@umijs/bundler-webpack 4.0.0-beta.9 → 4.0.0-rc.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.
Files changed (101) hide show
  1. package/compiled/autoprefixer/browserslist/index.d.ts +7 -7
  2. package/compiled/autoprefixer/index.js +3 -3
  3. package/compiled/autoprefixer/postcss/lib/container.d.ts +2 -2
  4. package/compiled/autoprefixer/postcss/lib/css-syntax-error.d.ts +55 -8
  5. package/compiled/autoprefixer/postcss/lib/input.d.ts +26 -6
  6. package/compiled/autoprefixer/postcss/lib/lazy-result.d.ts +11 -10
  7. package/compiled/autoprefixer/postcss/lib/no-work-result.d.ts +37 -0
  8. package/compiled/autoprefixer/postcss/lib/node.d.ts +36 -2
  9. package/compiled/autoprefixer/postcss/lib/postcss.d.ts +31 -30
  10. package/compiled/autoprefixer/postcss/lib/processor.d.ts +5 -4
  11. package/compiled/autoprefixer/postcss/lib/result.d.ts +3 -2
  12. package/compiled/autoprefixer/postcss/lib/warning.d.ts +37 -3
  13. package/compiled/babel-loader/index.js +2 -2
  14. package/compiled/fork-ts-checker-webpack-plugin/LICENSE +21 -0
  15. package/compiled/fork-ts-checker-webpack-plugin/fsevents.node +0 -0
  16. package/compiled/fork-ts-checker-webpack-plugin/index.js +49 -0
  17. package/compiled/fork-ts-checker-webpack-plugin/package.json +1 -0
  18. package/compiled/mini-css-extract-plugin/index.js +6769 -6731
  19. package/compiled/mini-css-extract-plugin/loader.js +1 -1
  20. package/compiled/mini-css-extract-plugin/utils.js +11 -6
  21. package/compiled/postcss-loader/index.js +1 -1
  22. package/compiled/react-refresh/index.js +3 -3
  23. package/compiled/sass-loader/index.js +1 -1
  24. package/compiled/schema-utils/ajv/dist/ajv.d.ts +16 -0
  25. package/compiled/schema-utils/ajv/dist/compile/codegen/code.d.ts +39 -0
  26. package/compiled/schema-utils/ajv/dist/compile/codegen/index.d.ts +79 -0
  27. package/compiled/schema-utils/ajv/dist/compile/codegen/scope.d.ts +79 -0
  28. package/compiled/schema-utils/ajv/dist/compile/errors.d.ts +13 -0
  29. package/compiled/schema-utils/ajv/dist/compile/index.d.ts +80 -0
  30. package/compiled/schema-utils/ajv/dist/compile/ref_error.d.ts +5 -0
  31. package/compiled/schema-utils/ajv/dist/compile/resolve.d.ts +12 -0
  32. package/compiled/schema-utils/ajv/dist/compile/rules.d.ts +28 -0
  33. package/compiled/schema-utils/ajv/dist/compile/util.d.ts +40 -0
  34. package/compiled/schema-utils/ajv/dist/compile/validate/index.d.ts +42 -0
  35. package/compiled/schema-utils/ajv/dist/compile/validate/subschema.d.ts +47 -0
  36. package/compiled/schema-utils/ajv/dist/core.d.ts +171 -0
  37. package/compiled/schema-utils/ajv/dist/runtime/validation_error.d.ts +7 -0
  38. package/compiled/schema-utils/ajv/dist/types/index.d.ts +177 -0
  39. package/compiled/schema-utils/ajv/dist/types/json-schema.d.ts +124 -0
  40. package/compiled/schema-utils/ajv/dist/types/jtd-schema.d.ts +168 -0
  41. package/compiled/schema-utils/declarations/validate.d.ts +4 -4
  42. package/compiled/schema-utils/index.js +8 -2
  43. package/compiled/schema-utils/uri-js/dist/es5/uri.all.d.ts +59 -0
  44. package/compiled/style-loader/index.js +1 -1
  45. package/compiled/terser/index.js +1 -1
  46. package/compiled/terser-webpack-plugin/index.js +328 -451
  47. package/compiled/terser-webpack-plugin/jest-worker/build/types.d.ts +1 -0
  48. package/compiled/terser-webpack-plugin/minify.js +6 -1
  49. package/compiled/terser-webpack-plugin/types/index.d.ts +3 -3
  50. package/compiled/terser-webpack-plugin/types/utils.d.ts +9 -12
  51. package/compiled/terser-webpack-plugin/utils.js +113 -17
  52. package/compiled/webpack/index.js +4915 -4485
  53. package/compiled/webpack-dev-middleware/index.js +11 -5
  54. package/compiled/webpack-manifest-plugin/LICENSE +21 -0
  55. package/compiled/webpack-manifest-plugin/index.js +1 -0
  56. package/compiled/webpack-manifest-plugin/package.json +1 -0
  57. package/compiled/webpack-sources/index.js +1 -1
  58. package/dist/build.d.ts +3 -2
  59. package/dist/build.js +1 -0
  60. package/dist/cli.js +4 -7
  61. package/dist/config/assetRules.js +6 -14
  62. package/dist/config/config.d.ts +7 -2
  63. package/dist/config/config.js +45 -4
  64. package/dist/config/cssRules.js +1 -1
  65. package/dist/config/forkTSCheckerPlugin.d.ts +11 -0
  66. package/dist/config/forkTSCheckerPlugin.js +34 -0
  67. package/dist/config/harmonyLinkingErrorPlugin.d.ts +6 -0
  68. package/dist/config/harmonyLinkingErrorPlugin.js +42 -0
  69. package/dist/config/javaScriptRules.d.ts +1 -0
  70. package/dist/config/javaScriptRules.js +33 -19
  71. package/dist/config/manifestPlugin.d.ts +11 -0
  72. package/dist/config/manifestPlugin.js +25 -0
  73. package/dist/config/miniCSSExtractPlugin.d.ts +1 -0
  74. package/dist/config/miniCSSExtractPlugin.js +2 -3
  75. package/dist/config/svgRules.d.ts +1 -0
  76. package/dist/config/svgRules.js +17 -3
  77. package/dist/dev.d.ts +3 -2
  78. package/dist/dev.js +29 -5
  79. package/dist/esbuildHandler/autoCssModules.d.ts +2 -0
  80. package/dist/esbuildHandler/autoCssModules.js +23 -0
  81. package/dist/loader/esbuild.d.ts +5 -0
  82. package/dist/loader/esbuild.js +53 -0
  83. package/dist/loader/svgr.d.ts +4 -0
  84. package/dist/loader/svgr.js +67 -0
  85. package/dist/loader/swc.d.ts +4 -0
  86. package/dist/loader/swc.js +83 -0
  87. package/dist/plugins/RuntimePublicPathPlugin.d.ts +4 -0
  88. package/dist/plugins/RuntimePublicPathPlugin.js +20 -0
  89. package/dist/schema.js +11 -5
  90. package/dist/server/server.js +20 -1
  91. package/dist/swcPlugins/autoCSSModules.js +6 -4
  92. package/dist/swcPlugins/lockCoreJS.d.ts +6 -0
  93. package/dist/swcPlugins/lockCoreJS.js +23 -0
  94. package/dist/types.d.ts +18 -0
  95. package/package.json +36 -31
  96. package/compiled/@svgr/webpack/LICENSE +0 -7
  97. package/compiled/@svgr/webpack/index.js +0 -266
  98. package/compiled/@svgr/webpack/package.json +0 -1
  99. package/compiled/swc-loader/LICENSE +0 -25
  100. package/compiled/swc-loader/index.js +0 -1
  101. package/compiled/swc-loader/package.json +0 -1
