swico 3.0.0-beta.4 → 3.0.0-beta.6
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 -1
- package/src/command/build.js +0 -6
- package/src/command/start.js +7 -0
- package/src/index.d.ts +2 -3
- package/src/index.react.d.ts +2 -2
- package/src/index.vue.d.ts +1 -1
- package/src/main-config/index.d.ts +6 -7
- package/src/main-config/index.js +1 -1
- package/src/rsbuild-config/config.dev.js +6 -4
- package/src/rsbuild-config/config.prod.js +13 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swico",
|
|
3
|
-
"version": "3.0.0-beta.
|
|
3
|
+
"version": "3.0.0-beta.6",
|
|
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
|
"author": "scw",
|
|
45
45
|
"license": "ISC",
|
|
46
46
|
"dependencies": {
|
|
47
|
+
"@esctn/vue-tsc-api": "^1.0.1",
|
|
47
48
|
"@rsbuild/plugin-basic-ssl": "^1.2.2",
|
|
48
49
|
"@rsbuild/plugin-eslint": "^1.3.0",
|
|
49
50
|
"@rsbuild/plugin-less": "^1.6.2",
|
|
@@ -51,6 +52,7 @@
|
|
|
51
52
|
"@rsbuild/plugin-sass": "^1.5.1",
|
|
52
53
|
"@rsbuild/plugin-type-check": "^1.3.4",
|
|
53
54
|
"@rsbuild/plugin-vue": "^1.2.7",
|
|
55
|
+
"@rsdoctor/rspack-plugin": "^1.5.7",
|
|
54
56
|
"chalk": "4.1.2",
|
|
55
57
|
"chokidar": "3.6.0",
|
|
56
58
|
"commander": "12.0.0",
|
package/src/command/build.js
CHANGED
|
@@ -18,8 +18,6 @@ const main_config_1 = require("../main-config");
|
|
|
18
18
|
const utils_1 = require("../utils");
|
|
19
19
|
const package_json_1 = __importDefault(require("../../package.json"));
|
|
20
20
|
const core_1 = require("@rsbuild/core");
|
|
21
|
-
const chalk_1 = __importDefault(require("chalk"));
|
|
22
|
-
const isAnalyze = process.env.ANALYZE === 'true';
|
|
23
21
|
function default_1() {
|
|
24
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
23
|
process.env.SWICO_ENV = 'prod';
|
|
@@ -52,9 +50,5 @@ function default_1() {
|
|
|
52
50
|
utils_1.toast.info('Building...');
|
|
53
51
|
now = Date.now();
|
|
54
52
|
yield rsbuild.build();
|
|
55
|
-
if (isAnalyze) {
|
|
56
|
-
const { urls, port } = yield rsbuild.preview();
|
|
57
|
-
utils_1.toast.info(`Bundle analysis is running at:${chalk_1.default.hex('#29abe0')}${urls[0]}`);
|
|
58
|
-
}
|
|
59
53
|
});
|
|
60
54
|
}
|
package/src/command/start.js
CHANGED
|
@@ -138,6 +138,13 @@ function start() {
|
|
|
138
138
|
(SWICO_DEV_RESTART === 'true' && newRouterBase !== SWICO_DEV_ROUTER_BASE)) {
|
|
139
139
|
utils_1.toast.info(`Project is running at:${chalk_1.default.hex('#29abe0')(`${customConfig.dev.https ? 'https' : 'http'}://localhost:${rsbuild.context.devServer.port}${newRouterBase}`)}`);
|
|
140
140
|
}
|
|
141
|
+
const proxyConfig = startConfig.server.proxy;
|
|
142
|
+
if (proxyConfig &&
|
|
143
|
+
(Array.isArray(proxyConfig)
|
|
144
|
+
? proxyConfig.length > 0
|
|
145
|
+
: Object.keys(proxyConfig).length > 0)) {
|
|
146
|
+
utils_1.toast.info('Proxy service is enabled');
|
|
147
|
+
}
|
|
141
148
|
currentRouterBase = newRouterBase;
|
|
142
149
|
}
|
|
143
150
|
catch (e) {
|
package/src/index.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import { GlobalDataType
|
|
1
|
+
import { GlobalDataType } from './main-config';
|
|
2
2
|
import { UseLocationType, UseNavType } from './typings/global-type';
|
|
3
3
|
import { App } from 'vue';
|
|
4
4
|
import { Router } from 'vue-router';
|
|
5
5
|
export type CustomConfigType = GlobalDataType['customConfig'];
|
|
6
|
-
export type
|
|
6
|
+
export type { ConfigRoutesItemType, GlobalSwicoConfigType, GlobalDataType, ConfigRouterType } from './main-config';
|
|
7
7
|
export type * from './typings/global-type';
|
|
8
|
-
export type { GlobalSwicoConfigType };
|
|
9
8
|
export { history } from './mock-history';
|
|
10
9
|
declare let Outlet: any, Link: any, useLocation: UseLocationType, useNav: UseNavType;
|
|
11
10
|
export { Outlet, Link, useLocation, useNav };
|
package/src/index.react.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { GlobalDataType } from './main-config';
|
|
|
2
2
|
import { CSSProperties, FC, ReactNode } from 'react';
|
|
3
3
|
import { SwicoHistoryOptionType } from './typings/global-type';
|
|
4
4
|
import { useLocation, useNav } from './template-root/.swico-react/hooks';
|
|
5
|
-
export type CustomConfigType = GlobalDataType['customConfig'];
|
|
6
5
|
export type * from './typings/global-type';
|
|
7
|
-
export type
|
|
6
|
+
export type { ConfigRoutesItemType, GlobalSwicoConfigType, GlobalDataType, ConfigRouterType } from './main-config';
|
|
7
|
+
export type CustomConfigType = GlobalDataType['customConfig'];
|
|
8
8
|
interface LinkPropsType {
|
|
9
9
|
replace?: boolean;
|
|
10
10
|
to: string | number | SwicoHistoryOptionType;
|
package/src/index.vue.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { RouterView } from 'vue-router';
|
|
|
8
8
|
export { useLocation, useNav };
|
|
9
9
|
export { history } from './mock-history';
|
|
10
10
|
export type * from './typings/global-type';
|
|
11
|
-
export type
|
|
11
|
+
export type { ConfigRoutesItemType, GlobalSwicoConfigType, GlobalDataType, ConfigRouterType } from './main-config';
|
|
12
12
|
export declare const Outlet: import("vue").DefineComponent<{}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
|
|
13
13
|
interface LinkPropsType {
|
|
14
14
|
replace?: boolean;
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { ProxyOptions, RsbuildPlugin, RsbuildPlugins, Rspack } from '@rsbuild/core';
|
|
2
|
+
import { Falsy } from '@rsbuild/core/dist-types/types';
|
|
1
3
|
export type ConfigRoutesItemType = {
|
|
2
4
|
component?: string;
|
|
3
5
|
children?: ConfigRoutesItemType[];
|
|
@@ -15,19 +17,16 @@ export type ConfigRouterType = {
|
|
|
15
17
|
};
|
|
16
18
|
export interface GlobalSwicoConfigType {
|
|
17
19
|
template: 'react' | 'vue';
|
|
18
|
-
plugins?:
|
|
20
|
+
plugins?: (RsbuildPlugin | Falsy | Promise<RsbuildPlugin | Falsy | RsbuildPlugins> | RsbuildPlugins)[];
|
|
19
21
|
publicPath?: string;
|
|
20
22
|
console?: boolean;
|
|
21
23
|
define?: Record<string, any>;
|
|
22
24
|
alias?: Record<string, any>;
|
|
23
|
-
proxy?:
|
|
25
|
+
proxy?: ProxyOptions[] | Record<string, string | ProxyOptions>;
|
|
24
26
|
https?: boolean;
|
|
25
27
|
responseHeaders?: Record<string, any>;
|
|
26
|
-
copy?:
|
|
27
|
-
|
|
28
|
-
to: string;
|
|
29
|
-
}>;
|
|
30
|
-
devtool?: string;
|
|
28
|
+
copy?: Rspack.CopyRspackPluginOptions | Rspack.CopyRspackPluginOptions['patterns'];
|
|
29
|
+
devtool?: Rspack.Configuration['devtool'];
|
|
31
30
|
externals?: any;
|
|
32
31
|
router?: ConfigRouterType;
|
|
33
32
|
}
|
package/src/main-config/index.js
CHANGED
|
@@ -61,7 +61,7 @@ const getFormatRouter = (projectPath, routes, templateType) => {
|
|
|
61
61
|
component: component
|
|
62
62
|
? `()=>import('${projectPath}/src/pages/${component}${templateType === 'vue' ? '.vue' : ''}')`
|
|
63
63
|
: undefined,
|
|
64
|
-
name
|
|
64
|
+
name: `decorator-outlet-${name}`,
|
|
65
65
|
redirect,
|
|
66
66
|
children: children ? children === null || children === void 0 ? void 0 : children.map((item) => _main(item)) : undefined
|
|
67
67
|
}
|
|
@@ -67,17 +67,16 @@ function default_1(options) {
|
|
|
67
67
|
base: publicPath,
|
|
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
|
-
historyApiFallback: {
|
|
71
|
-
index: `${baseConfig.output.publicPath}index.html`
|
|
72
|
-
},
|
|
73
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,
|
|
74
71
|
open: false
|
|
75
72
|
},
|
|
73
|
+
performance: {
|
|
74
|
+
buildCache: true
|
|
75
|
+
},
|
|
76
76
|
dev: {
|
|
77
77
|
client: {
|
|
78
78
|
overlay: false,
|
|
79
79
|
logLevel: 'error',
|
|
80
|
-
hmr: true,
|
|
81
80
|
lazyCompilation: true,
|
|
82
81
|
progress: false
|
|
83
82
|
},
|
|
@@ -101,6 +100,9 @@ function default_1(options) {
|
|
|
101
100
|
error: (message) => {
|
|
102
101
|
utils_1.toast.error(message, { title: 'TypeScript errors' });
|
|
103
102
|
}
|
|
103
|
+
},
|
|
104
|
+
typescript: {
|
|
105
|
+
typescriptPath: templateType === 'vue' ? '@esctn/vue-tsc-api' : undefined
|
|
104
106
|
}
|
|
105
107
|
}
|
|
106
108
|
}),
|
|
@@ -45,6 +45,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
45
45
|
exports.default = default_1;
|
|
46
46
|
const main_config_1 = require("../main-config");
|
|
47
47
|
const core_1 = require("@rsbuild/core");
|
|
48
|
+
const rspack_plugin_1 = require("@rsdoctor/rspack-plugin");
|
|
49
|
+
const isAnalyze = process.env.ANALYZE === 'true';
|
|
48
50
|
function default_1(options) {
|
|
49
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
52
|
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
@@ -55,7 +57,7 @@ function default_1(options) {
|
|
|
55
57
|
const copyConfig = (_d = (_c = customConfig.prod) === null || _c === void 0 ? void 0 : _c.copy) !== null && _d !== void 0 ? _d : main_config_1.initConfig.copy;
|
|
56
58
|
return (0, core_1.mergeRsbuildConfig)(baseConfig, {
|
|
57
59
|
output: {
|
|
58
|
-
copy: copyConfig
|
|
60
|
+
copy: copyConfig,
|
|
59
61
|
sourceMap: {
|
|
60
62
|
js: (_f = (_e = customConfig.prod.devtool) !== null && _e !== void 0 ? _e : customConfig.base.devtool) !== null && _f !== void 0 ? _f : false,
|
|
61
63
|
css: false,
|
|
@@ -63,9 +65,18 @@ function default_1(options) {
|
|
|
63
65
|
}
|
|
64
66
|
},
|
|
65
67
|
performance: {
|
|
66
|
-
removeConsole: !consoleAvailable
|
|
68
|
+
removeConsole: !consoleAvailable,
|
|
69
|
+
buildCache: true
|
|
67
70
|
},
|
|
68
71
|
mode: 'production',
|
|
72
|
+
tools: {
|
|
73
|
+
rspack: {
|
|
74
|
+
plugins: [
|
|
75
|
+
isAnalyze &&
|
|
76
|
+
new rspack_plugin_1.RsdoctorRspackPlugin({})
|
|
77
|
+
]
|
|
78
|
+
}
|
|
79
|
+
},
|
|
69
80
|
plugins: [...((_h = (_g = customConfig.prod) === null || _g === void 0 ? void 0 : _g.plugins) !== null && _h !== void 0 ? _h : [])]
|
|
70
81
|
});
|
|
71
82
|
});
|