@lukoweb/apitogo 0.2.18 → 0.2.20
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 +475 -449
- 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 +5 -0
- package/src/vite/watch-ignore.ts +45 -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
|
);
|
|
@@ -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.20",
|
|
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,38 @@ 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 stateIgnore(root) {
|
|
13865
|
+
let workspace = false;
|
|
13866
|
+
try {
|
|
13867
|
+
workspace = path40.basename(root) === "generated" && lstatSync(path40.join(root, "content")).isSymbolicLink();
|
|
13868
|
+
} catch {
|
|
13869
|
+
workspace = false;
|
|
13870
|
+
}
|
|
13871
|
+
if (!workspace) return void 0;
|
|
13872
|
+
const state = path40.dirname(root);
|
|
13873
|
+
const states = unique([state, realpathSync(state)]);
|
|
13874
|
+
const roots = unique([root, realpathSync(root)]);
|
|
13875
|
+
return (file) => {
|
|
13876
|
+
if (!states.some((base) => within(base, file))) return false;
|
|
13877
|
+
if (!roots.some((base) => within(base, file))) return true;
|
|
13878
|
+
return STATE_INSIDE_CONTENT.test(file);
|
|
13879
|
+
};
|
|
13880
|
+
}
|
|
13881
|
+
|
|
13858
13882
|
// src/vite/config.ts
|
|
13859
13883
|
var resolveMergedPublicDir = (rootDir, merged) => {
|
|
13860
13884
|
if (merged.publicDir === false) return void 0;
|
|
13861
13885
|
const rel2 = typeof merged.publicDir === "string" ? merged.publicDir : "public";
|
|
13862
|
-
return
|
|
13886
|
+
return path41.resolve(rootDir, rel2);
|
|
13863
13887
|
};
|
|
13864
|
-
var getAppClientEntryPath = () =>
|
|
13865
|
-
var getAppServerEntryPath = () =>
|
|
13888
|
+
var getAppClientEntryPath = () => path41.posix.join(getZudokuRootDir(), "src/app/entry.client.tsx");
|
|
13889
|
+
var getAppServerEntryPath = () => path41.posix.join(getZudokuRootDir(), "src/app/entry.server.tsx");
|
|
13866
13890
|
var hasLoggedCdnInfo = false;
|
|
13867
13891
|
var MEDIA_REGEX = /\.(a?png|jpe?g|gif|bmp|svg|webp|tiff|ico|webm|ogg|mp3|wav|m4a|avif|mp4)/i;
|
|
13868
13892
|
var defineEnvVars = (vars) => Object.fromEntries(
|
|
@@ -13890,9 +13914,10 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13890
13914
|
value
|
|
13891
13915
|
])
|
|
13892
13916
|
);
|
|
13917
|
+
const ignoreState = stateIgnore(dir);
|
|
13893
13918
|
if (ZuploEnv.isZuplo) {
|
|
13894
13919
|
dotenv.config({
|
|
13895
|
-
path:
|
|
13920
|
+
path: path41.resolve(config2.__meta.rootDir, "../.env.zuplo"),
|
|
13896
13921
|
quiet: true
|
|
13897
13922
|
});
|
|
13898
13923
|
}
|
|
@@ -13938,7 +13963,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13938
13963
|
middlewareMode: true,
|
|
13939
13964
|
open: true,
|
|
13940
13965
|
fs: {
|
|
13941
|
-
allow: [dir,
|
|
13966
|
+
allow: [dir, path41.dirname(dir)]
|
|
13942
13967
|
},
|
|
13943
13968
|
watch: {
|
|
13944
13969
|
ignored: [
|
|
@@ -13946,7 +13971,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13946
13971
|
`${dir}/lib`,
|
|
13947
13972
|
`${dir}/.git`,
|
|
13948
13973
|
`${config2.__meta.moduleDir}/src/vite`,
|
|
13949
|
-
`${config2.__meta.moduleDir}/src/cli
|
|
13974
|
+
`${config2.__meta.moduleDir}/src/cli`,
|
|
13975
|
+
...ignoreState ? [ignoreState] : []
|
|
13950
13976
|
]
|
|
13951
13977
|
}
|
|
13952
13978
|
},
|
|
@@ -13954,8 +13980,8 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13954
13980
|
ssr: configEnv.isSsrBuild,
|
|
13955
13981
|
sourcemap: true,
|
|
13956
13982
|
target: "es2022",
|
|
13957
|
-
outDir:
|
|
13958
|
-
|
|
13983
|
+
outDir: path41.resolve(
|
|
13984
|
+
path41.join(
|
|
13959
13985
|
dir,
|
|
13960
13986
|
"dist",
|
|
13961
13987
|
config2.basePath ?? "",
|
|
@@ -13974,7 +14000,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13974
14000
|
},
|
|
13975
14001
|
experimental: {
|
|
13976
14002
|
renderBuiltUrl(filename) {
|
|
13977
|
-
if (cdnUrl?.base && [".js", ".css"].includes(
|
|
14003
|
+
if (cdnUrl?.base && [".js", ".css"].includes(path41.extname(filename))) {
|
|
13978
14004
|
return joinUrl(cdnUrl.base, filename);
|
|
13979
14005
|
}
|
|
13980
14006
|
if (cdnUrl?.media && MEDIA_REGEX.test(filename)) {
|
|
@@ -13987,7 +14013,7 @@ async function getViteConfig(dir, configEnv) {
|
|
|
13987
14013
|
esbuildOptions: {
|
|
13988
14014
|
target: "es2022"
|
|
13989
14015
|
},
|
|
13990
|
-
entries: [
|
|
14016
|
+
entries: [path41.posix.join(getZudokuRootDir(), "src/{app,lib}/**")],
|
|
13991
14017
|
exclude: [
|
|
13992
14018
|
"@lukoweb/apitogo",
|
|
13993
14019
|
"@lukoweb/apitogo-plugin-dev-portal-billing"
|
|
@@ -14091,7 +14117,7 @@ init_package_json();
|
|
|
14091
14117
|
init_joinUrl();
|
|
14092
14118
|
import assert from "node:assert";
|
|
14093
14119
|
import { cp, mkdir as mkdir9, writeFile as writeFile10 } from "node:fs/promises";
|
|
14094
|
-
import
|
|
14120
|
+
import path42 from "node:path";
|
|
14095
14121
|
var pkgJson = getZudokuPackageJson();
|
|
14096
14122
|
function generateOutput({
|
|
14097
14123
|
config: config2,
|
|
@@ -14148,9 +14174,9 @@ async function writeOutput(dir, {
|
|
|
14148
14174
|
rewrites
|
|
14149
14175
|
}) {
|
|
14150
14176
|
const output4 = generateOutput({ config: config2, redirects, rewrites });
|
|
14151
|
-
const outputDir = process.env.VERCEL ?
|
|
14177
|
+
const outputDir = process.env.VERCEL ? path42.join(dir, ".vercel/output") : path42.join(dir, "dist/.output");
|
|
14152
14178
|
await mkdir9(outputDir, { recursive: true });
|
|
14153
|
-
const outputFile =
|
|
14179
|
+
const outputFile = path42.join(outputDir, "config.json");
|
|
14154
14180
|
await writeFile10(outputFile, JSON.stringify(output4, null, 2), "utf-8");
|
|
14155
14181
|
if (process.env.VERCEL) {
|
|
14156
14182
|
console.log("Wrote Vercel output to", outputDir);
|
|
@@ -14162,7 +14188,7 @@ init_logger();
|
|
|
14162
14188
|
init_file_exists();
|
|
14163
14189
|
import { readFile as readFile9, rm as rm6 } from "node:fs/promises";
|
|
14164
14190
|
import os from "node:os";
|
|
14165
|
-
import
|
|
14191
|
+
import path45 from "node:path";
|
|
14166
14192
|
import { pathToFileURL } from "node:url";
|
|
14167
14193
|
import { createIndex } from "pagefind";
|
|
14168
14194
|
import colors11 from "picocolors";
|
|
@@ -14204,7 +14230,7 @@ function throttle(fn) {
|
|
|
14204
14230
|
init_joinUrl();
|
|
14205
14231
|
import { createWriteStream, existsSync as existsSync4 } from "node:fs";
|
|
14206
14232
|
import { mkdir as mkdir10 } from "node:fs/promises";
|
|
14207
|
-
import
|
|
14233
|
+
import path43 from "node:path";
|
|
14208
14234
|
import colors9 from "picocolors";
|
|
14209
14235
|
import { SitemapStream } from "sitemap";
|
|
14210
14236
|
async function generateSitemap({
|
|
@@ -14218,11 +14244,11 @@ async function generateSitemap({
|
|
|
14218
14244
|
return;
|
|
14219
14245
|
}
|
|
14220
14246
|
const sitemap = new SitemapStream({ hostname: config2.siteUrl });
|
|
14221
|
-
const outputDir =
|
|
14247
|
+
const outputDir = path43.resolve(baseOutputDir, config2.outDir ?? "");
|
|
14222
14248
|
if (!existsSync4(outputDir)) {
|
|
14223
14249
|
await mkdir10(outputDir, { recursive: true });
|
|
14224
14250
|
}
|
|
14225
|
-
const sitemapOutputPath =
|
|
14251
|
+
const sitemapOutputPath = path43.join(outputDir, "sitemap.xml");
|
|
14226
14252
|
const writeStream = createWriteStream(sitemapOutputPath);
|
|
14227
14253
|
sitemap.pipe(writeStream);
|
|
14228
14254
|
let lastmod;
|
|
@@ -14252,14 +14278,14 @@ async function generateSitemap({
|
|
|
14252
14278
|
|
|
14253
14279
|
// src/vite/prerender/utils.ts
|
|
14254
14280
|
init_joinUrl();
|
|
14255
|
-
var resolveRoutePath = (
|
|
14256
|
-
const segments =
|
|
14281
|
+
var resolveRoutePath = (path103) => {
|
|
14282
|
+
const segments = path103.split("/");
|
|
14257
14283
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
14258
14284
|
return void 0;
|
|
14259
14285
|
}
|
|
14260
14286
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
14261
14287
|
};
|
|
14262
|
-
var isSkipped = (
|
|
14288
|
+
var isSkipped = (path103) => path103.includes("*") || /^\d+$/.test(path103);
|
|
14263
14289
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
14264
14290
|
if (route.path && isSkipped(route.path)) return [];
|
|
14265
14291
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -14308,12 +14334,12 @@ var prerender = async ({
|
|
|
14308
14334
|
serverConfigFilename,
|
|
14309
14335
|
writeRedirects = true
|
|
14310
14336
|
}) => {
|
|
14311
|
-
const distDir =
|
|
14337
|
+
const distDir = path45.join(dir, "dist", basePath);
|
|
14312
14338
|
const serverConfigPath = pathToFileURL(
|
|
14313
|
-
|
|
14339
|
+
path45.join(distDir, "server", serverConfigFilename)
|
|
14314
14340
|
).href;
|
|
14315
14341
|
const entryServerPath = pathToFileURL(
|
|
14316
|
-
|
|
14342
|
+
path45.join(distDir, "server/entry.server.js")
|
|
14317
14343
|
).href;
|
|
14318
14344
|
const rawConfig = await import(serverConfigPath).then(
|
|
14319
14345
|
(m) => m.default
|
|
@@ -14398,7 +14424,7 @@ var prerender = async ({
|
|
|
14398
14424
|
})
|
|
14399
14425
|
);
|
|
14400
14426
|
const pagefindWriteResult = await pagefindIndex?.writeFiles({
|
|
14401
|
-
outputPath:
|
|
14427
|
+
outputPath: path45.join(distDir, "pagefind")
|
|
14402
14428
|
});
|
|
14403
14429
|
const seconds = ((performance.now() - start) / 1e3).toFixed(1);
|
|
14404
14430
|
const message = `\u2713 finished prerendering ${paths.length} routes in ${seconds} seconds using ${maxThreads} workers`;
|
|
@@ -14430,7 +14456,7 @@ var prerender = async ({
|
|
|
14430
14456
|
const { generateLlmsTxtFiles: generateLlmsTxtFiles2 } = await Promise.resolve().then(() => (init_llms(), llms_exports));
|
|
14431
14457
|
const docsConfig = DocsConfigSchema2.parse(config2.docs);
|
|
14432
14458
|
const llmsConfig = docsConfig.llms ?? {};
|
|
14433
|
-
const markdownInfoPath =
|
|
14459
|
+
const markdownInfoPath = path45.join(
|
|
14434
14460
|
dir,
|
|
14435
14461
|
"node_modules/.apitogo/markdown-info.json"
|
|
14436
14462
|
);
|
|
@@ -14521,7 +14547,7 @@ async function runBuild(options) {
|
|
|
14521
14547
|
html,
|
|
14522
14548
|
basePath: config2.basePath
|
|
14523
14549
|
});
|
|
14524
|
-
await rm7(
|
|
14550
|
+
await rm7(path46.join(clientOutDir, "index.html"), { force: true });
|
|
14525
14551
|
} else {
|
|
14526
14552
|
await runPrerender({
|
|
14527
14553
|
dir,
|
|
@@ -14545,7 +14571,7 @@ var runPrerender = async (options) => {
|
|
|
14545
14571
|
serverConfigFilename,
|
|
14546
14572
|
writeRedirects: process.env.VERCEL === void 0
|
|
14547
14573
|
});
|
|
14548
|
-
const indexHtml =
|
|
14574
|
+
const indexHtml = path46.join(clientOutDir, "index.html");
|
|
14549
14575
|
if (!workerResults.find((r) => r.outputPath === indexHtml)) {
|
|
14550
14576
|
await writeFile12(indexHtml, html, "utf-8");
|
|
14551
14577
|
}
|
|
@@ -14555,15 +14581,15 @@ var runPrerender = async (options) => {
|
|
|
14555
14581
|
for (const statusPage of statusPages) {
|
|
14556
14582
|
await rename5(
|
|
14557
14583
|
statusPage,
|
|
14558
|
-
|
|
14584
|
+
path46.join(dir, DIST_DIR, path46.basename(statusPage))
|
|
14559
14585
|
);
|
|
14560
14586
|
}
|
|
14561
14587
|
await rm7(serverOutDir, { recursive: true, force: true });
|
|
14562
14588
|
if (process.env.VERCEL) {
|
|
14563
|
-
await mkdir11(
|
|
14589
|
+
await mkdir11(path46.join(dir, ".vercel/output/static"), { recursive: true });
|
|
14564
14590
|
await rename5(
|
|
14565
|
-
|
|
14566
|
-
|
|
14591
|
+
path46.join(dir, DIST_DIR),
|
|
14592
|
+
path46.join(dir, ".vercel/output/static")
|
|
14567
14593
|
);
|
|
14568
14594
|
}
|
|
14569
14595
|
await writeOutput(dir, {
|
|
@@ -14573,7 +14599,7 @@ var runPrerender = async (options) => {
|
|
|
14573
14599
|
});
|
|
14574
14600
|
if (ZuploEnv.isZuplo && issuer) {
|
|
14575
14601
|
await writeFile12(
|
|
14576
|
-
|
|
14602
|
+
path46.join(dir, DIST_DIR, ".output/zuplo.json"),
|
|
14577
14603
|
JSON.stringify({ issuer }, null, 2),
|
|
14578
14604
|
"utf-8"
|
|
14579
14605
|
);
|
|
@@ -14585,10 +14611,10 @@ var runPrerender = async (options) => {
|
|
|
14585
14611
|
};
|
|
14586
14612
|
var bundleSSREntry = async (options) => {
|
|
14587
14613
|
const { dir, adapter, serverOutDir, serverConfigFilename, html, basePath } = options;
|
|
14588
|
-
const tempEntryPath =
|
|
14614
|
+
const tempEntryPath = path46.join(dir, "__ssr-entry.ts");
|
|
14589
14615
|
const packageRoot = getZudokuRootDir();
|
|
14590
14616
|
const templateContent = await readFile10(
|
|
14591
|
-
|
|
14617
|
+
path46.join(packageRoot, "src/vite/ssr-templates", `${adapter}.ts`),
|
|
14592
14618
|
"utf-8"
|
|
14593
14619
|
);
|
|
14594
14620
|
const entryContent = templateContent.replace('"__TEMPLATE__"', JSON.stringify(html)).replace('"__CONFIG_FILE__"', JSON.stringify(`./${serverConfigFilename}`)).replace(
|
|
@@ -14603,9 +14629,9 @@ var bundleSSREntry = async (options) => {
|
|
|
14603
14629
|
platform: adapter === "node" ? "node" : "neutral",
|
|
14604
14630
|
target: "es2022",
|
|
14605
14631
|
format: "esm",
|
|
14606
|
-
outfile:
|
|
14632
|
+
outfile: path46.join(serverOutDir, "entry.js"),
|
|
14607
14633
|
external: ["./entry.server.js", `./${serverConfigFilename}`],
|
|
14608
|
-
nodePaths: [
|
|
14634
|
+
nodePaths: [path46.join(packageRoot, "node_modules")],
|
|
14609
14635
|
banner: { js: "// Bundled SSR entry" }
|
|
14610
14636
|
});
|
|
14611
14637
|
} finally {
|
|
@@ -14619,7 +14645,7 @@ init_package_json();
|
|
|
14619
14645
|
// src/cli/init/v2-packages.ts
|
|
14620
14646
|
import { existsSync as existsSync5 } from "node:fs";
|
|
14621
14647
|
import { readFile as readFile11, writeFile as writeFile13 } from "node:fs/promises";
|
|
14622
|
-
import
|
|
14648
|
+
import path47 from "node:path";
|
|
14623
14649
|
var CORE_PACKAGES = [
|
|
14624
14650
|
"@lukoweb/apitogo",
|
|
14625
14651
|
"react",
|
|
@@ -14636,7 +14662,7 @@ function packageNameFrom(name) {
|
|
|
14636
14662
|
return slug || "portal";
|
|
14637
14663
|
}
|
|
14638
14664
|
async function ensurePackageJson(dir, name) {
|
|
14639
|
-
const file =
|
|
14665
|
+
const file = path47.join(dir, "package.json");
|
|
14640
14666
|
if (existsSync5(file)) return false;
|
|
14641
14667
|
await writeFile13(
|
|
14642
14668
|
file,
|
|
@@ -14655,11 +14681,11 @@ async function ensurePackageJson(dir, name) {
|
|
|
14655
14681
|
return true;
|
|
14656
14682
|
}
|
|
14657
14683
|
function isPackageInstalled(startDir, name) {
|
|
14658
|
-
let dir =
|
|
14684
|
+
let dir = path47.resolve(startDir);
|
|
14659
14685
|
for (; ; ) {
|
|
14660
|
-
if (existsSync5(
|
|
14686
|
+
if (existsSync5(path47.join(dir, "node_modules", name, "package.json")))
|
|
14661
14687
|
return true;
|
|
14662
|
-
const parent =
|
|
14688
|
+
const parent = path47.dirname(dir);
|
|
14663
14689
|
if (parent === dir) return false;
|
|
14664
14690
|
dir = parent;
|
|
14665
14691
|
}
|
|
@@ -14668,7 +14694,7 @@ var missingCorePackages = (dir) => CORE_PACKAGES.filter((name) => !isPackageInst
|
|
|
14668
14694
|
|
|
14669
14695
|
// src/cli/portal/v2.ts
|
|
14670
14696
|
function assertPackagesInstalled(resolved, prepared) {
|
|
14671
|
-
const require2 = createRequire2(
|
|
14697
|
+
const require2 = createRequire2(path48.join(resolved.configDir, "package.json"));
|
|
14672
14698
|
const missing = requiredPackages(prepared.plan).filter((name) => {
|
|
14673
14699
|
try {
|
|
14674
14700
|
require2.resolve(name);
|
|
@@ -14721,7 +14747,7 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
|
|
|
14721
14747
|
return {
|
|
14722
14748
|
name: "build",
|
|
14723
14749
|
hash: () => hash2,
|
|
14724
|
-
stillValid: () => access4(
|
|
14750
|
+
stillValid: () => access4(path48.join(buildDir, "index.html")).then(
|
|
14725
14751
|
() => true,
|
|
14726
14752
|
() => false
|
|
14727
14753
|
),
|
|
@@ -14734,11 +14760,11 @@ function portalBuildStep(context, options = {}, build2 = runBuild) {
|
|
|
14734
14760
|
process.chdir(originalCwd);
|
|
14735
14761
|
}
|
|
14736
14762
|
await rm8(buildDir, { recursive: true, force: true });
|
|
14737
|
-
await mkdir12(
|
|
14738
|
-
await rename6(
|
|
14763
|
+
await mkdir12(path48.dirname(buildDir), { recursive: true });
|
|
14764
|
+
await rename6(path48.join(root, "dist"), buildDir);
|
|
14739
14765
|
if (prepared.publishedManifest) {
|
|
14740
14766
|
await writeFile14(
|
|
14741
|
-
|
|
14767
|
+
path48.join(buildDir, MANIFEST_FILE),
|
|
14742
14768
|
`${JSON.stringify(prepared.publishedManifest, null, 2)}
|
|
14743
14769
|
`
|
|
14744
14770
|
);
|
|
@@ -14769,15 +14795,15 @@ async function buildV2(options) {
|
|
|
14769
14795
|
// src/cli/check/gateway-online.ts
|
|
14770
14796
|
import { readFile as readFile13 } from "node:fs/promises";
|
|
14771
14797
|
var SPEC_SEND_LIMIT = 5 * 1024 * 1024 + 64 * 1024;
|
|
14772
|
-
var issue2 = (code,
|
|
14798
|
+
var issue2 = (code, path103, message, hint) => ({ code, path: path103, message, hint });
|
|
14773
14799
|
function capabilityIssues(gateway, answer) {
|
|
14774
14800
|
const can = answer.capabilities;
|
|
14775
14801
|
const plan2 = `your ${answer.tier} plan`;
|
|
14776
14802
|
const found = [];
|
|
14777
|
-
const unsupported = (
|
|
14803
|
+
const unsupported = (path103, what, hint) => found.push(
|
|
14778
14804
|
issue2(
|
|
14779
14805
|
"GATEWAY_CAPABILITY_UNSUPPORTED",
|
|
14780
|
-
|
|
14806
|
+
path103,
|
|
14781
14807
|
`${what} is not available on ${plan2}.`,
|
|
14782
14808
|
hint
|
|
14783
14809
|
)
|
|
@@ -14853,7 +14879,7 @@ async function onlineGatewayRules(gateway, projectId, api, derivedCors = []) {
|
|
|
14853
14879
|
async function isConfigV2(dir) {
|
|
14854
14880
|
try {
|
|
14855
14881
|
return /"version"\s*:\s*2\b/.test(
|
|
14856
|
-
await readFile14(
|
|
14882
|
+
await readFile14(path49.join(dir, APITOGO_CONFIG_FILENAME), "utf8")
|
|
14857
14883
|
);
|
|
14858
14884
|
} catch {
|
|
14859
14885
|
return false;
|
|
@@ -14947,7 +14973,7 @@ async function validatePortalBuild(dir) {
|
|
|
14947
14973
|
}
|
|
14948
14974
|
}
|
|
14949
14975
|
async function runCheckV2(dir, args = {}, deps = {}) {
|
|
14950
|
-
const configPath =
|
|
14976
|
+
const configPath = path49.join(dir, APITOGO_CONFIG_FILENAME);
|
|
14951
14977
|
let report;
|
|
14952
14978
|
let layout;
|
|
14953
14979
|
try {
|
|
@@ -15036,14 +15062,14 @@ async function checkV2(dir, args, deps = platformDependencies(args)) {
|
|
|
15036
15062
|
init_package_json();
|
|
15037
15063
|
|
|
15038
15064
|
// src/cli/init/v2-handler.ts
|
|
15039
|
-
import
|
|
15065
|
+
import path51 from "node:path";
|
|
15040
15066
|
import { createInterface } from "node:readline/promises";
|
|
15041
15067
|
init_package_json();
|
|
15042
15068
|
|
|
15043
15069
|
// src/cli/platform/helpers/npm-build.ts
|
|
15044
15070
|
import { spawn } from "node:child_process";
|
|
15045
15071
|
import { access as access5, readFile as readFile15 } from "node:fs/promises";
|
|
15046
|
-
import
|
|
15072
|
+
import path50 from "node:path";
|
|
15047
15073
|
var BUILD_LOG_TAIL_BYTES = 8192;
|
|
15048
15074
|
var MIN_NODE_MAJOR = 20;
|
|
15049
15075
|
var NpmBuildError = class extends Error {
|
|
@@ -15111,7 +15137,7 @@ function runCommand(command2, args, cwd, env) {
|
|
|
15111
15137
|
async function runNpmCommand(args, cwd) {
|
|
15112
15138
|
assertNodeVersion();
|
|
15113
15139
|
const startedAt = Date.now();
|
|
15114
|
-
const result = await runCommand("npm", args,
|
|
15140
|
+
const result = await runCommand("npm", args, path50.resolve(cwd));
|
|
15115
15141
|
if (result.exitCode !== 0) {
|
|
15116
15142
|
throw new NpmBuildError(
|
|
15117
15143
|
`npm ${args.join(" ")} exited ${result.exitCode ?? "unknown"}`,
|
|
@@ -15126,13 +15152,13 @@ async function runNpmCommand(args, cwd) {
|
|
|
15126
15152
|
}
|
|
15127
15153
|
async function runNpmInstall(sourceDirectory, options) {
|
|
15128
15154
|
assertNodeVersion(options?.nodeVersion);
|
|
15129
|
-
const cwd =
|
|
15130
|
-
const packageJsonPath =
|
|
15155
|
+
const cwd = path50.resolve(sourceDirectory);
|
|
15156
|
+
const packageJsonPath = path50.join(cwd, "package.json");
|
|
15131
15157
|
if (!await pathExists(packageJsonPath)) {
|
|
15132
15158
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
15133
15159
|
}
|
|
15134
15160
|
const startedAt = Date.now();
|
|
15135
|
-
const lockPath =
|
|
15161
|
+
const lockPath = path50.join(cwd, "package-lock.json");
|
|
15136
15162
|
const installArgs = await pathExists(lockPath) ? ["ci"] : ["install"];
|
|
15137
15163
|
const install = await runCommand("npm", installArgs, cwd);
|
|
15138
15164
|
const installLog = install.output;
|
|
@@ -15150,8 +15176,8 @@ async function runNpmInstall(sourceDirectory, options) {
|
|
|
15150
15176
|
}
|
|
15151
15177
|
async function runNpmBuild(sourceDirectory, options) {
|
|
15152
15178
|
assertNodeVersion(options?.nodeVersion);
|
|
15153
|
-
const cwd =
|
|
15154
|
-
const packageJsonPath =
|
|
15179
|
+
const cwd = path50.resolve(sourceDirectory);
|
|
15180
|
+
const packageJsonPath = path50.join(cwd, "package.json");
|
|
15155
15181
|
if (!await pathExists(packageJsonPath)) {
|
|
15156
15182
|
throw new Error(`package.json not found in sourceDirectory: ${cwd}`);
|
|
15157
15183
|
}
|
|
@@ -15168,8 +15194,8 @@ async function runNpmBuild(sourceDirectory, options) {
|
|
|
15168
15194
|
build2.exitCode
|
|
15169
15195
|
);
|
|
15170
15196
|
}
|
|
15171
|
-
const distPath =
|
|
15172
|
-
const indexPath =
|
|
15197
|
+
const distPath = path50.join(cwd, "dist");
|
|
15198
|
+
const indexPath = path50.join(distPath, "index.html");
|
|
15173
15199
|
if (!await pathExists(indexPath)) {
|
|
15174
15200
|
throw new NpmBuildError(
|
|
15175
15201
|
`Build completed but dist/index.html was not found at ${indexPath}`,
|
|
@@ -15236,9 +15262,9 @@ function describePlan(plan2) {
|
|
|
15236
15262
|
layoutReason: plan2.layoutReason,
|
|
15237
15263
|
docsIncluded: plan2.docsIncluded,
|
|
15238
15264
|
willCreate: plan2.entries.map(
|
|
15239
|
-
(entry) =>
|
|
15265
|
+
(entry) => path51.relative(plan2.dir, entry.path)
|
|
15240
15266
|
),
|
|
15241
|
-
willKeep: plan2.keep.map((target) =>
|
|
15267
|
+
willKeep: plan2.keep.map((target) => path51.relative(plan2.dir, target)),
|
|
15242
15268
|
replacesConfig: plan2.replacesConfig
|
|
15243
15269
|
};
|
|
15244
15270
|
}
|
|
@@ -15263,7 +15289,7 @@ async function initV2(argv) {
|
|
|
15263
15289
|
const json = argv.json === true;
|
|
15264
15290
|
try {
|
|
15265
15291
|
parseOnlyFlag(argv.only);
|
|
15266
|
-
const dir =
|
|
15292
|
+
const dir = path51.resolve(process.cwd(), argv.dir ?? ".");
|
|
15267
15293
|
const options = {
|
|
15268
15294
|
dir,
|
|
15269
15295
|
layout: argv.layout,
|
|
@@ -15316,7 +15342,7 @@ async function initV2(argv) {
|
|
|
15316
15342
|
const packages = await setUpPackages({
|
|
15317
15343
|
dir,
|
|
15318
15344
|
layout: plan2.layout,
|
|
15319
|
-
name: argv.name ??
|
|
15345
|
+
name: argv.name ?? path51.basename(dir),
|
|
15320
15346
|
install: argv.install === true,
|
|
15321
15347
|
quiet: json
|
|
15322
15348
|
});
|
|
@@ -15327,8 +15353,8 @@ async function initV2(argv) {
|
|
|
15327
15353
|
status: "created",
|
|
15328
15354
|
dir,
|
|
15329
15355
|
...describePlan(plan2),
|
|
15330
|
-
created: result.created.map((p) =>
|
|
15331
|
-
kept: result.kept.map((p) =>
|
|
15356
|
+
created: result.created.map((p) => path51.relative(dir, p)),
|
|
15357
|
+
kept: result.kept.map((p) => path51.relative(dir, p)),
|
|
15332
15358
|
packages
|
|
15333
15359
|
},
|
|
15334
15360
|
null,
|
|
@@ -15338,7 +15364,7 @@ async function initV2(argv) {
|
|
|
15338
15364
|
return;
|
|
15339
15365
|
}
|
|
15340
15366
|
printResultToConsole(
|
|
15341
|
-
`Created ${
|
|
15367
|
+
`Created ${path51.basename(plan2.configPath)} (config version 2, ${plan2.layout} layout) in ${dir}.`
|
|
15342
15368
|
);
|
|
15343
15369
|
if (packages.installed)
|
|
15344
15370
|
printResultToConsole(
|
|
@@ -15374,7 +15400,7 @@ async function initV2(argv) {
|
|
|
15374
15400
|
// src/cli/services/packages.ts
|
|
15375
15401
|
import { spawn as spawn2 } from "node:child_process";
|
|
15376
15402
|
import { existsSync as existsSync6 } from "node:fs";
|
|
15377
|
-
import
|
|
15403
|
+
import path52 from "node:path";
|
|
15378
15404
|
var USER_PANEL_PACKAGE = "@lukoweb/apitogo-module-user-panel";
|
|
15379
15405
|
var BILLING_PLUGIN_PACKAGE = "@lukoweb/apitogo-plugin-dev-portal-billing";
|
|
15380
15406
|
function packagesForConfig(config2) {
|
|
@@ -15389,18 +15415,18 @@ function packagesForConfig(config2) {
|
|
|
15389
15415
|
];
|
|
15390
15416
|
}
|
|
15391
15417
|
function isInstalled(dir, name) {
|
|
15392
|
-
for (let current =
|
|
15393
|
-
if (existsSync6(
|
|
15418
|
+
for (let current = path52.resolve(dir); ; current = path52.dirname(current)) {
|
|
15419
|
+
if (existsSync6(path52.join(current, "node_modules", name, "package.json")))
|
|
15394
15420
|
return true;
|
|
15395
|
-
if (
|
|
15421
|
+
if (path52.dirname(current) === current) return false;
|
|
15396
15422
|
}
|
|
15397
15423
|
}
|
|
15398
15424
|
function missingPackages(dir, names) {
|
|
15399
15425
|
return names.filter((name) => !isInstalled(dir, name));
|
|
15400
15426
|
}
|
|
15401
15427
|
function detectPackageManager(dir) {
|
|
15402
|
-
if (existsSync6(
|
|
15403
|
-
if (existsSync6(
|
|
15428
|
+
if (existsSync6(path52.join(dir, "pnpm-lock.yaml"))) return "pnpm";
|
|
15429
|
+
if (existsSync6(path52.join(dir, "yarn.lock"))) return "yarn";
|
|
15404
15430
|
return "npm";
|
|
15405
15431
|
}
|
|
15406
15432
|
function installCommand2(manager, names, version) {
|
|
@@ -15435,7 +15461,7 @@ async function installMissingPackages(dir, config2, version, options) {
|
|
|
15435
15461
|
reason: "--no-install was given",
|
|
15436
15462
|
command: shown
|
|
15437
15463
|
};
|
|
15438
|
-
if (!existsSync6(
|
|
15464
|
+
if (!existsSync6(path52.join(dir, "package.json")))
|
|
15439
15465
|
return {
|
|
15440
15466
|
status: "skipped",
|
|
15441
15467
|
packages: missing,
|
|
@@ -15454,7 +15480,7 @@ var list = (value) => {
|
|
|
15454
15480
|
return items.length > 0 ? items : void 0;
|
|
15455
15481
|
};
|
|
15456
15482
|
function addOptionsFromArguments(service, argv) {
|
|
15457
|
-
const dir =
|
|
15483
|
+
const dir = path53.resolve(process.cwd(), argv.dir ?? ".");
|
|
15458
15484
|
const issuers = list(argv.issuer);
|
|
15459
15485
|
return {
|
|
15460
15486
|
dir,
|
|
@@ -15513,8 +15539,8 @@ function describe(edit, dir) {
|
|
|
15513
15539
|
return {
|
|
15514
15540
|
service: edit.service,
|
|
15515
15541
|
action: edit.action,
|
|
15516
|
-
willCreate: edit.files.map((file) =>
|
|
15517
|
-
keep: edit.keep.map((file) =>
|
|
15542
|
+
willCreate: edit.files.map((file) => path53.relative(dir, file.path)),
|
|
15543
|
+
keep: edit.keep.map((file) => path53.relative(dir, file)),
|
|
15518
15544
|
notes: edit.notes
|
|
15519
15545
|
};
|
|
15520
15546
|
}
|
|
@@ -15527,11 +15553,11 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15527
15553
|
`Choose one of ${SERVICES.join(", ")}.`
|
|
15528
15554
|
);
|
|
15529
15555
|
}
|
|
15530
|
-
const dir =
|
|
15556
|
+
const dir = path53.resolve(process.cwd(), argv.dir ?? ".");
|
|
15531
15557
|
if (!await isConfigV2(dir)) {
|
|
15532
15558
|
throw new ServiceEditError(
|
|
15533
15559
|
`${action} works with a config version 2 project, and there is none in ${dir}.`,
|
|
15534
|
-
"Create one with `apitogo init
|
|
15560
|
+
"Create one with `apitogo init`."
|
|
15535
15561
|
);
|
|
15536
15562
|
}
|
|
15537
15563
|
const edit = await plan2(argv.service);
|
|
@@ -15574,7 +15600,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15574
15600
|
{
|
|
15575
15601
|
status: action === "add" ? "added" : "removed",
|
|
15576
15602
|
...describe(edit, dir),
|
|
15577
|
-
created: created.map((file) =>
|
|
15603
|
+
created: created.map((file) => path53.relative(dir, file)),
|
|
15578
15604
|
...install ? { packages: install } : {}
|
|
15579
15605
|
},
|
|
15580
15606
|
null,
|
|
@@ -15584,7 +15610,7 @@ async function run(action, argv, plan2, deps = {}) {
|
|
|
15584
15610
|
return;
|
|
15585
15611
|
}
|
|
15586
15612
|
printResultToConsole(
|
|
15587
|
-
`${action === "add" ? "Added" : "Removed"} ${edit.service} in ${
|
|
15613
|
+
`${action === "add" ? "Added" : "Removed"} ${edit.service} in ${path53.basename(edit.configPath)}.`
|
|
15588
15614
|
);
|
|
15589
15615
|
} catch (error) {
|
|
15590
15616
|
const message = error instanceof Error ? error.message : String(error);
|
|
@@ -15642,7 +15668,7 @@ var removeService = (argv) => run(
|
|
|
15642
15668
|
"remove",
|
|
15643
15669
|
argv,
|
|
15644
15670
|
(service) => planRemoveService(service, {
|
|
15645
|
-
dir:
|
|
15671
|
+
dir: path53.resolve(process.cwd(), argv.dir ?? ".")
|
|
15646
15672
|
})
|
|
15647
15673
|
);
|
|
15648
15674
|
|
|
@@ -15790,16 +15816,16 @@ var add_default = {
|
|
|
15790
15816
|
};
|
|
15791
15817
|
|
|
15792
15818
|
// src/cli/build/handler.ts
|
|
15793
|
-
import
|
|
15819
|
+
import path55 from "node:path";
|
|
15794
15820
|
init_logger();
|
|
15795
15821
|
init_package_json();
|
|
15796
15822
|
|
|
15797
15823
|
// src/cli/preview/handler.ts
|
|
15798
|
-
import
|
|
15824
|
+
import path54 from "node:path";
|
|
15799
15825
|
import { preview as vitePreview } from "vite";
|
|
15800
15826
|
var DEFAULT_PREVIEW_PORT = 4e3;
|
|
15801
15827
|
async function preview(argv) {
|
|
15802
|
-
const dir =
|
|
15828
|
+
const dir = path54.resolve(process.cwd(), argv.dir);
|
|
15803
15829
|
const viteConfig = await getViteConfig(dir, {
|
|
15804
15830
|
command: "serve",
|
|
15805
15831
|
mode: "production",
|
|
@@ -15842,7 +15868,7 @@ async function build(argv) {
|
|
|
15842
15868
|
printDiagnosticsToConsole("");
|
|
15843
15869
|
printDiagnosticsToConsole("");
|
|
15844
15870
|
}
|
|
15845
|
-
const dir =
|
|
15871
|
+
const dir = path55.resolve(process.cwd(), argv.dir);
|
|
15846
15872
|
try {
|
|
15847
15873
|
if (await isConfigV2(dir)) {
|
|
15848
15874
|
const result = await buildV2({ dir, jsonOnly });
|
|
@@ -15907,10 +15933,10 @@ var build_default = {
|
|
|
15907
15933
|
};
|
|
15908
15934
|
|
|
15909
15935
|
// src/cli/check/handler.ts
|
|
15910
|
-
import
|
|
15936
|
+
import path61 from "node:path";
|
|
15911
15937
|
|
|
15912
15938
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
15913
|
-
import
|
|
15939
|
+
import path60 from "node:path";
|
|
15914
15940
|
|
|
15915
15941
|
// src/cli/platform/helpers/dev-portal-backend.ts
|
|
15916
15942
|
function deriveProvisioningState(backend) {
|
|
@@ -15995,10 +16021,10 @@ function formatDevPortalBackendResponse(projectId, backend) {
|
|
|
15995
16021
|
init_gateway_limits();
|
|
15996
16022
|
import { existsSync as existsSync7 } from "node:fs";
|
|
15997
16023
|
import { access as access6, mkdir as mkdir13, readFile as readFile16, writeFile as writeFile15 } from "node:fs/promises";
|
|
15998
|
-
import
|
|
16024
|
+
import path57 from "node:path";
|
|
15999
16025
|
|
|
16000
16026
|
// src/cli/make-config/json-config.ts
|
|
16001
|
-
import
|
|
16027
|
+
import path56 from "node:path";
|
|
16002
16028
|
|
|
16003
16029
|
// src/cli/make-config/branding-assets.ts
|
|
16004
16030
|
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 +16494,9 @@ function openapiInputForConfig(specRelativePosix) {
|
|
|
16468
16494
|
return `./${specRelativePosix}`;
|
|
16469
16495
|
}
|
|
16470
16496
|
function toRelativeOpenApiInput(projectDir, inputPath) {
|
|
16471
|
-
const resolved =
|
|
16472
|
-
const relative =
|
|
16473
|
-
const posix = relative.split(
|
|
16497
|
+
const resolved = path56.isAbsolute(inputPath) ? inputPath : path56.resolve(projectDir, inputPath);
|
|
16498
|
+
const relative = path56.relative(projectDir, resolved);
|
|
16499
|
+
const posix = relative.split(path56.sep).join(path56.posix.sep);
|
|
16474
16500
|
if (!posix) {
|
|
16475
16501
|
throw new Error("OpenAPI path must point to a file.");
|
|
16476
16502
|
}
|
|
@@ -16750,7 +16776,7 @@ function isPlanFree(plan2) {
|
|
|
16750
16776
|
return (plan2.priceAmount ?? 0) <= 0;
|
|
16751
16777
|
}
|
|
16752
16778
|
function manifestFilePath(siteDirectory) {
|
|
16753
|
-
return
|
|
16779
|
+
return path57.join(path57.resolve(siteDirectory), APITOGO_CONFIG_FILENAME2);
|
|
16754
16780
|
}
|
|
16755
16781
|
var STORED_MANIFEST_KEYS = [
|
|
16756
16782
|
"authentication",
|
|
@@ -17223,23 +17249,23 @@ function resolveBackendSourceDirectory(siteDirectory, sourceDirectory) {
|
|
|
17223
17249
|
if (!trimmed) {
|
|
17224
17250
|
return void 0;
|
|
17225
17251
|
}
|
|
17226
|
-
return
|
|
17252
|
+
return path57.resolve(siteDirectory, trimmed);
|
|
17227
17253
|
}
|
|
17228
17254
|
function resolveBackendOpenApiPath(openApiPath, options) {
|
|
17229
17255
|
const trimmed = openApiPath?.trim();
|
|
17230
17256
|
if (!trimmed) {
|
|
17231
17257
|
return void 0;
|
|
17232
17258
|
}
|
|
17233
|
-
if (
|
|
17259
|
+
if (path57.isAbsolute(trimmed)) {
|
|
17234
17260
|
return trimmed;
|
|
17235
17261
|
}
|
|
17236
|
-
const siteResolved =
|
|
17262
|
+
const siteResolved = path57.resolve(options.siteDirectory, trimmed);
|
|
17237
17263
|
if (existsSync7(siteResolved)) {
|
|
17238
17264
|
return siteResolved;
|
|
17239
17265
|
}
|
|
17240
17266
|
const backendDir = options.backendSourceDirectory?.trim();
|
|
17241
17267
|
if (backendDir) {
|
|
17242
|
-
const backendResolved =
|
|
17268
|
+
const backendResolved = path57.resolve(backendDir, trimmed);
|
|
17243
17269
|
if (existsSync7(backendResolved)) {
|
|
17244
17270
|
return backendResolved;
|
|
17245
17271
|
}
|
|
@@ -17247,15 +17273,15 @@ function resolveBackendOpenApiPath(openApiPath, options) {
|
|
|
17247
17273
|
return siteResolved;
|
|
17248
17274
|
}
|
|
17249
17275
|
function toSiteRelativeOpenApiInput(siteDirectory, openApiAbsolutePath) {
|
|
17250
|
-
const relative =
|
|
17251
|
-
|
|
17252
|
-
|
|
17276
|
+
const relative = path57.relative(
|
|
17277
|
+
path57.resolve(siteDirectory),
|
|
17278
|
+
path57.resolve(openApiAbsolutePath)
|
|
17253
17279
|
);
|
|
17254
|
-
const posix = relative.split(
|
|
17280
|
+
const posix = relative.split(path57.sep).join("/");
|
|
17255
17281
|
if (!posix || posix === ".") {
|
|
17256
17282
|
return "./";
|
|
17257
17283
|
}
|
|
17258
|
-
if (
|
|
17284
|
+
if (path57.isAbsolute(posix) || posix.startsWith("..")) {
|
|
17259
17285
|
return posix;
|
|
17260
17286
|
}
|
|
17261
17287
|
return posix.startsWith("./") ? posix : `./${posix}`;
|
|
@@ -17302,7 +17328,7 @@ async function readManifest2(siteDirectory) {
|
|
|
17302
17328
|
}
|
|
17303
17329
|
async function writeManifest2(siteDirectory, manifest) {
|
|
17304
17330
|
const filePath = manifestFilePath(siteDirectory);
|
|
17305
|
-
await mkdir13(
|
|
17331
|
+
await mkdir13(path57.dirname(filePath), { recursive: true });
|
|
17306
17332
|
let config2 = {};
|
|
17307
17333
|
if (await pathExists2(filePath)) {
|
|
17308
17334
|
const raw = await readFile16(filePath, "utf8");
|
|
@@ -17328,7 +17354,7 @@ import {
|
|
|
17328
17354
|
unlink,
|
|
17329
17355
|
writeFile as writeFile16
|
|
17330
17356
|
} from "node:fs/promises";
|
|
17331
|
-
import
|
|
17357
|
+
import path58 from "node:path";
|
|
17332
17358
|
var ENV_FILENAME = ".env";
|
|
17333
17359
|
var COLLAPSED_UPPERCASE_ALIASES2 = {
|
|
17334
17360
|
SECRETKEY: "secretKey",
|
|
@@ -17447,12 +17473,12 @@ async function readEnvFile(filePath) {
|
|
|
17447
17473
|
}
|
|
17448
17474
|
}
|
|
17449
17475
|
async function loadSiteEnv(siteDirectory) {
|
|
17450
|
-
const resolvedDirectory =
|
|
17476
|
+
const resolvedDirectory = path58.resolve(siteDirectory);
|
|
17451
17477
|
const merged = { ...process.env };
|
|
17452
17478
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
17453
17479
|
Object.assign(
|
|
17454
17480
|
merged,
|
|
17455
|
-
await readEnvFile(
|
|
17481
|
+
await readEnvFile(path58.join(resolvedDirectory, fileName))
|
|
17456
17482
|
);
|
|
17457
17483
|
}
|
|
17458
17484
|
return merged;
|
|
@@ -17489,7 +17515,7 @@ function buildAuthSecretsJson(secrets2, options) {
|
|
|
17489
17515
|
return payload;
|
|
17490
17516
|
}
|
|
17491
17517
|
function envFilePath(siteDirectory) {
|
|
17492
|
-
return
|
|
17518
|
+
return path58.join(path58.resolve(siteDirectory), ENV_FILENAME);
|
|
17493
17519
|
}
|
|
17494
17520
|
function createEnvContent() {
|
|
17495
17521
|
return [
|
|
@@ -17553,7 +17579,7 @@ function validateSecretsForPublish(manifest, secrets2, emailOptions) {
|
|
|
17553
17579
|
}
|
|
17554
17580
|
async function siteEnvFileHasEntries(siteDirectory) {
|
|
17555
17581
|
for (const fileName of [ENV_FILENAME, ".env.local"]) {
|
|
17556
|
-
const loaded = await readEnvFile(
|
|
17582
|
+
const loaded = await readEnvFile(path58.join(siteDirectory, fileName));
|
|
17557
17583
|
if (Object.keys(loaded).length > 0) {
|
|
17558
17584
|
return true;
|
|
17559
17585
|
}
|
|
@@ -17561,7 +17587,7 @@ async function siteEnvFileHasEntries(siteDirectory) {
|
|
|
17561
17587
|
return false;
|
|
17562
17588
|
}
|
|
17563
17589
|
async function resolvePublishConfig(siteDirectory, emailOptions) {
|
|
17564
|
-
const resolvedDirectory =
|
|
17590
|
+
const resolvedDirectory = path58.resolve(siteDirectory);
|
|
17565
17591
|
const manifestRaw = await readManifest2(resolvedDirectory);
|
|
17566
17592
|
if (!manifestRaw) {
|
|
17567
17593
|
throw new Error("apitogo.config.json not found in sourceDirectory.");
|
|
@@ -17594,7 +17620,7 @@ function envFileHasActiveAssignments(content) {
|
|
|
17594
17620
|
});
|
|
17595
17621
|
}
|
|
17596
17622
|
async function writeScaffoldEnv(siteDirectory) {
|
|
17597
|
-
const resolvedDirectory =
|
|
17623
|
+
const resolvedDirectory = path58.resolve(siteDirectory);
|
|
17598
17624
|
const filesWritten = [];
|
|
17599
17625
|
const envPath = envFilePath(resolvedDirectory);
|
|
17600
17626
|
try {
|
|
@@ -17605,7 +17631,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
17605
17631
|
filesWritten.push(ENV_FILENAME);
|
|
17606
17632
|
}
|
|
17607
17633
|
for (const legacyName of [".env.example"]) {
|
|
17608
|
-
const legacyPath =
|
|
17634
|
+
const legacyPath = path58.join(resolvedDirectory, legacyName);
|
|
17609
17635
|
try {
|
|
17610
17636
|
const legacy = await readFile17(legacyPath, "utf8");
|
|
17611
17637
|
if (!envFileHasActiveAssignments(legacy)) {
|
|
@@ -17615,7 +17641,7 @@ async function writeScaffoldEnv(siteDirectory) {
|
|
|
17615
17641
|
} catch {
|
|
17616
17642
|
}
|
|
17617
17643
|
}
|
|
17618
|
-
const gitignorePath =
|
|
17644
|
+
const gitignorePath = path58.join(resolvedDirectory, ".gitignore");
|
|
17619
17645
|
let gitignore = "";
|
|
17620
17646
|
try {
|
|
17621
17647
|
gitignore = await readFile17(gitignorePath, "utf8");
|
|
@@ -17652,11 +17678,11 @@ var SECRETS_COLLECTION_INSTRUCTION = "For go-live, plans must already be in apit
|
|
|
17652
17678
|
init_gateway_limits();
|
|
17653
17679
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
17654
17680
|
import { createRequire as createRequire3 } from "node:module";
|
|
17655
|
-
import
|
|
17681
|
+
import path59 from "node:path";
|
|
17656
17682
|
var cachedFallbackTs;
|
|
17657
17683
|
async function loadTypeScriptForSite(sourceDirectory) {
|
|
17658
17684
|
const require2 = createRequire3(
|
|
17659
|
-
|
|
17685
|
+
path59.join(path59.resolve(sourceDirectory), "package.json")
|
|
17660
17686
|
);
|
|
17661
17687
|
try {
|
|
17662
17688
|
return require2("typescript");
|
|
@@ -17703,7 +17729,7 @@ async function referencedFileExists(sourceDirectory, reference) {
|
|
|
17703
17729
|
return true;
|
|
17704
17730
|
}
|
|
17705
17731
|
return pathExists2(
|
|
17706
|
-
|
|
17732
|
+
path59.resolve(sourceDirectory, reference.replace(/^\.\//, ""))
|
|
17707
17733
|
);
|
|
17708
17734
|
}
|
|
17709
17735
|
async function validateSiteConfigStructure(config2, sourceDirectory) {
|
|
@@ -17818,11 +17844,11 @@ var DEFAULT_TSX_CANDIDATES = [
|
|
|
17818
17844
|
"landing/LandingPage.tsx"
|
|
17819
17845
|
];
|
|
17820
17846
|
async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
17821
|
-
const resolvedDir =
|
|
17847
|
+
const resolvedDir = path59.resolve(sourceDirectory);
|
|
17822
17848
|
const issues = [];
|
|
17823
17849
|
const checkedFiles = [];
|
|
17824
17850
|
const skippedChecks = [];
|
|
17825
|
-
const jsonPath =
|
|
17851
|
+
const jsonPath = path59.join(resolvedDir, APITOGO_CONFIG_FILENAME2);
|
|
17826
17852
|
if (await pathExists2(jsonPath)) {
|
|
17827
17853
|
checkedFiles.push(APITOGO_CONFIG_FILENAME2);
|
|
17828
17854
|
let parsed;
|
|
@@ -17854,7 +17880,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
17854
17880
|
);
|
|
17855
17881
|
const existingTsxFiles = [];
|
|
17856
17882
|
for (const relativeFile of tsxFiles) {
|
|
17857
|
-
if (await pathExists2(
|
|
17883
|
+
if (await pathExists2(path59.join(resolvedDir, relativeFile))) {
|
|
17858
17884
|
existingTsxFiles.push(relativeFile);
|
|
17859
17885
|
}
|
|
17860
17886
|
}
|
|
@@ -17868,7 +17894,7 @@ async function validateDevPortalSiteConfig(sourceDirectory, options) {
|
|
|
17868
17894
|
for (const relativeFile of existingTsxFiles) {
|
|
17869
17895
|
checkedFiles.push(relativeFile);
|
|
17870
17896
|
const content = await readFile18(
|
|
17871
|
-
|
|
17897
|
+
path59.join(resolvedDir, relativeFile),
|
|
17872
17898
|
"utf8"
|
|
17873
17899
|
);
|
|
17874
17900
|
issues.push(
|
|
@@ -18272,7 +18298,7 @@ function validateManifestForPlatformPublish(manifest) {
|
|
|
18272
18298
|
|
|
18273
18299
|
// src/cli/platform/tools/check-publish-readiness.ts
|
|
18274
18300
|
async function checkPublishReadiness(client, _config, args) {
|
|
18275
|
-
const sourceDirectory =
|
|
18301
|
+
const sourceDirectory = path60.resolve(args.sourceDirectory);
|
|
18276
18302
|
const manifest = await readManifest2(sourceDirectory) ?? createScaffoldManifest();
|
|
18277
18303
|
const emailOptions = await resolveEmailOptionsForPublish(
|
|
18278
18304
|
client,
|
|
@@ -18350,7 +18376,7 @@ async function checkPublishReadiness(client, _config, args) {
|
|
|
18350
18376
|
|
|
18351
18377
|
// src/cli/check/handler.ts
|
|
18352
18378
|
async function check(argv) {
|
|
18353
|
-
const sourceDirectory =
|
|
18379
|
+
const sourceDirectory = path61.resolve(process.cwd(), argv.dir);
|
|
18354
18380
|
if (await isConfigV2(sourceDirectory)) {
|
|
18355
18381
|
await checkV2(sourceDirectory, argv);
|
|
18356
18382
|
return;
|
|
@@ -18415,13 +18441,13 @@ var check_default = {
|
|
|
18415
18441
|
// src/cli/make-config/handler.ts
|
|
18416
18442
|
import { constants as constants2 } from "node:fs";
|
|
18417
18443
|
import { access as access12, mkdir as mkdir17, readFile as readFile23, writeFile as writeFile21 } from "node:fs/promises";
|
|
18418
|
-
import
|
|
18444
|
+
import path71 from "node:path";
|
|
18419
18445
|
import { stdin as input2 } from "node:process";
|
|
18420
18446
|
import { glob as glob8 } from "glob";
|
|
18421
18447
|
|
|
18422
18448
|
// src/cli/platform/helpers/openapi-action-keys.ts
|
|
18423
18449
|
import { existsSync as existsSync8, readFileSync as readFileSync4 } from "node:fs";
|
|
18424
|
-
import
|
|
18450
|
+
import path62 from "node:path";
|
|
18425
18451
|
import YAML from "yaml";
|
|
18426
18452
|
var HTTP_METHODS = [
|
|
18427
18453
|
"get",
|
|
@@ -18490,7 +18516,7 @@ function extractGatewayActionKeysFromOpenApiDocument(document) {
|
|
|
18490
18516
|
function extractGatewayActionKeysFromOpenApiFile(filePath) {
|
|
18491
18517
|
try {
|
|
18492
18518
|
const raw = readFileSync4(filePath, "utf8");
|
|
18493
|
-
const ext =
|
|
18519
|
+
const ext = path62.extname(filePath).toLowerCase();
|
|
18494
18520
|
const parsed = ext === ".json" ? JSON.parse(raw) : YAML.parse(raw);
|
|
18495
18521
|
return extractGatewayActionKeysFromOpenApiDocument(parsed);
|
|
18496
18522
|
} catch {
|
|
@@ -18511,7 +18537,7 @@ function resolveConfigOpenApiFilePath(siteDirectory, config2) {
|
|
|
18511
18537
|
}
|
|
18512
18538
|
}
|
|
18513
18539
|
for (const candidate of candidates) {
|
|
18514
|
-
const resolved =
|
|
18540
|
+
const resolved = path62.isAbsolute(candidate) ? candidate : path62.resolve(siteDirectory, candidate);
|
|
18515
18541
|
if (existsSync8(resolved)) {
|
|
18516
18542
|
return resolved;
|
|
18517
18543
|
}
|
|
@@ -18526,7 +18552,7 @@ function loadOpenApiActionKeysForSite(siteDirectory, config2) {
|
|
|
18526
18552
|
return extractGatewayActionKeysFromOpenApiFile(filePath);
|
|
18527
18553
|
}
|
|
18528
18554
|
function loadOpenApiActionKeysFromSiteDirectory(siteDirectory) {
|
|
18529
|
-
const configPath =
|
|
18555
|
+
const configPath = path62.join(siteDirectory, "apitogo.config.json");
|
|
18530
18556
|
if (!existsSync8(configPath)) {
|
|
18531
18557
|
return [];
|
|
18532
18558
|
}
|
|
@@ -18555,7 +18581,7 @@ function withDefaultIncludedActionKeys(plan2, actionKeys) {
|
|
|
18555
18581
|
|
|
18556
18582
|
// src/cli/scaffold/dev-portal-config-pages.ts
|
|
18557
18583
|
import { access as access8, readFile as readFile19, rename as rename7, rm as rm9, writeFile as writeFile17 } from "node:fs/promises";
|
|
18558
|
-
import
|
|
18584
|
+
import path63 from "node:path";
|
|
18559
18585
|
async function writeConfigAtomically(filePath, content) {
|
|
18560
18586
|
const temporaryPath = `${filePath}.${process.pid}.${Date.now()}.tmp`;
|
|
18561
18587
|
try {
|
|
@@ -18568,7 +18594,7 @@ async function writeConfigAtomically(filePath, content) {
|
|
|
18568
18594
|
}
|
|
18569
18595
|
async function resolveApitogoConfigPath(sourceDirectory) {
|
|
18570
18596
|
for (const filename of ["apitogo.config.tsx", "apitogo.config.jsx"]) {
|
|
18571
|
-
const configPath =
|
|
18597
|
+
const configPath = path63.join(sourceDirectory, filename);
|
|
18572
18598
|
try {
|
|
18573
18599
|
await access8(configPath);
|
|
18574
18600
|
return configPath;
|
|
@@ -19332,17 +19358,17 @@ async function wireNewDevPortalPageInConfig(sourceDirectory, slug, label) {
|
|
|
19332
19358
|
|
|
19333
19359
|
// src/cli/scaffold/wire-openapi.ts
|
|
19334
19360
|
import { access as access10, readFile as readFile21, writeFile as writeFile19 } from "node:fs/promises";
|
|
19335
|
-
import
|
|
19361
|
+
import path68 from "node:path";
|
|
19336
19362
|
|
|
19337
19363
|
// src/cli/platform/helpers/openapi.ts
|
|
19338
19364
|
import { promises as fs6 } from "node:fs";
|
|
19339
|
-
import
|
|
19365
|
+
import path65 from "node:path";
|
|
19340
19366
|
import SwaggerParser from "@apidevtools/swagger-parser";
|
|
19341
19367
|
import YAML2 from "yaml";
|
|
19342
19368
|
|
|
19343
19369
|
// src/cli/scaffold/discover-openapi-files.ts
|
|
19344
19370
|
import { promises as fs5 } from "node:fs";
|
|
19345
|
-
import
|
|
19371
|
+
import path64 from "node:path";
|
|
19346
19372
|
var OPENAPI_BASENAMES = [
|
|
19347
19373
|
"openapi.yaml",
|
|
19348
19374
|
"openapi.yml",
|
|
@@ -19364,13 +19390,13 @@ var SKIP_OPENAPI_SEARCH_DIRS = /* @__PURE__ */ new Set([
|
|
|
19364
19390
|
".apitogo"
|
|
19365
19391
|
]);
|
|
19366
19392
|
async function collectFromDir(dir, searchedDirectories, candidates) {
|
|
19367
|
-
const resolved =
|
|
19393
|
+
const resolved = path64.resolve(dir);
|
|
19368
19394
|
if (searchedDirectories.includes(resolved)) {
|
|
19369
19395
|
return;
|
|
19370
19396
|
}
|
|
19371
19397
|
searchedDirectories.push(resolved);
|
|
19372
19398
|
for (const name of OPENAPI_BASENAMES) {
|
|
19373
|
-
const candidate =
|
|
19399
|
+
const candidate = path64.join(resolved, name);
|
|
19374
19400
|
try {
|
|
19375
19401
|
await fs5.access(candidate);
|
|
19376
19402
|
candidates.push(candidate);
|
|
@@ -19385,8 +19411,8 @@ async function collectSiteOpenApiFiles(siteDirectory) {
|
|
|
19385
19411
|
return { candidates: [...new Set(candidates)], searchedDirectories };
|
|
19386
19412
|
}
|
|
19387
19413
|
async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
19388
|
-
const site =
|
|
19389
|
-
const parent =
|
|
19414
|
+
const site = path64.resolve(siteDirectory);
|
|
19415
|
+
const parent = path64.dirname(site);
|
|
19390
19416
|
const searchedDirectories = [];
|
|
19391
19417
|
const candidates = [];
|
|
19392
19418
|
if (parent && parent !== site) {
|
|
@@ -19397,8 +19423,8 @@ async function collectNearbyOpenApiFiles(siteDirectory) {
|
|
|
19397
19423
|
if (!entry.isDirectory() || SKIP_OPENAPI_SEARCH_DIRS.has(entry.name)) {
|
|
19398
19424
|
continue;
|
|
19399
19425
|
}
|
|
19400
|
-
const sibling =
|
|
19401
|
-
if (
|
|
19426
|
+
const sibling = path64.join(parent, entry.name);
|
|
19427
|
+
if (path64.resolve(sibling) === site) {
|
|
19402
19428
|
continue;
|
|
19403
19429
|
}
|
|
19404
19430
|
await collectFromDir(sibling, searchedDirectories, candidates);
|
|
@@ -19426,7 +19452,7 @@ function parseOpenApiObject(doc) {
|
|
|
19426
19452
|
};
|
|
19427
19453
|
}
|
|
19428
19454
|
function liteParseOpenApi(content, filePath) {
|
|
19429
|
-
const ext =
|
|
19455
|
+
const ext = path64.extname(filePath).toLowerCase();
|
|
19430
19456
|
if (ext === ".json") {
|
|
19431
19457
|
try {
|
|
19432
19458
|
const parsed = JSON.parse(content);
|
|
@@ -19491,9 +19517,9 @@ async function discoverNearbyOpenApi(siteDirectory) {
|
|
|
19491
19517
|
};
|
|
19492
19518
|
}
|
|
19493
19519
|
async function validateOpenApiFile(filePath) {
|
|
19494
|
-
const resolved =
|
|
19520
|
+
const resolved = path65.resolve(filePath);
|
|
19495
19521
|
const content = await fs6.readFile(resolved, "utf8");
|
|
19496
|
-
const ext =
|
|
19522
|
+
const ext = path65.extname(resolved).toLowerCase();
|
|
19497
19523
|
let parsed;
|
|
19498
19524
|
try {
|
|
19499
19525
|
parsed = ext === ".json" ? JSON.parse(content) : YAML2.parse(content);
|
|
@@ -19536,7 +19562,7 @@ async function validateOpenApiFile(filePath) {
|
|
|
19536
19562
|
|
|
19537
19563
|
// src/cli/scaffold/scaffold-dev-portal-site.ts
|
|
19538
19564
|
import { mkdir as mkdir15, readFile as readFile20, writeFile as writeFile18 } from "node:fs/promises";
|
|
19539
|
-
import
|
|
19565
|
+
import path67 from "node:path";
|
|
19540
19566
|
|
|
19541
19567
|
// src/cli/scaffold/apitogo-npm-packages.ts
|
|
19542
19568
|
var DEFAULT_CREATE_APITOGO_PACKAGE2 = "@lukoweb/create-apitogo@latest";
|
|
@@ -19624,7 +19650,7 @@ var DOC_TOOL_LOCAL_PACKAGE_PATHS = {
|
|
|
19624
19650
|
// src/cli/scaffold/create-apitogo-cli.ts
|
|
19625
19651
|
import { spawn as spawn3 } from "node:child_process";
|
|
19626
19652
|
import { access as access9, rm as rm10 } from "node:fs/promises";
|
|
19627
|
-
import
|
|
19653
|
+
import path66 from "node:path";
|
|
19628
19654
|
var SKIP_NEARBY_DISCOVERY_ENV = "APITOGO_SKIP_NEARBY_DISCOVERY";
|
|
19629
19655
|
var CreateApitogoCliError = class extends Error {
|
|
19630
19656
|
exitCode;
|
|
@@ -19641,9 +19667,9 @@ function resolveDocToolPath(explicit) {
|
|
|
19641
19667
|
return value || void 0;
|
|
19642
19668
|
}
|
|
19643
19669
|
function splitOutputDirectory(outputDirectory) {
|
|
19644
|
-
const resolvedOutputDirectory =
|
|
19645
|
-
const projectName =
|
|
19646
|
-
const parentDirectory =
|
|
19670
|
+
const resolvedOutputDirectory = path66.resolve(outputDirectory);
|
|
19671
|
+
const projectName = path66.basename(resolvedOutputDirectory);
|
|
19672
|
+
const parentDirectory = path66.dirname(resolvedOutputDirectory);
|
|
19647
19673
|
if (!projectName || projectName === "." || projectName === "..") {
|
|
19648
19674
|
throw new Error(
|
|
19649
19675
|
"outputDirectory must be a named folder (e.g. ./dev-portal-site), not the current directory."
|
|
@@ -19669,7 +19695,7 @@ async function directoryHasEntries(dir) {
|
|
|
19669
19695
|
}
|
|
19670
19696
|
}
|
|
19671
19697
|
function resolveLocalCreateApitogoEntry(docToolPath) {
|
|
19672
|
-
return
|
|
19698
|
+
return path66.resolve(docToolPath, "packages/create-zudoku/dist/index.js");
|
|
19673
19699
|
}
|
|
19674
19700
|
async function resolveCreateApitogoInvocation(options) {
|
|
19675
19701
|
const docToolPath = resolveDocToolPath(options.docToolPath);
|
|
@@ -19751,7 +19777,7 @@ async function runCreateApitogoDevPortal(options) {
|
|
|
19751
19777
|
result.exitCode
|
|
19752
19778
|
);
|
|
19753
19779
|
}
|
|
19754
|
-
if (!await pathExists3(
|
|
19780
|
+
if (!await pathExists3(path66.join(resolvedOutputDirectory, "package.json"))) {
|
|
19755
19781
|
throw new CreateApitogoCliError(
|
|
19756
19782
|
`create-apitogo completed but package.json was not found at ${resolvedOutputDirectory}`,
|
|
19757
19783
|
result.output,
|
|
@@ -19810,7 +19836,7 @@ function ensureRequiredApitogoModules(pkg, options) {
|
|
|
19810
19836
|
]
|
|
19811
19837
|
]) {
|
|
19812
19838
|
if (options.docToolPath) {
|
|
19813
|
-
deps[moduleName] = `file:${
|
|
19839
|
+
deps[moduleName] = `file:${path67.join(options.docToolPath, localPath)}`;
|
|
19814
19840
|
continue;
|
|
19815
19841
|
}
|
|
19816
19842
|
deps[moduleName] = `npm:${moduleName}@${moduleAliasVersion}`;
|
|
@@ -19841,7 +19867,7 @@ function rewritePackageJson(raw, options) {
|
|
|
19841
19867
|
DOC_TOOL_LOCAL_PACKAGE_PATHS
|
|
19842
19868
|
)) {
|
|
19843
19869
|
if (dep in deps) {
|
|
19844
|
-
deps[dep] = `file:${
|
|
19870
|
+
deps[dep] = `file:${path67.join(options.docToolPath, relativePath)}`;
|
|
19845
19871
|
linkedWorkspacePackage = true;
|
|
19846
19872
|
}
|
|
19847
19873
|
}
|
|
@@ -19941,23 +19967,23 @@ function patchDashboardPageConfig(content) {
|
|
|
19941
19967
|
);
|
|
19942
19968
|
}
|
|
19943
19969
|
async function ensureAccountPlansPage(outputDirectory) {
|
|
19944
|
-
const pagePath =
|
|
19970
|
+
const pagePath = path67.join(outputDirectory, ACCOUNT_PLANS_PAGE_PATH);
|
|
19945
19971
|
try {
|
|
19946
19972
|
await readFile20(pagePath, "utf8");
|
|
19947
19973
|
return void 0;
|
|
19948
19974
|
} catch {
|
|
19949
|
-
await mkdir15(
|
|
19975
|
+
await mkdir15(path67.dirname(pagePath), { recursive: true });
|
|
19950
19976
|
await writeFile18(pagePath, ACCOUNT_PLANS_PAGE);
|
|
19951
19977
|
return ACCOUNT_PLANS_PAGE_PATH;
|
|
19952
19978
|
}
|
|
19953
19979
|
}
|
|
19954
19980
|
async function ensureDashboardPage(outputDirectory) {
|
|
19955
|
-
const pagePath =
|
|
19981
|
+
const pagePath = path67.join(outputDirectory, DASHBOARD_PAGE_PATH);
|
|
19956
19982
|
try {
|
|
19957
19983
|
await readFile20(pagePath, "utf8");
|
|
19958
19984
|
return void 0;
|
|
19959
19985
|
} catch {
|
|
19960
|
-
await mkdir15(
|
|
19986
|
+
await mkdir15(path67.dirname(pagePath), { recursive: true });
|
|
19961
19987
|
await writeFile18(pagePath, DASHBOARD_PAGE);
|
|
19962
19988
|
return DASHBOARD_PAGE_PATH;
|
|
19963
19989
|
}
|
|
@@ -20014,7 +20040,7 @@ function patchApitogoConfig(content, options) {
|
|
|
20014
20040
|
async function patchScaffoldedSite(outputDirectory, options) {
|
|
20015
20041
|
const title = options.branding?.title ?? options.siteName;
|
|
20016
20042
|
const filesWritten = [];
|
|
20017
|
-
const packageJsonPath =
|
|
20043
|
+
const packageJsonPath = path67.join(outputDirectory, "package.json");
|
|
20018
20044
|
if (options.patchPackageJson !== false) {
|
|
20019
20045
|
const packageJson3 = await readFile20(packageJsonPath, "utf8");
|
|
20020
20046
|
await writeFile18(
|
|
@@ -20027,7 +20053,7 @@ async function patchScaffoldedSite(outputDirectory, options) {
|
|
|
20027
20053
|
);
|
|
20028
20054
|
filesWritten.push("package.json");
|
|
20029
20055
|
}
|
|
20030
|
-
const configPath =
|
|
20056
|
+
const configPath = path67.join(outputDirectory, "apitogo.config.tsx");
|
|
20031
20057
|
const configContent = await readFile20(configPath, "utf8");
|
|
20032
20058
|
await writeFile18(
|
|
20033
20059
|
configPath,
|
|
@@ -20122,8 +20148,8 @@ async function discoverOpenApiByMode(siteDirectory, mode) {
|
|
|
20122
20148
|
return discoverNearbyOpenApi(siteDirectory);
|
|
20123
20149
|
}
|
|
20124
20150
|
async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
20125
|
-
const resolvedSource =
|
|
20126
|
-
const resolvedOpenApi =
|
|
20151
|
+
const resolvedSource = path68.resolve(sourceDirectory);
|
|
20152
|
+
const resolvedOpenApi = path68.resolve(openApiPath);
|
|
20127
20153
|
const input5 = toSiteRelativeOpenApiInput(resolvedSource, resolvedOpenApi);
|
|
20128
20154
|
const validation = await validateOpenApiFile(resolvedOpenApi);
|
|
20129
20155
|
if (!validation.valid) {
|
|
@@ -20148,7 +20174,7 @@ async function wireDevPortalOpenApi(sourceDirectory, openApiPath) {
|
|
|
20148
20174
|
"utf8"
|
|
20149
20175
|
);
|
|
20150
20176
|
} else {
|
|
20151
|
-
const tsxConfigPath =
|
|
20177
|
+
const tsxConfigPath = path68.join(resolvedSource, "apitogo.config.tsx");
|
|
20152
20178
|
const configContent = await readFile21(tsxConfigPath, "utf8");
|
|
20153
20179
|
try {
|
|
20154
20180
|
const patched = patchApitogoConfigOpenApiToFile(configContent, input5);
|
|
@@ -20234,7 +20260,7 @@ async function discoverAndWireOpenApi(siteDirectory, mode) {
|
|
|
20234
20260
|
}
|
|
20235
20261
|
|
|
20236
20262
|
// src/cli/make-config/interactive.ts
|
|
20237
|
-
import
|
|
20263
|
+
import path69 from "node:path";
|
|
20238
20264
|
import { stdin as input, stdout as output } from "node:process";
|
|
20239
20265
|
import { createInterface as createInterface3 } from "node:readline/promises";
|
|
20240
20266
|
|
|
@@ -20410,7 +20436,7 @@ async function promptMakeConfigInteractive(options) {
|
|
|
20410
20436
|
continue;
|
|
20411
20437
|
}
|
|
20412
20438
|
const routePath = `/${slug}`;
|
|
20413
|
-
const relativePath =
|
|
20439
|
+
const relativePath = path69.posix.join(options.pagesDir, `${slug}.tsx`);
|
|
20414
20440
|
const page = {
|
|
20415
20441
|
slug,
|
|
20416
20442
|
title: pageTitle.trim(),
|
|
@@ -20506,7 +20532,7 @@ export default function ${componentName}() {
|
|
|
20506
20532
|
init_package_json();
|
|
20507
20533
|
import { constants } from "node:fs";
|
|
20508
20534
|
import { access as access11, mkdir as mkdir16, readFile as readFile22, writeFile as writeFile20 } from "node:fs/promises";
|
|
20509
|
-
import
|
|
20535
|
+
import path70 from "node:path";
|
|
20510
20536
|
import { glob as glob7 } from "glob";
|
|
20511
20537
|
|
|
20512
20538
|
// src/cli/make-config/favicon-png.ts
|
|
@@ -20521,9 +20547,9 @@ var OPENAPI_GLOBS = [
|
|
|
20521
20547
|
"openapi.yaml",
|
|
20522
20548
|
"openapi.yml"
|
|
20523
20549
|
];
|
|
20524
|
-
var toPosix2 = (p) => p.split(
|
|
20550
|
+
var toPosix2 = (p) => p.split(path70.sep).join("/");
|
|
20525
20551
|
var sanitizePackageName = (dir) => {
|
|
20526
|
-
const base =
|
|
20552
|
+
const base = path70.basename(path70.resolve(dir));
|
|
20527
20553
|
const s = base.toLowerCase().replace(/[^a-z0-9-_.]/g, "-").replace(/^-+|-+$/g, "");
|
|
20528
20554
|
return s || "apitogo-site";
|
|
20529
20555
|
};
|
|
@@ -20533,7 +20559,7 @@ var apitogoVersionRange = () => {
|
|
|
20533
20559
|
};
|
|
20534
20560
|
async function findOpenApiSpecPath(dir) {
|
|
20535
20561
|
for (const rel2 of OPENAPI_GLOBS) {
|
|
20536
|
-
const full =
|
|
20562
|
+
const full = path70.join(dir, rel2);
|
|
20537
20563
|
try {
|
|
20538
20564
|
await access11(full, constants.R_OK);
|
|
20539
20565
|
return toPosix2(rel2);
|
|
@@ -20548,7 +20574,7 @@ async function findOpenApiSpecPath(dir) {
|
|
|
20548
20574
|
return extra[0] ? toPosix2(extra[0]) : null;
|
|
20549
20575
|
}
|
|
20550
20576
|
async function ensurePackageJson2(dir) {
|
|
20551
|
-
const pkgPath =
|
|
20577
|
+
const pkgPath = path70.join(dir, "package.json");
|
|
20552
20578
|
const apitogoVer = apitogoVersionRange();
|
|
20553
20579
|
const baseDeps = {
|
|
20554
20580
|
react: ">=19.0.0",
|
|
@@ -20615,7 +20641,7 @@ async function ensurePackageJson2(dir) {
|
|
|
20615
20641
|
return false;
|
|
20616
20642
|
}
|
|
20617
20643
|
async function ensureTsconfigJson(dir) {
|
|
20618
|
-
const tsPath =
|
|
20644
|
+
const tsPath = path70.join(dir, "tsconfig.json");
|
|
20619
20645
|
try {
|
|
20620
20646
|
await access11(tsPath, constants.R_OK);
|
|
20621
20647
|
return false;
|
|
@@ -20664,40 +20690,40 @@ var fileExists2 = async (filePath) => {
|
|
|
20664
20690
|
}
|
|
20665
20691
|
};
|
|
20666
20692
|
async function ensurePortalStubFiles(dir) {
|
|
20667
|
-
const landingPath =
|
|
20693
|
+
const landingPath = path70.join(dir, "landing", "LandingPage.tsx");
|
|
20668
20694
|
if (!await fileExists2(landingPath)) {
|
|
20669
|
-
await mkdir16(
|
|
20695
|
+
await mkdir16(path70.join(dir, "landing"), { recursive: true });
|
|
20670
20696
|
await writeFile20(landingPath, LANDING_PAGE_SOURCE, "utf8");
|
|
20671
20697
|
}
|
|
20672
|
-
const plansPath =
|
|
20698
|
+
const plansPath = path70.join(dir, "user-panel", "AccountPlansPage.tsx");
|
|
20673
20699
|
if (!await fileExists2(plansPath)) {
|
|
20674
|
-
await mkdir16(
|
|
20700
|
+
await mkdir16(path70.join(dir, "user-panel"), { recursive: true });
|
|
20675
20701
|
await writeFile20(plansPath, ACCOUNT_PLANS_PAGE_SOURCE, "utf8");
|
|
20676
20702
|
}
|
|
20677
|
-
const dashboardPath =
|
|
20703
|
+
const dashboardPath = path70.join(dir, "user-panel", "DashboardPage.tsx");
|
|
20678
20704
|
if (!await fileExists2(dashboardPath)) {
|
|
20679
|
-
await mkdir16(
|
|
20705
|
+
await mkdir16(path70.join(dir, "user-panel"), { recursive: true });
|
|
20680
20706
|
await writeFile20(dashboardPath, DASHBOARD_PAGE_SOURCE, "utf8");
|
|
20681
20707
|
}
|
|
20682
20708
|
await ensurePublicBrandingFiles(dir);
|
|
20683
20709
|
}
|
|
20684
20710
|
async function ensurePublicBrandingFiles(dir) {
|
|
20685
|
-
const destDir =
|
|
20711
|
+
const destDir = path70.join(dir, "public");
|
|
20686
20712
|
await mkdir16(destDir, { recursive: true });
|
|
20687
20713
|
for (const { name, content } of BRANDING_ASSETS) {
|
|
20688
|
-
const dest =
|
|
20714
|
+
const dest = path70.join(destDir, name);
|
|
20689
20715
|
if (await fileExists2(dest)) {
|
|
20690
20716
|
continue;
|
|
20691
20717
|
}
|
|
20692
20718
|
await writeFile20(dest, content, "utf8");
|
|
20693
20719
|
}
|
|
20694
|
-
const faviconDest =
|
|
20720
|
+
const faviconDest = path70.join(destDir, "Icon.png");
|
|
20695
20721
|
if (!await fileExists2(faviconDest)) {
|
|
20696
20722
|
await writeFile20(faviconDest, Buffer.from(FAVICON_PNG_BASE64, "base64"));
|
|
20697
20723
|
}
|
|
20698
20724
|
}
|
|
20699
20725
|
async function ensureThinConfigTsx(dir) {
|
|
20700
|
-
const tsxPath =
|
|
20726
|
+
const tsxPath = path70.join(dir, "apitogo.config.tsx");
|
|
20701
20727
|
if (await fileExists2(tsxPath)) {
|
|
20702
20728
|
return false;
|
|
20703
20729
|
}
|
|
@@ -20706,7 +20732,7 @@ async function ensureThinConfigTsx(dir) {
|
|
|
20706
20732
|
}
|
|
20707
20733
|
|
|
20708
20734
|
// src/cli/make-config/handler.ts
|
|
20709
|
-
var toPosixPath2 = (value) => value.split(
|
|
20735
|
+
var toPosixPath2 = (value) => value.split(path71.sep).join(path71.posix.sep);
|
|
20710
20736
|
var fileExists3 = async (filePath) => {
|
|
20711
20737
|
try {
|
|
20712
20738
|
await access12(filePath, constants2.F_OK);
|
|
@@ -20764,7 +20790,7 @@ async function persistConfig(config2, ctx) {
|
|
|
20764
20790
|
};
|
|
20765
20791
|
await writeFile21(ctx.jsonPath, `${JSON.stringify(next, null, 2)}
|
|
20766
20792
|
`, "utf8");
|
|
20767
|
-
const tsxPath =
|
|
20793
|
+
const tsxPath = path71.join(ctx.dir, "apitogo.config.tsx");
|
|
20768
20794
|
if (await fileExists3(tsxPath) && tsxRoutes.length > 0) {
|
|
20769
20795
|
const tsxSource = await readFile23(tsxPath, "utf8");
|
|
20770
20796
|
if (isManagedConfigWrapper(tsxSource)) {
|
|
@@ -20791,7 +20817,7 @@ function mergeBackendFlag(config2, backend) {
|
|
|
20791
20817
|
return next;
|
|
20792
20818
|
}
|
|
20793
20819
|
async function makeConfig(argv) {
|
|
20794
|
-
const dir =
|
|
20820
|
+
const dir = path71.resolve(process.cwd(), argv.dir);
|
|
20795
20821
|
const pagesDir = toPosixPath2(
|
|
20796
20822
|
argv.pagesDir.replace(/^[./]+/, "").replace(/\/+$/, "")
|
|
20797
20823
|
);
|
|
@@ -20811,14 +20837,14 @@ async function makeConfig(argv) {
|
|
|
20811
20837
|
printSuccessToConsole("Created tsconfig.json.");
|
|
20812
20838
|
}
|
|
20813
20839
|
await ensurePortalStubFiles(dir);
|
|
20814
|
-
const jsonPath =
|
|
20840
|
+
const jsonPath = path71.join(dir, APITOGO_JSON_FILENAME);
|
|
20815
20841
|
let createdJson = false;
|
|
20816
20842
|
let config2;
|
|
20817
20843
|
if (await fileExists3(jsonPath)) {
|
|
20818
20844
|
config2 = await readJsonConfig(jsonPath);
|
|
20819
20845
|
} else {
|
|
20820
20846
|
config2 = createDefaultApitogoJsonConfig({
|
|
20821
|
-
title: titleFromDirectoryName(
|
|
20847
|
+
title: titleFromDirectoryName(path71.basename(dir)),
|
|
20822
20848
|
pagesDir
|
|
20823
20849
|
});
|
|
20824
20850
|
createdJson = true;
|
|
@@ -20870,8 +20896,8 @@ async function makeConfig(argv) {
|
|
|
20870
20896
|
return;
|
|
20871
20897
|
}
|
|
20872
20898
|
if (action2.kind === "page") {
|
|
20873
|
-
const pagePath =
|
|
20874
|
-
await mkdir17(
|
|
20899
|
+
const pagePath = path71.join(dir, action2.page.relativePath);
|
|
20900
|
+
await mkdir17(path71.dirname(pagePath), { recursive: true });
|
|
20875
20901
|
await writeFile21(
|
|
20876
20902
|
pagePath,
|
|
20877
20903
|
buildStarterDocsPageTsx(action2.page.slug, action2.page.title),
|
|
@@ -20938,7 +20964,7 @@ async function makeConfig(argv) {
|
|
|
20938
20964
|
if (argv.openapi) {
|
|
20939
20965
|
const wire = await wireDevPortalOpenApi(
|
|
20940
20966
|
dir,
|
|
20941
|
-
|
|
20967
|
+
path71.resolve(dir, argv.openapi)
|
|
20942
20968
|
);
|
|
20943
20969
|
if (wire.status !== "succeeded") {
|
|
20944
20970
|
throw new Error(
|
|
@@ -20967,7 +20993,7 @@ async function makeConfig(argv) {
|
|
|
20967
20993
|
const slug = normalizePageSlug2(argv.pageSlug);
|
|
20968
20994
|
const pageTemplate = normalizePageTemplate(argv.pageTemplate);
|
|
20969
20995
|
const relativePagePath = pageComponentRelativePath(slug);
|
|
20970
|
-
const filePath =
|
|
20996
|
+
const filePath = path71.join(dir, relativePagePath);
|
|
20971
20997
|
const isUpdate = argv.pageUpdate === true;
|
|
20972
20998
|
if (isUpdate) {
|
|
20973
20999
|
if (!await fileExists3(filePath)) {
|
|
@@ -21000,7 +21026,7 @@ async function makeConfig(argv) {
|
|
|
21000
21026
|
argv.pageContent,
|
|
21001
21027
|
pageTemplate
|
|
21002
21028
|
);
|
|
21003
|
-
await mkdir17(
|
|
21029
|
+
await mkdir17(path71.dirname(filePath), { recursive: true });
|
|
21004
21030
|
await writeFile21(filePath, tsx, "utf8");
|
|
21005
21031
|
const configResult = await wireNewDevPortalPageInConfig(
|
|
21006
21032
|
dir,
|
|
@@ -21013,7 +21039,7 @@ async function makeConfig(argv) {
|
|
|
21013
21039
|
pagePath: relativePagePath,
|
|
21014
21040
|
pageTemplate,
|
|
21015
21041
|
configUpdated: configResult.updated,
|
|
21016
|
-
configPath: configResult.configPath ?
|
|
21042
|
+
configPath: configResult.configPath ? path71.relative(dir, configResult.configPath) : null
|
|
21017
21043
|
};
|
|
21018
21044
|
changes.push("page_add");
|
|
21019
21045
|
}
|
|
@@ -21138,10 +21164,10 @@ var config_default = {
|
|
|
21138
21164
|
};
|
|
21139
21165
|
|
|
21140
21166
|
// src/cli/cmds/deploy.ts
|
|
21141
|
-
import
|
|
21167
|
+
import path85 from "node:path";
|
|
21142
21168
|
|
|
21143
21169
|
// src/cli/apply/handler.ts
|
|
21144
|
-
import
|
|
21170
|
+
import path82 from "node:path";
|
|
21145
21171
|
|
|
21146
21172
|
// src/cli/platform/helpers/gateway-plan-validation.ts
|
|
21147
21173
|
init_gateway_limits();
|
|
@@ -21336,11 +21362,11 @@ init_gateway_limits();
|
|
|
21336
21362
|
// src/cli/platform/helpers/deploy-artifact-hash.ts
|
|
21337
21363
|
import { createHash as createHash3 } from "node:crypto";
|
|
21338
21364
|
import { createReadStream, promises as fs8 } from "node:fs";
|
|
21339
|
-
import
|
|
21365
|
+
import path73 from "node:path";
|
|
21340
21366
|
|
|
21341
21367
|
// src/cli/platform/helpers/package-files.ts
|
|
21342
21368
|
import { promises as fs7 } from "node:fs";
|
|
21343
|
-
import
|
|
21369
|
+
import path72 from "node:path";
|
|
21344
21370
|
import ignore from "ignore";
|
|
21345
21371
|
var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
21346
21372
|
"node_modules",
|
|
@@ -21353,7 +21379,7 @@ var DEFAULT_EXCLUDES = /* @__PURE__ */ new Set([
|
|
|
21353
21379
|
async function loadGitignore(rootDir) {
|
|
21354
21380
|
const ig = ignore();
|
|
21355
21381
|
ig.add(["node_modules/", ".git/", "dist/", "bin/", "obj/"]);
|
|
21356
|
-
const gitignorePath =
|
|
21382
|
+
const gitignorePath = path72.join(rootDir, ".gitignore");
|
|
21357
21383
|
try {
|
|
21358
21384
|
const content = await fs7.readFile(gitignorePath, "utf8");
|
|
21359
21385
|
ig.add(content);
|
|
@@ -21362,11 +21388,11 @@ async function loadGitignore(rootDir) {
|
|
|
21362
21388
|
return ig;
|
|
21363
21389
|
}
|
|
21364
21390
|
async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
21365
|
-
const absDir =
|
|
21391
|
+
const absDir = path72.join(rootDir, relativeDir);
|
|
21366
21392
|
const entries = await fs7.readdir(absDir, { withFileTypes: true });
|
|
21367
21393
|
for (const entry of entries) {
|
|
21368
|
-
const rel2 = relativeDir ?
|
|
21369
|
-
const relPosix = rel2.split(
|
|
21394
|
+
const rel2 = relativeDir ? path72.join(relativeDir, entry.name) : entry.name;
|
|
21395
|
+
const relPosix = rel2.split(path72.sep).join("/");
|
|
21370
21396
|
if (DEFAULT_EXCLUDES.has(entry.name) && !relativeDir) {
|
|
21371
21397
|
continue;
|
|
21372
21398
|
}
|
|
@@ -21381,7 +21407,7 @@ async function collectFiles(rootDir, relativeDir, ig, files) {
|
|
|
21381
21407
|
}
|
|
21382
21408
|
}
|
|
21383
21409
|
async function collectPackageableFiles(sourceDirectory) {
|
|
21384
|
-
const resolved =
|
|
21410
|
+
const resolved = path72.resolve(sourceDirectory);
|
|
21385
21411
|
const stat7 = await fs7.stat(resolved).catch(() => null);
|
|
21386
21412
|
if (!stat7?.isDirectory()) {
|
|
21387
21413
|
throw new Error(`sourceDirectory is not a directory: ${resolved}`);
|
|
@@ -21407,7 +21433,7 @@ async function sha256File(filePath) {
|
|
|
21407
21433
|
return hash2.digest("hex");
|
|
21408
21434
|
}
|
|
21409
21435
|
async function hashDirectoryContents(rootDirectory) {
|
|
21410
|
-
const resolved =
|
|
21436
|
+
const resolved = path73.resolve(rootDirectory);
|
|
21411
21437
|
const files = (await collectPackageableFiles(resolved)).sort(
|
|
21412
21438
|
(a, b) => a.localeCompare(b)
|
|
21413
21439
|
);
|
|
@@ -21415,13 +21441,13 @@ async function hashDirectoryContents(rootDirectory) {
|
|
|
21415
21441
|
for (const rel2 of files) {
|
|
21416
21442
|
hash2.update(rel2);
|
|
21417
21443
|
hash2.update("\0");
|
|
21418
|
-
hash2.update(await fs8.readFile(
|
|
21444
|
+
hash2.update(await fs8.readFile(path73.join(resolved, rel2)));
|
|
21419
21445
|
hash2.update("\0");
|
|
21420
21446
|
}
|
|
21421
21447
|
return hash2.digest("hex");
|
|
21422
21448
|
}
|
|
21423
21449
|
async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
21424
|
-
const resolved =
|
|
21450
|
+
const resolved = path73.resolve(siteDirectory);
|
|
21425
21451
|
const hash2 = createHash3("sha256");
|
|
21426
21452
|
const candidates = [
|
|
21427
21453
|
"apitogo.config.json",
|
|
@@ -21431,7 +21457,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
21431
21457
|
"zudoku.config.tsx"
|
|
21432
21458
|
];
|
|
21433
21459
|
for (const name of candidates) {
|
|
21434
|
-
const full =
|
|
21460
|
+
const full = path73.join(resolved, name);
|
|
21435
21461
|
try {
|
|
21436
21462
|
hash2.update(name);
|
|
21437
21463
|
hash2.update("\0");
|
|
@@ -21441,7 +21467,7 @@ async function hashDevPortalSiteSources(siteDirectory, options) {
|
|
|
21441
21467
|
}
|
|
21442
21468
|
}
|
|
21443
21469
|
for (const dir of ["pages", "landing", "src"]) {
|
|
21444
|
-
const full =
|
|
21470
|
+
const full = path73.join(resolved, dir);
|
|
21445
21471
|
try {
|
|
21446
21472
|
const st = await fs8.stat(full);
|
|
21447
21473
|
if (!st.isDirectory()) continue;
|
|
@@ -21670,8 +21696,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
21670
21696
|
const trimmed = actionKey2.trim();
|
|
21671
21697
|
if (trimmed.includes(":")) {
|
|
21672
21698
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
21673
|
-
const
|
|
21674
|
-
return `${method2?.toLowerCase()}:${
|
|
21699
|
+
const path104 = pathParts.join(":").trim();
|
|
21700
|
+
return `${method2?.toLowerCase()}:${path104.startsWith("/") ? path104 : `/${path104}`}`;
|
|
21675
21701
|
}
|
|
21676
21702
|
const spaceIndex = trimmed.indexOf(" ");
|
|
21677
21703
|
if (spaceIndex <= 0) {
|
|
@@ -21680,8 +21706,8 @@ function normalizeActionKey(actionKey2) {
|
|
|
21680
21706
|
);
|
|
21681
21707
|
}
|
|
21682
21708
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
21683
|
-
const
|
|
21684
|
-
return `${method}:${
|
|
21709
|
+
const path103 = trimmed.slice(spaceIndex + 1).trim();
|
|
21710
|
+
return `${method}:${path103.startsWith("/") ? path103 : `/${path103}`}`;
|
|
21685
21711
|
}
|
|
21686
21712
|
async function applyGatewayPublicRoutes(client, projectId, routes, options) {
|
|
21687
21713
|
const applied = [];
|
|
@@ -22160,7 +22186,7 @@ async function upsertGatewayPlansFromManifest(client, config2, projectId, plans,
|
|
|
22160
22186
|
|
|
22161
22187
|
// src/cli/platform/helpers/openapi-gateway-servers.ts
|
|
22162
22188
|
import { mkdir as mkdir18, readFile as readFile24, writeFile as writeFile22 } from "node:fs/promises";
|
|
22163
|
-
import
|
|
22189
|
+
import path74 from "node:path";
|
|
22164
22190
|
import YAML3 from "yaml";
|
|
22165
22191
|
var GATEWAY_URL_ENV_KEY = "APITOGO_GATEWAY_URL";
|
|
22166
22192
|
var PUBLISH_OPENAPI_RELATIVE = ".apitogo/openapi-publish.json";
|
|
@@ -22192,7 +22218,7 @@ async function resolveProjectGatewayUrl(client, projectId) {
|
|
|
22192
22218
|
}
|
|
22193
22219
|
async function readOpenApiDocument(filePath) {
|
|
22194
22220
|
const content = await readFile24(filePath, "utf8");
|
|
22195
|
-
const ext =
|
|
22221
|
+
const ext = path74.extname(filePath).toLowerCase();
|
|
22196
22222
|
const parsed = ext === ".json" ? JSON.parse(content) : YAML3.parse(content);
|
|
22197
22223
|
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
22198
22224
|
throw new Error(`OpenAPI document must be an object: ${filePath}`);
|
|
@@ -22200,13 +22226,13 @@ async function readOpenApiDocument(filePath) {
|
|
|
22200
22226
|
return parsed;
|
|
22201
22227
|
}
|
|
22202
22228
|
async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApiPath, gatewayUrl) {
|
|
22203
|
-
const site =
|
|
22204
|
-
const source =
|
|
22229
|
+
const site = path74.resolve(siteDirectory);
|
|
22230
|
+
const source = path74.resolve(sourceOpenApiPath);
|
|
22205
22231
|
const relativeInput = PUBLISH_OPENAPI_RELATIVE;
|
|
22206
|
-
const outputPath =
|
|
22232
|
+
const outputPath = path74.join(site, ...relativeInput.split("/"));
|
|
22207
22233
|
const doc = await readOpenApiDocument(source);
|
|
22208
22234
|
const rewritten = withGatewayServers(doc, gatewayUrl);
|
|
22209
|
-
await mkdir18(
|
|
22235
|
+
await mkdir18(path74.dirname(outputPath), { recursive: true });
|
|
22210
22236
|
await writeFile22(
|
|
22211
22237
|
outputPath,
|
|
22212
22238
|
`${JSON.stringify(rewritten, null, 2)}
|
|
@@ -22216,8 +22242,8 @@ async function materializePublishOpenApiWithGateway(siteDirectory, sourceOpenApi
|
|
|
22216
22242
|
return { outputPath, relativeInput };
|
|
22217
22243
|
}
|
|
22218
22244
|
async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
22219
|
-
const configPath =
|
|
22220
|
-
|
|
22245
|
+
const configPath = path74.join(
|
|
22246
|
+
path74.resolve(siteDirectory),
|
|
22221
22247
|
APITOGO_CONFIG_FILENAME2
|
|
22222
22248
|
);
|
|
22223
22249
|
const raw = await readFile24(configPath, "utf8");
|
|
@@ -22259,7 +22285,7 @@ async function pointSiteApisAtPublishOpenApi(siteDirectory, relativeInput) {
|
|
|
22259
22285
|
};
|
|
22260
22286
|
}
|
|
22261
22287
|
async function prepareOpenApiServersForGatewayBuild(options) {
|
|
22262
|
-
const siteDirectory =
|
|
22288
|
+
const siteDirectory = path74.resolve(options.siteDirectory);
|
|
22263
22289
|
let openApiPath = resolveBackendOpenApiPath(
|
|
22264
22290
|
options.manifest?.backend?.openApiPath,
|
|
22265
22291
|
{
|
|
@@ -22273,7 +22299,7 @@ async function prepareOpenApiServersForGatewayBuild(options) {
|
|
|
22273
22299
|
if (!openApiPath) {
|
|
22274
22300
|
try {
|
|
22275
22301
|
const raw = await readFile24(
|
|
22276
|
-
|
|
22302
|
+
path74.join(siteDirectory, APITOGO_CONFIG_FILENAME2),
|
|
22277
22303
|
"utf8"
|
|
22278
22304
|
);
|
|
22279
22305
|
const config2 = JSON.parse(raw);
|
|
@@ -22302,8 +22328,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22302
22328
|
const trimmed = actionKey2.trim();
|
|
22303
22329
|
if (trimmed.includes(":")) {
|
|
22304
22330
|
const [method2, ...pathParts] = trimmed.split(":");
|
|
22305
|
-
const
|
|
22306
|
-
return `${method2.toLowerCase()}:${
|
|
22331
|
+
const path104 = pathParts.join(":").trim();
|
|
22332
|
+
return `${method2.toLowerCase()}:${path104.startsWith("/") ? path104 : `/${path104}`}`;
|
|
22307
22333
|
}
|
|
22308
22334
|
const spaceIndex = trimmed.indexOf(" ");
|
|
22309
22335
|
if (spaceIndex <= 0) {
|
|
@@ -22312,8 +22338,8 @@ function normalizeActionKeyFormat(actionKey2) {
|
|
|
22312
22338
|
);
|
|
22313
22339
|
}
|
|
22314
22340
|
const method = trimmed.slice(0, spaceIndex).trim().toLowerCase();
|
|
22315
|
-
const
|
|
22316
|
-
return `${method}:${
|
|
22341
|
+
const path103 = trimmed.slice(spaceIndex + 1).trim();
|
|
22342
|
+
return `${method}:${path103.startsWith("/") ? path103 : `/${path103}`}`;
|
|
22317
22343
|
}
|
|
22318
22344
|
function normalizePublicRoute(route) {
|
|
22319
22345
|
const trimmed = route.trim();
|
|
@@ -22347,10 +22373,10 @@ function collectManifestPublicActionKeys(gateway) {
|
|
|
22347
22373
|
|
|
22348
22374
|
// src/cli/platform/helpers/publish-ledger.ts
|
|
22349
22375
|
import { mkdir as mkdir19, readFile as readFile25, writeFile as writeFile23 } from "node:fs/promises";
|
|
22350
|
-
import
|
|
22376
|
+
import path75 from "node:path";
|
|
22351
22377
|
var PUBLISH_LEDGER_RELATIVE_PATH = ".apitogo/publish-state.json";
|
|
22352
22378
|
function publishLedgerPath(siteDirectory) {
|
|
22353
|
-
return
|
|
22379
|
+
return path75.join(path75.resolve(siteDirectory), PUBLISH_LEDGER_RELATIVE_PATH);
|
|
22354
22380
|
}
|
|
22355
22381
|
async function readPublishLedger(siteDirectory) {
|
|
22356
22382
|
const filePath = publishLedgerPath(siteDirectory);
|
|
@@ -22367,7 +22393,7 @@ async function readPublishLedger(siteDirectory) {
|
|
|
22367
22393
|
}
|
|
22368
22394
|
async function writePublishLedger(siteDirectory, ledger) {
|
|
22369
22395
|
const filePath = publishLedgerPath(siteDirectory);
|
|
22370
|
-
await mkdir19(
|
|
22396
|
+
await mkdir19(path75.dirname(filePath), { recursive: true });
|
|
22371
22397
|
const next = {
|
|
22372
22398
|
...ledger,
|
|
22373
22399
|
version: 1,
|
|
@@ -22889,7 +22915,7 @@ async function createProjectWithWarmPoolRetry(client, body, options) {
|
|
|
22889
22915
|
import { spawn as spawn4 } from "node:child_process";
|
|
22890
22916
|
import { mkdtemp, readdir as readdir2, rm as rm11 } from "node:fs/promises";
|
|
22891
22917
|
import { tmpdir } from "node:os";
|
|
22892
|
-
import
|
|
22918
|
+
import path76 from "node:path";
|
|
22893
22919
|
async function directoryHasRuntimeConfig(dir) {
|
|
22894
22920
|
if (!await pathExists2(dir)) {
|
|
22895
22921
|
return false;
|
|
@@ -22932,20 +22958,20 @@ function runDotnetPublish(projectDir, outputDir) {
|
|
|
22932
22958
|
async function findCsproj(projectDir) {
|
|
22933
22959
|
const entries = await readdir2(projectDir);
|
|
22934
22960
|
const csproj = entries.find((name) => name.endsWith(".csproj"));
|
|
22935
|
-
return csproj ?
|
|
22961
|
+
return csproj ? path76.join(projectDir, csproj) : null;
|
|
22936
22962
|
}
|
|
22937
22963
|
async function prepareBackendPackagingDirectory(args) {
|
|
22938
|
-
const sourceDirectory =
|
|
22964
|
+
const sourceDirectory = path76.resolve(args.sourceDirectory);
|
|
22939
22965
|
if (args.publishDirectory?.trim()) {
|
|
22940
22966
|
return {
|
|
22941
|
-
directory:
|
|
22967
|
+
directory: path76.resolve(args.publishDirectory),
|
|
22942
22968
|
packagingMode: "published"
|
|
22943
22969
|
};
|
|
22944
22970
|
}
|
|
22945
22971
|
if (await directoryHasRuntimeConfig(sourceDirectory)) {
|
|
22946
22972
|
return { directory: sourceDirectory, packagingMode: "published" };
|
|
22947
22973
|
}
|
|
22948
|
-
const publishSubdir =
|
|
22974
|
+
const publishSubdir = path76.join(sourceDirectory, "publish");
|
|
22949
22975
|
if (await directoryHasRuntimeConfig(publishSubdir)) {
|
|
22950
22976
|
return { directory: publishSubdir, packagingMode: "published" };
|
|
22951
22977
|
}
|
|
@@ -22957,9 +22983,9 @@ async function prepareBackendPackagingDirectory(args) {
|
|
|
22957
22983
|
return { directory: sourceDirectory, packagingMode: "source" };
|
|
22958
22984
|
}
|
|
22959
22985
|
const tempRoot = await mkdtemp(
|
|
22960
|
-
|
|
22986
|
+
path76.join(tmpdir(), "apitogo-dotnet-publish-")
|
|
22961
22987
|
);
|
|
22962
|
-
const outputDir =
|
|
22988
|
+
const outputDir = path76.join(tempRoot, "publish");
|
|
22963
22989
|
const result = await runDotnetPublish(sourceDirectory, outputDir);
|
|
22964
22990
|
if (result.exitCode !== 0) {
|
|
22965
22991
|
await rm11(tempRoot, { recursive: true, force: true });
|
|
@@ -23005,12 +23031,12 @@ function formatJobStatusResponse(options) {
|
|
|
23005
23031
|
// src/cli/platform/helpers/zip.ts
|
|
23006
23032
|
import { createReadStream as createReadStream2, createWriteStream as createWriteStream2, promises as fs9 } from "node:fs";
|
|
23007
23033
|
import { tmpdir as tmpdir2 } from "node:os";
|
|
23008
|
-
import
|
|
23034
|
+
import path77 from "node:path";
|
|
23009
23035
|
import { ZipArchive } from "archiver";
|
|
23010
23036
|
async function packageBackendDirectory(sourceDirectory) {
|
|
23011
|
-
const resolved =
|
|
23037
|
+
const resolved = path77.resolve(sourceDirectory);
|
|
23012
23038
|
const files = await collectPackageableFiles(resolved);
|
|
23013
|
-
const zipPath =
|
|
23039
|
+
const zipPath = path77.join(
|
|
23014
23040
|
tmpdir2(),
|
|
23015
23041
|
`apitogo-backend-${Date.now()}-${Math.random().toString(36).slice(2)}.zip`
|
|
23016
23042
|
);
|
|
@@ -23022,8 +23048,8 @@ async function packageBackendDirectory(sourceDirectory) {
|
|
|
23022
23048
|
output4.on("error", reject);
|
|
23023
23049
|
archive.pipe(output4);
|
|
23024
23050
|
for (const rel2 of files) {
|
|
23025
|
-
archive.append(createReadStream2(
|
|
23026
|
-
name: rel2.split(
|
|
23051
|
+
archive.append(createReadStream2(path77.join(resolved, rel2)), {
|
|
23052
|
+
name: rel2.split(path77.sep).join("/")
|
|
23027
23053
|
});
|
|
23028
23054
|
}
|
|
23029
23055
|
void archive.finalize();
|
|
@@ -24524,11 +24550,11 @@ async function resolveProjectIdForPublish(client, config2, args, wait, progress,
|
|
|
24524
24550
|
}
|
|
24525
24551
|
|
|
24526
24552
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
24527
|
-
import
|
|
24553
|
+
import path81 from "node:path";
|
|
24528
24554
|
|
|
24529
24555
|
// src/cli/platform/helpers/dev-portal-site-api-url.ts
|
|
24530
24556
|
import { readdir as readdir3, readFile as readFile26, writeFile as writeFile24 } from "node:fs/promises";
|
|
24531
|
-
import
|
|
24557
|
+
import path78 from "node:path";
|
|
24532
24558
|
var SITE_API_BASE_URL_ENV_KEY = "VITE_APITOGO_AUTHENTICATION_API_BASE_URL";
|
|
24533
24559
|
var PLACEHOLDER_HOST_MARKERS = [
|
|
24534
24560
|
"dp-example.azurecontainerapps.io",
|
|
@@ -24549,10 +24575,10 @@ function isPlaceholderDevPortalApiUrl(apiBaseUrl) {
|
|
|
24549
24575
|
return PLACEHOLDER_HOST_MARKERS.some((marker) => normalized.includes(marker));
|
|
24550
24576
|
}
|
|
24551
24577
|
async function readSiteApiBaseUrl(sourceDirectory) {
|
|
24552
|
-
const resolved =
|
|
24578
|
+
const resolved = path78.resolve(sourceDirectory);
|
|
24553
24579
|
for (const envFile of [".env", ".env.production"]) {
|
|
24554
24580
|
try {
|
|
24555
|
-
const content = await readFile26(
|
|
24581
|
+
const content = await readFile26(path78.join(resolved, envFile), "utf8");
|
|
24556
24582
|
const lines = [...content.matchAll(ENV_LINE_GLOBAL_RE)];
|
|
24557
24583
|
if (lines.length === 0) {
|
|
24558
24584
|
continue;
|
|
@@ -24577,11 +24603,11 @@ async function readSiteApiBaseUrl(sourceDirectory) {
|
|
|
24577
24603
|
return null;
|
|
24578
24604
|
}
|
|
24579
24605
|
async function patchSiteApiBaseUrl(sourceDirectory, apiBaseUrl) {
|
|
24580
|
-
const resolved =
|
|
24606
|
+
const resolved = path78.resolve(sourceDirectory);
|
|
24581
24607
|
const line2 = `${SITE_API_BASE_URL_ENV_KEY}=${apiBaseUrl}`;
|
|
24582
24608
|
let patchedExisting = false;
|
|
24583
24609
|
for (const envFile of [".env.production", ".env"]) {
|
|
24584
|
-
const envPath =
|
|
24610
|
+
const envPath = path78.join(resolved, envFile);
|
|
24585
24611
|
try {
|
|
24586
24612
|
const content = await readFile26(envPath, "utf8");
|
|
24587
24613
|
const withoutAssignments = content.replace(ENV_LINE_GLOBAL_RE, "").replace(/\n{3,}/g, "\n\n").trimEnd();
|
|
@@ -24595,7 +24621,7 @@ ${line2}
|
|
|
24595
24621
|
}
|
|
24596
24622
|
}
|
|
24597
24623
|
if (!patchedExisting) {
|
|
24598
|
-
await writeFile24(
|
|
24624
|
+
await writeFile24(path78.join(resolved, ".env"), `${line2}
|
|
24599
24625
|
`);
|
|
24600
24626
|
}
|
|
24601
24627
|
}
|
|
@@ -24603,7 +24629,7 @@ function tryProjectId(explicit, manifestProjectId, config2) {
|
|
|
24603
24629
|
return explicit?.trim() || manifestProjectId?.trim() || config2.defaultProjectId?.trim() || void 0;
|
|
24604
24630
|
}
|
|
24605
24631
|
async function ensureLiveSiteApiBaseUrlForBuild(_client, config2, args, resolveFromProject) {
|
|
24606
|
-
const sourceDirectory =
|
|
24632
|
+
const sourceDirectory = path78.resolve(args.sourceDirectory);
|
|
24607
24633
|
const explicit = args.apiBaseUrl?.trim();
|
|
24608
24634
|
if (explicit && !isPlaceholderDevPortalApiUrl(explicit)) {
|
|
24609
24635
|
await patchSiteApiBaseUrl(sourceDirectory, explicit);
|
|
@@ -24639,7 +24665,7 @@ async function* walkFiles(root) {
|
|
|
24639
24665
|
return;
|
|
24640
24666
|
}
|
|
24641
24667
|
for (const entry of entries) {
|
|
24642
|
-
const full =
|
|
24668
|
+
const full = path78.join(root, entry.name);
|
|
24643
24669
|
if (entry.isDirectory()) {
|
|
24644
24670
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
24645
24671
|
continue;
|
|
@@ -24651,8 +24677,8 @@ async function* walkFiles(root) {
|
|
|
24651
24677
|
}
|
|
24652
24678
|
}
|
|
24653
24679
|
async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiBaseUrl) {
|
|
24654
|
-
const dist =
|
|
24655
|
-
const siteRoot =
|
|
24680
|
+
const dist = path78.resolve(distDirectory);
|
|
24681
|
+
const siteRoot = path78.dirname(dist);
|
|
24656
24682
|
const fromEnv = expectedApiBaseUrl?.trim() || await readSiteApiBaseUrl(siteRoot) || await readSiteApiBaseUrl(dist);
|
|
24657
24683
|
if (!fromEnv || isPlaceholderDevPortalApiUrl(fromEnv)) {
|
|
24658
24684
|
throw new Error(
|
|
@@ -24688,7 +24714,7 @@ async function assertDeployableDistHasLiveApiBaseUrl(distDirectory, expectedApiB
|
|
|
24688
24714
|
|
|
24689
24715
|
// src/cli/platform/tools/dev-portal.ts
|
|
24690
24716
|
import { promises as fs11 } from "node:fs";
|
|
24691
|
-
import
|
|
24717
|
+
import path80 from "node:path";
|
|
24692
24718
|
|
|
24693
24719
|
// src/cli/platform/helpers/dev-portal-backend-job.ts
|
|
24694
24720
|
var DEV_PORTAL_BACKEND_UPDATE_RESOURCE_TYPE = "DevPortalBackendUpdate";
|
|
@@ -24798,7 +24824,7 @@ async function snapshotBackendUpdateJobIds(client, projectId) {
|
|
|
24798
24824
|
// src/cli/platform/helpers/tarball.ts
|
|
24799
24825
|
import { createReadStream as createReadStream3, createWriteStream as createWriteStream3, promises as fs10 } from "node:fs";
|
|
24800
24826
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
24801
|
-
import
|
|
24827
|
+
import path79 from "node:path";
|
|
24802
24828
|
import { TarArchive } from "archiver";
|
|
24803
24829
|
var DEV_PORTAL_DEPLOY_ARCHIVE_ROOT = "dist";
|
|
24804
24830
|
function normalizeArchiveRoot(archiveRoot) {
|
|
@@ -24809,10 +24835,10 @@ function normalizeArchiveRoot(archiveRoot) {
|
|
|
24809
24835
|
return `${trimmed}/`;
|
|
24810
24836
|
}
|
|
24811
24837
|
async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
24812
|
-
const resolved =
|
|
24838
|
+
const resolved = path79.resolve(sourceDirectory);
|
|
24813
24839
|
const files = await collectPackageableFiles(resolved);
|
|
24814
24840
|
const entryPrefix = options?.archiveRoot ? normalizeArchiveRoot(options.archiveRoot) : "";
|
|
24815
|
-
const archivePath =
|
|
24841
|
+
const archivePath = path79.join(
|
|
24816
24842
|
tmpdir3(),
|
|
24817
24843
|
`apitogo-docs-${Date.now()}-${Math.random().toString(36).slice(2)}.tgz`
|
|
24818
24844
|
);
|
|
@@ -24824,8 +24850,8 @@ async function packageDirectoryAsTarGz(sourceDirectory, options) {
|
|
|
24824
24850
|
output4.on("error", reject);
|
|
24825
24851
|
archive.pipe(output4);
|
|
24826
24852
|
for (const rel2 of files) {
|
|
24827
|
-
const entryName = entryPrefix + rel2.split(
|
|
24828
|
-
archive.append(createReadStream3(
|
|
24853
|
+
const entryName = entryPrefix + rel2.split(path79.sep).join("/");
|
|
24854
|
+
archive.append(createReadStream3(path79.join(resolved, rel2)), {
|
|
24829
24855
|
name: entryName
|
|
24830
24856
|
});
|
|
24831
24857
|
}
|
|
@@ -25067,7 +25093,7 @@ function validateDeployArchiveInput(args) {
|
|
|
25067
25093
|
async function resolveDevPortalArchive(args) {
|
|
25068
25094
|
validateDeployArchiveInput(args);
|
|
25069
25095
|
if (args.archivePath?.trim()) {
|
|
25070
|
-
const archivePath =
|
|
25096
|
+
const archivePath = path80.resolve(args.archivePath.trim());
|
|
25071
25097
|
const stat7 = await fs11.stat(archivePath).catch(() => null);
|
|
25072
25098
|
if (!stat7?.isFile()) {
|
|
25073
25099
|
throw new Error(`archivePath is not a file: ${archivePath}`);
|
|
@@ -25132,7 +25158,7 @@ async function handleDeployDevPortal(client, config2, args, progress) {
|
|
|
25132
25158
|
// src/cli/platform/tools/dev-portal-site-build.ts
|
|
25133
25159
|
async function handleBuildDevPortalSite(client, config2, args, progress) {
|
|
25134
25160
|
const buildProgress = progress?.child("Build dev portal site");
|
|
25135
|
-
const sourceDirectory =
|
|
25161
|
+
const sourceDirectory = path81.resolve(args.sourceDirectory);
|
|
25136
25162
|
await buildProgress?.onStep("Ensuring live portal API URL");
|
|
25137
25163
|
const apiBaseUrl = await ensureLiveSiteApiBaseUrlForBuild(
|
|
25138
25164
|
client,
|
|
@@ -26628,7 +26654,7 @@ function resultLooksFailed(payload) {
|
|
|
26628
26654
|
return parsed.status === "failed" || parsed.status === "blocked";
|
|
26629
26655
|
}
|
|
26630
26656
|
async function apply(argv) {
|
|
26631
|
-
const sourceDirectory =
|
|
26657
|
+
const sourceDirectory = path82.resolve(process.cwd(), argv.dir);
|
|
26632
26658
|
let config2;
|
|
26633
26659
|
try {
|
|
26634
26660
|
config2 = loadConfig();
|
|
@@ -26698,7 +26724,7 @@ async function apply(argv) {
|
|
|
26698
26724
|
if (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_not_found") {
|
|
26699
26725
|
const resolution = await resolveProjectNotFoundInteractively(
|
|
26700
26726
|
parsed,
|
|
26701
|
-
|
|
26727
|
+
path82.basename(sourceDirectory)
|
|
26702
26728
|
);
|
|
26703
26729
|
if (resolution) {
|
|
26704
26730
|
effectiveProjectId = void 0;
|
|
@@ -26718,7 +26744,7 @@ async function apply(argv) {
|
|
|
26718
26744
|
while (canPromptInteractively && parsed?.status === "blocked" && parsed.reason === "project_name_exists") {
|
|
26719
26745
|
const resolution = await resolveProjectNameExistsInteractively(
|
|
26720
26746
|
parsed,
|
|
26721
|
-
effectiveProjectName ??
|
|
26747
|
+
effectiveProjectName ?? path82.basename(sourceDirectory)
|
|
26722
26748
|
);
|
|
26723
26749
|
if (!resolution) {
|
|
26724
26750
|
break;
|
|
@@ -26790,7 +26816,7 @@ async function apply(argv) {
|
|
|
26790
26816
|
|
|
26791
26817
|
// src/cli/deploy/command.ts
|
|
26792
26818
|
init_invariant();
|
|
26793
|
-
import
|
|
26819
|
+
import path84 from "node:path";
|
|
26794
26820
|
|
|
26795
26821
|
// src/cli/deploy/v2.ts
|
|
26796
26822
|
import { rm as rm12 } from "node:fs/promises";
|
|
@@ -26798,7 +26824,7 @@ init_invariant();
|
|
|
26798
26824
|
|
|
26799
26825
|
// src/cli/portal/report.ts
|
|
26800
26826
|
import { access as access13 } from "node:fs/promises";
|
|
26801
|
-
import
|
|
26827
|
+
import path83 from "node:path";
|
|
26802
26828
|
|
|
26803
26829
|
// src/cli/deploy/gateway.ts
|
|
26804
26830
|
import { createHash as createHash4 } from "node:crypto";
|
|
@@ -27077,7 +27103,7 @@ async function planPortalService(resolved, ledger) {
|
|
|
27077
27103
|
const hash2 = await portalBuildHash(resolved, prepared);
|
|
27078
27104
|
const previous = stepOf(ledger, "portal", "build");
|
|
27079
27105
|
const built = await exists4(
|
|
27080
|
-
|
|
27106
|
+
path83.join(resolved.state.buildDir, "index.html")
|
|
27081
27107
|
);
|
|
27082
27108
|
if (previous?.status === "succeeded" && previous.hash === hash2 && built) {
|
|
27083
27109
|
return {
|
|
@@ -27384,7 +27410,7 @@ async function statusV2(dir, only, options = {}) {
|
|
|
27384
27410
|
if (service === "portal") {
|
|
27385
27411
|
const build2 = stepOf(ledger, "portal", "build");
|
|
27386
27412
|
const built = await exists4(
|
|
27387
|
-
|
|
27413
|
+
path83.join(resolved.state.buildDir, "index.html")
|
|
27388
27414
|
);
|
|
27389
27415
|
const state = build2?.status === "failed" ? "build-failed" : build2?.status === "succeeded" && built ? "built" : "not-built";
|
|
27390
27416
|
services.push({
|
|
@@ -27395,7 +27421,7 @@ async function statusV2(dir, only, options = {}) {
|
|
|
27395
27421
|
...build2?.finishedAt ? [`last build: ${build2.finishedAt}`] : [],
|
|
27396
27422
|
...build2?.status === "failed" ? [`error: ${build2.error ?? "unknown"}`] : [],
|
|
27397
27423
|
...state === "built" ? [
|
|
27398
|
-
`output: ${
|
|
27424
|
+
`output: ${path83.relative(resolved.configDir, resolved.state.buildDir)}`
|
|
27399
27425
|
] : [],
|
|
27400
27426
|
...url2 ? [`url: ${url2}`] : ["url: not known (portal is not deployed yet)"]
|
|
27401
27427
|
]
|
|
@@ -27663,7 +27689,7 @@ async function deployProject(argv) {
|
|
|
27663
27689
|
const config2 = loadConfig();
|
|
27664
27690
|
const output4 = await deployV2(
|
|
27665
27691
|
{
|
|
27666
|
-
dir:
|
|
27692
|
+
dir: path84.resolve(process.cwd(), argv.dir),
|
|
27667
27693
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
27668
27694
|
projectId: argv.projectId,
|
|
27669
27695
|
env: argv.env,
|
|
@@ -27744,7 +27770,7 @@ var deploy_default = {
|
|
|
27744
27770
|
}),
|
|
27745
27771
|
handler: async (argv) => {
|
|
27746
27772
|
await captureEvent({ argv, event: "apitogo deploy" });
|
|
27747
|
-
if (await isConfigV2(
|
|
27773
|
+
if (await isConfigV2(path85.resolve(process.cwd(), argv.dir))) {
|
|
27748
27774
|
await deployProject(argv);
|
|
27749
27775
|
return;
|
|
27750
27776
|
}
|
|
@@ -27754,7 +27780,7 @@ var deploy_default = {
|
|
|
27754
27780
|
|
|
27755
27781
|
// src/cli/export/handler.ts
|
|
27756
27782
|
import { mkdir as mkdir20, writeFile as writeFile25 } from "node:fs/promises";
|
|
27757
|
-
import
|
|
27783
|
+
import path86 from "node:path";
|
|
27758
27784
|
init_invariant();
|
|
27759
27785
|
var ExportError = class extends ApitogoError {
|
|
27760
27786
|
constructor(message, developerHint) {
|
|
@@ -27768,7 +27794,7 @@ async function exportOpenApi(args, deps) {
|
|
|
27768
27794
|
`Cannot export "${args.target}".`,
|
|
27769
27795
|
"Only `apitogo export openapi` exists."
|
|
27770
27796
|
);
|
|
27771
|
-
const dir =
|
|
27797
|
+
const dir = path86.resolve(process.cwd(), args.dir ?? ".");
|
|
27772
27798
|
if (!await isConfigV2(dir))
|
|
27773
27799
|
throw new ExportError(
|
|
27774
27800
|
"This command needs a config version 2 project.",
|
|
@@ -27793,8 +27819,8 @@ async function exportOpenApi(args, deps) {
|
|
|
27793
27819
|
throw error;
|
|
27794
27820
|
}
|
|
27795
27821
|
if (!args.out) return { text };
|
|
27796
|
-
const file =
|
|
27797
|
-
await mkdir20(
|
|
27822
|
+
const file = path86.resolve(process.cwd(), args.out);
|
|
27823
|
+
await mkdir20(path86.dirname(file), { recursive: true });
|
|
27798
27824
|
await writeFile25(file, text);
|
|
27799
27825
|
return { text, file };
|
|
27800
27826
|
}
|
|
@@ -27845,15 +27871,15 @@ var export_default = {
|
|
|
27845
27871
|
};
|
|
27846
27872
|
|
|
27847
27873
|
// src/cli/init/handler.ts
|
|
27848
|
-
import
|
|
27874
|
+
import path90 from "node:path";
|
|
27849
27875
|
|
|
27850
27876
|
// src/cli/scaffold/run-scaffold-discovery.ts
|
|
27851
27877
|
import { access as access15, readFile as readFile30, writeFile as writeFile27 } from "node:fs/promises";
|
|
27852
|
-
import
|
|
27878
|
+
import path89 from "node:path";
|
|
27853
27879
|
|
|
27854
27880
|
// src/cli/scaffold/detect-backend.ts
|
|
27855
27881
|
import { readdir as readdir4, readFile as readFile28 } from "node:fs/promises";
|
|
27856
|
-
import
|
|
27882
|
+
import path87 from "node:path";
|
|
27857
27883
|
var DEFAULT_RUNTIME_VERSION = {
|
|
27858
27884
|
dotnet: "DOTNET_10",
|
|
27859
27885
|
nodejs: "NODE_22_LTS",
|
|
@@ -27899,15 +27925,15 @@ function isRunnableNodePackage(pkg) {
|
|
|
27899
27925
|
return typeof scripts.start === "string" || typeof pkg.main === "string";
|
|
27900
27926
|
}
|
|
27901
27927
|
async function detectParentBackend(siteDirectory) {
|
|
27902
|
-
const site =
|
|
27903
|
-
const directory =
|
|
27928
|
+
const site = path87.resolve(siteDirectory);
|
|
27929
|
+
const directory = path87.dirname(site);
|
|
27904
27930
|
if (directory === site) {
|
|
27905
27931
|
return void 0;
|
|
27906
27932
|
}
|
|
27907
27933
|
const files = await listFiles(directory);
|
|
27908
27934
|
const toResult = (runtime, runtimeVersion, marker) => ({
|
|
27909
27935
|
directory,
|
|
27910
|
-
sourceDirectory:
|
|
27936
|
+
sourceDirectory: path87.relative(site, directory).split(path87.sep).join("/") || ".",
|
|
27911
27937
|
runtime,
|
|
27912
27938
|
runtimeVersion,
|
|
27913
27939
|
marker
|
|
@@ -27915,7 +27941,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27915
27941
|
const csproj = files.find((f) => f.endsWith(".csproj"));
|
|
27916
27942
|
const solution = files.find((f) => /\.slnx?$/.test(f));
|
|
27917
27943
|
if (csproj || solution) {
|
|
27918
|
-
const content = csproj ? await readText(
|
|
27944
|
+
const content = csproj ? await readText(path87.join(directory, csproj)) : void 0;
|
|
27919
27945
|
return toResult(
|
|
27920
27946
|
"dotnet",
|
|
27921
27947
|
dotnetVersionFromCsproj(content),
|
|
@@ -27923,7 +27949,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27923
27949
|
);
|
|
27924
27950
|
}
|
|
27925
27951
|
if (files.includes("package.json")) {
|
|
27926
|
-
const raw = await readText(
|
|
27952
|
+
const raw = await readText(path87.join(directory, "package.json"));
|
|
27927
27953
|
try {
|
|
27928
27954
|
const pkg = JSON.parse(raw ?? "");
|
|
27929
27955
|
if (isRunnableNodePackage(pkg)) {
|
|
@@ -27938,7 +27964,7 @@ async function detectParentBackend(siteDirectory) {
|
|
|
27938
27964
|
}
|
|
27939
27965
|
const pythonMarker = PYTHON_MARKERS.find((m) => files.includes(m));
|
|
27940
27966
|
if (pythonMarker) {
|
|
27941
|
-
const versionSource = await readText(
|
|
27967
|
+
const versionSource = await readText(path87.join(directory, ".python-version")) ?? (pythonMarker === "pyproject.toml" ? (await readText(path87.join(directory, pythonMarker)))?.match(
|
|
27942
27968
|
/requires-python\s*=\s*"([^"]+)"/
|
|
27943
27969
|
)?.[1] : void 0);
|
|
27944
27970
|
return toResult(
|
|
@@ -27961,7 +27987,7 @@ import {
|
|
|
27961
27987
|
symlink as symlink2,
|
|
27962
27988
|
writeFile as writeFile26
|
|
27963
27989
|
} from "node:fs/promises";
|
|
27964
|
-
import
|
|
27990
|
+
import path88 from "node:path";
|
|
27965
27991
|
var DOCS_DIR_WHITELIST = [
|
|
27966
27992
|
"docs",
|
|
27967
27993
|
"documents",
|
|
@@ -27998,14 +28024,14 @@ async function isDirectory2(filePath) {
|
|
|
27998
28024
|
}
|
|
27999
28025
|
}
|
|
28000
28026
|
function toPosix3(value) {
|
|
28001
|
-
return value.split(
|
|
28027
|
+
return value.split(path88.sep).join(path88.posix.sep);
|
|
28002
28028
|
}
|
|
28003
28029
|
function isWhitelistedDirName(name) {
|
|
28004
28030
|
return DOCS_DIR_WHITELIST.includes(name.toLowerCase());
|
|
28005
28031
|
}
|
|
28006
28032
|
function isInside2(parent, child) {
|
|
28007
|
-
const relative =
|
|
28008
|
-
return relative === "" || !relative.startsWith("..") && !
|
|
28033
|
+
const relative = path88.relative(parent, child);
|
|
28034
|
+
return relative === "" || !relative.startsWith("..") && !path88.isAbsolute(relative);
|
|
28009
28035
|
}
|
|
28010
28036
|
async function collectMarkdownFiles(dir, excludeDir) {
|
|
28011
28037
|
const files = [];
|
|
@@ -28019,9 +28045,9 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
28019
28045
|
if (entry.name.startsWith(".")) {
|
|
28020
28046
|
continue;
|
|
28021
28047
|
}
|
|
28022
|
-
const full =
|
|
28048
|
+
const full = path88.join(dir, entry.name);
|
|
28023
28049
|
if (entry.isDirectory()) {
|
|
28024
|
-
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir &&
|
|
28050
|
+
if (SKIP_SEARCH_DIRS.has(entry.name) || entry.isSymbolicLink() || excludeDir && path88.resolve(full) === excludeDir) {
|
|
28025
28051
|
continue;
|
|
28026
28052
|
}
|
|
28027
28053
|
files.push(...await collectMarkdownFiles(full, excludeDir));
|
|
@@ -28034,11 +28060,11 @@ async function collectMarkdownFiles(dir, excludeDir) {
|
|
|
28034
28060
|
return files;
|
|
28035
28061
|
}
|
|
28036
28062
|
async function collectSearchRoots(siteDirectory) {
|
|
28037
|
-
const site =
|
|
28038
|
-
const parent =
|
|
28063
|
+
const site = path88.resolve(siteDirectory);
|
|
28064
|
+
const parent = path88.dirname(site);
|
|
28039
28065
|
const roots = [];
|
|
28040
28066
|
const add = (dir) => {
|
|
28041
|
-
const resolved =
|
|
28067
|
+
const resolved = path88.resolve(dir);
|
|
28042
28068
|
if (!roots.includes(resolved)) {
|
|
28043
28069
|
roots.push(resolved);
|
|
28044
28070
|
}
|
|
@@ -28051,7 +28077,7 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
28051
28077
|
if (!entry.isDirectory() || SKIP_SEARCH_DIRS.has(entry.name)) {
|
|
28052
28078
|
continue;
|
|
28053
28079
|
}
|
|
28054
|
-
add(
|
|
28080
|
+
add(path88.join(parent, entry.name));
|
|
28055
28081
|
}
|
|
28056
28082
|
} catch {
|
|
28057
28083
|
}
|
|
@@ -28060,13 +28086,13 @@ async function collectSearchRoots(siteDirectory) {
|
|
|
28060
28086
|
return roots;
|
|
28061
28087
|
}
|
|
28062
28088
|
async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
28063
|
-
const site =
|
|
28064
|
-
const sitePages =
|
|
28089
|
+
const site = path88.resolve(siteDirectory);
|
|
28090
|
+
const sitePages = path88.join(site, PAGES_DIR);
|
|
28065
28091
|
const searchedDirectories = await collectSearchRoots(site);
|
|
28066
28092
|
const directories = [];
|
|
28067
28093
|
const seen = /* @__PURE__ */ new Set();
|
|
28068
28094
|
const consider = async (dir) => {
|
|
28069
|
-
const resolved =
|
|
28095
|
+
const resolved = path88.resolve(dir);
|
|
28070
28096
|
if (resolved === site || seen.has(resolved) || isInside2(sitePages, resolved)) {
|
|
28071
28097
|
return;
|
|
28072
28098
|
}
|
|
@@ -28083,7 +28109,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
28083
28109
|
directories.push({ sourceDirectory: resolved, files });
|
|
28084
28110
|
};
|
|
28085
28111
|
for (const root of searchedDirectories) {
|
|
28086
|
-
if (isWhitelistedDirName(
|
|
28112
|
+
if (isWhitelistedDirName(path88.basename(root))) {
|
|
28087
28113
|
await consider(root);
|
|
28088
28114
|
}
|
|
28089
28115
|
try {
|
|
@@ -28095,7 +28121,7 @@ async function discoverNearbyDocsDirectories(siteDirectory) {
|
|
|
28095
28121
|
if (!isWhitelistedDirName(entry.name)) {
|
|
28096
28122
|
continue;
|
|
28097
28123
|
}
|
|
28098
|
-
await consider(
|
|
28124
|
+
await consider(path88.join(root, entry.name));
|
|
28099
28125
|
}
|
|
28100
28126
|
} catch {
|
|
28101
28127
|
}
|
|
@@ -28114,8 +28140,8 @@ function slugifyDirName(name) {
|
|
|
28114
28140
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "docs";
|
|
28115
28141
|
}
|
|
28116
28142
|
async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
28117
|
-
const base = slugifyDirName(
|
|
28118
|
-
const parent = slugifyDirName(
|
|
28143
|
+
const base = slugifyDirName(path88.basename(sourceDirectory));
|
|
28144
|
+
const parent = slugifyDirName(path88.basename(path88.dirname(sourceDirectory)));
|
|
28119
28145
|
const candidates = [base, `${parent}-${base}`];
|
|
28120
28146
|
let index = 2;
|
|
28121
28147
|
while (true) {
|
|
@@ -28123,7 +28149,7 @@ async function allocateLinkName(pagesDir, sourceDirectory, used) {
|
|
|
28123
28149
|
if (used.has(name)) {
|
|
28124
28150
|
continue;
|
|
28125
28151
|
}
|
|
28126
|
-
const target =
|
|
28152
|
+
const target = path88.join(pagesDir, name);
|
|
28127
28153
|
if (await pathExists5(target)) {
|
|
28128
28154
|
const stat7 = await lstat2(target);
|
|
28129
28155
|
if (!stat7.isDirectory() || !await isManagedLinkDir(target)) {
|
|
@@ -28154,8 +28180,8 @@ async function alreadyLinked(linkPath, sourcePath) {
|
|
|
28154
28180
|
return false;
|
|
28155
28181
|
}
|
|
28156
28182
|
const current = await readlink(linkPath);
|
|
28157
|
-
const resolved =
|
|
28158
|
-
return resolved ===
|
|
28183
|
+
const resolved = path88.resolve(path88.dirname(linkPath), current);
|
|
28184
|
+
return resolved === path88.resolve(sourcePath);
|
|
28159
28185
|
} catch {
|
|
28160
28186
|
return false;
|
|
28161
28187
|
}
|
|
@@ -28167,8 +28193,8 @@ async function linkMarkdownFile(sourcePath, linkPath) {
|
|
|
28167
28193
|
if (await pathExists5(linkPath)) {
|
|
28168
28194
|
return "skipped";
|
|
28169
28195
|
}
|
|
28170
|
-
await mkdir21(
|
|
28171
|
-
const relativeTarget =
|
|
28196
|
+
await mkdir21(path88.dirname(linkPath), { recursive: true });
|
|
28197
|
+
const relativeTarget = path88.relative(path88.dirname(linkPath), sourcePath);
|
|
28172
28198
|
await symlink2(
|
|
28173
28199
|
relativeTarget,
|
|
28174
28200
|
linkPath,
|
|
@@ -28183,7 +28209,7 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
28183
28209
|
if (routes.length === 0) {
|
|
28184
28210
|
return;
|
|
28185
28211
|
}
|
|
28186
|
-
const configPath =
|
|
28212
|
+
const configPath = path88.join(siteDirectory, CONFIG_FILENAME);
|
|
28187
28213
|
if (!await pathExists5(configPath)) {
|
|
28188
28214
|
return;
|
|
28189
28215
|
}
|
|
@@ -28200,8 +28226,8 @@ async function applyDocsNavigation(siteDirectory, routes) {
|
|
|
28200
28226
|
`, "utf8");
|
|
28201
28227
|
}
|
|
28202
28228
|
async function discoverAndWireDocs(siteDirectory) {
|
|
28203
|
-
const site =
|
|
28204
|
-
const pagesDir =
|
|
28229
|
+
const site = path88.resolve(siteDirectory);
|
|
28230
|
+
const pagesDir = path88.join(site, PAGES_DIR);
|
|
28205
28231
|
const { directories, searchedDirectories } = await discoverNearbyDocsDirectories(site);
|
|
28206
28232
|
if (directories.length === 0) {
|
|
28207
28233
|
return {
|
|
@@ -28223,15 +28249,15 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
28223
28249
|
directory.sourceDirectory,
|
|
28224
28250
|
usedNames
|
|
28225
28251
|
);
|
|
28226
|
-
const linkDirectory =
|
|
28252
|
+
const linkDirectory = path88.join(pagesDir, linkName);
|
|
28227
28253
|
const linked = [];
|
|
28228
28254
|
const skipped = [];
|
|
28229
28255
|
for (const sourcePath of directory.files) {
|
|
28230
28256
|
const relativeSource = toPosix3(
|
|
28231
|
-
|
|
28257
|
+
path88.relative(directory.sourceDirectory, sourcePath)
|
|
28232
28258
|
);
|
|
28233
|
-
const linkPath =
|
|
28234
|
-
const relativeLink = toPosix3(
|
|
28259
|
+
const linkPath = path88.join(linkDirectory, relativeSource);
|
|
28260
|
+
const relativeLink = toPosix3(path88.relative(site, linkPath));
|
|
28235
28261
|
const route = toRoutePath(relativeLink, PAGES_DIR);
|
|
28236
28262
|
if (routes.includes(route)) {
|
|
28237
28263
|
skipped.push({
|
|
@@ -28279,11 +28305,11 @@ async function discoverAndWireDocs(siteDirectory) {
|
|
|
28279
28305
|
};
|
|
28280
28306
|
}
|
|
28281
28307
|
function siteRelative(siteDirectory, filePath) {
|
|
28282
|
-
const relative = toPosix3(
|
|
28308
|
+
const relative = toPosix3(path88.relative(siteDirectory, filePath));
|
|
28283
28309
|
if (!relative) {
|
|
28284
28310
|
return ".";
|
|
28285
28311
|
}
|
|
28286
|
-
if (
|
|
28312
|
+
if (path88.isAbsolute(relative)) {
|
|
28287
28313
|
return toPosix3(filePath);
|
|
28288
28314
|
}
|
|
28289
28315
|
if (relative.startsWith("..")) {
|
|
@@ -28371,7 +28397,7 @@ async function pathExists6(filePath) {
|
|
|
28371
28397
|
}
|
|
28372
28398
|
async function wireOpenApiIntoJsonConfig(siteDirectory, openApiPath) {
|
|
28373
28399
|
const input5 = toSiteRelativeOpenApiInput(siteDirectory, openApiPath);
|
|
28374
|
-
const jsonConfigPath =
|
|
28400
|
+
const jsonConfigPath = path89.join(siteDirectory, "apitogo.config.json");
|
|
28375
28401
|
const raw = await readFile30(jsonConfigPath, "utf8");
|
|
28376
28402
|
const siteConfig = JSON.parse(raw);
|
|
28377
28403
|
const updated = applyOpenApiToSiteConfig(siteConfig, {
|
|
@@ -28423,7 +28449,7 @@ async function discoverAndWireOpenApiLite(siteDirectory, mode) {
|
|
|
28423
28449
|
wired: false
|
|
28424
28450
|
};
|
|
28425
28451
|
}
|
|
28426
|
-
const jsonConfigPath =
|
|
28452
|
+
const jsonConfigPath = path89.join(siteDirectory, "apitogo.config.json");
|
|
28427
28453
|
if (!await pathExists6(jsonConfigPath)) {
|
|
28428
28454
|
return {
|
|
28429
28455
|
openApiDiscovery: {
|
|
@@ -28473,7 +28499,7 @@ async function discoverAndWireBackend(siteDirectory, mode) {
|
|
|
28473
28499
|
if (mode !== "nearby") {
|
|
28474
28500
|
return { status: "skipped", mode };
|
|
28475
28501
|
}
|
|
28476
|
-
const jsonConfigPath =
|
|
28502
|
+
const jsonConfigPath = path89.join(siteDirectory, "apitogo.config.json");
|
|
28477
28503
|
if (!await pathExists6(jsonConfigPath)) {
|
|
28478
28504
|
return { status: "not_found" };
|
|
28479
28505
|
}
|
|
@@ -28540,18 +28566,18 @@ function slugifyName2(name) {
|
|
|
28540
28566
|
return name.toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-|-$/g, "") || "dev-portal-site";
|
|
28541
28567
|
}
|
|
28542
28568
|
function resolveInitOutputDirectory(dirArg, name) {
|
|
28543
|
-
const resolved =
|
|
28544
|
-
const base =
|
|
28569
|
+
const resolved = path90.resolve(process.cwd(), dirArg);
|
|
28570
|
+
const base = path90.basename(resolved);
|
|
28545
28571
|
const isDot = dirArg === "." || dirArg === "./" || base === "." || resolved === process.cwd();
|
|
28546
28572
|
if (isDot) {
|
|
28547
28573
|
const fromName = name?.trim();
|
|
28548
28574
|
if (!fromName) {
|
|
28549
28575
|
throw new Error(
|
|
28550
|
-
"apitogo init scaffolds into a named folder (default `dev-portal`). Pass a folder name or `--name` when using `.`."
|
|
28576
|
+
"apitogo init --no-v2 scaffolds into a named folder (default `dev-portal`). Pass a folder name or `--name` when using `.`."
|
|
28551
28577
|
);
|
|
28552
28578
|
}
|
|
28553
28579
|
return {
|
|
28554
|
-
outputDirectory:
|
|
28580
|
+
outputDirectory: path90.resolve(process.cwd(), slugifyName2(fromName)),
|
|
28555
28581
|
siteName: fromName
|
|
28556
28582
|
};
|
|
28557
28583
|
}
|
|
@@ -28668,9 +28694,9 @@ var init_default = {
|
|
|
28668
28694
|
command: "init [dir]",
|
|
28669
28695
|
builder: (yargs2) => yargs2.positional("dir", {
|
|
28670
28696
|
type: "string",
|
|
28671
|
-
describe: "Directory to scaffold into (
|
|
28672
|
-
// Shown in the help but not applied by yargs, so
|
|
28673
|
-
defaultDescription: '"
|
|
28697
|
+
describe: "Directory to scaffold into (the default is the current directory; with --no-v2 it is dev-portal)",
|
|
28698
|
+
// Shown in the help but not applied by yargs, so config version 2 can default to the current directory.
|
|
28699
|
+
defaultDescription: '"." (the current directory)',
|
|
28674
28700
|
normalize: true
|
|
28675
28701
|
}).option("name", {
|
|
28676
28702
|
type: "string",
|
|
@@ -28694,32 +28720,32 @@ var init_default = {
|
|
|
28694
28720
|
describe: "Auto-discover and wire OpenAPI (nearby = parent/siblings/site)"
|
|
28695
28721
|
}).option("v2", {
|
|
28696
28722
|
type: "boolean",
|
|
28697
|
-
default:
|
|
28698
|
-
describe: "
|
|
28723
|
+
default: true,
|
|
28724
|
+
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
28725
|
}).option("layout", {
|
|
28700
28726
|
type: "string",
|
|
28701
28727
|
choices: ["standalone", "embedded"],
|
|
28702
|
-
describe: "
|
|
28728
|
+
describe: "Config version 2: override layout detection"
|
|
28703
28729
|
}).option("only", {
|
|
28704
28730
|
type: "string",
|
|
28705
|
-
describe: "
|
|
28731
|
+
describe: "Config version 2: services to enable (only `portal` is available for now)"
|
|
28706
28732
|
}).option("docs", {
|
|
28707
28733
|
type: "string",
|
|
28708
28734
|
array: true,
|
|
28709
|
-
describe: "
|
|
28735
|
+
describe: "Config version 2: existing docs folder or file to include in place (repeatable); --no-docs skips docs detection"
|
|
28710
28736
|
}).option("dry-run", {
|
|
28711
28737
|
type: "boolean",
|
|
28712
28738
|
default: false,
|
|
28713
|
-
describe: "
|
|
28739
|
+
describe: "Config version 2: print what would be created and exit"
|
|
28714
28740
|
}).option("yes", {
|
|
28715
28741
|
alias: "y",
|
|
28716
28742
|
type: "boolean",
|
|
28717
28743
|
default: false,
|
|
28718
|
-
describe: "
|
|
28744
|
+
describe: "Config version 2: do not ask for confirmation; include every docs folder found"
|
|
28719
28745
|
}).option("force", {
|
|
28720
28746
|
type: "boolean",
|
|
28721
28747
|
default: false,
|
|
28722
|
-
describe: "
|
|
28748
|
+
describe: "Config version 2: replace an existing apitogo.config.json"
|
|
28723
28749
|
}),
|
|
28724
28750
|
handler: async (argv) => {
|
|
28725
28751
|
await captureEvent({ argv, event: "apitogo init" });
|
|
@@ -28734,8 +28760,8 @@ import open2 from "open";
|
|
|
28734
28760
|
import colors14 from "picocolors";
|
|
28735
28761
|
|
|
28736
28762
|
// src/cli/platform/device-auth.ts
|
|
28737
|
-
function url(apiUrl,
|
|
28738
|
-
return `${apiUrl}${
|
|
28763
|
+
function url(apiUrl, path103) {
|
|
28764
|
+
return `${apiUrl}${path103.startsWith("/") ? path103 : `/${path103}`}`;
|
|
28739
28765
|
}
|
|
28740
28766
|
async function requestDeviceCode(apiUrl) {
|
|
28741
28767
|
const response = await fetchWithRetry(
|
|
@@ -28917,7 +28943,7 @@ var logout_default = {
|
|
|
28917
28943
|
};
|
|
28918
28944
|
|
|
28919
28945
|
// src/cli/portal/commands.ts
|
|
28920
|
-
import
|
|
28946
|
+
import path91 from "node:path";
|
|
28921
28947
|
init_invariant();
|
|
28922
28948
|
function parseOnly(value) {
|
|
28923
28949
|
if (value === void 0) return void 0;
|
|
@@ -28934,11 +28960,11 @@ function parseOnly(value) {
|
|
|
28934
28960
|
async function run2(command2, argv, compute, format) {
|
|
28935
28961
|
const json = argv.json === true;
|
|
28936
28962
|
try {
|
|
28937
|
-
const dir =
|
|
28963
|
+
const dir = path91.resolve(process.cwd(), argv.dir ?? ".");
|
|
28938
28964
|
if (!await isConfigV2(dir)) {
|
|
28939
28965
|
throw new ServiceEditError(
|
|
28940
28966
|
`${command2} works with a config version 2 project, and there is none in ${dir}.`,
|
|
28941
|
-
"Create one with `apitogo init
|
|
28967
|
+
"Create one with `apitogo init`."
|
|
28942
28968
|
);
|
|
28943
28969
|
}
|
|
28944
28970
|
const output4 = await compute(dir, parseOnly(argv.only));
|
|
@@ -29018,7 +29044,7 @@ var plan_default = {
|
|
|
29018
29044
|
|
|
29019
29045
|
// src/cli/project/create-handler.ts
|
|
29020
29046
|
init_invariant();
|
|
29021
|
-
import
|
|
29047
|
+
import path92 from "node:path";
|
|
29022
29048
|
|
|
29023
29049
|
// src/cli/project/v2.ts
|
|
29024
29050
|
init_invariant();
|
|
@@ -29165,7 +29191,7 @@ async function createLinkedProject(argv, dir) {
|
|
|
29165
29191
|
}
|
|
29166
29192
|
}
|
|
29167
29193
|
async function createProject(argv) {
|
|
29168
|
-
const dir =
|
|
29194
|
+
const dir = path92.resolve(process.cwd(), argv.dir ?? ".");
|
|
29169
29195
|
if (await isConfigV2(dir)) {
|
|
29170
29196
|
await createLinkedProject(argv, dir);
|
|
29171
29197
|
return;
|
|
@@ -29289,14 +29315,14 @@ var remove_default = {
|
|
|
29289
29315
|
|
|
29290
29316
|
// src/cli/dev/handler.ts
|
|
29291
29317
|
init_joinUrl();
|
|
29292
|
-
import
|
|
29318
|
+
import path95 from "node:path";
|
|
29293
29319
|
|
|
29294
29320
|
// src/vite/dev-server.ts
|
|
29295
29321
|
init_logger();
|
|
29296
29322
|
import fs12 from "node:fs/promises";
|
|
29297
29323
|
import http from "node:http";
|
|
29298
29324
|
import https from "node:https";
|
|
29299
|
-
import
|
|
29325
|
+
import path94 from "node:path";
|
|
29300
29326
|
import { createHttpTerminator } from "http-terminator";
|
|
29301
29327
|
import {
|
|
29302
29328
|
createServer as createViteServer,
|
|
@@ -29329,7 +29355,7 @@ init_loader();
|
|
|
29329
29355
|
// src/vite/pagefind-dev-index.ts
|
|
29330
29356
|
init_invariant();
|
|
29331
29357
|
init_joinUrl();
|
|
29332
|
-
import
|
|
29358
|
+
import path93 from "node:path";
|
|
29333
29359
|
import { createIndex as createIndex2 } from "pagefind";
|
|
29334
29360
|
import { isRunnableDevEnvironment } from "vite";
|
|
29335
29361
|
async function* buildPagefindDevIndex(vite, config2) {
|
|
@@ -29382,7 +29408,7 @@ async function* buildPagefindDevIndex(vite, config2) {
|
|
|
29382
29408
|
path: urlPath
|
|
29383
29409
|
};
|
|
29384
29410
|
}
|
|
29385
|
-
const outputPath =
|
|
29411
|
+
const outputPath = path93.join(vite.config.publicDir, "pagefind");
|
|
29386
29412
|
await pagefindIndex.writeFiles({ outputPath });
|
|
29387
29413
|
yield { type: "complete", success: true, indexed };
|
|
29388
29414
|
}
|
|
@@ -29401,9 +29427,9 @@ var DevServer = class {
|
|
|
29401
29427
|
this.protocol = "https";
|
|
29402
29428
|
const { dir } = this.options;
|
|
29403
29429
|
const [key, cert, ca] = await Promise.all([
|
|
29404
|
-
fs12.readFile(
|
|
29405
|
-
fs12.readFile(
|
|
29406
|
-
config2.https.ca ? fs12.readFile(
|
|
29430
|
+
fs12.readFile(path94.resolve(dir, config2.https.key)),
|
|
29431
|
+
fs12.readFile(path94.resolve(dir, config2.https.cert)),
|
|
29432
|
+
config2.https.ca ? fs12.readFile(path94.resolve(dir, config2.https.ca)) : void 0
|
|
29407
29433
|
]);
|
|
29408
29434
|
return https.createServer({ key, cert, ca });
|
|
29409
29435
|
}
|
|
@@ -29420,7 +29446,7 @@ var DevServer = class {
|
|
|
29420
29446
|
);
|
|
29421
29447
|
const server = await this.createNodeServer(config2);
|
|
29422
29448
|
if (config2.search?.type === "pagefind" && viteConfig.publicDir !== false) {
|
|
29423
|
-
const publicRoot =
|
|
29449
|
+
const publicRoot = path94.resolve(
|
|
29424
29450
|
this.options.dir,
|
|
29425
29451
|
typeof viteConfig.publicDir === "string" ? viteConfig.publicDir : "public"
|
|
29426
29452
|
);
|
|
@@ -29437,7 +29463,7 @@ var DevServer = class {
|
|
|
29437
29463
|
// built-in transform middleware which would treat the path as a static asset.
|
|
29438
29464
|
name: "apitogo:entry-client",
|
|
29439
29465
|
configureServer(server2) {
|
|
29440
|
-
const entryPath =
|
|
29466
|
+
const entryPath = path94.posix.join(
|
|
29441
29467
|
server2.config.base,
|
|
29442
29468
|
"/__z/entry.client.tsx"
|
|
29443
29469
|
);
|
|
@@ -29602,7 +29628,7 @@ init_package_json();
|
|
|
29602
29628
|
async function dev(argv) {
|
|
29603
29629
|
const packageJson3 = getZudokuPackageJson();
|
|
29604
29630
|
process.env.NODE_ENV = "development";
|
|
29605
|
-
let dir =
|
|
29631
|
+
let dir = path95.resolve(process.cwd(), argv.dir);
|
|
29606
29632
|
if (await isConfigV2(dir)) {
|
|
29607
29633
|
const { root, prepared } = await preparePortalWorkspace(dir, "development");
|
|
29608
29634
|
dir = root;
|
|
@@ -29701,7 +29727,7 @@ var run_default = {
|
|
|
29701
29727
|
};
|
|
29702
29728
|
|
|
29703
29729
|
// src/cli/secrets/handler.ts
|
|
29704
|
-
import
|
|
29730
|
+
import path96 from "node:path";
|
|
29705
29731
|
init_invariant();
|
|
29706
29732
|
|
|
29707
29733
|
// src/cli/secrets/input.ts
|
|
@@ -29766,7 +29792,7 @@ var SecretsError = class extends ApitogoError {
|
|
|
29766
29792
|
async function resolveProjectId2(argv, deps) {
|
|
29767
29793
|
const explicit = argv.projectId?.trim();
|
|
29768
29794
|
if (explicit) return explicit;
|
|
29769
|
-
const dir =
|
|
29795
|
+
const dir = path96.resolve(process.cwd(), argv.dir ?? ".");
|
|
29770
29796
|
if (await isConfigV2(dir)) {
|
|
29771
29797
|
const id = loadConfigV2(dir).resolved.project.id;
|
|
29772
29798
|
if (id) return id;
|
|
@@ -29926,12 +29952,12 @@ var secrets_default = {
|
|
|
29926
29952
|
};
|
|
29927
29953
|
|
|
29928
29954
|
// src/cli/cmds/status.ts
|
|
29929
|
-
import
|
|
29955
|
+
import path98 from "node:path";
|
|
29930
29956
|
|
|
29931
29957
|
// src/cli/status/handler.ts
|
|
29932
|
-
import
|
|
29958
|
+
import path97 from "node:path";
|
|
29933
29959
|
async function status(argv) {
|
|
29934
|
-
const sourceDirectory =
|
|
29960
|
+
const sourceDirectory = path97.resolve(process.cwd(), argv.dir);
|
|
29935
29961
|
let config2;
|
|
29936
29962
|
try {
|
|
29937
29963
|
config2 = loadConfig();
|
|
@@ -30029,7 +30055,7 @@ var status_default = {
|
|
|
30029
30055
|
}),
|
|
30030
30056
|
handler: async (argv) => {
|
|
30031
30057
|
await captureEvent({ argv, event: "apitogo status" });
|
|
30032
|
-
if (await isConfigV2(
|
|
30058
|
+
if (await isConfigV2(path98.resolve(process.cwd(), argv.dir))) {
|
|
30033
30059
|
await statusOfProject(argv);
|
|
30034
30060
|
return;
|
|
30035
30061
|
}
|
|
@@ -30038,11 +30064,11 @@ var status_default = {
|
|
|
30038
30064
|
};
|
|
30039
30065
|
|
|
30040
30066
|
// src/cli/cmds/teardown.ts
|
|
30041
|
-
import
|
|
30067
|
+
import path101 from "node:path";
|
|
30042
30068
|
|
|
30043
30069
|
// src/cli/teardown/command.ts
|
|
30044
30070
|
init_invariant();
|
|
30045
|
-
import
|
|
30071
|
+
import path99 from "node:path";
|
|
30046
30072
|
import { createInterface as createInterface7 } from "node:readline/promises";
|
|
30047
30073
|
|
|
30048
30074
|
// src/cli/teardown/v2.ts
|
|
@@ -30259,7 +30285,7 @@ async function teardownProject(argv) {
|
|
|
30259
30285
|
const progress = createConsoleProgressReporter();
|
|
30260
30286
|
const result = await teardownV2(
|
|
30261
30287
|
{
|
|
30262
|
-
dir:
|
|
30288
|
+
dir: path99.resolve(process.cwd(), argv.dir),
|
|
30263
30289
|
projectId: argv.projectId,
|
|
30264
30290
|
only: Array.isArray(argv.only) ? argv.only.join(",") : argv.only,
|
|
30265
30291
|
yes: argv.yes === true,
|
|
@@ -30318,7 +30344,7 @@ async function teardownProject(argv) {
|
|
|
30318
30344
|
}
|
|
30319
30345
|
|
|
30320
30346
|
// src/cli/teardown/handler.ts
|
|
30321
|
-
import
|
|
30347
|
+
import path100 from "node:path";
|
|
30322
30348
|
function resultLooksFailed3(payload) {
|
|
30323
30349
|
try {
|
|
30324
30350
|
const parsed = JSON.parse(payload);
|
|
@@ -30334,7 +30360,7 @@ async function teardown(argv) {
|
|
|
30334
30360
|
);
|
|
30335
30361
|
return;
|
|
30336
30362
|
}
|
|
30337
|
-
const sourceDirectory =
|
|
30363
|
+
const sourceDirectory = path100.resolve(process.cwd(), argv.dir);
|
|
30338
30364
|
let config2;
|
|
30339
30365
|
try {
|
|
30340
30366
|
config2 = loadConfig();
|
|
@@ -30412,7 +30438,7 @@ var teardown_default = {
|
|
|
30412
30438
|
}),
|
|
30413
30439
|
handler: async (argv) => {
|
|
30414
30440
|
await captureEvent({ argv, event: "apitogo teardown" });
|
|
30415
|
-
if (await isConfigV2(
|
|
30441
|
+
if (await isConfigV2(path101.resolve(process.cwd(), argv.dir))) {
|
|
30416
30442
|
await teardownProject(argv);
|
|
30417
30443
|
return;
|
|
30418
30444
|
}
|
|
@@ -30489,37 +30515,37 @@ function createApitogoCli(argv) {
|
|
|
30489
30515
|
|
|
30490
30516
|
// src/cli/local-handoff.ts
|
|
30491
30517
|
import { spawn as spawn5 } from "node:child_process";
|
|
30492
|
-
import { existsSync as existsSync9, realpathSync } from "node:fs";
|
|
30493
|
-
import
|
|
30518
|
+
import { existsSync as existsSync9, realpathSync as realpathSync2 } from "node:fs";
|
|
30519
|
+
import path102 from "node:path";
|
|
30494
30520
|
var LOCAL_HANDOFF_ENV = "APITOGO_LOCAL_CLI";
|
|
30495
30521
|
var PACKAGE_NAME = "@lukoweb/apitogo";
|
|
30496
30522
|
var resolveProjectDir = (argv, cwd) => {
|
|
30497
30523
|
for (let i = 0; i < argv.length; i++) {
|
|
30498
30524
|
const arg = argv[i];
|
|
30499
30525
|
const next = argv[i + 1];
|
|
30500
|
-
if (arg === "--dir" && next) return
|
|
30526
|
+
if (arg === "--dir" && next) return path102.resolve(cwd, next);
|
|
30501
30527
|
if (arg?.startsWith("--dir=")) {
|
|
30502
|
-
return
|
|
30528
|
+
return path102.resolve(cwd, arg.slice("--dir=".length));
|
|
30503
30529
|
}
|
|
30504
30530
|
}
|
|
30505
30531
|
return cwd;
|
|
30506
30532
|
};
|
|
30507
30533
|
var findLocalCli = (projectDir, runningRoot) => {
|
|
30508
|
-
let dir =
|
|
30534
|
+
let dir = path102.resolve(projectDir);
|
|
30509
30535
|
let localPackageRoot;
|
|
30510
30536
|
while (!localPackageRoot) {
|
|
30511
|
-
const candidate =
|
|
30512
|
-
if (existsSync9(
|
|
30537
|
+
const candidate = path102.join(dir, "node_modules", PACKAGE_NAME);
|
|
30538
|
+
if (existsSync9(path102.join(candidate, "package.json"))) {
|
|
30513
30539
|
localPackageRoot = candidate;
|
|
30514
|
-
} else if (dir ===
|
|
30540
|
+
} else if (dir === path102.dirname(dir)) {
|
|
30515
30541
|
return void 0;
|
|
30516
30542
|
} else {
|
|
30517
|
-
dir =
|
|
30543
|
+
dir = path102.dirname(dir);
|
|
30518
30544
|
}
|
|
30519
30545
|
}
|
|
30520
|
-
const localRoot =
|
|
30521
|
-
if (localRoot ===
|
|
30522
|
-
return
|
|
30546
|
+
const localRoot = realpathSync2(localPackageRoot);
|
|
30547
|
+
if (localRoot === realpathSync2(runningRoot)) return void 0;
|
|
30548
|
+
return path102.join(localRoot, "cli.js");
|
|
30523
30549
|
};
|
|
30524
30550
|
var handoffToLocalCli = async (argv, runningRoot) => {
|
|
30525
30551
|
if (process.env[LOCAL_HANDOFF_ENV] || process.env.ZUDOKU_ENV === "internal") {
|
|
@@ -30531,7 +30557,7 @@ var handoffToLocalCli = async (argv, runningRoot) => {
|
|
|
30531
30557
|
);
|
|
30532
30558
|
if (!localCli) return void 0;
|
|
30533
30559
|
printDiagnosticsToConsole(
|
|
30534
|
-
`Using the project's local ${PACKAGE_NAME} (${
|
|
30560
|
+
`Using the project's local ${PACKAGE_NAME} (${path102.dirname(localCli)})`
|
|
30535
30561
|
);
|
|
30536
30562
|
const child = spawn5(process.execPath, [localCli, ...argv], {
|
|
30537
30563
|
stdio: "inherit",
|