@embroider/core 3.4.14-unstable.f653cff → 3.4.14-unstable.f73dd26
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
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@embroider/core",
|
3
|
-
"version": "3.4.14-unstable.
|
3
|
+
"version": "3.4.14-unstable.f73dd26",
|
4
4
|
"private": false,
|
5
5
|
"description": "A build system for EmberJS applications.",
|
6
6
|
"repository": {
|
@@ -41,9 +41,9 @@
|
|
41
41
|
"resolve.exports": "^2.0.2",
|
42
42
|
"typescript-memoize": "^1.0.1",
|
43
43
|
"walk-sync": "^3.0.0",
|
44
|
-
"@embroider/macros": "1.16.5-unstable.
|
45
|
-
"@embroider/
|
46
|
-
"@embroider/
|
44
|
+
"@embroider/macros": "1.16.5-unstable.f73dd26",
|
45
|
+
"@embroider/shared-internals": "2.6.2-unstable.f73dd26",
|
46
|
+
"@embroider/reverse-exports": "0.1.1-unstable.f73dd26"
|
47
47
|
},
|
48
48
|
"devDependencies": {
|
49
49
|
"@glimmer/syntax": "^0.84.2",
|
@@ -122,9 +122,7 @@ function renderEntrypoint(resolver, { fromFile }) {
|
|
122
122
|
};
|
123
123
|
}
|
124
124
|
const entryTemplate = (0, js_handlebars_1.compile)(`
|
125
|
-
import {
|
126
|
-
let w = window;
|
127
|
-
let d = w.define;
|
125
|
+
import { macroCondition, getGlobalConfig } from '@embroider/macros';
|
128
126
|
|
129
127
|
import environment from './config/environment';
|
130
128
|
|
@@ -138,22 +136,18 @@ import environment from './config/environment';
|
|
138
136
|
|
139
137
|
{{#if defineModulesFrom ~}}
|
140
138
|
import implicitModules from "{{js-string-escape defineModulesFrom}}";
|
141
|
-
|
142
|
-
for(const [name, module] of Object.entries(implicitModules)) {
|
143
|
-
d(name, function() { return module });
|
144
|
-
}
|
145
139
|
{{/if}}
|
146
140
|
|
147
|
-
|
148
141
|
{{#each eagerModules as |eagerModule| ~}}
|
149
142
|
import "{{js-string-escape eagerModule}}";
|
150
143
|
{{/each}}
|
151
144
|
|
152
145
|
{{#each amdModules as |amdModule index| ~}}
|
153
146
|
import * as amdModule{{index}} from "{{js-string-escape amdModule.buildtime}}"
|
154
|
-
d("{{js-string-escape amdModule.runtime}}", function(){ return amdModule{{index}}; });
|
155
147
|
{{/each}}
|
156
148
|
|
149
|
+
let exportFastbootModules = {};
|
150
|
+
|
157
151
|
{{#if fastbootOnlyAmdModules}}
|
158
152
|
if (macroCondition(getGlobalConfig().fastboot?.isRunning)) {
|
159
153
|
let fastbootModules = {};
|
@@ -165,14 +159,14 @@ import environment from './config/environment';
|
|
165
159
|
const resolvedValues = await Promise.all(Object.values(fastbootModules));
|
166
160
|
|
167
161
|
Object.keys(fastbootModules).forEach((k, i) => {
|
168
|
-
|
162
|
+
exportFasbootModules[k] = resolvedValues[i];
|
169
163
|
})
|
170
164
|
}
|
171
165
|
{{/if}}
|
172
166
|
|
173
167
|
|
174
168
|
{{#if lazyRoutes}}
|
175
|
-
|
169
|
+
window._embroiderRouteBundles_ = [
|
176
170
|
{{#each lazyRoutes as |route|}}
|
177
171
|
{
|
178
172
|
names: {{json-stringify route.names}},
|
@@ -185,7 +179,7 @@ w._embroiderRouteBundles_ = [
|
|
185
179
|
{{/if}}
|
186
180
|
|
187
181
|
{{#if lazyEngines}}
|
188
|
-
|
182
|
+
window._embroiderEngineBundles_ = [
|
189
183
|
{{#each lazyEngines as |engine|}}
|
190
184
|
{
|
191
185
|
names: {{json-stringify engine.names}},
|
@@ -196,6 +190,17 @@ w._embroiderEngineBundles_ = [
|
|
196
190
|
{{/each}}
|
197
191
|
]
|
198
192
|
{{/if}}
|
193
|
+
|
194
|
+
export default Object.assign(
|
195
|
+
{},
|
196
|
+
implicitModules,
|
197
|
+
{
|
198
|
+
{{#each amdModules as |amdModule index| ~}}
|
199
|
+
"{{js-string-escape amdModule.runtime}}": amdModule{{index}},
|
200
|
+
{{/each}}
|
201
|
+
},
|
202
|
+
exportFastbootModules
|
203
|
+
);
|
199
204
|
`);
|
200
205
|
function excludeDotFiles(files) {
|
201
206
|
return files.filter(file => !file.startsWith('.') && !file.includes('/.'));
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"virtual-entrypoint.js","sourceRoot":"","sources":["virtual-entrypoint.ts"],"names":[],"mappings":";;;;;AAcA,4CAWC;AAED,sDAIC;AAED,4CAsHC;AA2FD,kCAOC;AAED,gCA6DC;AAeD,kCAKC;AAED,4CAIC;AAlVD,2CAAwD;AACxD,mDAA0C;AAG1C,mCAA4C;AAC5C,+BAA4B;AAC5B,kEAAgE;AAChE,0DAAiC;AAEjC,yEAAyE;AACzE,gFAAgD;AAEhD,MAAM,iBAAiB,GAAG,8CAA8C,CAAC;AAEzE,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,0DAA0D;IAC1D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IACD,IAAI,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,CAAC;QACN,OAAO;YACL,QAAQ,EAAE,CAAC,CAAC,MAAO,CAAC,QAAQ;SAC7B,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,qBAAqB,CAAC,cAAoC;IACxE,IAAI,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,OAAO,IAAI,MAAM,CAAC,MAAM,GAAG,cAAc,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC,IAAA,8BAAY,EAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC,CAAC;IACtH,CAAC;AACH,CAAC;AAED,SAAgB,gBAAgB,CAC9B,QAAkB,EAClB,EAAE,QAAQ,EAAwB;IAElC,cAAc;IACd,MAAM,KAAK,GAAG,QAA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,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 } from 'path';\nimport { extensionsPattern } 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';\n\nconst entrypointPattern = /(?<filename>.*)[\\\\/]-embroider-entrypoint.js/;\n\nexport function decodeEntrypoint(filename: string): { fromFile: 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 fromFile: 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 { fromFile }: { fromFile: string }\n): { src: string; watches: string[] } {\n // this is new\n const owner = resolver.packageCache.ownerOfFile(fromFile);\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(owner.root),\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;\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/core/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/core/entrypoint/${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: [],\n };\n}\n\nconst entryTemplate = compile(`\nimport { importSync as i, macroCondition, getGlobalConfig } from '@embroider/macros';\nlet w = window;\nlet d = w.define;\n\nimport environment from './config/environment';\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\n for(const [name, module] of Object.entries(implicitModules)) {\n d(name, function() { return module });\n }\n{{/if}}\n\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 d(\"{{js-string-escape amdModule.runtime}}\", function(){ return amdModule{{index}}; });\n{{/each}}\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 d(k, function(){ return resolvedValues[i];});\n })\n }\n{{/if}}\n\n\n{{#if lazyRoutes}}\nw._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}}\nw._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`) 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
|
+
{"version":3,"file":"virtual-entrypoint.js","sourceRoot":"","sources":["virtual-entrypoint.ts"],"names":[],"mappings":";;;;;AAcA,4CAWC;AAED,sDAIC;AAED,4CAsHC;AAgGD,kCAOC;AAED,gCA6DC;AAeD,kCAKC;AAED,4CAIC;AAvVD,2CAAwD;AACxD,mDAA0C;AAG1C,mCAA4C;AAC5C,+BAA4B;AAC5B,kEAAgE;AAChE,0DAAiC;AAEjC,yEAAyE;AACzE,gFAAgD;AAEhD,MAAM,iBAAiB,GAAG,8CAA8C,CAAC;AAEzE,SAAgB,gBAAgB,CAAC,QAAgB;IAC/C,0DAA0D;IAC1D,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC;QAChD,OAAO;IACT,CAAC;IACD,IAAI,CAAC,GAAG,iBAAiB,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,CAAC;QACN,OAAO;YACL,QAAQ,EAAE,CAAC,CAAC,MAAO,C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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 } from 'path';\nimport { extensionsPattern } 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';\n\nconst entrypointPattern = /(?<filename>.*)[\\\\/]-embroider-entrypoint.js/;\n\nexport function decodeEntrypoint(filename: string): { fromFile: 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 fromFile: 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 { fromFile }: { fromFile: string }\n): { src: string; watches: string[] } {\n // this is new\n const owner = resolver.packageCache.ownerOfFile(fromFile);\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(owner.root),\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;\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/core/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/core/entrypoint/${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: [],\n };\n}\n\nconst entryTemplate = compile(`\nimport { macroCondition, getGlobalConfig } from '@embroider/macros';\n\nimport environment from './config/environment';\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"]}
|