@lukoweb/apitogo 0.1.111 → 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 +636 -377
- 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/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",
|
|
@@ -11978,16 +12078,16 @@ function resolveBackendOpenApiPath(openApiPath, options) {
|
|
|
11978
12078
|
if (!trimmed) {
|
|
11979
12079
|
return void 0;
|
|
11980
12080
|
}
|
|
11981
|
-
if (
|
|
12081
|
+
if (path36.isAbsolute(trimmed)) {
|
|
11982
12082
|
return trimmed;
|
|
11983
12083
|
}
|
|
11984
|
-
const siteResolved =
|
|
12084
|
+
const siteResolved = path36.resolve(options.siteDirectory, trimmed);
|
|
11985
12085
|
if (existsSync4(siteResolved)) {
|
|
11986
12086
|
return siteResolved;
|
|
11987
12087
|
}
|
|
11988
12088
|
const backendDir = options.backendSourceDirectory?.trim();
|
|
11989
12089
|
if (backendDir) {
|
|
11990
|
-
const backendResolved =
|
|
12090
|
+
const backendResolved = path36.resolve(backendDir, trimmed);
|
|
11991
12091
|
if (existsSync4(backendResolved)) {
|
|
11992
12092
|
return backendResolved;
|
|
11993
12093
|
}
|
|
@@ -11995,12 +12095,12 @@ function resolveBackendOpenApiPath(openApiPath, options) {
|
|
|
11995
12095
|
return siteResolved;
|
|
11996
12096
|
}
|
|
11997
12097
|
function toSiteRelativeOpenApiInput(siteDirectory, openApiAbsolutePath) {
|
|
11998
|
-
const relative =
|
|
11999
|
-
const posix = relative.split(
|
|
12098
|
+
const relative = path36.relative(path36.resolve(siteDirectory), path36.resolve(openApiAbsolutePath));
|
|
12099
|
+
const posix = relative.split(path36.sep).join("/");
|
|
12000
12100
|
if (!posix || posix === ".") {
|
|
12001
12101
|
return "./";
|
|
12002
12102
|
}
|
|
12003
|
-
if (
|
|
12103
|
+
if (path36.isAbsolute(posix) || posix.startsWith("..")) {
|
|
12004
12104
|
return posix;
|
|
12005
12105
|
}
|
|
12006
12106
|
return posix.startsWith("./") ? posix : `./${posix}`;
|
|
@@ -12047,7 +12147,7 @@ async function readManifest(siteDirectory) {
|
|
|
12047
12147
|
}
|
|
12048
12148
|
async function writeManifest(siteDirectory, manifest) {
|
|
12049
12149
|
const filePath = manifestFilePath(siteDirectory);
|
|
12050
|
-
await mkdir6(
|
|
12150
|
+
await mkdir6(path36.dirname(filePath), { recursive: true });
|
|
12051
12151
|
let config2 = {};
|
|
12052
12152
|
if (await pathExists(filePath)) {
|
|
12053
12153
|
const raw = await readFile6(filePath, "utf8");
|
|
@@ -12062,7 +12162,7 @@ async function writeManifest(siteDirectory, manifest) {
|
|
|
12062
12162
|
|
|
12063
12163
|
// src/cli/platform/helpers/dev-portal-secrets.ts
|
|
12064
12164
|
import { access as access2, appendFile, mkdir as mkdir7, readFile as readFile7, unlink, writeFile as writeFile8 } from "node:fs/promises";
|
|
12065
|
-
import
|
|
12165
|
+
import path37 from "node:path";
|
|
12066
12166
|
var ENV_FILENAME = ".env";
|
|
12067
12167
|
var COLLAPSED_UPPERCASE_ALIASES2 = {
|
|
12068
12168
|
SECRETKEY: "secretKey",
|
|
@@ -12181,10 +12281,10 @@ async function readEnvFile(filePath) {
|
|
|
12181
12281
|
}
|
|
12182
12282
|
}
|
|
12183
12283
|
async function loadSiteEnv(siteDirectory) {
|
|
12184
|
-
const resolvedDirectory =
|
|
12284
|
+
const resolvedDirectory = path37.resolve(siteDirectory);
|
|
12185
12285
|
const merged = { ...process.env };
|
|
12186
12286
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
12187
|
-
Object.assign(merged, await readEnvFile(
|
|
12287
|
+
Object.assign(merged, await readEnvFile(path37.join(resolvedDirectory, fileName)));
|
|
12188
12288
|
}
|
|
12189
12289
|
return merged;
|
|
12190
12290
|
}
|
|
@@ -12220,7 +12320,7 @@ function buildAuthSecretsJson(secrets, options) {
|
|
|
12220
12320
|
return payload;
|
|
12221
12321
|
}
|
|
12222
12322
|
function envFilePath(siteDirectory) {
|
|
12223
|
-
return
|
|
12323
|
+
return path37.join(path37.resolve(siteDirectory), ENV_FILENAME);
|
|
12224
12324
|
}
|
|
12225
12325
|
function createEnvContent() {
|
|
12226
12326
|
return [
|
|
@@ -12280,7 +12380,7 @@ function validateSecretsForPublish(manifest, secrets, emailOptions) {
|
|
|
12280
12380
|
}
|
|
12281
12381
|
async function siteEnvFileHasEntries(siteDirectory) {
|
|
12282
12382
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
12283
|
-
const loaded = await readEnvFile(
|
|
12383
|
+
const loaded = await readEnvFile(path37.join(siteDirectory, fileName));
|
|
12284
12384
|
if (Object.keys(loaded).length > 0) {
|
|
12285
12385
|
return true;
|
|
12286
12386
|
}
|
|
@@ -12288,7 +12388,7 @@ async function siteEnvFileHasEntries(siteDirectory) {
|
|
|
12288
12388
|
return false;
|
|
12289
12389
|
}
|
|
12290
12390
|
async function resolvePublishConfig(siteDirectory, emailOptions) {
|
|
12291
|
-
const resolvedDirectory =
|
|
12391
|
+
const resolvedDirectory = path37.resolve(siteDirectory);
|
|
12292
12392
|
const manifestRaw = await readManifest(resolvedDirectory);
|
|
12293
12393
|
if (!manifestRaw) {
|
|
12294
12394
|
throw new Error("apitogo.config.json not found in sourceDirectory.");
|
|
@@ -12317,7 +12417,7 @@ function envFileHasActiveAssignments(content) {
|
|
|
12317
12417
|
});
|
|
12318
12418
|
}
|
|
12319
12419
|
async function writeScaffoldEnv(siteDirectory) {
|
|
12320
|
-
const resolvedDirectory =
|
|
12420
|
+
const resolvedDirectory = path37.resolve(siteDirectory);
|
|
12321
12421
|
const filesWritten = [];
|
|
12322
12422
|
const envPath = envFilePath(resolvedDirectory);
|
|
12323
12423
|
try {
|
|
@@ -12328,7 +12428,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
12328
12428
|
filesWritten.push(ENV_FILENAME);
|
|
12329
12429
|
}
|
|
12330
12430
|
for (const legacyName of [".env.example"]) {
|
|
12331
|
-
const legacyPath =
|
|
12431
|
+
const legacyPath = path37.join(resolvedDirectory, legacyName);
|
|
12332
12432
|
try {
|
|
12333
12433
|
const legacy = await readFile7(legacyPath, "utf8");
|
|
12334
12434
|
if (!envFileHasActiveAssignments(legacy)) {
|
|
@@ -12338,7 +12438,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
12338
12438
|
} catch {
|
|
12339
12439
|
}
|
|
12340
12440
|
}
|
|
12341
|
-
const gitignorePath =
|
|
12441
|
+
const gitignorePath = path37.join(resolvedDirectory, ".gitignore");
|
|
12342
12442
|
let gitignore = "";
|
|
12343
12443
|
try {
|
|
12344
12444
|
gitignore = await readFile7(gitignorePath, "utf8");
|
|
@@ -12374,11 +12474,11 @@ var SECRETS_COLLECTION_INSTRUCTION = "For go-live, plans must already be in apit
|
|
|
12374
12474
|
// src/cli/platform/helpers/dev-portal-site-validation.ts
|
|
12375
12475
|
import { readFile as readFile8 } from "node:fs/promises";
|
|
12376
12476
|
import { createRequire as createRequire2 } from "node:module";
|
|
12377
|
-
import
|
|
12477
|
+
import path38 from "node:path";
|
|
12378
12478
|
init_gateway_limits();
|
|
12379
12479
|
var cachedFallbackTs;
|
|
12380
12480
|
async function loadTypeScriptForSite(sourceDirectory) {
|
|
12381
|
-
const require2 = createRequire2(
|
|
12481
|
+
const require2 = createRequire2(path38.join(path38.resolve(sourceDirectory), "package.json"));
|
|
12382
12482
|
try {
|
|
12383
12483
|
return require2("typescript");
|
|
12384
12484
|
} catch {
|
|
@@ -12422,7 +12522,7 @@ async function referencedFileExists(sourceDirectory, reference) {
|
|
|
12422
12522
|
if (/^https?:\/\//i.test(reference)) {
|
|
12423
12523
|
return true;
|
|
12424
12524
|
}
|
|
12425
|
-
return pathExists(
|
|
12525
|
+
return pathExists(path38.resolve(sourceDirectory, reference.replace(/^\.\//, "")));
|
|
12426
12526
|
}
|
|
12427
12527
|
async function validateSiteConfigStructure(config2, sourceDirectory) {
|
|
12428
12528
|
const errors = [];
|
|
@@ -12528,11 +12628,11 @@ var DEFAULT_TSX_CANDIDATES = [
|
|
|
12528
12628
|
"landing/LandingPage.tsx"
|
|
12529
12629
|
];
|
|
12530
12630
|
async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
12531
|
-
const resolvedDir =
|
|
12631
|
+
const resolvedDir = path38.resolve(sourceDirectory);
|
|
12532
12632
|
const issues = [];
|
|
12533
12633
|
const checkedFiles = [];
|
|
12534
12634
|
const skippedChecks = [];
|
|
12535
|
-
const jsonPath =
|
|
12635
|
+
const jsonPath = path38.join(resolvedDir, APITOGO_CONFIG_FILENAME2);
|
|
12536
12636
|
if (await pathExists(jsonPath)) {
|
|
12537
12637
|
checkedFiles.push(APITOGO_CONFIG_FILENAME2);
|
|
12538
12638
|
let parsed;
|
|
@@ -12561,7 +12661,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
12561
12661
|
);
|
|
12562
12662
|
const existingTsxFiles = [];
|
|
12563
12663
|
for (const relativeFile of tsxFiles) {
|
|
12564
|
-
if (await pathExists(
|
|
12664
|
+
if (await pathExists(path38.join(resolvedDir, relativeFile))) {
|
|
12565
12665
|
existingTsxFiles.push(relativeFile);
|
|
12566
12666
|
}
|
|
12567
12667
|
}
|
|
@@ -12574,7 +12674,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
12574
12674
|
} else {
|
|
12575
12675
|
for (const relativeFile of existingTsxFiles) {
|
|
12576
12676
|
checkedFiles.push(relativeFile);
|
|
12577
|
-
const content = await readFile8(
|
|
12677
|
+
const content = await readFile8(path38.join(resolvedDir, relativeFile), "utf8");
|
|
12578
12678
|
issues.push(
|
|
12579
12679
|
...checkTsxSyntax(ts, relativeFile, content).map((message) => ({
|
|
12580
12680
|
file: relativeFile,
|
|
@@ -12610,7 +12710,7 @@ function buildSiteValidationResponseFields(result) {
|
|
|
12610
12710
|
// src/cli/platform/helpers/npm-build.ts
|
|
12611
12711
|
import { spawn } from "node:child_process";
|
|
12612
12712
|
import { access as access3, readFile as readFile9 } from "node:fs/promises";
|
|
12613
|
-
import
|
|
12713
|
+
import path39 from "node:path";
|
|
12614
12714
|
var BUILD_LOG_TAIL_BYTES = 8192;
|
|
12615
12715
|
var MIN_NODE_MAJOR = 20;
|
|
12616
12716
|
var NpmBuildError = class extends Error {
|
|
@@ -12675,13 +12775,13 @@ function runCommand(command2, args, cwd, env) {
|
|
|
12675
12775
|
}
|
|
12676
12776
|
async function runNpmInstall(sourceDirectory, options) {
|
|
12677
12777
|
assertNodeVersion(options?.nodeVersion);
|
|
12678
|
-
const cwd =
|
|
12679
|
-
const packageJsonPath =
|
|
12778
|
+
const cwd = path39.resolve(sourceDirectory);
|
|
12779
|
+
const packageJsonPath = path39.join(cwd, "package.json");
|
|
12680
12780
|
if (!await pathExists2(packageJsonPath)) {
|
|
12681
12781
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
12682
12782
|
}
|
|
12683
12783
|
const startedAt = Date.now();
|
|
12684
|
-
const lockPath =
|
|
12784
|
+
const lockPath = path39.join(cwd, "package-lock.json");
|
|
12685
12785
|
const installArgs = await pathExists2(lockPath) ? ["ci"] : ["install"];
|
|
12686
12786
|
const install = await runCommand("npm", installArgs, cwd);
|
|
12687
12787
|
const installLog = install.output;
|
|
@@ -12699,8 +12799,8 @@ async function runNpmInstall(sourceDirectory, options) {
|
|
|
12699
12799
|
}
|
|
12700
12800
|
async function runNpmBuild(sourceDirectory, options) {
|
|
12701
12801
|
assertNodeVersion(options?.nodeVersion);
|
|
12702
|
-
const cwd =
|
|
12703
|
-
const packageJsonPath =
|
|
12802
|
+
const cwd = path39.resolve(sourceDirectory);
|
|
12803
|
+
const packageJsonPath = path39.join(cwd, "package.json");
|
|
12704
12804
|
if (!await pathExists2(packageJsonPath)) {
|
|
12705
12805
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
12706
12806
|
}
|
|
@@ -12717,8 +12817,8 @@ async function runNpmBuild(sourceDirectory, options) {
|
|
|
12717
12817
|
build2.exitCode
|
|
12718
12818
|
);
|
|
12719
12819
|
}
|
|
12720
|
-
const distPath =
|
|
12721
|
-
const indexPath =
|
|
12820
|
+
const distPath = path39.join(cwd, "dist");
|
|
12821
|
+
const indexPath = path39.join(distPath, "index.html");
|
|
12722
12822
|
if (!await pathExists2(indexPath)) {
|
|
12723
12823
|
throw new NpmBuildError(
|
|
12724
12824
|
`Build completed but dist/index.html was not found at ${indexPath}`,
|
|
@@ -13070,7 +13170,7 @@ function validateManifestForPlatformPublish(manifest) {
|
|
|
13070
13170
|
|
|
13071
13171
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
13072
13172
|
async function checkPublishReadiness(client, _config, args) {
|
|
13073
|
-
const sourceDirectory =
|
|
13173
|
+
const sourceDirectory = path40.resolve(args.sourceDirectory);
|
|
13074
13174
|
const manifest = await readManifest(sourceDirectory) ?? createScaffoldManifest();
|
|
13075
13175
|
const emailOptions = await resolveEmailOptionsForPublish(
|
|
13076
13176
|
client,
|
|
@@ -13148,7 +13248,7 @@ async function checkPublishReadiness(client, _config, args) {
|
|
|
13148
13248
|
|
|
13149
13249
|
// src/cli/check/handler.ts
|
|
13150
13250
|
async function check(argv) {
|
|
13151
|
-
const sourceDirectory =
|
|
13251
|
+
const sourceDirectory = path41.resolve(process.cwd(), argv.dir);
|
|
13152
13252
|
const config2 = loadConfig();
|
|
13153
13253
|
const client = new PlatformApiClient(config2);
|
|
13154
13254
|
let result;
|
|
@@ -13193,13 +13293,13 @@ var check_default = {
|
|
|
13193
13293
|
// src/cli/make-config/handler.ts
|
|
13194
13294
|
import { constants as constants2 } from "node:fs";
|
|
13195
13295
|
import { access as access8, mkdir as mkdir10, readFile as readFile14, writeFile as writeFile13 } from "node:fs/promises";
|
|
13196
|
-
import
|
|
13296
|
+
import path52 from "node:path";
|
|
13197
13297
|
import { stdin as input2 } from "node:process";
|
|
13198
13298
|
import { glob as glob5 } from "glob";
|
|
13199
13299
|
|
|
13200
13300
|
// src/cli/scaffold/dev-portal-config-pages.ts
|
|
13201
13301
|
import { access as access4, readFile as readFile10, rename as rename2, rm as rm3, writeFile as writeFile9 } from "node:fs/promises";
|
|
13202
|
-
import
|
|
13302
|
+
import path42 from "node:path";
|
|
13203
13303
|
async function writeConfigAtomically(filePath, content) {
|
|
13204
13304
|
const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
13205
13305
|
try {
|
|
@@ -13212,7 +13312,7 @@ async function writeConfigAtomically(filePath, content) {
|
|
|
13212
13312
|
}
|
|
13213
13313
|
async function resolveApitogoConfigPath(sourceDirectory) {
|
|
13214
13314
|
for (const filename of ["apitogo.config.tsx", "apitogo.config.jsx"]) {
|
|
13215
|
-
const configPath =
|
|
13315
|
+
const configPath = path42.join(sourceDirectory, filename);
|
|
13216
13316
|
try {
|
|
13217
13317
|
await access4(configPath);
|
|
13218
13318
|
return configPath;
|
|
@@ -13717,10 +13817,10 @@ ${formatCustomPageNavigationEntry(slug, label, itemIndent)}
|
|
|
13717
13817
|
${inner}],
|
|
13718
13818
|
${indent}},`;
|
|
13719
13819
|
}
|
|
13720
|
-
function findMatchingArrayClose(content,
|
|
13820
|
+
function findMatchingArrayClose(content, open2) {
|
|
13721
13821
|
let depth = 0;
|
|
13722
13822
|
let inString = null;
|
|
13723
|
-
for (let i =
|
|
13823
|
+
for (let i = open2; i < content.length; i++) {
|
|
13724
13824
|
const char = content[i];
|
|
13725
13825
|
if (inString) {
|
|
13726
13826
|
if (char === "\\") {
|
|
@@ -13759,8 +13859,8 @@ function findDocumentationCategoryItemsRange(content, from, to) {
|
|
|
13759
13859
|
if (!itemsMatch) {
|
|
13760
13860
|
return null;
|
|
13761
13861
|
}
|
|
13762
|
-
const
|
|
13763
|
-
const close3 = findMatchingArrayClose(content,
|
|
13862
|
+
const open2 = afterLabel + itemsMatch.index + itemsMatch[0].length - 1;
|
|
13863
|
+
const close3 = findMatchingArrayClose(content, open2);
|
|
13764
13864
|
if (close3 === null || close3 > to) {
|
|
13765
13865
|
return null;
|
|
13766
13866
|
}
|
|
@@ -13771,7 +13871,7 @@ function findDocumentationCategoryItemsRange(content, from, to) {
|
|
|
13771
13871
|
const indentMatch = /^[ \t]*/.exec(content.slice(lineStart));
|
|
13772
13872
|
const itemsIndent = indentMatch?.[0] ?? "";
|
|
13773
13873
|
const entryIndent = `${itemsIndent} `;
|
|
13774
|
-
return { open, close: close3, indent: entryIndent };
|
|
13874
|
+
return { open: open2, close: close3, indent: entryIndent };
|
|
13775
13875
|
}
|
|
13776
13876
|
function appendEntryToArrayRange(content, range, entry) {
|
|
13777
13877
|
const before = content.slice(0, range.close);
|
|
@@ -13806,11 +13906,11 @@ function appendCustomPageToDirectBuildExport(content, slug, label) {
|
|
|
13806
13906
|
return null;
|
|
13807
13907
|
}
|
|
13808
13908
|
const callStart = exportIndex + exportPrefix.length;
|
|
13809
|
-
const
|
|
13909
|
+
const open2 = callStart + callPrefix.length - 1;
|
|
13810
13910
|
let depth = 0;
|
|
13811
13911
|
let inString = null;
|
|
13812
13912
|
let close3 = -1;
|
|
13813
|
-
for (let i =
|
|
13913
|
+
for (let i = open2; i < content.length; i++) {
|
|
13814
13914
|
const char = content[i];
|
|
13815
13915
|
if (inString) {
|
|
13816
13916
|
if (char === "\\") {
|
|
@@ -13871,10 +13971,10 @@ function findNavigationArrayRange(content) {
|
|
|
13871
13971
|
return null;
|
|
13872
13972
|
}
|
|
13873
13973
|
const indent = match[1] ?? "";
|
|
13874
|
-
const
|
|
13974
|
+
const open2 = match.index + match[0].length - 1;
|
|
13875
13975
|
let depth = 0;
|
|
13876
13976
|
let inString = null;
|
|
13877
|
-
for (let i =
|
|
13977
|
+
for (let i = open2; i < content.length; i++) {
|
|
13878
13978
|
const char = content[i];
|
|
13879
13979
|
if (inString) {
|
|
13880
13980
|
if (char === "\\") {
|
|
@@ -13893,7 +13993,7 @@ function findNavigationArrayRange(content) {
|
|
|
13893
13993
|
} else if (char === "]") {
|
|
13894
13994
|
depth -= 1;
|
|
13895
13995
|
if (depth === 0) {
|
|
13896
|
-
return { open, close: i, indent };
|
|
13996
|
+
return { open: open2, close: i, indent };
|
|
13897
13997
|
}
|
|
13898
13998
|
}
|
|
13899
13999
|
}
|
|
@@ -13949,17 +14049,17 @@ async function wireNewDevPortalPageInConfig(sourceDirectory, slug, label) {
|
|
|
13949
14049
|
|
|
13950
14050
|
// src/cli/scaffold/wire-openapi.ts
|
|
13951
14051
|
import { access as access6, readFile as readFile12, writeFile as writeFile11 } from "node:fs/promises";
|
|
13952
|
-
import
|
|
14052
|
+
import path47 from "node:path";
|
|
13953
14053
|
|
|
13954
14054
|
// src/cli/platform/helpers/openapi.ts
|
|
13955
|
-
import { promises as
|
|
13956
|
-
import
|
|
14055
|
+
import { promises as fs6 } from "node:fs";
|
|
14056
|
+
import path44 from "node:path";
|
|
13957
14057
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
13958
14058
|
import YAML from "yaml";
|
|
13959
14059
|
|
|
13960
14060
|
// src/cli/scaffold/discover-openapi-files.ts
|
|
13961
|
-
import { promises as
|
|
13962
|
-
import
|
|
14061
|
+
import { promises as fs5 } from "node:fs";
|
|
14062
|
+
import path43 from "node:path";
|
|
13963
14063
|
var OPENAPI_BASENAMES = [
|
|
13964
14064
|
"openapi.yaml",
|
|
13965
14065
|
"openapi.yml",
|
|
@@ -13981,15 +14081,15 @@ var SKIP_OPENAPI_SEARCH_DIRS = /* @__PURE__ */ new Set([
|
|
|
13981
14081
|
".apitogo"
|
|
13982
14082
|
]);
|
|
13983
14083
|
async function collectFromDir(dir, searchedDirectories, candidates) {
|
|
13984
|
-
const resolved =
|
|
14084
|
+
const resolved = path43.resolve(dir);
|
|
13985
14085
|
if (searchedDirectories.includes(resolved)) {
|
|
13986
14086
|
return;
|
|
13987
14087
|
}
|
|
13988
14088
|
searchedDirectories.push(resolved);
|
|
13989
14089
|
for (const name of OPENAPI_BASENAMES) {
|
|
13990
|
-
const candidate =
|
|
14090
|
+
const candidate = path43.join(resolved, name);
|
|
13991
14091
|
try {
|
|
13992
|
-
await
|
|
14092
|
+
await fs5.access(candidate);
|
|
13993
14093
|
candidates.push(candidate);
|
|
13994
14094
|
} catch {
|
|
13995
14095
|
}
|
|
@@ -14002,20 +14102,20 @@ async function collectSiteOpenApiFiles(siteDirectory) {
|
|
|
14002
14102
|
return { candidates: [...new Set(candidates)], searchedDirectories };
|
|
14003
14103
|
}
|
|
14004
14104
|
async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
14005
|
-
const site =
|
|
14006
|
-
const parent =
|
|
14105
|
+
const site = path43.resolve(siteDirectory);
|
|
14106
|
+
const parent = path43.dirname(site);
|
|
14007
14107
|
const searchedDirectories = [];
|
|
14008
14108
|
const candidates = [];
|
|
14009
14109
|
if (parent && parent !== site) {
|
|
14010
14110
|
await collectFromDir(parent, searchedDirectories, candidates);
|
|
14011
14111
|
try {
|
|
14012
|
-
const entries = await
|
|
14112
|
+
const entries = await fs5.readdir(parent, { withFileTypes: true });
|
|
14013
14113
|
for (const entry of entries) {
|
|
14014
14114
|
if (!entry.isDirectory() || SKIP_OPENAPI_SEARCH_DIRS.has(entry.name)) {
|
|
14015
14115
|
continue;
|
|
14016
14116
|
}
|
|
14017
|
-
const sibling =
|
|
14018
|
-
if (
|
|
14117
|
+
const sibling = path43.join(parent, entry.name);
|
|
14118
|
+
if (path43.resolve(sibling) === site) {
|
|
14019
14119
|
continue;
|
|
14020
14120
|
}
|
|
14021
14121
|
await collectFromDir(sibling, searchedDirectories, candidates);
|
|
@@ -14043,7 +14143,7 @@ function parseOpenApiObject(doc) {
|
|
|
14043
14143
|
};
|
|
14044
14144
|
}
|
|
14045
14145
|
function liteParseOpenApi(content, filePath) {
|
|
14046
|
-
const ext =
|
|
14146
|
+
const ext = path43.extname(filePath).toLowerCase();
|
|
14047
14147
|
if (ext === ".json") {
|
|
14048
14148
|
try {
|
|
14049
14149
|
const parsed = JSON.parse(content);
|
|
@@ -14108,9 +14208,9 @@ async function discoverNearbyOpenApi(siteDirectory) {
|
|
|
14108
14208
|
};
|
|
14109
14209
|
}
|
|
14110
14210
|
async function validateOpenApiFile(filePath) {
|
|
14111
|
-
const resolved =
|
|
14112
|
-
const content = await
|
|
14113
|
-
const ext =
|
|
14211
|
+
const resolved = path44.resolve(filePath);
|
|
14212
|
+
const content = await fs6.readFile(resolved, "utf8");
|
|
14213
|
+
const ext = path44.extname(resolved).toLowerCase();
|
|
14114
14214
|
let parsed;
|
|
14115
14215
|
try {
|
|
14116
14216
|
parsed = ext === ".json" ? JSON.parse(content) : YAML.parse(content);
|
|
@@ -14153,12 +14253,12 @@ async function validateOpenApiFile(filePath) {
|
|
|
14153
14253
|
|
|
14154
14254
|
// src/cli/scaffold/scaffold-dev-portal-site.ts
|
|
14155
14255
|
import { mkdir as mkdir8, readFile as readFile11, writeFile as writeFile10 } from "node:fs/promises";
|
|
14156
|
-
import
|
|
14256
|
+
import path46 from "node:path";
|
|
14157
14257
|
|
|
14158
14258
|
// src/cli/scaffold/create-apitogo-cli.ts
|
|
14159
14259
|
import { spawn as spawn2 } from "node:child_process";
|
|
14160
14260
|
import { access as access5, rm as rm4 } from "node:fs/promises";
|
|
14161
|
-
import
|
|
14261
|
+
import path45 from "node:path";
|
|
14162
14262
|
|
|
14163
14263
|
// src/cli/scaffold/apitogo-npm-packages.ts
|
|
14164
14264
|
var DEFAULT_CREATE_APITOGO_PACKAGE2 = "@lukoweb/create-apitogo@latest";
|
|
@@ -14259,9 +14359,9 @@ function resolveDocToolPath(explicit) {
|
|
|
14259
14359
|
return value || void 0;
|
|
14260
14360
|
}
|
|
14261
14361
|
function splitOutputDirectory(outputDirectory) {
|
|
14262
|
-
const resolvedOutputDirectory =
|
|
14263
|
-
const projectName =
|
|
14264
|
-
const parentDirectory =
|
|
14362
|
+
const resolvedOutputDirectory = path45.resolve(outputDirectory);
|
|
14363
|
+
const projectName = path45.basename(resolvedOutputDirectory);
|
|
14364
|
+
const parentDirectory = path45.dirname(resolvedOutputDirectory);
|
|
14265
14365
|
if (!projectName || projectName === "." || projectName === "..") {
|
|
14266
14366
|
throw new Error(
|
|
14267
14367
|
"outputDirectory must be a named folder (e.g. ./dev-portal-site), not the current directory."
|
|
@@ -14287,7 +14387,7 @@ async function directoryHasEntries(dir) {
|
|
|
14287
14387
|
}
|
|
14288
14388
|
}
|
|
14289
14389
|
function resolveLocalCreateApitogoEntry(docToolPath) {
|
|
14290
|
-
return
|
|
14390
|
+
return path45.resolve(docToolPath, "packages/create-zudoku/dist/index.js");
|
|
14291
14391
|
}
|
|
14292
14392
|
async function resolveCreateApitogoInvocation(options) {
|
|
14293
14393
|
const docToolPath = resolveDocToolPath(options.docToolPath);
|
|
@@ -14369,7 +14469,7 @@ async function runCreateApitogoDevPortal(options) {
|
|
|
14369
14469
|
result.exitCode
|
|
14370
14470
|
);
|
|
14371
14471
|
}
|
|
14372
|
-
if (!await pathExists3(
|
|
14472
|
+
if (!await pathExists3(path45.join(resolvedOutputDirectory, "package.json"))) {
|
|
14373
14473
|
throw new CreateApitogoCliError(
|
|
14374
14474
|
`create-apitogo completed but package.json was not found at ${resolvedOutputDirectory}`,
|
|
14375
14475
|
result.output,
|
|
@@ -14425,7 +14525,7 @@ function ensureRequiredApitogoModules(pkg, options) {
|
|
|
14425
14525
|
]
|
|
14426
14526
|
]) {
|
|
14427
14527
|
if (options.docToolPath) {
|
|
14428
|
-
deps[moduleName] = `file:${
|
|
14528
|
+
deps[moduleName] = `file:${path46.join(options.docToolPath, localPath)}`;
|
|
14429
14529
|
continue;
|
|
14430
14530
|
}
|
|
14431
14531
|
deps[moduleName] = `npm:${moduleName}@${moduleAliasVersion}`;
|
|
@@ -14454,7 +14554,7 @@ function rewritePackageJson(raw, options) {
|
|
|
14454
14554
|
if (!deps) continue;
|
|
14455
14555
|
for (const [dep, relativePath] of Object.entries(DOC_TOOL_LOCAL_PACKAGE_PATHS)) {
|
|
14456
14556
|
if (dep in deps) {
|
|
14457
|
-
deps[dep] = `file:${
|
|
14557
|
+
deps[dep] = `file:${path46.join(options.docToolPath, relativePath)}`;
|
|
14458
14558
|
linkedWorkspacePackage = true;
|
|
14459
14559
|
}
|
|
14460
14560
|
}
|
|
@@ -14551,23 +14651,23 @@ function patchDashboardPageConfig(content) {
|
|
|
14551
14651
|
);
|
|
14552
14652
|
}
|
|
14553
14653
|
async function ensureAccountPlansPage(outputDirectory) {
|
|
14554
|
-
const pagePath =
|
|
14654
|
+
const pagePath = path46.join(outputDirectory, ACCOUNT_PLANS_PAGE_PATH);
|
|
14555
14655
|
try {
|
|
14556
14656
|
await readFile11(pagePath, "utf8");
|
|
14557
14657
|
return void 0;
|
|
14558
14658
|
} catch {
|
|
14559
|
-
await mkdir8(
|
|
14659
|
+
await mkdir8(path46.dirname(pagePath), { recursive: true });
|
|
14560
14660
|
await writeFile10(pagePath, ACCOUNT_PLANS_PAGE);
|
|
14561
14661
|
return ACCOUNT_PLANS_PAGE_PATH;
|
|
14562
14662
|
}
|
|
14563
14663
|
}
|
|
14564
14664
|
async function ensureDashboardPage(outputDirectory) {
|
|
14565
|
-
const pagePath =
|
|
14665
|
+
const pagePath = path46.join(outputDirectory, DASHBOARD_PAGE_PATH);
|
|
14566
14666
|
try {
|
|
14567
14667
|
await readFile11(pagePath, "utf8");
|
|
14568
14668
|
return void 0;
|
|
14569
14669
|
} catch {
|
|
14570
|
-
await mkdir8(
|
|
14670
|
+
await mkdir8(path46.dirname(pagePath), { recursive: true });
|
|
14571
14671
|
await writeFile10(pagePath, DASHBOARD_PAGE);
|
|
14572
14672
|
return DASHBOARD_PAGE_PATH;
|
|
14573
14673
|
}
|
|
@@ -14618,7 +14718,7 @@ function patchApitogoConfig(content, options) {
|
|
|
14618
14718
|
async function patchScaffoldedSite(outputDirectory, options) {
|
|
14619
14719
|
const title = options.branding?.title ?? options.siteName;
|
|
14620
14720
|
const filesWritten = [];
|
|
14621
|
-
const packageJsonPath =
|
|
14721
|
+
const packageJsonPath = path46.join(outputDirectory, "package.json");
|
|
14622
14722
|
if (options.patchPackageJson !== false) {
|
|
14623
14723
|
const packageJson3 = await readFile11(packageJsonPath, "utf8");
|
|
14624
14724
|
await writeFile10(
|
|
@@ -14631,7 +14731,7 @@ async function patchScaffoldedSite(outputDirectory, options) {
|
|
|
14631
14731
|
);
|
|
14632
14732
|
filesWritten.push("package.json");
|
|
14633
14733
|
}
|
|
14634
|
-
const configPath =
|
|
14734
|
+
const configPath = path46.join(outputDirectory, "apitogo.config.tsx");
|
|
14635
14735
|
const configContent = await readFile11(configPath, "utf8");
|
|
14636
14736
|
await writeFile10(
|
|
14637
14737
|
configPath,
|
|
@@ -14726,8 +14826,8 @@ async function discoverOpenApiByMode(siteDirectory, mode) {
|
|
|
14726
14826
|
return discoverNearbyOpenApi(siteDirectory);
|
|
14727
14827
|
}
|
|
14728
14828
|
async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
14729
|
-
const resolvedSource =
|
|
14730
|
-
const resolvedOpenApi =
|
|
14829
|
+
const resolvedSource = path47.resolve(sourceDirectory);
|
|
14830
|
+
const resolvedOpenApi = path47.resolve(openApiPath);
|
|
14731
14831
|
const input3 = toSiteRelativeOpenApiInput(resolvedSource, resolvedOpenApi);
|
|
14732
14832
|
const validation = await validateOpenApiFile(resolvedOpenApi);
|
|
14733
14833
|
if (!validation.valid) {
|
|
@@ -14752,7 +14852,7 @@ async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
|
14752
14852
|
"utf8"
|
|
14753
14853
|
);
|
|
14754
14854
|
} else {
|
|
14755
|
-
const tsxConfigPath =
|
|
14855
|
+
const tsxConfigPath = path47.join(resolvedSource, "apitogo.config.tsx");
|
|
14756
14856
|
const configContent = await readFile12(tsxConfigPath, "utf8");
|
|
14757
14857
|
try {
|
|
14758
14858
|
const patched = patchApitogoConfigOpenApiToFile(configContent, input3);
|
|
@@ -14840,10 +14940,10 @@ async function discoverAndWireOpenApi(siteDirectory, mode) {
|
|
|
14840
14940
|
// src/cli/make-config/interactive.ts
|
|
14841
14941
|
import { createInterface } from "node:readline/promises";
|
|
14842
14942
|
import { stdin as input, stdout as output } from "node:process";
|
|
14843
|
-
import
|
|
14943
|
+
import path49 from "node:path";
|
|
14844
14944
|
|
|
14845
14945
|
// src/cli/make-config/json-config.ts
|
|
14846
|
-
import
|
|
14946
|
+
import path48 from "node:path";
|
|
14847
14947
|
|
|
14848
14948
|
// src/cli/make-config/branding-assets.ts
|
|
14849
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';
|
|
@@ -15222,9 +15322,9 @@ function openapiInputForConfig(specRelativePosix) {
|
|
|
15222
15322
|
return `./${specRelativePosix}`;
|
|
15223
15323
|
}
|
|
15224
15324
|
function toRelativeOpenApiInput(projectDir, inputPath) {
|
|
15225
|
-
const resolved =
|
|
15226
|
-
const relative =
|
|
15227
|
-
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);
|
|
15228
15328
|
if (!posix) {
|
|
15229
15329
|
throw new Error("OpenAPI path must point to a file.");
|
|
15230
15330
|
}
|
|
@@ -15597,7 +15697,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
15597
15697
|
continue;
|
|
15598
15698
|
}
|
|
15599
15699
|
const routePath = `/${slug}`;
|
|
15600
|
-
const relativePath =
|
|
15700
|
+
const relativePath = path49.posix.join(options.pagesDir, `${slug}.tsx`);
|
|
15601
15701
|
const page = {
|
|
15602
15702
|
slug,
|
|
15603
15703
|
title: pageTitle.trim(),
|
|
@@ -15690,7 +15790,7 @@ export default function ${componentName}() {
|
|
|
15690
15790
|
init_package_json();
|
|
15691
15791
|
import { constants } from "node:fs";
|
|
15692
15792
|
import { access as access7, mkdir as mkdir9, readFile as readFile13, writeFile as writeFile12 } from "node:fs/promises";
|
|
15693
|
-
import
|
|
15793
|
+
import path50 from "node:path";
|
|
15694
15794
|
import { glob as glob4 } from "glob";
|
|
15695
15795
|
|
|
15696
15796
|
// src/cli/make-config/favicon-png.ts
|
|
@@ -15705,9 +15805,9 @@ var OPENAPI_GLOBS = [
|
|
|
15705
15805
|
"openapi.yaml",
|
|
15706
15806
|
"openapi.yml"
|
|
15707
15807
|
];
|
|
15708
|
-
var toPosix = (p) => p.split(
|
|
15808
|
+
var toPosix = (p) => p.split(path50.sep).join("/");
|
|
15709
15809
|
var sanitizePackageName = (dir) => {
|
|
15710
|
-
const base =
|
|
15810
|
+
const base = path50.basename(path50.resolve(dir));
|
|
15711
15811
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
15712
15812
|
return s || "apitogo-site";
|
|
15713
15813
|
};
|
|
@@ -15717,7 +15817,7 @@ var apitogoVersionRange = () => {
|
|
|
15717
15817
|
};
|
|
15718
15818
|
async function findOpenApiSpecPath(dir) {
|
|
15719
15819
|
for (const rel of OPENAPI_GLOBS) {
|
|
15720
|
-
const full =
|
|
15820
|
+
const full = path50.join(dir, rel);
|
|
15721
15821
|
try {
|
|
15722
15822
|
await access7(full, constants.R_OK);
|
|
15723
15823
|
return toPosix(rel);
|
|
@@ -15732,7 +15832,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
15732
15832
|
return extra[0] ? toPosix(extra[0]) : null;
|
|
15733
15833
|
}
|
|
15734
15834
|
async function ensurePackageJson(dir) {
|
|
15735
|
-
const pkgPath =
|
|
15835
|
+
const pkgPath = path50.join(dir, "package.json");
|
|
15736
15836
|
const apitogoVer = apitogoVersionRange();
|
|
15737
15837
|
const baseDeps = {
|
|
15738
15838
|
react: ">=19.0.0",
|
|
@@ -15799,7 +15899,7 @@ async function ensurePackageJson(dir) {
|
|
|
15799
15899
|
return false;
|
|
15800
15900
|
}
|
|
15801
15901
|
async function ensureTsconfigJson(dir) {
|
|
15802
|
-
const tsPath =
|
|
15902
|
+
const tsPath = path50.join(dir, "tsconfig.json");
|
|
15803
15903
|
try {
|
|
15804
15904
|
await access7(tsPath, constants.R_OK);
|
|
15805
15905
|
return false;
|
|
@@ -15848,40 +15948,40 @@ var fileExists2 = async (filePath) => {
|
|
|
15848
15948
|
}
|
|
15849
15949
|
};
|
|
15850
15950
|
async function ensurePortalStubFiles(dir) {
|
|
15851
|
-
const landingPath =
|
|
15951
|
+
const landingPath = path50.join(dir, "landing", "LandingPage.tsx");
|
|
15852
15952
|
if (!await fileExists2(landingPath)) {
|
|
15853
|
-
await mkdir9(
|
|
15953
|
+
await mkdir9(path50.join(dir, "landing"), { recursive: true });
|
|
15854
15954
|
await writeFile12(landingPath, LANDING_PAGE_SOURCE, "utf8");
|
|
15855
15955
|
}
|
|
15856
|
-
const plansPath =
|
|
15956
|
+
const plansPath = path50.join(dir, "user-panel", "AccountPlansPage.tsx");
|
|
15857
15957
|
if (!await fileExists2(plansPath)) {
|
|
15858
|
-
await mkdir9(
|
|
15958
|
+
await mkdir9(path50.join(dir, "user-panel"), { recursive: true });
|
|
15859
15959
|
await writeFile12(plansPath, ACCOUNT_PLANS_PAGE_SOURCE, "utf8");
|
|
15860
15960
|
}
|
|
15861
|
-
const dashboardPath =
|
|
15961
|
+
const dashboardPath = path50.join(dir, "user-panel", "DashboardPage.tsx");
|
|
15862
15962
|
if (!await fileExists2(dashboardPath)) {
|
|
15863
|
-
await mkdir9(
|
|
15963
|
+
await mkdir9(path50.join(dir, "user-panel"), { recursive: true });
|
|
15864
15964
|
await writeFile12(dashboardPath, DASHBOARD_PAGE_SOURCE, "utf8");
|
|
15865
15965
|
}
|
|
15866
15966
|
await ensurePublicBrandingFiles(dir);
|
|
15867
15967
|
}
|
|
15868
15968
|
async function ensurePublicBrandingFiles(dir) {
|
|
15869
|
-
const destDir =
|
|
15969
|
+
const destDir = path50.join(dir, "public");
|
|
15870
15970
|
await mkdir9(destDir, { recursive: true });
|
|
15871
15971
|
for (const { name, content } of BRANDING_ASSETS) {
|
|
15872
|
-
const dest =
|
|
15972
|
+
const dest = path50.join(destDir, name);
|
|
15873
15973
|
if (await fileExists2(dest)) {
|
|
15874
15974
|
continue;
|
|
15875
15975
|
}
|
|
15876
15976
|
await writeFile12(dest, content, "utf8");
|
|
15877
15977
|
}
|
|
15878
|
-
const faviconDest =
|
|
15978
|
+
const faviconDest = path50.join(destDir, "Icon.png");
|
|
15879
15979
|
if (!await fileExists2(faviconDest)) {
|
|
15880
15980
|
await writeFile12(faviconDest, Buffer.from(FAVICON_PNG_BASE64, "base64"));
|
|
15881
15981
|
}
|
|
15882
15982
|
}
|
|
15883
15983
|
async function ensureThinConfigTsx(dir) {
|
|
15884
|
-
const tsxPath =
|
|
15984
|
+
const tsxPath = path50.join(dir, "apitogo.config.tsx");
|
|
15885
15985
|
if (await fileExists2(tsxPath)) {
|
|
15886
15986
|
return false;
|
|
15887
15987
|
}
|
|
@@ -15891,7 +15991,7 @@ async function ensureThinConfigTsx(dir) {
|
|
|
15891
15991
|
|
|
15892
15992
|
// src/cli/platform/helpers/openapi-action-keys.ts
|
|
15893
15993
|
import { existsSync as existsSync5, readFileSync as readFileSync3 } from "node:fs";
|
|
15894
|
-
import
|
|
15994
|
+
import path51 from "node:path";
|
|
15895
15995
|
import YAML2 from "yaml";
|
|
15896
15996
|
var HTTP_METHODS = [
|
|
15897
15997
|
"get",
|
|
@@ -15960,7 +16060,7 @@ function extractGatewayActionKeysFromOpenApiDocument(document) {
|
|
|
15960
16060
|
function extractGatewayActionKeysFromOpenApiFile(filePath) {
|
|
15961
16061
|
try {
|
|
15962
16062
|
const raw = readFileSync3(filePath, "utf8");
|
|
15963
|
-
const ext =
|
|
16063
|
+
const ext = path51.extname(filePath).toLowerCase();
|
|
15964
16064
|
const parsed = ext === ".json" ? JSON.parse(raw) : YAML2.parse(raw);
|
|
15965
16065
|
return extractGatewayActionKeysFromOpenApiDocument(parsed);
|
|
15966
16066
|
} catch {
|
|
@@ -15981,7 +16081,7 @@ function resolveConfigOpenApiFilePath(siteDirectory, config2) {
|
|
|
15981
16081
|
}
|
|
15982
16082
|
}
|
|
15983
16083
|
for (const candidate of candidates) {
|
|
15984
|
-
const resolved =
|
|
16084
|
+
const resolved = path51.isAbsolute(candidate) ? candidate : path51.resolve(siteDirectory, candidate);
|
|
15985
16085
|
if (existsSync5(resolved)) {
|
|
15986
16086
|
return resolved;
|
|
15987
16087
|
}
|
|
@@ -15996,7 +16096,7 @@ function loadOpenApiActionKeysForSite(siteDirectory, config2) {
|
|
|
15996
16096
|
return extractGatewayActionKeysFromOpenApiFile(filePath);
|
|
15997
16097
|
}
|
|
15998
16098
|
function loadOpenApiActionKeysFromSiteDirectory(siteDirectory) {
|
|
15999
|
-
const configPath =
|
|
16099
|
+
const configPath = path51.join(siteDirectory, "apitogo.config.json");
|
|
16000
16100
|
if (!existsSync5(configPath)) {
|
|
16001
16101
|
return [];
|
|
16002
16102
|
}
|
|
@@ -16021,7 +16121,7 @@ function withDefaultIncludedActionKeys(plan, actionKeys) {
|
|
|
16021
16121
|
}
|
|
16022
16122
|
|
|
16023
16123
|
// src/cli/make-config/handler.ts
|
|
16024
|
-
var toPosixPath2 = (value) => value.split(
|
|
16124
|
+
var toPosixPath2 = (value) => value.split(path52.sep).join(path52.posix.sep);
|
|
16025
16125
|
var fileExists3 = async (filePath) => {
|
|
16026
16126
|
try {
|
|
16027
16127
|
await access8(filePath, constants2.F_OK);
|
|
@@ -16079,7 +16179,7 @@ async function persistConfig(config2, ctx) {
|
|
|
16079
16179
|
};
|
|
16080
16180
|
await writeFile13(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
|
|
16081
16181
|
`, "utf8");
|
|
16082
|
-
const tsxPath =
|
|
16182
|
+
const tsxPath = path52.join(ctx.dir, "apitogo.config.tsx");
|
|
16083
16183
|
if (await fileExists3(tsxPath) && tsxRoutes.length > 0) {
|
|
16084
16184
|
const tsxSource = await readFile14(tsxPath, "utf8");
|
|
16085
16185
|
if (isManagedConfigWrapper(tsxSource)) {
|
|
@@ -16106,7 +16206,7 @@ function mergeBackendFlag(config2, backend) {
|
|
|
16106
16206
|
return next;
|
|
16107
16207
|
}
|
|
16108
16208
|
async function makeConfig(argv) {
|
|
16109
|
-
const dir =
|
|
16209
|
+
const dir = path52.resolve(process.cwd(), argv.dir);
|
|
16110
16210
|
const pagesDir = toPosixPath2(
|
|
16111
16211
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
16112
16212
|
);
|
|
@@ -16126,14 +16226,14 @@ async function makeConfig(argv) {
|
|
|
16126
16226
|
printDiagnosticsToConsole("Created tsconfig.json.");
|
|
16127
16227
|
}
|
|
16128
16228
|
await ensurePortalStubFiles(dir);
|
|
16129
|
-
const jsonPath =
|
|
16229
|
+
const jsonPath = path52.join(dir, APITOGO_JSON_FILENAME);
|
|
16130
16230
|
let createdJson = false;
|
|
16131
16231
|
let config2;
|
|
16132
16232
|
if (await fileExists3(jsonPath)) {
|
|
16133
16233
|
config2 = await readJsonConfig(jsonPath);
|
|
16134
16234
|
} else {
|
|
16135
16235
|
config2 = createDefaultApitogoJsonConfig({
|
|
16136
|
-
title: titleFromDirectoryName(
|
|
16236
|
+
title: titleFromDirectoryName(path52.basename(dir)),
|
|
16137
16237
|
pagesDir
|
|
16138
16238
|
});
|
|
16139
16239
|
createdJson = true;
|
|
@@ -16182,8 +16282,8 @@ async function makeConfig(argv) {
|
|
|
16182
16282
|
return;
|
|
16183
16283
|
}
|
|
16184
16284
|
if (action2.kind === "page") {
|
|
16185
|
-
const pagePath =
|
|
16186
|
-
await mkdir10(
|
|
16285
|
+
const pagePath = path52.join(dir, action2.page.relativePath);
|
|
16286
|
+
await mkdir10(path52.dirname(pagePath), { recursive: true });
|
|
16187
16287
|
await writeFile13(
|
|
16188
16288
|
pagePath,
|
|
16189
16289
|
buildStarterDocsPageTsx(action2.page.slug, action2.page.title),
|
|
@@ -16250,7 +16350,7 @@ async function makeConfig(argv) {
|
|
|
16250
16350
|
if (argv.openapi) {
|
|
16251
16351
|
const wire = await wireDevPortalOpenApi(
|
|
16252
16352
|
dir,
|
|
16253
|
-
|
|
16353
|
+
path52.resolve(dir, argv.openapi)
|
|
16254
16354
|
);
|
|
16255
16355
|
if (wire.status !== "succeeded") {
|
|
16256
16356
|
throw new Error(
|
|
@@ -16279,7 +16379,7 @@ async function makeConfig(argv) {
|
|
|
16279
16379
|
const slug = normalizePageSlug(argv.pageSlug);
|
|
16280
16380
|
const pageTemplate = normalizePageTemplate(argv.pageTemplate);
|
|
16281
16381
|
const relativePagePath = pageComponentRelativePath(slug);
|
|
16282
|
-
const filePath =
|
|
16382
|
+
const filePath = path52.join(dir, relativePagePath);
|
|
16283
16383
|
const isUpdate = argv.pageUpdate === true;
|
|
16284
16384
|
if (isUpdate) {
|
|
16285
16385
|
if (!await fileExists3(filePath)) {
|
|
@@ -16312,7 +16412,7 @@ async function makeConfig(argv) {
|
|
|
16312
16412
|
argv.pageContent,
|
|
16313
16413
|
pageTemplate
|
|
16314
16414
|
);
|
|
16315
|
-
await mkdir10(
|
|
16415
|
+
await mkdir10(path52.dirname(filePath), { recursive: true });
|
|
16316
16416
|
await writeFile13(filePath, tsx, "utf8");
|
|
16317
16417
|
const configResult = await wireNewDevPortalPageInConfig(
|
|
16318
16418
|
dir,
|
|
@@ -16325,7 +16425,7 @@ async function makeConfig(argv) {
|
|
|
16325
16425
|
pagePath: relativePagePath,
|
|
16326
16426
|
pageTemplate,
|
|
16327
16427
|
configUpdated: configResult.updated,
|
|
16328
|
-
configPath: configResult.configPath ?
|
|
16428
|
+
configPath: configResult.configPath ? path52.relative(dir, configResult.configPath) : null
|
|
16329
16429
|
};
|
|
16330
16430
|
changes.push("page_add");
|
|
16331
16431
|
}
|
|
@@ -16450,7 +16550,7 @@ var config_default = {
|
|
|
16450
16550
|
};
|
|
16451
16551
|
|
|
16452
16552
|
// src/cli/apply/handler.ts
|
|
16453
|
-
import
|
|
16553
|
+
import path63 from "node:path";
|
|
16454
16554
|
|
|
16455
16555
|
// src/cli/platform/tools/dev-portal-publish.ts
|
|
16456
16556
|
init_gateway_limits();
|
|
@@ -16529,8 +16629,8 @@ function normalizeActionKey(actionKey) {
|
|
|
16529
16629
|
const trimmed = actionKey.trim();
|
|
16530
16630
|
if (trimmed.includes(":")) {
|
|
16531
16631
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
16532
|
-
const
|
|
16533
|
-
return `${method2.toLowerCase()}:${
|
|
16632
|
+
const path73 = pathParts.join(":").trim();
|
|
16633
|
+
return `${method2.toLowerCase()}:${path73.startsWith("/") ? path73 : `/${path73}`}`;
|
|
16534
16634
|
}
|
|
16535
16635
|
const spaceIndex = trimmed.indexOf(" ");
|
|
16536
16636
|
if (spaceIndex <= 0) {
|
|
@@ -16539,8 +16639,8 @@ function normalizeActionKey(actionKey) {
|
|
|
16539
16639
|
);
|
|
16540
16640
|
}
|
|
16541
16641
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
16542
|
-
const
|
|
16543
|
-
return `${method}:${
|
|
16642
|
+
const path72 = trimmed.slice(spaceIndex + 1).trim();
|
|
16643
|
+
return `${method}:${path72.startsWith("/") ? path72 : `/${path72}`}`;
|
|
16544
16644
|
}
|
|
16545
16645
|
async function applyGatewayPublicRoutes(client, projectId, routes, options) {
|
|
16546
16646
|
const applied = [];
|
|
@@ -16969,13 +17069,13 @@ async function syncDevPortalPlanCatalog(options) {
|
|
|
16969
17069
|
const retries = Math.max(1, options.retries ?? DEFAULT_RETRIES);
|
|
16970
17070
|
const retryDelayMs = options.retryDelayMs ?? DEFAULT_RETRY_DELAY_MS;
|
|
16971
17071
|
const base = options.backendApiBaseUrl.replace(/\/$/, "");
|
|
16972
|
-
const
|
|
17072
|
+
const url2 = `${base}/api/v1/plans?refresh=true&force=true`;
|
|
16973
17073
|
let lastError;
|
|
16974
17074
|
for (let attempt = 1; attempt <= retries; attempt++) {
|
|
16975
17075
|
const controller = new AbortController();
|
|
16976
17076
|
const timeout = setTimeout(() => controller.abort(), PLANS_TIMEOUT_MS);
|
|
16977
17077
|
try {
|
|
16978
|
-
const response = await fetchImpl(
|
|
17078
|
+
const response = await fetchImpl(url2, {
|
|
16979
17079
|
method: "GET",
|
|
16980
17080
|
headers: { Accept: "application/json" },
|
|
16981
17081
|
signal: controller.signal
|
|
@@ -17610,10 +17710,10 @@ async function validateDevPortalReadiness(client, projectId, options) {
|
|
|
17610
17710
|
|
|
17611
17711
|
// src/cli/platform/helpers/publish-ledger.ts
|
|
17612
17712
|
import { mkdir as mkdir11, readFile as readFile15, writeFile as writeFile14 } from "node:fs/promises";
|
|
17613
|
-
import
|
|
17713
|
+
import path53 from "node:path";
|
|
17614
17714
|
var PUBLISH_LEDGER_RELATIVE_PATH = ".apitogo/publish-state.json";
|
|
17615
17715
|
function publishLedgerPath(siteDirectory) {
|
|
17616
|
-
return
|
|
17716
|
+
return path53.join(path53.resolve(siteDirectory), PUBLISH_LEDGER_RELATIVE_PATH);
|
|
17617
17717
|
}
|
|
17618
17718
|
async function readPublishLedger(siteDirectory) {
|
|
17619
17719
|
const filePath = publishLedgerPath(siteDirectory);
|
|
@@ -17630,7 +17730,7 @@ async function readPublishLedger(siteDirectory) {
|
|
|
17630
17730
|
}
|
|
17631
17731
|
async function writePublishLedger(siteDirectory, ledger) {
|
|
17632
17732
|
const filePath = publishLedgerPath(siteDirectory);
|
|
17633
|
-
await mkdir11(
|
|
17733
|
+
await mkdir11(path53.dirname(filePath), { recursive: true });
|
|
17634
17734
|
const next = {
|
|
17635
17735
|
...ledger,
|
|
17636
17736
|
version: 1,
|
|
@@ -17700,12 +17800,12 @@ async function waitForGatewayActionsRegistered(client, projectId, options) {
|
|
|
17700
17800
|
|
|
17701
17801
|
// src/cli/platform/helpers/deploy-artifact-hash.ts
|
|
17702
17802
|
import { createHash as createHash2 } from "node:crypto";
|
|
17703
|
-
import { createReadStream, promises as
|
|
17704
|
-
import
|
|
17803
|
+
import { createReadStream, promises as fs8 } from "node:fs";
|
|
17804
|
+
import path55 from "node:path";
|
|
17705
17805
|
|
|
17706
17806
|
// src/cli/platform/helpers/package-files.ts
|
|
17707
|
-
import { promises as
|
|
17708
|
-
import
|
|
17807
|
+
import { promises as fs7 } from "node:fs";
|
|
17808
|
+
import path54 from "node:path";
|
|
17709
17809
|
import ignore from "ignore";
|
|
17710
17810
|
var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
17711
17811
|
"node_modules",
|
|
@@ -17718,20 +17818,20 @@ var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
|
17718
17818
|
async function loadGitignore(rootDir) {
|
|
17719
17819
|
const ig = ignore();
|
|
17720
17820
|
ig.add(["node_modules/", ".git/", "dist/", "bin/", "obj/"]);
|
|
17721
|
-
const gitignorePath =
|
|
17821
|
+
const gitignorePath = path54.join(rootDir, ".gitignore");
|
|
17722
17822
|
try {
|
|
17723
|
-
const content = await
|
|
17823
|
+
const content = await fs7.readFile(gitignorePath, "utf8");
|
|
17724
17824
|
ig.add(content);
|
|
17725
17825
|
} catch {
|
|
17726
17826
|
}
|
|
17727
17827
|
return ig;
|
|
17728
17828
|
}
|
|
17729
17829
|
async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
17730
|
-
const absDir =
|
|
17731
|
-
const entries = await
|
|
17830
|
+
const absDir = path54.join(rootDir, relativeDir);
|
|
17831
|
+
const entries = await fs7.readdir(absDir, { withFileTypes: true });
|
|
17732
17832
|
for (const entry of entries) {
|
|
17733
|
-
const rel = relativeDir ?
|
|
17734
|
-
const relPosix = rel.split(
|
|
17833
|
+
const rel = relativeDir ? path54.join(relativeDir, entry.name) : entry.name;
|
|
17834
|
+
const relPosix = rel.split(path54.sep).join("/");
|
|
17735
17835
|
if (DEFAULT_EXCLUDES.has(entry.name) && !relativeDir) {
|
|
17736
17836
|
continue;
|
|
17737
17837
|
}
|
|
@@ -17746,8 +17846,8 @@ async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
|
17746
17846
|
}
|
|
17747
17847
|
}
|
|
17748
17848
|
async function collectPackageableFiles(sourceDirectory) {
|
|
17749
|
-
const resolved =
|
|
17750
|
-
const stat4 = await
|
|
17849
|
+
const resolved = path54.resolve(sourceDirectory);
|
|
17850
|
+
const stat4 = await fs7.stat(resolved).catch(() => null);
|
|
17751
17851
|
if (!stat4?.isDirectory()) {
|
|
17752
17852
|
throw new Error(`sourceDirectory is not a directory: ${resolved}`);
|
|
17753
17853
|
}
|
|
@@ -17772,19 +17872,19 @@ async function sha256File(filePath) {
|
|
|
17772
17872
|
return hash2.digest("hex");
|
|
17773
17873
|
}
|
|
17774
17874
|
async function hashDirectoryContents(rootDirectory) {
|
|
17775
|
-
const resolved =
|
|
17875
|
+
const resolved = path55.resolve(rootDirectory);
|
|
17776
17876
|
const files = (await collectPackageableFiles(resolved)).sort((a, b) => a.localeCompare(b));
|
|
17777
17877
|
const hash2 = createHash2("sha256");
|
|
17778
17878
|
for (const rel of files) {
|
|
17779
17879
|
hash2.update(rel);
|
|
17780
17880
|
hash2.update("\0");
|
|
17781
|
-
hash2.update(await
|
|
17881
|
+
hash2.update(await fs8.readFile(path55.join(resolved, rel)));
|
|
17782
17882
|
hash2.update("\0");
|
|
17783
17883
|
}
|
|
17784
17884
|
return hash2.digest("hex");
|
|
17785
17885
|
}
|
|
17786
17886
|
async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
17787
|
-
const resolved =
|
|
17887
|
+
const resolved = path55.resolve(siteDirectory);
|
|
17788
17888
|
const hash2 = createHash2("sha256");
|
|
17789
17889
|
const candidates = [
|
|
17790
17890
|
"apitogo.config.json",
|
|
@@ -17794,19 +17894,19 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
17794
17894
|
"zudoku.config.tsx"
|
|
17795
17895
|
];
|
|
17796
17896
|
for (const name of candidates) {
|
|
17797
|
-
const full =
|
|
17897
|
+
const full = path55.join(resolved, name);
|
|
17798
17898
|
try {
|
|
17799
17899
|
hash2.update(name);
|
|
17800
17900
|
hash2.update("\0");
|
|
17801
|
-
hash2.update(await
|
|
17901
|
+
hash2.update(await fs8.readFile(full));
|
|
17802
17902
|
hash2.update("\0");
|
|
17803
17903
|
} catch {
|
|
17804
17904
|
}
|
|
17805
17905
|
}
|
|
17806
17906
|
for (const dir of ["pages", "landing", "src"]) {
|
|
17807
|
-
const full =
|
|
17907
|
+
const full = path55.join(resolved, dir);
|
|
17808
17908
|
try {
|
|
17809
|
-
const st = await
|
|
17909
|
+
const st = await fs8.stat(full);
|
|
17810
17910
|
if (!st.isDirectory()) continue;
|
|
17811
17911
|
hash2.update(dir);
|
|
17812
17912
|
hash2.update("\0");
|
|
@@ -17827,7 +17927,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
17827
17927
|
|
|
17828
17928
|
// src/cli/platform/helpers/openapi-gateway-servers.ts
|
|
17829
17929
|
import { mkdir as mkdir12, readFile as readFile16, writeFile as writeFile15 } from "node:fs/promises";
|
|
17830
|
-
import
|
|
17930
|
+
import path56 from "node:path";
|
|
17831
17931
|
import YAML3 from "yaml";
|
|
17832
17932
|
var GATEWAY_URL_ENV_KEY = "APITOGO_GATEWAY_URL";
|
|
17833
17933
|
var PUBLISH_OPENAPI_RELATIVE = ".apitogo/openapi-publish.json";
|
|
@@ -17835,10 +17935,10 @@ function normalizeGatewayUrl(gatewayUrl) {
|
|
|
17835
17935
|
return gatewayUrl.trim().replace(/\/+$/, "");
|
|
17836
17936
|
}
|
|
17837
17937
|
function withGatewayServers(doc, gatewayUrl) {
|
|
17838
|
-
const
|
|
17938
|
+
const url2 = normalizeGatewayUrl(gatewayUrl);
|
|
17839
17939
|
return {
|
|
17840
17940
|
...doc,
|
|
17841
|
-
servers: [{ url, description: "API gateway" }]
|
|
17941
|
+
servers: [{ url: url2, description: "API gateway" }]
|
|
17842
17942
|
};
|
|
17843
17943
|
}
|
|
17844
17944
|
async function resolveProjectGatewayUrl(client, projectId) {
|
|
@@ -17859,7 +17959,7 @@ async function resolveProjectGatewayUrl(client, projectId) {
|
|
|
17859
17959
|
}
|
|
17860
17960
|
async function readOpenApiDocument(filePath) {
|
|
17861
17961
|
const content = await readFile16(filePath, "utf8");
|
|
17862
|
-
const ext =
|
|
17962
|
+
const ext = path56.extname(filePath).toLowerCase();
|
|
17863
17963
|
const parsed = ext === ".json" ? JSON.parse(content) : YAML3.parse(content);
|
|
17864
17964
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
17865
17965
|
throw new Error(`OpenAPI document must be an object: ${filePath}`);
|
|
@@ -17867,19 +17967,19 @@ async function readOpenApiDocument(filePath) {
|
|
|
17867
17967
|
return parsed;
|
|
17868
17968
|
}
|
|
17869
17969
|
async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApiPath, gatewayUrl) {
|
|
17870
|
-
const site =
|
|
17871
|
-
const source =
|
|
17970
|
+
const site = path56.resolve(siteDirectory);
|
|
17971
|
+
const source = path56.resolve(sourceOpenApiPath);
|
|
17872
17972
|
const relativeInput = PUBLISH_OPENAPI_RELATIVE;
|
|
17873
|
-
const outputPath =
|
|
17973
|
+
const outputPath = path56.join(site, ...relativeInput.split("/"));
|
|
17874
17974
|
const doc = await readOpenApiDocument(source);
|
|
17875
17975
|
const rewritten = withGatewayServers(doc, gatewayUrl);
|
|
17876
|
-
await mkdir12(
|
|
17976
|
+
await mkdir12(path56.dirname(outputPath), { recursive: true });
|
|
17877
17977
|
await writeFile15(outputPath, `${JSON.stringify(rewritten, null, 2)}
|
|
17878
17978
|
`, "utf8");
|
|
17879
17979
|
return { outputPath, relativeInput };
|
|
17880
17980
|
}
|
|
17881
17981
|
async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
17882
|
-
const configPath =
|
|
17982
|
+
const configPath = path56.join(path56.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
|
|
17883
17983
|
const raw = await readFile16(configPath, "utf8");
|
|
17884
17984
|
const config2 = JSON.parse(raw);
|
|
17885
17985
|
const previousApis = config2.apis;
|
|
@@ -17915,14 +18015,14 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
|
17915
18015
|
};
|
|
17916
18016
|
}
|
|
17917
18017
|
async function prepareOpenApiServersForGatewayBuild(options) {
|
|
17918
|
-
const siteDirectory =
|
|
18018
|
+
const siteDirectory = path56.resolve(options.siteDirectory);
|
|
17919
18019
|
let openApiPath = resolveBackendOpenApiPath(options.manifest?.backend?.openApiPath, {
|
|
17920
18020
|
siteDirectory,
|
|
17921
18021
|
backendSourceDirectory: options.manifest?.backend?.sourceDirectory
|
|
17922
18022
|
});
|
|
17923
18023
|
if (!openApiPath) {
|
|
17924
18024
|
try {
|
|
17925
|
-
const raw = await readFile16(
|
|
18025
|
+
const raw = await readFile16(path56.join(siteDirectory, APITOGO_CONFIG_FILENAME2), "utf8");
|
|
17926
18026
|
const config2 = JSON.parse(raw);
|
|
17927
18027
|
const input3 = Array.isArray(config2.apis) ? config2.apis[0]?.input?.trim() : void 0;
|
|
17928
18028
|
openApiPath = resolveBackendOpenApiPath(input3, { siteDirectory });
|
|
@@ -17944,7 +18044,7 @@ async function prepareOpenApiServersForGatewayBuild(options) {
|
|
|
17944
18044
|
// src/cli/platform/helpers/backend-packaging.ts
|
|
17945
18045
|
import { mkdtemp, readdir, rm as rm5 } from "node:fs/promises";
|
|
17946
18046
|
import { tmpdir } from "node:os";
|
|
17947
|
-
import
|
|
18047
|
+
import path57 from "node:path";
|
|
17948
18048
|
import { spawn as spawn3 } from "node:child_process";
|
|
17949
18049
|
async function directoryHasRuntimeConfig(dir) {
|
|
17950
18050
|
if (!await pathExists(dir)) {
|
|
@@ -17988,20 +18088,20 @@ function runDotnetPublish(projectDir, outputDir) {
|
|
|
17988
18088
|
async function findCsproj(projectDir) {
|
|
17989
18089
|
const entries = await readdir(projectDir);
|
|
17990
18090
|
const csproj = entries.find((name) => name.endsWith(".csproj"));
|
|
17991
|
-
return csproj ?
|
|
18091
|
+
return csproj ? path57.join(projectDir, csproj) : null;
|
|
17992
18092
|
}
|
|
17993
18093
|
async function prepareBackendPackagingDirectory(args) {
|
|
17994
|
-
const sourceDirectory =
|
|
18094
|
+
const sourceDirectory = path57.resolve(args.sourceDirectory);
|
|
17995
18095
|
if (args.publishDirectory?.trim()) {
|
|
17996
18096
|
return {
|
|
17997
|
-
directory:
|
|
18097
|
+
directory: path57.resolve(args.publishDirectory),
|
|
17998
18098
|
packagingMode: "published"
|
|
17999
18099
|
};
|
|
18000
18100
|
}
|
|
18001
18101
|
if (await directoryHasRuntimeConfig(sourceDirectory)) {
|
|
18002
18102
|
return { directory: sourceDirectory, packagingMode: "published" };
|
|
18003
18103
|
}
|
|
18004
|
-
const publishSubdir =
|
|
18104
|
+
const publishSubdir = path57.join(sourceDirectory, "publish");
|
|
18005
18105
|
if (await directoryHasRuntimeConfig(publishSubdir)) {
|
|
18006
18106
|
return { directory: publishSubdir, packagingMode: "published" };
|
|
18007
18107
|
}
|
|
@@ -18012,8 +18112,8 @@ async function prepareBackendPackagingDirectory(args) {
|
|
|
18012
18112
|
if (!csproj) {
|
|
18013
18113
|
return { directory: sourceDirectory, packagingMode: "source" };
|
|
18014
18114
|
}
|
|
18015
|
-
const tempRoot = await mkdtemp(
|
|
18016
|
-
const outputDir =
|
|
18115
|
+
const tempRoot = await mkdtemp(path57.join(tmpdir(), "apitogo-dotnet-publish-"));
|
|
18116
|
+
const outputDir = path57.join(tempRoot, "publish");
|
|
18017
18117
|
const result = await runDotnetPublish(sourceDirectory, outputDir);
|
|
18018
18118
|
if (result.exitCode !== 0) {
|
|
18019
18119
|
await rm5(tempRoot, { recursive: true, force: true });
|
|
@@ -18057,14 +18157,14 @@ function formatJobStatusResponse(options) {
|
|
|
18057
18157
|
}
|
|
18058
18158
|
|
|
18059
18159
|
// src/cli/platform/helpers/zip.ts
|
|
18060
|
-
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as
|
|
18160
|
+
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as fs9 } from "node:fs";
|
|
18061
18161
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
18062
|
-
import
|
|
18162
|
+
import path58 from "node:path";
|
|
18063
18163
|
import { ZipArchive } from "archiver";
|
|
18064
18164
|
async function packageBackendDirectory(sourceDirectory) {
|
|
18065
|
-
const resolved =
|
|
18165
|
+
const resolved = path58.resolve(sourceDirectory);
|
|
18066
18166
|
const files = await collectPackageableFiles(resolved);
|
|
18067
|
-
const zipPath =
|
|
18167
|
+
const zipPath = path58.join(
|
|
18068
18168
|
tmpdir2(),
|
|
18069
18169
|
`apitogo-backend-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`
|
|
18070
18170
|
);
|
|
@@ -18076,15 +18176,15 @@ async function packageBackendDirectory(sourceDirectory) {
|
|
|
18076
18176
|
output2.on("error", reject);
|
|
18077
18177
|
archive.pipe(output2);
|
|
18078
18178
|
for (const rel of files) {
|
|
18079
|
-
archive.append(createReadStream2(
|
|
18179
|
+
archive.append(createReadStream2(path58.join(resolved, rel)), { name: rel.split(path58.sep).join("/") });
|
|
18080
18180
|
}
|
|
18081
18181
|
void archive.finalize();
|
|
18082
18182
|
});
|
|
18083
|
-
const { size } = await
|
|
18183
|
+
const { size } = await fs9.stat(zipPath);
|
|
18084
18184
|
return { zipPath, byteSize: size };
|
|
18085
18185
|
}
|
|
18086
18186
|
async function cleanupZip(zipPath) {
|
|
18087
|
-
await
|
|
18187
|
+
await fs9.unlink(zipPath).catch(() => void 0);
|
|
18088
18188
|
}
|
|
18089
18189
|
|
|
18090
18190
|
// src/cli/platform/tools/infrastructure.ts
|
|
@@ -19458,13 +19558,13 @@ async function resolveProjectIdForPublish(client, config2, args, wait, progress,
|
|
|
19458
19558
|
}
|
|
19459
19559
|
|
|
19460
19560
|
// src/cli/platform/tools/dev-portal.ts
|
|
19461
|
-
import { promises as
|
|
19462
|
-
import
|
|
19561
|
+
import { promises as fs11 } from "node:fs";
|
|
19562
|
+
import path61 from "node:path";
|
|
19463
19563
|
|
|
19464
19564
|
// src/cli/platform/helpers/tarball.ts
|
|
19465
|
-
import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as
|
|
19565
|
+
import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as fs10 } from "node:fs";
|
|
19466
19566
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
19467
|
-
import
|
|
19567
|
+
import path59 from "node:path";
|
|
19468
19568
|
import { TarArchive } from "archiver";
|
|
19469
19569
|
var DEV_PORTAL_DEPLOY_ARCHIVE_ROOT = "dist";
|
|
19470
19570
|
function normalizeArchiveRoot(archiveRoot) {
|
|
@@ -19475,10 +19575,10 @@ function normalizeArchiveRoot(archiveRoot) {
|
|
|
19475
19575
|
return `${trimmed}/`;
|
|
19476
19576
|
}
|
|
19477
19577
|
async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
19478
|
-
const resolved =
|
|
19578
|
+
const resolved = path59.resolve(sourceDirectory);
|
|
19479
19579
|
const files = await collectPackageableFiles(resolved);
|
|
19480
19580
|
const entryPrefix = options?.archiveRoot ? normalizeArchiveRoot(options.archiveRoot) : "";
|
|
19481
|
-
const archivePath =
|
|
19581
|
+
const archivePath = path59.join(
|
|
19482
19582
|
tmpdir3(),
|
|
19483
19583
|
`apitogo-docs-${Date.now()}-${Math.random().toString(36).slice(2)}.tgz`
|
|
19484
19584
|
);
|
|
@@ -19490,16 +19590,16 @@ async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
|
19490
19590
|
output2.on("error", reject);
|
|
19491
19591
|
archive.pipe(output2);
|
|
19492
19592
|
for (const rel of files) {
|
|
19493
|
-
const entryName = entryPrefix + rel.split(
|
|
19494
|
-
archive.append(createReadStream3(
|
|
19593
|
+
const entryName = entryPrefix + rel.split(path59.sep).join("/");
|
|
19594
|
+
archive.append(createReadStream3(path59.join(resolved, rel)), { name: entryName });
|
|
19495
19595
|
}
|
|
19496
19596
|
void archive.finalize();
|
|
19497
19597
|
});
|
|
19498
|
-
const { size } = await
|
|
19598
|
+
const { size } = await fs10.stat(archivePath);
|
|
19499
19599
|
return { archivePath, byteSize: size };
|
|
19500
19600
|
}
|
|
19501
19601
|
async function cleanupArchive(archivePath) {
|
|
19502
|
-
await
|
|
19602
|
+
await fs10.unlink(archivePath).catch(() => void 0);
|
|
19503
19603
|
}
|
|
19504
19604
|
function isTarGzPath(filePath) {
|
|
19505
19605
|
const normalized = filePath.toLowerCase();
|
|
@@ -19615,7 +19715,7 @@ async function snapshotBackendUpdateJobIds(client, projectId) {
|
|
|
19615
19715
|
|
|
19616
19716
|
// src/cli/platform/helpers/dev-portal-site-api-url.ts
|
|
19617
19717
|
import { readdir as readdir2, readFile as readFile17, writeFile as writeFile16 } from "node:fs/promises";
|
|
19618
|
-
import
|
|
19718
|
+
import path60 from "node:path";
|
|
19619
19719
|
var SITE_API_BASE_URL_ENV_KEY = "VITE_APITOGO_AUTHENTICATION_API_BASE_URL";
|
|
19620
19720
|
var PLACEHOLDER_HOST_MARKERS = [
|
|
19621
19721
|
"dp-example.azurecontainerapps.io",
|
|
@@ -19633,10 +19733,10 @@ function isPlaceholderDevPortalApiUrl(apiBaseUrl) {
|
|
|
19633
19733
|
return PLACEHOLDER_HOST_MARKERS.some((marker) => normalized.includes(marker));
|
|
19634
19734
|
}
|
|
19635
19735
|
async function readSiteApiBaseUrl(sourceDirectory) {
|
|
19636
|
-
const resolved =
|
|
19736
|
+
const resolved = path60.resolve(sourceDirectory);
|
|
19637
19737
|
for (const envFile of [".env", ".env.production"]) {
|
|
19638
19738
|
try {
|
|
19639
|
-
const content = await readFile17(
|
|
19739
|
+
const content = await readFile17(path60.join(resolved, envFile), "utf8");
|
|
19640
19740
|
const lines = [...content.matchAll(ENV_LINE_GLOBAL_RE)];
|
|
19641
19741
|
if (lines.length === 0) {
|
|
19642
19742
|
continue;
|
|
@@ -19661,11 +19761,11 @@ async function readSiteApiBaseUrl(sourceDirectory) {
|
|
|
19661
19761
|
return null;
|
|
19662
19762
|
}
|
|
19663
19763
|
async function patchSiteApiBaseUrl(sourceDirectory, apiBaseUrl) {
|
|
19664
|
-
const resolved =
|
|
19764
|
+
const resolved = path60.resolve(sourceDirectory);
|
|
19665
19765
|
const line = `${SITE_API_BASE_URL_ENV_KEY}=${apiBaseUrl}`;
|
|
19666
19766
|
let patchedExisting = false;
|
|
19667
19767
|
for (const envFile of [".env.production", ".env"]) {
|
|
19668
|
-
const envPath =
|
|
19768
|
+
const envPath = path60.join(resolved, envFile);
|
|
19669
19769
|
try {
|
|
19670
19770
|
const content = await readFile17(envPath, "utf8");
|
|
19671
19771
|
const withoutAssignments = content.replace(ENV_LINE_GLOBAL_RE, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
@@ -19679,7 +19779,7 @@ ${line}
|
|
|
19679
19779
|
}
|
|
19680
19780
|
}
|
|
19681
19781
|
if (!patchedExisting) {
|
|
19682
|
-
await writeFile16(
|
|
19782
|
+
await writeFile16(path60.join(resolved, ".env"), `${line}
|
|
19683
19783
|
`);
|
|
19684
19784
|
}
|
|
19685
19785
|
}
|
|
@@ -19687,7 +19787,7 @@ function tryProjectId(explicit, manifestProjectId, config2) {
|
|
|
19687
19787
|
return explicit?.trim() || manifestProjectId?.trim() || config2.defaultProjectId?.trim() || void 0;
|
|
19688
19788
|
}
|
|
19689
19789
|
async function ensureLiveSiteApiBaseUrlForBuild(_client, config2, args, resolveFromProject) {
|
|
19690
|
-
const sourceDirectory =
|
|
19790
|
+
const sourceDirectory = path60.resolve(args.sourceDirectory);
|
|
19691
19791
|
const explicit = args.apiBaseUrl?.trim();
|
|
19692
19792
|
if (explicit && !isPlaceholderDevPortalApiUrl(explicit)) {
|
|
19693
19793
|
await patchSiteApiBaseUrl(sourceDirectory, explicit);
|
|
@@ -19723,7 +19823,7 @@ async function* walkFiles(root) {
|
|
|
19723
19823
|
return;
|
|
19724
19824
|
}
|
|
19725
19825
|
for (const entry of entries) {
|
|
19726
|
-
const full =
|
|
19826
|
+
const full = path60.join(root, entry.name);
|
|
19727
19827
|
if (entry.isDirectory()) {
|
|
19728
19828
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
19729
19829
|
continue;
|
|
@@ -19735,8 +19835,8 @@ async function* walkFiles(root) {
|
|
|
19735
19835
|
}
|
|
19736
19836
|
}
|
|
19737
19837
|
async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiBaseUrl) {
|
|
19738
|
-
const dist =
|
|
19739
|
-
const siteRoot =
|
|
19838
|
+
const dist = path60.resolve(distDirectory);
|
|
19839
|
+
const siteRoot = path60.dirname(dist);
|
|
19740
19840
|
const fromEnv = expectedApiBaseUrl?.trim() || await readSiteApiBaseUrl(siteRoot) || await readSiteApiBaseUrl(dist);
|
|
19741
19841
|
if (!fromEnv || isPlaceholderDevPortalApiUrl(fromEnv)) {
|
|
19742
19842
|
throw new Error(
|
|
@@ -19991,8 +20091,8 @@ function validateDeployArchiveInput(args) {
|
|
|
19991
20091
|
async function resolveDevPortalArchive(args) {
|
|
19992
20092
|
validateDeployArchiveInput(args);
|
|
19993
20093
|
if (args.archivePath?.trim()) {
|
|
19994
|
-
const archivePath =
|
|
19995
|
-
const stat4 = await
|
|
20094
|
+
const archivePath = path61.resolve(args.archivePath.trim());
|
|
20095
|
+
const stat4 = await fs11.stat(archivePath).catch(() => null);
|
|
19996
20096
|
if (!stat4?.isFile()) {
|
|
19997
20097
|
throw new Error(`archivePath is not a file: ${archivePath}`);
|
|
19998
20098
|
}
|
|
@@ -20059,10 +20159,10 @@ async function handleDeployDevPortal(client, config2, args, progress) {
|
|
|
20059
20159
|
}
|
|
20060
20160
|
|
|
20061
20161
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
20062
|
-
import
|
|
20162
|
+
import path62 from "node:path";
|
|
20063
20163
|
async function handleBuildDevPortalSite(client, config2, args, progress) {
|
|
20064
20164
|
const buildProgress = progress?.child("Build dev portal site");
|
|
20065
|
-
const sourceDirectory =
|
|
20165
|
+
const sourceDirectory = path62.resolve(args.sourceDirectory);
|
|
20066
20166
|
await buildProgress?.onStep("Ensuring live portal API URL");
|
|
20067
20167
|
const apiBaseUrl = await ensureLiveSiteApiBaseUrlForBuild(
|
|
20068
20168
|
client,
|
|
@@ -20144,8 +20244,8 @@ function normalizeActionKeyFormat(actionKey) {
|
|
|
20144
20244
|
const trimmed = actionKey.trim();
|
|
20145
20245
|
if (trimmed.includes(":")) {
|
|
20146
20246
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
20147
|
-
const
|
|
20148
|
-
return `${method2.toLowerCase()}:${
|
|
20247
|
+
const path73 = pathParts.join(":").trim();
|
|
20248
|
+
return `${method2.toLowerCase()}:${path73.startsWith("/") ? path73 : `/${path73}`}`;
|
|
20149
20249
|
}
|
|
20150
20250
|
const spaceIndex = trimmed.indexOf(" ");
|
|
20151
20251
|
if (spaceIndex <= 0) {
|
|
@@ -20154,8 +20254,8 @@ function normalizeActionKeyFormat(actionKey) {
|
|
|
20154
20254
|
);
|
|
20155
20255
|
}
|
|
20156
20256
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
20157
|
-
const
|
|
20158
|
-
return `${method}:${
|
|
20257
|
+
const path72 = trimmed.slice(spaceIndex + 1).trim();
|
|
20258
|
+
return `${method}:${path72.startsWith("/") ? path72 : `/${path72}`}`;
|
|
20159
20259
|
}
|
|
20160
20260
|
function normalizePublicRoute(route) {
|
|
20161
20261
|
const trimmed = route.trim();
|
|
@@ -21036,7 +21136,7 @@ function resultLooksFailed(payload) {
|
|
|
21036
21136
|
}
|
|
21037
21137
|
}
|
|
21038
21138
|
async function apply(argv) {
|
|
21039
|
-
const sourceDirectory =
|
|
21139
|
+
const sourceDirectory = path63.resolve(process.cwd(), argv.dir);
|
|
21040
21140
|
const config2 = loadConfig();
|
|
21041
21141
|
const client = new PlatformApiClient(config2);
|
|
21042
21142
|
let only;
|
|
@@ -21121,11 +21221,11 @@ var deploy_default = {
|
|
|
21121
21221
|
};
|
|
21122
21222
|
|
|
21123
21223
|
// src/cli/init/handler.ts
|
|
21124
|
-
import
|
|
21224
|
+
import path66 from "node:path";
|
|
21125
21225
|
|
|
21126
21226
|
// src/cli/scaffold/run-scaffold-discovery.ts
|
|
21127
21227
|
import { access as access10, readFile as readFile19, writeFile as writeFile18 } from "node:fs/promises";
|
|
21128
|
-
import
|
|
21228
|
+
import path65 from "node:path";
|
|
21129
21229
|
|
|
21130
21230
|
// src/cli/scaffold/wire-docs.ts
|
|
21131
21231
|
import {
|
|
@@ -21138,7 +21238,7 @@ import {
|
|
|
21138
21238
|
symlink,
|
|
21139
21239
|
writeFile as writeFile17
|
|
21140
21240
|
} from "node:fs/promises";
|
|
21141
|
-
import
|
|
21241
|
+
import path64 from "node:path";
|
|
21142
21242
|
var DOCS_DIR_WHITELIST = [
|
|
21143
21243
|
"docs",
|
|
21144
21244
|
"documents",
|
|
@@ -21175,14 +21275,14 @@ async function isDirectory(filePath) {
|
|
|
21175
21275
|
}
|
|
21176
21276
|
}
|
|
21177
21277
|
function toPosix2(value) {
|
|
21178
|
-
return value.split(
|
|
21278
|
+
return value.split(path64.sep).join(path64.posix.sep);
|
|
21179
21279
|
}
|
|
21180
21280
|
function isWhitelistedDirName(name) {
|
|
21181
21281
|
return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
|
|
21182
21282
|
}
|
|
21183
21283
|
function isInside2(parent, child) {
|
|
21184
|
-
const relative =
|
|
21185
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
21284
|
+
const relative = path64.relative(parent, child);
|
|
21285
|
+
return relative === "" || !relative.startsWith("..") && !path64.isAbsolute(relative);
|
|
21186
21286
|
}
|
|
21187
21287
|
async function collectMarkdownFiles(dir) {
|
|
21188
21288
|
const files = [];
|
|
@@ -21196,7 +21296,7 @@ async function collectMarkdownFiles(dir) {
|
|
|
21196
21296
|
if (entry.name.startsWith(".")) {
|
|
21197
21297
|
continue;
|
|
21198
21298
|
}
|
|
21199
|
-
const full =
|
|
21299
|
+
const full = path64.join(dir, entry.name);
|
|
21200
21300
|
if (entry.isDirectory()) {
|
|
21201
21301
|
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink()) {
|
|
21202
21302
|
continue;
|
|
@@ -21211,11 +21311,11 @@ async function collectMarkdownFiles(dir) {
|
|
|
21211
21311
|
return files;
|
|
21212
21312
|
}
|
|
21213
21313
|
async function collectSearchRoots(siteDirectory) {
|
|
21214
|
-
const site =
|
|
21215
|
-
const parent =
|
|
21314
|
+
const site = path64.resolve(siteDirectory);
|
|
21315
|
+
const parent = path64.dirname(site);
|
|
21216
21316
|
const roots = [];
|
|
21217
21317
|
const add = (dir) => {
|
|
21218
|
-
const resolved =
|
|
21318
|
+
const resolved = path64.resolve(dir);
|
|
21219
21319
|
if (!roots.includes(resolved)) {
|
|
21220
21320
|
roots.push(resolved);
|
|
21221
21321
|
}
|
|
@@ -21228,7 +21328,7 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
21228
21328
|
if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
|
|
21229
21329
|
continue;
|
|
21230
21330
|
}
|
|
21231
|
-
add(
|
|
21331
|
+
add(path64.join(parent, entry.name));
|
|
21232
21332
|
}
|
|
21233
21333
|
} catch {
|
|
21234
21334
|
}
|
|
@@ -21237,13 +21337,13 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
21237
21337
|
return roots;
|
|
21238
21338
|
}
|
|
21239
21339
|
async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
21240
|
-
const site =
|
|
21241
|
-
const sitePages =
|
|
21340
|
+
const site = path64.resolve(siteDirectory);
|
|
21341
|
+
const sitePages = path64.join(site, PAGES_DIR);
|
|
21242
21342
|
const searchedDirectories = await collectSearchRoots(site);
|
|
21243
21343
|
const directories = [];
|
|
21244
21344
|
const seen = /* @__PURE__ */ new Set();
|
|
21245
21345
|
const consider = async (dir) => {
|
|
21246
|
-
const resolved =
|
|
21346
|
+
const resolved = path64.resolve(dir);
|
|
21247
21347
|
if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
|
|
21248
21348
|
return;
|
|
21249
21349
|
}
|
|
@@ -21260,7 +21360,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
21260
21360
|
directories.push({ sourceDirectory: resolved, files });
|
|
21261
21361
|
};
|
|
21262
21362
|
for (const root of searchedDirectories) {
|
|
21263
|
-
if (isWhitelistedDirName(
|
|
21363
|
+
if (isWhitelistedDirName(path64.basename(root))) {
|
|
21264
21364
|
await consider(root);
|
|
21265
21365
|
}
|
|
21266
21366
|
try {
|
|
@@ -21272,7 +21372,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
21272
21372
|
if (!isWhitelistedDirName(entry.name)) {
|
|
21273
21373
|
continue;
|
|
21274
21374
|
}
|
|
21275
|
-
await consider(
|
|
21375
|
+
await consider(path64.join(root, entry.name));
|
|
21276
21376
|
}
|
|
21277
21377
|
} catch {
|
|
21278
21378
|
}
|
|
@@ -21283,8 +21383,8 @@ function slugifyDirName(name) {
|
|
|
21283
21383
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
21284
21384
|
}
|
|
21285
21385
|
async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
21286
|
-
const base = slugifyDirName(
|
|
21287
|
-
const parent = slugifyDirName(
|
|
21386
|
+
const base = slugifyDirName(path64.basename(sourceDirectory));
|
|
21387
|
+
const parent = slugifyDirName(path64.basename(path64.dirname(sourceDirectory)));
|
|
21288
21388
|
const candidates = [base, `${parent}-${base}`];
|
|
21289
21389
|
let index = 2;
|
|
21290
21390
|
while (true) {
|
|
@@ -21292,7 +21392,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
|
21292
21392
|
if (used.has(name)) {
|
|
21293
21393
|
continue;
|
|
21294
21394
|
}
|
|
21295
|
-
const target =
|
|
21395
|
+
const target = path64.join(pagesDir, name);
|
|
21296
21396
|
if (await pathExists5(target)) {
|
|
21297
21397
|
const stat4 = await lstat(target);
|
|
21298
21398
|
if (!stat4.isDirectory() || !await isManagedLinkDir(target)) {
|
|
@@ -21323,8 +21423,8 @@ async function alreadyLinked(linkPath, sourcePath) {
|
|
|
21323
21423
|
return false;
|
|
21324
21424
|
}
|
|
21325
21425
|
const current = await readlink(linkPath);
|
|
21326
|
-
const resolved =
|
|
21327
|
-
return resolved ===
|
|
21426
|
+
const resolved = path64.resolve(path64.dirname(linkPath), current);
|
|
21427
|
+
return resolved === path64.resolve(sourcePath);
|
|
21328
21428
|
} catch {
|
|
21329
21429
|
return false;
|
|
21330
21430
|
}
|
|
@@ -21336,8 +21436,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
|
|
|
21336
21436
|
if (await pathExists5(linkPath)) {
|
|
21337
21437
|
return "skipped";
|
|
21338
21438
|
}
|
|
21339
|
-
await mkdir13(
|
|
21340
|
-
const relativeTarget =
|
|
21439
|
+
await mkdir13(path64.dirname(linkPath), { recursive: true });
|
|
21440
|
+
const relativeTarget = path64.relative(path64.dirname(linkPath), sourcePath);
|
|
21341
21441
|
await symlink(
|
|
21342
21442
|
relativeTarget,
|
|
21343
21443
|
linkPath,
|
|
@@ -21352,7 +21452,7 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
21352
21452
|
if (routes.length === 0) {
|
|
21353
21453
|
return;
|
|
21354
21454
|
}
|
|
21355
|
-
const configPath =
|
|
21455
|
+
const configPath = path64.join(siteDirectory, CONFIG_FILENAME);
|
|
21356
21456
|
if (!await pathExists5(configPath)) {
|
|
21357
21457
|
return;
|
|
21358
21458
|
}
|
|
@@ -21368,8 +21468,8 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
21368
21468
|
`, "utf8");
|
|
21369
21469
|
}
|
|
21370
21470
|
async function discoverAndWireDocs(siteDirectory) {
|
|
21371
|
-
const site =
|
|
21372
|
-
const pagesDir =
|
|
21471
|
+
const site = path64.resolve(siteDirectory);
|
|
21472
|
+
const pagesDir = path64.join(site, PAGES_DIR);
|
|
21373
21473
|
const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
|
|
21374
21474
|
if (directories.length === 0) {
|
|
21375
21475
|
return {
|
|
@@ -21391,14 +21491,14 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
21391
21491
|
directory.sourceDirectory,
|
|
21392
21492
|
usedNames
|
|
21393
21493
|
);
|
|
21394
|
-
const linkDirectory =
|
|
21494
|
+
const linkDirectory = path64.join(pagesDir, linkName);
|
|
21395
21495
|
const linked = [];
|
|
21396
21496
|
const skipped = [];
|
|
21397
21497
|
for (const sourcePath of directory.files) {
|
|
21398
21498
|
const relativeSource = toPosix2(
|
|
21399
|
-
|
|
21499
|
+
path64.relative(directory.sourceDirectory, sourcePath)
|
|
21400
21500
|
);
|
|
21401
|
-
const linkPath =
|
|
21501
|
+
const linkPath = path64.join(linkDirectory, relativeSource);
|
|
21402
21502
|
const result = await linkMarkdownFile(sourcePath, linkPath);
|
|
21403
21503
|
if (result === "skipped") {
|
|
21404
21504
|
skipped.push({
|
|
@@ -21407,7 +21507,7 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
21407
21507
|
});
|
|
21408
21508
|
continue;
|
|
21409
21509
|
}
|
|
21410
|
-
const relativeLink = toPosix2(
|
|
21510
|
+
const relativeLink = toPosix2(path64.relative(site, linkPath));
|
|
21411
21511
|
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
21412
21512
|
linked.push({ sourcePath, linkPath, route, relativeSource });
|
|
21413
21513
|
routes.push(route);
|
|
@@ -21440,11 +21540,11 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
21440
21540
|
};
|
|
21441
21541
|
}
|
|
21442
21542
|
function siteRelative(siteDirectory, filePath) {
|
|
21443
|
-
const relative = toPosix2(
|
|
21543
|
+
const relative = toPosix2(path64.relative(siteDirectory, filePath));
|
|
21444
21544
|
if (!relative) {
|
|
21445
21545
|
return ".";
|
|
21446
21546
|
}
|
|
21447
|
-
if (
|
|
21547
|
+
if (path64.isAbsolute(relative)) {
|
|
21448
21548
|
return toPosix2(filePath);
|
|
21449
21549
|
}
|
|
21450
21550
|
if (relative.startsWith("..")) {
|
|
@@ -21511,7 +21611,7 @@ async function pathExists6(filePath) {
|
|
|
21511
21611
|
}
|
|
21512
21612
|
async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
|
|
21513
21613
|
const input3 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
|
|
21514
|
-
const jsonConfigPath =
|
|
21614
|
+
const jsonConfigPath = path65.join(siteDirectory, "apitogo.config.json");
|
|
21515
21615
|
const raw = await readFile19(jsonConfigPath, "utf8");
|
|
21516
21616
|
const siteConfig = JSON.parse(raw);
|
|
21517
21617
|
const updated = applyOpenApiToSiteConfig(siteConfig, {
|
|
@@ -21563,7 +21663,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
|
|
|
21563
21663
|
wired: false
|
|
21564
21664
|
};
|
|
21565
21665
|
}
|
|
21566
|
-
const jsonConfigPath =
|
|
21666
|
+
const jsonConfigPath = path65.join(siteDirectory, "apitogo.config.json");
|
|
21567
21667
|
if (!await pathExists6(jsonConfigPath)) {
|
|
21568
21668
|
return {
|
|
21569
21669
|
openApiDiscovery: {
|
|
@@ -21624,8 +21724,8 @@ function slugifyName2(name) {
|
|
|
21624
21724
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
|
|
21625
21725
|
}
|
|
21626
21726
|
function resolveInitOutputDirectory(dirArg, name) {
|
|
21627
|
-
const resolved =
|
|
21628
|
-
const base =
|
|
21727
|
+
const resolved = path66.resolve(process.cwd(), dirArg);
|
|
21728
|
+
const base = path66.basename(resolved);
|
|
21629
21729
|
const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
|
|
21630
21730
|
if (isDot) {
|
|
21631
21731
|
const fromName = name?.trim();
|
|
@@ -21635,7 +21735,7 @@ function resolveInitOutputDirectory(dirArg, name) {
|
|
|
21635
21735
|
);
|
|
21636
21736
|
}
|
|
21637
21737
|
return {
|
|
21638
|
-
outputDirectory:
|
|
21738
|
+
outputDirectory: path66.resolve(process.cwd(), slugifyName2(fromName)),
|
|
21639
21739
|
siteName: fromName
|
|
21640
21740
|
};
|
|
21641
21741
|
}
|
|
@@ -21782,6 +21882,165 @@ var init_default = {
|
|
|
21782
21882
|
}
|
|
21783
21883
|
};
|
|
21784
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
|
+
|
|
21785
22044
|
// src/cli/project/create-handler.ts
|
|
21786
22045
|
function resultLooksFailed2(payload) {
|
|
21787
22046
|
try {
|
|
@@ -21856,14 +22115,14 @@ var project_create_default = {
|
|
|
21856
22115
|
|
|
21857
22116
|
// src/cli/dev/handler.ts
|
|
21858
22117
|
init_joinUrl();
|
|
21859
|
-
import
|
|
22118
|
+
import path69 from "node:path";
|
|
21860
22119
|
|
|
21861
22120
|
// src/vite/dev-server.ts
|
|
21862
22121
|
init_logger();
|
|
21863
|
-
import
|
|
22122
|
+
import fs12 from "node:fs/promises";
|
|
21864
22123
|
import http from "node:http";
|
|
21865
22124
|
import https from "node:https";
|
|
21866
|
-
import
|
|
22125
|
+
import path68 from "node:path";
|
|
21867
22126
|
import { createHttpTerminator } from "http-terminator";
|
|
21868
22127
|
import {
|
|
21869
22128
|
createServer as createViteServer,
|
|
@@ -21896,7 +22155,7 @@ init_loader();
|
|
|
21896
22155
|
// src/vite/pagefind-dev-index.ts
|
|
21897
22156
|
init_invariant();
|
|
21898
22157
|
init_joinUrl();
|
|
21899
|
-
import
|
|
22158
|
+
import path67 from "node:path";
|
|
21900
22159
|
import { createIndex as createIndex2 } from "pagefind";
|
|
21901
22160
|
import { isRunnableDevEnvironment } from "vite";
|
|
21902
22161
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -21922,8 +22181,8 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
21922
22181
|
for (const urlPath of paths) {
|
|
21923
22182
|
try {
|
|
21924
22183
|
const pathname = joinUrl(basePath, urlPath);
|
|
21925
|
-
const
|
|
21926
|
-
const request = new Request(
|
|
22184
|
+
const url2 = joinUrl("http://localhost", pathname);
|
|
22185
|
+
const request = new Request(url2);
|
|
21927
22186
|
const response = await serverModule.handleRequest({
|
|
21928
22187
|
template: transformedTemplate,
|
|
21929
22188
|
request,
|
|
@@ -21949,7 +22208,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
21949
22208
|
path: urlPath
|
|
21950
22209
|
};
|
|
21951
22210
|
}
|
|
21952
|
-
const outputPath =
|
|
22211
|
+
const outputPath = path67.join(vite.config.publicDir, "pagefind");
|
|
21953
22212
|
await pagefindIndex.writeFiles({ outputPath });
|
|
21954
22213
|
yield { type: "complete", success: true, indexed };
|
|
21955
22214
|
}
|
|
@@ -21968,9 +22227,9 @@ var DevServer = class {
|
|
|
21968
22227
|
this.protocol = "https";
|
|
21969
22228
|
const { dir } = this.options;
|
|
21970
22229
|
const [key, cert, ca] = await Promise.all([
|
|
21971
|
-
|
|
21972
|
-
|
|
21973
|
-
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
|
|
21974
22233
|
]);
|
|
21975
22234
|
return https.createServer({ key, cert, ca });
|
|
21976
22235
|
}
|
|
@@ -21987,7 +22246,7 @@ var DevServer = class {
|
|
|
21987
22246
|
);
|
|
21988
22247
|
const server = await this.createNodeServer(config2);
|
|
21989
22248
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
21990
|
-
const publicRoot =
|
|
22249
|
+
const publicRoot = path68.resolve(
|
|
21991
22250
|
this.options.dir,
|
|
21992
22251
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
21993
22252
|
);
|
|
@@ -22004,7 +22263,7 @@ var DevServer = class {
|
|
|
22004
22263
|
// built-in transform middleware which would treat the path as a static asset.
|
|
22005
22264
|
name: "apitogo:entry-client",
|
|
22006
22265
|
configureServer(server2) {
|
|
22007
|
-
const entryPath =
|
|
22266
|
+
const entryPath = path68.posix.join(
|
|
22008
22267
|
server2.config.base,
|
|
22009
22268
|
"/__z/entry.client.tsx"
|
|
22010
22269
|
);
|
|
@@ -22080,7 +22339,7 @@ var DevServer = class {
|
|
|
22080
22339
|
await ensurePagefindDevStub(vite.config.publicDir);
|
|
22081
22340
|
}
|
|
22082
22341
|
vite.middlewares.use(async (req, res) => {
|
|
22083
|
-
const
|
|
22342
|
+
const url2 = req.originalUrl ?? req.url ?? "/";
|
|
22084
22343
|
const ssrEnvironment = vite.environments.ssr;
|
|
22085
22344
|
if (!isRunnableDevEnvironment2(ssrEnvironment)) {
|
|
22086
22345
|
res.writeHead(500);
|
|
@@ -22096,14 +22355,14 @@ var DevServer = class {
|
|
|
22096
22355
|
jsEntry: "/__z/entry.client.tsx",
|
|
22097
22356
|
dir: currentConfig.site?.dir
|
|
22098
22357
|
});
|
|
22099
|
-
const template = await vite.transformIndexHtml(
|
|
22358
|
+
const template = await vite.transformIndexHtml(url2, rawHtml);
|
|
22100
22359
|
if (this.options.ssr) {
|
|
22101
22360
|
const entryServer = await ssrEnvironment.runner.import(
|
|
22102
22361
|
getAppServerEntryPath()
|
|
22103
22362
|
);
|
|
22104
22363
|
const hasBody = req.method !== "GET" && req.method !== "HEAD";
|
|
22105
22364
|
const request = new Request(
|
|
22106
|
-
`${this.protocol}://${req.headers.host}${
|
|
22365
|
+
`${this.protocol}://${req.headers.host}${url2}`,
|
|
22107
22366
|
{
|
|
22108
22367
|
method: req.method,
|
|
22109
22368
|
headers: req.headers,
|
|
@@ -22150,9 +22409,9 @@ var DevServer = class {
|
|
|
22150
22409
|
});
|
|
22151
22410
|
this.terminator = createHttpTerminator({ server });
|
|
22152
22411
|
if (this.options.open || process.env.ZUDOKU_OPEN_BROWSER) {
|
|
22153
|
-
const
|
|
22412
|
+
const url2 = `${this.protocol}://localhost:${this.resolvedPort}`;
|
|
22154
22413
|
vite.resolvedUrls = {
|
|
22155
|
-
local: [`${
|
|
22414
|
+
local: [`${url2}${vite.config.base || "/"}`],
|
|
22156
22415
|
network: []
|
|
22157
22416
|
};
|
|
22158
22417
|
vite.openBrowser();
|
|
@@ -22169,7 +22428,7 @@ init_package_json();
|
|
|
22169
22428
|
async function dev(argv) {
|
|
22170
22429
|
const packageJson3 = getZudokuPackageJson();
|
|
22171
22430
|
process.env.NODE_ENV = "development";
|
|
22172
|
-
const dir =
|
|
22431
|
+
const dir = path69.resolve(process.cwd(), argv.dir);
|
|
22173
22432
|
const server = new DevServer({
|
|
22174
22433
|
dir,
|
|
22175
22434
|
argPort: argv.port,
|
|
@@ -22177,14 +22436,14 @@ async function dev(argv) {
|
|
|
22177
22436
|
open: argv.open
|
|
22178
22437
|
});
|
|
22179
22438
|
const { vite } = await server.start();
|
|
22180
|
-
const
|
|
22439
|
+
const url2 = joinUrl(
|
|
22181
22440
|
`${server.protocol}://localhost:${server.resolvedPort}`,
|
|
22182
22441
|
vite.config.base
|
|
22183
22442
|
);
|
|
22184
22443
|
printDiagnosticsToConsole("Ctrl+C to exit");
|
|
22185
22444
|
printDiagnosticsToConsole("");
|
|
22186
22445
|
printDiagnosticsToConsole(
|
|
22187
|
-
`\u{1F680} Running API ToGo v${packageJson3.version}: ${
|
|
22446
|
+
`\u{1F680} Running API ToGo v${packageJson3.version}: ${url2}`
|
|
22188
22447
|
);
|
|
22189
22448
|
printDiagnosticsToConsole("");
|
|
22190
22449
|
let hasExited = false;
|
|
@@ -22252,9 +22511,9 @@ var run_default = {
|
|
|
22252
22511
|
};
|
|
22253
22512
|
|
|
22254
22513
|
// src/cli/status/handler.ts
|
|
22255
|
-
import
|
|
22514
|
+
import path70 from "node:path";
|
|
22256
22515
|
async function status(argv) {
|
|
22257
|
-
const sourceDirectory =
|
|
22516
|
+
const sourceDirectory = path70.resolve(process.cwd(), argv.dir);
|
|
22258
22517
|
const config2 = loadConfig();
|
|
22259
22518
|
const client = new PlatformApiClient(config2);
|
|
22260
22519
|
let whoamiJson;
|
|
@@ -22334,7 +22593,7 @@ var status_default = {
|
|
|
22334
22593
|
};
|
|
22335
22594
|
|
|
22336
22595
|
// src/cli/teardown/handler.ts
|
|
22337
|
-
import
|
|
22596
|
+
import path71 from "node:path";
|
|
22338
22597
|
function resultLooksFailed3(payload) {
|
|
22339
22598
|
try {
|
|
22340
22599
|
const parsed = JSON.parse(payload);
|
|
@@ -22350,7 +22609,7 @@ async function teardown(argv) {
|
|
|
22350
22609
|
);
|
|
22351
22610
|
return;
|
|
22352
22611
|
}
|
|
22353
|
-
const sourceDirectory =
|
|
22612
|
+
const sourceDirectory = path71.resolve(process.cwd(), argv.dir);
|
|
22354
22613
|
const config2 = loadConfig();
|
|
22355
22614
|
const client = new PlatformApiClient(config2);
|
|
22356
22615
|
let projectId = argv.projectId?.trim();
|
|
@@ -22488,7 +22747,7 @@ function createApitogoCli(argv) {
|
|
|
22488
22747
|
process.env.ZUPLO = "1";
|
|
22489
22748
|
printDiagnosticsToConsole("Running in Zuplo mode");
|
|
22490
22749
|
}
|
|
22491
|
-
}).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();
|
|
22492
22751
|
}
|
|
22493
22752
|
|
|
22494
22753
|
// src/cli/cli.ts
|