remote-components 0.3.4 → 0.3.6

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 (153) hide show
  1. package/dist/app-63L5THIQ.js +12 -0
  2. package/dist/app-63L5THIQ.js.map +1 -0
  3. package/dist/app-A5QE7XRH.cjs +12 -0
  4. package/dist/app-A5QE7XRH.cjs.map +1 -0
  5. package/dist/chunk-2VQGCACH.js +190 -0
  6. package/dist/chunk-2VQGCACH.js.map +1 -0
  7. package/dist/chunk-42N2ZLE2.js +703 -0
  8. package/dist/chunk-42N2ZLE2.js.map +1 -0
  9. package/dist/chunk-6IUP26UK.cjs +57 -0
  10. package/dist/chunk-6IUP26UK.cjs.map +1 -0
  11. package/dist/chunk-7MVFHOIP.cjs +60 -0
  12. package/dist/chunk-7MVFHOIP.cjs.map +1 -0
  13. package/dist/chunk-CREXMFMF.cjs +155 -0
  14. package/dist/chunk-CREXMFMF.cjs.map +1 -0
  15. package/dist/chunk-CTUJSWCM.js +215 -0
  16. package/dist/chunk-CTUJSWCM.js.map +1 -0
  17. package/dist/chunk-ENYGL5CO.js +11 -0
  18. package/dist/chunk-ENYGL5CO.js.map +1 -0
  19. package/dist/chunk-ER73O65F.cjs +703 -0
  20. package/dist/chunk-ER73O65F.cjs.map +1 -0
  21. package/dist/chunk-F44NODUS.cjs +709 -0
  22. package/dist/chunk-F44NODUS.cjs.map +1 -0
  23. package/dist/chunk-GAXJTFBV.js +20 -0
  24. package/dist/chunk-GAXJTFBV.js.map +1 -0
  25. package/dist/chunk-HNZVEIKN.js +358 -0
  26. package/dist/chunk-HNZVEIKN.js.map +1 -0
  27. package/dist/chunk-KE7QPAQ4.cjs +21 -0
  28. package/dist/chunk-KE7QPAQ4.cjs.map +1 -0
  29. package/dist/chunk-KEPHL25S.js +60 -0
  30. package/dist/chunk-KEPHL25S.js.map +1 -0
  31. package/dist/chunk-KKBEMQU7.cjs +670 -0
  32. package/dist/chunk-KKBEMQU7.cjs.map +1 -0
  33. package/dist/chunk-KYJWRZ2B.js +709 -0
  34. package/dist/chunk-KYJWRZ2B.js.map +1 -0
  35. package/dist/chunk-N5VQR2PW.cjs +215 -0
  36. package/dist/chunk-N5VQR2PW.cjs.map +1 -0
  37. package/dist/chunk-OO4AMJWO.js +155 -0
  38. package/dist/chunk-OO4AMJWO.js.map +1 -0
  39. package/dist/chunk-R4QFK5TN.cjs +358 -0
  40. package/dist/chunk-R4QFK5TN.cjs.map +1 -0
  41. package/dist/chunk-RUWR74XQ.cjs +152 -0
  42. package/dist/chunk-RUWR74XQ.cjs.map +1 -0
  43. package/dist/chunk-S2A4TFLS.js +152 -0
  44. package/dist/chunk-S2A4TFLS.js.map +1 -0
  45. package/dist/chunk-SHFJ5OQA.cjs +11 -0
  46. package/dist/chunk-SHFJ5OQA.cjs.map +1 -0
  47. package/dist/chunk-TCFLEBQM.cjs +20 -0
  48. package/dist/chunk-TCFLEBQM.cjs.map +1 -0
  49. package/dist/chunk-W5ESPGHH.js +670 -0
  50. package/dist/chunk-W5ESPGHH.js.map +1 -0
  51. package/dist/chunk-X6YKUJKH.js +21 -0
  52. package/dist/chunk-X6YKUJKH.js.map +1 -0
  53. package/dist/chunk-XCFYWSLD.cjs +190 -0
  54. package/dist/chunk-XCFYWSLD.cjs.map +1 -0
  55. package/dist/chunk-ZPMTZ3KJ.js +57 -0
  56. package/dist/chunk-ZPMTZ3KJ.js.map +1 -0
  57. package/dist/config/nextjs.cjs +76 -351
  58. package/dist/config/nextjs.cjs.map +1 -1
  59. package/dist/config/nextjs.js +26 -266
  60. package/dist/config/nextjs.js.map +1 -1
  61. package/dist/config/webpack.cjs +12 -240
  62. package/dist/config/webpack.cjs.map +1 -1
  63. package/dist/config/webpack.js +6 -207
  64. package/dist/config/webpack.js.map +1 -1
  65. package/dist/host/html.cjs +139 -2447
  66. package/dist/host/html.cjs.map +1 -1
  67. package/dist/host/html.js +66 -2345
  68. package/dist/host/html.js.map +1 -1
  69. package/dist/host/nextjs/app/client-only.cjs +53 -2825
  70. package/dist/host/nextjs/app/client-only.cjs.map +1 -1
  71. package/dist/host/nextjs/app/client-only.js +31 -2780
  72. package/dist/host/nextjs/app/client-only.js.map +1 -1
  73. package/dist/host/nextjs/app.cjs +34 -2
  74. package/dist/host/nextjs/app.cjs.map +1 -1
  75. package/dist/host/nextjs/app.js +35 -3
  76. package/dist/host/nextjs/app.js.map +1 -1
  77. package/dist/host/proxy/client.cjs +8 -38
  78. package/dist/host/proxy/client.cjs.map +1 -1
  79. package/dist/host/proxy/client.js +4 -7
  80. package/dist/host/proxy/client.js.map +1 -1
  81. package/dist/host/proxy.cjs +19 -56
  82. package/dist/host/proxy.cjs.map +1 -1
  83. package/dist/host/proxy.js +8 -20
  84. package/dist/host/proxy.js.map +1 -1
  85. package/dist/host/react.cjs +17 -2756
  86. package/dist/host/react.cjs.map +1 -1
  87. package/dist/host/react.js +13 -2723
  88. package/dist/host/react.js.map +1 -1
  89. package/dist/internal/host/nextjs/app-client.cjs +38 -24
  90. package/dist/internal/host/nextjs/app-client.cjs.map +1 -1
  91. package/dist/internal/host/nextjs/app-client.js +38 -24
  92. package/dist/internal/host/nextjs/app-client.js.map +1 -1
  93. package/dist/internal/host/nextjs/remote-component-links.cjs +24 -13
  94. package/dist/internal/host/nextjs/remote-component-links.cjs.map +1 -1
  95. package/dist/internal/host/nextjs/remote-component-links.d.ts +3 -0
  96. package/dist/internal/host/nextjs/remote-component-links.js +24 -13
  97. package/dist/internal/host/nextjs/remote-component-links.js.map +1 -1
  98. package/dist/internal/host/server/fetch-remote-component.cjs +1 -18
  99. package/dist/internal/host/server/fetch-remote-component.cjs.map +1 -1
  100. package/dist/internal/host/server/fetch-remote-component.js +1 -18
  101. package/dist/internal/host/server/fetch-remote-component.js.map +1 -1
  102. package/dist/internal/host/shared/lifecycle.cjs +69 -0
  103. package/dist/internal/host/shared/lifecycle.cjs.map +1 -0
  104. package/dist/internal/host/shared/lifecycle.d.ts +34 -0
  105. package/dist/internal/host/shared/lifecycle.js +44 -0
  106. package/dist/internal/host/shared/lifecycle.js.map +1 -0
  107. package/dist/internal/host/shared/pipeline.cjs +222 -0
  108. package/dist/internal/host/shared/pipeline.cjs.map +1 -0
  109. package/dist/internal/host/shared/pipeline.d.ts +153 -0
  110. package/dist/internal/host/shared/pipeline.js +200 -0
  111. package/dist/internal/host/shared/pipeline.js.map +1 -0
  112. package/dist/internal/runtime/loaders/component-loader.cjs +5 -2
  113. package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -1
  114. package/dist/internal/runtime/loaders/component-loader.js +5 -2
  115. package/dist/internal/runtime/loaders/component-loader.js.map +1 -1
  116. package/dist/internal/runtime/turbopack/patterns.cjs +1 -1
  117. package/dist/internal/runtime/turbopack/patterns.cjs.map +1 -1
  118. package/dist/internal/runtime/turbopack/patterns.js +1 -1
  119. package/dist/internal/runtime/turbopack/patterns.js.map +1 -1
  120. package/dist/internal/runtime/turbopack/remote-scope-setup.cjs.map +1 -1
  121. package/dist/internal/runtime/turbopack/remote-scope-setup.js.map +1 -1
  122. package/dist/internal/runtime/turbopack/remote-scope.cjs +1 -5
  123. package/dist/internal/runtime/turbopack/remote-scope.cjs.map +1 -1
  124. package/dist/internal/runtime/turbopack/remote-scope.js +1 -5
  125. package/dist/internal/runtime/turbopack/remote-scope.js.map +1 -1
  126. package/dist/internal/utils.cjs +1 -1
  127. package/dist/internal/utils.cjs.map +1 -1
  128. package/dist/internal/utils.d.ts +5 -5
  129. package/dist/internal/utils.js +1 -1
  130. package/dist/internal/utils.js.map +1 -1
  131. package/dist/remote/html.cjs +15 -314
  132. package/dist/remote/html.cjs.map +1 -1
  133. package/dist/remote/html.js +7 -305
  134. package/dist/remote/html.js.map +1 -1
  135. package/dist/remote/middleware.cjs +16 -41
  136. package/dist/remote/middleware.cjs.map +1 -1
  137. package/dist/script-6W5JRBZK.cjs +26 -0
  138. package/dist/script-6W5JRBZK.cjs.map +1 -0
  139. package/dist/script-IFEBOLIA.js +26 -0
  140. package/dist/script-IFEBOLIA.js.map +1 -0
  141. package/dist/static-loader-X4TSF5KW.js +11 -0
  142. package/dist/static-loader-X4TSF5KW.js.map +1 -0
  143. package/dist/static-loader-ZYD5BO4D.cjs +11 -0
  144. package/dist/static-loader-ZYD5BO4D.cjs.map +1 -0
  145. package/dist/turbopack-NPGO3MWS.js +55 -0
  146. package/dist/turbopack-NPGO3MWS.js.map +1 -0
  147. package/dist/turbopack-WRMKPNN4.cjs +55 -0
  148. package/dist/turbopack-WRMKPNN4.cjs.map +1 -0
  149. package/dist/webpack-DUBHPYD6.js +92 -0
  150. package/dist/webpack-DUBHPYD6.js.map +1 -0
  151. package/dist/webpack-KSCMCL7M.cjs +92 -0
  152. package/dist/webpack-KSCMCL7M.cjs.map +1 -0
  153. package/package.json +10 -3
