@embroider/core
Advanced tools
Comparing version 3.4.20-unstable.7195610 to 3.4.20-unstable.0aa8fc6
{ | ||
"name": "@embroider/core", | ||
"version": "3.4.20-unstable.7195610", | ||
"version": "3.4.20-unstable.0aa8fc6", | ||
"private": false, | ||
@@ -52,5 +52,5 @@ "description": "A build system for EmberJS applications.", | ||
"walk-sync": "^3.0.0", | ||
"@embroider/reverse-exports": "0.1.1-unstable.7195610", | ||
"@embroider/shared-internals": "2.8.2-unstable.7195610", | ||
"@embroider/macros": "1.16.10-unstable.7195610" | ||
"@embroider/macros": "1.16.10-unstable.0aa8fc6", | ||
"@embroider/shared-internals": "2.8.2-unstable.0aa8fc6", | ||
"@embroider/reverse-exports": "0.1.1-unstable.0aa8fc6" | ||
}, | ||
@@ -57,0 +57,0 @@ "devDependencies": { |
@@ -5,3 +5,2 @@ export { Packager, PackagerConstructor, Variant, applyVariantToBabelConfig, getAppMeta, getPackagerCacheDir, } from './packager'; | ||
export { default as Options, optionsWithDefaults } from './options'; | ||
export { default as toBroccoliPlugin } from './to-broccoli-plugin'; | ||
export { default as WaitForTrees, OutputPaths } from './wait-for-trees'; | ||
@@ -8,0 +7,0 @@ export { compile as jsHandlebarsCompile } from './js-handlebars'; |
@@ -20,3 +20,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.virtualContent = exports.ResolverLoader = exports.Resolver = exports.throwOnWarnings = exports.expectWarning = exports.debug = exports.warn = exports.unsupported = exports.todo = exports.jsHandlebarsCompile = exports.WaitForTrees = exports.toBroccoliPlugin = exports.optionsWithDefaults = exports.HTMLEntrypoint = exports.getPackagerCacheDir = exports.getAppMeta = exports.applyVariantToBabelConfig = void 0; | ||
exports.virtualContent = exports.ResolverLoader = exports.Resolver = exports.throwOnWarnings = exports.expectWarning = exports.debug = exports.warn = exports.unsupported = exports.todo = exports.jsHandlebarsCompile = exports.WaitForTrees = exports.optionsWithDefaults = exports.HTMLEntrypoint = exports.getPackagerCacheDir = exports.getAppMeta = exports.applyVariantToBabelConfig = void 0; | ||
var packager_1 = require("./packager"); | ||
@@ -30,4 +30,2 @@ Object.defineProperty(exports, "applyVariantToBabelConfig", { enumerable: true, get: function () { return packager_1.applyVariantToBabelConfig; } }); | ||
Object.defineProperty(exports, "optionsWithDefaults", { enumerable: true, get: function () { return options_1.optionsWithDefaults; } }); | ||
var to_broccoli_plugin_1 = require("./to-broccoli-plugin"); | ||
Object.defineProperty(exports, "toBroccoliPlugin", { enumerable: true, get: function () { return __importDefault(to_broccoli_plugin_1).default; } }); | ||
var wait_for_trees_1 = require("./wait-for-trees"); | ||
@@ -34,0 +32,0 @@ Object.defineProperty(exports, "WaitForTrees", { enumerable: true, get: function () { return __importDefault(wait_for_trees_1).default; } }); |
import { type AddonPackage, type Package } from '@embroider/shared-internals'; | ||
import type UserOptions from './options'; | ||
export interface Options { | ||
@@ -16,3 +15,2 @@ renamePackages: { | ||
podModulePrefix?: string; | ||
amdCompatibility: Required<UserOptions['amdCompatibility']>; | ||
staticAppPaths: string[]; | ||
@@ -19,0 +17,0 @@ emberVersion: string; |
@@ -33,5 +33,2 @@ "use strict"; | ||
engines, | ||
amdCompatibility: { | ||
es: [], | ||
}, | ||
modulePrefix, | ||
@@ -38,0 +35,0 @@ staticAppPaths: (_b = inputs.staticAppPaths) !== null && _b !== void 0 ? _b : [], |
@@ -78,3 +78,2 @@ import type { Package } from '@embroider/shared-internals'; | ||
private locateActiveAddon; | ||
private external; | ||
private fallbackResolve; | ||
@@ -81,0 +80,0 @@ private restoreRehomedRequest; |
@@ -11,6 +11,3 @@ export default interface Options { | ||
}[]; | ||
amdCompatibility?: false | 'cjs' | { | ||
es: [string, string[]][]; | ||
}; | ||
} | ||
export declare function optionsWithDefaults(options?: Options): Required<Options>; |
@@ -7,4 +7,2 @@ import type { Resolver } from '.'; | ||
export declare function virtualContent(filename: string, resolver: Resolver): VirtualContentResult; | ||
export declare function virtualExternalESModule(specifier: string, exports: string[] | undefined): string; | ||
export declare function virtualExternalCJSModule(specifier: string): string; | ||
export declare function virtualPairComponent(hbsModule: string, jsModule: string | undefined): string; | ||
@@ -11,0 +9,0 @@ export declare function fastbootSwitch(specifier: string, fromFile: string, names: Set<string>): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.virtualContent = virtualContent; | ||
exports.virtualExternalESModule = virtualExternalESModule; | ||
exports.virtualExternalCJSModule = virtualExternalCJSModule; | ||
exports.virtualPairComponent = virtualPairComponent; | ||
@@ -19,4 +17,2 @@ exports.fastbootSwitch = fastbootSwitch; | ||
const virtual_route_entrypoint_1 = require("./virtual-route-entrypoint"); | ||
const externalESPrefix = '/@embroider/ext-es/'; | ||
const externalCJSPrefix = '/@embroider/ext-cjs/'; | ||
// Given a filename that was passed to your ModuleRequest's `virtualize()`, | ||
@@ -27,6 +23,2 @@ // this produces the corresponding contents. It's a static, stateless function | ||
function virtualContent(filename, resolver) { | ||
let cjsExtern = decodeVirtualExternalCJSModule(filename); | ||
if (cjsExtern) { | ||
return renderCJSExternalShim(cjsExtern); | ||
} | ||
let entrypoint = (0, virtual_entrypoint_1.decodeEntrypoint)(filename); | ||
@@ -40,6 +32,2 @@ if (entrypoint) { | ||
} | ||
let extern = decodeVirtualExternalESModule(filename); | ||
if (extern) { | ||
return renderESExternalShim(extern); | ||
} | ||
let match = decodeVirtualPairComponent(filename); | ||
@@ -75,29 +63,2 @@ if (match) { | ||
} | ||
const externalESShim = (0, js_handlebars_1.compile)(` | ||
{{#if (eq moduleName "require")}} | ||
const m = window.requirejs; | ||
export default m; | ||
const has = m.has; | ||
export { has } | ||
{{else}} | ||
const m = window.require("{{{js-string-escape moduleName}}}"); | ||
{{#if default}} | ||
export default m.default; | ||
{{/if}} | ||
{{#if names}} | ||
const { {{#each names as |name|}}{{name}}, {{/each}} } = m; | ||
export { {{#each names as |name|}}{{name}}, {{/each}} } | ||
{{/if}} | ||
{{/if}} | ||
`); | ||
function renderESExternalShim({ moduleName, exports, }) { | ||
return { | ||
src: externalESShim({ | ||
moduleName, | ||
default: exports.includes('default'), | ||
names: exports.filter(n => n !== 'default'), | ||
}), | ||
watches: [], | ||
}; | ||
} | ||
function pairedComponentShim(params) { | ||
@@ -136,30 +97,2 @@ return { | ||
`); | ||
function virtualExternalESModule(specifier, exports) { | ||
if (exports) { | ||
return externalESPrefix + specifier + `/exports=${exports.join(',')}`; | ||
} | ||
else { | ||
return externalESPrefix + specifier; | ||
} | ||
} | ||
function virtualExternalCJSModule(specifier) { | ||
return externalCJSPrefix + specifier; | ||
} | ||
function decodeVirtualExternalESModule(filename) { | ||
if (filename.startsWith(externalESPrefix)) { | ||
let exports = []; | ||
let components = filename.split('/exports='); | ||
let nameString = components[1]; | ||
if (nameString) { | ||
exports = nameString.split(','); | ||
} | ||
let moduleName = components[0].slice(externalESPrefix.length); | ||
return { moduleName, exports }; | ||
} | ||
} | ||
function decodeVirtualExternalCJSModule(filename) { | ||
if (filename.startsWith(externalCJSPrefix)) { | ||
return { moduleName: filename.slice(externalCJSPrefix.length) }; | ||
} | ||
} | ||
const pairComponentMarker = '-embroider-pair-component'; | ||
@@ -354,39 +287,2 @@ const pairComponentPattern = /^(?<hbsModule>.*)__vpc__(?<jsModule>[^\/]*)-embroider-pair-component$/; | ||
} | ||
function renderCJSExternalShim(params) { | ||
return { | ||
src: renderCJSExternalShimTemplate(params), | ||
watches: [], | ||
}; | ||
} | ||
const renderCJSExternalShimTemplate = (0, js_handlebars_1.compile)(` | ||
module.exports = new Proxy({}, { | ||
get(target, prop) { | ||
{{!- our proxy always presents as ES module so that we can intercept "get('default')" -}} | ||
if (prop === '__esModule') { | ||
return true; | ||
} | ||
{{#if (eq moduleName "require")}} | ||
const m = window.requirejs; | ||
{{else}} | ||
const m = window.require("{{{js-string-escape moduleName}}}"); | ||
{{/if}} | ||
{{!- | ||
There are plenty of hand-written AMD defines floating around | ||
that lack an __esModule declaration. | ||
As far as I can tell, Ember's loader was already treating the Boolean(m.default)===true | ||
case as a module, so in theory we aren't breaking anything by | ||
treating it as such when other packagers come looking. | ||
-}} | ||
if (prop === 'default' && !m.__esModule && !m.default) { | ||
return m; | ||
} | ||
return m[prop]; | ||
} | ||
}); | ||
`); | ||
//# sourceMappingURL=virtual-content.js.map |
@@ -78,7 +78,8 @@ "use strict"; | ||
const routeEntryTemplate = (0, js_handlebars_1.compile)(` | ||
let d = window.define; | ||
const output = {}; | ||
export default output; | ||
{{#each amdModules as |amdModule index| ~}} | ||
import * as amdModule{{index}} from "{{js-string-escape amdModule.buildtime}}" | ||
d("{{js-string-escape amdModule.runtime}}", function(){ return amdModule{{index}}; }); | ||
output["{{js-string-escape amdModule.runtime}}"] = amdModule{{index}}; | ||
{{/each}} | ||
@@ -88,13 +89,5 @@ | ||
if (macroCondition(getGlobalConfig().fastboot?.isRunning)) { | ||
let fastbootModules = {}; | ||
{{#each fastbootOnlyAmdModules as |amdModule| ~}} | ||
fastbootModules["{{js-string-escape amdModule.runtime}}"] = import("{{js-string-escape amdModule.buildtime}}"); | ||
output["{{js-string-escape amdModule.runtime}}"] = await import("{{js-string-escape amdModule.buildtime}}"); | ||
{{/each}} | ||
const resolvedValues = await Promise.all(Object.values(fastbootModules)); | ||
Object.keys(fastbootModules).forEach((k, i) => { | ||
d(k, function(){ return resolvedValues[i];}); | ||
}) | ||
} | ||
@@ -101,0 +94,0 @@ {{/if}} |
@@ -10,3 +10,2 @@ "use strict"; | ||
const fs_extra_1 = require("fs-extra"); | ||
const lodash_1 = require("lodash"); | ||
const path_1 = require("path"); | ||
@@ -26,6 +25,3 @@ const resolve_1 = __importDefault(require("resolve")); | ||
let engineConfig = resolver.owningEngine(owner); | ||
let addons = new Map(engineConfig.activeAddons.map(addon => [ | ||
resolver.packageCache.get(addon.root), | ||
addon.canResolveFromFile, | ||
])); | ||
let addons = engineConfig.activeAddons.map(addon => resolver.packageCache.get(addon.root)); | ||
let path = (0, path_1.join)((0, shared_internals_1.locateEmbroiderWorkingDir)(resolver.options.appRoot), 'ember-env.json'); | ||
@@ -48,4 +44,2 @@ if (!(0, fs_extra_1.lstatSync)(path).isFile()) { | ||
vendor.unshift(`window.EmberENV={ ...(window.EmberENV || {}), ...${JSON.stringify(emberENV, null, 2)} };`); | ||
// Add _loader_.js | ||
vendor.push(`loader.makeDefaultExport=false;`); | ||
return vendor.join(''); | ||
@@ -55,12 +49,3 @@ } | ||
let result = []; | ||
for (let addon of (0, lodash_1.sortBy)(Array.from(addons.keys()), pkg => { | ||
switch (pkg.name) { | ||
case 'loader.js': | ||
return 0; | ||
case 'ember-source': | ||
return 10; | ||
default: | ||
return 1000; | ||
} | ||
})) { | ||
for (let addon of addons) { | ||
let implicitScripts = addon.meta['implicit-scripts']; | ||
@@ -67,0 +52,0 @@ if (implicitScripts) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
448700
76
3934
+ Added@embroider/macros@1.16.10-unstable.0aa8fc6(transitive)
+ Added@embroider/reverse-exports@0.1.1-unstable.0aa8fc6(transitive)
+ Added@embroider/shared-internals@2.8.2-unstable.0aa8fc6(transitive)
- Removed@embroider/macros@1.16.10-unstable.7195610(transitive)
- Removed@embroider/reverse-exports@0.1.1-unstable.7195610(transitive)
- Removed@embroider/shared-internals@2.8.2-unstable.7195610(transitive)