@rsbuild/core 2.0.0-beta.6 → 2.0.0-beta.8

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.
Files changed (87) hide show
  1. package/bin/rsbuild.js +13 -0
  2. package/compiled/chokidar/index.d.ts +197 -29
  3. package/compiled/chokidar/package.json +1 -1
  4. package/compiled/connect-next/index.d.ts +56 -0
  5. package/compiled/connect-next/license +26 -0
  6. package/compiled/connect-next/package.json +1 -0
  7. package/compiled/cors/index.d.ts +56 -0
  8. package/compiled/cors/license +22 -0
  9. package/compiled/cors/package.json +1 -0
  10. package/compiled/css-loader/index.js +2 -2
  11. package/compiled/html-rspack-plugin/index.js +14 -14
  12. package/compiled/jiti/dist/babel.cjs +60 -60
  13. package/compiled/jiti/dist/jiti.cjs +2 -2
  14. package/compiled/postcss/index.js +1 -1
  15. package/compiled/postcss/lib/at-rule.d.ts +1 -1
  16. package/compiled/postcss/lib/comment.d.ts +1 -1
  17. package/compiled/postcss/lib/container.d.ts +1 -1
  18. package/compiled/postcss/lib/css-syntax-error.d.ts +1 -1
  19. package/compiled/postcss/lib/declaration.d.ts +1 -1
  20. package/compiled/postcss/lib/document.d.ts +1 -1
  21. package/compiled/postcss/lib/input.d.ts +1 -1
  22. package/compiled/postcss/lib/lazy-result.d.ts +1 -1
  23. package/compiled/postcss/lib/no-work-result.d.ts +1 -1
  24. package/compiled/postcss/lib/node.d.ts +1 -1
  25. package/compiled/postcss/lib/previous-map.d.ts +1 -1
  26. package/compiled/postcss/lib/processor.d.ts +1 -1
  27. package/compiled/postcss/lib/result.d.ts +1 -1
  28. package/compiled/postcss/lib/root.d.ts +1 -1
  29. package/compiled/postcss/lib/rule.d.ts +1 -1
  30. package/compiled/postcss/lib/stringifier.d.ts +1 -1
  31. package/compiled/postcss/lib/warning.d.ts +1 -1
  32. package/compiled/postcss/package.json +1 -1
  33. package/compiled/postcss-loader/index.js +6 -6
  34. package/compiled/rslog/index.d.ts +17 -1
  35. package/compiled/rslog/package.json +1 -1
  36. package/compiled/rspack-chain/package.json +1 -1
  37. package/compiled/rspack-chain/types/index.d.ts +0 -2
  38. package/compiled/rspack-manifest-plugin/index.d.ts +48 -0
  39. package/compiled/rspack-manifest-plugin/license +21 -0
  40. package/compiled/rspack-manifest-plugin/package.json +1 -0
  41. package/compiled/style-loader/index.js +37 -94
  42. package/compiled/style-loader/package.json +1 -1
  43. package/dist/{131.js → 958.js} +1125 -1083
  44. package/dist/chokidar.js +59 -57
  45. package/dist/client/hmr.js +2 -2
  46. package/dist/client/overlay.js +1 -1
  47. package/dist/connect-next.js +268 -0
  48. package/dist/{connect.js.LICENSE.txt → connect-next.js.LICENSE.txt} +3 -13
  49. package/dist/cors.js +2 -2
  50. package/dist/http-proxy-middleware.js +57 -552
  51. package/dist/index.js +1 -1
  52. package/dist/launch-editor-middleware.js +31 -15
  53. package/dist/manifest-plugin.js +18 -18
  54. package/dist/memfs.js +217 -756
  55. package/dist/{710.js → mrmime.js} +2 -1
  56. package/dist/open.js +36 -34
  57. package/dist/range-parser.js +2 -2
  58. package/dist/remapping.js +2 -2
  59. package/dist/rslib-runtime.js +3 -3
  60. package/dist/sirv.js +14 -14
  61. package/dist/src.js +510 -0
  62. package/dist/tinyglobby.js +114 -69
  63. package/dist/transformLoader.mjs +38 -1
  64. package/dist/transformRawLoader.mjs +1 -1
  65. package/dist/ws.js +1541 -0
  66. package/dist-types/helpers/index.d.ts +1 -1
  67. package/dist-types/helpers/vendors.d.ts +0 -1
  68. package/dist-types/server/runner/asModule.d.ts +1 -1
  69. package/dist-types/server/socketServer.d.ts +1 -1
  70. package/dist-types/types/config.d.ts +4 -4
  71. package/dist-types/types/thirdParty.d.ts +14 -5
  72. package/package.json +13 -14
  73. package/compiled/chokidar/handler.d.ts +0 -90
  74. package/compiled/ws/index.d.ts +0 -437
  75. package/compiled/ws/index.js +0 -3166
  76. package/compiled/ws/license +0 -20
  77. package/compiled/ws/package.json +0 -1
  78. package/dist/397.js +0 -11
  79. package/dist/7.js +0 -1
  80. package/dist/712.js +0 -15
  81. package/dist/743.js +0 -7
  82. package/dist/88.js +0 -40
  83. package/dist/connect.js +0 -570
  84. package/dist-types/helpers/color.d.ts +0 -4
  85. /package/dist/{131.js.LICENSE.txt → 958.js.LICENSE.txt} +0 -0
  86. /package/dist/client/{59.js → 797.js} +0 -0
  87. /package/dist/{31.js → trace-mapping.js} +0 -0
