@lukoweb/apitogo 0.1.42 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.js +380 -264
- package/dist/declarations/config/local-manifest.d.ts +80 -0
- package/docs/configuration/authentication.md +11 -2
- package/package.json +9 -1
- package/src/config/local-manifest.ts +142 -0
- package/src/types.d.ts +5 -0
- package/src/vite/dev-portal-env.ts +0 -72
- package/src/vite/plugin-local-manifest.ts +79 -0
- package/src/vite/plugin.ts +2 -0
package/dist/cli/cli.js
CHANGED
|
@@ -131,7 +131,7 @@ import { stat } from "node:fs/promises";
|
|
|
131
131
|
var fileExists;
|
|
132
132
|
var init_file_exists = __esm({
|
|
133
133
|
"src/config/file-exists.ts"() {
|
|
134
|
-
fileExists = (
|
|
134
|
+
fileExists = (path38) => stat(path38).then(() => true).catch(() => false);
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
137
|
|
|
@@ -3889,7 +3889,7 @@ __export(llms_exports, {
|
|
|
3889
3889
|
generateLlmsTxtFiles: () => generateLlmsTxtFiles
|
|
3890
3890
|
});
|
|
3891
3891
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
3892
|
-
import
|
|
3892
|
+
import path25 from "node:path";
|
|
3893
3893
|
import colors6 from "picocolors";
|
|
3894
3894
|
async function generateLlmsTxtFiles({
|
|
3895
3895
|
markdownFileInfos,
|
|
@@ -3924,7 +3924,7 @@ async function generateLlmsTxtFiles({
|
|
|
3924
3924
|
}
|
|
3925
3925
|
}
|
|
3926
3926
|
const llmsTxt2 = llmsTxtParts.join("\n");
|
|
3927
|
-
await writeFile4(
|
|
3927
|
+
await writeFile4(path25.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
|
|
3928
3928
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
3929
3929
|
console.log(colors6.blue("\u2713 generated llms.txt"));
|
|
3930
3930
|
}
|
|
@@ -3952,7 +3952,7 @@ ${info.content}
|
|
|
3952
3952
|
}
|
|
3953
3953
|
const llmsFull = llmsFullParts.join("\n");
|
|
3954
3954
|
await writeFile4(
|
|
3955
|
-
|
|
3955
|
+
path25.join(baseOutputDir, "llms-full.txt"),
|
|
3956
3956
|
llmsFull,
|
|
3957
3957
|
"utf-8"
|
|
3958
3958
|
);
|
|
@@ -3973,11 +3973,11 @@ import { hideBin } from "yargs/helpers";
|
|
|
3973
3973
|
import yargs from "yargs/yargs";
|
|
3974
3974
|
|
|
3975
3975
|
// src/cli/build/handler.ts
|
|
3976
|
-
import
|
|
3976
|
+
import path29 from "node:path";
|
|
3977
3977
|
|
|
3978
3978
|
// src/vite/build.ts
|
|
3979
|
-
import { mkdir as mkdir5, readFile as
|
|
3980
|
-
import
|
|
3979
|
+
import { mkdir as mkdir5, readFile as readFile3, rename, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
|
|
3980
|
+
import path27 from "node:path";
|
|
3981
3981
|
import { build as esbuild } from "esbuild";
|
|
3982
3982
|
import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
|
|
3983
3983
|
|
|
@@ -4113,7 +4113,7 @@ init_invariant();
|
|
|
4113
4113
|
init_joinUrl();
|
|
4114
4114
|
|
|
4115
4115
|
// src/vite/config.ts
|
|
4116
|
-
import
|
|
4116
|
+
import path22 from "node:path";
|
|
4117
4117
|
import dotenv from "dotenv";
|
|
4118
4118
|
import colors4 from "picocolors";
|
|
4119
4119
|
import {
|
|
@@ -4124,7 +4124,7 @@ import {
|
|
|
4124
4124
|
// package.json
|
|
4125
4125
|
var package_default = {
|
|
4126
4126
|
name: "@lukoweb/apitogo",
|
|
4127
|
-
version: "0.1.
|
|
4127
|
+
version: "0.1.44",
|
|
4128
4128
|
type: "module",
|
|
4129
4129
|
sideEffects: [
|
|
4130
4130
|
"**/*.css",
|
|
@@ -4192,7 +4192,8 @@ var package_default = {
|
|
|
4192
4192
|
"./main.css": "./src/app/main.css",
|
|
4193
4193
|
"./processors/*": "./src/lib/plugins/openapi/processors/*.ts",
|
|
4194
4194
|
"./with-zuplo": "./src/zuplo/with-zuplo.ts",
|
|
4195
|
-
"./testing": "./src/lib/testing/index.tsx"
|
|
4195
|
+
"./testing": "./src/lib/testing/index.tsx",
|
|
4196
|
+
"./local-manifest": "./src/config/local-manifest.ts"
|
|
4196
4197
|
},
|
|
4197
4198
|
scripts: {
|
|
4198
4199
|
build: "esbuild src/cli/cli.ts src/vite/prerender/worker.ts --outdir=dist/cli --entry-names=[name] --bundle --format=esm --packages=external --target=node20 --platform=node --log-level=error",
|
|
@@ -4502,6 +4503,10 @@ var package_default = {
|
|
|
4502
4503
|
"./testing": {
|
|
4503
4504
|
types: "./dist/declarations/lib/testing/index.d.ts",
|
|
4504
4505
|
default: "./src/lib/testing/index.tsx"
|
|
4506
|
+
},
|
|
4507
|
+
"./local-manifest": {
|
|
4508
|
+
types: "./dist/declarations/config/local-manifest.d.ts",
|
|
4509
|
+
default: "./src/config/local-manifest.ts"
|
|
4505
4510
|
}
|
|
4506
4511
|
}
|
|
4507
4512
|
}
|
|
@@ -4515,47 +4520,7 @@ init_ZudokuConfig();
|
|
|
4515
4520
|
init_joinUrl();
|
|
4516
4521
|
|
|
4517
4522
|
// src/vite/dev-portal-env.ts
|
|
4518
|
-
import { readFile } from "node:fs/promises";
|
|
4519
|
-
import path4 from "node:path";
|
|
4520
4523
|
import { loadEnv as loadEnv2 } from "vite";
|
|
4521
|
-
var DEV_PORTAL_MANIFEST_FILENAME = "apitogo.local.json";
|
|
4522
|
-
function normalizeBillingPeriod(period) {
|
|
4523
|
-
if (!period) {
|
|
4524
|
-
return "monthly";
|
|
4525
|
-
}
|
|
4526
|
-
const normalized = period.toLowerCase();
|
|
4527
|
-
if (normalized === "month") {
|
|
4528
|
-
return "monthly";
|
|
4529
|
-
}
|
|
4530
|
-
if (normalized === "year") {
|
|
4531
|
-
return "annual";
|
|
4532
|
-
}
|
|
4533
|
-
return normalized;
|
|
4534
|
-
}
|
|
4535
|
-
function plansToMockEnvValue(plans) {
|
|
4536
|
-
if (!plans?.length) {
|
|
4537
|
-
return null;
|
|
4538
|
-
}
|
|
4539
|
-
const mockPlans = plans.map((plan) => ({
|
|
4540
|
-
sku: plan.sku,
|
|
4541
|
-
displayName: plan.displayName,
|
|
4542
|
-
isFree: plan.isFree,
|
|
4543
|
-
priceAmount: plan.priceAmount ?? 0,
|
|
4544
|
-
priceCurrency: plan.priceCurrency ?? "usd",
|
|
4545
|
-
billingPeriod: normalizeBillingPeriod(plan.billingPeriod),
|
|
4546
|
-
limitsJson: plan.limitsJson ?? null
|
|
4547
|
-
}));
|
|
4548
|
-
return JSON.stringify(mockPlans);
|
|
4549
|
-
}
|
|
4550
|
-
async function readDevPortalManifest(rootDir) {
|
|
4551
|
-
const manifestPath = path4.join(rootDir, DEV_PORTAL_MANIFEST_FILENAME);
|
|
4552
|
-
try {
|
|
4553
|
-
const raw = await readFile(manifestPath, "utf8");
|
|
4554
|
-
return JSON.parse(raw);
|
|
4555
|
-
} catch {
|
|
4556
|
-
return null;
|
|
4557
|
-
}
|
|
4558
|
-
}
|
|
4559
4524
|
async function loadDevPortalViteDefines(rootDir, mode) {
|
|
4560
4525
|
const env = loadEnv2(mode, rootDir, "VITE_");
|
|
4561
4526
|
const defines = {};
|
|
@@ -4563,34 +4528,29 @@ async function loadDevPortalViteDefines(rootDir, mode) {
|
|
|
4563
4528
|
if (apiUrl) {
|
|
4564
4529
|
defines.VITE_APITOGO_DEV_PORTAL_API_URL = JSON.stringify(apiUrl);
|
|
4565
4530
|
}
|
|
4566
|
-
const manifest = await readDevPortalManifest(rootDir);
|
|
4567
|
-
const mockPlansValue = plansToMockEnvValue(manifest?.plans);
|
|
4568
|
-
if (mockPlansValue) {
|
|
4569
|
-
defines.VITE_APITOGO_DEV_PORTAL_MOCK_PLANS = JSON.stringify(mockPlansValue);
|
|
4570
|
-
}
|
|
4571
4531
|
return defines;
|
|
4572
4532
|
}
|
|
4573
4533
|
|
|
4574
4534
|
// src/vite/package-root.ts
|
|
4575
4535
|
init_file_exists();
|
|
4576
|
-
import
|
|
4536
|
+
import path4 from "node:path";
|
|
4577
4537
|
var findPackageRoot = async (startDir) => {
|
|
4578
4538
|
let dir = startDir;
|
|
4579
|
-
while (dir !==
|
|
4580
|
-
if (await fileExists(
|
|
4581
|
-
dir =
|
|
4539
|
+
while (dir !== path4.dirname(dir)) {
|
|
4540
|
+
if (await fileExists(path4.join(dir, "package.json"))) return dir;
|
|
4541
|
+
dir = path4.dirname(dir);
|
|
4582
4542
|
}
|
|
4583
4543
|
};
|
|
4584
4544
|
|
|
4585
4545
|
// src/vite/pagefind-dev-stub.ts
|
|
4586
4546
|
import fs from "node:fs/promises";
|
|
4587
|
-
import
|
|
4547
|
+
import path5 from "node:path";
|
|
4588
4548
|
var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
|
|
4589
4549
|
async function ensurePagefindDevStub(publicDir) {
|
|
4590
|
-
const pagefindPath =
|
|
4550
|
+
const pagefindPath = path5.join(publicDir, "pagefind/pagefind.js");
|
|
4591
4551
|
const exists = await fs.stat(pagefindPath).catch(() => false);
|
|
4592
4552
|
if (!exists) {
|
|
4593
|
-
await fs.mkdir(
|
|
4553
|
+
await fs.mkdir(path5.dirname(pagefindPath), { recursive: true });
|
|
4594
4554
|
await fs.writeFile(pagefindPath, NOT_BUILT_YET);
|
|
4595
4555
|
}
|
|
4596
4556
|
}
|
|
@@ -4602,7 +4562,7 @@ import react from "@vitejs/plugin-react";
|
|
|
4602
4562
|
// src/vite/css/plugin.ts
|
|
4603
4563
|
init_loader();
|
|
4604
4564
|
init_plugin_theme();
|
|
4605
|
-
import
|
|
4565
|
+
import path6 from "node:path";
|
|
4606
4566
|
import { isCSSRequest as isCSSRequest2 } from "vite";
|
|
4607
4567
|
|
|
4608
4568
|
// src/vite/css/collect.ts
|
|
@@ -4637,7 +4597,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
|
|
|
4637
4597
|
function vitePluginSsrCss(pluginOpts) {
|
|
4638
4598
|
let server;
|
|
4639
4599
|
const config2 = getCurrentConfig();
|
|
4640
|
-
const virtualHref =
|
|
4600
|
+
const virtualHref = path6.join(
|
|
4641
4601
|
config2.basePath ?? "",
|
|
4642
4602
|
`/@id/__x00__${VIRTUAL_ENTRY}?direct`
|
|
4643
4603
|
);
|
|
@@ -4736,16 +4696,16 @@ var getZuploSystemConfigurations = (string) => {
|
|
|
4736
4696
|
// src/vite/plugin-api-keys.ts
|
|
4737
4697
|
var viteApiKeysPlugin = () => {
|
|
4738
4698
|
const virtualModuleId4 = "virtual:zudoku-api-keys-plugin";
|
|
4739
|
-
const
|
|
4699
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
4740
4700
|
return {
|
|
4741
4701
|
name: "zudoku-api-keys-plugin",
|
|
4742
4702
|
resolveId(id) {
|
|
4743
4703
|
if (id === virtualModuleId4) {
|
|
4744
|
-
return
|
|
4704
|
+
return resolvedVirtualModuleId5;
|
|
4745
4705
|
}
|
|
4746
4706
|
},
|
|
4747
4707
|
async load(id) {
|
|
4748
|
-
if (id ===
|
|
4708
|
+
if (id === resolvedVirtualModuleId5) {
|
|
4749
4709
|
const config2 = getCurrentConfig();
|
|
4750
4710
|
const apiKeysPath = config2.__resolvedModules.userPanel.apiKeys.path;
|
|
4751
4711
|
if (!config2.__resolvedModules.userPanel.apiKeys.enabled || config2.__meta.mode === "standalone") {
|
|
@@ -4774,7 +4734,7 @@ var plugin_api_keys_default = viteApiKeysPlugin;
|
|
|
4774
4734
|
|
|
4775
4735
|
// src/vite/plugin-api.ts
|
|
4776
4736
|
import fs3 from "node:fs/promises";
|
|
4777
|
-
import
|
|
4737
|
+
import path12 from "node:path";
|
|
4778
4738
|
import { deepEqual as deepEqual2 } from "fast-equals";
|
|
4779
4739
|
import { runnerImport as runnerImport3 } from "vite";
|
|
4780
4740
|
init_package_json();
|
|
@@ -4783,7 +4743,7 @@ init_loader();
|
|
|
4783
4743
|
// src/config/validators/BuildSchema.ts
|
|
4784
4744
|
init_file_exists();
|
|
4785
4745
|
init_loader();
|
|
4786
|
-
import
|
|
4746
|
+
import path7 from "node:path";
|
|
4787
4747
|
import { runnerImport as runnerImport2 } from "vite";
|
|
4788
4748
|
import { z as z9 } from "zod";
|
|
4789
4749
|
var BuildProcessorSchema = z9.custom((val) => typeof val === "function");
|
|
@@ -4812,7 +4772,7 @@ var buildConfigFiles = [
|
|
|
4812
4772
|
];
|
|
4813
4773
|
async function getBuildConfigFilePath(rootDir) {
|
|
4814
4774
|
for (const fileName of buildConfigFiles) {
|
|
4815
|
-
const filepath =
|
|
4775
|
+
const filepath = path7.join(rootDir, fileName);
|
|
4816
4776
|
if (await fileExists(filepath)) {
|
|
4817
4777
|
return filepath;
|
|
4818
4778
|
}
|
|
@@ -4921,14 +4881,14 @@ var flattenAllOf = (schema2) => {
|
|
|
4921
4881
|
};
|
|
4922
4882
|
|
|
4923
4883
|
// src/lib/util/traverse.ts
|
|
4924
|
-
var traverse = (specification, transform,
|
|
4925
|
-
const transformed = transform(specification,
|
|
4884
|
+
var traverse = (specification, transform, path38 = []) => {
|
|
4885
|
+
const transformed = transform(specification, path38);
|
|
4926
4886
|
if (typeof transformed !== "object" || transformed === null) {
|
|
4927
4887
|
return transformed;
|
|
4928
4888
|
}
|
|
4929
4889
|
const result = Array.isArray(transformed) ? [] : {};
|
|
4930
4890
|
for (const [key, value] of Object.entries(transformed)) {
|
|
4931
|
-
const currentPath = [...
|
|
4891
|
+
const currentPath = [...path38, key];
|
|
4932
4892
|
if (Array.isArray(value)) {
|
|
4933
4893
|
result[key] = value.map(
|
|
4934
4894
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -4956,9 +4916,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
4956
4916
|
if (schemaCache?.has(ref)) {
|
|
4957
4917
|
return schemaCache.get(ref);
|
|
4958
4918
|
}
|
|
4959
|
-
const
|
|
4919
|
+
const path38 = ref.split("/").slice(1);
|
|
4960
4920
|
let current = schema2;
|
|
4961
|
-
for (const segment of
|
|
4921
|
+
for (const segment of path38) {
|
|
4962
4922
|
if (!current || typeof current !== "object") {
|
|
4963
4923
|
current = null;
|
|
4964
4924
|
}
|
|
@@ -4977,7 +4937,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4977
4937
|
}
|
|
4978
4938
|
const cloned = structuredClone(schema2);
|
|
4979
4939
|
const visited = /* @__PURE__ */ new Set();
|
|
4980
|
-
const resolve = async (current,
|
|
4940
|
+
const resolve = async (current, path38) => {
|
|
4981
4941
|
if (isIndexableObject(current)) {
|
|
4982
4942
|
if (visited.has(current)) {
|
|
4983
4943
|
return CIRCULAR_REF;
|
|
@@ -4985,7 +4945,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4985
4945
|
visited.add(current);
|
|
4986
4946
|
if (Array.isArray(current)) {
|
|
4987
4947
|
for (let index = 0; index < current.length; index++) {
|
|
4988
|
-
current[index] = await resolve(current[index], `${
|
|
4948
|
+
current[index] = await resolve(current[index], `${path38}/${index}`);
|
|
4989
4949
|
}
|
|
4990
4950
|
} else {
|
|
4991
4951
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -4996,13 +4956,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4996
4956
|
for (const resolver of resolvers) {
|
|
4997
4957
|
const resolved = await resolver($ref);
|
|
4998
4958
|
if (resolved) {
|
|
4999
|
-
result2 = await resolve(resolved,
|
|
4959
|
+
result2 = await resolve(resolved, path38);
|
|
5000
4960
|
break;
|
|
5001
4961
|
}
|
|
5002
4962
|
}
|
|
5003
4963
|
if (result2 === void 0) {
|
|
5004
4964
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
5005
|
-
result2 = await resolve(resolved,
|
|
4965
|
+
result2 = await resolve(resolved, path38);
|
|
5006
4966
|
}
|
|
5007
4967
|
if (hasSiblings) {
|
|
5008
4968
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -5015,7 +4975,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
5015
4975
|
return result2;
|
|
5016
4976
|
}
|
|
5017
4977
|
for (const key in current) {
|
|
5018
|
-
current[key] = await resolve(current[key], `${
|
|
4978
|
+
current[key] = await resolve(current[key], `${path38}/${key}`);
|
|
5019
4979
|
}
|
|
5020
4980
|
}
|
|
5021
4981
|
visited.delete(current);
|
|
@@ -5054,9 +5014,9 @@ var upgradeSchema = (schema2) => {
|
|
|
5054
5014
|
}
|
|
5055
5015
|
return sub;
|
|
5056
5016
|
});
|
|
5057
|
-
schema2 = traverse(schema2, (sub,
|
|
5017
|
+
schema2 = traverse(schema2, (sub, path38) => {
|
|
5058
5018
|
if (sub.example !== void 0) {
|
|
5059
|
-
if (isSchemaPath(
|
|
5019
|
+
if (isSchemaPath(path38 ?? [])) {
|
|
5060
5020
|
sub.examples = [sub.example];
|
|
5061
5021
|
} else {
|
|
5062
5022
|
sub.examples = {
|
|
@@ -5069,11 +5029,11 @@ var upgradeSchema = (schema2) => {
|
|
|
5069
5029
|
}
|
|
5070
5030
|
return sub;
|
|
5071
5031
|
});
|
|
5072
|
-
schema2 = traverse(schema2, (schema3,
|
|
5032
|
+
schema2 = traverse(schema2, (schema3, path38) => {
|
|
5073
5033
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
5074
|
-
const parentPath =
|
|
5034
|
+
const parentPath = path38?.slice(0, -1);
|
|
5075
5035
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
5076
|
-
return segment === "content" &&
|
|
5036
|
+
return segment === "content" && path38?.[index + 1] === "multipart/form-data";
|
|
5077
5037
|
});
|
|
5078
5038
|
if (isMultipart) {
|
|
5079
5039
|
const entries = Object.entries(schema3.properties);
|
|
@@ -5087,8 +5047,8 @@ var upgradeSchema = (schema2) => {
|
|
|
5087
5047
|
}
|
|
5088
5048
|
return schema3;
|
|
5089
5049
|
});
|
|
5090
|
-
schema2 = traverse(schema2, (schema3,
|
|
5091
|
-
if (
|
|
5050
|
+
schema2 = traverse(schema2, (schema3, path38) => {
|
|
5051
|
+
if (path38?.includes("content") && path38.includes("application/octet-stream")) {
|
|
5092
5052
|
return {};
|
|
5093
5053
|
}
|
|
5094
5054
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -5114,11 +5074,11 @@ var upgradeSchema = (schema2) => {
|
|
|
5114
5074
|
}
|
|
5115
5075
|
return sub;
|
|
5116
5076
|
});
|
|
5117
|
-
schema2 = traverse(schema2, (schema3,
|
|
5077
|
+
schema2 = traverse(schema2, (schema3, path38) => {
|
|
5118
5078
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
5119
|
-
const parentPath =
|
|
5079
|
+
const parentPath = path38?.slice(0, -1);
|
|
5120
5080
|
const contentMediaType = parentPath?.find(
|
|
5121
|
-
(_, index) =>
|
|
5081
|
+
(_, index) => path38?.[index - 1] === "content"
|
|
5122
5082
|
);
|
|
5123
5083
|
return {
|
|
5124
5084
|
type: "string",
|
|
@@ -5130,7 +5090,7 @@ var upgradeSchema = (schema2) => {
|
|
|
5130
5090
|
});
|
|
5131
5091
|
return schema2;
|
|
5132
5092
|
};
|
|
5133
|
-
function isSchemaPath(
|
|
5093
|
+
function isSchemaPath(path38) {
|
|
5134
5094
|
const schemaLocations = [
|
|
5135
5095
|
["components", "schemas"],
|
|
5136
5096
|
"properties",
|
|
@@ -5143,10 +5103,10 @@ function isSchemaPath(path37) {
|
|
|
5143
5103
|
];
|
|
5144
5104
|
return schemaLocations.some((location) => {
|
|
5145
5105
|
if (Array.isArray(location)) {
|
|
5146
|
-
return location.every((segment, index) =>
|
|
5106
|
+
return location.every((segment, index) => path38[index] === segment);
|
|
5147
5107
|
}
|
|
5148
|
-
return
|
|
5149
|
-
}) ||
|
|
5108
|
+
return path38.includes(location);
|
|
5109
|
+
}) || path38.includes("schema") || path38.some((segment) => segment.endsWith("Schema"));
|
|
5150
5110
|
}
|
|
5151
5111
|
|
|
5152
5112
|
// src/lib/oas/parser/index.ts
|
|
@@ -5228,13 +5188,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
5228
5188
|
"anyOf",
|
|
5229
5189
|
"oneOf"
|
|
5230
5190
|
]);
|
|
5231
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
5191
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path38 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
5232
5192
|
if (obj === null || typeof obj !== "object") return obj;
|
|
5233
5193
|
const refPath = obj.__$ref;
|
|
5234
5194
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
5235
5195
|
if (isCircular) {
|
|
5236
5196
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
5237
|
-
const circularProp =
|
|
5197
|
+
const circularProp = path38.find((p) => !OPENAPI_PROPS.has(p)) || path38[0];
|
|
5238
5198
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
5239
5199
|
}
|
|
5240
5200
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -5244,7 +5204,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
5244
5204
|
value,
|
|
5245
5205
|
currentPath,
|
|
5246
5206
|
refs,
|
|
5247
|
-
[...
|
|
5207
|
+
[...path38, key],
|
|
5248
5208
|
currentRefPaths
|
|
5249
5209
|
);
|
|
5250
5210
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -5279,7 +5239,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
5279
5239
|
var getAllTags = (schema2) => {
|
|
5280
5240
|
const rootTags = schema2.tags ?? [];
|
|
5281
5241
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
5282
|
-
(
|
|
5242
|
+
(path38) => HttpMethods.map((k) => path38?.[k]).filter((op) => op != null)
|
|
5283
5243
|
);
|
|
5284
5244
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
5285
5245
|
const hasUntaggedOperations = operations.some(
|
|
@@ -5334,7 +5294,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
5334
5294
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
5335
5295
|
var getAllOperations = (paths) => {
|
|
5336
5296
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
5337
|
-
([
|
|
5297
|
+
([path38, value]) => HttpMethods.flatMap((method) => {
|
|
5338
5298
|
if (!value?.[method]) return [];
|
|
5339
5299
|
const operation = value[method];
|
|
5340
5300
|
const pathParameters = value.parameters ?? [];
|
|
@@ -5354,7 +5314,7 @@ var getAllOperations = (paths) => {
|
|
|
5354
5314
|
return {
|
|
5355
5315
|
...operation,
|
|
5356
5316
|
method,
|
|
5357
|
-
path:
|
|
5317
|
+
path: path38,
|
|
5358
5318
|
parameters,
|
|
5359
5319
|
servers,
|
|
5360
5320
|
tags: operation.tags ?? []
|
|
@@ -5712,8 +5672,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
5712
5672
|
}),
|
|
5713
5673
|
paths: t.field({
|
|
5714
5674
|
type: [PathItem],
|
|
5715
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
5716
|
-
path:
|
|
5675
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path38, value]) => ({
|
|
5676
|
+
path: path38,
|
|
5717
5677
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
5718
5678
|
methods: Object.keys(value)
|
|
5719
5679
|
}))
|
|
@@ -5808,7 +5768,7 @@ var ensureArray = (value) => Array.isArray(value) ? value : [value];
|
|
|
5808
5768
|
|
|
5809
5769
|
// src/vite/api/SchemaManager.ts
|
|
5810
5770
|
import fs2 from "node:fs/promises";
|
|
5811
|
-
import
|
|
5771
|
+
import path8 from "node:path";
|
|
5812
5772
|
import {
|
|
5813
5773
|
$RefParser as $RefParser2
|
|
5814
5774
|
} from "@apidevtools/json-schema-ref-parser";
|
|
@@ -5860,7 +5820,7 @@ init_joinUrl();
|
|
|
5860
5820
|
|
|
5861
5821
|
// src/vite/api/schema-codegen.ts
|
|
5862
5822
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
5863
|
-
var getSegmentsFromPath = (
|
|
5823
|
+
var getSegmentsFromPath = (path38) => path38.split("/").slice(1).map(unescapeJsonPointer);
|
|
5864
5824
|
var createLocalRefMap = (obj) => {
|
|
5865
5825
|
const refMap = /* @__PURE__ */ new Map();
|
|
5866
5826
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -5891,16 +5851,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
5891
5851
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
5892
5852
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
5893
5853
|
);
|
|
5894
|
-
var lookup = (schema2,
|
|
5895
|
-
const parts = getSegmentsFromPath(
|
|
5854
|
+
var lookup = (schema2, path38, filePath) => {
|
|
5855
|
+
const parts = getSegmentsFromPath(path38);
|
|
5896
5856
|
let val = schema2;
|
|
5897
5857
|
for (const part of parts) {
|
|
5898
5858
|
while (val.$ref?.startsWith("#/")) {
|
|
5899
|
-
val = val.$ref ===
|
|
5859
|
+
val = val.$ref === path38 ? val : lookup(schema2, val.$ref, filePath);
|
|
5900
5860
|
}
|
|
5901
5861
|
if (val[part] === void 0) {
|
|
5902
5862
|
throw new Error(
|
|
5903
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
5863
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path38}`
|
|
5904
5864
|
);
|
|
5905
5865
|
}
|
|
5906
5866
|
val = val[part];
|
|
@@ -5998,18 +5958,18 @@ var SchemaManager = class {
|
|
|
5998
5958
|
];
|
|
5999
5959
|
}
|
|
6000
5960
|
getPathForFile = (input, params) => {
|
|
6001
|
-
const filePath =
|
|
5961
|
+
const filePath = path8.resolve(this.config.__meta.rootDir, input);
|
|
6002
5962
|
const apis = ensureArray(this.config.apis ?? []);
|
|
6003
5963
|
for (const apiConfig of apis) {
|
|
6004
5964
|
if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
|
|
6005
5965
|
const match = normalizeInputs(apiConfig.input).some(
|
|
6006
|
-
(i) =>
|
|
5966
|
+
(i) => path8.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
|
|
6007
5967
|
);
|
|
6008
5968
|
if (match) return apiConfig.path;
|
|
6009
5969
|
}
|
|
6010
5970
|
};
|
|
6011
5971
|
processSchema = async (input) => {
|
|
6012
|
-
const filePath =
|
|
5972
|
+
const filePath = path8.resolve(this.config.__meta.rootDir, input.input);
|
|
6013
5973
|
const params = input.params;
|
|
6014
5974
|
const configuredPath = this.getPathForFile(input.input, params);
|
|
6015
5975
|
if (!configuredPath) {
|
|
@@ -6045,9 +6005,9 @@ var SchemaManager = class {
|
|
|
6045
6005
|
const processedTime = Date.now();
|
|
6046
6006
|
const code = generateCode(processedSchema, filePath);
|
|
6047
6007
|
const prefixPath = slugify(configuredPath);
|
|
6048
|
-
const processedFilePath =
|
|
6008
|
+
const processedFilePath = path8.posix.join(
|
|
6049
6009
|
this.storeDir,
|
|
6050
|
-
`${prefixPath}-${
|
|
6010
|
+
`${prefixPath}-${path8.basename(filePath)}${paramsSuffix(params)}.js`
|
|
6051
6011
|
);
|
|
6052
6012
|
const importKey = processedFilePath;
|
|
6053
6013
|
await fs2.writeFile(processedFilePath, code);
|
|
@@ -6096,7 +6056,7 @@ var SchemaManager = class {
|
|
|
6096
6056
|
};
|
|
6097
6057
|
getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
|
|
6098
6058
|
getFilesToReprocess = (changedFile) => {
|
|
6099
|
-
const resolvedPath =
|
|
6059
|
+
const resolvedPath = path8.resolve(this.config.__meta.rootDir, changedFile);
|
|
6100
6060
|
const referencedBy = this.referencedBy.get(resolvedPath);
|
|
6101
6061
|
if (!referencedBy) return [];
|
|
6102
6062
|
const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
|
|
@@ -6125,7 +6085,7 @@ var SchemaManager = class {
|
|
|
6125
6085
|
version: "",
|
|
6126
6086
|
path: input.path ?? "",
|
|
6127
6087
|
label: input.label,
|
|
6128
|
-
inputPath:
|
|
6088
|
+
inputPath: path8.resolve(this.config.__meta.rootDir, input.input),
|
|
6129
6089
|
params: input.params,
|
|
6130
6090
|
importKey: "",
|
|
6131
6091
|
downloadUrl: "",
|
|
@@ -6145,8 +6105,8 @@ var SchemaManager = class {
|
|
|
6145
6105
|
}
|
|
6146
6106
|
}
|
|
6147
6107
|
};
|
|
6148
|
-
getLatestSchema = (
|
|
6149
|
-
getSchemasForPath = (
|
|
6108
|
+
getLatestSchema = (path38) => this.processedSchemas[path38]?.at(0);
|
|
6109
|
+
getSchemasForPath = (path38) => this.processedSchemas[path38];
|
|
6150
6110
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
6151
6111
|
getUrlToFilePathMap = () => {
|
|
6152
6112
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -6168,7 +6128,7 @@ var SchemaManager = class {
|
|
|
6168
6128
|
};
|
|
6169
6129
|
createSchemaPath = (inputPath, versionPath, apiPath, params) => {
|
|
6170
6130
|
const suffix = paramsSuffix(params);
|
|
6171
|
-
const extension = suffix ? ".json" :
|
|
6131
|
+
const extension = suffix ? ".json" : path8.extname(inputPath);
|
|
6172
6132
|
return joinUrl(
|
|
6173
6133
|
this.config.basePath,
|
|
6174
6134
|
apiPath,
|
|
@@ -6191,7 +6151,7 @@ var SchemaManager = class {
|
|
|
6191
6151
|
// src/vite/plugin-config-reload.ts
|
|
6192
6152
|
init_logger();
|
|
6193
6153
|
init_loader();
|
|
6194
|
-
import
|
|
6154
|
+
import path11 from "node:path";
|
|
6195
6155
|
import colors3 from "picocolors";
|
|
6196
6156
|
|
|
6197
6157
|
// src/vite/plugin-navigation.ts
|
|
@@ -6201,14 +6161,14 @@ import { stringify as stringify3 } from "javascript-stringify";
|
|
|
6201
6161
|
import { isElement } from "react-is";
|
|
6202
6162
|
|
|
6203
6163
|
// src/config/validators/NavigationSchema.ts
|
|
6204
|
-
import
|
|
6164
|
+
import path9 from "node:path";
|
|
6205
6165
|
import { glob } from "glob";
|
|
6206
6166
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
6207
6167
|
import { mdxFromMarkdown } from "mdast-util-mdx";
|
|
6208
6168
|
import { mdxjs } from "micromark-extension-mdxjs";
|
|
6209
6169
|
|
|
6210
6170
|
// src/lib/util/readFrontmatter.ts
|
|
6211
|
-
import { readFile
|
|
6171
|
+
import { readFile } from "node:fs/promises";
|
|
6212
6172
|
import matter from "gray-matter";
|
|
6213
6173
|
import { parse, stringify as stringify2 } from "yaml";
|
|
6214
6174
|
var yaml = {
|
|
@@ -6216,7 +6176,7 @@ var yaml = {
|
|
|
6216
6176
|
stringify: (obj) => stringify2(obj)
|
|
6217
6177
|
};
|
|
6218
6178
|
var readFrontmatter = async (filePath) => {
|
|
6219
|
-
const content = await
|
|
6179
|
+
const content = await readFile(filePath, "utf-8");
|
|
6220
6180
|
const normalizedContent = content.replace(/\r\n/g, "\n");
|
|
6221
6181
|
return matter(normalizedContent, { engines: { yaml } });
|
|
6222
6182
|
};
|
|
@@ -6252,7 +6212,7 @@ var extractRichH1 = (content) => {
|
|
|
6252
6212
|
}
|
|
6253
6213
|
};
|
|
6254
6214
|
var isNavigationItem = (item) => item !== void 0;
|
|
6255
|
-
var toPosixPath = (filePath) => filePath.split(
|
|
6215
|
+
var toPosixPath = (filePath) => filePath.split(path9.win32.sep).join(path9.posix.sep);
|
|
6256
6216
|
var NavigationResolver = class {
|
|
6257
6217
|
rootDir;
|
|
6258
6218
|
globPatterns;
|
|
@@ -6385,13 +6345,13 @@ init_invariant();
|
|
|
6385
6345
|
|
|
6386
6346
|
// src/vite/debug.ts
|
|
6387
6347
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
6388
|
-
import
|
|
6348
|
+
import path10 from "node:path";
|
|
6389
6349
|
async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
|
|
6390
6350
|
if (process.env.ZUDOKU_BUILD_DEBUG) {
|
|
6391
|
-
const debugDir =
|
|
6351
|
+
const debugDir = path10.join(rootDir, "dist", "debug");
|
|
6392
6352
|
await mkdir(debugDir, { recursive: true });
|
|
6393
6353
|
await writeFile(
|
|
6394
|
-
|
|
6354
|
+
path10.join(debugDir, `${pluginName}.${extension}`),
|
|
6395
6355
|
typeof code === "string" ? code : code.join("\n")
|
|
6396
6356
|
);
|
|
6397
6357
|
}
|
|
@@ -6502,7 +6462,7 @@ var viteConfigReloadPlugin = () => ({
|
|
|
6502
6462
|
});
|
|
6503
6463
|
logger.info(
|
|
6504
6464
|
colors3.blue(
|
|
6505
|
-
`Config ${
|
|
6465
|
+
`Config ${path11.basename(currentConfig.__meta.configPath)} changed. Reloading...`
|
|
6506
6466
|
),
|
|
6507
6467
|
{ timestamp: true }
|
|
6508
6468
|
);
|
|
@@ -6513,14 +6473,14 @@ var viteConfigReloadPlugin = () => ({
|
|
|
6513
6473
|
// src/vite/plugin-api.ts
|
|
6514
6474
|
var viteApiPlugin = async () => {
|
|
6515
6475
|
const virtualModuleId4 = "virtual:zudoku-api-plugins";
|
|
6516
|
-
const
|
|
6476
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
6517
6477
|
const initialConfig = getCurrentConfig();
|
|
6518
6478
|
const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
|
|
6519
|
-
|
|
6479
|
+
path12.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
|
|
6520
6480
|
).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
|
|
6521
6481
|
const buildConfig = await getBuildConfig();
|
|
6522
6482
|
const buildProcessors = buildConfig?.processors ?? [];
|
|
6523
|
-
const tmpStoreDir =
|
|
6483
|
+
const tmpStoreDir = path12.posix.join(
|
|
6524
6484
|
initialConfig.__meta.rootDir,
|
|
6525
6485
|
"node_modules/.apitogo/processed"
|
|
6526
6486
|
);
|
|
@@ -6548,7 +6508,7 @@ var viteApiPlugin = async () => {
|
|
|
6548
6508
|
const inputPath = pathMap.get(req.url);
|
|
6549
6509
|
if (!inputPath) return next();
|
|
6550
6510
|
const content = await fs3.readFile(inputPath, "utf-8");
|
|
6551
|
-
const mimeType =
|
|
6511
|
+
const mimeType = path12.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
|
|
6552
6512
|
res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
|
|
6553
6513
|
return res.end(content);
|
|
6554
6514
|
});
|
|
@@ -6566,11 +6526,11 @@ var viteApiPlugin = async () => {
|
|
|
6566
6526
|
},
|
|
6567
6527
|
resolveId(id) {
|
|
6568
6528
|
if (id === virtualModuleId4) {
|
|
6569
|
-
return
|
|
6529
|
+
return resolvedVirtualModuleId5;
|
|
6570
6530
|
}
|
|
6571
6531
|
},
|
|
6572
6532
|
async load(id) {
|
|
6573
|
-
if (id !==
|
|
6533
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
6574
6534
|
const config2 = getCurrentConfig();
|
|
6575
6535
|
if (!deepEqual2(schemaManager.config.apis, config2.apis)) {
|
|
6576
6536
|
schemaManager.config = config2;
|
|
@@ -6736,8 +6696,8 @@ var viteApiPlugin = async () => {
|
|
|
6736
6696
|
if (process.env.NODE_ENV !== "production") return;
|
|
6737
6697
|
for (const [urlPath, inputPath] of pathMap) {
|
|
6738
6698
|
const content = await fs3.readFile(inputPath, "utf-8");
|
|
6739
|
-
const outputPath =
|
|
6740
|
-
await fs3.mkdir(
|
|
6699
|
+
const outputPath = path12.join(config2.__meta.rootDir, "dist", urlPath);
|
|
6700
|
+
await fs3.mkdir(path12.dirname(outputPath), { recursive: true });
|
|
6741
6701
|
await fs3.writeFile(outputPath, content, "utf-8");
|
|
6742
6702
|
}
|
|
6743
6703
|
}
|
|
@@ -6749,17 +6709,17 @@ var plugin_api_default = viteApiPlugin;
|
|
|
6749
6709
|
init_loader();
|
|
6750
6710
|
var viteAuthPlugin = () => {
|
|
6751
6711
|
const virtualModuleId4 = "virtual:zudoku-auth";
|
|
6752
|
-
const
|
|
6712
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
6753
6713
|
return {
|
|
6754
6714
|
name: "zudoku-auth-plugin",
|
|
6755
6715
|
// required, will show up in warnings and errors
|
|
6756
6716
|
resolveId(id) {
|
|
6757
6717
|
if (id === virtualModuleId4) {
|
|
6758
|
-
return
|
|
6718
|
+
return resolvedVirtualModuleId5;
|
|
6759
6719
|
}
|
|
6760
6720
|
},
|
|
6761
6721
|
async load(id) {
|
|
6762
|
-
if (id ===
|
|
6722
|
+
if (id === resolvedVirtualModuleId5) {
|
|
6763
6723
|
const config2 = getCurrentConfig();
|
|
6764
6724
|
if (!config2.authentication || config2.__meta.mode === "standalone") {
|
|
6765
6725
|
return `export const configuredAuthProvider = undefined;`;
|
|
@@ -6780,7 +6740,7 @@ var plugin_auth_default = viteAuthPlugin;
|
|
|
6780
6740
|
|
|
6781
6741
|
// src/vite/plugin-component.ts
|
|
6782
6742
|
init_loader();
|
|
6783
|
-
import
|
|
6743
|
+
import path13 from "node:path";
|
|
6784
6744
|
var viteAliasPlugin = () => {
|
|
6785
6745
|
return {
|
|
6786
6746
|
name: "zudoku-component-plugin",
|
|
@@ -6808,7 +6768,7 @@ var viteAliasPlugin = () => {
|
|
|
6808
6768
|
];
|
|
6809
6769
|
const aliases = replacements.map(([find, replacement]) => ({
|
|
6810
6770
|
find,
|
|
6811
|
-
replacement:
|
|
6771
|
+
replacement: path13.posix.join(config2.__meta.moduleDir, replacement)
|
|
6812
6772
|
}));
|
|
6813
6773
|
return config2.__meta.mode === "internal" || config2.__meta.mode === "standalone" ? { resolve: { alias: aliases } } : void 0;
|
|
6814
6774
|
}
|
|
@@ -6880,16 +6840,16 @@ var plugin_config_default = viteConfigPlugin;
|
|
|
6880
6840
|
init_loader();
|
|
6881
6841
|
var viteCustomPagesPlugin = () => {
|
|
6882
6842
|
const virtualModuleId4 = "virtual:zudoku-custom-pages-plugin";
|
|
6883
|
-
const
|
|
6843
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
6884
6844
|
return {
|
|
6885
6845
|
name: "zudoku-custom-pages-plugin",
|
|
6886
6846
|
resolveId(id) {
|
|
6887
6847
|
if (id === virtualModuleId4) {
|
|
6888
|
-
return
|
|
6848
|
+
return resolvedVirtualModuleId5;
|
|
6889
6849
|
}
|
|
6890
6850
|
},
|
|
6891
6851
|
async load(id) {
|
|
6892
|
-
if (id ===
|
|
6852
|
+
if (id === resolvedVirtualModuleId5) {
|
|
6893
6853
|
const config2 = getCurrentConfig();
|
|
6894
6854
|
if (config2.__meta.mode === "standalone" || !config2.navigation) {
|
|
6895
6855
|
return `export const configuredCustomPagesPlugin = undefined;`;
|
|
@@ -6945,7 +6905,7 @@ var viteDocMetadataPlugin = () => ({
|
|
|
6945
6905
|
|
|
6946
6906
|
// src/vite/plugin-docs.ts
|
|
6947
6907
|
init_loader();
|
|
6948
|
-
import
|
|
6908
|
+
import path14 from "node:path";
|
|
6949
6909
|
import { glob as glob3 } from "glob";
|
|
6950
6910
|
import globParent from "glob-parent";
|
|
6951
6911
|
init_ZudokuConfig();
|
|
@@ -7014,7 +6974,7 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
7014
6974
|
if (process.env.NODE_ENV !== "development") {
|
|
7015
6975
|
const draftStatuses = await Promise.all(
|
|
7016
6976
|
globbedFiles.map(async (file) => {
|
|
7017
|
-
const absolutePath =
|
|
6977
|
+
const absolutePath = path14.resolve(config2.__meta.rootDir, file);
|
|
7018
6978
|
const { data } = await readFrontmatter(absolutePath);
|
|
7019
6979
|
return { file, isDraft: data.draft === true };
|
|
7020
6980
|
})
|
|
@@ -7027,9 +6987,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
7027
6987
|
if (draftFiles.has(file)) {
|
|
7028
6988
|
continue;
|
|
7029
6989
|
}
|
|
7030
|
-
const relativePath =
|
|
6990
|
+
const relativePath = path14.posix.relative(parent, file);
|
|
7031
6991
|
const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
|
|
7032
|
-
const filePath = options.absolute ?
|
|
6992
|
+
const filePath = options.absolute ? path14.resolve(config2.__meta.rootDir, file) : file;
|
|
7033
6993
|
fileMapping[routePath] = filePath;
|
|
7034
6994
|
}
|
|
7035
6995
|
}
|
|
@@ -7065,16 +7025,16 @@ var resolveCustomNavigationPaths = async (config2, fileMapping) => {
|
|
|
7065
7025
|
};
|
|
7066
7026
|
var viteDocsPlugin = () => {
|
|
7067
7027
|
const virtualModuleId4 = "virtual:zudoku-docs-plugin";
|
|
7068
|
-
const
|
|
7028
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7069
7029
|
return {
|
|
7070
7030
|
name: "zudoku-docs-plugin",
|
|
7071
7031
|
resolveId(id) {
|
|
7072
7032
|
if (id === virtualModuleId4) {
|
|
7073
|
-
return
|
|
7033
|
+
return resolvedVirtualModuleId5;
|
|
7074
7034
|
}
|
|
7075
7035
|
},
|
|
7076
7036
|
async load(id) {
|
|
7077
|
-
if (id !==
|
|
7037
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
7078
7038
|
const config2 = getCurrentConfig();
|
|
7079
7039
|
if (config2.__meta.mode === "standalone" || !config2.__resolvedModules.docs.enabled) {
|
|
7080
7040
|
return `export const configuredDocsPlugin = undefined;`;
|
|
@@ -7093,7 +7053,7 @@ var viteDocsPlugin = () => {
|
|
|
7093
7053
|
const globbedDocuments = {};
|
|
7094
7054
|
for (const [routePath, file] of Object.entries(fileMapping)) {
|
|
7095
7055
|
const importPath = ensureLeadingSlash(
|
|
7096
|
-
|
|
7056
|
+
path14.posix.join(globImportBasePath, file)
|
|
7097
7057
|
);
|
|
7098
7058
|
globbedDocuments[routePath] = importPath;
|
|
7099
7059
|
}
|
|
@@ -7121,7 +7081,7 @@ init_loader();
|
|
|
7121
7081
|
init_ProtectedRoutesSchema();
|
|
7122
7082
|
init_joinUrl();
|
|
7123
7083
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
7124
|
-
import
|
|
7084
|
+
import path15 from "node:path";
|
|
7125
7085
|
import { matchPath } from "react-router";
|
|
7126
7086
|
var processMarkdownFile = async (filePath) => {
|
|
7127
7087
|
const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
|
|
@@ -7209,7 +7169,7 @@ var viteMarkdownExportPlugin = () => {
|
|
|
7209
7169
|
if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
|
|
7210
7170
|
return;
|
|
7211
7171
|
}
|
|
7212
|
-
const distDir =
|
|
7172
|
+
const distDir = path15.join(
|
|
7213
7173
|
config2.__meta.rootDir,
|
|
7214
7174
|
"dist",
|
|
7215
7175
|
config2.basePath ?? ""
|
|
@@ -7230,15 +7190,15 @@ var viteMarkdownExportPlugin = () => {
|
|
|
7230
7190
|
content: finalMarkdown
|
|
7231
7191
|
});
|
|
7232
7192
|
const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
|
|
7233
|
-
const outputPath = `${
|
|
7234
|
-
await mkdir2(
|
|
7193
|
+
const outputPath = `${path15.join(distDir, ...segments)}.md`;
|
|
7194
|
+
await mkdir2(path15.dirname(outputPath), { recursive: true });
|
|
7235
7195
|
await writeFile2(outputPath, finalMarkdown, "utf-8");
|
|
7236
7196
|
} catch (error) {
|
|
7237
7197
|
console.warn(`Failed to export markdown for ${routePath}:`, error);
|
|
7238
7198
|
}
|
|
7239
7199
|
}
|
|
7240
7200
|
if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
|
|
7241
|
-
const markdownInfoPath =
|
|
7201
|
+
const markdownInfoPath = path15.join(
|
|
7242
7202
|
config2.__meta.rootDir,
|
|
7243
7203
|
"node_modules/.apitogo/markdown-info.json"
|
|
7244
7204
|
);
|
|
@@ -7390,9 +7350,9 @@ var remarkCodeTabs = () => (tree) => {
|
|
|
7390
7350
|
};
|
|
7391
7351
|
|
|
7392
7352
|
// src/vite/mdx/remark-inject-filepath.ts
|
|
7393
|
-
import
|
|
7353
|
+
import path16 from "node:path";
|
|
7394
7354
|
var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
|
|
7395
|
-
const relativePath =
|
|
7355
|
+
const relativePath = path16.relative(rootDir, vfile.path).split(path16.sep).join(path16.posix.sep);
|
|
7396
7356
|
tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
|
|
7397
7357
|
};
|
|
7398
7358
|
|
|
@@ -7479,18 +7439,18 @@ var remarkLastModified = () => {
|
|
|
7479
7439
|
};
|
|
7480
7440
|
|
|
7481
7441
|
// src/vite/mdx/remark-link-rewrite.ts
|
|
7482
|
-
import
|
|
7442
|
+
import path17 from "node:path";
|
|
7483
7443
|
import { visit as visit5 } from "unist-util-visit";
|
|
7484
7444
|
var remarkLinkRewrite = (basePath = "") => (tree) => {
|
|
7485
7445
|
visit5(tree, "link", (node) => {
|
|
7486
7446
|
if (!node.url) return;
|
|
7487
7447
|
if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
|
|
7488
7448
|
node.url = node.url.replace(/\\/g, "/");
|
|
7489
|
-
const base =
|
|
7449
|
+
const base = path17.posix.join(basePath);
|
|
7490
7450
|
if (basePath && node.url.startsWith(base)) {
|
|
7491
7451
|
node.url = node.url.slice(base.length);
|
|
7492
7452
|
} else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
|
|
7493
|
-
node.url =
|
|
7453
|
+
node.url = path17.posix.join("..", node.url);
|
|
7494
7454
|
}
|
|
7495
7455
|
node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
|
|
7496
7456
|
});
|
|
@@ -7710,23 +7670,23 @@ var plugin_mdx_default = viteMdxPlugin;
|
|
|
7710
7670
|
|
|
7711
7671
|
// src/vite/plugin-modules.ts
|
|
7712
7672
|
init_loader();
|
|
7713
|
-
import
|
|
7673
|
+
import path18 from "node:path";
|
|
7714
7674
|
import { normalizePath as normalizePath2 } from "vite";
|
|
7715
|
-
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
7716
|
-
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
7717
|
-
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(
|
|
7675
|
+
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path18.join(moduleDir, "../module-landing/src/index.tsx")) : "@lukoweb/apitogo-module-landing";
|
|
7676
|
+
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path18.join(moduleDir, "../module-user-panel/src/index.tsx")) : "@lukoweb/apitogo-module-user-panel";
|
|
7677
|
+
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(path18.resolve(rootDir, pagePath));
|
|
7718
7678
|
var viteModulesPlugin = () => {
|
|
7719
7679
|
const virtualModuleId4 = "virtual:zudoku-modules-plugin";
|
|
7720
|
-
const
|
|
7680
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7721
7681
|
return {
|
|
7722
7682
|
name: "zudoku-modules-plugin",
|
|
7723
7683
|
resolveId(id) {
|
|
7724
7684
|
if (id === virtualModuleId4) {
|
|
7725
|
-
return
|
|
7685
|
+
return resolvedVirtualModuleId5;
|
|
7726
7686
|
}
|
|
7727
7687
|
},
|
|
7728
7688
|
async load(id) {
|
|
7729
|
-
if (id !==
|
|
7689
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
7730
7690
|
const config2 = getCurrentConfig();
|
|
7731
7691
|
const { landing, userPanel } = config2.__resolvedModules;
|
|
7732
7692
|
if (config2.__meta.mode === "standalone") {
|
|
@@ -7827,10 +7787,10 @@ var plugin_modules_default = viteModulesPlugin;
|
|
|
7827
7787
|
|
|
7828
7788
|
// src/vite/plugin-search.ts
|
|
7829
7789
|
init_loader();
|
|
7830
|
-
import
|
|
7790
|
+
import path19 from "node:path";
|
|
7831
7791
|
var viteSearchPlugin = () => {
|
|
7832
7792
|
const virtualModuleId4 = "virtual:zudoku-search-plugin";
|
|
7833
|
-
const
|
|
7793
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7834
7794
|
let resolvedViteConfig;
|
|
7835
7795
|
return {
|
|
7836
7796
|
name: "zudoku-search-plugin",
|
|
@@ -7842,14 +7802,14 @@ var viteSearchPlugin = () => {
|
|
|
7842
7802
|
},
|
|
7843
7803
|
resolveId(id) {
|
|
7844
7804
|
if (id === virtualModuleId4) {
|
|
7845
|
-
return
|
|
7805
|
+
return resolvedVirtualModuleId5;
|
|
7846
7806
|
}
|
|
7847
7807
|
if (id === "/pagefind/pagefind.js" && resolvedViteConfig?.publicDir) {
|
|
7848
|
-
return
|
|
7808
|
+
return path19.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
|
|
7849
7809
|
}
|
|
7850
7810
|
},
|
|
7851
7811
|
async load(id) {
|
|
7852
|
-
if (id !==
|
|
7812
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
7853
7813
|
const config2 = getCurrentConfig();
|
|
7854
7814
|
if (!config2.search || config2.__meta.mode === "standalone") {
|
|
7855
7815
|
return `export const configuredSearchPlugin = undefined;`;
|
|
@@ -7889,7 +7849,7 @@ var aliasToId = new Map(
|
|
|
7889
7849
|
var resolveLang = (lang) => aliasToId.get(lang) ?? lang;
|
|
7890
7850
|
var viteShikiRegisterPlugin = () => {
|
|
7891
7851
|
const virtualModuleId4 = "virtual:zudoku-shiki-register";
|
|
7892
|
-
const
|
|
7852
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7893
7853
|
return {
|
|
7894
7854
|
name: "vite-plugin-shiki-register",
|
|
7895
7855
|
config() {
|
|
@@ -7918,11 +7878,11 @@ var viteShikiRegisterPlugin = () => {
|
|
|
7918
7878
|
},
|
|
7919
7879
|
resolveId(id) {
|
|
7920
7880
|
if (id === virtualModuleId4) {
|
|
7921
|
-
return
|
|
7881
|
+
return resolvedVirtualModuleId5;
|
|
7922
7882
|
}
|
|
7923
7883
|
},
|
|
7924
7884
|
async load(id) {
|
|
7925
|
-
if (id !==
|
|
7885
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
7926
7886
|
const config2 = getCurrentConfig();
|
|
7927
7887
|
const languages = config2.syntaxHighlighting?.languages ?? defaultLanguages;
|
|
7928
7888
|
const themes = Object.values(
|
|
@@ -7956,12 +7916,168 @@ var viteShikiRegisterPlugin = () => {
|
|
|
7956
7916
|
};
|
|
7957
7917
|
};
|
|
7958
7918
|
|
|
7919
|
+
// src/vite/plugin-local-manifest.ts
|
|
7920
|
+
import path21 from "node:path";
|
|
7921
|
+
|
|
7922
|
+
// src/config/local-manifest.ts
|
|
7923
|
+
import path20 from "node:path";
|
|
7924
|
+
import { z as z10 } from "zod";
|
|
7925
|
+
var DEV_PORTAL_MANIFEST_FILENAME = "apitogo.local.json";
|
|
7926
|
+
var BillingPeriodSchema = z10.enum([
|
|
7927
|
+
"month",
|
|
7928
|
+
"year",
|
|
7929
|
+
"monthly",
|
|
7930
|
+
"annual"
|
|
7931
|
+
]);
|
|
7932
|
+
var ManifestPlanInputSchema = z10.object({
|
|
7933
|
+
sku: z10.string().min(1),
|
|
7934
|
+
displayName: z10.string().min(1),
|
|
7935
|
+
isFree: z10.boolean(),
|
|
7936
|
+
priceAmount: z10.number().optional(),
|
|
7937
|
+
priceCurrency: z10.string().optional(),
|
|
7938
|
+
billingPeriod: BillingPeriodSchema.optional(),
|
|
7939
|
+
limitsJson: z10.string().optional(),
|
|
7940
|
+
includedActionKeys: z10.array(z10.string()).optional()
|
|
7941
|
+
});
|
|
7942
|
+
var DevPortalLocalManifestSchema = z10.object({
|
|
7943
|
+
siteName: z10.string().optional(),
|
|
7944
|
+
branding: z10.object({
|
|
7945
|
+
title: z10.string().optional(),
|
|
7946
|
+
logoUrl: z10.string().optional()
|
|
7947
|
+
}).optional(),
|
|
7948
|
+
plans: z10.array(ManifestPlanInputSchema).optional(),
|
|
7949
|
+
backend: z10.object({
|
|
7950
|
+
sourceDirectory: z10.string().optional(),
|
|
7951
|
+
publishDirectory: z10.string().optional(),
|
|
7952
|
+
openApiPath: z10.string().optional(),
|
|
7953
|
+
runtime: z10.string().optional(),
|
|
7954
|
+
runtimeVersion: z10.string().optional(),
|
|
7955
|
+
deployed: z10.boolean().optional()
|
|
7956
|
+
}).optional(),
|
|
7957
|
+
gateway: z10.object({
|
|
7958
|
+
authMode: z10.enum(["platformManagedEntra", "bringYourOwnOidc"]).optional(),
|
|
7959
|
+
oidcMetadataUrl: z10.string().optional(),
|
|
7960
|
+
oidcAllowedIssuers: z10.array(z10.string()).optional(),
|
|
7961
|
+
oidcAudiences: z10.array(z10.string()).optional(),
|
|
7962
|
+
limitsJson: z10.string().optional(),
|
|
7963
|
+
publicHealthActionKey: z10.string().optional()
|
|
7964
|
+
}).optional(),
|
|
7965
|
+
projectId: z10.string().optional(),
|
|
7966
|
+
projectName: z10.string().optional()
|
|
7967
|
+
});
|
|
7968
|
+
function normalizeBillingPeriod(period) {
|
|
7969
|
+
if (!period) {
|
|
7970
|
+
return "monthly";
|
|
7971
|
+
}
|
|
7972
|
+
const normalized = period.toLowerCase();
|
|
7973
|
+
if (normalized === "month") {
|
|
7974
|
+
return "monthly";
|
|
7975
|
+
}
|
|
7976
|
+
if (normalized === "year") {
|
|
7977
|
+
return "annual";
|
|
7978
|
+
}
|
|
7979
|
+
return normalized;
|
|
7980
|
+
}
|
|
7981
|
+
function plansToPreviewCatalog(plans) {
|
|
7982
|
+
if (!plans?.length) {
|
|
7983
|
+
return { plans: [] };
|
|
7984
|
+
}
|
|
7985
|
+
return {
|
|
7986
|
+
plans: plans.map((plan) => ({
|
|
7987
|
+
sku: plan.sku,
|
|
7988
|
+
displayName: plan.displayName,
|
|
7989
|
+
isFree: plan.isFree,
|
|
7990
|
+
priceAmount: plan.priceAmount ?? 0,
|
|
7991
|
+
priceCurrency: plan.priceCurrency ?? "usd",
|
|
7992
|
+
billingPeriod: normalizeBillingPeriod(plan.billingPeriod),
|
|
7993
|
+
limitsJson: plan.limitsJson ?? null,
|
|
7994
|
+
includedActionKeys: plan.includedActionKeys ?? []
|
|
7995
|
+
}))
|
|
7996
|
+
};
|
|
7997
|
+
}
|
|
7998
|
+
function manifestFilePath(rootDir) {
|
|
7999
|
+
return path20.join(path20.resolve(rootDir), DEV_PORTAL_MANIFEST_FILENAME);
|
|
8000
|
+
}
|
|
8001
|
+
function parseLocalManifestJson(raw) {
|
|
8002
|
+
try {
|
|
8003
|
+
const parsed = JSON.parse(raw);
|
|
8004
|
+
const result = DevPortalLocalManifestSchema.safeParse(parsed);
|
|
8005
|
+
if (!result.success) {
|
|
8006
|
+
return null;
|
|
8007
|
+
}
|
|
8008
|
+
return result.data;
|
|
8009
|
+
} catch {
|
|
8010
|
+
return null;
|
|
8011
|
+
}
|
|
8012
|
+
}
|
|
8013
|
+
|
|
8014
|
+
// src/vite/plugin-local-manifest.ts
|
|
8015
|
+
var APITOGO_LOCAL_MANIFEST_VIRTUAL_ID = "virtual:apitogo-local-manifest";
|
|
8016
|
+
var resolvedVirtualModuleId4 = `\0${APITOGO_LOCAL_MANIFEST_VIRTUAL_ID}`;
|
|
8017
|
+
var viteLocalManifestPlugin = () => {
|
|
8018
|
+
let rootDir = "";
|
|
8019
|
+
let manifestPath = "";
|
|
8020
|
+
const loadManifestModule = async () => {
|
|
8021
|
+
const { readFile: readFile8 } = await import("node:fs/promises");
|
|
8022
|
+
let catalog = { plans: [] };
|
|
8023
|
+
try {
|
|
8024
|
+
const raw = await readFile8(manifestPath, "utf8");
|
|
8025
|
+
const manifest = parseLocalManifestJson(raw);
|
|
8026
|
+
catalog = plansToPreviewCatalog(manifest?.plans);
|
|
8027
|
+
} catch {
|
|
8028
|
+
}
|
|
8029
|
+
return `export default ${JSON.stringify(catalog)};`;
|
|
8030
|
+
};
|
|
8031
|
+
return {
|
|
8032
|
+
name: "apitogo-local-manifest-plugin",
|
|
8033
|
+
configResolved(resolvedConfig) {
|
|
8034
|
+
rootDir = resolvedConfig.root;
|
|
8035
|
+
manifestPath = manifestFilePath(rootDir);
|
|
8036
|
+
},
|
|
8037
|
+
resolveId(id) {
|
|
8038
|
+
if (id === APITOGO_LOCAL_MANIFEST_VIRTUAL_ID) {
|
|
8039
|
+
return resolvedVirtualModuleId4;
|
|
8040
|
+
}
|
|
8041
|
+
},
|
|
8042
|
+
async load(id) {
|
|
8043
|
+
if (id !== resolvedVirtualModuleId4) {
|
|
8044
|
+
return;
|
|
8045
|
+
}
|
|
8046
|
+
return loadManifestModule();
|
|
8047
|
+
},
|
|
8048
|
+
configureServer(server) {
|
|
8049
|
+
const watchPath = path21.join(rootDir, DEV_PORTAL_MANIFEST_FILENAME);
|
|
8050
|
+
server.watcher.add(watchPath);
|
|
8051
|
+
server.watcher.on("change", async (changedPath) => {
|
|
8052
|
+
if (path21.resolve(changedPath) !== path21.resolve(manifestPath)) {
|
|
8053
|
+
return;
|
|
8054
|
+
}
|
|
8055
|
+
const module = server.moduleGraph.getModuleById(
|
|
8056
|
+
resolvedVirtualModuleId4
|
|
8057
|
+
);
|
|
8058
|
+
if (module) {
|
|
8059
|
+
server.moduleGraph.invalidateModule(module);
|
|
8060
|
+
}
|
|
8061
|
+
const mod = await server.moduleGraph.getModuleByUrl(
|
|
8062
|
+
APITOGO_LOCAL_MANIFEST_VIRTUAL_ID
|
|
8063
|
+
);
|
|
8064
|
+
if (mod) {
|
|
8065
|
+
server.reloadModule(mod);
|
|
8066
|
+
}
|
|
8067
|
+
server.ws.send({ type: "full-reload", path: "*" });
|
|
8068
|
+
});
|
|
8069
|
+
}
|
|
8070
|
+
};
|
|
8071
|
+
};
|
|
8072
|
+
var plugin_local_manifest_default = viteLocalManifestPlugin;
|
|
8073
|
+
|
|
7959
8074
|
// src/vite/plugin.ts
|
|
7960
8075
|
init_plugin_theme();
|
|
7961
8076
|
function vitePlugin() {
|
|
7962
8077
|
return [
|
|
7963
8078
|
viteShikiRegisterPlugin(),
|
|
7964
8079
|
viteConfigReloadPlugin(),
|
|
8080
|
+
plugin_local_manifest_default(),
|
|
7965
8081
|
plugin_mdx_default(),
|
|
7966
8082
|
react({ include: /\.(mdx?|jsx?|tsx?)$/ }),
|
|
7967
8083
|
plugin_config_default(),
|
|
@@ -7986,10 +8102,10 @@ function vitePlugin() {
|
|
|
7986
8102
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
7987
8103
|
if (merged.publicDir === false) return void 0;
|
|
7988
8104
|
const rel = typeof merged.publicDir === "string" ? merged.publicDir : "public";
|
|
7989
|
-
return
|
|
8105
|
+
return path22.resolve(rootDir, rel);
|
|
7990
8106
|
};
|
|
7991
|
-
var getAppClientEntryPath = () =>
|
|
7992
|
-
var getAppServerEntryPath = () =>
|
|
8107
|
+
var getAppClientEntryPath = () => path22.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
|
|
8108
|
+
var getAppServerEntryPath = () => path22.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
7993
8109
|
var hasLoggedCdnInfo = false;
|
|
7994
8110
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
7995
8111
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
@@ -8019,7 +8135,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8019
8135
|
);
|
|
8020
8136
|
if (ZuploEnv.isZuplo) {
|
|
8021
8137
|
dotenv.config({
|
|
8022
|
-
path:
|
|
8138
|
+
path: path22.resolve(config2.__meta.rootDir, "../.env.zuplo"),
|
|
8023
8139
|
quiet: true
|
|
8024
8140
|
});
|
|
8025
8141
|
}
|
|
@@ -8078,8 +8194,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8078
8194
|
ssr: configEnv.isSsrBuild,
|
|
8079
8195
|
sourcemap: true,
|
|
8080
8196
|
target: "es2022",
|
|
8081
|
-
outDir:
|
|
8082
|
-
|
|
8197
|
+
outDir: path22.resolve(
|
|
8198
|
+
path22.join(
|
|
8083
8199
|
dir,
|
|
8084
8200
|
"dist",
|
|
8085
8201
|
config2.basePath ?? "",
|
|
@@ -8098,7 +8214,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8098
8214
|
},
|
|
8099
8215
|
experimental: {
|
|
8100
8216
|
renderBuiltUrl(filename) {
|
|
8101
|
-
if (cdnUrl?.base && [".js", ".css"].includes(
|
|
8217
|
+
if (cdnUrl?.base && [".js", ".css"].includes(path22.extname(filename))) {
|
|
8102
8218
|
return joinUrl(cdnUrl.base, filename);
|
|
8103
8219
|
}
|
|
8104
8220
|
if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
|
|
@@ -8111,7 +8227,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8111
8227
|
esbuildOptions: {
|
|
8112
8228
|
target: "es2022"
|
|
8113
8229
|
},
|
|
8114
|
-
entries: [
|
|
8230
|
+
entries: [path22.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
|
|
8115
8231
|
exclude: ["@lukoweb/apitogo"],
|
|
8116
8232
|
include: [
|
|
8117
8233
|
"react-dom/client",
|
|
@@ -8214,7 +8330,7 @@ init_package_json();
|
|
|
8214
8330
|
init_joinUrl();
|
|
8215
8331
|
import assert from "node:assert";
|
|
8216
8332
|
import { cp, mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
8217
|
-
import
|
|
8333
|
+
import path23 from "node:path";
|
|
8218
8334
|
var pkgJson = getZudokuPackageJson();
|
|
8219
8335
|
function generateOutput({
|
|
8220
8336
|
config: config2,
|
|
@@ -8271,9 +8387,9 @@ async function writeOutput(dir, {
|
|
|
8271
8387
|
rewrites
|
|
8272
8388
|
}) {
|
|
8273
8389
|
const output = generateOutput({ config: config2, redirects, rewrites });
|
|
8274
|
-
const outputDir = process.env.VERCEL ?
|
|
8390
|
+
const outputDir = process.env.VERCEL ? path23.join(dir, ".vercel/output") : path23.join(dir, "dist/.output");
|
|
8275
8391
|
await mkdir3(outputDir, { recursive: true });
|
|
8276
|
-
const outputFile =
|
|
8392
|
+
const outputFile = path23.join(outputDir, "config.json");
|
|
8277
8393
|
await writeFile3(outputFile, JSON.stringify(output, null, 2), "utf-8");
|
|
8278
8394
|
if (process.env.VERCEL) {
|
|
8279
8395
|
console.log("Wrote Vercel output to", outputDir);
|
|
@@ -8283,9 +8399,9 @@ async function writeOutput(dir, {
|
|
|
8283
8399
|
// src/vite/prerender/prerender.ts
|
|
8284
8400
|
init_logger();
|
|
8285
8401
|
init_file_exists();
|
|
8286
|
-
import { readFile as
|
|
8402
|
+
import { readFile as readFile2, rm } from "node:fs/promises";
|
|
8287
8403
|
import os from "node:os";
|
|
8288
|
-
import
|
|
8404
|
+
import path26 from "node:path";
|
|
8289
8405
|
import { pathToFileURL } from "node:url";
|
|
8290
8406
|
import { createIndex } from "pagefind";
|
|
8291
8407
|
import colors7 from "picocolors";
|
|
@@ -8327,7 +8443,7 @@ function throttle(fn) {
|
|
|
8327
8443
|
init_joinUrl();
|
|
8328
8444
|
import { createWriteStream, existsSync } from "node:fs";
|
|
8329
8445
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
8330
|
-
import
|
|
8446
|
+
import path24 from "node:path";
|
|
8331
8447
|
import colors5 from "picocolors";
|
|
8332
8448
|
import { SitemapStream } from "sitemap";
|
|
8333
8449
|
async function generateSitemap({
|
|
@@ -8341,11 +8457,11 @@ async function generateSitemap({
|
|
|
8341
8457
|
return;
|
|
8342
8458
|
}
|
|
8343
8459
|
const sitemap = new SitemapStream({ hostname: config2.siteUrl });
|
|
8344
|
-
const outputDir =
|
|
8460
|
+
const outputDir = path24.resolve(baseOutputDir, config2.outDir ?? "");
|
|
8345
8461
|
if (!existsSync(outputDir)) {
|
|
8346
8462
|
await mkdir4(outputDir, { recursive: true });
|
|
8347
8463
|
}
|
|
8348
|
-
const sitemapOutputPath =
|
|
8464
|
+
const sitemapOutputPath = path24.join(outputDir, "sitemap.xml");
|
|
8349
8465
|
const writeStream = createWriteStream(sitemapOutputPath);
|
|
8350
8466
|
sitemap.pipe(writeStream);
|
|
8351
8467
|
let lastmod;
|
|
@@ -8375,14 +8491,14 @@ async function generateSitemap({
|
|
|
8375
8491
|
|
|
8376
8492
|
// src/vite/prerender/utils.ts
|
|
8377
8493
|
init_joinUrl();
|
|
8378
|
-
var resolveRoutePath = (
|
|
8379
|
-
const segments =
|
|
8494
|
+
var resolveRoutePath = (path38) => {
|
|
8495
|
+
const segments = path38.split("/");
|
|
8380
8496
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
8381
8497
|
return void 0;
|
|
8382
8498
|
}
|
|
8383
8499
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
8384
8500
|
};
|
|
8385
|
-
var isSkipped = (
|
|
8501
|
+
var isSkipped = (path38) => path38.includes("*") || /^\d+$/.test(path38);
|
|
8386
8502
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
8387
8503
|
if (route.path && isSkipped(route.path)) return [];
|
|
8388
8504
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -8431,12 +8547,12 @@ var prerender = async ({
|
|
|
8431
8547
|
serverConfigFilename,
|
|
8432
8548
|
writeRedirects = true
|
|
8433
8549
|
}) => {
|
|
8434
|
-
const distDir =
|
|
8550
|
+
const distDir = path26.join(dir, "dist", basePath);
|
|
8435
8551
|
const serverConfigPath = pathToFileURL(
|
|
8436
|
-
|
|
8552
|
+
path26.join(distDir, "server", serverConfigFilename)
|
|
8437
8553
|
).href;
|
|
8438
8554
|
const entryServerPath = pathToFileURL(
|
|
8439
|
-
|
|
8555
|
+
path26.join(distDir, "server/entry.server.js")
|
|
8440
8556
|
).href;
|
|
8441
8557
|
const rawConfig = await import(serverConfigPath).then(
|
|
8442
8558
|
(m) => m.default
|
|
@@ -8521,7 +8637,7 @@ var prerender = async ({
|
|
|
8521
8637
|
})
|
|
8522
8638
|
);
|
|
8523
8639
|
const pagefindWriteResult = await pagefindIndex?.writeFiles({
|
|
8524
|
-
outputPath:
|
|
8640
|
+
outputPath: path26.join(distDir, "pagefind")
|
|
8525
8641
|
});
|
|
8526
8642
|
const seconds = ((performance.now() - start) / 1e3).toFixed(1);
|
|
8527
8643
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
@@ -8553,13 +8669,13 @@ var prerender = async ({
|
|
|
8553
8669
|
const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
|
|
8554
8670
|
const docsConfig = DocsConfigSchema2.parse(config2.docs);
|
|
8555
8671
|
const llmsConfig = docsConfig.llms ?? {};
|
|
8556
|
-
const markdownInfoPath =
|
|
8672
|
+
const markdownInfoPath = path26.join(
|
|
8557
8673
|
dir,
|
|
8558
8674
|
"node_modules/.apitogo/markdown-info.json"
|
|
8559
8675
|
);
|
|
8560
8676
|
let markdownFileInfos = [];
|
|
8561
8677
|
if (await fileExists(markdownInfoPath)) {
|
|
8562
|
-
const markdownInfoContent = await
|
|
8678
|
+
const markdownInfoContent = await readFile2(markdownInfoPath, "utf-8");
|
|
8563
8679
|
markdownFileInfos = JSON.parse(markdownInfoContent);
|
|
8564
8680
|
}
|
|
8565
8681
|
if (llmsConfig.llmsTxt || llmsConfig.llmsTxtFull) {
|
|
@@ -8644,7 +8760,7 @@ async function runBuild(options) {
|
|
|
8644
8760
|
html,
|
|
8645
8761
|
basePath: config2.basePath
|
|
8646
8762
|
});
|
|
8647
|
-
await rm2(
|
|
8763
|
+
await rm2(path27.join(clientOutDir, "index.html"), { force: true });
|
|
8648
8764
|
} else {
|
|
8649
8765
|
await runPrerender({
|
|
8650
8766
|
dir,
|
|
@@ -8668,7 +8784,7 @@ var runPrerender = async (options) => {
|
|
|
8668
8784
|
serverConfigFilename,
|
|
8669
8785
|
writeRedirects: process.env.VERCEL === void 0
|
|
8670
8786
|
});
|
|
8671
|
-
const indexHtml =
|
|
8787
|
+
const indexHtml = path27.join(clientOutDir, "index.html");
|
|
8672
8788
|
if (!workerResults.find((r) => r.outputPath === indexHtml)) {
|
|
8673
8789
|
await writeFile5(indexHtml, html, "utf-8");
|
|
8674
8790
|
}
|
|
@@ -8678,15 +8794,15 @@ var runPrerender = async (options) => {
|
|
|
8678
8794
|
for (const statusPage of statusPages) {
|
|
8679
8795
|
await rename(
|
|
8680
8796
|
statusPage,
|
|
8681
|
-
|
|
8797
|
+
path27.join(dir, DIST_DIR, path27.basename(statusPage))
|
|
8682
8798
|
);
|
|
8683
8799
|
}
|
|
8684
8800
|
await rm2(serverOutDir, { recursive: true, force: true });
|
|
8685
8801
|
if (process.env.VERCEL) {
|
|
8686
|
-
await mkdir5(
|
|
8802
|
+
await mkdir5(path27.join(dir, ".vercel/output/static"), { recursive: true });
|
|
8687
8803
|
await rename(
|
|
8688
|
-
|
|
8689
|
-
|
|
8804
|
+
path27.join(dir, DIST_DIR),
|
|
8805
|
+
path27.join(dir, ".vercel/output/static")
|
|
8690
8806
|
);
|
|
8691
8807
|
}
|
|
8692
8808
|
await writeOutput(dir, {
|
|
@@ -8696,7 +8812,7 @@ var runPrerender = async (options) => {
|
|
|
8696
8812
|
});
|
|
8697
8813
|
if (ZuploEnv.isZuplo && issuer) {
|
|
8698
8814
|
await writeFile5(
|
|
8699
|
-
|
|
8815
|
+
path27.join(dir, DIST_DIR, ".output/zuplo.json"),
|
|
8700
8816
|
JSON.stringify({ issuer }, null, 2),
|
|
8701
8817
|
"utf-8"
|
|
8702
8818
|
);
|
|
@@ -8708,10 +8824,10 @@ var runPrerender = async (options) => {
|
|
|
8708
8824
|
};
|
|
8709
8825
|
var bundleSSREntry = async (options) => {
|
|
8710
8826
|
const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
|
|
8711
|
-
const tempEntryPath =
|
|
8827
|
+
const tempEntryPath = path27.join(dir, "__ssr-entry.ts");
|
|
8712
8828
|
const packageRoot = getZudokuRootDir();
|
|
8713
|
-
const templateContent = await
|
|
8714
|
-
|
|
8829
|
+
const templateContent = await readFile3(
|
|
8830
|
+
path27.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
|
|
8715
8831
|
"utf-8"
|
|
8716
8832
|
);
|
|
8717
8833
|
const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
|
|
@@ -8726,9 +8842,9 @@ var bundleSSREntry = async (options) => {
|
|
|
8726
8842
|
platform: adapter === "node" ? "node" : "neutral",
|
|
8727
8843
|
target: "es2022",
|
|
8728
8844
|
format: "esm",
|
|
8729
|
-
outfile:
|
|
8845
|
+
outfile: path27.join(serverOutDir, "entry.js"),
|
|
8730
8846
|
external: ["./entry.server.js", `./${serverConfigFilename}`],
|
|
8731
|
-
nodePaths: [
|
|
8847
|
+
nodePaths: [path27.join(packageRoot, "node_modules")],
|
|
8732
8848
|
banner: { js: "// Bundled SSR entry" }
|
|
8733
8849
|
});
|
|
8734
8850
|
} finally {
|
|
@@ -8783,11 +8899,11 @@ function textOrJson(text) {
|
|
|
8783
8899
|
init_package_json();
|
|
8784
8900
|
|
|
8785
8901
|
// src/cli/preview/handler.ts
|
|
8786
|
-
import
|
|
8902
|
+
import path28 from "node:path";
|
|
8787
8903
|
import { preview as vitePreview } from "vite";
|
|
8788
8904
|
var DEFAULT_PREVIEW_PORT = 4e3;
|
|
8789
8905
|
async function preview(argv) {
|
|
8790
|
-
const dir =
|
|
8906
|
+
const dir = path28.resolve(process.cwd(), argv.dir);
|
|
8791
8907
|
const viteConfig = await getViteConfig(dir, {
|
|
8792
8908
|
command: "serve",
|
|
8793
8909
|
mode: "production",
|
|
@@ -8828,7 +8944,7 @@ async function build(argv) {
|
|
|
8828
8944
|
printDiagnosticsToConsole("");
|
|
8829
8945
|
printDiagnosticsToConsole("");
|
|
8830
8946
|
}
|
|
8831
|
-
const dir =
|
|
8947
|
+
const dir = path29.resolve(process.cwd(), argv.dir);
|
|
8832
8948
|
try {
|
|
8833
8949
|
await runBuild({
|
|
8834
8950
|
dir,
|
|
@@ -8988,7 +9104,7 @@ var build_default = {
|
|
|
8988
9104
|
// src/cli/configure-github-workflow/handler.ts
|
|
8989
9105
|
import { constants } from "node:fs";
|
|
8990
9106
|
import { access, mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
8991
|
-
import
|
|
9107
|
+
import path30 from "node:path";
|
|
8992
9108
|
var APITOGO_DEPLOY_WORKFLOW_YAML = `name: Build and Deploy
|
|
8993
9109
|
|
|
8994
9110
|
on:
|
|
@@ -9099,9 +9215,9 @@ jobs:
|
|
|
9099
9215
|
run: apitogo deploy --deployment-token="$APITOGO_TOKEN" --json-only
|
|
9100
9216
|
`;
|
|
9101
9217
|
async function configureGithubWorkflow(argv) {
|
|
9102
|
-
const dir =
|
|
9103
|
-
const workflowDir =
|
|
9104
|
-
const workflowPath =
|
|
9218
|
+
const dir = path30.resolve(process.cwd(), argv.dir);
|
|
9219
|
+
const workflowDir = path30.join(dir, ".github", "workflows");
|
|
9220
|
+
const workflowPath = path30.join(workflowDir, "apitogo-deploy.yml");
|
|
9105
9221
|
try {
|
|
9106
9222
|
try {
|
|
9107
9223
|
await access(workflowPath, constants.F_OK);
|
|
@@ -9173,15 +9289,15 @@ function applyJsonOnlyDeployQuietMode() {
|
|
|
9173
9289
|
}
|
|
9174
9290
|
|
|
9175
9291
|
// src/cli/deploy/handler.ts
|
|
9176
|
-
import { access as access2, readFile as
|
|
9177
|
-
import
|
|
9292
|
+
import { access as access2, readFile as readFile4 } from "node:fs/promises";
|
|
9293
|
+
import path31 from "node:path";
|
|
9178
9294
|
import { create as createTar } from "tar";
|
|
9179
9295
|
var DEPLOY_ENDPOINT = "https://deploy-server-dotnet2-b3fkcaaraydbckfe.canadacentral-01.azurewebsites.net/deploy";
|
|
9180
9296
|
var ARCHIVE_NAME = "dist.tgz";
|
|
9181
9297
|
var createDeploymentArchive = async (dir) => {
|
|
9182
|
-
const distDir =
|
|
9298
|
+
const distDir = path31.join(dir, "dist");
|
|
9183
9299
|
await access2(distDir);
|
|
9184
|
-
const archivePath =
|
|
9300
|
+
const archivePath = path31.join(dir, ARCHIVE_NAME);
|
|
9185
9301
|
await createTar(
|
|
9186
9302
|
{
|
|
9187
9303
|
cwd: dir,
|
|
@@ -9195,7 +9311,7 @@ var createDeploymentArchive = async (dir) => {
|
|
|
9195
9311
|
};
|
|
9196
9312
|
async function deploy(argv) {
|
|
9197
9313
|
await build({ ...argv, preview: void 0 });
|
|
9198
|
-
const dir =
|
|
9314
|
+
const dir = path31.resolve(process.cwd(), argv.dir);
|
|
9199
9315
|
const deploymentToken = argv.deploymentToken?.trim() || process.env.npm_config_deployment_token?.trim();
|
|
9200
9316
|
const env = argv.env?.trim() || process.env.npm_config_env?.trim() || "production";
|
|
9201
9317
|
try {
|
|
@@ -9208,15 +9324,15 @@ async function deploy(argv) {
|
|
|
9208
9324
|
const archivePath = await createDeploymentArchive(dir);
|
|
9209
9325
|
if (!isJsonOnlyDeployEnv()) {
|
|
9210
9326
|
printDiagnosticsToConsole(
|
|
9211
|
-
`Uploading ${
|
|
9327
|
+
`Uploading ${path31.basename(archivePath)} to ${env}...`
|
|
9212
9328
|
);
|
|
9213
9329
|
}
|
|
9214
|
-
const archiveBuffer = await
|
|
9330
|
+
const archiveBuffer = await readFile4(archivePath);
|
|
9215
9331
|
const formData = new FormData();
|
|
9216
9332
|
formData.append(
|
|
9217
9333
|
"file",
|
|
9218
9334
|
new Blob([archiveBuffer], { type: "application/gzip" }),
|
|
9219
|
-
|
|
9335
|
+
path31.basename(archivePath)
|
|
9220
9336
|
);
|
|
9221
9337
|
formData.append("deploymentToken", deploymentToken);
|
|
9222
9338
|
formData.append("env", env);
|
|
@@ -9301,14 +9417,14 @@ var deploy_default = {
|
|
|
9301
9417
|
|
|
9302
9418
|
// src/cli/dev/handler.ts
|
|
9303
9419
|
init_joinUrl();
|
|
9304
|
-
import
|
|
9420
|
+
import path34 from "node:path";
|
|
9305
9421
|
|
|
9306
9422
|
// src/vite/dev-server.ts
|
|
9307
9423
|
init_logger();
|
|
9308
9424
|
import fs4 from "node:fs/promises";
|
|
9309
9425
|
import http from "node:http";
|
|
9310
9426
|
import https from "node:https";
|
|
9311
|
-
import
|
|
9427
|
+
import path33 from "node:path";
|
|
9312
9428
|
import { createHttpTerminator } from "http-terminator";
|
|
9313
9429
|
import {
|
|
9314
9430
|
createServer as createViteServer,
|
|
@@ -9341,7 +9457,7 @@ init_loader();
|
|
|
9341
9457
|
// src/vite/pagefind-dev-index.ts
|
|
9342
9458
|
init_invariant();
|
|
9343
9459
|
init_joinUrl();
|
|
9344
|
-
import
|
|
9460
|
+
import path32 from "node:path";
|
|
9345
9461
|
import { createIndex as createIndex2 } from "pagefind";
|
|
9346
9462
|
import { isRunnableDevEnvironment } from "vite";
|
|
9347
9463
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -9394,7 +9510,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
9394
9510
|
path: urlPath
|
|
9395
9511
|
};
|
|
9396
9512
|
}
|
|
9397
|
-
const outputPath =
|
|
9513
|
+
const outputPath = path32.join(vite.config.publicDir, "pagefind");
|
|
9398
9514
|
await pagefindIndex.writeFiles({ outputPath });
|
|
9399
9515
|
yield { type: "complete", success: true, indexed };
|
|
9400
9516
|
}
|
|
@@ -9413,9 +9529,9 @@ var DevServer = class {
|
|
|
9413
9529
|
this.protocol = "https";
|
|
9414
9530
|
const { dir } = this.options;
|
|
9415
9531
|
const [key, cert, ca] = await Promise.all([
|
|
9416
|
-
fs4.readFile(
|
|
9417
|
-
fs4.readFile(
|
|
9418
|
-
config2.https.ca ? fs4.readFile(
|
|
9532
|
+
fs4.readFile(path33.resolve(dir, config2.https.key)),
|
|
9533
|
+
fs4.readFile(path33.resolve(dir, config2.https.cert)),
|
|
9534
|
+
config2.https.ca ? fs4.readFile(path33.resolve(dir, config2.https.ca)) : void 0
|
|
9419
9535
|
]);
|
|
9420
9536
|
return https.createServer({ key, cert, ca });
|
|
9421
9537
|
}
|
|
@@ -9432,7 +9548,7 @@ var DevServer = class {
|
|
|
9432
9548
|
);
|
|
9433
9549
|
const server = await this.createNodeServer(config2);
|
|
9434
9550
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
9435
|
-
const publicRoot =
|
|
9551
|
+
const publicRoot = path33.resolve(
|
|
9436
9552
|
this.options.dir,
|
|
9437
9553
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
9438
9554
|
);
|
|
@@ -9449,7 +9565,7 @@ var DevServer = class {
|
|
|
9449
9565
|
// built-in transform middleware which would treat the path as a static asset.
|
|
9450
9566
|
name: "apitogo:entry-client",
|
|
9451
9567
|
configureServer(server2) {
|
|
9452
|
-
const entryPath =
|
|
9568
|
+
const entryPath = path33.posix.join(
|
|
9453
9569
|
server2.config.base,
|
|
9454
9570
|
"/__z/entry.client.tsx"
|
|
9455
9571
|
);
|
|
@@ -9614,7 +9730,7 @@ init_package_json();
|
|
|
9614
9730
|
async function dev(argv) {
|
|
9615
9731
|
const packageJson2 = getZudokuPackageJson();
|
|
9616
9732
|
process.env.NODE_ENV = "development";
|
|
9617
|
-
const dir =
|
|
9733
|
+
const dir = path34.resolve(process.cwd(), argv.dir);
|
|
9618
9734
|
const server = new DevServer({
|
|
9619
9735
|
dir,
|
|
9620
9736
|
argPort: argv.port,
|
|
@@ -9698,15 +9814,15 @@ var dev_default = {
|
|
|
9698
9814
|
|
|
9699
9815
|
// src/cli/make-config/handler.ts
|
|
9700
9816
|
import { constants as constants3 } from "node:fs";
|
|
9701
|
-
import { access as access4, mkdir as mkdir7, readFile as
|
|
9702
|
-
import
|
|
9817
|
+
import { access as access4, mkdir as mkdir7, readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
|
|
9818
|
+
import path36 from "node:path";
|
|
9703
9819
|
import { glob as glob5 } from "glob";
|
|
9704
9820
|
|
|
9705
9821
|
// src/cli/make-config/scaffold-project.ts
|
|
9706
9822
|
init_package_json();
|
|
9707
9823
|
import { constants as constants2 } from "node:fs";
|
|
9708
|
-
import { access as access3, readFile as
|
|
9709
|
-
import
|
|
9824
|
+
import { access as access3, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
|
|
9825
|
+
import path35 from "node:path";
|
|
9710
9826
|
import { glob as glob4 } from "glob";
|
|
9711
9827
|
var OPENAPI_GLOBS = [
|
|
9712
9828
|
"apis/openapi.json",
|
|
@@ -9766,9 +9882,9 @@ var findMatchingCurly = (source, startIndex) => {
|
|
|
9766
9882
|
}
|
|
9767
9883
|
throw new Error("Could not find matching closing brace for object.");
|
|
9768
9884
|
};
|
|
9769
|
-
var toPosix = (p) => p.split(
|
|
9885
|
+
var toPosix = (p) => p.split(path35.sep).join("/");
|
|
9770
9886
|
var sanitizePackageName = (dir) => {
|
|
9771
|
-
const base =
|
|
9887
|
+
const base = path35.basename(path35.resolve(dir));
|
|
9772
9888
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
9773
9889
|
return s || "apitogo-site";
|
|
9774
9890
|
};
|
|
@@ -9778,7 +9894,7 @@ var apitogoVersionRange = () => {
|
|
|
9778
9894
|
};
|
|
9779
9895
|
async function findOpenApiSpecPath(dir) {
|
|
9780
9896
|
for (const rel of OPENAPI_GLOBS) {
|
|
9781
|
-
const full =
|
|
9897
|
+
const full = path35.join(dir, rel);
|
|
9782
9898
|
try {
|
|
9783
9899
|
await access3(full, constants2.R_OK);
|
|
9784
9900
|
return toPosix(rel);
|
|
@@ -9793,7 +9909,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
9793
9909
|
return extra[0] ? toPosix(extra[0]) : null;
|
|
9794
9910
|
}
|
|
9795
9911
|
async function ensurePackageJson(dir) {
|
|
9796
|
-
const pkgPath =
|
|
9912
|
+
const pkgPath = path35.join(dir, "package.json");
|
|
9797
9913
|
const apitogoVer = apitogoVersionRange();
|
|
9798
9914
|
const baseDeps = {
|
|
9799
9915
|
react: ">=19.0.0",
|
|
@@ -9828,7 +9944,7 @@ async function ensurePackageJson(dir) {
|
|
|
9828
9944
|
`, "utf8");
|
|
9829
9945
|
return true;
|
|
9830
9946
|
}
|
|
9831
|
-
const raw = await
|
|
9947
|
+
const raw = await readFile5(pkgPath, "utf8");
|
|
9832
9948
|
let pkg;
|
|
9833
9949
|
try {
|
|
9834
9950
|
pkg = JSON.parse(raw);
|
|
@@ -9856,7 +9972,7 @@ async function ensurePackageJson(dir) {
|
|
|
9856
9972
|
return false;
|
|
9857
9973
|
}
|
|
9858
9974
|
async function ensureTsconfigJson(dir) {
|
|
9859
|
-
const tsPath =
|
|
9975
|
+
const tsPath = path35.join(dir, "tsconfig.json");
|
|
9860
9976
|
try {
|
|
9861
9977
|
await access3(tsPath, constants2.R_OK);
|
|
9862
9978
|
return false;
|
|
@@ -9938,7 +10054,7 @@ var CONFIG_FILENAMES = [
|
|
|
9938
10054
|
];
|
|
9939
10055
|
var DEFAULT_NEW_CONFIG_FILENAME = "apitogo.config.tsx";
|
|
9940
10056
|
var createTreeNode = () => ({ docs: [], children: /* @__PURE__ */ new Map() });
|
|
9941
|
-
var toPosixPath2 = (value) => value.split(
|
|
10057
|
+
var toPosixPath2 = (value) => value.split(path36.sep).join(path36.posix.sep);
|
|
9942
10058
|
var toRoutePath = (relativeFile, pagesDir) => {
|
|
9943
10059
|
const relativeNoExt = relativeFile.replace(/\.mdx?$/, "");
|
|
9944
10060
|
const withoutPagesPrefix = relativeNoExt.replace(
|
|
@@ -10183,7 +10299,7 @@ export default config;
|
|
|
10183
10299
|
`;
|
|
10184
10300
|
};
|
|
10185
10301
|
var ensureApitogoDeployWorkflow = async (dir) => {
|
|
10186
|
-
const workflowPath =
|
|
10302
|
+
const workflowPath = path36.join(
|
|
10187
10303
|
dir,
|
|
10188
10304
|
".github",
|
|
10189
10305
|
"workflows",
|
|
@@ -10194,15 +10310,15 @@ var ensureApitogoDeployWorkflow = async (dir) => {
|
|
|
10194
10310
|
return false;
|
|
10195
10311
|
} catch {
|
|
10196
10312
|
}
|
|
10197
|
-
await mkdir7(
|
|
10313
|
+
await mkdir7(path36.join(dir, ".github", "workflows"), { recursive: true });
|
|
10198
10314
|
await writeFile8(workflowPath, APITOGO_DEPLOY_WORKFLOW_YAML, "utf8");
|
|
10199
10315
|
return true;
|
|
10200
10316
|
};
|
|
10201
10317
|
var findExistingConfigPath = async (dir) => {
|
|
10202
10318
|
for (const filename of CONFIG_FILENAMES) {
|
|
10203
|
-
const fullPath =
|
|
10319
|
+
const fullPath = path36.join(dir, filename);
|
|
10204
10320
|
try {
|
|
10205
|
-
await
|
|
10321
|
+
await readFile6(fullPath, "utf8");
|
|
10206
10322
|
return fullPath;
|
|
10207
10323
|
} catch {
|
|
10208
10324
|
}
|
|
@@ -10210,7 +10326,7 @@ var findExistingConfigPath = async (dir) => {
|
|
|
10210
10326
|
return null;
|
|
10211
10327
|
};
|
|
10212
10328
|
async function makeConfig(argv) {
|
|
10213
|
-
const dir =
|
|
10329
|
+
const dir = path36.resolve(process.cwd(), argv.dir);
|
|
10214
10330
|
const pagesDir = toPosixPath2(
|
|
10215
10331
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
10216
10332
|
);
|
|
@@ -10229,7 +10345,7 @@ async function makeConfig(argv) {
|
|
|
10229
10345
|
let configPath = await findExistingConfigPath(dir);
|
|
10230
10346
|
let createdNew = false;
|
|
10231
10347
|
if (!configPath) {
|
|
10232
|
-
configPath =
|
|
10348
|
+
configPath = path36.join(dir, DEFAULT_NEW_CONFIG_FILENAME);
|
|
10233
10349
|
await writeFile8(
|
|
10234
10350
|
configPath,
|
|
10235
10351
|
buildNewConfigContents(pagesDir, openApiSpecPath),
|
|
@@ -10249,7 +10365,7 @@ async function makeConfig(argv) {
|
|
|
10249
10365
|
if (routePaths.length === 0) {
|
|
10250
10366
|
throw new Error(`No .md or .mdx files found under '${pagesDir}'.`);
|
|
10251
10367
|
}
|
|
10252
|
-
let originalConfig = await
|
|
10368
|
+
let originalConfig = await readFile6(configPath, "utf8");
|
|
10253
10369
|
if (!createdNew && openApiSpecPath) {
|
|
10254
10370
|
originalConfig = insertApisIfMissing(
|
|
10255
10371
|
originalConfig,
|
|
@@ -10270,7 +10386,7 @@ async function makeConfig(argv) {
|
|
|
10270
10386
|
await writeFile8(configPath, withRedirects, "utf8");
|
|
10271
10387
|
const action = createdNew ? "Initialized" : "Updated";
|
|
10272
10388
|
printResultToConsole(
|
|
10273
|
-
`${action} ${
|
|
10389
|
+
`${action} ${path36.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
|
|
10274
10390
|
);
|
|
10275
10391
|
const createdWorkflow = await ensureApitogoDeployWorkflow(dir);
|
|
10276
10392
|
if (createdWorkflow) {
|
|
@@ -10413,7 +10529,7 @@ var remove_default = {
|
|
|
10413
10529
|
|
|
10414
10530
|
// src/cli/common/outdated.ts
|
|
10415
10531
|
import { existsSync as existsSync2, mkdirSync } from "node:fs";
|
|
10416
|
-
import { readFile as
|
|
10532
|
+
import { readFile as readFile7, writeFile as writeFile9 } from "node:fs/promises";
|
|
10417
10533
|
import { join } from "node:path";
|
|
10418
10534
|
import colors10 from "picocolors";
|
|
10419
10535
|
import { gt } from "semver";
|
|
@@ -10463,12 +10579,12 @@ function box(message, {
|
|
|
10463
10579
|
|
|
10464
10580
|
// src/cli/common/xdg/lib.ts
|
|
10465
10581
|
import { homedir } from "node:os";
|
|
10466
|
-
import
|
|
10582
|
+
import path37 from "node:path";
|
|
10467
10583
|
function defineDirectoryWithFallback(xdgName, fallback) {
|
|
10468
10584
|
if (process.env[xdgName]) {
|
|
10469
10585
|
return process.env[xdgName];
|
|
10470
10586
|
} else {
|
|
10471
|
-
return
|
|
10587
|
+
return path37.join(homedir(), fallback);
|
|
10472
10588
|
}
|
|
10473
10589
|
}
|
|
10474
10590
|
var XDG_CONFIG_HOME = defineDirectoryWithFallback(
|
|
@@ -10483,15 +10599,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
|
|
|
10483
10599
|
"XDG_DATA_HOME",
|
|
10484
10600
|
".local/state"
|
|
10485
10601
|
);
|
|
10486
|
-
var ZUDOKU_XDG_CONFIG_HOME =
|
|
10602
|
+
var ZUDOKU_XDG_CONFIG_HOME = path37.join(
|
|
10487
10603
|
XDG_CONFIG_HOME,
|
|
10488
10604
|
CLI_XDG_FOLDER_NAME
|
|
10489
10605
|
);
|
|
10490
|
-
var ZUDOKU_XDG_DATA_HOME =
|
|
10606
|
+
var ZUDOKU_XDG_DATA_HOME = path37.join(
|
|
10491
10607
|
XDG_DATA_HOME,
|
|
10492
10608
|
CLI_XDG_FOLDER_NAME
|
|
10493
10609
|
);
|
|
10494
|
-
var ZUDOKU_XDG_STATE_HOME =
|
|
10610
|
+
var ZUDOKU_XDG_STATE_HOME = path37.join(
|
|
10495
10611
|
XDG_STATE_HOME,
|
|
10496
10612
|
CLI_XDG_FOLDER_NAME
|
|
10497
10613
|
);
|
|
@@ -10543,7 +10659,7 @@ async function getVersionCheckInfo() {
|
|
|
10543
10659
|
let versionCheckInfo;
|
|
10544
10660
|
if (existsSync2(versionCheckPath)) {
|
|
10545
10661
|
try {
|
|
10546
|
-
versionCheckInfo = await
|
|
10662
|
+
versionCheckInfo = await readFile7(versionCheckPath, "utf-8").then(
|
|
10547
10663
|
JSON.parse
|
|
10548
10664
|
);
|
|
10549
10665
|
} catch {
|