@xyd-js/cli 0.1.0-xyd.1 → 0.1.0-xyd.11
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/.cli/bin.js +3 -0
- package/.cli/{host/node_modules/.vite/deps/gray-matter.js → index.js} +2715 -533
- package/.cli/package-lock.json +7497 -0
- package/.cli/package.json +37 -0
- package/package.json +39 -44
- package/postinstall.js +10 -0
- package/.cli/dist/index.js +0 -12417
- package/.cli/host/.react-router/types/app/+types/root.ts +0 -40
- package/.cli/host/node_modules/.vite/deps/@mdx-js_mdx.js +0 -81
- package/.cli/host/node_modules/.vite/deps/@mdx-js_mdx.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/@mdx-js_rollup.js +0 -4003
- package/.cli/host/node_modules/.vite/deps/@mdx-js_rollup.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/@radix-ui_react-icons.js +0 -7531
- package/.cli/host/node_modules/.vite/deps/@radix-ui_react-icons.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/@radix-ui_react-tabs.js +0 -917
- package/.cli/host/node_modules/.vite/deps/@radix-ui_react-tabs.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/_metadata.json +0 -157
- package/.cli/host/node_modules/.vite/deps/chunk-2TUXWMP5.js +0 -46
- package/.cli/host/node_modules/.vite/deps/chunk-2TUXWMP5.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-DNIFH2K7.js +0 -3461
- package/.cli/host/node_modules/.vite/deps/chunk-DNIFH2K7.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-ERHH4CDL.js +0 -23875
- package/.cli/host/node_modules/.vite/deps/chunk-ERHH4CDL.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-ETJV5QNK.js +0 -27
- package/.cli/host/node_modules/.vite/deps/chunk-ETJV5QNK.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-GPEJJ3KZ.js +0 -1906
- package/.cli/host/node_modules/.vite/deps/chunk-GPEJJ3KZ.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-IVP26VTC.js +0 -21
- package/.cli/host/node_modules/.vite/deps/chunk-IVP26VTC.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-MJUUSK53.js +0 -894
- package/.cli/host/node_modules/.vite/deps/chunk-MJUUSK53.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-NHN7DW4J.js +0 -928
- package/.cli/host/node_modules/.vite/deps/chunk-NHN7DW4J.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-OO6QDGMA.js +0 -10609
- package/.cli/host/node_modules/.vite/deps/chunk-OO6QDGMA.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-OUN4SSIE.js +0 -205
- package/.cli/host/node_modules/.vite/deps/chunk-OUN4SSIE.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-TKNG6GUJ.js +0 -894
- package/.cli/host/node_modules/.vite/deps/chunk-TKNG6GUJ.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-TM4FKLNO.js +0 -21628
- package/.cli/host/node_modules/.vite/deps/chunk-TM4FKLNO.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/chunk-V2IF7L2E.js +0 -12
- package/.cli/host/node_modules/.vite/deps/chunk-V2IF7L2E.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/gray-matter.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/lucide-react.js +0 -34742
- package/.cli/host/node_modules/.vite/deps/lucide-react.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/package.json +0 -3
- package/.cli/host/node_modules/.vite/deps/react-dom.js +0 -7
- package/.cli/host/node_modules/.vite/deps/react-dom.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/react-dom_client.js +0 -39
- package/.cli/host/node_modules/.vite/deps/react-dom_client.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/react-router.js +0 -243
- package/.cli/host/node_modules/.vite/deps/react-router.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/react-router_dom.js +0 -212
- package/.cli/host/node_modules/.vite/deps/react-router_dom.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/react.js +0 -6
- package/.cli/host/node_modules/.vite/deps/react.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/react_jsx-dev-runtime.js +0 -913
- package/.cli/host/node_modules/.vite/deps/react_jsx-dev-runtime.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/react_jsx-runtime.js +0 -7
- package/.cli/host/node_modules/.vite/deps/react_jsx-runtime.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/remark-frontmatter.js +0 -428
- package/.cli/host/node_modules/.vite/deps/remark-frontmatter.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/remark-gfm.js +0 -3122
- package/.cli/host/node_modules/.vite/deps/remark-gfm.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/remark-mdx-frontmatter.js +0 -10482
- package/.cli/host/node_modules/.vite/deps/remark-mdx-frontmatter.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/unist-util-visit.js +0 -14
- package/.cli/host/node_modules/.vite/deps/unist-util-visit.js.map +0 -7
- package/.cli/host/node_modules/.vite/deps/vfile.js +0 -8
- package/.cli/host/node_modules/.vite/deps/vfile.js.map +0 -7
- package/.cli/host/package.json +0 -43
- package/bin.js +0 -3
- /package/.cli/{host/app → app}/root.tsx +0 -0
- /package/.cli/{host/app → app}/routes.ts +0 -0
- /package/.cli/{dist/index.d.ts → index.d.ts} +0 -0
- /package/.cli/{host/postcss.config.cjs → postcss.config.cjs} +0 -0
- /package/.cli/{host/react-router.config.ts → react-router.config.ts} +0 -0
- /package/.cli/{host/tsconfig.json → tsconfig.json} +0 -0
- /package/.cli/{host/vite.config.ts → vite.config.ts} +0 -0
|
@@ -1,14 +1,1600 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __commonJS = (cb, mod) => function __require3() {
|
|
15
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
16
|
+
};
|
|
17
|
+
var __copyProps = (to, from, except, desc) => {
|
|
18
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
19
|
+
for (let key of __getOwnPropNames(from))
|
|
20
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
21
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
22
|
+
}
|
|
23
|
+
return to;
|
|
24
|
+
};
|
|
25
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
26
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
27
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
28
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
29
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
30
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
31
|
+
mod
|
|
32
|
+
));
|
|
33
|
+
|
|
34
|
+
// node_modules/picocolors/picocolors.js
|
|
35
|
+
var require_picocolors = __commonJS({
|
|
36
|
+
"node_modules/picocolors/picocolors.js"(exports2, module2) {
|
|
37
|
+
"use strict";
|
|
38
|
+
var p = process || {};
|
|
39
|
+
var argv = p.argv || [];
|
|
40
|
+
var env = p.env || {};
|
|
41
|
+
var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
42
|
+
var formatter = (open, close, replace = open) => (input) => {
|
|
43
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
44
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
45
|
+
};
|
|
46
|
+
var replaceClose = (string, close, replace, index) => {
|
|
47
|
+
let result = "", cursor = 0;
|
|
48
|
+
do {
|
|
49
|
+
result += string.substring(cursor, index) + replace;
|
|
50
|
+
cursor = index + close.length;
|
|
51
|
+
index = string.indexOf(close, cursor);
|
|
52
|
+
} while (~index);
|
|
53
|
+
return result + string.substring(cursor);
|
|
54
|
+
};
|
|
55
|
+
var createColors = (enabled = isColorSupported) => {
|
|
56
|
+
let f = enabled ? formatter : () => String;
|
|
57
|
+
return {
|
|
58
|
+
isColorSupported: enabled,
|
|
59
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
60
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
61
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
62
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
63
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
64
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
65
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
66
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
67
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
68
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
69
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
70
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
71
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
72
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
73
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
74
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
75
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
76
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
77
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
78
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
79
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
80
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
81
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
82
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
83
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
84
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
85
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
86
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
87
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
88
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
89
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
90
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
91
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
92
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
93
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
94
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
95
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
96
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
97
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
98
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
99
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
module2.exports = createColors();
|
|
103
|
+
module2.exports.createColors = createColors;
|
|
104
|
+
}
|
|
105
|
+
});
|
|
8
106
|
|
|
9
|
-
//
|
|
10
|
-
var
|
|
11
|
-
"
|
|
107
|
+
// package.json
|
|
108
|
+
var require_package = __commonJS({
|
|
109
|
+
"package.json"(exports2, module2) {
|
|
110
|
+
module2.exports = {
|
|
111
|
+
name: "@xyd-js/cli",
|
|
112
|
+
version: "0.1.0-xyd.10",
|
|
113
|
+
keywords: [],
|
|
114
|
+
author: "",
|
|
115
|
+
description: "",
|
|
116
|
+
type: "module",
|
|
117
|
+
files: [
|
|
118
|
+
".cli",
|
|
119
|
+
"postinstall.js"
|
|
120
|
+
],
|
|
121
|
+
scripts: {
|
|
122
|
+
build: "tsup",
|
|
123
|
+
postinstall: "node postinstall.js"
|
|
124
|
+
},
|
|
125
|
+
dependencies: {
|
|
126
|
+
"@graphql-markdown/core": "^1.12.0",
|
|
127
|
+
"@graphql-markdown/graphql": "^1.1.4",
|
|
128
|
+
"@graphql-markdown/types": "^1.4.0",
|
|
129
|
+
"@react-router/dev": "^7.1.1",
|
|
130
|
+
"@react-router/node": "^7.1.1",
|
|
131
|
+
"@react-router/serve": "^7.1.1",
|
|
132
|
+
"@readme/oas-to-snippet": "^26.0.1",
|
|
133
|
+
"@xyd-js/documan-host": "file:.cli",
|
|
134
|
+
"@xyd-js/react-router-dev": "7.1.1-xyd.3",
|
|
135
|
+
arg: "^5.0.2",
|
|
136
|
+
codehike: "^1.0.3",
|
|
137
|
+
colors: "^1.4.0",
|
|
138
|
+
compression: "^1.7.5",
|
|
139
|
+
express: "^4.21.1",
|
|
140
|
+
"get-port": "^7.1.0",
|
|
141
|
+
"graphql-config": "^5.1.2",
|
|
142
|
+
"gray-matter": "^4.0.3",
|
|
143
|
+
isbot: "^5.1.17",
|
|
144
|
+
"js-yaml": "^4.1.0",
|
|
145
|
+
"json-schema-ref-parser": "^9.0.9",
|
|
146
|
+
"json-to-graphql-query": "^2.3.0",
|
|
147
|
+
lightningcss: "^1.27.0",
|
|
148
|
+
morgan: "^1.10.0",
|
|
149
|
+
oas: "^25.0.3",
|
|
150
|
+
"openapi-sampler": "^1.5.1",
|
|
151
|
+
"openapi-types": "^12.1.3",
|
|
152
|
+
react: "^18.3.1",
|
|
153
|
+
"react-dom": "^18.3.1",
|
|
154
|
+
"react-router": "^7.1.1",
|
|
155
|
+
remark: "^15.0.1",
|
|
156
|
+
"remark-frontmatter": "^5.0.0",
|
|
157
|
+
"remark-gfm": "^4.0.0",
|
|
158
|
+
"remark-mdx-frontmatter": "^5.0.0",
|
|
159
|
+
"remark-stringify": "^11.0.0",
|
|
160
|
+
semver: "^7.6.3",
|
|
161
|
+
"source-map-support": "^0.5.21",
|
|
162
|
+
typescript: "^5.6.3",
|
|
163
|
+
"unist-builder": "^4.0.0",
|
|
164
|
+
"unist-util-visit": "^5.0.0",
|
|
165
|
+
vfile: "^6.0.3",
|
|
166
|
+
"vite-tsconfig-paths": "^5.1.4",
|
|
167
|
+
yaml: "^2.6.0"
|
|
168
|
+
},
|
|
169
|
+
devDependencies: {
|
|
170
|
+
"@xyd-js/documan": "0.1.0-xyd.15",
|
|
171
|
+
arg: "^5.0.2",
|
|
172
|
+
colors: "^1.4.0",
|
|
173
|
+
semver: "^7.6.3",
|
|
174
|
+
tsup: "^8.3.0",
|
|
175
|
+
"vite-tsconfig-paths": "^5.1.4"
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
// src/run.ts
|
|
182
|
+
var import_picocolors = __toESM(require_picocolors(), 1);
|
|
183
|
+
import arg from "arg";
|
|
184
|
+
import semver from "semver";
|
|
185
|
+
|
|
186
|
+
// node_modules/@xyd-js/documan/dist/index.js
|
|
187
|
+
import path4 from "node:path";
|
|
188
|
+
import fs4 from "node:fs";
|
|
189
|
+
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
190
|
+
import { execSync } from "child_process";
|
|
191
|
+
import { build as viteBuild } from "vite";
|
|
192
|
+
import tsconfigPaths from "vite-tsconfig-paths";
|
|
193
|
+
import { reactRouter } from "@xyd-js/react-router-dev/vite";
|
|
194
|
+
|
|
195
|
+
// node_modules/@xyd-js/content/dist/index.js
|
|
196
|
+
import { VFile } from "vfile";
|
|
197
|
+
import { compile as mdxCompile } from "@mdx-js/mdx";
|
|
198
|
+
import remarkFrontmatter from "remark-frontmatter";
|
|
199
|
+
import remarkMdxFrontmatter from "remark-mdx-frontmatter";
|
|
200
|
+
import remarkGfm from "remark-gfm";
|
|
201
|
+
import { visit } from "unist-util-visit";
|
|
202
|
+
import { visit as visit2 } from "unist-util-visit";
|
|
203
|
+
import { visit as visit3 } from "unist-util-visit";
|
|
204
|
+
import mdx from "@mdx-js/rollup";
|
|
205
|
+
var remarkMdxToc = (options2) => () => async (ast) => {
|
|
206
|
+
const { visit: visit4 } = await import("unist-util-visit");
|
|
207
|
+
const { toString } = await import("mdast-util-to-string");
|
|
208
|
+
const { valueToEstree } = await import("estree-util-value-to-estree");
|
|
209
|
+
const { name: isIdentifierName } = await import("estree-util-is-identifier-name");
|
|
210
|
+
const mdast = ast;
|
|
211
|
+
const name = options2.name ?? "toc";
|
|
212
|
+
if (!isIdentifierName(name)) {
|
|
213
|
+
throw new Error(`Invalid name for an identifier: ${name}`);
|
|
214
|
+
}
|
|
215
|
+
const toc = [];
|
|
216
|
+
const flatToc = [];
|
|
217
|
+
const createEntry = (node, depth) => {
|
|
218
|
+
let attributes = node.data || {};
|
|
219
|
+
if (node.type === "mdxJsxFlowElement") {
|
|
220
|
+
attributes = Object.fromEntries(
|
|
221
|
+
node.attributes.filter((attribute) => attribute.type === "mdxJsxAttribute" && typeof attribute.value === "string").map((attribute) => [attribute.name, attribute.value])
|
|
222
|
+
);
|
|
223
|
+
}
|
|
224
|
+
return {
|
|
225
|
+
depth,
|
|
226
|
+
value: toString(node, { includeImageAlt: false }),
|
|
227
|
+
attributes,
|
|
228
|
+
children: []
|
|
229
|
+
};
|
|
230
|
+
};
|
|
231
|
+
visit4(mdast, ["heading", "mdxJsxFlowElement"], (node) => {
|
|
232
|
+
let depth = 0;
|
|
233
|
+
if (node.type === "mdxJsxFlowElement") {
|
|
234
|
+
let valid = false;
|
|
235
|
+
if (/^h[1-6]$/.test(node.name || "")) {
|
|
236
|
+
valid = true;
|
|
237
|
+
depth = parseInt(node.name.substring(1));
|
|
238
|
+
} else if (options2.customTags) {
|
|
239
|
+
for (const tag of options2.customTags) {
|
|
240
|
+
if (tag.name.test(node.name || "")) {
|
|
241
|
+
valid = true;
|
|
242
|
+
depth = tag.depth(node.name || "");
|
|
243
|
+
break;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
if (!valid) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
} else if (node.type === "heading") {
|
|
251
|
+
depth = node.depth;
|
|
252
|
+
} else {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
if (depth && ((options2 == null ? void 0 : options2.minDepth) && options2.minDepth > depth)) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
const entry = createEntry(node, depth);
|
|
259
|
+
flatToc.push(entry);
|
|
260
|
+
let parent = toc;
|
|
261
|
+
for (let i = flatToc.length - 1; i >= 0; --i) {
|
|
262
|
+
const current = flatToc[i];
|
|
263
|
+
if (current.depth < entry.depth) {
|
|
264
|
+
parent = current.children;
|
|
265
|
+
break;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
parent.push(entry);
|
|
269
|
+
});
|
|
270
|
+
const tocExport = {
|
|
271
|
+
type: "mdxjsEsm",
|
|
272
|
+
value: "",
|
|
273
|
+
data: {
|
|
274
|
+
estree: {
|
|
275
|
+
type: "Program",
|
|
276
|
+
sourceType: "module",
|
|
277
|
+
body: [
|
|
278
|
+
{
|
|
279
|
+
type: "ExportNamedDeclaration",
|
|
280
|
+
specifiers: [],
|
|
281
|
+
source: null,
|
|
282
|
+
declaration: {
|
|
283
|
+
type: "VariableDeclaration",
|
|
284
|
+
kind: "const",
|
|
285
|
+
declarations: [
|
|
286
|
+
{
|
|
287
|
+
type: "VariableDeclarator",
|
|
288
|
+
id: {
|
|
289
|
+
type: "Identifier",
|
|
290
|
+
name
|
|
291
|
+
},
|
|
292
|
+
init: valueToEstree(toc)
|
|
293
|
+
}
|
|
294
|
+
]
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
]
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
};
|
|
301
|
+
mdast.children.unshift(tocExport);
|
|
302
|
+
};
|
|
303
|
+
function remarkInjectCodeMeta() {
|
|
304
|
+
return (tree) => {
|
|
305
|
+
visit(tree, "code", (node) => {
|
|
306
|
+
if (node.meta) {
|
|
307
|
+
node.data = node.data || {};
|
|
308
|
+
node.data.hProperties = {
|
|
309
|
+
...node.data.hProperties || {},
|
|
310
|
+
meta: node.meta
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
var extractThemeSettings = () => {
|
|
317
|
+
return (tree) => {
|
|
318
|
+
visit2(tree, "exportNamedDeclaration", (node) => {
|
|
319
|
+
const declaration = node.declaration;
|
|
320
|
+
if (declaration && declaration.declarations) {
|
|
321
|
+
declaration.declarations.forEach((decl) => {
|
|
322
|
+
if (decl.id.name === "themeSettings") {
|
|
323
|
+
global.themeSettings = decl.init;
|
|
324
|
+
}
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
};
|
|
329
|
+
};
|
|
330
|
+
var extractPage = () => {
|
|
331
|
+
return (tree) => {
|
|
332
|
+
visit3(tree, "exportNamedDeclaration", (node) => {
|
|
333
|
+
const declaration = node.declaration;
|
|
334
|
+
if (declaration && declaration.declarations) {
|
|
335
|
+
declaration.declarations.forEach((decl) => {
|
|
336
|
+
if (decl.id.name === "page") {
|
|
337
|
+
global.page = decl.init;
|
|
338
|
+
}
|
|
339
|
+
});
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
};
|
|
343
|
+
};
|
|
344
|
+
function mdxOptions(toc) {
|
|
345
|
+
return {
|
|
346
|
+
remarkPlugins: [
|
|
347
|
+
remarkFrontmatter,
|
|
348
|
+
remarkMdxFrontmatter,
|
|
349
|
+
remarkGfm,
|
|
350
|
+
remarkInjectCodeMeta,
|
|
351
|
+
remarkMdxToc(toc),
|
|
352
|
+
extractThemeSettings,
|
|
353
|
+
extractPage
|
|
354
|
+
],
|
|
355
|
+
rehypePlugins: []
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function vitePlugins(options2) {
|
|
359
|
+
return [
|
|
360
|
+
mdx(mdxOptions(options2.toc))
|
|
361
|
+
];
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// node_modules/@xyd-js/plugin-zero/dist/index.js
|
|
365
|
+
import { promises as fs2 } from "fs";
|
|
366
|
+
import path22 from "node:path";
|
|
367
|
+
import { createServer as createServer2 } from "vite";
|
|
368
|
+
import { route } from "@react-router/dev/routes";
|
|
369
|
+
import fs3 from "fs/promises";
|
|
370
|
+
import path3 from "node:path";
|
|
371
|
+
import { createServer } from "vite";
|
|
372
|
+
import { fileURLToPath } from "node:url";
|
|
373
|
+
|
|
374
|
+
// node_modules/@xyd-js/gql/dist/index.js
|
|
375
|
+
import { getDocumentLoaders, loadSchema } from "@graphql-markdown/graphql";
|
|
376
|
+
|
|
377
|
+
// node_modules/@xyd-js/uniform/dist/index.js
|
|
378
|
+
import path from "path";
|
|
379
|
+
import matter from "gray-matter";
|
|
380
|
+
function uniform(references, config) {
|
|
381
|
+
const response = {
|
|
382
|
+
references,
|
|
383
|
+
out: {}
|
|
384
|
+
};
|
|
385
|
+
const finishCallbacks = /* @__PURE__ */ new Set();
|
|
386
|
+
config.plugins.forEach((plugin) => {
|
|
387
|
+
const call = plugin((cb) => {
|
|
388
|
+
finishCallbacks.add(cb);
|
|
389
|
+
});
|
|
390
|
+
references.forEach((ref) => {
|
|
391
|
+
call(ref);
|
|
392
|
+
});
|
|
393
|
+
});
|
|
394
|
+
finishCallbacks.forEach((cb) => {
|
|
395
|
+
if (typeof cb === "function") {
|
|
396
|
+
const resp = cb();
|
|
397
|
+
if (typeof resp !== "object") {
|
|
398
|
+
throw new Error(`Invalid callback return type: ${typeof resp}`);
|
|
399
|
+
}
|
|
400
|
+
response.out = {
|
|
401
|
+
...response.out,
|
|
402
|
+
...resp
|
|
403
|
+
};
|
|
404
|
+
} else {
|
|
405
|
+
throw new Error(`Invalid callback type: ${typeof cb}`);
|
|
406
|
+
}
|
|
407
|
+
});
|
|
408
|
+
return response;
|
|
409
|
+
}
|
|
410
|
+
function pluginNavigation(options2) {
|
|
411
|
+
if (!options2.urlPrefix) {
|
|
412
|
+
throw new Error("urlPrefix is required");
|
|
413
|
+
}
|
|
414
|
+
return function pluginNavigationInner(cb) {
|
|
415
|
+
const pageFrontMatter = {};
|
|
416
|
+
const groupMaps = {};
|
|
417
|
+
cb(() => {
|
|
418
|
+
return {
|
|
419
|
+
pageFrontMatter,
|
|
420
|
+
sidebar: convertGroupMapsToNavigations(groupMaps)
|
|
421
|
+
};
|
|
422
|
+
});
|
|
423
|
+
return (ref) => {
|
|
424
|
+
var _a;
|
|
425
|
+
const content = matter(ref.description || "");
|
|
426
|
+
if (content.data) {
|
|
427
|
+
const data = content.data;
|
|
428
|
+
const pagePath = path.join(options2.urlPrefix, ref.canonical);
|
|
429
|
+
if (data.title) {
|
|
430
|
+
pageFrontMatter[pagePath] = {
|
|
431
|
+
title: data.title
|
|
432
|
+
};
|
|
433
|
+
}
|
|
434
|
+
if (data.group) {
|
|
435
|
+
if (typeof ((_a = content == null ? void 0 : content.data) == null ? void 0 : _a.group) === "string") {
|
|
436
|
+
throw new Error("group as string is not supported yet");
|
|
437
|
+
}
|
|
438
|
+
content.data.group.reduce((groups, group, i) => {
|
|
439
|
+
if (!groups[group]) {
|
|
440
|
+
groups[group] = {
|
|
441
|
+
__groups: {},
|
|
442
|
+
pages: /* @__PURE__ */ new Set()
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
if (i === content.data.group.length - 1) {
|
|
446
|
+
groups[group].pages.add(pagePath);
|
|
447
|
+
}
|
|
448
|
+
return groups[group].__groups;
|
|
449
|
+
}, groupMaps);
|
|
450
|
+
}
|
|
451
|
+
ref.description = content.content;
|
|
452
|
+
}
|
|
453
|
+
};
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
function convertGroupMapsToNavigations(groupMaps) {
|
|
457
|
+
const nav = [];
|
|
458
|
+
Object.keys(groupMaps).map((groupName) => {
|
|
459
|
+
const current = groupMaps[groupName];
|
|
460
|
+
const pages = [];
|
|
461
|
+
current.pages.forEach((page) => {
|
|
462
|
+
pages.push(page);
|
|
463
|
+
});
|
|
464
|
+
if (Object.keys(current.__groups).length) {
|
|
465
|
+
const subNav = {
|
|
466
|
+
group: groupName,
|
|
467
|
+
pages: convertGroupMapsToNavigations(current.__groups)
|
|
468
|
+
};
|
|
469
|
+
nav.push(subNav);
|
|
470
|
+
} else {
|
|
471
|
+
nav.push({
|
|
472
|
+
group: groupName,
|
|
473
|
+
pages
|
|
474
|
+
});
|
|
475
|
+
}
|
|
476
|
+
});
|
|
477
|
+
return nav;
|
|
478
|
+
}
|
|
479
|
+
var ReferenceCategory = /* @__PURE__ */ ((ReferenceCategory22) => {
|
|
480
|
+
ReferenceCategory22["COMPONENTS"] = "components";
|
|
481
|
+
ReferenceCategory22["HOOKS"] = "hooks";
|
|
482
|
+
ReferenceCategory22["REST"] = "rest";
|
|
483
|
+
ReferenceCategory22["GRAPHQL"] = "graphql";
|
|
484
|
+
ReferenceCategory22["FUNCTIONS"] = "functions";
|
|
485
|
+
return ReferenceCategory22;
|
|
486
|
+
})(ReferenceCategory || {});
|
|
487
|
+
var ReferenceType = /* @__PURE__ */ ((ReferenceType22) => {
|
|
488
|
+
ReferenceType22["COMPONENT"] = "component";
|
|
489
|
+
ReferenceType22["HOOK"] = "hook";
|
|
490
|
+
ReferenceType22["REST_HTTP_GET"] = "rest_get";
|
|
491
|
+
ReferenceType22["REST_HTTP_POST"] = "rest_post";
|
|
492
|
+
ReferenceType22["REST_HTTP_PUT"] = "rest_put";
|
|
493
|
+
ReferenceType22["REST_HTTP_PATCH"] = "rest_patch";
|
|
494
|
+
ReferenceType22["REST_HTTP_DELETE"] = "rest_delete";
|
|
495
|
+
ReferenceType22["GRAPHQL_QUERY"] = "graphql_query";
|
|
496
|
+
ReferenceType22["GRAPHQL_MUTATION"] = "graphql_mutation";
|
|
497
|
+
ReferenceType22["FUNCTION_JS"] = "function_js";
|
|
498
|
+
return ReferenceType22;
|
|
499
|
+
})(ReferenceType || {});
|
|
500
|
+
|
|
501
|
+
// node_modules/@xyd-js/gql/dist/index.js
|
|
502
|
+
import { jsonToGraphQLQuery, VariableType } from "json-to-graphql-query";
|
|
503
|
+
var __create2 = Object.create;
|
|
504
|
+
var __defProp2 = Object.defineProperty;
|
|
505
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
506
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
507
|
+
var __getProtoOf2 = Object.getPrototypeOf;
|
|
508
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
509
|
+
var __commonJS2 = (cb, mod) => function __require3() {
|
|
510
|
+
return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
511
|
+
};
|
|
512
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
513
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
514
|
+
for (let key of __getOwnPropNames2(from))
|
|
515
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
516
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
517
|
+
}
|
|
518
|
+
return to;
|
|
519
|
+
};
|
|
520
|
+
var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(
|
|
521
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
522
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
523
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
524
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
525
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target,
|
|
526
|
+
mod
|
|
527
|
+
));
|
|
528
|
+
var require_ast = __commonJS2({
|
|
529
|
+
"node_modules/graphql/language/ast.js"(exports2) {
|
|
530
|
+
"use strict";
|
|
531
|
+
Object.defineProperty(exports2, "__esModule", {
|
|
532
|
+
value: true
|
|
533
|
+
});
|
|
534
|
+
exports2.Token = exports2.QueryDocumentKeys = exports2.OperationTypeNode = exports2.Location = void 0;
|
|
535
|
+
exports2.isNode = isNode;
|
|
536
|
+
var Location = class {
|
|
537
|
+
/**
|
|
538
|
+
* The character offset at which this Node begins.
|
|
539
|
+
*/
|
|
540
|
+
/**
|
|
541
|
+
* The character offset at which this Node ends.
|
|
542
|
+
*/
|
|
543
|
+
/**
|
|
544
|
+
* The Token at which this Node begins.
|
|
545
|
+
*/
|
|
546
|
+
/**
|
|
547
|
+
* The Token at which this Node ends.
|
|
548
|
+
*/
|
|
549
|
+
/**
|
|
550
|
+
* The Source document the AST represents.
|
|
551
|
+
*/
|
|
552
|
+
constructor(startToken, endToken, source) {
|
|
553
|
+
this.start = startToken.start;
|
|
554
|
+
this.end = endToken.end;
|
|
555
|
+
this.startToken = startToken;
|
|
556
|
+
this.endToken = endToken;
|
|
557
|
+
this.source = source;
|
|
558
|
+
}
|
|
559
|
+
get [Symbol.toStringTag]() {
|
|
560
|
+
return "Location";
|
|
561
|
+
}
|
|
562
|
+
toJSON() {
|
|
563
|
+
return {
|
|
564
|
+
start: this.start,
|
|
565
|
+
end: this.end
|
|
566
|
+
};
|
|
567
|
+
}
|
|
568
|
+
};
|
|
569
|
+
exports2.Location = Location;
|
|
570
|
+
var Token = class {
|
|
571
|
+
/**
|
|
572
|
+
* The kind of Token.
|
|
573
|
+
*/
|
|
574
|
+
/**
|
|
575
|
+
* The character offset at which this Node begins.
|
|
576
|
+
*/
|
|
577
|
+
/**
|
|
578
|
+
* The character offset at which this Node ends.
|
|
579
|
+
*/
|
|
580
|
+
/**
|
|
581
|
+
* The 1-indexed line number on which this Token appears.
|
|
582
|
+
*/
|
|
583
|
+
/**
|
|
584
|
+
* The 1-indexed column number at which this Token begins.
|
|
585
|
+
*/
|
|
586
|
+
/**
|
|
587
|
+
* For non-punctuation tokens, represents the interpreted value of the token.
|
|
588
|
+
*
|
|
589
|
+
* Note: is undefined for punctuation tokens, but typed as string for
|
|
590
|
+
* convenience in the parser.
|
|
591
|
+
*/
|
|
592
|
+
/**
|
|
593
|
+
* Tokens exist as nodes in a double-linked-list amongst all tokens
|
|
594
|
+
* including ignored tokens. <SOF> is always the first node and <EOF>
|
|
595
|
+
* the last.
|
|
596
|
+
*/
|
|
597
|
+
constructor(kind, start2, end, line, column, value) {
|
|
598
|
+
this.kind = kind;
|
|
599
|
+
this.start = start2;
|
|
600
|
+
this.end = end;
|
|
601
|
+
this.line = line;
|
|
602
|
+
this.column = column;
|
|
603
|
+
this.value = value;
|
|
604
|
+
this.prev = null;
|
|
605
|
+
this.next = null;
|
|
606
|
+
}
|
|
607
|
+
get [Symbol.toStringTag]() {
|
|
608
|
+
return "Token";
|
|
609
|
+
}
|
|
610
|
+
toJSON() {
|
|
611
|
+
return {
|
|
612
|
+
kind: this.kind,
|
|
613
|
+
value: this.value,
|
|
614
|
+
line: this.line,
|
|
615
|
+
column: this.column
|
|
616
|
+
};
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
exports2.Token = Token;
|
|
620
|
+
var QueryDocumentKeys = {
|
|
621
|
+
Name: [],
|
|
622
|
+
Document: ["definitions"],
|
|
623
|
+
OperationDefinition: [
|
|
624
|
+
"name",
|
|
625
|
+
"variableDefinitions",
|
|
626
|
+
"directives",
|
|
627
|
+
"selectionSet"
|
|
628
|
+
],
|
|
629
|
+
VariableDefinition: ["variable", "type", "defaultValue", "directives"],
|
|
630
|
+
Variable: ["name"],
|
|
631
|
+
SelectionSet: ["selections"],
|
|
632
|
+
Field: ["alias", "name", "arguments", "directives", "selectionSet"],
|
|
633
|
+
Argument: ["name", "value"],
|
|
634
|
+
FragmentSpread: ["name", "directives"],
|
|
635
|
+
InlineFragment: ["typeCondition", "directives", "selectionSet"],
|
|
636
|
+
FragmentDefinition: [
|
|
637
|
+
"name",
|
|
638
|
+
// Note: fragment variable definitions are deprecated and will removed in v17.0.0
|
|
639
|
+
"variableDefinitions",
|
|
640
|
+
"typeCondition",
|
|
641
|
+
"directives",
|
|
642
|
+
"selectionSet"
|
|
643
|
+
],
|
|
644
|
+
IntValue: [],
|
|
645
|
+
FloatValue: [],
|
|
646
|
+
StringValue: [],
|
|
647
|
+
BooleanValue: [],
|
|
648
|
+
NullValue: [],
|
|
649
|
+
EnumValue: [],
|
|
650
|
+
ListValue: ["values"],
|
|
651
|
+
ObjectValue: ["fields"],
|
|
652
|
+
ObjectField: ["name", "value"],
|
|
653
|
+
Directive: ["name", "arguments"],
|
|
654
|
+
NamedType: ["name"],
|
|
655
|
+
ListType: ["type"],
|
|
656
|
+
NonNullType: ["type"],
|
|
657
|
+
SchemaDefinition: ["description", "directives", "operationTypes"],
|
|
658
|
+
OperationTypeDefinition: ["type"],
|
|
659
|
+
ScalarTypeDefinition: ["description", "name", "directives"],
|
|
660
|
+
ObjectTypeDefinition: [
|
|
661
|
+
"description",
|
|
662
|
+
"name",
|
|
663
|
+
"interfaces",
|
|
664
|
+
"directives",
|
|
665
|
+
"fields"
|
|
666
|
+
],
|
|
667
|
+
FieldDefinition: ["description", "name", "arguments", "type", "directives"],
|
|
668
|
+
InputValueDefinition: [
|
|
669
|
+
"description",
|
|
670
|
+
"name",
|
|
671
|
+
"type",
|
|
672
|
+
"defaultValue",
|
|
673
|
+
"directives"
|
|
674
|
+
],
|
|
675
|
+
InterfaceTypeDefinition: [
|
|
676
|
+
"description",
|
|
677
|
+
"name",
|
|
678
|
+
"interfaces",
|
|
679
|
+
"directives",
|
|
680
|
+
"fields"
|
|
681
|
+
],
|
|
682
|
+
UnionTypeDefinition: ["description", "name", "directives", "types"],
|
|
683
|
+
EnumTypeDefinition: ["description", "name", "directives", "values"],
|
|
684
|
+
EnumValueDefinition: ["description", "name", "directives"],
|
|
685
|
+
InputObjectTypeDefinition: ["description", "name", "directives", "fields"],
|
|
686
|
+
DirectiveDefinition: ["description", "name", "arguments", "locations"],
|
|
687
|
+
SchemaExtension: ["directives", "operationTypes"],
|
|
688
|
+
ScalarTypeExtension: ["name", "directives"],
|
|
689
|
+
ObjectTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
690
|
+
InterfaceTypeExtension: ["name", "interfaces", "directives", "fields"],
|
|
691
|
+
UnionTypeExtension: ["name", "directives", "types"],
|
|
692
|
+
EnumTypeExtension: ["name", "directives", "values"],
|
|
693
|
+
InputObjectTypeExtension: ["name", "directives", "fields"]
|
|
694
|
+
};
|
|
695
|
+
exports2.QueryDocumentKeys = QueryDocumentKeys;
|
|
696
|
+
var kindValues = new Set(Object.keys(QueryDocumentKeys));
|
|
697
|
+
function isNode(maybeNode) {
|
|
698
|
+
const maybeKind = maybeNode === null || maybeNode === void 0 ? void 0 : maybeNode.kind;
|
|
699
|
+
return typeof maybeKind === "string" && kindValues.has(maybeKind);
|
|
700
|
+
}
|
|
701
|
+
var OperationTypeNode2;
|
|
702
|
+
exports2.OperationTypeNode = OperationTypeNode2;
|
|
703
|
+
(function(OperationTypeNode3) {
|
|
704
|
+
OperationTypeNode3["QUERY"] = "query";
|
|
705
|
+
OperationTypeNode3["MUTATION"] = "mutation";
|
|
706
|
+
OperationTypeNode3["SUBSCRIPTION"] = "subscription";
|
|
707
|
+
})(OperationTypeNode2 || (exports2.OperationTypeNode = OperationTypeNode2 = {}));
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
var import_ast = __toESM2(require_ast(), 1);
|
|
711
|
+
function fieldIntoDefinitionProperty(fieldName, field) {
|
|
712
|
+
let properties2;
|
|
713
|
+
if ("ofType" in field.type) {
|
|
714
|
+
switch (field.type.constructor.name) {
|
|
715
|
+
case "GraphQLList": {
|
|
716
|
+
switch (field.type.ofType.constructor.name) {
|
|
717
|
+
case "GraphQLObjectType": {
|
|
718
|
+
const objectType = field.type.ofType;
|
|
719
|
+
properties2 = nestedProperties(objectType);
|
|
720
|
+
break;
|
|
721
|
+
}
|
|
722
|
+
case "GraphQLInputObjectType": {
|
|
723
|
+
const inputObjectType = field.type.ofType;
|
|
724
|
+
properties2 = nestedProperties(inputObjectType);
|
|
725
|
+
break;
|
|
726
|
+
}
|
|
727
|
+
case "GraphQLScalarType": {
|
|
728
|
+
properties2 = definitionPropsFromNestedObj(field) || [];
|
|
729
|
+
break;
|
|
730
|
+
}
|
|
731
|
+
case "GraphQLNonNull": {
|
|
732
|
+
properties2 = definitionPropsFromNestedObj(field) || [];
|
|
733
|
+
break;
|
|
734
|
+
}
|
|
735
|
+
default: {
|
|
736
|
+
console.error("unsupported ofType list", field.type.ofType.constructor.name);
|
|
737
|
+
break;
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
break;
|
|
741
|
+
}
|
|
742
|
+
case "GraphQLNonNull": {
|
|
743
|
+
properties2 = definitionPropsFromNestedObj(field) || [];
|
|
744
|
+
break;
|
|
745
|
+
}
|
|
746
|
+
default: {
|
|
747
|
+
console.error("unsupported ofType", field.type.constructor.name);
|
|
748
|
+
break;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
} else if (field.type.constructor.name === "GraphQLObjectType") {
|
|
752
|
+
const objectType = field.type;
|
|
753
|
+
properties2 = nestedProperties(objectType);
|
|
754
|
+
} else if (field.type.constructor.name === "GraphQLInputObjectType") {
|
|
755
|
+
const objectType = field.type;
|
|
756
|
+
properties2 = nestedProperties(objectType);
|
|
757
|
+
}
|
|
758
|
+
return {
|
|
759
|
+
name: fieldName,
|
|
760
|
+
type: field.type.toJSON(),
|
|
761
|
+
description: field.description || "",
|
|
762
|
+
properties: properties2
|
|
763
|
+
};
|
|
764
|
+
}
|
|
765
|
+
function definitionPropsFromNestedObj(obj) {
|
|
766
|
+
if (!obj) {
|
|
767
|
+
return null;
|
|
768
|
+
}
|
|
769
|
+
if (obj.getFields) {
|
|
770
|
+
return nestedProperties(obj);
|
|
771
|
+
}
|
|
772
|
+
if (obj.ofType) {
|
|
773
|
+
return definitionPropsFromNestedObj(obj.ofType);
|
|
774
|
+
}
|
|
775
|
+
if (obj.type) {
|
|
776
|
+
return definitionPropsFromNestedObj(obj.type);
|
|
777
|
+
}
|
|
778
|
+
return null;
|
|
779
|
+
}
|
|
780
|
+
function deepFieldMap(fieldsMap) {
|
|
781
|
+
const properties2 = [];
|
|
782
|
+
for (const [name, field] of Object.entries(fieldsMap)) {
|
|
783
|
+
const prop = fieldIntoDefinitionProperty(
|
|
784
|
+
name,
|
|
785
|
+
field
|
|
786
|
+
);
|
|
787
|
+
if (prop) {
|
|
788
|
+
properties2.push(prop);
|
|
789
|
+
}
|
|
790
|
+
}
|
|
791
|
+
return properties2;
|
|
792
|
+
}
|
|
793
|
+
function nestedProperties(objectType) {
|
|
794
|
+
var _a;
|
|
795
|
+
const nestedFields = (_a = objectType == null ? void 0 : objectType.getFields) == null ? void 0 : _a.call(objectType);
|
|
796
|
+
return deepFieldMap(nestedFields);
|
|
797
|
+
}
|
|
798
|
+
function argumentsIntoDefinitionProperty(args) {
|
|
799
|
+
const resp = [];
|
|
800
|
+
args.forEach((arg2) => {
|
|
801
|
+
var _a;
|
|
802
|
+
if (arg2.type.constructor.name === "GraphQLInputObjectType") {
|
|
803
|
+
const inputObjectType = arg2.type;
|
|
804
|
+
const inputFields = (_a = inputObjectType.getFields) == null ? void 0 : _a.call(inputObjectType);
|
|
805
|
+
const nestedProps = [];
|
|
806
|
+
const nestedDefinitionProperty = {
|
|
807
|
+
name: arg2.name,
|
|
808
|
+
type: arg2.type.toJSON(),
|
|
809
|
+
description: arg2.description || "",
|
|
810
|
+
properties: nestedProps
|
|
811
|
+
};
|
|
812
|
+
for (const [name, inputField] of Object.entries(inputFields)) {
|
|
813
|
+
const prop = fieldIntoDefinitionProperty(
|
|
814
|
+
name,
|
|
815
|
+
inputField
|
|
816
|
+
);
|
|
817
|
+
if (prop) {
|
|
818
|
+
nestedProps.push(prop);
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
resp.push(nestedDefinitionProperty);
|
|
822
|
+
} else {
|
|
823
|
+
const prop = {
|
|
824
|
+
name: arg2.name,
|
|
825
|
+
type: arg2.type.toJSON(),
|
|
826
|
+
description: arg2.description || "",
|
|
827
|
+
properties: []
|
|
828
|
+
};
|
|
829
|
+
resp.push(prop);
|
|
830
|
+
}
|
|
831
|
+
});
|
|
832
|
+
return resp;
|
|
833
|
+
}
|
|
834
|
+
function simpleGraphqlExample(operationType, operationName, args, returns) {
|
|
835
|
+
let obj = {};
|
|
836
|
+
switch (operationType) {
|
|
837
|
+
case ReferenceType.GRAPHQL_QUERY: {
|
|
838
|
+
const exampleReturnProps = exampleReturns(returns);
|
|
839
|
+
obj = {
|
|
840
|
+
query: {
|
|
841
|
+
__name: operationName,
|
|
842
|
+
[operationName]: exampleReturnProps
|
|
843
|
+
}
|
|
844
|
+
};
|
|
845
|
+
break;
|
|
846
|
+
}
|
|
847
|
+
case ReferenceType.GRAPHQL_MUTATION: {
|
|
848
|
+
const exampleReturnProps = exampleReturns(returns);
|
|
849
|
+
const vars = exampleVariables(args);
|
|
850
|
+
const argumen = exampleArguments(args);
|
|
851
|
+
obj = {
|
|
852
|
+
mutation: {
|
|
853
|
+
__name: operationName,
|
|
854
|
+
__variables: vars,
|
|
855
|
+
[operationName]: {
|
|
856
|
+
...exampleReturnProps,
|
|
857
|
+
__args: argumen
|
|
858
|
+
}
|
|
859
|
+
}
|
|
860
|
+
};
|
|
861
|
+
break;
|
|
862
|
+
}
|
|
863
|
+
}
|
|
864
|
+
return jsonToGraphQLQuery(obj, { pretty: true });
|
|
865
|
+
}
|
|
866
|
+
function exampleReturns(properties2, obj = {}) {
|
|
867
|
+
properties2.forEach((property) => {
|
|
868
|
+
var _a;
|
|
869
|
+
obj[property.name] = true;
|
|
870
|
+
if ((_a = property == null ? void 0 : property.properties) == null ? void 0 : _a.length) {
|
|
871
|
+
obj[property.name] = {};
|
|
872
|
+
exampleReturns(property.properties, obj[property.name]);
|
|
873
|
+
}
|
|
874
|
+
});
|
|
875
|
+
return obj;
|
|
876
|
+
}
|
|
877
|
+
function exampleArguments(properties2, obj = {}) {
|
|
878
|
+
properties2.forEach((property) => {
|
|
879
|
+
obj[property.name] = new VariableType(property.name);
|
|
880
|
+
});
|
|
881
|
+
return obj;
|
|
882
|
+
}
|
|
883
|
+
function exampleVariables(properties2, obj = {}) {
|
|
884
|
+
properties2.forEach((property) => {
|
|
885
|
+
obj[property.name] = property.type;
|
|
886
|
+
});
|
|
887
|
+
return obj;
|
|
888
|
+
}
|
|
889
|
+
function graphqlOperationReferences(operationType, fieldsMap) {
|
|
890
|
+
const references = [];
|
|
891
|
+
for (const [operationName, operationField] of Object.entries(fieldsMap)) {
|
|
892
|
+
const definitions2 = [];
|
|
893
|
+
const args = argumentsIntoDefinitionProperty(operationField.args);
|
|
894
|
+
const returns = fieldIntoDefinitionProperty(operationName, operationField);
|
|
895
|
+
const returnProperties = returns.properties || [];
|
|
896
|
+
definitions2.push({
|
|
897
|
+
title: "Arguments",
|
|
898
|
+
properties: args
|
|
899
|
+
});
|
|
900
|
+
definitions2.push({
|
|
901
|
+
title: "Returns",
|
|
902
|
+
properties: returnProperties
|
|
903
|
+
});
|
|
904
|
+
const exampleQuery = simpleGraphqlExample(
|
|
905
|
+
operationType,
|
|
906
|
+
operationName,
|
|
907
|
+
args,
|
|
908
|
+
returnProperties
|
|
909
|
+
);
|
|
910
|
+
const examples2 = [
|
|
911
|
+
{
|
|
912
|
+
codeblock: {
|
|
913
|
+
tabs: [
|
|
914
|
+
{
|
|
915
|
+
title: "graphql",
|
|
916
|
+
language: "graphql",
|
|
917
|
+
code: exampleQuery
|
|
918
|
+
}
|
|
919
|
+
]
|
|
920
|
+
}
|
|
921
|
+
}
|
|
922
|
+
];
|
|
923
|
+
const exampleGroup = {
|
|
924
|
+
description: "Example request",
|
|
925
|
+
examples: examples2
|
|
926
|
+
};
|
|
927
|
+
let description = operationField.description || "";
|
|
928
|
+
references.push(graphqlReference(
|
|
929
|
+
operationType,
|
|
930
|
+
operationName,
|
|
931
|
+
operationName,
|
|
932
|
+
description,
|
|
933
|
+
[exampleGroup],
|
|
934
|
+
definitions2
|
|
935
|
+
));
|
|
936
|
+
}
|
|
937
|
+
return references;
|
|
938
|
+
}
|
|
939
|
+
function graphqlReference(operationType, title, canonical, description, examples2, definitions2) {
|
|
940
|
+
return {
|
|
941
|
+
title,
|
|
942
|
+
canonical,
|
|
943
|
+
description,
|
|
944
|
+
category: ReferenceCategory.GRAPHQL,
|
|
945
|
+
type: operationType,
|
|
946
|
+
examples: {
|
|
947
|
+
groups: examples2
|
|
948
|
+
},
|
|
949
|
+
definitions: definitions2
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
async function gqlSchemaToReferences(schemaLocation) {
|
|
953
|
+
var _a, _b;
|
|
954
|
+
const loadersList = {
|
|
955
|
+
["GraphQLFileLoader"]: "@graphql-tools/graphql-file-loader"
|
|
956
|
+
};
|
|
957
|
+
const loaders = await getDocumentLoaders(loadersList);
|
|
958
|
+
const schema = await loadSchema(schemaLocation, loaders);
|
|
959
|
+
const references = [];
|
|
960
|
+
const queries = schema.getRootType(import_ast.OperationTypeNode.QUERY);
|
|
961
|
+
const queryFields = (_a = queries == null ? void 0 : queries.getFields) == null ? void 0 : _a.call(queries);
|
|
962
|
+
if (queryFields) {
|
|
963
|
+
references.push(...graphqlOperationReferences(
|
|
964
|
+
ReferenceType.GRAPHQL_QUERY,
|
|
965
|
+
queryFields
|
|
966
|
+
));
|
|
967
|
+
}
|
|
968
|
+
const mutations = schema.getRootType(import_ast.OperationTypeNode.MUTATION);
|
|
969
|
+
const mutationFields = (_b = mutations == null ? void 0 : mutations.getFields) == null ? void 0 : _b.call(mutations);
|
|
970
|
+
if (mutationFields) {
|
|
971
|
+
references.push(...graphqlOperationReferences(
|
|
972
|
+
ReferenceType.GRAPHQL_MUTATION,
|
|
973
|
+
mutationFields
|
|
974
|
+
));
|
|
975
|
+
}
|
|
976
|
+
return references;
|
|
977
|
+
}
|
|
978
|
+
|
|
979
|
+
// node_modules/@xyd-js/plugin-zero/dist/index.js
|
|
980
|
+
import path32 from "path";
|
|
981
|
+
import { promises as fs32 } from "fs";
|
|
982
|
+
import { route as route2 } from "@react-router/dev/routes";
|
|
983
|
+
|
|
984
|
+
// node_modules/@xyd-js/uniform/dist/markdown.js
|
|
985
|
+
import { remark } from "remark";
|
|
986
|
+
import remarkStringify from "remark-stringify";
|
|
987
|
+
import { u } from "unist-builder";
|
|
988
|
+
var START_DEPTH_LEVEL = 2;
|
|
989
|
+
function root(ast) {
|
|
990
|
+
return u("root", ast);
|
|
991
|
+
}
|
|
992
|
+
function heading(title, canonical, description, refCategory, refType, refContext) {
|
|
993
|
+
const uTitle = u(
|
|
994
|
+
"heading",
|
|
995
|
+
{ depth: START_DEPTH_LEVEL },
|
|
996
|
+
[u("text", `!!references ${title}`)]
|
|
997
|
+
);
|
|
998
|
+
const uCanonical = u(
|
|
999
|
+
"heading",
|
|
1000
|
+
{ depth: uTitle.depth + 1 },
|
|
1001
|
+
[u("text", `!canonical ${canonical}`)]
|
|
1002
|
+
);
|
|
1003
|
+
let uDesc = [
|
|
1004
|
+
u(
|
|
1005
|
+
"heading",
|
|
1006
|
+
{ depth: START_DEPTH_LEVEL },
|
|
1007
|
+
[u("text", `!description`)]
|
|
1008
|
+
),
|
|
1009
|
+
u("paragraph", [u("text", description)])
|
|
1010
|
+
];
|
|
1011
|
+
let uRefCategory;
|
|
1012
|
+
if (refCategory) {
|
|
1013
|
+
uRefCategory = u(
|
|
1014
|
+
"heading",
|
|
1015
|
+
{ depth: uTitle.depth + 1 },
|
|
1016
|
+
[u("text", `!category ${refCategory}`)]
|
|
1017
|
+
);
|
|
1018
|
+
}
|
|
1019
|
+
let uRefType;
|
|
1020
|
+
if (refType) {
|
|
1021
|
+
uRefType = u(
|
|
1022
|
+
"heading",
|
|
1023
|
+
{ depth: uTitle.depth + 1 },
|
|
1024
|
+
[u("text", `!type ${refType}`)]
|
|
1025
|
+
);
|
|
1026
|
+
}
|
|
1027
|
+
let uContext = [];
|
|
1028
|
+
if (refContext && Object.keys(refContext)) {
|
|
1029
|
+
uContext.push(u(
|
|
1030
|
+
"heading",
|
|
1031
|
+
{ depth: uTitle.depth + 1 },
|
|
1032
|
+
[
|
|
1033
|
+
u("text", `!context`)
|
|
1034
|
+
]
|
|
1035
|
+
));
|
|
1036
|
+
for (const [key, value] of Object.entries(refContext)) {
|
|
1037
|
+
uContext.push(
|
|
1038
|
+
u(
|
|
1039
|
+
"heading",
|
|
1040
|
+
{ depth: uContext[0].depth + 1 },
|
|
1041
|
+
[u("text", `!${key} ${value}`)]
|
|
1042
|
+
)
|
|
1043
|
+
);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
return {
|
|
1047
|
+
title: uTitle,
|
|
1048
|
+
canonical: uCanonical,
|
|
1049
|
+
description: uDesc,
|
|
1050
|
+
category: uRefCategory || null,
|
|
1051
|
+
type: uRefType || null,
|
|
1052
|
+
context: uContext || null
|
|
1053
|
+
};
|
|
1054
|
+
}
|
|
1055
|
+
function examples(examples2) {
|
|
1056
|
+
const md = [];
|
|
1057
|
+
const uExampleRoot = u(
|
|
1058
|
+
"heading",
|
|
1059
|
+
{ depth: START_DEPTH_LEVEL + 1 },
|
|
1060
|
+
[u("text", `!examples`)]
|
|
1061
|
+
);
|
|
1062
|
+
md.push(uExampleRoot);
|
|
1063
|
+
examples2.groups.forEach((group) => {
|
|
1064
|
+
const uExampleGroups = u(
|
|
1065
|
+
"heading",
|
|
1066
|
+
{ depth: uExampleRoot.depth + 1 },
|
|
1067
|
+
[u("text", `!!groups`)]
|
|
1068
|
+
);
|
|
1069
|
+
md.push(uExampleGroups);
|
|
1070
|
+
const uGroupDescription = u(
|
|
1071
|
+
"heading",
|
|
1072
|
+
{ depth: uExampleGroups.depth + 1 },
|
|
1073
|
+
[u("text", `!description ${group.description}`)]
|
|
1074
|
+
);
|
|
1075
|
+
md.push(uGroupDescription);
|
|
1076
|
+
group.examples.forEach((example) => {
|
|
1077
|
+
const uExamples = u(
|
|
1078
|
+
"heading",
|
|
1079
|
+
{ depth: uExampleGroups.depth + 1 },
|
|
1080
|
+
[u("text", `!!examples`)]
|
|
1081
|
+
);
|
|
1082
|
+
md.push(uExamples);
|
|
1083
|
+
const codeBlock = u(
|
|
1084
|
+
"heading",
|
|
1085
|
+
{ depth: uExamples.depth + 1 },
|
|
1086
|
+
[u("text", `!codeblock`)]
|
|
1087
|
+
);
|
|
1088
|
+
md.push(codeBlock);
|
|
1089
|
+
const codeBlockTitle = u(
|
|
1090
|
+
"heading",
|
|
1091
|
+
{ depth: codeBlock.depth + 1 },
|
|
1092
|
+
[u("text", `!title ${example.codeblock.title}`)]
|
|
1093
|
+
);
|
|
1094
|
+
md.push(codeBlockTitle);
|
|
1095
|
+
const tabs = u(
|
|
1096
|
+
"heading",
|
|
1097
|
+
{ depth: codeBlock.depth + 1 },
|
|
1098
|
+
[u("text", `!!tabs`)]
|
|
1099
|
+
);
|
|
1100
|
+
md.push(tabs);
|
|
1101
|
+
example.codeblock.tabs.forEach((tab) => {
|
|
1102
|
+
const code = u("code", {
|
|
1103
|
+
lang: tab.language,
|
|
1104
|
+
meta: `!code ${tab.title}`
|
|
1105
|
+
}, tab.code);
|
|
1106
|
+
md.push(code);
|
|
1107
|
+
});
|
|
1108
|
+
});
|
|
1109
|
+
});
|
|
1110
|
+
return md;
|
|
1111
|
+
}
|
|
1112
|
+
function definitions(definitions2) {
|
|
1113
|
+
const md = [];
|
|
1114
|
+
definitions2.forEach((definition) => {
|
|
1115
|
+
const uDefinition = u(
|
|
1116
|
+
"heading",
|
|
1117
|
+
{ depth: START_DEPTH_LEVEL + 1 },
|
|
1118
|
+
[u("text", `!!definitions`)]
|
|
1119
|
+
);
|
|
1120
|
+
md.push(uDefinition);
|
|
1121
|
+
md.push(u(
|
|
1122
|
+
"heading",
|
|
1123
|
+
{ depth: uDefinition.depth + 1 },
|
|
1124
|
+
[u("text", `!title ${definition.title}`)]
|
|
1125
|
+
));
|
|
1126
|
+
definition.properties.forEach((prop) => {
|
|
1127
|
+
properties(
|
|
1128
|
+
uDefinition.depth + 1,
|
|
1129
|
+
{
|
|
1130
|
+
name: prop.name,
|
|
1131
|
+
type: prop.type,
|
|
1132
|
+
description: prop.description,
|
|
1133
|
+
properties: prop.properties
|
|
1134
|
+
// TODO: fix ts
|
|
1135
|
+
},
|
|
1136
|
+
md
|
|
1137
|
+
);
|
|
1138
|
+
});
|
|
1139
|
+
});
|
|
1140
|
+
return md;
|
|
1141
|
+
}
|
|
1142
|
+
function properties(depth, props, output = []) {
|
|
1143
|
+
const paramName = props.name;
|
|
1144
|
+
const propTitle = `!!properties ${paramName}`;
|
|
1145
|
+
const uPropTitle = u("heading", { depth }, [u("text", propTitle)]);
|
|
1146
|
+
const uPropName = u("paragraph", { depth }, [u("text", `!name ${paramName}`)]);
|
|
1147
|
+
const uPropType = u("paragraph", { depth }, [u("text", `!type ${props.type}`)]);
|
|
1148
|
+
const uPropDesc = u("paragraph", { depth }, [u("text", props.description || "")]);
|
|
1149
|
+
output.push(
|
|
1150
|
+
uPropTitle,
|
|
1151
|
+
uPropName,
|
|
1152
|
+
uPropType,
|
|
1153
|
+
uPropDesc
|
|
1154
|
+
);
|
|
1155
|
+
if (props.properties) {
|
|
1156
|
+
const deepDepth = depth + 1;
|
|
1157
|
+
for (const prop of props.properties) {
|
|
1158
|
+
properties(deepDepth, prop, output);
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
function compile(ast) {
|
|
1163
|
+
return remark().use(remarkStringify, {
|
|
1164
|
+
bullet: "-",
|
|
1165
|
+
fences: true,
|
|
1166
|
+
listItemIndent: "one",
|
|
1167
|
+
incrementListMarker: false,
|
|
1168
|
+
handlers: {
|
|
1169
|
+
heading(node) {
|
|
1170
|
+
return `${"#".repeat(node.depth)} ${node.children[0].value}`;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
}).stringify(root(ast));
|
|
1174
|
+
}
|
|
1175
|
+
function referenceAST(ref) {
|
|
1176
|
+
var _a, _b;
|
|
1177
|
+
const md = [];
|
|
1178
|
+
const mdHeading = heading(
|
|
1179
|
+
ref.title,
|
|
1180
|
+
ref.canonical,
|
|
1181
|
+
ref.description,
|
|
1182
|
+
ref.category,
|
|
1183
|
+
ref.type,
|
|
1184
|
+
ref.context
|
|
1185
|
+
);
|
|
1186
|
+
if ((_a = mdHeading == null ? void 0 : mdHeading.description) == null ? void 0 : _a.length) {
|
|
1187
|
+
md.push(...mdHeading.description);
|
|
1188
|
+
}
|
|
1189
|
+
md.push(
|
|
1190
|
+
mdHeading.title,
|
|
1191
|
+
mdHeading.canonical
|
|
1192
|
+
);
|
|
1193
|
+
if (mdHeading.category) {
|
|
1194
|
+
md.push(mdHeading.category);
|
|
1195
|
+
}
|
|
1196
|
+
if (mdHeading.type) {
|
|
1197
|
+
md.push(mdHeading.type);
|
|
1198
|
+
}
|
|
1199
|
+
if ((_b = mdHeading == null ? void 0 : mdHeading.context) == null ? void 0 : _b.length) {
|
|
1200
|
+
md.push(...mdHeading.context);
|
|
1201
|
+
}
|
|
1202
|
+
const mdExamples = examples(ref.examples);
|
|
1203
|
+
const mdDefinitions = definitions(ref.definitions);
|
|
1204
|
+
md.push(...mdExamples, ...mdDefinitions);
|
|
1205
|
+
return md;
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
// node_modules/@xyd-js/openapi/dist/index.js
|
|
1209
|
+
import Oas from "oas";
|
|
1210
|
+
|
|
1211
|
+
// node_modules/@xyd-js/openapi/node_modules/@xyd-js/uniform/dist/index.js
|
|
1212
|
+
import matter2 from "gray-matter";
|
|
1213
|
+
var ReferenceCategory2 = /* @__PURE__ */ ((ReferenceCategory22) => {
|
|
1214
|
+
ReferenceCategory22["COMPONENTS"] = "components";
|
|
1215
|
+
ReferenceCategory22["HOOKS"] = "hooks";
|
|
1216
|
+
ReferenceCategory22["REST"] = "rest";
|
|
1217
|
+
ReferenceCategory22["GRAPHQL"] = "graphql";
|
|
1218
|
+
ReferenceCategory22["FUNCTIONS"] = "functions";
|
|
1219
|
+
return ReferenceCategory22;
|
|
1220
|
+
})(ReferenceCategory2 || {});
|
|
1221
|
+
var ReferenceType2 = /* @__PURE__ */ ((ReferenceType22) => {
|
|
1222
|
+
ReferenceType22["COMPONENT"] = "component";
|
|
1223
|
+
ReferenceType22["HOOK"] = "hook";
|
|
1224
|
+
ReferenceType22["REST_HTTP_GET"] = "rest_get";
|
|
1225
|
+
ReferenceType22["REST_HTTP_POST"] = "rest_post";
|
|
1226
|
+
ReferenceType22["REST_HTTP_PUT"] = "rest_put";
|
|
1227
|
+
ReferenceType22["REST_HTTP_PATCH"] = "rest_patch";
|
|
1228
|
+
ReferenceType22["REST_HTTP_DELETE"] = "rest_delete";
|
|
1229
|
+
ReferenceType22["GRAPHQL_QUERY"] = "graphql_query";
|
|
1230
|
+
ReferenceType22["GRAPHQL_MUTATION"] = "graphql_mutation";
|
|
1231
|
+
ReferenceType22["FUNCTION_JS"] = "function_js";
|
|
1232
|
+
return ReferenceType22;
|
|
1233
|
+
})(ReferenceType2 || {});
|
|
1234
|
+
|
|
1235
|
+
// node_modules/@xyd-js/openapi/dist/index.js
|
|
1236
|
+
import path2 from "path";
|
|
1237
|
+
import fs from "fs";
|
|
1238
|
+
import yaml2 from "js-yaml";
|
|
1239
|
+
import $refParser from "json-schema-ref-parser";
|
|
1240
|
+
import oasToSnippet from "@readme/oas-to-snippet";
|
|
1241
|
+
import OpenAPISampler from "openapi-sampler";
|
|
1242
|
+
var SUPPORTED_HTTP_METHODS = [
|
|
1243
|
+
"get",
|
|
1244
|
+
"put",
|
|
1245
|
+
"patch",
|
|
1246
|
+
"post",
|
|
1247
|
+
"delete"
|
|
1248
|
+
// 'options',
|
|
1249
|
+
// 'head',
|
|
1250
|
+
// 'trace'
|
|
1251
|
+
];
|
|
1252
|
+
function oapParametersToDefinitionProperties(parameters) {
|
|
1253
|
+
const parameterIn = {};
|
|
1254
|
+
parameters.forEach((param) => {
|
|
1255
|
+
if (!parameterIn[param.in]) {
|
|
1256
|
+
parameterIn[param.in] = [];
|
|
1257
|
+
}
|
|
1258
|
+
const schema = param.schema;
|
|
1259
|
+
const property = {
|
|
1260
|
+
name: param.name,
|
|
1261
|
+
type: schema.type || "",
|
|
1262
|
+
description: param.description || ""
|
|
1263
|
+
};
|
|
1264
|
+
parameterIn[param.in].push(property);
|
|
1265
|
+
});
|
|
1266
|
+
return parameterIn;
|
|
1267
|
+
}
|
|
1268
|
+
function schemaObjectToDefinitionProperties(v) {
|
|
1269
|
+
return Object.entries(v.properties || {}).map(([name, prop]) => {
|
|
1270
|
+
let objProp = prop;
|
|
1271
|
+
let merged = [];
|
|
1272
|
+
if (objProp.allOf) {
|
|
1273
|
+
merged = objProp.allOf.reduce((acc, of) => {
|
|
1274
|
+
return [
|
|
1275
|
+
...acc,
|
|
1276
|
+
...schemaObjectToDefinitionProperties(of)
|
|
1277
|
+
];
|
|
1278
|
+
}, []);
|
|
1279
|
+
}
|
|
1280
|
+
return {
|
|
1281
|
+
name,
|
|
1282
|
+
type: objProp.type || "",
|
|
1283
|
+
description: objProp.description || "",
|
|
1284
|
+
properties: (merged == null ? void 0 : merged.length) ? merged : objProp.properties ? schemaObjectToDefinitionProperties(objProp) : []
|
|
1285
|
+
};
|
|
1286
|
+
});
|
|
1287
|
+
}
|
|
1288
|
+
function oapRequestBodyToDefinitionProperties(reqBody) {
|
|
1289
|
+
const schema = reqBody.content["application/json"].schema;
|
|
1290
|
+
let schemaObject;
|
|
1291
|
+
if (schema.allOf) {
|
|
1292
|
+
return schema.allOf.reduce((acc, of) => {
|
|
1293
|
+
const fakeBody = {
|
|
1294
|
+
content: {
|
|
1295
|
+
"application/json": {
|
|
1296
|
+
schema: of
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
};
|
|
1300
|
+
return [
|
|
1301
|
+
...acc,
|
|
1302
|
+
...oapRequestBodyToDefinitionProperties(fakeBody) || []
|
|
1303
|
+
];
|
|
1304
|
+
}, []);
|
|
1305
|
+
}
|
|
1306
|
+
switch (schema.type) {
|
|
1307
|
+
case "object": {
|
|
1308
|
+
schemaObject = schema;
|
|
1309
|
+
break;
|
|
1310
|
+
}
|
|
1311
|
+
case "array": {
|
|
1312
|
+
const arrSchema = schema;
|
|
1313
|
+
const items = arrSchema.items;
|
|
1314
|
+
schemaObject = items;
|
|
1315
|
+
break;
|
|
1316
|
+
}
|
|
1317
|
+
default:
|
|
1318
|
+
break;
|
|
1319
|
+
}
|
|
1320
|
+
if (!schemaObject) {
|
|
1321
|
+
return null;
|
|
1322
|
+
}
|
|
1323
|
+
return schemaObjectToDefinitionProperties(schemaObject);
|
|
1324
|
+
}
|
|
1325
|
+
function oapResponseToDefinitionProperties(responses) {
|
|
1326
|
+
var _a, _b, _c, _d;
|
|
1327
|
+
let schemaObject;
|
|
1328
|
+
if (responses["default"]) {
|
|
1329
|
+
const w = responses["default"];
|
|
1330
|
+
schemaObject = (_b = (_a = w == null ? void 0 : w.content) == null ? void 0 : _a["application/json"]) == null ? void 0 : _b.schema;
|
|
1331
|
+
} else if (responses["200"]) {
|
|
1332
|
+
const w = responses["200"];
|
|
1333
|
+
schemaObject = (_d = (_c = w == null ? void 0 : w.content) == null ? void 0 : _c["application/json"]) == null ? void 0 : _d.schema;
|
|
1334
|
+
}
|
|
1335
|
+
if (!schemaObject) {
|
|
1336
|
+
return null;
|
|
1337
|
+
}
|
|
1338
|
+
switch (schemaObject.type) {
|
|
1339
|
+
case "array":
|
|
1340
|
+
const arrSchema = schemaObject;
|
|
1341
|
+
const items = arrSchema.items;
|
|
1342
|
+
schemaObject = items;
|
|
1343
|
+
break;
|
|
1344
|
+
default:
|
|
1345
|
+
break;
|
|
1346
|
+
}
|
|
1347
|
+
return schemaObjectToDefinitionProperties(schemaObject);
|
|
1348
|
+
}
|
|
1349
|
+
function toPascalCase(str2) {
|
|
1350
|
+
return str2.split(/[\s_-]+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("");
|
|
1351
|
+
}
|
|
1352
|
+
function readOpenApiSpec(filePath) {
|
|
1353
|
+
const ext = path2.extname(filePath).toLowerCase();
|
|
1354
|
+
const content = fs.readFileSync(filePath, "utf-8");
|
|
1355
|
+
if (ext === ".yaml" || ext === ".yml") {
|
|
1356
|
+
return yaml2.load(content);
|
|
1357
|
+
} else if (ext === ".json") {
|
|
1358
|
+
return JSON.parse(content);
|
|
1359
|
+
} else {
|
|
1360
|
+
throw new Error("Unsupported file format. Use JSON or YAML.");
|
|
1361
|
+
}
|
|
1362
|
+
}
|
|
1363
|
+
async function deferencedOpenAPI(openApiPath) {
|
|
1364
|
+
const openApiSpec = readOpenApiSpec(openApiPath);
|
|
1365
|
+
await $refParser.dereference(openApiSpec);
|
|
1366
|
+
return openApiSpec;
|
|
1367
|
+
}
|
|
1368
|
+
function httpMethodToUniformMethod(method) {
|
|
1369
|
+
switch (method) {
|
|
1370
|
+
case "get":
|
|
1371
|
+
return ReferenceType2.REST_HTTP_GET;
|
|
1372
|
+
case "put":
|
|
1373
|
+
return ReferenceType2.REST_HTTP_PUT;
|
|
1374
|
+
case "patch":
|
|
1375
|
+
return ReferenceType2.REST_HTTP_PATCH;
|
|
1376
|
+
case "post":
|
|
1377
|
+
return ReferenceType2.REST_HTTP_POST;
|
|
1378
|
+
case "delete":
|
|
1379
|
+
return ReferenceType2.REST_HTTP_DELETE;
|
|
1380
|
+
// case 'options':
|
|
1381
|
+
// return ReferenceType.REST_HTTP_OPTIONS
|
|
1382
|
+
// case 'head':
|
|
1383
|
+
// return ReferenceType.REST_HTTP_HEAD
|
|
1384
|
+
// case 'trace':
|
|
1385
|
+
// return ReferenceType.REST_HTTP_TRACE
|
|
1386
|
+
default:
|
|
1387
|
+
return null;
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
function oapPathToReference(httpMethod, path24, oapPath) {
|
|
1391
|
+
const mType = httpMethodToUniformMethod(httpMethod);
|
|
1392
|
+
if (!mType) {
|
|
1393
|
+
console.error(`Unsupported method: ${httpMethod}`);
|
|
1394
|
+
return null;
|
|
1395
|
+
}
|
|
1396
|
+
const definitions2 = [];
|
|
1397
|
+
const exampleGroups = [];
|
|
1398
|
+
const oapMethod = oapPath == null ? void 0 : oapPath[httpMethod];
|
|
1399
|
+
if (!oapMethod) {
|
|
1400
|
+
return null;
|
|
1401
|
+
}
|
|
1402
|
+
const endpointRef = {
|
|
1403
|
+
title: (oapMethod == null ? void 0 : oapMethod.summary) || "",
|
|
1404
|
+
canonical: toPascalCase((oapMethod == null ? void 0 : oapMethod.summary) || ""),
|
|
1405
|
+
description: (oapMethod == null ? void 0 : oapMethod.description) || "",
|
|
1406
|
+
category: ReferenceCategory2.REST,
|
|
1407
|
+
type: mType,
|
|
1408
|
+
context: {
|
|
1409
|
+
method: httpMethod,
|
|
1410
|
+
path: path24
|
|
1411
|
+
},
|
|
1412
|
+
examples: {
|
|
1413
|
+
groups: exampleGroups
|
|
1414
|
+
},
|
|
1415
|
+
definitions: definitions2
|
|
1416
|
+
};
|
|
1417
|
+
if (oapMethod.parameters) {
|
|
1418
|
+
const parameters = oapMethod.parameters;
|
|
1419
|
+
const paramtersMap = oapParametersToDefinitionProperties(parameters);
|
|
1420
|
+
Object.entries(paramtersMap).forEach(([key, definitionProperties]) => {
|
|
1421
|
+
let title;
|
|
1422
|
+
switch (key) {
|
|
1423
|
+
case "path":
|
|
1424
|
+
title = "Paths";
|
|
1425
|
+
break;
|
|
1426
|
+
case "query":
|
|
1427
|
+
title = "Query";
|
|
1428
|
+
break;
|
|
1429
|
+
case "header":
|
|
1430
|
+
title = "Header";
|
|
1431
|
+
break;
|
|
1432
|
+
default:
|
|
1433
|
+
console.error(`Unsupported parameter type: ${key} for ${httpMethod} ${path24}`);
|
|
1434
|
+
return;
|
|
1435
|
+
}
|
|
1436
|
+
definitions2.push({
|
|
1437
|
+
title,
|
|
1438
|
+
properties: definitionProperties
|
|
1439
|
+
});
|
|
1440
|
+
});
|
|
1441
|
+
}
|
|
1442
|
+
if (oapMethod.requestBody) {
|
|
1443
|
+
const reqBody = oapMethod.requestBody;
|
|
1444
|
+
definitions2.push({
|
|
1445
|
+
title: "Request body",
|
|
1446
|
+
properties: oapRequestBodyToDefinitionProperties(reqBody) || []
|
|
1447
|
+
});
|
|
1448
|
+
}
|
|
1449
|
+
if (oapMethod.responses) {
|
|
1450
|
+
const responses = oapMethod.responses;
|
|
1451
|
+
definitions2.push({
|
|
1452
|
+
title: "Response",
|
|
1453
|
+
properties: oapResponseToDefinitionProperties(responses) || []
|
|
1454
|
+
});
|
|
1455
|
+
}
|
|
1456
|
+
return endpointRef;
|
|
1457
|
+
}
|
|
1458
|
+
function oapExamples(oas, operation) {
|
|
1459
|
+
const exampleGroups = [];
|
|
1460
|
+
if (operation.schema.requestBody) {
|
|
1461
|
+
const body = operation.schema.requestBody;
|
|
1462
|
+
const schema = fixAllOfBug(
|
|
1463
|
+
body.content["application/json"].schema
|
|
1464
|
+
);
|
|
1465
|
+
if (!schema) {
|
|
1466
|
+
return exampleGroups;
|
|
1467
|
+
}
|
|
1468
|
+
const fakeData = OpenAPISampler.sample(schema);
|
|
1469
|
+
const { code } = oasToSnippet(oas, operation, {
|
|
1470
|
+
body: fakeData
|
|
1471
|
+
}, null, "shell");
|
|
1472
|
+
const examples2 = [];
|
|
1473
|
+
examples2.push({
|
|
1474
|
+
codeblock: {
|
|
1475
|
+
tabs: [{
|
|
1476
|
+
title: "curl",
|
|
1477
|
+
language: "curl",
|
|
1478
|
+
code: code || ""
|
|
1479
|
+
}]
|
|
1480
|
+
}
|
|
1481
|
+
});
|
|
1482
|
+
exampleGroups.push({
|
|
1483
|
+
description: "Example request",
|
|
1484
|
+
examples: examples2
|
|
1485
|
+
});
|
|
1486
|
+
}
|
|
1487
|
+
if (operation.schema.responses) {
|
|
1488
|
+
const responses = operation.schema.responses;
|
|
1489
|
+
const examples2 = [];
|
|
1490
|
+
Object.entries(responses).forEach(([status, r]) => {
|
|
1491
|
+
var _a;
|
|
1492
|
+
const response = r;
|
|
1493
|
+
const schema = (_a = response == null ? void 0 : response.content) == null ? void 0 : _a["application/json"].schema;
|
|
1494
|
+
if (!schema) {
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
const fakeData = OpenAPISampler.sample(schema);
|
|
1498
|
+
examples2.push({
|
|
1499
|
+
codeblock: {
|
|
1500
|
+
title: status,
|
|
1501
|
+
tabs: [{
|
|
1502
|
+
title: "json",
|
|
1503
|
+
language: "json",
|
|
1504
|
+
code: JSON.stringify(fakeData, null, 2) || ""
|
|
1505
|
+
}]
|
|
1506
|
+
}
|
|
1507
|
+
});
|
|
1508
|
+
});
|
|
1509
|
+
exampleGroups.push({
|
|
1510
|
+
description: "Response",
|
|
1511
|
+
examples: examples2
|
|
1512
|
+
});
|
|
1513
|
+
}
|
|
1514
|
+
return exampleGroups;
|
|
1515
|
+
}
|
|
1516
|
+
function fixAllOfBug(schema) {
|
|
1517
|
+
const modifiedSchema = { ...schema };
|
|
1518
|
+
if (schema.allOf) {
|
|
1519
|
+
schema.allOf.forEach((prop, i) => {
|
|
1520
|
+
var _a;
|
|
1521
|
+
const propObj = prop;
|
|
1522
|
+
if ("properties" in propObj && !propObj["properties"]) {
|
|
1523
|
+
(_a = modifiedSchema.allOf) == null ? true : delete _a[i];
|
|
1524
|
+
}
|
|
1525
|
+
});
|
|
1526
|
+
}
|
|
1527
|
+
return modifiedSchema;
|
|
1528
|
+
}
|
|
1529
|
+
function oapSchemaToReferences(schema) {
|
|
1530
|
+
const references = [];
|
|
1531
|
+
const oas = new Oas(schema);
|
|
1532
|
+
Object.entries(schema.paths).forEach(([path24, oapPath]) => {
|
|
1533
|
+
let type;
|
|
1534
|
+
SUPPORTED_HTTP_METHODS.forEach((eachMethod) => {
|
|
1535
|
+
const httpMethod = eachMethod.toLowerCase();
|
|
1536
|
+
switch (httpMethod) {
|
|
1537
|
+
case "get":
|
|
1538
|
+
break;
|
|
1539
|
+
case "put":
|
|
1540
|
+
break;
|
|
1541
|
+
case "post":
|
|
1542
|
+
break;
|
|
1543
|
+
case "delete":
|
|
1544
|
+
break;
|
|
1545
|
+
default:
|
|
1546
|
+
console.error(`Unsupported method: ${httpMethod}`);
|
|
1547
|
+
return;
|
|
1548
|
+
}
|
|
1549
|
+
const reference = oapPathToReference(
|
|
1550
|
+
httpMethod,
|
|
1551
|
+
path24,
|
|
1552
|
+
oapPath
|
|
1553
|
+
);
|
|
1554
|
+
if (reference) {
|
|
1555
|
+
const operation = oas.operation(path24, httpMethod);
|
|
1556
|
+
reference.examples.groups = oapExamples(oas, operation);
|
|
1557
|
+
references.push(reference);
|
|
1558
|
+
}
|
|
1559
|
+
});
|
|
1560
|
+
});
|
|
1561
|
+
return references;
|
|
1562
|
+
}
|
|
1563
|
+
|
|
1564
|
+
// node_modules/@xyd-js/plugin-zero/dist/index.js
|
|
1565
|
+
var __create3 = Object.create;
|
|
1566
|
+
var __defProp3 = Object.defineProperty;
|
|
1567
|
+
var __getOwnPropDesc3 = Object.getOwnPropertyDescriptor;
|
|
1568
|
+
var __getOwnPropNames3 = Object.getOwnPropertyNames;
|
|
1569
|
+
var __getProtoOf3 = Object.getPrototypeOf;
|
|
1570
|
+
var __hasOwnProp3 = Object.prototype.hasOwnProperty;
|
|
1571
|
+
var __require2 = /* @__PURE__ */ ((x) => typeof __require !== "undefined" ? __require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
1572
|
+
get: (a, b) => (typeof __require !== "undefined" ? __require : a)[b]
|
|
1573
|
+
}) : x)(function(x) {
|
|
1574
|
+
if (typeof __require !== "undefined") return __require.apply(this, arguments);
|
|
1575
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
1576
|
+
});
|
|
1577
|
+
var __commonJS3 = (cb, mod) => function __require22() {
|
|
1578
|
+
return mod || (0, cb[__getOwnPropNames3(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
1579
|
+
};
|
|
1580
|
+
var __copyProps3 = (to, from, except, desc) => {
|
|
1581
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
1582
|
+
for (let key of __getOwnPropNames3(from))
|
|
1583
|
+
if (!__hasOwnProp3.call(to, key) && key !== except)
|
|
1584
|
+
__defProp3(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc3(from, key)) || desc.enumerable });
|
|
1585
|
+
}
|
|
1586
|
+
return to;
|
|
1587
|
+
};
|
|
1588
|
+
var __toESM3 = (mod, isNodeMode, target) => (target = mod != null ? __create3(__getProtoOf3(mod)) : {}, __copyProps3(
|
|
1589
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
1590
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
1591
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
1592
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
1593
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp3(target, "default", { value: mod, enumerable: true }) : target,
|
|
1594
|
+
mod
|
|
1595
|
+
));
|
|
1596
|
+
var require_kind_of = __commonJS3({
|
|
1597
|
+
"../../node_modules/.pnpm/kind-of@6.0.3/node_modules/kind-of/index.js"(exports2, module2) {
|
|
12
1598
|
var toString = Object.prototype.toString;
|
|
13
1599
|
module2.exports = function kindOf(val) {
|
|
14
1600
|
if (val === void 0) return "undefined";
|
|
@@ -32,6 +1618,7 @@ var require_kind_of = __commonJS({
|
|
|
32
1618
|
return "symbol";
|
|
33
1619
|
case "Promise":
|
|
34
1620
|
return "promise";
|
|
1621
|
+
// Set, Map, WeakSet, WeakMap
|
|
35
1622
|
case "WeakMap":
|
|
36
1623
|
return "weakmap";
|
|
37
1624
|
case "WeakSet":
|
|
@@ -40,16 +1627,19 @@ var require_kind_of = __commonJS({
|
|
|
40
1627
|
return "map";
|
|
41
1628
|
case "Set":
|
|
42
1629
|
return "set";
|
|
1630
|
+
// 8-bit typed arrays
|
|
43
1631
|
case "Int8Array":
|
|
44
1632
|
return "int8array";
|
|
45
1633
|
case "Uint8Array":
|
|
46
1634
|
return "uint8array";
|
|
47
1635
|
case "Uint8ClampedArray":
|
|
48
1636
|
return "uint8clampedarray";
|
|
1637
|
+
// 16-bit typed arrays
|
|
49
1638
|
case "Int16Array":
|
|
50
1639
|
return "int16array";
|
|
51
1640
|
case "Uint16Array":
|
|
52
1641
|
return "uint16array";
|
|
1642
|
+
// 32-bit typed arrays
|
|
53
1643
|
case "Int32Array":
|
|
54
1644
|
return "int32array";
|
|
55
1645
|
case "Uint32Array":
|
|
@@ -66,6 +1656,7 @@ var require_kind_of = __commonJS({
|
|
|
66
1656
|
switch (type) {
|
|
67
1657
|
case "[object Object]":
|
|
68
1658
|
return "object";
|
|
1659
|
+
// iterators
|
|
69
1660
|
case "[object Map Iterator]":
|
|
70
1661
|
return "mapiterator";
|
|
71
1662
|
case "[object Set Iterator]":
|
|
@@ -121,158 +1712,40 @@ var require_kind_of = __commonJS({
|
|
|
121
1712
|
}
|
|
122
1713
|
}
|
|
123
1714
|
});
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
var require_is_extendable = __commonJS({
|
|
127
|
-
"../node_modules/.pnpm/is-extendable@0.1.1/node_modules/is-extendable/index.js"(exports2, module2) {
|
|
1715
|
+
var require_engine = __commonJS3({
|
|
1716
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engine.js"(exports2, module2) {
|
|
128
1717
|
"use strict";
|
|
129
|
-
module2.exports = function
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
// ../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js
|
|
136
|
-
var require_extend_shallow = __commonJS({
|
|
137
|
-
"../node_modules/.pnpm/extend-shallow@2.0.1/node_modules/extend-shallow/index.js"(exports2, module2) {
|
|
138
|
-
"use strict";
|
|
139
|
-
var isObject = require_is_extendable();
|
|
140
|
-
module2.exports = function extend(o) {
|
|
141
|
-
if (!isObject(o)) {
|
|
142
|
-
o = {};
|
|
1718
|
+
module2.exports = function(name, options2) {
|
|
1719
|
+
let engine = options2.engines[name] || options2.engines[aliase(name)];
|
|
1720
|
+
if (typeof engine === "undefined") {
|
|
1721
|
+
throw new Error('gray-matter engine "' + name + '" is not registered');
|
|
143
1722
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
var obj = arguments[i];
|
|
147
|
-
if (isObject(obj)) {
|
|
148
|
-
assign(o, obj);
|
|
149
|
-
}
|
|
1723
|
+
if (typeof engine === "function") {
|
|
1724
|
+
engine = { parse: engine };
|
|
150
1725
|
}
|
|
151
|
-
return
|
|
1726
|
+
return engine;
|
|
152
1727
|
};
|
|
153
|
-
function
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
var require_section_matter = __commonJS({
|
|
168
|
-
"../node_modules/.pnpm/section-matter@1.0.0/node_modules/section-matter/index.js"(exports2, module2) {
|
|
169
|
-
"use strict";
|
|
170
|
-
var typeOf = require_kind_of();
|
|
171
|
-
var extend = require_extend_shallow();
|
|
172
|
-
module2.exports = function(input, options2) {
|
|
173
|
-
if (typeof options2 === "function") {
|
|
174
|
-
options2 = { parse: options2 };
|
|
175
|
-
}
|
|
176
|
-
var file = toObject(input);
|
|
177
|
-
var defaults = { section_delimiter: "---", parse: identity };
|
|
178
|
-
var opts = extend({}, defaults, options2);
|
|
179
|
-
var delim = opts.section_delimiter;
|
|
180
|
-
var lines = file.content.split(/\r?\n/);
|
|
181
|
-
var sections = null;
|
|
182
|
-
var section = createSection();
|
|
183
|
-
var content = [];
|
|
184
|
-
var stack = [];
|
|
185
|
-
function initSections(val) {
|
|
186
|
-
file.content = val;
|
|
187
|
-
sections = [];
|
|
188
|
-
content = [];
|
|
189
|
-
}
|
|
190
|
-
function closeSection(val) {
|
|
191
|
-
if (stack.length) {
|
|
192
|
-
section.key = getKey(stack[0], delim);
|
|
193
|
-
section.content = val;
|
|
194
|
-
opts.parse(section, sections);
|
|
195
|
-
sections.push(section);
|
|
196
|
-
section = createSection();
|
|
197
|
-
content = [];
|
|
198
|
-
stack = [];
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
for (var i = 0; i < lines.length; i++) {
|
|
202
|
-
var line = lines[i];
|
|
203
|
-
var len = stack.length;
|
|
204
|
-
var ln = line.trim();
|
|
205
|
-
if (isDelimiter(ln, delim)) {
|
|
206
|
-
if (ln.length === 3 && i !== 0) {
|
|
207
|
-
if (len === 0 || len === 2) {
|
|
208
|
-
content.push(line);
|
|
209
|
-
continue;
|
|
210
|
-
}
|
|
211
|
-
stack.push(ln);
|
|
212
|
-
section.data = content.join("\n");
|
|
213
|
-
content = [];
|
|
214
|
-
continue;
|
|
215
|
-
}
|
|
216
|
-
if (sections === null) {
|
|
217
|
-
initSections(content.join("\n"));
|
|
218
|
-
}
|
|
219
|
-
if (len === 2) {
|
|
220
|
-
closeSection(content.join("\n"));
|
|
221
|
-
}
|
|
222
|
-
stack.push(ln);
|
|
223
|
-
continue;
|
|
1728
|
+
function aliase(name) {
|
|
1729
|
+
switch (name.toLowerCase()) {
|
|
1730
|
+
case "js":
|
|
1731
|
+
case "javascript":
|
|
1732
|
+
return "javascript";
|
|
1733
|
+
case "coffee":
|
|
1734
|
+
case "coffeescript":
|
|
1735
|
+
case "cson":
|
|
1736
|
+
return "coffee";
|
|
1737
|
+
case "yaml":
|
|
1738
|
+
case "yml":
|
|
1739
|
+
return "yaml";
|
|
1740
|
+
default: {
|
|
1741
|
+
return name;
|
|
224
1742
|
}
|
|
225
|
-
content.push(line);
|
|
226
|
-
}
|
|
227
|
-
if (sections === null) {
|
|
228
|
-
initSections(content.join("\n"));
|
|
229
|
-
} else {
|
|
230
|
-
closeSection(content.join("\n"));
|
|
231
|
-
}
|
|
232
|
-
file.sections = sections;
|
|
233
|
-
return file;
|
|
234
|
-
};
|
|
235
|
-
function isDelimiter(line, delim) {
|
|
236
|
-
if (line.slice(0, delim.length) !== delim) {
|
|
237
|
-
return false;
|
|
238
|
-
}
|
|
239
|
-
if (line.charAt(delim.length + 1) === delim.slice(-1)) {
|
|
240
|
-
return false;
|
|
241
|
-
}
|
|
242
|
-
return true;
|
|
243
|
-
}
|
|
244
|
-
function toObject(input) {
|
|
245
|
-
if (typeOf(input) !== "object") {
|
|
246
|
-
input = { content: input };
|
|
247
|
-
}
|
|
248
|
-
if (typeof input.content !== "string" && !isBuffer(input.content)) {
|
|
249
|
-
throw new TypeError("expected a buffer or string");
|
|
250
|
-
}
|
|
251
|
-
input.content = input.content.toString();
|
|
252
|
-
input.sections = [];
|
|
253
|
-
return input;
|
|
254
|
-
}
|
|
255
|
-
function getKey(val, delim) {
|
|
256
|
-
return val ? val.slice(delim.length).trim() : "";
|
|
257
|
-
}
|
|
258
|
-
function createSection() {
|
|
259
|
-
return { key: "", data: "", content: "" };
|
|
260
|
-
}
|
|
261
|
-
function identity(val) {
|
|
262
|
-
return val;
|
|
263
|
-
}
|
|
264
|
-
function isBuffer(val) {
|
|
265
|
-
if (val && val.constructor && typeof val.constructor.isBuffer === "function") {
|
|
266
|
-
return val.constructor.isBuffer(val);
|
|
267
1743
|
}
|
|
268
|
-
return false;
|
|
269
1744
|
}
|
|
270
1745
|
}
|
|
271
1746
|
});
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
var require_common = __commonJS({
|
|
275
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/common.js"(exports2, module2) {
|
|
1747
|
+
var require_common = __commonJS3({
|
|
1748
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/common.js"(exports2, module2) {
|
|
276
1749
|
"use strict";
|
|
277
1750
|
function isNothing(subject) {
|
|
278
1751
|
return typeof subject === "undefined" || subject === null;
|
|
@@ -314,10 +1787,8 @@ var require_common = __commonJS({
|
|
|
314
1787
|
module2.exports.extend = extend;
|
|
315
1788
|
}
|
|
316
1789
|
});
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
var require_exception = __commonJS({
|
|
320
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/exception.js"(exports2, module2) {
|
|
1790
|
+
var require_exception = __commonJS3({
|
|
1791
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/exception.js"(exports2, module2) {
|
|
321
1792
|
"use strict";
|
|
322
1793
|
function YAMLException(reason, mark) {
|
|
323
1794
|
Error.call(this);
|
|
@@ -344,10 +1815,8 @@ var require_exception = __commonJS({
|
|
|
344
1815
|
module2.exports = YAMLException;
|
|
345
1816
|
}
|
|
346
1817
|
});
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
var require_mark = __commonJS({
|
|
350
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/mark.js"(exports2, module2) {
|
|
1818
|
+
var require_mark = __commonJS3({
|
|
1819
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/mark.js"(exports2, module2) {
|
|
351
1820
|
"use strict";
|
|
352
1821
|
var common = require_common();
|
|
353
1822
|
function Mark(name, buffer, position, line, column) {
|
|
@@ -358,23 +1827,23 @@ var require_mark = __commonJS({
|
|
|
358
1827
|
this.column = column;
|
|
359
1828
|
}
|
|
360
1829
|
Mark.prototype.getSnippet = function getSnippet(indent, maxLength) {
|
|
361
|
-
var head,
|
|
1830
|
+
var head, start2, tail, end, snippet;
|
|
362
1831
|
if (!this.buffer) return null;
|
|
363
1832
|
indent = indent || 4;
|
|
364
1833
|
maxLength = maxLength || 75;
|
|
365
1834
|
head = "";
|
|
366
|
-
|
|
367
|
-
while (
|
|
368
|
-
|
|
369
|
-
if (this.position -
|
|
1835
|
+
start2 = this.position;
|
|
1836
|
+
while (start2 > 0 && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(start2 - 1)) === -1) {
|
|
1837
|
+
start2 -= 1;
|
|
1838
|
+
if (this.position - start2 > maxLength / 2 - 1) {
|
|
370
1839
|
head = " ... ";
|
|
371
|
-
|
|
1840
|
+
start2 += 5;
|
|
372
1841
|
break;
|
|
373
1842
|
}
|
|
374
1843
|
}
|
|
375
1844
|
tail = "";
|
|
376
1845
|
end = this.position;
|
|
377
|
-
while (end < this.buffer.length && "\0\r\n
|
|
1846
|
+
while (end < this.buffer.length && "\0\r\n\x85\u2028\u2029".indexOf(this.buffer.charAt(end)) === -1) {
|
|
378
1847
|
end += 1;
|
|
379
1848
|
if (end - this.position > maxLength / 2 - 1) {
|
|
380
1849
|
tail = " ... ";
|
|
@@ -382,8 +1851,8 @@ var require_mark = __commonJS({
|
|
|
382
1851
|
break;
|
|
383
1852
|
}
|
|
384
1853
|
}
|
|
385
|
-
snippet = this.buffer.slice(
|
|
386
|
-
return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position -
|
|
1854
|
+
snippet = this.buffer.slice(start2, end);
|
|
1855
|
+
return common.repeat(" ", indent) + head + snippet + tail + "\n" + common.repeat(" ", indent + this.position - start2 + head.length) + "^";
|
|
387
1856
|
};
|
|
388
1857
|
Mark.prototype.toString = function toString(compact) {
|
|
389
1858
|
var snippet, where = "";
|
|
@@ -402,10 +1871,8 @@ var require_mark = __commonJS({
|
|
|
402
1871
|
module2.exports = Mark;
|
|
403
1872
|
}
|
|
404
1873
|
});
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
var require_type = __commonJS({
|
|
408
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type.js"(exports2, module2) {
|
|
1874
|
+
var require_type = __commonJS3({
|
|
1875
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type.js"(exports2, module2) {
|
|
409
1876
|
"use strict";
|
|
410
1877
|
var YAMLException = require_exception();
|
|
411
1878
|
var TYPE_CONSTRUCTOR_OPTIONS = [
|
|
@@ -461,10 +1928,8 @@ var require_type = __commonJS({
|
|
|
461
1928
|
module2.exports = Type;
|
|
462
1929
|
}
|
|
463
1930
|
});
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
var require_schema = __commonJS({
|
|
467
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema.js"(exports2, module2) {
|
|
1931
|
+
var require_schema = __commonJS3({
|
|
1932
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema.js"(exports2, module2) {
|
|
468
1933
|
"use strict";
|
|
469
1934
|
var common = require_common();
|
|
470
1935
|
var YAMLException = require_exception();
|
|
@@ -549,10 +2014,8 @@ var require_schema = __commonJS({
|
|
|
549
2014
|
module2.exports = Schema;
|
|
550
2015
|
}
|
|
551
2016
|
});
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
var require_str = __commonJS({
|
|
555
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/str.js"(exports2, module2) {
|
|
2017
|
+
var require_str = __commonJS3({
|
|
2018
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/str.js"(exports2, module2) {
|
|
556
2019
|
"use strict";
|
|
557
2020
|
var Type = require_type();
|
|
558
2021
|
module2.exports = new Type("tag:yaml.org,2002:str", {
|
|
@@ -563,10 +2026,8 @@ var require_str = __commonJS({
|
|
|
563
2026
|
});
|
|
564
2027
|
}
|
|
565
2028
|
});
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
var require_seq = __commonJS({
|
|
569
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports2, module2) {
|
|
2029
|
+
var require_seq = __commonJS3({
|
|
2030
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/seq.js"(exports2, module2) {
|
|
570
2031
|
"use strict";
|
|
571
2032
|
var Type = require_type();
|
|
572
2033
|
module2.exports = new Type("tag:yaml.org,2002:seq", {
|
|
@@ -577,10 +2038,8 @@ var require_seq = __commonJS({
|
|
|
577
2038
|
});
|
|
578
2039
|
}
|
|
579
2040
|
});
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
var require_map = __commonJS({
|
|
583
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/map.js"(exports2, module2) {
|
|
2041
|
+
var require_map = __commonJS3({
|
|
2042
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/map.js"(exports2, module2) {
|
|
584
2043
|
"use strict";
|
|
585
2044
|
var Type = require_type();
|
|
586
2045
|
module2.exports = new Type("tag:yaml.org,2002:map", {
|
|
@@ -591,10 +2050,8 @@ var require_map = __commonJS({
|
|
|
591
2050
|
});
|
|
592
2051
|
}
|
|
593
2052
|
});
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
var require_failsafe = __commonJS({
|
|
597
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports2, module2) {
|
|
2053
|
+
var require_failsafe = __commonJS3({
|
|
2054
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/failsafe.js"(exports2, module2) {
|
|
598
2055
|
"use strict";
|
|
599
2056
|
var Schema = require_schema();
|
|
600
2057
|
module2.exports = new Schema({
|
|
@@ -606,10 +2063,8 @@ var require_failsafe = __commonJS({
|
|
|
606
2063
|
});
|
|
607
2064
|
}
|
|
608
2065
|
});
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
var require_null = __commonJS({
|
|
612
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/null.js"(exports2, module2) {
|
|
2066
|
+
var require_null = __commonJS3({
|
|
2067
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/null.js"(exports2, module2) {
|
|
613
2068
|
"use strict";
|
|
614
2069
|
var Type = require_type();
|
|
615
2070
|
function resolveYamlNull(data) {
|
|
@@ -646,10 +2101,8 @@ var require_null = __commonJS({
|
|
|
646
2101
|
});
|
|
647
2102
|
}
|
|
648
2103
|
});
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
var require_bool = __commonJS({
|
|
652
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports2, module2) {
|
|
2104
|
+
var require_bool = __commonJS3({
|
|
2105
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/bool.js"(exports2, module2) {
|
|
653
2106
|
"use strict";
|
|
654
2107
|
var Type = require_type();
|
|
655
2108
|
function resolveYamlBoolean(data) {
|
|
@@ -683,10 +2136,8 @@ var require_bool = __commonJS({
|
|
|
683
2136
|
});
|
|
684
2137
|
}
|
|
685
2138
|
});
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
var require_int = __commonJS({
|
|
689
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/int.js"(exports2, module2) {
|
|
2139
|
+
var require_int = __commonJS3({
|
|
2140
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/int.js"(exports2, module2) {
|
|
690
2141
|
"use strict";
|
|
691
2142
|
var common = require_common();
|
|
692
2143
|
var Type = require_type();
|
|
@@ -816,10 +2267,8 @@ var require_int = __commonJS({
|
|
|
816
2267
|
});
|
|
817
2268
|
}
|
|
818
2269
|
});
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
var require_float = __commonJS({
|
|
822
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/float.js"(exports2, module2) {
|
|
2270
|
+
var require_float = __commonJS3({
|
|
2271
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/float.js"(exports2, module2) {
|
|
823
2272
|
"use strict";
|
|
824
2273
|
var common = require_common();
|
|
825
2274
|
var Type = require_type();
|
|
@@ -911,10 +2360,8 @@ var require_float = __commonJS({
|
|
|
911
2360
|
});
|
|
912
2361
|
}
|
|
913
2362
|
});
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
var require_json = __commonJS({
|
|
917
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports2, module2) {
|
|
2363
|
+
var require_json = __commonJS3({
|
|
2364
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/json.js"(exports2, module2) {
|
|
918
2365
|
"use strict";
|
|
919
2366
|
var Schema = require_schema();
|
|
920
2367
|
module2.exports = new Schema({
|
|
@@ -930,10 +2377,8 @@ var require_json = __commonJS({
|
|
|
930
2377
|
});
|
|
931
2378
|
}
|
|
932
2379
|
});
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
var require_core = __commonJS({
|
|
936
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports2, module2) {
|
|
2380
|
+
var require_core = __commonJS3({
|
|
2381
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/core.js"(exports2, module2) {
|
|
937
2382
|
"use strict";
|
|
938
2383
|
var Schema = require_schema();
|
|
939
2384
|
module2.exports = new Schema({
|
|
@@ -943,10 +2388,8 @@ var require_core = __commonJS({
|
|
|
943
2388
|
});
|
|
944
2389
|
}
|
|
945
2390
|
});
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
var require_timestamp = __commonJS({
|
|
949
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports2, module2) {
|
|
2391
|
+
var require_timestamp = __commonJS3({
|
|
2392
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/timestamp.js"(exports2, module2) {
|
|
950
2393
|
"use strict";
|
|
951
2394
|
var Type = require_type();
|
|
952
2395
|
var YAML_DATE_REGEXP = new RegExp(
|
|
@@ -1004,10 +2447,8 @@ var require_timestamp = __commonJS({
|
|
|
1004
2447
|
});
|
|
1005
2448
|
}
|
|
1006
2449
|
});
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
var require_merge = __commonJS({
|
|
1010
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports2, module2) {
|
|
2450
|
+
var require_merge = __commonJS3({
|
|
2451
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/merge.js"(exports2, module2) {
|
|
1011
2452
|
"use strict";
|
|
1012
2453
|
var Type = require_type();
|
|
1013
2454
|
function resolveYamlMerge(data) {
|
|
@@ -1019,14 +2460,12 @@ var require_merge = __commonJS({
|
|
|
1019
2460
|
});
|
|
1020
2461
|
}
|
|
1021
2462
|
});
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
var require_binary = __commonJS({
|
|
1025
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports2, module2) {
|
|
2463
|
+
var require_binary = __commonJS3({
|
|
2464
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/binary.js"(exports2, module2) {
|
|
1026
2465
|
"use strict";
|
|
1027
2466
|
var NodeBuffer;
|
|
1028
2467
|
try {
|
|
1029
|
-
_require =
|
|
2468
|
+
_require = __require2;
|
|
1030
2469
|
NodeBuffer = _require("buffer").Buffer;
|
|
1031
2470
|
} catch (__) {
|
|
1032
2471
|
}
|
|
@@ -1112,10 +2551,8 @@ var require_binary = __commonJS({
|
|
|
1112
2551
|
});
|
|
1113
2552
|
}
|
|
1114
2553
|
});
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
var require_omap = __commonJS({
|
|
1118
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports2, module2) {
|
|
2554
|
+
var require_omap = __commonJS3({
|
|
2555
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/omap.js"(exports2, module2) {
|
|
1119
2556
|
"use strict";
|
|
1120
2557
|
var Type = require_type();
|
|
1121
2558
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -1149,10 +2586,8 @@ var require_omap = __commonJS({
|
|
|
1149
2586
|
});
|
|
1150
2587
|
}
|
|
1151
2588
|
});
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
var require_pairs = __commonJS({
|
|
1155
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports2, module2) {
|
|
2589
|
+
var require_pairs = __commonJS3({
|
|
2590
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/pairs.js"(exports2, module2) {
|
|
1156
2591
|
"use strict";
|
|
1157
2592
|
var Type = require_type();
|
|
1158
2593
|
var _toString = Object.prototype.toString;
|
|
@@ -1187,10 +2622,8 @@ var require_pairs = __commonJS({
|
|
|
1187
2622
|
});
|
|
1188
2623
|
}
|
|
1189
2624
|
});
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
var require_set = __commonJS({
|
|
1193
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/set.js"(exports2, module2) {
|
|
2625
|
+
var require_set = __commonJS3({
|
|
2626
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/set.js"(exports2, module2) {
|
|
1194
2627
|
"use strict";
|
|
1195
2628
|
var Type = require_type();
|
|
1196
2629
|
var _hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
@@ -1214,10 +2647,8 @@ var require_set = __commonJS({
|
|
|
1214
2647
|
});
|
|
1215
2648
|
}
|
|
1216
2649
|
});
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
var require_default_safe = __commonJS({
|
|
1220
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports2, module2) {
|
|
2650
|
+
var require_default_safe = __commonJS3({
|
|
2651
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/default_safe.js"(exports2, module2) {
|
|
1221
2652
|
"use strict";
|
|
1222
2653
|
var Schema = require_schema();
|
|
1223
2654
|
module2.exports = new Schema({
|
|
@@ -1237,10 +2668,8 @@ var require_default_safe = __commonJS({
|
|
|
1237
2668
|
});
|
|
1238
2669
|
}
|
|
1239
2670
|
});
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
var require_undefined = __commonJS({
|
|
1243
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports2, module2) {
|
|
2671
|
+
var require_undefined = __commonJS3({
|
|
2672
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/undefined.js"(exports2, module2) {
|
|
1244
2673
|
"use strict";
|
|
1245
2674
|
var Type = require_type();
|
|
1246
2675
|
function resolveJavascriptUndefined() {
|
|
@@ -1264,10 +2693,8 @@ var require_undefined = __commonJS({
|
|
|
1264
2693
|
});
|
|
1265
2694
|
}
|
|
1266
2695
|
});
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
var require_regexp = __commonJS({
|
|
1270
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports2, module2) {
|
|
2696
|
+
var require_regexp = __commonJS3({
|
|
2697
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/regexp.js"(exports2, module2) {
|
|
1271
2698
|
"use strict";
|
|
1272
2699
|
var Type = require_type();
|
|
1273
2700
|
function resolveJavascriptRegExp(data) {
|
|
@@ -1308,14 +2735,12 @@ var require_regexp = __commonJS({
|
|
|
1308
2735
|
});
|
|
1309
2736
|
}
|
|
1310
2737
|
});
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
var require_function = __commonJS({
|
|
1314
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports2, module2) {
|
|
2738
|
+
var require_function = __commonJS3({
|
|
2739
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/type/js/function.js"(exports2, module2) {
|
|
1315
2740
|
"use strict";
|
|
1316
2741
|
var esprima;
|
|
1317
2742
|
try {
|
|
1318
|
-
_require =
|
|
2743
|
+
_require = __require2;
|
|
1319
2744
|
esprima = _require("esprima");
|
|
1320
2745
|
} catch (_) {
|
|
1321
2746
|
if (typeof window !== "undefined") esprima = window.esprima;
|
|
@@ -1363,10 +2788,8 @@ var require_function = __commonJS({
|
|
|
1363
2788
|
});
|
|
1364
2789
|
}
|
|
1365
2790
|
});
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
var require_default_full = __commonJS({
|
|
1369
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports2, module2) {
|
|
2791
|
+
var require_default_full = __commonJS3({
|
|
2792
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/schema/default_full.js"(exports2, module2) {
|
|
1370
2793
|
"use strict";
|
|
1371
2794
|
var Schema = require_schema();
|
|
1372
2795
|
module2.exports = Schema.DEFAULT = new Schema({
|
|
@@ -1381,10 +2804,8 @@ var require_default_full = __commonJS({
|
|
|
1381
2804
|
});
|
|
1382
2805
|
}
|
|
1383
2806
|
});
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
var require_loader = __commonJS({
|
|
1387
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/loader.js"(exports2, module2) {
|
|
2807
|
+
var require_loader = __commonJS3({
|
|
2808
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/loader.js"(exports2, module2) {
|
|
1388
2809
|
"use strict";
|
|
1389
2810
|
var common = require_common();
|
|
1390
2811
|
var YAMLException = require_exception();
|
|
@@ -1449,7 +2870,7 @@ var require_loader = __commonJS({
|
|
|
1449
2870
|
return -1;
|
|
1450
2871
|
}
|
|
1451
2872
|
function simpleEscapeSequence(c) {
|
|
1452
|
-
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "
|
|
2873
|
+
return c === 48 ? "\0" : c === 97 ? "\x07" : c === 98 ? "\b" : c === 116 ? " " : c === 9 ? " " : c === 110 ? "\n" : c === 118 ? "\v" : c === 102 ? "\f" : c === 114 ? "\r" : c === 101 ? "\x1B" : c === 32 ? " " : c === 34 ? '"' : c === 47 ? "/" : c === 92 ? "\\" : c === 78 ? "\x85" : c === 95 ? "\xA0" : c === 76 ? "\u2028" : c === 80 ? "\u2029" : "";
|
|
1453
2874
|
}
|
|
1454
2875
|
function charFromCodepoint(c) {
|
|
1455
2876
|
if (c <= 65535) {
|
|
@@ -1541,10 +2962,10 @@ var require_loader = __commonJS({
|
|
|
1541
2962
|
state.tagMap[handle] = prefix;
|
|
1542
2963
|
}
|
|
1543
2964
|
};
|
|
1544
|
-
function captureSegment(state,
|
|
2965
|
+
function captureSegment(state, start2, end, checkJson) {
|
|
1545
2966
|
var _position, _length, _character, _result;
|
|
1546
|
-
if (
|
|
1547
|
-
_result = state.input.slice(
|
|
2967
|
+
if (start2 < end) {
|
|
2968
|
+
_result = state.input.slice(start2, end);
|
|
1548
2969
|
if (checkJson) {
|
|
1549
2970
|
for (_position = 0, _length = _result.length; _position < _length; _position += 1) {
|
|
1550
2971
|
_character = _result.charCodeAt(_position);
|
|
@@ -2488,10 +3909,8 @@ var require_loader = __commonJS({
|
|
|
2488
3909
|
module2.exports.safeLoad = safeLoad;
|
|
2489
3910
|
}
|
|
2490
3911
|
});
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
var require_dumper = __commonJS({
|
|
2494
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/dumper.js"(exports2, module2) {
|
|
3912
|
+
var require_dumper = __commonJS3({
|
|
3913
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml/dumper.js"(exports2, module2) {
|
|
2495
3914
|
"use strict";
|
|
2496
3915
|
var common = require_common();
|
|
2497
3916
|
var YAMLException = require_exception();
|
|
@@ -2771,22 +4190,22 @@ var require_dumper = __commonJS({
|
|
|
2771
4190
|
if (line === "" || line[0] === " ") return line;
|
|
2772
4191
|
var breakRe = / [^ ]/g;
|
|
2773
4192
|
var match;
|
|
2774
|
-
var
|
|
4193
|
+
var start2 = 0, end, curr = 0, next = 0;
|
|
2775
4194
|
var result = "";
|
|
2776
4195
|
while (match = breakRe.exec(line)) {
|
|
2777
4196
|
next = match.index;
|
|
2778
|
-
if (next -
|
|
2779
|
-
end = curr >
|
|
2780
|
-
result += "\n" + line.slice(
|
|
2781
|
-
|
|
4197
|
+
if (next - start2 > width) {
|
|
4198
|
+
end = curr > start2 ? curr : next;
|
|
4199
|
+
result += "\n" + line.slice(start2, end);
|
|
4200
|
+
start2 = end + 1;
|
|
2782
4201
|
}
|
|
2783
4202
|
curr = next;
|
|
2784
4203
|
}
|
|
2785
4204
|
result += "\n";
|
|
2786
|
-
if (line.length -
|
|
2787
|
-
result += line.slice(
|
|
4205
|
+
if (line.length - start2 > width && curr > start2) {
|
|
4206
|
+
result += line.slice(start2, curr) + "\n" + line.slice(curr + 1);
|
|
2788
4207
|
} else {
|
|
2789
|
-
result += line.slice(
|
|
4208
|
+
result += line.slice(start2);
|
|
2790
4209
|
}
|
|
2791
4210
|
return result.slice(1);
|
|
2792
4211
|
}
|
|
@@ -3036,10 +4455,8 @@ var require_dumper = __commonJS({
|
|
|
3036
4455
|
module2.exports.safeDump = safeDump;
|
|
3037
4456
|
}
|
|
3038
4457
|
});
|
|
3039
|
-
|
|
3040
|
-
|
|
3041
|
-
var require_js_yaml = __commonJS({
|
|
3042
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml.js"(exports2, module2) {
|
|
4458
|
+
var require_js_yaml = __commonJS3({
|
|
4459
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/lib/js-yaml.js"(exports2, module2) {
|
|
3043
4460
|
"use strict";
|
|
3044
4461
|
var loader = require_loader();
|
|
3045
4462
|
var dumper = require_dumper();
|
|
@@ -3071,19 +4488,15 @@ var require_js_yaml = __commonJS({
|
|
|
3071
4488
|
module2.exports.addConstructor = deprecated("addConstructor");
|
|
3072
4489
|
}
|
|
3073
4490
|
});
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
var require_js_yaml2 = __commonJS({
|
|
3077
|
-
"../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/index.js"(exports2, module2) {
|
|
4491
|
+
var require_js_yaml2 = __commonJS3({
|
|
4492
|
+
"../../node_modules/.pnpm/js-yaml@3.14.1/node_modules/js-yaml/index.js"(exports2, module2) {
|
|
3078
4493
|
"use strict";
|
|
3079
|
-
var
|
|
3080
|
-
module2.exports =
|
|
4494
|
+
var yaml22 = require_js_yaml();
|
|
4495
|
+
module2.exports = yaml22;
|
|
3081
4496
|
}
|
|
3082
4497
|
});
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
var require_engines = __commonJS({
|
|
3086
|
-
"../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engines.js"(exports, module) {
|
|
4498
|
+
var require_engines = __commonJS3({
|
|
4499
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engines.js"(exports, module) {
|
|
3087
4500
|
"use strict";
|
|
3088
4501
|
var yaml = require_js_yaml2();
|
|
3089
4502
|
var engines = exports = module.exports;
|
|
@@ -3118,10 +4531,8 @@ var require_engines = __commonJS({
|
|
|
3118
4531
|
};
|
|
3119
4532
|
}
|
|
3120
4533
|
});
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
var require_strip_bom_string = __commonJS({
|
|
3124
|
-
"../node_modules/.pnpm/strip-bom-string@1.0.0/node_modules/strip-bom-string/index.js"(exports2, module2) {
|
|
4534
|
+
var require_strip_bom_string = __commonJS3({
|
|
4535
|
+
"../../node_modules/.pnpm/strip-bom-string@1.0.0/node_modules/strip-bom-string/index.js"(exports2, module2) {
|
|
3125
4536
|
"use strict";
|
|
3126
4537
|
module2.exports = function(str2) {
|
|
3127
4538
|
if (typeof str2 === "string" && str2.charAt(0) === "\uFEFF") {
|
|
@@ -3131,10 +4542,8 @@ var require_strip_bom_string = __commonJS({
|
|
|
3131
4542
|
};
|
|
3132
4543
|
}
|
|
3133
4544
|
});
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
var require_utils = __commonJS({
|
|
3137
|
-
"../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/utils.js"(exports2) {
|
|
4545
|
+
var require_utils = __commonJS3({
|
|
4546
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/utils.js"(exports2) {
|
|
3138
4547
|
"use strict";
|
|
3139
4548
|
var stripBom = require_strip_bom_string();
|
|
3140
4549
|
var typeOf = require_kind_of();
|
|
@@ -3171,10 +4580,8 @@ var require_utils = __commonJS({
|
|
|
3171
4580
|
};
|
|
3172
4581
|
}
|
|
3173
4582
|
});
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
var require_defaults = __commonJS({
|
|
3177
|
-
"../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/defaults.js"(exports2, module2) {
|
|
4583
|
+
var require_defaults = __commonJS3({
|
|
4584
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/defaults.js"(exports2, module2) {
|
|
3178
4585
|
"use strict";
|
|
3179
4586
|
var engines2 = require_engines();
|
|
3180
4587
|
var utils = require_utils();
|
|
@@ -3190,44 +4597,8 @@ var require_defaults = __commonJS({
|
|
|
3190
4597
|
};
|
|
3191
4598
|
}
|
|
3192
4599
|
});
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
var require_engine = __commonJS({
|
|
3196
|
-
"../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/engine.js"(exports2, module2) {
|
|
3197
|
-
"use strict";
|
|
3198
|
-
module2.exports = function(name, options2) {
|
|
3199
|
-
let engine = options2.engines[name] || options2.engines[aliase(name)];
|
|
3200
|
-
if (typeof engine === "undefined") {
|
|
3201
|
-
throw new Error('gray-matter engine "' + name + '" is not registered');
|
|
3202
|
-
}
|
|
3203
|
-
if (typeof engine === "function") {
|
|
3204
|
-
engine = { parse: engine };
|
|
3205
|
-
}
|
|
3206
|
-
return engine;
|
|
3207
|
-
};
|
|
3208
|
-
function aliase(name) {
|
|
3209
|
-
switch (name.toLowerCase()) {
|
|
3210
|
-
case "js":
|
|
3211
|
-
case "javascript":
|
|
3212
|
-
return "javascript";
|
|
3213
|
-
case "coffee":
|
|
3214
|
-
case "coffeescript":
|
|
3215
|
-
case "cson":
|
|
3216
|
-
return "coffee";
|
|
3217
|
-
case "yaml":
|
|
3218
|
-
case "yml":
|
|
3219
|
-
return "yaml";
|
|
3220
|
-
default: {
|
|
3221
|
-
return name;
|
|
3222
|
-
}
|
|
3223
|
-
}
|
|
3224
|
-
}
|
|
3225
|
-
}
|
|
3226
|
-
});
|
|
3227
|
-
|
|
3228
|
-
// ../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js
|
|
3229
|
-
var require_stringify = __commonJS({
|
|
3230
|
-
"../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js"(exports2, module2) {
|
|
4600
|
+
var require_stringify = __commonJS3({
|
|
4601
|
+
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/stringify.js"(exports2, module2) {
|
|
3231
4602
|
"use strict";
|
|
3232
4603
|
var typeOf = require_kind_of();
|
|
3233
4604
|
var getEngine = require_engine();
|
|
@@ -3260,10 +4631,10 @@ var require_stringify = __commonJS({
|
|
|
3260
4631
|
data = Object.assign({}, file.data, data);
|
|
3261
4632
|
const open = opts.delimiters[0];
|
|
3262
4633
|
const close = opts.delimiters[1];
|
|
3263
|
-
const
|
|
4634
|
+
const matter3 = engine.stringify(data, options2).trim();
|
|
3264
4635
|
let buf = "";
|
|
3265
|
-
if (
|
|
3266
|
-
buf = newline(open) + newline(
|
|
4636
|
+
if (matter3 !== "{}") {
|
|
4637
|
+
buf = newline(open) + newline(matter3) + newline(close);
|
|
3267
4638
|
}
|
|
3268
4639
|
if (typeof file.excerpt === "string" && file.excerpt !== "") {
|
|
3269
4640
|
if (str2.indexOf(file.excerpt.trim()) === -1) {
|
|
@@ -3277,216 +4648,1027 @@ var require_stringify = __commonJS({
|
|
|
3277
4648
|
}
|
|
3278
4649
|
}
|
|
3279
4650
|
});
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
"
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
4651
|
+
var extensions = ["tsx", "jsx", "js", "ts", "json"];
|
|
4652
|
+
async function readSettings() {
|
|
4653
|
+
const dirPath = process.cwd();
|
|
4654
|
+
const baseFileName = "settings";
|
|
4655
|
+
let settingsFilePath = "";
|
|
4656
|
+
let reactSettings = false;
|
|
4657
|
+
try {
|
|
4658
|
+
const files = await fs3.readdir(dirPath);
|
|
4659
|
+
const settingsFile = files.find((file) => {
|
|
4660
|
+
const ext = path3.extname(file).slice(1);
|
|
4661
|
+
return file.startsWith(baseFileName) && extensions.includes(ext);
|
|
4662
|
+
});
|
|
4663
|
+
if (settingsFile) {
|
|
4664
|
+
settingsFilePath = path3.join(dirPath, settingsFile);
|
|
4665
|
+
reactSettings = path3.extname(settingsFile) !== ".json";
|
|
4666
|
+
} else {
|
|
4667
|
+
console.error("No settings file found");
|
|
4668
|
+
return null;
|
|
4669
|
+
}
|
|
4670
|
+
} catch (error) {
|
|
4671
|
+
console.error(error);
|
|
4672
|
+
return null;
|
|
4673
|
+
}
|
|
4674
|
+
if (reactSettings) {
|
|
4675
|
+
const settingsPreview = await createServer({
|
|
4676
|
+
optimizeDeps: {
|
|
4677
|
+
include: ["react/jsx-runtime"]
|
|
4678
|
+
}
|
|
4679
|
+
});
|
|
4680
|
+
const config = await settingsPreview.ssrLoadModule(settingsFilePath);
|
|
4681
|
+
return config.default;
|
|
4682
|
+
} else {
|
|
4683
|
+
const rawJsonSettings = await fs3.readFile(settingsFilePath, "utf-8");
|
|
4684
|
+
return JSON.parse(rawJsonSettings);
|
|
4685
|
+
}
|
|
4686
|
+
}
|
|
4687
|
+
async function loadModule(filePath) {
|
|
4688
|
+
const server = await createServer2({
|
|
4689
|
+
optimizeDeps: {
|
|
4690
|
+
include: ["react/jsx-runtime"]
|
|
4691
|
+
}
|
|
4692
|
+
});
|
|
4693
|
+
try {
|
|
4694
|
+
const module2 = await server.ssrLoadModule(filePath);
|
|
4695
|
+
return module2.default;
|
|
4696
|
+
} finally {
|
|
4697
|
+
await server.close();
|
|
4698
|
+
}
|
|
4699
|
+
}
|
|
4700
|
+
function preinstall() {
|
|
4701
|
+
return async function docsPluginInner(_, data) {
|
|
4702
|
+
const root2 = process.cwd();
|
|
4703
|
+
const settings = await readSettings();
|
|
4704
|
+
let themeRoutesExists = false;
|
|
4705
|
+
try {
|
|
4706
|
+
await fs2.access(path22.join(root2, ".xyd/theme/routes.ts"));
|
|
4707
|
+
themeRoutesExists = true;
|
|
4708
|
+
} catch (_2) {
|
|
4709
|
+
}
|
|
4710
|
+
if (themeRoutesExists) {
|
|
4711
|
+
const routeMod = await loadModule(path22.join(root2, ".xyd/theme/routes.ts"));
|
|
4712
|
+
const routes = routeMod((routePath, routeFile, routeOptions) => {
|
|
4713
|
+
return route(routePath, path22.join(root2, ".xyd/theme", routeFile), routeOptions);
|
|
4714
|
+
});
|
|
4715
|
+
data.routes.push(...routes);
|
|
4716
|
+
}
|
|
4717
|
+
return {
|
|
4718
|
+
settings
|
|
4719
|
+
};
|
|
4720
|
+
};
|
|
4721
|
+
}
|
|
4722
|
+
function vitePluginSettings() {
|
|
4723
|
+
return async function({ preinstall: preinstall3 }) {
|
|
4724
|
+
return {
|
|
4725
|
+
name: "virtual:xyd-settings",
|
|
4726
|
+
resolveId(id) {
|
|
4727
|
+
if (id === "virtual:xyd-settings") {
|
|
4728
|
+
return id + ".jsx";
|
|
4729
|
+
}
|
|
4730
|
+
return null;
|
|
4731
|
+
},
|
|
4732
|
+
async load(id) {
|
|
4733
|
+
if (id === "virtual:xyd-settings.jsx") {
|
|
4734
|
+
if (typeof preinstall3.settings === "string") {
|
|
4735
|
+
return preinstall3.settings;
|
|
4736
|
+
}
|
|
4737
|
+
return `export default ${JSON.stringify(preinstall3.settings)};`;
|
|
4738
|
+
}
|
|
4739
|
+
return null;
|
|
3290
4740
|
}
|
|
3291
|
-
|
|
3292
|
-
|
|
4741
|
+
};
|
|
4742
|
+
};
|
|
4743
|
+
}
|
|
4744
|
+
function vitePluginThemeCSS() {
|
|
4745
|
+
return async function({ preinstall: preinstall3 }) {
|
|
4746
|
+
return {
|
|
4747
|
+
name: "virtual:xyd-theme-css",
|
|
4748
|
+
resolveId(source) {
|
|
4749
|
+
if (source === "virtual:xyd-theme/index.css") {
|
|
4750
|
+
let basePath = "";
|
|
4751
|
+
if (process.env.XYD_CLI) {
|
|
4752
|
+
const __filename3 = fileURLToPath(import.meta.url);
|
|
4753
|
+
const __dirname23 = path22.dirname(__filename3);
|
|
4754
|
+
basePath = __dirname23 + "/";
|
|
4755
|
+
} else {
|
|
4756
|
+
basePath = import.meta.url.split("xyd/packages")[0] += "xyd/";
|
|
4757
|
+
}
|
|
4758
|
+
switch (preinstall3.settings.styling?.theme) {
|
|
4759
|
+
// TODO: support another themes + custom themes
|
|
4760
|
+
case "gusto": {
|
|
4761
|
+
const gustoCss = basePath += "node_modules/@xyd-js/theme-gusto/dist/index.css";
|
|
4762
|
+
return gustoCss.replace("file://", "");
|
|
4763
|
+
}
|
|
4764
|
+
case "poetry": {
|
|
4765
|
+
const poetryCss = basePath += "node_modules/@xyd-js/theme-poetry/dist/index.css";
|
|
4766
|
+
return poetryCss.replace("file://", "");
|
|
4767
|
+
}
|
|
4768
|
+
default: {
|
|
4769
|
+
const fableCss = basePath += "node_modules/@xyd-js/fable-wiki/dist/theme.css";
|
|
4770
|
+
return fableCss.replace("file://", "");
|
|
4771
|
+
}
|
|
4772
|
+
}
|
|
4773
|
+
}
|
|
4774
|
+
return null;
|
|
3293
4775
|
}
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
4776
|
+
};
|
|
4777
|
+
};
|
|
4778
|
+
}
|
|
4779
|
+
function vitePluginThemeOverrideCSS() {
|
|
4780
|
+
return async function({ preinstall: preinstall3 }) {
|
|
4781
|
+
return {
|
|
4782
|
+
name: "virtual:xyd-theme-override-css",
|
|
4783
|
+
async resolveId(id) {
|
|
4784
|
+
if (id === "virtual:xyd-theme-override/index.css") {
|
|
4785
|
+
const root2 = process.cwd();
|
|
4786
|
+
const filePath = path22.join(root2, ".xyd/theme/index.css");
|
|
4787
|
+
try {
|
|
4788
|
+
await fs2.access(filePath);
|
|
4789
|
+
return filePath;
|
|
4790
|
+
} catch {
|
|
4791
|
+
return "virtual:xyd-theme-override/empty.css";
|
|
4792
|
+
}
|
|
4793
|
+
}
|
|
4794
|
+
return null;
|
|
4795
|
+
},
|
|
4796
|
+
async load(id) {
|
|
4797
|
+
if (id === "virtual:xyd-theme-override/empty.css") {
|
|
4798
|
+
return "";
|
|
4799
|
+
}
|
|
4800
|
+
return null;
|
|
3297
4801
|
}
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
4802
|
+
};
|
|
4803
|
+
};
|
|
4804
|
+
}
|
|
4805
|
+
function vitePluginTheme() {
|
|
4806
|
+
return async function({
|
|
4807
|
+
preinstall: preinstall3
|
|
4808
|
+
}) {
|
|
4809
|
+
return {
|
|
4810
|
+
name: "virtual:xyd-theme",
|
|
4811
|
+
resolveId(id) {
|
|
4812
|
+
if (id === "virtual:xyd-theme") {
|
|
4813
|
+
return id;
|
|
4814
|
+
}
|
|
4815
|
+
return null;
|
|
4816
|
+
},
|
|
4817
|
+
async load(id) {
|
|
4818
|
+
if (id === "virtual:xyd-theme") {
|
|
4819
|
+
switch (preinstall3.settings.styling?.theme) {
|
|
4820
|
+
// TODO: support another themes + custom themes
|
|
4821
|
+
case "gusto": {
|
|
4822
|
+
return `import Theme from '@xyd-js/theme-gusto'; export default Theme;`;
|
|
4823
|
+
}
|
|
4824
|
+
case "poetry": {
|
|
4825
|
+
return `import Theme from '@xyd-js/theme-poetry'; export default Theme;`;
|
|
4826
|
+
}
|
|
4827
|
+
default: {
|
|
4828
|
+
return `import Theme from '@xyd-js/fable-wiki/theme'; export default Theme;`;
|
|
4829
|
+
}
|
|
4830
|
+
}
|
|
4831
|
+
}
|
|
4832
|
+
return null;
|
|
3302
4833
|
}
|
|
3303
|
-
return file;
|
|
3304
4834
|
};
|
|
4835
|
+
};
|
|
4836
|
+
}
|
|
4837
|
+
function preset(settings, options2) {
|
|
4838
|
+
const __filename3 = fileURLToPath(import.meta.url);
|
|
4839
|
+
const __dirname23 = path22.dirname(__filename3);
|
|
4840
|
+
let basePath = "";
|
|
4841
|
+
if (process.env.XYD_CLI) {
|
|
4842
|
+
basePath = path22.join(__dirname23, "./plugins/xyd-plugin-zero");
|
|
4843
|
+
} else {
|
|
4844
|
+
basePath = "../../../xyd-plugin-zero";
|
|
3305
4845
|
}
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
4846
|
+
return {
|
|
4847
|
+
preinstall: [
|
|
4848
|
+
preinstall
|
|
4849
|
+
],
|
|
4850
|
+
routes: [
|
|
4851
|
+
route("", path22.join(basePath, "src/pages/docs.tsx")),
|
|
4852
|
+
// TODO: custom routes
|
|
4853
|
+
route(options2.urlPrefix ? `${options2.urlPrefix}/*` : "*", path22.join(basePath, "src/pages/docs.tsx"), {
|
|
4854
|
+
// TODO: absolute paths does not works
|
|
4855
|
+
id: "xyd-plugin-zero/docs"
|
|
4856
|
+
})
|
|
4857
|
+
],
|
|
4858
|
+
vitePlugins: [
|
|
4859
|
+
vitePluginSettings,
|
|
4860
|
+
vitePluginTheme,
|
|
4861
|
+
vitePluginThemeCSS,
|
|
4862
|
+
vitePluginThemeOverrideCSS
|
|
4863
|
+
]
|
|
4864
|
+
};
|
|
4865
|
+
}
|
|
4866
|
+
var docsPreset = preset;
|
|
4867
|
+
var import_stringify = __toESM3(require_stringify(), 1);
|
|
4868
|
+
function flatPages(sidebar, groups, resp = []) {
|
|
4869
|
+
sidebar.map(async (side) => {
|
|
4870
|
+
if ("match" in side) {
|
|
4871
|
+
side.items.map((item) => {
|
|
4872
|
+
return flatPages([item], groups, resp);
|
|
4873
|
+
});
|
|
4874
|
+
return;
|
|
4875
|
+
}
|
|
4876
|
+
if (groups[side.group || ""]) {
|
|
4877
|
+
const link = groups[side.group || ""];
|
|
4878
|
+
resp.push(link);
|
|
4879
|
+
}
|
|
4880
|
+
side?.pages?.map(async (page) => {
|
|
4881
|
+
if (typeof page === "string") {
|
|
4882
|
+
resp.push(page);
|
|
4883
|
+
return;
|
|
4884
|
+
}
|
|
4885
|
+
return flatPages([page], groups, resp);
|
|
4886
|
+
});
|
|
4887
|
+
});
|
|
4888
|
+
return resp;
|
|
4889
|
+
}
|
|
4890
|
+
function flatGroups(sidebar, resp = {}) {
|
|
4891
|
+
sidebar.map(async (side) => {
|
|
4892
|
+
if ("match" in side) {
|
|
4893
|
+
side.items.map((item) => {
|
|
4894
|
+
return flatGroups([item], resp);
|
|
4895
|
+
});
|
|
4896
|
+
return;
|
|
4897
|
+
}
|
|
4898
|
+
if (side.group) {
|
|
4899
|
+
if (resp[side.group]) {
|
|
4900
|
+
console.error("group already exists", side.group);
|
|
4901
|
+
}
|
|
4902
|
+
const first = side?.pages?.[0];
|
|
4903
|
+
if (first && typeof first === "string") {
|
|
4904
|
+
const chunks = first.split("/");
|
|
4905
|
+
chunks[chunks.length - 1] = side.group || "";
|
|
4906
|
+
const groupLink = chunks.join("/");
|
|
4907
|
+
resp[side.group] = groupLink;
|
|
4908
|
+
}
|
|
4909
|
+
}
|
|
4910
|
+
side?.pages?.map(async (page) => {
|
|
4911
|
+
if (typeof page === "string") {
|
|
4912
|
+
return;
|
|
3318
4913
|
}
|
|
3319
|
-
|
|
3320
|
-
|
|
4914
|
+
return flatGroups([page], resp);
|
|
4915
|
+
});
|
|
4916
|
+
});
|
|
4917
|
+
return resp;
|
|
4918
|
+
}
|
|
4919
|
+
function uniformSidebarLevelMap(pages) {
|
|
4920
|
+
const out = {};
|
|
4921
|
+
let level = 0;
|
|
4922
|
+
function recursive(items) {
|
|
4923
|
+
for (const item of items) {
|
|
4924
|
+
out[item] = level++;
|
|
4925
|
+
}
|
|
4926
|
+
}
|
|
4927
|
+
recursive(pages);
|
|
4928
|
+
return out;
|
|
4929
|
+
}
|
|
4930
|
+
async function uniformResolver(root2, matchRoute, apiFile, uniformApiResolver, sidebar, options2) {
|
|
4931
|
+
let urlPrefix = "";
|
|
4932
|
+
if (matchRoute && sidebar) {
|
|
4933
|
+
sidebar.forEach((sidebar2) => {
|
|
4934
|
+
if ("match" in sidebar2) {
|
|
4935
|
+
if (sidebar2.match === matchRoute) {
|
|
4936
|
+
if (urlPrefix) {
|
|
4937
|
+
throw new Error("multiple sidebars found for apiFile match");
|
|
4938
|
+
}
|
|
4939
|
+
urlPrefix = sidebar2.match;
|
|
4940
|
+
}
|
|
3321
4941
|
}
|
|
3322
|
-
|
|
3323
|
-
|
|
4942
|
+
});
|
|
4943
|
+
}
|
|
4944
|
+
if (!urlPrefix && options2?.urlPrefix) {
|
|
4945
|
+
urlPrefix = options2.urlPrefix;
|
|
4946
|
+
}
|
|
4947
|
+
if (!urlPrefix) {
|
|
4948
|
+
throw new Error("urlPrefix not found");
|
|
4949
|
+
}
|
|
4950
|
+
const apiFilePath = path32.join(root2, apiFile);
|
|
4951
|
+
const uniformRefs = await uniformApiResolver(apiFilePath);
|
|
4952
|
+
const uniformWithNavigation = uniform(uniformRefs, {
|
|
4953
|
+
plugins: [pluginNavigation({
|
|
4954
|
+
urlPrefix
|
|
4955
|
+
})]
|
|
4956
|
+
});
|
|
4957
|
+
let pageLevels = {};
|
|
4958
|
+
const uniformData = {
|
|
4959
|
+
slugs: {},
|
|
4960
|
+
data: [],
|
|
4961
|
+
// TODO: fix any
|
|
4962
|
+
i: 0,
|
|
4963
|
+
set: (slug, content, options3 = {}) => {
|
|
4964
|
+
if (uniformData.slugs[slug]) {
|
|
4965
|
+
console.error("slug already exists", slug);
|
|
4966
|
+
}
|
|
4967
|
+
const level = pageLevels[slug];
|
|
4968
|
+
uniformData.data[level] = {
|
|
4969
|
+
slug,
|
|
4970
|
+
content,
|
|
4971
|
+
options: options3
|
|
4972
|
+
};
|
|
4973
|
+
}
|
|
4974
|
+
};
|
|
4975
|
+
const uniformSidebars = [];
|
|
4976
|
+
if (sidebar && matchRoute) {
|
|
4977
|
+
sidebar.forEach((sidebar2) => {
|
|
4978
|
+
if ("match" in sidebar2) {
|
|
4979
|
+
if (sidebar2.match === matchRoute) {
|
|
4980
|
+
uniformSidebars.push(sidebar2);
|
|
4981
|
+
}
|
|
3324
4982
|
}
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
4983
|
+
});
|
|
4984
|
+
if (uniformSidebars.length > 1) {
|
|
4985
|
+
throw new Error("multiple sidebars found for uniform match");
|
|
4986
|
+
}
|
|
4987
|
+
}
|
|
4988
|
+
{
|
|
4989
|
+
const otherUniformPages = flatPages(uniformSidebars, {});
|
|
4990
|
+
const groups = flatGroups(uniformWithNavigation.out.sidebar);
|
|
4991
|
+
const flatUniformPages = [
|
|
4992
|
+
...otherUniformPages,
|
|
4993
|
+
...flatPages(
|
|
4994
|
+
uniformWithNavigation.out.sidebar,
|
|
4995
|
+
groups
|
|
4996
|
+
// TODO: we dont need groups - because it comes to structured page levels
|
|
4997
|
+
)
|
|
4998
|
+
];
|
|
4999
|
+
pageLevels = uniformSidebarLevelMap(flatUniformPages);
|
|
5000
|
+
{
|
|
5001
|
+
await Promise.all(otherUniformPages.map(async (page) => {
|
|
5002
|
+
const content = await fs32.readFile(path32.join(root2, page + ".mdx"), "utf-8");
|
|
5003
|
+
uniformData.set(page, content + "\n");
|
|
5004
|
+
}));
|
|
5005
|
+
await Promise.all(Object.keys(groups).map(async (group) => {
|
|
5006
|
+
try {
|
|
5007
|
+
const page = groups[group];
|
|
5008
|
+
const content = await fs32.readFile(path32.join(root2, page + ".mdx"), "utf-8");
|
|
5009
|
+
uniformData.set(page, content + "\n");
|
|
5010
|
+
} catch (e) {
|
|
3331
5011
|
}
|
|
3332
|
-
|
|
5012
|
+
}));
|
|
5013
|
+
}
|
|
5014
|
+
}
|
|
5015
|
+
await Promise.all(
|
|
5016
|
+
uniformWithNavigation.references.map(async (ref) => {
|
|
5017
|
+
const ast = referenceAST(ref);
|
|
5018
|
+
const md = compile(ast);
|
|
5019
|
+
const byCanonical = path32.join(urlPrefix, ref.canonical);
|
|
5020
|
+
const mdPath = path32.join(root2, byCanonical + ".md");
|
|
5021
|
+
const frontmatter = uniformWithNavigation.out.pageFrontMatter[byCanonical];
|
|
5022
|
+
if (!frontmatter) {
|
|
5023
|
+
console.error("frontmatter not found", byCanonical);
|
|
5024
|
+
return;
|
|
5025
|
+
}
|
|
5026
|
+
const content = (0, import_stringify.default)({ content: md }, {
|
|
5027
|
+
title: frontmatter.title
|
|
3333
5028
|
});
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
5029
|
+
await fs32.writeFile(mdPath, content);
|
|
5030
|
+
uniformData.set(byCanonical, md + "\n");
|
|
5031
|
+
})
|
|
5032
|
+
);
|
|
5033
|
+
if (!sidebar) {
|
|
5034
|
+
return {
|
|
5035
|
+
sidebar: uniformWithNavigation.out.sidebar,
|
|
5036
|
+
data: uniformData.data
|
|
3338
5037
|
};
|
|
3339
5038
|
}
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
"../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/lib/parse.js"(exports2, module2) {
|
|
3345
|
-
"use strict";
|
|
3346
|
-
var getEngine = require_engine();
|
|
3347
|
-
var defaults = require_defaults();
|
|
3348
|
-
module2.exports = function(language, str2, options2) {
|
|
3349
|
-
const opts = defaults(options2);
|
|
3350
|
-
const engine = getEngine(language, opts);
|
|
3351
|
-
if (typeof engine.parse !== "function") {
|
|
3352
|
-
throw new TypeError('expected "' + language + '.parse" to be a function');
|
|
3353
|
-
}
|
|
3354
|
-
return engine.parse(str2, opts);
|
|
5039
|
+
if (matchRoute) {
|
|
5040
|
+
uniformSidebars[0].items.push(...uniformWithNavigation.out.sidebar);
|
|
5041
|
+
return {
|
|
5042
|
+
data: uniformData.data
|
|
3355
5043
|
};
|
|
3356
5044
|
}
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
var toFile = require_to_file();
|
|
3369
|
-
var parse2 = require_parse();
|
|
3370
|
-
var utils = require_utils();
|
|
3371
|
-
function matter(input, options2) {
|
|
3372
|
-
if (input === "") {
|
|
3373
|
-
return { data: {}, content: input, excerpt: "", orig: input };
|
|
5045
|
+
sidebar.push(...uniformWithNavigation.out.sidebar);
|
|
5046
|
+
return {
|
|
5047
|
+
data: uniformData.data
|
|
5048
|
+
};
|
|
5049
|
+
}
|
|
5050
|
+
function preinstall2(id, uniformApiResolver, apiFile) {
|
|
5051
|
+
return function preinstallInner(options2) {
|
|
5052
|
+
return async function uniformPluginInner(settings, data) {
|
|
5053
|
+
const root2 = options2.root ?? process.cwd();
|
|
5054
|
+
if (!apiFile) {
|
|
5055
|
+
return;
|
|
3374
5056
|
}
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
5057
|
+
const resp = [];
|
|
5058
|
+
if (typeof apiFile === "string") {
|
|
5059
|
+
const routeMatch = settings.api?.match?.[id] || "";
|
|
5060
|
+
const resolved = await uniformResolver(
|
|
5061
|
+
root2,
|
|
5062
|
+
routeMatch,
|
|
5063
|
+
apiFile,
|
|
5064
|
+
uniformApiResolver,
|
|
5065
|
+
settings?.structure?.sidebar,
|
|
5066
|
+
options2
|
|
5067
|
+
);
|
|
5068
|
+
if (resolved.sidebar) {
|
|
5069
|
+
settings.structure = {
|
|
5070
|
+
...settings?.structure,
|
|
5071
|
+
sidebar: !settings.structure?.sidebar ? resolved.sidebar : [
|
|
5072
|
+
...!settings.structure?.sidebar || [],
|
|
5073
|
+
...resolved.sidebar
|
|
5074
|
+
]
|
|
5075
|
+
};
|
|
3382
5076
|
}
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
function parseMatter(file, options2) {
|
|
3388
|
-
const opts = defaults(options2);
|
|
3389
|
-
const open = opts.delimiters[0];
|
|
3390
|
-
const close = "\n" + opts.delimiters[1];
|
|
3391
|
-
let str2 = file.content;
|
|
3392
|
-
if (opts.language) {
|
|
3393
|
-
file.language = opts.language;
|
|
3394
|
-
}
|
|
3395
|
-
const openLen = open.length;
|
|
3396
|
-
if (!utils.startsWith(str2, open, openLen)) {
|
|
3397
|
-
excerpt(file, opts);
|
|
3398
|
-
return file;
|
|
3399
|
-
}
|
|
3400
|
-
if (str2.charAt(openLen) === open.slice(-1)) {
|
|
3401
|
-
return file;
|
|
3402
|
-
}
|
|
3403
|
-
str2 = str2.slice(openLen);
|
|
3404
|
-
const len = str2.length;
|
|
3405
|
-
const language = matter.language(str2, opts);
|
|
3406
|
-
if (language.name) {
|
|
3407
|
-
file.language = language.name;
|
|
3408
|
-
str2 = str2.slice(language.raw.length);
|
|
3409
|
-
}
|
|
3410
|
-
let closeIndex = str2.indexOf(close);
|
|
3411
|
-
if (closeIndex === -1) {
|
|
3412
|
-
closeIndex = len;
|
|
3413
|
-
}
|
|
3414
|
-
file.matter = str2.slice(0, closeIndex);
|
|
3415
|
-
const block = file.matter.replace(/^\s*#[^\n]+/gm, "").trim();
|
|
3416
|
-
if (block === "") {
|
|
3417
|
-
file.isEmpty = true;
|
|
3418
|
-
file.empty = file.content;
|
|
3419
|
-
file.data = {};
|
|
5077
|
+
resp.push({
|
|
5078
|
+
urlPrefix: routeMatch.startsWith("/") ? routeMatch : `/${routeMatch}`,
|
|
5079
|
+
data: resolved.data
|
|
5080
|
+
});
|
|
3420
5081
|
} else {
|
|
3421
|
-
|
|
5082
|
+
for (const openapiKey in apiFile) {
|
|
5083
|
+
const uniform2 = apiFile?.[openapiKey];
|
|
5084
|
+
const routeMatch = settings.api?.match?.[id]?.[openapiKey] || "";
|
|
5085
|
+
if (!routeMatch) {
|
|
5086
|
+
throw new Error(`route match not found for ${openapiKey}`);
|
|
5087
|
+
}
|
|
5088
|
+
if (!uniform2) {
|
|
5089
|
+
throw new Error(`uniform not found for ${openapiKey}`);
|
|
5090
|
+
}
|
|
5091
|
+
const resolved = await uniformResolver(
|
|
5092
|
+
root2,
|
|
5093
|
+
routeMatch,
|
|
5094
|
+
uniform2,
|
|
5095
|
+
uniformApiResolver,
|
|
5096
|
+
settings?.structure?.sidebar
|
|
5097
|
+
);
|
|
5098
|
+
if (resolved.sidebar) {
|
|
5099
|
+
settings.structure = {
|
|
5100
|
+
...settings?.structure,
|
|
5101
|
+
sidebar: !settings.structure?.sidebar ? resolved.sidebar : [
|
|
5102
|
+
...!settings.structure?.sidebar || [],
|
|
5103
|
+
...resolved.sidebar
|
|
5104
|
+
]
|
|
5105
|
+
};
|
|
5106
|
+
}
|
|
5107
|
+
resp.push({
|
|
5108
|
+
urlPrefix: routeMatch.startsWith("/") ? routeMatch : `/${routeMatch}`,
|
|
5109
|
+
data: resolved.data
|
|
5110
|
+
});
|
|
5111
|
+
}
|
|
3422
5112
|
}
|
|
3423
|
-
|
|
3424
|
-
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
5113
|
+
return resp;
|
|
5114
|
+
};
|
|
5115
|
+
};
|
|
5116
|
+
}
|
|
5117
|
+
function vitePluginUniformContent(pluginId) {
|
|
5118
|
+
return function vitePluginUniformContentInner() {
|
|
5119
|
+
return async function({
|
|
5120
|
+
preinstall: preinstall3
|
|
5121
|
+
}) {
|
|
5122
|
+
return {
|
|
5123
|
+
name: `virtual:xyd-plugin-zero/${pluginId}`,
|
|
5124
|
+
// TODO: unique name per plugin ?
|
|
5125
|
+
resolveId(id) {
|
|
5126
|
+
if (id == `virtual:xyd-plugin-zero/${pluginId}`) {
|
|
5127
|
+
return id;
|
|
5128
|
+
}
|
|
5129
|
+
},
|
|
5130
|
+
async load(id) {
|
|
5131
|
+
if (id === `virtual:xyd-plugin-zero/${pluginId}`) {
|
|
5132
|
+
if (!preinstall3.data) {
|
|
5133
|
+
return `export default ${JSON.stringify(preinstall3)}`;
|
|
5134
|
+
}
|
|
5135
|
+
return `export default ${JSON.stringify(preinstall3.data)}`;
|
|
5136
|
+
}
|
|
3429
5137
|
}
|
|
3430
|
-
|
|
3431
|
-
|
|
5138
|
+
};
|
|
5139
|
+
};
|
|
5140
|
+
};
|
|
5141
|
+
}
|
|
5142
|
+
function uniformPreset(id, apiFile, sidebar, options2, uniformApiResolver) {
|
|
5143
|
+
return function(settings) {
|
|
5144
|
+
const routeMatches = [];
|
|
5145
|
+
if (apiFile) {
|
|
5146
|
+
sidebar.forEach((sidebar2) => {
|
|
5147
|
+
if ("match" in sidebar2) {
|
|
5148
|
+
if (typeof apiFile === "string") {
|
|
5149
|
+
const routeMatch = settings?.api?.match?.[id];
|
|
5150
|
+
if (sidebar2.match === routeMatch) {
|
|
5151
|
+
routeMatches.push(routeMatch);
|
|
5152
|
+
}
|
|
5153
|
+
return;
|
|
5154
|
+
}
|
|
5155
|
+
if (typeof apiFile === "object" && !Array.isArray(apiFile)) {
|
|
5156
|
+
for (const routeMatchKey in apiFile) {
|
|
5157
|
+
const routeMatch = settings?.api?.match?.[id]?.[routeMatchKey];
|
|
5158
|
+
if (sidebar2.match === routeMatch) {
|
|
5159
|
+
routeMatches.push(routeMatch);
|
|
5160
|
+
}
|
|
5161
|
+
}
|
|
5162
|
+
}
|
|
5163
|
+
return;
|
|
3432
5164
|
}
|
|
5165
|
+
});
|
|
5166
|
+
} else {
|
|
5167
|
+
if (!options2.urlPrefix) {
|
|
5168
|
+
throw new Error("urlPrefix not found");
|
|
3433
5169
|
}
|
|
3434
|
-
|
|
3435
|
-
if (opts.sections === true || typeof opts.section === "function") {
|
|
3436
|
-
sections(file, opts.section);
|
|
3437
|
-
}
|
|
3438
|
-
return file;
|
|
5170
|
+
routeMatches.push(`${options2.urlPrefix}/*`);
|
|
3439
5171
|
}
|
|
3440
|
-
|
|
3441
|
-
|
|
3442
|
-
|
|
3443
|
-
|
|
3444
|
-
|
|
3445
|
-
|
|
3446
|
-
|
|
3447
|
-
|
|
3448
|
-
|
|
3449
|
-
|
|
5172
|
+
let basePath = "";
|
|
5173
|
+
if (process.env.XYD_CLI) {
|
|
5174
|
+
basePath = path32.join(__dirname, "./plugins/xyd-plugin-zero");
|
|
5175
|
+
} else {
|
|
5176
|
+
basePath = "../../../xyd-plugin-zero";
|
|
5177
|
+
}
|
|
5178
|
+
return {
|
|
5179
|
+
preinstall: [
|
|
5180
|
+
preinstall2(id, uniformApiResolver, apiFile)
|
|
5181
|
+
],
|
|
5182
|
+
routes: routeMatches.map(
|
|
5183
|
+
(routeMatch, i) => route2(
|
|
5184
|
+
`${routeMatch}/*`,
|
|
5185
|
+
path32.join(basePath, "src/pages/api-reference.tsx"),
|
|
5186
|
+
{
|
|
5187
|
+
id: `xyd-plugin-zero/${id}-${i}`
|
|
5188
|
+
}
|
|
5189
|
+
)
|
|
5190
|
+
),
|
|
5191
|
+
vitePlugins: [
|
|
5192
|
+
vitePluginUniformContent(id)
|
|
5193
|
+
]
|
|
3450
5194
|
};
|
|
3451
|
-
|
|
3452
|
-
|
|
5195
|
+
};
|
|
5196
|
+
}
|
|
5197
|
+
function preset2(settings, options2) {
|
|
5198
|
+
return uniformPreset(
|
|
5199
|
+
"graphql",
|
|
5200
|
+
settings?.api?.graphql || "",
|
|
5201
|
+
settings?.structure?.sidebar || [],
|
|
5202
|
+
{
|
|
5203
|
+
root: options2.root,
|
|
5204
|
+
urlPrefix: options2.urlPrefix
|
|
5205
|
+
},
|
|
5206
|
+
async (gqlPath) => {
|
|
5207
|
+
return await gqlSchemaToReferences(gqlPath);
|
|
5208
|
+
}
|
|
5209
|
+
)(settings);
|
|
5210
|
+
}
|
|
5211
|
+
var graphqlPreset = preset2;
|
|
5212
|
+
function preset3(settings, options2) {
|
|
5213
|
+
return uniformPreset(
|
|
5214
|
+
"openapi",
|
|
5215
|
+
settings?.api?.openapi || "",
|
|
5216
|
+
settings?.structure?.sidebar || [],
|
|
5217
|
+
{
|
|
5218
|
+
root: options2.root,
|
|
5219
|
+
urlPrefix: options2.urlPrefix
|
|
5220
|
+
},
|
|
5221
|
+
async (openApiPath) => {
|
|
5222
|
+
const schema = await deferencedOpenAPI(openApiPath);
|
|
5223
|
+
return oapSchemaToReferences(schema);
|
|
5224
|
+
}
|
|
5225
|
+
)(settings);
|
|
5226
|
+
}
|
|
5227
|
+
var openapiPreset = preset3;
|
|
5228
|
+
async function pluginZero() {
|
|
5229
|
+
let settings = null;
|
|
5230
|
+
const vitePlugins2 = [];
|
|
5231
|
+
const routes = [];
|
|
5232
|
+
{
|
|
5233
|
+
const options2 = {
|
|
5234
|
+
urlPrefix: ""
|
|
5235
|
+
// TODO: configurable
|
|
3453
5236
|
};
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
5237
|
+
const docs = docsPreset(void 0, options2);
|
|
5238
|
+
docs.preinstall = docs.preinstall || [];
|
|
5239
|
+
let preinstallMerge = {};
|
|
5240
|
+
for (const preinstall3 of docs.preinstall) {
|
|
5241
|
+
const resp = await preinstall3()({}, {
|
|
5242
|
+
routes: docs.routes
|
|
5243
|
+
});
|
|
5244
|
+
if (resp && typeof resp === "object") {
|
|
5245
|
+
preinstallMerge = {
|
|
5246
|
+
...preinstallMerge,
|
|
5247
|
+
...resp
|
|
5248
|
+
};
|
|
3459
5249
|
}
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
|
|
3464
|
-
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
5250
|
+
}
|
|
5251
|
+
docs.vitePlugins = docs.vitePlugins || [];
|
|
5252
|
+
for (const vitePlugin of docs.vitePlugins) {
|
|
5253
|
+
const vitePlug = await vitePlugin()({
|
|
5254
|
+
preinstall: preinstallMerge
|
|
5255
|
+
});
|
|
5256
|
+
vitePlugins2.push(vitePlug);
|
|
5257
|
+
}
|
|
5258
|
+
if ("settings" in preinstallMerge) {
|
|
5259
|
+
settings = preinstallMerge.settings;
|
|
5260
|
+
}
|
|
5261
|
+
docs.routes = docs.routes || [];
|
|
5262
|
+
routes.push(...docs.routes);
|
|
5263
|
+
}
|
|
5264
|
+
if (!settings) {
|
|
5265
|
+
throw new Error("settings not found");
|
|
5266
|
+
}
|
|
5267
|
+
if (settings?.api?.graphql) {
|
|
5268
|
+
const options2 = {};
|
|
5269
|
+
const gql = graphqlPreset(settings, options2);
|
|
5270
|
+
gql.preinstall = gql.preinstall || [];
|
|
5271
|
+
let preinstallMerge = {};
|
|
5272
|
+
for (const preinstall3 of gql.preinstall) {
|
|
5273
|
+
const resp = await preinstall3(options2)(settings, {
|
|
5274
|
+
routes: gql.routes
|
|
5275
|
+
});
|
|
5276
|
+
if (resp && typeof resp === "object") {
|
|
5277
|
+
preinstallMerge = {
|
|
5278
|
+
...preinstallMerge,
|
|
5279
|
+
...resp
|
|
5280
|
+
};
|
|
5281
|
+
}
|
|
5282
|
+
}
|
|
5283
|
+
gql.vitePlugins = gql.vitePlugins || [];
|
|
5284
|
+
for (const vitePlugin of gql.vitePlugins) {
|
|
5285
|
+
const vitePlug = await vitePlugin()({
|
|
5286
|
+
preinstall: preinstallMerge
|
|
5287
|
+
});
|
|
5288
|
+
vitePlugins2.push(vitePlug);
|
|
5289
|
+
}
|
|
5290
|
+
gql.routes = gql.routes || [];
|
|
5291
|
+
routes.push(...gql.routes);
|
|
5292
|
+
}
|
|
5293
|
+
if (settings?.api?.openapi) {
|
|
5294
|
+
const options2 = {};
|
|
5295
|
+
const oap = openapiPreset(settings, options2);
|
|
5296
|
+
oap.preinstall = oap.preinstall || [];
|
|
5297
|
+
let preinstallMerge = {};
|
|
5298
|
+
for (const preinstall3 of oap.preinstall) {
|
|
5299
|
+
const resp = await preinstall3(options2)(settings, {
|
|
5300
|
+
routes: oap.routes
|
|
5301
|
+
});
|
|
5302
|
+
if (resp && typeof resp === "object") {
|
|
5303
|
+
preinstallMerge = {
|
|
5304
|
+
...preinstallMerge,
|
|
5305
|
+
...resp
|
|
5306
|
+
};
|
|
5307
|
+
}
|
|
5308
|
+
}
|
|
5309
|
+
oap.vitePlugins = oap.vitePlugins || [];
|
|
5310
|
+
for (const vitePlugin of oap.vitePlugins) {
|
|
5311
|
+
const vitePlug = await vitePlugin()({
|
|
5312
|
+
preinstall: preinstallMerge
|
|
5313
|
+
});
|
|
5314
|
+
vitePlugins2.push(vitePlug);
|
|
5315
|
+
}
|
|
5316
|
+
oap.routes = oap.routes || [];
|
|
5317
|
+
routes.push(...oap.routes);
|
|
5318
|
+
}
|
|
5319
|
+
return {
|
|
5320
|
+
vitePlugins: vitePlugins2,
|
|
5321
|
+
settings,
|
|
5322
|
+
routes
|
|
5323
|
+
};
|
|
5324
|
+
}
|
|
5325
|
+
|
|
5326
|
+
// node_modules/@xyd-js/documan/dist/index.js
|
|
5327
|
+
import path23 from "node:path";
|
|
5328
|
+
import { fileURLToPath as fileURLToPath22 } from "node:url";
|
|
5329
|
+
import { createServer as createServer3, searchForWorkspaceRoot } from "vite";
|
|
5330
|
+
import { reactRouter as reactRouter2 } from "@xyd-js/react-router-dev/vite";
|
|
5331
|
+
import fs22 from "node:fs";
|
|
5332
|
+
import os from "node:os";
|
|
5333
|
+
import path33 from "node:path";
|
|
5334
|
+
import url from "node:url";
|
|
5335
|
+
import { createRequestHandler } from "@react-router/express";
|
|
5336
|
+
import compression from "compression";
|
|
5337
|
+
import express from "express";
|
|
5338
|
+
import morgan from "morgan";
|
|
5339
|
+
import sourceMapSupport from "source-map-support";
|
|
5340
|
+
import getPort from "get-port";
|
|
5341
|
+
var __filename = fileURLToPath2(import.meta.url);
|
|
5342
|
+
var __dirname2 = path4.dirname(__filename);
|
|
5343
|
+
async function build() {
|
|
5344
|
+
const resp = await pluginZero();
|
|
5345
|
+
if (!resp) {
|
|
5346
|
+
throw new Error("PluginZero not found");
|
|
5347
|
+
}
|
|
5348
|
+
const buildDir = path4.join(process.cwd(), ".xyd/build");
|
|
5349
|
+
{
|
|
5350
|
+
const packageJsonPath = path4.join(buildDir, "package.json");
|
|
5351
|
+
const packageJsonContent = {
|
|
5352
|
+
type: "module",
|
|
5353
|
+
scripts: {},
|
|
5354
|
+
dependencies: {
|
|
5355
|
+
// TODO: better
|
|
5356
|
+
"@xyd-js/content": "latest",
|
|
5357
|
+
"@xyd-js/components": "latest",
|
|
5358
|
+
"@xyd-js/framework": "latest",
|
|
5359
|
+
"@xyd-js/theme-poetry": "latest",
|
|
5360
|
+
"@react-router/node": "^7.1.1",
|
|
5361
|
+
"isbot": "^5"
|
|
5362
|
+
},
|
|
5363
|
+
devDependencies: {}
|
|
3469
5364
|
};
|
|
3470
|
-
|
|
5365
|
+
if (!fs4.existsSync(buildDir)) {
|
|
5366
|
+
fs4.mkdirSync(buildDir, { recursive: true });
|
|
5367
|
+
}
|
|
5368
|
+
fs4.writeFileSync(packageJsonPath, JSON.stringify(packageJsonContent, null, 2), "utf8");
|
|
5369
|
+
console.log("Installing dependencies...");
|
|
5370
|
+
execSync("npm install", { cwd: buildDir, stdio: "inherit" });
|
|
3471
5371
|
}
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
|
|
5372
|
+
try {
|
|
5373
|
+
await viteBuild({
|
|
5374
|
+
root: process.env.XYD_CLI ? __dirname2 : process.env.XYD_DOCUMAN_HOST || path4.join(__dirname2, "../host"),
|
|
5375
|
+
// @ts-ignore
|
|
5376
|
+
plugins: [
|
|
5377
|
+
...vitePlugins({
|
|
5378
|
+
toc: {
|
|
5379
|
+
minDepth: 2
|
|
5380
|
+
}
|
|
5381
|
+
}),
|
|
5382
|
+
reactRouter({
|
|
5383
|
+
outDir: buildDir,
|
|
5384
|
+
routes: resp.routes
|
|
5385
|
+
}),
|
|
5386
|
+
tsconfigPaths(),
|
|
5387
|
+
...resp.vitePlugins
|
|
5388
|
+
],
|
|
5389
|
+
optimizeDeps: {
|
|
5390
|
+
include: ["react/jsx-runtime"]
|
|
5391
|
+
}
|
|
5392
|
+
});
|
|
5393
|
+
await viteBuild({
|
|
5394
|
+
root: process.env.XYD_CLI ? __dirname2 : process.env.XYD_DOCUMAN_HOST || path4.join(__dirname2, "../host"),
|
|
5395
|
+
build: {
|
|
5396
|
+
ssr: true
|
|
5397
|
+
},
|
|
5398
|
+
// @ts-ignore
|
|
5399
|
+
plugins: [
|
|
5400
|
+
...vitePlugins({
|
|
5401
|
+
toc: {
|
|
5402
|
+
minDepth: 2
|
|
5403
|
+
}
|
|
5404
|
+
}),
|
|
5405
|
+
reactRouter({
|
|
5406
|
+
outDir: buildDir,
|
|
5407
|
+
routes: resp.routes
|
|
5408
|
+
}),
|
|
5409
|
+
tsconfigPaths(),
|
|
5410
|
+
...resp.vitePlugins
|
|
5411
|
+
],
|
|
5412
|
+
optimizeDeps: {
|
|
5413
|
+
include: ["react/jsx-runtime"]
|
|
5414
|
+
}
|
|
5415
|
+
});
|
|
5416
|
+
console.log("Build completed successfully.");
|
|
5417
|
+
} catch (error) {
|
|
5418
|
+
console.error("Build failed:", error);
|
|
5419
|
+
}
|
|
5420
|
+
}
|
|
5421
|
+
var __filename2 = fileURLToPath22(import.meta.url);
|
|
5422
|
+
var __dirname22 = path23.dirname(__filename2);
|
|
5423
|
+
var port = process.env.XYD_PORT ? parseInt(process.env.XYD_PORT) : 5175;
|
|
5424
|
+
async function dev() {
|
|
5425
|
+
const resp = await pluginZero();
|
|
5426
|
+
if (!resp) {
|
|
5427
|
+
throw new Error("PluginZero not found");
|
|
5428
|
+
}
|
|
5429
|
+
const allowCwd = searchForWorkspaceRoot(process.cwd());
|
|
5430
|
+
const preview = await createServer3({
|
|
5431
|
+
// any valid user config options, plus `mode` and `configFile`
|
|
5432
|
+
// configFile: path.join(__dirname, "../src/vite/empty-config.ts"), // TODO: bundler??
|
|
5433
|
+
// configFile: path.join(__dirname, "../"), // TODO: bundler??
|
|
5434
|
+
// root: path.join(__dirname, "../"), // TODO: bundler?
|
|
5435
|
+
root: process.env.XYD_CLI ? __dirname22 : process.env.XYD_DOCUMAN_HOST || path23.join(__dirname22, "../host"),
|
|
5436
|
+
// TODO: bundler?
|
|
5437
|
+
server: {
|
|
5438
|
+
port,
|
|
5439
|
+
fs: {
|
|
5440
|
+
allow: [
|
|
5441
|
+
allowCwd,
|
|
5442
|
+
process.env.XYD_CLI ? path23.join(__dirname22, "../../") : ""
|
|
5443
|
+
// path.join(__dirname, "../node_modules") // Ensure node_modules from xyd-documan is included
|
|
5444
|
+
]
|
|
5445
|
+
}
|
|
5446
|
+
},
|
|
5447
|
+
build: {
|
|
5448
|
+
rollupOptions: {
|
|
5449
|
+
// Exclude package `B` from the client-side bundle
|
|
5450
|
+
external: ["@xyd-js/uniform", "@xyd-js/uniform/content", "@xyd-js/plugin-zero"]
|
|
5451
|
+
}
|
|
5452
|
+
},
|
|
5453
|
+
ssr: {
|
|
5454
|
+
external: ["@xyd-js/uniform", "@xyd-js/uniform/content", "@xyd-js/plugin-zero"]
|
|
5455
|
+
// noExternal: [
|
|
5456
|
+
// "@xyd-js/uniform",
|
|
5457
|
+
// "@xyd-js/uniform/content",
|
|
5458
|
+
// "@xyd-js/plugin-zero"
|
|
5459
|
+
// ],
|
|
5460
|
+
},
|
|
5461
|
+
optimizeDeps: {
|
|
5462
|
+
include: ["react/jsx-runtime"]
|
|
5463
|
+
},
|
|
5464
|
+
// @ts-ignore
|
|
5465
|
+
plugins: [
|
|
5466
|
+
// TODO: fix plugin ts
|
|
5467
|
+
...vitePlugins({
|
|
5468
|
+
toc: {
|
|
5469
|
+
minDepth: 2
|
|
5470
|
+
}
|
|
5471
|
+
}),
|
|
5472
|
+
reactRouter2({
|
|
5473
|
+
routes: resp.routes
|
|
5474
|
+
}),
|
|
5475
|
+
...resp.vitePlugins
|
|
5476
|
+
]
|
|
5477
|
+
});
|
|
5478
|
+
await preview.listen(port);
|
|
5479
|
+
preview.printUrls();
|
|
5480
|
+
preview.bindCLIShortcuts({ print: true });
|
|
5481
|
+
}
|
|
5482
|
+
function parseNumber(raw) {
|
|
5483
|
+
if (raw === void 0) return void 0;
|
|
5484
|
+
let maybe = Number(raw);
|
|
5485
|
+
if (Number.isNaN(maybe)) return void 0;
|
|
5486
|
+
return maybe;
|
|
5487
|
+
}
|
|
5488
|
+
async function serve() {
|
|
5489
|
+
process.env.NODE_ENV = process.env.NODE_ENV ?? "production";
|
|
5490
|
+
sourceMapSupport.install({
|
|
5491
|
+
retrieveSourceMap: function(source) {
|
|
5492
|
+
let match = source.startsWith("file://");
|
|
5493
|
+
if (match) {
|
|
5494
|
+
let filePath = url.fileURLToPath(source);
|
|
5495
|
+
let sourceMapPath = `${filePath}.map`;
|
|
5496
|
+
if (fs22.existsSync(sourceMapPath)) {
|
|
5497
|
+
return {
|
|
5498
|
+
url: source,
|
|
5499
|
+
map: fs22.readFileSync(sourceMapPath, "utf8")
|
|
5500
|
+
};
|
|
5501
|
+
}
|
|
5502
|
+
}
|
|
5503
|
+
return null;
|
|
5504
|
+
}
|
|
5505
|
+
});
|
|
5506
|
+
let port2 = parseNumber(process.env.PORT) ?? await getPort({ port: 3e3 });
|
|
5507
|
+
let buildPathArg = path33.join(process.cwd(), ".xyd/build/server/index.js");
|
|
5508
|
+
if (!buildPathArg) {
|
|
5509
|
+
console.error(`
|
|
5510
|
+
Usage: react-router-serve <server-build-path> - e.g. react-router-serve build/server/index.js`);
|
|
5511
|
+
process.exit(1);
|
|
5512
|
+
}
|
|
5513
|
+
let buildPath = path33.resolve(buildPathArg);
|
|
5514
|
+
let build22 = await import(url.pathToFileURL(buildPath).href);
|
|
5515
|
+
let onListen = () => {
|
|
5516
|
+
let address = process.env.HOST || Object.values(os.networkInterfaces()).flat().find((ip) => String(ip?.family).includes("4") && !ip?.internal)?.address;
|
|
5517
|
+
if (!address) {
|
|
5518
|
+
console.log(`[xyd-serve] http://localhost:${port2}`);
|
|
5519
|
+
} else {
|
|
5520
|
+
console.log(
|
|
5521
|
+
`[xyd-serve] http://localhost:${port2} (http://${address}:${port2})`
|
|
5522
|
+
);
|
|
5523
|
+
}
|
|
5524
|
+
};
|
|
5525
|
+
build22 = {
|
|
5526
|
+
...build22,
|
|
5527
|
+
assetsBuildDirectory: path33.join(process.cwd(), ".xyd/build/client")
|
|
5528
|
+
};
|
|
5529
|
+
let app = express();
|
|
5530
|
+
app.disable("x-powered-by");
|
|
5531
|
+
app.use(compression());
|
|
5532
|
+
app.use(
|
|
5533
|
+
path33.posix.join(build22.publicPath, "assets"),
|
|
5534
|
+
express.static(path33.join(build22.assetsBuildDirectory, "assets"), {
|
|
5535
|
+
immutable: true,
|
|
5536
|
+
maxAge: "1y"
|
|
5537
|
+
})
|
|
5538
|
+
);
|
|
5539
|
+
app.use(build22.publicPath, express.static(build22.assetsBuildDirectory));
|
|
5540
|
+
app.use(express.static("public", { maxAge: "1h" }));
|
|
5541
|
+
app.use(morgan("tiny"));
|
|
5542
|
+
app.all(
|
|
5543
|
+
"*",
|
|
5544
|
+
createRequestHandler({
|
|
5545
|
+
build: build22,
|
|
5546
|
+
mode: process.env.NODE_ENV
|
|
5547
|
+
})
|
|
5548
|
+
);
|
|
5549
|
+
let server = process.env.HOST ? app.listen(port2, process.env.HOST, onListen) : app.listen(port2, onListen);
|
|
5550
|
+
["SIGTERM", "SIGINT"].forEach((signal) => {
|
|
5551
|
+
process.once(signal, () => server?.close(console.error));
|
|
5552
|
+
});
|
|
5553
|
+
}
|
|
3475
5554
|
|
|
3476
|
-
|
|
3477
|
-
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
|
|
3482
|
-
|
|
5555
|
+
// src/commands.ts
|
|
5556
|
+
async function build2(root2, options2 = {}) {
|
|
5557
|
+
await build();
|
|
5558
|
+
}
|
|
5559
|
+
async function start(root2, options2 = {}) {
|
|
5560
|
+
await serve();
|
|
5561
|
+
await new Promise(() => {
|
|
5562
|
+
});
|
|
5563
|
+
}
|
|
5564
|
+
async function dev2(root2, options2 = {}) {
|
|
5565
|
+
await dev();
|
|
5566
|
+
await new Promise(() => {
|
|
5567
|
+
});
|
|
5568
|
+
}
|
|
5569
|
+
|
|
5570
|
+
// src/run.ts
|
|
5571
|
+
var helpText = `
|
|
5572
|
+
${import_picocolors.default.blueBright("xyd")}
|
|
5573
|
+
|
|
5574
|
+
${import_picocolors.default.underline("Usage")}:
|
|
5575
|
+
$ xyd build [${import_picocolors.default.yellowBright("projectDir")}]
|
|
5576
|
+
$ xyd start [${import_picocolors.default.yellowBright("projectDir")}]
|
|
5577
|
+
$ xyd dev [${import_picocolors.default.yellowBright("projectDir")}]
|
|
5578
|
+
|
|
5579
|
+
${import_picocolors.default.underline("Options")}:
|
|
5580
|
+
--help, -h Print this help message and exit
|
|
5581
|
+
--version, -v Print the CLI version and exit
|
|
5582
|
+
|
|
5583
|
+
${import_picocolors.default.underline("Build your project")}:
|
|
5584
|
+
|
|
5585
|
+
$ xyd build
|
|
5586
|
+
|
|
5587
|
+
|
|
5588
|
+
${import_picocolors.default.underline("Start your production server")}:
|
|
5589
|
+
|
|
5590
|
+
$ xyd start
|
|
5591
|
+
|
|
5592
|
+
${import_picocolors.default.underline("Run your project locally in development")}:
|
|
5593
|
+
|
|
5594
|
+
$ xyd dev
|
|
5595
|
+
`;
|
|
5596
|
+
async function run(argv = process.argv.slice(2)) {
|
|
5597
|
+
process.env.XYD_CLI = "true";
|
|
5598
|
+
let versions = process.versions;
|
|
5599
|
+
let MINIMUM_NODE_VERSION = 20;
|
|
5600
|
+
if (versions && versions.node && semver.major(versions.node) < MINIMUM_NODE_VERSION) {
|
|
5601
|
+
console.warn(
|
|
5602
|
+
`\uFE0F\u26A0\uFE0F Oops, Node v${versions.node} detected. xyd requires a Node version greater than ${MINIMUM_NODE_VERSION}.`
|
|
5603
|
+
);
|
|
5604
|
+
}
|
|
5605
|
+
let args = arg(
|
|
5606
|
+
{
|
|
5607
|
+
"--help": Boolean,
|
|
5608
|
+
"-h": "--help",
|
|
5609
|
+
"--version": Boolean,
|
|
5610
|
+
"-v": "--version",
|
|
5611
|
+
"--port": Number,
|
|
5612
|
+
"-p": "--port",
|
|
5613
|
+
"--logLevel": String,
|
|
5614
|
+
"-l": "--logLevel"
|
|
5615
|
+
},
|
|
5616
|
+
{
|
|
5617
|
+
argv
|
|
5618
|
+
}
|
|
5619
|
+
);
|
|
5620
|
+
let input = args._;
|
|
5621
|
+
let flags = Object.entries(args).reduce((acc, [key, value]) => {
|
|
5622
|
+
key = key.replace(/^--/, "");
|
|
5623
|
+
acc[key] = value;
|
|
5624
|
+
return acc;
|
|
5625
|
+
}, {});
|
|
5626
|
+
if (flags.help) {
|
|
5627
|
+
console.log(helpText);
|
|
5628
|
+
return;
|
|
5629
|
+
}
|
|
5630
|
+
if (flags.version) {
|
|
5631
|
+
let version = require_package().version;
|
|
5632
|
+
console.log(version);
|
|
5633
|
+
return;
|
|
5634
|
+
}
|
|
5635
|
+
let command = input[0];
|
|
5636
|
+
switch (command) {
|
|
5637
|
+
case "build":
|
|
5638
|
+
await build2(input[1], flags);
|
|
5639
|
+
break;
|
|
5640
|
+
case "start":
|
|
5641
|
+
await start(input[1], flags);
|
|
5642
|
+
break;
|
|
5643
|
+
case "dev":
|
|
5644
|
+
await dev2(input[1], flags);
|
|
5645
|
+
break;
|
|
5646
|
+
default:
|
|
5647
|
+
await dev2(input[0], flags);
|
|
5648
|
+
}
|
|
5649
|
+
}
|
|
5650
|
+
|
|
5651
|
+
// index.ts
|
|
5652
|
+
run().then(
|
|
5653
|
+
() => {
|
|
5654
|
+
process.exit(0);
|
|
5655
|
+
},
|
|
5656
|
+
(error) => {
|
|
5657
|
+
if (error) console.error(error);
|
|
5658
|
+
process.exit(1);
|
|
5659
|
+
}
|
|
5660
|
+
);
|
|
5661
|
+
/*! Bundled license information:
|
|
3483
5662
|
|
|
3484
|
-
|
|
3485
|
-
(*!
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
5663
|
+
@xyd-js/plugin-zero/dist/index.js:
|
|
5664
|
+
(*! Bundled license information:
|
|
5665
|
+
|
|
5666
|
+
strip-bom-string/index.js:
|
|
5667
|
+
(*!
|
|
5668
|
+
* strip-bom-string <https://github.com/jonschlinkert/strip-bom-string>
|
|
5669
|
+
*
|
|
5670
|
+
* Copyright (c) 2015, 2017, Jon Schlinkert.
|
|
5671
|
+
* Released under the MIT License.
|
|
5672
|
+
*)
|
|
5673
|
+
*)
|
|
3491
5674
|
*/
|
|
3492
|
-
//# sourceMappingURL=gray-matter.js.map
|