remote-components 0.0.50 → 0.0.51

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.
Files changed (71) hide show
  1. package/dist/html/host.cjs +330 -166
  2. package/dist/html/host.cjs.map +1 -1
  3. package/dist/html/host.js +330 -166
  4. package/dist/html/host.js.map +1 -1
  5. package/dist/html/remote.cjs +114 -20
  6. package/dist/html/remote.cjs.map +1 -1
  7. package/dist/html/remote.js +114 -20
  8. package/dist/html/remote.js.map +1 -1
  9. package/dist/internal/shared/{ssr → client}/fetch-with-protected-rc-fallback.cjs +9 -6
  10. package/dist/internal/shared/client/fetch-with-protected-rc-fallback.cjs.map +1 -0
  11. package/dist/internal/shared/{ssr → client}/fetch-with-protected-rc-fallback.d.ts +1 -2
  12. package/dist/internal/shared/{ssr → client}/fetch-with-protected-rc-fallback.js +10 -6
  13. package/dist/internal/shared/client/fetch-with-protected-rc-fallback.js.map +1 -0
  14. package/dist/internal/shared/client/protected-rc-fallback.cjs +32 -0
  15. package/dist/internal/shared/client/protected-rc-fallback.cjs.map +1 -0
  16. package/dist/internal/shared/client/protected-rc-fallback.d.ts +6 -0
  17. package/dist/internal/shared/client/protected-rc-fallback.js +8 -0
  18. package/dist/internal/shared/client/protected-rc-fallback.js.map +1 -0
  19. package/dist/internal/shared/client/remote-component.cjs +190 -100
  20. package/dist/internal/shared/client/remote-component.cjs.map +1 -1
  21. package/dist/internal/shared/client/remote-component.js +190 -100
  22. package/dist/internal/shared/client/remote-component.js.map +1 -1
  23. package/dist/internal/shared/constants.cjs +29 -0
  24. package/dist/internal/shared/constants.cjs.map +1 -0
  25. package/dist/internal/shared/constants.d.ts +3 -0
  26. package/dist/internal/shared/constants.js +5 -0
  27. package/dist/internal/shared/constants.js.map +1 -0
  28. package/dist/internal/shared/ssr/fetch-remote-component.cjs +1 -2
  29. package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +1 -1
  30. package/dist/internal/shared/ssr/fetch-remote-component.js +1 -2
  31. package/dist/internal/shared/ssr/fetch-remote-component.js.map +1 -1
  32. package/dist/internal/shared/ssr/fetch-with-hooks.cjs +1 -1
  33. package/dist/internal/shared/ssr/fetch-with-hooks.cjs.map +1 -1
  34. package/dist/internal/shared/ssr/fetch-with-hooks.js +1 -1
  35. package/dist/internal/shared/ssr/fetch-with-hooks.js.map +1 -1
  36. package/dist/internal/shared/utils/logger.cjs.map +1 -1
  37. package/dist/internal/shared/utils/logger.d.ts +1 -1
  38. package/dist/internal/shared/utils/logger.js.map +1 -1
  39. package/dist/next/config.cjs.map +1 -1
  40. package/dist/next/config.js.map +1 -1
  41. package/dist/next/host/client/index.cjs +202 -107
  42. package/dist/next/host/client/index.cjs.map +1 -1
  43. package/dist/next/host/client/index.js +202 -107
  44. package/dist/next/host/client/index.js.map +1 -1
  45. package/dist/next/host/pages-router-server.cjs +1 -2
  46. package/dist/next/host/pages-router-server.cjs.map +1 -1
  47. package/dist/next/host/pages-router-server.d.ts +5 -0
  48. package/dist/next/host/pages-router-server.js +1 -2
  49. package/dist/next/host/pages-router-server.js.map +1 -1
  50. package/dist/next/proxy.cjs +36 -24
  51. package/dist/next/proxy.cjs.map +1 -1
  52. package/dist/next/proxy.d.ts +0 -1
  53. package/dist/next/proxy.js +36 -24
  54. package/dist/next/proxy.js.map +1 -1
  55. package/dist/react/index.cjs +202 -107
  56. package/dist/react/index.cjs.map +1 -1
  57. package/dist/react/index.js +202 -107
  58. package/dist/react/index.js.map +1 -1
  59. package/dist/shared/host/proxy.cjs +23 -20
  60. package/dist/shared/host/proxy.cjs.map +1 -1
  61. package/dist/shared/host/proxy.d.ts +0 -3
  62. package/dist/shared/host/proxy.js +23 -19
  63. package/dist/shared/host/proxy.js.map +1 -1
  64. package/dist/shared/remote/proxy.cjs +9 -1
  65. package/dist/shared/remote/proxy.cjs.map +1 -1
  66. package/dist/shared/remote/proxy.d.ts +7 -1
  67. package/dist/shared/remote/proxy.js +8 -1
  68. package/dist/shared/remote/proxy.js.map +1 -1
  69. package/package.json +1 -1
  70. package/dist/internal/shared/ssr/fetch-with-protected-rc-fallback.cjs.map +0 -1
  71. package/dist/internal/shared/ssr/fetch-with-protected-rc-fallback.js.map +0 -1
