@embroider/compat 3.5.1-unstable.bdf4aae → 3.5.1-unstable.c8b5bd4

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.
@@ -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,12 +14,8 @@ 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
21
  const ember_html_1 = require("@embroider/core/src/ember-html");
@@ -52,10 +25,9 @@ const portable_1 = require("@embroider/core/src/portable");
52
25
  const assert_never_1 = __importDefault(require("assert-never"));
53
26
  const typescript_memoize_1 = require("typescript-memoize");
54
27
  const path_2 = require("path");
55
- const resolve_2 = __importDefault(require("resolve"));
28
+ const resolve_1 = __importDefault(require("resolve"));
56
29
  const fs_extra_2 = require("fs-extra");
57
30
  const node_1 = require("@embroider/macros/src/node");
58
- const fast_sourcemap_concat_1 = __importDefault(require("fast-sourcemap-concat"));
59
31
  const escape_string_regexp_1 = __importDefault(require("escape-string-regexp"));
60
32
  const sync_dir_1 = require("./sync-dir");
61
33
  // This exists during the actual broccoli build step. As opposed to CompatApp,
@@ -83,36 +55,11 @@ class CompatAppBuilder {
83
55
  }
84
56
  extractAssets(treePaths) {
85
57
  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
58
  for (let asset of this.emberEntrypoints(treePaths.htmlTree)) {
95
59
  assets.push(asset);
96
60
  }
97
61
  return assets;
98
62
  }
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
63
  activeAddonChildren(pkg) {
117
64
  let result = pkg.dependencies.filter(this.isActiveAddon).filter(
118
65
  // When looking for child addons, we want to ignore 'peerDependencies' of
@@ -189,9 +136,7 @@ class CompatAppBuilder {
189
136
  javascript: this.compatApp.findAppScript(scripts, entrypoint),
190
137
  styles: this.compatApp.findAppStyles(styles, entrypoint),
191
138
  implicitScripts: this.compatApp.findVendorScript(scripts, entrypoint),
192
- implicitStyles: this.compatApp.findVendorStyles(styles, entrypoint),
193
139
  testJavascript: this.compatApp.findTestScript(scripts),
194
- implicitTestStyles: this.compatApp.findTestSupportStyles(styles),
195
140
  };
196
141
  },
197
142
  };
@@ -250,63 +195,18 @@ class CompatAppBuilder {
250
195
  // this is the additional stufff that @embroider/compat adds on top to do
251
196
  // global template resolving
252
197
  modulePrefix: this.modulePrefix(),
198
+ splitAtRoutes: this.options.splitAtRoutes,
253
199
  podModulePrefix: this.podModulePrefix(),
254
200
  activePackageRules: this.activeRules(),
255
201
  options,
202
+ autoRun: this.compatApp.autoRun,
203
+ staticAppPaths: this.options.staticAppPaths,
256
204
  };
257
205
  return config;
258
206
  }
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
207
  get resolvableExtensionsPattern() {
270
208
  return (0, core_1.extensionsPattern)(this.resolvableExtensions());
271
209
  }
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
210
  async babelConfig(resolverConfig) {
311
211
  let babel = (0, cloneDeep_1.default)(this.compatApp.babelConfig());
312
212
  if (!babel.plugins) {
@@ -385,8 +285,7 @@ class CompatAppBuilder {
385
285
  // our tests entrypoint already includes a correct module dependency on the
386
286
  // app, so we only insert the app when we're not inserting tests
387
287
  if (!asset.fileAsset.includeTests) {
388
- let appJS = this.topAppJSAsset(appFiles, prepared);
389
- html.insertScriptTag(html.javascript, appJS.relativePath, { type: 'module' });
288
+ html.insertScriptTag(html.javascript, '@embroider/core/entrypoint', { type: 'module' });
390
289
  }
391
290
  if (this.fastbootConfig) {
392
291
  // any extra fastboot app files get inserted into our html.javascript
@@ -404,15 +303,12 @@ class CompatAppBuilder {
404
303
  html.insertScriptTag(html.implicitScripts, script, { tag: 'fastboot-script' });
405
304
  }
406
305
  }
407
- // virtual vendor.css entrypoint
408
- html.insertStyleLink(html.implicitStyles, '@embroider/core/vendor.css');
409
306
  if (!asset.fileAsset.includeTests) {
410
307
  return;
411
308
  }
412
309
  // Test-related assets happen below this point
413
310
  let testJS = this.testJSEntrypoint(appFiles, prepared);
414
311
  html.insertScriptTag(html.testJavascript, testJS.relativePath, { type: 'module' });
415
- html.insertStyleLink(html.implicitTestStyles, '@embroider/core/test-support.css');
416
312
  }
417
313
  // recurse to find all active addons that don't cross an engine boundary.
418
314
  // Inner engines themselves will be returned, but not those engines' children.
@@ -529,9 +425,14 @@ class CompatAppBuilder {
529
425
  }
530
426
  return this.engines.map(({ engine, appSync, fastbootSync }) => {
531
427
  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());
428
+ 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());
533
429
  });
