@lukoweb/apitogo 0.1.110 → 0.1.112
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 +637 -380
- package/dist/declarations/cli/common/constants.d.ts +6 -0
- package/dist/declarations/cli/common/xdg/lib.d.ts +6 -0
- package/dist/declarations/cli/platform/client/platform-api.d.ts +1 -0
- package/dist/declarations/cli/platform/config.d.ts +1 -0
- package/dist/declarations/cli/platform/credentials-store.d.ts +9 -0
- package/dist/declarations/cli/platform/helpers/dev-portal-manifest.d.ts +1 -1
- package/docs/mcp/shape.md +1 -1
- package/docs/quickstart.md +2 -2
- package/package.json +2 -1
package/dist/cli/cli.js
CHANGED
|
@@ -832,7 +832,7 @@ import { stat } from "node:fs/promises";
|
|
|
832
832
|
var fileExists;
|
|
833
833
|
var init_file_exists = __esm({
|
|
834
834
|
"src/config/file-exists.ts"() {
|
|
835
|
-
fileExists = (
|
|
835
|
+
fileExists = (path72) => stat(path72).then(() => true).catch(() => false);
|
|
836
836
|
}
|
|
837
837
|
});
|
|
838
838
|
|
|
@@ -1815,10 +1815,10 @@ var init_shadcn_registry = __esm({
|
|
|
1815
1815
|
}).optional(),
|
|
1816
1816
|
css: registryItemCssSchema.optional()
|
|
1817
1817
|
});
|
|
1818
|
-
fetchShadcnRegistryItem = async (
|
|
1819
|
-
const response = await fetch(
|
|
1818
|
+
fetchShadcnRegistryItem = async (url2) => {
|
|
1819
|
+
const response = await fetch(url2);
|
|
1820
1820
|
if (!response.ok) {
|
|
1821
|
-
throw new Error(`Failed to fetch shadcn registry item from ${
|
|
1821
|
+
throw new Error(`Failed to fetch shadcn registry item from ${url2}`);
|
|
1822
1822
|
}
|
|
1823
1823
|
const data = await response.json();
|
|
1824
1824
|
const result = registryItemSchema.parse(data);
|
|
@@ -2048,7 +2048,7 @@ var init_plugin_theme = __esm({
|
|
|
2048
2048
|
const themeCss = [];
|
|
2049
2049
|
const fonts = await processFonts(themeConfig);
|
|
2050
2050
|
if (fonts.imports.length > 0) {
|
|
2051
|
-
themeCss.push(...fonts.imports.map((
|
|
2051
|
+
themeCss.push(...fonts.imports.map((url2) => `@import url('${url2}');`));
|
|
2052
2052
|
}
|
|
2053
2053
|
if (themeConfig.registryUrl) {
|
|
2054
2054
|
try {
|
|
@@ -4365,18 +4365,18 @@ var init_joinUrl = __esm({
|
|
|
4365
4365
|
};
|
|
4366
4366
|
buildUrl = (parsedParts) => {
|
|
4367
4367
|
const { prefix, pathname, query } = parsedParts;
|
|
4368
|
-
let
|
|
4368
|
+
let url2 = prefix;
|
|
4369
4369
|
if (pathname.length > 0) {
|
|
4370
|
-
if (
|
|
4371
|
-
|
|
4370
|
+
if (url2) {
|
|
4371
|
+
url2 += "/";
|
|
4372
4372
|
} else {
|
|
4373
|
-
|
|
4373
|
+
url2 = "/";
|
|
4374
4374
|
}
|
|
4375
|
-
|
|
4376
|
-
} else if (!
|
|
4377
|
-
|
|
4375
|
+
url2 += pathname.join("/");
|
|
4376
|
+
} else if (!url2) {
|
|
4377
|
+
url2 = "/";
|
|
4378
4378
|
}
|
|
4379
|
-
return
|
|
4379
|
+
return url2 + query;
|
|
4380
4380
|
};
|
|
4381
4381
|
joinUrl = (...parts) => {
|
|
4382
4382
|
const normalizedParts = normalizeParts(parts);
|
|
@@ -5262,7 +5262,7 @@ async function generateLlmsTxtFiles({
|
|
|
5262
5262
|
llmsTxtFull,
|
|
5263
5263
|
redirectUrls
|
|
5264
5264
|
}) {
|
|
5265
|
-
const nonRedirectUrls = outputUrls.filter((
|
|
5265
|
+
const nonRedirectUrls = outputUrls.filter((url2) => !redirectUrls.has(url2));
|
|
5266
5266
|
const baseUrl = basePath ?? "";
|
|
5267
5267
|
const title = siteName ?? "Documentation";
|
|
5268
5268
|
const markdownMap = new Map(
|
|
@@ -5274,12 +5274,12 @@ async function generateLlmsTxtFiles({
|
|
|
5274
5274
|
`);
|
|
5275
5275
|
llmsTxtParts.push("> Documentation files for Large Language Models\n");
|
|
5276
5276
|
llmsTxtParts.push("## Documentation\n");
|
|
5277
|
-
for (const
|
|
5278
|
-
if (/(400|404|500)$/.test(
|
|
5279
|
-
const mdInfo = markdownMap.get(
|
|
5277
|
+
for (const url2 of nonRedirectUrls) {
|
|
5278
|
+
if (/(400|404|500)$/.test(url2)) continue;
|
|
5279
|
+
const mdInfo = markdownMap.get(url2);
|
|
5280
5280
|
if (mdInfo) {
|
|
5281
|
-
const mdUrl = joinUrl(baseUrl, `${
|
|
5282
|
-
const linkTitle = mdInfo.title ??
|
|
5281
|
+
const mdUrl = joinUrl(baseUrl, `${url2}.md`);
|
|
5282
|
+
const linkTitle = mdInfo.title ?? url2;
|
|
5283
5283
|
const description = mdInfo.description ? `: ${mdInfo.description}` : "";
|
|
5284
5284
|
llmsTxtParts.push(`- [${linkTitle}](${mdUrl})${description}`);
|
|
5285
5285
|
}
|
|
@@ -5801,7 +5801,7 @@ import {
|
|
|
5801
5801
|
// package.json
|
|
5802
5802
|
var package_default = {
|
|
5803
5803
|
name: "@lukoweb/apitogo",
|
|
5804
|
-
version: "0.1.
|
|
5804
|
+
version: "0.1.112",
|
|
5805
5805
|
type: "module",
|
|
5806
5806
|
sideEffects: [
|
|
5807
5807
|
"**/*.css",
|
|
@@ -5971,6 +5971,7 @@ var package_default = {
|
|
|
5971
5971
|
nanoevents: "9.1.0",
|
|
5972
5972
|
"next-themes": "0.4.6",
|
|
5973
5973
|
oauth4webapi: "3.8.5",
|
|
5974
|
+
open: "11.0.4",
|
|
5974
5975
|
"openapi-types": "12.1.3",
|
|
5975
5976
|
pagefind: "1.5.0-beta.1",
|
|
5976
5977
|
picocolors: "1.1.1",
|
|
@@ -6267,12 +6268,12 @@ import { isCSSRequest as isCSSRequest2 } from "vite";
|
|
|
6267
6268
|
import { isCSSRequest } from "vite";
|
|
6268
6269
|
async function collectStyle(server, entries, cssModuleMap) {
|
|
6269
6270
|
const urls = await collectStyleUrls(server, entries);
|
|
6270
|
-
return urls.map((
|
|
6271
|
+
return urls.map((url2) => cssModuleMap.get(url2) ?? "").join("\n");
|
|
6271
6272
|
}
|
|
6272
6273
|
async function collectStyleUrls(server, entries) {
|
|
6273
6274
|
const visited = /* @__PURE__ */ new Set();
|
|
6274
|
-
async function traverse2(
|
|
6275
|
-
const [, id] = await server.moduleGraph.resolveUrl(
|
|
6275
|
+
async function traverse2(url2) {
|
|
6276
|
+
const [, id] = await server.moduleGraph.resolveUrl(url2);
|
|
6276
6277
|
if (visited.has(id)) {
|
|
6277
6278
|
return;
|
|
6278
6279
|
}
|
|
@@ -6286,8 +6287,8 @@ async function collectStyleUrls(server, entries) {
|
|
|
6286
6287
|
);
|
|
6287
6288
|
}
|
|
6288
6289
|
await Promise.all(entries.map((e) => server.transformRequest(e)));
|
|
6289
|
-
await Promise.all(entries.map((
|
|
6290
|
-
return [...visited].filter((
|
|
6290
|
+
await Promise.all(entries.map((url2) => traverse2(url2)));
|
|
6291
|
+
return [...visited].filter((url2) => isCSSRequest(url2));
|
|
6291
6292
|
}
|
|
6292
6293
|
|
|
6293
6294
|
// src/vite/css/plugin.ts
|
|
@@ -6329,9 +6330,9 @@ function vitePluginSsrCss(pluginOpts) {
|
|
|
6329
6330
|
},
|
|
6330
6331
|
async load(id) {
|
|
6331
6332
|
if (!id.startsWith(`\0${VIRTUAL_ENTRY}`)) return;
|
|
6332
|
-
const
|
|
6333
|
+
const url2 = new URL(id.slice(1), "https://test.local");
|
|
6333
6334
|
let code = await collectStyle(server, pluginOpts.entries, cssModuleMap);
|
|
6334
|
-
if (!
|
|
6335
|
+
if (!url2.searchParams.has("direct")) {
|
|
6335
6336
|
code = `export default ${JSON.stringify(code)};`;
|
|
6336
6337
|
}
|
|
6337
6338
|
return code;
|
|
@@ -6579,14 +6580,14 @@ var flattenAllOf = (schema2) => {
|
|
|
6579
6580
|
};
|
|
6580
6581
|
|
|
6581
6582
|
// src/lib/util/traverse.ts
|
|
6582
|
-
var traverse = (specification, transform,
|
|
6583
|
-
const transformed = transform(specification,
|
|
6583
|
+
var traverse = (specification, transform, path72 = []) => {
|
|
6584
|
+
const transformed = transform(specification, path72);
|
|
6584
6585
|
if (typeof transformed !== "object" || transformed === null) {
|
|
6585
6586
|
return transformed;
|
|
6586
6587
|
}
|
|
6587
6588
|
const result = Array.isArray(transformed) ? [] : {};
|
|
6588
6589
|
for (const [key, value] of Object.entries(transformed)) {
|
|
6589
|
-
const currentPath = [...
|
|
6590
|
+
const currentPath = [...path72, key];
|
|
6590
6591
|
if (Array.isArray(value)) {
|
|
6591
6592
|
result[key] = value.map(
|
|
6592
6593
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -6614,9 +6615,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
6614
6615
|
if (schemaCache?.has(ref)) {
|
|
6615
6616
|
return schemaCache.get(ref);
|
|
6616
6617
|
}
|
|
6617
|
-
const
|
|
6618
|
+
const path72 = ref.split("/").slice(1);
|
|
6618
6619
|
let current = schema2;
|
|
6619
|
-
for (const segment of
|
|
6620
|
+
for (const segment of path72) {
|
|
6620
6621
|
if (!current || typeof current !== "object") {
|
|
6621
6622
|
current = null;
|
|
6622
6623
|
}
|
|
@@ -6635,7 +6636,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
6635
6636
|
}
|
|
6636
6637
|
const cloned = structuredClone(schema2);
|
|
6637
6638
|
const visited = /* @__PURE__ */ new Set();
|
|
6638
|
-
const resolve = async (current,
|
|
6639
|
+
const resolve = async (current, path72) => {
|
|
6639
6640
|
if (isIndexableObject(current)) {
|
|
6640
6641
|
if (visited.has(current)) {
|
|
6641
6642
|
return CIRCULAR_REF;
|
|
@@ -6643,7 +6644,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
6643
6644
|
visited.add(current);
|
|
6644
6645
|
if (Array.isArray(current)) {
|
|
6645
6646
|
for (let index = 0; index < current.length; index++) {
|
|
6646
|
-
current[index] = await resolve(current[index], `${
|
|
6647
|
+
current[index] = await resolve(current[index], `${path72}/${index}`);
|
|
6647
6648
|
}
|
|
6648
6649
|
} else {
|
|
6649
6650
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -6654,13 +6655,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
6654
6655
|
for (const resolver of resolvers) {
|
|
6655
6656
|
const resolved = await resolver($ref);
|
|
6656
6657
|
if (resolved) {
|
|
6657
|
-
result2 = await resolve(resolved,
|
|
6658
|
+
result2 = await resolve(resolved, path72);
|
|
6658
6659
|
break;
|
|
6659
6660
|
}
|
|
6660
6661
|
}
|
|
6661
6662
|
if (result2 === void 0) {
|
|
6662
6663
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
6663
|
-
result2 = await resolve(resolved,
|
|
6664
|
+
result2 = await resolve(resolved, path72);
|
|
6664
6665
|
}
|
|
6665
6666
|
if (hasSiblings) {
|
|
6666
6667
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -6673,7 +6674,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
6673
6674
|
return result2;
|
|
6674
6675
|
}
|
|
6675
6676
|
for (const key in current) {
|
|
6676
|
-
current[key] = await resolve(current[key], `${
|
|
6677
|
+
current[key] = await resolve(current[key], `${path72}/${key}`);
|
|
6677
6678
|
}
|
|
6678
6679
|
}
|
|
6679
6680
|
visited.delete(current);
|
|
@@ -6712,9 +6713,9 @@ var upgradeSchema = (schema2) => {
|
|
|
6712
6713
|
}
|
|
6713
6714
|
return sub;
|
|
6714
6715
|
});
|
|
6715
|
-
schema2 = traverse(schema2, (sub,
|
|
6716
|
+
schema2 = traverse(schema2, (sub, path72) => {
|
|
6716
6717
|
if (sub.example !== void 0) {
|
|
6717
|
-
if (isSchemaPath(
|
|
6718
|
+
if (isSchemaPath(path72 ?? [])) {
|
|
6718
6719
|
sub.examples = [sub.example];
|
|
6719
6720
|
} else {
|
|
6720
6721
|
sub.examples = {
|
|
@@ -6727,11 +6728,11 @@ var upgradeSchema = (schema2) => {
|
|
|
6727
6728
|
}
|
|
6728
6729
|
return sub;
|
|
6729
6730
|
});
|
|
6730
|
-
schema2 = traverse(schema2, (schema3,
|
|
6731
|
+
schema2 = traverse(schema2, (schema3, path72) => {
|
|
6731
6732
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
6732
|
-
const parentPath =
|
|
6733
|
+
const parentPath = path72?.slice(0, -1);
|
|
6733
6734
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
6734
|
-
return segment === "content" &&
|
|
6735
|
+
return segment === "content" && path72?.[index + 1] === "multipart/form-data";
|
|
6735
6736
|
});
|
|
6736
6737
|
if (isMultipart) {
|
|
6737
6738
|
const entries = Object.entries(schema3.properties);
|
|
@@ -6745,8 +6746,8 @@ var upgradeSchema = (schema2) => {
|
|
|
6745
6746
|
}
|
|
6746
6747
|
return schema3;
|
|
6747
6748
|
});
|
|
6748
|
-
schema2 = traverse(schema2, (schema3,
|
|
6749
|
-
if (
|
|
6749
|
+
schema2 = traverse(schema2, (schema3, path72) => {
|
|
6750
|
+
if (path72?.includes("content") && path72.includes("application/octet-stream")) {
|
|
6750
6751
|
return {};
|
|
6751
6752
|
}
|
|
6752
6753
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -6772,11 +6773,11 @@ var upgradeSchema = (schema2) => {
|
|
|
6772
6773
|
}
|
|
6773
6774
|
return sub;
|
|
6774
6775
|
});
|
|
6775
|
-
schema2 = traverse(schema2, (schema3,
|
|
6776
|
+
schema2 = traverse(schema2, (schema3, path72) => {
|
|
6776
6777
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
6777
|
-
const parentPath =
|
|
6778
|
+
const parentPath = path72?.slice(0, -1);
|
|
6778
6779
|
const contentMediaType = parentPath?.find(
|
|
6779
|
-
(_, index) =>
|
|
6780
|
+
(_, index) => path72?.[index - 1] === "content"
|
|
6780
6781
|
);
|
|
6781
6782
|
return {
|
|
6782
6783
|
type: "string",
|
|
@@ -6788,7 +6789,7 @@ var upgradeSchema = (schema2) => {
|
|
|
6788
6789
|
});
|
|
6789
6790
|
return schema2;
|
|
6790
6791
|
};
|
|
6791
|
-
function isSchemaPath(
|
|
6792
|
+
function isSchemaPath(path72) {
|
|
6792
6793
|
const schemaLocations = [
|
|
6793
6794
|
["components", "schemas"],
|
|
6794
6795
|
"properties",
|
|
@@ -6801,10 +6802,10 @@ function isSchemaPath(path71) {
|
|
|
6801
6802
|
];
|
|
6802
6803
|
return schemaLocations.some((location) => {
|
|
6803
6804
|
if (Array.isArray(location)) {
|
|
6804
|
-
return location.every((segment, index) =>
|
|
6805
|
+
return location.every((segment, index) => path72[index] === segment);
|
|
6805
6806
|
}
|
|
6806
|
-
return
|
|
6807
|
-
}) ||
|
|
6807
|
+
return path72.includes(location);
|
|
6808
|
+
}) || path72.includes("schema") || path72.some((segment) => segment.endsWith("Schema"));
|
|
6808
6809
|
}
|
|
6809
6810
|
|
|
6810
6811
|
// src/lib/oas/parser/index.ts
|
|
@@ -6886,13 +6887,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
6886
6887
|
"anyOf",
|
|
6887
6888
|
"oneOf"
|
|
6888
6889
|
]);
|
|
6889
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
6890
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path72 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
6890
6891
|
if (obj === null || typeof obj !== "object") return obj;
|
|
6891
6892
|
const refPath = obj.__$ref;
|
|
6892
6893
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
6893
6894
|
if (isCircular) {
|
|
6894
6895
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
6895
|
-
const circularProp =
|
|
6896
|
+
const circularProp = path72.find((p) => !OPENAPI_PROPS.has(p)) || path72[0];
|
|
6896
6897
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
6897
6898
|
}
|
|
6898
6899
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -6902,7 +6903,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
6902
6903
|
value,
|
|
6903
6904
|
currentPath,
|
|
6904
6905
|
refs,
|
|
6905
|
-
[...
|
|
6906
|
+
[...path72, key],
|
|
6906
6907
|
currentRefPaths
|
|
6907
6908
|
);
|
|
6908
6909
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -6937,7 +6938,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
6937
6938
|
var getAllTags = (schema2) => {
|
|
6938
6939
|
const rootTags = schema2.tags ?? [];
|
|
6939
6940
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
6940
|
-
(
|
|
6941
|
+
(path72) => HttpMethods.map((k) => path72?.[k]).filter((op) => op != null)
|
|
6941
6942
|
);
|
|
6942
6943
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
6943
6944
|
const hasUntaggedOperations = operations.some(
|
|
@@ -6992,7 +6993,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
6992
6993
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
6993
6994
|
var getAllOperations = (paths) => {
|
|
6994
6995
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
6995
|
-
([
|
|
6996
|
+
([path72, value]) => HttpMethods.flatMap((method) => {
|
|
6996
6997
|
if (!value?.[method]) return [];
|
|
6997
6998
|
const operation = value[method];
|
|
6998
6999
|
const pathParameters = value.parameters ?? [];
|
|
@@ -7012,7 +7013,7 @@ var getAllOperations = (paths) => {
|
|
|
7012
7013
|
return {
|
|
7013
7014
|
...operation,
|
|
7014
7015
|
method,
|
|
7015
|
-
path:
|
|
7016
|
+
path: path72,
|
|
7016
7017
|
parameters,
|
|
7017
7018
|
servers,
|
|
7018
7019
|
tags: operation.tags ?? []
|
|
@@ -7370,8 +7371,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
7370
7371
|
}),
|
|
7371
7372
|
paths: t.field({
|
|
7372
7373
|
type: [PathItem],
|
|
7373
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
7374
|
-
path:
|
|
7374
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path72, value]) => ({
|
|
7375
|
+
path: path72,
|
|
7375
7376
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
7376
7377
|
methods: Object.keys(value)
|
|
7377
7378
|
}))
|
|
@@ -7468,13 +7469,13 @@ function injectApitogoGatewayServer(options) {
|
|
|
7468
7469
|
if (process.env[options?.disableEnv ?? "APITOGO_PUBLIC_DISABLE_INJECT_GATEWAY"]) {
|
|
7469
7470
|
return schema2;
|
|
7470
7471
|
}
|
|
7471
|
-
const
|
|
7472
|
-
if (!
|
|
7472
|
+
const url2 = (options?.gatewayUrl ?? process.env[APITOGO_GATEWAY_URL_ENV])?.trim();
|
|
7473
|
+
if (!url2) {
|
|
7473
7474
|
return schema2;
|
|
7474
7475
|
}
|
|
7475
7476
|
return {
|
|
7476
7477
|
...schema2,
|
|
7477
|
-
servers: [{ url:
|
|
7478
|
+
servers: [{ url: url2.replace(/\/+$/, ""), description: "API gateway" }]
|
|
7478
7479
|
};
|
|
7479
7480
|
};
|
|
7480
7481
|
}
|
|
@@ -7536,7 +7537,7 @@ init_joinUrl();
|
|
|
7536
7537
|
|
|
7537
7538
|
// src/vite/api/schema-codegen.ts
|
|
7538
7539
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
7539
|
-
var getSegmentsFromPath = (
|
|
7540
|
+
var getSegmentsFromPath = (path72) => path72.split("/").slice(1).map(unescapeJsonPointer);
|
|
7540
7541
|
var createLocalRefMap = (obj) => {
|
|
7541
7542
|
const refMap = /* @__PURE__ */ new Map();
|
|
7542
7543
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -7567,16 +7568,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
7567
7568
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
7568
7569
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
7569
7570
|
);
|
|
7570
|
-
var lookup = (schema2,
|
|
7571
|
-
const parts = getSegmentsFromPath(
|
|
7571
|
+
var lookup = (schema2, path72, filePath) => {
|
|
7572
|
+
const parts = getSegmentsFromPath(path72);
|
|
7572
7573
|
let val = schema2;
|
|
7573
7574
|
for (const part of parts) {
|
|
7574
7575
|
while (val.$ref?.startsWith("#/")) {
|
|
7575
|
-
val = val.$ref ===
|
|
7576
|
+
val = val.$ref === path72 ? val : lookup(schema2, val.$ref, filePath);
|
|
7576
7577
|
}
|
|
7577
7578
|
if (val[part] === void 0) {
|
|
7578
7579
|
throw new Error(
|
|
7579
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
7580
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path72}`
|
|
7580
7581
|
);
|
|
7581
7582
|
}
|
|
7582
7583
|
val = val[part];
|
|
@@ -7821,8 +7822,8 @@ var SchemaManager = class {
|
|
|
7821
7822
|
}
|
|
7822
7823
|
}
|
|
7823
7824
|
};
|
|
7824
|
-
getLatestSchema = (
|
|
7825
|
-
getSchemasForPath = (
|
|
7825
|
+
getLatestSchema = (path72) => this.processedSchemas[path72]?.at(0);
|
|
7826
|
+
getSchemasForPath = (path72) => this.processedSchemas[path72];
|
|
7826
7827
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
7827
7828
|
getUrlToFilePathMap = () => {
|
|
7828
7829
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -10258,11 +10259,11 @@ async function generateSitemap({
|
|
|
10258
10259
|
lastmod = (/* @__PURE__ */ new Date()).toISOString();
|
|
10259
10260
|
}
|
|
10260
10261
|
const exclude = (typeof config2.exclude === "function" ? await config2.exclude() : config2.exclude) ?? [];
|
|
10261
|
-
for (const
|
|
10262
|
-
const shouldExclude = exclude.includes(
|
|
10262
|
+
for (const url2 of outputUrls) {
|
|
10263
|
+
const shouldExclude = exclude.includes(url2) || url2.includes("*") || /(400|404|500)$/.test(url2) || redirectUrls.has(url2);
|
|
10263
10264
|
if (shouldExclude) continue;
|
|
10264
10265
|
sitemap.write({
|
|
10265
|
-
url: new URL(joinUrl(basePath,
|
|
10266
|
+
url: new URL(joinUrl(basePath, url2), config2.siteUrl).toString(),
|
|
10266
10267
|
lastmod,
|
|
10267
10268
|
changefreq: config2.changefreq ?? "daily",
|
|
10268
10269
|
priority: config2.priority ?? 0.7
|
|
@@ -10280,14 +10281,14 @@ async function generateSitemap({
|
|
|
10280
10281
|
|
|
10281
10282
|
// src/vite/prerender/utils.ts
|
|
10282
10283
|
init_joinUrl();
|
|
10283
|
-
var resolveRoutePath = (
|
|
10284
|
-
const segments =
|
|
10284
|
+
var resolveRoutePath = (path72) => {
|
|
10285
|
+
const segments = path72.split("/");
|
|
10285
10286
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
10286
10287
|
return void 0;
|
|
10287
10288
|
}
|
|
10288
10289
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
10289
10290
|
};
|
|
10290
|
-
var isSkipped = (
|
|
10291
|
+
var isSkipped = (path72) => path72.includes("*") || /^\d+$/.test(path72);
|
|
10291
10292
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
10292
10293
|
if (route.path && isSkipped(route.path)) return [];
|
|
10293
10294
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -10751,7 +10752,7 @@ var build_default = {
|
|
|
10751
10752
|
};
|
|
10752
10753
|
|
|
10753
10754
|
// src/cli/check/handler.ts
|
|
10754
|
-
import
|
|
10755
|
+
import path41 from "node:path";
|
|
10755
10756
|
|
|
10756
10757
|
// src/cli/platform/client/platform-api.ts
|
|
10757
10758
|
import { basename } from "node:path";
|
|
@@ -10917,8 +10918,8 @@ var PlatformApiClient = class {
|
|
|
10917
10918
|
constructor(config2) {
|
|
10918
10919
|
this.config = config2;
|
|
10919
10920
|
}
|
|
10920
|
-
url(
|
|
10921
|
-
return `${this.config.apiUrl}${
|
|
10921
|
+
url(path72) {
|
|
10922
|
+
return `${this.config.apiUrl}${path72.startsWith("/") ? path72 : `/${path72}`}`;
|
|
10922
10923
|
}
|
|
10923
10924
|
headers(extra) {
|
|
10924
10925
|
return {
|
|
@@ -10928,13 +10929,15 @@ var PlatformApiClient = class {
|
|
|
10928
10929
|
...extra
|
|
10929
10930
|
};
|
|
10930
10931
|
}
|
|
10931
|
-
async request(method,
|
|
10932
|
+
async request(method, path72, init4) {
|
|
10932
10933
|
const response = await fetchWithRetry(
|
|
10933
|
-
this.url(
|
|
10934
|
+
this.url(path72),
|
|
10934
10935
|
{
|
|
10935
10936
|
method,
|
|
10936
10937
|
...init4,
|
|
10937
|
-
headers: this.headers(
|
|
10938
|
+
headers: this.headers(
|
|
10939
|
+
init4?.headers
|
|
10940
|
+
)
|
|
10938
10941
|
},
|
|
10939
10942
|
{
|
|
10940
10943
|
method,
|
|
@@ -10973,7 +10976,10 @@ var PlatformApiClient = class {
|
|
|
10973
10976
|
});
|
|
10974
10977
|
}
|
|
10975
10978
|
deleteProject(projectId) {
|
|
10976
|
-
return this.request(
|
|
10979
|
+
return this.request(
|
|
10980
|
+
"DELETE",
|
|
10981
|
+
`/api/v1/projects/${projectId}`
|
|
10982
|
+
);
|
|
10977
10983
|
}
|
|
10978
10984
|
getSubscription(projectId) {
|
|
10979
10985
|
return this.request(
|
|
@@ -10982,7 +10988,10 @@ var PlatformApiClient = class {
|
|
|
10982
10988
|
);
|
|
10983
10989
|
}
|
|
10984
10990
|
selectFreePlan(projectId) {
|
|
10985
|
-
return this.request(
|
|
10991
|
+
return this.request(
|
|
10992
|
+
"POST",
|
|
10993
|
+
`/api/v1/projects/${projectId}/subscription/free`
|
|
10994
|
+
);
|
|
10986
10995
|
}
|
|
10987
10996
|
createCheckoutSession(projectId, body) {
|
|
10988
10997
|
return this.request(
|
|
@@ -11061,7 +11070,11 @@ var PlatformApiClient = class {
|
|
|
11061
11070
|
headers: this.headers(),
|
|
11062
11071
|
body: form
|
|
11063
11072
|
},
|
|
11064
|
-
{
|
|
11073
|
+
{
|
|
11074
|
+
method: "PUT",
|
|
11075
|
+
maxRetries: MAX_RETRIES,
|
|
11076
|
+
retryMutatingOnServerError: true
|
|
11077
|
+
}
|
|
11065
11078
|
);
|
|
11066
11079
|
if (!response.ok) {
|
|
11067
11080
|
throw await parseErrorResponse(response);
|
|
@@ -11130,15 +11143,15 @@ var PlatformApiClient = class {
|
|
|
11130
11143
|
}
|
|
11131
11144
|
);
|
|
11132
11145
|
}
|
|
11133
|
-
deleteDevPortalPage(projectId,
|
|
11134
|
-
const query = new URLSearchParams({ path:
|
|
11146
|
+
deleteDevPortalPage(projectId, path72) {
|
|
11147
|
+
const query = new URLSearchParams({ path: path72 });
|
|
11135
11148
|
return this.request(
|
|
11136
11149
|
"DELETE",
|
|
11137
11150
|
`/api/v1/projects/${projectId}/dev-portal/pages/files?${query.toString()}`
|
|
11138
11151
|
);
|
|
11139
11152
|
}
|
|
11140
|
-
renameDevPortalPage(projectId,
|
|
11141
|
-
const query = new URLSearchParams({ path:
|
|
11153
|
+
renameDevPortalPage(projectId, path72, newName) {
|
|
11154
|
+
const query = new URLSearchParams({ path: path72 });
|
|
11142
11155
|
return this.request(
|
|
11143
11156
|
"POST",
|
|
11144
11157
|
`/api/v1/projects/${projectId}/dev-portal/pages/files/rename?${query.toString()}`,
|
|
@@ -11171,7 +11184,10 @@ var PlatformApiClient = class {
|
|
|
11171
11184
|
);
|
|
11172
11185
|
}
|
|
11173
11186
|
getBackendSummary(projectId) {
|
|
11174
|
-
return this.request(
|
|
11187
|
+
return this.request(
|
|
11188
|
+
"GET",
|
|
11189
|
+
`/api/v1/projects/${projectId}/backend`
|
|
11190
|
+
);
|
|
11175
11191
|
}
|
|
11176
11192
|
getDeploymentStatus(projectId, deploymentId) {
|
|
11177
11193
|
return this.request(
|
|
@@ -11182,21 +11198,34 @@ var PlatformApiClient = class {
|
|
|
11182
11198
|
async deployBackend(projectId, options) {
|
|
11183
11199
|
const form = new FormData();
|
|
11184
11200
|
const archiveBytes = await readFileBytes(options.archivePath);
|
|
11185
|
-
form.append(
|
|
11201
|
+
form.append(
|
|
11202
|
+
"archive",
|
|
11203
|
+
new Blob([archiveBytes]),
|
|
11204
|
+
basename(options.archivePath)
|
|
11205
|
+
);
|
|
11186
11206
|
form.append("runtime", options.runtime);
|
|
11187
11207
|
form.append("runtimeVersion", options.runtimeVersion);
|
|
11188
|
-
if (options.startupCommand)
|
|
11189
|
-
|
|
11208
|
+
if (options.startupCommand)
|
|
11209
|
+
form.append("startupCommand", options.startupCommand);
|
|
11210
|
+
if (options.healthCheckPath)
|
|
11211
|
+
form.append("healthCheckPath", options.healthCheckPath);
|
|
11190
11212
|
if (options.forceRedeploy) form.append("forceRedeploy", "true");
|
|
11191
11213
|
if (options.environmentVariables) {
|
|
11192
|
-
form.append(
|
|
11214
|
+
form.append(
|
|
11215
|
+
"environmentVariables",
|
|
11216
|
+
JSON.stringify(options.environmentVariables)
|
|
11217
|
+
);
|
|
11193
11218
|
}
|
|
11194
11219
|
if (options.secrets) {
|
|
11195
11220
|
form.append("secrets", JSON.stringify(options.secrets));
|
|
11196
11221
|
}
|
|
11197
11222
|
if (options.openApiPath) {
|
|
11198
11223
|
const openApiBytes = await readFileBytes(options.openApiPath);
|
|
11199
|
-
form.append(
|
|
11224
|
+
form.append(
|
|
11225
|
+
"openapi",
|
|
11226
|
+
new Blob([openApiBytes]),
|
|
11227
|
+
basename(options.openApiPath)
|
|
11228
|
+
);
|
|
11200
11229
|
}
|
|
11201
11230
|
const response = await fetchWithRetry(
|
|
11202
11231
|
this.url(`/api/v1/projects/${projectId}/backend/deployments`),
|
|
@@ -11218,13 +11247,20 @@ var PlatformApiClient = class {
|
|
|
11218
11247
|
return await response.json();
|
|
11219
11248
|
}
|
|
11220
11249
|
listGatewayPlans(projectId) {
|
|
11221
|
-
return this.request(
|
|
11250
|
+
return this.request(
|
|
11251
|
+
"GET",
|
|
11252
|
+
`/api/v1/projects/${projectId}/gateway/plans`
|
|
11253
|
+
);
|
|
11222
11254
|
}
|
|
11223
11255
|
createGatewayPlan(projectId, body) {
|
|
11224
|
-
return this.request(
|
|
11225
|
-
|
|
11226
|
-
|
|
11227
|
-
|
|
11256
|
+
return this.request(
|
|
11257
|
+
"POST",
|
|
11258
|
+
`/api/v1/projects/${projectId}/gateway/plans`,
|
|
11259
|
+
{
|
|
11260
|
+
headers: { "Content-Type": "application/json" },
|
|
11261
|
+
body: JSON.stringify(body)
|
|
11262
|
+
}
|
|
11263
|
+
);
|
|
11228
11264
|
}
|
|
11229
11265
|
getGatewayPlan(projectId, planId) {
|
|
11230
11266
|
return this.request(
|
|
@@ -11249,13 +11285,20 @@ var PlatformApiClient = class {
|
|
|
11249
11285
|
);
|
|
11250
11286
|
}
|
|
11251
11287
|
getGatewayAuth(projectId) {
|
|
11252
|
-
return this.request(
|
|
11288
|
+
return this.request(
|
|
11289
|
+
"GET",
|
|
11290
|
+
`/api/v1/projects/${projectId}/gateway/auth`
|
|
11291
|
+
);
|
|
11253
11292
|
}
|
|
11254
11293
|
updateGatewayAuth(projectId, body) {
|
|
11255
|
-
return this.request(
|
|
11256
|
-
|
|
11257
|
-
|
|
11258
|
-
|
|
11294
|
+
return this.request(
|
|
11295
|
+
"PUT",
|
|
11296
|
+
`/api/v1/projects/${projectId}/gateway/auth`,
|
|
11297
|
+
{
|
|
11298
|
+
headers: { "Content-Type": "application/json" },
|
|
11299
|
+
body: JSON.stringify(body)
|
|
11300
|
+
}
|
|
11301
|
+
);
|
|
11259
11302
|
}
|
|
11260
11303
|
getGatewaySettings(projectId) {
|
|
11261
11304
|
return this.request(
|
|
@@ -11294,6 +11337,12 @@ var PlatformApiClient = class {
|
|
|
11294
11337
|
}
|
|
11295
11338
|
);
|
|
11296
11339
|
}
|
|
11340
|
+
deletePlatformApiKey(publicKeyId) {
|
|
11341
|
+
return this.request(
|
|
11342
|
+
"DELETE",
|
|
11343
|
+
`/api/v1/account/platform-api-keys/${publicKeyId}`
|
|
11344
|
+
);
|
|
11345
|
+
}
|
|
11297
11346
|
upsertGatewayEntitlement(projectId, idempotencyKey, body) {
|
|
11298
11347
|
return this.request(
|
|
11299
11348
|
"POST",
|
|
@@ -11319,6 +11368,42 @@ function isNotFoundError(error) {
|
|
|
11319
11368
|
return error instanceof PlatformApiError && error.status === 404;
|
|
11320
11369
|
}
|
|
11321
11370
|
|
|
11371
|
+
// src/cli/platform/credentials-store.ts
|
|
11372
|
+
import fs4 from "node:fs";
|
|
11373
|
+
import path35 from "node:path";
|
|
11374
|
+
var CREDENTIALS_FILE = path35.join(
|
|
11375
|
+
ZUDOKU_XDG_CONFIG_HOME,
|
|
11376
|
+
"credentials.json"
|
|
11377
|
+
);
|
|
11378
|
+
function readStoredCredentials() {
|
|
11379
|
+
try {
|
|
11380
|
+
const raw = fs4.readFileSync(CREDENTIALS_FILE, "utf-8");
|
|
11381
|
+
const parsed = JSON.parse(raw);
|
|
11382
|
+
if (typeof parsed.apiUrl !== "string" || typeof parsed.apiKeyId !== "string" || typeof parsed.apiSecret !== "string") {
|
|
11383
|
+
return void 0;
|
|
11384
|
+
}
|
|
11385
|
+
return {
|
|
11386
|
+
apiUrl: parsed.apiUrl,
|
|
11387
|
+
apiKeyId: parsed.apiKeyId,
|
|
11388
|
+
apiSecret: parsed.apiSecret
|
|
11389
|
+
};
|
|
11390
|
+
} catch {
|
|
11391
|
+
return void 0;
|
|
11392
|
+
}
|
|
11393
|
+
}
|
|
11394
|
+
function writeStoredCredentials(creds) {
|
|
11395
|
+
fs4.mkdirSync(path35.dirname(CREDENTIALS_FILE), { recursive: true });
|
|
11396
|
+
fs4.writeFileSync(CREDENTIALS_FILE, JSON.stringify(creds, null, 2), {
|
|
11397
|
+
mode: 384
|
|
11398
|
+
});
|
|
11399
|
+
}
|
|
11400
|
+
function clearStoredCredentials() {
|
|
11401
|
+
try {
|
|
11402
|
+
fs4.unlinkSync(CREDENTIALS_FILE);
|
|
11403
|
+
} catch {
|
|
11404
|
+
}
|
|
11405
|
+
}
|
|
11406
|
+
|
|
11322
11407
|
// src/cli/platform/config.ts
|
|
11323
11408
|
var DEFAULT_API_URL = "https://api.apitogo.com";
|
|
11324
11409
|
var DEFAULT_DEV_PORTAL_DEPLOY_URL = "https://deploy-server-dotnet2-b3fkcaaraydbckfe.canadacentral-01.azurewebsites.net/deploy";
|
|
@@ -11326,14 +11411,29 @@ var DEFAULT_DEV_PORTAL_DEPLOY_API_KEY = "qRVLTP22TFStdN6";
|
|
|
11326
11411
|
var DEFAULT_DEV_PORTAL_DEPLOY_ENV = "production";
|
|
11327
11412
|
var DEFAULT_CREATE_APITOGO_PACKAGE = "@lukoweb/create-apitogo@latest";
|
|
11328
11413
|
function loadConfig() {
|
|
11329
|
-
const
|
|
11330
|
-
const
|
|
11331
|
-
const
|
|
11332
|
-
|
|
11333
|
-
|
|
11414
|
+
const envApiKeyId = process.env.APITOGO_API_KEY_ID?.trim();
|
|
11415
|
+
const envApiSecret = process.env.APITOGO_API_SECRET?.trim();
|
|
11416
|
+
const explicitApiUrl = process.env.APITOGO_API_URL?.trim();
|
|
11417
|
+
let apiUrl;
|
|
11418
|
+
let apiKeyId;
|
|
11419
|
+
let apiSecret;
|
|
11420
|
+
if (envApiKeyId && envApiSecret) {
|
|
11421
|
+
apiUrl = (explicitApiUrl ?? DEFAULT_API_URL).replace(/\/+$/, "");
|
|
11422
|
+
apiKeyId = envApiKeyId;
|
|
11423
|
+
apiSecret = envApiSecret;
|
|
11424
|
+
} else {
|
|
11425
|
+
const stored = readStoredCredentials();
|
|
11426
|
+
apiUrl = (explicitApiUrl ?? stored?.apiUrl ?? DEFAULT_API_URL).replace(
|
|
11427
|
+
/\/+$/,
|
|
11428
|
+
""
|
|
11429
|
+
);
|
|
11430
|
+
apiKeyId = stored?.apiKeyId;
|
|
11431
|
+
apiSecret = stored?.apiSecret;
|
|
11334
11432
|
}
|
|
11335
|
-
if (!apiSecret) {
|
|
11336
|
-
throw new Error(
|
|
11433
|
+
if (!apiKeyId || !apiSecret) {
|
|
11434
|
+
throw new Error(
|
|
11435
|
+
"No credentials found. Run `apitogo login`, or set APITOGO_API_KEY_ID and APITOGO_API_SECRET for CI."
|
|
11436
|
+
);
|
|
11337
11437
|
}
|
|
11338
11438
|
const defaultProjectId = process.env.APITOGO_DEFAULT_PROJECT_ID?.trim() || void 0;
|
|
11339
11439
|
const devPortalDeployUrl = process.env.APITOGO_DEV_PORTAL_DEPLOY_URL?.trim() || process.env.APITOGO_DOC_DEPLOY_URL?.trim() || DEFAULT_DEV_PORTAL_DEPLOY_URL;
|
|
@@ -11375,7 +11475,7 @@ function resolveDevPortalDeployConfig(config2) {
|
|
|
11375
11475
|
}
|
|
11376
11476
|
|
|
11377
11477
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
11378
|
-
import
|
|
11478
|
+
import path40 from "node:path";
|
|
11379
11479
|
|
|
11380
11480
|
// src/cli/platform/helpers/dev-portal-backend.ts
|
|
11381
11481
|
function deriveProvisioningState(backend) {
|
|
@@ -11459,7 +11559,7 @@ function formatDevPortalBackendResponse(projectId, backend) {
|
|
|
11459
11559
|
// src/cli/platform/helpers/dev-portal-manifest.ts
|
|
11460
11560
|
import { existsSync as existsSync4 } from "node:fs";
|
|
11461
11561
|
import { access, mkdir as mkdir6, readFile as readFile6, writeFile as writeFile7 } from "node:fs/promises";
|
|
11462
|
-
import
|
|
11562
|
+
import path36 from "node:path";
|
|
11463
11563
|
|
|
11464
11564
|
// src/cli/make-config/header-pricing-nav.ts
|
|
11465
11565
|
var HEADER_PRICING_PATH = "/pricing";
|
|
@@ -11519,7 +11619,7 @@ function isPlanFree(plan) {
|
|
|
11519
11619
|
return (plan.priceAmount ?? 0) <= 0;
|
|
11520
11620
|
}
|
|
11521
11621
|
function manifestFilePath(siteDirectory) {
|
|
11522
|
-
return
|
|
11622
|
+
return path36.join(path36.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
|
|
11523
11623
|
}
|
|
11524
11624
|
var STORED_MANIFEST_KEYS = [
|
|
11525
11625
|
"authentication",
|
|
@@ -11959,8 +12059,6 @@ function applyScaffoldManifestPolicy(manifest, options) {
|
|
|
11959
12059
|
if (options.includeDefaultPlans) {
|
|
11960
12060
|
result.plans = mergePlansBySku2(result.plans, DEFAULT_PLANS);
|
|
11961
12061
|
result.pricing = { enabled: true };
|
|
11962
|
-
} else {
|
|
11963
|
-
delete result.plans;
|
|
11964
12062
|
}
|
|
11965
12063
|
return result;
|
|
11966
12064
|
}
|
|
@@ -11980,16 +12078,16 @@ function resolveBackendOpenApiPath(openApiPath, options) {
|
|
|
11980
12078
|
if (!trimmed) {
|
|
11981
12079
|
return void 0;
|
|
11982
12080
|
}
|
|
11983
|
-
if (
|
|
12081
|
+
if (path36.isAbsolute(trimmed)) {
|
|
11984
12082
|
return trimmed;
|
|
11985
12083
|
}
|
|
11986
|
-
const siteResolved =
|
|
12084
|
+
const siteResolved = path36.resolve(options.siteDirectory, trimmed);
|
|
11987
12085
|
if (existsSync4(siteResolved)) {
|
|
11988
12086
|
return siteResolved;
|
|
11989
12087
|
}
|
|
11990
12088
|
const backendDir = options.backendSourceDirectory?.trim();
|
|
11991
12089
|
if (backendDir) {
|
|
11992
|
-
const backendResolved =
|
|
12090
|
+
const backendResolved = path36.resolve(backendDir, trimmed);
|
|
11993
12091
|
if (existsSync4(backendResolved)) {
|
|
11994
12092
|
return backendResolved;
|
|
11995
12093
|
}
|
|
@@ -11997,12 +12095,12 @@ function resolveBackendOpenApiPath(openApiPath, options) {
|
|
|
11997
12095
|
return siteResolved;
|
|
11998
12096
|
}
|
|
11999
12097
|
function toSiteRelativeOpenApiInput(siteDirectory, openApiAbsolutePath) {
|
|
12000
|
-
const relative =
|
|
12001
|
-
const posix = relative.split(
|
|
12098
|
+
const relative = path36.relative(path36.resolve(siteDirectory), path36.resolve(openApiAbsolutePath));
|
|
12099
|
+
const posix = relative.split(path36.sep).join("/");
|
|
12002
12100
|
if (!posix || posix === ".") {
|
|
12003
12101
|
return "./";
|
|
12004
12102
|
}
|
|
12005
|
-
if (
|
|
12103
|
+
if (path36.isAbsolute(posix) || posix.startsWith("..")) {
|
|
12006
12104
|
return posix;
|
|
12007
12105
|
}
|
|
12008
12106
|
return posix.startsWith("./") ? posix : `./${posix}`;
|
|
@@ -12049,7 +12147,7 @@ async function readManifest(siteDirectory) {
|
|
|
12049
12147
|
}
|
|
12050
12148
|
async function writeManifest(siteDirectory, manifest) {
|
|
12051
12149
|
const filePath = manifestFilePath(siteDirectory);
|
|
12052
|
-
await mkdir6(
|
|
12150
|
+
await mkdir6(path36.dirname(filePath), { recursive: true });
|
|
12053
12151
|
let config2 = {};
|
|
12054
12152
|
if (await pathExists(filePath)) {
|
|
12055
12153
|
const raw = await readFile6(filePath, "utf8");
|
|
@@ -12064,7 +12162,7 @@ async function writeManifest(siteDirectory, manifest) {
|
|
|
12064
12162
|
|
|
12065
12163
|
// src/cli/platform/helpers/dev-portal-secrets.ts
|
|
12066
12164
|
import { access as access2, appendFile, mkdir as mkdir7, readFile as readFile7, unlink, writeFile as writeFile8 } from "node:fs/promises";
|
|
12067
|
-
import
|
|
12165
|
+
import path37 from "node:path";
|
|
12068
12166
|
var ENV_FILENAME = ".env";
|
|
12069
12167
|
var COLLAPSED_UPPERCASE_ALIASES2 = {
|
|
12070
12168
|
SECRETKEY: "secretKey",
|
|
@@ -12183,10 +12281,10 @@ async function readEnvFile(filePath) {
|
|
|
12183
12281
|
}
|
|
12184
12282
|
}
|
|
12185
12283
|
async function loadSiteEnv(siteDirectory) {
|
|
12186
|
-
const resolvedDirectory =
|
|
12284
|
+
const resolvedDirectory = path37.resolve(siteDirectory);
|
|
12187
12285
|
const merged = { ...process.env };
|
|
12188
12286
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
12189
|
-
Object.assign(merged, await readEnvFile(
|
|
12287
|
+
Object.assign(merged, await readEnvFile(path37.join(resolvedDirectory, fileName)));
|
|
12190
12288
|
}
|
|
12191
12289
|
return merged;
|
|
12192
12290
|
}
|
|
@@ -12222,7 +12320,7 @@ function buildAuthSecretsJson(secrets, options) {
|
|
|
12222
12320
|
return payload;
|
|
12223
12321
|
}
|
|
12224
12322
|
function envFilePath(siteDirectory) {
|
|
12225
|
-
return
|
|
12323
|
+
return path37.join(path37.resolve(siteDirectory), ENV_FILENAME);
|
|
12226
12324
|
}
|
|
12227
12325
|
function createEnvContent() {
|
|
12228
12326
|
return [
|
|
@@ -12282,7 +12380,7 @@ function validateSecretsForPublish(manifest, secrets, emailOptions) {
|
|
|
12282
12380
|
}
|
|
12283
12381
|
async function siteEnvFileHasEntries(siteDirectory) {
|
|
12284
12382
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
12285
|
-
const loaded = await readEnvFile(
|
|
12383
|
+
const loaded = await readEnvFile(path37.join(siteDirectory, fileName));
|
|
12286
12384
|
if (Object.keys(loaded).length > 0) {
|
|
12287
12385
|
return true;
|
|
12288
12386
|
}
|
|
@@ -12290,7 +12388,7 @@ async function siteEnvFileHasEntries(siteDirectory) {
|
|
|
12290
12388
|
return false;
|
|
12291
12389
|
}
|
|
12292
12390
|
async function resolvePublishConfig(siteDirectory, emailOptions) {
|
|
12293
|
-
const resolvedDirectory =
|
|
12391
|
+
const resolvedDirectory = path37.resolve(siteDirectory);
|
|
12294
12392
|
const manifestRaw = await readManifest(resolvedDirectory);
|
|
12295
12393
|
if (!manifestRaw) {
|
|
12296
12394
|
throw new Error("apitogo.config.json not found in sourceDirectory.");
|
|
@@ -12319,7 +12417,7 @@ function envFileHasActiveAssignments(content) {
|
|
|
12319
12417
|
});
|
|
12320
12418
|
}
|
|
12321
12419
|
async function writeScaffoldEnv(siteDirectory) {
|
|
12322
|
-
const resolvedDirectory =
|
|
12420
|
+
const resolvedDirectory = path37.resolve(siteDirectory);
|
|
12323
12421
|
const filesWritten = [];
|
|
12324
12422
|
const envPath = envFilePath(resolvedDirectory);
|
|
12325
12423
|
try {
|
|
@@ -12330,7 +12428,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
12330
12428
|
filesWritten.push(ENV_FILENAME);
|
|
12331
12429
|
}
|
|
12332
12430
|
for (const legacyName of [".env.example"]) {
|
|
12333
|
-
const legacyPath =
|
|
12431
|
+
const legacyPath = path37.join(resolvedDirectory, legacyName);
|
|
12334
12432
|
try {
|
|
12335
12433
|
const legacy = await readFile7(legacyPath, "utf8");
|
|
12336
12434
|
if (!envFileHasActiveAssignments(legacy)) {
|
|
@@ -12340,7 +12438,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
12340
12438
|
} catch {
|
|
12341
12439
|
}
|
|
12342
12440
|
}
|
|
12343
|
-
const gitignorePath =
|
|
12441
|
+
const gitignorePath = path37.join(resolvedDirectory, ".gitignore");
|
|
12344
12442
|
let gitignore = "";
|
|
12345
12443
|
try {
|
|
12346
12444
|
gitignore = await readFile7(gitignorePath, "utf8");
|
|
@@ -12376,11 +12474,11 @@ var SECRETS_COLLECTION_INSTRUCTION = "For go-live, plans must already be in apit
|
|
|
12376
12474
|
// src/cli/platform/helpers/dev-portal-site-validation.ts
|
|
12377
12475
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
12378
12476
|
import { createRequire as createRequire2 } from "node:module";
|
|
12379
|
-
import
|
|
12477
|
+
import path38 from "node:path";
|
|
12380
12478
|
init_gateway_limits();
|
|
12381
12479
|
var cachedFallbackTs;
|
|
12382
12480
|
async function loadTypeScriptForSite(sourceDirectory) {
|
|
12383
|
-
const require2 = createRequire2(
|
|
12481
|
+
const require2 = createRequire2(path38.join(path38.resolve(sourceDirectory), "package.json"));
|
|
12384
12482
|
try {
|
|
12385
12483
|
return require2("typescript");
|
|
12386
12484
|
} catch {
|
|
@@ -12424,7 +12522,7 @@ async function referencedFileExists(sourceDirectory, reference) {
|
|
|
12424
12522
|
if (/^https?:\/\//i.test(reference)) {
|
|
12425
12523
|
return true;
|
|
12426
12524
|
}
|
|
12427
|
-
return pathExists(
|
|
12525
|
+
return pathExists(path38.resolve(sourceDirectory, reference.replace(/^\.\//, "")));
|
|
12428
12526
|
}
|
|
12429
12527
|
async function validateSiteConfigStructure(config2, sourceDirectory) {
|
|
12430
12528
|
const errors = [];
|
|
@@ -12530,11 +12628,11 @@ var DEFAULT_TSX_CANDIDATES = [
|
|
|
12530
12628
|
"landing/LandingPage.tsx"
|
|
12531
12629
|
];
|
|
12532
12630
|
async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
12533
|
-
const resolvedDir =
|
|
12631
|
+
const resolvedDir = path38.resolve(sourceDirectory);
|
|
12534
12632
|
const issues = [];
|
|
12535
12633
|
const checkedFiles = [];
|
|
12536
12634
|
const skippedChecks = [];
|
|
12537
|
-
const jsonPath =
|
|
12635
|
+
const jsonPath = path38.join(resolvedDir, APITOGO_CONFIG_FILENAME2);
|
|
12538
12636
|
if (await pathExists(jsonPath)) {
|
|
12539
12637
|
checkedFiles.push(APITOGO_CONFIG_FILENAME2);
|
|
12540
12638
|
let parsed;
|
|
@@ -12563,7 +12661,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
12563
12661
|
);
|
|
12564
12662
|
const existingTsxFiles = [];
|
|
12565
12663
|
for (const relativeFile of tsxFiles) {
|
|
12566
|
-
if (await pathExists(
|
|
12664
|
+
if (await pathExists(path38.join(resolvedDir, relativeFile))) {
|
|
12567
12665
|
existingTsxFiles.push(relativeFile);
|
|
12568
12666
|
}
|
|
12569
12667
|
}
|
|
@@ -12576,7 +12674,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
12576
12674
|
} else {
|
|
12577
12675
|
for (const relativeFile of existingTsxFiles) {
|
|
12578
12676
|
checkedFiles.push(relativeFile);
|
|
12579
|
-
const content = await readFile8(
|
|
12677
|
+
const content = await readFile8(path38.join(resolvedDir, relativeFile), "utf8");
|
|
12580
12678
|
issues.push(
|
|
12581
12679
|
...checkTsxSyntax(ts, relativeFile, content).map((message) => ({
|
|
12582
12680
|
file: relativeFile,
|
|
@@ -12612,7 +12710,7 @@ function buildSiteValidationResponseFields(result) {
|
|
|
12612
12710
|
// src/cli/platform/helpers/npm-build.ts
|
|
12613
12711
|
import { spawn } from "node:child_process";
|
|
12614
12712
|
import { access as access3, readFile as readFile9 } from "node:fs/promises";
|
|
12615
|
-
import
|
|
12713
|
+
import path39 from "node:path";
|
|
12616
12714
|
var BUILD_LOG_TAIL_BYTES = 8192;
|
|
12617
12715
|
var MIN_NODE_MAJOR = 20;
|
|
12618
12716
|
var NpmBuildError = class extends Error {
|
|
@@ -12677,13 +12775,13 @@ function runCommand(command2, args, cwd, env) {
|
|
|
12677
12775
|
}
|
|
12678
12776
|
async function runNpmInstall(sourceDirectory, options) {
|
|
12679
12777
|
assertNodeVersion(options?.nodeVersion);
|
|
12680
|
-
const cwd =
|
|
12681
|
-
const packageJsonPath =
|
|
12778
|
+
const cwd = path39.resolve(sourceDirectory);
|
|
12779
|
+
const packageJsonPath = path39.join(cwd, "package.json");
|
|
12682
12780
|
if (!await pathExists2(packageJsonPath)) {
|
|
12683
12781
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
12684
12782
|
}
|
|
12685
12783
|
const startedAt = Date.now();
|
|
12686
|
-
const lockPath =
|
|
12784
|
+
const lockPath = path39.join(cwd, "package-lock.json");
|
|
12687
12785
|
const installArgs = await pathExists2(lockPath) ? ["ci"] : ["install"];
|
|
12688
12786
|
const install = await runCommand("npm", installArgs, cwd);
|
|
12689
12787
|
const installLog = install.output;
|
|
@@ -12701,8 +12799,8 @@ async function runNpmInstall(sourceDirectory, options) {
|
|
|
12701
12799
|
}
|
|
12702
12800
|
async function runNpmBuild(sourceDirectory, options) {
|
|
12703
12801
|
assertNodeVersion(options?.nodeVersion);
|
|
12704
|
-
const cwd =
|
|
12705
|
-
const packageJsonPath =
|
|
12802
|
+
const cwd = path39.resolve(sourceDirectory);
|
|
12803
|
+
const packageJsonPath = path39.join(cwd, "package.json");
|
|
12706
12804
|
if (!await pathExists2(packageJsonPath)) {
|
|
12707
12805
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
12708
12806
|
}
|
|
@@ -12719,8 +12817,8 @@ async function runNpmBuild(sourceDirectory, options) {
|
|
|
12719
12817
|
build2.exitCode
|
|
12720
12818
|
);
|
|
12721
12819
|
}
|
|
12722
|
-
const distPath =
|
|
12723
|
-
const indexPath =
|
|
12820
|
+
const distPath = path39.join(cwd, "dist");
|
|
12821
|
+
const indexPath = path39.join(distPath, "index.html");
|
|
12724
12822
|
if (!await pathExists2(indexPath)) {
|
|
12725
12823
|
throw new NpmBuildError(
|
|
12726
12824
|
`Build completed but dist/index.html was not found at ${indexPath}`,
|
|
@@ -13072,7 +13170,7 @@ function validateManifestForPlatformPublish(manifest) {
|
|
|
13072
13170
|
|
|
13073
13171
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
13074
13172
|
async function checkPublishReadiness(client, _config, args) {
|
|
13075
|
-
const sourceDirectory =
|
|
13173
|
+
const sourceDirectory = path40.resolve(args.sourceDirectory);
|
|
13076
13174
|
const manifest = await readManifest(sourceDirectory) ?? createScaffoldManifest();
|
|
13077
13175
|
const emailOptions = await resolveEmailOptionsForPublish(
|
|
13078
13176
|
client,
|
|
@@ -13150,7 +13248,7 @@ async function checkPublishReadiness(client, _config, args) {
|
|
|
13150
13248
|
|
|
13151
13249
|
// src/cli/check/handler.ts
|
|
13152
13250
|
async function check(argv) {
|
|
13153
|
-
const sourceDirectory =
|
|
13251
|
+
const sourceDirectory = path41.resolve(process.cwd(), argv.dir);
|
|
13154
13252
|
const config2 = loadConfig();
|
|
13155
13253
|
const client = new PlatformApiClient(config2);
|
|
13156
13254
|
let result;
|
|
@@ -13195,13 +13293,13 @@ var check_default = {
|
|
|
13195
13293
|
// src/cli/make-config/handler.ts
|
|
13196
13294
|
import { constants as constants2 } from "node:fs";
|
|
13197
13295
|
import { access as access8, mkdir as mkdir10, readFile as readFile14, writeFile as writeFile13 } from "node:fs/promises";
|
|
13198
|
-
import
|
|
13296
|
+
import path52 from "node:path";
|
|
13199
13297
|
import { stdin as input2 } from "node:process";
|
|
13200
13298
|
import { glob as glob5 } from "glob";
|
|
13201
13299
|
|
|
13202
13300
|
// src/cli/scaffold/dev-portal-config-pages.ts
|
|
13203
13301
|
import { access as access4, readFile as readFile10, rename as rename2, rm as rm3, writeFile as writeFile9 } from "node:fs/promises";
|
|
13204
|
-
import
|
|
13302
|
+
import path42 from "node:path";
|
|
13205
13303
|
async function writeConfigAtomically(filePath, content) {
|
|
13206
13304
|
const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
13207
13305
|
try {
|
|
@@ -13214,7 +13312,7 @@ async function writeConfigAtomically(filePath, content) {
|
|
|
13214
13312
|
}
|
|
13215
13313
|
async function resolveApitogoConfigPath(sourceDirectory) {
|
|
13216
13314
|
for (const filename of ["apitogo.config.tsx", "apitogo.config.jsx"]) {
|
|
13217
|
-
const configPath =
|
|
13315
|
+
const configPath = path42.join(sourceDirectory, filename);
|
|
13218
13316
|
try {
|
|
13219
13317
|
await access4(configPath);
|
|
13220
13318
|
return configPath;
|
|
@@ -13719,10 +13817,10 @@ ${formatCustomPageNavigationEntry(slug, label, itemIndent)}
|
|
|
13719
13817
|
${inner}],
|
|
13720
13818
|
${indent}},`;
|
|
13721
13819
|
}
|
|
13722
|
-
function findMatchingArrayClose(content,
|
|
13820
|
+
function findMatchingArrayClose(content, open2) {
|
|
13723
13821
|
let depth = 0;
|
|
13724
13822
|
let inString = null;
|
|
13725
|
-
for (let i =
|
|
13823
|
+
for (let i = open2; i < content.length; i++) {
|
|
13726
13824
|
const char = content[i];
|
|
13727
13825
|
if (inString) {
|
|
13728
13826
|
if (char === "\\") {
|
|
@@ -13761,8 +13859,8 @@ function findDocumentationCategoryItemsRange(content, from, to) {
|
|
|
13761
13859
|
if (!itemsMatch) {
|
|
13762
13860
|
return null;
|
|
13763
13861
|
}
|
|
13764
|
-
const
|
|
13765
|
-
const close3 = findMatchingArrayClose(content,
|
|
13862
|
+
const open2 = afterLabel + itemsMatch.index + itemsMatch[0].length - 1;
|
|
13863
|
+
const close3 = findMatchingArrayClose(content, open2);
|
|
13766
13864
|
if (close3 === null || close3 > to) {
|
|
13767
13865
|
return null;
|
|
13768
13866
|
}
|
|
@@ -13773,7 +13871,7 @@ function findDocumentationCategoryItemsRange(content, from, to) {
|
|
|
13773
13871
|
const indentMatch = /^[ \t]*/.exec(content.slice(lineStart));
|
|
13774
13872
|
const itemsIndent = indentMatch?.[0] ?? "";
|
|
13775
13873
|
const entryIndent = `${itemsIndent} `;
|
|
13776
|
-
return { open, close: close3, indent: entryIndent };
|
|
13874
|
+
return { open: open2, close: close3, indent: entryIndent };
|
|
13777
13875
|
}
|
|
13778
13876
|
function appendEntryToArrayRange(content, range, entry) {
|
|
13779
13877
|
const before = content.slice(0, range.close);
|
|
@@ -13808,11 +13906,11 @@ function appendCustomPageToDirectBuildExport(content, slug, label) {
|
|
|
13808
13906
|
return null;
|
|
13809
13907
|
}
|
|
13810
13908
|
const callStart = exportIndex + exportPrefix.length;
|
|
13811
|
-
const
|
|
13909
|
+
const open2 = callStart + callPrefix.length - 1;
|
|
13812
13910
|
let depth = 0;
|
|
13813
13911
|
let inString = null;
|
|
13814
13912
|
let close3 = -1;
|
|
13815
|
-
for (let i =
|
|
13913
|
+
for (let i = open2; i < content.length; i++) {
|
|
13816
13914
|
const char = content[i];
|
|
13817
13915
|
if (inString) {
|
|
13818
13916
|
if (char === "\\") {
|
|
@@ -13873,10 +13971,10 @@ function findNavigationArrayRange(content) {
|
|
|
13873
13971
|
return null;
|
|
13874
13972
|
}
|
|
13875
13973
|
const indent = match[1] ?? "";
|
|
13876
|
-
const
|
|
13974
|
+
const open2 = match.index + match[0].length - 1;
|
|
13877
13975
|
let depth = 0;
|
|
13878
13976
|
let inString = null;
|
|
13879
|
-
for (let i =
|
|
13977
|
+
for (let i = open2; i < content.length; i++) {
|
|
13880
13978
|
const char = content[i];
|
|
13881
13979
|
if (inString) {
|
|
13882
13980
|
if (char === "\\") {
|
|
@@ -13895,7 +13993,7 @@ function findNavigationArrayRange(content) {
|
|
|
13895
13993
|
} else if (char === "]") {
|
|
13896
13994
|
depth -= 1;
|
|
13897
13995
|
if (depth === 0) {
|
|
13898
|
-
return { open, close: i, indent };
|
|
13996
|
+
return { open: open2, close: i, indent };
|
|
13899
13997
|
}
|
|
13900
13998
|
}
|
|
13901
13999
|
}
|
|
@@ -13951,17 +14049,17 @@ async function wireNewDevPortalPageInConfig(sourceDirectory, slug, label) {
|
|
|
13951
14049
|
|
|
13952
14050
|
// src/cli/scaffold/wire-openapi.ts
|
|
13953
14051
|
import { access as access6, readFile as readFile12, writeFile as writeFile11 } from "node:fs/promises";
|
|
13954
|
-
import
|
|
14052
|
+
import path47 from "node:path";
|
|
13955
14053
|
|
|
13956
14054
|
// src/cli/platform/helpers/openapi.ts
|
|
13957
|
-
import { promises as
|
|
13958
|
-
import
|
|
14055
|
+
import { promises as fs6 } from "node:fs";
|
|
14056
|
+
import path44 from "node:path";
|
|
13959
14057
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
13960
14058
|
import YAML from "yaml";
|
|
13961
14059
|
|
|
13962
14060
|
// src/cli/scaffold/discover-openapi-files.ts
|
|
13963
|
-
import { promises as
|
|
13964
|
-
import
|
|
14061
|
+
import { promises as fs5 } from "node:fs";
|
|
14062
|
+
import path43 from "node:path";
|
|
13965
14063
|
var OPENAPI_BASENAMES = [
|
|
13966
14064
|
"openapi.yaml",
|
|
13967
14065
|
"openapi.yml",
|
|
@@ -13983,15 +14081,15 @@ var SKIP_OPENAPI_SEARCH_DIRS = /* @__PURE__ */ new Set([
|
|
|
13983
14081
|
".apitogo"
|
|
13984
14082
|
]);
|
|
13985
14083
|
async function collectFromDir(dir, searchedDirectories, candidates) {
|
|
13986
|
-
const resolved =
|
|
14084
|
+
const resolved = path43.resolve(dir);
|
|
13987
14085
|
if (searchedDirectories.includes(resolved)) {
|
|
13988
14086
|
return;
|
|
13989
14087
|
}
|
|
13990
14088
|
searchedDirectories.push(resolved);
|
|
13991
14089
|
for (const name of OPENAPI_BASENAMES) {
|
|
13992
|
-
const candidate =
|
|
14090
|
+
const candidate = path43.join(resolved, name);
|
|
13993
14091
|
try {
|
|
13994
|
-
await
|
|
14092
|
+
await fs5.access(candidate);
|
|
13995
14093
|
candidates.push(candidate);
|
|
13996
14094
|
} catch {
|
|
13997
14095
|
}
|
|
@@ -14004,20 +14102,20 @@ async function collectSiteOpenApiFiles(siteDirectory) {
|
|
|
14004
14102
|
return { candidates: [...new Set(candidates)], searchedDirectories };
|
|
14005
14103
|
}
|
|
14006
14104
|
async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
14007
|
-
const site =
|
|
14008
|
-
const parent =
|
|
14105
|
+
const site = path43.resolve(siteDirectory);
|
|
14106
|
+
const parent = path43.dirname(site);
|
|
14009
14107
|
const searchedDirectories = [];
|
|
14010
14108
|
const candidates = [];
|
|
14011
14109
|
if (parent && parent !== site) {
|
|
14012
14110
|
await collectFromDir(parent, searchedDirectories, candidates);
|
|
14013
14111
|
try {
|
|
14014
|
-
const entries = await
|
|
14112
|
+
const entries = await fs5.readdir(parent, { withFileTypes: true });
|
|
14015
14113
|
for (const entry of entries) {
|
|
14016
14114
|
if (!entry.isDirectory() || SKIP_OPENAPI_SEARCH_DIRS.has(entry.name)) {
|
|
14017
14115
|
continue;
|
|
14018
14116
|
}
|
|
14019
|
-
const sibling =
|
|
14020
|
-
if (
|
|
14117
|
+
const sibling = path43.join(parent, entry.name);
|
|
14118
|
+
if (path43.resolve(sibling) === site) {
|
|
14021
14119
|
continue;
|
|
14022
14120
|
}
|
|
14023
14121
|
await collectFromDir(sibling, searchedDirectories, candidates);
|
|
@@ -14045,7 +14143,7 @@ function parseOpenApiObject(doc) {
|
|
|
14045
14143
|
};
|
|
14046
14144
|
}
|
|
14047
14145
|
function liteParseOpenApi(content, filePath) {
|
|
14048
|
-
const ext =
|
|
14146
|
+
const ext = path43.extname(filePath).toLowerCase();
|
|
14049
14147
|
if (ext === ".json") {
|
|
14050
14148
|
try {
|
|
14051
14149
|
const parsed = JSON.parse(content);
|
|
@@ -14110,9 +14208,9 @@ async function discoverNearbyOpenApi(siteDirectory) {
|
|
|
14110
14208
|
};
|
|
14111
14209
|
}
|
|
14112
14210
|
async function validateOpenApiFile(filePath) {
|
|
14113
|
-
const resolved =
|
|
14114
|
-
const content = await
|
|
14115
|
-
const ext =
|
|
14211
|
+
const resolved = path44.resolve(filePath);
|
|
14212
|
+
const content = await fs6.readFile(resolved, "utf8");
|
|
14213
|
+
const ext = path44.extname(resolved).toLowerCase();
|
|
14116
14214
|
let parsed;
|
|
14117
14215
|
try {
|
|
14118
14216
|
parsed = ext === ".json" ? JSON.parse(content) : YAML.parse(content);
|
|
@@ -14155,12 +14253,12 @@ async function validateOpenApiFile(filePath) {
|
|
|
14155
14253
|
|
|
14156
14254
|
// src/cli/scaffold/scaffold-dev-portal-site.ts
|
|
14157
14255
|
import { mkdir as mkdir8, readFile as readFile11, writeFile as writeFile10 } from "node:fs/promises";
|
|
14158
|
-
import
|
|
14256
|
+
import path46 from "node:path";
|
|
14159
14257
|
|
|
14160
14258
|
// src/cli/scaffold/create-apitogo-cli.ts
|
|
14161
14259
|
import { spawn as spawn2 } from "node:child_process";
|
|
14162
14260
|
import { access as access5, rm as rm4 } from "node:fs/promises";
|
|
14163
|
-
import
|
|
14261
|
+
import path45 from "node:path";
|
|
14164
14262
|
|
|
14165
14263
|
// src/cli/scaffold/apitogo-npm-packages.ts
|
|
14166
14264
|
var DEFAULT_CREATE_APITOGO_PACKAGE2 = "@lukoweb/create-apitogo@latest";
|
|
@@ -14261,9 +14359,9 @@ function resolveDocToolPath(explicit) {
|
|
|
14261
14359
|
return value || void 0;
|
|
14262
14360
|
}
|
|
14263
14361
|
function splitOutputDirectory(outputDirectory) {
|
|
14264
|
-
const resolvedOutputDirectory =
|
|
14265
|
-
const projectName =
|
|
14266
|
-
const parentDirectory =
|
|
14362
|
+
const resolvedOutputDirectory = path45.resolve(outputDirectory);
|
|
14363
|
+
const projectName = path45.basename(resolvedOutputDirectory);
|
|
14364
|
+
const parentDirectory = path45.dirname(resolvedOutputDirectory);
|
|
14267
14365
|
if (!projectName || projectName === "." || projectName === "..") {
|
|
14268
14366
|
throw new Error(
|
|
14269
14367
|
"outputDirectory must be a named folder (e.g. ./dev-portal-site), not the current directory."
|
|
@@ -14289,7 +14387,7 @@ async function directoryHasEntries(dir) {
|
|
|
14289
14387
|
}
|
|
14290
14388
|
}
|
|
14291
14389
|
function resolveLocalCreateApitogoEntry(docToolPath) {
|
|
14292
|
-
return
|
|
14390
|
+
return path45.resolve(docToolPath, "packages/create-zudoku/dist/index.js");
|
|
14293
14391
|
}
|
|
14294
14392
|
async function resolveCreateApitogoInvocation(options) {
|
|
14295
14393
|
const docToolPath = resolveDocToolPath(options.docToolPath);
|
|
@@ -14341,7 +14439,7 @@ function buildCreateApitogoCliArgs(invocationArgs, projectName, options) {
|
|
|
14341
14439
|
"--skip-install",
|
|
14342
14440
|
"--use-npm"
|
|
14343
14441
|
];
|
|
14344
|
-
if (options?.withExamples) {
|
|
14442
|
+
if (options?.withExamples !== false) {
|
|
14345
14443
|
cliArgs.push("--include-examples");
|
|
14346
14444
|
}
|
|
14347
14445
|
return cliArgs;
|
|
@@ -14371,7 +14469,7 @@ async function runCreateApitogoDevPortal(options) {
|
|
|
14371
14469
|
result.exitCode
|
|
14372
14470
|
);
|
|
14373
14471
|
}
|
|
14374
|
-
if (!await pathExists3(
|
|
14472
|
+
if (!await pathExists3(path45.join(resolvedOutputDirectory, "package.json"))) {
|
|
14375
14473
|
throw new CreateApitogoCliError(
|
|
14376
14474
|
`create-apitogo completed but package.json was not found at ${resolvedOutputDirectory}`,
|
|
14377
14475
|
result.output,
|
|
@@ -14427,7 +14525,7 @@ function ensureRequiredApitogoModules(pkg, options) {
|
|
|
14427
14525
|
]
|
|
14428
14526
|
]) {
|
|
14429
14527
|
if (options.docToolPath) {
|
|
14430
|
-
deps[moduleName] = `file:${
|
|
14528
|
+
deps[moduleName] = `file:${path46.join(options.docToolPath, localPath)}`;
|
|
14431
14529
|
continue;
|
|
14432
14530
|
}
|
|
14433
14531
|
deps[moduleName] = `npm:${moduleName}@${moduleAliasVersion}`;
|
|
@@ -14456,7 +14554,7 @@ function rewritePackageJson(raw, options) {
|
|
|
14456
14554
|
if (!deps) continue;
|
|
14457
14555
|
for (const [dep, relativePath] of Object.entries(DOC_TOOL_LOCAL_PACKAGE_PATHS)) {
|
|
14458
14556
|
if (dep in deps) {
|
|
14459
|
-
deps[dep] = `file:${
|
|
14557
|
+
deps[dep] = `file:${path46.join(options.docToolPath, relativePath)}`;
|
|
14460
14558
|
linkedWorkspacePackage = true;
|
|
14461
14559
|
}
|
|
14462
14560
|
}
|
|
@@ -14553,23 +14651,23 @@ function patchDashboardPageConfig(content) {
|
|
|
14553
14651
|
);
|
|
14554
14652
|
}
|
|
14555
14653
|
async function ensureAccountPlansPage(outputDirectory) {
|
|
14556
|
-
const pagePath =
|
|
14654
|
+
const pagePath = path46.join(outputDirectory, ACCOUNT_PLANS_PAGE_PATH);
|
|
14557
14655
|
try {
|
|
14558
14656
|
await readFile11(pagePath, "utf8");
|
|
14559
14657
|
return void 0;
|
|
14560
14658
|
} catch {
|
|
14561
|
-
await mkdir8(
|
|
14659
|
+
await mkdir8(path46.dirname(pagePath), { recursive: true });
|
|
14562
14660
|
await writeFile10(pagePath, ACCOUNT_PLANS_PAGE);
|
|
14563
14661
|
return ACCOUNT_PLANS_PAGE_PATH;
|
|
14564
14662
|
}
|
|
14565
14663
|
}
|
|
14566
14664
|
async function ensureDashboardPage(outputDirectory) {
|
|
14567
|
-
const pagePath =
|
|
14665
|
+
const pagePath = path46.join(outputDirectory, DASHBOARD_PAGE_PATH);
|
|
14568
14666
|
try {
|
|
14569
14667
|
await readFile11(pagePath, "utf8");
|
|
14570
14668
|
return void 0;
|
|
14571
14669
|
} catch {
|
|
14572
|
-
await mkdir8(
|
|
14670
|
+
await mkdir8(path46.dirname(pagePath), { recursive: true });
|
|
14573
14671
|
await writeFile10(pagePath, DASHBOARD_PAGE);
|
|
14574
14672
|
return DASHBOARD_PAGE_PATH;
|
|
14575
14673
|
}
|
|
@@ -14620,7 +14718,7 @@ function patchApitogoConfig(content, options) {
|
|
|
14620
14718
|
async function patchScaffoldedSite(outputDirectory, options) {
|
|
14621
14719
|
const title = options.branding?.title ?? options.siteName;
|
|
14622
14720
|
const filesWritten = [];
|
|
14623
|
-
const packageJsonPath =
|
|
14721
|
+
const packageJsonPath = path46.join(outputDirectory, "package.json");
|
|
14624
14722
|
if (options.patchPackageJson !== false) {
|
|
14625
14723
|
const packageJson3 = await readFile11(packageJsonPath, "utf8");
|
|
14626
14724
|
await writeFile10(
|
|
@@ -14633,7 +14731,7 @@ async function patchScaffoldedSite(outputDirectory, options) {
|
|
|
14633
14731
|
);
|
|
14634
14732
|
filesWritten.push("package.json");
|
|
14635
14733
|
}
|
|
14636
|
-
const configPath =
|
|
14734
|
+
const configPath = path46.join(outputDirectory, "apitogo.config.tsx");
|
|
14637
14735
|
const configContent = await readFile11(configPath, "utf8");
|
|
14638
14736
|
await writeFile10(
|
|
14639
14737
|
configPath,
|
|
@@ -14728,8 +14826,8 @@ async function discoverOpenApiByMode(siteDirectory, mode) {
|
|
|
14728
14826
|
return discoverNearbyOpenApi(siteDirectory);
|
|
14729
14827
|
}
|
|
14730
14828
|
async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
14731
|
-
const resolvedSource =
|
|
14732
|
-
const resolvedOpenApi =
|
|
14829
|
+
const resolvedSource = path47.resolve(sourceDirectory);
|
|
14830
|
+
const resolvedOpenApi = path47.resolve(openApiPath);
|
|
14733
14831
|
const input3 = toSiteRelativeOpenApiInput(resolvedSource, resolvedOpenApi);
|
|
14734
14832
|
const validation = await validateOpenApiFile(resolvedOpenApi);
|
|
14735
14833
|
if (!validation.valid) {
|
|
@@ -14754,7 +14852,7 @@ async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
|
14754
14852
|
"utf8"
|
|
14755
14853
|
);
|
|
14756
14854
|
} else {
|
|
14757
|
-
const tsxConfigPath =
|
|
14855
|
+
const tsxConfigPath = path47.join(resolvedSource, "apitogo.config.tsx");
|
|
14758
14856
|
const configContent = await readFile12(tsxConfigPath, "utf8");
|
|
14759
14857
|
try {
|
|
14760
14858
|
const patched = patchApitogoConfigOpenApiToFile(configContent, input3);
|
|
@@ -14842,10 +14940,10 @@ async function discoverAndWireOpenApi(siteDirectory, mode) {
|
|
|
14842
14940
|
// src/cli/make-config/interactive.ts
|
|
14843
14941
|
import { createInterface } from "node:readline/promises";
|
|
14844
14942
|
import { stdin as input, stdout as output } from "node:process";
|
|
14845
|
-
import
|
|
14943
|
+
import path49 from "node:path";
|
|
14846
14944
|
|
|
14847
14945
|
// src/cli/make-config/json-config.ts
|
|
14848
|
-
import
|
|
14946
|
+
import path48 from "node:path";
|
|
14849
14947
|
|
|
14850
14948
|
// src/cli/make-config/branding-assets.ts
|
|
14851
14949
|
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';
|
|
@@ -15224,9 +15322,9 @@ function openapiInputForConfig(specRelativePosix) {
|
|
|
15224
15322
|
return `./${specRelativePosix}`;
|
|
15225
15323
|
}
|
|
15226
15324
|
function toRelativeOpenApiInput(projectDir, inputPath) {
|
|
15227
|
-
const resolved =
|
|
15228
|
-
const relative =
|
|
15229
|
-
const posix = relative.split(
|
|
15325
|
+
const resolved = path48.isAbsolute(inputPath) ? inputPath : path48.resolve(projectDir, inputPath);
|
|
15326
|
+
const relative = path48.relative(projectDir, resolved);
|
|
15327
|
+
const posix = relative.split(path48.sep).join(path48.posix.sep);
|
|
15230
15328
|
if (!posix) {
|
|
15231
15329
|
throw new Error("OpenAPI path must point to a file.");
|
|
15232
15330
|
}
|
|
@@ -15599,7 +15697,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
15599
15697
|
continue;
|
|
15600
15698
|
}
|
|
15601
15699
|
const routePath = `/${slug}`;
|
|
15602
|
-
const relativePath =
|
|
15700
|
+
const relativePath = path49.posix.join(options.pagesDir, `${slug}.tsx`);
|
|
15603
15701
|
const page = {
|
|
15604
15702
|
slug,
|
|
15605
15703
|
title: pageTitle.trim(),
|
|
@@ -15692,7 +15790,7 @@ export default function ${componentName}() {
|
|
|
15692
15790
|
init_package_json();
|
|
15693
15791
|
import { constants } from "node:fs";
|
|
15694
15792
|
import { access as access7, mkdir as mkdir9, readFile as readFile13, writeFile as writeFile12 } from "node:fs/promises";
|
|
15695
|
-
import
|
|
15793
|
+
import path50 from "node:path";
|
|
15696
15794
|
import { glob as glob4 } from "glob";
|
|
15697
15795
|
|
|
15698
15796
|
// src/cli/make-config/favicon-png.ts
|
|
@@ -15707,9 +15805,9 @@ var OPENAPI_GLOBS = [
|
|
|
15707
15805
|
"openapi.yaml",
|
|
15708
15806
|
"openapi.yml"
|
|
15709
15807
|
];
|
|
15710
|
-
var toPosix = (p) => p.split(
|
|
15808
|
+
var toPosix = (p) => p.split(path50.sep).join("/");
|
|
15711
15809
|
var sanitizePackageName = (dir) => {
|
|
15712
|
-
const base =
|
|
15810
|
+
const base = path50.basename(path50.resolve(dir));
|
|
15713
15811
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
15714
15812
|
return s || "apitogo-site";
|
|
15715
15813
|
};
|
|
@@ -15719,7 +15817,7 @@ var apitogoVersionRange = () => {
|
|
|
15719
15817
|
};
|
|
15720
15818
|
async function findOpenApiSpecPath(dir) {
|
|
15721
15819
|
for (const rel of OPENAPI_GLOBS) {
|
|
15722
|
-
const full =
|
|
15820
|
+
const full = path50.join(dir, rel);
|
|
15723
15821
|
try {
|
|
15724
15822
|
await access7(full, constants.R_OK);
|
|
15725
15823
|
return toPosix(rel);
|
|
@@ -15734,7 +15832,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
15734
15832
|
return extra[0] ? toPosix(extra[0]) : null;
|
|
15735
15833
|
}
|
|
15736
15834
|
async function ensurePackageJson(dir) {
|
|
15737
|
-
const pkgPath =
|
|
15835
|
+
const pkgPath = path50.join(dir, "package.json");
|
|
15738
15836
|
const apitogoVer = apitogoVersionRange();
|
|
15739
15837
|
const baseDeps = {
|
|
15740
15838
|
react: ">=19.0.0",
|
|
@@ -15801,7 +15899,7 @@ async function ensurePackageJson(dir) {
|
|
|
15801
15899
|
return false;
|
|
15802
15900
|
}
|
|
15803
15901
|
async function ensureTsconfigJson(dir) {
|
|
15804
|
-
const tsPath =
|
|
15902
|
+
const tsPath = path50.join(dir, "tsconfig.json");
|
|
15805
15903
|
try {
|
|
15806
15904
|
await access7(tsPath, constants.R_OK);
|
|
15807
15905
|
return false;
|
|
@@ -15850,40 +15948,40 @@ var fileExists2 = async (filePath) => {
|
|
|
15850
15948
|
}
|
|
15851
15949
|
};
|
|
15852
15950
|
async function ensurePortalStubFiles(dir) {
|
|
15853
|
-
const landingPath =
|
|
15951
|
+
const landingPath = path50.join(dir, "landing", "LandingPage.tsx");
|
|
15854
15952
|
if (!await fileExists2(landingPath)) {
|
|
15855
|
-
await mkdir9(
|
|
15953
|
+
await mkdir9(path50.join(dir, "landing"), { recursive: true });
|
|
15856
15954
|
await writeFile12(landingPath, LANDING_PAGE_SOURCE, "utf8");
|
|
15857
15955
|
}
|
|
15858
|
-
const plansPath =
|
|
15956
|
+
const plansPath = path50.join(dir, "user-panel", "AccountPlansPage.tsx");
|
|
15859
15957
|
if (!await fileExists2(plansPath)) {
|
|
15860
|
-
await mkdir9(
|
|
15958
|
+
await mkdir9(path50.join(dir, "user-panel"), { recursive: true });
|
|
15861
15959
|
await writeFile12(plansPath, ACCOUNT_PLANS_PAGE_SOURCE, "utf8");
|
|
15862
15960
|
}
|
|
15863
|
-
const dashboardPath =
|
|
15961
|
+
const dashboardPath = path50.join(dir, "user-panel", "DashboardPage.tsx");
|
|
15864
15962
|
if (!await fileExists2(dashboardPath)) {
|
|
15865
|
-
await mkdir9(
|
|
15963
|
+
await mkdir9(path50.join(dir, "user-panel"), { recursive: true });
|
|
15866
15964
|
await writeFile12(dashboardPath, DASHBOARD_PAGE_SOURCE, "utf8");
|
|
15867
15965
|
}
|
|
15868
15966
|
await ensurePublicBrandingFiles(dir);
|
|
15869
15967
|
}
|
|
15870
15968
|
async function ensurePublicBrandingFiles(dir) {
|
|
15871
|
-
const destDir =
|
|
15969
|
+
const destDir = path50.join(dir, "public");
|
|
15872
15970
|
await mkdir9(destDir, { recursive: true });
|
|
15873
15971
|
for (const { name, content } of BRANDING_ASSETS) {
|
|
15874
|
-
const dest =
|
|
15972
|
+
const dest = path50.join(destDir, name);
|
|
15875
15973
|
if (await fileExists2(dest)) {
|
|
15876
15974
|
continue;
|
|
15877
15975
|
}
|
|
15878
15976
|
await writeFile12(dest, content, "utf8");
|
|
15879
15977
|
}
|
|
15880
|
-
const faviconDest =
|
|
15978
|
+
const faviconDest = path50.join(destDir, "Icon.png");
|
|
15881
15979
|
if (!await fileExists2(faviconDest)) {
|
|
15882
15980
|
await writeFile12(faviconDest, Buffer.from(FAVICON_PNG_BASE64, "base64"));
|
|
15883
15981
|
}
|
|
15884
15982
|
}
|
|
15885
15983
|
async function ensureThinConfigTsx(dir) {
|
|
15886
|
-
const tsxPath =
|
|
15984
|
+
const tsxPath = path50.join(dir, "apitogo.config.tsx");
|
|
15887
15985
|
if (await fileExists2(tsxPath)) {
|
|
15888
15986
|
return false;
|
|
15889
15987
|
}
|
|
@@ -15893,7 +15991,7 @@ async function ensureThinConfigTsx(dir) {
|
|
|
15893
15991
|
|
|
15894
15992
|
// src/cli/platform/helpers/openapi-action-keys.ts
|
|
15895
15993
|
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "node:fs";
|
|
15896
|
-
import
|
|
15994
|
+
import path51 from "node:path";
|
|
15897
15995
|
import YAML2 from "yaml";
|
|
15898
15996
|
var HTTP_METHODS = [
|
|
15899
15997
|
"get",
|
|
@@ -15962,7 +16060,7 @@ function extractGatewayActionKeysFromOpenApiDocument(document) {
|
|
|
15962
16060
|
function extractGatewayActionKeysFromOpenApiFile(filePath) {
|
|
15963
16061
|
try {
|
|
15964
16062
|
const raw = readFileSync3(filePath, "utf8");
|
|
15965
|
-
const ext =
|
|
16063
|
+
const ext = path51.extname(filePath).toLowerCase();
|
|
15966
16064
|
const parsed = ext === ".json" ? JSON.parse(raw) : YAML2.parse(raw);
|
|
15967
16065
|
return extractGatewayActionKeysFromOpenApiDocument(parsed);
|
|
15968
16066
|
} catch {
|
|
@@ -15983,7 +16081,7 @@ function resolveConfigOpenApiFilePath(siteDirectory, config2) {
|
|
|
15983
16081
|
}
|
|
15984
16082
|
}
|
|
15985
16083
|
for (const candidate of candidates) {
|
|
15986
|
-
const resolved =
|
|
16084
|
+
const resolved = path51.isAbsolute(candidate) ? candidate : path51.resolve(siteDirectory, candidate);
|
|
15987
16085
|
if (existsSync5(resolved)) {
|
|
15988
16086
|
return resolved;
|
|
15989
16087
|
}
|
|
@@ -15998,7 +16096,7 @@ function loadOpenApiActionKeysForSite(siteDirectory, config2) {
|
|
|
15998
16096
|
return extractGatewayActionKeysFromOpenApiFile(filePath);
|
|
15999
16097
|
}
|
|
16000
16098
|
function loadOpenApiActionKeysFromSiteDirectory(siteDirectory) {
|
|
16001
|
-
const configPath =
|
|
16099
|
+
const configPath = path51.join(siteDirectory, "apitogo.config.json");
|
|
16002
16100
|
if (!existsSync5(configPath)) {
|
|
16003
16101
|
return [];
|
|
16004
16102
|
}
|
|
@@ -16023,7 +16121,7 @@ function withDefaultIncludedActionKeys(plan, actionKeys) {
|
|
|
16023
16121
|
}
|
|
16024
16122
|
|
|
16025
16123
|
// src/cli/make-config/handler.ts
|
|
16026
|
-
var toPosixPath2 = (value) => value.split(
|
|
16124
|
+
var toPosixPath2 = (value) => value.split(path52.sep).join(path52.posix.sep);
|
|
16027
16125
|
var fileExists3 = async (filePath) => {
|
|
16028
16126
|
try {
|
|
16029
16127
|
await access8(filePath, constants2.F_OK);
|
|
@@ -16081,7 +16179,7 @@ async function persistConfig(config2, ctx) {
|
|
|
16081
16179
|
};
|
|
16082
16180
|
await writeFile13(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
|
|
16083
16181
|
`, "utf8");
|
|
16084
|
-
const tsxPath =
|
|
16182
|
+
const tsxPath = path52.join(ctx.dir, "apitogo.config.tsx");
|
|
16085
16183
|
if (await fileExists3(tsxPath) && tsxRoutes.length > 0) {
|
|
16086
16184
|
const tsxSource = await readFile14(tsxPath, "utf8");
|
|
16087
16185
|
if (isManagedConfigWrapper(tsxSource)) {
|
|
@@ -16108,7 +16206,7 @@ function mergeBackendFlag(config2, backend) {
|
|
|
16108
16206
|
return next;
|
|
16109
16207
|
}
|
|
16110
16208
|
async function makeConfig(argv) {
|
|
16111
|
-
const dir =
|
|
16209
|
+
const dir = path52.resolve(process.cwd(), argv.dir);
|
|
16112
16210
|
const pagesDir = toPosixPath2(
|
|
16113
16211
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
16114
16212
|
);
|
|
@@ -16128,14 +16226,14 @@ async function makeConfig(argv) {
|
|
|
16128
16226
|
printDiagnosticsToConsole("Created tsconfig.json.");
|
|
16129
16227
|
}
|
|
16130
16228
|
await ensurePortalStubFiles(dir);
|
|
16131
|
-
const jsonPath =
|
|
16229
|
+
const jsonPath = path52.join(dir, APITOGO_JSON_FILENAME);
|
|
16132
16230
|
let createdJson = false;
|
|
16133
16231
|
let config2;
|
|
16134
16232
|
if (await fileExists3(jsonPath)) {
|
|
16135
16233
|
config2 = await readJsonConfig(jsonPath);
|
|
16136
16234
|
} else {
|
|
16137
16235
|
config2 = createDefaultApitogoJsonConfig({
|
|
16138
|
-
title: titleFromDirectoryName(
|
|
16236
|
+
title: titleFromDirectoryName(path52.basename(dir)),
|
|
16139
16237
|
pagesDir
|
|
16140
16238
|
});
|
|
16141
16239
|
createdJson = true;
|
|
@@ -16184,8 +16282,8 @@ async function makeConfig(argv) {
|
|
|
16184
16282
|
return;
|
|
16185
16283
|
}
|
|
16186
16284
|
if (action2.kind === "page") {
|
|
16187
|
-
const pagePath =
|
|
16188
|
-
await mkdir10(
|
|
16285
|
+
const pagePath = path52.join(dir, action2.page.relativePath);
|
|
16286
|
+
await mkdir10(path52.dirname(pagePath), { recursive: true });
|
|
16189
16287
|
await writeFile13(
|
|
16190
16288
|
pagePath,
|
|
16191
16289
|
buildStarterDocsPageTsx(action2.page.slug, action2.page.title),
|
|
@@ -16252,7 +16350,7 @@ async function makeConfig(argv) {
|
|
|
16252
16350
|
if (argv.openapi) {
|
|
16253
16351
|
const wire = await wireDevPortalOpenApi(
|
|
16254
16352
|
dir,
|
|
16255
|
-
|
|
16353
|
+
path52.resolve(dir, argv.openapi)
|
|
16256
16354
|
);
|
|
16257
16355
|
if (wire.status !== "succeeded") {
|
|
16258
16356
|
throw new Error(
|
|
@@ -16281,7 +16379,7 @@ async function makeConfig(argv) {
|
|
|
16281
16379
|
const slug = normalizePageSlug(argv.pageSlug);
|
|
16282
16380
|
const pageTemplate = normalizePageTemplate(argv.pageTemplate);
|
|
16283
16381
|
const relativePagePath = pageComponentRelativePath(slug);
|
|
16284
|
-
const filePath =
|
|
16382
|
+
const filePath = path52.join(dir, relativePagePath);
|
|
16285
16383
|
const isUpdate = argv.pageUpdate === true;
|
|
16286
16384
|
if (isUpdate) {
|
|
16287
16385
|
if (!await fileExists3(filePath)) {
|
|
@@ -16314,7 +16412,7 @@ async function makeConfig(argv) {
|
|
|
16314
16412
|
argv.pageContent,
|
|
16315
16413
|
pageTemplate
|
|
16316
16414
|
);
|
|
16317
|
-
await mkdir10(
|
|
16415
|
+
await mkdir10(path52.dirname(filePath), { recursive: true });
|
|
16318
16416
|
await writeFile13(filePath, tsx, "utf8");
|
|
16319
16417
|
const configResult = await wireNewDevPortalPageInConfig(
|
|
16320
16418
|
dir,
|
|
@@ -16327,7 +16425,7 @@ async function makeConfig(argv) {
|
|
|
16327
16425
|
pagePath: relativePagePath,
|
|
16328
16426
|
pageTemplate,
|
|
16329
16427
|
configUpdated: configResult.updated,
|
|
16330
|
-
configPath: configResult.configPath ?
|
|
16428
|
+
configPath: configResult.configPath ? path52.relative(dir, configResult.configPath) : null
|
|
16331
16429
|
};
|
|
16332
16430
|
changes.push("page_add");
|
|
16333
16431
|
}
|
|
@@ -16452,7 +16550,7 @@ var config_default = {
|
|
|
16452
16550
|
};
|
|
16453
16551
|
|
|
16454
16552
|
// src/cli/apply/handler.ts
|
|
16455
|
-
import
|
|
16553
|
+
import path63 from "node:path";
|
|
16456
16554
|
|
|
16457
16555
|
// src/cli/platform/tools/dev-portal-publish.ts
|
|
16458
16556
|
init_gateway_limits();
|
|
@@ -16531,8 +16629,8 @@ function normalizeActionKey(actionKey) {
|
|
|
16531
16629
|
const trimmed = actionKey.trim();
|
|
16532
16630
|
if (trimmed.includes(":")) {
|
|
16533
16631
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
16534
|
-
const
|
|
16535
|
-
return `${method2.toLowerCase()}:${
|
|
16632
|
+
const path73 = pathParts.join(":").trim();
|
|
16633
|
+
return `${method2.toLowerCase()}:${path73.startsWith("/") ? path73 : `/${path73}`}`;
|
|
16536
16634
|
}
|
|
16537
16635
|
const spaceIndex = trimmed.indexOf(" ");
|
|
16538
16636
|
if (spaceIndex <= 0) {
|
|
@@ -16541,8 +16639,8 @@ function normalizeActionKey(actionKey) {
|
|
|
16541
16639
|
);
|
|
16542
16640
|
}
|
|
16543
16641
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
16544
|
-
const
|
|
16545
|
-
return `${method}:${
|
|
16642
|
+
const path72 = trimmed.slice(spaceIndex + 1).trim();
|
|
16643
|
+
return `${method}:${path72.startsWith("/") ? path72 : `/${path72}`}`;
|
|
16546
16644
|
}
|
|
16547
16645
|
async function applyGatewayPublicRoutes(client, projectId, routes, options) {
|
|
16548
16646
|
const applied = [];
|
|
@@ -16971,13 +17069,13 @@ async function syncDevPortalPlanCatalog(options) {
|
|
|
16971
17069
|
const retries = Math.max(1, options.retries ?? DEFAULT_RETRIES);
|
|
16972
17070
|
const retryDelayMs = options.retryDelayMs ?? DEFAULT_RETRY_DELAY_MS;
|
|
16973
17071
|
const base = options.backendApiBaseUrl.replace(/\/$/, "");
|
|
16974
|
-
const
|
|
17072
|
+
const url2 = `${base}/api/v1/plans?refresh=true&force=true`;
|
|
16975
17073
|
let lastError;
|
|
16976
17074
|
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
16977
17075
|
const controller = new AbortController();
|
|
16978
17076
|
const timeout = setTimeout(() => controller.abort(), PLANS_TIMEOUT_MS);
|
|
16979
17077
|
try {
|
|
16980
|
-
const response = await fetchImpl(
|
|
17078
|
+
const response = await fetchImpl(url2, {
|
|
16981
17079
|
method: "GET",
|
|
16982
17080
|
headers: { Accept: "application/json" },
|
|
16983
17081
|
signal: controller.signal
|
|
@@ -17612,10 +17710,10 @@ async function validateDevPortalReadiness(client, projectId, options) {
|
|
|
17612
17710
|
|
|
17613
17711
|
// src/cli/platform/helpers/publish-ledger.ts
|
|
17614
17712
|
import { mkdir as mkdir11, readFile as readFile15, writeFile as writeFile14 } from "node:fs/promises";
|
|
17615
|
-
import
|
|
17713
|
+
import path53 from "node:path";
|
|
17616
17714
|
var PUBLISH_LEDGER_RELATIVE_PATH = ".apitogo/publish-state.json";
|
|
17617
17715
|
function publishLedgerPath(siteDirectory) {
|
|
17618
|
-
return
|
|
17716
|
+
return path53.join(path53.resolve(siteDirectory), PUBLISH_LEDGER_RELATIVE_PATH);
|
|
17619
17717
|
}
|
|
17620
17718
|
async function readPublishLedger(siteDirectory) {
|
|
17621
17719
|
const filePath = publishLedgerPath(siteDirectory);
|
|
@@ -17632,7 +17730,7 @@ async function readPublishLedger(siteDirectory) {
|
|
|
17632
17730
|
}
|
|
17633
17731
|
async function writePublishLedger(siteDirectory, ledger) {
|
|
17634
17732
|
const filePath = publishLedgerPath(siteDirectory);
|
|
17635
|
-
await mkdir11(
|
|
17733
|
+
await mkdir11(path53.dirname(filePath), { recursive: true });
|
|
17636
17734
|
const next = {
|
|
17637
17735
|
...ledger,
|
|
17638
17736
|
version: 1,
|
|
@@ -17702,12 +17800,12 @@ async function waitForGatewayActionsRegistered(client, projectId, options) {
|
|
|
17702
17800
|
|
|
17703
17801
|
// src/cli/platform/helpers/deploy-artifact-hash.ts
|
|
17704
17802
|
import { createHash as createHash2 } from "node:crypto";
|
|
17705
|
-
import { createReadStream, promises as
|
|
17706
|
-
import
|
|
17803
|
+
import { createReadStream, promises as fs8 } from "node:fs";
|
|
17804
|
+
import path55 from "node:path";
|
|
17707
17805
|
|
|
17708
17806
|
// src/cli/platform/helpers/package-files.ts
|
|
17709
|
-
import { promises as
|
|
17710
|
-
import
|
|
17807
|
+
import { promises as fs7 } from "node:fs";
|
|
17808
|
+
import path54 from "node:path";
|
|
17711
17809
|
import ignore from "ignore";
|
|
17712
17810
|
var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
17713
17811
|
"node_modules",
|
|
@@ -17720,20 +17818,20 @@ var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
|
17720
17818
|
async function loadGitignore(rootDir) {
|
|
17721
17819
|
const ig = ignore();
|
|
17722
17820
|
ig.add(["node_modules/", ".git/", "dist/", "bin/", "obj/"]);
|
|
17723
|
-
const gitignorePath =
|
|
17821
|
+
const gitignorePath = path54.join(rootDir, ".gitignore");
|
|
17724
17822
|
try {
|
|
17725
|
-
const content = await
|
|
17823
|
+
const content = await fs7.readFile(gitignorePath, "utf8");
|
|
17726
17824
|
ig.add(content);
|
|
17727
17825
|
} catch {
|
|
17728
17826
|
}
|
|
17729
17827
|
return ig;
|
|
17730
17828
|
}
|
|
17731
17829
|
async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
17732
|
-
const absDir =
|
|
17733
|
-
const entries = await
|
|
17830
|
+
const absDir = path54.join(rootDir, relativeDir);
|
|
17831
|
+
const entries = await fs7.readdir(absDir, { withFileTypes: true });
|
|
17734
17832
|
for (const entry of entries) {
|
|
17735
|
-
const rel = relativeDir ?
|
|
17736
|
-
const relPosix = rel.split(
|
|
17833
|
+
const rel = relativeDir ? path54.join(relativeDir, entry.name) : entry.name;
|
|
17834
|
+
const relPosix = rel.split(path54.sep).join("/");
|
|
17737
17835
|
if (DEFAULT_EXCLUDES.has(entry.name) && !relativeDir) {
|
|
17738
17836
|
continue;
|
|
17739
17837
|
}
|
|
@@ -17748,8 +17846,8 @@ async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
|
17748
17846
|
}
|
|
17749
17847
|
}
|
|
17750
17848
|
async function collectPackageableFiles(sourceDirectory) {
|
|
17751
|
-
const resolved =
|
|
17752
|
-
const stat4 = await
|
|
17849
|
+
const resolved = path54.resolve(sourceDirectory);
|
|
17850
|
+
const stat4 = await fs7.stat(resolved).catch(() => null);
|
|
17753
17851
|
if (!stat4?.isDirectory()) {
|
|
17754
17852
|
throw new Error(`sourceDirectory is not a directory: ${resolved}`);
|
|
17755
17853
|
}
|
|
@@ -17774,19 +17872,19 @@ async function sha256File(filePath) {
|
|
|
17774
17872
|
return hash2.digest("hex");
|
|
17775
17873
|
}
|
|
17776
17874
|
async function hashDirectoryContents(rootDirectory) {
|
|
17777
|
-
const resolved =
|
|
17875
|
+
const resolved = path55.resolve(rootDirectory);
|
|
17778
17876
|
const files = (await collectPackageableFiles(resolved)).sort((a, b) => a.localeCompare(b));
|
|
17779
17877
|
const hash2 = createHash2("sha256");
|
|
17780
17878
|
for (const rel of files) {
|
|
17781
17879
|
hash2.update(rel);
|
|
17782
17880
|
hash2.update("\0");
|
|
17783
|
-
hash2.update(await
|
|
17881
|
+
hash2.update(await fs8.readFile(path55.join(resolved, rel)));
|
|
17784
17882
|
hash2.update("\0");
|
|
17785
17883
|
}
|
|
17786
17884
|
return hash2.digest("hex");
|
|
17787
17885
|
}
|
|
17788
17886
|
async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
17789
|
-
const resolved =
|
|
17887
|
+
const resolved = path55.resolve(siteDirectory);
|
|
17790
17888
|
const hash2 = createHash2("sha256");
|
|
17791
17889
|
const candidates = [
|
|
17792
17890
|
"apitogo.config.json",
|
|
@@ -17796,19 +17894,19 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
17796
17894
|
"zudoku.config.tsx"
|
|
17797
17895
|
];
|
|
17798
17896
|
for (const name of candidates) {
|
|
17799
|
-
const full =
|
|
17897
|
+
const full = path55.join(resolved, name);
|
|
17800
17898
|
try {
|
|
17801
17899
|
hash2.update(name);
|
|
17802
17900
|
hash2.update("\0");
|
|
17803
|
-
hash2.update(await
|
|
17901
|
+
hash2.update(await fs8.readFile(full));
|
|
17804
17902
|
hash2.update("\0");
|
|
17805
17903
|
} catch {
|
|
17806
17904
|
}
|
|
17807
17905
|
}
|
|
17808
17906
|
for (const dir of ["pages", "landing", "src"]) {
|
|
17809
|
-
const full =
|
|
17907
|
+
const full = path55.join(resolved, dir);
|
|
17810
17908
|
try {
|
|
17811
|
-
const st = await
|
|
17909
|
+
const st = await fs8.stat(full);
|
|
17812
17910
|
if (!st.isDirectory()) continue;
|
|
17813
17911
|
hash2.update(dir);
|
|
17814
17912
|
hash2.update("\0");
|
|
@@ -17829,7 +17927,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
17829
17927
|
|
|
17830
17928
|
// src/cli/platform/helpers/openapi-gateway-servers.ts
|
|
17831
17929
|
import { mkdir as mkdir12, readFile as readFile16, writeFile as writeFile15 } from "node:fs/promises";
|
|
17832
|
-
import
|
|
17930
|
+
import path56 from "node:path";
|
|
17833
17931
|
import YAML3 from "yaml";
|
|
17834
17932
|
var GATEWAY_URL_ENV_KEY = "APITOGO_GATEWAY_URL";
|
|
17835
17933
|
var PUBLISH_OPENAPI_RELATIVE = ".apitogo/openapi-publish.json";
|
|
@@ -17837,10 +17935,10 @@ function normalizeGatewayUrl(gatewayUrl) {
|
|
|
17837
17935
|
return gatewayUrl.trim().replace(/\/+$/, "");
|
|
17838
17936
|
}
|
|
17839
17937
|
function withGatewayServers(doc, gatewayUrl) {
|
|
17840
|
-
const
|
|
17938
|
+
const url2 = normalizeGatewayUrl(gatewayUrl);
|
|
17841
17939
|
return {
|
|
17842
17940
|
...doc,
|
|
17843
|
-
servers: [{ url, description: "API gateway" }]
|
|
17941
|
+
servers: [{ url: url2, description: "API gateway" }]
|
|
17844
17942
|
};
|
|
17845
17943
|
}
|
|
17846
17944
|
async function resolveProjectGatewayUrl(client, projectId) {
|
|
@@ -17861,7 +17959,7 @@ async function resolveProjectGatewayUrl(client, projectId) {
|
|
|
17861
17959
|
}
|
|
17862
17960
|
async function readOpenApiDocument(filePath) {
|
|
17863
17961
|
const content = await readFile16(filePath, "utf8");
|
|
17864
|
-
const ext =
|
|
17962
|
+
const ext = path56.extname(filePath).toLowerCase();
|
|
17865
17963
|
const parsed = ext === ".json" ? JSON.parse(content) : YAML3.parse(content);
|
|
17866
17964
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
17867
17965
|
throw new Error(`OpenAPI document must be an object: ${filePath}`);
|
|
@@ -17869,19 +17967,19 @@ async function readOpenApiDocument(filePath) {
|
|
|
17869
17967
|
return parsed;
|
|
17870
17968
|
}
|
|
17871
17969
|
async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApiPath, gatewayUrl) {
|
|
17872
|
-
const site =
|
|
17873
|
-
const source =
|
|
17970
|
+
const site = path56.resolve(siteDirectory);
|
|
17971
|
+
const source = path56.resolve(sourceOpenApiPath);
|
|
17874
17972
|
const relativeInput = PUBLISH_OPENAPI_RELATIVE;
|
|
17875
|
-
const outputPath =
|
|
17973
|
+
const outputPath = path56.join(site, ...relativeInput.split("/"));
|
|
17876
17974
|
const doc = await readOpenApiDocument(source);
|
|
17877
17975
|
const rewritten = withGatewayServers(doc, gatewayUrl);
|
|
17878
|
-
await mkdir12(
|
|
17976
|
+
await mkdir12(path56.dirname(outputPath), { recursive: true });
|
|
17879
17977
|
await writeFile15(outputPath, `${JSON.stringify(rewritten, null, 2)}
|
|
17880
17978
|
`, "utf8");
|
|
17881
17979
|
return { outputPath, relativeInput };
|
|
17882
17980
|
}
|
|
17883
17981
|
async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
17884
|
-
const configPath =
|
|
17982
|
+
const configPath = path56.join(path56.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
|
|
17885
17983
|
const raw = await readFile16(configPath, "utf8");
|
|
17886
17984
|
const config2 = JSON.parse(raw);
|
|
17887
17985
|
const previousApis = config2.apis;
|
|
@@ -17917,14 +18015,14 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
|
17917
18015
|
};
|
|
17918
18016
|
}
|
|
17919
18017
|
async function prepareOpenApiServersForGatewayBuild(options) {
|
|
17920
|
-
const siteDirectory =
|
|
18018
|
+
const siteDirectory = path56.resolve(options.siteDirectory);
|
|
17921
18019
|
let openApiPath = resolveBackendOpenApiPath(options.manifest?.backend?.openApiPath, {
|
|
17922
18020
|
siteDirectory,
|
|
17923
18021
|
backendSourceDirectory: options.manifest?.backend?.sourceDirectory
|
|
17924
18022
|
});
|
|
17925
18023
|
if (!openApiPath) {
|
|
17926
18024
|
try {
|
|
17927
|
-
const raw = await readFile16(
|
|
18025
|
+
const raw = await readFile16(path56.join(siteDirectory, APITOGO_CONFIG_FILENAME2), "utf8");
|
|
17928
18026
|
const config2 = JSON.parse(raw);
|
|
17929
18027
|
const input3 = Array.isArray(config2.apis) ? config2.apis[0]?.input?.trim() : void 0;
|
|
17930
18028
|
openApiPath = resolveBackendOpenApiPath(input3, { siteDirectory });
|
|
@@ -17946,7 +18044,7 @@ async function prepareOpenApiServersForGatewayBuild(options) {
|
|
|
17946
18044
|
// src/cli/platform/helpers/backend-packaging.ts
|
|
17947
18045
|
import { mkdtemp, readdir, rm as rm5 } from "node:fs/promises";
|
|
17948
18046
|
import { tmpdir } from "node:os";
|
|
17949
|
-
import
|
|
18047
|
+
import path57 from "node:path";
|
|
17950
18048
|
import { spawn as spawn3 } from "node:child_process";
|
|
17951
18049
|
async function directoryHasRuntimeConfig(dir) {
|
|
17952
18050
|
if (!await pathExists(dir)) {
|
|
@@ -17990,20 +18088,20 @@ function runDotnetPublish(projectDir, outputDir) {
|
|
|
17990
18088
|
async function findCsproj(projectDir) {
|
|
17991
18089
|
const entries = await readdir(projectDir);
|
|
17992
18090
|
const csproj = entries.find((name) => name.endsWith(".csproj"));
|
|
17993
|
-
return csproj ?
|
|
18091
|
+
return csproj ? path57.join(projectDir, csproj) : null;
|
|
17994
18092
|
}
|
|
17995
18093
|
async function prepareBackendPackagingDirectory(args) {
|
|
17996
|
-
const sourceDirectory =
|
|
18094
|
+
const sourceDirectory = path57.resolve(args.sourceDirectory);
|
|
17997
18095
|
if (args.publishDirectory?.trim()) {
|
|
17998
18096
|
return {
|
|
17999
|
-
directory:
|
|
18097
|
+
directory: path57.resolve(args.publishDirectory),
|
|
18000
18098
|
packagingMode: "published"
|
|
18001
18099
|
};
|
|
18002
18100
|
}
|
|
18003
18101
|
if (await directoryHasRuntimeConfig(sourceDirectory)) {
|
|
18004
18102
|
return { directory: sourceDirectory, packagingMode: "published" };
|
|
18005
18103
|
}
|
|
18006
|
-
const publishSubdir =
|
|
18104
|
+
const publishSubdir = path57.join(sourceDirectory, "publish");
|
|
18007
18105
|
if (await directoryHasRuntimeConfig(publishSubdir)) {
|
|
18008
18106
|
return { directory: publishSubdir, packagingMode: "published" };
|
|
18009
18107
|
}
|
|
@@ -18014,8 +18112,8 @@ async function prepareBackendPackagingDirectory(args) {
|
|
|
18014
18112
|
if (!csproj) {
|
|
18015
18113
|
return { directory: sourceDirectory, packagingMode: "source" };
|
|
18016
18114
|
}
|
|
18017
|
-
const tempRoot = await mkdtemp(
|
|
18018
|
-
const outputDir =
|
|
18115
|
+
const tempRoot = await mkdtemp(path57.join(tmpdir(), "apitogo-dotnet-publish-"));
|
|
18116
|
+
const outputDir = path57.join(tempRoot, "publish");
|
|
18019
18117
|
const result = await runDotnetPublish(sourceDirectory, outputDir);
|
|
18020
18118
|
if (result.exitCode !== 0) {
|
|
18021
18119
|
await rm5(tempRoot, { recursive: true, force: true });
|
|
@@ -18059,14 +18157,14 @@ function formatJobStatusResponse(options) {
|
|
|
18059
18157
|
}
|
|
18060
18158
|
|
|
18061
18159
|
// src/cli/platform/helpers/zip.ts
|
|
18062
|
-
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as
|
|
18160
|
+
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as fs9 } from "node:fs";
|
|
18063
18161
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
18064
|
-
import
|
|
18162
|
+
import path58 from "node:path";
|
|
18065
18163
|
import { ZipArchive } from "archiver";
|
|
18066
18164
|
async function packageBackendDirectory(sourceDirectory) {
|
|
18067
|
-
const resolved =
|
|
18165
|
+
const resolved = path58.resolve(sourceDirectory);
|
|
18068
18166
|
const files = await collectPackageableFiles(resolved);
|
|
18069
|
-
const zipPath =
|
|
18167
|
+
const zipPath = path58.join(
|
|
18070
18168
|
tmpdir2(),
|
|
18071
18169
|
`apitogo-backend-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`
|
|
18072
18170
|
);
|
|
@@ -18078,15 +18176,15 @@ async function packageBackendDirectory(sourceDirectory) {
|
|
|
18078
18176
|
output2.on("error", reject);
|
|
18079
18177
|
archive.pipe(output2);
|
|
18080
18178
|
for (const rel of files) {
|
|
18081
|
-
archive.append(createReadStream2(
|
|
18179
|
+
archive.append(createReadStream2(path58.join(resolved, rel)), { name: rel.split(path58.sep).join("/") });
|
|
18082
18180
|
}
|
|
18083
18181
|
void archive.finalize();
|
|
18084
18182
|
});
|
|
18085
|
-
const { size } = await
|
|
18183
|
+
const { size } = await fs9.stat(zipPath);
|
|
18086
18184
|
return { zipPath, byteSize: size };
|
|
18087
18185
|
}
|
|
18088
18186
|
async function cleanupZip(zipPath) {
|
|
18089
|
-
await
|
|
18187
|
+
await fs9.unlink(zipPath).catch(() => void 0);
|
|
18090
18188
|
}
|
|
18091
18189
|
|
|
18092
18190
|
// src/cli/platform/tools/infrastructure.ts
|
|
@@ -19460,13 +19558,13 @@ async function resolveProjectIdForPublish(client, config2, args, wait, progress,
|
|
|
19460
19558
|
}
|
|
19461
19559
|
|
|
19462
19560
|
// src/cli/platform/tools/dev-portal.ts
|
|
19463
|
-
import { promises as
|
|
19464
|
-
import
|
|
19561
|
+
import { promises as fs11 } from "node:fs";
|
|
19562
|
+
import path61 from "node:path";
|
|
19465
19563
|
|
|
19466
19564
|
// src/cli/platform/helpers/tarball.ts
|
|
19467
|
-
import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as
|
|
19565
|
+
import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as fs10 } from "node:fs";
|
|
19468
19566
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
19469
|
-
import
|
|
19567
|
+
import path59 from "node:path";
|
|
19470
19568
|
import { TarArchive } from "archiver";
|
|
19471
19569
|
var DEV_PORTAL_DEPLOY_ARCHIVE_ROOT = "dist";
|
|
19472
19570
|
function normalizeArchiveRoot(archiveRoot) {
|
|
@@ -19477,10 +19575,10 @@ function normalizeArchiveRoot(archiveRoot) {
|
|
|
19477
19575
|
return `${trimmed}/`;
|
|
19478
19576
|
}
|
|
19479
19577
|
async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
19480
|
-
const resolved =
|
|
19578
|
+
const resolved = path59.resolve(sourceDirectory);
|
|
19481
19579
|
const files = await collectPackageableFiles(resolved);
|
|
19482
19580
|
const entryPrefix = options?.archiveRoot ? normalizeArchiveRoot(options.archiveRoot) : "";
|
|
19483
|
-
const archivePath =
|
|
19581
|
+
const archivePath = path59.join(
|
|
19484
19582
|
tmpdir3(),
|
|
19485
19583
|
`apitogo-docs-${Date.now()}-${Math.random().toString(36).slice(2)}.tgz`
|
|
19486
19584
|
);
|
|
@@ -19492,16 +19590,16 @@ async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
|
19492
19590
|
output2.on("error", reject);
|
|
19493
19591
|
archive.pipe(output2);
|
|
19494
19592
|
for (const rel of files) {
|
|
19495
|
-
const entryName = entryPrefix + rel.split(
|
|
19496
|
-
archive.append(createReadStream3(
|
|
19593
|
+
const entryName = entryPrefix + rel.split(path59.sep).join("/");
|
|
19594
|
+
archive.append(createReadStream3(path59.join(resolved, rel)), { name: entryName });
|
|
19497
19595
|
}
|
|
19498
19596
|
void archive.finalize();
|
|
19499
19597
|
});
|
|
19500
|
-
const { size } = await
|
|
19598
|
+
const { size } = await fs10.stat(archivePath);
|
|
19501
19599
|
return { archivePath, byteSize: size };
|
|
19502
19600
|
}
|
|
19503
19601
|
async function cleanupArchive(archivePath) {
|
|
19504
|
-
await
|
|
19602
|
+
await fs10.unlink(archivePath).catch(() => void 0);
|
|
19505
19603
|
}
|
|
19506
19604
|
function isTarGzPath(filePath) {
|
|
19507
19605
|
const normalized = filePath.toLowerCase();
|
|
@@ -19617,7 +19715,7 @@ async function snapshotBackendUpdateJobIds(client, projectId) {
|
|
|
19617
19715
|
|
|
19618
19716
|
// src/cli/platform/helpers/dev-portal-site-api-url.ts
|
|
19619
19717
|
import { readdir as readdir2, readFile as readFile17, writeFile as writeFile16 } from "node:fs/promises";
|
|
19620
|
-
import
|
|
19718
|
+
import path60 from "node:path";
|
|
19621
19719
|
var SITE_API_BASE_URL_ENV_KEY = "VITE_APITOGO_AUTHENTICATION_API_BASE_URL";
|
|
19622
19720
|
var PLACEHOLDER_HOST_MARKERS = [
|
|
19623
19721
|
"dp-example.azurecontainerapps.io",
|
|
@@ -19635,10 +19733,10 @@ function isPlaceholderDevPortalApiUrl(apiBaseUrl) {
|
|
|
19635
19733
|
return PLACEHOLDER_HOST_MARKERS.some((marker) => normalized.includes(marker));
|
|
19636
19734
|
}
|
|
19637
19735
|
async function readSiteApiBaseUrl(sourceDirectory) {
|
|
19638
|
-
const resolved =
|
|
19736
|
+
const resolved = path60.resolve(sourceDirectory);
|
|
19639
19737
|
for (const envFile of [".env", ".env.production"]) {
|
|
19640
19738
|
try {
|
|
19641
|
-
const content = await readFile17(
|
|
19739
|
+
const content = await readFile17(path60.join(resolved, envFile), "utf8");
|
|
19642
19740
|
const lines = [...content.matchAll(ENV_LINE_GLOBAL_RE)];
|
|
19643
19741
|
if (lines.length === 0) {
|
|
19644
19742
|
continue;
|
|
@@ -19663,11 +19761,11 @@ async function readSiteApiBaseUrl(sourceDirectory) {
|
|
|
19663
19761
|
return null;
|
|
19664
19762
|
}
|
|
19665
19763
|
async function patchSiteApiBaseUrl(sourceDirectory, apiBaseUrl) {
|
|
19666
|
-
const resolved =
|
|
19764
|
+
const resolved = path60.resolve(sourceDirectory);
|
|
19667
19765
|
const line = `${SITE_API_BASE_URL_ENV_KEY}=${apiBaseUrl}`;
|
|
19668
19766
|
let patchedExisting = false;
|
|
19669
19767
|
for (const envFile of [".env.production", ".env"]) {
|
|
19670
|
-
const envPath =
|
|
19768
|
+
const envPath = path60.join(resolved, envFile);
|
|
19671
19769
|
try {
|
|
19672
19770
|
const content = await readFile17(envPath, "utf8");
|
|
19673
19771
|
const withoutAssignments = content.replace(ENV_LINE_GLOBAL_RE, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
@@ -19681,7 +19779,7 @@ ${line}
|
|
|
19681
19779
|
}
|
|
19682
19780
|
}
|
|
19683
19781
|
if (!patchedExisting) {
|
|
19684
|
-
await writeFile16(
|
|
19782
|
+
await writeFile16(path60.join(resolved, ".env"), `${line}
|
|
19685
19783
|
`);
|
|
19686
19784
|
}
|
|
19687
19785
|
}
|
|
@@ -19689,7 +19787,7 @@ function tryProjectId(explicit, manifestProjectId, config2) {
|
|
|
19689
19787
|
return explicit?.trim() || manifestProjectId?.trim() || config2.defaultProjectId?.trim() || void 0;
|
|
19690
19788
|
}
|
|
19691
19789
|
async function ensureLiveSiteApiBaseUrlForBuild(_client, config2, args, resolveFromProject) {
|
|
19692
|
-
const sourceDirectory =
|
|
19790
|
+
const sourceDirectory = path60.resolve(args.sourceDirectory);
|
|
19693
19791
|
const explicit = args.apiBaseUrl?.trim();
|
|
19694
19792
|
if (explicit && !isPlaceholderDevPortalApiUrl(explicit)) {
|
|
19695
19793
|
await patchSiteApiBaseUrl(sourceDirectory, explicit);
|
|
@@ -19725,7 +19823,7 @@ async function* walkFiles(root) {
|
|
|
19725
19823
|
return;
|
|
19726
19824
|
}
|
|
19727
19825
|
for (const entry of entries) {
|
|
19728
|
-
const full =
|
|
19826
|
+
const full = path60.join(root, entry.name);
|
|
19729
19827
|
if (entry.isDirectory()) {
|
|
19730
19828
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
19731
19829
|
continue;
|
|
@@ -19737,8 +19835,8 @@ async function* walkFiles(root) {
|
|
|
19737
19835
|
}
|
|
19738
19836
|
}
|
|
19739
19837
|
async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiBaseUrl) {
|
|
19740
|
-
const dist =
|
|
19741
|
-
const siteRoot =
|
|
19838
|
+
const dist = path60.resolve(distDirectory);
|
|
19839
|
+
const siteRoot = path60.dirname(dist);
|
|
19742
19840
|
const fromEnv = expectedApiBaseUrl?.trim() || await readSiteApiBaseUrl(siteRoot) || await readSiteApiBaseUrl(dist);
|
|
19743
19841
|
if (!fromEnv || isPlaceholderDevPortalApiUrl(fromEnv)) {
|
|
19744
19842
|
throw new Error(
|
|
@@ -19993,8 +20091,8 @@ function validateDeployArchiveInput(args) {
|
|
|
19993
20091
|
async function resolveDevPortalArchive(args) {
|
|
19994
20092
|
validateDeployArchiveInput(args);
|
|
19995
20093
|
if (args.archivePath?.trim()) {
|
|
19996
|
-
const archivePath =
|
|
19997
|
-
const stat4 = await
|
|
20094
|
+
const archivePath = path61.resolve(args.archivePath.trim());
|
|
20095
|
+
const stat4 = await fs11.stat(archivePath).catch(() => null);
|
|
19998
20096
|
if (!stat4?.isFile()) {
|
|
19999
20097
|
throw new Error(`archivePath is not a file: ${archivePath}`);
|
|
20000
20098
|
}
|
|
@@ -20061,10 +20159,10 @@ async function handleDeployDevPortal(client, config2, args, progress) {
|
|
|
20061
20159
|
}
|
|
20062
20160
|
|
|
20063
20161
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
20064
|
-
import
|
|
20162
|
+
import path62 from "node:path";
|
|
20065
20163
|
async function handleBuildDevPortalSite(client, config2, args, progress) {
|
|
20066
20164
|
const buildProgress = progress?.child("Build dev portal site");
|
|
20067
|
-
const sourceDirectory =
|
|
20165
|
+
const sourceDirectory = path62.resolve(args.sourceDirectory);
|
|
20068
20166
|
await buildProgress?.onStep("Ensuring live portal API URL");
|
|
20069
20167
|
const apiBaseUrl = await ensureLiveSiteApiBaseUrlForBuild(
|
|
20070
20168
|
client,
|
|
@@ -20146,8 +20244,8 @@ function normalizeActionKeyFormat(actionKey) {
|
|
|
20146
20244
|
const trimmed = actionKey.trim();
|
|
20147
20245
|
if (trimmed.includes(":")) {
|
|
20148
20246
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
20149
|
-
const
|
|
20150
|
-
return `${method2.toLowerCase()}:${
|
|
20247
|
+
const path73 = pathParts.join(":").trim();
|
|
20248
|
+
return `${method2.toLowerCase()}:${path73.startsWith("/") ? path73 : `/${path73}`}`;
|
|
20151
20249
|
}
|
|
20152
20250
|
const spaceIndex = trimmed.indexOf(" ");
|
|
20153
20251
|
if (spaceIndex <= 0) {
|
|
@@ -20156,8 +20254,8 @@ function normalizeActionKeyFormat(actionKey) {
|
|
|
20156
20254
|
);
|
|
20157
20255
|
}
|
|
20158
20256
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
20159
|
-
const
|
|
20160
|
-
return `${method}:${
|
|
20257
|
+
const path72 = trimmed.slice(spaceIndex + 1).trim();
|
|
20258
|
+
return `${method}:${path72.startsWith("/") ? path72 : `/${path72}`}`;
|
|
20161
20259
|
}
|
|
20162
20260
|
function normalizePublicRoute(route) {
|
|
20163
20261
|
const trimmed = route.trim();
|
|
@@ -21038,7 +21136,7 @@ function resultLooksFailed(payload) {
|
|
|
21038
21136
|
}
|
|
21039
21137
|
}
|
|
21040
21138
|
async function apply(argv) {
|
|
21041
|
-
const sourceDirectory =
|
|
21139
|
+
const sourceDirectory = path63.resolve(process.cwd(), argv.dir);
|
|
21042
21140
|
const config2 = loadConfig();
|
|
21043
21141
|
const client = new PlatformApiClient(config2);
|
|
21044
21142
|
let only;
|
|
@@ -21123,11 +21221,11 @@ var deploy_default = {
|
|
|
21123
21221
|
};
|
|
21124
21222
|
|
|
21125
21223
|
// src/cli/init/handler.ts
|
|
21126
|
-
import
|
|
21224
|
+
import path66 from "node:path";
|
|
21127
21225
|
|
|
21128
21226
|
// src/cli/scaffold/run-scaffold-discovery.ts
|
|
21129
21227
|
import { access as access10, readFile as readFile19, writeFile as writeFile18 } from "node:fs/promises";
|
|
21130
|
-
import
|
|
21228
|
+
import path65 from "node:path";
|
|
21131
21229
|
|
|
21132
21230
|
// src/cli/scaffold/wire-docs.ts
|
|
21133
21231
|
import {
|
|
@@ -21140,7 +21238,7 @@ import {
|
|
|
21140
21238
|
symlink,
|
|
21141
21239
|
writeFile as writeFile17
|
|
21142
21240
|
} from "node:fs/promises";
|
|
21143
|
-
import
|
|
21241
|
+
import path64 from "node:path";
|
|
21144
21242
|
var DOCS_DIR_WHITELIST = [
|
|
21145
21243
|
"docs",
|
|
21146
21244
|
"documents",
|
|
@@ -21177,14 +21275,14 @@ async function isDirectory(filePath) {
|
|
|
21177
21275
|
}
|
|
21178
21276
|
}
|
|
21179
21277
|
function toPosix2(value) {
|
|
21180
|
-
return value.split(
|
|
21278
|
+
return value.split(path64.sep).join(path64.posix.sep);
|
|
21181
21279
|
}
|
|
21182
21280
|
function isWhitelistedDirName(name) {
|
|
21183
21281
|
return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
|
|
21184
21282
|
}
|
|
21185
21283
|
function isInside2(parent, child) {
|
|
21186
|
-
const relative =
|
|
21187
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
21284
|
+
const relative = path64.relative(parent, child);
|
|
21285
|
+
return relative === "" || !relative.startsWith("..") && !path64.isAbsolute(relative);
|
|
21188
21286
|
}
|
|
21189
21287
|
async function collectMarkdownFiles(dir) {
|
|
21190
21288
|
const files = [];
|
|
@@ -21198,7 +21296,7 @@ async function collectMarkdownFiles(dir) {
|
|
|
21198
21296
|
if (entry.name.startsWith(".")) {
|
|
21199
21297
|
continue;
|
|
21200
21298
|
}
|
|
21201
|
-
const full =
|
|
21299
|
+
const full = path64.join(dir, entry.name);
|
|
21202
21300
|
if (entry.isDirectory()) {
|
|
21203
21301
|
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink()) {
|
|
21204
21302
|
continue;
|
|
@@ -21213,11 +21311,11 @@ async function collectMarkdownFiles(dir) {
|
|
|
21213
21311
|
return files;
|
|
21214
21312
|
}
|
|
21215
21313
|
async function collectSearchRoots(siteDirectory) {
|
|
21216
|
-
const site =
|
|
21217
|
-
const parent =
|
|
21314
|
+
const site = path64.resolve(siteDirectory);
|
|
21315
|
+
const parent = path64.dirname(site);
|
|
21218
21316
|
const roots = [];
|
|
21219
21317
|
const add = (dir) => {
|
|
21220
|
-
const resolved =
|
|
21318
|
+
const resolved = path64.resolve(dir);
|
|
21221
21319
|
if (!roots.includes(resolved)) {
|
|
21222
21320
|
roots.push(resolved);
|
|
21223
21321
|
}
|
|
@@ -21230,7 +21328,7 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
21230
21328
|
if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
|
|
21231
21329
|
continue;
|
|
21232
21330
|
}
|
|
21233
|
-
add(
|
|
21331
|
+
add(path64.join(parent, entry.name));
|
|
21234
21332
|
}
|
|
21235
21333
|
} catch {
|
|
21236
21334
|
}
|
|
@@ -21239,13 +21337,13 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
21239
21337
|
return roots;
|
|
21240
21338
|
}
|
|
21241
21339
|
async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
21242
|
-
const site =
|
|
21243
|
-
const sitePages =
|
|
21340
|
+
const site = path64.resolve(siteDirectory);
|
|
21341
|
+
const sitePages = path64.join(site, PAGES_DIR);
|
|
21244
21342
|
const searchedDirectories = await collectSearchRoots(site);
|
|
21245
21343
|
const directories = [];
|
|
21246
21344
|
const seen = /* @__PURE__ */ new Set();
|
|
21247
21345
|
const consider = async (dir) => {
|
|
21248
|
-
const resolved =
|
|
21346
|
+
const resolved = path64.resolve(dir);
|
|
21249
21347
|
if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
|
|
21250
21348
|
return;
|
|
21251
21349
|
}
|
|
@@ -21262,7 +21360,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
21262
21360
|
directories.push({ sourceDirectory: resolved, files });
|
|
21263
21361
|
};
|
|
21264
21362
|
for (const root of searchedDirectories) {
|
|
21265
|
-
if (isWhitelistedDirName(
|
|
21363
|
+
if (isWhitelistedDirName(path64.basename(root))) {
|
|
21266
21364
|
await consider(root);
|
|
21267
21365
|
}
|
|
21268
21366
|
try {
|
|
@@ -21274,7 +21372,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
21274
21372
|
if (!isWhitelistedDirName(entry.name)) {
|
|
21275
21373
|
continue;
|
|
21276
21374
|
}
|
|
21277
|
-
await consider(
|
|
21375
|
+
await consider(path64.join(root, entry.name));
|
|
21278
21376
|
}
|
|
21279
21377
|
} catch {
|
|
21280
21378
|
}
|
|
@@ -21285,8 +21383,8 @@ function slugifyDirName(name) {
|
|
|
21285
21383
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
21286
21384
|
}
|
|
21287
21385
|
async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
21288
|
-
const base = slugifyDirName(
|
|
21289
|
-
const parent = slugifyDirName(
|
|
21386
|
+
const base = slugifyDirName(path64.basename(sourceDirectory));
|
|
21387
|
+
const parent = slugifyDirName(path64.basename(path64.dirname(sourceDirectory)));
|
|
21290
21388
|
const candidates = [base, `${parent}-${base}`];
|
|
21291
21389
|
let index = 2;
|
|
21292
21390
|
while (true) {
|
|
@@ -21294,7 +21392,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
|
21294
21392
|
if (used.has(name)) {
|
|
21295
21393
|
continue;
|
|
21296
21394
|
}
|
|
21297
|
-
const target =
|
|
21395
|
+
const target = path64.join(pagesDir, name);
|
|
21298
21396
|
if (await pathExists5(target)) {
|
|
21299
21397
|
const stat4 = await lstat(target);
|
|
21300
21398
|
if (!stat4.isDirectory() || !await isManagedLinkDir(target)) {
|
|
@@ -21325,8 +21423,8 @@ async function alreadyLinked(linkPath, sourcePath) {
|
|
|
21325
21423
|
return false;
|
|
21326
21424
|
}
|
|
21327
21425
|
const current = await readlink(linkPath);
|
|
21328
|
-
const resolved =
|
|
21329
|
-
return resolved ===
|
|
21426
|
+
const resolved = path64.resolve(path64.dirname(linkPath), current);
|
|
21427
|
+
return resolved === path64.resolve(sourcePath);
|
|
21330
21428
|
} catch {
|
|
21331
21429
|
return false;
|
|
21332
21430
|
}
|
|
@@ -21338,8 +21436,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
|
|
|
21338
21436
|
if (await pathExists5(linkPath)) {
|
|
21339
21437
|
return "skipped";
|
|
21340
21438
|
}
|
|
21341
|
-
await mkdir13(
|
|
21342
|
-
const relativeTarget =
|
|
21439
|
+
await mkdir13(path64.dirname(linkPath), { recursive: true });
|
|
21440
|
+
const relativeTarget = path64.relative(path64.dirname(linkPath), sourcePath);
|
|
21343
21441
|
await symlink(
|
|
21344
21442
|
relativeTarget,
|
|
21345
21443
|
linkPath,
|
|
@@ -21354,7 +21452,7 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
21354
21452
|
if (routes.length === 0) {
|
|
21355
21453
|
return;
|
|
21356
21454
|
}
|
|
21357
|
-
const configPath =
|
|
21455
|
+
const configPath = path64.join(siteDirectory, CONFIG_FILENAME);
|
|
21358
21456
|
if (!await pathExists5(configPath)) {
|
|
21359
21457
|
return;
|
|
21360
21458
|
}
|
|
@@ -21370,8 +21468,8 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
21370
21468
|
`, "utf8");
|
|
21371
21469
|
}
|
|
21372
21470
|
async function discoverAndWireDocs(siteDirectory) {
|
|
21373
|
-
const site =
|
|
21374
|
-
const pagesDir =
|
|
21471
|
+
const site = path64.resolve(siteDirectory);
|
|
21472
|
+
const pagesDir = path64.join(site, PAGES_DIR);
|
|
21375
21473
|
const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
|
|
21376
21474
|
if (directories.length === 0) {
|
|
21377
21475
|
return {
|
|
@@ -21393,14 +21491,14 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
21393
21491
|
directory.sourceDirectory,
|
|
21394
21492
|
usedNames
|
|
21395
21493
|
);
|
|
21396
|
-
const linkDirectory =
|
|
21494
|
+
const linkDirectory = path64.join(pagesDir, linkName);
|
|
21397
21495
|
const linked = [];
|
|
21398
21496
|
const skipped = [];
|
|
21399
21497
|
for (const sourcePath of directory.files) {
|
|
21400
21498
|
const relativeSource = toPosix2(
|
|
21401
|
-
|
|
21499
|
+
path64.relative(directory.sourceDirectory, sourcePath)
|
|
21402
21500
|
);
|
|
21403
|
-
const linkPath =
|
|
21501
|
+
const linkPath = path64.join(linkDirectory, relativeSource);
|
|
21404
21502
|
const result = await linkMarkdownFile(sourcePath, linkPath);
|
|
21405
21503
|
if (result === "skipped") {
|
|
21406
21504
|
skipped.push({
|
|
@@ -21409,7 +21507,7 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
21409
21507
|
});
|
|
21410
21508
|
continue;
|
|
21411
21509
|
}
|
|
21412
|
-
const relativeLink = toPosix2(
|
|
21510
|
+
const relativeLink = toPosix2(path64.relative(site, linkPath));
|
|
21413
21511
|
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
21414
21512
|
linked.push({ sourcePath, linkPath, route, relativeSource });
|
|
21415
21513
|
routes.push(route);
|
|
@@ -21442,11 +21540,11 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
21442
21540
|
};
|
|
21443
21541
|
}
|
|
21444
21542
|
function siteRelative(siteDirectory, filePath) {
|
|
21445
|
-
const relative = toPosix2(
|
|
21543
|
+
const relative = toPosix2(path64.relative(siteDirectory, filePath));
|
|
21446
21544
|
if (!relative) {
|
|
21447
21545
|
return ".";
|
|
21448
21546
|
}
|
|
21449
|
-
if (
|
|
21547
|
+
if (path64.isAbsolute(relative)) {
|
|
21450
21548
|
return toPosix2(filePath);
|
|
21451
21549
|
}
|
|
21452
21550
|
if (relative.startsWith("..")) {
|
|
@@ -21513,7 +21611,7 @@ async function pathExists6(filePath) {
|
|
|
21513
21611
|
}
|
|
21514
21612
|
async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
|
|
21515
21613
|
const input3 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
|
|
21516
|
-
const jsonConfigPath =
|
|
21614
|
+
const jsonConfigPath = path65.join(siteDirectory, "apitogo.config.json");
|
|
21517
21615
|
const raw = await readFile19(jsonConfigPath, "utf8");
|
|
21518
21616
|
const siteConfig = JSON.parse(raw);
|
|
21519
21617
|
const updated = applyOpenApiToSiteConfig(siteConfig, {
|
|
@@ -21565,7 +21663,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
|
|
|
21565
21663
|
wired: false
|
|
21566
21664
|
};
|
|
21567
21665
|
}
|
|
21568
|
-
const jsonConfigPath =
|
|
21666
|
+
const jsonConfigPath = path65.join(siteDirectory, "apitogo.config.json");
|
|
21569
21667
|
if (!await pathExists6(jsonConfigPath)) {
|
|
21570
21668
|
return {
|
|
21571
21669
|
openApiDiscovery: {
|
|
@@ -21626,8 +21724,8 @@ function slugifyName2(name) {
|
|
|
21626
21724
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
|
|
21627
21725
|
}
|
|
21628
21726
|
function resolveInitOutputDirectory(dirArg, name) {
|
|
21629
|
-
const resolved =
|
|
21630
|
-
const base =
|
|
21727
|
+
const resolved = path66.resolve(process.cwd(), dirArg);
|
|
21728
|
+
const base = path66.basename(resolved);
|
|
21631
21729
|
const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
|
|
21632
21730
|
if (isDot) {
|
|
21633
21731
|
const fromName = name?.trim();
|
|
@@ -21637,7 +21735,7 @@ function resolveInitOutputDirectory(dirArg, name) {
|
|
|
21637
21735
|
);
|
|
21638
21736
|
}
|
|
21639
21737
|
return {
|
|
21640
|
-
outputDirectory:
|
|
21738
|
+
outputDirectory: path66.resolve(process.cwd(), slugifyName2(fromName)),
|
|
21641
21739
|
siteName: fromName
|
|
21642
21740
|
};
|
|
21643
21741
|
}
|
|
@@ -21784,6 +21882,165 @@ var init_default = {
|
|
|
21784
21882
|
}
|
|
21785
21883
|
};
|
|
21786
21884
|
|
|
21885
|
+
// src/cli/login/handler.ts
|
|
21886
|
+
import open from "open";
|
|
21887
|
+
|
|
21888
|
+
// src/cli/platform/device-auth.ts
|
|
21889
|
+
function url(apiUrl, path72) {
|
|
21890
|
+
return `${apiUrl}${path72.startsWith("/") ? path72 : `/${path72}`}`;
|
|
21891
|
+
}
|
|
21892
|
+
async function requestDeviceCode(apiUrl) {
|
|
21893
|
+
const response = await fetchWithRetry(
|
|
21894
|
+
url(apiUrl, "/api/v1/auth/device/code"),
|
|
21895
|
+
{
|
|
21896
|
+
method: "POST",
|
|
21897
|
+
headers: { Accept: "application/json" }
|
|
21898
|
+
},
|
|
21899
|
+
{ method: "POST", maxRetries: 3, retryMutatingOnServerError: true }
|
|
21900
|
+
);
|
|
21901
|
+
if (!response.ok) {
|
|
21902
|
+
throw await parseErrorResponse(response);
|
|
21903
|
+
}
|
|
21904
|
+
return await response.json();
|
|
21905
|
+
}
|
|
21906
|
+
async function pollDeviceToken(apiUrl, deviceCode) {
|
|
21907
|
+
const response = await fetchWithRetry(
|
|
21908
|
+
url(apiUrl, "/api/v1/auth/device/token"),
|
|
21909
|
+
{
|
|
21910
|
+
method: "POST",
|
|
21911
|
+
headers: {
|
|
21912
|
+
Accept: "application/json",
|
|
21913
|
+
"Content-Type": "application/json"
|
|
21914
|
+
},
|
|
21915
|
+
body: JSON.stringify({ deviceCode })
|
|
21916
|
+
},
|
|
21917
|
+
{ method: "POST", maxRetries: 3, retryMutatingOnServerError: true }
|
|
21918
|
+
);
|
|
21919
|
+
if (!response.ok) {
|
|
21920
|
+
throw await parseErrorResponse(response);
|
|
21921
|
+
}
|
|
21922
|
+
return await response.json();
|
|
21923
|
+
}
|
|
21924
|
+
|
|
21925
|
+
// src/cli/login/handler.ts
|
|
21926
|
+
function sleep4(ms) {
|
|
21927
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
21928
|
+
}
|
|
21929
|
+
function resolveLoginApiUrl() {
|
|
21930
|
+
return (process.env.APITOGO_API_URL?.trim() || DEFAULT_API_URL).replace(
|
|
21931
|
+
/\/+$/,
|
|
21932
|
+
""
|
|
21933
|
+
);
|
|
21934
|
+
}
|
|
21935
|
+
function maskApiKeyId(apiKeyId) {
|
|
21936
|
+
return `${apiKeyId.slice(0, 8)}***`;
|
|
21937
|
+
}
|
|
21938
|
+
async function login() {
|
|
21939
|
+
const apiUrl = resolveLoginApiUrl();
|
|
21940
|
+
try {
|
|
21941
|
+
const device = await requestDeviceCode(apiUrl);
|
|
21942
|
+
printDiagnosticsToConsole(`Your login code: ${device.userCode}`);
|
|
21943
|
+
printDiagnosticsToConsole(
|
|
21944
|
+
`If your browser doesn't open, visit ${device.verificationUri} and enter code ${device.userCode}`
|
|
21945
|
+
);
|
|
21946
|
+
try {
|
|
21947
|
+
await open(device.verificationUriComplete);
|
|
21948
|
+
} catch {
|
|
21949
|
+
}
|
|
21950
|
+
const deadline = Date.now() + device.expiresIn * 1e3;
|
|
21951
|
+
const intervalMs = Math.max(1, device.interval) * 1e3;
|
|
21952
|
+
while (Date.now() < deadline) {
|
|
21953
|
+
await sleep4(intervalMs);
|
|
21954
|
+
const result = await pollDeviceToken(apiUrl, device.deviceCode);
|
|
21955
|
+
if (result.status === "pending") {
|
|
21956
|
+
continue;
|
|
21957
|
+
}
|
|
21958
|
+
if (result.status === "denied") {
|
|
21959
|
+
await printCriticalFailureToConsoleAndExit("Login request was denied.");
|
|
21960
|
+
return;
|
|
21961
|
+
}
|
|
21962
|
+
if (result.status === "expired") {
|
|
21963
|
+
await printCriticalFailureToConsoleAndExit(
|
|
21964
|
+
"Login code expired. Run `apitogo login` again."
|
|
21965
|
+
);
|
|
21966
|
+
return;
|
|
21967
|
+
}
|
|
21968
|
+
if (!result.apiKeyId || !result.apiSecret) {
|
|
21969
|
+
await printCriticalFailureToConsoleAndExit(
|
|
21970
|
+
"Login approved but the server did not return API credentials."
|
|
21971
|
+
);
|
|
21972
|
+
return;
|
|
21973
|
+
}
|
|
21974
|
+
writeStoredCredentials({
|
|
21975
|
+
apiUrl: result.apiUrl ?? apiUrl,
|
|
21976
|
+
apiKeyId: result.apiKeyId,
|
|
21977
|
+
apiSecret: result.apiSecret
|
|
21978
|
+
});
|
|
21979
|
+
printResultToConsole(
|
|
21980
|
+
`Logged in. API key: ${maskApiKeyId(result.apiKeyId)}`
|
|
21981
|
+
);
|
|
21982
|
+
return;
|
|
21983
|
+
}
|
|
21984
|
+
await printCriticalFailureToConsoleAndExit(
|
|
21985
|
+
"Login code expired. Run `apitogo login` again."
|
|
21986
|
+
);
|
|
21987
|
+
} catch (error) {
|
|
21988
|
+
await printCriticalFailureToConsoleAndExit(
|
|
21989
|
+
error instanceof Error ? error.message : String(error)
|
|
21990
|
+
);
|
|
21991
|
+
}
|
|
21992
|
+
}
|
|
21993
|
+
|
|
21994
|
+
// src/cli/cmds/login.ts
|
|
21995
|
+
var login_default = {
|
|
21996
|
+
desc: "Log in to the API ToGo platform via your browser",
|
|
21997
|
+
command: "login",
|
|
21998
|
+
builder: (yargs2) => yargs2,
|
|
21999
|
+
handler: async (argv) => {
|
|
22000
|
+
await captureEvent({ argv, event: "apitogo login" });
|
|
22001
|
+
await login();
|
|
22002
|
+
}
|
|
22003
|
+
};
|
|
22004
|
+
|
|
22005
|
+
// src/cli/logout/handler.ts
|
|
22006
|
+
async function logout() {
|
|
22007
|
+
const stored = readStoredCredentials();
|
|
22008
|
+
if (!stored) {
|
|
22009
|
+
printResultToConsole("Not logged in.");
|
|
22010
|
+
return;
|
|
22011
|
+
}
|
|
22012
|
+
try {
|
|
22013
|
+
const config2 = {
|
|
22014
|
+
apiUrl: stored.apiUrl,
|
|
22015
|
+
apiKeyId: stored.apiKeyId,
|
|
22016
|
+
apiSecret: stored.apiSecret,
|
|
22017
|
+
devPortalDeployUrl: "",
|
|
22018
|
+
devPortalDeployApiKey: "",
|
|
22019
|
+
devPortalDeployEnv: "",
|
|
22020
|
+
createApitogoPackage: ""
|
|
22021
|
+
};
|
|
22022
|
+
const client = new PlatformApiClient(config2);
|
|
22023
|
+
await client.deletePlatformApiKey(stored.apiKeyId);
|
|
22024
|
+
} catch (error) {
|
|
22025
|
+
printWarningToConsole(
|
|
22026
|
+
`Could not revoke API key on the server, continuing with local logout: ${error instanceof Error ? error.message : String(error)}`
|
|
22027
|
+
);
|
|
22028
|
+
}
|
|
22029
|
+
clearStoredCredentials();
|
|
22030
|
+
printResultToConsole("Logged out.");
|
|
22031
|
+
}
|
|
22032
|
+
|
|
22033
|
+
// src/cli/cmds/logout.ts
|
|
22034
|
+
var logout_default = {
|
|
22035
|
+
desc: "Log out of the API ToGo platform and revoke stored credentials",
|
|
22036
|
+
command: "logout",
|
|
22037
|
+
builder: (yargs2) => yargs2,
|
|
22038
|
+
handler: async (argv) => {
|
|
22039
|
+
await captureEvent({ argv, event: "apitogo logout" });
|
|
22040
|
+
await logout();
|
|
22041
|
+
}
|
|
22042
|
+
};
|
|
22043
|
+
|
|
21787
22044
|
// src/cli/project/create-handler.ts
|
|
21788
22045
|
function resultLooksFailed2(payload) {
|
|
21789
22046
|
try {
|
|
@@ -21858,14 +22115,14 @@ var project_create_default = {
|
|
|
21858
22115
|
|
|
21859
22116
|
// src/cli/dev/handler.ts
|
|
21860
22117
|
init_joinUrl();
|
|
21861
|
-
import
|
|
22118
|
+
import path69 from "node:path";
|
|
21862
22119
|
|
|
21863
22120
|
// src/vite/dev-server.ts
|
|
21864
22121
|
init_logger();
|
|
21865
|
-
import
|
|
22122
|
+
import fs12 from "node:fs/promises";
|
|
21866
22123
|
import http from "node:http";
|
|
21867
22124
|
import https from "node:https";
|
|
21868
|
-
import
|
|
22125
|
+
import path68 from "node:path";
|
|
21869
22126
|
import { createHttpTerminator } from "http-terminator";
|
|
21870
22127
|
import {
|
|
21871
22128
|
createServer as createViteServer,
|
|
@@ -21898,7 +22155,7 @@ init_loader();
|
|
|
21898
22155
|
// src/vite/pagefind-dev-index.ts
|
|
21899
22156
|
init_invariant();
|
|
21900
22157
|
init_joinUrl();
|
|
21901
|
-
import
|
|
22158
|
+
import path67 from "node:path";
|
|
21902
22159
|
import { createIndex as createIndex2 } from "pagefind";
|
|
21903
22160
|
import { isRunnableDevEnvironment } from "vite";
|
|
21904
22161
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -21924,8 +22181,8 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
21924
22181
|
for (const urlPath of paths) {
|
|
21925
22182
|
try {
|
|
21926
22183
|
const pathname = joinUrl(basePath, urlPath);
|
|
21927
|
-
const
|
|
21928
|
-
const request = new Request(
|
|
22184
|
+
const url2 = joinUrl("http://localhost", pathname);
|
|
22185
|
+
const request = new Request(url2);
|
|
21929
22186
|
const response = await serverModule.handleRequest({
|
|
21930
22187
|
template: transformedTemplate,
|
|
21931
22188
|
request,
|
|
@@ -21951,7 +22208,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
21951
22208
|
path: urlPath
|
|
21952
22209
|
};
|
|
21953
22210
|
}
|
|
21954
|
-
const outputPath =
|
|
22211
|
+
const outputPath = path67.join(vite.config.publicDir, "pagefind");
|
|
21955
22212
|
await pagefindIndex.writeFiles({ outputPath });
|
|
21956
22213
|
yield { type: "complete", success: true, indexed };
|
|
21957
22214
|
}
|
|
@@ -21970,9 +22227,9 @@ var DevServer = class {
|
|
|
21970
22227
|
this.protocol = "https";
|
|
21971
22228
|
const { dir } = this.options;
|
|
21972
22229
|
const [key, cert, ca] = await Promise.all([
|
|
21973
|
-
|
|
21974
|
-
|
|
21975
|
-
config2.https.ca ?
|
|
22230
|
+
fs12.readFile(path68.resolve(dir, config2.https.key)),
|
|
22231
|
+
fs12.readFile(path68.resolve(dir, config2.https.cert)),
|
|
22232
|
+
config2.https.ca ? fs12.readFile(path68.resolve(dir, config2.https.ca)) : void 0
|
|
21976
22233
|
]);
|
|
21977
22234
|
return https.createServer({ key, cert, ca });
|
|
21978
22235
|
}
|
|
@@ -21989,7 +22246,7 @@ var DevServer = class {
|
|
|
21989
22246
|
);
|
|
21990
22247
|
const server = await this.createNodeServer(config2);
|
|
21991
22248
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
21992
|
-
const publicRoot =
|
|
22249
|
+
const publicRoot = path68.resolve(
|
|
21993
22250
|
this.options.dir,
|
|
21994
22251
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
21995
22252
|
);
|
|
@@ -22006,7 +22263,7 @@ var DevServer = class {
|
|
|
22006
22263
|
// built-in transform middleware which would treat the path as a static asset.
|
|
22007
22264
|
name: "apitogo:entry-client",
|
|
22008
22265
|
configureServer(server2) {
|
|
22009
|
-
const entryPath =
|
|
22266
|
+
const entryPath = path68.posix.join(
|
|
22010
22267
|
server2.config.base,
|
|
22011
22268
|
"/__z/entry.client.tsx"
|
|
22012
22269
|
);
|
|
@@ -22082,7 +22339,7 @@ var DevServer = class {
|
|
|
22082
22339
|
await ensurePagefindDevStub(vite.config.publicDir);
|
|
22083
22340
|
}
|
|
22084
22341
|
vite.middlewares.use(async (req, res) => {
|
|
22085
|
-
const
|
|
22342
|
+
const url2 = req.originalUrl ?? req.url ?? "/";
|
|
22086
22343
|
const ssrEnvironment = vite.environments.ssr;
|
|
22087
22344
|
if (!isRunnableDevEnvironment2(ssrEnvironment)) {
|
|
22088
22345
|
res.writeHead(500);
|
|
@@ -22098,14 +22355,14 @@ var DevServer = class {
|
|
|
22098
22355
|
jsEntry: "/__z/entry.client.tsx",
|
|
22099
22356
|
dir: currentConfig.site?.dir
|
|
22100
22357
|
});
|
|
22101
|
-
const template = await vite.transformIndexHtml(
|
|
22358
|
+
const template = await vite.transformIndexHtml(url2, rawHtml);
|
|
22102
22359
|
if (this.options.ssr) {
|
|
22103
22360
|
const entryServer = await ssrEnvironment.runner.import(
|
|
22104
22361
|
getAppServerEntryPath()
|
|
22105
22362
|
);
|
|
22106
22363
|
const hasBody = req.method !== "GET" && req.method !== "HEAD";
|
|
22107
22364
|
const request = new Request(
|
|
22108
|
-
`${this.protocol}://${req.headers.host}${
|
|
22365
|
+
`${this.protocol}://${req.headers.host}${url2}`,
|
|
22109
22366
|
{
|
|
22110
22367
|
method: req.method,
|
|
22111
22368
|
headers: req.headers,
|
|
@@ -22152,9 +22409,9 @@ var DevServer = class {
|
|
|
22152
22409
|
});
|
|
22153
22410
|
this.terminator = createHttpTerminator({ server });
|
|
22154
22411
|
if (this.options.open || process.env.ZUDOKU_OPEN_BROWSER) {
|
|
22155
|
-
const
|
|
22412
|
+
const url2 = `${this.protocol}://localhost:${this.resolvedPort}`;
|
|
22156
22413
|
vite.resolvedUrls = {
|
|
22157
|
-
local: [`${
|
|
22414
|
+
local: [`${url2}${vite.config.base || "/"}`],
|
|
22158
22415
|
network: []
|
|
22159
22416
|
};
|
|
22160
22417
|
vite.openBrowser();
|
|
@@ -22171,7 +22428,7 @@ init_package_json();
|
|
|
22171
22428
|
async function dev(argv) {
|
|
22172
22429
|
const packageJson3 = getZudokuPackageJson();
|
|
22173
22430
|
process.env.NODE_ENV = "development";
|
|
22174
|
-
const dir =
|
|
22431
|
+
const dir = path69.resolve(process.cwd(), argv.dir);
|
|
22175
22432
|
const server = new DevServer({
|
|
22176
22433
|
dir,
|
|
22177
22434
|
argPort: argv.port,
|
|
@@ -22179,14 +22436,14 @@ async function dev(argv) {
|
|
|
22179
22436
|
open: argv.open
|
|
22180
22437
|
});
|
|
22181
22438
|
const { vite } = await server.start();
|
|
22182
|
-
const
|
|
22439
|
+
const url2 = joinUrl(
|
|
22183
22440
|
`${server.protocol}://localhost:${server.resolvedPort}`,
|
|
22184
22441
|
vite.config.base
|
|
22185
22442
|
);
|
|
22186
22443
|
printDiagnosticsToConsole("Ctrl+C to exit");
|
|
22187
22444
|
printDiagnosticsToConsole("");
|
|
22188
22445
|
printDiagnosticsToConsole(
|
|
22189
|
-
`\u{1F680} Running API ToGo v${packageJson3.version}: ${
|
|
22446
|
+
`\u{1F680} Running API ToGo v${packageJson3.version}: ${url2}`
|
|
22190
22447
|
);
|
|
22191
22448
|
printDiagnosticsToConsole("");
|
|
22192
22449
|
let hasExited = false;
|
|
@@ -22254,9 +22511,9 @@ var run_default = {
|
|
|
22254
22511
|
};
|
|
22255
22512
|
|
|
22256
22513
|
// src/cli/status/handler.ts
|
|
22257
|
-
import
|
|
22514
|
+
import path70 from "node:path";
|
|
22258
22515
|
async function status(argv) {
|
|
22259
|
-
const sourceDirectory =
|
|
22516
|
+
const sourceDirectory = path70.resolve(process.cwd(), argv.dir);
|
|
22260
22517
|
const config2 = loadConfig();
|
|
22261
22518
|
const client = new PlatformApiClient(config2);
|
|
22262
22519
|
let whoamiJson;
|
|
@@ -22336,7 +22593,7 @@ var status_default = {
|
|
|
22336
22593
|
};
|
|
22337
22594
|
|
|
22338
22595
|
// src/cli/teardown/handler.ts
|
|
22339
|
-
import
|
|
22596
|
+
import path71 from "node:path";
|
|
22340
22597
|
function resultLooksFailed3(payload) {
|
|
22341
22598
|
try {
|
|
22342
22599
|
const parsed = JSON.parse(payload);
|
|
@@ -22352,7 +22609,7 @@ async function teardown(argv) {
|
|
|
22352
22609
|
);
|
|
22353
22610
|
return;
|
|
22354
22611
|
}
|
|
22355
|
-
const sourceDirectory =
|
|
22612
|
+
const sourceDirectory = path71.resolve(process.cwd(), argv.dir);
|
|
22356
22613
|
const config2 = loadConfig();
|
|
22357
22614
|
const client = new PlatformApiClient(config2);
|
|
22358
22615
|
let projectId = argv.projectId?.trim();
|
|
@@ -22490,7 +22747,7 @@ function createApitogoCli(argv) {
|
|
|
22490
22747
|
process.env.ZUPLO = "1";
|
|
22491
22748
|
printDiagnosticsToConsole("Running in Zuplo mode");
|
|
22492
22749
|
}
|
|
22493
|
-
}).middleware(warnPackageVersionMismatch).command(command(init_default)).command(command(config_default)).command(command(run_default)).command(command(build_default)).command(command(check_default)).command(command(project_create_default)).command(command(deploy_default)).command(command(status_default)).command(command(teardown_default)).demandCommand().strictCommands().version(packageJson?.version).fail(false).help();
|
|
22750
|
+
}).middleware(warnPackageVersionMismatch).command(command(init_default)).command(command(config_default)).command(command(run_default)).command(command(build_default)).command(command(check_default)).command(command(project_create_default)).command(command(deploy_default)).command(command(status_default)).command(command(teardown_default)).command(command(login_default)).command(command(logout_default)).demandCommand().strictCommands().version(packageJson?.version).fail(false).help();
|
|
22494
22751
|
}
|
|
22495
22752
|
|
|
22496
22753
|
// src/cli/cli.ts
|