@s-ui/bundler 9.39.0-typescript.112 → 9.39.0-typescript.116
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/package.json +1 -1
- package/scripts/postinstall.js +2 -2
- package/shared/module-rules-babel.js +2 -37
- package/shared/resolve-alias.js +17 -6
- package/tsconfig.json +1 -1
package/package.json
CHANGED
package/scripts/postinstall.js
CHANGED
|
@@ -11,9 +11,9 @@ const tsConfigTemplate = `\
|
|
|
11
11
|
{
|
|
12
12
|
"extends": "@s-ui/bundler/tsconfig.json",
|
|
13
13
|
"compilerOptions": {
|
|
14
|
-
"rootDir": "./
|
|
14
|
+
"rootDir": "./"
|
|
15
15
|
},
|
|
16
|
-
"include": ["
|
|
16
|
+
"include": ["src", "domain", "components"]
|
|
17
17
|
}`
|
|
18
18
|
|
|
19
19
|
const md5 = str => crypto.createHash('md5').update(str).digest('hex')
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
const fs = require('fs-extra')
|
|
3
3
|
const path = require('path')
|
|
4
4
|
const {config} = require('./index.js')
|
|
5
|
+
const {getSWCConfig} = require('@s-ui/typescript-config')
|
|
5
6
|
|
|
6
7
|
const EXCLUDED_FOLDERS_REGEXP = new RegExp(
|
|
7
8
|
`node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)`
|
|
@@ -35,43 +36,7 @@ module.exports = ({isServer = false, supportLegacyBrowsers = true} = {}) => {
|
|
|
35
36
|
use: [
|
|
36
37
|
{
|
|
37
38
|
loader: require.resolve('swc-loader'),
|
|
38
|
-
options: {
|
|
39
|
-
minify: true,
|
|
40
|
-
jsc: {
|
|
41
|
-
parser: {
|
|
42
|
-
syntax: 'typescript',
|
|
43
|
-
tsx: true,
|
|
44
|
-
dynamicImport: true,
|
|
45
|
-
privateMethod: true,
|
|
46
|
-
functionBind: true,
|
|
47
|
-
exportDefaultFrom: true,
|
|
48
|
-
exportNamespaceFrom: true,
|
|
49
|
-
decorators: true,
|
|
50
|
-
decoratorsBeforeExport: true,
|
|
51
|
-
topLevelAwait: true,
|
|
52
|
-
importMeta: true
|
|
53
|
-
},
|
|
54
|
-
transform: {
|
|
55
|
-
legacyDecorator: true,
|
|
56
|
-
react: {
|
|
57
|
-
useBuiltins: true,
|
|
58
|
-
runtime: 'automatic'
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
target: 'es5',
|
|
62
|
-
loose: true,
|
|
63
|
-
externalHelpers: true
|
|
64
|
-
},
|
|
65
|
-
env: {
|
|
66
|
-
targets: {
|
|
67
|
-
ie: '11'
|
|
68
|
-
},
|
|
69
|
-
dynamicImport: true,
|
|
70
|
-
loose: true,
|
|
71
|
-
mode: 'entry',
|
|
72
|
-
coreJs: 3
|
|
73
|
-
}
|
|
74
|
-
}
|
|
39
|
+
options: getSWCConfig({isModern: false, isTypeScript: true})
|
|
75
40
|
}
|
|
76
41
|
]
|
|
77
42
|
}
|
package/shared/resolve-alias.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const {config} = require('./config.js')
|
|
3
|
+
const fs = require('fs')
|
|
3
4
|
|
|
4
5
|
const {PWD} = process.env
|
|
5
6
|
|
|
@@ -13,21 +14,31 @@ const defaultPackagesToAlias = [
|
|
|
13
14
|
'react',
|
|
14
15
|
'react-dom',
|
|
15
16
|
'react-router-dom',
|
|
17
|
+
'react/jsx-dev-runtime',
|
|
18
|
+
'react/jsx-runtime',
|
|
16
19
|
'@s-ui/pde',
|
|
17
20
|
'@s-ui/react-context',
|
|
18
21
|
'@s-ui/react-router'
|
|
19
22
|
]
|
|
20
23
|
|
|
21
|
-
const createAliasPath = pkgName =>
|
|
22
|
-
path.
|
|
24
|
+
const createAliasPath = pkgName => {
|
|
25
|
+
const PWDNodeModules = path.join(PWD, './node_modules')
|
|
26
|
+
if (fs.existsSync(PWDNodeModules))
|
|
27
|
+
return path.resolve(path.join(PWDNodeModules, pkgName))
|
|
23
28
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
29
|
+
try {
|
|
30
|
+
return require.resolve(pkgName).replace(/\/index\.js$/, '')
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return ''
|
|
33
|
+
}
|
|
27
34
|
}
|
|
28
35
|
|
|
36
|
+
const mustPackagesToAlias = {}
|
|
37
|
+
|
|
29
38
|
exports.defaultAlias = Object.fromEntries(
|
|
30
|
-
defaultPackagesToAlias
|
|
39
|
+
defaultPackagesToAlias
|
|
40
|
+
.map(pkgName => [pkgName, createAliasPath(pkgName)])
|
|
41
|
+
.filter(([, path]) => path)
|
|
31
42
|
)
|
|
32
43
|
|
|
33
44
|
const aliasFromConfig = config.alias
|
package/tsconfig.json
CHANGED