mirror of
https://gitee.com/baidu/amis.git
synced 2024-11-29 18:48:45 +08:00
chore: 修复 ts 升级的兼容性问题 (#2486)
This commit is contained in:
parent
7064803174
commit
094a15cffc
@ -180,13 +180,17 @@ fis.match('{*.ts,*.jsx,*.tsx,/src/**.js,/src/**.ts}', {
|
||||
}),
|
||||
|
||||
function (content) {
|
||||
return content
|
||||
return (
|
||||
content
|
||||
// ts 4.4 生成的代码是 (0, tslib_1.__importStar),直接改成 tslib_1.__importStar
|
||||
.replace(/\(\d+, (tslib_\d+\.__importStar)\)/g, '$1')
|
||||
.replace(/\b[a-zA-Z_0-9$]+\.__uri\s*\(/g, '__uri(')
|
||||
.replace(
|
||||
/(return|=>)\s*(tslib_\d+)\.__importStar\(require\(('|")(.*?)\3\)\)/g,
|
||||
function (_, r, tslib, quto, value) {
|
||||
return `${r} new Promise(function(resolve){require(['${value}'], function(ret) {resolve(${tslib}.__importStar(ret));})})`;
|
||||
}
|
||||
)
|
||||
);
|
||||
}
|
||||
],
|
||||
@ -331,6 +335,7 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
);
|
||||
}
|
||||
)
|
||||
.replace(/\(\d+, (tslib_\d+\.__importStar)\)/g, '$1')
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
@ -443,6 +448,7 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
function (content) {
|
||||
return content
|
||||
.replace(/\b[a-zA-Z_0-9$]+\.__uri\s*\(/g, '__uri(')
|
||||
.replace(/\(\d+, (tslib_\d+\.__importStar)\)/g, '$1')
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
@ -932,6 +938,7 @@ if (fis.project.currentMedia() === 'publish') {
|
||||
);
|
||||
}
|
||||
)
|
||||
.replace(/\(\d+, (tslib_\d+\.__importStar)\)/g, '$1')
|
||||
.replace(
|
||||
/return\s+(tslib_\d+)\.__importStar\(require\(('|")(.*?)\2\)\);/g,
|
||||
function (_, tslib, quto, value) {
|
||||
|
@ -138,7 +138,7 @@
|
||||
"fis3-hook-node_modules": "^2.3.1",
|
||||
"fis3-hook-relative": "^2.0.3",
|
||||
"fis3-packager-deps-pack": "^0.1.2",
|
||||
"fis3-parser-typescript": "1.3.2",
|
||||
"fis3-parser-typescript": "^1.4.0",
|
||||
"fis3-postpackager-loader": "^2.1.12",
|
||||
"fis3-prepackager-stand-alone-pack": "^1.0.0",
|
||||
"fis3-preprocessor-js-require-css": "^0.1.3",
|
||||
@ -166,7 +166,7 @@
|
||||
"ts-jest": "^27.0.5",
|
||||
"ts-json-schema-generator": "^0.95.0",
|
||||
"ts-node": "^10.2.1",
|
||||
"typescript": "~4.1.2"
|
||||
"typescript": "~4.4.2"
|
||||
},
|
||||
"jest": {
|
||||
"testEnvironment": "jsdom",
|
||||
|
Loading…
Reference in New Issue
Block a user