@embroider/compat 3.4.8-unstable.fad2387 → 3.4.9-unstable.ccbf41f
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.9-unstable.ccbf41f",
|
|
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.
|
|
33
|
+
"@embroider/macros": "1.16.1-unstable.ccbf41f",
|
|
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.9-unstable.ccbf41f",
|
|
70
70
|
"@embroider/sample-transforms": "workspace:*",
|
|
71
71
|
"@embroider/test-support": "workspace:*",
|
|
72
72
|
"@glimmer/syntax": "^0.84.3",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"typescript": "^5.1.6"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@embroider/core": "3.4.
|
|
94
|
+
"@embroider/core": "3.4.9-unstable.ccbf41f"
|
|
95
95
|
},
|
|
96
96
|
"engines": {
|
|
97
97
|
"node": "12.* || 14.* || >= 16"
|
|
@@ -37,7 +37,6 @@ export declare class CompatAppBuilder {
|
|
|
37
37
|
private impliedAddonAssets;
|
|
38
38
|
private babelConfig;
|
|
39
39
|
private insertEmberApp;
|
|
40
|
-
private implicitScriptsAsset;
|
|
41
40
|
private findActiveAddons;
|
|
42
41
|
private partitionEngines;
|
|
43
42
|
private get activeFastboot();
|
|
@@ -61,6 +60,7 @@ export declare class CompatAppBuilder {
|
|
|
61
60
|
private addBabelConfig;
|
|
62
61
|
private addResolverConfig;
|
|
63
62
|
private addContentForConfig;
|
|
63
|
+
private addEmberEnvConfig;
|
|
64
64
|
private shouldSplitRoute;
|
|
65
65
|
private splitRoute;
|
|
66
66
|
private topAppJSAsset;
|
|
@@ -270,7 +270,7 @@ class CompatAppBuilder {
|
|
|
270
270
|
get resolvableExtensionsPattern() {
|
|
271
271
|
return (0, core_1.extensionsPattern)(this.resolvableExtensions());
|
|
272
272
|
}
|
|
273
|
-
impliedAssets(type, engine
|
|
273
|
+
impliedAssets(type, engine) {
|
|
274
274
|
let result = this.impliedAddonAssets(type, engine).map((sourcePath) => {
|
|
275
275
|
let stats = (0, fs_extra_1.statSync)(sourcePath);
|
|
276
276
|
return {
|
|
@@ -281,23 +281,6 @@ class CompatAppBuilder {
|
|
|
281
281
|
size: stats.size,
|
|
282
282
|
};
|
|
283
283
|
});
|
|
284
|
-
if (type === 'implicit-scripts') {
|
|
285
|
-
result.unshift({
|
|
286
|
-
kind: 'in-memory',
|
|
287
|
-
relativePath: '_testing_prefix_.js',
|
|
288
|
-
source: `var runningTests=false;`,
|
|
289
|
-
});
|
|
290
|
-
result.unshift({
|
|
291
|
-
kind: 'in-memory',
|
|
292
|
-
relativePath: '_ember_env_.js',
|
|
293
|
-
source: `window.EmberENV={ ...(window.EmberENV || {}), ...${JSON.stringify(emberENV, null, 2)} };`,
|
|
294
|
-
});
|
|
295
|
-
result.push({
|
|
296
|
-
kind: 'in-memory',
|
|
297
|
-
relativePath: '_loader_.js',
|
|
298
|
-
source: `loader.makeDefaultExport=false;`,
|
|
299
|
-
});
|
|
300
|
-
}
|
|
301
284
|
return result;
|
|
302
285
|
}
|
|
303
286
|
impliedAddonAssets(type, { engine }) {
|
|
@@ -390,7 +373,7 @@ class CompatAppBuilder {
|
|
|
390
373
|
addCachablePlugin(portable.config);
|
|
391
374
|
return portable;
|
|
392
375
|
}
|
|
393
|
-
insertEmberApp(asset, appFiles, prepared
|
|
376
|
+
insertEmberApp(asset, appFiles, prepared) {
|
|
394
377
|
let html = asset.html;
|
|
395
378
|
if (this.fastbootConfig) {
|
|
396
379
|
// ignore scripts like ember-cli-livereload.js which are not really associated with
|
|
@@ -414,11 +397,8 @@ class CompatAppBuilder {
|
|
|
414
397
|
}
|
|
415
398
|
}
|
|
416
399
|
html.insertStyleLink(html.styles, `assets/${this.origAppPackage.name}.css`);
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
if (vendorJS) {
|
|
420
|
-
html.insertScriptTag(html.implicitScripts, vendorJS.relativePath);
|
|
421
|
-
}
|
|
400
|
+
// virtual-vendor entrypoint
|
|
401
|
+
html.insertScriptTag(html.implicitScripts, '@embroider/core/vendor.js');
|
|
422
402
|
if (this.fastbootConfig) {
|
|
423
403
|
// any extra fastboot vendor files get inserted into our
|
|
424
404
|
// html.implicitScripts section, after the regular implicit script
|
|
@@ -439,17 +419,6 @@ class CompatAppBuilder {
|
|
|
439
419
|
html.insertScriptTag(html.implicitTestScripts, '@embroider/core/test-support.js');
|
|
440
420
|
html.insertStyleLink(html.implicitTestStyles, '@embroider/core/test-support.css');
|
|
441
421
|
}
|
|
442
|
-
implicitScriptsAsset(prepared, application, emberENV) {
|
|
443
|
-
let asset = prepared.get('assets/vendor.js');
|
|
444
|
-
if (!asset) {
|
|
445
|
-
let implicitScripts = this.impliedAssets('implicit-scripts', application, emberENV);
|
|
446
|
-
if (implicitScripts.length > 0) {
|
|
447
|
-
asset = new ConcatenatedAsset('assets/vendor.js', implicitScripts, this.resolvableExtensionsPattern);
|
|
448
|
-
prepared.set(asset.relativePath, asset);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
return asset;
|
|
452
|
-
}
|
|
453
422
|
// recurse to find all active addons that don't cross an engine boundary.
|
|
454
423
|
// Inner engines themselves will be returned, but not those engines' children.
|
|
455
424
|
// The output set's insertion order is the proper ember-cli compatible
|
|
@@ -568,7 +537,7 @@ class CompatAppBuilder {
|
|
|
568
537
|
return new app_files_1.AppFiles(engine, appSync.files, (_a = fastbootSync === null || fastbootSync === void 0 ? void 0 : fastbootSync.files) !== null && _a !== void 0 ? _a : new Set(), this.resolvableExtensionsPattern, this.podModulePrefix());
|
|
569
538
|
});
|
|
570
539
|
}
|
|
571
|
-
prepareAsset(asset, appFiles, prepared
|
|
540
|
+
prepareAsset(asset, appFiles, prepared) {
|
|
572
541
|
if (asset.kind === 'ember') {
|
|
573
542
|
let prior = this.assets.get(asset.relativePath);
|
|
574
543
|
let parsed;
|
|
@@ -580,17 +549,17 @@ class CompatAppBuilder {
|
|
|
580
549
|
else {
|
|
581
550
|
parsed = new ParsedEmberAsset(asset);
|
|
582
551
|
}
|
|
583
|
-
this.insertEmberApp(parsed, appFiles, prepared
|
|
552
|
+
this.insertEmberApp(parsed, appFiles, prepared);
|
|
584
553
|
prepared.set(asset.relativePath, new BuiltEmberAsset(parsed));
|
|
585
554
|
}
|
|
586
555
|
else {
|
|
587
556
|
prepared.set(asset.relativePath, asset);
|
|
588
557
|
}
|
|
589
558
|
}
|
|
590
|
-
prepareAssets(requestedAssets, appFiles
|
|
559
|
+
prepareAssets(requestedAssets, appFiles) {
|
|
591
560
|
let prepared = new Map();
|
|
592
561
|
for (let asset of requestedAssets) {
|
|
593
|
-
this.prepareAsset(asset, appFiles, prepared
|
|
562
|
+
this.prepareAsset(asset, appFiles, prepared);
|
|
594
563
|
}
|
|
595
564
|
return prepared;
|
|
596
565
|
}
|
|
@@ -656,8 +625,8 @@ class CompatAppBuilder {
|
|
|
656
625
|
}
|
|
657
626
|
await concat.end();
|
|
658
627
|
}
|
|
659
|
-
async updateAssets(requestedAssets, appFiles
|
|
660
|
-
let assets = this.prepareAssets(requestedAssets, appFiles
|
|
628
|
+
async updateAssets(requestedAssets, appFiles) {
|
|
629
|
+
let assets = this.prepareAssets(requestedAssets, appFiles);
|
|
661
630
|
for (let asset of assets.values()) {
|
|
662
631
|
if (this.assetIsValid(asset, this.assets.get(asset.relativePath))) {
|
|
663
632
|
continue;
|
|
@@ -719,9 +688,8 @@ class CompatAppBuilder {
|
|
|
719
688
|
this.firstBuild = false;
|
|
720
689
|
}
|
|
721
690
|
let appFiles = this.updateAppJS(inputPaths.appJS);
|
|
722
|
-
let emberENV = this.configTree.readConfig().EmberENV;
|
|
723
691
|
let assets = this.gatherAssets(inputPaths);
|
|
724
|
-
let finalAssets = await this.updateAssets(assets, appFiles
|
|
692
|
+
let finalAssets = await this.updateAssets(assets, appFiles);
|
|
725
693
|
let assetPaths = assets.map(asset => asset.relativePath);
|
|
726
694
|
if (this.activeFastboot) {
|
|
727
695
|
// when using fastboot, our own package.json needs to be in the output so fastboot can read it.
|
|
@@ -754,6 +722,7 @@ class CompatAppBuilder {
|
|
|
754
722
|
let resolverConfig = this.resolverConfig(appFiles);
|
|
755
723
|
this.addResolverConfig(resolverConfig);
|
|
756
724
|
this.addContentForConfig(this.contentForTree.readContents());
|
|
725
|
+
this.addEmberEnvConfig(this.configTree.readConfig().EmberENV);
|
|
757
726
|
let babelConfig = await this.babelConfig(resolverConfig);
|
|
758
727
|
this.addBabelConfig(babelConfig);
|
|
759
728
|
(0, fs_extra_1.writeFileSync)((0, path_2.join)(this.root, 'macros-config.json'), JSON.stringify(this.compatApp.macrosConfig.babelPluginConfig()[0], null, 2));
|
|
@@ -828,6 +797,11 @@ class CompatAppBuilder {
|
|
|
828
797
|
spaces: 2,
|
|
829
798
|
});
|
|
830
799
|
}
|
|
800
|
+
addEmberEnvConfig(emberEnvConfig) {
|
|
801
|
+
(0, fs_extra_1.outputJSONSync)((0, path_2.join)((0, core_1.locateEmbroiderWorkingDir)(this.compatApp.root), 'ember-env.json'), emberEnvConfig, {
|
|
802
|
+
spaces: 2,
|
|
803
|
+
});
|
|
804
|
+
}
|
|
831
805
|
shouldSplitRoute(routeName) {
|
|
832
806
|
return (!this.options.splitAtRoutes ||
|
|
833
807
|
this.options.splitAtRoutes.find(pattern => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,0CAWyB;AACzB,+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;AAI9B,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,cAAgC,EAChC,WAAoB,EACpB,WAAoB;QARpB,SAAI,GAAJ,IAAI,CAAQ;QACZ,mBAAc,GAAd,cAAc,CAAS;QACvB,4BAAuB,GAAvB,uBAAuB,CAAS;QAChC,YAAO,GAAP,OAAO,CAAmB;QAC1B,cAAS,GAAT,SAAS,CAAW;QACpB,eAAU,GAAV,UAAU,CAAU;QACpB,mBAAc,GAAd,cAAc,CAAkB;QAChC,gBAAW,GAAX,WAAW,CAAS;QACpB,gBAAW,GAAX,WAAW,CAAS;QAZ9B,0DAA0D;QAClD,WAAM,GAA+B,IAAI,GAAG,EAAE,CAAC;QAyvB/C,eAAU,GAAG,IAAI,CAAC;IA7uB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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 { 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 ContentForConfig from './content-for-config';\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 contentForTree: ContentForConfig,\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 // 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 isLazy: appFiles.engine.package.isLazyEngine(),\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 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 async 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([\n require.resolve('babel-plugin-ember-template-compilation'),\n await this.etcOptions(resolverConfig),\n ]);\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.isApp)!;\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 // virtual vendor.css entrypoint\n html.insertStyleLink(html.implicitStyles, '@embroider/core/vendor.css');\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 // virtual test-support.js\n html.insertScriptTag(html.implicitTestScripts, '@embroider/core/test-support.js');\n\n html.insertStyleLink(html.implicitTestStyles, '@embroider/core/test-support.css');\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 // 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(): Engine[] {\n let queue: Engine[] = [\n {\n package: this.appPackageWithMovedDeps,\n addons: new Map(),\n isApp: true,\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 isApp: !current,\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().map(engine => {\n if (engine.isApp) {\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.package.root, 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\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 this.addContentForConfig(this.contentForTree.readContents());\n let babelConfig = await 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 async etcOptions(resolverConfig: CompatResolverOptions): Promise<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 = await 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 addContentForConfig(contentForConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'content-for.json'), contentForConfig, {\n spaces: 2,\n });\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.isApp && 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"]}
|
|
1
|
+
{"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA,0CAWyB;AACzB,+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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,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 { 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 ContentForConfig from './content-for-config';\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 contentForTree: ContentForConfig,\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 // 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 isLazy: appFiles.engine.package.isLazyEngine(),\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(type: keyof ImplicitAssetPaths, engine: AppFiles): (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 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 async 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([\n require.resolve('babel-plugin-ember-template-compilation'),\n await this.etcOptions(resolverConfig),\n ]);\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(asset: ParsedEmberAsset, appFiles: AppFiles[], prepared: Map<string, InternalAsset>) {\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 // virtual-vendor entrypoint\n html.insertScriptTag(html.implicitScripts, '@embroider/core/vendor.js');\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 // virtual vendor.css entrypoint\n html.insertStyleLink(html.implicitStyles, '@embroider/core/vendor.css');\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 // virtual test-support.js\n html.insertScriptTag(html.implicitTestScripts, '@embroider/core/test-support.js');\n\n html.insertStyleLink(html.implicitTestStyles, '@embroider/core/test-support.css');\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(): Engine[] {\n let queue: Engine[] = [\n {\n package: this.appPackageWithMovedDeps,\n addons: new Map(),\n isApp: true,\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 isApp: !current,\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().map(engine => {\n if (engine.isApp) {\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.package.root, 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>) {\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);\n prepared.set(asset.relativePath, new BuiltEmberAsset(parsed));\n } else {\n prepared.set(asset.relativePath, asset);\n }\n }\n\n private prepareAssets(requestedAssets: Asset[], appFiles: AppFiles[]): Map<string, InternalAsset> {\n let prepared: Map<string, InternalAsset> = new Map();\n for (let asset of requestedAssets) {\n this.prepareAsset(asset, appFiles, prepared);\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[]) {\n let assets = this.prepareAssets(requestedAssets, appFiles);\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\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 assets = this.gatherAssets(inputPaths);\n\n let finalAssets = await this.updateAssets(assets, appFiles);\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 this.addContentForConfig(this.contentForTree.readContents());\n this.addEmberEnvConfig(this.configTree.readConfig().EmberENV);\n let babelConfig = await 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 async etcOptions(resolverConfig: CompatResolverOptions): Promise<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 = await 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 addContentForConfig(contentForConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'content-for.json'), contentForConfig, {\n spaces: 2,\n });\n }\n\n private addEmberEnvConfig(emberEnvConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'ember-env.json'), emberEnvConfig, {\n spaces: 2,\n });\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.isApp && 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 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"]}
|