@rspack/core 0.5.9 → 0.6.0-canary-77faf73-20240410004447

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 (54) hide show
  1. package/dist/Compilation.d.ts +4 -13
  2. package/dist/Compilation.js +11 -17
  3. package/dist/Compiler.d.ts +3 -8
  4. package/dist/Compiler.js +165 -144
  5. package/dist/ContextModuleFactory.d.ts +4 -8
  6. package/dist/ContextModuleFactory.js +26 -3
  7. package/dist/ExecuteModulePlugin.js +2 -2
  8. package/dist/Module.d.ts +20 -1
  9. package/dist/Module.js +1 -0
  10. package/dist/NormalModuleFactory.d.ts +8 -23
  11. package/dist/NormalModuleFactory.js +6 -4
  12. package/dist/Stats.js +2 -2
  13. package/dist/builtin-plugin/APIPlugin.d.ts +10 -0
  14. package/dist/builtin-plugin/APIPlugin.js +6 -0
  15. package/dist/builtin-plugin/CssModulesPlugin.d.ts +10 -0
  16. package/dist/builtin-plugin/CssModulesPlugin.js +6 -0
  17. package/dist/builtin-plugin/EntryPlugin.d.ts +1 -0
  18. package/dist/builtin-plugin/EntryPlugin.js +3 -2
  19. package/dist/builtin-plugin/ExternalsPlugin.d.ts +2 -2
  20. package/dist/builtin-plugin/JsLoaderRspackPlugin.js +3 -1
  21. package/dist/builtin-plugin/SplitChunksPlugin.js +2 -1
  22. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.d.ts +3 -0
  23. package/dist/builtin-plugin/css-extract/hmr/hotModuleReplacement.js +222 -0
  24. package/dist/builtin-plugin/css-extract/hmr/normalize-url.d.ts +2 -0
  25. package/dist/builtin-plugin/css-extract/hmr/normalize-url.js +38 -0
  26. package/dist/builtin-plugin/css-extract/index.d.ts +22 -0
  27. package/dist/builtin-plugin/css-extract/index.js +109 -0
  28. package/dist/builtin-plugin/css-extract/loader-options.json +32 -0
  29. package/dist/builtin-plugin/css-extract/loader.d.ts +15 -0
  30. package/dist/builtin-plugin/css-extract/loader.js +191 -0
  31. package/dist/builtin-plugin/css-extract/plugin-options.json +79 -0
  32. package/dist/builtin-plugin/css-extract/utils.d.ts +5 -0
  33. package/dist/builtin-plugin/css-extract/utils.js +51 -0
  34. package/dist/builtin-plugin/index.d.ts +4 -6
  35. package/dist/builtin-plugin/index.js +3 -15
  36. package/dist/config/adapter.js +58 -8
  37. package/dist/config/adapterRuleUse.d.ts +2 -2
  38. package/dist/config/defaults.js +65 -35
  39. package/dist/config/normalization.d.ts +1 -0
  40. package/dist/config/normalization.js +9 -1
  41. package/dist/config/zod.d.ts +706 -23
  42. package/dist/config/zod.js +47 -4
  43. package/dist/container/ContainerReferencePlugin.d.ts +1 -1
  44. package/dist/exports.d.ts +67 -11
  45. package/dist/exports.js +7 -1
  46. package/dist/lib/EntryOptionPlugin.js +1 -1
  47. package/dist/lib/NormalModuleReplacementPlugin.d.ts +19 -0
  48. package/dist/lib/NormalModuleReplacementPlugin.js +75 -0
  49. package/dist/lite-tapable/index.d.ts +25 -0
  50. package/dist/lite-tapable/index.js +70 -1
  51. package/dist/rspackOptionsApply.d.ts +0 -1
  52. package/dist/rspackOptionsApply.js +8 -21
  53. package/dist/util/comparators.d.ts +1 -1
  54. package/package.json +10 -7
@@ -8,7 +8,6 @@
8
8
  * https://github.com/webpack/webpack/blob/main/LICENSE
9
9
  */
10
10
  import { RspackOptionsNormalized, Compiler } from ".";
