@rspack/core 1.4.4 → 1.4.6

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.
@@ -0,0 +1,163 @@
1
+ import type { JsBuildMeta } from "@rspack/binding";
2
+ // @ts-ignore
3
+ import * as z from "zod/v4";
4
+ export declare const getIgnorePluginOptionsSchema: () => z.ZodUnion<readonly [z.ZodObject<{
5
+ contextRegExp: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
6
+ resourceRegExp: z.ZodCustom<RegExp, RegExp>;
7
+ }, z.core.$strip>, z.ZodObject<{
8
+ checkResource: z.ZodCustom<(...args: unknown[]) => any, (...args: unknown[]) => any>;
9
+ }, z.core.$strip>]>;
10
+ export declare const getRsdoctorPluginSchema: () => z.ZodObject<{
11
+ moduleGraphFeatures: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodEnum<{
12
+ ids: "ids";
13
+ graph: "graph";
14
+ sources: "sources";
15
+ }>>]>>;
16
+ chunkGraphFeatures: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodArray<z.ZodEnum<{
17
+ assets: "assets";
18
+ graph: "graph";
19
+ }>>]>>;
20
+ }, z.core.$strict>;
21
+ export declare const getSRIPluginOptionsSchema: () => z.ZodObject<{
22
+ hashFuncNames: z.ZodOptional<z.ZodTuple<[z.ZodEnum<{
23
+ sha256: "sha256";
24
+ sha384: "sha384";
25
+ sha512: "sha512";
26
+ }>], z.ZodEnum<{
27
+ sha256: "sha256";
28
+ sha384: "sha384";
29
+ sha512: "sha512";
30
+ }>>>;
31
+ htmlPlugin: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodLiteral<false>]>>;
32
+ enabled: z.ZodOptional<z.ZodUnion<[z.ZodLiteral<"auto">, z.ZodBoolean]>>;
33
+ }, z.core.$strip>;
34
+ export declare const getDllPluginOptionsSchema: () => z.ZodObject<{
35
+ context: z.ZodOptional<z.ZodString>;
36
+ entryOnly: z.ZodOptional<z.ZodBoolean>;
37
+ format: z.ZodOptional<z.ZodBoolean>;
38
+ name: z.ZodOptional<z.ZodString>;
39
+ path: z.ZodString;
40
+ type: z.ZodOptional<z.ZodString>;
41
+ }, z.core.$strip>;
42
+ export declare const getDllReferencePluginOptionsSchema: () => z.ZodUnion<readonly [z.ZodObject<{
43
+ context: z.ZodOptional<z.ZodString>;
44
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
45
+ manifest: z.ZodUnion<[z.ZodString, z.ZodObject<{
46
+ content: z.ZodRecord<z.ZodString, z.ZodObject<{
47
+ buildMeta: z.ZodOptional<z.ZodCustom<JsBuildMeta, JsBuildMeta>>;
48
+ exports: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodLiteral<true>]>>;
49
+ id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodNumber, z.ZodLiteral<number>]>]>>;
50
+ }, z.core.$strip>>;
51
+ name: z.ZodOptional<z.ZodString>;
52
+ type: z.ZodOptional<z.ZodEnum<{
53
+ jsonp: "jsonp";
54
+ var: "var";
55
+ assign: "assign";
56
+ this: "this";
57
+ window: "window";
58
+ global: "global";
59
+ commonjs: "commonjs";
60
+ commonjs2: "commonjs2";
61
+ "commonjs-module": "commonjs-module";
62
+ amd: "amd";
63
+ "amd-require": "amd-require";
64
+ umd: "umd";
65
+ umd2: "umd2";
66
+ system: "system";
67
+ }>>;
68
+ }, z.core.$strip>]>;
69
+ name: z.ZodOptional<z.ZodString>;
70
+ scope: z.ZodOptional<z.ZodString>;
71
+ sourceType: z.ZodOptional<z.ZodEnum<{
72
+ jsonp: "jsonp";
73
+ var: "var";
74
+ assign: "assign";
75
+ this: "this";
76
+ window: "window";
77
+ global: "global";
78
+ commonjs: "commonjs";
79
+ commonjs2: "commonjs2";
80
+ "commonjs-module": "commonjs-module";
81
+ amd: "amd";
82
+ "amd-require": "amd-require";
83
+ umd: "umd";
84
+ umd2: "umd2";
85
+ system: "system";
86
+ }>>;
87
+ type: z.ZodOptional<z.ZodEnum<{
88
+ object: "object";
89
+ require: "require";
90
+ }>>;
91
+ }, z.core.$strip>, z.ZodObject<{
92
+ content: z.ZodRecord<z.ZodString, z.ZodObject<{
93
+ buildMeta: z.ZodOptional<z.ZodCustom<JsBuildMeta, JsBuildMeta>>;
94
+ exports: z.ZodOptional<z.ZodUnion<[z.ZodArray<z.ZodString>, z.ZodLiteral<true>]>>;
95
+ id: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodUnion<[z.ZodNumber, z.ZodLiteral<number>]>]>>;
96
+ }, z.core.$strip>>;
97
+ context: z.ZodOptional<z.ZodString>;
98
+ extensions: z.ZodOptional<z.ZodArray<z.ZodString>>;
99
+ name: z.ZodString;
100
+ scope: z.ZodOptional<z.ZodString>;
101
+ sourceType: z.ZodOptional<z.ZodEnum<{
102
+ jsonp: "jsonp";
103
+ var: "var";
104
+ assign: "assign";
105
+ this: "this";
106
+ window: "window";
107
+ global: "global";
108
+ commonjs: "commonjs";
109
+ commonjs2: "commonjs2";
110
+ "commonjs-module": "commonjs-module";
111
+ amd: "amd";
112
+ "amd-require": "amd-require";
113
+ umd: "umd";
114
+ umd2: "umd2";
115
+ system: "system";
116
+ }>>;
117
+ type: z.ZodOptional<z.ZodEnum<{
118
+ object: "object";
119
+ require: "require";
120
+ }>>;
121
+ }, z.core.$strip>]>;
122
+ export declare const getHtmlPluginOptionsSchema: () => z.ZodObject<{
123
+ filename: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodCustom<(...args: unknown[]) => any, (...args: unknown[]) => any>]>>;
124
+ template: z.ZodOptional<z.ZodString>;
125
+ templateContent: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodCustom<(...args: unknown[]) => any, (...args: unknown[]) => any>]>>;
126
+ templateParameters: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodRecord<z.ZodString, z.ZodString>, z.ZodBoolean]>, z.ZodCustom<(...args: unknown[]) => any, (...args: unknown[]) => any>]>>;
127
+ inject: z.ZodOptional<z.ZodUnion<[z.ZodEnum<{
128
+ body: "body";
129
+ head: "head";
130
+ }>, z.ZodBoolean]>>;
131
+ publicPath: z.ZodOptional<z.ZodString>;
132
+ base: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodObject<{
133
+ href: z.ZodOptional<z.ZodString>;
134
+ target: z.ZodOptional<z.ZodEnum<{
135
+ _self: "_self";
136
+ _blank: "_blank";
137
+ _parent: "_parent";
138
+ _top: "_top";
139
+ }>>;
140
+ }, z.core.$strict>]>>;
141
+ scriptLoading: z.ZodOptional<z.ZodEnum<{
142
+ module: "module";
143
+ blocking: "blocking";
144
+ defer: "defer";
145
+ "systemjs-module": "systemjs-module";
146
+ }>>;
147
+ chunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
148
+ excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
149
+ chunksSortMode: z.ZodOptional<z.ZodEnum<{
150
+ auto: "auto";
151
+ manual: "manual";
152
+ }>>;
153
+ sri: z.ZodOptional<z.ZodEnum<{
154
+ sha256: "sha256";
155
+ sha384: "sha384";
156
+ sha512: "sha512";
157
+ }>>;
158
+ minify: z.ZodOptional<z.ZodBoolean>;
159
+ title: z.ZodOptional<z.ZodString>;
160
+ favicon: z.ZodOptional<z.ZodString>;
161
+ meta: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodString>]>>>;
162
+ hash: z.ZodOptional<z.ZodBoolean>;
163
+ }, z.core.$strip>;
@@ -1,3 +1,4 @@
1
+ // @ts-ignore
1
2
  import * as z from "zod/v4";
