@rspack/core 0.5.7-canary-3320ea8-20240312032922 → 0.5.7-canary-1f35c13-20240313091234

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.
@@ -36,7 +36,7 @@ export interface Asset {
36
36
  }
37
37
  export interface LogEntry {
38
38
  type: string;
39
- args: any[];
39
+ args?: any[];
40
40
  time?: number;
41
41
  trace?: string[];
42
42
  }
@@ -473,14 +473,12 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
473
473
  const logEntry = {
474
474
  time: Date.now(),
475
475
  type,
476
- // @ts-expect-error
477
476
  args,
478
- // @ts-expect-error
479
477
  trace
480
478
  };
481
479
  if (this.hooks.log.call(name, logEntry) === undefined) {
482
480
  if (logEntry.type === Logger_1.LogType.profileEnd) {
483
- if (typeof console.profileEnd === "function") {
481
+ if (typeof console.profileEnd === "function" && logEntry.args) {
484
482
  console.profileEnd(`[${name}] ${logEntry.args[0]}`);
485
483
  }
486
484
  }
@@ -493,7 +491,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
493
491
  }
494
492
  logEntries.push(logEntry);
495
493
  if (logEntry.type === Logger_1.LogType.profile) {
496
- if (typeof console.profile === "function") {
494
+ if (typeof console.profile === "function" && logEntry.args) {
497
495
  console.profile(`[${name}] ${logEntry.args[0]}`);
498
496
  }
499
497
  }
@@ -12,7 +12,7 @@ import * as binding from "@rspack/binding";
12
12
  import * as tapable from "tapable";
13
13
  import * as liteTapable from "./lite-tapable";
14
14
  import { Callback } from "tapable";
15
- import type { WatchOptions } from "watchpack";
15
+ import { WatchOptions } from "./config";
16
16
  import { EntryNormalized, OutputNormalized, RspackOptionsNormalized, RspackPluginInstance } from "./config";
17
17
  import { RuleSetCompiler } from "./RuleSetCompiler";
18
18
  import { Stats } from "./Stats";
@@ -48,7 +48,7 @@ declare class Compiler {
48
48
  ruleSet: RuleSetCompiler;
49
49
  watchFileSystem: WatchFileSystem;
50
50
  intermediateFileSystem: any;
51
- watchMode: boolean;
51
+ watchMode?: boolean;
52
52
  context: string;
53
53
  modifiedFiles?: ReadonlySet<string>;
54
54
  cache: Cache;
@@ -67,7 +67,7 @@ declare class Compiler {
67
67
  contextModuleFactory: tapable.SyncHook<ContextModuleFactory>;
68
68
  initialize: tapable.SyncHook<[]>;
69
69
  shouldEmit: tapable.SyncBailHook<[Compilation], boolean>;
70
- infrastructureLog: tapable.SyncBailHook<[string, string, any[]], true>;
70
+ infrastructureLog: tapable.SyncBailHook<[string, string, any[]?], true>;
71
71
  beforeRun: tapable.AsyncSeriesHook<[Compiler]>;
72
72
  run: tapable.AsyncSeriesHook<[Compiler]>;
73
73
  emit: tapable.AsyncSeriesHook<[Compilation]>;
@@ -111,7 +111,7 @@ declare class Compiler {
111
111
  */
112
112
  rebuild(modifiedFiles?: ReadonlySet<string>, removedFiles?: ReadonlySet<string>, callback?: (error: Error | null) => void): void;
113
113
  compile(callback: Callback<Error, Compilation>): void;
114
- watch(watchOptions: WatchOptions, handler: Callback<Error, Stats>): Watching;
114
+ watch(watchOptions: WatchOptions, handler: (error?: Error, stats?: Stats) => void): Watching | void;
115
115
  purgeInputFileSystem(): void;
116
116
  close(callback: (error?: Error | null) => void): void;
117
117
  getAsset(name: string): Buffer | null;
package/dist/Compiler.js CHANGED
@@ -259,9 +259,7 @@ class Compiler {
259
259
  }
260
260
  }
261
261
  else {
262
- if (
263
- // @ts-expect-error
264
- this.hooks.infrastructureLog.call(name, type, args) === undefined) {
262
+ if (this.hooks.infrastructureLog.call(name, type, args) === undefined) {
265
263
  if (this.infrastructureLogger !== undefined) {
266
264
  this.infrastructureLogger(name, type, args);
267
265
  }
@@ -270,8 +268,7 @@ class Compiler {
270
268
  }, (childName) => {
271
269
  if (typeof name === "function") {
272
270
  if (typeof childName === "function") {
273
- // @ts-expect-error
274
- return this.getInfrastructureLogger(_ => {
271
+ return this.getInfrastructureLogger(() => {
275
272
  if (typeof name === "function") {
276
273
  name = name();
277
274
  if (!name) {
@@ -324,7 +321,6 @@ class Compiler {
324
321
  const startTime = Date.now();
325
322
  this.running = true;
326
323
  const doRun = () => {
327
- // @ts-expect-error
328
324
  const finalCallback = (err, stats) => {
329
325
  this.idle = true;
330
326
  this.cache.beginIdle();
@@ -336,7 +332,7 @@ class Compiler {
336
332
  if (callback) {
337
333
  callback(err, stats);
338
334
  }
339
- this.hooks.afterDone.call(stats);
335
+ stats && this.hooks.afterDone.call(stats);
340
336
  };
341
337
  this.hooks.beforeRun.callAsync(this, err => {
342
338
  if (err) {
@@ -447,12 +443,10 @@ class Compiler {
447
443
  }
448
444
  watch(watchOptions, handler) {
449
445
  if (this.running) {
450
- // @ts-expect-error
451
446
  return handler(new ConcurrentCompilationError_1.default());
452
447
  }
453
448
  this.running = true;
454
449
  this.watchMode = true;
455
- // @ts-expect-error
456
450
  this.watching = new Watching_1.Watching(this, watchOptions, handler);
457
451
  return this.watching;
458
452
  }
@@ -647,7 +641,7 @@ _Compiler_instance = new WeakMap(), _Compiler_disabledHooks = new WeakMap(), _Co
647
641
  };
648
642
  });
649
643
  __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_updateDisabledHooks).call(this);
650
- return res;
644
+ return [res, resolveData.createData];
651
645
  }, _Compiler_contextModuleFactoryBeforeResolve = async function _Compiler_contextModuleFactoryBeforeResolve(resourceData) {
652
646
  var _a;
653
647
  let res = await ((_a = this.compilation.contextModuleFactory) === null || _a === void 0 ? void 0 : _a.hooks.beforeResolve.promise(resourceData));
@@ -240,8 +240,8 @@ class MultiCompiler {
240
240
  }, (compiler, watching, _done) => {
241
241
  if (compiler.watching !== watching)
242
242
  return;
243
- if (!watching.running)
244
- watching.invalidate();
243
+ if (!(watching === null || watching === void 0 ? void 0 : watching.running))
244
+ watching === null || watching === void 0 ? void 0 : watching.invalidate();
245
245
  }, handler);
246
246
  // @ts-expect-error
247
247
  return new MultiWatching_1.default(watchings, this);
@@ -3229,19 +3229,19 @@ export type Watch = z.infer<typeof watch>;
3229
3229
  declare const watchOptions: z.ZodObject<{
3230
3230
  aggregateTimeout: z.ZodOptional<z.ZodNumber>;
3231
3231
  followSymlinks: z.ZodOptional<z.ZodBoolean>;
3232
- ignored: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodString]>>;
3232
+ ignored: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodString]>, z.ZodFunction<z.ZodTuple<[z.ZodString], null>, z.ZodBoolean>]>>;
3233
3233
  poll: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
3234
3234
  stdin: z.ZodOptional<z.ZodBoolean>;
3235
3235
  }, "strict", z.ZodTypeAny, {
3236
3236
  aggregateTimeout?: number | undefined;
3237
3237
  followSymlinks?: boolean | undefined;
3238
- ignored?: string | RegExp | string[] | undefined;
3238
+ ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
3239
3239
  poll?: number | boolean | undefined;
3240
3240
  stdin?: boolean | undefined;
3241
3241
  }, {
3242
3242
  aggregateTimeout?: number | undefined;
3243
3243
  followSymlinks?: boolean | undefined;
3244
- ignored?: string | RegExp | string[] | undefined;
3244
+ ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
3245
3245
  poll?: number | boolean | undefined;
3246
3246
  stdin?: boolean | undefined;
3247
3247
  }>;
@@ -3874,19 +3874,19 @@ export declare const rspackOptions: z.ZodObject<{
3874
3874
  watchOptions: z.ZodOptional<z.ZodObject<{
3875
3875
  aggregateTimeout: z.ZodOptional<z.ZodNumber>;
3876
3876
  followSymlinks: z.ZodOptional<z.ZodBoolean>;
3877
- ignored: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodString]>>;
3877
+ ignored: z.ZodOptional<z.ZodUnion<[z.ZodUnion<[z.ZodUnion<[z.ZodArray<z.ZodString, "many">, z.ZodType<RegExp, z.ZodTypeDef, RegExp>]>, z.ZodString]>, z.ZodFunction<z.ZodTuple<[z.ZodString], null>, z.ZodBoolean>]>>;
3878
3878
  poll: z.ZodOptional<z.ZodUnion<[z.ZodNumber, z.ZodBoolean]>>;
3879
3879
  stdin: z.ZodOptional<z.ZodBoolean>;
3880
3880
  }, "strict", z.ZodTypeAny, {
3881
3881
  aggregateTimeout?: number | undefined;
3882
3882
  followSymlinks?: boolean | undefined;
3883
- ignored?: string | RegExp | string[] | undefined;
3883
+ ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
3884
3884
  poll?: number | boolean | undefined;
3885
3885
  stdin?: boolean | undefined;
3886
3886
  }, {
3887
3887
  aggregateTimeout?: number | undefined;
3888
3888
  followSymlinks?: boolean | undefined;
3889
- ignored?: string | RegExp | string[] | undefined;
3889
+ ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
3890
3890
  poll?: number | boolean | undefined;
3891
3891
  stdin?: boolean | undefined;
3892
3892
  }>>;
@@ -4750,7 +4750,7 @@ export declare const rspackOptions: z.ZodObject<{
4750
4750
  watchOptions?: {
4751
4751
  aggregateTimeout?: number | undefined;
4752
4752
  followSymlinks?: boolean | undefined;
4753
- ignored?: string | RegExp | string[] | undefined;
4753
+ ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
4754
4754
  poll?: number | boolean | undefined;
4755
4755
  stdin?: boolean | undefined;
4756
4756
  } | undefined;
@@ -5076,7 +5076,7 @@ export declare const rspackOptions: z.ZodObject<{
5076
5076
  watchOptions?: {
5077
5077
  aggregateTimeout?: number | undefined;
5078
5078
  followSymlinks?: boolean | undefined;
5079
- ignored?: string | RegExp | string[] | undefined;
5079
+ ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
5080
5080
  poll?: number | boolean | undefined;
5081
5081
  stdin?: boolean | undefined;
5082
5082
  } | undefined;
@@ -722,6 +722,7 @@ const watchOptions = zod_1.z.strictObject({
722
722
  .array()
723
723
  .or(zod_1.z.instanceof(RegExp))
724
724
  .or(zod_1.z.string())
725
+ .or(zod_1.z.function(zod_1.z.tuple([zod_1.z.string()])).returns(zod_1.z.boolean()))
725
726
  .optional(),
726
727
  poll: zod_1.z.number().or(zod_1.z.boolean()).optional(),
727
728
  stdin: zod_1.z.boolean().optional()
package/dist/exports.d.ts CHANGED
@@ -194,7 +194,7 @@ export declare const config: {
194
194
  watchOptions?: {
195
195
  aggregateTimeout?: number | undefined;
196
196
  followSymlinks?: boolean | undefined;
197
- ignored?: string | RegExp | string[] | undefined;
197
+ ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
198
198
  poll?: number | boolean | undefined;
199
199
  stdin?: boolean | undefined;
200
200
  } | undefined;
@@ -522,7 +522,7 @@ export declare const config: {
522
522
  watchOptions?: {
523
523
  aggregateTimeout?: number | undefined;
524
524
  followSymlinks?: boolean | undefined;
525
- ignored?: string | RegExp | string[] | undefined;
525
+ ignored?: string | RegExp | string[] | ((args_0: string) => boolean) | undefined;
526
526
  poll?: number | boolean | undefined;
527
527
  stdin?: boolean | undefined;
528
528
  } | undefined;
@@ -7,7 +7,8 @@
7
7
  * Copyright (c) JS Foundation and other contributors
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
- import Watchpack, { WatchOptions } from "watchpack";
10
+ import Watchpack from "watchpack";
11
+ import { WatchOptions } from "../config";
11
12
  import { FileSystemInfoEntry, Watcher, WatchFileSystem } from "../util/fs";
12
13
  export default class NodeWatchFileSystem implements WatchFileSystem {
13
14
  inputFileSystem: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.5.7-canary-3320ea8-20240312032922",
3
+ "version": "0.5.7-canary-1f35c13-20240313091234",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -55,9 +55,9 @@
55
55
  "styled-components": "^6.0.8",
56
56
  "terser": "5.27.2",
57
57
  "wast-loader": "^1.11.4",
58
- "@rspack/plugin-node-polyfill": "^0.5.7-canary-3320ea8-20240312032922",
59
- "@rspack/core": "0.5.7-canary-3320ea8-20240312032922",
60
- "@rspack/plugin-minify": "^0.5.7-canary-3320ea8-20240312032922"
58
+ "@rspack/core": "0.5.7-canary-1f35c13-20240313091234",
59
+ "@rspack/plugin-minify": "^0.5.7-canary-1f35c13-20240313091234",
60
+ "@rspack/plugin-node-polyfill": "^0.5.7-canary-1f35c13-20240313091234"
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.7-canary-3320ea8-20240312032922"
75
+ "@rspack/binding": "0.5.7-canary-1f35c13-20240313091234"
76
76
  },
77
77
  "peerDependencies": {
78
78
  "@swc/helpers": ">=0.5.1"