How to use the ember-source/dist/ember-template-compiler.registerPlugin function in ember-source

To help you get started, we’ve selected a few ember-source 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 rwjblue / ember-angle-bracket-invocation-polyfill / lib / sample-compile-script.js View on Github external
'use strict';
/* eslint-disable node/no-unpublished-require */

/*
  This script is pretty useful for launching a single template compilation
  with our script:

  node --inspect-brk lib/sample-compile-script.js
*/

const compiler = require('ember-source/dist/ember-template-compiler');
compiler.registerPlugin('ast', require('./ast-transform'));

let template = '<@nav.item />';
let output = compiler.precompile(template, { contents: template });
console.log(output); // eslint-disable-line no-console
github hashicorp / nomad / ui / .storybook / babel.config.js View on Github external
/* eslint-env node */

// Inject the named blocks polyfill into the template compiler (and then into the babel plugin)
const templateCompiler = require('ember-source/dist/ember-template-compiler');
const namedBlocksPolyfillPlugin = require('ember-named-blocks-polyfill/lib/named-blocks-polyfill-plugin');

templateCompiler.registerPlugin('ast', namedBlocksPolyfillPlugin);

module.exports = {
  presets: [
    [
      '@babel/preset-env',
      {
        shippedProposals: true,
        useBuiltIns: 'usage',
        corejs: '3',
        targets: ['last 1 Chrome versions', 'last 1 Firefox versions', 'last 1 Safari versions'],
      },
    ],
  ],
  plugins: [
    [
      '@babel/plugin-proposal-decorators',