@luna-park/plugin 1.3.1 → 1.4.1
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/dist-hc-SHkAg.mjs +600 -0
- package/dist/extractor.d.mts +85 -0
- package/dist/extractor.mjs +611 -0
- package/dist/index-X3hhfmWd.d.mts +368 -0
- package/dist/index.d.mts +941 -0
- package/dist/index.mjs +887 -0
- package/dist/preview.d.mts +8 -0
- package/dist/preview.mjs +47 -0
- package/dist/style.css +8 -0
- package/package.json +30 -31
- package/bin/preview.js +0 -50
- package/dist/chunk-rCEYsGS8.cjs +0 -1
- package/dist/dist-BUZt4gnZ.js +0 -421
- package/dist/dist-BkSFkjuo.cjs +0 -5
- package/dist/extractor.cjs +0 -14
- package/dist/extractor.d.ts +0 -1
- package/dist/extractor.js +0 -512
- package/dist/index.cjs +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +0 -2962
- package/dist/plugin.css +0 -2
- package/dist/preview.cjs +0 -1
- package/dist/preview.d.ts +0 -1
- package/dist/preview.js +0 -29
package/dist/preview.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { extname, join } from "path";
|
|
2
|
+
import { existsSync, readFileSync } from "fs";
|
|
3
|
+
import fastifyCors from "@fastify/cors";
|
|
4
|
+
import fastifyStatic from "@fastify/static";
|
|
5
|
+
import Fastify from "fastify";
|
|
6
|
+
//#region src/preview/transform.ts
|
|
7
|
+
function transformImports(content, externals) {
|
|
8
|
+
return content.replace(/\bimport\s+(.*?)\s+from\s+['"]([^.'/][^'"]*)['"];/g, (match, imports, pkg) => {
|
|
9
|
+
if (externals.includes(pkg)) return match;
|
|
10
|
+
return `import ${imports} from 'https://esm.sh/${pkg}';`;
|
|
11
|
+
}).replace(/\bimport\s+['"]([^.'/][^'"]*)['"];/g, (match, pkg) => {
|
|
12
|
+
if (externals.includes(pkg)) return match;
|
|
13
|
+
return `import 'https://esm.sh/${pkg}';`;
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
//#region src/preview/server.ts
|
|
18
|
+
async function startPreviewServer(config) {
|
|
19
|
+
const fastify = Fastify({ logger: false });
|
|
20
|
+
fastify.register(fastifyCors, { origin: [
|
|
21
|
+
"https://luna-park.app",
|
|
22
|
+
/localhost:[0-9]+/,
|
|
23
|
+
/127\.0\.0\.1:[0-9]+/
|
|
24
|
+
] });
|
|
25
|
+
fastify.addHook("onRequest", async (request, reply) => {
|
|
26
|
+
const targetUrl = request.url === "/" ? "/index.js" : request.url;
|
|
27
|
+
let filePath = join(config.dist, targetUrl);
|
|
28
|
+
if (!existsSync(filePath) && !extname(request.url)) filePath = join(config.dist, "index.js");
|
|
29
|
+
if (!existsSync(filePath)) return;
|
|
30
|
+
if (extname(filePath) === ".js") {
|
|
31
|
+
const transformed = transformImports(readFileSync(filePath, "utf-8"), config.externals).replaceAll("process.env.NODE_ENV", JSON.stringify("development"));
|
|
32
|
+
reply.type("application/javascript").send(transformed);
|
|
33
|
+
return reply;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
fastify.register(fastifyStatic, {
|
|
37
|
+
prefix: "/",
|
|
38
|
+
root: config.dist
|
|
39
|
+
});
|
|
40
|
+
await fastify.listen({
|
|
41
|
+
host: "127.0.0.1",
|
|
42
|
+
port: config.port
|
|
43
|
+
});
|
|
44
|
+
console.log(`Preview server started at http://127.0.0.1:${config.port}`);
|
|
45
|
+
}
|
|
46
|
+
//#endregion
|
|
47
|
+
export { startPreviewServer };
|
package/dist/style.css
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@luna-park/plugin",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Plugin helper for Luna Park.",
|
|
6
6
|
"homepage": "https://luna-park.app",
|
|
@@ -15,59 +15,58 @@
|
|
|
15
15
|
"type": "module",
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
|
-
"types": "./dist/index.d.
|
|
19
|
-
"
|
|
20
|
-
"import": "./dist/index.js"
|
|
18
|
+
"types": "./dist/index.d.mts",
|
|
19
|
+
"import": "./dist/index.mjs"
|
|
21
20
|
},
|
|
22
21
|
"./extractor": {
|
|
23
|
-
"types": "./dist/extractor.d.
|
|
24
|
-
"
|
|
25
|
-
"import": "./dist/extractor.js"
|
|
22
|
+
"types": "./dist/extractor.d.mts",
|
|
23
|
+
"import": "./dist/extractor.mjs"
|
|
26
24
|
},
|
|
27
|
-
"./index.css": "./dist/
|
|
25
|
+
"./index.css": "./dist/style.css"
|
|
28
26
|
},
|
|
29
|
-
"
|
|
30
|
-
"
|
|
31
|
-
"types": "./dist/index.d.ts",
|
|
27
|
+
"module": "./dist/index.mjs",
|
|
28
|
+
"types": "./dist/index.d.mts",
|
|
32
29
|
"bin": {
|
|
33
|
-
"luna-preview": "./bin/preview.
|
|
30
|
+
"luna-preview": "./bin/preview.mjs"
|
|
34
31
|
},
|
|
35
32
|
"files": [
|
|
36
33
|
"dist/**"
|
|
37
34
|
],
|
|
38
|
-
"
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"@electric-sql/pglite": "^0.4.3",
|
|
39
37
|
"@fastify/cors": "^11.2.0",
|
|
40
38
|
"@fastify/static": "^9.0.0",
|
|
41
39
|
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
40
|
+
"@sinclair/typebox": "^0.34.49",
|
|
41
|
+
"fastify": "^5.8.4",
|
|
42
|
+
"jsep": "^1.4.0",
|
|
43
|
+
"lite-cron": "^1.1.0",
|
|
44
|
+
"typescript": "^6.0.2",
|
|
45
|
+
"vue": "^3.5.32"
|
|
46
|
+
},
|
|
47
|
+
"devDependencies": {
|
|
42
48
|
"@luna-park/eslint-config": "^1.2.4",
|
|
43
|
-
"@
|
|
49
|
+
"@tsdown/css": "^0.21.7",
|
|
44
50
|
"@vitejs/plugin-vue": "^6.0.5",
|
|
45
51
|
"@vitest/ui": "^4.1.2",
|
|
46
|
-
"
|
|
47
|
-
"
|
|
52
|
+
"@vue/language-core": "^3.2.6",
|
|
53
|
+
"eslint": "^10.2.0",
|
|
48
54
|
"rimraf": "^6.1.3",
|
|
55
|
+
"rolldown-plugin-dts": "^0.23.2",
|
|
56
|
+
"tsdown": "^0.21.7",
|
|
49
57
|
"typescript": "^6.0.2",
|
|
50
58
|
"typescript-eslint": "^8.58.0",
|
|
51
|
-
"unplugin-
|
|
52
|
-
"vite": "
|
|
59
|
+
"unplugin-vue": "^7.1.1",
|
|
60
|
+
"vite": "^8.0.3",
|
|
53
61
|
"vitest": "^4.1.2",
|
|
54
|
-
"vue": "^3.5.
|
|
55
|
-
"@luna-park/shared": "^1.0.0",
|
|
62
|
+
"vue": "^3.5.32",
|
|
56
63
|
"@luna-park/logicnodes": "^2.0.0",
|
|
64
|
+
"@luna-park/shared": "^1.0.0",
|
|
57
65
|
"@luna-park/utils": "^2.0.0"
|
|
58
66
|
},
|
|
59
|
-
"peerDependencies": {
|
|
60
|
-
"@fastify/cors": "^11.2.0",
|
|
61
|
-
"@fastify/static": "^9.0.0",
|
|
62
|
-
"@fortawesome/fontawesome-svg-core": "^7.2.0",
|
|
63
|
-
"fastify": "^5.7.4",
|
|
64
|
-
"typescript": "^5.9.3",
|
|
65
|
-
"vite": "^7.3.1",
|
|
66
|
-
"vue": "^3.5.28"
|
|
67
|
-
},
|
|
68
67
|
"scripts": {
|
|
69
|
-
"build": "rimraf dist &&
|
|
70
|
-
"dev": "
|
|
68
|
+
"build": "rimraf dist && tsdown",
|
|
69
|
+
"dev": "tsdown --watch",
|
|
71
70
|
"dev:test": "vitest --ui",
|
|
72
71
|
"test": "vitest",
|
|
73
72
|
"test:preview": "node bin/preview.js"
|
package/bin/preview.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { parseArgs } from "node:util";
|
|
3
|
-
|
|
4
|
-
import { resolve } from "path";
|
|
5
|
-
|
|
6
|
-
import { startPreviewServer } from "../dist/preview.js";
|
|
7
|
-
|
|
8
|
-
const cwd = process.cwd();
|
|
9
|
-
|
|
10
|
-
// Parse CLI arguments
|
|
11
|
-
const { values } = parseArgs({
|
|
12
|
-
options: {
|
|
13
|
-
dist: {
|
|
14
|
-
default: "dist",
|
|
15
|
-
short: "d",
|
|
16
|
-
type: "string"
|
|
17
|
-
},
|
|
18
|
-
help: {
|
|
19
|
-
default: false,
|
|
20
|
-
short: "h",
|
|
21
|
-
type: "boolean"
|
|
22
|
-
},
|
|
23
|
-
port: {
|
|
24
|
-
default: "2084",
|
|
25
|
-
short: "p",
|
|
26
|
-
type: "string"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
if (values.help) {
|
|
32
|
-
console.log(`
|
|
33
|
-
Usage: luna-preview [options]
|
|
34
|
-
|
|
35
|
-
Options:
|
|
36
|
-
-p, --port <port> Port to run the server on (default: 2084)
|
|
37
|
-
-d, --dist <dir> Distribution directory to serve (default: dist)
|
|
38
|
-
-h, --help Show this help message
|
|
39
|
-
`);
|
|
40
|
-
process.exit(0);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const dist = resolve(cwd, values.dist);
|
|
44
|
-
const port = parseInt(values.port);
|
|
45
|
-
|
|
46
|
-
startPreviewServer({
|
|
47
|
-
dist,
|
|
48
|
-
externals: ["vue", "vue-router", "@luna-park/design"],
|
|
49
|
-
port
|
|
50
|
-
});
|
package/dist/chunk-rCEYsGS8.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,n)=>{let r={};for(var i in e)t(r,i,{get:e[i],enumerable:!0});return n&&t(r,Symbol.toStringTag,{value:`Module`}),r},s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return o}});
|
package/dist/dist-BUZt4gnZ.js
DELETED
|
@@ -1,421 +0,0 @@
|
|
|
1
|
-
function cloneDeep(e) {
|
|
2
|
-
if (typeof e != "object") return e;
|
|
3
|
-
let S = [
|
|
4
|
-
() => JSON.parse(JSON.stringify(e)),
|
|
5
|
-
() => structuredClone(e),
|
|
6
|
-
() => safeClone(e)
|
|
7
|
-
], C;
|
|
8
|
-
for (let e of S) try {
|
|
9
|
-
return e();
|
|
10
|
-
} catch (e) {
|
|
11
|
-
C = e;
|
|
12
|
-
continue;
|
|
13
|
-
}
|
|
14
|
-
throw console.error("Failed to deep clone object:", e), Error(C);
|
|
15
|
-
}
|
|
16
|
-
function safeClone(e) {
|
|
17
|
-
let x = /* @__PURE__ */ new WeakSet();
|
|
18
|
-
return S(e);
|
|
19
|
-
function S(e) {
|
|
20
|
-
if (typeof e != "object") return e;
|
|
21
|
-
if (x.has(e)) return { recursive: !0 };
|
|
22
|
-
if (x.add(e), Array.isArray(e)) return e.map((e) => S(e));
|
|
23
|
-
let C = Object.getOwnPropertyDescriptors(e), w = {};
|
|
24
|
-
for (let [e, x] of Object.entries(C)) w[e] = S(x.value);
|
|
25
|
-
return w;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
function cloneWithFunctions(e) {
|
|
29
|
-
if (Array.isArray(e)) return e.map(cloneWithFunctions);
|
|
30
|
-
if (typeof e != "object") return e;
|
|
31
|
-
let x = {};
|
|
32
|
-
for (let [C, w] of Object.entries(e)) {
|
|
33
|
-
if (typeof w == "function") {
|
|
34
|
-
x[C] = w;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
x[C] = cloneWithFunctions(w);
|
|
38
|
-
}
|
|
39
|
-
return x;
|
|
40
|
-
}
|
|
41
|
-
function objectMap(e, x) {
|
|
42
|
-
return e ? Object.fromEntries(Object.entries(e).map(([e, S]) => [e, x({
|
|
43
|
-
key: e,
|
|
44
|
-
value: S
|
|
45
|
-
})])) : {};
|
|
46
|
-
}
|
|
47
|
-
function objectFilter(e, x) {
|
|
48
|
-
return e ? Object.fromEntries(Object.entries(e).filter(([e, S]) => x({
|
|
49
|
-
key: e,
|
|
50
|
-
value: S
|
|
51
|
-
}))) : {};
|
|
52
|
-
}
|
|
53
|
-
function cleanObject(x) {
|
|
54
|
-
for (let C in x = cloneDeep(x), x) S(x, C);
|
|
55
|
-
function S(e, x) {
|
|
56
|
-
if (typeof e[x] == "object") {
|
|
57
|
-
for (let C in e[x]) S(e[x], C);
|
|
58
|
-
Object.keys(e[x]).length === 0 && delete e[x];
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
return x;
|
|
62
|
-
}
|
|
63
|
-
var EVarType = /* @__PURE__ */ function(e) {
|
|
64
|
-
return e.exec = "exec", e.number = "number", e.string = "string", e.boolean = "boolean", e.object = "object", e.record = "record", e.array = "array", e.interface = "interface", e.type = "type", e.function = "function", e.union = "union", e.unknown = "unknown", e.undefined = "undefined", e.void = "void", e;
|
|
65
|
-
}({}), LogicType = {
|
|
66
|
-
array: (e, x = {}) => ({
|
|
67
|
-
...x,
|
|
68
|
-
items: e,
|
|
69
|
-
type: EVarType.array
|
|
70
|
-
}),
|
|
71
|
-
boolean: (e = {}) => ({
|
|
72
|
-
...e,
|
|
73
|
-
type: EVarType.boolean
|
|
74
|
-
}),
|
|
75
|
-
exec: (e = {}) => ({
|
|
76
|
-
...e,
|
|
77
|
-
type: EVarType.exec
|
|
78
|
-
}),
|
|
79
|
-
function: (e = {
|
|
80
|
-
properties: {},
|
|
81
|
-
type: EVarType.object
|
|
82
|
-
}, x = { type: EVarType.void }, S = {}) => ({
|
|
83
|
-
...S,
|
|
84
|
-
inputs: e,
|
|
85
|
-
output: x,
|
|
86
|
-
type: EVarType.function
|
|
87
|
-
}),
|
|
88
|
-
interface: (e, x = {}) => ({
|
|
89
|
-
...x,
|
|
90
|
-
className: typeof e == "string" ? e : e.name,
|
|
91
|
-
type: EVarType.interface
|
|
92
|
-
}),
|
|
93
|
-
number: (e = {}) => ({
|
|
94
|
-
...e,
|
|
95
|
-
type: EVarType.number
|
|
96
|
-
}),
|
|
97
|
-
object: (e = {}, x = {}) => ({
|
|
98
|
-
...x,
|
|
99
|
-
properties: e,
|
|
100
|
-
type: EVarType.object
|
|
101
|
-
}),
|
|
102
|
-
record: (e, x, S = {}) => ({
|
|
103
|
-
...S,
|
|
104
|
-
key: e,
|
|
105
|
-
type: EVarType.record,
|
|
106
|
-
value: x
|
|
107
|
-
}),
|
|
108
|
-
string: (e = {}) => ({
|
|
109
|
-
...e,
|
|
110
|
-
type: EVarType.string
|
|
111
|
-
}),
|
|
112
|
-
type: (e, x = {}) => ({
|
|
113
|
-
...x,
|
|
114
|
-
target: e,
|
|
115
|
-
type: EVarType.type
|
|
116
|
-
}),
|
|
117
|
-
undefined: (e = {}) => ({
|
|
118
|
-
...e,
|
|
119
|
-
type: EVarType.undefined
|
|
120
|
-
}),
|
|
121
|
-
union: (e, x = {}) => ({
|
|
122
|
-
...x,
|
|
123
|
-
elements: e,
|
|
124
|
-
type: EVarType.union
|
|
125
|
-
}),
|
|
126
|
-
unknown: (e = {}) => ({
|
|
127
|
-
...e,
|
|
128
|
-
type: EVarType.unknown
|
|
129
|
-
}),
|
|
130
|
-
void: (e = {}) => ({
|
|
131
|
-
...e,
|
|
132
|
-
type: EVarType.void
|
|
133
|
-
})
|
|
134
|
-
}, LogicUtil = {
|
|
135
|
-
omit(e, x) {
|
|
136
|
-
return {
|
|
137
|
-
...e,
|
|
138
|
-
properties: objectFilter(e.properties, ({ key: e }) => !x.includes(e))
|
|
139
|
-
};
|
|
140
|
-
},
|
|
141
|
-
partial(e, x = !1) {
|
|
142
|
-
return {
|
|
143
|
-
...e,
|
|
144
|
-
properties: objectMap(e.properties, ({ value: e }) => ({
|
|
145
|
-
...e,
|
|
146
|
-
optional: !x || !e.required
|
|
147
|
-
}))
|
|
148
|
-
};
|
|
149
|
-
},
|
|
150
|
-
pick(e, x) {
|
|
151
|
-
return {
|
|
152
|
-
...e,
|
|
153
|
-
properties: objectFilter(e.properties, ({ key: e }) => x.includes(e))
|
|
154
|
-
};
|
|
155
|
-
},
|
|
156
|
-
promise(e) {
|
|
157
|
-
return {
|
|
158
|
-
...e,
|
|
159
|
-
promise: !0
|
|
160
|
-
};
|
|
161
|
-
},
|
|
162
|
-
required(e) {
|
|
163
|
-
return {
|
|
164
|
-
...e,
|
|
165
|
-
properties: objectMap(e.properties, ({ value: e }) => ({
|
|
166
|
-
...e,
|
|
167
|
-
optional: !1
|
|
168
|
-
}))
|
|
169
|
-
};
|
|
170
|
-
}
|
|
171
|
-
}, ELogicType = /* @__PURE__ */ function(e) {
|
|
172
|
-
return e.function = "function", e.macro = "macro", e.operation = "operation", e;
|
|
173
|
-
}({}), ELogicScope = /* @__PURE__ */ function(e) {
|
|
174
|
-
return e.Frontend = "frontend", e.Backend = "backend", e.Desktop = "desktop", e.Shared = "shared", e;
|
|
175
|
-
}({});
|
|
176
|
-
function makeLogicNode(e) {
|
|
177
|
-
return e;
|
|
178
|
-
}
|
|
179
|
-
function scanner(e) {
|
|
180
|
-
let x = [];
|
|
181
|
-
for (e = e.replaceAll(/ +/g, " "), e = e.replaceAll(/\s*\n\s*/g, "\n"); e.length;) {
|
|
182
|
-
if ([" ", "\n"].includes(e[0])) {
|
|
183
|
-
e = e.slice(1);
|
|
184
|
-
continue;
|
|
185
|
-
}
|
|
186
|
-
if (e.startsWith("/*")) {
|
|
187
|
-
let S = e.indexOf("*/");
|
|
188
|
-
x.push(e.slice(0, S + 2)), e = e.slice(S + 2);
|
|
189
|
-
continue;
|
|
190
|
-
}
|
|
191
|
-
let S = e.match(/^([a-zA-Z_][a-zA-Z0-9_.]*)/)?.[0];
|
|
192
|
-
if (S) {
|
|
193
|
-
e = e.slice(S.length), x.push(S);
|
|
194
|
-
continue;
|
|
195
|
-
}
|
|
196
|
-
let C = e.match(/^([0-9]+)/)?.[0];
|
|
197
|
-
if (C) {
|
|
198
|
-
e = e.slice(C.length), x.push(C);
|
|
199
|
-
continue;
|
|
200
|
-
}
|
|
201
|
-
if (e[0] === ">" && x.at(-1) === "=") {
|
|
202
|
-
x.pop(), x.push("=>"), e = e.slice(1);
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
x.push(e[0]), e = e.slice(1);
|
|
206
|
-
}
|
|
207
|
-
return x;
|
|
208
|
-
}
|
|
209
|
-
var wrappers = [
|
|
210
|
-
["(", ")"],
|
|
211
|
-
["[", "]"],
|
|
212
|
-
["{", "}"],
|
|
213
|
-
["<", ">"],
|
|
214
|
-
["'", "'"],
|
|
215
|
-
["\"", "\""]
|
|
216
|
-
];
|
|
217
|
-
function lexer(e) {
|
|
218
|
-
return cleanArray(splitUntil(e, ";"));
|
|
219
|
-
}
|
|
220
|
-
function getUntil(e, x, S = 1) {
|
|
221
|
-
let C = [];
|
|
222
|
-
for (wrappers.find((e) => e[1] === x)?.[0]; e.length && (e[0], !(e[0] === x && (S--, S <= 0)));) {
|
|
223
|
-
let w = getFirstElement(e);
|
|
224
|
-
if (C.push(w), S === 0 && typeof w == "object" && w.type === "wrap" && w.style.endsWith(x)) break;
|
|
225
|
-
}
|
|
226
|
-
return e.shift(), C;
|
|
227
|
-
}
|
|
228
|
-
function eraseUntil(e, x) {
|
|
229
|
-
for (; e.length;) {
|
|
230
|
-
if (e[0] === x) {
|
|
231
|
-
e.shift();
|
|
232
|
-
break;
|
|
233
|
-
}
|
|
234
|
-
e.shift();
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
function splitUntil(e, x) {
|
|
238
|
-
let S = [[]];
|
|
239
|
-
for (; e.length;) {
|
|
240
|
-
if (e[0] === x) {
|
|
241
|
-
S.push([]), e.shift();
|
|
242
|
-
continue;
|
|
243
|
-
}
|
|
244
|
-
S.at(-1).push(getFirstElement(e));
|
|
245
|
-
}
|
|
246
|
-
return S.filter((e) => e.length);
|
|
247
|
-
}
|
|
248
|
-
function getFirstElement(e) {
|
|
249
|
-
let x = e.shift(), S = !1;
|
|
250
|
-
if (x === "export") {
|
|
251
|
-
if (S = !0, x = e.shift(), x === "=") return {
|
|
252
|
-
type: "export",
|
|
253
|
-
content: e.shift()
|
|
254
|
-
};
|
|
255
|
-
if (x === "as") return eraseUntil(e, ";"), getFirstElement(e);
|
|
256
|
-
}
|
|
257
|
-
if (x === "declare" && (x = e.shift()), x === "namespace") {
|
|
258
|
-
let C = e.shift();
|
|
259
|
-
e.shift();
|
|
260
|
-
let w = splitUntil(getUntil(e, "}", 0), ";");
|
|
261
|
-
return e.unshift(";"), {
|
|
262
|
-
name: C,
|
|
263
|
-
type: x,
|
|
264
|
-
content: w,
|
|
265
|
-
export: S
|
|
266
|
-
};
|
|
267
|
-
}
|
|
268
|
-
if (x === "function") {
|
|
269
|
-
let C = e.shift(), w = e.shift(), T = {
|
|
270
|
-
name: C,
|
|
271
|
-
type: x
|
|
272
|
-
};
|
|
273
|
-
w === "<" && (T.template = getUntil(e, ">"), e.shift());
|
|
274
|
-
let E = splitUntil(getUntil(e, ")", 0), ",");
|
|
275
|
-
return T.export = S, T.params = E, e[0] === ":" && (e.shift(), T.returns = getUntil(e, ";")), e.unshift(";"), T;
|
|
276
|
-
}
|
|
277
|
-
if (x === "interface") {
|
|
278
|
-
let x = e.shift();
|
|
279
|
-
e.shift();
|
|
280
|
-
let S = splitUntil(getUntil(e, "}", 0), ";");
|
|
281
|
-
return e.unshift(";"), {
|
|
282
|
-
name: x,
|
|
283
|
-
type: "interface",
|
|
284
|
-
content: S
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
if (x === "type" && /^[A-Za-z0-9]*$/.test(e[0])) {
|
|
288
|
-
let S = e.shift(), C = e.shift(), w = {
|
|
289
|
-
name: S,
|
|
290
|
-
type: x
|
|
291
|
-
};
|
|
292
|
-
return C === "<" && (w.template = getUntil(e, ">"), e.shift()), w.content = getUntil(e, ";"), e.unshift(";"), w;
|
|
293
|
-
}
|
|
294
|
-
if (x === "enum") {
|
|
295
|
-
let x = e.shift();
|
|
296
|
-
e.shift();
|
|
297
|
-
let S = getUntil(e, "}");
|
|
298
|
-
return e.unshift(";"), {
|
|
299
|
-
name: x,
|
|
300
|
-
type: "enum",
|
|
301
|
-
options: Object.fromEntries(S.join("").split(",").filter((e) => e.trim()).map((e) => {
|
|
302
|
-
if (e.includes("=")) {
|
|
303
|
-
let [x, S] = e.split("=");
|
|
304
|
-
return [JSON.parse(S), x];
|
|
305
|
-
}
|
|
306
|
-
return [x, x];
|
|
307
|
-
}))
|
|
308
|
-
};
|
|
309
|
-
}
|
|
310
|
-
if (typeof x == "string" && x.startsWith("/*")) return {
|
|
311
|
-
type: "comment",
|
|
312
|
-
content: cleanComment(x)
|
|
313
|
-
};
|
|
314
|
-
for (let S of wrappers) if (x === S[0]) return {
|
|
315
|
-
type: "wrap",
|
|
316
|
-
content: splitUntil(getUntil(e, S[1]), ";").map((e) => splitUntil(e, ",")).map((e) => splitUntil(e, "|")),
|
|
317
|
-
style: S.join("")
|
|
318
|
-
};
|
|
319
|
-
return x;
|
|
320
|
-
}
|
|
321
|
-
function cleanArray(e) {
|
|
322
|
-
return Array.isArray(e) ? e.length === 1 ? cleanArray(e[0]) : e.map((e) => cleanArray(e)) : typeof e == "object" && e ? objectMap(e, ({ value: e }) => cleanArray(e)) : e;
|
|
323
|
-
}
|
|
324
|
-
function cleanComment(e) {
|
|
325
|
-
return e = e.trim(), e.startsWith("/**") && e.endsWith("*/") ? (e = e.slice(3, -2).split("\n").map((e) => {
|
|
326
|
-
let x = e.trim();
|
|
327
|
-
return x.startsWith("* ") ? x.slice(2) : x;
|
|
328
|
-
}).join("\n").trim(), e.trim()) : e;
|
|
329
|
-
}
|
|
330
|
-
function cleanUnion(e) {
|
|
331
|
-
e.elements.find((e) => [EVarType.undefined, EVarType.void].includes(e.type)) && (e.optional = !0, e.elements = e.elements.filter((e) => ![EVarType.undefined, EVarType.void].includes(e.type)));
|
|
332
|
-
let x = e.elements.filter((e) => e.type === EVarType.union);
|
|
333
|
-
if (x.length > 0) {
|
|
334
|
-
e.elements = e.elements.filter((e) => e.type !== EVarType.union);
|
|
335
|
-
for (let S of x) e.elements.push(...S.elements);
|
|
336
|
-
}
|
|
337
|
-
let S = e.elements.filter((e) => e.type === EVarType.string);
|
|
338
|
-
if (S.length > 1) {
|
|
339
|
-
let x = [], C = !1;
|
|
340
|
-
for (let e of S) e.enum ? x.push(...e.enum) : C = !0;
|
|
341
|
-
e.elements = e.elements.filter((e) => e.type !== EVarType.string), C ? e.elements.push(LogicType.string()) : e.elements.push(LogicType.string({ enum: x }));
|
|
342
|
-
}
|
|
343
|
-
let C = e.elements.filter((e) => e.type === EVarType.number);
|
|
344
|
-
if (C.length > 1) {
|
|
345
|
-
let x = [], S = !1;
|
|
346
|
-
for (let e of C) e.enum ? x.push(...e.enum) : S = !0;
|
|
347
|
-
e.elements = e.elements.filter((e) => e.type !== EVarType.number), S ? e.elements.push(LogicType.number()) : e.elements.push(LogicType.number({ enum: x }));
|
|
348
|
-
}
|
|
349
|
-
if (e.elements.length === 1) {
|
|
350
|
-
let x = e.elements[0];
|
|
351
|
-
return x.optional = e.optional, x;
|
|
352
|
-
}
|
|
353
|
-
return e.elements.length === 0 ? LogicType.void() : e;
|
|
354
|
-
}
|
|
355
|
-
function cleanInterface(e) {
|
|
356
|
-
return e.className === "Array" ? LogicType.array(e.options.template[0]) : e.className === "keyof" ? LogicType.string() : e.className === "Record" ? LogicType.object({}) : e.className === "PropertyKey" ? LogicType.union([LogicType.string(), LogicType.number()]) : [
|
|
357
|
-
"Promise",
|
|
358
|
-
"Partial",
|
|
359
|
-
"Required"
|
|
360
|
-
].includes(e.className) ? LogicUtil[e.className.toLocaleLowerCase()](e.options.template[0]) : ["Omit", "Pick"].includes(e.className) ? LogicUtil[e.className.toLocaleLowerCase()](e.options.template[0], e.options.template[1]?.enum) : e;
|
|
361
|
-
}
|
|
362
|
-
function parser(e, x = {}) {
|
|
363
|
-
if (typeof e == "string") return e === "string" ? LogicType.string(x) : e === "number" ? LogicType.number(x) : e === "boolean" ? LogicType.boolean(x) : e === "undefined" ? LogicType.void(x) : ["unknown", "any"].includes(e) ? LogicType.unknown(x) : ["undefined", "null"].includes(e) ? LogicType.undefined(x) : cleanInterface(LogicType.interface(e, x));
|
|
364
|
-
if (Array.isArray(e)) {
|
|
365
|
-
if (e[0] === "readonly" && e.shift(), e.length === 1) return parser(e[0], x);
|
|
366
|
-
if (e.includes("|")) return cleanUnion(LogicType.union(separate(e, (e) => e === "|").map((e) => parser(e)), x));
|
|
367
|
-
if (e.includes("&")) return cleanUnion(LogicType.union(separate(e, (e) => e === "&").map((e) => parser(e)), x));
|
|
368
|
-
if (e.at(-1)?.type === "wrap" && e.at(-1).style === "[]") return LogicType.array(parser(e.slice(0, -1)), x);
|
|
369
|
-
if (e[0] === "import" && e[2] === ".") return parser(e.slice(3), x);
|
|
370
|
-
if (e.length === 2 && e[1].type === "wrap" && e[1].style === "<>") {
|
|
371
|
-
let S = e[1].content;
|
|
372
|
-
return Array.isArray(S) || (S = [S]), Array.isArray(S[0]) || (S = S.some((e) => e.type === "wrap" && e.style === "[]") || S.some((e) => e.type === "wrap" && e.style === "<>") || S.includes("&") || S.includes("|") ? [S] : S.map((e) => [e])), S = S.map((e) => parser(e)), cleanInterface(LogicType.interface(e[0], {
|
|
373
|
-
...x,
|
|
374
|
-
options: { template: S }
|
|
375
|
-
}));
|
|
376
|
-
}
|
|
377
|
-
if (e.length === 3 && e[1] === "=>") {
|
|
378
|
-
let x = !e[0].content.length || Array.isArray(e[0].content[0]) ? e[0].content : [e[0].content];
|
|
379
|
-
return LogicType.function(LogicType.object(Object.fromEntries(x.map((e) => [e[0], parser(e.slice(2))]))), parser(e[2]));
|
|
380
|
-
}
|
|
381
|
-
return parser(e[0], x);
|
|
382
|
-
}
|
|
383
|
-
if (typeof e == "object" && e && e.type === "wrap") {
|
|
384
|
-
if (["''", "\"\""].includes(e.style)) return LogicType.string({
|
|
385
|
-
...x,
|
|
386
|
-
enum: [e.content]
|
|
387
|
-
});
|
|
388
|
-
if (e.style === "{}") {
|
|
389
|
-
let S = !e.content.length || Array.isArray(e.content[0]) ? e.content : [e.content];
|
|
390
|
-
return LogicType.object(Object.fromEntries(S.filter((e) => typeof e[0] == "string").map((e) => [e[0], e[1] === "?" ? parser(e.slice(3), { optional: !0 }) : parser(e.slice(2))])), x);
|
|
391
|
-
}
|
|
392
|
-
if (e.style === "[]") return e.content[1] === ":" ? LogicType.array(parser(e.content.slice(2)), x) : LogicType.array(parser(e.content), x);
|
|
393
|
-
if (e.style === "()") return parser(e.content, x);
|
|
394
|
-
}
|
|
395
|
-
return console.log("Unknown element"), console.log(e), LogicType.unknown();
|
|
396
|
-
}
|
|
397
|
-
function separate(e, x) {
|
|
398
|
-
let S = [[]];
|
|
399
|
-
for (let C of e) x(C) ? S.push([]) : S[S.length - 1].push(C);
|
|
400
|
-
return S;
|
|
401
|
-
}
|
|
402
|
-
function typeToSchema(e) {
|
|
403
|
-
try {
|
|
404
|
-
if (/^[A-Za-z]+\??:/.test(e)) {
|
|
405
|
-
let [, x, S, C] = e.match(/([A-Za-z]+)(\??):(.*)/), w = parser(lexer(scanner(C)));
|
|
406
|
-
return w.name = x, S === "?" && (w.optional = !0), w;
|
|
407
|
-
}
|
|
408
|
-
return parser(lexer(scanner(e)));
|
|
409
|
-
} catch (x) {
|
|
410
|
-
return console.error("Failed to parse type", e), console.error(x), LogicType.unknown();
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
function schemaLoop(e, x, S) {
|
|
414
|
-
if (e = x({
|
|
415
|
-
key: S,
|
|
416
|
-
schema: e
|
|
417
|
-
}) || e, e.type === EVarType.object) for (let S in e.properties) e.properties[S] = schemaLoop(e.properties[S], x, S);
|
|
418
|
-
if (e.type === EVarType.array && (e.items = schemaLoop(e.items, x)), e.type === EVarType.function && (e.inputs = schemaLoop(e.inputs, x), e.output = schemaLoop(e.output, x)), e.type === EVarType.union) for (let S in e.elements) e.elements[S] = schemaLoop(e.elements[S], x);
|
|
419
|
-
return e;
|
|
420
|
-
}
|
|
421
|
-
export { LogicUtil as a, typeToSchema as c, objectMap as d, LogicType as i, cleanObject as l, ELogicType as n, makeLogicNode as o, EVarType as r, schemaLoop as s, ELogicScope as t, cloneWithFunctions as u };
|
package/dist/dist-BkSFkjuo.cjs
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
function e(e){if(typeof e!=`object`)return e;let n=[()=>JSON.parse(JSON.stringify(e)),()=>structuredClone(e),()=>t(e)],r;for(let e of n)try{return e()}catch(e){r=e;continue}throw console.error(`Failed to deep clone object:`,e),Error(r)}function t(e){let t=new WeakSet;return n(e);function n(e){if(typeof e!=`object`)return e;if(t.has(e))return{recursive:!0};if(t.add(e),Array.isArray(e))return e.map(e=>n(e));let r=Object.getOwnPropertyDescriptors(e),i={};for(let[e,t]of Object.entries(r))i[e]=n(t.value);return i}}function n(e){if(Array.isArray(e))return e.map(n);if(typeof e!=`object`)return e;let t={};for(let[r,i]of Object.entries(e)){if(typeof i==`function`){t[r]=i;continue}t[r]=n(i)}return t}function r(e,t){return e?Object.fromEntries(Object.entries(e).map(([e,n])=>[e,t({key:e,value:n})])):{}}function i(e,t){return e?Object.fromEntries(Object.entries(e).filter(([e,n])=>t({key:e,value:n}))):{}}function a(t){for(let r in t=e(t),t)n(t,r);function n(e,t){if(typeof e[t]==`object`){for(let r in e[t])n(e[t],r);Object.keys(e[t]).length===0&&delete e[t]}}return t}var o=function(e){return e.exec=`exec`,e.number=`number`,e.string=`string`,e.boolean=`boolean`,e.object=`object`,e.record=`record`,e.array=`array`,e.interface=`interface`,e.type=`type`,e.function=`function`,e.union=`union`,e.unknown=`unknown`,e.undefined=`undefined`,e.void=`void`,e}({}),s={array:(e,t={})=>({...t,items:e,type:o.array}),boolean:(e={})=>({...e,type:o.boolean}),exec:(e={})=>({...e,type:o.exec}),function:(e={properties:{},type:o.object},t={type:o.void},n={})=>({...n,inputs:e,output:t,type:o.function}),interface:(e,t={})=>({...t,className:typeof e==`string`?e:e.name,type:o.interface}),number:(e={})=>({...e,type:o.number}),object:(e={},t={})=>({...t,properties:e,type:o.object}),record:(e,t,n={})=>({...n,key:e,type:o.record,value:t}),string:(e={})=>({...e,type:o.string}),type:(e,t={})=>({...t,target:e,type:o.type}),undefined:(e={})=>({...e,type:o.undefined}),union:(e,t={})=>({...t,elements:e,type:o.union}),unknown:(e={})=>({...e,type:o.unknown}),void:(e={})=>({...e,type:o.void})},c={omit(e,t){return{...e,properties:i(e.properties,({key:e})=>!t.includes(e))}},partial(e,t=!1){return{...e,properties:r(e.properties,({value:e})=>({...e,optional:!t||!e.required}))}},pick(e,t){return{...e,properties:i(e.properties,({key:e})=>t.includes(e))}},promise(e){return{...e,promise:!0}},required(e){return{...e,properties:r(e.properties,({value:e})=>({...e,optional:!1}))}}},l=function(e){return e.function=`function`,e.macro=`macro`,e.operation=`operation`,e}({}),u=function(e){return e.Frontend=`frontend`,e.Backend=`backend`,e.Desktop=`desktop`,e.Shared=`shared`,e}({});function d(e){return e}function f(e){let t=[];for(e=e.replaceAll(/ +/g,` `),e=e.replaceAll(/\s*\n\s*/g,`
|
|
2
|
-
`);e.length;){if([` `,`
|
|
3
|
-
`].includes(e[0])){e=e.slice(1);continue}if(e.startsWith(`/*`)){let n=e.indexOf(`*/`);t.push(e.slice(0,n+2)),e=e.slice(n+2);continue}let n=e.match(/^([a-zA-Z_][a-zA-Z0-9_.]*)/)?.[0];if(n){e=e.slice(n.length),t.push(n);continue}let r=e.match(/^([0-9]+)/)?.[0];if(r){e=e.slice(r.length),t.push(r);continue}if(e[0]===`>`&&t.at(-1)===`=`){t.pop(),t.push(`=>`),e=e.slice(1);continue}t.push(e[0]),e=e.slice(1)}return t}var p=[[`(`,`)`],[`[`,`]`],[`{`,`}`],[`<`,`>`],[`'`,`'`],[`"`,`"`]];function m(e){return y(_(e,`;`))}function h(e,t,n=1){let r=[];for(p.find(e=>e[1]===t)?.[0];e.length&&(e[0],!(e[0]===t&&(n--,n<=0)));){let i=v(e);if(r.push(i),n===0&&typeof i==`object`&&i.type===`wrap`&&i.style.endsWith(t))break}return e.shift(),r}function g(e,t){for(;e.length;){if(e[0]===t){e.shift();break}e.shift()}}function _(e,t){let n=[[]];for(;e.length;){if(e[0]===t){n.push([]),e.shift();continue}n.at(-1).push(v(e))}return n.filter(e=>e.length)}function v(e){let t=e.shift(),n=!1;if(t===`export`){if(n=!0,t=e.shift(),t===`=`)return{type:`export`,content:e.shift()};if(t===`as`)return g(e,`;`),v(e)}if(t===`declare`&&(t=e.shift()),t===`namespace`){let r=e.shift();e.shift();let i=_(h(e,`}`,0),`;`);return e.unshift(`;`),{name:r,type:t,content:i,export:n}}if(t===`function`){let r=e.shift(),i=e.shift(),a={name:r,type:t};i===`<`&&(a.template=h(e,`>`),e.shift());let o=_(h(e,`)`,0),`,`);return a.export=n,a.params=o,e[0]===`:`&&(e.shift(),a.returns=h(e,`;`)),e.unshift(`;`),a}if(t===`interface`){let t=e.shift();e.shift();let n=_(h(e,`}`,0),`;`);return e.unshift(`;`),{name:t,type:`interface`,content:n}}if(t===`type`&&/^[A-Za-z0-9]*$/.test(e[0])){let n=e.shift(),r=e.shift(),i={name:n,type:t};return r===`<`&&(i.template=h(e,`>`),e.shift()),i.content=h(e,`;`),e.unshift(`;`),i}if(t===`enum`){let t=e.shift();e.shift();let n=h(e,`}`);return e.unshift(`;`),{name:t,type:`enum`,options:Object.fromEntries(n.join(``).split(`,`).filter(e=>e.trim()).map(e=>{if(e.includes(`=`)){let[t,n]=e.split(`=`);return[JSON.parse(n),t]}return[t,t]}))}}if(typeof t==`string`&&t.startsWith(`/*`))return{type:`comment`,content:b(t)};for(let n of p)if(t===n[0])return{type:`wrap`,content:_(h(e,n[1]),`;`).map(e=>_(e,`,`)).map(e=>_(e,`|`)),style:n.join(``)};return t}function y(e){return Array.isArray(e)?e.length===1?y(e[0]):e.map(e=>y(e)):typeof e==`object`&&e?r(e,({value:e})=>y(e)):e}function b(e){return e=e.trim(),e.startsWith(`/**`)&&e.endsWith(`*/`)?(e=e.slice(3,-2).split(`
|
|
4
|
-
`).map(e=>{let t=e.trim();return t.startsWith(`* `)?t.slice(2):t}).join(`
|
|
5
|
-
`).trim(),e.trim()):e}function x(e){e.elements.find(e=>[o.undefined,o.void].includes(e.type))&&(e.optional=!0,e.elements=e.elements.filter(e=>![o.undefined,o.void].includes(e.type)));let t=e.elements.filter(e=>e.type===o.union);if(t.length>0){e.elements=e.elements.filter(e=>e.type!==o.union);for(let n of t)e.elements.push(...n.elements)}let n=e.elements.filter(e=>e.type===o.string);if(n.length>1){let t=[],r=!1;for(let e of n)e.enum?t.push(...e.enum):r=!0;e.elements=e.elements.filter(e=>e.type!==o.string),r?e.elements.push(s.string()):e.elements.push(s.string({enum:t}))}let r=e.elements.filter(e=>e.type===o.number);if(r.length>1){let t=[],n=!1;for(let e of r)e.enum?t.push(...e.enum):n=!0;e.elements=e.elements.filter(e=>e.type!==o.number),n?e.elements.push(s.number()):e.elements.push(s.number({enum:t}))}if(e.elements.length===1){let t=e.elements[0];return t.optional=e.optional,t}return e.elements.length===0?s.void():e}function S(e){return e.className===`Array`?s.array(e.options.template[0]):e.className===`keyof`?s.string():e.className===`Record`?s.object({}):e.className===`PropertyKey`?s.union([s.string(),s.number()]):[`Promise`,`Partial`,`Required`].includes(e.className)?c[e.className.toLocaleLowerCase()](e.options.template[0]):[`Omit`,`Pick`].includes(e.className)?c[e.className.toLocaleLowerCase()](e.options.template[0],e.options.template[1]?.enum):e}function C(e,t={}){if(typeof e==`string`)return e===`string`?s.string(t):e===`number`?s.number(t):e===`boolean`?s.boolean(t):e===`undefined`?s.void(t):[`unknown`,`any`].includes(e)?s.unknown(t):[`undefined`,`null`].includes(e)?s.undefined(t):S(s.interface(e,t));if(Array.isArray(e)){if(e[0]===`readonly`&&e.shift(),e.length===1)return C(e[0],t);if(e.includes(`|`))return x(s.union(w(e,e=>e===`|`).map(e=>C(e)),t));if(e.includes(`&`))return x(s.union(w(e,e=>e===`&`).map(e=>C(e)),t));if(e.at(-1)?.type===`wrap`&&e.at(-1).style===`[]`)return s.array(C(e.slice(0,-1)),t);if(e[0]===`import`&&e[2]===`.`)return C(e.slice(3),t);if(e.length===2&&e[1].type===`wrap`&&e[1].style===`<>`){let n=e[1].content;return Array.isArray(n)||(n=[n]),Array.isArray(n[0])||(n=n.some(e=>e.type===`wrap`&&e.style===`[]`)||n.some(e=>e.type===`wrap`&&e.style===`<>`)||n.includes(`&`)||n.includes(`|`)?[n]:n.map(e=>[e])),n=n.map(e=>C(e)),S(s.interface(e[0],{...t,options:{template:n}}))}if(e.length===3&&e[1]===`=>`){let t=!e[0].content.length||Array.isArray(e[0].content[0])?e[0].content:[e[0].content];return s.function(s.object(Object.fromEntries(t.map(e=>[e[0],C(e.slice(2))]))),C(e[2]))}return C(e[0],t)}if(typeof e==`object`&&e&&e.type===`wrap`){if([`''`,`""`].includes(e.style))return s.string({...t,enum:[e.content]});if(e.style===`{}`){let n=!e.content.length||Array.isArray(e.content[0])?e.content:[e.content];return s.object(Object.fromEntries(n.filter(e=>typeof e[0]==`string`).map(e=>[e[0],e[1]===`?`?C(e.slice(3),{optional:!0}):C(e.slice(2))])),t)}if(e.style===`[]`)return e.content[1]===`:`?s.array(C(e.content.slice(2)),t):s.array(C(e.content),t);if(e.style===`()`)return C(e.content,t)}return console.log(`Unknown element`),console.log(e),s.unknown()}function w(e,t){let n=[[]];for(let r of e)t(r)?n.push([]):n[n.length-1].push(r);return n}function T(e){try{if(/^[A-Za-z]+\??:/.test(e)){let[,t,n,r]=e.match(/([A-Za-z]+)(\??):(.*)/),i=C(m(f(r)));return i.name=t,n===`?`&&(i.optional=!0),i}return C(m(f(e)))}catch(t){return console.error(`Failed to parse type`,e),console.error(t),s.unknown()}}function E(e,t,n){if(e=t({key:n,schema:e})||e,e.type===o.object)for(let n in e.properties)e.properties[n]=E(e.properties[n],t,n);if(e.type===o.array&&(e.items=E(e.items,t)),e.type===o.function&&(e.inputs=E(e.inputs,t),e.output=E(e.output,t)),e.type===o.union)for(let n in e.elements)e.elements[n]=E(e.elements[n],t);return e}Object.defineProperty(exports,`a`,{enumerable:!0,get:function(){return c}}),Object.defineProperty(exports,`c`,{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,`d`,{enumerable:!0,get:function(){return r}}),Object.defineProperty(exports,`i`,{enumerable:!0,get:function(){return s}}),Object.defineProperty(exports,`l`,{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,`n`,{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,`o`,{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,`r`,{enumerable:!0,get:function(){return o}}),Object.defineProperty(exports,`s`,{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,`u`,{enumerable:!0,get:function(){return n}});
|