kn-cli 1.0.135 → 1.0.137

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.
@@ -45,7 +45,8 @@
45
45
  "webpack-cli": "~3.3.11",
46
46
  "webpack-dev-server": "~3.10.3",
47
47
  "@pmmmwh/react-refresh-webpack-plugin": "~0.4.3",
48
- "react-refresh": "~0.9.0"
48
+ "react-refresh": "~0.9.0",
49
+ "hard-source-webpack-plugin": "~0.13.1"
49
50
  },
50
51
  "overrides": {
51
52
  "@jridgewell/gen-mapping": "0.3.5"
@@ -12,6 +12,7 @@ const CopyPlugin = require('copy-webpack-plugin');
12
12
  const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
13
13
  const NowDateTime = Date.now();
14
14
 
15
+
15
16
  //////////// CONFIG ENV ///////////////
16
17
  const API_CONFIG = require('./webpack.api.js');
17
18
  let CLI_CONFIG = {};
@@ -132,7 +133,8 @@ if(!hashMode){
132
133
 
133
134
  /////////////// RULES ////////////////
134
135
  const BABEL_PLUGINS=[
135
- ['@babel/plugin-transform-runtime', { corejs: 3 }],
136
+ ['@babel/plugin-transform-runtime', { corejs: 3}],
137
+ '@babel/plugin-transform-class-properties'
136
138
  ]
137
139
  const BABEL_PLUGINS_777=[
138
140
  ['@babel/plugin-transform-runtime', { corejs: 3 }],
@@ -148,6 +150,7 @@ const LOADER_JS=[
148
150
  {
149
151
  loader: 'babel-loader',
150
152
  options: {
153
+ // cacheDirectory: true, // 👈 必须开启!默认是 false
151
154
  presets: [
152
155
  '@babel/preset-react',
153
156
  [
@@ -396,6 +399,7 @@ if(devMode){
396
399
  overlay:false//关闭全局的错误提示
397
400
  }) ) // 添加 React Refresh 插件
398
401
  }
402
+
399
403
  plugins.push(new webpack.SourceMapDevToolPlugin({
400
404
  filename: 'sourcemap/[file].map',
401
405
  // filename: false, // 避免生成额外的 .map 文件,提高构建速度
@@ -476,6 +480,17 @@ if(cssSplitMode){
476
480
  )
477
481
  }
478
482
 
483
+ if(CLI_CONFIG?.hardSourceWebpackPlugin){
484
+ var HardSourceWebpackPlugin = require('hard-source-webpack-plugin');
485
+ const cacheDir = path.resolve(dirname, '.webpack_cache/[confighash]')
486
+ warn(`hardSourceWebpackPlugin cacheDir:${cacheDir}`);
487
+ plugins.push(
488
+ new HardSourceWebpackPlugin({
489
+ cacheDirectory: cacheDir,
490
+ })
491
+ )
492
+ }
493
+
479
494
  //////////////// PLUGINS-END //////////////////
480
495
 
481
496
  ///////////// SPA-RENDER ///////////////
@@ -543,7 +558,7 @@ const config={
543
558
  optimization: optimization,
544
559
  plugins: plugins,
545
560
  // watchOptions: {
546
- // aggregateTimeout: 5000, // 文件变化后延迟 300 毫秒再重新构建
561
+ // // aggregateTimeout: 5000, // 文件变化后延迟 300 毫秒再重新构建
547
562
  // ignored: /node_modules/ // 忽略 node_modules 目录
548
563
  // }
549
564
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.135",
3
+ "version": "1.0.137",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/src/build.js CHANGED
@@ -54,7 +54,7 @@ module.exports= async (options={})=> {
54
54
  // 构建模板
55
55
  const tempWebpackDir = path.resolve(tempProjectDir,"_webpack");
56
56
  const tempWebpackPackagePath = path.resolve(tempWebpackDir,'package.json');
57
- const tempWebpackBabelPackagePath = path.resolve(tempWebpackDir,'babel.package.json');
57
+ const tempWebpackBabelPackagePath = path.resolve(tempWebpackDir,cliConfig?.babelConfigName??'babel.package.json');
58
58
 
59
59
  const tempVitePackagePath = path.resolve(tempWebpackDir,'vite.package.json');
60
60
  const tempWebpackConfigPath = path.resolve(tempWebpackDir,'webpack.config.js');
@@ -6,6 +6,7 @@ import RouteList from './route';
6
6
  import { ReactRender } from './components/react';
7
7
  import {DEBUG_VCONSOLE} from '@/config';
8
8
  import moment from '@/utils/moment';
9
+ import { runAutoCheckVersion } from '@/utils/version';
9
10
  moment;
10
11
 
11
12
  let _error=window.console.error;
@@ -68,6 +69,10 @@ window.appLog(`${location.href}`);
68
69
  window.appLog(`ua:${navigator.userAgent}`);
69
70
  /* eslint-enable */
70
71
 
72
+ // @ts-ignore
73
+ if(BUILD_ENV != 'prod'){
74
+ runAutoCheckVersion();
75
+ }
71
76
 
72
77
  ReactRender(<RouteList />, document.getElementById('main-view'));
73
78
 
@@ -10,6 +10,7 @@ import ProviderApp from '@/provider/app';
10
10
 
11
11
  import MenuConfig from '@/menuConfig';
12
12
  import { AUTH_ROUTE_DEBUG_OPEN } from '@/config';
13
+ import { runAutoCheckVersion } from '@/utils/version';
13
14
 
14
15
 
15
16
  /**
@@ -142,6 +143,10 @@ const useProvider=() =>{
142
143
  getLeftMenu(app.auths);
143
144
  },[routeMenu.source,curLocation,app.auths])
144
145
 
146
+ useEffect(()=>{
147
+ runAutoCheckVersion();
148
+ },[curLocation])
149
+
145
150
  return {leftMenu,topMenu,reload,selectMenus,findMenuData,setMenuConfig,getMenuNavigateTo,findHasAuthMenu}
146
151
  }
147
152
 
@@ -0,0 +1,3 @@
1
+ {
2
+ "version": "1.0.0"
3
+ }
@@ -1,47 +0,0 @@
1
-
2
- // @ts-ignore
3
- import { useState } from 'react'
4
-
5
- // @ts-ignore
6
- import { createContainer } from "unstated-next"
7
-
8
- const useProviderLoading=() =>{
9
-
10
- const [count,setCount]= useState(0);
11
-
12
- const open=()=>{
13
- setCount(v=>v+1)
14
- }
15
- const close=()=>{
16
- setCount(v=>v-1)
17
- }
18
-
19
- return {
20
- loading:count>0,
21
- open,
22
- close,
23
- count
24
- }
25
- }
26
-
27
- /**
28
- * @typedef LoadingProviderContaniner
29
- * @property {()=>void} open - 打开Loading
30
- * @property {()=>void} close - 关闭Loading
31
- * @property {boolean} loading - 当前loading状态
32
- * @property {number} count - 当前loading计数器
33
- */
34
-
35
-
36
- /**
37
- * @typedef {object} LoadingProvider
38
- * @property {function():LoadingProviderContaniner} useContainer
39
- * @property {React.ComponentType<any>} Provider
40
- */
41
-
42
-
43
- /**
44
- * @type {LoadingProvider}
45
- */
46
- const App = createContainer(useProviderLoading);
47
- export default App;
@@ -1,35 +0,0 @@
1
-
2
-
3
-
4
- .iconGroup{
5
- width: 17px;
6
- height: 100%;
7
- margin-right: 12px;
8
- display: inline-flex;
9
- align-items: center;
10
-
11
- img{width: 100%;}
12
- .icon{
13
- display: inline-block;
14
- }
15
- .iconActive{
16
- display: none;
17
- }
18
- }
19
-
20
- :global(.ant-menu-title-content){
21
- font-size: 14px;
22
- }
23
- :global(.ant-menu-item-selected),
24
- :global(.ant-menu-item-active){
25
- .iconGroup .iconActive{
26
- display: inline-block;
27
- }
28
- .iconGroup .icon{
29
- display: none;
30
- }
31
- :global(.ant-menu-title-content){
32
- font-weight: bold;
33
- }
34
-
35
- }