@embroider/compat 3.5.7-unstable.ce8f3cf → 3.5.7-unstable.dce753f
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 +4 -5
- package/src/compat-app-builder.d.ts +2 -21
- package/src/compat-app-builder.js +17 -183
- package/src/compat-app-builder.js.map +1 -1
- package/src/compat-app.d.ts +0 -6
- package/src/compat-app.js +5 -63
- package/src/compat-app.js.map +1 -1
- package/src/http-audit.js +17 -2
- package/src/http-audit.js.map +1 -1
- package/src/options.d.ts +0 -2
- package/src/options.js.map +1 -1
- package/src/standalone-addon-build.js +4 -13
- package/src/standalone-addon-build.js.map +1 -1
- package/src/sync-dir.d.ts +0 -8
- package/src/sync-dir.js +0 -68
- package/src/sync-dir.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@embroider/compat",
|
|
3
|
-
"version": "3.5.7-unstable.
|
|
3
|
+
"version": "3.5.7-unstable.dce753f",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Backward compatibility layer for the Embroider build system.",
|
|
6
6
|
"repository": {
|
|
@@ -45,7 +45,6 @@
|
|
|
45
45
|
"broccoli-source": "^3.0.1",
|
|
46
46
|
"chalk": "^4.1.1",
|
|
47
47
|
"debug": "^4.3.2",
|
|
48
|
-
"escape-string-regexp": "^4.0.0",
|
|
49
48
|
"fast-sourcemap-concat": "^2.1.1",
|
|
50
49
|
"fs-extra": "^9.1.0",
|
|
51
50
|
"fs-tree-diff": "^2.0.1",
|
|
@@ -61,7 +60,7 @@
|
|
|
61
60
|
"typescript-memoize": "^1.0.1",
|
|
62
61
|
"walk-sync": "^3.0.0",
|
|
63
62
|
"yargs": "^17.0.1",
|
|
64
|
-
"@embroider/macros": "1.16.6-unstable.
|
|
63
|
+
"@embroider/macros": "1.16.6-unstable.dce753f"
|
|
65
64
|
},
|
|
66
65
|
"devDependencies": {
|
|
67
66
|
"@glimmer/syntax": "^0.84.3",
|
|
@@ -86,10 +85,10 @@
|
|
|
86
85
|
"typescript": "^5.4.5",
|
|
87
86
|
"@embroider/sample-transforms": "0.0.0",
|
|
88
87
|
"@embroider/test-support": "0.36.0",
|
|
89
|
-
"@embroider/core": "^3.4.15-unstable.
|
|
88
|
+
"@embroider/core": "^3.4.15-unstable.dce753f"
|
|
90
89
|
},
|
|
91
90
|
"peerDependencies": {
|
|
92
|
-
"@embroider/core": "^3.4.15-unstable.
|
|
91
|
+
"@embroider/core": "^3.4.15-unstable.dce753f"
|
|
93
92
|
},
|
|
94
93
|
"engines": {
|
|
95
94
|
"node": "12.* || 14.* || >= 16"
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import type { Node as BroccoliNode } from 'broccoli-node-api';
|
|
2
|
-
import type { OutputPaths } from '@embroider/core';
|
|
3
1
|
import type Options from './options';
|
|
4
2
|
import type ContentForConfig from './content-for-config';
|
|
5
3
|
import type { V1Config } from './v1-config';
|
|
6
4
|
import type { Package } from '@embroider/core';
|
|
7
5
|
import type CompatApp from './compat-app';
|
|
8
6
|
export declare class CompatAppBuilder {
|
|
9
|
-
private root;
|
|
10
7
|
private origAppPackage;
|
|
11
8
|
private appPackageWithMovedDeps;
|
|
12
9
|
private options;
|
|
@@ -15,32 +12,22 @@ export declare class CompatAppBuilder {
|
|
|
15
12
|
private contentForTree;
|
|
16
13
|
private synthVendor;
|
|
17
14
|
private synthStyles;
|
|
18
|
-
constructor(
|
|
19
|
-
private fastbootJSSrcDir;
|
|
15
|
+
constructor(origAppPackage: Package, appPackageWithMovedDeps: Package, options: Required<Options>, compatApp: CompatApp, configTree: V1Config, contentForTree: ContentForConfig, synthVendor: Package, synthStyles: Package);
|
|
20
16
|
private activeAddonChildren;
|
|
21
17
|
private get allActiveAddons();
|
|
22
18
|
private isActiveAddon;
|
|
23
19
|
private orderAddons;
|
|
24
20
|
private resolvableExtensions;
|
|
25
|
-
private addEmberEntrypoints;
|
|
26
21
|
private modulePrefix;
|
|
27
22
|
private podModulePrefix;
|
|
28
|
-
private rootURL;
|
|
29
23
|
private activeRules;
|
|
30
24
|
private resolverConfig;
|
|
31
|
-
private get resolvableExtensionsPattern();
|
|
32
25
|
private babelConfig;
|
|
33
26
|
private findActiveAddons;
|
|
34
27
|
private partitionEngines;
|
|
35
|
-
private get activeFastboot();
|
|
36
28
|
private emberVersion;
|
|
37
|
-
private get fastbootConfig();
|
|
38
29
|
private engines;
|
|
39
|
-
|
|
40
|
-
private get staticAppPathsPattern();
|
|
41
|
-
private firstBuild;
|
|
42
|
-
build(inputPaths: OutputPaths<TreeNames>): Promise<void>;
|
|
43
|
-
private combinePackageJSON;
|
|
30
|
+
build(): Promise<void>;
|
|
44
31
|
private etcOptions;
|
|
45
32
|
private get portableHints();
|
|
46
33
|
private addBabelConfig;
|
|
@@ -50,9 +37,3 @@ export declare class CompatAppBuilder {
|
|
|
50
37
|
private addMacrosConfig;
|
|
51
38
|
private outputAppBootError;
|
|
52
39
|
}
|
|
53
|
-
interface TreeNames {
|
|
54
|
-
appJS: BroccoliNode;
|
|
55
|
-
publicTree: BroccoliNode | undefined;
|
|
56
|
-
configTree: BroccoliNode;
|
|
57
|
-
}
|
|
58
|
-
export {};
|
|
@@ -14,25 +14,20 @@ const core_1 = require("@embroider/core");
|
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
const dependency_rules_1 = require("./dependency-rules");
|
|
16
16
|
const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
17
|
-
const mergeWith_1 = __importDefault(require("lodash/mergeWith"));
|
|
18
17
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
19
18
|
const bind_decorator_1 = __importDefault(require("bind-decorator"));
|
|
20
19
|
const fs_extra_1 = require("fs-extra");
|
|
21
20
|
const portable_babel_config_1 = require("@embroider/core/src/portable-babel-config");
|
|
22
|
-
const app_files_1 = require("@embroider/core/src/app-files");
|
|
23
21
|
const portable_1 = require("@embroider/core/src/portable");
|
|
24
22
|
const typescript_memoize_1 = require("typescript-memoize");
|
|
25
23
|
const path_2 = require("path");
|
|
26
24
|
const resolve_1 = __importDefault(require("resolve"));
|
|
27
25
|
const fs_extra_2 = require("fs-extra");
|
|
28
26
|
const node_1 = require("@embroider/macros/src/node");
|
|
29
|
-
const escape_string_regexp_1 = __importDefault(require("escape-string-regexp"));
|
|
30
|
-
const sync_dir_1 = require("./sync-dir");
|
|
31
27
|
// This exists during the actual broccoli build step. As opposed to CompatApp,
|
|
32
28
|
// which also exists during pipeline-construction time.
|
|
33
29
|
class CompatAppBuilder {
|
|
34
|
-
constructor(
|
|
35
|
-
this.root = root;
|
|
30
|
+
constructor(origAppPackage, appPackageWithMovedDeps, options, compatApp, configTree, contentForTree, synthVendor, synthStyles) {
|
|
36
31
|
this.origAppPackage = origAppPackage;
|
|
37
32
|
this.appPackageWithMovedDeps = appPackageWithMovedDeps;
|
|
38
33
|
this.options = options;
|
|
@@ -41,13 +36,6 @@ class CompatAppBuilder {
|
|
|
41
36
|
this.contentForTree = contentForTree;
|
|
42
37
|
this.synthVendor = synthVendor;
|
|
43
38
|
this.synthStyles = synthStyles;
|
|
44
|
-
this.firstBuild = true;
|
|
45
|
-
}
|
|
46
|
-
fastbootJSSrcDir() {
|
|
47
|
-
let target = (0, path_2.join)(this.compatApp.root, 'fastboot');
|
|
48
|
-
if ((0, fs_extra_2.pathExistsSync)(target)) {
|
|
49
|
-
return target;
|
|
50
|
-
}
|
|
51
39
|
}
|
|
52
40
|
activeAddonChildren(pkg) {
|
|
53
41
|
let result = pkg.dependencies.filter(this.isActiveAddon).filter(
|
|
@@ -99,27 +87,15 @@ class CompatAppBuilder {
|
|
|
99
87
|
// ember-cli-typescript
|
|
100
88
|
return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js', '.gjs', '.gts'];
|
|
101
89
|
}
|
|
102
|
-
addEmberEntrypoints() {
|
|
103
|
-
let classicEntrypoints = ['index.html'];
|
|
104
|
-
for (let entrypoint of classicEntrypoints) {
|
|
105
|
-
let sourcePath = (0, path_2.join)(this.compatApp.root, entrypoint);
|
|
106
|
-
let rewrittenAppPath = (0, path_2.join)(this.root, entrypoint);
|
|
107
|
-
(0, fs_extra_1.writeFileSync)(rewrittenAppPath, (0, fs_extra_1.readFileSync)(sourcePath));
|
|
108
|
-
}
|
|
109
|
-
return classicEntrypoints;
|
|
110
|
-
}
|
|
111
90
|
modulePrefix() {
|
|
112
91
|
return this.configTree.readConfig().modulePrefix;
|
|
113
92
|
}
|
|
114
93
|
podModulePrefix() {
|
|
115
94
|
return this.configTree.readConfig().podModulePrefix;
|
|
116
95
|
}
|
|
117
|
-
rootURL() {
|
|
118
|
-
return this.configTree.readConfig().rootURL;
|
|
119
|
-
}
|
|
120
96
|
activeRules() {
|
|
121
97
|
return (0, dependency_rules_1.activePackageRules)(this.options.packageRules.concat(defaultAddonPackageRules()), [
|
|
122
|
-
{ name: this.origAppPackage.name, version: this.origAppPackage.version, root: this.root },
|
|
98
|
+
{ name: this.origAppPackage.name, version: this.origAppPackage.version, root: this.origAppPackage.root },
|
|
123
99
|
...this.allActiveAddons.filter(p => p.meta['auto-upgraded']),
|
|
124
100
|
]);
|
|
125
101
|
}
|
|
@@ -138,13 +114,12 @@ class CompatAppBuilder {
|
|
|
138
114
|
renamePackages,
|
|
139
115
|
resolvableExtensions: this.resolvableExtensions(),
|
|
140
116
|
appRoot: this.origAppPackage.root,
|
|
141
|
-
engines: engines.map(
|
|
142
|
-
packageName:
|
|
143
|
-
// first engine is the app, which has been relocated to this.root
|
|
117
|
+
engines: engines.map(engine => ({
|
|
118
|
+
packageName: engine.package.name,
|
|
144
119
|
// we need to use the real path here because webpack requests always use the real path i.e. follow symlinks
|
|
145
|
-
root: (0, fs_extra_1.realpathSync)(
|
|
146
|
-
fastbootFiles:
|
|
147
|
-
activeAddons: [...
|
|
120
|
+
root: (0, fs_extra_1.realpathSync)(engine.package.root),
|
|
121
|
+
fastbootFiles: {},
|
|
122
|
+
activeAddons: [...engine.addons]
|
|
148
123
|
.map(([addon, canResolveFromFile]) => ({
|
|
149
124
|
name: addon.name,
|
|
150
125
|
root: addon.root,
|
|
@@ -154,7 +129,7 @@ class CompatAppBuilder {
|
|
|
154
129
|
// that the last one wins. Our resolver's order is the order to
|
|
155
130
|
// search, so first one wins.
|
|
156
131
|
.reverse(),
|
|
157
|
-
isLazy:
|
|
132
|
+
isLazy: engine.package.isLazyEngine(),
|
|
158
133
|
})),
|
|
159
134
|
amdCompatibility: this.options.amdCompatibility,
|
|
160
135
|
// this is the additional stufff that @embroider/compat adds on top to do
|
|
@@ -169,9 +144,6 @@ class CompatAppBuilder {
|
|
|
169
144
|
};
|
|
170
145
|
return config;
|
|
171
146
|
}
|
|
172
|
-
get resolvableExtensionsPattern() {
|
|
173
|
-
return (0, core_1.extensionsPattern)(this.resolvableExtensions());
|
|
174
|
-
}
|
|
175
147
|
async babelConfig(resolverConfig) {
|
|
176
148
|
let babel = (0, cloneDeep_1.default)(this.compatApp.babelConfig());
|
|
177
149
|
if (!babel.plugins) {
|
|
@@ -233,7 +205,7 @@ class CompatAppBuilder {
|
|
|
233
205
|
require.resolve('@babel/plugin-transform-runtime'),
|
|
234
206
|
{ absoluteRuntime: __dirname, useESModules: true, regenerator: false },
|
|
235
207
|
]);
|
|
236
|
-
const portable = (0, portable_babel_config_1.makePortable)(babel, { basedir: this.root }, this.portableHints);
|
|
208
|
+
const portable = (0, portable_babel_config_1.makePortable)(babel, { basedir: this.origAppPackage.root }, this.portableHints);
|
|
237
209
|
addCachablePlugin(portable.config);
|
|
238
210
|
return portable;
|
|
239
211
|
}
|
|
@@ -246,16 +218,7 @@ class CompatAppBuilder {
|
|
|
246
218
|
if (!child.isEngine()) {
|
|
247
219
|
this.findActiveAddons(child, engine, true);
|
|
248
220
|
}
|
|
249
|
-
let canResolveFrom;
|
|
250
|
-
if (pkg === this.appPackageWithMovedDeps) {
|
|
251
|
-
// we want canResolveFrom to always be a rewritten package path, and our
|
|
252
|
-
// app's package is not rewritten yet here.
|
|
253
|
-
canResolveFrom = (0, path_1.resolve)(this.root, 'package.json');
|
|
254
|
-
}
|
|
255
|
-
else {
|
|
256
|
-
// whereas our addons are already moved
|
|
257
|
-
canResolveFrom = (0, path_1.resolve)(pkg.root, 'package.json');
|
|
258
|
-
}
|
|
221
|
+
let canResolveFrom = (0, path_1.resolve)(pkg.root, 'package.json');
|
|
259
222
|
engine.addons.set(child, canResolveFrom);
|
|
260
223
|
}
|
|
261
224
|
// ensure addons are applied in the correct order, if set (via @embroider/compat/v1-addon)
|
|
@@ -291,7 +254,7 @@ class CompatAppBuilder {
|
|
|
291
254
|
addons: new Map(),
|
|
292
255
|
isApp: !current,
|
|
293
256
|
modulePrefix: addon.name,
|
|
294
|
-
appRelativePath: (0, core_1.explicitRelative)(this.root, addon.root),
|
|
257
|
+
appRelativePath: (0, core_1.explicitRelative)(this.origAppPackage.root, addon.root),
|
|
295
258
|
});
|
|
296
259
|
}
|
|
297
260
|
}
|
|
@@ -299,9 +262,6 @@ class CompatAppBuilder {
|
|
|
299
262
|
}
|
|
300
263
|
return done;
|
|
301
264
|
}
|
|
302
|
-
get activeFastboot() {
|
|
303
|
-
return this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-cli-fastboot');
|
|
304
|
-
}
|
|
305
265
|
emberVersion() {
|
|
306
266
|
let pkg = this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-source');
|
|
307
267
|
if (!pkg) {
|
|
@@ -309,82 +269,14 @@ class CompatAppBuilder {
|
|
|
309
269
|
}
|
|
310
270
|
return pkg.version;
|
|
311
271
|
}
|
|
312
|
-
|
|
313
|
-
if (this.activeFastboot) {
|
|
314
|
-
// this is relying on work done in stage1 by @embroider/compat/src/compat-adapters/ember-cli-fastboot.ts
|
|
315
|
-
let packageJSON = (0, fs_extra_1.readJSONSync)((0, path_2.join)(this.activeFastboot.root, '_fastboot_', 'package.json'));
|
|
316
|
-
let { extraAppFiles, extraVendorFiles } = packageJSON['embroider-fastboot'];
|
|
317
|
-
delete packageJSON['embroider-fastboot'];
|
|
318
|
-
extraVendorFiles.push('assets/embroider_macros_fastboot_init.js');
|
|
319
|
-
return { packageJSON, extraAppFiles, extraVendorFiles };
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
updateAppJS(appJSPath) {
|
|
323
|
-
var _a;
|
|
324
|
-
if (!this.engines) {
|
|
325
|
-
this.engines = this.partitionEngines().map(engine => {
|
|
326
|
-
if (engine.isApp) {
|
|
327
|
-
// this is the app. We have more to do for the app than for other
|
|
328
|
-
// engines.
|
|
329
|
-
let fastbootSync;
|
|
330
|
-
if (this.activeFastboot) {
|
|
331
|
-
let fastbootDir = this.fastbootJSSrcDir();
|
|
332
|
-
if (fastbootDir) {
|
|
333
|
-
fastbootSync = new sync_dir_1.SyncDir(fastbootDir, (0, path_1.resolve)(this.root, '_fastboot_'));
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
return {
|
|
337
|
-
engine,
|
|
338
|
-
appSync: new sync_dir_1.SyncDir(appJSPath, this.root),
|
|
339
|
-
fastbootSync,
|
|
340
|
-
};
|
|
341
|
-
}
|
|
342
|
-
else {
|
|
343
|
-
// this is not the app, so it's some other engine. Engines are already
|
|
344
|
-
// built by stage1 like all other addons, so we only need to observe
|
|
345
|
-
// their files, not doing any actual copying or building.
|
|
346
|
-
return {
|
|
347
|
-
engine,
|
|
348
|
-
appSync: new sync_dir_1.SyncDir(engine.package.root, undefined),
|
|
349
|
-
// AFAIK, we've never supported a fastboot overlay directory in an
|
|
350
|
-
// engine. But if we do need that, it would go here.
|
|
351
|
-
fastbootSync: undefined,
|
|
352
|
-
};
|
|
353
|
-
}
|
|
354
|
-
});
|
|
355
|
-
}
|
|
356
|
-
for (let engine of this.engines) {
|
|
357
|
-
engine.appSync.update();
|
|
358
|
-
(_a = engine.fastbootSync) === null || _a === void 0 ? void 0 : _a.update();
|
|
359
|
-
}
|
|
360
|
-
return this.engines.map(({ engine, appSync, fastbootSync }) => {
|
|
361
|
-
var _a;
|
|
362
|
-
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.staticAppPathsPattern, this.podModulePrefix());
|
|
363
|
-
});
|
|
364
|
-
}
|
|
365
|
-
get staticAppPathsPattern() {
|
|
366
|
-
if (this.options.staticAppPaths.length > 0) {
|
|
367
|
-
return new RegExp('^(?:' + this.options.staticAppPaths.map(staticAppPath => (0, escape_string_regexp_1.default)(staticAppPath)).join('|') + ')(?:$|/)');
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
async build(inputPaths) {
|
|
272
|
+
async build() {
|
|
371
273
|
// on the first build, we lock down the macros config. on subsequent builds,
|
|
372
274
|
// this doesn't do anything anyway because it's idempotent.
|
|
373
275
|
this.compatApp.macrosConfig.finalize();
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
(0, fs_extra_1.rmSync)(this.root, { recursive: true, force: true });
|
|
377
|
-
this.firstBuild = false;
|
|
378
|
-
}
|
|
379
|
-
let appFiles = this.updateAppJS(inputPaths.appJS);
|
|
380
|
-
let assetPaths = this.addEmberEntrypoints();
|
|
381
|
-
if (this.activeFastboot) {
|
|
382
|
-
// when using fastboot, our own package.json needs to be in the output so fastboot can read it.
|
|
383
|
-
assetPaths.push('package.json');
|
|
276
|
+
if (!this.engines) {
|
|
277
|
+
this.engines = this.partitionEngines();
|
|
384
278
|
}
|
|
385
|
-
let
|
|
386
|
-
(0, fs_extra_1.writeFileSync)((0, path_2.join)(this.root, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');
|
|
387
|
-
let resolverConfig = this.resolverConfig(appFiles);
|
|
279
|
+
let resolverConfig = this.resolverConfig(this.engines);
|
|
388
280
|
let config = this.configTree.readConfig();
|
|
389
281
|
let contentForConfig = this.contentForTree.readContents();
|
|
390
282
|
this.addResolverConfig(resolverConfig);
|
|
@@ -395,39 +287,6 @@ class CompatAppBuilder {
|
|
|
395
287
|
this.addBabelConfig(babelConfig);
|
|
396
288
|
this.addMacrosConfig(this.compatApp.macrosConfig.babelPluginConfig()[0]);
|
|
397
289
|
}
|
|
398
|
-
combinePackageJSON(assetPaths) {
|
|
399
|
-
var _a, _b;
|
|
400
|
-
let pkgLayers = [this.origAppPackage.packageJSON];
|
|
401
|
-
let fastbootConfig = this.fastbootConfig;
|
|
402
|
-
if (fastbootConfig) {
|
|
403
|
-
// fastboot-specific package.json output is allowed to add to our original package.json
|
|
404
|
-
pkgLayers.push(fastbootConfig.packageJSON);
|
|
405
|
-
}
|
|
406
|
-
let meta = {
|
|
407
|
-
type: 'app',
|
|
408
|
-
version: 2,
|
|
409
|
-
assets: assetPaths,
|
|
410
|
-
babel: {
|
|
411
|
-
filename: '_babel_config_.js',
|
|
412
|
-
isParallelSafe: true, // TODO
|
|
413
|
-
majorVersion: this.compatApp.babelMajorVersion(),
|
|
414
|
-
fileFilter: '_babel_filter_.js',
|
|
415
|
-
},
|
|
416
|
-
'root-url': this.rootURL(),
|
|
417
|
-
};
|
|
418
|
-
if (((_b = (_a = this.origAppPackage.packageJSON['ember-addon']) === null || _a === void 0 ? void 0 : _a.version) !== null && _b !== void 0 ? _b : 0) < 2) {
|
|
419
|
-
meta['auto-upgraded'] = true;
|
|
420
|
-
// our rewriting keeps app in app directory, etc.
|
|
421
|
-
pkgLayers.push({
|
|
422
|
-
exports: {
|
|
423
|
-
'./*': './app/*',
|
|
424
|
-
'./tests/*': './tests/*',
|
|
425
|
-
},
|
|
426
|
-
});
|
|
427
|
-
}
|
|
428
|
-
pkgLayers.push({ 'ember-addon': meta });
|
|
429
|
-
return combinePackageJSON(...pkgLayers);
|
|
430
|
-
}
|
|
431
290
|
async etcOptions(resolverConfig) {
|
|
432
291
|
let transforms = this.compatApp.htmlbarsPlugins;
|
|
433
292
|
let { plugins: macroPlugins, setConfig } = node_1.MacrosConfig.transforms();
|
|
@@ -446,9 +305,9 @@ class CompatAppBuilder {
|
|
|
446
305
|
transforms.push([require.resolve('./resolver-transform'), opts]);
|
|
447
306
|
}
|
|
448
307
|
let resolver = new core_1.Resolver(resolverConfig);
|
|
449
|
-
let resolution = await resolver.nodeResolve('ember-source/vendor/ember/ember-template-compiler', (0, path_1.resolve)(this.root, 'package.json'));
|
|
308
|
+
let resolution = await resolver.nodeResolve('ember-source/vendor/ember/ember-template-compiler', (0, path_1.resolve)(this.origAppPackage.root, 'package.json'));
|
|
450
309
|
if (resolution.type !== 'real') {
|
|
451
|
-
throw new Error(`bug: unable to resolve ember-template-compiler from ${this.root}`);
|
|
310
|
+
throw new Error(`bug: unable to resolve ember-template-compiler from ${this.origAppPackage.root}`);
|
|
452
311
|
}
|
|
453
312
|
return {
|
|
454
313
|
transforms,
|
|
@@ -552,9 +411,6 @@ class CompatAppBuilder {
|
|
|
552
411
|
}
|
|
553
412
|
}
|
|
554
413
|
exports.CompatAppBuilder = CompatAppBuilder;
|
|
555
|
-
__decorate([
|
|
556
|
-
(0, typescript_memoize_1.Memoize)()
|
|
557
|
-
], CompatAppBuilder.prototype, "fastbootJSSrcDir", null);
|
|
558
414
|
__decorate([
|
|
559
415
|
(0, typescript_memoize_1.Memoize)()
|
|
560
416
|
], CompatAppBuilder.prototype, "allActiveAddons", null);
|
|
@@ -567,21 +423,9 @@ __decorate([
|
|
|
567
423
|
__decorate([
|
|
568
424
|
(0, typescript_memoize_1.Memoize)()
|
|
569
425
|
], CompatAppBuilder.prototype, "activeRules", null);
|
|
570
|
-
__decorate([
|
|
571
|
-
(0, typescript_memoize_1.Memoize)()
|
|
572
|
-
], CompatAppBuilder.prototype, "resolvableExtensionsPattern", null);
|
|
573
426
|
__decorate([
|
|
574
427
|
(0, typescript_memoize_1.Memoize)()
|
|
575
428
|
], CompatAppBuilder.prototype, "babelConfig", null);
|
|
576
|
-
__decorate([
|
|
577
|
-
(0, typescript_memoize_1.Memoize)()
|
|
578
|
-
], CompatAppBuilder.prototype, "activeFastboot", null);
|
|
579
|
-
__decorate([
|
|
580
|
-
(0, typescript_memoize_1.Memoize)()
|
|
581
|
-
], CompatAppBuilder.prototype, "fastbootConfig", null);
|
|
582
|
-
__decorate([
|
|
583
|
-
(0, typescript_memoize_1.Memoize)()
|
|
584
|
-
], CompatAppBuilder.prototype, "staticAppPathsPattern", null);
|
|
585
429
|
__decorate([
|
|
586
430
|
(0, typescript_memoize_1.Memoize)()
|
|
587
431
|
], CompatAppBuilder.prototype, "portableHints", null);
|
|
@@ -600,16 +444,6 @@ const babelFilterTemplate = (0, core_1.jsHandlebarsCompile)(`
|
|
|
600
444
|
const { babelFilter } = require(${JSON.stringify(require.resolve('@embroider/core'))});
|
|
601
445
|
module.exports = babelFilter({{json-stringify skipBabel}}, "{{js-string-escape appRoot}}");
|
|
602
446
|
`);
|
|
603
|
-
function combinePackageJSON(...layers) {
|
|
604
|
-
function custom(objValue, srcValue, key, _object, _source, stack) {
|
|
605
|
-
if (key === 'keywords' && stack.size === 0) {
|
|
606
|
-
if (Array.isArray(objValue)) {
|
|
607
|
-
return objValue.concat(srcValue);
|
|
608
|
-
}
|
|
609
|
-
}
|
|
610
|
-
}
|
|
611
|
-
return (0, mergeWith_1.default)({}, ...layers, custom);
|
|
612
|
-
}
|
|
613
447
|
function addCachablePlugin(babelConfig) {
|
|
614
448
|
if (Array.isArray(babelConfig.plugins) && babelConfig.plugins.length > 0) {
|
|
615
449
|
const plugins = Object.create(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,0CAUyB;AACzB,+BAA8C;AAI9C,yDAAwD;AACxD,6DAAqC;AACrC,iEAAyC;AACzC,iEAAyC;AACzC,oEAAkC;AAClC,uCAA2G;AAI3G,qFAAyE;AACzE,6DAAyD;AAEzD,2DAAsE;AACtE,2DAA6C;AAC7C,+BAAqC;A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utputPaths, AddonPackage, Engine, AppMeta, TemplateColocationPluginOptions } from '@embroider/core';\nimport {\n explicitRelative,\n extensionsPattern,\n warn,\n jsHandlebarsCompile,\n templateColocationPluginPath,\n cacheBustingPluginVersion,\n cacheBustingPluginPath,\n Resolver,\n locateEmbroiderWorkingDir,\n} from '@embroider/core';\nimport { resolve as resolvePath } from 'path';\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 mergeWith from 'lodash/mergeWith';\nimport cloneDeep from 'lodash/cloneDeep';\nimport bind from 'bind-decorator';\nimport { outputJSONSync, readFileSync, readJSONSync, rmSync, 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 { makePortable } from '@embroider/core/src/portable-babel-config';\nimport { AppFiles } from '@embroider/core/src/app-files';\nimport type { PortableHint } from '@embroider/core/src/portable';\nimport { maybeNodeModuleVersion } from '@embroider/core/src/portable';\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 { Package, PackageInfo } from '@embroider/core';\nimport { readdirSync, pathExistsSync } from 'fs-extra';\nimport type { TransformOptions } from '@babel/core';\nimport { MacrosConfig } from '@embroider/macros/src/node';\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 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 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 addEmberEntrypoints(): string[] {\n let classicEntrypoints = ['index.html'];\n for (let entrypoint of classicEntrypoints) {\n let sourcePath = join(this.compatApp.root, entrypoint);\n let rewrittenAppPath = join(this.root, entrypoint);\n writeFileSync(rewrittenAppPath, readFileSync(sourcePath));\n }\n return classicEntrypoints;\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 splitAtRoutes: this.options.splitAtRoutes,\n podModulePrefix: this.podModulePrefix(),\n activePackageRules: this.activeRules(),\n options,\n autoRun: this.compatApp.autoRun,\n staticAppPaths: this.options.staticAppPaths,\n };\n\n return config;\n }\n\n @Memoize()\n private get resolvableExtensionsPattern(): RegExp {\n return extensionsPattern(this.resolvableExtensions());\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 // 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 private emberVersion() {\n let pkg = this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-source');\n if (!pkg) {\n throw new Error('no ember version!');\n }\n return pkg.version;\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.staticAppPathsPattern,\n this.podModulePrefix()\n )\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 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 assetPaths = this.addEmberEntrypoints();\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 let pkg = this.combinePackageJSON(assetPaths);\n writeFileSync(join(this.root, 'package.json'), JSON.stringify(pkg, null, 2), 'utf8');\n\n let resolverConfig = this.resolverConfig(appFiles);\n let config = this.configTree.readConfig();\n let contentForConfig = this.contentForTree.readContents();\n\n this.addResolverConfig(resolverConfig);\n this.addContentForConfig(contentForConfig);\n this.addEmberEnvConfig(config.EmberENV);\n this.outputAppBootError(config.modulePrefix, config.APP, contentForConfig);\n let babelConfig = await this.babelConfig(resolverConfig);\n this.addBabelConfig(babelConfig);\n this.addMacrosConfig(this.compatApp.macrosConfig.babelPluginConfig()[0]);\n }\n\n private combinePackageJSON(assetPaths: string[]): 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\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 if ((this.origAppPackage.packageJSON['ember-addon']?.version ?? 0) < 2) {\n meta['auto-upgraded'] = true;\n // our rewriting keeps app in app directory, etc.\n pkgLayers.push({\n exports: {\n './*': './app/*',\n './tests/*': './tests/*',\n },\n });\n }\n\n pkgLayers.push({ 'ember-addon': meta });\n\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 emberVersion: this.emberVersion(),\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(locateEmbroiderWorkingDir(this.compatApp.root), '_babel_config_.js'),\n `module.exports = ${JSON.stringify(pconfig.config, null, 2)}`,\n 'utf8'\n );\n writeFileSync(\n join(locateEmbroiderWorkingDir(this.compatApp.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 // In addition to outputting content-for.json, we also want to check if content-for 'config-module' has a custom content.\n // If so, it means some classic addons used to provide this custom content, which is no longer supported.\n // Developers can deactivate this check (and the subsequent warning) with useAddonConfigModule\n if (this.compatApp.options.useAddonConfigModule) {\n let modulePrefix = this.configTree.readConfig().modulePrefix;\n\n // This is the default script provided by https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L84\n // When storeConfigInMeta is true, this content is always present in the config-module key of content-for.json\n const defaultConfigModule =\n `var prefix = '${modulePrefix}';\\ntry {\\n var metaName = prefix + '/config/environment';\\n var rawConfig = document.querySelector('meta[name=\\\"' + metaName + '\\\"]').getAttribute('content');\\n var config = JSON.parse(decodeURIComponent(rawConfig));\\n\\n var exports = { 'default': config };\\n\\n Object.defineProperty(exports, '__esModule', { value: true });\\n\\n return exports;\\n}\\ncatch(err) {\\n throw new Error('Could not read config from meta tag with name \\\"' + metaName + '\\\".');\\n}\\n`.replace(\n /\\s/g,\n ''\n );\n\n const configModule = contentForConfig['/index.html']['config-module'];\n const diff = configModule.replace(/\\s/g, '').replace(defaultConfigModule, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'config-module'. This is no longer supported.\n With Embroider, you have full control over the config module, so classic addons no longer need to modify it under the hood.\n The following code is included via content-for 'config-module':\n\n ${configModule}\n\n 1. If you want to keep the same behavior, add it to the app/environment.js.\n 2. Once app/environment.js has the content you need, remove the present error by setting \"useAddonConfigModule\" to false in the build options.\n `);\n }\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 addMacrosConfig(macrosConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'macros-config.json'), macrosConfig, {\n spaces: 2,\n });\n }\n\n // Classic addons providing custom content-for \"app-boot\" is no longer supported.\n // The purpose of this error message is to help developers to move the classic addons code.\n // Developers can deactivate it with useAddonAppBoot build option.\n private outputAppBootError(modulePrefix: string, appConfig: any, contentForConfig: any) {\n if (!this.compatApp.options.useAddonAppBoot) {\n return;\n }\n\n // This is the default script provided by\n // https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L103\n const defaultAppBoot = `\n if (!runningTests) {\n require(\"${modulePrefix}/app\")[\"default\"].create(${JSON.stringify(appConfig || {})});\n }\n `.replace(/\\s/g, '');\n\n const appBoot = contentForConfig['/index.html']['app-boot'];\n const diff = appBoot.replace(/\\s/g, '').replace(defaultAppBoot, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'app-boot'. This is no longer supported.\n With Embroider, you have full control over the app-boot script, so classic addons no longer need to modify it under the hood.\n The following code is used for your app boot:\n\n ${appBoot}\n\n 1. If you want to keep the same behavior, copy and paste it to the app-boot script included in app/index.html.\n 2. Once app/index.html has the content you need, remove the present error by setting \"useAddonAppBoot\" to false in the build options.\n `);\n }\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 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\ninterface TreeNames {\n appJS: BroccoliNode;\n publicTree: BroccoliNode | undefined;\n configTree: BroccoliNode;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"compat-app-builder.js","sourceRoot":"","sources":["compat-app-builder.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,0CASyB;AACzB,+BAA8C;AAI9C,yDAAwD;AACxD,6DAAqC;AACrC,iEAAyC;AACzC,oEAAkC;AAClC,uCAAuE;AAIvE,qFAAyE;AAEzE,2DAAsE;AACtE,2DAA6C;AAC7C,+BAAqC;AACrC,sDAA8B;AAI9B,uCAAuC;AAEvC,qDAA0D;AAI1D,8EAA8E;AAC9E,uDAAuD;AAEvD,MAAa,gBAAgB;IAC3B,YACU,cAAuB,EACvB,uBAAgC,EAChC,OAA0B,EAC1B,SAAoB,EACpB,UAAoB,EACpB,cAAgC,EAChC,WAAoB,EACpB,WAAoB;QAPpB,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;IAC3B,CAAC;IAEI,mBAAmB,CAAC,GAAY;QACtC,IAAI,MAAM,GAAI,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,IAA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AK,MAAM,MAAM,IAAI,WAAW,CAAC,OAAO,EAAE,CAAC;YACzC,IAAI,oBAA4B,CAAC;YACjC,IAAI,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,OAAO,MAAM,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC3D,oBAAoB,GAAG,MAAM,CAAC,CAAC,CAAW,CAAC;YAC7C,CAAC;iBAAM,IAAI,OAAO,MAAM,KAAK,QAAQ,EAAE,CAAC;gBACtC,oBAAoB,GAAG,MAAM,CAAC;YAChC,CAAC;iBAAM,CAAC;gBACN,MAAM,IAAI,KAAK,CAAC,iEAAiE,MAAM,EAAE,CAAC,CAAC;YAC7F,CAAC;YAED,OAAO,CAAC,oBAAoB,CAAC,GAAG,IAAA,iCAAsB,EAAC,oBAAoB,CAAC,CAAC;QAC/E,CAAC;QAED,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;YACvB,6BAAsB;YACtB;gBACE,OAAO;aACR;SACF,CAAC,CAAC;IACL,CAAC;AACH,CAAC","sourcesContent":["import type { AddonPackage, Engine, TemplateColocationPluginOptions } from '@embroider/core';\nimport {\n explicitRelative,\n warn,\n jsHandlebarsCompile,\n templateColocationPluginPath,\n cacheBustingPluginVersion,\n cacheBustingPluginPath,\n Resolver,\n locateEmbroiderWorkingDir,\n} from '@embroider/core';\nimport { resolve as resolvePath } from 'path';\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 cloneDeep from 'lodash/cloneDeep';\nimport bind from 'bind-decorator';\nimport { outputJSONSync, 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 { makePortable } from '@embroider/core/src/portable-babel-config';\nimport type { PortableHint } from '@embroider/core/src/portable';\nimport { maybeNodeModuleVersion } from '@embroider/core/src/portable';\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 { Package } from '@embroider/core';\nimport { readdirSync } from 'fs-extra';\nimport type { TransformOptions } from '@babel/core';\nimport { MacrosConfig } from '@embroider/macros/src/node';\n\nimport type CompatApp from './compat-app';\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 constructor(\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 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 modulePrefix(): string {\n return this.configTree.readConfig().modulePrefix;\n }\n\n private podModulePrefix(): string | undefined {\n return this.configTree.readConfig().podModulePrefix;\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.origAppPackage.root },\n ...this.allActiveAddons.filter(p => p.meta['auto-upgraded']),\n ]);\n }\n\n private resolverConfig(engines: Engine[]): 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(engine => ({\n packageName: engine.package.name,\n // we need to use the real path here because webpack requests always use the real path i.e. follow symlinks\n root: realpathSync(engine.package.root),\n fastbootFiles: {},\n activeAddons: [...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: 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 splitAtRoutes: this.options.splitAtRoutes,\n podModulePrefix: this.podModulePrefix(),\n activePackageRules: this.activeRules(),\n options,\n autoRun: this.compatApp.autoRun,\n staticAppPaths: this.options.staticAppPaths,\n };\n\n return config;\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.origAppPackage.root }, this.portableHints);\n addCachablePlugin(portable.config);\n return portable;\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 = resolvePath(pkg.root, 'package.json');\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.origAppPackage.root, addon.root),\n });\n }\n }\n done.push(current);\n }\n return done;\n }\n\n private emberVersion() {\n let pkg = this.activeAddonChildren(this.appPackageWithMovedDeps).find(a => a.name === 'ember-source');\n if (!pkg) {\n throw new Error('no ember version!');\n }\n return pkg.version;\n }\n\n private engines: Engine[] | undefined;\n\n async build() {\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 if (!this.engines) {\n this.engines = this.partitionEngines();\n }\n\n let resolverConfig = this.resolverConfig(this.engines);\n let config = this.configTree.readConfig();\n let contentForConfig = this.contentForTree.readContents();\n\n this.addResolverConfig(resolverConfig);\n this.addContentForConfig(contentForConfig);\n this.addEmberEnvConfig(config.EmberENV);\n this.outputAppBootError(config.modulePrefix, config.APP, contentForConfig);\n let babelConfig = await this.babelConfig(resolverConfig);\n this.addBabelConfig(babelConfig);\n this.addMacrosConfig(this.compatApp.macrosConfig.babelPluginConfig()[0]);\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 emberVersion: this.emberVersion(),\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.origAppPackage.root, 'package.json')\n );\n if (resolution.type !== 'real') {\n throw new Error(`bug: unable to resolve ember-template-compiler from ${this.origAppPackage.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(locateEmbroiderWorkingDir(this.compatApp.root), '_babel_config_.js'),\n `module.exports = ${JSON.stringify(pconfig.config, null, 2)}`,\n 'utf8'\n );\n writeFileSync(\n join(locateEmbroiderWorkingDir(this.compatApp.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 // In addition to outputting content-for.json, we also want to check if content-for 'config-module' has a custom content.\n // If so, it means some classic addons used to provide this custom content, which is no longer supported.\n // Developers can deactivate this check (and the subsequent warning) with useAddonConfigModule\n if (this.compatApp.options.useAddonConfigModule) {\n let modulePrefix = this.configTree.readConfig().modulePrefix;\n\n // This is the default script provided by https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L84\n // When storeConfigInMeta is true, this content is always present in the config-module key of content-for.json\n const defaultConfigModule =\n `var prefix = '${modulePrefix}';\\ntry {\\n var metaName = prefix + '/config/environment';\\n var rawConfig = document.querySelector('meta[name=\\\"' + metaName + '\\\"]').getAttribute('content');\\n var config = JSON.parse(decodeURIComponent(rawConfig));\\n\\n var exports = { 'default': config };\\n\\n Object.defineProperty(exports, '__esModule', { value: true });\\n\\n return exports;\\n}\\ncatch(err) {\\n throw new Error('Could not read config from meta tag with name \\\"' + metaName + '\\\".');\\n}\\n`.replace(\n /\\s/g,\n ''\n );\n\n const configModule = contentForConfig['/index.html']['config-module'];\n const diff = configModule.replace(/\\s/g, '').replace(defaultConfigModule, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'config-module'. This is no longer supported.\n With Embroider, you have full control over the config module, so classic addons no longer need to modify it under the hood.\n The following code is included via content-for 'config-module':\n\n ${configModule}\n\n 1. If you want to keep the same behavior, add it to the app/environment.js.\n 2. Once app/environment.js has the content you need, remove the present error by setting \"useAddonConfigModule\" to false in the build options.\n `);\n }\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 addMacrosConfig(macrosConfig: any) {\n outputJSONSync(join(locateEmbroiderWorkingDir(this.compatApp.root), 'macros-config.json'), macrosConfig, {\n spaces: 2,\n });\n }\n\n // Classic addons providing custom content-for \"app-boot\" is no longer supported.\n // The purpose of this error message is to help developers to move the classic addons code.\n // Developers can deactivate it with useAddonAppBoot build option.\n private outputAppBootError(modulePrefix: string, appConfig: any, contentForConfig: any) {\n if (!this.compatApp.options.useAddonAppBoot) {\n return;\n }\n\n // This is the default script provided by\n // https://github.com/ember-cli/ember-cli/blob/master/lib/utilities/ember-app-utils.js#L103\n const defaultAppBoot = `\n if (!runningTests) {\n require(\"${modulePrefix}/app\")[\"default\"].create(${JSON.stringify(appConfig || {})});\n }\n `.replace(/\\s/g, '');\n\n const appBoot = contentForConfig['/index.html']['app-boot'];\n const diff = appBoot.replace(/\\s/g, '').replace(defaultAppBoot, '');\n\n if (diff.length) {\n throw new Error(`\n Your app uses at least one classic addon that provides content-for 'app-boot'. This is no longer supported.\n With Embroider, you have full control over the app-boot script, so classic addons no longer need to modify it under the hood.\n The following code is used for your app boot:\n\n ${appBoot}\n\n 1. If you want to keep the same behavior, copy and paste it to the app-boot script included in app/index.html.\n 2. Once app/index.html has the content you need, remove the present error by setting \"useAddonAppBoot\" to false in the build options.\n `);\n }\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 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 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"]}
|