@rsbuild/core 2.0.1 → 2.0.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.
@@ -890,31 +890,28 @@ export type NormalizedDataUriLimit = Required<DataUriLimit>;
890
890
  export type Polyfill = 'usage' | 'entry' | 'off';
891
891
  export type SourceMapExtractTarget = {
892
892
  /**
893
- * Include matched JavaScript files whose existing source maps should be
894
- * extracted.
893
+ * Include matched files whose existing source maps should be extracted.
895
894
  */
896
895
  include?: RuleSetCondition[];
897
896
  /**
898
- * Exclude matched JavaScript files whose existing source maps should not be
899
- * extracted.
897
+ * Exclude matched files whose existing source maps should not be extracted.
900
898
  */
901
899
  exclude?: RuleSetCondition[];
902
900
  };
903
- export type SourceMapExtract = boolean | {
901
+ export type SourceMapExtractOptions = SourceMapExtractTarget & {
902
+ /**
903
+ * Custom rule condition for matching files whose existing source maps should
904
+ * be extracted.
905
+ * @default /\.(?:js|mjs|cjs|jsx)$/
906
+ */
907
+ test?: RuleSetCondition;
904
908
  /**
905
909
  * Whether to extract existing source maps from matching JavaScript files.
906
- * This is useful when a third-party package already ships both `.js` and
907
- * `.js.map` files.
908
- *
909
- * `true` means extract from all JavaScript files. You can also use `include`
910
- * or `exclude` to limit extraction to specific files.
911
- *
912
- * This option is implemented based on Rspack's
913
- * `module.rules[].extractSourceMap` and can replace `source-map-loader`.
914
- * @default false
910
+ * @deprecated Use the flat `test`, `include`, and `exclude` fields instead.
915
911
  */
916
912
  js?: boolean | SourceMapExtractTarget;
917
913
  };
914
+ export type SourceMapExtract = boolean | SourceMapExtractOptions;
918
915
  export type SourceMap = {
919
916
  /**
920
917
  * The source map type for JavaScript files.
@@ -928,7 +925,8 @@ export type SourceMap = {
928
925
  css?: boolean;
929
926
  /**
930
927
  * Whether to extract existing source maps from matching input files.
931
- * Currently only JavaScript files are supported.
928
+ * This is useful when a third-party package already ships both output files
929
+ * and source map files.
932
930
  * @default false
933
931
  */
934
932
  extract?: SourceMapExtract;
@@ -1586,6 +1584,20 @@ export type SetupMiddlewaresFn = (middlewares: {
1586
1584
  unshift: (...handlers: RequestHandler[]) => void;
1587
1585
  push: (...handlers: RequestHandler[]) => void;
1588
1586
  }, server: SetupMiddlewaresContext) => void;
1587
+ export type OverlayOptions = {
1588
+ /**
1589
+ * Whether to show build errors in the overlay. You can pass a filter
1590
+ * function to control which formatted build errors are rendered.
1591
+ * Return false from the filter function to hide a specific error.
1592
+ * @default true
1593
+ */
1594
+ errors?: boolean | ((error: Error) => boolean);
1595
+ /**
1596
+ * Whether to show runtime errors in the overlay.
1597
+ * @default false
1598
+ */
1599
+ runtime?: boolean;
1600
+ };
1589
1601
  export type ClientConfig = {
1590
1602
  /**
1591
1603
  * The path for the WebSocket request.
@@ -1613,16 +1625,10 @@ export type ClientConfig = {
1613
1625
  */
1614
1626
  reconnect?: number;
1615
1627
  /**
1616
- * Whether to display an error overlay in the browser when a compilation error occurs.
1628
+ * Whether to display an error overlay in the browser.
1617
1629
  * @default true
1618
1630
  */
1619
- overlay?: boolean | {
1620
- /**
1621
- * Whether to show runtime errors in the overlay.
1622
- * @default false
1623
- */
1624
- runtime?: boolean;
1625
- };
1631
+ overlay?: boolean | OverlayOptions;
1626
1632
  /**
1627
1633
  * Controls the log level for client-side logging in the browser console.
1628
1634
  * @default 'info'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "The Rspack-based build tool.",
5
5
  "homepage": "https://rsbuild.rs",
6
6
  "bugs": {
@@ -36,7 +36,7 @@
36
36
  "types.d.ts"
37
37
  ],
38
38
  "dependencies": {
39
- "@rspack/core": "^2.0.0",
39
+ "@rspack/core": "~2.0.1",
40
40
  "@swc/helpers": "^0.5.21"
41
41
  },
42
42
  "peerDependencies": {
@@ -65,7 +65,7 @@
65
65
  "deepmerge": "^4.3.1",
66
66
  "dotenv-expand": "13.0.0",
67
67
  "html-rspack-plugin": "6.1.8",
68
- "http-proxy-middleware": "4.0.0-beta.4",
68
+ "http-proxy-middleware": "4.0.0-beta.5",
69
69
  "jiti": "^2.6.1",
70
70
  "launch-editor-middleware": "^2.13.2",
71
71
  "memfs": "^4.57.2",
package/types.d.ts CHANGED
@@ -239,10 +239,13 @@ declare module '*.toml' {
239
239
 
240
240
  /**
241
241
  * Imports the file as a URL string.
242
- * @note Only works for static assets by default.
242
+ * @note Only works for static assets and CSS files by default.
243
243
  * @example
244
244
  * import logoUrl from './logo.png?url'
245
245
  * console.log(logoUrl) // 'http://example.com/logo.123456.png'
246
+ *
247
+ * import cssUrl from './style.css?url'
248
+ * console.log(cssUrl) // 'http://example.com/style.123456.css'
246
249
  */
247
250
  declare module '*?url' {
248
251
  const content: string;