@module-federation/rsbuild-plugin 0.0.0-perf-devtools-20260108034446 → 0.0.0-perf-website-code-usage-20260914033703

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,403 @@
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 logger from "../logger.mjs";
5
+ import { SSR_DIR, SSR_ENV_NAME, addDataFetchExposes, autoDeleteSplitChunkCacheGroups, createSSRMFConfig, createSSRREnvConfig, isRegExp, patchSSRRspackConfig, setSSREnv, updateStatsAndManifest } from "../utils.mjs";
6
+ import { CALL_NAME_MAP, RSPRESS_BUNDLER_CONFIG_NAME, RSPRESS_SSG_MD_ENV_NAME, RSPRESS_SSR_DIR } from "../constant.mjs";
7
+ import { patchNodeConfig, patchToolsTspack } from "../utils/ssr.mjs";
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+
18
+
19
+
20
+
21
+
22
+
23
+ const RSBUILD_PLUGIN_MODULE_FEDERATION_NAME = 'rsbuild:module-federation-enhanced';
24
+ const RSBUILD_PLUGIN_NAME = '@module-federation/rsbuild-plugin';
25
+
26
+ const LIB_FORMAT = [
27
+ 'umd',
28
+ 'modern-module'
29
+ ];
30
+ const DEFAULT_MF_ENVIRONMENT_NAME = 'mf';
31
+ const DEFAULT_WEB_ENVIRONMENT_NAME = 'web';
32
+ const DEFAULT_NODE_ENVIRONMENT_NAME = 'node';
33
+ const resolveDefaultEnvironmentName = ({ callerName, target })=>{
34
+ if (callerName === CALL_NAME_MAP.RSLIB) {
35
+ return DEFAULT_MF_ENVIRONMENT_NAME;
36
+ }
37
+ if (callerName === CALL_NAME_MAP.RSPRESS) {
38
+ if (target === 'node') {
39
+ return DEFAULT_NODE_ENVIRONMENT_NAME;
40
+ }
41
+ return DEFAULT_WEB_ENVIRONMENT_NAME;
42
+ }
43
+ if (target === 'node') {
44
+ return DEFAULT_NODE_ENVIRONMENT_NAME;
45
+ }
46
+ return DEFAULT_WEB_ENVIRONMENT_NAME;
47
+ };
48
+ function isStoryBook(rsbuildConfig) {
49
+ if (rsbuildConfig.plugins?.find((p)=>p && 'name' in p && p.name === 'module-federation-storybook-plugin')) {
50
+ return true;
51
+ }
52
+ return false;
53
+ }
54
+ function isMFFormat(bundlerConfig) {
55
+ const library = bundlerConfig.output?.library;
56
+ if (bundlerConfig.name === SSR_ENV_NAME) {
57
+ return true;
58
+ }
59
+ 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
60
+ (LIB_FORMAT.includes(library.type) || /commonjs/.test(library.type)));
61
+ }
62
+ const isSSRConfig = (bundlerConfigName)=>Boolean(bundlerConfigName === SSR_ENV_NAME);
63
+ const isRspressSSGConfig = (bundlerConfigName)=>{
64
+ return [
65
+ RSPRESS_BUNDLER_CONFIG_NAME,
66
+ RSPRESS_SSG_MD_ENV_NAME
67
+ ].includes(bundlerConfigName || '');
68
+ };
69
+ const pluginModuleFederation = (initialModuleFederationOptions, rsbuildOptions)=>({
70
+ name: RSBUILD_PLUGIN_MODULE_FEDERATION_NAME,
71
+ setup: (api)=>{
72
+ let moduleFederationOptions = initialModuleFederationOptions;
73
+ let hasNodeTargetConfigOwner = false;
74
+ if (!moduleFederationOptions?.name) {
75
+ throw new Error('The module federation option "name" is required in @module-federation/rsbuild-plugin.');
76
+ }
77
+ const { target = 'web', ssr = undefined, ssrDir = SSR_DIR, environment: configuredEnvironment } = rsbuildOptions || {};
78
+ if (ssr) {
79
+ throw new Error("The `ssr` option is deprecated. If you want to enable SSR, please use `target: 'dual'` instead.");
80
+ }
81
+ const { callerName } = api.context;
82
+ const originalRsbuildConfig = api.getRsbuildConfig();
83
+ if (!callerName) {
84
+ throw new Error('`callerName` is undefined. Please ensure the @rsbuild/core version is higher than 1.3.21 .');
85
+ }
86
+ const isRslib = callerName === CALL_NAME_MAP.RSLIB;
87
+ const isRspress = callerName === CALL_NAME_MAP.RSPRESS;
88
+ const isRstest = callerName === 'rstest';
89
+ const isRstestCompanionActive = ()=>isRstest && hasNodeTargetConfigOwner;
90
+ const isSSR = target === 'dual';
91
+ const environment = configuredEnvironment ?? resolveDefaultEnvironmentName({
92
+ callerName,
93
+ target
94
+ });
95
+ if (isSSR && !isStoryBook(originalRsbuildConfig)) {
96
+ if (!isRslib && !isRspress) {
97
+ throw new Error(`'target' option is only supported in Rslib.`);
98
+ }
99
+ const rsbuildConfig = api.getRsbuildConfig();
100
+ if (!isRspress && (!rsbuildConfig.environments?.[environment] || Object.keys(rsbuildConfig.environments).some((key)=>key.startsWith(environment) && key !== environment))) {
101
+ throw new Error(`Please set ${RSBUILD_PLUGIN_NAME} as global plugin in rslib.config.ts if you set 'target: "dual"'.`);
102
+ }
103
+ setSSREnv();
104
+ }
105
+ api.modifyRsbuildConfig((config)=>{
106
+ // skip storybook
107
+ if (isStoryBook(config)) {
108
+ return;
109
+ }
110
+ // Change some default configs for remote modules
111
+ if (moduleFederationOptions.exposes) {
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?.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?.port && !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?.assetPrefix === undefined && config.dev.assetPrefix === config.server?.base) {
136
+ config.dev.assetPrefix = true;
137
+ }
138
+ }
139
+ if (isSSR) {
140
+ if (config.environments?.[SSR_ENV_NAME]) {
141
+ throw new Error(`'${SSR_ENV_NAME}' environment is already defined.Please use another name.`);
142
+ }
143
+ const currentEnvironment = config.environments?.[environment];
144
+ if (!currentEnvironment) {
145
+ throw new Error(`Can not find environment '${environment}' when enabling SSR.`);
146
+ }
147
+ config.environments[SSR_ENV_NAME] = createSSRREnvConfig(currentEnvironment, moduleFederationOptions, ssrDir, config, callerName);
148
+ const ssgMDEnv = config.environments[RSPRESS_SSG_MD_ENV_NAME];
149
+ if (isRspress && ssgMDEnv) {
150
+ patchToolsTspack(ssgMDEnv, (config, { environment })=>{
151
+ config.target = 'async-node';
152
+ });
153
+ }
154
+ } else if (target === 'node') {
155
+ const nodeTargetEnv = config.environments?.[environment];
156
+ if (!nodeTargetEnv) {
157
+ const availableEnvironments = Object.keys(config.environments || {});
158
+ const availableEnvironmentsLabel = availableEnvironments.length > 0 ? availableEnvironments.join(', ') : '(none)';
159
+ throw new Error(`Can not find environment '${environment}' when using target: 'node'. Available environments: ${availableEnvironmentsLabel}.`);
160
+ }
161
+ if (!isRstestCompanionActive()) {
162
+ patchToolsTspack(nodeTargetEnv, (config)=>{
163
+ config.target = 'async-node';
164
+ });
165
+ }
166
+ }
167
+ });
168
+ api.modifyEnvironmentConfig((config)=>{
169
+ // Module Federation runtime uses ES6+ syntax,
170
+ // adding to include and let SWC transform it
171
+ config.source.include = [
172
+ ...config.source.include || [],
173
+ /@module-federation[\\/]/
174
+ ];
175
+ return config;
176
+ });
177
+ const exposedFederationApi = {
178
+ options: {
179
+ nodePlugin: undefined,
180
+ browserPlugin: undefined,
181
+ rspressSSGPlugin: undefined,
182
+ distOutputDir: undefined,
183
+ browserEnvironmentName: undefined,
184
+ nodeEnvironmentName: undefined
185
+ },
186
+ assetResources: {},
187
+ getOptions: ()=>moduleFederationOptions,
188
+ registerNodeTargetConfigOwner: ()=>{
189
+ hasNodeTargetConfigOwner = true;
190
+ },
191
+ registerOptionsTransformer: (transformer)=>{
192
+ moduleFederationOptions = transformer(moduleFederationOptions);
193
+ },
194
+ isSSRConfig: isSSRConfig,
195
+ isRspressSSGConfig: isRspressSSGConfig
196
+ };
197
+ api.expose(RSBUILD_PLUGIN_MODULE_FEDERATION_NAME, exposedFederationApi);
198
+ const defaultBrowserEnvironmentName = environment;
199
+ api.processAssets({
200
+ stage: 'report'
201
+ }, ({ assets, environment: envContext })=>{
202
+ if (moduleFederationOptions.manifest === false) {
203
+ return;
204
+ }
205
+ const assetFileNames = getManifestFileName(moduleFederationOptions.manifest);
206
+ const expectedBrowserEnv = exposedFederationApi.options.browserEnvironmentName ?? defaultBrowserEnvironmentName;
207
+ const expectedNodeEnv = exposedFederationApi.options.nodeEnvironmentName ?? SSR_ENV_NAME;
208
+ const envName = envContext.name;
209
+ if (envName !== expectedBrowserEnv && envName !== expectedNodeEnv) {
210
+ return;
211
+ }
212
+ const assetResources = exposedFederationApi.assetResources;
213
+ const targetResources = assetResources[envName] || (assetResources[envName] = {});
214
+ const statsAsset = assets[assetFileNames.statsFileName];
215
+ if (statsAsset) {
216
+ try {
217
+ const raw = statsAsset.source();
218
+ const content = typeof raw === 'string' ? raw : raw.toString();
219
+ targetResources.stats = {
220
+ data: JSON.parse(content),
221
+ filename: assetFileNames.statsFileName
222
+ };
223
+ } catch (err) {
224
+ const message = err instanceof Error ? err.message : String(err);
225
+ logger.error(`Failed to parse stats asset "${assetFileNames.statsFileName}" for environment "${envName}": ${message} `);
226
+ }
227
+ }
228
+ const manifestAsset = assets[assetFileNames.manifestFileName];
229
+ if (manifestAsset) {
230
+ try {
231
+ const raw = manifestAsset.source();
232
+ const content = typeof raw === 'string' ? raw : raw.toString();
233
+ targetResources.manifest = {
234
+ data: JSON.parse(content),
235
+ filename: assetFileNames.manifestFileName
236
+ };
237
+ } catch (err) {
238
+ const message = err instanceof Error ? err.message : String(err);
239
+ logger.error(`Failed to parse manifest asset "${assetFileNames.manifestFileName}" for environment "${envName}": ${message} `);
240
+ }
241
+ }
242
+ });
243
+ api.onBeforeCreateCompiler(({ bundlerConfigs })=>{
244
+ if (!bundlerConfigs) {
245
+ throw new Error('Can not get bundlerConfigs!');
246
+ }
247
+ const sharedOptions = parseOptions(moduleFederationOptions.shared || [], (item, key)=>{
248
+ if (typeof item !== 'string') throw new Error('Unexpected array in shared');
249
+ const config = item === key || !isRequiredVersion(item) ? {
250
+ import: item
251
+ } : {
252
+ import: key,
253
+ requiredVersion: item
254
+ };
255
+ return config;
256
+ }, (item)=>item);
257
+ const shared = sharedOptions.map(([name])=>name.endsWith('/') ? name.slice(0, -1) : name);
258
+ bundlerConfigs.forEach((bundlerConfig)=>{
259
+ const bundlerConfigName = bundlerConfig.name || '';
260
+ const isConfiguredEnvironmentConfig = bundlerConfigName === environment;
261
+ const isNodeTargetEnvironmentConfig = target === 'node' && bundlerConfigName === environment;
262
+ const isRspressSSGEnvironmentConfig = isRspressSSGConfig(bundlerConfig.name);
263
+ const isActiveRspressSSGEnvironmentConfig = isRspress && isRspressSSGEnvironmentConfig;
264
+ const shouldUseSSRPluginConfig = isSSRConfig(bundlerConfig.name) || isNodeTargetEnvironmentConfig && !isRstestCompanionActive();
265
+ if (target === 'node' && !isNodeTargetEnvironmentConfig && !isActiveRspressSSGEnvironmentConfig) {
266
+ return;
267
+ }
268
+ // For non-node targets, scope each plugin instance to its configured
269
+ // environment plus explicit SSR/SSG environments. This prevents a
270
+ // browser-targeted instance from mutating SSR configs.
271
+ if (target !== 'node' && !isConfiguredEnvironmentConfig && !shouldUseSSRPluginConfig && !isActiveRspressSSGEnvironmentConfig) {
272
+ return;
273
+ }
274
+ if (!isMFFormat(bundlerConfig) && !isRspress && !isNodeTargetEnvironmentConfig) {
275
+ return;
276
+ } else if (isStoryBook(originalRsbuildConfig)) {
277
+ bundlerConfig.output.uniqueName = `${moduleFederationOptions.name} -storybook - host`;
278
+ } else {
279
+ // mf
280
+ autoDeleteSplitChunkCacheGroups(moduleFederationOptions, bundlerConfig?.optimization?.splitChunks);
281
+ addDataFetchExposes(moduleFederationOptions.exposes, shouldUseSSRPluginConfig);
282
+ const ssrModuleFederationOptions = shouldUseSSRPluginConfig ? createSSRMFConfig(moduleFederationOptions) : undefined;
283
+ if (!isRstestCompanionActive()) {
284
+ if (bundlerConfig.optimization?.runtimeChunk) {
285
+ logger.warn('`optimization.runtimeChunk` is disabled because Module Federation requires its runtime to remain with each entry. The Rstest federation companion is the supported exception because its worker loads the shared runtime explicitly.');
286
+ }
287
+ delete bundlerConfig.optimization?.runtimeChunk;
288
+ }
289
+ const externals = bundlerConfig.externals;
290
+ if (Array.isArray(externals)) {
291
+ const sharedModules = new Set();
292
+ bundlerConfig.externals = externals.filter((ext)=>{
293
+ let sharedModule;
294
+ if (isRegExp(ext)) {
295
+ const match = shared.some((dep)=>{
296
+ if (ext.test(dep) || ext.test("@module-federation/rsbuild-plugin")) {
297
+ sharedModule = dep;
298
+ return true;
299
+ }
300
+ return false;
301
+ });
302
+ match && sharedModule && sharedModules.add(sharedModule);
303
+ return !match;
304
+ }
305
+ if (typeof ext === 'string') {
306
+ if (ext === "@module-federation/rsbuild-plugin") {
307
+ return false;
308
+ }
309
+ const match = shared.some((dep)=>{
310
+ if (dep === ext) {
311
+ sharedModule = dep;
312
+ }
313
+ return dep === ext;
314
+ });
315
+ if (match) {
316
+ sharedModule && sharedModules.add(sharedModule);
317
+ return false;
318
+ }
319
+ return true;
320
+ }
321
+ return true;
322
+ });
323
+ if (sharedModules.size > 0) {
324
+ for (const sharedModule of sharedModules){
325
+ logger.log(`${sharedModule} is removed from externals because it is a shared module.`);
326
+ }
327
+ }
328
+ }
329
+ if (!bundlerConfig.output?.chunkLoadingGlobal && !shouldUseSSRPluginConfig && !isActiveRspressSSGEnvironmentConfig && target !== 'node') {
330
+ bundlerConfig.output.chunkLoadingGlobal = `chunk_${moduleFederationOptions.name}`;
331
+ }
332
+ if (isNodeTargetEnvironmentConfig && !isRstestCompanionActive()) {
333
+ patchNodeConfig(bundlerConfig, ssrModuleFederationOptions ?? moduleFederationOptions);
334
+ }
335
+ // `uniqueName` is required for react refresh to work
336
+ if (!bundlerConfig.output?.uniqueName) {
337
+ bundlerConfig.output.uniqueName = moduleFederationOptions.name;
338
+ }
339
+ // Set default publicPath to 'auto' if not explicitly configured
340
+ // This allows remote chunks to load from the same origin as the remote application's manifest
341
+ if (bundlerConfig.output?.publicPath === undefined && !shouldUseSSRPluginConfig && !isActiveRspressSSGEnvironmentConfig) {
342
+ bundlerConfig.output.publicPath = 'auto';
343
+ }
344
+ if (!bundlerConfig.plugins.find((p)=>p && p.name === PLUGIN_NAME)) {
345
+ if (shouldUseSSRPluginConfig || isNodeTargetEnvironmentConfig) {
346
+ const ssrMFConfig = ssrModuleFederationOptions ?? (isRstestCompanionActive() ? moduleFederationOptions : createSSRMFConfig(moduleFederationOptions));
347
+ exposedFederationApi.options.nodePlugin = new ModuleFederationPlugin(ssrMFConfig);
348
+ exposedFederationApi.options.nodeEnvironmentName = bundlerConfig.name || SSR_ENV_NAME;
349
+ bundlerConfig.plugins.push(exposedFederationApi.options.nodePlugin);
350
+ return;
351
+ } else if (isActiveRspressSSGEnvironmentConfig) {
352
+ const mfConfig = {
353
+ ...createSSRMFConfig(moduleFederationOptions),
354
+ // expose in mf-ssg env
355
+ exposes: {},
356
+ manifest: false,
357
+ library: undefined
358
+ };
359
+ patchSSRRspackConfig(bundlerConfig, mfConfig, RSPRESS_SSR_DIR, callerName, false, false);
360
+ bundlerConfig.output ||= {};
361
+ bundlerConfig.output.publicPath = '/';
362
+ // MF depend on asyncChunks
363
+ bundlerConfig.output.asyncChunks = undefined;
364
+ const p = new ModuleFederationPlugin(mfConfig);
365
+ if (bundlerConfig.name === RSPRESS_BUNDLER_CONFIG_NAME) {
366
+ exposedFederationApi.options.rspressSSGPlugin = p;
367
+ }
368
+ bundlerConfig.plugins.push(p);
369
+ return;
370
+ }
371
+ exposedFederationApi.options.browserPlugin = new ModuleFederationPlugin(moduleFederationOptions);
372
+ exposedFederationApi.options.distOutputDir = bundlerConfig.output?.path || '';
373
+ exposedFederationApi.options.browserEnvironmentName = bundlerConfig.name || defaultBrowserEnvironmentName;
374
+ bundlerConfig.plugins.push(exposedFederationApi.options.browserPlugin);
375
+ }
376
+ }
377
+ });
378
+ });
379
+ const generateMergedStatsAndManifest = ()=>{
380
+ const { distOutputDir, browserEnvironmentName, nodeEnvironmentName } = exposedFederationApi.options;
381
+ if (!distOutputDir || !browserEnvironmentName || !nodeEnvironmentName) {
382
+ return;
383
+ }
384
+ const assetResources = exposedFederationApi.assetResources;
385
+ const browserAssets = assetResources[browserEnvironmentName];
386
+ const nodeAssets = assetResources[nodeEnvironmentName];
387
+ if (!browserAssets || !nodeAssets) {
388
+ return;
389
+ }
390
+ try {
391
+ updateStatsAndManifest(nodeAssets, browserAssets, distOutputDir);
392
+ } catch (err) {
393
+ logger.error(err);
394
+ }
395
+ };
396
+ api.onDevCompileDone(generateMergedStatsAndManifest);
397
+ api.onAfterBuild(generateMergedStatsAndManifest);
398
+ }
399
+ });
400
+
401
+
402
+
403
+ 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,36 +1,44 @@
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
+ // webpack/runtime/define_property_getters
13
+ (() => {
14
+ __webpack_require__.d = (exports, getters, values) => {
15
+ var define = (defs, kind) => {
16
+ for(var key in defs) {
17
+ if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
18
+ Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
19
+ }
20
+ }
21
+ };
22
+ define(getters, "get");
23
+ define(values, "value");
24
+ };
10
25
  })();
