@nocobase/plugin-flow-engine 2.1.0-beta.43 → 2.1.0-beta.45
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/client/index.js +1 -1
- package/dist/externalVersion.js +9 -9
- package/dist/node_modules/@ant-design/icons-svg/package.json +1 -1
- package/dist/node_modules/acorn/package.json +1 -1
- package/dist/node_modules/acorn-jsx/package.json +1 -1
- package/dist/node_modules/acorn-walk/package.json +1 -1
- package/dist/node_modules/ses/package.json +1 -1
- package/dist/node_modules/zod/package.json +1 -1
- package/dist/server/flow-surfaces/authoring-validation.js +160 -21
- package/dist/server/flow-surfaces/catalog.js +9 -5
- package/dist/server/flow-surfaces/chart-config.js +29 -6
- package/dist/server/flow-surfaces/contract-guard.js +39 -5
- package/dist/server/flow-surfaces/default-block-actions.js +2 -0
- package/dist/server/flow-surfaces/errors.d.ts +15 -0
- package/dist/server/flow-surfaces/errors.js +49 -3
- package/dist/server/flow-surfaces/filter-group.d.ts +7 -1
- package/dist/server/flow-surfaces/filter-group.js +175 -71
- package/dist/server/flow-surfaces/public-data-surface-default-filter.js +2 -1
- package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.d.ts +66 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/bindings.js +661 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/execution.d.ts +20 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/execution.js +275 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/parser.d.ts +16 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/parser.js +130 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.d.ts +20 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/react-values.js +401 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.d.ts +21 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/request-config.js +199 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.d.ts +70 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/source.js +895 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.d.ts +23 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-bindings.js +618 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.d.ts +196 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/static-values.js +1777 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/walk.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/ast/walk.js +55 -0
- package/dist/server/flow-surfaces/runjs-authoring/collectors.d.ts +12 -0
- package/dist/server/flow-surfaces/runjs-authoring/collectors.js +589 -0
- package/dist/server/flow-surfaces/runjs-authoring/index.d.ts +2 -25
- package/dist/server/flow-surfaces/runjs-authoring/index.js +5 -11138
- package/dist/server/flow-surfaces/runjs-authoring/inspect.d.ts +13 -0
- package/dist/server/flow-surfaces/runjs-authoring/inspect.js +149 -0
- package/dist/server/flow-surfaces/runjs-authoring/internal-types.d.ts +333 -0
- package/dist/server/flow-surfaces/runjs-authoring/internal-types.js +36 -0
- package/dist/server/flow-surfaces/runjs-authoring/rules.js +2 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.d.ts +67 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/constants.js +757 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.d.ts +22 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/errors.js +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.d.ts +16 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/source-budget.js +115 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.d.ts +19 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/surface.js +140 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.d.ts +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/runtime/types.js +24 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.d.ts +138 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/ctx-api.js +1779 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/filter.js +1583 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.d.ts +195 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/index.js +463 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.d.ts +48 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react-render.js +379 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react.d.ts +26 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/react.js +1441 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/resource.d.ts +23 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/resource.js +1427 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.d.ts +91 -0
- package/dist/server/flow-surfaces/runjs-authoring/scan/source-patterns.js +889 -0
- package/dist/server/flow-surfaces/runjs-authoring/types.d.ts +1 -1
- package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.d.ts +10 -0
- package/dist/server/flow-surfaces/runjs-authoring/unknown-global-stop/index.js +40 -0
- package/dist/server/flow-surfaces/runjs-authoring/validators/index.d.ts +12 -0
- package/dist/server/flow-surfaces/runjs-authoring/validators/index.js +887 -0
- package/dist/server/flow-surfaces/service-helpers.d.ts +29 -0
- package/dist/server/flow-surfaces/service-helpers.js +105 -0
- package/dist/server/flow-surfaces/service-utils.d.ts +15 -3
- package/dist/server/flow-surfaces/service-utils.js +5 -4
- package/dist/server/flow-surfaces/service.d.ts +4 -0
- package/dist/server/flow-surfaces/service.js +360 -30
- package/dist/server/flow-surfaces/types.d.ts +3 -0
- package/dist/server/repository.d.ts +15 -1
- package/dist/server/repository.js +262 -23
- package/dist/server/template/contexts.d.ts +2 -0
- package/dist/server/template/contexts.js +34 -0
- package/dist/server/template/resolver.js +233 -22
- package/dist/swagger/flow-surfaces.d.ts +175 -0
- package/dist/swagger/flow-surfaces.js +130 -51
- package/dist/swagger/index.d.ts +175 -0
- package/package.json +2 -2
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __defProp = Object.defineProperty;
|
|
11
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
12
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
13
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
14
|
+
var __export = (target, all) => {
|
|
15
|
+
for (var name in all)
|
|
16
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
17
|
+
};
|
|
18
|
+
var __copyProps = (to, from, except, desc) => {
|
|
19
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
20
|
+
for (let key of __getOwnPropNames(from))
|
|
21
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
22
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
23
|
+
}
|
|
24
|
+
return to;
|
|
25
|
+
};
|
|
26
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
27
|
+
var execution_exports = {};
|
|
28
|
+
__export(execution_exports, {
|
|
29
|
+
collectAstForOfSourceTargetElementMembers: () => collectAstForOfSourceTargetElementMembers,
|
|
30
|
+
collectAstForOfSourceTargets: () => collectAstForOfSourceTargets,
|
|
31
|
+
collectAstIdentifierWritesFromAst: () => collectAstIdentifierWritesFromAst,
|
|
32
|
+
findAstInnermostSynchronousIifeFunctionAncestorIndex: () => findAstInnermostSynchronousIifeFunctionAncestorIndex,
|
|
33
|
+
getAstLoopPatternTarget: () => getAstLoopPatternTarget,
|
|
34
|
+
getAstWriteExecutionContext: () => getAstWriteExecutionContext,
|
|
35
|
+
hasAstForOfSourceTargets: () => hasAstForOfSourceTargets,
|
|
36
|
+
isAstForOfLoopVariableDeclaratorWithSourceTargets: () => isAstForOfLoopVariableDeclaratorWithSourceTargets
|
|
37
|
+
});
|
|
38
|
+
module.exports = __toCommonJS(execution_exports);
|
|
39
|
+
var import_internal_types = require("../internal-types");
|
|
40
|
+
var import_walk = require("./walk");
|
|
41
|
+
var import_bindings = require("./bindings");
|
|
42
|
+
var import_static_values = require("./static-values");
|
|
43
|
+
function collectAstIdentifierWritesFromAst(ast, source) {
|
|
44
|
+
const writes = [];
|
|
45
|
+
const addLoopHeaderWrites = (target, ancestors, fallbackIndex) => {
|
|
46
|
+
const writeContext = getAstWriteExecutionContext(ancestors, source.length);
|
|
47
|
+
(0, import_static_values.collectAstPatternBindingIdentifiers)(target, (name, bindingNode) => {
|
|
48
|
+
writes.push({
|
|
49
|
+
alwaysRunsInExecutionScope: writeContext.alwaysRunsInExecutionScope,
|
|
50
|
+
executionScope: writeContext.executionScope,
|
|
51
|
+
name,
|
|
52
|
+
index: typeof (bindingNode == null ? void 0 : bindingNode.start) === "number" ? bindingNode.start : fallbackIndex
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
(0, import_static_values.collectAstPatternMemberExpressions)(target, (memberNode) => {
|
|
56
|
+
const memberWrite = (0, import_static_values.getAstMemberWriteLookup)(memberNode);
|
|
57
|
+
if (!memberWrite) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
writes.push({
|
|
61
|
+
alwaysRunsInExecutionScope: writeContext.alwaysRunsInExecutionScope,
|
|
62
|
+
executionScope: writeContext.executionScope,
|
|
63
|
+
name: memberWrite.aliasName,
|
|
64
|
+
index: memberWrite.index
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
(0, import_walk.walkAstAncestor)(ast, {
|
|
69
|
+
AssignmentExpression(node, ancestors) {
|
|
70
|
+
if (!(0, import_static_values.isAstDefiniteAssignmentOperator)(node.operator)) {
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
const writeContext = getAstWriteExecutionContext(ancestors, source.length);
|
|
74
|
+
(0, import_static_values.collectAstPatternBindingIdentifiers)(node.left, (name, bindingNode) => {
|
|
75
|
+
writes.push({
|
|
76
|
+
alwaysRunsInExecutionScope: writeContext.alwaysRunsInExecutionScope,
|
|
77
|
+
executionScope: writeContext.executionScope,
|
|
78
|
+
name,
|
|
79
|
+
index: typeof (bindingNode == null ? void 0 : bindingNode.start) === "number" ? bindingNode.start : node.start || 0
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
(0, import_static_values.collectAstPatternMemberExpressions)(node.left, (memberNode) => {
|
|
83
|
+
const memberWrite = (0, import_static_values.getAstMemberWriteLookup)(memberNode);
|
|
84
|
+
if (!memberWrite) {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
writes.push({
|
|
88
|
+
alwaysRunsInExecutionScope: writeContext.alwaysRunsInExecutionScope,
|
|
89
|
+
executionScope: writeContext.executionScope,
|
|
90
|
+
name: memberWrite.aliasName,
|
|
91
|
+
index: memberWrite.index
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
VariableDeclarator(node, ancestors) {
|
|
96
|
+
if (!node.init) {
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const writeContext = getAstWriteExecutionContext(ancestors, source.length);
|
|
100
|
+
(0, import_static_values.collectAstPatternBindingIdentifiers)(node.id, (name, bindingNode) => {
|
|
101
|
+
writes.push({
|
|
102
|
+
alwaysRunsInExecutionScope: writeContext.alwaysRunsInExecutionScope,
|
|
103
|
+
executionScope: writeContext.executionScope,
|
|
104
|
+
name,
|
|
105
|
+
index: typeof (bindingNode == null ? void 0 : bindingNode.start) === "number" ? bindingNode.start : node.start || 0
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
},
|
|
109
|
+
UpdateExpression(node, ancestors) {
|
|
110
|
+
var _a;
|
|
111
|
+
const writeContext = getAstWriteExecutionContext(ancestors, source.length);
|
|
112
|
+
if (((_a = node.argument) == null ? void 0 : _a.type) === "Identifier") {
|
|
113
|
+
writes.push({
|
|
114
|
+
alwaysRunsInExecutionScope: writeContext.alwaysRunsInExecutionScope,
|
|
115
|
+
executionScope: writeContext.executionScope,
|
|
116
|
+
name: node.argument.name,
|
|
117
|
+
index: typeof node.argument.start === "number" ? node.argument.start : node.start || 0
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
(0, import_static_values.collectAstPatternMemberExpressions)(node.argument, (memberNode) => {
|
|
121
|
+
const memberWrite = (0, import_static_values.getAstMemberWriteLookup)(memberNode);
|
|
122
|
+
if (!memberWrite) {
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
writes.push({
|
|
126
|
+
alwaysRunsInExecutionScope: writeContext.alwaysRunsInExecutionScope,
|
|
127
|
+
executionScope: writeContext.executionScope,
|
|
128
|
+
name: memberWrite.aliasName,
|
|
129
|
+
index: memberWrite.index
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
ForInStatement(node, ancestors) {
|
|
134
|
+
var _a, _b;
|
|
135
|
+
if (!(0, import_bindings.isAstDefinitelyNonEmptyForInSource)(node.right) || ((_a = node.left) == null ? void 0 : _a.type) === "VariableDeclaration") {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
addLoopHeaderWrites(node.left, ancestors, ((_b = node.left) == null ? void 0 : _b.start) || node.start || 0);
|
|
139
|
+
},
|
|
140
|
+
ForOfStatement(node, ancestors) {
|
|
141
|
+
var _a, _b;
|
|
142
|
+
if (!(0, import_bindings.isAstDefinitelyNonEmptyForOfSource)(node.right) || ((_a = node.left) == null ? void 0 : _a.type) === "VariableDeclaration") {
|
|
143
|
+
return;
|
|
144
|
+
}
|
|
145
|
+
addLoopHeaderWrites(node.left, ancestors, ((_b = node.left) == null ? void 0 : _b.start) || node.start || 0);
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
return writes;
|
|
149
|
+
}
|
|
150
|
+
function getAstWriteExecutionContext(ancestors, sourceLength) {
|
|
151
|
+
const iifeFunctionIndex = findAstInnermostSynchronousIifeFunctionAncestorIndex(ancestors);
|
|
152
|
+
if (iifeFunctionIndex > 0) {
|
|
153
|
+
const callAncestors = ancestors.slice(0, iifeFunctionIndex);
|
|
154
|
+
return {
|
|
155
|
+
alwaysRunsInExecutionScope: (0, import_bindings.isAstAlwaysExecutedInCurrentExecutionScope)(callAncestors),
|
|
156
|
+
executionScope: (0, import_bindings.getAstExecutionScopeRange)(callAncestors.slice(0, -1), sourceLength)
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return {
|
|
160
|
+
alwaysRunsInExecutionScope: (0, import_bindings.isAstAlwaysExecutedInCurrentExecutionScope)(ancestors),
|
|
161
|
+
executionScope: (0, import_bindings.getAstExecutionScopeRange)(ancestors, sourceLength)
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
function findAstInnermostSynchronousIifeFunctionAncestorIndex(ancestors) {
|
|
165
|
+
for (let index = ancestors.length - 1; index > 0; index -= 1) {
|
|
166
|
+
const node = ancestors[index];
|
|
167
|
+
if (!(0, import_bindings.isAstFunctionLike)(node) || node.async) {
|
|
168
|
+
continue;
|
|
169
|
+
}
|
|
170
|
+
const parent = ancestors[index - 1];
|
|
171
|
+
if ((parent == null ? void 0 : parent.type) === "CallExpression" && (0, import_bindings.unwrapAstChainExpression)(parent.callee) === node) {
|
|
172
|
+
return index;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return -1;
|
|
176
|
+
}
|
|
177
|
+
function getAstLoopPatternTarget(left) {
|
|
178
|
+
var _a, _b;
|
|
179
|
+
if ((left == null ? void 0 : left.type) === "VariableDeclaration") {
|
|
180
|
+
return ((_a = left.declarations) == null ? void 0 : _a.length) === 1 ? (_b = left.declarations[0]) == null ? void 0 : _b.id : void 0;
|
|
181
|
+
}
|
|
182
|
+
return left;
|
|
183
|
+
}
|
|
184
|
+
function isAstForOfLoopVariableDeclaratorWithSourceTargets(node, ancestors, aliases, identifierBindings) {
|
|
185
|
+
var _a;
|
|
186
|
+
const declaration = ancestors[ancestors.length - 2];
|
|
187
|
+
const loop = ancestors[ancestors.length - 3];
|
|
188
|
+
return (declaration == null ? void 0 : declaration.type) === "VariableDeclaration" && (loop == null ? void 0 : loop.type) === "ForOfStatement" && loop.left === declaration && ((_a = declaration.declarations) == null ? void 0 : _a.length) === 1 && declaration.declarations[0] === node && hasAstForOfSourceTargets(loop.right, aliases, identifierBindings);
|
|
189
|
+
}
|
|
190
|
+
function hasAstForOfSourceTargets(sourceNode, aliases, identifierBindings) {
|
|
191
|
+
let hasSourceTarget = false;
|
|
192
|
+
collectAstForOfSourceTargets(sourceNode, aliases, identifierBindings, () => {
|
|
193
|
+
hasSourceTarget = true;
|
|
194
|
+
});
|
|
195
|
+
return hasSourceTarget;
|
|
196
|
+
}
|
|
197
|
+
function collectAstForOfSourceTargets(sourceNode, aliases, identifierBindings, visit) {
|
|
198
|
+
const seenTargets = /* @__PURE__ */ new Set();
|
|
199
|
+
const emitSourceTarget = (sourceTarget) => {
|
|
200
|
+
if (!sourceTarget) {
|
|
201
|
+
return;
|
|
202
|
+
}
|
|
203
|
+
const key = sourceTarget.aliasName ? `${sourceTarget.aliasName}@${sourceTarget.index || 0}` : sourceTarget.node ? `${sourceTarget.node.start || 0}:${sourceTarget.node.end || 0}` : `source:${sourceTarget.index || 0}`;
|
|
204
|
+
if (seenTargets.has(key)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
seenTargets.add(key);
|
|
208
|
+
visit(sourceTarget);
|
|
209
|
+
};
|
|
210
|
+
const collectSourceTargets = (node) => {
|
|
211
|
+
const unwrapped = (0, import_bindings.unwrapAstChainExpression)(node);
|
|
212
|
+
if (!unwrapped) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
if (unwrapped.type === "ConditionalExpression") {
|
|
216
|
+
collectSourceTargets(unwrapped.consequent);
|
|
217
|
+
collectSourceTargets(unwrapped.alternate);
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
if (unwrapped.type === "LogicalExpression") {
|
|
221
|
+
collectSourceTargets(unwrapped.left);
|
|
222
|
+
collectSourceTargets(unwrapped.right);
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (unwrapped.type === "SequenceExpression") {
|
|
226
|
+
const expressions = unwrapped.expressions || [];
|
|
227
|
+
collectSourceTargets(expressions[expressions.length - 1]);
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (unwrapped.type === "AssignmentExpression" && (0, import_static_values.isAstCtxApiAliasAssignmentOperator)(unwrapped.operator)) {
|
|
231
|
+
collectSourceTargets(unwrapped.right);
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
if (unwrapped.type === "ArrayExpression") {
|
|
235
|
+
for (const element of unwrapped.elements || []) {
|
|
236
|
+
if (!element) {
|
|
237
|
+
continue;
|
|
238
|
+
}
|
|
239
|
+
if (element.type === "SpreadElement") {
|
|
240
|
+
collectSourceTargets(element.argument);
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
emitSourceTarget((0, import_static_values.createAstPatternSourceTarget)(element));
|
|
244
|
+
}
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
247
|
+
const sourceTarget = (0, import_static_values.createAstPatternSourceTarget)(unwrapped);
|
|
248
|
+
collectAstForOfSourceTargetElementMembers(sourceTarget, aliases, identifierBindings).forEach((member) => {
|
|
249
|
+
emitSourceTarget((0, import_static_values.getAstPatternMemberSourceTarget)(sourceTarget, member));
|
|
250
|
+
});
|
|
251
|
+
};
|
|
252
|
+
collectSourceTargets(sourceNode);
|
|
253
|
+
}
|
|
254
|
+
function collectAstForOfSourceTargetElementMembers(sourceTarget, aliases, identifierBindings) {
|
|
255
|
+
const members = /* @__PURE__ */ new Set();
|
|
256
|
+
(0, import_static_values.collectAstRestCarrierAliasCopies)(sourceTarget, "__forof__", aliases, identifierBindings, (suffix) => {
|
|
257
|
+
const firstMember = suffix.split(".")[0];
|
|
258
|
+
const numericMember = Number(firstMember);
|
|
259
|
+
if (firstMember === import_internal_types.AST_DYNAMIC_MEMBER_ALIAS || Number.isInteger(numericMember) && numericMember >= 0) {
|
|
260
|
+
members.add(firstMember);
|
|
261
|
+
}
|
|
262
|
+
});
|
|
263
|
+
return members;
|
|
264
|
+
}
|
|
265
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
266
|
+
0 && (module.exports = {
|
|
267
|
+
collectAstForOfSourceTargetElementMembers,
|
|
268
|
+
collectAstForOfSourceTargets,
|
|
269
|
+
collectAstIdentifierWritesFromAst,
|
|
270
|
+
findAstInnermostSynchronousIifeFunctionAncestorIndex,
|
|
271
|
+
getAstLoopPatternTarget,
|
|
272
|
+
getAstWriteExecutionContext,
|
|
273
|
+
hasAstForOfSourceTargets,
|
|
274
|
+
isAstForOfLoopVariableDeclaratorWithSourceTargets
|
|
275
|
+
});
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
export declare const ACORN_WALK_BASE: any;
|
|
10
|
+
export declare function parseRunJsAuthoringAst(source: string): {
|
|
11
|
+
ast?: any;
|
|
12
|
+
error?: {
|
|
13
|
+
index: number;
|
|
14
|
+
message: string;
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
var __create = Object.create;
|
|
11
|
+
var __defProp = Object.defineProperty;
|
|
12
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
13
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
14
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
15
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
16
|
+
var __export = (target, all) => {
|
|
17
|
+
for (var name in all)
|
|
18
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
19
|
+
};
|
|
20
|
+
var __copyProps = (to, from, except, desc) => {
|
|
21
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
22
|
+
for (let key of __getOwnPropNames(from))
|
|
23
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
24
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
25
|
+
}
|
|
26
|
+
return to;
|
|
27
|
+
};
|
|
28
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
29
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
30
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
31
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
32
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
33
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
34
|
+
mod
|
|
35
|
+
));
|
|
36
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
37
|
+
var parser_exports = {};
|
|
38
|
+
__export(parser_exports, {
|
|
39
|
+
ACORN_WALK_BASE: () => ACORN_WALK_BASE,
|
|
40
|
+
parseRunJsAuthoringAst: () => parseRunJsAuthoringAst
|
|
41
|
+
});
|
|
42
|
+
module.exports = __toCommonJS(parser_exports);
|
|
43
|
+
var acorn = __toESM(require("acorn"));
|
|
44
|
+
var import_acorn_jsx = __toESM(require("acorn-jsx"));
|
|
45
|
+
var acornWalk = __toESM(require("acorn-walk"));
|
|
46
|
+
const AcornParserWithJsx = acorn.Parser.extend((0, import_acorn_jsx.default)());
|
|
47
|
+
const ACORN_WALK_BASE = {
|
|
48
|
+
...acornWalk.base,
|
|
49
|
+
JSXElement(node, state, callback) {
|
|
50
|
+
callback(node.openingElement, state);
|
|
51
|
+
for (const child of node.children || []) {
|
|
52
|
+
callback(child, state);
|
|
53
|
+
}
|
|
54
|
+
if (node.closingElement) {
|
|
55
|
+
callback(node.closingElement, state);
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
JSXFragment(node, state, callback) {
|
|
59
|
+
callback(node.openingFragment, state);
|
|
60
|
+
for (const child of node.children || []) {
|
|
61
|
+
callback(child, state);
|
|
62
|
+
}
|
|
63
|
+
callback(node.closingFragment, state);
|
|
64
|
+
},
|
|
65
|
+
JSXOpeningElement(node, state, callback) {
|
|
66
|
+
callback(node.name, state);
|
|
67
|
+
for (const attribute of node.attributes || []) {
|
|
68
|
+
callback(attribute, state);
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
JSXClosingElement(node, state, callback) {
|
|
72
|
+
callback(node.name, state);
|
|
73
|
+
},
|
|
74
|
+
JSXAttribute(node, state, callback) {
|
|
75
|
+
callback(node.name, state);
|
|
76
|
+
if (node.value) {
|
|
77
|
+
callback(node.value, state);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
JSXExpressionContainer(node, state, callback) {
|
|
81
|
+
callback(node.expression, state);
|
|
82
|
+
},
|
|
83
|
+
JSXSpreadAttribute(node, state, callback) {
|
|
84
|
+
callback(node.argument, state);
|
|
85
|
+
},
|
|
86
|
+
JSXMemberExpression(node, state, callback) {
|
|
87
|
+
callback(node.object, state);
|
|
88
|
+
callback(node.property, state);
|
|
89
|
+
},
|
|
90
|
+
JSXNamespacedName(node, state, callback) {
|
|
91
|
+
callback(node.namespace, state);
|
|
92
|
+
callback(node.name, state);
|
|
93
|
+
},
|
|
94
|
+
JSXIdentifier() {
|
|
95
|
+
},
|
|
96
|
+
JSXText() {
|
|
97
|
+
},
|
|
98
|
+
JSXEmptyExpression() {
|
|
99
|
+
},
|
|
100
|
+
JSXOpeningFragment() {
|
|
101
|
+
},
|
|
102
|
+
JSXClosingFragment() {
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
function parseRunJsAuthoringAst(source) {
|
|
106
|
+
try {
|
|
107
|
+
return {
|
|
108
|
+
ast: AcornParserWithJsx.parse(source, {
|
|
109
|
+
allowAwaitOutsideFunction: true,
|
|
110
|
+
allowReturnOutsideFunction: true,
|
|
111
|
+
ecmaVersion: "latest",
|
|
112
|
+
locations: true,
|
|
113
|
+
sourceType: "script"
|
|
114
|
+
})
|
|
115
|
+
};
|
|
116
|
+
} catch (error) {
|
|
117
|
+
const acornError = error;
|
|
118
|
+
return {
|
|
119
|
+
error: {
|
|
120
|
+
index: typeof acornError.pos === "number" ? acornError.pos : 0,
|
|
121
|
+
message: acornError.message || "Invalid JavaScript syntax"
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
127
|
+
0 && (module.exports = {
|
|
128
|
+
ACORN_WALK_BASE,
|
|
129
|
+
parseRunJsAuthoringAst
|
|
130
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This file is part of the NocoBase (R) project.
|
|
3
|
+
* Copyright (c) 2020-2024 NocoBase Co., Ltd.
|
|
4
|
+
* Authors: NocoBase Team.
|
|
5
|
+
*
|
|
6
|
+
* This project is dual-licensed under AGPL-3.0 and NocoBase Commercial License.
|
|
7
|
+
* For more information, please refer to: https://www.nocobase.com/agreement.
|
|
8
|
+
*/
|
|
9
|
+
import type { AstIdentifierBinding, CtxRootAlias, ReactDefaultAlias, ReactNamespaceAlias } from '../internal-types';
|
|
10
|
+
export declare function getReactNamespaceCapabilityFromAstPatternSource(sourceTarget: any, identifierBindings: AstIdentifierBinding[], aliases: ReactNamespaceAlias[], ctxRootAliases: CtxRootAlias[]): any;
|
|
11
|
+
export declare function getReactDefaultNamespaceCapabilityFromAstPatternSource(sourceTarget: any, identifierBindings: AstIdentifierBinding[], aliases: ReactNamespaceAlias[], ctxRootAliases?: CtxRootAlias[], defaultAliases?: ReactDefaultAlias[]): any;
|
|
12
|
+
export declare function getReactNamespaceCapabilityFromAstPatternFallbackSources(sourceTarget: any, identifierBindings: AstIdentifierBinding[], aliases: ReactNamespaceAlias[], ctxRootAliases: CtxRootAlias[]): any;
|
|
13
|
+
export declare function getReactDefaultCapabilityFromAstPatternFallbackSources(sourceTarget: any, identifierBindings: AstIdentifierBinding[], aliases: ReactNamespaceAlias[], ctxRootAliases: CtxRootAlias[], defaultAliases: ReactDefaultAlias[]): any;
|
|
14
|
+
export declare function getAstDefaultMemberAliasBase(aliasName: string): string;
|
|
15
|
+
export declare function getDirectReactNamespaceCapabilityFromAstAliasName(sourceTarget: any, identifierBindings: AstIdentifierBinding[]): "" | "React" | "ctx.React" | "ctx.libs.React";
|
|
16
|
+
export declare function getDirectReactDefaultCapabilityFromAstAliasName(sourceTarget: any, identifierBindings: AstIdentifierBinding[]): string;
|
|
17
|
+
export declare function isAstPatternDefaultValueSuppressedByReactNamespace(sourceTarget: any, identifierBindings: AstIdentifierBinding[], namespaceAliases: ReactNamespaceAlias[], ctxRootAliases: CtxRootAlias[]): boolean;
|
|
18
|
+
export declare function getReactNamespaceCapabilityFromAst(node: any, identifierBindings: AstIdentifierBinding[], aliases: ReactNamespaceAlias[], ctxRootAliases?: CtxRootAlias[]): any;
|
|
19
|
+
export declare function getReactDefaultNamespaceCapabilityFromAst(node: any, identifierBindings: AstIdentifierBinding[], aliases: ReactNamespaceAlias[], ctxRootAliases?: CtxRootAlias[], defaultAliases?: ReactDefaultAlias[]): any;
|
|
20
|
+
export declare function getDirectReactNamespaceCapabilityFromAst(node: any, identifierBindings: AstIdentifierBinding[], ctxRootAliases?: CtxRootAlias[]): "" | "React" | "ctx.React" | "ctx.libs.React";
|