@nocobase/plugin-client 0.9.1-alpha.2 → 0.9.2-alpha.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/lib/antd.js +0 -4
- package/lib/cron.js +1 -11
- package/lib/cronstrue.js +5 -30
- package/lib/index.js +0 -2
- package/lib/locale/en-US.json +27 -3
- package/lib/locale/index.js +2 -1
- package/lib/locale/pt-BR.json +1381 -0
- package/lib/locale/zh-CN.json +27 -3
- package/lib/moment-locale.js +0 -2
- package/lib/resource.js +6 -43
- package/lib/server.js +137 -91
- package/package.json +4 -4
package/lib/server.js
CHANGED
|
@@ -4,95 +4,148 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = exports.ClientPlugin = void 0;
|
|
7
|
-
|
|
8
7
|
function _server() {
|
|
9
8
|
const data = require("@nocobase/server");
|
|
10
|
-
|
|
11
9
|
_server = function _server() {
|
|
12
10
|
return data;
|
|
13
11
|
};
|
|
14
|
-
|
|
15
12
|
return data;
|
|
16
13
|
}
|
|
17
|
-
|
|
14
|
+
function _fs() {
|
|
15
|
+
const data = _interopRequireDefault(require("fs"));
|
|
16
|
+
_fs = function _fs() {
|
|
17
|
+
return data;
|
|
18
|
+
};
|
|
19
|
+
return data;
|
|
20
|
+
}
|
|
18
21
|
function _koaSend() {
|
|
19
22
|
const data = _interopRequireDefault(require("koa-send"));
|
|
20
|
-
|
|
21
23
|
_koaSend = function _koaSend() {
|
|
22
24
|
return data;
|
|
23
25
|
};
|
|
24
|
-
|
|
25
26
|
return data;
|
|
26
27
|
}
|
|
27
|
-
|
|
28
28
|
function _koaStatic() {
|
|
29
29
|
const data = _interopRequireDefault(require("koa-static"));
|
|
30
|
-
|
|
31
30
|
_koaStatic = function _koaStatic() {
|
|
32
31
|
return data;
|
|
33
32
|
};
|
|
34
|
-
|
|
35
33
|
return data;
|
|
36
34
|
}
|
|
37
|
-
|
|
38
35
|
function _isEmpty() {
|
|
39
36
|
const data = _interopRequireDefault(require("lodash/isEmpty"));
|
|
40
|
-
|
|
41
37
|
_isEmpty = function _isEmpty() {
|
|
42
38
|
return data;
|
|
43
39
|
};
|
|
44
|
-
|
|
45
40
|
return data;
|
|
46
41
|
}
|
|
47
|
-
|
|
48
42
|
function _path() {
|
|
49
43
|
const data = require("path");
|
|
50
|
-
|
|
51
44
|
_path = function _path() {
|
|
52
45
|
return data;
|
|
53
46
|
};
|
|
54
|
-
|
|
55
47
|
return data;
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
var _antd = require("./antd");
|
|
59
|
-
|
|
60
50
|
var _cron = require("./cron");
|
|
61
|
-
|
|
62
51
|
var _cronstrue = require("./cronstrue");
|
|
63
|
-
|
|
64
52
|
var _momentLocale = require("./moment-locale");
|
|
65
|
-
|
|
66
53
|
var _resource = require("./resource");
|
|
67
|
-
|
|
68
54
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
69
|
-
|
|
70
55
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
71
|
-
|
|
72
56
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
73
|
-
|
|
74
|
-
function
|
|
75
|
-
|
|
57
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
58
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
59
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
76
60
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
77
|
-
|
|
78
61
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
79
|
-
|
|
80
62
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
81
|
-
|
|
82
63
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
83
|
-
|
|
84
|
-
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
85
|
-
|
|
64
|
+
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
86
65
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
87
|
-
|
|
88
66
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
89
|
-
|
|
90
67
|
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
91
|
-
|
|
68
|
+
function getReadMe(_x, _x2) {
|
|
69
|
+
return _getReadMe.apply(this, arguments);
|
|
70
|
+
}
|
|
71
|
+
function _getReadMe() {
|
|
72
|
+
_getReadMe = _asyncToGenerator(function* (name, locale) {
|
|
73
|
+
const packageName = _server().PluginManager.getPackageName(name);
|
|
74
|
+
const dir = (0, _path().resolve)(process.cwd(), 'node_modules', packageName);
|
|
75
|
+
let files = [(0, _path().resolve)(dir, `README.${locale}.md`), (0, _path().resolve)(dir, `README.md`)];
|
|
76
|
+
const file = files.find(file => {
|
|
77
|
+
return _fs().default.existsSync(file);
|
|
78
|
+
});
|
|
79
|
+
return file ? (yield _fs().default.promises.readFile(file)).toString() : '';
|
|
80
|
+
});
|
|
81
|
+
return _getReadMe.apply(this, arguments);
|
|
82
|
+
}
|
|
83
|
+
function getTabs(_x3, _x4) {
|
|
84
|
+
return _getTabs.apply(this, arguments);
|
|
85
|
+
}
|
|
86
|
+
function _getTabs() {
|
|
87
|
+
_getTabs = _asyncToGenerator(function* (name, locale) {
|
|
88
|
+
const packageName = _server().PluginManager.getPackageName(name);
|
|
89
|
+
const dir = (0, _path().resolve)(process.cwd(), 'node_modules', packageName);
|
|
90
|
+
let file = (0, _path().resolve)(dir, 'docs', locale, 'tabs.json');
|
|
91
|
+
if (!_fs().default.existsSync(file)) {
|
|
92
|
+
// TODO: compatible README, remove it in all plugin has tabs.json
|
|
93
|
+
return [{
|
|
94
|
+
title: 'README',
|
|
95
|
+
path: '__README__'
|
|
96
|
+
}];
|
|
97
|
+
}
|
|
98
|
+
return JSON.parse((yield _fs().default.promises.readFile(file)).toString());
|
|
99
|
+
});
|
|
100
|
+
return _getTabs.apply(this, arguments);
|
|
101
|
+
}
|
|
102
|
+
function getTabInfo(_x5) {
|
|
103
|
+
return _getTabInfo.apply(this, arguments);
|
|
104
|
+
}
|
|
105
|
+
function _getTabInfo() {
|
|
106
|
+
_getTabInfo = _asyncToGenerator(function* ({
|
|
107
|
+
filterByTk,
|
|
108
|
+
path,
|
|
109
|
+
locale
|
|
110
|
+
}) {
|
|
111
|
+
const packageName = _server().PluginManager.getPackageName(filterByTk);
|
|
112
|
+
const dir = (0, _path().resolve)(process.cwd(), 'node_modules', packageName);
|
|
113
|
+
if (path === '__README__') {
|
|
114
|
+
return yield getReadMe(filterByTk, locale);
|
|
115
|
+
}
|
|
116
|
+
const files = [(0, _path().resolve)(dir, 'docs', locale, `${path}.md`),
|
|
117
|
+
// default
|
|
118
|
+
(0, _path().resolve)(dir, 'docs', 'en-US', `${path}.md`), (0, _path().resolve)(dir, 'docs', 'zh-CN', `${path}.md`)];
|
|
119
|
+
const file = files.find(file => {
|
|
120
|
+
return _fs().default.existsSync(file);
|
|
121
|
+
});
|
|
122
|
+
return file ? (yield _fs().default.promises.readFile(file)).toString() : '';
|
|
123
|
+
});
|
|
124
|
+
return _getTabInfo.apply(this, arguments);
|
|
125
|
+
}
|
|
126
|
+
function getLang(_x6) {
|
|
127
|
+
return _getLang.apply(this, arguments);
|
|
128
|
+
}
|
|
129
|
+
function _getLang() {
|
|
130
|
+
_getLang = _asyncToGenerator(function* (ctx) {
|
|
131
|
+
const SystemSetting = ctx.db.getRepository('systemSettings');
|
|
132
|
+
const systemSetting = yield SystemSetting.findOne();
|
|
133
|
+
const enabledLanguages = systemSetting.get('enabledLanguages') || [];
|
|
134
|
+
const currentUser = ctx.state.currentUser;
|
|
135
|
+
let lang = (enabledLanguages === null || enabledLanguages === void 0 ? void 0 : enabledLanguages[0]) || process.env.APP_LANG || 'en-US';
|
|
136
|
+
if (enabledLanguages.includes(currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang)) {
|
|
137
|
+
lang = currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang;
|
|
138
|
+
}
|
|
139
|
+
if (ctx.request.query.locale) {
|
|
140
|
+
lang = ctx.request.query.locale;
|
|
141
|
+
}
|
|
142
|
+
return lang;
|
|
143
|
+
});
|
|
144
|
+
return _getLang.apply(this, arguments);
|
|
145
|
+
}
|
|
92
146
|
class ClientPlugin extends _server().Plugin {
|
|
93
147
|
beforeLoad() {
|
|
94
148
|
var _this = this;
|
|
95
|
-
|
|
96
149
|
return _asyncToGenerator(function* () {
|
|
97
150
|
// const cmd = this.app.findCommand('install');
|
|
98
151
|
// if (cmd) {
|
|
@@ -101,98 +154,70 @@ class ClientPlugin extends _server().Plugin {
|
|
|
101
154
|
_this.app.on('afterInstall', /*#__PURE__*/function () {
|
|
102
155
|
var _ref = _asyncToGenerator(function* (app, options) {
|
|
103
156
|
const _ref2 = (options === null || options === void 0 ? void 0 : options.cliArgs) || [{}],
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
157
|
+
_ref3 = _slicedToArray(_ref2, 1),
|
|
158
|
+
opts = _ref3[0];
|
|
159
|
+
if (opts === null || opts === void 0 ? void 0 : opts.importDemo) {
|
|
160
|
+
//
|
|
108
161
|
}
|
|
109
162
|
});
|
|
110
|
-
|
|
111
|
-
return function (_x, _x2) {
|
|
163
|
+
return function (_x7, _x8) {
|
|
112
164
|
return _ref.apply(this, arguments);
|
|
113
165
|
};
|
|
114
166
|
}());
|
|
115
167
|
})();
|
|
116
168
|
}
|
|
117
|
-
|
|
118
169
|
load() {
|
|
119
170
|
var _this2 = this;
|
|
120
|
-
|
|
121
171
|
return _asyncToGenerator(function* () {
|
|
122
172
|
_this2.app.acl.allow('app', 'getLang');
|
|
123
|
-
|
|
124
173
|
_this2.app.acl.allow('app', 'getInfo');
|
|
125
|
-
|
|
126
174
|
_this2.app.acl.allow('app', 'getPlugins');
|
|
127
|
-
|
|
128
|
-
_this2.app.acl.allow('plugins', 'getPinned', 'loggedIn');
|
|
129
|
-
|
|
175
|
+
_this2.app.acl.allow('plugins', '*', 'public');
|
|
130
176
|
const dialect = _this2.app.db.sequelize.getDialect();
|
|
131
|
-
|
|
132
177
|
const locales = require('./locale').default;
|
|
133
|
-
|
|
134
178
|
_this2.app.resource({
|
|
135
179
|
name: 'app',
|
|
136
180
|
actions: {
|
|
137
181
|
getInfo(ctx, next) {
|
|
138
182
|
return _asyncToGenerator(function* () {
|
|
183
|
+
var _currentUser$systemSe, _systemSetting$option;
|
|
139
184
|
const SystemSetting = ctx.db.getRepository('systemSettings');
|
|
140
185
|
const systemSetting = yield SystemSetting.findOne();
|
|
141
186
|
const enabledLanguages = systemSetting.get('enabledLanguages') || [];
|
|
142
187
|
const currentUser = ctx.state.currentUser;
|
|
143
188
|
let lang = (enabledLanguages === null || enabledLanguages === void 0 ? void 0 : enabledLanguages[0]) || process.env.APP_LANG || 'en-US';
|
|
144
|
-
|
|
145
189
|
if (enabledLanguages.includes(currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang)) {
|
|
146
190
|
lang = currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang;
|
|
147
191
|
}
|
|
148
|
-
|
|
149
192
|
ctx.body = {
|
|
150
193
|
database: {
|
|
151
194
|
dialect
|
|
152
195
|
},
|
|
153
196
|
version: yield ctx.app.version.get(),
|
|
154
|
-
lang
|
|
197
|
+
lang,
|
|
198
|
+
theme: (currentUser === null || currentUser === void 0 ? void 0 : (_currentUser$systemSe = currentUser.systemSettings) === null || _currentUser$systemSe === void 0 ? void 0 : _currentUser$systemSe.theme) || (systemSetting === null || systemSetting === void 0 ? void 0 : (_systemSetting$option = systemSetting.options) === null || _systemSetting$option === void 0 ? void 0 : _systemSetting$option.theme) || 'default'
|
|
155
199
|
};
|
|
156
200
|
yield next();
|
|
157
201
|
})();
|
|
158
202
|
},
|
|
159
|
-
|
|
160
203
|
getLang(ctx, next) {
|
|
161
204
|
return _asyncToGenerator(function* () {
|
|
162
|
-
const
|
|
163
|
-
const systemSetting = yield SystemSetting.findOne();
|
|
164
|
-
const enabledLanguages = systemSetting.get('enabledLanguages') || [];
|
|
165
|
-
const currentUser = ctx.state.currentUser;
|
|
166
|
-
let lang = (enabledLanguages === null || enabledLanguages === void 0 ? void 0 : enabledLanguages[0]) || process.env.APP_LANG || 'en-US';
|
|
167
|
-
|
|
168
|
-
if (enabledLanguages.includes(currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang)) {
|
|
169
|
-
lang = currentUser === null || currentUser === void 0 ? void 0 : currentUser.appLang;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (ctx.request.query.locale) {
|
|
173
|
-
lang = ctx.request.query.locale;
|
|
174
|
-
}
|
|
175
|
-
|
|
205
|
+
const lang = yield getLang(ctx);
|
|
176
206
|
if ((0, _isEmpty().default)(locales[lang])) {
|
|
177
207
|
locales[lang] = {};
|
|
178
208
|
}
|
|
179
|
-
|
|
180
209
|
if ((0, _isEmpty().default)(locales[lang].resources)) {
|
|
181
210
|
locales[lang].resources = yield (0, _resource.getResourceLocale)(lang, ctx.db);
|
|
182
211
|
}
|
|
183
|
-
|
|
184
212
|
if ((0, _isEmpty().default)(locales[lang].antd)) {
|
|
185
213
|
locales[lang].antd = (0, _antd.getAntdLocale)(lang);
|
|
186
214
|
}
|
|
187
|
-
|
|
188
215
|
if ((0, _isEmpty().default)(locales[lang].cronstrue)) {
|
|
189
216
|
locales[lang].cronstrue = (0, _cronstrue.getCronstrueLocale)(lang);
|
|
190
217
|
}
|
|
191
|
-
|
|
192
218
|
if ((0, _isEmpty().default)(locales[lang].cron)) {
|
|
193
219
|
locales[lang].cron = (0, _cron.getCronLocale)(lang);
|
|
194
220
|
}
|
|
195
|
-
|
|
196
221
|
ctx.body = _objectSpread({
|
|
197
222
|
lang,
|
|
198
223
|
moment: (0, _momentLocale.getMomentLocale)(lang)
|
|
@@ -200,7 +225,6 @@ class ClientPlugin extends _server().Plugin {
|
|
|
200
225
|
yield next();
|
|
201
226
|
})();
|
|
202
227
|
},
|
|
203
|
-
|
|
204
228
|
getPlugins(ctx, next) {
|
|
205
229
|
return _asyncToGenerator(function* () {
|
|
206
230
|
const pm = ctx.db.getRepository('applicationPlugins');
|
|
@@ -212,21 +236,16 @@ class ClientPlugin extends _server().Plugin {
|
|
|
212
236
|
ctx.body = items.filter(item => {
|
|
213
237
|
try {
|
|
214
238
|
const packageName = _server().PluginManager.getPackageName(item.name);
|
|
215
|
-
|
|
216
239
|
require.resolve(`${packageName}/client`);
|
|
217
|
-
|
|
218
240
|
return true;
|
|
219
241
|
} catch (error) {}
|
|
220
|
-
|
|
221
242
|
return false;
|
|
222
243
|
}).map(item => item.name);
|
|
223
244
|
yield next();
|
|
224
245
|
})();
|
|
225
246
|
}
|
|
226
|
-
|
|
227
247
|
}
|
|
228
248
|
});
|
|
229
|
-
|
|
230
249
|
_this2.app.resource({
|
|
231
250
|
name: 'plugins',
|
|
232
251
|
actions: {
|
|
@@ -248,34 +267,63 @@ class ClientPlugin extends _server().Plugin {
|
|
|
248
267
|
}];
|
|
249
268
|
yield next();
|
|
250
269
|
})();
|
|
270
|
+
},
|
|
271
|
+
getInfo(ctx, next) {
|
|
272
|
+
return _asyncToGenerator(function* () {
|
|
273
|
+
const lang = yield getLang(ctx);
|
|
274
|
+
const filterByTk = ctx.action.params.filterByTk;
|
|
275
|
+
ctx.body = {
|
|
276
|
+
filterByTk,
|
|
277
|
+
readMe: yield getReadMe(filterByTk, lang)
|
|
278
|
+
};
|
|
279
|
+
yield next();
|
|
280
|
+
})();
|
|
281
|
+
},
|
|
282
|
+
getTabs(ctx, next) {
|
|
283
|
+
return _asyncToGenerator(function* () {
|
|
284
|
+
const lang = yield getLang(ctx);
|
|
285
|
+
const filterByTk = ctx.action.params.filterByTk;
|
|
286
|
+
ctx.body = {
|
|
287
|
+
filterByTk,
|
|
288
|
+
tabs: yield getTabs(filterByTk, lang)
|
|
289
|
+
};
|
|
290
|
+
yield next();
|
|
291
|
+
})();
|
|
292
|
+
},
|
|
293
|
+
getTabInfo(ctx, next) {
|
|
294
|
+
return _asyncToGenerator(function* () {
|
|
295
|
+
const locale = yield getLang(ctx);
|
|
296
|
+
const filterByTk = ctx.action.params.filterByTk;
|
|
297
|
+
ctx.body = {
|
|
298
|
+
filterByTk,
|
|
299
|
+
content: yield getTabInfo(_objectSpread(_objectSpread({}, ctx.action.params), {}, {
|
|
300
|
+
locale
|
|
301
|
+
}))
|
|
302
|
+
};
|
|
303
|
+
yield next();
|
|
304
|
+
})();
|
|
251
305
|
}
|
|
252
|
-
|
|
253
306
|
}
|
|
254
307
|
});
|
|
255
|
-
|
|
256
308
|
let root = _this2.options.dist || `./packages/app/client/dist`;
|
|
257
|
-
|
|
258
309
|
if (!(0, _path().isAbsolute)(root)) {
|
|
259
310
|
root = (0, _path().resolve)(process.cwd(), root);
|
|
260
311
|
}
|
|
261
|
-
|
|
262
312
|
if (process.env.APP_ENV !== 'production' && root) {
|
|
263
313
|
_this2.app.use( /*#__PURE__*/function () {
|
|
264
314
|
var _ref4 = _asyncToGenerator(function* (ctx, next) {
|
|
265
315
|
if (ctx.path.startsWith(_this2.app.resourcer.options.prefix)) {
|
|
266
316
|
return next();
|
|
267
317
|
}
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
318
|
+
yield (0, _koaStatic().default)(root)(ctx, next);
|
|
319
|
+
// console.log('koa-send', root, ctx.status);
|
|
271
320
|
if (ctx.status == 404) {
|
|
272
321
|
return (0, _koaSend().default)(ctx, 'index.html', {
|
|
273
322
|
root
|
|
274
323
|
});
|
|
275
324
|
}
|
|
276
325
|
});
|
|
277
|
-
|
|
278
|
-
return function (_x3, _x4) {
|
|
326
|
+
return function (_x9, _x10) {
|
|
279
327
|
return _ref4.apply(this, arguments);
|
|
280
328
|
};
|
|
281
329
|
}(), {
|
|
@@ -285,9 +333,7 @@ class ClientPlugin extends _server().Plugin {
|
|
|
285
333
|
}
|
|
286
334
|
})();
|
|
287
335
|
}
|
|
288
|
-
|
|
289
336
|
}
|
|
290
|
-
|
|
291
337
|
exports.ClientPlugin = ClientPlugin;
|
|
292
338
|
var _default = ClientPlugin;
|
|
293
339
|
exports.default = _default;
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nocobase/plugin-client",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.2-alpha.2",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"license": "AGPL-3.0",
|
|
6
6
|
"dependencies": {
|
|
7
|
-
"@nocobase/server": "0.9.
|
|
7
|
+
"@nocobase/server": "0.9.2-alpha.2"
|
|
8
8
|
},
|
|
9
9
|
"devDependencies": {
|
|
10
|
-
"@nocobase/test": "0.9.
|
|
10
|
+
"@nocobase/test": "0.9.2-alpha.2"
|
|
11
11
|
},
|
|
12
|
-
"gitHead": "
|
|
12
|
+
"gitHead": "1a0de6908b2b1854bdf434fcafa8909cb65bb8a3"
|
|
13
13
|
}
|