remote-components 0.0.31 → 0.0.32

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.
@@ -524,7 +524,6 @@ function handleTurbopackModule(bundle, moduleId, id) {
524
524
  }
525
525
  const exports = {};
526
526
  const moduleExports = { exports };
527
- const exportNames = /* @__PURE__ */ new Set();
528
527
  if (!self.__remote_components_turbopack_modules__) {
529
528
  self.__remote_components_turbopack_modules__ = {};
530
529
  }
@@ -560,31 +559,53 @@ function handleTurbopackModule(bundle, moduleId, id) {
560
559
  };
561
560
  }
562
561
  },
563
- // define exports
564
- s(m) {
565
- let mod = m;
566
- if (Array.isArray(m)) {
567
- mod = {};
568
- const keys = [];
569
- for (const current of m) {
570
- if (typeof current === "string") {
571
- keys.push(current);
572
- } else if (typeof current === "function") {
573
- while (keys.length > 0) {
574
- const key = keys.shift();
575
- if (key) {
576
- mod[key] = current;
577
- }
562
+ // esm
563
+ s(bindings, esmId) {
564
+ let mod = exports;
565
+ if (typeof esmId === "string" || typeof esmId === "number") {
566
+ if (!self.__remote_components_turbopack_modules__) {
567
+ self.__remote_components_turbopack_modules__ = {};
568
+ }
569
+ if (!self.__remote_components_turbopack_modules__[bundle]) {
570
+ self.__remote_components_turbopack_modules__[bundle] = {};
571
+ }
572
+ if (!self.__remote_components_turbopack_modules__[bundle][esmId]) {
573
+ self.__remote_components_turbopack_modules__[bundle][esmId] = {};
574
+ }
575
+ mod = self.__remote_components_turbopack_modules__[bundle][esmId];
576
+ }
577
+ Object.defineProperty(mod, "__esModule", { value: true });
578
+ if (Array.isArray(bindings)) {
579
+ let i = 0;
580
+ while (i < bindings.length) {
581
+ const propName = bindings[i++];
582
+ const tagOrFunc = bindings[i++];
583
+ if (typeof tagOrFunc === "number") {
584
+ Object.defineProperty(mod, propName, {
585
+ value: bindings[i++],
586
+ enumerable: true,
587
+ writable: false
588
+ });
589
+ } else {
590
+ const getterFn = tagOrFunc;
591
+ if (typeof bindings[i] === "function") {
592
+ const setterFn = bindings[i++];
593
+ Object.defineProperty(mod, propName, {
594
+ get: getterFn,
595
+ set: setterFn,
596
+ enumerable: true
597
+ });
598
+ } else {
599
+ Object.defineProperty(mod, propName, {
600
+ get: getterFn,
601
+ enumerable: true
602
+ });
578
603
  }
579
604
  }
580
605
  }
581
606
  }
582
- for (const [key, value] of Object.entries(mod)) {
583
- exports[key] = value;
584
- exportNames.add(key);
585
- }
586
607
  },
587
- // import ESM
608
+ // import
588
609
  i(importId) {
589
610
  let mod;
590
611
  if (typeof importId === "string") {
@@ -608,7 +629,10 @@ function handleTurbopackModule(bundle, moduleId, id) {
608
629
  } else {
609
630
  mod = self.__webpack_require__?.(`[${bundle}] ${importId}`);
610
631
  }
611
- if (!("default" in mod) && mod.toString() !== "[object Module]") {
632
+ if (typeof mod !== "object") {
633
+ mod = { default: mod };
634
+ } else if (!("default" in mod) && // eslint-disable-next-line @typescript-eslint/no-base-to-string
635
+ mod.toString() !== "[object Module]") {
612
636
  try {
613
637
  mod.default = mod;
614
638
  } catch {
@@ -627,7 +651,7 @@ function handleTurbopackModule(bundle, moduleId, id) {
627
651
  return self.__webpack_require__?.(`[${bundle}] ${vid}`);
628
652
  });
629
653
  } else {
630
- exports.default = value;
654
+ moduleExports.exports = value;
631
655
  }
632
656
  },
633
657
  // async module initializer
@@ -671,11 +695,6 @@ function handleTurbopackModule(bundle, moduleId, id) {
671
695
  moduleExports,
672
696
  exports
673
697
  );
674
- for (const name of exportNames) {
675
- if (typeof exports[name] === "function") {
676
- exports[name] = exports[name]();
677
- }
678
- }
679
698
  if (self.__remote_components_turbopack_modules__[bundle][moduleId] !== moduleExports.exports) {
680
699
  self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
681
700
  }