@rspack/core 0.6.1 → 0.6.2-canary-4b8f4a6-20240417094517

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.
Files changed (81) hide show
  1. package/dist/Compilation.d.ts +6 -6
  2. package/dist/Compilation.js +3 -4
  3. package/dist/Compiler.d.ts +5 -5
  4. package/dist/Compiler.js +8 -8
  5. package/dist/MultiCompiler.d.ts +8 -18
  6. package/dist/MultiCompiler.js +7 -17
  7. package/dist/MultiWatching.d.ts +2 -10
  8. package/dist/MultiWatching.js +2 -10
  9. package/dist/RuntimeGlobals.d.ts +10 -10
  10. package/dist/RuntimeGlobals.js +10 -10
  11. package/dist/builtin-plugin/APIPlugin.d.ts +1 -1
  12. package/dist/builtin-plugin/ArrayPushCallbackChunkFormatPlugin.d.ts +1 -1
  13. package/dist/builtin-plugin/AssetModulesPlugin.d.ts +1 -1
  14. package/dist/builtin-plugin/AsyncWebAssemblyModulesPlugin.d.ts +1 -1
  15. package/dist/builtin-plugin/BannerPlugin.d.ts +1 -1
  16. package/dist/builtin-plugin/BundlerInfoRspackPlugin.d.ts +1 -1
  17. package/dist/builtin-plugin/ChunkPrefetchPreloadPlugin.d.ts +1 -1
  18. package/dist/builtin-plugin/CommonJsChunkFormatPlugin.d.ts +1 -1
  19. package/dist/builtin-plugin/CopyRspackPlugin.d.ts +1 -1
  20. package/dist/builtin-plugin/CssModulesPlugin.d.ts +1 -1
  21. package/dist/builtin-plugin/DataUriPlugin.d.ts +1 -1
  22. package/dist/builtin-plugin/DefinePlugin.d.ts +1 -1
  23. package/dist/builtin-plugin/DeterministicChunkIdsPlugin.d.ts +1 -1
  24. package/dist/builtin-plugin/DeterministicModuleIdsPlugin.d.ts +1 -1
  25. package/dist/builtin-plugin/ElectronTargetPlugin.d.ts +1 -1
  26. package/dist/builtin-plugin/EnableChunkLoadingPlugin.d.ts +1 -1
  27. package/dist/builtin-plugin/EnableWasmLoadingPlugin.d.ts +1 -1
  28. package/dist/builtin-plugin/EnsureChunkConditionsPlugin.d.ts +1 -1
  29. package/dist/builtin-plugin/EntryPlugin.d.ts +1 -1
  30. package/dist/builtin-plugin/EvalDevToolModulePlugin.d.ts +1 -1
  31. package/dist/builtin-plugin/EvalSourceMapDevToolPlugin.d.ts +1 -1
  32. package/dist/builtin-plugin/ExternalsPlugin.d.ts +3 -3
  33. package/dist/builtin-plugin/FileUriPlugin.d.ts +1 -1
  34. package/dist/builtin-plugin/FlagDependencyExportsPlugin.d.ts +1 -1
  35. package/dist/builtin-plugin/FlagDependencyUsagePlugin.d.ts +1 -1
  36. package/dist/builtin-plugin/HtmlRspackPlugin.d.ts +1 -1
  37. package/dist/builtin-plugin/HttpExternalsRspackPlugin.d.ts +1 -1
  38. package/dist/builtin-plugin/IgnorePlugin.d.ts +16 -0
  39. package/dist/builtin-plugin/IgnorePlugin.js +20 -0
  40. package/dist/builtin-plugin/InferAsyncModulesPlugin.d.ts +1 -1
  41. package/dist/builtin-plugin/JavascriptModulesPlugin.d.ts +1 -1
  42. package/dist/builtin-plugin/JsLoaderRspackPlugin.d.ts +1 -1
  43. package/dist/builtin-plugin/JsonModulesPlugin.d.ts +1 -1
  44. package/dist/builtin-plugin/LimitChunkCountPlugin.d.ts +1 -1
  45. package/dist/builtin-plugin/MangleExportsPlugin.d.ts +1 -1
  46. package/dist/builtin-plugin/MergeDuplicateChunksPlugin.d.ts +1 -1
  47. package/dist/builtin-plugin/ModuleChunkFormatPlugin.d.ts +1 -1
  48. package/dist/builtin-plugin/ModuleConcatenationPlugin.d.ts +1 -1
  49. package/dist/builtin-plugin/NamedChunkIdsPlugin.d.ts +1 -1
  50. package/dist/builtin-plugin/NamedModuleIdsPlugin.d.ts +1 -1
  51. package/dist/builtin-plugin/NodeTargetPlugin.d.ts +1 -1
  52. package/dist/builtin-plugin/ProgressPlugin.d.ts +1 -1
  53. package/dist/builtin-plugin/ProvidePlugin.d.ts +1 -1
  54. package/dist/builtin-plugin/RealContentHashPlugin.d.ts +1 -1
  55. package/dist/builtin-plugin/RemoveEmptyChunksPlugin.d.ts +1 -1
  56. package/dist/builtin-plugin/RuntimePlugin.d.ts +1 -1
  57. package/dist/builtin-plugin/SideEffectsFlagPlugin.d.ts +1 -1
  58. package/dist/builtin-plugin/SourceMapDevToolPlugin.d.ts +1 -1
  59. package/dist/builtin-plugin/SourceMapDevToolPlugin.js +1 -1
  60. package/dist/builtin-plugin/SwcCssMinimizerPlugin.d.ts +1 -1
  61. package/dist/builtin-plugin/SwcJsMinimizerPlugin.d.ts +2 -2
  62. package/dist/builtin-plugin/WarnCaseSensitiveModulesPlugin.d.ts +1 -1
  63. package/dist/builtin-plugin/WebWorkerTemplatePlugin.d.ts +1 -1
  64. package/dist/builtin-plugin/base.d.ts +1 -1
  65. package/dist/builtin-plugin/index.d.ts +1 -0
  66. package/dist/builtin-plugin/index.js +1 -0
  67. package/dist/config/adapter.js +1 -0
  68. package/dist/config/adapterRuleUse.d.ts +1 -1
  69. package/dist/config/defaults.js +2 -2
  70. package/dist/config/normalization.d.ts +2 -2
  71. package/dist/config/zod.d.ts +125 -67
  72. package/dist/config/zod.js +1 -0
  73. package/dist/container/ContainerReferencePlugin.d.ts +1 -1
  74. package/dist/container/default.runtime.js +4 -3
  75. package/dist/exports.d.ts +45 -846
  76. package/dist/exports.js +32 -28
  77. package/dist/lib/ModuleFilenameHelpers.d.ts +44 -6
  78. package/dist/lib/ModuleFilenameHelpers.js +50 -26
  79. package/package.json +9 -6
  80. package/dist/ModuleFilenameHelpers.d.ts +0 -44
  81. package/dist/ModuleFilenameHelpers.js +0 -76
