@lukoweb/apitogo 0.1.43 → 0.1.45
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/cli.js +391 -266
- 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/loader.ts +13 -2
- 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
|
|
|
@@ -3787,9 +3787,18 @@ function loadEnv(configEnv, rootDir) {
|
|
|
3787
3787
|
);
|
|
3788
3788
|
return { publicEnv: publicEnv2, envPrefix: envPrefix2 };
|
|
3789
3789
|
}
|
|
3790
|
+
function isWatchableConfigDependency(depPath) {
|
|
3791
|
+
return !depPath.startsWith("\0virtual:") && !depPath.startsWith("virtual:");
|
|
3792
|
+
}
|
|
3793
|
+
function getWatchableConfigDependencies(config2) {
|
|
3794
|
+
return [
|
|
3795
|
+
config2.__meta.configPath,
|
|
3796
|
+
...config2.__meta.dependencies.filter(isWatchableConfigDependency)
|
|
3797
|
+
];
|
|
3798
|
+
}
|
|
3790
3799
|
async function hasConfigChanged() {
|
|
3791
3800
|
if (!config || !modifiedTimes) return true;
|
|
3792
|
-
const files =
|
|
3801
|
+
const files = getWatchableConfigDependencies(config);
|
|
3793
3802
|
try {
|
|
3794
3803
|
const hasChanged = await Promise.all(
|
|
3795
3804
|
files.map(async (depPath) => {
|
|
@@ -3805,7 +3814,7 @@ async function hasConfigChanged() {
|
|
|
3805
3814
|
}
|
|
3806
3815
|
async function updateModifiedTimes() {
|
|
3807
3816
|
if (!config) return;
|
|
3808
|
-
const files =
|
|
3817
|
+
const files = getWatchableConfigDependencies(config);
|
|
3809
3818
|
modifiedTimes = /* @__PURE__ */ new Map();
|
|
3810
3819
|
await Promise.all(
|
|
3811
3820
|
files.map(async (depPath) => {
|
|
@@ -3889,7 +3898,7 @@ __export(llms_exports, {
|
|
|
3889
3898
|
generateLlmsTxtFiles: () => generateLlmsTxtFiles
|
|
3890
3899
|
});
|
|
3891
3900
|
import { writeFile as writeFile4 } from "node:fs/promises";
|
|
3892
|
-
import
|
|
3901
|
+
import path25 from "node:path";
|
|
3893
3902
|
import colors6 from "picocolors";
|
|
3894
3903
|
async function generateLlmsTxtFiles({
|
|
3895
3904
|
markdownFileInfos,
|
|
@@ -3924,7 +3933,7 @@ async function generateLlmsTxtFiles({
|
|
|
3924
3933
|
}
|
|
3925
3934
|
}
|
|
3926
3935
|
const llmsTxt2 = llmsTxtParts.join("\n");
|
|
3927
|
-
await writeFile4(
|
|
3936
|
+
await writeFile4(path25.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
|
|
3928
3937
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
3929
3938
|
console.log(colors6.blue("\u2713 generated llms.txt"));
|
|
3930
3939
|
}
|
|
@@ -3952,7 +3961,7 @@ ${info.content}
|
|
|
3952
3961
|
}
|
|
3953
3962
|
const llmsFull = llmsFullParts.join("\n");
|
|
3954
3963
|
await writeFile4(
|
|
3955
|
-
|
|
3964
|
+
path25.join(baseOutputDir, "llms-full.txt"),
|
|
3956
3965
|
llmsFull,
|
|
3957
3966
|
"utf-8"
|
|
3958
3967
|
);
|
|
@@ -3973,11 +3982,11 @@ import { hideBin } from "yargs/helpers";
|
|
|
3973
3982
|
import yargs from "yargs/yargs";
|
|
3974
3983
|
|
|
3975
3984
|
// src/cli/build/handler.ts
|
|
3976
|
-
import
|
|
3985
|
+
import path29 from "node:path";
|
|
3977
3986
|
|
|
3978
3987
|
// src/vite/build.ts
|
|
3979
|
-
import { mkdir as mkdir5, readFile as
|
|
3980
|
-
import
|
|
3988
|
+
import { mkdir as mkdir5, readFile as readFile3, rename, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
|
|
3989
|
+
import path27 from "node:path";
|
|
3981
3990
|
import { build as esbuild } from "esbuild";
|
|
3982
3991
|
import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
|
|
3983
3992
|
|
|
@@ -4113,7 +4122,7 @@ init_invariant();
|
|
|
4113
4122
|
init_joinUrl();
|
|
4114
4123
|
|
|
4115
4124
|
// src/vite/config.ts
|
|
4116
|
-
import
|
|
4125
|
+
import path22 from "node:path";
|
|
4117
4126
|
import dotenv from "dotenv";
|
|
4118
4127
|
import colors4 from "picocolors";
|
|
4119
4128
|
import {
|
|
@@ -4124,7 +4133,7 @@ import {
|
|
|
4124
4133
|
// package.json
|
|
4125
4134
|
var package_default = {
|
|
4126
4135
|
name: "@lukoweb/apitogo",
|
|
4127
|
-
version: "0.1.
|
|
4136
|
+
version: "0.1.45",
|
|
4128
4137
|
type: "module",
|
|
4129
4138
|
sideEffects: [
|
|
4130
4139
|
"**/*.css",
|
|
@@ -4192,7 +4201,8 @@ var package_default = {
|
|
|
4192
4201
|
"./main.css": "./src/app/main.css",
|
|
4193
4202
|
"./processors/*": "./src/lib/plugins/openapi/processors/*.ts",
|
|
4194
4203
|
"./with-zuplo": "./src/zuplo/with-zuplo.ts",
|
|
4195
|
-
"./testing": "./src/lib/testing/index.tsx"
|
|
4204
|
+
"./testing": "./src/lib/testing/index.tsx",
|
|
4205
|
+
"./local-manifest": "./src/config/local-manifest.ts"
|
|
4196
4206
|
},
|
|
4197
4207
|
scripts: {
|
|
4198
4208
|
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 +4512,10 @@ var package_default = {
|
|
|
4502
4512
|
"./testing": {
|
|
4503
4513
|
types: "./dist/declarations/lib/testing/index.d.ts",
|
|
4504
4514
|
default: "./src/lib/testing/index.tsx"
|
|
4515
|
+
},
|
|
4516
|
+
"./local-manifest": {
|
|
4517
|
+
types: "./dist/declarations/config/local-manifest.d.ts",
|
|
4518
|
+
default: "./src/config/local-manifest.ts"
|
|
4505
4519
|
}
|
|
4506
4520
|
}
|
|
4507
4521
|
}
|
|
@@ -4515,47 +4529,7 @@ init_ZudokuConfig();
|
|
|
4515
4529
|
init_joinUrl();
|
|
4516
4530
|
|
|
4517
4531
|
// src/vite/dev-portal-env.ts
|
|
4518
|
-
import { readFile } from "node:fs/promises";
|
|
4519
|
-
import path4 from "node:path";
|
|
4520
4532
|
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
4533
|
async function loadDevPortalViteDefines(rootDir, mode) {
|
|
4560
4534
|
const env = loadEnv2(mode, rootDir, "VITE_");
|
|
4561
4535
|
const defines = {};
|
|
@@ -4563,34 +4537,29 @@ async function loadDevPortalViteDefines(rootDir, mode) {
|
|
|
4563
4537
|
if (apiUrl) {
|
|
4564
4538
|
defines.VITE_APITOGO_DEV_PORTAL_API_URL = JSON.stringify(apiUrl);
|
|
4565
4539
|
}
|
|
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
4540
|
return defines;
|
|
4572
4541
|
}
|
|
4573
4542
|
|
|
4574
4543
|
// src/vite/package-root.ts
|
|
4575
4544
|
init_file_exists();
|
|
4576
|
-
import
|
|
4545
|
+
import path4 from "node:path";
|
|
4577
4546
|
var findPackageRoot = async (startDir) => {
|
|
4578
4547
|
let dir = startDir;
|
|
4579
|
-
while (dir !==
|
|
4580
|
-
if (await fileExists(
|
|
4581
|
-
dir =
|
|
4548
|
+
while (dir !== path4.dirname(dir)) {
|
|
4549
|
+
if (await fileExists(path4.join(dir, "package.json"))) return dir;
|
|
4550
|
+
dir = path4.dirname(dir);
|
|
4582
4551
|
}
|
|
4583
4552
|
};
|
|
4584
4553
|
|
|
4585
4554
|
// src/vite/pagefind-dev-stub.ts
|
|
4586
4555
|
import fs from "node:fs/promises";
|
|
4587
|
-
import
|
|
4556
|
+
import path5 from "node:path";
|
|
4588
4557
|
var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
|
|
4589
4558
|
async function ensurePagefindDevStub(publicDir) {
|
|
4590
|
-
const pagefindPath =
|
|
4559
|
+
const pagefindPath = path5.join(publicDir, "pagefind/pagefind.js");
|
|
4591
4560
|
const exists = await fs.stat(pagefindPath).catch(() => false);
|
|
4592
4561
|
if (!exists) {
|
|
4593
|
-
await fs.mkdir(
|
|
4562
|
+
await fs.mkdir(path5.dirname(pagefindPath), { recursive: true });
|
|
4594
4563
|
await fs.writeFile(pagefindPath, NOT_BUILT_YET);
|
|
4595
4564
|
}
|
|
4596
4565
|
}
|
|
@@ -4602,7 +4571,7 @@ import react from "@vitejs/plugin-react";
|
|
|
4602
4571
|
// src/vite/css/plugin.ts
|
|
4603
4572
|
init_loader();
|
|
4604
4573
|
init_plugin_theme();
|
|
4605
|
-
import
|
|
4574
|
+
import path6 from "node:path";
|
|
4606
4575
|
import { isCSSRequest as isCSSRequest2 } from "vite";
|
|
4607
4576
|
|
|
4608
4577
|
// src/vite/css/collect.ts
|
|
@@ -4637,7 +4606,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
|
|
|
4637
4606
|
function vitePluginSsrCss(pluginOpts) {
|
|
4638
4607
|
let server;
|
|
4639
4608
|
const config2 = getCurrentConfig();
|
|
4640
|
-
const virtualHref =
|
|
4609
|
+
const virtualHref = path6.join(
|
|
4641
4610
|
config2.basePath ?? "",
|
|
4642
4611
|
`/@id/__x00__${VIRTUAL_ENTRY}?direct`
|
|
4643
4612
|
);
|
|
@@ -4736,16 +4705,16 @@ var getZuploSystemConfigurations = (string) => {
|
|
|
4736
4705
|
// src/vite/plugin-api-keys.ts
|
|
4737
4706
|
var viteApiKeysPlugin = () => {
|
|
4738
4707
|
const virtualModuleId4 = "virtual:zudoku-api-keys-plugin";
|
|
4739
|
-
const
|
|
4708
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
4740
4709
|
return {
|
|
4741
4710
|
name: "zudoku-api-keys-plugin",
|
|
4742
4711
|
resolveId(id) {
|
|
4743
4712
|
if (id === virtualModuleId4) {
|
|
4744
|
-
return
|
|
4713
|
+
return resolvedVirtualModuleId5;
|
|
4745
4714
|
}
|
|
4746
4715
|
},
|
|
4747
4716
|
async load(id) {
|
|
4748
|
-
if (id ===
|
|
4717
|
+
if (id === resolvedVirtualModuleId5) {
|
|
4749
4718
|
const config2 = getCurrentConfig();
|
|
4750
4719
|
const apiKeysPath = config2.__resolvedModules.userPanel.apiKeys.path;
|
|
4751
4720
|
if (!config2.__resolvedModules.userPanel.apiKeys.enabled || config2.__meta.mode === "standalone") {
|
|
@@ -4774,7 +4743,7 @@ var plugin_api_keys_default = viteApiKeysPlugin;
|
|
|
4774
4743
|
|
|
4775
4744
|
// src/vite/plugin-api.ts
|
|
4776
4745
|
import fs3 from "node:fs/promises";
|
|
4777
|
-
import
|
|
4746
|
+
import path12 from "node:path";
|
|
4778
4747
|
import { deepEqual as deepEqual2 } from "fast-equals";
|
|
4779
4748
|
import { runnerImport as runnerImport3 } from "vite";
|
|
4780
4749
|
init_package_json();
|
|
@@ -4783,7 +4752,7 @@ init_loader();
|
|
|
4783
4752
|
// src/config/validators/BuildSchema.ts
|
|
4784
4753
|
init_file_exists();
|
|
4785
4754
|
init_loader();
|
|
4786
|
-
import
|
|
4755
|
+
import path7 from "node:path";
|
|
4787
4756
|
import { runnerImport as runnerImport2 } from "vite";
|
|
4788
4757
|
import { z as z9 } from "zod";
|
|
4789
4758
|
var BuildProcessorSchema = z9.custom((val) => typeof val === "function");
|
|
@@ -4812,7 +4781,7 @@ var buildConfigFiles = [
|
|
|
4812
4781
|
];
|
|
4813
4782
|
async function getBuildConfigFilePath(rootDir) {
|
|
4814
4783
|
for (const fileName of buildConfigFiles) {
|
|
4815
|
-
const filepath =
|
|
4784
|
+
const filepath = path7.join(rootDir, fileName);
|
|
4816
4785
|
if (await fileExists(filepath)) {
|
|
4817
4786
|
return filepath;
|
|
4818
4787
|
}
|
|
@@ -4921,14 +4890,14 @@ var flattenAllOf = (schema2) => {
|
|
|
4921
4890
|
};
|
|
4922
4891
|
|
|
4923
4892
|
// src/lib/util/traverse.ts
|
|
4924
|
-
var traverse = (specification, transform,
|
|
4925
|
-
const transformed = transform(specification,
|
|
4893
|
+
var traverse = (specification, transform, path38 = []) => {
|
|
4894
|
+
const transformed = transform(specification, path38);
|
|
4926
4895
|
if (typeof transformed !== "object" || transformed === null) {
|
|
4927
4896
|
return transformed;
|
|
4928
4897
|
}
|
|
4929
4898
|
const result = Array.isArray(transformed) ? [] : {};
|
|
4930
4899
|
for (const [key, value] of Object.entries(transformed)) {
|
|
4931
|
-
const currentPath = [...
|
|
4900
|
+
const currentPath = [...path38, key];
|
|
4932
4901
|
if (Array.isArray(value)) {
|
|
4933
4902
|
result[key] = value.map(
|
|
4934
4903
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -4956,9 +4925,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
4956
4925
|
if (schemaCache?.has(ref)) {
|
|
4957
4926
|
return schemaCache.get(ref);
|
|
4958
4927
|
}
|
|
4959
|
-
const
|
|
4928
|
+
const path38 = ref.split("/").slice(1);
|
|
4960
4929
|
let current = schema2;
|
|
4961
|
-
for (const segment of
|
|
4930
|
+
for (const segment of path38) {
|
|
4962
4931
|
if (!current || typeof current !== "object") {
|
|
4963
4932
|
current = null;
|
|
4964
4933
|
}
|
|
@@ -4977,7 +4946,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4977
4946
|
}
|
|
4978
4947
|
const cloned = structuredClone(schema2);
|
|
4979
4948
|
const visited = /* @__PURE__ */ new Set();
|
|
4980
|
-
const resolve = async (current,
|
|
4949
|
+
const resolve = async (current, path38) => {
|
|
4981
4950
|
if (isIndexableObject(current)) {
|
|
4982
4951
|
if (visited.has(current)) {
|
|
4983
4952
|
return CIRCULAR_REF;
|
|
@@ -4985,7 +4954,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4985
4954
|
visited.add(current);
|
|
4986
4955
|
if (Array.isArray(current)) {
|
|
4987
4956
|
for (let index = 0; index < current.length; index++) {
|
|
4988
|
-
current[index] = await resolve(current[index], `${
|
|
4957
|
+
current[index] = await resolve(current[index], `${path38}/${index}`);
|
|
4989
4958
|
}
|
|
4990
4959
|
} else {
|
|
4991
4960
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -4996,13 +4965,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4996
4965
|
for (const resolver of resolvers) {
|
|
4997
4966
|
const resolved = await resolver($ref);
|
|
4998
4967
|
if (resolved) {
|
|
4999
|
-
result2 = await resolve(resolved,
|
|
4968
|
+
result2 = await resolve(resolved, path38);
|
|
5000
4969
|
break;
|
|
5001
4970
|
}
|
|
5002
4971
|
}
|
|
5003
4972
|
if (result2 === void 0) {
|
|
5004
4973
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
5005
|
-
result2 = await resolve(resolved,
|
|
4974
|
+
result2 = await resolve(resolved, path38);
|
|
5006
4975
|
}
|
|
5007
4976
|
if (hasSiblings) {
|
|
5008
4977
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -5015,7 +4984,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
5015
4984
|
return result2;
|
|
5016
4985
|
}
|
|
5017
4986
|
for (const key in current) {
|
|
5018
|
-
current[key] = await resolve(current[key], `${
|
|
4987
|
+
current[key] = await resolve(current[key], `${path38}/${key}`);
|
|
5019
4988
|
}
|
|
5020
4989
|
}
|
|
5021
4990
|
visited.delete(current);
|
|
@@ -5054,9 +5023,9 @@ var upgradeSchema = (schema2) => {
|
|
|
5054
5023
|
}
|
|
5055
5024
|
return sub;
|
|
5056
5025
|
});
|
|
5057
|
-
schema2 = traverse(schema2, (sub,
|
|
5026
|
+
schema2 = traverse(schema2, (sub, path38) => {
|
|
5058
5027
|
if (sub.example !== void 0) {
|
|
5059
|
-
if (isSchemaPath(
|
|
5028
|
+
if (isSchemaPath(path38 ?? [])) {
|
|
5060
5029
|
sub.examples = [sub.example];
|
|
5061
5030
|
} else {
|
|
5062
5031
|
sub.examples = {
|
|
@@ -5069,11 +5038,11 @@ var upgradeSchema = (schema2) => {
|
|
|
5069
5038
|
}
|
|
5070
5039
|
return sub;
|
|
5071
5040
|
});
|
|
5072
|
-
schema2 = traverse(schema2, (schema3,
|
|
5041
|
+
schema2 = traverse(schema2, (schema3, path38) => {
|
|
5073
5042
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
5074
|
-
const parentPath =
|
|
5043
|
+
const parentPath = path38?.slice(0, -1);
|
|
5075
5044
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
5076
|
-
return segment === "content" &&
|
|
5045
|
+
return segment === "content" && path38?.[index + 1] === "multipart/form-data";
|
|
5077
5046
|
});
|
|
5078
5047
|
if (isMultipart) {
|
|
5079
5048
|
const entries = Object.entries(schema3.properties);
|
|
@@ -5087,8 +5056,8 @@ var upgradeSchema = (schema2) => {
|
|
|
5087
5056
|
}
|
|
5088
5057
|
return schema3;
|
|
5089
5058
|
});
|
|
5090
|
-
schema2 = traverse(schema2, (schema3,
|
|
5091
|
-
if (
|
|
5059
|
+
schema2 = traverse(schema2, (schema3, path38) => {
|
|
5060
|
+
if (path38?.includes("content") && path38.includes("application/octet-stream")) {
|
|
5092
5061
|
return {};
|
|
5093
5062
|
}
|
|
5094
5063
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -5114,11 +5083,11 @@ var upgradeSchema = (schema2) => {
|
|
|
5114
5083
|
}
|
|
5115
5084
|
return sub;
|
|
5116
5085
|
});
|
|
5117
|
-
schema2 = traverse(schema2, (schema3,
|
|
5086
|
+
schema2 = traverse(schema2, (schema3, path38) => {
|
|
5118
5087
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
5119
|
-
const parentPath =
|
|
5088
|
+
const parentPath = path38?.slice(0, -1);
|
|
5120
5089
|
const contentMediaType = parentPath?.find(
|
|
5121
|
-
(_, index) =>
|
|
5090
|
+
(_, index) => path38?.[index - 1] === "content"
|
|
5122
5091
|
);
|
|
5123
5092
|
return {
|
|
5124
5093
|
type: "string",
|
|
@@ -5130,7 +5099,7 @@ var upgradeSchema = (schema2) => {
|
|
|
5130
5099
|
});
|
|
5131
5100
|
return schema2;
|
|
5132
5101
|
};
|
|
5133
|
-
function isSchemaPath(
|
|
5102
|
+
function isSchemaPath(path38) {
|
|
5134
5103
|
const schemaLocations = [
|
|
5135
5104
|
["components", "schemas"],
|
|
5136
5105
|
"properties",
|
|
@@ -5143,10 +5112,10 @@ function isSchemaPath(path37) {
|
|
|
5143
5112
|
];
|
|
5144
5113
|
return schemaLocations.some((location) => {
|
|
5145
5114
|
if (Array.isArray(location)) {
|
|
5146
|
-
return location.every((segment, index) =>
|
|
5115
|
+
return location.every((segment, index) => path38[index] === segment);
|
|
5147
5116
|
}
|
|
5148
|
-
return
|
|
5149
|
-
}) ||
|
|
5117
|
+
return path38.includes(location);
|
|
5118
|
+
}) || path38.includes("schema") || path38.some((segment) => segment.endsWith("Schema"));
|
|
5150
5119
|
}
|
|
5151
5120
|
|
|
5152
5121
|
// src/lib/oas/parser/index.ts
|
|
@@ -5228,13 +5197,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
5228
5197
|
"anyOf",
|
|
5229
5198
|
"oneOf"
|
|
5230
5199
|
]);
|
|
5231
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
5200
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path38 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
5232
5201
|
if (obj === null || typeof obj !== "object") return obj;
|
|
5233
5202
|
const refPath = obj.__$ref;
|
|
5234
5203
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
5235
5204
|
if (isCircular) {
|
|
5236
5205
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
5237
|
-
const circularProp =
|
|
5206
|
+
const circularProp = path38.find((p) => !OPENAPI_PROPS.has(p)) || path38[0];
|
|
5238
5207
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
5239
5208
|
}
|
|
5240
5209
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -5244,7 +5213,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
5244
5213
|
value,
|
|
5245
5214
|
currentPath,
|
|
5246
5215
|
refs,
|
|
5247
|
-
[...
|
|
5216
|
+
[...path38, key],
|
|
5248
5217
|
currentRefPaths
|
|
5249
5218
|
);
|
|
5250
5219
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -5279,7 +5248,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
5279
5248
|
var getAllTags = (schema2) => {
|
|
5280
5249
|
const rootTags = schema2.tags ?? [];
|
|
5281
5250
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
5282
|
-
(
|
|
5251
|
+
(path38) => HttpMethods.map((k) => path38?.[k]).filter((op) => op != null)
|
|
5283
5252
|
);
|
|
5284
5253
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
5285
5254
|
const hasUntaggedOperations = operations.some(
|
|
@@ -5334,7 +5303,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
5334
5303
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
5335
5304
|
var getAllOperations = (paths) => {
|
|
5336
5305
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
5337
|
-
([
|
|
5306
|
+
([path38, value]) => HttpMethods.flatMap((method) => {
|
|
5338
5307
|
if (!value?.[method]) return [];
|
|
5339
5308
|
const operation = value[method];
|
|
5340
5309
|
const pathParameters = value.parameters ?? [];
|
|
@@ -5354,7 +5323,7 @@ var getAllOperations = (paths) => {
|
|
|
5354
5323
|
return {
|
|
5355
5324
|
...operation,
|
|
5356
5325
|
method,
|
|
5357
|
-
path:
|
|
5326
|
+
path: path38,
|
|
5358
5327
|
parameters,
|
|
5359
5328
|
servers,
|
|
5360
5329
|
tags: operation.tags ?? []
|
|
@@ -5712,8 +5681,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
5712
5681
|
}),
|
|
5713
5682
|
paths: t.field({
|
|
5714
5683
|
type: [PathItem],
|
|
5715
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
5716
|
-
path:
|
|
5684
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path38, value]) => ({
|
|
5685
|
+
path: path38,
|
|
5717
5686
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
5718
5687
|
methods: Object.keys(value)
|
|
5719
5688
|
}))
|
|
@@ -5808,7 +5777,7 @@ var ensureArray = (value) => Array.isArray(value) ? value : [value];
|
|
|
5808
5777
|
|
|
5809
5778
|
// src/vite/api/SchemaManager.ts
|
|
5810
5779
|
import fs2 from "node:fs/promises";
|
|
5811
|
-
import
|
|
5780
|
+
import path8 from "node:path";
|
|
5812
5781
|
import {
|
|
5813
5782
|
$RefParser as $RefParser2
|
|
5814
5783
|
} from "@apidevtools/json-schema-ref-parser";
|
|
@@ -5860,7 +5829,7 @@ init_joinUrl();
|
|
|
5860
5829
|
|
|
5861
5830
|
// src/vite/api/schema-codegen.ts
|
|
5862
5831
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
5863
|
-
var getSegmentsFromPath = (
|
|
5832
|
+
var getSegmentsFromPath = (path38) => path38.split("/").slice(1).map(unescapeJsonPointer);
|
|
5864
5833
|
var createLocalRefMap = (obj) => {
|
|
5865
5834
|
const refMap = /* @__PURE__ */ new Map();
|
|
5866
5835
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -5891,16 +5860,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
5891
5860
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
5892
5861
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
5893
5862
|
);
|
|
5894
|
-
var lookup = (schema2,
|
|
5895
|
-
const parts = getSegmentsFromPath(
|
|
5863
|
+
var lookup = (schema2, path38, filePath) => {
|
|
5864
|
+
const parts = getSegmentsFromPath(path38);
|
|
5896
5865
|
let val = schema2;
|
|
5897
5866
|
for (const part of parts) {
|
|
5898
5867
|
while (val.$ref?.startsWith("#/")) {
|
|
5899
|
-
val = val.$ref ===
|
|
5868
|
+
val = val.$ref === path38 ? val : lookup(schema2, val.$ref, filePath);
|
|
5900
5869
|
}
|
|
5901
5870
|
if (val[part] === void 0) {
|
|
5902
5871
|
throw new Error(
|
|
5903
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
5872
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path38}`
|
|
5904
5873
|
);
|
|
5905
5874
|
}
|
|
5906
5875
|
val = val[part];
|
|
@@ -5998,18 +5967,18 @@ var SchemaManager = class {
|
|
|
5998
5967
|
];
|
|
5999
5968
|
}
|
|
6000
5969
|
getPathForFile = (input, params) => {
|
|
6001
|
-
const filePath =
|
|
5970
|
+
const filePath = path8.resolve(this.config.__meta.rootDir, input);
|
|
6002
5971
|
const apis = ensureArray(this.config.apis ?? []);
|
|
6003
5972
|
for (const apiConfig of apis) {
|
|
6004
5973
|
if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
|
|
6005
5974
|
const match = normalizeInputs(apiConfig.input).some(
|
|
6006
|
-
(i) =>
|
|
5975
|
+
(i) => path8.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
|
|
6007
5976
|
);
|
|
6008
5977
|
if (match) return apiConfig.path;
|
|
6009
5978
|
}
|
|
6010
5979
|
};
|
|
6011
5980
|
processSchema = async (input) => {
|
|
6012
|
-
const filePath =
|
|
5981
|
+
const filePath = path8.resolve(this.config.__meta.rootDir, input.input);
|
|
6013
5982
|
const params = input.params;
|
|
6014
5983
|
const configuredPath = this.getPathForFile(input.input, params);
|
|
6015
5984
|
if (!configuredPath) {
|
|
@@ -6045,9 +6014,9 @@ var SchemaManager = class {
|
|
|
6045
6014
|
const processedTime = Date.now();
|
|
6046
6015
|
const code = generateCode(processedSchema, filePath);
|
|
6047
6016
|
const prefixPath = slugify(configuredPath);
|
|
6048
|
-
const processedFilePath =
|
|
6017
|
+
const processedFilePath = path8.posix.join(
|
|
6049
6018
|
this.storeDir,
|
|
6050
|
-
`${prefixPath}-${
|
|
6019
|
+
`${prefixPath}-${path8.basename(filePath)}${paramsSuffix(params)}.js`
|
|
6051
6020
|
);
|
|
6052
6021
|
const importKey = processedFilePath;
|
|
6053
6022
|
await fs2.writeFile(processedFilePath, code);
|
|
@@ -6096,7 +6065,7 @@ var SchemaManager = class {
|
|
|
6096
6065
|
};
|
|
6097
6066
|
getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
|
|
6098
6067
|
getFilesToReprocess = (changedFile) => {
|
|
6099
|
-
const resolvedPath =
|
|
6068
|
+
const resolvedPath = path8.resolve(this.config.__meta.rootDir, changedFile);
|
|
6100
6069
|
const referencedBy = this.referencedBy.get(resolvedPath);
|
|
6101
6070
|
if (!referencedBy) return [];
|
|
6102
6071
|
const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
|
|
@@ -6125,7 +6094,7 @@ var SchemaManager = class {
|
|
|
6125
6094
|
version: "",
|
|
6126
6095
|
path: input.path ?? "",
|
|
6127
6096
|
label: input.label,
|
|
6128
|
-
inputPath:
|
|
6097
|
+
inputPath: path8.resolve(this.config.__meta.rootDir, input.input),
|
|
6129
6098
|
params: input.params,
|
|
6130
6099
|
importKey: "",
|
|
6131
6100
|
downloadUrl: "",
|
|
@@ -6145,8 +6114,8 @@ var SchemaManager = class {
|
|
|
6145
6114
|
}
|
|
6146
6115
|
}
|
|
6147
6116
|
};
|
|
6148
|
-
getLatestSchema = (
|
|
6149
|
-
getSchemasForPath = (
|
|
6117
|
+
getLatestSchema = (path38) => this.processedSchemas[path38]?.at(0);
|
|
6118
|
+
getSchemasForPath = (path38) => this.processedSchemas[path38];
|
|
6150
6119
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
6151
6120
|
getUrlToFilePathMap = () => {
|
|
6152
6121
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -6168,7 +6137,7 @@ var SchemaManager = class {
|
|
|
6168
6137
|
};
|
|
6169
6138
|
createSchemaPath = (inputPath, versionPath, apiPath, params) => {
|
|
6170
6139
|
const suffix = paramsSuffix(params);
|
|
6171
|
-
const extension = suffix ? ".json" :
|
|
6140
|
+
const extension = suffix ? ".json" : path8.extname(inputPath);
|
|
6172
6141
|
return joinUrl(
|
|
6173
6142
|
this.config.basePath,
|
|
6174
6143
|
apiPath,
|
|
@@ -6191,7 +6160,7 @@ var SchemaManager = class {
|
|
|
6191
6160
|
// src/vite/plugin-config-reload.ts
|
|
6192
6161
|
init_logger();
|
|
6193
6162
|
init_loader();
|
|
6194
|
-
import
|
|
6163
|
+
import path11 from "node:path";
|
|
6195
6164
|
import colors3 from "picocolors";
|
|
6196
6165
|
|
|
6197
6166
|
// src/vite/plugin-navigation.ts
|
|
@@ -6201,14 +6170,14 @@ import { stringify as stringify3 } from "javascript-stringify";
|
|
|
6201
6170
|
import { isElement } from "react-is";
|
|
6202
6171
|
|
|
6203
6172
|
// src/config/validators/NavigationSchema.ts
|
|
6204
|
-
import
|
|
6173
|
+
import path9 from "node:path";
|
|
6205
6174
|
import { glob } from "glob";
|
|
6206
6175
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
6207
6176
|
import { mdxFromMarkdown } from "mdast-util-mdx";
|
|
6208
6177
|
import { mdxjs } from "micromark-extension-mdxjs";
|
|
6209
6178
|
|
|
6210
6179
|
// src/lib/util/readFrontmatter.ts
|
|
6211
|
-
import { readFile
|
|
6180
|
+
import { readFile } from "node:fs/promises";
|
|
6212
6181
|
import matter from "gray-matter";
|
|
6213
6182
|
import { parse, stringify as stringify2 } from "yaml";
|
|
6214
6183
|
var yaml = {
|
|
@@ -6216,7 +6185,7 @@ var yaml = {
|
|
|
6216
6185
|
stringify: (obj) => stringify2(obj)
|
|
6217
6186
|
};
|
|
6218
6187
|
var readFrontmatter = async (filePath) => {
|
|
6219
|
-
const content = await
|
|
6188
|
+
const content = await readFile(filePath, "utf-8");
|
|
6220
6189
|
const normalizedContent = content.replace(/\r\n/g, "\n");
|
|
6221
6190
|
return matter(normalizedContent, { engines: { yaml } });
|
|
6222
6191
|
};
|
|
@@ -6252,7 +6221,7 @@ var extractRichH1 = (content) => {
|
|
|
6252
6221
|
}
|
|
6253
6222
|
};
|
|
6254
6223
|
var isNavigationItem = (item) => item !== void 0;
|
|
6255
|
-
var toPosixPath = (filePath) => filePath.split(
|
|
6224
|
+
var toPosixPath = (filePath) => filePath.split(path9.win32.sep).join(path9.posix.sep);
|
|
6256
6225
|
var NavigationResolver = class {
|
|
6257
6226
|
rootDir;
|
|
6258
6227
|
globPatterns;
|
|
@@ -6385,13 +6354,13 @@ init_invariant();
|
|
|
6385
6354
|
|
|
6386
6355
|
// src/vite/debug.ts
|
|
6387
6356
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
6388
|
-
import
|
|
6357
|
+
import path10 from "node:path";
|
|
6389
6358
|
async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
|
|
6390
6359
|
if (process.env.ZUDOKU_BUILD_DEBUG) {
|
|
6391
|
-
const debugDir =
|
|
6360
|
+
const debugDir = path10.join(rootDir, "dist", "debug");
|
|
6392
6361
|
await mkdir(debugDir, { recursive: true });
|
|
6393
6362
|
await writeFile(
|
|
6394
|
-
|
|
6363
|
+
path10.join(debugDir, `${pluginName}.${extension}`),
|
|
6395
6364
|
typeof code === "string" ? code : code.join("\n")
|
|
6396
6365
|
);
|
|
6397
6366
|
}
|
|
@@ -6502,7 +6471,7 @@ var viteConfigReloadPlugin = () => ({
|
|
|
6502
6471
|
});
|
|
6503
6472
|
logger.info(
|
|
6504
6473
|
colors3.blue(
|
|
6505
|
-
`Config ${
|
|
6474
|
+
`Config ${path11.basename(currentConfig.__meta.configPath)} changed. Reloading...`
|
|
6506
6475
|
),
|
|
6507
6476
|
{ timestamp: true }
|
|
6508
6477
|
);
|
|
@@ -6513,14 +6482,14 @@ var viteConfigReloadPlugin = () => ({
|
|
|
6513
6482
|
// src/vite/plugin-api.ts
|
|
6514
6483
|
var viteApiPlugin = async () => {
|
|
6515
6484
|
const virtualModuleId4 = "virtual:zudoku-api-plugins";
|
|
6516
|
-
const
|
|
6485
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
6517
6486
|
const initialConfig = getCurrentConfig();
|
|
6518
6487
|
const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
|
|
6519
|
-
|
|
6488
|
+
path12.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
|
|
6520
6489
|
).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
|
|
6521
6490
|
const buildConfig = await getBuildConfig();
|
|
6522
6491
|
const buildProcessors = buildConfig?.processors ?? [];
|
|
6523
|
-
const tmpStoreDir =
|
|
6492
|
+
const tmpStoreDir = path12.posix.join(
|
|
6524
6493
|
initialConfig.__meta.rootDir,
|
|
6525
6494
|
"node_modules/.apitogo/processed"
|
|
6526
6495
|
);
|
|
@@ -6548,7 +6517,7 @@ var viteApiPlugin = async () => {
|
|
|
6548
6517
|
const inputPath = pathMap.get(req.url);
|
|
6549
6518
|
if (!inputPath) return next();
|
|
6550
6519
|
const content = await fs3.readFile(inputPath, "utf-8");
|
|
6551
|
-
const mimeType =
|
|
6520
|
+
const mimeType = path12.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
|
|
6552
6521
|
res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
|
|
6553
6522
|
return res.end(content);
|
|
6554
6523
|
});
|
|
@@ -6566,11 +6535,11 @@ var viteApiPlugin = async () => {
|
|
|
6566
6535
|
},
|
|
6567
6536
|
resolveId(id) {
|
|
6568
6537
|
if (id === virtualModuleId4) {
|
|
6569
|
-
return
|
|
6538
|
+
return resolvedVirtualModuleId5;
|
|
6570
6539
|
}
|
|
6571
6540
|
},
|
|
6572
6541
|
async load(id) {
|
|
6573
|
-
if (id !==
|
|
6542
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
6574
6543
|
const config2 = getCurrentConfig();
|
|
6575
6544
|
if (!deepEqual2(schemaManager.config.apis, config2.apis)) {
|
|
6576
6545
|
schemaManager.config = config2;
|
|
@@ -6736,8 +6705,8 @@ var viteApiPlugin = async () => {
|
|
|
6736
6705
|
if (process.env.NODE_ENV !== "production") return;
|
|
6737
6706
|
for (const [urlPath, inputPath] of pathMap) {
|
|
6738
6707
|
const content = await fs3.readFile(inputPath, "utf-8");
|
|
6739
|
-
const outputPath =
|
|
6740
|
-
await fs3.mkdir(
|
|
6708
|
+
const outputPath = path12.join(config2.__meta.rootDir, "dist", urlPath);
|
|
6709
|
+
await fs3.mkdir(path12.dirname(outputPath), { recursive: true });
|
|
6741
6710
|
await fs3.writeFile(outputPath, content, "utf-8");
|
|
6742
6711
|
}
|
|
6743
6712
|
}
|
|
@@ -6749,17 +6718,17 @@ var plugin_api_default = viteApiPlugin;
|
|
|
6749
6718
|
init_loader();
|
|
6750
6719
|
var viteAuthPlugin = () => {
|
|
6751
6720
|
const virtualModuleId4 = "virtual:zudoku-auth";
|
|
6752
|
-
const
|
|
6721
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
6753
6722
|
return {
|
|
6754
6723
|
name: "zudoku-auth-plugin",
|
|
6755
6724
|
// required, will show up in warnings and errors
|
|
6756
6725
|
resolveId(id) {
|
|
6757
6726
|
if (id === virtualModuleId4) {
|
|
6758
|
-
return
|
|
6727
|
+
return resolvedVirtualModuleId5;
|
|
6759
6728
|
}
|
|
6760
6729
|
},
|
|
6761
6730
|
async load(id) {
|
|
6762
|
-
if (id ===
|
|
6731
|
+
if (id === resolvedVirtualModuleId5) {
|
|
6763
6732
|
const config2 = getCurrentConfig();
|
|
6764
6733
|
if (!config2.authentication || config2.__meta.mode === "standalone") {
|
|
6765
6734
|
return `export const configuredAuthProvider = undefined;`;
|
|
@@ -6780,7 +6749,7 @@ var plugin_auth_default = viteAuthPlugin;
|
|
|
6780
6749
|
|
|
6781
6750
|
// src/vite/plugin-component.ts
|
|
6782
6751
|
init_loader();
|
|
6783
|
-
import
|
|
6752
|
+
import path13 from "node:path";
|
|
6784
6753
|
var viteAliasPlugin = () => {
|
|
6785
6754
|
return {
|
|
6786
6755
|
name: "zudoku-component-plugin",
|
|
@@ -6808,7 +6777,7 @@ var viteAliasPlugin = () => {
|
|
|
6808
6777
|
];
|
|
6809
6778
|
const aliases = replacements.map(([find, replacement]) => ({
|
|
6810
6779
|
find,
|
|
6811
|
-
replacement:
|
|
6780
|
+
replacement: path13.posix.join(config2.__meta.moduleDir, replacement)
|
|
6812
6781
|
}));
|
|
6813
6782
|
return config2.__meta.mode === "internal" || config2.__meta.mode === "standalone" ? { resolve: { alias: aliases } } : void 0;
|
|
6814
6783
|
}
|
|
@@ -6880,16 +6849,16 @@ var plugin_config_default = viteConfigPlugin;
|
|
|
6880
6849
|
init_loader();
|
|
6881
6850
|
var viteCustomPagesPlugin = () => {
|
|
6882
6851
|
const virtualModuleId4 = "virtual:zudoku-custom-pages-plugin";
|
|
6883
|
-
const
|
|
6852
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
6884
6853
|
return {
|
|
6885
6854
|
name: "zudoku-custom-pages-plugin",
|
|
6886
6855
|
resolveId(id) {
|
|
6887
6856
|
if (id === virtualModuleId4) {
|
|
6888
|
-
return
|
|
6857
|
+
return resolvedVirtualModuleId5;
|
|
6889
6858
|
}
|
|
6890
6859
|
},
|
|
6891
6860
|
async load(id) {
|
|
6892
|
-
if (id ===
|
|
6861
|
+
if (id === resolvedVirtualModuleId5) {
|
|
6893
6862
|
const config2 = getCurrentConfig();
|
|
6894
6863
|
if (config2.__meta.mode === "standalone" || !config2.navigation) {
|
|
6895
6864
|
return `export const configuredCustomPagesPlugin = undefined;`;
|
|
@@ -6945,7 +6914,7 @@ var viteDocMetadataPlugin = () => ({
|
|
|
6945
6914
|
|
|
6946
6915
|
// src/vite/plugin-docs.ts
|
|
6947
6916
|
init_loader();
|
|
6948
|
-
import
|
|
6917
|
+
import path14 from "node:path";
|
|
6949
6918
|
import { glob as glob3 } from "glob";
|
|
6950
6919
|
import globParent from "glob-parent";
|
|
6951
6920
|
init_ZudokuConfig();
|
|
@@ -7014,7 +6983,7 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
7014
6983
|
if (process.env.NODE_ENV !== "development") {
|
|
7015
6984
|
const draftStatuses = await Promise.all(
|
|
7016
6985
|
globbedFiles.map(async (file) => {
|
|
7017
|
-
const absolutePath =
|
|
6986
|
+
const absolutePath = path14.resolve(config2.__meta.rootDir, file);
|
|
7018
6987
|
const { data } = await readFrontmatter(absolutePath);
|
|
7019
6988
|
return { file, isDraft: data.draft === true };
|
|
7020
6989
|
})
|
|
@@ -7027,9 +6996,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
7027
6996
|
if (draftFiles.has(file)) {
|
|
7028
6997
|
continue;
|
|
7029
6998
|
}
|
|
7030
|
-
const relativePath =
|
|
6999
|
+
const relativePath = path14.posix.relative(parent, file);
|
|
7031
7000
|
const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
|
|
7032
|
-
const filePath = options.absolute ?
|
|
7001
|
+
const filePath = options.absolute ? path14.resolve(config2.__meta.rootDir, file) : file;
|
|
7033
7002
|
fileMapping[routePath] = filePath;
|
|
7034
7003
|
}
|
|
7035
7004
|
}
|
|
@@ -7065,16 +7034,16 @@ var resolveCustomNavigationPaths = async (config2, fileMapping) => {
|
|
|
7065
7034
|
};
|
|
7066
7035
|
var viteDocsPlugin = () => {
|
|
7067
7036
|
const virtualModuleId4 = "virtual:zudoku-docs-plugin";
|
|
7068
|
-
const
|
|
7037
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7069
7038
|
return {
|
|
7070
7039
|
name: "zudoku-docs-plugin",
|
|
7071
7040
|
resolveId(id) {
|
|
7072
7041
|
if (id === virtualModuleId4) {
|
|
7073
|
-
return
|
|
7042
|
+
return resolvedVirtualModuleId5;
|
|
7074
7043
|
}
|
|
7075
7044
|
},
|
|
7076
7045
|
async load(id) {
|
|
7077
|
-
if (id !==
|
|
7046
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
7078
7047
|
const config2 = getCurrentConfig();
|
|
7079
7048
|
if (config2.__meta.mode === "standalone" || !config2.__resolvedModules.docs.enabled) {
|
|
7080
7049
|
return `export const configuredDocsPlugin = undefined;`;
|
|
@@ -7093,7 +7062,7 @@ var viteDocsPlugin = () => {
|
|
|
7093
7062
|
const globbedDocuments = {};
|
|
7094
7063
|
for (const [routePath, file] of Object.entries(fileMapping)) {
|
|
7095
7064
|
const importPath = ensureLeadingSlash(
|
|
7096
|
-
|
|
7065
|
+
path14.posix.join(globImportBasePath, file)
|
|
7097
7066
|
);
|
|
7098
7067
|
globbedDocuments[routePath] = importPath;
|
|
7099
7068
|
}
|
|
@@ -7121,7 +7090,7 @@ init_loader();
|
|
|
7121
7090
|
init_ProtectedRoutesSchema();
|
|
7122
7091
|
init_joinUrl();
|
|
7123
7092
|
import { mkdir as mkdir2, writeFile as writeFile2 } from "node:fs/promises";
|
|
7124
|
-
import
|
|
7093
|
+
import path15 from "node:path";
|
|
7125
7094
|
import { matchPath } from "react-router";
|
|
7126
7095
|
var processMarkdownFile = async (filePath) => {
|
|
7127
7096
|
const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
|
|
@@ -7209,7 +7178,7 @@ var viteMarkdownExportPlugin = () => {
|
|
|
7209
7178
|
if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
|
|
7210
7179
|
return;
|
|
7211
7180
|
}
|
|
7212
|
-
const distDir =
|
|
7181
|
+
const distDir = path15.join(
|
|
7213
7182
|
config2.__meta.rootDir,
|
|
7214
7183
|
"dist",
|
|
7215
7184
|
config2.basePath ?? ""
|
|
@@ -7230,15 +7199,15 @@ var viteMarkdownExportPlugin = () => {
|
|
|
7230
7199
|
content: finalMarkdown
|
|
7231
7200
|
});
|
|
7232
7201
|
const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
|
|
7233
|
-
const outputPath = `${
|
|
7234
|
-
await mkdir2(
|
|
7202
|
+
const outputPath = `${path15.join(distDir, ...segments)}.md`;
|
|
7203
|
+
await mkdir2(path15.dirname(outputPath), { recursive: true });
|
|
7235
7204
|
await writeFile2(outputPath, finalMarkdown, "utf-8");
|
|
7236
7205
|
} catch (error) {
|
|
7237
7206
|
console.warn(`Failed to export markdown for ${routePath}:`, error);
|
|
7238
7207
|
}
|
|
7239
7208
|
}
|
|
7240
7209
|
if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
|
|
7241
|
-
const markdownInfoPath =
|
|
7210
|
+
const markdownInfoPath = path15.join(
|
|
7242
7211
|
config2.__meta.rootDir,
|
|
7243
7212
|
"node_modules/.apitogo/markdown-info.json"
|
|
7244
7213
|
);
|
|
@@ -7390,9 +7359,9 @@ var remarkCodeTabs = () => (tree) => {
|
|
|
7390
7359
|
};
|
|
7391
7360
|
|
|
7392
7361
|
// src/vite/mdx/remark-inject-filepath.ts
|
|
7393
|
-
import
|
|
7362
|
+
import path16 from "node:path";
|
|
7394
7363
|
var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
|
|
7395
|
-
const relativePath =
|
|
7364
|
+
const relativePath = path16.relative(rootDir, vfile.path).split(path16.sep).join(path16.posix.sep);
|
|
7396
7365
|
tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
|
|
7397
7366
|
};
|
|
7398
7367
|
|
|
@@ -7479,18 +7448,18 @@ var remarkLastModified = () => {
|
|
|
7479
7448
|
};
|
|
7480
7449
|
|
|
7481
7450
|
// src/vite/mdx/remark-link-rewrite.ts
|
|
7482
|
-
import
|
|
7451
|
+
import path17 from "node:path";
|
|
7483
7452
|
import { visit as visit5 } from "unist-util-visit";
|
|
7484
7453
|
var remarkLinkRewrite = (basePath = "") => (tree) => {
|
|
7485
7454
|
visit5(tree, "link", (node) => {
|
|
7486
7455
|
if (!node.url) return;
|
|
7487
7456
|
if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
|
|
7488
7457
|
node.url = node.url.replace(/\\/g, "/");
|
|
7489
|
-
const base =
|
|
7458
|
+
const base = path17.posix.join(basePath);
|
|
7490
7459
|
if (basePath && node.url.startsWith(base)) {
|
|
7491
7460
|
node.url = node.url.slice(base.length);
|
|
7492
7461
|
} else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
|
|
7493
|
-
node.url =
|
|
7462
|
+
node.url = path17.posix.join("..", node.url);
|
|
7494
7463
|
}
|
|
7495
7464
|
node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
|
|
7496
7465
|
});
|
|
@@ -7710,23 +7679,23 @@ var plugin_mdx_default = viteMdxPlugin;
|
|
|
7710
7679
|
|
|
7711
7680
|
// src/vite/plugin-modules.ts
|
|
7712
7681
|
init_loader();
|
|
7713
|
-
import
|
|
7682
|
+
import path18 from "node:path";
|
|
7714
7683
|
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(
|
|
7684
|
+
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path18.join(moduleDir, "../module-landing/src/index.tsx")) : "@lukoweb/apitogo-module-landing";
|
|
7685
|
+
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path18.join(moduleDir, "../module-user-panel/src/index.tsx")) : "@lukoweb/apitogo-module-user-panel";
|
|
7686
|
+
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(path18.resolve(rootDir, pagePath));
|
|
7718
7687
|
var viteModulesPlugin = () => {
|
|
7719
7688
|
const virtualModuleId4 = "virtual:zudoku-modules-plugin";
|
|
7720
|
-
const
|
|
7689
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7721
7690
|
return {
|
|
7722
7691
|
name: "zudoku-modules-plugin",
|
|
7723
7692
|
resolveId(id) {
|
|
7724
7693
|
if (id === virtualModuleId4) {
|
|
7725
|
-
return
|
|
7694
|
+
return resolvedVirtualModuleId5;
|
|
7726
7695
|
}
|
|
7727
7696
|
},
|
|
7728
7697
|
async load(id) {
|
|
7729
|
-
if (id !==
|
|
7698
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
7730
7699
|
const config2 = getCurrentConfig();
|
|
7731
7700
|
const { landing, userPanel } = config2.__resolvedModules;
|
|
7732
7701
|
if (config2.__meta.mode === "standalone") {
|
|
@@ -7827,10 +7796,10 @@ var plugin_modules_default = viteModulesPlugin;
|
|
|
7827
7796
|
|
|
7828
7797
|
// src/vite/plugin-search.ts
|
|
7829
7798
|
init_loader();
|
|
7830
|
-
import
|
|
7799
|
+
import path19 from "node:path";
|
|
7831
7800
|
var viteSearchPlugin = () => {
|
|
7832
7801
|
const virtualModuleId4 = "virtual:zudoku-search-plugin";
|
|
7833
|
-
const
|
|
7802
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7834
7803
|
let resolvedViteConfig;
|
|
7835
7804
|
return {
|
|
7836
7805
|
name: "zudoku-search-plugin",
|
|
@@ -7842,14 +7811,14 @@ var viteSearchPlugin = () => {
|
|
|
7842
7811
|
},
|
|
7843
7812
|
resolveId(id) {
|
|
7844
7813
|
if (id === virtualModuleId4) {
|
|
7845
|
-
return
|
|
7814
|
+
return resolvedVirtualModuleId5;
|
|
7846
7815
|
}
|
|
7847
7816
|
if (id === "/pagefind/pagefind.js" && resolvedViteConfig?.publicDir) {
|
|
7848
|
-
return
|
|
7817
|
+
return path19.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
|
|
7849
7818
|
}
|
|
7850
7819
|
},
|
|
7851
7820
|
async load(id) {
|
|
7852
|
-
if (id !==
|
|
7821
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
7853
7822
|
const config2 = getCurrentConfig();
|
|
7854
7823
|
if (!config2.search || config2.__meta.mode === "standalone") {
|
|
7855
7824
|
return `export const configuredSearchPlugin = undefined;`;
|
|
@@ -7889,7 +7858,7 @@ var aliasToId = new Map(
|
|
|
7889
7858
|
var resolveLang = (lang) => aliasToId.get(lang) ?? lang;
|
|
7890
7859
|
var viteShikiRegisterPlugin = () => {
|
|
7891
7860
|
const virtualModuleId4 = "virtual:zudoku-shiki-register";
|
|
7892
|
-
const
|
|
7861
|
+
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
7893
7862
|
return {
|
|
7894
7863
|
name: "vite-plugin-shiki-register",
|
|
7895
7864
|
config() {
|
|
@@ -7918,11 +7887,11 @@ var viteShikiRegisterPlugin = () => {
|
|
|
7918
7887
|
},
|
|
7919
7888
|
resolveId(id) {
|
|
7920
7889
|
if (id === virtualModuleId4) {
|
|
7921
|
-
return
|
|
7890
|
+
return resolvedVirtualModuleId5;
|
|
7922
7891
|
}
|
|
7923
7892
|
},
|
|
7924
7893
|
async load(id) {
|
|
7925
|
-
if (id !==
|
|
7894
|
+
if (id !== resolvedVirtualModuleId5) return;
|
|
7926
7895
|
const config2 = getCurrentConfig();
|
|
7927
7896
|
const languages = config2.syntaxHighlighting?.languages ?? defaultLanguages;
|
|
7928
7897
|
const themes = Object.values(
|
|
@@ -7956,12 +7925,168 @@ var viteShikiRegisterPlugin = () => {
|
|
|
7956
7925
|
};
|
|
7957
7926
|
};
|
|
7958
7927
|
|
|
7928
|
+
// src/vite/plugin-local-manifest.ts
|
|
7929
|
+
import path21 from "node:path";
|
|
7930
|
+
|
|
7931
|
+
// src/config/local-manifest.ts
|
|
7932
|
+
import path20 from "node:path";
|
|
7933
|
+
import { z as z10 } from "zod";
|
|
7934
|
+
var DEV_PORTAL_MANIFEST_FILENAME = "apitogo.local.json";
|
|
7935
|
+
var BillingPeriodSchema = z10.enum([
|
|
7936
|
+
"month",
|
|
7937
|
+
"year",
|
|
7938
|
+
"monthly",
|
|
7939
|
+
"annual"
|
|
7940
|
+
]);
|
|
7941
|
+
var ManifestPlanInputSchema = z10.object({
|
|
7942
|
+
sku: z10.string().min(1),
|
|
7943
|
+
displayName: z10.string().min(1),
|
|
7944
|
+
isFree: z10.boolean(),
|
|
7945
|
+
priceAmount: z10.number().optional(),
|
|
7946
|
+
priceCurrency: z10.string().optional(),
|
|
7947
|
+
billingPeriod: BillingPeriodSchema.optional(),
|
|
7948
|
+
limitsJson: z10.string().optional(),
|
|
7949
|
+
includedActionKeys: z10.array(z10.string()).optional()
|
|
7950
|
+
});
|
|
7951
|
+
var DevPortalLocalManifestSchema = z10.object({
|
|
7952
|
+
siteName: z10.string().optional(),
|
|
7953
|
+
branding: z10.object({
|
|
7954
|
+
title: z10.string().optional(),
|
|
7955
|
+
logoUrl: z10.string().optional()
|
|
7956
|
+
}).optional(),
|
|
7957
|
+
plans: z10.array(ManifestPlanInputSchema).optional(),
|
|
7958
|
+
backend: z10.object({
|
|
7959
|
+
sourceDirectory: z10.string().optional(),
|
|
7960
|
+
publishDirectory: z10.string().optional(),
|
|
7961
|
+
openApiPath: z10.string().optional(),
|
|
7962
|
+
runtime: z10.string().optional(),
|
|
7963
|
+
runtimeVersion: z10.string().optional(),
|
|
7964
|
+
deployed: z10.boolean().optional()
|
|
7965
|
+
}).optional(),
|
|
7966
|
+
gateway: z10.object({
|
|
7967
|
+
authMode: z10.enum(["platformManagedEntra", "bringYourOwnOidc"]).optional(),
|
|
7968
|
+
oidcMetadataUrl: z10.string().optional(),
|
|
7969
|
+
oidcAllowedIssuers: z10.array(z10.string()).optional(),
|
|
7970
|
+
oidcAudiences: z10.array(z10.string()).optional(),
|
|
7971
|
+
limitsJson: z10.string().optional(),
|
|
7972
|
+
publicHealthActionKey: z10.string().optional()
|
|
7973
|
+
}).optional(),
|
|
7974
|
+
projectId: z10.string().optional(),
|
|
7975
|
+
projectName: z10.string().optional()
|
|
7976
|
+
});
|
|
7977
|
+
function normalizeBillingPeriod(period) {
|
|
7978
|
+
if (!period) {
|
|
7979
|
+
return "monthly";
|
|
7980
|
+
}
|
|
7981
|
+
const normalized = period.toLowerCase();
|
|
7982
|
+
if (normalized === "month") {
|
|
7983
|
+
return "monthly";
|
|
7984
|
+
}
|
|
7985
|
+
if (normalized === "year") {
|
|
7986
|
+
return "annual";
|
|
7987
|
+
}
|
|
7988
|
+
return normalized;
|
|
7989
|
+
}
|
|
7990
|
+
function plansToPreviewCatalog(plans) {
|
|
7991
|
+
if (!plans?.length) {
|
|
7992
|
+
return { plans: [] };
|
|
7993
|
+
}
|
|
7994
|
+
return {
|
|
7995
|
+
plans: plans.map((plan) => ({
|
|
7996
|
+
sku: plan.sku,
|
|
7997
|
+
displayName: plan.displayName,
|
|
7998
|
+
isFree: plan.isFree,
|
|
7999
|
+
priceAmount: plan.priceAmount ?? 0,
|
|
8000
|
+
priceCurrency: plan.priceCurrency ?? "usd",
|
|
8001
|
+
billingPeriod: normalizeBillingPeriod(plan.billingPeriod),
|
|
8002
|
+
limitsJson: plan.limitsJson ?? null,
|
|
8003
|
+
includedActionKeys: plan.includedActionKeys ?? []
|
|
8004
|
+
}))
|
|
8005
|
+
};
|
|
8006
|
+
}
|
|
8007
|
+
function manifestFilePath(rootDir) {
|
|
8008
|
+
return path20.join(path20.resolve(rootDir), DEV_PORTAL_MANIFEST_FILENAME);
|
|
8009
|
+
}
|
|
8010
|
+
function parseLocalManifestJson(raw) {
|
|
8011
|
+
try {
|
|
8012
|
+
const parsed = JSON.parse(raw);
|
|
8013
|
+
const result = DevPortalLocalManifestSchema.safeParse(parsed);
|
|
8014
|
+
if (!result.success) {
|
|
8015
|
+
return null;
|
|
8016
|
+
}
|
|
8017
|
+
return result.data;
|
|
8018
|
+
} catch {
|
|
8019
|
+
return null;
|
|
8020
|
+
}
|
|
8021
|
+
}
|
|
8022
|
+
|
|
8023
|
+
// src/vite/plugin-local-manifest.ts
|
|
8024
|
+
var APITOGO_LOCAL_MANIFEST_VIRTUAL_ID = "virtual:apitogo-local-manifest";
|
|
8025
|
+
var resolvedVirtualModuleId4 = `\0${APITOGO_LOCAL_MANIFEST_VIRTUAL_ID}`;
|
|
8026
|
+
var viteLocalManifestPlugin = () => {
|
|
8027
|
+
let rootDir = "";
|
|
8028
|
+
let manifestPath = "";
|
|
8029
|
+
const loadManifestModule = async () => {
|
|
8030
|
+
const { readFile: readFile8 } = await import("node:fs/promises");
|
|
8031
|
+
let catalog = { plans: [] };
|
|
8032
|
+
try {
|
|
8033
|
+
const raw = await readFile8(manifestPath, "utf8");
|
|
8034
|
+
const manifest = parseLocalManifestJson(raw);
|
|
8035
|
+
catalog = plansToPreviewCatalog(manifest?.plans);
|
|
8036
|
+
} catch {
|
|
8037
|
+
}
|
|
8038
|
+
return `export default ${JSON.stringify(catalog)};`;
|
|
8039
|
+
};
|
|
8040
|
+
return {
|
|
8041
|
+
name: "apitogo-local-manifest-plugin",
|
|
8042
|
+
configResolved(resolvedConfig) {
|
|
8043
|
+
rootDir = resolvedConfig.root;
|
|
8044
|
+
manifestPath = manifestFilePath(rootDir);
|
|
8045
|
+
},
|
|
8046
|
+
resolveId(id) {
|
|
8047
|
+
if (id === APITOGO_LOCAL_MANIFEST_VIRTUAL_ID) {
|
|
8048
|
+
return resolvedVirtualModuleId4;
|
|
8049
|
+
}
|
|
8050
|
+
},
|
|
8051
|
+
async load(id) {
|
|
8052
|
+
if (id !== resolvedVirtualModuleId4) {
|
|
8053
|
+
return;
|
|
8054
|
+
}
|
|
8055
|
+
return loadManifestModule();
|
|
8056
|
+
},
|
|
8057
|
+
configureServer(server) {
|
|
8058
|
+
const watchPath = path21.join(rootDir, DEV_PORTAL_MANIFEST_FILENAME);
|
|
8059
|
+
server.watcher.add(watchPath);
|
|
8060
|
+
server.watcher.on("change", async (changedPath) => {
|
|
8061
|
+
if (path21.resolve(changedPath) !== path21.resolve(manifestPath)) {
|
|
8062
|
+
return;
|
|
8063
|
+
}
|
|
8064
|
+
const module = server.moduleGraph.getModuleById(
|
|
8065
|
+
resolvedVirtualModuleId4
|
|
8066
|
+
);
|
|
8067
|
+
if (module) {
|
|
8068
|
+
server.moduleGraph.invalidateModule(module);
|
|
8069
|
+
}
|
|
8070
|
+
const mod = await server.moduleGraph.getModuleByUrl(
|
|
8071
|
+
APITOGO_LOCAL_MANIFEST_VIRTUAL_ID
|
|
8072
|
+
);
|
|
8073
|
+
if (mod) {
|
|
8074
|
+
server.reloadModule(mod);
|
|
8075
|
+
}
|
|
8076
|
+
server.ws.send({ type: "full-reload", path: "*" });
|
|
8077
|
+
});
|
|
8078
|
+
}
|
|
8079
|
+
};
|
|
8080
|
+
};
|
|
8081
|
+
var plugin_local_manifest_default = viteLocalManifestPlugin;
|
|
8082
|
+
|
|
7959
8083
|
// src/vite/plugin.ts
|
|
7960
8084
|
init_plugin_theme();
|
|
7961
8085
|
function vitePlugin() {
|
|
7962
8086
|
return [
|
|
7963
8087
|
viteShikiRegisterPlugin(),
|
|
7964
8088
|
viteConfigReloadPlugin(),
|
|
8089
|
+
plugin_local_manifest_default(),
|
|
7965
8090
|
plugin_mdx_default(),
|
|
7966
8091
|
react({ include: /\.(mdx?|jsx?|tsx?)$/ }),
|
|
7967
8092
|
plugin_config_default(),
|
|
@@ -7986,10 +8111,10 @@ function vitePlugin() {
|
|
|
7986
8111
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
7987
8112
|
if (merged.publicDir === false) return void 0;
|
|
7988
8113
|
const rel = typeof merged.publicDir === "string" ? merged.publicDir : "public";
|
|
7989
|
-
return
|
|
8114
|
+
return path22.resolve(rootDir, rel);
|
|
7990
8115
|
};
|
|
7991
|
-
var getAppClientEntryPath = () =>
|
|
7992
|
-
var getAppServerEntryPath = () =>
|
|
8116
|
+
var getAppClientEntryPath = () => path22.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
|
|
8117
|
+
var getAppServerEntryPath = () => path22.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
7993
8118
|
var hasLoggedCdnInfo = false;
|
|
7994
8119
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
7995
8120
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
@@ -8019,7 +8144,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8019
8144
|
);
|
|
8020
8145
|
if (ZuploEnv.isZuplo) {
|
|
8021
8146
|
dotenv.config({
|
|
8022
|
-
path:
|
|
8147
|
+
path: path22.resolve(config2.__meta.rootDir, "../.env.zuplo"),
|
|
8023
8148
|
quiet: true
|
|
8024
8149
|
});
|
|
8025
8150
|
}
|
|
@@ -8078,8 +8203,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8078
8203
|
ssr: configEnv.isSsrBuild,
|
|
8079
8204
|
sourcemap: true,
|
|
8080
8205
|
target: "es2022",
|
|
8081
|
-
outDir:
|
|
8082
|
-
|
|
8206
|
+
outDir: path22.resolve(
|
|
8207
|
+
path22.join(
|
|
8083
8208
|
dir,
|
|
8084
8209
|
"dist",
|
|
8085
8210
|
config2.basePath ?? "",
|
|
@@ -8098,7 +8223,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8098
8223
|
},
|
|
8099
8224
|
experimental: {
|
|
8100
8225
|
renderBuiltUrl(filename) {
|
|
8101
|
-
if (cdnUrl?.base && [".js", ".css"].includes(
|
|
8226
|
+
if (cdnUrl?.base && [".js", ".css"].includes(path22.extname(filename))) {
|
|
8102
8227
|
return joinUrl(cdnUrl.base, filename);
|
|
8103
8228
|
}
|
|
8104
8229
|
if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
|
|
@@ -8111,7 +8236,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
8111
8236
|
esbuildOptions: {
|
|
8112
8237
|
target: "es2022"
|
|
8113
8238
|
},
|
|
8114
|
-
entries: [
|
|
8239
|
+
entries: [path22.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
|
|
8115
8240
|
exclude: ["@lukoweb/apitogo"],
|
|
8116
8241
|
include: [
|
|
8117
8242
|
"react-dom/client",
|
|
@@ -8214,7 +8339,7 @@ init_package_json();
|
|
|
8214
8339
|
init_joinUrl();
|
|
8215
8340
|
import assert from "node:assert";
|
|
8216
8341
|
import { cp, mkdir as mkdir3, writeFile as writeFile3 } from "node:fs/promises";
|
|
8217
|
-
import
|
|
8342
|
+
import path23 from "node:path";
|
|
8218
8343
|
var pkgJson = getZudokuPackageJson();
|
|
8219
8344
|
function generateOutput({
|
|
8220
8345
|
config: config2,
|
|
@@ -8271,9 +8396,9 @@ async function writeOutput(dir, {
|
|
|
8271
8396
|
rewrites
|
|
8272
8397
|
}) {
|
|
8273
8398
|
const output = generateOutput({ config: config2, redirects, rewrites });
|
|
8274
|
-
const outputDir = process.env.VERCEL ?
|
|
8399
|
+
const outputDir = process.env.VERCEL ? path23.join(dir, ".vercel/output") : path23.join(dir, "dist/.output");
|
|
8275
8400
|
await mkdir3(outputDir, { recursive: true });
|
|
8276
|
-
const outputFile =
|
|
8401
|
+
const outputFile = path23.join(outputDir, "config.json");
|
|
8277
8402
|
await writeFile3(outputFile, JSON.stringify(output, null, 2), "utf-8");
|
|
8278
8403
|
if (process.env.VERCEL) {
|
|
8279
8404
|
console.log("Wrote Vercel output to", outputDir);
|
|
@@ -8283,9 +8408,9 @@ async function writeOutput(dir, {
|
|
|
8283
8408
|
// src/vite/prerender/prerender.ts
|
|
8284
8409
|
init_logger();
|
|
8285
8410
|
init_file_exists();
|
|
8286
|
-
import { readFile as
|
|
8411
|
+
import { readFile as readFile2, rm } from "node:fs/promises";
|
|
8287
8412
|
import os from "node:os";
|
|
8288
|
-
import
|
|
8413
|
+
import path26 from "node:path";
|
|
8289
8414
|
import { pathToFileURL } from "node:url";
|
|
8290
8415
|
import { createIndex } from "pagefind";
|
|
8291
8416
|
import colors7 from "picocolors";
|
|
@@ -8327,7 +8452,7 @@ function throttle(fn) {
|
|
|
8327
8452
|
init_joinUrl();
|
|
8328
8453
|
import { createWriteStream, existsSync } from "node:fs";
|
|
8329
8454
|
import { mkdir as mkdir4 } from "node:fs/promises";
|
|
8330
|
-
import
|
|
8455
|
+
import path24 from "node:path";
|
|
8331
8456
|
import colors5 from "picocolors";
|
|
8332
8457
|
import { SitemapStream } from "sitemap";
|
|
8333
8458
|
async function generateSitemap({
|
|
@@ -8341,11 +8466,11 @@ async function generateSitemap({
|
|
|
8341
8466
|
return;
|
|
8342
8467
|
}
|
|
8343
8468
|
const sitemap = new SitemapStream({ hostname: config2.siteUrl });
|
|
8344
|
-
const outputDir =
|
|
8469
|
+
const outputDir = path24.resolve(baseOutputDir, config2.outDir ?? "");
|
|
8345
8470
|
if (!existsSync(outputDir)) {
|
|
8346
8471
|
await mkdir4(outputDir, { recursive: true });
|
|
8347
8472
|
}
|
|
8348
|
-
const sitemapOutputPath =
|
|
8473
|
+
const sitemapOutputPath = path24.join(outputDir, "sitemap.xml");
|
|
8349
8474
|
const writeStream = createWriteStream(sitemapOutputPath);
|
|
8350
8475
|
sitemap.pipe(writeStream);
|
|
8351
8476
|
let lastmod;
|
|
@@ -8375,14 +8500,14 @@ async function generateSitemap({
|
|
|
8375
8500
|
|
|
8376
8501
|
// src/vite/prerender/utils.ts
|
|
8377
8502
|
init_joinUrl();
|
|
8378
|
-
var resolveRoutePath = (
|
|
8379
|
-
const segments =
|
|
8503
|
+
var resolveRoutePath = (path38) => {
|
|
8504
|
+
const segments = path38.split("/");
|
|
8380
8505
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
8381
8506
|
return void 0;
|
|
8382
8507
|
}
|
|
8383
8508
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
8384
8509
|
};
|
|
8385
|
-
var isSkipped = (
|
|
8510
|
+
var isSkipped = (path38) => path38.includes("*") || /^\d+$/.test(path38);
|
|
8386
8511
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
8387
8512
|
if (route.path && isSkipped(route.path)) return [];
|
|
8388
8513
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -8431,12 +8556,12 @@ var prerender = async ({
|
|
|
8431
8556
|
serverConfigFilename,
|
|
8432
8557
|
writeRedirects = true
|
|
8433
8558
|
}) => {
|
|
8434
|
-
const distDir =
|
|
8559
|
+
const distDir = path26.join(dir, "dist", basePath);
|
|
8435
8560
|
const serverConfigPath = pathToFileURL(
|
|
8436
|
-
|
|
8561
|
+
path26.join(distDir, "server", serverConfigFilename)
|
|
8437
8562
|
).href;
|
|
8438
8563
|
const entryServerPath = pathToFileURL(
|
|
8439
|
-
|
|
8564
|
+
path26.join(distDir, "server/entry.server.js")
|
|
8440
8565
|
).href;
|
|
8441
8566
|
const rawConfig = await import(serverConfigPath).then(
|
|
8442
8567
|
(m) => m.default
|
|
@@ -8521,7 +8646,7 @@ var prerender = async ({
|
|
|
8521
8646
|
})
|
|
8522
8647
|
);
|
|
8523
8648
|
const pagefindWriteResult = await pagefindIndex?.writeFiles({
|
|
8524
|
-
outputPath:
|
|
8649
|
+
outputPath: path26.join(distDir, "pagefind")
|
|
8525
8650
|
});
|
|
8526
8651
|
const seconds = ((performance.now() - start) / 1e3).toFixed(1);
|
|
8527
8652
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
@@ -8553,13 +8678,13 @@ var prerender = async ({
|
|
|
8553
8678
|
const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
|
|
8554
8679
|
const docsConfig = DocsConfigSchema2.parse(config2.docs);
|
|
8555
8680
|
const llmsConfig = docsConfig.llms ?? {};
|
|
8556
|
-
const markdownInfoPath =
|
|
8681
|
+
const markdownInfoPath = path26.join(
|
|
8557
8682
|
dir,
|
|
8558
8683
|
"node_modules/.apitogo/markdown-info.json"
|
|
8559
8684
|
);
|
|
8560
8685
|
let markdownFileInfos = [];
|
|
8561
8686
|
if (await fileExists(markdownInfoPath)) {
|
|
8562
|
-
const markdownInfoContent = await
|
|
8687
|
+
const markdownInfoContent = await readFile2(markdownInfoPath, "utf-8");
|
|
8563
8688
|
markdownFileInfos = JSON.parse(markdownInfoContent);
|
|
8564
8689
|
}
|
|
8565
8690
|
if (llmsConfig.llmsTxt || llmsConfig.llmsTxtFull) {
|
|
@@ -8644,7 +8769,7 @@ async function runBuild(options) {
|
|
|
8644
8769
|
html,
|
|
8645
8770
|
basePath: config2.basePath
|
|
8646
8771
|
});
|
|
8647
|
-
await rm2(
|
|
8772
|
+
await rm2(path27.join(clientOutDir, "index.html"), { force: true });
|
|
8648
8773
|
} else {
|
|
8649
8774
|
await runPrerender({
|
|
8650
8775
|
dir,
|
|
@@ -8668,7 +8793,7 @@ var runPrerender = async (options) => {
|
|
|
8668
8793
|
serverConfigFilename,
|
|
8669
8794
|
writeRedirects: process.env.VERCEL === void 0
|
|
8670
8795
|
});
|
|
8671
|
-
const indexHtml =
|
|
8796
|
+
const indexHtml = path27.join(clientOutDir, "index.html");
|
|
8672
8797
|
if (!workerResults.find((r) => r.outputPath === indexHtml)) {
|
|
8673
8798
|
await writeFile5(indexHtml, html, "utf-8");
|
|
8674
8799
|
}
|
|
@@ -8678,15 +8803,15 @@ var runPrerender = async (options) => {
|
|
|
8678
8803
|
for (const statusPage of statusPages) {
|
|
8679
8804
|
await rename(
|
|
8680
8805
|
statusPage,
|
|
8681
|
-
|
|
8806
|
+
path27.join(dir, DIST_DIR, path27.basename(statusPage))
|
|
8682
8807
|
);
|
|
8683
8808
|
}
|
|
8684
8809
|
await rm2(serverOutDir, { recursive: true, force: true });
|
|
8685
8810
|
if (process.env.VERCEL) {
|
|
8686
|
-
await mkdir5(
|
|
8811
|
+
await mkdir5(path27.join(dir, ".vercel/output/static"), { recursive: true });
|
|
8687
8812
|
await rename(
|
|
8688
|
-
|
|
8689
|
-
|
|
8813
|
+
path27.join(dir, DIST_DIR),
|
|
8814
|
+
path27.join(dir, ".vercel/output/static")
|
|
8690
8815
|
);
|
|
8691
8816
|
}
|
|
8692
8817
|
await writeOutput(dir, {
|
|
@@ -8696,7 +8821,7 @@ var runPrerender = async (options) => {
|
|
|
8696
8821
|
});
|
|
8697
8822
|
if (ZuploEnv.isZuplo && issuer) {
|
|
8698
8823
|
await writeFile5(
|
|
8699
|
-
|
|
8824
|
+
path27.join(dir, DIST_DIR, ".output/zuplo.json"),
|
|
8700
8825
|
JSON.stringify({ issuer }, null, 2),
|
|
8701
8826
|
"utf-8"
|
|
8702
8827
|
);
|
|
@@ -8708,10 +8833,10 @@ var runPrerender = async (options) => {
|
|
|
8708
8833
|
};
|
|
8709
8834
|
var bundleSSREntry = async (options) => {
|
|
8710
8835
|
const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
|
|
8711
|
-
const tempEntryPath =
|
|
8836
|
+
const tempEntryPath = path27.join(dir, "__ssr-entry.ts");
|
|
8712
8837
|
const packageRoot = getZudokuRootDir();
|
|
8713
|
-
const templateContent = await
|
|
8714
|
-
|
|
8838
|
+
const templateContent = await readFile3(
|
|
8839
|
+
path27.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
|
|
8715
8840
|
"utf-8"
|
|
8716
8841
|
);
|
|
8717
8842
|
const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
|
|
@@ -8726,9 +8851,9 @@ var bundleSSREntry = async (options) => {
|
|
|
8726
8851
|
platform: adapter === "node" ? "node" : "neutral",
|
|
8727
8852
|
target: "es2022",
|
|
8728
8853
|
format: "esm",
|
|
8729
|
-
outfile:
|
|
8854
|
+
outfile: path27.join(serverOutDir, "entry.js"),
|
|
8730
8855
|
external: ["./entry.server.js", `./${serverConfigFilename}`],
|
|
8731
|
-
nodePaths: [
|
|
8856
|
+
nodePaths: [path27.join(packageRoot, "node_modules")],
|
|
8732
8857
|
banner: { js: "// Bundled SSR entry" }
|
|
8733
8858
|
});
|
|
8734
8859
|
} finally {
|
|
@@ -8783,11 +8908,11 @@ function textOrJson(text) {
|
|
|
8783
8908
|
init_package_json();
|
|
8784
8909
|
|
|
8785
8910
|
// src/cli/preview/handler.ts
|
|
8786
|
-
import
|
|
8911
|
+
import path28 from "node:path";
|
|
8787
8912
|
import { preview as vitePreview } from "vite";
|
|
8788
8913
|
var DEFAULT_PREVIEW_PORT = 4e3;
|
|
8789
8914
|
async function preview(argv) {
|
|
8790
|
-
const dir =
|
|
8915
|
+
const dir = path28.resolve(process.cwd(), argv.dir);
|
|
8791
8916
|
const viteConfig = await getViteConfig(dir, {
|
|
8792
8917
|
command: "serve",
|
|
8793
8918
|
mode: "production",
|
|
@@ -8828,7 +8953,7 @@ async function build(argv) {
|
|
|
8828
8953
|
printDiagnosticsToConsole("");
|
|
8829
8954
|
printDiagnosticsToConsole("");
|
|
8830
8955
|
}
|
|
8831
|
-
const dir =
|
|
8956
|
+
const dir = path29.resolve(process.cwd(), argv.dir);
|
|
8832
8957
|
try {
|
|
8833
8958
|
await runBuild({
|
|
8834
8959
|
dir,
|
|
@@ -8988,7 +9113,7 @@ var build_default = {
|
|
|
8988
9113
|
// src/cli/configure-github-workflow/handler.ts
|
|
8989
9114
|
import { constants } from "node:fs";
|
|
8990
9115
|
import { access, mkdir as mkdir6, writeFile as writeFile6 } from "node:fs/promises";
|
|
8991
|
-
import
|
|
9116
|
+
import path30 from "node:path";
|
|
8992
9117
|
var APITOGO_DEPLOY_WORKFLOW_YAML = `name: Build and Deploy
|
|
8993
9118
|
|
|
8994
9119
|
on:
|
|
@@ -9099,9 +9224,9 @@ jobs:
|
|
|
9099
9224
|
run: apitogo deploy --deployment-token="$APITOGO_TOKEN" --json-only
|
|
9100
9225
|
`;
|
|
9101
9226
|
async function configureGithubWorkflow(argv) {
|
|
9102
|
-
const dir =
|
|
9103
|
-
const workflowDir =
|
|
9104
|
-
const workflowPath =
|
|
9227
|
+
const dir = path30.resolve(process.cwd(), argv.dir);
|
|
9228
|
+
const workflowDir = path30.join(dir, ".github", "workflows");
|
|
9229
|
+
const workflowPath = path30.join(workflowDir, "apitogo-deploy.yml");
|
|
9105
9230
|
try {
|
|
9106
9231
|
try {
|
|
9107
9232
|
await access(workflowPath, constants.F_OK);
|
|
@@ -9173,15 +9298,15 @@ function applyJsonOnlyDeployQuietMode() {
|
|
|
9173
9298
|
}
|
|
9174
9299
|
|
|
9175
9300
|
// src/cli/deploy/handler.ts
|
|
9176
|
-
import { access as access2, readFile as
|
|
9177
|
-
import
|
|
9301
|
+
import { access as access2, readFile as readFile4 } from "node:fs/promises";
|
|
9302
|
+
import path31 from "node:path";
|
|
9178
9303
|
import { create as createTar } from "tar";
|
|
9179
9304
|
var DEPLOY_ENDPOINT = "https://deploy-server-dotnet2-b3fkcaaraydbckfe.canadacentral-01.azurewebsites.net/deploy";
|
|
9180
9305
|
var ARCHIVE_NAME = "dist.tgz";
|
|
9181
9306
|
var createDeploymentArchive = async (dir) => {
|
|
9182
|
-
const distDir =
|
|
9307
|
+
const distDir = path31.join(dir, "dist");
|
|
9183
9308
|
await access2(distDir);
|
|
9184
|
-
const archivePath =
|
|
9309
|
+
const archivePath = path31.join(dir, ARCHIVE_NAME);
|
|
9185
9310
|
await createTar(
|
|
9186
9311
|
{
|
|
9187
9312
|
cwd: dir,
|
|
@@ -9195,7 +9320,7 @@ var createDeploymentArchive = async (dir) => {
|
|
|
9195
9320
|
};
|
|
9196
9321
|
async function deploy(argv) {
|
|
9197
9322
|
await build({ ...argv, preview: void 0 });
|
|
9198
|
-
const dir =
|
|
9323
|
+
const dir = path31.resolve(process.cwd(), argv.dir);
|
|
9199
9324
|
const deploymentToken = argv.deploymentToken?.trim() || process.env.npm_config_deployment_token?.trim();
|
|
9200
9325
|
const env = argv.env?.trim() || process.env.npm_config_env?.trim() || "production";
|
|
9201
9326
|
try {
|
|
@@ -9208,15 +9333,15 @@ async function deploy(argv) {
|
|
|
9208
9333
|
const archivePath = await createDeploymentArchive(dir);
|
|
9209
9334
|
if (!isJsonOnlyDeployEnv()) {
|
|
9210
9335
|
printDiagnosticsToConsole(
|
|
9211
|
-
`Uploading ${
|
|
9336
|
+
`Uploading ${path31.basename(archivePath)} to ${env}...`
|
|
9212
9337
|
);
|
|
9213
9338
|
}
|
|
9214
|
-
const archiveBuffer = await
|
|
9339
|
+
const archiveBuffer = await readFile4(archivePath);
|
|
9215
9340
|
const formData = new FormData();
|
|
9216
9341
|
formData.append(
|
|
9217
9342
|
"file",
|
|
9218
9343
|
new Blob([archiveBuffer], { type: "application/gzip" }),
|
|
9219
|
-
|
|
9344
|
+
path31.basename(archivePath)
|
|
9220
9345
|
);
|
|
9221
9346
|
formData.append("deploymentToken", deploymentToken);
|
|
9222
9347
|
formData.append("env", env);
|
|
@@ -9301,14 +9426,14 @@ var deploy_default = {
|
|
|
9301
9426
|
|
|
9302
9427
|
// src/cli/dev/handler.ts
|
|
9303
9428
|
init_joinUrl();
|
|
9304
|
-
import
|
|
9429
|
+
import path34 from "node:path";
|
|
9305
9430
|
|
|
9306
9431
|
// src/vite/dev-server.ts
|
|
9307
9432
|
init_logger();
|
|
9308
9433
|
import fs4 from "node:fs/promises";
|
|
9309
9434
|
import http from "node:http";
|
|
9310
9435
|
import https from "node:https";
|
|
9311
|
-
import
|
|
9436
|
+
import path33 from "node:path";
|
|
9312
9437
|
import { createHttpTerminator } from "http-terminator";
|
|
9313
9438
|
import {
|
|
9314
9439
|
createServer as createViteServer,
|
|
@@ -9341,7 +9466,7 @@ init_loader();
|
|
|
9341
9466
|
// src/vite/pagefind-dev-index.ts
|
|
9342
9467
|
init_invariant();
|
|
9343
9468
|
init_joinUrl();
|
|
9344
|
-
import
|
|
9469
|
+
import path32 from "node:path";
|
|
9345
9470
|
import { createIndex as createIndex2 } from "pagefind";
|
|
9346
9471
|
import { isRunnableDevEnvironment } from "vite";
|
|
9347
9472
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -9394,7 +9519,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
9394
9519
|
path: urlPath
|
|
9395
9520
|
};
|
|
9396
9521
|
}
|
|
9397
|
-
const outputPath =
|
|
9522
|
+
const outputPath = path32.join(vite.config.publicDir, "pagefind");
|
|
9398
9523
|
await pagefindIndex.writeFiles({ outputPath });
|
|
9399
9524
|
yield { type: "complete", success: true, indexed };
|
|
9400
9525
|
}
|
|
@@ -9413,9 +9538,9 @@ var DevServer = class {
|
|
|
9413
9538
|
this.protocol = "https";
|
|
9414
9539
|
const { dir } = this.options;
|
|
9415
9540
|
const [key, cert, ca] = await Promise.all([
|
|
9416
|
-
fs4.readFile(
|
|
9417
|
-
fs4.readFile(
|
|
9418
|
-
config2.https.ca ? fs4.readFile(
|
|
9541
|
+
fs4.readFile(path33.resolve(dir, config2.https.key)),
|
|
9542
|
+
fs4.readFile(path33.resolve(dir, config2.https.cert)),
|
|
9543
|
+
config2.https.ca ? fs4.readFile(path33.resolve(dir, config2.https.ca)) : void 0
|
|
9419
9544
|
]);
|
|
9420
9545
|
return https.createServer({ key, cert, ca });
|
|
9421
9546
|
}
|
|
@@ -9432,7 +9557,7 @@ var DevServer = class {
|
|
|
9432
9557
|
);
|
|
9433
9558
|
const server = await this.createNodeServer(config2);
|
|
9434
9559
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
9435
|
-
const publicRoot =
|
|
9560
|
+
const publicRoot = path33.resolve(
|
|
9436
9561
|
this.options.dir,
|
|
9437
9562
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
9438
9563
|
);
|
|
@@ -9449,7 +9574,7 @@ var DevServer = class {
|
|
|
9449
9574
|
// built-in transform middleware which would treat the path as a static asset.
|
|
9450
9575
|
name: "apitogo:entry-client",
|
|
9451
9576
|
configureServer(server2) {
|
|
9452
|
-
const entryPath =
|
|
9577
|
+
const entryPath = path33.posix.join(
|
|
9453
9578
|
server2.config.base,
|
|
9454
9579
|
"/__z/entry.client.tsx"
|
|
9455
9580
|
);
|
|
@@ -9614,7 +9739,7 @@ init_package_json();
|
|
|
9614
9739
|
async function dev(argv) {
|
|
9615
9740
|
const packageJson2 = getZudokuPackageJson();
|
|
9616
9741
|
process.env.NODE_ENV = "development";
|
|
9617
|
-
const dir =
|
|
9742
|
+
const dir = path34.resolve(process.cwd(), argv.dir);
|
|
9618
9743
|
const server = new DevServer({
|
|
9619
9744
|
dir,
|
|
9620
9745
|
argPort: argv.port,
|
|
@@ -9698,15 +9823,15 @@ var dev_default = {
|
|
|
9698
9823
|
|
|
9699
9824
|
// src/cli/make-config/handler.ts
|
|
9700
9825
|
import { constants as constants3 } from "node:fs";
|
|
9701
|
-
import { access as access4, mkdir as mkdir7, readFile as
|
|
9702
|
-
import
|
|
9826
|
+
import { access as access4, mkdir as mkdir7, readFile as readFile6, writeFile as writeFile8 } from "node:fs/promises";
|
|
9827
|
+
import path36 from "node:path";
|
|
9703
9828
|
import { glob as glob5 } from "glob";
|
|
9704
9829
|
|
|
9705
9830
|
// src/cli/make-config/scaffold-project.ts
|
|
9706
9831
|
init_package_json();
|
|
9707
9832
|
import { constants as constants2 } from "node:fs";
|
|
9708
|
-
import { access as access3, readFile as
|
|
9709
|
-
import
|
|
9833
|
+
import { access as access3, readFile as readFile5, writeFile as writeFile7 } from "node:fs/promises";
|
|
9834
|
+
import path35 from "node:path";
|
|
9710
9835
|
import { glob as glob4 } from "glob";
|
|
9711
9836
|
var OPENAPI_GLOBS = [
|
|
9712
9837
|
"apis/openapi.json",
|
|
@@ -9766,9 +9891,9 @@ var findMatchingCurly = (source, startIndex) => {
|
|
|
9766
9891
|
}
|
|
9767
9892
|
throw new Error("Could not find matching closing brace for object.");
|
|
9768
9893
|
};
|
|
9769
|
-
var toPosix = (p) => p.split(
|
|
9894
|
+
var toPosix = (p) => p.split(path35.sep).join("/");
|
|
9770
9895
|
var sanitizePackageName = (dir) => {
|
|
9771
|
-
const base =
|
|
9896
|
+
const base = path35.basename(path35.resolve(dir));
|
|
9772
9897
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
9773
9898
|
return s || "apitogo-site";
|
|
9774
9899
|
};
|
|
@@ -9778,7 +9903,7 @@ var apitogoVersionRange = () => {
|
|
|
9778
9903
|
};
|
|
9779
9904
|
async function findOpenApiSpecPath(dir) {
|
|
9780
9905
|
for (const rel of OPENAPI_GLOBS) {
|
|
9781
|
-
const full =
|
|
9906
|
+
const full = path35.join(dir, rel);
|
|
9782
9907
|
try {
|
|
9783
9908
|
await access3(full, constants2.R_OK);
|
|
9784
9909
|
return toPosix(rel);
|
|
@@ -9793,7 +9918,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
9793
9918
|
return extra[0] ? toPosix(extra[0]) : null;
|
|
9794
9919
|
}
|
|
9795
9920
|
async function ensurePackageJson(dir) {
|
|
9796
|
-
const pkgPath =
|
|
9921
|
+
const pkgPath = path35.join(dir, "package.json");
|
|
9797
9922
|
const apitogoVer = apitogoVersionRange();
|
|
9798
9923
|
const baseDeps = {
|
|
9799
9924
|
react: ">=19.0.0",
|
|
@@ -9828,7 +9953,7 @@ async function ensurePackageJson(dir) {
|
|
|
9828
9953
|
`, "utf8");
|
|
9829
9954
|
return true;
|
|
9830
9955
|
}
|
|
9831
|
-
const raw = await
|
|
9956
|
+
const raw = await readFile5(pkgPath, "utf8");
|
|
9832
9957
|
let pkg;
|
|
9833
9958
|
try {
|
|
9834
9959
|
pkg = JSON.parse(raw);
|
|
@@ -9856,7 +9981,7 @@ async function ensurePackageJson(dir) {
|
|
|
9856
9981
|
return false;
|
|
9857
9982
|
}
|
|
9858
9983
|
async function ensureTsconfigJson(dir) {
|
|
9859
|
-
const tsPath =
|
|
9984
|
+
const tsPath = path35.join(dir, "tsconfig.json");
|
|
9860
9985
|
try {
|
|
9861
9986
|
await access3(tsPath, constants2.R_OK);
|
|
9862
9987
|
return false;
|
|
@@ -9938,7 +10063,7 @@ var CONFIG_FILENAMES = [
|
|
|
9938
10063
|
];
|
|
9939
10064
|
var DEFAULT_NEW_CONFIG_FILENAME = "apitogo.config.tsx";
|
|
9940
10065
|
var createTreeNode = () => ({ docs: [], children: /* @__PURE__ */ new Map() });
|
|
9941
|
-
var toPosixPath2 = (value) => value.split(
|
|
10066
|
+
var toPosixPath2 = (value) => value.split(path36.sep).join(path36.posix.sep);
|
|
9942
10067
|
var toRoutePath = (relativeFile, pagesDir) => {
|
|
9943
10068
|
const relativeNoExt = relativeFile.replace(/\.mdx?$/, "");
|
|
9944
10069
|
const withoutPagesPrefix = relativeNoExt.replace(
|
|
@@ -10183,7 +10308,7 @@ export default config;
|
|
|
10183
10308
|
`;
|
|
10184
10309
|
};
|
|
10185
10310
|
var ensureApitogoDeployWorkflow = async (dir) => {
|
|
10186
|
-
const workflowPath =
|
|
10311
|
+
const workflowPath = path36.join(
|
|
10187
10312
|
dir,
|
|
10188
10313
|
".github",
|
|
10189
10314
|
"workflows",
|
|
@@ -10194,15 +10319,15 @@ var ensureApitogoDeployWorkflow = async (dir) => {
|
|
|
10194
10319
|
return false;
|
|
10195
10320
|
} catch {
|
|
10196
10321
|
}
|
|
10197
|
-
await mkdir7(
|
|
10322
|
+
await mkdir7(path36.join(dir, ".github", "workflows"), { recursive: true });
|
|
10198
10323
|
await writeFile8(workflowPath, APITOGO_DEPLOY_WORKFLOW_YAML, "utf8");
|
|
10199
10324
|
return true;
|
|
10200
10325
|
};
|
|
10201
10326
|
var findExistingConfigPath = async (dir) => {
|
|
10202
10327
|
for (const filename of CONFIG_FILENAMES) {
|
|
10203
|
-
const fullPath =
|
|
10328
|
+
const fullPath = path36.join(dir, filename);
|
|
10204
10329
|
try {
|
|
10205
|
-
await
|
|
10330
|
+
await readFile6(fullPath, "utf8");
|
|
10206
10331
|
return fullPath;
|
|
10207
10332
|
} catch {
|
|
10208
10333
|
}
|
|
@@ -10210,7 +10335,7 @@ var findExistingConfigPath = async (dir) => {
|
|
|
10210
10335
|
return null;
|
|
10211
10336
|
};
|
|
10212
10337
|
async function makeConfig(argv) {
|
|
10213
|
-
const dir =
|
|
10338
|
+
const dir = path36.resolve(process.cwd(), argv.dir);
|
|
10214
10339
|
const pagesDir = toPosixPath2(
|
|
10215
10340
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
10216
10341
|
);
|
|
@@ -10229,7 +10354,7 @@ async function makeConfig(argv) {
|
|
|
10229
10354
|
let configPath = await findExistingConfigPath(dir);
|
|
10230
10355
|
let createdNew = false;
|
|
10231
10356
|
if (!configPath) {
|
|
10232
|
-
configPath =
|
|
10357
|
+
configPath = path36.join(dir, DEFAULT_NEW_CONFIG_FILENAME);
|
|
10233
10358
|
await writeFile8(
|
|
10234
10359
|
configPath,
|
|
10235
10360
|
buildNewConfigContents(pagesDir, openApiSpecPath),
|
|
@@ -10249,7 +10374,7 @@ async function makeConfig(argv) {
|
|
|
10249
10374
|
if (routePaths.length === 0) {
|
|
10250
10375
|
throw new Error(`No .md or .mdx files found under '${pagesDir}'.`);
|
|
10251
10376
|
}
|
|
10252
|
-
let originalConfig = await
|
|
10377
|
+
let originalConfig = await readFile6(configPath, "utf8");
|
|
10253
10378
|
if (!createdNew && openApiSpecPath) {
|
|
10254
10379
|
originalConfig = insertApisIfMissing(
|
|
10255
10380
|
originalConfig,
|
|
@@ -10270,7 +10395,7 @@ async function makeConfig(argv) {
|
|
|
10270
10395
|
await writeFile8(configPath, withRedirects, "utf8");
|
|
10271
10396
|
const action = createdNew ? "Initialized" : "Updated";
|
|
10272
10397
|
printResultToConsole(
|
|
10273
|
-
`${action} ${
|
|
10398
|
+
`${action} ${path36.basename(configPath)} from ${pagesDir}/ (navigation and redirects; other top-level settings preserved unless newly scaffolded).`
|
|
10274
10399
|
);
|
|
10275
10400
|
const createdWorkflow = await ensureApitogoDeployWorkflow(dir);
|
|
10276
10401
|
if (createdWorkflow) {
|
|
@@ -10413,7 +10538,7 @@ var remove_default = {
|
|
|
10413
10538
|
|
|
10414
10539
|
// src/cli/common/outdated.ts
|
|
10415
10540
|
import { existsSync as existsSync2, mkdirSync } from "node:fs";
|
|
10416
|
-
import { readFile as
|
|
10541
|
+
import { readFile as readFile7, writeFile as writeFile9 } from "node:fs/promises";
|
|
10417
10542
|
import { join } from "node:path";
|
|
10418
10543
|
import colors10 from "picocolors";
|
|
10419
10544
|
import { gt } from "semver";
|
|
@@ -10463,12 +10588,12 @@ function box(message, {
|
|
|
10463
10588
|
|
|
10464
10589
|
// src/cli/common/xdg/lib.ts
|
|
10465
10590
|
import { homedir } from "node:os";
|
|
10466
|
-
import
|
|
10591
|
+
import path37 from "node:path";
|
|
10467
10592
|
function defineDirectoryWithFallback(xdgName, fallback) {
|
|
10468
10593
|
if (process.env[xdgName]) {
|
|
10469
10594
|
return process.env[xdgName];
|
|
10470
10595
|
} else {
|
|
10471
|
-
return
|
|
10596
|
+
return path37.join(homedir(), fallback);
|
|
10472
10597
|
}
|
|
10473
10598
|
}
|
|
10474
10599
|
var XDG_CONFIG_HOME = defineDirectoryWithFallback(
|
|
@@ -10483,15 +10608,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
|
|
|
10483
10608
|
"XDG_DATA_HOME",
|
|
10484
10609
|
".local/state"
|
|
10485
10610
|
);
|
|
10486
|
-
var ZUDOKU_XDG_CONFIG_HOME =
|
|
10611
|
+
var ZUDOKU_XDG_CONFIG_HOME = path37.join(
|
|
10487
10612
|
XDG_CONFIG_HOME,
|
|
10488
10613
|
CLI_XDG_FOLDER_NAME
|
|
10489
10614
|
);
|
|
10490
|
-
var ZUDOKU_XDG_DATA_HOME =
|
|
10615
|
+
var ZUDOKU_XDG_DATA_HOME = path37.join(
|
|
10491
10616
|
XDG_DATA_HOME,
|
|
10492
10617
|
CLI_XDG_FOLDER_NAME
|
|
10493
10618
|
);
|
|
10494
|
-
var ZUDOKU_XDG_STATE_HOME =
|
|
10619
|
+
var ZUDOKU_XDG_STATE_HOME = path37.join(
|
|
10495
10620
|
XDG_STATE_HOME,
|
|
10496
10621
|
CLI_XDG_FOLDER_NAME
|
|
10497
10622
|
);
|
|
@@ -10543,7 +10668,7 @@ async function getVersionCheckInfo() {
|
|
|
10543
10668
|
let versionCheckInfo;
|
|
10544
10669
|
if (existsSync2(versionCheckPath)) {
|
|
10545
10670
|
try {
|
|
10546
|
-
versionCheckInfo = await
|
|
10671
|
+
versionCheckInfo = await readFile7(versionCheckPath, "utf-8").then(
|
|
10547
10672
|
JSON.parse
|
|
10548
10673
|
);
|
|
10549
10674
|
} catch {
|