@rsbuild/core 1.3.0-beta.0 → 1.3.0-beta.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/compiled/css-loader/index.js +18 -18
- package/compiled/html-rspack-plugin/index.js +14 -14
- package/compiled/postcss-loader/index.js +6 -6
- package/compiled/rspack-chain/index.d.ts +5 -1
- package/compiled/rspack-chain/index.js +67 -66
- package/compiled/rspack-chain/package.json +1 -1
- package/compiled/rspack-manifest-plugin/index.js +4 -4
- package/dist/index.cjs +333 -299
- package/dist/index.js +333 -299
- package/dist/transformLoader.mjs +20 -16
- package/dist/transformRawLoader.mjs +20 -16
- package/dist-types/config.d.ts +0 -2
- package/dist-types/configChain.d.ts +18 -2
- package/dist-types/helpers/index.d.ts +0 -1
- package/dist-types/plugins/css.d.ts +1 -1
- package/dist-types/restart.d.ts +18 -0
- package/dist-types/server/cliShortcuts.d.ts +1 -1
- package/dist-types/types/context.d.ts +10 -8
- package/package.json +5 -5
- package/types.d.ts +56 -0
- package/dist-types/cli/prepare.d.ts +0 -1
- package/dist-types/server/restart.d.ts +0 -14
package/dist/transformLoader.mjs
CHANGED
|
@@ -4,21 +4,25 @@ async function transformLoader_rslib_entry_transform(source, map) {
|
|
|
4
4
|
if (!transformId) return bypass();
|
|
5
5
|
let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler ? void 0 : null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
|
|
6
6
|
if (!transform) return bypass();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
try {
|
|
8
|
+
let result = await transform({
|
|
9
|
+
code: source,
|
|
10
|
+
context: this.context,
|
|
11
|
+
resource: this.resource,
|
|
12
|
+
resourcePath: this.resourcePath,
|
|
13
|
+
resourceQuery: this.resourceQuery,
|
|
14
|
+
environment: getEnvironment(),
|
|
15
|
+
addDependency: this.addDependency.bind(this),
|
|
16
|
+
emitFile: this.emitFile.bind(this),
|
|
17
|
+
importModule: this.importModule.bind(this),
|
|
18
|
+
resolve: this.resolve.bind(this)
|
|
19
|
+
});
|
|
20
|
+
if (null == result) return bypass();
|
|
21
|
+
if ('string' == typeof result) return callback(null, result, map);
|
|
22
|
+
let useMap = null != map, finalMap = result.map ?? map;
|
|
23
|
+
callback(null, result.code, useMap ? finalMap : void 0);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
26
|
+
}
|
|
23
27
|
}
|
|
24
28
|
export { transformLoader_rslib_entry_transform as default };
|
|
@@ -4,21 +4,25 @@ let transformRawLoader_rslib_entry_ = async function(source, map) {
|
|
|
4
4
|
if (!transformId) return bypass();
|
|
5
5
|
let transform = null === (_this__compiler = this._compiler) || void 0 === _this__compiler ? void 0 : null === (_this__compiler___rsbuildTransformer = _this__compiler.__rsbuildTransformer) || void 0 === _this__compiler___rsbuildTransformer ? void 0 : _this__compiler___rsbuildTransformer[transformId];
|
|
6
6
|
if (!transform) return bypass();
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
7
|
+
try {
|
|
8
|
+
let result = await transform({
|
|
9
|
+
code: source,
|
|
10
|
+
context: this.context,
|
|
11
|
+
resource: this.resource,
|
|
12
|
+
resourcePath: this.resourcePath,
|
|
13
|
+
resourceQuery: this.resourceQuery,
|
|
14
|
+
environment: getEnvironment(),
|
|
15
|
+
addDependency: this.addDependency.bind(this),
|
|
16
|
+
emitFile: this.emitFile.bind(this),
|
|
17
|
+
importModule: this.importModule.bind(this),
|
|
18
|
+
resolve: this.resolve.bind(this)
|
|
19
|
+
});
|
|
20
|
+
if (null == result) return bypass();
|
|
21
|
+
if ('string' == typeof result) return callback(null, result, map);
|
|
22
|
+
let useMap = null != map, finalMap = result.map ?? map;
|
|
23
|
+
callback(null, result.code, useMap ? finalMap : void 0);
|
|
24
|
+
} catch (error) {
|
|
25
|
+
error instanceof Error ? callback(error) : callback(Error(String(error)));
|
|
26
|
+
}
|
|
23
27
|
}, raw = !0;
|
|
24
28
|
export { transformRawLoader_rslib_entry_ as default, raw };
|
package/dist-types/config.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { ChokidarOptions } from '../compiled/chokidar/index.js';
|
|
2
1
|
import type { InspectConfigOptions, InspectConfigResult, NormalizedConfig, PluginManager, PublicDir, PublicDirOptions, RsbuildConfig, RsbuildEntry } from './types';
|
|
3
2
|
export declare function getDefaultEntry(root: string): RsbuildEntry;
|
|
4
3
|
export declare const withDefaultConfig: (rootPath: string, config: RsbuildConfig) => Promise<RsbuildConfig>;
|
|
@@ -25,7 +24,6 @@ export declare function defineConfig(config: RsbuildConfig): RsbuildConfig;
|
|
|
25
24
|
export declare function defineConfig(config: RsbuildConfigSyncFn): RsbuildConfigSyncFn;
|
|
26
25
|
export declare function defineConfig(config: RsbuildConfigAsyncFn): RsbuildConfigAsyncFn;
|
|
27
26
|
export declare function defineConfig(config: RsbuildConfigExport): RsbuildConfigExport;
|
|
28
|
-
export declare function watchFilesForRestart(files: string[], root: string, isBuildWatch: boolean, watchOptions?: ChokidarOptions): Promise<void>;
|
|
29
27
|
export type LoadConfigOptions = {
|
|
30
28
|
/**
|
|
31
29
|
* The root path to resolve the config file.
|
|
@@ -22,12 +22,28 @@ export declare const CHAIN_ID: {
|
|
|
22
22
|
readonly TS: "ts";
|
|
23
23
|
/** Rule for CSS */
|
|
24
24
|
readonly CSS: "css";
|
|
25
|
-
/** Rule for
|
|
25
|
+
/** Rule for raw CSS */
|
|
26
|
+
readonly CSS_RAW: "css-raw";
|
|
27
|
+
/** Rule for inline CSS */
|
|
28
|
+
readonly CSS_INLINE: "css-inline";
|
|
29
|
+
/** Rule for Less */
|
|
26
30
|
readonly LESS: "less";
|
|
27
|
-
/** Rule for
|
|
31
|
+
/** Rule for raw Less */
|
|
32
|
+
readonly LESS_RAW: "less-raw";
|
|
33
|
+
/** Rule for inline Less */
|
|
34
|
+
readonly LESS_INLINE: "less-inline";
|
|
35
|
+
/** Rule for Sass */
|
|
28
36
|
readonly SASS: "sass";
|
|
37
|
+
/** Rule for raw Sass */
|
|
38
|
+
readonly SASS_RAW: "sass-raw";
|
|
39
|
+
/** Rule for inline Sass */
|
|
40
|
+
readonly SASS_INLINE: "sass-inline";
|
|
29
41
|
/** Rule for stylus */
|
|
30
42
|
readonly STYLUS: "stylus";
|
|
43
|
+
/** Rule for raw stylus */
|
|
44
|
+
readonly STYLUS_RAW: "stylus-raw";
|
|
45
|
+
/** Rule for inline stylus */
|
|
46
|
+
readonly STYLUS_INLINE: "stylus-inline";
|
|
31
47
|
/** Rule for svg */
|
|
32
48
|
readonly SVG: "svg";
|
|
33
49
|
/** Rule for pug */
|
|
@@ -33,7 +33,6 @@ export declare function getFilename(config: NormalizedConfig | NormalizedEnviron
|
|
|
33
33
|
export declare function partition<T>(array: T[], predicate: (value: T) => boolean): [T[], T[]];
|
|
34
34
|
export declare const applyToCompiler: (compiler: Rspack.Compiler | Rspack.MultiCompiler, apply: (c: Rspack.Compiler, index: number) => void) => void;
|
|
35
35
|
export declare const upperFirst: (str: string) => string;
|
|
36
|
-
export declare function debounce<T extends (...args: any[]) => void>(func: T, wait: number): (...args: Parameters<T>) => void;
|
|
37
36
|
export declare const isURL: (str: string) => boolean;
|
|
38
37
|
export declare const createVirtualModule: (content: string) => string;
|
|
39
38
|
export declare function isWebTarget(target: RsbuildTarget | RsbuildTarget[]): boolean;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { CSSLoaderOptions, NormalizedEnvironmentConfig, RsbuildPlugin, Rspack } from '../types';
|
|
2
|
-
export declare const getLightningCSSLoaderOptions: (config: NormalizedEnvironmentConfig, targets: string[]) => Rspack.LightningcssLoaderOptions;
|
|
2
|
+
export declare const getLightningCSSLoaderOptions: (config: NormalizedEnvironmentConfig, targets: string[], minify: boolean) => Rspack.LightningcssLoaderOptions;
|
|
3
3
|
export declare const normalizeCssLoaderOptions: (options: CSSLoaderOptions, exportOnlyLocals: boolean) => CSSLoaderOptions;
|
|
4
4
|
export declare const pluginCss: () => RsbuildPlugin;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ChokidarOptions } from '../compiled/chokidar/index.js';
|
|
2
|
+
import type { RsbuildInstance } from './types';
|
|
3
|
+
type Cleaner = () => Promise<unknown> | unknown;
|
|
4
|
+
/**
|
|
5
|
+
* Add a cleaner to handle side effects
|
|
6
|
+
*/
|
|
7
|
+
export declare const onBeforeRestartServer: (cleaner: Cleaner) => void;
|
|
8
|
+
export declare const restartDevServer: ({ filePath, clear, }?: {
|
|
9
|
+
filePath?: string;
|
|
10
|
+
clear?: boolean;
|
|
11
|
+
}) => Promise<boolean>;
|
|
12
|
+
export declare function watchFilesForRestart({ files, rsbuild, isBuildWatch, watchOptions, }: {
|
|
13
|
+
files: string[];
|
|
14
|
+
rsbuild: RsbuildInstance;
|
|
15
|
+
isBuildWatch: boolean;
|
|
16
|
+
watchOptions?: ChokidarOptions;
|
|
17
|
+
}): Promise<void>;
|
|
18
|
+
export {};
|
|
@@ -5,6 +5,6 @@ export declare function setupCliShortcuts({ help, openPage, closeServer, printUr
|
|
|
5
5
|
openPage: () => Promise<void>;
|
|
6
6
|
closeServer: () => Promise<void>;
|
|
7
7
|
printUrls: () => void;
|
|
8
|
-
restartServer?: () => Promise<
|
|
8
|
+
restartServer?: () => Promise<boolean>;
|
|
9
9
|
customShortcuts?: (shortcuts: CliShortcut[]) => CliShortcut[];
|
|
10
10
|
}): () => void;
|
|
@@ -19,6 +19,16 @@ export type RsbuildContext = {
|
|
|
19
19
|
port: number;
|
|
20
20
|
https: boolean;
|
|
21
21
|
};
|
|
22
|
+
/**
|
|
23
|
+
* The current action type.
|
|
24
|
+
* - dev: will be set when running `rsbuild dev` or `rsbuild.startDevServer()`
|
|
25
|
+
* - build: will be set when running `rsbuild build` or `rsbuild.build()`
|
|
26
|
+
* - preview: will be set when running `rsbuild preview` or `rsbuild.preview()`
|
|
27
|
+
*/
|
|
28
|
+
action?: 'dev' | 'build' | 'preview';
|
|
29
|
+
/**
|
|
30
|
+
* The bundler type, can be `rspack` or `webpack`.
|
|
31
|
+
*/
|
|
22
32
|
bundlerType: BundlerType;
|
|
23
33
|
};
|
|
24
34
|
/** The inner context. */
|
|
@@ -41,12 +51,4 @@ export type InternalContext = RsbuildContext & {
|
|
|
41
51
|
environments: Record<string, EnvironmentContext>;
|
|
42
52
|
/** Only build specified environment. */
|
|
43
53
|
specifiedEnvironments?: string[];
|
|
44
|
-
/**
|
|
45
|
-
* The command type.
|
|
46
|
-
*
|
|
47
|
-
* - dev: `rsbuild dev` or `rsbuild.startDevServer()`
|
|
48
|
-
* - build: `rsbuild build` or `rsbuild.build()`
|
|
49
|
-
* - preview: `rsbuild preview` or `rsbuild.preview()`
|
|
50
|
-
*/
|
|
51
|
-
command?: 'dev' | 'build' | 'preview';
|
|
52
54
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.3.0-beta.
|
|
3
|
+
"version": "1.3.0-beta.2",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.dev",
|
|
6
6
|
"bugs": {
|
|
@@ -46,16 +46,16 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.3.0-beta.
|
|
49
|
+
"@rspack/core": "1.3.0-beta.1",
|
|
50
50
|
"@rspack/lite-tapable": "~1.0.1",
|
|
51
51
|
"@swc/helpers": "^0.5.15",
|
|
52
52
|
"core-js": "~3.41.0",
|
|
53
53
|
"jiti": "^2.4.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@rslib/core": "0.5.
|
|
56
|
+
"@rslib/core": "0.5.5",
|
|
57
57
|
"@types/connect": "3.4.38",
|
|
58
|
-
"@types/node": "^22.13.
|
|
58
|
+
"@types/node": "^22.13.11",
|
|
59
59
|
"@types/on-finished": "2.3.4",
|
|
60
60
|
"@types/webpack-bundle-analyzer": "4.7.0",
|
|
61
61
|
"@types/ws": "^8.18.0",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"reduce-configs": "^1.1.0",
|
|
84
84
|
"rsbuild-dev-middleware": "0.2.0",
|
|
85
85
|
"rslog": "^1.2.3",
|
|
86
|
-
"rspack-chain": "^1.2.
|
|
86
|
+
"rspack-chain": "^1.2.3",
|
|
87
87
|
"rspack-manifest-plugin": "5.0.3",
|
|
88
88
|
"sirv": "^3.0.1",
|
|
89
89
|
"style-loader": "3.3.4",
|
package/types.d.ts
CHANGED
|
@@ -184,6 +184,62 @@ declare module '*?inline' {
|
|
|
184
184
|
export default content;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
+
/**
|
|
188
|
+
* Inline CSS
|
|
189
|
+
*/
|
|
190
|
+
declare module '*.css?inline' {
|
|
191
|
+
const content: string;
|
|
192
|
+
export default content;
|
|
193
|
+
}
|
|
194
|
+
declare module '*.scss?inline' {
|
|
195
|
+
const content: string;
|
|
196
|
+
export default content;
|
|
197
|
+
}
|
|
198
|
+
declare module '*.sass?inline' {
|
|
199
|
+
const content: string;
|
|
200
|
+
export default content;
|
|
201
|
+
}
|
|
202
|
+
declare module '*.less?inline' {
|
|
203
|
+
const content: string;
|
|
204
|
+
export default content;
|
|
205
|
+
}
|
|
206
|
+
declare module '*.styl?inline' {
|
|
207
|
+
const content: string;
|
|
208
|
+
export default content;
|
|
209
|
+
}
|
|
210
|
+
declare module '*.stylus?inline' {
|
|
211
|
+
const content: string;
|
|
212
|
+
export default content;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Raw CSS
|
|
217
|
+
*/
|
|
218
|
+
declare module '*.css?raw' {
|
|
219
|
+
const content: string;
|
|
220
|
+
export default content;
|
|
221
|
+
}
|
|
222
|
+
declare module '*.scss?raw' {
|
|
223
|
+
const content: string;
|
|
224
|
+
export default content;
|
|
225
|
+
}
|
|
226
|
+
declare module '*.sass?raw' {
|
|
227
|
+
const content: string;
|
|
228
|
+
export default content;
|
|
229
|
+
}
|
|
230
|
+
declare module '*.less?raw' {
|
|
231
|
+
const content: string;
|
|
232
|
+
export default content;
|
|
233
|
+
}
|
|
234
|
+
declare module '*.styl?raw' {
|
|
235
|
+
const content: string;
|
|
236
|
+
export default content;
|
|
237
|
+
}
|
|
238
|
+
declare module '*.stylus?raw' {
|
|
239
|
+
const content: string;
|
|
240
|
+
export default content;
|
|
241
|
+
}
|
|
242
|
+
|
|
187
243
|
/**
|
|
188
244
|
* CSS Modules
|
|
189
245
|
*/
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function prepareCli(): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
type Cleaner = () => Promise<unknown> | unknown;
|
|
2
|
-
/**
|
|
3
|
-
* Add a cleaner to handle side effects
|
|
4
|
-
*/
|
|
5
|
-
export declare const onBeforeRestartServer: (cleaner: Cleaner) => void;
|
|
6
|
-
export declare const restartDevServer: ({ filePath, clear, }?: {
|
|
7
|
-
filePath?: string;
|
|
8
|
-
clear?: boolean;
|
|
9
|
-
}) => Promise<void>;
|
|
10
|
-
export declare const restartBuild: ({ filePath, clear, }?: {
|
|
11
|
-
filePath?: string;
|
|
12
|
-
clear?: boolean;
|
|
13
|
-
}) => Promise<void>;
|
|
14
|
-
export {};
|