@module-federation/rsbuild-plugin 0.24.1 → 2.0.1

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.
@@ -0,0 +1,360 @@
1
+ import { parseOptions } from "@module-federation/enhanced";
2
+ import { ModuleFederationPlugin, PLUGIN_NAME, TreeShakingSharedPlugin } from "@module-federation/enhanced/rspack";
3
+ import { createModuleFederationConfig, getManifestFileName, isRequiredVersion } from "@module-federation/sdk";
4
+ import package_0 from "../../package.json";
5
+ import logger from "../logger.mjs";
6
+ import { SSR_DIR, SSR_ENV_NAME, addDataFetchExposes, autoDeleteSplitChunkCacheGroups, createSSRMFConfig, createSSRREnvConfig, isRegExp, patchSSRRspackConfig, setSSREnv, updateStatsAndManifest } from "../utils.mjs";
7
+ import { CALL_NAME_MAP, RSPRESS_BUNDLER_CONFIG_NAME, RSPRESS_SSG_MD_ENV_NAME, RSPRESS_SSR_DIR } from "../constant.mjs";
8
+ import { ENV_NAME, patchNodeConfig, patchNodeMFConfig, patchToolsTspack } from "../utils/ssr.mjs";
9
+
10
+ ;// CONCATENATED MODULE: external "@module-federation/enhanced"
11
+
12
+ ;// CONCATENATED MODULE: external "@module-federation/enhanced/rspack"
13
+
14
+ ;// CONCATENATED MODULE: external "@module-federation/sdk"
15
+
16
+ ;// CONCATENATED MODULE: external "../../package.json"
17
+
18
+ ;// CONCATENATED MODULE: external "../logger.mjs"
19
+
20
+ ;// CONCATENATED MODULE: external "../utils.mjs"
21
+
22
+ ;// CONCATENATED MODULE: external "../constant.mjs"
23
+
24
+ ;// CONCATENATED MODULE: external "../utils/ssr.mjs"
25
+
26
+ ;// CONCATENATED MODULE: ./src/cli/index.ts
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+ const RSBUILD_PLUGIN_MODULE_FEDERATION_NAME = 'rsbuild:module-federation-enhanced';
36
+ const RSBUILD_PLUGIN_NAME = '@module-federation/rsbuild-plugin';
37
+
38
+ const LIB_FORMAT = [
39
+ 'umd',
40
+ 'modern-module'
41
+ ];
42
+ const DEFAULT_MF_ENVIRONMENT_NAME = 'mf';
43
+ function isStoryBook(rsbuildConfig) {
44
+ var _rsbuildConfig_plugins;
45
+ if ((_rsbuildConfig_plugins = rsbuildConfig.plugins) === null || _rsbuildConfig_plugins === void 0 ? void 0 : _rsbuildConfig_plugins.find((p)=>p && 'name' in p && p.name === 'module-federation-storybook-plugin')) {
46
+ return true;
47
+ }
48
+ return false;
49
+ }
50
+ function isMFFormat(bundlerConfig) {
51
+ var _bundlerConfig_output;
52
+ const library = (_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.library;
53
+ if (bundlerConfig.name === SSR_ENV_NAME) {
54
+ return true;
55
+ }
56
+ return !(typeof library === 'object' && !Array.isArray(library) && 'type' in library && // if the type is umd/modern-module or commonjs*, means this is a normal library , not mf
57
+ (LIB_FORMAT.includes(library.type) || /commonjs/.test(library.type)));
58
+ }
59
+ const isSSRConfig = (bundlerConfigName)=>Boolean(bundlerConfigName === SSR_ENV_NAME);
60
+ const isRspressSSGConfig = (bundlerConfigName)=>{
61
+ return [
62
+ RSPRESS_BUNDLER_CONFIG_NAME,
63
+ RSPRESS_SSG_MD_ENV_NAME
64
+ ].includes(bundlerConfigName || '');
65
+ };
66
+ const pluginModuleFederation = (moduleFederationOptions, rsbuildOptions)=>({
67
+ name: RSBUILD_PLUGIN_MODULE_FEDERATION_NAME,
68
+ setup: (api)=>{
69
+ const { target = 'web', ssr = undefined, ssrDir = SSR_DIR, environment = DEFAULT_MF_ENVIRONMENT_NAME } = rsbuildOptions || {};
70
+ if (ssr) {
71
+ throw new Error("The `ssr` option is deprecated. If you want to enable SSR, please use `target: 'dual'` instead.");
72
+ }
73
+ const { callerName } = api.context;
74
+ const originalRsbuildConfig = api.getRsbuildConfig();
75
+ if (!callerName) {
76
+ throw new Error('`callerName` is undefined. Please ensure the @rsbuild/core version is higher than 1.3.21 .');
77
+ }
78
+ const isRslib = callerName === CALL_NAME_MAP.RSLIB;
79
+ const isRspress = callerName === CALL_NAME_MAP.RSPRESS;
80
+ const isSSR = target === 'dual';
81
+ if (isSSR && !isStoryBook(originalRsbuildConfig)) {
82
+ var _rsbuildConfig_environments;
83
+ if (!isRslib && !isRspress) {
84
+ throw new Error(`'target' option is only supported in Rslib.`);
85
+ }
86
+ const rsbuildConfig = api.getRsbuildConfig();
87
+ if (!isRspress && (!((_rsbuildConfig_environments = rsbuildConfig.environments) === null || _rsbuildConfig_environments === void 0 ? void 0 : _rsbuildConfig_environments[environment]) || Object.keys(rsbuildConfig.environments).some((key)=>key.startsWith(environment) && key !== environment))) {
88
+ throw new Error(`Please set ${RSBUILD_PLUGIN_NAME} as global plugin in rslib.config.ts if you set 'target: "dual"'.`);
89
+ }
90
+ setSSREnv();
91
+ }
92
+ const sharedOptions = parseOptions(moduleFederationOptions.shared || [], (item, key)=>{
93
+ if (typeof item !== 'string') throw new Error('Unexpected array in shared');
94
+ const config = item === key || !isRequiredVersion(item) ? {
95
+ import: item
96
+ } : {
97
+ import: key,
98
+ requiredVersion: item
99
+ };
100
+ return config;
101
+ }, (item)=>item);
102
+ // shared[0] is the shared name
103
+ const shared = sharedOptions.map((shared)=>shared[0].endsWith('/') ? shared[0].slice(0, -1) : shared[0]);
104
+ api.modifyRsbuildConfig((config)=>{
105
+ // skip storybook
106
+ if (isStoryBook(config)) {
107
+ return;
108
+ }
109
+ // Change some default configs for remote modules
110
+ if (moduleFederationOptions.exposes) {
111
+ var _userConfig_server, _config_server, _config_dev_client, _originalConfig_dev, _config_server1;
112
+ config.dev ||= {};
113
+ config.server ||= {};
114
+ const userConfig = api.getRsbuildConfig('original');
115
+ // Allow remote modules to be loaded by setting CORS headers
116
+ // This is required for MF to work properly across different origins
117
+ config.server.headers ||= {};
118
+ if (!config.server.headers['Access-Control-Allow-Origin'] && !(typeof ((_userConfig_server = userConfig.server) === null || _userConfig_server === void 0 ? void 0 : _userConfig_server.cors) === 'object' && userConfig.server.cors.origin)) {
119
+ const corsWarnMsgs = [
120
+ 'Detect that CORS options are not set, mf Rsbuild plugin will add default cors header: server.headers["Access-Control-Allow-Headers"] = "*". It is recommended to specify an allowlist of trusted origins in "server.cors" instead.',
121
+ 'View https://module-federation.io/guide/troubleshooting/other.html#cors-warn for more details.'
122
+ ];
123
+ !isRslib && !isRspress && logger.warn(corsWarnMsgs.join('\n'));
124
+ config.server.headers['Access-Control-Allow-Origin'] = '*';
125
+ }
126
+ // For remote modules, Rsbuild should send the ws request to the provider's dev server.
127
+ // This allows the provider to do HMR when the provider module is loaded in the consumer's page.
128
+ if (((_config_server = config.server) === null || _config_server === void 0 ? void 0 : _config_server.port) && !((_config_dev_client = config.dev.client) === null || _config_dev_client === void 0 ? void 0 : _config_dev_client.port)) {
129
+ config.dev.client ||= {};
130
+ config.dev.client.port = config.server.port;
131
+ }
132
+ // Change the default assetPrefix to `true` for remote modules.
133
+ // This ensures that the remote module's assets can be requested by consumer apps with the correct URL.
134
+ const originalConfig = api.getRsbuildConfig('original');
135
+ if (((_originalConfig_dev = originalConfig.dev) === null || _originalConfig_dev === void 0 ? void 0 : _originalConfig_dev.assetPrefix) === undefined && config.dev.assetPrefix === ((_config_server1 = config.server) === null || _config_server1 === void 0 ? void 0 : _config_server1.base)) {
136
+ config.dev.assetPrefix = true;
137
+ }
138
+ }
139
+ if (isSSR) {
140
+ var _config_environments, _config_environments1;
141
+ if ((_config_environments = config.environments) === null || _config_environments === void 0 ? void 0 : _config_environments[SSR_ENV_NAME]) {
142
+ throw new Error(`'${SSR_ENV_NAME}' environment is already defined.Please use another name.`);
143
+ }
144
+ config.environments[SSR_ENV_NAME] = createSSRREnvConfig((_config_environments1 = config.environments) === null || _config_environments1 === void 0 ? void 0 : _config_environments1[environment], moduleFederationOptions, ssrDir, config, callerName);
145
+ const ssgMDEnv = config.environments[RSPRESS_SSG_MD_ENV_NAME];
146
+ if (isRspress && ssgMDEnv) {
147
+ patchToolsTspack(ssgMDEnv, (config, { environment })=>{
148
+ config.target = 'async-node';
149
+ });
150
+ }
151
+ } else if (target === 'node') {
152
+ const mfEnv = config.environments[ENV_NAME];
153
+ patchToolsTspack(mfEnv, (config, { environment })=>{
154
+ config.target = 'async-node';
155
+ });
156
+ }
157
+ });
158
+ api.modifyEnvironmentConfig((config)=>{
159
+ // Module Federation runtime uses ES6+ syntax,
160
+ // adding to include and let SWC transform it
161
+ config.source.include = [
162
+ ...config.source.include || [],
163
+ /@module-federation[\\/]/
164
+ ];
165
+ return config;
166
+ });
167
+ const generateMergedStatsAndManifestOptions = {
168
+ options: {
169
+ nodePlugin: undefined,
170
+ browserPlugin: undefined,
171
+ rspressSSGPlugin: undefined,
172
+ distOutputDir: undefined,
173
+ browserEnvironmentName: undefined,
174
+ nodeEnvironmentName: undefined
175
+ },
176
+ assetResources: {},
177
+ isSSRConfig,
178
+ isRspressSSGConfig
179
+ };
180
+ api.expose(RSBUILD_PLUGIN_MODULE_FEDERATION_NAME, generateMergedStatsAndManifestOptions);
181
+ const defaultBrowserEnvironmentName = environment;
182
+ const assetFileNames = getManifestFileName(moduleFederationOptions.manifest);
183
+ if (moduleFederationOptions.manifest !== false) {
184
+ api.processAssets({
185
+ stage: 'report'
186
+ }, ({ assets, environment: envContext })=>{
187
+ const expectedBrowserEnv = generateMergedStatsAndManifestOptions.options.browserEnvironmentName ?? defaultBrowserEnvironmentName;
188
+ const expectedNodeEnv = generateMergedStatsAndManifestOptions.options.nodeEnvironmentName ?? SSR_ENV_NAME;
189
+ const envName = envContext.name;
190
+ if (envName !== expectedBrowserEnv && envName !== expectedNodeEnv) {
191
+ return;
192
+ }
193
+ const assetResources = generateMergedStatsAndManifestOptions.assetResources;
194
+ const targetResources = assetResources[envName] || (assetResources[envName] = {});
195
+ const statsAsset = assets[assetFileNames.statsFileName];
196
+ if (statsAsset) {
197
+ try {
198
+ const raw = statsAsset.source();
199
+ const content = typeof raw === 'string' ? raw : raw.toString();
200
+ targetResources.stats = {
201
+ data: JSON.parse(content),
202
+ filename: assetFileNames.statsFileName
203
+ };
204
+ } catch (err) {
205
+ const message = err instanceof Error ? err.message : String(err);
206
+ logger.error(`Failed to parse stats asset "${assetFileNames.statsFileName}" for environment "${envName}": ${message} `);
207
+ }
208
+ }
209
+ const manifestAsset = assets[assetFileNames.manifestFileName];
210
+ if (manifestAsset) {
211
+ try {
212
+ const raw = manifestAsset.source();
213
+ const content = typeof raw === 'string' ? raw : raw.toString();
214
+ targetResources.manifest = {
215
+ data: JSON.parse(content),
216
+ filename: assetFileNames.manifestFileName
217
+ };
218
+ } catch (err) {
219
+ const message = err instanceof Error ? err.message : String(err);
220
+ logger.error(`Failed to parse manifest asset "${assetFileNames.manifestFileName}" for environment "${envName}": ${message} `);
221
+ }
222
+ }
223
+ });
224
+ }
225
+ api.onBeforeCreateCompiler(({ bundlerConfigs })=>{
226
+ if (!bundlerConfigs) {
227
+ throw new Error('Can not get bundlerConfigs!');
228
+ }
229
+ bundlerConfigs.forEach((bundlerConfig)=>{
230
+ if (!isMFFormat(bundlerConfig) && !isRspress) {
231
+ return;
232
+ } else if (isStoryBook(originalRsbuildConfig)) {
233
+ bundlerConfig.output.uniqueName = `${moduleFederationOptions.name} -storybook - host`;
234
+ } else {
235
+ var _bundlerConfig_optimization, _bundlerConfig_optimization1, _bundlerConfig_output, _bundlerConfig_output1, _bundlerConfig_output2;
236
+ // mf
237
+ autoDeleteSplitChunkCacheGroups(moduleFederationOptions, bundlerConfig === null || bundlerConfig === void 0 ? void 0 : (_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks);
238
+ addDataFetchExposes(moduleFederationOptions.exposes, isSSRConfig(bundlerConfig.name));
239
+ (_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? true : delete _bundlerConfig_optimization1.runtimeChunk;
240
+ const externals = bundlerConfig.externals;
241
+ if (Array.isArray(externals)) {
242
+ const sharedModules = new Set();
243
+ bundlerConfig.externals = externals.filter((ext)=>{
244
+ let sharedModule;
245
+ if (isRegExp(ext)) {
246
+ const match = shared.some((dep)=>{
247
+ if (ext.test(dep) || ext.test(package_0.name)) {
248
+ sharedModule = dep;
249
+ return true;
250
+ }
251
+ return false;
252
+ });
253
+ match && sharedModule && sharedModules.add(sharedModule);
254
+ return !match;
255
+ }
256
+ if (typeof ext === 'string') {
257
+ if (ext === package_0.name) {
258
+ return false;
259
+ }
260
+ const match = shared.some((dep)=>{
261
+ if (dep === ext) {
262
+ sharedModule = dep;
263
+ }
264
+ return dep === ext;
265
+ });
266
+ if (match) {
267
+ sharedModule && sharedModules.add(sharedModule);
268
+ return false;
269
+ }
270
+ return true;
271
+ }
272
+ return true;
273
+ });
274
+ if (sharedModules.size > 0) {
275
+ for (const sharedModule of sharedModules){
276
+ logger.log(`${sharedModule} is removed from externals because it is a shared module.`);
277
+ }
278
+ }
279
+ }
280
+ if (!((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.chunkLoadingGlobal) && !isSSRConfig(bundlerConfig.name) && !isRspressSSGConfig(bundlerConfig.name) && target !== 'node') {
281
+ bundlerConfig.output.chunkLoading = 'jsonp';
282
+ bundlerConfig.output.chunkLoadingGlobal = `chunk_${moduleFederationOptions.name} `;
283
+ }
284
+ if (target === 'node' && isMFFormat(bundlerConfig)) {
285
+ patchNodeConfig(bundlerConfig, moduleFederationOptions);
286
+ patchNodeMFConfig(moduleFederationOptions);
287
+ }
288
+ // `uniqueName` is required for react refresh to work
289
+ if (!((_bundlerConfig_output1 = bundlerConfig.output) === null || _bundlerConfig_output1 === void 0 ? void 0 : _bundlerConfig_output1.uniqueName)) {
290
+ bundlerConfig.output.uniqueName = moduleFederationOptions.name;
291
+ }
292
+ // Set default publicPath to 'auto' if not explicitly configured
293
+ // This allows remote chunks to load from the same origin as the remote application's manifest
294
+ if (((_bundlerConfig_output2 = bundlerConfig.output) === null || _bundlerConfig_output2 === void 0 ? void 0 : _bundlerConfig_output2.publicPath) === undefined && !isSSRConfig(bundlerConfig.name) && !isRspressSSGConfig(bundlerConfig.name)) {
295
+ bundlerConfig.output.publicPath = 'auto';
296
+ }
297
+ if (!bundlerConfig.plugins.find((p)=>p && p.name === PLUGIN_NAME)) {
298
+ var _bundlerConfig_output3;
299
+ if (isSSRConfig(bundlerConfig.name)) {
300
+ generateMergedStatsAndManifestOptions.options.nodePlugin = new ModuleFederationPlugin(createSSRMFConfig(moduleFederationOptions));
301
+ generateMergedStatsAndManifestOptions.options.nodeEnvironmentName = bundlerConfig.name || SSR_ENV_NAME;
302
+ bundlerConfig.plugins.push(generateMergedStatsAndManifestOptions.options.nodePlugin);
303
+ return;
304
+ } else if (isRspressSSGConfig(bundlerConfig.name)) {
305
+ const mfConfig = {
306
+ ...createSSRMFConfig(moduleFederationOptions),
307
+ // expose in mf-ssg env
308
+ exposes: {},
309
+ manifest: false,
310
+ library: undefined
311
+ };
312
+ patchSSRRspackConfig(bundlerConfig, mfConfig, RSPRESS_SSR_DIR, callerName, false, false);
313
+ bundlerConfig.output ||= {};
314
+ bundlerConfig.output.publicPath = '/';
315
+ // MF depend on asyncChunks
316
+ bundlerConfig.output.asyncChunks = undefined;
317
+ const p = new ModuleFederationPlugin(mfConfig);
318
+ if (bundlerConfig.name === RSPRESS_BUNDLER_CONFIG_NAME) {
319
+ generateMergedStatsAndManifestOptions.options.rspressSSGPlugin = p;
320
+ }
321
+ bundlerConfig.plugins.push(p);
322
+ return;
323
+ }
324
+ generateMergedStatsAndManifestOptions.options.browserPlugin = new ModuleFederationPlugin(moduleFederationOptions);
325
+ generateMergedStatsAndManifestOptions.options.distOutputDir = ((_bundlerConfig_output3 = bundlerConfig.output) === null || _bundlerConfig_output3 === void 0 ? void 0 : _bundlerConfig_output3.path) || '';
326
+ generateMergedStatsAndManifestOptions.options.browserEnvironmentName = bundlerConfig.name || defaultBrowserEnvironmentName;
327
+ bundlerConfig.plugins.push(generateMergedStatsAndManifestOptions.options.browserPlugin);
328
+ }
329
+ }
330
+ });
331
+ });
332
+ const generateMergedStatsAndManifest = ()=>{
333
+ const { distOutputDir, browserEnvironmentName, nodeEnvironmentName } = generateMergedStatsAndManifestOptions.options;
334
+ if (!distOutputDir || !browserEnvironmentName || !nodeEnvironmentName) {
335
+ return;
336
+ }
337
+ const assetResources = generateMergedStatsAndManifestOptions.assetResources;
338
+ const browserAssets = assetResources[browserEnvironmentName];
339
+ const nodeAssets = assetResources[nodeEnvironmentName];
340
+ if (!browserAssets || !nodeAssets) {
341
+ return;
342
+ }
343
+ try {
344
+ updateStatsAndManifest(nodeAssets, browserAssets, distOutputDir);
345
+ } catch (err) {
346
+ logger.error(err);
347
+ }
348
+ };
349
+ api.onDevCompileDone(()=>{
350
+ generateMergedStatsAndManifest();
351
+ });
352
+ api.onAfterBuild(()=>{
353
+ generateMergedStatsAndManifest();
354
+ });
355
+ }
356
+ });
357
+
358
+
359
+
360
+ export { PLUGIN_NAME, RSBUILD_PLUGIN_MODULE_FEDERATION_NAME, SSR_DIR, TreeShakingSharedPlugin, createModuleFederationConfig, isMFFormat, pluginModuleFederation };
@@ -6,4 +6,5 @@ export declare const CALL_NAME_MAP: {
6
6
  RSLIB: string;
7
7
  };
8
8
  export declare const RSPRESS_BUNDLER_CONFIG_NAME = "node";
9
+ export declare const RSPRESS_SSG_MD_ENV_NAME = "node_md";
9
10
  export declare const RSPRESS_SSR_DIR = "ssr";
package/dist/constant.js CHANGED
@@ -1,35 +1,50 @@
1
1
  "use strict";
2
+ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
3
+ return typeof document === 'undefined'
4
+ ? new (require('url'.replace('', '')).URL)('file:' + __filename).href
5
+ : (document.currentScript && document.currentScript.src) ||
6
+ new URL('main.js', document.baseURI).href;
7
+ })();
8
+ ;
9
+ // The require scope
2
10
  var __webpack_require__ = {};
3
- (()=>{
4
- __webpack_require__.d = (exports1, definition)=>{
5
- for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
6
- enumerable: true,
7
- get: definition[key]
8
- });
9
- };
11
+
12
+ /************************************************************************/
13
+ // webpack/runtime/define_property_getters
14
+ (() => {
15
+ __webpack_require__.d = (exports, definition) => {
16
+ for(var key in definition) {
17
+ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
19
+ }
20
+ }
21
+ };
10
22
  })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
23
+ // webpack/runtime/has_own_property
24
+ (() => {
25
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
13
26
  })();
14
- (()=>{
15
- __webpack_require__.r = (exports1)=>{
16
- if ('undefined' != typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
17
- value: 'Module'
18
- });
19
- Object.defineProperty(exports1, '__esModule', {
20
- value: true
21
- });
22
- };
27
+ // webpack/runtime/make_namespace_object
28
+ (() => {
29
+ // define __esModule on exports
30
+ __webpack_require__.r = (exports) => {
31
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
32
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
33
+ }
34
+ Object.defineProperty(exports, '__esModule', { value: true });
35
+ };
23
36
  })();
37
+ /************************************************************************/
24
38
  var __webpack_exports__ = {};
25
39
  __webpack_require__.r(__webpack_exports__);
26
40
  __webpack_require__.d(__webpack_exports__, {
27
- CALL_NAME_MAP: ()=>CALL_NAME_MAP,
28
- DATA_FETCH_CLIENT_SUFFIX: ()=>DATA_FETCH_CLIENT_SUFFIX,
29
- DATA_FETCH_IDENTIFIER: ()=>DATA_FETCH_IDENTIFIER,
30
- DEFAULT_ASSET_PREFIX: ()=>DEFAULT_ASSET_PREFIX,
31
- RSPRESS_BUNDLER_CONFIG_NAME: ()=>RSPRESS_BUNDLER_CONFIG_NAME,
32
- RSPRESS_SSR_DIR: ()=>RSPRESS_SSR_DIR
41
+ CALL_NAME_MAP: () => (CALL_NAME_MAP),
42
+ DATA_FETCH_CLIENT_SUFFIX: () => (DATA_FETCH_CLIENT_SUFFIX),
43
+ DATA_FETCH_IDENTIFIER: () => (DATA_FETCH_IDENTIFIER),
44
+ DEFAULT_ASSET_PREFIX: () => (DEFAULT_ASSET_PREFIX),
45
+ RSPRESS_BUNDLER_CONFIG_NAME: () => (RSPRESS_BUNDLER_CONFIG_NAME),
46
+ RSPRESS_SSG_MD_ENV_NAME: () => (RSPRESS_SSG_MD_ENV_NAME),
47
+ RSPRESS_SSR_DIR: () => (RSPRESS_SSR_DIR)
33
48
  });
34
49
  const DEFAULT_ASSET_PREFIX = '/';
35
50
  const DATA_FETCH_IDENTIFIER = 'data';
@@ -39,21 +54,19 @@ const CALL_NAME_MAP = {
39
54
  RSLIB: 'rslib'
40
55
  };
41
56
  const RSPRESS_BUNDLER_CONFIG_NAME = 'node';
57
+ const RSPRESS_SSG_MD_ENV_NAME = 'node_md';
42
58
  const RSPRESS_SSR_DIR = 'ssr';
59
+
43
60
  exports.CALL_NAME_MAP = __webpack_exports__.CALL_NAME_MAP;
44
61
  exports.DATA_FETCH_CLIENT_SUFFIX = __webpack_exports__.DATA_FETCH_CLIENT_SUFFIX;
45
62
  exports.DATA_FETCH_IDENTIFIER = __webpack_exports__.DATA_FETCH_IDENTIFIER;
46
63
  exports.DEFAULT_ASSET_PREFIX = __webpack_exports__.DEFAULT_ASSET_PREFIX;
47
64
  exports.RSPRESS_BUNDLER_CONFIG_NAME = __webpack_exports__.RSPRESS_BUNDLER_CONFIG_NAME;
65
+ exports.RSPRESS_SSG_MD_ENV_NAME = __webpack_exports__.RSPRESS_SSG_MD_ENV_NAME;
48
66
  exports.RSPRESS_SSR_DIR = __webpack_exports__.RSPRESS_SSR_DIR;
49
- for(var __webpack_i__ in __webpack_exports__)if (-1 === [
50
- "CALL_NAME_MAP",
51
- "DATA_FETCH_CLIENT_SUFFIX",
52
- "DATA_FETCH_IDENTIFIER",
53
- "DEFAULT_ASSET_PREFIX",
54
- "RSPRESS_BUNDLER_CONFIG_NAME",
55
- "RSPRESS_SSR_DIR"
56
- ].indexOf(__webpack_i__)) exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
57
- Object.defineProperty(exports, '__esModule', {
58
- value: true
59
- });
67
+ for(var __webpack_i__ in __webpack_exports__) {
68
+ if(["CALL_NAME_MAP","DATA_FETCH_CLIENT_SUFFIX","DATA_FETCH_IDENTIFIER","DEFAULT_ASSET_PREFIX","RSPRESS_BUNDLER_CONFIG_NAME","RSPRESS_SSG_MD_ENV_NAME","RSPRESS_SSR_DIR"].indexOf(__webpack_i__) === -1) {
69
+ exports[__webpack_i__] = __webpack_exports__[__webpack_i__];
70
+ }
71
+ }
72
+ Object.defineProperty(exports, '__esModule', { value: true });
package/dist/constant.mjs CHANGED
@@ -1,3 +1,5 @@
1
+
2
+ ;// CONCATENATED MODULE: ./src/constant.ts
1
3
  const DEFAULT_ASSET_PREFIX = '/';
2
4
  const DATA_FETCH_IDENTIFIER = 'data';
3
5
  const DATA_FETCH_CLIENT_SUFFIX = '.client';
@@ -6,5 +8,7 @@ const CALL_NAME_MAP = {
6
8
  RSLIB: 'rslib'
7
9
  };
8
10
  const RSPRESS_BUNDLER_CONFIG_NAME = 'node';
11
+ const RSPRESS_SSG_MD_ENV_NAME = 'node_md';
9
12
  const RSPRESS_SSR_DIR = 'ssr';
10
- export { CALL_NAME_MAP, DATA_FETCH_CLIENT_SUFFIX, DATA_FETCH_IDENTIFIER, DEFAULT_ASSET_PREFIX, RSPRESS_BUNDLER_CONFIG_NAME, RSPRESS_SSR_DIR };
13
+
14
+ export { CALL_NAME_MAP, DATA_FETCH_CLIENT_SUFFIX, DATA_FETCH_IDENTIFIER, DEFAULT_ASSET_PREFIX, RSPRESS_BUNDLER_CONFIG_NAME, RSPRESS_SSG_MD_ENV_NAME, RSPRESS_SSR_DIR };
@@ -0,0 +1 @@
1
+ export * from './cli/index';