@embroider/core 3.4.14 → 3.4.15-unstable.024270b

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.
Files changed (42) hide show
  1. package/package.json +8 -5
  2. package/src/app-files.d.ts +3 -4
  3. package/src/app-files.js +24 -5
  4. package/src/app-files.js.map +1 -1
  5. package/src/index.d.ts +1 -2
  6. package/src/index.js.map +1 -1
  7. package/src/module-resolver.d.ts +31 -15
  8. package/src/module-resolver.js +361 -193
  9. package/src/module-resolver.js.map +1 -1
  10. package/src/node-resolve.d.ts +33 -0
  11. package/src/node-resolve.js +131 -0
  12. package/src/node-resolve.js.map +1 -0
  13. package/src/virtual-content.d.ts +6 -2
  14. package/src/virtual-content.js +119 -42
  15. package/src/virtual-content.js.map +1 -1
  16. package/src/virtual-entrypoint.d.ts +19 -0
  17. package/src/virtual-entrypoint.js +289 -0
  18. package/src/virtual-entrypoint.js.map +1 -0
  19. package/src/virtual-route-entrypoint.d.ts +15 -0
  20. package/src/virtual-route-entrypoint.js +101 -0
  21. package/src/virtual-route-entrypoint.js.map +1 -0
  22. package/src/virtual-test-entrypoint.d.ts +10 -0
  23. package/src/virtual-test-entrypoint.js +66 -0
  24. package/src/virtual-test-entrypoint.js.map +1 -0
  25. package/src/virtual-test-support-styles.d.ts +4 -0
  26. package/src/virtual-test-support-styles.js +64 -0
  27. package/src/virtual-test-support-styles.js.map +1 -0
  28. package/src/virtual-test-support.d.ts +4 -0
  29. package/src/virtual-test-support.js +68 -0
  30. package/src/virtual-test-support.js.map +1 -0
  31. package/src/virtual-vendor-styles.d.ts +4 -0
  32. package/src/virtual-vendor-styles.js +82 -0
  33. package/src/virtual-vendor-styles.js.map +1 -0
  34. package/src/virtual-vendor.d.ts +4 -0
  35. package/src/virtual-vendor.js +72 -0
  36. package/src/virtual-vendor.js.map +1 -0
  37. package/src/asset.d.ts +0 -32
  38. package/src/asset.js +0 -3
  39. package/src/asset.js.map +0 -1
  40. package/src/ember-html.d.ts +0 -43
  41. package/src/ember-html.js +0 -110
  42. package/src/ember-html.js.map +0 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@embroider/core",
3
- "version": "3.4.14",
3
+ "version": "3.4.15-unstable.024270b",
4
4
  "private": false,
5
5
  "description": "A build system for EmberJS applications.",
6
6
  "repository": {
@@ -27,6 +27,7 @@
27
27
  "broccoli-plugin": "^4.0.7",
28
28
  "broccoli-source": "^3.0.1",
29
29
  "debug": "^4.3.2",
30
+ "escape-string-regexp": "^4.0.0",
30
31
  "fast-sourcemap-concat": "^2.1.1",
31
32
  "filesize": "^10.0.7",
32
33
  "fs-extra": "^9.1.0",
@@ -37,10 +38,12 @@
37
38
  "lodash": "^4.17.21",
38
39
  "resolve": "^1.20.0",
39
40
  "resolve-package-path": "^4.0.1",
41
+ "resolve.exports": "^2.0.2",
40
42
  "typescript-memoize": "^1.0.1",
41
43
  "walk-sync": "^3.0.0",
42
- "@embroider/shared-internals": "2.6.2",
43
- "@embroider/macros": "1.16.5"
44
+ "@embroider/macros": "1.16.6-unstable.024270b",
45
+ "@embroider/shared-internals": "2.6.3-unstable.024270b",
46
+ "@embroider/reverse-exports": "0.1.1-unstable.024270b"
44
47
  },
45
48
  "devDependencies": {
46
49
  "@glimmer/syntax": "^0.84.2",
@@ -49,15 +52,15 @@
49
52
  "@types/babel__traverse": "^7.18.5",
50
53
  "@types/debug": "^4.1.5",
51
54
  "@types/fs-extra": "^9.0.12",
52
- "@types/jsdom": "^16.2.11",
53
55
  "@types/js-string-escape": "^1.0.0",
56
+ "@types/jsdom": "^16.2.11",
54
57
  "@types/lodash": "^4.14.170",
55
58
  "@types/node": "^15.12.2",
56
59
  "@types/resolve": "^1.20.0",
57
60
  "@types/tmp": "^0.1.0",
58
61
  "fixturify": "^2.1.1",
59
62
  "tmp": "^0.1.0",
60
- "typescript": "^5.1.6",
63
+ "typescript": "^5.4.5",
61
64
  "@embroider/sample-transforms": "0.0.0",
62
65
  "@embroider/test-support": "0.36.0"
63
66
  },
