@monkeyplus/flow 1.2.0 → 3.0.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/dist/config.d.ts +3 -9
- package/dist/config.js +3 -0
- package/dist/config.js.map +1 -1
- package/dist/generate.d.ts +2 -1
- package/dist/generate.js +147 -38
- package/dist/generate.js.map +1 -1
- package/dist/helper.d.ts +2 -0
- package/dist/helper.js +95 -0
- package/dist/helper.js.map +1 -0
- package/dist/index copy.d.ts +0 -0
- package/dist/index copy.js +315 -0
- package/dist/index copy.js.map +1 -0
- package/dist/index.d.ts +18 -13
- package/dist/index.js +186 -218
- package/dist/index.js.map +1 -1
- package/dist/lib/index.d.ts +0 -3
- package/dist/lib/index.js +22 -23
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/pages/index copy.d.ts +0 -0
- package/dist/lib/pages/index copy.js +117 -0
- package/dist/lib/pages/index copy.js.map +1 -0
- package/dist/lib/pages/index.d.ts +0 -2
- package/dist/lib/pages/index.js +115 -121
- package/dist/lib/pages/index.js.map +1 -1
- package/dist/lib/pages/pre.d.ts +0 -8
- package/dist/lib/pages/pre.js +125 -135
- package/dist/lib/pages/pre.js.map +1 -1
- package/dist/lib/utils/index.d.ts +0 -2
- package/dist/lib/utils/index.js +25 -47
- package/dist/lib/utils/index.js.map +1 -1
- package/dist/pages.d.ts +2 -0
- package/dist/pages.js +97 -0
- package/dist/pages.js.map +1 -0
- package/dist/routes.json +0 -0
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +34 -7
- package/dist/utils/index.js.map +1 -1
- package/package.json +8 -6
- package/types/flow.d.ts +128 -0
- package/types/index.d.ts +13 -174
package/dist/index.js
CHANGED
|
@@ -1,272 +1,240 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
-
}) : (function(o, m, k, k2) {
|
|
6
|
-
if (k2 === undefined) k2 = k;
|
|
7
|
-
o[k2] = m[k];
|
|
8
|
-
}));
|
|
9
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
-
}) : function(o, v) {
|
|
12
|
-
o["default"] = v;
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
22
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
23
4
|
};
|
|
24
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.plugin = exports.
|
|
6
|
+
exports.plugin = exports.definePage = void 0;
|
|
26
7
|
const config_1 = require("./config");
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
Object.defineProperty(exports, "definePage", { enumerable: true, get: function () { return lib_1.definePage; } });
|
|
30
|
-
Object.defineProperty(exports, "defineSharedContext", { enumerable: true, get: function () { return lib_1.defineSharedContext; } });
|
|
31
|
-
const lib_2 = require("./lib/index");
|
|
32
|
-
var flow_core_1 = require("@monkeyplus/flow-core");
|
|
33
|
-
Object.defineProperty(exports, "defineImages", { enumerable: true, get: function () { return flow_core_1.defineImages; } });
|
|
34
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const flow_core_1 = require("@monkeyplus/flow-core");
|
|
9
|
+
// import { PageInfo } from '@monkeyplus/flow-core';
|
|
35
10
|
const utils_1 = require("./utils/index");
|
|
11
|
+
const helper_1 = require("./helper");
|
|
12
|
+
const path_1 = __importDefault(require("path"));
|
|
36
13
|
const generate_1 = require("./generate");
|
|
37
|
-
const
|
|
14
|
+
const pages_1 = require("./pages");
|
|
15
|
+
var pages_2 = require("./pages");
|
|
16
|
+
Object.defineProperty(exports, "definePage", { enumerable: true, get: function () { return pages_2.definePage; } });
|
|
17
|
+
// const logger = require('consola').withScope('@monkeyplus/flow');
|
|
18
|
+
const isProduction = process.env.NODE_ENV === 'production';
|
|
38
19
|
exports.plugin = {
|
|
39
20
|
pkg: require("../package.json"),
|
|
40
21
|
name: config_1.FULL_NAME_PLUGIN,
|
|
41
22
|
dependencies: config_1.DEPENDENCIES,
|
|
42
|
-
register: async (server,
|
|
43
|
-
const config = utils_1.getConfigs(server,
|
|
23
|
+
register: async (server, _options) => {
|
|
24
|
+
const config = utils_1.getConfigs(server, _options);
|
|
25
|
+
// console.log(config);
|
|
44
26
|
server.expose('configs', config);
|
|
45
27
|
server.expose('getPath', (...paths) => {
|
|
46
28
|
server.log(['warn'], 'This method is deprecated');
|
|
47
29
|
return path_1.default.join(config.relativeTo, ...paths);
|
|
48
30
|
});
|
|
49
|
-
const
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
*
|
|
66
|
-
*/
|
|
67
|
-
const inserPage = (pages) => {
|
|
68
|
-
for (const page of pages) {
|
|
69
|
-
if (server.app.flow.pages.has(page.name)) {
|
|
70
|
-
// server.log(['warn', FULL_NAME_PLUGIN], {
|
|
71
|
-
// error: 'insertPage',
|
|
72
|
-
// message: `Duplicate name page, "${page.name}" already exists`,
|
|
73
|
-
// details: page,
|
|
74
|
-
// });
|
|
75
|
-
// logger.error(
|
|
76
|
-
// new Error(`Duplicate name page, "${page.name}" already exists`),
|
|
77
|
-
// );
|
|
78
|
-
// logs.warns.push(`Duplicate name page, "${page.name}" already exists`);
|
|
31
|
+
const redirects = {};
|
|
32
|
+
const urls = {};
|
|
33
|
+
// const routes: Record<string, boolean> = {};
|
|
34
|
+
const pages = {};
|
|
35
|
+
const truncates = {};
|
|
36
|
+
const dynamicContent = {};
|
|
37
|
+
const dynamicPages = {};
|
|
38
|
+
server.app.flow = { redirects, urls, pages, truncates, dynamicPages };
|
|
39
|
+
server.app.generate = { folders: {} };
|
|
40
|
+
server.decorate('toolkit', 'getUrl', (_locale, _name) => {
|
|
41
|
+
// console.log('locale: %s, name:%s', _locale, _name);
|
|
42
|
+
try {
|
|
43
|
+
const pageName = path_1.default.posix.join(_locale, _name);
|
|
44
|
+
const page = urls[pageName];
|
|
45
|
+
if (page) {
|
|
46
|
+
return page.url;
|
|
79
47
|
}
|
|
80
48
|
else {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
// message: `Insert page`,
|
|
84
|
-
// info: {
|
|
85
|
-
// url: page.urlObject.path,
|
|
86
|
-
// name: page.name,
|
|
87
|
-
// locale: page.locale,
|
|
88
|
-
// level: page.level,
|
|
89
|
-
// },
|
|
90
|
-
// });
|
|
91
|
-
logs.pages.push(page.urlObject.path);
|
|
92
|
-
server.app.flow.pages.set(page.name, page);
|
|
93
|
-
server.app.flow.localePages = R.groupBy((f) => {
|
|
94
|
-
return f.locale;
|
|
95
|
-
}, Array.from(server.app.flow.pages.values()));
|
|
49
|
+
utils_1.logger.warn('Not found link with name: %s', pageName);
|
|
50
|
+
return '/404';
|
|
96
51
|
}
|
|
97
52
|
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
utils_1.logger.error(error);
|
|
55
|
+
return '/';
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
server.ext('onRequest', (req, h) => {
|
|
59
|
+
// console.log(req.path);
|
|
60
|
+
// console.log(req.app);
|
|
61
|
+
req.app.global = {};
|
|
62
|
+
req.app.local = {};
|
|
63
|
+
req.app.utils = {};
|
|
64
|
+
// req.app.
|
|
65
|
+
const pathRedirect = redirects[req.path];
|
|
66
|
+
if (truncates[req.path]) {
|
|
67
|
+
return h.redirect('/').takeover();
|
|
68
|
+
}
|
|
69
|
+
if (pathRedirect) {
|
|
70
|
+
return h.redirect(pathRedirect).takeover();
|
|
71
|
+
}
|
|
72
|
+
return h.continue;
|
|
73
|
+
});
|
|
74
|
+
const addRedirect = (key, urlPath) => {
|
|
75
|
+
redirects[key] = urlPath;
|
|
98
76
|
};
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
77
|
+
const addUrl = (key, url) => {
|
|
78
|
+
// console.log(key, urlPath);
|
|
79
|
+
if (/\{url?(.+)\}/.test(url.url)) {
|
|
80
|
+
return 0;
|
|
81
|
+
}
|
|
82
|
+
if (urls[key]) {
|
|
83
|
+
utils_1.logger.warn('The namePage %s already exist', urls[key]);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
urls[key] = url;
|
|
87
|
+
}
|
|
88
|
+
// console.log(urls);
|
|
89
|
+
};
|
|
90
|
+
const flowDecorate = (route, options) => {
|
|
91
|
+
var _a, _b, _c;
|
|
92
|
+
// route.settings.plugins?
|
|
93
|
+
const { plugins, app } = route.settings;
|
|
94
|
+
Object.assign(plugins, { generate: '.html' });
|
|
95
|
+
const flow = (_a = route.settings.app) === null || _a === void 0 ? void 0 : _a.flow;
|
|
96
|
+
// console.log(route);
|
|
97
|
+
if (flow) {
|
|
98
|
+
addUrl(flow.name, {
|
|
99
|
+
url: route.path,
|
|
100
|
+
locale: flow.locale,
|
|
101
|
+
name: flow.name,
|
|
102
|
+
originalName: flow.originName
|
|
103
|
+
});
|
|
104
|
+
if (flow.redirect) {
|
|
105
|
+
addRedirect(flow.redirect, route.path);
|
|
107
106
|
}
|
|
108
|
-
|
|
107
|
+
}
|
|
108
|
+
else {
|
|
109
|
+
const routes = flow_core_1.definePages({
|
|
110
|
+
name: options.name,
|
|
111
|
+
view: options.view,
|
|
112
|
+
locales: {
|
|
113
|
+
[options.locale || config.locale]: {}
|
|
114
|
+
},
|
|
115
|
+
context: options.context
|
|
116
|
+
})({
|
|
109
117
|
language: config.defaultLanguage,
|
|
110
118
|
ubication: config.defaultUbication,
|
|
111
119
|
publicPath: config.publicPath
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
if (hasPage) {
|
|
119
|
-
// server.log(['warn', FULL_NAME_PLUGIN], {
|
|
120
|
-
// error: 'addPage',
|
|
121
|
-
// message: `The name of group pages '${result.name}' already exists`,
|
|
122
|
-
// page: result,
|
|
123
|
-
// });
|
|
124
|
-
logger.warn(`The name of group pages '${result.name}' already exists`);
|
|
120
|
+
})().pages([
|
|
121
|
+
{ locale: options.locale || config.locale, url: route.path }
|
|
122
|
+
]);
|
|
123
|
+
const pageInfo = routes[0];
|
|
124
|
+
if (pageInfo.redirect) {
|
|
125
|
+
addRedirect(pageInfo.redirect, route.path);
|
|
125
126
|
}
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
catch (details) {
|
|
132
|
-
server.log(['error', config_1.FULL_NAME_PLUGIN], {
|
|
133
|
-
error: 'addPage',
|
|
134
|
-
message: 'Error addPage',
|
|
135
|
-
details
|
|
127
|
+
addUrl(pageInfo.name, {
|
|
128
|
+
url: route.path,
|
|
129
|
+
locale: pageInfo.locale,
|
|
130
|
+
name: pageInfo.name,
|
|
131
|
+
originalName: pageInfo.originName
|
|
136
132
|
});
|
|
133
|
+
Object.assign(app, { flow: pageInfo, content: options.content });
|
|
134
|
+
}
|
|
135
|
+
if (isProduction && !((_c = (_b = route.settings.plugins) === null || _b === void 0 ? void 0 : _b.flow) === null || _c === void 0 ? void 0 : _c.proxy)) {
|
|
136
|
+
truncates[route.path] = route.path;
|
|
137
|
+
}
|
|
138
|
+
if (app === null || app === void 0 ? void 0 : app.content) {
|
|
139
|
+
dynamicContent[`${app.flow.locale}${app.content}`] = {
|
|
140
|
+
path: route.path,
|
|
141
|
+
page: app.flow
|
|
142
|
+
};
|
|
137
143
|
}
|
|
144
|
+
return isProduction
|
|
145
|
+
? (req, h) => h.file(`${config.outputDir}${route.path}.html`)
|
|
146
|
+
: helper_1.handlerPage;
|
|
138
147
|
};
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
if (_route) {
|
|
144
|
-
logger.warn(
|
|
145
|
-
// server.log(['warn'], {
|
|
146
|
-
// error: 'registerRoutes',
|
|
147
|
-
// message: `Duplicate route, the route already exists`,
|
|
148
|
-
// info: {
|
|
149
|
-
// path: route.path
|
|
150
|
-
// }
|
|
151
|
-
// });
|
|
148
|
+
server.decorate('handler', 'flow', flowDecorate);
|
|
149
|
+
const registerPages = (_pages) => {
|
|
150
|
+
//
|
|
151
|
+
for (const _route of _pages) {
|
|
152
|
+
if (pages[_route.path]) {
|
|
153
|
+
utils_1.logger.warn('The route %s alredy exist', _route.path);
|
|
152
154
|
}
|
|
153
155
|
else {
|
|
154
|
-
|
|
155
|
-
server.route(route);
|
|
156
|
-
}
|
|
157
|
-
else {
|
|
158
|
-
const r = {
|
|
159
|
-
...route,
|
|
160
|
-
options: R.hasPath(['options'], route)
|
|
161
|
-
? R.mergeDeepLeft(route.options, options.routeOptions || {})
|
|
162
|
-
: undefined
|
|
163
|
-
};
|
|
164
|
-
server.route(r);
|
|
165
|
-
}
|
|
156
|
+
pages[_route.path] = _route;
|
|
166
157
|
}
|
|
167
158
|
}
|
|
168
159
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
url: _opts.path
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
})()(server, {
|
|
183
|
-
language: config.defaultLanguage,
|
|
184
|
-
ubication: config.defaultUbication,
|
|
185
|
-
publicPath: config.publicPath
|
|
186
|
-
}, locales, options.globals);
|
|
187
|
-
const flow = info.pages[0];
|
|
188
|
-
return {
|
|
189
|
-
path: flow.urlObject.path,
|
|
190
|
-
flow
|
|
191
|
-
};
|
|
160
|
+
const addPage = (_page) => {
|
|
161
|
+
let _pages;
|
|
162
|
+
if (typeof _page === 'function') {
|
|
163
|
+
_pages = _page(config);
|
|
164
|
+
registerPages(_pages);
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
_pages = pages_1.definePage(_page)()(config);
|
|
168
|
+
registerPages(_pages);
|
|
169
|
+
}
|
|
192
170
|
};
|
|
193
|
-
const
|
|
194
|
-
|
|
195
|
-
const
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
}
|
|
171
|
+
const registerRoute = (route) => {
|
|
172
|
+
const _routes = server.table();
|
|
173
|
+
const _route = _routes.find((v) => v.path === route.path);
|
|
174
|
+
if (_route) {
|
|
175
|
+
utils_1.logger.warn(`Duplicate route, the route ${route.path} already exists`);
|
|
176
|
+
}
|
|
177
|
+
else {
|
|
178
|
+
server.route(route);
|
|
179
|
+
}
|
|
199
180
|
};
|
|
200
|
-
const
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
.
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
var _a, _b;
|
|
233
|
-
return {
|
|
234
|
-
...route,
|
|
235
|
-
options: {
|
|
236
|
-
...route.options,
|
|
237
|
-
pre: ((_b = (_a = route.options) === null || _a === void 0 ? void 0 : _a.app) === null || _b === void 0 ? void 0 : _b.pre) || []
|
|
238
|
-
},
|
|
181
|
+
const loadDinamicContent = async (key) => {
|
|
182
|
+
try {
|
|
183
|
+
//@ts-ignore
|
|
184
|
+
const list = await server.$content(key).fetch();
|
|
185
|
+
const dRoutes = [];
|
|
186
|
+
for (const contentPage of list) {
|
|
187
|
+
const singlePage = dynamicContent[key];
|
|
188
|
+
const baseUrl = singlePage.path.replace(/\/\{url?(.+)\}/, contentPage.url);
|
|
189
|
+
const name = path_1.default.posix.join(singlePage.page.name, contentPage.slug);
|
|
190
|
+
const originalName = path_1.default.posix.join(singlePage.page.originName, contentPage.slug);
|
|
191
|
+
addUrl(name, {
|
|
192
|
+
url: baseUrl,
|
|
193
|
+
locale: singlePage.page.locale,
|
|
194
|
+
name,
|
|
195
|
+
originalName
|
|
196
|
+
});
|
|
197
|
+
dRoutes.push(baseUrl);
|
|
198
|
+
}
|
|
199
|
+
dynamicPages[key] = dRoutes;
|
|
200
|
+
}
|
|
201
|
+
catch (error) {
|
|
202
|
+
utils_1.logger.warn(error);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const init = async () => {
|
|
206
|
+
var _a, _b, _c, _d;
|
|
207
|
+
for (const key in pages) {
|
|
208
|
+
const page = pages[key];
|
|
209
|
+
if (isProduction) {
|
|
210
|
+
if ((_d = (_c = (_b = (_a = page) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.plugins) === null || _c === void 0 ? void 0 : _c.flow) === null || _d === void 0 ? void 0 : _d.proxy) {
|
|
211
|
+
registerRoute({
|
|
212
|
+
...page,
|
|
239
213
|
handler: {
|
|
240
|
-
file: `${
|
|
214
|
+
file: `${config.outputDir}${page.path}.html`
|
|
241
215
|
}
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
const _redirects = _r.map((r) => {
|
|
245
|
-
return {
|
|
246
|
-
path: `${r.path}.html`,
|
|
247
|
-
method: 'get',
|
|
248
|
-
handler: (_, h) => h.redirect(r.path)
|
|
249
|
-
};
|
|
250
|
-
});
|
|
251
|
-
const _routes = [..._r, ..._redirects];
|
|
252
|
-
registerRoutes(_routes);
|
|
216
|
+
});
|
|
217
|
+
}
|
|
253
218
|
}
|
|
254
219
|
else {
|
|
255
|
-
|
|
220
|
+
registerRoute(page);
|
|
256
221
|
}
|
|
257
222
|
}
|
|
258
|
-
|
|
259
|
-
|
|
223
|
+
// /{url*2}
|
|
224
|
+
for (const key in dynamicContent) {
|
|
225
|
+
await loadDinamicContent(key);
|
|
226
|
+
}
|
|
227
|
+
utils_1.logger.info(`Register %s pages`, `${Object.values(urls).length}`);
|
|
260
228
|
};
|
|
261
229
|
const getPath = (...paths) => path_1.default.join(config.relativeTo, ...paths);
|
|
262
230
|
const { runGenerate } = generate_1.registerGenerate(server, {
|
|
263
|
-
outputDir:
|
|
231
|
+
outputDir: config.outputDir || 'build',
|
|
264
232
|
getPath
|
|
265
233
|
});
|
|
234
|
+
// server.$content.
|
|
266
235
|
const flow = {
|
|
267
236
|
init,
|
|
268
237
|
addPage,
|
|
269
|
-
defineInfoPage,
|
|
270
238
|
getPath,
|
|
271
239
|
runGenerate
|
|
272
240
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AACA,qCAA0D;AAC1D,qDAA8D;AAS9D,oDAAoD;AACpD,yCAA6C;AAC7C,qCAAuC;AACvC,gDAAwB;AACxB,yCAA8C;AAC9C,mCAAqC;AACrC,iCAAqC;AAA5B,mGAAA,UAAU,OAAA;AAWnB,mEAAmE;AAEnE,MAAM,YAAY,GAAG,OAAO,CAAC,GAAG,CA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ACF,CAAC"}
|
package/dist/lib/index.d.ts
CHANGED
package/dist/lib/index.js
CHANGED
|
@@ -1,25 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
};
|
|
24
|
-
exports.defineSharedContext = defineSharedContext;
|
|
2
|
+
// import { DefineGlobalContext } from 'types';
|
|
3
|
+
// export { definePage } from './pages';
|
|
4
|
+
// export const defineSharedContext: DefineGlobalContext = (options) => async (
|
|
5
|
+
// ctx,
|
|
6
|
+
// ) => {
|
|
7
|
+
// const SHARED = await options.shared({ ...ctx });
|
|
8
|
+
// const locales = options.locales || {};
|
|
9
|
+
// const obj: any = {};
|
|
10
|
+
// for (const key in locales) {
|
|
11
|
+
// obj[key.toUpperCase().replace('-', '_')] = await locales[key]({
|
|
12
|
+
// ...ctx,
|
|
13
|
+
// locale: key,
|
|
14
|
+
// });
|
|
15
|
+
// }
|
|
16
|
+
// return {
|
|
17
|
+
// ...obj,
|
|
18
|
+
// SHARED_LOCALE: obj[ctx.locale.toUpperCase().replace('-', '_')],
|
|
19
|
+
// $_: obj[ctx.locale.toUpperCase().replace('-', '_')],
|
|
20
|
+
// SHARED,
|
|
21
|
+
// $: SHARED,
|
|
22
|
+
// };
|
|
23
|
+
// };
|
|
25
24
|
//# sourceMappingURL=index.js.map
|
package/dist/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":";AAAA,+CAA+C;AAC/C,wCAAwC;AAExC,+EAA+E;AAC/E,SAAS;AACT,SAAS;AACT,qDAAqD;AACrD,2CAA2C;AAC3C,yBAAyB;AACzB,iCAAiC;AACjC,sEAAsE;AACtE,gBAAgB;AAChB,qBAAqB;AACrB,UAAU;AACV,MAAM;AACN,aAAa;AACb,cAAc;AACd,sEAAsE;AACtE,2DAA2D;AAC3D,cAAc;AACd,iBAAiB;AACjB,OAAO;AACP,KAAK"}
|
|
File without changes
|