swico 3.0.0 → 3.1.0-beta.2
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 +2 -2
- package/src/main-config/index.d.ts +5 -3
- package/src/main-config/index.js +3 -1
- package/src/rsbuild-config/config.base.react.js +7 -4
- package/src/rsbuild-config/config.dev.js +4 -3
- package/src/template-root/src/layout/index.d.ts +2 -2
- package/src/template-root/src/layout/index.js +2 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swico",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.1.0-beta.2",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
},
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@eslint/js": "9.39.4",
|
|
69
|
-
"@rsbuild/core": "^2.
|
|
69
|
+
"@rsbuild/core": "^2.2.5",
|
|
70
70
|
"@types/node": "22.19.18",
|
|
71
71
|
"@types/react": "~19.2.14",
|
|
72
72
|
"@types/react-dom": "~19.2.3",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProxyOptions, RsbuildPlugin, RsbuildPlugins, Rspack } from '@rsbuild/core';
|
|
2
|
-
import { Falsy } from '@rsbuild/core/dist
|
|
2
|
+
import { Falsy } from '@rsbuild/core/dist/types';
|
|
3
3
|
export type ConfigRoutesItemType = {
|
|
4
4
|
component?: string;
|
|
5
5
|
children?: ConfigRoutesItemType[];
|
|
@@ -29,6 +29,8 @@ export interface GlobalSwicoConfigType {
|
|
|
29
29
|
devtool?: Rspack.Configuration['devtool'];
|
|
30
30
|
externals?: any;
|
|
31
31
|
router?: ConfigRouterType;
|
|
32
|
+
port?: number;
|
|
33
|
+
reactCompiler?: boolean;
|
|
32
34
|
}
|
|
33
35
|
export interface GlobalDataType {
|
|
34
36
|
templateType?: GlobalSwicoConfigType['template'];
|
|
@@ -37,8 +39,8 @@ export interface GlobalDataType {
|
|
|
37
39
|
templatePath: string;
|
|
38
40
|
env?: 'dev' | 'prod';
|
|
39
41
|
customConfig: {
|
|
40
|
-
base: Pick<GlobalSwicoConfigType, 'plugins' | 'publicPath' | 'alias' | 'define' | 'devtool' | 'externals' | 'router' | 'template'>;
|
|
41
|
-
dev: Pick<GlobalSwicoConfigType, 'plugins' | 'proxy' | 'https' | 'devtool' | 'router' | 'responseHeaders'>;
|
|
42
|
+
base: Pick<GlobalSwicoConfigType, 'plugins' | 'publicPath' | 'alias' | 'define' | 'devtool' | 'externals' | 'router' | 'template' | 'reactCompiler'>;
|
|
43
|
+
dev: Pick<GlobalSwicoConfigType, 'plugins' | 'proxy' | 'https' | 'devtool' | 'router' | 'responseHeaders' | 'port'>;
|
|
42
44
|
prod: Pick<GlobalSwicoConfigType, 'plugins' | 'console' | 'copy' | 'devtool' | 'router'>;
|
|
43
45
|
};
|
|
44
46
|
}
|
package/src/main-config/index.js
CHANGED
|
@@ -284,6 +284,7 @@ exports.getFormatDefineVars = getFormatDefineVars;
|
|
|
284
284
|
exports.initConfig = {
|
|
285
285
|
console: true,
|
|
286
286
|
plugins: [],
|
|
287
|
+
port: 3000,
|
|
287
288
|
publicPath: '/',
|
|
288
289
|
proxy: undefined,
|
|
289
290
|
responseHeaders: undefined,
|
|
@@ -292,7 +293,8 @@ exports.initConfig = {
|
|
|
292
293
|
base: '/',
|
|
293
294
|
type: 'browser',
|
|
294
295
|
routes: []
|
|
295
|
-
}
|
|
296
|
+
},
|
|
297
|
+
reactCompiler: false
|
|
296
298
|
};
|
|
297
299
|
exports.customLogger = (0, core_1.createLogger)();
|
|
298
300
|
exports.customLogger.override({
|
|
@@ -20,7 +20,7 @@ const plugin_less_1 = require("@rsbuild/plugin-less");
|
|
|
20
20
|
const plugin_sass_1 = require("@rsbuild/plugin-sass");
|
|
21
21
|
function default_1(_a) {
|
|
22
22
|
return __awaiter(this, arguments, void 0, function* ({ projectPath, entryPath, env, customConfig }) {
|
|
23
|
-
var _b, _c, _d, _e, _f;
|
|
23
|
+
var _b, _c, _d, _e, _f, _g;
|
|
24
24
|
const customBaseConfig = customConfig.base;
|
|
25
25
|
const getCustomAliasConfig = () => {
|
|
26
26
|
const { alias } = customBaseConfig || {};
|
|
@@ -34,13 +34,14 @@ function default_1(_a) {
|
|
|
34
34
|
};
|
|
35
35
|
const publicPath = (_b = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.publicPath) !== null && _b !== void 0 ? _b : main_config_1.initConfig.publicPath;
|
|
36
36
|
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 : main_config_1.initConfig.router.base;
|
|
37
|
+
const reactCompiler = (_e = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.reactCompiler) !== null && _e !== void 0 ? _e : main_config_1.initConfig.reactCompiler;
|
|
37
38
|
const initialDefineVarsConfig = {
|
|
38
39
|
SWICO_ENV: JSON.stringify(env),
|
|
39
40
|
SWICO_ROUTER_BASE: JSON.stringify(routerBase),
|
|
40
41
|
SWICO_PUBLIC_PATH: JSON.stringify(publicPath),
|
|
41
42
|
SWICO_STATIC_PUBLIC_PATH: JSON.stringify(env === 'prod' ? publicPath : '/')
|
|
42
43
|
};
|
|
43
|
-
const customDefineVarsConfig = yield (0, main_config_1.getFormatDefineVars)((
|
|
44
|
+
const customDefineVarsConfig = yield (0, main_config_1.getFormatDefineVars)((_f = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.define) !== null && _f !== void 0 ? _f : {});
|
|
44
45
|
return {
|
|
45
46
|
source: {
|
|
46
47
|
entry: {
|
|
@@ -96,10 +97,12 @@ function default_1(_a) {
|
|
|
96
97
|
templateParameters: initialDefineVarsConfig
|
|
97
98
|
},
|
|
98
99
|
plugins: [
|
|
99
|
-
(0, plugin_react_1.pluginReact)(
|
|
100
|
+
(0, plugin_react_1.pluginReact)({
|
|
101
|
+
reactCompiler
|
|
102
|
+
}),
|
|
100
103
|
(0, plugin_sass_1.pluginSass)(),
|
|
101
104
|
(0, plugin_less_1.pluginLess)(),
|
|
102
|
-
...((
|
|
105
|
+
...((_g = customBaseConfig === null || customBaseConfig === void 0 ? void 0 : customBaseConfig.plugins) !== null && _g !== void 0 ? _g : main_config_1.initConfig.plugins)
|
|
103
106
|
]
|
|
104
107
|
};
|
|
105
108
|
});
|
|
@@ -55,7 +55,7 @@ const core_1 = require("@rsbuild/core");
|
|
|
55
55
|
const plugin_basic_ssl_1 = require("@rsbuild/plugin-basic-ssl");
|
|
56
56
|
function default_1(options) {
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
58
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
|
|
59
59
|
const { projectPath, customConfig, templateType, entryPath, env } = options;
|
|
60
60
|
const getBaseConfig = (yield Promise.resolve(`${templateType === 'vue' ? './config.base.vue' : './config.base.react'}`).then(s => __importStar(require(s)))).default;
|
|
61
61
|
const publicPath = (_b = (_a = customConfig === null || customConfig === void 0 ? void 0 : customConfig.base) === null || _a === void 0 ? void 0 : _a.publicPath) !== null && _b !== void 0 ? _b : main_config_1.initConfig.publicPath;
|
|
@@ -68,7 +68,8 @@ function default_1(options) {
|
|
|
68
68
|
compress: true,
|
|
69
69
|
headers: (_e = (_d = customConfig === null || customConfig === void 0 ? void 0 : customConfig.dev) === null || _d === void 0 ? void 0 : _d.responseHeaders) !== null && _e !== void 0 ? _e : main_config_1.initConfig.responseHeaders,
|
|
70
70
|
proxy: (_g = (_f = customConfig === null || customConfig === void 0 ? void 0 : customConfig.dev) === null || _f === void 0 ? void 0 : _f.proxy) !== null && _g !== void 0 ? _g : main_config_1.initConfig.proxy,
|
|
71
|
-
open: false
|
|
71
|
+
open: false,
|
|
72
|
+
port: (_j = (_h = customConfig === null || customConfig === void 0 ? void 0 : customConfig.dev) === null || _h === void 0 ? void 0 : _h.port) !== null && _j !== void 0 ? _j : main_config_1.initConfig.port
|
|
72
73
|
},
|
|
73
74
|
performance: {
|
|
74
75
|
buildCache: true
|
|
@@ -119,7 +120,7 @@ function default_1(options) {
|
|
|
119
120
|
cache: true
|
|
120
121
|
}
|
|
121
122
|
}),
|
|
122
|
-
...((
|
|
123
|
+
...((_l = (_k = customConfig.dev) === null || _k === void 0 ? void 0 : _k.plugins) !== null && _l !== void 0 ? _l : [])
|
|
123
124
|
]
|
|
124
125
|
});
|
|
125
126
|
});
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
declare const
|
|
3
|
-
export default
|
|
2
|
+
declare const Layout: () => React.JSX.Element;
|
|
3
|
+
export default Layout;
|
|
@@ -5,4 +5,5 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_router_1 = require("react-router");
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
|
-
|
|
8
|
+
const Layout = () => react_1.default.createElement(react_router_1.Outlet, null);
|
|
9
|
+
exports.default = Layout;
|