@@ -1,98 +1,34 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
29
2
 
30
- // src/config/nextjs/index.ts
31
- var nextjs_exports = {};
32
- __export(nextjs_exports, {
33
- withRemoteComponentsConfig: () => withRemoteComponentsConfig
34
- });
35
- module.exports = __toCommonJS(nextjs_exports);
36
- var import_node_fs2 = require("fs");
37
- var import_node_path3 = require("path");
38
- var import_enhanced_resolve = __toESM(require("enhanced-resolve"), 1);
39
- var import_find_up2 = require("find-up");
40
- var import_config_schema = require("next/dist/server/config-schema.js");
41
- var import_tsconfig_paths_webpack_plugin = __toESM(require("tsconfig-paths-webpack-plugin"), 1);
42
3
 
43
- // src/utils/error.ts
44
- var RemoteComponentsError = class extends Error {
45
- code = "REMOTE_COMPONENTS_ERROR";
46
- constructor(message, options) {
47
- super(message, options);
48
- this.name = "RemoteComponentsError";
49
- }
50
- };
4
+ var _chunkR4QFK5TNcjs = require('../chunk-R4QFK5TN.cjs');
5
+ require('../chunk-7MVFHOIP.cjs');
51
6
 
52
- // src/utils/logger.ts
53
- var PREFIX = "remote-components";
54
- var DEBUG = typeof window !== "undefined" && localStorage.getItem("RC_DEBUG") === "true" || typeof process !== "undefined" && process.env.RC_DEBUG === "true";
55
- function logDebug(location2, message) {
56
- if (DEBUG) {
57
- console.debug(`[${PREFIX}:${location2}]: ${message}`);
58
- }
59
- }
60
- function logWarn(location2, message) {
61
- console.warn(`[${PREFIX}:${location2}]: ${message}`);
62
- }
63
- function logError(location2, message, cause) {
64
- console.error(
65
- new RemoteComponentsError(`[${PREFIX}:${location2}]: ${message}`, {
66
- cause
67
- })
68
- );
69
- }
70
7
 