@@ -4,8 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const Visitor_1 = __importDefault(require("@swc/core/Visitor"));
7
- const path_1 = require("path");
8
- const CSS_EXT_NAMES = ['.css', '.less', '.sass', '.scss', '.stylus', '.styl'];
7
+ const utils_1 = require("@umijs/utils");
9
8
  class AutoCSSModule extends Visitor_1.default {
10
9
  visitTsType(expression) {
11
10
  return expression;
@@ -13,7 +12,7 @@ class AutoCSSModule extends Visitor_1.default {
13
12
  visitImportDeclaration(expression) {
14
13
  const { specifiers, source } = expression;
15
14
  const { value } = source;
16
- if (specifiers.length && CSS_EXT_NAMES.includes((0, path_1.extname)(value))) {
15
+ if (specifiers.length && (0, utils_1.isStyleFile)({ filename: value })) {
17
16
  return Object.assign(Object.assign({}, expression), { source: Object.assign(Object.assign({}, source), { value: `${value}?modules` }) });
18
17
  }
19
18
  return expression;
@@ -24,9 +23,12 @@ class AutoCSSModule extends Visitor_1.default {
24
23
  declarations[0].init &&
25
24
  declarations[0].init.type === 'AwaitExpression' &&
26
25
  declarations[0].init.argument.type === 'CallExpression' &&
26
+ declarations[0].init.argument.arguments.length &&
27
27
  declarations[0].init.argument.arguments[0].expression.type ===
28
28
  'StringLiteral' &&
29
- CSS_EXT_NAMES.includes((0, path_1.extname)(declarations[0].init.argument.arguments[0].expression.value))) {
29
+ (0, utils_1.isStyleFile)({
30
+ filename: declarations[0].init.argument.arguments[0].expression.value,
31
+ })) {
30
32
  declarations[0].init.argument.arguments[0].expression.value = `${declarations[0].init.argument.arguments[0].expression.value}?modules`;
31
33
  }
32
34
  return expression;
@@ -0,0 +1,6 @@
1
+ import { ImportDeclaration } from '@swc/core';
2
+ import Visitor from '@swc/core/Visitor';
3
+ declare class LockCoreJS extends Visitor {
4
+ visitImportDeclaration(expression: ImportDeclaration): ImportDeclaration;
5
+ }
6
+ export default LockCoreJS;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const Visitor_1 = __importDefault(require("@swc/core/Visitor"));
7
+ const utils_1 = require("@umijs/utils");
8
+ const path_1 = require("path");
9
+ function addLastSlash(path) {
10
+ return path.endsWith('/') ? path : `${path}/`;
11
+ }
12
+ class LockCoreJS extends Visitor_1.default {
13
+ visitImportDeclaration(expression) {
14
+ const { source } = expression;
15
+ let { value, type } = source;
16
+ if (type === 'StringLiteral' && value.startsWith('core-js/')) {
17
+ value = value.replace(/^core-js\//, addLastSlash((0, utils_1.winPath)((0, path_1.dirname)(require.resolve('core-js/package.json')))));
18
+ return Object.assign(Object.assign({}, expression), { source: Object.assign(Object.assign({}, source), { value }) });
19
+ }
20
+ return expression;
21
+ }
22
+ }
23
+ exports.default = LockCoreJS;
package/dist/types.d.ts CHANGED
@@ -1,3 +1,6 @@
1
+ import type { Config as SwcConfig } from '@swc/core';
2
+ import type { ImportSpecifier } from '@umijs/bundler-utils/compiled/es-module-lexer';
3
+ import type { TransformOptions } from '@umijs/bundler-utils/compiled/esbuild';
1
4
  import type { Options as ProxyOptions } from '../compiled/http-proxy-middleware';
2
5
  import { Configuration } from '../compiled/webpack';
3
6
  import Config from '../compiled/webpack-5-chain';
@@ -34,6 +37,7 @@ declare type IBabelPlugin = Function | string | [string, {
34
37
  export interface IConfig {
35
38
  alias?: Record<string, string>;
36
39
  autoCSSModules?: boolean;
40
+ base?: string;
37
41
  chainWebpack?: Function;
38
42
  copy?: ICopy[] | string[];
39
43
  cssLoader?: {
@@ -97,4 +101,18 @@ export interface IConfig {
97
101
  writeToDisk?: boolean;
98
102
  [key: string]: any;
99
103
  }
104
+ export interface SwcOptions extends SwcConfig {
105
+ sync?: boolean;
106
+ parseMap?: boolean;
107
+ targets?: Record<string, any>;
108
+ }
109
+ export interface IEsbuildLoaderHandlerParams {
110
+ code: string;
111
+ filePath: string;
112
+ imports: readonly ImportSpecifier[];
113
+ exports: readonly string[];
114
+ }
115
+ export interface IEsbuildLoaderOpts extends Partial<TransformOptions> {
116
+ handler?: Array<(opts: IEsbuildLoaderHandlerParams) => string>;
117
+ }
100
118
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umijs/bundler-webpack",
3
- "version": "4.0.0-beta.9",
3
+ "version": "4.0.0-rc.1",
4
4
  "description": "@umijs/bundler-webpack",
5
5
  "homepage": "https://github.com/umijs/umi-next/tree/master/packages/bundler-webpack#readme",
6
6
  "bugs": "https://github.com/umijs/umi-next/issues",
@@ -28,56 +28,59 @@
28
28
  "generate:webpackPackages": "zx ./scripts/generateWebpackPackages.mjs"
29
29
  },
30
30
  "dependencies": {
31
- "@pmmmwh/react-refresh-webpack-plugin": "0.5.1",
32
- "@swc/core": "1.2.105",
31
+ "@pmmmwh/react-refresh-webpack-plugin": "0.5.3",
32
+ "@svgr/core": "6.0.0",
33
+ "@svgr/plugin-jsx": "^6.1.0",
34
+ "@svgr/plugin-svgo": "^6.1.0",
35
+ "@swc/core": "1.2.117",
33
36
  "@types/hapi__joi": "17.1.7",
34
- "@umijs/babel-preset-umi": "4.0.0-beta.9",
35
- "@umijs/mfsu": "4.0.0-beta.9",
36
- "@umijs/utils": "4.0.0-beta.9",
37
- "css-loader": "6.5.0",
37
+ "@umijs/babel-preset-umi": "4.0.0-rc.1",
38
+ "@umijs/mfsu": "4.0.0-rc.1",
39
+ "@umijs/utils": "4.0.0-rc.1",
40
+ "css-loader": "6.5.1",
38
41
  "es5-imcompatible-versions": "^0.1.73",
39
- "jest-worker": "27.3.1",
42
+ "jest-worker": "27.4.2",
40
43
  "node-libs-browser": "2.2.1",
41
- "postcss": "^8.3.11",
42
- "postcss-preset-env": "6.7.0",
44
+ "postcss": "^8.4.4",
45
+ "postcss-preset-env": "7.0.1",
43
46
  "react-error-overlay": "6.0.9"
44
47
  },
45
48
  "devDependencies": {
46
- "@svgr/webpack": "6.0.0",
47
49
  "@types/express": "4.17.13",
48
50
  "@types/webpack-sources": "3.2.0",
49
- "@types/ws": "8.2.0",
50
- "autoprefixer": "10.3.7",
51
- "babel-loader": "8.2.2",
51
+ "@types/ws": "8.2.1",
52
+ "autoprefixer": "10.4.0",
53
+ "babel-loader": "8.2.3",
52
54
  "compression": "1.7.4",
53
55
  "connect-history-api-fallback": "1.6.0",
54
56
  "copy-webpack-plugin": "9.0.1",
55
57
  "css-minimizer-webpack-plugin": "3.1.1",
56
58
  "cssnano": "5.0.8",
57
59
  "express": "4.17.1",
60
+ "fork-ts-checker-webpack-plugin": "6.5.0",
58
61
  "http-proxy-middleware": "2.0.1",
59
62
  "less": "4.1.2",
60
63
  "less-loader": "10.2.0",
61
- "mini-css-extract-plugin": "2.4.2",
64
+ "mini-css-extract-plugin": "2.4.5",
62
65
  "postcss-flexbugs-fixes": "5.0.2",
63
- "postcss-loader": "6.2.0",
66
+ "postcss-loader": "6.2.1",
64
67
  "purgecss-webpack-plugin": "4.0.3",
65
- "react-refresh": "0.10.0",
66
- "sass-loader": "12.2.0",
67
- "schema-utils": "3.1.1",
68
+ "react-refresh": "0.11.0",
69
+ "sass-loader": "12.3.0",
70
+ "schema-utils": "4.0.0",
68
71
  "speed-measure-webpack-plugin": "1.5.0",
69
- "style-loader": "3.3.0",
72
+ "style-loader": "3.3.1",
70
73
  "svgo-loader": "3.0.0",
71
- "swc-loader": "0.1.15",
72
74
  "tapable": "2.2.1",
73
- "terser": "5.9.0",
74
- "terser-webpack-plugin": "5.2.4",
75
+ "terser": "5.10.0",
76
+ "terser-webpack-plugin": "5.2.5",
75
77
  "url-loader": "4.1.1",
76
- "webpack": "5.61.0",
78
+ "webpack": "5.64.4",
77
79
  "webpack-5-chain": "8.0.0",
78
80
  "webpack-bundle-analyzer": "4.5.0",
79
- "webpack-dev-middleware": "5.2.1",
80
- "webpack-sources": "3.2.1",
81
+ "webpack-dev-middleware": "5.2.2",
82
+ "webpack-manifest-plugin": "4.0.2",
83
+ "webpack-sources": "3.2.2",
81
84
  "ws": "8.2.3"
82
85
  },
83
86
  "publishConfig": {
@@ -88,7 +91,6 @@
88
91
  ],
89
92
  "compiledConfig": {
90
93
  "deps": [
91
- "@svgr/webpack",
92
94
  "autoprefixer",
93
95
  "babel-loader",
94
96
  "copy-webpack-plugin",
@@ -98,6 +100,7 @@
98
100
  "compression",
99
101
  "connect-history-api-fallback",
100
102
  "express",
103
+ "fork-ts-checker-webpack-plugin",
101
104
  "http-proxy-middleware",
102
105
  "less",
103
106
  "less-loader",
@@ -108,7 +111,6 @@
108
111
  "sass-loader",
109
112
  "schema-utils",
110
113
  "style-loader",
111
- "swc-loader",
112
114
  "speed-measure-webpack-plugin",
113
115
  "svgo-loader",
114
116
  "tapable",
@@ -118,6 +120,7 @@
118
120
  "webpack-5-chain",
119
121
  "webpack-bundle-analyzer",
120
122
  "webpack-dev-middleware",
123
+ "webpack-manifest-plugin",
121
124
  "webpack-sources",
122
125
  "ws",
123
126
  "./bundles/webpack/bundle",
@@ -136,9 +139,11 @@
136
139
  "tapable": "$$LOCAL",
137
140
  "terser": "$$LOCAL",
138
141
  "terser-webpack-plugin": "$$LOCAL",
142
+ "typescript": "typescript",
139
143
  "uglify-js": "uglify-js",
140
144
  "url-loader": "$$LOCAL",
141
145
  "webpack": "$$LOCAL",
146
+ "webpack/lib/NormalModule": "../webpack/NormalModule",
142
147
  "webpack-5-chain": "$$LOCAL",
143
148
  "webpack-sources": "$$LOCAL",
144
149
  "ws": "$$LOCAL"
@@ -159,7 +164,6 @@
159
164
  "webpack"
160
165
  ],
161
166
  "excludeDtsDeps": [
162
- "@svgr/webpack",
163
167
  "babel-loader",
164
168
  "copy-webpack-plugin",
165
169
  "css-loader",
@@ -167,6 +171,7 @@
167
171
  "cssnano",
168
172
  "compression",
169
173
  "connect-history-api-fallback",
174
+ "fork-ts-checker-webpack-plugin",
170
175
  "less",
171
176
  "less-loader",
172
177
  "mini-css-extract-plugin",
@@ -176,11 +181,11 @@
176
181
  "sass-loader",
177
182
  "speed-measure-webpack-plugin",
178
183
  "style-loader",
179
- "swc-loader",
180
184
  "svgo-loader",
181
185
  "url-loader",
182
186
  "webpack-bundle-analyzer",
183
- "webpack-dev-middleware"
187
+ "webpack-dev-middleware",
188
+ "webpack-manifest-plugin"
184
189
  ]
185
190
  }
186
191
  }
@@ -1,7 +0,0 @@
1
- Copyright 2017 Smooth Code
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
-
5
- The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
-
7
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.