swico 3.0.0-beta.4 → 3.0.0-beta.5

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": "3.0.0-beta.4",
3
+ "version": "3.0.0-beta.5",
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",
@@ -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
  }
@@ -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, GlobalSwicoConfigType } from './main-config';
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 * from './main-config';
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 };
@@ -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 * from './main-config';
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;
@@ -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 * from './main-config';
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?: any[];
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?: Array<Record<string, any>>;
25
+ proxy?: ProxyOptions[] | Record<string, string | ProxyOptions>;
24
26
  https?: boolean;
25
27
  responseHeaders?: Record<string, any>;
26
- copy?: Array<string | {
27
- from: string;
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
  }
@@ -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
  }
@@ -73,6 +73,9 @@ function default_1(options) {
73
73
  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
74
  open: false
75
75
  },
76
+ performance: {
77
+ buildCache: true
78
+ },
76
79
  dev: {
77
80
  client: {
78
81
  overlay: false,
@@ -101,6 +104,9 @@ function default_1(options) {
101
104
  error: (message) => {
102
105
  utils_1.toast.error(message, { title: 'TypeScript errors' });
103
106
  }
107
+ },
108
+ typescript: {
109
+ typescriptPath: templateType === 'vue' ? '@esctn/vue-tsc-api' : undefined
104
110
  }
105
111
  }
106
112
  }),
@@ -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.length > 0 ? [...(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,20 @@ function default_1(options) {
63
65
  }
64
66
  },
65
67
  performance: {
66
- removeConsole: !consoleAvailable
68
+ removeConsole: !consoleAvailable,
69
+ performance: {
70
+ buildCache: true
71
+ }
67
72
  },
68
73
  mode: 'production',
74
+ tools: {
75
+ rspack: {
76
+ plugins: [
77
+ isAnalyze &&
78
+ new rspack_plugin_1.RsdoctorRspackPlugin({})
79
+ ]
80
+ }
81
+ },
69
82
  plugins: [...((_h = (_g = customConfig.prod) === null || _g === void 0 ? void 0 : _g.plugins) !== null && _h !== void 0 ? _h : [])]
70
83
  });
71
84
  });