@rspack/core 0.6.5-canary-d1f53fd-20240511004704 → 0.6.5-canary-6d6fcd3-20240514084813

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.
package/dist/Compiler.js CHANGED
@@ -609,33 +609,27 @@ _Compiler_instance = new WeakMap(), _Compiler_initial = new WeakMap(), _Compiler
609
609
  };
610
610
  await queried.promise(data, {});
611
611
  }),
612
- registerContextModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryBeforeResolve, () => this.compilationParams.contextModuleFactory.hooks.beforeResolve, queried => async (bindingData) => {
613
- return queried.promise(bindingData);
614
- }),
615
- registerContextModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryAfterResolve, () => this.compilationParams.contextModuleFactory.hooks.afterResolve, queried => async (bindingData) => {
616
- var _a;
617
- const data = bindingData
618
- ? ({
619
- resource: bindingData.resource,
620
- regExp: bindingData.regExp
621
- ? new RegExp(bindingData.regExp)
622
- : undefined,
623
- request: bindingData.request,
624
- context: bindingData.context,
625
- // TODO: Dependencies are not fully supported yet; this is a placeholder to prevent errors in moment-locales-webpack-plugin.
626
- dependencies: []
627
- })
628
- : false;
612
+ registerContextModuleFactoryBeforeResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryBeforeResolve, () => this.compilationParams.contextModuleFactory.hooks.beforeResolve, queried => async (arg) => {
613
+ const data = {
614
+ request: arg.request,
615
+ context: arg.context,
616
+ fileDependencies: [],
617
+ missingDependencies: [],
618
+ contextDependencies: []
619
+ };
629
620
  const ret = await queried.promise(data);
630
- const result = ret
631
- ? ({
632
- resource: ret.resource,
633
- context: ret.context,
634
- request: ret.request,
635
- regExp: (_a = ret.regExp) === null || _a === void 0 ? void 0 : _a.toString()
636
- })
637
- : false;
638
- return result;
621
+ return [ret, data];
622
+ }),
623
+ registerContextModuleFactoryAfterResolveTaps: __classPrivateFieldGet(this, _Compiler_instances, "m", _Compiler_createHookRegisterTaps).call(this, binding.RegisterJsTapKind.ContextModuleFactoryAfterResolve, () => this.compilationParams.contextModuleFactory.hooks.afterResolve, queried => async (arg) => {
624
+ const data = {
625
+ request: arg.request,
626
+ context: arg.context,
627
+ fileDependencies: arg.fileDependencies,
628
+ missingDependencies: arg.missingDependencies,
629
+ contextDependencies: arg.contextDependencies,
630
+ createData: arg.createData
631
+ };
632
+ return await queried.promise(data);
639
633
  })
640
634
  }, "f");
641
635
  __classPrivateFieldSet(this, _Compiler_instance, new instanceBinding.Rspack(rawOptions, this.builtinPlugins, __classPrivateFieldGet(this, _Compiler_registers, "f"), (0, fileSystem_1.createThreadsafeNodeFSFromRaw)(this.outputFileSystem)), "f");
@@ -1,13 +1,9 @@
1
1
  import * as liteTapable from "./lite-tapable";
2
- import { ContextModuleFactoryAfterResolveResult, ContextModuleFactoryBeforeResolveResult } from "./Module";
2
+ import { ResolveData } from "./Module";
3
3
  export declare class ContextModuleFactory {
4
4
  hooks: {
5
- beforeResolve: liteTapable.AsyncSeriesWaterfallHook<[
6
- ContextModuleFactoryBeforeResolveResult
7
- ], ContextModuleFactoryBeforeResolveResult | void>;
8
- afterResolve: liteTapable.AsyncSeriesWaterfallHook<[
9
- ContextModuleFactoryAfterResolveResult
10
- ], ContextModuleFactoryAfterResolveResult | void>;
5
+ beforeResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
6
+ afterResolve: liteTapable.AsyncSeriesBailHook<[ResolveData], false | void>;
11
7
  };
12
8
  constructor();
13
9
  }
