swico 0.6.1 → 0.6.2-beta1
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 +1 -1
- package/src/index.react.d.ts +1 -0
- package/src/index.react.js +3 -1
- package/src/index.vue.d.ts +1 -0
- package/src/index.vue.js +3 -1
- package/src/template/react/$env/index.d.ts +1 -0
- package/src/template/react/$env/index.js +4 -2
- package/src/template/vue/$env/index.d.ts +1 -1
- package/src/template/vue/$env/index.js +3 -1
package/package.json
CHANGED
package/src/index.react.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare const Link: FC<{
|
|
|
11
11
|
}>;
|
|
12
12
|
export { Outlet } from 'react-router-dom';
|
|
13
13
|
export { useLocation } from './template/react/react-hooks';
|
|
14
|
+
export { history } from './template/react/$env/index';
|
|
14
15
|
export interface DefineSwicoConfigType {
|
|
15
16
|
(env: 'base', config: CustomConfigType['base']): any;
|
|
16
17
|
(env: 'dev', config: CustomConfigType['dev']): any;
|
package/src/index.react.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.defineGlobal = exports.defineConfig = exports.useLocation = exports.Outlet = exports.Link = void 0;
|
|
6
|
+
exports.defineGlobal = exports.defineConfig = exports.history = exports.useLocation = exports.Outlet = exports.Link = void 0;
|
|
7
7
|
var react_router_dom_1 = require("react-router-dom");
|
|
8
8
|
var react_1 = __importDefault(require("react"));
|
|
9
9
|
var Link = function (_a) {
|
|
@@ -15,6 +15,8 @@ var react_router_dom_2 = require("react-router-dom");
|
|
|
15
15
|
Object.defineProperty(exports, "Outlet", { enumerable: true, get: function () { return react_router_dom_2.Outlet; } });
|
|
16
16
|
var react_hooks_1 = require("./template/react/react-hooks");
|
|
17
17
|
Object.defineProperty(exports, "useLocation", { enumerable: true, get: function () { return react_hooks_1.useLocation; } });
|
|
18
|
+
var index_1 = require("./template/react/$env/index");
|
|
19
|
+
Object.defineProperty(exports, "history", { enumerable: true, get: function () { return index_1.history; } });
|
|
18
20
|
var defineConfig = function (env, config) { return config; };
|
|
19
21
|
exports.defineConfig = defineConfig;
|
|
20
22
|
var defineGlobal = function (config) {
|
package/src/index.vue.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Router } from 'vue-router';
|
|
|
4
4
|
export type CustomConfigType = GlobalData['customConfig'];
|
|
5
5
|
export { RouterView as Outlet } from 'vue-router';
|
|
6
6
|
export { useLocation } from './template/vue/vue-hooks';
|
|
7
|
+
export { history } from './template/vue/$env/index';
|
|
7
8
|
export type { GlobalSwicoConfigType };
|
|
8
9
|
export declare const Link: import("vue").DefineComponent<{
|
|
9
10
|
to: {
|
package/src/index.vue.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.defineGlobal = exports.defineConfig = exports.Link = exports.useLocation = exports.Outlet = void 0;
|
|
3
|
+
exports.defineGlobal = exports.defineConfig = exports.Link = exports.history = exports.useLocation = exports.Outlet = void 0;
|
|
4
4
|
var vue_1 = require("vue");
|
|
5
5
|
var vue_router_1 = require("vue-router");
|
|
6
6
|
var vue_router_2 = require("vue-router");
|
|
7
7
|
Object.defineProperty(exports, "Outlet", { enumerable: true, get: function () { return vue_router_2.RouterView; } });
|
|
8
8
|
var vue_hooks_1 = require("./template/vue/vue-hooks");
|
|
9
9
|
Object.defineProperty(exports, "useLocation", { enumerable: true, get: function () { return vue_hooks_1.useLocation; } });
|
|
10
|
+
var index_1 = require("./template/vue/$env/index");
|
|
11
|
+
Object.defineProperty(exports, "history", { enumerable: true, get: function () { return index_1.history; } });
|
|
10
12
|
exports.Link = (0, vue_1.defineComponent)({
|
|
11
13
|
components: {
|
|
12
14
|
RouterLink: vue_router_1.RouterLink
|
|
@@ -26,6 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.history = void 0;
|
|
29
30
|
var client_1 = require("react-dom/client");
|
|
30
31
|
var react_1 = __importStar(require("react"));
|
|
31
32
|
var react_router_dom_1 = require("react-router-dom");
|
|
@@ -35,6 +36,8 @@ var history_1 = require("./history");
|
|
|
35
36
|
var config_1 = require("./config");
|
|
36
37
|
require("../../global");
|
|
37
38
|
var layout_1 = __importDefault(require("../../layout"));
|
|
39
|
+
var _a = (0, history_1.getHistory)(config_1.routerBase, config_1.routerType), swicoHistory = _a.history, originalHistory = _a.originalHistory;
|
|
40
|
+
exports.history = swicoHistory;
|
|
38
41
|
var renderChildrenRouteList = function (childrenRoutes, ancPathKey) {
|
|
39
42
|
return childrenRoutes === null || childrenRoutes === void 0 ? void 0 : childrenRoutes.map(function (item) {
|
|
40
43
|
var component = item.component, path = item.path, children = item.children, redirect = item.redirect;
|
|
@@ -43,14 +46,13 @@ var renderChildrenRouteList = function (childrenRoutes, ancPathKey) {
|
|
|
43
46
|
});
|
|
44
47
|
};
|
|
45
48
|
var App = function () {
|
|
46
|
-
var _a = (0, history_1.getHistory)(config_1.routerBase, config_1.routerType), history = _a.history, originalHistory = _a.originalHistory;
|
|
47
49
|
if (config_1.routerBase && config_1.routerBase !== '/') {
|
|
48
50
|
if (config_1.routerType === 'browser' && window.location.pathname === '/') {
|
|
49
51
|
window.location.replace("".concat(config_1.routerBase));
|
|
50
52
|
}
|
|
51
53
|
}
|
|
52
54
|
window.Swico = {
|
|
53
|
-
history: history
|
|
55
|
+
history: exports.history
|
|
54
56
|
};
|
|
55
57
|
return (react_1.default.createElement(history_1.HistoryRouter, { basename: config_1.routerBase, history: originalHistory },
|
|
56
58
|
react_1.default.createElement(react_router_dom_1.Routes, null,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const history: SwicoHistoryType;
|
|
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.history = void 0;
|
|
7
8
|
var vue_1 = require("vue");
|
|
8
9
|
var routes_1 = __importDefault(require("./routes"));
|
|
9
10
|
var vue_router_1 = require("vue-router");
|
|
@@ -18,7 +19,7 @@ var router = (0, vue_router_1.createRouter)({
|
|
|
18
19
|
});
|
|
19
20
|
var app = (0, vue_1.createApp)(Container_1.default);
|
|
20
21
|
var Swico = { history: null };
|
|
21
|
-
|
|
22
|
+
exports.history = {
|
|
22
23
|
push: function (options) {
|
|
23
24
|
if (typeof options === 'string') {
|
|
24
25
|
router.push(options);
|
|
@@ -55,6 +56,7 @@ Swico.history = {
|
|
|
55
56
|
};
|
|
56
57
|
}
|
|
57
58
|
};
|
|
59
|
+
Swico.history = exports.history;
|
|
58
60
|
app.component('Layout', Layout_1.default);
|
|
59
61
|
app.use(router);
|
|
60
62
|
window.Swico = Swico;
|