Commit e0d7ce07 authored by Luke Sandberg's avatar Luke Sandberg Committed by Luke Sandberg

update snapshots

parent 54c65882
...@@ -57,10 +57,10 @@ externalRequire.resolve = ( ...@@ -57,10 +57,10 @@ externalRequire.resolve = (
} }
contextPrototype.x = externalRequire contextPrototype.x = externalRequire
// Override the shared asyncLoader with an async version for Node.js/Edge. // Use an sync version for Node.js/Edge.
// Chunk loading is synchronous in these runtimes, so loaders may return plain // Chunk loading is synchronous in these runtimes, so loaders may return plain
// values or throw. The async keyword ensures dynamic import() always returns // values or throw. The async keyword ensures dynamic import() always returns
// a Promise per spec without an extra microtask in the browser path. // a Promise per spec without an extra microtask or code gen in the loaders to return promises
async function asyncLoader( async function asyncLoader(
this: TurbopackBaseContext<Module>, this: TurbopackBaseContext<Module>,
moduleId: ModuleId moduleId: ModuleId
......
...@@ -412,8 +412,6 @@ contextPrototype.i = esmImport ...@@ -412,8 +412,6 @@ contextPrototype.i = esmImport
// Base async loader for dynamic import(). In the browser, chunk loading is // Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed. // naturally async so loaders already return Promises — no extra wrapping needed.
// Node.js/Edge runtimes override this with an async version (in
// base-externals-utils.ts) to enforce Promise semantics over sync loaders.
function asyncLoader( function asyncLoader(
this: TurbopackBaseContext<Module>, this: TurbopackBaseContext<Module>,
moduleId: ModuleId moduleId: ModuleId
......
(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_css_css-modules_input_style_module_css_0ox2tup._.js", (globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/0_9x_turbopack-tests_tests_snapshot_css_css-modules_input_style_module_css_0ox2tup._.js",
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css module, async loader)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css module, async loader)", ((__turbopack_context__) => {
__turbopack_context__.v((parentImport) => { __turbopack_context__.v(async (parentImport) => {
return Promise.resolve().then(() => { return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css module)");
return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css-modules/input/style.module.css [test] (css module)");
});
}); });
}), }),
]); ]);
\ No newline at end of file
(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1-no_foo_style_css_1pkrete._.js", (globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1-no_foo_style_css_1pkrete._.js",
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.css [test] (css, async loader)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/css/input/node_modules/foo/style.css [test] (css, async loader)", ((__turbopack_context__) => {
__turbopack_context__.v((parentImport) => { __turbopack_context__.v(async (parentImport) => {});
return Promise.resolve();
});
}), }),
]); ]);
\ No newline at end of file
(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/turbopack_crates_turbopack-tests_tests_snapshot_css_embed-url_input_1ww-zwk._.js", (globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/turbopack_crates_turbopack-tests_tests_snapshot_css_embed-url_input_1ww-zwk._.js",
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css module, async loader)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css module, async loader)", ((__turbopack_context__) => {
__turbopack_context__.v((parentImport) => { __turbopack_context__.v(async (parentImport) => {
return Promise.resolve().then(() => { return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css module)");
return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.module.css [test] (css module)");
});
}); });
}), }),
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.css [test] (css, async loader)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/css/embed-url/input/style.css [test] (css, async loader)", ((__turbopack_context__) => {
__turbopack_context__.v((parentImport) => { __turbopack_context__.v(async (parentImport) => {});
return Promise.resolve();
});
}), }),
]); ]);
\ No newline at end of file
;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="161bf1fe-ca33-d8de-b14a-ddace1bb63c7")}catch(e){}}(); ;!function(){try { var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:{},n=(new e.Error).stack;n&&((e._debugIds|| (e._debugIds={}))[n]="9566ed5f-c5ba-299b-b0fa-d05b88b46ce3")}catch(e){}}();
(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([ (globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push([
"output/1i9t_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js", "output/1i9t_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js",
{"otherChunks":["output/1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_03ibyvs.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/input/index.js [test] (ecmascript)"]} {"otherChunks":["output/1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_03ibyvs.js"],"runtimeModuleIds":["[project]/turbopack/crates/turbopack-tests/tests/snapshot/debug-ids/browser/input/index.js [test] (ecmascript)"]}
...@@ -284,6 +284,8 @@ function esmImport(id) { ...@@ -284,6 +284,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
const loader = this.r(moduleId); const loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
...@@ -2227,5 +2229,5 @@ chunkListsToRegister.forEach(registerChunkList); ...@@ -2227,5 +2229,5 @@ chunkListsToRegister.forEach(registerChunkList);
})(); })();
//# debugId=161bf1fe-ca33-d8de-b14a-ddace1bb63c7 //# debugId=9566ed5f-c5ba-299b-b0fa-d05b88b46ce3
//# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js.map //# sourceMappingURL=1do3_crates_turbopack-tests_tests_snapshot_debug-ids_browser_input_index_19boa0e.js.map
\ No newline at end of file
...@@ -273,6 +273,8 @@ function esmImport(id) { ...@@ -273,6 +273,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
const loader = this.r(moduleId); const loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
...@@ -619,6 +621,15 @@ externalRequire.resolve = (id, options)=>{ ...@@ -619,6 +621,15 @@ externalRequire.resolve = (id, options)=>{
return require.resolve(id, options); return require.resolve(id, options);
}; };
contextPrototype.x = externalRequire; contextPrototype.x = externalRequire;
// Use an sync version for Node.js/Edge.
// Chunk loading is synchronous in these runtimes, so loaders may return plain
// values or throw. The async keyword ensures dynamic import() always returns
// a Promise per spec without an extra microtask or code gen in the loaders to return promises
async function asyncLoader(moduleId) {
const loader = this.r(moduleId);
return loader(esmImport.bind(this));
}
contextPrototype.A = asyncLoader;
/* eslint-disable @typescript-eslint/no-unused-vars */ const path = require('path'); /* eslint-disable @typescript-eslint/no-unused-vars */ const path = require('path');
const relativePathToRuntimeRoot = path.relative(RUNTIME_PUBLIC_PATH, '.'); const relativePathToRuntimeRoot = path.relative(RUNTIME_PUBLIC_PATH, '.');
// Compute the relative path to the `distDir`. // Compute the relative path to the `distDir`.
...@@ -697,86 +708,56 @@ function loadRuntimeChunk(sourcePath, chunkData) { ...@@ -697,86 +708,56 @@ function loadRuntimeChunk(sourcePath, chunkData) {
loadRuntimeChunkPath(sourcePath, chunkData.path); loadRuntimeChunkPath(sourcePath, chunkData.path);
} }
} }
const loadedChunks = new Set(); // null = loaded successfully, Error = load failed (cached for future requests)
const chunkErrors = new Map(); const loadedChunks = new Map();
function clearChunkCache() { function clearChunkCache() {
loadedChunks.clear(); loadedChunks.clear();
chunkErrors.clear();
} }
function loadRuntimeChunkPath(sourcePath, chunkPath) { /**
* Synchronously loads a chunk using require(). Caches results so a chunk is
* only loaded once; cached errors are re-thrown on subsequent calls.
*
* @param sourceId - identifier for error messages (chunk path or module id)
* @param sourceIsModule - true: "from module {sourceId}", false: "from runtime for chunk {sourceId}"
*/ function loadChunkPath(chunkPath, sourceId, sourceIsModule) {
if (!isJs(chunkPath)) { if (!isJs(chunkPath)) {
// We only support loading JS chunks in Node.js. // We only support loading JS chunks in Node.js.
// This branch can be hit when trying to load a CSS chunk. // This branch can be hit when trying to load a CSS chunk.
return; return;
} }
if (loadedChunks.has(chunkPath)) { const cached = loadedChunks.get(chunkPath);
if (cached !== undefined) {
if (cached !== null) throw cached;
return; return;
} }
try { try {
const resolved = path.resolve(RUNTIME_ROOT, chunkPath); const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
const chunkModules = require(resolved); const chunkModules = require(resolved);
installCompressedModuleFactories(chunkModules, 0, moduleFactories); installCompressedModuleFactories(chunkModules, 0, moduleFactories);
loadedChunks.add(chunkPath); loadedChunks.set(chunkPath, null);
} catch (cause) { } catch (cause) {
let errorMessage = `Failed to load chunk ${chunkPath}`; const error = new Error(sourceIsModule ? `Failed to load chunk ${chunkPath} from module ${sourceId}` : `Failed to load chunk ${chunkPath} ${sourceId ? `from runtime for chunk ${sourceId}` : ''}`, {
if (sourcePath) {
errorMessage += ` from runtime for chunk ${sourcePath}`;
}
const error = new Error(errorMessage, {
cause cause
}); });
error.name = 'ChunkLoadError'; error.name = 'ChunkLoadError';
// Don't cache runtime chunk loading errors
if (!sourceIsModule) {
loadedChunks.set(chunkPath, error);
}
throw error; throw error;
} }
} }
/** function loadRuntimeChunkPath(sourcePath, chunkPath) {
* Synchronously loads a chunk using require(). On Node.js, chunk loading is loadChunkPath(chunkPath, sourcePath, false);
* always synchronous (file I/O via require), so there's no need for promises. }
* Throws on failure. function loadChunkSync(chunkData) {
*/ function loadChunkSync(chunkData) {
const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path; const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path;
if (!isJs(chunkPath)) { loadChunkPath(chunkPath, this.m.id, true);
// We only support loading JS chunks in Node.js.
// This branch can be hit when trying to load a CSS chunk.
return;
}
if (loadedChunks.has(chunkPath)) {
return;
}
const cachedError = chunkErrors.get(chunkPath);
if (cachedError !== undefined) {
throw cachedError;
}
try {
const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
const chunkModules = require(resolved);
installCompressedModuleFactories(chunkModules, 0, moduleFactories);
loadedChunks.add(chunkPath);
} catch (cause) {
const errorMessage = `Failed to load chunk ${chunkPath} from module ${this.m.id}`;
const error = new Error(errorMessage, {
cause
});
error.name = 'ChunkLoadError';
// Cache the failure, future requests will also get this same error
chunkErrors.set(chunkPath, error);
throw error;
}
} }
contextPrototype.l = loadChunkSync; contextPrototype.l = loadChunkSync;
// Override the shared asyncLoader with an async version for Node.js.
// In the Node.js runtime, chunk loading and module evaluation are synchronous,
// so the loader may return a plain value or throw. Since dynamic import() must
// always return a Promise per the spec, wrapping in async ensures both success
// values and errors are properly wrapped in a Promise.
async function asyncLoaderNodeJs(moduleId) {
const loader = this.r(moduleId);
return loader(esmImport.bind(this));
}
contextPrototype.A = asyncLoaderNodeJs;
function loadChunkSyncByUrl(chunkUrl) { function loadChunkSyncByUrl(chunkUrl) {
const chunkPath = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT)); const chunkPath = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT));
return loadChunkSync.call(this, chunkPath); loadChunkSync.call(this, chunkPath);
} }
contextPrototype.L = loadChunkSyncByUrl; contextPrototype.L = loadChunkSyncByUrl;
function loadWebAssembly(chunkPath, _edgeModule, imports) { function loadWebAssembly(chunkPath, _edgeModule, imports) {
......
(globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_imports_static-and-dynamic_input_vercel_mjs_08p9skj._.js", (globalThis["TURBOPACK"] || (globalThis["TURBOPACK"] = [])).push(["output/1jsg_tests_snapshot_imports_static-and-dynamic_input_vercel_mjs_08p9skj._.js",
"[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/input/vercel.mjs [test] (ecmascript, async loader)", ((__turbopack_context__) => { "[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/input/vercel.mjs [test] (ecmascript, async loader)", ((__turbopack_context__) => {
__turbopack_context__.v((parentImport) => { __turbopack_context__.v(async (parentImport) => {
return Promise.resolve().then(() => { return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/input/vercel.mjs [test] (ecmascript)");
return parentImport("[project]/turbopack/crates/turbopack-tests/tests/snapshot/imports/static-and-dynamic/input/vercel.mjs [test] (ecmascript)");
});
}); });
}), }),
]); ]);
\ No newline at end of file
...@@ -273,6 +273,8 @@ function esmImport(id) { ...@@ -273,6 +273,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
const loader = this.r(moduleId); const loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
...@@ -619,6 +621,15 @@ externalRequire.resolve = (id, options)=>{ ...@@ -619,6 +621,15 @@ externalRequire.resolve = (id, options)=>{
return require.resolve(id, options); return require.resolve(id, options);
}; };
contextPrototype.x = externalRequire; contextPrototype.x = externalRequire;
// Use an sync version for Node.js/Edge.
// Chunk loading is synchronous in these runtimes, so loaders may return plain
// values or throw. The async keyword ensures dynamic import() always returns
// a Promise per spec without an extra microtask or code gen in the loaders to return promises
async function asyncLoader(moduleId) {
const loader = this.r(moduleId);
return loader(esmImport.bind(this));
}
contextPrototype.A = asyncLoader;
/* eslint-disable @typescript-eslint/no-unused-vars */ const path = require('path'); /* eslint-disable @typescript-eslint/no-unused-vars */ const path = require('path');
const relativePathToRuntimeRoot = path.relative(RUNTIME_PUBLIC_PATH, '.'); const relativePathToRuntimeRoot = path.relative(RUNTIME_PUBLIC_PATH, '.');
// Compute the relative path to the `distDir`. // Compute the relative path to the `distDir`.
...@@ -697,86 +708,56 @@ function loadRuntimeChunk(sourcePath, chunkData) { ...@@ -697,86 +708,56 @@ function loadRuntimeChunk(sourcePath, chunkData) {
loadRuntimeChunkPath(sourcePath, chunkData.path); loadRuntimeChunkPath(sourcePath, chunkData.path);
} }
} }
const loadedChunks = new Set(); // null = loaded successfully, Error = load failed (cached for future requests)
const chunkErrors = new Map(); const loadedChunks = new Map();
function clearChunkCache() { function clearChunkCache() {
loadedChunks.clear(); loadedChunks.clear();
chunkErrors.clear();
} }
function loadRuntimeChunkPath(sourcePath, chunkPath) { /**
* Synchronously loads a chunk using require(). Caches results so a chunk is
* only loaded once; cached errors are re-thrown on subsequent calls.
*
* @param sourceId - identifier for error messages (chunk path or module id)
* @param sourceIsModule - true: "from module {sourceId}", false: "from runtime for chunk {sourceId}"
*/ function loadChunkPath(chunkPath, sourceId, sourceIsModule) {
if (!isJs(chunkPath)) { if (!isJs(chunkPath)) {
// We only support loading JS chunks in Node.js. // We only support loading JS chunks in Node.js.
// This branch can be hit when trying to load a CSS chunk. // This branch can be hit when trying to load a CSS chunk.
return; return;
} }
if (loadedChunks.has(chunkPath)) { const cached = loadedChunks.get(chunkPath);
if (cached !== undefined) {
if (cached !== null) throw cached;
return; return;
} }
try { try {
const resolved = path.resolve(RUNTIME_ROOT, chunkPath); const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
const chunkModules = require(resolved); const chunkModules = require(resolved);
installCompressedModuleFactories(chunkModules, 0, moduleFactories); installCompressedModuleFactories(chunkModules, 0, moduleFactories);
loadedChunks.add(chunkPath); loadedChunks.set(chunkPath, null);
} catch (cause) { } catch (cause) {
let errorMessage = `Failed to load chunk ${chunkPath}`; const error = new Error(sourceIsModule ? `Failed to load chunk ${chunkPath} from module ${sourceId}` : `Failed to load chunk ${chunkPath} ${sourceId ? `from runtime for chunk ${sourceId}` : ''}`, {
if (sourcePath) {
errorMessage += ` from runtime for chunk ${sourcePath}`;
}
const error = new Error(errorMessage, {
cause cause
}); });
error.name = 'ChunkLoadError'; error.name = 'ChunkLoadError';
// Don't cache runtime chunk loading errors
if (!sourceIsModule) {
loadedChunks.set(chunkPath, error);
}
throw error; throw error;
} }
} }
/** function loadRuntimeChunkPath(sourcePath, chunkPath) {
* Synchronously loads a chunk using require(). On Node.js, chunk loading is loadChunkPath(chunkPath, sourcePath, false);
* always synchronous (file I/O via require), so there's no need for promises. }
* Throws on failure. function loadChunkSync(chunkData) {
*/ function loadChunkSync(chunkData) {
const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path; const chunkPath = typeof chunkData === 'string' ? chunkData : chunkData.path;
if (!isJs(chunkPath)) { loadChunkPath(chunkPath, this.m.id, true);
// We only support loading JS chunks in Node.js.
// This branch can be hit when trying to load a CSS chunk.
return;
}
if (loadedChunks.has(chunkPath)) {
return;
}
const cachedError = chunkErrors.get(chunkPath);
if (cachedError !== undefined) {
throw cachedError;
}
try {
const resolved = path.resolve(RUNTIME_ROOT, chunkPath);
const chunkModules = require(resolved);
installCompressedModuleFactories(chunkModules, 0, moduleFactories);
loadedChunks.add(chunkPath);
} catch (cause) {
const errorMessage = `Failed to load chunk ${chunkPath} from module ${this.m.id}`;
const error = new Error(errorMessage, {
cause
});
error.name = 'ChunkLoadError';
// Cache the failure, future requests will also get this same error
chunkErrors.set(chunkPath, error);
throw error;
}
} }
contextPrototype.l = loadChunkSync; contextPrototype.l = loadChunkSync;
// Override the shared asyncLoader with an async version for Node.js.
// In the Node.js runtime, chunk loading and module evaluation are synchronous,
// so the loader may return a plain value or throw. Since dynamic import() must
// always return a Promise per the spec, wrapping in async ensures both success
// values and errors are properly wrapped in a Promise.
async function asyncLoaderNodeJs(moduleId) {
const loader = this.r(moduleId);
return loader(esmImport.bind(this));
}
contextPrototype.A = asyncLoaderNodeJs;
function loadChunkSyncByUrl(chunkUrl) { function loadChunkSyncByUrl(chunkUrl) {
const chunkPath = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT)); const chunkPath = url.fileURLToPath(new URL(chunkUrl, RUNTIME_ROOT));
return loadChunkSync.call(this, chunkPath); loadChunkSync.call(this, chunkPath);
} }
contextPrototype.L = loadChunkSyncByUrl; contextPrototype.L = loadChunkSyncByUrl;
function loadWebAssembly(chunkPath, _edgeModule, imports) { function loadWebAssembly(chunkPath, _edgeModule, imports) {
......
...@@ -283,6 +283,8 @@ function esmImport(id) { ...@@ -283,6 +283,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
const loader = this.r(moduleId); const loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
......
...@@ -505,6 +505,8 @@ function esmImport(id) { ...@@ -505,6 +505,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
var loader = this.r(moduleId); var loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
......
...@@ -283,6 +283,8 @@ function esmImport(id) { ...@@ -283,6 +283,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
const loader = this.r(moduleId); const loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
......
...@@ -283,6 +283,8 @@ function esmImport(id) { ...@@ -283,6 +283,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
const loader = this.r(moduleId); const loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
......
...@@ -283,6 +283,8 @@ function esmImport(id) { ...@@ -283,6 +283,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
const loader = this.r(moduleId); const loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
......
...@@ -283,6 +283,8 @@ function esmImport(id) { ...@@ -283,6 +283,8 @@ function esmImport(id) {
return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule); return module.namespaceObject = interopEsm(raw, createNS(raw), raw && raw.__esModule);
} }
contextPrototype.i = esmImport; contextPrototype.i = esmImport;
// Base async loader for dynamic import(). In the browser, chunk loading is
// naturally async so loaders already return Promises — no extra wrapping needed.
function asyncLoader(moduleId) { function asyncLoader(moduleId) {
const loader = this.r(moduleId); const loader = this.r(moduleId);
return loader(esmImport.bind(this)); return loader(esmImport.bind(this));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment