@s-ui/bundler 9.38.0 → 9.39.0-typescript.1
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/.swcrc +78 -0
- package/bin/sui-bundler-dev.js +1 -6
- package/loaders/linkLoaderConfigBuilder.js +1 -1
- package/package.json +4 -1
- package/shared/index.js +1 -1
- package/shared/module-rules-babel.js +84 -22
- package/webpack.config.dev.js +1 -1
package/.swcrc
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"test": ".tsx?$",
|
|
4
|
+
"minify": true,
|
|
5
|
+
"jsc": {
|
|
6
|
+
"parser": {
|
|
7
|
+
"syntax": "typescript",
|
|
8
|
+
"tsx": true,
|
|
9
|
+
"dynamicImport": true,
|
|
10
|
+
"privateMethod": true,
|
|
11
|
+
"functionBind": true,
|
|
12
|
+
"exportDefaultFrom": true,
|
|
13
|
+
"exportNamespaceFrom": true,
|
|
14
|
+
"decorators": true,
|
|
15
|
+
"decoratorsBeforeExport": true,
|
|
16
|
+
"topLevelAwait": true,
|
|
17
|
+
"importMeta": true
|
|
18
|
+
},
|
|
19
|
+
"transform": {
|
|
20
|
+
"legacyDecorator": true,
|
|
21
|
+
"react": {
|
|
22
|
+
"useBuiltins": true,
|
|
23
|
+
"runtime": "automatic"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"target": "es5",
|
|
27
|
+
"loose": true,
|
|
28
|
+
"externalHelpers": true
|
|
29
|
+
},
|
|
30
|
+
"env": {
|
|
31
|
+
"targets": {
|
|
32
|
+
"ie": "11"
|
|
33
|
+
},
|
|
34
|
+
"dynamicImport": true,
|
|
35
|
+
"loose": true,
|
|
36
|
+
"mode": "entry",
|
|
37
|
+
"coreJs": 3
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"test": ".jsx?$",
|
|
42
|
+
"minify": true,
|
|
43
|
+
"jsc": {
|
|
44
|
+
"parser": {
|
|
45
|
+
"syntax": "ecmascript",
|
|
46
|
+
"jsx": true,
|
|
47
|
+
"dynamicImport": true,
|
|
48
|
+
"privateMethod": true,
|
|
49
|
+
"functionBind": true,
|
|
50
|
+
"exportDefaultFrom": true,
|
|
51
|
+
"exportNamespaceFrom": true,
|
|
52
|
+
"decorators": true,
|
|
53
|
+
"decoratorsBeforeExport": true,
|
|
54
|
+
"topLevelAwait": true,
|
|
55
|
+
"importMeta": true
|
|
56
|
+
},
|
|
57
|
+
"transform": {
|
|
58
|
+
"legacyDecorator": true,
|
|
59
|
+
"react": {
|
|
60
|
+
"useBuiltins": true,
|
|
61
|
+
"runtime": "automatic"
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"target": "es5",
|
|
65
|
+
"loose": true,
|
|
66
|
+
"externalHelpers": true
|
|
67
|
+
},
|
|
68
|
+
"env": {
|
|
69
|
+
"targets": {
|
|
70
|
+
"ie": "11"
|
|
71
|
+
},
|
|
72
|
+
"dynamicImport": true,
|
|
73
|
+
"loose": true,
|
|
74
|
+
"mode": "entry",
|
|
75
|
+
"coreJs": 3
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
]
|
package/bin/sui-bundler-dev.js
CHANGED
|
@@ -67,12 +67,7 @@ const start = async ({
|
|
|
67
67
|
} = {}) => {
|
|
68
68
|
clearConsole()
|
|
69
69
|
// Warn and crash if required files are missing
|
|
70
|
-
if (
|
|
71
|
-
!checkRequiredFiles([
|
|
72
|
-
path.join(config.context, 'index.html'),
|
|
73
|
-
path.join(config.context, 'app.js')
|
|
74
|
-
])
|
|
75
|
-
) {
|
|
70
|
+
if (!checkRequiredFiles([path.join(config.context, 'index.html')])) {
|
|
76
71
|
log.error(
|
|
77
72
|
`✖ Required files are missing, create and index.html and app.js inside your src folder.`
|
|
78
73
|
)
|
|
@@ -49,7 +49,7 @@ module.exports = ({config, packagesToLink, linkAll}) => {
|
|
|
49
49
|
* if neccesary
|
|
50
50
|
*/
|
|
51
51
|
const linkLoader = {
|
|
52
|
-
test: /\.(jsx?|scss)$/,
|
|
52
|
+
test: /\.(jsx?|tsx?|scss)$/,
|
|
53
53
|
enforce: 'pre', // this will ensure is execute before transformations
|
|
54
54
|
use: {
|
|
55
55
|
loader: require.resolve('./LinkLoader'),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@s-ui/bundler",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.39.0-typescript.1",
|
|
4
4
|
"description": "Config-free bundler for ES6 React apps.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sui-bundler": "./bin/sui-bundler.js"
|
|
@@ -24,6 +24,8 @@
|
|
|
24
24
|
"@babel/core": "7.18.10",
|
|
25
25
|
"@s-ui/helpers": "1",
|
|
26
26
|
"@s-ui/sass-loader": "1",
|
|
27
|
+
"@swc/core": "1.3.52",
|
|
28
|
+
"@swc/helpers": "0.5.0",
|
|
27
29
|
"address": "1.2.0",
|
|
28
30
|
"autoprefixer": "10.4.8",
|
|
29
31
|
"babel-loader": "8.2.5",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"stream-http": "3.2.0",
|
|
47
49
|
"strip-ansi": "6.0.1",
|
|
48
50
|
"style-loader": "3.3.1",
|
|
51
|
+
"swc-loader": "^0.2.1",
|
|
49
52
|
"url": "0.11.0",
|
|
50
53
|
"webpack": "5.74.0",
|
|
51
54
|
"webpack-dev-server": "4.10.0",
|
package/shared/index.js
CHANGED
|
@@ -1,32 +1,94 @@
|
|
|
1
|
+
/* eslint-disable no-console */
|
|
2
|
+
import fs from 'fs-extra'
|
|
3
|
+
|
|
1
4
|
const path = require('path')
|
|
2
5
|
const {config} = require('./index.js')
|
|
3
6
|
|
|
7
|
+
const tsConfigPath = path.join(process.cwd(), 'tsconfig.json')
|
|
8
|
+
let isTypeScriptEnabled = false
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
if (fs.existsSync(tsConfigPath)) {
|
|
12
|
+
isTypeScriptEnabled = true
|
|
13
|
+
}
|
|
14
|
+
} catch (err) {
|
|
15
|
+
console.error(err)
|
|
16
|
+
}
|
|
17
|
+
|
|
4
18
|
const EXCLUDED_FOLDERS_REGEXP = new RegExp(
|
|
5
19
|
`node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)`
|
|
6
20
|
)
|
|
7
21
|
|
|
8
|
-
module.exports = ({isServer = false, supportLegacyBrowsers = true} = {}) =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
22
|
+
module.exports = ({isServer = false, supportLegacyBrowsers = true} = {}) =>
|
|
23
|
+
isTypeScriptEnabled
|
|
24
|
+
? {
|
|
25
|
+
test: /\.(js|ts)x?$/,
|
|
26
|
+
exclude: EXCLUDED_FOLDERS_REGEXP,
|
|
27
|
+
use: [
|
|
28
|
+
{
|
|
29
|
+
loader: require.resolve('swc-loader'),
|
|
30
|
+
options: {
|
|
31
|
+
minify: true,
|
|
32
|
+
jsc: {
|
|
33
|
+
parser: {
|
|
34
|
+
syntax: 'typescript',
|
|
35
|
+
tsx: true,
|
|
36
|
+
dynamicImport: true,
|
|
37
|
+
privateMethod: true,
|
|
38
|
+
functionBind: true,
|
|
39
|
+
exportDefaultFrom: true,
|
|
40
|
+
exportNamespaceFrom: true,
|
|
41
|
+
decorators: true,
|
|
42
|
+
decoratorsBeforeExport: true,
|
|
43
|
+
topLevelAwait: true,
|
|
44
|
+
importMeta: true
|
|
45
|
+
},
|
|
46
|
+
transform: {
|
|
47
|
+
legacyDecorator: true,
|
|
48
|
+
react: {
|
|
49
|
+
useBuiltins: true,
|
|
50
|
+
runtime: 'automatic'
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
target: 'es5',
|
|
54
|
+
loose: true,
|
|
55
|
+
externalHelpers: true
|
|
56
|
+
},
|
|
57
|
+
env: {
|
|
58
|
+
targets: {
|
|
59
|
+
ie: '11'
|
|
60
|
+
},
|
|
61
|
+
dynamicImport: true,
|
|
62
|
+
loose: true,
|
|
63
|
+
mode: 'entry',
|
|
64
|
+
coreJs: 3
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
: {
|
|
71
|
+
test: /\.jsx?$/,
|
|
72
|
+
exclude: EXCLUDED_FOLDERS_REGEXP,
|
|
73
|
+
use: [
|
|
74
|
+
{
|
|
75
|
+
loader: require.resolve('babel-loader'),
|
|
76
|
+
options: {
|
|
77
|
+
cacheDirectory: true,
|
|
78
|
+
cacheCompression: false,
|
|
79
|
+
babelrc: false,
|
|
80
|
+
compact: true,
|
|
81
|
+
presets: [
|
|
82
|
+
[
|
|
83
|
+
require.resolve('babel-preset-sui'),
|
|
84
|
+
{
|
|
85
|
+
isServer,
|
|
86
|
+
isModern: !supportLegacyBrowsers,
|
|
87
|
+
targets: config.targets
|
|
88
|
+
}
|
|
89
|
+
]
|
|
90
|
+
]
|
|
26
91
|
}
|
|
27
|
-
|
|
92
|
+
}
|
|
28
93
|
]
|
|
29
94
|
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
})
|
package/webpack.config.dev.js
CHANGED