@scalar/cli 1.7.9 → 1.8.2
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/README.md +28 -13
- package/docs.html +147 -78
- package/index.js +327 -199
- package/package.json +6 -5
package/index.js
CHANGED
|
@@ -6866,14 +6866,14 @@ var require_parser = __commonJS({
|
|
|
6866
6866
|
case "scalar":
|
|
6867
6867
|
case "single-quoted-scalar":
|
|
6868
6868
|
case "double-quoted-scalar": {
|
|
6869
|
-
const
|
|
6869
|
+
const fs19 = this.flowScalar(this.type);
|
|
6870
6870
|
if (atNextItem || it.value) {
|
|
6871
|
-
map2.items.push({ start, key:
|
|
6871
|
+
map2.items.push({ start, key: fs19, sep: [] });
|
|
6872
6872
|
this.onKeyLine = true;
|
|
6873
6873
|
} else if (it.sep) {
|
|
6874
|
-
this.stack.push(
|
|
6874
|
+
this.stack.push(fs19);
|
|
6875
6875
|
} else {
|
|
6876
|
-
Object.assign(it, { key:
|
|
6876
|
+
Object.assign(it, { key: fs19, sep: [] });
|
|
6877
6877
|
this.onKeyLine = true;
|
|
6878
6878
|
}
|
|
6879
6879
|
return;
|
|
@@ -6991,13 +6991,13 @@ var require_parser = __commonJS({
|
|
|
6991
6991
|
case "scalar":
|
|
6992
6992
|
case "single-quoted-scalar":
|
|
6993
6993
|
case "double-quoted-scalar": {
|
|
6994
|
-
const
|
|
6994
|
+
const fs19 = this.flowScalar(this.type);
|
|
6995
6995
|
if (!it || it.value)
|
|
6996
|
-
fc.items.push({ start: [], key:
|
|
6996
|
+
fc.items.push({ start: [], key: fs19, sep: [] });
|
|
6997
6997
|
else if (it.sep)
|
|
6998
|
-
this.stack.push(
|
|
6998
|
+
this.stack.push(fs19);
|
|
6999
6999
|
else
|
|
7000
|
-
Object.assign(it, { key:
|
|
7000
|
+
Object.assign(it, { key: fs19, sep: [] });
|
|
7001
7001
|
return;
|
|
7002
7002
|
}
|
|
7003
7003
|
case "flow-map-end":
|
|
@@ -11776,7 +11776,7 @@ var require_parse2 = __commonJS({
|
|
|
11776
11776
|
var require_gray_matter = __commonJS({
|
|
11777
11777
|
"../../node_modules/.pnpm/gray-matter@4.0.3/node_modules/gray-matter/index.js"(exports2, module2) {
|
|
11778
11778
|
"use strict";
|
|
11779
|
-
var
|
|
11779
|
+
var fs19 = __require("fs");
|
|
11780
11780
|
var sections = require_section_matter();
|
|
11781
11781
|
var defaults = require_defaults();
|
|
11782
11782
|
var stringify = require_stringify3();
|
|
@@ -11860,7 +11860,7 @@ var require_gray_matter = __commonJS({
|
|
|
11860
11860
|
return stringify(file2, data, options2);
|
|
11861
11861
|
};
|
|
11862
11862
|
matter2.read = function(filepath, options2) {
|
|
11863
|
-
const str2 =
|
|
11863
|
+
const str2 = fs19.readFileSync(filepath, "utf8");
|
|
11864
11864
|
const file2 = matter2(str2, options2);
|
|
11865
11865
|
file2.path = filepath;
|
|
11866
11866
|
return file2;
|
|
@@ -28609,7 +28609,7 @@ var require_util2 = __commonJS({
|
|
|
28609
28609
|
return result;
|
|
28610
28610
|
};
|
|
28611
28611
|
}
|
|
28612
|
-
var
|
|
28612
|
+
var normalize7 = lruMemoize(function normalize8(aPath) {
|
|
28613
28613
|
var path12 = aPath;
|
|
28614
28614
|
var url2 = urlParse(aPath);
|
|
28615
28615
|
if (url2) {
|
|
@@ -28661,7 +28661,7 @@ var require_util2 = __commonJS({
|
|
|
28661
28661
|
}
|
|
28662
28662
|
return path12;
|
|
28663
28663
|
});
|
|
28664
|
-
exports2.normalize =
|
|
28664
|
+
exports2.normalize = normalize7;
|
|
28665
28665
|
function join2(aRoot, aPath) {
|
|
28666
28666
|
if (aRoot === "") {
|
|
28667
28667
|
aRoot = ".";
|
|
@@ -28687,7 +28687,7 @@ var require_util2 = __commonJS({
|
|
|
28687
28687
|
aRootUrl.host = aPath;
|
|
28688
28688
|
return urlGenerate(aRootUrl);
|
|
28689
28689
|
}
|
|
28690
|
-
var joined = aPath.charAt(0) === "/" ? aPath :
|
|
28690
|
+
var joined = aPath.charAt(0) === "/" ? aPath : normalize7(aRoot.replace(/\/+$/, "") + "/" + aPath);
|
|
28691
28691
|
if (aRootUrl) {
|
|
28692
28692
|
aRootUrl.path = joined;
|
|
28693
28693
|
return urlGenerate(aRootUrl);
|
|
@@ -28910,7 +28910,7 @@ var require_util2 = __commonJS({
|
|
|
28910
28910
|
}
|
|
28911
28911
|
sourceURL = join2(urlGenerate(parsed), sourceURL);
|
|
28912
28912
|
}
|
|
28913
|
-
return
|
|
28913
|
+
return normalize7(sourceURL);
|
|
28914
28914
|
}
|
|
28915
28915
|
exports2.computeSourceURL = computeSourceURL;
|
|
28916
28916
|
}
|
|
@@ -68689,11 +68689,11 @@ Visit https://nodejs.org to download the latest version.`
|
|
|
68689
68689
|
}
|
|
68690
68690
|
|
|
68691
68691
|
// src/program.ts
|
|
68692
|
-
import { Command as
|
|
68692
|
+
import { Command as Command47 } from "commander";
|
|
68693
68693
|
|
|
68694
68694
|
// package.json
|
|
68695
68695
|
var name = "@scalar/cli";
|
|
68696
|
-
var version = "1.
|
|
68696
|
+
var version = "1.8.2";
|
|
68697
68697
|
var bin = {
|
|
68698
68698
|
scalar: "./dist/index.js",
|
|
68699
68699
|
"scalar-cli": "./dist/index.js"
|
|
@@ -86287,6 +86287,55 @@ function getLegacyWysiwygVersion(versions) {
|
|
|
86287
86287
|
return latestVersion ?? "latest";
|
|
86288
86288
|
}
|
|
86289
86289
|
|
|
86290
|
+
// ../../packages/entities/dist/agent/embed.js
|
|
86291
|
+
var embedStatuses = ["pending", "success", "failed"];
|
|
86292
|
+
|
|
86293
|
+
// ../../packages/entities/dist/agent/docs.js
|
|
86294
|
+
var docsProjectTypes = ["sync", "wysiwyg"];
|
|
86295
|
+
var docsProjectSchema = zod_default.object({
|
|
86296
|
+
id: zod_default.string(),
|
|
86297
|
+
uid: zod_default.string(),
|
|
86298
|
+
name: zod_default.string(),
|
|
86299
|
+
teamUid: zod_default.string(),
|
|
86300
|
+
isPrivate: zod_default.boolean(),
|
|
86301
|
+
type: zod_default.enum(docsProjectTypes),
|
|
86302
|
+
activePublishId: zod_default.string().nullable(),
|
|
86303
|
+
mcpServerId: zod_default.string().nullable(),
|
|
86304
|
+
mcpInstallationId: zod_default.string().nullable(),
|
|
86305
|
+
agentEnabled: zod_default.boolean(),
|
|
86306
|
+
createdAt: zod_default.string(),
|
|
86307
|
+
updatedAt: zod_default.string()
|
|
86308
|
+
}).meta({ id: "docs-project" });
|
|
86309
|
+
var docsPublishSchema = zod_default.object({
|
|
86310
|
+
id: zod_default.string(),
|
|
86311
|
+
uid: zod_default.string(),
|
|
86312
|
+
projectId: zod_default.string(),
|
|
86313
|
+
domain: zod_default.string(),
|
|
86314
|
+
embedStatus: zod_default.enum(embedStatuses),
|
|
86315
|
+
createdAt: zod_default.string(),
|
|
86316
|
+
updatedAt: zod_default.string()
|
|
86317
|
+
}).meta({ id: "docs-publish" });
|
|
86318
|
+
var docsPageSchema = zod_default.object({
|
|
86319
|
+
id: zod_default.string(),
|
|
86320
|
+
publishId: zod_default.string(),
|
|
86321
|
+
title: zod_default.string(),
|
|
86322
|
+
description: zod_default.string().nullable(),
|
|
86323
|
+
to: zod_default.string(),
|
|
86324
|
+
filepath: zod_default.string(),
|
|
86325
|
+
contentHash: zod_default.string().nullable(),
|
|
86326
|
+
searchToolEnabled: zod_default.boolean(),
|
|
86327
|
+
executeRequestToolEnabled: zod_default.boolean(),
|
|
86328
|
+
createdAt: zod_default.string()
|
|
86329
|
+
}).meta({ id: "docs-page" });
|
|
86330
|
+
var docsPageEmbeddingSchema = zod_default.object({
|
|
86331
|
+
id: zod_default.string(),
|
|
86332
|
+
pageId: zod_default.string(),
|
|
86333
|
+
raw: zod_default.instanceof(Uint8Array),
|
|
86334
|
+
embedding: zod_default.number().array(),
|
|
86335
|
+
metadata: zod_default.record(zod_default.string(), zod_default.unknown()).nullable(),
|
|
86336
|
+
createdAt: zod_default.string()
|
|
86337
|
+
}).meta({ id: "docs-embedding" });
|
|
86338
|
+
|
|
86290
86339
|
// ../../packages/entities/dist/agent/document.js
|
|
86291
86340
|
var documentSchema = zod_default.object({
|
|
86292
86341
|
id: zod_default.uuid(),
|
|
@@ -86349,6 +86398,17 @@ var mcpServerOperationToolSchema = external_exports.object({
|
|
|
86349
86398
|
}).meta({
|
|
86350
86399
|
id: "mcp-server-operation-tool"
|
|
86351
86400
|
});
|
|
86401
|
+
var mcpServerDocsPageToolSchema = external_exports.object({
|
|
86402
|
+
id: external_exports.string(),
|
|
86403
|
+
mcpServerId: external_exports.string(),
|
|
86404
|
+
docsPageId: external_exports.string(),
|
|
86405
|
+
searchToolEnabled: external_exports.boolean(),
|
|
86406
|
+
executeRequestToolEnabled: external_exports.boolean(),
|
|
86407
|
+
createdAt: external_exports.string(),
|
|
86408
|
+
updatedAt: external_exports.string()
|
|
86409
|
+
}).meta({
|
|
86410
|
+
id: "mcp-server-docs-page-tool"
|
|
86411
|
+
});
|
|
86352
86412
|
var mcpInstallationSchema = external_exports.object({
|
|
86353
86413
|
id: external_exports.string(),
|
|
86354
86414
|
mcpServerId: external_exports.string(),
|
|
@@ -86361,7 +86421,7 @@ var mcpInstallationSchema = external_exports.object({
|
|
|
86361
86421
|
var monthlyUsageSchema = zod_default.object({
|
|
86362
86422
|
identifier: zod_default.string(),
|
|
86363
86423
|
month: zod_default.date(),
|
|
86364
|
-
type: zod_default.enum(["public-user", "web-team-user", "agent-key"]),
|
|
86424
|
+
type: zod_default.enum(["public-user", "web-team-user", "agent-key", "docs-project"]),
|
|
86365
86425
|
inputTokens: zod_default.number(),
|
|
86366
86426
|
outputTokens: zod_default.number(),
|
|
86367
86427
|
messages: zod_default.number()
|
|
@@ -86384,7 +86444,6 @@ var operationSchema = zod_default.object({
|
|
|
86384
86444
|
}).meta({ id: "operation" });
|
|
86385
86445
|
|
|
86386
86446
|
// ../../packages/entities/dist/agent/version.js
|
|
86387
|
-
var embedStatuses = ["pending", "success", "failed"];
|
|
86388
86447
|
var versionSchema = zod_default.object({
|
|
86389
86448
|
id: zod_default.uuid(),
|
|
86390
86449
|
uid: nanoidSchema,
|
|
@@ -86994,6 +87053,8 @@ var sharedProjectSchema = entitySchema.extend({
|
|
|
86994
87053
|
typesenseId: external_exports.number().optional(),
|
|
86995
87054
|
/** Private projects require a login from a user in an access group */
|
|
86996
87055
|
isPrivate: external_exports.boolean().default(false),
|
|
87056
|
+
/** Toggle AI agent features for the docs project */
|
|
87057
|
+
agentEnabled: external_exports.boolean().default(false),
|
|
86997
87058
|
/** Set of allowed access groups */
|
|
86998
87059
|
accessGroups: scalarSet(external_exports.set(nanoidSchema).max(50)).default([])
|
|
86999
87060
|
}).meta({ id: "shared-project" });
|
|
@@ -87083,7 +87144,8 @@ var publishRecordSchema = entitySchema.extend({
|
|
|
87083
87144
|
registryApis: external_exports.object({
|
|
87084
87145
|
uid: nanoidSchema,
|
|
87085
87146
|
version: external_exports.string()
|
|
87086
|
-
}).array().optional().default([])
|
|
87147
|
+
}).array().optional().default([]),
|
|
87148
|
+
agentToken: external_exports.string().nullable().default(null)
|
|
87087
87149
|
}).meta({ id: "publish-record" });
|
|
87088
87150
|
|
|
87089
87151
|
// ../../packages/entities/dist/theme/index.js
|
|
@@ -87683,6 +87745,7 @@ var FeatureFlag;
|
|
|
87683
87745
|
FeatureFlag2["MCP"] = "mcp";
|
|
87684
87746
|
FeatureFlag2["Workspaces"] = "workspaces";
|
|
87685
87747
|
FeatureFlag2["Export"] = "export";
|
|
87748
|
+
FeatureFlag2["DocsMCP"] = "docsMcp";
|
|
87686
87749
|
})(FeatureFlag || (FeatureFlag = {}));
|
|
87687
87750
|
var featureSchema = external_exports.boolean().optional().meta({ id: "feature" });
|
|
87688
87751
|
var featureFlagSchema = external_exports.object({
|
|
@@ -87694,7 +87757,8 @@ var featureFlagSchema = external_exports.object({
|
|
|
87694
87757
|
[FeatureFlag.Agent]: featureSchema,
|
|
87695
87758
|
[FeatureFlag.Workspaces]: featureSchema,
|
|
87696
87759
|
[FeatureFlag.MCP]: featureSchema,
|
|
87697
|
-
[FeatureFlag.Export]: featureSchema
|
|
87760
|
+
[FeatureFlag.Export]: featureSchema,
|
|
87761
|
+
[FeatureFlag.DocsMCP]: featureSchema
|
|
87698
87762
|
}).meta({ id: "feature-flag" });
|
|
87699
87763
|
|
|
87700
87764
|
// ../../packages/entities/dist/team/schema.js
|
|
@@ -87985,6 +88049,16 @@ var hostingExchangeTokenSchema = external_exports.object({
|
|
|
87985
88049
|
teamUid: nanoidSchema,
|
|
87986
88050
|
exp: external_exports.number()
|
|
87987
88051
|
}).meta({ id: "hosting-exchange-token" });
|
|
88052
|
+
var docsAgentTokenSchema = external_exports.object({
|
|
88053
|
+
uid: external_exports.string(),
|
|
88054
|
+
publishUid: external_exports.string(),
|
|
88055
|
+
projectUid: external_exports.string(),
|
|
88056
|
+
teamUid: external_exports.string(),
|
|
88057
|
+
mcpServerId: external_exports.string(),
|
|
88058
|
+
mcpInstallationId: external_exports.string(),
|
|
88059
|
+
iat: external_exports.number(),
|
|
88060
|
+
exp: external_exports.number()
|
|
88061
|
+
}).meta({ id: "docs-agent-token" });
|
|
87988
88062
|
|
|
87989
88063
|
// ../../packages/entities/dist/user/github.js
|
|
87990
88064
|
var userGithubSchema = entitySchema.extend({
|
|
@@ -89995,6 +90069,16 @@ function teamApiFactory(requestService, getNewTokens) {
|
|
|
89995
90069
|
schema: external_exports.null()
|
|
89996
90070
|
});
|
|
89997
90071
|
}
|
|
90072
|
+
async function updateBillingEmail(email3) {
|
|
90073
|
+
return await requestService.request({
|
|
90074
|
+
url: "core/team/billing/email",
|
|
90075
|
+
method: "post",
|
|
90076
|
+
data: {
|
|
90077
|
+
email: email3
|
|
90078
|
+
},
|
|
90079
|
+
schema: external_exports.null()
|
|
90080
|
+
});
|
|
90081
|
+
}
|
|
89998
90082
|
async function onboardingSetup(data) {
|
|
89999
90083
|
return await requestService.request({
|
|
90000
90084
|
url: "core/team/onboarding/complete",
|
|
@@ -90093,6 +90177,7 @@ function teamApiFactory(requestService, getNewTokens) {
|
|
|
90093
90177
|
removeMember,
|
|
90094
90178
|
delete: deleteTeam,
|
|
90095
90179
|
getBillingSummary,
|
|
90180
|
+
updateBillingEmail,
|
|
90096
90181
|
updateBillingPlan,
|
|
90097
90182
|
update,
|
|
90098
90183
|
updateRole,
|
|
@@ -90161,7 +90246,7 @@ var config2 = {
|
|
|
90161
90246
|
}
|
|
90162
90247
|
},
|
|
90163
90248
|
cdnUrl: process.env.CDN_URL ?? "https://cdn.scalar.com",
|
|
90164
|
-
ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? "1.3.
|
|
90249
|
+
ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? "1.3.3"
|
|
90165
90250
|
};
|
|
90166
90251
|
|
|
90167
90252
|
// src/domains/auth/login/helpers/personal-token-generate-access.ts
|
|
@@ -91937,7 +92022,7 @@ authCommands.forEach((command) => authDomain.addCommand(command()));
|
|
|
91937
92022
|
var auth_default = authDomain;
|
|
91938
92023
|
|
|
91939
92024
|
// src/domains/document/index.ts
|
|
91940
|
-
import { Command as
|
|
92025
|
+
import { Command as Command28 } from "commander";
|
|
91941
92026
|
|
|
91942
92027
|
// src/domains/document/join/index.ts
|
|
91943
92028
|
var import_yaml3 = __toESM(require_dist(), 1);
|
|
@@ -92198,13 +92283,48 @@ function LintCommand() {
|
|
|
92198
92283
|
return cmd2;
|
|
92199
92284
|
}
|
|
92200
92285
|
|
|
92201
|
-
// src/domains/document/
|
|
92202
|
-
import
|
|
92286
|
+
// src/domains/document/markdown/index.ts
|
|
92287
|
+
import fs8 from "node:fs";
|
|
92288
|
+
import as16 from "ansis";
|
|
92203
92289
|
import { Command as Command21 } from "commander";
|
|
92290
|
+
import { normalize as normalize5 } from "@scalar/openapi-parser";
|
|
92291
|
+
import { createMarkdownFromOpenApi } from "@scalar/openapi-to-markdown";
|
|
92292
|
+
function MarkdownCommand() {
|
|
92293
|
+
const cmd2 = new Command21("markdown");
|
|
92294
|
+
cmd2.description("Generate Markdown from an OpenAPI file");
|
|
92295
|
+
cmd2.argument("[file|url]", "OpenAPI file path or URL to convert");
|
|
92296
|
+
cmd2.option("-o, --output <file>", "Output file (defaults to stdout)");
|
|
92297
|
+
cmd2.action(
|
|
92298
|
+
async (inputArgument, { output: outputPath }) => {
|
|
92299
|
+
const startTime = performance.now();
|
|
92300
|
+
if (!inputArgument) {
|
|
92301
|
+
return output.error().title("Invalid argument").message("Please provide a file path or URL").exit("error");
|
|
92302
|
+
}
|
|
92303
|
+
const specification = await getFileOrUrl(inputArgument);
|
|
92304
|
+
const markdown = await createMarkdownFromOpenApi(normalize5(specification));
|
|
92305
|
+
if (outputPath) {
|
|
92306
|
+
fs8.writeFileSync(outputPath, markdown, "utf8");
|
|
92307
|
+
const endTime = performance.now();
|
|
92308
|
+
output.info().line(
|
|
92309
|
+
`${as16.green("Markdown generated")} ${as16.grey(
|
|
92310
|
+
`in ${as16.white(`${as16.bold(`${Math.round(endTime - startTime)}`)} ms`)}`
|
|
92311
|
+
)}`
|
|
92312
|
+
).line(`Written to ${as16.cyan(outputPath)}`).print();
|
|
92313
|
+
return;
|
|
92314
|
+
}
|
|
92315
|
+
process.stdout.write(markdown);
|
|
92316
|
+
}
|
|
92317
|
+
);
|
|
92318
|
+
return cmd2;
|
|
92319
|
+
}
|
|
92320
|
+
|
|
92321
|
+
// src/domains/document/mock/index.ts
|
|
92322
|
+
import as18 from "ansis";
|
|
92323
|
+
import { Command as Command22 } from "commander";
|
|
92204
92324
|
|
|
92205
92325
|
// src/domains/document/mock/helpers.ts
|
|
92206
92326
|
import { serve } from "@hono/node-server";
|
|
92207
|
-
import
|
|
92327
|
+
import as17 from "ansis";
|
|
92208
92328
|
import { createMockServer } from "@scalar/mock-server";
|
|
92209
92329
|
var bootServer = async ({
|
|
92210
92330
|
specification,
|
|
@@ -92221,17 +92341,17 @@ var bootServer = async ({
|
|
|
92221
92341
|
},
|
|
92222
92342
|
(info) => {
|
|
92223
92343
|
output.info().message(
|
|
92224
|
-
`${
|
|
92344
|
+
`${as17.green.bold("\u279C Mock Server")} ${as17.white(
|
|
92225
92345
|
"listening on"
|
|
92226
|
-
)} ${
|
|
92346
|
+
)} ${as17.cyan(`http://localhost:${info.port}`)}`
|
|
92227
92347
|
).print();
|
|
92228
92348
|
}
|
|
92229
92349
|
);
|
|
92230
92350
|
};
|
|
92231
92351
|
var printAvailablePaths = (specification) => {
|
|
92232
|
-
output.info().message(
|
|
92352
|
+
output.info().message(as17.white.bold("Available Paths")).print();
|
|
92233
92353
|
if (specification?.paths === void 0 || Object.keys(specification?.paths).length === 0) {
|
|
92234
|
-
output.warn().title(
|
|
92354
|
+
output.warn().title(as17.grey("Could not find any paths in the OpenAPI file.")).print();
|
|
92235
92355
|
}
|
|
92236
92356
|
for (const path12 in specification?.paths ?? []) {
|
|
92237
92357
|
if (specification?.paths?.[path12] === void 0) {
|
|
@@ -92242,7 +92362,7 @@ var printAvailablePaths = (specification) => {
|
|
|
92242
92362
|
continue;
|
|
92243
92363
|
}
|
|
92244
92364
|
output.info().line(
|
|
92245
|
-
`${
|
|
92365
|
+
`${as17[getMethodColor(method)].bold(method.toUpperCase().padEnd(6))} ${as17.grey(`${path12}`)}`
|
|
92246
92366
|
).print();
|
|
92247
92367
|
}
|
|
92248
92368
|
}
|
|
@@ -92254,7 +92374,7 @@ var onRequest = ({
|
|
|
92254
92374
|
}) => {
|
|
92255
92375
|
const { method } = context.req;
|
|
92256
92376
|
output.info().line(
|
|
92257
|
-
`${
|
|
92377
|
+
`${as17[getMethodColor(method)].bold(method.toUpperCase().padEnd(6))} ${as17.grey(`${context.req.path}`)} ${as17.grey("\u2192")} ${operation?.operationId ? as17.white(operation.operationId) : as17.red("[ERROR] 404 Not Found")}`
|
|
92258
92378
|
).print();
|
|
92259
92379
|
};
|
|
92260
92380
|
function getMethodColor(method) {
|
|
@@ -92270,7 +92390,7 @@ function getMethodColor(method) {
|
|
|
92270
92390
|
|
|
92271
92391
|
// src/domains/document/mock/index.ts
|
|
92272
92392
|
function MockCommand() {
|
|
92273
|
-
const cmd2 = new
|
|
92393
|
+
const cmd2 = new Command22("mock");
|
|
92274
92394
|
cmd2.description("Mock an API from an OpenAPI file");
|
|
92275
92395
|
cmd2.argument("[file|url]", "OpenAPI file or URL to mock the server for");
|
|
92276
92396
|
cmd2.option("-w, --watch", "watch the file for changes");
|
|
@@ -92293,7 +92413,7 @@ function MockCommand() {
|
|
|
92293
92413
|
const newResult = await loadOpenApiFile(fileArgument);
|
|
92294
92414
|
const specificationHasChanged = newResult?.specification && JSON.stringify(specification) !== JSON.stringify(newResult.specification);
|
|
92295
92415
|
if (specificationHasChanged) {
|
|
92296
|
-
output.info().title(
|
|
92416
|
+
output.info().title(as18.grey("OpenAPI file modified")).print();
|
|
92297
92417
|
printSpecificationBanner({
|
|
92298
92418
|
version: newResult.version,
|
|
92299
92419
|
schema: newResult.schema
|
|
@@ -92330,12 +92450,12 @@ function MockCommand() {
|
|
|
92330
92450
|
|
|
92331
92451
|
// src/domains/document/serve/index.ts
|
|
92332
92452
|
import { serve as serve2 } from "@hono/node-server";
|
|
92333
|
-
import
|
|
92334
|
-
import { Command as
|
|
92453
|
+
import as19 from "ansis";
|
|
92454
|
+
import { Command as Command23 } from "commander";
|
|
92335
92455
|
import { Hono } from "hono";
|
|
92336
92456
|
import { stream } from "hono/streaming";
|
|
92337
92457
|
function ServeCommand() {
|
|
92338
|
-
const cmd2 = new
|
|
92458
|
+
const cmd2 = new Command23("serve");
|
|
92339
92459
|
cmd2.description("Serve an API Reference from an OpenAPI file");
|
|
92340
92460
|
cmd2.argument("[file|url]", "OpenAPI file or URL to show the reference for");
|
|
92341
92461
|
cmd2.option("-w, --watch", "watch the file for changes");
|
|
@@ -92378,7 +92498,7 @@ function ServeCommand() {
|
|
|
92378
92498
|
const newResult = await loadOpenApiFile(inputArgument);
|
|
92379
92499
|
const specificationHasChanged = newResult?.specification && JSON.stringify(specification) !== JSON.stringify(newResult.specification);
|
|
92380
92500
|
if (specificationHasChanged) {
|
|
92381
|
-
output.info().title(
|
|
92501
|
+
output.info().title(as19.grey("OpenAPI file modified")).print();
|
|
92382
92502
|
printSpecificationBanner({
|
|
92383
92503
|
version: newResult.version,
|
|
92384
92504
|
schema: newResult.schema
|
|
@@ -92403,9 +92523,9 @@ function ServeCommand() {
|
|
|
92403
92523
|
},
|
|
92404
92524
|
(info) => {
|
|
92405
92525
|
output.info().line(
|
|
92406
|
-
`${
|
|
92526
|
+
`${as19.green.bold("\u279C API Reference Server")} ${as19.white(
|
|
92407
92527
|
"listening on"
|
|
92408
|
-
)} ${
|
|
92528
|
+
)} ${as19.cyan(`http://localhost:${info.port}`)}`
|
|
92409
92529
|
).print();
|
|
92410
92530
|
}
|
|
92411
92531
|
);
|
|
@@ -92453,10 +92573,10 @@ var getHtmlDocument = (specification, watch = false) => {
|
|
|
92453
92573
|
};
|
|
92454
92574
|
|
|
92455
92575
|
// src/domains/document/share/index.ts
|
|
92456
|
-
import
|
|
92457
|
-
import { Command as
|
|
92576
|
+
import as20 from "ansis";
|
|
92577
|
+
import { Command as Command24 } from "commander";
|
|
92458
92578
|
function ShareCommand() {
|
|
92459
|
-
const cmd2 = new
|
|
92579
|
+
const cmd2 = new Command24("share");
|
|
92460
92580
|
cmd2.description("Share an OpenAPI file");
|
|
92461
92581
|
cmd2.argument("[file]", "file to share");
|
|
92462
92582
|
cmd2.option(
|
|
@@ -92482,29 +92602,29 @@ function ShareCommand() {
|
|
|
92482
92602
|
})
|
|
92483
92603
|
}).then((response) => response.json()).then((data) => {
|
|
92484
92604
|
const { id, token: newToken } = data;
|
|
92485
|
-
output.info().line(
|
|
92605
|
+
output.info().line(as20.green.bold("Your OpenAPI file is public.")).line().table(
|
|
92486
92606
|
[
|
|
92487
92607
|
[
|
|
92488
|
-
`${
|
|
92489
|
-
|
|
92608
|
+
`${as20.green("\u279C")} ${as20.white.bold("API Reference:")}`,
|
|
92609
|
+
as20.cyan(`https://sandbox.scalar.com/p/${id}`)
|
|
92490
92610
|
],
|
|
92491
92611
|
[
|
|
92492
|
-
`${
|
|
92493
|
-
|
|
92612
|
+
`${as20.grey("\u279C")} ${as20.grey.bold("Editor:")}`,
|
|
92613
|
+
as20.cyan(`https://sandbox.scalar.com/e/${id}`)
|
|
92494
92614
|
],
|
|
92495
92615
|
[],
|
|
92496
92616
|
[
|
|
92497
|
-
`${
|
|
92498
|
-
|
|
92617
|
+
`${as20.grey("\u279C")} ${as20.grey.bold("OpenAPI JSON:")}`,
|
|
92618
|
+
as20.cyan(`https://sandbox.scalar.com/files/${id}/openapi.json`)
|
|
92499
92619
|
],
|
|
92500
92620
|
[
|
|
92501
|
-
`${
|
|
92502
|
-
|
|
92621
|
+
`${as20.grey("\u279C")} ${as20.grey.bold("OpenAPI YAML:")}`,
|
|
92622
|
+
as20.cyan(`https://sandbox.scalar.com/files/${id}/openapi.yaml`)
|
|
92503
92623
|
]
|
|
92504
92624
|
],
|
|
92505
92625
|
{ padding: 1 }
|
|
92506
92626
|
).line().line("Use the token to update the existing sandbox:").line().line(
|
|
92507
|
-
`${
|
|
92627
|
+
`${as20.grey("$")} ${as20.white.bold("scalar document share --token=")}${as20.cyan.bold(`${newToken}`)} `
|
|
92508
92628
|
).line().print();
|
|
92509
92629
|
}).catch((error48) => {
|
|
92510
92630
|
output.error().title("Failed to share the file.").message(`Details: ${error48}`).exit("error");
|
|
@@ -92515,13 +92635,13 @@ function ShareCommand() {
|
|
|
92515
92635
|
|
|
92516
92636
|
// src/domains/document/upgrade/index.ts
|
|
92517
92637
|
var import_yaml4 = __toESM(require_dist(), 1);
|
|
92518
|
-
import
|
|
92638
|
+
import fs9 from "node:fs/promises";
|
|
92519
92639
|
import { confirm as confirm2 } from "@clack/prompts";
|
|
92520
|
-
import
|
|
92521
|
-
import { Command as
|
|
92522
|
-
import { normalize as
|
|
92640
|
+
import as21 from "ansis";
|
|
92641
|
+
import { Command as Command25 } from "commander";
|
|
92642
|
+
import { normalize as normalize6, upgrade } from "@scalar/openapi-parser";
|
|
92523
92643
|
function UpgradeCommand() {
|
|
92524
|
-
const cmd2 = new
|
|
92644
|
+
const cmd2 = new Command25("upgrade");
|
|
92525
92645
|
cmd2.description("Upgrade OpenAPI document to version 3.1");
|
|
92526
92646
|
cmd2.argument("[file|url]", "File or URL to validate");
|
|
92527
92647
|
cmd2.option("-o, --output <file>", "Path to save the upgraded output file");
|
|
@@ -92545,31 +92665,31 @@ function UpgradeCommand() {
|
|
|
92545
92665
|
}
|
|
92546
92666
|
}
|
|
92547
92667
|
const outputFileName = outputFilePath ?? input;
|
|
92548
|
-
const document2 =
|
|
92668
|
+
const document2 = normalize6(await getFileOrUrl(input));
|
|
92549
92669
|
const { result, executionTimeMs } = await measureTime(
|
|
92550
92670
|
() => upgrade(document2)
|
|
92551
92671
|
);
|
|
92552
92672
|
const isYaml = isYamlFileName(outputFileName);
|
|
92553
|
-
await
|
|
92673
|
+
await fs9.writeFile(
|
|
92554
92674
|
outputFileName,
|
|
92555
92675
|
isYaml ? import_yaml4.default.stringify(result.specification) : JSON.stringify(result.specification, null, 2)
|
|
92556
92676
|
);
|
|
92557
92677
|
output.info().message(
|
|
92558
|
-
`${
|
|
92678
|
+
`${as21.green(`\u2728 OpenAPI Schema upgraded to version ${result.version}`)} in ${as21.white(`${as21.bold(`${executionTimeMs.toFixed(2)}`)} ms`)}`
|
|
92559
92679
|
).print();
|
|
92560
92680
|
});
|
|
92561
92681
|
return cmd2;
|
|
92562
92682
|
}
|
|
92563
92683
|
|
|
92564
92684
|
// src/domains/document/validate/index.ts
|
|
92565
|
-
import
|
|
92566
|
-
import { Command as
|
|
92685
|
+
import as22 from "ansis";
|
|
92686
|
+
import { Command as Command26 } from "commander";
|
|
92567
92687
|
import prettyjson from "prettyjson";
|
|
92568
92688
|
import { bundle as bundle3 } from "@scalar/json-magic/bundle";
|
|
92569
92689
|
import { fetchUrls as fetchUrls3, readFiles as readFiles3 } from "@scalar/json-magic/bundle/plugins/node";
|
|
92570
92690
|
import { validate as validate2 } from "@scalar/openapi-parser";
|
|
92571
92691
|
function ValidateCommand() {
|
|
92572
|
-
const cmd2 = new
|
|
92692
|
+
const cmd2 = new Command26("validate");
|
|
92573
92693
|
cmd2.description("Validate an OpenAPI file");
|
|
92574
92694
|
cmd2.argument("[file|url]", "File or URL to validate");
|
|
92575
92695
|
cmd2.action(async (inputArgument) => {
|
|
@@ -92586,24 +92706,24 @@ function ValidateCommand() {
|
|
|
92586
92706
|
if (result.valid && result.version) {
|
|
92587
92707
|
const endTime = performance.now();
|
|
92588
92708
|
output.info().line(
|
|
92589
|
-
|
|
92590
|
-
`Matches the OpenAPI specification${
|
|
92709
|
+
as22.green(
|
|
92710
|
+
`Matches the OpenAPI specification${as22.white(` (OpenAPI ${as22.bold(result.version)})`)}
|
|
92591
92711
|
`
|
|
92592
92712
|
)
|
|
92593
92713
|
).line(
|
|
92594
|
-
`${
|
|
92595
|
-
`in ${
|
|
92714
|
+
`${as22.green("File validated")} ${as22.grey(
|
|
92715
|
+
`in ${as22.white(`${as22.bold(`${Math.round(endTime - startTime)}`)} ms`)}
|
|
92596
92716
|
`
|
|
92597
92717
|
)}`
|
|
92598
92718
|
).print();
|
|
92599
92719
|
} else {
|
|
92600
92720
|
output.error().message(prettyjson.render(result.errors)).message(
|
|
92601
|
-
|
|
92721
|
+
as22.red(
|
|
92602
92722
|
`File does not match the OpenAPI ${result.version ? `${result.version} ` : ""}specification.`
|
|
92603
92723
|
)
|
|
92604
92724
|
).message(
|
|
92605
|
-
|
|
92606
|
-
`${
|
|
92725
|
+
as22.red(
|
|
92726
|
+
`${as22.bold(
|
|
92607
92727
|
`${result.errors?.length} error${result.errors && result.errors.length > 1 ? "s" : ""}`
|
|
92608
92728
|
)} found.`
|
|
92609
92729
|
)
|
|
@@ -92615,11 +92735,11 @@ function ValidateCommand() {
|
|
|
92615
92735
|
|
|
92616
92736
|
// src/domains/document/void/index.ts
|
|
92617
92737
|
import { serve as serve3 } from "@hono/node-server";
|
|
92618
|
-
import
|
|
92619
|
-
import { Command as
|
|
92738
|
+
import as23 from "ansis";
|
|
92739
|
+
import { Command as Command27 } from "commander";
|
|
92620
92740
|
import { createVoidServer } from "@scalar/void-server";
|
|
92621
92741
|
function VoidCommand() {
|
|
92622
|
-
const cmd2 = new
|
|
92742
|
+
const cmd2 = new Command27("void");
|
|
92623
92743
|
cmd2.description("Boot a server to mirror HTTP requests");
|
|
92624
92744
|
cmd2.option("-o, --once", "run the server only once and exit after that");
|
|
92625
92745
|
cmd2.option("-p, --port <port>", "set the HTTP port for the mock server");
|
|
@@ -92651,9 +92771,9 @@ var bootServer2 = async ({
|
|
|
92651
92771
|
},
|
|
92652
92772
|
(info) => {
|
|
92653
92773
|
output.info().line(
|
|
92654
|
-
`${
|
|
92774
|
+
`${as23.green.bold("\u279C Void Server")} ${as23.white(
|
|
92655
92775
|
"listening on"
|
|
92656
|
-
)} ${
|
|
92776
|
+
)} ${as23.cyan(`http://localhost:${info.port}`)}
|
|
92657
92777
|
`
|
|
92658
92778
|
).print();
|
|
92659
92779
|
}
|
|
@@ -92666,6 +92786,7 @@ var documentCommands = [
|
|
|
92666
92786
|
SplitCommand,
|
|
92667
92787
|
JoinCommand,
|
|
92668
92788
|
FormatCommand,
|
|
92789
|
+
MarkdownCommand,
|
|
92669
92790
|
MockCommand,
|
|
92670
92791
|
ServeCommand,
|
|
92671
92792
|
ShareCommand,
|
|
@@ -92674,23 +92795,23 @@ var documentCommands = [
|
|
|
92674
92795
|
LintCommand,
|
|
92675
92796
|
UpgradeCommand
|
|
92676
92797
|
];
|
|
92677
|
-
var documentDomain = new
|
|
92798
|
+
var documentDomain = new Command28("document");
|
|
92678
92799
|
documentDomain.description("Manage local openapi file");
|
|
92679
92800
|
documentCommands.forEach((command) => documentDomain.addCommand(command()));
|
|
92680
92801
|
var document_default = documentDomain;
|
|
92681
92802
|
|
|
92682
92803
|
// src/domains/project/index.ts
|
|
92683
|
-
import { Command as
|
|
92804
|
+
import { Command as Command35 } from "commander";
|
|
92684
92805
|
|
|
92685
92806
|
// src/domains/project/preview/index.ts
|
|
92686
92807
|
import { text as text4 } from "@clack/prompts";
|
|
92687
|
-
import
|
|
92688
|
-
import { Command as
|
|
92808
|
+
import as26 from "ansis";
|
|
92809
|
+
import { Command as Command30 } from "commander";
|
|
92689
92810
|
|
|
92690
92811
|
// src/domains/project/check-config/index.ts
|
|
92691
|
-
import
|
|
92692
|
-
import
|
|
92693
|
-
import { Command as
|
|
92812
|
+
import fs11 from "node:fs";
|
|
92813
|
+
import as24 from "ansis";
|
|
92814
|
+
import { Command as Command29 } from "commander";
|
|
92694
92815
|
|
|
92695
92816
|
// ../../packages/helpers/dist/parse/parse.js
|
|
92696
92817
|
var import_json5 = __toESM(require_lib(), 1);
|
|
@@ -94067,6 +94188,15 @@ var internalNavigationConfigSchema = baseNavigationConfigSchema.extend({
|
|
|
94067
94188
|
routes: internalNavigationRoutesSchema
|
|
94068
94189
|
});
|
|
94069
94190
|
|
|
94191
|
+
// ../../packages/scalar-config/dist/schema/postprocess/types.js
|
|
94192
|
+
var llmPageSchema = zod_default.object({
|
|
94193
|
+
title: titleSchema,
|
|
94194
|
+
description: zod_default.string().optional(),
|
|
94195
|
+
type: zod_default.enum(["page", "openapi", "openapi-single"]),
|
|
94196
|
+
to: zod_default.string(),
|
|
94197
|
+
filepath: zod_default.string()
|
|
94198
|
+
});
|
|
94199
|
+
|
|
94070
94200
|
// ../../packages/scalar-config/dist/schema/site-config.js
|
|
94071
94201
|
var redirectSchema = external_exports.object({
|
|
94072
94202
|
from: external_exports.string(),
|
|
@@ -94185,7 +94315,6 @@ function parseConfig(rawConfig) {
|
|
|
94185
94315
|
const version3 = getConfigVersion(jsonConfigResult.data);
|
|
94186
94316
|
const { success: success2, data: config3, error: error48 } = configVersionToSchemaMapping[version3].safeParse(jsonConfigResult.data);
|
|
94187
94317
|
if (!success2) {
|
|
94188
|
-
console.error("Failed to parse config", rawConfig, error48);
|
|
94189
94318
|
return { success: false, error: error48, version: version3 };
|
|
94190
94319
|
}
|
|
94191
94320
|
return {
|
|
@@ -94196,7 +94325,6 @@ function parseConfig(rawConfig) {
|
|
|
94196
94325
|
}
|
|
94197
94326
|
};
|
|
94198
94327
|
} catch (error48) {
|
|
94199
|
-
console.error("Failed to parse config", rawConfig, error48);
|
|
94200
94328
|
return { success: false, error: error48 };
|
|
94201
94329
|
}
|
|
94202
94330
|
}
|
|
@@ -94877,7 +95005,7 @@ var wysiwygProjectToV2 = n.safeFn(({ project, invalidRefs, theme }) => {
|
|
|
94877
95005
|
}, (originalError) => createError("FAILED_TO_CONVERT_WYSIWYG_TO_V2", originalError));
|
|
94878
95006
|
|
|
94879
95007
|
// src/domains/project/helpers.ts
|
|
94880
|
-
import
|
|
95008
|
+
import fs10 from "node:fs";
|
|
94881
95009
|
import path5 from "node:path";
|
|
94882
95010
|
var DEFAULT_MARKDOWN_FILE_NAME = "docs-quickstart.md";
|
|
94883
95011
|
var DEFAULT_OPENAPI_FILE_NAME = "docs-openapi.json";
|
|
@@ -94889,7 +95017,7 @@ function findConfig(searchPath) {
|
|
|
94889
95017
|
return searchInDirectory(process.cwd());
|
|
94890
95018
|
}
|
|
94891
95019
|
const searchPathResolved = path5.resolve(searchPath);
|
|
94892
|
-
const stat =
|
|
95020
|
+
const stat = fs10.statSync(searchPathResolved, { throwIfNoEntry: false });
|
|
94893
95021
|
if (!stat) {
|
|
94894
95022
|
return null;
|
|
94895
95023
|
}
|
|
@@ -94906,7 +95034,7 @@ function getCurrentFolderName() {
|
|
|
94906
95034
|
}
|
|
94907
95035
|
function searchInDirectory(directory) {
|
|
94908
95036
|
try {
|
|
94909
|
-
const entries =
|
|
95037
|
+
const entries = fs10.readdirSync(directory);
|
|
94910
95038
|
for (const entry of entries) {
|
|
94911
95039
|
if (entry === CONFIG_FILE_NAME || entry.startsWith(`${CONFIG_FILE_NAME}.`)) {
|
|
94912
95040
|
return path5.join(directory, entry);
|
|
@@ -94932,7 +95060,7 @@ function readAndParseConfig(configPath) {
|
|
|
94932
95060
|
}
|
|
94933
95061
|
};
|
|
94934
95062
|
}
|
|
94935
|
-
const fileContent =
|
|
95063
|
+
const fileContent = fs11.readFileSync(file2, "utf-8");
|
|
94936
95064
|
const parseConfigResult = parseConfig(fileContent);
|
|
94937
95065
|
if (!parseConfigResult.success) {
|
|
94938
95066
|
return {
|
|
@@ -94952,17 +95080,17 @@ function readAndParseConfig(configPath) {
|
|
|
94952
95080
|
};
|
|
94953
95081
|
}
|
|
94954
95082
|
function CheckConfigCommand() {
|
|
94955
|
-
const cmd2 = new
|
|
95083
|
+
const cmd2 = new Command29("check-config");
|
|
94956
95084
|
cmd2.description("Check a Scalar Configuration file");
|
|
94957
95085
|
cmd2.argument("[file]", "File to check");
|
|
94958
95086
|
cmd2.action(async (inputArgument) => {
|
|
94959
95087
|
const result = readAndParseConfig(inputArgument);
|
|
94960
95088
|
if (result.success) {
|
|
94961
95089
|
output.info().line(
|
|
94962
|
-
`${
|
|
95090
|
+
`${as24.green("[SUCCESS]")} ${as24.green("The Scalar Configuration is valid:")} ${as24.green(result.filePath)}`
|
|
94963
95091
|
).line(
|
|
94964
|
-
`${
|
|
94965
|
-
`in ${
|
|
95092
|
+
`${as24.green("Scalar Configuration validated")} ${as24.grey(
|
|
95093
|
+
`in ${as24.white.bold(`${result.validationTime} ms`)}`
|
|
94966
95094
|
)}
|
|
94967
95095
|
`
|
|
94968
95096
|
).print();
|
|
@@ -94979,7 +95107,7 @@ function CheckConfigCommand() {
|
|
|
94979
95107
|
if (error48.issues) {
|
|
94980
95108
|
output.error().table(
|
|
94981
95109
|
error48.issues.map((issue2) => [
|
|
94982
|
-
|
|
95110
|
+
as24.yellow(`${issue2.path.join("/").trim() || "root"}:`),
|
|
94983
95111
|
issue2.message
|
|
94984
95112
|
]),
|
|
94985
95113
|
{ padding: 2 }
|
|
@@ -94994,7 +95122,7 @@ function CheckConfigCommand() {
|
|
|
94994
95122
|
|
|
94995
95123
|
// src/domains/project/preview/v2.ts
|
|
94996
95124
|
import { execFile, spawn } from "node:child_process";
|
|
94997
|
-
import
|
|
95125
|
+
import fs12 from "node:fs/promises";
|
|
94998
95126
|
import os2 from "node:os";
|
|
94999
95127
|
import path6 from "node:path";
|
|
95000
95128
|
import { Readable } from "node:stream";
|
|
@@ -95003,14 +95131,14 @@ import tar from "tar-fs";
|
|
|
95003
95131
|
|
|
95004
95132
|
// src/helpers/run-command.ts
|
|
95005
95133
|
import { exec as exec2 } from "node:child_process";
|
|
95006
|
-
import
|
|
95134
|
+
import as25 from "ansis";
|
|
95007
95135
|
async function runCommand(command, cwd2) {
|
|
95008
95136
|
return new Promise((resolve, reject) => {
|
|
95009
95137
|
const comm = exec2(command, { cwd: cwd2 });
|
|
95010
95138
|
comm.stdout?.pipe(process.stdout);
|
|
95011
95139
|
comm.stderr?.pipe(process.stderr);
|
|
95012
95140
|
comm.on("error", (err) => {
|
|
95013
|
-
|
|
95141
|
+
as25.redBright(err.message);
|
|
95014
95142
|
reject(err);
|
|
95015
95143
|
});
|
|
95016
95144
|
comm.on("close", (code) => code === 0 ? resolve(true) : reject(code));
|
|
@@ -95022,7 +95150,7 @@ var ISOLATE_EXTRACTION_DIR = path6.join(os2.homedir(), ".scalar");
|
|
|
95022
95150
|
var ISOLATE_DIR = path6.join(ISOLATE_EXTRACTION_DIR, "isolate");
|
|
95023
95151
|
async function getExistingIsolateVersion() {
|
|
95024
95152
|
try {
|
|
95025
|
-
const packageJsonString = await
|
|
95153
|
+
const packageJsonString = await fs12.readFile(
|
|
95026
95154
|
path6.join(ISOLATE_DIR, "package.json"),
|
|
95027
95155
|
"utf8"
|
|
95028
95156
|
);
|
|
@@ -95077,7 +95205,7 @@ Remove-Item $tempFile
|
|
|
95077
95205
|
async function downloadIsolate() {
|
|
95078
95206
|
const existingIsolateVersion = await getExistingIsolateVersion();
|
|
95079
95207
|
if (config2.ssgDocsIsolateVersion === existingIsolateVersion) return;
|
|
95080
|
-
await
|
|
95208
|
+
await fs12.rm(ISOLATE_EXTRACTION_DIR, { force: true, recursive: true });
|
|
95081
95209
|
const logger = output.info({ animate: true }).loader("Downloading docs isolate. This may take a minute...");
|
|
95082
95210
|
const ISOLATE_URL = `${config2.cdnUrl}/isolates/${config2.ssgDocsIsolateVersion}-isolate.tar.gz`;
|
|
95083
95211
|
if (process.platform === "win32") {
|
|
@@ -95142,7 +95270,7 @@ async function previewV2Project({
|
|
|
95142
95270
|
|
|
95143
95271
|
// src/domains/project/preview/index.ts
|
|
95144
95272
|
var PreviewCommand = () => {
|
|
95145
|
-
const cmd2 = new
|
|
95273
|
+
const cmd2 = new Command30("preview");
|
|
95146
95274
|
cmd2.description("Preview scalar guides");
|
|
95147
95275
|
cmd2.argument(
|
|
95148
95276
|
"[config]",
|
|
@@ -95200,7 +95328,7 @@ var PreviewCommand = () => {
|
|
|
95200
95328
|
if (error48.issues) {
|
|
95201
95329
|
output.error().table(
|
|
95202
95330
|
error48.issues.map((issue2) => [
|
|
95203
|
-
|
|
95331
|
+
as26.yellow(`${issue2.path.join("/").trim() || "root"}:`),
|
|
95204
95332
|
issue2.message
|
|
95205
95333
|
]),
|
|
95206
95334
|
{ padding: 2 }
|
|
@@ -95211,7 +95339,7 @@ var PreviewCommand = () => {
|
|
|
95211
95339
|
}
|
|
95212
95340
|
if (parseConfigResult.success) {
|
|
95213
95341
|
output.info().line(
|
|
95214
|
-
`${
|
|
95342
|
+
`${as26.green("[SUCCESS]")} ${as26.green("Configuration is valid:")} ${as26.green(parseConfigResult.filePath)}`
|
|
95215
95343
|
).print();
|
|
95216
95344
|
}
|
|
95217
95345
|
const { config: config3 } = parseConfigResult;
|
|
@@ -95234,10 +95362,10 @@ var PreviewCommand = () => {
|
|
|
95234
95362
|
|
|
95235
95363
|
// src/domains/project/create/index.ts
|
|
95236
95364
|
import { text as text5 } from "@clack/prompts";
|
|
95237
|
-
import
|
|
95238
|
-
import { Command as
|
|
95365
|
+
import as27 from "ansis";
|
|
95366
|
+
import { Command as Command31 } from "commander";
|
|
95239
95367
|
var CreateCommand = () => {
|
|
95240
|
-
const cmd2 = new
|
|
95368
|
+
const cmd2 = new Command31("create");
|
|
95241
95369
|
cmd2.description(
|
|
95242
95370
|
"Create a new project that is not linked to a github project."
|
|
95243
95371
|
);
|
|
@@ -95274,19 +95402,19 @@ var CreateCommand = () => {
|
|
|
95274
95402
|
}
|
|
95275
95403
|
logger.update("loader", 0, { content: "Project created successfully!" });
|
|
95276
95404
|
logger.message(
|
|
95277
|
-
`Project uid: ${
|
|
95278
|
-
Project slug: ${
|
|
95405
|
+
`Project uid: ${as27.cyan(response.data.uid)}
|
|
95406
|
+
Project slug: ${as27.cyan(response.data.slug)}`
|
|
95279
95407
|
).exit("success");
|
|
95280
95408
|
});
|
|
95281
95409
|
return cmd2;
|
|
95282
95410
|
};
|
|
95283
95411
|
|
|
95284
95412
|
// src/domains/project/init/index.ts
|
|
95285
|
-
import
|
|
95413
|
+
import fs13 from "node:fs/promises";
|
|
95286
95414
|
import path7 from "node:path";
|
|
95287
95415
|
import { cancel, confirm as confirm3, isCancel, text as text6 } from "@clack/prompts";
|
|
95288
|
-
import
|
|
95289
|
-
import { Command as
|
|
95416
|
+
import as28 from "ansis";
|
|
95417
|
+
import { Command as Command32 } from "commander";
|
|
95290
95418
|
|
|
95291
95419
|
// ../../node_modules/.pnpm/@scalar+galaxy@0.6.1/node_modules/@scalar/galaxy/dist/3.1.json
|
|
95292
95420
|
var __default = {
|
|
@@ -97239,14 +97367,14 @@ We're here to help:
|
|
|
97239
97367
|
// src/domains/project/init/index.ts
|
|
97240
97368
|
async function fileExists2(path12) {
|
|
97241
97369
|
try {
|
|
97242
|
-
await
|
|
97370
|
+
await fs13.access(path12, fs13.constants.F_OK);
|
|
97243
97371
|
return true;
|
|
97244
97372
|
} catch {
|
|
97245
97373
|
return false;
|
|
97246
97374
|
}
|
|
97247
97375
|
}
|
|
97248
97376
|
var InitCommand = () => {
|
|
97249
|
-
const cmd2 = new
|
|
97377
|
+
const cmd2 = new Command32("init");
|
|
97250
97378
|
cmd2.description("Create a new Scalar Docs project.");
|
|
97251
97379
|
cmd2.option("-s, --subdomain [url]", "subdomain to publish on");
|
|
97252
97380
|
cmd2.option("--force", "override existing configuration");
|
|
@@ -97255,14 +97383,14 @@ var InitCommand = () => {
|
|
|
97255
97383
|
let validInput;
|
|
97256
97384
|
const nextSteps = () => {
|
|
97257
97385
|
output.info().line("What to do next:").line(
|
|
97258
|
-
` ${
|
|
97386
|
+
` ${as28.cyan("scalar project preview")} to preview your project locally`
|
|
97259
97387
|
).line(
|
|
97260
|
-
` ${
|
|
97388
|
+
` ${as28.cyan("scalar project check-config")} to validate your scalar.config.json file`
|
|
97261
97389
|
).line(
|
|
97262
|
-
` ${
|
|
97390
|
+
` ${as28.cyan("scalar project publish --slug")} ${as28.gray("[dashboard-project-slug]")} to publish your project`
|
|
97263
97391
|
).line(
|
|
97264
|
-
|
|
97265
|
-
`Run ${
|
|
97392
|
+
as28.white(
|
|
97393
|
+
`Run ${as28.magenta("scalar --help")} to see all available commands.`
|
|
97266
97394
|
)
|
|
97267
97395
|
).print();
|
|
97268
97396
|
};
|
|
@@ -97273,10 +97401,10 @@ var InitCommand = () => {
|
|
|
97273
97401
|
};
|
|
97274
97402
|
if (await fileExists2(configFile)) {
|
|
97275
97403
|
output.info().line(
|
|
97276
|
-
`${
|
|
97404
|
+
`${as28.green("\u26A0")} Found existing configuration: ${as28.green.bold(`${configFile}`)}`
|
|
97277
97405
|
).print();
|
|
97278
97406
|
if (force) {
|
|
97279
|
-
output.info().line(`${
|
|
97407
|
+
output.info().line(`${as28.green("\u2714")} Overwriting existing file\u2026`).print();
|
|
97280
97408
|
}
|
|
97281
97409
|
const shouldOverwriteExisting = force ?? await confirm3({
|
|
97282
97410
|
message: "Do you want to override the file?",
|
|
@@ -97331,23 +97459,23 @@ var InitCommand = () => {
|
|
|
97331
97459
|
const slug = slugify3(title);
|
|
97332
97460
|
configuration.info = { title, description: `Documentation for ${title}` };
|
|
97333
97461
|
subdomain = slug;
|
|
97334
|
-
output.info().line(`${
|
|
97462
|
+
output.info().line(`${as28.green("\u2714")} Subdomain: ${as28.green(subdomain)}`).print();
|
|
97335
97463
|
}
|
|
97336
97464
|
configuration.siteConfig.subdomain = subdomain.trim();
|
|
97337
97465
|
const content = JSON.stringify(configuration, null, 2);
|
|
97338
|
-
await
|
|
97339
|
-
await
|
|
97466
|
+
await fs13.writeFile(configFile, content);
|
|
97467
|
+
await fs13.writeFile(
|
|
97340
97468
|
path7.join(currentDir, DEFAULT_MARKDOWN_FILE_NAME),
|
|
97341
97469
|
quickstartMarkdown
|
|
97342
97470
|
);
|
|
97343
|
-
await
|
|
97471
|
+
await fs13.writeFile(
|
|
97344
97472
|
path7.join(currentDir, DEFAULT_OPENAPI_FILE_NAME),
|
|
97345
97473
|
JSON.stringify(__default, null, 2)
|
|
97346
97474
|
);
|
|
97347
|
-
output.info().line(`${
|
|
97348
|
-
`).line(`${
|
|
97475
|
+
output.info().line(`${as28.green("\u2714")} Configuration stored.
|
|
97476
|
+
`).line(`${as28.green.bold(`${configFile}`)}
|
|
97349
97477
|
`).line(
|
|
97350
|
-
`${
|
|
97478
|
+
`${as28.grey(
|
|
97351
97479
|
content.split("\n").map((line) => ` ${line}`).join("\n")
|
|
97352
97480
|
)}`
|
|
97353
97481
|
).print();
|
|
@@ -97357,12 +97485,12 @@ var InitCommand = () => {
|
|
|
97357
97485
|
};
|
|
97358
97486
|
|
|
97359
97487
|
// src/domains/project/publish/index.ts
|
|
97360
|
-
import
|
|
97488
|
+
import fs15 from "node:fs";
|
|
97361
97489
|
import { dirname } from "node:path";
|
|
97362
|
-
import { Command as
|
|
97490
|
+
import { Command as Command33 } from "commander";
|
|
97363
97491
|
|
|
97364
97492
|
// src/domains/project/publish/publish.ts
|
|
97365
|
-
import
|
|
97493
|
+
import fs14 from "node:fs";
|
|
97366
97494
|
import path8 from "node:path";
|
|
97367
97495
|
import { Readable as Readable2 } from "node:stream";
|
|
97368
97496
|
import ignore from "ignore";
|
|
@@ -97373,7 +97501,7 @@ function isErrnoException(error48) {
|
|
|
97373
97501
|
}
|
|
97374
97502
|
async function readGitIgnore(configDir) {
|
|
97375
97503
|
try {
|
|
97376
|
-
const gitignore = await
|
|
97504
|
+
const gitignore = await fs14.promises.readFile(
|
|
97377
97505
|
path8.resolve(configDir, ".gitignore"),
|
|
97378
97506
|
"utf8"
|
|
97379
97507
|
);
|
|
@@ -97465,7 +97593,7 @@ var sleep = (ms) => {
|
|
|
97465
97593
|
|
|
97466
97594
|
// src/domains/project/publish/index.ts
|
|
97467
97595
|
var PublishCommand = () => {
|
|
97468
|
-
const cmd2 = new
|
|
97596
|
+
const cmd2 = new Command33("publish");
|
|
97469
97597
|
cmd2.description(
|
|
97470
97598
|
"Publish new build for a github sync project that is not linked."
|
|
97471
97599
|
);
|
|
@@ -97519,10 +97647,10 @@ var PublishCommand = () => {
|
|
|
97519
97647
|
});
|
|
97520
97648
|
}
|
|
97521
97649
|
const configPath = configPathOption ?? findConfig();
|
|
97522
|
-
if (!configPath || !
|
|
97650
|
+
if (!configPath || !fs15.existsSync(configPath)) {
|
|
97523
97651
|
return output.error().title("Invalid configuration file").message("Could not find the Scalar Configuration file:").message(configPath ?? "").exit("error");
|
|
97524
97652
|
}
|
|
97525
|
-
const rawConfig =
|
|
97653
|
+
const rawConfig = fs15.readFileSync(configPath, "utf-8");
|
|
97526
97654
|
const configParseResult = parseConfig(rawConfig);
|
|
97527
97655
|
if (!configParseResult.success) {
|
|
97528
97656
|
return output.error().title("Invalid configuration file").line(
|
|
@@ -97567,13 +97695,13 @@ async function waitForPublish({
|
|
|
97567
97695
|
}
|
|
97568
97696
|
logger.update("loader", 0, { content: deployStatus.data.message });
|
|
97569
97697
|
if (deployStatus.data.status === "deployed") {
|
|
97570
|
-
logger.exit("success");
|
|
97571
97698
|
const deploymentUrl = getPublishDeploymentUrl(deployStatus.data);
|
|
97572
97699
|
if (deploymentUrl) {
|
|
97573
97700
|
output.info().line(
|
|
97574
97701
|
`${deployStatus.data.preview ? "Preview URL" : "Deployment URL"}: ${deploymentUrl}`
|
|
97575
97702
|
).print();
|
|
97576
97703
|
}
|
|
97704
|
+
logger.exit("success");
|
|
97577
97705
|
return;
|
|
97578
97706
|
}
|
|
97579
97707
|
if (deployStatus.data.status === "error") {
|
|
@@ -97602,11 +97730,11 @@ async function getDeployStatus({
|
|
|
97602
97730
|
}
|
|
97603
97731
|
|
|
97604
97732
|
// src/domains/project/upgrade/index.ts
|
|
97605
|
-
import
|
|
97733
|
+
import fs16 from "node:fs/promises";
|
|
97606
97734
|
import path9 from "node:path";
|
|
97607
97735
|
import { text as text7 } from "@clack/prompts";
|
|
97608
|
-
import
|
|
97609
|
-
import { Command as
|
|
97736
|
+
import as29 from "ansis";
|
|
97737
|
+
import { Command as Command34 } from "commander";
|
|
97610
97738
|
import { n as n2 } from "neverpanic";
|
|
97611
97739
|
|
|
97612
97740
|
// src/errors.ts
|
|
@@ -97635,7 +97763,7 @@ function displayError(error48, fallback = "Unknown error occurred. Please contac
|
|
|
97635
97763
|
|
|
97636
97764
|
// src/domains/project/upgrade/index.ts
|
|
97637
97765
|
var UpgradeCommand2 = () => {
|
|
97638
|
-
const cmd2 = new
|
|
97766
|
+
const cmd2 = new Command34("upgrade");
|
|
97639
97767
|
cmd2.description("Upgrade scalar project");
|
|
97640
97768
|
cmd2.argument(
|
|
97641
97769
|
"[config]",
|
|
@@ -97661,7 +97789,7 @@ var UpgradeCommand2 = () => {
|
|
|
97661
97789
|
if (error48.issues) {
|
|
97662
97790
|
output.error().table(
|
|
97663
97791
|
error48.issues.map((issue2) => [
|
|
97664
|
-
|
|
97792
|
+
as29.yellow(`${issue2.path.join("/").trim() || "root"}:`),
|
|
97665
97793
|
issue2.message
|
|
97666
97794
|
]),
|
|
97667
97795
|
{ padding: 2 }
|
|
@@ -97672,7 +97800,7 @@ var UpgradeCommand2 = () => {
|
|
|
97672
97800
|
}
|
|
97673
97801
|
if (parseConfigResult.success) {
|
|
97674
97802
|
output.info().line(
|
|
97675
|
-
`${
|
|
97803
|
+
`${as29.green("[SUCCESS]")} ${as29.green("Configuration is valid:")} ${as29.green(parseConfigResult.filePath)}`
|
|
97676
97804
|
).print();
|
|
97677
97805
|
}
|
|
97678
97806
|
const { config: config3 } = parseConfigResult;
|
|
@@ -97691,7 +97819,7 @@ var UpgradeCommand2 = () => {
|
|
|
97691
97819
|
const { upgradedConfig, legacyTheme, legacyFooter, legacyScript } = upgradedConfigResult.data;
|
|
97692
97820
|
if (legacyTheme) {
|
|
97693
97821
|
const writeUpgradedThemeResult = await n2.fromUnsafe(
|
|
97694
|
-
() =>
|
|
97822
|
+
() => fs16.writeFile(
|
|
97695
97823
|
path9.resolve(
|
|
97696
97824
|
path9.dirname(parseConfigResult.filePath),
|
|
97697
97825
|
config3.root ?? "./",
|
|
@@ -97707,7 +97835,7 @@ var UpgradeCommand2 = () => {
|
|
|
97707
97835
|
}
|
|
97708
97836
|
if (legacyFooter) {
|
|
97709
97837
|
const writeUpgradedFooterResult = await n2.fromUnsafe(
|
|
97710
|
-
() =>
|
|
97838
|
+
() => fs16.writeFile(
|
|
97711
97839
|
path9.resolve(
|
|
97712
97840
|
path9.dirname(parseConfigResult.filePath),
|
|
97713
97841
|
config3.root ?? "./",
|
|
@@ -97723,7 +97851,7 @@ var UpgradeCommand2 = () => {
|
|
|
97723
97851
|
}
|
|
97724
97852
|
if (legacyScript) {
|
|
97725
97853
|
const writeUpgradedScriptResult = await n2.fromUnsafe(
|
|
97726
|
-
() =>
|
|
97854
|
+
() => fs16.writeFile(
|
|
97727
97855
|
path9.resolve(
|
|
97728
97856
|
path9.dirname(parseConfigResult.filePath),
|
|
97729
97857
|
config3.root ?? "./",
|
|
@@ -97738,7 +97866,7 @@ var UpgradeCommand2 = () => {
|
|
|
97738
97866
|
}
|
|
97739
97867
|
}
|
|
97740
97868
|
const writeUpgradedConfigResult = await n2.fromUnsafe(
|
|
97741
|
-
() =>
|
|
97869
|
+
() => fs16.writeFile(
|
|
97742
97870
|
parseConfigResult.filePath,
|
|
97743
97871
|
JSON.stringify(upgradedConfig, null, 2)
|
|
97744
97872
|
),
|
|
@@ -97761,21 +97889,21 @@ var projectCommands = [
|
|
|
97761
97889
|
PublishCommand,
|
|
97762
97890
|
UpgradeCommand2
|
|
97763
97891
|
];
|
|
97764
|
-
var projectDomain = new
|
|
97892
|
+
var projectDomain = new Command35("project");
|
|
97765
97893
|
projectDomain.description("Manage scalar project");
|
|
97766
97894
|
projectCommands.forEach((command) => projectDomain.addCommand(command()));
|
|
97767
97895
|
var project_default = projectDomain;
|
|
97768
97896
|
|
|
97769
97897
|
// src/domains/readme/index.ts
|
|
97770
|
-
import { Command as
|
|
97898
|
+
import { Command as Command37 } from "commander";
|
|
97771
97899
|
|
|
97772
97900
|
// src/domains/readme/generate.ts
|
|
97773
97901
|
import { text as text8 } from "@clack/prompts";
|
|
97774
|
-
import
|
|
97775
|
-
import { Command as
|
|
97902
|
+
import as30 from "ansis";
|
|
97903
|
+
import { Command as Command36 } from "commander";
|
|
97776
97904
|
|
|
97777
97905
|
// src/helpers/documentation/index.ts
|
|
97778
|
-
import
|
|
97906
|
+
import fs17 from "node:fs/promises";
|
|
97779
97907
|
import path10 from "node:path";
|
|
97780
97908
|
var generateDocs = (command, depth = 0) => {
|
|
97781
97909
|
const documentation = [];
|
|
@@ -97804,13 +97932,13 @@ ${docs.content}${codeBlock}`);
|
|
|
97804
97932
|
};
|
|
97805
97933
|
var generateDocumentationFile = async (outputPath) => {
|
|
97806
97934
|
const commandDocumentation = generateCommandDocumentation(getProgram());
|
|
97807
|
-
const template = await
|
|
97935
|
+
const template = await fs17.readFile(
|
|
97808
97936
|
path10.join(import.meta.dirname, "template.md"),
|
|
97809
97937
|
{
|
|
97810
97938
|
encoding: "utf-8"
|
|
97811
97939
|
}
|
|
97812
97940
|
);
|
|
97813
|
-
await
|
|
97941
|
+
await fs17.writeFile(
|
|
97814
97942
|
outputPath,
|
|
97815
97943
|
template.replace("<COMMANDS>", commandDocumentation)
|
|
97816
97944
|
);
|
|
@@ -97818,7 +97946,7 @@ var generateDocumentationFile = async (outputPath) => {
|
|
|
97818
97946
|
|
|
97819
97947
|
// src/domains/readme/generate.ts
|
|
97820
97948
|
function GenerateReadmeCommand() {
|
|
97821
|
-
const cmd2 = new
|
|
97949
|
+
const cmd2 = new Command36("generate");
|
|
97822
97950
|
cmd2.description("Self generate documentation for the cli");
|
|
97823
97951
|
cmd2.option(
|
|
97824
97952
|
"-o, --output [file]",
|
|
@@ -97843,20 +97971,20 @@ function GenerateReadmeCommand() {
|
|
|
97843
97971
|
const { executionTimeMs } = await measureTime(
|
|
97844
97972
|
() => generateDocumentationFile(outputPath)
|
|
97845
97973
|
);
|
|
97846
|
-
output.info().line().title(
|
|
97847
|
-
`\u23F1\uFE0F Generation completed in ${
|
|
97974
|
+
output.info().line().title(as30.green("Documentation Generated Successfully! \u{1F389}")).line().message(`\u2728 Documentation has been generated at: ${as30.blue(outputPath)}`).line(
|
|
97975
|
+
`\u23F1\uFE0F Generation completed in ${as30.yellow(executionTimeMs.toFixed(2))}ms`
|
|
97848
97976
|
).line("").exit("success");
|
|
97849
97977
|
});
|
|
97850
97978
|
return cmd2;
|
|
97851
97979
|
}
|
|
97852
97980
|
|
|
97853
97981
|
// src/domains/readme/serve.ts
|
|
97854
|
-
import
|
|
97982
|
+
import fs18 from "node:fs/promises";
|
|
97855
97983
|
import path11 from "node:path";
|
|
97856
|
-
import
|
|
97984
|
+
import as31 from "ansis";
|
|
97857
97985
|
var fileExists3 = async (filePath) => {
|
|
97858
97986
|
try {
|
|
97859
|
-
await
|
|
97987
|
+
await fs18.access(filePath);
|
|
97860
97988
|
return true;
|
|
97861
97989
|
} catch {
|
|
97862
97990
|
return false;
|
|
@@ -97875,24 +98003,24 @@ function ServeReadmeCommand(cmd2) {
|
|
|
97875
98003
|
openBrowser(docsUrl);
|
|
97876
98004
|
output.info().message(
|
|
97877
98005
|
"Documentation is being opened in your default browser. If it does not open automatically, please visit the following URL:"
|
|
97878
|
-
).line(
|
|
98006
|
+
).line(as31.blue(docsUrl)).line().exit("success");
|
|
97879
98007
|
});
|
|
97880
98008
|
return cmd2;
|
|
97881
98009
|
}
|
|
97882
98010
|
|
|
97883
98011
|
// src/domains/readme/index.ts
|
|
97884
|
-
var readmeDomain = new
|
|
98012
|
+
var readmeDomain = new Command37("readme");
|
|
97885
98013
|
readmeDomain.addCommand(GenerateReadmeCommand());
|
|
97886
98014
|
ServeReadmeCommand(readmeDomain);
|
|
97887
98015
|
var readme_default = readmeDomain;
|
|
97888
98016
|
|
|
97889
98017
|
// src/domains/registry/index.ts
|
|
97890
|
-
import { Command as
|
|
98018
|
+
import { Command as Command42 } from "commander";
|
|
97891
98019
|
|
|
97892
98020
|
// src/domains/registry/publish/index.ts
|
|
97893
98021
|
import { text as text9 } from "@clack/prompts";
|
|
97894
|
-
import
|
|
97895
|
-
import { Command as
|
|
98022
|
+
import as32 from "ansis";
|
|
98023
|
+
import { Command as Command38 } from "commander";
|
|
97896
98024
|
import { bundle as bundle4 } from "@scalar/json-magic/bundle";
|
|
97897
98025
|
import { fetchUrls as fetchUrls4, readFiles as readFiles4 } from "@scalar/json-magic/bundle/plugins/node";
|
|
97898
98026
|
import { parseJsonOrYaml as parseJsonOrYaml2 } from "@scalar/oas-utils/helpers";
|
|
@@ -97905,7 +98033,7 @@ function apiDashboardUrl(uid) {
|
|
|
97905
98033
|
|
|
97906
98034
|
// src/domains/registry/publish/index.ts
|
|
97907
98035
|
var PublishCommand2 = () => {
|
|
97908
|
-
const cmd2 = new
|
|
98036
|
+
const cmd2 = new Command38("publish");
|
|
97909
98037
|
cmd2.description("Publish an OpenAPI document to the Scalar registry");
|
|
97910
98038
|
cmd2.argument("[file]", "OpenAPI file to upload");
|
|
97911
98039
|
cmd2.option(
|
|
@@ -98044,15 +98172,15 @@ var PublishCommand2 = () => {
|
|
|
98044
98172
|
const dashboardUrl = apiDashboardUrl(
|
|
98045
98173
|
matchingApi?.uid ?? publishRes.data.uid
|
|
98046
98174
|
);
|
|
98047
|
-
output.info().line(`${
|
|
98175
|
+
output.info().line(`${as32.green("\u279C")} ${as32.white.bold("View in dashboard:")}`).line(as32.cyan(dashboardUrl)).line().line(`${as32.green("\u279C")} ${as32.white.bold("Registry Preview:")}`).line(as32.cyan(registryUrl(api.url({ version: version3 })))).line().line(`${as32.green("\u279C")} ${as32.white.bold("Registry YAML:")}`).line(as32.cyan(registryUrl(api.url({ version: version3, format: "yaml" })))).line().line(`${as32.green("\u279C")} ${as32.white.bold("Registry JSON:")}`).line(as32.cyan(registryUrl(api.url({ version: version3, format: "json" })))).print();
|
|
98048
98176
|
});
|
|
98049
98177
|
return cmd2;
|
|
98050
98178
|
};
|
|
98051
98179
|
|
|
98052
98180
|
// src/domains/registry/delete/index.ts
|
|
98053
|
-
import { Command as
|
|
98181
|
+
import { Command as Command39 } from "commander";
|
|
98054
98182
|
var DeleteCommand = () => {
|
|
98055
|
-
const cmd2 = new
|
|
98183
|
+
const cmd2 = new Command39("delete");
|
|
98056
98184
|
cmd2.description("Delete a document from scalar registry");
|
|
98057
98185
|
cmd2.argument("[namespace]", "Team namespace");
|
|
98058
98186
|
cmd2.argument("[slug]", "Managed doc slug");
|
|
@@ -98069,10 +98197,10 @@ var DeleteCommand = () => {
|
|
|
98069
98197
|
};
|
|
98070
98198
|
|
|
98071
98199
|
// src/domains/registry/list/index.ts
|
|
98072
|
-
import
|
|
98073
|
-
import { Command as
|
|
98200
|
+
import as33 from "ansis";
|
|
98201
|
+
import { Command as Command40 } from "commander";
|
|
98074
98202
|
var ListCommand = () => {
|
|
98075
|
-
const cmd2 = new
|
|
98203
|
+
const cmd2 = new Command40("list");
|
|
98076
98204
|
cmd2.description("List all registry APIs for a team namespace");
|
|
98077
98205
|
cmd2.option("--namespace <namespace>", "Team namespace");
|
|
98078
98206
|
cmd2.action(async (args) => {
|
|
@@ -98108,17 +98236,17 @@ var ListCommand = () => {
|
|
|
98108
98236
|
output.info().table(
|
|
98109
98237
|
[
|
|
98110
98238
|
[
|
|
98111
|
-
|
|
98112
|
-
|
|
98113
|
-
|
|
98114
|
-
|
|
98239
|
+
as33.underline.bold("Slug"),
|
|
98240
|
+
as33.underline.bold("Title"),
|
|
98241
|
+
as33.underline.bold("Version"),
|
|
98242
|
+
as33.underline.bold("Privacy")
|
|
98115
98243
|
],
|
|
98116
98244
|
...listApisRes.data.map((api) => {
|
|
98117
98245
|
return [
|
|
98118
|
-
|
|
98119
|
-
|
|
98120
|
-
|
|
98121
|
-
api.isPrivate ?
|
|
98246
|
+
as33.blue(api.slug),
|
|
98247
|
+
as33.blue(api.title),
|
|
98248
|
+
as33.blue(api.version),
|
|
98249
|
+
api.isPrivate ? as33.green("Private") : as33.yellow("Public")
|
|
98122
98250
|
];
|
|
98123
98251
|
})
|
|
98124
98252
|
],
|
|
@@ -98130,10 +98258,10 @@ var ListCommand = () => {
|
|
|
98130
98258
|
|
|
98131
98259
|
// src/domains/registry/update/index.ts
|
|
98132
98260
|
import { text as text10 } from "@clack/prompts";
|
|
98133
|
-
import
|
|
98134
|
-
import { Command as
|
|
98261
|
+
import as34 from "ansis";
|
|
98262
|
+
import { Command as Command41 } from "commander";
|
|
98135
98263
|
var UpdateCommand = () => {
|
|
98136
|
-
const cmd2 = new
|
|
98264
|
+
const cmd2 = new Command41("update");
|
|
98137
98265
|
cmd2.description("Update document metadata on scalar registry");
|
|
98138
98266
|
cmd2.argument("[namespace]", "namespace of document you want to update");
|
|
98139
98267
|
cmd2.argument("[slug]", "slug of document you want to update");
|
|
@@ -98152,12 +98280,12 @@ var UpdateCommand = () => {
|
|
|
98152
98280
|
const shouldPrompt = ![title, description].some((it) => it !== void 0);
|
|
98153
98281
|
if (!titleValue && shouldPrompt) {
|
|
98154
98282
|
titleValue = await text10({
|
|
98155
|
-
message: `What is the new title of your document? ${
|
|
98283
|
+
message: `What is the new title of your document? ${as34.grey("(Optional)")}`
|
|
98156
98284
|
});
|
|
98157
98285
|
}
|
|
98158
98286
|
if (!descriptionValue && shouldPrompt) {
|
|
98159
98287
|
descriptionValue = await text10({
|
|
98160
|
-
message: `What is the new description of your document? ${
|
|
98288
|
+
message: `What is the new description of your document? ${as34.grey("(Optional)")}`
|
|
98161
98289
|
});
|
|
98162
98290
|
}
|
|
98163
98291
|
if (!titleValue && !descriptionValue) {
|
|
@@ -98186,17 +98314,17 @@ var registryCommands = [
|
|
|
98186
98314
|
DeleteCommand,
|
|
98187
98315
|
ListCommand
|
|
98188
98316
|
];
|
|
98189
|
-
var registryDomain = new
|
|
98317
|
+
var registryDomain = new Command42("registry");
|
|
98190
98318
|
registryDomain.description("Manage your scalar registry");
|
|
98191
98319
|
registryCommands.forEach((command) => registryDomain.addCommand(command()));
|
|
98192
98320
|
var registry_default = registryDomain;
|
|
98193
98321
|
|
|
98194
98322
|
// src/domains/team/index.ts
|
|
98195
|
-
import { Command as
|
|
98323
|
+
import { Command as Command45 } from "commander";
|
|
98196
98324
|
|
|
98197
98325
|
// src/domains/team/list/index.ts
|
|
98198
|
-
import
|
|
98199
|
-
import { Command as
|
|
98326
|
+
import as35 from "ansis";
|
|
98327
|
+
import { Command as Command43 } from "commander";
|
|
98200
98328
|
|
|
98201
98329
|
// src/domains/team/helpers.ts
|
|
98202
98330
|
var getUserTeams = async (client, email3) => {
|
|
@@ -98211,7 +98339,7 @@ var getUserTeams = async (client, email3) => {
|
|
|
98211
98339
|
|
|
98212
98340
|
// src/domains/team/list/index.ts
|
|
98213
98341
|
var ListCommand2 = () => {
|
|
98214
|
-
const cmd2 = new
|
|
98342
|
+
const cmd2 = new Command43("list");
|
|
98215
98343
|
cmd2.description("List all teams current user is part of");
|
|
98216
98344
|
cmd2.action(async () => {
|
|
98217
98345
|
const auth = await getAuthData();
|
|
@@ -98224,7 +98352,7 @@ var ListCommand2 = () => {
|
|
|
98224
98352
|
output.info().table(
|
|
98225
98353
|
teams.data.map((it) => {
|
|
98226
98354
|
const isCurrentTeam = it.teamUid === auth.teamUid;
|
|
98227
|
-
const color = isCurrentTeam ?
|
|
98355
|
+
const color = isCurrentTeam ? as35.green : as35.blue;
|
|
98228
98356
|
const teamName = isCurrentTeam ? `${it.teamName} (default)` : it.teamName;
|
|
98229
98357
|
return [isCurrentTeam ? color("\u279C") : " ", color(teamName)];
|
|
98230
98358
|
}),
|
|
@@ -98236,10 +98364,10 @@ var ListCommand2 = () => {
|
|
|
98236
98364
|
|
|
98237
98365
|
// src/domains/team/set/index.ts
|
|
98238
98366
|
import { select as select7 } from "@clack/prompts";
|
|
98239
|
-
import
|
|
98240
|
-
import { Command as
|
|
98367
|
+
import as36 from "ansis";
|
|
98368
|
+
import { Command as Command44 } from "commander";
|
|
98241
98369
|
var SetCommand = () => {
|
|
98242
|
-
const cmd2 = new
|
|
98370
|
+
const cmd2 = new Command44("set");
|
|
98243
98371
|
cmd2.description("Set current active team for the user");
|
|
98244
98372
|
cmd2.option("--team <team>", "Team uid");
|
|
98245
98373
|
cmd2.action(async ({ team }) => {
|
|
@@ -98271,7 +98399,7 @@ var SetCommand = () => {
|
|
|
98271
98399
|
}
|
|
98272
98400
|
await refreshToken(auth.refreshToken, teamValue);
|
|
98273
98401
|
output.info().message(
|
|
98274
|
-
`Operation ${
|
|
98402
|
+
`Operation ${as36.green("successful")}. Selected team: ${as36.cyan(selectedTeam.teamName)}`
|
|
98275
98403
|
).print();
|
|
98276
98404
|
});
|
|
98277
98405
|
return cmd2;
|
|
@@ -98279,18 +98407,18 @@ var SetCommand = () => {
|
|
|
98279
98407
|
|
|
98280
98408
|
// src/domains/team/index.ts
|
|
98281
98409
|
var teamCommands = [ListCommand2, SetCommand];
|
|
98282
|
-
var teamDomain = new
|
|
98410
|
+
var teamDomain = new Command45("team");
|
|
98283
98411
|
teamDomain.description("Manage user teams");
|
|
98284
98412
|
teamCommands.forEach((command) => teamDomain.addCommand(command()));
|
|
98285
98413
|
var team_default = teamDomain;
|
|
98286
98414
|
|
|
98287
98415
|
// src/domains/upgrade/index.ts
|
|
98288
98416
|
import { execSync } from "node:child_process";
|
|
98289
|
-
import
|
|
98290
|
-
import { Command as
|
|
98417
|
+
import as38 from "ansis";
|
|
98418
|
+
import { Command as Command46 } from "commander";
|
|
98291
98419
|
|
|
98292
98420
|
// src/helpers/upgrade.ts
|
|
98293
|
-
import
|
|
98421
|
+
import as37 from "ansis";
|
|
98294
98422
|
import semver3 from "semver";
|
|
98295
98423
|
var packageJsonSchema = external_exports.object({
|
|
98296
98424
|
version: external_exports.string()
|
|
@@ -98318,7 +98446,7 @@ async function getUpgradeInformation() {
|
|
|
98318
98446
|
}
|
|
98319
98447
|
async function checkUpgrade() {
|
|
98320
98448
|
const emitOutput = () => output.info().message(
|
|
98321
|
-
`New version available! Run ${
|
|
98449
|
+
`New version available! Run ${as37.cyan("`scalar upgrade`")} to install the latest version`
|
|
98322
98450
|
).print();
|
|
98323
98451
|
const now = performance.now();
|
|
98324
98452
|
const delay = 1 * 60 * 60 * 1e3;
|
|
@@ -98343,7 +98471,7 @@ async function checkUpgrade() {
|
|
|
98343
98471
|
}
|
|
98344
98472
|
|
|
98345
98473
|
// src/domains/upgrade/index.ts
|
|
98346
|
-
var cmd = new
|
|
98474
|
+
var cmd = new Command46("upgrade");
|
|
98347
98475
|
cmd.description("Upgrade current version of your cli");
|
|
98348
98476
|
cmd.action(async () => {
|
|
98349
98477
|
const upgradeStatus = await getUpgradeInformation();
|
|
@@ -98360,7 +98488,7 @@ cmd.action(async () => {
|
|
|
98360
98488
|
});
|
|
98361
98489
|
output.info().message("Successfully upgraded to the latest version").print();
|
|
98362
98490
|
} catch {
|
|
98363
|
-
output.error().title("Upgrade failed").message("Failed to upgrade the CLI. Please try running:").message(
|
|
98491
|
+
output.error().title("Upgrade failed").message("Failed to upgrade the CLI. Please try running:").message(as38.cyan(`npm install -g ${upgradeStatus.name}@latest`)).exit("error");
|
|
98364
98492
|
}
|
|
98365
98493
|
});
|
|
98366
98494
|
var upgrade_default = cmd;
|
|
@@ -98381,7 +98509,7 @@ var domains_default = domains;
|
|
|
98381
98509
|
|
|
98382
98510
|
// src/program.ts
|
|
98383
98511
|
var getProgram = () => {
|
|
98384
|
-
const program2 = new
|
|
98512
|
+
const program2 = new Command47();
|
|
98385
98513
|
program2.enablePositionalOptions().name(Object.keys(bin)[0]).description("CLI to work with your OpenAPI files").version(version);
|
|
98386
98514
|
program2.showHelpAfterError();
|
|
98387
98515
|
domains_default.forEach((domain2) => program2.addCommand(domain2));
|