@bleedingdev/modern-js-builder 3.8.3-ultramodern.1 → 3.8.3-ultramodern.3
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.
- package/dist/cjs/createBuilder.js +1 -4
- package/dist/cjs/plugins/rscConfig.js +0 -138
- package/dist/cjs/shared/parseCommonConfig.js +4 -12
- package/dist/esm/createBuilder.mjs +1 -4
- package/dist/esm/plugins/rscConfig.mjs +1 -136
- package/dist/esm/shared/parseCommonConfig.mjs +4 -12
- package/dist/esm-node/createBuilder.mjs +1 -4
- package/dist/esm-node/plugins/rscConfig.mjs +1 -136
- package/dist/esm-node/shared/parseCommonConfig.mjs +4 -12
- package/dist/types/plugins/rscConfig.d.ts +0 -32
- package/dist/types/shared/parseCommonConfig.d.ts +0 -2
- package/dist/types/types.d.ts +1 -12
- package/package.json +5 -6
- package/dist/cjs/plugins/environmentBuildCache.js +0 -89
- package/dist/cjs/plugins/rsdoctor.js +0 -68
- package/dist/cjs/plugins/rspack21.js +0 -57
- package/dist/cjs/rsdoctorConfig.js +0 -18
- package/dist/cjs/shared/tsgo.js +0 -212
- package/dist/esm/plugins/environmentBuildCache.mjs +0 -38
- package/dist/esm/plugins/rsdoctor.mjs +0 -30
- package/dist/esm/plugins/rspack21.mjs +0 -19
- package/dist/esm/rsdoctorConfig.mjs +0 -0
- package/dist/esm/shared/tsgo.mjs +0 -160
- package/dist/esm-node/plugins/environmentBuildCache.mjs +0 -39
- package/dist/esm-node/plugins/rsdoctor.mjs +0 -31
- package/dist/esm-node/plugins/rspack21.mjs +0 -20
- package/dist/esm-node/rsdoctorConfig.mjs +0 -1
- package/dist/esm-node/shared/tsgo.mjs +0 -161
- package/dist/types/plugins/environmentBuildCache.d.ts +0 -3
- package/dist/types/plugins/rsdoctor.d.ts +0 -3
- package/dist/types/plugins/rspack21.d.ts +0 -4
- package/dist/types/rsdoctorConfig.d.ts +0 -12
- package/dist/types/shared/tsgo.d.ts +0 -12
|
@@ -12,9 +12,6 @@ const RENDER_RSC_RUNTIME = '@modern-js/render/rsc';
|
|
|
12
12
|
const RENDER_RSC_WORKER_RUNTIME = '@modern-js/render/rsc-worker';
|
|
13
13
|
const RSC_COMMON_LAYER = 'rsc-common';
|
|
14
14
|
const ENTRY_NAME_VAR = '__MODERN_JS_ENTRY_NAME';
|
|
15
|
-
const SERVER_ONLY_MARKER_PATTERN = /(?:^|[/\\])server-only[/\\]index\.js(?:\?|$)/;
|
|
16
|
-
const SERVER_ONLY_MESSAGE_PATTERN = /server-only|server only|only works in a Server Component|cannot be imported (?:directly )?(?:from|into) (?:a )?Client Component/i;
|
|
17
|
-
const SERVER_ONLY_DIAGNOSTIC_PREFIX = '[Modern.js RSC server-only diagnostic context]';
|
|
18
15
|
const ROUTE_DATA_FILE_PATTERN = /[/\\]routes[/\\](?:.*[/\\])?(?:layout|page|\$)\.(?:loader|data)\.[tj]sx?(?:\?.*)?$/;
|
|
19
16
|
const createVirtualModule = (content)=>`data:text/javascript,${encodeURIComponent(content)}`;
|
|
20
17
|
const isAsyncStorageExclude = (exclude)=>{
|
|
@@ -22,134 +19,6 @@ const isAsyncStorageExclude = (exclude)=>{
|
|
|
22
19
|
if (exclude instanceof RegExp) return exclude.test('universal/async_storage') || exclude.test('universal\\async_storage');
|
|
23
20
|
return false;
|
|
24
21
|
};
|
|
25
|
-
const asRecord = (value)=>{
|
|
26
|
-
if (value && 'object' == typeof value && !Array.isArray(value)) return value;
|
|
27
|
-
};
|
|
28
|
-
const disableReactCompilerInSwcLoaders = (value, seen = new WeakSet())=>{
|
|
29
|
-
if (!value || 'object' != typeof value) return;
|
|
30
|
-
if (seen.has(value)) return;
|
|
31
|
-
seen.add(value);
|
|
32
|
-
if (Array.isArray(value)) {
|
|
33
|
-
for (const item of value)disableReactCompilerInSwcLoaders(item, seen);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const record = value;
|
|
37
|
-
if ('builtin:swc-loader' === record.loader) {
|
|
38
|
-
let options = asRecord(record.options);
|
|
39
|
-
if (!options) {
|
|
40
|
-
options = {};
|
|
41
|
-
record.options = options;
|
|
42
|
-
}
|
|
43
|
-
let jsc = asRecord(options.jsc);
|
|
44
|
-
if (!jsc) {
|
|
45
|
-
jsc = {};
|
|
46
|
-
options.jsc = jsc;
|
|
47
|
-
}
|
|
48
|
-
let transform = asRecord(jsc.transform);
|
|
49
|
-
if (!transform) {
|
|
50
|
-
transform = {};
|
|
51
|
-
jsc.transform = transform;
|
|
52
|
-
}
|
|
53
|
-
transform.reactCompiler = false;
|
|
54
|
-
}
|
|
55
|
-
for (const item of Object.values(record))disableReactCompilerInSwcLoaders(item, seen);
|
|
56
|
-
};
|
|
57
|
-
const normalizeDiagnosticText = (diagnostic)=>[
|
|
58
|
-
diagnostic.message,
|
|
59
|
-
diagnostic.details,
|
|
60
|
-
diagnostic.file,
|
|
61
|
-
getModulePath(diagnostic.module),
|
|
62
|
-
getModuleIdentifier(diagnostic.module)
|
|
63
|
-
].filter((item)=>Boolean(item)).join('\n');
|
|
64
|
-
const isServerOnlyDiagnostic = (diagnostic)=>{
|
|
65
|
-
const text = normalizeDiagnosticText(diagnostic);
|
|
66
|
-
return SERVER_ONLY_MARKER_PATTERN.test(text) || SERVER_ONLY_MESSAGE_PATTERN.test(text);
|
|
67
|
-
};
|
|
68
|
-
const isEnrichedServerOnlyDiagnostic = (diagnostic)=>diagnostic.message.includes(SERVER_ONLY_DIAGNOSTIC_PREFIX) || diagnostic.details?.includes(SERVER_ONLY_DIAGNOSTIC_PREFIX);
|
|
69
|
-
const getModulePath = (module)=>{
|
|
70
|
-
if (!module) return;
|
|
71
|
-
return module.resource || module.nameForCondition?.() || module.userRequest;
|
|
72
|
-
};
|
|
73
|
-
const getModuleIdentifier = (module)=>{
|
|
74
|
-
if (!module) return;
|
|
75
|
-
return getModulePath(module) || module.readableIdentifier?.() || module.identifier?.() || module.request || module.rawRequest;
|
|
76
|
-
};
|
|
77
|
-
const formatModuleContext = (module)=>{
|
|
78
|
-
const id = getModuleIdentifier(module);
|
|
79
|
-
if (!id) return;
|
|
80
|
-
const layer = module?.layer ? ` [layer: ${module.layer}]` : '';
|
|
81
|
-
return `${id}${layer}`;
|
|
82
|
-
};
|
|
83
|
-
const getIssuerChain = (compilation, module)=>{
|
|
84
|
-
const chain = [];
|
|
85
|
-
const seen = new Set();
|
|
86
|
-
let current = module;
|
|
87
|
-
while(current && !seen.has(current) && chain.length < 8){
|
|
88
|
-
seen.add(current);
|
|
89
|
-
const issuer = compilation.moduleGraph?.getIssuer?.(current);
|
|
90
|
-
const formatted = formatModuleContext(issuer);
|
|
91
|
-
if (!issuer || !formatted) break;
|
|
92
|
-
chain.push(formatted);
|
|
93
|
-
current = issuer;
|
|
94
|
-
}
|
|
95
|
-
return chain;
|
|
96
|
-
};
|
|
97
|
-
const getModuleTraceChain = (diagnostic)=>{
|
|
98
|
-
const trace = diagnostic.moduleTrace || [];
|
|
99
|
-
const chain = [];
|
|
100
|
-
for (const item of trace){
|
|
101
|
-
const formatted = formatModuleContext(item.origin) || item.originName || formatModuleContext(item.module) || item.moduleName;
|
|
102
|
-
if (formatted && !chain.includes(formatted)) chain.push(formatted);
|
|
103
|
-
}
|
|
104
|
-
return chain.slice(0, 8);
|
|
105
|
-
};
|
|
106
|
-
const appendDiagnosticDetails = (diagnostic, lines)=>{
|
|
107
|
-
const context = `${SERVER_ONLY_DIAGNOSTIC_PREFIX}\n${lines.join('\n')}`;
|
|
108
|
-
diagnostic.details = diagnostic.details ? `${diagnostic.details}\n\n${context}` : context;
|
|
109
|
-
};
|
|
110
|
-
const enrichServerOnlyDiagnostics = (compilation, environmentName)=>{
|
|
111
|
-
const diagnostics = [
|
|
112
|
-
...compilation.warnings,
|
|
113
|
-
...compilation.errors
|
|
114
|
-
];
|
|
115
|
-
for (const diagnostic of diagnostics){
|
|
116
|
-
if (!isServerOnlyDiagnostic(diagnostic) || isEnrichedServerOnlyDiagnostic(diagnostic)) continue;
|
|
117
|
-
const lines = [
|
|
118
|
-
`Environment: ${environmentName || compilation.name || 'unknown'}`
|
|
119
|
-
];
|
|
120
|
-
const markerModule = formatModuleContext(diagnostic.module);
|
|
121
|
-
if (markerModule) lines.push(`Matched module: ${markerModule}`);
|
|
122
|
-
const issuerChain = getIssuerChain(compilation, diagnostic.module);
|
|
123
|
-
const moduleTraceChain = getModuleTraceChain(diagnostic);
|
|
124
|
-
const importerChain = issuerChain.length > 0 ? issuerChain : moduleTraceChain;
|
|
125
|
-
if (importerChain.length > 0) lines.push(`Importer chain: ${importerChain.join(' -> ')}`);
|
|
126
|
-
appendDiagnosticDetails(diagnostic, lines);
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
|
-
const applyServerOnlyDiagnosticPlugin = (compiler, environmentName)=>{
|
|
130
|
-
compiler.hooks.thisCompilation.tap('ModernJsServerOnlyDiagnosticContextPlugin', (compilation)=>{
|
|
131
|
-
compilation.hooks.processWarnings.tap('ModernJsServerOnlyDiagnosticContextPlugin', (warnings)=>{
|
|
132
|
-
enrichServerOnlyDiagnostics({
|
|
133
|
-
errors: compilation.errors,
|
|
134
|
-
moduleGraph: compilation.moduleGraph,
|
|
135
|
-
warnings
|
|
136
|
-
}, environmentName || compilation.name || compiler.name);
|
|
137
|
-
return warnings;
|
|
138
|
-
});
|
|
139
|
-
compilation.hooks.afterSeal.tapPromise('ModernJsServerOnlyDiagnosticContextPlugin', async ()=>{
|
|
140
|
-
enrichServerOnlyDiagnostics(compilation, environmentName || compilation.name || compiler.name);
|
|
141
|
-
});
|
|
142
|
-
});
|
|
143
|
-
};
|
|
144
|
-
const applyServerOnlyDiagnosticPlugins = (compiler, environments)=>{
|
|
145
|
-
const compilers = 'compilers' in compiler ? compiler.compilers : [
|
|
146
|
-
compiler
|
|
147
|
-
];
|
|
148
|
-
compilers.forEach((childCompiler, index)=>{
|
|
149
|
-
const environmentName = childCompiler.name || Object.values(environments).find((environment)=>environment.index === index)?.name;
|
|
150
|
-
applyServerOnlyDiagnosticPlugin(childCompiler, environmentName);
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
22
|
function pluginRscConfig() {
|
|
154
23
|
return {
|
|
155
24
|
name: 'builder:rsc-config',
|
|
@@ -211,7 +80,6 @@ function pluginRscConfig() {
|
|
|
211
80
|
}
|
|
212
81
|
if (config.module?.rules) {
|
|
213
82
|
const rules = config.module.rules;
|
|
214
|
-
disableReactCompilerInSwcLoaders(rules);
|
|
215
83
|
for (const rule of rules)if (rule.layer === Layers.rsc) {
|
|
216
84
|
if (rule.exclude) {
|
|
217
85
|
if (!Array.isArray(rule.exclude)) rule.exclude = [
|
|
@@ -228,9 +96,6 @@ function pluginRscConfig() {
|
|
|
228
96
|
});
|
|
229
97
|
}
|
|
230
98
|
});
|
|
231
|
-
api.onAfterCreateCompiler(({ compiler, environments })=>{
|
|
232
|
-
applyServerOnlyDiagnosticPlugins(compiler, environments);
|
|
233
|
-
});
|
|
234
99
|
api.modifyBundlerChain((chain, { isServer, isWebWorker })=>{
|
|
235
100
|
if (!isServer && !isWebWorker) {
|
|
236
101
|
const entries = chain.entryPoints.entries();
|
|
@@ -277,4 +142,4 @@ function createRscLayerMatchers(internalDirectory) {
|
|
|
277
142
|
isolatedRouteDataReg
|
|
278
143
|
];
|
|
279
144
|
}
|
|
280
|
-
export { createRscLayerMatchers,
|
|
145
|
+
export { createRscLayerMatchers, getRscPlugins, pluginRscConfig };
|
|
@@ -6,14 +6,11 @@ import { pluginReact } from "@rsbuild/plugin-react";
|
|
|
6
6
|
import { pluginSass } from "@rsbuild/plugin-sass";
|
|
7
7
|
import { pluginDevtool } from "../plugins/devtools.mjs";
|
|
8
8
|
import { pluginEmitRouteFile } from "../plugins/emitRouteFile.mjs";
|
|
9
|
-
import { pluginEnvironmentBuildCacheIsolation } from "../plugins/environmentBuildCache.mjs";
|
|
10
9
|
import { pluginEnvironmentDefaults } from "../plugins/environmentDefaults.mjs";
|
|
11
10
|
import { pluginGlobalVars } from "../plugins/globalVars.mjs";
|
|
12
11
|
import { pluginHtmlMinifierTerser } from "../plugins/htmlMinify.mjs";
|
|
13
|
-
import { pluginRspack21 } from "../plugins/rspack21.mjs";
|
|
14
12
|
import { pluginRuntimeChunk } from "../plugins/runtimeChunk.mjs";
|
|
15
13
|
import { transformToRsbuildServerOptions } from "./devServer.mjs";
|
|
16
|
-
import { withTsgoDefaults } from "./tsgo.mjs";
|
|
17
14
|
import { NODE_MODULES_REGEX } from "./utils.mjs";
|
|
18
15
|
const CSS_MODULES_REGEX = /\.modules?\.\w+$/i;
|
|
19
16
|
const GLOBAL_CSS_REGEX = /\.global\.\w+$/;
|
|
@@ -40,7 +37,7 @@ function removeUndefinedKey(obj) {
|
|
|
40
37
|
}
|
|
41
38
|
async function parseCommonConfig(builderConfig, options) {
|
|
42
39
|
const frameworkConfigPath = options?.frameworkConfigPath;
|
|
43
|
-
const { plugins: [...plugins] = [], splitChunks, performance: {
|
|
40
|
+
const { plugins: [...plugins] = [], splitChunks, performance: { ...performanceConfig } = {}, output: { module = false, enableCssModuleTSDeclaration, disableCssModuleExtension, disableTsChecker, disableSvgr, svgDefaultExport, assetsRetry, enableAssetManifest, sourceMap, convertToRem, polyfill, dataUriLimit = 10000, distPath = {}, ...outputConfig } = {}, html: { outputStructure, appIcon, ...htmlConfig } = {}, source: { alias, globalVars, transformImport, reactCompiler, ...sourceConfig } = {}, dev = {}, server = {}, security: { checkSyntax, sri, ...securityConfig } = {}, tools: { devServer, tsChecker, minifyCss, less, sass, htmlPlugin, autoprefixer, ...toolsConfig } = {}, environments = {}, resolve = {} } = builderConfig;
|
|
44
41
|
let combinedAlias;
|
|
45
42
|
if (alias || resolve.alias) combinedAlias = [].concat(alias ?? []).concat(resolve.alias ?? []);
|
|
46
43
|
const rsbuildConfig = {
|
|
@@ -116,12 +113,8 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
116
113
|
rsbuildConfig.dev = removeUndefinedKey(rsbuildDev);
|
|
117
114
|
rsbuildConfig.html = html;
|
|
118
115
|
rsbuildConfig.output = output;
|
|
119
|
-
const { sourceBuild
|
|
116
|
+
const { sourceBuild } = builderConfig.experiments || {};
|
|
120
117
|
const rsbuildPlugins = [
|
|
121
|
-
pluginRspack21({
|
|
122
|
-
sourceImport
|
|
123
|
-
}),
|
|
124
|
-
pluginEnvironmentBuildCacheIsolation(),
|
|
125
118
|
pluginGlobalVars(globalVars),
|
|
126
119
|
pluginDevtool({
|
|
127
120
|
sourceMap
|
|
@@ -143,7 +136,7 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
143
136
|
if (!disableTsChecker) {
|
|
144
137
|
const { pluginTypeCheck } = await import("@rsbuild/plugin-type-check");
|
|
145
138
|
rsbuildPlugins.push(pluginTypeCheck({
|
|
146
|
-
tsCheckerOptions:
|
|
139
|
+
tsCheckerOptions: tsChecker
|
|
147
140
|
}));
|
|
148
141
|
}
|
|
149
142
|
if (convertToRem) {
|
|
@@ -195,8 +188,7 @@ async function parseCommonConfig(builderConfig, options) {
|
|
|
195
188
|
}
|
|
196
189
|
return {
|
|
197
190
|
rsbuildConfig: mergeRsbuildConfig(rsbuildConfig, extraConfig),
|
|
198
|
-
rsbuildPlugins
|
|
199
|
-
rsdoctorConfig
|
|
191
|
+
rsbuildPlugins
|
|
200
192
|
};
|
|
201
193
|
}
|
|
202
194
|
export { isLooseCssModules, parseCommonConfig };
|
|
@@ -1,35 +1,4 @@
|
|
|
1
1
|
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
type RspackDiagnostic = Error & {
|
|
3
|
-
details?: string;
|
|
4
|
-
file?: string;
|
|
5
|
-
module?: DiagnosticModule | null;
|
|
6
|
-
moduleTrace?: Array<{
|
|
7
|
-
module?: DiagnosticModule | null;
|
|
8
|
-
moduleName?: string;
|
|
9
|
-
origin?: DiagnosticModule | null;
|
|
10
|
-
originName?: string;
|
|
11
|
-
}>;
|
|
12
|
-
};
|
|
13
|
-
type DiagnosticModule = {
|
|
14
|
-
resource?: string;
|
|
15
|
-
request?: string;
|
|
16
|
-
userRequest?: string;
|
|
17
|
-
rawRequest?: string;
|
|
18
|
-
layer?: string;
|
|
19
|
-
context?: string;
|
|
20
|
-
identifier?: () => string;
|
|
21
|
-
readableIdentifier?: (requestShortener?: unknown) => string;
|
|
22
|
-
nameForCondition?: () => string | undefined;
|
|
23
|
-
};
|
|
24
|
-
type DiagnosticCompilation = {
|
|
25
|
-
errors: RspackDiagnostic[];
|
|
26
|
-
name?: string;
|
|
27
|
-
moduleGraph?: {
|
|
28
|
-
getIssuer?: (module: DiagnosticModule) => DiagnosticModule | null;
|
|
29
|
-
};
|
|
30
|
-
warnings: RspackDiagnostic[];
|
|
31
|
-
};
|
|
32
|
-
export declare const enrichServerOnlyDiagnostics: (compilation: DiagnosticCompilation, environmentName?: string) => void;
|
|
33
2
|
/**
|
|
34
3
|
* Unified plugin for RSC (React Server Components) configuration
|
|
35
4
|
* Handles:
|
|
@@ -57,4 +26,3 @@ export declare function getRscPlugins(enableRsc: boolean, internalDirectory: str
|
|
|
57
26
|
client?: string;
|
|
58
27
|
}): Promise<RsbuildPlugin[]>;
|
|
59
28
|
export declare function createRscLayerMatchers(internalDirectory: string): RegExp[];
|
|
60
|
-
export {};
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { type RsbuildConfig, type RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
-
import type { RsdoctorUserConfig } from '../rsdoctorConfig';
|
|
3
2
|
import type { BuilderConfig, CreateBuilderCommonOptions } from '../types';
|
|
4
3
|
/** Determine if a file path is a CSS module when disableCssModuleExtension is enabled. */
|
|
5
4
|
export declare const isLooseCssModules: (path: string) => boolean;
|
|
6
5
|
export declare function parseCommonConfig(builderConfig: BuilderConfig, options?: CreateBuilderCommonOptions): Promise<{
|
|
7
6
|
rsbuildConfig: RsbuildConfig;
|
|
8
7
|
rsbuildPlugins: RsbuildPlugin[];
|
|
9
|
-
rsdoctorConfig: RsdoctorUserConfig | undefined;
|
|
10
8
|
}>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -11,8 +11,6 @@ import type { PluginSourceBuildOptions } from '@rsbuild/plugin-source-build';
|
|
|
11
11
|
import type { SvgDefaultExport } from '@rsbuild/plugin-svgr';
|
|
12
12
|
import type { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
|
|
13
13
|
import type { Options as AutoprefixerOptions } from 'autoprefixer';
|
|
14
|
-
import type { RsdoctorUserConfig } from './rsdoctorConfig';
|
|
15
|
-
export type { RsdoctorUserConfig } from './rsdoctorConfig';
|
|
16
14
|
export type CacheGroup = Rspack.OptimizationSplitChunksCacheGroup;
|
|
17
15
|
export type Stats = Omit<Rspack.Stats, '#private' | 'hash' | 'startTime' | 'endTime'>;
|
|
18
16
|
export type RspackConfig = Rspack.Configuration;
|
|
@@ -139,12 +137,6 @@ export type BuilderExtraConfig = {
|
|
|
139
137
|
watch?: boolean;
|
|
140
138
|
};
|
|
141
139
|
};
|
|
142
|
-
performance?: {
|
|
143
|
-
/**
|
|
144
|
-
* Configure Rsdoctor diagnostics for build.
|
|
145
|
-
*/
|
|
146
|
-
rsdoctor?: RsdoctorUserConfig;
|
|
147
|
-
};
|
|
148
140
|
source?: {
|
|
149
141
|
transformImport?: SourceConfig['transformImport'] | false;
|
|
150
142
|
alias?: AliasOption;
|
|
@@ -223,10 +215,6 @@ export type BuilderExtraConfig = {
|
|
|
223
215
|
* Enable the ability for source code building
|
|
224
216
|
*/
|
|
225
217
|
sourceBuild?: boolean | Pick<PluginSourceBuildOptions, 'sourceField' | 'resolvePriority'>;
|
|
226
|
-
/**
|
|
227
|
-
* Configure Rspack source phase imports for WebAssembly modules.
|
|
228
|
-
*/
|
|
229
|
-
sourceImport?: boolean;
|
|
230
218
|
};
|
|
231
219
|
};
|
|
232
220
|
export type SriOptions = {
|
|
@@ -318,3 +306,4 @@ export type BuilderConfig = {
|
|
|
318
306
|
[key: string]: EnvironmentConfig;
|
|
319
307
|
};
|
|
320
308
|
} & BuilderExtraConfig;
|
|
309
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bleedingdev/modern-js-builder",
|
|
3
|
-
"version": "3.8.3-ultramodern.
|
|
3
|
+
"version": "3.8.3-ultramodern.3",
|
|
4
4
|
"description": "A builder for Modern.js",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"dist"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.3-ultramodern.
|
|
29
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.8.3-ultramodern.3",
|
|
30
30
|
"@rsbuild/core": "2.2.0",
|
|
31
31
|
"@rsbuild/plugin-assets-retry": "2.0.2",
|
|
32
32
|
"@rsbuild/plugin-check-syntax": "2.0.1",
|
|
@@ -39,10 +39,8 @@
|
|
|
39
39
|
"@rsbuild/plugin-svgr": "2.0.5",
|
|
40
40
|
"@rsbuild/plugin-type-check": "1.6.0",
|
|
41
41
|
"@rsbuild/plugin-typed-css-modules": "1.2.4",
|
|
42
|
-
"@rsdoctor/rspack-plugin": "^1.5.17",
|
|
43
42
|
"@swc/core": "1.15.43",
|
|
44
43
|
"@swc/helpers": "^0.5.23",
|
|
45
|
-
"@typescript/native-preview": "7.0.0-dev.20260707.2",
|
|
46
44
|
"autoprefixer": "10.5.2",
|
|
47
45
|
"browserslist": "4.28.8",
|
|
48
46
|
"core-js": "^3.49.0",
|
|
@@ -61,7 +59,8 @@
|
|
|
61
59
|
"ts-deepmerge": "8.0.0"
|
|
62
60
|
},
|
|
63
61
|
"devDependencies": {
|
|
64
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.3-ultramodern.
|
|
62
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.8.3-ultramodern.3",
|
|
63
|
+
"@rsdoctor/rspack-plugin": "^1.6.3",
|
|
65
64
|
"@rslib/core": "0.23.2",
|
|
66
65
|
"@scripts/rstest-config": "2.66.0",
|
|
67
66
|
"@types/html-minifier-terser": "^7.0.2",
|
|
@@ -88,7 +87,7 @@
|
|
|
88
87
|
"access": "public"
|
|
89
88
|
},
|
|
90
89
|
"scripts": {
|
|
91
|
-
"build": "rslib build
|
|
90
|
+
"build": "rslib build",
|
|
92
91
|
"dev": "rslib build --watch",
|
|
93
92
|
"test": "rstest run",
|
|
94
93
|
"test:watch": "rstest watch"
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.n = (module)=>{
|
|
5
|
-
var getter = module && module.__esModule ? ()=>module['default'] : ()=>module;
|
|
6
|
-
__webpack_require__.d(getter, {
|
|
7
|
-
a: getter
|
|
8
|
-
});
|
|
9
|
-
return getter;
|
|
10
|
-
};
|
|
11
|
-
})();
|
|
12
|
-
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
-
var define = (defs, kind)=>{
|
|
15
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
[kind]: defs[key]
|
|
18
|
-
});
|
|
19
|
-
};
|
|
20
|
-
define(getters, "get");
|
|
21
|
-
define(values, "value");
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
(()=>{
|
|
25
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
26
|
-
})();
|
|
27
|
-
(()=>{
|
|
28
|
-
__webpack_require__.r = (exports1)=>{
|
|
29
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
30
|
-
value: 'Module'
|
|
31
|
-
});
|
|
32
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
33
|
-
value: true
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
})();
|
|
37
|
-
var __webpack_exports__ = {};
|
|
38
|
-
__webpack_require__.r(__webpack_exports__);
|
|
39
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
-
isolateEnvironmentBuildCacheDirectory: ()=>isolateEnvironmentBuildCacheDirectory,
|
|
41
|
-
pluginEnvironmentBuildCacheIsolation: ()=>pluginEnvironmentBuildCacheIsolation
|
|
42
|
-
});
|
|
43
|
-
const external_node_path_namespaceObject = require("node:path");
|
|
44
|
-
var external_node_path_default = /*#__PURE__*/ __webpack_require__.n(external_node_path_namespaceObject);
|
|
45
|
-
const DEFAULT_RSPACK_CACHE_DIRECTORY = 'node_modules/.cache/rspack';
|
|
46
|
-
function sanitizeCachePathSegment(value) {
|
|
47
|
-
return value.replace(/[^a-zA-Z0-9._-]+/gu, '_');
|
|
48
|
-
}
|
|
49
|
-
function pathEndsWithSegment(filePath, segment) {
|
|
50
|
-
const normalized = filePath.replace(/[\\/]+$/u, '');
|
|
51
|
-
return normalized.split(/[\\/]+/u).at(-1) === segment;
|
|
52
|
-
}
|
|
53
|
-
function isolateEnvironmentBuildCacheDirectory(cacheDirectory, environmentName) {
|
|
54
|
-
const segment = sanitizeCachePathSegment(environmentName);
|
|
55
|
-
const baseDirectory = cacheDirectory || DEFAULT_RSPACK_CACHE_DIRECTORY;
|
|
56
|
-
return pathEndsWithSegment(baseDirectory, segment) ? baseDirectory : external_node_path_default().join(baseDirectory, segment);
|
|
57
|
-
}
|
|
58
|
-
const pluginEnvironmentBuildCacheIsolation = ()=>({
|
|
59
|
-
name: 'modern-js:environment-build-cache-isolation',
|
|
60
|
-
setup (api) {
|
|
61
|
-
api.modifyEnvironmentConfig({
|
|
62
|
-
order: 'post',
|
|
63
|
-
handler: (config, { name })=>{
|
|
64
|
-
const buildCache = config.performance.buildCache;
|
|
65
|
-
if (false === buildCache || void 0 === buildCache) return;
|
|
66
|
-
const buildCacheConfig = true === buildCache ? {} : buildCache;
|
|
67
|
-
return {
|
|
68
|
-
...config,
|
|
69
|
-
performance: {
|
|
70
|
-
...config.performance,
|
|
71
|
-
buildCache: {
|
|
72
|
-
...buildCacheConfig,
|
|
73
|
-
cacheDirectory: isolateEnvironmentBuildCacheDirectory(buildCacheConfig.cacheDirectory, name)
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
});
|
|
81
|
-
exports.isolateEnvironmentBuildCacheDirectory = __webpack_exports__.isolateEnvironmentBuildCacheDirectory;
|
|
82
|
-
exports.pluginEnvironmentBuildCacheIsolation = __webpack_exports__.pluginEnvironmentBuildCacheIsolation;
|
|
83
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
84
|
-
"isolateEnvironmentBuildCacheDirectory",
|
|
85
|
-
"pluginEnvironmentBuildCacheIsolation"
|
|
86
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
87
|
-
Object.defineProperty(exports, '__esModule', {
|
|
88
|
-
value: true
|
|
89
|
-
});
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const isRsdoctorEnabled = (config)=>{
|
|
31
|
-
if (void 0 === config) return false;
|
|
32
|
-
if ('boolean' == typeof config) return config;
|
|
33
|
-
if ('boolean' == typeof config?.enabled) return config.enabled;
|
|
34
|
-
return true;
|
|
35
|
-
};
|
|
36
|
-
const getRsdoctorPluginOptions = (config)=>{
|
|
37
|
-
if (config && 'object' == typeof config) return {
|
|
38
|
-
disableClientServer: config.disableClientServer ?? true
|
|
39
|
-
};
|
|
40
|
-
return {
|
|
41
|
-
disableClientServer: true
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const pluginRsdoctor = (config)=>{
|
|
45
|
-
if (!isRsdoctorEnabled(config)) return null;
|
|
46
|
-
const pluginOptions = getRsdoctorPluginOptions(config);
|
|
47
|
-
return {
|
|
48
|
-
name: 'builder:rsdoctor',
|
|
49
|
-
setup (api) {
|
|
50
|
-
api.modifyBundlerChain(async (chain)=>{
|
|
51
|
-
const { RsdoctorRspackPlugin } = await import("@rsdoctor/rspack-plugin");
|
|
52
|
-
chain.plugin('rsdoctor').use(RsdoctorRspackPlugin, [
|
|
53
|
-
pluginOptions
|
|
54
|
-
]);
|
|
55
|
-
});
|
|
56
|
-
}
|
|
57
|
-
};
|
|
58
|
-
};
|
|
59
|
-
__webpack_require__.d(__webpack_exports__, {}, {
|
|
60
|
-
pluginRsdoctor: pluginRsdoctor
|
|
61
|
-
});
|
|
62
|
-
exports.pluginRsdoctor = __webpack_exports__.pluginRsdoctor;
|
|
63
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
64
|
-
"pluginRsdoctor"
|
|
65
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
66
|
-
Object.defineProperty(exports, '__esModule', {
|
|
67
|
-
value: true
|
|
68
|
-
});
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
-
var define = (defs, kind)=>{
|
|
6
|
-
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
[kind]: defs[key]
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
define(getters, "get");
|
|
12
|
-
define(values, "value");
|
|
13
|
-
};
|
|
14
|
-
})();
|
|
15
|
-
(()=>{
|
|
16
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
17
|
-
})();
|
|
18
|
-
(()=>{
|
|
19
|
-
__webpack_require__.r = (exports1)=>{
|
|
20
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
21
|
-
value: 'Module'
|
|
22
|
-
});
|
|
23
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
24
|
-
value: true
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
})();
|
|
28
|
-
var __webpack_exports__ = {};
|
|
29
|
-
__webpack_require__.r(__webpack_exports__);
|
|
30
|
-
const PERSISTENT_CACHE_MAX_AGE = 604800;
|
|
31
|
-
const pluginRspack21 = ({ sourceImport } = {})=>({
|
|
32
|
-
name: 'modern-js:rspack-2-1-defaults',
|
|
33
|
-
setup (api) {
|
|
34
|
-
api.modifyRspackConfig((config)=>{
|
|
35
|
-
config.module ??= {};
|
|
36
|
-
config.module.parser ??= {};
|
|
37
|
-
config.module.parser.javascript ??= {};
|
|
38
|
-
config.module.parser.javascript.createRequire ??= true;
|
|
39
|
-
if ('object' == typeof config.cache && null !== config.cache && 'persistent' === config.cache.type) config.cache.maxAge ??= PERSISTENT_CACHE_MAX_AGE;
|
|
40
|
-
if (void 0 !== sourceImport) {
|
|
41
|
-
config.experiments ??= {};
|
|
42
|
-
config.experiments.sourceImport = sourceImport;
|
|
43
|
-
}
|
|
44
|
-
return config;
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
});
|
|
48
|
-
__webpack_require__.d(__webpack_exports__, {}, {
|
|
49
|
-
pluginRspack21: pluginRspack21
|
|
50
|
-
});
|
|
51
|
-
exports.pluginRspack21 = __webpack_exports__.pluginRspack21;
|
|
52
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
53
|
-
"pluginRspack21"
|
|
54
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
55
|
-
Object.defineProperty(exports, '__esModule', {
|
|
56
|
-
value: true
|
|
57
|
-
});
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.r = (exports1)=>{
|
|
5
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
6
|
-
value: 'Module'
|
|
7
|
-
});
|
|
8
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
9
|
-
value: true
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
})();
|
|
13
|
-
var __webpack_exports__ = {};
|
|
14
|
-
__webpack_require__.r(__webpack_exports__);
|
|
15
|
-
for(var __rspack_i in __webpack_exports__)exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
16
|
-
Object.defineProperty(exports, '__esModule', {
|
|
17
|
-
value: true
|
|
18
|
-
});
|