@embroider/core 3.5.1-unstable.06606b1 → 3.5.1-unstable.13ee6e9

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.5.1-unstable.06606b1",
3
+ "version": "3.5.1-unstable.13ee6e9",
4
4
  "private": false,
5
5
  "description": "A build system for EmberJS applications.",
6
6
  "repository": {
@@ -24,6 +24,14 @@
24
24
  "src/**/*.js.map",
25
25
  "types"
26
26
  ],
27
+ "release-plan": {
28
+ "semverIncrementAs": {
29
+ "major": "premajor",
30
+ "minor": "prerelease",
31
+ "patch": "prerelease"
32
+ },
33
+ "semverIncrementTag": "alpha"
34
+ },
27
35
  "dependencies": {
28
36
  "@babel/core": "^7.14.5",
29
37
  "@babel/parser": "^7.14.5",
@@ -49,9 +57,9 @@
49
57
  "semver": "^7.3.5",
50
58
  "typescript-memoize": "^1.0.1",
51
59
  "walk-sync": "^3.0.0",
52
- "@embroider/macros": "1.16.11-unstable.06606b1",
53
- "@embroider/reverse-exports": "0.1.1-unstable.06606b1",
54
- "@embroider/shared-internals": "2.8.2-unstable.06606b1"
60
+ "@embroider/macros": "1.16.11-unstable.13ee6e9",
61
+ "@embroider/reverse-exports": "0.1.1-unstable.13ee6e9",
62
+ "@embroider/shared-internals": "2.8.2-unstable.13ee6e9"
55
63
  },