package/dist/exports.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.SwcCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.NormalModuleReplacementPlugin = exports.EnvironmentPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.BannerPlugin = exports.EntryOptionPlugin = exports.experimental_cleanupGlobalTrace = exports.experimental_registerGlobalTrace = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.NormalModule = exports.MultiStats = exports.Stats = exports.RuntimeGlobals = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compilation = exports.Compiler = exports.rspackVersion = exports.version = void 0;
6
+ exports.CssExtractRspackPlugin = exports.EvalDevToolModulePlugin = exports.EvalSourceMapDevToolPlugin = exports.SourceMapDevToolPlugin = exports.CopyRspackPlugin = exports.SwcCssMinimizerRspackPlugin = exports.SwcJsMinimizerRspackPlugin = exports.HtmlRspackPlugin = exports.sharing = exports.container = exports.optimize = exports.webworker = exports.javascript = exports.wasm = exports.library = exports.electron = exports.node = exports.NormalModuleReplacementPlugin = exports.EnvironmentPlugin = exports.LoaderTargetPlugin = exports.LoaderOptionsPlugin = exports.HotModuleReplacementPlugin = exports.ExternalsPlugin = exports.EntryPlugin = exports.ProgressPlugin = exports.DefinePlugin = exports.ProvidePlugin = exports.IgnorePlugin = exports.BannerPlugin = exports.EntryOptionPlugin = exports.experimental_cleanupGlobalTrace = exports.experimental_registerGlobalTrace = exports.util = exports.config = exports.sources = exports.WebpackError = exports.Template = exports.ModuleFilenameHelpers = exports.NormalModule = exports.MultiStats = exports.Stats = exports.RuntimeGlobals = exports.WebpackOptionsApply = exports.RspackOptionsApply = exports.MultiCompiler = exports.Compilation = exports.Compiler = exports.rspackVersion = exports.version = void 0;
7
7
  const { version: rspackVersion, webpackVersion } = require("../package.json");
