@sanity/cli 3.77.3-server-side-schemas.26 → 3.77.3-server-side-schemas.36
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/bin/xdg-open +1066 -0
- package/lib/_chunks-cjs/cli.js +384 -195
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/_chunks-cjs/loadEnv.js +5 -5
- package/lib/_chunks-cjs/loadEnv.js.map +1 -1
- package/lib/index.d.mts +2 -3
- package/lib/index.d.ts +2 -3
- package/lib/index.esm.js +5 -5
- package/lib/index.esm.js.map +1 -1
- package/lib/index.mjs +5 -5
- package/lib/index.mjs.map +1 -1
- package/package.json +12 -11
- package/src/actions/init-project/bootstrapLocalTemplate.ts +10 -10
- package/src/actions/init-project/{createCoreAppCliConfig.ts → createAppCliConfig.ts} +4 -4
- package/src/actions/init-project/{determineCoreAppTemplate.ts → determineAppTemplate.ts} +3 -3
- package/src/actions/init-project/initProject.ts +125 -48
- package/src/actions/init-project/templates/{coreApp.ts → appQuickstart.ts} +7 -8
- package/src/actions/init-project/templates/index.ts +2 -2
- package/src/cli.ts +4 -14
- package/src/commands/functions/devFunctionsCommand.ts +42 -0
- package/src/commands/functions/functionsGroup.ts +11 -0
- package/src/commands/functions/logsFunctionsCommand.ts +46 -0
- package/src/commands/functions/testFunctionsCommand.ts +62 -0
- package/src/commands/index.ts +8 -0
- package/src/commands/init/initCommand.ts +0 -1
- package/src/types.ts +2 -3
- package/src/util/clientWrapper.ts +1 -1
- package/src/util/resolveRootDir.ts +5 -5
- package/templates/core-app/src/App.css +18 -0
- package/templates/core-app/src/App.tsx +15 -17
- package/templates/core-app/src/ExampleComponent.css +26 -0
- package/templates/core-app/src/ExampleComponent.tsx +15 -4
package/lib/_chunks-cjs/cli.js
CHANGED
@@ -1,4 +1,23 @@
|
|
1
1
|
"use strict";
|
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, __hasOwnProp = Object.prototype.hasOwnProperty;
|
7
|
+
var __copyProps = (to, from2, except, desc) => {
|
8
|
+
if (from2 && typeof from2 == "object" || typeof from2 == "function")
|
9
|
+
for (let key2 of __getOwnPropNames(from2))
|
10
|
+
!__hasOwnProp.call(to, key2) && key2 !== except && __defProp(to, key2, { get: () => from2[key2], enumerable: !(desc = __getOwnPropDesc(from2, key2)) || desc.enumerable });
|
11
|
+
return to;
|
12
|
+
};
|
13
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
14
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
15
|
+
// file that has been converted to a CommonJS file using a Babel-
|
16
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
17
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
18
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: !0 }) : target,
|
19
|
+
mod
|
20
|
+
));
|
2
21
|
var fs$1 = require("node:fs"), os = require("node:os"), path$3 = require("node:path"), chalk = require("chalk"), loadEnv = require("./loadEnv.js"), require$$0$5 = require("path"), require$$1$2 = require("module"), require$$0$4 = require("fs"), telemetry = require("@sanity/telemetry"), childProcess = require("node:child_process"), fs = require("node:fs/promises"), util$4 = require("node:util"), require$$0$6 = require("os"), require$$5$1 = require("url"), require$$1$3 = require("get-it"), require$$2$1 = require("get-it/middleware"), require$$0$7 = require("constants"), require$$0$8 = require("stream"), require$$0$9 = require("util"), require$$0$a = require("assert"), require$$0$b = require("events"), require$$6$1 = require("http"), semver = require("semver"), pkgDir = require("pkg-dir"), client$1 = require("@sanity/client"), require$$3$1 = require("crypto"), require$$1$4 = require("child_process"), require$$0$c = require("fs/promises"), require$$0$d = require("buffer"), getCliConfig = require("./getCliConfig.js"), journeyConfig = require("./journeyConfig.js"), Stream = require("node:stream"), promises$1 = require("node:stream/promises"), templateValidator = require("@sanity/template-validator"), require$$2$2 = require("string_decoder"), require$$0$e = require("zlib"), require$$7$1 = require("process"), http = require("node:http"), traverse = require("@babel/traverse"), node_url = require("node:url"), node_events = require("node:events"), node_string_decoder = require("node:string_decoder"), process$2 = require("node:process"), require$$2$3 = require("readline"), require$$0$f = require("tty");
|
3
22
|
function _interopDefaultCompat(e) {
|
4
23
|
return e && typeof e == "object" && "default" in e ? e : { default: e };
|
@@ -3892,7 +3911,7 @@ function ensureNpx() {
|
|
3892
3911
|
);
|
3893
3912
|
}
|
3894
3913
|
}
|
3895
|
-
const helpText$
|
3914
|
+
const helpText$c = `
|
3896
3915
|
Runs a given code modification script on the current studio folder.
|
3897
3916
|
Running the command without a specified codemod name will list available transformations.
|
3898
3917
|
|
@@ -3914,7 +3933,7 @@ Examples
|
|
3914
3933
|
name: "codemod",
|
3915
3934
|
signature: "[CODEMOD_NAME]",
|
3916
3935
|
description: "Updates Sanity Studio codebase with a code modification script",
|
3917
|
-
helpText: helpText$
|
3936
|
+
helpText: helpText$c,
|
3918
3937
|
action: codemodAction
|
3919
3938
|
};
|
3920
3939
|
var lodash_isplainobject, hasRequiredLodash_isplainobject;
|
@@ -7042,7 +7061,7 @@ const sanityEnv$1 = (process.env.SANITY_INTERNAL_ENV || "").toLowerCase(), confi
|
|
7042
7061
|
let config$1;
|
7043
7062
|
const getUserConfig = () => (config$1 || (config$1 = new ConfigStore(configName, defaults$2, { globalConfigPath: !0 })), config$1), apiHosts = {
|
7044
7063
|
staging: "https://api.sanity.work",
|
7045
|
-
development: "http://api.sanity.
|
7064
|
+
development: "http://api.sanity.local"
|
7046
7065
|
}, defaults$1 = {
|
7047
7066
|
requireUser: !0,
|
7048
7067
|
requireProject: !0
|
@@ -7452,6 +7471,107 @@ const docsCommand = {
|
|
7452
7471
|
const { output } = context, { print } = output, url = "https://www.sanity.io/docs";
|
7453
7472
|
print(`Opening ${url}`), await open(url);
|
7454
7473
|
}
|
7474
|
+
}, helpText$b = `
|
7475
|
+
Options
|
7476
|
+
--port <port> Port to start emulator on
|
7477
|
+
|
7478
|
+
Examples
|
7479
|
+
# Start dev server on default port
|
7480
|
+
sanity functions dev
|
7481
|
+
|
7482
|
+
# Start dev server on specific port
|
7483
|
+
sanity functions dev --port 3333
|
7484
|
+
`, defaultFlags$3 = {
|
7485
|
+
port: 8080
|
7486
|
+
}, devFunctionsCommand = {
|
7487
|
+
name: "dev",
|
7488
|
+
group: "functions",
|
7489
|
+
helpText: helpText$b,
|
7490
|
+
signature: "",
|
7491
|
+
description: "Start the Sanity Function emulator",
|
7492
|
+
hideFromHelp: !0,
|
7493
|
+
async action(args, context) {
|
7494
|
+
const { output } = context, { print } = output, flags = { ...defaultFlags$3, ...args.extOptions }, { devAction } = await import("@sanity/runtime-cli");
|
7495
|
+
devAction(flags.port), print(`Server is running on port ${flags.port}
|
7496
|
+
`), open(`http://localhost:${flags.port}`);
|
7497
|
+
}
|
7498
|
+
}, functionsGroup = {
|
7499
|
+
name: "functions",
|
7500
|
+
signature: "[COMMAND]",
|
7501
|
+
isGroupRoot: !0,
|
7502
|
+
description: "Test Sanity Functions locally and retrieve logs",
|
7503
|
+
hideFromHelp: !0
|
7504
|
+
}, helpText$a = `
|
7505
|
+
Options
|
7506
|
+
--id <id> The ID of the function to retrieve logs for
|
7507
|
+
|
7508
|
+
Examples
|
7509
|
+
# Retrieve logs for Sanity Function abcd1234
|
7510
|
+
sanity functions logs --id abcd1234
|
7511
|
+
`, defaultFlags$2 = {
|
7512
|
+
id: void 0
|
7513
|
+
}, logsFunctionsCommand = {
|
7514
|
+
name: "logs",
|
7515
|
+
group: "functions",
|
7516
|
+
helpText: helpText$a,
|
7517
|
+
signature: "",
|
7518
|
+
description: "Retrieve logs for a Sanity Function",
|
7519
|
+
hideFromHelp: !0,
|
7520
|
+
async action(args, context) {
|
7521
|
+
const { apiClient, output } = context, { print } = output, flags = { ...defaultFlags$2, ...args.extOptions }, client2 = apiClient({
|
7522
|
+
requireUser: !0,
|
7523
|
+
requireProject: !1
|
7524
|
+
});
|
7525
|
+
if (flags.id) {
|
7526
|
+
const token2 = client2.config().token;
|
7527
|
+
if (token2) {
|
7528
|
+
const { logsAction } = await import("@sanity/runtime-cli"), result = await logsAction(flags.id, token2);
|
7529
|
+
print(JSON.stringify(result, null, 2));
|
7530
|
+
}
|
7531
|
+
} else
|
7532
|
+
print("You must provide a function ID");
|
7533
|
+
}
|
7534
|
+
}, helpText$9 = `
|
7535
|
+
Options
|
7536
|
+
--data <data> Data to send to the function
|
7537
|
+
--file <file> Read data from file and send to the function
|
7538
|
+
--path <path> Path to your Sanity Function code
|
7539
|
+
--timeout <timeout> Execution timeout value in seconds
|
7540
|
+
|
7541
|
+
Examples
|
7542
|
+
# Test function passing event data on command line
|
7543
|
+
sanity functions test --path ./test.ts --data '{ "id": 1 }'
|
7544
|
+
|
7545
|
+
# Test function passing event data via a file
|
7546
|
+
sanity functions test -path ./test.js --file 'payload.json'
|
7547
|
+
|
7548
|
+
# Test function passing event data on command line and cap execution time to 60 seconds
|
7549
|
+
sanity functions test -path ./test.ts --data '{ "id": 1 }' --timeout 60
|
7550
|
+
`, defaultFlags$1 = {
|
7551
|
+
data: void 0,
|
7552
|
+
file: void 0,
|
7553
|
+
path: void 0,
|
7554
|
+
timeout: 5
|
7555
|
+
// seconds
|
7556
|
+
}, testFunctionsCommand = {
|
7557
|
+
name: "test",
|
7558
|
+
group: "functions",
|
7559
|
+
helpText: helpText$9,
|
7560
|
+
signature: "",
|
7561
|
+
description: "Invoke a local Sanity Function",
|
7562
|
+
hideFromHelp: !0,
|
7563
|
+
async action(args, context) {
|
7564
|
+
const { output } = context, { print } = output, flags = { ...defaultFlags$1, ...args.extOptions };
|
7565
|
+
if (flags.path) {
|
7566
|
+
const { testAction } = await import("@sanity/runtime-cli"), { json: json2, logs, error: error2 } = await testAction(flags.path, {
|
7567
|
+
data: flags.data,
|
7568
|
+
file: flags.file,
|
7569
|
+
timeout: flags.timeout
|
7570
|
+
});
|
7571
|
+
error2 ? print(error2.toString()) : (print("Logs:"), print(logs), print("Response:"), print(JSON.stringify(json2, null, 2)));
|
7572
|
+
} else
|
7573
|
+
print("You must provide a path to the Sanity Function code");
|
7574
|
+
}
|
7455
7575
|
};
|
7456
7576
|
var leven$1 = { exports: {} }, hasRequiredLeven;
|
7457
7577
|
function requireLeven() {
|
@@ -8832,7 +8952,7 @@ function requireDumper$2() {
|
|
8832
8952
|
function State(options2) {
|
8833
8953
|
this.schema = options2.schema || DEFAULT_FULL_SCHEMA, this.indent = Math.max(1, options2.indent || 2), this.noArrayIndent = options2.noArrayIndent || !1, this.skipInvalid = options2.skipInvalid || !1, this.flowLevel = common2.isNothing(options2.flowLevel) ? -1 : options2.flowLevel, this.styleMap = compileStyleMap(this.schema, options2.styles || null), this.sortKeys = options2.sortKeys || !1, this.lineWidth = options2.lineWidth || 80, this.noRefs = options2.noRefs || !1, this.noCompatMode = options2.noCompatMode || !1, this.condenseFlow = options2.condenseFlow || !1, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
|
8834
8954
|
}
|
8835
|
-
function
|
8955
|
+
function indentString2(string, spaces) {
|
8836
8956
|
for (var ind = common2.repeat(" ", spaces), position = 0, next = -1, result = "", line3, length = string.length; position < length; )
|
8837
8957
|
next = string.indexOf(`
|
8838
8958
|
`, position), next === -1 ? (line3 = string.slice(position), position = length) : (line3 = string.slice(position, next + 1), position = next + 1), line3.length && line3 !== `
|
@@ -8904,9 +9024,9 @@ function requireDumper$2() {
|
|
8904
9024
|
case STYLE_SINGLE:
|
8905
9025
|
return "'" + string.replace(/'/g, "''") + "'";
|
8906
9026
|
case STYLE_LITERAL:
|
8907
|
-
return "|" + blockHeader(string, state.indent) + dropEndingNewline(
|
9027
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString2(string, indent));
|
8908
9028
|
case STYLE_FOLDED:
|
8909
|
-
return ">" + blockHeader(string, state.indent) + dropEndingNewline(
|
9029
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString2(foldString(string, lineWidth), indent));
|
8910
9030
|
case STYLE_DOUBLE:
|
8911
9031
|
return '"' + escapeString(string) + '"';
|
8912
9032
|
default:
|
@@ -15075,7 +15195,7 @@ function requireDumper$1() {
|
|
15075
15195
|
function State(options2) {
|
15076
15196
|
this.schema = options2.schema || DEFAULT_SCHEMA, this.indent = Math.max(1, options2.indent || 2), this.noArrayIndent = options2.noArrayIndent || !1, this.skipInvalid = options2.skipInvalid || !1, this.flowLevel = common2.isNothing(options2.flowLevel) ? -1 : options2.flowLevel, this.styleMap = compileStyleMap(this.schema, options2.styles || null), this.sortKeys = options2.sortKeys || !1, this.lineWidth = options2.lineWidth || 80, this.noRefs = options2.noRefs || !1, this.noCompatMode = options2.noCompatMode || !1, this.condenseFlow = options2.condenseFlow || !1, this.quotingType = options2.quotingType === '"' ? QUOTING_TYPE_DOUBLE : QUOTING_TYPE_SINGLE, this.forceQuotes = options2.forceQuotes || !1, this.replacer = typeof options2.replacer == "function" ? options2.replacer : null, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
|
15077
15197
|
}
|
15078
|
-
function
|
15198
|
+
function indentString2(string, spaces) {
|
15079
15199
|
for (var ind = common2.repeat(" ", spaces), position = 0, next = -1, result = "", line3, length = string.length; position < length; )
|
15080
15200
|
next = string.indexOf(`
|
15081
15201
|
`, position), next === -1 ? (line3 = string.slice(position), position = length) : (line3 = string.slice(position, next + 1), position = next + 1), line3.length && line3 !== `
|
@@ -15173,9 +15293,9 @@ function requireDumper$1() {
|
|
15173
15293
|
case STYLE_SINGLE:
|
15174
15294
|
return "'" + string.replace(/'/g, "''") + "'";
|
15175
15295
|
case STYLE_LITERAL:
|
15176
|
-
return "|" + blockHeader(string, state.indent) + dropEndingNewline(
|
15296
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString2(string, indent));
|
15177
15297
|
case STYLE_FOLDED:
|
15178
|
-
return ">" + blockHeader(string, state.indent) + dropEndingNewline(
|
15298
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString2(foldString(string, lineWidth), indent));
|
15179
15299
|
case STYLE_DOUBLE:
|
15180
15300
|
return '"' + escapeString(string) + '"';
|
15181
15301
|
default:
|
@@ -18906,54 +19026,105 @@ function requireExeca() {
|
|
18906
19026
|
);
|
18907
19027
|
}, execa$1.exports;
|
18908
19028
|
}
|
18909
|
-
var execaExports = requireExeca(), execa = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(execaExports),
|
19029
|
+
var execaExports = requireExeca(), execa = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(execaExports), indentString, hasRequiredIndentString;
|
19030
|
+
function requireIndentString() {
|
19031
|
+
return hasRequiredIndentString || (hasRequiredIndentString = 1, indentString = (string, count2 = 1, options2) => {
|
19032
|
+
if (options2 = {
|
19033
|
+
indent: " ",
|
19034
|
+
includeEmptyLines: !1,
|
19035
|
+
...options2
|
19036
|
+
}, typeof string != "string")
|
19037
|
+
throw new TypeError(
|
19038
|
+
`Expected \`input\` to be a \`string\`, got \`${typeof string}\``
|
19039
|
+
);
|
19040
|
+
if (typeof count2 != "number")
|
19041
|
+
throw new TypeError(
|
19042
|
+
`Expected \`count\` to be a \`number\`, got \`${typeof count2}\``
|
19043
|
+
);
|
19044
|
+
if (typeof options2.indent != "string")
|
19045
|
+
throw new TypeError(
|
19046
|
+
`Expected \`options.indent\` to be a \`string\`, got \`${typeof options2.indent}\``
|
19047
|
+
);
|
19048
|
+
if (count2 === 0)
|
19049
|
+
return string;
|
19050
|
+
const regex2 = options2.includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
|
19051
|
+
return string.replace(regex2, options2.indent.repeat(count2));
|
19052
|
+
}), indentString;
|
19053
|
+
}
|
19054
|
+
var cleanStack$2, hasRequiredCleanStack$1;
|
19055
|
+
function requireCleanStack$1() {
|
19056
|
+
if (hasRequiredCleanStack$1) return cleanStack$2;
|
19057
|
+
hasRequiredCleanStack$1 = 1;
|
19058
|
+
const os2 = require$$0__default$2.default, extractPathRegex = /\s+at.*(?:\(|\s)(.*)\)?/, pathRegex = /^(?:(?:(?:node|(?:internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)\.js:\d+:\d+)|native)/, homeDir = typeof os2.homedir > "u" ? "" : os2.homedir();
|
19059
|
+
return cleanStack$2 = (stack2, options2) => (options2 = Object.assign({ pretty: !1 }, options2), stack2.replace(/\\/g, "/").split(`
|
19060
|
+
`).filter((line3) => {
|
19061
|
+
const pathMatches = line3.match(extractPathRegex);
|
19062
|
+
if (pathMatches === null || !pathMatches[1])
|
19063
|
+
return !0;
|
19064
|
+
const match2 = pathMatches[1];
|
19065
|
+
return match2.includes(".app/Contents/Resources/electron.asar") || match2.includes(".app/Contents/Resources/default_app.asar") ? !1 : !pathRegex.test(match2);
|
19066
|
+
}).filter((line3) => line3.trim() !== "").map((line3) => options2.pretty ? line3.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~"))) : line3).join(`
|
19067
|
+
`)), cleanStack$2;
|
19068
|
+
}
|
19069
|
+
var aggregateError, hasRequiredAggregateError;
|
19070
|
+
function requireAggregateError() {
|
19071
|
+
if (hasRequiredAggregateError) return aggregateError;
|
19072
|
+
hasRequiredAggregateError = 1;
|
19073
|
+
const indentString2 = requireIndentString(), cleanStack2 = requireCleanStack$1(), cleanInternalStack = (stack2) => stack2.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, "");
|
19074
|
+
class AggregateError extends Error {
|
19075
|
+
constructor(errors) {
|
19076
|
+
if (!Array.isArray(errors))
|
19077
|
+
throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
|
19078
|
+
errors = [...errors].map((error2) => error2 instanceof Error ? error2 : error2 !== null && typeof error2 == "object" ? Object.assign(new Error(error2.message), error2) : new Error(error2));
|
19079
|
+
let message = errors.map((error2) => typeof error2.stack == "string" ? cleanInternalStack(cleanStack2(error2.stack)) : String(error2)).join(`
|
19080
|
+
`);
|
19081
|
+
message = `
|
19082
|
+
` + indentString2(message, 4), super(message), this.name = "AggregateError", Object.defineProperty(this, "_errors", { value: errors });
|
19083
|
+
}
|
19084
|
+
*[Symbol.iterator]() {
|
19085
|
+
for (const error2 of this._errors)
|
19086
|
+
yield error2;
|
19087
|
+
}
|
19088
|
+
}
|
19089
|
+
return aggregateError = AggregateError, aggregateError;
|
19090
|
+
}
|
19091
|
+
var pMap$1, hasRequiredPMap;
|
18910
19092
|
function requirePMap() {
|
18911
|
-
if (hasRequiredPMap) return pMap
|
19093
|
+
if (hasRequiredPMap) return pMap$1;
|
18912
19094
|
hasRequiredPMap = 1;
|
18913
|
-
const
|
18914
|
-
|
18915
|
-
|
18916
|
-
|
19095
|
+
const AggregateError = requireAggregateError();
|
19096
|
+
return pMap$1 = async (iterable, mapper, {
|
19097
|
+
concurrency = 1 / 0,
|
19098
|
+
stopOnError = !0
|
19099
|
+
} = {}) => new Promise((resolve, reject) => {
|
19100
|
+
if (typeof mapper != "function")
|
18917
19101
|
throw new TypeError("Mapper function is required");
|
18918
|
-
|
18919
|
-
|
18920
|
-
|
18921
|
-
const ret = [], iterator2 = iterable[Symbol.iterator]();
|
19102
|
+
if (!((Number.isSafeInteger(concurrency) || concurrency === 1 / 0) && concurrency >= 1))
|
19103
|
+
throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
|
19104
|
+
const result = [], errors = [], iterator2 = iterable[Symbol.iterator]();
|
18922
19105
|
let isRejected = !1, isIterableDone = !1, resolvingCount = 0, currentIndex = 0;
|
18923
19106
|
const next = () => {
|
18924
19107
|
if (isRejected)
|
18925
19108
|
return;
|
18926
|
-
const nextItem = iterator2.next(),
|
19109
|
+
const nextItem = iterator2.next(), index = currentIndex;
|
18927
19110
|
if (currentIndex++, nextItem.done) {
|
18928
|
-
isIterableDone = !0, resolvingCount === 0 && resolve(
|
19111
|
+
isIterableDone = !0, resolvingCount === 0 && (!stopOnError && errors.length !== 0 ? reject(new AggregateError(errors)) : resolve(result));
|
18929
19112
|
return;
|
18930
19113
|
}
|
18931
|
-
resolvingCount++,
|
18932
|
-
|
18933
|
-
|
18934
|
-
|
18935
|
-
(error2)
|
18936
|
-
isRejected = !0, reject(error2);
|
19114
|
+
resolvingCount++, (async () => {
|
19115
|
+
try {
|
19116
|
+
const element = await nextItem.value;
|
19117
|
+
result[index] = await mapper(element, index), resolvingCount--, next();
|
19118
|
+
} catch (error2) {
|
19119
|
+
stopOnError ? (isRejected = !0, reject(error2)) : (errors.push(error2), resolvingCount--, next());
|
18937
19120
|
}
|
18938
|
-
);
|
19121
|
+
})();
|
18939
19122
|
};
|
18940
19123
|
for (let i = 0; i < concurrency && (next(), !isIterableDone); i++)
|
18941
19124
|
;
|
18942
|
-
});
|
18943
|
-
|
18944
|
-
|
18945
|
-
var hasRequiredPFilter;
|
18946
|
-
function requirePFilter() {
|
18947
|
-
if (hasRequiredPFilter) return pFilter$1.exports;
|
18948
|
-
hasRequiredPFilter = 1;
|
18949
|
-
const pMap2 = requirePMap(), pFilter2 = async (iterable, filterer, options2) => (await pMap2(
|
18950
|
-
iterable,
|
18951
|
-
(element, index) => Promise.all([filterer(element, index), element]),
|
18952
|
-
options2
|
18953
|
-
)).filter((value) => !!value[0]).map((value) => value[1]);
|
18954
|
-
return pFilter$1.exports = pFilter2, pFilter$1.exports.default = pFilter2, pFilter$1.exports;
|
18955
|
-
}
|
18956
|
-
var pFilterExports = requirePFilter(), pFilter = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(pFilterExports);
|
19125
|
+
}), pMap$1;
|
19126
|
+
}
|
19127
|
+
var pMapExports = requirePMap(), pMap = /* @__PURE__ */ loadEnv.getDefaultExportFromCjs(pMapExports);
|
18957
19128
|
const CLIInitStepCompleted = telemetry.defineTrace({
|
18958
19129
|
name: "CLI Init Step Completed",
|
18959
19130
|
version: 1,
|
@@ -22175,7 +22346,7 @@ function requireDumper() {
|
|
22175
22346
|
function State(options2) {
|
22176
22347
|
this.schema = options2.schema || DEFAULT_FULL_SCHEMA, this.indent = Math.max(1, options2.indent || 2), this.noArrayIndent = options2.noArrayIndent || !1, this.skipInvalid = options2.skipInvalid || !1, this.flowLevel = common2.isNothing(options2.flowLevel) ? -1 : options2.flowLevel, this.styleMap = compileStyleMap(this.schema, options2.styles || null), this.sortKeys = options2.sortKeys || !1, this.lineWidth = options2.lineWidth || 80, this.noRefs = options2.noRefs || !1, this.noCompatMode = options2.noCompatMode || !1, this.condenseFlow = options2.condenseFlow || !1, this.implicitTypes = this.schema.compiledImplicit, this.explicitTypes = this.schema.compiledExplicit, this.tag = null, this.result = "", this.duplicates = [], this.usedDuplicates = null;
|
22177
22348
|
}
|
22178
|
-
function
|
22349
|
+
function indentString2(string, spaces) {
|
22179
22350
|
for (var ind = common2.repeat(" ", spaces), position = 0, next = -1, result = "", line3, length = string.length; position < length; )
|
22180
22351
|
next = string.indexOf(`
|
22181
22352
|
`, position), next === -1 ? (line3 = string.slice(position), position = length) : (line3 = string.slice(position, next + 1), position = next + 1), line3.length && line3 !== `
|
@@ -22250,9 +22421,9 @@ function requireDumper() {
|
|
22250
22421
|
case STYLE_SINGLE:
|
22251
22422
|
return "'" + string.replace(/'/g, "''") + "'";
|
22252
22423
|
case STYLE_LITERAL:
|
22253
|
-
return "|" + blockHeader(string, state.indent) + dropEndingNewline(
|
22424
|
+
return "|" + blockHeader(string, state.indent) + dropEndingNewline(indentString2(string, indent));
|
22254
22425
|
case STYLE_FOLDED:
|
22255
|
-
return ">" + blockHeader(string, state.indent) + dropEndingNewline(
|
22426
|
+
return ">" + blockHeader(string, state.indent) + dropEndingNewline(indentString2(foldString(string, lineWidth), indent));
|
22256
22427
|
case STYLE_DOUBLE:
|
22257
22428
|
return '"' + escapeString(string) + '"';
|
22258
22429
|
default:
|
@@ -35943,7 +36114,7 @@ function requirePrinter() {
|
|
35943
36114
|
return decoratorsLines.isEmpty() ? options2.avoidRootParens || (shouldAddParens = path2.needsParens()) : parts.push(decoratorsLines), shouldAddParens && parts.unshift("("), parts.push(linesWithoutParens), shouldAddParens && parts.push(")"), (0, lines_1.concat)(parts);
|
35944
36115
|
}
|
35945
36116
|
function genericPrintNoParens(path2, options2, print) {
|
35946
|
-
var n = path2.getValue();
|
36117
|
+
var _a, _b, _c, n = path2.getValue();
|
35947
36118
|
if (!n)
|
35948
36119
|
return (0, lines_1.fromString)("");
|
35949
36120
|
if (typeof n == "string")
|
@@ -36113,10 +36284,10 @@ function requirePrinter() {
|
|
36113
36284
|
}
|
36114
36285
|
case "ReturnStatement": {
|
36115
36286
|
if (parts.push("return"), n.argument) {
|
36116
|
-
var argLines = path2.call(print, "argument");
|
36117
|
-
argLines.startsWithComment() || argLines.length > 1 &&
|
36118
|
-
`, argLines.
|
36119
|
-
)`) : parts.push(" ", argLines);
|
36287
|
+
var argIsJsxElement = ((_a = namedTypes2.JSXElement) === null || _a === void 0 ? void 0 : _a.check(n.argument)) || ((_b = namedTypes2.JSXFragment) === null || _b === void 0 ? void 0 : _b.check(n.argument)), argLines = path2.call(print, "argument");
|
36288
|
+
argLines.startsWithComment() || argLines.length > 1 && argIsJsxElement ? (argIsJsxElement && (!((_c = n.argument.extra) === null || _c === void 0) && _c.parenthesized) && (n.argument.extra.parenthesized = !1, argLines = path2.call(print, "argument"), n.argument.extra.parenthesized = !0), parts.push(" ", (0, lines_1.concat)([`(
|
36289
|
+
`, argLines]).indentTail(options2.tabWidth), `
|
36290
|
+
)`)) : parts.push(" ", argLines);
|
36120
36291
|
}
|
36121
36292
|
return parts.push(";"), (0, lines_1.concat)(parts);
|
36122
36293
|
}
|
@@ -36466,7 +36637,7 @@ while`), parts.push(" (", path2.call(print, "test"), ");"), (0, lines_1.concat)(
|
|
36466
36637
|
}, "quasis"), parts.push("`"), (0, lines_1.concat)(parts).lockIndentTail();
|
36467
36638
|
}
|
36468
36639
|
case "TaggedTemplateExpression":
|
36469
|
-
return (
|
36640
|
+
return parts.push(path2.call(print, "tag")), n.typeParameters && parts.push(path2.call(print, "typeParameters")), parts.push(path2.call(print, "quasi")), (0, lines_1.concat)(parts);
|
36470
36641
|
// These types are unprintable because they serve as abstract
|
36471
36642
|
// supertypes for other (printable) types.
|
36472
36643
|
case "Node":
|
@@ -37332,7 +37503,7 @@ function requireLib$1() {
|
|
37332
37503
|
if (r == null) return {};
|
37333
37504
|
var t = {};
|
37334
37505
|
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
37335
|
-
if (e.
|
37506
|
+
if (e.indexOf(n) !== -1) continue;
|
37336
37507
|
t[n] = r[n];
|
37337
37508
|
}
|
37338
37509
|
return t;
|
@@ -40705,8 +40876,7 @@ function requireLib$1() {
|
|
40705
40876
|
!this.eat(13) && !this.eat(12) && !this.match(8) && !this.match(9) && this.unexpected();
|
40706
40877
|
}
|
40707
40878
|
flowParseQualifiedTypeIdentifier(startLoc, id) {
|
40708
|
-
|
40709
|
-
(_startLoc = startLoc) != null || (startLoc = this.state.startLoc);
|
40879
|
+
startLoc ?? (startLoc = this.state.startLoc);
|
40710
40880
|
let node = id || this.flowParseRestrictedIdentifier(!0);
|
40711
40881
|
for (; this.eat(16); ) {
|
40712
40882
|
const node2 = this.startNodeAt(startLoc);
|
@@ -42323,17 +42493,18 @@ function requireLib$1() {
|
|
42323
42493
|
const end = exprList.length - 1;
|
42324
42494
|
for (let i = 0; i <= end; i++) {
|
42325
42495
|
const elt = exprList[i];
|
42326
|
-
|
42327
|
-
if (elt.type === "SpreadElement") {
|
42328
|
-
elt.type = "RestElement";
|
42329
|
-
const arg = elt.argument;
|
42330
|
-
this.checkToRestConversion(arg, !0), this.toAssignable(arg, isLHS);
|
42331
|
-
} else
|
42332
|
-
this.toAssignable(elt, isLHS);
|
42333
|
-
elt.type === "RestElement" && (i < end ? this.raise(Errors.RestTrailingComma, elt) : trailingCommaLoc && this.raise(Errors.RestTrailingComma, trailingCommaLoc));
|
42334
|
-
}
|
42496
|
+
elt && (this.toAssignableListItem(exprList, i, isLHS), elt.type === "RestElement" && (i < end ? this.raise(Errors.RestTrailingComma, elt) : trailingCommaLoc && this.raise(Errors.RestTrailingComma, trailingCommaLoc)));
|
42335
42497
|
}
|
42336
42498
|
}
|
42499
|
+
toAssignableListItem(exprList, index, isLHS) {
|
42500
|
+
const node = exprList[index];
|
42501
|
+
if (node.type === "SpreadElement") {
|
42502
|
+
node.type = "RestElement";
|
42503
|
+
const arg = node.argument;
|
42504
|
+
this.checkToRestConversion(arg, !0), this.toAssignable(arg, isLHS);
|
42505
|
+
} else
|
42506
|
+
this.toAssignable(node, isLHS);
|
42507
|
+
}
|
42337
42508
|
isAssignable(node, isBinding) {
|
42338
42509
|
switch (node.type) {
|
42339
42510
|
case "Identifier":
|
@@ -42407,9 +42578,10 @@ function requireLib$1() {
|
|
42407
42578
|
}
|
42408
42579
|
} else {
|
42409
42580
|
const decorators = [];
|
42410
|
-
|
42411
|
-
decorators.
|
42412
|
-
|
42581
|
+
if (flags & 2)
|
42582
|
+
for (this.match(26) && this.hasPlugin("decorators") && this.raise(Errors.UnsupportedParameterDecorator, this.state.startLoc); this.match(26); )
|
42583
|
+
decorators.push(this.parseDecorator());
|
42584
|
+
elts.push(this.parseBindingElement(flags, decorators));
|
42413
42585
|
}
|
42414
42586
|
}
|
42415
42587
|
return elts;
|
@@ -42427,7 +42599,7 @@ function requireLib$1() {
|
|
42427
42599
|
const prop = this.startNode();
|
42428
42600
|
return type2 === 139 ? (this.expectPlugin("destructuringPrivate", startLoc), this.classScope.usePrivateName(this.state.value, startLoc), prop.key = this.parsePrivateName()) : this.parsePropertyName(prop), prop.method = !1, this.parseObjPropValue(prop, startLoc, !1, !1, !0, !1);
|
42429
42601
|
}
|
42430
|
-
|
42602
|
+
parseBindingElement(flags, decorators) {
|
42431
42603
|
const left = this.parseMaybeDefault();
|
42432
42604
|
(this.hasPlugin("flow") || flags & 2) && this.parseFunctionParamType(left);
|
42433
42605
|
const elt = this.parseMaybeDefault(left.loc.start, left);
|
@@ -42437,8 +42609,7 @@ function requireLib$1() {
|
|
42437
42609
|
return param;
|
42438
42610
|
}
|
42439
42611
|
parseMaybeDefault(startLoc, left) {
|
42440
|
-
|
42441
|
-
if ((_startLoc = startLoc) != null || (startLoc = this.state.startLoc), left = (_left = left) != null ? _left : this.parseBindingAtom(), !this.eat(29)) return left;
|
42612
|
+
if (startLoc ?? (startLoc = this.state.startLoc), left = left ?? this.parseBindingAtom(), !this.eat(29)) return left;
|
42442
42613
|
const node = this.startNodeAt(startLoc);
|
42443
42614
|
return node.left = left, node.right = this.parseMaybeAssignAllowIn(), this.finishNode(node, "AssignmentPattern");
|
42444
42615
|
}
|
@@ -42582,6 +42753,9 @@ function requireLib$1() {
|
|
42582
42753
|
IndexSignatureHasOverride: "'override' modifier cannot appear on an index signature.",
|
42583
42754
|
IndexSignatureHasStatic: "Index signatures cannot have the 'static' modifier.",
|
42584
42755
|
InitializerNotAllowedInAmbientContext: "Initializers are not allowed in ambient contexts.",
|
42756
|
+
InvalidHeritageClauseType: ({
|
42757
|
+
token: token2
|
42758
|
+
}) => `'${token2}' list can only include identifiers or qualified-names with optional type arguments.`,
|
42585
42759
|
InvalidModifierOnTypeMember: ({
|
42586
42760
|
modifier
|
42587
42761
|
}) => `'${modifier}' modifier cannot appear on a type member.`,
|
@@ -43208,8 +43382,10 @@ function requireLib$1() {
|
|
43208
43382
|
}
|
43209
43383
|
tsParseHeritageClause(token2) {
|
43210
43384
|
const originalStartLoc = this.state.startLoc, delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
|
43211
|
-
|
43212
|
-
|
43385
|
+
{
|
43386
|
+
const node = this.startNode();
|
43387
|
+
return node.expression = this.tsParseEntityName(3), this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSExpressionWithTypeArguments");
|
43388
|
+
}
|
43213
43389
|
});
|
43214
43390
|
return delimitedList.length || this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
43215
43391
|
token: token2
|
@@ -43441,7 +43617,7 @@ function requireLib$1() {
|
|
43441
43617
|
isExportDefaultSpecifier() {
|
43442
43618
|
return this.tsIsDeclarationStart() ? !1 : super.isExportDefaultSpecifier();
|
43443
43619
|
}
|
43444
|
-
|
43620
|
+
parseBindingElement(flags, decorators) {
|
43445
43621
|
const startLoc = this.state.startLoc, modified = {};
|
43446
43622
|
this.tsParseModifiers({
|
43447
43623
|
allowedModifiers: ["public", "private", "protected", "override", "readonly"]
|
@@ -43682,10 +43858,13 @@ function requireLib$1() {
|
|
43682
43858
|
return this.tsIsDeclarationStart() ? !0 : super.shouldParseExportDeclaration();
|
43683
43859
|
}
|
43684
43860
|
parseConditional(expr, startLoc, refExpressionErrors) {
|
43685
|
-
if (!this.
|
43686
|
-
|
43687
|
-
|
43688
|
-
|
43861
|
+
if (!this.match(17)) return expr;
|
43862
|
+
if (this.state.maybeInArrowParameters) {
|
43863
|
+
const nextCh = this.lookaheadCharCode();
|
43864
|
+
if (nextCh === 44 || nextCh === 61 || nextCh === 58 || nextCh === 41)
|
43865
|
+
return this.setOptionalParametersError(refExpressionErrors), expr;
|
43866
|
+
}
|
43867
|
+
return super.parseConditional(expr, startLoc, refExpressionErrors);
|
43689
43868
|
}
|
43690
43869
|
parseParenItem(node, startLoc) {
|
43691
43870
|
const newNode = super.parseParenItem(node, startLoc);
|
@@ -43805,8 +43984,8 @@ function requireLib$1() {
|
|
43805
43984
|
throw ((_jsx3 = jsx3) == null ? void 0 : _jsx3.error) || arrow4.error || ((_typeCast2 = typeCast) == null ? void 0 : _typeCast2.error);
|
43806
43985
|
}
|
43807
43986
|
reportReservedArrowTypeParam(node) {
|
43808
|
-
var _node$
|
43809
|
-
node.params.length === 1 && !node.params[0].constraint && !((_node$
|
43987
|
+
var _node$extra2;
|
43988
|
+
node.params.length === 1 && !node.params[0].constraint && !((_node$extra2 = node.extra) != null && _node$extra2.trailingComma) && this.getPluginOption("typescript", "disallowAmbiguousJSXLike") && this.raise(TSErrors.ReservedArrowTypeParam, node);
|
43810
43989
|
}
|
43811
43990
|
parseMaybeUnary(refExpressionErrors, sawUnary) {
|
43812
43991
|
return !this.hasPlugin("jsx") && this.match(47) ? this.tsParseTypeAssertion() : super.parseMaybeUnary(refExpressionErrors, sawUnary);
|
@@ -43886,7 +44065,6 @@ function requireLib$1() {
|
|
43886
44065
|
case "TSParameterProperty":
|
43887
44066
|
return "parameter";
|
43888
44067
|
case "TSNonNullExpression":
|
43889
|
-
case "TSInstantiationExpression":
|
43890
44068
|
return "expression";
|
43891
44069
|
case "TSAsExpression":
|
43892
44070
|
case "TSSatisfiesExpression":
|
@@ -43948,12 +44126,9 @@ function requireLib$1() {
|
|
43948
44126
|
} = this.state;
|
43949
44127
|
return type2 === 51 ? (this.state.pos -= 2, this.finishOp(47, 1), 47) : type2;
|
43950
44128
|
}
|
43951
|
-
|
43952
|
-
|
43953
|
-
|
43954
|
-
expr?.type === "TSTypeCastExpression" && (exprList[i] = this.typeCastToParameter(expr));
|
43955
|
-
}
|
43956
|
-
super.toAssignableList(exprList, trailingCommaLoc, isLHS);
|
44129
|
+
toAssignableListItem(exprList, index, isLHS) {
|
44130
|
+
const node = exprList[index];
|
44131
|
+
node.type === "TSTypeCastExpression" && (exprList[index] = this.typeCastToParameter(node)), super.toAssignableListItem(exprList, index, isLHS);
|
43957
44132
|
}
|
43958
44133
|
typeCastToParameter(node) {
|
43959
44134
|
return node.expression.typeAnnotation = node.typeAnnotation, this.resetEndLocation(node.expression, node.typeAnnotation.loc.end), node.expression;
|
@@ -44307,17 +44482,11 @@ function requireLib$1() {
|
|
44307
44482
|
placeholders
|
44308
44483
|
}, mixinPluginNames = Object.keys(mixinPlugins);
|
44309
44484
|
class ExpressionParser extends LValParser {
|
44310
|
-
checkProto(prop, isRecord,
|
44485
|
+
checkProto(prop, isRecord, sawProto, refExpressionErrors) {
|
44311
44486
|
if (prop.type === "SpreadElement" || this.isObjectMethod(prop) || prop.computed || prop.shorthand)
|
44312
|
-
return;
|
44487
|
+
return sawProto;
|
44313
44488
|
const key2 = prop.key;
|
44314
|
-
|
44315
|
-
if (isRecord) {
|
44316
|
-
this.raise(Errors.RecordNoProto, key2);
|
44317
|
-
return;
|
44318
|
-
}
|
44319
|
-
protoRef.used && (refExpressionErrors ? refExpressionErrors.doubleProtoLoc === null && (refExpressionErrors.doubleProtoLoc = key2.loc.start) : this.raise(Errors.DuplicateProto, key2)), protoRef.used = !0;
|
44320
|
-
}
|
44489
|
+
return (key2.type === "Identifier" ? key2.name : key2.value) === "__proto__" ? isRecord ? (this.raise(Errors.RecordNoProto, key2), !0) : (sawProto && (refExpressionErrors ? refExpressionErrors.doubleProtoLoc === null && (refExpressionErrors.doubleProtoLoc = key2.loc.start) : this.raise(Errors.DuplicateProto, key2)), !0) : sawProto;
|
44321
44490
|
}
|
44322
44491
|
shouldExitDescending(expr, potentialArrowAt) {
|
44323
44492
|
return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt;
|
@@ -44346,9 +44515,8 @@ function requireLib$1() {
|
|
44346
44515
|
parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse) {
|
44347
44516
|
return this.allowInAnd(() => this.parseMaybeAssign(refExpressionErrors, afterLeftParse));
|
44348
44517
|
}
|
44349
|
-
setOptionalParametersError(refExpressionErrors
|
44350
|
-
|
44351
|
-
refExpressionErrors.optionalParametersLoc = (_resultError$loc = resultError?.loc) != null ? _resultError$loc : this.state.startLoc;
|
44518
|
+
setOptionalParametersError(refExpressionErrors) {
|
44519
|
+
refExpressionErrors.optionalParametersLoc = this.state.startLoc;
|
44352
44520
|
}
|
44353
44521
|
parseMaybeAssign(refExpressionErrors, afterLeftParse) {
|
44354
44522
|
const startLoc = this.state.startLoc;
|
@@ -44920,8 +45088,7 @@ function requireLib$1() {
|
|
44920
45088
|
isRecord && this.expectPlugin("recordAndTuple");
|
44921
45089
|
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
|
44922
45090
|
this.state.inFSharpPipelineDirectBody = !1;
|
44923
|
-
|
44924
|
-
let first2 = !0;
|
45091
|
+
let sawProto = !1, first2 = !0;
|
44925
45092
|
const node = this.startNode();
|
44926
45093
|
for (node.properties = [], this.next(); !this.match(close); ) {
|
44927
45094
|
if (first2)
|
@@ -44931,7 +45098,7 @@ function requireLib$1() {
|
|
44931
45098
|
break;
|
44932
45099
|
}
|
44933
45100
|
let prop;
|
44934
|
-
isPattern ? prop = this.parseBindingProperty() : (prop = this.parsePropertyDefinition(refExpressionErrors), this.checkProto(prop, isRecord,
|
45101
|
+
isPattern ? prop = this.parseBindingProperty() : (prop = this.parsePropertyDefinition(refExpressionErrors), sawProto = this.checkProto(prop, isRecord, sawProto, refExpressionErrors)), isRecord && !this.isObjectProperty(prop) && prop.type !== "SpreadElement" && this.raise(Errors.InvalidRecordProperty, prop), prop.shorthand && this.addExtra(prop, "shorthand", !0), node.properties.push(prop);
|
44935
45102
|
}
|
44936
45103
|
this.next(), this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
|
44937
45104
|
let type2 = "ObjectExpression";
|
@@ -45594,7 +45761,7 @@ function requireLib$1() {
|
|
45594
45761
|
case 82: {
|
45595
45762
|
!(this.optionFlags & 8) && !topLevel && this.raise(Errors.UnexpectedImportExport, this.state.startLoc), this.next();
|
45596
45763
|
let result;
|
45597
|
-
return startType === 83 ?
|
45764
|
+
return startType === 83 ? result = this.parseImport(node) : result = this.parseExport(node, decorators), this.assertModuleNodeAllowed(result), result;
|
45598
45765
|
}
|
45599
45766
|
default:
|
45600
45767
|
if (this.isAsyncFunction())
|
@@ -46044,7 +46211,7 @@ function requireLib$1() {
|
|
46044
46211
|
if (hasStar && !hasNamespace) {
|
46045
46212
|
if (hasDefault && this.unexpected(), decorators)
|
46046
46213
|
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
46047
|
-
return this.parseExportFrom(node, !0), this.finishNode(node, "ExportAllDeclaration");
|
46214
|
+
return this.parseExportFrom(node, !0), this.sawUnambiguousESM = !0, this.finishNode(node, "ExportAllDeclaration");
|
46048
46215
|
}
|
46049
46216
|
const hasSpecifiers = this.maybeParseExportNamedSpecifiers(node);
|
46050
46217
|
hasDefault && parseAfterDefault && !hasStar && !hasSpecifiers && this.unexpected(null, 5), hasNamespace && parseAfterNamespace && this.unexpected(null, 98);
|
@@ -46062,7 +46229,7 @@ function requireLib$1() {
|
|
46062
46229
|
this.maybeTakeDecorators(decorators, node2.declaration, node2);
|
46063
46230
|
else if (decorators)
|
46064
46231
|
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
46065
|
-
return this.finishNode(node2, "ExportNamedDeclaration");
|
46232
|
+
return this.sawUnambiguousESM = !0, this.finishNode(node2, "ExportNamedDeclaration");
|
46066
46233
|
}
|
46067
46234
|
if (this.eat(65)) {
|
46068
46235
|
const node2 = node, decl = this.parseExportDefaultExpression();
|
@@ -46070,7 +46237,7 @@ function requireLib$1() {
|
|
46070
46237
|
this.maybeTakeDecorators(decorators, decl, node2);
|
46071
46238
|
else if (decorators)
|
46072
46239
|
throw this.raise(Errors.UnsupportedDecoratorExport, node);
|
46073
|
-
return this.checkExport(node2, !0, !0), this.finishNode(node2, "ExportDefaultDeclaration");
|
46240
|
+
return this.checkExport(node2, !0, !0), this.sawUnambiguousESM = !0, this.finishNode(node2, "ExportDefaultDeclaration");
|
46074
46241
|
}
|
46075
46242
|
this.unexpected(null, 5);
|
46076
46243
|
}
|
@@ -46099,12 +46266,12 @@ function requireLib$1() {
|
|
46099
46266
|
const node2 = node;
|
46100
46267
|
node2.specifiers || (node2.specifiers = []);
|
46101
46268
|
const isTypeExport = node2.exportKind === "type";
|
46102
|
-
return node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport)), node2.source = null,
|
46269
|
+
return node2.specifiers.push(...this.parseExportSpecifiers(isTypeExport)), node2.source = null, this.hasPlugin("importAssertions") ? node2.assertions = [] : node2.attributes = [], node2.declaration = null, !0;
|
46103
46270
|
}
|
46104
46271
|
return !1;
|
46105
46272
|
}
|
46106
46273
|
maybeParseExportDeclaration(node) {
|
46107
|
-
return this.shouldParseExportDeclaration() ? (node.specifiers = [], node.source = null, this.hasPlugin("importAssertions")
|
46274
|
+
return this.shouldParseExportDeclaration() ? (node.specifiers = [], node.source = null, this.hasPlugin("importAssertions") ? node.assertions = [] : node.attributes = [], node.declaration = this.parseExportDeclaration(node), !0) : !1;
|
46108
46275
|
}
|
46109
46276
|
isAsyncFunction() {
|
46110
46277
|
if (!this.isContextual(95)) return !1;
|
@@ -46305,7 +46472,7 @@ function requireLib$1() {
|
|
46305
46472
|
}
|
46306
46473
|
parseImportSourceAndAttributes(node) {
|
46307
46474
|
var _node$specifiers2;
|
46308
|
-
return (_node$specifiers2 = node.specifiers) != null || (node.specifiers = []), node.source = this.parseImportSource(), this.maybeParseImportAttributes(node), this.checkImportReflection(node), this.checkJSONModuleImport(node), this.semicolon(), this.finishNode(node, "ImportDeclaration");
|
46475
|
+
return (_node$specifiers2 = node.specifiers) != null || (node.specifiers = []), node.source = this.parseImportSource(), this.maybeParseImportAttributes(node), this.checkImportReflection(node), this.checkJSONModuleImport(node), this.semicolon(), this.sawUnambiguousESM = !0, this.finishNode(node, "ImportDeclaration");
|
46309
46476
|
}
|
46310
46477
|
parseImportSource() {
|
46311
46478
|
return this.match(134) || this.unexpected(), this.parseExprAtom();
|
@@ -46557,6 +46724,22 @@ function processTemplate(options2) {
|
|
46557
46724
|
}
|
46558
46725
|
}), mainExports.print(ast, { quote: "single" }).code;
|
46559
46726
|
}
|
46727
|
+
const defaultAppTemplate = `
|
46728
|
+
import {defineCliConfig} from 'sanity/cli'
|
46729
|
+
|
46730
|
+
export default defineCliConfig({
|
46731
|
+
__experimental_appConfiguration: {
|
46732
|
+
organizationId: '%organizationId%',
|
46733
|
+
appLocation: '%appLocation%',
|
46734
|
+
},
|
46735
|
+
})
|
46736
|
+
`;
|
46737
|
+
function createAppCliConfig(options2) {
|
46738
|
+
return processTemplate({
|
46739
|
+
template: defaultAppTemplate,
|
46740
|
+
variables: options2
|
46741
|
+
});
|
46742
|
+
}
|
46560
46743
|
const defaultTemplate$1 = `
|
46561
46744
|
import {defineCliConfig} from 'sanity/cli'
|
46562
46745
|
|
@@ -46579,22 +46762,6 @@ function createCliConfig(options2) {
|
|
46579
46762
|
includeBooleanTransform: !0
|
46580
46763
|
});
|
46581
46764
|
}
|
46582
|
-
const defaultCoreAppTemplate = `
|
46583
|
-
import {defineCliConfig} from 'sanity/cli'
|
46584
|
-
|
46585
|
-
export default defineCliConfig({
|
46586
|
-
__experimental_coreAppConfiguration: {
|
46587
|
-
organizationId: '%organizationId%',
|
46588
|
-
appLocation: '%appLocation%',
|
46589
|
-
},
|
46590
|
-
})
|
46591
|
-
`;
|
46592
|
-
function createCoreAppCliConfig(options2) {
|
46593
|
-
return processTemplate({
|
46594
|
-
template: defaultCoreAppTemplate,
|
46595
|
-
variables: options2
|
46596
|
-
});
|
46597
|
-
}
|
46598
46765
|
/*!
|
46599
46766
|
* isobject <https://github.com/jonschlinkert/isobject>
|
46600
46767
|
*
|
@@ -46737,14 +46904,14 @@ function createStudioConfig(options2) {
|
|
46737
46904
|
variables
|
46738
46905
|
});
|
46739
46906
|
}
|
46740
|
-
const
|
46741
|
-
function
|
46742
|
-
return
|
46907
|
+
const appTemplates = ["app-quickstart"];
|
46908
|
+
function determineAppTemplate(templateName) {
|
46909
|
+
return appTemplates.includes(templateName);
|
46743
46910
|
}
|
46744
|
-
const
|
46911
|
+
const appTemplate = {
|
46745
46912
|
dependencies: {
|
46746
|
-
"@sanity/sdk": "^0.0.0-
|
46747
|
-
"@sanity/sdk-react": "^0.0.0-
|
46913
|
+
"@sanity/sdk": "^0.0.0-rc",
|
46914
|
+
"@sanity/sdk-react": "^0.0.0-rc",
|
46748
46915
|
react: "^19",
|
46749
46916
|
"react-dom": "^19"
|
46750
46917
|
},
|
@@ -46762,12 +46929,11 @@ const blogTemplate = {}, cleanTemplate = {}, coreAppTemplate = {
|
|
46762
46929
|
},
|
46763
46930
|
appLocation: "./src/App.tsx",
|
46764
46931
|
scripts: {
|
46765
|
-
|
46766
|
-
|
46767
|
-
|
46768
|
-
start: "sanity app start"
|
46932
|
+
dev: "sanity dev",
|
46933
|
+
build: "sanity build",
|
46934
|
+
start: "sanity start"
|
46769
46935
|
}
|
46770
|
-
}, configTemplate$3 = `
|
46936
|
+
}, blogTemplate = {}, cleanTemplate = {}, configTemplate$3 = `
|
46771
46937
|
import {defineConfig, isDev} from 'sanity'
|
46772
46938
|
import {visionTool} from '@sanity/vision'
|
46773
46939
|
import {structureTool} from 'sanity/structure'
|
@@ -46945,7 +47111,7 @@ export default defineConfig({
|
|
46945
47111
|
}, templates = {
|
46946
47112
|
blog: blogTemplate,
|
46947
47113
|
clean: cleanTemplate,
|
46948
|
-
"
|
47114
|
+
"app-quickstart": appTemplate,
|
46949
47115
|
"get-started": getStartedTemplate,
|
46950
47116
|
moviedb: movieTemplate,
|
46951
47117
|
shopify: shopifyTemplate$1,
|
@@ -46966,7 +47132,7 @@ async function updateInitialTemplateMetadata(apiClient, projectId, templateName)
|
|
46966
47132
|
}
|
46967
47133
|
}
|
46968
47134
|
async function bootstrapLocalTemplate(opts, context) {
|
46969
|
-
const { apiClient, cliRoot, output } = context, templatesDir = path__default.default.join(cliRoot, "templates"), { outputPath, templateName, useTypeScript, packageName, variables } = opts, sourceDir = path__default.default.join(templatesDir, templateName), sharedDir = path__default.default.join(templatesDir, "shared"),
|
47135
|
+
const { apiClient, cliRoot, output } = context, templatesDir = path__default.default.join(cliRoot, "templates"), { outputPath, templateName, useTypeScript, packageName, variables } = opts, sourceDir = path__default.default.join(templatesDir, templateName), sharedDir = path__default.default.join(templatesDir, "shared"), isAppTemplate = determineAppTemplate(templateName), template = templates[templateName];
|
46970
47136
|
if (!template)
|
46971
47137
|
throw new Error(`Template "${templateName}" not defined`);
|
46972
47138
|
loadEnv.debug('Copying files from template "%s" to "%s"', templateName, outputPath);
|
@@ -46981,20 +47147,20 @@ async function bootstrapLocalTemplate(opts, context) {
|
|
46981
47147
|
schemaUrl: opts.schemaUrl
|
46982
47148
|
})), spinner.succeed(), spinner = output.spinner("Resolving latest module versions").start();
|
46983
47149
|
const dependencyVersions = await resolveLatestVersions({
|
46984
|
-
...
|
46985
|
-
...
|
47150
|
+
...isAppTemplate ? {} : studioDependencies.dependencies,
|
47151
|
+
...isAppTemplate ? {} : studioDependencies.devDependencies,
|
46986
47152
|
...template.dependencies || {},
|
46987
47153
|
...template.devDependencies || {}
|
46988
47154
|
});
|
46989
47155
|
spinner.succeed();
|
46990
47156
|
const dependencies = Object.keys({
|
46991
|
-
...
|
47157
|
+
...isAppTemplate ? {} : studioDependencies.dependencies,
|
46992
47158
|
...template.dependencies
|
46993
47159
|
}).reduce(
|
46994
47160
|
(deps, dependency) => (deps[dependency] = dependencyVersions[dependency], deps),
|
46995
47161
|
{}
|
46996
47162
|
), devDependencies = Object.keys({
|
46997
|
-
...
|
47163
|
+
...isAppTemplate ? {} : studioDependencies.devDependencies,
|
46998
47164
|
...template.devDependencies
|
46999
47165
|
}).reduce(
|
47000
47166
|
(deps, dependency) => (deps[dependency] = dependencyVersions[dependency], deps),
|
@@ -47009,7 +47175,7 @@ async function bootstrapLocalTemplate(opts, context) {
|
|
47009
47175
|
}), studioConfig = createStudioConfig({
|
47010
47176
|
template: template.configTemplate,
|
47011
47177
|
variables
|
47012
|
-
}), cliConfig =
|
47178
|
+
}), cliConfig = isAppTemplate ? createAppCliConfig({
|
47013
47179
|
appLocation: template.appLocation,
|
47014
47180
|
organizationId: variables.organizationId
|
47015
47181
|
}) : createCliConfig({
|
@@ -47019,7 +47185,7 @@ async function bootstrapLocalTemplate(opts, context) {
|
|
47019
47185
|
}), codeExt = useTypeScript ? "ts" : "js";
|
47020
47186
|
return await Promise.all(
|
47021
47187
|
[
|
47022
|
-
|
47188
|
+
isAppTemplate ? Promise.resolve(null) : writeFileIfNotExists(`sanity.config.${codeExt}`, studioConfig),
|
47023
47189
|
writeFileIfNotExists(`sanity.cli.${codeExt}`, cliConfig),
|
47024
47190
|
writeFileIfNotExists("package.json", packageManifest),
|
47025
47191
|
writeFileIfNotExists(
|
@@ -52641,14 +52807,12 @@ ${err.message}`);
|
|
52641
52807
|
if (!envFilename.startsWith(".env"))
|
52642
52808
|
throw new Error("Env filename must start with .env");
|
52643
52809
|
const hasToken = getUserConfig().get("authToken");
|
52644
|
-
|
52645
|
-
|
52646
|
-
|
52647
|
-
|
52648
|
-
} else unattended || (trace.log({ step: "login" }), await getOrCreateUser());
|
52649
|
-
const isCoreAppTemplate = cliFlags.template ? determineCoreAppTemplate(cliFlags.template) : !1;
|
52810
|
+
loadEnv.debug(hasToken ? "User already has a token" : "User has no token");
|
52811
|
+
let user;
|
52812
|
+
hasToken ? (trace.log({ step: "login", alreadyLoggedIn: !0 }), user = await getUserData(apiClient), success("You are logged in as %s using %s", user.email, getProviderName(user.provider))) : unattended || (trace.log({ step: "login" }), user = await getOrCreateUser());
|
52813
|
+
const isAppTemplate = cliFlags.template ? determineAppTemplate(cliFlags.template) : !1;
|
52650
52814
|
let introMessage = "Fetching existing projects";
|
52651
|
-
cliFlags.quickstart && (introMessage = "Eject your existing project's Sanity configuration"),
|
52815
|
+
cliFlags.quickstart && (introMessage = "Eject your existing project's Sanity configuration"), isAppTemplate || (success(introMessage), print(""));
|
52652
52816
|
const flags = await prepareFlags(), { projectId, displayName, isFirstProject, datasetName, schemaUrl, organizationId } = await getProjectDetails(), sluggedName = lodashExports.deburr(displayName.toLowerCase()).replace(/\s+/g, "-").replace(/[^a-z0-9-]/g, "");
|
52653
52817
|
if (bareOutput) {
|
52654
52818
|
success("Below are your project details"), print(""), print(`Project ID: ${chalk2.cyan(projectId)}`), print(`Dataset: ${chalk2.cyan(datasetName)}`), print(
|
@@ -52840,12 +53004,12 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
|
|
52840
53004
|
outputPath === process.cwd() ? (print(`
|
52841
53005
|
${chalk2.green("Success!")} Now, use this command to continue:
|
52842
53006
|
`), print(
|
52843
|
-
`${chalk2.cyan(devCommand)} - to run ${
|
53007
|
+
`${chalk2.cyan(devCommand)} - to run ${isAppTemplate ? "your Sanity application" : "Sanity Studio"}
|
52844
53008
|
`
|
52845
53009
|
)) : (print(`
|
52846
53010
|
${chalk2.green("Success!")} Now, use these commands to continue:
|
52847
53011
|
`), print(`First: ${chalk2.cyan(`cd ${outputPath}`)} - to enter project\u2019s directory`), print(
|
52848
|
-
`Then: ${chalk2.cyan(devCommand)} -to run ${
|
53012
|
+
`Then: ${chalk2.cyan(devCommand)} -to run ${isAppTemplate ? "your Sanity application" : "Sanity Studio"}
|
52849
53013
|
`
|
52850
53014
|
)), print("Other helpful commands"), print("npx sanity docs - to open the documentation in a browser"), print("npx sanity manage - to open the project settings in a browser"), print("npx sanity help - to explore the CLI manual");
|
52851
53015
|
const sendInvite = isFirstProject && await prompt2.single({
|
@@ -52858,7 +53022,7 @@ ${chalk2.green("Success!")} Now, use these commands to continue:
|
|
52858
53022
|
method: "POST"
|
52859
53023
|
}).catch(lodashExports.noop)), trace.complete();
|
52860
53024
|
async function getOrCreateUser() {
|
52861
|
-
warn("No authentication credentials found in your Sanity config"), print(""), await login({ extOptions: {} }, { ...context, telemetry: trace.newContext("login") });
|
53025
|
+
return warn("No authentication credentials found in your Sanity config"), print(""), await login({ extOptions: {} }, { ...context, telemetry: trace.newContext("login") }), getUserData(apiClient);
|
52862
53026
|
}
|
52863
53027
|
async function getProjectDetails() {
|
52864
53028
|
if (flags.quickstart) {
|
@@ -52872,7 +53036,7 @@ ${chalk2.green("Success!")} Now, use these commands to continue:
|
|
52872
53036
|
isFirstProject: data.isFirstProject
|
52873
53037
|
}), data;
|
52874
53038
|
}
|
52875
|
-
if (
|
53039
|
+
if (isAppTemplate) {
|
52876
53040
|
const organizations = await apiClient({ requireUser: !0, requireProject: !1 }).request({ uri: "/organizations" });
|
52877
53041
|
return {
|
52878
53042
|
projectId: "",
|
@@ -52952,7 +53116,14 @@ ${err.message}`);
|
|
52952
53116
|
loadEnv.debug(
|
52953
53117
|
isUsersFirstProject ? "No projects found for user, prompting for name" : "Using a coupon - skipping project selection"
|
52954
53118
|
);
|
52955
|
-
const projectName = await prompt2.single({
|
53119
|
+
const projectName = await prompt2.single({
|
53120
|
+
type: "input",
|
53121
|
+
message: "Project name:",
|
53122
|
+
default: "My Sanity Project",
|
53123
|
+
validate(input2) {
|
53124
|
+
return !input2 || input2.trim() === "" ? "Project name cannot be empty" : input2.length > 80 ? "Project name cannot be longer than 80 characters" : !0;
|
53125
|
+
}
|
53126
|
+
});
|
52956
53127
|
return createProject(apiClient, {
|
52957
53128
|
displayName: projectName,
|
52958
53129
|
organizationId: await getOrganizationId(organizations),
|
@@ -53184,33 +53355,45 @@ The default dataset configuration has a public dataset named "production".`;
|
|
53184
53355
|
}
|
53185
53356
|
return cliFlags;
|
53186
53357
|
}
|
53187
|
-
async function
|
53188
|
-
|
53189
|
-
|
53190
|
-
|
53191
|
-
|
53192
|
-
|
53193
|
-
|
53194
|
-
if (withGrant.length === 0) {
|
53195
|
-
loadEnv.debug("User lacks project attach grant in all organizations, not prompting");
|
53196
|
-
return;
|
53358
|
+
async function createOrganization(props = {}) {
|
53359
|
+
const name = props.name || await prompt2.single({
|
53360
|
+
type: "input",
|
53361
|
+
message: "Organization name:",
|
53362
|
+
default: user ? user.name : void 0,
|
53363
|
+
validate(input2) {
|
53364
|
+
return input2.length === 0 ? "Organization name cannot be empty" : input2.length > 100 ? "Organization name cannot be longer than 100 characters" : !0;
|
53197
53365
|
}
|
53198
|
-
|
53199
|
-
|
53200
|
-
|
53201
|
-
|
53202
|
-
|
53203
|
-
|
53204
|
-
|
53205
|
-
|
53206
|
-
|
53207
|
-
|
53208
|
-
|
53209
|
-
|
53210
|
-
|
53211
|
-
|
53212
|
-
|
53213
|
-
|
53366
|
+
}), spinner = context.output.spinner("Creating organization").start(), organization = await apiClient({ requireProject: !1, requireUser: !0 }).request({
|
53367
|
+
uri: "/organizations",
|
53368
|
+
method: "POST",
|
53369
|
+
body: { name }
|
53370
|
+
});
|
53371
|
+
return spinner.succeed(), organization;
|
53372
|
+
}
|
53373
|
+
async function getOrganizationId(organizations) {
|
53374
|
+
if (unattended || flags.organization)
|
53375
|
+
return flags.organization || void 0;
|
53376
|
+
if (organizations.length === 0)
|
53377
|
+
return createOrganization().then((org) => org.id);
|
53378
|
+
loadEnv.debug(`User has ${organizations.length} organization(s), checking attach access`);
|
53379
|
+
const withGrantInfo = await getOrganizationsWithAttachGrantInfo(organizations), withAttach = withGrantInfo.filter(({ hasAttachGrant }) => hasAttachGrant);
|
53380
|
+
loadEnv.debug("User has attach access to %d organizations.", withAttach.length);
|
53381
|
+
const organizationChoices = [
|
53382
|
+
...withGrantInfo.map(({ organization, hasAttachGrant }) => ({
|
53383
|
+
value: organization.id,
|
53384
|
+
name: `${organization.name} [${organization.id}]`,
|
53385
|
+
disabled: hasAttachGrant ? !1 : "Insufficient permissions"
|
53386
|
+
})),
|
53387
|
+
new prompt2.Separator(),
|
53388
|
+
{ value: "-new-", name: "Create new organization" },
|
53389
|
+
new prompt2.Separator()
|
53390
|
+
], defaultOrganizationId = withAttach.length === 1 ? withAttach[0].organization.id : organizations.find((org) => org.name === user?.name)?.id, chosenOrg = await prompt2.single({
|
53391
|
+
message: "Select organization:",
|
53392
|
+
type: "list",
|
53393
|
+
default: defaultOrganizationId || void 0,
|
53394
|
+
choices: organizationChoices
|
53395
|
+
});
|
53396
|
+
return chosenOrg === "-new-" ? createOrganization().then((org) => org.id) : chosenOrg || void 0;
|
53214
53397
|
}
|
53215
53398
|
async function hasProjectAttachGrant(orgId) {
|
53216
53399
|
const requiredGrantGroup = "sanity.organization.projects", requiredGrant = "attach";
|
@@ -53218,8 +53401,15 @@ The default dataset configuration has a public dataset named "production".`;
|
|
53218
53401
|
(resource) => resource.grants && resource.grants.some((grant) => grant.name === requiredGrant)
|
53219
53402
|
);
|
53220
53403
|
}
|
53221
|
-
function
|
53222
|
-
return
|
53404
|
+
function getOrganizationsWithAttachGrantInfo(organizations) {
|
53405
|
+
return pMap(
|
53406
|
+
organizations,
|
53407
|
+
async (organization) => ({
|
53408
|
+
hasAttachGrant: await hasProjectAttachGrant(organization.id),
|
53409
|
+
organization
|
53410
|
+
}),
|
53411
|
+
{ concurrency: 3 }
|
53412
|
+
);
|
53223
53413
|
}
|
53224
53414
|
async function createOrAppendEnvVars(filename, framework, options2) {
|
53225
53415
|
const envVars = {
|
@@ -53762,7 +53952,11 @@ const baseCommands = [
|
|
53762
53952
|
enableTelemetryCommand,
|
53763
53953
|
telemetryStatusCommand,
|
53764
53954
|
generateTypegenCommand,
|
53765
|
-
typegenGroup
|
53955
|
+
typegenGroup,
|
53956
|
+
functionsGroup,
|
53957
|
+
devFunctionsCommand,
|
53958
|
+
logsFunctionsCommand,
|
53959
|
+
testFunctionsCommand
|
53766
53960
|
], copyProperty = (to, from2, property, ignoreNonConfigurable) => {
|
53767
53961
|
if (property === "length" || property === "prototype" || property === "arguments" || property === "caller")
|
53768
53962
|
return;
|
@@ -78657,14 +78851,14 @@ function installProcessExitHack(finalTask) {
|
|
78657
78851
|
}
|
78658
78852
|
async function runCli(cliRoot, { cliVersion }) {
|
78659
78853
|
installUnhandledRejectionsHandler();
|
78660
|
-
const pkg = { name: "@sanity/cli", version: cliVersion }, args = parseArguments(), isInit = args.groupOrCommand === "init" && args.argsWithoutOptions[0] !== "plugin",
|
78854
|
+
const pkg = { name: "@sanity/cli", version: cliVersion }, args = parseArguments(), isInit = args.groupOrCommand === "init" && args.argsWithoutOptions[0] !== "plugin", cwd = getCurrentWorkingDirectory();
|
78661
78855
|
let workDir;
|
78662
78856
|
try {
|
78663
|
-
workDir = isInit ? process.cwd() : loadEnv.resolveRootDir(cwd
|
78857
|
+
workDir = isInit ? process.cwd() : loadEnv.resolveRootDir(cwd);
|
78664
78858
|
} catch (err) {
|
78665
78859
|
console.error(chalk__default.default.red(err.message)), process.exit(1);
|
78666
78860
|
}
|
78667
|
-
loadAndSetEnvFromDotEnvFiles({ workDir, cmd: args.groupOrCommand
|
78861
|
+
loadAndSetEnvFromDotEnvFiles({ workDir, cmd: args.groupOrCommand }), maybeFixMissingWindowsEnvVar(), await runUpdateCheck({ pkg, cwd, workDir }).notify(), telemetryDisclosure(), loadEnv.debug(`Reading CLI config from "${workDir}"`);
|
78668
78862
|
const cliConfig = await getCliConfig.getCliConfig(workDir, { forked: !0 });
|
78669
78863
|
cliConfig || loadEnv.debug("No CLI config found");
|
78670
78864
|
const { logger: telemetry2, flush: flushTelemetry } = createTelemetryStore({
|
@@ -78690,8 +78884,7 @@ async function runCli(cliRoot, { cliVersion }) {
|
|
78690
78884
|
workDir,
|
78691
78885
|
corePath: await getCoreModulePath(workDir, cliConfig),
|
78692
78886
|
cliConfig,
|
78693
|
-
telemetry: telemetry2
|
78694
|
-
isCoreApp
|
78887
|
+
telemetry: telemetry2
|
78695
78888
|
};
|
78696
78889
|
warnOnNonProductionEnvironment(), warnOnInferredProjectDir(isInit, cwd, workDir);
|
78697
78890
|
const core2 = args.coreOptions, commands = await mergeCommands(baseCommands, options2.corePath, { cliVersion });
|
@@ -78791,11 +78984,7 @@ function warnOnNonProductionEnvironment() {
|
|
78791
78984
|
)
|
78792
78985
|
);
|
78793
78986
|
}
|
78794
|
-
function loadAndSetEnvFromDotEnvFiles({
|
78795
|
-
workDir,
|
78796
|
-
cmd,
|
78797
|
-
isCoreApp
|
78798
|
-
}) {
|
78987
|
+
function loadAndSetEnvFromDotEnvFiles({ workDir, cmd }) {
|
78799
78988
|
if (fs$1.existsSync(path__default.default.join(workDir, "sanity.json"))) {
|
78800
78989
|
loadEnv.debug("sanity.json exists, assuming v2 project and loading .env files using old behavior");
|
78801
78990
|
const env = process.env.SANITY_ACTIVE_ENV || process.env.NODE_ENV || "development";
|
@@ -78807,7 +78996,7 @@ function loadAndSetEnvFromDotEnvFiles({
|
|
78807
78996
|
let mode2 = process.env.SANITY_ACTIVE_ENV;
|
78808
78997
|
!mode2 && (isProdCmd || process.env.NODE_ENV === "production") ? mode2 = "production" : mode2 || (mode2 = "development"), mode2 === "production" && !isProdCmd && console.warn(chalk__default.default.yellow(`[WARN] Running in ${sanityEnv} environment mode
|
78809
78998
|
`)), loadEnv.debug("Loading environment files using %s mode", mode2);
|
78810
|
-
const studioEnv = loadEnv.loadEnv(mode2, workDir,
|
78999
|
+
const studioEnv = loadEnv.loadEnv(mode2, workDir, ["SANITY_STUDIO_"]);
|
78811
79000
|
process.env = { ...process.env, ...studioEnv };
|
78812
79001
|
}
|
78813
79002
|
function maybeFixMissingWindowsEnvVar() {
|