swico 2.1.0-beta.2 → 2.1.0-beta.3
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swico",
|
|
3
|
-
"version": "2.1.0-beta.
|
|
3
|
+
"version": "2.1.0-beta.3",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"less-loader": "12.2.0",
|
|
45
45
|
"ora": "5.4.1",
|
|
46
46
|
"portfinder": "1.0.32",
|
|
47
|
+
"postcss": "8.5.3",
|
|
47
48
|
"postcss-loader": "8.1.0",
|
|
48
49
|
"postcss-preset-env": "9.3.0",
|
|
49
50
|
"qs": "6.13.0",
|
|
@@ -60,8 +61,8 @@
|
|
|
60
61
|
"webpack-merge": "6.0.1"
|
|
61
62
|
},
|
|
62
63
|
"devDependencies": {
|
|
63
|
-
"@rspack/core": "1.3.5",
|
|
64
64
|
"@eslint/js": "9.24.0",
|
|
65
|
+
"@rspack/core": "1.3.5",
|
|
65
66
|
"@types/node": "22.13.10",
|
|
66
67
|
"@types/react": "19.1.0",
|
|
67
68
|
"@types/react-dom": "19.1.0",
|
|
@@ -21,7 +21,7 @@ const sassLoader = require.resolve('sass-loader');
|
|
|
21
21
|
const postcssLoader = require.resolve('postcss-loader');
|
|
22
22
|
function default_1(_a) {
|
|
23
23
|
return __awaiter(this, arguments, void 0, function* ({ projectPath, entryPath, env, customConfig }) {
|
|
24
|
-
var _b, _c, _d;
|
|
24
|
+
var _b, _c, _d, _e, _f, _g, _h;
|
|
25
25
|
const customBaseConfig = customConfig.base;
|
|
26
26
|
const getCustomAliasConfig = () => {
|
|
27
27
|
const { alias } = customBaseConfig || {};
|
|
@@ -33,10 +33,11 @@ function default_1(_a) {
|
|
|
33
33
|
}
|
|
34
34
|
return custAliasConfig;
|
|
35
35
|
};
|
|
36
|
-
const publicPath = (customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath)
|
|
37
|
-
const routerBase = ((
|
|
36
|
+
const publicPath = (_b = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath) !== null && _b !== void 0 ? _b : config_1.initConfig.publicPath;
|
|
37
|
+
const routerBase = (_d = (_c = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.router) === null || _c === void 0 ? void 0 : _c.base) !== null && _d !== void 0 ? _d : config_1.initConfig.router.base;
|
|
38
|
+
const cssMode = ((_e = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.cssAuto) !== null && _e !== void 0 ? _e : config_1.initConfig.cssAuto) ? 'css/auto' : 'css';
|
|
38
39
|
const basicPlugins = [];
|
|
39
|
-
const defineConfigData = (
|
|
40
|
+
const defineConfigData = (_g = (_f = customConfig === null || customConfig === void 0 ? void 0 : customConfig.base) === null || _f === void 0 ? void 0 : _f.define) !== null && _g !== void 0 ? _g : {};
|
|
40
41
|
const formatObj = yield (0, config_1.getFormatDefineVars)(defineConfigData);
|
|
41
42
|
if (Object.keys(formatObj).length !== 0) {
|
|
42
43
|
basicPlugins.push(new core_1.rspack.DefinePlugin(formatObj));
|
|
@@ -95,7 +96,7 @@ function default_1(_a) {
|
|
|
95
96
|
oneOf: [
|
|
96
97
|
{
|
|
97
98
|
test: /\.css$/,
|
|
98
|
-
type:
|
|
99
|
+
type: cssMode,
|
|
99
100
|
use: [
|
|
100
101
|
{
|
|
101
102
|
loader: postcssLoader,
|
|
@@ -109,7 +110,7 @@ function default_1(_a) {
|
|
|
109
110
|
},
|
|
110
111
|
{
|
|
111
112
|
test: /\.less$/,
|
|
112
|
-
type:
|
|
113
|
+
type: cssMode,
|
|
113
114
|
use: [
|
|
114
115
|
{
|
|
115
116
|
loader: postcssLoader,
|
|
@@ -124,7 +125,7 @@ function default_1(_a) {
|
|
|
124
125
|
},
|
|
125
126
|
{
|
|
126
127
|
test: /\.scss$/,
|
|
127
|
-
type:
|
|
128
|
+
type: cssMode,
|
|
128
129
|
use: [
|
|
129
130
|
{
|
|
130
131
|
loader: postcssLoader,
|
|
@@ -186,7 +187,7 @@ function default_1(_a) {
|
|
|
186
187
|
},
|
|
187
188
|
hash: true
|
|
188
189
|
}),
|
|
189
|
-
...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins)
|
|
190
|
+
...((_h = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) !== null && _h !== void 0 ? _h : config_1.initConfig.plugins)
|
|
190
191
|
]
|
|
191
192
|
};
|
|
192
193
|
});
|
|
@@ -24,7 +24,7 @@ const sassLoader = require.resolve('sass-loader');
|
|
|
24
24
|
const postcssLoader = require.resolve('postcss-loader');
|
|
25
25
|
function default_1(_a) {
|
|
26
26
|
return __awaiter(this, arguments, void 0, function* ({ projectPath, entryPath, env, customConfig }) {
|
|
27
|
-
var _b, _c, _d;
|
|
27
|
+
var _b, _c, _d, _e, _f;
|
|
28
28
|
const customBaseConfig = customConfig.base;
|
|
29
29
|
const getCustomAliasConfig = () => {
|
|
30
30
|
const { alias } = customBaseConfig || {};
|
|
@@ -36,10 +36,10 @@ function default_1(_a) {
|
|
|
36
36
|
}
|
|
37
37
|
return custAliasConfig;
|
|
38
38
|
};
|
|
39
|
-
const publicPath = (customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath)
|
|
40
|
-
const routerBase = ((
|
|
39
|
+
const publicPath = (_b = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath) !== null && _b !== void 0 ? _b : config_1.initConfig.publicPath;
|
|
40
|
+
const routerBase = (_d = (_c = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.router) === null || _c === void 0 ? void 0 : _c.base) !== null && _d !== void 0 ? _d : config_1.initConfig.router.base;
|
|
41
41
|
const basicPlugins = [];
|
|
42
|
-
const defineConfigData = (
|
|
42
|
+
const defineConfigData = (_e = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.define) !== null && _e !== void 0 ? _e : {};
|
|
43
43
|
const formatObj = yield (0, config_1.getFormatDefineVars)(defineConfigData);
|
|
44
44
|
if (Object.keys(formatObj).length !== 0) {
|
|
45
45
|
basicPlugins.push(new core_1.DefinePlugin(formatObj));
|
|
@@ -255,7 +255,7 @@ function default_1(_a) {
|
|
|
255
255
|
extensions: ['.ts', '.js', '.vue', '.json'],
|
|
256
256
|
alias: Object.assign({ '@': path_1.default.join(projectPath, '/src'), vue: 'vue/dist/vue.esm-bundler.js', 'vue-router': path_1.default.dirname(require.resolve('vue-router')), qs: path_1.default.dirname(require.resolve('qs')) }, getCustomAliasConfig())
|
|
257
257
|
},
|
|
258
|
-
externals:
|
|
258
|
+
externals: customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.externals,
|
|
259
259
|
plugins: [
|
|
260
260
|
...basicPlugins,
|
|
261
261
|
new core_1.CssExtractRspackPlugin({
|
|
@@ -278,7 +278,7 @@ function default_1(_a) {
|
|
|
278
278
|
},
|
|
279
279
|
hash: true
|
|
280
280
|
}),
|
|
281
|
-
...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins)
|
|
281
|
+
...((_f = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) !== null && _f !== void 0 ? _f : config_1.initConfig.plugins)
|
|
282
282
|
]
|
|
283
283
|
};
|
|
284
284
|
});
|
package/src/utils/config.d.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface GlobalSwicoConfigType {
|
|
|
29
29
|
devtool?: string;
|
|
30
30
|
externals?: any;
|
|
31
31
|
router?: ConfigRouterType;
|
|
32
|
+
cssAuto?: boolean;
|
|
32
33
|
}
|
|
33
34
|
export interface GlobalData {
|
|
34
35
|
templateType?: GlobalSwicoConfigType['template'];
|
|
@@ -37,7 +38,7 @@ export interface GlobalData {
|
|
|
37
38
|
templatePath: string;
|
|
38
39
|
env?: 'dev' | 'prod';
|
|
39
40
|
customConfig: {
|
|
40
|
-
base: Pick<GlobalSwicoConfigType, 'plugins' | 'publicPath' | 'alias' | 'define' | 'devtool' | 'externals' | 'router' | 'template'>;
|
|
41
|
+
base: Pick<GlobalSwicoConfigType, 'plugins' | 'publicPath' | 'alias' | 'define' | 'devtool' | 'externals' | 'router' | 'template' | 'cssAuto'>;
|
|
41
42
|
dev: Pick<GlobalSwicoConfigType, 'plugins' | 'proxy' | 'https' | 'devtool' | 'router'>;
|
|
42
43
|
prod: Pick<GlobalSwicoConfigType, 'plugins' | 'console' | 'copy' | 'devtool' | 'router'>;
|
|
43
44
|
};
|
package/src/utils/config.js
CHANGED
|
@@ -77,7 +77,8 @@ const getProjectConfig = (env) => __awaiter(void 0, void 0, void 0, function* ()
|
|
|
77
77
|
'devtool',
|
|
78
78
|
'externals',
|
|
79
79
|
'router',
|
|
80
|
-
'template'
|
|
80
|
+
'template',
|
|
81
|
+
'cssAuto'
|
|
81
82
|
];
|
|
82
83
|
configFileName = 'swico.ts';
|
|
83
84
|
break;
|
|
@@ -266,6 +267,7 @@ const getFormatDefineVars = (defineVarsConfigData) => __awaiter(void 0, void 0,
|
|
|
266
267
|
exports.getFormatDefineVars = getFormatDefineVars;
|
|
267
268
|
exports.initConfig = {
|
|
268
269
|
console: true,
|
|
270
|
+
cssAuto: true,
|
|
269
271
|
plugins: [],
|
|
270
272
|
publicPath: '/',
|
|
271
273
|
proxy: undefined,
|