@bleedingdev/modern-js-builder 3.2.0-ultramodern.0 → 3.2.0-ultramodern.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bleedingdev/modern-js-builder",
3
- "version": "3.2.0-ultramodern.0",
3
+ "version": "3.2.0-ultramodern.2",
4
4
  "description": "A builder for Modern.js",
5
5
  "repository": {
6
6
  "type": "git",
@@ -59,7 +59,7 @@
59
59
  "rsbuild-plugin-rsc": "0.1.0",
60
60
  "rspack-manifest-plugin": "5.2.1",
61
61
  "ts-deepmerge": "7.0.3",
62
- "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.0"
62
+ "@modern-js/utils": "npm:@bleedingdev/modern-js-utils@3.2.0-ultramodern.2"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@rslib/core": "0.21.5",
@@ -68,7 +68,7 @@
68
68
  "@typescript/native-preview": "7.0.0-dev.20260516.1",
69
69
  "react": "^19.2.6",
70
70
  "terser": "^5.47.1",
71
- "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.0",
71
+ "@modern-js/types": "npm:@bleedingdev/modern-js-types@3.2.0-ultramodern.2",
72
72
  "@scripts/rstest-config": "2.66.0"
73
73
  },
74
74
  "publishConfig": {
@@ -1,8 +0,0 @@
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>;
@@ -1,8 +0,0 @@
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 };
@@ -1,4 +0,0 @@
1
- import type { RsbuildPlugin, SourceMap } from '@rsbuild/core';
2
- export declare const pluginDevtool: (options: {
3
- sourceMap?: SourceMap | boolean;
4
- }) => RsbuildPlugin;
@@ -1,6 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- export declare function isFileExists(file: string): Promise<boolean>;
3
- /**
4
- * generate a basic route.json for modern.js server
5
- */
6
- export declare const pluginEmitRouteFile: () => RsbuildPlugin;
@@ -1,3 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- import type { DistPath } from '../types';
3
- export declare const pluginEnvironmentDefaults: (distPath?: DistPath) => RsbuildPlugin;
@@ -1,3 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- import type { ChainedGlobalVars } from '../types';
3
- export declare const pluginGlobalVars: (options?: ChainedGlobalVars) => RsbuildPlugin;
@@ -1,2 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- export declare const pluginHtmlMinifierTerser: () => RsbuildPlugin;
@@ -1,2 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- export declare const pluginManifest: () => RsbuildPlugin;
@@ -1,6 +0,0 @@
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;
@@ -1,18 +0,0 @@
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[]>;
@@ -1,3 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- import type { RsdoctorUserConfig } from '../types';
3
- export declare const pluginRsdoctor: (config: RsdoctorUserConfig | undefined) => RsbuildPlugin | null;
@@ -1,2 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- export declare const pluginRuntimeChunk: (disableInlineRuntimeChunk?: boolean) => RsbuildPlugin;
@@ -1,6 +0,0 @@
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
- };
@@ -1 +0,0 @@
1
- export declare function getCssSupport(projectBrowserslist: string[]): Record<"customProperties" | "initial" | "pageBreak" | "fontVariant" | "mediaMinmax", boolean>;
@@ -1,2 +0,0 @@
1
- import type { ManifestPluginOptions } from 'rspack-manifest-plugin';
2
- export declare const generateManifest: ManifestPluginOptions['generate'];
@@ -1,9 +0,0 @@
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
- }>;
@@ -1,5 +0,0 @@
1
- import type { Rspack } from '@rsbuild/core';
2
- /**
3
- * Loader to add 'use server-entry'; directive at the top of route components
4
- */
5
- export default function rscServerEntryLoader(this: Rspack.LoaderContext, source: string): string;
@@ -1,2 +0,0 @@
1
- import type { RsbuildPlugin } from '@rsbuild/core';
2
- export declare function rscClientBrowserFallbackPlugin(): RsbuildPlugin;
@@ -1,2 +0,0 @@
1
- declare const _default: {};
2
- export default _default;
@@ -1,12 +0,0 @@
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[]>;
@@ -1,287 +0,0 @@
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 {};