remote-components 0.0.25 → 0.0.27

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/dist/html/host.js CHANGED
@@ -358,17 +358,21 @@ function createModuleRequire(runtime) {
358
358
  return handleTurbopackModule(bundle, moduleId, id);
359
359
  }
360
360
  throw new Error(`Module ${id} not found`);
361
- } catch {
361
+ } catch (requireError) {
362
362
  if (typeof self.__original_webpack_require__ !== "function") {
363
363
  throw new Error(
364
- `Module ${id} not found in remote component bundle ${bundle}`
364
+ `Module ${id} not found in remote component bundle ${bundle}`,
365
+ {
366
+ cause: requireError instanceof Error ? requireError : void 0
367
+ }
365
368
  );
366
369
  }
367
370
  try {
368
371
  return self.__original_webpack_require__(id);
369
- } catch {
372
+ } catch (originalError) {
370
373
  throw new Error(
371
- `Module ${id} not found in remote component bundle ${bundle}`
374
+ `Module ${id} not found in remote component bundle ${bundle}`,
375
+ { cause: originalError instanceof Error ? originalError : void 0 }
372
376
  );
373
377
  }
374
378
  }
@@ -464,7 +468,8 @@ function handleTurbopackModule(bundle, moduleId, id) {
464
468
  registerExports() {
465
469
  },
466
470
  signature() {
467
- return () => {
471
+ return (fn) => {
472
+ return fn;
468
473
  };
469
474
  }
470
475
  },
@@ -497,8 +502,18 @@ function handleTurbopackModule(bundle, moduleId, id) {
497
502
  const mod = self.__webpack_require__?.(
498
503
  `[${bundle}] ${normalizedId}`
499
504
  );
500
- if (exportSource && exportName && typeof mod[exportSource] !== "undefined" && typeof mod[exportName] === "undefined") {
501
- mod[exportName] = mod[exportSource];
505
+ if (exportSource && exportName && (exportSource === "*" || typeof mod[exportSource] !== "undefined") && typeof mod[exportName] === "undefined") {
506
+ if (exportSource === "*") {
507
+ mod[exportName] = mod;
508
+ } else {
509
+ mod[exportName] = mod[exportSource];
510
+ }
511
+ }
512
+ if (!("default" in mod) && mod.toString() !== "[object Module]") {
513
+ try {
514
+ mod.default = mod;
515
+ } catch {
516
+ }
502
517
  }
503
518
  return mod;
504
519
  },
@@ -508,6 +523,21 @@ function handleTurbopackModule(bundle, moduleId, id) {
508
523
  v(value) {
509
524
  exports.default = value;
510
525
  },
526
+ async a(mod) {
527
+ let result;
528
+ await mod(
529
+ () => {
530
+ },
531
+ (value) => result = value
532
+ );
533
+ exports.default = result;
534
+ },
535
+ async A(Aid) {
536
+ const mod = self.__webpack_require__?.(`[${bundle}] ${Aid}`);
537
+ return mod.default(
538
+ (parentId) => self.__webpack_require__?.(`[${bundle}] ${parentId}`)
539
+ );
540
+ },
511
541
  g: self.__remote_components_turbopack_global__[bundle],
512
542
  m: moduleExports,
513
543
  e: exports
@@ -520,6 +550,9 @@ function handleTurbopackModule(bundle, moduleId, id) {
520
550
  exports[name] = exports[name]();
521
551
  }
522
552
  }
553
+ if (self.__remote_components_turbopack_modules__[bundle][moduleId] !== moduleExports.exports) {
554
+ self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
555
+ }
523
556
  return moduleExports.exports;
524
557
  }
525
558
  var init_webpack_adapter = __esm({
@@ -621,7 +654,15 @@ function sharedPolyfills(shared) {
621
654
  },
622
655
  __esModule: true
623
656
  })
624
- ))
657
+ )),
658
+ "next/dist/build/polyfills/process": () => Promise.resolve({
659
+ default: {
660
+ env: {
661
+ NODE_ENV: "production"
662
+ }
663
+ },
664
+ __esModule: true
665
+ })
625
666
  };
626
667
  polyfill["next/navigation"] = polyfill["next/dist/client/components/navigation"];
627
668
  polyfill["next/link"] = polyfill["next/dist/client/app-dir/link"];
@@ -877,7 +918,7 @@ function createRSCStream(rscName, data) {
877
918
  self[rscName] = null;
878
919
  allChunks.split("\n").forEach((chunk) => {
879
920
  if (chunk.length > 0) {
880
- const { before, id, prefix, payload } = /^(?<before>.*?)?(?<id>[0-9a-zA-Z]+):(?<prefix>[A-Z])?(?<payload>\[.*\])/.exec(
921
+ const { before, id, prefix, payload } = /^(?<before>[^:]*?)?(?<id>[0-9a-zA-Z]+):(?<prefix>[A-Z])?(?<payload>\[.*\])/.exec(
881
922
  chunk
882
923
  )?.groups ?? {};
883
924
  if (payload) {
@@ -920,26 +961,28 @@ var tagNames = [
920
961
  "link"
921
962
  ];
922
963
  function applyOriginToNodes(doc, url) {
923
- const nodes = doc.querySelectorAll(
924
- tagNames.map((type) => `${type}[src],${type}[srcset]`).join(",")
925
- );
926
- nodes.forEach((node) => {
927
- if (node.hasAttribute("src") && /^[./]+\/?/.test(node.getAttribute("src") ?? "")) {
928
- node.src = new URL(node.getAttribute("src") ?? "/", url).href;
929
- }
930
- if (node.hasAttribute("srcset")) {
931
- const srcSet = node.getAttribute("srcset")?.split(",").map((entry) => {
932
- const [urlPart, descriptor] = entry.trim().split(/\s+/);
933
- if (!urlPart)
934
- return entry;
935
- const absoluteUrl = new URL(urlPart, url).href;
936
- return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
937
- }).join(", ");
938
- if (srcSet) {
939
- node.setAttribute("srcset", srcSet);
964
+ if (url.origin !== location.origin) {
965
+ const nodes = doc.querySelectorAll(
966
+ tagNames.map((type) => `${type}[src],${type}[srcset]`).join(",")
967
+ );
968
+ nodes.forEach((node) => {
969
+ if (node.hasAttribute("src") && /^[./]+\/?/.test(node.getAttribute("src") ?? "")) {
970
+ node.src = new URL(node.getAttribute("src") ?? "/", url).href;
940
971
  }
941
- }
942
- });
972
+ if (node.hasAttribute("srcset")) {
973
+ const srcSet = node.getAttribute("srcset")?.split(",").map((entry) => {
974
+ const [urlPart, descriptor] = entry.trim().split(/\s+/);
975
+ if (!urlPart)
976
+ return entry;
977
+ const absoluteUrl = new URL(urlPart, url).href;
978
+ return descriptor ? `${absoluteUrl} ${descriptor}` : absoluteUrl;
979
+ }).join(", ");
980
+ if (srcSet) {
981
+ node.setAttribute("srcset", srcSet);
982
+ }
983
+ }
984
+ });
985
+ }
943
986
  }
944
987
 
945
988
  // src/html/host/runtime/index.ts