71
- // src/host/shared/polyfill.tsx
72
- var import_jsx_runtime = require("react/jsx-runtime");
73
8
 
74
- // src/host/shared/shared-module-resolver.ts
75
- var CORE_REACT_SHARED_KEYS = [
76
- "react",
77
- "react/jsx-dev-runtime",
78
- "react/jsx-runtime",
79
- "react-dom",
80
- "react-dom/client"
81
- ];
82
- var CORE_REACT_PATH_MAP = {
83
- react: "/react/index.js",
84
- "react/jsx-dev-runtime": "/react/jsx-dev-runtime.js",
85
- "react/jsx-runtime": "/react/jsx-runtime.js",
86
- "react-dom": "/react-dom/index.js",
87
- "react-dom/client": "/react-dom/client.js"
88
- };
89
- var VENDOR_SHARED = Object.fromEntries(
90
- Object.entries(CORE_REACT_PATH_MAP).filter(([key]) => key !== "react-dom/client").map(([key, path]) => [key, `'${path}'`])
91
- );
9
+
10
+
11
+ var _chunkRUWR74XQcjs = require('../chunk-RUWR74XQ.cjs');
12
+
13
+
14
+
15
+
16
+
17
+ var _chunkN5VQR2PWcjs = require('../chunk-N5VQR2PW.cjs');
18
+ require('../chunk-KE7QPAQ4.cjs');
19
+ require('../chunk-SHFJ5OQA.cjs');
20
+
21
+ // src/config/nextjs/index.ts
22
+ var _fs = require('fs');
23
+ var _path = require('path');
24
+ var _enhancedresolve = require('enhanced-resolve'); var _enhancedresolve2 = _interopRequireDefault(_enhancedresolve);
25
+ var _findup = require('find-up');
26
+ var _configschemajs = require('next/dist/server/config-schema.js');
27
+ var _tsconfigpathswebpackplugin = require('tsconfig-paths-webpack-plugin'); var _tsconfigpathswebpackplugin2 = _interopRequireDefault(_tsconfigpathswebpackplugin);
92
28
 
93
29
  // src/utils/project-id.ts
94
- var import_node_fs = require("fs");
95
- var import_find_up = require("find-up");
30
+
31
+
96
32
 
97
33
  // src/utils/project-id-env.ts
