alemonjs 2.1.52 → 2.1.53

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/bin/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## alemonc
2
2
 
3
- AlemonJS 项目 CLI 工具,用于配置管理、平台管理、版本更新等。
3
+ ALemonJS 项目 CLI 工具,用于配置管理、平台管理、版本更新等。
4
4
 
5
5
  ### 帮助
6
6
 
package/bin/info.js CHANGED
@@ -8,7 +8,7 @@ import YAML from 'yaml';
8
8
  * 输出项目诊断信息
9
9
  */
10
10
  export function info() {
11
- console.log('=== AlemonJS 项目信息 ===\n');
11
+ console.log('=== ALemonJS 项目信息 ===\n');
12
12
 
13
13
  // Node 版本
14
14
  console.log(`Node.js: ${process.version}`);
@@ -1,3 +1,4 @@
1
- import { Next, Events, EventKeys, StoreResponseItem } from '../types';
1
+ import { Next, Events, EventKeys, FileTreeNode, StoreResponseItem } from '../types';
2
2
  export declare const clearModuleCache: (path?: string) => void;
3
3
  export declare const createNextStep: <T extends EventKeys>(valueEvent: Events[T], select: T, next: Next, files: StoreResponseItem[], callHandler: (currents: any, nextEvent: any) => void) => Next;
4
+ export declare const createFileTreeStep: <T extends EventKeys>(valueEvent: Events[T], select: T, next: Next, root: FileTreeNode, callHandler: (currents: any, nextEvent: any) => void) => Next;
@@ -1,10 +1,26 @@
1
- import { useState } from './event-utils.js';
2
1
  import { getCachedRegExp, showErrorModule } from '../core/utils.js';
3
2
  import { EventMessageText } from '../core/variable.js';
4
- import { ResponseMiddleware } from './store.js';
5
3
 
6
- const responseMiddlewareSingleton = new ResponseMiddleware();
7
4
  const moduleCache = new Map();
5
+ const shouldSkipFile = (file, select, valueEvent) => {
6
+ if (!moduleCache.has(file.path)) {
7
+ return false;
8
+ }
9
+ const app = moduleCache.get(file.path);
10
+ if (!app?.default?.current || !app?.default?.select) {
11
+ return true;
12
+ }
13
+ const selects = Array.isArray(app.default.select) ? app.default.select : [app.default.select];
14
+ if (!selects.includes(select)) {
15
+ return true;
16
+ }
17
+ if (EventMessageText.includes(select) && app?.regular) {
18
+ if (!getCachedRegExp(app.regular).test(valueEvent['MessageText'])) {
19
+ return true;
20
+ }
21
+ }
22
+ return false;
23
+ };
8
24
  const clearModuleCache = (path) => {
9
25
  if (path) {
10
26
  moduleCache.delete(path);
@@ -28,13 +44,6 @@ const callHandlerFile = async (valueEvent, select, file, nextStep, callback) =>
28
44
  nextStep();
29
45
  return;
30
46
  }
31
- if (file?.stateKey) {
32
- const [state] = useState(file?.stateKey);
33
- if (state === false) {
34
- nextStep();
35
- return;
36
- }
37
- }
38
47
  if (EventMessageText.includes(select)) {
39
48
  if (app?.regular) {
40
49
  if (!getCachedRegExp(app.regular).test(valueEvent['MessageText'])) {
@@ -52,11 +61,11 @@ const callHandlerFile = async (valueEvent, select, file, nextStep, callback) =>
52
61
  }
53
62
  catch (err) {
54
63
  showErrorModule(err);
64
+ nextStep();
55
65
  }
56
66
  };
57
67
  const createNextStep = (valueEvent, select, next, files, callHandler) => {
58
68
  let valueI = 0;
59
- const recordCloseMw = new Set();
60
69
  const nextStep = (cn, ...cns) => {
61
70
  if (cn) {
62
71
  next(...cns);
@@ -79,30 +88,129 @@ const createNextStep = (valueEvent, select, next, files, callHandler) => {
79
88
  nextStep();
80
89
  return;
81
90
  }
82
- const currentsAndMiddleware = responseMiddlewareSingleton.find(file.appName, file.stateKey);
83
91
  const currents = [];
84
- const iterItems = currentsAndMiddleware.length > 0 ? currentsAndMiddleware.concat(file) : [file];
85
- for (const cm of iterItems) {
86
- let isBreak = false;
87
- if (recordCloseMw.has(cm.stateKey)) {
92
+ await callHandlerFile(valueEvent, select, file, () => {
93
+ nextStep();
94
+ }, app => {
95
+ const currentsItem = Array.isArray(app.default.current) ? app.default.current : [app.default.current];
96
+ currents.push(...currentsItem);
97
+ });
98
+ if (currents.length > 0) {
99
+ callHandler(currents, nextStep);
100
+ }
101
+ };
102
+ return nextStep;
103
+ };
104
+ const createFileTreeStep = (valueEvent, select, next, root, callHandler) => {
105
+ const processNode = (node, done) => {
106
+ if (node.middleware?.path) {
107
+ void checkMiddleware(node, done);
108
+ }
109
+ else {
110
+ void processContent(node, done);
111
+ }
112
+ };
113
+ const checkMiddleware = async (node, done) => {
114
+ if (shouldSkipFile(node.middleware, select, valueEvent)) {
115
+ void processContent(node, done);
116
+ return;
117
+ }
118
+ let matched = false;
119
+ const mwCurrents = [];
120
+ await callHandlerFile(valueEvent, select, node.middleware, () => {
121
+ void processContent(node, done);
122
+ }, app => {
123
+ matched = true;
124
+ const items = Array.isArray(app.default.current)
125
+ ? app.default.current
126
+ : [app.default.current];
127
+ mwCurrents.push(...items);
128
+ });
129
+ if (matched) {
130
+ if (mwCurrents.length === 0) {
131
+ void processContent(node, done);
88
132
  return;
89
133
  }
90
- const close = () => {
91
- isBreak = true;
92
- recordCloseMw.add(cm.stateKey);
93
- };
94
- await callHandlerFile(valueEvent, select, cm, close, app => {
95
- const currentsItem = Array.isArray(app.default.current) ? app.default.current : [app.default.current];
96
- currents.push(...currentsItem);
134
+ const gateCurrents = mwCurrents.concat([
135
+ (_event, gateNext) => {
136
+ gateNext();
137
+ return true;
138
+ }
139
+ ]);
140
+ callHandler(gateCurrents, (cn, ...cns) => {
141
+ if (cn) {
142
+ done(true, ...cns);
143
+ return;
144
+ }
145
+ void processContent(node, done);
97
146
  });
98
- if (isBreak) {
99
- nextStep();
147
+ }
148
+ };
149
+ const processContent = (node, done) => {
150
+ processFiles(node, 0, () => {
151
+ processChildNodes(node, done);
152
+ }, done);
153
+ };
154
+ const processFiles = (node, idx, filesDone, treeDone) => {
155
+ if (idx >= node.files.length) {
156
+ filesDone();
157
+ return;
158
+ }
159
+ const file = node.files[idx];
160
+ if (!file?.path) {
161
+ processFiles(node, idx + 1, filesDone, treeDone);
162
+ return;
163
+ }
164
+ if (shouldSkipFile(file, select, valueEvent)) {
165
+ processFiles(node, idx + 1, filesDone, treeDone);
166
+ return;
167
+ }
168
+ void callHandlerFile(valueEvent, select, file, () => {
169
+ processFiles(node, idx + 1, filesDone, treeDone);
170
+ }, app => {
171
+ const fileCurrents = Array.isArray(app.default.current)
172
+ ? app.default.current
173
+ : [app.default.current];
174
+ callHandler(fileCurrents, (cn, ...cns) => {
175
+ if (cn) {
176
+ treeDone(true, ...cns);
177
+ }
178
+ else {
179
+ processFiles(node, idx + 1, filesDone, treeDone);
180
+ }
181
+ });
182
+ });
183
+ };
184
+ const processChildNodes = (node, done) => {
185
+ const childKeys = Array.from(node.children.keys());
186
+ let childIdx = 0;
187
+ const nextChild = (...cns) => {
188
+ if (cns.length > 0 && cns[0]) {
189
+ done(...cns);
190
+ return;
191
+ }
192
+ if (childIdx >= childKeys.length) {
193
+ done();
100
194
  return;
101
195
  }
196
+ const childNode = node.children.get(childKeys[childIdx++]);
197
+ if (childNode) {
198
+ processNode(childNode, nextChild);
199
+ }
200
+ else {
201
+ nextChild();
202
+ }
203
+ };
204
+ nextChild();
205
+ };
206
+ const startStep = (cn, ...cns) => {
207
+ if (cn) {
208
+ next(...cns);
209
+ return;
102
210
  }
103
- callHandler(currents, nextStep);
211
+ processNode(root, next);
104
212
  };
105
- return nextStep;
213
+ return startStep;
106
214
  };
107
215
 
108
- export { clearModuleCache, createNextStep };
216
+ export { clearModuleCache, createFileTreeStep, createNextStep };
@@ -1,2 +1,2 @@
1
1
  import { Next, Events, EventKeys, ResponseRoute } from '../types';
2
- export declare const createRouteProcessChildren: <T extends EventKeys>(valueEvent: Events[T], select: T, nextCycle: Next, callHandler: (currents: any, nextEvent: any) => void) => (nodes: ResponseRoute[], middleware: any, next: () => Promise<void> | void) => void;
2
+ export declare const createRouteProcessChildren: <T extends EventKeys>(valueEvent: Events[T], select: T, nextCycle: Next, callHandler: (currents: any, nextEvent: any) => void) => (nodes: ResponseRoute[], _pending: any[], next: () => Promise<void> | void) => void;
@@ -12,7 +12,40 @@ function isFunction(value) {
12
12
  return isAsyncFunction(value) || typeof value === 'function' || value instanceof Function;
13
13
  }
14
14
  const createRouteProcessChildren = (valueEvent, select, nextCycle, callHandler) => {
15
- const processChildren = (nodes, middleware, next) => {
15
+ const handlerResultCache = new Map();
16
+ const collectHandlers = (tail) => {
17
+ const result = [];
18
+ let node = tail;
19
+ while (node) {
20
+ result.push(node.handler);
21
+ node = node.prev;
22
+ }
23
+ result.reverse();
24
+ return result;
25
+ };
26
+ const resolveHandler = async (handler) => {
27
+ if (handlerResultCache.has(handler)) {
28
+ return handlerResultCache.get(handler);
29
+ }
30
+ const app = await handler();
31
+ const result = { matched: true, currents: [] };
32
+ if (isFunction(app)) {
33
+ result.currents.push(app);
34
+ }
35
+ else {
36
+ const selects = Array.isArray(app.select) ? app.select : [app.select];
37
+ if (!selects.includes(select)) {
38
+ result.matched = false;
39
+ }
40
+ else {
41
+ const items = Array.isArray(app.current) ? app.current : [app.current];
42
+ result.currents.push(...items);
43
+ }
44
+ }
45
+ handlerResultCache.set(handler, result);
46
+ return result;
47
+ };
48
+ const processChildren = (nodes, pendingTail, next) => {
16
49
  if (!nodes || nodes.length === 0) {
17
50
  void next();
18
51
  return;
@@ -57,35 +90,25 @@ const createRouteProcessChildren = (valueEvent, select, nextCycle, callHandler)
57
90
  void nextNode();
58
91
  return;
59
92
  }
93
+ const currentNode = { handler: node.handler, prev: pendingTail };
60
94
  if (node.children && node.children.length > 0) {
61
- middleware.push(node.handler);
62
- processChildren(node.children, middleware, () => {
63
- middleware.pop();
95
+ processChildren(node.children, currentNode, () => {
64
96
  void nextNode();
65
97
  });
66
98
  return;
67
99
  }
68
- middleware.push(node.handler);
69
- const currentsAndMiddleware = middleware;
70
100
  try {
71
- const currents = [];
72
- for (const item of currentsAndMiddleware) {
73
- const app = await item();
74
- if (isFunction(app)) {
75
- currents.push(app);
76
- continue;
77
- }
78
- const selects = Array.isArray(app.select) ? app.select : [app.select];
79
- if (!selects.includes(select)) {
80
- middleware.pop();
101
+ const allHandlers = collectHandlers(currentNode);
102
+ const allCurrents = [];
103
+ for (const h of allHandlers) {
104
+ const result = await resolveHandler(h);
105
+ if (!result.matched) {
81
106
  void nextNode();
82
107
  return;
83
108
  }
84
- const currentsItem = Array.isArray(app.current) ? app.current : [app.current];
85
- currents.push(...currentsItem);
109
+ allCurrents.push(...result.currents);
86
110
  }
87
- middleware.pop();
88
- callHandler(currents, (cn, ...cns) => {
111
+ callHandler(allCurrents, (cn, ...cns) => {
89
112
  if (cn) {
90
113
  nextCycle(true, ...cns);
91
114
  return;
@@ -94,13 +117,14 @@ const createRouteProcessChildren = (valueEvent, select, nextCycle, callHandler)
94
117
  });
95
118
  }
96
119
  catch (err) {
97
- middleware.pop();
98
120
  showErrorModule(err);
99
121
  }
100
122
  };
101
123
  void nextNode();
102
124
  };
103
- return processChildren;
125
+ return (nodes, _pending, next) => {
126
+ processChildren(nodes, null, next);
127
+ };
104
128
  };
105
129
 
106
130
  export { createRouteProcessChildren };
@@ -1,14 +1,14 @@
1
- import { Response, ResponseRouter } from './store.js';
1
+ import { ResponseTree, ResponseRouter } from './store.js';
2
2
  import { createCallHandler } from './event-processor-callHandler.js';
3
- import { createNextStep } from './event-processor-cycleFiles.js';
3
+ import { createFileTreeStep } from './event-processor-cycleFiles.js';
4
4
  import { createRouteProcessChildren } from './event-processor-cycleRoute.js';
5
5
 
6
- const responseSingleton = new Response();
6
+ const responseTreeSingleton = new ResponseTree();
7
7
  const responseRouterSingleton = new ResponseRouter();
8
8
  const expendEvent = (valueEvent, select, next) => {
9
- const StoreResponse = responseSingleton.value;
9
+ const root = responseTreeSingleton.value;
10
10
  const callHandler = createCallHandler(valueEvent);
11
- const nextEvent = createNextStep(valueEvent, select, next, StoreResponse, callHandler);
11
+ const nextEvent = createFileTreeStep(valueEvent, select, next, root, callHandler);
12
12
  const routes = responseRouterSingleton.value;
13
13
  const callRouteHandler = createCallHandler(valueEvent);
14
14
  const processChildren = createRouteProcessChildren(valueEvent, select, nextEvent, callRouteHandler);
@@ -1,14 +1,14 @@
1
- import { Middleware, MiddlewareRouter } from './store.js';
1
+ import { MiddlewareTree, MiddlewareRouter } from './store.js';
2
2
  import { createCallHandler } from './event-processor-callHandler.js';
3
- import { createNextStep } from './event-processor-cycleFiles.js';
3
+ import { createFileTreeStep } from './event-processor-cycleFiles.js';
4
4
  import { createRouteProcessChildren } from './event-processor-cycleRoute.js';
5
5
 
6
- const middlewareSingleton = new Middleware();
6
+ const middlewareTreeSingleton = new MiddlewareTree();
7
7
  const middlewareRouterSingleton = new MiddlewareRouter();
8
8
  const expendMiddleware = (valueEvent, select, next) => {
9
- const mwFiles = middlewareSingleton.value;
9
+ const root = middlewareTreeSingleton.value;
10
10
  const callHandler = createCallHandler(valueEvent);
11
- const nextMiddleware = createNextStep(valueEvent, select, next, mwFiles, callHandler);
11
+ const nextMiddleware = createFileTreeStep(valueEvent, select, next, root, callHandler);
12
12
  const routes = middlewareRouterSingleton.value;
13
13
  const callRouteHandler = createCallHandler(valueEvent);
14
14
  const processChildren = createRouteProcessChildren(valueEvent, select, nextMiddleware, callRouteHandler);
@@ -98,6 +98,9 @@ const onProcessor = (name, event, data) => {
98
98
  }
99
99
  }
100
100
  }
101
+ else {
102
+ event['MessageText'] = '';
103
+ }
101
104
  const masterId = value?.master_id;
102
105
  const masterKey = value?.master_key;
103
106
  if (event['UserId'] && matchIn(masterId, event['UserId'])) {
package/lib/app/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { ChildrenApp, Core, Logger, Middleware, MiddlewareRouter, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, Response, ResponseMiddleware, ResponseRouter, State, StateSubscribe, SubscribeList, bumpStoreVersion, core, getSubscribeList, logger } from './store.js';
1
+ export { ChildrenApp, Core, Logger, Middleware, MiddlewareRouter, MiddlewareTree, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, Response, ResponseMiddleware, ResponseRouter, ResponseTree, State, StateSubscribe, SubscribeList, bumpStoreVersion, core, getSubscribeList, logger } from './store.js';
2
2
  export { loadModels, run } from './load_modules/load.js';
3
3
  export { loadChildren, loadChildrenFile } from './load_modules/loadChild.js';
4
4
  export { defineChildren } from './define-children.js';
@@ -1,5 +1,5 @@
1
1
  import { SinglyLinkedList } from './SinglyLinkedList';
2
- import { childrenCallbackRes, ChildrenCycle, EventCycleEnum, EventKeys, StoreMiddlewareItem, StoreResponseItem, SubscribeValue } from '../types';
2
+ import { childrenCallbackRes, ChildrenCycle, EventCycleEnum, EventKeys, FileTreeNode, StoreMiddlewareItem, StoreResponseItem, SubscribeValue } from '../types';
3
3
  export declare class Logger {
4
4
  #private;
5
5
  constructor();
@@ -24,6 +24,14 @@ export declare class Response {
24
24
  export declare class ResponseMiddleware {
25
25
  find(name: string, stateKey: string): StoreResponseItem[];
26
26
  }
27
+ export declare class MiddlewareTree {
28
+ #private;
29
+ get value(): FileTreeNode;
30
+ }
31
+ export declare class ResponseTree {
32
+ #private;
33
+ get value(): FileTreeNode;
34
+ }
27
35
  export declare class ResponseRouter {
28
36
  #private;
29
37
  get value(): any[];
package/lib/app/store.js CHANGED
@@ -157,6 +157,96 @@ class ResponseMiddleware {
157
157
  return mr;
158
158
  }
159
159
  }
160
+ function createTreeNode() {
161
+ return { files: [], children: new Map() };
162
+ }
163
+ function buildFileTree(files, middlewareResponse) {
164
+ const root = createTreeNode();
165
+ for (const file of files) {
166
+ if (!file.stateKey) {
167
+ root.files.push(file);
168
+ continue;
169
+ }
170
+ const parts = file.stateKey.split(':');
171
+ let node = root;
172
+ for (const part of parts) {
173
+ if (!node.children.has(part)) {
174
+ node.children.set(part, createTreeNode());
175
+ }
176
+ node = node.children.get(part);
177
+ }
178
+ node.files.push(file);
179
+ }
180
+ if (middlewareResponse) {
181
+ for (const [key, mw] of Object.entries(middlewareResponse)) {
182
+ const parts = key.split(':');
183
+ let node = root;
184
+ for (const part of parts) {
185
+ if (!node.children.has(part)) {
186
+ node.children.set(part, createTreeNode());
187
+ }
188
+ node = node.children.get(part);
189
+ }
190
+ node.middleware = mw;
191
+ }
192
+ }
193
+ return root;
194
+ }
195
+ function mergeFileTree(target, source) {
196
+ target.files.push(...source.files);
197
+ if (source.middleware) {
198
+ if (!target.middleware) {
199
+ target.middleware = source.middleware;
200
+ }
201
+ else {
202
+ console.warn(`[mergeFileTree] middleware conflict at same stateKey, keeping first (${target.middleware.path}), discarding (${source.middleware.path})`);
203
+ }
204
+ }
205
+ for (const [key, child] of source.children) {
206
+ if (target.children.has(key)) {
207
+ mergeFileTree(target.children.get(key), child);
208
+ }
209
+ else {
210
+ target.children.set(key, child);
211
+ }
212
+ }
213
+ }
214
+ class MiddlewareTree {
215
+ #cache = null;
216
+ #cacheVersion = -1;
217
+ get value() {
218
+ if (this.#cacheVersion === _storeVersion && this.#cache !== null) {
219
+ return this.#cache;
220
+ }
221
+ const root = createTreeNode();
222
+ for (const appKey of Object.keys(alemonjsCore.storeChildrenApp)) {
223
+ const app = alemonjsCore.storeChildrenApp[appKey];
224
+ const subTree = buildFileTree(app.middleware ?? [], undefined);
225
+ mergeFileTree(root, subTree);
226
+ }
227
+ this.#cache = root;
228
+ this.#cacheVersion = _storeVersion;
229
+ return this.#cache;
230
+ }
231
+ }
232
+ class ResponseTree {
233
+ #cache = null;
234
+ #cacheVersion = -1;
235
+ get value() {
236
+ if (this.#cacheVersion === _storeVersion && this.#cache !== null) {
237
+ return this.#cache;
238
+ }
239
+ const root = createTreeNode();
240
+ for (const appKey of Object.keys(alemonjsCore.storeChildrenApp)) {
241
+ const app = alemonjsCore.storeChildrenApp[appKey];
242
+ const subTree = buildFileTree(app.response ?? [], app.middlewareResponse);
243
+ mergeFileTree(root, subTree);
244
+ }
245
+ this.#cache = root;
246
+ this.#cacheVersion = _storeVersion;
247
+ return this.#cache;
248
+ }
249
+ }
160
250
  class ResponseRouter {
161
251
  #cache = null;
162
252
  #cacheVersion = -1;
@@ -357,4 +447,4 @@ process?.on?.('exit', code => {
357
447
  logger.info?.(`[alemonjs][exit] 进程退出,code=${code}`);
358
448
  });
359
449
 
360
- export { ChildrenApp, Core, Logger, Middleware, MiddlewareRouter, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, Response, ResponseMiddleware, ResponseRouter, State, StateSubscribe, SubscribeList, bumpStoreVersion, core, getSubscribeList, logger };
450
+ export { ChildrenApp, Core, Logger, Middleware, MiddlewareRouter, MiddlewareTree, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, Response, ResponseMiddleware, ResponseRouter, ResponseTree, State, StateSubscribe, SubscribeList, bumpStoreVersion, core, getSubscribeList, logger };
@@ -14,10 +14,10 @@ import { onProcessor } from '../../app/event-processor.js';
14
14
  import '../../app/event-response.js';
15
15
  import { createResult } from '../../core/utils.js';
16
16
  import '../../app/hook-event-context.js';
17
- import '../../app/event-utils.js';
18
17
  import { apiResolves, apiTimeouts, actionResolves, actionTimeouts, FULL_RECEIVE_HEADER } from '../processor/config.js';
19
18
  import { setDirectSend } from '../processor/transport.js';
20
19
  import '../../app/message-format-old.js';
20
+ import '../../app/event-utils.js';
21
21
  import '../../app/message-api.js';
22
22
  import { createWSConnector } from './base.js';
23
23
  import { createDirectServer } from '../../process/direct-channel.js';
@@ -21,8 +21,8 @@ class App extends Component {
21
21
  }
22
22
  a { color: #0099cc; }
23
23
  `;
24
- const head = Head(null, Title('欢迎使用 AlemonJS!'), Style(style));
25
- const body = Body(null, H1('AlemonJS 启动成功!'), P(null, '已成功通过 ', A({ href: 'https://alemonjs.com', target: '_blank' }, 'AlemonJS 框架'), ' 启动。'), Div({ className: 'footer' }, '— 感谢选择 AlemonJS。'));
24
+ const head = Head(null, Title('欢迎使用 ALemonJS!'), Style(style));
25
+ const body = Body(null, H1('ALemonJS 启动成功!'), P(null, '已成功通过 ', A({ href: 'https://alemonjs.com', target: '_blank' }, 'ALemonJS 框架'), ' 启动。'), Div({ className: 'footer' }, '— 感谢选择 ALemonJS。'));
26
26
  return Html(null, head, body);
27
27
  }
28
28
  }
package/lib/client.js CHANGED
@@ -27,8 +27,8 @@ import './app/event-middleware.js';
27
27
  import './app/event-processor.js';
28
28
  import './app/event-response.js';
29
29
  import './app/hook-event-context.js';
30
- import './app/event-utils.js';
31
30
  import './app/message-format-old.js';
31
+ import './app/event-utils.js';
32
32
  import './app/message-api.js';
33
33
  import './process/platform.js';
34
34
  import './process/module.js';
package/lib/index.js CHANGED
@@ -5,7 +5,7 @@ export { createEventName, createHash, createResult, createUserHashKey, fastHash,
5
5
  export { cbpClient } from './cbp/connects/client.js';
6
6
  export { cbpPlatform } from './cbp/connects/platform.js';
7
7
  export { cbpServer } from './cbp/server/main.js';
8
- export { ChildrenApp, Core, Logger, Middleware, MiddlewareRouter, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, Response, ResponseMiddleware, ResponseRouter, State, StateSubscribe, SubscribeList, bumpStoreVersion, core, getSubscribeList, logger } from './app/store.js';
8
+ export { ChildrenApp, Core, Logger, Middleware, MiddlewareRouter, MiddlewareTree, ProcessorEventAutoClearMap, ProcessorEventUserAutoClearMap, Response, ResponseMiddleware, ResponseRouter, ResponseTree, State, StateSubscribe, SubscribeList, bumpStoreVersion, core, getSubscribeList, logger } from './app/store.js';
9
9
  export { loadModels, run } from './app/load_modules/load.js';
10
10
  export { loadChildren, loadChildrenFile } from './app/load_modules/loadChild.js';
11
11
  export { defineChildren } from './app/define-children.js';
@@ -21,8 +21,8 @@ class App extends Component {
21
21
  }
22
22
  a { color: #0099cc; }
23
23
  `;
24
- const head = Head(null, Title('欢迎使用 AlemonJS!'), Style(style));
25
- const body = Body(null, H1('AlemonJS 启动成功!'), P(null, '已成功通过 ', A({ href: 'https://alemonjs.com', target: '_blank' }, 'AlemonJS 框架'), ' 启动。'), P(null, '如果想访问主应用,请访问, ', A({ href: '/app', target: '_blank' }, '/app'), '(对应根目录index.html)'), P(null, '如果想访问其他应用,请访问 ', A({ href: '/apps/[package-name]', target: '_blank' }, '/apps/[package-name]'), '。(对应/packages/[package-name]/index.html)'), Div({ className: 'footer' }, '— 感谢选择 AlemonJS。'));
24
+ const head = Head(null, Title('欢迎使用 ALemonJS!'), Style(style));
25
+ const body = Body(null, H1('ALemonJS 启动成功!'), P(null, '已成功通过 ', A({ href: 'https://alemonjs.com', target: '_blank' }, 'ALemonJS 框架'), ' 启动。'), P(null, '如果想访问主应用,请访问, ', A({ href: '/app', target: '_blank' }, '/app'), '(对应根目录index.html)'), P(null, '如果想访问其他应用,请访问 ', A({ href: '/apps/[package-name]', target: '_blank' }, '/apps/[package-name]'), '。(对应/packages/[package-name]/index.html)'), Div({ className: 'footer' }, '— 感谢选择 ALemonJS。'));
26
26
  return Html(null, head, body);
27
27
  }
28
28
  }
@@ -23,6 +23,11 @@ export type StoreMiddlewareItem = {
23
23
  select: string;
24
24
  } | null;
25
25
  };
26
+ export type FileTreeNode = {
27
+ middleware?: StoreResponseItem;
28
+ files: StoreResponseItem[];
29
+ children: Map<string, FileTreeNode>;
30
+ };
26
31
  export type StoreMiddleware = {
27
32
  [key in EventKeys]: StoreResponseItem[];
28
33
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alemonjs",
3
- "version": "2.1.52",
3
+ "version": "2.1.53",
4
4
  "description": "bot script",
5
5
  "author": "lemonade",
6
6
  "license": "MIT",
@@ -69,5 +69,5 @@
69
69
  "type": "git",
70
70
  "url": "https://github.com/lemonade-lab/alemonjs.git"
71
71
  },
72
- "gitHead": "90cafaf98cefa01152764922f58e543f0c513811"
73
- }
72
+ "gitHead": "c6aa5616afe091a37610dad22fbb2d2618d943b8"
73
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2013-present, Yuxi (Evan) You
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIdED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.