@@ -275,6 +275,17 @@ function createRSCStream(rscName, data) {
275
275
  });
276
276
  }
277
277
 
278
+ // src/shared/constants.ts
279
+ var RC_PROTECTED_REMOTE_FETCH_PATHNAME = "/rc-fetch-protected-remote";
280
+
281
+ // src/shared/client/protected-rc-fallback.ts
282
+ function generateProtectedRcFallbackSrc(url) {
283
+ return `${RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${encodeURIComponent(url)}`;
284
+ }
285
+
286
+ // src/shared/client/webpack-patterns.ts
287
+ var NEXT_BUNDLE_PATH_RE = /\/_next\/\[.+\](?:%20| )/;
288
+
278
289
  // src/shared/client/script-loader.ts
279
290
  async function loadScripts(scripts) {
280
291
  await Promise.all(
@@ -282,28 +293,65 @@ async function loadScripts(scripts) {
282
293
  return new Promise((resolve, reject) => {
283
294
  const newSrc = new URL(
284
295
  // remove the remote component bundle name identifier from the script src
285
- script.src.replace(/\/_next\/\[.+\](?<whitespace>%20| )/, "/_next/"),
296
+ script.src.replace(NEXT_BUNDLE_PATH_RE, "/_next/"),
286
297
  location.origin
287
298
  ).href;
288
- const newScript = document.createElement("script");
289
- newScript.onload = () => {
290
- resolve();
291
- };
292
- newScript.onerror = () => {
293
- reject(
294
- new RemoteComponentsError(
295
- `Failed to load <script src="${script.src}"> for Remote Component. Check the URL is correct.`
296
- )
297
- );
299
+ const loadScriptWithProtectedRcFallback = (src, isFallback = false) => {
300
+ const newScript = document.createElement("script");
301
+ newScript.onload = () => {
302
+ if (isFallback) {
303
+ logInfo(
304
+ "ScriptLoader",
305
+ `Successfully loaded <script src="${newSrc}"> using fallback.`
306
+ );
307
+ }
308
+ resolve();
309
+ };
310
+ newScript.onerror = () => {
311
+ if (!isFallback) {
312
+ const fallbackSrc = generateProtectedRcFallbackSrc(newSrc);
313
+ logWarn(
314
+ "ScriptLoader",
315
+ `Failed to load <script src="${newSrc}"> for Remote Component. Trying fallback with ${RC_PROTECTED_REMOTE_FETCH_PATHNAME} (withRemoteComponentsHost)...`
316
+ );
317
+ loadScriptWithProtectedRcFallback(fallbackSrc, true);
318
+ } else {
319
+ logError(
320
+ "ScriptLoader",
321
+ `Failed to load fallback for <script src="${newSrc}"> for Remote Component.`
322
+ );
323
+ reject(
324
+ new RemoteComponentsError(
325
+ `Failed to load <script src="${newSrc}"> for Remote Component. Check the URL is correct.`
326
+ )
327
+ );
328
+ }
329
+ };
330
+ newScript.src = src;
331
+ newScript.async = true;
332
+ document.head.appendChild(newScript);
298
333
  };
299
- newScript.src = newSrc;
300
- newScript.async = true;
301
- document.head.appendChild(newScript);
334
+ loadScriptWithProtectedRcFallback(newSrc);
302
335
  });
303
336
  })
304
337
  );
305
338
  }
