@lukoweb/apitogo 0.2.18 → 0.2.21
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 +485 -451
- package/docs/cli/setup.md +27 -13
- package/package.json +1 -1
- package/src/config/v2/wrapper.ts +3 -1
- package/src/vite/config.ts +6 -1
- package/src/vite/watch-ignore.ts +70 -0
package/dist/cli/cli.js
CHANGED
|
@@ -836,7 +836,7 @@ import { stat as stat4 } from "node:fs/promises";
|
|
|
836
836
|
var fileExists;
|
|
837
837
|
var init_file_exists = __esm({
|
|
838
838
|
"src/config/file-exists.ts"() {
|
|
839
|
-
fileExists = (
|
|
839
|
+
fileExists = (path103) => stat4(path103).then(() => true).catch(() => false);
|
|
840
840
|
}
|
|
841
841
|
});
|
|
842
842
|
|
|
@@ -5267,7 +5267,7 @@ __export(llms_exports, {
|
|
|
5267
5267
|
generateLlmsTxtFiles: () => generateLlmsTxtFiles
|
|
5268
5268
|
});
|
|
5269
5269
|
import { writeFile as writeFile11 } from "node:fs/promises";
|
|
5270
|
-
import
|
|
5270
|
+
import path44 from "node:path";
|
|
5271
5271
|
import colors10 from "picocolors";
|
|
5272
5272
|
async function generateLlmsTxtFiles({
|
|
5273
5273
|
markdownFileInfos,
|
|
@@ -5302,7 +5302,7 @@ async function generateLlmsTxtFiles({
|
|
|
5302
5302
|
}
|
|
5303
5303
|
}
|
|
5304
5304
|
const llmsTxt2 = llmsTxtParts.join("\n");
|
|
5305
|
-
await writeFile11(
|
|
5305
|
+
await writeFile11(path44.join(baseOutputDir, "llms.txt"), llmsTxt2, "utf-8");
|
|
5306
5306
|
if (process.env.APITOGO_JSON_ONLY !== "1") {
|
|
5307
5307
|
console.log(colors10.blue("\u2713 generated llms.txt"));
|
|
5308
5308
|
}
|
|
@@ -5330,7 +5330,7 @@ ${info.content}
|
|
|
5330
5330
|
}
|
|
5331
5331
|
const llmsFull = llmsFullParts.join("\n");
|
|
5332
5332
|
await writeFile11(
|
|
5333
|
-
|
|
5333
|
+
path44.join(baseOutputDir, "llms-full.txt"),
|
|
5334
5334
|
llmsFull,
|
|
5335
5335
|
"utf-8"
|
|
5336
5336
|
);
|
|
@@ -5729,8 +5729,8 @@ async function warnIfOutdatedVersion(currentVersion) {
|
|
|
5729
5729
|
if (!process.env.ZUDOKU_OVERRIDE_CI_TO_TEST && (process.env.CI || process.env.ZUDOKU_DISABLE_UPDATE_CHECK)) {
|
|
5730
5730
|
return false;
|
|
5731
5731
|
}
|
|
5732
|
-
const versionCheckInfo = await getVersionCheckInfo();
|
|
5733
|
-
if (!versionCheckInfo
|
|
5732
|
+
const versionCheckInfo = await getVersionCheckInfo().catch(() => void 0);
|
|
5733
|
+
if (!versionCheckInfo?.latestVersion) {
|
|
5734
5734
|
return false;
|
|
5735
5735
|
}
|
|
5736
5736
|
const shouldWarn = gt(versionCheckInfo.latestVersion, currentVersion) && !process.env.ZUDOKU_INTERNAL_DEV;
|
|
@@ -5809,7 +5809,7 @@ init_package_json();
|
|
|
5809
5809
|
import yargs from "yargs/yargs";
|
|
5810
5810
|
|
|
5811
5811
|
// src/cli/services/handler.ts
|
|
5812
|
-
import
|
|
5812
|
+
import path53 from "node:path";
|
|
5813
5813
|
import { createInterface as createInterface2 } from "node:readline/promises";
|
|
5814
5814
|
|
|
5815
5815
|
// src/config/v2/errors.ts
|
|
@@ -6189,8 +6189,8 @@ var ConfigV2Schema = z.strictObject({
|
|
|
6189
6189
|
var REMOVED_KEYS = {
|
|
6190
6190
|
"plans.provider": "plans.provider was removed. Only plans.billing.provider (stripe or none) is selectable."
|
|
6191
6191
|
};
|
|
6192
|
-
function pathToString(
|
|
6193
|
-
return
|
|
6192
|
+
function pathToString(path103) {
|
|
6193
|
+
return path103.reduce(
|
|
6194
6194
|
(acc, segment) => typeof segment === "number" ? `${acc}[${segment}]` : acc === "" ? String(segment) : `${acc}.${String(segment)}`,
|
|
6195
6195
|
""
|
|
6196
6196
|
);
|
|
@@ -6210,9 +6210,9 @@ function step(schema2, segment) {
|
|
|
6210
6210
|
}
|
|
6211
6211
|
return void 0;
|
|
6212
6212
|
}
|
|
6213
|
-
function knownKeysAt(
|
|
6213
|
+
function knownKeysAt(path103) {
|
|
6214
6214
|
let current = ConfigV2Schema;
|
|
6215
|
-
for (const segment of
|
|
6215
|
+
for (const segment of path103) {
|
|
6216
6216
|
if (!current) return [];
|
|
6217
6217
|
current = step(current, segment);
|
|
6218
6218
|
}
|
|
@@ -6248,7 +6248,7 @@ function unknownKeyHint(fullPath, key, known) {
|
|
|
6248
6248
|
return known.length > 0 ? `Allowed keys: ${known.join(", ")}.` : void 0;
|
|
6249
6249
|
}
|
|
6250
6250
|
function mapIssue(issue3) {
|
|
6251
|
-
const
|
|
6251
|
+
const path103 = pathToString(issue3.path);
|
|
6252
6252
|
switch (issue3.code) {
|
|
6253
6253
|
case "unrecognized_keys":
|
|
6254
6254
|
return issue3.keys.map((key) => {
|
|
@@ -6264,20 +6264,20 @@ function mapIssue(issue3) {
|
|
|
6264
6264
|
return [
|
|
6265
6265
|
{
|
|
6266
6266
|
code: "CONFIG_INVALID_VALUE",
|
|
6267
|
-
path:
|
|
6267
|
+
path: path103,
|
|
6268
6268
|
message: `must be one of: ${issue3.values.map((v) => JSON.stringify(v)).join(", ")}.`
|
|
6269
6269
|
}
|
|
6270
6270
|
];
|
|
6271
6271
|
case "custom": {
|
|
6272
6272
|
const code = typeof issue3.params?.code === "string" ? issue3.params.code : "CONFIG_INVALID_VALUE";
|
|
6273
|
-
return [{ code, path:
|
|
6273
|
+
return [{ code, path: path103, message: issue3.message ?? "is invalid." }];
|
|
6274
6274
|
}
|
|
6275
6275
|
case "invalid_type":
|
|
6276
6276
|
return [
|
|
6277
|
-
/received undefined/.test(issue3.message) ? { code: "CONFIG_MISSING_FIELD", path:
|
|
6277
|
+
/received undefined/.test(issue3.message) ? { code: "CONFIG_MISSING_FIELD", path: path103, message: "is required." } : { code: "CONFIG_INVALID_VALUE", path: path103, message: issue3.message }
|
|
6278
6278
|
];
|
|
6279
6279
|
default:
|
|
6280
|
-
return [{ code: "CONFIG_INVALID_VALUE", path:
|
|
6280
|
+
return [{ code: "CONFIG_INVALID_VALUE", path: path103, message: issue3.message }];
|
|
6281
6281
|
}
|
|
6282
6282
|
}
|
|
6283
6283
|
function isRecord(value) {
|
|
@@ -7301,7 +7301,7 @@ var ServiceManifestSchema = z3.looseObject({
|
|
|
7301
7301
|
}).optional()
|
|
7302
7302
|
}).default({})
|
|
7303
7303
|
});
|
|
7304
|
-
var issue = (code,
|
|
7304
|
+
var issue = (code, path103, message, hint) => ({ code, path: path103, message, hint });
|
|
7305
7305
|
function parseManifest(raw, file = "services.json") {
|
|
7306
7306
|
const version = typeof raw === "object" && raw !== null && "schemaVersion" in raw ? raw.schemaVersion : void 0;
|
|
7307
7307
|
if (typeof version === "number" && version > SUPPORTED_MANIFEST_SCHEMA) {
|
|
@@ -7504,8 +7504,8 @@ var METHODS = [
|
|
|
7504
7504
|
"trace"
|
|
7505
7505
|
];
|
|
7506
7506
|
var isObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
|
|
7507
|
-
function actionKey(method,
|
|
7508
|
-
const trimmed =
|
|
7507
|
+
function actionKey(method, path103) {
|
|
7508
|
+
const trimmed = path103.trim();
|
|
7509
7509
|
const withSlash = trimmed.startsWith("/") ? trimmed : `/${trimmed}`;
|
|
7510
7510
|
const normalized = withSlash.length > 1 ? withSlash.replace(/\/+$/, "") || "/" : withSlash;
|
|
7511
7511
|
return `${method.trim().toLowerCase()}:${normalized}`;
|
|
@@ -7542,8 +7542,8 @@ var ReferenceSpecError = class extends Error {
|
|
|
7542
7542
|
};
|
|
7543
7543
|
function operationsOf(paths) {
|
|
7544
7544
|
return Object.entries(paths).flatMap(
|
|
7545
|
-
([
|
|
7546
|
-
(method) => [
|
|
7545
|
+
([path103, item]) => isObject(item) ? METHODS.filter((method) => isObject(item[method])).map(
|
|
7546
|
+
(method) => [path103, item, method]
|
|
7547
7547
|
) : []
|
|
7548
7548
|
);
|
|
7549
7549
|
}
|
|
@@ -7558,14 +7558,14 @@ function buildReferenceSpec(specText, options) {
|
|
|
7558
7558
|
throw new ReferenceSpecError("The OpenAPI file could not be read.");
|
|
7559
7559
|
const doc = structuredClone(root);
|
|
7560
7560
|
const paths = isObject(doc.paths) ? doc.paths : {};
|
|
7561
|
-
for (const [
|
|
7562
|
-
if (options.deniedOperations.has(actionKey(method,
|
|
7561
|
+
for (const [path103, item, method] of operationsOf(paths))
|
|
7562
|
+
if (options.deniedOperations.has(actionKey(method, path103)))
|
|
7563
7563
|
delete item[method];
|
|
7564
|
-
for (const [
|
|
7564
|
+
for (const [path103, item] of Object.entries(paths))
|
|
7565
7565
|
if (!isObject(item) || !METHODS.some((method) => method in item))
|
|
7566
|
-
delete paths[
|
|
7567
|
-
for (const [
|
|
7568
|
-
if (options.publicOperations.has(actionKey(method,
|
|
7566
|
+
delete paths[path103];
|
|
7567
|
+
for (const [path103, item, method] of operationsOf(paths))
|
|
7568
|
+
if (options.publicOperations.has(actionKey(method, path103)))
|
|
7569
7569
|
item[method].security = [];
|
|
7570
7570
|
doc.servers = [{ url: options.gatewayBaseUrl.replace(/\/+$/, "") }];
|
|
7571
7571
|
for (const item of Object.values(paths)) {
|
|
@@ -8049,7 +8049,7 @@ async function preparePortal(resolved, manifest, mode, options = {}) {
|
|
|
8049
8049
|
if (mode === "production") {
|
|
8050
8050
|
issues.push(...missingManifestServices(resolved, manifest));
|
|
8051
8051
|
}
|
|
8052
|
-
} else if (mode === "development") {
|
|
8052
|
+
} else if (mode === "development" && requiredServices(resolved).length > 0) {
|
|
8053
8053
|
effective = stubManifest(resolved);
|
|
8054
8054
|
manifestSource = "preview-stub";
|
|
8055
8055
|
} else {
|
|
@@ -8837,7 +8837,7 @@ init_invariant();
|
|
|
8837
8837
|
// src/cli/check/v2.ts
|
|
8838
8838
|
init_apitogo_config_core();
|
|
8839
8839
|
import { readFile as readFile14 } from "node:fs/promises";
|
|
8840
|
-
import
|
|
8840
|
+
import path49 from "node:path";
|
|
8841
8841
|
|
|
8842
8842
|
// src/cli/platform/client/platform-api.ts
|
|
8843
8843
|
import { basename } from "node:path";
|
|
@@ -8950,8 +8950,8 @@ var PlatformApiClient = class {
|
|
|
8950
8950
|
constructor(config2) {
|
|
8951
8951
|
this.config = config2;
|
|
8952
8952
|
}
|
|
8953
|
-
url(
|
|
8954
|
-
return `${this.config.apiUrl}${
|
|
8953
|
+
url(path103) {
|
|
8954
|
+
return `${this.config.apiUrl}${path103.startsWith("/") ? path103 : `/${path103}`}`;
|
|
8955
8955
|
}
|
|
8956
8956
|
headers(extra) {
|
|
8957
8957
|
return {
|
|
@@ -8961,9 +8961,9 @@ var PlatformApiClient = class {
|
|
|
8961
8961
|
...extra
|
|
8962
8962
|
};
|
|
8963
8963
|
}
|
|
8964
|
-
async request(method,
|
|
8964
|
+
async request(method, path103, init4) {
|
|
8965
8965
|
const response = await fetchWithRetry(
|
|
8966
|
-
this.url(
|
|
8966
|
+
this.url(path103),
|
|
8967
8967
|
{
|
|
8968
8968
|
method,
|
|
8969
8969
|
...init4,
|
|
@@ -9326,15 +9326,15 @@ var PlatformApiClient = class {
|
|
|
9326
9326
|
}
|
|
9327
9327
|
);
|
|
9328
9328
|
}
|
|
9329
|
-
deleteDevPortalPage(projectId,
|
|
9330
|
-
const query = new URLSearchParams({ path:
|
|
9329
|
+
deleteDevPortalPage(projectId, path103) {
|
|
9330
|
+
const query = new URLSearchParams({ path: path103 });
|
|
9331
9331
|
return this.request(
|
|
9332
9332
|
"DELETE",
|
|
9333
9333
|
`/api/v1/projects/${projectId}/dev-portal/pages/files?${query.toString()}`
|
|
9334
9334
|
);
|
|
9335
9335
|
}
|
|
9336
|
-
renameDevPortalPage(projectId,
|
|
9337
|
-
const query = new URLSearchParams({ path:
|
|
9336
|
+
renameDevPortalPage(projectId, path103, newName) {
|
|
9337
|
+
const query = new URLSearchParams({ path: path103 });
|
|
9338
9338
|
return this.request(
|
|
9339
9339
|
"POST",
|
|
9340
9340
|
`/api/v1/projects/${projectId}/dev-portal/pages/files/rename?${query.toString()}`,
|
|
@@ -9450,8 +9450,8 @@ var PlatformApiClient = class {
|
|
|
9450
9450
|
* the project-less endpoint is used; `planTier` overrides the tier used for paid-plan checks.
|
|
9451
9451
|
*/
|
|
9452
9452
|
validateGatewayPlans(plans, options = {}) {
|
|
9453
|
-
const
|
|
9454
|
-
return this.request("POST",
|
|
9453
|
+
const path103 = options.projectId ? `/api/v1/projects/${options.projectId}/gateway/plans/validate` : "/api/v1/gateway/plans/validate";
|
|
9454
|
+
return this.request("POST", path103, {
|
|
9455
9455
|
headers: { "Content-Type": "application/json" },
|
|
9456
9456
|
body: JSON.stringify({ plans, planTier: options.planTier })
|
|
9457
9457
|
});
|
|
@@ -9656,11 +9656,11 @@ import {
|
|
|
9656
9656
|
writeFile as writeFile14
|
|
9657
9657
|
} from "node:fs/promises";
|
|
9658
9658
|
import { createRequire as createRequire2 } from "node:module";
|
|
9659
|
-
import
|
|
9659
|
+
import path48 from "node:path";
|
|
9660
9660
|
|
|
9661
9661
|
// src/vite/build.ts
|
|
9662
9662
|
import { mkdir as mkdir11, readFile as readFile10, rename as rename5, rm as rm7, writeFile as writeFile12 } from "node:fs/promises";
|
|
9663
|
-
import
|
|
9663
|
+
import path46 from "node:path";
|
|
9664
9664
|
import { build as esbuild } from "esbuild";
|
|
9665
9665
|
import { build as viteBuild, mergeConfig as mergeConfig3 } from "vite";
|
|
9666
9666
|
|
|
@@ -9796,7 +9796,7 @@ init_invariant();
|
|
|
9796
9796
|
init_joinUrl();
|
|
9797
9797
|
|
|
9798
9798
|
// src/vite/config.ts
|
|
9799
|
-
import
|
|
9799
|
+
import path41 from "node:path";
|
|
9800
9800
|
import dotenv from "dotenv";
|
|
9801
9801
|
import colors8 from "picocolors";
|
|
9802
9802
|
import {
|
|
@@ -9807,7 +9807,7 @@ import {
|
|
|
9807
9807
|
// package.json
|
|
9808
9808
|
var package_default = {
|
|
9809
9809
|
name: "@lukoweb/apitogo",
|
|
9810
|
-
version: "0.2.
|
|
9810
|
+
version: "0.2.21",
|
|
9811
9811
|
type: "module",
|
|
9812
9812
|
sideEffects: [
|
|
9813
9813
|
"**/*.css",
|
|
@@ -10589,14 +10589,14 @@ var flattenAllOf = (schema2) => {
|
|
|
10589
10589
|
};
|
|
10590
10590
|
|
|
10591
10591
|
// src/lib/util/traverse.ts
|
|
10592
|
-
var traverse = (specification, transform,
|
|
10593
|
-
const transformed = transform(specification,
|
|
10592
|
+
var traverse = (specification, transform, path103 = []) => {
|
|
10593
|
+
const transformed = transform(specification, path103);
|
|
10594
10594
|
if (typeof transformed !== "object" || transformed === null) {
|
|
10595
10595
|
return transformed;
|
|
10596
10596
|
}
|
|
10597
10597
|
const result = Array.isArray(transformed) ? [] : {};
|
|
10598
10598
|
for (const [key, value] of Object.entries(transformed)) {
|
|
10599
|
-
const currentPath = [...
|
|
10599
|
+
const currentPath = [...path103, key];
|
|
10600
10600
|
if (Array.isArray(value)) {
|
|
10601
10601
|
result[key] = value.map(
|
|
10602
10602
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -10624,9 +10624,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
10624
10624
|
if (schemaCache?.has(ref)) {
|
|
10625
10625
|
return schemaCache.get(ref);
|
|
10626
10626
|
}
|
|
10627
|
-
const
|
|
10627
|
+
const path103 = ref.split("/").slice(1);
|
|
10628
10628
|
let current = schema2;
|
|
10629
|
-
for (const segment of
|
|
10629
|
+
for (const segment of path103) {
|
|
10630
10630
|
if (!current || typeof current !== "object") {
|
|
10631
10631
|
current = null;
|
|
10632
10632
|
}
|
|
@@ -10645,7 +10645,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10645
10645
|
}
|
|
10646
10646
|
const cloned = structuredClone(schema2);
|
|
10647
10647
|
const visited = /* @__PURE__ */ new Set();
|
|
10648
|
-
const resolve = async (current,
|
|
10648
|
+
const resolve = async (current, path103) => {
|
|
10649
10649
|
if (isIndexableObject(current)) {
|
|
10650
10650
|
if (visited.has(current)) {
|
|
10651
10651
|
return CIRCULAR_REF;
|
|
@@ -10653,7 +10653,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10653
10653
|
visited.add(current);
|
|
10654
10654
|
if (Array.isArray(current)) {
|
|
10655
10655
|
for (let index = 0; index < current.length; index++) {
|
|
10656
|
-
current[index] = await resolve(current[index], `${
|
|
10656
|
+
current[index] = await resolve(current[index], `${path103}/${index}`);
|
|
10657
10657
|
}
|
|
10658
10658
|
} else {
|
|
10659
10659
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -10664,13 +10664,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10664
10664
|
for (const resolver of resolvers) {
|
|
10665
10665
|
const resolved = await resolver($ref);
|
|
10666
10666
|
if (resolved) {
|
|
10667
|
-
result2 = await resolve(resolved,
|
|
10667
|
+
result2 = await resolve(resolved, path103);
|
|
10668
10668
|
break;
|
|
10669
10669
|
}
|
|
10670
10670
|
}
|
|
10671
10671
|
if (result2 === void 0) {
|
|
10672
10672
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
10673
|
-
result2 = await resolve(resolved,
|
|
10673
|
+
result2 = await resolve(resolved, path103);
|
|
10674
10674
|
}
|
|
10675
10675
|
if (hasSiblings) {
|
|
10676
10676
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -10683,7 +10683,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
10683
10683
|
return result2;
|
|
10684
10684
|
}
|
|
10685
10685
|
for (const key in current) {
|
|
10686
|
-
current[key] = await resolve(current[key], `${
|
|
10686
|
+
current[key] = await resolve(current[key], `${path103}/${key}`);
|
|
10687
10687
|
}
|
|
10688
10688
|
}
|
|
10689
10689
|
visited.delete(current);
|
|
@@ -10722,9 +10722,9 @@ var upgradeSchema = (schema2) => {
|
|
|
10722
10722
|
}
|
|
10723
10723
|
return sub;
|
|
10724
10724
|
});
|
|
10725
|
-
schema2 = traverse(schema2, (sub,
|
|
10725
|
+
schema2 = traverse(schema2, (sub, path103) => {
|
|
10726
10726
|
if (sub.example !== void 0) {
|
|
10727
|
-
if (isSchemaPath(
|
|
10727
|
+
if (isSchemaPath(path103 ?? [])) {
|
|
10728
10728
|
sub.examples = [sub.example];
|
|
10729
10729
|
} else {
|
|
10730
10730
|
sub.examples = {
|
|
@@ -10737,11 +10737,11 @@ var upgradeSchema = (schema2) => {
|
|
|
10737
10737
|
}
|
|
10738
10738
|
return sub;
|
|
10739
10739
|
});
|
|
10740
|
-
schema2 = traverse(schema2, (schema3,
|
|
10740
|
+
schema2 = traverse(schema2, (schema3, path103) => {
|
|
10741
10741
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
10742
|
-
const parentPath =
|
|
10742
|
+
const parentPath = path103?.slice(0, -1);
|
|
10743
10743
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
10744
|
-
return segment === "content" &&
|
|
10744
|
+
return segment === "content" && path103?.[index + 1] === "multipart/form-data";
|
|
10745
10745
|
});
|
|
10746
10746
|
if (isMultipart) {
|
|
10747
10747
|
const entries = Object.entries(schema3.properties);
|
|
@@ -10755,8 +10755,8 @@ var upgradeSchema = (schema2) => {
|
|
|
10755
10755
|
}
|
|
10756
10756
|
return schema3;
|
|
10757
10757
|
});
|
|
10758
|
-
schema2 = traverse(schema2, (schema3,
|
|
10759
|
-
if (
|
|
10758
|
+
schema2 = traverse(schema2, (schema3, path103) => {
|
|
10759
|
+
if (path103?.includes("content") && path103.includes("application/octet-stream")) {
|
|
10760
10760
|
return {};
|
|
10761
10761
|
}
|
|
10762
10762
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -10782,11 +10782,11 @@ var upgradeSchema = (schema2) => {
|
|
|
10782
10782
|
}
|
|
10783
10783
|
return sub;
|
|
10784
10784
|
});
|
|
10785
|
-
schema2 = traverse(schema2, (schema3,
|
|
10785
|
+
schema2 = traverse(schema2, (schema3, path103) => {
|
|
10786
10786
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
10787
|
-
const parentPath =
|
|
10787
|
+
const parentPath = path103?.slice(0, -1);
|
|
10788
10788
|
const contentMediaType = parentPath?.find(
|
|
10789
|
-
(_, index) =>
|
|
10789
|
+
(_, index) => path103?.[index - 1] === "content"
|
|
10790
10790
|
);
|
|
10791
10791
|
return {
|
|
10792
10792
|
type: "string",
|
|
@@ -10798,7 +10798,7 @@ var upgradeSchema = (schema2) => {
|
|
|
10798
10798
|
});
|
|
10799
10799
|
return schema2;
|
|
10800
10800
|
};
|
|
10801
|
-
function isSchemaPath(
|
|
10801
|
+
function isSchemaPath(path103) {
|
|
10802
10802
|
const schemaLocations = [
|
|
10803
10803
|
["components", "schemas"],
|
|
10804
10804
|
"properties",
|
|
@@ -10811,10 +10811,10 @@ function isSchemaPath(path102) {
|
|
|
10811
10811
|
];
|
|
10812
10812
|
return schemaLocations.some((location) => {
|
|
10813
10813
|
if (Array.isArray(location)) {
|
|
10814
|
-
return location.every((segment, index) =>
|
|
10814
|
+
return location.every((segment, index) => path103[index] === segment);
|
|
10815
10815
|
}
|
|
10816
|
-
return
|
|
10817
|
-
}) ||
|
|
10816
|
+
return path103.includes(location);
|
|
10817
|
+
}) || path103.includes("schema") || path103.some((segment) => segment.endsWith("Schema"));
|
|
10818
10818
|
}
|
|
10819
10819
|
|
|
10820
10820
|
// src/lib/oas/parser/index.ts
|
|
@@ -10896,13 +10896,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
10896
10896
|
"anyOf",
|
|
10897
10897
|
"oneOf"
|
|
10898
10898
|
]);
|
|
10899
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
10899
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path103 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
10900
10900
|
if (obj === null || typeof obj !== "object") return obj;
|
|
10901
10901
|
const refPath = obj.__$ref;
|
|
10902
10902
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
10903
10903
|
if (isCircular) {
|
|
10904
10904
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
10905
|
-
const circularProp =
|
|
10905
|
+
const circularProp = path103.find((p) => !OPENAPI_PROPS.has(p)) || path103[0];
|
|
10906
10906
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
10907
10907
|
}
|
|
10908
10908
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -10912,7 +10912,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
10912
10912
|
value,
|
|
10913
10913
|
currentPath,
|
|
10914
10914
|
refs,
|
|
10915
|
-
[...
|
|
10915
|
+
[...path103, key],
|
|
10916
10916
|
currentRefPaths
|
|
10917
10917
|
);
|
|
10918
10918
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -10947,7 +10947,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
10947
10947
|
var getAllTags = (schema2) => {
|
|
10948
10948
|
const rootTags = schema2.tags ?? [];
|
|
10949
10949
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
10950
|
-
(
|
|
10950
|
+
(path103) => HttpMethods.map((k) => path103?.[k]).filter((op) => op != null)
|
|
10951
10951
|
);
|
|
10952
10952
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
10953
10953
|
const hasUntaggedOperations = operations.some(
|
|
@@ -11002,7 +11002,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
11002
11002
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
11003
11003
|
var getAllOperations = (paths) => {
|
|
11004
11004
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
11005
|
-
([
|
|
11005
|
+
([path103, value]) => HttpMethods.flatMap((method) => {
|
|
11006
11006
|
if (!value?.[method]) return [];
|
|
11007
11007
|
const operation = value[method];
|
|
11008
11008
|
const pathParameters = value.parameters ?? [];
|
|
@@ -11022,7 +11022,7 @@ var getAllOperations = (paths) => {
|
|
|
11022
11022
|
return {
|
|
11023
11023
|
...operation,
|
|
11024
11024
|
method,
|
|
11025
|
-
path:
|
|
11025
|
+
path: path103,
|
|
11026
11026
|
parameters,
|
|
11027
11027
|
servers,
|
|
11028
11028
|
tags: operation.tags ?? []
|
|
@@ -11380,8 +11380,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
11380
11380
|
}),
|
|
11381
11381
|
paths: t.field({
|
|
11382
11382
|
type: [PathItem],
|
|
11383
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
11384
|
-
path:
|
|
11383
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path103, value]) => ({
|
|
11384
|
+
path: path103,
|
|
11385
11385
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
11386
11386
|
methods: Object.keys(value)
|
|
11387
11387
|
}))
|
|
@@ -11546,7 +11546,7 @@ init_joinUrl();
|
|
|
11546
11546
|
|
|
11547
11547
|
// src/vite/api/schema-codegen.ts
|
|
11548
11548
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
11549
|
-
var getSegmentsFromPath = (
|
|
11549
|
+
var getSegmentsFromPath = (path103) => path103.split("/").slice(1).map(unescapeJsonPointer);
|
|
11550
11550
|
var createLocalRefMap = (obj) => {
|
|
11551
11551
|
const refMap = /* @__PURE__ */ new Map();
|
|
11552
11552
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -11577,16 +11577,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
11577
11577
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
11578
11578
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
11579
11579
|
);
|
|
11580
|
-
var lookup = (schema2,
|
|
11581
|
-
const parts = getSegmentsFromPath(
|
|
11580
|
+
var lookup = (schema2, path103, filePath) => {
|
|
11581
|
+
const parts = getSegmentsFromPath(path103);
|
|
11582
11582
|
let val = schema2;
|
|
11583
11583
|
for (const part of parts) {
|
|
11584
11584
|
while (val.$ref?.startsWith("#/")) {
|
|
11585
|
-
val = val.$ref ===
|
|
11585
|
+
val = val.$ref === path103 ? val : lookup(schema2, val.$ref, filePath);
|
|
11586
11586
|
}
|
|
11587
11587
|
if (val[part] === void 0) {
|
|
11588
11588
|
throw new Error(
|
|
11589
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
11589
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path103}`
|
|
11590
11590
|
);
|
|
11591
11591
|
}
|
|
11592
11592
|
val = val[part];
|
|
@@ -11831,8 +11831,8 @@ var SchemaManager = class {
|
|
|
11831
11831
|
}
|
|
11832
11832
|
}
|
|
11833
11833
|
};
|
|
11834
|
-
getLatestSchema = (
|
|
11835
|
-
getSchemasForPath = (
|
|
11834
|
+
getLatestSchema = (path103) => this.processedSchemas[path103]?.at(0);
|
|
11835
|
+
getSchemasForPath = (path103) => this.processedSchemas[path103];
|
|
11836
11836
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
11837
11837
|
getUrlToFilePathMap = () => {
|
|
11838
11838
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -13855,14 +13855,46 @@ function vitePlugin() {
|
|
|
13855
13855
|
];
|
|
13856
13856
|
}
|
|
13857
13857
|
|
|
13858
|
+
// src/vite/watch-ignore.ts
|
|
13859
|
+
import { lstatSync, realpathSync } from "node:fs";
|
|
13860
|
+
import path40 from "node:path";
|
|
13861
|
+
var STATE_INSIDE_CONTENT = /[\\/]content[\\/](?:\.apitogo|apitogo[\\/]\.state)(?:[\\/]|$)/;
|
|
13862
|
+
var within = (base, file) => file === base || file.startsWith(base + path40.sep);
|
|
13863
|
+
var unique = (paths) => [...new Set(paths)];
|
|
13864
|
+
function isWorkspace(root) {
|
|
13865
|
+
try {
|
|
13866
|
+
return path40.basename(root) === "generated" && lstatSync(path40.join(root, "content")).isSymbolicLink();
|
|
13867
|
+
} catch {
|
|
13868
|
+
return false;
|
|
13869
|
+
}
|
|
13870
|
+
}
|
|
13871
|
+
function tenantDir(root) {
|
|
13872
|
+
return isWorkspace(root) ? realpathSync(path40.join(root, "content")) : void 0;
|
|
13873
|
+
}
|
|
13874
|
+
function stateIgnore(root) {
|
|
13875
|
+
if (!isWorkspace(root)) return void 0;
|
|
13876
|
+
const state = path40.dirname(root);
|
|
13877
|
+
const states = unique([state, realpathSync(state)]);
|
|
13878
|
+
const roots = unique([root, realpathSync(root)]);
|
|
13879
|
+
return (file) => {
|
|
13880
|
+
if (!states.some((base) => within(base, file))) return false;
|
|
13881
|
+
if (!roots.some((base) => within(base, file))) return true;
|
|
13882
|
+
return STATE_INSIDE_CONTENT.test(file);
|
|
13883
|
+
};
|
|
13884
|
+
}
|
|
13885
|
+
function devServerAllow(root, moduleDir) {
|
|
13886
|
+
const tenant = tenantDir(root);
|
|
13887
|
+
return [root, path40.dirname(root), moduleDir, ...tenant ? [tenant] : []];
|
|
13888
|
+
}
|
|
13889
|
+
|
|
13858
13890
|
// src/vite/config.ts
|
|
13859
13891
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
13860
13892
|
if (merged.publicDir === false) return void 0;
|
|
13861
13893
|
const rel2 = typeof merged.publicDir === "string" ? merged.publicDir : "public";
|
|
13862
|
-
return
|
|
13894
|
+
return path41.resolve(rootDir, rel2);
|
|
13863
13895
|
};
|
|
13864
|
-
var getAppClientEntryPath = () =>
|
|
13865
|
-
var getAppServerEntryPath = () =>
|
|
13896
|
+
var getAppClientEntryPath = () => path41.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
|
|
13897
|
+
var getAppServerEntryPath = () => path41.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
13866
13898
|
var hasLoggedCdnInfo = false;
|
|
13867
13899
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
13868
13900
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
@@ -13890,9 +13922,10 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13890
13922
|
value
|
|
13891
13923
|
])
|
|
13892
13924
|
);
|
|
13925
|
+
const ignoreState = stateIgnore(dir);
|
|
13893
13926
|
if (ZuploEnv.isZuplo) {
|
|
13894
13927
|
dotenv.config({
|
|
13895
|
-
path:
|
|
13928
|
+
path: path41.resolve(config2.__meta.rootDir, "../.env.zuplo"),
|
|
13896
13929
|
quiet: true
|
|
13897
13930
|
});
|
|
13898
13931
|
}
|
|
@@ -13938,7 +13971,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13938
13971
|
middlewareMode: true,
|
|
13939
13972
|
open: true,
|
|
13940
13973
|
fs: {
|
|
13941
|
-
allow:
|
|
13974
|
+
allow: devServerAllow(dir, config2.__meta.moduleDir)
|
|
13942
13975
|
},
|
|
13943
13976
|
watch: {
|
|
13944
13977
|
ignored: [
|
|
@@ -13946,7 +13979,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13946
13979
|
`${dir}/lib`,
|
|
13947
13980
|
`${dir}/.git`,
|
|
13948
13981
|
`${config2.__meta.moduleDir}/src/vite`,
|
|
13949
|
-
`${config2.__meta.moduleDir}/src/cli
|
|
13982
|
+
`${config2.__meta.moduleDir}/src/cli`,
|
|
13983
|
+
...ignoreState ? [ignoreState] : []
|
|
13950
13984
|
]
|
|
13951
13985
|
}
|
|
13952
13986
|
},
|
|
@@ -13954,8 +13988,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13954
13988
|
ssr: configEnv.isSsrBuild,
|
|
13955
13989
|
sourcemap: true,
|
|
13956
13990
|
target: "es2022",
|
|
13957
|
-
outDir:
|
|
13958
|
-
|
|
13991
|
+
outDir: path41.resolve(
|
|
13992
|
+
path41.join(
|
|
13959
13993
|
dir,
|
|
13960
13994
|
"dist",
|
|
13961
13995
|
config2.basePath ?? "",
|
|
@@ -13974,7 +14008,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13974
14008
|
},
|
|
13975
14009
|
experimental: {
|
|
13976
14010
|
renderBuiltUrl(filename) {
|
|
13977
|
-
if (cdnUrl?.base && [".js", ".css"].includes(
|
|
14011
|
+
if (cdnUrl?.base && [".js", ".css"].includes(path41.extname(filename))) {
|
|
13978
14012
|
return joinUrl(cdnUrl.base, filename);
|
|
13979
14013
|
}
|
|
13980
14014
|
if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
|
|
@@ -13987,7 +14021,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13987
14021
|
esbuildOptions: {
|
|
13988
14022
|
target: "es2022"
|
|
13989
14023
|
},
|
|
13990
|
-
entries: [
|
|
14024
|
+
entries: [path41.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
|
|
13991
14025
|
exclude: [
|
|
13992
14026
|
"@lukoweb/apitogo",
|
|
13993
14027
|
"@lukoweb/apitogo-plugin-dev-portal-billing"
|
|
@@ -14091,7 +14125,7 @@ init_package_json();
|
|
|
14091
14125
|
init_joinUrl();
|
|
14092
14126
|
import assert from "node:assert";
|
|
14093
14127
|
import { cp, mkdir as mkdir9, writeFile as writeFile10 } from "node:fs/promises";
|
|
14094
|
-
import
|
|
14128
|
+
import path42 from "node:path";
|
|
14095
14129
|
var pkgJson = getZudokuPackageJson();
|
|
14096
14130
|
function generateOutput({
|
|
14097
14131
|
config: config2,
|
|
@@ -14148,9 +14182,9 @@ async function writeOutput(dir, {
|
|
|
14148
14182
|
rewrites
|
|
14149
14183
|
}) {
|
|
14150
14184
|
const output4 = generateOutput({ config: config2, redirects, rewrites });
|
|
14151
|
-
const outputDir = process.env.VERCEL ?
|
|
14185
|
+
const outputDir = process.env.VERCEL ? path42.join(dir, ".vercel/output") : path42.join(dir, "dist/.output");
|
|
14152
14186
|
await mkdir9(outputDir, { recursive: true });
|
|
14153
|
-
const outputFile =
|
|
14187
|
+
const outputFile = path42.join(outputDir, "config.json");
|
|
14154
14188
|
await writeFile10(outputFile, JSON.stringify(output4, null, 2), "utf-8");
|
|
14155
14189
|
if (process.env.VERCEL) {
|
|
14156
14190
|
console.log("Wrote Vercel output to", outputDir);
|
|
@@ -14162,7 +14196,7 @@ init_logger();
|
|
|
14162
14196
|
init_file_exists();
|
|
14163
14197
|
import { readFile as readFile9, rm as rm6 } from "node:fs/promises";
|
|
14164
14198
|
import os from "node:os";
|
|
14165
|
-
import
|
|
14199
|
+
import path45 from "node:path";
|
|
14166
14200
|
import { pathToFileURL } from "node:url";
|
|
14167
14201
|
import { createIndex } from "pagefind";
|
|
14168
14202
|
import colors11 from "picocolors";
|
|
@@ -14204,7 +14238,7 @@ function throttle(fn) {
|
|
|
14204
14238
|
init_joinUrl();
|
|
14205
14239
|
import { createWriteStream, existsSync as existsSync4 } from "node:fs";
|
|
14206
14240
|
import { mkdir as mkdir10 } from "node:fs/promises";
|
|
14207
|
-
import
|
|
14241
|
+
import path43 from "node:path";
|
|
14208
14242
|
import colors9 from "picocolors";
|
|
14209
14243
|
import { SitemapStream } from "sitemap";
|
|
14210
14244
|
async function generateSitemap({
|
|
@@ -14218,11 +14252,11 @@ async function generateSitemap({
|
|
|
14218
14252
|
return;
|
|
14219
14253
|
}
|
|
14220
14254
|
const sitemap = new SitemapStream({ hostname: config2.siteUrl });
|
|
14221
|
-
const outputDir =
|
|
14255
|
+
const outputDir = path43.resolve(baseOutputDir, config2.outDir ?? "");
|
|
14222
14256
|
if (!existsSync4(outputDir)) {
|
|
14223
14257
|
await mkdir10(outputDir, { recursive: true });
|
|
14224
14258
|
}
|
|
14225
|
-
const sitemapOutputPath =
|
|
14259
|
+
const sitemapOutputPath = path43.join(outputDir, "sitemap.xml");
|
|
14226
14260
|
const writeStream = createWriteStream(sitemapOutputPath);
|
|
14227
14261
|
sitemap.pipe(writeStream);
|
|
14228
14262
|
let lastmod;
|
|
@@ -14252,14 +14286,14 @@ async function generateSitemap({
|
|
|
14252
14286
|
|
|
14253
14287
|
// src/vite/prerender/utils.ts
|
|
14254
14288
|
init_joinUrl();
|
|
14255
|
-
var resolveRoutePath = (
|
|
14256
|
-
const segments =
|
|
14289
|
+
var resolveRoutePath = (path103) => {
|
|
14290
|
+
const segments = path103.split("/");
|
|
14257
14291
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
14258
14292
|
return void 0;
|
|
14259
14293
|
}
|
|
14260
14294
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
14261
14295
|
};
|
|
14262
|
-
var isSkipped = (
|
|
14296
|
+
var isSkipped = (path103) => path103.includes("*") || /^\d+$/.test(path103);
|
|
14263
14297
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
14264
14298
|
if (route.path && isSkipped(route.path)) return [];
|
|
14265
14299
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -14308,12 +14342,12 @@ var prerender = async ({
|
|
|
14308
14342
|
serverConfigFilename,
|
|
14309
14343
|
writeRedirects = true
|
|
14310
14344
|
}) => {
|
|
14311
|
-
const distDir =
|
|
14345
|
+
const distDir = path45.join(dir, "dist", basePath);
|
|
14312
14346
|
const serverConfigPath = pathToFileURL(
|
|
14313
|
-
|
|
14347
|
+
path45.join(distDir, "server", serverConfigFilename)
|
|
14314
14348
|
).href;
|
|
14315
14349
|
const entryServerPath = pathToFileURL(
|
|
14316
|
-
|
|
14350
|
+
path45.join(distDir, "server/entry.server.js")
|
|
14317
14351
|
).href;
|
|
14318
14352
|
const rawConfig = await import(serverConfigPath).then(
|
|
14319
14353
|
(m) => m.default
|
|
@@ -14398,7 +14432,7 @@ var prerender = async ({
|
|
|
14398
14432
|
})
|
|
14399
14433
|
);
|
|
14400
14434
|
const pagefindWriteResult = await pagefindIndex?.writeFiles({
|
|
14401
|
-
outputPath:
|
|
14435
|
+
outputPath: path45.join(distDir, "pagefind")
|
|
14402
14436
|
});
|
|
14403
14437
|
const seconds = ((performance.now() - start) / 1e3).toFixed(1);
|
|
14404
14438
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
@@ -14430,7 +14464,7 @@ var prerender = async ({
|
|
|
14430
14464
|
const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
|
|
14431
14465
|
const docsConfig = DocsConfigSchema2.parse(config2.docs);
|
|
14432
14466
|
const llmsConfig = docsConfig.llms ?? {};
|
|
14433
|
-
const markdownInfoPath =
|
|
14467
|
+
const markdownInfoPath = path45.join(
|
|
14434
14468
|
dir,
|
|
14435
14469
|
"node_modules/.apitogo/markdown-info.json"
|
|
14436
14470
|
);
|
|
@@ -14521,7 +14555,7 @@ async function runBuild(options) {
|
|
|
14521
14555
|
html,
|
|
14522
14556
|
basePath: config2.basePath
|
|
14523
14557
|
});
|
|
14524
|
-
await rm7(
|
|
14558
|
+
await rm7(path46.join(clientOutDir, "index.html"), { force: true });
|
|
14525
14559
|
} else {
|
|
14526
14560
|
await runPrerender({
|
|
14527
14561
|
dir,
|
|
@@ -14545,7 +14579,7 @@ var runPrerender = async (options) => {
|
|
|
14545
14579
|
serverConfigFilename,
|
|
14546
14580
|
writeRedirects: process.env.VERCEL === void 0
|
|
14547
14581
|
});
|
|
14548
|
-
const indexHtml =
|
|
14582
|
+
const indexHtml = path46.join(clientOutDir, "index.html");
|
|
14549
14583
|
if (!workerResults.find((r) => r.outputPath === indexHtml)) {
|
|
14550
14584
|
await writeFile12(indexHtml, html, "utf-8");
|
|
14551
14585
|
}
|
|
@@ -14555,15 +14589,15 @@ var runPrerender = async (options) => {
|
|
|
14555
14589
|
for (const statusPage of statusPages) {
|
|
14556
14590
|
await rename5(
|
|
14557
14591
|
statusPage,
|
|
14558
|
-
|
|
14592
|
+
path46.join(dir, DIST_DIR, path46.basename(statusPage))
|
|
14559
14593
|
);
|
|
14560
14594
|
}
|
|
14561
14595
|
await rm7(serverOutDir, { recursive: true, force: true });
|
|
14562
14596
|
if (process.env.VERCEL) {
|
|
14563
|
-
await mkdir11(
|
|
14597
|
+
await mkdir11(path46.join(dir, ".vercel/output/static"), { recursive: true });
|
|
14564
14598
|
await rename5(
|
|
14565
|
-
|
|
14566
|
-
|
|
14599
|
+
path46.join(dir, DIST_DIR),
|
|
14600
|
+
path46.join(dir, ".vercel/output/static")
|
|
14567
14601
|
);
|
|
14568
14602
|
}
|
|
14569
14603
|
await writeOutput(dir, {
|
|
@@ -14573,7 +14607,7 @@ var runPrerender = async (options) => {
|
|
|
14573
14607
|
});
|
|
14574
14608
|
if (ZuploEnv.isZuplo && issuer) {
|
|
14575
14609
|
await writeFile12(
|
|
14576
|
-
|
|
14610
|
+
path46.join(dir, DIST_DIR, ".output/zuplo.json"),
|
|
14577
14611
|
JSON.stringify({ issuer }, null, 2),
|
|
14578
14612
|
"utf-8"
|
|
14579
14613
|
);
|
|
@@ -14585,10 +14619,10 @@ var runPrerender = async (options) => {
|
|
|
14585
14619
|
};
|
|
14586
14620
|
var bundleSSREntry = async (options) => {
|
|
14587
14621
|
const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
|
|
14588
|
-
const tempEntryPath =
|
|
14622
|
+
const tempEntryPath = path46.join(dir, "__ssr-entry.ts");
|
|
14589
14623
|
const packageRoot = getZudokuRootDir();
|
|
14590
14624
|
const templateContent = await readFile10(
|
|
14591
|
-
|
|
14625
|
+
path46.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
|
|
14592
14626
|
"utf-8"
|
|
14593
14627
|
);
|
|
14594
14628
|
const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
|
|
@@ -14603,9 +14637,9 @@ var bundleSSREntry = async (options) => {
|
|
|
14603
14637
|
platform: adapter === "node" ? "node" : "neutral",
|
|
14604
14638
|
target: "es2022",
|
|
14605
14639
|
format: "esm",
|
|
14606
|
-
outfile:
|
|
14640
|
+
outfile: path46.join(serverOutDir, "entry.js"),
|
|
14607
14641
|
external: ["./entry.server.js", `./${serverConfigFilename}`],
|
|
14608
|
-
nodePaths: [
|
|
14642
|
+
nodePaths: [path46.join(packageRoot, "node_modules")],
|
|
14609
14643
|
banner: { js: "// Bundled SSR entry" }
|
|
14610
14644
|
});
|
|
14611
14645
|
} finally {
|
|
@@ -14619,7 +14653,7 @@ init_package_json();
|
|
|
14619
14653
|
// src/cli/init/v2-packages.ts
|
|
14620
14654
|
import { existsSync as existsSync5 } from "node:fs";
|
|
14621
14655
|
import { readFile as readFile11, writeFile as writeFile13 } from "node:fs/promises";
|
|
14622
|
-
import
|
|
14656
|
+
import path47 from "node:path";
|
|
14623
14657
|
var CORE_PACKAGES = [
|
|
14624
14658
|
"@lukoweb/apitogo",
|
|
14625
14659
|
"react",
|
|
@@ -14636,7 +14670,7 @@ function packageNameFrom(name) {
|
|
|
14636
14670
|
return slug || "portal";
|
|
14637
14671
|
}
|
|
14638
14672
|
async function ensurePackageJson(dir, name) {
|
|
14639
|
-
const file =
|
|
14673
|
+
const file = path47.join(dir, "package.json");
|
|
14640
14674
|
if (existsSync5(file)) return false;
|
|
14641
14675
|
await writeFile13(
|
|
14642
14676
|
file,
|
|
@@ -14655,11 +14689,11 @@ async function ensurePackageJson(dir, name) {
|
|
|
14655
14689
|
return true;
|
|
14656
14690
|
}
|
|
14657
14691
|
function isPackageInstalled(startDir, name) {
|
|
14658
|
-
let dir =
|
|
14692
|
+
let dir = path47.resolve(startDir);
|
|
14659
14693
|
for (; ; ) {
|
|
14660
|
-
if (existsSync5(
|
|
14694
|
+
if (existsSync5(path47.join(dir, "node_modules", name, "package.json")))
|
|
14661
14695
|
return true;
|
|
14662
|
-
const parent =
|
|
14696
|
+
const parent = path47.dirname(dir);
|
|
14663
14697
|
if (parent === dir) return false;
|
|
14664
14698
|
dir = parent;
|
|
14665
14699
|
}
|
|
@@ -14668,7 +14702,7 @@ var missingCorePackages = (dir) => CORE_PACKAGES.filter((name) => !isPackageInst
|
|
|
14668
14702
|
|
|
14669
14703
|
// src/cli/portal/v2.ts
|
|
14670
14704
|
function assertPackagesInstalled(resolved, prepared) {
|
|
14671
|
-
const require2 = createRequire2(
|
|
14705
|
+
const require2 = createRequire2(path48.join(resolved.configDir, "package.json"));
|
|
14672
14706
|
const missing = requiredPackages(prepared.plan).filter((name) => {
|
|
14673
14707
|
try {
|
|
14674
14708
|
require2.resolve(name);
|
|
@@ -14721,7 +14755,7 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
|
|
|
14721
14755
|
return {
|
|
14722
14756
|
name: "build",
|
|
14723
14757
|
hash: () => hash2,
|
|
14724
|
-
stillValid: () => access4(
|
|
14758
|
+
stillValid: () => access4(path48.join(buildDir, "index.html")).then(
|
|
14725
14759
|
() => true,
|
|
14726
14760
|
() => false
|
|
14727
14761
|
),
|
|
@@ -14734,11 +14768,11 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
|
|
|
14734
14768
|
process.chdir(originalCwd);
|
|
14735
14769
|
}
|
|
14736
14770
|
await rm8(buildDir, { recursive: true, force: true });
|
|
14737
|
-
await mkdir12(
|
|
14738
|
-
await rename6(
|
|
14771
|
+
await mkdir12(path48.dirname(buildDir), { recursive: true });
|
|
14772
|
+
await rename6(path48.join(root, "dist"), buildDir);
|
|
14739
14773
|
if (prepared.publishedManifest) {
|
|
14740
14774
|
await writeFile14(
|
|
14741
|
-
|
|
14775
|
+
path48.join(buildDir, MANIFEST_FILE),
|
|
14742
14776
|
`${JSON.stringify(prepared.publishedManifest, null, 2)}
|
|
14743
14777
|
`
|
|
14744
14778
|
);
|
|
@@ -14769,15 +14803,15 @@ async function buildV2(options) {
|
|
|
14769
14803
|
// src/cli/check/gateway-online.ts
|
|
14770
14804
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
14771
14805
|
var SPEC_SEND_LIMIT = 5 * 1024 * 1024 + 64 * 1024;
|
|
14772
|
-
var issue2 = (code,
|
|
14806
|
+
var issue2 = (code, path103, message, hint) => ({ code, path: path103, message, hint });
|
|
14773
14807
|
function capabilityIssues(gateway, answer) {
|
|
14774
14808
|
const can = answer.capabilities;
|
|
14775
14809
|
const plan2 = `your ${answer.tier} plan`;
|
|
14776
14810
|
const found = [];
|
|
14777
|
-
const unsupported = (
|
|
14811
|
+
const unsupported = (path103, what, hint) => found.push(
|
|
14778
14812
|
issue2(
|
|
14779
14813
|
"GATEWAY_CAPABILITY_UNSUPPORTED",
|
|
14780
|
-
|
|
14814
|
+
path103,
|
|
14781
14815
|
`${what} is not available on ${plan2}.`,
|
|
14782
14816
|
hint
|
|
14783
14817
|
)
|
|
@@ -14853,7 +14887,7 @@ async function onlineGatewayRules(gateway, projectId, api, derivedCors = []) {
|
|
|
14853
14887
|
async function isConfigV2(dir) {
|
|
14854
14888
|
try {
|
|
14855
14889
|
return /"version"\s*:\s*2\b/.test(
|
|
14856
|
-
await readFile14(
|
|
14890
|
+
await readFile14(path49.join(dir, APITOGO_CONFIG_FILENAME), "utf8")
|
|
14857
14891
|
);
|
|
14858
14892
|
} catch {
|
|
14859
14893
|
return false;
|
|
@@ -14947,7 +14981,7 @@ async function validatePortalBuild(dir) {
|
|
|
14947
14981
|
}
|
|
14948
14982
|
}
|
|
14949
14983
|
async function runCheckV2(dir, args = {}, deps = {}) {
|
|
14950
|
-
const configPath =
|
|
14984
|
+
const configPath = path49.join(dir, APITOGO_CONFIG_FILENAME);
|
|
14951
14985
|
let report;
|
|
14952
14986
|
let layout;
|
|
14953
14987
|
try {
|
|
@@ -15036,14 +15070,14 @@ async function checkV2(dir, args, deps = platformDependencies(args)) {
|
|
|
15036
15070
|
init_package_json();
|
|
15037
15071
|
|
|
15038
15072
|
// src/cli/init/v2-handler.ts
|
|
15039
|
-
import
|
|
15073
|
+
import path51 from "node:path";
|
|
15040
15074
|
import { createInterface } from "node:readline/promises";
|
|
15041
15075
|
init_package_json();
|
|
15042
15076
|
|
|
15043
15077
|
// src/cli/platform/helpers/npm-build.ts
|
|
15044
15078
|
import { spawn } from "node:child_process";
|
|
15045
15079
|
import { access as access5, readFile as readFile15 } from "node:fs/promises";
|
|
15046
|
-
import
|
|
15080
|
+
import path50 from "node:path";
|
|
15047
15081
|
var BUILD_LOG_TAIL_BYTES = 8192;
|
|
15048
15082
|
var MIN_NODE_MAJOR = 20;
|
|
15049
15083
|
var NpmBuildError = class extends Error {
|
|
@@ -15111,7 +15145,7 @@ function runCommand(command2, args, cwd, env) {
|
|
|
15111
15145
|
async function runNpmCommand(args, cwd) {
|
|
15112
15146
|
assertNodeVersion();
|
|
15113
15147
|
const startedAt = Date.now();
|
|
15114
|
-
const result = await runCommand("npm", args,
|
|
15148
|
+
const result = await runCommand("npm", args, path50.resolve(cwd));
|
|
15115
15149
|
if (result.exitCode !== 0) {
|
|
15116
15150
|
throw new NpmBuildError(
|
|
15117
15151
|
`npm ${args.join(" ")} exited ${result.exitCode ?? "unknown"}`,
|
|
@@ -15126,13 +15160,13 @@ async function runNpmCommand(args, cwd) {
|
|
|
15126
15160
|
}
|
|
15127
15161
|
async function runNpmInstall(sourceDirectory, options) {
|
|
15128
15162
|
assertNodeVersion(options?.nodeVersion);
|
|
15129
|
-
const cwd =
|
|
15130
|
-
const packageJsonPath =
|
|
15163
|
+
const cwd = path50.resolve(sourceDirectory);
|
|
15164
|
+
const packageJsonPath = path50.join(cwd, "package.json");
|
|
15131
15165
|
if (!await pathExists(packageJsonPath)) {
|
|
15132
15166
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
15133
15167
|
}
|
|
15134
15168
|
const startedAt = Date.now();
|
|
15135
|
-
const lockPath =
|
|
15169
|
+
const lockPath = path50.join(cwd, "package-lock.json");
|
|
15136
15170
|
const installArgs = await pathExists(lockPath) ? ["ci"] : ["install"];
|
|
15137
15171
|
const install = await runCommand("npm", installArgs, cwd);
|
|
15138
15172
|
const installLog = install.output;
|
|
@@ -15150,8 +15184,8 @@ async function runNpmInstall(sourceDirectory, options) {
|
|
|
15150
15184
|
}
|
|
15151
15185
|
async function runNpmBuild(sourceDirectory, options) {
|
|
15152
15186
|
assertNodeVersion(options?.nodeVersion);
|
|
15153
|
-
const cwd =
|
|
15154
|
-
const packageJsonPath =
|
|
15187
|
+
const cwd = path50.resolve(sourceDirectory);
|
|
15188
|
+
const packageJsonPath = path50.join(cwd, "package.json");
|
|
15155
15189
|
if (!await pathExists(packageJsonPath)) {
|
|
15156
15190
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
15157
15191
|
}
|
|
@@ -15168,8 +15202,8 @@ async function runNpmBuild(sourceDirectory, options) {
|
|
|
15168
15202
|
build2.exitCode
|
|
15169
15203
|
);
|
|
15170
15204
|
}
|
|
15171
|
-
const distPath =
|
|
15172
|
-
const indexPath =
|
|
15205
|
+
const distPath = path50.join(cwd, "dist");
|
|
15206
|
+
const indexPath = path50.join(distPath, "index.html");
|
|
15173
15207
|
if (!await pathExists(indexPath)) {
|
|
15174
15208
|
throw new NpmBuildError(
|
|
15175
15209
|
`Build completed but dist/index.html was not found at ${indexPath}`,
|
|
@@ -15236,9 +15270,9 @@ function describePlan(plan2) {
|
|
|
15236
15270
|
layoutReason: plan2.layoutReason,
|
|
15237
15271
|
docsIncluded: plan2.docsIncluded,
|
|
15238
15272
|
willCreate: plan2.entries.map(
|
|
15239
|
-
(entry) =>
|
|
15273
|
+
(entry) => path51.relative(plan2.dir, entry.path)
|
|
15240
15274
|
),
|
|
15241
|
-
willKeep: plan2.keep.map((target) =>
|
|
15275
|
+
willKeep: plan2.keep.map((target) => path51.relative(plan2.dir, target)),
|
|
15242
15276
|
replacesConfig: plan2.replacesConfig
|
|
15243
15277
|
};
|
|
15244
15278
|
}
|
|
@@ -15263,7 +15297,7 @@ async function initV2(argv) {
|
|
|
15263
15297
|
const json = argv.json === true;
|
|
15264
15298
|
try {
|
|
15265
15299
|
parseOnlyFlag(argv.only);
|
|
15266
|
-
const dir =
|
|
15300
|
+
const dir = path51.resolve(process.cwd(), argv.dir ?? ".");
|
|
15267
15301
|
const options = {
|
|
15268
15302
|
dir,
|
|
15269
15303
|
layout: argv.layout,
|
|
@@ -15316,7 +15350,7 @@ async function initV2(argv) {
|
|
|
15316
15350
|
const packages = await setUpPackages({
|
|
15317
15351
|
dir,
|
|
15318
15352
|
layout: plan2.layout,
|
|
15319
|
-
name: argv.name ??
|
|
15353
|
+
name: argv.name ?? path51.basename(dir),
|
|
15320
15354
|
install: argv.install === true,
|
|
15321
15355
|
quiet: json
|
|
15322
15356
|
});
|
|
@@ -15327,8 +15361,8 @@ async function initV2(argv) {
|
|
|
15327
15361
|
status: "created",
|
|
15328
15362
|
dir,
|
|
15329
15363
|
...describePlan(plan2),
|
|
15330
|
-
created: result.created.map((p) =>
|
|
15331
|
-
kept: result.kept.map((p) =>
|
|
15364
|
+
created: result.created.map((p) => path51.relative(dir, p)),
|
|
15365
|
+
kept: result.kept.map((p) => path51.relative(dir, p)),
|
|
15332
15366
|
packages
|
|
15333
15367
|
},
|
|
15334
15368
|
null,
|
|
@@ -15338,7 +15372,7 @@ async function initV2(argv) {
|
|
|
15338
15372
|
return;
|
|
15339
15373
|
}
|
|
15340
15374
|
printResultToConsole(
|
|
15341
|
-
`Created ${
|
|
15375
|
+
`Created ${path51.basename(plan2.configPath)} (config version 2, ${plan2.layout} layout) in ${dir}.`
|
|
15342
15376
|
);
|
|
15343
15377
|
if (packages.installed)
|
|
15344
15378
|
printResultToConsole(
|
|
@@ -15374,7 +15408,7 @@ async function initV2(argv) {
|
|
|
15374
15408
|
// src/cli/services/packages.ts
|
|
15375
15409
|
import { spawn as spawn2 } from "node:child_process";
|
|
15376
15410
|
import { existsSync as existsSync6 } from "node:fs";
|
|
15377
|
-
import
|
|
15411
|
+
import path52 from "node:path";
|
|
15378
15412
|
var USER_PANEL_PACKAGE = "@lukoweb/apitogo-module-user-panel";
|
|
15379
15413
|
var BILLING_PLUGIN_PACKAGE = "@lukoweb/apitogo-plugin-dev-portal-billing";
|
|
15380
15414
|
function packagesForConfig(config2) {
|
|
@@ -15389,18 +15423,18 @@ function packagesForConfig(config2) {
|
|
|
15389
15423
|
];
|
|
15390
15424
|
}
|
|
15391
15425
|
function isInstalled(dir, name) {
|
|
15392
|
-
for (let current =
|
|
15393
|
-
if (existsSync6(
|
|
15426
|
+
for (let current = path52.resolve(dir); ; current = path52.dirname(current)) {
|
|
15427
|
+
if (existsSync6(path52.join(current, "node_modules", name, "package.json")))
|
|
15394
15428
|
return true;
|
|
15395
|
-
if (
|
|
15429
|
+
if (path52.dirname(current) === current) return false;
|
|
15396
15430
|
}
|
|
15397
15431
|
}
|
|
15398
15432
|
function missingPackages(dir, names) {
|
|
15399
15433
|
return names.filter((name) => !isInstalled(dir, name));
|
|
15400
15434
|
}
|
|
15401
15435
|
function detectPackageManager(dir) {
|
|
15402
|
-
if (existsSync6(
|
|
15403
|
-
if (existsSync6(
|
|
15436
|
+
if (existsSync6(path52.join(dir, "pnpm-lock.yaml"))) return "pnpm";
|
|
15437
|
+
if (existsSync6(path52.join(dir, "yarn.lock"))) return "yarn";
|
|
15404
15438
|
return "npm";
|
|
15405
15439
|
}
|
|
15406
15440
|
function installCommand2(manager, names, version) {
|
|
@@ -15435,7 +15469,7 @@ async function installMissingPackages(dir, config2, version, options) {
|
|
|
15435
15469
|
reason: "--no-install was given",
|
|
15436
15470
|
command: shown
|
|
15437
15471
|
};
|
|
15438
|
-
if (!existsSync6(
|
|
15472
|
+
if (!existsSync6(path52.join(dir, "package.json")))
|
|
15439
15473
|
return {
|
|
15440
15474
|
status: "skipped",
|
|
15441
15475
|
packages: missing,
|
|
@@ -15454,7 +15488,7 @@ var list = (value) => {
|
|
|
15454
15488
|
return items.length > 0 ? items : void 0;
|
|
15455
15489
|
};
|
|
15456
15490
|
function addOptionsFromArguments(service, argv) {
|
|
15457
|
-
const dir =
|
|
15491
|
+
const dir = path53.resolve(process.cwd(), argv.dir ?? ".");
|
|
15458
15492
|
const issuers = list(argv.issuer);
|
|
15459
15493
|
return {
|
|
15460
15494
|
dir,
|
|
@@ -15513,8 +15547,8 @@ function describe(edit, dir) {
|
|
|
15513
15547
|
return {
|
|
15514
15548
|
service: edit.service,
|
|
15515
15549
|
action: edit.action,
|
|
15516
|
-
willCreate: edit.files.map((file) =>
|
|
15517
|
-
keep: edit.keep.map((file) =>
|
|
15550
|
+
willCreate: edit.files.map((file) => path53.relative(dir, file.path)),
|
|
15551
|
+
keep: edit.keep.map((file) => path53.relative(dir, file)),
|
|
15518
15552
|
notes: edit.notes
|
|
15519
15553
|
};
|
|
15520
15554
|
}
|
|
@@ -15527,11 +15561,11 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15527
15561
|
`Choose one of ${SERVICES.join(", ")}.`
|
|
15528
15562
|
);
|
|
15529
15563
|
}
|
|
15530
|
-
const dir =
|
|
15564
|
+
const dir = path53.resolve(process.cwd(), argv.dir ?? ".");
|
|
15531
15565
|
if (!await isConfigV2(dir)) {
|
|
15532
15566
|
throw new ServiceEditError(
|
|
15533
15567
|
`${action} works with a config version 2 project, and there is none in ${dir}.`,
|
|
15534
|
-
"Create one with `apitogo init
|
|
15568
|
+
"Create one with `apitogo init`."
|
|
15535
15569
|
);
|
|
15536
15570
|
}
|
|
15537
15571
|
const edit = await plan2(argv.service);
|
|
@@ -15574,7 +15608,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15574
15608
|
{
|
|
15575
15609
|
status: action === "add" ? "added" : "removed",
|
|
15576
15610
|
...describe(edit, dir),
|
|
15577
|
-
created: created.map((file) =>
|
|
15611
|
+
created: created.map((file) => path53.relative(dir, file)),
|
|
15578
15612
|
...install ? { packages: install } : {}
|
|
15579
15613
|
},
|
|
15580
15614
|
null,
|
|
@@ -15584,7 +15618,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15584
15618
|
return;
|
|
15585
15619
|
}
|
|
15586
15620
|
printResultToConsole(
|
|
15587
|
-
`${action === "add" ? "Added" : "Removed"} ${edit.service} in ${
|
|
15621
|
+
`${action === "add" ? "Added" : "Removed"} ${edit.service} in ${path53.basename(edit.configPath)}.`
|
|
15588
15622
|
);
|
|
15589
15623
|
} catch (error) {
|
|
15590
15624
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -15642,7 +15676,7 @@ var removeService = (argv) => run(
|
|
|
15642
15676
|
"remove",
|
|
15643
15677
|
argv,
|
|
15644
15678
|
(service) => planRemoveService(service, {
|
|
15645
|
-
dir:
|
|
15679
|
+
dir: path53.resolve(process.cwd(), argv.dir ?? ".")
|
|
15646
15680
|
})
|
|
15647
15681
|
);
|
|
15648
15682
|
|
|
@@ -15790,16 +15824,16 @@ var add_default = {
|
|
|
15790
15824
|
};
|
|
15791
15825
|
|
|
15792
15826
|
// src/cli/build/handler.ts
|
|
15793
|
-
import
|
|
15827
|
+
import path55 from "node:path";
|
|
15794
15828
|
init_logger();
|
|
15795
15829
|
init_package_json();
|
|
15796
15830
|
|
|
15797
15831
|
// src/cli/preview/handler.ts
|
|
15798
|
-
import
|
|
15832
|
+
import path54 from "node:path";
|
|
15799
15833
|
import { preview as vitePreview } from "vite";
|
|
15800
15834
|
var DEFAULT_PREVIEW_PORT = 4e3;
|
|
15801
15835
|
async function preview(argv) {
|
|
15802
|
-
const dir =
|
|
15836
|
+
const dir = path54.resolve(process.cwd(), argv.dir);
|
|
15803
15837
|
const viteConfig = await getViteConfig(dir, {
|
|
15804
15838
|
command: "serve",
|
|
15805
15839
|
mode: "production",
|
|
@@ -15842,7 +15876,7 @@ async function build(argv) {
|
|
|
15842
15876
|
printDiagnosticsToConsole("");
|
|
15843
15877
|
printDiagnosticsToConsole("");
|
|
15844
15878
|
}
|
|
15845
|
-
const dir =
|
|
15879
|
+
const dir = path55.resolve(process.cwd(), argv.dir);
|
|
15846
15880
|
try {
|
|
15847
15881
|
if (await isConfigV2(dir)) {
|
|
15848
15882
|
const result = await buildV2({ dir, jsonOnly });
|
|
@@ -15907,10 +15941,10 @@ var build_default = {
|
|
|
15907
15941
|
};
|
|
15908
15942
|
|
|
15909
15943
|
// src/cli/check/handler.ts
|
|
15910
|
-
import
|
|
15944
|
+
import path61 from "node:path";
|
|
15911
15945
|
|
|
15912
15946
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
15913
|
-
import
|
|
15947
|
+
import path60 from "node:path";
|
|
15914
15948
|
|
|
15915
15949
|
// src/cli/platform/helpers/dev-portal-backend.ts
|
|
15916
15950
|
function deriveProvisioningState(backend) {
|
|
@@ -15995,10 +16029,10 @@ function formatDevPortalBackendResponse(projectId, backend) {
|
|
|
15995
16029
|
init_gateway_limits();
|
|
15996
16030
|
import { existsSync as existsSync7 } from "node:fs";
|
|
15997
16031
|
import { access as access6, mkdir as mkdir13, readFile as readFile16, writeFile as writeFile15 } from "node:fs/promises";
|
|
15998
|
-
import
|
|
16032
|
+
import path57 from "node:path";
|
|
15999
16033
|
|
|
16000
16034
|
// src/cli/make-config/json-config.ts
|
|
16001
|
-
import
|
|
16035
|
+
import path56 from "node:path";
|
|
16002
16036
|
|
|
16003
16037
|
// src/cli/make-config/branding-assets.ts
|
|
16004
16038
|
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';
|
|
@@ -16468,9 +16502,9 @@ function openapiInputForConfig(specRelativePosix) {
|
|
|
16468
16502
|
return `./${specRelativePosix}`;
|
|
16469
16503
|
}
|
|
16470
16504
|
function toRelativeOpenApiInput(projectDir, inputPath) {
|
|
16471
|
-
const resolved =
|
|
16472
|
-
const relative =
|
|
16473
|
-
const posix = relative.split(
|
|
16505
|
+
const resolved = path56.isAbsolute(inputPath) ? inputPath : path56.resolve(projectDir, inputPath);
|
|
16506
|
+
const relative = path56.relative(projectDir, resolved);
|
|
16507
|
+
const posix = relative.split(path56.sep).join(path56.posix.sep);
|
|
16474
16508
|
if (!posix) {
|
|
16475
16509
|
throw new Error("OpenAPI path must point to a file.");
|
|
16476
16510
|
}
|
|
@@ -16750,7 +16784,7 @@ function isPlanFree(plan2) {
|
|
|
16750
16784
|
return (plan2.priceAmount ?? 0) <= 0;
|
|
16751
16785
|
}
|
|
16752
16786
|
function manifestFilePath(siteDirectory) {
|
|
16753
|
-
return
|
|
16787
|
+
return path57.join(path57.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
|
|
16754
16788
|
}
|
|
16755
16789
|
var STORED_MANIFEST_KEYS = [
|
|
16756
16790
|
"authentication",
|
|
@@ -17223,23 +17257,23 @@ function resolveBackendSourceDirectory(siteDirectory, sourceDirectory) {
|
|
|
17223
17257
|
if (!trimmed) {
|
|
17224
17258
|
return void 0;
|
|
17225
17259
|
}
|
|
17226
|
-
return
|
|
17260
|
+
return path57.resolve(siteDirectory, trimmed);
|
|
17227
17261
|
}
|
|
17228
17262
|
function resolveBackendOpenApiPath(openApiPath, options) {
|
|
17229
17263
|
const trimmed = openApiPath?.trim();
|
|
17230
17264
|
if (!trimmed) {
|
|
17231
17265
|
return void 0;
|
|
17232
17266
|
}
|
|
17233
|
-
if (
|
|
17267
|
+
if (path57.isAbsolute(trimmed)) {
|
|
17234
17268
|
return trimmed;
|
|
17235
17269
|
}
|
|
17236
|
-
const siteResolved =
|
|
17270
|
+
const siteResolved = path57.resolve(options.siteDirectory, trimmed);
|
|
17237
17271
|
if (existsSync7(siteResolved)) {
|
|
17238
17272
|
return siteResolved;
|
|
17239
17273
|
}
|
|
17240
17274
|
const backendDir = options.backendSourceDirectory?.trim();
|
|
17241
17275
|
if (backendDir) {
|
|
17242
|
-
const backendResolved =
|
|
17276
|
+
const backendResolved = path57.resolve(backendDir, trimmed);
|
|
17243
17277
|
if (existsSync7(backendResolved)) {
|
|
17244
17278
|
return backendResolved;
|
|
17245
17279
|
}
|
|
@@ -17247,15 +17281,15 @@ function resolveBackendOpenApiPath(openApiPath, options) {
|
|
|
17247
17281
|
return siteResolved;
|
|
17248
17282
|
}
|
|
17249
17283
|
function toSiteRelativeOpenApiInput(siteDirectory, openApiAbsolutePath) {
|
|
17250
|
-
const relative =
|
|
17251
|
-
|
|
17252
|
-
|
|
17284
|
+
const relative = path57.relative(
|
|
17285
|
+
path57.resolve(siteDirectory),
|
|
17286
|
+
path57.resolve(openApiAbsolutePath)
|
|
17253
17287
|
);
|
|
17254
|
-
const posix = relative.split(
|
|
17288
|
+
const posix = relative.split(path57.sep).join("/");
|
|
17255
17289
|
if (!posix || posix === ".") {
|
|
17256
17290
|
return "./";
|
|
17257
17291
|
}
|
|
17258
|
-
if (
|
|
17292
|
+
if (path57.isAbsolute(posix) || posix.startsWith("..")) {
|
|
17259
17293
|
return posix;
|
|
17260
17294
|
}
|
|
17261
17295
|
return posix.startsWith("./") ? posix : `./${posix}`;
|
|
@@ -17302,7 +17336,7 @@ async function readManifest2(siteDirectory) {
|
|
|
17302
17336
|
}
|
|
17303
17337
|
async function writeManifest2(siteDirectory, manifest) {
|
|
17304
17338
|
const filePath = manifestFilePath(siteDirectory);
|
|
17305
|
-
await mkdir13(
|
|
17339
|
+
await mkdir13(path57.dirname(filePath), { recursive: true });
|
|
17306
17340
|
let config2 = {};
|
|
17307
17341
|
if (await pathExists2(filePath)) {
|
|
17308
17342
|
const raw = await readFile16(filePath, "utf8");
|
|
@@ -17328,7 +17362,7 @@ import {
|
|
|
17328
17362
|
unlink,
|
|
17329
17363
|
writeFile as writeFile16
|
|
17330
17364
|
} from "node:fs/promises";
|
|
17331
|
-
import
|
|
17365
|
+
import path58 from "node:path";
|
|
17332
17366
|
var ENV_FILENAME = ".env";
|
|
17333
17367
|
var COLLAPSED_UPPERCASE_ALIASES2 = {
|
|
17334
17368
|
SECRETKEY: "secretKey",
|
|
@@ -17447,12 +17481,12 @@ async function readEnvFile(filePath) {
|
|
|
17447
17481
|
}
|
|
17448
17482
|
}
|
|
17449
17483
|
async function loadSiteEnv(siteDirectory) {
|
|
17450
|
-
const resolvedDirectory =
|
|
17484
|
+
const resolvedDirectory = path58.resolve(siteDirectory);
|
|
17451
17485
|
const merged = { ...process.env };
|
|
17452
17486
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
17453
17487
|
Object.assign(
|
|
17454
17488
|
merged,
|
|
17455
|
-
await readEnvFile(
|
|
17489
|
+
await readEnvFile(path58.join(resolvedDirectory, fileName))
|
|
17456
17490
|
);
|
|
17457
17491
|
}
|
|
17458
17492
|
return merged;
|
|
@@ -17489,7 +17523,7 @@ function buildAuthSecretsJson(secrets2, options) {
|
|
|
17489
17523
|
return payload;
|
|
17490
17524
|
}
|
|
17491
17525
|
function envFilePath(siteDirectory) {
|
|
17492
|
-
return
|
|
17526
|
+
return path58.join(path58.resolve(siteDirectory), ENV_FILENAME);
|
|
17493
17527
|
}
|
|
17494
17528
|
function createEnvContent() {
|
|
17495
17529
|
return [
|
|
@@ -17553,7 +17587,7 @@ function validateSecretsForPublish(manifest, secrets2, emailOptions) {
|
|
|
17553
17587
|
}
|
|
17554
17588
|
async function siteEnvFileHasEntries(siteDirectory) {
|
|
17555
17589
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
17556
|
-
const loaded = await readEnvFile(
|
|
17590
|
+
const loaded = await readEnvFile(path58.join(siteDirectory, fileName));
|
|
17557
17591
|
if (Object.keys(loaded).length > 0) {
|
|
17558
17592
|
return true;
|
|
17559
17593
|
}
|
|
@@ -17561,7 +17595,7 @@ async function siteEnvFileHasEntries(siteDirectory) {
|
|
|
17561
17595
|
return false;
|
|
17562
17596
|
}
|
|
17563
17597
|
async function resolvePublishConfig(siteDirectory, emailOptions) {
|
|
17564
|
-
const resolvedDirectory =
|
|
17598
|
+
const resolvedDirectory = path58.resolve(siteDirectory);
|
|
17565
17599
|
const manifestRaw = await readManifest2(resolvedDirectory);
|
|
17566
17600
|
if (!manifestRaw) {
|
|
17567
17601
|
throw new Error("apitogo.config.json not found in sourceDirectory.");
|
|
@@ -17594,7 +17628,7 @@ function envFileHasActiveAssignments(content) {
|
|
|
17594
17628
|
});
|
|
17595
17629
|
}
|
|
17596
17630
|
async function writeScaffoldEnv(siteDirectory) {
|
|
17597
|
-
const resolvedDirectory =
|
|
17631
|
+
const resolvedDirectory = path58.resolve(siteDirectory);
|
|
17598
17632
|
const filesWritten = [];
|
|
17599
17633
|
const envPath = envFilePath(resolvedDirectory);
|
|
17600
17634
|
try {
|
|
@@ -17605,7 +17639,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
17605
17639
|
filesWritten.push(ENV_FILENAME);
|
|
17606
17640
|
}
|
|
17607
17641
|
for (const legacyName of [".env.example"]) {
|
|
17608
|
-
const legacyPath =
|
|
17642
|
+
const legacyPath = path58.join(resolvedDirectory, legacyName);
|
|
17609
17643
|
try {
|
|
17610
17644
|
const legacy = await readFile17(legacyPath, "utf8");
|
|
17611
17645
|
if (!envFileHasActiveAssignments(legacy)) {
|
|
@@ -17615,7 +17649,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
17615
17649
|
} catch {
|
|
17616
17650
|
}
|
|
17617
17651
|
}
|
|
17618
|
-
const gitignorePath =
|
|
17652
|
+
const gitignorePath = path58.join(resolvedDirectory, ".gitignore");
|
|
17619
17653
|
let gitignore = "";
|
|
17620
17654
|
try {
|
|
17621
17655
|
gitignore = await readFile17(gitignorePath, "utf8");
|
|
@@ -17652,11 +17686,11 @@ var SECRETS_COLLECTION_INSTRUCTION = "For go-live, plans must already be in apit
|
|
|
17652
17686
|
init_gateway_limits();
|
|
17653
17687
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
17654
17688
|
import { createRequire as createRequire3 } from "node:module";
|
|
17655
|
-
import
|
|
17689
|
+
import path59 from "node:path";
|
|
17656
17690
|
var cachedFallbackTs;
|
|
17657
17691
|
async function loadTypeScriptForSite(sourceDirectory) {
|
|
17658
17692
|
const require2 = createRequire3(
|
|
17659
|
-
|
|
17693
|
+
path59.join(path59.resolve(sourceDirectory), "package.json")
|
|
17660
17694
|
);
|
|
17661
17695
|
try {
|
|
17662
17696
|
return require2("typescript");
|
|
@@ -17703,7 +17737,7 @@ async function referencedFileExists(sourceDirectory, reference) {
|
|
|
17703
17737
|
return true;
|
|
17704
17738
|
}
|
|
17705
17739
|
return pathExists2(
|
|
17706
|
-
|
|
17740
|
+
path59.resolve(sourceDirectory, reference.replace(/^\.\//, ""))
|
|
17707
17741
|
);
|
|
17708
17742
|
}
|
|
17709
17743
|
async function validateSiteConfigStructure(config2, sourceDirectory) {
|
|
@@ -17818,11 +17852,11 @@ var DEFAULT_TSX_CANDIDATES = [
|
|
|
17818
17852
|
"landing/LandingPage.tsx"
|
|
17819
17853
|
];
|
|
17820
17854
|
async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
17821
|
-
const resolvedDir =
|
|
17855
|
+
const resolvedDir = path59.resolve(sourceDirectory);
|
|
17822
17856
|
const issues = [];
|
|
17823
17857
|
const checkedFiles = [];
|
|
17824
17858
|
const skippedChecks = [];
|
|
17825
|
-
const jsonPath =
|
|
17859
|
+
const jsonPath = path59.join(resolvedDir, APITOGO_CONFIG_FILENAME2);
|
|
17826
17860
|
if (await pathExists2(jsonPath)) {
|
|
17827
17861
|
checkedFiles.push(APITOGO_CONFIG_FILENAME2);
|
|
17828
17862
|
let parsed;
|
|
@@ -17854,7 +17888,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
17854
17888
|
);
|
|
17855
17889
|
const existingTsxFiles = [];
|
|
17856
17890
|
for (const relativeFile of tsxFiles) {
|
|
17857
|
-
if (await pathExists2(
|
|
17891
|
+
if (await pathExists2(path59.join(resolvedDir, relativeFile))) {
|
|
17858
17892
|
existingTsxFiles.push(relativeFile);
|
|
17859
17893
|
}
|
|
17860
17894
|
}
|
|
@@ -17868,7 +17902,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
17868
17902
|
for (const relativeFile of existingTsxFiles) {
|
|
17869
17903
|
checkedFiles.push(relativeFile);
|
|
17870
17904
|
const content = await readFile18(
|
|
17871
|
-
|
|
17905
|
+
path59.join(resolvedDir, relativeFile),
|
|
17872
17906
|
"utf8"
|
|
17873
17907
|
);
|
|
17874
17908
|
issues.push(
|
|
@@ -18272,7 +18306,7 @@ function validateManifestForPlatformPublish(manifest) {
|
|
|
18272
18306
|
|
|
18273
18307
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
18274
18308
|
async function checkPublishReadiness(client, _config, args) {
|
|
18275
|
-
const sourceDirectory =
|
|
18309
|
+
const sourceDirectory = path60.resolve(args.sourceDirectory);
|
|
18276
18310
|
const manifest = await readManifest2(sourceDirectory) ?? createScaffoldManifest();
|
|
18277
18311
|
const emailOptions = await resolveEmailOptionsForPublish(
|
|
18278
18312
|
client,
|
|
@@ -18350,7 +18384,7 @@ async function checkPublishReadiness(client, _config, args) {
|
|
|
18350
18384
|
|
|
18351
18385
|
// src/cli/check/handler.ts
|
|
18352
18386
|
async function check(argv) {
|
|
18353
|
-
const sourceDirectory =
|
|
18387
|
+
const sourceDirectory = path61.resolve(process.cwd(), argv.dir);
|
|
18354
18388
|
if (await isConfigV2(sourceDirectory)) {
|
|
18355
18389
|
await checkV2(sourceDirectory, argv);
|
|
18356
18390
|
return;
|
|
@@ -18415,13 +18449,13 @@ var check_default = {
|
|
|
18415
18449
|
// src/cli/make-config/handler.ts
|
|
18416
18450
|
import { constants as constants2 } from "node:fs";
|
|
18417
18451
|
import { access as access12, mkdir as mkdir17, readFile as readFile23, writeFile as writeFile21 } from "node:fs/promises";
|
|
18418
|
-
import
|
|
18452
|
+
import path71 from "node:path";
|
|
18419
18453
|
import { stdin as input2 } from "node:process";
|
|
18420
18454
|
import { glob as glob8 } from "glob";
|
|
18421
18455
|
|
|
18422
18456
|
// src/cli/platform/helpers/openapi-action-keys.ts
|
|
18423
18457
|
import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
|
|
18424
|
-
import
|
|
18458
|
+
import path62 from "node:path";
|
|
18425
18459
|
import YAML from "yaml";
|
|
18426
18460
|
var HTTP_METHODS = [
|
|
18427
18461
|
"get",
|
|
@@ -18490,7 +18524,7 @@ function extractGatewayActionKeysFromOpenApiDocument(document) {
|
|
|
18490
18524
|
function extractGatewayActionKeysFromOpenApiFile(filePath) {
|
|
18491
18525
|
try {
|
|
18492
18526
|
const raw = readFileSync4(filePath, "utf8");
|
|
18493
|
-
const ext =
|
|
18527
|
+
const ext = path62.extname(filePath).toLowerCase();
|
|
18494
18528
|
const parsed = ext === ".json" ? JSON.parse(raw) : YAML.parse(raw);
|
|
18495
18529
|
return extractGatewayActionKeysFromOpenApiDocument(parsed);
|
|
18496
18530
|
} catch {
|
|
@@ -18511,7 +18545,7 @@ function resolveConfigOpenApiFilePath(siteDirectory, config2) {
|
|
|
18511
18545
|
}
|
|
18512
18546
|
}
|
|
18513
18547
|
for (const candidate of candidates) {
|
|
18514
|
-
const resolved =
|
|
18548
|
+
const resolved = path62.isAbsolute(candidate) ? candidate : path62.resolve(siteDirectory, candidate);
|
|
18515
18549
|
if (existsSync8(resolved)) {
|
|
18516
18550
|
return resolved;
|
|
18517
18551
|
}
|
|
@@ -18526,7 +18560,7 @@ function loadOpenApiActionKeysForSite(siteDirectory, config2) {
|
|
|
18526
18560
|
return extractGatewayActionKeysFromOpenApiFile(filePath);
|
|
18527
18561
|
}
|
|
18528
18562
|
function loadOpenApiActionKeysFromSiteDirectory(siteDirectory) {
|
|
18529
|
-
const configPath =
|
|
18563
|
+
const configPath = path62.join(siteDirectory, "apitogo.config.json");
|
|
18530
18564
|
if (!existsSync8(configPath)) {
|
|
18531
18565
|
return [];
|
|
18532
18566
|
}
|
|
@@ -18555,7 +18589,7 @@ function withDefaultIncludedActionKeys(plan2, actionKeys) {
|
|
|
18555
18589
|
|
|
18556
18590
|
// src/cli/scaffold/dev-portal-config-pages.ts
|
|
18557
18591
|
import { access as access8, readFile as readFile19, rename as rename7, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
|
|
18558
|
-
import
|
|
18592
|
+
import path63 from "node:path";
|
|
18559
18593
|
async function writeConfigAtomically(filePath, content) {
|
|
18560
18594
|
const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
18561
18595
|
try {
|
|
@@ -18568,7 +18602,7 @@ async function writeConfigAtomically(filePath, content) {
|
|
|
18568
18602
|
}
|
|
18569
18603
|
async function resolveApitogoConfigPath(sourceDirectory) {
|
|
18570
18604
|
for (const filename of ["apitogo.config.tsx", "apitogo.config.jsx"]) {
|
|
18571
|
-
const configPath =
|
|
18605
|
+
const configPath = path63.join(sourceDirectory, filename);
|
|
18572
18606
|
try {
|
|
18573
18607
|
await access8(configPath);
|
|
18574
18608
|
return configPath;
|
|
@@ -19332,17 +19366,17 @@ async function wireNewDevPortalPageInConfig(sourceDirectory, slug, label) {
|
|
|
19332
19366
|
|
|
19333
19367
|
// src/cli/scaffold/wire-openapi.ts
|
|
19334
19368
|
import { access as access10, readFile as readFile21, writeFile as writeFile19 } from "node:fs/promises";
|
|
19335
|
-
import
|
|
19369
|
+
import path68 from "node:path";
|
|
19336
19370
|
|
|
19337
19371
|
// src/cli/platform/helpers/openapi.ts
|
|
19338
19372
|
import { promises as fs6 } from "node:fs";
|
|
19339
|
-
import
|
|
19373
|
+
import path65 from "node:path";
|
|
19340
19374
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
19341
19375
|
import YAML2 from "yaml";
|
|
19342
19376
|
|
|
19343
19377
|
// src/cli/scaffold/discover-openapi-files.ts
|
|
19344
19378
|
import { promises as fs5 } from "node:fs";
|
|
19345
|
-
import
|
|
19379
|
+
import path64 from "node:path";
|
|
19346
19380
|
var OPENAPI_BASENAMES = [
|
|
19347
19381
|
"openapi.yaml",
|
|
19348
19382
|
"openapi.yml",
|
|
@@ -19364,13 +19398,13 @@ var SKIP_OPENAPI_SEARCH_DIRS = /* @__PURE__ */ new Set([
|
|
|
19364
19398
|
".apitogo"
|
|
19365
19399
|
]);
|
|
19366
19400
|
async function collectFromDir(dir, searchedDirectories, candidates) {
|
|
19367
|
-
const resolved =
|
|
19401
|
+
const resolved = path64.resolve(dir);
|
|
19368
19402
|
if (searchedDirectories.includes(resolved)) {
|
|
19369
19403
|
return;
|
|
19370
19404
|
}
|
|
19371
19405
|
searchedDirectories.push(resolved);
|
|
19372
19406
|
for (const name of OPENAPI_BASENAMES) {
|
|
19373
|
-
const candidate =
|
|
19407
|
+
const candidate = path64.join(resolved, name);
|
|
19374
19408
|
try {
|
|
19375
19409
|
await fs5.access(candidate);
|
|
19376
19410
|
candidates.push(candidate);
|
|
@@ -19385,8 +19419,8 @@ async function collectSiteOpenApiFiles(siteDirectory) {
|
|
|
19385
19419
|
return { candidates: [...new Set(candidates)], searchedDirectories };
|
|
19386
19420
|
}
|
|
19387
19421
|
async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
19388
|
-
const site =
|
|
19389
|
-
const parent =
|
|
19422
|
+
const site = path64.resolve(siteDirectory);
|
|
19423
|
+
const parent = path64.dirname(site);
|
|
19390
19424
|
const searchedDirectories = [];
|
|
19391
19425
|
const candidates = [];
|
|
19392
19426
|
if (parent && parent !== site) {
|
|
@@ -19397,8 +19431,8 @@ async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
|
19397
19431
|
if (!entry.isDirectory() || SKIP_OPENAPI_SEARCH_DIRS.has(entry.name)) {
|
|
19398
19432
|
continue;
|
|
19399
19433
|
}
|
|
19400
|
-
const sibling =
|
|
19401
|
-
if (
|
|
19434
|
+
const sibling = path64.join(parent, entry.name);
|
|
19435
|
+
if (path64.resolve(sibling) === site) {
|
|
19402
19436
|
continue;
|
|
19403
19437
|
}
|
|
19404
19438
|
await collectFromDir(sibling, searchedDirectories, candidates);
|
|
@@ -19426,7 +19460,7 @@ function parseOpenApiObject(doc) {
|
|
|
19426
19460
|
};
|
|
19427
19461
|
}
|
|
19428
19462
|
function liteParseOpenApi(content, filePath) {
|
|
19429
|
-
const ext =
|
|
19463
|
+
const ext = path64.extname(filePath).toLowerCase();
|
|
19430
19464
|
if (ext === ".json") {
|
|
19431
19465
|
try {
|
|
19432
19466
|
const parsed = JSON.parse(content);
|
|
@@ -19491,9 +19525,9 @@ async function discoverNearbyOpenApi(siteDirectory) {
|
|
|
19491
19525
|
};
|
|
19492
19526
|
}
|
|
19493
19527
|
async function validateOpenApiFile(filePath) {
|
|
19494
|
-
const resolved =
|
|
19528
|
+
const resolved = path65.resolve(filePath);
|
|
19495
19529
|
const content = await fs6.readFile(resolved, "utf8");
|
|
19496
|
-
const ext =
|
|
19530
|
+
const ext = path65.extname(resolved).toLowerCase();
|
|
19497
19531
|
let parsed;
|
|
19498
19532
|
try {
|
|
19499
19533
|
parsed = ext === ".json" ? JSON.parse(content) : YAML2.parse(content);
|
|
@@ -19536,7 +19570,7 @@ async function validateOpenApiFile(filePath) {
|
|
|
19536
19570
|
|
|
19537
19571
|
// src/cli/scaffold/scaffold-dev-portal-site.ts
|
|
19538
19572
|
import { mkdir as mkdir15, readFile as readFile20, writeFile as writeFile18 } from "node:fs/promises";
|
|
19539
|
-
import
|
|
19573
|
+
import path67 from "node:path";
|
|
19540
19574
|
|
|
19541
19575
|
// src/cli/scaffold/apitogo-npm-packages.ts
|
|
19542
19576
|
var DEFAULT_CREATE_APITOGO_PACKAGE2 = "@lukoweb/create-apitogo@latest";
|
|
@@ -19624,7 +19658,7 @@ var DOC_TOOL_LOCAL_PACKAGE_PATHS = {
|
|
|
19624
19658
|
// src/cli/scaffold/create-apitogo-cli.ts
|
|
19625
19659
|
import { spawn as spawn3 } from "node:child_process";
|
|
19626
19660
|
import { access as access9, rm as rm10 } from "node:fs/promises";
|
|
19627
|
-
import
|
|
19661
|
+
import path66 from "node:path";
|
|
19628
19662
|
var SKIP_NEARBY_DISCOVERY_ENV = "APITOGO_SKIP_NEARBY_DISCOVERY";
|
|
19629
19663
|
var CreateApitogoCliError = class extends Error {
|
|
19630
19664
|
exitCode;
|
|
@@ -19641,9 +19675,9 @@ function resolveDocToolPath(explicit) {
|
|
|
19641
19675
|
return value || void 0;
|
|
19642
19676
|
}
|
|
19643
19677
|
function splitOutputDirectory(outputDirectory) {
|
|
19644
|
-
const resolvedOutputDirectory =
|
|
19645
|
-
const projectName =
|
|
19646
|
-
const parentDirectory =
|
|
19678
|
+
const resolvedOutputDirectory = path66.resolve(outputDirectory);
|
|
19679
|
+
const projectName = path66.basename(resolvedOutputDirectory);
|
|
19680
|
+
const parentDirectory = path66.dirname(resolvedOutputDirectory);
|
|
19647
19681
|
if (!projectName || projectName === "." || projectName === "..") {
|
|
19648
19682
|
throw new Error(
|
|
19649
19683
|
"outputDirectory must be a named folder (e.g. ./dev-portal-site), not the current directory."
|
|
@@ -19669,7 +19703,7 @@ async function directoryHasEntries(dir) {
|
|
|
19669
19703
|
}
|
|
19670
19704
|
}
|
|
19671
19705
|
function resolveLocalCreateApitogoEntry(docToolPath) {
|
|
19672
|
-
return
|
|
19706
|
+
return path66.resolve(docToolPath, "packages/create-zudoku/dist/index.js");
|
|
19673
19707
|
}
|
|
19674
19708
|
async function resolveCreateApitogoInvocation(options) {
|
|
19675
19709
|
const docToolPath = resolveDocToolPath(options.docToolPath);
|
|
@@ -19751,7 +19785,7 @@ async function runCreateApitogoDevPortal(options) {
|
|
|
19751
19785
|
result.exitCode
|
|
19752
19786
|
);
|
|
19753
19787
|
}
|
|
19754
|
-
if (!await pathExists3(
|
|
19788
|
+
if (!await pathExists3(path66.join(resolvedOutputDirectory, "package.json"))) {
|
|
19755
19789
|
throw new CreateApitogoCliError(
|
|
19756
19790
|
`create-apitogo completed but package.json was not found at ${resolvedOutputDirectory}`,
|
|
19757
19791
|
result.output,
|
|
@@ -19810,7 +19844,7 @@ function ensureRequiredApitogoModules(pkg, options) {
|
|
|
19810
19844
|
]
|
|
19811
19845
|
]) {
|
|
19812
19846
|
if (options.docToolPath) {
|
|
19813
|
-
deps[moduleName] = `file:${
|
|
19847
|
+
deps[moduleName] = `file:${path67.join(options.docToolPath, localPath)}`;
|
|
19814
19848
|
continue;
|
|
19815
19849
|
}
|
|
19816
19850
|
deps[moduleName] = `npm:${moduleName}@${moduleAliasVersion}`;
|
|
@@ -19841,7 +19875,7 @@ function rewritePackageJson(raw, options) {
|
|
|
19841
19875
|
DOC_TOOL_LOCAL_PACKAGE_PATHS
|
|
19842
19876
|
)) {
|
|
19843
19877
|
if (dep in deps) {
|
|
19844
|
-
deps[dep] = `file:${
|
|
19878
|
+
deps[dep] = `file:${path67.join(options.docToolPath, relativePath)}`;
|
|
19845
19879
|
linkedWorkspacePackage = true;
|
|
19846
19880
|
}
|
|
19847
19881
|
}
|
|
@@ -19941,23 +19975,23 @@ function patchDashboardPageConfig(content) {
|
|
|
19941
19975
|
);
|
|
19942
19976
|
}
|
|
19943
19977
|
async function ensureAccountPlansPage(outputDirectory) {
|
|
19944
|
-
const pagePath =
|
|
19978
|
+
const pagePath = path67.join(outputDirectory, ACCOUNT_PLANS_PAGE_PATH);
|
|
19945
19979
|
try {
|
|
19946
19980
|
await readFile20(pagePath, "utf8");
|
|
19947
19981
|
return void 0;
|
|
19948
19982
|
} catch {
|
|
19949
|
-
await mkdir15(
|
|
19983
|
+
await mkdir15(path67.dirname(pagePath), { recursive: true });
|
|
19950
19984
|
await writeFile18(pagePath, ACCOUNT_PLANS_PAGE);
|
|
19951
19985
|
return ACCOUNT_PLANS_PAGE_PATH;
|
|
19952
19986
|
}
|
|
19953
19987
|
}
|
|
19954
19988
|
async function ensureDashboardPage(outputDirectory) {
|
|
19955
|
-
const pagePath =
|
|
19989
|
+
const pagePath = path67.join(outputDirectory, DASHBOARD_PAGE_PATH);
|
|
19956
19990
|
try {
|
|
19957
19991
|
await readFile20(pagePath, "utf8");
|
|
19958
19992
|
return void 0;
|
|
19959
19993
|
} catch {
|
|
19960
|
-
await mkdir15(
|
|
19994
|
+
await mkdir15(path67.dirname(pagePath), { recursive: true });
|
|
19961
19995
|
await writeFile18(pagePath, DASHBOARD_PAGE);
|
|
19962
19996
|
return DASHBOARD_PAGE_PATH;
|
|
19963
19997
|
}
|
|
@@ -20014,7 +20048,7 @@ function patchApitogoConfig(content, options) {
|
|
|
20014
20048
|
async function patchScaffoldedSite(outputDirectory, options) {
|
|
20015
20049
|
const title = options.branding?.title ?? options.siteName;
|
|
20016
20050
|
const filesWritten = [];
|
|
20017
|
-
const packageJsonPath =
|
|
20051
|
+
const packageJsonPath = path67.join(outputDirectory, "package.json");
|
|
20018
20052
|
if (options.patchPackageJson !== false) {
|
|
20019
20053
|
const packageJson3 = await readFile20(packageJsonPath, "utf8");
|
|
20020
20054
|
await writeFile18(
|
|
@@ -20027,7 +20061,7 @@ async function patchScaffoldedSite(outputDirectory, options) {
|
|
|
20027
20061
|
);
|
|
20028
20062
|
filesWritten.push("package.json");
|
|
20029
20063
|
}
|
|
20030
|
-
const configPath =
|
|
20064
|
+
const configPath = path67.join(outputDirectory, "apitogo.config.tsx");
|
|
20031
20065
|
const configContent = await readFile20(configPath, "utf8");
|
|
20032
20066
|
await writeFile18(
|
|
20033
20067
|
configPath,
|
|
@@ -20122,8 +20156,8 @@ async function discoverOpenApiByMode(siteDirectory, mode) {
|
|
|
20122
20156
|
return discoverNearbyOpenApi(siteDirectory);
|
|
20123
20157
|
}
|
|
20124
20158
|
async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
20125
|
-
const resolvedSource =
|
|
20126
|
-
const resolvedOpenApi =
|
|
20159
|
+
const resolvedSource = path68.resolve(sourceDirectory);
|
|
20160
|
+
const resolvedOpenApi = path68.resolve(openApiPath);
|
|
20127
20161
|
const input5 = toSiteRelativeOpenApiInput(resolvedSource, resolvedOpenApi);
|
|
20128
20162
|
const validation = await validateOpenApiFile(resolvedOpenApi);
|
|
20129
20163
|
if (!validation.valid) {
|
|
@@ -20148,7 +20182,7 @@ async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
|
20148
20182
|
"utf8"
|
|
20149
20183
|
);
|
|
20150
20184
|
} else {
|
|
20151
|
-
const tsxConfigPath =
|
|
20185
|
+
const tsxConfigPath = path68.join(resolvedSource, "apitogo.config.tsx");
|
|
20152
20186
|
const configContent = await readFile21(tsxConfigPath, "utf8");
|
|
20153
20187
|
try {
|
|
20154
20188
|
const patched = patchApitogoConfigOpenApiToFile(configContent, input5);
|
|
@@ -20234,7 +20268,7 @@ async function discoverAndWireOpenApi(siteDirectory, mode) {
|
|
|
20234
20268
|
}
|
|
20235
20269
|
|
|
20236
20270
|
// src/cli/make-config/interactive.ts
|
|
20237
|
-
import
|
|
20271
|
+
import path69 from "node:path";
|
|
20238
20272
|
import { stdin as input, stdout as output } from "node:process";
|
|
20239
20273
|
import { createInterface as createInterface3 } from "node:readline/promises";
|
|
20240
20274
|
|
|
@@ -20410,7 +20444,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
20410
20444
|
continue;
|
|
20411
20445
|
}
|
|
20412
20446
|
const routePath = `/${slug}`;
|
|
20413
|
-
const relativePath =
|
|
20447
|
+
const relativePath = path69.posix.join(options.pagesDir, `${slug}.tsx`);
|
|
20414
20448
|
const page = {
|
|
20415
20449
|
slug,
|
|
20416
20450
|
title: pageTitle.trim(),
|
|
@@ -20506,7 +20540,7 @@ export default function ${componentName}() {
|
|
|
20506
20540
|
init_package_json();
|
|
20507
20541
|
import { constants } from "node:fs";
|
|
20508
20542
|
import { access as access11, mkdir as mkdir16, readFile as readFile22, writeFile as writeFile20 } from "node:fs/promises";
|
|
20509
|
-
import
|
|
20543
|
+
import path70 from "node:path";
|
|
20510
20544
|
import { glob as glob7 } from "glob";
|
|
20511
20545
|
|
|
20512
20546
|
// src/cli/make-config/favicon-png.ts
|
|
@@ -20521,9 +20555,9 @@ var OPENAPI_GLOBS = [
|
|
|
20521
20555
|
"openapi.yaml",
|
|
20522
20556
|
"openapi.yml"
|
|
20523
20557
|
];
|
|
20524
|
-
var toPosix2 = (p) => p.split(
|
|
20558
|
+
var toPosix2 = (p) => p.split(path70.sep).join("/");
|
|
20525
20559
|
var sanitizePackageName = (dir) => {
|
|
20526
|
-
const base =
|
|
20560
|
+
const base = path70.basename(path70.resolve(dir));
|
|
20527
20561
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
20528
20562
|
return s || "apitogo-site";
|
|
20529
20563
|
};
|
|
@@ -20533,7 +20567,7 @@ var apitogoVersionRange = () => {
|
|
|
20533
20567
|
};
|
|
20534
20568
|
async function findOpenApiSpecPath(dir) {
|
|
20535
20569
|
for (const rel2 of OPENAPI_GLOBS) {
|
|
20536
|
-
const full =
|
|
20570
|
+
const full = path70.join(dir, rel2);
|
|
20537
20571
|
try {
|
|
20538
20572
|
await access11(full, constants.R_OK);
|
|
20539
20573
|
return toPosix2(rel2);
|
|
@@ -20548,7 +20582,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
20548
20582
|
return extra[0] ? toPosix2(extra[0]) : null;
|
|
20549
20583
|
}
|
|
20550
20584
|
async function ensurePackageJson2(dir) {
|
|
20551
|
-
const pkgPath =
|
|
20585
|
+
const pkgPath = path70.join(dir, "package.json");
|
|
20552
20586
|
const apitogoVer = apitogoVersionRange();
|
|
20553
20587
|
const baseDeps = {
|
|
20554
20588
|
react: ">=19.0.0",
|
|
@@ -20615,7 +20649,7 @@ async function ensurePackageJson2(dir) {
|
|
|
20615
20649
|
return false;
|
|
20616
20650
|
}
|
|
20617
20651
|
async function ensureTsconfigJson(dir) {
|
|
20618
|
-
const tsPath =
|
|
20652
|
+
const tsPath = path70.join(dir, "tsconfig.json");
|
|
20619
20653
|
try {
|
|
20620
20654
|
await access11(tsPath, constants.R_OK);
|
|
20621
20655
|
return false;
|
|
@@ -20664,40 +20698,40 @@ var fileExists2 = async (filePath) => {
|
|
|
20664
20698
|
}
|
|
20665
20699
|
};
|
|
20666
20700
|
async function ensurePortalStubFiles(dir) {
|
|
20667
|
-
const landingPath =
|
|
20701
|
+
const landingPath = path70.join(dir, "landing", "LandingPage.tsx");
|
|
20668
20702
|
if (!await fileExists2(landingPath)) {
|
|
20669
|
-
await mkdir16(
|
|
20703
|
+
await mkdir16(path70.join(dir, "landing"), { recursive: true });
|
|
20670
20704
|
await writeFile20(landingPath, LANDING_PAGE_SOURCE, "utf8");
|
|
20671
20705
|
}
|
|
20672
|
-
const plansPath =
|
|
20706
|
+
const plansPath = path70.join(dir, "user-panel", "AccountPlansPage.tsx");
|
|
20673
20707
|
if (!await fileExists2(plansPath)) {
|
|
20674
|
-
await mkdir16(
|
|
20708
|
+
await mkdir16(path70.join(dir, "user-panel"), { recursive: true });
|
|
20675
20709
|
await writeFile20(plansPath, ACCOUNT_PLANS_PAGE_SOURCE, "utf8");
|
|
20676
20710
|
}
|
|
20677
|
-
const dashboardPath =
|
|
20711
|
+
const dashboardPath = path70.join(dir, "user-panel", "DashboardPage.tsx");
|
|
20678
20712
|
if (!await fileExists2(dashboardPath)) {
|
|
20679
|
-
await mkdir16(
|
|
20713
|
+
await mkdir16(path70.join(dir, "user-panel"), { recursive: true });
|
|
20680
20714
|
await writeFile20(dashboardPath, DASHBOARD_PAGE_SOURCE, "utf8");
|
|
20681
20715
|
}
|
|
20682
20716
|
await ensurePublicBrandingFiles(dir);
|
|
20683
20717
|
}
|
|
20684
20718
|
async function ensurePublicBrandingFiles(dir) {
|
|
20685
|
-
const destDir =
|
|
20719
|
+
const destDir = path70.join(dir, "public");
|
|
20686
20720
|
await mkdir16(destDir, { recursive: true });
|
|
20687
20721
|
for (const { name, content } of BRANDING_ASSETS) {
|
|
20688
|
-
const dest =
|
|
20722
|
+
const dest = path70.join(destDir, name);
|
|
20689
20723
|
if (await fileExists2(dest)) {
|
|
20690
20724
|
continue;
|
|
20691
20725
|
}
|
|
20692
20726
|
await writeFile20(dest, content, "utf8");
|
|
20693
20727
|
}
|
|
20694
|
-
const faviconDest =
|
|
20728
|
+
const faviconDest = path70.join(destDir, "Icon.png");
|
|
20695
20729
|
if (!await fileExists2(faviconDest)) {
|
|
20696
20730
|
await writeFile20(faviconDest, Buffer.from(FAVICON_PNG_BASE64, "base64"));
|
|
20697
20731
|
}
|
|
20698
20732
|
}
|
|
20699
20733
|
async function ensureThinConfigTsx(dir) {
|
|
20700
|
-
const tsxPath =
|
|
20734
|
+
const tsxPath = path70.join(dir, "apitogo.config.tsx");
|
|
20701
20735
|
if (await fileExists2(tsxPath)) {
|
|
20702
20736
|
return false;
|
|
20703
20737
|
}
|
|
@@ -20706,7 +20740,7 @@ async function ensureThinConfigTsx(dir) {
|
|
|
20706
20740
|
}
|
|
20707
20741
|
|
|
20708
20742
|
// src/cli/make-config/handler.ts
|
|
20709
|
-
var toPosixPath2 = (value) => value.split(
|
|
20743
|
+
var toPosixPath2 = (value) => value.split(path71.sep).join(path71.posix.sep);
|
|
20710
20744
|
var fileExists3 = async (filePath) => {
|
|
20711
20745
|
try {
|
|
20712
20746
|
await access12(filePath, constants2.F_OK);
|
|
@@ -20764,7 +20798,7 @@ async function persistConfig(config2, ctx) {
|
|
|
20764
20798
|
};
|
|
20765
20799
|
await writeFile21(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
|
|
20766
20800
|
`, "utf8");
|
|
20767
|
-
const tsxPath =
|
|
20801
|
+
const tsxPath = path71.join(ctx.dir, "apitogo.config.tsx");
|
|
20768
20802
|
if (await fileExists3(tsxPath) && tsxRoutes.length > 0) {
|
|
20769
20803
|
const tsxSource = await readFile23(tsxPath, "utf8");
|
|
20770
20804
|
if (isManagedConfigWrapper(tsxSource)) {
|
|
@@ -20791,7 +20825,7 @@ function mergeBackendFlag(config2, backend) {
|
|
|
20791
20825
|
return next;
|
|
20792
20826
|
}
|
|
20793
20827
|
async function makeConfig(argv) {
|
|
20794
|
-
const dir =
|
|
20828
|
+
const dir = path71.resolve(process.cwd(), argv.dir);
|
|
20795
20829
|
const pagesDir = toPosixPath2(
|
|
20796
20830
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
20797
20831
|
);
|
|
@@ -20811,14 +20845,14 @@ async function makeConfig(argv) {
|
|
|
20811
20845
|
printSuccessToConsole("Created tsconfig.json.");
|
|
20812
20846
|
}
|
|
20813
20847
|
await ensurePortalStubFiles(dir);
|
|
20814
|
-
const jsonPath =
|
|
20848
|
+
const jsonPath = path71.join(dir, APITOGO_JSON_FILENAME);
|
|
20815
20849
|
let createdJson = false;
|
|
20816
20850
|
let config2;
|
|
20817
20851
|
if (await fileExists3(jsonPath)) {
|
|
20818
20852
|
config2 = await readJsonConfig(jsonPath);
|
|
20819
20853
|
} else {
|
|
20820
20854
|
config2 = createDefaultApitogoJsonConfig({
|
|
20821
|
-
title: titleFromDirectoryName(
|
|
20855
|
+
title: titleFromDirectoryName(path71.basename(dir)),
|
|
20822
20856
|
pagesDir
|
|
20823
20857
|
});
|
|
20824
20858
|
createdJson = true;
|
|
@@ -20870,8 +20904,8 @@ async function makeConfig(argv) {
|
|
|
20870
20904
|
return;
|
|
20871
20905
|
}
|
|
20872
20906
|
if (action2.kind === "page") {
|
|
20873
|
-
const pagePath =
|
|
20874
|
-
await mkdir17(
|
|
20907
|
+
const pagePath = path71.join(dir, action2.page.relativePath);
|
|
20908
|
+
await mkdir17(path71.dirname(pagePath), { recursive: true });
|
|
20875
20909
|
await writeFile21(
|
|
20876
20910
|
pagePath,
|
|
20877
20911
|
buildStarterDocsPageTsx(action2.page.slug, action2.page.title),
|
|
@@ -20938,7 +20972,7 @@ async function makeConfig(argv) {
|
|
|
20938
20972
|
if (argv.openapi) {
|
|
20939
20973
|
const wire = await wireDevPortalOpenApi(
|
|
20940
20974
|
dir,
|
|
20941
|
-
|
|
20975
|
+
path71.resolve(dir, argv.openapi)
|
|
20942
20976
|
);
|
|
20943
20977
|
if (wire.status !== "succeeded") {
|
|
20944
20978
|
throw new Error(
|
|
@@ -20967,7 +21001,7 @@ async function makeConfig(argv) {
|
|
|
20967
21001
|
const slug = normalizePageSlug2(argv.pageSlug);
|
|
20968
21002
|
const pageTemplate = normalizePageTemplate(argv.pageTemplate);
|
|
20969
21003
|
const relativePagePath = pageComponentRelativePath(slug);
|
|
20970
|
-
const filePath =
|
|
21004
|
+
const filePath = path71.join(dir, relativePagePath);
|
|
20971
21005
|
const isUpdate = argv.pageUpdate === true;
|
|
20972
21006
|
if (isUpdate) {
|
|
20973
21007
|
if (!await fileExists3(filePath)) {
|
|
@@ -21000,7 +21034,7 @@ async function makeConfig(argv) {
|
|
|
21000
21034
|
argv.pageContent,
|
|
21001
21035
|
pageTemplate
|
|
21002
21036
|
);
|
|
21003
|
-
await mkdir17(
|
|
21037
|
+
await mkdir17(path71.dirname(filePath), { recursive: true });
|
|
21004
21038
|
await writeFile21(filePath, tsx, "utf8");
|
|
21005
21039
|
const configResult = await wireNewDevPortalPageInConfig(
|
|
21006
21040
|
dir,
|
|
@@ -21013,7 +21047,7 @@ async function makeConfig(argv) {
|
|
|
21013
21047
|
pagePath: relativePagePath,
|
|
21014
21048
|
pageTemplate,
|
|
21015
21049
|
configUpdated: configResult.updated,
|
|
21016
|
-
configPath: configResult.configPath ?
|
|
21050
|
+
configPath: configResult.configPath ? path71.relative(dir, configResult.configPath) : null
|
|
21017
21051
|
};
|
|
21018
21052
|
changes.push("page_add");
|
|
21019
21053
|
}
|
|
@@ -21138,10 +21172,10 @@ var config_default = {
|
|
|
21138
21172
|
};
|
|
21139
21173
|
|
|
21140
21174
|
// src/cli/cmds/deploy.ts
|
|
21141
|
-
import
|
|
21175
|
+
import path85 from "node:path";
|
|
21142
21176
|
|
|
21143
21177
|
// src/cli/apply/handler.ts
|
|
21144
|
-
import
|
|
21178
|
+
import path82 from "node:path";
|
|
21145
21179
|
|
|
21146
21180
|
// src/cli/platform/helpers/gateway-plan-validation.ts
|
|
21147
21181
|
init_gateway_limits();
|
|
@@ -21336,11 +21370,11 @@ init_gateway_limits();
|
|
|
21336
21370
|
// src/cli/platform/helpers/deploy-artifact-hash.ts
|
|
21337
21371
|
import { createHash as createHash3 } from "node:crypto";
|
|
21338
21372
|
import { createReadStream, promises as fs8 } from "node:fs";
|
|
21339
|
-
import
|
|
21373
|
+
import path73 from "node:path";
|
|
21340
21374
|
|
|
21341
21375
|
// src/cli/platform/helpers/package-files.ts
|
|
21342
21376
|
import { promises as fs7 } from "node:fs";
|
|
21343
|
-
import
|
|
21377
|
+
import path72 from "node:path";
|
|
21344
21378
|
import ignore from "ignore";
|
|
21345
21379
|
var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
21346
21380
|
"node_modules",
|
|
@@ -21353,7 +21387,7 @@ var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
|
21353
21387
|
async function loadGitignore(rootDir) {
|
|
21354
21388
|
const ig = ignore();
|
|
21355
21389
|
ig.add(["node_modules/", ".git/", "dist/", "bin/", "obj/"]);
|
|
21356
|
-
const gitignorePath =
|
|
21390
|
+
const gitignorePath = path72.join(rootDir, ".gitignore");
|
|
21357
21391
|
try {
|
|
21358
21392
|
const content = await fs7.readFile(gitignorePath, "utf8");
|
|
21359
21393
|
ig.add(content);
|
|
@@ -21362,11 +21396,11 @@ async function loadGitignore(rootDir) {
|
|
|
21362
21396
|
return ig;
|
|
21363
21397
|
}
|
|
21364
21398
|
async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
21365
|
-
const absDir =
|
|
21399
|
+
const absDir = path72.join(rootDir, relativeDir);
|
|
21366
21400
|
const entries = await fs7.readdir(absDir, { withFileTypes: true });
|
|
21367
21401
|
for (const entry of entries) {
|
|
21368
|
-
const rel2 = relativeDir ?
|
|
21369
|
-
const relPosix = rel2.split(
|
|
21402
|
+
const rel2 = relativeDir ? path72.join(relativeDir, entry.name) : entry.name;
|
|
21403
|
+
const relPosix = rel2.split(path72.sep).join("/");
|
|
21370
21404
|
if (DEFAULT_EXCLUDES.has(entry.name) && !relativeDir) {
|
|
21371
21405
|
continue;
|
|
21372
21406
|
}
|
|
@@ -21381,7 +21415,7 @@ async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
|
21381
21415
|
}
|
|
21382
21416
|
}
|
|
21383
21417
|
async function collectPackageableFiles(sourceDirectory) {
|
|
21384
|
-
const resolved =
|
|
21418
|
+
const resolved = path72.resolve(sourceDirectory);
|
|
21385
21419
|
const stat7 = await fs7.stat(resolved).catch(() => null);
|
|
21386
21420
|
if (!stat7?.isDirectory()) {
|
|
21387
21421
|
throw new Error(`sourceDirectory is not a directory: ${resolved}`);
|
|
@@ -21407,7 +21441,7 @@ async function sha256File(filePath) {
|
|
|
21407
21441
|
return hash2.digest("hex");
|
|
21408
21442
|
}
|
|
21409
21443
|
async function hashDirectoryContents(rootDirectory) {
|
|
21410
|
-
const resolved =
|
|
21444
|
+
const resolved = path73.resolve(rootDirectory);
|
|
21411
21445
|
const files = (await collectPackageableFiles(resolved)).sort(
|
|
21412
21446
|
(a, b) => a.localeCompare(b)
|
|
21413
21447
|
);
|
|
@@ -21415,13 +21449,13 @@ async function hashDirectoryContents(rootDirectory) {
|
|
|
21415
21449
|
for (const rel2 of files) {
|
|
21416
21450
|
hash2.update(rel2);
|
|
21417
21451
|
hash2.update("\0");
|
|
21418
|
-
hash2.update(await fs8.readFile(
|
|
21452
|
+
hash2.update(await fs8.readFile(path73.join(resolved, rel2)));
|
|
21419
21453
|
hash2.update("\0");
|
|
21420
21454
|
}
|
|
21421
21455
|
return hash2.digest("hex");
|
|
21422
21456
|
}
|
|
21423
21457
|
async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
21424
|
-
const resolved =
|
|
21458
|
+
const resolved = path73.resolve(siteDirectory);
|
|
21425
21459
|
const hash2 = createHash3("sha256");
|
|
21426
21460
|
const candidates = [
|
|
21427
21461
|
"apitogo.config.json",
|
|
@@ -21431,7 +21465,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
21431
21465
|
"zudoku.config.tsx"
|
|
21432
21466
|
];
|
|
21433
21467
|
for (const name of candidates) {
|
|
21434
|
-
const full =
|
|
21468
|
+
const full = path73.join(resolved, name);
|
|
21435
21469
|
try {
|
|
21436
21470
|
hash2.update(name);
|
|
21437
21471
|
hash2.update("\0");
|
|
@@ -21441,7 +21475,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
21441
21475
|
}
|
|
21442
21476
|
}
|
|
21443
21477
|
for (const dir of ["pages", "landing", "src"]) {
|
|
21444
|
-
const full =
|
|
21478
|
+
const full = path73.join(resolved, dir);
|
|
21445
21479
|
try {
|
|
21446
21480
|
const st = await fs8.stat(full);
|
|
21447
21481
|
if (!st.isDirectory()) continue;
|
|
@@ -21670,8 +21704,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
21670
21704
|
const trimmed = actionKey2.trim();
|
|
21671
21705
|
if (trimmed.includes(":")) {
|
|
21672
21706
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
21673
|
-
const
|
|
21674
|
-
return `${method2?.toLowerCase()}:${
|
|
21707
|
+
const path104 = pathParts.join(":").trim();
|
|
21708
|
+
return `${method2?.toLowerCase()}:${path104.startsWith("/") ? path104 : `/${path104}`}`;
|
|
21675
21709
|
}
|
|
21676
21710
|
const spaceIndex = trimmed.indexOf(" ");
|
|
21677
21711
|
if (spaceIndex <= 0) {
|
|
@@ -21680,8 +21714,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
21680
21714
|
);
|
|
21681
21715
|
}
|
|
21682
21716
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
21683
|
-
const
|
|
21684
|
-
return `${method}:${
|
|
21717
|
+
const path103 = trimmed.slice(spaceIndex + 1).trim();
|
|
21718
|
+
return `${method}:${path103.startsWith("/") ? path103 : `/${path103}`}`;
|
|
21685
21719
|
}
|
|
21686
21720
|
async function applyGatewayPublicRoutes(client, projectId, routes, options) {
|
|
21687
21721
|
const applied = [];
|
|
@@ -22160,7 +22194,7 @@ async function upsertGatewayPlansFromManifest(client, config2, projectId, plans,
|
|
|
22160
22194
|
|
|
22161
22195
|
// src/cli/platform/helpers/openapi-gateway-servers.ts
|
|
22162
22196
|
import { mkdir as mkdir18, readFile as readFile24, writeFile as writeFile22 } from "node:fs/promises";
|
|
22163
|
-
import
|
|
22197
|
+
import path74 from "node:path";
|
|
22164
22198
|
import YAML3 from "yaml";
|
|
22165
22199
|
var GATEWAY_URL_ENV_KEY = "APITOGO_GATEWAY_URL";
|
|
22166
22200
|
var PUBLISH_OPENAPI_RELATIVE = ".apitogo/openapi-publish.json";
|
|
@@ -22192,7 +22226,7 @@ async function resolveProjectGatewayUrl(client, projectId) {
|
|
|
22192
22226
|
}
|
|
22193
22227
|
async function readOpenApiDocument(filePath) {
|
|
22194
22228
|
const content = await readFile24(filePath, "utf8");
|
|
22195
|
-
const ext =
|
|
22229
|
+
const ext = path74.extname(filePath).toLowerCase();
|
|
22196
22230
|
const parsed = ext === ".json" ? JSON.parse(content) : YAML3.parse(content);
|
|
22197
22231
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
22198
22232
|
throw new Error(`OpenAPI document must be an object: ${filePath}`);
|
|
@@ -22200,13 +22234,13 @@ async function readOpenApiDocument(filePath) {
|
|
|
22200
22234
|
return parsed;
|
|
22201
22235
|
}
|
|
22202
22236
|
async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApiPath, gatewayUrl) {
|
|
22203
|
-
const site =
|
|
22204
|
-
const source =
|
|
22237
|
+
const site = path74.resolve(siteDirectory);
|
|
22238
|
+
const source = path74.resolve(sourceOpenApiPath);
|
|
22205
22239
|
const relativeInput = PUBLISH_OPENAPI_RELATIVE;
|
|
22206
|
-
const outputPath =
|
|
22240
|
+
const outputPath = path74.join(site, ...relativeInput.split("/"));
|
|
22207
22241
|
const doc = await readOpenApiDocument(source);
|
|
22208
22242
|
const rewritten = withGatewayServers(doc, gatewayUrl);
|
|
22209
|
-
await mkdir18(
|
|
22243
|
+
await mkdir18(path74.dirname(outputPath), { recursive: true });
|
|
22210
22244
|
await writeFile22(
|
|
22211
22245
|
outputPath,
|
|
22212
22246
|
`${JSON.stringify(rewritten, null, 2)}
|
|
@@ -22216,8 +22250,8 @@ async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApi
|
|
|
22216
22250
|
return { outputPath, relativeInput };
|
|
22217
22251
|
}
|
|
22218
22252
|
async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
22219
|
-
const configPath =
|
|
22220
|
-
|
|
22253
|
+
const configPath = path74.join(
|
|
22254
|
+
path74.resolve(siteDirectory),
|
|
22221
22255
|
APITOGO_CONFIG_FILENAME2
|
|
22222
22256
|
);
|
|
22223
22257
|
const raw = await readFile24(configPath, "utf8");
|
|
@@ -22259,7 +22293,7 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
|
22259
22293
|
};
|
|
22260
22294
|
}
|
|
22261
22295
|
async function prepareOpenApiServersForGatewayBuild(options) {
|
|
22262
|
-
const siteDirectory =
|
|
22296
|
+
const siteDirectory = path74.resolve(options.siteDirectory);
|
|
22263
22297
|
let openApiPath = resolveBackendOpenApiPath(
|
|
22264
22298
|
options.manifest?.backend?.openApiPath,
|
|
22265
22299
|
{
|
|
@@ -22273,7 +22307,7 @@ async function prepareOpenApiServersForGatewayBuild(options) {
|
|
|
22273
22307
|
if (!openApiPath) {
|
|
22274
22308
|
try {
|
|
22275
22309
|
const raw = await readFile24(
|
|
22276
|
-
|
|
22310
|
+
path74.join(siteDirectory, APITOGO_CONFIG_FILENAME2),
|
|
22277
22311
|
"utf8"
|
|
22278
22312
|
);
|
|
22279
22313
|
const config2 = JSON.parse(raw);
|
|
@@ -22302,8 +22336,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22302
22336
|
const trimmed = actionKey2.trim();
|
|
22303
22337
|
if (trimmed.includes(":")) {
|
|
22304
22338
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
22305
|
-
const
|
|
22306
|
-
return `${method2.toLowerCase()}:${
|
|
22339
|
+
const path104 = pathParts.join(":").trim();
|
|
22340
|
+
return `${method2.toLowerCase()}:${path104.startsWith("/") ? path104 : `/${path104}`}`;
|
|
22307
22341
|
}
|
|
22308
22342
|
const spaceIndex = trimmed.indexOf(" ");
|
|
22309
22343
|
if (spaceIndex <= 0) {
|
|
@@ -22312,8 +22346,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22312
22346
|
);
|
|
22313
22347
|
}
|
|
22314
22348
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
22315
|
-
const
|
|
22316
|
-
return `${method}:${
|
|
22349
|
+
const path103 = trimmed.slice(spaceIndex + 1).trim();
|
|
22350
|
+
return `${method}:${path103.startsWith("/") ? path103 : `/${path103}`}`;
|
|
22317
22351
|
}
|
|
22318
22352
|
function normalizePublicRoute(route) {
|
|
22319
22353
|
const trimmed = route.trim();
|
|
@@ -22347,10 +22381,10 @@ function collectManifestPublicActionKeys(gateway) {
|
|
|
22347
22381
|
|
|
22348
22382
|
// src/cli/platform/helpers/publish-ledger.ts
|
|
22349
22383
|
import { mkdir as mkdir19, readFile as readFile25, writeFile as writeFile23 } from "node:fs/promises";
|
|
22350
|
-
import
|
|
22384
|
+
import path75 from "node:path";
|
|
22351
22385
|
var PUBLISH_LEDGER_RELATIVE_PATH = ".apitogo/publish-state.json";
|
|
22352
22386
|
function publishLedgerPath(siteDirectory) {
|
|
22353
|
-
return
|
|
22387
|
+
return path75.join(path75.resolve(siteDirectory), PUBLISH_LEDGER_RELATIVE_PATH);
|
|
22354
22388
|
}
|
|
22355
22389
|
async function readPublishLedger(siteDirectory) {
|
|
22356
22390
|
const filePath = publishLedgerPath(siteDirectory);
|
|
@@ -22367,7 +22401,7 @@ async function readPublishLedger(siteDirectory) {
|
|
|
22367
22401
|
}
|
|
22368
22402
|
async function writePublishLedger(siteDirectory, ledger) {
|
|
22369
22403
|
const filePath = publishLedgerPath(siteDirectory);
|
|
22370
|
-
await mkdir19(
|
|
22404
|
+
await mkdir19(path75.dirname(filePath), { recursive: true });
|
|
22371
22405
|
const next = {
|
|
22372
22406
|
...ledger,
|
|
22373
22407
|
version: 1,
|
|
@@ -22889,7 +22923,7 @@ async function createProjectWithWarmPoolRetry(client, body, options) {
|
|
|
22889
22923
|
import { spawn as spawn4 } from "node:child_process";
|
|
22890
22924
|
import { mkdtemp, readdir as readdir2, rm as rm11 } from "node:fs/promises";
|
|
22891
22925
|
import { tmpdir } from "node:os";
|
|
22892
|
-
import
|
|
22926
|
+
import path76 from "node:path";
|
|
22893
22927
|
async function directoryHasRuntimeConfig(dir) {
|
|
22894
22928
|
if (!await pathExists2(dir)) {
|
|
22895
22929
|
return false;
|
|
@@ -22932,20 +22966,20 @@ function runDotnetPublish(projectDir, outputDir) {
|
|
|
22932
22966
|
async function findCsproj(projectDir) {
|
|
22933
22967
|
const entries = await readdir2(projectDir);
|
|
22934
22968
|
const csproj = entries.find((name) => name.endsWith(".csproj"));
|
|
22935
|
-
return csproj ?
|
|
22969
|
+
return csproj ? path76.join(projectDir, csproj) : null;
|
|
22936
22970
|
}
|
|
22937
22971
|
async function prepareBackendPackagingDirectory(args) {
|
|
22938
|
-
const sourceDirectory =
|
|
22972
|
+
const sourceDirectory = path76.resolve(args.sourceDirectory);
|
|
22939
22973
|
if (args.publishDirectory?.trim()) {
|
|
22940
22974
|
return {
|
|
22941
|
-
directory:
|
|
22975
|
+
directory: path76.resolve(args.publishDirectory),
|
|
22942
22976
|
packagingMode: "published"
|
|
22943
22977
|
};
|
|
22944
22978
|
}
|
|
22945
22979
|
if (await directoryHasRuntimeConfig(sourceDirectory)) {
|
|
22946
22980
|
return { directory: sourceDirectory, packagingMode: "published" };
|
|
22947
22981
|
}
|
|
22948
|
-
const publishSubdir =
|
|
22982
|
+
const publishSubdir = path76.join(sourceDirectory, "publish");
|
|
22949
22983
|
if (await directoryHasRuntimeConfig(publishSubdir)) {
|
|
22950
22984
|
return { directory: publishSubdir, packagingMode: "published" };
|
|
22951
22985
|
}
|
|
@@ -22957,9 +22991,9 @@ async function prepareBackendPackagingDirectory(args) {
|
|
|
22957
22991
|
return { directory: sourceDirectory, packagingMode: "source" };
|
|
22958
22992
|
}
|
|
22959
22993
|
const tempRoot = await mkdtemp(
|
|
22960
|
-
|
|
22994
|
+
path76.join(tmpdir(), "apitogo-dotnet-publish-")
|
|
22961
22995
|
);
|
|
22962
|
-
const outputDir =
|
|
22996
|
+
const outputDir = path76.join(tempRoot, "publish");
|
|
22963
22997
|
const result = await runDotnetPublish(sourceDirectory, outputDir);
|
|
22964
22998
|
if (result.exitCode !== 0) {
|
|
22965
22999
|
await rm11(tempRoot, { recursive: true, force: true });
|
|
@@ -23005,12 +23039,12 @@ function formatJobStatusResponse(options) {
|
|
|
23005
23039
|
// src/cli/platform/helpers/zip.ts
|
|
23006
23040
|
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as fs9 } from "node:fs";
|
|
23007
23041
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
23008
|
-
import
|
|
23042
|
+
import path77 from "node:path";
|
|
23009
23043
|
import { ZipArchive } from "archiver";
|
|
23010
23044
|
async function packageBackendDirectory(sourceDirectory) {
|
|
23011
|
-
const resolved =
|
|
23045
|
+
const resolved = path77.resolve(sourceDirectory);
|
|
23012
23046
|
const files = await collectPackageableFiles(resolved);
|
|
23013
|
-
const zipPath =
|
|
23047
|
+
const zipPath = path77.join(
|
|
23014
23048
|
tmpdir2(),
|
|
23015
23049
|
`apitogo-backend-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`
|
|
23016
23050
|
);
|
|
@@ -23022,8 +23056,8 @@ async function packageBackendDirectory(sourceDirectory) {
|
|
|
23022
23056
|
output4.on("error", reject);
|
|
23023
23057
|
archive.pipe(output4);
|
|
23024
23058
|
for (const rel2 of files) {
|
|
23025
|
-
archive.append(createReadStream2(
|
|
23026
|
-
name: rel2.split(
|
|
23059
|
+
archive.append(createReadStream2(path77.join(resolved, rel2)), {
|
|
23060
|
+
name: rel2.split(path77.sep).join("/")
|
|
23027
23061
|
});
|
|
23028
23062
|
}
|
|
23029
23063
|
void archive.finalize();
|
|
@@ -24524,11 +24558,11 @@ async function resolveProjectIdForPublish(client, config2, args, wait, progress,
|
|
|
24524
24558
|
}
|
|
24525
24559
|
|
|
24526
24560
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
24527
|
-
import
|
|
24561
|
+
import path81 from "node:path";
|
|
24528
24562
|
|
|
24529
24563
|
// src/cli/platform/helpers/dev-portal-site-api-url.ts
|
|
24530
24564
|
import { readdir as readdir3, readFile as readFile26, writeFile as writeFile24 } from "node:fs/promises";
|
|
24531
|
-
import
|
|
24565
|
+
import path78 from "node:path";
|
|
24532
24566
|
var SITE_API_BASE_URL_ENV_KEY = "VITE_APITOGO_AUTHENTICATION_API_BASE_URL";
|
|
24533
24567
|
var PLACEHOLDER_HOST_MARKERS = [
|
|
24534
24568
|
"dp-example.azurecontainerapps.io",
|
|
@@ -24549,10 +24583,10 @@ function isPlaceholderDevPortalApiUrl(apiBaseUrl) {
|
|
|
24549
24583
|
return PLACEHOLDER_HOST_MARKERS.some((marker) => normalized.includes(marker));
|
|
24550
24584
|
}
|
|
24551
24585
|
async function readSiteApiBaseUrl(sourceDirectory) {
|
|
24552
|
-
const resolved =
|
|
24586
|
+
const resolved = path78.resolve(sourceDirectory);
|
|
24553
24587
|
for (const envFile of [".env", ".env.production"]) {
|
|
24554
24588
|
try {
|
|
24555
|
-
const content = await readFile26(
|
|
24589
|
+
const content = await readFile26(path78.join(resolved, envFile), "utf8");
|
|
24556
24590
|
const lines = [...content.matchAll(ENV_LINE_GLOBAL_RE)];
|
|
24557
24591
|
if (lines.length === 0) {
|
|
24558
24592
|
continue;
|
|
@@ -24577,11 +24611,11 @@ async function readSiteApiBaseUrl(sourceDirectory) {
|
|
|
24577
24611
|
return null;
|
|
24578
24612
|
}
|
|
24579
24613
|
async function patchSiteApiBaseUrl(sourceDirectory, apiBaseUrl) {
|
|
24580
|
-
const resolved =
|
|
24614
|
+
const resolved = path78.resolve(sourceDirectory);
|
|
24581
24615
|
const line2 = `${SITE_API_BASE_URL_ENV_KEY}=${apiBaseUrl}`;
|
|
24582
24616
|
let patchedExisting = false;
|
|
24583
24617
|
for (const envFile of [".env.production", ".env"]) {
|
|
24584
|
-
const envPath =
|
|
24618
|
+
const envPath = path78.join(resolved, envFile);
|
|
24585
24619
|
try {
|
|
24586
24620
|
const content = await readFile26(envPath, "utf8");
|
|
24587
24621
|
const withoutAssignments = content.replace(ENV_LINE_GLOBAL_RE, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
@@ -24595,7 +24629,7 @@ ${line2}
|
|
|
24595
24629
|
}
|
|
24596
24630
|
}
|
|
24597
24631
|
if (!patchedExisting) {
|
|
24598
|
-
await writeFile24(
|
|
24632
|
+
await writeFile24(path78.join(resolved, ".env"), `${line2}
|
|
24599
24633
|
`);
|
|
24600
24634
|
}
|
|
24601
24635
|
}
|
|
@@ -24603,7 +24637,7 @@ function tryProjectId(explicit, manifestProjectId, config2) {
|
|
|
24603
24637
|
return explicit?.trim() || manifestProjectId?.trim() || config2.defaultProjectId?.trim() || void 0;
|
|
24604
24638
|
}
|
|
24605
24639
|
async function ensureLiveSiteApiBaseUrlForBuild(_client, config2, args, resolveFromProject) {
|
|
24606
|
-
const sourceDirectory =
|
|
24640
|
+
const sourceDirectory = path78.resolve(args.sourceDirectory);
|
|
24607
24641
|
const explicit = args.apiBaseUrl?.trim();
|
|
24608
24642
|
if (explicit && !isPlaceholderDevPortalApiUrl(explicit)) {
|
|
24609
24643
|
await patchSiteApiBaseUrl(sourceDirectory, explicit);
|
|
@@ -24639,7 +24673,7 @@ async function* walkFiles(root) {
|
|
|
24639
24673
|
return;
|
|
24640
24674
|
}
|
|
24641
24675
|
for (const entry of entries) {
|
|
24642
|
-
const full =
|
|
24676
|
+
const full = path78.join(root, entry.name);
|
|
24643
24677
|
if (entry.isDirectory()) {
|
|
24644
24678
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
24645
24679
|
continue;
|
|
@@ -24651,8 +24685,8 @@ async function* walkFiles(root) {
|
|
|
24651
24685
|
}
|
|
24652
24686
|
}
|
|
24653
24687
|
async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiBaseUrl) {
|
|
24654
|
-
const dist =
|
|
24655
|
-
const siteRoot =
|
|
24688
|
+
const dist = path78.resolve(distDirectory);
|
|
24689
|
+
const siteRoot = path78.dirname(dist);
|
|
24656
24690
|
const fromEnv = expectedApiBaseUrl?.trim() || await readSiteApiBaseUrl(siteRoot) || await readSiteApiBaseUrl(dist);
|
|
24657
24691
|
if (!fromEnv || isPlaceholderDevPortalApiUrl(fromEnv)) {
|
|
24658
24692
|
throw new Error(
|
|
@@ -24688,7 +24722,7 @@ async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiB
|
|
|
24688
24722
|
|
|
24689
24723
|
// src/cli/platform/tools/dev-portal.ts
|
|
24690
24724
|
import { promises as fs11 } from "node:fs";
|
|
24691
|
-
import
|
|
24725
|
+
import path80 from "node:path";
|
|
24692
24726
|
|
|
24693
24727
|
// src/cli/platform/helpers/dev-portal-backend-job.ts
|
|
24694
24728
|
var DEV_PORTAL_BACKEND_UPDATE_RESOURCE_TYPE = "DevPortalBackendUpdate";
|
|
@@ -24798,7 +24832,7 @@ async function snapshotBackendUpdateJobIds(client, projectId) {
|
|
|
24798
24832
|
// src/cli/platform/helpers/tarball.ts
|
|
24799
24833
|
import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as fs10 } from "node:fs";
|
|
24800
24834
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
24801
|
-
import
|
|
24835
|
+
import path79 from "node:path";
|
|
24802
24836
|
import { TarArchive } from "archiver";
|
|
24803
24837
|
var DEV_PORTAL_DEPLOY_ARCHIVE_ROOT = "dist";
|
|
24804
24838
|
function normalizeArchiveRoot(archiveRoot) {
|
|
@@ -24809,10 +24843,10 @@ function normalizeArchiveRoot(archiveRoot) {
|
|
|
24809
24843
|
return `${trimmed}/`;
|
|
24810
24844
|
}
|
|
24811
24845
|
async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
24812
|
-
const resolved =
|
|
24846
|
+
const resolved = path79.resolve(sourceDirectory);
|
|
24813
24847
|
const files = await collectPackageableFiles(resolved);
|
|
24814
24848
|
const entryPrefix = options?.archiveRoot ? normalizeArchiveRoot(options.archiveRoot) : "";
|
|
24815
|
-
const archivePath =
|
|
24849
|
+
const archivePath = path79.join(
|
|
24816
24850
|
tmpdir3(),
|
|
24817
24851
|
`apitogo-docs-${Date.now()}-${Math.random().toString(36).slice(2)}.tgz`
|
|
24818
24852
|
);
|
|
@@ -24824,8 +24858,8 @@ async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
|
24824
24858
|
output4.on("error", reject);
|
|
24825
24859
|
archive.pipe(output4);
|
|
24826
24860
|
for (const rel2 of files) {
|
|
24827
|
-
const entryName = entryPrefix + rel2.split(
|
|
24828
|
-
archive.append(createReadStream3(
|
|
24861
|
+
const entryName = entryPrefix + rel2.split(path79.sep).join("/");
|
|
24862
|
+
archive.append(createReadStream3(path79.join(resolved, rel2)), {
|
|
24829
24863
|
name: entryName
|
|
24830
24864
|
});
|
|
24831
24865
|
}
|
|
@@ -25067,7 +25101,7 @@ function validateDeployArchiveInput(args) {
|
|
|
25067
25101
|
async function resolveDevPortalArchive(args) {
|
|
25068
25102
|
validateDeployArchiveInput(args);
|
|
25069
25103
|
if (args.archivePath?.trim()) {
|
|
25070
|
-
const archivePath =
|
|
25104
|
+
const archivePath = path80.resolve(args.archivePath.trim());
|
|
25071
25105
|
const stat7 = await fs11.stat(archivePath).catch(() => null);
|
|
25072
25106
|
if (!stat7?.isFile()) {
|
|
25073
25107
|
throw new Error(`archivePath is not a file: ${archivePath}`);
|
|
@@ -25132,7 +25166,7 @@ async function handleDeployDevPortal(client, config2, args, progress) {
|
|
|
25132
25166
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
25133
25167
|
async function handleBuildDevPortalSite(client, config2, args, progress) {
|
|
25134
25168
|
const buildProgress = progress?.child("Build dev portal site");
|
|
25135
|
-
const sourceDirectory =
|
|
25169
|
+
const sourceDirectory = path81.resolve(args.sourceDirectory);
|
|
25136
25170
|
await buildProgress?.onStep("Ensuring live portal API URL");
|
|
25137
25171
|
const apiBaseUrl = await ensureLiveSiteApiBaseUrlForBuild(
|
|
25138
25172
|
client,
|
|
@@ -26628,7 +26662,7 @@ function resultLooksFailed(payload) {
|
|
|
26628
26662
|
return parsed.status === "failed" || parsed.status === "blocked";
|
|
26629
26663
|
}
|
|
26630
26664
|
async function apply(argv) {
|
|
26631
|
-
const sourceDirectory =
|
|
26665
|
+
const sourceDirectory = path82.resolve(process.cwd(), argv.dir);
|
|
26632
26666
|
let config2;
|
|
26633
26667
|
try {
|
|
26634
26668
|
config2 = loadConfig();
|
|
@@ -26698,7 +26732,7 @@ async function apply(argv) {
|
|
|
26698
26732
|
if (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_not_found") {
|
|
26699
26733
|
const resolution = await resolveProjectNotFoundInteractively(
|
|
26700
26734
|
parsed,
|
|
26701
|
-
|
|
26735
|
+
path82.basename(sourceDirectory)
|
|
26702
26736
|
);
|
|
26703
26737
|
if (resolution) {
|
|
26704
26738
|
effectiveProjectId = void 0;
|
|
@@ -26718,7 +26752,7 @@ async function apply(argv) {
|
|
|
26718
26752
|
while (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_name_exists") {
|
|
26719
26753
|
const resolution = await resolveProjectNameExistsInteractively(
|
|
26720
26754
|
parsed,
|
|
26721
|
-
effectiveProjectName ??
|
|
26755
|
+
effectiveProjectName ?? path82.basename(sourceDirectory)
|
|
26722
26756
|
);
|
|
26723
26757
|
if (!resolution) {
|
|
26724
26758
|
break;
|
|
@@ -26790,7 +26824,7 @@ async function apply(argv) {
|
|
|
26790
26824
|
|
|
26791
26825
|
// src/cli/deploy/command.ts
|
|
26792
26826
|
init_invariant();
|
|
26793
|
-
import
|
|
26827
|
+
import path84 from "node:path";
|
|
26794
26828
|
|
|
26795
26829
|
// src/cli/deploy/v2.ts
|
|
26796
26830
|
import { rm as rm12 } from "node:fs/promises";
|
|
@@ -26798,7 +26832,7 @@ init_invariant();
|
|
|
26798
26832
|
|
|
26799
26833
|
// src/cli/portal/report.ts
|
|
26800
26834
|
import { access as access13 } from "node:fs/promises";
|
|
26801
|
-
import
|
|
26835
|
+
import path83 from "node:path";
|
|
26802
26836
|
|
|
26803
26837
|
// src/cli/deploy/gateway.ts
|
|
26804
26838
|
import { createHash as createHash4 } from "node:crypto";
|
|
@@ -27077,7 +27111,7 @@ async function planPortalService(resolved, ledger) {
|
|
|
27077
27111
|
const hash2 = await portalBuildHash(resolved, prepared);
|
|
27078
27112
|
const previous = stepOf(ledger, "portal", "build");
|
|
27079
27113
|
const built = await exists4(
|
|
27080
|
-
|
|
27114
|
+
path83.join(resolved.state.buildDir, "index.html")
|
|
27081
27115
|
);
|
|
27082
27116
|
if (previous?.status === "succeeded" && previous.hash === hash2 && built) {
|
|
27083
27117
|
return {
|
|
@@ -27384,7 +27418,7 @@ async function statusV2(dir, only, options = {}) {
|
|
|
27384
27418
|
if (service === "portal") {
|
|
27385
27419
|
const build2 = stepOf(ledger, "portal", "build");
|
|
27386
27420
|
const built = await exists4(
|
|
27387
|
-
|
|
27421
|
+
path83.join(resolved.state.buildDir, "index.html")
|
|
27388
27422
|
);
|
|
27389
27423
|
const state = build2?.status === "failed" ? "build-failed" : build2?.status === "succeeded" && built ? "built" : "not-built";
|
|
27390
27424
|
services.push({
|
|
@@ -27395,7 +27429,7 @@ async function statusV2(dir, only, options = {}) {
|
|
|
27395
27429
|
...build2?.finishedAt ? [`last build: ${build2.finishedAt}`] : [],
|
|
27396
27430
|
...build2?.status === "failed" ? [`error: ${build2.error ?? "unknown"}`] : [],
|
|
27397
27431
|
...state === "built" ? [
|
|
27398
|
-
`output: ${
|
|
27432
|
+
`output: ${path83.relative(resolved.configDir, resolved.state.buildDir)}`
|
|
27399
27433
|
] : [],
|
|
27400
27434
|
...url2 ? [`url: ${url2}`] : ["url: not known (portal is not deployed yet)"]
|
|
27401
27435
|
]
|
|
@@ -27663,7 +27697,7 @@ async function deployProject(argv) {
|
|
|
27663
27697
|
const config2 = loadConfig();
|
|
27664
27698
|
const output4 = await deployV2(
|
|
27665
27699
|
{
|
|
27666
|
-
dir:
|
|
27700
|
+
dir: path84.resolve(process.cwd(), argv.dir),
|
|
27667
27701
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
27668
27702
|
projectId: argv.projectId,
|
|
27669
27703
|
env: argv.env,
|
|
@@ -27744,7 +27778,7 @@ var deploy_default = {
|
|
|
27744
27778
|
}),
|
|
27745
27779
|
handler: async (argv) => {
|
|
27746
27780
|
await captureEvent({ argv, event: "apitogo deploy" });
|
|
27747
|
-
if (await isConfigV2(
|
|
27781
|
+
if (await isConfigV2(path85.resolve(process.cwd(), argv.dir))) {
|
|
27748
27782
|
await deployProject(argv);
|
|
27749
27783
|
return;
|
|
27750
27784
|
}
|
|
@@ -27754,7 +27788,7 @@ var deploy_default = {
|
|
|
27754
27788
|
|
|
27755
27789
|
// src/cli/export/handler.ts
|
|
27756
27790
|
import { mkdir as mkdir20, writeFile as writeFile25 } from "node:fs/promises";
|
|
27757
|
-
import
|
|
27791
|
+
import path86 from "node:path";
|
|
27758
27792
|
init_invariant();
|
|
27759
27793
|
var ExportError = class extends ApitogoError {
|
|
27760
27794
|
constructor(message, developerHint) {
|
|
@@ -27768,7 +27802,7 @@ async function exportOpenApi(args, deps) {
|
|
|
27768
27802
|
`Cannot export "${args.target}".`,
|
|
27769
27803
|
"Only `apitogo export openapi` exists."
|
|
27770
27804
|
);
|
|
27771
|
-
const dir =
|
|
27805
|
+
const dir = path86.resolve(process.cwd(), args.dir ?? ".");
|
|
27772
27806
|
if (!await isConfigV2(dir))
|
|
27773
27807
|
throw new ExportError(
|
|
27774
27808
|
"This command needs a config version 2 project.",
|
|
@@ -27793,8 +27827,8 @@ async function exportOpenApi(args, deps) {
|
|
|
27793
27827
|
throw error;
|
|
27794
27828
|
}
|
|
27795
27829
|
if (!args.out) return { text };
|
|
27796
|
-
const file =
|
|
27797
|
-
await mkdir20(
|
|
27830
|
+
const file = path86.resolve(process.cwd(), args.out);
|
|
27831
|
+
await mkdir20(path86.dirname(file), { recursive: true });
|
|
27798
27832
|
await writeFile25(file, text);
|
|
27799
27833
|
return { text, file };
|
|
27800
27834
|
}
|
|
@@ -27845,15 +27879,15 @@ var export_default = {
|
|
|
27845
27879
|
};
|
|
27846
27880
|
|
|
27847
27881
|
// src/cli/init/handler.ts
|
|
27848
|
-
import
|
|
27882
|
+
import path90 from "node:path";
|
|
27849
27883
|
|
|
27850
27884
|
// src/cli/scaffold/run-scaffold-discovery.ts
|
|
27851
27885
|
import { access as access15, readFile as readFile30, writeFile as writeFile27 } from "node:fs/promises";
|
|
27852
|
-
import
|
|
27886
|
+
import path89 from "node:path";
|
|
27853
27887
|
|
|
27854
27888
|
// src/cli/scaffold/detect-backend.ts
|
|
27855
27889
|
import { readdir as readdir4, readFile as readFile28 } from "node:fs/promises";
|
|
27856
|
-
import
|
|
27890
|
+
import path87 from "node:path";
|
|
27857
27891
|
var DEFAULT_RUNTIME_VERSION = {
|
|
27858
27892
|
dotnet: "DOTNET_10",
|
|
27859
27893
|
nodejs: "NODE_22_LTS",
|
|
@@ -27899,15 +27933,15 @@ function isRunnableNodePackage(pkg) {
|
|
|
27899
27933
|
return typeof scripts.start === "string" || typeof pkg.main === "string";
|
|
27900
27934
|
}
|
|
27901
27935
|
async function detectParentBackend(siteDirectory) {
|
|
27902
|
-
const site =
|
|
27903
|
-
const directory =
|
|
27936
|
+
const site = path87.resolve(siteDirectory);
|
|
27937
|
+
const directory = path87.dirname(site);
|
|
27904
27938
|
if (directory === site) {
|
|
27905
27939
|
return void 0;
|
|
27906
27940
|
}
|
|
27907
27941
|
const files = await listFiles(directory);
|
|
27908
27942
|
const toResult = (runtime, runtimeVersion, marker) => ({
|
|
27909
27943
|
directory,
|
|
27910
|
-
sourceDirectory:
|
|
27944
|
+
sourceDirectory: path87.relative(site, directory).split(path87.sep).join("/") || ".",
|
|
27911
27945
|
runtime,
|
|
27912
27946
|
runtimeVersion,
|
|
27913
27947
|
marker
|
|
@@ -27915,7 +27949,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27915
27949
|
const csproj = files.find((f) => f.endsWith(".csproj"));
|
|
27916
27950
|
const solution = files.find((f) => /\.slnx?$/.test(f));
|
|
27917
27951
|
if (csproj || solution) {
|
|
27918
|
-
const content = csproj ? await readText(
|
|
27952
|
+
const content = csproj ? await readText(path87.join(directory, csproj)) : void 0;
|
|
27919
27953
|
return toResult(
|
|
27920
27954
|
"dotnet",
|
|
27921
27955
|
dotnetVersionFromCsproj(content),
|
|
@@ -27923,7 +27957,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27923
27957
|
);
|
|
27924
27958
|
}
|
|
27925
27959
|
if (files.includes("package.json")) {
|
|
27926
|
-
const raw = await readText(
|
|
27960
|
+
const raw = await readText(path87.join(directory, "package.json"));
|
|
27927
27961
|
try {
|
|
27928
27962
|
const pkg = JSON.parse(raw ?? "");
|
|
27929
27963
|
if (isRunnableNodePackage(pkg)) {
|
|
@@ -27938,7 +27972,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27938
27972
|
}
|
|
27939
27973
|
const pythonMarker = PYTHON_MARKERS.find((m) => files.includes(m));
|
|
27940
27974
|
if (pythonMarker) {
|
|
27941
|
-
const versionSource = await readText(
|
|
27975
|
+
const versionSource = await readText(path87.join(directory, ".python-version")) ?? (pythonMarker === "pyproject.toml" ? (await readText(path87.join(directory, pythonMarker)))?.match(
|
|
27942
27976
|
/requires-python\s*=\s*"([^"]+)"/
|
|
27943
27977
|
)?.[1] : void 0);
|
|
27944
27978
|
return toResult(
|
|
@@ -27961,7 +27995,7 @@ import {
|
|
|
27961
27995
|
symlink as symlink2,
|
|
27962
27996
|
writeFile as writeFile26
|
|
27963
27997
|
} from "node:fs/promises";
|
|
27964
|
-
import
|
|
27998
|
+
import path88 from "node:path";
|
|
27965
27999
|
var DOCS_DIR_WHITELIST = [
|
|
27966
28000
|
"docs",
|
|
27967
28001
|
"documents",
|
|
@@ -27998,14 +28032,14 @@ async function isDirectory2(filePath) {
|
|
|
27998
28032
|
}
|
|
27999
28033
|
}
|
|
28000
28034
|
function toPosix3(value) {
|
|
28001
|
-
return value.split(
|
|
28035
|
+
return value.split(path88.sep).join(path88.posix.sep);
|
|
28002
28036
|
}
|
|
28003
28037
|
function isWhitelistedDirName(name) {
|
|
28004
28038
|
return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
|
|
28005
28039
|
}
|
|
28006
28040
|
function isInside2(parent, child) {
|
|
28007
|
-
const relative =
|
|
28008
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
28041
|
+
const relative = path88.relative(parent, child);
|
|
28042
|
+
return relative === "" || !relative.startsWith("..") && !path88.isAbsolute(relative);
|
|
28009
28043
|
}
|
|
28010
28044
|
async function collectMarkdownFiles(dir, excludeDir) {
|
|
28011
28045
|
const files = [];
|
|
@@ -28019,9 +28053,9 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
28019
28053
|
if (entry.name.startsWith(".")) {
|
|
28020
28054
|
continue;
|
|
28021
28055
|
}
|
|
28022
|
-
const full =
|
|
28056
|
+
const full = path88.join(dir, entry.name);
|
|
28023
28057
|
if (entry.isDirectory()) {
|
|
28024
|
-
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir &&
|
|
28058
|
+
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path88.resolve(full) === excludeDir) {
|
|
28025
28059
|
continue;
|
|
28026
28060
|
}
|
|
28027
28061
|
files.push(...await collectMarkdownFiles(full, excludeDir));
|
|
@@ -28034,11 +28068,11 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
28034
28068
|
return files;
|
|
28035
28069
|
}
|
|
28036
28070
|
async function collectSearchRoots(siteDirectory) {
|
|
28037
|
-
const site =
|
|
28038
|
-
const parent =
|
|
28071
|
+
const site = path88.resolve(siteDirectory);
|
|
28072
|
+
const parent = path88.dirname(site);
|
|
28039
28073
|
const roots = [];
|
|
28040
28074
|
const add = (dir) => {
|
|
28041
|
-
const resolved =
|
|
28075
|
+
const resolved = path88.resolve(dir);
|
|
28042
28076
|
if (!roots.includes(resolved)) {
|
|
28043
28077
|
roots.push(resolved);
|
|
28044
28078
|
}
|
|
@@ -28051,7 +28085,7 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
28051
28085
|
if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
|
|
28052
28086
|
continue;
|
|
28053
28087
|
}
|
|
28054
|
-
add(
|
|
28088
|
+
add(path88.join(parent, entry.name));
|
|
28055
28089
|
}
|
|
28056
28090
|
} catch {
|
|
28057
28091
|
}
|
|
@@ -28060,13 +28094,13 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
28060
28094
|
return roots;
|
|
28061
28095
|
}
|
|
28062
28096
|
async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
28063
|
-
const site =
|
|
28064
|
-
const sitePages =
|
|
28097
|
+
const site = path88.resolve(siteDirectory);
|
|
28098
|
+
const sitePages = path88.join(site, PAGES_DIR);
|
|
28065
28099
|
const searchedDirectories = await collectSearchRoots(site);
|
|
28066
28100
|
const directories = [];
|
|
28067
28101
|
const seen = /* @__PURE__ */ new Set();
|
|
28068
28102
|
const consider = async (dir) => {
|
|
28069
|
-
const resolved =
|
|
28103
|
+
const resolved = path88.resolve(dir);
|
|
28070
28104
|
if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
|
|
28071
28105
|
return;
|
|
28072
28106
|
}
|
|
@@ -28083,7 +28117,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
28083
28117
|
directories.push({ sourceDirectory: resolved, files });
|
|
28084
28118
|
};
|
|
28085
28119
|
for (const root of searchedDirectories) {
|
|
28086
|
-
if (isWhitelistedDirName(
|
|
28120
|
+
if (isWhitelistedDirName(path88.basename(root))) {
|
|
28087
28121
|
await consider(root);
|
|
28088
28122
|
}
|
|
28089
28123
|
try {
|
|
@@ -28095,7 +28129,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
28095
28129
|
if (!isWhitelistedDirName(entry.name)) {
|
|
28096
28130
|
continue;
|
|
28097
28131
|
}
|
|
28098
|
-
await consider(
|
|
28132
|
+
await consider(path88.join(root, entry.name));
|
|
28099
28133
|
}
|
|
28100
28134
|
} catch {
|
|
28101
28135
|
}
|
|
@@ -28114,8 +28148,8 @@ function slugifyDirName(name) {
|
|
|
28114
28148
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
28115
28149
|
}
|
|
28116
28150
|
async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
28117
|
-
const base = slugifyDirName(
|
|
28118
|
-
const parent = slugifyDirName(
|
|
28151
|
+
const base = slugifyDirName(path88.basename(sourceDirectory));
|
|
28152
|
+
const parent = slugifyDirName(path88.basename(path88.dirname(sourceDirectory)));
|
|
28119
28153
|
const candidates = [base, `${parent}-${base}`];
|
|
28120
28154
|
let index = 2;
|
|
28121
28155
|
while (true) {
|
|
@@ -28123,7 +28157,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
|
28123
28157
|
if (used.has(name)) {
|
|
28124
28158
|
continue;
|
|
28125
28159
|
}
|
|
28126
|
-
const target =
|
|
28160
|
+
const target = path88.join(pagesDir, name);
|
|
28127
28161
|
if (await pathExists5(target)) {
|
|
28128
28162
|
const stat7 = await lstat2(target);
|
|
28129
28163
|
if (!stat7.isDirectory() || !await isManagedLinkDir(target)) {
|
|
@@ -28154,8 +28188,8 @@ async function alreadyLinked(linkPath, sourcePath) {
|
|
|
28154
28188
|
return false;
|
|
28155
28189
|
}
|
|
28156
28190
|
const current = await readlink(linkPath);
|
|
28157
|
-
const resolved =
|
|
28158
|
-
return resolved ===
|
|
28191
|
+
const resolved = path88.resolve(path88.dirname(linkPath), current);
|
|
28192
|
+
return resolved === path88.resolve(sourcePath);
|
|
28159
28193
|
} catch {
|
|
28160
28194
|
return false;
|
|
28161
28195
|
}
|
|
@@ -28167,8 +28201,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
|
|
|
28167
28201
|
if (await pathExists5(linkPath)) {
|
|
28168
28202
|
return "skipped";
|
|
28169
28203
|
}
|
|
28170
|
-
await mkdir21(
|
|
28171
|
-
const relativeTarget =
|
|
28204
|
+
await mkdir21(path88.dirname(linkPath), { recursive: true });
|
|
28205
|
+
const relativeTarget = path88.relative(path88.dirname(linkPath), sourcePath);
|
|
28172
28206
|
await symlink2(
|
|
28173
28207
|
relativeTarget,
|
|
28174
28208
|
linkPath,
|
|
@@ -28183,7 +28217,7 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
28183
28217
|
if (routes.length === 0) {
|
|
28184
28218
|
return;
|
|
28185
28219
|
}
|
|
28186
|
-
const configPath =
|
|
28220
|
+
const configPath = path88.join(siteDirectory, CONFIG_FILENAME);
|
|
28187
28221
|
if (!await pathExists5(configPath)) {
|
|
28188
28222
|
return;
|
|
28189
28223
|
}
|
|
@@ -28200,8 +28234,8 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
28200
28234
|
`, "utf8");
|
|
28201
28235
|
}
|
|
28202
28236
|
async function discoverAndWireDocs(siteDirectory) {
|
|
28203
|
-
const site =
|
|
28204
|
-
const pagesDir =
|
|
28237
|
+
const site = path88.resolve(siteDirectory);
|
|
28238
|
+
const pagesDir = path88.join(site, PAGES_DIR);
|
|
28205
28239
|
const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
|
|
28206
28240
|
if (directories.length === 0) {
|
|
28207
28241
|
return {
|
|
@@ -28223,15 +28257,15 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
28223
28257
|
directory.sourceDirectory,
|
|
28224
28258
|
usedNames
|
|
28225
28259
|
);
|
|
28226
|
-
const linkDirectory =
|
|
28260
|
+
const linkDirectory = path88.join(pagesDir, linkName);
|
|
28227
28261
|
const linked = [];
|
|
28228
28262
|
const skipped = [];
|
|
28229
28263
|
for (const sourcePath of directory.files) {
|
|
28230
28264
|
const relativeSource = toPosix3(
|
|
28231
|
-
|
|
28265
|
+
path88.relative(directory.sourceDirectory, sourcePath)
|
|
28232
28266
|
);
|
|
28233
|
-
const linkPath =
|
|
28234
|
-
const relativeLink = toPosix3(
|
|
28267
|
+
const linkPath = path88.join(linkDirectory, relativeSource);
|
|
28268
|
+
const relativeLink = toPosix3(path88.relative(site, linkPath));
|
|
28235
28269
|
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
28236
28270
|
if (routes.includes(route)) {
|
|
28237
28271
|
skipped.push({
|
|
@@ -28279,11 +28313,11 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
28279
28313
|
};
|
|
28280
28314
|
}
|
|
28281
28315
|
function siteRelative(siteDirectory, filePath) {
|
|
28282
|
-
const relative = toPosix3(
|
|
28316
|
+
const relative = toPosix3(path88.relative(siteDirectory, filePath));
|
|
28283
28317
|
if (!relative) {
|
|
28284
28318
|
return ".";
|
|
28285
28319
|
}
|
|
28286
|
-
if (
|
|
28320
|
+
if (path88.isAbsolute(relative)) {
|
|
28287
28321
|
return toPosix3(filePath);
|
|
28288
28322
|
}
|
|
28289
28323
|
if (relative.startsWith("..")) {
|
|
@@ -28371,7 +28405,7 @@ async function pathExists6(filePath) {
|
|
|
28371
28405
|
}
|
|
28372
28406
|
async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
|
|
28373
28407
|
const input5 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
|
|
28374
|
-
const jsonConfigPath =
|
|
28408
|
+
const jsonConfigPath = path89.join(siteDirectory, "apitogo.config.json");
|
|
28375
28409
|
const raw = await readFile30(jsonConfigPath, "utf8");
|
|
28376
28410
|
const siteConfig = JSON.parse(raw);
|
|
28377
28411
|
const updated = applyOpenApiToSiteConfig(siteConfig, {
|
|
@@ -28423,7 +28457,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
|
|
|
28423
28457
|
wired: false
|
|
28424
28458
|
};
|
|
28425
28459
|
}
|
|
28426
|
-
const jsonConfigPath =
|
|
28460
|
+
const jsonConfigPath = path89.join(siteDirectory, "apitogo.config.json");
|
|
28427
28461
|
if (!await pathExists6(jsonConfigPath)) {
|
|
28428
28462
|
return {
|
|
28429
28463
|
openApiDiscovery: {
|
|
@@ -28473,7 +28507,7 @@ async function discoverAndWireBackend(siteDirectory, mode) {
|
|
|
28473
28507
|
if (mode !== "nearby") {
|
|
28474
28508
|
return { status: "skipped", mode };
|
|
28475
28509
|
}
|
|
28476
|
-
const jsonConfigPath =
|
|
28510
|
+
const jsonConfigPath = path89.join(siteDirectory, "apitogo.config.json");
|
|
28477
28511
|
if (!await pathExists6(jsonConfigPath)) {
|
|
28478
28512
|
return { status: "not_found" };
|
|
28479
28513
|
}
|
|
@@ -28540,18 +28574,18 @@ function slugifyName2(name) {
|
|
|
28540
28574
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
|
|
28541
28575
|
}
|
|
28542
28576
|
function resolveInitOutputDirectory(dirArg, name) {
|
|
28543
|
-
const resolved =
|
|
28544
|
-
const base =
|
|
28577
|
+
const resolved = path90.resolve(process.cwd(), dirArg);
|
|
28578
|
+
const base = path90.basename(resolved);
|
|
28545
28579
|
const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
|
|
28546
28580
|
if (isDot) {
|
|
28547
28581
|
const fromName = name?.trim();
|
|
28548
28582
|
if (!fromName) {
|
|
28549
28583
|
throw new Error(
|
|
28550
|
-
"apitogo init scaffolds into a named folder (default `dev-portal`). Pass a folder name or `--name` when using `.`."
|
|
28584
|
+
"apitogo init --no-v2 scaffolds into a named folder (default `dev-portal`). Pass a folder name or `--name` when using `.`."
|
|
28551
28585
|
);
|
|
28552
28586
|
}
|
|
28553
28587
|
return {
|
|
28554
|
-
outputDirectory:
|
|
28588
|
+
outputDirectory: path90.resolve(process.cwd(), slugifyName2(fromName)),
|
|
28555
28589
|
siteName: fromName
|
|
28556
28590
|
};
|
|
28557
28591
|
}
|
|
@@ -28668,9 +28702,9 @@ var init_default = {
|
|
|
28668
28702
|
command: "init [dir]",
|
|
28669
28703
|
builder: (yargs2) => yargs2.positional("dir", {
|
|
28670
28704
|
type: "string",
|
|
28671
|
-
describe: "Directory to scaffold into (
|
|
28672
|
-
// Shown in the help but not applied by yargs, so
|
|
28673
|
-
defaultDescription: '"
|
|
28705
|
+
describe: "Directory to scaffold into (the default is the current directory; with --no-v2 it is dev-portal)",
|
|
28706
|
+
// Shown in the help but not applied by yargs, so config version 2 can default to the current directory.
|
|
28707
|
+
defaultDescription: '"." (the current directory)',
|
|
28674
28708
|
normalize: true
|
|
28675
28709
|
}).option("name", {
|
|
28676
28710
|
type: "string",
|
|
@@ -28694,32 +28728,32 @@ var init_default = {
|
|
|
28694
28728
|
describe: "Auto-discover and wire OpenAPI (nearby = parent/siblings/site)"
|
|
28695
28729
|
}).option("v2", {
|
|
28696
28730
|
type: "boolean",
|
|
28697
|
-
default:
|
|
28698
|
-
describe: "
|
|
28731
|
+
default: true,
|
|
28732
|
+
describe: "Create a config version 2 project (standalone or embedded layout). This is the default; use --no-v2 for the older dev-portal scaffold"
|
|
28699
28733
|
}).option("layout", {
|
|
28700
28734
|
type: "string",
|
|
28701
28735
|
choices: ["standalone", "embedded"],
|
|
28702
|
-
describe: "
|
|
28736
|
+
describe: "Config version 2: override layout detection"
|
|
28703
28737
|
}).option("only", {
|
|
28704
28738
|
type: "string",
|
|
28705
|
-
describe: "
|
|
28739
|
+
describe: "Config version 2: services to enable (only `portal` is available for now)"
|
|
28706
28740
|
}).option("docs", {
|
|
28707
28741
|
type: "string",
|
|
28708
28742
|
array: true,
|
|
28709
|
-
describe: "
|
|
28743
|
+
describe: "Config version 2: existing docs folder or file to include in place (repeatable); --no-docs skips docs detection"
|
|
28710
28744
|
}).option("dry-run", {
|
|
28711
28745
|
type: "boolean",
|
|
28712
28746
|
default: false,
|
|
28713
|
-
describe: "
|
|
28747
|
+
describe: "Config version 2: print what would be created and exit"
|
|
28714
28748
|
}).option("yes", {
|
|
28715
28749
|
alias: "y",
|
|
28716
28750
|
type: "boolean",
|
|
28717
28751
|
default: false,
|
|
28718
|
-
describe: "
|
|
28752
|
+
describe: "Config version 2: do not ask for confirmation; include every docs folder found"
|
|
28719
28753
|
}).option("force", {
|
|
28720
28754
|
type: "boolean",
|
|
28721
28755
|
default: false,
|
|
28722
|
-
describe: "
|
|
28756
|
+
describe: "Config version 2: replace an existing apitogo.config.json"
|
|
28723
28757
|
}),
|
|
28724
28758
|
handler: async (argv) => {
|
|
28725
28759
|
await captureEvent({ argv, event: "apitogo init" });
|
|
@@ -28734,8 +28768,8 @@ import open2 from "open";
|
|
|
28734
28768
|
import colors14 from "picocolors";
|
|
28735
28769
|
|
|
28736
28770
|
// src/cli/platform/device-auth.ts
|
|
28737
|
-
function url(apiUrl,
|
|
28738
|
-
return `${apiUrl}${
|
|
28771
|
+
function url(apiUrl, path103) {
|
|
28772
|
+
return `${apiUrl}${path103.startsWith("/") ? path103 : `/${path103}`}`;
|
|
28739
28773
|
}
|
|
28740
28774
|
async function requestDeviceCode(apiUrl) {
|
|
28741
28775
|
const response = await fetchWithRetry(
|
|
@@ -28917,7 +28951,7 @@ var logout_default = {
|
|
|
28917
28951
|
};
|
|
28918
28952
|
|
|
28919
28953
|
// src/cli/portal/commands.ts
|
|
28920
|
-
import
|
|
28954
|
+
import path91 from "node:path";
|
|
28921
28955
|
init_invariant();
|
|
28922
28956
|
function parseOnly(value) {
|
|
28923
28957
|
if (value === void 0) return void 0;
|
|
@@ -28934,11 +28968,11 @@ function parseOnly(value) {
|
|
|
28934
28968
|
async function run2(command2, argv, compute, format) {
|
|
28935
28969
|
const json = argv.json === true;
|
|
28936
28970
|
try {
|
|
28937
|
-
const dir =
|
|
28971
|
+
const dir = path91.resolve(process.cwd(), argv.dir ?? ".");
|
|
28938
28972
|
if (!await isConfigV2(dir)) {
|
|
28939
28973
|
throw new ServiceEditError(
|
|
28940
28974
|
`${command2} works with a config version 2 project, and there is none in ${dir}.`,
|
|
28941
|
-
"Create one with `apitogo init
|
|
28975
|
+
"Create one with `apitogo init`."
|
|
28942
28976
|
);
|
|
28943
28977
|
}
|
|
28944
28978
|
const output4 = await compute(dir, parseOnly(argv.only));
|
|
@@ -29018,7 +29052,7 @@ var plan_default = {
|
|
|
29018
29052
|
|
|
29019
29053
|
// src/cli/project/create-handler.ts
|
|
29020
29054
|
init_invariant();
|
|
29021
|
-
import
|
|
29055
|
+
import path92 from "node:path";
|
|
29022
29056
|
|
|
29023
29057
|
// src/cli/project/v2.ts
|
|
29024
29058
|
init_invariant();
|
|
@@ -29165,7 +29199,7 @@ async function createLinkedProject(argv, dir) {
|
|
|
29165
29199
|
}
|
|
29166
29200
|
}
|
|
29167
29201
|
async function createProject(argv) {
|
|
29168
|
-
const dir =
|
|
29202
|
+
const dir = path92.resolve(process.cwd(), argv.dir ?? ".");
|
|
29169
29203
|
if (await isConfigV2(dir)) {
|
|
29170
29204
|
await createLinkedProject(argv, dir);
|
|
29171
29205
|
return;
|
|
@@ -29289,14 +29323,14 @@ var remove_default = {
|
|
|
29289
29323
|
|
|
29290
29324
|
// src/cli/dev/handler.ts
|
|
29291
29325
|
init_joinUrl();
|
|
29292
|
-
import
|
|
29326
|
+
import path95 from "node:path";
|
|
29293
29327
|
|
|
29294
29328
|
// src/vite/dev-server.ts
|
|
29295
29329
|
init_logger();
|
|
29296
29330
|
import fs12 from "node:fs/promises";
|
|
29297
29331
|
import http from "node:http";
|
|
29298
29332
|
import https from "node:https";
|
|
29299
|
-
import
|
|
29333
|
+
import path94 from "node:path";
|
|
29300
29334
|
import { createHttpTerminator } from "http-terminator";
|
|
29301
29335
|
import {
|
|
29302
29336
|
createServer as createViteServer,
|
|
@@ -29329,7 +29363,7 @@ init_loader();
|
|
|
29329
29363
|
// src/vite/pagefind-dev-index.ts
|
|
29330
29364
|
init_invariant();
|
|
29331
29365
|
init_joinUrl();
|
|
29332
|
-
import
|
|
29366
|
+
import path93 from "node:path";
|
|
29333
29367
|
import { createIndex as createIndex2 } from "pagefind";
|
|
29334
29368
|
import { isRunnableDevEnvironment } from "vite";
|
|
29335
29369
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -29382,7 +29416,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
29382
29416
|
path: urlPath
|
|
29383
29417
|
};
|
|
29384
29418
|
}
|
|
29385
|
-
const outputPath =
|
|
29419
|
+
const outputPath = path93.join(vite.config.publicDir, "pagefind");
|
|
29386
29420
|
await pagefindIndex.writeFiles({ outputPath });
|
|
29387
29421
|
yield { type: "complete", success: true, indexed };
|
|
29388
29422
|
}
|
|
@@ -29401,9 +29435,9 @@ var DevServer = class {
|
|
|
29401
29435
|
this.protocol = "https";
|
|
29402
29436
|
const { dir } = this.options;
|
|
29403
29437
|
const [key, cert, ca] = await Promise.all([
|
|
29404
|
-
fs12.readFile(
|
|
29405
|
-
fs12.readFile(
|
|
29406
|
-
config2.https.ca ? fs12.readFile(
|
|
29438
|
+
fs12.readFile(path94.resolve(dir, config2.https.key)),
|
|
29439
|
+
fs12.readFile(path94.resolve(dir, config2.https.cert)),
|
|
29440
|
+
config2.https.ca ? fs12.readFile(path94.resolve(dir, config2.https.ca)) : void 0
|
|
29407
29441
|
]);
|
|
29408
29442
|
return https.createServer({ key, cert, ca });
|
|
29409
29443
|
}
|
|
@@ -29420,7 +29454,7 @@ var DevServer = class {
|
|
|
29420
29454
|
);
|
|
29421
29455
|
const server = await this.createNodeServer(config2);
|
|
29422
29456
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
29423
|
-
const publicRoot =
|
|
29457
|
+
const publicRoot = path94.resolve(
|
|
29424
29458
|
this.options.dir,
|
|
29425
29459
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
29426
29460
|
);
|
|
@@ -29437,7 +29471,7 @@ var DevServer = class {
|
|
|
29437
29471
|
// built-in transform middleware which would treat the path as a static asset.
|
|
29438
29472
|
name: "apitogo:entry-client",
|
|
29439
29473
|
configureServer(server2) {
|
|
29440
|
-
const entryPath =
|
|
29474
|
+
const entryPath = path94.posix.join(
|
|
29441
29475
|
server2.config.base,
|
|
29442
29476
|
"/__z/entry.client.tsx"
|
|
29443
29477
|
);
|
|
@@ -29602,7 +29636,7 @@ init_package_json();
|
|
|
29602
29636
|
async function dev(argv) {
|
|
29603
29637
|
const packageJson3 = getZudokuPackageJson();
|
|
29604
29638
|
process.env.NODE_ENV = "development";
|
|
29605
|
-
let dir =
|
|
29639
|
+
let dir = path95.resolve(process.cwd(), argv.dir);
|
|
29606
29640
|
if (await isConfigV2(dir)) {
|
|
29607
29641
|
const { root, prepared } = await preparePortalWorkspace(dir, "development");
|
|
29608
29642
|
dir = root;
|
|
@@ -29701,7 +29735,7 @@ var run_default = {
|
|
|
29701
29735
|
};
|
|
29702
29736
|
|
|
29703
29737
|
// src/cli/secrets/handler.ts
|
|
29704
|
-
import
|
|
29738
|
+
import path96 from "node:path";
|
|
29705
29739
|
init_invariant();
|
|
29706
29740
|
|
|
29707
29741
|
// src/cli/secrets/input.ts
|
|
@@ -29766,7 +29800,7 @@ var SecretsError = class extends ApitogoError {
|
|
|
29766
29800
|
async function resolveProjectId2(argv, deps) {
|
|
29767
29801
|
const explicit = argv.projectId?.trim();
|
|
29768
29802
|
if (explicit) return explicit;
|
|
29769
|
-
const dir =
|
|
29803
|
+
const dir = path96.resolve(process.cwd(), argv.dir ?? ".");
|
|
29770
29804
|
if (await isConfigV2(dir)) {
|
|
29771
29805
|
const id = loadConfigV2(dir).resolved.project.id;
|
|
29772
29806
|
if (id) return id;
|
|
@@ -29926,12 +29960,12 @@ var secrets_default = {
|
|
|
29926
29960
|
};
|
|
29927
29961
|
|
|
29928
29962
|
// src/cli/cmds/status.ts
|
|
29929
|
-
import
|
|
29963
|
+
import path98 from "node:path";
|
|
29930
29964
|
|
|
29931
29965
|
// src/cli/status/handler.ts
|
|
29932
|
-
import
|
|
29966
|
+
import path97 from "node:path";
|
|
29933
29967
|
async function status(argv) {
|
|
29934
|
-
const sourceDirectory =
|
|
29968
|
+
const sourceDirectory = path97.resolve(process.cwd(), argv.dir);
|
|
29935
29969
|
let config2;
|
|
29936
29970
|
try {
|
|
29937
29971
|
config2 = loadConfig();
|
|
@@ -30029,7 +30063,7 @@ var status_default = {
|
|
|
30029
30063
|
}),
|
|
30030
30064
|
handler: async (argv) => {
|
|
30031
30065
|
await captureEvent({ argv, event: "apitogo status" });
|
|
30032
|
-
if (await isConfigV2(
|
|
30066
|
+
if (await isConfigV2(path98.resolve(process.cwd(), argv.dir))) {
|
|
30033
30067
|
await statusOfProject(argv);
|
|
30034
30068
|
return;
|
|
30035
30069
|
}
|
|
@@ -30038,11 +30072,11 @@ var status_default = {
|
|
|
30038
30072
|
};
|
|
30039
30073
|
|
|
30040
30074
|
// src/cli/cmds/teardown.ts
|
|
30041
|
-
import
|
|
30075
|
+
import path101 from "node:path";
|
|
30042
30076
|
|
|
30043
30077
|
// src/cli/teardown/command.ts
|
|
30044
30078
|
init_invariant();
|
|
30045
|
-
import
|
|
30079
|
+
import path99 from "node:path";
|
|
30046
30080
|
import { createInterface as createInterface7 } from "node:readline/promises";
|
|
30047
30081
|
|
|
30048
30082
|
// src/cli/teardown/v2.ts
|
|
@@ -30259,7 +30293,7 @@ async function teardownProject(argv) {
|
|
|
30259
30293
|
const progress = createConsoleProgressReporter();
|
|
30260
30294
|
const result = await teardownV2(
|
|
30261
30295
|
{
|
|
30262
|
-
dir:
|
|
30296
|
+
dir: path99.resolve(process.cwd(), argv.dir),
|
|
30263
30297
|
projectId: argv.projectId,
|
|
30264
30298
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
30265
30299
|
yes: argv.yes === true,
|
|
@@ -30318,7 +30352,7 @@ async function teardownProject(argv) {
|
|
|
30318
30352
|
}
|
|
30319
30353
|
|
|
30320
30354
|
// src/cli/teardown/handler.ts
|
|
30321
|
-
import
|
|
30355
|
+
import path100 from "node:path";
|
|
30322
30356
|
function resultLooksFailed3(payload) {
|
|
30323
30357
|
try {
|
|
30324
30358
|
const parsed = JSON.parse(payload);
|
|
@@ -30334,7 +30368,7 @@ async function teardown(argv) {
|
|
|
30334
30368
|
);
|
|
30335
30369
|
return;
|
|
30336
30370
|
}
|
|
30337
|
-
const sourceDirectory =
|
|
30371
|
+
const sourceDirectory = path100.resolve(process.cwd(), argv.dir);
|
|
30338
30372
|
let config2;
|
|
30339
30373
|
try {
|
|
30340
30374
|
config2 = loadConfig();
|
|
@@ -30412,7 +30446,7 @@ var teardown_default = {
|
|
|
30412
30446
|
}),
|
|
30413
30447
|
handler: async (argv) => {
|
|
30414
30448
|
await captureEvent({ argv, event: "apitogo teardown" });
|
|
30415
|
-
if (await isConfigV2(
|
|
30449
|
+
if (await isConfigV2(path101.resolve(process.cwd(), argv.dir))) {
|
|
30416
30450
|
await teardownProject(argv);
|
|
30417
30451
|
return;
|
|
30418
30452
|
}
|
|
@@ -30489,37 +30523,37 @@ function createApitogoCli(argv) {
|
|
|
30489
30523
|
|
|
30490
30524
|
// src/cli/local-handoff.ts
|
|
30491
30525
|
import { spawn as spawn5 } from "node:child_process";
|
|
30492
|
-
import { existsSync as existsSync9, realpathSync } from "node:fs";
|
|
30493
|
-
import
|
|
30526
|
+
import { existsSync as existsSync9, realpathSync as realpathSync2 } from "node:fs";
|
|
30527
|
+
import path102 from "node:path";
|
|
30494
30528
|
var LOCAL_HANDOFF_ENV = "APITOGO_LOCAL_CLI";
|
|
30495
30529
|
var PACKAGE_NAME = "@lukoweb/apitogo";
|
|
30496
30530
|
var resolveProjectDir = (argv, cwd) => {
|
|
30497
30531
|
for (let i = 0; i < argv.length; i++) {
|
|
30498
30532
|
const arg = argv[i];
|
|
30499
30533
|
const next = argv[i + 1];
|
|
30500
|
-
if (arg === "--dir" && next) return
|
|
30534
|
+
if (arg === "--dir" && next) return path102.resolve(cwd, next);
|
|
30501
30535
|
if (arg?.startsWith("--dir=")) {
|
|
30502
|
-
return
|
|
30536
|
+
return path102.resolve(cwd, arg.slice("--dir=".length));
|
|
30503
30537
|
}
|
|
30504
30538
|
}
|
|
30505
30539
|
return cwd;
|
|
30506
30540
|
};
|
|
30507
30541
|
var findLocalCli = (projectDir, runningRoot) => {
|
|
30508
|
-
let dir =
|
|
30542
|
+
let dir = path102.resolve(projectDir);
|
|
30509
30543
|
let localPackageRoot;
|
|
30510
30544
|
while (!localPackageRoot) {
|
|
30511
|
-
const candidate =
|
|
30512
|
-
if (existsSync9(
|
|
30545
|
+
const candidate = path102.join(dir, "node_modules", PACKAGE_NAME);
|
|
30546
|
+
if (existsSync9(path102.join(candidate, "package.json"))) {
|
|
30513
30547
|
localPackageRoot = candidate;
|
|
30514
|
-
} else if (dir ===
|
|
30548
|
+
} else if (dir === path102.dirname(dir)) {
|
|
30515
30549
|
return void 0;
|
|
30516
30550
|
} else {
|
|
30517
|
-
dir =
|
|
30551
|
+
dir = path102.dirname(dir);
|
|
30518
30552
|
}
|
|
30519
30553
|
}
|
|
30520
|
-
const localRoot =
|
|
30521
|
-
if (localRoot ===
|
|
30522
|
-
return
|
|
30554
|
+
const localRoot = realpathSync2(localPackageRoot);
|
|
30555
|
+
if (localRoot === realpathSync2(runningRoot)) return void 0;
|
|
30556
|
+
return path102.join(localRoot, "cli.js");
|
|
30523
30557
|
};
|
|
30524
30558
|
var handoffToLocalCli = async (argv, runningRoot) => {
|
|
30525
30559
|
if (process.env[LOCAL_HANDOFF_ENV] || process.env.ZUDOKU_ENV === "internal") {
|
|
@@ -30531,7 +30565,7 @@ var handoffToLocalCli = async (argv, runningRoot) => {
|
|
|
30531
30565
|
);
|
|
30532
30566
|
if (!localCli) return void 0;
|
|
30533
30567
|
printDiagnosticsToConsole(
|
|
30534
|
-
`Using the project's local ${PACKAGE_NAME} (${
|
|
30568
|
+
`Using the project's local ${PACKAGE_NAME} (${path102.dirname(localCli)})`
|
|
30535
30569
|
);
|
|
30536
30570
|
const child = spawn5(process.execPath, [localCli, ...argv], {
|
|
30537
30571
|
stdio: "inherit",
|