@modern-js/app-tools 2.39.0 → 2.39.1

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.
@@ -62,6 +62,7 @@ class RouterPlugin {
62
62
  return;
63
63
  }
64
64
  const { webpack } = compiler;
65
+ const isRspack = webpack.rspackVersion;
65
66
  const { Compilation, sources } = webpack;
66
67
  const { RawSource } = sources;
67
68
  const normalizePath = (path) => {
@@ -127,7 +128,19 @@ class RouterPlugin {
127
128
  routeAssets
128
129
  };
129
130
  const entryNames = Array.from(compilation.entrypoints.keys());
130
- const entryChunks = this.getEntryChunks(compilation, chunks);
131
+ let entryChunks = [];
132
+ if (isRspack) {
133
+ entryChunks = this.getEntryChunks(compilation, chunks);
134
+ } else {
135
+ const orignalEntryIds = Object.keys(compilation.options.entry).map((entryName) => {
136
+ const chunk = compilation.namedChunks.get(entryName);
137
+ if (chunk) {
138
+ return chunk.id;
139
+ }
140
+ return entryName;
141
+ });
142
+ entryChunks = this.getEntryChunks(compilation, chunks).filter((chunk) => orignalEntryIds.includes(chunk.id));
143
+ }
131
144
  const entryChunkFiles = this.getEntryChunkFiles(entryChunks);
132
145
  const entryChunkFileIds = entryChunks.map((chunk) => chunk.id);
133
146
  for (let i = 0; i < entryChunkFiles.length; i++) {
@@ -80,6 +80,7 @@ var RouterPlugin = /* @__PURE__ */ function() {
80
80
  return;
81
81
  }
82
82
  var webpack = compiler.webpack;
83
+ var isRspack = webpack.rspackVersion;
83
84
  var Compilation = webpack.Compilation, sources = webpack.sources;
84
85
  var RawSource = sources.RawSource;
85
86
  var normalizePath = function(path) {
@@ -104,7 +105,7 @@ var RouterPlugin = /* @__PURE__ */ function() {
104
105
  name: PLUGIN_NAME,
105
106
  stage: Compilation.PROCESS_ASSETS_STAGE_REPORT
106
107
  }, /* @__PURE__ */ _async_to_generator(function() {
107
- var _loop, stats, publicPath, _stats_chunks, chunks, namedChunkGroups, routeAssets, prevManifestAsset, prevManifestStr, prevManifest, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, chunkGroup, assets, referenceCssAssets, manifest, entryNames, entryChunks, entryChunkFiles, entryChunkFileIds, i;
108
+ var _loop, stats, publicPath, _stats_chunks, chunks, namedChunkGroups, routeAssets, prevManifestAsset, prevManifestStr, prevManifest, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _step_value, name, chunkGroup, assets, referenceCssAssets, manifest, entryNames, entryChunks, orignalEntryIds, entryChunkFiles, entryChunkFileIds, i;
108
109
  return _ts_generator(this, function(_state) {
109
110
  _loop = function(i2) {
110
111
  var entryName = entryNames[i2];
@@ -261,7 +262,21 @@ var RouterPlugin = /* @__PURE__ */ function() {
261
262
  routeAssets
262
263
  };
263
264
  entryNames = Array.from(compilation.entrypoints.keys());
264
- entryChunks = _this1.getEntryChunks(compilation, chunks);
265
+ entryChunks = [];
266
+ if (isRspack) {
267
+ entryChunks = _this1.getEntryChunks(compilation, chunks);
268
+ } else {
269
+ orignalEntryIds = Object.keys(compilation.options.entry).map(function(entryName) {
270
+ var chunk = compilation.namedChunks.get(entryName);
271
+ if (chunk) {
272
+ return chunk.id;
273
+ }
274
+ return entryName;
275
+ });
276
+ entryChunks = _this1.getEntryChunks(compilation, chunks).filter(function(chunk) {
277
+ return orignalEntryIds.includes(chunk.id);
278
+ });
279
+ }
265
280
  entryChunkFiles = _this1.getEntryChunkFiles(entryChunks);
266
281
  entryChunkFileIds = entryChunks.map(function(chunk) {
267
282
  return chunk.id;
@@ -39,6 +39,7 @@ class RouterPlugin {
39
39
  return;
40
40
  }
41
41
  const { webpack } = compiler;
42
+ const isRspack = webpack.rspackVersion;
42
43
  const { Compilation, sources } = webpack;
43
44
  const { RawSource } = sources;
44
45
  const normalizePath = (path) => {
@@ -104,7 +105,19 @@ class RouterPlugin {
104
105
  routeAssets
105
106
  };
106
107
  const entryNames = Array.from(compilation.entrypoints.keys());
107
- const entryChunks = this.getEntryChunks(compilation, chunks);
108
+ let entryChunks = [];
109
+ if (isRspack) {
110
+ entryChunks = this.getEntryChunks(compilation, chunks);
111
+ } else {
112
+ const orignalEntryIds = Object.keys(compilation.options.entry).map((entryName) => {
113
+ const chunk = compilation.namedChunks.get(entryName);
114
+ if (chunk) {
115
+ return chunk.id;
116
+ }
117
+ return entryName;
118
+ });
119
+ entryChunks = this.getEntryChunks(compilation, chunks).filter((chunk) => orignalEntryIds.includes(chunk.id));
120
+ }
108
121
  const entryChunkFiles = this.getEntryChunkFiles(entryChunks);
109
122
  const entryChunkFileIds = entryChunks.map((chunk) => chunk.id);
110
123
  for (let i = 0; i < entryChunkFiles.length; i++) {
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.39.0",
18
+ "version": "2.39.1",
19
19
  "jsnext:source": "./src/index.ts",
20
20
  "types": "./dist/types/index.d.ts",
21
21
  "main": "./dist/cjs/index.js",
@@ -72,24 +72,24 @@
72
72
  "es-module-lexer": "^1.1.0",
73
73
  "esbuild": "0.17.19",
74
74
  "@swc/helpers": "0.5.1",
75
- "@modern-js/builder-plugin-esbuild": "2.39.0",
76
- "@modern-js/builder-plugin-node-polyfill": "2.39.0",
77
- "@modern-js/builder": "2.39.0",
78
- "@modern-js/builder-shared": "2.39.0",
79
- "@modern-js/builder-webpack-provider": "2.39.0",
80
- "@modern-js/core": "2.39.0",
81
- "@modern-js/new-action": "2.39.0",
82
- "@modern-js/node-bundle-require": "2.39.0",
83
- "@modern-js/plugin": "2.39.0",
84
- "@modern-js/plugin-data-loader": "2.39.0",
85
- "@modern-js/plugin-i18n": "2.39.0",
86
- "@modern-js/plugin-lint": "2.39.0",
87
- "@modern-js/prod-server": "2.39.0",
88
- "@modern-js/server": "2.39.0",
89
- "@modern-js/types": "2.39.0",
90
- "@modern-js/upgrade": "2.39.0",
91
- "@modern-js/utils": "2.39.0",
92
- "@modern-js/server-core": "2.39.0"
75
+ "@modern-js/builder": "2.39.1",
76
+ "@modern-js/builder-plugin-esbuild": "2.39.1",
77
+ "@modern-js/builder-shared": "2.39.1",
78
+ "@modern-js/builder-plugin-node-polyfill": "2.39.1",
79
+ "@modern-js/builder-webpack-provider": "2.39.1",
80
+ "@modern-js/core": "2.39.1",
81
+ "@modern-js/new-action": "2.39.1",
82
+ "@modern-js/node-bundle-require": "2.39.1",
83
+ "@modern-js/plugin": "2.39.1",
84
+ "@modern-js/plugin-data-loader": "2.39.1",
85
+ "@modern-js/plugin-i18n": "2.39.1",
86
+ "@modern-js/plugin-lint": "2.39.1",
87
+ "@modern-js/prod-server": "2.39.1",
88
+ "@modern-js/server": "2.39.1",
89
+ "@modern-js/types": "2.39.1",
90
+ "@modern-js/upgrade": "2.39.1",
91
+ "@modern-js/utils": "2.39.1",
92
+ "@modern-js/server-core": "2.39.1"
93
93
  },
94
94
  "devDependencies": {
95
95
  "@types/babel__traverse": "^7.14.2",
@@ -98,13 +98,13 @@
98
98
  "jest": "^29",
99
99
  "typescript": "^5",
100
100
  "webpack": "^5.88.1",
101
- "@modern-js/builder-plugin-swc": "2.39.0",
102
- "@modern-js/builder-rspack-provider": "2.39.0",
103
- "@scripts/build": "2.39.0",
104
- "@scripts/jest-config": "2.39.0"
101
+ "@modern-js/builder-plugin-swc": "2.39.1",
102
+ "@modern-js/builder-rspack-provider": "2.39.1",
103
+ "@scripts/build": "2.39.1",
104
+ "@scripts/jest-config": "2.39.1"
105
105
  },
106
106
  "peerDependencies": {
107
- "@modern-js/builder-rspack-provider": "^2.39.0"
107
+ "@modern-js/builder-rspack-provider": "^2.39.1"
108
108
  },
109
109
  "peerDependenciesMeta": {
110
110
  "@modern-js/builder-rspack-provider": {