534
430
  }
431
+ get staticAppPathsPattern() {
432
+ if (this.options.staticAppPaths.length > 0) {
433
+ return new RegExp('^(?:' + this.options.staticAppPaths.map(staticAppPath => (0, escape_string_regexp_1.default)(staticAppPath)).join('|') + ')(?:$|/)');
434
+ }
435
+ }
535
436
  prepareAsset(asset, appFiles, prepared) {
536
437
  if (asset.kind === 'ember') {
537
438
  let prior = this.assets.get(asset.relativePath);
@@ -569,13 +470,6 @@ class CompatAppBuilder {
569
470
  return prior.kind === 'in-memory' && stringOrBufferEqual(prior.source, asset.source);
570
471
  case 'built-ember':
571
472
  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
473
  }
580
474
  }
581
475
  updateOnDiskAsset(asset) {
@@ -593,33 +487,6 @@ class CompatAppBuilder {
593
487
  (0, fs_extra_2.ensureDirSync)((0, path_2.dirname)(destination));
594
488
  (0, fs_extra_1.writeFileSync)(destination, asset.source, 'utf8');
595
489
  }
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,
601
- });
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
- }
623
490
  async updateAssets(requestedAssets, appFiles) {
624
491
  let assets = this.prepareAssets(requestedAssets, appFiles);
625
492
  for (let asset of assets.values()) {
@@ -637,9 +504,6 @@ class CompatAppBuilder {
637
504
  case 'built-ember':
638
505
  this.updateBuiltEmberAsset(asset);
639
506
  break;
640
- case 'concatenated-asset':
641
- await this.updateConcatenatedAsset(asset);
642
- break;
643
507
  default:
644
508
  (0, assert_never_1.default)(asset);
645
509
  }
@@ -650,7 +514,6 @@ class CompatAppBuilder {
650
514
  }
651
515
  }
652
516
  this.assets = assets;
653
- return [...assets.values()];
654
517
  }