2
3
  export declare const numberOrInfinity: z.ZodUnion<[z.ZodNumber, z.ZodLiteral<number>]>;
3
4
  export declare const anyFunction: z.ZodCustom<(...args: unknown[]) => any, (...args: unknown[]) => any>;
@@ -1,3 +1,4 @@
1
+ // @ts-ignore
1
2
  import type { z } from "zod/v4";
2
3
  export declare class ValidationError extends Error {
3
4
  constructor(message: string);
@@ -14,7 +14,7 @@ import { type GroupConfig } from "../util/smartGrouping";
14
14
  export type KnownStatsFactoryContext = {
15
15
  type: string;
16
16
  makePathsRelative?: ((arg0: string) => string) | undefined;
17
- compilation?: Compilation | undefined;
17
+ compilation: Compilation;
18
18
  cachedGetErrors?: ((arg0: Compilation) => JsStatsError[]) | undefined;
19
19
  cachedGetWarnings?: ((arg0: Compilation) => JsStatsError[]) | undefined;
20
20
  getStatsCompilation: (compilation: Compilation) => JsStatsCompilation;
@@ -1,5 +1,5 @@
1
1
  /**
2
2
  * Check if these version matches:
3
- * `@rspack/core`, `@rspack/binding`, `@rspack/binding-<platform>-<arch>-<abi>`
3
+ * `@rspack/core`, Binding version
4
4
  */
5
5
  export declare const checkVersion: () => Error | null;
package/dist/util/fs.d.ts CHANGED
@@ -77,6 +77,7 @@ export interface OutputFileSystem {
77
77
  stat: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void) => void;
78
78
  lstat?: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: IStats) => void) => void;
