@embroider/core 3.4.20-unstable.e6197c7 → 3.5.0
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 +9 -19
- package/src/app-files.d.ts +5 -3
- package/src/app-files.js +8 -25
- package/src/app-files.js.map +1 -1
- package/src/asset.d.ts +32 -0
- package/src/asset.js +3 -0
- package/src/asset.js.map +1 -0
- package/src/ember-html.d.ts +43 -0
- package/src/ember-html.js +110 -0
- package/src/ember-html.js.map +1 -0
- package/src/index.d.ts +4 -4
- package/src/index.js +3 -3
- package/src/index.js.map +1 -1
- package/src/measure-concat.js +2 -1
- package/src/measure-concat.js.map +1 -1
- package/src/module-resolver.d.ts +60 -17
- package/src/module-resolver.js +311 -402
- package/src/module-resolver.js.map +1 -1
- package/src/options.d.ts +60 -1
- package/src/options.js +1 -3
- package/src/options.js.map +1 -1
- package/src/portable-babel-config.d.ts +11 -0
- package/src/portable-babel-config.js +132 -0
- package/src/portable-babel-config.js.map +1 -0
- package/src/portable-babel-launcher.d.ts +6 -0
- package/src/portable-babel-launcher.js +75 -0
- package/src/portable-babel-launcher.js.map +1 -0
- package/src/resolver-loader.js +1 -8
- package/src/resolver-loader.js.map +1 -1
- package/src/to-broccoli-plugin.d.ts +8 -0
- package/src/to-broccoli-plugin.js +30 -0
- package/src/to-broccoli-plugin.js.map +1 -0
- package/src/virtual-content.d.ts +4 -29
- package/src/virtual-content.js +112 -74
- package/src/virtual-content.js.map +1 -1
- package/src/module-request.d.ts +0 -43
- package/src/module-request.js +0 -91
- package/src/module-request.js.map +0 -1
- package/src/module-resolver-options.d.ts +0 -42
- package/src/module-resolver-options.js +0 -164
- package/src/module-resolver-options.js.map +0 -1
- package/src/node-resolve.d.ts +0 -30
- package/src/node-resolve.js +0 -112
- package/src/node-resolve.js.map +0 -1
- package/src/virtual-entrypoint.d.ts +0 -23
- package/src/virtual-entrypoint.js +0 -327
- package/src/virtual-entrypoint.js.map +0 -1
- package/src/virtual-route-entrypoint.d.ts +0 -16
- package/src/virtual-route-entrypoint.js +0 -100
- package/src/virtual-route-entrypoint.js.map +0 -1
- package/src/virtual-test-support-styles.d.ts +0 -4
- package/src/virtual-test-support-styles.js +0 -64
- package/src/virtual-test-support-styles.js.map +0 -1
- package/src/virtual-test-support.d.ts +0 -4
- package/src/virtual-test-support.js +0 -68
- package/src/virtual-test-support.js.map +0 -1
- package/src/virtual-vendor-styles.d.ts +0 -4
- package/src/virtual-vendor-styles.js +0 -82
- package/src/virtual-vendor-styles.js.map +0 -1
- package/src/virtual-vendor.d.ts +0 -4
- package/src/virtual-vendor.js +0 -57
- package/src/virtual-vendor.js.map +0 -1
- package/types/virtual/index.d.ts +0 -9
- package/types/virtual/index.js +0 -3
@@ -1,23 +0,0 @@
|
|
1
|
-
import { AppFiles, type RouteFiles } from './app-files';
|
2
|
-
import type { Resolver } from './module-resolver';
|
3
|
-
import { type PackageCachePublicAPI } from '@embroider/shared-internals';
|
4
|
-
import { type ModuleRequest } from './module-request';
|
5
|
-
import { type VirtualResponse } from './virtual-content';
|
6
|
-
export declare function virtualEntrypoint(request: ModuleRequest, packageCache: PackageCachePublicAPI): VirtualResponse | undefined;
|
7
|
-
export declare function decodeEntrypoint(filename: string): {
|
8
|
-
fromDir: string;
|
9
|
-
} | undefined;
|
10
|
-
export declare function staticAppPathsPattern(staticAppPaths: string[] | undefined): RegExp | undefined;
|
11
|
-
export declare function renderEntrypoint(resolver: Resolver, { fromDir }: {
|
12
|
-
fromDir: string;
|
13
|
-
}): {
|
14
|
-
src: string;
|
15
|
-
watches: string[];
|
16
|
-
};
|
17
|
-
export declare function importPaths(resolver: Resolver, { engine }: AppFiles, engineRelativePath: string): {
|
18
|
-
runtime: string;
|
19
|
-
buildtime: string;
|
20
|
-
};
|
21
|
-
export declare function splitRoute(routeName: string, files: RouteFiles, splitAtRoutes: (RegExp | string)[] | undefined, addToParent: (routeName: string, filename: string) => void, addLazyBundle: (routeNames: string[], files: string[]) => void): void;
|
22
|
-
export declare function getAppFiles(appRoot: string): Set<string>;
|
23
|
-
export declare function getFastbootFiles(appRoot: string): Set<string>;
|
@@ -1,327 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.virtualEntrypoint = virtualEntrypoint;
|
7
|
-
exports.decodeEntrypoint = decodeEntrypoint;
|
8
|
-
exports.staticAppPathsPattern = staticAppPathsPattern;
|
9
|
-
exports.renderEntrypoint = renderEntrypoint;
|
10
|
-
exports.importPaths = importPaths;
|
11
|
-
exports.splitRoute = splitRoute;
|
12
|
-
exports.getAppFiles = getAppFiles;
|
13
|
-
exports.getFastbootFiles = getFastbootFiles;
|
14
|
-
const app_files_1 = require("./app-files");
|
15
|
-
const js_handlebars_1 = require("./js-handlebars");
|
16
|
-
const lodash_1 = require("lodash");
|
17
|
-
const path_1 = require("path");
|
18
|
-
const shared_internals_1 = require("@embroider/shared-internals");
|
19
|
-
const walk_sync_1 = __importDefault(require("walk-sync"));
|
20
|
-
const virtual_route_entrypoint_1 = require("./virtual-route-entrypoint");
|
21
|
-
const escape_string_regexp_1 = __importDefault(require("escape-string-regexp"));
|
22
|
-
const options_1 = require("./options");
|
23
|
-
const resolve_exports_1 = require("resolve.exports");
|
24
|
-
const entrypointPattern = /(?<filename>.*)[\\/]-embroider-entrypoint.js/;
|
25
|
-
function virtualEntrypoint(request, packageCache) {
|
26
|
-
var _a;
|
27
|
-
//TODO move the extra forwardslash handling out into the vite plugin
|
28
|
-
const candidates = [
|
29
|
-
'@embroider/virtual/compat-modules',
|
30
|
-
'/@embroider/virtual/compat-modules',
|
31
|
-
'./@embroider/virtual/compat-modules',
|
32
|
-
];
|
33
|
-
if (!candidates.some(c => request.specifier.startsWith(c + '/') || request.specifier === c)) {
|
34
|
-
return undefined;
|
35
|
-
}
|
36
|
-
const result = /\.?\/?@embroider\/virtual\/compat-modules(?:\/(?<packageName>.*))?/.exec(request.specifier);
|
37
|
-
if (!result) {
|
38
|
-
throw new Error('bug: entrypoint does not match pattern' + request.specifier);
|
39
|
-
}
|
40
|
-
const { packageName } = result.groups;
|
41
|
-
const requestingPkg = packageCache.ownerOfFile(request.fromFile);
|
42
|
-
if (!(requestingPkg === null || requestingPkg === void 0 ? void 0 : requestingPkg.isV2Ember())) {
|
43
|
-
throw new Error(`bug: found entrypoint import in non-ember package at ${request.fromFile}`);
|
44
|
-
}
|
45
|
-
let pkg;
|
46
|
-
if (packageName) {
|
47
|
-
pkg = packageCache.resolve(packageName, requestingPkg);
|
48
|
-
}
|
49
|
-
else {
|
50
|
-
pkg = requestingPkg;
|
51
|
-
}
|
52
|
-
let matched = (0, resolve_exports_1.exports)(pkg.packageJSON, '-embroider-entrypoint.js', {
|
53
|
-
browser: true,
|
54
|
-
conditions: ['default', 'imports'],
|
55
|
-
});
|
56
|
-
return {
|
57
|
-
type: 'entrypoint',
|
58
|
-
specifier: (0, path_1.resolve)(pkg.root, (_a = matched === null || matched === void 0 ? void 0 : matched[0]) !== null && _a !== void 0 ? _a : '-embroider-entrypoint.js'),
|
59
|
-
};
|
60
|
-
}
|
61
|
-
function decodeEntrypoint(filename) {
|
62
|
-
// Performance: avoid paying regex exec cost unless needed
|
63
|
-
if (!filename.includes('-embroider-entrypoint')) {
|
64
|
-
return;
|
65
|
-
}
|
66
|
-
let m = entrypointPattern.exec(filename);
|
67
|
-
if (m) {
|
68
|
-
return {
|
69
|
-
fromDir: m.groups.filename,
|
70
|
-
};
|
71
|
-
}
|
72
|
-
}
|
73
|
-
function staticAppPathsPattern(staticAppPaths) {
|
74
|
-
if (staticAppPaths && staticAppPaths.length > 0) {
|
75
|
-
return new RegExp('^(?:' + staticAppPaths.map(staticAppPath => (0, escape_string_regexp_1.default)(staticAppPath)).join('|') + ')(?:$|/)');
|
76
|
-
}
|
77
|
-
}
|
78
|
-
function renderEntrypoint(resolver, { fromDir }) {
|
79
|
-
var _a;
|
80
|
-
// this is new
|
81
|
-
const owner = resolver.packageCache.ownerOfFile(fromDir);
|
82
|
-
let eagerModules = [];
|
83
|
-
if (!owner) {
|
84
|
-
throw new Error('Owner expected'); // ToDo: Really bad error, update message
|
85
|
-
}
|
86
|
-
let engine = resolver.owningEngine(owner);
|
87
|
-
let isApp = (owner === null || owner === void 0 ? void 0 : owner.root) === resolver.options.engines[0].root;
|
88
|
-
let hasFastboot = Boolean(resolver.options.engines[0].activeAddons.find(a => a.name === 'ember-cli-fastboot'));
|
89
|
-
let appFiles = new app_files_1.AppFiles({
|
90
|
-
package: owner,
|
91
|
-
addons: new Map(engine.activeAddons.map(addon => [
|
92
|
-
resolver.packageCache.get(addon.root),
|
93
|
-
addon.canResolveFromFile,
|
94
|
-
])),
|
95
|
-
isApp,
|
96
|
-
modulePrefix: isApp ? resolver.options.modulePrefix : engine.packageName,
|
97
|
-
appRelativePath: 'NOT_USED_DELETE_ME',
|
98
|
-
}, getAppFiles(fromDir), hasFastboot ? getFastbootFiles(owner.root) : new Set(), (0, shared_internals_1.extensionsPattern)(resolver.options.resolvableExtensions), staticAppPathsPattern(resolver.options.staticAppPaths), resolver.options.podModulePrefix);
|
99
|
-
let options = (_a = resolver.options.options) !== null && _a !== void 0 ? _a : (0, options_1.optionsWithDefaults)();
|
100
|
-
let requiredAppFiles = [appFiles.otherAppFiles];
|
101
|
-
if (!options.staticComponents) {
|
102
|
-
requiredAppFiles.push(appFiles.components);
|
103
|
-
}
|
104
|
-
if (!options.staticHelpers) {
|
105
|
-
requiredAppFiles.push(appFiles.helpers);
|
106
|
-
}
|
107
|
-
if (!options.staticModifiers) {
|
108
|
-
requiredAppFiles.push(appFiles.modifiers);
|
109
|
-
}
|
110
|
-
let styles = [];
|
111
|
-
// only import styles from engines with a parent (this excludeds the parent application) as their styles
|
112
|
-
// will be inserted via a direct <link> tag.
|
113
|
-
if (!appFiles.engine.isApp && appFiles.engine.package.isLazyEngine()) {
|
114
|
-
styles.push({
|
115
|
-
path: '@embroider/virtual/vendor.css',
|
116
|
-
});
|
117
|
-
}
|
118
|
-
let lazyEngines = [];
|
119
|
-
if (isApp) {
|
120
|
-
// deliberately ignoring the app (which is the first entry in the engines array)
|
121
|
-
let [, ...childEngines] = resolver.options.engines;
|
122
|
-
for (let childEngine of childEngines) {
|
123
|
-
let target = `@embroider/virtual/compat-modules/${childEngine.packageName}`;
|
124
|
-
if (childEngine.isLazy) {
|
125
|
-
lazyEngines.push({
|
126
|
-
names: [childEngine.packageName],
|
127
|
-
path: target,
|
128
|
-
});
|
129
|
-
}
|
130
|
-
else {
|
131
|
-
eagerModules.push(target);
|
132
|
-
}
|
133
|
-
}
|
134
|
-
}
|
135
|
-
let lazyRoutes = [];
|
136
|
-
for (let [routeName, routeFiles] of appFiles.routeFiles.children) {
|
137
|
-
splitRoute(routeName, routeFiles, resolver.options.splitAtRoutes, (_, filename) => {
|
138
|
-
requiredAppFiles.push([filename]);
|
139
|
-
}, (routeNames, _files) => {
|
140
|
-
lazyRoutes.push({
|
141
|
-
names: routeNames,
|
142
|
-
path: (0, virtual_route_entrypoint_1.encodePublicRouteEntrypoint)(routeNames, _files),
|
143
|
-
});
|
144
|
-
});
|
145
|
-
}
|
146
|
-
let [fastboot, nonFastboot] = (0, lodash_1.partition)(excludeDotFiles((0, lodash_1.flatten)(requiredAppFiles)), file => appFiles.isFastbootOnly.get(file));
|
147
|
-
let amdModules = nonFastboot.map(file => importPaths(resolver, appFiles, file));
|
148
|
-
let fastbootOnlyAmdModules = fastboot.map(file => importPaths(resolver, appFiles, file));
|
149
|
-
let params = {
|
150
|
-
amdModules,
|
151
|
-
fastbootOnlyAmdModules,
|
152
|
-
lazyRoutes,
|
153
|
-
lazyEngines,
|
154
|
-
eagerModules,
|
155
|
-
styles,
|
156
|
-
// this is a backward-compatibility feature: addons can force inclusion of modules.
|
157
|
-
defineModulesFrom: './-embroider-implicit-modules.js',
|
158
|
-
};
|
159
|
-
return {
|
160
|
-
src: entryTemplate(params),
|
161
|
-
watches: [fromDir],
|
162
|
-
};
|
163
|
-
}
|
164
|
-
const entryTemplate = (0, js_handlebars_1.compile)(`
|
165
|
-
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
166
|
-
|
167
|
-
{{#if styles}}
|
168
|
-
if (macroCondition(!getGlobalConfig().fastboot?.isRunning)) {
|
169
|
-
{{#each styles as |stylePath| ~}}
|
170
|
-
await import("{{js-string-escape stylePath.path}}");
|
171
|
-
{{/each}}
|
172
|
-
}
|
173
|
-
{{/if}}
|
174
|
-
|
175
|
-
{{#if defineModulesFrom ~}}
|
176
|
-
import implicitModules from "{{js-string-escape defineModulesFrom}}";
|
177
|
-
{{/if}}
|
178
|
-
|
179
|
-
{{#each eagerModules as |eagerModule| ~}}
|
180
|
-
import "{{js-string-escape eagerModule}}";
|
181
|
-
{{/each}}
|
182
|
-
|
183
|
-
{{#each amdModules as |amdModule index| ~}}
|
184
|
-
import * as amdModule{{index}} from "{{js-string-escape amdModule.buildtime}}"
|
185
|
-
{{/each}}
|
186
|
-
|
187
|
-
let exportFastbootModules = {};
|
188
|
-
|
189
|
-
{{#if fastbootOnlyAmdModules}}
|
190
|
-
if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {
|
191
|
-
let fastbootModules = {};
|
192
|
-
|
193
|
-
{{#each fastbootOnlyAmdModules as |amdModule| ~}}
|
194
|
-
fastbootModules["{{js-string-escape amdModule.runtime}}"] = import("{{js-string-escape amdModule.buildtime}}");
|
195
|
-
{{/each}}
|
196
|
-
|
197
|
-
const resolvedValues = await Promise.all(Object.values(fastbootModules));
|
198
|
-
|
199
|
-
Object.keys(fastbootModules).forEach((k, i) => {
|
200
|
-
exportFasbootModules[k] = resolvedValues[i];
|
201
|
-
})
|
202
|
-
}
|
203
|
-
{{/if}}
|
204
|
-
|
205
|
-
|
206
|
-
{{#if lazyRoutes}}
|
207
|
-
window._embroiderRouteBundles_ = [
|
208
|
-
{{#each lazyRoutes as |route|}}
|
209
|
-
{
|
210
|
-
names: {{json-stringify route.names}},
|
211
|
-
load: function() {
|
212
|
-
return import("{{js-string-escape route.path}}");
|
213
|
-
}
|
214
|
-
},
|
215
|
-
{{/each}}
|
216
|
-
]
|
217
|
-
{{/if}}
|
218
|
-
|
219
|
-
{{#if lazyEngines}}
|
220
|
-
window._embroiderEngineBundles_ = [
|
221
|
-
{{#each lazyEngines as |engine|}}
|
222
|
-
{
|
223
|
-
names: {{json-stringify engine.names}},
|
224
|
-
load: function() {
|
225
|
-
return import("{{js-string-escape engine.path}}");
|
226
|
-
}
|
227
|
-
},
|
228
|
-
{{/each}}
|
229
|
-
]
|
230
|
-
{{/if}}
|
231
|
-
|
232
|
-
export default Object.assign(
|
233
|
-
{},
|
234
|
-
implicitModules,
|
235
|
-
{
|
236
|
-
{{#each amdModules as |amdModule index| ~}}
|
237
|
-
"{{js-string-escape amdModule.runtime}}": amdModule{{index}},
|
238
|
-
{{/each}}
|
239
|
-
},
|
240
|
-
exportFastbootModules
|
241
|
-
);
|
242
|
-
`);
|
243
|
-
function excludeDotFiles(files) {
|
244
|
-
return files.filter(file => !file.startsWith('.') && !file.includes('/.'));
|
245
|
-
}
|
246
|
-
function importPaths(resolver, { engine }, engineRelativePath) {
|
247
|
-
let resolvableExtensionsPattern = (0, shared_internals_1.extensionsPattern)(resolver.options.resolvableExtensions);
|
248
|
-
let noHBS = engineRelativePath.replace(resolvableExtensionsPattern, '').replace(/\.hbs$/, '');
|
249
|
-
return {
|
250
|
-
runtime: `${engine.modulePrefix}/${noHBS}`,
|
251
|
-
buildtime: `./${engineRelativePath}`,
|
252
|
-
};
|
253
|
-
}
|
254
|
-
function splitRoute(routeName, files, splitAtRoutes, addToParent, addLazyBundle) {
|
255
|
-
let shouldSplit = routeName && shouldSplitRoute(routeName, splitAtRoutes);
|
256
|
-
let ownFiles = [];
|
257
|
-
let ownNames = new Set();
|
258
|
-
if (files.template) {
|
259
|
-
if (shouldSplit) {
|
260
|
-
ownFiles.push(files.template);
|
261
|
-
ownNames.add(routeName);
|
262
|
-
}
|
263
|
-
else {
|
264
|
-
addToParent(routeName, files.template);
|
265
|
-
}
|
266
|
-
}
|
267
|
-
if (files.controller) {
|
268
|
-
if (shouldSplit) {
|
269
|
-
ownFiles.push(files.controller);
|
270
|
-
ownNames.add(routeName);
|
271
|
-
}
|
272
|
-
else {
|
273
|
-
addToParent(routeName, files.controller);
|
274
|
-
}
|
275
|
-
}
|
276
|
-
if (files.route) {
|
277
|
-
if (shouldSplit) {
|
278
|
-
ownFiles.push(files.route);
|
279
|
-
ownNames.add(routeName);
|
280
|
-
}
|
281
|
-
else {
|
282
|
-
addToParent(routeName, files.route);
|
283
|
-
}
|
284
|
-
}
|
285
|
-
for (let [childName, childFiles] of files.children) {
|
286
|
-
splitRoute(`${routeName}.${childName}`, childFiles, splitAtRoutes, (childRouteName, childFile) => {
|
287
|
-
// this is our child calling "addToParent"
|
288
|
-
if (shouldSplit) {
|
289
|
-
ownFiles.push(childFile);
|
290
|
-
ownNames.add(childRouteName);
|
291
|
-
}
|
292
|
-
else {
|
293
|
-
addToParent(childRouteName, childFile);
|
294
|
-
}
|
295
|
-
}, (routeNames, files) => {
|
296
|
-
addLazyBundle(routeNames, files);
|
297
|
-
});
|
298
|
-
}
|
299
|
-
if (ownFiles.length > 0) {
|
300
|
-
addLazyBundle([...ownNames], ownFiles);
|
301
|
-
}
|
302
|
-
}
|
303
|
-
function shouldSplitRoute(routeName, splitAtRoutes) {
|
304
|
-
if (!splitAtRoutes) {
|
305
|
-
return false;
|
306
|
-
}
|
307
|
-
return splitAtRoutes.find(pattern => {
|
308
|
-
if (typeof pattern === 'string') {
|
309
|
-
return pattern === routeName;
|
310
|
-
}
|
311
|
-
else {
|
312
|
-
return pattern.test(routeName);
|
313
|
-
}
|
314
|
-
});
|
315
|
-
}
|
316
|
-
function getAppFiles(appRoot) {
|
317
|
-
const files = (0, walk_sync_1.default)(appRoot, {
|
318
|
-
ignore: ['_babel_filter_.js', 'app.js', 'assets', 'testem.js', 'node_modules'],
|
319
|
-
});
|
320
|
-
return new Set(files);
|
321
|
-
}
|
322
|
-
function getFastbootFiles(appRoot) {
|
323
|
-
const appDirPath = (0, path_1.join)(appRoot, '_fastboot_');
|
324
|
-
const files = (0, walk_sync_1.default)(appDirPath);
|
325
|
-
return new Set(files);
|
326
|
-
}
|
327
|
-
//# sourceMappingURL=virtual-entrypoint.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"virtual-entrypoint.js","sourceRoot":"","sources":["virtual-entrypoint.ts"],"names":[],"mappings":";;;;;AAkBA,8CA2CC;AAED,4CAWC;AAED,sDAIC;AAED,4CAsHC;AA8FD,kCAOC;AAED,gCA6DC;AAeD,kCAKC;AAED,4CAIC;AAtYD,2CAAwD;AACxD,mDAA0C;AAG1C,mCAA4C;AAC5C,+BAAqC;AACrC,kEAA0G;AAC1G,0DAAiC;AAEjC,yEAAyE;AACzE,gFAAgD;AAChD,uCAAgD;AAEhD,qDAA4D;AAG5D,MAAM,iBAAiB,GAAG,8CAA8C,CAAC;AAEzE,SAAgB,iBAAiB,CAC/B,OAAsB,EACtB,YAAmC;;IAEnC,oEAAoE;IACpE,MAAM,UAAU,GAAG;QACjB,mCAAmC;QACnC,oCAAoC;QACpC,qCAAqC;KACtC,CAAC;IAEF,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,GAAG,GAAG,CAAC,IAAI,OAAO,CAAC,SAAS,KAAK,CAAC,CAAC,EAAE,CAAC;QAC5F,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,MAAM,MAAM,GAAG,oEAAoE,CAAC,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAE5G,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,wCAAwC,GAAG,OAAO,CAA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,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAgB,WAAW,CAAC,OAAe;IACzC,MAAM,KAAK,GAAa,IAAA,mBAAQ,EAAC,OAAO,EAAE;QACxC,MAAM,EAAE,CAAC,mBAAmB,EAAE,QAAQ,EAAE,QAAQ,EAAE,WAAW,EAAE,cAAc,CAAC;KAC/E,CAAC,CAAC;IACH,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC;AAED,SAAgB,gBAAgB,CAAC,OAAe;IAC9C,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC/C,MAAM,KAAK,GAAa,IAAA,mBAAQ,EAAC,UAAU,CAAC,CAAC;IAC7C,OAAO,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC;AACxB,CAAC","sourcesContent":["import { AppFiles, type RouteFiles } from './app-files';\nimport { compile } from './js-handlebars';\nimport type { Resolver } from './module-resolver';\nimport type { CompatResolverOptions } from '../../compat/src/resolver-transform';\nimport { flatten, partition } from 'lodash';\nimport { join, resolve } from 'path';\nimport { extensionsPattern, type PackageCachePublicAPI, type Package } from '@embroider/shared-internals';\nimport walkSync from 'walk-sync';\nimport type { V2AddonPackage } from '@embroider/shared-internals/src/package';\nimport { encodePublicRouteEntrypoint } from './virtual-route-entrypoint';\nimport escapeRegExp from 'escape-string-regexp';\nimport { optionsWithDefaults } from './options';\nimport { type ModuleRequest } from './module-request';\nimport { exports as resolveExports } from 'resolve.exports';\nimport { type VirtualResponse } from './virtual-content';\n\nconst entrypointPattern = /(?<filename>.*)[\\\\/]-embroider-entrypoint.js/;\n\nexport function virtualEntrypoint(\n request: ModuleRequest,\n packageCache: PackageCachePublicAPI\n): VirtualResponse | undefined {\n //TODO move the extra forwardslash handling out into the vite plugin\n const candidates = [\n '@embroider/virtual/compat-modules',\n '/@embroider/virtual/compat-modules',\n './@embroider/virtual/compat-modules',\n ];\n\n if (!candidates.some(c => request.specifier.startsWith(c + '/') || request.specifier === c)) {\n return undefined;\n }\n\n const result = /\\.?\\/?@embroider\\/virtual\\/compat-modules(?:\\/(?<packageName>.*))?/.exec(request.specifier);\n\n if (!result) {\n throw new Error('bug: entrypoint does not match pattern' + request.specifier);\n }\n\n const { packageName } = result.groups!;\n\n const requestingPkg = packageCache.ownerOfFile(request.fromFile);\n\n if (!requestingPkg?.isV2Ember()) {\n throw new Error(`bug: found entrypoint import in non-ember package at ${request.fromFile}`);\n }\n let pkg: Package;\n\n if (packageName) {\n pkg = packageCache.resolve(packageName, requestingPkg);\n } else {\n pkg = requestingPkg;\n }\n let matched = resolveExports(pkg.packageJSON, '-embroider-entrypoint.js', {\n browser: true,\n conditions: ['default', 'imports'],\n });\n return {\n type: 'entrypoint',\n specifier: resolve(pkg.root, matched?.[0] ?? '-embroider-entrypoint.js'),\n };\n}\n\nexport function decodeEntrypoint(filename: string): { fromDir: string } | undefined {\n // Performance: avoid paying regex exec cost unless needed\n if (!filename.includes('-embroider-entrypoint')) {\n return;\n }\n let m = entrypointPattern.exec(filename);\n if (m) {\n return {\n fromDir: m.groups!.filename,\n };\n }\n}\n\nexport function staticAppPathsPattern(staticAppPaths: string[] | undefined): RegExp | undefined {\n if (staticAppPaths && staticAppPaths.length > 0) {\n return new RegExp('^(?:' + staticAppPaths.map(staticAppPath => escapeRegExp(staticAppPath)).join('|') + ')(?:$|/)');\n }\n}\n\nexport function renderEntrypoint(\n resolver: Resolver,\n { fromDir }: { fromDir: string }\n): { src: string; watches: string[] } {\n // this is new\n const owner = resolver.packageCache.ownerOfFile(fromDir);\n\n let eagerModules: string[] = [];\n\n if (!owner) {\n throw new Error('Owner expected'); // ToDo: Really bad error, update message\n }\n\n let engine = resolver.owningEngine(owner);\n let isApp = owner?.root === resolver.options.engines[0]!.root;\n let hasFastboot = Boolean(resolver.options.engines[0]!.activeAddons.find(a => a.name === 'ember-cli-fastboot'));\n\n let appFiles = new AppFiles(\n {\n package: owner,\n addons: new Map(\n engine.activeAddons.map(addon => [\n resolver.packageCache.get(addon.root) as V2AddonPackage,\n addon.canResolveFromFile,\n ])\n ),\n isApp,\n modulePrefix: isApp ? resolver.options.modulePrefix : engine.packageName,\n appRelativePath: 'NOT_USED_DELETE_ME',\n },\n getAppFiles(fromDir),\n hasFastboot ? getFastbootFiles(owner.root) : new Set(),\n extensionsPattern(resolver.options.resolvableExtensions),\n staticAppPathsPattern(resolver.options.staticAppPaths),\n resolver.options.podModulePrefix\n );\n\n let options = (resolver.options as CompatResolverOptions).options ?? optionsWithDefaults();\n\n let requiredAppFiles = [appFiles.otherAppFiles];\n if (!options.staticComponents) {\n requiredAppFiles.push(appFiles.components);\n }\n if (!options.staticHelpers) {\n requiredAppFiles.push(appFiles.helpers);\n }\n if (!options.staticModifiers) {\n requiredAppFiles.push(appFiles.modifiers);\n }\n\n let styles = [];\n // only import styles from engines with a parent (this excludeds the parent application) as their styles\n // will be inserted via a direct <link> tag.\n if (!appFiles.engine.isApp && appFiles.engine.package.isLazyEngine()) {\n styles.push({\n path: '@embroider/virtual/vendor.css',\n });\n }\n\n let lazyEngines: { names: string[]; path: string }[] = [];\n\n if (isApp) {\n // deliberately ignoring the app (which is the first entry in the engines array)\n let [, ...childEngines] = resolver.options.engines;\n for (let childEngine of childEngines) {\n let target = `@embroider/virtual/compat-modules/${childEngine.packageName}`;\n\n if (childEngine.isLazy) {\n lazyEngines.push({\n names: [childEngine.packageName],\n path: target,\n });\n } else {\n eagerModules.push(target);\n }\n }\n }\n\n let lazyRoutes: { names: string[]; path: string }[] = [];\n for (let [routeName, routeFiles] of appFiles.routeFiles.children) {\n splitRoute(\n routeName,\n routeFiles,\n resolver.options.splitAtRoutes,\n (_: string, filename: string) => {\n requiredAppFiles.push([filename]);\n },\n (routeNames: string[], _files: string[]) => {\n lazyRoutes.push({\n names: routeNames,\n path: encodePublicRouteEntrypoint(routeNames, _files),\n });\n }\n );\n }\n\n let [fastboot, nonFastboot] = partition(excludeDotFiles(flatten(requiredAppFiles)), file =>\n appFiles.isFastbootOnly.get(file)\n );\n\n let amdModules = nonFastboot.map(file => importPaths(resolver, appFiles, file));\n let fastbootOnlyAmdModules = fastboot.map(file => importPaths(resolver, appFiles, file));\n\n let params = {\n amdModules,\n fastbootOnlyAmdModules,\n lazyRoutes,\n lazyEngines,\n eagerModules,\n styles,\n // this is a backward-compatibility feature: addons can force inclusion of modules.\n defineModulesFrom: './-embroider-implicit-modules.js',\n };\n\n return {\n src: entryTemplate(params),\n watches: [fromDir],\n };\n}\n\nconst entryTemplate = compile(`\nimport { macroCondition, getGlobalConfig } from '@embroider/macros';\n\n{{#if styles}}\n if (macroCondition(!getGlobalConfig().fastboot?.isRunning)) {\n {{#each styles as |stylePath| ~}}\n await import(\"{{js-string-escape stylePath.path}}\");\n {{/each}}\n }\n{{/if}}\n\n{{#if defineModulesFrom ~}}\n import implicitModules from \"{{js-string-escape defineModulesFrom}}\";\n{{/if}}\n\n{{#each eagerModules as |eagerModule| ~}}\n import \"{{js-string-escape eagerModule}}\";\n{{/each}}\n\n{{#each amdModules as |amdModule index| ~}}\n import * as amdModule{{index}} from \"{{js-string-escape amdModule.buildtime}}\"\n{{/each}}\n\nlet exportFastbootModules = {};\n\n{{#if fastbootOnlyAmdModules}}\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {\n let fastbootModules = {};\n\n {{#each fastbootOnlyAmdModules as |amdModule| ~}}\n fastbootModules[\"{{js-string-escape amdModule.runtime}}\"] = import(\"{{js-string-escape amdModule.buildtime}}\");\n {{/each}}\n\n const resolvedValues = await Promise.all(Object.values(fastbootModules));\n\n Object.keys(fastbootModules).forEach((k, i) => {\n exportFasbootModules[k] = resolvedValues[i];\n })\n }\n{{/if}}\n\n\n{{#if lazyRoutes}}\nwindow._embroiderRouteBundles_ = [\n {{#each lazyRoutes as |route|}}\n {\n names: {{json-stringify route.names}},\n load: function() {\n return import(\"{{js-string-escape route.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\n{{#if lazyEngines}}\nwindow._embroiderEngineBundles_ = [\n {{#each lazyEngines as |engine|}}\n {\n names: {{json-stringify engine.names}},\n load: function() {\n return import(\"{{js-string-escape engine.path}}\");\n }\n },\n {{/each}}\n]\n{{/if}}\n\nexport default Object.assign(\n {},\n implicitModules,\n {\n {{#each amdModules as |amdModule index| ~}}\n \"{{js-string-escape amdModule.runtime}}\": amdModule{{index}},\n {{/each}}\n },\n exportFastbootModules\n);\n`) as (params: {\n amdModules: { runtime: string; buildtime: string }[];\n fastbootOnlyAmdModules?: { runtime: string; buildtime: string }[];\n defineModulesFrom?: string;\n eagerModules?: string[];\n lazyRoutes?: { names: string[]; path: string }[];\n lazyEngines?: { names: string[]; path: string }[];\n styles?: { path: string }[];\n}) => string;\n\nfunction excludeDotFiles(files: string[]) {\n return files.filter(file => !file.startsWith('.') && !file.includes('/.'));\n}\n\nexport function importPaths(resolver: Resolver, { engine }: AppFiles, engineRelativePath: string) {\n let resolvableExtensionsPattern = extensionsPattern(resolver.options.resolvableExtensions);\n let noHBS = engineRelativePath.replace(resolvableExtensionsPattern, '').replace(/\\.hbs$/, '');\n return {\n runtime: `${engine.modulePrefix}/${noHBS}`,\n buildtime: `./${engineRelativePath}`,\n };\n}\n\nexport function splitRoute(\n routeName: string,\n files: RouteFiles,\n splitAtRoutes: (RegExp | string)[] | undefined,\n addToParent: (routeName: string, filename: string) => void,\n addLazyBundle: (routeNames: string[], files: string[]) => void\n) {\n let shouldSplit = routeName && shouldSplitRoute(routeName, splitAtRoutes);\n let ownFiles = [];\n let ownNames = new Set() as Set<string>;\n\n if (files.template) {\n if (shouldSplit) {\n ownFiles.push(files.template);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.template);\n }\n }\n\n if (files.controller) {\n if (shouldSplit) {\n ownFiles.push(files.controller);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.controller);\n }\n }\n\n if (files.route) {\n if (shouldSplit) {\n ownFiles.push(files.route);\n ownNames.add(routeName);\n } else {\n addToParent(routeName, files.route);\n }\n }\n\n for (let [childName, childFiles] of files.children) {\n splitRoute(\n `${routeName}.${childName}`,\n childFiles,\n splitAtRoutes,\n (childRouteName: string, childFile: string) => {\n // this is our child calling \"addToParent\"\n if (shouldSplit) {\n ownFiles.push(childFile);\n ownNames.add(childRouteName);\n } else {\n addToParent(childRouteName, childFile);\n }\n },\n (routeNames: string[], files: string[]) => {\n addLazyBundle(routeNames, files);\n }\n );\n }\n\n if (ownFiles.length > 0) {\n addLazyBundle([...ownNames], ownFiles);\n }\n}\n\nfunction shouldSplitRoute(routeName: string, splitAtRoutes: (RegExp | string)[] | undefined) {\n if (!splitAtRoutes) {\n return false;\n }\n return splitAtRoutes.find(pattern => {\n if (typeof pattern === 'string') {\n return pattern === routeName;\n } else {\n return pattern.test(routeName);\n }\n });\n}\n\nexport function getAppFiles(appRoot: string): Set<string> {\n const files: string[] = walkSync(appRoot, {\n ignore: ['_babel_filter_.js', 'app.js', 'assets', 'testem.js', 'node_modules'],\n });\n return new Set(files);\n}\n\nexport function getFastbootFiles(appRoot: string): Set<string> {\n const appDirPath = join(appRoot, '_fastboot_');\n const files: string[] = walkSync(appDirPath);\n return new Set(files);\n}\n"]}
|
@@ -1,16 +0,0 @@
|
|
1
|
-
import type { Resolver } from './module-resolver';
|
2
|
-
import { type Package } from '@embroider/shared-internals';
|
3
|
-
export declare function encodeRouteEntrypoint(pkg: Package, routeName: string): string;
|
4
|
-
export declare function decodeRouteEntrypoint(filename: string): {
|
5
|
-
fromDir: string;
|
6
|
-
route: string;
|
7
|
-
} | undefined;
|
8
|
-
export declare function encodePublicRouteEntrypoint(routeNames: string[], _files: string[]): string;
|
9
|
-
export declare function decodePublicRouteEntrypoint(specifier: string): string | null;
|
10
|
-
export declare function renderRouteEntrypoint(resolver: Resolver, { fromDir, route }: {
|
11
|
-
fromDir: string;
|
12
|
-
route: string;
|
13
|
-
}): {
|
14
|
-
src: string;
|
15
|
-
watches: string[];
|
16
|
-
};
|
@@ -1,100 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.encodeRouteEntrypoint = encodeRouteEntrypoint;
|
4
|
-
exports.decodeRouteEntrypoint = decodeRouteEntrypoint;
|
5
|
-
exports.encodePublicRouteEntrypoint = encodePublicRouteEntrypoint;
|
6
|
-
exports.decodePublicRouteEntrypoint = decodePublicRouteEntrypoint;
|
7
|
-
exports.renderRouteEntrypoint = renderRouteEntrypoint;
|
8
|
-
const app_files_1 = require("./app-files");
|
9
|
-
const path_1 = require("path");
|
10
|
-
const js_handlebars_1 = require("./js-handlebars");
|
11
|
-
const shared_internals_1 = require("@embroider/shared-internals");
|
12
|
-
const lodash_1 = require("lodash");
|
13
|
-
const virtual_entrypoint_1 = require("./virtual-entrypoint");
|
14
|
-
const resolve_exports_1 = require("resolve.exports");
|
15
|
-
const entrypointPattern = /(?<filename>.*)[\\/]-embroider-route-entrypoint.js:route=(?<route>.*)/;
|
16
|
-
function encodeRouteEntrypoint(pkg, routeName) {
|
17
|
-
let matched = (0, resolve_exports_1.exports)(pkg.packageJSON, '-embroider-route-entrypoint.js', {
|
18
|
-
browser: true,
|
19
|
-
conditions: ['default', 'imports'],
|
20
|
-
});
|
21
|
-
let target = matched ? `${matched}:route=${routeName}` : `-embroider-route-entrypoint.js:route=${routeName}`;
|
22
|
-
return (0, path_1.resolve)(pkg.root, target);
|
23
|
-
}
|
24
|
-
function decodeRouteEntrypoint(filename) {
|
25
|
-
// Performance: avoid paying regex exec cost unless needed
|
26
|
-
if (!filename.includes('-embroider-route-entrypoint')) {
|
27
|
-
return;
|
28
|
-
}
|
29
|
-
let m = entrypointPattern.exec(filename);
|
30
|
-
if (m) {
|
31
|
-
return {
|
32
|
-
fromDir: m.groups.filename,
|
33
|
-
route: m.groups.route,
|
34
|
-
};
|
35
|
-
}
|
36
|
-
}
|
37
|
-
function encodePublicRouteEntrypoint(routeNames, _files) {
|
38
|
-
return `@embroider/core/route/${encodeURIComponent(routeNames[0])}`;
|
39
|
-
}
|
40
|
-
function decodePublicRouteEntrypoint(specifier) {
|
41
|
-
const publicPrefix = '@embroider/core/route/';
|
42
|
-
if (!specifier.startsWith(publicPrefix)) {
|
43
|
-
return null;
|
44
|
-
}
|
45
|
-
return specifier.slice(publicPrefix.length);
|
46
|
-
}
|
47
|
-
function renderRouteEntrypoint(resolver, { fromDir, route }) {
|
48
|
-
const owner = resolver.packageCache.ownerOfFile(fromDir);
|
49
|
-
if (!owner) {
|
50
|
-
throw new Error('Owner expected'); // ToDo: Really bad error, update message
|
51
|
-
}
|
52
|
-
let engine = resolver.owningEngine(owner);
|
53
|
-
let isApp = (owner === null || owner === void 0 ? void 0 : owner.root) === resolver.options.engines[0].root;
|
54
|
-
let hasFastboot = Boolean(resolver.options.engines[0].activeAddons.find(a => a.name === 'ember-cli-fastboot'));
|
55
|
-
let appFiles = new app_files_1.AppFiles({
|
56
|
-
package: owner,
|
57
|
-
addons: new Map(engine.activeAddons.map(addon => [
|
58
|
-
resolver.packageCache.get(addon.root),
|
59
|
-
addon.canResolveFromFile,
|
60
|
-
])),
|
61
|
-
isApp,
|
62
|
-
modulePrefix: isApp ? resolver.options.modulePrefix : engine.packageName,
|
63
|
-
appRelativePath: 'NOT_USED_DELETE_ME',
|
64
|
-
}, (0, virtual_entrypoint_1.getAppFiles)(fromDir), hasFastboot ? (0, virtual_entrypoint_1.getFastbootFiles)(owner.root) : new Set(), (0, shared_internals_1.extensionsPattern)(resolver.options.resolvableExtensions), (0, virtual_entrypoint_1.staticAppPathsPattern)(resolver.options.staticAppPaths), resolver.options.podModulePrefix);
|
65
|
-
let src = '';
|
66
|
-
for (let [routeName, routeFiles] of appFiles.routeFiles.children) {
|
67
|
-
(0, virtual_entrypoint_1.splitRoute)(routeName, routeFiles, resolver.options.splitAtRoutes, (_, _filename) => {
|
68
|
-
// noop
|
69
|
-
}, (routeNames, routeFiles) => {
|
70
|
-
if (routeNames[0] === route) {
|
71
|
-
let [fastboot, nonFastboot] = (0, lodash_1.partition)(routeFiles, file => appFiles.isFastbootOnly.get(file));
|
72
|
-
const amdModules = nonFastboot.map(f => (0, virtual_entrypoint_1.importPaths)(resolver, appFiles, f));
|
73
|
-
const fastbootOnlyAmdModules = fastboot.map(f => (0, virtual_entrypoint_1.importPaths)(resolver, appFiles, f));
|
74
|
-
src = routeEntryTemplate({
|
75
|
-
amdModules,
|
76
|
-
fastbootOnlyAmdModules,
|
77
|
-
});
|
78
|
-
}
|
79
|
-
});
|
80
|
-
}
|
81
|
-
return { src, watches: [] };
|
82
|
-
}
|
83
|
-
const routeEntryTemplate = (0, js_handlebars_1.compile)(`
|
84
|
-
const output = {};
|
85
|
-
export default output;
|
86
|
-
|
87
|
-
{{#each amdModules as |amdModule index| ~}}
|
88
|
-
import * as amdModule{{index}} from "{{js-string-escape amdModule.buildtime}}"
|
89
|
-
output["{{js-string-escape amdModule.runtime}}"] = amdModule{{index}};
|
90
|
-
{{/each}}
|
91
|
-
|
92
|
-
{{#if fastbootOnlyAmdModules}}
|
93
|
-
if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {
|
94
|
-
{{#each fastbootOnlyAmdModules as |amdModule| ~}}
|
95
|
-
output["{{js-string-escape amdModule.runtime}}"] = await import("{{js-string-escape amdModule.buildtime}}");
|
96
|
-
{{/each}}
|
97
|
-
}
|
98
|
-
{{/if}}
|
99
|
-
`);
|
100
|
-
//# sourceMappingURL=virtual-route-entrypoint.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"virtual-route-entrypoint.js","sourceRoot":"","sources":["virtual-route-entrypoint.ts"],"names":[],"mappings":";;AAYA,sDAOC;AAED,sDAYC;AAED,kEAEC;AAED,kEAOC;AAED,sDA6DC;AA5GD,2CAAuC;AAEvC,+BAA+B;AAC/B,mDAA0C;AAC1C,kEAA8E;AAC9E,mCAAmC;AACnC,6DAAqH;AACrH,qDAA4D;AAE5D,MAAM,iBAAiB,GAAG,uEAAuE,CAAC;AAElG,SAAgB,qBAAqB,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;;;;;;;;;;;;CAgBlC,CAGW,CAAC","sourcesContent":["import type { V2AddonPackage } from '@embroider/shared-internals/src/package';\nimport { AppFiles } from './app-files';\nimport type { Resolver } from './module-resolver';\nimport { resolve } from 'path';\nimport { compile } from './js-handlebars';\nimport { extensionsPattern, type Package } from '@embroider/shared-internals';\nimport { partition } from 'lodash';\nimport { getAppFiles, getFastbootFiles, importPaths, splitRoute, staticAppPathsPattern } from './virtual-entrypoint';\nimport { exports as resolveExports } from 'resolve.exports';\n\nconst entrypointPattern = /(?<filename>.*)[\\\\/]-embroider-route-entrypoint.js:route=(?<route>.*)/;\n\nexport function encodeRouteEntrypoint(pkg: Package, routeName: string): string {\n let matched = resolveExports(pkg.packageJSON, '-embroider-route-entrypoint.js', {\n browser: true,\n conditions: ['default', 'imports'],\n });\n let target = matched ? `${matched}:route=${routeName}` : `-embroider-route-entrypoint.js:route=${routeName}`;\n return resolve(pkg.root, target);\n}\n\nexport function decodeRouteEntrypoint(filename: string): { fromDir: string; route: string } | undefined {\n // Performance: avoid paying regex exec cost unless needed\n if (!filename.includes('-embroider-route-entrypoint')) {\n return;\n }\n let m = entrypointPattern.exec(filename);\n if (m) {\n return {\n fromDir: m.groups!.filename,\n route: m.groups!.route,\n };\n }\n}\n\nexport function encodePublicRouteEntrypoint(routeNames: string[], _files: string[]) {\n return `@embroider/core/route/${encodeURIComponent(routeNames[0])}`;\n}\n\nexport function decodePublicRouteEntrypoint(specifier: string): string | null {\n const publicPrefix = '@embroider/core/route/';\n if (!specifier.startsWith(publicPrefix)) {\n return null;\n }\n\n return specifier.slice(publicPrefix.length);\n}\n\nexport function renderRouteEntrypoint(\n resolver: Resolver,\n { fromDir, route }: { fromDir: string; route: string }\n): { src: string; watches: string[] } {\n const owner = resolver.packageCache.ownerOfFile(fromDir);\n\n if (!owner) {\n throw new Error('Owner expected'); // ToDo: Really bad error, update message\n }\n\n let engine = resolver.owningEngine(owner);\n let isApp = owner?.root === resolver.options.engines[0]!.root;\n let hasFastboot = Boolean(resolver.options.engines[0]!.activeAddons.find(a => a.name === 'ember-cli-fastboot'));\n\n let appFiles = new AppFiles(\n {\n package: owner,\n addons: new Map(\n engine.activeAddons.map(addon => [\n resolver.packageCache.get(addon.root) as V2AddonPackage,\n addon.canResolveFromFile,\n ])\n ),\n isApp,\n modulePrefix: isApp ? resolver.options.modulePrefix : engine.packageName,\n appRelativePath: 'NOT_USED_DELETE_ME',\n },\n getAppFiles(fromDir),\n hasFastboot ? getFastbootFiles(owner.root) : new Set(),\n extensionsPattern(resolver.options.resolvableExtensions),\n staticAppPathsPattern(resolver.options.staticAppPaths),\n resolver.options.podModulePrefix\n );\n\n let src = '';\n\n for (let [routeName, routeFiles] of appFiles.routeFiles.children) {\n splitRoute(\n routeName,\n routeFiles,\n resolver.options.splitAtRoutes,\n (_: string, _filename: string) => {\n // noop\n },\n (routeNames: string[], routeFiles: string[]) => {\n if (routeNames[0] === route) {\n let [fastboot, nonFastboot] = partition(routeFiles, file => appFiles.isFastbootOnly.get(file));\n\n const amdModules = nonFastboot.map(f => importPaths(resolver, appFiles, f));\n const fastbootOnlyAmdModules = fastboot.map(f => importPaths(resolver, appFiles, f));\n\n src = routeEntryTemplate({\n amdModules,\n fastbootOnlyAmdModules,\n });\n }\n }\n );\n }\n\n return { src, watches: [] };\n}\n\nconst routeEntryTemplate = compile(`\nconst output = {};\nexport default output;\n\n{{#each amdModules as |amdModule index| ~}}\n import * as amdModule{{index}} from \"{{js-string-escape amdModule.buildtime}}\"\n output[\"{{js-string-escape amdModule.runtime}}\"] = amdModule{{index}};\n{{/each}}\n\n{{#if fastbootOnlyAmdModules}}\n if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {\n {{#each fastbootOnlyAmdModules as |amdModule| ~}}\n output[\"{{js-string-escape amdModule.runtime}}\"] = await import(\"{{js-string-escape amdModule.buildtime}}\");\n {{/each}}\n }\n{{/if}}\n`) as (params: {\n amdModules: { runtime: string; buildtime: string }[];\n fastbootOnlyAmdModules: { runtime: string; buildtime: string }[];\n}) => string;\n"]}
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import type { Resolver } from './module-resolver';
|
2
|
-
import type { VirtualContentResult } from './virtual-content';
|
3
|
-
export declare function decodeTestSupportStyles(filename: string): boolean;
|
4
|
-
export declare function renderTestSupportStyles(filename: string, resolver: Resolver): VirtualContentResult;
|
@@ -1,64 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.decodeTestSupportStyles = decodeTestSupportStyles;
|
7
|
-
exports.renderTestSupportStyles = renderTestSupportStyles;
|
8
|
-
const fs_1 = require("fs");
|
9
|
-
const lodash_1 = require("lodash");
|
10
|
-
const resolve_1 = __importDefault(require("resolve"));
|
11
|
-
function decodeTestSupportStyles(filename) {
|
12
|
-
return filename.endsWith('-embroider-test-support-styles.css');
|
13
|
-
}
|
14
|
-
function renderTestSupportStyles(filename, resolver) {
|
15
|
-
const owner = resolver.packageCache.ownerOfFile(filename);
|
16
|
-
if (!owner) {
|
17
|
-
throw new Error(`Failed to find a valid owner for ${filename}`);
|
18
|
-
}
|
19
|
-
return { src: getTestSupportStyles(owner, resolver), watches: [] };
|
20
|
-
}
|
21
|
-
function getTestSupportStyles(owner, resolver) {
|
22
|
-
let engineConfig = resolver.owningEngine(owner);
|
23
|
-
let engine = {
|
24
|
-
package: owner,
|
25
|
-
addons: new Map(engineConfig.activeAddons.map(addon => [
|
26
|
-
resolver.packageCache.get(addon.root),
|
27
|
-
addon.canResolveFromFile,
|
28
|
-
])),
|
29
|
-
isApp: true,
|
30
|
-
modulePrefix: resolver.options.modulePrefix,
|
31
|
-
appRelativePath: 'NOT_USED_DELETE_ME',
|
32
|
-
};
|
33
|
-
return generateTestSupportStyles(engine);
|
34
|
-
}
|
35
|
-
function generateTestSupportStyles(engine) {
|
36
|
-
let result = impliedAddonTestSupportStyles(engine).map((sourcePath) => {
|
37
|
-
let source = (0, fs_1.readFileSync)(sourcePath);
|
38
|
-
return `${source}`;
|
39
|
-
});
|
40
|
-
return result.join('');
|
41
|
-
}
|
42
|
-
function impliedAddonTestSupportStyles(engine) {
|
43
|
-
let result = [];
|
44
|
-
for (let addon of (0, lodash_1.sortBy)(Array.from(engine.addons.keys()), pkg => {
|
45
|
-
switch (pkg.name) {
|
46
|
-
case 'loader.js':
|
47
|
-
return 0;
|
48
|
-
case 'ember-source':
|
49
|
-
return 10;
|
50
|
-
default:
|
51
|
-
return 1000;
|
52
|
-
}
|
53
|
-
})) {
|
54
|
-
let implicitStyles = addon.meta['implicit-test-styles'];
|
55
|
-
if (implicitStyles) {
|
56
|
-
let options = { basedir: addon.root };
|
57
|
-
for (let mod of implicitStyles) {
|
58
|
-
result.push(resolve_1.default.sync(mod, options));
|
59
|
-
}
|
60
|
-
}
|
61
|
-
}
|
62
|
-
return result;
|
63
|
-
}
|
64
|
-
//# sourceMappingURL=virtual-test-support-styles.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"virtual-test-support-styles.js","sourceRoot":"","sources":["virtual-test-support-styles.ts"],"names":[],"mappings":";;;;;AASA,0DAEC;AAED,0DAMC;AAjBD,2BAAkC;AAClC,mCAAgC;AAChC,sDAA8B;AAK9B,SAAgB,uBAAuB,CAAC,QAAgB;IACtD,OAAO,QAAQ,CAAC,QAAQ,CAAC,oCAAoC,CAAC,CAAC;AACjE,CAAC;AAED,SAAgB,uBAAuB,CAAC,QAAgB,EAAE,QAAkB;IAC1E,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,CAAC;IAC1D,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,EAAE,CAAC,CAAC;IAClE,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,oBAA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,KAAK,cAAc;gBACjB,OAAO,EAAE,CAAC;YACZ;gBACE,OAAO,IAAI,CAAC;QAChB,CAAC;IACH,CAAC,CAAC,EAAE,CAAC;QACH,IAAI,cAAc,GAAG,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QACxD,IAAI,cAAc,EAAE,CAAC;YACnB,IAAI,OAAO,GAAG,EAAE,OAAO,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;YACtC,KAAK,IAAI,GAAG,IAAI,cAAc,EAAE,CAAC;gBAC/B,MAAM,CAAC,IAAI,CAAC,iBAAO,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC,CAAC;YAC1C,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import type { Package } from '@embroider/shared-internals';\nimport type { V2AddonPackage } from '@embroider/shared-internals/src/package';\nimport { readFileSync } from 'fs';\nimport { sortBy } from 'lodash';\nimport resolve from 'resolve';\nimport type { Engine } from './app-files';\nimport type { Resolver } from './module-resolver';\nimport type { VirtualContentResult } from './virtual-content';\n\nexport function decodeTestSupportStyles(filename: string): boolean {\n return filename.endsWith('-embroider-test-support-styles.css');\n}\n\nexport function renderTestSupportStyles(filename: string, resolver: Resolver): VirtualContentResult {\n const owner = resolver.packageCache.ownerOfFile(filename);\n if (!owner) {\n throw new Error(`Failed to find a valid owner for ${filename}`);\n }\n return { src: getTestSupportStyles(owner, resolver), watches: [] };\n}\n\nfunction getTestSupportStyles(owner: Package, resolver: Resolver): string {\n let engineConfig = resolver.owningEngine(owner);\n let engine: Engine = {\n package: owner,\n addons: new Map(\n engineConfig.activeAddons.map(addon => [\n resolver.packageCache.get(addon.root) as V2AddonPackage,\n addon.canResolveFromFile,\n ])\n ),\n isApp: true,\n modulePrefix: resolver.options.modulePrefix,\n appRelativePath: 'NOT_USED_DELETE_ME',\n };\n\n return generateTestSupportStyles(engine);\n}\n\nfunction generateTestSupportStyles(engine: Engine): string {\n let result: string[] = impliedAddonTestSupportStyles(engine).map((sourcePath: string): string => {\n let source = readFileSync(sourcePath);\n return `${source}`;\n });\n\n return result.join('') as string;\n}\n\nfunction impliedAddonTestSupportStyles(engine: Engine): string[] {\n let result: Array<string> = [];\n for (let addon of sortBy(Array.from(engine.addons.keys()), pkg => {\n switch (pkg.name) {\n case 'loader.js':\n return 0;\n case 'ember-source':\n return 10;\n default:\n return 1000;\n }\n })) {\n let implicitStyles = addon.meta['implicit-test-styles'];\n if (implicitStyles) {\n let options = { basedir: addon.root };\n for (let mod of implicitStyles) {\n result.push(resolve.sync(mod, options));\n }\n }\n }\n return result;\n}\n"]}
|
@@ -1,4 +0,0 @@
|
|
1
|
-
import type { Resolver } from './module-resolver';
|
2
|
-
import type { VirtualContentResult } from './virtual-content';
|
3
|
-
export declare function decodeImplicitTestScripts(filename: string): boolean;
|
4
|
-
export declare function renderImplicitTestScripts(filename: string, resolver: Resolver): VirtualContentResult;
|