ko 6.5.1 → 6.5.3-beta.0
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/CHANGELOG.md +358 -0
- package/README.md +5 -5
- package/lib/actions/dev.js +30 -3
- package/lib/cli.js +1 -1
- package/lib/core/config.js +0 -1
- package/lib/core/hooks.js +6 -2
- package/lib/webpack/index.js +1 -11
- package/lib/webpack/loaders/style.js +0 -28
- package/lib/webpack/plugins.js +11 -1
- package/package.json +20 -13
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
# ko
|
|
2
|
+
|
|
3
|
+
## 6.5.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 723774e0e: optimize devServer complation log and add dev log config
|
|
8
|
+
- 8006d5d49: add port select when port used
|
|
9
|
+
- 14e59d909: add --max_old_space_size
|
|
10
|
+
- 2640cddf5: remove antd4Options when antd upgrade to 4+
|
|
11
|
+
|
|
12
|
+
## 6.5.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- b23e6cbb: devserver added historyApiFallback configuration to resolve resource path 404 issues
|
|
17
|
+
|
|
18
|
+
## 6.5.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 78b5730e: support clear console.log and bug fixed
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- 1cbef1df: support clear console.log
|
|
27
|
+
|
|
28
|
+
## 6.4.1
|
|
29
|
+
|
|
30
|
+
### Patch Changes
|
|
31
|
+
|
|
32
|
+
- 56e09f1d: correct worker-loader include config
|
|
33
|
+
|
|
34
|
+
## 6.4.0
|
|
35
|
+
|
|
36
|
+
### Minor Changes
|
|
37
|
+
|
|
38
|
+
- 3d2f19ae: new options & bugs fixed
|
|
39
|
+
- support new option: `logLevel`
|
|
40
|
+
- support new plugin key: `ModifyWebpack`
|
|
41
|
+
- change MiniCssExtractPluginLoader to style-loader in development mode
|
|
42
|
+
- fix bugs: #108, #109
|
|
43
|
+
|
|
44
|
+
## 6.3.4
|
|
45
|
+
|
|
46
|
+
### Patch Changes
|
|
47
|
+
|
|
48
|
+
- fba9a04c: support new option
|
|
49
|
+
- auto-polyfills-webpack-plugin: support longTermCache option to decide whether or not to store cache polyfills.
|
|
50
|
+
- Updated dependencies [fba9a04c]
|
|
51
|
+
- auto-polyfills-webpack-plugin@1.1.0
|
|
52
|
+
|
|
53
|
+
## 6.3.3
|
|
54
|
+
|
|
55
|
+
### Patch Changes
|
|
56
|
+
|
|
57
|
+
- 55aa11c9: fix bug
|
|
58
|
+
- auto polyfills webpack plugin can't read browserslist correctly
|
|
59
|
+
- Updated dependencies [55aa11c9]
|
|
60
|
+
- auto-polyfills-webpack-plugin@1.0.2
|
|
61
|
+
|
|
62
|
+
## 6.3.2
|
|
63
|
+
|
|
64
|
+
### Patch Changes
|
|
65
|
+
|
|
66
|
+
- 51287d44: update plugin dependencies
|
|
67
|
+
|
|
68
|
+
- fixed bugs of can't send correct options to core-js-builder
|
|
69
|
+
|
|
70
|
+
## 6.3.1
|
|
71
|
+
|
|
72
|
+
### Patch Changes
|
|
73
|
+
|
|
74
|
+
- 641dc7aa: update ko dependency version
|
|
75
|
+
|
|
76
|
+
## 6.3.0
|
|
77
|
+
|
|
78
|
+
### Minor Changes
|
|
79
|
+
|
|
80
|
+
- 403d780e: release auto-polyfills-webpack-plugin, and support it in ko
|
|
81
|
+
|
|
82
|
+
1. release auto-polyfills-webpack-plugin, find more in it's README
|
|
83
|
+
2. add auto-polyfills-webpack-plugin & dynamic-resolve-webpack-plugin into ko, and support change these plugins via config options:
|
|
84
|
+
|
|
85
|
+
```js
|
|
86
|
+
export type IOptions = {
|
|
87
|
+
dynamicResolve?: <T extends any>(request: T) => T;
|
|
88
|
+
autoPolyfills: boolean | AutoPolyfillsWebpackPluginOptions;
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
- Updated dependencies [403d780e]
|
|
93
|
+
- auto-polyfills-webpack-plugin@1.0.1
|
|
94
|
+
|
|
95
|
+
## 6.2.0
|
|
96
|
+
|
|
97
|
+
### Minor Changes
|
|
98
|
+
|
|
99
|
+
- c77237f1: support new config
|
|
100
|
+
|
|
101
|
+
1. support disableLazyImports config when using fast refresh
|
|
102
|
+
|
|
103
|
+
## 6.1.4
|
|
104
|
+
|
|
105
|
+
### Patch Changes
|
|
106
|
+
|
|
107
|
+
- fix bugs in production mode
|
|
108
|
+
|
|
109
|
+
1. minimizer bug when in production mode
|
|
110
|
+
2. include ico assets when build
|
|
111
|
+
|
|
112
|
+
## 6.1.3
|
|
113
|
+
|
|
114
|
+
### Patch Changes
|
|
115
|
+
|
|
116
|
+
- ko-lints@4.0.0
|
|
117
|
+
|
|
118
|
+
## 6.1.2
|
|
119
|
+
|
|
120
|
+
### Patch Changes
|
|
121
|
+
|
|
122
|
+
- ff1560a2: exit with error when lint throw errors
|
|
123
|
+
|
|
124
|
+
- exit with `process.exit(1)` when stdout length is not zero
|
|
125
|
+
- use variadic arguments in patterns
|
|
126
|
+
|
|
127
|
+
## 6.1.1
|
|
128
|
+
|
|
129
|
+
### Patch Changes
|
|
130
|
+
|
|
131
|
+
- 62572f85: update dependence of ko-lints
|
|
132
|
+
|
|
133
|
+
## 6.1.0
|
|
134
|
+
|
|
135
|
+
### Minor Changes
|
|
136
|
+
|
|
137
|
+
- 1721dfa0: Support Lints & Format with concurrency mode, Add Config & Plugin of Prettier in Eslint
|
|
138
|
+
|
|
139
|
+
- `ko-lint-config`:
|
|
140
|
+
|
|
141
|
+
Add Config & Plugin of Prettier in Eslint Config
|
|
142
|
+
|
|
143
|
+
- `ko-lints`:
|
|
144
|
+
|
|
145
|
+
- Support concurrency mode with multithreading to do lint or format tasks,you can enable concurrency mode via `--concurrency` cli flag
|
|
146
|
+
- Default threads Count is `require('os').cpus().length`, you can specify it via `--concurrentNumber` like `--concurrentNumber=4`
|
|
147
|
+
|
|
148
|
+
- `ko`:
|
|
149
|
+
- Support `ko prettier`,`ko eslint`,`ko stylelint` commands with concurrency mode, you can also specify this mode with `ko.config.js`
|
|
150
|
+
|
|
151
|
+
### Patch Changes
|
|
152
|
+
|
|
153
|
+
- Updated dependencies [1721dfa0]
|
|
154
|
+
- ko-lints@4.0.0
|
|
155
|
+
|
|
156
|
+
## 6.0.1
|
|
157
|
+
|
|
158
|
+
### Patch Changes
|
|
159
|
+
|
|
160
|
+
- ko-lints@3.0.0
|
|
161
|
+
|
|
162
|
+
## 6.0.0
|
|
163
|
+
|
|
164
|
+
### Major Changes
|
|
165
|
+
|
|
166
|
+
- 84adca00: publish ko v6.0 and it's related packages
|
|
167
|
+
|
|
168
|
+
### Patch Changes
|
|
169
|
+
|
|
170
|
+
- Updated dependencies [84adca00]
|
|
171
|
+
- ko-lints@2.0.0
|
|
172
|
+
|
|
173
|
+
## 5.3.10
|
|
174
|
+
|
|
175
|
+
### Patch Changes
|
|
176
|
+
|
|
177
|
+
- 70576b9c: Bug Fixed
|
|
178
|
+
- fix: antd v4 less loader path
|
|
179
|
+
|
|
180
|
+
## 5.3.9
|
|
181
|
+
|
|
182
|
+
### Patch Changes
|
|
183
|
+
|
|
184
|
+
- 35faeb91: fix less-loader config issue when in symlink
|
|
185
|
+
|
|
186
|
+
## 5.3.8
|
|
187
|
+
|
|
188
|
+
### Patch Changes
|
|
189
|
+
|
|
190
|
+
- update less exclude config
|
|
191
|
+
- exclude test files when build
|
|
192
|
+
|
|
193
|
+
## 5.3.7
|
|
194
|
+
|
|
195
|
+
### Patch Changes
|
|
196
|
+
|
|
197
|
+
- fd136e36: Optimizations
|
|
198
|
+
- feat: update build action optimization
|
|
199
|
+
- fix: update work-loader's path to resolve path
|
|
200
|
+
|
|
201
|
+
## 5.3.6
|
|
202
|
+
|
|
203
|
+
### Patch Changes
|
|
204
|
+
|
|
205
|
+
- ## 4f4516bb: Optimization:
|
|
206
|
+
- fix: chunks can be shared even between async and no-async chunks
|
|
207
|
+
- fix: fix dt-common path scope bug
|
|
208
|
+
- docs: update FAQ.md
|
|
209
|
+
|
|
210
|
+
## 5.3.5
|
|
211
|
+
|
|
212
|
+
### Patch Changes
|
|
213
|
+
|
|
214
|
+
- 1ed9e367: Optimization:
|
|
215
|
+
- support hash parameter for fix potential conflict filename
|
|
216
|
+
- update devServer default config to prevent GC
|
|
217
|
+
|
|
218
|
+
## 5.3.4
|
|
219
|
+
|
|
220
|
+
### Patch Changes
|
|
221
|
+
|
|
222
|
+
- cb5abf09: \* Downgrade webpack-dev-server to v3
|
|
223
|
+
- Support fallback internally
|
|
224
|
+
|
|
225
|
+
## 5.3.3
|
|
226
|
+
|
|
227
|
+
### Patch Changes
|
|
228
|
+
|
|
229
|
+
- 1e760adc: Fix Bug #87, change cache to "memory" when environment is development
|
|
230
|
+
- e268fcb1: bugs fixed
|
|
231
|
+
|
|
232
|
+
## 5.3.2
|
|
233
|
+
|
|
234
|
+
### Patch Changes
|
|
235
|
+
|
|
236
|
+
- Bugs fixed
|
|
237
|
+
|
|
238
|
+
- fix set wrong **mode** when run `ko build` bug
|
|
239
|
+
- fix port change not effect devSever config bug
|
|
240
|
+
|
|
241
|
+
## 5.3.1
|
|
242
|
+
|
|
243
|
+
- support work-loader internally
|
|
244
|
+
- update webpack-dev-server default config to disable full-screen overlay in the browser
|
|
245
|
+
- optimize docs
|
|
246
|
+
|
|
247
|
+
## 5.3.0
|
|
248
|
+
|
|
249
|
+
- change ts-loader to babel-loader because babel-loader is faster than ts-loader when build [#76](https://github.com/DTStack/ko/issues/76)
|
|
250
|
+
- support React Fast Refresh [#77](https://github.com/DTStack/ko/issues/77)
|
|
251
|
+
- migrate webapack-dev-server from v3 to v4 [#78](https://github.com/DTStack/ko/issues/78)
|
|
252
|
+
|
|
253
|
+
## 5.2.1
|
|
254
|
+
|
|
255
|
+
- fixed [Throw an error when running "ko init"](https://github.com/DTStack/ko/issues/27)
|
|
256
|
+
- check node version when install because [webpack 5 requires at least Node.js 10.13.0 (LTS)](https://webpack.js.org/migrate/5/#preparations)
|
|
257
|
+
|
|
258
|
+
## 5.2.0
|
|
259
|
+
|
|
260
|
+
- upgrade dependencies except less because [Ant Design use 3.x version of less](https://github.com/vueComponent/ant-design-vue/issues/3665)
|
|
261
|
+
- remove file-loader, change to [asset-modules](https://webpack.js.org/guides/asset-modules/)
|
|
262
|
+
- fixed [react-dev-utils warning](https://github.com/facebook/create-react-app/issues/9880)
|
|
263
|
+
- update `ko-babel-app` to version 8.0.17
|
|
264
|
+
|
|
265
|
+
## 5.0.5
|
|
266
|
+
|
|
267
|
+
- remove prettier parse config to fixed prettier format bug
|
|
268
|
+
- support react lint for eslint
|
|
269
|
+
|
|
270
|
+
## 5.0.4
|
|
271
|
+
|
|
272
|
+
- repository structure:
|
|
273
|
+
|
|
274
|
+
- config directory: webpack config files has been move to webpack subdirectory
|
|
275
|
+
- util directory: remove useless and duplicated utility functions
|
|
276
|
+
|
|
277
|
+
- lint:
|
|
278
|
+
|
|
279
|
+
- add prettier & eslint dependencies
|
|
280
|
+
- eslint support default & user defined config, and eslintignore config
|
|
281
|
+
- prettier support default & user defined config, and prettierignore config
|
|
282
|
+
|
|
283
|
+
- plugins have be removed in this release:
|
|
284
|
+
|
|
285
|
+
- `webpack.BannerPlugin`'s banner now has static banner content, maybe it's will be readded in the future with user defined banner content
|
|
286
|
+
- `webpack.DllPlugin` has been removed from CRA & vue-cli because [Webpack 4 should provide good enough perf and the cost of maintaining DLL mode inside Vue CLI is no longer justified](https://github.com/vuejs/vue-cli/issues/1205) & webpack 5 use [HardSourceWebpackPlugin](https://www.cnblogs.com/skychx/p/webpack-dllplugin.html) to optimize
|
|
287
|
+
- `happypack`'s maintainer sugguest users to use [thread-loader](https://github.com/webpack-contrib/thread-loader) instead
|
|
288
|
+
- `copy-webpack-plugin` has been used when dll is support, it will be removed when release new verison
|
|
289
|
+
|
|
290
|
+
- dependencies will be removed in next release:
|
|
291
|
+
|
|
292
|
+
- `camelcase` removed because attachToEnv function has been removed
|
|
293
|
+
|
|
294
|
+
- `decamelize` removed because attachToEnv function has been removed
|
|
295
|
+
|
|
296
|
+
## 5.0.0
|
|
297
|
+
|
|
298
|
+
Migrate webpack to v5, and remove or update webpack plugins & loaders.
|
|
299
|
+
|
|
300
|
+
### Upgrade
|
|
301
|
+
|
|
302
|
+
assets-webpack-plugin ^3.9.10 → ^7.0.0
|
|
303
|
+
autoprefixer ^9.7.3 → ^10.1.0
|
|
304
|
+
babel-loader ^8.0.6 → ^8.2.2
|
|
305
|
+
camelcase ^5.3.1 → ^6.2.0
|
|
306
|
+
case-sensitive-paths-webpack-plugin ^2.2.0 → ^2.3.0
|
|
307
|
+
clean-webpack-plugin 1.0.0 → 3.0.0
|
|
308
|
+
commander ^4.1.0 → ^6.2.1
|
|
309
|
+
compressing ^1.5.0 → ^1.5.1
|
|
310
|
+
copy-webpack-plugin ^5.1.1 → ^7.0.0
|
|
311
|
+
css-loader ^3.4.1 → ^5.0.1
|
|
312
|
+
decamelize ^3.2.0 → ^4.0.0
|
|
313
|
+
file-loader ^5.0.2 → ^6.2.0
|
|
314
|
+
fork-ts-checker-webpack-plugin ^3.1.1 → ^6.0.7
|
|
315
|
+
html-webpack-plugin ^3.2.0 → ^4.5.0
|
|
316
|
+
inquirer ^7.0.3 → ^7.3.3
|
|
317
|
+
less ^3.10.3 → ^3.13.0
|
|
318
|
+
less-loader ^5.0.0 → ^7.1.0
|
|
319
|
+
lodash ^4.17.15 → ^4.17.20
|
|
320
|
+
mini-css-extract-plugin ^0.9.0 → ^1.3.3
|
|
321
|
+
mustache ^3.2.1 → ^4.1.0
|
|
322
|
+
ora ^4.0.3 → ^5.1.0
|
|
323
|
+
postcss-loader ^3.0.0 → ^4.1.0
|
|
324
|
+
react-dev-utils ^9.0.3 → ^11.0.1
|
|
325
|
+
sass-loader ^8.0.0 → ^10.1.0
|
|
326
|
+
shelljs ^0.8.3 → ^0.8.4
|
|
327
|
+
style-loader ^1.1.2 → ^2.0.0
|
|
328
|
+
ts-loader ^6.2.1 → ^8.0.12
|
|
329
|
+
tsconfig-paths-webpack-plugin ^3.2.0 → ^3.3.0
|
|
330
|
+
typescript ^3.7.4 → ^4.1.3
|
|
331
|
+
url-loader ^3.0.0 → ^4.1.1
|
|
332
|
+
urllib ^2.34.2 → ^2.36.1
|
|
333
|
+
vue-loader ^15.8.3 → ^15.9.5
|
|
334
|
+
vue-template-compiler ^2.6.11 → ^2.6.12
|
|
335
|
+
webpack ^4.41.5 → ^4.44.2
|
|
336
|
+
webpack-bundle-analyzer ^3.6.0 → ^4.2.0
|
|
337
|
+
webpack-cli ^3.3.10 → ^4.2.0
|
|
338
|
+
webpack-dev-server ^3.10.1 → ^3.11.0
|
|
339
|
+
webpack-merge ^4.2.2 → ^5.7.0
|
|
340
|
+
|
|
341
|
+
### Remove
|
|
342
|
+
|
|
343
|
+
| PackageName | Reason |
|
|
344
|
+
| ------------------------------ | ---------- |
|
|
345
|
+
| awesome-typescript-loader | Not Use |
|
|
346
|
+
| babel-plugin-import | Not Use |
|
|
347
|
+
| friendly-errors-webpack-plugin | Not Use |
|
|
348
|
+
| moment | deprecated |
|
|
349
|
+
| request | deprecated |
|
|
350
|
+
| request-progress | deprecated |
|
|
351
|
+
| request-promise | deprecated |
|
|
352
|
+
|
|
353
|
+
### Replace
|
|
354
|
+
|
|
355
|
+
| PackageName | Replace To |
|
|
356
|
+
| ---------------------------------- | ---------------------------- |
|
|
357
|
+
| optimize-css-assets-webpack-plugin | css-minimizer-webpack-plugin |
|
|
358
|
+
| node-sass | sass |
|
package/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
# ko
|
|
2
|
-
|
|
2
|
+
English | [简体中文](./README_CN.md)
|
|
3
3
|
## Simple, yet powerful, tool for managing your react applications.
|
|
4
4
|
|
|
5
5
|
<a href="https://www.npmjs.com/package/ko"><img alt="NPM Status" src="https://img.shields.io/npm/v/ko.svg?style=flat"></a>
|
|
@@ -23,13 +23,13 @@ pnpm add ko --save-dev
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## Documents
|
|
26
|
-
* [Introduction](https://dtstack.github.io/ko/docs/introduction)
|
|
27
|
-
* [Getting Started](https://dtstack.github.io/ko/docs/getting-started)
|
|
28
|
-
* [FAQ](https://dtstack.github.io/ko/docs/FAQ)
|
|
26
|
+
* [Introduction](https://dtstack.github.io/ko/zh-CN/docs/current/introduction)
|
|
27
|
+
* [Getting Started](https://dtstack.github.io/ko/zh-CN/docs/current/getting-started)
|
|
28
|
+
* [FAQ](https://dtstack.github.io/ko/zh-CN/docs/current/FAQ)
|
|
29
29
|
|
|
30
30
|
## Contributing
|
|
31
31
|
|
|
32
|
-
We'd love to have your helping hand on `ko`! See [CONTRIBUTING](
|
|
32
|
+
We'd love to have your helping hand on `ko`! See [CONTRIBUTING](../../CONTRIBUTING.md) for more information on how to get started.
|
|
33
33
|
|
|
34
34
|
## License
|
|
35
35
|
|
package/lib/actions/dev.js
CHANGED
|
@@ -7,12 +7,14 @@ const webpack_1 = __importDefault(require("webpack"));
|
|
|
7
7
|
const webpack_dev_server_1 = __importDefault(require("webpack-dev-server"));
|
|
8
8
|
const webpack_2 = __importDefault(require("../webpack"));
|
|
9
9
|
const factory_1 = __importDefault(require("./factory"));
|
|
10
|
+
const detect_port_1 = __importDefault(require("detect-port"));
|
|
11
|
+
const inquirer_1 = __importDefault(require("inquirer"));
|
|
10
12
|
class Dev extends factory_1.default {
|
|
11
13
|
constructor(service) {
|
|
12
14
|
super(service);
|
|
13
15
|
}
|
|
14
16
|
get devServerConfig() {
|
|
15
|
-
const { serve, publicPath
|
|
17
|
+
const { serve, publicPath } = this.service.config;
|
|
16
18
|
const { host, port, proxy, staticPath, historyApiFallback = false } = serve;
|
|
17
19
|
return {
|
|
18
20
|
port,
|
|
@@ -28,7 +30,6 @@ class Dev extends factory_1.default {
|
|
|
28
30
|
allowedHosts: 'all',
|
|
29
31
|
client: {
|
|
30
32
|
overlay: false,
|
|
31
|
-
logging: logLevel,
|
|
32
33
|
},
|
|
33
34
|
historyApiFallback,
|
|
34
35
|
};
|
|
@@ -85,13 +86,39 @@ class Dev extends factory_1.default {
|
|
|
85
86
|
});
|
|
86
87
|
this.service.commander.bindAction(cmdName, this.action.bind(this));
|
|
87
88
|
}
|
|
89
|
+
async changePort(newPort, port) {
|
|
90
|
+
const question = {
|
|
91
|
+
type: 'confirm',
|
|
92
|
+
name: 'changePort',
|
|
93
|
+
message: `port: ${port} has been used,use new port ${newPort} instead?`,
|
|
94
|
+
default: true,
|
|
95
|
+
};
|
|
96
|
+
const answer = await inquirer_1.default.prompt([question]);
|
|
97
|
+
if (answer.changePort) {
|
|
98
|
+
return newPort;
|
|
99
|
+
}
|
|
100
|
+
this.errorStdout(`so sorry, ${port} already in use!!`);
|
|
101
|
+
process.exit(0);
|
|
102
|
+
}
|
|
103
|
+
async checkPort(port) {
|
|
104
|
+
const newPort = await (0, detect_port_1.default)(port);
|
|
105
|
+
if (newPort === port) {
|
|
106
|
+
return newPort;
|
|
107
|
+
}
|
|
108
|
+
const isInteractive = process.stdout.isTTY;
|
|
109
|
+
if (isInteractive) {
|
|
110
|
+
return this.changePort(newPort, port);
|
|
111
|
+
}
|
|
112
|
+
}
|
|
88
113
|
async action(cliOpts) {
|
|
89
114
|
process.title = 'ko-dev';
|
|
90
115
|
process.env.NODE_ENV = 'development';
|
|
91
116
|
this.service.freezeCliOptsWith(cliOpts);
|
|
92
117
|
const config = await this.generateConfig();
|
|
118
|
+
const port = config.devServer?.port;
|
|
119
|
+
const newPort = (await this.checkPort(port));
|
|
93
120
|
const compiler = (0, webpack_1.default)(config);
|
|
94
|
-
const devServer = new webpack_dev_server_1.default(config.devServer, compiler);
|
|
121
|
+
const devServer = new webpack_dev_server_1.default({ ...config.devServer, port: newPort }, compiler);
|
|
95
122
|
await devServer.start();
|
|
96
123
|
const exitProcess = (callback) => () => {
|
|
97
124
|
callback && callback();
|
package/lib/cli.js
CHANGED
package/lib/core/config.js
CHANGED
package/lib/core/hooks.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
6
|
const tapable_1 = require("tapable");
|
|
4
7
|
const types_1 = require("../types");
|
|
8
|
+
const webpack_1 = __importDefault(require("webpack"));
|
|
5
9
|
class Hooks {
|
|
6
10
|
constructor() {
|
|
7
11
|
this.hookKeySet = types_1.HOOK_KEY_SET;
|
|
@@ -22,13 +26,13 @@ class Hooks {
|
|
|
22
26
|
const tapInstance = new tapable_1.AsyncSeriesWaterfallHook(['ctx']);
|
|
23
27
|
hooks[types_1.ACTION.ADD].forEach(hook => {
|
|
24
28
|
tapInstance.tapPromise({ name: hook.name, stage: hook.stage, before: hook.before }, async (ctx) => {
|
|
25
|
-
const result = await hook.fn(ctx);
|
|
29
|
+
const result = await hook.fn(ctx, webpack_1.default);
|
|
26
30
|
return ctx.concat(result);
|
|
27
31
|
});
|
|
28
32
|
});
|
|
29
33
|
hooks[types_1.ACTION.UPDATE].forEach(hook => {
|
|
30
34
|
tapInstance.tapPromise({ name: hook.name, stage: hook.stage, before: hook.before }, async (ctx) => {
|
|
31
|
-
const result = await hook.fn(ctx);
|
|
35
|
+
const result = await hook.fn(ctx, webpack_1.default);
|
|
32
36
|
return result;
|
|
33
37
|
});
|
|
34
38
|
});
|
package/lib/webpack/index.js
CHANGED
|
@@ -54,16 +54,6 @@ class WebpackConfig {
|
|
|
54
54
|
(0, utils_1.assert)((0, fs_1.existsSync)(pkgPath), 'project package.json file not found');
|
|
55
55
|
return require(pkgPath).version;
|
|
56
56
|
}
|
|
57
|
-
get stats() {
|
|
58
|
-
const mapping = {
|
|
59
|
-
info: 'normal',
|
|
60
|
-
error: 'errors-only',
|
|
61
|
-
warn: 'errors-warnings',
|
|
62
|
-
none: 'none',
|
|
63
|
-
};
|
|
64
|
-
const { logLevel } = this.opts;
|
|
65
|
-
return mapping[logLevel];
|
|
66
|
-
}
|
|
67
57
|
get base() {
|
|
68
58
|
const { cwd, publicPath, entry, outputPath, alias, hash, analyzer } = this.opts;
|
|
69
59
|
const webpackBaseConf = {
|
|
@@ -111,7 +101,7 @@ class WebpackConfig {
|
|
|
111
101
|
hints: false,
|
|
112
102
|
},
|
|
113
103
|
cache: this.cache,
|
|
114
|
-
stats:
|
|
104
|
+
stats: 'none',
|
|
115
105
|
infrastructureLogging: {
|
|
116
106
|
level: 'error',
|
|
117
107
|
},
|
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
-
const fs_1 = require("fs");
|
|
8
7
|
const mini_css_extract_plugin_1 = require("mini-css-extract-plugin");
|
|
9
8
|
const autoprefixer_1 = __importDefault(require("autoprefixer"));
|
|
10
9
|
const postCssUrl = require('postcss-url');
|
|
@@ -46,7 +45,6 @@ class Style {
|
|
|
46
45
|
enableCssModule && this.sassCssModuleConfig,
|
|
47
46
|
{
|
|
48
47
|
test: /\.less$/,
|
|
49
|
-
exclude: [this.realAntdV4Path],
|
|
50
48
|
use: [
|
|
51
49
|
this.styleLoader,
|
|
52
50
|
this.cssLoader,
|
|
@@ -54,16 +52,6 @@ class Style {
|
|
|
54
52
|
this.lessLoader,
|
|
55
53
|
],
|
|
56
54
|
},
|
|
57
|
-
{
|
|
58
|
-
test: /\.less$/,
|
|
59
|
-
include: [this.realAntdV4Path],
|
|
60
|
-
use: [
|
|
61
|
-
this.styleLoader,
|
|
62
|
-
this.cssLoader,
|
|
63
|
-
this.postCSSLoader,
|
|
64
|
-
this.antdV4LessLoader,
|
|
65
|
-
],
|
|
66
|
-
},
|
|
67
55
|
];
|
|
68
56
|
}
|
|
69
57
|
get sassCssModuleConfig() {
|
|
@@ -88,12 +76,6 @@ class Style {
|
|
|
88
76
|
],
|
|
89
77
|
};
|
|
90
78
|
}
|
|
91
|
-
//TODO: remove when upgrade to antd v4
|
|
92
|
-
get realAntdV4Path() {
|
|
93
|
-
const antdV4Path = (0, path_1.join)(this.opts.cwd, 'node_modules/antd-v4');
|
|
94
|
-
const ret = (0, fs_1.existsSync)(antdV4Path) ? (0, fs_1.realpathSync)(antdV4Path) : antdV4Path;
|
|
95
|
-
return ret;
|
|
96
|
-
}
|
|
97
79
|
get styleLoader() {
|
|
98
80
|
return {
|
|
99
81
|
loader: this.opts.isProd ? mini_css_extract_plugin_1.loader : this.STYLE_LOADER,
|
|
@@ -125,16 +107,6 @@ class Style {
|
|
|
125
107
|
},
|
|
126
108
|
};
|
|
127
109
|
}
|
|
128
|
-
get antdV4LessLoader() {
|
|
129
|
-
const { antdV4LessOptions = {} } = this.opts;
|
|
130
|
-
return {
|
|
131
|
-
loader: this.LESS_LOADER,
|
|
132
|
-
options: {
|
|
133
|
-
sourceMap: true,
|
|
134
|
-
lessOptions: antdV4LessOptions,
|
|
135
|
-
},
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
110
|
get postCSSLoader() {
|
|
139
111
|
return {
|
|
140
112
|
loader: this.POSTCSS_LOADER,
|
package/lib/webpack/plugins.js
CHANGED
|
@@ -13,8 +13,10 @@ const copy_webpack_plugin_1 = __importDefault(require("copy-webpack-plugin"));
|
|
|
13
13
|
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
14
14
|
const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
|
|
15
15
|
const auto_polyfills_webpack_plugin_1 = __importDefault(require("auto-polyfills-webpack-plugin"));
|
|
16
|
+
const friendly_errors_webpack_plugin_1 = __importDefault(require("@nuxt/friendly-errors-webpack-plugin"));
|
|
17
|
+
const error_overlay_webpack_plugin_1 = __importDefault(require("error-overlay-webpack-plugin"));
|
|
16
18
|
function getPlugins(opts) {
|
|
17
|
-
const { isProd, htmlTemplate, copy, analyzer, autoPolyfills } = opts;
|
|
19
|
+
const { isProd, htmlTemplate, copy, analyzer, autoPolyfills, serve: { host, port, compilationSuccessInfo }, } = opts;
|
|
18
20
|
return [
|
|
19
21
|
new webpack_1.IgnorePlugin({
|
|
20
22
|
resourceRegExp: /^\.\/locale$/,
|
|
@@ -79,6 +81,14 @@ function getPlugins(opts) {
|
|
|
79
81
|
overlay: false,
|
|
80
82
|
}),
|
|
81
83
|
analyzer && new webpack_bundle_analyzer_1.BundleAnalyzerPlugin(),
|
|
84
|
+
!isProd &&
|
|
85
|
+
new friendly_errors_webpack_plugin_1.default({
|
|
86
|
+
compilationSuccessInfo: compilationSuccessInfo ?? {
|
|
87
|
+
messages: [`Your application is running at http://${host}:${port}`],
|
|
88
|
+
notes: [],
|
|
89
|
+
},
|
|
90
|
+
}),
|
|
91
|
+
!isProd && new error_overlay_webpack_plugin_1.default(),
|
|
82
92
|
isProd &&
|
|
83
93
|
autoPolyfills &&
|
|
84
94
|
(typeof autoPolyfills === 'boolean'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ko",
|
|
3
|
-
"version": "6.5.
|
|
3
|
+
"version": "6.5.3-beta.0",
|
|
4
4
|
"description": "build & lint library",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ko",
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
"bugs": {
|
|
21
21
|
"url": "https://github.com/DTStack/ko/issues"
|
|
22
22
|
},
|
|
23
|
+
"typings": "index.d.ts",
|
|
23
24
|
"repository": {
|
|
24
25
|
"type": "git",
|
|
25
26
|
"url": "https://github.com/DTStack/ko",
|
|
@@ -33,15 +34,22 @@
|
|
|
33
34
|
"files": [
|
|
34
35
|
"lib/*"
|
|
35
36
|
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"prepublishOnly": "rm -rf lib && tsc",
|
|
39
|
+
"debug": "tsc -w --sourceMap",
|
|
40
|
+
"test": "jest",
|
|
41
|
+
"build": "tsc"
|
|
42
|
+
},
|
|
36
43
|
"dependencies": {
|
|
37
44
|
"@babel/core": "^7.18.0",
|
|
45
|
+
"@nuxt/friendly-errors-webpack-plugin": "^2.5.2",
|
|
38
46
|
"@parcel/css": "^1.12.2",
|
|
39
47
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.7",
|
|
40
|
-
"auto-polyfills-webpack-plugin": "
|
|
48
|
+
"auto-polyfills-webpack-plugin": "workspace:^1.1.0",
|
|
41
49
|
"autoprefixer": "^10.4.7",
|
|
42
50
|
"babel-loader": "^8.2.5",
|
|
43
51
|
"babel-plugin-treasure": "^0.9.0",
|
|
44
|
-
"babel-preset-ko-app": "
|
|
52
|
+
"babel-preset-ko-app": "workspace:^1.0.0",
|
|
45
53
|
"buffer": "^6.0.3",
|
|
46
54
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
47
55
|
"chalk": "^4.1.2",
|
|
@@ -51,10 +59,13 @@
|
|
|
51
59
|
"crypto-browserify": "^3.12.0",
|
|
52
60
|
"css-loader": "^6.7.1",
|
|
53
61
|
"css-minimizer-webpack-plugin": "^4.0.0",
|
|
54
|
-
"
|
|
62
|
+
"detect-port": "^1.3.0",
|
|
63
|
+
"dynamic-resolve-webpack-plugin": "workspace:^2.0.0",
|
|
64
|
+
"error-overlay-webpack-plugin": "^1.1.1",
|
|
55
65
|
"esbuild-loader": "^2.19.0",
|
|
56
66
|
"html-webpack-plugin": "^5.5.0",
|
|
57
|
-
"
|
|
67
|
+
"inquirer": "^8.2.2",
|
|
68
|
+
"ko-lints": "workspace:^4.0.0",
|
|
58
69
|
"less": "^3.13.1",
|
|
59
70
|
"less-loader": "^9.1.0",
|
|
60
71
|
"lodash": "^4.17.21",
|
|
@@ -80,6 +91,8 @@
|
|
|
80
91
|
},
|
|
81
92
|
"devDependencies": {
|
|
82
93
|
"@types/case-sensitive-paths-webpack-plugin": "^2.1.6",
|
|
94
|
+
"@types/detect-port": "^1.3.2",
|
|
95
|
+
"@types/inquirer": "^8.2.2",
|
|
83
96
|
"@types/jest": "^27.5.1",
|
|
84
97
|
"@types/lodash": "^4.14.182",
|
|
85
98
|
"@types/webpack-bundle-analyzer": "^4.4.1",
|
|
@@ -89,11 +102,5 @@
|
|
|
89
102
|
},
|
|
90
103
|
"engines": {
|
|
91
104
|
"node": ">=14"
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
"debug": "tsc -w --sourceMap",
|
|
95
|
-
"test": "jest",
|
|
96
|
-
"build": "tsc"
|
|
97
|
-
},
|
|
98
|
-
"readme": "# ko\n\n## Simple, yet powerful, tool for managing your react applications. \n\n<a href=\"https://www.npmjs.com/package/ko\"><img alt=\"NPM Status\" src=\"https://img.shields.io/npm/v/ko.svg?style=flat\"></a>\n\n## Features\n\n* Support building applications on top of **webpack v5** and **esbuild**\n* Customize ko to work exactly the way you need it for your applications \n* Built-in popular linting tools to lint your source code\n* Built-in support typescript\n\n## Installation\n\nYou can install ko using npm, yarn or pnpm:\n``` bash\nnpm install ko --save-dev\n# or\nyarn add ko --dev\n# or \npnpm add ko --save-dev\n```\n\n## Documents\n* [Introduction](https://dtstack.github.io/ko/docs/introduction)\n* [Getting Started](https://dtstack.github.io/ko/docs/getting-started)\n* [FAQ](https://dtstack.github.io/ko/docs/FAQ)\n\n## Contributing\n\nWe'd love to have your helping hand on `ko`! See [CONTRIBUTING](https://dtstack.github.io/ko/docs/contributing/) for more information on how to get started.\n\n## License\n\nCopyright © DTStack. All rights reserved.\n\nLicensed under the MIT license.\n"
|
|
99
|
-
}
|
|
105
|
+
}
|
|
106
|
+
}
|