Home Reference Source Test Repository

Function

Static Public Summary
public

Returns what electron-compile would use as a default rootCacheDir.

public

Creates a compiler host from a .babelrc file.

public

createCompilerHostFromBabelRcSync(file: *, rootCacheDir: *): *

public

Creates a compiler host from a .compilerc file.

public

createCompilerHostFromConfigFileSync(file: *, rootCacheDir: *): *

public

Creates a configured CompilerHost instance from the project root directory.

public

createCompilerHostFromProjectRootSync(rootDir: *, rootCacheDir: *): *

public

Allows you to create new instances of all compilers that are supported by electron-compile and use them directly.

public

forAllFilesSync(rootDirectory: *, func: *, args: ...*)

public

Returns the default .configrc if no configuration information can be found.

public

init(appRoot: string, mainModule: string, productionMode: bool)

Initialize electron-compile and set it up, either for development or production use.

public

Initialize the global hooks (protocol hook for file:, node.js hook) independent of initializing the compiler.

public

Initializes the protocol hook on file: that allows us to intercept files loaded by Chromium and rewrite them.

public

Initializes the node.js hook that allows us to intercept files loaded by node.js and rewrite them.

Static Public

public calculateDefaultCompileCacheDirectory(): string source

import {calculateDefaultCompileCacheDirectory} from 'electron-compile/src/config-parser.js'

Returns what electron-compile would use as a default rootCacheDir. Usually only used for debugging purposes

Return:

string

A path that may or may not exist where electron-compile would set up a development mode cache.

public createCompilerHostFromBabelRc(file: string, rootCacheDir: string): Promise<CompilerHost> source

import {createCompilerHostFromBabelRc} from 'electron-compile/src/config-parser.js'

Creates a compiler host from a .babelrc file. This method is usually called from createCompilerHostFromProjectRoot instead of used directly.

Params:

NameTypeAttributeDescription
file string

The path to a .babelrc file

rootCacheDir string

(optional) The directory to use as a cache.

Return:

Promise<CompilerHost>

A set-up compiler host

public createCompilerHostFromBabelRcSync(file: *, rootCacheDir: *): * source

import {createCompilerHostFromBabelRcSync} from 'electron-compile/src/config-parser.js'

Params:

NameTypeAttributeDescription
file *
rootCacheDir *
  • optional
  • default: null

Return:

*

public createCompilerHostFromConfigFile(file: string, rootCacheDir: string): Promise<CompilerHost> source

import {createCompilerHostFromConfigFile} from 'electron-compile/src/config-parser.js'

Creates a compiler host from a .compilerc file. This method is usually called from createCompilerHostFromProjectRoot instead of used directly.

Params:

NameTypeAttributeDescription
file string

The path to a .compilerc file

rootCacheDir string

(optional) The directory to use as a cache.

Return:

Promise<CompilerHost>

A set-up compiler host

public createCompilerHostFromConfigFileSync(file: *, rootCacheDir: *): * source

import {createCompilerHostFromConfigFileSync} from 'electron-compile/src/config-parser.js'

Params:

NameTypeAttributeDescription
file *
rootCacheDir *
  • optional
  • default: null

Return:

*

public createCompilerHostFromProjectRoot(rootDir: string, rootCacheDir: string): Promise<CompilerHost> source

import {createCompilerHostFromProjectRoot} from 'electron-compile/src/config-parser.js'

Creates a configured CompilerHost instance from the project root directory. This method first searches for a .compilerc, then falls back to the default locations for Babel configuration info. If neither are found, defaults to standard settings

Params:

NameTypeAttributeDescription
rootDir string

The root application directory (i.e. the directory that has the app's package.json)

rootCacheDir string

(optional) The directory to use as a cache.

Return:

Promise<CompilerHost>

A set-up compiler host

public createCompilerHostFromProjectRootSync(rootDir: *, rootCacheDir: *): * source

import {createCompilerHostFromProjectRootSync} from 'electron-compile/src/config-parser.js'

Params:

NameTypeAttributeDescription
rootDir *
rootCacheDir *
  • optional
  • default: null

Return:

*

public createCompilers(): Object source

import {createCompilers} from 'electron-compile/src/config-parser.js'

Allows you to create new instances of all compilers that are supported by electron-compile and use them directly. Currently supports Babel, CoffeeScript, TypeScript, LESS, and Jade.

Return:

Object

An Object whose Keys are MIME types, and whose values are instances of @{link CompilerBase}.

public forAllFilesSync(rootDirectory: *, func: *, args: ...*) source

import {forAllFilesSync} from 'electron-compile/src/for-all-files.js'

Params:

NameTypeAttributeDescription
rootDirectory *
func *
args ...*

public getDefaultConfiguration(): Object source

import {getDefaultConfiguration} from 'electron-compile/src/config-parser.js'

Returns the default .configrc if no configuration information can be found.

Return:

Object

A list of default config settings for electron-compiler.

public init(appRoot: string, mainModule: string, productionMode: bool) source

Initialize electron-compile and set it up, either for development or production use. This is almost always the only method you need to use in order to use electron-compile.

Params:

NameTypeAttributeDescription
appRoot string

The top-level directory for your application (i.e. the one which has your package.json).

mainModule string

The module to require in, relative to the module calling init, that will start your app. Write this as if you were writing a require call from here.

productionMode bool

If explicitly True/False, will set read-only mode to be disabled/enabled. If not, we'll guess based on the presence of a production cache.

public initializeGlobalHooks(compilerHost: CompilerHost) source

import {initializeGlobalHooks} from 'electron-compile/src/config-parser.js'

Initialize the global hooks (protocol hook for file:, node.js hook) independent of initializing the compiler. This method is usually called by init instead of directly

Params:

NameTypeAttributeDescription
compilerHost CompilerHost

The compiler host to use.

public initializeProtocolHook(compilerHost: CompilerHost) source

import {initializeProtocolHook} from 'electron-compile/src/protocol-hook.js'

Initializes the protocol hook on file: that allows us to intercept files loaded by Chromium and rewrite them. This method along with registerRequireExtension are the top-level methods that electron-compile actually uses to intercept code that Electron loads.

Params:

NameTypeAttributeDescription
compilerHost CompilerHost

The compiler host to use for compilation.

public registerRequireExtension(compilerHost: CompilerHost) source

import registerRequireExtension from 'electron-compile/src/require-hook.js'

Initializes the node.js hook that allows us to intercept files loaded by node.js and rewrite them. This method along with initializeProtocolHook are the top-level methods that electron-compile actually uses to intercept code that Electron loads.

Params:

NameTypeAttributeDescription
compilerHost CompilerHost

The compiler host to use for compilation.