11
- export declare function applyEntryOptions(compiler: Compiler, options: RspackOptionsNormalized): void;
12
11
  export declare class RspackOptionsApply {
13
12
  constructor();
14
13
  process(options: RspackOptionsNormalized, compiler: Compiler): void;
@@ -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.RspackOptionsApply = exports.applyEntryOptions = void 0;
6
+ exports.RspackOptionsApply = void 0;
7
7
  const graceful_fs_1 = __importDefault(require("graceful-fs"));
8
8
  const DefaultStatsFactoryPlugin_1 = require("./stats/DefaultStatsFactoryPlugin");
9
9
  const DefaultStatsPrinterPlugin_1 = require("./stats/DefaultStatsPrinterPlugin");
@@ -12,21 +12,7 @@ const assert_1 = __importDefault(require("assert"));
12
12
  const ignoreWarningsPlugin_1 = __importDefault(require("./lib/ignoreWarningsPlugin"));
13
13
  const EntryOptionPlugin_1 = __importDefault(require("./lib/EntryOptionPlugin"));
14
14
  const builtin_plugin_1 = require("./builtin-plugin");
15
- const util_1 = require("./util");
16
- function applyEntryOptions(compiler, options) {
17
- if (!options.experiments.rspackFuture.disableApplyEntryLazily) {
18
- (0, util_1.deprecatedWarn)(`You are depending on apply entry lazily (https://rspack.dev/config/experiments.html#experimentsrspackfuturedisableapplyentrylazily), this behavior has been deprecated, you can setup 'experiments.rspackFuture.disableApplyEntryLazily = true' to disable this behavior, and this will be enabled by default in v0.5`);
19
- }
20
- if (compiler.parentCompilation === undefined) {
21
- if (options.experiments.rspackFuture.disableApplyEntryLazily) {
22
- new EntryOptionPlugin_1.default().apply(compiler);
23
- }
24
- else {
25
- EntryOptionPlugin_1.default.applyEntryOption(compiler, compiler.context, options.entry);
26
- }
27
- }
28
- }
29
- exports.applyEntryOptions = applyEntryOptions;
15
+ const assertNotNil_1 = require("./util/assertNotNil");
30
16
  class RspackOptionsApply {
31
17
  constructor() { }
32
18
  process(options, compiler) {
@@ -97,7 +83,7 @@ class RspackOptionsApply {
97
83
  .runtimeChunk;
98
84
  if (runtimeChunk) {
99
85
  Object.entries(options.entry).forEach(([entryName, value]) => {
100
- if (value.runtime === undefined) {
86
+ if (value.runtime === undefined && !value.dependOn) {
101
87
  value.runtime = runtimeChunk.name({ name: entryName });
102
88
  }
103
89
  });
@@ -137,17 +123,18 @@ class RspackOptionsApply {
137
123
  if (options.experiments.asyncWebAssembly) {
138
124
  new builtin_plugin_1.AsyncWebAssemblyModulesPlugin().apply(compiler);
139
125
  }
140
- new builtin_plugin_1.JsLoaderRspackPlugin(compiler).apply(compiler);
141
- if (options.experiments.rspackFuture.disableApplyEntryLazily) {
142
- applyEntryOptions(compiler, options);
126
+ if (options.experiments.css) {
127
+ new builtin_plugin_1.CssModulesPlugin().apply(compiler);
143
128
  }
144
- (0, assert_1.default)(options.context, "options.context should have value after `applyRspackOptionsDefaults`");
129
+ new EntryOptionPlugin_1.default().apply(compiler);
130
+ (0, assertNotNil_1.assertNotNill)(options.context);
145
131
  compiler.hooks.entryOption.call(options.context, options.entry);
146
132
  new builtin_plugin_1.RuntimePlugin().apply(compiler);
147
133
  if (options.experiments.rspackFuture.bundlerInfo) {
148
134
  new builtin_plugin_1.BundlerInfoRspackPlugin(options.experiments.rspackFuture.bundlerInfo).apply(compiler);
149
135
  }
150
136
  new builtin_plugin_1.InferAsyncModulesPlugin().apply(compiler);
137
+ new builtin_plugin_1.APIPlugin().apply(compiler);
151
138
  new builtin_plugin_1.DataUriPlugin().apply(compiler);
152
139
  new builtin_plugin_1.FileUriPlugin().apply(compiler);
153
140
  new builtin_plugin_1.EnsureChunkConditionsPlugin().apply(compiler);
@@ -16,5 +16,5 @@ export declare const compareIds: (a: string | number, b: string | number) => -1
16
16
  export declare const compareChunksById: (a: Chunk, b: Chunk) => -1 | 0 | 1;
17
17
  export declare const compareChunkGroupsByIndex: (a: ChunkGroup, b: ChunkGroup) => -1 | 0 | 1;
18
18
  export declare const compareSelect: <T, R>(getter: Selector<T, R>, comparator: Comparator) => Comparator;
19
- export declare const compareNumbers: (a: number, b: number) => 1 | -1 | 0;
19
+ export declare const compareNumbers: (a: number, b: number) => 0 | 1 | -1;
20
20
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rspack/core",
3
- "version": "0.5.9",
3
+ "version": "0.6.0-canary-77faf73-20240410004447",
4
4
  "webpackVersion": "5.75.0",
5
5
  "license": "MIT",
6
6
  "description": "A Fast Rust-based Web Bundler",
@@ -29,7 +29,7 @@
29
29
  "directory": "packages/rspack"
30
30
  },
31
31
  "devDependencies": {
32
- "@swc/plugin-remove-console": "^1.5.114",
32
+ "@swc/plugin-remove-console": "1.5.121",
33
33
  "@types/watchpack": "^2.4.0",
34
34
  "@types/webpack-sources": "3.2.3",
35
35
  "@types/ws": "8.5.10",
@@ -37,12 +37,15 @@
37
37
  "babel-plugin-import": "^1.13.5",
38
38
  "copy-webpack-plugin": "5.1.2",
39
39
  "cross-env": "^7.0.3",
40
+ "del": "^6.0.0",
40
41
  "file-loader": "^6.2.0",
41
42
  "glob": "^10.3.10",
42
43
  "html-loader": "^5.0.0",
43
44
  "html-webpack-plugin": "^5.5.0",
44
45
  "identity-obj-proxy": "3.0.0",
46
+ "jest-environment-jsdom": "^29",
45
47
  "jest-serializer-path": "^0.1.15",
48
+ "jsdom": "^24.0.0",
46
49
  "less": "4.2.0",
47
50
  "less-loader": "^12.0.0",
48
51
  "node-polyfill-webpack-plugin": "3.0.0",
@@ -50,14 +53,14 @@
50
53
  "postcss-pxtorem": "^6.0.0",
51
54
  "pug-loader": "^2.4.0",
52
55
  "react-relay": "^16.0.0",
53
- "sass": "^1.56.2",
54
- "sass-loader": "^13.2.0",
56
+ "sass": "1.56.2",
57
+ "sass-loader": "13.2.0",
55
58
  "source-map": "^0.7.4",
56
59
  "styled-components": "^6.0.8",
57
60
  "terser": "5.27.2",
58
61
  "wast-loader": "^1.11.4",
59
- "@rspack/plugin-minify": "^0.5.9",
60
- "@rspack/core": "0.5.9"
62
+ "@rspack/core": "0.6.0-canary-77faf73-20240410004447",
63
+ "@rspack/plugin-minify": "^0.6.0-canary-77faf73-20240410004447"
61
64
  },
62
65
  "dependencies": {
63
66
  "@module-federation/runtime-tools": "0.0.8",
@@ -72,7 +75,7 @@
72
75
  "webpack-sources": "3.2.3",
73
76
  "zod": "^3.21.4",
74
77
  "zod-validation-error": "1.3.1",
75
- "@rspack/binding": "0.5.9"
78
+ "@rspack/binding": "0.6.0-canary-77faf73-20240410004447"
76
79
  },
77
80
  "peerDependencies": {
78
81
  "@swc/helpers": ">=0.5.1"