@embroider/compat 3.7.0 → 3.7.1-unstable.3e8dbe3
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/babel.js +1 -0
- package/package.json +11 -9
- package/src/audit/babel-visitor.js +7 -1
- package/src/audit/babel-visitor.js.map +1 -1
- package/src/audit/build.js.map +1 -1
- package/src/audit.d.ts +6 -53
- package/src/audit.js +98 -285
- package/src/audit.js.map +1 -1
- package/src/babel-plugin-adjust-imports.js +19 -18
- package/src/babel-plugin-adjust-imports.js.map +1 -1
- package/src/babel.d.ts +19 -0
- package/src/babel.js +153 -0
- package/src/babel.js.map +1 -0
- package/src/compat-adapters/@ember-data/store.d.ts +1 -5
- package/src/compat-adapters/@ember-data/store.js +3 -15
- 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-fetch.d.ts +5 -0
- package/src/compat-adapters/ember-fetch.js +19 -0
- package/src/compat-adapters/ember-fetch.js.map +1 -0
- 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-resolver.d.ts +4 -0
- package/src/compat-adapters/ember-resolver.js +21 -0
- package/src/compat-adapters/ember-resolver.js.map +1 -0
- 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 +9 -64
- package/src/compat-app-builder.js +110 -1275
- package/src/compat-app-builder.js.map +1 -1
- package/src/compat-app.d.ts +4 -22
- package/src/compat-app.js +70 -216
- package/src/compat-app.js.map +1 -1
- package/src/content-for-config.d.ts +11 -0
- package/src/content-for-config.js +66 -0
- package/src/content-for-config.js.map +1 -0
- package/src/default-pipeline.d.ts +2 -2
- package/src/default-pipeline.js +21 -0
- package/src/default-pipeline.js.map +1 -1
- package/src/dependency-rules.js +17 -10
- package/src/dependency-rules.js.map +1 -1
- package/src/detect-babel-plugins.d.ts +1 -0
- package/src/detect-babel-plugins.js +14 -0
- package/src/detect-babel-plugins.js.map +1 -1
- package/src/http-audit.d.ts +13 -0
- package/src/http-audit.js +60 -0
- package/src/http-audit.js.map +1 -0
- package/src/index.d.ts +1 -2
- package/src/index.js +2 -3
- package/src/index.js.map +1 -1
- package/src/module-visitor.d.ts +52 -0
- package/src/module-visitor.js +285 -0
- package/src/module-visitor.js.map +1 -0
- package/src/options.d.ts +3 -2
- package/src/options.js +3 -0
- package/src/options.js.map +1 -1
- package/src/resolver-transform.js +9 -6
- package/src/resolver-transform.js.map +1 -1
- package/src/standalone-addon-build.js +6 -15
- package/src/standalone-addon-build.js.map +1 -1
- package/src/v1-config.d.ts +0 -8
- package/src/v1-config.js +1 -51
- package/src/v1-config.js.map +1 -1
- package/src/compat-adapters/@ember-data/debug.d.ts +0 -6
- package/src/compat-adapters/@ember-data/debug.js +0 -22
- package/src/compat-adapters/@ember-data/debug.js.map +0 -1
- package/src/rename-require-plugin.d.ts +0 -1
- package/src/rename-require-plugin.js +0 -15
- package/src/rename-require-plugin.js.map +0 -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/src/template-tag-codemod.d.ts +0 -13
- package/src/template-tag-codemod.js +0 -304
- package/src/template-tag-codemod.js.map +0 -1
- package/src/v1-appboot.d.ts +0 -14
- package/src/v1-appboot.js +0 -47
- package/src/v1-appboot.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"));
|
|
21
22
|
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"));
|
|
31
30
|
const detect_babel_plugins_1 = require("./detect-babel-plugins");
|
|
32
31
|
const prepare_htmlbars_ast_plugins_1 = __importDefault(require("./prepare-htmlbars-ast-plugins"));
|
|
33
32
|
const fs_1 = require("fs");
|
|
34
33
|
const semver_1 = __importDefault(require("semver"));
|
|
35
34
|
const compat_app_builder_1 = require("./compat-app-builder");
|
|
35
|
+
const walk_sync_1 = __importDefault(require("walk-sync"));
|
|
36
36
|
const broccoli_file_creator_1 = __importDefault(require("broccoli-file-creator"));
|
|
37
37
|
// This runs at broccoli-pipeline-construction time, whereas the
|
|
38
38
|
// CompatAppBuilder instance only becomes available during tree-building time.
|
|
@@ -78,9 +78,6 @@ class CompatApp {
|
|
|
78
78
|
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
79
79
|
return require(resolve_1.default.sync(specifier, { basedir: this.emberCLILocation }));
|
|
80
80
|
}
|
|
81
|
-
get configReplace() {
|
|
82
|
-
return this.requireFromEmberCLI('broccoli-config-replace');
|
|
83
|
-
}
|
|
84
81
|
get configLoader() {
|
|
85
82
|
return this.requireFromEmberCLI('broccoli-config-loader');
|
|
86
83
|
}
|
|
@@ -114,20 +111,21 @@ class CompatApp {
|
|
|
114
111
|
return new v1_config_1.V1Config(this.configTree, 'test');
|
|
115
112
|
}
|
|
116
113
|
}
|
|
114
|
+
get contentFor() {
|
|
115
|
+
const configPaths = [
|
|
116
|
+
{ file: '/index.html', path: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`) },
|
|
117
|
+
];
|
|
118
|
+
if (this.shouldBuildTests)
|
|
119
|
+
configPaths.push({ file: '/tests/index.html', path: (0, path_1.join)('environments', `test.json`) });
|
|
120
|
+
return new content_for_config_1.default(this.configTree, {
|
|
121
|
+
availableContentForTypes: this.options.availableContentForTypes,
|
|
122
|
+
configPaths,
|
|
123
|
+
pattern: this.filteredPatternsByContentFor.contentFor,
|
|
124
|
+
});
|
|
125
|
+
}
|
|
117
126
|
get autoRun() {
|
|
118
127
|
return this.legacyEmberAppInstance.options.autoRun;
|
|
119
128
|
}
|
|
120
|
-
get appBoot() {
|
|
121
|
-
let env = this.legacyEmberAppInstance.env;
|
|
122
|
-
let appBootContentTree = new v1_appboot_1.WriteV1AppBoot();
|
|
123
|
-
let patterns = this.configReplacePatterns;
|
|
124
|
-
appBootContentTree = new this.configReplace(appBootContentTree, this.configTree, {
|
|
125
|
-
configPath: (0, path_1.join)('environments', `${env}.json`),
|
|
126
|
-
files: ['config/app-boot.js'],
|
|
127
|
-
patterns,
|
|
128
|
-
});
|
|
129
|
-
return new v1_appboot_1.ReadV1AppBoot(appBootContentTree);
|
|
130
|
-
}
|
|
131
129
|
get storeConfigInMeta() {
|
|
132
130
|
return this.legacyEmberAppInstance.options.storeConfigInMeta;
|
|
133
131
|
}
|
|
@@ -138,93 +136,36 @@ class CompatApp {
|
|
|
138
136
|
storeConfigInMeta: this.storeConfigInMeta,
|
|
139
137
|
});
|
|
140
138
|
}
|
|
141
|
-
get
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
get indexTree() {
|
|
150
|
-
let indexFilePath = this.legacyEmberAppInstance.options.outputPaths.app.html;
|
|
151
|
-
let index = (0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.app, {
|
|
152
|
-
allowEmpty: true,
|
|
153
|
-
include: [`index.html`],
|
|
154
|
-
getDestinationPath: () => indexFilePath,
|
|
155
|
-
annotation: 'app/index.html',
|
|
156
|
-
});
|
|
157
|
-
return new this.configReplace(index, this.configTree, {
|
|
158
|
-
configPath: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`),
|
|
159
|
-
files: [indexFilePath],
|
|
160
|
-
patterns: this.configReplacePatterns,
|
|
161
|
-
annotation: 'ConfigReplace/indexTree',
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
get testIndexTree() {
|
|
165
|
-
let index = (0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.tests, {
|
|
166
|
-
allowEmpty: true,
|
|
167
|
-
include: [`index.html`],
|
|
168
|
-
destDir: 'tests',
|
|
169
|
-
annotation: 'tests/index.html',
|
|
170
|
-
});
|
|
171
|
-
return new this.configReplace(index, this.configTree, {
|
|
172
|
-
configPath: (0, path_1.join)('environments', `test.json`),
|
|
173
|
-
files: ['tests/index.html'],
|
|
174
|
-
patterns: this.configReplacePatterns,
|
|
175
|
-
annotation: 'ConfigReplace/testIndexTree',
|
|
176
|
-
});
|
|
139
|
+
get filteredPatternsByContentFor() {
|
|
140
|
+
const filter = '/{{content-for [\'"](.+?)["\']}}/g';
|
|
141
|
+
return {
|
|
142
|
+
contentFor: this.configReplacePatterns.find((pattern) => filter.includes(pattern.match.toString())),
|
|
143
|
+
others: this.configReplacePatterns.filter((pattern) => !filter.includes(pattern.match.toString())),
|
|
144
|
+
};
|
|
177
145
|
}
|
|
178
|
-
|
|
179
|
-
// this finds
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
'ember-cli-babel': {
|
|
183
|
-
...this.legacyEmberAppInstance.options['ember-cli-babel'],
|
|
184
|
-
includeExternalHelpers: true,
|
|
185
|
-
compileModules: false,
|
|
186
|
-
disableDebugTooling: false,
|
|
187
|
-
disablePresetEnv: false,
|
|
188
|
-
disableEmberModulesAPIPolyfill: false,
|
|
189
|
-
},
|
|
190
|
-
});
|
|
191
|
-
let plugins = babelConfig.plugins;
|
|
192
|
-
let presets = babelConfig.presets;
|
|
193
|
-
// this finds any custom babel configuration that's on the app (either
|
|
194
|
-
// because the app author explicitly added some, or because addons have
|
|
195
|
-
// pushed plugins into it).
|
|
146
|
+
extraBabelPlugins() {
|
|
147
|
+
// this finds any custom babel plugins on the app (either because the app
|
|
148
|
+
// author explicitly added some, or because addons have pushed plugins into
|
|
149
|
+
// it).
|
|
196
150
|
let appBabel = this.legacyEmberAppInstance.options.babel;
|
|
197
151
|
if (appBabel) {
|
|
198
152
|
if (appBabel.plugins) {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
153
|
+
return appBabel.plugins.filter(p => {
|
|
154
|
+
// even if the app was using @embroider/macros, we drop it from the config
|
|
155
|
+
// here in favor of our globally-configured one.
|
|
156
|
+
return (!(0, node_1.isEmbroiderMacrosPlugin)(p) &&
|
|
157
|
+
// similarly, if the app was already using an inline template compiler
|
|
158
|
+
// babel plugin, we remove it here because we have our own
|
|
159
|
+
// always-installed version of that (v2 addons are allowed to assume it
|
|
160
|
+
// will be present in the final app build, the app doesn't get to turn
|
|
161
|
+
// that off or configure it.)
|
|
162
|
+
!(0, detect_babel_plugins_1.isInlinePrecompilePlugin)(p) &&
|
|
163
|
+
!(0, detect_babel_plugins_1.isEmberAutoImportDynamic)(p) &&
|
|
164
|
+
!(0, detect_babel_plugins_1.isHtmlbarColocation)(p));
|
|
165
|
+
});
|
|
203
166
|
}
|
|
204
167
|
}
|
|
205
|
-
|
|
206
|
-
// even if the app was using @embroider/macros, we drop it from the config
|
|
207
|
-
// here in favor of our globally-configured one.
|
|
208
|
-
return (!(0, node_1.isEmbroiderMacrosPlugin)(p) &&
|
|
209
|
-
// similarly, if the app was already using an inline template compiler
|
|
210
|
-
// babel plugin, we remove it here because we have our own
|
|
211
|
-
// always-installed version of that (v2 addons are allowed to assume it
|
|
212
|
-
// will be present in the final app build, the app doesn't get to turn
|
|
213
|
-
// that off or configure it.)
|
|
214
|
-
!(0, detect_babel_plugins_1.isInlinePrecompilePlugin)(p) &&
|
|
215
|
-
!(0, detect_babel_plugins_1.isEmberAutoImportDynamic)(p));
|
|
216
|
-
});
|
|
217
|
-
const config = {
|
|
218
|
-
babelrc: false,
|
|
219
|
-
plugins,
|
|
220
|
-
presets,
|
|
221
|
-
// this is here because broccoli-middleware can't render a codeFrame full
|
|
222
|
-
// of terminal codes. It would be nice to add something like
|
|
223
|
-
// https://github.com/mmalecki/ansispan to broccoli-middleware so we can
|
|
224
|
-
// leave color enabled.
|
|
225
|
-
highlightCode: false,
|
|
226
|
-
};
|
|
227
|
-
return config;
|
|
168
|
+
return [];
|
|
228
169
|
}
|
|
229
170
|
babelMajorVersion() {
|
|
230
171
|
var _a, _b;
|
|
@@ -378,6 +319,28 @@ class CompatApp {
|
|
|
378
319
|
(0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(destPath));
|
|
379
320
|
(0, fs_extra_1.copySync)(sourcePath, destPath);
|
|
380
321
|
}
|
|
322
|
+
if (this.shouldBuildTests) {
|
|
323
|
+
(0, fs_extra_1.writeFileSync)((0, path_1.join)(outputPath, 'testem.js'), `/*
|
|
324
|
+
* This is dummy file that exists for the sole purpose
|
|
325
|
+
* of allowing tests to run directly in the browser as
|
|
326
|
+
* well as by Testem.
|
|
327
|
+
*
|
|
328
|
+
* Testem is configured to run tests directly against
|
|
329
|
+
* the test build of index.html, which requires a
|
|
330
|
+
* snippet to load the testem.js file:
|
|
331
|
+
* <script src="/testem.js"></script>
|
|
332
|
+
* This has to go before the qunit framework and app
|
|
333
|
+
* tests are loaded.
|
|
334
|
+
*
|
|
335
|
+
* Testem internally supplies this file. However, if you
|
|
336
|
+
* run the tests directly in the browser (localhost:8000/tests),
|
|
337
|
+
* this file does not exist.
|
|
338
|
+
*
|
|
339
|
+
* Hence the purpose of this fake file. This file is served
|
|
340
|
+
* directly from the express server to satisify the script load.
|
|
341
|
+
*/`);
|
|
342
|
+
this._publicAssets['/testem.js'] = './testem.js';
|
|
343
|
+
}
|
|
381
344
|
let remapAsset = this.remapAsset.bind(this);
|
|
382
345
|
let addonMeta = {
|
|
383
346
|
type: 'addon',
|
|
@@ -440,7 +403,7 @@ class CompatApp {
|
|
|
440
403
|
};
|
|
441
404
|
let assetPath = (0, path_1.join)(outputPath, 'assets');
|
|
442
405
|
if ((0, fs_extra_1.pathExistsSync)(assetPath)) {
|
|
443
|
-
for (let file of (0,
|
|
406
|
+
for (let file of (0, walk_sync_1.default)(assetPath, { directories: false })) {
|
|
444
407
|
addonMeta['public-assets'][`./assets/${file}`] = `/assets/${file}`;
|
|
445
408
|
}
|
|
446
409
|
}
|
|
@@ -488,19 +451,6 @@ class CompatApp {
|
|
|
488
451
|
}
|
|
489
452
|
return './' + asset;
|
|
490
453
|
}
|
|
491
|
-
preprocessJS(tree) {
|
|
492
|
-
// we're saving all our babel compilation for the final stage packager
|
|
493
|
-
this.legacyEmberAppInstance.registry.remove('js', 'ember-cli-babel');
|
|
494
|
-
// auto-import is supported natively so we don't need it here
|
|
495
|
-
this.legacyEmberAppInstance.registry.remove('js', 'ember-auto-import-analyzer');
|
|
496
|
-
tree = (0, broccoli_funnel_1.default)(tree, { destDir: this.name });
|
|
497
|
-
tree = this.preprocessors.preprocessJs(tree, `/`, '/', {
|
|
498
|
-
annotation: 'v1-app-preprocess-js',
|
|
499
|
-
registry: this.legacyEmberAppInstance.registry,
|
|
500
|
-
});
|
|
501
|
-
tree = (0, broccoli_funnel_1.default)(tree, { srcDir: this.name });
|
|
502
|
-
return tree;
|
|
503
|
-
}
|
|
504
454
|
get htmlbarsPlugins() {
|
|
505
455
|
let plugins = (0, prepare_htmlbars_ast_plugins_1.default)(this.legacyEmberAppInstance.registry);
|
|
506
456
|
// even if the app was using @embroider/macros, we drop it from the config
|
|
@@ -508,25 +458,6 @@ class CompatApp {
|
|
|
508
458
|
plugins = plugins.filter((p) => !(0, node_1.isEmbroiderMacrosPlugin)(p));
|
|
509
459
|
return plugins;
|
|
510
460
|
}
|
|
511
|
-
// our own appTree. Not to be confused with the one that combines the app js
|
|
512
|
-
// from all addons too.
|
|
513
|
-
get appTree() {
|
|
514
|
-
return this.preprocessJS((0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.app, {
|
|
515
|
-
exclude: ['styles/**', '*.html'],
|
|
516
|
-
}));
|
|
517
|
-
}
|
|
518
|
-
get testsTree() {
|
|
519
|
-
if (this.shouldBuildTests && this.legacyEmberAppInstance.trees.tests) {
|
|
520
|
-
return this.preprocessJS((0, broccoli_funnel_1.default)(this.legacyEmberAppInstance.trees.tests, {
|
|
521
|
-
destDir: 'tests',
|
|
522
|
-
}));
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
get lintTree() {
|
|
526
|
-
if (this.shouldBuildTests) {
|
|
527
|
-
return this.legacyEmberAppInstance.getLintTests();
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
461
|
get vendorTree() {
|
|
531
462
|
return this.ensureTree(this.legacyEmberAppInstance.trees.vendor);
|
|
532
463
|
}
|
|
@@ -550,69 +481,6 @@ class CompatApp {
|
|
|
550
481
|
get preprocessors() {
|
|
551
482
|
return this.requireFromEmberCLI('ember-cli-preprocess-registry/preprocessors');
|
|
552
483
|
}
|
|
553
|
-
get publicTree() {
|
|
554
|
-
return this.ensureTree(this.legacyEmberAppInstance.trees.public);
|
|
555
|
-
}
|
|
556
|
-
processAppJS() {
|
|
557
|
-
let appTree = this.appTree;
|
|
558
|
-
let testsTree = this.testsTree;
|
|
559
|
-
let lintTree = this.lintTree;
|
|
560
|
-
let config = new v1_config_1.WriteV1Config(this.config, this.storeConfigInMeta, this.testConfig);
|
|
561
|
-
let patterns = this.configReplacePatterns;
|
|
562
|
-
let configReplaced = new this.configReplace(config, this.configTree, {
|
|
563
|
-
configPath: (0, path_1.join)('environments', `${this.legacyEmberAppInstance.env}.json`),
|
|
564
|
-
files: ['config/environment.js'],
|
|
565
|
-
patterns,
|
|
566
|
-
});
|
|
567
|
-
let trees = [];
|
|
568
|
-
trees.push(appTree);
|
|
569
|
-
trees.push(new synthesize_template_only_components_1.default(appTree, { allowedPaths: ['components'], templateExtensions: ['.hbs'] }));
|
|
570
|
-
trees.push(configReplaced);
|
|
571
|
-
if (testsTree) {
|
|
572
|
-
trees.push(testsTree);
|
|
573
|
-
}
|
|
574
|
-
if (lintTree) {
|
|
575
|
-
trees.push(lintTree);
|
|
576
|
-
}
|
|
577
|
-
return {
|
|
578
|
-
appJS: (0, broccoli_merge_trees_1.default)(trees, { overwrite: true }),
|
|
579
|
-
};
|
|
580
|
-
}
|
|
581
|
-
withoutRootURL(src) {
|
|
582
|
-
let rootURL = this.config.readConfig().rootURL;
|
|
583
|
-
if ((src.startsWith(rootURL) && rootURL) || (!rootURL && !src.startsWith('/'))) {
|
|
584
|
-
src = '/' + src.slice(rootURL.length);
|
|
585
|
-
}
|
|
586
|
-
else if (src.startsWith('/' + rootURL)) {
|
|
587
|
-
src = src.slice(rootURL.length);
|
|
588
|
-
}
|
|
589
|
-
return src;
|
|
590
|
-
}
|
|
591
|
-
findAppScript(scripts, entrypoint) {
|
|
592
|
-
let appJS = scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.app.js);
|
|
593
|
-
return throwIfMissing(appJS, this.legacyEmberAppInstance.options.outputPaths.app.js, scripts.map(s => s.src), entrypoint, 'app javascript');
|
|
594
|
-
}
|
|
595
|
-
findAppStyles(styles, entrypoint) {
|
|
596
|
-
let style = styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.app.css.app);
|
|
597
|
-
return throwIfMissing(style, this.legacyEmberAppInstance.options.outputPaths.app.css.app, styles.map(s => s.href), entrypoint, 'app css');
|
|
598
|
-
}
|
|
599
|
-
findVendorScript(scripts, entrypoint) {
|
|
600
|
-
let vendor = scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.vendor.js);
|
|
601
|
-
return throwIfMissing(vendor, this.legacyEmberAppInstance.options.outputPaths.vendor.js, scripts.map(s => s.src), entrypoint, 'vendor javascript');
|
|
602
|
-
}
|
|
603
|
-
findVendorStyles(styles, entrypoint) {
|
|
604
|
-
let vendorStyle = styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.vendor.css);
|
|
605
|
-
return throwIfMissing(vendorStyle, this.legacyEmberAppInstance.options.outputPaths.vendor.css, styles.map(s => s.href), entrypoint, 'vendor css');
|
|
606
|
-
}
|
|
607
|
-
findTestSupportStyles(styles) {
|
|
608
|
-
return styles.find(style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.testSupport.css);
|
|
609
|
-
}
|
|
610
|
-
findTestSupportScript(scripts) {
|
|
611
|
-
return scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.testSupport.js.testSupport);
|
|
612
|
-
}
|
|
613
|
-
findTestScript(scripts) {
|
|
614
|
-
return scripts.find(script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.tests.js);
|
|
615
|
-
}
|
|
616
484
|
constructor(legacyEmberAppInstance, _options) {
|
|
617
485
|
this.legacyEmberAppInstance = legacyEmberAppInstance;
|
|
618
486
|
this.annotation = '@embroider/compat/app';
|
|
@@ -640,17 +508,11 @@ class CompatApp {
|
|
|
640
508
|
});
|
|
641
509
|
}
|
|
642
510
|
inTrees(prevStageTree) {
|
|
643
|
-
let publicTree = this.publicTree;
|
|
644
511
|
let configTree = this.config;
|
|
645
|
-
|
|
646
|
-
publicTree = (0, broccoli_merge_trees_1.default)([publicTree, ...this.options.extraPublicTrees].filter(Boolean));
|
|
647
|
-
}
|
|
512
|
+
let contentForTree = this.contentFor;
|
|
648
513
|
return {
|
|
649
|
-
appJS: this.processAppJS().appJS,
|
|
650
|
-
htmlTree: this.htmlTree,
|
|
651
|
-
publicTree,
|
|
652
514
|
configTree,
|
|
653
|
-
|
|
515
|
+
contentForTree,
|
|
654
516
|
prevStageTree,
|
|
655
517
|
};
|
|
656
518
|
}
|
|
@@ -666,25 +528,25 @@ class CompatApp {
|
|
|
666
528
|
return packageCache.get(this.root);
|
|
667
529
|
}
|
|
668
530
|
}
|
|
669
|
-
async instantiate(
|
|
531
|
+
async instantiate(packageCache, configTree, contentForTree) {
|
|
670
532
|
let origAppPkg = this.appPackage();
|
|
671
533
|
let movedAppPkg = packageCache.withRewrittenDeps(origAppPkg);
|
|
672
534
|
let workingDir = (0, core_1.locateEmbroiderWorkingDir)(this.root);
|
|
673
|
-
return new compat_app_builder_1.CompatAppBuilder(
|
|
535
|
+
return new compat_app_builder_1.CompatAppBuilder(origAppPkg, movedAppPkg, this.options, this, configTree, contentForTree, packageCache.get((0, path_1.join)(workingDir, 'rewritten-packages', '@embroider', 'synthesized-vendor')), packageCache.get((0, path_1.join)(workingDir, 'rewritten-packages', '@embroider', 'synthesized-styles')));
|
|
674
536
|
}
|
|
675
537
|
asStage(prevStage) {
|
|
676
538
|
let resolve;
|
|
677
539
|
let promise = new Promise(r => (resolve = r));
|
|
678
540
|
let tree = () => {
|
|
679
541
|
let inTrees = this.inTrees(prevStage.tree);
|
|
680
|
-
return new core_1.WaitForTrees(inTrees, this.annotation, async (
|
|
542
|
+
return new core_1.WaitForTrees(inTrees, this.annotation, async (_treePaths) => {
|
|
681
543
|
if (!this.active) {
|
|
682
544
|
let { outputPath } = await prevStage.ready();
|
|
683
545
|
let packageCache = core_1.RewrittenPackageCache.shared('embroider', this.root);
|
|
684
|
-
this.active = await this.instantiate(
|
|
546
|
+
this.active = await this.instantiate(packageCache, inTrees.configTree, inTrees.contentForTree);
|
|
685
547
|
resolve({ outputPath });
|
|
686
548
|
}
|
|
687
|
-
await this.active.build(
|
|
549
|
+
await this.active.build();
|
|
688
550
|
});
|
|
689
551
|
};
|
|
690
552
|
return {
|
|
@@ -724,13 +586,13 @@ __decorate([
|
|
|
724
586
|
], CompatApp.prototype, "testConfig", null);
|
|
725
587
|
__decorate([
|
|
726
588
|
(0, typescript_memoize_1.Memoize)()
|
|
727
|
-
], CompatApp.prototype, "
|
|
589
|
+
], CompatApp.prototype, "contentFor", null);
|
|
728
590
|
__decorate([
|
|
729
591
|
(0, typescript_memoize_1.Memoize)()
|
|
730
592
|
], CompatApp.prototype, "configReplacePatterns", null);
|
|
731
593
|
__decorate([
|
|
732
594
|
(0, typescript_memoize_1.Memoize)()
|
|
733
|
-
], CompatApp.prototype, "
|
|
595
|
+
], CompatApp.prototype, "extraBabelPlugins", null);
|
|
734
596
|
__decorate([
|
|
735
597
|
(0, typescript_memoize_1.Memoize)()
|
|
736
598
|
], CompatApp.prototype, "babelMajorVersion", null);
|
|
@@ -743,12 +605,4 @@ __decorate([
|
|
|
743
605
|
__decorate([
|
|
744
606
|
(0, typescript_memoize_1.Memoize)()
|
|
745
607
|
], CompatApp.prototype, "appPackage", null);
|
|
746
|
-
function throwIfMissing(asset, needle, haystack, entryfile, context) {
|
|
747
|
-
if (!asset) {
|
|
748
|
-
throw new Error(`Could not find ${context}: "${needle}" in ${entryfile}. Found the following instead:\n${haystack
|
|
749
|
-
.map(asset => ` - ${asset}`)
|
|
750
|
-
.join('\n')}\n\nFor more information about this error: https://github.com/thoov/stitch/wiki/Could-not-find-asset-in-entry-file-error-help`);
|
|
751
|
-
}
|
|
752
|
-
return asset;
|
|
753
|
-
}
|
|
754
608
|
//# sourceMappingURL=compat-app.js.map
|