@s-ui/bundler 9.33.0 → 9.36.0-beta.0
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-build.js +17 -7
- package/bin/sui-bundler-dev.js +1 -6
- package/loaders/linkLoaderConfigBuilder.js +1 -1
- package/package.json +13 -10
- package/shared/index.js +1 -1
- package/shared/module-rules-babel.js +72 -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-build.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// @ts-check
|
|
4
|
+
|
|
2
5
|
/* eslint-disable no-console */
|
|
3
6
|
|
|
4
7
|
const fs = require('fs')
|
|
@@ -63,21 +66,24 @@ if (clean) {
|
|
|
63
66
|
|
|
64
67
|
log.processing('Generating minified bundle...')
|
|
65
68
|
|
|
66
|
-
webpack(nextConfig)
|
|
69
|
+
const compiler = webpack(nextConfig)
|
|
70
|
+
|
|
71
|
+
compiler.run(async (error, stats) => {
|
|
67
72
|
if (error) {
|
|
68
73
|
log.error(error)
|
|
69
|
-
return 1
|
|
74
|
+
return process.exit(1)
|
|
70
75
|
}
|
|
71
76
|
|
|
72
|
-
if (stats
|
|
77
|
+
if (stats?.hasErrors()) {
|
|
73
78
|
const jsonStats = stats.toJson('errors-only')
|
|
74
|
-
|
|
79
|
+
jsonStats?.errors?.map(({message}) => log.error(message))
|
|
80
|
+
return process.exit(1)
|
|
75
81
|
}
|
|
76
82
|
|
|
77
|
-
if (stats
|
|
83
|
+
if (stats?.hasWarnings()) {
|
|
78
84
|
const jsonStats = stats.toJson('errors-warnings')
|
|
79
85
|
log.warn('Webpack generated the following warnings: ')
|
|
80
|
-
jsonStats
|
|
86
|
+
jsonStats?.warnings?.map(({message}) => log.warn(message))
|
|
81
87
|
}
|
|
82
88
|
|
|
83
89
|
console.log(`Webpack stats: ${stats}`)
|
|
@@ -147,5 +153,9 @@ webpack(nextConfig).run(async (error, stats) => {
|
|
|
147
153
|
`Your app is compiled in ${process.env.NODE_ENV} mode in /public. It's ready to roll!`
|
|
148
154
|
)
|
|
149
155
|
|
|
150
|
-
|
|
156
|
+
compiler.close(closeErr => {
|
|
157
|
+
const exitCode = closeErr ? 1 : 0
|
|
158
|
+
if (closeErr) return process.exit(exitCode)
|
|
159
|
+
return process.exit(0)
|
|
160
|
+
})
|
|
151
161
|
})
|
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.36.0-beta.0",
|
|
4
4
|
"description": "Config-free bundler for ES6 React apps.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sui-bundler": "./bin/sui-bundler.js"
|
|
@@ -21,35 +21,38 @@
|
|
|
21
21
|
},
|
|
22
22
|
"homepage": "https://github.com/SUI-Components/sui/tree/master/packages/sui-bundler#readme",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@babel/core": "7.18.
|
|
24
|
+
"@babel/core": "7.18.10",
|
|
25
25
|
"@s-ui/helpers": "1",
|
|
26
26
|
"@s-ui/sass-loader": "1",
|
|
27
27
|
"address": "1.2.0",
|
|
28
|
-
"autoprefixer": "10.4.
|
|
28
|
+
"autoprefixer": "10.4.8",
|
|
29
29
|
"babel-loader": "8.2.5",
|
|
30
30
|
"babel-preset-sui": "3",
|
|
31
31
|
"buffer": "6.0.3",
|
|
32
32
|
"commander": "8.3.0",
|
|
33
33
|
"css-loader": "6.7.1",
|
|
34
34
|
"css-minimizer-webpack-plugin": "4.0.0",
|
|
35
|
-
"esbuild": "0.
|
|
35
|
+
"esbuild": "0.15.5",
|
|
36
36
|
"escape-string-regexp": "4.0.0",
|
|
37
37
|
"fast-glob": "3.2.11",
|
|
38
38
|
"find-free-ports": "3.0.0",
|
|
39
39
|
"html-webpack-plugin": "5.5.0",
|
|
40
40
|
"https-browserify": "1.0.0",
|
|
41
41
|
"mini-css-extract-plugin": "2.6.1",
|
|
42
|
-
"postcss": "8.4.
|
|
42
|
+
"postcss": "8.4.16",
|
|
43
43
|
"postcss-loader": "7.0.1",
|
|
44
44
|
"process": "0.11.10",
|
|
45
|
-
"sass": "1.
|
|
45
|
+
"sass": "1.54.5",
|
|
46
46
|
"stream-http": "3.2.0",
|
|
47
47
|
"strip-ansi": "6.0.1",
|
|
48
48
|
"style-loader": "3.3.1",
|
|
49
49
|
"url": "0.11.0",
|
|
50
|
-
"webpack": "5.
|
|
51
|
-
"webpack-dev-server": "4.
|
|
50
|
+
"webpack": "5.74.0",
|
|
51
|
+
"webpack-dev-server": "4.10.0",
|
|
52
52
|
"webpack-manifest-plugin": "5.0.0",
|
|
53
|
-
"webpack-node-externals": "3.0.0"
|
|
53
|
+
"webpack-node-externals": "3.0.0",
|
|
54
|
+
"@swc/core": "^1.2.189",
|
|
55
|
+
"@swc/helpers": "^0.3.15",
|
|
56
|
+
"swc-loader": "^0.2.1"
|
|
54
57
|
}
|
|
55
|
-
}
|
|
58
|
+
}
|
package/shared/index.js
CHANGED
|
@@ -1,32 +1,82 @@
|
|
|
1
1
|
const path = require('path')
|
|
2
2
|
const {config} = require('./index.js')
|
|
3
3
|
|
|
4
|
+
const {TS: isTypeScript = false} = process.env
|
|
5
|
+
|
|
4
6
|
const EXCLUDED_FOLDERS_REGEXP = new RegExp(
|
|
5
7
|
`node_modules(?!${path.sep}@s-ui(${path.sep}studio)(${path.sep}workbench)?${path.sep}src)`
|
|
6
8
|
)
|
|
7
9
|
|
|
8
|
-
module.exports = ({isServer = false} = {}) =>
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
10
|
+
module.exports = ({isServer = false} = {}) =>
|
|
11
|
+
isTypeScript
|
|
12
|
+
? {
|
|
13
|
+
test: /\.(js|ts)x?$/,
|
|
14
|
+
exclude: EXCLUDED_FOLDERS_REGEXP,
|
|
15
|
+
use: [
|
|
16
|
+
{
|
|
17
|
+
loader: require.resolve('swc-loader'),
|
|
18
|
+
options: {
|
|
19
|
+
minify: true,
|
|
20
|
+
jsc: {
|
|
21
|
+
parser: {
|
|
22
|
+
syntax: 'typescript',
|
|
23
|
+
tsx: true,
|
|
24
|
+
dynamicImport: true,
|
|
25
|
+
privateMethod: true,
|
|
26
|
+
functionBind: true,
|
|
27
|
+
exportDefaultFrom: true,
|
|
28
|
+
exportNamespaceFrom: true,
|
|
29
|
+
decorators: true,
|
|
30
|
+
decoratorsBeforeExport: true,
|
|
31
|
+
topLevelAwait: true,
|
|
32
|
+
importMeta: true
|
|
33
|
+
},
|
|
34
|
+
transform: {
|
|
35
|
+
legacyDecorator: true,
|
|
36
|
+
react: {
|
|
37
|
+
useBuiltins: true,
|
|
38
|
+
runtime: 'automatic'
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
target: 'es5',
|
|
42
|
+
loose: true,
|
|
43
|
+
externalHelpers: true
|
|
44
|
+
},
|
|
45
|
+
env: {
|
|
46
|
+
targets: {
|
|
47
|
+
ie: '11'
|
|
48
|
+
},
|
|
49
|
+
dynamicImport: true,
|
|
50
|
+
loose: true,
|
|
51
|
+
mode: 'entry',
|
|
52
|
+
coreJs: 3
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
]
|
|
57
|
+
}
|
|
58
|
+
: {
|
|
59
|
+
test: /\.jsx?$/,
|
|
60
|
+
exclude: EXCLUDED_FOLDERS_REGEXP,
|
|
61
|
+
use: [
|
|
62
|
+
{
|
|
63
|
+
loader: require.resolve('babel-loader'),
|
|
64
|
+
options: {
|
|
65
|
+
cacheDirectory: true,
|
|
66
|
+
cacheCompression: false,
|
|
67
|
+
babelrc: false,
|
|
68
|
+
compact: true,
|
|
69
|
+
presets: [
|
|
70
|
+
[
|
|
71
|
+
require.resolve('babel-preset-sui'),
|
|
72
|
+
{
|
|
73
|
+
isServer,
|
|
74
|
+
supportLegacyBrowsers: true,
|
|
75
|
+
targets: config.targets
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
]
|
|
26
79
|
}
|
|
27
|
-
|
|
80
|
+
}
|
|
28
81
|
]
|
|
29
82
|
}
|
|
30
|
-
}
|
|
31
|
-
]
|
|
32
|
-
})
|
package/webpack.config.dev.js
CHANGED