655
518
  gatherAssets(inputPaths) {
656
519
  // first gather all the assets out of addons
@@ -684,20 +547,12 @@ class CompatAppBuilder {
684
547
  }
685
548
  let appFiles = this.updateAppJS(inputPaths.appJS);
686
549
  let assets = this.gatherAssets(inputPaths);
687
- let finalAssets = await this.updateAssets(assets, appFiles);
550
+ await this.updateAssets(assets, appFiles);
688
551
  let assetPaths = assets.map(asset => asset.relativePath);
689
552
  if (this.activeFastboot) {
690
553
  // when using fastboot, our own package.json needs to be in the output so fastboot can read it.
691
554
  assetPaths.push('package.json');
692
555
  }
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
556
  let meta = {
702
557
  type: 'app',
703
558
  version: 2,
@@ -718,6 +573,7 @@ class CompatAppBuilder {
718
573
  this.addResolverConfig(resolverConfig);
719
574
  this.addContentForConfig(this.contentForTree.readContents());
720
575
  this.addEmberEnvConfig(this.configTree.readConfig().EmberENV);
576
+ this.addAppBoot(this.compatApp.appBoot.readAppBoot());
721
577
  let babelConfig = await this.babelConfig(resolverConfig);
722
578
  this.addBabelConfig(babelConfig);
723
579
  (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 +624,7 @@ class CompatAppBuilder {
768
624
  if (i < hint.resolve.length - 1) {
769
625
  target = (0, path_2.join)(target, 'package.json');
770
626
  }
771
- cursor = resolve_2.default.sync(target, { basedir: (0, path_2.dirname)(cursor) });
627
+ cursor = resolve_1.default.sync(target, { basedir: (0, path_2.dirname)(cursor) });
772
628
  }
773
629
  return {
774
630
  requireFile: cursor,
@@ -797,179 +653,8 @@ class CompatAppBuilder {
797
653
  spaces: 2,
798
654
  });
799
655
  }
800
- shouldSplitRoute(routeName) {
801
- return (!this.options.splitAtRoutes ||
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;
656
+ addAppBoot(appBoot) {
657
+ (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 : '');
973
658
  }
974
659
  importPaths({ engine }, engineRelativePath) {
975
660
  let noHBS = engineRelativePath.replace(this.resolvableExtensionsPattern, '').replace(/\.hbs$/, '');
@@ -978,18 +663,6 @@ class CompatAppBuilder {
978
663
  buildtime: path_1.posix.join(engine.package.name, engineRelativePath),
979
664
  };
980
665
  }
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
666
  testJSEntrypoint(appFiles, prepared) {
994
667
  let asset = prepared.get(`assets/test.js`);
995
668
  if (asset) {
@@ -1000,22 +673,12 @@ class CompatAppBuilder {
1000
673
  // the app.
1001
674
  let engine = appFiles[0];
1002
675
  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
676
  let amdModules = [];
1013
677
  for (let relativePath of engine.tests) {
1014
678
  amdModules.push(this.importPaths(engine, relativePath));
1015
679
  }
1016
680
  let source = entryTemplate({
1017
681
  amdModules,
1018
- eagerModules,
1019
682
  testSuffix: true,
1020
683
  // this is a backward-compatibility feature: addons can force inclusion of test support modules.
1021
684
  defineModulesFrom: './-embroider-implicit-test-modules.js',
@@ -1033,9 +696,6 @@ exports.CompatAppBuilder = CompatAppBuilder;
1033
696
  __decorate([
1034
697
  (0, typescript_memoize_1.Memoize)()
1035
698
  ], CompatAppBuilder.prototype, "fastbootJSSrcDir", null);
1036
- __decorate([
1037
- (0, typescript_memoize_1.Memoize)()
1038
- ], CompatAppBuilder.prototype, "findTestemAsset", null);
1039
699
  __decorate([
1040
700
  (0, typescript_memoize_1.Memoize)()
1041
701
  ], CompatAppBuilder.prototype, "allActiveAddons", null);
@@ -1062,10 +722,10 @@ __decorate([
1062
722
  ], CompatAppBuilder.prototype, "fastbootConfig", null);
1063
723
  __decorate([
1064
724
  (0, typescript_memoize_1.Memoize)()
1065
- ], CompatAppBuilder.prototype, "portableHints", null);
725
+ ], CompatAppBuilder.prototype, "staticAppPathsPattern", null);
1066
726
  __decorate([
1067
727
  (0, typescript_memoize_1.Memoize)()
1068
- ], CompatAppBuilder.prototype, "staticAppPathsPattern", null);
728
+ ], CompatAppBuilder.prototype, "portableHints", null);
1069
729
  function defaultAddonPackageRules() {
1070
730
  return (0, fs_extra_2.readdirSync)((0, path_2.join)(__dirname, 'addon-dependency-rules'))
1071
731
  .map(filename => {
@@ -1099,9 +759,8 @@ let d = w.define;
1099
759
  {{/if}}
1100
760
 
1101
761
 
1102
- {{#each eagerModules as |eagerModule| ~}}
1103
- i("{{js-string-escape eagerModule}}");
1104
- {{/each}}
762
+ import "ember-testing";
763
+ import "@embroider/core/entrypoint";
1105
764
 
1106
765
  {{#each amdModules as |amdModule| ~}}
1107
766
  d("{{js-string-escape amdModule.runtime}}", function(){ return i("{{js-string-escape amdModule.buildtime}}");});
@@ -1168,21 +827,6 @@ if (!runningTests) {
1168
827
  EmberENV.TESTS_FILE_LOADED = true;
1169
828
  {{/if}}
1170
829
  `);
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
830
  function stringOrBufferEqual(a, b) {
1187
831
  if (typeof a === 'string' && typeof b === 'string') {
1188
832
  return a === b;
@@ -1231,9 +875,6 @@ function addCachablePlugin(babelConfig) {
1231
875
  ]);
1232
876
  }
1233
877
  }
1234
- function excludeDotFiles(files) {
1235
- return files.filter(file => !file.startsWith('.') && !file.includes('/.'));
1236
- }
1237
878
  class ParsedEmberAsset {
1238
879
  constructor(asset) {
1239
880
  this.kind = 'parsed-ember';
@@ -1253,15 +894,4 @@ class BuiltEmberAsset {
1253
894
  this.relativePath = asset.relativePath;
1254
895
  }
1255
896
  }
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
897
  //# sourceMappingURL=compat-app-builder.js.map