11
- (()=>{
12
- __webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
26
+ // webpack/runtime/has_own_property
27
+ (() => {
28
+ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
13
29
  })();
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
- };
30
+ // webpack/runtime/make_namespace_object
31
+ (() => {
32
+ // define __esModule on exports
33
+ __webpack_require__.r = (exports) => {
34
+ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
35
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
36
+ }
37
+ Object.defineProperty(exports, '__esModule', { value: true });
38
+ };
23
39
  })();
24
40
  var __webpack_exports__ = {};
25
41
  __webpack_require__.r(__webpack_exports__);
26
- __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
33
- });
34
42
  const DEFAULT_ASSET_PREFIX = '/';
35
43
  const DATA_FETCH_IDENTIFIER = 'data';
36
44
  const DATA_FETCH_CLIENT_SUFFIX = '.client';
@@ -39,21 +47,30 @@ const CALL_NAME_MAP = {
39
47
  RSLIB: 'rslib'
40
48
  };
41
49
  const RSPRESS_BUNDLER_CONFIG_NAME = 'node';
50
+ const RSPRESS_SSG_MD_ENV_NAME = 'node_md';
42
51
  const RSPRESS_SSR_DIR = 'ssr';
52
+
53
+ __webpack_require__.d(__webpack_exports__, {
54
+ }, {
55
+ CALL_NAME_MAP: CALL_NAME_MAP,
56
+ DATA_FETCH_CLIENT_SUFFIX: DATA_FETCH_CLIENT_SUFFIX,
57
+ DATA_FETCH_IDENTIFIER: DATA_FETCH_IDENTIFIER,
58
+ DEFAULT_ASSET_PREFIX: DEFAULT_ASSET_PREFIX,
59
+ RSPRESS_BUNDLER_CONFIG_NAME: RSPRESS_BUNDLER_CONFIG_NAME,
60
+ RSPRESS_SSG_MD_ENV_NAME: RSPRESS_SSG_MD_ENV_NAME,
61
+ RSPRESS_SSR_DIR: RSPRESS_SSR_DIR
62
+ });
63
+
43
64
  exports.CALL_NAME_MAP = __webpack_exports__.CALL_NAME_MAP;
