swico 0.7.2 → 0.7.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": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "Simple, efficient, and practical front-end framework",
|
|
5
5
|
"main": "./src/index.js",
|
|
6
6
|
"types": "./src/index.d.ts",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"react": "~18.2.0",
|
|
34
34
|
"react-dom": "~18.2.0",
|
|
35
|
-
"react-router-dom": "6.
|
|
35
|
+
"react-router-dom": "6.22.3",
|
|
36
36
|
"vue": "~3.4.14",
|
|
37
37
|
"vue-router": "^4.2.5",
|
|
38
38
|
"history": "5.3.0"
|
|
39
39
|
},
|
|
40
40
|
"devDependencies": {
|
|
41
|
-
"@types/react": "18.2.
|
|
42
|
-
"@types/react-dom": "18.2.
|
|
41
|
+
"@types/react": "18.2.79",
|
|
42
|
+
"@types/react-dom": "18.2.25",
|
|
43
43
|
"@vue/compiler-sfc": "3.4.14",
|
|
44
44
|
"eslint-plugin-react": "7.33.2",
|
|
45
45
|
"eslint-plugin-react-hooks": "4.3.0",
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react';
|
|
2
|
+
import type { History } from '@remix-run/router';
|
|
3
|
+
interface PropsType {
|
|
4
|
+
basename?: string;
|
|
5
|
+
children: ReactNode;
|
|
6
|
+
history: History;
|
|
7
|
+
}
|
|
8
|
+
declare const HistoryRouter: React.FC<PropsType>;
|
|
9
|
+
export default HistoryRouter;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
var react_1 = __importStar(require("react"));
|
|
27
|
+
var react_router_dom_1 = require("react-router-dom");
|
|
28
|
+
var HistoryRouter = function (props) {
|
|
29
|
+
var basename = props.basename, children = props.children, history = props.history;
|
|
30
|
+
var _a = (0, react_1.useState)({
|
|
31
|
+
action: history.action,
|
|
32
|
+
location: history.location
|
|
33
|
+
}), state = _a[0], setState = _a[1];
|
|
34
|
+
react_1.default.useLayoutEffect(function () { return history.listen(setState); }, [history]);
|
|
35
|
+
return react_1.default.createElement(react_router_dom_1.Router, {
|
|
36
|
+
basename: basename,
|
|
37
|
+
children: children,
|
|
38
|
+
location: state.location,
|
|
39
|
+
navigationType: state.action,
|
|
40
|
+
navigator: history
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
exports.default = HistoryRouter;
|
package/README.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# SWICO介绍
|
|
2
|
-
|
|
3
|
-
Swico,发音类似于“斯威扣”。
|
|
4
|
-
|
|
5
|
-
为个人独立开发的一款实用的前端框架,它基于前端工程化最新技术栈实现了前端开发从创建项目,获取模板,本地开发,Git提交校验到打包构建的完整过程。
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
## 主要特性
|
|
9
|
-
|
|
10
|
-
- 构建工具基于[Webpack5],并配合[esbuild-loader]和[swc-loader]提升编译构建速率。
|
|
11
|
-
|
|
12
|
-
- 提供[Vue3]和[React18]两种开发模板选择,默认集成[TypeScript5]。同时最大化统一这两种模板的开发API。
|
|
13
|
-
|
|
14
|
-
- 提供可配置化路由方案,基于[React-Router6]和[Vue-Router4]进行二次封装,支持路由嵌套,懒加载,动态参数,装饰校验等功能。
|
|
15
|
-
|
|
16
|
-
- 内置[ESLint] + [Prettier] + [Husky]三大前端编码风格以及代码提交规范约束插件,保证代码风格统一以及 Git 提交规范。
|
|
17
|
-
|
|
18
|
-
- 提供配置文件可对部分项目配置进行修改扩展,例如Alias映射,本地请求代理等。
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
详见:[SWICO 官方文档](http://fanlaboy.gitee.io/swico-docs)
|