@scalar/cli 2.0.1 → 2.5.1
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 +68 -24
- package/chunks/action-37EV4UHW.js +125 -0
- package/chunks/action-4XI7XJR4.js +204 -0
- package/chunks/action-5IU77OII.js +60 -0
- package/chunks/action-B3KKREWQ.js +64 -0
- package/chunks/action-CH24QGTE.js +86 -0
- package/chunks/action-F3UX5E3M.js +522 -0
- package/chunks/action-FDB7NEOK.js +81 -0
- package/chunks/action-FIXBOJEW.js +244 -0
- package/chunks/action-G26LSVZ7.js +40 -0
- package/chunks/action-H3RTILLM.js +46 -0
- package/chunks/action-HGBBV353.js +86 -0
- package/chunks/action-IUE4IOWO.js +2142 -0
- package/chunks/action-JZLZ7ZAD.js +110 -0
- package/chunks/action-LA6KVAXQ.js +374 -0
- package/chunks/action-M7RQKBSB.js +169 -0
- package/chunks/action-MSLBC2SO.js +92 -0
- package/chunks/action-NVSZT2ZD.js +37 -0
- package/chunks/action-OGQSTRMX.js +37 -0
- package/chunks/action-PAGJ5PWC.js +60 -0
- package/chunks/action-QE2ZQQX7.js +250 -0
- package/chunks/action-QPUSPD5M.js +54 -0
- package/chunks/action-R7IMFHQ5.js +147 -0
- package/chunks/action-SH4UUXPL.js +60 -0
- package/chunks/action-SNLCIBQC.js +84 -0
- package/chunks/action-SQG3JAII.js +150 -0
- package/chunks/action-UZQJNYK4.js +18 -0
- package/chunks/action-VC4DCVST.js +68 -0
- package/chunks/action-VTVFY2MP.js +181 -0
- package/chunks/action-WFWYGY7O.js +67 -0
- package/chunks/action-XMNX5ZYT.js +197 -0
- package/chunks/agent-HCQRMHQ5.js +132 -0
- package/chunks/asyncapi-QM76O55R.js +105 -0
- package/chunks/build.action-P7FCIMYU.js +108 -0
- package/chunks/chunk-24WAOKGG.js +105 -0
- package/chunks/chunk-3L6DLIXJ.js +25530 -0
- package/chunks/chunk-3MZYUBJ6.js +49 -0
- package/chunks/chunk-3ZJYGGAA.js +30 -0
- package/chunks/chunk-4NHMAG6F.js +21 -0
- package/chunks/chunk-4ORL4MST.js +16 -0
- package/chunks/chunk-4ZDQXWBT.js +26 -0
- package/chunks/chunk-6ZMT63IV.js +19 -0
- package/chunks/chunk-7AGLC7WV.js +107 -0
- package/chunks/chunk-AEFPCC4U.js +16 -0
- package/chunks/chunk-AO3F5XWR.js +3147 -0
- package/chunks/chunk-B2MHTD3R.js +90 -0
- package/chunks/chunk-CISTON3A.js +153 -0
- package/chunks/chunk-COBPBRQF.js +25 -0
- package/chunks/chunk-F467BYYR.js +568 -0
- package/chunks/chunk-GSGZHE26.js +352 -0
- package/chunks/chunk-HCPN3KNF.js +637 -0
- package/chunks/chunk-HPL3ZZ2P.js +1726 -0
- package/chunks/chunk-IKT5F47M.js +17344 -0
- package/chunks/chunk-JFIXNSPP.js +26 -0
- package/chunks/chunk-K4DTP5TV.js +32 -0
- package/chunks/chunk-K74E42RV.js +7311 -0
- package/chunks/chunk-KHDYYVYF.js +16 -0
- package/chunks/chunk-LFU5ZUAP.js +350 -0
- package/chunks/chunk-M37TP6U2.js +445 -0
- package/chunks/chunk-OQKDBLOZ.js +741 -0
- package/chunks/chunk-P7H7GY5A.js +14 -0
- package/chunks/chunk-PBXZN65A.js +63911 -0
- package/chunks/chunk-PT5TI77I.js +34 -0
- package/chunks/chunk-Q7DOQHZN.js +404 -0
- package/chunks/chunk-T5HJUAWB.js +242 -0
- package/chunks/chunk-T7B6WNZC.js +18 -0
- package/chunks/chunk-UGGNHILG.js +38 -0
- package/chunks/chunk-VNYE4R7N.js +499 -0
- package/chunks/chunk-X5T526CE.js +23 -0
- package/chunks/chunk-XCSR4RIT.js +210 -0
- package/chunks/chunk-Z2KMGFE6.js +295 -0
- package/chunks/create.action-HDD2WUON.js +108 -0
- package/chunks/delete.action-7GOZY7ID.js +88 -0
- package/chunks/delete.action-VE66JFDS.js +96 -0
- package/chunks/get.action-2745EB4N.js +86 -0
- package/chunks/list.action-3VTXQJRA.js +116 -0
- package/chunks/list.action-4QDCZLSZ.js +95 -0
- package/chunks/publish.action-ULQLZKWU.js +190 -0
- package/chunks/update.action-6QEFP7NA.js +95 -0
- package/chunks/update.action-OROQSP2S.js +101 -0
- package/docs.html +352 -250
- package/index.js +664 -99064
- package/package.json +17 -11
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
15
|
+
try {
|
|
16
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
17
|
+
} catch (e) {
|
|
18
|
+
throw mod = 0, e;
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
var __export = (target, all) => {
|
|
22
|
+
for (var name in all)
|
|
23
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
24
|
+
};
|
|
25
|
+
var __copyProps = (to, from, except, desc) => {
|
|
26
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
27
|
+
for (let key of __getOwnPropNames(from))
|
|
28
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
29
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
30
|
+
}
|
|
31
|
+
return to;
|
|
32
|
+
};
|
|
33
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
34
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
35
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
36
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
37
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
38
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
39
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
40
|
+
mod
|
|
41
|
+
));
|
|
42
|
+
|
|
43
|
+
export {
|
|
44
|
+
__require,
|
|
45
|
+
__commonJS,
|
|
46
|
+
__export,
|
|
47
|
+
__reExport,
|
|
48
|
+
__toESM
|
|
49
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/errors.ts
|
|
4
|
+
function createError(code, detail) {
|
|
5
|
+
return {
|
|
6
|
+
code,
|
|
7
|
+
detail
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function displayError(error, fallback = "Unknown error occurred. Please contact support@scalar.com") {
|
|
11
|
+
try {
|
|
12
|
+
if (error instanceof Error) {
|
|
13
|
+
return error.message;
|
|
14
|
+
}
|
|
15
|
+
if (typeof error === "object") {
|
|
16
|
+
return JSON.stringify(error);
|
|
17
|
+
}
|
|
18
|
+
if (typeof error === "string") {
|
|
19
|
+
return error;
|
|
20
|
+
}
|
|
21
|
+
return fallback;
|
|
22
|
+
} catch {
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export {
|
|
28
|
+
createError,
|
|
29
|
+
displayError
|
|
30
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
getPublishPreviewUrl,
|
|
4
|
+
getPublishUrl
|
|
5
|
+
} from "./chunk-XCSR4RIT.js";
|
|
6
|
+
|
|
7
|
+
// src/domains/project/publish/url.ts
|
|
8
|
+
function getPublishDeploymentUrl(publish) {
|
|
9
|
+
try {
|
|
10
|
+
if (publish.preview) {
|
|
11
|
+
return getPublishPreviewUrl(publish.uid, publish.domain, publish.subpath);
|
|
12
|
+
}
|
|
13
|
+
return getPublishUrl(publish.domain, publish.subpath);
|
|
14
|
+
} catch {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {
|
|
20
|
+
getPublishDeploymentUrl
|
|
21
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/domains/document/helpers/file-type.ts
|
|
4
|
+
import { isHttpUrl } from "@scalar/json-magic/helpers/is-http-url";
|
|
5
|
+
var isUrl = isHttpUrl;
|
|
6
|
+
var isYamlFileName = (fileName) => {
|
|
7
|
+
if (isUrl(fileName)) {
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
return /\.ya?ml$/i.test(fileName);
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
isUrl,
|
|
15
|
+
isYamlFileName
|
|
16
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// src/config.ts
|
|
4
|
+
import { portNumbers } from "get-port";
|
|
5
|
+
var config = {
|
|
6
|
+
projects: {
|
|
7
|
+
dashboard: process.env.DASHBOARD_URL ?? "https://dashboard.scalar.com",
|
|
8
|
+
sandbox: process.env.SANDBOX_URL ?? "https://sandbox.scalar.com",
|
|
9
|
+
registry: process.env.REGISTRY_URL ?? "https://registry.scalar.com"
|
|
10
|
+
},
|
|
11
|
+
services: {
|
|
12
|
+
api: process.env.BASE_URL ?? "https://services.scalar.com"
|
|
13
|
+
},
|
|
14
|
+
auth: {
|
|
15
|
+
callback: {
|
|
16
|
+
preferredPortRange: process.env.PREFERRED_PORT ? Number.parseInt(process.env.PREFERRED_PORT) : portNumbers(4799, 5100)
|
|
17
|
+
}
|
|
18
|
+
},
|
|
19
|
+
cdnUrl: process.env.CDN_URL ?? "https://cdn.scalar.com",
|
|
20
|
+
publishTld: process.env.PUBLISH_TLD ?? ((URL.parse(process.env.BASE_URL ?? "", "https://services.scalar.com")?.hostname ?? "services.scalar.com") === "services.scalar.com" ? "apidocumentation.com" : "staging-apidocumentation.com"),
|
|
21
|
+
ssgDocsIsolateVersion: process.env.SSG_DOCS_ISOLATE_VERSION ?? "1.6.2"
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export {
|
|
25
|
+
config
|
|
26
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
userSchema
|
|
4
|
+
} from "./chunk-B2MHTD3R.js";
|
|
5
|
+
|
|
6
|
+
// src/domains/team/helpers.ts
|
|
7
|
+
var getUserTeams = async (client, email) => {
|
|
8
|
+
const user = await client.getOne({
|
|
9
|
+
collectionPath: "users",
|
|
10
|
+
query: { email },
|
|
11
|
+
schema: userSchema
|
|
12
|
+
});
|
|
13
|
+
if (user.error) return user;
|
|
14
|
+
return { error: false, data: user.data.teams };
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export {
|
|
18
|
+
getUserTeams
|
|
19
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
import {
|
|
3
|
+
findConfig,
|
|
4
|
+
parseConfig
|
|
5
|
+
} from "./chunk-PBXZN65A.js";
|
|
6
|
+
import {
|
|
7
|
+
ConfigVersion
|
|
8
|
+
} from "./chunk-OQKDBLOZ.js";
|
|
9
|
+
import {
|
|
10
|
+
output
|
|
11
|
+
} from "./chunk-T5HJUAWB.js";
|
|
12
|
+
import {
|
|
13
|
+
external_exports
|
|
14
|
+
} from "./chunk-IKT5F47M.js";
|
|
15
|
+
|
|
16
|
+
// src/domains/project/check-config/parse-config.ts
|
|
17
|
+
import fs from "node:fs";
|
|
18
|
+
function readAndParseConfig(configPath) {
|
|
19
|
+
const startTime = performance.now();
|
|
20
|
+
const file = findConfig(configPath);
|
|
21
|
+
if (!file) {
|
|
22
|
+
return {
|
|
23
|
+
success: false,
|
|
24
|
+
error: {
|
|
25
|
+
type: "file-not-found",
|
|
26
|
+
message: "Could not find the Scalar Configuration file",
|
|
27
|
+
inputPath: configPath
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
const fileContent = fs.readFileSync(file, "utf-8");
|
|
32
|
+
const parseConfigResult = parseConfig(fileContent);
|
|
33
|
+
if (!parseConfigResult.success) {
|
|
34
|
+
if (parseConfigResult.errorType === "validation") {
|
|
35
|
+
return {
|
|
36
|
+
success: false,
|
|
37
|
+
error: {
|
|
38
|
+
type: "validation-error",
|
|
39
|
+
message: "The given Scalar Configuration is invalid",
|
|
40
|
+
filePath: file,
|
|
41
|
+
prettyError: external_exports.prettifyError(parseConfigResult.error),
|
|
42
|
+
version: parseConfigResult.version
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
return {
|
|
47
|
+
success: false,
|
|
48
|
+
error: {
|
|
49
|
+
type: "parse-error",
|
|
50
|
+
message: "Could not parse the Scalar Configuration file",
|
|
51
|
+
filePath: file,
|
|
52
|
+
detail: typeof parseConfigResult.error === "string" ? parseConfigResult.error : parseConfigResult.error instanceof Error ? parseConfigResult.error.message : void 0
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
return {
|
|
57
|
+
success: true,
|
|
58
|
+
filePath: file,
|
|
59
|
+
validationTime: Math.round(performance.now() - startTime),
|
|
60
|
+
config: parseConfigResult.config
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// src/domains/project/render-config-error.ts
|
|
65
|
+
import as from "ansis";
|
|
66
|
+
function renderConfigError(error) {
|
|
67
|
+
if (error.type === "file-not-found") {
|
|
68
|
+
return output.error().title("Scalar Configuration file not found").message(error.inputPath).line(
|
|
69
|
+
as.grey(
|
|
70
|
+
"Create a `scalar.config.json`, or pass the path to your configuration file as an argument."
|
|
71
|
+
)
|
|
72
|
+
).exit("error");
|
|
73
|
+
}
|
|
74
|
+
if (error.type === "parse-error") {
|
|
75
|
+
const block2 = output.error().title("Invalid configuration file").message("Could not parse the Scalar Configuration file:").line(error.filePath);
|
|
76
|
+
if (error.detail) {
|
|
77
|
+
block2.message(error.detail);
|
|
78
|
+
}
|
|
79
|
+
return block2.exit("error");
|
|
80
|
+
}
|
|
81
|
+
const block = output.error().title("The given Scalar Configuration is invalid").message(error.filePath);
|
|
82
|
+
const note = versionNote(error.version);
|
|
83
|
+
if (note) {
|
|
84
|
+
block.line(note);
|
|
85
|
+
}
|
|
86
|
+
block.line("");
|
|
87
|
+
for (const line of error.prettyError.split("\n")) {
|
|
88
|
+
block.line(line);
|
|
89
|
+
}
|
|
90
|
+
return block.exit("error");
|
|
91
|
+
}
|
|
92
|
+
function versionNote(version) {
|
|
93
|
+
if (version === ConfigVersion.V2) {
|
|
94
|
+
return as.grey("Validated as Scalar Configuration v2.0.0.");
|
|
95
|
+
}
|
|
96
|
+
if (version === ConfigVersion.V1) {
|
|
97
|
+
return as.grey(
|
|
98
|
+
'Validated as a legacy (V1) configuration. If this should be a v2 config, add a top-level `scalar: "2.0.0"` field.'
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
return "";
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
export {
|
|
105
|
+
readAndParseConfig,
|
|
106
|
+
renderConfigError
|
|
107
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { createRequire as $$cR } from "node:module"; const require = $$cR(import.meta.url);
|
|
2
|
+
|
|
3
|
+
// ../../packages/helpers/dist/datetime/index.js
|
|
4
|
+
function formatAbsoluteTime(date) {
|
|
5
|
+
return new Intl.DateTimeFormat("en", {
|
|
6
|
+
month: "short",
|
|
7
|
+
day: "numeric",
|
|
8
|
+
year: "numeric",
|
|
9
|
+
hour: "numeric",
|
|
10
|
+
minute: "2-digit"
|
|
11
|
+
}).format(new Date(date));
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export {
|
|
15
|
+
formatAbsoluteTime
|
|
16
|
+
};
|