44
65
  exports.DATA_FETCH_CLIENT_SUFFIX = __webpack_exports__.DATA_FETCH_CLIENT_SUFFIX;
45
66
  exports.DATA_FETCH_IDENTIFIER = __webpack_exports__.DATA_FETCH_IDENTIFIER;
46
67
  exports.DEFAULT_ASSET_PREFIX = __webpack_exports__.DEFAULT_ASSET_PREFIX;
47
68
  exports.RSPRESS_BUNDLER_CONFIG_NAME = __webpack_exports__.RSPRESS_BUNDLER_CONFIG_NAME;
69
+ exports.RSPRESS_SSG_MD_ENV_NAME = __webpack_exports__.RSPRESS_SSG_MD_ENV_NAME;
48
70
  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
- });
71
+ for(var __rspack_i in __webpack_exports__) {
72
+ 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(__rspack_i) === -1) {
73
+ exports[__rspack_i] = __webpack_exports__[__rspack_i];
74
+ }
75
+ }
76
+ Object.defineProperty(exports, '__esModule', { value: true });
package/dist/constant.mjs CHANGED
@@ -6,5 +6,7 @@ const CALL_NAME_MAP = {
6
6
  RSLIB: 'rslib'
7
7
  };
8
8
  const RSPRESS_BUNDLER_CONFIG_NAME = 'node';
9
+ const RSPRESS_SSG_MD_ENV_NAME = 'node_md';
9
10
  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 };
11
+
12
+ 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';