@embroider/compat 3.4.1-unstable.efd9117 → 3.4.2-unstable.2287af7
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/compat",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.2-unstable.2287af7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Backward compatibility layer for the Embroider build system.",
|
|
6
6
|
"repository": {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@babel/preset-env": "^7.14.5",
|
|
31
31
|
"@babel/runtime": "^7.18.6",
|
|
32
32
|
"@babel/traverse": "^7.14.5",
|
|
33
|
-
"@embroider/macros": "1.13.
|
|
33
|
+
"@embroider/macros": "1.13.5-unstable.2287af7",
|
|
34
34
|
"@types/babel__code-frame": "^7.0.2",
|
|
35
35
|
"@types/yargs": "^17.0.3",
|
|
36
36
|
"assert-never": "^1.1.0",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"yargs": "^17.0.1"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@embroider/core": "3.4.
|
|
69
|
+
"@embroider/core": "3.4.4-unstable.2287af7",
|
|
70
70
|
"@embroider/sample-transforms": "workspace:*",
|
|
71
71
|
"@embroider/test-support": "workspace:*",
|
|
72
72
|
"@glimmer/syntax": "^0.84.3",
|
|
@@ -87,11 +87,11 @@
|
|
|
87
87
|
"broccoli-node-api": "^1.7.0",
|
|
88
88
|
"code-equality-assertions": "^0.9.0",
|
|
89
89
|
"ember-engines": "^0.8.19",
|
|
90
|
-
"scenario-tester": "^
|
|
90
|
+
"scenario-tester": "^3.0.1",
|
|
91
91
|
"typescript": "^5.1.6"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@embroider/core": "3.4.
|
|
94
|
+
"@embroider/core": "3.4.4-unstable.2287af7"
|
|
95
95
|
},
|
|
96
96
|
"engines": {
|
|
97
97
|
"node": "12.* || 14.* || >= 16"
|
|
@@ -122,10 +122,16 @@ class default_1 extends v1_addon_1.default {
|
|
|
122
122
|
meta['implicit-modules'] = [];
|
|
123
123
|
}
|
|
124
124
|
meta['implicit-modules'].push('./ember/index.js');
|
|
125
|
-
if
|
|
126
|
-
|
|
125
|
+
// before 5.6, Ember uses the AMD loader to decide if it's test-only parts
|
|
126
|
+
// are present, so we must ensure they're registered. After that it's
|
|
127
|
+
// enough to evaluate ember-testing, which @embroider/core is hard-coded
|
|
128
|
+
// to do in the backward-compatible tests bundle.
|
|
129
|
+
if (!(0, semver_1.satisfies)(this.packageJSON.version, '>= 5.6.0-alpha.0', { includePrerelease: true })) {
|
|
130
|
+
if (!meta['implicit-test-modules']) {
|
|
131
|
+
meta['implicit-test-modules'] = [];
|
|
132
|
+
}
|
|
133
|
+
meta['implicit-test-modules'].push('./ember-testing/index.js');
|
|
127
134
|
}
|
|
128
|
-
meta['implicit-test-modules'].push('./ember-testing/index.js');
|
|
129
135
|
}
|
|
130
136
|
return meta;
|
|
131
137
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ember-source.js","sourceRoot":"","sources":["ember-source.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkC;AAClC,sEAA0C;AAC1C,gFAA8C;AAC9C,iEAAuC;AACvC,uCAAiF;AACjF,+BAAqC;AACrC,2DAA6C;AAC7C,mCAAmC;AACnC,sCAAwC;AAGxC,sEAAqC;AAGrC,eAAqB,SAAQ,kBAAO;IAClC,IAAI,MAAM;QACR,OAAO,IAAA,8BAAU,EAAC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,yBAAW,EAAC,IAAI,CAAC,QAAQ,EAAE,EAAE,OAAO,EAAE,CAAC,iCAAiC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAClH,CAAC;IAED,IAAY,cAAc;QACxB,OAAO,I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IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC9F,IAAI,KAAK,CAAC,aAAa,IAAI,IAAI,KAAK,KAAK,EAAE;oBACzC,IAAI,CAAC,MAAM,EAAE,CAAC;iBACf;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import V1Addon from '../v1-addon';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport AddToTree from '../add-to-tree';\nimport { outputFileSync, readFileSync, readdirSync, unlinkSync } from 'fs-extra';\nimport { join, resolve } from 'path';\nimport { Memoize } from 'typescript-memoize';\nimport { satisfies } from 'semver';\nimport { transform } from '@babel/core';\nimport type * as Babel from '@babel/core';\nimport type { NodePath } from '@babel/traverse';\nimport Plugin from 'broccoli-plugin';\nimport type { Node } from 'broccoli-node-api';\n\nexport default class extends V1Addon {\n get v2Tree() {\n return mergeTrees([super.v2Tree, buildFunnel(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);\n }\n\n private get useStaticEmber(): boolean {\n return this.app.options.staticEmberSource;\n }\n\n // ember-source inlines a whole bunch of dependencies into itself\n @Memoize()\n private get includedDependencies() {\n let result: string[] = [];\n for (let name of readdirSync(resolve(this.root, 'dist', 'dependencies'))) {\n if (name[0] === '@') {\n for (let innerName of readdirSync(resolve(this.root, 'dist', 'dependencies', name))) {\n if (innerName.endsWith('.js')) {\n result.push(name + '/' + innerName.slice(0, -3));\n }\n }\n } else {\n if (name.endsWith('.js')) {\n result.push(name.slice(0, -3));\n }\n }\n }\n return result;\n }\n\n get newPackageJSON() {\n let json = super.newPackageJSON;\n if (this.useStaticEmber) {\n for (let name of this.includedDependencies) {\n // weirdly, many of the inlined dependency are still listed as real\n // dependencies too. If we don't delete them here, they will take\n // precedence over the inlined ones, because the embroider module-resolver\n // tries to prioritize real deps.\n delete json.dependencies?.[name];\n }\n }\n return json;\n }\n\n customizes(treeName: string) {\n if (this.useStaticEmber) {\n // we are adding custom implementations of these\n return treeName === 'treeForAddon' || treeName === 'treeForVendor' || super.customizes(treeName);\n } else {\n return super.customizes(treeName);\n }\n }\n\n invokeOriginalTreeFor(name: string, opts: { neuterPreprocessors: boolean } = { neuterPreprocessors: false }) {\n if (this.useStaticEmber) {\n if (name === 'addon') {\n return this.customAddonTree();\n }\n if (name === 'vendor') {\n return this.customVendorTree();\n }\n }\n return super.invokeOriginalTreeFor(name, opts);\n }\n\n // Our addon tree is all of the \"packages\" we share. @embroider/compat already\n // supports that pattern of emitting modules into other package's namespaces.\n private customAddonTree() {\n let packages = buildFunnel(this.rootTree, {\n srcDir: 'dist/packages',\n });\n\n let trees: Node[] = [\n packages,\n buildFunnel(this.rootTree, {\n srcDir: 'dist/dependencies',\n }),\n ];\n\n if (satisfies(this.packageJSON.version, '>= 4.0.0-alpha.0 <4.10.0-alpha.0', { includePrerelease: true })) {\n // import { loc } from '@ember/string' was removed in 4.0. but the\n // top-level `ember` package tries to import it until 4.10. A\n // spec-compliant ES modules implementation will treat this as a parse\n // error.\n trees.push(new FixStringLoc([packages]));\n }\n\n return mergeTrees(trees, { overwrite: true });\n }\n\n // We're zeroing out these files in vendor rather than deleting them, because\n // we can't easily intercept the `app.import` that presumably exists for them,\n // so rather than error they will just be empty.\n //\n // The reason we're zeroing these out is that we're going to consume all our\n // modules directly out of treeForAddon instead, as real modules that webpack\n // can see.\n private customVendorTree() {\n return new AddToTree(this.addonInstance._treeFor('vendor'), outputPath => {\n unlinkSync(join(outputPath, 'ember', 'ember.js'));\n outputFileSync(join(outputPath, 'ember', 'ember.js'), '');\n unlinkSync(join(outputPath, 'ember', 'ember-testing.js'));\n outputFileSync(join(outputPath, 'ember', 'ember-testing.js'), '');\n });\n }\n\n get packageMeta() {\n let meta = super.packageMeta;\n if (this.useStaticEmber) {\n if (!meta['implicit-modules']) {\n meta['implicit-modules'] = [];\n }\n meta['implicit-modules'].push('./ember/index.js');\n\n if (!meta['implicit-test-modules']) {\n meta['implicit-test-modules'] = [];\n }\n meta['implicit-test-modules'].push('./ember-testing/index.js');\n }\n return meta;\n }\n}\n\nclass FixStringLoc extends Plugin {\n build() {\n let inSource = readFileSync(resolve(this.inputPaths[0], 'ember', 'index.js'), 'utf8');\n let outSource = transform(inSource, {\n plugins: [fixStringLoc],\n configFile: false,\n })!.code!;\n outputFileSync(resolve(this.outputPath, 'ember', 'index.js'), outSource, 'utf8');\n }\n}\n\nfunction fixStringLoc(babel: typeof Babel) {\n let t = babel.types;\n return {\n visitor: {\n Program(path: NodePath<Babel.types.Program>) {\n path.node.body.unshift(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier('loc'), t.identifier('undefined'))])\n );\n },\n ImportDeclaration: {\n enter(path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n if (path.node.source.value === '@ember/string') {\n state.inEmberString = true;\n }\n },\n exit(_path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n state.inEmberString = false;\n },\n },\n ImportSpecifier(path: NodePath<Babel.types.ImportSpecifier>, state: { inEmberString: boolean }) {\n let name = 'value' in path.node.imported ? path.node.imported.value : path.node.imported.name;\n if (state.inEmberString && name === 'loc') {\n path.remove();\n }\n },\n },\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ember-source.js","sourceRoot":"","sources":["ember-source.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAAkC;AAClC,sEAA0C;AAC1C,gFAA8C;AAC9C,iEAAuC;AACvC,uCAAiF;AACjF,+BAAqC;AACrC,2DAA6C;AAC7C,mCAAmC;AACnC,sCAAwC;AAGxC,sEAAqC;AAGrC,eAAqB,SAAQ,kBAAO;IAClC,IAAI,MAAM;QACR,OAAO,IAAA,8BAAU,EAAC,CAAC,KAAK,CAAC,MAAM,EAAE,IAAA,yBAAW,EAAC,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CAAC,IAA6C,EAAE,KAAiC;oBACpF,IAAI,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,KAAK,eAAe,EAAE;wBAC9C,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC;qBAC5B;gBACH,CAAC;gBACD,IAAI,CAAC,KAA8C,EAAE,KAAiC;oBACpF,KAAK,CAAC,aAAa,GAAG,KAAK,CAAC;gBAC9B,CAAC;aACF;YACD,eAAe,CAAC,IAA2C,EAAE,KAAiC;gBAC5F,IAAI,IAAI,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC9F,IAAI,KAAK,CAAC,aAAa,IAAI,IAAI,KAAK,KAAK,EAAE;oBACzC,IAAI,CAAC,MAAM,EAAE,CAAC;iBACf;YACH,CAAC;SACF;KACF,CAAC;AACJ,CAAC","sourcesContent":["import V1Addon from '../v1-addon';\nimport buildFunnel from 'broccoli-funnel';\nimport mergeTrees from 'broccoli-merge-trees';\nimport AddToTree from '../add-to-tree';\nimport { outputFileSync, readFileSync, readdirSync, unlinkSync } from 'fs-extra';\nimport { join, resolve } from 'path';\nimport { Memoize } from 'typescript-memoize';\nimport { satisfies } from 'semver';\nimport { transform } from '@babel/core';\nimport type * as Babel from '@babel/core';\nimport type { NodePath } from '@babel/traverse';\nimport Plugin from 'broccoli-plugin';\nimport type { Node } from 'broccoli-node-api';\n\nexport default class extends V1Addon {\n get v2Tree() {\n return mergeTrees([super.v2Tree, buildFunnel(this.rootTree, { include: ['dist/ember-template-compiler.js'] })]);\n }\n\n private get useStaticEmber(): boolean {\n return this.app.options.staticEmberSource;\n }\n\n // ember-source inlines a whole bunch of dependencies into itself\n @Memoize()\n private get includedDependencies() {\n let result: string[] = [];\n for (let name of readdirSync(resolve(this.root, 'dist', 'dependencies'))) {\n if (name[0] === '@') {\n for (let innerName of readdirSync(resolve(this.root, 'dist', 'dependencies', name))) {\n if (innerName.endsWith('.js')) {\n result.push(name + '/' + innerName.slice(0, -3));\n }\n }\n } else {\n if (name.endsWith('.js')) {\n result.push(name.slice(0, -3));\n }\n }\n }\n return result;\n }\n\n get newPackageJSON() {\n let json = super.newPackageJSON;\n if (this.useStaticEmber) {\n for (let name of this.includedDependencies) {\n // weirdly, many of the inlined dependency are still listed as real\n // dependencies too. If we don't delete them here, they will take\n // precedence over the inlined ones, because the embroider module-resolver\n // tries to prioritize real deps.\n delete json.dependencies?.[name];\n }\n }\n return json;\n }\n\n customizes(treeName: string) {\n if (this.useStaticEmber) {\n // we are adding custom implementations of these\n return treeName === 'treeForAddon' || treeName === 'treeForVendor' || super.customizes(treeName);\n } else {\n return super.customizes(treeName);\n }\n }\n\n invokeOriginalTreeFor(name: string, opts: { neuterPreprocessors: boolean } = { neuterPreprocessors: false }) {\n if (this.useStaticEmber) {\n if (name === 'addon') {\n return this.customAddonTree();\n }\n if (name === 'vendor') {\n return this.customVendorTree();\n }\n }\n return super.invokeOriginalTreeFor(name, opts);\n }\n\n // Our addon tree is all of the \"packages\" we share. @embroider/compat already\n // supports that pattern of emitting modules into other package's namespaces.\n private customAddonTree() {\n let packages = buildFunnel(this.rootTree, {\n srcDir: 'dist/packages',\n });\n\n let trees: Node[] = [\n packages,\n buildFunnel(this.rootTree, {\n srcDir: 'dist/dependencies',\n }),\n ];\n\n if (satisfies(this.packageJSON.version, '>= 4.0.0-alpha.0 <4.10.0-alpha.0', { includePrerelease: true })) {\n // import { loc } from '@ember/string' was removed in 4.0. but the\n // top-level `ember` package tries to import it until 4.10. A\n // spec-compliant ES modules implementation will treat this as a parse\n // error.\n trees.push(new FixStringLoc([packages]));\n }\n\n return mergeTrees(trees, { overwrite: true });\n }\n\n // We're zeroing out these files in vendor rather than deleting them, because\n // we can't easily intercept the `app.import` that presumably exists for them,\n // so rather than error they will just be empty.\n //\n // The reason we're zeroing these out is that we're going to consume all our\n // modules directly out of treeForAddon instead, as real modules that webpack\n // can see.\n private customVendorTree() {\n return new AddToTree(this.addonInstance._treeFor('vendor'), outputPath => {\n unlinkSync(join(outputPath, 'ember', 'ember.js'));\n outputFileSync(join(outputPath, 'ember', 'ember.js'), '');\n unlinkSync(join(outputPath, 'ember', 'ember-testing.js'));\n outputFileSync(join(outputPath, 'ember', 'ember-testing.js'), '');\n });\n }\n\n get packageMeta() {\n let meta = super.packageMeta;\n if (this.useStaticEmber) {\n if (!meta['implicit-modules']) {\n meta['implicit-modules'] = [];\n }\n meta['implicit-modules'].push('./ember/index.js');\n // before 5.6, Ember uses the AMD loader to decide if it's test-only parts\n // are present, so we must ensure they're registered. After that it's\n // enough to evaluate ember-testing, which @embroider/core is hard-coded\n // to do in the backward-compatible tests bundle.\n if (!satisfies(this.packageJSON.version, '>= 5.6.0-alpha.0', { includePrerelease: true })) {\n if (!meta['implicit-test-modules']) {\n meta['implicit-test-modules'] = [];\n }\n meta['implicit-test-modules'].push('./ember-testing/index.js');\n }\n }\n return meta;\n }\n}\n\nclass FixStringLoc extends Plugin {\n build() {\n let inSource = readFileSync(resolve(this.inputPaths[0], 'ember', 'index.js'), 'utf8');\n let outSource = transform(inSource, {\n plugins: [fixStringLoc],\n configFile: false,\n })!.code!;\n outputFileSync(resolve(this.outputPath, 'ember', 'index.js'), outSource, 'utf8');\n }\n}\n\nfunction fixStringLoc(babel: typeof Babel) {\n let t = babel.types;\n return {\n visitor: {\n Program(path: NodePath<Babel.types.Program>) {\n path.node.body.unshift(\n t.variableDeclaration('const', [t.variableDeclarator(t.identifier('loc'), t.identifier('undefined'))])\n );\n },\n ImportDeclaration: {\n enter(path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n if (path.node.source.value === '@ember/string') {\n state.inEmberString = true;\n }\n },\n exit(_path: NodePath<Babel.types.ImportDeclaration>, state: { inEmberString: boolean }) {\n state.inEmberString = false;\n },\n },\n ImportSpecifier(path: NodePath<Babel.types.ImportSpecifier>, state: { inEmberString: boolean }) {\n let name = 'value' in path.node.imported ? path.node.imported.value : path.node.imported.name;\n if (state.inEmberString && name === 'loc') {\n path.remove();\n }\n },\n },\n };\n}\n"]}
|
|
@@ -177,7 +177,7 @@ class CompatAppBuilder {
|
|
|
177
177
|
// For TS, we defer to ember-cli-babel, and the setting for
|
|
178
178
|
// "enableTypescriptTransform" can be set with and without
|
|
179
179
|
// ember-cli-typescript
|
|
180
|
-
return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js'];
|
|
180
|
+
return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js', '.gjs', '.gts'];
|
|
181
181
|
}
|
|
182
182
|
*emberEntrypoints(htmlTreePath) {
|
|
183
183
|
let classicEntrypoints = [
|
|
@@ -1068,10 +1068,16 @@ class CompatAppBuilder {
|
|
|
1068
1068
|
let [fastboot, nonFastboot] = (0, partition_1.default)(excludeDotFiles((0, flatten_1.default)(requiredAppFiles)), file => appFiles.isFastbootOnly.get(file));
|
|
1069
1069
|
let amdModules = nonFastboot.map(file => this.importPaths(appFiles, file));
|
|
1070
1070
|
let fastbootOnlyAmdModules = fastboot.map(file => this.importPaths(appFiles, file));
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1071
|
+
let params = {
|
|
1072
|
+
amdModules,
|
|
1073
|
+
fastbootOnlyAmdModules,
|
|
1074
|
+
lazyRoutes,
|
|
1075
|
+
lazyEngines,
|
|
1076
|
+
eagerModules,
|
|
1077
|
+
styles,
|
|
1078
|
+
// this is a backward-compatibility feature: addons can force inclusion of modules.
|
|
1079
|
+
defineModulesFrom: './-embroider-implicit-modules.js',
|
|
1080
|
+
};
|
|
1075
1081
|
if (entryParams) {
|
|
1076
1082
|
Object.assign(params, entryParams);
|
|
1077
1083
|
}
|
|
@@ -1119,12 +1125,10 @@ class CompatAppBuilder {
|
|
|
1119
1125
|
// packagers to understand. It's better to express it here as a direct
|
|
1120
1126
|
// module dependency.
|
|
1121
1127
|
let eagerModules = [
|
|
1128
|
+
'ember-testing',
|
|
1122
1129
|
(0, core_1.explicitRelative)((0, path_2.dirname)(myName), this.topAppJSAsset(appFiles, prepared).relativePath),
|
|
1123
1130
|
];
|
|
1124
1131
|
let amdModules = [];
|
|
1125
|
-
// this is a backward-compatibility feature: addons can force inclusion of
|
|
1126
|
-
// test support modules.
|
|
1127
|
-
eagerModules.push('./-embroider-implicit-test-modules.js');
|
|
1128
1132
|
for (let relativePath of engine.tests) {
|
|
1129
1133
|
amdModules.push(this.importPaths(engine, relativePath));
|
|
1130
1134
|
}
|
|
@@ -1132,6 +1136,8 @@ class CompatAppBuilder {
|
|
|
1132
1136
|
amdModules,
|
|
1133
1137
|
eagerModules,
|
|
1134
1138
|
testSuffix: true,
|
|
1139
|
+
// this is a backward-compatibility feature: addons can force inclusion of test support modules.
|
|
1140
|
+
defineModulesFrom: './-embroider-implicit-test-modules.js',
|
|
1135
1141
|
});
|
|
1136
1142
|
asset = {
|
|
1137
1143
|
kind: 'in-memory',
|
|
@@ -1203,6 +1209,15 @@ let d = w.define;
|
|
|
1203
1209
|
}
|
|
1204
1210
|
{{/if}}
|
|
1205
1211
|
|
|
1212
|
+
{{#if defineModulesFrom ~}}
|
|
1213
|
+
import implicitModules from "{{js-string-escape defineModulesFrom}}";
|
|
1214
|
+
|
|
1215
|
+
for(const [name, module] of Object.entries(implicitModules)) {
|
|
1216
|
+
d(name, function() { return module });
|
|
1217
|
+
}
|
|
1218
|
+
{{/if}}
|
|
1219
|
+
|
|
1220
|
+
|
|
1206
1221
|
{{#each eagerModules as |eagerModule| ~}}
|
|
1207
1222
|
i("{{js-string-escape eagerModule}}");
|
|
1208
1223
|
{{/each}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;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B,SAAI,GAAmB,cAAc,CAAC;QAMpC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,IAAI,GAAG,IAAI,8BAAiB,CAAC,KAAK,CAAC,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IACzC,CAAC;IAED,QAAQ,CAAC,KAAiB;QACxB,OAAO,IAAI,CAAC,SAAS,CAAC,KAAK,KAAK,KAAK,CAAC,KAAK,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,KAAK,KAAK,CAAC,IAAI,CAAC;IACpF,CAAC;CACF;AAED,MAAM,eAAe;IAMnB,YAAY,KAAuB;QALnC,SAAI,GAAkB,aAAa,CAAC;QAMlC,IAAI,CAAC,WAAW,GAAG,KAAK,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACzC,IAAI,CAAC,YAAY,GAAG,KAAK,CAAC,YAAY,CAAC;IACzC,CAAC;CACF;AAED,MAAM,iBAAiB;IAErB,YACS,YAAoB,EACpB,OAAwC,EACvC,oBAA4B;QAF7B,iBAAY,GAAZ,YAAY,CAAQ;QACpB,YAAO,GAAP,OAAO,CAAiC;QACvC,yBAAoB,GAApB,oBAAoB,CAAQ;QAJtC,SAAI,GAAyB,oBAAoB,CAAC;IAK/C,CAAC;IACJ,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { Node as BroccoliNode } from 'broccoli-node-api';\nimport type {\n OutputPaths,\n Asset,\n EmberAsset,\n AddonPackage,\n Engine,\n AppMeta,\n TemplateColocationPluginOptions,\n} from '@embroider/core';\nimport {\n explicitRelative,\n extensionsPattern,\n debug,\n warn,\n jsHandlebarsCompile,\n templateColocationPluginPath,\n cacheBustingPluginVersion,\n cacheBustingPluginPath,\n Resolver,\n locateEmbroiderWorkingDir,\n} from '@embroider/core';\nimport walkSync from 'walk-sync';\nimport { resolve as resolvePath, posix } from 'path';\nimport type { JSDOM } from 'jsdom';\nimport type Options from './options';\nimport type { CompatResolverOptions } from './resolver-transform';\nimport type { PackageRules } from './dependency-rules';\nimport { activePackageRules } from './dependency-rules';\nimport flatMap from 'lodash/flatMap';\nimport sortBy from 'lodash/sortBy';\nimport flatten from 'lodash/flatten';\nimport partition from 'lodash/partition';\nimport mergeWith from 'lodash/mergeWith';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { sync as resolveSync } from 'resolve';\nimport bind from 'bind-decorator';\nimport { outputJSONSync, readJSONSync, rmSync, statSync, unlinkSync, writeFileSync, realpathSync } from 'fs-extra';\nimport type { Options as EtcOptions } from 'babel-plugin-ember-template-compilation';\nimport type { Options as ResolverTransformOptions } from './resolver-transform';\nimport type { Options as AdjustImportsOptions } from './babel-plugin-adjust-imports';\nimport { PreparedEmberHTML } from '@embroider/core/src/ember-html';\nimport type { InMemoryAsset, OnDiskAsset, ImplicitAssetPaths } from '@embroider/core/src/asset';\nimport { makePortable } from '@embroider/core/src/portable-babel-config';\nimport type { RouteFiles } from '@embroider/core/src/app-files';\nimport { AppFiles } from '@embroider/core/src/app-files';\nimport type { PortableHint } from '@embroider/core/src/portable';\nimport { maybeNodeModuleVersion } from '@embroider/core/src/portable';\nimport assertNever from 'assert-never';\nimport { Memoize } from 'typescript-memoize';\nimport { join, dirname } from 'path';\nimport resolve from 'resolve';\nimport type { V1Config } from './v1-config';\nimport type { AddonMeta, Package, PackageInfo } from '@embroider/core';\nimport { ensureDirSync, copySync, readdirSync, pathExistsSync } from 'fs-extra';\nimport type { TransformOptions } from '@babel/core';\nimport { MacrosConfig } from '@embroider/macros/src/node';\nimport SourceMapConcat from 'fast-sourcemap-concat';\nimport escapeRegExp from 'escape-string-regexp';\n\nimport type CompatApp from './compat-app';\nimport { SyncDir } from './sync-dir';\n\n// This exists during the actual broccoli build step. As opposed to CompatApp,\n// which also exists during pipeline-construction time.\n\nexport class CompatAppBuilder {\n // for each relativePath, an Asset we have already emitted\n private assets: Map<string, InternalAsset> = new Map();\n\n constructor(\n private root: string,\n private origAppPackage: Package,\n private appPackageWithMovedDeps: Package,\n private options: Required<Options>,\n private compatApp: CompatApp,\n private configTree: V1Config,\n private synthVendor: Package,\n private synthStyles: Package\n ) {}\n\n @Memoize()\n private fastbootJSSrcDir() {\n let target = join(this.compatApp.root, 'fastboot');\n if (pathExistsSync(target)) {\n return target;\n }\n }\n\n private extractAssets(treePaths: OutputPaths<TreeNames>): Asset[] {\n let assets: Asset[] = [];\n\n // Everything in our traditional public tree is an on-disk asset\n if (treePaths.publicTree) {\n walkSync\n .entries(treePaths.publicTree, {\n directories: false,\n })\n .forEach(entry => {\n assets.push({\n kind: 'on-disk',\n relativePath: entry.relativePath,\n sourcePath: entry.fullPath,\n mtime: entry.mtime as unknown as number, // https://github.com/joliss/node-walk-sync/pull/38\n size: entry.size,\n });\n });\n }\n\n // ember-cli traditionally outputs a dummy testem.js file to prevent\n // spurious errors when running tests under \"ember s\".\n if (this.compatApp.shouldBuildTests) {\n let testemAsset = this.findTestemAsset();\n if (testemAsset) {\n assets.push(testemAsset);\n }\n }\n\n for (let asset of this.emberEntrypoints(treePaths.htmlTree)) {\n assets.push(asset);\n }\n\n return assets;\n }\n\n @Memoize()\n private findTestemAsset(): Asset | undefined {\n let sourcePath;\n try {\n sourcePath = resolveSync('ember-cli/lib/broccoli/testem.js', { basedir: this.root });\n } catch (err) {}\n if (sourcePath) {\n let stat = statSync(sourcePath);\n return {\n kind: 'on-disk',\n relativePath: 'testem.js',\n sourcePath,\n mtime: stat.mtime.getTime(),\n size: stat.size,\n };\n }\n }\n\n private activeAddonChildren(pkg: Package): AddonPackage[] {\n let result = (pkg.dependencies.filter(this.isActiveAddon) as AddonPackage[]).filter(\n // When looking for child addons, we want to ignore 'peerDependencies' of\n // a given package, to align with how ember-cli resolves addons. So here\n // we only include dependencies that are definitely active due to one of\n // the other sections.\n addon => pkg.categorizeDependency(addon.name) !== 'peerDependencies'\n );\n if (pkg === this.appPackageWithMovedDeps) {\n let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon) as AddonPackage[];\n result = [...result, ...extras];\n }\n return result.sort(this.orderAddons);\n }\n\n @Memoize()\n private get allActiveAddons(): AddonPackage[] {\n let result = this.appPackageWithMovedDeps.findDescendants(this.isActiveAddon) as AddonPackage[];\n let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon) as AddonPackage[];\n let extraDescendants = flatMap(extras, dep => dep.findDescendants(this.isActiveAddon)) as AddonPackage[];\n result = [...result, ...extras, ...extraDescendants];\n return result.sort(this.orderAddons);\n }\n\n @bind\n private isActiveAddon(pkg: Package): boolean {\n // stage1 already took care of converting everything that's actually active\n // into v2 addons. If it's not a v2 addon, we don't want it.\n //\n // We can encounter v1 addons here when there is inactive stuff floating\n // around in the node_modules that accidentally satisfy something like an\n // optional peer dep.\n return pkg.isV2Addon();\n }\n\n @bind\n private orderAddons(depA: Package, depB: Package): number {\n let depAIdx = 0;\n let depBIdx = 0;\n\n if (depA && depA.meta && depA.isV2Addon()) {\n depAIdx = depA.meta['order-index'] || 0;\n }\n if (depB && depB.meta && depB.isV2Addon()) {\n depBIdx = depB.meta['order-index'] || 0;\n }\n\n return depAIdx - depBIdx;\n }\n\n private resolvableExtensions(): string[] {\n // webpack's default is ['.wasm', '.mjs', '.js', '.json']. Keeping that\n // subset in that order is sensible, since many third-party libraries will\n // expect it to work that way.\n //\n // For TS, we defer to ember-cli-babel, and the setting for\n // \"enableTypescriptTransform\" can be set with and without\n // ember-cli-typescript\n return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js'];\n }\n\n private *emberEntrypoints(htmlTreePath: string): IterableIterator<Asset> {\n let classicEntrypoints = [\n { entrypoint: 'index.html', includeTests: false },\n { entrypoint: 'tests/index.html', includeTests: true },\n ];\n if (!this.compatApp.shouldBuildTests) {\n classicEntrypoints.pop();\n }\n for (let { entrypoint, includeTests } of classicEntrypoints) {\n let sourcePath = join(htmlTreePath, entrypoint);\n let stats = statSync(sourcePath);\n let asset: EmberAsset = {\n kind: 'ember',\n relativePath: entrypoint,\n includeTests,\n sourcePath,\n mtime: stats.mtime.getTime(),\n size: stats.size,\n rootURL: this.rootURL(),\n prepare: (dom: JSDOM) => {\n let scripts = [...dom.window.document.querySelectorAll('script')];\n let styles = [...dom.window.document.querySelectorAll('link[rel*=\"stylesheet\"]')] as HTMLLinkElement[];\n return {\n javascript: this.compatApp.findAppScript(scripts, entrypoint),\n styles: this.compatApp.findAppStyles(styles, entrypoint),\n implicitScripts: this.compatApp.findVendorScript(scripts, entrypoint),\n implicitStyles: this.compatApp.findVendorStyles(styles, entrypoint),\n testJavascript: this.compatApp.findTestScript(scripts),\n implicitTestScripts: this.compatApp.findTestSupportScript(scripts),\n implicitTestStyles: this.compatApp.findTestSupportStyles(styles),\n };\n },\n };\n yield asset;\n }\n }\n\n private modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n private podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\n }\n\n private rootURL(): string {\n return this.configTree.readConfig().rootURL;\n }\n\n @Memoize()\n private activeRules() {\n return activePackageRules(this.options.packageRules.concat(defaultAddonPackageRules()), [\n { name: this.origAppPackage.name, version: this.origAppPackage.version, root: this.root },\n ...this.allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n }\n\n private resolverConfig(engines: AppFiles[]): CompatResolverOptions {\n let renamePackages = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-packages']));\n let renameModules = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-modules']));\n\n let options: CompatResolverOptions['options'] = {\n staticHelpers: this.options.staticHelpers,\n staticModifiers: this.options.staticModifiers,\n staticComponents: this.options.staticComponents,\n allowUnsafeDynamicComponents: this.options.allowUnsafeDynamicComponents,\n };\n\n let config: CompatResolverOptions = {\n // this part is the base ModuleResolverOptions as required by @embroider/core\n renameModules,\n renamePackages,\n resolvableExtensions: this.resolvableExtensions(),\n appRoot: this.origAppPackage.root,\n engines: engines.map((appFiles, index) => ({\n packageName: appFiles.engine.package.name,\n // first engine is the app, which has been relocated to this.root\n // we need to use the real path here because webpack requests always use the real path i.e. follow symlinks\n root: realpathSync(index === 0 ? this.root : appFiles.engine.package.root),\n fastbootFiles: appFiles.fastbootFiles,\n activeAddons: [...appFiles.engine.addons]\n .map(([addon, canResolveFromFile]) => ({\n name: addon.name,\n root: addon.root,\n canResolveFromFile,\n }))\n // the traditional order is the order in which addons will run, such\n // that the last one wins. Our resolver's order is the order to\n // search, so first one wins.\n .reverse(),\n })),\n amdCompatibility: this.options.amdCompatibility,\n\n // this is the additional stufff that @embroider/compat adds on top to do\n // global template resolving\n modulePrefix: this.modulePrefix(),\n podModulePrefix: this.podModulePrefix(),\n activePackageRules: this.activeRules(),\n options,\n };\n\n return config;\n }\n\n private scriptPriority(pkg: Package) {\n switch (pkg.name) {\n case 'loader.js':\n return 0;\n case 'ember-source':\n return 10;\n default:\n return 1000;\n }\n }\n\n @Memoize()\n private get resolvableExtensionsPattern(): RegExp {\n return extensionsPattern(this.resolvableExtensions());\n }\n\n private impliedAssets(\n type: keyof ImplicitAssetPaths,\n engine: AppFiles,\n emberENV?: EmberENV\n ): (OnDiskAsset | InMemoryAsset)[] {\n let result: (OnDiskAsset | InMemoryAsset)[] = this.impliedAddonAssets(type, engine).map(\n (sourcePath: string): OnDiskAsset => {\n let stats = statSync(sourcePath);\n return {\n kind: 'on-disk',\n relativePath: explicitRelative(this.root, sourcePath),\n sourcePath,\n mtime: stats.mtimeMs,\n size: stats.size,\n };\n }\n );\n\n if (type === 'implicit-scripts') {\n result.unshift({\n kind: 'in-memory',\n relativePath: '_testing_prefix_.js',\n source: `var runningTests=false;`,\n });\n\n result.unshift({\n kind: 'in-memory',\n relativePath: '_ember_env_.js',\n source: `window.EmberENV={ ...(window.EmberENV || {}), ...${JSON.stringify(emberENV, null, 2)} };`,\n });\n\n result.push({\n kind: 'in-memory',\n relativePath: '_loader_.js',\n source: `loader.makeDefaultExport=false;`,\n });\n }\n\n if (type === 'implicit-test-scripts') {\n // this is the traditional test-support-suffix.js\n result.push({\n kind: 'in-memory',\n relativePath: '_testing_suffix_.js',\n source: `\n var runningTests=true;\n if (typeof Testem !== 'undefined' && (typeof QUnit !== 'undefined' || typeof Mocha !== 'undefined')) {\n Testem.hookIntoTestFramework();\n }`,\n });\n\n // whether or not anybody was actually using @embroider/macros\n // explicitly as an addon, we ensure its test-support file is always\n // present.\n if (!result.find(s => s.kind === 'on-disk' && s.sourcePath.endsWith('embroider-macros-test-support.js'))) {\n result.unshift({\n kind: 'on-disk',\n sourcePath: require.resolve('@embroider/macros/src/vendor/embroider-macros-test-support'),\n mtime: 0,\n size: 0,\n relativePath: 'embroider-macros-test-support.js',\n });\n }\n }\n\n return result;\n }\n\n private impliedAddonAssets(type: keyof ImplicitAssetPaths, { engine }: AppFiles): string[] {\n let result: Array<string> = [];\n for (let addon of sortBy(Array.from(engine.addons.keys()), this.scriptPriority.bind(this))) {\n let implicitScripts = addon.meta[type];\n if (implicitScripts) {\n let styles = [];\n let options = { basedir: addon.root };\n for (let mod of implicitScripts) {\n if (type === 'implicit-styles') {\n // exclude engines because they will handle their own css importation\n if (!addon.isLazyEngine()) {\n styles.push(resolve.sync(mod, options));\n }\n } else {\n result.push(resolve.sync(mod, options));\n }\n }\n if (styles.length) {\n result = [...styles, ...result];\n }\n }\n }\n return result;\n }\n\n @Memoize()\n private babelConfig(resolverConfig: CompatResolverOptions) {\n let babel = cloneDeep(this.compatApp.babelConfig());\n\n if (!babel.plugins) {\n babel.plugins = [];\n }\n\n // Our stage3 code is always allowed to use dynamic import. We may emit it\n // ourself when splitting routes.\n babel.plugins.push(require.resolve('@babel/plugin-syntax-dynamic-import'));\n\n // https://github.com/webpack/webpack/issues/12154\n babel.plugins.push(require.resolve('./rename-require-plugin'));\n\n babel.plugins.push([require.resolve('babel-plugin-ember-template-compilation'), this.etcOptions(resolverConfig)]);\n\n // this is @embroider/macros configured for full stage3 resolution\n babel.plugins.push(...this.compatApp.macrosConfig.babelPluginConfig());\n\n let colocationOptions: TemplateColocationPluginOptions = {\n appRoot: this.origAppPackage.root,\n\n // This extra weirdness is a compromise in favor of build performance.\n //\n // 1. When auto-upgrading an addon from v1 to v2, we definitely want to\n // run any custom AST transforms in stage1.\n //\n // 2. In general case, AST transforms are allowed to manipulate Javascript\n // scope. This means that running transforms -- even when we're doing\n // source-to-source compilation that emits handlebars and not wire\n // format -- implies changing .hbs files into .js files.\n //\n // 3. So stage1 may need to rewrite .hbs to .hbs.js (to avoid colliding\n // with an existing co-located .js file).\n //\n // 4. But stage1 doesn't necessarily want to run babel over the\n // corresponding JS file. Most of the time, that's just an\n // unnecessarily expensive second parse. (We only run it in stage1 to\n // eliminate an addon's custom babel plugins, and many addons don't\n // have any.)\n //\n // 5. Therefore, the work of template-colocation gets defered until here,\n // and it may see co-located templates named `.hbs.js` instead of the\n // usual `.hbs.\n templateExtensions: ['.hbs', '.hbs.js'],\n\n // All of the above only applies to auto-upgraded packages that were\n // authored in v1. V2 packages don't get any of this complexity, they're\n // supposed to take care of colocating their own templates explicitly.\n packageGuard: true,\n };\n babel.plugins.push([templateColocationPluginPath, colocationOptions]);\n\n babel.plugins.push([\n require.resolve('./babel-plugin-adjust-imports'),\n (() => {\n let pluginConfig: AdjustImportsOptions = {\n appRoot: resolverConfig.appRoot,\n };\n return pluginConfig;\n })(),\n ]);\n\n // we can use globally shared babel runtime by default\n babel.plugins.push([\n require.resolve('@babel/plugin-transform-runtime'),\n { absoluteRuntime: __dirname, useESModules: true, regenerator: false },\n ]);\n\n const portable = makePortable(babel, { basedir: this.root }, this.portableHints);\n addCachablePlugin(portable.config);\n return portable;\n }\n\n private insertEmberApp(\n asset: ParsedEmberAsset,\n appFiles: AppFiles[],\n prepared: Map<string, InternalAsset>,\n emberENV: EmberENV\n ) {\n let html = asset.html;\n\n if (this.fastbootConfig) {\n // ignore scripts like ember-cli-livereload.js which are not really associated with\n // \"the app\".\n let ignoreScripts = html.dom.window.document.querySelectorAll('script');\n ignoreScripts.forEach(script => {\n script.setAttribute('data-fastboot-ignore', '');\n });\n }\n\n // our tests entrypoint already includes a correct module dependency on the\n // app, so we only insert the app when we're not inserting tests\n if (!asset.fileAsset.includeTests) {\n let appJS = this.topAppJSAsset(appFiles, prepared);\n html.insertScriptTag(html.javascript, appJS.relativePath, { type: 'module' });\n }\n\n if (this.fastbootConfig) {\n // any extra fastboot app files get inserted into our html.javascript\n // section, after the app has been inserted.\n for (let script of this.fastbootConfig.extraAppFiles) {\n html.insertScriptTag(html.javascript, script, { tag: 'fastboot-script' });\n }\n }\n\n html.insertStyleLink(html.styles, `assets/${this.origAppPackage.name}.css`);\n\n const parentEngine = appFiles.find(e => !e.engine.parent)!;\n let vendorJS = this.implicitScriptsAsset(prepared, parentEngine, emberENV);\n if (vendorJS) {\n html.insertScriptTag(html.implicitScripts, vendorJS.relativePath);\n }\n\n if (this.fastbootConfig) {\n // any extra fastboot vendor files get inserted into our\n // html.implicitScripts section, after the regular implicit script\n // (vendor.js) have been inserted.\n for (let script of this.fastbootConfig.extraVendorFiles) {\n html.insertScriptTag(html.implicitScripts, script, { tag: 'fastboot-script' });\n }\n }\n\n let implicitStyles = this.implicitStylesAsset(prepared, parentEngine);\n if (implicitStyles) {\n html.insertStyleLink(html.implicitStyles, implicitStyles.relativePath);\n }\n\n if (!asset.fileAsset.includeTests) {\n return;\n }\n\n // Test-related assets happen below this point\n\n let testJS = this.testJSEntrypoint(appFiles, prepared);\n html.insertScriptTag(html.testJavascript, testJS.relativePath, { type: 'module' });\n\n let implicitTestScriptsAsset = this.implicitTestScriptsAsset(prepared, parentEngine);\n if (implicitTestScriptsAsset) {\n html.insertScriptTag(html.implicitTestScripts, implicitTestScriptsAsset.relativePath);\n }\n\n let implicitTestStylesAsset = this.implicitTestStylesAsset(prepared, parentEngine);\n if (implicitTestStylesAsset) {\n html.insertStyleLink(html.implicitTestStyles, implicitTestStylesAsset.relativePath);\n }\n }\n\n private implicitScriptsAsset(\n prepared: Map<string, InternalAsset>,\n application: AppFiles,\n emberENV: EmberENV\n ): InternalAsset | undefined {\n let asset = prepared.get('assets/vendor.js');\n if (!asset) {\n let implicitScripts = this.impliedAssets('implicit-scripts', application, emberENV);\n if (implicitScripts.length > 0) {\n asset = new ConcatenatedAsset('assets/vendor.js', implicitScripts, this.resolvableExtensionsPattern);\n prepared.set(asset.relativePath, asset);\n }\n }\n return asset;\n }\n\n private implicitStylesAsset(prepared: Map<string, InternalAsset>, application: AppFiles): InternalAsset | undefined {\n let asset = prepared.get('assets/vendor.css');\n if (!asset) {\n let implicitStyles = this.impliedAssets('implicit-styles', application);\n if (implicitStyles.length > 0) {\n // we reverse because we want the synthetic vendor style at the top\n asset = new ConcatenatedAsset('assets/vendor.css', implicitStyles.reverse(), this.resolvableExtensionsPattern);\n prepared.set(asset.relativePath, asset);\n }\n }\n return asset;\n }\n\n private implicitTestScriptsAsset(\n prepared: Map<string, InternalAsset>,\n application: AppFiles\n ): InternalAsset | undefined {\n let testSupportJS = prepared.get('assets/test-support.js');\n if (!testSupportJS) {\n let implicitTestScripts = this.impliedAssets('implicit-test-scripts', application);\n if (implicitTestScripts.length > 0) {\n testSupportJS = new ConcatenatedAsset(\n 'assets/test-support.js',\n implicitTestScripts,\n this.resolvableExtensionsPattern\n );\n prepared.set(testSupportJS.relativePath, testSupportJS);\n }\n }\n return testSupportJS;\n }\n\n private implicitTestStylesAsset(\n prepared: Map<string, InternalAsset>,\n application: AppFiles\n ): InternalAsset | undefined {\n let asset = prepared.get('assets/test-support.css');\n if (!asset) {\n let implicitTestStyles = this.impliedAssets('implicit-test-styles', application);\n if (implicitTestStyles.length > 0) {\n asset = new ConcatenatedAsset('assets/test-support.css', implicitTestStyles, this.resolvableExtensionsPattern);\n prepared.set(asset.relativePath, asset);\n }\n }\n return asset;\n }\n\n // recurse to find all active addons that don't cross an engine boundary.\n // Inner engines themselves will be returned, but not those engines' children.\n // The output set's insertion order is the proper ember-cli compatible\n // ordering of the addons.\n private findActiveAddons(pkg: Package, engine: Engine, isChild = false): void {\n for (let child of this.activeAddonChildren(pkg)) {\n if (!child.isEngine()) {\n this.findActiveAddons(child, engine, true);\n }\n let canResolveFrom: string;\n if (pkg === this.appPackageWithMovedDeps) {\n // we want canResolveFrom to always be a rewritten package path, and our\n // app's package is not rewritten yet here.\n canResolveFrom = resolvePath(this.root, 'package.json');\n } else {\n // whereas our addons are already moved\n canResolveFrom = resolvePath(pkg.root, 'package.json');\n }\n engine.addons.set(child, canResolveFrom);\n }\n // ensure addons are applied in the correct order, if set (via @embroider/compat/v1-addon)\n if (!isChild) {\n engine.addons = new Map(\n [...engine.addons].sort(([a], [b]) => {\n return (a.meta['order-index'] || 0) - (b.meta['order-index'] || 0);\n })\n );\n }\n }\n\n private partitionEngines(appJSPath: string): Engine[] {\n let queue: Engine[] = [\n {\n package: this.appPackageWithMovedDeps,\n addons: new Map(),\n parent: undefined,\n sourcePath: appJSPath,\n modulePrefix: this.modulePrefix(),\n appRelativePath: '.',\n },\n ];\n let done: Engine[] = [];\n let seenEngines: Set<Package> = new Set();\n while (true) {\n let current = queue.shift();\n if (!current) {\n break;\n }\n this.findActiveAddons(current.package, current);\n for (let addon of current.addons.keys()) {\n if (addon.isEngine() && !seenEngines.has(addon)) {\n seenEngines.add(addon);\n queue.push({\n package: addon,\n addons: new Map(),\n parent: current,\n sourcePath: addon.root,\n modulePrefix: addon.name,\n appRelativePath: explicitRelative(this.root, addon.root),\n });\n }\n }\n done.push(current);\n }\n return done;\n }\n\n @Memoize()\n private get activeFastboot() {\n return this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-cli-fastboot');\n }\n\n @Memoize()\n private get fastbootConfig():\n | { packageJSON: PackageInfo; extraAppFiles: string[]; extraVendorFiles: string[] }\n | undefined {\n if (this.activeFastboot) {\n // this is relying on work done in stage1 by @embroider/compat/src/compat-adapters/ember-cli-fastboot.ts\n let packageJSON = readJSONSync(join(this.activeFastboot.root, '_fastboot_', 'package.json'));\n let { extraAppFiles, extraVendorFiles } = packageJSON['embroider-fastboot'];\n delete packageJSON['embroider-fastboot'];\n extraVendorFiles.push('assets/embroider_macros_fastboot_init.js');\n return { packageJSON, extraAppFiles, extraVendorFiles };\n }\n }\n\n private engines: { engine: Engine; appSync: SyncDir; fastbootSync: SyncDir | undefined }[] | undefined;\n\n private updateAppJS(appJSPath: string): AppFiles[] {\n if (!this.engines) {\n this.engines = this.partitionEngines(appJSPath).map(engine => {\n if (engine.sourcePath === appJSPath) {\n // this is the app. We have more to do for the app than for other\n // engines.\n let fastbootSync: SyncDir | undefined;\n if (this.activeFastboot) {\n let fastbootDir = this.fastbootJSSrcDir();\n if (fastbootDir) {\n fastbootSync = new SyncDir(fastbootDir, resolvePath(this.root, '_fastboot_'));\n }\n }\n return {\n engine,\n appSync: new SyncDir(appJSPath, this.root),\n fastbootSync,\n };\n } else {\n // this is not the app, so it's some other engine. Engines are already\n // built by stage1 like all other addons, so we only need to observe\n // their files, not doing any actual copying or building.\n return {\n engine,\n appSync: new SyncDir(engine.sourcePath, undefined),\n\n // AFAIK, we've never supported a fastboot overlay directory in an\n // engine. But if we do need that, it would go here.\n fastbootSync: undefined,\n };\n }\n });\n }\n\n for (let engine of this.engines) {\n engine.appSync.update();\n engine.fastbootSync?.update();\n }\n\n return this.engines.map(\n ({ engine, appSync, fastbootSync }) =>\n new AppFiles(\n engine,\n appSync.files,\n fastbootSync?.files ?? new Set(),\n this.resolvableExtensionsPattern,\n this.podModulePrefix()\n )\n );\n }\n\n private prepareAsset(asset: Asset, appFiles: AppFiles[], prepared: Map<string, InternalAsset>, emberENV: EmberENV) {\n if (asset.kind === 'ember') {\n let prior = this.assets.get(asset.relativePath);\n let parsed: ParsedEmberAsset;\n if (prior && prior.kind === 'built-ember' && prior.parsedAsset.validFor(asset)) {\n // we can reuse the parsed html\n parsed = prior.parsedAsset;\n parsed.html.clear();\n } else {\n parsed = new ParsedEmberAsset(asset);\n }\n this.insertEmberApp(parsed, appFiles, prepared, emberENV);\n prepared.set(asset.relativePath, new BuiltEmberAsset(parsed));\n } else {\n prepared.set(asset.relativePath, asset);\n }\n }\n\n private prepareAssets(\n requestedAssets: Asset[],\n appFiles: AppFiles[],\n emberENV: EmberENV\n ): Map<string, InternalAsset> {\n let prepared: Map<string, InternalAsset> = new Map();\n for (let asset of requestedAssets) {\n this.prepareAsset(asset, appFiles, prepared, emberENV);\n }\n return prepared;\n }\n\n private assetIsValid(asset: InternalAsset, prior: InternalAsset | undefined): boolean {\n if (!prior) {\n return false;\n }\n switch (asset.kind) {\n case 'on-disk':\n return prior.kind === 'on-disk' && prior.size === asset.size && prior.mtime === asset.mtime;\n case 'in-memory':\n return prior.kind === 'in-memory' && stringOrBufferEqual(prior.source, asset.source);\n case 'built-ember':\n return prior.kind === 'built-ember' && prior.source === asset.source;\n case 'concatenated-asset':\n return (\n prior.kind === 'concatenated-asset' &&\n prior.sources.length === asset.sources.length &&\n prior.sources.every((priorFile, index) => {\n let newFile = asset.sources[index];\n return this.assetIsValid(newFile, priorFile);\n })\n );\n }\n }\n\n private updateOnDiskAsset(asset: OnDiskAsset) {\n let destination = join(this.root, asset.relativePath);\n ensureDirSync(dirname(destination));\n copySync(asset.sourcePath, destination, { dereference: true });\n }\n\n private updateInMemoryAsset(asset: InMemoryAsset) {\n let destination = join(this.root, asset.relativePath);\n ensureDirSync(dirname(destination));\n writeFileSync(destination, asset.source, 'utf8');\n }\n\n private updateBuiltEmberAsset(asset: BuiltEmberAsset) {\n let destination = join(this.root, asset.relativePath);\n ensureDirSync(dirname(destination));\n writeFileSync(destination, asset.source, 'utf8');\n }\n\n private async updateConcatenatedAsset(asset: ConcatenatedAsset) {\n let concat = new SourceMapConcat({\n outputFile: join(this.root, asset.relativePath),\n mapCommentType: asset.relativePath.endsWith('.js') ? 'line' : 'block',\n baseDir: this.root,\n });\n if (process.env.EMBROIDER_CONCAT_STATS) {\n let MeasureConcat = (await import('@embroider/core/src/measure-concat')).default;\n concat = new MeasureConcat(asset.relativePath, concat, this.root);\n }\n for (let source of asset.sources) {\n switch (source.kind) {\n case 'on-disk':\n concat.addFile(explicitRelative(this.root, source.sourcePath));\n break;\n case 'in-memory':\n if (typeof source.source !== 'string') {\n throw new Error(`attempted to concatenated a Buffer-backed in-memory asset`);\n }\n concat.addSpace(source.source);\n break;\n default:\n assertNever(source);\n }\n }\n await concat.end();\n }\n\n private async updateAssets(requestedAssets: Asset[], appFiles: AppFiles[], emberENV: EmberENV) {\n let assets = this.prepareAssets(requestedAssets, appFiles, emberENV);\n for (let asset of assets.values()) {\n if (this.assetIsValid(asset, this.assets.get(asset.relativePath))) {\n continue;\n }\n debug('rebuilding %s', asset.relativePath);\n switch (asset.kind) {\n case 'on-disk':\n this.updateOnDiskAsset(asset);\n break;\n case 'in-memory':\n this.updateInMemoryAsset(asset);\n break;\n case 'built-ember':\n this.updateBuiltEmberAsset(asset);\n break;\n case 'concatenated-asset':\n await this.updateConcatenatedAsset(asset);\n break;\n default:\n assertNever(asset);\n }\n }\n for (let oldAsset of this.assets.values()) {\n if (!assets.has(oldAsset.relativePath)) {\n unlinkSync(join(this.root, oldAsset.relativePath));\n }\n }\n this.assets = assets;\n return [...assets.values()];\n }\n\n private gatherAssets(inputPaths: OutputPaths<TreeNames>): Asset[] {\n // first gather all the assets out of addons\n let assets: Asset[] = [];\n for (let pkg of this.allActiveAddons) {\n if (pkg.meta['public-assets']) {\n for (let [filename, appRelativeURL] of Object.entries(pkg.meta['public-assets'] || {})) {\n let sourcePath = resolvePath(pkg.root, filename);\n let stats = statSync(sourcePath);\n assets.push({\n kind: 'on-disk',\n sourcePath,\n relativePath: appRelativeURL,\n mtime: stats.mtimeMs,\n size: stats.size,\n });\n }\n }\n }\n\n if (this.activeFastboot) {\n const source = `\n (function(){\n var key = '_embroider_macros_runtime_config';\n if (!window[key]){ window[key] = [];}\n window[key].push(function(m) {\n m.setGlobalConfig('fastboot', Object.assign({}, m.getGlobalConfig().fastboot, { isRunning: true }));\n });\n }())`;\n assets.push({\n kind: 'in-memory',\n source,\n relativePath: 'assets/embroider_macros_fastboot_init.js',\n });\n }\n\n // and finally tack on the ones from our app itself\n return assets.concat(this.extractAssets(inputPaths));\n }\n\n private firstBuild = true;\n\n async build(inputPaths: OutputPaths<TreeNames>) {\n // on the first build, we lock down the macros config. on subsequent builds,\n // this doesn't do anything anyway because it's idempotent.\n this.compatApp.macrosConfig.finalize();\n\n // on first build, clear the output directory completely\n if (this.firstBuild) {\n rmSync(this.root, { recursive: true, force: true });\n this.firstBuild = false;\n }\n\n let appFiles = this.updateAppJS(inputPaths.appJS);\n let emberENV = this.configTree.readConfig().EmberENV;\n let assets = this.gatherAssets(inputPaths);\n\n let finalAssets = await this.updateAssets(assets, appFiles, emberENV);\n\n let assetPaths = assets.map(asset => asset.relativePath);\n\n if (this.activeFastboot) {\n // when using fastboot, our own package.json needs to be in the output so fastboot can read it.\n assetPaths.push('package.json');\n }\n\n for (let asset of finalAssets) {\n // our concatenated assets all have map files that ride along. Here we're\n // telling the final stage packager to be sure and serve the map files\n // too.\n if (asset.kind === 'concatenated-asset') {\n assetPaths.push(asset.sourcemapPath);\n }\n }\n\n let meta: AppMeta = {\n type: 'app',\n version: 2,\n assets: assetPaths,\n babel: {\n filename: '_babel_config_.js',\n isParallelSafe: true, // TODO\n majorVersion: this.compatApp.babelMajorVersion(),\n fileFilter: '_babel_filter_.js',\n },\n 'root-url': this.rootURL(),\n };\n\n // all compat apps are auto-upgraded, there's no v2 app format here\n meta['auto-upgraded'] = true;\n\n let pkg = this.combinePackageJSON(meta);\n writeFileSync(join(this.root, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');\n\n let resolverConfig = this.resolverConfig(appFiles);\n this.addResolverConfig(resolverConfig);\n let babelConfig = this.babelConfig(resolverConfig);\n this.addBabelConfig(babelConfig);\n writeFileSync(\n join(this.root, 'macros-config.json'),\n JSON.stringify(this.compatApp.macrosConfig.babelPluginConfig()[0], null, 2)\n );\n }\n\n private combinePackageJSON(meta: AppMeta): object {\n let pkgLayers: any[] = [this.origAppPackage.packageJSON];\n let fastbootConfig = this.fastbootConfig;\n if (fastbootConfig) {\n // fastboot-specific package.json output is allowed to add to our original package.json\n pkgLayers.push(fastbootConfig.packageJSON);\n }\n // but our own new v2 app metadata takes precedence over both\n pkgLayers.push({ keywords: ['ember-addon'], 'ember-addon': meta });\n return combinePackageJSON(...pkgLayers);\n }\n\n private etcOptions(resolverConfig: CompatResolverOptions): EtcOptions {\n let transforms = this.compatApp.htmlbarsPlugins;\n\n let { plugins: macroPlugins, setConfig } = MacrosConfig.transforms();\n setConfig(this.compatApp.macrosConfig);\n for (let macroPlugin of macroPlugins) {\n transforms.push(macroPlugin as any);\n }\n\n if (\n this.options.staticComponents ||\n this.options.staticHelpers ||\n this.options.staticModifiers ||\n (globalThis as any).embroider_audit\n ) {\n let opts: ResolverTransformOptions = {\n appRoot: resolverConfig.appRoot,\n };\n transforms.push([require.resolve('./resolver-transform'), opts]);\n }\n\n let resolver = new Resolver(resolverConfig);\n let resolution = resolver.nodeResolve(\n 'ember-source/vendor/ember/ember-template-compiler',\n resolvePath(this.root, 'package.json')\n );\n if (resolution.type !== 'real') {\n throw new Error(`bug: unable to resolve ember-template-compiler from ${this.root}`);\n }\n\n return {\n transforms,\n compilerPath: resolution.filename,\n enableLegacyModules: ['ember-cli-htmlbars', 'ember-cli-htmlbars-inline-precompile', 'htmlbars-inline-precompile'],\n };\n }\n\n @Memoize()\n private get portableHints(): PortableHint[] {\n return this.options.pluginHints.map(hint => {\n let cursor = join(this.origAppPackage.root, 'package.json');\n for (let i = 0; i < hint.resolve.length; i++) {\n let target = hint.resolve[i];\n if (i < hint.resolve.length - 1) {\n target = join(target, 'package.json');\n }\n cursor = resolve.sync(target, { basedir: dirname(cursor) });\n }\n\n return {\n requireFile: cursor,\n useMethod: hint.useMethod,\n packageVersion: maybeNodeModuleVersion(cursor),\n };\n });\n }\n\n private addBabelConfig(pconfig: { config: TransformOptions; isParallelSafe: boolean }) {\n if (!pconfig.isParallelSafe) {\n warn('Your build is slower because some babel plugins are non-serializable');\n }\n writeFileSync(\n join(this.root, '_babel_config_.js'),\n `module.exports = ${JSON.stringify(pconfig.config, null, 2)}`,\n 'utf8'\n );\n writeFileSync(\n join(this.root, '_babel_filter_.js'),\n babelFilterTemplate({ skipBabel: this.options.skipBabel, appRoot: this.origAppPackage.root }),\n 'utf8'\n );\n }\n\n private addResolverConfig(config: CompatResolverOptions) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'resolver.json'), config, { spaces: 2 });\n }\n\n private shouldSplitRoute(routeName: string) {\n return (\n !this.options.splitAtRoutes ||\n this.options.splitAtRoutes.find(pattern => {\n if (typeof pattern === 'string') {\n return pattern === routeName;\n } else {\n return pattern.test(routeName);\n }\n })\n );\n }\n\n private splitRoute(\n routeName: string,\n files: RouteFiles,\n addToParent: (routeName: string, filename: string) => void,\n addLazyBundle: (routeNames: string[], files: string[]) => void\n ) {\n let shouldSplit = routeName && this.shouldSplitRoute(routeName);\n let ownFiles = [];\n let ownNames = new Set() as Set<string>;\n\n if (files.template) {\n if (shouldSplit) {\n ownFiles.push(files.template);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.template);\n }\n }\n\n if (files.controller) {\n if (shouldSplit) {\n ownFiles.push(files.controller);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.controller);\n }\n }\n\n if (files.route) {\n if (shouldSplit) {\n ownFiles.push(files.route);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.route);\n }\n }\n\n for (let [childName, childFiles] of files.children) {\n this.splitRoute(\n `${routeName}.${childName}`,\n childFiles,\n\n (childRouteName: string, childFile: string) => {\n // this is our child calling \"addToParent\"\n if (shouldSplit) {\n ownFiles.push(childFile);\n ownNames.add(childRouteName);\n } else {\n addToParent(childRouteName, childFile);\n }\n },\n (routeNames: string[], files: string[]) => {\n addLazyBundle(routeNames, files);\n }\n );\n }\n\n if (ownFiles.length > 0) {\n addLazyBundle([...ownNames], ownFiles);\n }\n }\n\n private topAppJSAsset(engines: AppFiles[], prepared: Map<string, InternalAsset>): InternalAsset {\n let [app, ...childEngines] = engines;\n let relativePath = `assets/${this.origAppPackage.name}.js`;\n return this.appJSAsset(relativePath, app, childEngines, prepared, {\n autoRun: this.compatApp.autoRun,\n appBoot: !this.compatApp.autoRun ? this.compatApp.appBoot.readAppBoot() : '',\n mainModule: explicitRelative(dirname(relativePath), 'app'),\n appConfig: this.configTree.readConfig().APP,\n });\n }\n\n @Memoize()\n private get staticAppPathsPattern(): RegExp | undefined {\n if (this.options.staticAppPaths.length > 0) {\n return new RegExp(\n '^(?:' + this.options.staticAppPaths.map(staticAppPath => escapeRegExp(staticAppPath)).join('|') + ')(?:$|/)'\n );\n }\n }\n\n private requiredOtherFiles(appFiles: AppFiles): readonly string[] {\n let pattern = this.staticAppPathsPattern;\n if (pattern) {\n return appFiles.otherAppFiles.filter(f => {\n return !pattern!.test(f);\n });\n } else {\n return appFiles.otherAppFiles;\n }\n }\n\n private appJSAsset(\n relativePath: string,\n appFiles: AppFiles,\n childEngines: AppFiles[],\n prepared: Map<string, InternalAsset>,\n entryParams?: Partial<Parameters<typeof entryTemplate>[0]>\n ): InternalAsset {\n let cached = prepared.get(relativePath);\n if (cached) {\n return cached;\n }\n\n let eagerModules: string[] = [];\n\n let requiredAppFiles = [this.requiredOtherFiles(appFiles)];\n if (!this.options.staticComponents) {\n requiredAppFiles.push(appFiles.components);\n }\n if (!this.options.staticHelpers) {\n requiredAppFiles.push(appFiles.helpers);\n }\n if (!this.options.staticModifiers) {\n requiredAppFiles.push(appFiles.modifiers);\n }\n\n let styles = [];\n // only import styles from engines with a parent (this excludeds the parent application) as their styles\n // will be inserted via a direct <link> tag.\n if (appFiles.engine.parent && appFiles.engine.package.isLazyEngine()) {\n let implicitStyles = this.impliedAssets('implicit-styles', appFiles);\n for (let style of implicitStyles) {\n styles.push({\n path: explicitRelative('assets/_engine_', style.relativePath),\n });\n }\n\n let engineMeta = appFiles.engine.package.meta as AddonMeta;\n if (engineMeta && engineMeta['implicit-styles']) {\n for (let style of engineMeta['implicit-styles']) {\n styles.push({\n path: explicitRelative(dirname(relativePath), join(appFiles.engine.appRelativePath, style)),\n });\n }\n }\n }\n\n let lazyEngines: { names: string[]; path: string }[] = [];\n for (let childEngine of childEngines) {\n let asset = this.appJSAsset(\n `assets/_engine_/${encodeURIComponent(childEngine.engine.package.name)}.js`,\n childEngine,\n [],\n prepared\n );\n if (childEngine.engine.package.isLazyEngine()) {\n lazyEngines.push({\n names: [childEngine.engine.package.name],\n path: explicitRelative(dirname(relativePath), asset.relativePath),\n });\n } else {\n eagerModules.push(explicitRelative(dirname(relativePath), asset.relativePath));\n }\n }\n let lazyRoutes: { names: string[]; path: string }[] = [];\n for (let [routeName, routeFiles] of appFiles.routeFiles.children) {\n this.splitRoute(\n routeName,\n routeFiles,\n (_: string, filename: string) => {\n requiredAppFiles.push([filename]);\n },\n (routeNames: string[], files: string[]) => {\n let routeEntrypoint = `assets/_route_/${encodeURIComponent(routeNames[0])}.js`;\n if (!prepared.has(routeEntrypoint)) {\n prepared.set(routeEntrypoint, this.routeEntrypoint(appFiles, routeEntrypoint, files));\n }\n lazyRoutes.push({\n names: routeNames,\n path: this.importPaths(appFiles, routeEntrypoint).buildtime,\n });\n }\n );\n }\n\n let [fastboot, nonFastboot] = partition(excludeDotFiles(flatten(requiredAppFiles)), file =>\n appFiles.isFastbootOnly.get(file)\n );\n let amdModules = nonFastboot.map(file => this.importPaths(appFiles, file));\n let fastbootOnlyAmdModules = fastboot.map(file => this.importPaths(appFiles, file));\n\n // this is a backward-compatibility feature: addons can force inclusion of\n // modules.\n eagerModules.push('./-embroider-implicit-modules.js');\n\n let params = { amdModules, fastbootOnlyAmdModules, lazyRoutes, lazyEngines, eagerModules, styles };\n if (entryParams) {\n Object.assign(params, entryParams);\n }\n\n let source = entryTemplate(params);\n\n let asset: InternalAsset = {\n kind: 'in-memory',\n source,\n relativePath,\n };\n prepared.set(relativePath, asset);\n return asset;\n }\n\n private importPaths({ engine }: AppFiles, engineRelativePath: string) {\n let noHBS = engineRelativePath.replace(this.resolvableExtensionsPattern, '').replace(/\\.hbs$/, '');\n return {\n runtime: `${engine.modulePrefix}/${noHBS}`,\n buildtime: posix.join(engine.package.name, engineRelativePath),\n };\n }\n\n private routeEntrypoint(appFiles: AppFiles, relativePath: string, files: string[]) {\n let [fastboot, nonFastboot] = partition(files, file => appFiles.isFastbootOnly.get(file));\n\n let asset: InternalAsset = {\n kind: 'in-memory',\n source: routeEntryTemplate({\n files: nonFastboot.map(f => this.importPaths(appFiles, f)),\n fastbootOnlyFiles: fastboot.map(f => this.importPaths(appFiles, f)),\n }),\n relativePath,\n };\n return asset;\n }\n\n private testJSEntrypoint(appFiles: AppFiles[], prepared: Map<string, InternalAsset>): InternalAsset {\n let asset = prepared.get(`assets/test.js`);\n if (asset) {\n return asset;\n }\n\n // We're only building tests from the first engine (the app). This is the\n // normal thing to do -- tests from engines don't automatically roll up into\n // the app.\n let engine = appFiles[0];\n\n const myName = 'assets/test.js';\n\n // tests necessarily also include the app. This is where we account for\n // that. The classic solution was to always include the app's separate\n // script tag in the tests HTML, but that isn't as easy for final stage\n // packagers to understand. It's better to express it here as a direct\n // module dependency.\n let eagerModules: string[] = [\n explicitRelative(dirname(myName), this.topAppJSAsset(appFiles, prepared).relativePath),\n ];\n\n let amdModules: { runtime: string; buildtime: string }[] = [];\n // this is a backward-compatibility feature: addons can force inclusion of\n // test support modules.\n eagerModules.push('./-embroider-implicit-test-modules.js');\n\n for (let relativePath of engine.tests) {\n amdModules.push(this.importPaths(engine, relativePath));\n }\n\n let source = entryTemplate({\n amdModules,\n eagerModules,\n testSuffix: true,\n });\n\n asset = {\n kind: 'in-memory',\n source,\n relativePath: myName,\n };\n prepared.set(asset.relativePath, asset);\n return asset;\n }\n}\n\nfunction defaultAddonPackageRules(): PackageRules[] {\n return readdirSync(join(__dirname, 'addon-dependency-rules'))\n .map(filename => {\n if (filename.endsWith('.js')) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(join(__dirname, 'addon-dependency-rules', filename)).default;\n }\n })\n .filter(Boolean)\n .reduce((a, b) => a.concat(b), []);\n}\n\nconst entryTemplate = jsHandlebarsCompile(`\nimport { importSync as i, macroCondition, getGlobalConfig } from '@embroider/macros';\nlet w = window;\nlet d = w.define;\n\n{{#if styles}}\n if (macroCondition(!getGlobalConfig().fastboot?.isRunning)) {\n {{#each styles as |stylePath| ~}}\n i(\"{{js-string-escape stylePath.path}}\");\n {{/each}}\n }\n{{/if}}\n\n{{#each eagerModules as |eagerModule| ~}}\n i(\"{{js-string-escape eagerModule}}\");\n{{/each}}\n\n{{#each amdModules as |amdModule| ~}}\n d(\"{{js-string-escape amdModule.runtime}}\", function(){ return i(\"{{js-string-escape amdModule.buildtime}}\");});\n{{/each}}\n\n{{#if fastbootOnlyAmdModules}}\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {\n let fastbootModules = {};\n\n {{#each fastbootOnlyAmdModules as |amdModule| ~}}\n fastbootModules[\"{{js-string-escape amdModule.runtime}}\"] = import(\"{{js-string-escape amdModule.buildtime}}\");\n {{/each}}\n\n const resolvedValues = await Promise.all(Object.values(fastbootModules));\n\n Object.keys(fastbootModules).forEach((k, i) => {\n d(k, function(){ return resolvedValues[i];});\n })\n }\n{{/if}}\n\n\n{{#if lazyRoutes}}\nw._embroiderRouteBundles_ = [\n {{#each lazyRoutes as |route|}}\n {\n names: {{json-stringify route.names}},\n load: function() {\n return import(\"{{js-string-escape route.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if lazyEngines}}\nw._embroiderEngineBundles_ = [\n {{#each lazyEngines as |engine|}}\n {\n names: {{json-stringify engine.names}},\n load: function() {\n return import(\"{{js-string-escape engine.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if autoRun ~}}\nif (!runningTests) {\n i(\"{{js-string-escape mainModule}}\").default.create({{json-stringify appConfig}});\n}\n{{else if appBoot ~}}\n {{ appBoot }}\n{{/if}}\n\n{{#if testSuffix ~}}\n {{!- TODO: both of these suffixes should get dynamically generated so they incorporate\n any content-for added by addons. -}}\n\n\n {{!- this is the traditional tests-suffix.js -}}\n i('../tests/test-helper');\n EmberENV.TESTS_FILE_LOADED = true;\n{{/if}}\n`) as (params: {\n amdModules: { runtime: string; buildtime: string }[];\n fastbootOnlyAmdModules?: { runtime: string; buildtime: string }[];\n eagerModules?: string[];\n autoRun?: boolean;\n appBoot?: string;\n mainModule?: string;\n appConfig?: unknown;\n testSuffix?: boolean;\n lazyRoutes?: { names: string[]; path: string }[];\n lazyEngines?: { names: string[]; path: string }[];\n styles?: { path: string }[];\n}) => string;\n\nconst routeEntryTemplate = jsHandlebarsCompile(`\nimport { importSync as i } from '@embroider/macros';\nlet d = window.define;\n{{#each files as |amdModule| ~}}\nd(\"{{js-string-escape amdModule.runtime}}\", function(){ return i(\"{{js-string-escape amdModule.buildtime}}\");});\n{{/each}}\n{{#if fastbootOnlyFiles}}\n import { macroCondition, getGlobalConfig } from '@embroider/macros';\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {\n {{#each fastbootOnlyFiles as |amdModule| ~}}\n d(\"{{js-string-escape amdModule.runtime}}\", function(){ return i(\"{{js-string-escape amdModule.buildtime}}\");});\n {{/each}}\n }\n{{/if}}\n`) as (params: {\n files: { runtime: string; buildtime: string }[];\n fastbootOnlyFiles: { runtime: string; buildtime: string }[];\n}) => string;\n\nfunction stringOrBufferEqual(a: string | Buffer, b: string | Buffer): boolean {\n if (typeof a === 'string' && typeof b === 'string') {\n return a === b;\n }\n if (a instanceof Buffer && b instanceof Buffer) {\n return Buffer.compare(a, b) === 0;\n }\n return false;\n}\n\nconst babelFilterTemplate = jsHandlebarsCompile(`\nconst { babelFilter } = require(${JSON.stringify(require.resolve('@embroider/core'))});\nmodule.exports = babelFilter({{json-stringify skipBabel}}, \"{{js-string-escape appRoot}}\");\n`) as (params: { skipBabel: Options['skipBabel']; appRoot: string }) => string;\n\nfunction combinePackageJSON(...layers: object[]) {\n function custom(objValue: any, srcValue: any, key: string, _object: any, _source: any, stack: { size: number }) {\n if (key === 'keywords' && stack.size === 0) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n }\n }\n return mergeWith({}, ...layers, custom);\n}\n\nfunction addCachablePlugin(babelConfig: TransformOptions) {\n if (Array.isArray(babelConfig.plugins) && babelConfig.plugins.length > 0) {\n const plugins = Object.create(null);\n plugins[cacheBustingPluginPath] = cacheBustingPluginVersion;\n\n for (const plugin of babelConfig.plugins) {\n let absolutePathToPlugin: string;\n if (Array.isArray(plugin) && typeof plugin[0] === 'string') {\n absolutePathToPlugin = plugin[0] as string;\n } else if (typeof plugin === 'string') {\n absolutePathToPlugin = plugin;\n } else {\n throw new Error(`[Embroider] a babel plugin without an absolute path was from: ${plugin}`);\n }\n\n plugins[absolutePathToPlugin] = maybeNodeModuleVersion(absolutePathToPlugin);\n }\n\n babelConfig.plugins.push([\n cacheBustingPluginPath,\n {\n plugins,\n },\n ]);\n }\n}\n\nfunction excludeDotFiles(files: string[]) {\n return files.filter(file => !file.startsWith('.') && !file.includes('/.'));\n}\n\ninterface TreeNames {\n appJS: BroccoliNode;\n htmlTree: BroccoliNode;\n publicTree: BroccoliNode | undefined;\n configTree: BroccoliNode;\n}\n\ntype EmberENV = unknown;\n\ntype InternalAsset = OnDiskAsset | InMemoryAsset | BuiltEmberAsset | ConcatenatedAsset;\n\nclass ParsedEmberAsset {\n kind: 'parsed-ember' = 'parsed-ember';\n relativePath: string;\n fileAsset: EmberAsset;\n html: PreparedEmberHTML;\n\n constructor(asset: EmberAsset) {\n this.fileAsset = asset;\n this.html = new PreparedEmberHTML(asset);\n this.relativePath = asset.relativePath;\n }\n\n validFor(other: EmberAsset) {\n return this.fileAsset.mtime === other.mtime && this.fileAsset.size === other.size;\n }\n}\n\nclass BuiltEmberAsset {\n kind: 'built-ember' = 'built-ember';\n relativePath: string;\n parsedAsset: ParsedEmberAsset;\n source: string;\n\n constructor(asset: ParsedEmberAsset) {\n this.parsedAsset = asset;\n this.source = asset.html.dom.serialize();\n this.relativePath = asset.relativePath;\n }\n}\n\nclass ConcatenatedAsset {\n kind: 'concatenated-asset' = 'concatenated-asset';\n constructor(\n public relativePath: string,\n public sources: (OnDiskAsset | InMemoryAsset)[],\n private resolvableExtensions: RegExp\n ) {}\n get sourcemapPath() {\n return this.relativePath.replace(this.resolvableExtensions, '') + '.map';\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,0CAWyB;AACzB,0DAAiC;AACjC,+BAAqD;AAKrD,yDAAwD;AACxD,6DAAqC;AACrC,2DAAmC;AACnC,6DAAqC;AACrC,iEAAyC;AACzC,iEAAyC;AACzC,iEAAyC;AACzC,qCAA8C;AAC9C,oEAAkC;AAClC,uCAAmH;AAInH,+DAAmE;AAEnE,qFAAyE;AAEzE,6DAAyD;AAEzD,2DAAsE;AACtE,gEAAuC;AACvC,2DAA6C;AAC7C,+BAAqC;AACrC,sDAA8B;AAG9B,uCAAgF;AAEhF,qDAA0D;AAC1D,kFAAoD;AACpD,gFAAgD;AAGhD,yCAAqC;AAErC,8EAA8E;AAC9E,uDAAuD;AAEvD,MAAa,gBAAgB;IAI3B,YACU,IAAY,EACZ,cAAuB,EACvB,uBAAgC,EAChC,OAA0B,EAC1B,SAAoB,EACpB,UAAoB,EACpB,WAAoB,EACpB,WAAoB;QAPpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,mBAAc,GAAd,cAAc,CAAS;QACvB,4BAAuB,GAAvB,uBAAuB,CAAS;QAChC,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4B;QAF7B,iBAAY,GAAZ,YAAY,CAAQ;QACpB,YAAO,GAAP,OAAO,CAAiC;QACvC,yBAAoB,GAApB,oBAAoB,CAAQ;QAJtC,SAAI,GAAyB,oBAAoB,CAAC;IAK/C,CAAC;IACJ,IAAI,aAAa;QACf,OAAO,IAAI,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,CAAC,GAAG,MAAM,CAAC;IAC3E,CAAC;CACF","sourcesContent":["import type { Node as BroccoliNode } from 'broccoli-node-api';\nimport type {\n OutputPaths,\n Asset,\n EmberAsset,\n AddonPackage,\n Engine,\n AppMeta,\n TemplateColocationPluginOptions,\n} from '@embroider/core';\nimport {\n explicitRelative,\n extensionsPattern,\n debug,\n warn,\n jsHandlebarsCompile,\n templateColocationPluginPath,\n cacheBustingPluginVersion,\n cacheBustingPluginPath,\n Resolver,\n locateEmbroiderWorkingDir,\n} from '@embroider/core';\nimport walkSync from 'walk-sync';\nimport { resolve as resolvePath, posix } from 'path';\nimport type { JSDOM } from 'jsdom';\nimport type Options from './options';\nimport type { CompatResolverOptions } from './resolver-transform';\nimport type { PackageRules } from './dependency-rules';\nimport { activePackageRules } from './dependency-rules';\nimport flatMap from 'lodash/flatMap';\nimport sortBy from 'lodash/sortBy';\nimport flatten from 'lodash/flatten';\nimport partition from 'lodash/partition';\nimport mergeWith from 'lodash/mergeWith';\nimport cloneDeep from 'lodash/cloneDeep';\nimport { sync as resolveSync } from 'resolve';\nimport bind from 'bind-decorator';\nimport { outputJSONSync, readJSONSync, rmSync, statSync, unlinkSync, writeFileSync, realpathSync } from 'fs-extra';\nimport type { Options as EtcOptions } from 'babel-plugin-ember-template-compilation';\nimport type { Options as ResolverTransformOptions } from './resolver-transform';\nimport type { Options as AdjustImportsOptions } from './babel-plugin-adjust-imports';\nimport { PreparedEmberHTML } from '@embroider/core/src/ember-html';\nimport type { InMemoryAsset, OnDiskAsset, ImplicitAssetPaths } from '@embroider/core/src/asset';\nimport { makePortable } from '@embroider/core/src/portable-babel-config';\nimport type { RouteFiles } from '@embroider/core/src/app-files';\nimport { AppFiles } from '@embroider/core/src/app-files';\nimport type { PortableHint } from '@embroider/core/src/portable';\nimport { maybeNodeModuleVersion } from '@embroider/core/src/portable';\nimport assertNever from 'assert-never';\nimport { Memoize } from 'typescript-memoize';\nimport { join, dirname } from 'path';\nimport resolve from 'resolve';\nimport type { V1Config } from './v1-config';\nimport type { AddonMeta, Package, PackageInfo } from '@embroider/core';\nimport { ensureDirSync, copySync, readdirSync, pathExistsSync } from 'fs-extra';\nimport type { TransformOptions } from '@babel/core';\nimport { MacrosConfig } from '@embroider/macros/src/node';\nimport SourceMapConcat from 'fast-sourcemap-concat';\nimport escapeRegExp from 'escape-string-regexp';\n\nimport type CompatApp from './compat-app';\nimport { SyncDir } from './sync-dir';\n\n// This exists during the actual broccoli build step. As opposed to CompatApp,\n// which also exists during pipeline-construction time.\n\nexport class CompatAppBuilder {\n // for each relativePath, an Asset we have already emitted\n private assets: Map<string, InternalAsset> = new Map();\n\n constructor(\n private root: string,\n private origAppPackage: Package,\n private appPackageWithMovedDeps: Package,\n private options: Required<Options>,\n private compatApp: CompatApp,\n private configTree: V1Config,\n private synthVendor: Package,\n private synthStyles: Package\n ) {}\n\n @Memoize()\n private fastbootJSSrcDir() {\n let target = join(this.compatApp.root, 'fastboot');\n if (pathExistsSync(target)) {\n return target;\n }\n }\n\n private extractAssets(treePaths: OutputPaths<TreeNames>): Asset[] {\n let assets: Asset[] = [];\n\n // Everything in our traditional public tree is an on-disk asset\n if (treePaths.publicTree) {\n walkSync\n .entries(treePaths.publicTree, {\n directories: false,\n })\n .forEach(entry => {\n assets.push({\n kind: 'on-disk',\n relativePath: entry.relativePath,\n sourcePath: entry.fullPath,\n mtime: entry.mtime as unknown as number, // https://github.com/joliss/node-walk-sync/pull/38\n size: entry.size,\n });\n });\n }\n\n // ember-cli traditionally outputs a dummy testem.js file to prevent\n // spurious errors when running tests under \"ember s\".\n if (this.compatApp.shouldBuildTests) {\n let testemAsset = this.findTestemAsset();\n if (testemAsset) {\n assets.push(testemAsset);\n }\n }\n\n for (let asset of this.emberEntrypoints(treePaths.htmlTree)) {\n assets.push(asset);\n }\n\n return assets;\n }\n\n @Memoize()\n private findTestemAsset(): Asset | undefined {\n let sourcePath;\n try {\n sourcePath = resolveSync('ember-cli/lib/broccoli/testem.js', { basedir: this.root });\n } catch (err) {}\n if (sourcePath) {\n let stat = statSync(sourcePath);\n return {\n kind: 'on-disk',\n relativePath: 'testem.js',\n sourcePath,\n mtime: stat.mtime.getTime(),\n size: stat.size,\n };\n }\n }\n\n private activeAddonChildren(pkg: Package): AddonPackage[] {\n let result = (pkg.dependencies.filter(this.isActiveAddon) as AddonPackage[]).filter(\n // When looking for child addons, we want to ignore 'peerDependencies' of\n // a given package, to align with how ember-cli resolves addons. So here\n // we only include dependencies that are definitely active due to one of\n // the other sections.\n addon => pkg.categorizeDependency(addon.name) !== 'peerDependencies'\n );\n if (pkg === this.appPackageWithMovedDeps) {\n let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon) as AddonPackage[];\n result = [...result, ...extras];\n }\n return result.sort(this.orderAddons);\n }\n\n @Memoize()\n private get allActiveAddons(): AddonPackage[] {\n let result = this.appPackageWithMovedDeps.findDescendants(this.isActiveAddon) as AddonPackage[];\n let extras = [this.synthVendor, this.synthStyles].filter(this.isActiveAddon) as AddonPackage[];\n let extraDescendants = flatMap(extras, dep => dep.findDescendants(this.isActiveAddon)) as AddonPackage[];\n result = [...result, ...extras, ...extraDescendants];\n return result.sort(this.orderAddons);\n }\n\n @bind\n private isActiveAddon(pkg: Package): boolean {\n // stage1 already took care of converting everything that's actually active\n // into v2 addons. If it's not a v2 addon, we don't want it.\n //\n // We can encounter v1 addons here when there is inactive stuff floating\n // around in the node_modules that accidentally satisfy something like an\n // optional peer dep.\n return pkg.isV2Addon();\n }\n\n @bind\n private orderAddons(depA: Package, depB: Package): number {\n let depAIdx = 0;\n let depBIdx = 0;\n\n if (depA && depA.meta && depA.isV2Addon()) {\n depAIdx = depA.meta['order-index'] || 0;\n }\n if (depB && depB.meta && depB.isV2Addon()) {\n depBIdx = depB.meta['order-index'] || 0;\n }\n\n return depAIdx - depBIdx;\n }\n\n private resolvableExtensions(): string[] {\n // webpack's default is ['.wasm', '.mjs', '.js', '.json']. Keeping that\n // subset in that order is sensible, since many third-party libraries will\n // expect it to work that way.\n //\n // For TS, we defer to ember-cli-babel, and the setting for\n // \"enableTypescriptTransform\" can be set with and without\n // ember-cli-typescript\n return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js', '.gjs', '.gts'];\n }\n\n private *emberEntrypoints(htmlTreePath: string): IterableIterator<Asset> {\n let classicEntrypoints = [\n { entrypoint: 'index.html', includeTests: false },\n { entrypoint: 'tests/index.html', includeTests: true },\n ];\n if (!this.compatApp.shouldBuildTests) {\n classicEntrypoints.pop();\n }\n for (let { entrypoint, includeTests } of classicEntrypoints) {\n let sourcePath = join(htmlTreePath, entrypoint);\n let stats = statSync(sourcePath);\n let asset: EmberAsset = {\n kind: 'ember',\n relativePath: entrypoint,\n includeTests,\n sourcePath,\n mtime: stats.mtime.getTime(),\n size: stats.size,\n rootURL: this.rootURL(),\n prepare: (dom: JSDOM) => {\n let scripts = [...dom.window.document.querySelectorAll('script')];\n let styles = [...dom.window.document.querySelectorAll('link[rel*=\"stylesheet\"]')] as HTMLLinkElement[];\n return {\n javascript: this.compatApp.findAppScript(scripts, entrypoint),\n styles: this.compatApp.findAppStyles(styles, entrypoint),\n implicitScripts: this.compatApp.findVendorScript(scripts, entrypoint),\n implicitStyles: this.compatApp.findVendorStyles(styles, entrypoint),\n testJavascript: this.compatApp.findTestScript(scripts),\n implicitTestScripts: this.compatApp.findTestSupportScript(scripts),\n implicitTestStyles: this.compatApp.findTestSupportStyles(styles),\n };\n },\n };\n yield asset;\n }\n }\n\n private modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n private podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\n }\n\n private rootURL(): string {\n return this.configTree.readConfig().rootURL;\n }\n\n @Memoize()\n private activeRules() {\n return activePackageRules(this.options.packageRules.concat(defaultAddonPackageRules()), [\n { name: this.origAppPackage.name, version: this.origAppPackage.version, root: this.root },\n ...this.allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n }\n\n private resolverConfig(engines: AppFiles[]): CompatResolverOptions {\n let renamePackages = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-packages']));\n let renameModules = Object.assign({}, ...this.allActiveAddons.map(dep => dep.meta['renamed-modules']));\n\n let options: CompatResolverOptions['options'] = {\n staticHelpers: this.options.staticHelpers,\n staticModifiers: this.options.staticModifiers,\n staticComponents: this.options.staticComponents,\n allowUnsafeDynamicComponents: this.options.allowUnsafeDynamicComponents,\n };\n\n let config: CompatResolverOptions = {\n // this part is the base ModuleResolverOptions as required by @embroider/core\n renameModules,\n renamePackages,\n resolvableExtensions: this.resolvableExtensions(),\n appRoot: this.origAppPackage.root,\n engines: engines.map((appFiles, index) => ({\n packageName: appFiles.engine.package.name,\n // first engine is the app, which has been relocated to this.root\n // we need to use the real path here because webpack requests always use the real path i.e. follow symlinks\n root: realpathSync(index === 0 ? this.root : appFiles.engine.package.root),\n fastbootFiles: appFiles.fastbootFiles,\n activeAddons: [...appFiles.engine.addons]\n .map(([addon, canResolveFromFile]) => ({\n name: addon.name,\n root: addon.root,\n canResolveFromFile,\n }))\n // the traditional order is the order in which addons will run, such\n // that the last one wins. Our resolver's order is the order to\n // search, so first one wins.\n .reverse(),\n })),\n amdCompatibility: this.options.amdCompatibility,\n\n // this is the additional stufff that @embroider/compat adds on top to do\n // global template resolving\n modulePrefix: this.modulePrefix(),\n podModulePrefix: this.podModulePrefix(),\n activePackageRules: this.activeRules(),\n options,\n };\n\n return config;\n }\n\n private scriptPriority(pkg: Package) {\n switch (pkg.name) {\n case 'loader.js':\n return 0;\n case 'ember-source':\n return 10;\n default:\n return 1000;\n }\n }\n\n @Memoize()\n private get resolvableExtensionsPattern(): RegExp {\n return extensionsPattern(this.resolvableExtensions());\n }\n\n private impliedAssets(\n type: keyof ImplicitAssetPaths,\n engine: AppFiles,\n emberENV?: EmberENV\n ): (OnDiskAsset | InMemoryAsset)[] {\n let result: (OnDiskAsset | InMemoryAsset)[] = this.impliedAddonAssets(type, engine).map(\n (sourcePath: string): OnDiskAsset => {\n let stats = statSync(sourcePath);\n return {\n kind: 'on-disk',\n relativePath: explicitRelative(this.root, sourcePath),\n sourcePath,\n mtime: stats.mtimeMs,\n size: stats.size,\n };\n }\n );\n\n if (type === 'implicit-scripts') {\n result.unshift({\n kind: 'in-memory',\n relativePath: '_testing_prefix_.js',\n source: `var runningTests=false;`,\n });\n\n result.unshift({\n kind: 'in-memory',\n relativePath: '_ember_env_.js',\n source: `window.EmberENV={ ...(window.EmberENV || {}), ...${JSON.stringify(emberENV, null, 2)} };`,\n });\n\n result.push({\n kind: 'in-memory',\n relativePath: '_loader_.js',\n source: `loader.makeDefaultExport=false;`,\n });\n }\n\n if (type === 'implicit-test-scripts') {\n // this is the traditional test-support-suffix.js\n result.push({\n kind: 'in-memory',\n relativePath: '_testing_suffix_.js',\n source: `\n var runningTests=true;\n if (typeof Testem !== 'undefined' && (typeof QUnit !== 'undefined' || typeof Mocha !== 'undefined')) {\n Testem.hookIntoTestFramework();\n }`,\n });\n\n // whether or not anybody was actually using @embroider/macros\n // explicitly as an addon, we ensure its test-support file is always\n // present.\n if (!result.find(s => s.kind === 'on-disk' && s.sourcePath.endsWith('embroider-macros-test-support.js'))) {\n result.unshift({\n kind: 'on-disk',\n sourcePath: require.resolve('@embroider/macros/src/vendor/embroider-macros-test-support'),\n mtime: 0,\n size: 0,\n relativePath: 'embroider-macros-test-support.js',\n });\n }\n }\n\n return result;\n }\n\n private impliedAddonAssets(type: keyof ImplicitAssetPaths, { engine }: AppFiles): string[] {\n let result: Array<string> = [];\n for (let addon of sortBy(Array.from(engine.addons.keys()), this.scriptPriority.bind(this))) {\n let implicitScripts = addon.meta[type];\n if (implicitScripts) {\n let styles = [];\n let options = { basedir: addon.root };\n for (let mod of implicitScripts) {\n if (type === 'implicit-styles') {\n // exclude engines because they will handle their own css importation\n if (!addon.isLazyEngine()) {\n styles.push(resolve.sync(mod, options));\n }\n } else {\n result.push(resolve.sync(mod, options));\n }\n }\n if (styles.length) {\n result = [...styles, ...result];\n }\n }\n }\n return result;\n }\n\n @Memoize()\n private babelConfig(resolverConfig: CompatResolverOptions) {\n let babel = cloneDeep(this.compatApp.babelConfig());\n\n if (!babel.plugins) {\n babel.plugins = [];\n }\n\n // Our stage3 code is always allowed to use dynamic import. We may emit it\n // ourself when splitting routes.\n babel.plugins.push(require.resolve('@babel/plugin-syntax-dynamic-import'));\n\n // https://github.com/webpack/webpack/issues/12154\n babel.plugins.push(require.resolve('./rename-require-plugin'));\n\n babel.plugins.push([require.resolve('babel-plugin-ember-template-compilation'), this.etcOptions(resolverConfig)]);\n\n // this is @embroider/macros configured for full stage3 resolution\n babel.plugins.push(...this.compatApp.macrosConfig.babelPluginConfig());\n\n let colocationOptions: TemplateColocationPluginOptions = {\n appRoot: this.origAppPackage.root,\n\n // This extra weirdness is a compromise in favor of build performance.\n //\n // 1. When auto-upgrading an addon from v1 to v2, we definitely want to\n // run any custom AST transforms in stage1.\n //\n // 2. In general case, AST transforms are allowed to manipulate Javascript\n // scope. This means that running transforms -- even when we're doing\n // source-to-source compilation that emits handlebars and not wire\n // format -- implies changing .hbs files into .js files.\n //\n // 3. So stage1 may need to rewrite .hbs to .hbs.js (to avoid colliding\n // with an existing co-located .js file).\n //\n // 4. But stage1 doesn't necessarily want to run babel over the\n // corresponding JS file. Most of the time, that's just an\n // unnecessarily expensive second parse. (We only run it in stage1 to\n // eliminate an addon's custom babel plugins, and many addons don't\n // have any.)\n //\n // 5. Therefore, the work of template-colocation gets defered until here,\n // and it may see co-located templates named `.hbs.js` instead of the\n // usual `.hbs.\n templateExtensions: ['.hbs', '.hbs.js'],\n\n // All of the above only applies to auto-upgraded packages that were\n // authored in v1. V2 packages don't get any of this complexity, they're\n // supposed to take care of colocating their own templates explicitly.\n packageGuard: true,\n };\n babel.plugins.push([templateColocationPluginPath, colocationOptions]);\n\n babel.plugins.push([\n require.resolve('./babel-plugin-adjust-imports'),\n (() => {\n let pluginConfig: AdjustImportsOptions = {\n appRoot: resolverConfig.appRoot,\n };\n return pluginConfig;\n })(),\n ]);\n\n // we can use globally shared babel runtime by default\n babel.plugins.push([\n require.resolve('@babel/plugin-transform-runtime'),\n { absoluteRuntime: __dirname, useESModules: true, regenerator: false },\n ]);\n\n const portable = makePortable(babel, { basedir: this.root }, this.portableHints);\n addCachablePlugin(portable.config);\n return portable;\n }\n\n private insertEmberApp(\n asset: ParsedEmberAsset,\n appFiles: AppFiles[],\n prepared: Map<string, InternalAsset>,\n emberENV: EmberENV\n ) {\n let html = asset.html;\n\n if (this.fastbootConfig) {\n // ignore scripts like ember-cli-livereload.js which are not really associated with\n // \"the app\".\n let ignoreScripts = html.dom.window.document.querySelectorAll('script');\n ignoreScripts.forEach(script => {\n script.setAttribute('data-fastboot-ignore', '');\n });\n }\n\n // our tests entrypoint already includes a correct module dependency on the\n // app, so we only insert the app when we're not inserting tests\n if (!asset.fileAsset.includeTests) {\n let appJS = this.topAppJSAsset(appFiles, prepared);\n html.insertScriptTag(html.javascript, appJS.relativePath, { type: 'module' });\n }\n\n if (this.fastbootConfig) {\n // any extra fastboot app files get inserted into our html.javascript\n // section, after the app has been inserted.\n for (let script of this.fastbootConfig.extraAppFiles) {\n html.insertScriptTag(html.javascript, script, { tag: 'fastboot-script' });\n }\n }\n\n html.insertStyleLink(html.styles, `assets/${this.origAppPackage.name}.css`);\n\n const parentEngine = appFiles.find(e => !e.engine.parent)!;\n let vendorJS = this.implicitScriptsAsset(prepared, parentEngine, emberENV);\n if (vendorJS) {\n html.insertScriptTag(html.implicitScripts, vendorJS.relativePath);\n }\n\n if (this.fastbootConfig) {\n // any extra fastboot vendor files get inserted into our\n // html.implicitScripts section, after the regular implicit script\n // (vendor.js) have been inserted.\n for (let script of this.fastbootConfig.extraVendorFiles) {\n html.insertScriptTag(html.implicitScripts, script, { tag: 'fastboot-script' });\n }\n }\n\n let implicitStyles = this.implicitStylesAsset(prepared, parentEngine);\n if (implicitStyles) {\n html.insertStyleLink(html.implicitStyles, implicitStyles.relativePath);\n }\n\n if (!asset.fileAsset.includeTests) {\n return;\n }\n\n // Test-related assets happen below this point\n\n let testJS = this.testJSEntrypoint(appFiles, prepared);\n html.insertScriptTag(html.testJavascript, testJS.relativePath, { type: 'module' });\n\n let implicitTestScriptsAsset = this.implicitTestScriptsAsset(prepared, parentEngine);\n if (implicitTestScriptsAsset) {\n html.insertScriptTag(html.implicitTestScripts, implicitTestScriptsAsset.relativePath);\n }\n\n let implicitTestStylesAsset = this.implicitTestStylesAsset(prepared, parentEngine);\n if (implicitTestStylesAsset) {\n html.insertStyleLink(html.implicitTestStyles, implicitTestStylesAsset.relativePath);\n }\n }\n\n private implicitScriptsAsset(\n prepared: Map<string, InternalAsset>,\n application: AppFiles,\n emberENV: EmberENV\n ): InternalAsset | undefined {\n let asset = prepared.get('assets/vendor.js');\n if (!asset) {\n let implicitScripts = this.impliedAssets('implicit-scripts', application, emberENV);\n if (implicitScripts.length > 0) {\n asset = new ConcatenatedAsset('assets/vendor.js', implicitScripts, this.resolvableExtensionsPattern);\n prepared.set(asset.relativePath, asset);\n }\n }\n return asset;\n }\n\n private implicitStylesAsset(prepared: Map<string, InternalAsset>, application: AppFiles): InternalAsset | undefined {\n let asset = prepared.get('assets/vendor.css');\n if (!asset) {\n let implicitStyles = this.impliedAssets('implicit-styles', application);\n if (implicitStyles.length > 0) {\n // we reverse because we want the synthetic vendor style at the top\n asset = new ConcatenatedAsset('assets/vendor.css', implicitStyles.reverse(), this.resolvableExtensionsPattern);\n prepared.set(asset.relativePath, asset);\n }\n }\n return asset;\n }\n\n private implicitTestScriptsAsset(\n prepared: Map<string, InternalAsset>,\n application: AppFiles\n ): InternalAsset | undefined {\n let testSupportJS = prepared.get('assets/test-support.js');\n if (!testSupportJS) {\n let implicitTestScripts = this.impliedAssets('implicit-test-scripts', application);\n if (implicitTestScripts.length > 0) {\n testSupportJS = new ConcatenatedAsset(\n 'assets/test-support.js',\n implicitTestScripts,\n this.resolvableExtensionsPattern\n );\n prepared.set(testSupportJS.relativePath, testSupportJS);\n }\n }\n return testSupportJS;\n }\n\n private implicitTestStylesAsset(\n prepared: Map<string, InternalAsset>,\n application: AppFiles\n ): InternalAsset | undefined {\n let asset = prepared.get('assets/test-support.css');\n if (!asset) {\n let implicitTestStyles = this.impliedAssets('implicit-test-styles', application);\n if (implicitTestStyles.length > 0) {\n asset = new ConcatenatedAsset('assets/test-support.css', implicitTestStyles, this.resolvableExtensionsPattern);\n prepared.set(asset.relativePath, asset);\n }\n }\n return asset;\n }\n\n // recurse to find all active addons that don't cross an engine boundary.\n // Inner engines themselves will be returned, but not those engines' children.\n // The output set's insertion order is the proper ember-cli compatible\n // ordering of the addons.\n private findActiveAddons(pkg: Package, engine: Engine, isChild = false): void {\n for (let child of this.activeAddonChildren(pkg)) {\n if (!child.isEngine()) {\n this.findActiveAddons(child, engine, true);\n }\n let canResolveFrom: string;\n if (pkg === this.appPackageWithMovedDeps) {\n // we want canResolveFrom to always be a rewritten package path, and our\n // app's package is not rewritten yet here.\n canResolveFrom = resolvePath(this.root, 'package.json');\n } else {\n // whereas our addons are already moved\n canResolveFrom = resolvePath(pkg.root, 'package.json');\n }\n engine.addons.set(child, canResolveFrom);\n }\n // ensure addons are applied in the correct order, if set (via @embroider/compat/v1-addon)\n if (!isChild) {\n engine.addons = new Map(\n [...engine.addons].sort(([a], [b]) => {\n return (a.meta['order-index'] || 0) - (b.meta['order-index'] || 0);\n })\n );\n }\n }\n\n private partitionEngines(appJSPath: string): Engine[] {\n let queue: Engine[] = [\n {\n package: this.appPackageWithMovedDeps,\n addons: new Map(),\n parent: undefined,\n sourcePath: appJSPath,\n modulePrefix: this.modulePrefix(),\n appRelativePath: '.',\n },\n ];\n let done: Engine[] = [];\n let seenEngines: Set<Package> = new Set();\n while (true) {\n let current = queue.shift();\n if (!current) {\n break;\n }\n this.findActiveAddons(current.package, current);\n for (let addon of current.addons.keys()) {\n if (addon.isEngine() && !seenEngines.has(addon)) {\n seenEngines.add(addon);\n queue.push({\n package: addon,\n addons: new Map(),\n parent: current,\n sourcePath: addon.root,\n modulePrefix: addon.name,\n appRelativePath: explicitRelative(this.root, addon.root),\n });\n }\n }\n done.push(current);\n }\n return done;\n }\n\n @Memoize()\n private get activeFastboot() {\n return this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-cli-fastboot');\n }\n\n @Memoize()\n private get fastbootConfig():\n | { packageJSON: PackageInfo; extraAppFiles: string[]; extraVendorFiles: string[] }\n | undefined {\n if (this.activeFastboot) {\n // this is relying on work done in stage1 by @embroider/compat/src/compat-adapters/ember-cli-fastboot.ts\n let packageJSON = readJSONSync(join(this.activeFastboot.root, '_fastboot_', 'package.json'));\n let { extraAppFiles, extraVendorFiles } = packageJSON['embroider-fastboot'];\n delete packageJSON['embroider-fastboot'];\n extraVendorFiles.push('assets/embroider_macros_fastboot_init.js');\n return { packageJSON, extraAppFiles, extraVendorFiles };\n }\n }\n\n private engines: { engine: Engine; appSync: SyncDir; fastbootSync: SyncDir | undefined }[] | undefined;\n\n private updateAppJS(appJSPath: string): AppFiles[] {\n if (!this.engines) {\n this.engines = this.partitionEngines(appJSPath).map(engine => {\n if (engine.sourcePath === appJSPath) {\n // this is the app. We have more to do for the app than for other\n // engines.\n let fastbootSync: SyncDir | undefined;\n if (this.activeFastboot) {\n let fastbootDir = this.fastbootJSSrcDir();\n if (fastbootDir) {\n fastbootSync = new SyncDir(fastbootDir, resolvePath(this.root, '_fastboot_'));\n }\n }\n return {\n engine,\n appSync: new SyncDir(appJSPath, this.root),\n fastbootSync,\n };\n } else {\n // this is not the app, so it's some other engine. Engines are already\n // built by stage1 like all other addons, so we only need to observe\n // their files, not doing any actual copying or building.\n return {\n engine,\n appSync: new SyncDir(engine.sourcePath, undefined),\n\n // AFAIK, we've never supported a fastboot overlay directory in an\n // engine. But if we do need that, it would go here.\n fastbootSync: undefined,\n };\n }\n });\n }\n\n for (let engine of this.engines) {\n engine.appSync.update();\n engine.fastbootSync?.update();\n }\n\n return this.engines.map(\n ({ engine, appSync, fastbootSync }) =>\n new AppFiles(\n engine,\n appSync.files,\n fastbootSync?.files ?? new Set(),\n this.resolvableExtensionsPattern,\n this.podModulePrefix()\n )\n );\n }\n\n private prepareAsset(asset: Asset, appFiles: AppFiles[], prepared: Map<string, InternalAsset>, emberENV: EmberENV) {\n if (asset.kind === 'ember') {\n let prior = this.assets.get(asset.relativePath);\n let parsed: ParsedEmberAsset;\n if (prior && prior.kind === 'built-ember' && prior.parsedAsset.validFor(asset)) {\n // we can reuse the parsed html\n parsed = prior.parsedAsset;\n parsed.html.clear();\n } else {\n parsed = new ParsedEmberAsset(asset);\n }\n this.insertEmberApp(parsed, appFiles, prepared, emberENV);\n prepared.set(asset.relativePath, new BuiltEmberAsset(parsed));\n } else {\n prepared.set(asset.relativePath, asset);\n }\n }\n\n private prepareAssets(\n requestedAssets: Asset[],\n appFiles: AppFiles[],\n emberENV: EmberENV\n ): Map<string, InternalAsset> {\n let prepared: Map<string, InternalAsset> = new Map();\n for (let asset of requestedAssets) {\n this.prepareAsset(asset, appFiles, prepared, emberENV);\n }\n return prepared;\n }\n\n private assetIsValid(asset: InternalAsset, prior: InternalAsset | undefined): boolean {\n if (!prior) {\n return false;\n }\n switch (asset.kind) {\n case 'on-disk':\n return prior.kind === 'on-disk' && prior.size === asset.size && prior.mtime === asset.mtime;\n case 'in-memory':\n return prior.kind === 'in-memory' && stringOrBufferEqual(prior.source, asset.source);\n case 'built-ember':\n return prior.kind === 'built-ember' && prior.source === asset.source;\n case 'concatenated-asset':\n return (\n prior.kind === 'concatenated-asset' &&\n prior.sources.length === asset.sources.length &&\n prior.sources.every((priorFile, index) => {\n let newFile = asset.sources[index];\n return this.assetIsValid(newFile, priorFile);\n })\n );\n }\n }\n\n private updateOnDiskAsset(asset: OnDiskAsset) {\n let destination = join(this.root, asset.relativePath);\n ensureDirSync(dirname(destination));\n copySync(asset.sourcePath, destination, { dereference: true });\n }\n\n private updateInMemoryAsset(asset: InMemoryAsset) {\n let destination = join(this.root, asset.relativePath);\n ensureDirSync(dirname(destination));\n writeFileSync(destination, asset.source, 'utf8');\n }\n\n private updateBuiltEmberAsset(asset: BuiltEmberAsset) {\n let destination = join(this.root, asset.relativePath);\n ensureDirSync(dirname(destination));\n writeFileSync(destination, asset.source, 'utf8');\n }\n\n private async updateConcatenatedAsset(asset: ConcatenatedAsset) {\n let concat = new SourceMapConcat({\n outputFile: join(this.root, asset.relativePath),\n mapCommentType: asset.relativePath.endsWith('.js') ? 'line' : 'block',\n baseDir: this.root,\n });\n if (process.env.EMBROIDER_CONCAT_STATS) {\n let MeasureConcat = (await import('@embroider/core/src/measure-concat')).default;\n concat = new MeasureConcat(asset.relativePath, concat, this.root);\n }\n for (let source of asset.sources) {\n switch (source.kind) {\n case 'on-disk':\n concat.addFile(explicitRelative(this.root, source.sourcePath));\n break;\n case 'in-memory':\n if (typeof source.source !== 'string') {\n throw new Error(`attempted to concatenated a Buffer-backed in-memory asset`);\n }\n concat.addSpace(source.source);\n break;\n default:\n assertNever(source);\n }\n }\n await concat.end();\n }\n\n private async updateAssets(requestedAssets: Asset[], appFiles: AppFiles[], emberENV: EmberENV) {\n let assets = this.prepareAssets(requestedAssets, appFiles, emberENV);\n for (let asset of assets.values()) {\n if (this.assetIsValid(asset, this.assets.get(asset.relativePath))) {\n continue;\n }\n debug('rebuilding %s', asset.relativePath);\n switch (asset.kind) {\n case 'on-disk':\n this.updateOnDiskAsset(asset);\n break;\n case 'in-memory':\n this.updateInMemoryAsset(asset);\n break;\n case 'built-ember':\n this.updateBuiltEmberAsset(asset);\n break;\n case 'concatenated-asset':\n await this.updateConcatenatedAsset(asset);\n break;\n default:\n assertNever(asset);\n }\n }\n for (let oldAsset of this.assets.values()) {\n if (!assets.has(oldAsset.relativePath)) {\n unlinkSync(join(this.root, oldAsset.relativePath));\n }\n }\n this.assets = assets;\n return [...assets.values()];\n }\n\n private gatherAssets(inputPaths: OutputPaths<TreeNames>): Asset[] {\n // first gather all the assets out of addons\n let assets: Asset[] = [];\n for (let pkg of this.allActiveAddons) {\n if (pkg.meta['public-assets']) {\n for (let [filename, appRelativeURL] of Object.entries(pkg.meta['public-assets'] || {})) {\n let sourcePath = resolvePath(pkg.root, filename);\n let stats = statSync(sourcePath);\n assets.push({\n kind: 'on-disk',\n sourcePath,\n relativePath: appRelativeURL,\n mtime: stats.mtimeMs,\n size: stats.size,\n });\n }\n }\n }\n\n if (this.activeFastboot) {\n const source = `\n (function(){\n var key = '_embroider_macros_runtime_config';\n if (!window[key]){ window[key] = [];}\n window[key].push(function(m) {\n m.setGlobalConfig('fastboot', Object.assign({}, m.getGlobalConfig().fastboot, { isRunning: true }));\n });\n }())`;\n assets.push({\n kind: 'in-memory',\n source,\n relativePath: 'assets/embroider_macros_fastboot_init.js',\n });\n }\n\n // and finally tack on the ones from our app itself\n return assets.concat(this.extractAssets(inputPaths));\n }\n\n private firstBuild = true;\n\n async build(inputPaths: OutputPaths<TreeNames>) {\n // on the first build, we lock down the macros config. on subsequent builds,\n // this doesn't do anything anyway because it's idempotent.\n this.compatApp.macrosConfig.finalize();\n\n // on first build, clear the output directory completely\n if (this.firstBuild) {\n rmSync(this.root, { recursive: true, force: true });\n this.firstBuild = false;\n }\n\n let appFiles = this.updateAppJS(inputPaths.appJS);\n let emberENV = this.configTree.readConfig().EmberENV;\n let assets = this.gatherAssets(inputPaths);\n\n let finalAssets = await this.updateAssets(assets, appFiles, emberENV);\n\n let assetPaths = assets.map(asset => asset.relativePath);\n\n if (this.activeFastboot) {\n // when using fastboot, our own package.json needs to be in the output so fastboot can read it.\n assetPaths.push('package.json');\n }\n\n for (let asset of finalAssets) {\n // our concatenated assets all have map files that ride along. Here we're\n // telling the final stage packager to be sure and serve the map files\n // too.\n if (asset.kind === 'concatenated-asset') {\n assetPaths.push(asset.sourcemapPath);\n }\n }\n\n let meta: AppMeta = {\n type: 'app',\n version: 2,\n assets: assetPaths,\n babel: {\n filename: '_babel_config_.js',\n isParallelSafe: true, // TODO\n majorVersion: this.compatApp.babelMajorVersion(),\n fileFilter: '_babel_filter_.js',\n },\n 'root-url': this.rootURL(),\n };\n\n // all compat apps are auto-upgraded, there's no v2 app format here\n meta['auto-upgraded'] = true;\n\n let pkg = this.combinePackageJSON(meta);\n writeFileSync(join(this.root, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');\n\n let resolverConfig = this.resolverConfig(appFiles);\n this.addResolverConfig(resolverConfig);\n let babelConfig = this.babelConfig(resolverConfig);\n this.addBabelConfig(babelConfig);\n writeFileSync(\n join(this.root, 'macros-config.json'),\n JSON.stringify(this.compatApp.macrosConfig.babelPluginConfig()[0], null, 2)\n );\n }\n\n private combinePackageJSON(meta: AppMeta): object {\n let pkgLayers: any[] = [this.origAppPackage.packageJSON];\n let fastbootConfig = this.fastbootConfig;\n if (fastbootConfig) {\n // fastboot-specific package.json output is allowed to add to our original package.json\n pkgLayers.push(fastbootConfig.packageJSON);\n }\n // but our own new v2 app metadata takes precedence over both\n pkgLayers.push({ keywords: ['ember-addon'], 'ember-addon': meta });\n return combinePackageJSON(...pkgLayers);\n }\n\n private etcOptions(resolverConfig: CompatResolverOptions): EtcOptions {\n let transforms = this.compatApp.htmlbarsPlugins;\n\n let { plugins: macroPlugins, setConfig } = MacrosConfig.transforms();\n setConfig(this.compatApp.macrosConfig);\n for (let macroPlugin of macroPlugins) {\n transforms.push(macroPlugin as any);\n }\n\n if (\n this.options.staticComponents ||\n this.options.staticHelpers ||\n this.options.staticModifiers ||\n (globalThis as any).embroider_audit\n ) {\n let opts: ResolverTransformOptions = {\n appRoot: resolverConfig.appRoot,\n };\n transforms.push([require.resolve('./resolver-transform'), opts]);\n }\n\n let resolver = new Resolver(resolverConfig);\n let resolution = resolver.nodeResolve(\n 'ember-source/vendor/ember/ember-template-compiler',\n resolvePath(this.root, 'package.json')\n );\n if (resolution.type !== 'real') {\n throw new Error(`bug: unable to resolve ember-template-compiler from ${this.root}`);\n }\n\n return {\n transforms,\n compilerPath: resolution.filename,\n enableLegacyModules: ['ember-cli-htmlbars', 'ember-cli-htmlbars-inline-precompile', 'htmlbars-inline-precompile'],\n };\n }\n\n @Memoize()\n private get portableHints(): PortableHint[] {\n return this.options.pluginHints.map(hint => {\n let cursor = join(this.origAppPackage.root, 'package.json');\n for (let i = 0; i < hint.resolve.length; i++) {\n let target = hint.resolve[i];\n if (i < hint.resolve.length - 1) {\n target = join(target, 'package.json');\n }\n cursor = resolve.sync(target, { basedir: dirname(cursor) });\n }\n\n return {\n requireFile: cursor,\n useMethod: hint.useMethod,\n packageVersion: maybeNodeModuleVersion(cursor),\n };\n });\n }\n\n private addBabelConfig(pconfig: { config: TransformOptions; isParallelSafe: boolean }) {\n if (!pconfig.isParallelSafe) {\n warn('Your build is slower because some babel plugins are non-serializable');\n }\n writeFileSync(\n join(this.root, '_babel_config_.js'),\n `module.exports = ${JSON.stringify(pconfig.config, null, 2)}`,\n 'utf8'\n );\n writeFileSync(\n join(this.root, '_babel_filter_.js'),\n babelFilterTemplate({ skipBabel: this.options.skipBabel, appRoot: this.origAppPackage.root }),\n 'utf8'\n );\n }\n\n private addResolverConfig(config: CompatResolverOptions) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'resolver.json'), config, { spaces: 2 });\n }\n\n private shouldSplitRoute(routeName: string) {\n return (\n !this.options.splitAtRoutes ||\n this.options.splitAtRoutes.find(pattern => {\n if (typeof pattern === 'string') {\n return pattern === routeName;\n } else {\n return pattern.test(routeName);\n }\n })\n );\n }\n\n private splitRoute(\n routeName: string,\n files: RouteFiles,\n addToParent: (routeName: string, filename: string) => void,\n addLazyBundle: (routeNames: string[], files: string[]) => void\n ) {\n let shouldSplit = routeName && this.shouldSplitRoute(routeName);\n let ownFiles = [];\n let ownNames = new Set() as Set<string>;\n\n if (files.template) {\n if (shouldSplit) {\n ownFiles.push(files.template);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.template);\n }\n }\n\n if (files.controller) {\n if (shouldSplit) {\n ownFiles.push(files.controller);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.controller);\n }\n }\n\n if (files.route) {\n if (shouldSplit) {\n ownFiles.push(files.route);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.route);\n }\n }\n\n for (let [childName, childFiles] of files.children) {\n this.splitRoute(\n `${routeName}.${childName}`,\n childFiles,\n\n (childRouteName: string, childFile: string) => {\n // this is our child calling \"addToParent\"\n if (shouldSplit) {\n ownFiles.push(childFile);\n ownNames.add(childRouteName);\n } else {\n addToParent(childRouteName, childFile);\n }\n },\n (routeNames: string[], files: string[]) => {\n addLazyBundle(routeNames, files);\n }\n );\n }\n\n if (ownFiles.length > 0) {\n addLazyBundle([...ownNames], ownFiles);\n }\n }\n\n private topAppJSAsset(engines: AppFiles[], prepared: Map<string, InternalAsset>): InternalAsset {\n let [app, ...childEngines] = engines;\n let relativePath = `assets/${this.origAppPackage.name}.js`;\n return this.appJSAsset(relativePath, app, childEngines, prepared, {\n autoRun: this.compatApp.autoRun,\n appBoot: !this.compatApp.autoRun ? this.compatApp.appBoot.readAppBoot() : '',\n mainModule: explicitRelative(dirname(relativePath), 'app'),\n appConfig: this.configTree.readConfig().APP,\n });\n }\n\n @Memoize()\n private get staticAppPathsPattern(): RegExp | undefined {\n if (this.options.staticAppPaths.length > 0) {\n return new RegExp(\n '^(?:' + this.options.staticAppPaths.map(staticAppPath => escapeRegExp(staticAppPath)).join('|') + ')(?:$|/)'\n );\n }\n }\n\n private requiredOtherFiles(appFiles: AppFiles): readonly string[] {\n let pattern = this.staticAppPathsPattern;\n if (pattern) {\n return appFiles.otherAppFiles.filter(f => {\n return !pattern!.test(f);\n });\n } else {\n return appFiles.otherAppFiles;\n }\n }\n\n private appJSAsset(\n relativePath: string,\n appFiles: AppFiles,\n childEngines: AppFiles[],\n prepared: Map<string, InternalAsset>,\n entryParams?: Partial<Parameters<typeof entryTemplate>[0]>\n ): InternalAsset {\n let cached = prepared.get(relativePath);\n if (cached) {\n return cached;\n }\n\n let eagerModules: string[] = [];\n\n let requiredAppFiles = [this.requiredOtherFiles(appFiles)];\n if (!this.options.staticComponents) {\n requiredAppFiles.push(appFiles.components);\n }\n if (!this.options.staticHelpers) {\n requiredAppFiles.push(appFiles.helpers);\n }\n if (!this.options.staticModifiers) {\n requiredAppFiles.push(appFiles.modifiers);\n }\n\n let styles = [];\n // only import styles from engines with a parent (this excludeds the parent application) as their styles\n // will be inserted via a direct <link> tag.\n if (appFiles.engine.parent && appFiles.engine.package.isLazyEngine()) {\n let implicitStyles = this.impliedAssets('implicit-styles', appFiles);\n for (let style of implicitStyles) {\n styles.push({\n path: explicitRelative('assets/_engine_', style.relativePath),\n });\n }\n\n let engineMeta = appFiles.engine.package.meta as AddonMeta;\n if (engineMeta && engineMeta['implicit-styles']) {\n for (let style of engineMeta['implicit-styles']) {\n styles.push({\n path: explicitRelative(dirname(relativePath), join(appFiles.engine.appRelativePath, style)),\n });\n }\n }\n }\n\n let lazyEngines: { names: string[]; path: string }[] = [];\n for (let childEngine of childEngines) {\n let asset = this.appJSAsset(\n `assets/_engine_/${encodeURIComponent(childEngine.engine.package.name)}.js`,\n childEngine,\n [],\n prepared\n );\n if (childEngine.engine.package.isLazyEngine()) {\n lazyEngines.push({\n names: [childEngine.engine.package.name],\n path: explicitRelative(dirname(relativePath), asset.relativePath),\n });\n } else {\n eagerModules.push(explicitRelative(dirname(relativePath), asset.relativePath));\n }\n }\n let lazyRoutes: { names: string[]; path: string }[] = [];\n for (let [routeName, routeFiles] of appFiles.routeFiles.children) {\n this.splitRoute(\n routeName,\n routeFiles,\n (_: string, filename: string) => {\n requiredAppFiles.push([filename]);\n },\n (routeNames: string[], files: string[]) => {\n let routeEntrypoint = `assets/_route_/${encodeURIComponent(routeNames[0])}.js`;\n if (!prepared.has(routeEntrypoint)) {\n prepared.set(routeEntrypoint, this.routeEntrypoint(appFiles, routeEntrypoint, files));\n }\n lazyRoutes.push({\n names: routeNames,\n path: this.importPaths(appFiles, routeEntrypoint).buildtime,\n });\n }\n );\n }\n\n let [fastboot, nonFastboot] = partition(excludeDotFiles(flatten(requiredAppFiles)), file =>\n appFiles.isFastbootOnly.get(file)\n );\n let amdModules = nonFastboot.map(file => this.importPaths(appFiles, file));\n let fastbootOnlyAmdModules = fastboot.map(file => this.importPaths(appFiles, file));\n\n let params = {\n amdModules,\n fastbootOnlyAmdModules,\n lazyRoutes,\n lazyEngines,\n eagerModules,\n styles,\n // this is a backward-compatibility feature: addons can force inclusion of modules.\n defineModulesFrom: './-embroider-implicit-modules.js',\n };\n if (entryParams) {\n Object.assign(params, entryParams);\n }\n\n let source = entryTemplate(params);\n\n let asset: InternalAsset = {\n kind: 'in-memory',\n source,\n relativePath,\n };\n prepared.set(relativePath, asset);\n return asset;\n }\n\n private importPaths({ engine }: AppFiles, engineRelativePath: string) {\n let noHBS = engineRelativePath.replace(this.resolvableExtensionsPattern, '').replace(/\\.hbs$/, '');\n return {\n runtime: `${engine.modulePrefix}/${noHBS}`,\n buildtime: posix.join(engine.package.name, engineRelativePath),\n };\n }\n\n private routeEntrypoint(appFiles: AppFiles, relativePath: string, files: string[]) {\n let [fastboot, nonFastboot] = partition(files, file => appFiles.isFastbootOnly.get(file));\n\n let asset: InternalAsset = {\n kind: 'in-memory',\n source: routeEntryTemplate({\n files: nonFastboot.map(f => this.importPaths(appFiles, f)),\n fastbootOnlyFiles: fastboot.map(f => this.importPaths(appFiles, f)),\n }),\n relativePath,\n };\n return asset;\n }\n\n private testJSEntrypoint(appFiles: AppFiles[], prepared: Map<string, InternalAsset>): InternalAsset {\n let asset = prepared.get(`assets/test.js`);\n if (asset) {\n return asset;\n }\n\n // We're only building tests from the first engine (the app). This is the\n // normal thing to do -- tests from engines don't automatically roll up into\n // the app.\n let engine = appFiles[0];\n\n const myName = 'assets/test.js';\n\n // tests necessarily also include the app. This is where we account for\n // that. The classic solution was to always include the app's separate\n // script tag in the tests HTML, but that isn't as easy for final stage\n // packagers to understand. It's better to express it here as a direct\n // module dependency.\n let eagerModules: string[] = [\n 'ember-testing',\n explicitRelative(dirname(myName), this.topAppJSAsset(appFiles, prepared).relativePath),\n ];\n\n let amdModules: { runtime: string; buildtime: string }[] = [];\n\n for (let relativePath of engine.tests) {\n amdModules.push(this.importPaths(engine, relativePath));\n }\n\n let source = entryTemplate({\n amdModules,\n eagerModules,\n testSuffix: true,\n // this is a backward-compatibility feature: addons can force inclusion of test support modules.\n defineModulesFrom: './-embroider-implicit-test-modules.js',\n });\n\n asset = {\n kind: 'in-memory',\n source,\n relativePath: myName,\n };\n prepared.set(asset.relativePath, asset);\n return asset;\n }\n}\n\nfunction defaultAddonPackageRules(): PackageRules[] {\n return readdirSync(join(__dirname, 'addon-dependency-rules'))\n .map(filename => {\n if (filename.endsWith('.js')) {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n return require(join(__dirname, 'addon-dependency-rules', filename)).default;\n }\n })\n .filter(Boolean)\n .reduce((a, b) => a.concat(b), []);\n}\n\nconst entryTemplate = jsHandlebarsCompile(`\nimport { importSync as i, macroCondition, getGlobalConfig } from '@embroider/macros';\nlet w = window;\nlet d = w.define;\n\n{{#if styles}}\n if (macroCondition(!getGlobalConfig().fastboot?.isRunning)) {\n {{#each styles as |stylePath| ~}}\n i(\"{{js-string-escape stylePath.path}}\");\n {{/each}}\n }\n{{/if}}\n\n{{#if defineModulesFrom ~}}\n import implicitModules from \"{{js-string-escape defineModulesFrom}}\";\n\n for(const [name, module] of Object.entries(implicitModules)) {\n d(name, function() { return module });\n }\n{{/if}}\n\n\n{{#each eagerModules as |eagerModule| ~}}\n i(\"{{js-string-escape eagerModule}}\");\n{{/each}}\n\n{{#each amdModules as |amdModule| ~}}\n d(\"{{js-string-escape amdModule.runtime}}\", function(){ return i(\"{{js-string-escape amdModule.buildtime}}\");});\n{{/each}}\n\n{{#if fastbootOnlyAmdModules}}\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {\n let fastbootModules = {};\n\n {{#each fastbootOnlyAmdModules as |amdModule| ~}}\n fastbootModules[\"{{js-string-escape amdModule.runtime}}\"] = import(\"{{js-string-escape amdModule.buildtime}}\");\n {{/each}}\n\n const resolvedValues = await Promise.all(Object.values(fastbootModules));\n\n Object.keys(fastbootModules).forEach((k, i) => {\n d(k, function(){ return resolvedValues[i];});\n })\n }\n{{/if}}\n\n\n{{#if lazyRoutes}}\nw._embroiderRouteBundles_ = [\n {{#each lazyRoutes as |route|}}\n {\n names: {{json-stringify route.names}},\n load: function() {\n return import(\"{{js-string-escape route.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if lazyEngines}}\nw._embroiderEngineBundles_ = [\n {{#each lazyEngines as |engine|}}\n {\n names: {{json-stringify engine.names}},\n load: function() {\n return import(\"{{js-string-escape engine.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if autoRun ~}}\nif (!runningTests) {\n i(\"{{js-string-escape mainModule}}\").default.create({{json-stringify appConfig}});\n}\n{{else if appBoot ~}}\n {{ appBoot }}\n{{/if}}\n\n{{#if testSuffix ~}}\n {{!- TODO: both of these suffixes should get dynamically generated so they incorporate\n any content-for added by addons. -}}\n\n\n {{!- this is the traditional tests-suffix.js -}}\n i('../tests/test-helper');\n EmberENV.TESTS_FILE_LOADED = true;\n{{/if}}\n`) as (params: {\n amdModules: { runtime: string; buildtime: string }[];\n fastbootOnlyAmdModules?: { runtime: string; buildtime: string }[];\n defineModulesFrom?: string;\n eagerModules?: string[];\n autoRun?: boolean;\n appBoot?: string;\n mainModule?: string;\n appConfig?: unknown;\n testSuffix?: boolean;\n lazyRoutes?: { names: string[]; path: string }[];\n lazyEngines?: { names: string[]; path: string }[];\n styles?: { path: string }[];\n}) => string;\n\nconst routeEntryTemplate = jsHandlebarsCompile(`\nimport { importSync as i } from '@embroider/macros';\nlet d = window.define;\n{{#each files as |amdModule| ~}}\nd(\"{{js-string-escape amdModule.runtime}}\", function(){ return i(\"{{js-string-escape amdModule.buildtime}}\");});\n{{/each}}\n{{#if fastbootOnlyFiles}}\n import { macroCondition, getGlobalConfig } from '@embroider/macros';\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {\n {{#each fastbootOnlyFiles as |amdModule| ~}}\n d(\"{{js-string-escape amdModule.runtime}}\", function(){ return i(\"{{js-string-escape amdModule.buildtime}}\");});\n {{/each}}\n }\n{{/if}}\n`) as (params: {\n files: { runtime: string; buildtime: string }[];\n fastbootOnlyFiles: { runtime: string; buildtime: string }[];\n}) => string;\n\nfunction stringOrBufferEqual(a: string | Buffer, b: string | Buffer): boolean {\n if (typeof a === 'string' && typeof b === 'string') {\n return a === b;\n }\n if (a instanceof Buffer && b instanceof Buffer) {\n return Buffer.compare(a, b) === 0;\n }\n return false;\n}\n\nconst babelFilterTemplate = jsHandlebarsCompile(`\nconst { babelFilter } = require(${JSON.stringify(require.resolve('@embroider/core'))});\nmodule.exports = babelFilter({{json-stringify skipBabel}}, \"{{js-string-escape appRoot}}\");\n`) as (params: { skipBabel: Options['skipBabel']; appRoot: string }) => string;\n\nfunction combinePackageJSON(...layers: object[]) {\n function custom(objValue: any, srcValue: any, key: string, _object: any, _source: any, stack: { size: number }) {\n if (key === 'keywords' && stack.size === 0) {\n if (Array.isArray(objValue)) {\n return objValue.concat(srcValue);\n }\n }\n }\n return mergeWith({}, ...layers, custom);\n}\n\nfunction addCachablePlugin(babelConfig: TransformOptions) {\n if (Array.isArray(babelConfig.plugins) && babelConfig.plugins.length > 0) {\n const plugins = Object.create(null);\n plugins[cacheBustingPluginPath] = cacheBustingPluginVersion;\n\n for (const plugin of babelConfig.plugins) {\n let absolutePathToPlugin: string;\n if (Array.isArray(plugin) && typeof plugin[0] === 'string') {\n absolutePathToPlugin = plugin[0] as string;\n } else if (typeof plugin === 'string') {\n absolutePathToPlugin = plugin;\n } else {\n throw new Error(`[Embroider] a babel plugin without an absolute path was from: ${plugin}`);\n }\n\n plugins[absolutePathToPlugin] = maybeNodeModuleVersion(absolutePathToPlugin);\n }\n\n babelConfig.plugins.push([\n cacheBustingPluginPath,\n {\n plugins,\n },\n ]);\n }\n}\n\nfunction excludeDotFiles(files: string[]) {\n return files.filter(file => !file.startsWith('.') && !file.includes('/.'));\n}\n\ninterface TreeNames {\n appJS: BroccoliNode;\n htmlTree: BroccoliNode;\n publicTree: BroccoliNode | undefined;\n configTree: BroccoliNode;\n}\n\ntype EmberENV = unknown;\n\ntype InternalAsset = OnDiskAsset | InMemoryAsset | BuiltEmberAsset | ConcatenatedAsset;\n\nclass ParsedEmberAsset {\n kind: 'parsed-ember' = 'parsed-ember';\n relativePath: string;\n fileAsset: EmberAsset;\n html: PreparedEmberHTML;\n\n constructor(asset: EmberAsset) {\n this.fileAsset = asset;\n this.html = new PreparedEmberHTML(asset);\n this.relativePath = asset.relativePath;\n }\n\n validFor(other: EmberAsset) {\n return this.fileAsset.mtime === other.mtime && this.fileAsset.size === other.size;\n }\n}\n\nclass BuiltEmberAsset {\n kind: 'built-ember' = 'built-ember';\n relativePath: string;\n parsedAsset: ParsedEmberAsset;\n source: string;\n\n constructor(asset: ParsedEmberAsset) {\n this.parsedAsset = asset;\n this.source = asset.html.dom.serialize();\n this.relativePath = asset.relativePath;\n }\n}\n\nclass ConcatenatedAsset {\n kind: 'concatenated-asset' = 'concatenated-asset';\n constructor(\n public relativePath: string,\n public sources: (OnDiskAsset | InMemoryAsset)[],\n private resolvableExtensions: RegExp\n ) {}\n get sourcemapPath() {\n return this.relativePath.replace(this.resolvableExtensions, '') + '.map';\n }\n}\n"]}
|
package/src/v1-addon.js
CHANGED
|
@@ -920,7 +920,7 @@ class V1Addon {
|
|
|
920
920
|
build() {
|
|
921
921
|
let built = new IntermediateBuild();
|
|
922
922
|
built.staticMeta['order-index'] = this.orderIdx;
|
|
923
|
-
if (this.options.lazyLoading && this.options.lazyLoading.enabled) {
|
|
923
|
+
if (this.options.lazyLoading === true || (this.options.lazyLoading && this.options.lazyLoading.enabled)) {
|
|
924
924
|
built.staticMeta['lazy-engine'] = true;
|
|
925
925
|
}
|
|
926
926
|
if (this.moduleName !== this.name) {
|
package/src/v1-addon.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"v1-addon.js","sourceRoot":"","sources":["v1-addon.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAA6C;AAC7C,+BAAwD;AACxD,mCAA2C;AAC3C,uCAAsD;AAEtD,sEAA0C;AAC1C,qDAA2D;AAC3D,kFAAwD;AACxD,2DAAiE;AAEjE,gFAA8C;AAC9C,oDAA4B;AAC5B,8EAAoD;AACpD,qCAA2C;AAE3C,0CAAwC;AAExC,0DAAiC;AACjC,kEAAyC;AAEzC,qDAAqE;AAErE,sEAA6C;AAC7C,kFAA8C;AAC9C,gHAAqF;AACrF,iEAKgC;AAChC,4FAAgE;AAChE,mCAAmC;AACnC,kGAA6E;AAC7E,sEAA4C;AAI5C,MAAM,cAAc,GAAoB,MAAM,CAAC,MAAM,CAAC;IACpD,OAAO;IACP,cAAc;IACd,QAAQ;IACR,oBAAoB;IACpB,cAAc;IACd,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,uEAAuE;IACvE,8CAA8C;CAC/C,CAAoB,CAAC;AAEtB,MAAM,gBAAgB,GAAG,MAAM,CAAC,MAAM,CAAC;IACrC,SAAS;IACT,cAAc;IACd,uBAAuB;IACvB,yBAAyB;IACzB,YAAY;IACZ,eAAe;IACf,eAAe;IACf,kBAAkB;IAClB,oBAAoB;IACpB,eAAe;CAChB,CAAC,CAAC;AAEH,MAAM,cAAc,GAAG;IACrB,GAAG,EAAE,YAAY;IACjB,KAAK,EAAE,cAAc;IACrB,cAAc,EAAE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name, join, relative, resolve } from 'path';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { existsSync, pathExistsSync } from 'fs-extra';\nimport type { Options as FunnelOptions } from 'broccoli-funnel';\nimport buildFunnel from 'broccoli-funnel';\nimport { UnwatchedDir, WatchedDir } from 'broccoli-source';\nimport RewritePackageJSON from './rewrite-package-json';\nimport { todo, unsupported } from '@embroider/core/src/messages';\nimport type { Node } from 'broccoli-node-api';\nimport mergeTrees from 'broccoli-merge-trees';\nimport semver from 'semver';\nimport rewriteAddonTree from './rewrite-addon-tree';\nimport { mergeWithAppend } from './merges';\nimport type { AddonMeta, PackageCache, AddonInstance, AddonTreePath } from '@embroider/core';\nimport { debug } from '@embroider/core';\nimport type Options from './options';\nimport walkSync from 'walk-sync';\nimport ObserveTree from './observe-tree';\nimport type { Options as HTMLBarsOptions } from 'ember-cli-htmlbars';\nimport { isEmbroiderMacrosPlugin } from '@embroider/macros/src/node';\nimport type { TransformOptions, PluginItem } from '@babel/core';\nimport modulesCompat from './modules-compat';\nimport writeFile from 'broccoli-file-creator';\nimport SynthesizeTemplateOnlyComponents from './synthesize-template-only-components';\nimport {\n isEmberAutoImportDynamic,\n isCompactReexports,\n isColocationPlugin,\n isInlinePrecompilePlugin,\n} from './detect-babel-plugins';\nimport HbsToJSBroccoliPlugin from './hbs-to-js-broccoli-plugin';\nimport { fromPairs } from 'lodash';\nimport prepHtmlbarsAstPluginsForUnwrap from './prepare-htmlbars-ast-plugins';\nimport getRealAddon from './get-real-addon';\nimport type { Options as EtcOptions } from 'babel-plugin-ember-template-compilation';\nimport type CompatApp from './compat-app';\n\nconst stockTreeNames: AddonTreePath[] = Object.freeze([\n 'addon',\n 'addon-styles',\n 'styles',\n 'addon-test-support',\n 'test-support',\n 'app',\n 'public',\n 'vendor',\n // 'addon-templates' and 'templates are trees too, but they live inside\n // 'addon' and 'app' and we handle them there.\n]) as AddonTreePath[];\n\nconst dynamicTreeHooks = Object.freeze([\n 'treeFor',\n 'treeForAddon',\n 'treeForAddonTemplates',\n 'treeForAddonTestSupport',\n 'treeForApp',\n 'treeForPublic',\n 'treeForStyles',\n 'treeForTemplates',\n 'treeForTestSupport',\n 'treeForVendor',\n]);\n\nconst defaultMethods = {\n app: 'treeForApp',\n addon: 'treeForAddon',\n 'addon-styles': 'treeForAddonStyles',\n 'addon-templates': 'treeForAddonTemplates',\n 'addon-test-support': 'treeForAddonTestSupport',\n public: 'treeForPublic',\n styles: 'treeForStyles',\n templates: 'treeForTemplates',\n 'test-support': 'treeForTestSupport',\n vendor: 'treeForVendor',\n};\n\nconst appPublicationDir = '_app_';\nconst fastbootPublicationDir = '_fastboot_';\n\n// This controls and types the interface between our new world and the classic\n// v1 addon instance.\nexport default class V1Addon {\n constructor(\n protected addonInstance: AddonInstance,\n protected addonOptions: Required<Options>,\n protected app: CompatApp,\n private packageCache: PackageCache,\n private orderIdx: number\n ) {\n if (addonInstance.registry) {\n this.updateRegistry(addonInstance.registry);\n }\n }\n\n // Optional extensible hook for pruning down the list of redundant addon\n // instances produced by the classic ember-cli architecture. ember-cli\n // instantiates each addon *per consumer*, not per package. So a given package\n // will have many addon instances, and Embroider dutifully produces a V1Addon\n // instance for each one, and then needs to mimic the classic smooshing\n // behavior between them.\n //\n // But some packages (and ember-cli-babel is the motivating example) produce a\n // huge number of instances that do nothing useful and incur significant cost.\n // This hook allows their compat adapter to prune down the set, using\n // addon-specific knowledge of which instance(s) are actually important.\n //\n // The order of the instances is significant. The first one is the one with\n // the highest precedence, meaning its files would win under classic\n // smooshing.\n reduceInstances(instances: V1Addon[]): V1Addon[] {\n // the default beahvior is that all copies matter\n return instances;\n }\n\n // this is only defined when there are custom AST transforms that need it\n @Memoize()\n private get templateCompilerBabelPlugin(): PluginItem | undefined {\n let htmlbars = this.addonInstance.addons.find(a => a.name === 'ember-cli-htmlbars');\n if (htmlbars) {\n let options = (htmlbars as any).htmlbarsOptions() as HTMLBarsOptions;\n if (options?.plugins?.ast) {\n // our macros don't run here in stage1\n options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n prepHtmlbarsAstPluginsForUnwrap(this.addonInstance.registry);\n if (options.plugins.ast.length > 0) {\n let opts: EtcOptions = {\n compilerPath: options.templateCompilerPath,\n targetFormat: 'hbs',\n enableLegacyModules: [\n 'ember-cli-htmlbars',\n 'ember-cli-htmlbars-inline-precompile',\n 'htmlbars-inline-precompile',\n ],\n transforms: options.plugins.ast as any,\n };\n return [require.resolve('babel-plugin-ember-template-compilation'), opts];\n }\n }\n }\n }\n\n private updateRegistry(registry: any) {\n // auto-import gets disabled because we support it natively\n registry.remove('js', 'ember-auto-import-analyzer');\n\n // here we're replacing the stock template compiler with our own. Ours\n // doesn't compile all the way to wire format -- it does source-to-source\n // transformation just to process custom AST transforms, while leaving the\n // template as a template. It does turn HBS files into equivalent JS files\n // (because in the general case, AST transforms may need to emit values in\n // Javascript scope), but those JS files will contain HBS strings, not wire\n // format.\n //\n // Even when no AST transforms are registered, we'll still need to register\n // a no-op transform here to avoid an exception coming out of ember-cli like\n // \"Addon templates were detected, but there are no template compilers\n // registered\".\n registry.remove('template', 'ember-cli-htmlbars');\n registry.add('template', {\n name: 'embroider-addon-templates',\n ext: 'hbs',\n _addon: this,\n toTree(this: { _addon: V1Addon }, tree: Node): Node {\n if (this._addon.templateCompilerBabelPlugin) {\n return new HbsToJSBroccoliPlugin(tree);\n } else {\n // when there are no custom AST transforms, we don't need to do\n // anything at all.\n return tree;\n }\n },\n });\n\n // first, look into the babel config and related packages to decide whether\n // we need to run babel at all in this stage.\n let needsCustomBabel = this.needsCustomBabel();\n\n // regardless of the answer, we modify the babel config, because even if\n // we're unregistering ember-cli-babel, some addons manually invoke\n // ember-cli-babel in their custom hooks, and in that case we want to be\n // sure we've taken out the babel plugins that really shouldn't run at this\n // stage.\n this.updateBabelConfig();\n\n if (!needsCustomBabel) {\n // no custom babel behavior, so we don't run the ember-cli-babel\n // preprocessor at all. We still need to register a no-op preprocessor to\n // prevent ember-cli from emitting a deprecation warning.\n registry.remove('js', 'ember-cli-babel');\n registry.add('js', {\n name: 'embroider-babel-noop',\n ext: 'js',\n toTree(tree: Node) {\n return tree;\n },\n });\n }\n }\n\n // we need to run custom inline hbs preprocessing if there are custom hbs\n // plugins and there are inline hbs templates\n private needsInlineHBS(): boolean {\n if (!this.templateCompilerBabelPlugin) {\n // no custom transforms\n return false;\n }\n if (this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-htmlbars-inline-precompile')) {\n // the older inline template compiler is present\n return true;\n }\n\n if (\n this.addonInstance.addons.find(\n (a: any) =>\n a.name === 'ember-cli-htmlbars' && semver.satisfies(semver.coerce(a.pkg.version) || a.pkg.version, '>4.0.0')\n )\n ) {\n // a version of ember-cli-htmlbars that natively supports inline hbs is present\n return true;\n }\n\n return false;\n }\n\n private needsCustomBabel() {\n if (\n this.addonInstance.addons.find(\n (a: any) =>\n a.name === 'ember-cli-typescript' &&\n semver.satisfies(semver.coerce(a.pkg.version) || a.pkg.version, '>=4.0.0-alpha.1')\n )\n ) {\n // This addon is using ember-cli-typescript 4, which relies on\n // ember-cli-babel to add the TypeScript transform Babel plugin.\n return true;\n }\n\n if (\n this.addonInstance.options &&\n this.addonInstance.options['ember-cli-babel'] &&\n this.addonInstance.options['ember-cli-babel'].enableTypeScriptTransform\n ) {\n // This addon has explicitly configured ember-cli-babel to add the\n // TypeScript transform Babel plugin.\n return true;\n }\n\n if ((this.options.babel?.plugins?.filter(babelPluginAllowedInStage1)?.length ?? 0) > 0) {\n // this addon has custom babel plugins, so we need to run them here in\n // stage1\n return true;\n }\n\n // even if there are no custom babel plugins, if we need to do any\n // preprocessing of inline handlebars templates we still need to run the\n // custom babel.\n return this.needsInlineHBS();\n }\n\n get name(): string {\n return this.packageJSON.name;\n }\n\n // you can override this to change the *input* packageJSON that the rest of\n // stage1 will see. If you want to see and change the *output* packageJSON see\n // `newPackageJSON`.\n protected get packageJSON() {\n return this.packageCache.get(this.root).packageJSON;\n }\n\n protected get newPackageJSON() {\n // shallow copy only! This is OK as long as we're only changing top-level\n // keys in this method\n let pkg = Object.assign({}, this.packageJSON);\n let meta: AddonMeta = Object.assign({}, this.packageCache.get(this.root).meta, this.packageMeta);\n pkg['ember-addon'] = meta;\n\n // classic addons don't get to customize their entrypoints like this. We\n // always rewrite them so their entrypoint is index.js, so whatever was here\n // is just misleading to stage3 packagers that might look (rollup does).\n delete pkg.main;\n delete pkg.module;\n delete pkg.exports;\n\n return pkg;\n }\n\n @Memoize()\n get root(): string {\n // addonInstance.root gets modified by a customized \"main\" or\n // \"ember-addon.main\" in package.json. We want the real package root here\n // (the place where package.json lives).\n return dirname(pkgUpSync({ cwd: this.addonInstance.root })!);\n }\n\n @Memoize()\n private get mainModule() {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const mod = require((this.addonInstance as unknown as any).constructor._meta_.modulePath);\n\n if (typeof mod === 'function') {\n return mod.prototype;\n } else {\n return mod;\n }\n }\n\n protected get options() {\n if (!this.addonInstance.options) {\n this.addonInstance.options = {};\n return this.addonInstance.options;\n }\n // some addons (like ember-cli-inline-content) assign the *app's* options\n // onto their own this.options. Which means they (accidentally or on\n // purpose), always get the app's babel config, and it means when we try\n // to modify the addon's babel config we're accidentally modifying the\n // app's too.\n //\n // So here we do copying to ensure that we can modify the babel config\n // without altering anybody else. We're not doing cloneDeep because that\n // pulls on our lazy MacrosConfig if it appears in any babel configs here,\n // whereas we want to leave it unevaluated until babel actually uses it.\n let addonOptions =\n typeof this.addonInstance.options == 'function' ? this.addonInstance.options() : this.addonInstance.options;\n let options = Object.assign({}, addonOptions);\n if (options.babel) {\n options.babel = Object.assign({}, options.babel);\n if (options.babel.plugins) {\n options.babel.plugins = options.babel.plugins.slice();\n }\n }\n if (options['ember-cli-babel']) {\n options['ember-cli-babel'] = Object.assign({}, options['ember-cli-babel']);\n }\n\n if (typeof this.addonInstance.options == 'function') {\n this.addonInstance.options = () => options;\n } else {\n this.addonInstance.options = options;\n }\n\n return options;\n }\n\n protected customizes(...treeNames: string[]) {\n // get the real addon as we're going to compare with __proto__\n const realAddon = getRealAddon(this.addonInstance);\n return Boolean(\n treeNames.find(treeName => {\n return (\n // customized hook exists in actual code exported from their index.js\n this.mainModule[treeName] ||\n // addon instance doesn't match its own prototype\n (realAddon.__proto__ && realAddon[treeName] !== realAddon.__proto__[treeName]) ||\n this.customizesHookName(treeName)\n );\n })\n );\n }\n\n private customizesHookName(treeName: string): boolean {\n if (!this.addonInstance.treeForMethods) {\n // weird old addons don't even extend ember-cli's Addon base class and\n // might not have this.\n return false;\n }\n for (let [name, methodName] of Object.entries(defaultMethods)) {\n if (methodName === treeName) {\n return this.addonInstance.treeForMethods[name] !== methodName;\n }\n }\n return false;\n }\n\n @Memoize()\n private hasStockTree(treeName: AddonTreePath): boolean {\n if (this.suppressesTree(treeName)) {\n return false;\n }\n\n // we need to use this.addonInstance.root instead of this.root here because\n // we're looking for the classic location of the stock tree, and that\n // location is influenced by a customized ember-addon.main in package.json,\n // which is reflected in addonInstance.root.\n return (\n this.addonInstance.treePaths && existsSync(join(this.addonInstance.root, this.addonInstance.treePaths[treeName]))\n );\n }\n\n hasAnyTrees(): boolean {\n return Boolean(stockTreeNames.find(name => this.hasStockTree(name))) || this.customizes(...dynamicTreeHooks);\n }\n\n // we keep all these here to ensure that we always apply the same options to\n // the same tree, so that our cache doesn't need to worry about varying\n // options.\n private stockTreeFunnelOptions(treeName: string): FunnelOptions | undefined {\n switch (treeName) {\n case 'addon':\n return {\n exclude: ['styles/**'],\n };\n case 'styles':\n return {\n destDir: '_app_styles_',\n };\n case 'addon-test-support':\n return {\n destDir: 'test-support',\n };\n case 'app':\n return {\n exclude: ['styles/**'],\n destDir: appPublicationDir,\n };\n case 'public':\n return {\n destDir: `public/${this.moduleName}`,\n };\n case 'vendor':\n return {\n destDir: 'vendor',\n };\n }\n }\n\n protected stockTree(treeName: AddonTreePath): Node {\n return this.throughTreeCache(treeName, 'stock', () => {\n // adjust from the legacy \"root\" to our real root, because our rootTree\n // uses our real root but the stock trees are defined in terms of the\n // legacy root\n let srcDir = relative(this.root, join(this.addonInstance.root, this.addonInstance.treePaths[treeName]));\n let opts = Object.assign({ srcDir }, this.stockTreeFunnelOptions(treeName));\n return buildFunnel(this.rootTree, opts);\n })!;\n }\n\n @Memoize()\n protected get rootTree(): Node {\n if (this.packageCache.get(this.root).mayRebuild) {\n return new WatchedDir(this.root);\n } else {\n return new UnwatchedDir(this.root);\n }\n }\n\n @Memoize()\n private get moduleName(): string {\n if (typeof this.addonInstance.moduleName === 'function') {\n return this.addonInstance.moduleName();\n }\n return this.addonInstance.name;\n }\n\n // applies preprocessors to JS and HBS\n private transpile(tree: Node) {\n // Namespace the tree being passed to preprocessJs with the moduleName\n // to mimic classic build\n tree = buildFunnel(tree, { destDir: this.moduleName });\n\n if (this.addonInstance.shouldCompileTemplates() && this.addonInstance.registry.load('template')?.length > 0) {\n tree = this.app.preprocessRegistry.preprocessTemplates(tree, {\n registry: this.addonInstance.registry,\n });\n }\n\n tree = this.addonInstance.preprocessJs(tree, '/', this.moduleName, {\n registry: this.addonInstance.registry,\n });\n\n // Remove namespacing so that it gets written out to the node_modules\n // directory correctly.\n tree = buildFunnel(tree, {\n srcDir: this.moduleName,\n });\n\n return tree;\n }\n\n @Memoize()\n protected updateBabelConfig() {\n let packageOptions = this.options;\n let emberCLIBabelInstance = this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-babel');\n let version;\n\n if (emberCLIBabelInstance) {\n version = emberCLIBabelInstance.pkg.version;\n }\n\n if (!packageOptions['ember-cli-babel']) {\n packageOptions['ember-cli-babel'] = {};\n }\n\n if (!packageOptions.babel) {\n packageOptions.babel = {};\n }\n let babelConfig = packageOptions.babel as TransformOptions;\n\n Object.assign(packageOptions['ember-cli-babel'], {\n compileModules: false,\n disablePresetEnv: true,\n disableDebugTooling: true,\n disableEmberModulesAPIPolyfill: true,\n });\n\n if (version && semver.satisfies(semver.coerce(version) || version, '^5')) {\n unsupported(`${this.name} is using babel 5. Not installing our custom plugin.`);\n return;\n }\n\n if (!babelConfig.plugins) {\n babelConfig.plugins = [];\n } else {\n let hadAutoImport = Boolean(babelConfig.plugins.find(isEmberAutoImportDynamic));\n babelConfig.plugins = babelConfig.plugins.filter(babelPluginAllowedInStage1);\n if (hadAutoImport) {\n // if we removed ember-auto-import's dynamic import() plugin, the code\n // may use import() syntax and we need to re-add it to the parser.\n if (version && semver.satisfies(semver.coerce(version) || version, '^6')) {\n babelConfig.plugins.push(require.resolve('babel-plugin-syntax-dynamic-import'));\n } else {\n babelConfig.plugins.push(require.resolve('@babel/plugin-syntax-dynamic-import'));\n }\n }\n }\n\n if (this.templateCompilerBabelPlugin) {\n babelConfig.plugins.push(this.templateCompilerBabelPlugin);\n }\n }\n\n get v2Tree(): Node {\n return this.throughTreeCache(\n // these are all the kinds of trees that ember-cli's tree cache\n // understands. We need them all here because if *any* of these are\n // uncacheable, we want our whole v2 tree to be treated as uncacheable.\n [\n 'app',\n 'addon',\n 'addon-styles',\n 'addon-templates',\n 'addon-test-support',\n 'public',\n 'styles',\n 'templates',\n 'test-support',\n 'vendor',\n ],\n 'v2Tree',\n () => mergeTrees(this.v2Trees, { overwrite: true })\n );\n }\n\n // this is split out so that compatibility shims can override it to add more\n // things to the package metadata.\n protected get packageMeta(): Partial<AddonMeta> {\n let built = this.build();\n return mergeWithAppend(\n {\n version: 2,\n 'auto-upgraded': true,\n type: 'addon',\n },\n built.staticMeta,\n ...built.dynamicMeta.map(d => d())\n );\n }\n\n @Memoize()\n protected get v2Trees() {\n let { trees } = this.build();\n return trees;\n }\n\n protected throughTreeCache(nameOrNames: string | string[], category: string, fn: () => Node): Node;\n protected throughTreeCache(\n nameOrNames: string | string[],\n category: string,\n fn: () => Node | undefined\n ): Node | undefined {\n let cacheKey: string | undefined;\n if (typeof this.addonInstance.cacheKeyForTree === 'function') {\n let names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames];\n cacheKey = names.reduce((accum: string | undefined, name) => {\n if (accum == null) {\n // a previous name was uncacheable, so we're entirely uncacheable\n return undefined;\n }\n let key = this.addonInstance.cacheKeyForTree?.(name);\n if (key) {\n return accum + key;\n } else {\n return undefined;\n }\n }, '');\n if (cacheKey) {\n cacheKey = cacheKey + category;\n let cachedTree = this.app.addonTreeCache.get(cacheKey);\n if (cachedTree) {\n debug('cache hit %s %s %s', this.name, nameOrNames, category);\n return cachedTree;\n }\n }\n }\n debug('cache miss %s %s %s', this.name, nameOrNames, category);\n let tree = fn();\n if (tree && cacheKey) {\n this.app.addonTreeCache.set(cacheKey, tree);\n }\n return tree;\n }\n\n // In general, we can't reliably run addons' custom `treeFor()` methods,\n // because they recurse in a way that we absolutely don't want.\n //\n // But there is a very common use case that we *can* handle opportunisticaly,\n // which is a treeFor() that's used purely to guard whether `_super` will be\n // called or not.\n protected suppressesTree(name: string): boolean {\n if (!this.customizes('treeFor')) {\n return false;\n }\n // get the real addon as we're going to patch and restore `_super`\n const realAddon = getRealAddon(this.addonInstance);\n let origSuper = this.addonInstance._super;\n try {\n realAddon._super = stubbedSuper;\n let result = this.mainModule.treeFor?.call(this.addonInstance, name);\n if (result === markedEmptyTree) {\n // the method returns _super unchanged, so tree is not suppressed and we\n // understand what's going on\n return false;\n }\n if (result == null) {\n // the method nulled out the tree, so we are definitely suppressing\n return true;\n }\n // we can't tell what's really going on, don't suppress and hope for the\n // best\n unsupported(`${this.name} has a custom treeFor() method that is doing some arbitrary broccoli processing.`);\n return false;\n } finally {\n if (realAddon._super === stubbedSuper) {\n realAddon._super = origSuper;\n }\n }\n }\n\n protected invokeOriginalTreeFor(\n name: string,\n { neuterPreprocessors } = { neuterPreprocessors: false }\n ): Node | undefined {\n // @ts-expect-error have no idea why throughTreeCache overload is not working here..\n return this.throughTreeCache(name, 'original', () => {\n // get the real addon as we're going to patch and restore `preprocessJs`\n const realAddon = getRealAddon(this.addonInstance);\n let original;\n try {\n if (neuterPreprocessors) {\n original = realAddon.preprocessJs;\n realAddon.preprocessJs = function (tree: Node) {\n return tree;\n };\n }\n if (this.suppressesTree(name)) {\n return undefined;\n }\n return this.addonInstance._treeFor(name);\n } finally {\n if (neuterPreprocessors) {\n realAddon.preprocessJs = original;\n }\n }\n });\n }\n\n protected treeForAddon(built: IntermediateBuild): Node | undefined {\n // the extra isEngine condition is because ember-engines injects a\n // treeForAddon method into each engine addon that we really don't need or\n // want to run. Unfortunately there's not a more localized place to patch it\n // out, partly because ember-engines also uses a bogus inheritance strategy\n // (instead of providing a prototype that engine addons can extend it\n // patches things into their instance directly).\n if (this.customizes('treeForAddon', 'treeForAddonTemplates') && !this.isEngine()) {\n let tree = this.invokeOriginalTreeFor('addon', { neuterPreprocessors: true });\n if (tree) {\n tree = modulesCompat(tree);\n\n // this captures addons that are trying to escape their own package's\n // namespace\n let result = rewriteAddonTree(this.transpile(tree), this.name, this.moduleName);\n built.dynamicMeta.push(result.getMeta);\n return result.tree;\n }\n } else if (this.hasStockTree('addon')) {\n return this.transpile(this.stockTree('addon'));\n }\n }\n\n protected addonStylesTree(): Node | undefined {\n if (this.customizes('treeForAddonStyles')) {\n let custom = this.invokeOriginalTreeFor('addon-styles');\n if (custom) {\n return this.addonInstance.compileStyles(custom);\n }\n } else if (this.hasStockTree('addon-styles')) {\n return this.addonInstance.compileStyles(this.stockTree('addon-styles'));\n }\n }\n\n protected treeForTestSupport(): Node | undefined {\n if (this.customizes('treeForTestSupport')) {\n todo(`${this.name} has customized the test support tree`);\n } else if (this.hasStockTree('test-support')) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app. For example, imports should be relative to\n // the consuming app, not our own package.\n return buildFunnel(this.stockTree('test-support'), {\n destDir: `${appPublicationDir}/tests`,\n });\n }\n }\n\n private buildTreeForAddon(built: IntermediateBuild) {\n let tree = this.treeForAddon(built);\n if (!tree) {\n return;\n }\n let templateOnlyComponents: Node = new SynthesizeTemplateOnlyComponents(tree, {\n allowedPaths: ['components'],\n\n // if an addon has custom AST transforms, stage1 can rewrite .hbs to\n // .hbs.js\n templateExtensions: ['.hbs', '.hbs.js'],\n });\n if (this.addonOptions.staticAddonTrees) {\n if (this.isEngine()) {\n // even when staticAddonTrees is enabled, engines may have a router map\n // that needs to be dynamically resolved.\n let hasRoutesModule = false;\n\n tree = new ObserveTree(tree, outputDir => {\n hasRoutesModule = existsSync(resolve(outputDir, 'routes.js'));\n });\n built.dynamicMeta.push(() => ({\n 'implicit-modules': hasRoutesModule ? ['./routes.js'] : [],\n }));\n }\n } else {\n let filenames: string[] = [];\n let templateOnlyComponentNames: string[] = [];\n\n tree = new ObserveTree(tree, outputDir => {\n filenames = walkSync(outputDir, { globs: ['**/*.js', '**/*.hbs'] })\n .map(f => `./${f.replace(/\\.js$/i, '')}`)\n .filter(notColocatedTemplate);\n });\n\n templateOnlyComponents = new ObserveTree(templateOnlyComponents, outputDir => {\n templateOnlyComponentNames = walkSync(outputDir, { globs: ['**/*.js'] }).map(\n f => `./${f.replace(/\\.js$/i, '')}`\n );\n });\n\n built.dynamicMeta.push(() => ({\n 'implicit-modules': filenames.concat(templateOnlyComponentNames),\n }));\n }\n built.trees.push(tree);\n built.trees.push(templateOnlyComponents);\n }\n\n private buildAddonStyles(built: IntermediateBuild) {\n let addonStylesTree = this.addonStylesTree();\n if (addonStylesTree) {\n if (this.app.hasCompiledStyles) {\n // >= ember-cli@3.18 store css files in <addon-name/__COMPILED_STYLES__\n // and for embroider to work correctly need to be moved back to `/`\n //\n // speaking with @rwjblue the ember-cli build is now frozen, and it is\n // ok to assume that after the above version no changes will occur\n // makings this work-around safe.\n //\n // additional context: https://github.com/embroider-build/embroider/pull/934/files#r695269976\n addonStylesTree = buildFunnel(addonStylesTree, {\n srcDir: `${this.name}/__COMPILED_STYLES__`,\n destDir: '/',\n allowEmpty: true,\n });\n }\n\n let discoveredFiles: string[] = [];\n let tree = new ObserveTree(addonStylesTree, outputPath => {\n discoveredFiles = walkSync(outputPath, { globs: ['**/*.css'], directories: false });\n });\n built.trees.push(tree);\n built.dynamicMeta.push(() => {\n return {\n 'implicit-styles': discoveredFiles.map(f => `./${f}`),\n };\n });\n }\n }\n\n private buildTreeForStyles(built: IntermediateBuild) {\n let tree;\n if (this.customizes('treeForStyles')) {\n // the user's tree returns their own styles with no \"app/styles\" wrapping\n // around, which is actually what we want\n tree = this.invokeOriginalTreeFor('styles');\n if (tree) {\n tree = buildFunnel(tree, {\n destDir: '_app_styles_',\n getDestinationPath(path) {\n return path.replace(/^app\\/styles\\//, '');\n },\n });\n }\n } else if (this.hasStockTree('styles')) {\n tree = this.stockTree('styles');\n }\n if (tree) {\n built.trees.push(tree);\n }\n }\n\n private buildAddonTestSupport(built: IntermediateBuild) {\n let addonTestSupportTree;\n if (this.customizes('treeForAddonTestSupport')) {\n let original = this.invokeOriginalTreeFor('addon-test-support', { neuterPreprocessors: true });\n if (original) {\n let { tree, getMeta } = rewriteAddonTree(original, this.name, this.moduleName);\n addonTestSupportTree = this.transpile(tree);\n built.dynamicMeta.push(getMeta);\n }\n } else if (this.hasStockTree('addon-test-support')) {\n addonTestSupportTree = this.transpile(this.stockTree('addon-test-support'));\n }\n if (addonTestSupportTree) {\n if (!this.addonOptions.staticAddonTestSupportTrees) {\n let filenames: string[] = [];\n addonTestSupportTree = new ObserveTree(addonTestSupportTree, outputPath => {\n filenames = walkSync(outputPath, { globs: ['**/*.js', '**/*.hbs'] }).map(f => `./${f.replace(/.js$/i, '')}`);\n });\n built.dynamicMeta.push(() => ({\n 'implicit-test-modules': filenames,\n }));\n }\n built.trees.push(addonTestSupportTree);\n }\n }\n\n private maybeSetDirectoryMeta(built: IntermediateBuild, tree: Node, localDir: string, key: keyof AddonMeta): Node {\n let files: AddonMeta['app-js'];\n built.dynamicMeta.push(() => {\n if (files) {\n return { [key]: files };\n } else {\n return {};\n }\n });\n return new ObserveTree(tree, (outputPath: string) => {\n let dir = join(outputPath, localDir);\n if (existsSync(dir)) {\n files = fromPairs(walkSync(dir, { globs: ['**/*.js', '**/*.hbs'] }).map(f => [`./${f}`, `./${localDir}/${f}`]));\n } else {\n files = undefined;\n }\n });\n }\n\n private buildTestSupport(built: IntermediateBuild) {\n let tree = this.treeForTestSupport();\n if (tree) {\n tree = this.maybeSetDirectoryMeta(built, tree, appPublicationDir, 'app-js');\n built.trees.push(tree);\n }\n }\n\n private buildTreeForApp(built: IntermediateBuild) {\n let appTree;\n if (this.customizes('treeForApp', 'treeForTemplates')) {\n let original = this.invokeOriginalTreeFor('app');\n if (original) {\n appTree = buildFunnel(original, {\n destDir: appPublicationDir,\n });\n }\n } else if (this.hasStockTree('app')) {\n appTree = this.stockTree('app');\n }\n\n if (appTree) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app.\n appTree = this.maybeSetDirectoryMeta(built, appTree, appPublicationDir, 'app-js');\n built.trees.push(appTree);\n }\n\n if (\n typeof this.addonInstance.isDevelopingAddon === 'function' &&\n this.addonInstance.isDevelopingAddon() &&\n this.addonInstance.hintingEnabled()\n ) {\n let hintTree = this.addonInstance.jshintAddonTree();\n if (hintTree) {\n hintTree = this.maybeSetDirectoryMeta(\n built,\n buildFunnel(hintTree, { destDir: appPublicationDir }),\n appPublicationDir,\n 'app-js'\n );\n built.trees.push(hintTree);\n }\n }\n }\n\n private buildTreeForFastBoot(built: IntermediateBuild) {\n let tree;\n\n if (this.customizes('treeForFastBoot')) {\n // Arguably, it would be more correct to always create the new Funnel,\n // because the fastboot directory could be created *after* our build starts.\n // But that would result in hundreds of additional trees, even though the\n // vast majority of addons aren't changing and don't have fastboot\n // directories. So I'm pretty comfortable with the optimization. It means\n // that an addon author who creates a brand new fastboot directory in a v1\n // packages will need to restart their build. (Really we hope new addons\n // will be authored in v2 instead soon anyway, and they won't need the\n // concept of \"fastboot directory\" because they can use the macro system to\n // conditionally import some things only in fastboot.)\n if (pathExistsSync(join(this.root, 'fastboot'))) {\n tree = buildFunnel(this.rootTree, { srcDir: 'fastboot' });\n }\n tree = this.addonInstance.treeForFastBoot(tree);\n if (tree) {\n tree = buildFunnel(tree, { destDir: fastbootPublicationDir });\n }\n } else {\n if (pathExistsSync(join(this.root, 'fastboot'))) {\n tree = buildFunnel(this.rootTree, { srcDir: 'fastboot', destDir: fastbootPublicationDir });\n }\n }\n\n if (tree) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app.\n tree = this.maybeSetDirectoryMeta(built, tree, fastbootPublicationDir, 'fastboot-js');\n built.trees.push(tree);\n }\n }\n\n private buildPublicTree(built: IntermediateBuild) {\n let publicTree;\n // the extra isEngine condition is here because ember-engines injects a\n // customized treeForPublic into every engine addon. We don't want or need\n // it to run.\n if (this.customizes('treeForPublic') && !this.isEngine()) {\n let original = this.invokeOriginalTreeFor('public');\n if (original) {\n publicTree = buildFunnel(original, {\n destDir: 'public',\n });\n }\n } else if (this.hasStockTree('public')) {\n publicTree = this.stockTree('public');\n }\n if (publicTree) {\n let publicAssets: { [filename: string]: string } = {};\n publicTree = new ObserveTree(publicTree, (outputPath: string) => {\n publicAssets = {};\n for (let filename of walkSync(join(outputPath, 'public'))) {\n if (!filename.endsWith('/')) {\n publicAssets[`./public/${filename}`] = './' + filename;\n }\n }\n });\n built.trees.push(publicTree);\n built.dynamicMeta.push(() => ({ 'public-assets': publicAssets }));\n }\n }\n\n private buildVendorTree(built: IntermediateBuild) {\n if (this.customizes('treeForVendor')) {\n // We don't have any particular opinions about the structure inside\n // vendor, so even when it's customized we can just use the customized\n // one.\n let tree = this.invokeOriginalTreeFor('vendor');\n if (tree) {\n built.trees.push(\n buildFunnel(tree, {\n destDir: 'vendor',\n })\n );\n }\n } else if (this.hasStockTree('vendor')) {\n built.trees.push(this.stockTree('vendor'));\n }\n }\n\n private isEngine() {\n return typeof this.addonInstance.getEngineConfigContents === 'function';\n }\n\n private buildEngineConfig(built: IntermediateBuild) {\n if (!this.isEngine()) {\n return;\n }\n // this addon is an engine, so it needs its own config/environment.js.\n // ember-engines always emits a separate inline (not-meta-tag) config for\n // fastboot, so we mimic that behavior here.\n //\n // getEngineConfigContents is an arbitrary customizable module, so we can't\n // easily rewrite it to live inside our conditional, so it's safer in a\n // separate module.\n built.trees.push(writeFile('config/_environment_browser_.js', this.addonInstance.getEngineConfigContents?.()));\n built.trees.push(\n writeFile(\n 'config/environment.js',\n `\n import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';\n let config;\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)){\n config = ${JSON.stringify(this.addonInstance.engineConfig?.(this.app.env, {}), null, 2)};\n } else {\n config = importSync('./_environment_browser_.js').default;\n }\n export default config;\n `\n )\n );\n }\n\n private buildPackageJSON(built: IntermediateBuild) {\n built.trees.push(new RewritePackageJSON(this.rootTree, () => this.newPackageJSON));\n }\n\n @Memoize()\n private build(): IntermediateBuild {\n let built = new IntermediateBuild();\n built.staticMeta['order-index'] = this.orderIdx;\n\n if (this.options.lazyLoading && this.options.lazyLoading.enabled) {\n built.staticMeta['lazy-engine'] = true;\n }\n\n if (this.moduleName !== this.name) {\n built.staticMeta['renamed-packages'] = {\n [this.moduleName]: this.name,\n };\n }\n\n this.buildTreeForAddon(built);\n this.buildAddonStyles(built);\n this.buildTreeForStyles(built);\n this.buildAddonTestSupport(built);\n this.buildTestSupport(built);\n this.buildTreeForApp(built);\n this.buildTreeForFastBoot(built);\n this.buildPublicTree(built);\n this.buildVendorTree(built);\n this.buildEngineConfig(built);\n this.buildPackageJSON(built);\n return built;\n }\n}\n\nexport interface V1AddonConstructor {\n new (\n addonInstance: any,\n options: Required<Options>,\n app: CompatApp,\n packageCache: PackageCache,\n orderIdx: number\n ): V1Addon;\n\n shouldApplyAdapter?(addonInstance: any): boolean;\n}\n\nclass IntermediateBuild {\n trees: Node[] = [];\n staticMeta: { [metaField: string]: any } = {};\n dynamicMeta: (() => Partial<AddonMeta>)[] = [];\n}\n\nfunction babelPluginAllowedInStage1(plugin: PluginItem) {\n if (isEmbroiderMacrosPlugin(plugin)) {\n // the point of @embroider/macros is that it's allowed to stay in v2\n // addon publication format, so it doesn't need to run here in stage1.\n // We always run it in stage3.\n return false;\n }\n\n if (isInlinePrecompilePlugin(plugin)) {\n // Similarly, the inline precompile plugin must not run in stage1. We\n // want all templates uncompiled. Instead, we will be adding our own\n // plugin that only runs custom AST transforms inside inline\n // templates.\n return false;\n }\n\n if (isEmberAutoImportDynamic(plugin)) {\n // We replace ember-auto-import's implementation of dynamic import(), so we\n // need to stop its plugin from rewriting those.\n return false;\n }\n\n if (isCompactReexports(plugin)) {\n // We don't want to replace re-exports at this stage, since that will turn\n // an `export` statement into a `define`, which is handled in Stage 3\n return false;\n }\n\n if (isColocationPlugin(plugin)) {\n // template co-location is a first-class feature we support directly, so\n // whether or not the app brought a plugin for it we're going to do it our\n // way.\n return false;\n }\n\n return true;\n}\n\nfunction notColocatedTemplate(path: string) {\n return !/^\\.\\/components\\/.*\\.hbs$/.test(path);\n}\n\nconst markedEmptyTree = new UnwatchedDir(process.cwd());\n\nconst stubbedSuper = () => {\n return markedEmptyTree;\n};\n\nstubbedSuper.treeFor = () => {\n return markedEmptyTree;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"v1-addon.js","sourceRoot":"","sources":["v1-addon.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,2DAA6C;AAC7C,+BAAwD;AACxD,mCAA2C;AAC3C,uCAAsD;AAEtD,sEAA0C;AAC1C,qDAA2D;AAC3D,kFAAwD;AACxD,2DAAiE;AAEjE,gFAA8C;AAC9C,oDAA4B;AAC5B,8EAAoD;AACpD,qCAA2C;AAE3C,0CAAwC;AAExC,0DAAiC;AACjC,kEAAyC;AAEzC,qDAAqE;AAErE,sEAA6C;AAC7C,kFAA8C;AAC9C,gHAAqF;AACrF,iEAKgC;AAChC,4FAAgE;AAChE,mCAAmC;AACnC,kGAA6E;AAC7E,sEAA4C;AAI5C,MAAM,cAAc,GAAoB,MAAM,CAAC,MAAM,CAAC;IACpD,OAAO;IACP,cAAc;IACd,QAAQ;IACR,oBAAoB;IACpB,cAAc;IACd,KAAK;IACL,QAAQ;IACR,QAAQ;IACR,uE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ED,SAAS,oBAAoB,CAAC,IAAY;IACxC,OAAO,CAAC,2BAA2B,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACjD,CAAC;AAED,MAAM,eAAe,GAAG,IAAI,8BAAY,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;AAExD,MAAM,YAAY,GAAG,GAAG,EAAE;IACxB,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC;AAEF,YAAY,CAAC,OAAO,GAAG,GAAG,EAAE;IAC1B,OAAO,eAAe,CAAC;AACzB,CAAC,CAAC","sourcesContent":["import { Memoize } from 'typescript-memoize';\nimport { dirname, join, relative, resolve } from 'path';\nimport { sync as pkgUpSync } from 'pkg-up';\nimport { existsSync, pathExistsSync } from 'fs-extra';\nimport type { Options as FunnelOptions } from 'broccoli-funnel';\nimport buildFunnel from 'broccoli-funnel';\nimport { UnwatchedDir, WatchedDir } from 'broccoli-source';\nimport RewritePackageJSON from './rewrite-package-json';\nimport { todo, unsupported } from '@embroider/core/src/messages';\nimport type { Node } from 'broccoli-node-api';\nimport mergeTrees from 'broccoli-merge-trees';\nimport semver from 'semver';\nimport rewriteAddonTree from './rewrite-addon-tree';\nimport { mergeWithAppend } from './merges';\nimport type { AddonMeta, PackageCache, AddonInstance, AddonTreePath } from '@embroider/core';\nimport { debug } from '@embroider/core';\nimport type Options from './options';\nimport walkSync from 'walk-sync';\nimport ObserveTree from './observe-tree';\nimport type { Options as HTMLBarsOptions } from 'ember-cli-htmlbars';\nimport { isEmbroiderMacrosPlugin } from '@embroider/macros/src/node';\nimport type { TransformOptions, PluginItem } from '@babel/core';\nimport modulesCompat from './modules-compat';\nimport writeFile from 'broccoli-file-creator';\nimport SynthesizeTemplateOnlyComponents from './synthesize-template-only-components';\nimport {\n isEmberAutoImportDynamic,\n isCompactReexports,\n isColocationPlugin,\n isInlinePrecompilePlugin,\n} from './detect-babel-plugins';\nimport HbsToJSBroccoliPlugin from './hbs-to-js-broccoli-plugin';\nimport { fromPairs } from 'lodash';\nimport prepHtmlbarsAstPluginsForUnwrap from './prepare-htmlbars-ast-plugins';\nimport getRealAddon from './get-real-addon';\nimport type { Options as EtcOptions } from 'babel-plugin-ember-template-compilation';\nimport type CompatApp from './compat-app';\n\nconst stockTreeNames: AddonTreePath[] = Object.freeze([\n 'addon',\n 'addon-styles',\n 'styles',\n 'addon-test-support',\n 'test-support',\n 'app',\n 'public',\n 'vendor',\n // 'addon-templates' and 'templates are trees too, but they live inside\n // 'addon' and 'app' and we handle them there.\n]) as AddonTreePath[];\n\nconst dynamicTreeHooks = Object.freeze([\n 'treeFor',\n 'treeForAddon',\n 'treeForAddonTemplates',\n 'treeForAddonTestSupport',\n 'treeForApp',\n 'treeForPublic',\n 'treeForStyles',\n 'treeForTemplates',\n 'treeForTestSupport',\n 'treeForVendor',\n]);\n\nconst defaultMethods = {\n app: 'treeForApp',\n addon: 'treeForAddon',\n 'addon-styles': 'treeForAddonStyles',\n 'addon-templates': 'treeForAddonTemplates',\n 'addon-test-support': 'treeForAddonTestSupport',\n public: 'treeForPublic',\n styles: 'treeForStyles',\n templates: 'treeForTemplates',\n 'test-support': 'treeForTestSupport',\n vendor: 'treeForVendor',\n};\n\nconst appPublicationDir = '_app_';\nconst fastbootPublicationDir = '_fastboot_';\n\n// This controls and types the interface between our new world and the classic\n// v1 addon instance.\nexport default class V1Addon {\n constructor(\n protected addonInstance: AddonInstance,\n protected addonOptions: Required<Options>,\n protected app: CompatApp,\n private packageCache: PackageCache,\n private orderIdx: number\n ) {\n if (addonInstance.registry) {\n this.updateRegistry(addonInstance.registry);\n }\n }\n\n // Optional extensible hook for pruning down the list of redundant addon\n // instances produced by the classic ember-cli architecture. ember-cli\n // instantiates each addon *per consumer*, not per package. So a given package\n // will have many addon instances, and Embroider dutifully produces a V1Addon\n // instance for each one, and then needs to mimic the classic smooshing\n // behavior between them.\n //\n // But some packages (and ember-cli-babel is the motivating example) produce a\n // huge number of instances that do nothing useful and incur significant cost.\n // This hook allows their compat adapter to prune down the set, using\n // addon-specific knowledge of which instance(s) are actually important.\n //\n // The order of the instances is significant. The first one is the one with\n // the highest precedence, meaning its files would win under classic\n // smooshing.\n reduceInstances(instances: V1Addon[]): V1Addon[] {\n // the default beahvior is that all copies matter\n return instances;\n }\n\n // this is only defined when there are custom AST transforms that need it\n @Memoize()\n private get templateCompilerBabelPlugin(): PluginItem | undefined {\n let htmlbars = this.addonInstance.addons.find(a => a.name === 'ember-cli-htmlbars');\n if (htmlbars) {\n let options = (htmlbars as any).htmlbarsOptions() as HTMLBarsOptions;\n if (options?.plugins?.ast) {\n // our macros don't run here in stage1\n options.plugins.ast = options.plugins.ast.filter((p: any) => !isEmbroiderMacrosPlugin(p));\n prepHtmlbarsAstPluginsForUnwrap(this.addonInstance.registry);\n if (options.plugins.ast.length > 0) {\n let opts: EtcOptions = {\n compilerPath: options.templateCompilerPath,\n targetFormat: 'hbs',\n enableLegacyModules: [\n 'ember-cli-htmlbars',\n 'ember-cli-htmlbars-inline-precompile',\n 'htmlbars-inline-precompile',\n ],\n transforms: options.plugins.ast as any,\n };\n return [require.resolve('babel-plugin-ember-template-compilation'), opts];\n }\n }\n }\n }\n\n private updateRegistry(registry: any) {\n // auto-import gets disabled because we support it natively\n registry.remove('js', 'ember-auto-import-analyzer');\n\n // here we're replacing the stock template compiler with our own. Ours\n // doesn't compile all the way to wire format -- it does source-to-source\n // transformation just to process custom AST transforms, while leaving the\n // template as a template. It does turn HBS files into equivalent JS files\n // (because in the general case, AST transforms may need to emit values in\n // Javascript scope), but those JS files will contain HBS strings, not wire\n // format.\n //\n // Even when no AST transforms are registered, we'll still need to register\n // a no-op transform here to avoid an exception coming out of ember-cli like\n // \"Addon templates were detected, but there are no template compilers\n // registered\".\n registry.remove('template', 'ember-cli-htmlbars');\n registry.add('template', {\n name: 'embroider-addon-templates',\n ext: 'hbs',\n _addon: this,\n toTree(this: { _addon: V1Addon }, tree: Node): Node {\n if (this._addon.templateCompilerBabelPlugin) {\n return new HbsToJSBroccoliPlugin(tree);\n } else {\n // when there are no custom AST transforms, we don't need to do\n // anything at all.\n return tree;\n }\n },\n });\n\n // first, look into the babel config and related packages to decide whether\n // we need to run babel at all in this stage.\n let needsCustomBabel = this.needsCustomBabel();\n\n // regardless of the answer, we modify the babel config, because even if\n // we're unregistering ember-cli-babel, some addons manually invoke\n // ember-cli-babel in their custom hooks, and in that case we want to be\n // sure we've taken out the babel plugins that really shouldn't run at this\n // stage.\n this.updateBabelConfig();\n\n if (!needsCustomBabel) {\n // no custom babel behavior, so we don't run the ember-cli-babel\n // preprocessor at all. We still need to register a no-op preprocessor to\n // prevent ember-cli from emitting a deprecation warning.\n registry.remove('js', 'ember-cli-babel');\n registry.add('js', {\n name: 'embroider-babel-noop',\n ext: 'js',\n toTree(tree: Node) {\n return tree;\n },\n });\n }\n }\n\n // we need to run custom inline hbs preprocessing if there are custom hbs\n // plugins and there are inline hbs templates\n private needsInlineHBS(): boolean {\n if (!this.templateCompilerBabelPlugin) {\n // no custom transforms\n return false;\n }\n if (this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-htmlbars-inline-precompile')) {\n // the older inline template compiler is present\n return true;\n }\n\n if (\n this.addonInstance.addons.find(\n (a: any) =>\n a.name === 'ember-cli-htmlbars' && semver.satisfies(semver.coerce(a.pkg.version) || a.pkg.version, '>4.0.0')\n )\n ) {\n // a version of ember-cli-htmlbars that natively supports inline hbs is present\n return true;\n }\n\n return false;\n }\n\n private needsCustomBabel() {\n if (\n this.addonInstance.addons.find(\n (a: any) =>\n a.name === 'ember-cli-typescript' &&\n semver.satisfies(semver.coerce(a.pkg.version) || a.pkg.version, '>=4.0.0-alpha.1')\n )\n ) {\n // This addon is using ember-cli-typescript 4, which relies on\n // ember-cli-babel to add the TypeScript transform Babel plugin.\n return true;\n }\n\n if (\n this.addonInstance.options &&\n this.addonInstance.options['ember-cli-babel'] &&\n this.addonInstance.options['ember-cli-babel'].enableTypeScriptTransform\n ) {\n // This addon has explicitly configured ember-cli-babel to add the\n // TypeScript transform Babel plugin.\n return true;\n }\n\n if ((this.options.babel?.plugins?.filter(babelPluginAllowedInStage1)?.length ?? 0) > 0) {\n // this addon has custom babel plugins, so we need to run them here in\n // stage1\n return true;\n }\n\n // even if there are no custom babel plugins, if we need to do any\n // preprocessing of inline handlebars templates we still need to run the\n // custom babel.\n return this.needsInlineHBS();\n }\n\n get name(): string {\n return this.packageJSON.name;\n }\n\n // you can override this to change the *input* packageJSON that the rest of\n // stage1 will see. If you want to see and change the *output* packageJSON see\n // `newPackageJSON`.\n protected get packageJSON() {\n return this.packageCache.get(this.root).packageJSON;\n }\n\n protected get newPackageJSON() {\n // shallow copy only! This is OK as long as we're only changing top-level\n // keys in this method\n let pkg = Object.assign({}, this.packageJSON);\n let meta: AddonMeta = Object.assign({}, this.packageCache.get(this.root).meta, this.packageMeta);\n pkg['ember-addon'] = meta;\n\n // classic addons don't get to customize their entrypoints like this. We\n // always rewrite them so their entrypoint is index.js, so whatever was here\n // is just misleading to stage3 packagers that might look (rollup does).\n delete pkg.main;\n delete pkg.module;\n delete pkg.exports;\n\n return pkg;\n }\n\n @Memoize()\n get root(): string {\n // addonInstance.root gets modified by a customized \"main\" or\n // \"ember-addon.main\" in package.json. We want the real package root here\n // (the place where package.json lives).\n return dirname(pkgUpSync({ cwd: this.addonInstance.root })!);\n }\n\n @Memoize()\n private get mainModule() {\n // eslint-disable-next-line @typescript-eslint/no-require-imports\n const mod = require((this.addonInstance as unknown as any).constructor._meta_.modulePath);\n\n if (typeof mod === 'function') {\n return mod.prototype;\n } else {\n return mod;\n }\n }\n\n protected get options() {\n if (!this.addonInstance.options) {\n this.addonInstance.options = {};\n return this.addonInstance.options;\n }\n // some addons (like ember-cli-inline-content) assign the *app's* options\n // onto their own this.options. Which means they (accidentally or on\n // purpose), always get the app's babel config, and it means when we try\n // to modify the addon's babel config we're accidentally modifying the\n // app's too.\n //\n // So here we do copying to ensure that we can modify the babel config\n // without altering anybody else. We're not doing cloneDeep because that\n // pulls on our lazy MacrosConfig if it appears in any babel configs here,\n // whereas we want to leave it unevaluated until babel actually uses it.\n let addonOptions =\n typeof this.addonInstance.options == 'function' ? this.addonInstance.options() : this.addonInstance.options;\n let options = Object.assign({}, addonOptions);\n if (options.babel) {\n options.babel = Object.assign({}, options.babel);\n if (options.babel.plugins) {\n options.babel.plugins = options.babel.plugins.slice();\n }\n }\n if (options['ember-cli-babel']) {\n options['ember-cli-babel'] = Object.assign({}, options['ember-cli-babel']);\n }\n\n if (typeof this.addonInstance.options == 'function') {\n this.addonInstance.options = () => options;\n } else {\n this.addonInstance.options = options;\n }\n\n return options;\n }\n\n protected customizes(...treeNames: string[]) {\n // get the real addon as we're going to compare with __proto__\n const realAddon = getRealAddon(this.addonInstance);\n return Boolean(\n treeNames.find(treeName => {\n return (\n // customized hook exists in actual code exported from their index.js\n this.mainModule[treeName] ||\n // addon instance doesn't match its own prototype\n (realAddon.__proto__ && realAddon[treeName] !== realAddon.__proto__[treeName]) ||\n this.customizesHookName(treeName)\n );\n })\n );\n }\n\n private customizesHookName(treeName: string): boolean {\n if (!this.addonInstance.treeForMethods) {\n // weird old addons don't even extend ember-cli's Addon base class and\n // might not have this.\n return false;\n }\n for (let [name, methodName] of Object.entries(defaultMethods)) {\n if (methodName === treeName) {\n return this.addonInstance.treeForMethods[name] !== methodName;\n }\n }\n return false;\n }\n\n @Memoize()\n private hasStockTree(treeName: AddonTreePath): boolean {\n if (this.suppressesTree(treeName)) {\n return false;\n }\n\n // we need to use this.addonInstance.root instead of this.root here because\n // we're looking for the classic location of the stock tree, and that\n // location is influenced by a customized ember-addon.main in package.json,\n // which is reflected in addonInstance.root.\n return (\n this.addonInstance.treePaths && existsSync(join(this.addonInstance.root, this.addonInstance.treePaths[treeName]))\n );\n }\n\n hasAnyTrees(): boolean {\n return Boolean(stockTreeNames.find(name => this.hasStockTree(name))) || this.customizes(...dynamicTreeHooks);\n }\n\n // we keep all these here to ensure that we always apply the same options to\n // the same tree, so that our cache doesn't need to worry about varying\n // options.\n private stockTreeFunnelOptions(treeName: string): FunnelOptions | undefined {\n switch (treeName) {\n case 'addon':\n return {\n exclude: ['styles/**'],\n };\n case 'styles':\n return {\n destDir: '_app_styles_',\n };\n case 'addon-test-support':\n return {\n destDir: 'test-support',\n };\n case 'app':\n return {\n exclude: ['styles/**'],\n destDir: appPublicationDir,\n };\n case 'public':\n return {\n destDir: `public/${this.moduleName}`,\n };\n case 'vendor':\n return {\n destDir: 'vendor',\n };\n }\n }\n\n protected stockTree(treeName: AddonTreePath): Node {\n return this.throughTreeCache(treeName, 'stock', () => {\n // adjust from the legacy \"root\" to our real root, because our rootTree\n // uses our real root but the stock trees are defined in terms of the\n // legacy root\n let srcDir = relative(this.root, join(this.addonInstance.root, this.addonInstance.treePaths[treeName]));\n let opts = Object.assign({ srcDir }, this.stockTreeFunnelOptions(treeName));\n return buildFunnel(this.rootTree, opts);\n })!;\n }\n\n @Memoize()\n protected get rootTree(): Node {\n if (this.packageCache.get(this.root).mayRebuild) {\n return new WatchedDir(this.root);\n } else {\n return new UnwatchedDir(this.root);\n }\n }\n\n @Memoize()\n private get moduleName(): string {\n if (typeof this.addonInstance.moduleName === 'function') {\n return this.addonInstance.moduleName();\n }\n return this.addonInstance.name;\n }\n\n // applies preprocessors to JS and HBS\n private transpile(tree: Node) {\n // Namespace the tree being passed to preprocessJs with the moduleName\n // to mimic classic build\n tree = buildFunnel(tree, { destDir: this.moduleName });\n\n if (this.addonInstance.shouldCompileTemplates() && this.addonInstance.registry.load('template')?.length > 0) {\n tree = this.app.preprocessRegistry.preprocessTemplates(tree, {\n registry: this.addonInstance.registry,\n });\n }\n\n tree = this.addonInstance.preprocessJs(tree, '/', this.moduleName, {\n registry: this.addonInstance.registry,\n });\n\n // Remove namespacing so that it gets written out to the node_modules\n // directory correctly.\n tree = buildFunnel(tree, {\n srcDir: this.moduleName,\n });\n\n return tree;\n }\n\n @Memoize()\n protected updateBabelConfig() {\n let packageOptions = this.options;\n let emberCLIBabelInstance = this.addonInstance.addons.find((a: any) => a.name === 'ember-cli-babel');\n let version;\n\n if (emberCLIBabelInstance) {\n version = emberCLIBabelInstance.pkg.version;\n }\n\n if (!packageOptions['ember-cli-babel']) {\n packageOptions['ember-cli-babel'] = {};\n }\n\n if (!packageOptions.babel) {\n packageOptions.babel = {};\n }\n let babelConfig = packageOptions.babel as TransformOptions;\n\n Object.assign(packageOptions['ember-cli-babel'], {\n compileModules: false,\n disablePresetEnv: true,\n disableDebugTooling: true,\n disableEmberModulesAPIPolyfill: true,\n });\n\n if (version && semver.satisfies(semver.coerce(version) || version, '^5')) {\n unsupported(`${this.name} is using babel 5. Not installing our custom plugin.`);\n return;\n }\n\n if (!babelConfig.plugins) {\n babelConfig.plugins = [];\n } else {\n let hadAutoImport = Boolean(babelConfig.plugins.find(isEmberAutoImportDynamic));\n babelConfig.plugins = babelConfig.plugins.filter(babelPluginAllowedInStage1);\n if (hadAutoImport) {\n // if we removed ember-auto-import's dynamic import() plugin, the code\n // may use import() syntax and we need to re-add it to the parser.\n if (version && semver.satisfies(semver.coerce(version) || version, '^6')) {\n babelConfig.plugins.push(require.resolve('babel-plugin-syntax-dynamic-import'));\n } else {\n babelConfig.plugins.push(require.resolve('@babel/plugin-syntax-dynamic-import'));\n }\n }\n }\n\n if (this.templateCompilerBabelPlugin) {\n babelConfig.plugins.push(this.templateCompilerBabelPlugin);\n }\n }\n\n get v2Tree(): Node {\n return this.throughTreeCache(\n // these are all the kinds of trees that ember-cli's tree cache\n // understands. We need them all here because if *any* of these are\n // uncacheable, we want our whole v2 tree to be treated as uncacheable.\n [\n 'app',\n 'addon',\n 'addon-styles',\n 'addon-templates',\n 'addon-test-support',\n 'public',\n 'styles',\n 'templates',\n 'test-support',\n 'vendor',\n ],\n 'v2Tree',\n () => mergeTrees(this.v2Trees, { overwrite: true })\n );\n }\n\n // this is split out so that compatibility shims can override it to add more\n // things to the package metadata.\n protected get packageMeta(): Partial<AddonMeta> {\n let built = this.build();\n return mergeWithAppend(\n {\n version: 2,\n 'auto-upgraded': true,\n type: 'addon',\n },\n built.staticMeta,\n ...built.dynamicMeta.map(d => d())\n );\n }\n\n @Memoize()\n protected get v2Trees() {\n let { trees } = this.build();\n return trees;\n }\n\n protected throughTreeCache(nameOrNames: string | string[], category: string, fn: () => Node): Node;\n protected throughTreeCache(\n nameOrNames: string | string[],\n category: string,\n fn: () => Node | undefined\n ): Node | undefined {\n let cacheKey: string | undefined;\n if (typeof this.addonInstance.cacheKeyForTree === 'function') {\n let names = Array.isArray(nameOrNames) ? nameOrNames : [nameOrNames];\n cacheKey = names.reduce((accum: string | undefined, name) => {\n if (accum == null) {\n // a previous name was uncacheable, so we're entirely uncacheable\n return undefined;\n }\n let key = this.addonInstance.cacheKeyForTree?.(name);\n if (key) {\n return accum + key;\n } else {\n return undefined;\n }\n }, '');\n if (cacheKey) {\n cacheKey = cacheKey + category;\n let cachedTree = this.app.addonTreeCache.get(cacheKey);\n if (cachedTree) {\n debug('cache hit %s %s %s', this.name, nameOrNames, category);\n return cachedTree;\n }\n }\n }\n debug('cache miss %s %s %s', this.name, nameOrNames, category);\n let tree = fn();\n if (tree && cacheKey) {\n this.app.addonTreeCache.set(cacheKey, tree);\n }\n return tree;\n }\n\n // In general, we can't reliably run addons' custom `treeFor()` methods,\n // because they recurse in a way that we absolutely don't want.\n //\n // But there is a very common use case that we *can* handle opportunisticaly,\n // which is a treeFor() that's used purely to guard whether `_super` will be\n // called or not.\n protected suppressesTree(name: string): boolean {\n if (!this.customizes('treeFor')) {\n return false;\n }\n // get the real addon as we're going to patch and restore `_super`\n const realAddon = getRealAddon(this.addonInstance);\n let origSuper = this.addonInstance._super;\n try {\n realAddon._super = stubbedSuper;\n let result = this.mainModule.treeFor?.call(this.addonInstance, name);\n if (result === markedEmptyTree) {\n // the method returns _super unchanged, so tree is not suppressed and we\n // understand what's going on\n return false;\n }\n if (result == null) {\n // the method nulled out the tree, so we are definitely suppressing\n return true;\n }\n // we can't tell what's really going on, don't suppress and hope for the\n // best\n unsupported(`${this.name} has a custom treeFor() method that is doing some arbitrary broccoli processing.`);\n return false;\n } finally {\n if (realAddon._super === stubbedSuper) {\n realAddon._super = origSuper;\n }\n }\n }\n\n protected invokeOriginalTreeFor(\n name: string,\n { neuterPreprocessors } = { neuterPreprocessors: false }\n ): Node | undefined {\n // @ts-expect-error have no idea why throughTreeCache overload is not working here..\n return this.throughTreeCache(name, 'original', () => {\n // get the real addon as we're going to patch and restore `preprocessJs`\n const realAddon = getRealAddon(this.addonInstance);\n let original;\n try {\n if (neuterPreprocessors) {\n original = realAddon.preprocessJs;\n realAddon.preprocessJs = function (tree: Node) {\n return tree;\n };\n }\n if (this.suppressesTree(name)) {\n return undefined;\n }\n return this.addonInstance._treeFor(name);\n } finally {\n if (neuterPreprocessors) {\n realAddon.preprocessJs = original;\n }\n }\n });\n }\n\n protected treeForAddon(built: IntermediateBuild): Node | undefined {\n // the extra isEngine condition is because ember-engines injects a\n // treeForAddon method into each engine addon that we really don't need or\n // want to run. Unfortunately there's not a more localized place to patch it\n // out, partly because ember-engines also uses a bogus inheritance strategy\n // (instead of providing a prototype that engine addons can extend it\n // patches things into their instance directly).\n if (this.customizes('treeForAddon', 'treeForAddonTemplates') && !this.isEngine()) {\n let tree = this.invokeOriginalTreeFor('addon', { neuterPreprocessors: true });\n if (tree) {\n tree = modulesCompat(tree);\n\n // this captures addons that are trying to escape their own package's\n // namespace\n let result = rewriteAddonTree(this.transpile(tree), this.name, this.moduleName);\n built.dynamicMeta.push(result.getMeta);\n return result.tree;\n }\n } else if (this.hasStockTree('addon')) {\n return this.transpile(this.stockTree('addon'));\n }\n }\n\n protected addonStylesTree(): Node | undefined {\n if (this.customizes('treeForAddonStyles')) {\n let custom = this.invokeOriginalTreeFor('addon-styles');\n if (custom) {\n return this.addonInstance.compileStyles(custom);\n }\n } else if (this.hasStockTree('addon-styles')) {\n return this.addonInstance.compileStyles(this.stockTree('addon-styles'));\n }\n }\n\n protected treeForTestSupport(): Node | undefined {\n if (this.customizes('treeForTestSupport')) {\n todo(`${this.name} has customized the test support tree`);\n } else if (this.hasStockTree('test-support')) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app. For example, imports should be relative to\n // the consuming app, not our own package.\n return buildFunnel(this.stockTree('test-support'), {\n destDir: `${appPublicationDir}/tests`,\n });\n }\n }\n\n private buildTreeForAddon(built: IntermediateBuild) {\n let tree = this.treeForAddon(built);\n if (!tree) {\n return;\n }\n let templateOnlyComponents: Node = new SynthesizeTemplateOnlyComponents(tree, {\n allowedPaths: ['components'],\n\n // if an addon has custom AST transforms, stage1 can rewrite .hbs to\n // .hbs.js\n templateExtensions: ['.hbs', '.hbs.js'],\n });\n if (this.addonOptions.staticAddonTrees) {\n if (this.isEngine()) {\n // even when staticAddonTrees is enabled, engines may have a router map\n // that needs to be dynamically resolved.\n let hasRoutesModule = false;\n\n tree = new ObserveTree(tree, outputDir => {\n hasRoutesModule = existsSync(resolve(outputDir, 'routes.js'));\n });\n built.dynamicMeta.push(() => ({\n 'implicit-modules': hasRoutesModule ? ['./routes.js'] : [],\n }));\n }\n } else {\n let filenames: string[] = [];\n let templateOnlyComponentNames: string[] = [];\n\n tree = new ObserveTree(tree, outputDir => {\n filenames = walkSync(outputDir, { globs: ['**/*.js', '**/*.hbs'] })\n .map(f => `./${f.replace(/\\.js$/i, '')}`)\n .filter(notColocatedTemplate);\n });\n\n templateOnlyComponents = new ObserveTree(templateOnlyComponents, outputDir => {\n templateOnlyComponentNames = walkSync(outputDir, { globs: ['**/*.js'] }).map(\n f => `./${f.replace(/\\.js$/i, '')}`\n );\n });\n\n built.dynamicMeta.push(() => ({\n 'implicit-modules': filenames.concat(templateOnlyComponentNames),\n }));\n }\n built.trees.push(tree);\n built.trees.push(templateOnlyComponents);\n }\n\n private buildAddonStyles(built: IntermediateBuild) {\n let addonStylesTree = this.addonStylesTree();\n if (addonStylesTree) {\n if (this.app.hasCompiledStyles) {\n // >= ember-cli@3.18 store css files in <addon-name/__COMPILED_STYLES__\n // and for embroider to work correctly need to be moved back to `/`\n //\n // speaking with @rwjblue the ember-cli build is now frozen, and it is\n // ok to assume that after the above version no changes will occur\n // makings this work-around safe.\n //\n // additional context: https://github.com/embroider-build/embroider/pull/934/files#r695269976\n addonStylesTree = buildFunnel(addonStylesTree, {\n srcDir: `${this.name}/__COMPILED_STYLES__`,\n destDir: '/',\n allowEmpty: true,\n });\n }\n\n let discoveredFiles: string[] = [];\n let tree = new ObserveTree(addonStylesTree, outputPath => {\n discoveredFiles = walkSync(outputPath, { globs: ['**/*.css'], directories: false });\n });\n built.trees.push(tree);\n built.dynamicMeta.push(() => {\n return {\n 'implicit-styles': discoveredFiles.map(f => `./${f}`),\n };\n });\n }\n }\n\n private buildTreeForStyles(built: IntermediateBuild) {\n let tree;\n if (this.customizes('treeForStyles')) {\n // the user's tree returns their own styles with no \"app/styles\" wrapping\n // around, which is actually what we want\n tree = this.invokeOriginalTreeFor('styles');\n if (tree) {\n tree = buildFunnel(tree, {\n destDir: '_app_styles_',\n getDestinationPath(path) {\n return path.replace(/^app\\/styles\\//, '');\n },\n });\n }\n } else if (this.hasStockTree('styles')) {\n tree = this.stockTree('styles');\n }\n if (tree) {\n built.trees.push(tree);\n }\n }\n\n private buildAddonTestSupport(built: IntermediateBuild) {\n let addonTestSupportTree;\n if (this.customizes('treeForAddonTestSupport')) {\n let original = this.invokeOriginalTreeFor('addon-test-support', { neuterPreprocessors: true });\n if (original) {\n let { tree, getMeta } = rewriteAddonTree(original, this.name, this.moduleName);\n addonTestSupportTree = this.transpile(tree);\n built.dynamicMeta.push(getMeta);\n }\n } else if (this.hasStockTree('addon-test-support')) {\n addonTestSupportTree = this.transpile(this.stockTree('addon-test-support'));\n }\n if (addonTestSupportTree) {\n if (!this.addonOptions.staticAddonTestSupportTrees) {\n let filenames: string[] = [];\n addonTestSupportTree = new ObserveTree(addonTestSupportTree, outputPath => {\n filenames = walkSync(outputPath, { globs: ['**/*.js', '**/*.hbs'] }).map(f => `./${f.replace(/.js$/i, '')}`);\n });\n built.dynamicMeta.push(() => ({\n 'implicit-test-modules': filenames,\n }));\n }\n built.trees.push(addonTestSupportTree);\n }\n }\n\n private maybeSetDirectoryMeta(built: IntermediateBuild, tree: Node, localDir: string, key: keyof AddonMeta): Node {\n let files: AddonMeta['app-js'];\n built.dynamicMeta.push(() => {\n if (files) {\n return { [key]: files };\n } else {\n return {};\n }\n });\n return new ObserveTree(tree, (outputPath: string) => {\n let dir = join(outputPath, localDir);\n if (existsSync(dir)) {\n files = fromPairs(walkSync(dir, { globs: ['**/*.js', '**/*.hbs'] }).map(f => [`./${f}`, `./${localDir}/${f}`]));\n } else {\n files = undefined;\n }\n });\n }\n\n private buildTestSupport(built: IntermediateBuild) {\n let tree = this.treeForTestSupport();\n if (tree) {\n tree = this.maybeSetDirectoryMeta(built, tree, appPublicationDir, 'app-js');\n built.trees.push(tree);\n }\n }\n\n private buildTreeForApp(built: IntermediateBuild) {\n let appTree;\n if (this.customizes('treeForApp', 'treeForTemplates')) {\n let original = this.invokeOriginalTreeFor('app');\n if (original) {\n appTree = buildFunnel(original, {\n destDir: appPublicationDir,\n });\n }\n } else if (this.hasStockTree('app')) {\n appTree = this.stockTree('app');\n }\n\n if (appTree) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app.\n appTree = this.maybeSetDirectoryMeta(built, appTree, appPublicationDir, 'app-js');\n built.trees.push(appTree);\n }\n\n if (\n typeof this.addonInstance.isDevelopingAddon === 'function' &&\n this.addonInstance.isDevelopingAddon() &&\n this.addonInstance.hintingEnabled()\n ) {\n let hintTree = this.addonInstance.jshintAddonTree();\n if (hintTree) {\n hintTree = this.maybeSetDirectoryMeta(\n built,\n buildFunnel(hintTree, { destDir: appPublicationDir }),\n appPublicationDir,\n 'app-js'\n );\n built.trees.push(hintTree);\n }\n }\n }\n\n private buildTreeForFastBoot(built: IntermediateBuild) {\n let tree;\n\n if (this.customizes('treeForFastBoot')) {\n // Arguably, it would be more correct to always create the new Funnel,\n // because the fastboot directory could be created *after* our build starts.\n // But that would result in hundreds of additional trees, even though the\n // vast majority of addons aren't changing and don't have fastboot\n // directories. So I'm pretty comfortable with the optimization. It means\n // that an addon author who creates a brand new fastboot directory in a v1\n // packages will need to restart their build. (Really we hope new addons\n // will be authored in v2 instead soon anyway, and they won't need the\n // concept of \"fastboot directory\" because they can use the macro system to\n // conditionally import some things only in fastboot.)\n if (pathExistsSync(join(this.root, 'fastboot'))) {\n tree = buildFunnel(this.rootTree, { srcDir: 'fastboot' });\n }\n tree = this.addonInstance.treeForFastBoot(tree);\n if (tree) {\n tree = buildFunnel(tree, { destDir: fastbootPublicationDir });\n }\n } else {\n if (pathExistsSync(join(this.root, 'fastboot'))) {\n tree = buildFunnel(this.rootTree, { srcDir: 'fastboot', destDir: fastbootPublicationDir });\n }\n }\n\n if (tree) {\n // this one doesn't go through transpile yet because it gets handled as\n // part of the consuming app.\n tree = this.maybeSetDirectoryMeta(built, tree, fastbootPublicationDir, 'fastboot-js');\n built.trees.push(tree);\n }\n }\n\n private buildPublicTree(built: IntermediateBuild) {\n let publicTree;\n // the extra isEngine condition is here because ember-engines injects a\n // customized treeForPublic into every engine addon. We don't want or need\n // it to run.\n if (this.customizes('treeForPublic') && !this.isEngine()) {\n let original = this.invokeOriginalTreeFor('public');\n if (original) {\n publicTree = buildFunnel(original, {\n destDir: 'public',\n });\n }\n } else if (this.hasStockTree('public')) {\n publicTree = this.stockTree('public');\n }\n if (publicTree) {\n let publicAssets: { [filename: string]: string } = {};\n publicTree = new ObserveTree(publicTree, (outputPath: string) => {\n publicAssets = {};\n for (let filename of walkSync(join(outputPath, 'public'))) {\n if (!filename.endsWith('/')) {\n publicAssets[`./public/${filename}`] = './' + filename;\n }\n }\n });\n built.trees.push(publicTree);\n built.dynamicMeta.push(() => ({ 'public-assets': publicAssets }));\n }\n }\n\n private buildVendorTree(built: IntermediateBuild) {\n if (this.customizes('treeForVendor')) {\n // We don't have any particular opinions about the structure inside\n // vendor, so even when it's customized we can just use the customized\n // one.\n let tree = this.invokeOriginalTreeFor('vendor');\n if (tree) {\n built.trees.push(\n buildFunnel(tree, {\n destDir: 'vendor',\n })\n );\n }\n } else if (this.hasStockTree('vendor')) {\n built.trees.push(this.stockTree('vendor'));\n }\n }\n\n private isEngine() {\n return typeof this.addonInstance.getEngineConfigContents === 'function';\n }\n\n private buildEngineConfig(built: IntermediateBuild) {\n if (!this.isEngine()) {\n return;\n }\n // this addon is an engine, so it needs its own config/environment.js.\n // ember-engines always emits a separate inline (not-meta-tag) config for\n // fastboot, so we mimic that behavior here.\n //\n // getEngineConfigContents is an arbitrary customizable module, so we can't\n // easily rewrite it to live inside our conditional, so it's safer in a\n // separate module.\n built.trees.push(writeFile('config/_environment_browser_.js', this.addonInstance.getEngineConfigContents?.()));\n built.trees.push(\n writeFile(\n 'config/environment.js',\n `\n import { macroCondition, getGlobalConfig, importSync } from '@embroider/macros';\n let config;\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)){\n config = ${JSON.stringify(this.addonInstance.engineConfig?.(this.app.env, {}), null, 2)};\n } else {\n config = importSync('./_environment_browser_.js').default;\n }\n export default config;\n `\n )\n );\n }\n\n private buildPackageJSON(built: IntermediateBuild) {\n built.trees.push(new RewritePackageJSON(this.rootTree, () => this.newPackageJSON));\n }\n\n @Memoize()\n private build(): IntermediateBuild {\n let built = new IntermediateBuild();\n built.staticMeta['order-index'] = this.orderIdx;\n\n if (this.options.lazyLoading === true || (this.options.lazyLoading && this.options.lazyLoading.enabled)) {\n built.staticMeta['lazy-engine'] = true;\n }\n\n if (this.moduleName !== this.name) {\n built.staticMeta['renamed-packages'] = {\n [this.moduleName]: this.name,\n };\n }\n\n this.buildTreeForAddon(built);\n this.buildAddonStyles(built);\n this.buildTreeForStyles(built);\n this.buildAddonTestSupport(built);\n this.buildTestSupport(built);\n this.buildTreeForApp(built);\n this.buildTreeForFastBoot(built);\n this.buildPublicTree(built);\n this.buildVendorTree(built);\n this.buildEngineConfig(built);\n this.buildPackageJSON(built);\n return built;\n }\n}\n\nexport interface V1AddonConstructor {\n new (\n addonInstance: any,\n options: Required<Options>,\n app: CompatApp,\n packageCache: PackageCache,\n orderIdx: number\n ): V1Addon;\n\n shouldApplyAdapter?(addonInstance: any): boolean;\n}\n\nclass IntermediateBuild {\n trees: Node[] = [];\n staticMeta: { [metaField: string]: any } = {};\n dynamicMeta: (() => Partial<AddonMeta>)[] = [];\n}\n\nfunction babelPluginAllowedInStage1(plugin: PluginItem) {\n if (isEmbroiderMacrosPlugin(plugin)) {\n // the point of @embroider/macros is that it's allowed to stay in v2\n // addon publication format, so it doesn't need to run here in stage1.\n // We always run it in stage3.\n return false;\n }\n\n if (isInlinePrecompilePlugin(plugin)) {\n // Similarly, the inline precompile plugin must not run in stage1. We\n // want all templates uncompiled. Instead, we will be adding our own\n // plugin that only runs custom AST transforms inside inline\n // templates.\n return false;\n }\n\n if (isEmberAutoImportDynamic(plugin)) {\n // We replace ember-auto-import's implementation of dynamic import(), so we\n // need to stop its plugin from rewriting those.\n return false;\n }\n\n if (isCompactReexports(plugin)) {\n // We don't want to replace re-exports at this stage, since that will turn\n // an `export` statement into a `define`, which is handled in Stage 3\n return false;\n }\n\n if (isColocationPlugin(plugin)) {\n // template co-location is a first-class feature we support directly, so\n // whether or not the app brought a plugin for it we're going to do it our\n // way.\n return false;\n }\n\n return true;\n}\n\nfunction notColocatedTemplate(path: string) {\n return !/^\\.\\/components\\/.*\\.hbs$/.test(path);\n}\n\nconst markedEmptyTree = new UnwatchedDir(process.cwd());\n\nconst stubbedSuper = () => {\n return markedEmptyTree;\n};\n\nstubbedSuper.treeFor = () => {\n return markedEmptyTree;\n};\n"]}
|