@rsbuild/core 1.6.12 → 1.6.14
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-manifest-plugin/index.js +4 -4
- package/dist/0~range-parser.js +1 -1
- package/dist/131.js +198 -90
- package/dist/2~open.cjs +1 -1
- package/dist/2~range-parser.cjs +1 -1
- package/dist/client/59.js +22 -0
- package/dist/client/hmr.js +12 -10
- package/dist/client/overlay.js +3 -2
- package/dist/index.cjs +206 -97
- package/dist-types/client/hmr.d.ts +3 -2
- package/dist-types/client/log.d.ts +13 -0
- package/dist-types/helpers/format.d.ts +1 -1
- package/dist-types/helpers/stats.d.ts +1 -1
- package/dist-types/plugins/fileSize.d.ts +2 -0
- package/dist-types/types/config.d.ts +66 -45
- package/dist-types/types/index.d.ts +8 -8
- package/package.json +3 -3
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type { NormalizedClientConfig } from '../types';
|
|
1
|
+
import type { LogLevel, NormalizedClientConfig } from '../types';
|
|
2
2
|
export declare const registerOverlay: (createFn: (html: string) => void, clearFn: () => void) => void;
|
|
3
|
-
export declare function init({ token, config, serverHost, serverPort, liveReload, browserLogs, }: {
|
|
3
|
+
export declare function init({ token, config, serverHost, serverPort, liveReload, browserLogs, logLevel, }: {
|
|
4
4
|
token: string;
|
|
5
5
|
config: NormalizedClientConfig;
|
|
6
6
|
serverHost: string;
|
|
7
7
|
serverPort: number;
|
|
8
8
|
liveReload: boolean;
|
|
9
9
|
browserLogs: boolean;
|
|
10
|
+
logLevel: LogLevel;
|
|
10
11
|
}): void;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { LogLevel } from '../types';
|
|
2
|
+
export declare const LOG_LEVEL: {
|
|
3
|
+
readonly silent: -1;
|
|
4
|
+
readonly error: 0;
|
|
5
|
+
readonly warn: 1;
|
|
6
|
+
readonly info: 2;
|
|
7
|
+
};
|
|
8
|
+
export declare const logger: {
|
|
9
|
+
level: LogLevel;
|
|
10
|
+
info(...messages: unknown[]): void;
|
|
11
|
+
warn(...messages: unknown[]): void;
|
|
12
|
+
error(...messages: unknown[]): void;
|
|
13
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { StatsError } from '@rspack/core';
|
|
2
|
-
export declare function formatStatsError(stats: StatsError): string;
|
|
2
|
+
export declare function formatStatsError(stats: StatsError, root: string): string;
|
|
@@ -19,7 +19,7 @@ export type RsbuildAsset = {
|
|
|
19
19
|
};
|
|
20
20
|
export declare const getAssetsFromStats: (stats: Rspack.Stats) => RsbuildAsset[];
|
|
21
21
|
export declare function getRsbuildStats(statsInstance: Rspack.Stats | Rspack.MultiStats, compiler: Rspack.Compiler | Rspack.MultiCompiler, action?: ActionType): RsbuildStats;
|
|
22
|
-
export declare function formatStats(stats: RsbuildStats, hasErrors: boolean): {
|
|
22
|
+
export declare function formatStats(stats: RsbuildStats, hasErrors: boolean, root: string): {
|
|
23
23
|
message?: string;
|
|
24
24
|
level?: string;
|
|
25
25
|
};
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { InternalContext, PrintFileSizeAsset, RsbuildPlugin } from '../types';
|
|
2
|
+
/** Normalize filename by removing hash for comparison across builds */
|
|
3
|
+
export declare function normalizeFilename(fileName: string): string;
|
|
2
4
|
/** Exclude source map and license files by default */
|
|
3
5
|
export declare const excludeAsset: (asset: PrintFileSizeAsset) => boolean;
|
|
4
6
|
export declare const pluginFileSize: (context: InternalContext) => RsbuildPlugin;
|
|
@@ -542,6 +542,14 @@ export type PrintFileSizeOptions = {
|
|
|
542
542
|
* @default (asset) => /\.(?:map|LICENSE\.txt)$/.test(asset.name)
|
|
543
543
|
*/
|
|
544
544
|
exclude?: (asset: PrintFileSizeAsset) => boolean;
|
|
545
|
+
/**
|
|
546
|
+
* Controls whether file size differences are displayed relative to the previous build.
|
|
547
|
+
* When this option is enabled, Rsbuild records a snapshot of all output file sizes after
|
|
548
|
+
* each build. On subsequent builds, Rsbuild compares the current sizes against the previous
|
|
549
|
+
* snapshot and shows the change inline in parentheses.
|
|
550
|
+
* @default false
|
|
551
|
+
*/
|
|
552
|
+
diff?: boolean;
|
|
545
553
|
};
|
|
546
554
|
export interface PreconnectOption {
|
|
547
555
|
/**
|
|
@@ -968,9 +976,7 @@ export type ManifestData = {
|
|
|
968
976
|
/**
|
|
969
977
|
* Maps each entry name to its associated output files.
|
|
970
978
|
*/
|
|
971
|
-
entries:
|
|
972
|
-
[entryName: string]: ManifestByEntry;
|
|
973
|
-
};
|
|
979
|
+
entries: Record<string, ManifestByEntry>;
|
|
974
980
|
/**
|
|
975
981
|
* Subresource Integrity (SRI) hashes for emitted assets.
|
|
976
982
|
* The key is the asset file path, and the value is its integrity hash.
|
|
@@ -1206,19 +1212,33 @@ export type ScriptInject = boolean | 'body' | 'head';
|
|
|
1206
1212
|
export type ScriptLoading = 'defer' | 'module' | 'blocking';
|
|
1207
1213
|
export type OutputStructure = 'flat' | 'nested';
|
|
1208
1214
|
/**
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1215
|
+
* Custom meta tag attributes.
|
|
1216
|
+
* Key is the attribute name.
|
|
1217
|
+
* Value is the attribute value, as a string or boolean.
|
|
1218
|
+
*
|
|
1219
|
+
* @example
|
|
1220
|
+
* {
|
|
1221
|
+
* name: 'viewport',
|
|
1222
|
+
* content: 'width=500, initial-scale=1',
|
|
1223
|
+
* }
|
|
1211
1224
|
*/
|
|
1212
|
-
export type MetaAttrs =
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1225
|
+
export type MetaAttrs = Record<string, string | boolean>;
|
|
1226
|
+
/**
|
|
1227
|
+
* Meta options in name-content form.
|
|
1228
|
+
* Key is the meta name, such as `viewport`, `description`, or `robots`.
|
|
1229
|
+
* The value can be:
|
|
1230
|
+
* - `string`: the content of the meta tag
|
|
1231
|
+
* - `false`: explicitly disables the meta tag
|
|
1232
|
+
* - `MetaAttrs`: a set of custom meta attributes
|
|
1233
|
+
*
|
|
1234
|
+
* @example
|
|
1235
|
+
* {
|
|
1236
|
+
* viewport: 'width=device-width, initial-scale=1',
|
|
1237
|
+
* description: 'My awesome website',
|
|
1238
|
+
* robots: false,
|
|
1239
|
+
* }
|
|
1240
|
+
*/
|
|
1241
|
+
export type MetaOptions = Record<string, string | false | MetaAttrs>;
|
|
1222
1242
|
export type HtmlBasicTag = {
|
|
1223
1243
|
/**
|
|
1224
1244
|
* The HTML tag name to be generated. Should be a valid HTML element name.
|
|
@@ -1473,29 +1493,27 @@ export type ProgressBarConfig = {
|
|
|
1473
1493
|
id?: string;
|
|
1474
1494
|
};
|
|
1475
1495
|
export type RequestHandler = Connect.NextHandleFunction;
|
|
1476
|
-
export type EnvironmentAPI = {
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
};
|
|
1498
|
-
};
|
|
1496
|
+
export type EnvironmentAPI = Record<string, {
|
|
1497
|
+
/**
|
|
1498
|
+
* Get stats info about current environment.
|
|
1499
|
+
*/
|
|
1500
|
+
getStats: () => Promise<Rspack.Stats>;
|
|
1501
|
+
/**
|
|
1502
|
+
* Load and execute stats bundle in Server.
|
|
1503
|
+
*
|
|
1504
|
+
* @param entryName - relate to rsbuild source.entry
|
|
1505
|
+
* @returns the return of entry module.
|
|
1506
|
+
*/
|
|
1507
|
+
loadBundle: <T = unknown>(entryName: string) => Promise<T>;
|
|
1508
|
+
/**
|
|
1509
|
+
* Get the compiled HTML template.
|
|
1510
|
+
*/
|
|
1511
|
+
getTransformedHtml: (entryName: string) => Promise<string>;
|
|
1512
|
+
/**
|
|
1513
|
+
* Provides some context information about the current environment
|
|
1514
|
+
*/
|
|
1515
|
+
context: EnvironmentContext;
|
|
1516
|
+
}>;
|
|
1499
1517
|
export type SetupMiddlewaresContext = Pick<RsbuildDevServer, 'sockWrite' | 'environments'>;
|
|
1500
1518
|
export type SetupMiddlewaresFn = (middlewares: {
|
|
1501
1519
|
unshift: (...handlers: RequestHandler[]) => void;
|
|
@@ -1532,6 +1550,11 @@ export type ClientConfig = {
|
|
|
1532
1550
|
* @default true
|
|
1533
1551
|
*/
|
|
1534
1552
|
overlay?: boolean;
|
|
1553
|
+
/**
|
|
1554
|
+
* Controls the log level for client-side logging in the browser console.
|
|
1555
|
+
* @default 'info'
|
|
1556
|
+
*/
|
|
1557
|
+
logLevel?: 'info' | 'warn' | 'error' | 'silent';
|
|
1535
1558
|
};
|
|
1536
1559
|
export type NormalizedClientConfig = Optional<Required<ClientConfig>, 'protocol'>;
|
|
1537
1560
|
export type { ChokidarOptions };
|
|
@@ -1799,11 +1822,11 @@ export interface RsbuildConfig extends EnvironmentConfig {
|
|
|
1799
1822
|
*/
|
|
1800
1823
|
server?: ServerConfig;
|
|
1801
1824
|
/**
|
|
1802
|
-
* Configure
|
|
1825
|
+
* Configure Rsbuild config by environment.
|
|
1826
|
+
* The key represents the environment name.
|
|
1827
|
+
* The value is the Rsbuild config for the specified environment.
|
|
1803
1828
|
*/
|
|
1804
|
-
environments?:
|
|
1805
|
-
[name: string]: EnvironmentConfig;
|
|
1806
|
-
};
|
|
1829
|
+
environments?: Record<string, EnvironmentConfig>;
|
|
1807
1830
|
/**
|
|
1808
1831
|
* Used to switch the bundler type.
|
|
1809
1832
|
*/
|
|
@@ -1839,7 +1862,5 @@ export type NormalizedEnvironmentConfig = TwoLevelReadonly<Omit<MergedEnvironmen
|
|
|
1839
1862
|
}>;
|
|
1840
1863
|
export type NormalizedConfig = NormalizedEnvironmentConfig & {
|
|
1841
1864
|
provider?: unknown;
|
|
1842
|
-
environments:
|
|
1843
|
-
[name: string]: NormalizedEnvironmentConfig;
|
|
1844
|
-
};
|
|
1865
|
+
environments: Record<string, NormalizedEnvironmentConfig>;
|
|
1845
1866
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './config';
|
|
2
|
-
export * from './context';
|
|
3
|
-
export * from './hooks';
|
|
4
|
-
export * from './plugin';
|
|
5
|
-
export * from './rsbuild';
|
|
6
|
-
export * from './rspack';
|
|
7
|
-
export * from './thirdParty';
|
|
8
|
-
export * from './utils';
|
|
1
|
+
export type * from './config';
|
|
2
|
+
export type * from './context';
|
|
3
|
+
export type * from './hooks';
|
|
4
|
+
export type * from './plugin';
|
|
5
|
+
export type * from './rsbuild';
|
|
6
|
+
export type * from './rspack';
|
|
7
|
+
export type * from './thirdParty';
|
|
8
|
+
export type * from './utils';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsbuild/core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.14",
|
|
4
4
|
"description": "The Rspack-based build tool.",
|
|
5
5
|
"homepage": "https://rsbuild.rs",
|
|
6
6
|
"bugs": {
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"types.d.ts"
|
|
47
47
|
],
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@rspack/core": "1.6.
|
|
49
|
+
"@rspack/core": "1.6.7",
|
|
50
50
|
"@rspack/lite-tapable": "~1.1.0",
|
|
51
51
|
"@swc/helpers": "^0.5.17",
|
|
52
52
|
"core-js": "~3.47.0",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@jridgewell/remapping": "^2.3.5",
|
|
57
57
|
"@jridgewell/trace-mapping": "^0.3.31",
|
|
58
|
-
"@rslib/core": "0.18.
|
|
58
|
+
"@rslib/core": "0.18.3",
|
|
59
59
|
"@types/connect": "3.4.38",
|
|
60
60
|
"@types/cors": "^2.8.19",
|
|
61
61
|
"@types/node": "^24.10.1",
|