@dtwo/webpack-builder 3.2.0 → 3.2.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.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2022 - Dtwo Team
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2022 - Dtwo Team
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import pify from 'pify';
2
- import webpack from 'webpack';
2
+ import webpack, { RuntimeGlobals } from 'webpack';
3
3
  import { fromNodeMiddleware, defineEventHandler } from 'h3';
4
4
  import webpackDevMiddleware from 'webpack-dev-middleware';
5
5
  import webpackHotMiddleware from 'webpack-hot-middleware';
@@ -155,6 +155,31 @@ ${options.globalPublicPath} = buildAssetsURL();
155
155
  };
156
156
  });
157
157
 
158
+ const pluginName = "ChunkErrorPlugin";
159
+ const script = `
160
+ if (typeof ${RuntimeGlobals.require} !== "undefined") {
161
+ var _ensureChunk = ${RuntimeGlobals.ensureChunk};
162
+ ${RuntimeGlobals.ensureChunk} = function (chunkId) {
163
+ return Promise.resolve(_ensureChunk(chunkId)).catch(err => {
164
+ const e = new Event("dtwo.preloadError");
165
+ e.payload = err;
166
+ window.dispatchEvent(e);
167
+ throw err;
168
+ });
169
+ };
170
+ };`;
171
+ class ChunkErrorPlugin {
172
+ apply(compiler) {
173
+ compiler.hooks.thisCompilation.tap(
174
+ pluginName,
175
+ (compilation) => compilation.mainTemplate.hooks.localVars.tap(
176
+ { name: pluginName, stage: 1 },
177
+ (source) => source + script
178
+ )
179
+ );
180
+ }
181
+ }
182
+
158
183
  function createMFS() {
159
184
  const fs = createFsFromVolume(new Volume());
160
185
  const _fs = { ...fs };
@@ -1102,6 +1127,9 @@ async function bundle(dtwo) {
1102
1127
  config.plugins.push(DynamicBasePlugin.webpack({
1103
1128
  sourcemap: dtwo.options.sourcemap[config.name]
1104
1129
  }));
1130
+ if (config.name === "client" && dtwo.options.experimental.emitRouteChunkError) {
1131
+ config.plugins.push(new ChunkErrorPlugin());
1132
+ }
1105
1133
  config.plugins.push(composableKeysPlugin.webpack({
1106
1134
  sourcemap: dtwo.options.sourcemap[config.name],
1107
1135
  rootDir: dtwo.options.rootDir
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dtwo/webpack-builder",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "repository": "d2js/dtwo",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -15,26 +15,26 @@
15
15
  "dependencies": {
16
16
  "@babel/core": "7.20.12",
17
17
  "@d2js/friendly-errors-webpack-plugin": "2.5.2",
18
- "@dtwo/kit": "3.2.0",
19
- "@dtwo/unplugin": "1.0.0",
18
+ "@dtwo/kit": "3.2.1",
19
+ "@dtwo/unplugin": "1.4.0",
20
20
  "@dtwojs/fork-ts-checker-webpack-plugin": "7.3.0",
21
21
  "autoprefixer": "10.4.13",
22
22
  "css-loader": "6.7.3",
23
23
  "css-minimizer-webpack-plugin": "4.2.2",
24
- "cssnano": "5.1.14",
25
- "esbuild-loader": "3.0.0",
24
+ "cssnano": "5.1.15",
25
+ "esbuild-loader": "3.0.1",
26
26
  "escape-string-regexp": "5.0.0",
27
27
  "estree-walker": "3.0.3",
28
28
  "file-loader": "6.2.0",
29
29
  "fs-extra": "11.1.0",
30
30
  "hash-sum": "2.0.0",
31
- "kdu-bundle-renderer": "1.0.1",
31
+ "kdu-bundle-renderer": "1.0.2-1",
32
32
  "kdu-loader": "17.0.0",
33
33
  "lodash-es": "4.17.21",
34
- "magic-string": "0.27.0",
34
+ "magic-string": "0.29.0",
35
35
  "memfs": "3.4.13",
36
36
  "mini-css-extract-plugin": "2.7.2",
37
- "mlly": "1.1.0",
37
+ "mlly": "1.1.1",
38
38
  "ohash": "1.0.0",
39
39
  "pathe": "1.1.0",
40
40
  "pify": "6.1.0",
@@ -44,17 +44,17 @@
44
44
  "postcss-url": "10.1.3",
45
45
  "style-resources-loader": "1.5.0",
46
46
  "time-fix-plugin": "2.0.7",
47
- "ufo": "1.0.1",
47
+ "ufo": "1.1.0",
48
48
  "url-loader": "4.1.1",
49
49
  "webpack": "5.75.0",
50
- "webpack-bundle-analyzer": "4.7.0",
50
+ "webpack-bundle-analyzer": "4.8.0",
51
51
  "webpack-dev-middleware": "6.0.1",
52
52
  "webpack-hot-middleware": "2.25.3",
53
53
  "webpack-virtual-modules": "0.5.0",
54
54
  "webpackbar": "5.0.2"
55
55
  },
56
56
  "devDependencies": {
57
- "@dtwo/schema": "3.2.0",
57
+ "@dtwo/schema": "3.2.1",
58
58
  "@types/lodash-es": "4.17.6",
59
59
  "@types/pify": "5.0.1",
60
60
  "@types/webpack-bundle-analyzer": "4.6.0",
@@ -68,7 +68,7 @@
68
68
  "kdu": "^3.2.47"
69
69
  },
70
70
  "engines": {
71
- "node": "^14.16.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
71
+ "node": "^14.18.0 || ^16.10.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
72
72
  },
73
73
  "scripts": {}
74
74
  }
package/README.md DELETED
@@ -1,7 +0,0 @@
1
- # Dtwo
2
-
3
- Dtwo 3: **The Intuitive Web Framework** ✨
4
-
5
- ## License
6
-
7
- [MIT](./LICENSE)