swico 2.1.0-beta.2 → 2.1.0-beta.4
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.4",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -44,8 +44,8 @@
|
|
|
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
|
-
"postcss-preset-env": "9.3.0",
|
|
49
49
|
"qs": "6.13.0",
|
|
50
50
|
"react-router": "7.5.0",
|
|
51
51
|
"sass-embedded": "1.86.3",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"webpack-merge": "6.0.1"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
|
-
"@rspack/core": "1.3.5",
|
|
64
63
|
"@eslint/js": "9.24.0",
|
|
64
|
+
"@rspack/core": "1.3.5",
|
|
65
65
|
"@types/node": "22.13.10",
|
|
66
66
|
"@types/react": "19.1.0",
|
|
67
67
|
"@types/react-dom": "19.1.0",
|
|
@@ -48,6 +48,20 @@ export default function ({ projectPath, entryPath, env, customConfig }: GlobalDa
|
|
|
48
48
|
oneOf?: undefined;
|
|
49
49
|
} | {
|
|
50
50
|
oneOf: ({
|
|
51
|
+
test: RegExp;
|
|
52
|
+
type: string;
|
|
53
|
+
use: {
|
|
54
|
+
loader: string;
|
|
55
|
+
options: {
|
|
56
|
+
postcssOptions: {
|
|
57
|
+
plugins: string[][];
|
|
58
|
+
config: string;
|
|
59
|
+
};
|
|
60
|
+
};
|
|
61
|
+
}[];
|
|
62
|
+
generator?: undefined;
|
|
63
|
+
loader?: undefined;
|
|
64
|
+
} | {
|
|
51
65
|
test: RegExp;
|
|
52
66
|
type: string;
|
|
53
67
|
use: (string | {
|
|
@@ -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,13 +96,14 @@ 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,
|
|
102
103
|
options: {
|
|
103
104
|
postcssOptions: {
|
|
104
|
-
plugins: [['autoprefixer']]
|
|
105
|
+
plugins: [['autoprefixer']],
|
|
106
|
+
config: path_1.default.join(projectPath, '/postcss.config.mjs')
|
|
105
107
|
}
|
|
106
108
|
}
|
|
107
109
|
}
|
|
@@ -109,7 +111,7 @@ function default_1(_a) {
|
|
|
109
111
|
},
|
|
110
112
|
{
|
|
111
113
|
test: /\.less$/,
|
|
112
|
-
type:
|
|
114
|
+
type: cssMode,
|
|
113
115
|
use: [
|
|
114
116
|
{
|
|
115
117
|
loader: postcssLoader,
|
|
@@ -124,7 +126,7 @@ function default_1(_a) {
|
|
|
124
126
|
},
|
|
125
127
|
{
|
|
126
128
|
test: /\.scss$/,
|
|
127
|
-
type:
|
|
129
|
+
type: cssMode,
|
|
128
130
|
use: [
|
|
129
131
|
{
|
|
130
132
|
loader: postcssLoader,
|
|
@@ -186,7 +188,7 @@ function default_1(_a) {
|
|
|
186
188
|
},
|
|
187
189
|
hash: true
|
|
188
190
|
}),
|
|
189
|
-
...((customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins)
|
|
191
|
+
...((_h = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) !== null && _h !== void 0 ? _h : config_1.initConfig.plugins)
|
|
190
192
|
]
|
|
191
193
|
};
|
|
192
194
|
});
|
|
@@ -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,
|