swico 2.0.0-beta.5 → 2.0.0-beta.7
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 +3 -3
- package/src/command/start.js +2 -2
- package/src/config/rsbpack.dev.js +0 -1
- package/src/config/rspack.base.react.d.ts +25 -0
- package/src/config/rspack.base.react.js +10 -5
- package/src/config/rspack.base.vue.d.ts +19 -0
- package/src/config/rspack.base.vue.js +12 -6
- 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.7",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -52,8 +52,8 @@
|
|
|
52
52
|
"postcss-preset-env": "9.3.0",
|
|
53
53
|
"qs": "6.13.0",
|
|
54
54
|
"react-router-dom": "6.23.0",
|
|
55
|
-
"sass": "1.
|
|
56
|
-
"sass-loader": "
|
|
55
|
+
"sass-embedded": "^1.86.3",
|
|
56
|
+
"sass-loader": "16.0.5",
|
|
57
57
|
"style-loader": "3.3.0",
|
|
58
58
|
"ts-checker-rspack-plugin": "^1.1.1",
|
|
59
59
|
"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();
|
|
@@ -119,7 +119,7 @@ const createCompileListener = (compiler) => {
|
|
|
119
119
|
const warnings = info.warnings;
|
|
120
120
|
warnings.some((item) => {
|
|
121
121
|
const msg = item.message || item.stack;
|
|
122
|
-
if (msg.
|
|
122
|
+
if (msg.includes('[eslint]')) {
|
|
123
123
|
tools_1.toast.warning(msg, { title: 'ESLint errors' });
|
|
124
124
|
return;
|
|
125
125
|
}
|
|
@@ -4,6 +4,9 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
4
4
|
output: {
|
|
5
5
|
path: string;
|
|
6
6
|
filename: string;
|
|
7
|
+
chunkFilename: string;
|
|
8
|
+
cssFilename: string;
|
|
9
|
+
cssChunkFilename: string;
|
|
7
10
|
assetModuleFilename: string;
|
|
8
11
|
publicPath: string;
|
|
9
12
|
clean: boolean;
|
|
@@ -57,6 +60,28 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
57
60
|
})[];
|
|
58
61
|
generator?: undefined;
|
|
59
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;
|
|
60
85
|
} | {
|
|
61
86
|
test: RegExp;
|
|
62
87
|
type: string;
|
|
@@ -46,6 +46,9 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
46
46
|
output: {
|
|
47
47
|
path: path_1.default.join(projectPath, '/dist'),
|
|
48
48
|
filename: 'js/[name].[chunkhash].js',
|
|
49
|
+
chunkFilename: 'js/[name].[chunkhash].js',
|
|
50
|
+
cssFilename: 'css/[name].[contenthash].css',
|
|
51
|
+
cssChunkFilename: 'css/[name].[contenthash].css',
|
|
49
52
|
assetModuleFilename: 'assets/[name]_[chunkhash][ext]',
|
|
50
53
|
publicPath,
|
|
51
54
|
clean: true
|
|
@@ -132,7 +135,13 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
132
135
|
}
|
|
133
136
|
}
|
|
134
137
|
},
|
|
135
|
-
|
|
138
|
+
{
|
|
139
|
+
loader: sassLoader,
|
|
140
|
+
options: {
|
|
141
|
+
api: 'modern-compiler',
|
|
142
|
+
implementation: require.resolve('sass-embedded')
|
|
143
|
+
}
|
|
144
|
+
}
|
|
136
145
|
]
|
|
137
146
|
},
|
|
138
147
|
{
|
|
@@ -178,10 +187,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
178
187
|
},
|
|
179
188
|
hash: true
|
|
180
189
|
}),
|
|
181
|
-
new core_1.rspack.CssExtractRspackPlugin({
|
|
182
|
-
filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
183
|
-
ignoreOrder: true
|
|
184
|
-
}),
|
|
185
190
|
...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins)
|
|
186
191
|
]
|
|
187
192
|
};
|
|
@@ -4,10 +4,16 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
4
4
|
output: {
|
|
5
5
|
path: string;
|
|
6
6
|
filename: string;
|
|
7
|
+
chunkFilename: string;
|
|
8
|
+
cssFilename: string;
|
|
9
|
+
cssChunkFilename: string;
|
|
7
10
|
assetModuleFilename: string;
|
|
8
11
|
publicPath: string;
|
|
9
12
|
clean: boolean;
|
|
10
13
|
};
|
|
14
|
+
experiments: {
|
|
15
|
+
css: boolean;
|
|
16
|
+
};
|
|
11
17
|
target: string[];
|
|
12
18
|
module: {
|
|
13
19
|
parser: {
|
|
@@ -49,6 +55,16 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
49
55
|
test: RegExp;
|
|
50
56
|
type: string;
|
|
51
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
|
+
};
|
|
52
68
|
generator?: undefined;
|
|
53
69
|
} | {
|
|
54
70
|
test: RegExp;
|
|
@@ -57,15 +73,18 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
57
73
|
filename: string;
|
|
58
74
|
};
|
|
59
75
|
loader?: undefined;
|
|
76
|
+
options?: undefined;
|
|
60
77
|
} | {
|
|
61
78
|
test: RegExp;
|
|
62
79
|
type: string;
|
|
63
80
|
loader?: undefined;
|
|
81
|
+
options?: undefined;
|
|
64
82
|
generator?: undefined;
|
|
65
83
|
} | {
|
|
66
84
|
test: RegExp;
|
|
67
85
|
loader: string;
|
|
68
86
|
type?: undefined;
|
|
87
|
+
options?: undefined;
|
|
69
88
|
generator?: undefined;
|
|
70
89
|
})[];
|
|
71
90
|
test?: undefined;
|
|
@@ -48,10 +48,16 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
48
48
|
output: {
|
|
49
49
|
path: path_1.default.join(projectPath, '/dist'),
|
|
50
50
|
filename: 'js/[name].[chunkhash].js',
|
|
51
|
-
|
|
51
|
+
chunkFilename: 'js/[name].[chunkhash].js',
|
|
52
|
+
cssFilename: 'css/[name].[contenthash].css',
|
|
53
|
+
cssChunkFilename: 'css/[name].[contenthash].css',
|
|
54
|
+
assetModuleFilename: 'assets/[name]_[id][ext]',
|
|
52
55
|
publicPath,
|
|
53
56
|
clean: true
|
|
54
57
|
},
|
|
58
|
+
experiments: {
|
|
59
|
+
css: true
|
|
60
|
+
},
|
|
55
61
|
target: ['web', 'es5'],
|
|
56
62
|
module: {
|
|
57
63
|
parser: {
|
|
@@ -98,7 +104,11 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
98
104
|
{
|
|
99
105
|
test: /\.scss$/,
|
|
100
106
|
type: 'css',
|
|
101
|
-
loader: sassLoader
|
|
107
|
+
loader: sassLoader,
|
|
108
|
+
options: {
|
|
109
|
+
api: 'modern-compiler',
|
|
110
|
+
implementation: require.resolve('sass-embedded')
|
|
111
|
+
}
|
|
102
112
|
},
|
|
103
113
|
{
|
|
104
114
|
test: /\.(jpg|png|gif|webp|bmp|jpeg|svg)$/,
|
|
@@ -149,10 +159,6 @@ function default_1({ projectPath, entryPath, env, customConfig }) {
|
|
|
149
159
|
},
|
|
150
160
|
hash: true
|
|
151
161
|
}),
|
|
152
|
-
new core_1.CssExtractRspackPlugin({
|
|
153
|
-
filename: env === 'dev' ? 'css/[name].css' : 'css/[name].[contenthash].css',
|
|
154
|
-
ignoreOrder: true
|
|
155
|
-
}),
|
|
156
162
|
...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) || config_1.initConfig.plugins)
|
|
157
163
|
]
|
|
158
164
|
};
|
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)}`);
|