babel-plugin-ember-template-compilation
Advanced tools
Comparing version 1.1.0-alpha.1 to 2.0.0-alpha.0
{ | ||
"name": "babel-plugin-ember-template-compilation", | ||
"version": "1.1.0-alpha.1", | ||
"version": "2.0.0-alpha.0", | ||
"description": "Babel implementation of Ember's low-level template-compilation API", | ||
@@ -47,2 +47,3 @@ "repository": "https://github.com/emberjs/babel-plugin-ember-template-compilation", | ||
"@types/jest": "^26.0.23", | ||
"@types/sinon": "^10.0.13", | ||
"@typescript-eslint/eslint-plugin": "^4.28.4", | ||
@@ -60,2 +61,3 @@ "@typescript-eslint/parser": "^4.28.4", | ||
"release-it-lerna-changelog": "^3.1.0", | ||
"sinon": "^14.0.0", | ||
"typescript": "^4.3.5" | ||
@@ -62,0 +64,0 @@ }, |
import type { types as t } from '@babel/core'; | ||
import type * as Babel from '@babel/core'; | ||
import type { NodePath } from '@babel/traverse'; | ||
import type { ASTv1, WalkerPath } from '@glimmer/syntax'; | ||
import type { ASTPluginBuilder, ASTPluginEnvironment, ASTv1, WalkerPath } from '@glimmer/syntax'; | ||
import type { ImportUtil } from 'babel-import-util'; | ||
import type { State } from './plugin'; | ||
export declare class JSUtils { | ||
#private; | ||
constructor(babel: typeof Babel, program: NodePath<t.Program>, template: NodePath<t.Expression>, locals: string[], importer: ImportUtil); | ||
constructor(babel: typeof Babel, state: State<unknown>, template: NodePath<t.Expression>, locals: string[], importer: ImportUtil); | ||
/** | ||
@@ -70,2 +71,3 @@ * Create a new binding that you can use in your template, initialized with | ||
} & T; | ||
export declare type ExtendedPluginBuilder = ASTPluginBuilder<WithJSUtils<ASTPluginEnvironment>>; | ||
/** | ||
@@ -72,0 +74,0 @@ * Allows you to construct an expression that relies on imported values. |
@@ -13,3 +13,3 @@ "use strict"; | ||
}; | ||
var _JSUtils_instances, _JSUtils_babel, _JSUtils_program, _JSUtils_template, _JSUtils_locals, _JSUtils_importer, _JSUtils_lastInsertedPath, _JSUtils_emitStatement, _JSUtils_parseExpression, _ExpressionContext_importer, _ExpressionContext_target; | ||
var _JSUtils_instances, _JSUtils_babel, _JSUtils_state, _JSUtils_template, _JSUtils_locals, _JSUtils_importer, _JSUtils_emitStatement, _JSUtils_parseExpression, _ExpressionContext_importer, _ExpressionContext_target; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
@@ -20,12 +20,11 @@ exports.JSUtils = void 0; | ||
class JSUtils { | ||
constructor(babel, program, template, locals, importer) { | ||
constructor(babel, state, template, locals, importer) { | ||
_JSUtils_instances.add(this); | ||
_JSUtils_babel.set(this, void 0); | ||
_JSUtils_program.set(this, void 0); | ||
_JSUtils_state.set(this, void 0); | ||
_JSUtils_template.set(this, void 0); | ||
_JSUtils_locals.set(this, void 0); | ||
_JSUtils_importer.set(this, void 0); | ||
_JSUtils_lastInsertedPath.set(this, void 0); | ||
__classPrivateFieldSet(this, _JSUtils_babel, babel, "f"); | ||
__classPrivateFieldSet(this, _JSUtils_program, program, "f"); | ||
__classPrivateFieldSet(this, _JSUtils_state, state, "f"); | ||
__classPrivateFieldSet(this, _JSUtils_template, template, "f"); | ||
@@ -53,5 +52,6 @@ __classPrivateFieldSet(this, _JSUtils_locals, locals, "f"); | ||
let t = __classPrivateFieldGet(this, _JSUtils_babel, "f").types; | ||
__classPrivateFieldGet(this, _JSUtils_instances, "m", _JSUtils_emitStatement).call(this, t.variableDeclaration('let', [ | ||
t.variableDeclarator(t.identifier(name), __classPrivateFieldGet(this, _JSUtils_instances, "m", _JSUtils_parseExpression).call(this, __classPrivateFieldGet(this, _JSUtils_program, "f"), expression)), | ||
let declaration = __classPrivateFieldGet(this, _JSUtils_instances, "m", _JSUtils_emitStatement).call(this, t.variableDeclaration('let', [ | ||
t.variableDeclarator(t.identifier(name), __classPrivateFieldGet(this, _JSUtils_instances, "m", _JSUtils_parseExpression).call(this, __classPrivateFieldGet(this, _JSUtils_state, "f").program, expression)), | ||
])); | ||
declaration.scope.registerBinding('module', declaration.get('declarations.0')); | ||
__classPrivateFieldGet(this, _JSUtils_locals, "f").push(name); | ||
@@ -113,13 +113,14 @@ return name; | ||
let t = __classPrivateFieldGet(this, _JSUtils_babel, "f").types; | ||
__classPrivateFieldGet(this, _JSUtils_instances, "m", _JSUtils_emitStatement).call(this, t.expressionStatement(__classPrivateFieldGet(this, _JSUtils_instances, "m", _JSUtils_parseExpression).call(this, __classPrivateFieldGet(this, _JSUtils_program, "f"), expression))); | ||
__classPrivateFieldGet(this, _JSUtils_instances, "m", _JSUtils_emitStatement).call(this, t.expressionStatement(__classPrivateFieldGet(this, _JSUtils_instances, "m", _JSUtils_parseExpression).call(this, __classPrivateFieldGet(this, _JSUtils_state, "f").program, expression))); | ||
} | ||
} | ||
exports.JSUtils = JSUtils; | ||
_JSUtils_babel = new WeakMap(), _JSUtils_program = new WeakMap(), _JSUtils_template = new WeakMap(), _JSUtils_locals = new WeakMap(), _JSUtils_importer = new WeakMap(), _JSUtils_lastInsertedPath = new WeakMap(), _JSUtils_instances = new WeakSet(), _JSUtils_emitStatement = function _JSUtils_emitStatement(statement) { | ||
if (__classPrivateFieldGet(this, _JSUtils_lastInsertedPath, "f")) { | ||
__classPrivateFieldGet(this, _JSUtils_lastInsertedPath, "f").insertAfter(statement); | ||
_JSUtils_babel = new WeakMap(), _JSUtils_state = new WeakMap(), _JSUtils_template = new WeakMap(), _JSUtils_locals = new WeakMap(), _JSUtils_importer = new WeakMap(), _JSUtils_instances = new WeakSet(), _JSUtils_emitStatement = function _JSUtils_emitStatement(statement) { | ||
if (__classPrivateFieldGet(this, _JSUtils_state, "f").lastInsertedPath) { | ||
__classPrivateFieldGet(this, _JSUtils_state, "f").lastInsertedPath = __classPrivateFieldGet(this, _JSUtils_state, "f").lastInsertedPath.insertAfter(statement)[0]; | ||
} | ||
else { | ||
__classPrivateFieldSet(this, _JSUtils_lastInsertedPath, __classPrivateFieldGet(this, _JSUtils_program, "f").unshiftContainer('body', statement)[0], "f"); | ||
__classPrivateFieldGet(this, _JSUtils_state, "f").lastInsertedPath = __classPrivateFieldGet(this, _JSUtils_state, "f").program.unshiftContainer('body', statement)[0]; | ||
} | ||
return __classPrivateFieldGet(this, _JSUtils_state, "f").lastInsertedPath; | ||
}, _JSUtils_parseExpression = function _JSUtils_parseExpression(target, expression) { | ||
@@ -211,2 +212,2 @@ let expressionString; | ||
_ExpressionContext_importer = new WeakMap(), _ExpressionContext_target = new WeakMap(); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoianMtdXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJqcy11dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7QUFNQSw2RUFBNkU7QUFDN0UsK0JBQStCO0FBQy9CLE1BQWEsT0FBTztJQVFsQixZQUNFLEtBQW1CLEVBQ25CLE9BQTRCLEVBQzVCLFFBQWdDLEVBQ2hDLE1BQWdCLEVBQ2hCLFFBQW9COztRQVp0QixpQ0FBcUI7UUFDckIsbUNBQThCO1FBQzlCLG9DQUFrQztRQUNsQyxrQ0FBa0I7UUFDbEIsb0NBQXNCO1FBQ3RCLDRDQUFnRDtRQVM5Qyx1QkFBQSxJQUFJLGtCQUFVLEtBQUssTUFBQSxDQUFDO1FBQ3BCLHVCQUFBLElBQUksb0JBQVksT0FBTyxNQUFBLENBQUM7UUFDeEIsdUJBQUEsSUFBSSxxQkFBYSxRQUFRLE1BQUEsQ0FBQztRQUMxQix1QkFBQSxJQUFJLG1CQUFXLE1BQU0sTUFBQSxDQUFDO1FBQ3RCLHVCQUFBLElBQUkscUJBQWEsUUFBUSxNQUFBLENBQUM7SUFDNUIsQ0FBQztJQUVEOzs7Ozs7Ozs7Ozs7O09BYUc7SUFDSCxjQUFjLENBQ1osVUFBc0IsRUFDdEIsTUFBOEIsRUFDOUIsSUFBNEI7O1FBRTVCLElBQUksSUFBSSxHQUFHLGNBQWMsQ0FDdkIsTUFBQSxJQUFJLGFBQUosSUFBSSx1QkFBS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hcyBuZWVkZWQgdG8gYXZvaWQgY29sbGlzaW9ucywgYnV0XG4gICAqIHBpY2tpbmcgYSBnb29kIG5hbWUgaGVyZSBjYW4gYWlkIGluIGRlYnVnZ2luZy5cblxuICAgKiBAcmV0dXJuIHRoZSBsb2NhbCBpZGVudGlmaWVyIGZvciB0aGUgaW1wb3J0ZWQgdmFsdWVcbiAgICovXG4gIGltcG9ydChtb2R1bGVTcGVjaWZpZXI6IHN0cmluZywgZXhwb3J0ZWROYW1lOiBzdHJpbmcsIG5hbWVIaW50Pzogc3RyaW5nKTogc3RyaW5nIHtcbiAgICByZXR1cm4gdGhpcy4jaW1wb3J0ZXIuaW1wb3J0KHRoaXMuI3RhcmdldCwgbW9kdWxlU3BlY2lmaWVyLCBleHBvcnRlZE5hbWUsIG5hbWVIaW50KS5uYW1lO1xuICB9XG59XG5cbi8qKlxuICogWW91IGNhbiBwYXNzIGEgSmF2YXNjcmlwdCBleHByZXNzaW9uIGFzIGEgc3RyaW5nIGxpa2U6XG4gKlxuICogICBcIm5ldyBEYXRlKClcIlxuICpcbiAqIE9yIGFzIGEgZnVuY3Rpb24gdGhhdCByZXR1cm5zIGEgc3RyaW5nOlxuICpcbiAqICAgKCkgPT4gXCJuZXcgRGF0ZSgpXCJcbiAqXG4gKiBXaGVuIHlvdSB1c2UgYSBmdW5jdGlvbiwgaXQgY2FuIHVzZSBpbXBvcnRlZCB2YWx1ZXM6XG4gKlxuICogICAoY29udGV4dCkgPT4gYG5ldyAke2NvbnRleHQuaW1wb3J0KFwibHV4b25cIiwgXCJEYXRlVGltZVwiKX0oKWBcbiAqXG4gKi9cbmV4cG9ydCB0eXBlIEV4cHJlc3Npb24gPSBzdHJpbmcgfCAoKGNvbnRleHQ6IEV4cHJlc3Npb25Db250ZXh0KSA9PiBzdHJpbmcpO1xuIl19 |
@@ -1,14 +0,15 @@ | ||
import type * as Babel from '@babel/core'; | ||
import { Options as PluginOptions, EmberPrecompile } from './plugin'; | ||
export interface Options extends PluginOptions { | ||
precompilerPath?: string; | ||
precompile?: EmberPrecompile; | ||
} | ||
declare const htmlbarsInlinePrecompile: { | ||
(babel: typeof Babel): Babel.PluginObj<Options>; | ||
import { Options as SharedOptions } from './plugin'; | ||
import { EmberTemplateCompiler } from './ember-template-compiler'; | ||
import { ExtendedPluginBuilder } from './js-utils'; | ||
export declare type Options = Omit<SharedOptions, 'transforms' | 'compiler'> & { | ||
compilerPath?: string; | ||
compiler?: EmberTemplateCompiler; | ||
transforms?: (ExtendedPluginBuilder | string)[]; | ||
}; | ||
declare const _default: ((babel: typeof import("@babel/core")) => import("@babel/core").PluginObj<import("./plugin").State<Options>>) & { | ||
baseDir(): string; | ||
_parallelBabel: { | ||
requireFile: string; | ||
}; | ||
baseDir(): string; | ||
}; | ||
export default htmlbarsInlinePrecompile; | ||
export default _default; |
@@ -8,12 +8,32 @@ "use strict"; | ||
const plugin_1 = __importDefault(require("./plugin")); | ||
const htmlbarsInlinePrecompile = plugin_1.default(function (opts) { | ||
if (opts.precompilerPath) { | ||
const ember_template_compiler_1 = require("./ember-template-compiler"); | ||
function handleNodeSpecificOptions(opts) { | ||
let compiler; | ||
if (opts.compilerPath) { | ||
// eslint-disable-next-line @typescript-eslint/no-var-requires | ||
let mod = require(opts.precompilerPath); | ||
return mod.precompile; | ||
let mod = require(opts.compilerPath); | ||
ember_template_compiler_1.assertTemplateCompiler(mod); | ||
compiler = mod; | ||
} | ||
else if (opts.precompile) { | ||
return opts.precompile; | ||
else if (opts.compiler) { | ||
ember_template_compiler_1.assertTemplateCompiler(opts.compiler); | ||
compiler = opts.compiler; | ||
} | ||
}); | ||
else { | ||
throw new Error(`must provide compilerPath or compiler`); | ||
} | ||
let transforms = []; | ||
if (opts.transforms) { | ||
transforms = opts.transforms.map((t) => { | ||
if (typeof t === 'string') { | ||
return require(t); | ||
} | ||
else { | ||
return t; | ||
} | ||
}); | ||
} | ||
return Object.assign(Object.assign({}, opts), { transforms, compiler }); | ||
} | ||
const htmlbarsInlinePrecompile = plugin_1.default(handleNodeSpecificOptions); | ||
htmlbarsInlinePrecompile._parallelBabel = { | ||
@@ -26,2 +46,2 @@ requireFile: __filename, | ||
exports.default = htmlbarsInlinePrecompile; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibm9kZS1tYWluLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsibm9kZS1tYWluLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7O0FBQUEsK0JBQStCO0FBQy9CLHNEQUFrQztBQXNCbEMsTUFBTSx3QkFBd0IsR0FBRyxnQkFBVSxDQUFDLFVBQVUsSUFBYTtJQUNqRSxJQUFJLElBQUksQ0FBQyxlQUFlLEVBQUU7UUFDeEIsOERBQThEO1FBQzlELElBQUksR0FBRyxHQUFRLE9BQU8sQ0FBQyxJQUFJLENBQUMsZUFBZSxDQUFDLENBQUM7UUFDN0MsT0FBTyxHQUFHLENBQUMsVUFBVSxDQUFDO0tBQ3ZCO1NBQU0sSUFBSSxJQUFJLENBQUMsVUFBVSxFQUFFO1FBQzFCLE9BQU8sSUFBSSxDQUFDLFVBQVUsQ0FBQztLQUN4QjtBQUNILENBQUMsQ0FJQSxDQUFDO0FBRUYsd0JBQXdCLENBQUMsY0FBYyxHQUFHO0lBQ3hDLFdBQVcsRUFBRSxVQUFVO0NBQ3hCLENBQUM7QUFFRix3QkFBd0IsQ0FBQyxPQUFPLEdBQUc7SUFDakMsT0FBTyxjQUFPLENBQUMsU0FBUyxFQUFFLElBQUksQ0FBQyxDQUFDO0FBQ2xDLENBQUMsQ0FBQztBQUVGLGtCQUFlLHdCQUF3QixDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0IHsgcmVzb2x2ZSB9IGZyb20gJ3BhdGgnO1xuaW1wb3J0IG1ha2VQbHVnaW4gZnJvbSAnLi9wbHVnaW4nO1xuaW1wb3J0IHR5cGUgKiBhcyBCYWJlbCBmcm9tIC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KG9wdHMudHJhbnNmb3Jtcykge1xuICAgIHRyYW5zZm9ybXMgPSBvcHRzLnRyYW5zZm9ybXMubWFwKCh0KSA9PiB7XG4gICAgICBpZiAodHlwZW9mIHQgPT09ICdzdHJpbmcnKSB7XG4gICAgICAgIHJldHVybiByZXF1aXJlKHQpO1xuICAgICAgfSBlbHNlIHtcbiAgICAgICAgcmV0dXJuIHQ7XG4gICAgICB9XG4gICAgfSk7XG4gIH1cbiAgcmV0dXJuIHsgLi4ub3B0cywgdHJhbnNmb3JtcywgY29tcGlsZXIgfTtcbn1cblxuY29uc3QgaHRtbGJhcnNJbmxpbmVQcmVjb21waWxlID0gbWFrZVBsdWdpbihoYW5kbGVOb2RlU3BlY2lmaWNPcHRpb25zKTtcblxuKGh0bWxiYXJzSW5saW5lUHJlY29tcGlsZSBhcyBhbnkpLl9wYXJhbGxlbEJhYmVsID0ge1xuICByZXF1aXJlRmlsZTogX19maWxlbmFtZSxcbn07XG5cbihodG1sYmFyc0lubGluZVByZWNvbXBpbGUgYXMgYW55KS5iYXNlRGlyID0gZnVuY3Rpb24gKCkge1xuICByZXR1cm4gcmVzb2x2ZShfX2Rpcm5hbWUsICcuLicpO1xufTtcblxuZXhwb3J0IGRlZmF1bHQgaHRtbGJhcnNJbmxpbmVQcmVjb21waWxlIGFzIHR5cGVvZiBodG1sYmFyc0lubGluZVByZWNvbXBpbGUgJiB7XG4gIGJhc2VEaXIoKTogc3RyaW5nO1xuICBfcGFyYWxsZWxCYWJlbDogeyByZXF1aXJlRmlsZTogc3RyaW5nIH07XG59O1xuIl19 |
@@ -5,12 +5,16 @@ import type { NodePath } from '@babel/traverse'; | ||
import { ImportUtil } from 'babel-import-util'; | ||
export declare type EmberPrecompile = (templateString: string, options: Record<string, unknown>) => string; | ||
import { ExtendedPluginBuilder } from './js-utils'; | ||
import type { EmberTemplateCompiler } from './ember-template-compiler'; | ||
export declare type LegacyModuleName = 'ember-cli-htmlbars' | 'ember-cli-htmlbars-inline-precompile' | 'htmlbars-inline-precompile'; | ||
export interface Options { | ||
compiler: EmberTemplateCompiler; | ||
outputModuleOverrides?: Record<string, Record<string, [string, string]>>; | ||
enableLegacyModules?: LegacyModuleName[]; | ||
targetFormat?: 'wire' | 'hbs'; | ||
transforms?: ExtendedPluginBuilder[]; | ||
} | ||
interface State { | ||
opts: Options; | ||
export interface State<EnvSpecificOptions> { | ||
opts: EnvSpecificOptions; | ||
normalizedOpts: Required<Options>; | ||
util: ImportUtil; | ||
precompile: EmberPrecompile; | ||
templateFactory: { | ||
@@ -21,4 +25,5 @@ moduleName: string; | ||
program: NodePath<t.Program>; | ||
lastInsertedPath: NodePath<t.Statement> | undefined; | ||
filename: string; | ||
} | ||
export default function makePlugin<O>(loadPrecompiler: (opts: O) => EmberPrecompile): (babel: typeof Babel) => Babel.PluginObj<State>; | ||
export {}; | ||
export default function makePlugin<EnvSpecificOptions>(loadOptions: (opts: EnvSpecificOptions) => Options): (babel: typeof Babel) => Babel.PluginObj<State<EnvSpecificOptions>>; |
@@ -32,39 +32,5 @@ "use strict"; | ||
]; | ||
function makePlugin( | ||
// receives the Babel plugin options, returns Ember's precompiler | ||
loadPrecompiler) { | ||
function makePlugin(loadOptions) { | ||
return function htmlbarsInlinePrecompile(babel) { | ||
let t = babel.types; | ||
function insertCompiledTemplate(target, state, template, userTypedOptions) { | ||
if (!userTypedOptions.locals) { | ||
userTypedOptions.locals = []; | ||
} | ||
let jsutils = new js_utils_1.JSUtils(babel, state.program, target, userTypedOptions.locals, state.util); | ||
let meta = Object.assign({ jsutils }, userTypedOptions === null || userTypedOptions === void 0 ? void 0 : userTypedOptions.meta); | ||
let options = Object.assign({}, userTypedOptions, { contents: template, meta }); | ||
let precompile = state.precompile; | ||
let precompileResultString; | ||
if (options.insertRuntimeErrors) { | ||
try { | ||
precompileResultString = precompile(template, options); | ||
} | ||
catch (error) { | ||
target.replaceWith(runtimeErrorIIFE(babel, { ERROR_MESSAGE: error.message })); | ||
return; | ||
} | ||
} | ||
else { | ||
precompileResultString = precompile(template, options); | ||
} | ||
let precompileResultAST = babel.parse(`var precompileResult = ${precompileResultString};`, { | ||
babelrc: false, | ||
configFile: false, | ||
}); | ||
let templateExpression = precompileResultAST.program.body[0] | ||
.declarations[0].init; | ||
t.addComment(templateExpression, 'leading', `\n ${template.replace(/\*\//g, '*\\/')}\n`, | ||
/* line comment? */ false); | ||
let templateFactoryIdentifier = state.util.import(target, state.templateFactory.moduleName, state.templateFactory.exportName); | ||
target.replaceWith(t.callExpression(templateFactoryIdentifier, [templateExpression])); | ||
} | ||
return { | ||
@@ -74,16 +40,12 @@ visitor: { | ||
enter(path, state) { | ||
var _a, _b; | ||
let moduleName = '@ember/template-factory'; | ||
let exportName = 'createTemplateFactory'; | ||
let overrides = (_b = (_a = state.opts.outputModuleOverrides) === null || _a === void 0 ? void 0 : _a[moduleName]) === null || _b === void 0 ? void 0 : _b[exportName]; | ||
state.templateFactory = overrides | ||
? { exportName: overrides[0], moduleName: overrides[1] } | ||
: { exportName, moduleName }; | ||
state.normalizedOpts = Object.assign({ targetFormat: 'wire', outputModuleOverrides: {}, enableLegacyModules: [], transforms: [] }, loadOptions(state.opts)); | ||
state.templateFactory = templateFactoryConfig(state.normalizedOpts); | ||
state.util = new babel_import_util_1.ImportUtil(t, path); | ||
state.precompile = loadPrecompiler(state.opts); | ||
state.program = path; | ||
}, | ||
exit(_path, state) { | ||
for (let { moduleName, export: exportName } of configuredModules(state)) { | ||
state.util.removeImport(moduleName, exportName); | ||
if (state.normalizedOpts.targetFormat === 'wire') { | ||
for (let { moduleName, export: exportName } of configuredModules(state)) { | ||
state.util.removeImport(moduleName, exportName); | ||
} | ||
} | ||
@@ -108,3 +70,8 @@ }, | ||
let template = path.node.quasi.quasis.map((quasi) => quasi.value.cooked).join(''); | ||
insertCompiledTemplate(path, state, template, {}); | ||
if (state.normalizedOpts.targetFormat === 'wire') { | ||
insertCompiledTemplate(babel, state, template, path, {}); | ||
} | ||
else { | ||
insertTransformedTemplate(babel, state, template, path, {}, options); | ||
} | ||
}, | ||
@@ -147,3 +114,3 @@ CallExpression(path, state) { | ||
} | ||
userTypedOptions = new expression_parser_1.ExpressionParser(babel).parseObjectExpression(calleePath.node.name, secondArg, true); | ||
userTypedOptions = new expression_parser_1.ExpressionParser(babel).parseObjectExpression(calleePath.node.name, secondArg, options.enableScope); | ||
} | ||
@@ -153,3 +120,8 @@ if (restArgs.length > 0) { | ||
} | ||
insertCompiledTemplate(path, state, template, userTypedOptions); | ||
if (state.normalizedOpts.targetFormat === 'wire') { | ||
insertCompiledTemplate(babel, state, template, path, userTypedOptions); | ||
} | ||
else { | ||
insertTransformedTemplate(babel, state, template, path, userTypedOptions, options); | ||
} | ||
}, | ||
@@ -162,6 +134,5 @@ }, | ||
function* configuredModules(state) { | ||
var _a; | ||
for (let moduleConfig of INLINE_PRECOMPILE_MODULES) { | ||
if (moduleConfig.moduleName !== '@ember/template-compilation' && | ||
!((_a = state.opts.enableLegacyModules) === null || _a === void 0 ? void 0 : _a.includes(moduleConfig.moduleName))) { | ||
!state.normalizedOpts.enableLegacyModules.includes(moduleConfig.moduleName)) { | ||
continue; | ||
@@ -184,2 +155,134 @@ } | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsicGx1Z2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBR0EseURBQStDO0FBQy9DLDJEQUF1RDtBQUN2RCx5Q0FBcUM7QUFrQnJDLE1BQU0seUJBQXlCLEdBQW1CO0lBQ2hEO1FBQ0UsVUFBVSxFQUFFLG9CQUFvQjtRQUNoQyxNQUFNLEVBQUUsS0FBSztRQUNiLG9CQUFvQixFQUFFLElBQUk7UUFDMUIsV0FBVyxFQUFFLEtBQUs7S0FDbkI7SUFDRDtRQUNFLFVBQVUsRUFBRSxzQ0FBc0M7UUFDbEQsTUFBTSxFQU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B7XFxuICB0aHJvdyBuZXcgRXJyb3IoJ0VSUk9SX01FU1NBR0UnKTtcXG59KSgpO2ApKFxuICAgIHJlcGxhY2VtZW50c1xuICApIGFzIHQuRXhwcmVzc2lvblN0YXRlbWVudDtcbiAgcmV0dXJuIHN0YXRlbWVudC5leHByZXNzaW9uO1xufVxuIl19 | ||
function buildPrecompileOptions(babel, target, state, template, userTypedOptions) { | ||
if (!userTypedOptions.locals) { | ||
userTypedOptions.locals = []; | ||
} | ||
let jsutils = new js_utils_1.JSUtils(babel, state, target, userTypedOptions.locals, state.util); | ||
let meta = Object.assign({ jsutils }, userTypedOptions === null || userTypedOptions === void 0 ? void 0 : userTypedOptions.meta); | ||
return Object.assign({ | ||
contents: template, | ||
meta, | ||
// TODO: embroider's template-compiler allows this to be overriden to get | ||
// backward-compatible module names that don't match the real name of the | ||
// on-disk file. What's our plan for migrating people away from that? | ||
moduleName: state.filename, | ||
plugins: { | ||
ast: state.normalizedOpts.transforms, | ||
}, | ||
}, userTypedOptions); | ||
} | ||
function insertCompiledTemplate(babel, state, template, target, userTypedOptions) { | ||
let t = babel.types; | ||
let options = buildPrecompileOptions(babel, target, state, template, userTypedOptions); | ||
let precompileResultString; | ||
if (options.insertRuntimeErrors) { | ||
try { | ||
precompileResultString = state.normalizedOpts.compiler.precompile(template, options); | ||
} | ||
catch (error) { | ||
target.replaceWith(runtimeErrorIIFE(babel, { ERROR_MESSAGE: error.message })); | ||
return; | ||
} | ||
} | ||
else { | ||
precompileResultString = state.normalizedOpts.compiler.precompile(template, options); | ||
} | ||
let precompileResultAST = babel.parse(`var precompileResult = ${precompileResultString};`, { | ||
babelrc: false, | ||
configFile: false, | ||
}); | ||
let templateExpression = precompileResultAST.program.body[0] | ||
.declarations[0].init; | ||
t.addComment(templateExpression, 'leading', `\n ${template.replace(/\*\//g, '*\\/')}\n`, | ||
/* line comment? */ false); | ||
let templateFactoryIdentifier = state.util.import(target, state.templateFactory.moduleName, state.templateFactory.exportName); | ||
target.replaceWith(t.callExpression(templateFactoryIdentifier, [templateExpression])); | ||
} | ||
function insertTransformedTemplate(babel, state, template, target, userTypedOptions, formatOptions) { | ||
let t = babel.types; | ||
let options = buildPrecompileOptions(babel, target, state, template, userTypedOptions); | ||
let ast = state.normalizedOpts.compiler._preprocess(template, Object.assign(Object.assign({}, options), { mode: 'codemod' })); | ||
let transformed = state.normalizedOpts.compiler._print(ast); | ||
if (target.isCallExpression()) { | ||
target.get('arguments.0').replaceWith(t.stringLiteral(transformed)); | ||
if (options.locals && options.locals.length > 0) { | ||
if (!formatOptions.enableScope) { | ||
maybePruneImport(state.util, target.get('callee')); | ||
target.set('callee', precompileTemplate(state.util, target)); | ||
} | ||
updateScope(babel, target, options.locals); | ||
} | ||
} | ||
else { | ||
if (options.locals && options.locals.length > 0) { | ||
// need to add scope, so need to replace the backticks form with a call | ||
// expression to precompileTemplate | ||
maybePruneImport(state.util, target.get('tag')); | ||
let newCall = target.replaceWith(t.callExpression(precompileTemplate(state.util, target), [t.stringLiteral(transformed)]))[0]; | ||
updateScope(babel, newCall, options.locals); | ||
} | ||
else { | ||
target.get('quasi').get('quasis.0').replaceWith(t.templateElement({ raw: transformed })); | ||
} | ||
} | ||
} | ||
function templateFactoryConfig(opts) { | ||
var _a; | ||
let moduleName = '@ember/template-factory'; | ||
let exportName = 'createTemplateFactory'; | ||
let overrides = (_a = opts.outputModuleOverrides[moduleName]) === null || _a === void 0 ? void 0 : _a[exportName]; | ||
return overrides | ||
? { exportName: overrides[0], moduleName: overrides[1] } | ||
: { exportName, moduleName }; | ||
} | ||
function buildScope(babel, locals) { | ||
let t = babel.types; | ||
return t.arrowFunctionExpression([], t.objectExpression(locals.map((name) => t.objectProperty(t.identifier(name), t.identifier(name), false, true)))); | ||
} | ||
function updateScope(babel, target, locals) { | ||
let t = babel.types; | ||
let secondArg = target.get('arguments.1'); | ||
if (secondArg) { | ||
let scope = secondArg.get('properties').find((p) => { | ||
let key = p.get('key'); | ||
return key.isIdentifier() && key.node.name === 'scope'; | ||
}); | ||
if (scope) { | ||
scope.set('value', buildScope(babel, locals)); | ||
} | ||
else { | ||
secondArg.pushContainer('properties', t.objectProperty(t.identifier('scope'), buildScope(babel, locals))); | ||
} | ||
} | ||
else { | ||
target.pushContainer('arguments', t.objectExpression([t.objectProperty(t.identifier('scope'), buildScope(babel, locals))])); | ||
} | ||
} | ||
function maybePruneImport(util, identifier) { | ||
if (!identifier.isIdentifier()) { | ||
return; | ||
} | ||
let binding = identifier.scope.getBinding(identifier.node.name); | ||
// this checks if the identifier (that we're about to remove) is used in | ||
// exactly one place. | ||
if ((binding === null || binding === void 0 ? void 0 : binding.referencePaths.reduce((count, path) => (path.removed ? count : count + 1), 0)) === 1) { | ||
let specifier = binding.path; | ||
if (specifier.isImportSpecifier()) { | ||
let declaration = specifier.parentPath; | ||
util.removeImport(declaration.node.source.value, name(specifier.node.imported)); | ||
} | ||
} | ||
identifier.removed = true; | ||
} | ||
function precompileTemplate(util, target) { | ||
return util.import(target, '@ember/template-compilation', 'precompileTemplate'); | ||
} | ||
function name(node) { | ||
if (node.type === 'StringLiteral') { | ||
return node.value; | ||
} | ||
else { | ||
return node.name; | ||
} | ||
} | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGx1Z2luLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsicGx1Z2luLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7O0FBR0EseURBQStDO0FBQy9DLDJEQUF1RDtBQUN2RCx5Q0FBNEQ7QUFpQjVELE1BQU0seUJBQXlCLEdBQW1CO0lBQ2hEO1FBQ0UsVUFBVSxFQUFFLG9CQUFvQjtRQUNoQyxNQUFNLEVBQUUsS0FBSztRQUNiLG9CQUFvQixFQUFFLElBQUk7UUFDMUIsV0FBVyxFQUFFLEtBQUs7S0FDbkI7SUFDRDtRQUNFLFVBQVUsRUFBRSxzQ0FBc0M7UUFDbEQsTUFBTSxFQUF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vbnM6IFJlY29yZDxzdHJpbmcsIHVua25vd24+O1xuXG4gICAgICAgICAgaWYgKCFzZWNvbmRBcmcpIHtcbiAgICAgICAgICAgIHVzZXJUeXBlZE9wdGlvbnMgPSB7fTtcbiAgICAgICAgICB9IGVsc2Uge1xuICAgICAgICAgICAgaWYgKCFzZWNvbmRBcmcuaXNPYmplY3RFeHByZXNzaW9uKCkpIHtcbiAgICAgICAgICAgICAgdGhyb3cgcGF0aC5idWlsZENvZGVGcmFtZUVycm9yKFxuICAgICAgICAgICAgICAgIGAke2NhbGxlZVBhdGgubm9kZS5uYW1lfSBjYW4gb25seSBiZSBpbnZva2VkIHdpdGggMiBhcmd1bWVudHM6IHRoZSB0ZW1wbGF0ZSBzdHJpbmcsIGFuZCBhbnkgc3RhdGljIG9wdGlvbnNgXG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG5cbiAgICAgICAgICAgIHVzZXJUeXBlZE9wdGlvbnMgPSBuZXcgRXhwcmVzc2lvblBhcnNlcihiYWJlbCkucGFyc2VPYmplY3RFeHByZXNzaW9uKFxuICAgICAgICAgICAgICBjYWxsZWVQYXRoLm5vZGUubmFtZSxcbiAgICAgICAgICAgICAgc2Vjb25kQXJnLFxuICAgICAgICAgICAgICBvcHRpb25zLmVuYWJsZVNjb3BlXG4gICAgICAgICAgICApO1xuICAgICAgICAgIH1cbiAgICAgICAgICBpZiAocmVzdEFyZ3MubGVuZ3RoID4gMCkge1xuICAgICAgICAgICAgdGhyb3cgcGF0aC5idWlsZENvZGVGcmFtZUVycm9yKFxuICAgICAgICAgICAgICBgJHtjYWxsZWVQYXRoLm5vZGUubmFtZX0gY2FuIG9ubHkgYmUgaW52b2tlZCB3aXRoIDIgYXJndW1lbnRzOiB0aGUgdGVtcGxhdGUgc3RyaW5nLCBhbmQgYW55IHN0YXRpYyBvcHRpb25zYFxuICAgICAgICAgICAgKTtcbiAgICAgICAgICB9XG4gICAgICAgICAgaWYgKHN0YXRlLm5vcm1hbGl6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GF0aDtcbiAgICBpZiAoc3BlY2lmaWVyLmlzSW1wb3J0U3BlY2lmaWVyKCkpIHtcbiAgICAgIGxldCBkZWNsYXJhdGlvbiA9IHNwZWNpZmllci5wYXJlbnRQYXRoIGFzIE5vZGVQYXRoPHQuSW1wb3J0RGVjbGFyYXRpb24+O1xuICAgICAgdXRpbC5yZW1vdmVJbXBvcnQoZGVjbGFyYXRpb24ubm9kZS5zb3VyY2UudmFsdWUsIG5hbWUoc3BlY2lmaWVyLm5vZGUuaW1wb3J0ZWQpKTtcbiAgICB9XG4gIH1cbiAgaWRlbnRpZmllci5yZW1vdmVkID0gdHJ1ZTtcbn1cblxuZnVuY3Rpb24gcHJlY29tcGlsZVRlbXBsYXRlKHV0aWw6IEltcG9ydFV0aWwsIHRhcmdldDogTm9kZVBhdGg8dC5Ob2RlPikge1xuICByZXR1cm4gdXRpbC5pbXBvcnQodGFyZ2V0LCAnQGVtYmVyL3RlbXBsYXRlLWNvbXBpbGF0aW9uJywgJ3ByZWNvbXBpbGVUZW1wbGF0ZScpO1xufVxuXG5mdW5jdGlvbiBuYW1lKG5vZGU6IHQuU3RyaW5nTGl0ZXJhbCB8IHQuSWRlbnRpZmllcikge1xuICBpZiAobm9kZS50eXBlID09PSAnU3RyaW5nTGl0ZXJhbCcpIHtcbiAgICByZXR1cm4gbm9kZS52YWx1ZTtcbiAgfSBlbHNlIHtcbiAgICByZXR1cm4gbm9kZS5uYW1lO1xuICB9XG59XG4iXX0= |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
151390
17
915
24
3