306
339
 
340
+ // src/shared/utils/index.ts
341
+ function escapeString(str) {
342
+ return str.replace(/[^a-z0-9]/g, "_");
343
+ }
344
+
345
+ // src/shared/client/const.ts
346
+ var DEFAULT_ROUTE = "/";
347
+ var RUNTIME_WEBPACK = "webpack";
348
+ var RUNTIME_TURBOPACK = "turbopack";
349
+ var RUNTIME_SCRIPT = "script";
350
+ var REMOTE_COMPONENT_REGEX = /(?<prefix>.*?)\[(?<bundle>[^\]]+)\](?:%20| )(?<id>.+)/;
351
+ function getBundleKey(bundle) {
352
+ return escapeString(bundle);
353
+ }
354
+
307
355
  // src/shared/utils/abort.ts
308
356
  function isAbortError(error) {
309
357
  if (error instanceof DOMException && error.name === "AbortError") {
@@ -316,8 +364,7 @@ function isAbortError(error) {
316
364
  return false;
317
365
  }
318
366
 
319
- // src/shared/ssr/fetch-with-protected-rc-fallback.ts
320
- var RC_PROTECTED_REMOTE_FETCH_PATHNAME = "/rc-fetch-protected-remote";
367
+ // src/shared/client/fetch-with-protected-rc-fallback.ts
321
368
  async function fetchWithProtectedRcFallback(url, init) {
322
369
  try {
323
370
  const res = await fetch(url, init);
@@ -326,16 +373,21 @@ async function fetchWithProtectedRcFallback(url, init) {
326
373
  if (isAbortError(error)) {
327
374
  throw error;
328
375
  }
329
- if (typeof document === "object" && typeof document.location === "object" && document.location.origin !== new URL(url).origin) {
330
- logInfo(
376
+ const parsedUrl = new URL(url);
377
+ if (typeof document === "object" && typeof document.location === "object" && document.location.origin !== parsedUrl.origin) {
378
+ logWarn(
331
379
  "FetchRemoteComponent",
332
380
  "Request failed due to CORS, attempting to fetch it via the withRemoteComponentsHost proxy."
333
381
  );
334
382
  const proxiedRes = await fetch(
335
- `${RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${url}`,
383
+ generateProtectedRcFallbackSrc(parsedUrl.href),
336
384
  init?.signal ? { signal: init.signal } : void 0
337
385
  );
338
386
  if (proxiedRes.status === 200) {
387
+ logInfo(
388
+ "FetchRemoteComponent",
389
+ `Successfully fetched ${parsedUrl.href} with fallback withRemoteComponentsHost proxy`
390
+ );
339
391
  return proxiedRes;
340
392
  } else {
341
393
  logError(
@@ -348,28 +400,12 @@ async function fetchWithProtectedRcFallback(url, init) {
348
400
  }
349
401
  }
350
402
 
351
- // src/shared/utils/index.ts
352
- function escapeString(str) {
353
- return str.replace(/[^a-z0-9]/g, "_");
354
- }
355
-
356
- // src/shared/client/const.ts
357
- var DEFAULT_ROUTE = "/";
358
- var RUNTIME_WEBPACK = "webpack";
359
- var RUNTIME_TURBOPACK = "turbopack";
360
- var RUNTIME_SCRIPT = "script";
361
- var REMOTE_COMPONENT_REGEX = /(?<prefix>.*?)\[(?<bundle>[^\]]+)\](?:%20| )(?<id>.+)/;
362
- function getBundleKey(bundle) {
363
- return escapeString(bundle);
364
- }
365
-
366
403
  // src/shared/client/turbopack-patterns.ts
367
404
  var REMOTE_SHARED_MARKER_RE = /(?:self|[a-z])\.TURBOPACK_REMOTE_SHARED/;
368
405
  var REMOTE_SHARED_ASSIGNMENT_RE = /\.TURBOPACK_REMOTE_SHARED=await (?:__turbopack_context__|e)\.A\((?<sharedModuleId>[0-9]+)\)/;
369
406
  var ASYNC_MODULE_LOADER_RE = /(?:__turbopack_context__|e)\.A\((?<asyncSharedModuleId>[0-9]+)\)/;
370
407
  var ASYNC_MODULE_RESOLVE_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<inner>parentImport|e)=>Promise\.resolve\(\)\.then\(\(\)=>\k<inner>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
371
408
  var ASYNC_MODULE_ALL_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<vCb>parentImport|t)=>Promise\.all\(\["[^"]+"\]\.map\((?<mapCb>chunk|t)=>\k<ctx>\.l\(\k<mapCb>\)\)\)\.then\(\(\)=>\k<vCb>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
372
- var NUMERIC_MODULE_ID_RE = /^[0-9]+$/;
373
409
  var TURBOPACK_GLOBAL_RE = /(?:globalThis|self)\s*(?:\.TURBOPACK|\[\s*["']TURBOPACK["']\s*\])/;
374
410
 
375
411
  // src/shared/client/chunk-loader.ts
@@ -575,10 +611,14 @@ async function handleTurbopackChunk(code, bundle, url) {
575
611
  function handleTurbopackModule(bundle, moduleId, id) {
576
612
  const self = globalThis;
577
613
  const bundleKey = getBundleKey(bundle);
578
- let modules = self[`TURBOPACK_${bundleKey}`];
579
- if (modules && typeof modules === "object" && "__chunks__" in modules) {
580
- const chunks = modules.__chunks__;
581
- modules = chunks.flat();
614
+ const raw = self[`TURBOPACK_${bundleKey}`];
615
+ let modules;
616
+ if (raw && typeof raw === "object" && "__chunks__" in raw) {
617
+ modules = raw.__chunks__.flat();
618
+ } else if (Array.isArray(raw)) {
619
+ modules = raw.flat();
620
+ } else {
621
+ modules = raw;
582
622
  }
583
623
  if (!self.__remote_components_turbopack_modules__) {
584
624
  self.__remote_components_turbopack_modules__ = {};
@@ -607,13 +647,12 @@ function handleTurbopackModule(bundle, moduleId, id) {
607
647
  if (!self.__remote_components_turbopack_global__[bundle]) {
608
648
  self.__remote_components_turbopack_global__[bundle] = {};
609
649
  }
610
- const allModules = Array.isArray(modules) ? modules.flat() : modules ? Object.values(modules) : [];
611
650
  moduleInit(
612
651
  createTurbopackContext(
613
652
  bundle,
614
653
  exports,
615
654
  moduleExports,
616
- allModules,
655
+ modules,
617
656
  moduleInit,
618
657
  id,
619
658
  self
@@ -627,46 +666,27 @@ function handleTurbopackModule(bundle, moduleId, id) {
627
666
  return moduleExports.exports;
628
667
  }
629
668
  function findModuleInit(modules, moduleId) {
630
- if (modules && !Array.isArray(modules) && typeof modules === "object") {
631
- const normalizedId = NUMERIC_MODULE_ID_RE.test(moduleId) ? Number(moduleId) : moduleId;
632
- if (normalizedId in modules) {
633
- return modules[normalizedId];
634
- }
635
- if (typeof normalizedId === "number" && String(normalizedId) in modules) {
636
- return modules[String(normalizedId)];
637
- }
638
- const matchingKey = Object.keys(modules).find(
639
- (key) => typeof key === "string" && key.includes(String(moduleId))
669
+ if (!modules || typeof modules !== "object")
670
+ return;
671
+ if (!Array.isArray(modules)) {
672
+ const key = moduleId in modules ? moduleId : Object.keys(modules).find((k) => k.startsWith(moduleId));
673
+ return key !== void 0 ? modules[key] : void 0;
674
+ }
675
+ const flat = modules.flat();
676
+ let idx = flat.findIndex((e) => String(e) === String(moduleId));
677
+ if (idx < 0) {
678
+ idx = flat.findIndex(
679
+ (e) => typeof e === "string" && e.startsWith(moduleId)
640
680
  );
641
- if (matchingKey) {
642
- return modules[matchingKey];
643
- }
644
- logError("TurbopackModule", `No match found for module ID: ${moduleId}`);
645
- return void 0;
646
681
  }
647
- const allModules = modules?.flat() ?? [];
648
- if (typeof allModules[1] === "string" || typeof allModules[1] === "number") {
649
- const normalizedId = NUMERIC_MODULE_ID_RE.test(moduleId) ? Number(moduleId) : moduleId;
650
- let moduleIdIndex = allModules.indexOf(normalizedId);
651
- if (moduleIdIndex === -1) {
652
- moduleIdIndex = allModules.findIndex(
653
- (bundleEntry) => typeof bundleEntry === "string" && bundleEntry.startsWith(moduleId) || bundleEntry === normalizedId
654
- );
655
- }
656
- if (moduleIdIndex !== -1) {
657
- while (typeof allModules[moduleIdIndex] !== "function" && moduleIdIndex < allModules.length) {
658
- moduleIdIndex++;
659
- }
660
- return allModules[moduleIdIndex];
661
- }
662
- } else {
663
- return allModules.find(
664
- (bundleEntry) => typeof bundleEntry === "object" && bundleEntry !== null && moduleId in bundleEntry
665
- )?.[moduleId];
682
+ if (idx >= 0) {
683
+ return flat.slice(idx + 1).find((e) => typeof e === "function");
666
684
  }
667
- return void 0;
685
+ return flat.find(
686
+ (e) => Boolean(e && typeof e === "object" && moduleId in e)
687
+ )?.[moduleId];
668
688
  }
669
- function createTurbopackContext(bundle, exports, moduleExports, allModules, moduleInit, id, self) {
689
+ function createTurbopackContext(bundle, exports, moduleExports, modules, moduleInit, id, self) {
670
690
  return {
671
691
  // HMR not implemented for Remote Components
672
692
  k: {
@@ -787,13 +807,17 @@ function createTurbopackContext(bundle, exports, moduleExports, allModules, modu
787
807
  (parentId) => self.__webpack_require__?.(`[${bundle}] ${parentId}`)
788
808
  );
789
809
  },
810
+ // dynamic import tracking — no-op for remote components
811
+ j() {
812
+ },
790
813
  // chunk loader
791
814
  l(url) {
792
- const moduleInitIndex = allModules.indexOf(moduleInit);
815
+ const flatModules = Array.isArray(modules) ? modules : [];
816
+ const moduleInitIndex = flatModules.indexOf(moduleInit);
793
817
  if (moduleInitIndex !== -1) {
794
- const scriptIndex = allModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
818
+ const scriptIndex = flatModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
795
819
  if (scriptIndex !== -1) {
796
- const script = allModules[scriptIndex];
820
+ const script = flatModules[scriptIndex];
797
821
  const scriptSrc = script.getAttribute("data-turbopack-src") || "";
798
822
  const nextIndex = scriptSrc.indexOf("/_next");
799
823
  const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
@@ -1202,6 +1226,89 @@ function setAttributesFromProps(el, props) {
1202
1226
  }
1203
1227
 
1204
1228
  // src/shared/client/static-loader.ts
1229
+ async function importViaProxy(absoluteSrc) {
1230
+ const proxyUrl = new URL(
1231
+ generateProtectedRcFallbackSrc(absoluteSrc),
1232
+ location.href
1233
+ ).href;
1234
+ const response = await fetch(proxyUrl);
1235
+ if (!response.ok)
1236
+ throw new Error(`Proxy fetch failed: ${response.status}`);
1237
+ logInfo(
1238
+ "StaticLoader",
1239
+ `Successfully loaded ${absoluteSrc} via protected RC proxy fallback.`
1240
+ );
1241
+ const content = (await response.text()).replace(/import\.meta\.url/g, JSON.stringify(absoluteSrc)).replace(
1242
+ /\b(from|import)\s*(["'])(\.\.?\/[^"']+)\2/g,
1243
+ (_, keyword, quote, relativePath) => {
1244
+ const absoluteImportUrl = new URL(relativePath, absoluteSrc).href;
1245
+ const absoluteProxyUrl = new URL(
1246
+ generateProtectedRcFallbackSrc(absoluteImportUrl),
1247
+ location.href
1248
+ ).href;
1249
+ return `${keyword} ${quote}${absoluteProxyUrl}${quote}`;
1250
+ }
1251
+ );
1252
+ const moduleBlobUrl = URL.createObjectURL(
1253
+ new Blob([content], { type: "text/javascript" })
1254
+ );
1255
+ const wrapperContent = [
1256
+ `import*as m from${JSON.stringify(moduleBlobUrl)};`,
1257
+ `globalThis.__rc_module_registry__=globalThis.__rc_module_registry__||{};`,
1258
+ `globalThis.__rc_module_registry__[${JSON.stringify(absoluteSrc)}]=m;`
1259
+ ].join("");
1260
+ const wrapperBlobUrl = URL.createObjectURL(
1261
+ new Blob([wrapperContent], { type: "text/javascript" })
1262
+ );
1263
+ const scriptEl = document.createElement("script");
1264
+ scriptEl.type = "module";
1265
+ scriptEl.src = wrapperBlobUrl;
1266
+ try {
1267
+ await new Promise((resolve, reject) => {
1268
+ scriptEl.onload = () => resolve();
1269
+ scriptEl.onerror = () => reject(new Error(`Failed to load module for ${absoluteSrc}`));
1270
+ document.head.appendChild(scriptEl);
1271
+ });
1272
+ } finally {
1273
+ scriptEl.remove();
1274
+ URL.revokeObjectURL(moduleBlobUrl);
1275
+ URL.revokeObjectURL(wrapperBlobUrl);
1276
+ }
1277
+ const registry = globalThis.__rc_module_registry__;
1278
+ const mod = registry?.[absoluteSrc] ?? {};
1279
+ if (registry)
1280
+ delete registry[absoluteSrc];
1281
+ return mod;
1282
+ }
1283
+ function resolveScriptSrc(script, url) {
1284
+ const rawSrc = typeof script.getAttribute === "function" ? script.getAttribute("src") ?? script.src : script.src;
1285
+ if (!rawSrc && script.textContent) {
1286
+ return URL.createObjectURL(
1287
+ new Blob(
1288
+ [script.textContent.replace(/import\.meta\.url/g, JSON.stringify(url))],
1289
+ { type: "text/javascript" }
1290
+ )
1291
+ );
1292
+ }
1293
+ return rawSrc;
1294
+ }
1295
+ async function importScriptMod(absoluteSrc) {
1296
+ try {
1297
+ return await import(
1298
+ /* @vite-ignore */
1299
+ /* webpackIgnore: true */
1300
+ absoluteSrc
1301
+ );
1302
+ } catch (importError) {
1303
+ if (absoluteSrc.startsWith("blob:"))
1304
+ throw importError;
1305
+ logWarn(
1306
+ "StaticLoader",
1307
+ `Direct import of ${absoluteSrc} failed, attempting via protected RC proxy fallback.`
1308
+ );
1309
+ return importViaProxy(absoluteSrc);
1310
+ }
1311
+ }
1205
1312
  async function loadStaticRemoteComponent(scripts, url) {
1206
1313
  const self = globalThis;
1207
1314
  if (self.__remote_script_entrypoint_mount__?.[url.href]) {
@@ -1213,26 +1320,9 @@ async function loadStaticRemoteComponent(scripts, url) {
1213
1320
  const mountUnmountSets = await Promise.all(
1214
1321
  scripts.map(async (script) => {
1215
1322
  try {
1216
- let src = typeof script.getAttribute === "function" ? script.getAttribute("src") ?? script.src : script.src;
1217
- if (!src && script.textContent) {
1218
- const blob = new Blob(
1219
- [
1220
- script.textContent.replace(
1221
- /import\.meta\.url/g,
1222
- JSON.stringify(url)
1223
- )
1224
- ],
1225
- {
1226
- type: "text/javascript"
1227
- }
1228
- );
1229
- src = URL.createObjectURL(blob);
1230
- }
1231
- const mod = await import(
1232
- /* @vite-ignore */
1233
- /* webpackIgnore: true */
1234
- new URL(src, url).href
1235
- );
1323
+ const src = resolveScriptSrc(script, url);
1324
+ const absoluteSrc = new URL(src, url).href;
1325
+ const mod = await importScriptMod(absoluteSrc);
1236
1326
  if (src.startsWith("blob:")) {
1237
1327
  URL.revokeObjectURL(src);
1238
1328
  }