@rspack/core 1.4.3 → 1.4.5

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.
@@ -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,4 +1,4 @@
1
- import type { z } from "zod/v4";
1
+ import type { z } from "../config/zod";
2
2
  export declare class ValidationError extends Error {
3
3
  constructor(message: string);
4
4
  }
@@ -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.3",
3
+ "version": "1.4.5",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "The fast Rust-based web bundler with webpack-compatible API",
@@ -38,6 +38,7 @@
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
43
  "@swc/core": "1.12.0",
43
44
  "@swc/types": "0.1.22",
@@ -58,7 +59,7 @@
58
59
  "dependencies": {
59
60
  "@module-federation/runtime-tools": "0.15.0",
60
61
  "@rspack/lite-tapable": "1.0.1",
61
- "@rspack/binding": "1.4.3"
62
+ "@rspack/binding": "1.4.5"
62
63
  },
63
64
  "peerDependencies": {
64
65
  "@swc/helpers": ">=0.5.1"