How to use the @glimmer/compiler.precompile function in @glimmer/compiler

To help you get started, we’ve selected a few @glimmer/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 bakerac4 / glimmer-native / src / glimmer / context.ts View on Github external
export function Compilable(source: any) {
    // console.log('In Compilable: ' + source);
    const precompiled = precompile(source);
    // console.log('Precompiled');
    const component = Component(precompiled);
    // console.log(`Compiled Component: ${component}`);
    return component;
}
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment.ts View on Github external
compile(template: string, meta: TemplateMeta = {}): Template {
    let wrapper = JSON.parse(precompile(template, { meta }));
    let factory = templateFactory(wrapper);
    return factory.create(this.compileOptions);
  }
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment / modes / lazy / environment.ts View on Github external
preprocess(
    template: string,
    meta?: AnnotatedModuleLocator
  ): Template> {
    let wrapper = JSON.parse(precompile(template));
    let factory = templateFactory(wrapper);
    return factory.create(templateMeta(meta || DEFAULT_TEST_META));
  }
github glimmerjs / glimmer-vm / packages / @glimmer / integration-tests / lib / compile.ts View on Github external
export function createTemplate(
  templateSource: string,
  options?: PrecompileOptions
): TemplateFactory {
  let wrapper: SerializedTemplateWithLazyBlock = JSON.parse(
    rawPrecompile(templateSource, options)
  );
  return templateFactory(wrapper);
}
github glimmerjs / glimmer-vm / packages / @glimmer / test-helpers / lib / environment / shared.ts View on Github external
export function createTemplate(templateSource: string, meta: TemplateMeta = {}): ParsedLayout {
  let wrapper: SerializedTemplateWithLazyBlock = JSON.parse(precompile(templateSource, { meta }));
  let block: SerializedTemplateBlock = JSON.parse(wrapper.block);

  return { block, referer: meta };
}
github glimmerjs / glimmer-vm / packages / @glimmer / integration-tests / lib / suites / custom-dom-helper.ts View on Github external
'generates id in node'() {
    let template = precompile('hello');
    let obj = JSON.parse(template);
    this.assert.equal(obj.id, '14+n+4pQ', 'short sha of template source');
    template = precompile('hello', { meta: { moduleName: 'template/hello' } });
    obj = JSON.parse(template);
    this.assert.equal(obj.id, 'Ohs2KKrA', 'short sha of template source and meta');
  }
}
github bakerac4 / glimmer-native / dist / index.js View on Github external
registerNativeComponent(name, value) {
        this.registerNativeElement(name, value);
        const handle = Application.resolver.registerTemplateOnlyComponent(name);
        Application.resolverDelegate.registerComponent(name, handle, precompile(`<${name.toLowerCase()} ...attributes> {{yield}} `), TEMPLATE_ONLY_COMPONENT);
    }
    registerHelper(name, func) {
github glimmerjs / glimmer-application-pipeline / lib / broccoli / glimmer-template-precompiler.ts View on Github external
processString(content, relativePath) {
    let specifier = getTemplateSpecifier(this.options.rootName, relativePath);
    return 'export default ' + precompile(content, { meta: { specifier, '': true } }) + ';';
  }
}
github html-next / optimizing-css-compiler / lib / optimize / process-templates-tree.js View on Github external
return walkTree(templatesDir, (relativePath, fileData) => {
    let moduleName = relativePath.substr(templatesDir.length + 1);
    let isComponent = false;
    moduleName = moduleName.replace('.hbs', '');
    let componentName;

    if (moduleName.indexOf(COMPONENT_PATH) === 0) {
      isComponent = true;
      componentName = moduleName.substr(COMPONENT_PATH.length);
    }

    precompile(fileData, {
      rawSource: fileData,
      isComponent,
      moduleName,
      componentName,
      availableGraph:stylesGraph,
      usedGraph:usedStylesGraph,
      plugins: {
        ast: [htmlGraphBuilder]
      }
    });
  }).then(() => {
    return usedStylesGraph;

@glimmer/compiler

MIT
Latest version published 2 months ago

Package Health Score

77 / 100
Full package analysis

Similar packages