56
64
  "devDependencies": {
57
65
  "@glimmer/syntax": "^0.84.2",
package/src/options.d.ts CHANGED
@@ -1,43 +1,4 @@
1
1
  export default interface Options {
2
- /**
3
- * When true, we statically resolve all template helpers at build time. This
4
- * causes unused helpers to be left out of the build ("tree shaking" of
5
- * helpers).
6
- *
7
- * Defaults to false, which gives you greater compatibility with classic Ember
8
- * apps at the cost of bigger builds.
9
- *
10
- * Enabling this is a prerequisite for route splitting.
11
- *
12
- * @deprecated use staticInvokables instead
13
- */
14
- staticHelpers?: boolean;
15
- /**
16
- * When true, we statically resolve all modifiers at build time. This
17
- * causes unused modifiers to be left out of the build ("tree shaking" of
18
- * modifiers).
19
- *
20
- * Defaults to false, which gives you greater compatibility with classic Ember
21
- * apps at the cost of bigger builds.
22
- *
23
- * Enabling this is a prerequisite for route splitting.
24
- *
25
- * @deprecated use staticInvokables instead
26
- */
27
- staticModifiers?: boolean;
28
- /**
29
- * When true, we statically resolve all components at build time. This causes
30
- * unused components to be left out of the build ("tree shaking" of
31
- * components).
32
- *
33
- * Defaults to false, which gives you greater compatibility with classic Ember
34
- * apps at the cost of bigger builds.
35
- *
36
- * Enabling this is a prerequisite for route splitting.
37
- *
38
- * @deprecated use staticInvokables instead
39
- */
40
- staticComponents?: boolean;
41
2
  /**
42
3
  * When true, we statically resolve all components, modifiers, and helpers (collectively
43
4
  * knows as Invokables) at build time. This causes any unused Invokables to be left out
@@ -60,5 +21,5 @@ export default interface Options {
60
21
  useMethod?: string;
61
22
  }[];
62
23
  }
63
- export type CoreOptionsType = Required<Omit<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>> & Pick<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>;
24
+ export type CoreOptionsType = Required<Options>;
64
25
  export declare function optionsWithDefaults(options?: Options): CoreOptionsType;
package/src/options.js CHANGED
@@ -2,7 +2,17 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.optionsWithDefaults = optionsWithDefaults;
4
4
  function optionsWithDefaults(options) {
5
+ if ((options === null || options === void 0 ? void 0 : options.staticHelpers) !== undefined) {
6
+ throw new Error(`You have set 'staticHelpers' on your Embroider options. This setting has been removed and replaced with 'staticInvokables'`);
7
+ }
8
+ if ((options === null || options === void 0 ? void 0 : options.staticComponents) !== undefined) {
9
+ throw new Error(`You have set 'staticComponents' on your Embroider options. This setting has been removed and replaced with 'staticInvokables'`);
10
+ }
11
+ if ((options === null || options === void 0 ? void 0 : options.staticModifiers) !== undefined) {
12
+ throw new Error(`You have set 'staticModifiers' on your Embroider options. This setting has been removed and replaced with 'staticInvokables'`);
13
+ }
5
14
  let defaults = {
15
+ staticInvokables: true,
6
16
  splitAtRoutes: [],
7
17
  staticAppPaths: [],
8
18
  pluginHints: [],
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";;AA4GA,kDAWC;AAXD,SAAgB,mBAAmB,CAAC,OAAiB;IACnD,IAAI,QAAQ,GAAG;QACb,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,EAAE;QACf,gBAAgB,EAAE,KAAc;KACjC,CAAC;IACF,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["export default interface Options {\n /**\n * When true, we statically resolve all template helpers at build time. This\n * causes unused helpers to be left out of the build (\"tree shaking\" of\n * helpers).\n *\n * Defaults to false, which gives you greater compatibility with classic Ember\n * apps at the cost of bigger builds.\n *\n * Enabling this is a prerequisite for route splitting.\n *\n * @deprecated use staticInvokables instead\n */\n staticHelpers?: boolean;\n\n /**\n * When true, we statically resolve all modifiers at build time. This\n * causes unused modifiers to be left out of the build (\"tree shaking\" of\n * modifiers).\n *\n * Defaults to false, which gives you greater compatibility with classic Ember\n * apps at the cost of bigger builds.\n *\n * Enabling this is a prerequisite for route splitting.\n *\n * @deprecated use staticInvokables instead\n */\n staticModifiers?: boolean;\n\n /**\n * When true, we statically resolve all components at build time. This causes\n * unused components to be left out of the build (\"tree shaking\" of\n * components).\n *\n * Defaults to false, which gives you greater compatibility with classic Ember\n * apps at the cost of bigger builds.\n *\n * Enabling this is a prerequisite for route splitting.\n *\n * @deprecated use staticInvokables instead\n */\n staticComponents?: boolean;\n\n /**\n * When true, we statically resolve all components, modifiers, and helpers (collectively\n * knows as Invokables) at build time. This causes any unused Invokables to be left out\n * of the build if they are unused i.e. \"tree shaking\".\n *\n * Defaults to false which gives you greater compatibility with classic Ember apps at the\n * cost of bigger builds.\n *\n * This setting takes over from `staticHelpers`, `staticModifiers`, and `staticComponents`\n * because the Developer Experience was less than ideal if any of these settings did not\n * agree i.e. they all needed to be true or they all needed to be false.\n *\n * Enabling this is a prerequisite for route splitting.\n */\n staticInvokables?: boolean;\n\n // Enables per-route code splitting. Any route names that match these patterns\n // will be split out of the initial app payload. If you use this, you must\n // also add @embroider/router to your app. See [@embroider/router's\n // README](https://github.com/embroider-build/embroider/blob/main/packages/router/README.md)\n splitAtRoutes?: (RegExp | string)[];\n\n // Every file within your application's `app` directory is categorized as a\n // component, helper, modifier, route, route template, controller, or \"other\".\n //\n // This option lets you decide which \"other\" files should be loaded\n // statically. By default, all \"other\" files will be included in the build and\n // registered with Ember's runtime loader, because we can't know if somebody\n // is going to try to access them dynamically via Ember's resolver or AMD\n // runtime `require`.\n //\n // If you know that your files are only ever imported, you can list them here\n // and then they will only be included exactly where they're needed.\n //\n // Provide a list of directories or files relative to `/app`. For example\n //\n // staticAppPaths: ['lib']\n //\n // means that everything under your-project/app/lib will be loaded statically.\n //\n // This option has no effect on components (which are governed by\n // staticComponents), helpers (which are governed by staticHelpers), modifiers\n // (which are governed by staticModifiers) or the route-specific files (routes,\n // route templates, and controllers which are governed by splitAtRoutes).\n staticAppPaths?: string[];\n\n // This is a performance optimization that can help you avoid the \"Your build\n // is slower because some babel plugins are non-serializable\" penalty. If you\n // provide the locations of known non-serializable objects, we can discover\n // them and make them serializable.\n //\n // resolve is a list of paths to resolve, in a chain. This lets you resolve\n // your dependencies' dependencies, like: resolve: ['your-dependency',\n // 'inner-dependency/lib/transform']\n //\n // useMethod optionally lets you pick which property within the module to use.\n // If not provided, we use the module.exports itself.\n pluginHints?: { resolve: string[]; useMethod?: string }[];\n}\n\nexport type CoreOptionsType = Required<\n Omit<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>\n> &\n Pick<Options, 'staticHelpers' | 'staticModifiers' | 'staticComponents' | 'staticInvokables'>;\n\nexport function optionsWithDefaults(options?: Options): CoreOptionsType {\n let defaults = {\n splitAtRoutes: [],\n staticAppPaths: [],\n pluginHints: [],\n amdCompatibility: 'cjs' as const,\n };\n if (options) {\n return Object.assign(defaults, options);\n }\n return defaults;\n}\n"]}
1
+ {"version":3,"file":"options.js","sourceRoot":"","sources":["options.ts"],"names":[],"mappings":";;AA+DA,kDA8BC;AA9BD,SAAgB,mBAAmB,CAAC,OAAiB;IACnD,IAAI,CAAC,OAAe,aAAf,OAAO,uBAAP,OAAO,CAAU,aAAa,MAAK,SAAS,EAAE,CAAC;QAClD,MAAM,IAAI,KAAK,CACb,4HAA4H,CAC7H,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAe,aAAf,OAAO,uBAAP,OAAO,CAAU,gBAAgB,MAAK,SAAS,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CACb,+HAA+H,CAChI,CAAC;IACJ,CAAC;IAED,IAAI,CAAC,OAAe,aAAf,OAAO,uBAAP,OAAO,CAAU,eAAe,MAAK,SAAS,EAAE,CAAC;QACpD,MAAM,IAAI,KAAK,CACb,8HAA8H,CAC/H,CAAC;IACJ,CAAC;IAED,IAAI,QAAQ,GAAG;QACb,gBAAgB,EAAE,IAAI;QACtB,aAAa,EAAE,EAAE;QACjB,cAAc,EAAE,EAAE;QAClB,WAAW,EAAE,EAAE;QACf,gBAAgB,EAAE,KAAc;KACjC,CAAC;IACF,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["export default interface Options {\n /**\n * When true, we statically resolve all components, modifiers, and helpers (collectively\n * knows as Invokables) at build time. This causes any unused Invokables to be left out\n * of the build if they are unused i.e. \"tree shaking\".\n *\n * Defaults to false which gives you greater compatibility with classic Ember apps at the\n * cost of bigger builds.\n *\n * This setting takes over from `staticHelpers`, `staticModifiers`, and `staticComponents`\n * because the Developer Experience was less than ideal if any of these settings did not\n * agree i.e. they all needed to be true or they all needed to be false.\n *\n * Enabling this is a prerequisite for route splitting.\n */\n staticInvokables?: boolean;\n\n // Enables per-route code splitting. Any route names that match these patterns\n // will be split out of the initial app payload. If you use this, you must\n // also add @embroider/router to your app. See [@embroider/router's\n // README](https://github.com/embroider-build/embroider/blob/main/packages/router/README.md)\n splitAtRoutes?: (RegExp | string)[];\n\n // Every file within your application's `app` directory is categorized as a\n // component, helper, modifier, route, route template, controller, or \"other\".\n //\n // This option lets you decide which \"other\" files should be loaded\n // statically. By default, all \"other\" files will be included in the build and\n // registered with Ember's runtime loader, because we can't know if somebody\n // is going to try to access them dynamically via Ember's resolver or AMD\n // runtime `require`.\n //\n // If you know that your files are only ever imported, you can list them here\n // and then they will only be included exactly where they're needed.\n //\n // Provide a list of directories or files relative to `/app`. For example\n //\n // staticAppPaths: ['lib']\n //\n // means that everything under your-project/app/lib will be loaded statically.\n //\n // This option has no effect on components (which are governed by\n // staticComponents), helpers (which are governed by staticHelpers), modifiers\n // (which are governed by staticModifiers) or the route-specific files (routes,\n // route templates, and controllers which are governed by splitAtRoutes).\n staticAppPaths?: string[];\n\n // This is a performance optimization that can help you avoid the \"Your build\n // is slower because some babel plugins are non-serializable\" penalty. If you\n // provide the locations of known non-serializable objects, we can discover\n // them and make them serializable.\n //\n // resolve is a list of paths to resolve, in a chain. This lets you resolve\n // your dependencies' dependencies, like: resolve: ['your-dependency',\n // 'inner-dependency/lib/transform']\n //\n // useMethod optionally lets you pick which property within the module to use.\n // If not provided, we use the module.exports itself.\n pluginHints?: { resolve: string[]; useMethod?: string }[];\n}\n\nexport type CoreOptionsType = Required<Options>;\n\nexport function optionsWithDefaults(options?: Options): CoreOptionsType {\n if ((options as any)?.staticHelpers !== undefined) {\n throw new Error(\n `You have set 'staticHelpers' on your Embroider options. This setting has been removed and replaced with 'staticInvokables'`\n );\n }\n\n if ((options as any)?.staticComponents !== undefined) {\n throw new Error(\n `You have set 'staticComponents' on your Embroider options. This setting has been removed and replaced with 'staticInvokables'`\n );\n }\n\n if ((options as any)?.staticModifiers !== undefined) {\n throw new Error(\n `You have set 'staticModifiers' on your Embroider options. This setting has been removed and replaced with 'staticInvokables'`\n );\n }\n\n let defaults = {\n staticInvokables: true,\n splitAtRoutes: [],\n staticAppPaths: [],\n pluginHints: [],\n amdCompatibility: 'cjs' as const,\n };\n if (options) {\n return Object.assign(defaults, options);\n }\n return defaults;\n}\n"]}
@@ -44,13 +44,9 @@ function renderEntrypoint(resolver, { fromDir }) {
44
44
  }, getAppFiles(fromDir), hasFastboot ? getFastbootFiles(owner.root) : new Set(), (0, shared_internals_1.extensionsPattern)(resolver.options.resolvableExtensions), staticAppPathsPattern(resolver.options.staticAppPaths), resolver.options.podModulePrefix);
45
45
  let options = (_a = resolver.options.options) !== null && _a !== void 0 ? _a : (0, options_1.optionsWithDefaults)();
46
46
  let requiredAppFiles = [appFiles.otherAppFiles];
47
- if (!options.staticComponents) {
47
+ if (!options.staticInvokables) {
48
48
  requiredAppFiles.push(appFiles.components);
49
- }
50
- if (!options.staticHelpers) {
51
49
  requiredAppFiles.push(appFiles.helpers);
52
- }
53
- if (!options.staticModifiers) {
54
50
  requiredAppFiles.push(appFiles.modifiers);
55
51
  }
56
52
  let styles = [];
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-entrypoint.js","sourceRoot":"","sources":["virtual-entrypoint.ts"],"names":[],"mappings":";;;;;AAkBA,sDAIC;AAED,4CAqHC;AA8FD,kCAOC;AAED,gCA6DC;AAeD,kCAKC;AAED,4CAIC;AA3UD,2CAAwD;AACxD,mDAA0C;AAG1C,mCAA4C;AAC5C,+BAA4B;AAC5B,kEAAgE;AAChE,0DAAiC;AAEjC,gFAAgD;AAChD,uCAAgD;AAQhD,SAAgB,qBAAqB,CAAC,cAAoC;I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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 escapeRegExp from 'escape-string-regexp';\nimport { optionsWithDefaults } from './options';\n\nexport interface EntrypointResponse {\n type: 'entrypoint';\n fromDir: string;\n specifier: string;\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 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[]) => {\n lazyRoutes.push({\n names: routeNames,\n path: `@embroider/core/route/${encodeURIComponent(routeNames[0])}`,\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
+ {"version":3,"file":"virtual-entrypoint.js","sourceRoot":"","sources":["virtual-entrypoint.ts"],"names":[],"mappings":";;;;;AAkBA,sDAIC;AAED,4CAiHC;AA8FD,kCAOC;AAED,gCA6DC;AAeD,kCAKC;AAED,4CAIC;AAvUD,2CAAwD;AACxD,mDAA0C;AAG1C,mCAA4C;AAC5C,+BAA4B;AAC5B,kEAAgE;AAChE,0DAAiC;AAEjC,gFAAgD;AAChD,uCAAgD;AAQhD,SAAgB,qBAAqB,CAAC,cAAoC;IACxE,IAAI,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAChD,OAAO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K,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 escapeRegExp from 'escape-string-regexp';\nimport { optionsWithDefaults } from './options';\n\nexport interface EntrypointResponse {\n type: 'entrypoint';\n fromDir: string;\n specifier: string;\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 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.staticInvokables) {\n requiredAppFiles.push(appFiles.components);\n requiredAppFiles.push(appFiles.helpers);\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[]) => {\n lazyRoutes.push({\n names: routeNames,\n path: `@embroider/core/route/${encodeURIComponent(routeNames[0])}`,\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"]}
@@ -13,16 +13,16 @@ function renderVendor(response, resolver) {
13
13
  if (!owner) {
14
14
  throw new Error(`Failed to find a valid owner for ${response.specifier}`);
15
15
  }
16
- return { src: getVendor(owner, resolver, response.specifier), watches: [] };
16
+ return { src: getVendor(owner, resolver), watches: [] };
17
17
  }
18
- function getVendor(owner, resolver, filename) {
18
+ function getVendor(owner, resolver) {
19
19
  let engineConfig = resolver.owningEngine(owner);
20
20
  let addons = engineConfig.activeAddons.map(addon => resolver.packageCache.get(addon.root));
21
21
  let path = (0, path_1.join)((0, shared_internals_1.locateEmbroiderWorkingDir)(resolver.options.appRoot), 'ember-env.json');
22
- if (!(0, fs_extra_1.lstatSync)(path).isFile()) {
23
- throw new Error(`Failed to read the ember-env.json when generating content for ${filename}`);
22
+ let emberENV;
23
+ if ((0, fs_extra_1.existsSync)(path)) {
24
+ emberENV = (0, fs_extra_1.readJSONSync)(path);
24
25
  }
25
- let emberENV = (0, fs_extra_1.readJSONSync)(path);
26
26
  return generateVendor(addons, emberENV);
27
27
  }
28
28
  function generateVendor(addons, emberENV) {
@@ -34,7 +34,9 @@ function generateVendor(addons, emberENV) {
34
34
  // Add _testing_prefix_.js
35
35
  vendor.unshift(`var runningTests=false;`);
36
36
  // Add _ember_env_.js
37
- vendor.unshift(`window.EmberENV={ ...(window.EmberENV || {}), ...${JSON.stringify(emberENV, null, 2)} };`);
37
+ if (emberENV) {
38
+ vendor.unshift(`window.EmberENV={ ...(window.EmberENV || {}), ...${JSON.stringify(emberENV, null, 2)} };`);
39
+ }
38
40
  return vendor.join('');
39
41
  }
40
42
  function impliedAddonVendors(addons) {
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-vendor.js","sourceRoot":"","sources":["virtual-vendor.ts"],"names":[],"mappings":";;;;;AAaA,oCAMC;AAnBD,kEAAsF;AAEtF,uCAAiE;AACjE,+BAA4B;AAC5B,sDAA8B;AAS9B,SAAgB,YAAY,CAAC,QAA+B,EAAE,QAAkB;IAC9E,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC9E,CAAC;AAED,SAAS,SAAS,CAAC,KAAc,EAAE,QAAkB,EAAE,QAAgB;IACrE,IAAI,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC,CAAC;IAE7G,IAAI,IAAI,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KAAK,IAAI,GAAG,IAAI,eAAe,EAAE,CAAC;gBAChC,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, locateEmbroiderWorkingDir } from '@embroider/shared-internals';\nimport type { V2AddonPackage } from '@embroider/shared-internals/src/package';\nimport { lstatSync, readFileSync, readJSONSync } from 'fs-extra';\nimport { join } from 'path';\nimport resolve from 'resolve';\nimport type { Resolver } from './module-resolver';\nimport type { VirtualContentResult } from './virtual-content';\n\nexport interface VirtualVendorResponse {\n type: 'vendor-js';\n specifier: string;\n}\n\nexport function renderVendor(response: VirtualVendorResponse, resolver: Resolver): VirtualContentResult {\n const owner = resolver.packageCache.ownerOfFile(response.specifier);\n if (!owner) {\n throw new Error(`Failed to find a valid owner for ${response.specifier}`);\n }\n return { src: getVendor(owner, resolver, response.specifier), watches: [] };\n}\n\nfunction getVendor(owner: Package, resolver: Resolver, filename: string): string {\n let engineConfig = resolver.owningEngine(owner);\n let addons = engineConfig.activeAddons.map(addon => resolver.packageCache.get(addon.root) as V2AddonPackage);\n\n let path = join(locateEmbroiderWorkingDir(resolver.options.appRoot), 'ember-env.json');\n if (!lstatSync(path).isFile()) {\n throw new Error(`Failed to read the ember-env.json when generating content for ${filename}`);\n }\n let emberENV = readJSONSync(path);\n\n return generateVendor(addons, emberENV);\n}\n\nfunction generateVendor(addons: V2AddonPackage[], emberENV?: unknown): string {\n // Add addons implicit-scripts\n let vendor: string[] = impliedAddonVendors(addons).map((sourcePath: string): string => {\n let source = readFileSync(sourcePath);\n return `${source}`;\n });\n // Add _testing_prefix_.js\n vendor.unshift(`var runningTests=false;`);\n // Add _ember_env_.js\n vendor.unshift(`window.EmberENV={ ...(window.EmberENV || {}), ...${JSON.stringify(emberENV, null, 2)} };`);\n\n return vendor.join('') as string;\n}\n\nfunction impliedAddonVendors(addons: V2AddonPackage[]): string[] {\n let result: Array<string> = [];\n for (let addon of addons) {\n let implicitScripts = addon.meta['implicit-scripts'];\n if (implicitScripts) {\n let options = { basedir: addon.root };\n for (let mod of implicitScripts) {\n result.push(resolve.sync(mod, options));\n }\n }\n }\n return result;\n}\n"]}
1
+ {"version":3,"file":"virtual-vendor.js","sourceRoot":"","sources":["virtual-vendor.ts"],"names":[],"mappings":";;;;;AAaA,oCAMC;AAnBD,kEAAsF;AAEtF,uCAAkE;AAClE,+BAA4B;AAC5B,sDAA8B;AAS9B,SAAgB,YAAY,CAAC,QAA+B,EAAE,QAAkB;IAC9E,MAAM,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,WAAW,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IACpE,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,oCAAoC,QAAQ,CAAC,SAAS,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,EAAE,GAAG,EAAE,SAAS,CAAC,KAAK,EAAE,QAAQ,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AAC1D,CAAC;AAED,SAAS,SAAS,CAAC,KAAc,EAAE,QAAkB;IACnD,IAAI,YAAY,GAAG,QAAQ,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAChD,IAAI,MAAM,GAAG,YAAY,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,YAAY,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,CAAmB,CAAC,CAAC;IAE7G,IAAI,IAAI,GAAG,IAAA,WAAI,EAAC,IAAA,4CAAyB,EAAC,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,CAAC;IAEvF,IAAI,QAAQ,CAAC;IACb,IAAI,IAAA,qBAAU,EAAC,IAAI,CAAC,EAAE,CAAC;QACrB,QAAQ,GAAG,IAA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@embroider/shared-internals';\nimport type { V2AddonPackage } from '@embroider/shared-internals/src/package';\nimport { existsSync, readFileSync, readJSONSync } from 'fs-extra';\nimport { join } from 'path';\nimport resolve from 'resolve';\nimport type { Resolver } from './module-resolver';\nimport type { VirtualContentResult } from './virtual-content';\n\nexport interface VirtualVendorResponse {\n type: 'vendor-js';\n specifier: string;\n}\n\nexport function renderVendor(response: VirtualVendorResponse, resolver: Resolver): VirtualContentResult {\n const owner = resolver.packageCache.ownerOfFile(response.specifier);\n if (!owner) {\n throw new Error(`Failed to find a valid owner for ${response.specifier}`);\n }\n return { src: getVendor(owner, resolver), watches: [] };\n}\n\nfunction getVendor(owner: Package, resolver: Resolver): string {\n let engineConfig = resolver.owningEngine(owner);\n let addons = engineConfig.activeAddons.map(addon => resolver.packageCache.get(addon.root) as V2AddonPackage);\n\n let path = join(locateEmbroiderWorkingDir(resolver.options.appRoot), 'ember-env.json');\n\n let emberENV;\n if (existsSync(path)) {\n emberENV = readJSONSync(path);\n }\n\n return generateVendor(addons, emberENV);\n}\n\nfunction generateVendor(addons: V2AddonPackage[], emberENV: unknown): string {\n // Add addons implicit-scripts\n let vendor: string[] = impliedAddonVendors(addons).map((sourcePath: string): string => {\n let source = readFileSync(sourcePath);\n return `${source}`;\n });\n // Add _testing_prefix_.js\n vendor.unshift(`var runningTests=false;`);\n // Add _ember_env_.js\n if (emberENV) {\n vendor.unshift(`window.EmberENV={ ...(window.EmberENV || {}), ...${JSON.stringify(emberENV, null, 2)} };`);\n }\n\n return vendor.join('') as string;\n}\n\nfunction impliedAddonVendors(addons: V2AddonPackage[]): string[] {\n let result: Array<string> = [];\n for (let addon of addons) {\n let implicitScripts = addon.meta['implicit-scripts'];\n if (implicitScripts) {\n let options = { basedir: addon.root };\n for (let mod of implicitScripts) {\n result.push(resolve.sync(mod, options));\n }\n }\n }\n return result;\n}\n"]}