@bleedingdev/modern-js-builder 3.2.0-ultramodern.2 → 3.2.0-ultramodern.22
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/plugins/environmentDefaults.js +5 -1
- package/dist/cjs/plugins/rscConfig.js +6 -1
- package/dist/esm/plugins/environmentDefaults.mjs +5 -1
- package/dist/esm/plugins/rscConfig.mjs +6 -1
- package/dist/esm-node/plugins/environmentDefaults.mjs +5 -1
- package/dist/esm-node/plugins/rscConfig.mjs +6 -1
- package/dist/types/createBuilder.d.ts +8 -0
- package/dist/types/index.d.ts +8 -0
- package/dist/types/plugins/devtools.d.ts +4 -0
- package/dist/types/plugins/emitRouteFile.d.ts +6 -0
- package/dist/types/plugins/environmentDefaults.d.ts +3 -0
- package/dist/types/plugins/globalVars.d.ts +3 -0
- package/dist/types/plugins/htmlMinify.d.ts +2 -0
- package/dist/types/plugins/manifest.d.ts +2 -0
- package/dist/types/plugins/postcss.d.ts +6 -0
- package/dist/types/plugins/rscConfig.d.ts +18 -0
- package/dist/types/plugins/rsdoctor.d.ts +3 -0
- package/dist/types/plugins/runtimeChunk.d.ts +2 -0
- package/dist/types/shared/devServer.d.ts +6 -0
- package/dist/types/shared/getCssSupport.d.ts +1 -0
- package/dist/types/shared/manifest.d.ts +2 -0
- package/dist/types/shared/parseCommonConfig.d.ts +9 -0
- package/dist/types/shared/rsc/rsc-server-entry-loader.d.ts +5 -0
- package/dist/types/shared/rsc/rscClientBrowserFallback.d.ts +2 -0
- package/dist/types/shared/rsc/rscEmptyModule.d.ts +2 -0
- package/dist/types/shared/utils.d.ts +12 -0
- package/dist/types/types.d.ts +287 -0
- package/package.json +9 -9
|
@@ -84,7 +84,11 @@ const pluginEnvironmentDefaults = (distPath = {})=>({
|
|
|
84
84
|
});
|
|
85
85
|
api.modifyBundlerChain(async (chain, { environment })=>{
|
|
86
86
|
const isServiceWorker = environment.name === utils_js_namespaceObject.SERVICE_WORKER_ENVIRONMENT_NAME;
|
|
87
|
-
if (isServiceWorker) chain.output.library({
|
|
87
|
+
if (isServiceWorker && true === chain.output.get('module')) chain.output.library({
|
|
88
|
+
...chain.output.get('library') || {},
|
|
89
|
+
type: 'module'
|
|
90
|
+
});
|
|
91
|
+
else if (isServiceWorker) chain.output.library({
|
|
88
92
|
...chain.output.get('library') || {},
|
|
89
93
|
type: 'commonjs2'
|
|
90
94
|
});
|
|
@@ -39,6 +39,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
39
39
|
const external_path_namespaceObject = require("path");
|
|
40
40
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
41
41
|
const ASYNC_STORAGE_PATTERN = /universal[/\\]async_storage/;
|
|
42
|
+
const SERVER_LOADER_ENTRY_PATTERN = /[/\\](?:server-loader-combined|route-server-loaders)\.js$/;
|
|
43
|
+
const RENDER_RSC_SOURCE_PATTERN = /render[/\\].*[/\\]server[/\\]rsc/;
|
|
44
|
+
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc\.mjs$/;
|
|
42
45
|
const RSC_COMMON_LAYER = 'rsc-common';
|
|
43
46
|
const ENTRY_NAME_VAR = '__MODERN_JS_ENTRY_NAME';
|
|
44
47
|
const createVirtualModule = (content)=>`data:text/javascript,${encodeURIComponent(content)}`;
|
|
@@ -136,8 +139,10 @@ async function getRscPlugins(enableRsc, internalDirectory) {
|
|
|
136
139
|
return [
|
|
137
140
|
pluginRSC({
|
|
138
141
|
layers: {
|
|
142
|
+
ssr: SERVER_LOADER_ENTRY_PATTERN,
|
|
139
143
|
rsc: [
|
|
140
|
-
|
|
144
|
+
RENDER_RSC_SOURCE_PATTERN,
|
|
145
|
+
RENDER_RSC_RSLIB_ENTRY_PATTERN,
|
|
141
146
|
/AppProxy/,
|
|
142
147
|
routesFileReg
|
|
143
148
|
]
|
|
@@ -56,7 +56,11 @@ const pluginEnvironmentDefaults = (distPath = {})=>({
|
|
|
56
56
|
});
|
|
57
57
|
api.modifyBundlerChain(async (chain, { environment })=>{
|
|
58
58
|
const isServiceWorker = environment.name === SERVICE_WORKER_ENVIRONMENT_NAME;
|
|
59
|
-
if (isServiceWorker) chain.output.library({
|
|
59
|
+
if (isServiceWorker && true === chain.output.get('module')) chain.output.library({
|
|
60
|
+
...chain.output.get('library') || {},
|
|
61
|
+
type: 'module'
|
|
62
|
+
});
|
|
63
|
+
else if (isServiceWorker) chain.output.library({
|
|
60
64
|
...chain.output.get('library') || {},
|
|
61
65
|
type: 'commonjs2'
|
|
62
66
|
});
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import path from "path";
|
|
2
2
|
const ASYNC_STORAGE_PATTERN = /universal[/\\]async_storage/;
|
|
3
|
+
const SERVER_LOADER_ENTRY_PATTERN = /[/\\](?:server-loader-combined|route-server-loaders)\.js$/;
|
|
4
|
+
const RENDER_RSC_SOURCE_PATTERN = /render[/\\].*[/\\]server[/\\]rsc/;
|
|
5
|
+
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc\.mjs$/;
|
|
3
6
|
const RSC_COMMON_LAYER = 'rsc-common';
|
|
4
7
|
const ENTRY_NAME_VAR = '__MODERN_JS_ENTRY_NAME';
|
|
5
8
|
const createVirtualModule = (content)=>`data:text/javascript,${encodeURIComponent(content)}`;
|
|
@@ -97,8 +100,10 @@ async function getRscPlugins(enableRsc, internalDirectory) {
|
|
|
97
100
|
return [
|
|
98
101
|
pluginRSC({
|
|
99
102
|
layers: {
|
|
103
|
+
ssr: SERVER_LOADER_ENTRY_PATTERN,
|
|
100
104
|
rsc: [
|
|
101
|
-
|
|
105
|
+
RENDER_RSC_SOURCE_PATTERN,
|
|
106
|
+
RENDER_RSC_RSLIB_ENTRY_PATTERN,
|
|
102
107
|
/AppProxy/,
|
|
103
108
|
routesFileReg
|
|
104
109
|
]
|
|
@@ -57,7 +57,11 @@ const pluginEnvironmentDefaults = (distPath = {})=>({
|
|
|
57
57
|
});
|
|
58
58
|
api.modifyBundlerChain(async (chain, { environment })=>{
|
|
59
59
|
const isServiceWorker = environment.name === SERVICE_WORKER_ENVIRONMENT_NAME;
|
|
60
|
-
if (isServiceWorker) chain.output.library({
|
|
60
|
+
if (isServiceWorker && true === chain.output.get('module')) chain.output.library({
|
|
61
|
+
...chain.output.get('library') || {},
|
|
62
|
+
type: 'module'
|
|
63
|
+
});
|
|
64
|
+
else if (isServiceWorker) chain.output.library({
|
|
61
65
|
...chain.output.get('library') || {},
|
|
62
66
|
type: 'commonjs2'
|
|
63
67
|
});
|
|
@@ -5,6 +5,9 @@ import { fileURLToPath as __rspack_fileURLToPath } from "node:url";
|
|
|
5
5
|
import { dirname as __rspack_dirname } from "node:path";
|
|
6
6
|
var rscConfig_dirname = __rspack_dirname(__rspack_fileURLToPath(import.meta.url));
|
|
7
7
|
const ASYNC_STORAGE_PATTERN = /universal[/\\]async_storage/;
|
|
8
|
+
const SERVER_LOADER_ENTRY_PATTERN = /[/\\](?:server-loader-combined|route-server-loaders)\.js$/;
|
|
9
|
+
const RENDER_RSC_SOURCE_PATTERN = /render[/\\].*[/\\]server[/\\]rsc/;
|
|
10
|
+
const RENDER_RSC_RSLIB_ENTRY_PATTERN = /render[/\\]dist[/\\]esm[/\\]rsc\.mjs$/;
|
|
8
11
|
const RSC_COMMON_LAYER = 'rsc-common';
|
|
9
12
|
const ENTRY_NAME_VAR = '__MODERN_JS_ENTRY_NAME';
|
|
10
13
|
const createVirtualModule = (content)=>`data:text/javascript,${encodeURIComponent(content)}`;
|
|
@@ -102,8 +105,10 @@ async function getRscPlugins(enableRsc, internalDirectory) {
|
|
|
102
105
|
return [
|
|
103
106
|
pluginRSC({
|
|
104
107
|
layers: {
|
|
108
|
+
ssr: SERVER_LOADER_ENTRY_PATTERN,
|
|
105
109
|
rsc: [
|
|
106
|
-
|
|
110
|
+
RENDER_RSC_SOURCE_PATTERN,
|
|
111
|
+
RENDER_RSC_RSLIB_ENTRY_PATTERN,
|
|
107
112
|
/AppProxy/,
|
|
108
113
|
routesFileReg
|
|
109
114
|
]
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { RsbuildConfig, RsbuildInstance, RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import type { BuilderConfig, CreateBuilderCommonOptions, CreateBuilderOptions } from './types';
|
|
3
|
+
export declare function parseConfig(builderConfig: BuilderConfig, options: CreateBuilderCommonOptions): Promise<{
|
|
4
|
+
rsbuildConfig: RsbuildConfig;
|
|
5
|
+
rsbuildPlugins: RsbuildPlugin[];
|
|
6
|
+
}>;
|
|
7
|
+
export type BuilderInstance = RsbuildInstance;
|
|
8
|
+
export declare function createRspackBuilder(options: CreateBuilderOptions): Promise<BuilderInstance>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type BuilderInstance, createRspackBuilder } from './createBuilder';
|
|
2
|
+
import type { CreateBuilderOptions } from './types';
|
|
3
|
+
export { type ChainIdentifier, type ConfigChain, logger, type NormalizedConfig, type RsbuildConfig, type RsbuildContext, type RsbuildPlugin, type RsbuildPlugins, type RsbuildTarget, type Rspack, type RspackChain, } from '@rsbuild/core';
|
|
4
|
+
export { parseConfig as parseRspackConfig } from './createBuilder';
|
|
5
|
+
export { castArray, isHtmlDisabled, RUNTIME_CHUNK_NAME, RUNTIME_CHUNK_REGEX, SERVICE_WORKER_ENVIRONMENT_NAME, } from './shared/utils';
|
|
6
|
+
export type { BuilderConfig, BundlerType, CacheGroup, MetaOptions, MultiStats, RspackConfig, Stats, ToolsDevServerConfig, } from './types';
|
|
7
|
+
export type { BuilderInstance, CreateBuilderOptions };
|
|
8
|
+
export { createRspackBuilder as createBuilder };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import type { ToolsAutoprefixerConfig } from '../types';
|
|
3
|
+
export interface PluginPostcssOptions {
|
|
4
|
+
autoprefixer?: ToolsAutoprefixerConfig;
|
|
5
|
+
}
|
|
6
|
+
export declare const pluginPostcss: (options?: PluginPostcssOptions) => RsbuildPlugin;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
/**
|
|
3
|
+
* Unified plugin for RSC (React Server Components) configuration
|
|
4
|
+
* Handles:
|
|
5
|
+
* 1. Adding layer configuration to server-side entries
|
|
6
|
+
* 2. Excluding /universal[/\\]async_storage/ from react-server-components layer
|
|
7
|
+
* 3. Adding rsc-common layer for /universal[/\\]async_storage/
|
|
8
|
+
* 4. Adding entry name virtual module for client-side entries
|
|
9
|
+
* 5. Adding 'use server-entry' directive to route components
|
|
10
|
+
*/
|
|
11
|
+
export declare function pluginRscConfig(): RsbuildPlugin;
|
|
12
|
+
/**
|
|
13
|
+
* Get RSC plugins based on configuration
|
|
14
|
+
* @param enableRsc - Whether RSC is enabled
|
|
15
|
+
* @param internalDirectory - Internal directory path for route matching
|
|
16
|
+
* @returns Array of RSC-related plugins
|
|
17
|
+
*/
|
|
18
|
+
export declare function getRscPlugins(enableRsc: boolean, internalDirectory: string): Promise<RsbuildPlugin[]>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { DevConfig, ServerConfig } from '@rsbuild/core';
|
|
2
|
+
import type { BuilderConfig, ToolsDevServerConfig } from '../types';
|
|
3
|
+
export declare const transformToRsbuildServerOptions: (dev: NonNullable<BuilderConfig['dev']>, devServer: ToolsDevServerConfig, server?: BuilderConfig['server']) => {
|
|
4
|
+
rsbuildDev: DevConfig;
|
|
5
|
+
rsbuildServer: ServerConfig;
|
|
6
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getCssSupport(projectBrowserslist: string[]): Record<"customProperties" | "fontVariant" | "initial" | "mediaMinmax" | "pageBreak", boolean>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type RsbuildConfig, type RsbuildPlugin } from '@rsbuild/core';
|
|
2
|
+
import type { BuilderConfig, CreateBuilderCommonOptions, RsdoctorUserConfig } from '../types';
|
|
3
|
+
/** Determine if a file path is a CSS module when disableCssModuleExtension is enabled. */
|
|
4
|
+
export declare const isLooseCssModules: (path: string) => boolean;
|
|
5
|
+
export declare function parseCommonConfig(builderConfig: BuilderConfig, options?: CreateBuilderCommonOptions): Promise<{
|
|
6
|
+
rsbuildConfig: RsbuildConfig;
|
|
7
|
+
rsbuildPlugins: RsbuildPlugin[];
|
|
8
|
+
rsdoctorConfig: RsdoctorUserConfig | undefined;
|
|
9
|
+
}>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { NormalizedEnvironmentConfig, RsbuildTarget } from '@rsbuild/core';
|
|
2
|
+
export declare const RUNTIME_CHUNK_NAME = "builder-runtime";
|
|
3
|
+
export declare const RUNTIME_CHUNK_REGEX: RegExp;
|
|
4
|
+
export declare const SERVICE_WORKER_ENVIRONMENT_NAME = "workerSSR";
|
|
5
|
+
export declare const NODE_MODULES_REGEX: RegExp;
|
|
6
|
+
export declare const castArray: <T>(arr?: T | T[]) => T[];
|
|
7
|
+
export declare const isHtmlDisabled: (config: NormalizedEnvironmentConfig, target: RsbuildTarget) => boolean;
|
|
8
|
+
export declare function getBrowserslistWithDefault(path: string, config: {
|
|
9
|
+
output?: {
|
|
10
|
+
overrideBrowserslist?: string[];
|
|
11
|
+
};
|
|
12
|
+
}, target: RsbuildTarget): Promise<string[]>;
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
import type { AliasOption } from '@modern-js/utils';
|
|
2
|
+
import type { ConfigChain, ConfigChainWithContext, DevConfig, DistPathConfig, EnvironmentConfig, HtmlConfig, OutputConfig, Polyfill, RsbuildConfig, RsbuildPluginAPI, RsbuildPlugins, RsbuildTarget, Rspack, SecurityConfig, ServerConfig, SourceConfig, ToolsConfig } from '@rsbuild/core';
|
|
3
|
+
import type { PluginAssetsRetryOptions } from '@rsbuild/plugin-assets-retry';
|
|
4
|
+
import type { PluginCheckSyntaxOptions } from '@rsbuild/plugin-check-syntax';
|
|
5
|
+
import type { PluginCssMinimizerOptions } from '@rsbuild/plugin-css-minimizer';
|
|
6
|
+
import type { PluginLessOptions } from '@rsbuild/plugin-less';
|
|
7
|
+
import type { PluginRemOptions } from '@rsbuild/plugin-rem';
|
|
8
|
+
import type { PluginSassOptions } from '@rsbuild/plugin-sass';
|
|
9
|
+
import type { PluginSourceBuildOptions } from '@rsbuild/plugin-source-build';
|
|
10
|
+
import type { SvgDefaultExport } from '@rsbuild/plugin-svgr';
|
|
11
|
+
import type { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
|
|
12
|
+
import type { Options as AutoprefixerOptions } from 'autoprefixer';
|
|
13
|
+
export type CacheGroup = Rspack.OptimizationSplitChunksCacheGroup;
|
|
14
|
+
export type Stats = Omit<Rspack.Stats, '#private' | 'hash' | 'startTime' | 'endTime'>;
|
|
15
|
+
export type RspackConfig = Rspack.Configuration;
|
|
16
|
+
export type MultiStats = Rspack.MultiStats;
|
|
17
|
+
/**
|
|
18
|
+
* custom properties
|
|
19
|
+
* e.g. { name: 'viewport' content: 'width=500, initial-scale=1' }
|
|
20
|
+
* */
|
|
21
|
+
type MetaAttrs = {
|
|
22
|
+
[attrName: string]: string | boolean;
|
|
23
|
+
};
|
|
24
|
+
export type MetaOptions = {
|
|
25
|
+
/**
|
|
26
|
+
* name content pair
|
|
27
|
+
* e.g. { viewport: 'width=device-width, initial-scale=1, shrink-to-fit=no' }`
|
|
28
|
+
* */
|
|
29
|
+
[name: string]: string | false | MetaAttrs;
|
|
30
|
+
};
|
|
31
|
+
export type CreateBuilderCommonOptions = {
|
|
32
|
+
frameworkConfigPath?: string;
|
|
33
|
+
/** The root path of current project. */
|
|
34
|
+
cwd: string;
|
|
35
|
+
rscClientRuntimePath?: string;
|
|
36
|
+
rscServerRuntimePath?: string;
|
|
37
|
+
internalDirectory?: string;
|
|
38
|
+
};
|
|
39
|
+
export type BundlerType = 'rspack';
|
|
40
|
+
export type CreateBuilderOptions = {
|
|
41
|
+
rscClientRuntimePath?: string;
|
|
42
|
+
rscServerRuntimePath?: string;
|
|
43
|
+
bundlerType: BundlerType;
|
|
44
|
+
config: BuilderConfig;
|
|
45
|
+
} & Partial<CreateBuilderCommonOptions>;
|
|
46
|
+
export type GlobalVars = Record<string, any>;
|
|
47
|
+
export type ChainedGlobalVars = ConfigChainWithContext<GlobalVars, {
|
|
48
|
+
env: string;
|
|
49
|
+
target: RsbuildTarget;
|
|
50
|
+
}>;
|
|
51
|
+
export type MainFields = (string | string[])[];
|
|
52
|
+
export type DevServerHttpsOptions = boolean | {
|
|
53
|
+
key: string;
|
|
54
|
+
cert: string;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @deprecated This configuration is deprecated, please use `dev.server` instead.
|
|
58
|
+
*/
|
|
59
|
+
export type ToolsDevServerConfig = ConfigChain<{
|
|
60
|
+
/**
|
|
61
|
+
* @deprecated Use `dev.server.compress` instead.
|
|
62
|
+
*/
|
|
63
|
+
compress?: ServerConfig['compress'];
|
|
64
|
+
/**
|
|
65
|
+
* @deprecated Use `dev.server.headers` instead.
|
|
66
|
+
*/
|
|
67
|
+
headers?: ServerConfig['headers'];
|
|
68
|
+
/**
|
|
69
|
+
* @deprecated Use `dev.server.historyApiFallback` instead.
|
|
70
|
+
*/
|
|
71
|
+
historyApiFallback?: ServerConfig['historyApiFallback'];
|
|
72
|
+
/**
|
|
73
|
+
* @deprecated Use `dev.server.proxy` instead.
|
|
74
|
+
*/
|
|
75
|
+
proxy?: ServerConfig['proxy'];
|
|
76
|
+
/**
|
|
77
|
+
* @deprecated Use `dev.server.watch` instead.
|
|
78
|
+
*/
|
|
79
|
+
watch?: boolean;
|
|
80
|
+
}>;
|
|
81
|
+
export type ToolsAutoprefixerConfig = ConfigChain<AutoprefixerOptions>;
|
|
82
|
+
export type RsdoctorUserConfig = boolean | {
|
|
83
|
+
/**
|
|
84
|
+
* Force enable / disable Rsdoctor.
|
|
85
|
+
* By default, Modern.js enables Rsdoctor in production builds.
|
|
86
|
+
*/
|
|
87
|
+
enabled?: boolean;
|
|
88
|
+
/**
|
|
89
|
+
* Disable Rsdoctor client server and ensure build process exits after report generation.
|
|
90
|
+
* @default true
|
|
91
|
+
*/
|
|
92
|
+
disableClientServer?: boolean;
|
|
93
|
+
};
|
|
94
|
+
export type BuilderExtraConfig = {
|
|
95
|
+
tools?: {
|
|
96
|
+
/**
|
|
97
|
+
* Modify the config of [autoprefixer](https://github.com/postcss/autoprefixer)
|
|
98
|
+
*/
|
|
99
|
+
autoprefixer?: ToolsAutoprefixerConfig;
|
|
100
|
+
htmlPlugin?: ToolsConfig['htmlPlugin'];
|
|
101
|
+
/**
|
|
102
|
+
* @deprecated Use `dev.server` instead.
|
|
103
|
+
*/
|
|
104
|
+
devServer?: ToolsDevServerConfig;
|
|
105
|
+
/**
|
|
106
|
+
* Modify the options of [fork-ts-checker-webpack-plugin](https://github.com/TypeStrong/fork-ts-checker-webpack-plugin).
|
|
107
|
+
*/
|
|
108
|
+
tsChecker?: PluginTypeCheckerOptions['tsCheckerOptions'];
|
|
109
|
+
/**
|
|
110
|
+
* Modify the options of [css-minimizer-webpack-plugin](https://github.com/webpack-contrib/css-minimizer-webpack-plugin).
|
|
111
|
+
*/
|
|
112
|
+
minifyCss?: PluginCssMinimizerOptions['pluginOptions'];
|
|
113
|
+
/**
|
|
114
|
+
* Modify the config of [less-loader](https://github.com/webpack-contrib/less-loader).
|
|
115
|
+
*/
|
|
116
|
+
less?: PluginLessOptions['lessLoaderOptions'];
|
|
117
|
+
/**
|
|
118
|
+
* Modify the config of [sass-loader](https://github.com/webpack-contrib/sass-loader).
|
|
119
|
+
*/
|
|
120
|
+
sass?: PluginSassOptions['sassLoaderOptions'];
|
|
121
|
+
};
|
|
122
|
+
dev?: {
|
|
123
|
+
/** Set the page URL to open when the server starts. */
|
|
124
|
+
startUrl?: boolean | string | string[];
|
|
125
|
+
/** Execute a callback function before opening the `startUrl`. */
|
|
126
|
+
beforeStartUrl?: () => Promise<void> | void;
|
|
127
|
+
/**
|
|
128
|
+
* Used to set the host of Dev Server.
|
|
129
|
+
*/
|
|
130
|
+
host?: string;
|
|
131
|
+
/**
|
|
132
|
+
* After configuring this option, you can enable HTTPS Dev Server, and disabling the HTTP Dev Server.
|
|
133
|
+
*/
|
|
134
|
+
https?: DevServerHttpsOptions;
|
|
135
|
+
/**
|
|
136
|
+
* Server configuration for Dev Server.
|
|
137
|
+
*/
|
|
138
|
+
server?: {
|
|
139
|
+
compress?: ServerConfig['compress'];
|
|
140
|
+
headers?: ServerConfig['headers'];
|
|
141
|
+
historyApiFallback?: ServerConfig['historyApiFallback'];
|
|
142
|
+
proxy?: ServerConfig['proxy'];
|
|
143
|
+
watch?: boolean;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
performance?: {
|
|
147
|
+
/**
|
|
148
|
+
* Configure Rsdoctor diagnostics for build.
|
|
149
|
+
*/
|
|
150
|
+
rsdoctor?: RsdoctorUserConfig;
|
|
151
|
+
};
|
|
152
|
+
source?: {
|
|
153
|
+
transformImport?: SourceConfig['transformImport'] | false;
|
|
154
|
+
alias?: AliasOption;
|
|
155
|
+
/**
|
|
156
|
+
* Define global variables. It can replace expressions like `process.env.FOO` in your code after compile.
|
|
157
|
+
*/
|
|
158
|
+
globalVars?: ChainedGlobalVars;
|
|
159
|
+
};
|
|
160
|
+
output?: {
|
|
161
|
+
/**
|
|
162
|
+
* Whether to generate a TypeScript declaration file for CSS Modules.
|
|
163
|
+
*/
|
|
164
|
+
enableCssModuleTSDeclaration?: boolean;
|
|
165
|
+
/**
|
|
166
|
+
* Whether to generate a manifest file that contains information of all assets.
|
|
167
|
+
*/
|
|
168
|
+
enableAssetManifest?: boolean;
|
|
169
|
+
/**
|
|
170
|
+
* Configure the retry of assets.
|
|
171
|
+
*/
|
|
172
|
+
assetsRetry?: PluginAssetsRetryOptions;
|
|
173
|
+
/**
|
|
174
|
+
* Controls whether to the inline the runtime chunk to HTML.
|
|
175
|
+
*/
|
|
176
|
+
disableInlineRuntimeChunk?: boolean;
|
|
177
|
+
/**
|
|
178
|
+
* Convert px to rem in CSS.
|
|
179
|
+
*/
|
|
180
|
+
convertToRem?: boolean | PluginRemOptions;
|
|
181
|
+
/**
|
|
182
|
+
* Whether to treat all .css files in the source directory as CSS Modules.
|
|
183
|
+
*/
|
|
184
|
+
disableCssModuleExtension?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Whether to disable TypeScript Type Checker.
|
|
187
|
+
*/
|
|
188
|
+
disableTsChecker?: boolean;
|
|
189
|
+
/**
|
|
190
|
+
* Configure the default export type of SVG files.
|
|
191
|
+
*/
|
|
192
|
+
svgDefaultExport?: SvgDefaultExport;
|
|
193
|
+
/**
|
|
194
|
+
* Whether to transform SVGs into React components. If true, will treat all .svg files as assets.
|
|
195
|
+
*/
|
|
196
|
+
disableSvgr?: boolean;
|
|
197
|
+
};
|
|
198
|
+
html?: {
|
|
199
|
+
appIcon?: HtmlConfig['appIcon'];
|
|
200
|
+
favicon?: string;
|
|
201
|
+
};
|
|
202
|
+
security?: {
|
|
203
|
+
/**
|
|
204
|
+
* Adding an integrity attribute (`integrity`) to sub-resources introduced by HTML allows the browser to
|
|
205
|
+
* verify the integrity of the introduced resource, thus preventing tampering with the downloaded resource.
|
|
206
|
+
*
|
|
207
|
+
* Tips: this configuration is not yet supported in rspack
|
|
208
|
+
*/
|
|
209
|
+
sri?: SriOptions | boolean;
|
|
210
|
+
/**
|
|
211
|
+
* Analyze the build artifacts to identify advanced syntax that is incompatible with the current browser scope.
|
|
212
|
+
*/
|
|
213
|
+
checkSyntax?: boolean | PluginCheckSyntaxOptions;
|
|
214
|
+
};
|
|
215
|
+
experiments?: {
|
|
216
|
+
/**
|
|
217
|
+
* Enable the ability for source code building
|
|
218
|
+
*/
|
|
219
|
+
sourceBuild?: boolean | Pick<PluginSourceBuildOptions, 'sourceField' | 'resolvePriority'>;
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
export type SriOptions = {
|
|
223
|
+
hashFuncNames?: [string, ...string[]];
|
|
224
|
+
enabled?: 'auto' | true | false;
|
|
225
|
+
hashLoading?: 'eager' | 'lazy';
|
|
226
|
+
};
|
|
227
|
+
export type BuilderContext = RsbuildPluginAPI['context'] & {
|
|
228
|
+
target: RsbuildTarget[];
|
|
229
|
+
framework: string;
|
|
230
|
+
srcPath: string;
|
|
231
|
+
entry: Record<string, string | string[]>;
|
|
232
|
+
};
|
|
233
|
+
/**
|
|
234
|
+
* make the plugins type looser to avoid type mismatch
|
|
235
|
+
*/
|
|
236
|
+
export type BuilderPluginAPI = {
|
|
237
|
+
[key in keyof RsbuildPluginAPI]: any;
|
|
238
|
+
} & {
|
|
239
|
+
/** The following APIs only type incompatibility */
|
|
240
|
+
onBeforeCreateCompiler: (fn: any) => void;
|
|
241
|
+
onAfterCreateCompiler: (fn: any) => void;
|
|
242
|
+
onBeforeBuild: (fn: any) => void;
|
|
243
|
+
modifyBundlerChain: (fn: any) => void;
|
|
244
|
+
getNormalizedConfig: () => any;
|
|
245
|
+
/** The following APIs need to be compatible */
|
|
246
|
+
context: BuilderContext;
|
|
247
|
+
getBuilderConfig: () => Readonly<any>;
|
|
248
|
+
modifyBuilderConfig: (fn: (config: any, utils: {
|
|
249
|
+
mergeBuilderConfig: <T>(...configs: T[]) => T;
|
|
250
|
+
}) => any | Promise<any>) => void;
|
|
251
|
+
};
|
|
252
|
+
export type DistPath = DistPathConfig & {
|
|
253
|
+
server?: string;
|
|
254
|
+
worker?: string;
|
|
255
|
+
};
|
|
256
|
+
export type BuilderConfig = {
|
|
257
|
+
dev?: Omit<DevConfig, 'setupMiddlewares'> & {
|
|
258
|
+
server?: {
|
|
259
|
+
compress?: ServerConfig['compress'];
|
|
260
|
+
headers?: ServerConfig['headers'];
|
|
261
|
+
historyApiFallback?: ServerConfig['historyApiFallback'];
|
|
262
|
+
proxy?: ServerConfig['proxy'];
|
|
263
|
+
watch?: boolean;
|
|
264
|
+
};
|
|
265
|
+
};
|
|
266
|
+
html?: Omit<HtmlConfig, 'appIcon'>;
|
|
267
|
+
output?: Omit<OutputConfig, 'polyfill' | 'distPath'> & {
|
|
268
|
+
polyfill?: Polyfill | 'ua';
|
|
269
|
+
distPath?: DistPath;
|
|
270
|
+
};
|
|
271
|
+
server?: {
|
|
272
|
+
rsc?: boolean;
|
|
273
|
+
port?: number;
|
|
274
|
+
cors?: ServerConfig['cors'];
|
|
275
|
+
};
|
|
276
|
+
splitChunks?: RsbuildConfig['splitChunks'];
|
|
277
|
+
performance?: RsbuildConfig['performance'];
|
|
278
|
+
security?: Omit<SecurityConfig, 'sri'>;
|
|
279
|
+
tools?: Omit<ToolsConfig, 'htmlPlugin'>;
|
|
280
|
+
resolve?: RsbuildConfig['resolve'];
|
|
281
|
+
source?: Omit<SourceConfig, 'alias' | 'transformImport'>;
|
|
282
|
+
plugins?: RsbuildPlugins;
|
|
283
|
+
environments?: {
|
|
284
|
+
[key: string]: EnvironmentConfig;
|
|
285
|
+
};
|
|
286
|
+
} & BuilderExtraConfig;
|
|
287
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bleedingdev/modern-js-builder",
|
|
3
|
-
"version": "3.2.0-ultramodern.
|
|
3
|
+
"version": "3.2.0-ultramodern.22",
|
|
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
|
-
"@rsbuild/core": "2.0.
|
|
29
|
+
"@rsbuild/core": "2.0.7",
|
|
30
30
|
"@rsbuild/plugin-assets-retry": "2.0.0",
|
|
31
31
|
"@rsbuild/plugin-check-syntax": "1.6.1",
|
|
32
32
|
"@rsbuild/plugin-css-minimizer": "2.0.0",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@rsbuild/plugin-type-check": "1.3.4",
|
|
40
40
|
"@rsbuild/plugin-typed-css-modules": "1.2.2",
|
|
41
41
|
"@rsdoctor/rspack-plugin": "^1.5.11",
|
|
42
|
-
"@swc/core": "1.15.
|
|
42
|
+
"@swc/core": "1.15.40",
|
|
43
43
|
"@swc/helpers": "^0.5.21",
|
|
44
44
|
"autoprefixer": "10.5.0",
|
|
45
45
|
"browserslist": "4.28.2",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"cssnano": "8.0.1",
|
|
48
48
|
"html-minifier-terser": "^7.2.0",
|
|
49
49
|
"lodash": "^4.18.1",
|
|
50
|
-
"postcss": "^8.5.
|
|
50
|
+
"postcss": "^8.5.15",
|
|
51
51
|
"postcss-custom-properties": "15.0.1",
|
|
52
52
|
"postcss-flexbugs-fixes": "5.0.2",
|
|
53
53
|
"postcss-font-variant": "5.0.0",
|
|
@@ -58,17 +58,17 @@
|
|
|
58
58
|
"postcss-page-break": "3.0.4",
|
|
59
59
|
"rsbuild-plugin-rsc": "0.1.0",
|
|
60
60
|
"rspack-manifest-plugin": "5.2.1",
|
|
61
|
-
"ts-deepmerge": "
|
|
62
|
-
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.
|
|
61
|
+
"ts-deepmerge": "8.0.0",
|
|
62
|
+
"@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.22"
|
|
63
63
|
},
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@rslib/core": "0.21.5",
|
|
66
66
|
"@types/html-minifier-terser": "^7.0.2",
|
|
67
67
|
"@types/lodash": "^4.17.24",
|
|
68
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
68
|
+
"@typescript/native-preview": "7.0.0-dev.20260526.1",
|
|
69
69
|
"react": "^19.2.6",
|
|
70
|
-
"terser": "^5.
|
|
71
|
-
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.
|
|
70
|
+
"terser": "^5.48.0",
|
|
71
|
+
"@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.22",
|
|
72
72
|
"@scripts/rstest-config": "2.66.0"
|
|
73
73
|
},
|
|
74
74
|
"publishConfig": {
|