@@ -20,16 +20,15 @@ export declare class AppFiles {
20
20
  shadowedFilename: string | undefined;
21
21
  };
22
22
  };
23
- constructor(engine: Engine, appFiles: Set<string>, fastbootFiles: Set<string>, resolvableExtensions: RegExp, podModulePrefix?: string);
23
+ constructor(engine: Engine, appFiles: Set<string>, fastbootFiles: Set<string>, resolvableExtensions: RegExp, staticAppPathsPattern: RegExp | undefined, podModulePrefix?: string);
24
24
  private handleClassicRouteFile;
25
25
  private handlePodsRouteFile;
26
26
  get routeFiles(): Readonly<RouteFiles>;
27
27
  }
28
28
  export interface Engine {
29
29
  package: Package;
30
- addons: Set<AddonPackage>;
31
- parent: Engine | undefined;
32
- sourcePath: string;
30
+ addons: Map<AddonPackage, string>;
31
+ isApp: boolean;
33
32
  modulePrefix: string;
34
33
  appRelativePath: string;
35
34
  }
package/src/app-files.js CHANGED
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AppFiles = void 0;
4
4
  const path_1 = require("path");
5
5
  class AppFiles {
6
- constructor(engine, appFiles, fastbootFiles, resolvableExtensions, podModulePrefix) {
6
+ constructor(engine, appFiles, fastbootFiles, resolvableExtensions, staticAppPathsPattern, podModulePrefix) {
7
7
  this.engine = engine;
8
8
  let tests = [];
9
9
  let components = [];
@@ -21,7 +21,7 @@ class AppFiles {
21
21
  for (let f of fastbootFiles) {
22
22
  combinedFiles.add(f);
23
23
  }
24
- for (let addon of engine.addons) {
24
+ for (let addon of engine.addons.keys()) {
25
25
  let appJS = addon.meta['app-js'];
26
26
  if (appJS) {
27
27
  for (let filename of Object.keys(appJS)) {
@@ -54,13 +54,25 @@ class AppFiles {
54
54
  continue;
55
55
  }
56
56
  if (relativePath.startsWith('components/')) {
57
- // hbs files are resolvable, but not when they're used via co-location.
57
+ // hbs files are not resolvable when they're used via co-location with
58
+ // an associated js file because it's the js that is resolvable.
58
59
  // An hbs file is used via colocation when it's inside the components
59
60
  // directory, and also not named "template.hbs" (because that is an
60
61
  // older pattern used with pods-like layouts).
61
- if (!relativePath.endsWith('.hbs') || relativePath.endsWith('/template.hbs')) {
62
+ let isHbs = relativePath.endsWith('.hbs');
63
+ if (!isHbs || relativePath.endsWith('/template.hbs')) {
62
64
  components.push(relativePath);
63
65
  }
66
+ else if (isHbs) {
67
+ // template-only components will be compiled as js files during the
68
+ // build process, so we push a virtual path to js in the list of files
69
+ // because the resolver will be able to recognize a template-only and
70
+ // give a correct answer in the end.
71
+ let jsPath = relativePath.replace(/\.hbs$/, '.js');
72
+ if (!combinedFiles.has(jsPath)) {
73
+ components.push(jsPath);
74
+ }
75
+ }
64
76
  continue;
65
77
  }
66
78
  if (relativePath.startsWith('templates/components/')) {
@@ -79,7 +91,14 @@ class AppFiles {
79
91
  this.handleClassicRouteFile(relativePath)) {
80
92
  continue;
81
93
  }
82
- otherAppFiles.push(relativePath);
94
+ if (staticAppPathsPattern) {
95
+ if (!staticAppPathsPattern.test(relativePath)) {
96
+ otherAppFiles.push(relativePath);
97
+ }
98
+ }
99
+ else {
100
+ otherAppFiles.push(relativePath);
101
+ }
83
102
  }
84
103
  this.tests = tests;
85
104
  this.components = components;
@@ -1 +1 @@
1
- {"version":3,"file":"app-files.js","sourceRoot":"","sources":["app-files.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAU3B,MAAa,QAAQ;IAUnB,YACW,MAAc,EACvB,QAAqB,EACrB,aAA0B,EAC1B,oBAA4B,EAC5B,eAAwB;QAJf,WAAM,GAAN,MAAM,CAAQ;QAMvB,IAAI,KAAK,GAAa,EAAE,CAAC;QACzB,IAAI,UAAU,GAAa,EAAE,CAAC;QAC9B,IAAI,OAAO,GAAa,EAAE,CAAC;QAC3B,IAAI,SAAS,GAAa,EAAE,CAAC;QAC7B,IAAI,aAAa,GAAa,EAAE,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;QAExC,IAAI,aA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7B,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC;gBAC9B,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC3B,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,IAAI,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACtC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,GAAG,KAAK,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACN,IAAI,QAAQ,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;gBACvC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBACpC,MAAM,GAAG,QAAQ,CAAC;YACpB,CAAC;QACH,CAAC;QACD,MAAM,CAAC,IAA2C,CAAC,GAAG,YAAY,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AA7LD,4BA6LC","sourcesContent":["import { sep } from 'path';\nimport type { Package, AddonPackage } from '@embroider/shared-internals';\n\nexport interface RouteFiles {\n route?: string;\n template?: string;\n controller?: string;\n children: Map<string, RouteFiles>;\n}\n\nexport class AppFiles {\n readonly tests: ReadonlyArray<string>;\n readonly components: ReadonlyArray<string>;\n readonly helpers: ReadonlyArray<string>;\n readonly modifiers: ReadonlyArray<string>;\n private perRoute: RouteFiles;\n readonly otherAppFiles: ReadonlyArray<string>;\n readonly isFastbootOnly: Map<string, boolean>;\n readonly fastbootFiles: { [appName: string]: { localFilename: string; shadowedFilename: string | undefined } };\n\n constructor(\n readonly engine: Engine,\n appFiles: Set<string>,\n fastbootFiles: Set<string>,\n resolvableExtensions: RegExp,\n podModulePrefix?: string\n ) {\n let tests: string[] = [];\n let components: string[] = [];\n let helpers: string[] = [];\n let modifiers: string[] = [];\n let otherAppFiles: string[] = [];\n this.perRoute = { children: new Map() };\n\n let combinedFiles = new Set<string>();\n let combinedNonFastbootFiles = new Set<string>();\n let isFastbootOnly = new Map<string, boolean>();\n\n for (let f of appFiles) {\n combinedFiles.add(f);\n combinedNonFastbootFiles.add(f);\n }\n for (let f of fastbootFiles) {\n combinedFiles.add(f);\n }\n\n for (let addon of engine.addons) {\n let appJS = addon.meta['app-js'];\n if (appJS) {\n for (let filename of Object.keys(appJS)) {\n filename = filename.replace(/^\\.\\//, '');\n combinedFiles.add(filename);\n combinedNonFastbootFiles.add(filename);\n }\n }\n\n let fastbootJS = addon.meta['fastboot-js'];\n if (fastbootJS) {\n for (let filename of Object.keys(fastbootJS)) {\n filename = filename.replace(/^\\.\\//, '');\n combinedFiles.add(filename);\n }\n }\n }\n\n for (let relativePath of combinedFiles) {\n isFastbootOnly.set(relativePath, !combinedNonFastbootFiles.has(relativePath));\n relativePath = relativePath.split(sep).join('/');\n if (!resolvableExtensions.test(relativePath)) {\n continue;\n }\n\n if (/\\.d\\.ts$/.test(relativePath)) {\n // .d.ts files are technically \"*.ts\" files but aren't really and we\n // don't want to include them when we crawl through the app.\n continue;\n }\n\n if (relativePath.startsWith('tests/')) {\n tests.push(relativePath);\n continue;\n }\n\n if (relativePath.startsWith('components/')) {\n // hbs files are resolvable, but not when they're used via co-location.\n // An hbs file is used via colocation when it's inside the components\n // directory, and also not named \"template.hbs\" (because that is an\n // older pattern used with pods-like layouts).\n if (!relativePath.endsWith('.hbs') || relativePath.endsWith('/template.hbs')) {\n components.push(relativePath);\n }\n continue;\n }\n\n if (relativePath.startsWith('templates/components/')) {\n components.push(relativePath);\n continue;\n }\n\n if (relativePath.startsWith('helpers/')) {\n helpers.push(relativePath);\n continue;\n }\n\n if (relativePath.startsWith('modifiers/')) {\n modifiers.push(relativePath);\n continue;\n }\n\n if (\n (podModulePrefix !== undefined && this.handlePodsRouteFile(relativePath, podModulePrefix)) ||\n this.handleClassicRouteFile(relativePath)\n ) {\n continue;\n }\n\n otherAppFiles.push(relativePath);\n }\n this.tests = tests;\n this.components = components;\n this.helpers = helpers;\n this.modifiers = modifiers;\n this.otherAppFiles = otherAppFiles;\n this.isFastbootOnly = isFastbootOnly;\n\n // this deliberately only describes the app's fastboot files. Not the full\n // merge from all the addons. This is because they need different handling\n // in the module resolver -- addon fastboot files can always be a\n // fallbackResolve, because if the app happens to define the same name\n // (whether fastboot-specific or just browser) that wins over the addon.\n // Whereas if the app itself defines a fastbot-specific version of a file,\n // that must take precedence over the *normal* resolution, and must be\n // implemented in beforeResolve.\n this.fastbootFiles = Object.fromEntries(\n [...fastbootFiles].map(name => [\n `./${name}`,\n {\n localFilename: `./_fastboot_/${name}`,\n shadowedFilename: appFiles.has(name) ? `./${name}` : undefined,\n },\n ])\n );\n }\n\n private handleClassicRouteFile(relativePath: string): boolean {\n let [prefix, ...rest] = relativePath.replace(/\\.\\w{1,3}$/, '').split('/');\n if (!['controllers', 'templates', 'routes'].includes(prefix)) {\n return false;\n }\n let type = prefix.slice(0, -1) as 'controller' | 'template' | 'route';\n let cursor = this.perRoute;\n for (let part of rest) {\n let child = cursor.children.get(part);\n if (child) {\n cursor = child;\n } else {\n let newEntry = { children: new Map() };\n cursor.children.set(part, newEntry);\n cursor = newEntry;\n }\n }\n cursor[type] = relativePath;\n return true;\n }\n\n private handlePodsRouteFile(relativePath: string, podModulePrefix: string): boolean {\n let parts = relativePath.replace(/\\.\\w{1,3}$/, '').split('/');\n let type = parts.pop();\n if (!type || !['controller', 'template', 'route'].includes(type)) {\n return false;\n }\n let podParts = podModulePrefix.split('/');\n // The first part of podModulePrefix is the app's package name\n podParts.shift();\n\n for (let podPart of podParts) {\n if (parts.shift() !== podPart) {\n return false;\n }\n }\n\n let cursor = this.perRoute;\n for (let part of parts) {\n let child = cursor.children.get(part);\n if (child) {\n cursor = child;\n } else {\n let newEntry = { children: new Map() };\n cursor.children.set(part, newEntry);\n cursor = newEntry;\n }\n }\n cursor[type as 'controller' | 'template' | 'route'] = relativePath;\n return true;\n }\n\n get routeFiles(): Readonly<RouteFiles> {\n return this.perRoute;\n }\n}\n\nexport interface Engine {\n // the engine's own package\n package: Package;\n // the set of active addons in the engine\n addons: Set<AddonPackage>;\n // the parent engine, if any\n parent: Engine | undefined;\n // where the engine's own V2 code comes from\n sourcePath: string;\n // runtime name for the engine's own module namespace\n modulePrefix: string;\n // this is destPath but relative to the app itself\n appRelativePath: string;\n}\n"]}
1
+ {"version":3,"file":"app-files.js","sourceRoot":"","sources":["app-files.ts"],"names":[],"mappings":";;;AAAA,+BAA2B;AAU3B,MAAa,QAAQ;IAUnB,YACW,MAAc,EACvB,QAAqB,EACrB,aAA0B,EAC1B,oBAA4B,EAC5B,qBAAyC,EACzC,eAAwB;QALf,WAAM,GAAN,MAAM,CAAQ;QAOvB,IAAI,KAAK,GAAa,EAAE,CAAC;QACzB,IAAI,UAAU,GAAa,EAAE,CAAC;QAC9B,IAAI,OAAO,GAAa,EAAE,CAAC;QAC3B,IAAI,SAAS,GAAa,EAAE,CAAC;QAC7B,IAAI,aAAa,GAAa,EAAE,CAAC;QACjC,IAAI,CAAC,QAAQ,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;QAExC,IAAI,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;QACtC,IAAI,wBAAwB,GAAG,IAAI,GAAG,EAAU,CAAC;QACjD,IAAI,cAAc,GAAG,IAAI,GAAG,EAAmB,CAAC;QAEhD,KAAK,IAAI,CAAC,IAAI,QAAQ,EAAE,CAAC;YACvB,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;YACrB,wBAAwB,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QAClC,CAAC;QACD,KAAK,IAAI,CAAC,IAAI,aAAa,EAAE,CAAC;YAC5B,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;QACvB,CAAC;QAED,KAA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CAAC;QACD,IAAI,QAAQ,GAAG,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC1C,8DAA8D;QAC9D,QAAQ,CAAC,KAAK,EAAE,CAAC;QAEjB,KAAK,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC7B,IAAI,KAAK,CAAC,KAAK,EAAE,KAAK,OAAO,EAAE,CAAC;gBAC9B,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QAED,IAAI,MAAM,GAAG,IAAI,CAAC,QAAQ,CAAC;QAC3B,KAAK,IAAI,IAAI,IAAI,KAAK,EAAE,CAAC;YACvB,IAAI,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACtC,IAAI,KAAK,EAAE,CAAC;gBACV,MAAM,GAAG,KAAK,CAAC;YACjB,CAAC;iBAAM,CAAC;gBACN,IAAI,QAAQ,GAAG,EAAE,QAAQ,EAAE,IAAI,GAAG,EAAE,EAAE,CAAC;gBACvC,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;gBACpC,MAAM,GAAG,QAAQ,CAAC;YACpB,CAAC;QACH,CAAC;QACD,MAAM,CAAC,IAA2C,CAAC,GAAG,YAAY,CAAC;QACnE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;CACF;AA/MD,4BA+MC","sourcesContent":["import { sep } from 'path';\nimport type { Package, AddonPackage } from '@embroider/shared-internals';\n\nexport interface RouteFiles {\n route?: string;\n template?: string;\n controller?: string;\n children: Map<string, RouteFiles>;\n}\n\nexport class AppFiles {\n readonly tests: ReadonlyArray<string>;\n readonly components: ReadonlyArray<string>;\n readonly helpers: ReadonlyArray<string>;\n readonly modifiers: ReadonlyArray<string>;\n private perRoute: RouteFiles;\n readonly otherAppFiles: ReadonlyArray<string>;\n readonly isFastbootOnly: Map<string, boolean>;\n readonly fastbootFiles: { [appName: string]: { localFilename: string; shadowedFilename: string | undefined } };\n\n constructor(\n readonly engine: Engine,\n appFiles: Set<string>,\n fastbootFiles: Set<string>,\n resolvableExtensions: RegExp,\n staticAppPathsPattern: RegExp | undefined,\n podModulePrefix?: string\n ) {\n let tests: string[] = [];\n let components: string[] = [];\n let helpers: string[] = [];\n let modifiers: string[] = [];\n let otherAppFiles: string[] = [];\n this.perRoute = { children: new Map() };\n\n let combinedFiles = new Set<string>();\n let combinedNonFastbootFiles = new Set<string>();\n let isFastbootOnly = new Map<string, boolean>();\n\n for (let f of appFiles) {\n combinedFiles.add(f);\n combinedNonFastbootFiles.add(f);\n }\n for (let f of fastbootFiles) {\n combinedFiles.add(f);\n }\n\n for (let addon of engine.addons.keys()) {\n let appJS = addon.meta['app-js'];\n if (appJS) {\n for (let filename of Object.keys(appJS)) {\n filename = filename.replace(/^\\.\\//, '');\n combinedFiles.add(filename);\n combinedNonFastbootFiles.add(filename);\n }\n }\n\n let fastbootJS = addon.meta['fastboot-js'];\n if (fastbootJS) {\n for (let filename of Object.keys(fastbootJS)) {\n filename = filename.replace(/^\\.\\//, '');\n combinedFiles.add(filename);\n }\n }\n }\n\n for (let relativePath of combinedFiles) {\n isFastbootOnly.set(relativePath, !combinedNonFastbootFiles.has(relativePath));\n relativePath = relativePath.split(sep).join('/');\n if (!resolvableExtensions.test(relativePath)) {\n continue;\n }\n\n if (/\\.d\\.ts$/.test(relativePath)) {\n // .d.ts files are technically \"*.ts\" files but aren't really and we\n // don't want to include them when we crawl through the app.\n continue;\n }\n\n if (relativePath.startsWith('tests/')) {\n tests.push(relativePath);\n continue;\n }\n\n if (relativePath.startsWith('components/')) {\n // hbs files are not resolvable when they're used via co-location with\n // an associated js file because it's the js that is resolvable.\n // An hbs file is used via colocation when it's inside the components\n // directory, and also not named \"template.hbs\" (because that is an\n // older pattern used with pods-like layouts).\n let isHbs = relativePath.endsWith('.hbs');\n if (!isHbs || relativePath.endsWith('/template.hbs')) {\n components.push(relativePath);\n } else if (isHbs) {\n // template-only components will be compiled as js files during the\n // build process, so we push a virtual path to js in the list of files\n // because the resolver will be able to recognize a template-only and\n // give a correct answer in the end.\n let jsPath = relativePath.replace(/\\.hbs$/, '.js');\n if (!combinedFiles.has(jsPath)) {\n components.push(jsPath);\n }\n }\n continue;\n }\n\n if (relativePath.startsWith('templates/components/')) {\n components.push(relativePath);\n continue;\n }\n\n if (relativePath.startsWith('helpers/')) {\n helpers.push(relativePath);\n continue;\n }\n\n if (relativePath.startsWith('modifiers/')) {\n modifiers.push(relativePath);\n continue;\n }\n\n if (\n (podModulePrefix !== undefined && this.handlePodsRouteFile(relativePath, podModulePrefix)) ||\n this.handleClassicRouteFile(relativePath)\n ) {\n continue;\n }\n\n if (staticAppPathsPattern) {\n if (!staticAppPathsPattern.test(relativePath)) {\n otherAppFiles.push(relativePath);\n }\n } else {\n otherAppFiles.push(relativePath);\n }\n }\n this.tests = tests;\n this.components = components;\n this.helpers = helpers;\n this.modifiers = modifiers;\n this.otherAppFiles = otherAppFiles;\n this.isFastbootOnly = isFastbootOnly;\n\n // this deliberately only describes the app's fastboot files. Not the full\n // merge from all the addons. This is because they need different handling\n // in the module resolver -- addon fastboot files can always be a\n // fallbackResolve, because if the app happens to define the same name\n // (whether fastboot-specific or just browser) that wins over the addon.\n // Whereas if the app itself defines a fastbot-specific version of a file,\n // that must take precedence over the *normal* resolution, and must be\n // implemented in beforeResolve.\n this.fastbootFiles = Object.fromEntries(\n [...fastbootFiles].map(name => [\n `./${name}`,\n {\n localFilename: `./_fastboot_/${name}`,\n shadowedFilename: appFiles.has(name) ? `./${name}` : undefined,\n },\n ])\n );\n }\n\n private handleClassicRouteFile(relativePath: string): boolean {\n let [prefix, ...rest] = relativePath.replace(/\\.\\w{1,3}$/, '').split('/');\n if (!['controllers', 'templates', 'routes'].includes(prefix)) {\n return false;\n }\n let type = prefix.slice(0, -1) as 'controller' | 'template' | 'route';\n let cursor = this.perRoute;\n for (let part of rest) {\n let child = cursor.children.get(part);\n if (child) {\n cursor = child;\n } else {\n let newEntry = { children: new Map() };\n cursor.children.set(part, newEntry);\n cursor = newEntry;\n }\n }\n cursor[type] = relativePath;\n return true;\n }\n\n private handlePodsRouteFile(relativePath: string, podModulePrefix: string): boolean {\n let parts = relativePath.replace(/\\.\\w{1,3}$/, '').split('/');\n let type = parts.pop();\n if (!type || !['controller', 'template', 'route'].includes(type)) {\n return false;\n }\n let podParts = podModulePrefix.split('/');\n // The first part of podModulePrefix is the app's package name\n podParts.shift();\n\n for (let podPart of podParts) {\n if (parts.shift() !== podPart) {\n return false;\n }\n }\n\n let cursor = this.perRoute;\n for (let part of parts) {\n let child = cursor.children.get(part);\n if (child) {\n cursor = child;\n } else {\n let newEntry = { children: new Map() };\n cursor.children.set(part, newEntry);\n cursor = newEntry;\n }\n }\n cursor[type as 'controller' | 'template' | 'route'] = relativePath;\n return true;\n }\n\n get routeFiles(): Readonly<RouteFiles> {\n return this.perRoute;\n }\n}\n\nexport interface Engine {\n // the engine's own package\n package: Package;\n // the set of active addons in the engine. For each one we keep track of a file that can resolve the addon, because we'll need that later.\n addons: Map<AddonPackage, string>;\n // is this the top-level engine?\n isApp: boolean;\n // runtime name for the engine's own module namespace\n modulePrefix: string;\n // TODO: remove this after we remove the stage2 entrypoint\n appRelativePath: string;\n}\n"]}
package/src/index.d.ts CHANGED
@@ -1,13 +1,12 @@
1
1
  export { Packager, PackagerConstructor, Variant, applyVariantToBabelConfig, getAppMeta, getPackagerCacheDir, } from './packager';
2
2
  export { HTMLEntrypoint, BundleSummary } from './html-entrypoint';
3
3
  export { default as Stage } from './stage';
4
- export { Asset, EmberAsset, ImplicitAssetPaths } from './asset';
5
4
  export { default as Options, optionsWithDefaults } from './options';
6
5
  export { default as toBroccoliPlugin } from './to-broccoli-plugin';
7
6
  export { default as WaitForTrees, OutputPaths } from './wait-for-trees';
8
7
  export { compile as jsHandlebarsCompile } from './js-handlebars';
9
8
  export { todo, unsupported, warn, debug, expectWarning, throwOnWarnings } from './messages';
10
- export { Resolver, Options as ResolverOptions, ModuleRequest, Resolution, ResolverFunction, SyncResolverFunction, } from './module-resolver';
9
+ export { Resolver, Options as ResolverOptions, ModuleRequest, Resolution } from './module-resolver';
11
10
  export { ResolverLoader } from './resolver-loader';
12
11
  export { virtualContent } from './virtual-content';
13
12
  export type { Engine } from './app-files';
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,uCAOoB;AAHlB,qHAAA,yBAAyB,OAAA;AACzB,sGAAA,UAAU,OAAA;AACV,+GAAA,mBAAmB,OAAA;AAErB,qDAAkE;AAAzD,iHAAA,cAAc,OAAA;AAGvB,qCAAoE;AAAvC,8GAAA,mBAAmB,OAAA;AAChD,2DAAmE;AAA1D,uIAAA,OAAO,OAAoB;AACpC,mDAAwE;AAA/D,+HAAA,OAAO,OAAgB;AAChC,iDAAiE;AAAxD,oHAAA,OAAO,OAAuB;AACvC,uCAA4F;AAAnF,gGAAA,IAAI,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,gGAAA,IAAI,OAAA;AAAE,iGAAA,KAAK,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,2GAAA,eAAe,OAAA;AACvE,qDAO2B;AANzB,2GAAA,QAAQ,OAAA;AAOV,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAGvB,8EAA8E;AAC9E,+DAA+D;AAC/D,8DAA4C","sourcesContent":["export {\n Packager,\n PackagerConstructor,\n Variant,\n applyVariantToBabelConfig,\n getAppMeta,\n getPackagerCacheDir,\n} from './packager';\nexport { HTMLEntrypoint, BundleSummary } from './html-entrypoint';\nexport { default as Stage } from './stage';\nexport { Asset, EmberAsset, ImplicitAssetPaths } from './asset';\nexport { default as Options, optionsWithDefaults } from './options';\nexport { default as toBroccoliPlugin } from './to-broccoli-plugin';\nexport { default as WaitForTrees, OutputPaths } from './wait-for-trees';\nexport { compile as jsHandlebarsCompile } from './js-handlebars';\nexport { todo, unsupported, warn, debug, expectWarning, throwOnWarnings } from './messages';\nexport {\n Resolver,\n Options as ResolverOptions,\n ModuleRequest,\n Resolution,\n ResolverFunction,\n SyncResolverFunction,\n} from './module-resolver';\nexport { ResolverLoader } from './resolver-loader';\nexport { virtualContent } from './virtual-content';\nexport type { Engine } from './app-files';\n\n// this is reexported because we already make users manage a peerDep from some\n// other packages (like embroider/webpack and @embroider/compat\nexport * from '@embroider/shared-internals';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,uCAOoB;AAHlB,qHAAA,yBAAyB,OAAA;AACzB,sGAAA,UAAU,OAAA;AACV,+GAAA,mBAAmB,OAAA;AAErB,qDAAkE;AAAzD,iHAAA,cAAc,OAAA;AAEvB,qCAAoE;AAAvC,8GAAA,mBAAmB,OAAA;AAChD,2DAAmE;AAA1D,uIAAA,OAAO,OAAoB;AACpC,mDAAwE;AAA/D,+HAAA,OAAO,OAAgB;AAChC,iDAAiE;AAAxD,oHAAA,OAAO,OAAuB;AACvC,uCAA4F;AAAnF,gGAAA,IAAI,OAAA;AAAE,uGAAA,WAAW,OAAA;AAAE,gGAAA,IAAI,OAAA;AAAE,iGAAA,KAAK,OAAA;AAAE,yGAAA,aAAa,OAAA;AAAE,2GAAA,eAAe,OAAA;AACvE,qDAAoG;AAA3F,2GAAA,QAAQ,OAAA;AACjB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AAGvB,8EAA8E;AAC9E,+DAA+D;AAC/D,8DAA4C","sourcesContent":["export {\n Packager,\n PackagerConstructor,\n Variant,\n applyVariantToBabelConfig,\n getAppMeta,\n getPackagerCacheDir,\n} from './packager';\nexport { HTMLEntrypoint, BundleSummary } from './html-entrypoint';\nexport { default as Stage } from './stage';\nexport { default as Options, optionsWithDefaults } from './options';\nexport { default as toBroccoliPlugin } from './to-broccoli-plugin';\nexport { default as WaitForTrees, OutputPaths } from './wait-for-trees';\nexport { compile as jsHandlebarsCompile } from './js-handlebars';\nexport { todo, unsupported, warn, debug, expectWarning, throwOnWarnings } from './messages';\nexport { Resolver, Options as ResolverOptions, ModuleRequest, Resolution } from './module-resolver';\nexport { ResolverLoader } from './resolver-loader';\nexport { virtualContent } from './virtual-content';\nexport type { Engine } from './app-files';\n\n// this is reexported because we already make users manage a peerDep from some\n// other packages (like embroider/webpack and @embroider/compat\nexport * from '@embroider/shared-internals';\n"]}
@@ -8,21 +8,22 @@ export interface Options {
8
8
  renameModules: {
9
9
  [fromName: string]: string;
10
10
  };
11
- activeAddons: {
12
- [packageName: string]: string;
13
- };
14
11
  resolvableExtensions: string[];
15
12
  appRoot: string;
16
13
  engines: EngineConfig[];
17
14
  modulePrefix: string;
15
+ splitAtRoutes?: (RegExp | string)[];
18
16
  podModulePrefix?: string;
19
17
  amdCompatibility: Required<UserOptions['amdCompatibility']>;
18
+ autoRun: boolean;
19
+ staticAppPaths: string[];
20
20
  }
21
- interface EngineConfig {
21
+ export interface EngineConfig {
22
22
  packageName: string;
23
23
  activeAddons: {
24
24
  name: string;
25
25
  root: string;
26
+ canResolveFromFile: string;
26
27
  }[];
27
28
  fastbootFiles: {
28
29
  [appName: string]: {
@@ -31,34 +32,42 @@ interface EngineConfig {
31
32
  };
32
33
  };
33
34
  root: string;
35
+ isLazy: boolean;
34
36
  }
35
- export interface ModuleRequest {
37
+ export interface ModuleRequest<Res extends Resolution = Resolution> {
36
38
  readonly specifier: string;
37
39
  readonly fromFile: string;
38
40
  readonly isVirtual: boolean;
39
41
  readonly meta: Record<string, unknown> | undefined;
42
+ readonly debugType: string;
43
+ readonly isNotFound: boolean;
44
+ readonly resolvedTo: Res | undefined;
40
45
  alias(newSpecifier: string): this;
41
46
  rehome(newFromFile: string): this;
42
47
  virtualize(virtualFilename: string): this;
43
48
  withMeta(meta: Record<string, any> | undefined): this;
49
+ notFound(): this;
50
+ defaultResolve(): Promise<Res>;
51
+ resolveTo(resolution: Res): this;
44
52
  }
45
53
  export type Resolution<T = unknown, E = unknown> = {
46
54
  type: 'found';
55
+ filename: string;
56
+ isVirtual: boolean;
57
+ result: T;
58
+ } | {
59
+ type: 'ignored';
47
60
  result: T;
48
61
  } | {
49
62
  type: 'not_found';
50
63
  err: E;
51
64
  };
52
- export type ResolverFunction<R extends ModuleRequest = ModuleRequest, Res extends Resolution = Resolution> = (request: R) => Promise<Res>;
53
- export type SyncResolverFunction<R extends ModuleRequest = ModuleRequest, Res extends Resolution = Resolution> = (request: R) => Res;
54
65
  export declare class Resolver {
55
66
  readonly options: Options;
56
67
  constructor(options: Options);
57
- beforeResolve<R extends ModuleRequest>(request: R): R;
58
- resolve<Req extends ModuleRequest, Res extends Resolution>(request: Req, defaultResolve: ResolverFunction<Req, Res>): Promise<Res>;
59
- resolveSync<Req extends ModuleRequest, Res extends Resolution>(request: Req, defaultResolve: SyncResolverFunction<Req, Res>): Res;
60
- private internalResolve;
61
- nodeResolve(specifier: string, fromFile: string): {
68
+ private beforeResolve;
69
+ resolve<ResolveResolution extends Resolution>(request: ModuleRequest<ResolveResolution>): Promise<ResolveResolution>;
70
+ nodeResolve(specifier: string, fromFile: string): Promise<{
62
71
  type: 'virtual';
63
72
  filename: string;
64
73
  content: string;
@@ -68,13 +77,19 @@ export declare class Resolver {
68
77
  } | {
69
78
  type: 'not_found';
70
79
  err: Error;
71
- };
80
+ }>;
72
81
  get packageCache(): RewrittenPackageCache;
73
82
  private logicalPackage;
74
83
  private generateFastbootSwitch;
75
84
  private handleFastbootSwitch;
76
85
  private handleImplicitModules;
86
+ private handleEntrypoint;
87
+ private handleTestEntrypoint;
88
+ private handleRouteEntrypoint;
89
+ private handleImplicitTestScripts;
90
+ private handleTestSupportStyles;
77
91
  private handleGlobalsCompat;
92
+ private handleVendorStyles;
78
93
  private resolveHelper;
79
94
  private resolveComponent;
80
95
  private resolveHelperOrComponent;
@@ -88,10 +103,12 @@ export declare class Resolver {
88
103
  owningEngine(pkg: Package): EngineConfig;
89
104
  private handleRewrittenPackages;
90
105
  private handleRenaming;
106
+ private handleVendor;
91
107
  private resolveWithinMovedPackage;
92
108
  private preHandleExternal;
109
+ private locateActiveAddon;
93
110
  private external;
94
- fallbackResolve<R extends ModuleRequest>(request: R): R;
111
+ private fallbackResolve;
95
112
  private getEntryFromMergeMap;
96
113
  private withResolvableExtensions;
97
114
  private searchAppTree;
@@ -99,4 +116,3 @@ export declare class Resolver {
99
116
  reverseComponentLookup(filename: string): string | undefined;
100
117
  private tryReverseComponent;
101
118
  }
102
- export {};