@embroider/core 0.44.0-alpha.2 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -6
- package/src/app-differ.js +20 -20
- package/src/app-differ.js.map +1 -1
- package/src/app-files.js.map +1 -1
- package/src/app.js +81 -109
- package/src/app.js.map +1 -1
- package/src/asset.js.map +1 -1
- package/src/babel-import-adder.d.ts +11 -0
- package/src/babel-import-adder.js +75 -0
- package/src/babel-import-adder.js.map +1 -0
- package/src/babel-plugin-adjust-imports.d.ts +5 -6
- package/src/babel-plugin-adjust-imports.js +25 -24
- package/src/babel-plugin-adjust-imports.js.map +1 -1
- package/src/babel-plugin-inline-hbs-node.d.ts +9 -3
- package/src/babel-plugin-inline-hbs-node.js +1 -1
- package/src/babel-plugin-inline-hbs-node.js.map +1 -1
- package/src/babel-plugin-inline-hbs.d.ts +9 -7
- package/src/babel-plugin-inline-hbs.js +77 -39
- package/src/babel-plugin-inline-hbs.js.map +1 -1
- package/src/browser-index.js.map +1 -1
- package/src/build-stage.js +2 -2
- package/src/build-stage.js.map +1 -1
- package/src/describe-exports.js +6 -6
- package/src/describe-exports.js.map +1 -1
- package/src/ember-html.js +1 -1
- package/src/ember-html.js.map +1 -1
- package/src/ember-template-compiler-types.js.map +1 -1
- package/src/engine-mangler.js.map +1 -1
- package/src/html-entrypoint.js +6 -6
- package/src/html-entrypoint.js.map +1 -1
- package/src/html-placeholder.js.map +1 -1
- package/src/index.js.map +1 -1
- package/src/js-handlebars.d.ts +2 -2
- package/src/js-handlebars.js +5 -5
- package/src/js-handlebars.js.map +1 -1
- package/src/load-ember-template-compiler.js +6 -6
- package/src/load-ember-template-compiler.js.map +1 -1
- package/src/measure-concat.js +2 -2
- package/src/measure-concat.js.map +1 -1
- package/src/messages.js +6 -6
- package/src/messages.js.map +1 -1
- package/src/mini-modules-polyfill.d.ts +1 -1
- package/src/mini-modules-polyfill.js.map +1 -1
- package/src/multi-tree-diff.js +1 -1
- package/src/multi-tree-diff.js.map +1 -1
- package/src/options.js.map +1 -1
- package/src/packager.js +2 -2
- package/src/packager.js.map +1 -1
- package/src/patch-template-compiler.js +6 -5
- package/src/patch-template-compiler.js.map +1 -1
- package/src/portable-babel-config.js +1 -1
- package/src/portable-babel-config.js.map +1 -1
- package/src/portable-babel-launcher.js.map +1 -1
- package/src/portable.js +4 -4
- package/src/portable.js.map +1 -1
- package/src/rename-require-plugin.js.map +1 -1
- package/src/resolver.js.map +1 -1
- package/src/stage.js.map +1 -1
- package/src/template-colocation-plugin.d.ts +8 -9
- package/src/template-colocation-plugin.js +11 -5
- package/src/template-colocation-plugin.js.map +1 -1
- package/src/template-compiler-common.d.ts +1 -3
- package/src/template-compiler-common.js +16 -12
- package/src/template-compiler-common.js.map +1 -1
- package/src/template-compiler-node.js +10 -10
- package/src/template-compiler-node.js.map +1 -1
- package/src/to-broccoli-plugin.js.map +1 -1
- package/src/wait-for-trees.js.map +1 -1
- package/src/write-template-compiler.js +2 -2
- package/src/write-template-compiler.js.map +1 -1
- package/src/babel-plugin-inline-hbs-deps-node.d.ts +0 -14
- package/src/babel-plugin-inline-hbs-deps-node.js +0 -27
- package/src/babel-plugin-inline-hbs-deps-node.js.map +0 -1
- package/src/babel-plugin-inline-hbs-deps.d.ts +0 -10
- package/src/babel-plugin-inline-hbs-deps.js +0 -118
- package/src/babel-plugin-inline-hbs-deps.js.map +0 -1
- package/src/babel-plugin-stage1-inline-hbs-node.d.ts +0 -12
- package/src/babel-plugin-stage1-inline-hbs-node.js +0 -9
- package/src/babel-plugin-stage1-inline-hbs-node.js.map +0 -1
- package/src/babel-plugin-stage1-inline-hbs.d.ts +0 -9
- package/src/babel-plugin-stage1-inline-hbs.js +0 -96
- package/src/babel-plugin-stage1-inline-hbs.js.map +0 -1
package/src/portable.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"portable.js","sourceRoot":"","sources":["portable.ts"],"names":[],"mappings":";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AM,IAAI,KAAK,CAAC,GAAG,GAAG,eAAe,CAAC,UAAU,GAAG,8BAA8B,GAAG,eAAe,CAAC,WAAW,CAAC,CAAC;KAClH;IACD,OAAO,aAAa,CAAC,eAAe,CAAC,UAAU,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;AAC3E,CAAC;AAED,SAAS,iBAAiB,CAAC,KAAU;IACnC,IAAI,KAAK,GAAG,YAAY,CAAC,MAAM,CAAC;IAChC,YAAY,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IACzB,OAAO;QACL,KAAK,EAAE;YACL,oBAAoB,EAAE,IAAI;YAC1B,IAAI,EAAE,QAAQ;YACd,KAAK;YACL,KAAK;SACN;QACD,cAAc,EAAE,KAAK;QACrB,YAAY,EAAE,IAAI;KACnB,CAAC;AACJ,CAAC","sourcesContent":["import mapValues from 'lodash/mapValues';\nimport assertNever from 'assert-never';\nimport { Memoize } from 'typescript-memoize';\nimport resolvePackagePath from 'resolve-package-path';\n\nexport const protocol = '__embroider_portable_values__';\nconst { globalValues, nonce } = setupGlobals();\n\nexport interface PortableResult {\n value: any;\n isParallelSafe: boolean;\n needsHydrate: boolean;\n}\n\nexport interface PortableHint {\n requireFile: string;\n packageVersion: string | undefined;\n useMethod?: string;\n}\n\nconst { findUpPackagePath } = resolvePackagePath;\n\nexport function maybeNodeModuleVersion(path: string) {\n const packagePath = findUpPackagePath(path);\n\n if (packagePath === null) {\n throw new Error(`Could not find package.json for '${path}'`);\n } else {\n return require(packagePath).version; // eslint-disable-line @typescript-eslint/no-require-imports\n }\n}\n\nexport class Portable {\n constructor(\n private opts: {\n dehydrate?: (value: any, accessPath: string[]) => PortableResult | undefined;\n hydrate?: (value: any, accessPath: string[]) => { value: any } | undefined;\n hints?: PortableHint[];\n } = {}\n ) {}\n\n dehydrate(value: any, accessPath: string[] = []): PortableResult {\n if (this.opts.dehydrate) {\n let result = this.opts.dehydrate.call(this, value, accessPath);\n if (result) {\n return result;\n }\n }\n\n if (value === null) {\n return { value, isParallelSafe: true, needsHydrate: false };\n }\n\n let broccoli = maybeBroccoli(value);\n if (broccoli) {\n return { value: broccoli, isParallelSafe: true, needsHydrate: true };\n }\n\n let htmlbars = maybeHTMLBars(value);\n if (htmlbars) {\n return { value: htmlbars, isParallelSafe: true, needsHydrate: true };\n }\n\n if (Array.isArray(value)) {\n let results = value.map((element, index) => this.dehydrate(element, accessPath.concat(String(index))));\n return {\n value: results.map(r => r.value),\n isParallelSafe: results.every(r => r.isParallelSafe),\n needsHydrate: results.some(r => r.needsHydrate),\n };\n }\n\n switch (typeof value) {\n case 'string':\n case 'number':\n case 'boolean':\n case 'undefined':\n return { value, isParallelSafe: true, needsHydrate: false };\n case 'object':\n if (Object.getPrototypeOf(value) === Object.prototype) {\n let isParallelSafe = true;\n let needsHydrate = false;\n let result = mapValues(value, (propertyValue, key) => {\n let result = this.dehydrate(propertyValue, accessPath.concat(key));\n isParallelSafe = isParallelSafe && result.isParallelSafe;\n needsHydrate = needsHydrate || result.needsHydrate;\n return result.value;\n });\n return { value: result, isParallelSafe, needsHydrate };\n }\n }\n\n let found = this.foundHints.get(value);\n if (found) {\n return {\n value: {\n embroiderPlaceholder: true,\n type: 'broccoli-parallel',\n requireFile: found.requireFile,\n packageVersion: maybeNodeModuleVersion(found.requireFile),\n useMethod: found.useMethod,\n },\n isParallelSafe: true,\n needsHydrate: true,\n };\n }\n\n return globalPlaceholder(value);\n }\n\n hydrate(input: any, accessPath: string[] = []): any {\n if (this.opts.hydrate) {\n let result = this.opts.hydrate.call(this, input, accessPath);\n if (result) {\n return result;\n }\n }\n if (Array.isArray(input)) {\n return input.map((element, index) => this.hydrate(element, accessPath.concat(String(index))));\n }\n if (input && typeof input === 'object') {\n if (input.embroiderPlaceholder) {\n let placeholder = input as Placeholder;\n switch (placeholder.type) {\n case 'global':\n if (placeholder.nonce !== nonce) {\n throw new Error(`unable to use this non-serializable babel config in this node process`);\n }\n return globalValues[placeholder.index];\n case 'broccoli-parallel':\n return buildBroccoli(placeholder);\n case 'htmlbars-parallel':\n return buildHTMLBars(placeholder);\n default:\n assertNever(placeholder);\n }\n } else {\n return mapValues(input, (value, key) => this.hydrate(value, accessPath.concat(key)));\n }\n }\n return input;\n }\n\n @Memoize()\n get foundHints(): Map<any, PortableHint> {\n let found = new Map();\n if (this.opts.hints) {\n for (let hint of this.opts.hints) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n let mod = require(hint.requireFile);\n if (hint.useMethod) {\n mod = mod[hint.useMethod];\n }\n found.set(mod, hint);\n }\n }\n return found;\n }\n}\n\ninterface GlobalPlaceholder {\n embroiderPlaceholder: true;\n type: 'global';\n nonce: number;\n index: number;\n}\n\ninterface BroccoliParallelPlaceholder {\n embroiderPlaceholder: true;\n type: 'broccoli-parallel';\n requireFile: string;\n packageVersion: string | undefined;\n useMethod: string | undefined;\n buildUsing: string | undefined;\n params: any;\n}\n\ninterface HTMLBarsParallelPlaceholder {\n embroiderPlaceholder: true;\n type: 'htmlbars-parallel';\n packageVersion: string | undefined;\n requireFile: string;\n buildUsing: string;\n params: any;\n}\n\ntype Placeholder = GlobalPlaceholder | BroccoliParallelPlaceholder | HTMLBarsParallelPlaceholder;\n\nfunction setupGlobals() {\n let G = global as any as { [protocol]: { globalValues: any[]; nonce: number } };\n if (!G[protocol]) {\n G[protocol] = { globalValues: [], nonce: Math.floor(Math.random() * Math.pow(2, 32)) };\n }\n return G[protocol];\n}\n\n// === broccoli-babel-transpiler support ===\n\nfunction maybeBroccoli(object: any): BroccoliParallelPlaceholder | undefined {\n const type = typeof object;\n const hasProperties = type === 'function' || (type === 'object' && object !== null);\n\n if (\n hasProperties &&\n object._parallelBabel !== null &&\n typeof object._parallelBabel === 'object' &&\n typeof object._parallelBabel.requireFile === 'string'\n ) {\n return {\n embroiderPlaceholder: true,\n type: 'broccoli-parallel',\n requireFile: object._parallelBabel.requireFile,\n packageVersion: maybeNodeModuleVersion(object._parallelBabel.requireFile),\n buildUsing: object._parallelBabel.buildUsing,\n useMethod: object._parallelBabel.useMethod,\n params: object._parallelBabel.params,\n };\n }\n}\n\nfunction buildBroccoli(parallelApiInfo: BroccoliParallelPlaceholder) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n let requiredStuff = require(parallelApiInfo.requireFile);\n\n if (parallelApiInfo.useMethod) {\n if (requiredStuff[parallelApiInfo.useMethod] === undefined) {\n throw new Error(\n \"method '\" + parallelApiInfo.useMethod + \"' does not exist in file \" + parallelApiInfo.requireFile\n );\n }\n return requiredStuff[parallelApiInfo.useMethod];\n }\n\n if (parallelApiInfo.buildUsing) {\n if (typeof requiredStuff[parallelApiInfo.buildUsing] !== 'function') {\n throw new Error(\"'\" + parallelApiInfo.buildUsing + \"' is not a function in file \" + parallelApiInfo.requireFile);\n }\n return requiredStuff[parallelApiInfo.buildUsing](parallelApiInfo.params);\n }\n\n return requiredStuff;\n}\n\n// ember-cli-htmlbars-inline-precompile support ===\nfunction maybeHTMLBars(object: any): HTMLBarsParallelPlaceholder | undefined {\n const type = typeof object;\n const hasProperties = type === 'function' || (type === 'object' && object !== null);\n\n if (\n hasProperties &&\n object.parallelBabel !== null &&\n typeof object.parallelBabel === 'object' &&\n typeof object.parallelBabel.requireFile === 'string'\n ) {\n return {\n embroiderPlaceholder: true,\n type: 'htmlbars-parallel',\n requireFile: object.parallelBabel.requireFile,\n packageVersion: maybeNodeModuleVersion(object.parallelBabel.requireFile),\n buildUsing: String(object.parallelBabel.buildUsing),\n params: object.parallelBabel.params,\n };\n }\n}\n\nfunction buildHTMLBars(parallelApiInfo: HTMLBarsParallelPlaceholder) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n let requiredStuff = require(parallelApiInfo.requireFile);\n if (typeof requiredStuff[parallelApiInfo.buildUsing] !== 'function') {\n throw new Error(\"'\" + parallelApiInfo.buildUsing + \"' is not a function in file \" + parallelApiInfo.requireFile);\n }\n return requiredStuff[parallelApiInfo.buildUsing](parallelApiInfo.params);\n}\n\nfunction globalPlaceholder(value: any): { value: GlobalPlaceholder; isParallelSafe: false; needsHydrate: true } {\n let index = globalValues.length;\n globalValues.push(value);\n return {\n value: {\n embroiderPlaceholder: true,\n type: 'global',\n nonce,\n index,\n },\n isParallelSafe: false,\n needsHydrate: true,\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rename-require-plugin.js","sourceRoot":"","sources":["rename-require-plugin.ts"],"names":[],"mappings":";;AAGA,SAAwB,kBAAkB;IACxC,OAAO;QACL,OAAO,EAAE;YACP,sBAAsB,CAAC,IAAwC;gBAC7D,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;oBACtC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;iBAC9B;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAVD,qCAUC"}
|
|
1
|
+
{"version":3,"file":"rename-require-plugin.js","sourceRoot":"","sources":["rename-require-plugin.ts"],"names":[],"mappings":";;AAGA,SAAwB,kBAAkB;IACxC,OAAO;QACL,OAAO,EAAE;YACP,sBAAsB,CAAC,IAAwC;gBAC7D,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE;oBACtC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;iBAC9B;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC;AAVD,qCAUC","sourcesContent":["import type * as t from '@babel/types';\nimport type { NodePath } from '@babel/traverse';\n\nexport default function inlineHBSTransform(): unknown {\n return {\n visitor: {\n ImportDefaultSpecifier(path: NodePath<t.ImportDefaultSpecifier>) {\n if (path.node.local.name === 'require') {\n path.scope.rename('require');\n }\n },\n },\n };\n}\n"]}
|
package/src/resolver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["resolver.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["resolver.ts"],"names":[],"mappings":"","sourcesContent":["import { TemplateCompiler } from './template-compiler-common';\nimport { Options } from './babel-plugin-adjust-imports';\n\nexport interface ResolvedDep {\n runtimeName: string;\n path: string;\n absPath: string;\n}\n\nexport interface Resolver {\n astTransformer(templateCompiler: TemplateCompiler): unknown;\n dependenciesOf(moduleName: string): ResolvedDep[];\n\n // this takes an absolute path to a file and gives back a path like\n // \"the-package-name/path/to/the-file.js\", while taking into account any\n // backward-compatible runtime name of the package. It's used by the template\n // compiler, because this is the kind of path AST plugins expect to see.\n absPathToRuntimePath(absPath: string): string;\n\n // this takes an absolute path to a file and gives back the runtime name of\n // that module, as it would tradtionally be named within loader.js.\n absPathToRuntimeName(absPath: string): string;\n\n adjustImportsOptions: Options;\n}\n"]}
|
package/src/stage.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stage.js","sourceRoot":"","sources":["stage.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"stage.js","sourceRoot":"","sources":["stage.ts"],"names":[],"mappings":"","sourcesContent":["import type { Node } from 'broccoli-node-api';\nimport { PackageCache } from '@embroider/shared-internals';\n\n// A build Stage is _kinda_ like a Broccoli transform, and it interoperates with\n// Broccoli, but it takes a different approach to how stages combine.\n//\n// Conceptually, normal broccoli transforms pass trees by value (meaning they\n// always get copied) whereas Stages pass trees by reference (meaning they can\n// be borrowed and mutated).\n//\n// This would be potentially bad if abused, but we are only using them for\n// precisely three well-defined stages, where each has clear responsibilities.\n//\nexport default interface Stage {\n // this is the broccoli tree that must get built for the Stage to be ready.\n // But! This tree's output path is _not_ necessarily where the Stage's output\n // will be, for that you must wait for `outputPath`.\n readonly tree: Node;\n\n // this is where our stage was reading from. Subsequent stages are also\n // allowed to read from here in addition to reading from our `outputPath`.\n readonly inputPath: string;\n\n // this promise is only guaranteed to resolve if you cause `tree` to be\n // included in a broccoli build.\n ready(): Promise<{\n // This is the actual directory in which the output will be. It's guaranteed\n // to not change once you get it.\n readonly outputPath: string;\n\n // This optionally allows the Stage to share a PackageCache with the next\n // Stage, as an optimization. If the Stage uses a PackageCache, it _should_\n // share it here.\n readonly packageCache?: PackageCache;\n }>;\n}\n"]}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import type { NodePath } from '@babel/traverse';
|
|
2
|
-
import type * as
|
|
3
|
-
import
|
|
4
|
-
import { ImportUtil } from 'babel-import-util';
|
|
2
|
+
import type * as t from '@babel/types';
|
|
3
|
+
import { ImportAdder } from './babel-import-adder';
|
|
5
4
|
interface State {
|
|
6
5
|
colocatedTemplate: string | undefined;
|
|
7
6
|
associate: {
|
|
8
7
|
component: t.Identifier;
|
|
9
8
|
template: t.Identifier;
|
|
10
9
|
} | undefined;
|
|
11
|
-
adder:
|
|
10
|
+
adder: ImportAdder;
|
|
12
11
|
}
|
|
13
|
-
export default function main(babel:
|
|
12
|
+
export default function main(babel: unknown): {
|
|
14
13
|
visitor: {
|
|
15
14
|
Program: {
|
|
16
|
-
enter(path: NodePath<
|
|
17
|
-
exit(path: NodePath<
|
|
15
|
+
enter(path: NodePath<t.Program>, state: State): void;
|
|
16
|
+
exit(path: NodePath<t.Program>, state: State): void;
|
|
18
17
|
};
|
|
19
|
-
ExportDefaultDeclaration(path: NodePath<
|
|
20
|
-
ExportNamedDeclaration(path: NodePath<
|
|
18
|
+
ExportDefaultDeclaration(path: NodePath<t.ExportDefaultDeclaration>, state: State): void;
|
|
19
|
+
ExportNamedDeclaration(path: NodePath<t.ExportNamedDeclaration>, state: State): void;
|
|
21
20
|
};
|
|
22
21
|
};
|
|
23
22
|
export {};
|
|
@@ -4,7 +4,7 @@ const fs_1 = require("fs");
|
|
|
4
4
|
const path_1 = require("path");
|
|
5
5
|
const shared_internals_1 = require("@embroider/shared-internals");
|
|
6
6
|
const shared_internals_2 = require("@embroider/shared-internals");
|
|
7
|
-
const
|
|
7
|
+
const babel_import_adder_1 = require("./babel-import-adder");
|
|
8
8
|
const packageCache = shared_internals_2.PackageCache.shared('embroider-stage3');
|
|
9
9
|
function setComponentTemplate(target, state) {
|
|
10
10
|
return state.adder.import(target, '@ember/component', 'setComponentTemplate');
|
|
@@ -15,14 +15,14 @@ function main(babel) {
|
|
|
15
15
|
visitor: {
|
|
16
16
|
Program: {
|
|
17
17
|
enter(path, state) {
|
|
18
|
-
state.adder = new
|
|
18
|
+
state.adder = new babel_import_adder_1.ImportAdder(t, path);
|
|
19
19
|
let filename = path.hub.file.opts.filename;
|
|
20
20
|
let owningPackage = packageCache.ownerOfFile(filename);
|
|
21
21
|
if (!owningPackage || !owningPackage.isV2Ember() || !owningPackage.meta['auto-upgraded']) {
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
24
|
let hbsFilename = filename.replace(/\.\w{1,3}$/, '') + '.hbs';
|
|
25
|
-
if (fs_1.existsSync(hbsFilename)) {
|
|
25
|
+
if ((0, fs_1.existsSync)(hbsFilename)) {
|
|
26
26
|
state.colocatedTemplate = hbsFilename;
|
|
27
27
|
}
|
|
28
28
|
},
|
|
@@ -68,7 +68,7 @@ function main(babel) {
|
|
|
68
68
|
]);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
else if (
|
|
71
|
+
else if (isTSDeclareFunction(t, declaration)) {
|
|
72
72
|
// we don't rewrite this
|
|
73
73
|
}
|
|
74
74
|
else {
|
|
@@ -107,7 +107,13 @@ function main(babel) {
|
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
109
|
exports.default = main;
|
|
110
|
+
// this is here because babel6 doesn't offer this function, but we still want it
|
|
111
|
+
// to provide type exhaustiveness when it's missing
|
|
112
|
+
function isTSDeclareFunction(t, dec) {
|
|
113
|
+
var _a;
|
|
114
|
+
return (_a = t.isTSDeclareFunction) === null || _a === void 0 ? void 0 : _a.call(t, dec);
|
|
115
|
+
}
|
|
110
116
|
function importTemplate(target, adder, colocatedTemplate) {
|
|
111
|
-
return adder.import(target, shared_internals_1.explicitRelative(path_1.dirname(colocatedTemplate), colocatedTemplate), 'default', 'TEMPLATE');
|
|
117
|
+
return adder.import(target, (0, shared_internals_1.explicitRelative)((0, path_1.dirname)(colocatedTemplate), colocatedTemplate), 'default', 'TEMPLATE');
|
|
112
118
|
}
|
|
113
119
|
//# sourceMappingURL=template-colocation-plugin.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-colocation-plugin.js","sourceRoot":"","sources":["template-colocation-plugin.ts"],"names":[],"mappings":";;AACA,2BAAgC;
|
|
1
|
+
{"version":3,"file":"template-colocation-plugin.js","sourceRoot":"","sources":["template-colocation-plugin.ts"],"names":[],"mappings":";;AACA,2BAAgC;AAEhC,+BAA+B;AAC/B,kEAA+D;AAC/D,kEAA2D;AAC3D,6DAAmD;AAInD,MAAM,YAAY,GAAG,+BAAY,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAQ7D,SAAS,oBAAoB,CAAC,MAAwB,EAAE,KAAY;IAClE,OAAO,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,EAAE,sBAAsB,CAAC,CAAC;AAChF,CAAC;AAED,SAAwB,IAAI,CAAC,KAAc;IACzC,IAAI,CAAC,GAAI,KAAa,CAAC,KAAmB,CAAC;IAC3C,OAAO;QACL,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,KAAK,CAAC,IAAyB,EAAE,KAAY;oBAC3C,KAAK,CAAC,KAAK,GAAG,IAAI,gCAAW,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;oBACvC,IAAI,QAAQ,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;oBAE3C,IAAI,aAAa,GAAG,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;oBACvD,IAAI,CAAC,aAAa,IAAI,CAAC,aAAa,CAAC,SAAS,EAAE,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;wB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AACnD,SAAS,mBAAmB,CAAC,CAAa,EAAE,GAAQ;;IAClD,OAAO,MAAA,CAAC,CAAC,mBAAmB,+CAArB,CAAC,EAAuB,GAAG,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,cAAc,CAAC,MAAwB,EAAE,KAAkB,EAAE,iBAAyB;IAC7F,OAAO,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,IAAA,mCAAgB,EAAC,IAAA,cAAO,EAAC,iBAAiB,CAAC,EAAE,iBAAiB,CAAC,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;AACtH,CAAC","sourcesContent":["import type { NodePath } from '@babel/traverse';\nimport { existsSync } from 'fs';\nimport type * as t from '@babel/types';\nimport { dirname } from 'path';\nimport { explicitRelative } from '@embroider/shared-internals';\nimport { PackageCache } from '@embroider/shared-internals';\nimport { ImportAdder } from './babel-import-adder';\n\ntype BabelTypes = typeof t;\n\nconst packageCache = PackageCache.shared('embroider-stage3');\n\ninterface State {\n colocatedTemplate: string | undefined;\n associate: { component: t.Identifier; template: t.Identifier } | undefined;\n adder: ImportAdder;\n}\n\nfunction setComponentTemplate(target: NodePath<t.Node>, state: State) {\n return state.adder.import(target, '@ember/component', 'setComponentTemplate');\n}\n\nexport default function main(babel: unknown) {\n let t = (babel as any).types as BabelTypes;\n return {\n visitor: {\n Program: {\n enter(path: NodePath<t.Program>, state: State) {\n state.adder = new ImportAdder(t, path);\n let filename = path.hub.file.opts.filename;\n\n let owningPackage = packageCache.ownerOfFile(filename);\n if (!owningPackage || !owningPackage.isV2Ember() || !owningPackage.meta['auto-upgraded']) {\n return;\n }\n\n let hbsFilename = filename.replace(/\\.\\w{1,3}$/, '') + '.hbs';\n if (existsSync(hbsFilename)) {\n state.colocatedTemplate = hbsFilename;\n }\n },\n exit(path: NodePath<t.Program>, state: State) {\n if (!state.colocatedTemplate) {\n return;\n }\n if (state.associate) {\n path.node.body.push(\n t.expressionStatement(\n t.callExpression(setComponentTemplate(path, state), [\n state.associate.template,\n state.associate.component,\n ])\n )\n );\n }\n },\n },\n\n ExportDefaultDeclaration(path: NodePath<t.ExportDefaultDeclaration>, state: State) {\n if (!state.colocatedTemplate) {\n return;\n }\n\n let declaration = path.get('declaration').node;\n\n if (t.isClassDeclaration(declaration)) {\n let template = importTemplate(path, state.adder, state.colocatedTemplate);\n if (declaration.id != null) {\n state.associate = { template, component: declaration.id };\n } else {\n path.node.declaration = t.callExpression(setComponentTemplate(path, state), [\n template,\n t.classExpression(null, declaration.superClass, declaration.body, declaration.decorators ?? []),\n ]);\n }\n } else if (t.isFunctionDeclaration(declaration)) {\n let template = importTemplate(path, state.adder, state.colocatedTemplate);\n\n if (declaration.id != null) {\n state.associate = { template, component: declaration.id };\n } else {\n path.node.declaration = t.callExpression(setComponentTemplate(path, state), [\n template,\n t.functionExpression(\n null,\n declaration.params,\n declaration.body,\n declaration.generator,\n declaration.async\n ),\n ]);\n }\n } else if (isTSDeclareFunction(t, declaration)) {\n // we don't rewrite this\n } else {\n let local = importTemplate(path, state.adder, state.colocatedTemplate);\n path.node.declaration = t.callExpression(setComponentTemplate(path, state), [local, declaration]);\n }\n },\n ExportNamedDeclaration(path: NodePath<t.ExportNamedDeclaration>, state: State) {\n if (!state.colocatedTemplate) {\n return;\n }\n let { node } = path;\n for (let specifier of path.node.specifiers) {\n if (t.isExportDefaultSpecifier(specifier)) {\n } else if (t.isExportSpecifier(specifier)) {\n const name = specifier.exported.type === 'Identifier' ? specifier.exported.name : specifier.exported.value;\n\n if (name === 'default') {\n let template = importTemplate(path, state.adder, state.colocatedTemplate);\n if (node.source) {\n // our default export is a reexport from elsewhere. We will\n // synthesize a new import for it so we can get a local handle\n // on it\n let component = state.adder.import(path, node.source.value, specifier.local.name, 'COMPONENT');\n state.associate = { template, component };\n } else {\n // our default export is one of our local names\n state.associate = { template, component: t.identifier(specifier.local.name) };\n }\n }\n }\n }\n },\n },\n };\n}\n\n// this is here because babel6 doesn't offer this function, but we still want it\n// to provide type exhaustiveness when it's missing\nfunction isTSDeclareFunction(t: BabelTypes, dec: any): dec is t.TSDeclareFunction {\n return t.isTSDeclareFunction?.(dec);\n}\n\nfunction importTemplate(target: NodePath<t.Node>, adder: ImportAdder, colocatedTemplate: string) {\n return adder.import(target, explicitRelative(dirname(colocatedTemplate), colocatedTemplate), 'default', 'TEMPLATE');\n}\n"]}
|
|
@@ -59,9 +59,7 @@ export declare class TemplateCompiler {
|
|
|
59
59
|
get cacheKey(): string;
|
|
60
60
|
private setup;
|
|
61
61
|
private getReversedASTPlugins;
|
|
62
|
-
precompile(
|
|
63
|
-
filename: string;
|
|
64
|
-
}): {
|
|
62
|
+
precompile(moduleName: string, contents: string): {
|
|
65
63
|
compiled: string;
|
|
66
64
|
dependencies: ResolvedDep[];
|
|
67
65
|
};
|
|
@@ -51,27 +51,31 @@ class TemplateCompiler {
|
|
|
51
51
|
return ast.slice().reverse();
|
|
52
52
|
}
|
|
53
53
|
// Compiles to the wire format plus dependency list.
|
|
54
|
-
precompile(
|
|
54
|
+
precompile(moduleName, contents) {
|
|
55
55
|
var _a, _b;
|
|
56
56
|
let dependencies;
|
|
57
57
|
let runtimeName;
|
|
58
|
-
let filename = options.filename;
|
|
59
58
|
if (this.resolver) {
|
|
60
|
-
runtimeName = this.resolver.absPathToRuntimePath(
|
|
59
|
+
runtimeName = this.resolver.absPathToRuntimePath(moduleName);
|
|
61
60
|
}
|
|
62
61
|
else {
|
|
63
|
-
runtimeName =
|
|
62
|
+
runtimeName = moduleName;
|
|
64
63
|
}
|
|
65
|
-
let opts = this.syntax.defaultOptions({ contents
|
|
64
|
+
let opts = this.syntax.defaultOptions({ contents, moduleName });
|
|
66
65
|
let plugins = Object.assign(Object.assign({}, opts === null || opts === void 0 ? void 0 : opts.plugins), { ast: [
|
|
67
66
|
...this.getReversedASTPlugins(this.plugins.ast),
|
|
68
67
|
this.resolver && this.resolver.astTransformer(this),
|
|
69
68
|
// Ember 3.27+ uses _buildCompileOptions will not add AST plugins to its result
|
|
70
69
|
...((_b = (_a = opts === null || opts === void 0 ? void 0 : opts.plugins) === null || _a === void 0 ? void 0 : _a.ast) !== null && _b !== void 0 ? _b : []),
|
|
71
70
|
].filter(Boolean) });
|
|
72
|
-
let compiled = this.syntax.precompile(strip_bom_1.default(
|
|
71
|
+
let compiled = this.syntax.precompile((0, strip_bom_1.default)(contents), {
|
|
72
|
+
contents,
|
|
73
|
+
moduleName: runtimeName,
|
|
74
|
+
filename: moduleName,
|
|
75
|
+
plugins,
|
|
76
|
+
});
|
|
73
77
|
if (this.resolver) {
|
|
74
|
-
dependencies = this.resolver.dependenciesOf(
|
|
78
|
+
dependencies = this.resolver.dependenciesOf(moduleName);
|
|
75
79
|
}
|
|
76
80
|
else {
|
|
77
81
|
dependencies = [];
|
|
@@ -80,7 +84,7 @@ class TemplateCompiler {
|
|
|
80
84
|
}
|
|
81
85
|
// Compiles all the way from a template string to a javascript module string.
|
|
82
86
|
compile(moduleName, contents) {
|
|
83
|
-
let { compiled, dependencies } = this.precompile(
|
|
87
|
+
let { compiled, dependencies } = this.precompile(moduleName, contents);
|
|
84
88
|
let lines = [];
|
|
85
89
|
let counter = 0;
|
|
86
90
|
for (let { runtimeName, path } of dependencies) {
|
|
@@ -107,7 +111,7 @@ class TemplateCompiler {
|
|
|
107
111
|
opts.plugins.ast = this.getReversedASTPlugins(this.plugins.ast).map(plugin => {
|
|
108
112
|
// Although the precompile API does, this direct glimmer syntax api
|
|
109
113
|
// does not support these legacy plugins, so we must wrap them.
|
|
110
|
-
return wrap_legacy_hbs_plugin_if_needed_1.default(plugin);
|
|
114
|
+
return (0, wrap_legacy_hbs_plugin_if_needed_1.default)(plugin);
|
|
111
115
|
});
|
|
112
116
|
// instructs glimmer-vm to preserve entity encodings (e.g. don't parse -> ' ')
|
|
113
117
|
opts.mode = 'codemod';
|
|
@@ -122,7 +126,7 @@ class TemplateCompiler {
|
|
|
122
126
|
return this.syntax.preprocess(contents, opts);
|
|
123
127
|
}
|
|
124
128
|
baseDir() {
|
|
125
|
-
return path_1.join(__dirname, '..');
|
|
129
|
+
return (0, path_1.join)(__dirname, '..');
|
|
126
130
|
}
|
|
127
131
|
// tests for the classic ember-cli-htmlbars-inline-precompile babel plugin
|
|
128
132
|
static isInlinePrecompilePlugin(item) {
|
|
@@ -144,10 +148,10 @@ class TemplateCompiler {
|
|
|
144
148
|
}
|
|
145
149
|
}
|
|
146
150
|
__decorate([
|
|
147
|
-
typescript_memoize_1.Memoize()
|
|
151
|
+
(0, typescript_memoize_1.Memoize)()
|
|
148
152
|
], TemplateCompiler.prototype, "setup", null);
|
|
149
153
|
__decorate([
|
|
150
|
-
typescript_memoize_1.Memoize()
|
|
154
|
+
(0, typescript_memoize_1.Memoize)()
|
|
151
155
|
], TemplateCompiler.prototype, "getReversedASTPlugins", null);
|
|
152
156
|
exports.TemplateCompiler = TemplateCompiler;
|
|
153
157
|
function matchesSourceFile(filename) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-compiler-common.js","sourceRoot":"","sources":["template-compiler-common.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,0DAAiC;AAEjC,+BAAiC;AAEjC,2DAA6C;AAC7C,wGAA2E;AAuD3E,MAAM,kBAAkB,GAAG;IACzB,CAAC,4BAA4B,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,UAAG,CAAC;IACpD,CAAC,4BAA4B,EAAE,KAAK,EAAE,wBAAwB,CAAC,CAAC,IAAI,CAAC,UAAG,CAAC;IACzE,CAAC,4BAA4B,EAAE,OAAO,CAAC,CAAC,IAAI,CAAC,UAAG,CAAC;IACjD,CAAC,4BAA4B,EAAE,KAAK,EAAE,qBAAqB,CAAC,CAAC,IAAI,CAAC,UAAG,CAAC;IACtE,CAAC,oBAAoB,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,UAAG,CAAC;IAC5C,CAAC,oBAAoB,EAAE,KAAK,EAAE,wBAAwB,CAAC,CAAC,IAAI,CAAC,UAAG,CAAC;IACjE,CAAC,oBAA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L,kHAAkH;QAClH,mDAAmD;QACnD,EAAE;QACF,iEAAiE;QACjE,EAAE;QACF,gCAAgC;QAChC,2BAA2B;QAC3B,wEAAwE;QACxE,IAAI,MAAM,GAAG,CAAC,MAAA,4BAA4B,CAAC,KAAK,mCAAI,4BAA4B,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CACvG,iBAAiB,CAClB,CAAC;QACF,IAAI,eAAe,GAAG,CAAC,MAAA,4BAA4B,CAAC,KAAK,mCAAI,4BAA4B,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,OAAO,CAChH,oDAAoD,CACrD,CAAC;QAEF,OAAO;YACL,KAAK,EAAE,MAAM,CAAC,KAAK;YACnB,UAAU,EAAE,MAAM,CAAC,UAAU;YAC7B,cAAc,EAAE,eAAe,CAAC,OAAO;YACvC,UAAU,EAAE,4BAA4B,CAAC,UAAU;YACnD,MAAM,EAAE,4BAA4B,CAAC,MAAM;SAC5C,CAAC;KACH;AACH,CAAC","sourcesContent":["import stripBom from 'strip-bom';\nimport { Resolver, ResolvedDep } from './resolver';\nimport { join, sep } from 'path';\nimport type { PluginItem } from '@babel/core';\nimport { Memoize } from 'typescript-memoize';\nimport wrapLegacyHbsPluginIfNeeded from 'wrap-legacy-hbs-plugin-if-needed';\n\nexport interface Plugins {\n ast?: unknown[];\n}\n\nexport interface AST {\n _deliberatelyOpaque: 'AST';\n}\n\nexport interface PreprocessOptions {\n contents: string;\n moduleName: string;\n plugins?: Plugins;\n filename?: string;\n\n parseOptions?: {\n srcName?: string;\n ignoreStandalone?: boolean;\n };\n\n // added in Ember 3.17 (@glimmer/syntax@0.40.2)\n mode?: 'codemod' | 'precompile';\n\n // added in Ember 3.25\n strictMode?: boolean;\n locals?: string[];\n}\n\nexport interface PrinterOptions {\n entityEncoding?: 'transformed' | 'raw';\n}\n\n// This just reflects the API we're extracting from ember-template-compiler.js,\n// plus a cache key that lets us know when the underlying source has remained\n// stable.\nexport interface GlimmerSyntax {\n preprocess(html: string, options?: PreprocessOptions): AST;\n print(ast: AST, options?: PrinterOptions): string;\n defaultOptions(options: PreprocessOptions): PreprocessOptions;\n precompile(\n templateContents: string,\n options: {\n contents: string;\n moduleName: string;\n filename: string;\n plugins?: any;\n parseOptions?: {\n srcName?: string;\n };\n }\n ): string;\n _Ember: { FEATURES: any; ENV: any };\n}\n\nconst htmlbarPathMatches = [\n ['htmlbars-inline-precompile', 'index.js'].join(sep),\n ['htmlbars-inline-precompile', 'lib', 'require-from-worker.js'].join(sep),\n ['htmlbars-inline-precompile', 'index'].join(sep),\n ['htmlbars-inline-precompile', 'lib', 'require-from-worker'].join(sep),\n ['ember-cli-htmlbars', 'index.js'].join(sep),\n ['ember-cli-htmlbars', 'lib', 'require-from-worker.js'].join(sep),\n ['ember-cli-htmlbars', 'index'].join(sep),\n ['ember-cli-htmlbars', 'lib', 'require-from-worker'].join(sep),\n];\n\nexport interface TemplateCompilerParams {\n // this should be the exports object from ember-template-compiler.js. It's\n // \"unknown\" here because it changes shape in different ember versions, we\n // will do our best to consume it.\n loadEmberTemplateCompiler: () => { theExports: unknown; cacheKey: string };\n resolver?: Resolver;\n EmberENV: unknown;\n plugins: Plugins;\n}\n\nexport class TemplateCompiler {\n private loadEmberTemplateCompiler: () => { theExports: unknown; cacheKey: string };\n private resolver?: Resolver;\n private EmberENV: unknown;\n private plugins: Plugins;\n\n constructor(params: TemplateCompilerParams) {\n this.loadEmberTemplateCompiler = params.loadEmberTemplateCompiler;\n this.resolver = params.resolver;\n this.EmberENV = params.EmberENV;\n this.plugins = params.plugins;\n\n // stage3 packagers don't need to know about our instance, they can just\n // grab the compile function and use it.\n this.compile = this.compile.bind(this);\n }\n\n private get syntax(): GlimmerSyntax {\n return this.setup().syntax;\n }\n\n get cacheKey(): string {\n return this.setup().cacheKey;\n }\n\n @Memoize()\n private setup() {\n let { theExports, cacheKey } = this.loadEmberTemplateCompiler();\n let syntax = loadGlimmerSyntax(theExports);\n initializeEmberENV(syntax, this.EmberENV);\n // todo: get resolver reflected in cacheKey\n return { syntax, cacheKey };\n }\n\n @Memoize()\n private getReversedASTPlugins(ast: unknown[]): unknown[] {\n return ast.slice().reverse();\n }\n\n // Compiles to the wire format plus dependency list.\n precompile(moduleName: string, contents: string): { compiled: string; dependencies: ResolvedDep[] } {\n let dependencies: ResolvedDep[];\n let runtimeName: string;\n\n if (this.resolver) {\n runtimeName = this.resolver.absPathToRuntimePath(moduleName);\n } else {\n runtimeName = moduleName;\n }\n\n let opts = this.syntax.defaultOptions({ contents, moduleName });\n let plugins: Plugins = {\n ...opts?.plugins,\n\n ast: [\n ...this.getReversedASTPlugins(this.plugins.ast!),\n this.resolver && this.resolver.astTransformer(this),\n\n // Ember 3.27+ uses _buildCompileOptions will not add AST plugins to its result\n ...(opts?.plugins?.ast ?? []),\n ].filter(Boolean),\n };\n\n let compiled = this.syntax.precompile(stripBom(contents), {\n contents,\n moduleName: runtimeName,\n filename: moduleName,\n plugins,\n });\n\n if (this.resolver) {\n dependencies = this.resolver.dependenciesOf(moduleName);\n } else {\n dependencies = [];\n }\n\n return { compiled, dependencies };\n }\n\n // Compiles all the way from a template string to a javascript module string.\n compile(moduleName: string, contents: string) {\n let { compiled, dependencies } = this.precompile(moduleName, contents);\n let lines = [];\n let counter = 0;\n for (let { runtimeName, path } of dependencies) {\n lines.push(`import a${counter} from \"${path.split(sep).join('/')}\";`);\n lines.push(`window.define('${runtimeName}', function(){ return a${counter++}});`);\n }\n\n lines.push(`import { createTemplateFactory } from '@ember/template-factory';`);\n lines.push(`export default createTemplateFactory(${compiled});`);\n\n return lines.join('\\n');\n }\n\n // Applies all custom AST transforms and emits the results still as\n // handlebars.\n applyTransforms(moduleName: string, contents: string): string {\n let opts = this.syntax.defaultOptions({ contents, moduleName });\n\n // the user-provided plugins come first in the list, and those are the\n // only ones we want to run. The built-in plugins don't need to run here\n // in stage1, it's better that they run in stage3 when the appropriate\n // ember version is in charge.\n //\n // rather than slicing them off, we could choose instead to not call\n // syntax.defaultOptions, but then we lose some of the compatibility\n // normalization that it does on the user-provided plugins.\n opts.plugins = opts.plugins || {}; // Ember 3.27+ won't add opts.plugins\n opts.plugins.ast = this.getReversedASTPlugins(this.plugins.ast!).map(plugin => {\n // Although the precompile API does, this direct glimmer syntax api\n // does not support these legacy plugins, so we must wrap them.\n return wrapLegacyHbsPluginIfNeeded(plugin as any);\n });\n\n // instructs glimmer-vm to preserve entity encodings (e.g. don't parse -> ' ')\n opts.mode = 'codemod';\n\n opts.filename = moduleName;\n opts.moduleName = this.resolver ? this.resolver.absPathToRuntimePath(moduleName) || moduleName : moduleName;\n let ast = this.syntax.preprocess(contents, opts);\n\n return this.syntax.print(ast, { entityEncoding: 'raw' });\n }\n\n parse(moduleName: string, contents: string): AST {\n // this is just a parse, so we deliberately don't run any plugins.\n let opts = { contents, moduleName, plugins: {} };\n return this.syntax.preprocess(contents, opts);\n }\n\n baseDir() {\n return join(__dirname, '..');\n }\n\n // tests for the classic ember-cli-htmlbars-inline-precompile babel plugin\n static isInlinePrecompilePlugin(item: PluginItem) {\n if (typeof item === 'string') {\n return matchesSourceFile(item);\n }\n if (hasProperties(item) && (item as any)._parallelBabel) {\n return matchesSourceFile((item as any)._parallelBabel.requireFile);\n }\n if (Array.isArray(item) && item.length > 0) {\n if (typeof item[0] === 'string') {\n return matchesSourceFile(item[0]);\n }\n if (hasProperties(item[0]) && (item[0] as any)._parallelBabel) {\n return matchesSourceFile((item[0] as any)._parallelBabel.requireFile);\n }\n }\n return false;\n }\n}\n\nexport function matchesSourceFile(filename: string) {\n return Boolean(htmlbarPathMatches.find(match => filename.endsWith(match)));\n}\n\nfunction hasProperties(item: any) {\n return item && (typeof item === 'object' || typeof item === 'function');\n}\n\n// this matches the setup done by ember-cli-htmlbars: https://git.io/JtbN6\nfunction initializeEmberENV(syntax: GlimmerSyntax, EmberENV: any) {\n if (!EmberENV) {\n return;\n }\n\n let props;\n\n if (EmberENV.FEATURES) {\n props = Object.keys(EmberENV.FEATURES);\n props.forEach(prop => {\n syntax._Ember.FEATURES[prop] = EmberENV.FEATURES[prop];\n });\n }\n\n if (EmberENV) {\n props = Object.keys(EmberENV);\n props.forEach(prop => {\n if (prop === 'FEATURES') {\n return;\n }\n syntax._Ember.ENV[prop] = EmberENV[prop];\n });\n }\n}\n\n// we could directly depend on @glimmer/syntax and have nice types and\n// everything. But the problem is, we really want to use the exact version that\n// the app itself is using, and its copy is bundled away inside\n// ember-template-compiler.js.\nfunction loadGlimmerSyntax(emberTemplateCompilerExports: any): GlimmerSyntax {\n // detect if we are using an Ember version with the exports we need\n // (from https://github.com/emberjs/ember.js/pull/19426)\n if (emberTemplateCompilerExports._preprocess !== undefined) {\n return {\n print: emberTemplateCompilerExports._print,\n preprocess: emberTemplateCompilerExports._preprocess,\n defaultOptions: emberTemplateCompilerExports._buildCompileOptions,\n precompile: emberTemplateCompilerExports.precompile,\n _Ember: emberTemplateCompilerExports._Ember,\n };\n } else {\n // Older Ember versions (prior to 3.27) do not expose a public way to to source 2 source compilation of templates.\n // because of this, we must resort to some hackery.\n //\n // We use the following API's (that we grab from Ember.__loader):\n //\n // * glimmer/syntax's preprocess\n // * glimmer/syntax's print\n // * ember-template-compiler/lib/system/compile-options's defaultOptions\n let syntax = (emberTemplateCompilerExports.Ember ?? emberTemplateCompilerExports._Ember).__loader.require(\n '@glimmer/syntax'\n );\n let compilerOptions = (emberTemplateCompilerExports.Ember ?? emberTemplateCompilerExports._Ember).__loader.require(\n 'ember-template-compiler/lib/system/compile-options'\n );\n\n return {\n print: syntax.print,\n preprocess: syntax.preprocess,\n defaultOptions: compilerOptions.default,\n precompile: emberTemplateCompilerExports.precompile,\n _Ember: emberTemplateCompilerExports._Ember,\n };\n }\n}\n"]}
|
|
@@ -12,7 +12,7 @@ const babel_plugin_adjust_imports_1 = __importDefault(require("./babel-plugin-ad
|
|
|
12
12
|
class NodeTemplateCompiler extends template_compiler_common_1.TemplateCompiler {
|
|
13
13
|
constructor(params) {
|
|
14
14
|
super({
|
|
15
|
-
loadEmberTemplateCompiler: () => load_ember_template_compiler_1.getEmberExports(params.compilerPath),
|
|
15
|
+
loadEmberTemplateCompiler: () => (0, load_ember_template_compiler_1.getEmberExports)(params.compilerPath),
|
|
16
16
|
resolver: params.resolver,
|
|
17
17
|
EmberENV: params.EmberENV,
|
|
18
18
|
plugins: params.plugins,
|
|
@@ -23,13 +23,12 @@ class NodeTemplateCompiler extends template_compiler_common_1.TemplateCompiler {
|
|
|
23
23
|
let src = super.compile(moduleName, contents);
|
|
24
24
|
let resolver = this.params.resolver;
|
|
25
25
|
if (resolver) {
|
|
26
|
-
|
|
27
|
-
return core_1.transform(src, {
|
|
26
|
+
return (0, core_1.transform)(src, {
|
|
28
27
|
filename: moduleName,
|
|
29
28
|
generatorOpts: {
|
|
30
29
|
compact: false,
|
|
31
30
|
},
|
|
32
|
-
plugins: [[babel_plugin_adjust_imports_1.default,
|
|
31
|
+
plugins: [[babel_plugin_adjust_imports_1.default, resolver.adjustImportsOptions]],
|
|
33
32
|
}).code;
|
|
34
33
|
}
|
|
35
34
|
else {
|
|
@@ -40,29 +39,30 @@ class NodeTemplateCompiler extends template_compiler_common_1.TemplateCompiler {
|
|
|
40
39
|
// Javascript.
|
|
41
40
|
inlineTransformsBabelPlugin() {
|
|
42
41
|
return [
|
|
43
|
-
path_1.join(__dirname, 'babel-plugin-
|
|
42
|
+
(0, path_1.join)(__dirname, 'babel-plugin-inline-hbs-node.js'),
|
|
44
43
|
{
|
|
45
44
|
templateCompiler: this.params,
|
|
45
|
+
stage: 1,
|
|
46
46
|
},
|
|
47
47
|
];
|
|
48
48
|
}
|
|
49
49
|
baseDir() {
|
|
50
|
-
return path_1.join(__dirname, '..');
|
|
50
|
+
return (0, path_1.join)(__dirname, '..');
|
|
51
51
|
}
|
|
52
52
|
// tests for the classic ember-cli-htmlbars-inline-precompile babel plugin
|
|
53
53
|
static isInlinePrecompilePlugin(item) {
|
|
54
54
|
if (typeof item === 'string') {
|
|
55
|
-
return template_compiler_common_1.matchesSourceFile(item);
|
|
55
|
+
return (0, template_compiler_common_1.matchesSourceFile)(item);
|
|
56
56
|
}
|
|
57
57
|
if (hasProperties(item) && item._parallelBabel) {
|
|
58
|
-
return template_compiler_common_1.matchesSourceFile(item._parallelBabel.requireFile);
|
|
58
|
+
return (0, template_compiler_common_1.matchesSourceFile)(item._parallelBabel.requireFile);
|
|
59
59
|
}
|
|
60
60
|
if (Array.isArray(item) && item.length > 0) {
|
|
61
61
|
if (typeof item[0] === 'string') {
|
|
62
|
-
return template_compiler_common_1.matchesSourceFile(item[0]);
|
|
62
|
+
return (0, template_compiler_common_1.matchesSourceFile)(item[0]);
|
|
63
63
|
}
|
|
64
64
|
if (hasProperties(item[0]) && item[0]._parallelBabel) {
|
|
65
|
-
return template_compiler_common_1.matchesSourceFile(item[0]._parallelBabel.requireFile);
|
|
65
|
+
return (0, template_compiler_common_1.matchesSourceFile)(item[0]._parallelBabel.requireFile);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"template-compiler-node.js","sourceRoot":"","sources":["template-compiler-node.ts"],"names":[],"mappings":";;;;;;AACA,+BAA4B;AAC5B,sCAAoD;AAGpD,iFAAiE;AACjE,yEAAiF;AACjF,
|
|
1
|
+
{"version":3,"file":"template-compiler-node.js","sourceRoot":"","sources":["template-compiler-node.ts"],"names":[],"mappings":";;;;;;AACA,+BAA4B;AAC5B,sCAAoD;AAGpD,iFAAiE;AACjE,yEAAiF;AACjF,gGAAgE;AAUhE,MAAa,oBAAqB,SAAQ,2CAAgB;IACxD,YAAmB,MAAkC;QACnD,KAAK,CAAC;YACJ,yBAAyB,EAAE,GAAG,EAAE,CAAC,IAAA,8CAAe,EAAC,MAAM,CAAC,YAAY,CAAC;YACrE,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,OAAO,EAAE,MAAM,CAAC,OAAO;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I,OAAO,IAAI,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;gBAC/B,OAAO,IAAA,4CAAiB,EAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;aACnC;YACD,IAAI,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAK,IAAI,CAAC,CAAC,CAAS,CAAC,cAAc,EAAE;gBAC7D,OAAO,IAAA,4CAAiB,EAAE,IAAI,CAAC,CAAC,CAAS,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;aACvE;SACF;QACD,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AA5DD,oDA4DC;AAED,SAAS,aAAa,CAAC,IAAS;IAC9B,OAAO,IAAI,IAAI,CAAC,OAAO,IAAI,KAAK,QAAQ,IAAI,OAAO,IAAI,KAAK,UAAU,CAAC,CAAC;AAC1E,CAAC","sourcesContent":["import { Resolver } from './resolver';\nimport { join } from 'path';\nimport { PluginItem, transform } from '@babel/core';\nimport type { Params as InlineBabelParams } from './babel-plugin-inline-hbs';\nimport { Plugins } from './ember-template-compiler-types';\nimport { getEmberExports } from './load-ember-template-compiler';\nimport { TemplateCompiler, matchesSourceFile } from './template-compiler-common';\nimport adjustImportsPlugin from './babel-plugin-adjust-imports';\n\nexport interface NodeTemplateCompilerParams {\n compilerPath: string;\n compilerChecksum: string;\n resolver?: Resolver;\n EmberENV: unknown;\n plugins: Plugins;\n}\n\nexport class NodeTemplateCompiler extends TemplateCompiler {\n constructor(public params: NodeTemplateCompilerParams) {\n super({\n loadEmberTemplateCompiler: () => getEmberExports(params.compilerPath),\n resolver: params.resolver,\n EmberENV: params.EmberENV,\n plugins: params.plugins,\n });\n }\n\n compile(moduleName: string, contents: string) {\n let src = super.compile(moduleName, contents);\n let resolver = this.params.resolver;\n if (resolver) {\n return transform(src, {\n filename: moduleName,\n generatorOpts: {\n compact: false,\n },\n plugins: [[adjustImportsPlugin, resolver.adjustImportsOptions]],\n })!.code!;\n } else {\n return src;\n }\n }\n\n // Use applyTransforms on the contents of inline hbs template strings inside\n // Javascript.\n inlineTransformsBabelPlugin(): PluginItem {\n return [\n join(__dirname, 'babel-plugin-inline-hbs-node.js'),\n {\n templateCompiler: this.params,\n stage: 1,\n } as InlineBabelParams,\n ];\n }\n\n baseDir() {\n return join(__dirname, '..');\n }\n\n // tests for the classic ember-cli-htmlbars-inline-precompile babel plugin\n static isInlinePrecompilePlugin(item: PluginItem) {\n if (typeof item === 'string') {\n return matchesSourceFile(item);\n }\n if (hasProperties(item) && (item as any)._parallelBabel) {\n return matchesSourceFile((item as any)._parallelBabel.requireFile);\n }\n if (Array.isArray(item) && item.length > 0) {\n if (typeof item[0] === 'string') {\n return matchesSourceFile(item[0]);\n }\n if (hasProperties(item[0]) && (item[0] as any)._parallelBabel) {\n return matchesSourceFile((item[0] as any)._parallelBabel.requireFile);\n }\n }\n return false;\n }\n}\n\nfunction hasProperties(item: any) {\n return item && (typeof item === 'object' || typeof item === 'function');\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"to-broccoli-plugin.js","sourceRoot":"","sources":["to-broccoli-plugin.ts"],"names":[],"mappings":";;;;;AAAA,sEAAqC;AAGrC,kEAAqD;AAMrD,SAAwB,gBAAgB,CACtC,aAA2C;IAE3C,MAAM,cAAe,SAAQ,yBAAM;QAEjC,YAAoB,KAAY,EAAU,QAAmB,EAAU,OAAiB;YACtF,KAAK,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE;gBAClB,gBAAgB,EAAE,IAAI;gBACtB,UAAU,EAAE,KAAK;gBACjB,UAAU,EAAE,aAAa,CAAC,UAAU;aACrC,CAAC,CAAC;YALe,UAAK,GAAL,KAAK,CAAO;YAAU,aAAQ,GAAR,QAAQ,CAAW;YAAU,YAAO,GAAP,OAAO,CAAU;QAMxF,CAAC;QAED,KAAK,CAAC,KAAK;YACT,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE;gBAClB,IAAI,EAAE,UAAU,EAAE,YAAY,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E,CAAC;gBAC5D,uEAAuE;gBACvE,oDAAoD;gBACpD,IAAI,YAAY,EAAE;oBAChB,YAAY,CAAC,OAAO,CAAC,kBAAkB,CAAC,CAAC;iBAC1C;gBACD,IAAI,CAAC,QAAQ,GAAG,IAAI,aAAa,CAC/B,UAAU,EACV,IAAI,CAAC,UAAU,EACf,IAAI,CAAC,QAAQ,EACb,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,KAAK,CAAC,yBAAM,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EACrD,IAAI,CAAC,OAAO,CACb,CAAC;aACH;YACD,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC;QAC/B,CAAC;KACF;IACD,OAAO,cAAc,CAAC;AACxB,CAAC;AAjCD,mCAiCC","sourcesContent":["import Plugin from 'broccoli-plugin';\nimport { Packager, PackagerConstructor, Variant } from './packager';\nimport Stage from './stage';\nimport { tmpdir } from '@embroider/shared-internals';\n\ninterface BroccoliPackager<Options> {\n new (stage: Stage, variants: Variant[], options?: Options): Plugin;\n}\n\nexport default function toBroccoliPlugin<Options>(\n packagerClass: PackagerConstructor<Options>\n): BroccoliPackager<Options> {\n class PackagerRunner extends Plugin {\n private packager: Packager | undefined;\n constructor(private stage: Stage, private variants: Variant[], private options?: Options) {\n super([stage.tree], {\n persistentOutput: true,\n needsCache: false,\n annotation: packagerClass.annotation,\n });\n }\n\n async build() {\n if (!this.packager) {\n let { outputPath, packageCache } = await this.stage.ready();\n // We always register a shared stage3 packageCache so it can be used by\n // things like babel plugins and template compilers.\n if (packageCache) {\n packageCache.shareAs('embroider-stage3');\n }\n this.packager = new packagerClass(\n outputPath,\n this.outputPath,\n this.variants,\n msg => console.log(msg.split(tmpdir).join('$TMPDIR')),\n this.options\n );\n }\n return this.packager.build();\n }\n }\n return PackagerRunner;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wait-for-trees.js","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,OAAO,CAAC,KAAK,CAAC,EAAE;YACxB,IAAI,WAAW,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC;YAC3D,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE;gBAC1B,MAAM,IAAI,KAAK,CAAC,+CAA+C,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;aAClF;YACD,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;SAC7C;aAAM,IAAI,MAAM,CAAC,KAAK,CAAC,EAAE;YACxB,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;SAC/B;aAAM,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;YACpC,MAAM,IAAI,KAAK,CAAC,uDAAuD,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC;SAC1F;KACF;AACH,CAAC;AAED,SAAS,SAAS,CAAa,KAAiB;IAC9C,IAAI,MAAM,GAAW,EAAE,CAAC;IACxB,KAAK,IAAI,KAAK,IAAI,SAAS,CAAC,KAAK,CAAC,EAAE;QAClC,IAAI,KAAK,CAAC,KAAK,EAAE;YACf,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;SACrC;aAAM,IAAI,KAAK,CAAC,MAAM,EAAE;YACvB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;SAC3B;KACF;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import BroccoliPlugin from 'broccoli-plugin';\nimport { Node } from 'broccoli-node-api';\n\n/*\n Takes some named broccoli trees and/or lists of broccoli trees and gives you\n the resulting inputPaths once those trees are built. Example:\n\n import { Node } from 'broccoli-node-api';;\n\n interface MyInputs<T> {\n codeFromMyApp: T,\n codeFromMyAddons: T[]\n }\n\n function(trees: MyInputs<Node>): Node {\n return WaitForTrees(trees, build);\n }\n\n async function build(paths: MyInputs<string>) {\n // paths.someTree is a string\n // paths.otherTrees is a string[]\n }\n\n*/\nexport default class WaitForTrees<NamedTrees> extends BroccoliPlugin {\n constructor(\n private trees: NamedTrees,\n annotation: string,\n private buildHook: (trees: OutputPaths<NamedTrees>, changed: Map<string, boolean>) => Promise<void>\n ) {\n super(flatTrees(trees), {\n persistentOutput: true,\n needsCache: false,\n annotation: annotation,\n trackInputChanges: true,\n });\n }\n\n async build(detail?: { changedNodes: boolean[] }) {\n let result: { [treeName: string]: string | string[] } = {};\n let changedMap = new Map();\n\n let inputPathCounter = 0;\n for (let entry of findTrees(this.trees)) {\n if (entry.single) {\n result[entry.name] = this.inputPaths[inputPathCounter];\n let didChange = detail ? detail.changedNodes[inputPathCounter] : true;\n changedMap.set(this.inputPaths[inputPathCounter], didChange);\n inputPathCounter += 1;\n } else if (entry.multi) {\n let sliced = this.inputPaths.slice(inputPathCounter, inputPathCounter + entry.multi.length);\n\n result[entry.name] = sliced.map(slice => {\n let didChange = detail ? detail.changedNodes[inputPathCounter] : true;\n changedMap.set(slice, didChange);\n inputPathCounter++;\n return slice;\n });\n }\n }\n return this.buildHook(result as unknown as OutputPaths<NamedTrees>, changedMap);\n }\n}\n\nexport type OutputPaths<NamedTrees> = {\n [P in keyof NamedTrees]: NamedTrees[P] extends Node ? string : NamedTrees[P] extends Node[] ? string[] : never;\n};\n\nfunction isTree(x: any): x is Node {\n return x && typeof x.__broccoliGetInfo__ === 'function';\n}\n\nfunction* findTrees<NamedTrees>(trees: NamedTrees): IterableIterator<{ name: string; single?: Node; multi?: Node[] }> {\n for (let [name, value] of Object.entries(trees)) {\n if (Array.isArray(value)) {\n let stringTrees = value.filter(t => typeof t === 'string');\n if (stringTrees.length > 0) {\n throw new Error(`found strings instead of broccoli trees for ${name}: ${value}`);\n }\n yield { name, multi: value.filter(isTree) };\n } else if (isTree(value)) {\n yield { name, single: value };\n } else if (typeof value === 'string') {\n throw new Error(`found a string when we expected a broccoli tree for ${name}: ${value}`);\n }\n }\n}\n\nfunction flatTrees<NamedTrees>(trees: NamedTrees) {\n let output: Node[] = [];\n for (let value of findTrees(trees)) {\n if (value.multi) {\n output = output.concat(value.multi);\n } else if (value.single) {\n output.push(value.single);\n }\n }\n return output;\n}\n"]}
|
|
@@ -12,8 +12,8 @@ function templateCompilerModule(params, hints) {
|
|
|
12
12
|
let result = p.dehydrate(params);
|
|
13
13
|
return {
|
|
14
14
|
src: [
|
|
15
|
-
`const { NodeTemplateCompiler } = require("${js_string_escape_1.default(path_1.resolve(__dirname, './template-compiler-node.js'))}");`,
|
|
16
|
-
`const { Portable } = require("${js_string_escape_1.default(path_1.resolve(__dirname, './portable.js'))}");`,
|
|
15
|
+
`const { NodeTemplateCompiler } = require("${(0, js_string_escape_1.default)((0, path_1.resolve)(__dirname, './template-compiler-node.js'))}");`,
|
|
16
|
+
`const { Portable } = require("${(0, js_string_escape_1.default)((0, path_1.resolve)(__dirname, './portable.js'))}");`,
|
|
17
17
|
`let p = new Portable({ hints: ${JSON.stringify(hints, null, 2)} });`,
|
|
18
18
|
`module.exports = new NodeTemplateCompiler(p.hydrate(${JSON.stringify(result.value, null, 2)}))`,
|
|
19
19
|
].join('\n'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"write-template-compiler.js","sourceRoot":"","sources":["write-template-compiler.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA+B;AAC/B,yCAAoD;AAEpD,wEAA8C;AAE9C,SAAgB,sBAAsB,CAAC,MAAkC,EAAE,KAAqB;IAC9F,IAAI,CAAC,GAAG,IAAI,mBAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAChC,IAAI,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO;QACL,GAAG,EAAE;YACH,6CAA6C,0BAAc,
|
|
1
|
+
{"version":3,"file":"write-template-compiler.js","sourceRoot":"","sources":["write-template-compiler.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA+B;AAC/B,yCAAoD;AAEpD,wEAA8C;AAE9C,SAAgB,sBAAsB,CAAC,MAAkC,EAAE,KAAqB;IAC9F,IAAI,CAAC,GAAG,IAAI,mBAAQ,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC;IAChC,IAAI,MAAM,GAAG,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;IACjC,OAAO;QACL,GAAG,EAAE;YACH,6CAA6C,IAAA,0BAAc,EACzD,IAAA,cAAO,EAAC,SAAS,EAAE,6BAA6B,CAAC,CAClD,KAAK;YACN,iCAAiC,IAAA,0BAAc,EAAC,IAAA,cAAO,EAAC,SAAS,EAAE,eAAe,CAAC,CAAC,KAAK;YACzF,iCAAiC,IAAI,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM;YACrE,uDAAuD,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI;SACjG,CAAC,IAAI,CAAC,IAAI,CAAC;QACZ,cAAc,EAAE,MAAM,CAAC,cAAc;KACtC,CAAC;AACJ,CAAC;AAdD,wDAcC","sourcesContent":["import { resolve } from 'path';\nimport { Portable, PortableHint } from './portable';\nimport type { NodeTemplateCompilerParams } from './template-compiler-node';\nimport jsStringEscape from 'js-string-escape';\n\nexport function templateCompilerModule(params: NodeTemplateCompilerParams, hints: PortableHint[]) {\n let p = new Portable({ hints });\n let result = p.dehydrate(params);\n return {\n src: [\n `const { NodeTemplateCompiler } = require(\"${jsStringEscape(\n resolve(__dirname, './template-compiler-node.js')\n )}\");`,\n `const { Portable } = require(\"${jsStringEscape(resolve(__dirname, './portable.js'))}\");`,\n `let p = new Portable({ hints: ${JSON.stringify(hints, null, 2)} });`,\n `module.exports = new NodeTemplateCompiler(p.hydrate(${JSON.stringify(result.value, null, 2)}))`,\n ].join('\\n'),\n isParallelSafe: result.isParallelSafe,\n };\n}\n"]}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { NodeTemplateCompilerParams } from './template-compiler-node';
|
|
2
|
-
import { precompile } from './babel-plugin-inline-hbs-deps';
|
|
3
|
-
export interface Params {
|
|
4
|
-
templateCompiler: NodeTemplateCompilerParams;
|
|
5
|
-
}
|
|
6
|
-
declare const _default: {
|
|
7
|
-
(babel: typeof import("@babel/core")): unknown;
|
|
8
|
-
_parallelBabel: {
|
|
9
|
-
requireFile: string;
|
|
10
|
-
};
|
|
11
|
-
baseDir(): string;
|
|
12
|
-
};
|
|
13
|
-
export default _default;
|
|
14
|
-
export { precompile };
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.precompile = void 0;
|
|
23
|
-
const template_compiler_node_1 = require("./template-compiler-node");
|
|
24
|
-
const babel_plugin_inline_hbs_deps_1 = __importStar(require("./babel-plugin-inline-hbs-deps"));
|
|
25
|
-
Object.defineProperty(exports, "precompile", { enumerable: true, get: function () { return babel_plugin_inline_hbs_deps_1.precompile; } });
|
|
26
|
-
exports.default = babel_plugin_inline_hbs_deps_1.default((opts) => new template_compiler_node_1.NodeTemplateCompiler(opts.templateCompiler));
|
|
27
|
-
//# sourceMappingURL=babel-plugin-inline-hbs-deps-node.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"babel-plugin-inline-hbs-deps-node.js","sourceRoot":"","sources":["babel-plugin-inline-hbs-deps-node.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,qEAA4F;AAC5F,+FAAkE;AAOzD,2FAPM,yCAAU,OAON;AADnB,kBAAe,sCAAI,CAAC,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,6CAAoB,CAAC,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type * as Babel from '@babel/core';
|
|
2
|
-
import { TemplateCompiler } from './template-compiler-common';
|
|
3
|
-
export declare function precompile(templateSource: string, options: Record<string, unknown>): string;
|
|
4
|
-
export default function make(getCompiler: (opts: any) => TemplateCompiler): {
|
|
5
|
-
(babel: typeof Babel): unknown;
|
|
6
|
-
_parallelBabel: {
|
|
7
|
-
requireFile: string;
|
|
8
|
-
};
|
|
9
|
-
baseDir(): string;
|
|
10
|
-
};
|