@glimmer/app-compiler
TypeScript icon, indicating that this package has built-in type declarations

1.1.2 • Public • Published

@glimmer/app-compiler

A broccoli plugin that wraps Glimmer's optimizing compiler for producing the required pre-computed objects for Glimmer VM based applications.

Basic Usage

For most apps the plugin can be used as the following:

import { BundleCompiler } from '@glimmer/app-compiler';
...

let optimizedApp = BundleCompiler(app, {
  projectPath: 'my-app',
  mode: 'module-unification'
});

return optimizedApp;

Advanced Usage

If you need to do more advanced things like registering AST plugins or using custom project layout you can do something like the following:

import { BundleCompiler } from '@glimmer/app-compiler';
import { BundleCompilerDelegate } from '@glimmer/compiler-delegates'
...

class MyCustomCompilerDelegate implements BundleCompilerDelegate {
  ...
}

let optimizedApp = BundleCompiler(app, {
  projectPath: 'my-app',
  delegate: MyCustomCompilerDelegate,
  outputFiles: {
    heapFile: 'snowflake/location/template.gbx',
    dataSegment: 'snowflake/data.js'
  },
  bundleCompiler: {
    plugins: [MyASTPlugin]
  }
});

return optimizedApp;

Options

interface GlimmerBundleCompilerOptions {
  projectPath: string;                      // where the project is at
  bundleCompiler: BundleCompilerOptions;    // Options specifically for the compiler
  outputFiles?: OutputFiles;                // Where to write the output
  delegate?: BundleCompilerDelegateConstructor; // Delegate to discover information about templates
  mode?: 'module-unification';              // Builtin delegate
}

interface BundleCompilerDelegateConstructor {
  new(): BundleCompilerDelegate;
}

export interface OutputFiles {
  dataSegment: Option<string>;
  heapFile: Option<string>;
}

interface BundleCompilerOptions {
  plugins?: ASTPluginBuilder[];
}

Readme

Keywords

none

Package Sidebar

Install

npm i @glimmer/app-compiler

Weekly Downloads

71

Version

1.1.2

License

MIT

Unpacked Size

67.3 kB

Total Files

13

Last publish

Collaborators

  • nullvoxpopuli
  • glimmer-vm-github-actions
  • tomdale
  • rwjblue
  • dgeb
  • locks
  • chancancode
  • wycats
  • chadhietala
  • krisselden
  • stefanpenner
  • mmun
  • mixonic
  • pzuraq