@lukoweb/apitogo 0.2.15 → 0.2.17
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 +729 -601
- package/package.json +1 -1
- package/src/config/v2/docs-navigation.ts +72 -0
- package/src/config/v2/home-redirect.ts +98 -0
- package/src/config/v2/wrapper.ts +40 -8
package/dist/cli/cli.js
CHANGED
|
@@ -756,12 +756,12 @@ var init_transform_config = __esm({
|
|
|
756
756
|
|
|
757
757
|
// src/config/apitogo-config-loader.node.ts
|
|
758
758
|
import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
|
|
759
|
-
import
|
|
759
|
+
import path17 from "node:path";
|
|
760
760
|
function loadApitogoConfig(rootDir = process.cwd()) {
|
|
761
|
-
const configPath =
|
|
761
|
+
const configPath = path17.join(path17.resolve(rootDir), APITOGO_CONFIG_FILENAME);
|
|
762
762
|
if (!existsSync3(configPath)) {
|
|
763
763
|
throw new Error(
|
|
764
|
-
`Missing ${APITOGO_CONFIG_FILENAME} in ${
|
|
764
|
+
`Missing ${APITOGO_CONFIG_FILENAME} in ${path17.resolve(rootDir)}`
|
|
765
765
|
);
|
|
766
766
|
}
|
|
767
767
|
const raw = readFileSync3(configPath, "utf8");
|
|
@@ -836,7 +836,7 @@ import { stat as stat4 } from "node:fs/promises";
|
|
|
836
836
|
var fileExists;
|
|
837
837
|
var init_file_exists = __esm({
|
|
838
838
|
"src/config/file-exists.ts"() {
|
|
839
|
-
fileExists = (
|
|
839
|
+
fileExists = (path101) => stat4(path101).then(() => true).catch(() => false);
|
|
840
840
|
}
|
|
841
841
|
});
|
|
842
842
|
|
|
@@ -1094,7 +1094,7 @@ var init_landing_manifest = __esm({
|
|
|
1094
1094
|
});
|
|
1095
1095
|
|
|
1096
1096
|
// src/config/local-manifest.ts
|
|
1097
|
-
import
|
|
1097
|
+
import path18 from "node:path";
|
|
1098
1098
|
import { z as z7 } from "zod";
|
|
1099
1099
|
function isPricingEnabled(manifest) {
|
|
1100
1100
|
return manifest?.pricing?.enabled === true;
|
|
@@ -1147,8 +1147,8 @@ function resolveManifestEnv(viteMode) {
|
|
|
1147
1147
|
return viteMode === "production" ? "production" : "development";
|
|
1148
1148
|
}
|
|
1149
1149
|
function manifestPathsForEnv(rootDir, _env) {
|
|
1150
|
-
const resolvedRoot =
|
|
1151
|
-
const configPath =
|
|
1150
|
+
const resolvedRoot = path18.resolve(rootDir);
|
|
1151
|
+
const configPath = path18.join(resolvedRoot, APITOGO_CONFIG_FILENAME);
|
|
1152
1152
|
return {
|
|
1153
1153
|
basePath: configPath,
|
|
1154
1154
|
overridePath: configPath,
|
|
@@ -1840,7 +1840,7 @@ var init_shadcn_registry = __esm({
|
|
|
1840
1840
|
|
|
1841
1841
|
// src/vite/plugin-theme.ts
|
|
1842
1842
|
import { createRequire } from "node:module";
|
|
1843
|
-
import
|
|
1843
|
+
import path19 from "node:path";
|
|
1844
1844
|
import { normalizeTheme } from "shiki";
|
|
1845
1845
|
var THEME_VARIABLES, uncamelize, processColorValue, generateCss, generateRegistryCss, processCustomCss, MAIN_REPLACE, DEFAULT_THEME_REPLACE, GOOGLE_FONTS, getGoogleFontUrl, processFont, processFontConfig, bundledFont, DEFAULT_FONT_SANS, DEFAULT_FONT_MONO, DEFAULT_FONT_HEADING, processFonts, MODULE_SOURCE_PACKAGES, resolveModuleSourceDirs, virtualModuleId, resolvedVirtualModuleId, viteThemePlugin;
|
|
1846
1846
|
var init_plugin_theme = __esm({
|
|
@@ -1955,11 +1955,11 @@ var init_plugin_theme = __esm({
|
|
|
1955
1955
|
};
|
|
1956
1956
|
};
|
|
1957
1957
|
bundledFont = (pkg) => {
|
|
1958
|
-
const dir =
|
|
1958
|
+
const dir = path19.dirname(
|
|
1959
1959
|
createRequire(import.meta.url).resolve(`@fontsource/${pkg}/package.json`)
|
|
1960
1960
|
);
|
|
1961
1961
|
return [400, 500, 600, 700].map(
|
|
1962
|
-
(weight) =>
|
|
1962
|
+
(weight) => path19.join(dir, `latin-${weight}.css`).split(path19.sep).join("/")
|
|
1963
1963
|
);
|
|
1964
1964
|
};
|
|
1965
1965
|
DEFAULT_FONT_SANS = '"IBM Plex Sans", system-ui, sans-serif';
|
|
@@ -2028,7 +2028,7 @@ var init_plugin_theme = __esm({
|
|
|
2028
2028
|
resolveModuleSourceDirs = (config2) => {
|
|
2029
2029
|
if (config2.__meta.mode === "internal") {
|
|
2030
2030
|
return MODULE_SOURCE_PACKAGES.map(
|
|
2031
|
-
(pkg) =>
|
|
2031
|
+
(pkg) => path19.join(
|
|
2032
2032
|
config2.__meta.moduleDir,
|
|
2033
2033
|
"..",
|
|
2034
2034
|
pkg.replace("@lukoweb/apitogo-", ""),
|
|
@@ -2037,12 +2037,12 @@ var init_plugin_theme = __esm({
|
|
|
2037
2037
|
);
|
|
2038
2038
|
}
|
|
2039
2039
|
const require2 = createRequire(
|
|
2040
|
-
|
|
2040
|
+
path19.join(config2.__meta.rootDir, "package.json")
|
|
2041
2041
|
);
|
|
2042
2042
|
const dirs = [];
|
|
2043
2043
|
for (const pkg of MODULE_SOURCE_PACKAGES) {
|
|
2044
2044
|
try {
|
|
2045
|
-
dirs.push(
|
|
2045
|
+
dirs.push(path19.dirname(require2.resolve(pkg)));
|
|
2046
2046
|
} catch {
|
|
2047
2047
|
}
|
|
2048
2048
|
}
|
|
@@ -2169,7 +2169,7 @@ ${rootVars.join("\n")}
|
|
|
2169
2169
|
...config2.__meta.dependencies,
|
|
2170
2170
|
...config2.__pluginDirs ?? [],
|
|
2171
2171
|
...resolveModuleSourceDirs(config2)
|
|
2172
|
-
].map((file) =>
|
|
2172
|
+
].map((file) => path19.relative(path19.dirname(id), file))
|
|
2173
2173
|
);
|
|
2174
2174
|
const code = [...files].map((file) => `@source "${file}";`);
|
|
2175
2175
|
code.push("@theme inline {");
|
|
@@ -5011,7 +5011,7 @@ var init_ZudokuConfig = __esm({
|
|
|
5011
5011
|
|
|
5012
5012
|
// src/config/loader.ts
|
|
5013
5013
|
import { stat as stat5 } from "node:fs/promises";
|
|
5014
|
-
import
|
|
5014
|
+
import path20 from "node:path";
|
|
5015
5015
|
import colors6 from "picocolors";
|
|
5016
5016
|
import {
|
|
5017
5017
|
runnerImport,
|
|
@@ -5038,7 +5038,7 @@ function mergeJsonConfigWithRuntimeOverrides(fileConfig, importedConfig) {
|
|
|
5038
5038
|
}
|
|
5039
5039
|
async function getConfigFilePath(rootDir) {
|
|
5040
5040
|
for (const fileName of zudokuConfigFiles) {
|
|
5041
|
-
const filepath =
|
|
5041
|
+
const filepath = path20.join(rootDir, fileName);
|
|
5042
5042
|
if (await fileExists(filepath)) {
|
|
5043
5043
|
return filepath;
|
|
5044
5044
|
}
|
|
@@ -5267,7 +5267,7 @@ __export(llms_exports, {
|
|
|
5267
5267
|
generateLlmsTxtFiles: () => generateLlmsTxtFiles
|
|
5268
5268
|
});
|
|
5269
5269
|
import { writeFile as writeFile11 } from "node:fs/promises";
|
|
5270
|
-
import
|
|
5270
|
+
import path43 from "node:path";
|
|
5271
5271
|
import colors10 from "picocolors";
|
|
5272
5272
|
async function generateLlmsTxtFiles({
|
|
5273
5273
|
markdownFileInfos,
|
|
@@ -5302,7 +5302,7 @@ async function generateLlmsTxtFiles({
|
|
|
5302
5302
|
}
|
|
5303
5303
|
}
|
|
5304
5304
|
const llmsTxt2 = llmsTxtParts.join("\n");
|
|
5305
|
-
await writeFile11(
|
|
5305
|
+
await writeFile11(path43.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
|
|
5306
5306
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
5307
5307
|
console.log(colors10.blue("\u2713 generated llms.txt"));
|
|
5308
5308
|
}
|
|
@@ -5330,7 +5330,7 @@ ${info.content}
|
|
|
5330
5330
|
}
|
|
5331
5331
|
const llmsFull = llmsFullParts.join("\n");
|
|
5332
5332
|
await writeFile11(
|
|
5333
|
-
|
|
5333
|
+
path43.join(baseOutputDir, "llms-full.txt"),
|
|
5334
5334
|
llmsFull,
|
|
5335
5335
|
"utf-8"
|
|
5336
5336
|
);
|
|
@@ -5809,7 +5809,7 @@ init_package_json();
|
|
|
5809
5809
|
import yargs from "yargs/yargs";
|
|
5810
5810
|
|
|
5811
5811
|
// src/cli/services/handler.ts
|
|
5812
|
-
import
|
|
5812
|
+
import path50 from "node:path";
|
|
5813
5813
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
5814
5814
|
|
|
5815
5815
|
// src/config/v2/errors.ts
|
|
@@ -6189,8 +6189,8 @@ var ConfigV2Schema = z.strictObject({
|
|
|
6189
6189
|
var REMOVED_KEYS = {
|
|
6190
6190
|
"plans.provider": "plans.provider was removed. Only plans.billing.provider (stripe or none) is selectable."
|
|
6191
6191
|
};
|
|
6192
|
-
function pathToString(
|
|
6193
|
-
return
|
|
6192
|
+
function pathToString(path101) {
|
|
6193
|
+
return path101.reduce(
|
|
6194
6194
|
(acc, segment) => typeof segment === "number" ? `${acc}[${segment}]` : acc === "" ? String(segment) : `${acc}.${String(segment)}`,
|
|
6195
6195
|
""
|
|
6196
6196
|
);
|
|
@@ -6210,9 +6210,9 @@ function step(schema2, segment) {
|
|
|
6210
6210
|
}
|
|
6211
6211
|
return void 0;
|
|
6212
6212
|
}
|
|
6213
|
-
function knownKeysAt(
|
|
6213
|
+
function knownKeysAt(path101) {
|
|
6214
6214
|
let current = ConfigV2Schema;
|
|
6215
|
-
for (const segment of
|
|
6215
|
+
for (const segment of path101) {
|
|
6216
6216
|
if (!current) return [];
|
|
6217
6217
|
current = step(current, segment);
|
|
6218
6218
|
}
|
|
@@ -6248,7 +6248,7 @@ function unknownKeyHint(fullPath, key, known) {
|
|
|
6248
6248
|
return known.length > 0 ? `Allowed keys: ${known.join(", ")}.` : void 0;
|
|
6249
6249
|
}
|
|
6250
6250
|
function mapIssue(issue3) {
|
|
6251
|
-
const
|
|
6251
|
+
const path101 = pathToString(issue3.path);
|
|
6252
6252
|
switch (issue3.code) {
|
|
6253
6253
|
case "unrecognized_keys":
|
|
6254
6254
|
return issue3.keys.map((key) => {
|
|
@@ -6264,20 +6264,20 @@ function mapIssue(issue3) {
|
|
|
6264
6264
|
return [
|
|
6265
6265
|
{
|
|
6266
6266
|
code: "CONFIG_INVALID_VALUE",
|
|
6267
|
-
path:
|
|
6267
|
+
path: path101,
|
|
6268
6268
|
message: `must be one of: ${issue3.values.map((v) => JSON.stringify(v)).join(", ")}.`
|
|
6269
6269
|
}
|
|
6270
6270
|
];
|
|
6271
6271
|
case "custom": {
|
|
6272
6272
|
const code = typeof issue3.params?.code === "string" ? issue3.params.code : "CONFIG_INVALID_VALUE";
|
|
6273
|
-
return [{ code, path:
|
|
6273
|
+
return [{ code, path: path101, message: issue3.message ?? "is invalid." }];
|
|
6274
6274
|
}
|
|
6275
6275
|
case "invalid_type":
|
|
6276
6276
|
return [
|
|
6277
|
-
/received undefined/.test(issue3.message) ? { code: "CONFIG_MISSING_FIELD", path:
|
|
6277
|
+
/received undefined/.test(issue3.message) ? { code: "CONFIG_MISSING_FIELD", path: path101, message: "is required." } : { code: "CONFIG_INVALID_VALUE", path: path101, message: issue3.message }
|
|
6278
6278
|
];
|
|
6279
6279
|
default:
|
|
6280
|
-
return [{ code: "CONFIG_INVALID_VALUE", path:
|
|
6280
|
+
return [{ code: "CONFIG_INVALID_VALUE", path: path101, message: issue3.message }];
|
|
6281
6281
|
}
|
|
6282
6282
|
}
|
|
6283
6283
|
function isRecord(value) {
|
|
@@ -6568,7 +6568,7 @@ function resolveConfigV2(config2, configPath) {
|
|
|
6568
6568
|
docs: {
|
|
6569
6569
|
enabled: portal.docs?.enabled ?? true,
|
|
6570
6570
|
provider,
|
|
6571
|
-
content: provider === "external" ? [] : portal.docs?.content ? portal.docs.content.map((
|
|
6571
|
+
content: provider === "external" ? [] : portal.docs?.content ? portal.docs.content.map((glob9) => fromConfig(configDir, glob9)) : [path7.join(dir, "pages", "**", "*.{md,mdx}")],
|
|
6572
6572
|
url: portal.docs?.url
|
|
6573
6573
|
},
|
|
6574
6574
|
console: { enabled: portal.console?.enabled ?? true },
|
|
@@ -7301,7 +7301,7 @@ var ServiceManifestSchema = z3.looseObject({
|
|
|
7301
7301
|
}).optional()
|
|
7302
7302
|
}).default({})
|
|
7303
7303
|
});
|
|
7304
|
-
var issue = (code,
|
|
7304
|
+
var issue = (code, path101, message, hint) => ({ code, path: path101, message, hint });
|
|
7305
7305
|
function parseManifest(raw, file = "services.json") {
|
|
7306
7306
|
const version = typeof raw === "object" && raw !== null && "schemaVersion" in raw ? raw.schemaVersion : void 0;
|
|
7307
7307
|
if (typeof version === "number" && version > SUPPORTED_MANIFEST_SCHEMA) {
|
|
@@ -7504,8 +7504,8 @@ var METHODS = [
|
|
|
7504
7504
|
"trace"
|
|
7505
7505
|
];
|
|
7506
7506
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7507
|
-
function actionKey(method,
|
|
7508
|
-
const trimmed =
|
|
7507
|
+
function actionKey(method, path101) {
|
|
7508
|
+
const trimmed = path101.trim();
|
|
7509
7509
|
const withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
7510
7510
|
const normalized = withSlash.length > 1 ? withSlash.replace(/\/+$/, "") || "/" : withSlash;
|
|
7511
7511
|
return `${method.trim().toLowerCase()}:${normalized}`;
|
|
@@ -7542,8 +7542,8 @@ var ReferenceSpecError = class extends Error {
|
|
|
7542
7542
|
};
|
|
7543
7543
|
function operationsOf(paths) {
|
|
7544
7544
|
return Object.entries(paths).flatMap(
|
|
7545
|
-
([
|
|
7546
|
-
(method) => [
|
|
7545
|
+
([path101, item]) => isObject(item) ? METHODS.filter((method) => isObject(item[method])).map(
|
|
7546
|
+
(method) => [path101, item, method]
|
|
7547
7547
|
) : []
|
|
7548
7548
|
);
|
|
7549
7549
|
}
|
|
@@ -7558,14 +7558,14 @@ function buildReferenceSpec(specText, options) {
|
|
|
7558
7558
|
throw new ReferenceSpecError("The OpenAPI file could not be read.");
|
|
7559
7559
|
const doc = structuredClone(root);
|
|
7560
7560
|
const paths = isObject(doc.paths) ? doc.paths : {};
|
|
7561
|
-
for (const [
|
|
7562
|
-
if (options.deniedOperations.has(actionKey(method,
|
|
7561
|
+
for (const [path101, item, method] of operationsOf(paths))
|
|
7562
|
+
if (options.deniedOperations.has(actionKey(method, path101)))
|
|
7563
7563
|
delete item[method];
|
|
7564
|
-
for (const [
|
|
7564
|
+
for (const [path101, item] of Object.entries(paths))
|
|
7565
7565
|
if (!isObject(item) || !METHODS.some((method) => method in item))
|
|
7566
|
-
delete paths[
|
|
7567
|
-
for (const [
|
|
7568
|
-
if (options.publicOperations.has(actionKey(method,
|
|
7566
|
+
delete paths[path101];
|
|
7567
|
+
for (const [path101, item, method] of operationsOf(paths))
|
|
7568
|
+
if (options.publicOperations.has(actionKey(method, path101)))
|
|
7569
7569
|
item[method].security = [];
|
|
7570
7570
|
doc.servers = [{ url: options.gatewayBaseUrl.replace(/\/+$/, "") }];
|
|
7571
7571
|
for (const item of Object.values(paths)) {
|
|
@@ -7699,14 +7699,134 @@ function stableJson(value) {
|
|
|
7699
7699
|
}
|
|
7700
7700
|
|
|
7701
7701
|
// src/config/v2/wrapper.ts
|
|
7702
|
-
import { mkdir as mkdir4, readFile as
|
|
7702
|
+
import { mkdir as mkdir4, readFile as readFile6, rename as rename2, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
|
|
7703
|
+
import path12 from "node:path";
|
|
7704
|
+
|
|
7705
|
+
// src/config/v2/docs-navigation.ts
|
|
7706
|
+
var DOCS_NAVIGATION_LABEL = "Documentation";
|
|
7707
|
+
var emptyBranch = () => ({ pages: /* @__PURE__ */ new Set(), folders: /* @__PURE__ */ new Map() });
|
|
7708
|
+
function folderLabel(name) {
|
|
7709
|
+
const words = name.replace(/[-_]+/g, " ").trim();
|
|
7710
|
+
return words.charAt(0).toUpperCase() + words.slice(1);
|
|
7711
|
+
}
|
|
7712
|
+
var byName = (a, b) => a.localeCompare(b);
|
|
7713
|
+
var toItems = (branch, prefix) => {
|
|
7714
|
+
const pages = [...branch.pages].sort(
|
|
7715
|
+
(a, b) => a === "index" ? -1 : b === "index" ? 1 : byName(a, b)
|
|
7716
|
+
);
|
|
7717
|
+
const folders = [...branch.folders.keys()].sort(byName);
|
|
7718
|
+
return [
|
|
7719
|
+
// The index page of a folder is the folder's own address, so the sidebar also shows on `/`.
|
|
7720
|
+
...pages.map(
|
|
7721
|
+
(page) => page === "index" ? {
|
|
7722
|
+
type: "doc",
|
|
7723
|
+
file: `${prefix}${page}`,
|
|
7724
|
+
path: prefix === "" ? "/" : `/${prefix.slice(0, -1)}`
|
|
7725
|
+
} : `${prefix}${page}`
|
|
7726
|
+
),
|
|
7727
|
+
...folders.map(
|
|
7728
|
+
(folder) => ({
|
|
7729
|
+
type: "category",
|
|
7730
|
+
label: folderLabel(folder),
|
|
7731
|
+
collapsible: true,
|
|
7732
|
+
collapsed: false,
|
|
7733
|
+
items: toItems(
|
|
7734
|
+
branch.folders.get(folder) ?? emptyBranch(),
|
|
7735
|
+
`${prefix}${folder}/`
|
|
7736
|
+
)
|
|
7737
|
+
})
|
|
7738
|
+
)
|
|
7739
|
+
];
|
|
7740
|
+
};
|
|
7741
|
+
function docsNavigation(routes) {
|
|
7742
|
+
const root = emptyBranch();
|
|
7743
|
+
for (const route of routes) {
|
|
7744
|
+
const parts = route.split("/").filter(Boolean);
|
|
7745
|
+
const page = parts.pop();
|
|
7746
|
+
if (!page) continue;
|
|
7747
|
+
const branch = parts.reduce((current, folder) => {
|
|
7748
|
+
const next = current.folders.get(folder) ?? emptyBranch();
|
|
7749
|
+
current.folders.set(folder, next);
|
|
7750
|
+
return next;
|
|
7751
|
+
}, root);
|
|
7752
|
+
branch.pages.add(page);
|
|
7753
|
+
}
|
|
7754
|
+
const items = toItems(root, "");
|
|
7755
|
+
return items.length === 0 ? [] : [{ type: "category", label: DOCS_NAVIGATION_LABEL, items }];
|
|
7756
|
+
}
|
|
7757
|
+
|
|
7758
|
+
// src/config/v2/home-redirect.ts
|
|
7703
7759
|
import path11 from "node:path";
|
|
7760
|
+
import { glob as glob2 } from "glob";
|
|
7761
|
+
import globParent from "glob-parent";
|
|
7762
|
+
|
|
7763
|
+
// src/lib/util/readFrontmatter.ts
|
|
7764
|
+
import { readFile as readFile5 } from "node:fs/promises";
|
|
7765
|
+
import matter from "gray-matter";
|
|
7766
|
+
import { parse as parse2, stringify } from "yaml";
|
|
7767
|
+
var yaml = {
|
|
7768
|
+
parse: (input5) => parse2(input5) ?? {},
|
|
7769
|
+
stringify: (obj) => stringify(obj)
|
|
7770
|
+
};
|
|
7771
|
+
var readFrontmatter = async (filePath) => {
|
|
7772
|
+
const content = await readFile5(filePath, "utf-8");
|
|
7773
|
+
const normalizedContent = content.replace(/\r\n/g, "\n");
|
|
7774
|
+
return matter(normalizedContent, { engines: { yaml } });
|
|
7775
|
+
};
|
|
7776
|
+
|
|
7777
|
+
// src/config/v2/home-redirect.ts
|
|
7778
|
+
var IGNORED = ["**/node_modules/**", "**/dist/**", "**/.git/**"];
|
|
7779
|
+
async function docRoutes(patterns, options = {}) {
|
|
7780
|
+
const excluded = patterns.filter((pattern) => pattern.startsWith("!")).map((pattern) => pattern.slice(1));
|
|
7781
|
+
const included = patterns.filter((pattern) => !pattern.startsWith("!"));
|
|
7782
|
+
const routes = await Promise.all(
|
|
7783
|
+
included.map(async (pattern) => {
|
|
7784
|
+
const files = await glob2(pattern, {
|
|
7785
|
+
absolute: true,
|
|
7786
|
+
posix: true,
|
|
7787
|
+
ignore: [...IGNORED, ...excluded]
|
|
7788
|
+
});
|
|
7789
|
+
const parent = globParent(pattern);
|
|
7790
|
+
const published = options.includeDrafts ? files : (await Promise.all(
|
|
7791
|
+
files.map(async (file) => ({
|
|
7792
|
+
file,
|
|
7793
|
+
draft: (await readFrontmatter(file)).data.draft === true
|
|
7794
|
+
}))
|
|
7795
|
+
)).filter(({ draft }) => !draft).map(({ file }) => file);
|
|
7796
|
+
return published.map(
|
|
7797
|
+
(file) => `/${path11.posix.relative(parent, file).replace(/\.mdx?$/, "")}`
|
|
7798
|
+
);
|
|
7799
|
+
})
|
|
7800
|
+
);
|
|
7801
|
+
return [...new Set(routes.flat())].sort();
|
|
7802
|
+
}
|
|
7803
|
+
function pickLandingRoute(routes) {
|
|
7804
|
+
const depth = (route) => route.split("/").length;
|
|
7805
|
+
return [...routes].sort(
|
|
7806
|
+
(a, b) => depth(a) - depth(b) || a.localeCompare(b)
|
|
7807
|
+
)[0];
|
|
7808
|
+
}
|
|
7809
|
+
function homeRedirect(input5) {
|
|
7810
|
+
if (input5.hostsDocs) {
|
|
7811
|
+
if (input5.docRoutes.some((route) => route === "/" || route === "/index"))
|
|
7812
|
+
return void 0;
|
|
7813
|
+
const landing = pickLandingRoute(input5.docRoutes);
|
|
7814
|
+
if (landing) return { from: "/", to: landing };
|
|
7815
|
+
return input5.apiReferencePath ? { from: "/", to: input5.apiReferencePath } : void 0;
|
|
7816
|
+
}
|
|
7817
|
+
if (input5.externalDocsUrl && !input5.userPanel) {
|
|
7818
|
+
return { from: "/", to: input5.externalDocsUrl };
|
|
7819
|
+
}
|
|
7820
|
+
return void 0;
|
|
7821
|
+
}
|
|
7822
|
+
|
|
7823
|
+
// src/config/v2/wrapper.ts
|
|
7704
7824
|
var WRAPPER_FILE = "apitogo.config.tsx";
|
|
7705
7825
|
var CONTENT_LINK = "content";
|
|
7706
|
-
function contentGlob(configDir,
|
|
7707
|
-
const negated =
|
|
7708
|
-
const absolute = negated ?
|
|
7709
|
-
const relative =
|
|
7826
|
+
function contentGlob(configDir, glob9) {
|
|
7827
|
+
const negated = glob9.startsWith("!");
|
|
7828
|
+
const absolute = negated ? glob9.slice(1) : glob9;
|
|
7829
|
+
const relative = path12.relative(configDir, absolute).split(path12.sep).join("/");
|
|
7710
7830
|
return `${negated ? "!" : ""}/${CONTENT_LINK}/${relative}`;
|
|
7711
7831
|
}
|
|
7712
7832
|
var PLANS_CONSOLE_CAPABILITIES = [
|
|
@@ -7830,8 +7950,19 @@ function planPortal(profile, manifest) {
|
|
|
7830
7950
|
var SITE_CONFIG_FILE = "apitogo.config.json";
|
|
7831
7951
|
var REFERENCE_SPEC_FILE = "openapi/gateway.json";
|
|
7832
7952
|
var API_REFERENCE_PATH = "api";
|
|
7833
|
-
function buildSiteConfig(resolved, plan2, theme) {
|
|
7953
|
+
function buildSiteConfig(resolved, plan2, theme, extras = {}) {
|
|
7834
7954
|
const portal = resolved.portal;
|
|
7955
|
+
const redirects = extras.redirects ?? [];
|
|
7956
|
+
const navigation = [
|
|
7957
|
+
...extras.docsNavigation ?? [],
|
|
7958
|
+
...plan2.apiReference ? [
|
|
7959
|
+
{
|
|
7960
|
+
type: "link",
|
|
7961
|
+
to: `/${API_REFERENCE_PATH}`,
|
|
7962
|
+
label: "API Reference"
|
|
7963
|
+
}
|
|
7964
|
+
] : []
|
|
7965
|
+
];
|
|
7835
7966
|
return {
|
|
7836
7967
|
site: {
|
|
7837
7968
|
title: portal?.name ?? resolved.project.name,
|
|
@@ -7844,7 +7975,7 @@ function buildSiteConfig(resolved, plan2, theme) {
|
|
|
7844
7975
|
...plan2.docs ? {
|
|
7845
7976
|
docs: {
|
|
7846
7977
|
files: portal?.docs.content.map(
|
|
7847
|
-
(
|
|
7978
|
+
(glob9) => contentGlob(resolved.configDir, glob9)
|
|
7848
7979
|
)
|
|
7849
7980
|
}
|
|
7850
7981
|
} : {},
|
|
@@ -7855,15 +7986,10 @@ function buildSiteConfig(resolved, plan2, theme) {
|
|
|
7855
7986
|
input: `./${REFERENCE_SPEC_FILE}`,
|
|
7856
7987
|
path: API_REFERENCE_PATH
|
|
7857
7988
|
}
|
|
7858
|
-
],
|
|
7859
|
-
navigation: [
|
|
7860
|
-
{
|
|
7861
|
-
type: "link",
|
|
7862
|
-
to: `/${API_REFERENCE_PATH}`,
|
|
7863
|
-
label: "API Reference"
|
|
7864
|
-
}
|
|
7865
7989
|
]
|
|
7866
7990
|
} : {},
|
|
7991
|
+
...navigation.length > 0 ? { navigation } : {},
|
|
7992
|
+
...redirects.length > 0 ? { redirects } : {},
|
|
7867
7993
|
...theme !== void 0 ? { theme } : {},
|
|
7868
7994
|
...plan2.auth ? { authentication: { type: "openid", ...plan2.auth } } : {},
|
|
7869
7995
|
...plan2.preview ? { preview: true } : {}
|
|
@@ -7897,7 +8023,7 @@ async function readTheme(resolved) {
|
|
|
7897
8023
|
const file = resolved.portal?.theme;
|
|
7898
8024
|
if (!file) return void 0;
|
|
7899
8025
|
try {
|
|
7900
|
-
return JSON.parse(await
|
|
8026
|
+
return JSON.parse(await readFile6(file, "utf8"));
|
|
7901
8027
|
} catch {
|
|
7902
8028
|
return void 0;
|
|
7903
8029
|
}
|
|
@@ -7955,22 +8081,40 @@ async function preparePortal(resolved, manifest, mode, options = {}) {
|
|
|
7955
8081
|
});
|
|
7956
8082
|
}
|
|
7957
8083
|
}
|
|
7958
|
-
const
|
|
8084
|
+
const hostedDocRoutes = plan2.docs ? await docRoutes(profile.docs.content, {
|
|
8085
|
+
includeDrafts: mode === "development"
|
|
8086
|
+
}) : [];
|
|
8087
|
+
const home = homeRedirect({
|
|
8088
|
+
hostsDocs: plan2.docs,
|
|
8089
|
+
docRoutes: hostedDocRoutes,
|
|
8090
|
+
externalDocsUrl: profile.docs.url,
|
|
8091
|
+
apiReferencePath: plan2.apiReference ? `/${API_REFERENCE_PATH}` : void 0,
|
|
8092
|
+
userPanel: plan2.userPanel
|
|
8093
|
+
});
|
|
8094
|
+
const siteConfig = buildSiteConfig(
|
|
8095
|
+
resolved,
|
|
8096
|
+
plan2,
|
|
8097
|
+
await readTheme(resolved),
|
|
8098
|
+
{
|
|
8099
|
+
redirects: home ? [home] : [],
|
|
8100
|
+
docsNavigation: docsNavigation(hostedDocRoutes)
|
|
8101
|
+
}
|
|
8102
|
+
);
|
|
7959
8103
|
const wrapper = renderWrapper(plan2);
|
|
7960
|
-
const wrapperPath =
|
|
8104
|
+
const wrapperPath = path12.join(resolved.state.generatedDir, WRAPPER_FILE);
|
|
7961
8105
|
if (options.write !== false) {
|
|
7962
|
-
await mkdir4(
|
|
8106
|
+
await mkdir4(path12.dirname(wrapperPath), { recursive: true });
|
|
7963
8107
|
await writeFile5(
|
|
7964
|
-
|
|
8108
|
+
path12.join(path12.dirname(wrapperPath), SITE_CONFIG_FILE),
|
|
7965
8109
|
`${JSON.stringify(siteConfig, null, 2)}
|
|
7966
8110
|
`
|
|
7967
8111
|
);
|
|
7968
|
-
const referenceFile =
|
|
7969
|
-
|
|
8112
|
+
const referenceFile = path12.join(
|
|
8113
|
+
path12.dirname(wrapperPath),
|
|
7970
8114
|
REFERENCE_SPEC_FILE
|
|
7971
8115
|
);
|
|
7972
8116
|
if (referenceSpec !== void 0) {
|
|
7973
|
-
await mkdir4(
|
|
8117
|
+
await mkdir4(path12.dirname(referenceFile), { recursive: true });
|
|
7974
8118
|
await writeFile5(referenceFile, referenceSpec);
|
|
7975
8119
|
} else {
|
|
7976
8120
|
await rm2(referenceFile, { force: true });
|
|
@@ -7999,9 +8143,9 @@ async function preparePortal(resolved, manifest, mode, options = {}) {
|
|
|
7999
8143
|
|
|
8000
8144
|
// src/config/v2/workspace.ts
|
|
8001
8145
|
import { createHash as createHash2 } from "node:crypto";
|
|
8002
|
-
import { access as access2, lstat, readFile as
|
|
8003
|
-
import
|
|
8004
|
-
import { glob as
|
|
8146
|
+
import { access as access2, lstat, readFile as readFile7, rm as rm3, symlink } from "node:fs/promises";
|
|
8147
|
+
import path13 from "node:path";
|
|
8148
|
+
import { glob as glob3 } from "glob";
|
|
8005
8149
|
var exists2 = (file) => access2(file).then(
|
|
8006
8150
|
() => true,
|
|
8007
8151
|
() => false
|
|
@@ -8015,11 +8159,11 @@ async function relink(target, link) {
|
|
|
8015
8159
|
await symlink(target, link, "dir");
|
|
8016
8160
|
}
|
|
8017
8161
|
async function materializeWorkspace(resolved, prepared) {
|
|
8018
|
-
const root =
|
|
8162
|
+
const root = path13.dirname(prepared.wrapperPath);
|
|
8019
8163
|
await ensureStateDir(resolved.state);
|
|
8020
|
-
await relink(resolved.configDir,
|
|
8021
|
-
const publicDir = resolved.portal &&
|
|
8022
|
-
const publicLink =
|
|
8164
|
+
await relink(resolved.configDir, path13.join(root, CONTENT_LINK));
|
|
8165
|
+
const publicDir = resolved.portal && path13.join(resolved.portal.dir, "public");
|
|
8166
|
+
const publicLink = path13.join(root, "public");
|
|
8023
8167
|
if (publicDir && await exists2(publicDir)) {
|
|
8024
8168
|
await relink(publicDir, publicLink);
|
|
8025
8169
|
} else {
|
|
@@ -8028,7 +8172,7 @@ async function materializeWorkspace(resolved, prepared) {
|
|
|
8028
8172
|
return root;
|
|
8029
8173
|
}
|
|
8030
8174
|
async function configFingerprint(configPath) {
|
|
8031
|
-
const text = await
|
|
8175
|
+
const text = await readFile7(configPath, "utf8");
|
|
8032
8176
|
try {
|
|
8033
8177
|
const raw = JSON.parse(text);
|
|
8034
8178
|
if (raw.project) {
|
|
@@ -8045,7 +8189,7 @@ async function portalArtifactHash(resolved, manifestText, cliVersion, wrapper =
|
|
|
8045
8189
|
const patterns = [
|
|
8046
8190
|
...portal?.docs.content ?? [],
|
|
8047
8191
|
...resolved.gateway?.specs ?? [],
|
|
8048
|
-
...portal ? [portal.theme,
|
|
8192
|
+
...portal ? [portal.theme, path13.join(portal.dir, "public", "**", "*")] : []
|
|
8049
8193
|
];
|
|
8050
8194
|
const positive = patterns.filter((p) => !p.startsWith("!"));
|
|
8051
8195
|
const ignore2 = patterns.filter((p) => p.startsWith("!")).map((p) => p.slice(1));
|
|
@@ -8053,7 +8197,7 @@ async function portalArtifactHash(resolved, manifestText, cliVersion, wrapper =
|
|
|
8053
8197
|
...new Set(
|
|
8054
8198
|
(await Promise.all(
|
|
8055
8199
|
positive.map(
|
|
8056
|
-
(pattern) =>
|
|
8200
|
+
(pattern) => glob3(pattern.split(path13.sep).join("/"), {
|
|
8057
8201
|
absolute: true,
|
|
8058
8202
|
nodir: true,
|
|
8059
8203
|
ignore: [...ignore2, "**/node_modules/**"]
|
|
@@ -8075,9 +8219,9 @@ async function portalArtifactHash(resolved, manifestText, cliVersion, wrapper =
|
|
|
8075
8219
|
`);
|
|
8076
8220
|
}
|
|
8077
8221
|
for (const file of files) {
|
|
8078
|
-
hash2.update(`file:${
|
|
8222
|
+
hash2.update(`file:${path13.relative(resolved.configDir, file)}
|
|
8079
8223
|
`);
|
|
8080
|
-
hash2.update(await
|
|
8224
|
+
hash2.update(await readFile7(file));
|
|
8081
8225
|
}
|
|
8082
8226
|
return hash2.digest("hex");
|
|
8083
8227
|
}
|
|
@@ -8085,7 +8229,7 @@ async function portalArtifactHash(resolved, manifestText, cliVersion, wrapper =
|
|
|
8085
8229
|
// src/config/v2/services.ts
|
|
8086
8230
|
init_invariant();
|
|
8087
8231
|
import { access as access3, mkdir as mkdir5, rename as rename3, rm as rm4, stat as stat3, writeFile as writeFile6 } from "node:fs/promises";
|
|
8088
|
-
import
|
|
8232
|
+
import path14 from "node:path";
|
|
8089
8233
|
var SERVICES = ["portal", "gateway", "identity", "plans"];
|
|
8090
8234
|
var ServiceEditError = class extends ApitogoError {
|
|
8091
8235
|
constructor(message, developerHint) {
|
|
@@ -8100,7 +8244,7 @@ var exists3 = (target) => access3(target).then(
|
|
|
8100
8244
|
() => true,
|
|
8101
8245
|
() => false
|
|
8102
8246
|
);
|
|
8103
|
-
var rel = (dir, target) =>
|
|
8247
|
+
var rel = (dir, target) => path14.relative(dir, target).split(path14.sep).join("/") || ".";
|
|
8104
8248
|
var STARTER_SPEC = (name) => `openapi: 3.1.0
|
|
8105
8249
|
info:
|
|
8106
8250
|
title: ${JSON.stringify(name)}
|
|
@@ -8166,14 +8310,14 @@ function pair(value, flag, unit) {
|
|
|
8166
8310
|
return [Number(match[1]), Number(match[2])];
|
|
8167
8311
|
}
|
|
8168
8312
|
function insideProject(dir, requested, what) {
|
|
8169
|
-
const absolute =
|
|
8170
|
-
const relative =
|
|
8171
|
-
if (relative === "" || relative.startsWith("..") ||
|
|
8313
|
+
const absolute = path14.resolve(dir, requested);
|
|
8314
|
+
const relative = path14.relative(dir, absolute);
|
|
8315
|
+
if (relative === "" || relative.startsWith("..") || path14.isAbsolute(relative)) {
|
|
8172
8316
|
throw new ServiceEditError(
|
|
8173
8317
|
`${what} "${requested}" is outside the project directory.`
|
|
8174
8318
|
);
|
|
8175
8319
|
}
|
|
8176
|
-
return relative.split(
|
|
8320
|
+
return relative.split(path14.sep).join("/");
|
|
8177
8321
|
}
|
|
8178
8322
|
async function addFile(context, target, content) {
|
|
8179
8323
|
if (await exists3(target)) context.keep.push(target);
|
|
@@ -8210,7 +8354,7 @@ async function buildPortal(context) {
|
|
|
8210
8354
|
if (content.length === 0) {
|
|
8211
8355
|
await addFile(
|
|
8212
8356
|
context,
|
|
8213
|
-
|
|
8357
|
+
path14.join(resolved.root, "portal", "pages", "index.mdx"),
|
|
8214
8358
|
starterPage(name)
|
|
8215
8359
|
);
|
|
8216
8360
|
}
|
|
@@ -8259,7 +8403,7 @@ async function buildGateway(context) {
|
|
|
8259
8403
|
specs = [];
|
|
8260
8404
|
for (const requested of o.spec) {
|
|
8261
8405
|
const relative = insideProject(dir, requested, "OpenAPI file");
|
|
8262
|
-
if (!await stat3(
|
|
8406
|
+
if (!await stat3(path14.join(dir, relative)).then(
|
|
8263
8407
|
(s) => s.isFile(),
|
|
8264
8408
|
() => false
|
|
8265
8409
|
)) {
|
|
@@ -8270,7 +8414,7 @@ async function buildGateway(context) {
|
|
|
8270
8414
|
specs.push(relative);
|
|
8271
8415
|
}
|
|
8272
8416
|
} else if (o.createSpec) {
|
|
8273
|
-
const target =
|
|
8417
|
+
const target = path14.join(resolved.apisDir, "openapi.yaml");
|
|
8274
8418
|
await addFile(context, target, STARTER_SPEC(resolved.project.name));
|
|
8275
8419
|
specs = [rel(dir, target)];
|
|
8276
8420
|
} else {
|
|
@@ -8364,7 +8508,7 @@ async function buildPlans(context) {
|
|
|
8364
8508
|
);
|
|
8365
8509
|
}
|
|
8366
8510
|
const file = o.file ? insideProject(dir, o.file, "Plans file") : void 0;
|
|
8367
|
-
const target = file ?
|
|
8511
|
+
const target = file ? path14.join(dir, file) : resolved.plans?.file ?? path14.join(resolved.root, "plans.json");
|
|
8368
8512
|
await addFile(
|
|
8369
8513
|
context,
|
|
8370
8514
|
target,
|
|
@@ -8394,11 +8538,11 @@ function dependencyProblems(config2, configPath) {
|
|
|
8394
8538
|
return checkDependencies(config2, resolveConfigV2(config2, configPath));
|
|
8395
8539
|
}
|
|
8396
8540
|
async function planAddService(service, options) {
|
|
8397
|
-
const dir =
|
|
8541
|
+
const dir = path14.resolve(options.dir);
|
|
8398
8542
|
const { config: config2, resolved } = loadConfigV2(dir);
|
|
8399
8543
|
if (config2[service] !== void 0) {
|
|
8400
8544
|
throw new ServiceEditError(
|
|
8401
|
-
`${service} is already in ${
|
|
8545
|
+
`${service} is already in ${path14.basename(resolved.configPath)}.`,
|
|
8402
8546
|
`Edit the file, or run \`apitogo remove ${service}\` first. Its files are kept.`
|
|
8403
8547
|
);
|
|
8404
8548
|
}
|
|
@@ -8441,11 +8585,11 @@ async function planAddService(service, options) {
|
|
|
8441
8585
|
};
|
|
8442
8586
|
}
|
|
8443
8587
|
async function planRemoveService(service, options) {
|
|
8444
|
-
const dir =
|
|
8588
|
+
const dir = path14.resolve(options.dir);
|
|
8445
8589
|
const { config: config2, resolved } = loadConfigV2(dir);
|
|
8446
8590
|
if (config2[service] === void 0) {
|
|
8447
8591
|
throw new ServiceEditError(
|
|
8448
|
-
`${service} is not in ${
|
|
8592
|
+
`${service} is not in ${path14.basename(resolved.configPath)}.`
|
|
8449
8593
|
);
|
|
8450
8594
|
}
|
|
8451
8595
|
const { [service]: removed, ...rest } = config2;
|
|
@@ -8494,7 +8638,7 @@ async function writeConfig(configPath, config2) {
|
|
|
8494
8638
|
async function applyServiceEdit(edit) {
|
|
8495
8639
|
const created = [];
|
|
8496
8640
|
for (const file of edit.files) {
|
|
8497
|
-
await mkdir5(
|
|
8641
|
+
await mkdir5(path14.dirname(file.path), { recursive: true });
|
|
8498
8642
|
try {
|
|
8499
8643
|
await writeFile6(file.path, file.content, { flag: "wx" });
|
|
8500
8644
|
created.push(file.path);
|
|
@@ -8508,7 +8652,7 @@ async function applyServiceEdit(edit) {
|
|
|
8508
8652
|
function formatServiceEdit(edit) {
|
|
8509
8653
|
const verb = edit.action === "add" ? "Adds" : "Removes";
|
|
8510
8654
|
return [
|
|
8511
|
-
`${verb} the ${edit.service} section in ${
|
|
8655
|
+
`${verb} the ${edit.service} section in ${path14.basename(edit.configPath)}.`,
|
|
8512
8656
|
...edit.files.length > 0 ? [
|
|
8513
8657
|
"Will create:",
|
|
8514
8658
|
...edit.files.map((file) => ` ${rel(edit.dir, file.path)}`)
|
|
@@ -8544,8 +8688,8 @@ async function clearProjectId(dir, projectId) {
|
|
|
8544
8688
|
|
|
8545
8689
|
// src/config/v2/ledger.ts
|
|
8546
8690
|
init_invariant();
|
|
8547
|
-
import { mkdir as mkdir6, readFile as
|
|
8548
|
-
import
|
|
8691
|
+
import { mkdir as mkdir6, readFile as readFile8, rename as rename4, rm as rm5, writeFile as writeFile7 } from "node:fs/promises";
|
|
8692
|
+
import path15 from "node:path";
|
|
8549
8693
|
var LEDGER_VERSION = 1;
|
|
8550
8694
|
var LedgerError = class extends ApitogoError {
|
|
8551
8695
|
constructor(code, message, developerHint) {
|
|
@@ -8561,7 +8705,7 @@ var emptyLedger = () => ({
|
|
|
8561
8705
|
async function readLedger(state) {
|
|
8562
8706
|
let text;
|
|
8563
8707
|
try {
|
|
8564
|
-
text = await
|
|
8708
|
+
text = await readFile8(state.file, "utf8");
|
|
8565
8709
|
} catch (error) {
|
|
8566
8710
|
if (error.code === "ENOENT")
|
|
8567
8711
|
return emptyLedger();
|
|
@@ -8600,7 +8744,7 @@ function corrupt(file, why) {
|
|
|
8600
8744
|
);
|
|
8601
8745
|
}
|
|
8602
8746
|
async function writeLedger(state, ledger) {
|
|
8603
|
-
await mkdir6(
|
|
8747
|
+
await mkdir6(path15.dirname(state.file), { recursive: true });
|
|
8604
8748
|
const temporary = `${state.file}.${process.pid}.tmp`;
|
|
8605
8749
|
try {
|
|
8606
8750
|
await writeFile7(temporary, `${JSON.stringify(ledger, null, 2)}
|
|
@@ -8693,7 +8837,7 @@ init_invariant();
|
|
|
8693
8837
|
// src/cli/check/v2.ts
|
|
8694
8838
|
init_apitogo_config_core();
|
|
8695
8839
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
8696
|
-
import
|
|
8840
|
+
import path47 from "node:path";
|
|
8697
8841
|
|
|
8698
8842
|
// src/cli/platform/client/platform-api.ts
|
|
8699
8843
|
import { basename } from "node:path";
|
|
@@ -8806,8 +8950,8 @@ var PlatformApiClient = class {
|
|
|
8806
8950
|
constructor(config2) {
|
|
8807
8951
|
this.config = config2;
|
|
8808
8952
|
}
|
|
8809
|
-
url(
|
|
8810
|
-
return `${this.config.apiUrl}${
|
|
8953
|
+
url(path101) {
|
|
8954
|
+
return `${this.config.apiUrl}${path101.startsWith("/") ? path101 : `/${path101}`}`;
|
|
8811
8955
|
}
|
|
8812
8956
|
headers(extra) {
|
|
8813
8957
|
return {
|
|
@@ -8817,9 +8961,9 @@ var PlatformApiClient = class {
|
|
|
8817
8961
|
...extra
|
|
8818
8962
|
};
|
|
8819
8963
|
}
|
|
8820
|
-
async request(method,
|
|
8964
|
+
async request(method, path101, init4) {
|
|
8821
8965
|
const response = await fetchWithRetry(
|
|
8822
|
-
this.url(
|
|
8966
|
+
this.url(path101),
|
|
8823
8967
|
{
|
|
8824
8968
|
method,
|
|
8825
8969
|
...init4,
|
|
@@ -9182,15 +9326,15 @@ var PlatformApiClient = class {
|
|
|
9182
9326
|
}
|
|
9183
9327
|
);
|
|
9184
9328
|
}
|
|
9185
|
-
deleteDevPortalPage(projectId,
|
|
9186
|
-
const query = new URLSearchParams({ path:
|
|
9329
|
+
deleteDevPortalPage(projectId, path101) {
|
|
9330
|
+
const query = new URLSearchParams({ path: path101 });
|
|
9187
9331
|
return this.request(
|
|
9188
9332
|
"DELETE",
|
|
9189
9333
|
`/api/v1/projects/${projectId}/dev-portal/pages/files?${query.toString()}`
|
|
9190
9334
|
);
|
|
9191
9335
|
}
|
|
9192
|
-
renameDevPortalPage(projectId,
|
|
9193
|
-
const query = new URLSearchParams({ path:
|
|
9336
|
+
renameDevPortalPage(projectId, path101, newName) {
|
|
9337
|
+
const query = new URLSearchParams({ path: path101 });
|
|
9194
9338
|
return this.request(
|
|
9195
9339
|
"POST",
|
|
9196
9340
|
`/api/v1/projects/${projectId}/dev-portal/pages/files/rename?${query.toString()}`,
|
|
@@ -9306,8 +9450,8 @@ var PlatformApiClient = class {
|
|
|
9306
9450
|
* the project-less endpoint is used; `planTier` overrides the tier used for paid-plan checks.
|
|
9307
9451
|
*/
|
|
9308
9452
|
validateGatewayPlans(plans, options = {}) {
|
|
9309
|
-
const
|
|
9310
|
-
return this.request("POST",
|
|
9453
|
+
const path101 = options.projectId ? `/api/v1/projects/${options.projectId}/gateway/plans/validate` : "/api/v1/gateway/plans/validate";
|
|
9454
|
+
return this.request("POST", path101, {
|
|
9311
9455
|
headers: { "Content-Type": "application/json" },
|
|
9312
9456
|
body: JSON.stringify({ plans, planTier: options.planTier })
|
|
9313
9457
|
});
|
|
@@ -9420,8 +9564,8 @@ function isNotFoundError(error) {
|
|
|
9420
9564
|
|
|
9421
9565
|
// src/cli/platform/credentials-store.ts
|
|
9422
9566
|
import fs from "node:fs";
|
|
9423
|
-
import
|
|
9424
|
-
var CREDENTIALS_FILE =
|
|
9567
|
+
import path16 from "node:path";
|
|
9568
|
+
var CREDENTIALS_FILE = path16.join(
|
|
9425
9569
|
ZUDOKU_XDG_CONFIG_HOME,
|
|
9426
9570
|
"credentials.json"
|
|
9427
9571
|
);
|
|
@@ -9442,7 +9586,7 @@ function readStoredCredentials() {
|
|
|
9442
9586
|
}
|
|
9443
9587
|
}
|
|
9444
9588
|
function writeStoredCredentials(creds) {
|
|
9445
|
-
fs.mkdirSync(
|
|
9589
|
+
fs.mkdirSync(path16.dirname(CREDENTIALS_FILE), { recursive: true });
|
|
9446
9590
|
fs.writeFileSync(CREDENTIALS_FILE, JSON.stringify(creds, null, 2), {
|
|
9447
9591
|
mode: 384
|
|
9448
9592
|
});
|
|
@@ -9512,11 +9656,11 @@ import {
|
|
|
9512
9656
|
writeFile as writeFile13
|
|
9513
9657
|
} from "node:fs/promises";
|
|
9514
9658
|
import { createRequire as createRequire2 } from "node:module";
|
|
9515
|
-
import
|
|
9659
|
+
import path46 from "node:path";
|
|
9516
9660
|
|
|
9517
9661
|
// src/vite/build.ts
|
|
9518
9662
|
import { mkdir as mkdir11, readFile as readFile10, rename as rename5, rm as rm7, writeFile as writeFile12 } from "node:fs/promises";
|
|
9519
|
-
import
|
|
9663
|
+
import path45 from "node:path";
|
|
9520
9664
|
import { build as esbuild } from "esbuild";
|
|
9521
9665
|
import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
|
|
9522
9666
|
|
|
@@ -9652,7 +9796,7 @@ init_invariant();
|
|
|
9652
9796
|
init_joinUrl();
|
|
9653
9797
|
|
|
9654
9798
|
// src/vite/config.ts
|
|
9655
|
-
import
|
|
9799
|
+
import path40 from "node:path";
|
|
9656
9800
|
import dotenv from "dotenv";
|
|
9657
9801
|
import colors8 from "picocolors";
|
|
9658
9802
|
import {
|
|
@@ -9663,7 +9807,7 @@ import {
|
|
|
9663
9807
|
// package.json
|
|
9664
9808
|
var package_default = {
|
|
9665
9809
|
name: "@lukoweb/apitogo",
|
|
9666
|
-
version: "0.2.
|
|
9810
|
+
version: "0.2.17",
|
|
9667
9811
|
type: "module",
|
|
9668
9812
|
sideEffects: [
|
|
9669
9813
|
"**/*.css",
|
|
@@ -10097,24 +10241,24 @@ async function loadDevPortalViteDefines(rootDir, mode) {
|
|
|
10097
10241
|
|
|
10098
10242
|
// src/vite/package-root.ts
|
|
10099
10243
|
init_file_exists();
|
|
10100
|
-
import
|
|
10244
|
+
import path21 from "node:path";
|
|
10101
10245
|
var findPackageRoot = async (startDir) => {
|
|
10102
10246
|
let dir = startDir;
|
|
10103
|
-
while (dir !==
|
|
10104
|
-
if (await fileExists(
|
|
10105
|
-
dir =
|
|
10247
|
+
while (dir !== path21.dirname(dir)) {
|
|
10248
|
+
if (await fileExists(path21.join(dir, "package.json"))) return dir;
|
|
10249
|
+
dir = path21.dirname(dir);
|
|
10106
10250
|
}
|
|
10107
10251
|
};
|
|
10108
10252
|
|
|
10109
10253
|
// src/vite/pagefind-dev-stub.ts
|
|
10110
10254
|
import fs2 from "node:fs/promises";
|
|
10111
|
-
import
|
|
10255
|
+
import path22 from "node:path";
|
|
10112
10256
|
var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
|
|
10113
10257
|
async function ensurePagefindDevStub(publicDir) {
|
|
10114
|
-
const pagefindPath =
|
|
10258
|
+
const pagefindPath = path22.join(publicDir, "pagefind/pagefind.js");
|
|
10115
10259
|
const exists5 = await fs2.stat(pagefindPath).catch(() => false);
|
|
10116
10260
|
if (!exists5) {
|
|
10117
|
-
await fs2.mkdir(
|
|
10261
|
+
await fs2.mkdir(path22.dirname(pagefindPath), { recursive: true });
|
|
10118
10262
|
await fs2.writeFile(pagefindPath, NOT_BUILT_YET);
|
|
10119
10263
|
}
|
|
10120
10264
|
}
|
|
@@ -10126,7 +10270,7 @@ import react from "@vitejs/plugin-react";
|
|
|
10126
10270
|
// src/vite/css/plugin.ts
|
|
10127
10271
|
init_loader();
|
|
10128
10272
|
init_plugin_theme();
|
|
10129
|
-
import
|
|
10273
|
+
import path23 from "node:path";
|
|
10130
10274
|
import { isCSSRequest as isCSSRequest2 } from "vite";
|
|
10131
10275
|
|
|
10132
10276
|
// src/vite/css/collect.ts
|
|
@@ -10161,7 +10305,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
|
|
|
10161
10305
|
function vitePluginSsrCss(pluginOpts) {
|
|
10162
10306
|
let server;
|
|
10163
10307
|
const config2 = getCurrentConfig();
|
|
10164
|
-
const virtualHref =
|
|
10308
|
+
const virtualHref = path23.join(
|
|
10165
10309
|
config2.basePath ?? "",
|
|
10166
10310
|
`/@id/__x00__${VIRTUAL_ENTRY}?direct`
|
|
10167
10311
|
);
|
|
@@ -10298,7 +10442,7 @@ var plugin_api_keys_default = viteApiKeysPlugin;
|
|
|
10298
10442
|
|
|
10299
10443
|
// src/vite/plugin-api.ts
|
|
10300
10444
|
import fs4 from "node:fs/promises";
|
|
10301
|
-
import
|
|
10445
|
+
import path29 from "node:path";
|
|
10302
10446
|
import { deepEqual as deepEqual2 } from "fast-equals";
|
|
10303
10447
|
import { runnerImport as runnerImport3 } from "vite";
|
|
10304
10448
|
init_package_json();
|
|
@@ -10307,7 +10451,7 @@ init_loader();
|
|
|
10307
10451
|
// src/config/validators/BuildSchema.ts
|
|
10308
10452
|
init_file_exists();
|
|
10309
10453
|
init_loader();
|
|
10310
|
-
import
|
|
10454
|
+
import path24 from "node:path";
|
|
10311
10455
|
import { runnerImport as runnerImport2 } from "vite";
|
|
10312
10456
|
import { z as z13 } from "zod";
|
|
10313
10457
|
var BuildProcessorSchema = z13.custom((val) => typeof val === "function");
|
|
@@ -10336,7 +10480,7 @@ var buildConfigFiles = [
|
|
|
10336
10480
|
];
|
|
10337
10481
|
async function getBuildConfigFilePath(rootDir) {
|
|
10338
10482
|
for (const fileName of buildConfigFiles) {
|
|
10339
|
-
const filepath =
|
|
10483
|
+
const filepath = path24.join(rootDir, fileName);
|
|
10340
10484
|
if (await fileExists(filepath)) {
|
|
10341
10485
|
return filepath;
|
|
10342
10486
|
}
|
|
@@ -10445,14 +10589,14 @@ var flattenAllOf = (schema2) => {
|
|
|
10445
10589
|
};
|
|
10446
10590
|
|
|
10447
10591
|
// src/lib/util/traverse.ts
|
|
10448
|
-
var traverse = (specification, transform,
|
|
10449
|
-
const transformed = transform(specification,
|
|
10592
|
+
var traverse = (specification, transform, path101 = []) => {
|
|
10593
|
+
const transformed = transform(specification, path101);
|
|
10450
10594
|
if (typeof transformed !== "object" || transformed === null) {
|
|
10451
10595
|
return transformed;
|
|
10452
10596
|
}
|
|
10453
10597
|
const result = Array.isArray(transformed) ? [] : {};
|
|
10454
10598
|
for (const [key, value] of Object.entries(transformed)) {
|
|
10455
|
-
const currentPath = [...
|
|
10599
|
+
const currentPath = [...path101, key];
|
|
10456
10600
|
if (Array.isArray(value)) {
|
|
10457
10601
|
result[key] = value.map(
|
|
10458
10602
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -10480,9 +10624,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
10480
10624
|
if (schemaCache?.has(ref)) {
|
|
10481
10625
|
return schemaCache.get(ref);
|
|
10482
10626
|
}
|
|
10483
|
-
const
|
|
10627
|
+
const path101 = ref.split("/").slice(1);
|
|
10484
10628
|
let current = schema2;
|
|
10485
|
-
for (const segment of
|
|
10629
|
+
for (const segment of path101) {
|
|
10486
10630
|
if (!current || typeof current !== "object") {
|
|
10487
10631
|
current = null;
|
|
10488
10632
|
}
|
|
@@ -10501,7 +10645,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10501
10645
|
}
|
|
10502
10646
|
const cloned = structuredClone(schema2);
|
|
10503
10647
|
const visited = /* @__PURE__ */ new Set();
|
|
10504
|
-
const resolve = async (current,
|
|
10648
|
+
const resolve = async (current, path101) => {
|
|
10505
10649
|
if (isIndexableObject(current)) {
|
|
10506
10650
|
if (visited.has(current)) {
|
|
10507
10651
|
return CIRCULAR_REF;
|
|
@@ -10509,7 +10653,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10509
10653
|
visited.add(current);
|
|
10510
10654
|
if (Array.isArray(current)) {
|
|
10511
10655
|
for (let index = 0; index < current.length; index++) {
|
|
10512
|
-
current[index] = await resolve(current[index], `${
|
|
10656
|
+
current[index] = await resolve(current[index], `${path101}/${index}`);
|
|
10513
10657
|
}
|
|
10514
10658
|
} else {
|
|
10515
10659
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -10520,13 +10664,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10520
10664
|
for (const resolver of resolvers) {
|
|
10521
10665
|
const resolved = await resolver($ref);
|
|
10522
10666
|
if (resolved) {
|
|
10523
|
-
result2 = await resolve(resolved,
|
|
10667
|
+
result2 = await resolve(resolved, path101);
|
|
10524
10668
|
break;
|
|
10525
10669
|
}
|
|
10526
10670
|
}
|
|
10527
10671
|
if (result2 === void 0) {
|
|
10528
10672
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
10529
|
-
result2 = await resolve(resolved,
|
|
10673
|
+
result2 = await resolve(resolved, path101);
|
|
10530
10674
|
}
|
|
10531
10675
|
if (hasSiblings) {
|
|
10532
10676
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -10539,7 +10683,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10539
10683
|
return result2;
|
|
10540
10684
|
}
|
|
10541
10685
|
for (const key in current) {
|
|
10542
|
-
current[key] = await resolve(current[key], `${
|
|
10686
|
+
current[key] = await resolve(current[key], `${path101}/${key}`);
|
|
10543
10687
|
}
|
|
10544
10688
|
}
|
|
10545
10689
|
visited.delete(current);
|
|
@@ -10578,9 +10722,9 @@ var upgradeSchema = (schema2) => {
|
|
|
10578
10722
|
}
|
|
10579
10723
|
return sub;
|
|
10580
10724
|
});
|
|
10581
|
-
schema2 = traverse(schema2, (sub,
|
|
10725
|
+
schema2 = traverse(schema2, (sub, path101) => {
|
|
10582
10726
|
if (sub.example !== void 0) {
|
|
10583
|
-
if (isSchemaPath(
|
|
10727
|
+
if (isSchemaPath(path101 ?? [])) {
|
|
10584
10728
|
sub.examples = [sub.example];
|
|
10585
10729
|
} else {
|
|
10586
10730
|
sub.examples = {
|
|
@@ -10593,11 +10737,11 @@ var upgradeSchema = (schema2) => {
|
|
|
10593
10737
|
}
|
|
10594
10738
|
return sub;
|
|
10595
10739
|
});
|
|
10596
|
-
schema2 = traverse(schema2, (schema3,
|
|
10740
|
+
schema2 = traverse(schema2, (schema3, path101) => {
|
|
10597
10741
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
10598
|
-
const parentPath =
|
|
10742
|
+
const parentPath = path101?.slice(0, -1);
|
|
10599
10743
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
10600
|
-
return segment === "content" &&
|
|
10744
|
+
return segment === "content" && path101?.[index + 1] === "multipart/form-data";
|
|
10601
10745
|
});
|
|
10602
10746
|
if (isMultipart) {
|
|
10603
10747
|
const entries = Object.entries(schema3.properties);
|
|
@@ -10611,8 +10755,8 @@ var upgradeSchema = (schema2) => {
|
|
|
10611
10755
|
}
|
|
10612
10756
|
return schema3;
|
|
10613
10757
|
});
|
|
10614
|
-
schema2 = traverse(schema2, (schema3,
|
|
10615
|
-
if (
|
|
10758
|
+
schema2 = traverse(schema2, (schema3, path101) => {
|
|
10759
|
+
if (path101?.includes("content") && path101.includes("application/octet-stream")) {
|
|
10616
10760
|
return {};
|
|
10617
10761
|
}
|
|
10618
10762
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -10638,11 +10782,11 @@ var upgradeSchema = (schema2) => {
|
|
|
10638
10782
|
}
|
|
10639
10783
|
return sub;
|
|
10640
10784
|
});
|
|
10641
|
-
schema2 = traverse(schema2, (schema3,
|
|
10785
|
+
schema2 = traverse(schema2, (schema3, path101) => {
|
|
10642
10786
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
10643
|
-
const parentPath =
|
|
10787
|
+
const parentPath = path101?.slice(0, -1);
|
|
10644
10788
|
const contentMediaType = parentPath?.find(
|
|
10645
|
-
(_, index) =>
|
|
10789
|
+
(_, index) => path101?.[index - 1] === "content"
|
|
10646
10790
|
);
|
|
10647
10791
|
return {
|
|
10648
10792
|
type: "string",
|
|
@@ -10654,7 +10798,7 @@ var upgradeSchema = (schema2) => {
|
|
|
10654
10798
|
});
|
|
10655
10799
|
return schema2;
|
|
10656
10800
|
};
|
|
10657
|
-
function isSchemaPath(
|
|
10801
|
+
function isSchemaPath(path101) {
|
|
10658
10802
|
const schemaLocations = [
|
|
10659
10803
|
["components", "schemas"],
|
|
10660
10804
|
"properties",
|
|
@@ -10667,10 +10811,10 @@ function isSchemaPath(path100) {
|
|
|
10667
10811
|
];
|
|
10668
10812
|
return schemaLocations.some((location) => {
|
|
10669
10813
|
if (Array.isArray(location)) {
|
|
10670
|
-
return location.every((segment, index) =>
|
|
10814
|
+
return location.every((segment, index) => path101[index] === segment);
|
|
10671
10815
|
}
|
|
10672
|
-
return
|
|
10673
|
-
}) ||
|
|
10816
|
+
return path101.includes(location);
|
|
10817
|
+
}) || path101.includes("schema") || path101.some((segment) => segment.endsWith("Schema"));
|
|
10674
10818
|
}
|
|
10675
10819
|
|
|
10676
10820
|
// src/lib/oas/parser/index.ts
|
|
@@ -10752,13 +10896,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
10752
10896
|
"anyOf",
|
|
10753
10897
|
"oneOf"
|
|
10754
10898
|
]);
|
|
10755
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
10899
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path101 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
10756
10900
|
if (obj === null || typeof obj !== "object") return obj;
|
|
10757
10901
|
const refPath = obj.__$ref;
|
|
10758
10902
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
10759
10903
|
if (isCircular) {
|
|
10760
10904
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
10761
|
-
const circularProp =
|
|
10905
|
+
const circularProp = path101.find((p) => !OPENAPI_PROPS.has(p)) || path101[0];
|
|
10762
10906
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
10763
10907
|
}
|
|
10764
10908
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -10768,7 +10912,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
10768
10912
|
value,
|
|
10769
10913
|
currentPath,
|
|
10770
10914
|
refs,
|
|
10771
|
-
[...
|
|
10915
|
+
[...path101, key],
|
|
10772
10916
|
currentRefPaths
|
|
10773
10917
|
);
|
|
10774
10918
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -10803,7 +10947,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
10803
10947
|
var getAllTags = (schema2) => {
|
|
10804
10948
|
const rootTags = schema2.tags ?? [];
|
|
10805
10949
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
10806
|
-
(
|
|
10950
|
+
(path101) => HttpMethods.map((k) => path101?.[k]).filter((op) => op != null)
|
|
10807
10951
|
);
|
|
10808
10952
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
10809
10953
|
const hasUntaggedOperations = operations.some(
|
|
@@ -10858,7 +11002,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
10858
11002
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
10859
11003
|
var getAllOperations = (paths) => {
|
|
10860
11004
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
10861
|
-
([
|
|
11005
|
+
([path101, value]) => HttpMethods.flatMap((method) => {
|
|
10862
11006
|
if (!value?.[method]) return [];
|
|
10863
11007
|
const operation = value[method];
|
|
10864
11008
|
const pathParameters = value.parameters ?? [];
|
|
@@ -10878,7 +11022,7 @@ var getAllOperations = (paths) => {
|
|
|
10878
11022
|
return {
|
|
10879
11023
|
...operation,
|
|
10880
11024
|
method,
|
|
10881
|
-
path:
|
|
11025
|
+
path: path101,
|
|
10882
11026
|
parameters,
|
|
10883
11027
|
servers,
|
|
10884
11028
|
tags: operation.tags ?? []
|
|
@@ -11236,8 +11380,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
11236
11380
|
}),
|
|
11237
11381
|
paths: t.field({
|
|
11238
11382
|
type: [PathItem],
|
|
11239
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
11240
|
-
path:
|
|
11383
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path101, value]) => ({
|
|
11384
|
+
path: path101,
|
|
11241
11385
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
11242
11386
|
methods: Object.keys(value)
|
|
11243
11387
|
}))
|
|
@@ -11350,7 +11494,7 @@ var ensureArray = (value) => Array.isArray(value) ? value : [value];
|
|
|
11350
11494
|
|
|
11351
11495
|
// src/vite/api/SchemaManager.ts
|
|
11352
11496
|
import fs3 from "node:fs/promises";
|
|
11353
|
-
import
|
|
11497
|
+
import path25 from "node:path";
|
|
11354
11498
|
import {
|
|
11355
11499
|
$RefParser as $RefParser2
|
|
11356
11500
|
} from "@apidevtools/json-schema-ref-parser";
|
|
@@ -11402,7 +11546,7 @@ init_joinUrl();
|
|
|
11402
11546
|
|
|
11403
11547
|
// src/vite/api/schema-codegen.ts
|
|
11404
11548
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
11405
|
-
var getSegmentsFromPath = (
|
|
11549
|
+
var getSegmentsFromPath = (path101) => path101.split("/").slice(1).map(unescapeJsonPointer);
|
|
11406
11550
|
var createLocalRefMap = (obj) => {
|
|
11407
11551
|
const refMap = /* @__PURE__ */ new Map();
|
|
11408
11552
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -11433,23 +11577,23 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
11433
11577
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
11434
11578
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
11435
11579
|
);
|
|
11436
|
-
var lookup = (schema2,
|
|
11437
|
-
const parts = getSegmentsFromPath(
|
|
11580
|
+
var lookup = (schema2, path101, filePath) => {
|
|
11581
|
+
const parts = getSegmentsFromPath(path101);
|
|
11438
11582
|
let val = schema2;
|
|
11439
11583
|
for (const part of parts) {
|
|
11440
11584
|
while (val.$ref?.startsWith("#/")) {
|
|
11441
|
-
val = val.$ref ===
|
|
11585
|
+
val = val.$ref === path101 ? val : lookup(schema2, val.$ref, filePath);
|
|
11442
11586
|
}
|
|
11443
11587
|
if (val[part] === void 0) {
|
|
11444
11588
|
throw new Error(
|
|
11445
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
11589
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path101}`
|
|
11446
11590
|
);
|
|
11447
11591
|
}
|
|
11448
11592
|
val = val[part];
|
|
11449
11593
|
}
|
|
11450
11594
|
return val;
|
|
11451
11595
|
};
|
|
11452
|
-
var
|
|
11596
|
+
var stringify2 = (obj, indent = 2) => JSON.stringify(obj, null, indent);
|
|
11453
11597
|
var generateCode = (schema2, filePath) => {
|
|
11454
11598
|
const { refMap, siblingsMap } = createLocalRefMap(schema2);
|
|
11455
11599
|
const lines = [];
|
|
@@ -11466,7 +11610,7 @@ var generateCode = (schema2, filePath) => {
|
|
|
11466
11610
|
mergedRefs.set(uniqueKey, varName);
|
|
11467
11611
|
lines.push(`const ${varName} = {};`);
|
|
11468
11612
|
}
|
|
11469
|
-
const toCode = (obj) => replaceMarkers(
|
|
11613
|
+
const toCode = (obj) => replaceMarkers(stringify2(setRefMarkers(obj, refMap)), mergedRefs);
|
|
11470
11614
|
const deferred = [];
|
|
11471
11615
|
for (const [refPath, index] of refMap) {
|
|
11472
11616
|
const value = lookup(schema2, refPath, filePath);
|
|
@@ -11477,7 +11621,7 @@ var generateCode = (schema2, filePath) => {
|
|
|
11477
11621
|
const siblingEntry = value.__uniqueRefKey && siblingsMap.get(value.__uniqueRefKey);
|
|
11478
11622
|
const target = siblingEntry ? deferred : lines;
|
|
11479
11623
|
target.push(
|
|
11480
|
-
siblingEntry ? `Object.assign(__refs[${index}], __refMap["${siblingEntry.refPath}"], ${
|
|
11624
|
+
siblingEntry ? `Object.assign(__refs[${index}], __refMap["${siblingEntry.refPath}"], ${stringify2(siblingEntry.siblings)});` : `Object.assign(__refs[${index}], ${toCode(value)});`,
|
|
11481
11625
|
`Object.defineProperty(__refs[${index}], "__$ref", { value: __refMapPaths[${index}], enumerable: false });`
|
|
11482
11626
|
);
|
|
11483
11627
|
}
|
|
@@ -11486,7 +11630,7 @@ var generateCode = (schema2, filePath) => {
|
|
|
11486
11630
|
const varName = mergedRefs.get(uniqueKey);
|
|
11487
11631
|
const refIndex = refMap.get(refPath);
|
|
11488
11632
|
lines.push(
|
|
11489
|
-
`Object.assign(${varName}, __refMap["${refPath}"], ${
|
|
11633
|
+
`Object.assign(${varName}, __refMap["${refPath}"], ${stringify2(siblings)});`,
|
|
11490
11634
|
`Object.defineProperty(${varName}, "__$ref", { value: __refMapPaths[${refIndex}], enumerable: false });`
|
|
11491
11635
|
);
|
|
11492
11636
|
}
|
|
@@ -11540,18 +11684,18 @@ var SchemaManager = class {
|
|
|
11540
11684
|
];
|
|
11541
11685
|
}
|
|
11542
11686
|
getPathForFile = (input5, params) => {
|
|
11543
|
-
const filePath =
|
|
11687
|
+
const filePath = path25.resolve(this.config.__meta.rootDir, input5);
|
|
11544
11688
|
const apis = ensureArray(this.config.apis ?? []);
|
|
11545
11689
|
for (const apiConfig of apis) {
|
|
11546
11690
|
if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
|
|
11547
11691
|
const match = normalizeInputs(apiConfig.input).some(
|
|
11548
|
-
(i) =>
|
|
11692
|
+
(i) => path25.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
|
|
11549
11693
|
);
|
|
11550
11694
|
if (match) return apiConfig.path;
|
|
11551
11695
|
}
|
|
11552
11696
|
};
|
|
11553
11697
|
processSchema = async (input5) => {
|
|
11554
|
-
const filePath =
|
|
11698
|
+
const filePath = path25.resolve(this.config.__meta.rootDir, input5.input);
|
|
11555
11699
|
const params = input5.params;
|
|
11556
11700
|
const configuredPath = this.getPathForFile(input5.input, params);
|
|
11557
11701
|
if (!configuredPath) {
|
|
@@ -11587,9 +11731,9 @@ var SchemaManager = class {
|
|
|
11587
11731
|
const processedTime = Date.now();
|
|
11588
11732
|
const code = generateCode(processedSchema, filePath);
|
|
11589
11733
|
const prefixPath = slugify(configuredPath);
|
|
11590
|
-
const processedFilePath =
|
|
11734
|
+
const processedFilePath = path25.posix.join(
|
|
11591
11735
|
this.storeDir,
|
|
11592
|
-
`${prefixPath}-${
|
|
11736
|
+
`${prefixPath}-${path25.basename(filePath)}${paramsSuffix(params)}.js`
|
|
11593
11737
|
);
|
|
11594
11738
|
const importKey = processedFilePath;
|
|
11595
11739
|
await fs3.writeFile(processedFilePath, code);
|
|
@@ -11638,7 +11782,7 @@ var SchemaManager = class {
|
|
|
11638
11782
|
};
|
|
11639
11783
|
getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
|
|
11640
11784
|
getFilesToReprocess = (changedFile) => {
|
|
11641
|
-
const resolvedPath =
|
|
11785
|
+
const resolvedPath = path25.resolve(this.config.__meta.rootDir, changedFile);
|
|
11642
11786
|
const referencedBy = this.referencedBy.get(resolvedPath);
|
|
11643
11787
|
if (!referencedBy) return [];
|
|
11644
11788
|
const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
|
|
@@ -11667,7 +11811,7 @@ var SchemaManager = class {
|
|
|
11667
11811
|
version: "",
|
|
11668
11812
|
path: input5.path ?? "",
|
|
11669
11813
|
label: input5.label,
|
|
11670
|
-
inputPath:
|
|
11814
|
+
inputPath: path25.resolve(this.config.__meta.rootDir, input5.input),
|
|
11671
11815
|
params: input5.params,
|
|
11672
11816
|
importKey: "",
|
|
11673
11817
|
downloadUrl: "",
|
|
@@ -11687,8 +11831,8 @@ var SchemaManager = class {
|
|
|
11687
11831
|
}
|
|
11688
11832
|
}
|
|
11689
11833
|
};
|
|
11690
|
-
getLatestSchema = (
|
|
11691
|
-
getSchemasForPath = (
|
|
11834
|
+
getLatestSchema = (path101) => this.processedSchemas[path101]?.at(0);
|
|
11835
|
+
getSchemasForPath = (path101) => this.processedSchemas[path101];
|
|
11692
11836
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
11693
11837
|
getUrlToFilePathMap = () => {
|
|
11694
11838
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -11710,7 +11854,7 @@ var SchemaManager = class {
|
|
|
11710
11854
|
};
|
|
11711
11855
|
createSchemaPath = (inputPath, versionPath, apiPath, params) => {
|
|
11712
11856
|
const suffix = paramsSuffix(params);
|
|
11713
|
-
const extension = suffix ? ".json" :
|
|
11857
|
+
const extension = suffix ? ".json" : path25.extname(inputPath);
|
|
11714
11858
|
return joinUrl(
|
|
11715
11859
|
this.config.basePath,
|
|
11716
11860
|
apiPath,
|
|
@@ -11733,7 +11877,7 @@ var SchemaManager = class {
|
|
|
11733
11877
|
// src/vite/plugin-config-reload.ts
|
|
11734
11878
|
init_logger();
|
|
11735
11879
|
init_loader();
|
|
11736
|
-
import
|
|
11880
|
+
import path28 from "node:path";
|
|
11737
11881
|
import colors7 from "picocolors";
|
|
11738
11882
|
|
|
11739
11883
|
// src/vite/plugin-navigation.ts
|
|
@@ -11743,27 +11887,11 @@ import { stringify as stringify3 } from "javascript-stringify";
|
|
|
11743
11887
|
import { isElement } from "react-is";
|
|
11744
11888
|
|
|
11745
11889
|
// src/config/validators/NavigationSchema.ts
|
|
11746
|
-
import
|
|
11747
|
-
import { glob as
|
|
11890
|
+
import path26 from "node:path";
|
|
11891
|
+
import { glob as glob4 } from "glob";
|
|
11748
11892
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
11749
11893
|
import { mdxFromMarkdown } from "mdast-util-mdx";
|
|
11750
11894
|
import { mdxjs } from "micromark-extension-mdxjs";
|
|
11751
|
-
|
|
11752
|
-
// src/lib/util/readFrontmatter.ts
|
|
11753
|
-
import { readFile as readFile8 } from "node:fs/promises";
|
|
11754
|
-
import matter from "gray-matter";
|
|
11755
|
-
import { parse as parse2, stringify as stringify2 } from "yaml";
|
|
11756
|
-
var yaml = {
|
|
11757
|
-
parse: (input5) => parse2(input5) ?? {},
|
|
11758
|
-
stringify: (obj) => stringify2(obj)
|
|
11759
|
-
};
|
|
11760
|
-
var readFrontmatter = async (filePath) => {
|
|
11761
|
-
const content = await readFile8(filePath, "utf-8");
|
|
11762
|
-
const normalizedContent = content.replace(/\r\n/g, "\n");
|
|
11763
|
-
return matter(normalizedContent, { engines: { yaml } });
|
|
11764
|
-
};
|
|
11765
|
-
|
|
11766
|
-
// src/config/validators/NavigationSchema.ts
|
|
11767
11895
|
init_ZudokuConfig();
|
|
11768
11896
|
var extractTitleFromContent = (content) => content.match(/^\s*#\s(.*)$/m)?.at(1);
|
|
11769
11897
|
var isMdxJsxElement = (node) => node.type === "mdxJsxTextElement";
|
|
@@ -11794,7 +11922,7 @@ var extractRichH1 = (content) => {
|
|
|
11794
11922
|
}
|
|
11795
11923
|
};
|
|
11796
11924
|
var isNavigationItem = (item) => item !== void 0;
|
|
11797
|
-
var toPosixPath = (filePath) => filePath.split(
|
|
11925
|
+
var toPosixPath = (filePath) => filePath.split(path26.win32.sep).join(path26.posix.sep);
|
|
11798
11926
|
var NavigationResolver = class {
|
|
11799
11927
|
rootDir;
|
|
11800
11928
|
globPatterns;
|
|
@@ -11808,7 +11936,7 @@ var NavigationResolver = class {
|
|
|
11808
11936
|
}
|
|
11809
11937
|
async initialize() {
|
|
11810
11938
|
if (this.globFiles.length > 0) return;
|
|
11811
|
-
this.globFiles = await
|
|
11939
|
+
this.globFiles = await glob4(this.globPatterns, {
|
|
11812
11940
|
root: this.rootDir,
|
|
11813
11941
|
ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**"]
|
|
11814
11942
|
}).then((files) => files.map(toPosixPath));
|
|
@@ -11927,13 +12055,13 @@ init_invariant();
|
|
|
11927
12055
|
|
|
11928
12056
|
// src/vite/debug.ts
|
|
11929
12057
|
import { mkdir as mkdir7, writeFile as writeFile8 } from "node:fs/promises";
|
|
11930
|
-
import
|
|
12058
|
+
import path27 from "node:path";
|
|
11931
12059
|
async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
|
|
11932
12060
|
if (process.env.ZUDOKU_BUILD_DEBUG) {
|
|
11933
|
-
const debugDir =
|
|
12061
|
+
const debugDir = path27.join(rootDir, "dist", "debug");
|
|
11934
12062
|
await mkdir7(debugDir, { recursive: true });
|
|
11935
12063
|
await writeFile8(
|
|
11936
|
-
|
|
12064
|
+
path27.join(debugDir, `${pluginName}.${extension}`),
|
|
11937
12065
|
typeof code === "string" ? code : code.join("\n")
|
|
11938
12066
|
);
|
|
11939
12067
|
}
|
|
@@ -12042,7 +12170,7 @@ var viteConfigReloadPlugin = () => ({
|
|
|
12042
12170
|
reload(server);
|
|
12043
12171
|
logger.info(
|
|
12044
12172
|
colors7.blue(
|
|
12045
|
-
`Config ${
|
|
12173
|
+
`Config ${path28.basename(currentConfig.__meta.configPath)} changed. Reloading...`
|
|
12046
12174
|
),
|
|
12047
12175
|
{ timestamp: true }
|
|
12048
12176
|
);
|
|
@@ -12056,11 +12184,11 @@ var viteApiPlugin = async () => {
|
|
|
12056
12184
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
12057
12185
|
const initialConfig = getCurrentConfig();
|
|
12058
12186
|
const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
|
|
12059
|
-
|
|
12187
|
+
path29.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
|
|
12060
12188
|
).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
|
|
12061
12189
|
const buildConfig = await getBuildConfig();
|
|
12062
12190
|
const buildProcessors = buildConfig?.processors ?? [];
|
|
12063
|
-
const tmpStoreDir =
|
|
12191
|
+
const tmpStoreDir = path29.posix.join(
|
|
12064
12192
|
initialConfig.__meta.rootDir,
|
|
12065
12193
|
"node_modules/.apitogo/processed"
|
|
12066
12194
|
);
|
|
@@ -12092,7 +12220,7 @@ var viteApiPlugin = async () => {
|
|
|
12092
12220
|
const inputPath = pathMap.get(req.url);
|
|
12093
12221
|
if (!inputPath) return next();
|
|
12094
12222
|
const content = await fs4.readFile(inputPath, "utf-8");
|
|
12095
|
-
const mimeType =
|
|
12223
|
+
const mimeType = path29.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
|
|
12096
12224
|
res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
|
|
12097
12225
|
return res.end(content);
|
|
12098
12226
|
});
|
|
@@ -12280,8 +12408,8 @@ var viteApiPlugin = async () => {
|
|
|
12280
12408
|
if (process.env.NODE_ENV !== "production") return;
|
|
12281
12409
|
for (const [urlPath, inputPath] of pathMap) {
|
|
12282
12410
|
const content = await fs4.readFile(inputPath, "utf-8");
|
|
12283
|
-
const outputPath =
|
|
12284
|
-
await fs4.mkdir(
|
|
12411
|
+
const outputPath = path29.join(config2.__meta.rootDir, "dist", urlPath);
|
|
12412
|
+
await fs4.mkdir(path29.dirname(outputPath), { recursive: true });
|
|
12285
12413
|
await fs4.writeFile(outputPath, content, "utf-8");
|
|
12286
12414
|
}
|
|
12287
12415
|
}
|
|
@@ -12324,7 +12452,7 @@ var plugin_auth_default = viteAuthPlugin;
|
|
|
12324
12452
|
|
|
12325
12453
|
// src/vite/plugin-component.ts
|
|
12326
12454
|
init_loader();
|
|
12327
|
-
import
|
|
12455
|
+
import path30 from "node:path";
|
|
12328
12456
|
var viteAliasPlugin = () => {
|
|
12329
12457
|
return {
|
|
12330
12458
|
name: "zudoku-component-plugin",
|
|
@@ -12352,7 +12480,7 @@ var viteAliasPlugin = () => {
|
|
|
12352
12480
|
];
|
|
12353
12481
|
const aliases = replacements.map(([find, replacement]) => ({
|
|
12354
12482
|
find,
|
|
12355
|
-
replacement:
|
|
12483
|
+
replacement: path30.posix.join(config2.__meta.moduleDir, replacement)
|
|
12356
12484
|
}));
|
|
12357
12485
|
return config2.__meta.mode === "internal" || config2.__meta.mode === "standalone" ? { resolve: { alias: aliases } } : void 0;
|
|
12358
12486
|
}
|
|
@@ -12363,11 +12491,11 @@ var plugin_component_default = viteAliasPlugin;
|
|
|
12363
12491
|
// src/vite/plugin-config.ts
|
|
12364
12492
|
init_package_json();
|
|
12365
12493
|
init_loader();
|
|
12366
|
-
import
|
|
12494
|
+
import path31 from "node:path";
|
|
12367
12495
|
import { normalizePath } from "vite";
|
|
12368
12496
|
var virtualModuleId3 = "virtual:zudoku-config";
|
|
12369
12497
|
var resolvedVirtualModuleId3 = `\0${virtualModuleId3}`;
|
|
12370
|
-
var browserConfigLoaderPath =
|
|
12498
|
+
var browserConfigLoaderPath = path31.join(
|
|
12371
12499
|
getZudokuRootDir(),
|
|
12372
12500
|
"src/config/apitogo-config-loader.browser.ts"
|
|
12373
12501
|
);
|
|
@@ -12501,7 +12629,7 @@ var plugin_custom_pages_default = viteCustomPagesPlugin;
|
|
|
12501
12629
|
|
|
12502
12630
|
// src/vite/plugin-doc-metadata.ts
|
|
12503
12631
|
init_loader();
|
|
12504
|
-
import { glob as
|
|
12632
|
+
import { glob as glob5 } from "glob";
|
|
12505
12633
|
var serializeMetadata = async (filePath) => {
|
|
12506
12634
|
const fm = await readFrontmatter(filePath);
|
|
12507
12635
|
const h1 = fm.content.match(/^#\s+(.*)$/m)?.[1];
|
|
@@ -12512,7 +12640,7 @@ var viteDocMetadataPlugin = () => ({
|
|
|
12512
12640
|
name: "zudoku-doc-metadata-plugin",
|
|
12513
12641
|
configureServer: async (server) => {
|
|
12514
12642
|
const config2 = getCurrentConfig();
|
|
12515
|
-
const files = await
|
|
12643
|
+
const files = await glob5("**/*.{md,mdx}", {
|
|
12516
12644
|
cwd: config2.__meta.rootDir,
|
|
12517
12645
|
ignore: ["node_modules", "dist"],
|
|
12518
12646
|
absolute: true
|
|
@@ -12538,9 +12666,9 @@ var viteDocMetadataPlugin = () => ({
|
|
|
12538
12666
|
|
|
12539
12667
|
// src/vite/plugin-docs.ts
|
|
12540
12668
|
init_loader();
|
|
12541
|
-
import
|
|
12542
|
-
import { glob as
|
|
12543
|
-
import
|
|
12669
|
+
import path32 from "node:path";
|
|
12670
|
+
import { glob as glob6 } from "glob";
|
|
12671
|
+
import globParent2 from "glob-parent";
|
|
12544
12672
|
init_ZudokuConfig();
|
|
12545
12673
|
|
|
12546
12674
|
// src/lib/components/navigation/utils.ts
|
|
@@ -12595,19 +12723,19 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
12595
12723
|
const docsConfig = DocsConfigSchema.parse(config2.docs ?? {});
|
|
12596
12724
|
const fileMapping = {};
|
|
12597
12725
|
for (const globPattern of docsConfig.files) {
|
|
12598
|
-
const globbedFiles = await
|
|
12726
|
+
const globbedFiles = await glob6(globPattern, {
|
|
12599
12727
|
root: config2.__meta.rootDir,
|
|
12600
12728
|
ignore: ["**/node_modules/**", "**/dist/**", "**/.git/**"],
|
|
12601
12729
|
// Always glob with relative paths to avoid issues on different OS
|
|
12602
12730
|
absolute: false,
|
|
12603
12731
|
posix: true
|
|
12604
12732
|
});
|
|
12605
|
-
const parent =
|
|
12733
|
+
const parent = globParent2(globPattern).replace(/^\.?\//, "");
|
|
12606
12734
|
let draftFiles = /* @__PURE__ */ new Set();
|
|
12607
12735
|
if (process.env.NODE_ENV !== "development") {
|
|
12608
12736
|
const draftStatuses = await Promise.all(
|
|
12609
12737
|
globbedFiles.map(async (file) => {
|
|
12610
|
-
const absolutePath =
|
|
12738
|
+
const absolutePath = path32.resolve(config2.__meta.rootDir, file);
|
|
12611
12739
|
const { data } = await readFrontmatter(absolutePath);
|
|
12612
12740
|
return { file, isDraft: data.draft === true };
|
|
12613
12741
|
})
|
|
@@ -12620,9 +12748,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
12620
12748
|
if (draftFiles.has(file)) {
|
|
12621
12749
|
continue;
|
|
12622
12750
|
}
|
|
12623
|
-
const relativePath =
|
|
12751
|
+
const relativePath = path32.posix.relative(parent, file);
|
|
12624
12752
|
const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
|
|
12625
|
-
const filePath = options.absolute ?
|
|
12753
|
+
const filePath = options.absolute ? path32.resolve(config2.__meta.rootDir, file) : file;
|
|
12626
12754
|
fileMapping[routePath] = filePath;
|
|
12627
12755
|
}
|
|
12628
12756
|
}
|
|
@@ -12686,7 +12814,7 @@ var viteDocsPlugin = () => {
|
|
|
12686
12814
|
const globbedDocuments = {};
|
|
12687
12815
|
for (const [routePath, file] of Object.entries(fileMapping)) {
|
|
12688
12816
|
const importPath = ensureLeadingSlash(
|
|
12689
|
-
|
|
12817
|
+
path32.posix.join(globImportBasePath, file)
|
|
12690
12818
|
);
|
|
12691
12819
|
globbedDocuments[routePath] = importPath;
|
|
12692
12820
|
}
|
|
@@ -12712,7 +12840,7 @@ var plugin_docs_default = viteDocsPlugin;
|
|
|
12712
12840
|
// src/vite/plugin-local-manifest.ts
|
|
12713
12841
|
init_apitogo_config_loader();
|
|
12714
12842
|
init_local_manifest();
|
|
12715
|
-
import
|
|
12843
|
+
import path33 from "node:path";
|
|
12716
12844
|
var APITOGO_LOCAL_MANIFEST_VIRTUAL_ID = "virtual:apitogo-local-manifest";
|
|
12717
12845
|
var resolvedVirtualModuleId4 = `\0${APITOGO_LOCAL_MANIFEST_VIRTUAL_ID}`;
|
|
12718
12846
|
var viteLocalManifestPlugin = () => {
|
|
@@ -12762,8 +12890,8 @@ var viteLocalManifestPlugin = () => {
|
|
|
12762
12890
|
server.watcher.add(watchPath);
|
|
12763
12891
|
}
|
|
12764
12892
|
server.watcher.on("change", async (changedPath) => {
|
|
12765
|
-
const resolvedChanged =
|
|
12766
|
-
if (!watchPaths.some((p) =>
|
|
12893
|
+
const resolvedChanged = path33.resolve(changedPath);
|
|
12894
|
+
if (!watchPaths.some((p) => path33.resolve(p) === resolvedChanged)) {
|
|
12767
12895
|
return;
|
|
12768
12896
|
}
|
|
12769
12897
|
const module = server.moduleGraph.getModuleById(
|
|
@@ -12790,7 +12918,7 @@ init_loader();
|
|
|
12790
12918
|
init_ProtectedRoutesSchema();
|
|
12791
12919
|
init_joinUrl();
|
|
12792
12920
|
import { mkdir as mkdir8, writeFile as writeFile9 } from "node:fs/promises";
|
|
12793
|
-
import
|
|
12921
|
+
import path34 from "node:path";
|
|
12794
12922
|
import { matchPath } from "react-router";
|
|
12795
12923
|
var processMarkdownFile = async (filePath) => {
|
|
12796
12924
|
const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
|
|
@@ -12878,7 +13006,7 @@ var viteMarkdownExportPlugin = () => {
|
|
|
12878
13006
|
if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
|
|
12879
13007
|
return;
|
|
12880
13008
|
}
|
|
12881
|
-
const distDir =
|
|
13009
|
+
const distDir = path34.join(
|
|
12882
13010
|
config2.__meta.rootDir,
|
|
12883
13011
|
"dist",
|
|
12884
13012
|
config2.basePath ?? ""
|
|
@@ -12899,15 +13027,15 @@ var viteMarkdownExportPlugin = () => {
|
|
|
12899
13027
|
content: finalMarkdown
|
|
12900
13028
|
});
|
|
12901
13029
|
const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
|
|
12902
|
-
const outputPath = `${
|
|
12903
|
-
await mkdir8(
|
|
13030
|
+
const outputPath = `${path34.join(distDir, ...segments)}.md`;
|
|
13031
|
+
await mkdir8(path34.dirname(outputPath), { recursive: true });
|
|
12904
13032
|
await writeFile9(outputPath, finalMarkdown, "utf-8");
|
|
12905
13033
|
} catch (error) {
|
|
12906
13034
|
console.warn(`Failed to export markdown for ${routePath}:`, error);
|
|
12907
13035
|
}
|
|
12908
13036
|
}
|
|
12909
13037
|
if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
|
|
12910
|
-
const markdownInfoPath =
|
|
13038
|
+
const markdownInfoPath = path34.join(
|
|
12911
13039
|
config2.__meta.rootDir,
|
|
12912
13040
|
"node_modules/.apitogo/markdown-info.json"
|
|
12913
13041
|
);
|
|
@@ -13059,9 +13187,9 @@ var remarkCodeTabs = () => (tree) => {
|
|
|
13059
13187
|
};
|
|
13060
13188
|
|
|
13061
13189
|
// src/vite/mdx/remark-inject-filepath.ts
|
|
13062
|
-
import
|
|
13190
|
+
import path35 from "node:path";
|
|
13063
13191
|
var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
|
|
13064
|
-
const relativePath =
|
|
13192
|
+
const relativePath = path35.relative(rootDir, vfile.path).split(path35.sep).join(path35.posix.sep);
|
|
13065
13193
|
tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
|
|
13066
13194
|
};
|
|
13067
13195
|
|
|
@@ -13148,18 +13276,18 @@ var remarkLastModified = () => {
|
|
|
13148
13276
|
};
|
|
13149
13277
|
|
|
13150
13278
|
// src/vite/mdx/remark-link-rewrite.ts
|
|
13151
|
-
import
|
|
13279
|
+
import path36 from "node:path";
|
|
13152
13280
|
import { visit as visit5 } from "unist-util-visit";
|
|
13153
13281
|
var remarkLinkRewrite = (basePath = "") => (tree) => {
|
|
13154
13282
|
visit5(tree, "link", (node) => {
|
|
13155
13283
|
if (!node.url) return;
|
|
13156
13284
|
if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
|
|
13157
13285
|
node.url = node.url.replace(/\\/g, "/");
|
|
13158
|
-
const base =
|
|
13286
|
+
const base = path36.posix.join(basePath);
|
|
13159
13287
|
if (basePath && node.url.startsWith(base)) {
|
|
13160
13288
|
node.url = node.url.slice(base.length);
|
|
13161
13289
|
} else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
|
|
13162
|
-
node.url =
|
|
13290
|
+
node.url = path36.posix.join("..", node.url);
|
|
13163
13291
|
}
|
|
13164
13292
|
node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
|
|
13165
13293
|
});
|
|
@@ -13379,14 +13507,14 @@ var plugin_mdx_default = viteMdxPlugin;
|
|
|
13379
13507
|
|
|
13380
13508
|
// src/vite/plugin-modules.ts
|
|
13381
13509
|
init_loader();
|
|
13382
|
-
import
|
|
13510
|
+
import path37 from "node:path";
|
|
13383
13511
|
import { normalizePath as normalizePath2 } from "vite";
|
|
13384
|
-
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
13385
|
-
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
13512
|
+
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path37.join(moduleDir, "../module-landing/src/index.tsx")) : "@lukoweb/apitogo-module-landing";
|
|
13513
|
+
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path37.join(moduleDir, "../module-user-panel/src/index.tsx")) : "@lukoweb/apitogo-module-user-panel";
|
|
13386
13514
|
var getBillingPluginImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
13387
|
-
|
|
13515
|
+
path37.join(moduleDir, "../plugin-dev-portal-billing/src/index.ts")
|
|
13388
13516
|
) : "@lukoweb/apitogo-plugin-dev-portal-billing";
|
|
13389
|
-
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(
|
|
13517
|
+
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(path37.resolve(rootDir, pagePath));
|
|
13390
13518
|
var viteModulesPlugin = () => {
|
|
13391
13519
|
const virtualModuleId4 = "virtual:zudoku-modules-plugin";
|
|
13392
13520
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
@@ -13526,20 +13654,20 @@ var plugin_modules_default = viteModulesPlugin;
|
|
|
13526
13654
|
|
|
13527
13655
|
// src/vite/plugin-offroot-resolve.ts
|
|
13528
13656
|
init_loader();
|
|
13529
|
-
import
|
|
13657
|
+
import path38 from "node:path";
|
|
13530
13658
|
function stripQuery(id) {
|
|
13531
13659
|
const query = id.indexOf("?");
|
|
13532
13660
|
return query === -1 ? id : id.slice(0, query);
|
|
13533
13661
|
}
|
|
13534
13662
|
function isInside(parent, child) {
|
|
13535
|
-
const relative =
|
|
13536
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
13663
|
+
const relative = path38.relative(path38.resolve(parent), path38.resolve(child));
|
|
13664
|
+
return relative === "" || !relative.startsWith("..") && !path38.isAbsolute(relative);
|
|
13537
13665
|
}
|
|
13538
13666
|
function isBareSpecifier(source) {
|
|
13539
|
-
return !source.startsWith("\0") && !source.startsWith(".") && !source.startsWith("/") && !
|
|
13667
|
+
return !source.startsWith("\0") && !source.startsWith(".") && !source.startsWith("/") && !path38.isAbsolute(source);
|
|
13540
13668
|
}
|
|
13541
13669
|
function isInsideNodeModules(filePath) {
|
|
13542
|
-
return filePath.split(
|
|
13670
|
+
return filePath.split(path38.sep).includes("node_modules");
|
|
13543
13671
|
}
|
|
13544
13672
|
function shouldResolveFromSiteRoot(source, importer, rootDir) {
|
|
13545
13673
|
if (!importer || !isBareSpecifier(source)) {
|
|
@@ -13560,7 +13688,7 @@ function viteOffrootResolvePlugin() {
|
|
|
13560
13688
|
if (!shouldResolveFromSiteRoot(source, importer, rootDir)) {
|
|
13561
13689
|
return;
|
|
13562
13690
|
}
|
|
13563
|
-
return this.resolve(source,
|
|
13691
|
+
return this.resolve(source, path38.join(rootDir, "package.json"), {
|
|
13564
13692
|
...options,
|
|
13565
13693
|
skipSelf: true
|
|
13566
13694
|
});
|
|
@@ -13570,7 +13698,7 @@ function viteOffrootResolvePlugin() {
|
|
|
13570
13698
|
|
|
13571
13699
|
// src/vite/plugin-search.ts
|
|
13572
13700
|
init_loader();
|
|
13573
|
-
import
|
|
13701
|
+
import path39 from "node:path";
|
|
13574
13702
|
var viteSearchPlugin = () => {
|
|
13575
13703
|
const virtualModuleId4 = "virtual:zudoku-search-plugin";
|
|
13576
13704
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
@@ -13588,7 +13716,7 @@ var viteSearchPlugin = () => {
|
|
|
13588
13716
|
return resolvedVirtualModuleId5;
|
|
13589
13717
|
}
|
|
13590
13718
|
if (id === "/pagefind/pagefind.js" && resolvedViteConfig?.publicDir) {
|
|
13591
|
-
return
|
|
13719
|
+
return path39.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
|
|
13592
13720
|
}
|
|
13593
13721
|
},
|
|
13594
13722
|
async load(id) {
|
|
@@ -13731,10 +13859,10 @@ function vitePlugin() {
|
|
|
13731
13859
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
13732
13860
|
if (merged.publicDir === false) return void 0;
|
|
13733
13861
|
const rel2 = typeof merged.publicDir === "string" ? merged.publicDir : "public";
|
|
13734
|
-
return
|
|
13862
|
+
return path40.resolve(rootDir, rel2);
|
|
13735
13863
|
};
|
|
13736
|
-
var getAppClientEntryPath = () =>
|
|
13737
|
-
var getAppServerEntryPath = () =>
|
|
13864
|
+
var getAppClientEntryPath = () => path40.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
|
|
13865
|
+
var getAppServerEntryPath = () => path40.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
13738
13866
|
var hasLoggedCdnInfo = false;
|
|
13739
13867
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
13740
13868
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
@@ -13764,7 +13892,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13764
13892
|
);
|
|
13765
13893
|
if (ZuploEnv.isZuplo) {
|
|
13766
13894
|
dotenv.config({
|
|
13767
|
-
path:
|
|
13895
|
+
path: path40.resolve(config2.__meta.rootDir, "../.env.zuplo"),
|
|
13768
13896
|
quiet: true
|
|
13769
13897
|
});
|
|
13770
13898
|
}
|
|
@@ -13810,7 +13938,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13810
13938
|
middlewareMode: true,
|
|
13811
13939
|
open: true,
|
|
13812
13940
|
fs: {
|
|
13813
|
-
allow: [dir,
|
|
13941
|
+
allow: [dir, path40.dirname(dir)]
|
|
13814
13942
|
},
|
|
13815
13943
|
watch: {
|
|
13816
13944
|
ignored: [
|
|
@@ -13826,8 +13954,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13826
13954
|
ssr: configEnv.isSsrBuild,
|
|
13827
13955
|
sourcemap: true,
|
|
13828
13956
|
target: "es2022",
|
|
13829
|
-
outDir:
|
|
13830
|
-
|
|
13957
|
+
outDir: path40.resolve(
|
|
13958
|
+
path40.join(
|
|
13831
13959
|
dir,
|
|
13832
13960
|
"dist",
|
|
13833
13961
|
config2.basePath ?? "",
|
|
@@ -13846,7 +13974,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13846
13974
|
},
|
|
13847
13975
|
experimental: {
|
|
13848
13976
|
renderBuiltUrl(filename) {
|
|
13849
|
-
if (cdnUrl?.base && [".js", ".css"].includes(
|
|
13977
|
+
if (cdnUrl?.base && [".js", ".css"].includes(path40.extname(filename))) {
|
|
13850
13978
|
return joinUrl(cdnUrl.base, filename);
|
|
13851
13979
|
}
|
|
13852
13980
|
if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
|
|
@@ -13859,7 +13987,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13859
13987
|
esbuildOptions: {
|
|
13860
13988
|
target: "es2022"
|
|
13861
13989
|
},
|
|
13862
|
-
entries: [
|
|
13990
|
+
entries: [path40.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
|
|
13863
13991
|
exclude: [
|
|
13864
13992
|
"@lukoweb/apitogo",
|
|
13865
13993
|
"@lukoweb/apitogo-plugin-dev-portal-billing"
|
|
@@ -13963,7 +14091,7 @@ init_package_json();
|
|
|
13963
14091
|
init_joinUrl();
|
|
13964
14092
|
import assert from "node:assert";
|
|
13965
14093
|
import { cp, mkdir as mkdir9, writeFile as writeFile10 } from "node:fs/promises";
|
|
13966
|
-
import
|
|
14094
|
+
import path41 from "node:path";
|
|
13967
14095
|
var pkgJson = getZudokuPackageJson();
|
|
13968
14096
|
function generateOutput({
|
|
13969
14097
|
config: config2,
|
|
@@ -14020,9 +14148,9 @@ async function writeOutput(dir, {
|
|
|
14020
14148
|
rewrites
|
|
14021
14149
|
}) {
|
|
14022
14150
|
const output4 = generateOutput({ config: config2, redirects, rewrites });
|
|
14023
|
-
const outputDir = process.env.VERCEL ?
|
|
14151
|
+
const outputDir = process.env.VERCEL ? path41.join(dir, ".vercel/output") : path41.join(dir, "dist/.output");
|
|
14024
14152
|
await mkdir9(outputDir, { recursive: true });
|
|
14025
|
-
const outputFile =
|
|
14153
|
+
const outputFile = path41.join(outputDir, "config.json");
|
|
14026
14154
|
await writeFile10(outputFile, JSON.stringify(output4, null, 2), "utf-8");
|
|
14027
14155
|
if (process.env.VERCEL) {
|
|
14028
14156
|
console.log("Wrote Vercel output to", outputDir);
|
|
@@ -14034,7 +14162,7 @@ init_logger();
|
|
|
14034
14162
|
init_file_exists();
|
|
14035
14163
|
import { readFile as readFile9, rm as rm6 } from "node:fs/promises";
|
|
14036
14164
|
import os from "node:os";
|
|
14037
|
-
import
|
|
14165
|
+
import path44 from "node:path";
|
|
14038
14166
|
import { pathToFileURL } from "node:url";
|
|
14039
14167
|
import { createIndex } from "pagefind";
|
|
14040
14168
|
import colors11 from "picocolors";
|
|
@@ -14076,7 +14204,7 @@ function throttle(fn) {
|
|
|
14076
14204
|
init_joinUrl();
|
|
14077
14205
|
import { createWriteStream, existsSync as existsSync4 } from "node:fs";
|
|
14078
14206
|
import { mkdir as mkdir10 } from "node:fs/promises";
|
|
14079
|
-
import
|
|
14207
|
+
import path42 from "node:path";
|
|
14080
14208
|
import colors9 from "picocolors";
|
|
14081
14209
|
import { SitemapStream } from "sitemap";
|
|
14082
14210
|
async function generateSitemap({
|
|
@@ -14090,11 +14218,11 @@ async function generateSitemap({
|
|
|
14090
14218
|
return;
|
|
14091
14219
|
}
|
|
14092
14220
|
const sitemap = new SitemapStream({ hostname: config2.siteUrl });
|
|
14093
|
-
const outputDir =
|
|
14221
|
+
const outputDir = path42.resolve(baseOutputDir, config2.outDir ?? "");
|
|
14094
14222
|
if (!existsSync4(outputDir)) {
|
|
14095
14223
|
await mkdir10(outputDir, { recursive: true });
|
|
14096
14224
|
}
|
|
14097
|
-
const sitemapOutputPath =
|
|
14225
|
+
const sitemapOutputPath = path42.join(outputDir, "sitemap.xml");
|
|
14098
14226
|
const writeStream = createWriteStream(sitemapOutputPath);
|
|
14099
14227
|
sitemap.pipe(writeStream);
|
|
14100
14228
|
let lastmod;
|
|
@@ -14124,14 +14252,14 @@ async function generateSitemap({
|
|
|
14124
14252
|
|
|
14125
14253
|
// src/vite/prerender/utils.ts
|
|
14126
14254
|
init_joinUrl();
|
|
14127
|
-
var resolveRoutePath = (
|
|
14128
|
-
const segments =
|
|
14255
|
+
var resolveRoutePath = (path101) => {
|
|
14256
|
+
const segments = path101.split("/");
|
|
14129
14257
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
14130
14258
|
return void 0;
|
|
14131
14259
|
}
|
|
14132
14260
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
14133
14261
|
};
|
|
14134
|
-
var isSkipped = (
|
|
14262
|
+
var isSkipped = (path101) => path101.includes("*") || /^\d+$/.test(path101);
|
|
14135
14263
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
14136
14264
|
if (route.path && isSkipped(route.path)) return [];
|
|
14137
14265
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -14180,12 +14308,12 @@ var prerender = async ({
|
|
|
14180
14308
|
serverConfigFilename,
|
|
14181
14309
|
writeRedirects = true
|
|
14182
14310
|
}) => {
|
|
14183
|
-
const distDir =
|
|
14311
|
+
const distDir = path44.join(dir, "dist", basePath);
|
|
14184
14312
|
const serverConfigPath = pathToFileURL(
|
|
14185
|
-
|
|
14313
|
+
path44.join(distDir, "server", serverConfigFilename)
|
|
14186
14314
|
).href;
|
|
14187
14315
|
const entryServerPath = pathToFileURL(
|
|
14188
|
-
|
|
14316
|
+
path44.join(distDir, "server/entry.server.js")
|
|
14189
14317
|
).href;
|
|
14190
14318
|
const rawConfig = await import(serverConfigPath).then(
|
|
14191
14319
|
(m) => m.default
|
|
@@ -14270,7 +14398,7 @@ var prerender = async ({
|
|
|
14270
14398
|
})
|
|
14271
14399
|
);
|
|
14272
14400
|
const pagefindWriteResult = await pagefindIndex?.writeFiles({
|
|
14273
|
-
outputPath:
|
|
14401
|
+
outputPath: path44.join(distDir, "pagefind")
|
|
14274
14402
|
});
|
|
14275
14403
|
const seconds = ((performance.now() - start) / 1e3).toFixed(1);
|
|
14276
14404
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
@@ -14302,7 +14430,7 @@ var prerender = async ({
|
|
|
14302
14430
|
const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
|
|
14303
14431
|
const docsConfig = DocsConfigSchema2.parse(config2.docs);
|
|
14304
14432
|
const llmsConfig = docsConfig.llms ?? {};
|
|
14305
|
-
const markdownInfoPath =
|
|
14433
|
+
const markdownInfoPath = path44.join(
|
|
14306
14434
|
dir,
|
|
14307
14435
|
"node_modules/.apitogo/markdown-info.json"
|
|
14308
14436
|
);
|
|
@@ -14393,7 +14521,7 @@ async function runBuild(options) {
|
|
|
14393
14521
|
html,
|
|
14394
14522
|
basePath: config2.basePath
|
|
14395
14523
|
});
|
|
14396
|
-
await rm7(
|
|
14524
|
+
await rm7(path45.join(clientOutDir, "index.html"), { force: true });
|
|
14397
14525
|
} else {
|
|
14398
14526
|
await runPrerender({
|
|
14399
14527
|
dir,
|
|
@@ -14417,7 +14545,7 @@ var runPrerender = async (options) => {
|
|
|
14417
14545
|
serverConfigFilename,
|
|
14418
14546
|
writeRedirects: process.env.VERCEL === void 0
|
|
14419
14547
|
});
|
|
14420
|
-
const indexHtml =
|
|
14548
|
+
const indexHtml = path45.join(clientOutDir, "index.html");
|
|
14421
14549
|
if (!workerResults.find((r) => r.outputPath === indexHtml)) {
|
|
14422
14550
|
await writeFile12(indexHtml, html, "utf-8");
|
|
14423
14551
|
}
|
|
@@ -14427,15 +14555,15 @@ var runPrerender = async (options) => {
|
|
|
14427
14555
|
for (const statusPage of statusPages) {
|
|
14428
14556
|
await rename5(
|
|
14429
14557
|
statusPage,
|
|
14430
|
-
|
|
14558
|
+
path45.join(dir, DIST_DIR, path45.basename(statusPage))
|
|
14431
14559
|
);
|
|
14432
14560
|
}
|
|
14433
14561
|
await rm7(serverOutDir, { recursive: true, force: true });
|
|
14434
14562
|
if (process.env.VERCEL) {
|
|
14435
|
-
await mkdir11(
|
|
14563
|
+
await mkdir11(path45.join(dir, ".vercel/output/static"), { recursive: true });
|
|
14436
14564
|
await rename5(
|
|
14437
|
-
|
|
14438
|
-
|
|
14565
|
+
path45.join(dir, DIST_DIR),
|
|
14566
|
+
path45.join(dir, ".vercel/output/static")
|
|
14439
14567
|
);
|
|
14440
14568
|
}
|
|
14441
14569
|
await writeOutput(dir, {
|
|
@@ -14445,7 +14573,7 @@ var runPrerender = async (options) => {
|
|
|
14445
14573
|
});
|
|
14446
14574
|
if (ZuploEnv.isZuplo && issuer) {
|
|
14447
14575
|
await writeFile12(
|
|
14448
|
-
|
|
14576
|
+
path45.join(dir, DIST_DIR, ".output/zuplo.json"),
|
|
14449
14577
|
JSON.stringify({ issuer }, null, 2),
|
|
14450
14578
|
"utf-8"
|
|
14451
14579
|
);
|
|
@@ -14457,10 +14585,10 @@ var runPrerender = async (options) => {
|
|
|
14457
14585
|
};
|
|
14458
14586
|
var bundleSSREntry = async (options) => {
|
|
14459
14587
|
const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
|
|
14460
|
-
const tempEntryPath =
|
|
14588
|
+
const tempEntryPath = path45.join(dir, "__ssr-entry.ts");
|
|
14461
14589
|
const packageRoot = getZudokuRootDir();
|
|
14462
14590
|
const templateContent = await readFile10(
|
|
14463
|
-
|
|
14591
|
+
path45.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
|
|
14464
14592
|
"utf-8"
|
|
14465
14593
|
);
|
|
14466
14594
|
const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
|
|
@@ -14475,9 +14603,9 @@ var bundleSSREntry = async (options) => {
|
|
|
14475
14603
|
platform: adapter === "node" ? "node" : "neutral",
|
|
14476
14604
|
target: "es2022",
|
|
14477
14605
|
format: "esm",
|
|
14478
|
-
outfile:
|
|
14606
|
+
outfile: path45.join(serverOutDir, "entry.js"),
|
|
14479
14607
|
external: ["./entry.server.js", `./${serverConfigFilename}`],
|
|
14480
|
-
nodePaths: [
|
|
14608
|
+
nodePaths: [path45.join(packageRoot, "node_modules")],
|
|
14481
14609
|
banner: { js: "// Bundled SSR entry" }
|
|
14482
14610
|
});
|
|
14483
14611
|
} finally {
|
|
@@ -14488,7 +14616,7 @@ var bundleSSREntry = async (options) => {
|
|
|
14488
14616
|
// src/cli/portal/v2.ts
|
|
14489
14617
|
init_package_json();
|
|
14490
14618
|
function assertPackagesInstalled(resolved, prepared) {
|
|
14491
|
-
const require2 = createRequire2(
|
|
14619
|
+
const require2 = createRequire2(path46.join(resolved.configDir, "package.json"));
|
|
14492
14620
|
const missing = requiredPackages(prepared.plan).filter((name) => {
|
|
14493
14621
|
try {
|
|
14494
14622
|
require2.resolve(name);
|
|
@@ -14535,7 +14663,7 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
|
|
|
14535
14663
|
return {
|
|
14536
14664
|
name: "build",
|
|
14537
14665
|
hash: () => hash2,
|
|
14538
|
-
stillValid: () => access4(
|
|
14666
|
+
stillValid: () => access4(path46.join(buildDir, "index.html")).then(
|
|
14539
14667
|
() => true,
|
|
14540
14668
|
() => false
|
|
14541
14669
|
),
|
|
@@ -14548,11 +14676,11 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
|
|
|
14548
14676
|
process.chdir(originalCwd);
|
|
14549
14677
|
}
|
|
14550
14678
|
await rm8(buildDir, { recursive: true, force: true });
|
|
14551
|
-
await mkdir12(
|
|
14552
|
-
await rename6(
|
|
14679
|
+
await mkdir12(path46.dirname(buildDir), { recursive: true });
|
|
14680
|
+
await rename6(path46.join(root, "dist"), buildDir);
|
|
14553
14681
|
if (prepared.publishedManifest) {
|
|
14554
14682
|
await writeFile13(
|
|
14555
|
-
|
|
14683
|
+
path46.join(buildDir, MANIFEST_FILE),
|
|
14556
14684
|
`${JSON.stringify(prepared.publishedManifest, null, 2)}
|
|
14557
14685
|
`
|
|
14558
14686
|
);
|
|
@@ -14583,15 +14711,15 @@ async function buildV2(options) {
|
|
|
14583
14711
|
// src/cli/check/gateway-online.ts
|
|
14584
14712
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
14585
14713
|
var SPEC_SEND_LIMIT = 5 * 1024 * 1024 + 64 * 1024;
|
|
14586
|
-
var issue2 = (code,
|
|
14714
|
+
var issue2 = (code, path101, message, hint) => ({ code, path: path101, message, hint });
|
|
14587
14715
|
function capabilityIssues(gateway, answer) {
|
|
14588
14716
|
const can = answer.capabilities;
|
|
14589
14717
|
const plan2 = `your ${answer.tier} plan`;
|
|
14590
14718
|
const found = [];
|
|
14591
|
-
const unsupported = (
|
|
14719
|
+
const unsupported = (path101, what, hint) => found.push(
|
|
14592
14720
|
issue2(
|
|
14593
14721
|
"GATEWAY_CAPABILITY_UNSUPPORTED",
|
|
14594
|
-
|
|
14722
|
+
path101,
|
|
14595
14723
|
`${what} is not available on ${plan2}.`,
|
|
14596
14724
|
hint
|
|
14597
14725
|
)
|
|
@@ -14667,7 +14795,7 @@ async function onlineGatewayRules(gateway, projectId, api, derivedCors = []) {
|
|
|
14667
14795
|
async function isConfigV2(dir) {
|
|
14668
14796
|
try {
|
|
14669
14797
|
return /"version"\s*:\s*2\b/.test(
|
|
14670
|
-
await readFile13(
|
|
14798
|
+
await readFile13(path47.join(dir, APITOGO_CONFIG_FILENAME), "utf8")
|
|
14671
14799
|
);
|
|
14672
14800
|
} catch {
|
|
14673
14801
|
return false;
|
|
@@ -14761,7 +14889,7 @@ async function validatePortalBuild(dir) {
|
|
|
14761
14889
|
}
|
|
14762
14890
|
}
|
|
14763
14891
|
async function runCheckV2(dir, args = {}, deps = {}) {
|
|
14764
|
-
const configPath =
|
|
14892
|
+
const configPath = path47.join(dir, APITOGO_CONFIG_FILENAME);
|
|
14765
14893
|
let report;
|
|
14766
14894
|
let layout;
|
|
14767
14895
|
try {
|
|
@@ -14850,7 +14978,7 @@ async function checkV2(dir, args, deps = platformDependencies(args)) {
|
|
|
14850
14978
|
init_package_json();
|
|
14851
14979
|
|
|
14852
14980
|
// src/cli/init/v2-handler.ts
|
|
14853
|
-
import
|
|
14981
|
+
import path48 from "node:path";
|
|
14854
14982
|
import { createInterface } from "node:readline/promises";
|
|
14855
14983
|
function parseOnlyFlag(value) {
|
|
14856
14984
|
const services = (value ?? "portal").split(",").map((name) => name.trim()).filter(Boolean);
|
|
@@ -14903,9 +15031,9 @@ function describePlan(plan2) {
|
|
|
14903
15031
|
layoutReason: plan2.layoutReason,
|
|
14904
15032
|
docsIncluded: plan2.docsIncluded,
|
|
14905
15033
|
willCreate: plan2.entries.map(
|
|
14906
|
-
(entry) =>
|
|
15034
|
+
(entry) => path48.relative(plan2.dir, entry.path)
|
|
14907
15035
|
),
|
|
14908
|
-
willKeep: plan2.keep.map((target) =>
|
|
15036
|
+
willKeep: plan2.keep.map((target) => path48.relative(plan2.dir, target)),
|
|
14909
15037
|
replacesConfig: plan2.replacesConfig
|
|
14910
15038
|
};
|
|
14911
15039
|
}
|
|
@@ -14913,7 +15041,7 @@ async function initV2(argv) {
|
|
|
14913
15041
|
const json = argv.json === true;
|
|
14914
15042
|
try {
|
|
14915
15043
|
parseOnlyFlag(argv.only);
|
|
14916
|
-
const dir =
|
|
15044
|
+
const dir = path48.resolve(process.cwd(), argv.dir ?? ".");
|
|
14917
15045
|
const options = {
|
|
14918
15046
|
dir,
|
|
14919
15047
|
layout: argv.layout,
|
|
@@ -14970,8 +15098,8 @@ async function initV2(argv) {
|
|
|
14970
15098
|
status: "created",
|
|
14971
15099
|
dir,
|
|
14972
15100
|
...describePlan(plan2),
|
|
14973
|
-
created: result.created.map((p) =>
|
|
14974
|
-
kept: result.kept.map((p) =>
|
|
15101
|
+
created: result.created.map((p) => path48.relative(dir, p)),
|
|
15102
|
+
kept: result.kept.map((p) => path48.relative(dir, p))
|
|
14975
15103
|
},
|
|
14976
15104
|
null,
|
|
14977
15105
|
2
|
|
@@ -14980,7 +15108,7 @@ async function initV2(argv) {
|
|
|
14980
15108
|
return;
|
|
14981
15109
|
}
|
|
14982
15110
|
printResultToConsole(
|
|
14983
|
-
`Created ${
|
|
15111
|
+
`Created ${path48.basename(plan2.configPath)} (config version 2, ${plan2.layout} layout) in ${dir}.`
|
|
14984
15112
|
);
|
|
14985
15113
|
printHintToConsole(
|
|
14986
15114
|
"Config version 2 is a preview: add, remove, check, run, build, plan, status, deploy and secrets read it."
|
|
@@ -15008,7 +15136,7 @@ async function initV2(argv) {
|
|
|
15008
15136
|
// src/cli/services/packages.ts
|
|
15009
15137
|
import { spawn } from "node:child_process";
|
|
15010
15138
|
import { existsSync as existsSync5 } from "node:fs";
|
|
15011
|
-
import
|
|
15139
|
+
import path49 from "node:path";
|
|
15012
15140
|
var USER_PANEL_PACKAGE = "@lukoweb/apitogo-module-user-panel";
|
|
15013
15141
|
var BILLING_PLUGIN_PACKAGE = "@lukoweb/apitogo-plugin-dev-portal-billing";
|
|
15014
15142
|
function packagesForConfig(config2) {
|
|
@@ -15023,18 +15151,18 @@ function packagesForConfig(config2) {
|
|
|
15023
15151
|
];
|
|
15024
15152
|
}
|
|
15025
15153
|
function isInstalled(dir, name) {
|
|
15026
|
-
for (let current =
|
|
15027
|
-
if (existsSync5(
|
|
15154
|
+
for (let current = path49.resolve(dir); ; current = path49.dirname(current)) {
|
|
15155
|
+
if (existsSync5(path49.join(current, "node_modules", name, "package.json")))
|
|
15028
15156
|
return true;
|
|
15029
|
-
if (
|
|
15157
|
+
if (path49.dirname(current) === current) return false;
|
|
15030
15158
|
}
|
|
15031
15159
|
}
|
|
15032
15160
|
function missingPackages(dir, names) {
|
|
15033
15161
|
return names.filter((name) => !isInstalled(dir, name));
|
|
15034
15162
|
}
|
|
15035
15163
|
function detectPackageManager(dir) {
|
|
15036
|
-
if (existsSync5(
|
|
15037
|
-
if (existsSync5(
|
|
15164
|
+
if (existsSync5(path49.join(dir, "pnpm-lock.yaml"))) return "pnpm";
|
|
15165
|
+
if (existsSync5(path49.join(dir, "yarn.lock"))) return "yarn";
|
|
15038
15166
|
return "npm";
|
|
15039
15167
|
}
|
|
15040
15168
|
function installCommand(manager, names, version) {
|
|
@@ -15069,7 +15197,7 @@ async function installMissingPackages(dir, config2, version, options) {
|
|
|
15069
15197
|
reason: "--no-install was given",
|
|
15070
15198
|
command: shown
|
|
15071
15199
|
};
|
|
15072
|
-
if (!existsSync5(
|
|
15200
|
+
if (!existsSync5(path49.join(dir, "package.json")))
|
|
15073
15201
|
return {
|
|
15074
15202
|
status: "skipped",
|
|
15075
15203
|
packages: missing,
|
|
@@ -15088,7 +15216,7 @@ var list = (value) => {
|
|
|
15088
15216
|
return items.length > 0 ? items : void 0;
|
|
15089
15217
|
};
|
|
15090
15218
|
function addOptionsFromArguments(service, argv) {
|
|
15091
|
-
const dir =
|
|
15219
|
+
const dir = path50.resolve(process.cwd(), argv.dir ?? ".");
|
|
15092
15220
|
const issuers = list(argv.issuer);
|
|
15093
15221
|
return {
|
|
15094
15222
|
dir,
|
|
@@ -15147,8 +15275,8 @@ function describe(edit, dir) {
|
|
|
15147
15275
|
return {
|
|
15148
15276
|
service: edit.service,
|
|
15149
15277
|
action: edit.action,
|
|
15150
|
-
willCreate: edit.files.map((file) =>
|
|
15151
|
-
keep: edit.keep.map((file) =>
|
|
15278
|
+
willCreate: edit.files.map((file) => path50.relative(dir, file.path)),
|
|
15279
|
+
keep: edit.keep.map((file) => path50.relative(dir, file)),
|
|
15152
15280
|
notes: edit.notes
|
|
15153
15281
|
};
|
|
15154
15282
|
}
|
|
@@ -15161,7 +15289,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15161
15289
|
`Choose one of ${SERVICES.join(", ")}.`
|
|
15162
15290
|
);
|
|
15163
15291
|
}
|
|
15164
|
-
const dir =
|
|
15292
|
+
const dir = path50.resolve(process.cwd(), argv.dir ?? ".");
|
|
15165
15293
|
if (!await isConfigV2(dir)) {
|
|
15166
15294
|
throw new ServiceEditError(
|
|
15167
15295
|
`${action} works with a config version 2 project, and there is none in ${dir}.`,
|
|
@@ -15208,7 +15336,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15208
15336
|
{
|
|
15209
15337
|
status: action === "add" ? "added" : "removed",
|
|
15210
15338
|
...describe(edit, dir),
|
|
15211
|
-
created: created.map((file) =>
|
|
15339
|
+
created: created.map((file) => path50.relative(dir, file)),
|
|
15212
15340
|
...install ? { packages: install } : {}
|
|
15213
15341
|
},
|
|
15214
15342
|
null,
|
|
@@ -15218,7 +15346,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15218
15346
|
return;
|
|
15219
15347
|
}
|
|
15220
15348
|
printResultToConsole(
|
|
15221
|
-
`${action === "add" ? "Added" : "Removed"} ${edit.service} in ${
|
|
15349
|
+
`${action === "add" ? "Added" : "Removed"} ${edit.service} in ${path50.basename(edit.configPath)}.`
|
|
15222
15350
|
);
|
|
15223
15351
|
} catch (error) {
|
|
15224
15352
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -15276,7 +15404,7 @@ var removeService = (argv) => run(
|
|
|
15276
15404
|
"remove",
|
|
15277
15405
|
argv,
|
|
15278
15406
|
(service) => planRemoveService(service, {
|
|
15279
|
-
dir:
|
|
15407
|
+
dir: path50.resolve(process.cwd(), argv.dir ?? ".")
|
|
15280
15408
|
})
|
|
15281
15409
|
);
|
|
15282
15410
|
|
|
@@ -15424,16 +15552,16 @@ var add_default = {
|
|
|
15424
15552
|
};
|
|
15425
15553
|
|
|
15426
15554
|
// src/cli/build/handler.ts
|
|
15427
|
-
import
|
|
15555
|
+
import path52 from "node:path";
|
|
15428
15556
|
init_logger();
|
|
15429
15557
|
init_package_json();
|
|
15430
15558
|
|
|
15431
15559
|
// src/cli/preview/handler.ts
|
|
15432
|
-
import
|
|
15560
|
+
import path51 from "node:path";
|
|
15433
15561
|
import { preview as vitePreview } from "vite";
|
|
15434
15562
|
var DEFAULT_PREVIEW_PORT = 4e3;
|
|
15435
15563
|
async function preview(argv) {
|
|
15436
|
-
const dir =
|
|
15564
|
+
const dir = path51.resolve(process.cwd(), argv.dir);
|
|
15437
15565
|
const viteConfig = await getViteConfig(dir, {
|
|
15438
15566
|
command: "serve",
|
|
15439
15567
|
mode: "production",
|
|
@@ -15476,7 +15604,7 @@ async function build(argv) {
|
|
|
15476
15604
|
printDiagnosticsToConsole("");
|
|
15477
15605
|
printDiagnosticsToConsole("");
|
|
15478
15606
|
}
|
|
15479
|
-
const dir =
|
|
15607
|
+
const dir = path52.resolve(process.cwd(), argv.dir);
|
|
15480
15608
|
try {
|
|
15481
15609
|
if (await isConfigV2(dir)) {
|
|
15482
15610
|
const result = await buildV2({ dir, jsonOnly });
|
|
@@ -15541,10 +15669,10 @@ var build_default = {
|
|
|
15541
15669
|
};
|
|
15542
15670
|
|
|
15543
15671
|
// src/cli/check/handler.ts
|
|
15544
|
-
import
|
|
15672
|
+
import path59 from "node:path";
|
|
15545
15673
|
|
|
15546
15674
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
15547
|
-
import
|
|
15675
|
+
import path58 from "node:path";
|
|
15548
15676
|
|
|
15549
15677
|
// src/cli/platform/helpers/dev-portal-backend.ts
|
|
15550
15678
|
function deriveProvisioningState(backend) {
|
|
@@ -15629,10 +15757,10 @@ function formatDevPortalBackendResponse(projectId, backend) {
|
|
|
15629
15757
|
init_gateway_limits();
|
|
15630
15758
|
import { existsSync as existsSync6 } from "node:fs";
|
|
15631
15759
|
import { access as access5, mkdir as mkdir13, readFile as readFile14, writeFile as writeFile14 } from "node:fs/promises";
|
|
15632
|
-
import
|
|
15760
|
+
import path54 from "node:path";
|
|
15633
15761
|
|
|
15634
15762
|
// src/cli/make-config/json-config.ts
|
|
15635
|
-
import
|
|
15763
|
+
import path53 from "node:path";
|
|
15636
15764
|
|
|
15637
15765
|
// src/cli/make-config/branding-assets.ts
|
|
15638
15766
|
var LOGO_LIGHT = '<svg xmlns="http://www.w3.org/2000/svg" width="201.57" height="72.66" viewBox="-0.09 -46.99 201.57 72.66">\n <path d="M13.5 0.39Q8.03 0.39 4.76 -2.09Q1.48 -4.57 1.41 -9.61H8.03Q8.14 -7.48 9.6 -6.41Q11.05 -5.33 13.42 -5.33Q15.57 -5.33 16.8 -6.2Q18.03 -7.07 18.03 -8.46Q18.03 -9.71 16.87 -10.44Q15.7 -11.17 13.32 -11.72L10.23 -12.44Q6.46 -13.3 4.32 -15.25Q2.17 -17.21 2.17 -20.49Q2.17 -23.18 3.62 -25.21Q5.08 -27.23 7.64 -28.36Q10.2 -29.49 13.5 -29.49Q16.88 -29.49 19.36 -28.35Q21.84 -27.21 23.2 -25.17Q24.57 -23.12 24.61 -20.43H17.99Q17.85 -22.01 16.7 -22.89Q15.55 -23.77 13.48 -23.77Q11.41 -23.77 10.35 -22.97Q9.3 -22.17 9.3 -20.96Q9.3 -19.61 10.47 -18.88Q11.64 -18.14 13.59 -17.71L16.11 -17.13Q20.33 -16.19 22.67 -14.06Q25 -11.93 25 -8.44Q25 -4.3 21.95 -1.95Q18.91 0.39 13.5 0.39Z M32.97 0.39Q29.82 0.39 27.8 -1.21Q25.78 -2.81 25.78 -6.05Q25.78 -8.48 26.89 -9.9Q28 -11.33 29.85 -12.01Q31.7 -12.7 33.9 -12.89Q36.68 -13.12 37.88 -13.47Q39.08 -13.81 39.08 -14.82V-14.9Q39.08 -16.04 38.29 -16.65Q37.5 -17.27 36.11 -17.27Q34.68 -17.27 33.77 -16.66Q32.85 -16.05 32.58 -15.02L26.4 -15.82Q27.05 -18.61 29.56 -20.36Q32.07 -22.11 36.17 -22.11Q38.88 -22.11 41.08 -21.27Q43.28 -20.43 44.58 -18.8Q45.88 -17.17 45.88 -14.82V0H39.47V-3.07H39.29Q37.48 0.39 32.97 0.39ZM35.04 -4.12Q36.75 -4.12 37.95 -5.14Q39.14 -6.15 39.14 -7.77V-9.86Q38.55 -9.55 37.44 -9.34Q36.33 -9.12 35.37 -8.96Q32.22 -8.5 32.22 -6.37Q32.22 -5.27 33.01 -4.7Q33.81 -4.12 35.04 -4.12Z M48.59 0V-21.84H54.86L55.17 -17.5Q56.07 -19.96 57.78 -21.04Q59.49 -22.13 61.46 -22.13Q63.53 -22.13 64.91 -20.94Q66.28 -19.75 67.08 -17.07Q68.08 -19.77 70.02 -20.95Q71.97 -22.13 74.17 -22.13Q77.24 -22.13 79.2 -20.16Q81.17 -18.18 81.17 -14.73V0H74.37V-13.18Q74.37 -14.84 73.5 -15.7Q72.63 -16.56 71.28 -16.56Q69.84 -16.56 69 -15.62Q68.16 -14.67 68.16 -13.11V0H61.61V-13.28Q61.61 -14.79 60.77 -15.67Q59.92 -16.56 58.57 -16.56Q57.18 -16.56 56.29 -15.62Q55.4 -14.69 55.4 -12.97V0Z M83.88 8.16V-21.84H90.62V-18.09H90.85Q91.26 -19.06 92.04 -19.99Q92.82 -20.92 94.05 -21.51Q95.28 -22.11 97.02 -22.11Q99.33 -22.11 101.31 -20.9Q103.29 -19.69 104.51 -17.21Q105.73 -14.73 105.73 -10.9Q105.73 -7.19 104.55 -4.7Q103.37 -2.21 101.39 -0.95Q99.4 0.31 96.98 0.31Q94.48 0.31 92.99 -0.87Q91.49 -2.05 90.85 -3.54H90.69V8.16ZM94.66 -5Q96.63 -5 97.68 -6.62Q98.72 -8.24 98.72 -10.9Q98.72 -13.55 97.68 -15.17Q96.63 -16.78 94.66 -16.78Q92.71 -16.78 91.62 -15.2Q90.54 -13.61 90.54 -10.9Q90.54 -8.22 91.62 -6.61Q92.71 -5 94.66 -5Z M114.4 -29.1V0H107.59V-29.1Z M127.29 0.41Q122.15 0.41 119.21 -2.59Q116.27 -5.59 116.27 -10.84Q116.27 -14.2 117.59 -16.74Q118.91 -19.28 121.33 -20.69Q123.75 -22.11 127.04 -22.11Q130.1 -22.11 132.47 -20.83Q134.85 -19.55 136.21 -17.06Q137.56 -14.57 137.56 -10.98V-9.26H122.97Q123.07 -6.89 124.27 -5.71Q125.47 -4.53 127.41 -4.53Q128.77 -4.53 129.77 -5.11Q130.77 -5.68 131.18 -6.78L137.25 -5.78Q136.43 -2.95 133.84 -1.27Q131.25 0.41 127.29 0.41ZM123.01 -13.22H131.1Q130.9 -15.08 129.89 -16.12Q128.87 -17.17 127.09 -17.17Q125.3 -17.17 124.25 -16.1Q123.21 -15.04 123.01 -13.22Z" fill="#202633"/>\n <path d="M138.48 0 148.19 -29.1H157.43L167.43 0H159.69L157.72 -6.19H148.03L146.14 0ZM149.65 -11.46H156.04L155.65 -12.71Q154.89 -15.21 154.16 -17.95Q153.44 -20.68 152.74 -23.61Q152.07 -20.66 151.42 -17.93Q150.77 -15.2 150.04 -12.71Z M168.81 0V-29.1H180.72Q184 -29.1 186.39 -27.83Q188.77 -26.56 190.05 -24.3Q191.33 -22.03 191.33 -19.04Q191.33 -16.04 190.02 -13.8Q188.71 -11.56 186.29 -10.32Q183.87 -9.08 180.53 -9.08H175.7V0ZM175.7 -14.53H179.28Q181.7 -14.53 182.94 -15.77Q184.18 -17.01 184.18 -19.04Q184.18 -21.09 182.93 -22.3Q181.68 -23.52 179.26 -23.52H175.7Z M199.98 -29.1V0H193.08V-29.1Z" fill="#008A7D"/>\n</svg>\n';
|
|
@@ -16102,9 +16230,9 @@ function openapiInputForConfig(specRelativePosix) {
|
|
|
16102
16230
|
return `./${specRelativePosix}`;
|
|
16103
16231
|
}
|
|
16104
16232
|
function toRelativeOpenApiInput(projectDir, inputPath) {
|
|
16105
|
-
const resolved =
|
|
16106
|
-
const relative =
|
|
16107
|
-
const posix = relative.split(
|
|
16233
|
+
const resolved = path53.isAbsolute(inputPath) ? inputPath : path53.resolve(projectDir, inputPath);
|
|
16234
|
+
const relative = path53.relative(projectDir, resolved);
|
|
16235
|
+
const posix = relative.split(path53.sep).join(path53.posix.sep);
|
|
16108
16236
|
if (!posix) {
|
|
16109
16237
|
throw new Error("OpenAPI path must point to a file.");
|
|
16110
16238
|
}
|
|
@@ -16328,8 +16456,8 @@ function readHeaderNavigation(config2) {
|
|
|
16328
16456
|
function isDocsItem(item) {
|
|
16329
16457
|
return isPlainObject4(item) && (item.to === TEMPLATE_DOCS_PATH || typeof item.label === "string" && item.label.trim().toLowerCase() === HEADER_DOCS_LABEL.toLowerCase());
|
|
16330
16458
|
}
|
|
16331
|
-
function ensureHeaderDocsNavigation(config2,
|
|
16332
|
-
const firstRoute = sortDocPaths(
|
|
16459
|
+
function ensureHeaderDocsNavigation(config2, docRoutes2) {
|
|
16460
|
+
const firstRoute = sortDocPaths(docRoutes2)[0];
|
|
16333
16461
|
const current = readHeaderNavigation(config2);
|
|
16334
16462
|
if (!firstRoute || !current) return config2;
|
|
16335
16463
|
const { header, navigation } = current;
|
|
@@ -16384,7 +16512,7 @@ function isPlanFree(plan2) {
|
|
|
16384
16512
|
return (plan2.priceAmount ?? 0) <= 0;
|
|
16385
16513
|
}
|
|
16386
16514
|
function manifestFilePath(siteDirectory) {
|
|
16387
|
-
return
|
|
16515
|
+
return path54.join(path54.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
|
|
16388
16516
|
}
|
|
16389
16517
|
var STORED_MANIFEST_KEYS = [
|
|
16390
16518
|
"authentication",
|
|
@@ -16857,23 +16985,23 @@ function resolveBackendSourceDirectory(siteDirectory, sourceDirectory) {
|
|
|
16857
16985
|
if (!trimmed) {
|
|
16858
16986
|
return void 0;
|
|
16859
16987
|
}
|
|
16860
|
-
return
|
|
16988
|
+
return path54.resolve(siteDirectory, trimmed);
|
|
16861
16989
|
}
|
|
16862
16990
|
function resolveBackendOpenApiPath(openApiPath, options) {
|
|
16863
16991
|
const trimmed = openApiPath?.trim();
|
|
16864
16992
|
if (!trimmed) {
|
|
16865
16993
|
return void 0;
|
|
16866
16994
|
}
|
|
16867
|
-
if (
|
|
16995
|
+
if (path54.isAbsolute(trimmed)) {
|
|
16868
16996
|
return trimmed;
|
|
16869
16997
|
}
|
|
16870
|
-
const siteResolved =
|
|
16998
|
+
const siteResolved = path54.resolve(options.siteDirectory, trimmed);
|
|
16871
16999
|
if (existsSync6(siteResolved)) {
|
|
16872
17000
|
return siteResolved;
|
|
16873
17001
|
}
|
|
16874
17002
|
const backendDir = options.backendSourceDirectory?.trim();
|
|
16875
17003
|
if (backendDir) {
|
|
16876
|
-
const backendResolved =
|
|
17004
|
+
const backendResolved = path54.resolve(backendDir, trimmed);
|
|
16877
17005
|
if (existsSync6(backendResolved)) {
|
|
16878
17006
|
return backendResolved;
|
|
16879
17007
|
}
|
|
@@ -16881,15 +17009,15 @@ function resolveBackendOpenApiPath(openApiPath, options) {
|
|
|
16881
17009
|
return siteResolved;
|
|
16882
17010
|
}
|
|
16883
17011
|
function toSiteRelativeOpenApiInput(siteDirectory, openApiAbsolutePath) {
|
|
16884
|
-
const relative =
|
|
16885
|
-
|
|
16886
|
-
|
|
17012
|
+
const relative = path54.relative(
|
|
17013
|
+
path54.resolve(siteDirectory),
|
|
17014
|
+
path54.resolve(openApiAbsolutePath)
|
|
16887
17015
|
);
|
|
16888
|
-
const posix = relative.split(
|
|
17016
|
+
const posix = relative.split(path54.sep).join("/");
|
|
16889
17017
|
if (!posix || posix === ".") {
|
|
16890
17018
|
return "./";
|
|
16891
17019
|
}
|
|
16892
|
-
if (
|
|
17020
|
+
if (path54.isAbsolute(posix) || posix.startsWith("..")) {
|
|
16893
17021
|
return posix;
|
|
16894
17022
|
}
|
|
16895
17023
|
return posix.startsWith("./") ? posix : `./${posix}`;
|
|
@@ -16936,7 +17064,7 @@ async function readManifest2(siteDirectory) {
|
|
|
16936
17064
|
}
|
|
16937
17065
|
async function writeManifest2(siteDirectory, manifest) {
|
|
16938
17066
|
const filePath = manifestFilePath(siteDirectory);
|
|
16939
|
-
await mkdir13(
|
|
17067
|
+
await mkdir13(path54.dirname(filePath), { recursive: true });
|
|
16940
17068
|
let config2 = {};
|
|
16941
17069
|
if (await pathExists(filePath)) {
|
|
16942
17070
|
const raw = await readFile14(filePath, "utf8");
|
|
@@ -16962,7 +17090,7 @@ import {
|
|
|
16962
17090
|
unlink,
|
|
16963
17091
|
writeFile as writeFile15
|
|
16964
17092
|
} from "node:fs/promises";
|
|
16965
|
-
import
|
|
17093
|
+
import path55 from "node:path";
|
|
16966
17094
|
var ENV_FILENAME = ".env";
|
|
16967
17095
|
var COLLAPSED_UPPERCASE_ALIASES2 = {
|
|
16968
17096
|
SECRETKEY: "secretKey",
|
|
@@ -17081,12 +17209,12 @@ async function readEnvFile(filePath) {
|
|
|
17081
17209
|
}
|
|
17082
17210
|
}
|
|
17083
17211
|
async function loadSiteEnv(siteDirectory) {
|
|
17084
|
-
const resolvedDirectory =
|
|
17212
|
+
const resolvedDirectory = path55.resolve(siteDirectory);
|
|
17085
17213
|
const merged = { ...process.env };
|
|
17086
17214
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
17087
17215
|
Object.assign(
|
|
17088
17216
|
merged,
|
|
17089
|
-
await readEnvFile(
|
|
17217
|
+
await readEnvFile(path55.join(resolvedDirectory, fileName))
|
|
17090
17218
|
);
|
|
17091
17219
|
}
|
|
17092
17220
|
return merged;
|
|
@@ -17123,7 +17251,7 @@ function buildAuthSecretsJson(secrets2, options) {
|
|
|
17123
17251
|
return payload;
|
|
17124
17252
|
}
|
|
17125
17253
|
function envFilePath(siteDirectory) {
|
|
17126
|
-
return
|
|
17254
|
+
return path55.join(path55.resolve(siteDirectory), ENV_FILENAME);
|
|
17127
17255
|
}
|
|
17128
17256
|
function createEnvContent() {
|
|
17129
17257
|
return [
|
|
@@ -17187,7 +17315,7 @@ function validateSecretsForPublish(manifest, secrets2, emailOptions) {
|
|
|
17187
17315
|
}
|
|
17188
17316
|
async function siteEnvFileHasEntries(siteDirectory) {
|
|
17189
17317
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
17190
|
-
const loaded = await readEnvFile(
|
|
17318
|
+
const loaded = await readEnvFile(path55.join(siteDirectory, fileName));
|
|
17191
17319
|
if (Object.keys(loaded).length > 0) {
|
|
17192
17320
|
return true;
|
|
17193
17321
|
}
|
|
@@ -17195,7 +17323,7 @@ async function siteEnvFileHasEntries(siteDirectory) {
|
|
|
17195
17323
|
return false;
|
|
17196
17324
|
}
|
|
17197
17325
|
async function resolvePublishConfig(siteDirectory, emailOptions) {
|
|
17198
|
-
const resolvedDirectory =
|
|
17326
|
+
const resolvedDirectory = path55.resolve(siteDirectory);
|
|
17199
17327
|
const manifestRaw = await readManifest2(resolvedDirectory);
|
|
17200
17328
|
if (!manifestRaw) {
|
|
17201
17329
|
throw new Error("apitogo.config.json not found in sourceDirectory.");
|
|
@@ -17228,7 +17356,7 @@ function envFileHasActiveAssignments(content) {
|
|
|
17228
17356
|
});
|
|
17229
17357
|
}
|
|
17230
17358
|
async function writeScaffoldEnv(siteDirectory) {
|
|
17231
|
-
const resolvedDirectory =
|
|
17359
|
+
const resolvedDirectory = path55.resolve(siteDirectory);
|
|
17232
17360
|
const filesWritten = [];
|
|
17233
17361
|
const envPath = envFilePath(resolvedDirectory);
|
|
17234
17362
|
try {
|
|
@@ -17239,7 +17367,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
17239
17367
|
filesWritten.push(ENV_FILENAME);
|
|
17240
17368
|
}
|
|
17241
17369
|
for (const legacyName of [".env.example"]) {
|
|
17242
|
-
const legacyPath =
|
|
17370
|
+
const legacyPath = path55.join(resolvedDirectory, legacyName);
|
|
17243
17371
|
try {
|
|
17244
17372
|
const legacy = await readFile15(legacyPath, "utf8");
|
|
17245
17373
|
if (!envFileHasActiveAssignments(legacy)) {
|
|
@@ -17249,7 +17377,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
17249
17377
|
} catch {
|
|
17250
17378
|
}
|
|
17251
17379
|
}
|
|
17252
|
-
const gitignorePath =
|
|
17380
|
+
const gitignorePath = path55.join(resolvedDirectory, ".gitignore");
|
|
17253
17381
|
let gitignore = "";
|
|
17254
17382
|
try {
|
|
17255
17383
|
gitignore = await readFile15(gitignorePath, "utf8");
|
|
@@ -17286,11 +17414,11 @@ var SECRETS_COLLECTION_INSTRUCTION = "For go-live, plans must already be in apit
|
|
|
17286
17414
|
init_gateway_limits();
|
|
17287
17415
|
import { readFile as readFile16 } from "node:fs/promises";
|
|
17288
17416
|
import { createRequire as createRequire3 } from "node:module";
|
|
17289
|
-
import
|
|
17417
|
+
import path56 from "node:path";
|
|
17290
17418
|
var cachedFallbackTs;
|
|
17291
17419
|
async function loadTypeScriptForSite(sourceDirectory) {
|
|
17292
17420
|
const require2 = createRequire3(
|
|
17293
|
-
|
|
17421
|
+
path56.join(path56.resolve(sourceDirectory), "package.json")
|
|
17294
17422
|
);
|
|
17295
17423
|
try {
|
|
17296
17424
|
return require2("typescript");
|
|
@@ -17337,7 +17465,7 @@ async function referencedFileExists(sourceDirectory, reference) {
|
|
|
17337
17465
|
return true;
|
|
17338
17466
|
}
|
|
17339
17467
|
return pathExists(
|
|
17340
|
-
|
|
17468
|
+
path56.resolve(sourceDirectory, reference.replace(/^\.\//, ""))
|
|
17341
17469
|
);
|
|
17342
17470
|
}
|
|
17343
17471
|
async function validateSiteConfigStructure(config2, sourceDirectory) {
|
|
@@ -17452,11 +17580,11 @@ var DEFAULT_TSX_CANDIDATES = [
|
|
|
17452
17580
|
"landing/LandingPage.tsx"
|
|
17453
17581
|
];
|
|
17454
17582
|
async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
17455
|
-
const resolvedDir =
|
|
17583
|
+
const resolvedDir = path56.resolve(sourceDirectory);
|
|
17456
17584
|
const issues = [];
|
|
17457
17585
|
const checkedFiles = [];
|
|
17458
17586
|
const skippedChecks = [];
|
|
17459
|
-
const jsonPath =
|
|
17587
|
+
const jsonPath = path56.join(resolvedDir, APITOGO_CONFIG_FILENAME2);
|
|
17460
17588
|
if (await pathExists(jsonPath)) {
|
|
17461
17589
|
checkedFiles.push(APITOGO_CONFIG_FILENAME2);
|
|
17462
17590
|
let parsed;
|
|
@@ -17488,7 +17616,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
17488
17616
|
);
|
|
17489
17617
|
const existingTsxFiles = [];
|
|
17490
17618
|
for (const relativeFile of tsxFiles) {
|
|
17491
|
-
if (await pathExists(
|
|
17619
|
+
if (await pathExists(path56.join(resolvedDir, relativeFile))) {
|
|
17492
17620
|
existingTsxFiles.push(relativeFile);
|
|
17493
17621
|
}
|
|
17494
17622
|
}
|
|
@@ -17502,7 +17630,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
17502
17630
|
for (const relativeFile of existingTsxFiles) {
|
|
17503
17631
|
checkedFiles.push(relativeFile);
|
|
17504
17632
|
const content = await readFile16(
|
|
17505
|
-
|
|
17633
|
+
path56.join(resolvedDir, relativeFile),
|
|
17506
17634
|
"utf8"
|
|
17507
17635
|
);
|
|
17508
17636
|
issues.push(
|
|
@@ -17540,7 +17668,7 @@ function buildSiteValidationResponseFields(result) {
|
|
|
17540
17668
|
// src/cli/platform/helpers/npm-build.ts
|
|
17541
17669
|
import { spawn as spawn2 } from "node:child_process";
|
|
17542
17670
|
import { access as access7, readFile as readFile17 } from "node:fs/promises";
|
|
17543
|
-
import
|
|
17671
|
+
import path57 from "node:path";
|
|
17544
17672
|
var BUILD_LOG_TAIL_BYTES = 8192;
|
|
17545
17673
|
var MIN_NODE_MAJOR = 20;
|
|
17546
17674
|
var NpmBuildError = class extends Error {
|
|
@@ -17607,13 +17735,13 @@ function runCommand(command2, args, cwd, env) {
|
|
|
17607
17735
|
}
|
|
17608
17736
|
async function runNpmInstall(sourceDirectory, options) {
|
|
17609
17737
|
assertNodeVersion(options?.nodeVersion);
|
|
17610
|
-
const cwd =
|
|
17611
|
-
const packageJsonPath =
|
|
17738
|
+
const cwd = path57.resolve(sourceDirectory);
|
|
17739
|
+
const packageJsonPath = path57.join(cwd, "package.json");
|
|
17612
17740
|
if (!await pathExists2(packageJsonPath)) {
|
|
17613
17741
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
17614
17742
|
}
|
|
17615
17743
|
const startedAt = Date.now();
|
|
17616
|
-
const lockPath =
|
|
17744
|
+
const lockPath = path57.join(cwd, "package-lock.json");
|
|
17617
17745
|
const installArgs = await pathExists2(lockPath) ? ["ci"] : ["install"];
|
|
17618
17746
|
const install = await runCommand("npm", installArgs, cwd);
|
|
17619
17747
|
const installLog = install.output;
|
|
@@ -17631,8 +17759,8 @@ async function runNpmInstall(sourceDirectory, options) {
|
|
|
17631
17759
|
}
|
|
17632
17760
|
async function runNpmBuild(sourceDirectory, options) {
|
|
17633
17761
|
assertNodeVersion(options?.nodeVersion);
|
|
17634
|
-
const cwd =
|
|
17635
|
-
const packageJsonPath =
|
|
17762
|
+
const cwd = path57.resolve(sourceDirectory);
|
|
17763
|
+
const packageJsonPath = path57.join(cwd, "package.json");
|
|
17636
17764
|
if (!await pathExists2(packageJsonPath)) {
|
|
17637
17765
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
17638
17766
|
}
|
|
@@ -17649,8 +17777,8 @@ async function runNpmBuild(sourceDirectory, options) {
|
|
|
17649
17777
|
build2.exitCode
|
|
17650
17778
|
);
|
|
17651
17779
|
}
|
|
17652
|
-
const distPath =
|
|
17653
|
-
const indexPath =
|
|
17780
|
+
const distPath = path57.join(cwd, "dist");
|
|
17781
|
+
const indexPath = path57.join(distPath, "index.html");
|
|
17654
17782
|
if (!await pathExists2(indexPath)) {
|
|
17655
17783
|
throw new NpmBuildError(
|
|
17656
17784
|
`Build completed but dist/index.html was not found at ${indexPath}`,
|
|
@@ -18034,7 +18162,7 @@ function validateManifestForPlatformPublish(manifest) {
|
|
|
18034
18162
|
|
|
18035
18163
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
18036
18164
|
async function checkPublishReadiness(client, _config, args) {
|
|
18037
|
-
const sourceDirectory =
|
|
18165
|
+
const sourceDirectory = path58.resolve(args.sourceDirectory);
|
|
18038
18166
|
const manifest = await readManifest2(sourceDirectory) ?? createScaffoldManifest();
|
|
18039
18167
|
const emailOptions = await resolveEmailOptionsForPublish(
|
|
18040
18168
|
client,
|
|
@@ -18112,7 +18240,7 @@ async function checkPublishReadiness(client, _config, args) {
|
|
|
18112
18240
|
|
|
18113
18241
|
// src/cli/check/handler.ts
|
|
18114
18242
|
async function check(argv) {
|
|
18115
|
-
const sourceDirectory =
|
|
18243
|
+
const sourceDirectory = path59.resolve(process.cwd(), argv.dir);
|
|
18116
18244
|
if (await isConfigV2(sourceDirectory)) {
|
|
18117
18245
|
await checkV2(sourceDirectory, argv);
|
|
18118
18246
|
return;
|
|
@@ -18177,13 +18305,13 @@ var check_default = {
|
|
|
18177
18305
|
// src/cli/make-config/handler.ts
|
|
18178
18306
|
import { constants as constants2 } from "node:fs";
|
|
18179
18307
|
import { access as access12, mkdir as mkdir17, readFile as readFile22, writeFile as writeFile20 } from "node:fs/promises";
|
|
18180
|
-
import
|
|
18308
|
+
import path69 from "node:path";
|
|
18181
18309
|
import { stdin as input2 } from "node:process";
|
|
18182
|
-
import { glob as
|
|
18310
|
+
import { glob as glob8 } from "glob";
|
|
18183
18311
|
|
|
18184
18312
|
// src/cli/platform/helpers/openapi-action-keys.ts
|
|
18185
18313
|
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
18186
|
-
import
|
|
18314
|
+
import path60 from "node:path";
|
|
18187
18315
|
import YAML from "yaml";
|
|
18188
18316
|
var HTTP_METHODS = [
|
|
18189
18317
|
"get",
|
|
@@ -18252,7 +18380,7 @@ function extractGatewayActionKeysFromOpenApiDocument(document) {
|
|
|
18252
18380
|
function extractGatewayActionKeysFromOpenApiFile(filePath) {
|
|
18253
18381
|
try {
|
|
18254
18382
|
const raw = readFileSync4(filePath, "utf8");
|
|
18255
|
-
const ext =
|
|
18383
|
+
const ext = path60.extname(filePath).toLowerCase();
|
|
18256
18384
|
const parsed = ext === ".json" ? JSON.parse(raw) : YAML.parse(raw);
|
|
18257
18385
|
return extractGatewayActionKeysFromOpenApiDocument(parsed);
|
|
18258
18386
|
} catch {
|
|
@@ -18273,7 +18401,7 @@ function resolveConfigOpenApiFilePath(siteDirectory, config2) {
|
|
|
18273
18401
|
}
|
|
18274
18402
|
}
|
|
18275
18403
|
for (const candidate of candidates) {
|
|
18276
|
-
const resolved =
|
|
18404
|
+
const resolved = path60.isAbsolute(candidate) ? candidate : path60.resolve(siteDirectory, candidate);
|
|
18277
18405
|
if (existsSync7(resolved)) {
|
|
18278
18406
|
return resolved;
|
|
18279
18407
|
}
|
|
@@ -18288,7 +18416,7 @@ function loadOpenApiActionKeysForSite(siteDirectory, config2) {
|
|
|
18288
18416
|
return extractGatewayActionKeysFromOpenApiFile(filePath);
|
|
18289
18417
|
}
|
|
18290
18418
|
function loadOpenApiActionKeysFromSiteDirectory(siteDirectory) {
|
|
18291
|
-
const configPath =
|
|
18419
|
+
const configPath = path60.join(siteDirectory, "apitogo.config.json");
|
|
18292
18420
|
if (!existsSync7(configPath)) {
|
|
18293
18421
|
return [];
|
|
18294
18422
|
}
|
|
@@ -18317,7 +18445,7 @@ function withDefaultIncludedActionKeys(plan2, actionKeys) {
|
|
|
18317
18445
|
|
|
18318
18446
|
// src/cli/scaffold/dev-portal-config-pages.ts
|
|
18319
18447
|
import { access as access8, readFile as readFile18, rename as rename7, rm as rm9, writeFile as writeFile16 } from "node:fs/promises";
|
|
18320
|
-
import
|
|
18448
|
+
import path61 from "node:path";
|
|
18321
18449
|
async function writeConfigAtomically(filePath, content) {
|
|
18322
18450
|
const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
18323
18451
|
try {
|
|
@@ -18330,7 +18458,7 @@ async function writeConfigAtomically(filePath, content) {
|
|
|
18330
18458
|
}
|
|
18331
18459
|
async function resolveApitogoConfigPath(sourceDirectory) {
|
|
18332
18460
|
for (const filename of ["apitogo.config.tsx", "apitogo.config.jsx"]) {
|
|
18333
|
-
const configPath =
|
|
18461
|
+
const configPath = path61.join(sourceDirectory, filename);
|
|
18334
18462
|
try {
|
|
18335
18463
|
await access8(configPath);
|
|
18336
18464
|
return configPath;
|
|
@@ -19094,17 +19222,17 @@ async function wireNewDevPortalPageInConfig(sourceDirectory, slug, label) {
|
|
|
19094
19222
|
|
|
19095
19223
|
// src/cli/scaffold/wire-openapi.ts
|
|
19096
19224
|
import { access as access10, readFile as readFile20, writeFile as writeFile18 } from "node:fs/promises";
|
|
19097
|
-
import
|
|
19225
|
+
import path66 from "node:path";
|
|
19098
19226
|
|
|
19099
19227
|
// src/cli/platform/helpers/openapi.ts
|
|
19100
19228
|
import { promises as fs6 } from "node:fs";
|
|
19101
|
-
import
|
|
19229
|
+
import path63 from "node:path";
|
|
19102
19230
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
19103
19231
|
import YAML2 from "yaml";
|
|
19104
19232
|
|
|
19105
19233
|
// src/cli/scaffold/discover-openapi-files.ts
|
|
19106
19234
|
import { promises as fs5 } from "node:fs";
|
|
19107
|
-
import
|
|
19235
|
+
import path62 from "node:path";
|
|
19108
19236
|
var OPENAPI_BASENAMES = [
|
|
19109
19237
|
"openapi.yaml",
|
|
19110
19238
|
"openapi.yml",
|
|
@@ -19126,13 +19254,13 @@ var SKIP_OPENAPI_SEARCH_DIRS = /* @__PURE__ */ new Set([
|
|
|
19126
19254
|
".apitogo"
|
|
19127
19255
|
]);
|
|
19128
19256
|
async function collectFromDir(dir, searchedDirectories, candidates) {
|
|
19129
|
-
const resolved =
|
|
19257
|
+
const resolved = path62.resolve(dir);
|
|
19130
19258
|
if (searchedDirectories.includes(resolved)) {
|
|
19131
19259
|
return;
|
|
19132
19260
|
}
|
|
19133
19261
|
searchedDirectories.push(resolved);
|
|
19134
19262
|
for (const name of OPENAPI_BASENAMES) {
|
|
19135
|
-
const candidate =
|
|
19263
|
+
const candidate = path62.join(resolved, name);
|
|
19136
19264
|
try {
|
|
19137
19265
|
await fs5.access(candidate);
|
|
19138
19266
|
candidates.push(candidate);
|
|
@@ -19147,8 +19275,8 @@ async function collectSiteOpenApiFiles(siteDirectory) {
|
|
|
19147
19275
|
return { candidates: [...new Set(candidates)], searchedDirectories };
|
|
19148
19276
|
}
|
|
19149
19277
|
async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
19150
|
-
const site =
|
|
19151
|
-
const parent =
|
|
19278
|
+
const site = path62.resolve(siteDirectory);
|
|
19279
|
+
const parent = path62.dirname(site);
|
|
19152
19280
|
const searchedDirectories = [];
|
|
19153
19281
|
const candidates = [];
|
|
19154
19282
|
if (parent && parent !== site) {
|
|
@@ -19159,8 +19287,8 @@ async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
|
19159
19287
|
if (!entry.isDirectory() || SKIP_OPENAPI_SEARCH_DIRS.has(entry.name)) {
|
|
19160
19288
|
continue;
|
|
19161
19289
|
}
|
|
19162
|
-
const sibling =
|
|
19163
|
-
if (
|
|
19290
|
+
const sibling = path62.join(parent, entry.name);
|
|
19291
|
+
if (path62.resolve(sibling) === site) {
|
|
19164
19292
|
continue;
|
|
19165
19293
|
}
|
|
19166
19294
|
await collectFromDir(sibling, searchedDirectories, candidates);
|
|
@@ -19188,7 +19316,7 @@ function parseOpenApiObject(doc) {
|
|
|
19188
19316
|
};
|
|
19189
19317
|
}
|
|
19190
19318
|
function liteParseOpenApi(content, filePath) {
|
|
19191
|
-
const ext =
|
|
19319
|
+
const ext = path62.extname(filePath).toLowerCase();
|
|
19192
19320
|
if (ext === ".json") {
|
|
19193
19321
|
try {
|
|
19194
19322
|
const parsed = JSON.parse(content);
|
|
@@ -19253,9 +19381,9 @@ async function discoverNearbyOpenApi(siteDirectory) {
|
|
|
19253
19381
|
};
|
|
19254
19382
|
}
|
|
19255
19383
|
async function validateOpenApiFile(filePath) {
|
|
19256
|
-
const resolved =
|
|
19384
|
+
const resolved = path63.resolve(filePath);
|
|
19257
19385
|
const content = await fs6.readFile(resolved, "utf8");
|
|
19258
|
-
const ext =
|
|
19386
|
+
const ext = path63.extname(resolved).toLowerCase();
|
|
19259
19387
|
let parsed;
|
|
19260
19388
|
try {
|
|
19261
19389
|
parsed = ext === ".json" ? JSON.parse(content) : YAML2.parse(content);
|
|
@@ -19298,7 +19426,7 @@ async function validateOpenApiFile(filePath) {
|
|
|
19298
19426
|
|
|
19299
19427
|
// src/cli/scaffold/scaffold-dev-portal-site.ts
|
|
19300
19428
|
import { mkdir as mkdir15, readFile as readFile19, writeFile as writeFile17 } from "node:fs/promises";
|
|
19301
|
-
import
|
|
19429
|
+
import path65 from "node:path";
|
|
19302
19430
|
|
|
19303
19431
|
// src/cli/scaffold/apitogo-npm-packages.ts
|
|
19304
19432
|
var DEFAULT_CREATE_APITOGO_PACKAGE2 = "@lukoweb/create-apitogo@latest";
|
|
@@ -19386,7 +19514,7 @@ var DOC_TOOL_LOCAL_PACKAGE_PATHS = {
|
|
|
19386
19514
|
// src/cli/scaffold/create-apitogo-cli.ts
|
|
19387
19515
|
import { spawn as spawn3 } from "node:child_process";
|
|
19388
19516
|
import { access as access9, rm as rm10 } from "node:fs/promises";
|
|
19389
|
-
import
|
|
19517
|
+
import path64 from "node:path";
|
|
19390
19518
|
var SKIP_NEARBY_DISCOVERY_ENV = "APITOGO_SKIP_NEARBY_DISCOVERY";
|
|
19391
19519
|
var CreateApitogoCliError = class extends Error {
|
|
19392
19520
|
exitCode;
|
|
@@ -19403,9 +19531,9 @@ function resolveDocToolPath(explicit) {
|
|
|
19403
19531
|
return value || void 0;
|
|
19404
19532
|
}
|
|
19405
19533
|
function splitOutputDirectory(outputDirectory) {
|
|
19406
|
-
const resolvedOutputDirectory =
|
|
19407
|
-
const projectName =
|
|
19408
|
-
const parentDirectory =
|
|
19534
|
+
const resolvedOutputDirectory = path64.resolve(outputDirectory);
|
|
19535
|
+
const projectName = path64.basename(resolvedOutputDirectory);
|
|
19536
|
+
const parentDirectory = path64.dirname(resolvedOutputDirectory);
|
|
19409
19537
|
if (!projectName || projectName === "." || projectName === "..") {
|
|
19410
19538
|
throw new Error(
|
|
19411
19539
|
"outputDirectory must be a named folder (e.g. ./dev-portal-site), not the current directory."
|
|
@@ -19431,7 +19559,7 @@ async function directoryHasEntries(dir) {
|
|
|
19431
19559
|
}
|
|
19432
19560
|
}
|
|
19433
19561
|
function resolveLocalCreateApitogoEntry(docToolPath) {
|
|
19434
|
-
return
|
|
19562
|
+
return path64.resolve(docToolPath, "packages/create-zudoku/dist/index.js");
|
|
19435
19563
|
}
|
|
19436
19564
|
async function resolveCreateApitogoInvocation(options) {
|
|
19437
19565
|
const docToolPath = resolveDocToolPath(options.docToolPath);
|
|
@@ -19513,7 +19641,7 @@ async function runCreateApitogoDevPortal(options) {
|
|
|
19513
19641
|
result.exitCode
|
|
19514
19642
|
);
|
|
19515
19643
|
}
|
|
19516
|
-
if (!await pathExists3(
|
|
19644
|
+
if (!await pathExists3(path64.join(resolvedOutputDirectory, "package.json"))) {
|
|
19517
19645
|
throw new CreateApitogoCliError(
|
|
19518
19646
|
`create-apitogo completed but package.json was not found at ${resolvedOutputDirectory}`,
|
|
19519
19647
|
result.output,
|
|
@@ -19572,7 +19700,7 @@ function ensureRequiredApitogoModules(pkg, options) {
|
|
|
19572
19700
|
]
|
|
19573
19701
|
]) {
|
|
19574
19702
|
if (options.docToolPath) {
|
|
19575
|
-
deps[moduleName] = `file:${
|
|
19703
|
+
deps[moduleName] = `file:${path65.join(options.docToolPath, localPath)}`;
|
|
19576
19704
|
continue;
|
|
19577
19705
|
}
|
|
19578
19706
|
deps[moduleName] = `npm:${moduleName}@${moduleAliasVersion}`;
|
|
@@ -19603,7 +19731,7 @@ function rewritePackageJson(raw, options) {
|
|
|
19603
19731
|
DOC_TOOL_LOCAL_PACKAGE_PATHS
|
|
19604
19732
|
)) {
|
|
19605
19733
|
if (dep in deps) {
|
|
19606
|
-
deps[dep] = `file:${
|
|
19734
|
+
deps[dep] = `file:${path65.join(options.docToolPath, relativePath)}`;
|
|
19607
19735
|
linkedWorkspacePackage = true;
|
|
19608
19736
|
}
|
|
19609
19737
|
}
|
|
@@ -19703,23 +19831,23 @@ function patchDashboardPageConfig(content) {
|
|
|
19703
19831
|
);
|
|
19704
19832
|
}
|
|
19705
19833
|
async function ensureAccountPlansPage(outputDirectory) {
|
|
19706
|
-
const pagePath =
|
|
19834
|
+
const pagePath = path65.join(outputDirectory, ACCOUNT_PLANS_PAGE_PATH);
|
|
19707
19835
|
try {
|
|
19708
19836
|
await readFile19(pagePath, "utf8");
|
|
19709
19837
|
return void 0;
|
|
19710
19838
|
} catch {
|
|
19711
|
-
await mkdir15(
|
|
19839
|
+
await mkdir15(path65.dirname(pagePath), { recursive: true });
|
|
19712
19840
|
await writeFile17(pagePath, ACCOUNT_PLANS_PAGE);
|
|
19713
19841
|
return ACCOUNT_PLANS_PAGE_PATH;
|
|
19714
19842
|
}
|
|
19715
19843
|
}
|
|
19716
19844
|
async function ensureDashboardPage(outputDirectory) {
|
|
19717
|
-
const pagePath =
|
|
19845
|
+
const pagePath = path65.join(outputDirectory, DASHBOARD_PAGE_PATH);
|
|
19718
19846
|
try {
|
|
19719
19847
|
await readFile19(pagePath, "utf8");
|
|
19720
19848
|
return void 0;
|
|
19721
19849
|
} catch {
|
|
19722
|
-
await mkdir15(
|
|
19850
|
+
await mkdir15(path65.dirname(pagePath), { recursive: true });
|
|
19723
19851
|
await writeFile17(pagePath, DASHBOARD_PAGE);
|
|
19724
19852
|
return DASHBOARD_PAGE_PATH;
|
|
19725
19853
|
}
|
|
@@ -19776,7 +19904,7 @@ function patchApitogoConfig(content, options) {
|
|
|
19776
19904
|
async function patchScaffoldedSite(outputDirectory, options) {
|
|
19777
19905
|
const title = options.branding?.title ?? options.siteName;
|
|
19778
19906
|
const filesWritten = [];
|
|
19779
|
-
const packageJsonPath =
|
|
19907
|
+
const packageJsonPath = path65.join(outputDirectory, "package.json");
|
|
19780
19908
|
if (options.patchPackageJson !== false) {
|
|
19781
19909
|
const packageJson3 = await readFile19(packageJsonPath, "utf8");
|
|
19782
19910
|
await writeFile17(
|
|
@@ -19789,7 +19917,7 @@ async function patchScaffoldedSite(outputDirectory, options) {
|
|
|
19789
19917
|
);
|
|
19790
19918
|
filesWritten.push("package.json");
|
|
19791
19919
|
}
|
|
19792
|
-
const configPath =
|
|
19920
|
+
const configPath = path65.join(outputDirectory, "apitogo.config.tsx");
|
|
19793
19921
|
const configContent = await readFile19(configPath, "utf8");
|
|
19794
19922
|
await writeFile17(
|
|
19795
19923
|
configPath,
|
|
@@ -19884,8 +20012,8 @@ async function discoverOpenApiByMode(siteDirectory, mode) {
|
|
|
19884
20012
|
return discoverNearbyOpenApi(siteDirectory);
|
|
19885
20013
|
}
|
|
19886
20014
|
async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
19887
|
-
const resolvedSource =
|
|
19888
|
-
const resolvedOpenApi =
|
|
20015
|
+
const resolvedSource = path66.resolve(sourceDirectory);
|
|
20016
|
+
const resolvedOpenApi = path66.resolve(openApiPath);
|
|
19889
20017
|
const input5 = toSiteRelativeOpenApiInput(resolvedSource, resolvedOpenApi);
|
|
19890
20018
|
const validation = await validateOpenApiFile(resolvedOpenApi);
|
|
19891
20019
|
if (!validation.valid) {
|
|
@@ -19910,7 +20038,7 @@ async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
|
19910
20038
|
"utf8"
|
|
19911
20039
|
);
|
|
19912
20040
|
} else {
|
|
19913
|
-
const tsxConfigPath =
|
|
20041
|
+
const tsxConfigPath = path66.join(resolvedSource, "apitogo.config.tsx");
|
|
19914
20042
|
const configContent = await readFile20(tsxConfigPath, "utf8");
|
|
19915
20043
|
try {
|
|
19916
20044
|
const patched = patchApitogoConfigOpenApiToFile(configContent, input5);
|
|
@@ -19996,7 +20124,7 @@ async function discoverAndWireOpenApi(siteDirectory, mode) {
|
|
|
19996
20124
|
}
|
|
19997
20125
|
|
|
19998
20126
|
// src/cli/make-config/interactive.ts
|
|
19999
|
-
import
|
|
20127
|
+
import path67 from "node:path";
|
|
20000
20128
|
import { stdin as input, stdout as output } from "node:process";
|
|
20001
20129
|
import { createInterface as createInterface3 } from "node:readline/promises";
|
|
20002
20130
|
|
|
@@ -20172,7 +20300,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
20172
20300
|
continue;
|
|
20173
20301
|
}
|
|
20174
20302
|
const routePath = `/${slug}`;
|
|
20175
|
-
const relativePath =
|
|
20303
|
+
const relativePath = path67.posix.join(options.pagesDir, `${slug}.tsx`);
|
|
20176
20304
|
const page = {
|
|
20177
20305
|
slug,
|
|
20178
20306
|
title: pageTitle.trim(),
|
|
@@ -20268,8 +20396,8 @@ export default function ${componentName}() {
|
|
|
20268
20396
|
init_package_json();
|
|
20269
20397
|
import { constants } from "node:fs";
|
|
20270
20398
|
import { access as access11, mkdir as mkdir16, readFile as readFile21, writeFile as writeFile19 } from "node:fs/promises";
|
|
20271
|
-
import
|
|
20272
|
-
import { glob as
|
|
20399
|
+
import path68 from "node:path";
|
|
20400
|
+
import { glob as glob7 } from "glob";
|
|
20273
20401
|
|
|
20274
20402
|
// src/cli/make-config/favicon-png.ts
|
|
20275
20403
|
var FAVICON_PNG_BASE64 = "iVBORw0KGgoAAAANSUhEUgAAALQAAAC0CAYAAAA9zQYyAAAKOmlDQ1BzUkdCIElFQzYxOTY2LTIuMQAASImdU3dYU3cXPvfe7MFKiICMsJdsgQAiI+whU5aoxCRAGCGGBNwDERWsKCqyFEWqAhasliF1IoqDgqjgtiBFRK3FKi4cfaLP09o+/b6vX98/7n2f8zvn3t9533MAaAEhInEWqgKQKZZJI/292XHxCWxiD6BABgLYAfD42ZLQKL9oAIBAXy47O9LfG/6ElwOAKN5XrQLC2Wz4/6DKl0hlAEg4ADgIhNl8ACQfADJyZRJFfBwAmAvSFRzFKbg0Lj4BANVQ8JTPfNqnnM/cU8EFmWIBAKq4s0SQKVDwTgBYnyMXCgCwEAAoyBEJcwGwawBglCHPFAFgrxW1mUJeNgCOpojLhPxUAJwtANCk0ZFcANwMABIt5Qu+4AsuEy6SKZriZkkWS0UpqTK2Gd+cbefiwmEHCHMzhDKZVTiPn86TCtjcrEwJT7wY4HPPn6Cm0JYd6Mt1snNxcrKyt7b7Qqj/evgPofD2M3se8ckzhNX9R+zv8rJqADgTANjmP2ILygFa1wJo3PojZrQbQDkfoKX3i35YinlJlckkrjY2ubm51iIh31oh6O/4nwn/AF/8z1rxud/lYfsIk3nyDBlboRs/KyNLLmVnS3h8Idvqr0P8rwv//h7TIoXJQqlQzBeyY0TCXJE4hc3NEgtEMlGWmC0S/ycT/2XZX/B5rgGAUfsBmPOtQaWXCdjP3YBjUAFL3KVw/XffQsgxoNi8WL3Rz3P/CZ+2+c9AixWPbFHKpzpuZDSbL5fmfD5TrCXggQLKwARN0AVDMAMrsAdncANP8IUgCINoiId5wIdUyAQp5MIyWA0FUASbYTtUQDXUQh00wmFohWNwGs7BJbgM/XAbBmEEHsM4vIRJBEGICB1hIJqIHmKMWCL2CAeZifgiIUgkEo8kISmIGJEjy5A1SBFSglQge5A65FvkKHIauYD0ITeRIWQM+RV5i2IoDWWiOqgJaoNyUC80GI1G56Ip6EJ0CZqPbkLL0Br0INqCnkYvof3oIPoYncAAo2IsTB+zwjgYFwvDErBkTIqtwAqxUqwGa8TasS7sKjaIPcHe4Ag4Bo6Ns8K54QJws3F83ELcCtxGXAXuAK4F14m7ihvCjeM+4Ol4bbwl3hUfiI/Dp+Bz8QX4Uvw+fDP+LL4fP4J/SSAQWARTgjMhgBBPSCMsJWwk7CQ0EU4R+gjDhAkikahJtCS6E8OIPKKMWEAsJx4kniReIY4QX5OoJD2SPcmPlEASk/JIpaR60gnSFdIoaZKsQjYmu5LDyALyYnIxuZbcTu4lj5AnKaoUU4o7JZqSRllNKaM0Us5S7lCeU6lUA6oLNYIqoq6illEPUc9Th6hvaGo0CxqXlkiT0zbR9tNO0W7SntPpdBO6Jz2BLqNvotfRz9Dv0V8rMZSslQKVBEorlSqVWpSuKD1VJisbK3spz1NeolyqfES5V/mJClnFRIWrwlNZoVKpclTlusqEKkPVTjVMNVN1o2q96gXVh2pENRM1XzWBWr7aXrUzasMMjGHI4DL4jDWMWsZZxgiTwDRlBjLTmEXMb5g9zHF1NfXp6jHqi9Qr1Y+rD7IwlgkrkJXBKmYdZg2w3k7RmeI1RThlw5TGKVemvNKYquGpIdQo1GjS6Nd4q8nW9NVM19yi2ap5VwunZaEVoZWrtUvrrNaTqcypblP5UwunHp56SxvVttCO1F6qvVe7W3tCR1fHX0eiU65zRueJLkvXUzdNd5vuCd0xPYbeTD2R3ja9k3qP2OpsL3YGu4zdyR7X19YP0Jfr79Hv0Z80MDWYbZBn0GRw15BiyDFMNtxm2GE4bqRnFGq0zKjB6JYx2ZhjnGq8w7jL+JWJqUmsyTqTVpOHphqmgaZLTBtM75jRzTzMFprVmF0zJ5hzzNPNd5pftkAtHC1SLSotei1RSydLkeVOy75p+Gku08TTaqZdt6JZeVnlWDVYDVmzrEOs86xbrZ/aGNkk2Gyx6bL5YOtom2Fba3vbTs0uyC7Prt3uV3sLe759pf01B7qDn8NKhzaHZ9Mtpwun75p+w5HhGOq4zrHD8b2Ts5PUqdFpzNnIOcm5yvk6h8kJ52zknHfBu3i7rHQ55vLG1clV5nrY9Rc3K7d0t3q3hzNMZwhn1M4Ydjdw57nvcR+cyZ6ZNHP3zEEPfQ+eR43HfU9DT4HnPs9RL3OvNK+DXk+9bb2l3s3er7iu3OXcUz6Yj79PoU+Pr5rvbN8K33t+Bn4pfg1+4/6O/kv9TwXgA4IDtgRcD9QJ5AfWBY4HOQctD+oMpgVHBVcE3w+xCJGGtIeioUGhW0PvzDKeJZ7VGgZhgWFbw+6Gm4YvDP8+ghARHlEZ8SDSLnJZZFcUI2p+VH3Uy2jv6OLo27PNZstnd8QoxyTG1MW8ivWJLYkdjLOJWx53KV4rXhTflkBMiEnYlzAxx3fO9jkjiY6JBYkDc03nLpp7YZ7WvIx5x+crz+fNP5KET4pNqk96xwvj1fAmFgQuqFowzufyd/AfCzwF2wRjQndhiXA02T25JPlhinvK1pSxVI/U0tQnIq6oQvQsLSCtOu1Velj6/vSPGbEZTZmkzKTMo2I1cbq4M0s3a1FWn8RSUiAZXOi6cPvCcWmwdF82kj03u03GlElk3XIz+Vr5UM7MnMqc17kxuUcWqS4SL+pebLF4w+LRJX5Lvl6KW8pf2rFMf9nqZUPLvZbvWYGsWLCiY6XhyvyVI6v8Vx1YTVmdvvqHPNu8krwXa2LXtOfr5K/KH17rv7ahQKlAWnB9ndu66vW49aL1PRscNpRv+FAoKLxYZFtUWvRuI3/jxa/svir76uOm5E09xU7FuzYTNos3D2zx2HKgRLVkScnw1tCtLdvY2wq3vdg+f/uF0uml1TsoO+Q7BstCytrKjco3l7+rSK3or/SubKrSrtpQ9WqnYOeVXZ67Gqt1qouq3+4W7b6xx39PS41JTelewt6cvQ9qY2q7vuZ8XbdPa1/Rvvf7xfsHD0Qe6Kxzrqur164vbkAb5A1jBxMPXv7G55u2RqvGPU2spqJDcEh+6NG3Sd8OHA4+3HGEc6TxO+PvqpoZzYUtSMvilvHW1NbBtvi2vqNBRzva3dqbv7f+fv8x/WOVx9WPF5+gnMg/8fHkkpMTpySnnpxOOT3cMb/j9pm4M9c6Izp7zgafPX/O79yZLq+uk+fdzx+74Hrh6EXOxdZLTpdauh27m39w/KG5x6mnpde5t+2yy+X2vhl9J654XDl91efquWuB1y71z+rvG5g9cON64vXBG4IbD29m3Hx2K+fW5O1Vd/B3Cu+q3C29p32v5kfzH5sGnQaPD/kMdd+Pun97mD/8+Kfsn96N5D+gPygd1Rute2j/8NiY39jlR3MejTyWPJ58UvCz6s9VT82efveL5y/d43HjI8+kzz7+uvG55vP9L6a/6JgIn7j3MvPl5KvC15qvD7zhvOl6G/t2dDL3HfFd2Xvz9+0fgj/c+Zj58eNv94Tz+8WoiUIAAAAJcEhZcwAALiMAAC4jAXilP3YAAA7iSURBVHic7Z1/qNfVGcffzzXoB0g/FkUrkXSrFURltH4hLYzatWaThEqzMCa6SqiVUMmMBCuwWqNyRSNXlhUYzn7o+kUbkrZFNon1w22G1CZJP4nZgtwznutz63rTe7+fc87nx/d83i84+I+fzznnOe/vuedzznOeR1QVhORCT90NICQlFDTJCgqaZAUFTbKCgiZZQUGTrKCgSVZQ0CQrKGiSFRQ0yQoKmmQFBU2ygoImWUFBk6ygoElWUNAkKyhokhUUNMkKCppkBQVNsoKCJllBQZOsoKBJVlDQJCsoaJIVFDTJCgqaZAUFTbKCgiZZQUGTrKCgSVZQ0CQrKGiSFRQ0yQoKmmQFBU2yYg9khojsBeAIAGMBHA5gFIBDARwM4EAA+wEYCWBv7/9XAL4A8DmATwF8COADAP8C8B6AdwH8E8BGVf1v3f0jQyPdngVLREywJwA4HsCxAI4BMKaEqjYBeAPABgCvA3hNVU3wpEF0paBF5EQA4wGcBuAUAIfU0IwtANYBeBnAGlV9tYY2kG4VtIgcBeAsABO87IPmsA3Ai16eU9W36m5QW2m8oEVkIoBzAdi/o9F8NgNYBeBpVbV/SdsFLSJ7AjgfwGQvI9B9bAewwssTqvpl3Q1qA40TtIhcBOACAOchH1YCeFxVH627IbnTGEGLyNkApgOYhnx5BMBSVX227obkSu2CFhHbM74MwAwAByF/tgJYAuABVd1Yd2Nyo1ZBi4jNyDN9C65trAFwv6ourbshOVGLoEXETvEuBzC7YdtvdWz33QtgsaraaSTpNkGLSC+AOQDsX7KD1QDuUlX7l3SLL4eI2Ix8tftakG+wH/dYERmtqjZjkybP0CJizkDXApjrTkFk15iT1CIAt6mqOUuRpglaRA4DcB2AK1AtnwF4E8A77i232T3ozJPuI/euMwHBf2T2o/uOe+Ud6qeSttY/EsDRAPatsO33ALhVVd+vsM4sKFXQviU3D8AlKB9z7VwL4M8AzFFovaqaiKOxpQCAcQDMKeokAKcCMDfVMnkIwEJu7TVE0O5MNB/AhSiXF9wp6CVVNTGXjoiYqM9wJ6kzS6zqMQAL6OxUs6B9Zr6pRDH/G8CT5gBkOwSq+j/UgIj0+AedOU9NAvDdkkR9I2fqmgTta+aFJS0z7PbIciuq+hc0CBH5IYApXuymTOrlxzyuqSsWtO9m3FLCB+AnAB4GsExVX0GDEZGTAUwFcDGA/RN/KF7P3Y9hMEGnKr7M0MTF3C8npWxnFcWXICsS2+KmuvulDS/JZmg/NLkj4T6z7VDcZ0VVP0YXIiIHAJjlJcXlBNtm/AUPX4Yg0WzU6/u9qWYiu+lxTt2/9lTF+uJ9SmEbs3Nv3X3ShpY9EjkazUl4nL0YwJ2q+ndkgqo+IyIb/aPWnLJiMDvPsffRoamcQDOXJ3I0+tz3ra/JScz9eJ+u8T7Gftj1Jvhh5Enkn1LzZ/5Pgj+jtq98Zd1/rqoq1lfvc4zNzO7T6+6LNqz0RB6ezEzgz2zBWuar6t1oCd5Xm6ljAtWY3Wf6OJAES47LEtw02eJHu79Fy/A+L3AbhDLex4HECNovtNodwBhsHXlzG8Xcj/f95sg19QwfDxIxQ09PcKF1UZuWGbvDbWA+0KEc5ONBQgTtcTOmJdiaixnE3FjkNgllmo9L6+kJiGhkQWBiWO37zAxN67gt7nTbhHKBj0+rKTpDnx8Z0ciOs+/JcZ85FreJOSCFXko4z8en1RQVtMWZi8H8Mp6JfEe2uG3MfyWUyWg5PQWjgMYY7PeRg9UW7nNbhTDZx6m1FJmhz42IAmr+zEu61WuuStxGS9xmRRnh49RaegrcD4z55T+sqnZlinSA28ouNIQw0cerlXQ6Q58V4c9rHmbLAp9tM8vcdkUZ7ePVSjp1H7XbzaEsb/q1qSZiNhOR5R6cpygTAPwaNSMiP/CwD8d5bJPDPe7JSD8d/cB/tBY/5a8WgkJV346q072/hmqUxaL4Y6ATknmUTW7ahdZuwS/ergi4Tb4NwI/qSGQkInv7FqItUc8ueKJsoYaf9csQK1W1PxBQ0iXH+AiPuicp5nDcdiHfHvvUEaJYROzG+6NeQtwj+o/x+97h70suaEudForFzSBxhNrwNFSEiHxPRG4H8GDCVCL2ngftvfb+jp8axhF9VIQj+vP2g6nb4bvbi086zwdemhhVQftOB/BU4tvtg4u9//QUDv4nRCS1fLGuiEY54Ta0UGdFOcTHrzRE5Mceh6XsvW97/y1e35AMJ2hLNxyCOdu8FPgs+TZmyxBnruNREiJyut+6sUy+VWD1zPd6gwVtubNDWFtV4MQ24La0yKpFObasNbPH+65KzP1YfdcOtaberaBFZC9PBB8CxZyeEJse4+OYmp/XeMR+rtdfeIa2y5djAitlIvf0hNh0TOr0H76VZlGy6mT27rb0hhK0BZAJjZy/PvBZsnvWu22LMjbxocnFDchcZvVf7O3p+Og7NCTsm6ki55NvcJvuV3MzzmtQyur+tlj87I5maNuDDsFir5E8mYiGt2coQVvinBAYby1DZIejUdPCJZzt7epI0OYVFQKXG3lyUgNzsR/k7epoDX1gYCWWOi1bRCRNQG2SiuPch2TYGTr0A8R8XAmpCvOzRieCNifsECypJSFVcXingg5NLcGkNqRKDu7oxkrEWnFEzl52XEM3DlXVnk5m6K+qaQ8hUey0IhhK0IXvczmpsmARUngToqeEtXDoxyQhIbzbqaA/DXo98J3A5wgJwUIgdHSw8mHEV+ffkCmqKmghInIpgN+heVg8j45m6NADklAfENL8CwZb0Sy2Dr740FPCEXaKFMCkYeiOiEYWBKZJPDs40tJQgg5NOZbMoZw0jlVoeHuGEnRIoEDjyMDnyDCIyFo72ClYJidswkovTWCXbekpwa/5aBHhsiMxbtOdHHGq9k/XHbHmHvbYeXWyzUM0f1FE0JZsfVNAZfsCGBfwHBmacW7bImzycUyGqlpE1HtRL/d6O9CxoD0z0xuBFVrEUpKWEJu+UVK2sd/UGLfwaa8/KNDMhsBKd7pFQJIQYtMNJbTDJrt/ALgNwDpUi9V3m9cfJOjXAys+VUQo6kS4LU8NePR1lISq/slzlVcl6nWeF97qRaigXwtMrm7Res4IeI7sGrNl0QhIW3z8SkNV/wDg+gqWH/b+670+BAtaVd+L+AVOEJHQXOLEcRuGpARZ5+NXKj5jXg3gjhJ2P7b5e68ebmbupxPBvRzYmDMB9AY+S76h121ZlJdREbamVdVrAFyacJ/a3nOpvXeoNXNI0qA1/kvZJzCwHjPHxhESFHGbj1ul2FaaiDxTZ46VYZMG9f0nEcvz8ZOiL2fSoNqSBj2lqpPQwixYnaZ1ezFQ0DYQFiWSgg5jSoCYERjxPzkuzrcHxs0om04/2p6LiIg0RURODny2tbjNCmeBwo5xsvFqJR0JWlXfivC0sj8zUwOfbTNTAyPArvLxaiU9BfcCtwfWY7F8a1/TdQtuK4vDXJTtbU+l17GgVXWVf6CEsD+AGSJyQODzrcFtNMNtVpQVPk6tpejBR6igjZ8CmBXxfFuY5bYKYQVaTlFBPxG5cT5LRM6JeD5r3DahP/qVPj6tppCgVfVLAI9H1GdO6leIyPcj3pElbpMrIu5kPu7j02oK+1qoqiUWfyTyKPeqktKNdSVui6siXAUe8XFpPaHOQ0sjr7RfDmBuxPO5MddtEsJWHw8SKmhVtfP2JZF1zxWRK9Fy3AYxP+4lPh4kYoY2Hoh0gLHz/BtE5GdoKd73GyLiAa7xcSCxglZVu3x5f6QP7CGekLx1ovY+z3cbhGB2v9/HgThRDviqujTBDWDLh7igTcsP7+uCiFyQ/TefuXYeRIobJYsBrI58h81SN4vIL3Pe/bC+WR+trxEzM9zeZneSWtCqaoFM7koQ/2Gkz1q357hP7X263fsYE0Pb7HyX250Mxhz8UxQAs31dpwmK+SOck6ptdRfri/cp1i5m39l190cbXDq6sdIpInKTf+ikwPx677Oiqh+jex2NZnlJER7NrvHfmOA9+ZJ4JrI/pXcnmqX7izncTKr7lx9gi0ne9lR2MLuOrLtf2qYZ2hCRwwAsBHBJwtd+4kECl6nqK2j+TZOp7s8c4gK6Kx4CME9V30/0vmxJLui+l4ocAcCWHxcmfrVdqLQgfcubdvHWL7RO8RJy02R3PAbgRu431yjovheLHOXr6dSi7r9N/qTfzlhdV6JPDwLT66EGJgVeaB1OzAvafKWqKKUJesBMPS/x8mMwL/gt55dUdad8GyXHmjvDIxqFBIHpdJmxkDNzgwQ9YE19nfv6lomFjV3rSWReBbBeVUNvqu8q2Pg4D2nbHzixzAOgewDcyjVzAwXdV4mI7X5c615lVWWa/cwDmLzjUew3eyIkC27ykQc66Y/MY20a6TkWD/ZMXqM9X8yRHiSlaLDxEKw9izxkbGji01ZTiaC/rkxktgf2s6UI2RlbWvxKVeuOjt/VVCrovgpF7CNqDgM5fss3w46zY31iWk/lgu6rVGSs39CYHRgEMhfsKNtm5MX0zehiQX9duch0ADMBjEf7WOP+zHQBzUXQA7b2LvPgKkVCr3YrW/362gPckstQ0P2IiMUSthl7GvLFbssv5R3AFgi6HxG5CMAFHjQ7F1Z63AyGGmiboA0R2RPA+RYs3csIdB/b3dvOyhMMAtNiQQ9ERCa6r4T92w0plze7M//TbQ+cWAeNF/QgZ6ez3H9iQsO2+7a5P4mV5+hMVB9dI+iBiMiJvtV3GoBTIi+chrLFU95Ztqk1qmr+I6RmulLQAxERCwVwAoDjARwL4BgAY0qoapPnPt/gGVpfqyIPIGmZoAfjYRBsb3usO9qPcmcjczo6EMB+7oi0tydN+sqdgswZ6FMAH7oDkzkyveeXCuwUb2NJieBJQrITNGk3TF1MsoKCJllBQZOsoKBJVlDQJCsoaJIVFDTJCgqaZAUFTbKCgiZZQUGTrKCgSVZQ0CQrKGiSFRQ0yQoKmmQFBU2ygoImWUFBk6ygoElWUNAkKyhokhUUNMkKCppkBQVNsoKCJllBQRPkxP8BREfPStnUCKgAAAAASUVORK5CYII=";
|
|
@@ -20283,9 +20411,9 @@ var OPENAPI_GLOBS = [
|
|
|
20283
20411
|
"openapi.yaml",
|
|
20284
20412
|
"openapi.yml"
|
|
20285
20413
|
];
|
|
20286
|
-
var toPosix2 = (p) => p.split(
|
|
20414
|
+
var toPosix2 = (p) => p.split(path68.sep).join("/");
|
|
20287
20415
|
var sanitizePackageName = (dir) => {
|
|
20288
|
-
const base =
|
|
20416
|
+
const base = path68.basename(path68.resolve(dir));
|
|
20289
20417
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
20290
20418
|
return s || "apitogo-site";
|
|
20291
20419
|
};
|
|
@@ -20295,14 +20423,14 @@ var apitogoVersionRange = () => {
|
|
|
20295
20423
|
};
|
|
20296
20424
|
async function findOpenApiSpecPath(dir) {
|
|
20297
20425
|
for (const rel2 of OPENAPI_GLOBS) {
|
|
20298
|
-
const full =
|
|
20426
|
+
const full = path68.join(dir, rel2);
|
|
20299
20427
|
try {
|
|
20300
20428
|
await access11(full, constants.R_OK);
|
|
20301
20429
|
return toPosix2(rel2);
|
|
20302
20430
|
} catch {
|
|
20303
20431
|
}
|
|
20304
20432
|
}
|
|
20305
|
-
const extra = await
|
|
20433
|
+
const extra = await glob7("apis/**/*.{json,yaml,yml}", {
|
|
20306
20434
|
cwd: dir,
|
|
20307
20435
|
posix: true,
|
|
20308
20436
|
ignore: ["**/node_modules/**"]
|
|
@@ -20310,7 +20438,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
20310
20438
|
return extra[0] ? toPosix2(extra[0]) : null;
|
|
20311
20439
|
}
|
|
20312
20440
|
async function ensurePackageJson(dir) {
|
|
20313
|
-
const pkgPath =
|
|
20441
|
+
const pkgPath = path68.join(dir, "package.json");
|
|
20314
20442
|
const apitogoVer = apitogoVersionRange();
|
|
20315
20443
|
const baseDeps = {
|
|
20316
20444
|
react: ">=19.0.0",
|
|
@@ -20377,7 +20505,7 @@ async function ensurePackageJson(dir) {
|
|
|
20377
20505
|
return false;
|
|
20378
20506
|
}
|
|
20379
20507
|
async function ensureTsconfigJson(dir) {
|
|
20380
|
-
const tsPath =
|
|
20508
|
+
const tsPath = path68.join(dir, "tsconfig.json");
|
|
20381
20509
|
try {
|
|
20382
20510
|
await access11(tsPath, constants.R_OK);
|
|
20383
20511
|
return false;
|
|
@@ -20426,40 +20554,40 @@ var fileExists2 = async (filePath) => {
|
|
|
20426
20554
|
}
|
|
20427
20555
|
};
|
|
20428
20556
|
async function ensurePortalStubFiles(dir) {
|
|
20429
|
-
const landingPath =
|
|
20557
|
+
const landingPath = path68.join(dir, "landing", "LandingPage.tsx");
|
|
20430
20558
|
if (!await fileExists2(landingPath)) {
|
|
20431
|
-
await mkdir16(
|
|
20559
|
+
await mkdir16(path68.join(dir, "landing"), { recursive: true });
|
|
20432
20560
|
await writeFile19(landingPath, LANDING_PAGE_SOURCE, "utf8");
|
|
20433
20561
|
}
|
|
20434
|
-
const plansPath =
|
|
20562
|
+
const plansPath = path68.join(dir, "user-panel", "AccountPlansPage.tsx");
|
|
20435
20563
|
if (!await fileExists2(plansPath)) {
|
|
20436
|
-
await mkdir16(
|
|
20564
|
+
await mkdir16(path68.join(dir, "user-panel"), { recursive: true });
|
|
20437
20565
|
await writeFile19(plansPath, ACCOUNT_PLANS_PAGE_SOURCE, "utf8");
|
|
20438
20566
|
}
|
|
20439
|
-
const dashboardPath =
|
|
20567
|
+
const dashboardPath = path68.join(dir, "user-panel", "DashboardPage.tsx");
|
|
20440
20568
|
if (!await fileExists2(dashboardPath)) {
|
|
20441
|
-
await mkdir16(
|
|
20569
|
+
await mkdir16(path68.join(dir, "user-panel"), { recursive: true });
|
|
20442
20570
|
await writeFile19(dashboardPath, DASHBOARD_PAGE_SOURCE, "utf8");
|
|
20443
20571
|
}
|
|
20444
20572
|
await ensurePublicBrandingFiles(dir);
|
|
20445
20573
|
}
|
|
20446
20574
|
async function ensurePublicBrandingFiles(dir) {
|
|
20447
|
-
const destDir =
|
|
20575
|
+
const destDir = path68.join(dir, "public");
|
|
20448
20576
|
await mkdir16(destDir, { recursive: true });
|
|
20449
20577
|
for (const { name, content } of BRANDING_ASSETS) {
|
|
20450
|
-
const dest =
|
|
20578
|
+
const dest = path68.join(destDir, name);
|
|
20451
20579
|
if (await fileExists2(dest)) {
|
|
20452
20580
|
continue;
|
|
20453
20581
|
}
|
|
20454
20582
|
await writeFile19(dest, content, "utf8");
|
|
20455
20583
|
}
|
|
20456
|
-
const faviconDest =
|
|
20584
|
+
const faviconDest = path68.join(destDir, "Icon.png");
|
|
20457
20585
|
if (!await fileExists2(faviconDest)) {
|
|
20458
20586
|
await writeFile19(faviconDest, Buffer.from(FAVICON_PNG_BASE64, "base64"));
|
|
20459
20587
|
}
|
|
20460
20588
|
}
|
|
20461
20589
|
async function ensureThinConfigTsx(dir) {
|
|
20462
|
-
const tsxPath =
|
|
20590
|
+
const tsxPath = path68.join(dir, "apitogo.config.tsx");
|
|
20463
20591
|
if (await fileExists2(tsxPath)) {
|
|
20464
20592
|
return false;
|
|
20465
20593
|
}
|
|
@@ -20468,7 +20596,7 @@ async function ensureThinConfigTsx(dir) {
|
|
|
20468
20596
|
}
|
|
20469
20597
|
|
|
20470
20598
|
// src/cli/make-config/handler.ts
|
|
20471
|
-
var toPosixPath2 = (value) => value.split(
|
|
20599
|
+
var toPosixPath2 = (value) => value.split(path69.sep).join(path69.posix.sep);
|
|
20472
20600
|
var fileExists3 = async (filePath) => {
|
|
20473
20601
|
try {
|
|
20474
20602
|
await access12(filePath, constants2.F_OK);
|
|
@@ -20501,7 +20629,7 @@ function shouldRunInteractive(argv) {
|
|
|
20501
20629
|
return input2.isTTY === true;
|
|
20502
20630
|
}
|
|
20503
20631
|
async function persistConfig(config2, ctx) {
|
|
20504
|
-
const pageFiles = await
|
|
20632
|
+
const pageFiles = await glob8(`${ctx.pagesDir}/**/*.{md,mdx,tsx,jsx}`, {
|
|
20505
20633
|
cwd: ctx.dir,
|
|
20506
20634
|
ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**"],
|
|
20507
20635
|
posix: true
|
|
@@ -20512,21 +20640,21 @@ async function persistConfig(config2, ctx) {
|
|
|
20512
20640
|
(file) => toRoutePath(file, ctx.pagesDir)
|
|
20513
20641
|
);
|
|
20514
20642
|
const tsxRoutes = tsxFiles.map((file) => toRoutePath(file, ctx.pagesDir));
|
|
20515
|
-
const
|
|
20516
|
-
if (
|
|
20643
|
+
const docRoutes2 = [.../* @__PURE__ */ new Set([...markdownRoutes, ...tsxRoutes])];
|
|
20644
|
+
if (docRoutes2.length === 0) {
|
|
20517
20645
|
printHintToConsole(
|
|
20518
20646
|
`No docs pages under '${ctx.pagesDir}/' \u2014 skipping documentation nav scan.`
|
|
20519
20647
|
);
|
|
20520
20648
|
}
|
|
20521
20649
|
const next = {
|
|
20522
20650
|
...config2,
|
|
20523
|
-
navigation: mergeDocumentationNavigation(config2.navigation,
|
|
20651
|
+
navigation: mergeDocumentationNavigation(config2.navigation, docRoutes2, {
|
|
20524
20652
|
force: ctx.force
|
|
20525
20653
|
})
|
|
20526
20654
|
};
|
|
20527
20655
|
await writeFile20(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
|
|
20528
20656
|
`, "utf8");
|
|
20529
|
-
const tsxPath =
|
|
20657
|
+
const tsxPath = path69.join(ctx.dir, "apitogo.config.tsx");
|
|
20530
20658
|
if (await fileExists3(tsxPath) && tsxRoutes.length > 0) {
|
|
20531
20659
|
const tsxSource = await readFile22(tsxPath, "utf8");
|
|
20532
20660
|
if (isManagedConfigWrapper(tsxSource)) {
|
|
@@ -20553,7 +20681,7 @@ function mergeBackendFlag(config2, backend) {
|
|
|
20553
20681
|
return next;
|
|
20554
20682
|
}
|
|
20555
20683
|
async function makeConfig(argv) {
|
|
20556
|
-
const dir =
|
|
20684
|
+
const dir = path69.resolve(process.cwd(), argv.dir);
|
|
20557
20685
|
const pagesDir = toPosixPath2(
|
|
20558
20686
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
20559
20687
|
);
|
|
@@ -20573,14 +20701,14 @@ async function makeConfig(argv) {
|
|
|
20573
20701
|
printSuccessToConsole("Created tsconfig.json.");
|
|
20574
20702
|
}
|
|
20575
20703
|
await ensurePortalStubFiles(dir);
|
|
20576
|
-
const jsonPath =
|
|
20704
|
+
const jsonPath = path69.join(dir, APITOGO_JSON_FILENAME);
|
|
20577
20705
|
let createdJson = false;
|
|
20578
20706
|
let config2;
|
|
20579
20707
|
if (await fileExists3(jsonPath)) {
|
|
20580
20708
|
config2 = await readJsonConfig(jsonPath);
|
|
20581
20709
|
} else {
|
|
20582
20710
|
config2 = createDefaultApitogoJsonConfig({
|
|
20583
|
-
title: titleFromDirectoryName(
|
|
20711
|
+
title: titleFromDirectoryName(path69.basename(dir)),
|
|
20584
20712
|
pagesDir
|
|
20585
20713
|
});
|
|
20586
20714
|
createdJson = true;
|
|
@@ -20632,8 +20760,8 @@ async function makeConfig(argv) {
|
|
|
20632
20760
|
return;
|
|
20633
20761
|
}
|
|
20634
20762
|
if (action2.kind === "page") {
|
|
20635
|
-
const pagePath =
|
|
20636
|
-
await mkdir17(
|
|
20763
|
+
const pagePath = path69.join(dir, action2.page.relativePath);
|
|
20764
|
+
await mkdir17(path69.dirname(pagePath), { recursive: true });
|
|
20637
20765
|
await writeFile20(
|
|
20638
20766
|
pagePath,
|
|
20639
20767
|
buildStarterDocsPageTsx(action2.page.slug, action2.page.title),
|
|
@@ -20700,7 +20828,7 @@ async function makeConfig(argv) {
|
|
|
20700
20828
|
if (argv.openapi) {
|
|
20701
20829
|
const wire = await wireDevPortalOpenApi(
|
|
20702
20830
|
dir,
|
|
20703
|
-
|
|
20831
|
+
path69.resolve(dir, argv.openapi)
|
|
20704
20832
|
);
|
|
20705
20833
|
if (wire.status !== "succeeded") {
|
|
20706
20834
|
throw new Error(
|
|
@@ -20729,7 +20857,7 @@ async function makeConfig(argv) {
|
|
|
20729
20857
|
const slug = normalizePageSlug2(argv.pageSlug);
|
|
20730
20858
|
const pageTemplate = normalizePageTemplate(argv.pageTemplate);
|
|
20731
20859
|
const relativePagePath = pageComponentRelativePath(slug);
|
|
20732
|
-
const filePath =
|
|
20860
|
+
const filePath = path69.join(dir, relativePagePath);
|
|
20733
20861
|
const isUpdate = argv.pageUpdate === true;
|
|
20734
20862
|
if (isUpdate) {
|
|
20735
20863
|
if (!await fileExists3(filePath)) {
|
|
@@ -20762,7 +20890,7 @@ async function makeConfig(argv) {
|
|
|
20762
20890
|
argv.pageContent,
|
|
20763
20891
|
pageTemplate
|
|
20764
20892
|
);
|
|
20765
|
-
await mkdir17(
|
|
20893
|
+
await mkdir17(path69.dirname(filePath), { recursive: true });
|
|
20766
20894
|
await writeFile20(filePath, tsx, "utf8");
|
|
20767
20895
|
const configResult = await wireNewDevPortalPageInConfig(
|
|
20768
20896
|
dir,
|
|
@@ -20775,7 +20903,7 @@ async function makeConfig(argv) {
|
|
|
20775
20903
|
pagePath: relativePagePath,
|
|
20776
20904
|
pageTemplate,
|
|
20777
20905
|
configUpdated: configResult.updated,
|
|
20778
|
-
configPath: configResult.configPath ?
|
|
20906
|
+
configPath: configResult.configPath ? path69.relative(dir, configResult.configPath) : null
|
|
20779
20907
|
};
|
|
20780
20908
|
changes.push("page_add");
|
|
20781
20909
|
}
|
|
@@ -20900,10 +21028,10 @@ var config_default = {
|
|
|
20900
21028
|
};
|
|
20901
21029
|
|
|
20902
21030
|
// src/cli/cmds/deploy.ts
|
|
20903
|
-
import
|
|
21031
|
+
import path83 from "node:path";
|
|
20904
21032
|
|
|
20905
21033
|
// src/cli/apply/handler.ts
|
|
20906
|
-
import
|
|
21034
|
+
import path80 from "node:path";
|
|
20907
21035
|
|
|
20908
21036
|
// src/cli/platform/helpers/gateway-plan-validation.ts
|
|
20909
21037
|
init_gateway_limits();
|
|
@@ -21098,11 +21226,11 @@ init_gateway_limits();
|
|
|
21098
21226
|
// src/cli/platform/helpers/deploy-artifact-hash.ts
|
|
21099
21227
|
import { createHash as createHash3 } from "node:crypto";
|
|
21100
21228
|
import { createReadStream, promises as fs8 } from "node:fs";
|
|
21101
|
-
import
|
|
21229
|
+
import path71 from "node:path";
|
|
21102
21230
|
|
|
21103
21231
|
// src/cli/platform/helpers/package-files.ts
|
|
21104
21232
|
import { promises as fs7 } from "node:fs";
|
|
21105
|
-
import
|
|
21233
|
+
import path70 from "node:path";
|
|
21106
21234
|
import ignore from "ignore";
|
|
21107
21235
|
var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
21108
21236
|
"node_modules",
|
|
@@ -21115,7 +21243,7 @@ var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
|
21115
21243
|
async function loadGitignore(rootDir) {
|
|
21116
21244
|
const ig = ignore();
|
|
21117
21245
|
ig.add(["node_modules/", ".git/", "dist/", "bin/", "obj/"]);
|
|
21118
|
-
const gitignorePath =
|
|
21246
|
+
const gitignorePath = path70.join(rootDir, ".gitignore");
|
|
21119
21247
|
try {
|
|
21120
21248
|
const content = await fs7.readFile(gitignorePath, "utf8");
|
|
21121
21249
|
ig.add(content);
|
|
@@ -21124,11 +21252,11 @@ async function loadGitignore(rootDir) {
|
|
|
21124
21252
|
return ig;
|
|
21125
21253
|
}
|
|
21126
21254
|
async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
21127
|
-
const absDir =
|
|
21255
|
+
const absDir = path70.join(rootDir, relativeDir);
|
|
21128
21256
|
const entries = await fs7.readdir(absDir, { withFileTypes: true });
|
|
21129
21257
|
for (const entry of entries) {
|
|
21130
|
-
const rel2 = relativeDir ?
|
|
21131
|
-
const relPosix = rel2.split(
|
|
21258
|
+
const rel2 = relativeDir ? path70.join(relativeDir, entry.name) : entry.name;
|
|
21259
|
+
const relPosix = rel2.split(path70.sep).join("/");
|
|
21132
21260
|
if (DEFAULT_EXCLUDES.has(entry.name) && !relativeDir) {
|
|
21133
21261
|
continue;
|
|
21134
21262
|
}
|
|
@@ -21143,7 +21271,7 @@ async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
|
21143
21271
|
}
|
|
21144
21272
|
}
|
|
21145
21273
|
async function collectPackageableFiles(sourceDirectory) {
|
|
21146
|
-
const resolved =
|
|
21274
|
+
const resolved = path70.resolve(sourceDirectory);
|
|
21147
21275
|
const stat7 = await fs7.stat(resolved).catch(() => null);
|
|
21148
21276
|
if (!stat7?.isDirectory()) {
|
|
21149
21277
|
throw new Error(`sourceDirectory is not a directory: ${resolved}`);
|
|
@@ -21169,7 +21297,7 @@ async function sha256File(filePath) {
|
|
|
21169
21297
|
return hash2.digest("hex");
|
|
21170
21298
|
}
|
|
21171
21299
|
async function hashDirectoryContents(rootDirectory) {
|
|
21172
|
-
const resolved =
|
|
21300
|
+
const resolved = path71.resolve(rootDirectory);
|
|
21173
21301
|
const files = (await collectPackageableFiles(resolved)).sort(
|
|
21174
21302
|
(a, b) => a.localeCompare(b)
|
|
21175
21303
|
);
|
|
@@ -21177,13 +21305,13 @@ async function hashDirectoryContents(rootDirectory) {
|
|
|
21177
21305
|
for (const rel2 of files) {
|
|
21178
21306
|
hash2.update(rel2);
|
|
21179
21307
|
hash2.update("\0");
|
|
21180
|
-
hash2.update(await fs8.readFile(
|
|
21308
|
+
hash2.update(await fs8.readFile(path71.join(resolved, rel2)));
|
|
21181
21309
|
hash2.update("\0");
|
|
21182
21310
|
}
|
|
21183
21311
|
return hash2.digest("hex");
|
|
21184
21312
|
}
|
|
21185
21313
|
async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
21186
|
-
const resolved =
|
|
21314
|
+
const resolved = path71.resolve(siteDirectory);
|
|
21187
21315
|
const hash2 = createHash3("sha256");
|
|
21188
21316
|
const candidates = [
|
|
21189
21317
|
"apitogo.config.json",
|
|
@@ -21193,7 +21321,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
21193
21321
|
"zudoku.config.tsx"
|
|
21194
21322
|
];
|
|
21195
21323
|
for (const name of candidates) {
|
|
21196
|
-
const full =
|
|
21324
|
+
const full = path71.join(resolved, name);
|
|
21197
21325
|
try {
|
|
21198
21326
|
hash2.update(name);
|
|
21199
21327
|
hash2.update("\0");
|
|
@@ -21203,7 +21331,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
21203
21331
|
}
|
|
21204
21332
|
}
|
|
21205
21333
|
for (const dir of ["pages", "landing", "src"]) {
|
|
21206
|
-
const full =
|
|
21334
|
+
const full = path71.join(resolved, dir);
|
|
21207
21335
|
try {
|
|
21208
21336
|
const st = await fs8.stat(full);
|
|
21209
21337
|
if (!st.isDirectory()) continue;
|
|
@@ -21432,8 +21560,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
21432
21560
|
const trimmed = actionKey2.trim();
|
|
21433
21561
|
if (trimmed.includes(":")) {
|
|
21434
21562
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
21435
|
-
const
|
|
21436
|
-
return `${method2?.toLowerCase()}:${
|
|
21563
|
+
const path102 = pathParts.join(":").trim();
|
|
21564
|
+
return `${method2?.toLowerCase()}:${path102.startsWith("/") ? path102 : `/${path102}`}`;
|
|
21437
21565
|
}
|
|
21438
21566
|
const spaceIndex = trimmed.indexOf(" ");
|
|
21439
21567
|
if (spaceIndex <= 0) {
|
|
@@ -21442,8 +21570,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
21442
21570
|
);
|
|
21443
21571
|
}
|
|
21444
21572
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
21445
|
-
const
|
|
21446
|
-
return `${method}:${
|
|
21573
|
+
const path101 = trimmed.slice(spaceIndex + 1).trim();
|
|
21574
|
+
return `${method}:${path101.startsWith("/") ? path101 : `/${path101}`}`;
|
|
21447
21575
|
}
|
|
21448
21576
|
async function applyGatewayPublicRoutes(client, projectId, routes, options) {
|
|
21449
21577
|
const applied = [];
|
|
@@ -21922,7 +22050,7 @@ async function upsertGatewayPlansFromManifest(client, config2, projectId, plans,
|
|
|
21922
22050
|
|
|
21923
22051
|
// src/cli/platform/helpers/openapi-gateway-servers.ts
|
|
21924
22052
|
import { mkdir as mkdir18, readFile as readFile23, writeFile as writeFile21 } from "node:fs/promises";
|
|
21925
|
-
import
|
|
22053
|
+
import path72 from "node:path";
|
|
21926
22054
|
import YAML3 from "yaml";
|
|
21927
22055
|
var GATEWAY_URL_ENV_KEY = "APITOGO_GATEWAY_URL";
|
|
21928
22056
|
var PUBLISH_OPENAPI_RELATIVE = ".apitogo/openapi-publish.json";
|
|
@@ -21954,7 +22082,7 @@ async function resolveProjectGatewayUrl(client, projectId) {
|
|
|
21954
22082
|
}
|
|
21955
22083
|
async function readOpenApiDocument(filePath) {
|
|
21956
22084
|
const content = await readFile23(filePath, "utf8");
|
|
21957
|
-
const ext =
|
|
22085
|
+
const ext = path72.extname(filePath).toLowerCase();
|
|
21958
22086
|
const parsed = ext === ".json" ? JSON.parse(content) : YAML3.parse(content);
|
|
21959
22087
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
21960
22088
|
throw new Error(`OpenAPI document must be an object: ${filePath}`);
|
|
@@ -21962,13 +22090,13 @@ async function readOpenApiDocument(filePath) {
|
|
|
21962
22090
|
return parsed;
|
|
21963
22091
|
}
|
|
21964
22092
|
async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApiPath, gatewayUrl) {
|
|
21965
|
-
const site =
|
|
21966
|
-
const source =
|
|
22093
|
+
const site = path72.resolve(siteDirectory);
|
|
22094
|
+
const source = path72.resolve(sourceOpenApiPath);
|
|
21967
22095
|
const relativeInput = PUBLISH_OPENAPI_RELATIVE;
|
|
21968
|
-
const outputPath =
|
|
22096
|
+
const outputPath = path72.join(site, ...relativeInput.split("/"));
|
|
21969
22097
|
const doc = await readOpenApiDocument(source);
|
|
21970
22098
|
const rewritten = withGatewayServers(doc, gatewayUrl);
|
|
21971
|
-
await mkdir18(
|
|
22099
|
+
await mkdir18(path72.dirname(outputPath), { recursive: true });
|
|
21972
22100
|
await writeFile21(
|
|
21973
22101
|
outputPath,
|
|
21974
22102
|
`${JSON.stringify(rewritten, null, 2)}
|
|
@@ -21978,8 +22106,8 @@ async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApi
|
|
|
21978
22106
|
return { outputPath, relativeInput };
|
|
21979
22107
|
}
|
|
21980
22108
|
async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
21981
|
-
const configPath =
|
|
21982
|
-
|
|
22109
|
+
const configPath = path72.join(
|
|
22110
|
+
path72.resolve(siteDirectory),
|
|
21983
22111
|
APITOGO_CONFIG_FILENAME2
|
|
21984
22112
|
);
|
|
21985
22113
|
const raw = await readFile23(configPath, "utf8");
|
|
@@ -22021,7 +22149,7 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
|
22021
22149
|
};
|
|
22022
22150
|
}
|
|
22023
22151
|
async function prepareOpenApiServersForGatewayBuild(options) {
|
|
22024
|
-
const siteDirectory =
|
|
22152
|
+
const siteDirectory = path72.resolve(options.siteDirectory);
|
|
22025
22153
|
let openApiPath = resolveBackendOpenApiPath(
|
|
22026
22154
|
options.manifest?.backend?.openApiPath,
|
|
22027
22155
|
{
|
|
@@ -22035,7 +22163,7 @@ async function prepareOpenApiServersForGatewayBuild(options) {
|
|
|
22035
22163
|
if (!openApiPath) {
|
|
22036
22164
|
try {
|
|
22037
22165
|
const raw = await readFile23(
|
|
22038
|
-
|
|
22166
|
+
path72.join(siteDirectory, APITOGO_CONFIG_FILENAME2),
|
|
22039
22167
|
"utf8"
|
|
22040
22168
|
);
|
|
22041
22169
|
const config2 = JSON.parse(raw);
|
|
@@ -22064,8 +22192,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22064
22192
|
const trimmed = actionKey2.trim();
|
|
22065
22193
|
if (trimmed.includes(":")) {
|
|
22066
22194
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
22067
|
-
const
|
|
22068
|
-
return `${method2.toLowerCase()}:${
|
|
22195
|
+
const path102 = pathParts.join(":").trim();
|
|
22196
|
+
return `${method2.toLowerCase()}:${path102.startsWith("/") ? path102 : `/${path102}`}`;
|
|
22069
22197
|
}
|
|
22070
22198
|
const spaceIndex = trimmed.indexOf(" ");
|
|
22071
22199
|
if (spaceIndex <= 0) {
|
|
@@ -22074,8 +22202,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22074
22202
|
);
|
|
22075
22203
|
}
|
|
22076
22204
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
22077
|
-
const
|
|
22078
|
-
return `${method}:${
|
|
22205
|
+
const path101 = trimmed.slice(spaceIndex + 1).trim();
|
|
22206
|
+
return `${method}:${path101.startsWith("/") ? path101 : `/${path101}`}`;
|
|
22079
22207
|
}
|
|
22080
22208
|
function normalizePublicRoute(route) {
|
|
22081
22209
|
const trimmed = route.trim();
|
|
@@ -22109,10 +22237,10 @@ function collectManifestPublicActionKeys(gateway) {
|
|
|
22109
22237
|
|
|
22110
22238
|
// src/cli/platform/helpers/publish-ledger.ts
|
|
22111
22239
|
import { mkdir as mkdir19, readFile as readFile24, writeFile as writeFile22 } from "node:fs/promises";
|
|
22112
|
-
import
|
|
22240
|
+
import path73 from "node:path";
|
|
22113
22241
|
var PUBLISH_LEDGER_RELATIVE_PATH = ".apitogo/publish-state.json";
|
|
22114
22242
|
function publishLedgerPath(siteDirectory) {
|
|
22115
|
-
return
|
|
22243
|
+
return path73.join(path73.resolve(siteDirectory), PUBLISH_LEDGER_RELATIVE_PATH);
|
|
22116
22244
|
}
|
|
22117
22245
|
async function readPublishLedger(siteDirectory) {
|
|
22118
22246
|
const filePath = publishLedgerPath(siteDirectory);
|
|
@@ -22129,7 +22257,7 @@ async function readPublishLedger(siteDirectory) {
|
|
|
22129
22257
|
}
|
|
22130
22258
|
async function writePublishLedger(siteDirectory, ledger) {
|
|
22131
22259
|
const filePath = publishLedgerPath(siteDirectory);
|
|
22132
|
-
await mkdir19(
|
|
22260
|
+
await mkdir19(path73.dirname(filePath), { recursive: true });
|
|
22133
22261
|
const next = {
|
|
22134
22262
|
...ledger,
|
|
22135
22263
|
version: 1,
|
|
@@ -22651,7 +22779,7 @@ async function createProjectWithWarmPoolRetry(client, body, options) {
|
|
|
22651
22779
|
import { spawn as spawn4 } from "node:child_process";
|
|
22652
22780
|
import { mkdtemp, readdir as readdir2, rm as rm11 } from "node:fs/promises";
|
|
22653
22781
|
import { tmpdir } from "node:os";
|
|
22654
|
-
import
|
|
22782
|
+
import path74 from "node:path";
|
|
22655
22783
|
async function directoryHasRuntimeConfig(dir) {
|
|
22656
22784
|
if (!await pathExists(dir)) {
|
|
22657
22785
|
return false;
|
|
@@ -22694,20 +22822,20 @@ function runDotnetPublish(projectDir, outputDir) {
|
|
|
22694
22822
|
async function findCsproj(projectDir) {
|
|
22695
22823
|
const entries = await readdir2(projectDir);
|
|
22696
22824
|
const csproj = entries.find((name) => name.endsWith(".csproj"));
|
|
22697
|
-
return csproj ?
|
|
22825
|
+
return csproj ? path74.join(projectDir, csproj) : null;
|
|
22698
22826
|
}
|
|
22699
22827
|
async function prepareBackendPackagingDirectory(args) {
|
|
22700
|
-
const sourceDirectory =
|
|
22828
|
+
const sourceDirectory = path74.resolve(args.sourceDirectory);
|
|
22701
22829
|
if (args.publishDirectory?.trim()) {
|
|
22702
22830
|
return {
|
|
22703
|
-
directory:
|
|
22831
|
+
directory: path74.resolve(args.publishDirectory),
|
|
22704
22832
|
packagingMode: "published"
|
|
22705
22833
|
};
|
|
22706
22834
|
}
|
|
22707
22835
|
if (await directoryHasRuntimeConfig(sourceDirectory)) {
|
|
22708
22836
|
return { directory: sourceDirectory, packagingMode: "published" };
|
|
22709
22837
|
}
|
|
22710
|
-
const publishSubdir =
|
|
22838
|
+
const publishSubdir = path74.join(sourceDirectory, "publish");
|
|
22711
22839
|
if (await directoryHasRuntimeConfig(publishSubdir)) {
|
|
22712
22840
|
return { directory: publishSubdir, packagingMode: "published" };
|
|
22713
22841
|
}
|
|
@@ -22719,9 +22847,9 @@ async function prepareBackendPackagingDirectory(args) {
|
|
|
22719
22847
|
return { directory: sourceDirectory, packagingMode: "source" };
|
|
22720
22848
|
}
|
|
22721
22849
|
const tempRoot = await mkdtemp(
|
|
22722
|
-
|
|
22850
|
+
path74.join(tmpdir(), "apitogo-dotnet-publish-")
|
|
22723
22851
|
);
|
|
22724
|
-
const outputDir =
|
|
22852
|
+
const outputDir = path74.join(tempRoot, "publish");
|
|
22725
22853
|
const result = await runDotnetPublish(sourceDirectory, outputDir);
|
|
22726
22854
|
if (result.exitCode !== 0) {
|
|
22727
22855
|
await rm11(tempRoot, { recursive: true, force: true });
|
|
@@ -22767,12 +22895,12 @@ function formatJobStatusResponse(options) {
|
|
|
22767
22895
|
// src/cli/platform/helpers/zip.ts
|
|
22768
22896
|
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as fs9 } from "node:fs";
|
|
22769
22897
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
22770
|
-
import
|
|
22898
|
+
import path75 from "node:path";
|
|
22771
22899
|
import { ZipArchive } from "archiver";
|
|
22772
22900
|
async function packageBackendDirectory(sourceDirectory) {
|
|
22773
|
-
const resolved =
|
|
22901
|
+
const resolved = path75.resolve(sourceDirectory);
|
|
22774
22902
|
const files = await collectPackageableFiles(resolved);
|
|
22775
|
-
const zipPath =
|
|
22903
|
+
const zipPath = path75.join(
|
|
22776
22904
|
tmpdir2(),
|
|
22777
22905
|
`apitogo-backend-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`
|
|
22778
22906
|
);
|
|
@@ -22784,8 +22912,8 @@ async function packageBackendDirectory(sourceDirectory) {
|
|
|
22784
22912
|
output4.on("error", reject);
|
|
22785
22913
|
archive.pipe(output4);
|
|
22786
22914
|
for (const rel2 of files) {
|
|
22787
|
-
archive.append(createReadStream2(
|
|
22788
|
-
name: rel2.split(
|
|
22915
|
+
archive.append(createReadStream2(path75.join(resolved, rel2)), {
|
|
22916
|
+
name: rel2.split(path75.sep).join("/")
|
|
22789
22917
|
});
|
|
22790
22918
|
}
|
|
22791
22919
|
void archive.finalize();
|
|
@@ -24286,11 +24414,11 @@ async function resolveProjectIdForPublish(client, config2, args, wait, progress,
|
|
|
24286
24414
|
}
|
|
24287
24415
|
|
|
24288
24416
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
24289
|
-
import
|
|
24417
|
+
import path79 from "node:path";
|
|
24290
24418
|
|
|
24291
24419
|
// src/cli/platform/helpers/dev-portal-site-api-url.ts
|
|
24292
24420
|
import { readdir as readdir3, readFile as readFile25, writeFile as writeFile23 } from "node:fs/promises";
|
|
24293
|
-
import
|
|
24421
|
+
import path76 from "node:path";
|
|
24294
24422
|
var SITE_API_BASE_URL_ENV_KEY = "VITE_APITOGO_AUTHENTICATION_API_BASE_URL";
|
|
24295
24423
|
var PLACEHOLDER_HOST_MARKERS = [
|
|
24296
24424
|
"dp-example.azurecontainerapps.io",
|
|
@@ -24311,10 +24439,10 @@ function isPlaceholderDevPortalApiUrl(apiBaseUrl) {
|
|
|
24311
24439
|
return PLACEHOLDER_HOST_MARKERS.some((marker) => normalized.includes(marker));
|
|
24312
24440
|
}
|
|
24313
24441
|
async function readSiteApiBaseUrl(sourceDirectory) {
|
|
24314
|
-
const resolved =
|
|
24442
|
+
const resolved = path76.resolve(sourceDirectory);
|
|
24315
24443
|
for (const envFile of [".env", ".env.production"]) {
|
|
24316
24444
|
try {
|
|
24317
|
-
const content = await readFile25(
|
|
24445
|
+
const content = await readFile25(path76.join(resolved, envFile), "utf8");
|
|
24318
24446
|
const lines = [...content.matchAll(ENV_LINE_GLOBAL_RE)];
|
|
24319
24447
|
if (lines.length === 0) {
|
|
24320
24448
|
continue;
|
|
@@ -24339,11 +24467,11 @@ async function readSiteApiBaseUrl(sourceDirectory) {
|
|
|
24339
24467
|
return null;
|
|
24340
24468
|
}
|
|
24341
24469
|
async function patchSiteApiBaseUrl(sourceDirectory, apiBaseUrl) {
|
|
24342
|
-
const resolved =
|
|
24470
|
+
const resolved = path76.resolve(sourceDirectory);
|
|
24343
24471
|
const line2 = `${SITE_API_BASE_URL_ENV_KEY}=${apiBaseUrl}`;
|
|
24344
24472
|
let patchedExisting = false;
|
|
24345
24473
|
for (const envFile of [".env.production", ".env"]) {
|
|
24346
|
-
const envPath =
|
|
24474
|
+
const envPath = path76.join(resolved, envFile);
|
|
24347
24475
|
try {
|
|
24348
24476
|
const content = await readFile25(envPath, "utf8");
|
|
24349
24477
|
const withoutAssignments = content.replace(ENV_LINE_GLOBAL_RE, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
@@ -24357,7 +24485,7 @@ ${line2}
|
|
|
24357
24485
|
}
|
|
24358
24486
|
}
|
|
24359
24487
|
if (!patchedExisting) {
|
|
24360
|
-
await writeFile23(
|
|
24488
|
+
await writeFile23(path76.join(resolved, ".env"), `${line2}
|
|
24361
24489
|
`);
|
|
24362
24490
|
}
|
|
24363
24491
|
}
|
|
@@ -24365,7 +24493,7 @@ function tryProjectId(explicit, manifestProjectId, config2) {
|
|
|
24365
24493
|
return explicit?.trim() || manifestProjectId?.trim() || config2.defaultProjectId?.trim() || void 0;
|
|
24366
24494
|
}
|
|
24367
24495
|
async function ensureLiveSiteApiBaseUrlForBuild(_client, config2, args, resolveFromProject) {
|
|
24368
|
-
const sourceDirectory =
|
|
24496
|
+
const sourceDirectory = path76.resolve(args.sourceDirectory);
|
|
24369
24497
|
const explicit = args.apiBaseUrl?.trim();
|
|
24370
24498
|
if (explicit && !isPlaceholderDevPortalApiUrl(explicit)) {
|
|
24371
24499
|
await patchSiteApiBaseUrl(sourceDirectory, explicit);
|
|
@@ -24401,7 +24529,7 @@ async function* walkFiles(root) {
|
|
|
24401
24529
|
return;
|
|
24402
24530
|
}
|
|
24403
24531
|
for (const entry of entries) {
|
|
24404
|
-
const full =
|
|
24532
|
+
const full = path76.join(root, entry.name);
|
|
24405
24533
|
if (entry.isDirectory()) {
|
|
24406
24534
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
24407
24535
|
continue;
|
|
@@ -24413,8 +24541,8 @@ async function* walkFiles(root) {
|
|
|
24413
24541
|
}
|
|
24414
24542
|
}
|
|
24415
24543
|
async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiBaseUrl) {
|
|
24416
|
-
const dist =
|
|
24417
|
-
const siteRoot =
|
|
24544
|
+
const dist = path76.resolve(distDirectory);
|
|
24545
|
+
const siteRoot = path76.dirname(dist);
|
|
24418
24546
|
const fromEnv = expectedApiBaseUrl?.trim() || await readSiteApiBaseUrl(siteRoot) || await readSiteApiBaseUrl(dist);
|
|
24419
24547
|
if (!fromEnv || isPlaceholderDevPortalApiUrl(fromEnv)) {
|
|
24420
24548
|
throw new Error(
|
|
@@ -24450,7 +24578,7 @@ async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiB
|
|
|
24450
24578
|
|
|
24451
24579
|
// src/cli/platform/tools/dev-portal.ts
|
|
24452
24580
|
import { promises as fs11 } from "node:fs";
|
|
24453
|
-
import
|
|
24581
|
+
import path78 from "node:path";
|
|
24454
24582
|
|
|
24455
24583
|
// src/cli/platform/helpers/dev-portal-backend-job.ts
|
|
24456
24584
|
var DEV_PORTAL_BACKEND_UPDATE_RESOURCE_TYPE = "DevPortalBackendUpdate";
|
|
@@ -24560,7 +24688,7 @@ async function snapshotBackendUpdateJobIds(client, projectId) {
|
|
|
24560
24688
|
// src/cli/platform/helpers/tarball.ts
|
|
24561
24689
|
import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as fs10 } from "node:fs";
|
|
24562
24690
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
24563
|
-
import
|
|
24691
|
+
import path77 from "node:path";
|
|
24564
24692
|
import { TarArchive } from "archiver";
|
|
24565
24693
|
var DEV_PORTAL_DEPLOY_ARCHIVE_ROOT = "dist";
|
|
24566
24694
|
function normalizeArchiveRoot(archiveRoot) {
|
|
@@ -24571,10 +24699,10 @@ function normalizeArchiveRoot(archiveRoot) {
|
|
|
24571
24699
|
return `${trimmed}/`;
|
|
24572
24700
|
}
|
|
24573
24701
|
async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
24574
|
-
const resolved =
|
|
24702
|
+
const resolved = path77.resolve(sourceDirectory);
|
|
24575
24703
|
const files = await collectPackageableFiles(resolved);
|
|
24576
24704
|
const entryPrefix = options?.archiveRoot ? normalizeArchiveRoot(options.archiveRoot) : "";
|
|
24577
|
-
const archivePath =
|
|
24705
|
+
const archivePath = path77.join(
|
|
24578
24706
|
tmpdir3(),
|
|
24579
24707
|
`apitogo-docs-${Date.now()}-${Math.random().toString(36).slice(2)}.tgz`
|
|
24580
24708
|
);
|
|
@@ -24586,8 +24714,8 @@ async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
|
24586
24714
|
output4.on("error", reject);
|
|
24587
24715
|
archive.pipe(output4);
|
|
24588
24716
|
for (const rel2 of files) {
|
|
24589
|
-
const entryName = entryPrefix + rel2.split(
|
|
24590
|
-
archive.append(createReadStream3(
|
|
24717
|
+
const entryName = entryPrefix + rel2.split(path77.sep).join("/");
|
|
24718
|
+
archive.append(createReadStream3(path77.join(resolved, rel2)), {
|
|
24591
24719
|
name: entryName
|
|
24592
24720
|
});
|
|
24593
24721
|
}
|
|
@@ -24829,7 +24957,7 @@ function validateDeployArchiveInput(args) {
|
|
|
24829
24957
|
async function resolveDevPortalArchive(args) {
|
|
24830
24958
|
validateDeployArchiveInput(args);
|
|
24831
24959
|
if (args.archivePath?.trim()) {
|
|
24832
|
-
const archivePath =
|
|
24960
|
+
const archivePath = path78.resolve(args.archivePath.trim());
|
|
24833
24961
|
const stat7 = await fs11.stat(archivePath).catch(() => null);
|
|
24834
24962
|
if (!stat7?.isFile()) {
|
|
24835
24963
|
throw new Error(`archivePath is not a file: ${archivePath}`);
|
|
@@ -24894,7 +25022,7 @@ async function handleDeployDevPortal(client, config2, args, progress) {
|
|
|
24894
25022
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
24895
25023
|
async function handleBuildDevPortalSite(client, config2, args, progress) {
|
|
24896
25024
|
const buildProgress = progress?.child("Build dev portal site");
|
|
24897
|
-
const sourceDirectory =
|
|
25025
|
+
const sourceDirectory = path79.resolve(args.sourceDirectory);
|
|
24898
25026
|
await buildProgress?.onStep("Ensuring live portal API URL");
|
|
24899
25027
|
const apiBaseUrl = await ensureLiveSiteApiBaseUrlForBuild(
|
|
24900
25028
|
client,
|
|
@@ -26390,7 +26518,7 @@ function resultLooksFailed(payload) {
|
|
|
26390
26518
|
return parsed.status === "failed" || parsed.status === "blocked";
|
|
26391
26519
|
}
|
|
26392
26520
|
async function apply(argv) {
|
|
26393
|
-
const sourceDirectory =
|
|
26521
|
+
const sourceDirectory = path80.resolve(process.cwd(), argv.dir);
|
|
26394
26522
|
let config2;
|
|
26395
26523
|
try {
|
|
26396
26524
|
config2 = loadConfig();
|
|
@@ -26460,7 +26588,7 @@ async function apply(argv) {
|
|
|
26460
26588
|
if (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_not_found") {
|
|
26461
26589
|
const resolution = await resolveProjectNotFoundInteractively(
|
|
26462
26590
|
parsed,
|
|
26463
|
-
|
|
26591
|
+
path80.basename(sourceDirectory)
|
|
26464
26592
|
);
|
|
26465
26593
|
if (resolution) {
|
|
26466
26594
|
effectiveProjectId = void 0;
|
|
@@ -26480,7 +26608,7 @@ async function apply(argv) {
|
|
|
26480
26608
|
while (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_name_exists") {
|
|
26481
26609
|
const resolution = await resolveProjectNameExistsInteractively(
|
|
26482
26610
|
parsed,
|
|
26483
|
-
effectiveProjectName ??
|
|
26611
|
+
effectiveProjectName ?? path80.basename(sourceDirectory)
|
|
26484
26612
|
);
|
|
26485
26613
|
if (!resolution) {
|
|
26486
26614
|
break;
|
|
@@ -26552,7 +26680,7 @@ async function apply(argv) {
|
|
|
26552
26680
|
|
|
26553
26681
|
// src/cli/deploy/command.ts
|
|
26554
26682
|
init_invariant();
|
|
26555
|
-
import
|
|
26683
|
+
import path82 from "node:path";
|
|
26556
26684
|
|
|
26557
26685
|
// src/cli/deploy/v2.ts
|
|
26558
26686
|
import { rm as rm12 } from "node:fs/promises";
|
|
@@ -26560,7 +26688,7 @@ init_invariant();
|
|
|
26560
26688
|
|
|
26561
26689
|
// src/cli/portal/report.ts
|
|
26562
26690
|
import { access as access13 } from "node:fs/promises";
|
|
26563
|
-
import
|
|
26691
|
+
import path81 from "node:path";
|
|
26564
26692
|
|
|
26565
26693
|
// src/cli/deploy/gateway.ts
|
|
26566
26694
|
import { createHash as createHash4 } from "node:crypto";
|
|
@@ -26839,7 +26967,7 @@ async function planPortalService(resolved, ledger) {
|
|
|
26839
26967
|
const hash2 = await portalBuildHash(resolved, prepared);
|
|
26840
26968
|
const previous = stepOf(ledger, "portal", "build");
|
|
26841
26969
|
const built = await exists4(
|
|
26842
|
-
|
|
26970
|
+
path81.join(resolved.state.buildDir, "index.html")
|
|
26843
26971
|
);
|
|
26844
26972
|
if (previous?.status === "succeeded" && previous.hash === hash2 && built) {
|
|
26845
26973
|
return {
|
|
@@ -27146,7 +27274,7 @@ async function statusV2(dir, only, options = {}) {
|
|
|
27146
27274
|
if (service === "portal") {
|
|
27147
27275
|
const build2 = stepOf(ledger, "portal", "build");
|
|
27148
27276
|
const built = await exists4(
|
|
27149
|
-
|
|
27277
|
+
path81.join(resolved.state.buildDir, "index.html")
|
|
27150
27278
|
);
|
|
27151
27279
|
const state = build2?.status === "failed" ? "build-failed" : build2?.status === "succeeded" && built ? "built" : "not-built";
|
|
27152
27280
|
services.push({
|
|
@@ -27157,7 +27285,7 @@ async function statusV2(dir, only, options = {}) {
|
|
|
27157
27285
|
...build2?.finishedAt ? [`last build: ${build2.finishedAt}`] : [],
|
|
27158
27286
|
...build2?.status === "failed" ? [`error: ${build2.error ?? "unknown"}`] : [],
|
|
27159
27287
|
...state === "built" ? [
|
|
27160
|
-
`output: ${
|
|
27288
|
+
`output: ${path81.relative(resolved.configDir, resolved.state.buildDir)}`
|
|
27161
27289
|
] : [],
|
|
27162
27290
|
...url2 ? [`url: ${url2}`] : ["url: not known (portal is not deployed yet)"]
|
|
27163
27291
|
]
|
|
@@ -27425,7 +27553,7 @@ async function deployProject(argv) {
|
|
|
27425
27553
|
const config2 = loadConfig();
|
|
27426
27554
|
const output4 = await deployV2(
|
|
27427
27555
|
{
|
|
27428
|
-
dir:
|
|
27556
|
+
dir: path82.resolve(process.cwd(), argv.dir),
|
|
27429
27557
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
27430
27558
|
projectId: argv.projectId,
|
|
27431
27559
|
env: argv.env,
|
|
@@ -27506,7 +27634,7 @@ var deploy_default = {
|
|
|
27506
27634
|
}),
|
|
27507
27635
|
handler: async (argv) => {
|
|
27508
27636
|
await captureEvent({ argv, event: "apitogo deploy" });
|
|
27509
|
-
if (await isConfigV2(
|
|
27637
|
+
if (await isConfigV2(path83.resolve(process.cwd(), argv.dir))) {
|
|
27510
27638
|
await deployProject(argv);
|
|
27511
27639
|
return;
|
|
27512
27640
|
}
|
|
@@ -27516,7 +27644,7 @@ var deploy_default = {
|
|
|
27516
27644
|
|
|
27517
27645
|
// src/cli/export/handler.ts
|
|
27518
27646
|
import { mkdir as mkdir20, writeFile as writeFile24 } from "node:fs/promises";
|
|
27519
|
-
import
|
|
27647
|
+
import path84 from "node:path";
|
|
27520
27648
|
init_invariant();
|
|
27521
27649
|
var ExportError = class extends ApitogoError {
|
|
27522
27650
|
constructor(message, developerHint) {
|
|
@@ -27530,7 +27658,7 @@ async function exportOpenApi(args, deps) {
|
|
|
27530
27658
|
`Cannot export "${args.target}".`,
|
|
27531
27659
|
"Only `apitogo export openapi` exists."
|
|
27532
27660
|
);
|
|
27533
|
-
const dir =
|
|
27661
|
+
const dir = path84.resolve(process.cwd(), args.dir ?? ".");
|
|
27534
27662
|
if (!await isConfigV2(dir))
|
|
27535
27663
|
throw new ExportError(
|
|
27536
27664
|
"This command needs a config version 2 project.",
|
|
@@ -27555,8 +27683,8 @@ async function exportOpenApi(args, deps) {
|
|
|
27555
27683
|
throw error;
|
|
27556
27684
|
}
|
|
27557
27685
|
if (!args.out) return { text };
|
|
27558
|
-
const file =
|
|
27559
|
-
await mkdir20(
|
|
27686
|
+
const file = path84.resolve(process.cwd(), args.out);
|
|
27687
|
+
await mkdir20(path84.dirname(file), { recursive: true });
|
|
27560
27688
|
await writeFile24(file, text);
|
|
27561
27689
|
return { text, file };
|
|
27562
27690
|
}
|
|
@@ -27607,15 +27735,15 @@ var export_default = {
|
|
|
27607
27735
|
};
|
|
27608
27736
|
|
|
27609
27737
|
// src/cli/init/handler.ts
|
|
27610
|
-
import
|
|
27738
|
+
import path88 from "node:path";
|
|
27611
27739
|
|
|
27612
27740
|
// src/cli/scaffold/run-scaffold-discovery.ts
|
|
27613
27741
|
import { access as access15, readFile as readFile29, writeFile as writeFile26 } from "node:fs/promises";
|
|
27614
|
-
import
|
|
27742
|
+
import path87 from "node:path";
|
|
27615
27743
|
|
|
27616
27744
|
// src/cli/scaffold/detect-backend.ts
|
|
27617
27745
|
import { readdir as readdir4, readFile as readFile27 } from "node:fs/promises";
|
|
27618
|
-
import
|
|
27746
|
+
import path85 from "node:path";
|
|
27619
27747
|
var DEFAULT_RUNTIME_VERSION = {
|
|
27620
27748
|
dotnet: "DOTNET_10",
|
|
27621
27749
|
nodejs: "NODE_22_LTS",
|
|
@@ -27661,15 +27789,15 @@ function isRunnableNodePackage(pkg) {
|
|
|
27661
27789
|
return typeof scripts.start === "string" || typeof pkg.main === "string";
|
|
27662
27790
|
}
|
|
27663
27791
|
async function detectParentBackend(siteDirectory) {
|
|
27664
|
-
const site =
|
|
27665
|
-
const directory =
|
|
27792
|
+
const site = path85.resolve(siteDirectory);
|
|
27793
|
+
const directory = path85.dirname(site);
|
|
27666
27794
|
if (directory === site) {
|
|
27667
27795
|
return void 0;
|
|
27668
27796
|
}
|
|
27669
27797
|
const files = await listFiles(directory);
|
|
27670
27798
|
const toResult = (runtime, runtimeVersion, marker) => ({
|
|
27671
27799
|
directory,
|
|
27672
|
-
sourceDirectory:
|
|
27800
|
+
sourceDirectory: path85.relative(site, directory).split(path85.sep).join("/") || ".",
|
|
27673
27801
|
runtime,
|
|
27674
27802
|
runtimeVersion,
|
|
27675
27803
|
marker
|
|
@@ -27677,7 +27805,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27677
27805
|
const csproj = files.find((f) => f.endsWith(".csproj"));
|
|
27678
27806
|
const solution = files.find((f) => /\.slnx?$/.test(f));
|
|
27679
27807
|
if (csproj || solution) {
|
|
27680
|
-
const content = csproj ? await readText(
|
|
27808
|
+
const content = csproj ? await readText(path85.join(directory, csproj)) : void 0;
|
|
27681
27809
|
return toResult(
|
|
27682
27810
|
"dotnet",
|
|
27683
27811
|
dotnetVersionFromCsproj(content),
|
|
@@ -27685,7 +27813,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27685
27813
|
);
|
|
27686
27814
|
}
|
|
27687
27815
|
if (files.includes("package.json")) {
|
|
27688
|
-
const raw = await readText(
|
|
27816
|
+
const raw = await readText(path85.join(directory, "package.json"));
|
|
27689
27817
|
try {
|
|
27690
27818
|
const pkg = JSON.parse(raw ?? "");
|
|
27691
27819
|
if (isRunnableNodePackage(pkg)) {
|
|
@@ -27700,7 +27828,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27700
27828
|
}
|
|
27701
27829
|
const pythonMarker = PYTHON_MARKERS.find((m) => files.includes(m));
|
|
27702
27830
|
if (pythonMarker) {
|
|
27703
|
-
const versionSource = await readText(
|
|
27831
|
+
const versionSource = await readText(path85.join(directory, ".python-version")) ?? (pythonMarker === "pyproject.toml" ? (await readText(path85.join(directory, pythonMarker)))?.match(
|
|
27704
27832
|
/requires-python\s*=\s*"([^"]+)"/
|
|
27705
27833
|
)?.[1] : void 0);
|
|
27706
27834
|
return toResult(
|
|
@@ -27723,7 +27851,7 @@ import {
|
|
|
27723
27851
|
symlink as symlink2,
|
|
27724
27852
|
writeFile as writeFile25
|
|
27725
27853
|
} from "node:fs/promises";
|
|
27726
|
-
import
|
|
27854
|
+
import path86 from "node:path";
|
|
27727
27855
|
var DOCS_DIR_WHITELIST = [
|
|
27728
27856
|
"docs",
|
|
27729
27857
|
"documents",
|
|
@@ -27760,14 +27888,14 @@ async function isDirectory2(filePath) {
|
|
|
27760
27888
|
}
|
|
27761
27889
|
}
|
|
27762
27890
|
function toPosix3(value) {
|
|
27763
|
-
return value.split(
|
|
27891
|
+
return value.split(path86.sep).join(path86.posix.sep);
|
|
27764
27892
|
}
|
|
27765
27893
|
function isWhitelistedDirName(name) {
|
|
27766
27894
|
return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
|
|
27767
27895
|
}
|
|
27768
27896
|
function isInside2(parent, child) {
|
|
27769
|
-
const relative =
|
|
27770
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
27897
|
+
const relative = path86.relative(parent, child);
|
|
27898
|
+
return relative === "" || !relative.startsWith("..") && !path86.isAbsolute(relative);
|
|
27771
27899
|
}
|
|
27772
27900
|
async function collectMarkdownFiles(dir, excludeDir) {
|
|
27773
27901
|
const files = [];
|
|
@@ -27781,9 +27909,9 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
27781
27909
|
if (entry.name.startsWith(".")) {
|
|
27782
27910
|
continue;
|
|
27783
27911
|
}
|
|
27784
|
-
const full =
|
|
27912
|
+
const full = path86.join(dir, entry.name);
|
|
27785
27913
|
if (entry.isDirectory()) {
|
|
27786
|
-
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir &&
|
|
27914
|
+
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path86.resolve(full) === excludeDir) {
|
|
27787
27915
|
continue;
|
|
27788
27916
|
}
|
|
27789
27917
|
files.push(...await collectMarkdownFiles(full, excludeDir));
|
|
@@ -27796,11 +27924,11 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
27796
27924
|
return files;
|
|
27797
27925
|
}
|
|
27798
27926
|
async function collectSearchRoots(siteDirectory) {
|
|
27799
|
-
const site =
|
|
27800
|
-
const parent =
|
|
27927
|
+
const site = path86.resolve(siteDirectory);
|
|
27928
|
+
const parent = path86.dirname(site);
|
|
27801
27929
|
const roots = [];
|
|
27802
27930
|
const add = (dir) => {
|
|
27803
|
-
const resolved =
|
|
27931
|
+
const resolved = path86.resolve(dir);
|
|
27804
27932
|
if (!roots.includes(resolved)) {
|
|
27805
27933
|
roots.push(resolved);
|
|
27806
27934
|
}
|
|
@@ -27813,7 +27941,7 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
27813
27941
|
if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
|
|
27814
27942
|
continue;
|
|
27815
27943
|
}
|
|
27816
|
-
add(
|
|
27944
|
+
add(path86.join(parent, entry.name));
|
|
27817
27945
|
}
|
|
27818
27946
|
} catch {
|
|
27819
27947
|
}
|
|
@@ -27822,13 +27950,13 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
27822
27950
|
return roots;
|
|
27823
27951
|
}
|
|
27824
27952
|
async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
27825
|
-
const site =
|
|
27826
|
-
const sitePages =
|
|
27953
|
+
const site = path86.resolve(siteDirectory);
|
|
27954
|
+
const sitePages = path86.join(site, PAGES_DIR);
|
|
27827
27955
|
const searchedDirectories = await collectSearchRoots(site);
|
|
27828
27956
|
const directories = [];
|
|
27829
27957
|
const seen = /* @__PURE__ */ new Set();
|
|
27830
27958
|
const consider = async (dir) => {
|
|
27831
|
-
const resolved =
|
|
27959
|
+
const resolved = path86.resolve(dir);
|
|
27832
27960
|
if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
|
|
27833
27961
|
return;
|
|
27834
27962
|
}
|
|
@@ -27845,7 +27973,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
27845
27973
|
directories.push({ sourceDirectory: resolved, files });
|
|
27846
27974
|
};
|
|
27847
27975
|
for (const root of searchedDirectories) {
|
|
27848
|
-
if (isWhitelistedDirName(
|
|
27976
|
+
if (isWhitelistedDirName(path86.basename(root))) {
|
|
27849
27977
|
await consider(root);
|
|
27850
27978
|
}
|
|
27851
27979
|
try {
|
|
@@ -27857,7 +27985,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
27857
27985
|
if (!isWhitelistedDirName(entry.name)) {
|
|
27858
27986
|
continue;
|
|
27859
27987
|
}
|
|
27860
|
-
await consider(
|
|
27988
|
+
await consider(path86.join(root, entry.name));
|
|
27861
27989
|
}
|
|
27862
27990
|
} catch {
|
|
27863
27991
|
}
|
|
@@ -27876,8 +28004,8 @@ function slugifyDirName(name) {
|
|
|
27876
28004
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
27877
28005
|
}
|
|
27878
28006
|
async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
27879
|
-
const base = slugifyDirName(
|
|
27880
|
-
const parent = slugifyDirName(
|
|
28007
|
+
const base = slugifyDirName(path86.basename(sourceDirectory));
|
|
28008
|
+
const parent = slugifyDirName(path86.basename(path86.dirname(sourceDirectory)));
|
|
27881
28009
|
const candidates = [base, `${parent}-${base}`];
|
|
27882
28010
|
let index = 2;
|
|
27883
28011
|
while (true) {
|
|
@@ -27885,7 +28013,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
|
27885
28013
|
if (used.has(name)) {
|
|
27886
28014
|
continue;
|
|
27887
28015
|
}
|
|
27888
|
-
const target =
|
|
28016
|
+
const target = path86.join(pagesDir, name);
|
|
27889
28017
|
if (await pathExists5(target)) {
|
|
27890
28018
|
const stat7 = await lstat2(target);
|
|
27891
28019
|
if (!stat7.isDirectory() || !await isManagedLinkDir(target)) {
|
|
@@ -27916,8 +28044,8 @@ async function alreadyLinked(linkPath, sourcePath) {
|
|
|
27916
28044
|
return false;
|
|
27917
28045
|
}
|
|
27918
28046
|
const current = await readlink(linkPath);
|
|
27919
|
-
const resolved =
|
|
27920
|
-
return resolved ===
|
|
28047
|
+
const resolved = path86.resolve(path86.dirname(linkPath), current);
|
|
28048
|
+
return resolved === path86.resolve(sourcePath);
|
|
27921
28049
|
} catch {
|
|
27922
28050
|
return false;
|
|
27923
28051
|
}
|
|
@@ -27929,8 +28057,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
|
|
|
27929
28057
|
if (await pathExists5(linkPath)) {
|
|
27930
28058
|
return "skipped";
|
|
27931
28059
|
}
|
|
27932
|
-
await mkdir21(
|
|
27933
|
-
const relativeTarget =
|
|
28060
|
+
await mkdir21(path86.dirname(linkPath), { recursive: true });
|
|
28061
|
+
const relativeTarget = path86.relative(path86.dirname(linkPath), sourcePath);
|
|
27934
28062
|
await symlink2(
|
|
27935
28063
|
relativeTarget,
|
|
27936
28064
|
linkPath,
|
|
@@ -27945,7 +28073,7 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
27945
28073
|
if (routes.length === 0) {
|
|
27946
28074
|
return;
|
|
27947
28075
|
}
|
|
27948
|
-
const configPath =
|
|
28076
|
+
const configPath = path86.join(siteDirectory, CONFIG_FILENAME);
|
|
27949
28077
|
if (!await pathExists5(configPath)) {
|
|
27950
28078
|
return;
|
|
27951
28079
|
}
|
|
@@ -27962,8 +28090,8 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
27962
28090
|
`, "utf8");
|
|
27963
28091
|
}
|
|
27964
28092
|
async function discoverAndWireDocs(siteDirectory) {
|
|
27965
|
-
const site =
|
|
27966
|
-
const pagesDir =
|
|
28093
|
+
const site = path86.resolve(siteDirectory);
|
|
28094
|
+
const pagesDir = path86.join(site, PAGES_DIR);
|
|
27967
28095
|
const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
|
|
27968
28096
|
if (directories.length === 0) {
|
|
27969
28097
|
return {
|
|
@@ -27985,15 +28113,15 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
27985
28113
|
directory.sourceDirectory,
|
|
27986
28114
|
usedNames
|
|
27987
28115
|
);
|
|
27988
|
-
const linkDirectory =
|
|
28116
|
+
const linkDirectory = path86.join(pagesDir, linkName);
|
|
27989
28117
|
const linked = [];
|
|
27990
28118
|
const skipped = [];
|
|
27991
28119
|
for (const sourcePath of directory.files) {
|
|
27992
28120
|
const relativeSource = toPosix3(
|
|
27993
|
-
|
|
28121
|
+
path86.relative(directory.sourceDirectory, sourcePath)
|
|
27994
28122
|
);
|
|
27995
|
-
const linkPath =
|
|
27996
|
-
const relativeLink = toPosix3(
|
|
28123
|
+
const linkPath = path86.join(linkDirectory, relativeSource);
|
|
28124
|
+
const relativeLink = toPosix3(path86.relative(site, linkPath));
|
|
27997
28125
|
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
27998
28126
|
if (routes.includes(route)) {
|
|
27999
28127
|
skipped.push({
|
|
@@ -28041,11 +28169,11 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
28041
28169
|
};
|
|
28042
28170
|
}
|
|
28043
28171
|
function siteRelative(siteDirectory, filePath) {
|
|
28044
|
-
const relative = toPosix3(
|
|
28172
|
+
const relative = toPosix3(path86.relative(siteDirectory, filePath));
|
|
28045
28173
|
if (!relative) {
|
|
28046
28174
|
return ".";
|
|
28047
28175
|
}
|
|
28048
|
-
if (
|
|
28176
|
+
if (path86.isAbsolute(relative)) {
|
|
28049
28177
|
return toPosix3(filePath);
|
|
28050
28178
|
}
|
|
28051
28179
|
if (relative.startsWith("..")) {
|
|
@@ -28133,7 +28261,7 @@ async function pathExists6(filePath) {
|
|
|
28133
28261
|
}
|
|
28134
28262
|
async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
|
|
28135
28263
|
const input5 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
|
|
28136
|
-
const jsonConfigPath =
|
|
28264
|
+
const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
|
|
28137
28265
|
const raw = await readFile29(jsonConfigPath, "utf8");
|
|
28138
28266
|
const siteConfig = JSON.parse(raw);
|
|
28139
28267
|
const updated = applyOpenApiToSiteConfig(siteConfig, {
|
|
@@ -28185,7 +28313,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
|
|
|
28185
28313
|
wired: false
|
|
28186
28314
|
};
|
|
28187
28315
|
}
|
|
28188
|
-
const jsonConfigPath =
|
|
28316
|
+
const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
|
|
28189
28317
|
if (!await pathExists6(jsonConfigPath)) {
|
|
28190
28318
|
return {
|
|
28191
28319
|
openApiDiscovery: {
|
|
@@ -28235,7 +28363,7 @@ async function discoverAndWireBackend(siteDirectory, mode) {
|
|
|
28235
28363
|
if (mode !== "nearby") {
|
|
28236
28364
|
return { status: "skipped", mode };
|
|
28237
28365
|
}
|
|
28238
|
-
const jsonConfigPath =
|
|
28366
|
+
const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
|
|
28239
28367
|
if (!await pathExists6(jsonConfigPath)) {
|
|
28240
28368
|
return { status: "not_found" };
|
|
28241
28369
|
}
|
|
@@ -28302,8 +28430,8 @@ function slugifyName2(name) {
|
|
|
28302
28430
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
|
|
28303
28431
|
}
|
|
28304
28432
|
function resolveInitOutputDirectory(dirArg, name) {
|
|
28305
|
-
const resolved =
|
|
28306
|
-
const base =
|
|
28433
|
+
const resolved = path88.resolve(process.cwd(), dirArg);
|
|
28434
|
+
const base = path88.basename(resolved);
|
|
28307
28435
|
const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
|
|
28308
28436
|
if (isDot) {
|
|
28309
28437
|
const fromName = name?.trim();
|
|
@@ -28313,7 +28441,7 @@ function resolveInitOutputDirectory(dirArg, name) {
|
|
|
28313
28441
|
);
|
|
28314
28442
|
}
|
|
28315
28443
|
return {
|
|
28316
|
-
outputDirectory:
|
|
28444
|
+
outputDirectory: path88.resolve(process.cwd(), slugifyName2(fromName)),
|
|
28317
28445
|
siteName: fromName
|
|
28318
28446
|
};
|
|
28319
28447
|
}
|
|
@@ -28496,8 +28624,8 @@ import open2 from "open";
|
|
|
28496
28624
|
import colors14 from "picocolors";
|
|
28497
28625
|
|
|
28498
28626
|
// src/cli/platform/device-auth.ts
|
|
28499
|
-
function url(apiUrl,
|
|
28500
|
-
return `${apiUrl}${
|
|
28627
|
+
function url(apiUrl, path101) {
|
|
28628
|
+
return `${apiUrl}${path101.startsWith("/") ? path101 : `/${path101}`}`;
|
|
28501
28629
|
}
|
|
28502
28630
|
async function requestDeviceCode(apiUrl) {
|
|
28503
28631
|
const response = await fetchWithRetry(
|
|
@@ -28679,7 +28807,7 @@ var logout_default = {
|
|
|
28679
28807
|
};
|
|
28680
28808
|
|
|
28681
28809
|
// src/cli/portal/commands.ts
|
|
28682
|
-
import
|
|
28810
|
+
import path89 from "node:path";
|
|
28683
28811
|
init_invariant();
|
|
28684
28812
|
function parseOnly(value) {
|
|
28685
28813
|
if (value === void 0) return void 0;
|
|
@@ -28696,7 +28824,7 @@ function parseOnly(value) {
|
|
|
28696
28824
|
async function run2(command2, argv, compute, format) {
|
|
28697
28825
|
const json = argv.json === true;
|
|
28698
28826
|
try {
|
|
28699
|
-
const dir =
|
|
28827
|
+
const dir = path89.resolve(process.cwd(), argv.dir ?? ".");
|
|
28700
28828
|
if (!await isConfigV2(dir)) {
|
|
28701
28829
|
throw new ServiceEditError(
|
|
28702
28830
|
`${command2} works with a config version 2 project, and there is none in ${dir}.`,
|
|
@@ -28780,7 +28908,7 @@ var plan_default = {
|
|
|
28780
28908
|
|
|
28781
28909
|
// src/cli/project/create-handler.ts
|
|
28782
28910
|
init_invariant();
|
|
28783
|
-
import
|
|
28911
|
+
import path90 from "node:path";
|
|
28784
28912
|
|
|
28785
28913
|
// src/cli/project/v2.ts
|
|
28786
28914
|
init_invariant();
|
|
@@ -28927,7 +29055,7 @@ async function createLinkedProject(argv, dir) {
|
|
|
28927
29055
|
}
|
|
28928
29056
|
}
|
|
28929
29057
|
async function createProject(argv) {
|
|
28930
|
-
const dir =
|
|
29058
|
+
const dir = path90.resolve(process.cwd(), argv.dir ?? ".");
|
|
28931
29059
|
if (await isConfigV2(dir)) {
|
|
28932
29060
|
await createLinkedProject(argv, dir);
|
|
28933
29061
|
return;
|
|
@@ -29051,14 +29179,14 @@ var remove_default = {
|
|
|
29051
29179
|
|
|
29052
29180
|
// src/cli/dev/handler.ts
|
|
29053
29181
|
init_joinUrl();
|
|
29054
|
-
import
|
|
29182
|
+
import path93 from "node:path";
|
|
29055
29183
|
|
|
29056
29184
|
// src/vite/dev-server.ts
|
|
29057
29185
|
init_logger();
|
|
29058
29186
|
import fs12 from "node:fs/promises";
|
|
29059
29187
|
import http from "node:http";
|
|
29060
29188
|
import https from "node:https";
|
|
29061
|
-
import
|
|
29189
|
+
import path92 from "node:path";
|
|
29062
29190
|
import { createHttpTerminator } from "http-terminator";
|
|
29063
29191
|
import {
|
|
29064
29192
|
createServer as createViteServer,
|
|
@@ -29091,7 +29219,7 @@ init_loader();
|
|
|
29091
29219
|
// src/vite/pagefind-dev-index.ts
|
|
29092
29220
|
init_invariant();
|
|
29093
29221
|
init_joinUrl();
|
|
29094
|
-
import
|
|
29222
|
+
import path91 from "node:path";
|
|
29095
29223
|
import { createIndex as createIndex2 } from "pagefind";
|
|
29096
29224
|
import { isRunnableDevEnvironment } from "vite";
|
|
29097
29225
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -29144,7 +29272,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
29144
29272
|
path: urlPath
|
|
29145
29273
|
};
|
|
29146
29274
|
}
|
|
29147
|
-
const outputPath =
|
|
29275
|
+
const outputPath = path91.join(vite.config.publicDir, "pagefind");
|
|
29148
29276
|
await pagefindIndex.writeFiles({ outputPath });
|
|
29149
29277
|
yield { type: "complete", success: true, indexed };
|
|
29150
29278
|
}
|
|
@@ -29163,9 +29291,9 @@ var DevServer = class {
|
|
|
29163
29291
|
this.protocol = "https";
|
|
29164
29292
|
const { dir } = this.options;
|
|
29165
29293
|
const [key, cert, ca] = await Promise.all([
|
|
29166
|
-
fs12.readFile(
|
|
29167
|
-
fs12.readFile(
|
|
29168
|
-
config2.https.ca ? fs12.readFile(
|
|
29294
|
+
fs12.readFile(path92.resolve(dir, config2.https.key)),
|
|
29295
|
+
fs12.readFile(path92.resolve(dir, config2.https.cert)),
|
|
29296
|
+
config2.https.ca ? fs12.readFile(path92.resolve(dir, config2.https.ca)) : void 0
|
|
29169
29297
|
]);
|
|
29170
29298
|
return https.createServer({ key, cert, ca });
|
|
29171
29299
|
}
|
|
@@ -29182,7 +29310,7 @@ var DevServer = class {
|
|
|
29182
29310
|
);
|
|
29183
29311
|
const server = await this.createNodeServer(config2);
|
|
29184
29312
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
29185
|
-
const publicRoot =
|
|
29313
|
+
const publicRoot = path92.resolve(
|
|
29186
29314
|
this.options.dir,
|
|
29187
29315
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
29188
29316
|
);
|
|
@@ -29199,7 +29327,7 @@ var DevServer = class {
|
|
|
29199
29327
|
// built-in transform middleware which would treat the path as a static asset.
|
|
29200
29328
|
name: "apitogo:entry-client",
|
|
29201
29329
|
configureServer(server2) {
|
|
29202
|
-
const entryPath =
|
|
29330
|
+
const entryPath = path92.posix.join(
|
|
29203
29331
|
server2.config.base,
|
|
29204
29332
|
"/__z/entry.client.tsx"
|
|
29205
29333
|
);
|
|
@@ -29364,7 +29492,7 @@ init_package_json();
|
|
|
29364
29492
|
async function dev(argv) {
|
|
29365
29493
|
const packageJson3 = getZudokuPackageJson();
|
|
29366
29494
|
process.env.NODE_ENV = "development";
|
|
29367
|
-
let dir =
|
|
29495
|
+
let dir = path93.resolve(process.cwd(), argv.dir);
|
|
29368
29496
|
if (await isConfigV2(dir)) {
|
|
29369
29497
|
const { root, prepared } = await preparePortalWorkspace(dir, "development");
|
|
29370
29498
|
dir = root;
|
|
@@ -29463,7 +29591,7 @@ var run_default = {
|
|
|
29463
29591
|
};
|
|
29464
29592
|
|
|
29465
29593
|
// src/cli/secrets/handler.ts
|
|
29466
|
-
import
|
|
29594
|
+
import path94 from "node:path";
|
|
29467
29595
|
init_invariant();
|
|
29468
29596
|
|
|
29469
29597
|
// src/cli/secrets/input.ts
|
|
@@ -29528,7 +29656,7 @@ var SecretsError = class extends ApitogoError {
|
|
|
29528
29656
|
async function resolveProjectId2(argv, deps) {
|
|
29529
29657
|
const explicit = argv.projectId?.trim();
|
|
29530
29658
|
if (explicit) return explicit;
|
|
29531
|
-
const dir =
|
|
29659
|
+
const dir = path94.resolve(process.cwd(), argv.dir ?? ".");
|
|
29532
29660
|
if (await isConfigV2(dir)) {
|
|
29533
29661
|
const id = loadConfigV2(dir).resolved.project.id;
|
|
29534
29662
|
if (id) return id;
|
|
@@ -29688,12 +29816,12 @@ var secrets_default = {
|
|
|
29688
29816
|
};
|
|
29689
29817
|
|
|
29690
29818
|
// src/cli/cmds/status.ts
|
|
29691
|
-
import
|
|
29819
|
+
import path96 from "node:path";
|
|
29692
29820
|
|
|
29693
29821
|
// src/cli/status/handler.ts
|
|
29694
|
-
import
|
|
29822
|
+
import path95 from "node:path";
|
|
29695
29823
|
async function status(argv) {
|
|
29696
|
-
const sourceDirectory =
|
|
29824
|
+
const sourceDirectory = path95.resolve(process.cwd(), argv.dir);
|
|
29697
29825
|
let config2;
|
|
29698
29826
|
try {
|
|
29699
29827
|
config2 = loadConfig();
|
|
@@ -29791,7 +29919,7 @@ var status_default = {
|
|
|
29791
29919
|
}),
|
|
29792
29920
|
handler: async (argv) => {
|
|
29793
29921
|
await captureEvent({ argv, event: "apitogo status" });
|
|
29794
|
-
if (await isConfigV2(
|
|
29922
|
+
if (await isConfigV2(path96.resolve(process.cwd(), argv.dir))) {
|
|
29795
29923
|
await statusOfProject(argv);
|
|
29796
29924
|
return;
|
|
29797
29925
|
}
|
|
@@ -29800,11 +29928,11 @@ var status_default = {
|
|
|
29800
29928
|
};
|
|
29801
29929
|
|
|
29802
29930
|
// src/cli/cmds/teardown.ts
|
|
29803
|
-
import
|
|
29931
|
+
import path99 from "node:path";
|
|
29804
29932
|
|
|
29805
29933
|
// src/cli/teardown/command.ts
|
|
29806
29934
|
init_invariant();
|
|
29807
|
-
import
|
|
29935
|
+
import path97 from "node:path";
|
|
29808
29936
|
import { createInterface as createInterface7 } from "node:readline/promises";
|
|
29809
29937
|
|
|
29810
29938
|
// src/cli/teardown/v2.ts
|
|
@@ -30021,7 +30149,7 @@ async function teardownProject(argv) {
|
|
|
30021
30149
|
const progress = createConsoleProgressReporter();
|
|
30022
30150
|
const result = await teardownV2(
|
|
30023
30151
|
{
|
|
30024
|
-
dir:
|
|
30152
|
+
dir: path97.resolve(process.cwd(), argv.dir),
|
|
30025
30153
|
projectId: argv.projectId,
|
|
30026
30154
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
30027
30155
|
yes: argv.yes === true,
|
|
@@ -30080,7 +30208,7 @@ async function teardownProject(argv) {
|
|
|
30080
30208
|
}
|
|
30081
30209
|
|
|
30082
30210
|
// src/cli/teardown/handler.ts
|
|
30083
|
-
import
|
|
30211
|
+
import path98 from "node:path";
|
|
30084
30212
|
function resultLooksFailed3(payload) {
|
|
30085
30213
|
try {
|
|
30086
30214
|
const parsed = JSON.parse(payload);
|
|
@@ -30096,7 +30224,7 @@ async function teardown(argv) {
|
|
|
30096
30224
|
);
|
|
30097
30225
|
return;
|
|
30098
30226
|
}
|
|
30099
|
-
const sourceDirectory =
|
|
30227
|
+
const sourceDirectory = path98.resolve(process.cwd(), argv.dir);
|
|
30100
30228
|
let config2;
|
|
30101
30229
|
try {
|
|
30102
30230
|
config2 = loadConfig();
|
|
@@ -30174,7 +30302,7 @@ var teardown_default = {
|
|
|
30174
30302
|
}),
|
|
30175
30303
|
handler: async (argv) => {
|
|
30176
30304
|
await captureEvent({ argv, event: "apitogo teardown" });
|
|
30177
|
-
if (await isConfigV2(
|
|
30305
|
+
if (await isConfigV2(path99.resolve(process.cwd(), argv.dir))) {
|
|
30178
30306
|
await teardownProject(argv);
|
|
30179
30307
|
return;
|
|
30180
30308
|
}
|
|
@@ -30252,36 +30380,36 @@ function createApitogoCli(argv) {
|
|
|
30252
30380
|
// src/cli/local-handoff.ts
|
|
30253
30381
|
import { spawn as spawn5 } from "node:child_process";
|
|
30254
30382
|
import { existsSync as existsSync8, realpathSync } from "node:fs";
|
|
30255
|
-
import
|
|
30383
|
+
import path100 from "node:path";
|
|
30256
30384
|
var LOCAL_HANDOFF_ENV = "APITOGO_LOCAL_CLI";
|
|
30257
30385
|
var PACKAGE_NAME = "@lukoweb/apitogo";
|
|
30258
30386
|
var resolveProjectDir = (argv, cwd) => {
|
|
30259
30387
|
for (let i = 0; i < argv.length; i++) {
|
|
30260
30388
|
const arg = argv[i];
|
|
30261
30389
|
const next = argv[i + 1];
|
|
30262
|
-
if (arg === "--dir" && next) return
|
|
30390
|
+
if (arg === "--dir" && next) return path100.resolve(cwd, next);
|
|
30263
30391
|
if (arg?.startsWith("--dir=")) {
|
|
30264
|
-
return
|
|
30392
|
+
return path100.resolve(cwd, arg.slice("--dir=".length));
|
|
30265
30393
|
}
|
|
30266
30394
|
}
|
|
30267
30395
|
return cwd;
|
|
30268
30396
|
};
|
|
30269
30397
|
var findLocalCli = (projectDir, runningRoot) => {
|
|
30270
|
-
let dir =
|
|
30398
|
+
let dir = path100.resolve(projectDir);
|
|
30271
30399
|
let localPackageRoot;
|
|
30272
30400
|
while (!localPackageRoot) {
|
|
30273
|
-
const candidate =
|
|
30274
|
-
if (existsSync8(
|
|
30401
|
+
const candidate = path100.join(dir, "node_modules", PACKAGE_NAME);
|
|
30402
|
+
if (existsSync8(path100.join(candidate, "package.json"))) {
|
|
30275
30403
|
localPackageRoot = candidate;
|
|
30276
|
-
} else if (dir ===
|
|
30404
|
+
} else if (dir === path100.dirname(dir)) {
|
|
30277
30405
|
return void 0;
|
|
30278
30406
|
} else {
|
|
30279
|
-
dir =
|
|
30407
|
+
dir = path100.dirname(dir);
|
|
30280
30408
|
}
|
|
30281
30409
|
}
|
|
30282
30410
|
const localRoot = realpathSync(localPackageRoot);
|
|
30283
30411
|
if (localRoot === realpathSync(runningRoot)) return void 0;
|
|
30284
|
-
return
|
|
30412
|
+
return path100.join(localRoot, "cli.js");
|
|
30285
30413
|
};
|
|
30286
30414
|
var handoffToLocalCli = async (argv, runningRoot) => {
|
|
30287
30415
|
if (process.env[LOCAL_HANDOFF_ENV] || process.env.ZUDOKU_ENV === "internal") {
|
|
@@ -30293,7 +30421,7 @@ var handoffToLocalCli = async (argv, runningRoot) => {
|
|
|
30293
30421
|
);
|
|
30294
30422
|
if (!localCli) return void 0;
|
|
30295
30423
|
printDiagnosticsToConsole(
|
|
30296
|
-
`Using the project's local ${PACKAGE_NAME} (${
|
|
30424
|
+
`Using the project's local ${PACKAGE_NAME} (${path100.dirname(localCli)})`
|
|
30297
30425
|
);
|
|
30298
30426
|
const child = spawn5(process.execPath, [localCli, ...argv], {
|
|
30299
30427
|
stdio: "inherit",
|