RSX Code Reference
    Preparing search index...

    Class ScriptModuleCompiler

    Abstract class that abstracts the ScriptAPI module compiler.

    The responsibility of the module compiler is to take a set of TypeScript source files and transform them into JavaScript source that can be loaded into the engine on runtime.

    Index
    • Creates a new ScriptModuleCompiler instance for the current ScriptAPI implementation.

      Parameters

      • OptionalisInternalConstructor: boolean

      Returns ScriptModuleCompiler

      A newly created ScriptModuleCompiler instance.

    • get isCompilationInProgress(): boolean

      Determines if the compilation task is active or not.

      Returns boolean

    • Starts the module compilation.

      Compiling modules can be an expensive operation so the implementation is free to run it asynchronously and return AsyncOp that will be fulfilled once the worker thread is done with the module compilation.

      Parameters

      Returns AsyncOp<TypeScriptModuleCompilationResult>

      An AsyncOp that will be completed once the module compilation finishes.

      If the compilation fails, errors will be included in the ScriptModuleCompilerResult object returned by the AsyncOp.

      Only a single compilation can be running at the same. Trying to start the same compilation again will result in an error. Also note that once the compilation has started, sources cannot be added, updated or removed from the compiler until the process is done.

    • Registers a new source file for compilation.

      Parameters

      • virtualPath: FilePath

        The file virtual path to be added.

      • content: string

        The contents of the file.

      Returns void

    • Unregisters an existing file. Can only be called for already registered source files.

      Parameters

      • virtualPath: FilePath

        The file virtual path to be removed.

      Returns void

    • Updates an existing file with new contents. Can only be called for already registered source files.

      Parameters

      • virtualPath: FilePath

        The file virtual path to update the contents.

      • content: string

        The new contents of the file.

      Returns void