@@ -1,6 +1,6 @@
1
+ import { color } from '../../compiled/rslog';
1
2
  import RspackChain from '../../compiled/rspack-chain/types';
2
3
  import type { FilenameConfig, NormalizedConfig, NormalizedEnvironmentConfig, RsbuildTarget, Rspack } from '../types';
3
- import { color } from './color';
4
4
  export { require } from './vendors';
5
5
  export { color, RspackChain };
6
6
  export declare const getNodeEnv: () => string;
@@ -1,5 +1,4 @@
1
1
  type CompiledPackages = {
2
- ws: typeof import('../../compiled/ws').default;
3
2
  'webpack-merge': typeof import('../../compiled/webpack-merge');
4
3
  'html-rspack-plugin': typeof import('../../compiled/html-rspack-plugin').default;
5
4
  };
@@ -1,2 +1,2 @@
1
1
  import type { Module, SyntheticModule } from 'node:vm';
2
- export declare const asModule: (something: Record<string, any>, context: Record<string, any>, unlinked?: boolean) => Promise<Module | SyntheticModule>;
2
+ export declare const asModule: (moduleExports: Record<string, unknown>, context: Record<string, unknown>, unlinked?: boolean) => Promise<Module | SyntheticModule>;
@@ -63,7 +63,7 @@ export declare class SocketServer {
63
63
  upgrade: (req: IncomingMessage, socket: Socket, head: Buffer) => void;
64
64
  private checkSockets;
65
65
  private clearHeartbeatTimer;
66
- prepare(): void;
66
+ prepare(): Promise<void>;
67
67
  onBuildDone(): void;
68
68
  /**
69
69
  * Send error messages to the client and render error overlay
@@ -3,11 +3,11 @@ import type { SecureServerSessionOptions } from 'node:http2';
3
3
  import type { ServerOptions as HttpsServerOptions } from 'node:https';
4
4
  import type { URL } from 'node:url';
5
5
  import type { CopyRspackPluginOptions, DefinePluginOptions, Externals, LightningCssMinimizerRspackPluginOptions, ModuleFederationPluginOptions, RuleSetCondition, SwcJsMinimizerRspackPluginOptions, SwcLoaderOptions } from '@rspack/core';
6
- import type { CorsOptions } from 'cors';
7
- import type RspackChain from '../../compiled/rspack-chain/types';
8
- import type { FileDescriptor } from 'rspack-manifest-plugin';
9
6
  import type { ChokidarOptions } from '../../compiled/chokidar';
7
+ import type Cors from '../../compiled/cors';
10
8
  import type { Options as HttpProxyOptions, Filter as ProxyFilter } from '../../compiled/http-proxy-middleware';
9
+ import type RspackChain from '../../compiled/rspack-chain/types';
10
+ import type { FileDescriptor } from '../../compiled/rspack-manifest-plugin';
11
11
  import type { RsbuildDevServer } from '../server/devServer';
12
12
  import type { RsbuildPreviewServer } from '../server/previewServer';
13
13
  import type { EnvironmentContext, ModifyBundlerChainUtils, ModifyChainUtils, Routes } from './hooks';
@@ -414,7 +414,7 @@ export interface ServerConfig {
414
414
  *
415
415
  * @link https://github.com/expressjs/cors
416
416
  */
417
- cors?: boolean | CorsOptions;
417
+ cors?: boolean | Cors.CorsOptions;
418
418
  /**
419
419
  * Configure proxy rules for the dev server or preview server to proxy requests to
420
420
  * the specified service.
@@ -1,5 +1,5 @@
1
1
  import type { CssExtractRspackLoaderOptions, CssExtractRspackPluginOptions } from '@rspack/core';
2
- import type Connect from 'connect';
2
+ import type * as Connect from '../../compiled/connect-next';
3
3
  import type HtmlRspackPlugin from '../../compiled/html-rspack-plugin';
4
4
  import type { AcceptedPlugin, ProcessOptions } from '../../compiled/postcss';
5
5
  import type { Rspack } from './rspack';
@@ -169,15 +169,24 @@ export interface StyleLoaderOptions {
169
169
  */
170
170
  attributes?: Record<string, string>;
171
171
  /**
172
- * By default, the style-loader appends <style>/<link> elements to the end of the style target, which is the <head> tag of the page unless specified by insert.
172
+ * By default, style-loader appends <style>/<link> elements to the end of the style target,
173
+ * which is the <head> tag of the page unless specified by insert.
173
174
  * This will cause CSS created by the loader to take priority over CSS already present in the target.
174
175
  * You can use other values if the standard behavior is not suitable for you, but we do not recommend doing this.
176
+ * If you target an iframe, make sure you have sufficient access rights.
177
+ *
178
+ * Supports:
179
+ * - a CSS selector where styles are injected
180
+ * - an absolute path to a custom insert module
175
181
  *
176
182
  * @default 'head'
177
183
  */
178
- insert?: LiteralUnion<'head' | 'body', string> | ((element: HTMLElement) => void);
184
+ insert?: LiteralUnion<'head' | 'body', string>;
179
185
  /**
180
- * Allows to setup absolute path to custom function that allows to override default behavior styleTagTransform.
186
+ * Allows to setup an absolute path to a custom module that overrides
187
+ * the default styleTagTransform behavior.
188
+ *
189
+ * @default undefined
181
190
  */
182
- styleTagTransform?: string | ((css: string, styleElement: HTMLStyleElement, options: Record<string, any>) => void);
191
+ styleTagTransform?: string;
183
192
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rsbuild/core",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.0-beta.8",
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-beta.3",
39
+ "@rspack/core": "2.0.0-beta.6",
40
40
  "@swc/helpers": "^0.5.19"
41
41
  },
