@lukoweb/apitogo 0.1.2 → 0.1.4
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 +160 -53
- package/package.json +2 -1
package/dist/cli/cli.js
CHANGED
|
@@ -131,7 +131,7 @@ import { stat } from "node:fs/promises";
|
|
|
131
131
|
var fileExists;
|
|
132
132
|
var init_file_exists = __esm({
|
|
133
133
|
"src/config/file-exists.ts"() {
|
|
134
|
-
fileExists = (
|
|
134
|
+
fileExists = (path30) => stat(path30).then(() => true).catch(() => false);
|
|
135
135
|
}
|
|
136
136
|
});
|
|
137
137
|
|
|
@@ -3816,7 +3816,7 @@ import {
|
|
|
3816
3816
|
// package.json
|
|
3817
3817
|
var package_default = {
|
|
3818
3818
|
name: "@lukoweb/apitogo",
|
|
3819
|
-
version: "0.1.
|
|
3819
|
+
version: "0.1.3",
|
|
3820
3820
|
type: "module",
|
|
3821
3821
|
sideEffects: [
|
|
3822
3822
|
"**/*.css",
|
|
@@ -3890,7 +3890,6 @@ var package_default = {
|
|
|
3890
3890
|
"generate:types": "tsx scripts/generate-types.js && tsx scripts/generate-flat-config.js",
|
|
3891
3891
|
"build:standalone": "vite build --mode standalone --config vite.standalone.config.ts --log-level=error",
|
|
3892
3892
|
prepublishOnly: "tsx scripts/generate-publish-exports.ts",
|
|
3893
|
-
postpublish: "git checkout -- package.json",
|
|
3894
3893
|
clean: "rm -rf dist",
|
|
3895
3894
|
codegen: "graphql-codegen --config ./src/codegen.ts"
|
|
3896
3895
|
},
|
|
@@ -4001,6 +4000,7 @@ var package_default = {
|
|
|
4001
4000
|
shiki: "3.23.0",
|
|
4002
4001
|
sitemap: "9.0.1",
|
|
4003
4002
|
"strip-ansi": "7.2.0",
|
|
4003
|
+
tar: "7.5.10",
|
|
4004
4004
|
"tailwind-merge": "3.5.0",
|
|
4005
4005
|
tailwindcss: "4.2.1",
|
|
4006
4006
|
"tw-animate-css": "1.4.0",
|
|
@@ -4406,14 +4406,14 @@ var flattenAllOf = (schema2) => {
|
|
|
4406
4406
|
};
|
|
4407
4407
|
|
|
4408
4408
|
// src/lib/util/traverse.ts
|
|
4409
|
-
var traverse = (specification, transform,
|
|
4410
|
-
const transformed = transform(specification,
|
|
4409
|
+
var traverse = (specification, transform, path30 = []) => {
|
|
4410
|
+
const transformed = transform(specification, path30);
|
|
4411
4411
|
if (typeof transformed !== "object" || transformed === null) {
|
|
4412
4412
|
return transformed;
|
|
4413
4413
|
}
|
|
4414
4414
|
const result = Array.isArray(transformed) ? [] : {};
|
|
4415
4415
|
for (const [key, value] of Object.entries(transformed)) {
|
|
4416
|
-
const currentPath = [...
|
|
4416
|
+
const currentPath = [...path30, key];
|
|
4417
4417
|
if (Array.isArray(value)) {
|
|
4418
4418
|
result[key] = value.map(
|
|
4419
4419
|
(item, index) => typeof item === "object" && item != null ? traverse(item, transform, [...currentPath, index.toString()]) : item
|
|
@@ -4441,9 +4441,9 @@ var resolveLocalRef = (schema2, ref) => {
|
|
|
4441
4441
|
if (schemaCache?.has(ref)) {
|
|
4442
4442
|
return schemaCache.get(ref);
|
|
4443
4443
|
}
|
|
4444
|
-
const
|
|
4444
|
+
const path30 = ref.split("/").slice(1);
|
|
4445
4445
|
let current = schema2;
|
|
4446
|
-
for (const segment of
|
|
4446
|
+
for (const segment of path30) {
|
|
4447
4447
|
if (!current || typeof current !== "object") {
|
|
4448
4448
|
current = null;
|
|
4449
4449
|
}
|
|
@@ -4462,7 +4462,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4462
4462
|
}
|
|
4463
4463
|
const cloned = structuredClone(schema2);
|
|
4464
4464
|
const visited = /* @__PURE__ */ new Set();
|
|
4465
|
-
const resolve = async (current,
|
|
4465
|
+
const resolve = async (current, path30) => {
|
|
4466
4466
|
if (isIndexableObject(current)) {
|
|
4467
4467
|
if (visited.has(current)) {
|
|
4468
4468
|
return CIRCULAR_REF;
|
|
@@ -4470,7 +4470,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4470
4470
|
visited.add(current);
|
|
4471
4471
|
if (Array.isArray(current)) {
|
|
4472
4472
|
for (let index = 0; index < current.length; index++) {
|
|
4473
|
-
current[index] = await resolve(current[index], `${
|
|
4473
|
+
current[index] = await resolve(current[index], `${path30}/${index}`);
|
|
4474
4474
|
}
|
|
4475
4475
|
} else {
|
|
4476
4476
|
if ("$ref" in current && typeof current.$ref === "string") {
|
|
@@ -4481,13 +4481,13 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4481
4481
|
for (const resolver of resolvers) {
|
|
4482
4482
|
const resolved = await resolver($ref);
|
|
4483
4483
|
if (resolved) {
|
|
4484
|
-
result2 = await resolve(resolved,
|
|
4484
|
+
result2 = await resolve(resolved, path30);
|
|
4485
4485
|
break;
|
|
4486
4486
|
}
|
|
4487
4487
|
}
|
|
4488
4488
|
if (result2 === void 0) {
|
|
4489
4489
|
const resolved = await resolveLocalRef(cloned, $ref);
|
|
4490
|
-
result2 = await resolve(resolved,
|
|
4490
|
+
result2 = await resolve(resolved, path30);
|
|
4491
4491
|
}
|
|
4492
4492
|
if (hasSiblings) {
|
|
4493
4493
|
if (result2 === CIRCULAR_REF) {
|
|
@@ -4500,7 +4500,7 @@ var dereference = async (schema2, resolvers = []) => {
|
|
|
4500
4500
|
return result2;
|
|
4501
4501
|
}
|
|
4502
4502
|
for (const key in current) {
|
|
4503
|
-
current[key] = await resolve(current[key], `${
|
|
4503
|
+
current[key] = await resolve(current[key], `${path30}/${key}`);
|
|
4504
4504
|
}
|
|
4505
4505
|
}
|
|
4506
4506
|
visited.delete(current);
|
|
@@ -4539,9 +4539,9 @@ var upgradeSchema = (schema2) => {
|
|
|
4539
4539
|
}
|
|
4540
4540
|
return sub;
|
|
4541
4541
|
});
|
|
4542
|
-
schema2 = traverse(schema2, (sub,
|
|
4542
|
+
schema2 = traverse(schema2, (sub, path30) => {
|
|
4543
4543
|
if (sub.example !== void 0) {
|
|
4544
|
-
if (isSchemaPath(
|
|
4544
|
+
if (isSchemaPath(path30 ?? [])) {
|
|
4545
4545
|
sub.examples = [sub.example];
|
|
4546
4546
|
} else {
|
|
4547
4547
|
sub.examples = {
|
|
@@ -4554,11 +4554,11 @@ var upgradeSchema = (schema2) => {
|
|
|
4554
4554
|
}
|
|
4555
4555
|
return sub;
|
|
4556
4556
|
});
|
|
4557
|
-
schema2 = traverse(schema2, (schema3,
|
|
4557
|
+
schema2 = traverse(schema2, (schema3, path30) => {
|
|
4558
4558
|
if (schema3.type === "object" && schema3.properties !== void 0) {
|
|
4559
|
-
const parentPath =
|
|
4559
|
+
const parentPath = path30?.slice(0, -1);
|
|
4560
4560
|
const isMultipart = parentPath?.some((segment, index) => {
|
|
4561
|
-
return segment === "content" &&
|
|
4561
|
+
return segment === "content" && path30?.[index + 1] === "multipart/form-data";
|
|
4562
4562
|
});
|
|
4563
4563
|
if (isMultipart) {
|
|
4564
4564
|
const entries = Object.entries(schema3.properties);
|
|
@@ -4572,8 +4572,8 @@ var upgradeSchema = (schema2) => {
|
|
|
4572
4572
|
}
|
|
4573
4573
|
return schema3;
|
|
4574
4574
|
});
|
|
4575
|
-
schema2 = traverse(schema2, (schema3,
|
|
4576
|
-
if (
|
|
4575
|
+
schema2 = traverse(schema2, (schema3, path30) => {
|
|
4576
|
+
if (path30?.includes("content") && path30.includes("application/octet-stream")) {
|
|
4577
4577
|
return {};
|
|
4578
4578
|
}
|
|
4579
4579
|
if (schema3.type === "string" && schema3.format === "binary") {
|
|
@@ -4599,11 +4599,11 @@ var upgradeSchema = (schema2) => {
|
|
|
4599
4599
|
}
|
|
4600
4600
|
return sub;
|
|
4601
4601
|
});
|
|
4602
|
-
schema2 = traverse(schema2, (schema3,
|
|
4602
|
+
schema2 = traverse(schema2, (schema3, path30) => {
|
|
4603
4603
|
if (schema3.type === "string" && schema3.format === "byte") {
|
|
4604
|
-
const parentPath =
|
|
4604
|
+
const parentPath = path30?.slice(0, -1);
|
|
4605
4605
|
const contentMediaType = parentPath?.find(
|
|
4606
|
-
(_, index) =>
|
|
4606
|
+
(_, index) => path30?.[index - 1] === "content"
|
|
4607
4607
|
);
|
|
4608
4608
|
return {
|
|
4609
4609
|
type: "string",
|
|
@@ -4615,7 +4615,7 @@ var upgradeSchema = (schema2) => {
|
|
|
4615
4615
|
});
|
|
4616
4616
|
return schema2;
|
|
4617
4617
|
};
|
|
4618
|
-
function isSchemaPath(
|
|
4618
|
+
function isSchemaPath(path30) {
|
|
4619
4619
|
const schemaLocations = [
|
|
4620
4620
|
["components", "schemas"],
|
|
4621
4621
|
"properties",
|
|
@@ -4628,10 +4628,10 @@ function isSchemaPath(path29) {
|
|
|
4628
4628
|
];
|
|
4629
4629
|
return schemaLocations.some((location) => {
|
|
4630
4630
|
if (Array.isArray(location)) {
|
|
4631
|
-
return location.every((segment, index) =>
|
|
4631
|
+
return location.every((segment, index) => path30[index] === segment);
|
|
4632
4632
|
}
|
|
4633
|
-
return
|
|
4634
|
-
}) ||
|
|
4633
|
+
return path30.includes(location);
|
|
4634
|
+
}) || path30.includes("schema") || path30.some((segment) => segment.endsWith("Schema"));
|
|
4635
4635
|
}
|
|
4636
4636
|
|
|
4637
4637
|
// src/lib/oas/parser/index.ts
|
|
@@ -4713,13 +4713,13 @@ var OPENAPI_PROPS = /* @__PURE__ */ new Set([
|
|
|
4713
4713
|
"anyOf",
|
|
4714
4714
|
"oneOf"
|
|
4715
4715
|
]);
|
|
4716
|
-
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(),
|
|
4716
|
+
var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs = /* @__PURE__ */ new WeakMap(), path30 = [], currentRefPaths = /* @__PURE__ */ new Set()) => {
|
|
4717
4717
|
if (obj === null || typeof obj !== "object") return obj;
|
|
4718
4718
|
const refPath = obj.__$ref;
|
|
4719
4719
|
const isCircular = currentPath.has(obj) || typeof refPath === "string" && currentRefPaths.has(refPath);
|
|
4720
4720
|
if (isCircular) {
|
|
4721
4721
|
if (typeof refPath === "string") return SCHEMA_REF_PREFIX + refPath;
|
|
4722
|
-
const circularProp =
|
|
4722
|
+
const circularProp = path30.find((p) => !OPENAPI_PROPS.has(p)) || path30[0];
|
|
4723
4723
|
return [CIRCULAR_REF, circularProp].filter(Boolean).join(":");
|
|
4724
4724
|
}
|
|
4725
4725
|
if (refs.has(obj)) return refs.get(obj);
|
|
@@ -4729,7 +4729,7 @@ var handleCircularRefs = (obj, currentPath = /* @__PURE__ */ new WeakSet(), refs
|
|
|
4729
4729
|
value,
|
|
4730
4730
|
currentPath,
|
|
4731
4731
|
refs,
|
|
4732
|
-
[...
|
|
4732
|
+
[...path30, key],
|
|
4733
4733
|
currentRefPaths
|
|
4734
4734
|
);
|
|
4735
4735
|
const result = Array.isArray(obj) ? obj.map((item, i) => recurse(item, i.toString())) : Object.fromEntries(
|
|
@@ -4764,7 +4764,7 @@ var resolveExtensions = (obj) => Object.fromEntries(
|
|
|
4764
4764
|
var getAllTags = (schema2) => {
|
|
4765
4765
|
const rootTags = schema2.tags ?? [];
|
|
4766
4766
|
const operations = Object.values(schema2.paths ?? {}).flatMap(
|
|
4767
|
-
(
|
|
4767
|
+
(path30) => HttpMethods.map((k) => path30?.[k]).filter((op) => op != null)
|
|
4768
4768
|
);
|
|
4769
4769
|
const operationTags = new Set(operations.flatMap((op) => op.tags ?? []));
|
|
4770
4770
|
const hasUntaggedOperations = operations.some(
|
|
@@ -4819,7 +4819,7 @@ var getAllSlugs = (ops, schemaTags = []) => {
|
|
|
4819
4819
|
var getOperationSlugKey = (op) => [op.path, op.method, op.operationId, op.summary].filter(Boolean).join("-");
|
|
4820
4820
|
var getAllOperations = (paths) => {
|
|
4821
4821
|
const operations = Object.entries(paths ?? {}).flatMap(
|
|
4822
|
-
([
|
|
4822
|
+
([path30, value]) => HttpMethods.flatMap((method) => {
|
|
4823
4823
|
if (!value?.[method]) return [];
|
|
4824
4824
|
const operation = value[method];
|
|
4825
4825
|
const pathParameters = value.parameters ?? [];
|
|
@@ -4839,7 +4839,7 @@ var getAllOperations = (paths) => {
|
|
|
4839
4839
|
return {
|
|
4840
4840
|
...operation,
|
|
4841
4841
|
method,
|
|
4842
|
-
path:
|
|
4842
|
+
path: path30,
|
|
4843
4843
|
parameters,
|
|
4844
4844
|
servers,
|
|
4845
4845
|
tags: operation.tags ?? []
|
|
@@ -5197,8 +5197,8 @@ var Schema = builder.objectRef("Schema").implement({
|
|
|
5197
5197
|
}),
|
|
5198
5198
|
paths: t.field({
|
|
5199
5199
|
type: [PathItem],
|
|
5200
|
-
resolve: (root) => Object.entries(root.paths ?? {}).map(([
|
|
5201
|
-
path:
|
|
5200
|
+
resolve: (root) => Object.entries(root.paths ?? {}).map(([path30, value]) => ({
|
|
5201
|
+
path: path30,
|
|
5202
5202
|
// biome-ignore lint/style/noNonNullAssertion: value is guaranteed to be defined
|
|
5203
5203
|
methods: Object.keys(value)
|
|
5204
5204
|
}))
|
|
@@ -5345,7 +5345,7 @@ init_joinUrl();
|
|
|
5345
5345
|
|
|
5346
5346
|
// src/vite/api/schema-codegen.ts
|
|
5347
5347
|
var unescapeJsonPointer = (uri) => decodeURIComponent(uri.replace(/~1/g, "/").replace(/~0/g, "~"));
|
|
5348
|
-
var getSegmentsFromPath = (
|
|
5348
|
+
var getSegmentsFromPath = (path30) => path30.split("/").slice(1).map(unescapeJsonPointer);
|
|
5349
5349
|
var createLocalRefMap = (obj) => {
|
|
5350
5350
|
const refMap = /* @__PURE__ */ new Map();
|
|
5351
5351
|
const siblingsMap = /* @__PURE__ */ new Map();
|
|
@@ -5376,16 +5376,16 @@ var replaceMarkers = (code, mergedRefs) => code.replace(/"__refMap:(.*?)"/g, '__
|
|
|
5376
5376
|
/"__refMap\+Siblings:(.*?)"/g,
|
|
5377
5377
|
(_, key) => mergedRefs.get(key) ?? `__refMap["${key}"]`
|
|
5378
5378
|
);
|
|
5379
|
-
var lookup = (schema2,
|
|
5380
|
-
const parts = getSegmentsFromPath(
|
|
5379
|
+
var lookup = (schema2, path30, filePath) => {
|
|
5380
|
+
const parts = getSegmentsFromPath(path30);
|
|
5381
5381
|
let val = schema2;
|
|
5382
5382
|
for (const part of parts) {
|
|
5383
5383
|
while (val.$ref?.startsWith("#/")) {
|
|
5384
|
-
val = val.$ref ===
|
|
5384
|
+
val = val.$ref === path30 ? val : lookup(schema2, val.$ref, filePath);
|
|
5385
5385
|
}
|
|
5386
5386
|
if (val[part] === void 0) {
|
|
5387
5387
|
throw new Error(
|
|
5388
|
-
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${
|
|
5388
|
+
`Error in ${filePath ?? "code generation"}: Could not find path segment ${part} in path: ${path30}`
|
|
5389
5389
|
);
|
|
5390
5390
|
}
|
|
5391
5391
|
val = val[part];
|
|
@@ -5630,8 +5630,8 @@ var SchemaManager = class {
|
|
|
5630
5630
|
}
|
|
5631
5631
|
}
|
|
5632
5632
|
};
|
|
5633
|
-
getLatestSchema = (
|
|
5634
|
-
getSchemasForPath = (
|
|
5633
|
+
getLatestSchema = (path30) => this.processedSchemas[path30]?.at(0);
|
|
5634
|
+
getSchemasForPath = (path30) => this.processedSchemas[path30];
|
|
5635
5635
|
getSchemaImports = () => Object.values(this.processedSchemas).flat().filter((s) => s.importKey);
|
|
5636
5636
|
getUrlToFilePathMap = () => {
|
|
5637
5637
|
const map = /* @__PURE__ */ new Map();
|
|
@@ -7720,14 +7720,14 @@ async function generateSitemap({
|
|
|
7720
7720
|
|
|
7721
7721
|
// src/vite/prerender/utils.ts
|
|
7722
7722
|
init_joinUrl();
|
|
7723
|
-
var resolveRoutePath = (
|
|
7724
|
-
const segments =
|
|
7723
|
+
var resolveRoutePath = (path30) => {
|
|
7724
|
+
const segments = path30.split("/");
|
|
7725
7725
|
if (segments.some((s) => s.startsWith(":") && !s.endsWith("?"))) {
|
|
7726
7726
|
return void 0;
|
|
7727
7727
|
}
|
|
7728
7728
|
return segments.filter((s) => !s.startsWith(":")).join("/") || void 0;
|
|
7729
7729
|
};
|
|
7730
|
-
var isSkipped = (
|
|
7730
|
+
var isSkipped = (path30) => path30.includes("*") || /^\d+$/.test(path30);
|
|
7731
7731
|
var resolveRoutes = (routes, parentPath = "") => routes.flatMap((route) => {
|
|
7732
7732
|
if (route.path && isSkipped(route.path)) return [];
|
|
7733
7733
|
const routePath = route.path ? resolveRoutePath(route.path) : void 0;
|
|
@@ -8093,6 +8093,22 @@ function printDiagnosticsToConsole(message) {
|
|
|
8093
8093
|
function printWarningToConsole(message) {
|
|
8094
8094
|
console.error(message);
|
|
8095
8095
|
}
|
|
8096
|
+
async function printCriticalFailureToConsoleAndExit(message) {
|
|
8097
|
+
console.error(colors8.bold(colors8.red(message)));
|
|
8098
|
+
await Sentry.close(MAX_WAIT_PENDING_TIME_MS).then(() => {
|
|
8099
|
+
process.exit(1);
|
|
8100
|
+
});
|
|
8101
|
+
}
|
|
8102
|
+
function printResultToConsole(message) {
|
|
8103
|
+
console.log(colors8.bold(colors8.green(message)));
|
|
8104
|
+
}
|
|
8105
|
+
function textOrJson(text) {
|
|
8106
|
+
try {
|
|
8107
|
+
return JSON.parse(text);
|
|
8108
|
+
} catch {
|
|
8109
|
+
return text;
|
|
8110
|
+
}
|
|
8111
|
+
}
|
|
8096
8112
|
|
|
8097
8113
|
// src/cli/build/handler.ts
|
|
8098
8114
|
init_package_json();
|
|
@@ -8690,6 +8706,97 @@ var dev_default = {
|
|
|
8690
8706
|
}
|
|
8691
8707
|
};
|
|
8692
8708
|
|
|
8709
|
+
// src/cli/deploy/handler.ts
|
|
8710
|
+
import { access, readFile as readFile4 } from "node:fs/promises";
|
|
8711
|
+
import path28 from "node:path";
|
|
8712
|
+
import { create as createTar } from "tar";
|
|
8713
|
+
var DEPLOY_ENDPOINT = "http://localhost:3000/deploy";
|
|
8714
|
+
var ARCHIVE_NAME = "dist.tgz";
|
|
8715
|
+
var createDeploymentArchive = async (dir) => {
|
|
8716
|
+
const distDir = path28.join(dir, "dist");
|
|
8717
|
+
await access(distDir);
|
|
8718
|
+
const archivePath = path28.join(dir, ARCHIVE_NAME);
|
|
8719
|
+
await createTar(
|
|
8720
|
+
{
|
|
8721
|
+
cwd: dir,
|
|
8722
|
+
file: archivePath,
|
|
8723
|
+
gzip: true,
|
|
8724
|
+
portable: true
|
|
8725
|
+
},
|
|
8726
|
+
["dist"]
|
|
8727
|
+
);
|
|
8728
|
+
return archivePath;
|
|
8729
|
+
};
|
|
8730
|
+
async function deploy(argv) {
|
|
8731
|
+
await build({ ...argv, preview: void 0 });
|
|
8732
|
+
const dir = path28.resolve(process.cwd(), argv.dir);
|
|
8733
|
+
const deploymentToken = argv.deploymentToken?.trim();
|
|
8734
|
+
try {
|
|
8735
|
+
if (!deploymentToken) {
|
|
8736
|
+
throw new Error("A deployment token is required.");
|
|
8737
|
+
}
|
|
8738
|
+
printDiagnosticsToConsole("Creating deployment archive...");
|
|
8739
|
+
const archivePath = await createDeploymentArchive(dir);
|
|
8740
|
+
printDiagnosticsToConsole(`Uploading ${path28.basename(archivePath)}...`);
|
|
8741
|
+
const archiveBuffer = await readFile4(archivePath);
|
|
8742
|
+
const formData = new FormData();
|
|
8743
|
+
formData.append(
|
|
8744
|
+
"file",
|
|
8745
|
+
new Blob([archiveBuffer], { type: "application/gzip" }),
|
|
8746
|
+
path28.basename(archivePath)
|
|
8747
|
+
);
|
|
8748
|
+
formData.append("deploymentToken", deploymentToken);
|
|
8749
|
+
const response = await fetch(DEPLOY_ENDPOINT, {
|
|
8750
|
+
method: "POST",
|
|
8751
|
+
body: formData
|
|
8752
|
+
});
|
|
8753
|
+
const responseText = await response.text();
|
|
8754
|
+
if (!response.ok) {
|
|
8755
|
+
throw new Error(
|
|
8756
|
+
`Deploy failed with ${response.status}: ${JSON.stringify(textOrJson(responseText))}`
|
|
8757
|
+
);
|
|
8758
|
+
}
|
|
8759
|
+
printResultToConsole(`Deployment uploaded to ${DEPLOY_ENDPOINT}`);
|
|
8760
|
+
if (responseText.trim()) {
|
|
8761
|
+
printDiagnosticsToConsole(JSON.stringify(textOrJson(responseText), null, 2));
|
|
8762
|
+
}
|
|
8763
|
+
} catch (error) {
|
|
8764
|
+
await printCriticalFailureToConsoleAndExit(
|
|
8765
|
+
error instanceof Error ? error.message : String(error)
|
|
8766
|
+
);
|
|
8767
|
+
}
|
|
8768
|
+
}
|
|
8769
|
+
|
|
8770
|
+
// src/cli/cmds/deploy.ts
|
|
8771
|
+
var deploy_default = {
|
|
8772
|
+
desc: "Build, archive, and deploy",
|
|
8773
|
+
command: "deploy [deploymentToken]",
|
|
8774
|
+
builder: (yargs2) => yargs2.positional("deploymentToken", {
|
|
8775
|
+
type: "string",
|
|
8776
|
+
describe: "Deployment token sent to the deploy endpoint"
|
|
8777
|
+
}).option("dir", {
|
|
8778
|
+
type: "string",
|
|
8779
|
+
describe: "The directory containing your project",
|
|
8780
|
+
default: ".",
|
|
8781
|
+
normalize: true,
|
|
8782
|
+
hidden: true
|
|
8783
|
+
}).option("experimental-ssr", {
|
|
8784
|
+
type: "boolean",
|
|
8785
|
+
describe: "Build for server-side rendering (experimental)",
|
|
8786
|
+
default: false
|
|
8787
|
+
}).option("adapter", {
|
|
8788
|
+
type: "string",
|
|
8789
|
+
describe: "SSR adapter (node, cloudflare, vercel)",
|
|
8790
|
+
choices: ["node", "cloudflare", "vercel"],
|
|
8791
|
+
default: "node"
|
|
8792
|
+
}),
|
|
8793
|
+
handler: async (argv) => {
|
|
8794
|
+
process.env.NODE_ENV = "production";
|
|
8795
|
+
await captureEvent({ argv, event: "apitogo deploy" });
|
|
8796
|
+
await deploy(argv);
|
|
8797
|
+
}
|
|
8798
|
+
};
|
|
8799
|
+
|
|
8693
8800
|
// src/cli/cmds/preview.ts
|
|
8694
8801
|
var previewCommand = {
|
|
8695
8802
|
desc: "Preview production build",
|
|
@@ -8714,7 +8821,7 @@ var preview_default = previewCommand;
|
|
|
8714
8821
|
|
|
8715
8822
|
// src/cli/common/outdated.ts
|
|
8716
8823
|
import { existsSync as existsSync2, mkdirSync } from "node:fs";
|
|
8717
|
-
import { readFile as
|
|
8824
|
+
import { readFile as readFile5, writeFile as writeFile6 } from "node:fs/promises";
|
|
8718
8825
|
import { join } from "node:path";
|
|
8719
8826
|
import colors10 from "picocolors";
|
|
8720
8827
|
import { gt } from "semver";
|
|
@@ -8764,12 +8871,12 @@ function box(message, {
|
|
|
8764
8871
|
|
|
8765
8872
|
// src/cli/common/xdg/lib.ts
|
|
8766
8873
|
import { homedir } from "node:os";
|
|
8767
|
-
import
|
|
8874
|
+
import path29 from "node:path";
|
|
8768
8875
|
function defineDirectoryWithFallback(xdgName, fallback) {
|
|
8769
8876
|
if (process.env[xdgName]) {
|
|
8770
8877
|
return process.env[xdgName];
|
|
8771
8878
|
} else {
|
|
8772
|
-
return
|
|
8879
|
+
return path29.join(homedir(), fallback);
|
|
8773
8880
|
}
|
|
8774
8881
|
}
|
|
8775
8882
|
var XDG_CONFIG_HOME = defineDirectoryWithFallback(
|
|
@@ -8784,15 +8891,15 @@ var XDG_STATE_HOME = defineDirectoryWithFallback(
|
|
|
8784
8891
|
"XDG_DATA_HOME",
|
|
8785
8892
|
".local/state"
|
|
8786
8893
|
);
|
|
8787
|
-
var ZUDOKU_XDG_CONFIG_HOME =
|
|
8894
|
+
var ZUDOKU_XDG_CONFIG_HOME = path29.join(
|
|
8788
8895
|
XDG_CONFIG_HOME,
|
|
8789
8896
|
CLI_XDG_FOLDER_NAME
|
|
8790
8897
|
);
|
|
8791
|
-
var ZUDOKU_XDG_DATA_HOME =
|
|
8898
|
+
var ZUDOKU_XDG_DATA_HOME = path29.join(
|
|
8792
8899
|
XDG_DATA_HOME,
|
|
8793
8900
|
CLI_XDG_FOLDER_NAME
|
|
8794
8901
|
);
|
|
8795
|
-
var ZUDOKU_XDG_STATE_HOME =
|
|
8902
|
+
var ZUDOKU_XDG_STATE_HOME = path29.join(
|
|
8796
8903
|
XDG_STATE_HOME,
|
|
8797
8904
|
CLI_XDG_FOLDER_NAME
|
|
8798
8905
|
);
|
|
@@ -8841,7 +8948,7 @@ async function getVersionCheckInfo() {
|
|
|
8841
8948
|
let versionCheckInfo;
|
|
8842
8949
|
if (existsSync2(versionCheckPath)) {
|
|
8843
8950
|
try {
|
|
8844
|
-
versionCheckInfo = await
|
|
8951
|
+
versionCheckInfo = await readFile5(versionCheckPath, "utf-8").then(
|
|
8845
8952
|
JSON.parse
|
|
8846
8953
|
);
|
|
8847
8954
|
} catch {
|
|
@@ -8946,7 +9053,7 @@ var cli = yargs(hideBin(process.argv)).option("zuplo", {
|
|
|
8946
9053
|
process.env.ZUPLO = "1";
|
|
8947
9054
|
printDiagnosticsToConsole("Running in Zuplo mode");
|
|
8948
9055
|
}
|
|
8949
|
-
}).middleware(warnPackageVersionMismatch).command(build_default).command(dev_default).command(preview_default).demandCommand().strictCommands().version(packageJson?.version).fail(false).help();
|
|
9056
|
+
}).middleware(warnPackageVersionMismatch).command(build_default).command(dev_default).command(deploy_default).command(preview_default).demandCommand().strictCommands().version(packageJson?.version).fail(false).help();
|
|
8950
9057
|
try {
|
|
8951
9058
|
void warnIfOutdatedVersion(packageJson?.version);
|
|
8952
9059
|
await cli.argv;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lukoweb/apitogo",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"**/*.css",
|
|
@@ -252,6 +252,7 @@
|
|
|
252
252
|
"shiki": "3.23.0",
|
|
253
253
|
"sitemap": "9.0.1",
|
|
254
254
|
"strip-ansi": "7.2.0",
|
|
255
|
+
"tar": "7.5.10",
|
|
255
256
|
"tailwind-merge": "3.5.0",
|
|
256
257
|
"tailwindcss": "4.2.1",
|
|
257
258
|
"tw-animate-css": "1.4.0",
|