@embroider/compat 3.5.1-unstable.bdf4aae → 3.5.1-unstable.ccbb0a6
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 -4
- package/src/compat-app-builder.d.ts +3 -26
- package/src/compat-app-builder.js +21 -719
- package/src/compat-app-builder.js.map +1 -1
- package/src/compat-app.d.ts +0 -7
- package/src/compat-app.js +22 -41
- package/src/compat-app.js.map +1 -1
- package/src/http-audit.js +4 -1
- package/src/http-audit.js.map +1 -1
|
@@ -1,33 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
2
|
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
19
3
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
20
4
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
21
5
|
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
22
6
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
23
7
|
};
|
|
24
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
25
|
-
if (mod && mod.__esModule) return mod;
|
|
26
|
-
var result = {};
|
|
27
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
28
|
-
__setModuleDefault(result, mod);
|
|
29
|
-
return result;
|
|
30
|
-
};
|
|
31
8
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
32
9
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
33
10
|
};
|
|
@@ -37,25 +14,18 @@ const core_1 = require("@embroider/core");
|
|
|
37
14
|
const path_1 = require("path");
|
|
38
15
|
const dependency_rules_1 = require("./dependency-rules");
|
|
39
16
|
const flatMap_1 = __importDefault(require("lodash/flatMap"));
|
|
40
|
-
const sortBy_1 = __importDefault(require("lodash/sortBy"));
|
|
41
|
-
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
42
|
-
const partition_1 = __importDefault(require("lodash/partition"));
|
|
43
17
|
const mergeWith_1 = __importDefault(require("lodash/mergeWith"));
|
|
44
18
|
const cloneDeep_1 = __importDefault(require("lodash/cloneDeep"));
|
|
45
|
-
const resolve_1 = require("resolve");
|
|
46
19
|
const bind_decorator_1 = __importDefault(require("bind-decorator"));
|
|
47
20
|
const fs_extra_1 = require("fs-extra");
|
|
48
|
-
const ember_html_1 = require("@embroider/core/src/ember-html");
|
|
49
21
|
const portable_babel_config_1 = require("@embroider/core/src/portable-babel-config");
|
|
50
22
|
const app_files_1 = require("@embroider/core/src/app-files");
|
|
51
23
|
const portable_1 = require("@embroider/core/src/portable");
|
|
52
|
-
const assert_never_1 = __importDefault(require("assert-never"));
|
|
53
24
|
const typescript_memoize_1 = require("typescript-memoize");
|
|
54
25
|
const path_2 = require("path");
|
|
55
|
-
const
|
|
26
|
+
const resolve_1 = __importDefault(require("resolve"));
|
|
56
27
|
const fs_extra_2 = require("fs-extra");
|
|
57
28
|
const node_1 = require("@embroider/macros/src/node");
|
|
58
|
-
const fast_sourcemap_concat_1 = __importDefault(require("fast-sourcemap-concat"));
|
|
59
29
|
const escape_string_regexp_1 = __importDefault(require("escape-string-regexp"));
|
|
60
30
|
const sync_dir_1 = require("./sync-dir");
|
|
61
31
|
// This exists during the actual broccoli build step. As opposed to CompatApp,
|
|
@@ -71,8 +41,6 @@ class CompatAppBuilder {
|
|
|
71
41
|
this.contentForTree = contentForTree;
|
|
72
42
|
this.synthVendor = synthVendor;
|
|
73
43
|
this.synthStyles = synthStyles;
|
|
74
|
-
// for each relativePath, an Asset we have already emitted
|
|
75
|
-
this.assets = new Map();
|
|
76
44
|
this.firstBuild = true;
|
|
77
45
|
}
|
|
78
46
|
fastbootJSSrcDir() {
|
|
@@ -81,38 +49,6 @@ class CompatAppBuilder {
|
|
|
81
49
|
return target;
|
|
82
50
|
}
|
|
83
51
|
}
|
|
84
|
-
extractAssets(treePaths) {
|
|
85
|
-
let assets = [];
|
|
86
|
-
// ember-cli traditionally outputs a dummy testem.js file to prevent
|
|
87
|
-
// spurious errors when running tests under "ember s".
|
|
88
|
-
if (this.compatApp.shouldBuildTests) {
|
|
89
|
-
let testemAsset = this.findTestemAsset();
|
|
90
|
-
if (testemAsset) {
|
|
91
|
-
assets.push(testemAsset);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
for (let asset of this.emberEntrypoints(treePaths.htmlTree)) {
|
|
95
|
-
assets.push(asset);
|
|
96
|
-
}
|
|
97
|
-
return assets;
|
|
98
|
-
}
|
|
99
|
-
findTestemAsset() {
|
|
100
|
-
let sourcePath;
|
|
101
|
-
try {
|
|
102
|
-
sourcePath = (0, resolve_1.sync)('ember-cli/lib/broccoli/testem.js', { basedir: this.root });
|
|
103
|
-
}
|
|
104
|
-
catch (err) { }
|
|
105
|
-
if (sourcePath) {
|
|
106
|
-
let stat = (0, fs_extra_1.statSync)(sourcePath);
|
|
107
|
-
return {
|
|
108
|
-
kind: 'on-disk',
|
|
109
|
-
relativePath: 'testem.js',
|
|
110
|
-
sourcePath,
|
|
111
|
-
mtime: stat.mtime.getTime(),
|
|
112
|
-
size: stat.size,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
52
|
activeAddonChildren(pkg) {
|
|
117
53
|
let result = pkg.dependencies.filter(this.isActiveAddon).filter(
|
|
118
54
|
// When looking for child addons, we want to ignore 'peerDependencies' of
|
|
@@ -163,40 +99,17 @@ class CompatAppBuilder {
|
|
|
163
99
|
// ember-cli-typescript
|
|
164
100
|
return ['.wasm', '.mjs', '.js', '.json', '.ts', '.hbs', '.hbs.js', '.gjs', '.gts'];
|
|
165
101
|
}
|
|
166
|
-
|
|
167
|
-
let classicEntrypoints = [
|
|
168
|
-
{ entrypoint: 'index.html', includeTests: false },
|
|
169
|
-
{ entrypoint: 'tests/index.html', includeTests: true },
|
|
170
|
-
];
|
|
102
|
+
addEmberEntrypoints(htmlTreePath) {
|
|
103
|
+
let classicEntrypoints = ['index.html', 'tests/index.html'];
|
|
171
104
|
if (!this.compatApp.shouldBuildTests) {
|
|
172
105
|
classicEntrypoints.pop();
|
|
173
106
|
}
|
|
174
|
-
for (let
|
|
107
|
+
for (let entrypoint of classicEntrypoints) {
|
|
175
108
|
let sourcePath = (0, path_2.join)(htmlTreePath, entrypoint);
|
|
176
|
-
let
|
|
177
|
-
|
|
178
|
-
kind: 'ember',
|
|
179
|
-
relativePath: entrypoint,
|
|
180
|
-
includeTests,
|
|
181
|
-
sourcePath,
|
|
182
|
-
mtime: stats.mtime.getTime(),
|
|
183
|
-
size: stats.size,
|
|
184
|
-
rootURL: this.rootURL(),
|
|
185
|
-
prepare: (dom) => {
|
|
186
|
-
let scripts = [...dom.window.document.querySelectorAll('script')];
|
|
187
|
-
let styles = [...dom.window.document.querySelectorAll('link[rel*="stylesheet"]')];
|
|
188
|
-
return {
|
|
189
|
-
javascript: this.compatApp.findAppScript(scripts, entrypoint),
|
|
190
|
-
styles: this.compatApp.findAppStyles(styles, entrypoint),
|
|
191
|
-
implicitScripts: this.compatApp.findVendorScript(scripts, entrypoint),
|
|
192
|
-
implicitStyles: this.compatApp.findVendorStyles(styles, entrypoint),
|
|
193
|
-
testJavascript: this.compatApp.findTestScript(scripts),
|
|
194
|
-
implicitTestStyles: this.compatApp.findTestSupportStyles(styles),
|
|
195
|
-
};
|
|
196
|
-
},
|
|
197
|
-
};
|
|
198
|
-
yield asset;
|
|
109
|
+
let rewrittenAppPath = (0, path_2.join)(this.root, entrypoint);
|
|
110
|
+
(0, fs_extra_1.writeFileSync)(rewrittenAppPath, (0, fs_extra_1.readFileSync)(sourcePath));
|
|
199
111
|
}
|
|
112
|
+
return classicEntrypoints;
|
|
200
113
|
}
|
|
201
114
|
modulePrefix() {
|
|
202
115
|
return this.configTree.readConfig().modulePrefix;
|
|
@@ -250,63 +163,18 @@ class CompatAppBuilder {
|
|
|
250
163
|
// this is the additional stufff that @embroider/compat adds on top to do
|
|
251
164
|
// global template resolving
|
|
252
165
|
modulePrefix: this.modulePrefix(),
|
|
166
|
+
splitAtRoutes: this.options.splitAtRoutes,
|
|
253
167
|
podModulePrefix: this.podModulePrefix(),
|
|
254
168
|
activePackageRules: this.activeRules(),
|
|
255
169
|
options,
|
|
170
|
+
autoRun: this.compatApp.autoRun,
|
|
171
|
+
staticAppPaths: this.options.staticAppPaths,
|
|
256
172
|
};
|
|
257
173
|
return config;
|
|
258
174
|
}
|
|
259
|
-
scriptPriority(pkg) {
|
|
260
|
-
switch (pkg.name) {
|
|
261
|
-
case 'loader.js':
|
|
262
|
-
return 0;
|
|
263
|
-
case 'ember-source':
|
|
264
|
-
return 10;
|
|
265
|
-
default:
|
|
266
|
-
return 1000;
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
175
|
get resolvableExtensionsPattern() {
|
|
270
176
|
return (0, core_1.extensionsPattern)(this.resolvableExtensions());
|
|
271
177
|
}
|
|
272
|
-
impliedAssets(type, engine) {
|
|
273
|
-
let result = this.impliedAddonAssets(type, engine).map((sourcePath) => {
|
|
274
|
-
let stats = (0, fs_extra_1.statSync)(sourcePath);
|
|
275
|
-
return {
|
|
276
|
-
kind: 'on-disk',
|
|
277
|
-
relativePath: (0, core_1.explicitRelative)(this.root, sourcePath),
|
|
278
|
-
sourcePath,
|
|
279
|
-
mtime: stats.mtimeMs,
|
|
280
|
-
size: stats.size,
|
|
281
|
-
};
|
|
282
|
-
});
|
|
283
|
-
return result;
|
|
284
|
-
}
|
|
285
|
-
impliedAddonAssets(type, { engine }) {
|
|
286
|
-
let result = [];
|
|
287
|
-
for (let addon of (0, sortBy_1.default)(Array.from(engine.addons.keys()), this.scriptPriority.bind(this))) {
|
|
288
|
-
let implicitScripts = addon.meta[type];
|
|
289
|
-
if (implicitScripts) {
|
|
290
|
-
let styles = [];
|
|
291
|
-
let options = { basedir: addon.root };
|
|
292
|
-
for (let mod of implicitScripts) {
|
|
293
|
-
if (type === 'implicit-styles') {
|
|
294
|
-
// exclude engines because they will handle their own css importation
|
|
295
|
-
if (!addon.isLazyEngine()) {
|
|
296
|
-
styles.push(resolve_2.default.sync(mod, options));
|
|
297
|
-
}
|
|
298
|
-
}
|
|
299
|
-
else {
|
|
300
|
-
result.push(resolve_2.default.sync(mod, options));
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
if (styles.length) {
|
|
304
|
-
result = [...styles, ...result];
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
return result;
|
|
309
|
-
}
|
|
310
178
|
async babelConfig(resolverConfig) {
|
|
311
179
|
let babel = (0, cloneDeep_1.default)(this.compatApp.babelConfig());
|
|
312
180
|
if (!babel.plugins) {
|
|
@@ -372,48 +240,6 @@ class CompatAppBuilder {
|
|
|
372
240
|
addCachablePlugin(portable.config);
|
|
373
241
|
return portable;
|
|
374
242
|
}
|
|
375
|
-
insertEmberApp(asset, appFiles, prepared) {
|
|
376
|
-
let html = asset.html;
|
|
377
|
-
if (this.fastbootConfig) {
|
|
378
|
-
// ignore scripts like ember-cli-livereload.js which are not really associated with
|
|
379
|
-
// "the app".
|
|
380
|
-
let ignoreScripts = html.dom.window.document.querySelectorAll('script');
|
|
381
|
-
ignoreScripts.forEach(script => {
|
|
382
|
-
script.setAttribute('data-fastboot-ignore', '');
|
|
383
|
-
});
|
|
384
|
-
}
|
|
385
|
-
// our tests entrypoint already includes a correct module dependency on the
|
|
386
|
-
// app, so we only insert the app when we're not inserting tests
|
|
387
|
-
if (!asset.fileAsset.includeTests) {
|
|
388
|
-
let appJS = this.topAppJSAsset(appFiles, prepared);
|
|
389
|
-
html.insertScriptTag(html.javascript, appJS.relativePath, { type: 'module' });
|
|
390
|
-
}
|
|
391
|
-
if (this.fastbootConfig) {
|
|
392
|
-
// any extra fastboot app files get inserted into our html.javascript
|
|
393
|
-
// section, after the app has been inserted.
|
|
394
|
-
for (let script of this.fastbootConfig.extraAppFiles) {
|
|
395
|
-
html.insertScriptTag(html.javascript, script, { tag: 'fastboot-script' });
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
html.insertStyleLink(html.styles, `assets/${this.origAppPackage.name}.css`);
|
|
399
|
-
if (this.fastbootConfig) {
|
|
400
|
-
// any extra fastboot vendor files get inserted into our
|
|
401
|
-
// html.implicitScripts section, after the regular implicit script
|
|
402
|
-
// (vendor.js) have been inserted.
|
|
403
|
-
for (let script of this.fastbootConfig.extraVendorFiles) {
|
|
404
|
-
html.insertScriptTag(html.implicitScripts, script, { tag: 'fastboot-script' });
|
|
405
|
-
}
|
|
406
|
-
}
|
|
407
|
-
// virtual vendor.css entrypoint
|
|
408
|
-
html.insertStyleLink(html.implicitStyles, '@embroider/core/vendor.css');
|
|
409
|
-
if (!asset.fileAsset.includeTests) {
|
|
410
|
-
return;
|
|
411
|
-
}
|
|
412
|
-
// Test-related assets happen below this point
|
|
413
|
-
let testJS = this.testJSEntrypoint(appFiles, prepared);
|
|
414
|
-
html.insertScriptTag(html.testJavascript, testJS.relativePath, { type: 'module' });
|
|
415
|
-
html.insertStyleLink(html.implicitTestStyles, '@embroider/core/test-support.css');
|
|
416
|
-
}
|
|
417
243
|
// recurse to find all active addons that don't cross an engine boundary.
|
|
418
244
|
// Inner engines themselves will be returned, but not those engines' children.
|
|
419
245
|
// The output set's insertion order is the proper ember-cli compatible
|
|
@@ -529,149 +355,13 @@ class CompatAppBuilder {
|
|
|
529
355
|
}
|
|
530
356
|
return this.engines.map(({ engine, appSync, fastbootSync }) => {
|
|
531
357
|
var _a;
|
|
532
|
-
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());
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
prepareAsset(asset, appFiles, prepared) {
|
|
536
|
-
if (asset.kind === 'ember') {
|
|
537
|
-
let prior = this.assets.get(asset.relativePath);
|
|
538
|
-
let parsed;
|
|
539
|
-
if (prior && prior.kind === 'built-ember' && prior.parsedAsset.validFor(asset)) {
|
|
540
|
-
// we can reuse the parsed html
|
|
541
|
-
parsed = prior.parsedAsset;
|
|
542
|
-
parsed.html.clear();
|
|
543
|
-
}
|
|
544
|
-
else {
|
|
545
|
-
parsed = new ParsedEmberAsset(asset);
|
|
546
|
-
}
|
|
547
|
-
this.insertEmberApp(parsed, appFiles, prepared);
|
|
548
|
-
prepared.set(asset.relativePath, new BuiltEmberAsset(parsed));
|
|
549
|
-
}
|
|
550
|
-
else {
|
|
551
|
-
prepared.set(asset.relativePath, asset);
|
|
552
|
-
}
|
|
553
|
-
}
|
|
554
|
-
prepareAssets(requestedAssets, appFiles) {
|
|
555
|
-
let prepared = new Map();
|
|
556
|
-
for (let asset of requestedAssets) {
|
|
557
|
-
this.prepareAsset(asset, appFiles, prepared);
|
|
558
|
-
}
|
|
559
|
-
return prepared;
|
|
560
|
-
}
|
|
561
|
-
assetIsValid(asset, prior) {
|
|
562
|
-
if (!prior) {
|
|
563
|
-
return false;
|
|
564
|
-
}
|
|
565
|
-
switch (asset.kind) {
|
|
566
|
-
case 'on-disk':
|
|
567
|
-
return prior.kind === 'on-disk' && prior.size === asset.size && prior.mtime === asset.mtime;
|
|
568
|
-
case 'in-memory':
|
|
569
|
-
return prior.kind === 'in-memory' && stringOrBufferEqual(prior.source, asset.source);
|
|
570
|
-
case 'built-ember':
|
|
571
|
-
return prior.kind === 'built-ember' && prior.source === asset.source;
|
|
572
|
-
case 'concatenated-asset':
|
|
573
|
-
return (prior.kind === 'concatenated-asset' &&
|
|
574
|
-
prior.sources.length === asset.sources.length &&
|
|
575
|
-
prior.sources.every((priorFile, index) => {
|
|
576
|
-
let newFile = asset.sources[index];
|
|
577
|
-
return this.assetIsValid(newFile, priorFile);
|
|
578
|
-
}));
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
updateOnDiskAsset(asset) {
|
|
582
|
-
let destination = (0, path_2.join)(this.root, asset.relativePath);
|
|
583
|
-
(0, fs_extra_2.ensureDirSync)((0, path_2.dirname)(destination));
|
|
584
|
-
(0, fs_extra_2.copySync)(asset.sourcePath, destination, { dereference: true });
|
|
585
|
-
}
|
|
586
|
-
updateInMemoryAsset(asset) {
|
|
587
|
-
let destination = (0, path_2.join)(this.root, asset.relativePath);
|
|
588
|
-
(0, fs_extra_2.ensureDirSync)((0, path_2.dirname)(destination));
|
|
589
|
-
(0, fs_extra_1.writeFileSync)(destination, asset.source, 'utf8');
|
|
590
|
-
}
|
|
591
|
-
updateBuiltEmberAsset(asset) {
|
|
592
|
-
let destination = (0, path_2.join)(this.root, asset.relativePath);
|
|
593
|
-
(0, fs_extra_2.ensureDirSync)((0, path_2.dirname)(destination));
|
|
594
|
-
(0, fs_extra_1.writeFileSync)(destination, asset.source, 'utf8');
|
|
595
|
-
}
|
|
596
|
-
async updateConcatenatedAsset(asset) {
|
|
597
|
-
let concat = new fast_sourcemap_concat_1.default({
|
|
598
|
-
outputFile: (0, path_2.join)(this.root, asset.relativePath),
|
|
599
|
-
mapCommentType: asset.relativePath.endsWith('.js') ? 'line' : 'block',
|
|
600
|
-
baseDir: this.root,
|
|
358
|
+
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());
|
|
601
359
|
});
|
|
602
|
-
if (process.env.EMBROIDER_CONCAT_STATS) {
|
|
603
|
-
let MeasureConcat = (await Promise.resolve().then(() => __importStar(require('@embroider/core/src/measure-concat')))).default;
|
|
604
|
-
concat = new MeasureConcat(asset.relativePath, concat, this.root);
|
|
605
|
-
}
|
|
606
|
-
for (let source of asset.sources) {
|
|
607
|
-
switch (source.kind) {
|
|
608
|
-
case 'on-disk':
|
|
609
|
-
concat.addFile((0, core_1.explicitRelative)(this.root, source.sourcePath));
|
|
610
|
-
break;
|
|
611
|
-
case 'in-memory':
|
|
612
|
-
if (typeof source.source !== 'string') {
|
|
613
|
-
throw new Error(`attempted to concatenated a Buffer-backed in-memory asset`);
|
|
614
|
-
}
|
|
615
|
-
concat.addSpace(source.source);
|
|
616
|
-
break;
|
|
617
|
-
default:
|
|
618
|
-
(0, assert_never_1.default)(source);
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
await concat.end();
|
|
622
360
|
}
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
if (this.assetIsValid(asset, this.assets.get(asset.relativePath))) {
|
|
627
|
-
continue;
|
|
628
|
-
}
|
|
629
|
-
(0, core_1.debug)('rebuilding %s', asset.relativePath);
|
|
630
|
-
switch (asset.kind) {
|
|
631
|
-
case 'on-disk':
|
|
632
|
-
this.updateOnDiskAsset(asset);
|
|
633
|
-
break;
|
|
634
|
-
case 'in-memory':
|
|
635
|
-
this.updateInMemoryAsset(asset);
|
|
636
|
-
break;
|
|
637
|
-
case 'built-ember':
|
|
638
|
-
this.updateBuiltEmberAsset(asset);
|
|
639
|
-
break;
|
|
640
|
-
case 'concatenated-asset':
|
|
641
|
-
await this.updateConcatenatedAsset(asset);
|
|
642
|
-
break;
|
|
643
|
-
default:
|
|
644
|
-
(0, assert_never_1.default)(asset);
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
for (let oldAsset of this.assets.values()) {
|
|
648
|
-
if (!assets.has(oldAsset.relativePath)) {
|
|
649
|
-
(0, fs_extra_1.unlinkSync)((0, path_2.join)(this.root, oldAsset.relativePath));
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
this.assets = assets;
|
|
653
|
-
return [...assets.values()];
|
|
654
|
-
}
|
|
655
|
-
gatherAssets(inputPaths) {
|
|
656
|
-
// first gather all the assets out of addons
|
|
657
|
-
let assets = [];
|
|
658
|
-
if (this.activeFastboot) {
|
|
659
|
-
const source = `
|
|
660
|
-
(function(){
|
|
661
|
-
var key = '_embroider_macros_runtime_config';
|
|
662
|
-
if (!window[key]){ window[key] = [];}
|
|
663
|
-
window[key].push(function(m) {
|
|
664
|
-
m.setGlobalConfig('fastboot', Object.assign({}, m.getGlobalConfig().fastboot, { isRunning: true }));
|
|
665
|
-
});
|
|
666
|
-
}())`;
|
|
667
|
-
assets.push({
|
|
668
|
-
kind: 'in-memory',
|
|
669
|
-
source,
|
|
670
|
-
relativePath: 'assets/embroider_macros_fastboot_init.js',
|
|
671
|
-
});
|
|
361
|
+
get staticAppPathsPattern() {
|
|
362
|
+
if (this.options.staticAppPaths.length > 0) {
|
|
363
|
+
return new RegExp('^(?:' + this.options.staticAppPaths.map(staticAppPath => (0, escape_string_regexp_1.default)(staticAppPath)).join('|') + ')(?:$|/)');
|
|
672
364
|
}
|
|
673
|
-
// and finally tack on the ones from our app itself
|
|
674
|
-
return assets.concat(this.extractAssets(inputPaths));
|
|
675
365
|
}
|
|
676
366
|
async build(inputPaths) {
|
|
677
367
|
// on the first build, we lock down the macros config. on subsequent builds,
|
|
@@ -683,21 +373,11 @@ class CompatAppBuilder {
|
|
|
683
373
|
this.firstBuild = false;
|
|
684
374
|
}
|
|
685
375
|
let appFiles = this.updateAppJS(inputPaths.appJS);
|
|
686
|
-
let
|
|
687
|
-
let finalAssets = await this.updateAssets(assets, appFiles);
|
|
688
|
-
let assetPaths = assets.map(asset => asset.relativePath);
|
|
376
|
+
let assetPaths = this.addEmberEntrypoints(inputPaths.htmlTree);
|
|
689
377
|
if (this.activeFastboot) {
|
|
690
378
|
// when using fastboot, our own package.json needs to be in the output so fastboot can read it.
|
|
691
379
|
assetPaths.push('package.json');
|
|
692
380
|
}
|
|
693
|
-
for (let asset of finalAssets) {
|
|
694
|
-
// our concatenated assets all have map files that ride along. Here we're
|
|
695
|
-
// telling the final stage packager to be sure and serve the map files
|
|
696
|
-
// too.
|
|
697
|
-
if (asset.kind === 'concatenated-asset') {
|
|
698
|
-
assetPaths.push(asset.sourcemapPath);
|
|
699
|
-
}
|
|
700
|
-
}
|
|
701
381
|
let meta = {
|
|
702
382
|
type: 'app',
|
|
703
383
|
version: 2,
|
|
@@ -718,6 +398,7 @@ class CompatAppBuilder {
|
|
|
718
398
|
this.addResolverConfig(resolverConfig);
|
|
719
399
|
this.addContentForConfig(this.contentForTree.readContents());
|
|
720
400
|
this.addEmberEnvConfig(this.configTree.readConfig().EmberENV);
|
|
401
|
+
this.addAppBoot(this.compatApp.appBoot.readAppBoot());
|
|
721
402
|
let babelConfig = await this.babelConfig(resolverConfig);
|
|
722
403
|
this.addBabelConfig(babelConfig);
|
|
723
404
|
(0, fs_extra_1.writeFileSync)((0, path_2.join)(this.root, 'macros-config.json'), JSON.stringify(this.compatApp.macrosConfig.babelPluginConfig()[0], null, 2));
|
|
@@ -768,7 +449,7 @@ class CompatAppBuilder {
|
|
|
768
449
|
if (i < hint.resolve.length - 1) {
|
|
769
450
|
target = (0, path_2.join)(target, 'package.json');
|
|
770
451
|
}
|
|
771
|
-
cursor =
|
|
452
|
+
cursor = resolve_1.default.sync(target, { basedir: (0, path_2.dirname)(cursor) });
|
|
772
453
|
}
|
|
773
454
|
return {
|
|
774
455
|
requireFile: cursor,
|
|
@@ -797,245 +478,14 @@ class CompatAppBuilder {
|
|
|
797
478
|
spaces: 2,
|
|
798
479
|
});
|
|
799
480
|
}
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
this.options.splitAtRoutes.find(pattern => {
|
|
803
|
-
if (typeof pattern === 'string') {
|
|
804
|
-
return pattern === routeName;
|
|
805
|
-
}
|
|
806
|
-
else {
|
|
807
|
-
return pattern.test(routeName);
|
|
808
|
-
}
|
|
809
|
-
}));
|
|
810
|
-
}
|
|
811
|
-
splitRoute(routeName, files, addToParent, addLazyBundle) {
|
|
812
|
-
let shouldSplit = routeName && this.shouldSplitRoute(routeName);
|
|
813
|
-
let ownFiles = [];
|
|
814
|
-
let ownNames = new Set();
|
|
815
|
-
if (files.template) {
|
|
816
|
-
if (shouldSplit) {
|
|
817
|
-
ownFiles.push(files.template);
|
|
818
|
-
ownNames.add(routeName);
|
|
819
|
-
}
|
|
820
|
-
else {
|
|
821
|
-
addToParent(routeName, files.template);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
if (files.controller) {
|
|
825
|
-
if (shouldSplit) {
|
|
826
|
-
ownFiles.push(files.controller);
|
|
827
|
-
ownNames.add(routeName);
|
|
828
|
-
}
|
|
829
|
-
else {
|
|
830
|
-
addToParent(routeName, files.controller);
|
|
831
|
-
}
|
|
832
|
-
}
|
|
833
|
-
if (files.route) {
|
|
834
|
-
if (shouldSplit) {
|
|
835
|
-
ownFiles.push(files.route);
|
|
836
|
-
ownNames.add(routeName);
|
|
837
|
-
}
|
|
838
|
-
else {
|
|
839
|
-
addToParent(routeName, files.route);
|
|
840
|
-
}
|
|
841
|
-
}
|
|
842
|
-
for (let [childName, childFiles] of files.children) {
|
|
843
|
-
this.splitRoute(`${routeName}.${childName}`, childFiles, (childRouteName, childFile) => {
|
|
844
|
-
// this is our child calling "addToParent"
|
|
845
|
-
if (shouldSplit) {
|
|
846
|
-
ownFiles.push(childFile);
|
|
847
|
-
ownNames.add(childRouteName);
|
|
848
|
-
}
|
|
849
|
-
else {
|
|
850
|
-
addToParent(childRouteName, childFile);
|
|
851
|
-
}
|
|
852
|
-
}, (routeNames, files) => {
|
|
853
|
-
addLazyBundle(routeNames, files);
|
|
854
|
-
});
|
|
855
|
-
}
|
|
856
|
-
if (ownFiles.length > 0) {
|
|
857
|
-
addLazyBundle([...ownNames], ownFiles);
|
|
858
|
-
}
|
|
859
|
-
}
|
|
860
|
-
topAppJSAsset(engines, prepared) {
|
|
861
|
-
let [app, ...childEngines] = engines;
|
|
862
|
-
let relativePath = `assets/${this.origAppPackage.name}.js`;
|
|
863
|
-
return this.appJSAsset(relativePath, app, childEngines, prepared, {
|
|
864
|
-
autoRun: this.compatApp.autoRun,
|
|
865
|
-
appBoot: !this.compatApp.autoRun ? this.compatApp.appBoot.readAppBoot() : '',
|
|
866
|
-
mainModule: (0, core_1.explicitRelative)((0, path_2.dirname)(relativePath), 'app'),
|
|
867
|
-
appConfig: this.configTree.readConfig().APP,
|
|
868
|
-
});
|
|
869
|
-
}
|
|
870
|
-
get staticAppPathsPattern() {
|
|
871
|
-
if (this.options.staticAppPaths.length > 0) {
|
|
872
|
-
return new RegExp('^(?:' + this.options.staticAppPaths.map(staticAppPath => (0, escape_string_regexp_1.default)(staticAppPath)).join('|') + ')(?:$|/)');
|
|
873
|
-
}
|
|
874
|
-
}
|
|
875
|
-
requiredOtherFiles(appFiles) {
|
|
876
|
-
let pattern = this.staticAppPathsPattern;
|
|
877
|
-
if (pattern) {
|
|
878
|
-
return appFiles.otherAppFiles.filter(f => {
|
|
879
|
-
return !pattern.test(f);
|
|
880
|
-
});
|
|
881
|
-
}
|
|
882
|
-
else {
|
|
883
|
-
return appFiles.otherAppFiles;
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
appJSAsset(relativePath, appFiles, childEngines, prepared, entryParams) {
|
|
887
|
-
let cached = prepared.get(relativePath);
|
|
888
|
-
if (cached) {
|
|
889
|
-
return cached;
|
|
890
|
-
}
|
|
891
|
-
let eagerModules = [];
|
|
892
|
-
let requiredAppFiles = [this.requiredOtherFiles(appFiles)];
|
|
893
|
-
if (!this.options.staticComponents) {
|
|
894
|
-
requiredAppFiles.push(appFiles.components);
|
|
895
|
-
}
|
|
896
|
-
if (!this.options.staticHelpers) {
|
|
897
|
-
requiredAppFiles.push(appFiles.helpers);
|
|
898
|
-
}
|
|
899
|
-
if (!this.options.staticModifiers) {
|
|
900
|
-
requiredAppFiles.push(appFiles.modifiers);
|
|
901
|
-
}
|
|
902
|
-
let styles = [];
|
|
903
|
-
// only import styles from engines with a parent (this excludeds the parent application) as their styles
|
|
904
|
-
// will be inserted via a direct <link> tag.
|
|
905
|
-
if (!appFiles.engine.isApp && appFiles.engine.package.isLazyEngine()) {
|
|
906
|
-
let implicitStyles = this.impliedAssets('implicit-styles', appFiles);
|
|
907
|
-
for (let style of implicitStyles) {
|
|
908
|
-
styles.push({
|
|
909
|
-
path: (0, core_1.explicitRelative)('assets/_engine_', style.relativePath),
|
|
910
|
-
});
|
|
911
|
-
}
|
|
912
|
-
let engineMeta = appFiles.engine.package.meta;
|
|
913
|
-
if (engineMeta && engineMeta['implicit-styles']) {
|
|
914
|
-
for (let style of engineMeta['implicit-styles']) {
|
|
915
|
-
styles.push({
|
|
916
|
-
path: (0, core_1.explicitRelative)((0, path_2.dirname)(relativePath), (0, path_2.join)(appFiles.engine.appRelativePath, style)),
|
|
917
|
-
});
|
|
918
|
-
}
|
|
919
|
-
}
|
|
920
|
-
}
|
|
921
|
-
let lazyEngines = [];
|
|
922
|
-
for (let childEngine of childEngines) {
|
|
923
|
-
let asset = this.appJSAsset(`assets/_engine_/${encodeURIComponent(childEngine.engine.package.name)}.js`, childEngine, [], prepared);
|
|
924
|
-
if (childEngine.engine.package.isLazyEngine()) {
|
|
925
|
-
lazyEngines.push({
|
|
926
|
-
names: [childEngine.engine.package.name],
|
|
927
|
-
path: (0, core_1.explicitRelative)((0, path_2.dirname)(relativePath), asset.relativePath),
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
else {
|
|
931
|
-
eagerModules.push((0, core_1.explicitRelative)((0, path_2.dirname)(relativePath), asset.relativePath));
|
|
932
|
-
}
|
|
933
|
-
}
|
|
934
|
-
let lazyRoutes = [];
|
|
935
|
-
for (let [routeName, routeFiles] of appFiles.routeFiles.children) {
|
|
936
|
-
this.splitRoute(routeName, routeFiles, (_, filename) => {
|
|
937
|
-
requiredAppFiles.push([filename]);
|
|
938
|
-
}, (routeNames, files) => {
|
|
939
|
-
let routeEntrypoint = `assets/_route_/${encodeURIComponent(routeNames[0])}.js`;
|
|
940
|
-
if (!prepared.has(routeEntrypoint)) {
|
|
941
|
-
prepared.set(routeEntrypoint, this.routeEntrypoint(appFiles, routeEntrypoint, files));
|
|
942
|
-
}
|
|
943
|
-
lazyRoutes.push({
|
|
944
|
-
names: routeNames,
|
|
945
|
-
path: this.importPaths(appFiles, routeEntrypoint).buildtime,
|
|
946
|
-
});
|
|
947
|
-
});
|
|
948
|
-
}
|
|
949
|
-
let [fastboot, nonFastboot] = (0, partition_1.default)(excludeDotFiles((0, flatten_1.default)(requiredAppFiles)), file => appFiles.isFastbootOnly.get(file));
|
|
950
|
-
let amdModules = nonFastboot.map(file => this.importPaths(appFiles, file));
|
|
951
|
-
let fastbootOnlyAmdModules = fastboot.map(file => this.importPaths(appFiles, file));
|
|
952
|
-
let params = {
|
|
953
|
-
amdModules,
|
|
954
|
-
fastbootOnlyAmdModules,
|
|
955
|
-
lazyRoutes,
|
|
956
|
-
lazyEngines,
|
|
957
|
-
eagerModules,
|
|
958
|
-
styles,
|
|
959
|
-
// this is a backward-compatibility feature: addons can force inclusion of modules.
|
|
960
|
-
defineModulesFrom: './-embroider-implicit-modules.js',
|
|
961
|
-
};
|
|
962
|
-
if (entryParams) {
|
|
963
|
-
Object.assign(params, entryParams);
|
|
964
|
-
}
|
|
965
|
-
let source = entryTemplate(params);
|
|
966
|
-
let asset = {
|
|
967
|
-
kind: 'in-memory',
|
|
968
|
-
source,
|
|
969
|
-
relativePath,
|
|
970
|
-
};
|
|
971
|
-
prepared.set(relativePath, asset);
|
|
972
|
-
return asset;
|
|
973
|
-
}
|
|
974
|
-
importPaths({ engine }, engineRelativePath) {
|
|
975
|
-
let noHBS = engineRelativePath.replace(this.resolvableExtensionsPattern, '').replace(/\.hbs$/, '');
|
|
976
|
-
return {
|
|
977
|
-
runtime: `${engine.modulePrefix}/${noHBS}`,
|
|
978
|
-
buildtime: path_1.posix.join(engine.package.name, engineRelativePath),
|
|
979
|
-
};
|
|
980
|
-
}
|
|
981
|
-
routeEntrypoint(appFiles, relativePath, files) {
|
|
982
|
-
let [fastboot, nonFastboot] = (0, partition_1.default)(files, file => appFiles.isFastbootOnly.get(file));
|
|
983
|
-
let asset = {
|
|
984
|
-
kind: 'in-memory',
|
|
985
|
-
source: routeEntryTemplate({
|
|
986
|
-
files: nonFastboot.map(f => this.importPaths(appFiles, f)),
|
|
987
|
-
fastbootOnlyFiles: fastboot.map(f => this.importPaths(appFiles, f)),
|
|
988
|
-
}),
|
|
989
|
-
relativePath,
|
|
990
|
-
};
|
|
991
|
-
return asset;
|
|
992
|
-
}
|
|
993
|
-
testJSEntrypoint(appFiles, prepared) {
|
|
994
|
-
let asset = prepared.get(`assets/test.js`);
|
|
995
|
-
if (asset) {
|
|
996
|
-
return asset;
|
|
997
|
-
}
|
|
998
|
-
// We're only building tests from the first engine (the app). This is the
|
|
999
|
-
// normal thing to do -- tests from engines don't automatically roll up into
|
|
1000
|
-
// the app.
|
|
1001
|
-
let engine = appFiles[0];
|
|
1002
|
-
const myName = 'assets/test.js';
|
|
1003
|
-
// tests necessarily also include the app. This is where we account for
|
|
1004
|
-
// that. The classic solution was to always include the app's separate
|
|
1005
|
-
// script tag in the tests HTML, but that isn't as easy for final stage
|
|
1006
|
-
// packagers to understand. It's better to express it here as a direct
|
|
1007
|
-
// module dependency.
|
|
1008
|
-
let eagerModules = [
|
|
1009
|
-
'ember-testing',
|
|
1010
|
-
(0, core_1.explicitRelative)((0, path_2.dirname)(myName), this.topAppJSAsset(appFiles, prepared).relativePath),
|
|
1011
|
-
];
|
|
1012
|
-
let amdModules = [];
|
|
1013
|
-
for (let relativePath of engine.tests) {
|
|
1014
|
-
amdModules.push(this.importPaths(engine, relativePath));
|
|
1015
|
-
}
|
|
1016
|
-
let source = entryTemplate({
|
|
1017
|
-
amdModules,
|
|
1018
|
-
eagerModules,
|
|
1019
|
-
testSuffix: true,
|
|
1020
|
-
// this is a backward-compatibility feature: addons can force inclusion of test support modules.
|
|
1021
|
-
defineModulesFrom: './-embroider-implicit-test-modules.js',
|
|
1022
|
-
});
|
|
1023
|
-
asset = {
|
|
1024
|
-
kind: 'in-memory',
|
|
1025
|
-
source,
|
|
1026
|
-
relativePath: myName,
|
|
1027
|
-
};
|
|
1028
|
-
prepared.set(asset.relativePath, asset);
|
|
1029
|
-
return asset;
|
|
481
|
+
addAppBoot(appBoot) {
|
|
482
|
+
(0, fs_extra_1.writeFileSync)((0, path_2.join)((0, core_1.locateEmbroiderWorkingDir)(this.compatApp.root), 'ember-app-boot.js'), appBoot !== null && appBoot !== void 0 ? appBoot : '');
|
|
1030
483
|
}
|
|
1031
484
|
}
|
|
1032
485
|
exports.CompatAppBuilder = CompatAppBuilder;
|
|
1033
486
|
__decorate([
|
|
1034
487
|
(0, typescript_memoize_1.Memoize)()
|
|
1035
488
|
], CompatAppBuilder.prototype, "fastbootJSSrcDir", null);
|
|
1036
|
-
__decorate([
|
|
1037
|
-
(0, typescript_memoize_1.Memoize)()
|
|
1038
|
-
], CompatAppBuilder.prototype, "findTestemAsset", null);
|
|
1039
489
|
__decorate([
|
|
1040
490
|
(0, typescript_memoize_1.Memoize)()
|
|
1041
491
|
], CompatAppBuilder.prototype, "allActiveAddons", null);
|
|
@@ -1062,10 +512,10 @@ __decorate([
|
|
|
1062
512
|
], CompatAppBuilder.prototype, "fastbootConfig", null);
|
|
1063
513
|
__decorate([
|
|
1064
514
|
(0, typescript_memoize_1.Memoize)()
|
|
1065
|
-
], CompatAppBuilder.prototype, "
|
|
515
|
+
], CompatAppBuilder.prototype, "staticAppPathsPattern", null);
|
|
1066
516
|
__decorate([
|
|
1067
517
|
(0, typescript_memoize_1.Memoize)()
|
|
1068
|
-
], CompatAppBuilder.prototype, "
|
|
518
|
+
], CompatAppBuilder.prototype, "portableHints", null);
|
|
1069
519
|
function defaultAddonPackageRules() {
|
|
1070
520
|
return (0, fs_extra_2.readdirSync)((0, path_2.join)(__dirname, 'addon-dependency-rules'))
|
|
1071
521
|
.map(filename => {
|
|
@@ -1077,121 +527,6 @@ function defaultAddonPackageRules() {
|
|
|
1077
527
|
.filter(Boolean)
|
|
1078
528
|
.reduce((a, b) => a.concat(b), []);
|
|
1079
529
|
}
|
|
1080
|
-
const entryTemplate = (0, core_1.jsHandlebarsCompile)(`
|
|
1081
|
-
import { importSync as i, macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
1082
|
-
let w = window;
|
|
1083
|
-
let d = w.define;
|
|
1084
|
-
|
|
1085
|
-
{{#if styles}}
|
|
1086
|
-
if (macroCondition(!getGlobalConfig().fastboot?.isRunning)) {
|
|
1087
|
-
{{#each styles as |stylePath| ~}}
|
|
1088
|
-
i("{{js-string-escape stylePath.path}}");
|
|
1089
|
-
{{/each}}
|
|
1090
|
-
}
|
|
1091
|
-
{{/if}}
|
|
1092
|
-
|
|
1093
|
-
{{#if defineModulesFrom ~}}
|
|
1094
|
-
import implicitModules from "{{js-string-escape defineModulesFrom}}";
|
|
1095
|
-
|
|
1096
|
-
for(const [name, module] of Object.entries(implicitModules)) {
|
|
1097
|
-
d(name, function() { return module });
|
|
1098
|
-
}
|
|
1099
|
-
{{/if}}
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
{{#each eagerModules as |eagerModule| ~}}
|
|
1103
|
-
i("{{js-string-escape eagerModule}}");
|
|
1104
|
-
{{/each}}
|
|
1105
|
-
|
|
1106
|
-
{{#each amdModules as |amdModule| ~}}
|
|
1107
|
-
d("{{js-string-escape amdModule.runtime}}", function(){ return i("{{js-string-escape amdModule.buildtime}}");});
|
|
1108
|
-
{{/each}}
|
|
1109
|
-
|
|
1110
|
-
{{#if fastbootOnlyAmdModules}}
|
|
1111
|
-
if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {
|
|
1112
|
-
let fastbootModules = {};
|
|
1113
|
-
|
|
1114
|
-
{{#each fastbootOnlyAmdModules as |amdModule| ~}}
|
|
1115
|
-
fastbootModules["{{js-string-escape amdModule.runtime}}"] = import("{{js-string-escape amdModule.buildtime}}");
|
|
1116
|
-
{{/each}}
|
|
1117
|
-
|
|
1118
|
-
const resolvedValues = await Promise.all(Object.values(fastbootModules));
|
|
1119
|
-
|
|
1120
|
-
Object.keys(fastbootModules).forEach((k, i) => {
|
|
1121
|
-
d(k, function(){ return resolvedValues[i];});
|
|
1122
|
-
})
|
|
1123
|
-
}
|
|
1124
|
-
{{/if}}
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
{{#if lazyRoutes}}
|
|
1128
|
-
w._embroiderRouteBundles_ = [
|
|
1129
|
-
{{#each lazyRoutes as |route|}}
|
|
1130
|
-
{
|
|
1131
|
-
names: {{json-stringify route.names}},
|
|
1132
|
-
load: function() {
|
|
1133
|
-
return import("{{js-string-escape route.path}}");
|
|
1134
|
-
}
|
|
1135
|
-
},
|
|
1136
|
-
{{/each}}
|
|
1137
|
-
]
|
|
1138
|
-
{{/if}}
|
|
1139
|
-
|
|
1140
|
-
{{#if lazyEngines}}
|
|
1141
|
-
w._embroiderEngineBundles_ = [
|
|
1142
|
-
{{#each lazyEngines as |engine|}}
|
|
1143
|
-
{
|
|
1144
|
-
names: {{json-stringify engine.names}},
|
|
1145
|
-
load: function() {
|
|
1146
|
-
return import("{{js-string-escape engine.path}}");
|
|
1147
|
-
}
|
|
1148
|
-
},
|
|
1149
|
-
{{/each}}
|
|
1150
|
-
]
|
|
1151
|
-
{{/if}}
|
|
1152
|
-
|
|
1153
|
-
{{#if autoRun ~}}
|
|
1154
|
-
if (!runningTests) {
|
|
1155
|
-
i("{{js-string-escape mainModule}}").default.create({{json-stringify appConfig}});
|
|
1156
|
-
}
|
|
1157
|
-
{{else if appBoot ~}}
|
|
1158
|
-
{{ appBoot }}
|
|
1159
|
-
{{/if}}
|
|
1160
|
-
|
|
1161
|
-
{{#if testSuffix ~}}
|
|
1162
|
-
{{!- TODO: both of these suffixes should get dynamically generated so they incorporate
|
|
1163
|
-
any content-for added by addons. -}}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
{{!- this is the traditional tests-suffix.js -}}
|
|
1167
|
-
i('../tests/test-helper');
|
|
1168
|
-
EmberENV.TESTS_FILE_LOADED = true;
|
|
1169
|
-
{{/if}}
|
|
1170
|
-
`);
|
|
1171
|
-
const routeEntryTemplate = (0, core_1.jsHandlebarsCompile)(`
|
|
1172
|
-
import { importSync as i } from '@embroider/macros';
|
|
1173
|
-
let d = window.define;
|
|
1174
|
-
{{#each files as |amdModule| ~}}
|
|
1175
|
-
d("{{js-string-escape amdModule.runtime}}", function(){ return i("{{js-string-escape amdModule.buildtime}}");});
|
|
1176
|
-
{{/each}}
|
|
1177
|
-
{{#if fastbootOnlyFiles}}
|
|
1178
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
|
1179
|
-
if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {
|
|
1180
|
-
{{#each fastbootOnlyFiles as |amdModule| ~}}
|
|
1181
|
-
d("{{js-string-escape amdModule.runtime}}", function(){ return i("{{js-string-escape amdModule.buildtime}}");});
|
|
1182
|
-
{{/each}}
|
|
1183
|
-
}
|
|
1184
|
-
{{/if}}
|
|
1185
|
-
`);
|
|
1186
|
-
function stringOrBufferEqual(a, b) {
|
|
1187
|
-
if (typeof a === 'string' && typeof b === 'string') {
|
|
1188
|
-
return a === b;
|
|
1189
|
-
}
|
|
1190
|
-
if (a instanceof Buffer && b instanceof Buffer) {
|
|
1191
|
-
return Buffer.compare(a, b) === 0;
|
|
1192
|
-
}
|
|
1193
|
-
return false;
|
|
1194
|
-
}
|
|
1195
530
|
const babelFilterTemplate = (0, core_1.jsHandlebarsCompile)(`
|
|
1196
531
|
const { babelFilter } = require(${JSON.stringify(require.resolve('@embroider/core'))});
|
|
1197
532
|
module.exports = babelFilter({{json-stringify skipBabel}}, "{{js-string-escape appRoot}}");
|
|
@@ -1231,37 +566,4 @@ function addCachablePlugin(babelConfig) {
|
|
|
1231
566
|
]);
|
|
1232
567
|
}
|
|
1233
568
|
}
|
|
1234
|
-
function excludeDotFiles(files) {
|
|
1235
|
-
return files.filter(file => !file.startsWith('.') && !file.includes('/.'));
|
|
1236
|
-
}
|
|
1237
|
-
class ParsedEmberAsset {
|
|
1238
|
-
constructor(asset) {
|
|
1239
|
-
this.kind = 'parsed-ember';
|
|
1240
|
-
this.fileAsset = asset;
|
|
1241
|
-
this.html = new ember_html_1.PreparedEmberHTML(asset);
|
|
1242
|
-
this.relativePath = asset.relativePath;
|
|
1243
|
-
}
|
|
1244
|
-
validFor(other) {
|
|
1245
|
-
return this.fileAsset.mtime === other.mtime && this.fileAsset.size === other.size;
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
class BuiltEmberAsset {
|
|
1249
|
-
constructor(asset) {
|
|
1250
|
-
this.kind = 'built-ember';
|
|
1251
|
-
this.parsedAsset = asset;
|
|
1252
|
-
this.source = asset.html.dom.serialize();
|
|
1253
|
-
this.relativePath = asset.relativePath;
|
|
1254
|
-
}
|
|
1255
|
-
}
|
|
1256
|
-
class ConcatenatedAsset {
|
|
1257
|
-
constructor(relativePath, sources, resolvableExtensions) {
|
|
1258
|
-
this.relativePath = relativePath;
|
|
1259
|
-
this.sources = sources;
|
|
1260
|
-
this.resolvableExtensions = resolvableExtensions;
|
|
1261
|
-
this.kind = 'concatenated-asset';
|
|
1262
|
-
}
|
|
1263
|
-
get sourcemapPath() {
|
|
1264
|
-
return this.relativePath.replace(this.resolvableExtensions, '') + '.map';
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
569
|
//# sourceMappingURL=compat-app-builder.js.map
|