@@ -41,8 +41,8 @@ class ContextModuleFactory {
41
41
  // /** @type {AsyncSeriesBailHook<[ResolveData], Module>} */
42
42
  // factorize: new AsyncSeriesBailHook(["resolveData"]),
43
43
  // /** @type {AsyncSeriesBailHook<[ResolveData], false | void>} */
44
- beforeResolve: new liteTapable.AsyncSeriesWaterfallHook(["resolveData"]),
45
- afterResolve: new liteTapable.AsyncSeriesWaterfallHook(["resolveData"])
44
+ beforeResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"]),
45
+ afterResolve: new liteTapable.AsyncSeriesBailHook(["resolveData"])
46
46
  // /** @type {AsyncSeriesBailHook<[ResolveData["createData"], ResolveData], Module | void>} */
47
47
  // createModule: new AsyncSeriesBailHook(["createData", "resolveData"]),
48
48
  // /** @type {SyncWaterfallHook<[Module, ResolveData["createData"], ResolveData], Module>} */
package/dist/Module.d.ts CHANGED
@@ -18,17 +18,6 @@ export type ResolveData = {
18
18
  contextDependencies: string[];
19
19
  createData?: CreateData;
20
20
  };
21
- export type ContextModuleFactoryBeforeResolveResult = false | {
22
- context: string;
23
- request?: string;
24
- };
25
- export type ContextModuleFactoryAfterResolveResult = false | {
26
- resource: string;
27
- context: string;
28
- request: string;
29
- regExp?: RegExp;
30
- dependencies: Array<any>;
31
- };
32
21
  export declare class Module {
33
22
  #private;
34
23
  _originalSource?: Source;
package/dist/exports.d.ts CHANGED
@@ -59,11 +59,9 @@ export { EnvironmentPlugin } from "./lib/EnvironmentPlugin";
59
59
  export { NormalModuleReplacementPlugin } from "./lib/NormalModuleReplacementPlugin";
60
60
  import NodeTemplatePlugin from "./node/NodeTemplatePlugin";
61
61
  import { NodeTargetPlugin } from "./builtin-plugin";
62
- import NodeEnvironmentPlugin from "./node/NodeEnvironmentPlugin";
63
62
  interface Node {
64
63
  NodeTargetPlugin: typeof NodeTargetPlugin;
65
64
  NodeTemplatePlugin: typeof NodeTemplatePlugin;
66
- NodeEnvironmentPlugin: typeof NodeEnvironmentPlugin;
67
65
  }
68
66
  export declare const node: Node;
69
67
  import { ElectronTargetPlugin } from "./builtin-plugin";
package/dist/exports.js CHANGED
@@ -100,12 +100,7 @@ var NormalModuleReplacementPlugin_1 = require("./lib/NormalModuleReplacementPlug
100
100
  Object.defineProperty(exports, "NormalModuleReplacementPlugin", { enumerable: true, get: function () { return NormalModuleReplacementPlugin_1.NormalModuleReplacementPlugin; } });
101
101
  const NodeTemplatePlugin_1 = __importDefault(require("./node/NodeTemplatePlugin"));
102
102
  const builtin_plugin_10 = require("./builtin-plugin");
103
- const NodeEnvironmentPlugin_1 = __importDefault(require("./node/NodeEnvironmentPlugin"));
104
- exports.node = {
105
- NodeTargetPlugin: builtin_plugin_10.NodeTargetPlugin,
106
- NodeTemplatePlugin: NodeTemplatePlugin_1.default,
107
- NodeEnvironmentPlugin: NodeEnvironmentPlugin_1.default
108
- };
103
+ exports.node = { NodeTargetPlugin: builtin_plugin_10.NodeTargetPlugin, NodeTemplatePlugin: NodeTemplatePlugin_1.default };
109
104
  const builtin_plugin_11 = require("./builtin-plugin");
110
105
  exports.electron = { ElectronTargetPlugin: builtin_plugin_11.ElectronTargetPlugin };
111
106
  const builtin_plugin_12 = require("./builtin-plugin");
@@ -112,12 +112,6 @@ export declare class AsyncSeriesBailHook<T, R, AdditionalOptions = UnsetAddition
112
112
  tapAsync(options: Options<AdditionalOptions>, fn: FnWithCallback<T, void>): void;
113
113
  tapPromise(options: Options<AdditionalOptions>, fn: Fn<T, void>): void;
114
114
  }
115
- export declare class AsyncSeriesWaterfallHook<T, R, AdditionalOptions = UnsetAdditionalOptions> extends Hook<T, R, AdditionalOptions> {
116
- constructor(args?: ArgumentNames<AsArray<T>>, name?: string);
117
- callAsyncStageRange(queried: QueriedHook<T, R, AdditionalOptions>, ...args: Append<AsArray<T>, Callback<Error, R>>): void;
118
- tapAsync(options: Options<AdditionalOptions>, fn: FnWithCallback<T, void>): void;
119
- tapPromise(options: Options<AdditionalOptions>, fn: Fn<T, void>): void;
120
- }
121
115
  export type HookMapKey = any;
122
116
  export type HookFactory<H> = (key: HookMapKey, hook?: H) => H;
123
117
  export interface HookMapInterceptor<H> {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.QueriedHookMap = exports.HookMap = exports.AsyncSeriesWaterfallHook = exports.AsyncSeriesBailHook = exports.AsyncSeriesHook = exports.AsyncParallelHook = exports.SyncBailHook = exports.SyncHook = exports.QueriedHook = exports.safeStage = exports.maxStage = exports.minStage = exports.Hook = void 0;
3
+ exports.QueriedHookMap = exports.HookMap = exports.AsyncSeriesBailHook = exports.AsyncSeriesHook = exports.AsyncParallelHook = exports.SyncBailHook = exports.SyncHook = exports.QueriedHook = exports.safeStage = exports.maxStage = exports.minStage = exports.Hook = void 0;
4
4
  class Hook {
5
5
  constructor(args, name) {
6
6
  this.args = args;
@@ -578,112 +578,6 @@ class AsyncSeriesBailHook extends Hook {
578
578
  }
579
579
  }
580
580
  exports.AsyncSeriesBailHook = AsyncSeriesBailHook;
581
- class AsyncSeriesWaterfallHook extends Hook {
582
- constructor(args, name) {
583
- if (!(args === null || args === void 0 ? void 0 : args.length))
584
- throw new Error("Waterfall hooks must have at least one argument");
585
- super(args, name);
586
- }
587
- callAsyncStageRange(queried, ...args) {
588
- const { stageRange: [from, to], tapsInRange } = queried;
589
- let data = args[0];
590
- const cb = args[1];
591
- if (from === exports.minStage) {
592
- this._runCallInterceptors(data);
593
- }
594
- const done = () => {
595
- this._runDoneInterceptors();
596
- cb(null, data);
597
- };
598
- const error = (e) => {
599
- this._runErrorInterceptors(e);
600
- cb(e);
601
- };
602
- if (tapsInRange.length === 0)
603
- return done();
604
- let index = 0;
605
- const next = () => {
606
- const tap = tapsInRange[index];
607
- this._runTapInterceptors(tap);
608
- if (tap.type === "promise") {
609
- const promise = tap.fn(data);
610
- if (!promise || !promise.then) {
611
- throw new Error("Tap function (tapPromise) did not return promise (returned " +
612
- promise +
613
- ")");
614
- }
615
- promise.then((r) => {
616
- index += 1;
617
- if (r !== undefined) {
618
- data = r;
619
- }
620
- if (index === tapsInRange.length) {
621
- done();
622
- }
623
- else {
624
- next();
625
- }
626
- }, (e) => {
627
- index = tapsInRange.length;
628
- error(e);
629
- });
630
- }
631
- else if (tap.type === "async") {
632
- tap.fn(data, (e, r) => {
633
- if (e) {
634
- index = tapsInRange.length;
635
- error(e);
636
- }
637
- else {
638
- index += 1;
639
- if (r !== undefined) {
640
- data = r;
641
- }
642
- if (index === tapsInRange.length) {
643
- done();
644
- }
645
- else {
646
- next();
647
- }
648
- }
649
- });
650
- }
651
- else {
652
- let hasError = false;
653
- try {
654
- const r = tap.fn(data);
655
- if (r !== undefined) {
656
- data = r;
657
- }
658
- }
659
- catch (e) {
660
- hasError = true;
661
- index = tapsInRange.length;
662
- error(e);
663
- }
664
- if (!hasError) {
665
- index += 1;
666
- if (index === tapsInRange.length) {
667
- done();
668
- }
669
- else {
670
- next();
671
- }
672
- }
673
- }
674
- if (index === tapsInRange.length)
675
- return;
676
- };
677
- next();
678
- }
679
- tapAsync(options, fn) {
680
- this._tap("async", options, fn);
681
- }
682
- tapPromise(options, fn) {
683
- this._tap("promise", options, fn);
684
- }
685
- }
686
- exports.AsyncSeriesWaterfallHook = AsyncSeriesWaterfallHook;
687
581
  const defaultFactory = (key, hook) => hook;
688
582
  class HookMap {
689
583
  constructor(factory, name) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.6.5-canary-d1f53fd-20240511004704",
3
+ "version": "0.6.5-canary-6d6fcd3-20240514084813",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -71,8 +71,8 @@
71
71
  "watchpack": "^2.4.0",
72
72
  "zod": "^3.21.4",
73
73
  "zod-validation-error": "1.3.1",
74
- "@rspack/core": "0.6.5-canary-d1f53fd-20240511004704",
75
- "@rspack/plugin-minify": "^0.6.5-canary-d1f53fd-20240511004704"
74
+ "@rspack/core": "0.6.5-canary-6d6fcd3-20240514084813",
75
+ "@rspack/plugin-minify": "^0.6.5-canary-6d6fcd3-20240514084813"
76
76
  },
77
77
  "dependencies": {
78
78
  "@module-federation/runtime-tools": "0.1.6",
@@ -80,7 +80,7 @@
80
80
  "enhanced-resolve": "5.12.0",
81
81
  "tapable": "2.2.1",
82
82
  "webpack-sources": "3.2.3",
83
- "@rspack/binding": "0.6.5-canary-d1f53fd-20240511004704"
83
+ "@rspack/binding": "0.6.5-canary-6d6fcd3-20240514084813"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "@swc/helpers": ">=0.5.1"