@lukoweb/apitogo 0.2.14 → 0.2.16
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
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)) {
|
|
@@ -7700,13 +7700,58 @@ function stableJson(value) {
|
|
|
7700
7700
|
|
|
7701
7701
|
// src/config/v2/wrapper.ts
|
|
7702
7702
|
import { mkdir as mkdir4, readFile as readFile5, rename as rename2, rm as rm2, writeFile as writeFile5 } from "node:fs/promises";
|
|
7703
|
+
import path12 from "node:path";
|
|
7704
|
+
|
|
7705
|
+
// src/config/v2/home-redirect.ts
|
|
7703
7706
|
import path11 from "node:path";
|
|
7707
|
+
import { glob as glob2 } from "glob";
|
|
7708
|
+
import globParent from "glob-parent";
|
|
7709
|
+
var IGNORED = ["**/node_modules/**", "**/dist/**", "**/.git/**"];
|
|
7710
|
+
async function docRoutes(patterns) {
|
|
7711
|
+
const excluded = patterns.filter((pattern) => pattern.startsWith("!")).map((pattern) => pattern.slice(1));
|
|
7712
|
+
const included = patterns.filter((pattern) => !pattern.startsWith("!"));
|
|
7713
|
+
const routes = await Promise.all(
|
|
7714
|
+
included.map(async (pattern) => {
|
|
7715
|
+
const files = await glob2(pattern, {
|
|
7716
|
+
absolute: true,
|
|
7717
|
+
posix: true,
|
|
7718
|
+
ignore: [...IGNORED, ...excluded]
|
|
7719
|
+
});
|
|
7720
|
+
const parent = globParent(pattern);
|
|
7721
|
+
return files.map(
|
|
7722
|
+
(file) => `/${path11.posix.relative(parent, file).replace(/\.mdx?$/, "")}`
|
|
7723
|
+
);
|
|
7724
|
+
})
|
|
7725
|
+
);
|
|
7726
|
+
return [...new Set(routes.flat())].sort();
|
|
7727
|
+
}
|
|
7728
|
+
function pickLandingRoute(routes) {
|
|
7729
|
+
const depth = (route) => route.split("/").length;
|
|
7730
|
+
return [...routes].sort(
|
|
7731
|
+
(a, b) => depth(a) - depth(b) || a.localeCompare(b)
|
|
7732
|
+
)[0];
|
|
7733
|
+
}
|
|
7734
|
+
function homeRedirect(input5) {
|
|
7735
|
+
if (input5.hostsDocs) {
|
|
7736
|
+
if (input5.docRoutes.some((route) => route === "/" || route === "/index"))
|
|
7737
|
+
return void 0;
|
|
7738
|
+
const landing = pickLandingRoute(input5.docRoutes);
|
|
7739
|
+
if (landing) return { from: "/", to: landing };
|
|
7740
|
+
return input5.apiReferencePath ? { from: "/", to: input5.apiReferencePath } : void 0;
|
|
7741
|
+
}
|
|
7742
|
+
if (input5.externalDocsUrl && !input5.userPanel) {
|
|
7743
|
+
return { from: "/", to: input5.externalDocsUrl };
|
|
7744
|
+
}
|
|
7745
|
+
return void 0;
|
|
7746
|
+
}
|
|
7747
|
+
|
|
7748
|
+
// src/config/v2/wrapper.ts
|
|
7704
7749
|
var WRAPPER_FILE = "apitogo.config.tsx";
|
|
7705
7750
|
var CONTENT_LINK = "content";
|
|
7706
|
-
function contentGlob(configDir,
|
|
7707
|
-
const negated =
|
|
7708
|
-
const absolute = negated ?
|
|
7709
|
-
const relative =
|
|
7751
|
+
function contentGlob(configDir, glob9) {
|
|
7752
|
+
const negated = glob9.startsWith("!");
|
|
7753
|
+
const absolute = negated ? glob9.slice(1) : glob9;
|
|
7754
|
+
const relative = path12.relative(configDir, absolute).split(path12.sep).join("/");
|
|
7710
7755
|
return `${negated ? "!" : ""}/${CONTENT_LINK}/${relative}`;
|
|
7711
7756
|
}
|
|
7712
7757
|
var PLANS_CONSOLE_CAPABILITIES = [
|
|
@@ -7830,7 +7875,7 @@ function planPortal(profile, manifest) {
|
|
|
7830
7875
|
var SITE_CONFIG_FILE = "apitogo.config.json";
|
|
7831
7876
|
var REFERENCE_SPEC_FILE = "openapi/gateway.json";
|
|
7832
7877
|
var API_REFERENCE_PATH = "api";
|
|
7833
|
-
function buildSiteConfig(resolved, plan2, theme) {
|
|
7878
|
+
function buildSiteConfig(resolved, plan2, theme, redirects = []) {
|
|
7834
7879
|
const portal = resolved.portal;
|
|
7835
7880
|
return {
|
|
7836
7881
|
site: {
|
|
@@ -7844,7 +7889,7 @@ function buildSiteConfig(resolved, plan2, theme) {
|
|
|
7844
7889
|
...plan2.docs ? {
|
|
7845
7890
|
docs: {
|
|
7846
7891
|
files: portal?.docs.content.map(
|
|
7847
|
-
(
|
|
7892
|
+
(glob9) => contentGlob(resolved.configDir, glob9)
|
|
7848
7893
|
)
|
|
7849
7894
|
}
|
|
7850
7895
|
} : {},
|
|
@@ -7864,6 +7909,7 @@ function buildSiteConfig(resolved, plan2, theme) {
|
|
|
7864
7909
|
}
|
|
7865
7910
|
]
|
|
7866
7911
|
} : {},
|
|
7912
|
+
...redirects.length > 0 ? { redirects } : {},
|
|
7867
7913
|
...theme !== void 0 ? { theme } : {},
|
|
7868
7914
|
...plan2.auth ? { authentication: { type: "openid", ...plan2.auth } } : {},
|
|
7869
7915
|
...plan2.preview ? { preview: true } : {}
|
|
@@ -7955,22 +8001,34 @@ async function preparePortal(resolved, manifest, mode, options = {}) {
|
|
|
7955
8001
|
});
|
|
7956
8002
|
}
|
|
7957
8003
|
}
|
|
7958
|
-
const
|
|
8004
|
+
const home = homeRedirect({
|
|
8005
|
+
hostsDocs: plan2.docs,
|
|
8006
|
+
docRoutes: plan2.docs ? await docRoutes(profile.docs.content) : [],
|
|
8007
|
+
externalDocsUrl: profile.docs.url,
|
|
8008
|
+
apiReferencePath: plan2.apiReference ? `/${API_REFERENCE_PATH}` : void 0,
|
|
8009
|
+
userPanel: plan2.userPanel
|
|
8010
|
+
});
|
|
8011
|
+
const siteConfig = buildSiteConfig(
|
|
8012
|
+
resolved,
|
|
8013
|
+
plan2,
|
|
8014
|
+
await readTheme(resolved),
|
|
8015
|
+
home ? [home] : []
|
|
8016
|
+
);
|
|
7959
8017
|
const wrapper = renderWrapper(plan2);
|
|
7960
|
-
const wrapperPath =
|
|
8018
|
+
const wrapperPath = path12.join(resolved.state.generatedDir, WRAPPER_FILE);
|
|
7961
8019
|
if (options.write !== false) {
|
|
7962
|
-
await mkdir4(
|
|
8020
|
+
await mkdir4(path12.dirname(wrapperPath), { recursive: true });
|
|
7963
8021
|
await writeFile5(
|
|
7964
|
-
|
|
8022
|
+
path12.join(path12.dirname(wrapperPath), SITE_CONFIG_FILE),
|
|
7965
8023
|
`${JSON.stringify(siteConfig, null, 2)}
|
|
7966
8024
|
`
|
|
7967
8025
|
);
|
|
7968
|
-
const referenceFile =
|
|
7969
|
-
|
|
8026
|
+
const referenceFile = path12.join(
|
|
8027
|
+
path12.dirname(wrapperPath),
|
|
7970
8028
|
REFERENCE_SPEC_FILE
|
|
7971
8029
|
);
|
|
7972
8030
|
if (referenceSpec !== void 0) {
|
|
7973
|
-
await mkdir4(
|
|
8031
|
+
await mkdir4(path12.dirname(referenceFile), { recursive: true });
|
|
7974
8032
|
await writeFile5(referenceFile, referenceSpec);
|
|
7975
8033
|
} else {
|
|
7976
8034
|
await rm2(referenceFile, { force: true });
|
|
@@ -8000,8 +8058,8 @@ async function preparePortal(resolved, manifest, mode, options = {}) {
|
|
|
8000
8058
|
// src/config/v2/workspace.ts
|
|
8001
8059
|
import { createHash as createHash2 } from "node:crypto";
|
|
8002
8060
|
import { access as access2, lstat, readFile as readFile6, rm as rm3, symlink } from "node:fs/promises";
|
|
8003
|
-
import
|
|
8004
|
-
import { glob as
|
|
8061
|
+
import path13 from "node:path";
|
|
8062
|
+
import { glob as glob3 } from "glob";
|
|
8005
8063
|
var exists2 = (file) => access2(file).then(
|
|
8006
8064
|
() => true,
|
|
8007
8065
|
() => false
|
|
@@ -8015,11 +8073,11 @@ async function relink(target, link) {
|
|
|
8015
8073
|
await symlink(target, link, "dir");
|
|
8016
8074
|
}
|
|
8017
8075
|
async function materializeWorkspace(resolved, prepared) {
|
|
8018
|
-
const root =
|
|
8076
|
+
const root = path13.dirname(prepared.wrapperPath);
|
|
8019
8077
|
await ensureStateDir(resolved.state);
|
|
8020
|
-
await relink(resolved.configDir,
|
|
8021
|
-
const publicDir = resolved.portal &&
|
|
8022
|
-
const publicLink =
|
|
8078
|
+
await relink(resolved.configDir, path13.join(root, CONTENT_LINK));
|
|
8079
|
+
const publicDir = resolved.portal && path13.join(resolved.portal.dir, "public");
|
|
8080
|
+
const publicLink = path13.join(root, "public");
|
|
8023
8081
|
if (publicDir && await exists2(publicDir)) {
|
|
8024
8082
|
await relink(publicDir, publicLink);
|
|
8025
8083
|
} else {
|
|
@@ -8045,7 +8103,7 @@ async function portalArtifactHash(resolved, manifestText, cliVersion, wrapper =
|
|
|
8045
8103
|
const patterns = [
|
|
8046
8104
|
...portal?.docs.content ?? [],
|
|
8047
8105
|
...resolved.gateway?.specs ?? [],
|
|
8048
|
-
...portal ? [portal.theme,
|
|
8106
|
+
...portal ? [portal.theme, path13.join(portal.dir, "public", "**", "*")] : []
|
|
8049
8107
|
];
|
|
8050
8108
|
const positive = patterns.filter((p) => !p.startsWith("!"));
|
|
8051
8109
|
const ignore2 = patterns.filter((p) => p.startsWith("!")).map((p) => p.slice(1));
|
|
@@ -8053,7 +8111,7 @@ async function portalArtifactHash(resolved, manifestText, cliVersion, wrapper =
|
|
|
8053
8111
|
...new Set(
|
|
8054
8112
|
(await Promise.all(
|
|
8055
8113
|
positive.map(
|
|
8056
|
-
(pattern) =>
|
|
8114
|
+
(pattern) => glob3(pattern.split(path13.sep).join("/"), {
|
|
8057
8115
|
absolute: true,
|
|
8058
8116
|
nodir: true,
|
|
8059
8117
|
ignore: [...ignore2, "**/node_modules/**"]
|
|
@@ -8075,7 +8133,7 @@ async function portalArtifactHash(resolved, manifestText, cliVersion, wrapper =
|
|
|
8075
8133
|
`);
|
|
8076
8134
|
}
|
|
8077
8135
|
for (const file of files) {
|
|
8078
|
-
hash2.update(`file:${
|
|
8136
|
+
hash2.update(`file:${path13.relative(resolved.configDir, file)}
|
|
8079
8137
|
`);
|
|
8080
8138
|
hash2.update(await readFile6(file));
|
|
8081
8139
|
}
|
|
@@ -8085,7 +8143,7 @@ async function portalArtifactHash(resolved, manifestText, cliVersion, wrapper =
|
|
|
8085
8143
|
// src/config/v2/services.ts
|
|
8086
8144
|
init_invariant();
|
|
8087
8145
|
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
|
|
8146
|
+
import path14 from "node:path";
|
|
8089
8147
|
var SERVICES = ["portal", "gateway", "identity", "plans"];
|
|
8090
8148
|
var ServiceEditError = class extends ApitogoError {
|
|
8091
8149
|
constructor(message, developerHint) {
|
|
@@ -8100,7 +8158,7 @@ var exists3 = (target) => access3(target).then(
|
|
|
8100
8158
|
() => true,
|
|
8101
8159
|
() => false
|
|
8102
8160
|
);
|
|
8103
|
-
var rel = (dir, target) =>
|
|
8161
|
+
var rel = (dir, target) => path14.relative(dir, target).split(path14.sep).join("/") || ".";
|
|
8104
8162
|
var STARTER_SPEC = (name) => `openapi: 3.1.0
|
|
8105
8163
|
info:
|
|
8106
8164
|
title: ${JSON.stringify(name)}
|
|
@@ -8166,14 +8224,14 @@ function pair(value, flag, unit) {
|
|
|
8166
8224
|
return [Number(match[1]), Number(match[2])];
|
|
8167
8225
|
}
|
|
8168
8226
|
function insideProject(dir, requested, what) {
|
|
8169
|
-
const absolute =
|
|
8170
|
-
const relative =
|
|
8171
|
-
if (relative === "" || relative.startsWith("..") ||
|
|
8227
|
+
const absolute = path14.resolve(dir, requested);
|
|
8228
|
+
const relative = path14.relative(dir, absolute);
|
|
8229
|
+
if (relative === "" || relative.startsWith("..") || path14.isAbsolute(relative)) {
|
|
8172
8230
|
throw new ServiceEditError(
|
|
8173
8231
|
`${what} "${requested}" is outside the project directory.`
|
|
8174
8232
|
);
|
|
8175
8233
|
}
|
|
8176
|
-
return relative.split(
|
|
8234
|
+
return relative.split(path14.sep).join("/");
|
|
8177
8235
|
}
|
|
8178
8236
|
async function addFile(context, target, content) {
|
|
8179
8237
|
if (await exists3(target)) context.keep.push(target);
|
|
@@ -8210,7 +8268,7 @@ async function buildPortal(context) {
|
|
|
8210
8268
|
if (content.length === 0) {
|
|
8211
8269
|
await addFile(
|
|
8212
8270
|
context,
|
|
8213
|
-
|
|
8271
|
+
path14.join(resolved.root, "portal", "pages", "index.mdx"),
|
|
8214
8272
|
starterPage(name)
|
|
8215
8273
|
);
|
|
8216
8274
|
}
|
|
@@ -8259,7 +8317,7 @@ async function buildGateway(context) {
|
|
|
8259
8317
|
specs = [];
|
|
8260
8318
|
for (const requested of o.spec) {
|
|
8261
8319
|
const relative = insideProject(dir, requested, "OpenAPI file");
|
|
8262
|
-
if (!await stat3(
|
|
8320
|
+
if (!await stat3(path14.join(dir, relative)).then(
|
|
8263
8321
|
(s) => s.isFile(),
|
|
8264
8322
|
() => false
|
|
8265
8323
|
)) {
|
|
@@ -8270,7 +8328,7 @@ async function buildGateway(context) {
|
|
|
8270
8328
|
specs.push(relative);
|
|
8271
8329
|
}
|
|
8272
8330
|
} else if (o.createSpec) {
|
|
8273
|
-
const target =
|
|
8331
|
+
const target = path14.join(resolved.apisDir, "openapi.yaml");
|
|
8274
8332
|
await addFile(context, target, STARTER_SPEC(resolved.project.name));
|
|
8275
8333
|
specs = [rel(dir, target)];
|
|
8276
8334
|
} else {
|
|
@@ -8364,7 +8422,7 @@ async function buildPlans(context) {
|
|
|
8364
8422
|
);
|
|
8365
8423
|
}
|
|
8366
8424
|
const file = o.file ? insideProject(dir, o.file, "Plans file") : void 0;
|
|
8367
|
-
const target = file ?
|
|
8425
|
+
const target = file ? path14.join(dir, file) : resolved.plans?.file ?? path14.join(resolved.root, "plans.json");
|
|
8368
8426
|
await addFile(
|
|
8369
8427
|
context,
|
|
8370
8428
|
target,
|
|
@@ -8394,11 +8452,11 @@ function dependencyProblems(config2, configPath) {
|
|
|
8394
8452
|
return checkDependencies(config2, resolveConfigV2(config2, configPath));
|
|
8395
8453
|
}
|
|
8396
8454
|
async function planAddService(service, options) {
|
|
8397
|
-
const dir =
|
|
8455
|
+
const dir = path14.resolve(options.dir);
|
|
8398
8456
|
const { config: config2, resolved } = loadConfigV2(dir);
|
|
8399
8457
|
if (config2[service] !== void 0) {
|
|
8400
8458
|
throw new ServiceEditError(
|
|
8401
|
-
`${service} is already in ${
|
|
8459
|
+
`${service} is already in ${path14.basename(resolved.configPath)}.`,
|
|
8402
8460
|
`Edit the file, or run \`apitogo remove ${service}\` first. Its files are kept.`
|
|
8403
8461
|
);
|
|
8404
8462
|
}
|
|
@@ -8441,11 +8499,11 @@ async function planAddService(service, options) {
|
|
|
8441
8499
|
};
|
|
8442
8500
|
}
|
|
8443
8501
|
async function planRemoveService(service, options) {
|
|
8444
|
-
const dir =
|
|
8502
|
+
const dir = path14.resolve(options.dir);
|
|
8445
8503
|
const { config: config2, resolved } = loadConfigV2(dir);
|
|
8446
8504
|
if (config2[service] === void 0) {
|
|
8447
8505
|
throw new ServiceEditError(
|
|
8448
|
-
`${service} is not in ${
|
|
8506
|
+
`${service} is not in ${path14.basename(resolved.configPath)}.`
|
|
8449
8507
|
);
|
|
8450
8508
|
}
|
|
8451
8509
|
const { [service]: removed, ...rest } = config2;
|
|
@@ -8494,7 +8552,7 @@ async function writeConfig(configPath, config2) {
|
|
|
8494
8552
|
async function applyServiceEdit(edit) {
|
|
8495
8553
|
const created = [];
|
|
8496
8554
|
for (const file of edit.files) {
|
|
8497
|
-
await mkdir5(
|
|
8555
|
+
await mkdir5(path14.dirname(file.path), { recursive: true });
|
|
8498
8556
|
try {
|
|
8499
8557
|
await writeFile6(file.path, file.content, { flag: "wx" });
|
|
8500
8558
|
created.push(file.path);
|
|
@@ -8508,7 +8566,7 @@ async function applyServiceEdit(edit) {
|
|
|
8508
8566
|
function formatServiceEdit(edit) {
|
|
8509
8567
|
const verb = edit.action === "add" ? "Adds" : "Removes";
|
|
8510
8568
|
return [
|
|
8511
|
-
`${verb} the ${edit.service} section in ${
|
|
8569
|
+
`${verb} the ${edit.service} section in ${path14.basename(edit.configPath)}.`,
|
|
8512
8570
|
...edit.files.length > 0 ? [
|
|
8513
8571
|
"Will create:",
|
|
8514
8572
|
...edit.files.map((file) => ` ${rel(edit.dir, file.path)}`)
|
|
@@ -8545,7 +8603,7 @@ async function clearProjectId(dir, projectId) {
|
|
|
8545
8603
|
// src/config/v2/ledger.ts
|
|
8546
8604
|
init_invariant();
|
|
8547
8605
|
import { mkdir as mkdir6, readFile as readFile7, rename as rename4, rm as rm5, writeFile as writeFile7 } from "node:fs/promises";
|
|
8548
|
-
import
|
|
8606
|
+
import path15 from "node:path";
|
|
8549
8607
|
var LEDGER_VERSION = 1;
|
|
8550
8608
|
var LedgerError = class extends ApitogoError {
|
|
8551
8609
|
constructor(code, message, developerHint) {
|
|
@@ -8600,7 +8658,7 @@ function corrupt(file, why) {
|
|
|
8600
8658
|
);
|
|
8601
8659
|
}
|
|
8602
8660
|
async function writeLedger(state, ledger) {
|
|
8603
|
-
await mkdir6(
|
|
8661
|
+
await mkdir6(path15.dirname(state.file), { recursive: true });
|
|
8604
8662
|
const temporary = `${state.file}.${process.pid}.tmp`;
|
|
8605
8663
|
try {
|
|
8606
8664
|
await writeFile7(temporary, `${JSON.stringify(ledger, null, 2)}
|
|
@@ -8693,7 +8751,7 @@ init_invariant();
|
|
|
8693
8751
|
// src/cli/check/v2.ts
|
|
8694
8752
|
init_apitogo_config_core();
|
|
8695
8753
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
8696
|
-
import
|
|
8754
|
+
import path47 from "node:path";
|
|
8697
8755
|
|
|
8698
8756
|
// src/cli/platform/client/platform-api.ts
|
|
8699
8757
|
import { basename } from "node:path";
|
|
@@ -8806,8 +8864,8 @@ var PlatformApiClient = class {
|
|
|
8806
8864
|
constructor(config2) {
|
|
8807
8865
|
this.config = config2;
|
|
8808
8866
|
}
|
|
8809
|
-
url(
|
|
8810
|
-
return `${this.config.apiUrl}${
|
|
8867
|
+
url(path101) {
|
|
8868
|
+
return `${this.config.apiUrl}${path101.startsWith("/") ? path101 : `/${path101}`}`;
|
|
8811
8869
|
}
|
|
8812
8870
|
headers(extra) {
|
|
8813
8871
|
return {
|
|
@@ -8817,9 +8875,9 @@ var PlatformApiClient = class {
|
|
|
8817
8875
|
...extra
|
|
8818
8876
|
};
|
|
8819
8877
|
}
|
|
8820
|
-
async request(method,
|
|
8878
|
+
async request(method, path101, init4) {
|
|
8821
8879
|
const response = await fetchWithRetry(
|
|
8822
|
-
this.url(
|
|
8880
|
+
this.url(path101),
|
|
8823
8881
|
{
|
|
8824
8882
|
method,
|
|
8825
8883
|
...init4,
|
|
@@ -9182,15 +9240,15 @@ var PlatformApiClient = class {
|
|
|
9182
9240
|
}
|
|
9183
9241
|
);
|
|
9184
9242
|
}
|
|
9185
|
-
deleteDevPortalPage(projectId,
|
|
9186
|
-
const query = new URLSearchParams({ path:
|
|
9243
|
+
deleteDevPortalPage(projectId, path101) {
|
|
9244
|
+
const query = new URLSearchParams({ path: path101 });
|
|
9187
9245
|
return this.request(
|
|
9188
9246
|
"DELETE",
|
|
9189
9247
|
`/api/v1/projects/${projectId}/dev-portal/pages/files?${query.toString()}`
|
|
9190
9248
|
);
|
|
9191
9249
|
}
|
|
9192
|
-
renameDevPortalPage(projectId,
|
|
9193
|
-
const query = new URLSearchParams({ path:
|
|
9250
|
+
renameDevPortalPage(projectId, path101, newName) {
|
|
9251
|
+
const query = new URLSearchParams({ path: path101 });
|
|
9194
9252
|
return this.request(
|
|
9195
9253
|
"POST",
|
|
9196
9254
|
`/api/v1/projects/${projectId}/dev-portal/pages/files/rename?${query.toString()}`,
|
|
@@ -9306,8 +9364,8 @@ var PlatformApiClient = class {
|
|
|
9306
9364
|
* the project-less endpoint is used; `planTier` overrides the tier used for paid-plan checks.
|
|
9307
9365
|
*/
|
|
9308
9366
|
validateGatewayPlans(plans, options = {}) {
|
|
9309
|
-
const
|
|
9310
|
-
return this.request("POST",
|
|
9367
|
+
const path101 = options.projectId ? `/api/v1/projects/${options.projectId}/gateway/plans/validate` : "/api/v1/gateway/plans/validate";
|
|
9368
|
+
return this.request("POST", path101, {
|
|
9311
9369
|
headers: { "Content-Type": "application/json" },
|
|
9312
9370
|
body: JSON.stringify({ plans, planTier: options.planTier })
|
|
9313
9371
|
});
|
|
@@ -9420,8 +9478,8 @@ function isNotFoundError(error) {
|
|
|
9420
9478
|
|
|
9421
9479
|
// src/cli/platform/credentials-store.ts
|
|
9422
9480
|
import fs from "node:fs";
|
|
9423
|
-
import
|
|
9424
|
-
var CREDENTIALS_FILE =
|
|
9481
|
+
import path16 from "node:path";
|
|
9482
|
+
var CREDENTIALS_FILE = path16.join(
|
|
9425
9483
|
ZUDOKU_XDG_CONFIG_HOME,
|
|
9426
9484
|
"credentials.json"
|
|
9427
9485
|
);
|
|
@@ -9442,7 +9500,7 @@ function readStoredCredentials() {
|
|
|
9442
9500
|
}
|
|
9443
9501
|
}
|
|
9444
9502
|
function writeStoredCredentials(creds) {
|
|
9445
|
-
fs.mkdirSync(
|
|
9503
|
+
fs.mkdirSync(path16.dirname(CREDENTIALS_FILE), { recursive: true });
|
|
9446
9504
|
fs.writeFileSync(CREDENTIALS_FILE, JSON.stringify(creds, null, 2), {
|
|
9447
9505
|
mode: 384
|
|
9448
9506
|
});
|
|
@@ -9512,11 +9570,11 @@ import {
|
|
|
9512
9570
|
writeFile as writeFile13
|
|
9513
9571
|
} from "node:fs/promises";
|
|
9514
9572
|
import { createRequire as createRequire2 } from "node:module";
|
|
9515
|
-
import
|
|
9573
|
+
import path46 from "node:path";
|
|
9516
9574
|
|
|
9517
9575
|
// src/vite/build.ts
|
|
9518
9576
|
import { mkdir as mkdir11, readFile as readFile10, rename as rename5, rm as rm7, writeFile as writeFile12 } from "node:fs/promises";
|
|
9519
|
-
import
|
|
9577
|
+
import path45 from "node:path";
|
|
9520
9578
|
import { build as esbuild } from "esbuild";
|
|
9521
9579
|
import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
|
|
9522
9580
|
|
|
@@ -9652,7 +9710,7 @@ init_invariant();
|
|
|
9652
9710
|
init_joinUrl();
|
|
9653
9711
|
|
|
9654
9712
|
// src/vite/config.ts
|
|
9655
|
-
import
|
|
9713
|
+
import path40 from "node:path";
|
|
9656
9714
|
import dotenv from "dotenv";
|
|
9657
9715
|
import colors8 from "picocolors";
|
|
9658
9716
|
import {
|
|
@@ -9663,7 +9721,7 @@ import {
|
|
|
9663
9721
|
// package.json
|
|
9664
9722
|
var package_default = {
|
|
9665
9723
|
name: "@lukoweb/apitogo",
|
|
9666
|
-
version: "0.2.
|
|
9724
|
+
version: "0.2.16",
|
|
9667
9725
|
type: "module",
|
|
9668
9726
|
sideEffects: [
|
|
9669
9727
|
"**/*.css",
|
|
@@ -10097,24 +10155,24 @@ async function loadDevPortalViteDefines(rootDir, mode) {
|
|
|
10097
10155
|
|
|
10098
10156
|
// src/vite/package-root.ts
|
|
10099
10157
|
init_file_exists();
|
|
10100
|
-
import
|
|
10158
|
+
import path21 from "node:path";
|
|
10101
10159
|
var findPackageRoot = async (startDir) => {
|
|
10102
10160
|
let dir = startDir;
|
|
10103
|
-
while (dir !==
|
|
10104
|
-
if (await fileExists(
|
|
10105
|
-
dir =
|
|
10161
|
+
while (dir !== path21.dirname(dir)) {
|
|
10162
|
+
if (await fileExists(path21.join(dir, "package.json"))) return dir;
|
|
10163
|
+
dir = path21.dirname(dir);
|
|
10106
10164
|
}
|
|
10107
10165
|
};
|
|
10108
10166
|
|
|
10109
10167
|
// src/vite/pagefind-dev-stub.ts
|
|
10110
10168
|
import fs2 from "node:fs/promises";
|
|
10111
|
-
import
|
|
10169
|
+
import path22 from "node:path";
|
|
10112
10170
|
var NOT_BUILT_YET = 'throw new Error("NOT_BUILT_YET");';
|
|
10113
10171
|
async function ensurePagefindDevStub(publicDir) {
|
|
10114
|
-
const pagefindPath =
|
|
10172
|
+
const pagefindPath = path22.join(publicDir, "pagefind/pagefind.js");
|
|
10115
10173
|
const exists5 = await fs2.stat(pagefindPath).catch(() => false);
|
|
10116
10174
|
if (!exists5) {
|
|
10117
|
-
await fs2.mkdir(
|
|
10175
|
+
await fs2.mkdir(path22.dirname(pagefindPath), { recursive: true });
|
|
10118
10176
|
await fs2.writeFile(pagefindPath, NOT_BUILT_YET);
|
|
10119
10177
|
}
|
|
10120
10178
|
}
|
|
@@ -10126,7 +10184,7 @@ import react from "@vitejs/plugin-react";
|
|
|
10126
10184
|
// src/vite/css/plugin.ts
|
|
10127
10185
|
init_loader();
|
|
10128
10186
|
init_plugin_theme();
|
|
10129
|
-
import
|
|
10187
|
+
import path23 from "node:path";
|
|
10130
10188
|
import { isCSSRequest as isCSSRequest2 } from "vite";
|
|
10131
10189
|
|
|
10132
10190
|
// src/vite/css/collect.ts
|
|
@@ -10161,7 +10219,7 @@ var VIRTUAL_ENTRY = "virtual:ssr-css.css";
|
|
|
10161
10219
|
function vitePluginSsrCss(pluginOpts) {
|
|
10162
10220
|
let server;
|
|
10163
10221
|
const config2 = getCurrentConfig();
|
|
10164
|
-
const virtualHref =
|
|
10222
|
+
const virtualHref = path23.join(
|
|
10165
10223
|
config2.basePath ?? "",
|
|
10166
10224
|
`/@id/__x00__${VIRTUAL_ENTRY}?direct`
|
|
10167
10225
|
);
|
|
@@ -10298,7 +10356,7 @@ var plugin_api_keys_default = viteApiKeysPlugin;
|
|
|
10298
10356
|
|
|
10299
10357
|
// src/vite/plugin-api.ts
|
|
10300
10358
|
import fs4 from "node:fs/promises";
|
|
10301
|
-
import
|
|
10359
|
+
import path29 from "node:path";
|
|
10302
10360
|
import { deepEqual as deepEqual2 } from "fast-equals";
|
|
10303
10361
|
import { runnerImport as runnerImport3 } from "vite";
|
|
10304
10362
|
init_package_json();
|
|
@@ -10307,7 +10365,7 @@ init_loader();
|
|
|
10307
10365
|
// src/config/validators/BuildSchema.ts
|
|
10308
10366
|
init_file_exists();
|
|
10309
10367
|
init_loader();
|
|
10310
|
-
import
|
|
10368
|
+
import path24 from "node:path";
|
|
10311
10369
|
import { runnerImport as runnerImport2 } from "vite";
|
|
10312
10370
|
import { z as z13 } from "zod";
|
|
10313
10371
|
var BuildProcessorSchema = z13.custom((val) => typeof val === "function");
|
|
@@ -10336,7 +10394,7 @@ var buildConfigFiles = [
|
|
|
10336
10394
|
];
|
|
10337
10395
|
async function getBuildConfigFilePath(rootDir) {
|
|
10338
10396
|
for (const fileName of buildConfigFiles) {
|
|
10339
|
-
const filepath =
|
|
10397
|
+
const filepath = path24.join(rootDir, fileName);
|
|
10340
10398
|
if (await fileExists(filepath)) {
|
|
10341
10399
|
return filepath;
|
|
10342
10400
|
}
|
|
@@ -10445,14 +10503,14 @@ var flattenAllOf = (schema2) => {
|
|
|
10445
10503
|
};
|
|
10446
10504
|
|
|
10447
10505
|
// src/lib/util/traverse.ts
|
|
10448
|
-
var traverse = (specification, transform,
|
|
10449
|
-
const transformed = transform(specification,
|
|
10506
|
+
var traverse = (specification, transform, path101 = []) => {
|
|
10507
|
+
const transformed = transform(specification, path101);
|
|
10450
10508
|
if (typeof transformed !== "object" || transformed === null) {
|
|
10451
10509
|
return transformed;
|
|
10452
10510
|
}
|
|
10453
10511
|
const result = Array.isArray(transformed) ? [] : {};
|
|
10454
10512
|
for (const [key, value] of Object.entries(transformed)) {
|
|
10455
|
-
const currentPath = [...
|
|
10513
|
+
const currentPath = [...path101, key];
|
|
10456
10514
|
if (Array.isArray(value)) {
|
|
10457
10515
|
result[key] = value.map(
|
|
10458
10516
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -10480,9 +10538,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
10480
10538
|
if (schemaCache?.has(ref)) {
|
|
10481
10539
|
return schemaCache.get(ref);
|
|
10482
10540
|
}
|
|
10483
|
-
const
|
|
10541
|
+
const path101 = ref.split("/").slice(1);
|
|
10484
10542
|
let current = schema2;
|
|
10485
|
-
for (const segment of
|
|
10543
|
+
for (const segment of path101) {
|
|
10486
10544
|
if (!current || typeof current !== "object") {
|
|
10487
10545
|
current = null;
|
|
10488
10546
|
}
|
|
@@ -10501,7 +10559,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10501
10559
|
}
|
|
10502
10560
|
const cloned = structuredClone(schema2);
|
|
10503
10561
|
const visited = /* @__PURE__ */ new Set();
|
|
10504
|
-
const resolve = async (current,
|
|
10562
|
+
const resolve = async (current, path101) => {
|
|
10505
10563
|
if (isIndexableObject(current)) {
|
|
10506
10564
|
if (visited.has(current)) {
|
|
10507
10565
|
return CIRCULAR_REF;
|
|
@@ -10509,7 +10567,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10509
10567
|
visited.add(current);
|
|
10510
10568
|
if (Array.isArray(current)) {
|
|
10511
10569
|
for (let index = 0; index < current.length; index++) {
|
|
10512
|
-
current[index] = await resolve(current[index], `${
|
|
10570
|
+
current[index] = await resolve(current[index], `${path101}/${index}`);
|
|
10513
10571
|
}
|
|
10514
10572
|
} else {
|
|
10515
10573
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -10520,13 +10578,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10520
10578
|
for (const resolver of resolvers) {
|
|
10521
10579
|
const resolved = await resolver($ref);
|
|
10522
10580
|
if (resolved) {
|
|
10523
|
-
result2 = await resolve(resolved,
|
|
10581
|
+
result2 = await resolve(resolved, path101);
|
|
10524
10582
|
break;
|
|
10525
10583
|
}
|
|
10526
10584
|
}
|
|
10527
10585
|
if (result2 === void 0) {
|
|
10528
10586
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
10529
|
-
result2 = await resolve(resolved,
|
|
10587
|
+
result2 = await resolve(resolved, path101);
|
|
10530
10588
|
}
|
|
10531
10589
|
if (hasSiblings) {
|
|
10532
10590
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -10539,7 +10597,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10539
10597
|
return result2;
|
|
10540
10598
|
}
|
|
10541
10599
|
for (const key in current) {
|
|
10542
|
-
current[key] = await resolve(current[key], `${
|
|
10600
|
+
current[key] = await resolve(current[key], `${path101}/${key}`);
|
|
10543
10601
|
}
|
|
10544
10602
|
}
|
|
10545
10603
|
visited.delete(current);
|
|
@@ -10578,9 +10636,9 @@ var upgradeSchema = (schema2) => {
|
|
|
10578
10636
|
}
|
|
10579
10637
|
return sub;
|
|
10580
10638
|
});
|
|
10581
|
-
schema2 = traverse(schema2, (sub,
|
|
10639
|
+
schema2 = traverse(schema2, (sub, path101) => {
|
|
10582
10640
|
if (sub.example !== void 0) {
|
|
10583
|
-
if (isSchemaPath(
|
|
10641
|
+
if (isSchemaPath(path101 ?? [])) {
|
|
10584
10642
|
sub.examples = [sub.example];
|
|
10585
10643
|
} else {
|
|
10586
10644
|
sub.examples = {
|
|
@@ -10593,11 +10651,11 @@ var upgradeSchema = (schema2) => {
|
|
|
10593
10651
|
}
|
|
10594
10652
|
return sub;
|
|
10595
10653
|
});
|
|
10596
|
-
schema2 = traverse(schema2, (schema3,
|
|
10654
|
+
schema2 = traverse(schema2, (schema3, path101) => {
|
|
10597
10655
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
10598
|
-
const parentPath =
|
|
10656
|
+
const parentPath = path101?.slice(0, -1);
|
|
10599
10657
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
10600
|
-
return segment === "content" &&
|
|
10658
|
+
return segment === "content" && path101?.[index + 1] === "multipart/form-data";
|
|
10601
10659
|
});
|
|
10602
10660
|
if (isMultipart) {
|
|
10603
10661
|
const entries = Object.entries(schema3.properties);
|
|
@@ -10611,8 +10669,8 @@ var upgradeSchema = (schema2) => {
|
|
|
10611
10669
|
}
|
|
10612
10670
|
return schema3;
|
|
10613
10671
|
});
|
|
10614
|
-
schema2 = traverse(schema2, (schema3,
|
|
10615
|
-
if (
|
|
10672
|
+
schema2 = traverse(schema2, (schema3, path101) => {
|
|
10673
|
+
if (path101?.includes("content") && path101.includes("application/octet-stream")) {
|
|
10616
10674
|
return {};
|
|
10617
10675
|
}
|
|
10618
10676
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -10638,11 +10696,11 @@ var upgradeSchema = (schema2) => {
|
|
|
10638
10696
|
}
|
|
10639
10697
|
return sub;
|
|
10640
10698
|
});
|
|
10641
|
-
schema2 = traverse(schema2, (schema3,
|
|
10699
|
+
schema2 = traverse(schema2, (schema3, path101) => {
|
|
10642
10700
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
10643
|
-
const parentPath =
|
|
10701
|
+
const parentPath = path101?.slice(0, -1);
|
|
10644
10702
|
const contentMediaType = parentPath?.find(
|
|
10645
|
-
(_, index) =>
|
|
10703
|
+
(_, index) => path101?.[index - 1] === "content"
|
|
10646
10704
|
);
|
|
10647
10705
|
return {
|
|
10648
10706
|
type: "string",
|
|
@@ -10654,7 +10712,7 @@ var upgradeSchema = (schema2) => {
|
|
|
10654
10712
|
});
|
|
10655
10713
|
return schema2;
|
|
10656
10714
|
};
|
|
10657
|
-
function isSchemaPath(
|
|
10715
|
+
function isSchemaPath(path101) {
|
|
10658
10716
|
const schemaLocations = [
|
|
10659
10717
|
["components", "schemas"],
|
|
10660
10718
|
"properties",
|
|
@@ -10667,10 +10725,10 @@ function isSchemaPath(path100) {
|
|
|
10667
10725
|
];
|
|
10668
10726
|
return schemaLocations.some((location) => {
|
|
10669
10727
|
if (Array.isArray(location)) {
|
|
10670
|
-
return location.every((segment, index) =>
|
|
10728
|
+
return location.every((segment, index) => path101[index] === segment);
|
|
10671
10729
|
}
|
|
10672
|
-
return
|
|
10673
|
-
}) ||
|
|
10730
|
+
return path101.includes(location);
|
|
10731
|
+
}) || path101.includes("schema") || path101.some((segment) => segment.endsWith("Schema"));
|
|
10674
10732
|
}
|
|
10675
10733
|
|
|
10676
10734
|
// src/lib/oas/parser/index.ts
|
|
@@ -10752,13 +10810,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
10752
10810
|
"anyOf",
|
|
10753
10811
|
"oneOf"
|
|
10754
10812
|
]);
|
|
10755
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
10813
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path101 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
10756
10814
|
if (obj === null || typeof obj !== "object") return obj;
|
|
10757
10815
|
const refPath = obj.__$ref;
|
|
10758
10816
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
10759
10817
|
if (isCircular) {
|
|
10760
10818
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
10761
|
-
const circularProp =
|
|
10819
|
+
const circularProp = path101.find((p) => !OPENAPI_PROPS.has(p)) || path101[0];
|
|
10762
10820
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
10763
10821
|
}
|
|
10764
10822
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -10768,7 +10826,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
10768
10826
|
value,
|
|
10769
10827
|
currentPath,
|
|
10770
10828
|
refs,
|
|
10771
|
-
[...
|
|
10829
|
+
[...path101, key],
|
|
10772
10830
|
currentRefPaths
|
|
10773
10831
|
);
|
|
10774
10832
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -10803,7 +10861,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
10803
10861
|
var getAllTags = (schema2) => {
|
|
10804
10862
|
const rootTags = schema2.tags ?? [];
|
|
10805
10863
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
10806
|
-
(
|
|
10864
|
+
(path101) => HttpMethods.map((k) => path101?.[k]).filter((op) => op != null)
|
|
10807
10865
|
);
|
|
10808
10866
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
10809
10867
|
const hasUntaggedOperations = operations.some(
|
|
@@ -10858,7 +10916,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
10858
10916
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
10859
10917
|
var getAllOperations = (paths) => {
|
|
10860
10918
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
10861
|
-
([
|
|
10919
|
+
([path101, value]) => HttpMethods.flatMap((method) => {
|
|
10862
10920
|
if (!value?.[method]) return [];
|
|
10863
10921
|
const operation = value[method];
|
|
10864
10922
|
const pathParameters = value.parameters ?? [];
|
|
@@ -10878,7 +10936,7 @@ var getAllOperations = (paths) => {
|
|
|
10878
10936
|
return {
|
|
10879
10937
|
...operation,
|
|
10880
10938
|
method,
|
|
10881
|
-
path:
|
|
10939
|
+
path: path101,
|
|
10882
10940
|
parameters,
|
|
10883
10941
|
servers,
|
|
10884
10942
|
tags: operation.tags ?? []
|
|
@@ -11236,8 +11294,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
11236
11294
|
}),
|
|
11237
11295
|
paths: t.field({
|
|
11238
11296
|
type: [PathItem],
|
|
11239
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
11240
|
-
path:
|
|
11297
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path101, value]) => ({
|
|
11298
|
+
path: path101,
|
|
11241
11299
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
11242
11300
|
methods: Object.keys(value)
|
|
11243
11301
|
}))
|
|
@@ -11350,7 +11408,7 @@ var ensureArray = (value) => Array.isArray(value) ? value : [value];
|
|
|
11350
11408
|
|
|
11351
11409
|
// src/vite/api/SchemaManager.ts
|
|
11352
11410
|
import fs3 from "node:fs/promises";
|
|
11353
|
-
import
|
|
11411
|
+
import path25 from "node:path";
|
|
11354
11412
|
import {
|
|
11355
11413
|
$RefParser as $RefParser2
|
|
11356
11414
|
} from "@apidevtools/json-schema-ref-parser";
|
|
@@ -11402,7 +11460,7 @@ init_joinUrl();
|
|
|
11402
11460
|
|
|
11403
11461
|
// src/vite/api/schema-codegen.ts
|
|
11404
11462
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
11405
|
-
var getSegmentsFromPath = (
|
|
11463
|
+
var getSegmentsFromPath = (path101) => path101.split("/").slice(1).map(unescapeJsonPointer);
|
|
11406
11464
|
var createLocalRefMap = (obj) => {
|
|
11407
11465
|
const refMap = /* @__PURE__ */ new Map();
|
|
11408
11466
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -11433,16 +11491,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
11433
11491
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
11434
11492
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
11435
11493
|
);
|
|
11436
|
-
var lookup = (schema2,
|
|
11437
|
-
const parts = getSegmentsFromPath(
|
|
11494
|
+
var lookup = (schema2, path101, filePath) => {
|
|
11495
|
+
const parts = getSegmentsFromPath(path101);
|
|
11438
11496
|
let val = schema2;
|
|
11439
11497
|
for (const part of parts) {
|
|
11440
11498
|
while (val.$ref?.startsWith("#/")) {
|
|
11441
|
-
val = val.$ref ===
|
|
11499
|
+
val = val.$ref === path101 ? val : lookup(schema2, val.$ref, filePath);
|
|
11442
11500
|
}
|
|
11443
11501
|
if (val[part] === void 0) {
|
|
11444
11502
|
throw new Error(
|
|
11445
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
11503
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path101}`
|
|
11446
11504
|
);
|
|
11447
11505
|
}
|
|
11448
11506
|
val = val[part];
|
|
@@ -11540,18 +11598,18 @@ var SchemaManager = class {
|
|
|
11540
11598
|
];
|
|
11541
11599
|
}
|
|
11542
11600
|
getPathForFile = (input5, params) => {
|
|
11543
|
-
const filePath =
|
|
11601
|
+
const filePath = path25.resolve(this.config.__meta.rootDir, input5);
|
|
11544
11602
|
const apis = ensureArray(this.config.apis ?? []);
|
|
11545
11603
|
for (const apiConfig of apis) {
|
|
11546
11604
|
if (!apiConfig || apiConfig.type !== "file" || !apiConfig.path) continue;
|
|
11547
11605
|
const match = normalizeInputs(apiConfig.input).some(
|
|
11548
|
-
(i) =>
|
|
11606
|
+
(i) => path25.resolve(this.config.__meta.rootDir, i.input) === filePath && deepEqual(i.params, params)
|
|
11549
11607
|
);
|
|
11550
11608
|
if (match) return apiConfig.path;
|
|
11551
11609
|
}
|
|
11552
11610
|
};
|
|
11553
11611
|
processSchema = async (input5) => {
|
|
11554
|
-
const filePath =
|
|
11612
|
+
const filePath = path25.resolve(this.config.__meta.rootDir, input5.input);
|
|
11555
11613
|
const params = input5.params;
|
|
11556
11614
|
const configuredPath = this.getPathForFile(input5.input, params);
|
|
11557
11615
|
if (!configuredPath) {
|
|
@@ -11587,9 +11645,9 @@ var SchemaManager = class {
|
|
|
11587
11645
|
const processedTime = Date.now();
|
|
11588
11646
|
const code = generateCode(processedSchema, filePath);
|
|
11589
11647
|
const prefixPath = slugify(configuredPath);
|
|
11590
|
-
const processedFilePath =
|
|
11648
|
+
const processedFilePath = path25.posix.join(
|
|
11591
11649
|
this.storeDir,
|
|
11592
|
-
`${prefixPath}-${
|
|
11650
|
+
`${prefixPath}-${path25.basename(filePath)}${paramsSuffix(params)}.js`
|
|
11593
11651
|
);
|
|
11594
11652
|
const importKey = processedFilePath;
|
|
11595
11653
|
await fs3.writeFile(processedFilePath, code);
|
|
@@ -11638,7 +11696,7 @@ var SchemaManager = class {
|
|
|
11638
11696
|
};
|
|
11639
11697
|
getAllTrackedFiles = () => Array.from(this.referencedBy.keys());
|
|
11640
11698
|
getFilesToReprocess = (changedFile) => {
|
|
11641
|
-
const resolvedPath =
|
|
11699
|
+
const resolvedPath = path25.resolve(this.config.__meta.rootDir, changedFile);
|
|
11642
11700
|
const referencedBy = this.referencedBy.get(resolvedPath);
|
|
11643
11701
|
if (!referencedBy) return [];
|
|
11644
11702
|
const filesToProcess = referencedBy.size === 0 ? [resolvedPath] : Array.from(referencedBy);
|
|
@@ -11667,7 +11725,7 @@ var SchemaManager = class {
|
|
|
11667
11725
|
version: "",
|
|
11668
11726
|
path: input5.path ?? "",
|
|
11669
11727
|
label: input5.label,
|
|
11670
|
-
inputPath:
|
|
11728
|
+
inputPath: path25.resolve(this.config.__meta.rootDir, input5.input),
|
|
11671
11729
|
params: input5.params,
|
|
11672
11730
|
importKey: "",
|
|
11673
11731
|
downloadUrl: "",
|
|
@@ -11687,8 +11745,8 @@ var SchemaManager = class {
|
|
|
11687
11745
|
}
|
|
11688
11746
|
}
|
|
11689
11747
|
};
|
|
11690
|
-
getLatestSchema = (
|
|
11691
|
-
getSchemasForPath = (
|
|
11748
|
+
getLatestSchema = (path101) => this.processedSchemas[path101]?.at(0);
|
|
11749
|
+
getSchemasForPath = (path101) => this.processedSchemas[path101];
|
|
11692
11750
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
11693
11751
|
getUrlToFilePathMap = () => {
|
|
11694
11752
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -11710,7 +11768,7 @@ var SchemaManager = class {
|
|
|
11710
11768
|
};
|
|
11711
11769
|
createSchemaPath = (inputPath, versionPath, apiPath, params) => {
|
|
11712
11770
|
const suffix = paramsSuffix(params);
|
|
11713
|
-
const extension = suffix ? ".json" :
|
|
11771
|
+
const extension = suffix ? ".json" : path25.extname(inputPath);
|
|
11714
11772
|
return joinUrl(
|
|
11715
11773
|
this.config.basePath,
|
|
11716
11774
|
apiPath,
|
|
@@ -11733,7 +11791,7 @@ var SchemaManager = class {
|
|
|
11733
11791
|
// src/vite/plugin-config-reload.ts
|
|
11734
11792
|
init_logger();
|
|
11735
11793
|
init_loader();
|
|
11736
|
-
import
|
|
11794
|
+
import path28 from "node:path";
|
|
11737
11795
|
import colors7 from "picocolors";
|
|
11738
11796
|
|
|
11739
11797
|
// src/vite/plugin-navigation.ts
|
|
@@ -11743,8 +11801,8 @@ import { stringify as stringify3 } from "javascript-stringify";
|
|
|
11743
11801
|
import { isElement } from "react-is";
|
|
11744
11802
|
|
|
11745
11803
|
// src/config/validators/NavigationSchema.ts
|
|
11746
|
-
import
|
|
11747
|
-
import { glob as
|
|
11804
|
+
import path26 from "node:path";
|
|
11805
|
+
import { glob as glob4 } from "glob";
|
|
11748
11806
|
import { fromMarkdown } from "mdast-util-from-markdown";
|
|
11749
11807
|
import { mdxFromMarkdown } from "mdast-util-mdx";
|
|
11750
11808
|
import { mdxjs } from "micromark-extension-mdxjs";
|
|
@@ -11794,7 +11852,7 @@ var extractRichH1 = (content) => {
|
|
|
11794
11852
|
}
|
|
11795
11853
|
};
|
|
11796
11854
|
var isNavigationItem = (item) => item !== void 0;
|
|
11797
|
-
var toPosixPath = (filePath) => filePath.split(
|
|
11855
|
+
var toPosixPath = (filePath) => filePath.split(path26.win32.sep).join(path26.posix.sep);
|
|
11798
11856
|
var NavigationResolver = class {
|
|
11799
11857
|
rootDir;
|
|
11800
11858
|
globPatterns;
|
|
@@ -11808,7 +11866,7 @@ var NavigationResolver = class {
|
|
|
11808
11866
|
}
|
|
11809
11867
|
async initialize() {
|
|
11810
11868
|
if (this.globFiles.length > 0) return;
|
|
11811
|
-
this.globFiles = await
|
|
11869
|
+
this.globFiles = await glob4(this.globPatterns, {
|
|
11812
11870
|
root: this.rootDir,
|
|
11813
11871
|
ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**"]
|
|
11814
11872
|
}).then((files) => files.map(toPosixPath));
|
|
@@ -11927,13 +11985,13 @@ init_invariant();
|
|
|
11927
11985
|
|
|
11928
11986
|
// src/vite/debug.ts
|
|
11929
11987
|
import { mkdir as mkdir7, writeFile as writeFile8 } from "node:fs/promises";
|
|
11930
|
-
import
|
|
11988
|
+
import path27 from "node:path";
|
|
11931
11989
|
async function writePluginDebugCode(rootDir, pluginName, code, extension = "js") {
|
|
11932
11990
|
if (process.env.ZUDOKU_BUILD_DEBUG) {
|
|
11933
|
-
const debugDir =
|
|
11991
|
+
const debugDir = path27.join(rootDir, "dist", "debug");
|
|
11934
11992
|
await mkdir7(debugDir, { recursive: true });
|
|
11935
11993
|
await writeFile8(
|
|
11936
|
-
|
|
11994
|
+
path27.join(debugDir, `${pluginName}.${extension}`),
|
|
11937
11995
|
typeof code === "string" ? code : code.join("\n")
|
|
11938
11996
|
);
|
|
11939
11997
|
}
|
|
@@ -12042,7 +12100,7 @@ var viteConfigReloadPlugin = () => ({
|
|
|
12042
12100
|
reload(server);
|
|
12043
12101
|
logger.info(
|
|
12044
12102
|
colors7.blue(
|
|
12045
|
-
`Config ${
|
|
12103
|
+
`Config ${path28.basename(currentConfig.__meta.configPath)} changed. Reloading...`
|
|
12046
12104
|
),
|
|
12047
12105
|
{ timestamp: true }
|
|
12048
12106
|
);
|
|
@@ -12056,11 +12114,11 @@ var viteApiPlugin = async () => {
|
|
|
12056
12114
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
12057
12115
|
const initialConfig = getCurrentConfig();
|
|
12058
12116
|
const zuploProcessors = ZuploEnv.isZuplo ? await runnerImport3(
|
|
12059
|
-
|
|
12117
|
+
path29.resolve(getZudokuRootDir(), "src/zuplo/with-zuplo-processors.ts")
|
|
12060
12118
|
).then((m) => m.module.default(initialConfig.__meta.rootDir)) : [];
|
|
12061
12119
|
const buildConfig = await getBuildConfig();
|
|
12062
12120
|
const buildProcessors = buildConfig?.processors ?? [];
|
|
12063
|
-
const tmpStoreDir =
|
|
12121
|
+
const tmpStoreDir = path29.posix.join(
|
|
12064
12122
|
initialConfig.__meta.rootDir,
|
|
12065
12123
|
"node_modules/.apitogo/processed"
|
|
12066
12124
|
);
|
|
@@ -12092,7 +12150,7 @@ var viteApiPlugin = async () => {
|
|
|
12092
12150
|
const inputPath = pathMap.get(req.url);
|
|
12093
12151
|
if (!inputPath) return next();
|
|
12094
12152
|
const content = await fs4.readFile(inputPath, "utf-8");
|
|
12095
|
-
const mimeType =
|
|
12153
|
+
const mimeType = path29.extname(inputPath).toLowerCase() === ".json" ? "application/json" : "application/x-yaml";
|
|
12096
12154
|
res.setHeader("Content-Type", `${mimeType}; charset=utf-8`);
|
|
12097
12155
|
return res.end(content);
|
|
12098
12156
|
});
|
|
@@ -12280,8 +12338,8 @@ var viteApiPlugin = async () => {
|
|
|
12280
12338
|
if (process.env.NODE_ENV !== "production") return;
|
|
12281
12339
|
for (const [urlPath, inputPath] of pathMap) {
|
|
12282
12340
|
const content = await fs4.readFile(inputPath, "utf-8");
|
|
12283
|
-
const outputPath =
|
|
12284
|
-
await fs4.mkdir(
|
|
12341
|
+
const outputPath = path29.join(config2.__meta.rootDir, "dist", urlPath);
|
|
12342
|
+
await fs4.mkdir(path29.dirname(outputPath), { recursive: true });
|
|
12285
12343
|
await fs4.writeFile(outputPath, content, "utf-8");
|
|
12286
12344
|
}
|
|
12287
12345
|
}
|
|
@@ -12324,7 +12382,7 @@ var plugin_auth_default = viteAuthPlugin;
|
|
|
12324
12382
|
|
|
12325
12383
|
// src/vite/plugin-component.ts
|
|
12326
12384
|
init_loader();
|
|
12327
|
-
import
|
|
12385
|
+
import path30 from "node:path";
|
|
12328
12386
|
var viteAliasPlugin = () => {
|
|
12329
12387
|
return {
|
|
12330
12388
|
name: "zudoku-component-plugin",
|
|
@@ -12352,7 +12410,7 @@ var viteAliasPlugin = () => {
|
|
|
12352
12410
|
];
|
|
12353
12411
|
const aliases = replacements.map(([find, replacement]) => ({
|
|
12354
12412
|
find,
|
|
12355
|
-
replacement:
|
|
12413
|
+
replacement: path30.posix.join(config2.__meta.moduleDir, replacement)
|
|
12356
12414
|
}));
|
|
12357
12415
|
return config2.__meta.mode === "internal" || config2.__meta.mode === "standalone" ? { resolve: { alias: aliases } } : void 0;
|
|
12358
12416
|
}
|
|
@@ -12363,11 +12421,11 @@ var plugin_component_default = viteAliasPlugin;
|
|
|
12363
12421
|
// src/vite/plugin-config.ts
|
|
12364
12422
|
init_package_json();
|
|
12365
12423
|
init_loader();
|
|
12366
|
-
import
|
|
12424
|
+
import path31 from "node:path";
|
|
12367
12425
|
import { normalizePath } from "vite";
|
|
12368
12426
|
var virtualModuleId3 = "virtual:zudoku-config";
|
|
12369
12427
|
var resolvedVirtualModuleId3 = `\0${virtualModuleId3}`;
|
|
12370
|
-
var browserConfigLoaderPath =
|
|
12428
|
+
var browserConfigLoaderPath = path31.join(
|
|
12371
12429
|
getZudokuRootDir(),
|
|
12372
12430
|
"src/config/apitogo-config-loader.browser.ts"
|
|
12373
12431
|
);
|
|
@@ -12501,7 +12559,7 @@ var plugin_custom_pages_default = viteCustomPagesPlugin;
|
|
|
12501
12559
|
|
|
12502
12560
|
// src/vite/plugin-doc-metadata.ts
|
|
12503
12561
|
init_loader();
|
|
12504
|
-
import { glob as
|
|
12562
|
+
import { glob as glob5 } from "glob";
|
|
12505
12563
|
var serializeMetadata = async (filePath) => {
|
|
12506
12564
|
const fm = await readFrontmatter(filePath);
|
|
12507
12565
|
const h1 = fm.content.match(/^#\s+(.*)$/m)?.[1];
|
|
@@ -12512,7 +12570,7 @@ var viteDocMetadataPlugin = () => ({
|
|
|
12512
12570
|
name: "zudoku-doc-metadata-plugin",
|
|
12513
12571
|
configureServer: async (server) => {
|
|
12514
12572
|
const config2 = getCurrentConfig();
|
|
12515
|
-
const files = await
|
|
12573
|
+
const files = await glob5("**/*.{md,mdx}", {
|
|
12516
12574
|
cwd: config2.__meta.rootDir,
|
|
12517
12575
|
ignore: ["node_modules", "dist"],
|
|
12518
12576
|
absolute: true
|
|
@@ -12538,9 +12596,9 @@ var viteDocMetadataPlugin = () => ({
|
|
|
12538
12596
|
|
|
12539
12597
|
// src/vite/plugin-docs.ts
|
|
12540
12598
|
init_loader();
|
|
12541
|
-
import
|
|
12542
|
-
import { glob as
|
|
12543
|
-
import
|
|
12599
|
+
import path32 from "node:path";
|
|
12600
|
+
import { glob as glob6 } from "glob";
|
|
12601
|
+
import globParent2 from "glob-parent";
|
|
12544
12602
|
init_ZudokuConfig();
|
|
12545
12603
|
|
|
12546
12604
|
// src/lib/components/navigation/utils.ts
|
|
@@ -12595,19 +12653,19 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
12595
12653
|
const docsConfig = DocsConfigSchema.parse(config2.docs ?? {});
|
|
12596
12654
|
const fileMapping = {};
|
|
12597
12655
|
for (const globPattern of docsConfig.files) {
|
|
12598
|
-
const globbedFiles = await
|
|
12656
|
+
const globbedFiles = await glob6(globPattern, {
|
|
12599
12657
|
root: config2.__meta.rootDir,
|
|
12600
12658
|
ignore: ["**/node_modules/**", "**/dist/**", "**/.git/**"],
|
|
12601
12659
|
// Always glob with relative paths to avoid issues on different OS
|
|
12602
12660
|
absolute: false,
|
|
12603
12661
|
posix: true
|
|
12604
12662
|
});
|
|
12605
|
-
const parent =
|
|
12663
|
+
const parent = globParent2(globPattern).replace(/^\.?\//, "");
|
|
12606
12664
|
let draftFiles = /* @__PURE__ */ new Set();
|
|
12607
12665
|
if (process.env.NODE_ENV !== "development") {
|
|
12608
12666
|
const draftStatuses = await Promise.all(
|
|
12609
12667
|
globbedFiles.map(async (file) => {
|
|
12610
|
-
const absolutePath =
|
|
12668
|
+
const absolutePath = path32.resolve(config2.__meta.rootDir, file);
|
|
12611
12669
|
const { data } = await readFrontmatter(absolutePath);
|
|
12612
12670
|
return { file, isDraft: data.draft === true };
|
|
12613
12671
|
})
|
|
@@ -12620,9 +12678,9 @@ var globMarkdownFiles = async (config2, options = { absolute: false }) => {
|
|
|
12620
12678
|
if (draftFiles.has(file)) {
|
|
12621
12679
|
continue;
|
|
12622
12680
|
}
|
|
12623
|
-
const relativePath =
|
|
12681
|
+
const relativePath = path32.posix.relative(parent, file);
|
|
12624
12682
|
const routePath = ensureLeadingSlash(relativePath.replace(/\.mdx?$/, ""));
|
|
12625
|
-
const filePath = options.absolute ?
|
|
12683
|
+
const filePath = options.absolute ? path32.resolve(config2.__meta.rootDir, file) : file;
|
|
12626
12684
|
fileMapping[routePath] = filePath;
|
|
12627
12685
|
}
|
|
12628
12686
|
}
|
|
@@ -12686,7 +12744,7 @@ var viteDocsPlugin = () => {
|
|
|
12686
12744
|
const globbedDocuments = {};
|
|
12687
12745
|
for (const [routePath, file] of Object.entries(fileMapping)) {
|
|
12688
12746
|
const importPath = ensureLeadingSlash(
|
|
12689
|
-
|
|
12747
|
+
path32.posix.join(globImportBasePath, file)
|
|
12690
12748
|
);
|
|
12691
12749
|
globbedDocuments[routePath] = importPath;
|
|
12692
12750
|
}
|
|
@@ -12712,7 +12770,7 @@ var plugin_docs_default = viteDocsPlugin;
|
|
|
12712
12770
|
// src/vite/plugin-local-manifest.ts
|
|
12713
12771
|
init_apitogo_config_loader();
|
|
12714
12772
|
init_local_manifest();
|
|
12715
|
-
import
|
|
12773
|
+
import path33 from "node:path";
|
|
12716
12774
|
var APITOGO_LOCAL_MANIFEST_VIRTUAL_ID = "virtual:apitogo-local-manifest";
|
|
12717
12775
|
var resolvedVirtualModuleId4 = `\0${APITOGO_LOCAL_MANIFEST_VIRTUAL_ID}`;
|
|
12718
12776
|
var viteLocalManifestPlugin = () => {
|
|
@@ -12762,8 +12820,8 @@ var viteLocalManifestPlugin = () => {
|
|
|
12762
12820
|
server.watcher.add(watchPath);
|
|
12763
12821
|
}
|
|
12764
12822
|
server.watcher.on("change", async (changedPath) => {
|
|
12765
|
-
const resolvedChanged =
|
|
12766
|
-
if (!watchPaths.some((p) =>
|
|
12823
|
+
const resolvedChanged = path33.resolve(changedPath);
|
|
12824
|
+
if (!watchPaths.some((p) => path33.resolve(p) === resolvedChanged)) {
|
|
12767
12825
|
return;
|
|
12768
12826
|
}
|
|
12769
12827
|
const module = server.moduleGraph.getModuleById(
|
|
@@ -12790,7 +12848,7 @@ init_loader();
|
|
|
12790
12848
|
init_ProtectedRoutesSchema();
|
|
12791
12849
|
init_joinUrl();
|
|
12792
12850
|
import { mkdir as mkdir8, writeFile as writeFile9 } from "node:fs/promises";
|
|
12793
|
-
import
|
|
12851
|
+
import path34 from "node:path";
|
|
12794
12852
|
import { matchPath } from "react-router";
|
|
12795
12853
|
var processMarkdownFile = async (filePath) => {
|
|
12796
12854
|
const { content: markdownContent, data: frontmatter } = await readFrontmatter(filePath);
|
|
@@ -12878,7 +12936,7 @@ var viteMarkdownExportPlugin = () => {
|
|
|
12878
12936
|
if (process.env.NODE_ENV !== "production" || Object.keys(markdownFiles).length === 0 || !needsMdFiles) {
|
|
12879
12937
|
return;
|
|
12880
12938
|
}
|
|
12881
|
-
const distDir =
|
|
12939
|
+
const distDir = path34.join(
|
|
12882
12940
|
config2.__meta.rootDir,
|
|
12883
12941
|
"dist",
|
|
12884
12942
|
config2.basePath ?? ""
|
|
@@ -12899,15 +12957,15 @@ var viteMarkdownExportPlugin = () => {
|
|
|
12899
12957
|
content: finalMarkdown
|
|
12900
12958
|
});
|
|
12901
12959
|
const segments = routePath === "/" ? ["index"] : routePath.split("/").filter(Boolean);
|
|
12902
|
-
const outputPath = `${
|
|
12903
|
-
await mkdir8(
|
|
12960
|
+
const outputPath = `${path34.join(distDir, ...segments)}.md`;
|
|
12961
|
+
await mkdir8(path34.dirname(outputPath), { recursive: true });
|
|
12904
12962
|
await writeFile9(outputPath, finalMarkdown, "utf-8");
|
|
12905
12963
|
} catch (error) {
|
|
12906
12964
|
console.warn(`Failed to export markdown for ${routePath}:`, error);
|
|
12907
12965
|
}
|
|
12908
12966
|
}
|
|
12909
12967
|
if (config2.docs?.llms?.llmsTxt || config2.docs?.llms?.llmsTxtFull) {
|
|
12910
|
-
const markdownInfoPath =
|
|
12968
|
+
const markdownInfoPath = path34.join(
|
|
12911
12969
|
config2.__meta.rootDir,
|
|
12912
12970
|
"node_modules/.apitogo/markdown-info.json"
|
|
12913
12971
|
);
|
|
@@ -13059,9 +13117,9 @@ var remarkCodeTabs = () => (tree) => {
|
|
|
13059
13117
|
};
|
|
13060
13118
|
|
|
13061
13119
|
// src/vite/mdx/remark-inject-filepath.ts
|
|
13062
|
-
import
|
|
13120
|
+
import path35 from "node:path";
|
|
13063
13121
|
var remarkInjectFilepath = (rootDir) => (tree, vfile) => {
|
|
13064
|
-
const relativePath =
|
|
13122
|
+
const relativePath = path35.relative(rootDir, vfile.path).split(path35.sep).join(path35.posix.sep);
|
|
13065
13123
|
tree.children.unshift(exportMdxjsConst("__filepath", relativePath));
|
|
13066
13124
|
};
|
|
13067
13125
|
|
|
@@ -13148,18 +13206,18 @@ var remarkLastModified = () => {
|
|
|
13148
13206
|
};
|
|
13149
13207
|
|
|
13150
13208
|
// src/vite/mdx/remark-link-rewrite.ts
|
|
13151
|
-
import
|
|
13209
|
+
import path36 from "node:path";
|
|
13152
13210
|
import { visit as visit5 } from "unist-util-visit";
|
|
13153
13211
|
var remarkLinkRewrite = (basePath = "") => (tree) => {
|
|
13154
13212
|
visit5(tree, "link", (node) => {
|
|
13155
13213
|
if (!node.url) return;
|
|
13156
13214
|
if (node.url.startsWith("http") || node.url.startsWith("mailto:")) return;
|
|
13157
13215
|
node.url = node.url.replace(/\\/g, "/");
|
|
13158
|
-
const base =
|
|
13216
|
+
const base = path36.posix.join(basePath);
|
|
13159
13217
|
if (basePath && node.url.startsWith(base)) {
|
|
13160
13218
|
node.url = node.url.slice(base.length);
|
|
13161
13219
|
} else if (!node.url.startsWith("/") && !node.url.startsWith("#")) {
|
|
13162
|
-
node.url =
|
|
13220
|
+
node.url = path36.posix.join("..", node.url);
|
|
13163
13221
|
}
|
|
13164
13222
|
node.url = node.url.replace(/\.mdx?(#.*)?$/, "$1");
|
|
13165
13223
|
});
|
|
@@ -13379,14 +13437,14 @@ var plugin_mdx_default = viteMdxPlugin;
|
|
|
13379
13437
|
|
|
13380
13438
|
// src/vite/plugin-modules.ts
|
|
13381
13439
|
init_loader();
|
|
13382
|
-
import
|
|
13440
|
+
import path37 from "node:path";
|
|
13383
13441
|
import { normalizePath as normalizePath2 } from "vite";
|
|
13384
|
-
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
13385
|
-
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
13442
|
+
var getLandingModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path37.join(moduleDir, "../module-landing/src/index.tsx")) : "@lukoweb/apitogo-module-landing";
|
|
13443
|
+
var getUserPanelModuleImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(path37.join(moduleDir, "../module-user-panel/src/index.tsx")) : "@lukoweb/apitogo-module-user-panel";
|
|
13386
13444
|
var getBillingPluginImport = (moduleDir, mode) => mode === "internal" ? normalizePath2(
|
|
13387
|
-
|
|
13445
|
+
path37.join(moduleDir, "../plugin-dev-portal-billing/src/index.ts")
|
|
13388
13446
|
) : "@lukoweb/apitogo-plugin-dev-portal-billing";
|
|
13389
|
-
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(
|
|
13447
|
+
var resolveProjectPageImport = (rootDir, pagePath) => normalizePath2(path37.resolve(rootDir, pagePath));
|
|
13390
13448
|
var viteModulesPlugin = () => {
|
|
13391
13449
|
const virtualModuleId4 = "virtual:zudoku-modules-plugin";
|
|
13392
13450
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
@@ -13526,20 +13584,20 @@ var plugin_modules_default = viteModulesPlugin;
|
|
|
13526
13584
|
|
|
13527
13585
|
// src/vite/plugin-offroot-resolve.ts
|
|
13528
13586
|
init_loader();
|
|
13529
|
-
import
|
|
13587
|
+
import path38 from "node:path";
|
|
13530
13588
|
function stripQuery(id) {
|
|
13531
13589
|
const query = id.indexOf("?");
|
|
13532
13590
|
return query === -1 ? id : id.slice(0, query);
|
|
13533
13591
|
}
|
|
13534
13592
|
function isInside(parent, child) {
|
|
13535
|
-
const relative =
|
|
13536
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
13593
|
+
const relative = path38.relative(path38.resolve(parent), path38.resolve(child));
|
|
13594
|
+
return relative === "" || !relative.startsWith("..") && !path38.isAbsolute(relative);
|
|
13537
13595
|
}
|
|
13538
13596
|
function isBareSpecifier(source) {
|
|
13539
|
-
return !source.startsWith("\0") && !source.startsWith(".") && !source.startsWith("/") && !
|
|
13597
|
+
return !source.startsWith("\0") && !source.startsWith(".") && !source.startsWith("/") && !path38.isAbsolute(source);
|
|
13540
13598
|
}
|
|
13541
13599
|
function isInsideNodeModules(filePath) {
|
|
13542
|
-
return filePath.split(
|
|
13600
|
+
return filePath.split(path38.sep).includes("node_modules");
|
|
13543
13601
|
}
|
|
13544
13602
|
function shouldResolveFromSiteRoot(source, importer, rootDir) {
|
|
13545
13603
|
if (!importer || !isBareSpecifier(source)) {
|
|
@@ -13560,7 +13618,7 @@ function viteOffrootResolvePlugin() {
|
|
|
13560
13618
|
if (!shouldResolveFromSiteRoot(source, importer, rootDir)) {
|
|
13561
13619
|
return;
|
|
13562
13620
|
}
|
|
13563
|
-
return this.resolve(source,
|
|
13621
|
+
return this.resolve(source, path38.join(rootDir, "package.json"), {
|
|
13564
13622
|
...options,
|
|
13565
13623
|
skipSelf: true
|
|
13566
13624
|
});
|
|
@@ -13570,7 +13628,7 @@ function viteOffrootResolvePlugin() {
|
|
|
13570
13628
|
|
|
13571
13629
|
// src/vite/plugin-search.ts
|
|
13572
13630
|
init_loader();
|
|
13573
|
-
import
|
|
13631
|
+
import path39 from "node:path";
|
|
13574
13632
|
var viteSearchPlugin = () => {
|
|
13575
13633
|
const virtualModuleId4 = "virtual:zudoku-search-plugin";
|
|
13576
13634
|
const resolvedVirtualModuleId5 = `\0${virtualModuleId4}`;
|
|
@@ -13588,7 +13646,7 @@ var viteSearchPlugin = () => {
|
|
|
13588
13646
|
return resolvedVirtualModuleId5;
|
|
13589
13647
|
}
|
|
13590
13648
|
if (id === "/pagefind/pagefind.js" && resolvedViteConfig?.publicDir) {
|
|
13591
|
-
return
|
|
13649
|
+
return path39.join(resolvedViteConfig.publicDir, "pagefind/pagefind.js");
|
|
13592
13650
|
}
|
|
13593
13651
|
},
|
|
13594
13652
|
async load(id) {
|
|
@@ -13731,10 +13789,10 @@ function vitePlugin() {
|
|
|
13731
13789
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
13732
13790
|
if (merged.publicDir === false) return void 0;
|
|
13733
13791
|
const rel2 = typeof merged.publicDir === "string" ? merged.publicDir : "public";
|
|
13734
|
-
return
|
|
13792
|
+
return path40.resolve(rootDir, rel2);
|
|
13735
13793
|
};
|
|
13736
|
-
var getAppClientEntryPath = () =>
|
|
13737
|
-
var getAppServerEntryPath = () =>
|
|
13794
|
+
var getAppClientEntryPath = () => path40.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
|
|
13795
|
+
var getAppServerEntryPath = () => path40.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
13738
13796
|
var hasLoggedCdnInfo = false;
|
|
13739
13797
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
13740
13798
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
@@ -13764,7 +13822,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13764
13822
|
);
|
|
13765
13823
|
if (ZuploEnv.isZuplo) {
|
|
13766
13824
|
dotenv.config({
|
|
13767
|
-
path:
|
|
13825
|
+
path: path40.resolve(config2.__meta.rootDir, "../.env.zuplo"),
|
|
13768
13826
|
quiet: true
|
|
13769
13827
|
});
|
|
13770
13828
|
}
|
|
@@ -13810,7 +13868,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13810
13868
|
middlewareMode: true,
|
|
13811
13869
|
open: true,
|
|
13812
13870
|
fs: {
|
|
13813
|
-
allow: [dir,
|
|
13871
|
+
allow: [dir, path40.dirname(dir)]
|
|
13814
13872
|
},
|
|
13815
13873
|
watch: {
|
|
13816
13874
|
ignored: [
|
|
@@ -13826,8 +13884,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13826
13884
|
ssr: configEnv.isSsrBuild,
|
|
13827
13885
|
sourcemap: true,
|
|
13828
13886
|
target: "es2022",
|
|
13829
|
-
outDir:
|
|
13830
|
-
|
|
13887
|
+
outDir: path40.resolve(
|
|
13888
|
+
path40.join(
|
|
13831
13889
|
dir,
|
|
13832
13890
|
"dist",
|
|
13833
13891
|
config2.basePath ?? "",
|
|
@@ -13846,7 +13904,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13846
13904
|
},
|
|
13847
13905
|
experimental: {
|
|
13848
13906
|
renderBuiltUrl(filename) {
|
|
13849
|
-
if (cdnUrl?.base && [".js", ".css"].includes(
|
|
13907
|
+
if (cdnUrl?.base && [".js", ".css"].includes(path40.extname(filename))) {
|
|
13850
13908
|
return joinUrl(cdnUrl.base, filename);
|
|
13851
13909
|
}
|
|
13852
13910
|
if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
|
|
@@ -13859,7 +13917,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13859
13917
|
esbuildOptions: {
|
|
13860
13918
|
target: "es2022"
|
|
13861
13919
|
},
|
|
13862
|
-
entries: [
|
|
13920
|
+
entries: [path40.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
|
|
13863
13921
|
exclude: [
|
|
13864
13922
|
"@lukoweb/apitogo",
|
|
13865
13923
|
"@lukoweb/apitogo-plugin-dev-portal-billing"
|
|
@@ -13963,7 +14021,7 @@ init_package_json();
|
|
|
13963
14021
|
init_joinUrl();
|
|
13964
14022
|
import assert from "node:assert";
|
|
13965
14023
|
import { cp, mkdir as mkdir9, writeFile as writeFile10 } from "node:fs/promises";
|
|
13966
|
-
import
|
|
14024
|
+
import path41 from "node:path";
|
|
13967
14025
|
var pkgJson = getZudokuPackageJson();
|
|
13968
14026
|
function generateOutput({
|
|
13969
14027
|
config: config2,
|
|
@@ -14020,9 +14078,9 @@ async function writeOutput(dir, {
|
|
|
14020
14078
|
rewrites
|
|
14021
14079
|
}) {
|
|
14022
14080
|
const output4 = generateOutput({ config: config2, redirects, rewrites });
|
|
14023
|
-
const outputDir = process.env.VERCEL ?
|
|
14081
|
+
const outputDir = process.env.VERCEL ? path41.join(dir, ".vercel/output") : path41.join(dir, "dist/.output");
|
|
14024
14082
|
await mkdir9(outputDir, { recursive: true });
|
|
14025
|
-
const outputFile =
|
|
14083
|
+
const outputFile = path41.join(outputDir, "config.json");
|
|
14026
14084
|
await writeFile10(outputFile, JSON.stringify(output4, null, 2), "utf-8");
|
|
14027
14085
|
if (process.env.VERCEL) {
|
|
14028
14086
|
console.log("Wrote Vercel output to", outputDir);
|
|
@@ -14034,7 +14092,7 @@ init_logger();
|
|
|
14034
14092
|
init_file_exists();
|
|
14035
14093
|
import { readFile as readFile9, rm as rm6 } from "node:fs/promises";
|
|
14036
14094
|
import os from "node:os";
|
|
14037
|
-
import
|
|
14095
|
+
import path44 from "node:path";
|
|
14038
14096
|
import { pathToFileURL } from "node:url";
|
|
14039
14097
|
import { createIndex } from "pagefind";
|
|
14040
14098
|
import colors11 from "picocolors";
|
|
@@ -14076,7 +14134,7 @@ function throttle(fn) {
|
|
|
14076
14134
|
init_joinUrl();
|
|
14077
14135
|
import { createWriteStream, existsSync as existsSync4 } from "node:fs";
|
|
14078
14136
|
import { mkdir as mkdir10 } from "node:fs/promises";
|
|
14079
|
-
import
|
|
14137
|
+
import path42 from "node:path";
|
|
14080
14138
|
import colors9 from "picocolors";
|
|
14081
14139
|
import { SitemapStream } from "sitemap";
|
|
14082
14140
|
async function generateSitemap({
|
|
@@ -14090,11 +14148,11 @@ async function generateSitemap({
|
|
|
14090
14148
|
return;
|
|
14091
14149
|
}
|
|
14092
14150
|
const sitemap = new SitemapStream({ hostname: config2.siteUrl });
|
|
14093
|
-
const outputDir =
|
|
14151
|
+
const outputDir = path42.resolve(baseOutputDir, config2.outDir ?? "");
|
|
14094
14152
|
if (!existsSync4(outputDir)) {
|
|
14095
14153
|
await mkdir10(outputDir, { recursive: true });
|
|
14096
14154
|
}
|
|
14097
|
-
const sitemapOutputPath =
|
|
14155
|
+
const sitemapOutputPath = path42.join(outputDir, "sitemap.xml");
|
|
14098
14156
|
const writeStream = createWriteStream(sitemapOutputPath);
|
|
14099
14157
|
sitemap.pipe(writeStream);
|
|
14100
14158
|
let lastmod;
|
|
@@ -14124,14 +14182,14 @@ async function generateSitemap({
|
|
|
14124
14182
|
|
|
14125
14183
|
// src/vite/prerender/utils.ts
|
|
14126
14184
|
init_joinUrl();
|
|
14127
|
-
var resolveRoutePath = (
|
|
14128
|
-
const segments =
|
|
14185
|
+
var resolveRoutePath = (path101) => {
|
|
14186
|
+
const segments = path101.split("/");
|
|
14129
14187
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
14130
14188
|
return void 0;
|
|
14131
14189
|
}
|
|
14132
14190
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
14133
14191
|
};
|
|
14134
|
-
var isSkipped = (
|
|
14192
|
+
var isSkipped = (path101) => path101.includes("*") || /^\d+$/.test(path101);
|
|
14135
14193
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
14136
14194
|
if (route.path && isSkipped(route.path)) return [];
|
|
14137
14195
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -14180,12 +14238,12 @@ var prerender = async ({
|
|
|
14180
14238
|
serverConfigFilename,
|
|
14181
14239
|
writeRedirects = true
|
|
14182
14240
|
}) => {
|
|
14183
|
-
const distDir =
|
|
14241
|
+
const distDir = path44.join(dir, "dist", basePath);
|
|
14184
14242
|
const serverConfigPath = pathToFileURL(
|
|
14185
|
-
|
|
14243
|
+
path44.join(distDir, "server", serverConfigFilename)
|
|
14186
14244
|
).href;
|
|
14187
14245
|
const entryServerPath = pathToFileURL(
|
|
14188
|
-
|
|
14246
|
+
path44.join(distDir, "server/entry.server.js")
|
|
14189
14247
|
).href;
|
|
14190
14248
|
const rawConfig = await import(serverConfigPath).then(
|
|
14191
14249
|
(m) => m.default
|
|
@@ -14270,7 +14328,7 @@ var prerender = async ({
|
|
|
14270
14328
|
})
|
|
14271
14329
|
);
|
|
14272
14330
|
const pagefindWriteResult = await pagefindIndex?.writeFiles({
|
|
14273
|
-
outputPath:
|
|
14331
|
+
outputPath: path44.join(distDir, "pagefind")
|
|
14274
14332
|
});
|
|
14275
14333
|
const seconds = ((performance.now() - start) / 1e3).toFixed(1);
|
|
14276
14334
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
@@ -14302,7 +14360,7 @@ var prerender = async ({
|
|
|
14302
14360
|
const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
|
|
14303
14361
|
const docsConfig = DocsConfigSchema2.parse(config2.docs);
|
|
14304
14362
|
const llmsConfig = docsConfig.llms ?? {};
|
|
14305
|
-
const markdownInfoPath =
|
|
14363
|
+
const markdownInfoPath = path44.join(
|
|
14306
14364
|
dir,
|
|
14307
14365
|
"node_modules/.apitogo/markdown-info.json"
|
|
14308
14366
|
);
|
|
@@ -14393,7 +14451,7 @@ async function runBuild(options) {
|
|
|
14393
14451
|
html,
|
|
14394
14452
|
basePath: config2.basePath
|
|
14395
14453
|
});
|
|
14396
|
-
await rm7(
|
|
14454
|
+
await rm7(path45.join(clientOutDir, "index.html"), { force: true });
|
|
14397
14455
|
} else {
|
|
14398
14456
|
await runPrerender({
|
|
14399
14457
|
dir,
|
|
@@ -14417,7 +14475,7 @@ var runPrerender = async (options) => {
|
|
|
14417
14475
|
serverConfigFilename,
|
|
14418
14476
|
writeRedirects: process.env.VERCEL === void 0
|
|
14419
14477
|
});
|
|
14420
|
-
const indexHtml =
|
|
14478
|
+
const indexHtml = path45.join(clientOutDir, "index.html");
|
|
14421
14479
|
if (!workerResults.find((r) => r.outputPath === indexHtml)) {
|
|
14422
14480
|
await writeFile12(indexHtml, html, "utf-8");
|
|
14423
14481
|
}
|
|
@@ -14427,15 +14485,15 @@ var runPrerender = async (options) => {
|
|
|
14427
14485
|
for (const statusPage of statusPages) {
|
|
14428
14486
|
await rename5(
|
|
14429
14487
|
statusPage,
|
|
14430
|
-
|
|
14488
|
+
path45.join(dir, DIST_DIR, path45.basename(statusPage))
|
|
14431
14489
|
);
|
|
14432
14490
|
}
|
|
14433
14491
|
await rm7(serverOutDir, { recursive: true, force: true });
|
|
14434
14492
|
if (process.env.VERCEL) {
|
|
14435
|
-
await mkdir11(
|
|
14493
|
+
await mkdir11(path45.join(dir, ".vercel/output/static"), { recursive: true });
|
|
14436
14494
|
await rename5(
|
|
14437
|
-
|
|
14438
|
-
|
|
14495
|
+
path45.join(dir, DIST_DIR),
|
|
14496
|
+
path45.join(dir, ".vercel/output/static")
|
|
14439
14497
|
);
|
|
14440
14498
|
}
|
|
14441
14499
|
await writeOutput(dir, {
|
|
@@ -14445,7 +14503,7 @@ var runPrerender = async (options) => {
|
|
|
14445
14503
|
});
|
|
14446
14504
|
if (ZuploEnv.isZuplo && issuer) {
|
|
14447
14505
|
await writeFile12(
|
|
14448
|
-
|
|
14506
|
+
path45.join(dir, DIST_DIR, ".output/zuplo.json"),
|
|
14449
14507
|
JSON.stringify({ issuer }, null, 2),
|
|
14450
14508
|
"utf-8"
|
|
14451
14509
|
);
|
|
@@ -14457,10 +14515,10 @@ var runPrerender = async (options) => {
|
|
|
14457
14515
|
};
|
|
14458
14516
|
var bundleSSREntry = async (options) => {
|
|
14459
14517
|
const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
|
|
14460
|
-
const tempEntryPath =
|
|
14518
|
+
const tempEntryPath = path45.join(dir, "__ssr-entry.ts");
|
|
14461
14519
|
const packageRoot = getZudokuRootDir();
|
|
14462
14520
|
const templateContent = await readFile10(
|
|
14463
|
-
|
|
14521
|
+
path45.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
|
|
14464
14522
|
"utf-8"
|
|
14465
14523
|
);
|
|
14466
14524
|
const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
|
|
@@ -14475,9 +14533,9 @@ var bundleSSREntry = async (options) => {
|
|
|
14475
14533
|
platform: adapter === "node" ? "node" : "neutral",
|
|
14476
14534
|
target: "es2022",
|
|
14477
14535
|
format: "esm",
|
|
14478
|
-
outfile:
|
|
14536
|
+
outfile: path45.join(serverOutDir, "entry.js"),
|
|
14479
14537
|
external: ["./entry.server.js", `./${serverConfigFilename}`],
|
|
14480
|
-
nodePaths: [
|
|
14538
|
+
nodePaths: [path45.join(packageRoot, "node_modules")],
|
|
14481
14539
|
banner: { js: "// Bundled SSR entry" }
|
|
14482
14540
|
});
|
|
14483
14541
|
} finally {
|
|
@@ -14488,7 +14546,7 @@ var bundleSSREntry = async (options) => {
|
|
|
14488
14546
|
// src/cli/portal/v2.ts
|
|
14489
14547
|
init_package_json();
|
|
14490
14548
|
function assertPackagesInstalled(resolved, prepared) {
|
|
14491
|
-
const require2 = createRequire2(
|
|
14549
|
+
const require2 = createRequire2(path46.join(resolved.configDir, "package.json"));
|
|
14492
14550
|
const missing = requiredPackages(prepared.plan).filter((name) => {
|
|
14493
14551
|
try {
|
|
14494
14552
|
require2.resolve(name);
|
|
@@ -14535,7 +14593,7 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
|
|
|
14535
14593
|
return {
|
|
14536
14594
|
name: "build",
|
|
14537
14595
|
hash: () => hash2,
|
|
14538
|
-
stillValid: () => access4(
|
|
14596
|
+
stillValid: () => access4(path46.join(buildDir, "index.html")).then(
|
|
14539
14597
|
() => true,
|
|
14540
14598
|
() => false
|
|
14541
14599
|
),
|
|
@@ -14548,11 +14606,11 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
|
|
|
14548
14606
|
process.chdir(originalCwd);
|
|
14549
14607
|
}
|
|
14550
14608
|
await rm8(buildDir, { recursive: true, force: true });
|
|
14551
|
-
await mkdir12(
|
|
14552
|
-
await rename6(
|
|
14609
|
+
await mkdir12(path46.dirname(buildDir), { recursive: true });
|
|
14610
|
+
await rename6(path46.join(root, "dist"), buildDir);
|
|
14553
14611
|
if (prepared.publishedManifest) {
|
|
14554
14612
|
await writeFile13(
|
|
14555
|
-
|
|
14613
|
+
path46.join(buildDir, MANIFEST_FILE),
|
|
14556
14614
|
`${JSON.stringify(prepared.publishedManifest, null, 2)}
|
|
14557
14615
|
`
|
|
14558
14616
|
);
|
|
@@ -14583,15 +14641,15 @@ async function buildV2(options) {
|
|
|
14583
14641
|
// src/cli/check/gateway-online.ts
|
|
14584
14642
|
import { readFile as readFile12 } from "node:fs/promises";
|
|
14585
14643
|
var SPEC_SEND_LIMIT = 5 * 1024 * 1024 + 64 * 1024;
|
|
14586
|
-
var issue2 = (code,
|
|
14644
|
+
var issue2 = (code, path101, message, hint) => ({ code, path: path101, message, hint });
|
|
14587
14645
|
function capabilityIssues(gateway, answer) {
|
|
14588
14646
|
const can = answer.capabilities;
|
|
14589
14647
|
const plan2 = `your ${answer.tier} plan`;
|
|
14590
14648
|
const found = [];
|
|
14591
|
-
const unsupported = (
|
|
14649
|
+
const unsupported = (path101, what, hint) => found.push(
|
|
14592
14650
|
issue2(
|
|
14593
14651
|
"GATEWAY_CAPABILITY_UNSUPPORTED",
|
|
14594
|
-
|
|
14652
|
+
path101,
|
|
14595
14653
|
`${what} is not available on ${plan2}.`,
|
|
14596
14654
|
hint
|
|
14597
14655
|
)
|
|
@@ -14667,7 +14725,7 @@ async function onlineGatewayRules(gateway, projectId, api, derivedCors = []) {
|
|
|
14667
14725
|
async function isConfigV2(dir) {
|
|
14668
14726
|
try {
|
|
14669
14727
|
return /"version"\s*:\s*2\b/.test(
|
|
14670
|
-
await readFile13(
|
|
14728
|
+
await readFile13(path47.join(dir, APITOGO_CONFIG_FILENAME), "utf8")
|
|
14671
14729
|
);
|
|
14672
14730
|
} catch {
|
|
14673
14731
|
return false;
|
|
@@ -14761,7 +14819,7 @@ async function validatePortalBuild(dir) {
|
|
|
14761
14819
|
}
|
|
14762
14820
|
}
|
|
14763
14821
|
async function runCheckV2(dir, args = {}, deps = {}) {
|
|
14764
|
-
const configPath =
|
|
14822
|
+
const configPath = path47.join(dir, APITOGO_CONFIG_FILENAME);
|
|
14765
14823
|
let report;
|
|
14766
14824
|
let layout;
|
|
14767
14825
|
try {
|
|
@@ -14850,7 +14908,7 @@ async function checkV2(dir, args, deps = platformDependencies(args)) {
|
|
|
14850
14908
|
init_package_json();
|
|
14851
14909
|
|
|
14852
14910
|
// src/cli/init/v2-handler.ts
|
|
14853
|
-
import
|
|
14911
|
+
import path48 from "node:path";
|
|
14854
14912
|
import { createInterface } from "node:readline/promises";
|
|
14855
14913
|
function parseOnlyFlag(value) {
|
|
14856
14914
|
const services = (value ?? "portal").split(",").map((name) => name.trim()).filter(Boolean);
|
|
@@ -14903,9 +14961,9 @@ function describePlan(plan2) {
|
|
|
14903
14961
|
layoutReason: plan2.layoutReason,
|
|
14904
14962
|
docsIncluded: plan2.docsIncluded,
|
|
14905
14963
|
willCreate: plan2.entries.map(
|
|
14906
|
-
(entry) =>
|
|
14964
|
+
(entry) => path48.relative(plan2.dir, entry.path)
|
|
14907
14965
|
),
|
|
14908
|
-
willKeep: plan2.keep.map((target) =>
|
|
14966
|
+
willKeep: plan2.keep.map((target) => path48.relative(plan2.dir, target)),
|
|
14909
14967
|
replacesConfig: plan2.replacesConfig
|
|
14910
14968
|
};
|
|
14911
14969
|
}
|
|
@@ -14913,7 +14971,7 @@ async function initV2(argv) {
|
|
|
14913
14971
|
const json = argv.json === true;
|
|
14914
14972
|
try {
|
|
14915
14973
|
parseOnlyFlag(argv.only);
|
|
14916
|
-
const dir =
|
|
14974
|
+
const dir = path48.resolve(process.cwd(), argv.dir ?? ".");
|
|
14917
14975
|
const options = {
|
|
14918
14976
|
dir,
|
|
14919
14977
|
layout: argv.layout,
|
|
@@ -14970,8 +15028,8 @@ async function initV2(argv) {
|
|
|
14970
15028
|
status: "created",
|
|
14971
15029
|
dir,
|
|
14972
15030
|
...describePlan(plan2),
|
|
14973
|
-
created: result.created.map((p) =>
|
|
14974
|
-
kept: result.kept.map((p) =>
|
|
15031
|
+
created: result.created.map((p) => path48.relative(dir, p)),
|
|
15032
|
+
kept: result.kept.map((p) => path48.relative(dir, p))
|
|
14975
15033
|
},
|
|
14976
15034
|
null,
|
|
14977
15035
|
2
|
|
@@ -14980,7 +15038,7 @@ async function initV2(argv) {
|
|
|
14980
15038
|
return;
|
|
14981
15039
|
}
|
|
14982
15040
|
printResultToConsole(
|
|
14983
|
-
`Created ${
|
|
15041
|
+
`Created ${path48.basename(plan2.configPath)} (config version 2, ${plan2.layout} layout) in ${dir}.`
|
|
14984
15042
|
);
|
|
14985
15043
|
printHintToConsole(
|
|
14986
15044
|
"Config version 2 is a preview: add, remove, check, run, build, plan, status, deploy and secrets read it."
|
|
@@ -15008,7 +15066,7 @@ async function initV2(argv) {
|
|
|
15008
15066
|
// src/cli/services/packages.ts
|
|
15009
15067
|
import { spawn } from "node:child_process";
|
|
15010
15068
|
import { existsSync as existsSync5 } from "node:fs";
|
|
15011
|
-
import
|
|
15069
|
+
import path49 from "node:path";
|
|
15012
15070
|
var USER_PANEL_PACKAGE = "@lukoweb/apitogo-module-user-panel";
|
|
15013
15071
|
var BILLING_PLUGIN_PACKAGE = "@lukoweb/apitogo-plugin-dev-portal-billing";
|
|
15014
15072
|
function packagesForConfig(config2) {
|
|
@@ -15023,18 +15081,18 @@ function packagesForConfig(config2) {
|
|
|
15023
15081
|
];
|
|
15024
15082
|
}
|
|
15025
15083
|
function isInstalled(dir, name) {
|
|
15026
|
-
for (let current =
|
|
15027
|
-
if (existsSync5(
|
|
15084
|
+
for (let current = path49.resolve(dir); ; current = path49.dirname(current)) {
|
|
15085
|
+
if (existsSync5(path49.join(current, "node_modules", name, "package.json")))
|
|
15028
15086
|
return true;
|
|
15029
|
-
if (
|
|
15087
|
+
if (path49.dirname(current) === current) return false;
|
|
15030
15088
|
}
|
|
15031
15089
|
}
|
|
15032
15090
|
function missingPackages(dir, names) {
|
|
15033
15091
|
return names.filter((name) => !isInstalled(dir, name));
|
|
15034
15092
|
}
|
|
15035
15093
|
function detectPackageManager(dir) {
|
|
15036
|
-
if (existsSync5(
|
|
15037
|
-
if (existsSync5(
|
|
15094
|
+
if (existsSync5(path49.join(dir, "pnpm-lock.yaml"))) return "pnpm";
|
|
15095
|
+
if (existsSync5(path49.join(dir, "yarn.lock"))) return "yarn";
|
|
15038
15096
|
return "npm";
|
|
15039
15097
|
}
|
|
15040
15098
|
function installCommand(manager, names, version) {
|
|
@@ -15069,7 +15127,7 @@ async function installMissingPackages(dir, config2, version, options) {
|
|
|
15069
15127
|
reason: "--no-install was given",
|
|
15070
15128
|
command: shown
|
|
15071
15129
|
};
|
|
15072
|
-
if (!existsSync5(
|
|
15130
|
+
if (!existsSync5(path49.join(dir, "package.json")))
|
|
15073
15131
|
return {
|
|
15074
15132
|
status: "skipped",
|
|
15075
15133
|
packages: missing,
|
|
@@ -15088,7 +15146,7 @@ var list = (value) => {
|
|
|
15088
15146
|
return items.length > 0 ? items : void 0;
|
|
15089
15147
|
};
|
|
15090
15148
|
function addOptionsFromArguments(service, argv) {
|
|
15091
|
-
const dir =
|
|
15149
|
+
const dir = path50.resolve(process.cwd(), argv.dir ?? ".");
|
|
15092
15150
|
const issuers = list(argv.issuer);
|
|
15093
15151
|
return {
|
|
15094
15152
|
dir,
|
|
@@ -15147,8 +15205,8 @@ function describe(edit, dir) {
|
|
|
15147
15205
|
return {
|
|
15148
15206
|
service: edit.service,
|
|
15149
15207
|
action: edit.action,
|
|
15150
|
-
willCreate: edit.files.map((file) =>
|
|
15151
|
-
keep: edit.keep.map((file) =>
|
|
15208
|
+
willCreate: edit.files.map((file) => path50.relative(dir, file.path)),
|
|
15209
|
+
keep: edit.keep.map((file) => path50.relative(dir, file)),
|
|
15152
15210
|
notes: edit.notes
|
|
15153
15211
|
};
|
|
15154
15212
|
}
|
|
@@ -15161,7 +15219,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15161
15219
|
`Choose one of ${SERVICES.join(", ")}.`
|
|
15162
15220
|
);
|
|
15163
15221
|
}
|
|
15164
|
-
const dir =
|
|
15222
|
+
const dir = path50.resolve(process.cwd(), argv.dir ?? ".");
|
|
15165
15223
|
if (!await isConfigV2(dir)) {
|
|
15166
15224
|
throw new ServiceEditError(
|
|
15167
15225
|
`${action} works with a config version 2 project, and there is none in ${dir}.`,
|
|
@@ -15208,7 +15266,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15208
15266
|
{
|
|
15209
15267
|
status: action === "add" ? "added" : "removed",
|
|
15210
15268
|
...describe(edit, dir),
|
|
15211
|
-
created: created.map((file) =>
|
|
15269
|
+
created: created.map((file) => path50.relative(dir, file)),
|
|
15212
15270
|
...install ? { packages: install } : {}
|
|
15213
15271
|
},
|
|
15214
15272
|
null,
|
|
@@ -15218,7 +15276,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15218
15276
|
return;
|
|
15219
15277
|
}
|
|
15220
15278
|
printResultToConsole(
|
|
15221
|
-
`${action === "add" ? "Added" : "Removed"} ${edit.service} in ${
|
|
15279
|
+
`${action === "add" ? "Added" : "Removed"} ${edit.service} in ${path50.basename(edit.configPath)}.`
|
|
15222
15280
|
);
|
|
15223
15281
|
} catch (error) {
|
|
15224
15282
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -15276,7 +15334,7 @@ var removeService = (argv) => run(
|
|
|
15276
15334
|
"remove",
|
|
15277
15335
|
argv,
|
|
15278
15336
|
(service) => planRemoveService(service, {
|
|
15279
|
-
dir:
|
|
15337
|
+
dir: path50.resolve(process.cwd(), argv.dir ?? ".")
|
|
15280
15338
|
})
|
|
15281
15339
|
);
|
|
15282
15340
|
|
|
@@ -15424,16 +15482,16 @@ var add_default = {
|
|
|
15424
15482
|
};
|
|
15425
15483
|
|
|
15426
15484
|
// src/cli/build/handler.ts
|
|
15427
|
-
import
|
|
15485
|
+
import path52 from "node:path";
|
|
15428
15486
|
init_logger();
|
|
15429
15487
|
init_package_json();
|
|
15430
15488
|
|
|
15431
15489
|
// src/cli/preview/handler.ts
|
|
15432
|
-
import
|
|
15490
|
+
import path51 from "node:path";
|
|
15433
15491
|
import { preview as vitePreview } from "vite";
|
|
15434
15492
|
var DEFAULT_PREVIEW_PORT = 4e3;
|
|
15435
15493
|
async function preview(argv) {
|
|
15436
|
-
const dir =
|
|
15494
|
+
const dir = path51.resolve(process.cwd(), argv.dir);
|
|
15437
15495
|
const viteConfig = await getViteConfig(dir, {
|
|
15438
15496
|
command: "serve",
|
|
15439
15497
|
mode: "production",
|
|
@@ -15476,7 +15534,7 @@ async function build(argv) {
|
|
|
15476
15534
|
printDiagnosticsToConsole("");
|
|
15477
15535
|
printDiagnosticsToConsole("");
|
|
15478
15536
|
}
|
|
15479
|
-
const dir =
|
|
15537
|
+
const dir = path52.resolve(process.cwd(), argv.dir);
|
|
15480
15538
|
try {
|
|
15481
15539
|
if (await isConfigV2(dir)) {
|
|
15482
15540
|
const result = await buildV2({ dir, jsonOnly });
|
|
@@ -15541,10 +15599,10 @@ var build_default = {
|
|
|
15541
15599
|
};
|
|
15542
15600
|
|
|
15543
15601
|
// src/cli/check/handler.ts
|
|
15544
|
-
import
|
|
15602
|
+
import path59 from "node:path";
|
|
15545
15603
|
|
|
15546
15604
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
15547
|
-
import
|
|
15605
|
+
import path58 from "node:path";
|
|
15548
15606
|
|
|
15549
15607
|
// src/cli/platform/helpers/dev-portal-backend.ts
|
|
15550
15608
|
function deriveProvisioningState(backend) {
|
|
@@ -15629,10 +15687,10 @@ function formatDevPortalBackendResponse(projectId, backend) {
|
|
|
15629
15687
|
init_gateway_limits();
|
|
15630
15688
|
import { existsSync as existsSync6 } from "node:fs";
|
|
15631
15689
|
import { access as access5, mkdir as mkdir13, readFile as readFile14, writeFile as writeFile14 } from "node:fs/promises";
|
|
15632
|
-
import
|
|
15690
|
+
import path54 from "node:path";
|
|
15633
15691
|
|
|
15634
15692
|
// src/cli/make-config/json-config.ts
|
|
15635
|
-
import
|
|
15693
|
+
import path53 from "node:path";
|
|
15636
15694
|
|
|
15637
15695
|
// src/cli/make-config/branding-assets.ts
|
|
15638
15696
|
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 +16160,9 @@ function openapiInputForConfig(specRelativePosix) {
|
|
|
16102
16160
|
return `./${specRelativePosix}`;
|
|
16103
16161
|
}
|
|
16104
16162
|
function toRelativeOpenApiInput(projectDir, inputPath) {
|
|
16105
|
-
const resolved =
|
|
16106
|
-
const relative =
|
|
16107
|
-
const posix = relative.split(
|
|
16163
|
+
const resolved = path53.isAbsolute(inputPath) ? inputPath : path53.resolve(projectDir, inputPath);
|
|
16164
|
+
const relative = path53.relative(projectDir, resolved);
|
|
16165
|
+
const posix = relative.split(path53.sep).join(path53.posix.sep);
|
|
16108
16166
|
if (!posix) {
|
|
16109
16167
|
throw new Error("OpenAPI path must point to a file.");
|
|
16110
16168
|
}
|
|
@@ -16328,8 +16386,8 @@ function readHeaderNavigation(config2) {
|
|
|
16328
16386
|
function isDocsItem(item) {
|
|
16329
16387
|
return isPlainObject4(item) && (item.to === TEMPLATE_DOCS_PATH || typeof item.label === "string" && item.label.trim().toLowerCase() === HEADER_DOCS_LABEL.toLowerCase());
|
|
16330
16388
|
}
|
|
16331
|
-
function ensureHeaderDocsNavigation(config2,
|
|
16332
|
-
const firstRoute = sortDocPaths(
|
|
16389
|
+
function ensureHeaderDocsNavigation(config2, docRoutes2) {
|
|
16390
|
+
const firstRoute = sortDocPaths(docRoutes2)[0];
|
|
16333
16391
|
const current = readHeaderNavigation(config2);
|
|
16334
16392
|
if (!firstRoute || !current) return config2;
|
|
16335
16393
|
const { header, navigation } = current;
|
|
@@ -16384,7 +16442,7 @@ function isPlanFree(plan2) {
|
|
|
16384
16442
|
return (plan2.priceAmount ?? 0) <= 0;
|
|
16385
16443
|
}
|
|
16386
16444
|
function manifestFilePath(siteDirectory) {
|
|
16387
|
-
return
|
|
16445
|
+
return path54.join(path54.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
|
|
16388
16446
|
}
|
|
16389
16447
|
var STORED_MANIFEST_KEYS = [
|
|
16390
16448
|
"authentication",
|
|
@@ -16857,23 +16915,23 @@ function resolveBackendSourceDirectory(siteDirectory, sourceDirectory) {
|
|
|
16857
16915
|
if (!trimmed) {
|
|
16858
16916
|
return void 0;
|
|
16859
16917
|
}
|
|
16860
|
-
return
|
|
16918
|
+
return path54.resolve(siteDirectory, trimmed);
|
|
16861
16919
|
}
|
|
16862
16920
|
function resolveBackendOpenApiPath(openApiPath, options) {
|
|
16863
16921
|
const trimmed = openApiPath?.trim();
|
|
16864
16922
|
if (!trimmed) {
|
|
16865
16923
|
return void 0;
|
|
16866
16924
|
}
|
|
16867
|
-
if (
|
|
16925
|
+
if (path54.isAbsolute(trimmed)) {
|
|
16868
16926
|
return trimmed;
|
|
16869
16927
|
}
|
|
16870
|
-
const siteResolved =
|
|
16928
|
+
const siteResolved = path54.resolve(options.siteDirectory, trimmed);
|
|
16871
16929
|
if (existsSync6(siteResolved)) {
|
|
16872
16930
|
return siteResolved;
|
|
16873
16931
|
}
|
|
16874
16932
|
const backendDir = options.backendSourceDirectory?.trim();
|
|
16875
16933
|
if (backendDir) {
|
|
16876
|
-
const backendResolved =
|
|
16934
|
+
const backendResolved = path54.resolve(backendDir, trimmed);
|
|
16877
16935
|
if (existsSync6(backendResolved)) {
|
|
16878
16936
|
return backendResolved;
|
|
16879
16937
|
}
|
|
@@ -16881,15 +16939,15 @@ function resolveBackendOpenApiPath(openApiPath, options) {
|
|
|
16881
16939
|
return siteResolved;
|
|
16882
16940
|
}
|
|
16883
16941
|
function toSiteRelativeOpenApiInput(siteDirectory, openApiAbsolutePath) {
|
|
16884
|
-
const relative =
|
|
16885
|
-
|
|
16886
|
-
|
|
16942
|
+
const relative = path54.relative(
|
|
16943
|
+
path54.resolve(siteDirectory),
|
|
16944
|
+
path54.resolve(openApiAbsolutePath)
|
|
16887
16945
|
);
|
|
16888
|
-
const posix = relative.split(
|
|
16946
|
+
const posix = relative.split(path54.sep).join("/");
|
|
16889
16947
|
if (!posix || posix === ".") {
|
|
16890
16948
|
return "./";
|
|
16891
16949
|
}
|
|
16892
|
-
if (
|
|
16950
|
+
if (path54.isAbsolute(posix) || posix.startsWith("..")) {
|
|
16893
16951
|
return posix;
|
|
16894
16952
|
}
|
|
16895
16953
|
return posix.startsWith("./") ? posix : `./${posix}`;
|
|
@@ -16936,7 +16994,7 @@ async function readManifest2(siteDirectory) {
|
|
|
16936
16994
|
}
|
|
16937
16995
|
async function writeManifest2(siteDirectory, manifest) {
|
|
16938
16996
|
const filePath = manifestFilePath(siteDirectory);
|
|
16939
|
-
await mkdir13(
|
|
16997
|
+
await mkdir13(path54.dirname(filePath), { recursive: true });
|
|
16940
16998
|
let config2 = {};
|
|
16941
16999
|
if (await pathExists(filePath)) {
|
|
16942
17000
|
const raw = await readFile14(filePath, "utf8");
|
|
@@ -16962,7 +17020,7 @@ import {
|
|
|
16962
17020
|
unlink,
|
|
16963
17021
|
writeFile as writeFile15
|
|
16964
17022
|
} from "node:fs/promises";
|
|
16965
|
-
import
|
|
17023
|
+
import path55 from "node:path";
|
|
16966
17024
|
var ENV_FILENAME = ".env";
|
|
16967
17025
|
var COLLAPSED_UPPERCASE_ALIASES2 = {
|
|
16968
17026
|
SECRETKEY: "secretKey",
|
|
@@ -17081,12 +17139,12 @@ async function readEnvFile(filePath) {
|
|
|
17081
17139
|
}
|
|
17082
17140
|
}
|
|
17083
17141
|
async function loadSiteEnv(siteDirectory) {
|
|
17084
|
-
const resolvedDirectory =
|
|
17142
|
+
const resolvedDirectory = path55.resolve(siteDirectory);
|
|
17085
17143
|
const merged = { ...process.env };
|
|
17086
17144
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
17087
17145
|
Object.assign(
|
|
17088
17146
|
merged,
|
|
17089
|
-
await readEnvFile(
|
|
17147
|
+
await readEnvFile(path55.join(resolvedDirectory, fileName))
|
|
17090
17148
|
);
|
|
17091
17149
|
}
|
|
17092
17150
|
return merged;
|
|
@@ -17123,7 +17181,7 @@ function buildAuthSecretsJson(secrets2, options) {
|
|
|
17123
17181
|
return payload;
|
|
17124
17182
|
}
|
|
17125
17183
|
function envFilePath(siteDirectory) {
|
|
17126
|
-
return
|
|
17184
|
+
return path55.join(path55.resolve(siteDirectory), ENV_FILENAME);
|
|
17127
17185
|
}
|
|
17128
17186
|
function createEnvContent() {
|
|
17129
17187
|
return [
|
|
@@ -17187,7 +17245,7 @@ function validateSecretsForPublish(manifest, secrets2, emailOptions) {
|
|
|
17187
17245
|
}
|
|
17188
17246
|
async function siteEnvFileHasEntries(siteDirectory) {
|
|
17189
17247
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
17190
|
-
const loaded = await readEnvFile(
|
|
17248
|
+
const loaded = await readEnvFile(path55.join(siteDirectory, fileName));
|
|
17191
17249
|
if (Object.keys(loaded).length > 0) {
|
|
17192
17250
|
return true;
|
|
17193
17251
|
}
|
|
@@ -17195,7 +17253,7 @@ async function siteEnvFileHasEntries(siteDirectory) {
|
|
|
17195
17253
|
return false;
|
|
17196
17254
|
}
|
|
17197
17255
|
async function resolvePublishConfig(siteDirectory, emailOptions) {
|
|
17198
|
-
const resolvedDirectory =
|
|
17256
|
+
const resolvedDirectory = path55.resolve(siteDirectory);
|
|
17199
17257
|
const manifestRaw = await readManifest2(resolvedDirectory);
|
|
17200
17258
|
if (!manifestRaw) {
|
|
17201
17259
|
throw new Error("apitogo.config.json not found in sourceDirectory.");
|
|
@@ -17228,7 +17286,7 @@ function envFileHasActiveAssignments(content) {
|
|
|
17228
17286
|
});
|
|
17229
17287
|
}
|
|
17230
17288
|
async function writeScaffoldEnv(siteDirectory) {
|
|
17231
|
-
const resolvedDirectory =
|
|
17289
|
+
const resolvedDirectory = path55.resolve(siteDirectory);
|
|
17232
17290
|
const filesWritten = [];
|
|
17233
17291
|
const envPath = envFilePath(resolvedDirectory);
|
|
17234
17292
|
try {
|
|
@@ -17239,7 +17297,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
17239
17297
|
filesWritten.push(ENV_FILENAME);
|
|
17240
17298
|
}
|
|
17241
17299
|
for (const legacyName of [".env.example"]) {
|
|
17242
|
-
const legacyPath =
|
|
17300
|
+
const legacyPath = path55.join(resolvedDirectory, legacyName);
|
|
17243
17301
|
try {
|
|
17244
17302
|
const legacy = await readFile15(legacyPath, "utf8");
|
|
17245
17303
|
if (!envFileHasActiveAssignments(legacy)) {
|
|
@@ -17249,7 +17307,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
17249
17307
|
} catch {
|
|
17250
17308
|
}
|
|
17251
17309
|
}
|
|
17252
|
-
const gitignorePath =
|
|
17310
|
+
const gitignorePath = path55.join(resolvedDirectory, ".gitignore");
|
|
17253
17311
|
let gitignore = "";
|
|
17254
17312
|
try {
|
|
17255
17313
|
gitignore = await readFile15(gitignorePath, "utf8");
|
|
@@ -17286,11 +17344,11 @@ var SECRETS_COLLECTION_INSTRUCTION = "For go-live, plans must already be in apit
|
|
|
17286
17344
|
init_gateway_limits();
|
|
17287
17345
|
import { readFile as readFile16 } from "node:fs/promises";
|
|
17288
17346
|
import { createRequire as createRequire3 } from "node:module";
|
|
17289
|
-
import
|
|
17347
|
+
import path56 from "node:path";
|
|
17290
17348
|
var cachedFallbackTs;
|
|
17291
17349
|
async function loadTypeScriptForSite(sourceDirectory) {
|
|
17292
17350
|
const require2 = createRequire3(
|
|
17293
|
-
|
|
17351
|
+
path56.join(path56.resolve(sourceDirectory), "package.json")
|
|
17294
17352
|
);
|
|
17295
17353
|
try {
|
|
17296
17354
|
return require2("typescript");
|
|
@@ -17337,7 +17395,7 @@ async function referencedFileExists(sourceDirectory, reference) {
|
|
|
17337
17395
|
return true;
|
|
17338
17396
|
}
|
|
17339
17397
|
return pathExists(
|
|
17340
|
-
|
|
17398
|
+
path56.resolve(sourceDirectory, reference.replace(/^\.\//, ""))
|
|
17341
17399
|
);
|
|
17342
17400
|
}
|
|
17343
17401
|
async function validateSiteConfigStructure(config2, sourceDirectory) {
|
|
@@ -17452,11 +17510,11 @@ var DEFAULT_TSX_CANDIDATES = [
|
|
|
17452
17510
|
"landing/LandingPage.tsx"
|
|
17453
17511
|
];
|
|
17454
17512
|
async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
17455
|
-
const resolvedDir =
|
|
17513
|
+
const resolvedDir = path56.resolve(sourceDirectory);
|
|
17456
17514
|
const issues = [];
|
|
17457
17515
|
const checkedFiles = [];
|
|
17458
17516
|
const skippedChecks = [];
|
|
17459
|
-
const jsonPath =
|
|
17517
|
+
const jsonPath = path56.join(resolvedDir, APITOGO_CONFIG_FILENAME2);
|
|
17460
17518
|
if (await pathExists(jsonPath)) {
|
|
17461
17519
|
checkedFiles.push(APITOGO_CONFIG_FILENAME2);
|
|
17462
17520
|
let parsed;
|
|
@@ -17488,7 +17546,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
17488
17546
|
);
|
|
17489
17547
|
const existingTsxFiles = [];
|
|
17490
17548
|
for (const relativeFile of tsxFiles) {
|
|
17491
|
-
if (await pathExists(
|
|
17549
|
+
if (await pathExists(path56.join(resolvedDir, relativeFile))) {
|
|
17492
17550
|
existingTsxFiles.push(relativeFile);
|
|
17493
17551
|
}
|
|
17494
17552
|
}
|
|
@@ -17502,7 +17560,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
17502
17560
|
for (const relativeFile of existingTsxFiles) {
|
|
17503
17561
|
checkedFiles.push(relativeFile);
|
|
17504
17562
|
const content = await readFile16(
|
|
17505
|
-
|
|
17563
|
+
path56.join(resolvedDir, relativeFile),
|
|
17506
17564
|
"utf8"
|
|
17507
17565
|
);
|
|
17508
17566
|
issues.push(
|
|
@@ -17540,7 +17598,7 @@ function buildSiteValidationResponseFields(result) {
|
|
|
17540
17598
|
// src/cli/platform/helpers/npm-build.ts
|
|
17541
17599
|
import { spawn as spawn2 } from "node:child_process";
|
|
17542
17600
|
import { access as access7, readFile as readFile17 } from "node:fs/promises";
|
|
17543
|
-
import
|
|
17601
|
+
import path57 from "node:path";
|
|
17544
17602
|
var BUILD_LOG_TAIL_BYTES = 8192;
|
|
17545
17603
|
var MIN_NODE_MAJOR = 20;
|
|
17546
17604
|
var NpmBuildError = class extends Error {
|
|
@@ -17607,13 +17665,13 @@ function runCommand(command2, args, cwd, env) {
|
|
|
17607
17665
|
}
|
|
17608
17666
|
async function runNpmInstall(sourceDirectory, options) {
|
|
17609
17667
|
assertNodeVersion(options?.nodeVersion);
|
|
17610
|
-
const cwd =
|
|
17611
|
-
const packageJsonPath =
|
|
17668
|
+
const cwd = path57.resolve(sourceDirectory);
|
|
17669
|
+
const packageJsonPath = path57.join(cwd, "package.json");
|
|
17612
17670
|
if (!await pathExists2(packageJsonPath)) {
|
|
17613
17671
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
17614
17672
|
}
|
|
17615
17673
|
const startedAt = Date.now();
|
|
17616
|
-
const lockPath =
|
|
17674
|
+
const lockPath = path57.join(cwd, "package-lock.json");
|
|
17617
17675
|
const installArgs = await pathExists2(lockPath) ? ["ci"] : ["install"];
|
|
17618
17676
|
const install = await runCommand("npm", installArgs, cwd);
|
|
17619
17677
|
const installLog = install.output;
|
|
@@ -17631,8 +17689,8 @@ async function runNpmInstall(sourceDirectory, options) {
|
|
|
17631
17689
|
}
|
|
17632
17690
|
async function runNpmBuild(sourceDirectory, options) {
|
|
17633
17691
|
assertNodeVersion(options?.nodeVersion);
|
|
17634
|
-
const cwd =
|
|
17635
|
-
const packageJsonPath =
|
|
17692
|
+
const cwd = path57.resolve(sourceDirectory);
|
|
17693
|
+
const packageJsonPath = path57.join(cwd, "package.json");
|
|
17636
17694
|
if (!await pathExists2(packageJsonPath)) {
|
|
17637
17695
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
17638
17696
|
}
|
|
@@ -17649,8 +17707,8 @@ async function runNpmBuild(sourceDirectory, options) {
|
|
|
17649
17707
|
build2.exitCode
|
|
17650
17708
|
);
|
|
17651
17709
|
}
|
|
17652
|
-
const distPath =
|
|
17653
|
-
const indexPath =
|
|
17710
|
+
const distPath = path57.join(cwd, "dist");
|
|
17711
|
+
const indexPath = path57.join(distPath, "index.html");
|
|
17654
17712
|
if (!await pathExists2(indexPath)) {
|
|
17655
17713
|
throw new NpmBuildError(
|
|
17656
17714
|
`Build completed but dist/index.html was not found at ${indexPath}`,
|
|
@@ -18034,7 +18092,7 @@ function validateManifestForPlatformPublish(manifest) {
|
|
|
18034
18092
|
|
|
18035
18093
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
18036
18094
|
async function checkPublishReadiness(client, _config, args) {
|
|
18037
|
-
const sourceDirectory =
|
|
18095
|
+
const sourceDirectory = path58.resolve(args.sourceDirectory);
|
|
18038
18096
|
const manifest = await readManifest2(sourceDirectory) ?? createScaffoldManifest();
|
|
18039
18097
|
const emailOptions = await resolveEmailOptionsForPublish(
|
|
18040
18098
|
client,
|
|
@@ -18112,7 +18170,7 @@ async function checkPublishReadiness(client, _config, args) {
|
|
|
18112
18170
|
|
|
18113
18171
|
// src/cli/check/handler.ts
|
|
18114
18172
|
async function check(argv) {
|
|
18115
|
-
const sourceDirectory =
|
|
18173
|
+
const sourceDirectory = path59.resolve(process.cwd(), argv.dir);
|
|
18116
18174
|
if (await isConfigV2(sourceDirectory)) {
|
|
18117
18175
|
await checkV2(sourceDirectory, argv);
|
|
18118
18176
|
return;
|
|
@@ -18177,13 +18235,13 @@ var check_default = {
|
|
|
18177
18235
|
// src/cli/make-config/handler.ts
|
|
18178
18236
|
import { constants as constants2 } from "node:fs";
|
|
18179
18237
|
import { access as access12, mkdir as mkdir17, readFile as readFile22, writeFile as writeFile20 } from "node:fs/promises";
|
|
18180
|
-
import
|
|
18238
|
+
import path69 from "node:path";
|
|
18181
18239
|
import { stdin as input2 } from "node:process";
|
|
18182
|
-
import { glob as
|
|
18240
|
+
import { glob as glob8 } from "glob";
|
|
18183
18241
|
|
|
18184
18242
|
// src/cli/platform/helpers/openapi-action-keys.ts
|
|
18185
18243
|
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "node:fs";
|
|
18186
|
-
import
|
|
18244
|
+
import path60 from "node:path";
|
|
18187
18245
|
import YAML from "yaml";
|
|
18188
18246
|
var HTTP_METHODS = [
|
|
18189
18247
|
"get",
|
|
@@ -18252,7 +18310,7 @@ function extractGatewayActionKeysFromOpenApiDocument(document) {
|
|
|
18252
18310
|
function extractGatewayActionKeysFromOpenApiFile(filePath) {
|
|
18253
18311
|
try {
|
|
18254
18312
|
const raw = readFileSync4(filePath, "utf8");
|
|
18255
|
-
const ext =
|
|
18313
|
+
const ext = path60.extname(filePath).toLowerCase();
|
|
18256
18314
|
const parsed = ext === ".json" ? JSON.parse(raw) : YAML.parse(raw);
|
|
18257
18315
|
return extractGatewayActionKeysFromOpenApiDocument(parsed);
|
|
18258
18316
|
} catch {
|
|
@@ -18273,7 +18331,7 @@ function resolveConfigOpenApiFilePath(siteDirectory, config2) {
|
|
|
18273
18331
|
}
|
|
18274
18332
|
}
|
|
18275
18333
|
for (const candidate of candidates) {
|
|
18276
|
-
const resolved =
|
|
18334
|
+
const resolved = path60.isAbsolute(candidate) ? candidate : path60.resolve(siteDirectory, candidate);
|
|
18277
18335
|
if (existsSync7(resolved)) {
|
|
18278
18336
|
return resolved;
|
|
18279
18337
|
}
|
|
@@ -18288,7 +18346,7 @@ function loadOpenApiActionKeysForSite(siteDirectory, config2) {
|
|
|
18288
18346
|
return extractGatewayActionKeysFromOpenApiFile(filePath);
|
|
18289
18347
|
}
|
|
18290
18348
|
function loadOpenApiActionKeysFromSiteDirectory(siteDirectory) {
|
|
18291
|
-
const configPath =
|
|
18349
|
+
const configPath = path60.join(siteDirectory, "apitogo.config.json");
|
|
18292
18350
|
if (!existsSync7(configPath)) {
|
|
18293
18351
|
return [];
|
|
18294
18352
|
}
|
|
@@ -18317,7 +18375,7 @@ function withDefaultIncludedActionKeys(plan2, actionKeys) {
|
|
|
18317
18375
|
|
|
18318
18376
|
// src/cli/scaffold/dev-portal-config-pages.ts
|
|
18319
18377
|
import { access as access8, readFile as readFile18, rename as rename7, rm as rm9, writeFile as writeFile16 } from "node:fs/promises";
|
|
18320
|
-
import
|
|
18378
|
+
import path61 from "node:path";
|
|
18321
18379
|
async function writeConfigAtomically(filePath, content) {
|
|
18322
18380
|
const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
18323
18381
|
try {
|
|
@@ -18330,7 +18388,7 @@ async function writeConfigAtomically(filePath, content) {
|
|
|
18330
18388
|
}
|
|
18331
18389
|
async function resolveApitogoConfigPath(sourceDirectory) {
|
|
18332
18390
|
for (const filename of ["apitogo.config.tsx", "apitogo.config.jsx"]) {
|
|
18333
|
-
const configPath =
|
|
18391
|
+
const configPath = path61.join(sourceDirectory, filename);
|
|
18334
18392
|
try {
|
|
18335
18393
|
await access8(configPath);
|
|
18336
18394
|
return configPath;
|
|
@@ -19094,17 +19152,17 @@ async function wireNewDevPortalPageInConfig(sourceDirectory, slug, label) {
|
|
|
19094
19152
|
|
|
19095
19153
|
// src/cli/scaffold/wire-openapi.ts
|
|
19096
19154
|
import { access as access10, readFile as readFile20, writeFile as writeFile18 } from "node:fs/promises";
|
|
19097
|
-
import
|
|
19155
|
+
import path66 from "node:path";
|
|
19098
19156
|
|
|
19099
19157
|
// src/cli/platform/helpers/openapi.ts
|
|
19100
19158
|
import { promises as fs6 } from "node:fs";
|
|
19101
|
-
import
|
|
19159
|
+
import path63 from "node:path";
|
|
19102
19160
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
19103
19161
|
import YAML2 from "yaml";
|
|
19104
19162
|
|
|
19105
19163
|
// src/cli/scaffold/discover-openapi-files.ts
|
|
19106
19164
|
import { promises as fs5 } from "node:fs";
|
|
19107
|
-
import
|
|
19165
|
+
import path62 from "node:path";
|
|
19108
19166
|
var OPENAPI_BASENAMES = [
|
|
19109
19167
|
"openapi.yaml",
|
|
19110
19168
|
"openapi.yml",
|
|
@@ -19126,13 +19184,13 @@ var SKIP_OPENAPI_SEARCH_DIRS = /* @__PURE__ */ new Set([
|
|
|
19126
19184
|
".apitogo"
|
|
19127
19185
|
]);
|
|
19128
19186
|
async function collectFromDir(dir, searchedDirectories, candidates) {
|
|
19129
|
-
const resolved =
|
|
19187
|
+
const resolved = path62.resolve(dir);
|
|
19130
19188
|
if (searchedDirectories.includes(resolved)) {
|
|
19131
19189
|
return;
|
|
19132
19190
|
}
|
|
19133
19191
|
searchedDirectories.push(resolved);
|
|
19134
19192
|
for (const name of OPENAPI_BASENAMES) {
|
|
19135
|
-
const candidate =
|
|
19193
|
+
const candidate = path62.join(resolved, name);
|
|
19136
19194
|
try {
|
|
19137
19195
|
await fs5.access(candidate);
|
|
19138
19196
|
candidates.push(candidate);
|
|
@@ -19147,8 +19205,8 @@ async function collectSiteOpenApiFiles(siteDirectory) {
|
|
|
19147
19205
|
return { candidates: [...new Set(candidates)], searchedDirectories };
|
|
19148
19206
|
}
|
|
19149
19207
|
async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
19150
|
-
const site =
|
|
19151
|
-
const parent =
|
|
19208
|
+
const site = path62.resolve(siteDirectory);
|
|
19209
|
+
const parent = path62.dirname(site);
|
|
19152
19210
|
const searchedDirectories = [];
|
|
19153
19211
|
const candidates = [];
|
|
19154
19212
|
if (parent && parent !== site) {
|
|
@@ -19159,8 +19217,8 @@ async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
|
19159
19217
|
if (!entry.isDirectory() || SKIP_OPENAPI_SEARCH_DIRS.has(entry.name)) {
|
|
19160
19218
|
continue;
|
|
19161
19219
|
}
|
|
19162
|
-
const sibling =
|
|
19163
|
-
if (
|
|
19220
|
+
const sibling = path62.join(parent, entry.name);
|
|
19221
|
+
if (path62.resolve(sibling) === site) {
|
|
19164
19222
|
continue;
|
|
19165
19223
|
}
|
|
19166
19224
|
await collectFromDir(sibling, searchedDirectories, candidates);
|
|
@@ -19188,7 +19246,7 @@ function parseOpenApiObject(doc) {
|
|
|
19188
19246
|
};
|
|
19189
19247
|
}
|
|
19190
19248
|
function liteParseOpenApi(content, filePath) {
|
|
19191
|
-
const ext =
|
|
19249
|
+
const ext = path62.extname(filePath).toLowerCase();
|
|
19192
19250
|
if (ext === ".json") {
|
|
19193
19251
|
try {
|
|
19194
19252
|
const parsed = JSON.parse(content);
|
|
@@ -19253,9 +19311,9 @@ async function discoverNearbyOpenApi(siteDirectory) {
|
|
|
19253
19311
|
};
|
|
19254
19312
|
}
|
|
19255
19313
|
async function validateOpenApiFile(filePath) {
|
|
19256
|
-
const resolved =
|
|
19314
|
+
const resolved = path63.resolve(filePath);
|
|
19257
19315
|
const content = await fs6.readFile(resolved, "utf8");
|
|
19258
|
-
const ext =
|
|
19316
|
+
const ext = path63.extname(resolved).toLowerCase();
|
|
19259
19317
|
let parsed;
|
|
19260
19318
|
try {
|
|
19261
19319
|
parsed = ext === ".json" ? JSON.parse(content) : YAML2.parse(content);
|
|
@@ -19298,7 +19356,7 @@ async function validateOpenApiFile(filePath) {
|
|
|
19298
19356
|
|
|
19299
19357
|
// src/cli/scaffold/scaffold-dev-portal-site.ts
|
|
19300
19358
|
import { mkdir as mkdir15, readFile as readFile19, writeFile as writeFile17 } from "node:fs/promises";
|
|
19301
|
-
import
|
|
19359
|
+
import path65 from "node:path";
|
|
19302
19360
|
|
|
19303
19361
|
// src/cli/scaffold/apitogo-npm-packages.ts
|
|
19304
19362
|
var DEFAULT_CREATE_APITOGO_PACKAGE2 = "@lukoweb/create-apitogo@latest";
|
|
@@ -19386,7 +19444,7 @@ var DOC_TOOL_LOCAL_PACKAGE_PATHS = {
|
|
|
19386
19444
|
// src/cli/scaffold/create-apitogo-cli.ts
|
|
19387
19445
|
import { spawn as spawn3 } from "node:child_process";
|
|
19388
19446
|
import { access as access9, rm as rm10 } from "node:fs/promises";
|
|
19389
|
-
import
|
|
19447
|
+
import path64 from "node:path";
|
|
19390
19448
|
var SKIP_NEARBY_DISCOVERY_ENV = "APITOGO_SKIP_NEARBY_DISCOVERY";
|
|
19391
19449
|
var CreateApitogoCliError = class extends Error {
|
|
19392
19450
|
exitCode;
|
|
@@ -19403,9 +19461,9 @@ function resolveDocToolPath(explicit) {
|
|
|
19403
19461
|
return value || void 0;
|
|
19404
19462
|
}
|
|
19405
19463
|
function splitOutputDirectory(outputDirectory) {
|
|
19406
|
-
const resolvedOutputDirectory =
|
|
19407
|
-
const projectName =
|
|
19408
|
-
const parentDirectory =
|
|
19464
|
+
const resolvedOutputDirectory = path64.resolve(outputDirectory);
|
|
19465
|
+
const projectName = path64.basename(resolvedOutputDirectory);
|
|
19466
|
+
const parentDirectory = path64.dirname(resolvedOutputDirectory);
|
|
19409
19467
|
if (!projectName || projectName === "." || projectName === "..") {
|
|
19410
19468
|
throw new Error(
|
|
19411
19469
|
"outputDirectory must be a named folder (e.g. ./dev-portal-site), not the current directory."
|
|
@@ -19431,7 +19489,7 @@ async function directoryHasEntries(dir) {
|
|
|
19431
19489
|
}
|
|
19432
19490
|
}
|
|
19433
19491
|
function resolveLocalCreateApitogoEntry(docToolPath) {
|
|
19434
|
-
return
|
|
19492
|
+
return path64.resolve(docToolPath, "packages/create-zudoku/dist/index.js");
|
|
19435
19493
|
}
|
|
19436
19494
|
async function resolveCreateApitogoInvocation(options) {
|
|
19437
19495
|
const docToolPath = resolveDocToolPath(options.docToolPath);
|
|
@@ -19513,7 +19571,7 @@ async function runCreateApitogoDevPortal(options) {
|
|
|
19513
19571
|
result.exitCode
|
|
19514
19572
|
);
|
|
19515
19573
|
}
|
|
19516
|
-
if (!await pathExists3(
|
|
19574
|
+
if (!await pathExists3(path64.join(resolvedOutputDirectory, "package.json"))) {
|
|
19517
19575
|
throw new CreateApitogoCliError(
|
|
19518
19576
|
`create-apitogo completed but package.json was not found at ${resolvedOutputDirectory}`,
|
|
19519
19577
|
result.output,
|
|
@@ -19572,7 +19630,7 @@ function ensureRequiredApitogoModules(pkg, options) {
|
|
|
19572
19630
|
]
|
|
19573
19631
|
]) {
|
|
19574
19632
|
if (options.docToolPath) {
|
|
19575
|
-
deps[moduleName] = `file:${
|
|
19633
|
+
deps[moduleName] = `file:${path65.join(options.docToolPath, localPath)}`;
|
|
19576
19634
|
continue;
|
|
19577
19635
|
}
|
|
19578
19636
|
deps[moduleName] = `npm:${moduleName}@${moduleAliasVersion}`;
|
|
@@ -19603,7 +19661,7 @@ function rewritePackageJson(raw, options) {
|
|
|
19603
19661
|
DOC_TOOL_LOCAL_PACKAGE_PATHS
|
|
19604
19662
|
)) {
|
|
19605
19663
|
if (dep in deps) {
|
|
19606
|
-
deps[dep] = `file:${
|
|
19664
|
+
deps[dep] = `file:${path65.join(options.docToolPath, relativePath)}`;
|
|
19607
19665
|
linkedWorkspacePackage = true;
|
|
19608
19666
|
}
|
|
19609
19667
|
}
|
|
@@ -19703,23 +19761,23 @@ function patchDashboardPageConfig(content) {
|
|
|
19703
19761
|
);
|
|
19704
19762
|
}
|
|
19705
19763
|
async function ensureAccountPlansPage(outputDirectory) {
|
|
19706
|
-
const pagePath =
|
|
19764
|
+
const pagePath = path65.join(outputDirectory, ACCOUNT_PLANS_PAGE_PATH);
|
|
19707
19765
|
try {
|
|
19708
19766
|
await readFile19(pagePath, "utf8");
|
|
19709
19767
|
return void 0;
|
|
19710
19768
|
} catch {
|
|
19711
|
-
await mkdir15(
|
|
19769
|
+
await mkdir15(path65.dirname(pagePath), { recursive: true });
|
|
19712
19770
|
await writeFile17(pagePath, ACCOUNT_PLANS_PAGE);
|
|
19713
19771
|
return ACCOUNT_PLANS_PAGE_PATH;
|
|
19714
19772
|
}
|
|
19715
19773
|
}
|
|
19716
19774
|
async function ensureDashboardPage(outputDirectory) {
|
|
19717
|
-
const pagePath =
|
|
19775
|
+
const pagePath = path65.join(outputDirectory, DASHBOARD_PAGE_PATH);
|
|
19718
19776
|
try {
|
|
19719
19777
|
await readFile19(pagePath, "utf8");
|
|
19720
19778
|
return void 0;
|
|
19721
19779
|
} catch {
|
|
19722
|
-
await mkdir15(
|
|
19780
|
+
await mkdir15(path65.dirname(pagePath), { recursive: true });
|
|
19723
19781
|
await writeFile17(pagePath, DASHBOARD_PAGE);
|
|
19724
19782
|
return DASHBOARD_PAGE_PATH;
|
|
19725
19783
|
}
|
|
@@ -19776,7 +19834,7 @@ function patchApitogoConfig(content, options) {
|
|
|
19776
19834
|
async function patchScaffoldedSite(outputDirectory, options) {
|
|
19777
19835
|
const title = options.branding?.title ?? options.siteName;
|
|
19778
19836
|
const filesWritten = [];
|
|
19779
|
-
const packageJsonPath =
|
|
19837
|
+
const packageJsonPath = path65.join(outputDirectory, "package.json");
|
|
19780
19838
|
if (options.patchPackageJson !== false) {
|
|
19781
19839
|
const packageJson3 = await readFile19(packageJsonPath, "utf8");
|
|
19782
19840
|
await writeFile17(
|
|
@@ -19789,7 +19847,7 @@ async function patchScaffoldedSite(outputDirectory, options) {
|
|
|
19789
19847
|
);
|
|
19790
19848
|
filesWritten.push("package.json");
|
|
19791
19849
|
}
|
|
19792
|
-
const configPath =
|
|
19850
|
+
const configPath = path65.join(outputDirectory, "apitogo.config.tsx");
|
|
19793
19851
|
const configContent = await readFile19(configPath, "utf8");
|
|
19794
19852
|
await writeFile17(
|
|
19795
19853
|
configPath,
|
|
@@ -19884,8 +19942,8 @@ async function discoverOpenApiByMode(siteDirectory, mode) {
|
|
|
19884
19942
|
return discoverNearbyOpenApi(siteDirectory);
|
|
19885
19943
|
}
|
|
19886
19944
|
async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
19887
|
-
const resolvedSource =
|
|
19888
|
-
const resolvedOpenApi =
|
|
19945
|
+
const resolvedSource = path66.resolve(sourceDirectory);
|
|
19946
|
+
const resolvedOpenApi = path66.resolve(openApiPath);
|
|
19889
19947
|
const input5 = toSiteRelativeOpenApiInput(resolvedSource, resolvedOpenApi);
|
|
19890
19948
|
const validation = await validateOpenApiFile(resolvedOpenApi);
|
|
19891
19949
|
if (!validation.valid) {
|
|
@@ -19910,7 +19968,7 @@ async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
|
19910
19968
|
"utf8"
|
|
19911
19969
|
);
|
|
19912
19970
|
} else {
|
|
19913
|
-
const tsxConfigPath =
|
|
19971
|
+
const tsxConfigPath = path66.join(resolvedSource, "apitogo.config.tsx");
|
|
19914
19972
|
const configContent = await readFile20(tsxConfigPath, "utf8");
|
|
19915
19973
|
try {
|
|
19916
19974
|
const patched = patchApitogoConfigOpenApiToFile(configContent, input5);
|
|
@@ -19996,7 +20054,7 @@ async function discoverAndWireOpenApi(siteDirectory, mode) {
|
|
|
19996
20054
|
}
|
|
19997
20055
|
|
|
19998
20056
|
// src/cli/make-config/interactive.ts
|
|
19999
|
-
import
|
|
20057
|
+
import path67 from "node:path";
|
|
20000
20058
|
import { stdin as input, stdout as output } from "node:process";
|
|
20001
20059
|
import { createInterface as createInterface3 } from "node:readline/promises";
|
|
20002
20060
|
|
|
@@ -20172,7 +20230,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
20172
20230
|
continue;
|
|
20173
20231
|
}
|
|
20174
20232
|
const routePath = `/${slug}`;
|
|
20175
|
-
const relativePath =
|
|
20233
|
+
const relativePath = path67.posix.join(options.pagesDir, `${slug}.tsx`);
|
|
20176
20234
|
const page = {
|
|
20177
20235
|
slug,
|
|
20178
20236
|
title: pageTitle.trim(),
|
|
@@ -20268,8 +20326,8 @@ export default function ${componentName}() {
|
|
|
20268
20326
|
init_package_json();
|
|
20269
20327
|
import { constants } from "node:fs";
|
|
20270
20328
|
import { access as access11, mkdir as mkdir16, readFile as readFile21, writeFile as writeFile19 } from "node:fs/promises";
|
|
20271
|
-
import
|
|
20272
|
-
import { glob as
|
|
20329
|
+
import path68 from "node:path";
|
|
20330
|
+
import { glob as glob7 } from "glob";
|
|
20273
20331
|
|
|
20274
20332
|
// src/cli/make-config/favicon-png.ts
|
|
20275
20333
|
var FAVICON_PNG_BASE64 = "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";
|
|
@@ -20283,9 +20341,9 @@ var OPENAPI_GLOBS = [
|
|
|
20283
20341
|
"openapi.yaml",
|
|
20284
20342
|
"openapi.yml"
|
|
20285
20343
|
];
|
|
20286
|
-
var toPosix2 = (p) => p.split(
|
|
20344
|
+
var toPosix2 = (p) => p.split(path68.sep).join("/");
|
|
20287
20345
|
var sanitizePackageName = (dir) => {
|
|
20288
|
-
const base =
|
|
20346
|
+
const base = path68.basename(path68.resolve(dir));
|
|
20289
20347
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
20290
20348
|
return s || "apitogo-site";
|
|
20291
20349
|
};
|
|
@@ -20295,14 +20353,14 @@ var apitogoVersionRange = () => {
|
|
|
20295
20353
|
};
|
|
20296
20354
|
async function findOpenApiSpecPath(dir) {
|
|
20297
20355
|
for (const rel2 of OPENAPI_GLOBS) {
|
|
20298
|
-
const full =
|
|
20356
|
+
const full = path68.join(dir, rel2);
|
|
20299
20357
|
try {
|
|
20300
20358
|
await access11(full, constants.R_OK);
|
|
20301
20359
|
return toPosix2(rel2);
|
|
20302
20360
|
} catch {
|
|
20303
20361
|
}
|
|
20304
20362
|
}
|
|
20305
|
-
const extra = await
|
|
20363
|
+
const extra = await glob7("apis/**/*.{json,yaml,yml}", {
|
|
20306
20364
|
cwd: dir,
|
|
20307
20365
|
posix: true,
|
|
20308
20366
|
ignore: ["**/node_modules/**"]
|
|
@@ -20310,7 +20368,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
20310
20368
|
return extra[0] ? toPosix2(extra[0]) : null;
|
|
20311
20369
|
}
|
|
20312
20370
|
async function ensurePackageJson(dir) {
|
|
20313
|
-
const pkgPath =
|
|
20371
|
+
const pkgPath = path68.join(dir, "package.json");
|
|
20314
20372
|
const apitogoVer = apitogoVersionRange();
|
|
20315
20373
|
const baseDeps = {
|
|
20316
20374
|
react: ">=19.0.0",
|
|
@@ -20377,7 +20435,7 @@ async function ensurePackageJson(dir) {
|
|
|
20377
20435
|
return false;
|
|
20378
20436
|
}
|
|
20379
20437
|
async function ensureTsconfigJson(dir) {
|
|
20380
|
-
const tsPath =
|
|
20438
|
+
const tsPath = path68.join(dir, "tsconfig.json");
|
|
20381
20439
|
try {
|
|
20382
20440
|
await access11(tsPath, constants.R_OK);
|
|
20383
20441
|
return false;
|
|
@@ -20426,40 +20484,40 @@ var fileExists2 = async (filePath) => {
|
|
|
20426
20484
|
}
|
|
20427
20485
|
};
|
|
20428
20486
|
async function ensurePortalStubFiles(dir) {
|
|
20429
|
-
const landingPath =
|
|
20487
|
+
const landingPath = path68.join(dir, "landing", "LandingPage.tsx");
|
|
20430
20488
|
if (!await fileExists2(landingPath)) {
|
|
20431
|
-
await mkdir16(
|
|
20489
|
+
await mkdir16(path68.join(dir, "landing"), { recursive: true });
|
|
20432
20490
|
await writeFile19(landingPath, LANDING_PAGE_SOURCE, "utf8");
|
|
20433
20491
|
}
|
|
20434
|
-
const plansPath =
|
|
20492
|
+
const plansPath = path68.join(dir, "user-panel", "AccountPlansPage.tsx");
|
|
20435
20493
|
if (!await fileExists2(plansPath)) {
|
|
20436
|
-
await mkdir16(
|
|
20494
|
+
await mkdir16(path68.join(dir, "user-panel"), { recursive: true });
|
|
20437
20495
|
await writeFile19(plansPath, ACCOUNT_PLANS_PAGE_SOURCE, "utf8");
|
|
20438
20496
|
}
|
|
20439
|
-
const dashboardPath =
|
|
20497
|
+
const dashboardPath = path68.join(dir, "user-panel", "DashboardPage.tsx");
|
|
20440
20498
|
if (!await fileExists2(dashboardPath)) {
|
|
20441
|
-
await mkdir16(
|
|
20499
|
+
await mkdir16(path68.join(dir, "user-panel"), { recursive: true });
|
|
20442
20500
|
await writeFile19(dashboardPath, DASHBOARD_PAGE_SOURCE, "utf8");
|
|
20443
20501
|
}
|
|
20444
20502
|
await ensurePublicBrandingFiles(dir);
|
|
20445
20503
|
}
|
|
20446
20504
|
async function ensurePublicBrandingFiles(dir) {
|
|
20447
|
-
const destDir =
|
|
20505
|
+
const destDir = path68.join(dir, "public");
|
|
20448
20506
|
await mkdir16(destDir, { recursive: true });
|
|
20449
20507
|
for (const { name, content } of BRANDING_ASSETS) {
|
|
20450
|
-
const dest =
|
|
20508
|
+
const dest = path68.join(destDir, name);
|
|
20451
20509
|
if (await fileExists2(dest)) {
|
|
20452
20510
|
continue;
|
|
20453
20511
|
}
|
|
20454
20512
|
await writeFile19(dest, content, "utf8");
|
|
20455
20513
|
}
|
|
20456
|
-
const faviconDest =
|
|
20514
|
+
const faviconDest = path68.join(destDir, "Icon.png");
|
|
20457
20515
|
if (!await fileExists2(faviconDest)) {
|
|
20458
20516
|
await writeFile19(faviconDest, Buffer.from(FAVICON_PNG_BASE64, "base64"));
|
|
20459
20517
|
}
|
|
20460
20518
|
}
|
|
20461
20519
|
async function ensureThinConfigTsx(dir) {
|
|
20462
|
-
const tsxPath =
|
|
20520
|
+
const tsxPath = path68.join(dir, "apitogo.config.tsx");
|
|
20463
20521
|
if (await fileExists2(tsxPath)) {
|
|
20464
20522
|
return false;
|
|
20465
20523
|
}
|
|
@@ -20468,7 +20526,7 @@ async function ensureThinConfigTsx(dir) {
|
|
|
20468
20526
|
}
|
|
20469
20527
|
|
|
20470
20528
|
// src/cli/make-config/handler.ts
|
|
20471
|
-
var toPosixPath2 = (value) => value.split(
|
|
20529
|
+
var toPosixPath2 = (value) => value.split(path69.sep).join(path69.posix.sep);
|
|
20472
20530
|
var fileExists3 = async (filePath) => {
|
|
20473
20531
|
try {
|
|
20474
20532
|
await access12(filePath, constants2.F_OK);
|
|
@@ -20501,7 +20559,7 @@ function shouldRunInteractive(argv) {
|
|
|
20501
20559
|
return input2.isTTY === true;
|
|
20502
20560
|
}
|
|
20503
20561
|
async function persistConfig(config2, ctx) {
|
|
20504
|
-
const pageFiles = await
|
|
20562
|
+
const pageFiles = await glob8(`${ctx.pagesDir}/**/*.{md,mdx,tsx,jsx}`, {
|
|
20505
20563
|
cwd: ctx.dir,
|
|
20506
20564
|
ignore: ["**/node_modules/**", "**/.git/**", "**/dist/**"],
|
|
20507
20565
|
posix: true
|
|
@@ -20512,21 +20570,21 @@ async function persistConfig(config2, ctx) {
|
|
|
20512
20570
|
(file) => toRoutePath(file, ctx.pagesDir)
|
|
20513
20571
|
);
|
|
20514
20572
|
const tsxRoutes = tsxFiles.map((file) => toRoutePath(file, ctx.pagesDir));
|
|
20515
|
-
const
|
|
20516
|
-
if (
|
|
20573
|
+
const docRoutes2 = [.../* @__PURE__ */ new Set([...markdownRoutes, ...tsxRoutes])];
|
|
20574
|
+
if (docRoutes2.length === 0) {
|
|
20517
20575
|
printHintToConsole(
|
|
20518
20576
|
`No docs pages under '${ctx.pagesDir}/' \u2014 skipping documentation nav scan.`
|
|
20519
20577
|
);
|
|
20520
20578
|
}
|
|
20521
20579
|
const next = {
|
|
20522
20580
|
...config2,
|
|
20523
|
-
navigation: mergeDocumentationNavigation(config2.navigation,
|
|
20581
|
+
navigation: mergeDocumentationNavigation(config2.navigation, docRoutes2, {
|
|
20524
20582
|
force: ctx.force
|
|
20525
20583
|
})
|
|
20526
20584
|
};
|
|
20527
20585
|
await writeFile20(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
|
|
20528
20586
|
`, "utf8");
|
|
20529
|
-
const tsxPath =
|
|
20587
|
+
const tsxPath = path69.join(ctx.dir, "apitogo.config.tsx");
|
|
20530
20588
|
if (await fileExists3(tsxPath) && tsxRoutes.length > 0) {
|
|
20531
20589
|
const tsxSource = await readFile22(tsxPath, "utf8");
|
|
20532
20590
|
if (isManagedConfigWrapper(tsxSource)) {
|
|
@@ -20553,7 +20611,7 @@ function mergeBackendFlag(config2, backend) {
|
|
|
20553
20611
|
return next;
|
|
20554
20612
|
}
|
|
20555
20613
|
async function makeConfig(argv) {
|
|
20556
|
-
const dir =
|
|
20614
|
+
const dir = path69.resolve(process.cwd(), argv.dir);
|
|
20557
20615
|
const pagesDir = toPosixPath2(
|
|
20558
20616
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
20559
20617
|
);
|
|
@@ -20573,14 +20631,14 @@ async function makeConfig(argv) {
|
|
|
20573
20631
|
printSuccessToConsole("Created tsconfig.json.");
|
|
20574
20632
|
}
|
|
20575
20633
|
await ensurePortalStubFiles(dir);
|
|
20576
|
-
const jsonPath =
|
|
20634
|
+
const jsonPath = path69.join(dir, APITOGO_JSON_FILENAME);
|
|
20577
20635
|
let createdJson = false;
|
|
20578
20636
|
let config2;
|
|
20579
20637
|
if (await fileExists3(jsonPath)) {
|
|
20580
20638
|
config2 = await readJsonConfig(jsonPath);
|
|
20581
20639
|
} else {
|
|
20582
20640
|
config2 = createDefaultApitogoJsonConfig({
|
|
20583
|
-
title: titleFromDirectoryName(
|
|
20641
|
+
title: titleFromDirectoryName(path69.basename(dir)),
|
|
20584
20642
|
pagesDir
|
|
20585
20643
|
});
|
|
20586
20644
|
createdJson = true;
|
|
@@ -20632,8 +20690,8 @@ async function makeConfig(argv) {
|
|
|
20632
20690
|
return;
|
|
20633
20691
|
}
|
|
20634
20692
|
if (action2.kind === "page") {
|
|
20635
|
-
const pagePath =
|
|
20636
|
-
await mkdir17(
|
|
20693
|
+
const pagePath = path69.join(dir, action2.page.relativePath);
|
|
20694
|
+
await mkdir17(path69.dirname(pagePath), { recursive: true });
|
|
20637
20695
|
await writeFile20(
|
|
20638
20696
|
pagePath,
|
|
20639
20697
|
buildStarterDocsPageTsx(action2.page.slug, action2.page.title),
|
|
@@ -20700,7 +20758,7 @@ async function makeConfig(argv) {
|
|
|
20700
20758
|
if (argv.openapi) {
|
|
20701
20759
|
const wire = await wireDevPortalOpenApi(
|
|
20702
20760
|
dir,
|
|
20703
|
-
|
|
20761
|
+
path69.resolve(dir, argv.openapi)
|
|
20704
20762
|
);
|
|
20705
20763
|
if (wire.status !== "succeeded") {
|
|
20706
20764
|
throw new Error(
|
|
@@ -20729,7 +20787,7 @@ async function makeConfig(argv) {
|
|
|
20729
20787
|
const slug = normalizePageSlug2(argv.pageSlug);
|
|
20730
20788
|
const pageTemplate = normalizePageTemplate(argv.pageTemplate);
|
|
20731
20789
|
const relativePagePath = pageComponentRelativePath(slug);
|
|
20732
|
-
const filePath =
|
|
20790
|
+
const filePath = path69.join(dir, relativePagePath);
|
|
20733
20791
|
const isUpdate = argv.pageUpdate === true;
|
|
20734
20792
|
if (isUpdate) {
|
|
20735
20793
|
if (!await fileExists3(filePath)) {
|
|
@@ -20762,7 +20820,7 @@ async function makeConfig(argv) {
|
|
|
20762
20820
|
argv.pageContent,
|
|
20763
20821
|
pageTemplate
|
|
20764
20822
|
);
|
|
20765
|
-
await mkdir17(
|
|
20823
|
+
await mkdir17(path69.dirname(filePath), { recursive: true });
|
|
20766
20824
|
await writeFile20(filePath, tsx, "utf8");
|
|
20767
20825
|
const configResult = await wireNewDevPortalPageInConfig(
|
|
20768
20826
|
dir,
|
|
@@ -20775,7 +20833,7 @@ async function makeConfig(argv) {
|
|
|
20775
20833
|
pagePath: relativePagePath,
|
|
20776
20834
|
pageTemplate,
|
|
20777
20835
|
configUpdated: configResult.updated,
|
|
20778
|
-
configPath: configResult.configPath ?
|
|
20836
|
+
configPath: configResult.configPath ? path69.relative(dir, configResult.configPath) : null
|
|
20779
20837
|
};
|
|
20780
20838
|
changes.push("page_add");
|
|
20781
20839
|
}
|
|
@@ -20900,10 +20958,10 @@ var config_default = {
|
|
|
20900
20958
|
};
|
|
20901
20959
|
|
|
20902
20960
|
// src/cli/cmds/deploy.ts
|
|
20903
|
-
import
|
|
20961
|
+
import path83 from "node:path";
|
|
20904
20962
|
|
|
20905
20963
|
// src/cli/apply/handler.ts
|
|
20906
|
-
import
|
|
20964
|
+
import path80 from "node:path";
|
|
20907
20965
|
|
|
20908
20966
|
// src/cli/platform/helpers/gateway-plan-validation.ts
|
|
20909
20967
|
init_gateway_limits();
|
|
@@ -21098,11 +21156,11 @@ init_gateway_limits();
|
|
|
21098
21156
|
// src/cli/platform/helpers/deploy-artifact-hash.ts
|
|
21099
21157
|
import { createHash as createHash3 } from "node:crypto";
|
|
21100
21158
|
import { createReadStream, promises as fs8 } from "node:fs";
|
|
21101
|
-
import
|
|
21159
|
+
import path71 from "node:path";
|
|
21102
21160
|
|
|
21103
21161
|
// src/cli/platform/helpers/package-files.ts
|
|
21104
21162
|
import { promises as fs7 } from "node:fs";
|
|
21105
|
-
import
|
|
21163
|
+
import path70 from "node:path";
|
|
21106
21164
|
import ignore from "ignore";
|
|
21107
21165
|
var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
21108
21166
|
"node_modules",
|
|
@@ -21115,7 +21173,7 @@ var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
|
21115
21173
|
async function loadGitignore(rootDir) {
|
|
21116
21174
|
const ig = ignore();
|
|
21117
21175
|
ig.add(["node_modules/", ".git/", "dist/", "bin/", "obj/"]);
|
|
21118
|
-
const gitignorePath =
|
|
21176
|
+
const gitignorePath = path70.join(rootDir, ".gitignore");
|
|
21119
21177
|
try {
|
|
21120
21178
|
const content = await fs7.readFile(gitignorePath, "utf8");
|
|
21121
21179
|
ig.add(content);
|
|
@@ -21124,11 +21182,11 @@ async function loadGitignore(rootDir) {
|
|
|
21124
21182
|
return ig;
|
|
21125
21183
|
}
|
|
21126
21184
|
async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
21127
|
-
const absDir =
|
|
21185
|
+
const absDir = path70.join(rootDir, relativeDir);
|
|
21128
21186
|
const entries = await fs7.readdir(absDir, { withFileTypes: true });
|
|
21129
21187
|
for (const entry of entries) {
|
|
21130
|
-
const rel2 = relativeDir ?
|
|
21131
|
-
const relPosix = rel2.split(
|
|
21188
|
+
const rel2 = relativeDir ? path70.join(relativeDir, entry.name) : entry.name;
|
|
21189
|
+
const relPosix = rel2.split(path70.sep).join("/");
|
|
21132
21190
|
if (DEFAULT_EXCLUDES.has(entry.name) && !relativeDir) {
|
|
21133
21191
|
continue;
|
|
21134
21192
|
}
|
|
@@ -21143,7 +21201,7 @@ async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
|
21143
21201
|
}
|
|
21144
21202
|
}
|
|
21145
21203
|
async function collectPackageableFiles(sourceDirectory) {
|
|
21146
|
-
const resolved =
|
|
21204
|
+
const resolved = path70.resolve(sourceDirectory);
|
|
21147
21205
|
const stat7 = await fs7.stat(resolved).catch(() => null);
|
|
21148
21206
|
if (!stat7?.isDirectory()) {
|
|
21149
21207
|
throw new Error(`sourceDirectory is not a directory: ${resolved}`);
|
|
@@ -21169,7 +21227,7 @@ async function sha256File(filePath) {
|
|
|
21169
21227
|
return hash2.digest("hex");
|
|
21170
21228
|
}
|
|
21171
21229
|
async function hashDirectoryContents(rootDirectory) {
|
|
21172
|
-
const resolved =
|
|
21230
|
+
const resolved = path71.resolve(rootDirectory);
|
|
21173
21231
|
const files = (await collectPackageableFiles(resolved)).sort(
|
|
21174
21232
|
(a, b) => a.localeCompare(b)
|
|
21175
21233
|
);
|
|
@@ -21177,13 +21235,13 @@ async function hashDirectoryContents(rootDirectory) {
|
|
|
21177
21235
|
for (const rel2 of files) {
|
|
21178
21236
|
hash2.update(rel2);
|
|
21179
21237
|
hash2.update("\0");
|
|
21180
|
-
hash2.update(await fs8.readFile(
|
|
21238
|
+
hash2.update(await fs8.readFile(path71.join(resolved, rel2)));
|
|
21181
21239
|
hash2.update("\0");
|
|
21182
21240
|
}
|
|
21183
21241
|
return hash2.digest("hex");
|
|
21184
21242
|
}
|
|
21185
21243
|
async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
21186
|
-
const resolved =
|
|
21244
|
+
const resolved = path71.resolve(siteDirectory);
|
|
21187
21245
|
const hash2 = createHash3("sha256");
|
|
21188
21246
|
const candidates = [
|
|
21189
21247
|
"apitogo.config.json",
|
|
@@ -21193,7 +21251,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
21193
21251
|
"zudoku.config.tsx"
|
|
21194
21252
|
];
|
|
21195
21253
|
for (const name of candidates) {
|
|
21196
|
-
const full =
|
|
21254
|
+
const full = path71.join(resolved, name);
|
|
21197
21255
|
try {
|
|
21198
21256
|
hash2.update(name);
|
|
21199
21257
|
hash2.update("\0");
|
|
@@ -21203,7 +21261,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
21203
21261
|
}
|
|
21204
21262
|
}
|
|
21205
21263
|
for (const dir of ["pages", "landing", "src"]) {
|
|
21206
|
-
const full =
|
|
21264
|
+
const full = path71.join(resolved, dir);
|
|
21207
21265
|
try {
|
|
21208
21266
|
const st = await fs8.stat(full);
|
|
21209
21267
|
if (!st.isDirectory()) continue;
|
|
@@ -21432,8 +21490,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
21432
21490
|
const trimmed = actionKey2.trim();
|
|
21433
21491
|
if (trimmed.includes(":")) {
|
|
21434
21492
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
21435
|
-
const
|
|
21436
|
-
return `${method2?.toLowerCase()}:${
|
|
21493
|
+
const path102 = pathParts.join(":").trim();
|
|
21494
|
+
return `${method2?.toLowerCase()}:${path102.startsWith("/") ? path102 : `/${path102}`}`;
|
|
21437
21495
|
}
|
|
21438
21496
|
const spaceIndex = trimmed.indexOf(" ");
|
|
21439
21497
|
if (spaceIndex <= 0) {
|
|
@@ -21442,8 +21500,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
21442
21500
|
);
|
|
21443
21501
|
}
|
|
21444
21502
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
21445
|
-
const
|
|
21446
|
-
return `${method}:${
|
|
21503
|
+
const path101 = trimmed.slice(spaceIndex + 1).trim();
|
|
21504
|
+
return `${method}:${path101.startsWith("/") ? path101 : `/${path101}`}`;
|
|
21447
21505
|
}
|
|
21448
21506
|
async function applyGatewayPublicRoutes(client, projectId, routes, options) {
|
|
21449
21507
|
const applied = [];
|
|
@@ -21922,7 +21980,7 @@ async function upsertGatewayPlansFromManifest(client, config2, projectId, plans,
|
|
|
21922
21980
|
|
|
21923
21981
|
// src/cli/platform/helpers/openapi-gateway-servers.ts
|
|
21924
21982
|
import { mkdir as mkdir18, readFile as readFile23, writeFile as writeFile21 } from "node:fs/promises";
|
|
21925
|
-
import
|
|
21983
|
+
import path72 from "node:path";
|
|
21926
21984
|
import YAML3 from "yaml";
|
|
21927
21985
|
var GATEWAY_URL_ENV_KEY = "APITOGO_GATEWAY_URL";
|
|
21928
21986
|
var PUBLISH_OPENAPI_RELATIVE = ".apitogo/openapi-publish.json";
|
|
@@ -21954,7 +22012,7 @@ async function resolveProjectGatewayUrl(client, projectId) {
|
|
|
21954
22012
|
}
|
|
21955
22013
|
async function readOpenApiDocument(filePath) {
|
|
21956
22014
|
const content = await readFile23(filePath, "utf8");
|
|
21957
|
-
const ext =
|
|
22015
|
+
const ext = path72.extname(filePath).toLowerCase();
|
|
21958
22016
|
const parsed = ext === ".json" ? JSON.parse(content) : YAML3.parse(content);
|
|
21959
22017
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
21960
22018
|
throw new Error(`OpenAPI document must be an object: ${filePath}`);
|
|
@@ -21962,13 +22020,13 @@ async function readOpenApiDocument(filePath) {
|
|
|
21962
22020
|
return parsed;
|
|
21963
22021
|
}
|
|
21964
22022
|
async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApiPath, gatewayUrl) {
|
|
21965
|
-
const site =
|
|
21966
|
-
const source =
|
|
22023
|
+
const site = path72.resolve(siteDirectory);
|
|
22024
|
+
const source = path72.resolve(sourceOpenApiPath);
|
|
21967
22025
|
const relativeInput = PUBLISH_OPENAPI_RELATIVE;
|
|
21968
|
-
const outputPath =
|
|
22026
|
+
const outputPath = path72.join(site, ...relativeInput.split("/"));
|
|
21969
22027
|
const doc = await readOpenApiDocument(source);
|
|
21970
22028
|
const rewritten = withGatewayServers(doc, gatewayUrl);
|
|
21971
|
-
await mkdir18(
|
|
22029
|
+
await mkdir18(path72.dirname(outputPath), { recursive: true });
|
|
21972
22030
|
await writeFile21(
|
|
21973
22031
|
outputPath,
|
|
21974
22032
|
`${JSON.stringify(rewritten, null, 2)}
|
|
@@ -21978,8 +22036,8 @@ async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApi
|
|
|
21978
22036
|
return { outputPath, relativeInput };
|
|
21979
22037
|
}
|
|
21980
22038
|
async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
21981
|
-
const configPath =
|
|
21982
|
-
|
|
22039
|
+
const configPath = path72.join(
|
|
22040
|
+
path72.resolve(siteDirectory),
|
|
21983
22041
|
APITOGO_CONFIG_FILENAME2
|
|
21984
22042
|
);
|
|
21985
22043
|
const raw = await readFile23(configPath, "utf8");
|
|
@@ -22021,7 +22079,7 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
|
22021
22079
|
};
|
|
22022
22080
|
}
|
|
22023
22081
|
async function prepareOpenApiServersForGatewayBuild(options) {
|
|
22024
|
-
const siteDirectory =
|
|
22082
|
+
const siteDirectory = path72.resolve(options.siteDirectory);
|
|
22025
22083
|
let openApiPath = resolveBackendOpenApiPath(
|
|
22026
22084
|
options.manifest?.backend?.openApiPath,
|
|
22027
22085
|
{
|
|
@@ -22035,7 +22093,7 @@ async function prepareOpenApiServersForGatewayBuild(options) {
|
|
|
22035
22093
|
if (!openApiPath) {
|
|
22036
22094
|
try {
|
|
22037
22095
|
const raw = await readFile23(
|
|
22038
|
-
|
|
22096
|
+
path72.join(siteDirectory, APITOGO_CONFIG_FILENAME2),
|
|
22039
22097
|
"utf8"
|
|
22040
22098
|
);
|
|
22041
22099
|
const config2 = JSON.parse(raw);
|
|
@@ -22064,8 +22122,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22064
22122
|
const trimmed = actionKey2.trim();
|
|
22065
22123
|
if (trimmed.includes(":")) {
|
|
22066
22124
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
22067
|
-
const
|
|
22068
|
-
return `${method2.toLowerCase()}:${
|
|
22125
|
+
const path102 = pathParts.join(":").trim();
|
|
22126
|
+
return `${method2.toLowerCase()}:${path102.startsWith("/") ? path102 : `/${path102}`}`;
|
|
22069
22127
|
}
|
|
22070
22128
|
const spaceIndex = trimmed.indexOf(" ");
|
|
22071
22129
|
if (spaceIndex <= 0) {
|
|
@@ -22074,8 +22132,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22074
22132
|
);
|
|
22075
22133
|
}
|
|
22076
22134
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
22077
|
-
const
|
|
22078
|
-
return `${method}:${
|
|
22135
|
+
const path101 = trimmed.slice(spaceIndex + 1).trim();
|
|
22136
|
+
return `${method}:${path101.startsWith("/") ? path101 : `/${path101}`}`;
|
|
22079
22137
|
}
|
|
22080
22138
|
function normalizePublicRoute(route) {
|
|
22081
22139
|
const trimmed = route.trim();
|
|
@@ -22109,10 +22167,10 @@ function collectManifestPublicActionKeys(gateway) {
|
|
|
22109
22167
|
|
|
22110
22168
|
// src/cli/platform/helpers/publish-ledger.ts
|
|
22111
22169
|
import { mkdir as mkdir19, readFile as readFile24, writeFile as writeFile22 } from "node:fs/promises";
|
|
22112
|
-
import
|
|
22170
|
+
import path73 from "node:path";
|
|
22113
22171
|
var PUBLISH_LEDGER_RELATIVE_PATH = ".apitogo/publish-state.json";
|
|
22114
22172
|
function publishLedgerPath(siteDirectory) {
|
|
22115
|
-
return
|
|
22173
|
+
return path73.join(path73.resolve(siteDirectory), PUBLISH_LEDGER_RELATIVE_PATH);
|
|
22116
22174
|
}
|
|
22117
22175
|
async function readPublishLedger(siteDirectory) {
|
|
22118
22176
|
const filePath = publishLedgerPath(siteDirectory);
|
|
@@ -22129,7 +22187,7 @@ async function readPublishLedger(siteDirectory) {
|
|
|
22129
22187
|
}
|
|
22130
22188
|
async function writePublishLedger(siteDirectory, ledger) {
|
|
22131
22189
|
const filePath = publishLedgerPath(siteDirectory);
|
|
22132
|
-
await mkdir19(
|
|
22190
|
+
await mkdir19(path73.dirname(filePath), { recursive: true });
|
|
22133
22191
|
const next = {
|
|
22134
22192
|
...ledger,
|
|
22135
22193
|
version: 1,
|
|
@@ -22651,7 +22709,7 @@ async function createProjectWithWarmPoolRetry(client, body, options) {
|
|
|
22651
22709
|
import { spawn as spawn4 } from "node:child_process";
|
|
22652
22710
|
import { mkdtemp, readdir as readdir2, rm as rm11 } from "node:fs/promises";
|
|
22653
22711
|
import { tmpdir } from "node:os";
|
|
22654
|
-
import
|
|
22712
|
+
import path74 from "node:path";
|
|
22655
22713
|
async function directoryHasRuntimeConfig(dir) {
|
|
22656
22714
|
if (!await pathExists(dir)) {
|
|
22657
22715
|
return false;
|
|
@@ -22694,20 +22752,20 @@ function runDotnetPublish(projectDir, outputDir) {
|
|
|
22694
22752
|
async function findCsproj(projectDir) {
|
|
22695
22753
|
const entries = await readdir2(projectDir);
|
|
22696
22754
|
const csproj = entries.find((name) => name.endsWith(".csproj"));
|
|
22697
|
-
return csproj ?
|
|
22755
|
+
return csproj ? path74.join(projectDir, csproj) : null;
|
|
22698
22756
|
}
|
|
22699
22757
|
async function prepareBackendPackagingDirectory(args) {
|
|
22700
|
-
const sourceDirectory =
|
|
22758
|
+
const sourceDirectory = path74.resolve(args.sourceDirectory);
|
|
22701
22759
|
if (args.publishDirectory?.trim()) {
|
|
22702
22760
|
return {
|
|
22703
|
-
directory:
|
|
22761
|
+
directory: path74.resolve(args.publishDirectory),
|
|
22704
22762
|
packagingMode: "published"
|
|
22705
22763
|
};
|
|
22706
22764
|
}
|
|
22707
22765
|
if (await directoryHasRuntimeConfig(sourceDirectory)) {
|
|
22708
22766
|
return { directory: sourceDirectory, packagingMode: "published" };
|
|
22709
22767
|
}
|
|
22710
|
-
const publishSubdir =
|
|
22768
|
+
const publishSubdir = path74.join(sourceDirectory, "publish");
|
|
22711
22769
|
if (await directoryHasRuntimeConfig(publishSubdir)) {
|
|
22712
22770
|
return { directory: publishSubdir, packagingMode: "published" };
|
|
22713
22771
|
}
|
|
@@ -22719,9 +22777,9 @@ async function prepareBackendPackagingDirectory(args) {
|
|
|
22719
22777
|
return { directory: sourceDirectory, packagingMode: "source" };
|
|
22720
22778
|
}
|
|
22721
22779
|
const tempRoot = await mkdtemp(
|
|
22722
|
-
|
|
22780
|
+
path74.join(tmpdir(), "apitogo-dotnet-publish-")
|
|
22723
22781
|
);
|
|
22724
|
-
const outputDir =
|
|
22782
|
+
const outputDir = path74.join(tempRoot, "publish");
|
|
22725
22783
|
const result = await runDotnetPublish(sourceDirectory, outputDir);
|
|
22726
22784
|
if (result.exitCode !== 0) {
|
|
22727
22785
|
await rm11(tempRoot, { recursive: true, force: true });
|
|
@@ -22767,12 +22825,12 @@ function formatJobStatusResponse(options) {
|
|
|
22767
22825
|
// src/cli/platform/helpers/zip.ts
|
|
22768
22826
|
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as fs9 } from "node:fs";
|
|
22769
22827
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
22770
|
-
import
|
|
22828
|
+
import path75 from "node:path";
|
|
22771
22829
|
import { ZipArchive } from "archiver";
|
|
22772
22830
|
async function packageBackendDirectory(sourceDirectory) {
|
|
22773
|
-
const resolved =
|
|
22831
|
+
const resolved = path75.resolve(sourceDirectory);
|
|
22774
22832
|
const files = await collectPackageableFiles(resolved);
|
|
22775
|
-
const zipPath =
|
|
22833
|
+
const zipPath = path75.join(
|
|
22776
22834
|
tmpdir2(),
|
|
22777
22835
|
`apitogo-backend-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`
|
|
22778
22836
|
);
|
|
@@ -22784,8 +22842,8 @@ async function packageBackendDirectory(sourceDirectory) {
|
|
|
22784
22842
|
output4.on("error", reject);
|
|
22785
22843
|
archive.pipe(output4);
|
|
22786
22844
|
for (const rel2 of files) {
|
|
22787
|
-
archive.append(createReadStream2(
|
|
22788
|
-
name: rel2.split(
|
|
22845
|
+
archive.append(createReadStream2(path75.join(resolved, rel2)), {
|
|
22846
|
+
name: rel2.split(path75.sep).join("/")
|
|
22789
22847
|
});
|
|
22790
22848
|
}
|
|
22791
22849
|
void archive.finalize();
|
|
@@ -24286,11 +24344,11 @@ async function resolveProjectIdForPublish(client, config2, args, wait, progress,
|
|
|
24286
24344
|
}
|
|
24287
24345
|
|
|
24288
24346
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
24289
|
-
import
|
|
24347
|
+
import path79 from "node:path";
|
|
24290
24348
|
|
|
24291
24349
|
// src/cli/platform/helpers/dev-portal-site-api-url.ts
|
|
24292
24350
|
import { readdir as readdir3, readFile as readFile25, writeFile as writeFile23 } from "node:fs/promises";
|
|
24293
|
-
import
|
|
24351
|
+
import path76 from "node:path";
|
|
24294
24352
|
var SITE_API_BASE_URL_ENV_KEY = "VITE_APITOGO_AUTHENTICATION_API_BASE_URL";
|
|
24295
24353
|
var PLACEHOLDER_HOST_MARKERS = [
|
|
24296
24354
|
"dp-example.azurecontainerapps.io",
|
|
@@ -24311,10 +24369,10 @@ function isPlaceholderDevPortalApiUrl(apiBaseUrl) {
|
|
|
24311
24369
|
return PLACEHOLDER_HOST_MARKERS.some((marker) => normalized.includes(marker));
|
|
24312
24370
|
}
|
|
24313
24371
|
async function readSiteApiBaseUrl(sourceDirectory) {
|
|
24314
|
-
const resolved =
|
|
24372
|
+
const resolved = path76.resolve(sourceDirectory);
|
|
24315
24373
|
for (const envFile of [".env", ".env.production"]) {
|
|
24316
24374
|
try {
|
|
24317
|
-
const content = await readFile25(
|
|
24375
|
+
const content = await readFile25(path76.join(resolved, envFile), "utf8");
|
|
24318
24376
|
const lines = [...content.matchAll(ENV_LINE_GLOBAL_RE)];
|
|
24319
24377
|
if (lines.length === 0) {
|
|
24320
24378
|
continue;
|
|
@@ -24339,11 +24397,11 @@ async function readSiteApiBaseUrl(sourceDirectory) {
|
|
|
24339
24397
|
return null;
|
|
24340
24398
|
}
|
|
24341
24399
|
async function patchSiteApiBaseUrl(sourceDirectory, apiBaseUrl) {
|
|
24342
|
-
const resolved =
|
|
24400
|
+
const resolved = path76.resolve(sourceDirectory);
|
|
24343
24401
|
const line2 = `${SITE_API_BASE_URL_ENV_KEY}=${apiBaseUrl}`;
|
|
24344
24402
|
let patchedExisting = false;
|
|
24345
24403
|
for (const envFile of [".env.production", ".env"]) {
|
|
24346
|
-
const envPath =
|
|
24404
|
+
const envPath = path76.join(resolved, envFile);
|
|
24347
24405
|
try {
|
|
24348
24406
|
const content = await readFile25(envPath, "utf8");
|
|
24349
24407
|
const withoutAssignments = content.replace(ENV_LINE_GLOBAL_RE, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
@@ -24357,7 +24415,7 @@ ${line2}
|
|
|
24357
24415
|
}
|
|
24358
24416
|
}
|
|
24359
24417
|
if (!patchedExisting) {
|
|
24360
|
-
await writeFile23(
|
|
24418
|
+
await writeFile23(path76.join(resolved, ".env"), `${line2}
|
|
24361
24419
|
`);
|
|
24362
24420
|
}
|
|
24363
24421
|
}
|
|
@@ -24365,7 +24423,7 @@ function tryProjectId(explicit, manifestProjectId, config2) {
|
|
|
24365
24423
|
return explicit?.trim() || manifestProjectId?.trim() || config2.defaultProjectId?.trim() || void 0;
|
|
24366
24424
|
}
|
|
24367
24425
|
async function ensureLiveSiteApiBaseUrlForBuild(_client, config2, args, resolveFromProject) {
|
|
24368
|
-
const sourceDirectory =
|
|
24426
|
+
const sourceDirectory = path76.resolve(args.sourceDirectory);
|
|
24369
24427
|
const explicit = args.apiBaseUrl?.trim();
|
|
24370
24428
|
if (explicit && !isPlaceholderDevPortalApiUrl(explicit)) {
|
|
24371
24429
|
await patchSiteApiBaseUrl(sourceDirectory, explicit);
|
|
@@ -24401,7 +24459,7 @@ async function* walkFiles(root) {
|
|
|
24401
24459
|
return;
|
|
24402
24460
|
}
|
|
24403
24461
|
for (const entry of entries) {
|
|
24404
|
-
const full =
|
|
24462
|
+
const full = path76.join(root, entry.name);
|
|
24405
24463
|
if (entry.isDirectory()) {
|
|
24406
24464
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
24407
24465
|
continue;
|
|
@@ -24413,8 +24471,8 @@ async function* walkFiles(root) {
|
|
|
24413
24471
|
}
|
|
24414
24472
|
}
|
|
24415
24473
|
async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiBaseUrl) {
|
|
24416
|
-
const dist =
|
|
24417
|
-
const siteRoot =
|
|
24474
|
+
const dist = path76.resolve(distDirectory);
|
|
24475
|
+
const siteRoot = path76.dirname(dist);
|
|
24418
24476
|
const fromEnv = expectedApiBaseUrl?.trim() || await readSiteApiBaseUrl(siteRoot) || await readSiteApiBaseUrl(dist);
|
|
24419
24477
|
if (!fromEnv || isPlaceholderDevPortalApiUrl(fromEnv)) {
|
|
24420
24478
|
throw new Error(
|
|
@@ -24450,7 +24508,7 @@ async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiB
|
|
|
24450
24508
|
|
|
24451
24509
|
// src/cli/platform/tools/dev-portal.ts
|
|
24452
24510
|
import { promises as fs11 } from "node:fs";
|
|
24453
|
-
import
|
|
24511
|
+
import path78 from "node:path";
|
|
24454
24512
|
|
|
24455
24513
|
// src/cli/platform/helpers/dev-portal-backend-job.ts
|
|
24456
24514
|
var DEV_PORTAL_BACKEND_UPDATE_RESOURCE_TYPE = "DevPortalBackendUpdate";
|
|
@@ -24560,7 +24618,7 @@ async function snapshotBackendUpdateJobIds(client, projectId) {
|
|
|
24560
24618
|
// src/cli/platform/helpers/tarball.ts
|
|
24561
24619
|
import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as fs10 } from "node:fs";
|
|
24562
24620
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
24563
|
-
import
|
|
24621
|
+
import path77 from "node:path";
|
|
24564
24622
|
import { TarArchive } from "archiver";
|
|
24565
24623
|
var DEV_PORTAL_DEPLOY_ARCHIVE_ROOT = "dist";
|
|
24566
24624
|
function normalizeArchiveRoot(archiveRoot) {
|
|
@@ -24571,10 +24629,10 @@ function normalizeArchiveRoot(archiveRoot) {
|
|
|
24571
24629
|
return `${trimmed}/`;
|
|
24572
24630
|
}
|
|
24573
24631
|
async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
24574
|
-
const resolved =
|
|
24632
|
+
const resolved = path77.resolve(sourceDirectory);
|
|
24575
24633
|
const files = await collectPackageableFiles(resolved);
|
|
24576
24634
|
const entryPrefix = options?.archiveRoot ? normalizeArchiveRoot(options.archiveRoot) : "";
|
|
24577
|
-
const archivePath =
|
|
24635
|
+
const archivePath = path77.join(
|
|
24578
24636
|
tmpdir3(),
|
|
24579
24637
|
`apitogo-docs-${Date.now()}-${Math.random().toString(36).slice(2)}.tgz`
|
|
24580
24638
|
);
|
|
@@ -24586,8 +24644,8 @@ async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
|
24586
24644
|
output4.on("error", reject);
|
|
24587
24645
|
archive.pipe(output4);
|
|
24588
24646
|
for (const rel2 of files) {
|
|
24589
|
-
const entryName = entryPrefix + rel2.split(
|
|
24590
|
-
archive.append(createReadStream3(
|
|
24647
|
+
const entryName = entryPrefix + rel2.split(path77.sep).join("/");
|
|
24648
|
+
archive.append(createReadStream3(path77.join(resolved, rel2)), {
|
|
24591
24649
|
name: entryName
|
|
24592
24650
|
});
|
|
24593
24651
|
}
|
|
@@ -24829,7 +24887,7 @@ function validateDeployArchiveInput(args) {
|
|
|
24829
24887
|
async function resolveDevPortalArchive(args) {
|
|
24830
24888
|
validateDeployArchiveInput(args);
|
|
24831
24889
|
if (args.archivePath?.trim()) {
|
|
24832
|
-
const archivePath =
|
|
24890
|
+
const archivePath = path78.resolve(args.archivePath.trim());
|
|
24833
24891
|
const stat7 = await fs11.stat(archivePath).catch(() => null);
|
|
24834
24892
|
if (!stat7?.isFile()) {
|
|
24835
24893
|
throw new Error(`archivePath is not a file: ${archivePath}`);
|
|
@@ -24894,7 +24952,7 @@ async function handleDeployDevPortal(client, config2, args, progress) {
|
|
|
24894
24952
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
24895
24953
|
async function handleBuildDevPortalSite(client, config2, args, progress) {
|
|
24896
24954
|
const buildProgress = progress?.child("Build dev portal site");
|
|
24897
|
-
const sourceDirectory =
|
|
24955
|
+
const sourceDirectory = path79.resolve(args.sourceDirectory);
|
|
24898
24956
|
await buildProgress?.onStep("Ensuring live portal API URL");
|
|
24899
24957
|
const apiBaseUrl = await ensureLiveSiteApiBaseUrlForBuild(
|
|
24900
24958
|
client,
|
|
@@ -26390,7 +26448,7 @@ function resultLooksFailed(payload) {
|
|
|
26390
26448
|
return parsed.status === "failed" || parsed.status === "blocked";
|
|
26391
26449
|
}
|
|
26392
26450
|
async function apply(argv) {
|
|
26393
|
-
const sourceDirectory =
|
|
26451
|
+
const sourceDirectory = path80.resolve(process.cwd(), argv.dir);
|
|
26394
26452
|
let config2;
|
|
26395
26453
|
try {
|
|
26396
26454
|
config2 = loadConfig();
|
|
@@ -26460,7 +26518,7 @@ async function apply(argv) {
|
|
|
26460
26518
|
if (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_not_found") {
|
|
26461
26519
|
const resolution = await resolveProjectNotFoundInteractively(
|
|
26462
26520
|
parsed,
|
|
26463
|
-
|
|
26521
|
+
path80.basename(sourceDirectory)
|
|
26464
26522
|
);
|
|
26465
26523
|
if (resolution) {
|
|
26466
26524
|
effectiveProjectId = void 0;
|
|
@@ -26480,7 +26538,7 @@ async function apply(argv) {
|
|
|
26480
26538
|
while (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_name_exists") {
|
|
26481
26539
|
const resolution = await resolveProjectNameExistsInteractively(
|
|
26482
26540
|
parsed,
|
|
26483
|
-
effectiveProjectName ??
|
|
26541
|
+
effectiveProjectName ?? path80.basename(sourceDirectory)
|
|
26484
26542
|
);
|
|
26485
26543
|
if (!resolution) {
|
|
26486
26544
|
break;
|
|
@@ -26552,7 +26610,7 @@ async function apply(argv) {
|
|
|
26552
26610
|
|
|
26553
26611
|
// src/cli/deploy/command.ts
|
|
26554
26612
|
init_invariant();
|
|
26555
|
-
import
|
|
26613
|
+
import path82 from "node:path";
|
|
26556
26614
|
|
|
26557
26615
|
// src/cli/deploy/v2.ts
|
|
26558
26616
|
import { rm as rm12 } from "node:fs/promises";
|
|
@@ -26560,7 +26618,7 @@ init_invariant();
|
|
|
26560
26618
|
|
|
26561
26619
|
// src/cli/portal/report.ts
|
|
26562
26620
|
import { access as access13 } from "node:fs/promises";
|
|
26563
|
-
import
|
|
26621
|
+
import path81 from "node:path";
|
|
26564
26622
|
|
|
26565
26623
|
// src/cli/deploy/gateway.ts
|
|
26566
26624
|
import { createHash as createHash4 } from "node:crypto";
|
|
@@ -26839,7 +26897,7 @@ async function planPortalService(resolved, ledger) {
|
|
|
26839
26897
|
const hash2 = await portalBuildHash(resolved, prepared);
|
|
26840
26898
|
const previous = stepOf(ledger, "portal", "build");
|
|
26841
26899
|
const built = await exists4(
|
|
26842
|
-
|
|
26900
|
+
path81.join(resolved.state.buildDir, "index.html")
|
|
26843
26901
|
);
|
|
26844
26902
|
if (previous?.status === "succeeded" && previous.hash === hash2 && built) {
|
|
26845
26903
|
return {
|
|
@@ -27146,7 +27204,7 @@ async function statusV2(dir, only, options = {}) {
|
|
|
27146
27204
|
if (service === "portal") {
|
|
27147
27205
|
const build2 = stepOf(ledger, "portal", "build");
|
|
27148
27206
|
const built = await exists4(
|
|
27149
|
-
|
|
27207
|
+
path81.join(resolved.state.buildDir, "index.html")
|
|
27150
27208
|
);
|
|
27151
27209
|
const state = build2?.status === "failed" ? "build-failed" : build2?.status === "succeeded" && built ? "built" : "not-built";
|
|
27152
27210
|
services.push({
|
|
@@ -27157,7 +27215,7 @@ async function statusV2(dir, only, options = {}) {
|
|
|
27157
27215
|
...build2?.finishedAt ? [`last build: ${build2.finishedAt}`] : [],
|
|
27158
27216
|
...build2?.status === "failed" ? [`error: ${build2.error ?? "unknown"}`] : [],
|
|
27159
27217
|
...state === "built" ? [
|
|
27160
|
-
`output: ${
|
|
27218
|
+
`output: ${path81.relative(resolved.configDir, resolved.state.buildDir)}`
|
|
27161
27219
|
] : [],
|
|
27162
27220
|
...url2 ? [`url: ${url2}`] : ["url: not known (portal is not deployed yet)"]
|
|
27163
27221
|
]
|
|
@@ -27425,7 +27483,7 @@ async function deployProject(argv) {
|
|
|
27425
27483
|
const config2 = loadConfig();
|
|
27426
27484
|
const output4 = await deployV2(
|
|
27427
27485
|
{
|
|
27428
|
-
dir:
|
|
27486
|
+
dir: path82.resolve(process.cwd(), argv.dir),
|
|
27429
27487
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
27430
27488
|
projectId: argv.projectId,
|
|
27431
27489
|
env: argv.env,
|
|
@@ -27506,7 +27564,7 @@ var deploy_default = {
|
|
|
27506
27564
|
}),
|
|
27507
27565
|
handler: async (argv) => {
|
|
27508
27566
|
await captureEvent({ argv, event: "apitogo deploy" });
|
|
27509
|
-
if (await isConfigV2(
|
|
27567
|
+
if (await isConfigV2(path83.resolve(process.cwd(), argv.dir))) {
|
|
27510
27568
|
await deployProject(argv);
|
|
27511
27569
|
return;
|
|
27512
27570
|
}
|
|
@@ -27516,7 +27574,7 @@ var deploy_default = {
|
|
|
27516
27574
|
|
|
27517
27575
|
// src/cli/export/handler.ts
|
|
27518
27576
|
import { mkdir as mkdir20, writeFile as writeFile24 } from "node:fs/promises";
|
|
27519
|
-
import
|
|
27577
|
+
import path84 from "node:path";
|
|
27520
27578
|
init_invariant();
|
|
27521
27579
|
var ExportError = class extends ApitogoError {
|
|
27522
27580
|
constructor(message, developerHint) {
|
|
@@ -27530,7 +27588,7 @@ async function exportOpenApi(args, deps) {
|
|
|
27530
27588
|
`Cannot export "${args.target}".`,
|
|
27531
27589
|
"Only `apitogo export openapi` exists."
|
|
27532
27590
|
);
|
|
27533
|
-
const dir =
|
|
27591
|
+
const dir = path84.resolve(process.cwd(), args.dir ?? ".");
|
|
27534
27592
|
if (!await isConfigV2(dir))
|
|
27535
27593
|
throw new ExportError(
|
|
27536
27594
|
"This command needs a config version 2 project.",
|
|
@@ -27555,8 +27613,8 @@ async function exportOpenApi(args, deps) {
|
|
|
27555
27613
|
throw error;
|
|
27556
27614
|
}
|
|
27557
27615
|
if (!args.out) return { text };
|
|
27558
|
-
const file =
|
|
27559
|
-
await mkdir20(
|
|
27616
|
+
const file = path84.resolve(process.cwd(), args.out);
|
|
27617
|
+
await mkdir20(path84.dirname(file), { recursive: true });
|
|
27560
27618
|
await writeFile24(file, text);
|
|
27561
27619
|
return { text, file };
|
|
27562
27620
|
}
|
|
@@ -27607,15 +27665,15 @@ var export_default = {
|
|
|
27607
27665
|
};
|
|
27608
27666
|
|
|
27609
27667
|
// src/cli/init/handler.ts
|
|
27610
|
-
import
|
|
27668
|
+
import path88 from "node:path";
|
|
27611
27669
|
|
|
27612
27670
|
// src/cli/scaffold/run-scaffold-discovery.ts
|
|
27613
27671
|
import { access as access15, readFile as readFile29, writeFile as writeFile26 } from "node:fs/promises";
|
|
27614
|
-
import
|
|
27672
|
+
import path87 from "node:path";
|
|
27615
27673
|
|
|
27616
27674
|
// src/cli/scaffold/detect-backend.ts
|
|
27617
27675
|
import { readdir as readdir4, readFile as readFile27 } from "node:fs/promises";
|
|
27618
|
-
import
|
|
27676
|
+
import path85 from "node:path";
|
|
27619
27677
|
var DEFAULT_RUNTIME_VERSION = {
|
|
27620
27678
|
dotnet: "DOTNET_10",
|
|
27621
27679
|
nodejs: "NODE_22_LTS",
|
|
@@ -27661,15 +27719,15 @@ function isRunnableNodePackage(pkg) {
|
|
|
27661
27719
|
return typeof scripts.start === "string" || typeof pkg.main === "string";
|
|
27662
27720
|
}
|
|
27663
27721
|
async function detectParentBackend(siteDirectory) {
|
|
27664
|
-
const site =
|
|
27665
|
-
const directory =
|
|
27722
|
+
const site = path85.resolve(siteDirectory);
|
|
27723
|
+
const directory = path85.dirname(site);
|
|
27666
27724
|
if (directory === site) {
|
|
27667
27725
|
return void 0;
|
|
27668
27726
|
}
|
|
27669
27727
|
const files = await listFiles(directory);
|
|
27670
27728
|
const toResult = (runtime, runtimeVersion, marker) => ({
|
|
27671
27729
|
directory,
|
|
27672
|
-
sourceDirectory:
|
|
27730
|
+
sourceDirectory: path85.relative(site, directory).split(path85.sep).join("/") || ".",
|
|
27673
27731
|
runtime,
|
|
27674
27732
|
runtimeVersion,
|
|
27675
27733
|
marker
|
|
@@ -27677,7 +27735,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27677
27735
|
const csproj = files.find((f) => f.endsWith(".csproj"));
|
|
27678
27736
|
const solution = files.find((f) => /\.slnx?$/.test(f));
|
|
27679
27737
|
if (csproj || solution) {
|
|
27680
|
-
const content = csproj ? await readText(
|
|
27738
|
+
const content = csproj ? await readText(path85.join(directory, csproj)) : void 0;
|
|
27681
27739
|
return toResult(
|
|
27682
27740
|
"dotnet",
|
|
27683
27741
|
dotnetVersionFromCsproj(content),
|
|
@@ -27685,7 +27743,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27685
27743
|
);
|
|
27686
27744
|
}
|
|
27687
27745
|
if (files.includes("package.json")) {
|
|
27688
|
-
const raw = await readText(
|
|
27746
|
+
const raw = await readText(path85.join(directory, "package.json"));
|
|
27689
27747
|
try {
|
|
27690
27748
|
const pkg = JSON.parse(raw ?? "");
|
|
27691
27749
|
if (isRunnableNodePackage(pkg)) {
|
|
@@ -27700,7 +27758,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27700
27758
|
}
|
|
27701
27759
|
const pythonMarker = PYTHON_MARKERS.find((m) => files.includes(m));
|
|
27702
27760
|
if (pythonMarker) {
|
|
27703
|
-
const versionSource = await readText(
|
|
27761
|
+
const versionSource = await readText(path85.join(directory, ".python-version")) ?? (pythonMarker === "pyproject.toml" ? (await readText(path85.join(directory, pythonMarker)))?.match(
|
|
27704
27762
|
/requires-python\s*=\s*"([^"]+)"/
|
|
27705
27763
|
)?.[1] : void 0);
|
|
27706
27764
|
return toResult(
|
|
@@ -27723,7 +27781,7 @@ import {
|
|
|
27723
27781
|
symlink as symlink2,
|
|
27724
27782
|
writeFile as writeFile25
|
|
27725
27783
|
} from "node:fs/promises";
|
|
27726
|
-
import
|
|
27784
|
+
import path86 from "node:path";
|
|
27727
27785
|
var DOCS_DIR_WHITELIST = [
|
|
27728
27786
|
"docs",
|
|
27729
27787
|
"documents",
|
|
@@ -27760,14 +27818,14 @@ async function isDirectory2(filePath) {
|
|
|
27760
27818
|
}
|
|
27761
27819
|
}
|
|
27762
27820
|
function toPosix3(value) {
|
|
27763
|
-
return value.split(
|
|
27821
|
+
return value.split(path86.sep).join(path86.posix.sep);
|
|
27764
27822
|
}
|
|
27765
27823
|
function isWhitelistedDirName(name) {
|
|
27766
27824
|
return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
|
|
27767
27825
|
}
|
|
27768
27826
|
function isInside2(parent, child) {
|
|
27769
|
-
const relative =
|
|
27770
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
27827
|
+
const relative = path86.relative(parent, child);
|
|
27828
|
+
return relative === "" || !relative.startsWith("..") && !path86.isAbsolute(relative);
|
|
27771
27829
|
}
|
|
27772
27830
|
async function collectMarkdownFiles(dir, excludeDir) {
|
|
27773
27831
|
const files = [];
|
|
@@ -27781,9 +27839,9 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
27781
27839
|
if (entry.name.startsWith(".")) {
|
|
27782
27840
|
continue;
|
|
27783
27841
|
}
|
|
27784
|
-
const full =
|
|
27842
|
+
const full = path86.join(dir, entry.name);
|
|
27785
27843
|
if (entry.isDirectory()) {
|
|
27786
|
-
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir &&
|
|
27844
|
+
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path86.resolve(full) === excludeDir) {
|
|
27787
27845
|
continue;
|
|
27788
27846
|
}
|
|
27789
27847
|
files.push(...await collectMarkdownFiles(full, excludeDir));
|
|
@@ -27796,11 +27854,11 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
27796
27854
|
return files;
|
|
27797
27855
|
}
|
|
27798
27856
|
async function collectSearchRoots(siteDirectory) {
|
|
27799
|
-
const site =
|
|
27800
|
-
const parent =
|
|
27857
|
+
const site = path86.resolve(siteDirectory);
|
|
27858
|
+
const parent = path86.dirname(site);
|
|
27801
27859
|
const roots = [];
|
|
27802
27860
|
const add = (dir) => {
|
|
27803
|
-
const resolved =
|
|
27861
|
+
const resolved = path86.resolve(dir);
|
|
27804
27862
|
if (!roots.includes(resolved)) {
|
|
27805
27863
|
roots.push(resolved);
|
|
27806
27864
|
}
|
|
@@ -27813,7 +27871,7 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
27813
27871
|
if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
|
|
27814
27872
|
continue;
|
|
27815
27873
|
}
|
|
27816
|
-
add(
|
|
27874
|
+
add(path86.join(parent, entry.name));
|
|
27817
27875
|
}
|
|
27818
27876
|
} catch {
|
|
27819
27877
|
}
|
|
@@ -27822,13 +27880,13 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
27822
27880
|
return roots;
|
|
27823
27881
|
}
|
|
27824
27882
|
async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
27825
|
-
const site =
|
|
27826
|
-
const sitePages =
|
|
27883
|
+
const site = path86.resolve(siteDirectory);
|
|
27884
|
+
const sitePages = path86.join(site, PAGES_DIR);
|
|
27827
27885
|
const searchedDirectories = await collectSearchRoots(site);
|
|
27828
27886
|
const directories = [];
|
|
27829
27887
|
const seen = /* @__PURE__ */ new Set();
|
|
27830
27888
|
const consider = async (dir) => {
|
|
27831
|
-
const resolved =
|
|
27889
|
+
const resolved = path86.resolve(dir);
|
|
27832
27890
|
if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
|
|
27833
27891
|
return;
|
|
27834
27892
|
}
|
|
@@ -27845,7 +27903,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
27845
27903
|
directories.push({ sourceDirectory: resolved, files });
|
|
27846
27904
|
};
|
|
27847
27905
|
for (const root of searchedDirectories) {
|
|
27848
|
-
if (isWhitelistedDirName(
|
|
27906
|
+
if (isWhitelistedDirName(path86.basename(root))) {
|
|
27849
27907
|
await consider(root);
|
|
27850
27908
|
}
|
|
27851
27909
|
try {
|
|
@@ -27857,7 +27915,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
27857
27915
|
if (!isWhitelistedDirName(entry.name)) {
|
|
27858
27916
|
continue;
|
|
27859
27917
|
}
|
|
27860
|
-
await consider(
|
|
27918
|
+
await consider(path86.join(root, entry.name));
|
|
27861
27919
|
}
|
|
27862
27920
|
} catch {
|
|
27863
27921
|
}
|
|
@@ -27876,8 +27934,8 @@ function slugifyDirName(name) {
|
|
|
27876
27934
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
27877
27935
|
}
|
|
27878
27936
|
async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
27879
|
-
const base = slugifyDirName(
|
|
27880
|
-
const parent = slugifyDirName(
|
|
27937
|
+
const base = slugifyDirName(path86.basename(sourceDirectory));
|
|
27938
|
+
const parent = slugifyDirName(path86.basename(path86.dirname(sourceDirectory)));
|
|
27881
27939
|
const candidates = [base, `${parent}-${base}`];
|
|
27882
27940
|
let index = 2;
|
|
27883
27941
|
while (true) {
|
|
@@ -27885,7 +27943,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
|
27885
27943
|
if (used.has(name)) {
|
|
27886
27944
|
continue;
|
|
27887
27945
|
}
|
|
27888
|
-
const target =
|
|
27946
|
+
const target = path86.join(pagesDir, name);
|
|
27889
27947
|
if (await pathExists5(target)) {
|
|
27890
27948
|
const stat7 = await lstat2(target);
|
|
27891
27949
|
if (!stat7.isDirectory() || !await isManagedLinkDir(target)) {
|
|
@@ -27916,8 +27974,8 @@ async function alreadyLinked(linkPath, sourcePath) {
|
|
|
27916
27974
|
return false;
|
|
27917
27975
|
}
|
|
27918
27976
|
const current = await readlink(linkPath);
|
|
27919
|
-
const resolved =
|
|
27920
|
-
return resolved ===
|
|
27977
|
+
const resolved = path86.resolve(path86.dirname(linkPath), current);
|
|
27978
|
+
return resolved === path86.resolve(sourcePath);
|
|
27921
27979
|
} catch {
|
|
27922
27980
|
return false;
|
|
27923
27981
|
}
|
|
@@ -27929,8 +27987,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
|
|
|
27929
27987
|
if (await pathExists5(linkPath)) {
|
|
27930
27988
|
return "skipped";
|
|
27931
27989
|
}
|
|
27932
|
-
await mkdir21(
|
|
27933
|
-
const relativeTarget =
|
|
27990
|
+
await mkdir21(path86.dirname(linkPath), { recursive: true });
|
|
27991
|
+
const relativeTarget = path86.relative(path86.dirname(linkPath), sourcePath);
|
|
27934
27992
|
await symlink2(
|
|
27935
27993
|
relativeTarget,
|
|
27936
27994
|
linkPath,
|
|
@@ -27945,7 +28003,7 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
27945
28003
|
if (routes.length === 0) {
|
|
27946
28004
|
return;
|
|
27947
28005
|
}
|
|
27948
|
-
const configPath =
|
|
28006
|
+
const configPath = path86.join(siteDirectory, CONFIG_FILENAME);
|
|
27949
28007
|
if (!await pathExists5(configPath)) {
|
|
27950
28008
|
return;
|
|
27951
28009
|
}
|
|
@@ -27962,8 +28020,8 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
27962
28020
|
`, "utf8");
|
|
27963
28021
|
}
|
|
27964
28022
|
async function discoverAndWireDocs(siteDirectory) {
|
|
27965
|
-
const site =
|
|
27966
|
-
const pagesDir =
|
|
28023
|
+
const site = path86.resolve(siteDirectory);
|
|
28024
|
+
const pagesDir = path86.join(site, PAGES_DIR);
|
|
27967
28025
|
const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
|
|
27968
28026
|
if (directories.length === 0) {
|
|
27969
28027
|
return {
|
|
@@ -27985,15 +28043,15 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
27985
28043
|
directory.sourceDirectory,
|
|
27986
28044
|
usedNames
|
|
27987
28045
|
);
|
|
27988
|
-
const linkDirectory =
|
|
28046
|
+
const linkDirectory = path86.join(pagesDir, linkName);
|
|
27989
28047
|
const linked = [];
|
|
27990
28048
|
const skipped = [];
|
|
27991
28049
|
for (const sourcePath of directory.files) {
|
|
27992
28050
|
const relativeSource = toPosix3(
|
|
27993
|
-
|
|
28051
|
+
path86.relative(directory.sourceDirectory, sourcePath)
|
|
27994
28052
|
);
|
|
27995
|
-
const linkPath =
|
|
27996
|
-
const relativeLink = toPosix3(
|
|
28053
|
+
const linkPath = path86.join(linkDirectory, relativeSource);
|
|
28054
|
+
const relativeLink = toPosix3(path86.relative(site, linkPath));
|
|
27997
28055
|
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
27998
28056
|
if (routes.includes(route)) {
|
|
27999
28057
|
skipped.push({
|
|
@@ -28041,11 +28099,11 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
28041
28099
|
};
|
|
28042
28100
|
}
|
|
28043
28101
|
function siteRelative(siteDirectory, filePath) {
|
|
28044
|
-
const relative = toPosix3(
|
|
28102
|
+
const relative = toPosix3(path86.relative(siteDirectory, filePath));
|
|
28045
28103
|
if (!relative) {
|
|
28046
28104
|
return ".";
|
|
28047
28105
|
}
|
|
28048
|
-
if (
|
|
28106
|
+
if (path86.isAbsolute(relative)) {
|
|
28049
28107
|
return toPosix3(filePath);
|
|
28050
28108
|
}
|
|
28051
28109
|
if (relative.startsWith("..")) {
|
|
@@ -28133,7 +28191,7 @@ async function pathExists6(filePath) {
|
|
|
28133
28191
|
}
|
|
28134
28192
|
async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
|
|
28135
28193
|
const input5 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
|
|
28136
|
-
const jsonConfigPath =
|
|
28194
|
+
const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
|
|
28137
28195
|
const raw = await readFile29(jsonConfigPath, "utf8");
|
|
28138
28196
|
const siteConfig = JSON.parse(raw);
|
|
28139
28197
|
const updated = applyOpenApiToSiteConfig(siteConfig, {
|
|
@@ -28185,7 +28243,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
|
|
|
28185
28243
|
wired: false
|
|
28186
28244
|
};
|
|
28187
28245
|
}
|
|
28188
|
-
const jsonConfigPath =
|
|
28246
|
+
const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
|
|
28189
28247
|
if (!await pathExists6(jsonConfigPath)) {
|
|
28190
28248
|
return {
|
|
28191
28249
|
openApiDiscovery: {
|
|
@@ -28235,7 +28293,7 @@ async function discoverAndWireBackend(siteDirectory, mode) {
|
|
|
28235
28293
|
if (mode !== "nearby") {
|
|
28236
28294
|
return { status: "skipped", mode };
|
|
28237
28295
|
}
|
|
28238
|
-
const jsonConfigPath =
|
|
28296
|
+
const jsonConfigPath = path87.join(siteDirectory, "apitogo.config.json");
|
|
28239
28297
|
if (!await pathExists6(jsonConfigPath)) {
|
|
28240
28298
|
return { status: "not_found" };
|
|
28241
28299
|
}
|
|
@@ -28302,8 +28360,8 @@ function slugifyName2(name) {
|
|
|
28302
28360
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
|
|
28303
28361
|
}
|
|
28304
28362
|
function resolveInitOutputDirectory(dirArg, name) {
|
|
28305
|
-
const resolved =
|
|
28306
|
-
const base =
|
|
28363
|
+
const resolved = path88.resolve(process.cwd(), dirArg);
|
|
28364
|
+
const base = path88.basename(resolved);
|
|
28307
28365
|
const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
|
|
28308
28366
|
if (isDot) {
|
|
28309
28367
|
const fromName = name?.trim();
|
|
@@ -28313,7 +28371,7 @@ function resolveInitOutputDirectory(dirArg, name) {
|
|
|
28313
28371
|
);
|
|
28314
28372
|
}
|
|
28315
28373
|
return {
|
|
28316
|
-
outputDirectory:
|
|
28374
|
+
outputDirectory: path88.resolve(process.cwd(), slugifyName2(fromName)),
|
|
28317
28375
|
siteName: fromName
|
|
28318
28376
|
};
|
|
28319
28377
|
}
|
|
@@ -28496,8 +28554,8 @@ import open2 from "open";
|
|
|
28496
28554
|
import colors14 from "picocolors";
|
|
28497
28555
|
|
|
28498
28556
|
// src/cli/platform/device-auth.ts
|
|
28499
|
-
function url(apiUrl,
|
|
28500
|
-
return `${apiUrl}${
|
|
28557
|
+
function url(apiUrl, path101) {
|
|
28558
|
+
return `${apiUrl}${path101.startsWith("/") ? path101 : `/${path101}`}`;
|
|
28501
28559
|
}
|
|
28502
28560
|
async function requestDeviceCode(apiUrl) {
|
|
28503
28561
|
const response = await fetchWithRetry(
|
|
@@ -28679,7 +28737,7 @@ var logout_default = {
|
|
|
28679
28737
|
};
|
|
28680
28738
|
|
|
28681
28739
|
// src/cli/portal/commands.ts
|
|
28682
|
-
import
|
|
28740
|
+
import path89 from "node:path";
|
|
28683
28741
|
init_invariant();
|
|
28684
28742
|
function parseOnly(value) {
|
|
28685
28743
|
if (value === void 0) return void 0;
|
|
@@ -28696,7 +28754,7 @@ function parseOnly(value) {
|
|
|
28696
28754
|
async function run2(command2, argv, compute, format) {
|
|
28697
28755
|
const json = argv.json === true;
|
|
28698
28756
|
try {
|
|
28699
|
-
const dir =
|
|
28757
|
+
const dir = path89.resolve(process.cwd(), argv.dir ?? ".");
|
|
28700
28758
|
if (!await isConfigV2(dir)) {
|
|
28701
28759
|
throw new ServiceEditError(
|
|
28702
28760
|
`${command2} works with a config version 2 project, and there is none in ${dir}.`,
|
|
@@ -28780,7 +28838,7 @@ var plan_default = {
|
|
|
28780
28838
|
|
|
28781
28839
|
// src/cli/project/create-handler.ts
|
|
28782
28840
|
init_invariant();
|
|
28783
|
-
import
|
|
28841
|
+
import path90 from "node:path";
|
|
28784
28842
|
|
|
28785
28843
|
// src/cli/project/v2.ts
|
|
28786
28844
|
init_invariant();
|
|
@@ -28927,7 +28985,7 @@ async function createLinkedProject(argv, dir) {
|
|
|
28927
28985
|
}
|
|
28928
28986
|
}
|
|
28929
28987
|
async function createProject(argv) {
|
|
28930
|
-
const dir =
|
|
28988
|
+
const dir = path90.resolve(process.cwd(), argv.dir ?? ".");
|
|
28931
28989
|
if (await isConfigV2(dir)) {
|
|
28932
28990
|
await createLinkedProject(argv, dir);
|
|
28933
28991
|
return;
|
|
@@ -29051,14 +29109,14 @@ var remove_default = {
|
|
|
29051
29109
|
|
|
29052
29110
|
// src/cli/dev/handler.ts
|
|
29053
29111
|
init_joinUrl();
|
|
29054
|
-
import
|
|
29112
|
+
import path93 from "node:path";
|
|
29055
29113
|
|
|
29056
29114
|
// src/vite/dev-server.ts
|
|
29057
29115
|
init_logger();
|
|
29058
29116
|
import fs12 from "node:fs/promises";
|
|
29059
29117
|
import http from "node:http";
|
|
29060
29118
|
import https from "node:https";
|
|
29061
|
-
import
|
|
29119
|
+
import path92 from "node:path";
|
|
29062
29120
|
import { createHttpTerminator } from "http-terminator";
|
|
29063
29121
|
import {
|
|
29064
29122
|
createServer as createViteServer,
|
|
@@ -29091,7 +29149,7 @@ init_loader();
|
|
|
29091
29149
|
// src/vite/pagefind-dev-index.ts
|
|
29092
29150
|
init_invariant();
|
|
29093
29151
|
init_joinUrl();
|
|
29094
|
-
import
|
|
29152
|
+
import path91 from "node:path";
|
|
29095
29153
|
import { createIndex as createIndex2 } from "pagefind";
|
|
29096
29154
|
import { isRunnableDevEnvironment } from "vite";
|
|
29097
29155
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -29144,7 +29202,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
29144
29202
|
path: urlPath
|
|
29145
29203
|
};
|
|
29146
29204
|
}
|
|
29147
|
-
const outputPath =
|
|
29205
|
+
const outputPath = path91.join(vite.config.publicDir, "pagefind");
|
|
29148
29206
|
await pagefindIndex.writeFiles({ outputPath });
|
|
29149
29207
|
yield { type: "complete", success: true, indexed };
|
|
29150
29208
|
}
|
|
@@ -29163,9 +29221,9 @@ var DevServer = class {
|
|
|
29163
29221
|
this.protocol = "https";
|
|
29164
29222
|
const { dir } = this.options;
|
|
29165
29223
|
const [key, cert, ca] = await Promise.all([
|
|
29166
|
-
fs12.readFile(
|
|
29167
|
-
fs12.readFile(
|
|
29168
|
-
config2.https.ca ? fs12.readFile(
|
|
29224
|
+
fs12.readFile(path92.resolve(dir, config2.https.key)),
|
|
29225
|
+
fs12.readFile(path92.resolve(dir, config2.https.cert)),
|
|
29226
|
+
config2.https.ca ? fs12.readFile(path92.resolve(dir, config2.https.ca)) : void 0
|
|
29169
29227
|
]);
|
|
29170
29228
|
return https.createServer({ key, cert, ca });
|
|
29171
29229
|
}
|
|
@@ -29182,7 +29240,7 @@ var DevServer = class {
|
|
|
29182
29240
|
);
|
|
29183
29241
|
const server = await this.createNodeServer(config2);
|
|
29184
29242
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
29185
|
-
const publicRoot =
|
|
29243
|
+
const publicRoot = path92.resolve(
|
|
29186
29244
|
this.options.dir,
|
|
29187
29245
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
29188
29246
|
);
|
|
@@ -29199,7 +29257,7 @@ var DevServer = class {
|
|
|
29199
29257
|
// built-in transform middleware which would treat the path as a static asset.
|
|
29200
29258
|
name: "apitogo:entry-client",
|
|
29201
29259
|
configureServer(server2) {
|
|
29202
|
-
const entryPath =
|
|
29260
|
+
const entryPath = path92.posix.join(
|
|
29203
29261
|
server2.config.base,
|
|
29204
29262
|
"/__z/entry.client.tsx"
|
|
29205
29263
|
);
|
|
@@ -29364,7 +29422,7 @@ init_package_json();
|
|
|
29364
29422
|
async function dev(argv) {
|
|
29365
29423
|
const packageJson3 = getZudokuPackageJson();
|
|
29366
29424
|
process.env.NODE_ENV = "development";
|
|
29367
|
-
let dir =
|
|
29425
|
+
let dir = path93.resolve(process.cwd(), argv.dir);
|
|
29368
29426
|
if (await isConfigV2(dir)) {
|
|
29369
29427
|
const { root, prepared } = await preparePortalWorkspace(dir, "development");
|
|
29370
29428
|
dir = root;
|
|
@@ -29463,7 +29521,7 @@ var run_default = {
|
|
|
29463
29521
|
};
|
|
29464
29522
|
|
|
29465
29523
|
// src/cli/secrets/handler.ts
|
|
29466
|
-
import
|
|
29524
|
+
import path94 from "node:path";
|
|
29467
29525
|
init_invariant();
|
|
29468
29526
|
|
|
29469
29527
|
// src/cli/secrets/input.ts
|
|
@@ -29528,7 +29586,7 @@ var SecretsError = class extends ApitogoError {
|
|
|
29528
29586
|
async function resolveProjectId2(argv, deps) {
|
|
29529
29587
|
const explicit = argv.projectId?.trim();
|
|
29530
29588
|
if (explicit) return explicit;
|
|
29531
|
-
const dir =
|
|
29589
|
+
const dir = path94.resolve(process.cwd(), argv.dir ?? ".");
|
|
29532
29590
|
if (await isConfigV2(dir)) {
|
|
29533
29591
|
const id = loadConfigV2(dir).resolved.project.id;
|
|
29534
29592
|
if (id) return id;
|
|
@@ -29688,12 +29746,12 @@ var secrets_default = {
|
|
|
29688
29746
|
};
|
|
29689
29747
|
|
|
29690
29748
|
// src/cli/cmds/status.ts
|
|
29691
|
-
import
|
|
29749
|
+
import path96 from "node:path";
|
|
29692
29750
|
|
|
29693
29751
|
// src/cli/status/handler.ts
|
|
29694
|
-
import
|
|
29752
|
+
import path95 from "node:path";
|
|
29695
29753
|
async function status(argv) {
|
|
29696
|
-
const sourceDirectory =
|
|
29754
|
+
const sourceDirectory = path95.resolve(process.cwd(), argv.dir);
|
|
29697
29755
|
let config2;
|
|
29698
29756
|
try {
|
|
29699
29757
|
config2 = loadConfig();
|
|
@@ -29791,7 +29849,7 @@ var status_default = {
|
|
|
29791
29849
|
}),
|
|
29792
29850
|
handler: async (argv) => {
|
|
29793
29851
|
await captureEvent({ argv, event: "apitogo status" });
|
|
29794
|
-
if (await isConfigV2(
|
|
29852
|
+
if (await isConfigV2(path96.resolve(process.cwd(), argv.dir))) {
|
|
29795
29853
|
await statusOfProject(argv);
|
|
29796
29854
|
return;
|
|
29797
29855
|
}
|
|
@@ -29800,11 +29858,11 @@ var status_default = {
|
|
|
29800
29858
|
};
|
|
29801
29859
|
|
|
29802
29860
|
// src/cli/cmds/teardown.ts
|
|
29803
|
-
import
|
|
29861
|
+
import path99 from "node:path";
|
|
29804
29862
|
|
|
29805
29863
|
// src/cli/teardown/command.ts
|
|
29806
29864
|
init_invariant();
|
|
29807
|
-
import
|
|
29865
|
+
import path97 from "node:path";
|
|
29808
29866
|
import { createInterface as createInterface7 } from "node:readline/promises";
|
|
29809
29867
|
|
|
29810
29868
|
// src/cli/teardown/v2.ts
|
|
@@ -30021,7 +30079,7 @@ async function teardownProject(argv) {
|
|
|
30021
30079
|
const progress = createConsoleProgressReporter();
|
|
30022
30080
|
const result = await teardownV2(
|
|
30023
30081
|
{
|
|
30024
|
-
dir:
|
|
30082
|
+
dir: path97.resolve(process.cwd(), argv.dir),
|
|
30025
30083
|
projectId: argv.projectId,
|
|
30026
30084
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
30027
30085
|
yes: argv.yes === true,
|
|
@@ -30080,7 +30138,7 @@ async function teardownProject(argv) {
|
|
|
30080
30138
|
}
|
|
30081
30139
|
|
|
30082
30140
|
// src/cli/teardown/handler.ts
|
|
30083
|
-
import
|
|
30141
|
+
import path98 from "node:path";
|
|
30084
30142
|
function resultLooksFailed3(payload) {
|
|
30085
30143
|
try {
|
|
30086
30144
|
const parsed = JSON.parse(payload);
|
|
@@ -30096,7 +30154,7 @@ async function teardown(argv) {
|
|
|
30096
30154
|
);
|
|
30097
30155
|
return;
|
|
30098
30156
|
}
|
|
30099
|
-
const sourceDirectory =
|
|
30157
|
+
const sourceDirectory = path98.resolve(process.cwd(), argv.dir);
|
|
30100
30158
|
let config2;
|
|
30101
30159
|
try {
|
|
30102
30160
|
config2 = loadConfig();
|
|
@@ -30174,7 +30232,7 @@ var teardown_default = {
|
|
|
30174
30232
|
}),
|
|
30175
30233
|
handler: async (argv) => {
|
|
30176
30234
|
await captureEvent({ argv, event: "apitogo teardown" });
|
|
30177
|
-
if (await isConfigV2(
|
|
30235
|
+
if (await isConfigV2(path99.resolve(process.cwd(), argv.dir))) {
|
|
30178
30236
|
await teardownProject(argv);
|
|
30179
30237
|
return;
|
|
30180
30238
|
}
|
|
@@ -30252,36 +30310,36 @@ function createApitogoCli(argv) {
|
|
|
30252
30310
|
// src/cli/local-handoff.ts
|
|
30253
30311
|
import { spawn as spawn5 } from "node:child_process";
|
|
30254
30312
|
import { existsSync as existsSync8, realpathSync } from "node:fs";
|
|
30255
|
-
import
|
|
30313
|
+
import path100 from "node:path";
|
|
30256
30314
|
var LOCAL_HANDOFF_ENV = "APITOGO_LOCAL_CLI";
|
|
30257
30315
|
var PACKAGE_NAME = "@lukoweb/apitogo";
|
|
30258
30316
|
var resolveProjectDir = (argv, cwd) => {
|
|
30259
30317
|
for (let i = 0; i < argv.length; i++) {
|
|
30260
30318
|
const arg = argv[i];
|
|
30261
30319
|
const next = argv[i + 1];
|
|
30262
|
-
if (arg === "--dir" && next) return
|
|
30320
|
+
if (arg === "--dir" && next) return path100.resolve(cwd, next);
|
|
30263
30321
|
if (arg?.startsWith("--dir=")) {
|
|
30264
|
-
return
|
|
30322
|
+
return path100.resolve(cwd, arg.slice("--dir=".length));
|
|
30265
30323
|
}
|
|
30266
30324
|
}
|
|
30267
30325
|
return cwd;
|
|
30268
30326
|
};
|
|
30269
30327
|
var findLocalCli = (projectDir, runningRoot) => {
|
|
30270
|
-
let dir =
|
|
30328
|
+
let dir = path100.resolve(projectDir);
|
|
30271
30329
|
let localPackageRoot;
|
|
30272
30330
|
while (!localPackageRoot) {
|
|
30273
|
-
const candidate =
|
|
30274
|
-
if (existsSync8(
|
|
30331
|
+
const candidate = path100.join(dir, "node_modules", PACKAGE_NAME);
|
|
30332
|
+
if (existsSync8(path100.join(candidate, "package.json"))) {
|
|
30275
30333
|
localPackageRoot = candidate;
|
|
30276
|
-
} else if (dir ===
|
|
30334
|
+
} else if (dir === path100.dirname(dir)) {
|
|
30277
30335
|
return void 0;
|
|
30278
30336
|
} else {
|
|
30279
|
-
dir =
|
|
30337
|
+
dir = path100.dirname(dir);
|
|
30280
30338
|
}
|
|
30281
30339
|
}
|
|
30282
30340
|
const localRoot = realpathSync(localPackageRoot);
|
|
30283
30341
|
if (localRoot === realpathSync(runningRoot)) return void 0;
|
|
30284
|
-
return
|
|
30342
|
+
return path100.join(localRoot, "cli.js");
|
|
30285
30343
|
};
|
|
30286
30344
|
var handoffToLocalCli = async (argv, runningRoot) => {
|
|
30287
30345
|
if (process.env[LOCAL_HANDOFF_ENV] || process.env.ZUDOKU_ENV === "internal") {
|
|
@@ -30293,7 +30351,7 @@ var handoffToLocalCli = async (argv, runningRoot) => {
|
|
|
30293
30351
|
);
|
|
30294
30352
|
if (!localCli) return void 0;
|
|
30295
30353
|
printDiagnosticsToConsole(
|
|
30296
|
-
`Using the project's local ${PACKAGE_NAME} (${
|
|
30354
|
+
`Using the project's local ${PACKAGE_NAME} (${path100.dirname(localCli)})`
|
|
30297
30355
|
);
|
|
30298
30356
|
const child = spawn5(process.execPath, [localCli, ...argv], {
|
|
30299
30357
|
stdio: "inherit",
|