79
79
  readFile: (arg0: string, arg1: (arg0?: null | NodeJS.ErrnoException, arg1?: string | Buffer) => void) => void;
80
+ chmod: (arg0: string, arg1: number, arg2: (arg0?: NodeJS.ErrnoException | null) => void) => void;
80
81
  join?: (arg0: string, arg1: string) => string;
81
82
  relative?: (arg0: string, arg1: string) => string;
82
83
  dirname?: (arg0: string) => string;
@@ -8,7 +8,7 @@ var urlBase = decodeURIComponent(__resourceQuery.slice(1));
8
8
  * @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
9
9
  * @returns {() => void} function to destroy response
10
10
  */
11
- exports.keepAlive = function (options) {
11
+ exports.activate = function (options) {
12
12
  var data = options.data;
13
13
  var onError = options.onError;
14
14
  var active = options.active;
@@ -11,14 +11,14 @@ if (typeof EventSource !== "function") {
11
11
  var urlBase = decodeURIComponent(__resourceQuery.slice(1));
12
12
  /** @type {EventSource | undefined} */
13
13
  var activeEventSource;
14
- var activeKeys = new Map();
14
+ var compiling = new Set();
15
15
  var errorHandlers = new Set();
16
16
 
17
17
  var updateEventSource = function updateEventSource() {
18
18
  if (activeEventSource) activeEventSource.close();
19
- if (activeKeys.size) {
19
+ if (compiling.size) {
20
20
  activeEventSource = new EventSource(
21
- urlBase + Array.from(activeKeys.keys()).join("@")
21
+ urlBase + Array.from(compiling).join("@")
22
22
  );
23
23
  /**
24
24
  * @this {EventSource}
@@ -47,17 +47,18 @@ var updateEventSource = function updateEventSource() {
47
47
  * @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
48
48
  * @returns {() => void} function to destroy response
49
49
  */
50
- exports.keepAlive = function (options) {
50
+ exports.activate = function (options) {
51
51
  var data = options.data;
52
52
  var onError = options.onError;
53
53
  var active = options.active;
54
54
  var module = options.module;
55
55
  errorHandlers.add(onError);
56
- var value = activeKeys.get(data) || 0;
57
- activeKeys.set(data, value + 1);
58
- if (value === 0) {
56
+
57
+ if (!compiling.has(data)) {
58
+ compiling.add(data);
59
59
  updateEventSource();
60
60
  }
61
+
61
62
  if (!active && !module.hot) {
62
63
  console.log(
63
64
  "Hot Module Replacement is not enabled. Waiting for process restart..."
@@ -66,14 +67,7 @@ exports.keepAlive = function (options) {
66
67
 
67
68
  return function () {
68
69
  errorHandlers.delete(onError);
69
- setTimeout(function () {
70
- var value = activeKeys.get(data);
71
- if (value === 1) {
72
- activeKeys.delete(data);
73
- updateEventSource();
74
- } else {
75
- activeKeys.set(data, value - 1);
76
- }
77
- }, 1000);
70
+ compiling.delete(data);
71
+ updateEventSource();
78
72
  };
79
73
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "1.4.4",
3
+ "version": "1.4.6",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -38,8 +38,8 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@ast-grep/napi": "^0.37.0",
41
+ "@rsbuild/core": "^1.4.4",
41
42
  "@rslib/core": "0.10.0",
42
- "@swc/core": "1.12.0",
43
43
  "@swc/types": "0.1.22",
44
44
  "@types/graceful-fs": "4.1.9",
45
45
  "@types/watchpack": "^2.4.4",
@@ -51,14 +51,14 @@
51
51
  "tsx": "^4.20.3",
52
52
  "typescript": "^5.8.3",
53
53
  "watchpack": "^2.4.4",
54
- "webpack-sources": "3.3.2",
54
+ "webpack-sources": "3.3.3",
55
55
  "zod": "^3.25.58",
56
56
  "zod-validation-error": "3.5.2"
57
57
  },
58
58
  "dependencies": {
59
59
  "@module-federation/runtime-tools": "0.15.0",
60
60
  "@rspack/lite-tapable": "1.0.1",
61
- "@rspack/binding": "1.4.4"
61
+ "@rspack/binding": "1.4.6"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@swc/helpers": ">=0.5.1"
@@ -69,10 +69,8 @@
69
69
  }
70
70
  },
71
71
  "scripts": {
72
- "build": "rslib build && npm run prepare-container-runtime && npm run codmod",
72
+ "build": "rslib build",
73
73
  "dev": "rslib build --watch",
74
- "prepare-container-runtime": "node ./scripts/prepare-container-runtime.js",
75
- "codmod": "node ./scripts/codmod/index.js",
76
74
  "doc-coverage": "tsx ./scripts/check-documentation-coverage.ts",
77
75
  "api-extractor": "api-extractor run --verbose",
78
76
  "api-extractor:ci": "api-extractor run --verbose || diff temp/core.api.md etc/core.api.md"