@rspack/core 0.5.9-canary-a856e2e-20240329110405 → 0.5.9-canary-df5312d-20240330095228

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.
@@ -42,7 +42,6 @@ declare class Compiler {
42
42
  };
43
43
  compilation?: Compilation;
44
44
  compilationParams?: CompilationParams;
45
- first: boolean;
46
45
  builtinPlugins: binding.BuiltinPlugin[];
47
46
  root: Compiler;
48
47
  running: boolean;
@@ -110,14 +109,10 @@ declare class Compiler {
110
109
  getInfrastructureLogger(name: string | Function): Logger;
111
110
  run(callback: Callback<Error, Stats>): void;
112
111
  /**
113
- * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
112
+ * * Note: This is not a webpack public API, maybe removed in future.
113
+ * @internal
114
114
  */
115
- build(callback?: (error: Error | null) => void): void;
116
- /**
117
- * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
118
- * @deprecated This is a low-level incremental rebuild API, which shouldn't be used intentionally. Use `compiler.build` instead.
119
- */
120
- rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
115
+ __internal__rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
121
116
  compile(callback: Callback<Error, Compilation>): void;
122
117
  watch(watchOptions: WatchOptions, handler: Callback<Error, Stats>): Watching;
123
118
  purgeInputFileSystem(): void;
package/dist/Compiler.js CHANGED
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
36
36
  var __importDefault = (this && this.__importDefault) || function (mod) {
37
37
  return (mod && mod.__esModule) ? mod : { "default": mod };
38
38
  };
39
- var _Compiler_instances, _Compiler_instance, _Compiler_disabledHooks, _Compiler_nonSkippableRegisters, _Compiler_registers, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateNonSkippableRegisters, _Compiler_decorateJsTaps, _Compiler_createHookRegisterTaps, _Compiler_createHookMapRegisterTaps, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
39
+ var _Compiler_instances, _Compiler_instance, _Compiler_initial, _Compiler_disabledHooks, _Compiler_nonSkippableRegisters, _Compiler_registers, _Compiler_moduleExecutionResultsMap, _Compiler_getInstance, _Compiler_updateNonSkippableRegisters, _Compiler_decorateJsTaps, _Compiler_createHookRegisterTaps, _Compiler_createHookMapRegisterTaps, _Compiler_build, _Compiler_createCompilation, _Compiler_resetThisCompilation, _Compiler_newCompilationParams;
40
40
  Object.defineProperty(exports, "__esModule", { value: true });
41
41
  exports.Compiler = void 0;
42
42
  /**
@@ -84,7 +84,7 @@ class Compiler {
84
84
  _Compiler_instance.set(this, void 0);
85
85
  this.webpack = index_1.rspack;
86
86
  // TODO: remove this after remove rebuild on the rust side.
87
- this.first = true;
87
+ _Compiler_initial.set(this, true);
88
88
  _Compiler_disabledHooks.set(this, void 0);
89
89
  _Compiler_nonSkippableRegisters.set(this, void 0);
90
90
  _Compiler_registers.set(this, void 0);
@@ -386,36 +386,10 @@ class Compiler {
386
386
  }
387
387
  }
388
388
  /**
389
- * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
389
+ * * Note: This is not a webpack public API, maybe removed in future.
390
+ * @internal
390
391
  */
391
- build(callback) {
392
- __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
393
- if (error) {
394
- return callback === null || callback === void 0 ? void 0 : callback(error);
395
- }
396
- if (!this.first) {
397
- instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
398
- if (error) {
399
- return callback === null || callback === void 0 ? void 0 : callback(error);
400
- }
401
- callback === null || callback === void 0 ? void 0 : callback(null);
402
- });
403
- return;
404
- }
405
- this.first = false;
406
- instance.build(error => {
407
- if (error) {
408
- return callback === null || callback === void 0 ? void 0 : callback(error);
409
- }
410
- callback === null || callback === void 0 ? void 0 : callback(null);
411
- });
412
- });
413
- }
414
- /**
415
- * Safety: This method is only valid to call if the previous rebuild task is finished, or there will be data races.
416
- * @deprecated This is a low-level incremental rebuild API, which shouldn't be used intentionally. Use `compiler.build` instead.
417
- */
418
- rebuild(modifiedFiles, removedFiles, callback) {
392
+ __internal__rebuild(modifiedFiles, removedFiles, callback) {
419
393
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
420
394
  if (error) {
421
395
  return callback === null || callback === void 0 ? void 0 : callback(error);
@@ -437,7 +411,7 @@ class Compiler {
437
411
  }
438
412
  this.hooks.compile.call(params);
439
413
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_resetThisCompilation).call(this);
440
- this.build(err => {
414
+ __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_build).call(this, err => {
441
415
  if (err) {
442
416
  return callback(err);
443
417
  }
@@ -470,7 +444,7 @@ class Compiler {
470
444
  }
471
445
  close(callback) {
472
446
  if (this.watching) {
473
- // When there is still an active watching, close this first
447
+ // When there is still an active watching, close this #initial
474
448
  this.watching.close(() => {
475
449
  this.close(callback);
476
450
  });
@@ -497,7 +471,7 @@ class Compiler {
497
471
  }
498
472
  }
499
473
  exports.Compiler = Compiler;
500
- _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_getInstance = function _Compiler_getInstance(callback) {
474
+ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Compiler_nonSkippableRegisters = new WeakMap(), _Compiler_registers = new WeakMap(), _Compiler_moduleExecutionResultsMap = new WeakMap(), _Compiler_instances = new WeakSet(), _Compiler_getInstance = function _Compiler_getInstance(callback) {
501
475
  const error = (0, bindingVersionCheck_1.checkVersion)();
502
476
  if (error) {
503
477
  return callback(error);
@@ -751,6 +725,28 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
751
725
  getTaps.registerKind = registerKind;
752
726
  getTaps.getHookMap = getHookMap;
753
727
  return getTaps;
728
+ }, _Compiler_build = function _Compiler_build(callback) {
729
+ __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_getInstance).call(this, (error, instance) => {
730
+ if (error) {
731
+ return callback === null || callback === void 0 ? void 0 : callback(error);
732
+ }
733
+ if (!__classPrivateFieldGet(this, _Compiler_initial, "f")) {
734
+ instance.rebuild(Array.from(this.modifiedFiles || []), Array.from(this.removedFiles || []), error => {
735
+ if (error) {
736
+ return callback === null || callback === void 0 ? void 0 : callback(error);
737
+ }
738
+ callback === null || callback === void 0 ? void 0 : callback(null);
739
+ });
740
+ return;
741
+ }
742
+ __classPrivateFieldSet(this, _Compiler_initial, false, "f");
743
+ instance.build(error => {
744
+ if (error) {
745
+ return callback === null || callback === void 0 ? void 0 : callback(error);
746
+ }
747
+ callback === null || callback === void 0 ? void 0 : callback(null);
748
+ });
749
+ });
754
750
  }, _Compiler_createCompilation = function _Compiler_createCompilation(native) {
755
751
  const compilation = new Compilation_1.Compilation(this, native);
756
752
  compilation.name = this.name;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.5.9-canary-a856e2e-20240329110405",
3
+ "version": "0.5.9-canary-df5312d-20240330095228",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -56,8 +56,8 @@
56
56
  "styled-components": "^6.0.8",
57
57
  "terser": "5.27.2",
58
58
  "wast-loader": "^1.11.4",
59
- "@rspack/core": "0.5.9-canary-a856e2e-20240329110405",
60
- "@rspack/plugin-minify": "^0.5.9-canary-a856e2e-20240329110405"
59
+ "@rspack/core": "0.5.9-canary-df5312d-20240330095228",
60
+ "@rspack/plugin-minify": "^0.5.9-canary-df5312d-20240330095228"
61
61
  },
62
62
  "dependencies": {
63
63
  "@module-federation/runtime-tools": "0.0.8",
@@ -72,7 +72,7 @@
72
72
  "webpack-sources": "3.2.3",
73
73
  "zod": "^3.21.4",
74
74
  "zod-validation-error": "1.3.1",
75
- "@rspack/binding": "0.5.9-canary-a856e2e-20240329110405"
75
+ "@rspack/binding": "0.5.9-canary-df5312d-20240330095228"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@swc/helpers": ">=0.5.1"