@qse/edu-scripts 1.14.1 → 1.14.3
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 +13 -0
- package/app.d.ts +0 -5
- package/docs/faq.md +45 -0
- package/lib/config/babel.js +3 -3
- package/lib/config/plugins/mock-server/defineMock.d.ts +6 -0
- package/lib/config/webpackConfig.js +1 -1
- package/lib/index.d.ts +2 -0
- package/lib/utils/defineConfig.d.ts +0 -1
- package/package.json +12 -12
- package/src/config/babel.js +3 -3
- package/src/config/webpackConfig.js +1 -1
- package/src/utils/defineConfig.ts +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,18 @@
|
|
|
1
1
|
# 更新日志
|
|
2
2
|
|
|
3
|
+
## 1.14.3 (2024-01-03)
|
|
4
|
+
|
|
5
|
+
- fix: 修复 app.d.ts html 文件类型错误
|
|
6
|
+
- feat: override transformNodeModules 默认 true,并且 production 模式下也可生效
|
|
7
|
+
|
|
8
|
+
## 1.14.2 (2023-10-11)
|
|
9
|
+
|
|
10
|
+
- fix: 修复声明文件缺失
|
|
11
|
+
|
|
12
|
+
## 1.14.1 (2023-10-11)
|
|
13
|
+
|
|
14
|
+
- fix: esbuild 压缩 target 改成 es5
|
|
15
|
+
|
|
3
16
|
## 1.14.0 (2023-10-11)
|
|
4
17
|
|
|
5
18
|
- fix: 修改 browserslist 条件范围,保证包括 IE11,iOS>=9, Chrome>=49
|
package/app.d.ts
CHANGED
package/docs/faq.md
CHANGED
|
@@ -97,3 +97,48 @@ export default (callback) => {
|
|
|
97
97
|
<!-- 引入 @qsb/antd -->
|
|
98
98
|
<script src="//www.zhidianbao.cn:8088/qsxxwapdev/edu-scripts/qsb-antd.min.js"></script>
|
|
99
99
|
```
|
|
100
|
+
|
|
101
|
+
## 钉钉遇到页面打开白屏
|
|
102
|
+
|
|
103
|
+
这种情况多半是链接中带了 hash,导致页面跳转失败。(复制出来可能是新的链接,但页面其实是老的并未跳转)
|
|
104
|
+
|
|
105
|
+
将下面两段代码分别加入对应的文件中,必须保证其位置在所有 `script` 最前面
|
|
106
|
+
|
|
107
|
+
原理: 将 hash 转存至 localStorage,跳转后再取出
|
|
108
|
+
|
|
109
|
+
```html
|
|
110
|
+
<!-- index.html -->
|
|
111
|
+
<script>
|
|
112
|
+
;(function () {
|
|
113
|
+
var searchString = location.search
|
|
114
|
+
if (!/(\?|&)S=/.test(searchString)) {
|
|
115
|
+
var randomHexString = Math.random().toString(32).substring(2)
|
|
116
|
+
searchString = searchString.substring(1)
|
|
117
|
+
searchString = '?S=' + randomHexString + (searchString.length > 0 ? '&' + searchString : '')
|
|
118
|
+
}
|
|
119
|
+
if (location.hash) {
|
|
120
|
+
localStorage.setItem('qse:H', location.hash)
|
|
121
|
+
}
|
|
122
|
+
var pathnameArr = location.pathname.split('/')
|
|
123
|
+
var pathname = pathnameArr.slice(0, -1).concat('index1.html').join('/')
|
|
124
|
+
var __tmp_URL = location.origin + pathname + searchString
|
|
125
|
+
history.replaceState(null, document.title, __tmp_URL)
|
|
126
|
+
location.reload()
|
|
127
|
+
})()
|
|
128
|
+
</script>
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<!-- index1.html -->
|
|
133
|
+
<script>
|
|
134
|
+
;(function () {
|
|
135
|
+
var hash = localStorage.getItem('qse:H')
|
|
136
|
+
if (hash) {
|
|
137
|
+
localStorage.removeItem('qse:H')
|
|
138
|
+
hash = /^#/.test(hash) ? hash : '#' + hash
|
|
139
|
+
var url = location.origin + location.pathname + location.search + hash
|
|
140
|
+
history.replaceState(history.state, null, url)
|
|
141
|
+
}
|
|
142
|
+
})()
|
|
143
|
+
</script>
|
|
144
|
+
```
|
package/lib/config/babel.js
CHANGED
|
@@ -82,9 +82,9 @@ module.exports = function getBabelConfig(opts = {}) {
|
|
|
82
82
|
}
|
|
83
83
|
],
|
|
84
84
|
["@babel/plugin-proposal-decorators", { legacy: true }],
|
|
85
|
-
["@babel/plugin-
|
|
86
|
-
["@babel/plugin-
|
|
87
|
-
["@babel/plugin-
|
|
85
|
+
["@babel/plugin-transform-class-properties", { loose: true }],
|
|
86
|
+
["@babel/plugin-transform-private-methods", { loose: true }],
|
|
87
|
+
["@babel/plugin-transform-private-property-in-object", { loose: true }],
|
|
88
88
|
[
|
|
89
89
|
"import",
|
|
90
90
|
{ libraryName: "lodash", libraryDirectory: "", camel2DashComponentName: false },
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { RequestHandler } from 'express';
|
|
2
|
+
type Method = 'GET' | 'POST' | 'PUT' | 'DELETE' | 'PATCH' | 'HEAD' | 'OPTIONS' | 'CONNECT' | 'TRACE';
|
|
3
|
+
type API = string;
|
|
4
|
+
export type MockConfig = Record<`${Method} ${API}`, string | number | null | undefined | boolean | Record<string, any> | RequestHandler>;
|
|
5
|
+
export declare function defineMock(config: MockConfig): MockConfig;
|
|
6
|
+
export {};
|
|
@@ -187,7 +187,7 @@ module.exports = function getWebpackConfig(args, override) {
|
|
|
187
187
|
exclude: /node_modules/,
|
|
188
188
|
options: require("./babel")()
|
|
189
189
|
},
|
|
190
|
-
|
|
190
|
+
override.transformNodeModules && {
|
|
191
191
|
test: /\.m?js$/,
|
|
192
192
|
loader: "babel-loader",
|
|
193
193
|
exclude: /@babel(?:\/|\\{1,2})runtime/,
|
package/lib/index.d.ts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@qse/edu-scripts",
|
|
3
|
-
"version": "1.14.
|
|
3
|
+
"version": "1.14.3",
|
|
4
4
|
"author": "Kinoko",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"description": "教育工程化基础框架",
|
|
@@ -34,19 +34,19 @@
|
|
|
34
34
|
"extends": "qsb-react"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@babel/core": "~7.
|
|
38
|
-
"@babel/plugin-proposal-decorators": "~7.
|
|
39
|
-
"@babel/plugin-transform-runtime": "~7.
|
|
40
|
-
"@babel/preset-env": "~7.
|
|
41
|
-
"@babel/preset-react": "~7.
|
|
42
|
-
"@babel/preset-typescript": "~7.
|
|
43
|
-
"@babel/register": "~7.
|
|
44
|
-
"@babel/runtime": "~7.
|
|
37
|
+
"@babel/core": "~7.23.2",
|
|
38
|
+
"@babel/plugin-proposal-decorators": "~7.23.2",
|
|
39
|
+
"@babel/plugin-transform-runtime": "~7.23.2",
|
|
40
|
+
"@babel/preset-env": "~7.23.2",
|
|
41
|
+
"@babel/preset-react": "~7.22.15",
|
|
42
|
+
"@babel/preset-typescript": "~7.23.2",
|
|
43
|
+
"@babel/register": "~7.22.15",
|
|
44
|
+
"@babel/runtime": "~7.23.2",
|
|
45
45
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.10",
|
|
46
46
|
"@qse/ssh-sftp": "^1.0.0",
|
|
47
47
|
"@svgr/webpack": "^8.0.1",
|
|
48
|
-
"babel-loader": "^
|
|
49
|
-
"babel-plugin-import": "^1.13.
|
|
48
|
+
"babel-loader": "^9.1.3",
|
|
49
|
+
"babel-plugin-import": "^1.13.8",
|
|
50
50
|
"case-sensitive-paths-webpack-plugin": "^2.4.0",
|
|
51
51
|
"chalk": "^4.1.2",
|
|
52
52
|
"chokidar": "^3.5.3",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"@types/yargs": "^17.0.24",
|
|
100
100
|
"dumi": "^1.1.50",
|
|
101
101
|
"eslint-config-qsb-react": "^1.1.1",
|
|
102
|
-
"father": "^4.3.
|
|
102
|
+
"father": "^4.3.5",
|
|
103
103
|
"jest": "^28.1.3"
|
|
104
104
|
}
|
|
105
105
|
}
|
package/src/config/babel.js
CHANGED
|
@@ -67,9 +67,9 @@ module.exports = function getBabelConfig(opts = {}) {
|
|
|
67
67
|
},
|
|
68
68
|
],
|
|
69
69
|
['@babel/plugin-proposal-decorators', { legacy: true }],
|
|
70
|
-
['@babel/plugin-
|
|
71
|
-
['@babel/plugin-
|
|
72
|
-
['@babel/plugin-
|
|
70
|
+
['@babel/plugin-transform-class-properties', { loose: true }],
|
|
71
|
+
['@babel/plugin-transform-private-methods', { loose: true }],
|
|
72
|
+
['@babel/plugin-transform-private-property-in-object', { loose: true }],
|
|
73
73
|
[
|
|
74
74
|
'import',
|
|
75
75
|
{ libraryName: 'lodash', libraryDirectory: '', camel2DashComponentName: false },
|
|
@@ -210,7 +210,7 @@ module.exports = function getWebpackConfig(args, override) {
|
|
|
210
210
|
exclude: /node_modules/,
|
|
211
211
|
options: require('./babel')(),
|
|
212
212
|
},
|
|
213
|
-
|
|
213
|
+
override.transformNodeModules && {
|
|
214
214
|
test: /\.m?js$/,
|
|
215
215
|
loader: 'babel-loader',
|
|
216
216
|
exclude: /@babel(?:\/|\\{1,2})runtime/,
|