8
8
  exports.rspackVersion = rspackVersion;
9
9
  exports.version = webpackVersion;
@@ -24,10 +24,12 @@ var MultiStats_1 = require("./MultiStats");
24
24
  Object.defineProperty(exports, "MultiStats", { enumerable: true, get: function () { return MultiStats_1.MultiStats; } });
25
25
  var NormalModule_1 = require("./NormalModule");
26
26
  Object.defineProperty(exports, "NormalModule", { enumerable: true, get: function () { return NormalModule_1.NormalModule; } });
27
- var ModuleFilenameHelpers_1 = require("./lib/ModuleFilenameHelpers");
28
- Object.defineProperty(exports, "ModuleFilenameHelpers", { enumerable: true, get: function () { return __importDefault(ModuleFilenameHelpers_1).default; } });
29
- var Template_1 = require("./Template");
30
- Object.defineProperty(exports, "Template", { enumerable: true, get: function () { return __importDefault(Template_1).default; } });
27
+ // API extractor not working with some re-exports, see: https://github.com/microsoft/fluentui/issues/20694
28
+ const ModuleFilenameHelpers = require("./lib/ModuleFilenameHelpers");
29
+ exports.ModuleFilenameHelpers = ModuleFilenameHelpers;
30
+ // API extractor not working with some re-exports, see: https://github.com/microsoft/fluentui/issues/20694
31
+ const Template = require("./Template");
32
+ exports.Template = Template;
31
33
  exports.WebpackError = Error;
32
34
  const sources = require("webpack-sources"); // use require to avoid wrong types, @types/webpack-sources is outdate
33
35
  exports.sources = sources;
