@embroider/compat 3.6.2-unstable.f33728f → 3.6.2
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 +12 -14
- package/src/audit/babel-visitor.js +1 -7
- package/src/audit/babel-visitor.js.map +1 -1
- package/src/audit/build.js.map +1 -1
- package/src/audit.d.ts +53 -6
- package/src/audit.js +285 -98
- package/src/audit.js.map +1 -1
- package/src/babel-plugin-adjust-imports.js +18 -19
- package/src/babel-plugin-adjust-imports.js.map +1 -1
- package/src/compat-adapters/@ember-data/debug.d.ts +6 -0
- package/src/compat-adapters/@ember-data/debug.js +22 -0
- package/src/compat-adapters/@ember-data/debug.js.map +1 -0
- package/src/compat-adapters/@ember-data/store.d.ts +5 -1
- package/src/compat-adapters/@ember-data/store.js +15 -3
- package/src/compat-adapters/@ember-data/store.js.map +1 -1
- package/src/compat-adapters/active-model-adapter.d.ts +1 -1
- package/src/compat-adapters/ember-asset-loader.d.ts +1 -1
- package/src/compat-adapters/ember-cli-addon-docs.d.ts +1 -1
- package/src/compat-adapters/ember-decorators.d.ts +1 -1
- package/src/compat-adapters/ember-macro-helpers.d.ts +1 -1
- package/src/compat-adapters/ember-percy.d.ts +1 -1
- package/src/compat-adapters/ember-scroll-modifiers.d.ts +1 -1
- package/src/compat-adapters/ember-source.d.ts +2 -2
- package/src/compat-adapters/ember-test-selectors.d.ts +1 -1
- package/src/compat-addons.js +1 -1
- package/src/compat-addons.js.map +1 -1
- package/src/compat-app-builder.d.ts +64 -9
- package/src/compat-app-builder.js +1275 -110
- package/src/compat-app-builder.js.map +1 -1
- package/src/compat-app.d.ts +22 -4
- package/src/compat-app.js +216 -70
- package/src/compat-app.js.map +1 -1
- package/src/default-pipeline.d.ts +2 -2
- package/src/default-pipeline.js +0 -21
- package/src/default-pipeline.js.map +1 -1
- package/src/dependency-rules.js +10 -17
- package/src/dependency-rules.js.map +1 -1
- package/src/detect-babel-plugins.d.ts +0 -1
- package/src/detect-babel-plugins.js +0 -14
- package/src/detect-babel-plugins.js.map +1 -1
- package/src/index.d.ts +2 -1
- package/src/index.js +3 -2
- package/src/index.js.map +1 -1
- package/src/options.d.ts +2 -3
- package/src/options.js +0 -3
- package/src/options.js.map +1 -1
- package/src/rename-require-plugin.d.ts +1 -0
- package/src/rename-require-plugin.js +15 -0
- package/src/rename-require-plugin.js.map +1 -0
- package/src/resolver-transform.js +6 -9
- package/src/resolver-transform.js.map +1 -1
- package/src/standalone-addon-build.js +15 -6
- package/src/standalone-addon-build.js.map +1 -1
- package/src/sync-dir.d.ts +8 -0
- package/src/sync-dir.js +68 -0
- package/src/sync-dir.js.map +1 -0
- package/src/template-tag-codemod.d.ts +10 -0
- package/src/template-tag-codemod.js +259 -0
- package/src/template-tag-codemod.js.map +1 -0
- package/src/v1-appboot.d.ts +14 -0
- package/src/v1-appboot.js +47 -0
- package/src/v1-appboot.js.map +1 -0
- package/src/v1-config.d.ts +8 -0
- package/src/v1-config.js +51 -1
- package/src/v1-config.js.map +1 -1
- package/babel.js +0 -1
- package/src/babel.d.ts +0 -19
- package/src/babel.js +0 -153
- package/src/babel.js.map +0 -1
- package/src/compat-adapters/ember-fetch.d.ts +0 -5
- package/src/compat-adapters/ember-fetch.js +0 -19
- package/src/compat-adapters/ember-fetch.js.map +0 -1
- package/src/compat-adapters/ember-resolver.d.ts +0 -4
- package/src/compat-adapters/ember-resolver.js +0 -21
- package/src/compat-adapters/ember-resolver.js.map +0 -1
- package/src/content-for-config.d.ts +0 -11
- package/src/content-for-config.js +0 -66
- package/src/content-for-config.js.map +0 -1
- package/src/http-audit.d.ts +0 -13
- package/src/http-audit.js +0 -60
- package/src/http-audit.js.map +0 -1
- package/src/module-visitor.d.ts +0 -52
- package/src/module-visitor.js +0 -285
- package/src/module-visitor.js.map +0 -1
package/src/compat-app.js
CHANGED
|
@@ -18,8 +18,8 @@ const broccoli_funnel_1 = __importDefault(require("broccoli-funnel"));
|
|
|
18
18
|
const broccoli_merge_trees_1 = __importDefault(require("broccoli-merge-trees"));
|
|
19
19
|
const broccoli_source_1 = require("broccoli-source");
|
|
20
20
|
const resolve_1 = __importDefault(require("resolve"));
|
|
21
|
-
const content_for_config_1 = __importDefault(require("./content-for-config"));
|
|
22
21
|
const v1_config_1 = require("./v1-config");
|
|
22
|
+
const v1_appboot_1 = require("./v1-appboot");
|
|
23
23
|
const fs_extra_1 = require("fs-extra");
|
|
24
24
|
const add_to_tree_1 = __importDefault(require("./add-to-tree"));
|
|
25
25
|
const dummy_package_1 = __importDefault(require("./dummy-package"));
|
|
@@ -27,12 +27,12 @@ const node_1 = require("@embroider/macros/src/node");
|
|
|
27
27
|
const resolve_package_path_1 = __importDefault(require("resolve-package-path"));
|
|
28
28
|
const broccoli_concat_1 = __importDefault(require("broccoli-concat"));
|
|
29
29
|
const mapKeys_1 = __importDefault(require("lodash/mapKeys"));
|
|
30
|
+
const synthesize_template_only_components_1 = __importDefault(require("./synthesize-template-only-components"));
|
|
30
31
|
const detect_babel_plugins_1 = require("./detect-babel-plugins");
|
|
31
32
|
const prepare_htmlbars_ast_plugins_1 = __importDefault(require("./prepare-htmlbars-ast-plugins"));
|
|
32
33
|
const fs_1 = require("fs");
|
|
33
34
|
const semver_1 = __importDefault(require("semver"));
|
|
34
35
|
const compat_app_builder_1 = require("./compat-app-builder");
|
|
35
|
-
const walk_sync_1 = __importDefault(require("walk-sync"));
|
|
36
36
|
// This runs at broccoli-pipeline-construction time, whereas the
|
|
37
37
|
// CompatAppBuilder instance only becomes available during tree-building time.
|
|
38
38
|
class CompatApp {
|
|
@@ -77,6 +77,9 @@ class CompatApp {
|
|
|
77
77
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
78
78
|
return require(resolve_1.default.sync(specifier, { basedir: this.emberCLILocation }));
|
|
79
79
|
}
|
|
80
|
+
get configReplace() {
|
|
81
|
+
return this.requireFromEmberCLI('broccoli-config-replace');
|
|
82
|
+
}
|
|
80
83
|
get configLoader() {
|
|
81
84
|
return this.requireFromEmberCLI('broccoli-config-loader');
|
|
82
85
|
}
|
|
@@ -110,21 +113,20 @@ class CompatApp {
|
|
|
110
113
|
return new v1_config_1.V1Config(this.configTree, 'test');
|
|
111
114
|
}
|
|
112
115
|
}
|
|
113
|
-
get contentFor() {
|
|
114
|
-
const configPaths = [
|
|
115
|
-
{ file: '/index.html', path: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`) },
|
|
116
|
-
];
|
|
117
|
-
if (this.shouldBuildTests)
|
|
118
|
-
configPaths.push({ file: '/tests/index.html', path: (0, path_1.join)('environments', `test.json`) });
|
|
119
|
-
return new content_for_config_1.default(this.configTree, {
|
|
120
|
-
availableContentForTypes: this.options.availableContentForTypes,
|
|
121
|
-
configPaths,
|
|
122
|
-
pattern: this.filteredPatternsByContentFor.contentFor,
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
116
|
get autoRun() {
|
|
126
117
|
return this.legacyEmberAppInstance.options.autoRun;
|
|
127
118
|
}
|
|
119
|
+
get appBoot() {
|
|
120
|
+
let env = this.legacyEmberAppInstance.env;
|
|
121
|
+
let appBootContentTree = new v1_appboot_1.WriteV1AppBoot();
|
|
122
|
+
let patterns = this.configReplacePatterns;
|
|
123
|
+
appBootContentTree = new this.configReplace(appBootContentTree, this.configTree, {
|
|
124
|
+
configPath: (0, path_1.join)('environments', `${env}.json`),
|
|
125
|
+
files: ['config/app-boot.js'],
|
|
126
|
+
patterns,
|
|
127
|
+
});
|
|
128
|
+
return new v1_appboot_1.ReadV1AppBoot(appBootContentTree);
|
|
129
|
+
}
|
|
128
130
|
get storeConfigInMeta() {
|
|
129
131
|
return this.legacyEmberAppInstance.options.storeConfigInMeta;
|
|
130
132
|
}
|
|
@@ -135,36 +137,93 @@ class CompatApp {
|
|
|
135
137
|
storeConfigInMeta: this.storeConfigInMeta,
|
|
136
138
|
});
|
|
137
139
|
}
|
|
138
|
-
get
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
140
|
+
get htmlTree() {
|
|
141
|
+
if (this.legacyEmberAppInstance.tests) {
|
|
142
|
+
return (0, broccoli_merge_trees_1.default)([this.indexTree, this.testIndexTree]);
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
return this.indexTree;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
get indexTree() {
|
|
149
|
+
let indexFilePath = this.legacyEmberAppInstance.options.outputPaths.app.html;
|
|
150
|
+
let index = (0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.app, {
|
|
151
|
+
allowEmpty: true,
|
|
152
|
+
include: [`index.html`],
|
|
153
|
+
getDestinationPath: () => indexFilePath,
|
|
154
|
+
annotation: 'app/index.html',
|
|
155
|
+
});
|
|
156
|
+
return new this.configReplace(index, this.configTree, {
|
|
157
|
+
configPath: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`),
|
|
158
|
+
files: [indexFilePath],
|
|
159
|
+
patterns: this.configReplacePatterns,
|
|
160
|
+
annotation: 'ConfigReplace/indexTree',
|
|
161
|
+
});
|
|
144
162
|
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
163
|
+
get testIndexTree() {
|
|
164
|
+
let index = (0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.tests, {
|
|
165
|
+
allowEmpty: true,
|
|
166
|
+
include: [`index.html`],
|
|
167
|
+
destDir: 'tests',
|
|
168
|
+
annotation: 'tests/index.html',
|
|
169
|
+
});
|
|
170
|
+
return new this.configReplace(index, this.configTree, {
|
|
171
|
+
configPath: (0, path_1.join)('environments', `test.json`),
|
|
172
|
+
files: ['tests/index.html'],
|
|
173
|
+
patterns: this.configReplacePatterns,
|
|
174
|
+
annotation: 'ConfigReplace/testIndexTree',
|
|
175
|
+
});
|
|
176
|
+
}
|
|
177
|
+
babelConfig() {
|
|
178
|
+
// this finds all the built-in babel configuration that comes with ember-cli-babel
|
|
179
|
+
const babelAddon = this.legacyEmberAppInstance.project.findAddonByName('ember-cli-babel');
|
|
180
|
+
const babelConfig = babelAddon.buildBabelOptions({
|
|
181
|
+
'ember-cli-babel': {
|
|
182
|
+
...this.legacyEmberAppInstance.options['ember-cli-babel'],
|
|
183
|
+
includeExternalHelpers: true,
|
|
184
|
+
compileModules: false,
|
|
185
|
+
disableDebugTooling: false,
|
|
186
|
+
disablePresetEnv: false,
|
|
187
|
+
disableEmberModulesAPIPolyfill: false,
|
|
188
|
+
},
|
|
189
|
+
});
|
|
190
|
+
let plugins = babelConfig.plugins;
|
|
191
|
+
let presets = babelConfig.presets;
|
|
192
|
+
// this finds any custom babel configuration that's on the app (either
|
|
193
|
+
// because the app author explicitly added some, or because addons have
|
|
194
|
+
// pushed plugins into it).
|
|
149
195
|
let appBabel = this.legacyEmberAppInstance.options.babel;
|
|
150
196
|
if (appBabel) {
|
|
151
197
|
if (appBabel.plugins) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
// similarly, if the app was already using an inline template compiler
|
|
157
|
-
// babel plugin, we remove it here because we have our own
|
|
158
|
-
// always-installed version of that (v2 addons are allowed to assume it
|
|
159
|
-
// will be present in the final app build, the app doesn't get to turn
|
|
160
|
-
// that off or configure it.)
|
|
161
|
-
!(0, detect_babel_plugins_1.isInlinePrecompilePlugin)(p) &&
|
|
162
|
-
!(0, detect_babel_plugins_1.isEmberAutoImportDynamic)(p) &&
|
|
163
|
-
!(0, detect_babel_plugins_1.isHtmlbarColocation)(p));
|
|
164
|
-
});
|
|
198
|
+
plugins = appBabel.plugins.concat(plugins);
|
|
199
|
+
}
|
|
200
|
+
if (appBabel.presets) {
|
|
201
|
+
presets = appBabel.presets.concat(presets);
|
|
165
202
|
}
|
|
166
203
|
}
|
|
167
|
-
|
|
204
|
+
plugins = plugins.filter(p => {
|
|
205
|
+
// even if the app was using @embroider/macros, we drop it from the config
|
|
206
|
+
// here in favor of our globally-configured one.
|
|
207
|
+
return (!(0, node_1.isEmbroiderMacrosPlugin)(p) &&
|
|
208
|
+
// similarly, if the app was already using an inline template compiler
|
|
209
|
+
// babel plugin, we remove it here because we have our own
|
|
210
|
+
// always-installed version of that (v2 addons are allowed to assume it
|
|
211
|
+
// will be present in the final app build, the app doesn't get to turn
|
|
212
|
+
// that off or configure it.)
|
|
213
|
+
!(0, detect_babel_plugins_1.isInlinePrecompilePlugin)(p) &&
|
|
214
|
+
!(0, detect_babel_plugins_1.isEmberAutoImportDynamic)(p));
|
|
215
|
+
});
|
|
216
|
+
const config = {
|
|
217
|
+
babelrc: false,
|
|
218
|
+
plugins,
|
|
219
|
+
presets,
|
|
220
|
+
// this is here because broccoli-middleware can't render a codeFrame full
|
|
221
|
+
// of terminal codes. It would be nice to add something like
|
|
222
|
+
// https://github.com/mmalecki/ansispan to broccoli-middleware so we can
|
|
223
|
+
// leave color enabled.
|
|
224
|
+
highlightCode: false,
|
|
225
|
+
};
|
|
226
|
+
return config;
|
|
168
227
|
}
|
|
169
228
|
babelMajorVersion() {
|
|
170
229
|
var _a, _b;
|
|
@@ -302,28 +361,6 @@ class CompatApp {
|
|
|
302
361
|
(0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(destPath));
|
|
303
362
|
(0, fs_extra_1.copySync)(sourcePath, destPath);
|
|
304
363
|
}
|
|
305
|
-
if (this.shouldBuildTests) {
|
|
306
|
-
(0, fs_extra_1.writeFileSync)((0, path_1.join)(outputPath, 'testem.js'), `/*
|
|
307
|
-
* This is dummy file that exists for the sole purpose
|
|
308
|
-
* of allowing tests to run directly in the browser as
|
|
309
|
-
* well as by Testem.
|
|
310
|
-
*
|
|
311
|
-
* Testem is configured to run tests directly against
|
|
312
|
-
* the test build of index.html, which requires a
|
|
313
|
-
* snippet to load the testem.js file:
|
|
314
|
-
* <script src="/testem.js"></script>
|
|
315
|
-
* This has to go before the qunit framework and app
|
|
316
|
-
* tests are loaded.
|
|
317
|
-
*
|
|
318
|
-
* Testem internally supplies this file. However, if you
|
|
319
|
-
* run the tests directly in the browser (localhost:8000/tests),
|
|
320
|
-
* this file does not exist.
|
|
321
|
-
*
|
|
322
|
-
* Hence the purpose of this fake file. This file is served
|
|
323
|
-
* directly from the express server to satisify the script load.
|
|
324
|
-
*/`);
|
|
325
|
-
this._publicAssets['/testem.js'] = './testem.js';
|
|
326
|
-
}
|
|
327
364
|
let remapAsset = this.remapAsset.bind(this);
|
|
328
365
|
let addonMeta = {
|
|
329
366
|
type: 'addon',
|
|
@@ -386,7 +423,7 @@ class CompatApp {
|
|
|
386
423
|
};
|
|
387
424
|
let assetPath = (0, path_1.join)(outputPath, 'assets');
|
|
388
425
|
if ((0, fs_extra_1.pathExistsSync)(assetPath)) {
|
|
389
|
-
for (let file of (0,
|
|
426
|
+
for (let file of (0, fs_extra_1.readdirSync)(assetPath)) {
|
|
390
427
|
addonMeta['public-assets'][`./assets/${file}`] = `/assets/${file}`;
|
|
391
428
|
}
|
|
392
429
|
}
|
|
@@ -434,6 +471,19 @@ class CompatApp {
|
|
|
434
471
|
}
|
|
435
472
|
return './' + asset;
|
|
436
473
|
}
|
|
474
|
+
preprocessJS(tree) {
|
|
475
|
+
// we're saving all our babel compilation for the final stage packager
|
|
476
|
+
this.legacyEmberAppInstance.registry.remove('js', 'ember-cli-babel');
|
|
477
|
+
// auto-import is supported natively so we don't need it here
|
|
478
|
+
this.legacyEmberAppInstance.registry.remove('js', 'ember-auto-import-analyzer');
|
|
479
|
+
tree = (0, broccoli_funnel_1.default)(tree, { destDir: this.name });
|
|
480
|
+
tree = this.preprocessors.preprocessJs(tree, `/`, '/', {
|
|
481
|
+
annotation: 'v1-app-preprocess-js',
|
|
482
|
+
registry: this.legacyEmberAppInstance.registry,
|
|
483
|
+
});
|
|
484
|
+
tree = (0, broccoli_funnel_1.default)(tree, { srcDir: this.name });
|
|
485
|
+
return tree;
|
|
486
|
+
}
|
|
437
487
|
get htmlbarsPlugins() {
|
|
438
488
|
let plugins = (0, prepare_htmlbars_ast_plugins_1.default)(this.legacyEmberAppInstance.registry);
|
|
439
489
|
// even if the app was using @embroider/macros, we drop it from the config
|
|
@@ -441,6 +491,25 @@ class CompatApp {
|
|
|
441
491
|
plugins = plugins.filter((p) => !(0, node_1.isEmbroiderMacrosPlugin)(p));
|
|
442
492
|
return plugins;
|
|
443
493
|
}
|
|
494
|
+
// our own appTree. Not to be confused with the one that combines the app js
|
|
495
|
+
// from all addons too.
|
|
496
|
+
get appTree() {
|
|
497
|
+
return this.preprocessJS((0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.app, {
|
|
498
|
+
exclude: ['styles/**', '*.html'],
|
|
499
|
+
}));
|
|
500
|
+
}
|
|
501
|
+
get testsTree() {
|
|
502
|
+
if (this.shouldBuildTests && this.legacyEmberAppInstance.trees.tests) {
|
|
503
|
+
return this.preprocessJS((0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.tests, {
|
|
504
|
+
destDir: 'tests',
|
|
505
|
+
}));
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
get lintTree() {
|
|
509
|
+
if (this.shouldBuildTests) {
|
|
510
|
+
return this.legacyEmberAppInstance.getLintTests();
|
|
511
|
+
}
|
|
512
|
+
}
|
|
444
513
|
get vendorTree() {
|
|
445
514
|
return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);
|
|
446
515
|
}
|
|
@@ -464,6 +533,69 @@ class CompatApp {
|
|
|
464
533
|
get preprocessors() {
|
|
465
534
|
return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');
|
|
466
535
|
}
|
|
536
|
+
get publicTree() {
|
|
537
|
+
return this.ensureTree(this.legacyEmberAppInstance.trees.public);
|
|
538
|
+
}
|
|
539
|
+
processAppJS() {
|
|
540
|
+
let appTree = this.appTree;
|
|
541
|
+
let testsTree = this.testsTree;
|
|
542
|
+
let lintTree = this.lintTree;
|
|
543
|
+
let config = new v1_config_1.WriteV1Config(this.config, this.storeConfigInMeta, this.testConfig);
|
|
544
|
+
let patterns = this.configReplacePatterns;
|
|
545
|
+
let configReplaced = new this.configReplace(config, this.configTree, {
|
|
546
|
+
configPath: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`),
|
|
547
|
+
files: ['config/environment.js'],
|
|
548
|
+
patterns,
|
|
549
|
+
});
|
|
550
|
+
let trees = [];
|
|
551
|
+
trees.push(appTree);
|
|
552
|
+
trees.push(new synthesize_template_only_components_1.default(appTree, { allowedPaths: ['components'], templateExtensions: ['.hbs'] }));
|
|
553
|
+
trees.push(configReplaced);
|
|
554
|
+
if (testsTree) {
|
|
555
|
+
trees.push(testsTree);
|
|
556
|
+
}
|
|
557
|
+
if (lintTree) {
|
|
558
|
+
trees.push(lintTree);
|
|
559
|
+
}
|
|
560
|
+
return {
|
|
561
|
+
appJS: (0, broccoli_merge_trees_1.default)(trees, { overwrite: true }),
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
withoutRootURL(src) {
|
|
565
|
+
let rootURL = this.config.readConfig().rootURL;
|
|
566
|
+
if ((src.startsWith(rootURL) && rootURL) || (!rootURL && !src.startsWith('/'))) {
|
|
567
|
+
src = '/' + src.slice(rootURL.length);
|
|
568
|
+
}
|
|
569
|
+
else if (src.startsWith('/' + rootURL)) {
|
|
570
|
+
src = src.slice(rootURL.length);
|
|
571
|
+
}
|
|
572
|
+
return src;
|
|
573
|
+
}
|
|
574
|
+
findAppScript(scripts, entrypoint) {
|
|
575
|
+
let appJS = scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.app.js);
|
|
576
|
+
return throwIfMissing(appJS, this.legacyEmberAppInstance.options.outputPaths.app.js, scripts.map(s => s.src), entrypoint, 'app javascript');
|
|
577
|
+
}
|
|
578
|
+
findAppStyles(styles, entrypoint) {
|
|
579
|
+
let style = styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.app.css.app);
|
|
580
|
+
return throwIfMissing(style, this.legacyEmberAppInstance.options.outputPaths.app.css.app, styles.map(s => s.href), entrypoint, 'app css');
|
|
581
|
+
}
|
|
582
|
+
findVendorScript(scripts, entrypoint) {
|
|
583
|
+
let vendor = scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.vendor.js);
|
|
584
|
+
return throwIfMissing(vendor, this.legacyEmberAppInstance.options.outputPaths.vendor.js, scripts.map(s => s.src), entrypoint, 'vendor javascript');
|
|
585
|
+
}
|
|
586
|
+
findVendorStyles(styles, entrypoint) {
|
|
587
|
+
let vendorStyle = styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.vendor.css);
|
|
588
|
+
return throwIfMissing(vendorStyle, this.legacyEmberAppInstance.options.outputPaths.vendor.css, styles.map(s => s.href), entrypoint, 'vendor css');
|
|
589
|
+
}
|
|
590
|
+
findTestSupportStyles(styles) {
|
|
591
|
+
return styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.testSupport.css);
|
|
592
|
+
}
|
|
593
|
+
findTestSupportScript(scripts) {
|
|
594
|
+
return scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.testSupport.js.testSupport);
|
|
595
|
+
}
|
|
596
|
+
findTestScript(scripts) {
|
|
597
|
+
return scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.tests.js);
|
|
598
|
+
}
|
|
467
599
|
constructor(legacyEmberAppInstance, _options) {
|
|
468
600
|
this.legacyEmberAppInstance = legacyEmberAppInstance;
|
|
469
601
|
this.annotation = '@embroider/compat/app';
|
|
@@ -491,11 +623,17 @@ class CompatApp {
|
|
|
491
623
|
});
|
|
492
624
|
}
|
|
493
625
|
inTrees(prevStageTree) {
|
|
626
|
+
let publicTree = this.publicTree;
|
|
494
627
|
let configTree = this.config;
|
|
495
|
-
|
|
628
|
+
if (this.options.extraPublicTrees.length > 0) {
|
|
629
|
+
publicTree = (0, broccoli_merge_trees_1.default)([publicTree, ...this.options.extraPublicTrees].filter(Boolean));
|
|
630
|
+
}
|
|
496
631
|
return {
|
|
632
|
+
appJS: this.processAppJS().appJS,
|
|
633
|
+
htmlTree: this.htmlTree,
|
|
634
|
+
publicTree,
|
|
497
635
|
configTree,
|
|
498
|
-
|
|
636
|
+
appBootTree: this.appBoot,
|
|
499
637
|
prevStageTree,
|
|
500
638
|
};
|
|
501
639
|
}
|
|
@@ -511,25 +649,25 @@ class CompatApp {
|
|
|
511
649
|
return packageCache.get(this.root);
|
|
512
650
|
}
|
|
513
651
|
}
|
|
514
|
-
async instantiate(packageCache, configTree
|
|
652
|
+
async instantiate(root, packageCache, configTree) {
|
|
515
653
|
let origAppPkg = this.appPackage();
|
|
516
654
|
let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);
|
|
517
655
|
let workingDir = (0, core_1.locateEmbroiderWorkingDir)(this.root);
|
|
518
|
-
return new compat_app_builder_1.CompatAppBuilder(origAppPkg, movedAppPkg, this.options, this, configTree,
|
|
656
|
+
return new compat_app_builder_1.CompatAppBuilder(root, origAppPkg, movedAppPkg, this.options, this, configTree, packageCache.get((0, path_1.join)(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')), packageCache.get((0, path_1.join)(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles')));
|
|
519
657
|
}
|
|
520
658
|
asStage(prevStage) {
|
|
521
659
|
let resolve;
|
|
522
660
|
let promise = new Promise(r => (resolve = r));
|
|
523
661
|
let tree = () => {
|
|
524
662
|
let inTrees = this.inTrees(prevStage.tree);
|
|
525
|
-
return new core_1.WaitForTrees(inTrees, this.annotation, async (
|
|
663
|
+
return new core_1.WaitForTrees(inTrees, this.annotation, async (treePaths) => {
|
|
526
664
|
if (!this.active) {
|
|
527
665
|
let { outputPath } = await prevStage.ready();
|
|
528
666
|
let packageCache = core_1.RewrittenPackageCache.shared('embroider', this.root);
|
|
529
|
-
this.active = await this.instantiate(packageCache, inTrees.configTree
|
|
667
|
+
this.active = await this.instantiate(outputPath, packageCache, inTrees.configTree);
|
|
530
668
|
resolve({ outputPath });
|
|
531
669
|
}
|
|
532
|
-
await this.active.build();
|
|
670
|
+
await this.active.build(treePaths);
|
|
533
671
|
});
|
|
534
672
|
};
|
|
535
673
|
return {
|
|
@@ -569,13 +707,13 @@ __decorate([
|
|
|
569
707
|
], CompatApp.prototype, "testConfig", null);
|
|
570
708
|
__decorate([
|
|
571
709
|
(0, typescript_memoize_1.Memoize)()
|
|
572
|
-
], CompatApp.prototype, "
|
|
710
|
+
], CompatApp.prototype, "appBoot", null);
|
|
573
711
|
__decorate([
|
|
574
712
|
(0, typescript_memoize_1.Memoize)()
|
|
575
713
|
], CompatApp.prototype, "configReplacePatterns", null);
|
|
576
714
|
__decorate([
|
|
577
715
|
(0, typescript_memoize_1.Memoize)()
|
|
578
|
-
], CompatApp.prototype, "
|
|
716
|
+
], CompatApp.prototype, "babelConfig", null);
|
|
579
717
|
__decorate([
|
|
580
718
|
(0, typescript_memoize_1.Memoize)()
|
|
581
719
|
], CompatApp.prototype, "babelMajorVersion", null);
|
|
@@ -588,4 +726,12 @@ __decorate([
|
|
|
588
726
|
__decorate([
|
|
589
727
|
(0, typescript_memoize_1.Memoize)()
|
|
590
728
|
], CompatApp.prototype, "appPackage", null);
|
|
729
|
+
function throwIfMissing(asset, needle, haystack, entryfile, context) {
|
|
730
|
+
if (!asset) {
|
|
731
|
+
throw new Error(`Could not find ${context}: "${needle}" in ${entryfile}. Found the following instead:\n${haystack
|
|
732
|
+
.map(asset => ` - ${asset}`)
|
|
733
|
+
.join('\n')}\n\nFor more information about this error: https://github.com/thoov/stitch/wiki/Could-not-find-asset-in-entry-file-error-help`);
|
|
734
|
+
}
|
|
735
|
+
return asset;
|
|
736
|
+
}
|
|
591
737
|
//# sourceMappingURL=compat-app.js.map
|