@noego/forge 0.0.5 → 0.0.6
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.cjs +1 -1
- package/dist/client.cjs.map +1 -1
- package/dist/client.mjs +402 -129
- package/dist/client.mjs.map +1 -1
- package/dist/page.cjs +1 -1
- package/dist/page.cjs.map +1 -1
- package/dist/page.mjs +3 -41
- package/dist/page.mjs.map +1 -1
- package/dist/page.svelte-C4chAYK2.js +137 -0
- package/dist/page.svelte-C4chAYK2.js.map +1 -0
- package/dist/page.svelte-Dvj7306U.cjs +2 -0
- package/dist/page.svelte-Dvj7306U.cjs.map +1 -0
- package/dist/shared.cjs +1 -1
- package/dist/shared.mjs +2 -2
- package/dist-ssr/path-CyGuWUeq.cjs +68 -0
- package/dist-ssr/path-CyGuWUeq.cjs.map +1 -0
- package/dist-ssr/path-ODk1FhWY.js +69 -0
- package/dist-ssr/path-ODk1FhWY.js.map +1 -0
- package/dist-ssr/server.cjs +6 -170
- package/dist-ssr/server.cjs.map +1 -1
- package/dist-ssr/server.js +4 -151
- package/dist-ssr/server.js.map +1 -1
- package/dist-ssr/shared.cjs +28 -5
- package/dist-ssr/shared.cjs.map +1 -1
- package/dist-ssr/shared.js +27 -1
- package/dist-ssr/shared.js.map +1 -1
- package/package.json +1 -1
- package/dist/index-D3Pt-y7F.cjs +0 -2
- package/dist/index-D3Pt-y7F.cjs.map +0 -1
- package/dist/index-DFgPI13E.js +0 -96
- package/dist/index-DFgPI13E.js.map +0 -1
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
function convertBraces(path) {
|
|
3
|
+
let out = "";
|
|
4
|
+
let i = 0;
|
|
5
|
+
while (i < path.length) {
|
|
6
|
+
if (path[i] === "{") {
|
|
7
|
+
let start = i;
|
|
8
|
+
i++;
|
|
9
|
+
let depth = 1;
|
|
10
|
+
while (i < path.length && depth > 0) {
|
|
11
|
+
if (path[i] === "\\") {
|
|
12
|
+
i += 2;
|
|
13
|
+
} else {
|
|
14
|
+
if (path[i] === "{") depth++;
|
|
15
|
+
else if (path[i] === "}") depth--;
|
|
16
|
+
i++;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
if (depth !== 0) {
|
|
20
|
+
throw new Error(`Unmatched '{' in path: ${path}`);
|
|
21
|
+
}
|
|
22
|
+
const segment = path.slice(start + 1, i - 1);
|
|
23
|
+
const colonIdx = segment.indexOf(":");
|
|
24
|
+
let name;
|
|
25
|
+
let pattern;
|
|
26
|
+
let modifier;
|
|
27
|
+
if (colonIdx === -1) {
|
|
28
|
+
const m = segment.match(/^([^?*+]+)([?*+])?$/);
|
|
29
|
+
if (!m) {
|
|
30
|
+
throw new Error(`Invalid parameter segment: {${segment}}`);
|
|
31
|
+
}
|
|
32
|
+
[, name, modifier] = m;
|
|
33
|
+
} else {
|
|
34
|
+
name = segment.slice(0, colonIdx);
|
|
35
|
+
pattern = segment.slice(colonIdx + 1);
|
|
36
|
+
}
|
|
37
|
+
out += `:${name}`;
|
|
38
|
+
if (pattern) out += `(${pattern})`;
|
|
39
|
+
if (modifier) out += modifier;
|
|
40
|
+
} else {
|
|
41
|
+
out += path[i++];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return out;
|
|
45
|
+
}
|
|
46
|
+
function parsePathConfig(path, method, path_config) {
|
|
47
|
+
const layout = path_config["x-layout"];
|
|
48
|
+
const view = path_config["x-view"];
|
|
49
|
+
const summary = path_config.summary;
|
|
50
|
+
const query = path_config.query;
|
|
51
|
+
const body = path_config.body;
|
|
52
|
+
const parameters = path_config.parameters;
|
|
53
|
+
const responses = path_config.responses;
|
|
54
|
+
return {
|
|
55
|
+
summary,
|
|
56
|
+
path: convertBraces(path),
|
|
57
|
+
method,
|
|
58
|
+
layout,
|
|
59
|
+
view,
|
|
60
|
+
responses,
|
|
61
|
+
parameters,
|
|
62
|
+
query,
|
|
63
|
+
body
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
exports.convertBraces = convertBraces;
|
|
67
|
+
exports.parsePathConfig = parsePathConfig;
|
|
68
|
+
//# sourceMappingURL=path-CyGuWUeq.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-CyGuWUeq.cjs","sources":["../src/parser/path.ts"],"sourcesContent":["import type {IRoute} from \"./IRoute\"\n\n/**\n * Convert OpenAPI‐style `{name[:pattern][modifier]}` into\n * path-to-regexp’s `:name(pattern)?*+` syntax, while\n * allowing literal `{` or `}` inside the regex.\n */\nexport function convertBraces(path: string): string {\n let out = '';\n let i = 0;\n\n while (i < path.length) {\n if (path[i] === '{') {\n // start of a parameter spec\n let start = i;\n i++;\n // find the matching closing '}' that balances this one\n let depth = 1;\n while (i < path.length && depth > 0) {\n if (path[i] === '\\\\') {\n // skip escaped chars\n i += 2;\n } else {\n if (path[i] === '{') depth++;\n else if (path[i] === '}') depth--;\n i++;\n }\n }\n if (depth !== 0) {\n throw new Error(`Unmatched '{' in path: ${path}`);\n }\n const segment = path.slice(start + 1, i - 1);\n // A segment is one of the following forms:\n // 1. \"name\" – simple param, no pattern, no modifier\n // 2. \"name+\" / \"name*\" / \"name?\" – param with modifier only\n // 3. \"name:regex\" – explicit pattern (may itself contain +, *, ?)\n // In the third case we must **not** interpret a trailing +, * or ? as a\n // modifier because it belongs to the user-supplied regex. The original\n // implementation used a single regexp with an optional modifier group,\n // which incorrectly split patterns such as `.*` or `.+` into two parts\n // (`.` as the pattern and `*` or `+` as the modifier). Instead we now\n // split on the first ':'; if a pattern is present we treat the rest of\n // the segment verbatim.\n\n const colonIdx = segment.indexOf(':');\n let name: string;\n let pattern: string | undefined;\n let modifier: string | undefined;\n\n if (colonIdx === -1) {\n // Forms 1 & 2 – no explicit pattern, so a trailing modifier is allowed.\n const m = segment.match(/^([^?*+]+)([?*+])?$/);\n if (!m) {\n throw new Error(`Invalid parameter segment: {${segment}}`);\n }\n [, name, modifier] = m as RegExpMatchArray & [string, string, string?];\n } else {\n // Form 3 – everything after the first ':' is the pattern.\n name = segment.slice(0, colonIdx);\n pattern = segment.slice(colonIdx + 1);\n // No modifier allowed when an explicit pattern is used.\n }\n\n out += `:${name}`;\n if (pattern) out += `(${pattern})`;\n if (modifier) out += modifier;\n } else {\n // ordinary char, copy (also handles escaped chars)\n out += path[i++];\n }\n }\n\n return out;\n}\n\n\nexport function parsePathConfig(path:string,method:string,path_config:any):IRoute {\n const layout = path_config['x-layout']\n const view = path_config['x-view']\n const summary = path_config.summary\n const query = path_config.query\n const body = path_config.body\n const parameters = path_config.parameters\n const responses = path_config.responses\n\n return {\n summary,\n path: convertBraces(path),\n method,\n layout,\n view,\n responses,\n parameters,\n query,\n body\n }\n}\n"],"names":[],"mappings":";AAOO,SAAS,cAAc,MAAsB;AAClD,MAAI,MAAM;AACV,MAAI,IAAI;AAED,SAAA,IAAI,KAAK,QAAQ;AAClB,QAAA,KAAK,CAAC,MAAM,KAAK;AAEnB,UAAI,QAAQ;AACZ;AAEA,UAAI,QAAQ;AACZ,aAAO,IAAI,KAAK,UAAU,QAAQ,GAAG;AAC/B,YAAA,KAAK,CAAC,MAAM,MAAM;AAEf,eAAA;AAAA,QAAA,OACA;AACD,cAAA,KAAK,CAAC,MAAM,IAAK;AAAA,mBACZ,KAAK,CAAC,MAAM,IAAK;AAC1B;AAAA,QAAA;AAAA,MACF;AAEF,UAAI,UAAU,GAAG;AACf,cAAM,IAAI,MAAM,0BAA0B,IAAI,EAAE;AAAA,MAAA;AAElD,YAAM,UAAU,KAAK,MAAM,QAAQ,GAAG,IAAI,CAAC;AAarC,YAAA,WAAW,QAAQ,QAAQ,GAAG;AAChC,UAAA;AACA,UAAA;AACA,UAAA;AAEJ,UAAI,aAAa,IAAI;AAEb,cAAA,IAAI,QAAQ,MAAM,qBAAqB;AAC7C,YAAI,CAAC,GAAG;AACN,gBAAM,IAAI,MAAM,+BAA+B,OAAO,GAAG;AAAA,QAAA;AAE1D,WAAE,MAAM,QAAQ,IAAI;AAAA,MAAA,OAChB;AAEK,eAAA,QAAQ,MAAM,GAAG,QAAQ;AACzB,kBAAA,QAAQ,MAAM,WAAW,CAAC;AAAA,MAAA;AAItC,aAAO,IAAI,IAAI;AACX,UAAA,QAAiB,QAAA,IAAI,OAAO;AAChC,UAAI,SAAiB,QAAA;AAAA,IAAA,OAChB;AAEL,aAAO,KAAK,GAAG;AAAA,IAAA;AAAA,EACjB;AAGK,SAAA;AACT;AAGgB,SAAA,gBAAgB,MAAY,QAAc,aAAwB;AACxE,QAAA,SAAS,YAAY,UAAU;AAC/B,QAAA,OAAO,YAAY,QAAQ;AACjC,QAAM,UAAU,YAAY;AAC5B,QAAM,QAAQ,YAAY;AAC1B,QAAM,OAAO,YAAY;AACzB,QAAM,aAAa,YAAY;AAC/B,QAAM,YAAY,YAAY;AAEvB,SAAA;AAAA,IACH;AAAA,IACA,MAAM,cAAc,IAAI;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;;;"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
function convertBraces(path) {
|
|
2
|
+
let out = "";
|
|
3
|
+
let i = 0;
|
|
4
|
+
while (i < path.length) {
|
|
5
|
+
if (path[i] === "{") {
|
|
6
|
+
let start = i;
|
|
7
|
+
i++;
|
|
8
|
+
let depth = 1;
|
|
9
|
+
while (i < path.length && depth > 0) {
|
|
10
|
+
if (path[i] === "\\") {
|
|
11
|
+
i += 2;
|
|
12
|
+
} else {
|
|
13
|
+
if (path[i] === "{") depth++;
|
|
14
|
+
else if (path[i] === "}") depth--;
|
|
15
|
+
i++;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
if (depth !== 0) {
|
|
19
|
+
throw new Error(`Unmatched '{' in path: ${path}`);
|
|
20
|
+
}
|
|
21
|
+
const segment = path.slice(start + 1, i - 1);
|
|
22
|
+
const colonIdx = segment.indexOf(":");
|
|
23
|
+
let name;
|
|
24
|
+
let pattern;
|
|
25
|
+
let modifier;
|
|
26
|
+
if (colonIdx === -1) {
|
|
27
|
+
const m = segment.match(/^([^?*+]+)([?*+])?$/);
|
|
28
|
+
if (!m) {
|
|
29
|
+
throw new Error(`Invalid parameter segment: {${segment}}`);
|
|
30
|
+
}
|
|
31
|
+
[, name, modifier] = m;
|
|
32
|
+
} else {
|
|
33
|
+
name = segment.slice(0, colonIdx);
|
|
34
|
+
pattern = segment.slice(colonIdx + 1);
|
|
35
|
+
}
|
|
36
|
+
out += `:${name}`;
|
|
37
|
+
if (pattern) out += `(${pattern})`;
|
|
38
|
+
if (modifier) out += modifier;
|
|
39
|
+
} else {
|
|
40
|
+
out += path[i++];
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
45
|
+
function parsePathConfig(path, method, path_config) {
|
|
46
|
+
const layout = path_config["x-layout"];
|
|
47
|
+
const view = path_config["x-view"];
|
|
48
|
+
const summary = path_config.summary;
|
|
49
|
+
const query = path_config.query;
|
|
50
|
+
const body = path_config.body;
|
|
51
|
+
const parameters = path_config.parameters;
|
|
52
|
+
const responses = path_config.responses;
|
|
53
|
+
return {
|
|
54
|
+
summary,
|
|
55
|
+
path: convertBraces(path),
|
|
56
|
+
method,
|
|
57
|
+
layout,
|
|
58
|
+
view,
|
|
59
|
+
responses,
|
|
60
|
+
parameters,
|
|
61
|
+
query,
|
|
62
|
+
body
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
export {
|
|
66
|
+
convertBraces as c,
|
|
67
|
+
parsePathConfig as p
|
|
68
|
+
};
|
|
69
|
+
//# sourceMappingURL=path-ODk1FhWY.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path-ODk1FhWY.js","sources":["../src/parser/path.ts"],"sourcesContent":["import type {IRoute} from \"./IRoute\"\n\n/**\n * Convert OpenAPI‐style `{name[:pattern][modifier]}` into\n * path-to-regexp’s `:name(pattern)?*+` syntax, while\n * allowing literal `{` or `}` inside the regex.\n */\nexport function convertBraces(path: string): string {\n let out = '';\n let i = 0;\n\n while (i < path.length) {\n if (path[i] === '{') {\n // start of a parameter spec\n let start = i;\n i++;\n // find the matching closing '}' that balances this one\n let depth = 1;\n while (i < path.length && depth > 0) {\n if (path[i] === '\\\\') {\n // skip escaped chars\n i += 2;\n } else {\n if (path[i] === '{') depth++;\n else if (path[i] === '}') depth--;\n i++;\n }\n }\n if (depth !== 0) {\n throw new Error(`Unmatched '{' in path: ${path}`);\n }\n const segment = path.slice(start + 1, i - 1);\n // A segment is one of the following forms:\n // 1. \"name\" – simple param, no pattern, no modifier\n // 2. \"name+\" / \"name*\" / \"name?\" – param with modifier only\n // 3. \"name:regex\" – explicit pattern (may itself contain +, *, ?)\n // In the third case we must **not** interpret a trailing +, * or ? as a\n // modifier because it belongs to the user-supplied regex. The original\n // implementation used a single regexp with an optional modifier group,\n // which incorrectly split patterns such as `.*` or `.+` into two parts\n // (`.` as the pattern and `*` or `+` as the modifier). Instead we now\n // split on the first ':'; if a pattern is present we treat the rest of\n // the segment verbatim.\n\n const colonIdx = segment.indexOf(':');\n let name: string;\n let pattern: string | undefined;\n let modifier: string | undefined;\n\n if (colonIdx === -1) {\n // Forms 1 & 2 – no explicit pattern, so a trailing modifier is allowed.\n const m = segment.match(/^([^?*+]+)([?*+])?$/);\n if (!m) {\n throw new Error(`Invalid parameter segment: {${segment}}`);\n }\n [, name, modifier] = m as RegExpMatchArray & [string, string, string?];\n } else {\n // Form 3 – everything after the first ':' is the pattern.\n name = segment.slice(0, colonIdx);\n pattern = segment.slice(colonIdx + 1);\n // No modifier allowed when an explicit pattern is used.\n }\n\n out += `:${name}`;\n if (pattern) out += `(${pattern})`;\n if (modifier) out += modifier;\n } else {\n // ordinary char, copy (also handles escaped chars)\n out += path[i++];\n }\n }\n\n return out;\n}\n\n\nexport function parsePathConfig(path:string,method:string,path_config:any):IRoute {\n const layout = path_config['x-layout']\n const view = path_config['x-view']\n const summary = path_config.summary\n const query = path_config.query\n const body = path_config.body\n const parameters = path_config.parameters\n const responses = path_config.responses\n\n return {\n summary,\n path: convertBraces(path),\n method,\n layout,\n view,\n responses,\n parameters,\n query,\n body\n }\n}\n"],"names":[],"mappings":"AAOO,SAAS,cAAc,MAAsB;AAClD,MAAI,MAAM;AACV,MAAI,IAAI;AAED,SAAA,IAAI,KAAK,QAAQ;AAClB,QAAA,KAAK,CAAC,MAAM,KAAK;AAEnB,UAAI,QAAQ;AACZ;AAEA,UAAI,QAAQ;AACZ,aAAO,IAAI,KAAK,UAAU,QAAQ,GAAG;AAC/B,YAAA,KAAK,CAAC,MAAM,MAAM;AAEf,eAAA;AAAA,QAAA,OACA;AACD,cAAA,KAAK,CAAC,MAAM,IAAK;AAAA,mBACZ,KAAK,CAAC,MAAM,IAAK;AAC1B;AAAA,QAAA;AAAA,MACF;AAEF,UAAI,UAAU,GAAG;AACf,cAAM,IAAI,MAAM,0BAA0B,IAAI,EAAE;AAAA,MAAA;AAElD,YAAM,UAAU,KAAK,MAAM,QAAQ,GAAG,IAAI,CAAC;AAarC,YAAA,WAAW,QAAQ,QAAQ,GAAG;AAChC,UAAA;AACA,UAAA;AACA,UAAA;AAEJ,UAAI,aAAa,IAAI;AAEb,cAAA,IAAI,QAAQ,MAAM,qBAAqB;AAC7C,YAAI,CAAC,GAAG;AACN,gBAAM,IAAI,MAAM,+BAA+B,OAAO,GAAG;AAAA,QAAA;AAE1D,WAAE,MAAM,QAAQ,IAAI;AAAA,MAAA,OAChB;AAEK,eAAA,QAAQ,MAAM,GAAG,QAAQ;AACzB,kBAAA,QAAQ,MAAM,WAAW,CAAC;AAAA,MAAA;AAItC,aAAO,IAAI,IAAI;AACX,UAAA,QAAiB,QAAA,IAAI,OAAO;AAChC,UAAI,SAAiB,QAAA;AAAA,IAAA,OAChB;AAEL,aAAO,KAAK,GAAG;AAAA,IAAA;AAAA,EACjB;AAGK,SAAA;AACT;AAGgB,SAAA,gBAAgB,MAAY,QAAc,aAAwB;AACxE,QAAA,SAAS,YAAY,UAAU;AAC/B,QAAA,OAAO,YAAY,QAAQ;AACjC,QAAM,UAAU,YAAY;AAC5B,QAAM,QAAQ,YAAY;AAC1B,QAAM,OAAO,YAAY;AACzB,QAAM,aAAa,YAAY;AAC/B,QAAM,YAAY,YAAY;AAEvB,SAAA;AAAA,IACH;AAAA,IACA,MAAM,cAAc,IAAI;AAAA,IACxB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACJ;AACJ;"}
|
package/dist-ssr/server.cjs
CHANGED
|
@@ -33,26 +33,10 @@ const fs$1 = require("fs/promises");
|
|
|
33
33
|
const yaml = require("js-yaml");
|
|
34
34
|
require("clone-deep");
|
|
35
35
|
const join = require("url-join");
|
|
36
|
+
const path$1 = require("./path-CyGuWUeq.cjs");
|
|
36
37
|
const server = require("svelte/server");
|
|
37
38
|
const pathToRegex = require("path-to-regex");
|
|
38
|
-
const
|
|
39
|
-
function _interopNamespaceDefault(e) {
|
|
40
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
41
|
-
if (e) {
|
|
42
|
-
for (const k in e) {
|
|
43
|
-
if (k !== "default") {
|
|
44
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
45
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
46
|
-
enumerable: true,
|
|
47
|
-
get: () => e[k]
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
n.default = e;
|
|
53
|
-
return Object.freeze(n);
|
|
54
|
-
}
|
|
55
|
-
const $__namespace = /* @__PURE__ */ _interopNamespaceDefault($);
|
|
39
|
+
const ApplicationRenderer = require("../src/components/RecursiveRender.svelte");
|
|
56
40
|
class ViteComponentLoader {
|
|
57
41
|
constructor(basePath, vite) {
|
|
58
42
|
this.basePath = basePath;
|
|
@@ -153,70 +137,6 @@ class LiveHTMLRender {
|
|
|
153
137
|
return file_content;
|
|
154
138
|
}
|
|
155
139
|
}
|
|
156
|
-
function convertBraces(path2) {
|
|
157
|
-
let out = "";
|
|
158
|
-
let i = 0;
|
|
159
|
-
while (i < path2.length) {
|
|
160
|
-
if (path2[i] === "{") {
|
|
161
|
-
let start = i;
|
|
162
|
-
i++;
|
|
163
|
-
let depth = 1;
|
|
164
|
-
while (i < path2.length && depth > 0) {
|
|
165
|
-
if (path2[i] === "\\") {
|
|
166
|
-
i += 2;
|
|
167
|
-
} else {
|
|
168
|
-
if (path2[i] === "{") depth++;
|
|
169
|
-
else if (path2[i] === "}") depth--;
|
|
170
|
-
i++;
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
if (depth !== 0) {
|
|
174
|
-
throw new Error(`Unmatched '{' in path: ${path2}`);
|
|
175
|
-
}
|
|
176
|
-
const segment = path2.slice(start + 1, i - 1);
|
|
177
|
-
const colonIdx = segment.indexOf(":");
|
|
178
|
-
let name;
|
|
179
|
-
let pattern;
|
|
180
|
-
let modifier;
|
|
181
|
-
if (colonIdx === -1) {
|
|
182
|
-
const m = segment.match(/^([^?*+]+)([?*+])?$/);
|
|
183
|
-
if (!m) {
|
|
184
|
-
throw new Error(`Invalid parameter segment: {${segment}}`);
|
|
185
|
-
}
|
|
186
|
-
[, name, modifier] = m;
|
|
187
|
-
} else {
|
|
188
|
-
name = segment.slice(0, colonIdx);
|
|
189
|
-
pattern = segment.slice(colonIdx + 1);
|
|
190
|
-
}
|
|
191
|
-
out += `:${name}`;
|
|
192
|
-
if (pattern) out += `(${pattern})`;
|
|
193
|
-
if (modifier) out += modifier;
|
|
194
|
-
} else {
|
|
195
|
-
out += path2[i++];
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return out;
|
|
199
|
-
}
|
|
200
|
-
function parsePathConfig(path2, method, path_config) {
|
|
201
|
-
const layout = path_config["x-layout"];
|
|
202
|
-
const view = path_config["x-view"];
|
|
203
|
-
const summary = path_config.summary;
|
|
204
|
-
const query = path_config.query;
|
|
205
|
-
const body = path_config.body;
|
|
206
|
-
const parameters = path_config.parameters;
|
|
207
|
-
const responses = path_config.responses;
|
|
208
|
-
return {
|
|
209
|
-
summary,
|
|
210
|
-
path: convertBraces(path2),
|
|
211
|
-
method,
|
|
212
|
-
layout,
|
|
213
|
-
view,
|
|
214
|
-
responses,
|
|
215
|
-
parameters,
|
|
216
|
-
query,
|
|
217
|
-
body
|
|
218
|
-
};
|
|
219
|
-
}
|
|
220
140
|
function parseConfigfile(file_content) {
|
|
221
141
|
let config = null;
|
|
222
142
|
try {
|
|
@@ -243,7 +163,7 @@ function parse_modules(openapi) {
|
|
|
243
163
|
}
|
|
244
164
|
const configurations = Object.entries(paths).map(([path2, method_config]) => {
|
|
245
165
|
return Object.entries(method_config).map(([method, config]) => {
|
|
246
|
-
return parsePathConfig(path2, method, config);
|
|
166
|
+
return path$1.parsePathConfig(path2, method, config);
|
|
247
167
|
});
|
|
248
168
|
});
|
|
249
169
|
const routes = configurations.reduce((flat_config, config) => {
|
|
@@ -269,7 +189,7 @@ function parse_paths(openapi) {
|
|
|
269
189
|
}
|
|
270
190
|
const configurations = Object.entries(paths).map(([path2, method_config]) => {
|
|
271
191
|
return Object.entries(method_config).map(([method, config]) => {
|
|
272
|
-
return parsePathConfig(path2, method, config);
|
|
192
|
+
return path$1.parsePathConfig(path2, method, config);
|
|
273
193
|
});
|
|
274
194
|
});
|
|
275
195
|
const routes = configurations.reduce((flat_config, config) => {
|
|
@@ -554,90 +474,6 @@ function initialize_route_matchers(routes) {
|
|
|
554
474
|
}
|
|
555
475
|
class ServerAdapter {
|
|
556
476
|
}
|
|
557
|
-
function RecursiveRender($$payload, $$props) {
|
|
558
|
-
$__namespace.push();
|
|
559
|
-
let topLayout, childlayouts, top_data, other_data, view_data, recursive_child_data;
|
|
560
|
-
let layouts = $__namespace.fallback($$props["layouts"], () => [], true);
|
|
561
|
-
let view = $__namespace.fallback($$props["view"], null);
|
|
562
|
-
let data = $__namespace.fallback($$props["data"], () => ({}), true);
|
|
563
|
-
let params = $__namespace.fallback($$props["params"], () => ({}), true);
|
|
564
|
-
let urlParams = $__namespace.fallback($$props["urlParams"], () => ({}), true);
|
|
565
|
-
let query = $__namespace.fallback($$props["query"], () => ({}), true);
|
|
566
|
-
let page = $__namespace.fallback($$props["page"], null);
|
|
567
|
-
console.log("[page]", page);
|
|
568
|
-
[topLayout, ...childlayouts] = layouts;
|
|
569
|
-
[top_data, ...other_data] = data.layout || [];
|
|
570
|
-
view_data = data.view;
|
|
571
|
-
recursive_child_data = { layout: other_data, view: data.view };
|
|
572
|
-
if (childlayouts.length > 0) {
|
|
573
|
-
$$payload.out += "<!--[-->";
|
|
574
|
-
$$payload.out += `<!---->`;
|
|
575
|
-
topLayout == null ? void 0 : topLayout($$payload, $__namespace.spread_props([
|
|
576
|
-
top_data || {},
|
|
577
|
-
{
|
|
578
|
-
params,
|
|
579
|
-
urlParams,
|
|
580
|
-
query,
|
|
581
|
-
page,
|
|
582
|
-
children: ($$payload2) => {
|
|
583
|
-
RecursiveRender($$payload2, {
|
|
584
|
-
layouts: childlayouts,
|
|
585
|
-
view,
|
|
586
|
-
data: recursive_child_data,
|
|
587
|
-
params,
|
|
588
|
-
urlParams,
|
|
589
|
-
query,
|
|
590
|
-
page
|
|
591
|
-
});
|
|
592
|
-
$$payload2.out += `<!---->`;
|
|
593
|
-
},
|
|
594
|
-
$$slots: { default: true }
|
|
595
|
-
}
|
|
596
|
-
]));
|
|
597
|
-
$$payload.out += `<!---->`;
|
|
598
|
-
} else if (topLayout) {
|
|
599
|
-
$$payload.out += "<!--[1-->";
|
|
600
|
-
$$payload.out += `<!---->`;
|
|
601
|
-
topLayout == null ? void 0 : topLayout($$payload, $__namespace.spread_props([
|
|
602
|
-
top_data || {},
|
|
603
|
-
{
|
|
604
|
-
params,
|
|
605
|
-
urlParams,
|
|
606
|
-
query,
|
|
607
|
-
page,
|
|
608
|
-
children: ($$payload2) => {
|
|
609
|
-
$$payload2.out += `<!---->`;
|
|
610
|
-
view == null ? void 0 : view($$payload2, $__namespace.spread_props([
|
|
611
|
-
view_data || {},
|
|
612
|
-
{ params, urlParams, query, page }
|
|
613
|
-
]));
|
|
614
|
-
$$payload2.out += `<!---->`;
|
|
615
|
-
},
|
|
616
|
-
$$slots: { default: true }
|
|
617
|
-
}
|
|
618
|
-
]));
|
|
619
|
-
$$payload.out += `<!---->`;
|
|
620
|
-
} else {
|
|
621
|
-
$$payload.out += "<!--[!-->";
|
|
622
|
-
$$payload.out += `<!---->`;
|
|
623
|
-
view == null ? void 0 : view($$payload, $__namespace.spread_props([
|
|
624
|
-
view_data || {},
|
|
625
|
-
{ params, urlParams, query, page }
|
|
626
|
-
]));
|
|
627
|
-
$$payload.out += `<!---->`;
|
|
628
|
-
}
|
|
629
|
-
$$payload.out += `<!--]-->`;
|
|
630
|
-
$__namespace.bind_props($$props, {
|
|
631
|
-
layouts,
|
|
632
|
-
view,
|
|
633
|
-
data,
|
|
634
|
-
params,
|
|
635
|
-
urlParams,
|
|
636
|
-
query,
|
|
637
|
-
page
|
|
638
|
-
});
|
|
639
|
-
$__namespace.pop();
|
|
640
|
-
}
|
|
641
477
|
class ExpressServerAdapter extends ServerAdapter {
|
|
642
478
|
constructor(server2, manager, htmlRender, api_adapter, middleware_adapter) {
|
|
643
479
|
super();
|
|
@@ -750,7 +586,7 @@ class ExpressServerAdapter extends ServerAdapter {
|
|
|
750
586
|
params: request_data.params || {},
|
|
751
587
|
query: request_data.query
|
|
752
588
|
};
|
|
753
|
-
let { head: head_render, body: body_render, css } = server.render(
|
|
589
|
+
let { head: head_render, body: body_render, css } = server.render(ApplicationRenderer, {
|
|
754
590
|
props: {
|
|
755
591
|
layouts,
|
|
756
592
|
view,
|
|
@@ -827,7 +663,7 @@ view: ${route.view}</pre>`;
|
|
|
827
663
|
const view = await this.manager.getView(route);
|
|
828
664
|
console.log("Fallback view", view);
|
|
829
665
|
console.log("Fallback layouts", layouts);
|
|
830
|
-
let { head: head_render, body: body_render, css } = server.render(
|
|
666
|
+
let { head: head_render, body: body_render, css } = server.render(ApplicationRenderer, {
|
|
831
667
|
props: {
|
|
832
668
|
layouts,
|
|
833
669
|
view,
|