98
34
  function resolveProjectIdFromEnv() {
@@ -105,229 +41,19 @@ function resolveProjectId(packageName) {
105
41
  if (fromEnv)
106
42
  return fromEnv;
107
43
  try {
108
- const projectPath = (0, import_find_up.findUpSync)(".vercel/project.json", {
44
+ const projectPath = _findup.findUpSync.call(void 0, ".vercel/project.json", {
109
45
  cwd: process.cwd()
110
46
  });
111
47
  if (projectPath) {
112
- return JSON.parse((0, import_node_fs.readFileSync)(projectPath, "utf8")).projectId;
48
+ return JSON.parse(_fs.readFileSync.call(void 0, projectPath, "utf8")).projectId;
113
49
  }
114
- } catch {
50
+ } catch (e) {
115
51
  }
116
52
  return packageName;
117
53
  }
118
54
 
119
55
  // src/config/webpack/nextjs.ts
120
- var import_node_path2 = require("path");
121
-
122
- // src/config/webpack/plugins/conditional-exec.ts
123
- var ConditionalExecPlugin = class {
124
- appName;
125
- constructor(appName) {
126
- this.appName = appName;
127
- }
128
- apply(compiler) {
129
- const { Compilation, sources } = compiler.webpack;
130
- compiler.hooks.thisCompilation.tap(
131
- "ConditionalExecPlugin",
132
- (compilation) => {
133
- compilation.hooks.processAssets.tap(
134
- {
135
- name: "ConditionalExecPlugin",
136
- stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
137
- },
138
- (assets) => {
139
- for (const [name, source] of Object.entries(assets)) {
140
- if (name.endsWith(".js")) {
141
- const patchedSource = source.source().toString().replace(
142
- `var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))`,
143
- `var __webpack_exec__ = (moduleId) => { if (globalThis.__DISABLE_WEBPACK_EXEC__ && globalThis.__DISABLE_WEBPACK_EXEC__["${this.appName}"]) return; return __webpack_require__(__webpack_require__.s = moduleId); }`
144
- );
145
- compilation.updateAsset(
146
- name,
147
- new sources.RawSource(patchedSource)
148
- );
149
- }
150
- }
151
- }
152
- );
153
- }
154
- );
155
- }
156
- };
157
-
158
- // src/config/webpack/plugins/module-id-embed.ts
159
- var import_node_path = require("path");
160
-
161
- // src/config/webpack/plugins/module-id-embed-runtime-module.ts
162
- function createModuleIdEmbedRuntimeModule(webpack) {
163
- return class ModuleIdEmbedRuntimeModule extends webpack.RuntimeModule {
164
- appName;
165
- moduleMap;
166
- constructor(appName, moduleMap) {
167
- super("remote-webpack-module-id-embed");
168
- this.appName = appName;
169
- this.moduleMap = moduleMap;
170
- }
171
- generate() {
172
- return `globalThis.__remote_webpack_module_map__ = globalThis.__remote_webpack_module_map__ || {}; globalThis.__remote_webpack_module_map__["${this.appName}"] = ${JSON.stringify(this.moduleMap)};`;
173
- }
174
- };
175
- }
176
56
 
177
- // src/config/webpack/plugins/module-id-embed.ts
178
- var cwd = process.cwd();
179
- var ModuleIdEmbedPlugin = class {
180
- appName;
181
- includeAllModules;
182
- isServer;
183
- constructor(appName, options) {
184
- this.appName = appName;
185
- this.includeAllModules = options?.includeAllModules ?? false;
186
- this.isServer = options?.isServer ?? false;
187
- }
188
- apply(compiler) {
189
- const ModuleIdEmbedRuntimeModule = createModuleIdEmbedRuntimeModule(
190
- compiler.webpack
191
- );
192
- compiler.hooks.thisCompilation.tap("ModuleIdEmbedPlugin", (compilation) => {
193
- const moduleMap = {};
194
- compilation.hooks.runtimeRequirementInTree.for(compiler.webpack.RuntimeGlobals.require).tap("ModuleIdEmbedPlugin", (chunk, set) => {
195
- for (const mod of compilation.modules) {
196
- const id = compilation.chunkGraph.getModuleId(mod);
197
- if (id && (this.includeAllModules || mod.layer?.endsWith("browser") || !this.isServer && mod.layer === null)) {
198
- const normalModule = mod;
199
- if (normalModule.resource || normalModule.request) {
200
- moduleMap[(0, import_node_path.relative)(cwd, normalModule.resource || normalModule.request)] = id;
201
- }
202
- }
203
- }
204
- if (Object.keys(moduleMap).length > 0) {
205
- compilation.addRuntimeModule(
206
- chunk,
207
- new ModuleIdEmbedRuntimeModule(
208
- this.appName,
209
- moduleMap
210
- )
211
- );
212
- set.add(compiler.webpack.RuntimeGlobals.require);
213
- }
214
- });
215
- });
216
- }
217
- };
218
-
219
- // src/config/webpack/plugins/patch-require.ts
220
- var PatchRequirePlugin = class {
221
- appName;
222
- constructor(appName) {
223
- this.appName = appName;
224
- }
225
- apply(compiler) {
226
- const { sources } = compiler.webpack;
227
- compiler.hooks.thisCompilation.tap("PatchRequirePlugin", (compilation) => {
228
- compilation.mainTemplate.hooks.requireExtensions.tap(
229
- "PatchRequirePlugin",
230
- (source) => {
231
- return new sources.ConcatSource(
232
- source,
233
- `const __webpack_require_orig__ = __webpack_require__;
234
- const REMOTE_RE = /\\[(?<bundle>[^\\]]+)\\] (?<id>.*)/;
235
- __webpack_require__ = function __remote_webpack_require__(remoteId) {
236
- const match = REMOTE_RE.exec(remoteId);
237
- const bundle = match?.groups?.bundle;
238
- const id = match?.groups?.id;
239
- if (!(id && bundle)) {
240
- return __webpack_require_orig__(remoteId);
241
- }
242
- if (typeof self.__remote_webpack_require__?.[bundle] !== 'function') {
243
- const error = new Error(\`Remote Components are not available in "\${bundle}". Did you forget to wrap the Next.js config with \\\`withRemoteComponentsConfig\\\` on both host and remote?\`);
244
- error.name = 'RemoteComponentsError';
245
- error.code = 'REMOTE_COMPONENTS_ERROR';
246
- throw error;
247
- }
248
- return self.__remote_webpack_require__[bundle](self.__remote_webpack_require__[bundle].type === 'turbopack' ? remoteId : id);
249
- };
250
- Object.assign(__webpack_require__, __webpack_require_orig__);
251
- const __webpack_require_l__ = __webpack_require__.l;
252
- __webpack_require__.l = function __remote_webpack_require_l__(url, done, key, chunkId) {
253
- const match = REMOTE_RE.exec(chunkId);
254
- const bundle = match?.groups?.bundle;
255
- const id = match?.groups?.id;
256
- if (!(id && bundle)) {
257
- // __remote_bundle_url__[appName] is the *host app's own* asset base URL
258
- // (set by the HTML host or setupWebpackRuntime). It is NOT a remote
259
- // bundle URL \u2014 it just ensures the host's own chunks resolve correctly
260
- // when the page is served from a CDN or different origin.
261
- return __webpack_require_l__(new URL(url, globalThis.__remote_bundle_url__?.["${this.appName}"] ?? location.origin).href, done, key, chunkId);
262
- }
263
- return done();
264
- };
265
- const __webpack_require_o__ = __webpack_require__.o;
266
- __webpack_require__.o = function __remote_webpack_require_o__(installedChunks, chunkId) {
267
- const match = REMOTE_RE.exec(chunkId);
268
- const bundle = match?.groups?.bundle;
269
- const id = match?.groups?.id;
270
- if (!(id && bundle)) {
271
- return __webpack_require_o__(installedChunks, chunkId);
272
- }
273
- return installedChunks[chunkId] = 0;
274
- };
275
- const __webpack_require_e__ = __webpack_require__.e;
276
- __webpack_require__.e = function __remote_webpack_require_e__(chunkId) {
277
- const match = REMOTE_RE.exec(chunkId);
278
- const bundle = match?.groups?.bundle;
279
- const id = match?.groups?.id;
280
- if (!(id && bundle)) {
281
- return __webpack_require_e__(chunkId);
282
- }
283
- return Promise.resolve([]);
284
- };`
285
- ).source().toString();
286
- }
287
- );
288
- });
289
- }
290
- };
291
-
292
- // src/config/webpack/plugins/remote-webpack-require-runtime-module.ts
293
- function createRemoteWebpackRequireRuntimeModule(webpack) {
294
- return class RemoteWebpackRequireRuntimeModule extends webpack.RuntimeModule {
295
- appName;
296
- constructor(appName) {
297
- super("remote-webpack-require");
298
- this.appName = appName;
299
- }
300
- generate() {
301
- return `globalThis.__remote_webpack_require__ = globalThis.__remote_webpack_require__ || {}; globalThis.__remote_webpack_require__["${this.appName}"] = __webpack_require__;`;
302
- }
303
- };
304
- }
305
-
306
- // src/config/webpack/plugins/remote-webpack-require.ts
307
- var RemoteWebpackRequirePlugin = class {
308
- appName;
309
- constructor(appName) {
310
- this.appName = appName;
311
- }
312
- apply(compiler) {
313
- const RemoteWebpackRequireRuntimeModule = createRemoteWebpackRequireRuntimeModule(compiler.webpack);
314
- compiler.hooks.thisCompilation.tap(
315
- "RemoteWebpackRequirePlugin",
316
- (compilation) => {
317
- compilation.hooks.runtimeRequirementInTree.for("__webpack_require__").tap("RemoteWebpackRequirePlugin", (chunk) => {
318
- compilation.addRuntimeModule(
319
- chunk,
320
- new RemoteWebpackRequireRuntimeModule(
321
- this.appName
322
- )
323
- );
324
- });
325
- }
326
- );
327
- }
328
- };
329
-
330
- // src/config/webpack/nextjs.ts
331
57
  function transform(nextConfig, {
332
58
  app,
333
59
  alias = {},
@@ -336,12 +62,12 @@ function transform(nextConfig, {
336
62
  }) {
337
63
  const webpackConfig = nextConfig.webpack;
338
64
  nextConfig.webpack = (baseConfig, webpackContext) => {
339
- const config = typeof webpackConfig === "function" ? webpackConfig(baseConfig, webpackContext) ?? baseConfig : baseConfig;
65
+ const config = typeof webpackConfig === "function" ? _nullishCoalesce(webpackConfig(baseConfig, webpackContext), () => ( baseConfig)) : baseConfig;
340
66
  config.plugins.push(
341
- new RemoteWebpackRequirePlugin(app.name),
342
- new ModuleIdEmbedPlugin(app.name, { isServer: webpackContext.isServer }),
343
- new ConditionalExecPlugin(app.name),
344
- new PatchRequirePlugin(app.name)
67
+ new (0, _chunkN5VQR2PWcjs.RemoteWebpackRequirePlugin)(app.name),
68
+ new (0, _chunkN5VQR2PWcjs.ModuleIdEmbedPlugin)(app.name, { isServer: webpackContext.isServer }),
69
+ new (0, _chunkN5VQR2PWcjs.ConditionalExecPlugin)(app.name),
70
+ new (0, _chunkN5VQR2PWcjs.PatchRequirePlugin)(app.name)
345
71
  );
346
72
  if (!webpackContext.isServer) {
347
73
  config.output.chunkLoadingGlobal = `__remote_chunk_loading_global_${app.name}__`;
@@ -353,7 +79,7 @@ function transform(nextConfig, {
353
79
  ...Object.fromEntries(
354
80
  Object.entries(alias).map(([key, value]) => [
355
81
  key,
356
- (0, import_node_path2.join)(process.cwd(), value)
82
+ _path.join.call(void 0, process.cwd(), value)
357
83
  ])
358
84
  )
359
85
  }
@@ -367,56 +93,56 @@ function transform(nextConfig, {
367
93
  // src/config/nextjs/index.ts
368
94
  function getNextMajorVersion() {
369
95
  try {
370
- const nextPkgPath = (0, import_find_up2.findUpSync)("node_modules/next/package.json", {
96
+ const nextPkgPath = _findup.findUpSync.call(void 0, "node_modules/next/package.json", {
371
97
  cwd: process.cwd()
372
98
  });
373
99
  if (!nextPkgPath)
374
100
  return void 0;
375
- const { version } = JSON.parse((0, import_node_fs2.readFileSync)(nextPkgPath, "utf8"));
101
+ const { version } = JSON.parse(_fs.readFileSync.call(void 0, nextPkgPath, "utf8"));
376
102
  const major = version.split(".")[0];
377
103
  return major ? Number.parseInt(major, 10) : void 0;
378
- } catch {
104
+ } catch (e2) {
379
105
  return void 0;
380
106
  }
381
107
  }
382
108
  function hasPagesDirectory() {
383
- return (0, import_node_fs2.existsSync)((0, import_node_path3.join)(process.cwd(), "pages")) || (0, import_node_fs2.existsSync)((0, import_node_path3.join)(process.cwd(), "src/pages"));
109
+ return _fs.existsSync.call(void 0, _path.join.call(void 0, process.cwd(), "pages")) || _fs.existsSync.call(void 0, _path.join.call(void 0, process.cwd(), "src/pages"));
384
110
  }
385
111
  function readProjectPackageJson() {
386
- const defaults = { name: (0, import_node_path3.basename)(process.cwd()), type: "module" };
112
+ const defaults = { name: _path.basename.call(void 0, process.cwd()), type: "module" };
387
113
  try {
388
- const packageJsonPath = (0, import_find_up2.findUpSync)("package.json", {
114
+ const packageJsonPath = _findup.findUpSync.call(void 0, "package.json", {
389
115
  cwd: process.cwd()
390
116
  });
391
117
  if (packageJsonPath) {
392
118
  return {
393
119
  ...defaults,
394
- ...JSON.parse((0, import_node_fs2.readFileSync)(packageJsonPath, "utf8"))
120
+ ...JSON.parse(_fs.readFileSync.call(void 0, packageJsonPath, "utf8"))
395
121
  };
396
122
  }
397
- } catch {
123
+ } catch (e3) {
398
124
  }
399
125
  return defaults;
400
126
  }
401
127
  function withRemoteComponentsConfig(nextConfig, options) {
402
- const virtualRemoteComponentAppSharedRemote = (0, import_node_path3.join)(
128
+ const virtualRemoteComponentAppSharedRemote = _path.join.call(void 0,
403
129
  process.cwd(),
404
130
  ".remote-components/shared/app-remote.tsx"
405
131
  );
406
- const virtualRemoteComponentPagesSharedRemote = (0, import_node_path3.join)(
132
+ const virtualRemoteComponentPagesSharedRemote = _path.join.call(void 0,
407
133
  process.cwd(),
408
134
  ".remote-components/shared/pages-remote.tsx"
409
135
  );
410
- const virtualRemoteComponentAppSharedHost = (0, import_node_path3.join)(
136
+ const virtualRemoteComponentAppSharedHost = _path.join.call(void 0,
411
137
  process.cwd(),
412
138
  ".remote-components/shared/app-host.tsx"
413
139
  );
414
- const virtualRemoteComponentPagesSharedHost = (0, import_node_path3.join)(
140
+ const virtualRemoteComponentPagesSharedHost = _path.join.call(void 0,
415
141
  process.cwd(),
416
142
  ".remote-components/shared/pages-host.tsx"
417
143
  );
418
144
  const appShared = /* @__PURE__ */ new Set([
419
- ...CORE_REACT_SHARED_KEYS,
145
+ ..._chunkR4QFK5TNcjs.CORE_REACT_SHARED_KEYS,
420
146
  "next/navigation",
421
147
  "next/dist/client/components/navigation",
422
148
  "next/link",
@@ -427,25 +153,25 @@ function withRemoteComponentsConfig(nextConfig, options) {
427
153
  "next/script",
428
154
  "next/dist/client/script",
429
155
  "next/dist/build/polyfills/process",
430
- ...options?.shared ?? []
156
+ ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _ => _.shared]), () => ( []))
431
157
  ]);
432
158
  const pagesShared = /* @__PURE__ */ new Set([
433
- ...CORE_REACT_SHARED_KEYS,
159
+ ..._chunkR4QFK5TNcjs.CORE_REACT_SHARED_KEYS,
434
160
  "next/router",
435
161
  "next/link",
436
162
  "next/dist/shared/lib/image-loader",
437
163
  "next/script",
438
164
  "next/form",
439
- ...options?.shared ?? []
165
+ ..._nullishCoalesce(_optionalChain([options, 'optionalAccess', _2 => _2.shared]), () => ( []))
440
166
  ]);
441
- const vendorShared = { ...VENDOR_SHARED };
442
- const resolve = import_enhanced_resolve.default.create.sync({
167
+ const vendorShared = { ..._chunkR4QFK5TNcjs.VENDOR_SHARED };
168
+ const resolve = _enhancedresolve2.default.create.sync({
443
169
  conditionNames: ["browser", "import", "module", "require"],
444
- ...(0, import_node_fs2.existsSync)((0, import_node_path3.join)(process.cwd(), "tsconfig.json")) ? {
170
+ ..._fs.existsSync.call(void 0, _path.join.call(void 0, process.cwd(), "tsconfig.json")) ? {
445
171
  extensions: [".js", ".jsx", ".ts", ".tsx"],
446
172
  plugins: [
447
- new import_tsconfig_paths_webpack_plugin.default({
448
- configFile: (0, import_node_path3.join)(process.cwd(), "tsconfig.json")
173
+ new (0, _tsconfigpathswebpackplugin2.default)({
174
+ configFile: _path.join.call(void 0, process.cwd(), "tsconfig.json")
449
175
  })
450
176
  ]
451
177
  } : {}
@@ -457,19 +183,19 @@ function withRemoteComponentsConfig(nextConfig, options) {
457
183
  try {
458
184
  const resolved = resolve(process.cwd(), moduleName);
459
185
  if (resolved) {
460
- return (0, import_node_path3.relative)(process.cwd(), resolved).replace(
186
+ return _path.relative.call(void 0, process.cwd(), resolved).replace(
461
187
  /^(?<relative>\.\.\/)+/,
462
188
  ""
463
189
  );
464
190
  }
465
- } catch {
191
+ } catch (e4) {
466
192
  }
467
193
  };
468
194
  const generateSharedRemote = (sharedRemote) => `'use client';
469
195
  ${exportPre}${Array.from(sharedRemote).reduce((acc, curr) => {
470
196
  const path = resolveSharedPath(curr);
471
197
  acc.push(
472
- `[${vendorShared[curr] ?? (path ? `'${path}'` : `require.resolve('${curr}')`)}]: '${curr}',`
198
+ `[${_nullishCoalesce(vendorShared[curr], () => ( (path ? `'${path}'` : `require.resolve('${curr}')`)))}]: '${curr}',`
473
199
  );
474
200
  acc.push(
475
201
  `['__remote_shared_module_${curr}']: () => import('${curr}'),`
@@ -486,28 +212,28 @@ ${exportPre}${Array.from(sharedHost).reduce((acc, curr) => {
486
212
  const appSharedHost = generateSharedHost(appShared);
487
213
  const pagesSharedHost = generateSharedHost(pagesShared);
488
214
  const emitSharedFiles = () => {
489
- (0, import_node_fs2.mkdirSync)((0, import_node_path3.dirname)(virtualRemoteComponentAppSharedRemote), {
215
+ _fs.mkdirSync.call(void 0, _path.dirname.call(void 0, virtualRemoteComponentAppSharedRemote), {
490
216
  recursive: true
491
217
  });
492
- (0, import_node_fs2.writeFileSync)(
218
+ _fs.writeFileSync.call(void 0,
493
219
  virtualRemoteComponentAppSharedRemote,
494
220
  appSharedRemote,
495
221
  "utf-8"
496
222
  );
497
- (0, import_node_fs2.writeFileSync)(
223
+ _fs.writeFileSync.call(void 0,
498
224
  virtualRemoteComponentPagesSharedRemote,
499
225
  pagesSharedRemote,
500
226
  "utf-8"
501
227
  );
502
- (0, import_node_fs2.writeFileSync)(virtualRemoteComponentAppSharedHost, appSharedHost, "utf-8");
503
- (0, import_node_fs2.writeFileSync)(
228
+ _fs.writeFileSync.call(void 0, virtualRemoteComponentAppSharedHost, appSharedHost, "utf-8");
229
+ _fs.writeFileSync.call(void 0,
504
230
  virtualRemoteComponentPagesSharedHost,
505
231
  pagesSharedHost,
506
232
  "utf-8"
507
233
  );
508
234
  };
509
235
  nextConfig.transpilePackages = [
510
- ...nextConfig.transpilePackages ?? [],
236
+ ..._nullishCoalesce(nextConfig.transpilePackages, () => ( [])),
511
237
  "remote-components"
512
238
  ];
513
239
  nextConfig.env = {
@@ -515,19 +241,19 @@ ${exportPre}${Array.from(sharedHost).reduce((acc, curr) => {
515
241
  REMOTE_COMPONENTS_CONFIGURED: "1"
516
242
  };
517
243
  const alias = {
518
- "#remote-components/remote/defaults/app": `./${(0, import_node_path3.relative)(
244
+ "#remote-components/remote/defaults/app": `./${_path.relative.call(void 0,
519
245
  process.cwd(),
520
246
  virtualRemoteComponentAppSharedRemote
521
247
  )}`,
522
- "#remote-components/remote/defaults/pages": `./${(0, import_node_path3.relative)(
248
+ "#remote-components/remote/defaults/pages": `./${_path.relative.call(void 0,
523
249
  process.cwd(),
524
250
  virtualRemoteComponentPagesSharedRemote
525
251
  )}`,
526
- "#remote-components/host/defaults/app": `./${(0, import_node_path3.relative)(
252
+ "#remote-components/host/defaults/app": `./${_path.relative.call(void 0,
527
253
  process.cwd(),
528
254
  virtualRemoteComponentAppSharedHost
529
255
  )}`,
530
- "#remote-components/host/defaults/pages": `./${(0, import_node_path3.relative)(
256
+ "#remote-components/host/defaults/pages": `./${_path.relative.call(void 0,
531
257
  process.cwd(),
532
258
  virtualRemoteComponentPagesSharedHost
533
259
  )}`
@@ -536,13 +262,13 @@ ${exportPre}${Array.from(sharedHost).reduce((acc, curr) => {
536
262
  process.env.REMOTE_COMPONENTS_PROJECT_ID = projectId;
537
263
  if (hasPagesDirectory()) {
538
264
  if (process.env.TURBOPACK) {
539
- throw new RemoteComponentsError(
265
+ throw new (0, _chunkRUWR74XQcjs.RemoteComponentsError)(
540
266
  "Remote Components does not support Next.js Pages Router with Turbopack. Use webpack instead (`next dev` / `next build` without `--turbo`)."
541
267
  );
542
268
  }
543
269
  const nextMajor = getNextMajorVersion();
544
270
  if (nextMajor !== void 0 && nextMajor < 16) {
545
- const log = process.env.NODE_ENV !== "production" || process.env.VERCEL_ENV === "preview" ? logWarn : logDebug;
271
+ const log = process.env.NODE_ENV !== "production" || process.env.VERCEL_ENV === "preview" ? _chunkRUWR74XQcjs.logWarn : _chunkRUWR74XQcjs.logDebug;
546
272
  log(
547
273
  "Config",
548
274
  `Remote Components does not support Pages Router hosts on Next.js ${nextMajor}. Pages Router remotes are unaffected. Upgrade to Next.js 16+ for host support.`
@@ -550,7 +276,7 @@ ${exportPre}${Array.from(sharedHost).reduce((acc, curr) => {
550
276
  }
551
277
  }
552
278
  if (process.env.TURBOPACK) {
553
- if (!import_config_schema.configSchema.safeParse({
279
+ if (!_configschemajs.configSchema.safeParse({
554
280
  turbopack: {
555
281
  resolveAlias: {
556
282
  ...alias
@@ -562,7 +288,7 @@ ${exportPre}${Array.from(sharedHost).reduce((acc, curr) => {
562
288
  }
563
289
  }
564
290
  }).success) {
565
- logError(
291
+ _chunkRUWR74XQcjs.logError.call(void 0,
566
292
  "Config",
567
293
  "Turbopack support requires a Next.js version that includes `compiler.defineServer`. Upgrade Next.js to continue using Remote Components with Turbopack."
568
294
  );
@@ -571,14 +297,14 @@ ${exportPre}${Array.from(sharedHost).reduce((acc, curr) => {
571
297
  nextConfig.turbopack = {
572
298
  ...nextConfig.turbopack,
573
299
  resolveAlias: {
574
- ...nextConfig.turbopack?.resolveAlias,
300
+ ..._optionalChain([nextConfig, 'access', _3 => _3.turbopack, 'optionalAccess', _4 => _4.resolveAlias]),
575
301
  ...alias
576
302
  }
577
303
  };
578
304
  nextConfig.compiler = {
579
305
  ...nextConfig.compiler,
580
306
  defineServer: {
581
- ...nextConfig.compiler?.defineServer,
307
+ ..._optionalChain([nextConfig, 'access', _5 => _5.compiler, 'optionalAccess', _6 => _6.defineServer]),
582
308
  "process.env.REMOTE_COMPONENTS_PROJECT_ID": projectId
583
309
  }
584
310
  };
@@ -591,8 +317,7 @@ ${exportPre}${Array.from(sharedHost).reduce((acc, curr) => {
591
317
  emitSharedFiles
592
318
  });
593
319
  }
594
- // Annotate the CommonJS export names for ESM import in node:
595
- 0 && (module.exports = {
596
- withRemoteComponentsConfig
597
- });
320
+
321
+
322
+ exports.withRemoteComponentsConfig = withRemoteComponentsConfig;
598
323
  //# sourceMappingURL=nextjs.cjs.map