@glimmer/app-compiler

Broccoli tooling for Glimmer-VM based applications

Stats

StarsIssuesVersionUpdatedCreatedSize
@glimmer/app-compiler
1.0.47 months ago4 years agoMinified + gzip package size for @glimmer/app-compiler in KB

Readme

@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[];
}

If you find any bugs or have a feature request, please open an issue on github!

The npm package download data comes from npm's download counts api and package details come from npms.io.