How to use the @glimmer/opcode-compiler.compilable function in @glimmer/opcode-compiler

To help you get started, we’ve selected a few @glimmer/opcode-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github glimmerjs / glimmer.js / packages / @glimmer / application-test-helpers / src / app-builder.ts View on Github external
protected buildBytecodeLoader(resolver: Resolver) {
    let delegate = new CompilerDelegate(resolver);
    let compiler = new BundleCompiler(delegate);

    let mainLocator = locatorFor('template:mainTemplate', 'default');
    mainLocator.meta.module = 'template:mainTemplate';

    let block = JSON.parse(mainTemplate.block);
    let compilableTemplate = compilable({
      block,
      referrer: mainLocator.meta,
    });

    compiler.addCompilableTemplate(mainLocator, compilableTemplate);

    for (let module in this.templates) {
      compiler.addTemplateSource(locatorFor(module, 'default'), this.templates[module]);
    }

    let { heap, pool, table } = compiler.compile();

    let resolverTable: unknown[] = [];

    let meta: Dict = {};
github glimmerjs / glimmer.js / packages / @glimmer / app-compiler / src / bundle-compiler.ts View on Github external
build() {
    this.createBundleCompiler();

    let { outputPath } = this;

    let locator = this.delegate.templateLocatorFor({
      module: '@glimmer/application',
      name: 'mainLayout',
    });
    let block = JSON.parse(mainTemplate.block);
    let compilableTemplate = compilable({
      block,
      referrer: locator.meta,
      asPartial: false,
    });

    this.compiler.addCompilableTemplate(locator, compilableTemplate);

    let [projectPath] = this.inputPaths;

    this.listEntries().forEach((entry: WalkSyncEntry) => {
      let { relativePath } = entry;
      if (entry.isDirectory()) {
        mkdirSync(join(outputPath, relativePath));
      } else {
        let content = this._readFile(relativePath);
        if (extname(relativePath) === '.hbs') {
github glimmerjs / glimmer-vm / packages / @glimmer / bundle-compiler / lib / bundle-compiler.ts View on Github external
addTemplateSource(_locator: ModuleLocator, templateSource: string): SerializedTemplateBlock {
    let locator = normalizeLocator(_locator);

    let block = this.preprocess(locator, templateSource);
    this.context.compiledBlocks.set(locator, block);

    let layout = {
      block,
      referrer: locator,
      asPartial: false,
    };

    let template = compilable(layout);

    this.addCompilableTemplate(locator, template);

    return block;
  }