swico 2.0.0-beta.6 → 2.0.0-beta.8
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 +4 -6
- package/src/command/start.js +2 -3
- package/src/config/rsbpack.dev.js +5 -0
- package/src/config/rspack.base.react.d.ts +24 -0
- package/src/config/rspack.base.react.js +11 -3
- package/src/config/rspack.base.vue.d.ts +15 -0
- package/src/config/rspack.base.vue.js +8 -2
- package/src/utils/tools.js +3 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swico",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.8",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"cli",
|
|
14
14
|
"swico",
|
|
15
15
|
"template",
|
|
16
|
-
"
|
|
16
|
+
"rspack"
|
|
17
17
|
],
|
|
18
18
|
"bin": {
|
|
19
19
|
"swico": "./src/bin.js"
|
|
@@ -30,10 +30,8 @@
|
|
|
30
30
|
"author": "scw",
|
|
31
31
|
"license": "ISC",
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@babel/types": "7.23.9",
|
|
34
33
|
"@rspack/core": "1.3.4",
|
|
35
34
|
"@rspack/dev-server": "^1.1.1",
|
|
36
|
-
"@swc/core": "1.4.6",
|
|
37
35
|
"@vue/compiler-sfc": "3.4.14",
|
|
38
36
|
"autoprefixer": "10.3.7",
|
|
39
37
|
"chalk": "4.1.2",
|
|
@@ -52,8 +50,8 @@
|
|
|
52
50
|
"postcss-preset-env": "9.3.0",
|
|
53
51
|
"qs": "6.13.0",
|
|
54
52
|
"react-router-dom": "6.23.0",
|
|
55
|
-
"sass": "1.
|
|
56
|
-
"sass-loader": "
|
|
53
|
+
"sass-embedded": "^1.86.3",
|
|
54
|
+
"sass-loader": "16.0.5",
|
|
57
55
|
"style-loader": "3.3.0",
|
|
58
56
|
"ts-checker-rspack-plugin": "^1.1.1",
|
|
59
57
|
"ts-node": "10.9.1",
|
package/src/command/start.js
CHANGED
|
@@ -35,7 +35,7 @@ const handleWatch = (projectPath, devServer, env) => {
|
|
|
35
35
|
ignored: [path_1.default.join(projectPath, '/config/swico.prod.ts')]
|
|
36
36
|
})
|
|
37
37
|
.on('all', (path, stats) => __awaiter(void 0, void 0, void 0, function* () {
|
|
38
|
-
tools_1.toast.warning('
|
|
38
|
+
tools_1.toast.warning('Configuration files changed, restarting server...', {
|
|
39
39
|
inline: true
|
|
40
40
|
});
|
|
41
41
|
yield devServer.stop();
|
|
@@ -116,11 +116,10 @@ const createCompileListener = (compiler) => {
|
|
|
116
116
|
return;
|
|
117
117
|
}
|
|
118
118
|
if (stats === null || stats === void 0 ? void 0 : stats.hasWarnings()) {
|
|
119
|
-
console.log('warning', info);
|
|
120
119
|
const warnings = info.warnings;
|
|
121
120
|
warnings.some((item) => {
|
|
122
121
|
const msg = item.message || item.stack;
|
|
123
|
-
if (msg.
|
|
122
|
+
if (msg.includes('[eslint]')) {
|
|
124
123
|
tools_1.toast.warning(msg, { title: 'ESLint errors' });
|
|
125
124
|
return;
|
|
126
125
|
}
|
|
@@ -41,6 +41,7 @@ const webpack_merge_1 = require("webpack-merge");
|
|
|
41
41
|
const eslint_webpack_plugin_1 = __importDefault(require("eslint-webpack-plugin"));
|
|
42
42
|
const ts_checker_rspack_plugin_1 = require("ts-checker-rspack-plugin");
|
|
43
43
|
const tools_1 = require("../utils/tools");
|
|
44
|
+
const core_1 = require("@rspack/core");
|
|
44
45
|
function default_1(options) {
|
|
45
46
|
var _a, _b, _c, _d, _e;
|
|
46
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -54,6 +55,9 @@ function default_1(options) {
|
|
|
54
55
|
devtool: templateType === 'vue'
|
|
55
56
|
? customDevtool !== null && customDevtool !== void 0 ? customDevtool : 'cheap-module-source-map'
|
|
56
57
|
: customDevtool !== null && customDevtool !== void 0 ? customDevtool : 'eval-cheap-module-source-map',
|
|
58
|
+
optimization: {
|
|
59
|
+
runtimeChunk: 'single'
|
|
60
|
+
},
|
|
57
61
|
devServer: {
|
|
58
62
|
historyApiFallback: {
|
|
59
63
|
index: `${baseConfig.output.publicPath}index.html`
|
|
@@ -74,6 +78,7 @@ function default_1(options) {
|
|
|
74
78
|
server: customConfig.dev.https === true ? 'https' : 'http'
|
|
75
79
|
},
|
|
76
80
|
plugins: [
|
|
81
|
+
new core_1.rspack.HotModuleReplacementPlugin(),
|
|
77
82
|
new ts_checker_rspack_plugin_1.TsCheckerRspackPlugin({
|
|
78
83
|
logger: {
|
|
79
84
|
log: () => { },
|
|
@@ -4,7 +4,9 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
4
4
|
output: {
|
|
5
5
|
path: string;
|
|
6
6
|
filename: string;
|
|
7
|
+
chunkFilename: string;
|
|
7
8
|
cssFilename: string;
|
|
9
|
+
cssChunkFilename: string;
|
|
8
10
|
assetModuleFilename: string;
|
|
9
11
|
publicPath: string;
|
|
10
12
|
clean: boolean;
|
|
@@ -58,6 +60,28 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
58
60
|
})[];
|
|
59
61
|
generator?: undefined;
|
|
60
62
|
loader?: undefined;
|
|
63
|
+
} | {
|
|
64
|
+
test: RegExp;
|
|
65
|
+
type: string;
|
|
66
|
+
use: ({
|
|
67
|
+
loader: string;
|
|
68
|
+
options: {
|
|
69
|
+
postcssOptions: {
|
|
70
|
+
plugins: string[][];
|
|
71
|
+
};
|
|
72
|
+
api?: undefined;
|
|
73
|
+
implementation?: undefined;
|
|
74
|
+
};
|
|
75
|
+
} | {
|
|
76
|
+
loader: string;
|
|
77
|
+
options: {
|
|
78
|
+
api: string;
|
|
79
|
+
implementation: string;
|
|
80
|
+
postcssOptions?: undefined;
|
|
81
|
+
};
|
|
82
|
+
})[];
|
|
83
|
+
generator?: undefined;
|
|
84
|
+
loader?: undefined;
|
|
61
85
|
} | {
|
|
62
86
|
test: RegExp;
|
|
63
87
|
type: string;
|
|
@@ -45,8 +45,10 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
45
45
|
entry: entryPath,
|
|
46
46
|
output: {
|
|
47
47
|
path: path_1.default.join(projectPath, '/dist'),
|
|
48
|
-
filename: 'js/[name].[
|
|
48
|
+
filename: 'js/[name].[chunkhash].js',
|
|
49
|
+
chunkFilename: 'js/[name].[chunkhash].js',
|
|
49
50
|
cssFilename: 'css/[name].[contenthash].css',
|
|
51
|
+
cssChunkFilename: 'css/[name].[contenthash].css',
|
|
50
52
|
assetModuleFilename: 'assets/[name]_[chunkhash][ext]',
|
|
51
53
|
publicPath,
|
|
52
54
|
clean: true
|
|
@@ -54,7 +56,7 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
54
56
|
experiments: {
|
|
55
57
|
css: true
|
|
56
58
|
},
|
|
57
|
-
target: ['web', '
|
|
59
|
+
target: ['web', 'es2015'],
|
|
58
60
|
module: {
|
|
59
61
|
parser: {
|
|
60
62
|
'css/auto': {
|
|
@@ -133,7 +135,13 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
133
135
|
}
|
|
134
136
|
}
|
|
135
137
|
},
|
|
136
|
-
|
|
138
|
+
{
|
|
139
|
+
loader: sassLoader,
|
|
140
|
+
options: {
|
|
141
|
+
api: 'modern-compiler',
|
|
142
|
+
implementation: require.resolve('sass-embedded')
|
|
143
|
+
}
|
|
144
|
+
}
|
|
137
145
|
]
|
|
138
146
|
},
|
|
139
147
|
{
|
|
@@ -4,7 +4,9 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
4
4
|
output: {
|
|
5
5
|
path: string;
|
|
6
6
|
filename: string;
|
|
7
|
+
chunkFilename: string;
|
|
7
8
|
cssFilename: string;
|
|
9
|
+
cssChunkFilename: string;
|
|
8
10
|
assetModuleFilename: string;
|
|
9
11
|
publicPath: string;
|
|
10
12
|
clean: boolean;
|
|
@@ -53,6 +55,16 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
53
55
|
test: RegExp;
|
|
54
56
|
type: string;
|
|
55
57
|
loader: string;
|
|
58
|
+
options?: undefined;
|
|
59
|
+
generator?: undefined;
|
|
60
|
+
} | {
|
|
61
|
+
test: RegExp;
|
|
62
|
+
type: string;
|
|
63
|
+
loader: string;
|
|
64
|
+
options: {
|
|
65
|
+
api: string;
|
|
66
|
+
implementation: string;
|
|
67
|
+
};
|
|
56
68
|
generator?: undefined;
|
|
57
69
|
} | {
|
|
58
70
|
test: RegExp;
|
|
@@ -61,15 +73,18 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
61
73
|
filename: string;
|
|
62
74
|
};
|
|
63
75
|
loader?: undefined;
|
|
76
|
+
options?: undefined;
|
|
64
77
|
} | {
|
|
65
78
|
test: RegExp;
|
|
66
79
|
type: string;
|
|
67
80
|
loader?: undefined;
|
|
81
|
+
options?: undefined;
|
|
68
82
|
generator?: undefined;
|
|
69
83
|
} | {
|
|
70
84
|
test: RegExp;
|
|
71
85
|
loader: string;
|
|
72
86
|
type?: undefined;
|
|
87
|
+
options?: undefined;
|
|
73
88
|
generator?: undefined;
|
|
74
89
|
})[];
|
|
75
90
|
test?: undefined;
|
|
@@ -47,8 +47,10 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
47
47
|
entry: entryPath,
|
|
48
48
|
output: {
|
|
49
49
|
path: path_1.default.join(projectPath, '/dist'),
|
|
50
|
-
filename: 'js/[name].[
|
|
50
|
+
filename: 'js/[name].[chunkhash].js',
|
|
51
|
+
chunkFilename: 'js/[name].[chunkhash].js',
|
|
51
52
|
cssFilename: 'css/[name].[contenthash].css',
|
|
53
|
+
cssChunkFilename: 'css/[name].[contenthash].css',
|
|
52
54
|
assetModuleFilename: 'assets/[name]_[id][ext]',
|
|
53
55
|
publicPath,
|
|
54
56
|
clean: true
|
|
@@ -102,7 +104,11 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
102
104
|
{
|
|
103
105
|
test: /\.scss$/,
|
|
104
106
|
type: 'css',
|
|
105
|
-
loader: sassLoader
|
|
107
|
+
loader: sassLoader,
|
|
108
|
+
options: {
|
|
109
|
+
api: 'modern-compiler',
|
|
110
|
+
implementation: require.resolve('sass-embedded')
|
|
111
|
+
}
|
|
106
112
|
},
|
|
107
113
|
{
|
|
108
114
|
test: /\.(jpg|png|gif|webp|bmp|jpeg|svg)$/,
|
package/src/utils/tools.js
CHANGED
|
@@ -141,14 +141,14 @@ exports.toast = {
|
|
|
141
141
|
else {
|
|
142
142
|
if (Array.isArray(message)) {
|
|
143
143
|
if (message.length > 0) {
|
|
144
|
-
console.log(`${chalk_1.default.red.bold('error')} - ${title || '
|
|
144
|
+
console.log(`${chalk_1.default.red.bold('error')} - ${title || 'Swico errors'}:`);
|
|
145
145
|
}
|
|
146
146
|
message.forEach((item) => {
|
|
147
147
|
console.log(`> ${chalk_1.default.red.bold(item)}`);
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
else if (message) {
|
|
151
|
-
console.log(`${chalk_1.default.red.bold('error')} - ${title || '
|
|
151
|
+
console.log(`${chalk_1.default.red.bold('error')} - ${title || 'Swico errors'}:`);
|
|
152
152
|
console.log(`> ${chalk_1.default.red.bold(message)}`);
|
|
153
153
|
}
|
|
154
154
|
}
|
|
@@ -160,7 +160,7 @@ exports.toast = {
|
|
|
160
160
|
console.log(`${chalk_1.default.hex(color).bold('warning')} - ${message}`);
|
|
161
161
|
}
|
|
162
162
|
else {
|
|
163
|
-
console.log(`${chalk_1.default.hex(color).bold('warning')} - ${title || '
|
|
163
|
+
console.log(`${chalk_1.default.hex(color).bold('warning')} - ${title || ' Swico warnings'}:`);
|
|
164
164
|
if (Array.isArray(message)) {
|
|
165
165
|
message.forEach((item) => {
|
|
166
166
|
console.log(`> ${chalk_1.default.hex(color).bold(item)}`);
|