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.
@@ -501,7 +501,6 @@ function handleTurbopackModule(bundle, moduleId, id) {
501
501
  }
502
502
  const exports = {};
503
503
  const moduleExports = { exports };
504
- const exportNames = /* @__PURE__ */ new Set();
505
504
  if (!self.__remote_components_turbopack_modules__) {
506
505
  self.__remote_components_turbopack_modules__ = {};
507
506
  }
@@ -537,31 +536,53 @@ function handleTurbopackModule(bundle, moduleId, id) {
537
536
  };
538
537
  }
539
538
  },
540
- // define exports
541
- s(m) {
542
- let mod = m;
543
- if (Array.isArray(m)) {
544
- mod = {};
545
- const keys = [];
546
- for (const current of m) {
547
- if (typeof current === "string") {
548
- keys.push(current);
549
- } else if (typeof current === "function") {
550
- while (keys.length > 0) {
551
- const key = keys.shift();
552
- if (key) {
553
- mod[key] = current;
554
- }
539
+ // esm
540
+ s(bindings, esmId) {
541
+ let mod = exports;
542
+ if (typeof esmId === "string" || typeof esmId === "number") {
543
+ if (!self.__remote_components_turbopack_modules__) {
544
+ self.__remote_components_turbopack_modules__ = {};
545
+ }
546
+ if (!self.__remote_components_turbopack_modules__[bundle]) {
547
+ self.__remote_components_turbopack_modules__[bundle] = {};
548
+ }
549
+ if (!self.__remote_components_turbopack_modules__[bundle][esmId]) {
550
+ self.__remote_components_turbopack_modules__[bundle][esmId] = {};
551
+ }
552
+ mod = self.__remote_components_turbopack_modules__[bundle][esmId];
553
+ }
554
+ Object.defineProperty(mod, "__esModule", { value: true });
555
+ if (Array.isArray(bindings)) {
556
+ let i = 0;
557
+ while (i < bindings.length) {
558
+ const propName = bindings[i++];
559
+ const tagOrFunc = bindings[i++];
560
+ if (typeof tagOrFunc === "number") {
561
+ Object.defineProperty(mod, propName, {
562
+ value: bindings[i++],
563
+ enumerable: true,
564
+ writable: false
565
+ });
566
+ } else {
567
+ const getterFn = tagOrFunc;
568
+ if (typeof bindings[i] === "function") {
569
+ const setterFn = bindings[i++];
570
+ Object.defineProperty(mod, propName, {
571
+ get: getterFn,
572
+ set: setterFn,
573
+ enumerable: true
574
+ });
575
+ } else {
576
+ Object.defineProperty(mod, propName, {
577
+ get: getterFn,
578
+ enumerable: true
579
+ });
555
580
  }
556
581
  }
557
582
  }
558
583
  }
559
- for (const [key, value] of Object.entries(mod)) {
560
- exports[key] = value;
561
- exportNames.add(key);
562
- }
563
584
  },
564
- // import ESM
585
+ // import
565
586
  i(importId) {
566
587
  let mod;
567
588
  if (typeof importId === "string") {
@@ -585,7 +606,10 @@ function handleTurbopackModule(bundle, moduleId, id) {
585
606
  } else {
586
607
  mod = self.__webpack_require__?.(`[${bundle}] ${importId}`);
587
608
  }
588
- if (!("default" in mod) && mod.toString() !== "[object Module]") {
609
+ if (typeof mod !== "object") {
610
+ mod = { default: mod };
611
+ } else if (!("default" in mod) && // eslint-disable-next-line @typescript-eslint/no-base-to-string
612
+ mod.toString() !== "[object Module]") {
589
613
  try {
590
614
  mod.default = mod;
591
615
  } catch {
@@ -604,7 +628,7 @@ function handleTurbopackModule(bundle, moduleId, id) {
604
628
  return self.__webpack_require__?.(`[${bundle}] ${vid}`);
605
629
  });
606
630
  } else {
607
- exports.default = value;
631
+ moduleExports.exports = value;
608
632
  }
609
633
  },
610
634
  // async module initializer
@@ -648,11 +672,6 @@ function handleTurbopackModule(bundle, moduleId, id) {
648
672
  moduleExports,
649
673
  exports
650
674
  );
651
- for (const name of exportNames) {
652
- if (typeof exports[name] === "function") {
653
- exports[name] = exports[name]();
654
- }
655
- }
656
675
  if (self.__remote_components_turbopack_modules__[bundle][moduleId] !== moduleExports.exports) {
657
676
  self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
658
677
  }