42
42
  "peerDependencies": {
@@ -50,17 +50,16 @@
50
50
  "devDependencies": {
51
51
  "@jridgewell/remapping": "^2.3.5",
52
52
  "@jridgewell/trace-mapping": "^0.3.31",
53
- "@rslib/core": "0.19.6",
54
- "@types/connect": "3.4.38",
53
+ "@rslib/core": "0.20.0-canary-202603101",
55
54
  "@types/cors": "^2.8.19",
56
- "@types/node": "^24.10.13",
55
+ "@types/node": "^24.12.0",
57
56
  "@types/on-finished": "2.3.5",
58
57
  "@types/range-parser": "^1.2.7",
59
58
  "@types/ws": "^8.18.1",
60
59
  "browserslist-load-config": "1.0.1",
61
- "cac": "^6.7.14",
60
+ "cac": "^7.0.0",
62
61
  "chokidar": "^5.0.0",
63
- "connect": "3.7.0",
62
+ "connect-next": "4.0.0",
64
63
  "cors": "^2.8.6",
65
64
  "css-loader": "7.1.4",
66
65
  "deepmerge": "^4.3.1",
@@ -68,25 +67,25 @@
68
67
  "html-rspack-plugin": "6.1.7",
69
68
  "http-proxy-middleware": "^3.0.5",
70
69
  "jiti": "^2.6.1",
71
- "launch-editor-middleware": "^2.13.0",
72
- "memfs": "^4.56.10",
70
+ "launch-editor-middleware": "^2.13.1",
71
+ "memfs": "^4.56.11",
73
72
  "mrmime": "^2.0.1",
74
73
  "on-finished": "2.4.1",
75
74
  "open": "^11.0.0",
76
- "postcss": "^8.5.6",
75
+ "postcss": "^8.5.8",
77
76
  "postcss-load-config": "6.0.1",
78
77
  "postcss-loader": "8.2.1",
79
78
  "prebundle": "1.6.2",
80
79
  "range-parser": "^1.2.1",
81
80
  "reduce-configs": "^1.1.1",
82
- "rslog": "^2.0.0",
83
- "rspack-chain": "^2.0.0-alpha.0",
81
+ "rslog": "^2.0.1",
82
+ "rspack-chain": "^2.0.0-beta.0",
84
83
  "rspack-manifest-plugin": "5.2.1",
85
84
  "sirv": "^3.0.2",
86
85
  "stacktrace-parser": "^0.1.11",
87
- "style-loader": "3.3.4",
86
+ "style-loader": "^4.0.0",
88
87
  "supports-color": "^10.2.2",
89
- "tinyglobby": "0.2.14",
88
+ "tinyglobby": "^0.2.15",
90
89
  "typescript": "^5.9.3",
91
90
  "webpack-merge": "6.0.1",
92
91
  "ws": "^8.19.0"
@@ -1,90 +0,0 @@
1
- import type { FSWatcher as NativeFsWatcher, Stats, WatchEventType } from 'node:fs';
2
- import type { EntryInfo } from 'readdirp';
3
- import type { FSWatcher, Throttler, WatchHelper } from './index.js';
4
- export type Path = string;
5
- export declare const STR_DATA = "data";
6
- export declare const STR_END = "end";
7
- export declare const STR_CLOSE = "close";
8
- export declare const EMPTY_FN: () => void;
9
- export declare const IDENTITY_FN: (val: unknown) => unknown;
10
- export declare const isWindows: boolean;
11
- export declare const isMacos: boolean;
12
- export declare const isLinux: boolean;
13
- export declare const isFreeBSD: boolean;
14
- export declare const isIBMi: boolean;
15
- export declare const EVENTS: {
16
- readonly ALL: "all";
17
- readonly READY: "ready";
18
- readonly ADD: "add";
19
- readonly CHANGE: "change";
20
- readonly ADD_DIR: "addDir";
21
- readonly UNLINK: "unlink";
22
- readonly UNLINK_DIR: "unlinkDir";
23
- readonly RAW: "raw";
24
- readonly ERROR: "error";
25
- };
26
- export type EventName = (typeof EVENTS)[keyof typeof EVENTS];
27
- export type FsWatchContainer = {
28
- listeners: (path: string) => void | Set<any>;
29
- errHandlers: (err: unknown) => void | Set<any>;
30
- rawEmitters: (ev: WatchEventType, path: string, opts: unknown) => void | Set<any>;
31
- watcher: NativeFsWatcher;
32
- watcherUnusable?: boolean;
33
- };
34
- export interface WatchHandlers {
35
- listener: (path: string) => void;
36
- errHandler: (err: unknown) => void;
37
- rawEmitter: (ev: WatchEventType, path: string, opts: unknown) => void;
38
- }
39
- /**
40
- * @mixin
41
- */
42
- export declare class NodeFsHandler {
43
- fsw: FSWatcher;
44
- _boundHandleError: (error: unknown) => void;
45
- constructor(fsW: FSWatcher);
46
- /**
47
- * Watch file for changes with fs_watchFile or fs_watch.
48
- * @param path to file or dir
49
- * @param listener on fs change
50
- * @returns closer for the watcher instance
51
- */
52
- _watchWithNodeFs(path: string, listener: (path: string, newStats?: any) => void | Promise<void>): (() => void) | undefined;
53
- /**
54
- * Watch a file and emit add event if warranted.
55
- * @returns closer for the watcher instance
56
- */
57
- _handleFile(file: Path, stats: Stats, initialAdd: boolean): (() => void) | undefined;
58
- /**
59
- * Handle symlinks encountered while reading a dir.
60
- * @param entry returned by readdirp
61
- * @param directory path of dir being read
62
- * @param path of this item
63
- * @param item basename of this item
64
- * @returns true if no more processing is needed for this entry.
65
- */
66
- _handleSymlink(entry: EntryInfo, directory: string, path: Path, item: string): Promise<boolean | undefined>;
67
- _handleRead(directory: string, initialAdd: boolean, wh: WatchHelper, target: Path | undefined, dir: Path, depth: number, throttler: Throttler): Promise<unknown> | undefined;
68
- /**
69
- * Read directory to add / remove files from `@watched` list and re-read it on change.
70
- * @param dir fs path
71
- * @param stats
72
- * @param initialAdd
73
- * @param depth relative to user-supplied path
74
- * @param target child path targeted for watch
75
- * @param wh Common watch helpers for this path
76
- * @param realpath
77
- * @returns closer for the watcher instance.
78
- */
79
- _handleDir(dir: string, stats: Stats, initialAdd: boolean, depth: number, target: string | undefined, wh: WatchHelper, realpath: string): Promise<(() => void) | undefined>;
80
- /**
81
- * Handle added file, directory, or glob pattern.
82
- * Delegates call to _handleFile / _handleDir after checks.
83
- * @param path to file or ir
84
- * @param initialAdd was the file added at watch instantiation?
85
- * @param priorWh depth relative to user-supplied path
86
- * @param depth Child path actually targeted for watch
87
- * @param target Child path actually targeted for watch
88
- */
89
- _addToNodeFs(path: string, initialAdd: boolean, priorWh: WatchHelper | undefined, depth: number, target?: string): Promise<string | false | undefined>;
90
- }