swico 2.3.0 → 2.4.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "swico",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.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",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"license": "ISC",
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"@rspack/dev-server": "1.1.4",
|
|
33
|
-
"@vue/compiler-sfc": "3.5.
|
|
33
|
+
"@vue/compiler-sfc": "3.5.23",
|
|
34
34
|
"chalk": "4.1.2",
|
|
35
35
|
"chokidar": "3.6.0",
|
|
36
36
|
"commander": "12.0.0",
|
|
@@ -60,18 +60,18 @@
|
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@eslint/js": "9.24.0",
|
|
63
|
-
"@rspack/core": "1.
|
|
63
|
+
"@rspack/core": "1.6.1",
|
|
64
64
|
"@types/node": "22.13.10",
|
|
65
|
-
"@types/react": "19.
|
|
66
|
-
"@types/react-dom": "19.
|
|
65
|
+
"@types/react": "~19.2.0",
|
|
66
|
+
"@types/react-dom": "~19.2.0",
|
|
67
67
|
"eslint": "9.24.0",
|
|
68
68
|
"globals": "16.0.0",
|
|
69
69
|
"prettier": "3.5.3",
|
|
70
|
-
"react": "~19.
|
|
71
|
-
"react-dom": "~19.
|
|
70
|
+
"react": "~19.2.0",
|
|
71
|
+
"react-dom": "~19.2.0",
|
|
72
72
|
"typescript": "5.8.3",
|
|
73
73
|
"typescript-eslint": "8.30.1",
|
|
74
|
-
"vue": "~3.5.
|
|
74
|
+
"vue": "~3.5.23"
|
|
75
75
|
},
|
|
76
76
|
"engines": {
|
|
77
77
|
"node": ">=20.0.0"
|
package/src/index.react.d.ts
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import { GlobalData, GlobalSwicoConfigType } from './utils/config';
|
|
2
|
-
import { CSSProperties, FC, ReactNode } from 'react';
|
|
3
2
|
export type CustomConfigType = GlobalData['customConfig'];
|
|
4
3
|
export type { GlobalSwicoConfigType };
|
|
5
|
-
export
|
|
6
|
-
replace?: boolean;
|
|
7
|
-
to: string;
|
|
8
|
-
style?: CSSProperties;
|
|
9
|
-
className?: string;
|
|
10
|
-
children: ReactNode;
|
|
11
|
-
}>;
|
|
4
|
+
export { default as Link } from './project-path/.swico-react/Link';
|
|
12
5
|
export { Outlet } from 'react-router';
|
|
13
6
|
export { useLocation, useNav } from './project-path/.swico-react/react-hooks';
|
|
14
7
|
export { history } from './mock-history';
|
package/src/index.react.js
CHANGED
|
@@ -4,12 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.defineGlobal = exports.defineConfig = exports.history = exports.useNav = exports.useLocation = exports.Outlet = exports.Link = void 0;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
exports.
|
|
11
|
-
var react_router_2 = require("react-router");
|
|
12
|
-
Object.defineProperty(exports, "Outlet", { enumerable: true, get: function () { return react_router_2.Outlet; } });
|
|
7
|
+
var Link_1 = require("./project-path/.swico-react/Link");
|
|
8
|
+
Object.defineProperty(exports, "Link", { enumerable: true, get: function () { return __importDefault(Link_1).default; } });
|
|
9
|
+
var react_router_1 = require("react-router");
|
|
10
|
+
Object.defineProperty(exports, "Outlet", { enumerable: true, get: function () { return react_router_1.Outlet; } });
|
|
13
11
|
var react_hooks_1 = require("./project-path/.swico-react/react-hooks");
|
|
14
12
|
Object.defineProperty(exports, "useLocation", { enumerable: true, get: function () { return react_hooks_1.useLocation; } });
|
|
15
13
|
Object.defineProperty(exports, "useNav", { enumerable: true, get: function () { return react_hooks_1.useNav; } });
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CSSProperties, FC, ReactNode } from 'react';
|
|
2
|
+
import { UseNavType } from '../../typings/global-type';
|
|
3
|
+
declare const Link: FC<{
|
|
4
|
+
replace?: boolean;
|
|
5
|
+
to: Parameters<ReturnType<UseNavType>>[0];
|
|
6
|
+
style?: CSSProperties;
|
|
7
|
+
className?: string;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}>;
|
|
10
|
+
export default Link;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const react_hooks_1 = require("./react-hooks");
|
|
8
|
+
const Link = ({ replace, to, style, className, children }) => {
|
|
9
|
+
const nav = (0, react_hooks_1.useNav)();
|
|
10
|
+
return (react_1.default.createElement("a", { onClick: () => {
|
|
11
|
+
nav(to, { replace });
|
|
12
|
+
}, style: style, className: className }, children));
|
|
13
|
+
};
|
|
14
|
+
exports.default = Link;
|
package/src/utils/config.js
CHANGED
|
@@ -143,6 +143,18 @@ const initCliIndexFile = (templateType, env) => __awaiter(void 0, void 0, void 0
|
|
|
143
143
|
.replaceAll('\\', '/');
|
|
144
144
|
replaceFileText = replaceFileText.replaceAll('require("./project-path/.swico-react/react-hooks");', `require("${formatHooksPath}");`);
|
|
145
145
|
}
|
|
146
|
+
if (templateType === 'react') {
|
|
147
|
+
const formatHooksPath = path_1.default
|
|
148
|
+
.resolve(projectPath, './.swico/react-hooks')
|
|
149
|
+
.replaceAll('\\', '/');
|
|
150
|
+
replaceFileText = replaceFileText.replaceAll('require("./project-path/.swico-react/react-hooks");', `require("${formatHooksPath}");`);
|
|
151
|
+
}
|
|
152
|
+
if (templateType === 'react') {
|
|
153
|
+
const formatLinkComponentPath = path_1.default
|
|
154
|
+
.resolve(projectPath, './.swico/Link')
|
|
155
|
+
.replaceAll('\\', '/');
|
|
156
|
+
replaceFileText = replaceFileText.replaceAll('require("./project-path/.swico-react/Link");', `require("${formatLinkComponentPath}");`);
|
|
157
|
+
}
|
|
146
158
|
const formatHistoryPath = path_1.default
|
|
147
159
|
.resolve(projectPath, `./.swico/.${env}/history`)
|
|
148
160
|
.replaceAll('\\', '/');
|
|
@@ -240,7 +252,13 @@ const initTemplateConfig = (routerConfig, templateType, env) => {
|
|
|
240
252
|
(templateType === 'vue'
|
|
241
253
|
? !['Container.js', 'vue-hooks.js'].includes(fileName)
|
|
242
254
|
: !['react-hooks.js'].includes(fileName)));
|
|
243
|
-
yield (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, `../project-path/.swico-${templateType}`), path_1.default.resolve(projectPath, './.swico'), (fileName) => [
|
|
255
|
+
yield (0, tools_1.copyDirFiles)(path_1.default.resolve(__dirname, `../project-path/.swico-${templateType}`), path_1.default.resolve(projectPath, './.swico'), (fileName) => [
|
|
256
|
+
'react-hooks.js',
|
|
257
|
+
'vue-hooks.js',
|
|
258
|
+
'Link.js',
|
|
259
|
+
'loading.js',
|
|
260
|
+
'Container.vue'
|
|
261
|
+
].includes(fileName));
|
|
244
262
|
yield formatRouterConfig(routerConfig, templateType, env);
|
|
245
263
|
let replaceIndexText = yield fs_extra_1.default.readFile(path_1.default.resolve(projectPath, `./.swico${envPath}index.js`), 'utf8');
|
|
246
264
|
const hooksFilePath = path_1.default.resolve(projectPath, `./.swico/${templateType}-hooks.js`);
|