@@ -50,17 +52,19 @@ Object.defineProperty(exports, "EntryOptionPlugin", { enumerable: true, get: fun
50
52
  var builtin_plugin_1 = require("./builtin-plugin");
51
53
  Object.defineProperty(exports, "BannerPlugin", { enumerable: true, get: function () { return builtin_plugin_1.BannerPlugin; } });
52
54
  var builtin_plugin_2 = require("./builtin-plugin");
53
- Object.defineProperty(exports, "ProvidePlugin", { enumerable: true, get: function () { return builtin_plugin_2.ProvidePlugin; } });
55
+ Object.defineProperty(exports, "IgnorePlugin", { enumerable: true, get: function () { return builtin_plugin_2.IgnorePlugin; } });
54
56
  var builtin_plugin_3 = require("./builtin-plugin");
55
- Object.defineProperty(exports, "DefinePlugin", { enumerable: true, get: function () { return builtin_plugin_3.DefinePlugin; } });
57
+ Object.defineProperty(exports, "ProvidePlugin", { enumerable: true, get: function () { return builtin_plugin_3.ProvidePlugin; } });
56
58
  var builtin_plugin_4 = require("./builtin-plugin");
57
- Object.defineProperty(exports, "ProgressPlugin", { enumerable: true, get: function () { return builtin_plugin_4.ProgressPlugin; } });
59
+ Object.defineProperty(exports, "DefinePlugin", { enumerable: true, get: function () { return builtin_plugin_4.DefinePlugin; } });
58
60
  var builtin_plugin_5 = require("./builtin-plugin");
59
- Object.defineProperty(exports, "EntryPlugin", { enumerable: true, get: function () { return builtin_plugin_5.EntryPlugin; } });
61
+ Object.defineProperty(exports, "ProgressPlugin", { enumerable: true, get: function () { return builtin_plugin_5.ProgressPlugin; } });
60
62
  var builtin_plugin_6 = require("./builtin-plugin");
61
- Object.defineProperty(exports, "ExternalsPlugin", { enumerable: true, get: function () { return builtin_plugin_6.ExternalsPlugin; } });
63
+ Object.defineProperty(exports, "EntryPlugin", { enumerable: true, get: function () { return builtin_plugin_6.EntryPlugin; } });
62
64
  var builtin_plugin_7 = require("./builtin-plugin");
63
- Object.defineProperty(exports, "HotModuleReplacementPlugin", { enumerable: true, get: function () { return builtin_plugin_7.HotModuleReplacementPlugin; } });
65
+ Object.defineProperty(exports, "ExternalsPlugin", { enumerable: true, get: function () { return builtin_plugin_7.ExternalsPlugin; } });
66
+ var builtin_plugin_8 = require("./builtin-plugin");
67
+ Object.defineProperty(exports, "HotModuleReplacementPlugin", { enumerable: true, get: function () { return builtin_plugin_8.HotModuleReplacementPlugin; } });
64
68
  var LoaderOptionsPlugin_1 = require("./lib/LoaderOptionsPlugin");
65
69
  Object.defineProperty(exports, "LoaderOptionsPlugin", { enumerable: true, get: function () { return LoaderOptionsPlugin_1.LoaderOptionsPlugin; } });
66
70
  var LoaderTargetPlugin_1 = require("./lib/LoaderTargetPlugin");
@@ -70,20 +74,20 @@ Object.defineProperty(exports, "EnvironmentPlugin", { enumerable: true, get: fun
70
74
  var NormalModuleReplacementPlugin_1 = require("./lib/NormalModuleReplacementPlugin");
71
75
  Object.defineProperty(exports, "NormalModuleReplacementPlugin", { enumerable: true, get: function () { return NormalModuleReplacementPlugin_1.NormalModuleReplacementPlugin; } });
72
76
  const NodeTemplatePlugin_1 = __importDefault(require("./node/NodeTemplatePlugin"));
73
- const builtin_plugin_8 = require("./builtin-plugin");
74
- exports.node = { NodeTargetPlugin: builtin_plugin_8.NodeTargetPlugin, NodeTemplatePlugin: NodeTemplatePlugin_1.default };
75
77
  const builtin_plugin_9 = require("./builtin-plugin");
76
- exports.electron = { ElectronTargetPlugin: builtin_plugin_9.ElectronTargetPlugin };
78
+ exports.node = { NodeTargetPlugin: builtin_plugin_9.NodeTargetPlugin, NodeTemplatePlugin: NodeTemplatePlugin_1.default };
77
79
  const builtin_plugin_10 = require("./builtin-plugin");
78
- exports.library = { EnableLibraryPlugin: builtin_plugin_10.EnableLibraryPlugin };
80
+ exports.electron = { ElectronTargetPlugin: builtin_plugin_10.ElectronTargetPlugin };
79
81
  const builtin_plugin_11 = require("./builtin-plugin");
80
- exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_11.EnableWasmLoadingPlugin };
82
+ exports.library = { EnableLibraryPlugin: builtin_plugin_11.EnableLibraryPlugin };
81
83
  const builtin_plugin_12 = require("./builtin-plugin");
82
- exports.javascript = { EnableChunkLoadingPlugin: builtin_plugin_12.EnableChunkLoadingPlugin };
84
+ exports.wasm = { EnableWasmLoadingPlugin: builtin_plugin_12.EnableWasmLoadingPlugin };
83
85
  const builtin_plugin_13 = require("./builtin-plugin");
84
- exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_13.WebWorkerTemplatePlugin };
86
+ exports.javascript = { EnableChunkLoadingPlugin: builtin_plugin_13.EnableChunkLoadingPlugin };
85
87
  const builtin_plugin_14 = require("./builtin-plugin");
86
- exports.optimize = { LimitChunkCountPlugin: builtin_plugin_14.LimitChunkCountPlugin };
88
+ exports.webworker = { WebWorkerTemplatePlugin: builtin_plugin_14.WebWorkerTemplatePlugin };
89
+ const builtin_plugin_15 = require("./builtin-plugin");
90
+ exports.optimize = { LimitChunkCountPlugin: builtin_plugin_15.LimitChunkCountPlugin };
87
91
  const ModuleFederationPlugin_1 = require("./container/ModuleFederationPlugin");
88
92
  const ModuleFederationPluginV1_1 = require("./container/ModuleFederationPluginV1");
89
93
  const ContainerPlugin_1 = require("./container/ContainerPlugin");
@@ -103,19 +107,19 @@ exports.sharing = {
103
107
  SharePlugin: SharePlugin_1.SharePlugin
104
108
  };
105
109
  ///// Rspack Postfixed Internal Plugins /////
106
- var builtin_plugin_15 = require("./builtin-plugin");
107
- Object.defineProperty(exports, "HtmlRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_15.HtmlRspackPlugin; } });
108
110
  var builtin_plugin_16 = require("./builtin-plugin");
109
- Object.defineProperty(exports, "SwcJsMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_16.SwcJsMinimizerRspackPlugin; } });
111
+ Object.defineProperty(exports, "HtmlRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_16.HtmlRspackPlugin; } });
110
112
  var builtin_plugin_17 = require("./builtin-plugin");
111
- Object.defineProperty(exports, "SwcCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_17.SwcCssMinimizerRspackPlugin; } });
113
+ Object.defineProperty(exports, "SwcJsMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_17.SwcJsMinimizerRspackPlugin; } });
112
114
  var builtin_plugin_18 = require("./builtin-plugin");
113
- Object.defineProperty(exports, "CopyRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_18.CopyRspackPlugin; } });
115
+ Object.defineProperty(exports, "SwcCssMinimizerRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_18.SwcCssMinimizerRspackPlugin; } });
114
116
  var builtin_plugin_19 = require("./builtin-plugin");
115
- Object.defineProperty(exports, "SourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_19.SourceMapDevToolPlugin; } });
117
+ Object.defineProperty(exports, "CopyRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_19.CopyRspackPlugin; } });
116
118
  var builtin_plugin_20 = require("./builtin-plugin");
117
- Object.defineProperty(exports, "EvalSourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_20.EvalSourceMapDevToolPlugin; } });
119
+ Object.defineProperty(exports, "SourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_20.SourceMapDevToolPlugin; } });
118
120
  var builtin_plugin_21 = require("./builtin-plugin");
119
- Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_21.EvalDevToolModulePlugin; } });
121
+ Object.defineProperty(exports, "EvalSourceMapDevToolPlugin", { enumerable: true, get: function () { return builtin_plugin_21.EvalSourceMapDevToolPlugin; } });
120
122
  var builtin_plugin_22 = require("./builtin-plugin");
121
- Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_22.CssExtractRspackPlugin; } });
123
+ Object.defineProperty(exports, "EvalDevToolModulePlugin", { enumerable: true, get: function () { return builtin_plugin_22.EvalDevToolModulePlugin; } });
124
+ var builtin_plugin_23 = require("./builtin-plugin");
125
+ Object.defineProperty(exports, "CssExtractRspackPlugin", { enumerable: true, get: function () { return builtin_plugin_23.CssExtractRspackPlugin; } });
@@ -1,6 +1,44 @@
1
- export function matchPart(str: any, test: any): any;
2
- export function matchObject(obj: any, str: any): boolean;
3
- export type ChunkGraph = any;
4
- export type Module = any;
5
- export type RequestShortener = any;
6
- export type Hash = any;
1
+ type Matcher = string | RegExp | (string | RegExp)[];
2
+ /**
3
+ * Returns a function that returns the string with the token replaced with the replacement
4
+ * @example
5
+ * ```js
6
+ * const test = asRegExp("test");
7
+ * test.test("test"); // true
8
+ *
9
+ * const test2 = asRegExp(/test/);
10
+ * test2.test("test"); // true
11
+ * ```
12
+ */
13
+ export declare const asRegExp: (test: string | RegExp) => RegExp;
14
+ export declare const matchPart: (str: string, test: Matcher) => boolean;
15
+ interface MatchObject {
16
+ test?: Matcher;
17
+ include?: Matcher;
18
+ exclude?: Matcher;
19
+ }
20
+ /**
21
+ * Tests if a string matches a match object. The match object can have the following properties:
22
+ * - `test`: a RegExp or an array of RegExp
23
+ * - `include`: a RegExp or an array of RegExp
24
+ * - `exclude`: a RegExp or an array of RegExp
25
+ *
26
+ * The `test` property is tested first, then `include` and then `exclude`.
27
+ *
28
+ * @example
29
+ * ```js
30
+ * ModuleFilenameHelpers.matchObject({ test: "foo.js" }, "foo.js"); // true
31
+ * ModuleFilenameHelpers.matchObject({ test: /^foo/ }, "foo.js"); // true
32
+ * ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "foo.js"); // true
33
+ * ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "baz.js"); // false
34
+ * ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "foo.js"); // true
35
+ * ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "bar.js"); // false
36
+ * ModuleFilenameHelpers.matchObject({ include: /^foo/ }, "foo.js"); // true
37
+ * ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "foo.js"); // true
38
+ * ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "baz.js"); // false
39
+ * ModuleFilenameHelpers.matchObject({ exclude: "foo.js" }, "foo.js"); // false
40
+ * ModuleFilenameHelpers.matchObject({ exclude: [/^foo/, "bar"] }, "foo.js"); // false
41
+ * ```
42
+ */
43
+ export declare const matchObject: (obj: MatchObject, str: string) => boolean;
44
+ export {};
@@ -1,52 +1,76 @@
1
- /*
2
- MIT License http://www.opensource.org/licenses/mit-license.php
3
- Author Tobias Koppers @sokra
4
- */
5
1
  "use strict";
6
- // /** @typedef {import("./ChunkGraph")} ChunkGraph */
7
- // /** @typedef {import("./Module")} Module */
8
- // /** @typedef {import("./RequestShortener")} RequestShortener */
9
- // /** @typedef {typeof import("./util/Hash")} Hash */
10
- /** @typedef {any} ChunkGraph */
11
- /** @typedef {any} Module */
12
- /** @typedef {any} RequestShortener */
13
- /** @typedef {any} Hash */
14
- const ModuleFilenameHelpers = exports;
15
- // @ts-expect-error
16
- const asRegExp = test => {
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.matchObject = exports.matchPart = exports.asRegExp = void 0;
4
+ /**
5
+ * Returns a function that returns the string with the token replaced with the replacement
6
+ * @example
7
+ * ```js
8
+ * const test = asRegExp("test");
9
+ * test.test("test"); // true
10
+ *
11
+ * const test2 = asRegExp(/test/);
12
+ * test2.test("test"); // true
13
+ * ```
14
+ */
15
+ const asRegExp = (test) => {
17
16
  if (typeof test === "string") {
18
- test = new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
17
+ // Escape special characters in the string to prevent them from being interpreted as special characters in a regular expression. Do this by
18
+ // adding a backslash before each special character
19
+ return new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
19
20
  }
20
21
  return test;
21
22
  };
22
- // @ts-expect-error
23
- ModuleFilenameHelpers.matchPart = (str, test) => {
23
+ exports.asRegExp = asRegExp;
24
+ const matchPart = (str, test) => {
24
25
  if (!test)
25
26
  return true;
26
- test = asRegExp(test);
27
27
  if (Array.isArray(test)) {
28
- return test.map(asRegExp).some(regExp => regExp.test(str));
28
+ return test.map(exports.asRegExp).some(regExp => regExp.test(str));
29
29
  }
30
30
  else {
31
- return test.test(str);
31
+ return (0, exports.asRegExp)(test).test(str);
32
32
  }
33
33
  };
34
- // @ts-expect-error
35
- ModuleFilenameHelpers.matchObject = (obj, str) => {
34
+ exports.matchPart = matchPart;
35
+ /**
36
+ * Tests if a string matches a match object. The match object can have the following properties:
37
+ * - `test`: a RegExp or an array of RegExp
38
+ * - `include`: a RegExp or an array of RegExp
39
+ * - `exclude`: a RegExp or an array of RegExp
40
+ *
41
+ * The `test` property is tested first, then `include` and then `exclude`.
42
+ *
43
+ * @example
44
+ * ```js
45
+ * ModuleFilenameHelpers.matchObject({ test: "foo.js" }, "foo.js"); // true
46
+ * ModuleFilenameHelpers.matchObject({ test: /^foo/ }, "foo.js"); // true
47
+ * ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "foo.js"); // true
48
+ * ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "baz.js"); // false
49
+ * ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "foo.js"); // true
50
+ * ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "bar.js"); // false
51
+ * ModuleFilenameHelpers.matchObject({ include: /^foo/ }, "foo.js"); // true
52
+ * ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "foo.js"); // true
53
+ * ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "baz.js"); // false
54
+ * ModuleFilenameHelpers.matchObject({ exclude: "foo.js" }, "foo.js"); // false
55
+ * ModuleFilenameHelpers.matchObject({ exclude: [/^foo/, "bar"] }, "foo.js"); // false
56
+ * ```
57
+ */
58
+ const matchObject = (obj, str) => {
36
59
  if (obj.test) {
37
- if (!ModuleFilenameHelpers.matchPart(str, obj.test)) {
60
+ if (!(0, exports.matchPart)(str, obj.test)) {
38
61
  return false;
39
62
  }
40
63
  }
41
64
  if (obj.include) {
42
- if (!ModuleFilenameHelpers.matchPart(str, obj.include)) {
65
+ if (!(0, exports.matchPart)(str, obj.include)) {
43
66
  return false;
44
67
  }
45
68
  }
46
69
  if (obj.exclude) {
47
- if (ModuleFilenameHelpers.matchPart(str, obj.exclude)) {
70
+ if ((0, exports.matchPart)(str, obj.exclude)) {
48
71
  return false;
49
72
  }
50
73
  }
51
74
  return true;
52
75
  };
76
+ exports.matchObject = matchObject;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.6.1",
3
+ "version": "0.6.2-canary-4b8f4a6-20240417094517",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -56,14 +56,15 @@
56
56
  "sass": "1.56.2",
57
57
  "sass-loader": "13.2.0",
58
58
  "source-map": "^0.7.4",
59
+ "source-map-loader": "^5.0.0",
59
60
  "styled-components": "^6.0.8",
60
61
  "terser": "5.27.2",
61
62
  "wast-loader": "^1.11.4",
62
- "@rspack/core": "0.6.1",
63
- "@rspack/plugin-minify": "^0.6.1"
63
+ "@rspack/plugin-minify": "^0.6.2-canary-4b8f4a6-20240417094517",
64
+ "@rspack/core": "0.6.2-canary-4b8f4a6-20240417094517"
64
65
  },
65
66
  "dependencies": {
66
- "@module-federation/runtime-tools": "0.0.8",
67
+ "@module-federation/runtime-tools": "0.1.6",
67
68
  "browserslist": "^4.21.3",
68
69
  "enhanced-resolve": "5.12.0",
69
70
  "events": "^3.3.0",
@@ -75,7 +76,7 @@
75
76
  "webpack-sources": "3.2.3",
76
77
  "zod": "^3.21.4",
77
78
  "zod-validation-error": "1.3.1",
78
- "@rspack/binding": "0.6.1"
79
+ "@rspack/binding": "0.6.2-canary-4b8f4a6-20240417094517"
79
80
  },
80
81
  "peerDependencies": {
81
82
  "@swc/helpers": ">=0.5.1"
@@ -88,6 +89,8 @@
88
89
  "scripts": {
89
90
  "build": "tsc -b ./tsconfig.build.json",
90
91
  "dev": "tsc -w",
91
- "test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage"
92
+ "test": "cross-env NO_COLOR=1 node --expose-gc --max-old-space-size=8192 --experimental-vm-modules ../../node_modules/jest-cli/bin/jest --logHeapUsage",
93
+ "api-extractor": "api-extractor run --verbose",
94
+ "api-extractor:ci": "api-extractor run --verbose || diff temp/api.md etc/api.md"
92
95
  }
93
96
  }
@@ -1,44 +0,0 @@
1
- type Matcher = string | RegExp | (string | RegExp)[];
2
- /**
3
- * Returns a function that returns the string with the token replaced with the replacement
4
- * @example
5
- * ```js
6
- * const test = asRegExp("test");
7
- * test.test("test"); // true
8
- *
9
- * const test2 = asRegExp(/test/);
10
- * test2.test("test"); // true
11
- * ```
12
- */
13
- export declare const asRegExp: (test: string | RegExp) => RegExp;
14
- export declare const matchPart: (str: string, test: Matcher) => boolean;
15
- interface MatchObject {
16
- test?: Matcher;
17
- include?: Matcher;
18
- exclude?: Matcher;
19
- }
20
- /**
21
- * Tests if a string matches a match object. The match object can have the following properties:
22
- * - `test`: a RegExp or an array of RegExp
23
- * - `include`: a RegExp or an array of RegExp
24
- * - `exclude`: a RegExp or an array of RegExp
25
- *
26
- * The `test` property is tested first, then `include` and then `exclude`.
27
- *
28
- * @example
29
- * ```js
30
- * ModuleFilenameHelpers.matchObject({ test: "foo.js" }, "foo.js"); // true
31
- * ModuleFilenameHelpers.matchObject({ test: /^foo/ }, "foo.js"); // true
32
- * ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "foo.js"); // true
33
- * ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "baz.js"); // false
34
- * ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "foo.js"); // true
35
- * ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "bar.js"); // false
36
- * ModuleFilenameHelpers.matchObject({ include: /^foo/ }, "foo.js"); // true
37
- * ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "foo.js"); // true
38
- * ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "baz.js"); // false
39
- * ModuleFilenameHelpers.matchObject({ exclude: "foo.js" }, "foo.js"); // false
40
- * ModuleFilenameHelpers.matchObject({ exclude: [/^foo/, "bar"] }, "foo.js"); // false
41
- * ```
42
- */
43
- export declare const matchObject: (obj: MatchObject, str: string) => boolean;
44
- export {};
@@ -1,76 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.matchObject = exports.matchPart = exports.asRegExp = void 0;
4
- /**
5
- * Returns a function that returns the string with the token replaced with the replacement
6
- * @example
7
- * ```js
8
- * const test = asRegExp("test");
9
- * test.test("test"); // true
10
- *
11
- * const test2 = asRegExp(/test/);
12
- * test2.test("test"); // true
13
- * ```
14
- */
15
- const asRegExp = (test) => {
16
- if (typeof test === "string") {
17
- // Escape special characters in the string to prevent them from being interpreted as special characters in a regular expression. Do this by
18
- // adding a backslash before each special character
19
- return new RegExp("^" + test.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&"));
20
- }
21
- return test;
22
- };
23
- exports.asRegExp = asRegExp;
24
- const matchPart = (str, test) => {
25
- if (!test)
26
- return true;
27
- if (Array.isArray(test)) {
28
- return test.map(exports.asRegExp).some(regExp => regExp.test(str));
29
- }
30
- else {
31
- return (0, exports.asRegExp)(test).test(str);
32
- }
33
- };
34
- exports.matchPart = matchPart;
35
- /**
36
- * Tests if a string matches a match object. The match object can have the following properties:
37
- * - `test`: a RegExp or an array of RegExp
38
- * - `include`: a RegExp or an array of RegExp
39
- * - `exclude`: a RegExp or an array of RegExp
40
- *
41
- * The `test` property is tested first, then `include` and then `exclude`.
42
- *
43
- * @example
44
- * ```js
45
- * ModuleFilenameHelpers.matchObject({ test: "foo.js" }, "foo.js"); // true
46
- * ModuleFilenameHelpers.matchObject({ test: /^foo/ }, "foo.js"); // true
47
- * ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "foo.js"); // true
48
- * ModuleFilenameHelpers.matchObject({ test: [/^foo/, "bar"] }, "baz.js"); // false
49
- * ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "foo.js"); // true
50
- * ModuleFilenameHelpers.matchObject({ include: "foo.js" }, "bar.js"); // false
51
- * ModuleFilenameHelpers.matchObject({ include: /^foo/ }, "foo.js"); // true
52
- * ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "foo.js"); // true
53
- * ModuleFilenameHelpers.matchObject({ include: [/^foo/, "bar"] }, "baz.js"); // false
54
- * ModuleFilenameHelpers.matchObject({ exclude: "foo.js" }, "foo.js"); // false
55
- * ModuleFilenameHelpers.matchObject({ exclude: [/^foo/, "bar"] }, "foo.js"); // false
56
- * ```
57
- */
58
- const matchObject = (obj, str) => {
59
- if (obj.test) {
60
- if (!(0, exports.matchPart)(str, obj.test)) {
61
- return false;
62
- }
63
- }
64
- if (obj.include) {
65
- if (!(0, exports.matchPart)(str, obj.include)) {
66
- return false;
67
- }
68
- }
69
- if (obj.exclude) {
70
- if ((0, exports.matchPart)(str, obj.exclude)) {
71
- return false;
72
- }
73
- }
74
- return true;
75
- };
76
- exports.matchObject = matchObject;