@embroider/core 3.4.20-unstable.b89b741 → 3.4.20-unstable.e6197c7
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 +6 -6
- package/src/index.d.ts +1 -1
- package/src/index.js.map +1 -1
- package/src/module-request.d.ts +4 -6
- package/src/module-request.js +2 -2
- package/src/module-request.js.map +1 -1
- package/src/module-resolver.js +29 -63
- package/src/module-resolver.js.map +1 -1
- package/src/node-resolve.d.ts +2 -1
- package/src/node-resolve.js +6 -8
- package/src/node-resolve.js.map +1 -1
- package/src/virtual-content.d.ts +24 -1
- package/src/virtual-content.js +10 -16
- package/src/virtual-content.js.map +1 -1
- package/src/virtual-entrypoint.d.ts +4 -0
- package/src/virtual-entrypoint.js +38 -0
- package/src/virtual-entrypoint.js.map +1 -1
- package/src/virtual-route-entrypoint.d.ts +2 -1
- package/src/virtual-route-entrypoint.js +8 -2
- package/src/virtual-route-entrypoint.js.map +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@embroider/core",
|
3
|
-
"version": "3.4.20-unstable.
|
3
|
+
"version": "3.4.20-unstable.e6197c7",
|
4
4
|
"private": false,
|
5
5
|
"description": "A build system for EmberJS applications.",
|
6
6
|
"repository": {
|
@@ -49,9 +49,9 @@
|
|
49
49
|
"semver": "^7.3.5",
|
50
50
|
"typescript-memoize": "^1.0.1",
|
51
51
|
"walk-sync": "^3.0.0",
|
52
|
-
"@embroider/macros": "1.16.10-unstable.
|
53
|
-
"@embroider/reverse-exports": "0.1.1-unstable.
|
54
|
-
"@embroider/shared-internals": "2.8.2-unstable.
|
52
|
+
"@embroider/macros": "1.16.10-unstable.e6197c7",
|
53
|
+
"@embroider/reverse-exports": "0.1.1-unstable.e6197c7",
|
54
|
+
"@embroider/shared-internals": "2.8.2-unstable.e6197c7"
|
55
55
|
},
|
56
56
|
"devDependencies": {
|
57
57
|
"@glimmer/syntax": "^0.84.2",
|
@@ -70,8 +70,8 @@
|
|
70
70
|
"fixturify": "^2.1.1",
|
71
71
|
"tmp": "^0.1.0",
|
72
72
|
"typescript": "^5.4.5",
|
73
|
-
"@embroider/
|
74
|
-
"@embroider/
|
73
|
+
"@embroider/test-support": "0.36.0",
|
74
|
+
"@embroider/sample-transforms": "0.0.0"
|
75
75
|
},
|
76
76
|
"engines": {
|
77
77
|
"node": "12.* || 14.* || >= 16"
|
package/src/index.d.ts
CHANGED
@@ -9,6 +9,6 @@ export { Resolver } from './module-resolver';
|
|
9
9
|
export { ModuleRequest, type Resolution, type RequestAdapter, type RequestAdapterCreate } from './module-request';
|
10
10
|
export type { Options as ResolverOptions } from './module-resolver-options';
|
11
11
|
export { ResolverLoader } from './resolver-loader';
|
12
|
-
export { virtualContent } from './virtual-content';
|
12
|
+
export { virtualContent, type VirtualResponse } from './virtual-content';
|
13
13
|
export type { Engine } from './app-files';
|
14
14
|
export * from '@embroider/shared-internals';
|
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;AAEvB,qCAAoE;AAAvC,8GAAA,mBAAmB,OAAA;AAChD,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,qDAA6C;AAApC,2GAAA,QAAQ,OAAA;AACjB,mDAAkH;AAAzG,+GAAA,aAAa,OAAA;AAEtB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,
|
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,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,qDAA6C;AAApC,2GAAA,QAAQ,OAAA;AACjB,mDAAkH;AAAzG,+GAAA,aAAa,OAAA;AAEtB,qDAAmD;AAA1C,iHAAA,cAAc,OAAA;AACvB,qDAAyE;AAAhE,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 WaitForTrees, OutputPaths } from './wait-for-trees';\nexport { compile as jsHandlebarsCompile } from './js-handlebars';\nexport { todo, unsupported, warn, debug, expectWarning, throwOnWarnings } from './messages';\nexport { Resolver } from './module-resolver';\nexport { ModuleRequest, type Resolution, type RequestAdapter, type RequestAdapterCreate } from './module-request';\nexport type { Options as ResolverOptions } from './module-resolver-options';\nexport { ResolverLoader } from './resolver-loader';\nexport { virtualContent, type VirtualResponse } 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"]}
|
package/src/module-request.d.ts
CHANGED
@@ -1,10 +1,8 @@
|
|
1
|
+
import type { VirtualResponse } from './virtual-content';
|
1
2
|
export type Resolution<T = unknown, E = unknown> = {
|
2
3
|
type: 'found';
|
3
4
|
filename: string;
|
4
|
-
|
5
|
-
result: T;
|
6
|
-
} | {
|
7
|
-
type: 'ignored';
|
5
|
+
virtual: VirtualResponse | false;
|
8
6
|
result: T;
|
9
7
|
} | {
|
10
8
|
type: 'not_found';
|
@@ -18,7 +16,7 @@ export interface RequestAdapter<Res extends Resolution> {
|
|
18
16
|
readonly debugType: string;
|
19
17
|
resolve(request: ModuleRequest<Res>): Promise<Res>;
|
20
18
|
notFoundResponse(request: ModuleRequest<Res>): Res | (() => Promise<Res>);
|
21
|
-
virtualResponse(request: ModuleRequest<Res>,
|
19
|
+
virtualResponse(request: ModuleRequest<Res>, response: VirtualResponse): Res | (() => Promise<Res>);
|
22
20
|
}
|
23
21
|
export interface InitialRequestState {
|
24
22
|
readonly specifier: string;
|
@@ -36,7 +34,7 @@ export declare class ModuleRequest<Res extends Resolution = Resolution> implemen
|
|
36
34
|
get resolvedTo(): Res | (() => Promise<Res>) | undefined;
|
37
35
|
alias(newSpecifier: string): this;
|
38
36
|
rehome(newFromFile: string): this;
|
39
|
-
virtualize(
|
37
|
+
virtualize(virtualResponse: VirtualResponse): this;
|
40
38
|
withMeta(meta: Record<string, any> | undefined): this;
|
41
39
|
notFound(): this;
|
42
40
|
resolveTo(res: Res | (() => Promise<Res>)): this;
|
package/src/module-request.js
CHANGED
@@ -62,8 +62,8 @@ class ModuleRequest {
|
|
62
62
|
__classPrivateFieldSet(result, _ModuleRequest_fromFile, newFromFile, "f");
|
63
63
|
return result;
|
64
64
|
}
|
65
|
-
virtualize(
|
66
|
-
return this.resolveTo(__classPrivateFieldGet(this, _ModuleRequest_adapter, "f").virtualResponse(this,
|
65
|
+
virtualize(virtualResponse) {
|
66
|
+
return this.resolveTo(__classPrivateFieldGet(this, _ModuleRequest_adapter, "f").virtualResponse(this, virtualResponse));
|
67
67
|
}
|
68
68
|
withMeta(meta) {
|
69
69
|
let result = this.clone();
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"module-request.js","sourceRoot":"","sources":["module-request.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;
|
1
|
+
{"version":3,"file":"module-request.js","sourceRoot":"","sources":["module-request.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAgCA,MAAa,aAAa;IACxB,MAAM,CAAC,MAAM,CACX,aAA8C,EAC9C,MAAY;QAEZ,IAAI,MAAM,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;QACnC,IAAI,MAAM,EAAE,CAAC;YACX,OAAO,IAAI,aAAa,CAAC,MAAM,CAAC,OAAO,EAAE,MAAM,CAAC,YAAY,CAAC,CAAC;QAChE,CAAC;IACH,CAAC;IAQD,YAAoB,OAA4B,EAAE,UAA+B;QANjF,yCAA8B;QAC9B,2CAAmB;QACnB,0CAAkB;QAClB,sCAA2C;QAC3C,4CAAoD;QAGlD,uBAAA,IAAI,0BAAY,OAAO,MAAA,CAAC;QACxB,uBAAA,IAAI,4BAAc,UAAU,CAAC,SAAS,MAAA,CAAC;QACvC,uBAAA,IAAI,2BAAa,UAAU,CAAC,QAAQ,MAAA,CAAC;QACrC,uBAAA,IAAI,uBAAS,UAAU,CAAC,IAAI,MAAA,CAAC;IAC/B,CAAC;IAED,IAAI,SAAS;QACX,OAAO,uBAAA,IAAI,gCAAW,CAAC;IACzB,CAAC;IAED,IAAI,QAAQ;QACV,OAAO,uBAAA,IAAI,+BAAU,CAAC;IACxB,CAAC;IAED,IAAI,SAAS;QACX,OAAO,uBAAA,IAAI,8BAAS,CAAC,SAAS,CAAC;IACjC,CAAC;IAED,IAAI,IAAI;QACN,OAAO,uBAAA,IAAI,2BAAM,CAAC;IACpB,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,uBAAA,IAAI,iCAAY,CAAC;IAC1B,CAAC;IAED,KAAK,CAAC,YAAoB;QACxB,IAAI,uBAAA,IAAI,gCAAW,KAAK,YAAY,EAAE,CAAC;YACrC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,uBAAA,MAAM,4BAAc,YAAY,MAAA,CAAC;QACjC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,WAAmB;QACxB,IAAI,uBAAA,IAAI,+BAAU,KAAK,WAAW,EAAE,CAAC;YACnC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,uBAAA,MAAM,2BAAa,WAAW,MAAA,CAAC;QAC/B,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,UAAU,CAAC,eAAgC;QACzC,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAA,IAAI,8BAAS,CAAC,eAAe,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC,CAAC;IAC9E,CAAC;IAED,QAAQ,CAAC,IAAqC;QAC5C,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,uBAAA,MAAM,uBAAS,IAAI,MAAA,CAAC;QACpB,uBAAA,MAAM,6BAAe,uBAAA,IAAI,iCAAY,MAAA,CAAC;QACtC,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,SAAS,CAAC,uBAAA,IAAI,8BAAS,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;IAC9D,CAAC;IAED,SAAS,CAAC,GAA+B;QACvC,IAAI,MAAM,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC;QAC1B,uBAAA,MAAM,6BAAe,GAAG,MAAA,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,cAAc;QACZ,OAAO,uBAAA,IAAI,8BAAS,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IAED,KAAK;QACH,OAAO,IAAI,aAAa,CAAC,uBAAA,IAAI,8BAAS,EAAE,IAAI,CAAS,CAAC;IACxD,CAAC;CACF;AA1FD,sCA0FC","sourcesContent":["import type { VirtualResponse } from './virtual-content';\n\n// This is generic because different build systems have different ways of\n// representing a found module, and we just pass those values through.\nexport type Resolution<T = unknown, E = unknown> =\n | { type: 'found'; filename: string; virtual: VirtualResponse | false; result: T }\n\n // the important thing about this Resolution is that embroider should do its\n // fallback behaviors here.\n | { type: 'not_found'; err: E };\n\nexport type RequestAdapterCreate<Init, Res extends Resolution> = (\n params: Init\n) => { initialState: InitialRequestState; adapter: RequestAdapter<Res> } | undefined;\n\nexport interface RequestAdapter<Res extends Resolution> {\n readonly debugType: string;\n resolve(request: ModuleRequest<Res>): Promise<Res>;\n\n // the function-returning variants of both of these are only because webpack\n // plugins are a pain in the butt. Integrators are encouraged to use the plain\n // Response-returning variants in all sane build environments.\n notFoundResponse(request: ModuleRequest<Res>): Res | (() => Promise<Res>);\n virtualResponse(request: ModuleRequest<Res>, response: VirtualResponse): Res | (() => Promise<Res>);\n}\n\nexport interface InitialRequestState {\n readonly specifier: string;\n readonly fromFile: string;\n readonly meta: Record<string, unknown> | undefined;\n}\n\nexport class ModuleRequest<Res extends Resolution = Resolution> implements ModuleRequest<Res> {\n static create<Init, Res extends Resolution>(\n createAdapter: RequestAdapterCreate<Init, Res>,\n params: Init\n ): ModuleRequest<Res> | undefined {\n let result = createAdapter(params);\n if (result) {\n return new ModuleRequest(result.adapter, result.initialState);\n }\n }\n\n #adapter: RequestAdapter<Res>;\n #specifier: string;\n #fromFile: string;\n #meta: Record<string, unknown> | undefined;\n #resolvedTo: Res | (() => Promise<Res>) | undefined;\n\n private constructor(adapter: RequestAdapter<Res>, initialize: InitialRequestState) {\n this.#adapter = adapter;\n this.#specifier = initialize.specifier;\n this.#fromFile = initialize.fromFile;\n this.#meta = initialize.meta;\n }\n\n get specifier(): string {\n return this.#specifier;\n }\n\n get fromFile(): string {\n return this.#fromFile;\n }\n\n get debugType(): string {\n return this.#adapter.debugType;\n }\n\n get meta(): Record<string, unknown> | undefined {\n return this.#meta;\n }\n\n get resolvedTo(): Res | (() => Promise<Res>) | undefined {\n return this.#resolvedTo;\n }\n\n alias(newSpecifier: string): this {\n if (this.#specifier === newSpecifier) {\n return this;\n }\n let result = this.clone();\n result.#specifier = newSpecifier;\n return result;\n }\n\n rehome(newFromFile: string): this {\n if (this.#fromFile === newFromFile) {\n return this;\n }\n let result = this.clone();\n result.#fromFile = newFromFile;\n return result;\n }\n\n virtualize(virtualResponse: VirtualResponse): this {\n return this.resolveTo(this.#adapter.virtualResponse(this, virtualResponse));\n }\n\n withMeta(meta: Record<string, any> | undefined): this {\n let result = this.clone();\n result.#meta = meta;\n result.#resolvedTo = this.#resolvedTo;\n return result;\n }\n\n notFound(): this {\n return this.resolveTo(this.#adapter.notFoundResponse(this));\n }\n\n resolveTo(res: Res | (() => Promise<Res>)): this {\n let result = this.clone();\n result.#resolvedTo = res;\n return result;\n }\n\n defaultResolve(): Promise<Res> {\n return this.#adapter.resolve(this);\n }\n\n clone(): this {\n return new ModuleRequest(this.#adapter, this) as this;\n }\n}\n"]}
|
package/src/module-resolver.js
CHANGED
@@ -24,6 +24,7 @@ const fs_1 = require("fs");
|
|
24
24
|
const node_resolve_1 = require("./node-resolve");
|
25
25
|
const virtual_route_entrypoint_1 = require("./virtual-route-entrypoint");
|
26
26
|
const semver_1 = require("semver");
|
27
|
+
const virtual_entrypoint_1 = require("./virtual-entrypoint");
|
27
28
|
const debug = (0, debug_1.default)('embroider:resolver');
|
28
29
|
// Using a formatter makes this work lazy so nothing happens when we aren't
|
29
30
|
// logging. It is unfortunate that formatters are a globally mutable config and
|
@@ -107,7 +108,6 @@ class Resolver {
|
|
107
108
|
}
|
108
109
|
switch (resolution.type) {
|
109
110
|
case 'found':
|
110
|
-
case 'ignored':
|
111
111
|
return resolution;
|
112
112
|
case 'not_found':
|
113
113
|
break;
|
@@ -182,7 +182,7 @@ class Resolver {
|
|
182
182
|
return logTransition('internal lookup from fastbootSwitch', request);
|
183
183
|
}
|
184
184
|
else {
|
185
|
-
return logTransition('shadowed app fastboot', request, request.virtualize(switchFile));
|
185
|
+
return logTransition('shadowed app fastboot', request, request.virtualize({ type: 'fastboot-switch', specifier: switchFile }));
|
186
186
|
}
|
187
187
|
}
|
188
188
|
else {
|
@@ -256,48 +256,23 @@ class Resolver {
|
|
256
256
|
let packageName = (0, shared_internals_1.packageName)(im.fromFile);
|
257
257
|
if (packageName) {
|
258
258
|
let dep = this.packageCache.resolve(packageName, pkg);
|
259
|
-
return logTransition(`dep's implicit modules`, request, request.virtualize((0, path_1.resolve)(dep.root, `-embroider-${im.type}.js`)));
|
259
|
+
return logTransition(`dep's implicit modules`, request, request.virtualize({ type: im.type, specifier: (0, path_1.resolve)(dep.root, `-embroider-${im.type}.js`) }));
|
260
260
|
}
|
261
261
|
else {
|
262
|
-
return logTransition(`own implicit modules`, request, request.virtualize((0, path_1.resolve)(pkg.root, `-embroider-${im.type}.js`)));
|
262
|
+
return logTransition(`own implicit modules`, request, request.virtualize({ type: im.type, specifier: (0, path_1.resolve)(pkg.root, `-embroider-${im.type}.js`) }));
|
263
263
|
}
|
264
264
|
}
|
265
265
|
handleEntrypoint(request) {
|
266
|
-
var _a;
|
267
266
|
if (request.resolvedTo) {
|
268
267
|
return request;
|
269
268
|
}
|
270
|
-
|
271
|
-
|
272
|
-
'
|
273
|
-
'/@embroider/virtual/compat-modules',
|
274
|
-
'./@embroider/virtual/compat-modules',
|
275
|
-
];
|
276
|
-
if (!candidates.some(c => request.specifier.startsWith(c + '/') || request.specifier === c)) {
|
277
|
-
return request;
|
278
|
-
}
|
279
|
-
const result = /\.?\/?@embroider\/virtual\/compat-modules(?:\/(?<packageName>.*))?/.exec(request.specifier);
|
280
|
-
if (!result) {
|
281
|
-
// TODO make a better error
|
282
|
-
throw new Error('entrypoint does not match pattern' + request.specifier);
|
283
|
-
}
|
284
|
-
const { packageName } = result.groups;
|
285
|
-
const requestingPkg = this.packageCache.ownerOfFile(request.fromFile);
|
286
|
-
if (!(requestingPkg === null || requestingPkg === void 0 ? void 0 : requestingPkg.isV2Ember())) {
|
287
|
-
throw new Error(`bug: found entrypoint import in non-ember package at ${request.fromFile}`);
|
288
|
-
}
|
289
|
-
let pkg;
|
290
|
-
if (packageName) {
|
291
|
-
pkg = this.packageCache.resolve(packageName, requestingPkg);
|
269
|
+
let virtualResponse = (0, virtual_entrypoint_1.virtualEntrypoint)(request, this.packageCache);
|
270
|
+
if (virtualResponse) {
|
271
|
+
return logTransition('entrypoint', request, request.virtualize(virtualResponse));
|
292
272
|
}
|
293
273
|
else {
|
294
|
-
|
274
|
+
return request;
|
295
275
|
}
|
296
|
-
let matched = (0, resolve_exports_1.exports)(pkg.packageJSON, '-embroider-entrypoint.js', {
|
297
|
-
browser: true,
|
298
|
-
conditions: ['default', 'imports'],
|
299
|
-
});
|
300
|
-
return logTransition('entrypoint', request, request.virtualize((0, path_1.resolve)(pkg.root, (_a = matched === null || matched === void 0 ? void 0 : matched[0]) !== null && _a !== void 0 ? _a : '-embroider-entrypoint.js')));
|
301
276
|
}
|
302
277
|
handleRouteEntrypoint(request) {
|
303
278
|
if (request.resolvedTo) {
|
@@ -311,11 +286,7 @@ class Resolver {
|
|
311
286
|
if (!(pkg === null || pkg === void 0 ? void 0 : pkg.isV2Ember())) {
|
312
287
|
throw new Error(`bug: found entrypoint import in non-ember package at ${request.fromFile}`);
|
313
288
|
}
|
314
|
-
|
315
|
-
browser: true,
|
316
|
-
conditions: ['default', 'imports'],
|
317
|
-
});
|
318
|
-
return logTransition('route entrypoint', request, request.virtualize((0, virtual_route_entrypoint_1.encodeRouteEntrypoint)(pkg.root, matched === null || matched === void 0 ? void 0 : matched[0], routeName)));
|
289
|
+
return logTransition('route entrypoint', request, request.virtualize({ type: 'route-entrypoint', specifier: (0, virtual_route_entrypoint_1.encodeRouteEntrypoint)(pkg, routeName) }));
|
319
290
|
}
|
320
291
|
handleImplicitTestScripts(request) {
|
321
292
|
//TODO move the extra forwardslash handling out into the vite plugin
|
@@ -331,7 +302,7 @@ class Resolver {
|
|
331
302
|
if ((pkg === null || pkg === void 0 ? void 0 : pkg.root) !== this.options.engines[0].root) {
|
332
303
|
throw new Error(`bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/virtual/test-support.js. If you think something should be fixed in Embroider, please open an issue on https://github.com/embroider-build/embroider/issues.`);
|
333
304
|
}
|
334
|
-
return logTransition('test-support', request, request.virtualize((0, path_1.resolve)(pkg.root, '-embroider-test-support.js')));
|
305
|
+
return logTransition('test-support', request, request.virtualize({ type: 'test-support-js', specifier: (0, path_1.resolve)(pkg.root, '-embroider-test-support.js') }));
|
335
306
|
}
|
336
307
|
handleTestSupportStyles(request) {
|
337
308
|
//TODO move the extra forwardslash handling out into the vite plugin
|
@@ -347,7 +318,10 @@ class Resolver {
|
|
347
318
|
if ((pkg === null || pkg === void 0 ? void 0 : pkg.root) !== this.options.engines[0].root) {
|
348
319
|
throw new Error(`bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/virtual/test-support.css. If you think something should be fixed in Embroider, please open an issue on https://github.com/embroider-build/embroider/issues.`);
|
349
320
|
}
|
350
|
-
return logTransition('test-support-styles', request, request.virtualize(
|
321
|
+
return logTransition('test-support-styles', request, request.virtualize({
|
322
|
+
type: 'test-support-css',
|
323
|
+
specifier: (0, path_1.resolve)(pkg.root, '-embroider-test-support-styles.css'),
|
324
|
+
}));
|
351
325
|
}
|
352
326
|
async handleGlobalsCompat(request) {
|
353
327
|
if (request.resolvedTo) {
|
@@ -390,7 +364,7 @@ class Resolver {
|
|
390
364
|
if (!pkg || !this.options.engines.some(e => e.root === (pkg === null || pkg === void 0 ? void 0 : pkg.root))) {
|
391
365
|
throw new Error(`bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app or Engine. The top-level Ember app is the only one that has support for @embroider/virtual/vendor.css. If you think something should be fixed in Embroider, please open an issue on https://github.com/embroider-build/embroider/issues.`);
|
392
366
|
}
|
393
|
-
return logTransition('vendor-styles', request, request.virtualize((0, path_1.resolve)(pkg.root, '-embroider-vendor-styles.css')));
|
367
|
+
return logTransition('vendor-styles', request, request.virtualize({ type: 'vendor-css', specifier: (0, path_1.resolve)(pkg.root, '-embroider-vendor-styles.css') }));
|
394
368
|
}
|
395
369
|
resolveHelper(path, inEngine, request) {
|
396
370
|
let target = this.parseGlobalPath(path, inEngine);
|
@@ -403,9 +377,7 @@ class Resolver {
|
|
403
377
|
// first, the various places our template might be.
|
404
378
|
for (let candidate of this.componentTemplateCandidates(target.packageName)) {
|
405
379
|
let candidateSpecifier = `${target.packageName}${candidate.prefix}${target.memberName}${candidate.suffix}`;
|
406
|
-
let resolution = await this.resolve(request.alias(candidateSpecifier).rehome(target.from)
|
407
|
-
runtimeFallback: false,
|
408
|
-
}));
|
380
|
+
let resolution = await this.resolve(request.alias(candidateSpecifier).rehome(target.from));
|
409
381
|
if (resolution.type === 'found') {
|
410
382
|
hbsModule = resolution;
|
411
383
|
break;
|
@@ -414,12 +386,7 @@ class Resolver {
|
|
414
386
|
// then the various places our javascript might be.
|
415
387
|
for (let candidate of this.componentJSCandidates(target.packageName)) {
|
416
388
|
let candidateSpecifier = `${target.packageName}${candidate.prefix}${target.memberName}${candidate.suffix}`;
|
417
|
-
let resolution = await this.resolve(request.alias(candidateSpecifier).rehome(target.from)
|
418
|
-
runtimeFallback: false,
|
419
|
-
}));
|
420
|
-
if (resolution.type === 'ignored') {
|
421
|
-
return logTransition(`resolving to ignored component`, request, request.resolveTo(resolution));
|
422
|
-
}
|
389
|
+
let resolution = await this.resolve(request.alias(candidateSpecifier).rehome(target.from));
|
423
390
|
// .hbs is a resolvable extension for us, so we need to exclude it here.
|
424
391
|
// It matches as a priority lower than .js, so finding an .hbs means
|
425
392
|
// there's definitely not a .js.
|
@@ -432,7 +399,10 @@ class Resolver {
|
|
432
399
|
if (!this.emberVersionSupportsSeparateTemplates) {
|
433
400
|
throw new Error(`Components with separately resolved templates were removed at Ember 6.0. Migrate to either co-located js/ts + hbs files or to gjs/gts. https://deprecations.emberjs.com/id/component-template-resolving/. Bad template was: ${hbsModule.filename}.`);
|
434
401
|
}
|
435
|
-
return logTransition(`resolveComponent found legacy HBS`, request, request.virtualize(
|
402
|
+
return logTransition(`resolveComponent found legacy HBS`, request, request.virtualize({
|
403
|
+
type: 'component-pair',
|
404
|
+
specifier: (0, virtual_content_1.virtualPairComponent)(this.options.appRoot, hbsModule.filename, jsModule === null || jsModule === void 0 ? void 0 : jsModule.filename),
|
405
|
+
}));
|
436
406
|
}
|
437
407
|
else if (jsModule) {
|
438
408
|
return logTransition(`resolving to resolveComponent found only JS`, request, request.resolveTo(jsModule));
|
@@ -446,13 +416,8 @@ class Resolver {
|
|
446
416
|
// component, so here to resolve the ambiguity we need to actually resolve
|
447
417
|
// that candidate to see if it works.
|
448
418
|
let helperCandidate = this.resolveHelper(path, inEngine, request);
|
449
|
-
let helperMatch = await this.resolve(request.alias(helperCandidate.specifier).rehome(helperCandidate.fromFile)
|
450
|
-
|
451
|
-
}));
|
452
|
-
// for the case of 'ignored' that means that esbuild found this helper in an external
|
453
|
-
// package so it should be considered found in this case and we should not look for a
|
454
|
-
// component with this name
|
455
|
-
if (helperMatch.type === 'found' || helperMatch.type === 'ignored') {
|
419
|
+
let helperMatch = await this.resolve(request.alias(helperCandidate.specifier).rehome(helperCandidate.fromFile));
|
420
|
+
if (helperMatch.type === 'found') {
|
456
421
|
return logTransition('resolve to ambiguous case matched a helper', request, request.resolveTo(helperMatch));
|
457
422
|
}
|
458
423
|
// unlike resolveHelper, resolveComponent already does pre-resolution in
|
@@ -768,7 +733,7 @@ class Resolver {
|
|
768
733
|
if ((pkg === null || pkg === void 0 ? void 0 : pkg.root) !== this.options.engines[0].root) {
|
769
734
|
throw new Error(`bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/virtual/vendor.js. If you think something should be fixed in Embroider, please open an issue on https://github.com/embroider-build/embroider/issues.`);
|
770
735
|
}
|
771
|
-
return logTransition('vendor', request, request.virtualize((0, path_1.resolve)(pkg.root, '-embroider-vendor.js')));
|
736
|
+
return logTransition('vendor', request, request.virtualize({ type: 'vendor-js', specifier: (0, path_1.resolve)(pkg.root, '-embroider-vendor.js') }));
|
772
737
|
}
|
773
738
|
resolveWithinMovedPackage(request, pkg) {
|
774
739
|
let levels = ['..'];
|
@@ -1024,14 +989,15 @@ class Resolver {
|
|
1024
989
|
case 'fastboot-only':
|
1025
990
|
return request.alias(matched.entry['fastboot-js'].specifier).rehome(matched.entry['fastboot-js'].fromFile);
|
1026
991
|
case 'both':
|
1027
|
-
let foundAppJS = await this.resolve(request.alias(matched.entry['app-js'].specifier).rehome(matched.entry['app-js'].fromFile)
|
1028
|
-
runtimeFallback: false,
|
1029
|
-
}));
|
992
|
+
let foundAppJS = await this.resolve(request.alias(matched.entry['app-js'].specifier).rehome(matched.entry['app-js'].fromFile));
|
1030
993
|
if (foundAppJS.type !== 'found') {
|
1031
994
|
throw new Error(`${matched.entry['app-js'].fromPackageName} declared ${inEngineSpecifier} in packageJSON.ember-addon.app-js, but that module does not exist`);
|
1032
995
|
}
|
1033
996
|
let { names } = (0, describe_exports_1.describeExports)((0, fs_1.readFileSync)(foundAppJS.filename, 'utf8'), { configFile: false });
|
1034
|
-
return request.virtualize(
|
997
|
+
return request.virtualize({
|
998
|
+
type: 'fastboot-switch',
|
999
|
+
specifier: (0, virtual_content_1.fastbootSwitch)(matched.matched, (0, path_1.resolve)(engine.root, 'package.json'), names),
|
1000
|
+
});
|
1035
1001
|
}
|
1036
1002
|
}
|
1037
1003
|
// check whether the given file with the given owningPackage is an addon's
|