@sanity/cli 3.58.1-upgrade-vite-v5.8 → 3.58.1-upgrade-vite-v5.44

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.
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- var fs$r = require("node:fs"), os$6 = require("node:os"), path$t = require("node:path"), chalk$2 = require("chalk"), loadEnv = require("./loadEnv.js"), nodeMachineId = require("node-machine-id"), require$$0$4 = require("path"), require$$1$2 = require("module"), require$$0$5 = require("fs"), telemetry = require("@sanity/telemetry"), childProcess$2 = require("node:child_process"), fs$q = require("node:fs/promises"), util$b = require("node:util"), require$$0$6 = require("os"), require$$0$a = 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$$5$1 = require("assert"), require$$3$1 = require("events"), require$$6$1 = require("http"), semver$2 = require("semver"), pkgDir = require("pkg-dir"), client$1 = require("@sanity/client"), require$$3$2 = require("crypto"), require$$0$b = require("child_process"), require$$0$c = require("fs/promises"), fs$s = require("@sanity/util/fs"), decompress = require("decompress"), validateNpmPackageName = require("validate-npm-package-name"), getCliConfig = require("./getCliConfig.js"), require$$0$d = require("buffer"), silverFleece = require("silver-fleece"), journeyConfig = require("./journeyConfig.js"), http$1 = require("node:http"), traverse = require("@babel/traverse"), process$2 = require("node:process"), require$$2$2 = require("readline"), require$$0$e = require("tty");
2
+ var fs$r = require("node:fs"), os$6 = require("node:os"), path$t = require("node:path"), chalk$2 = require("chalk"), loadEnv = require("./loadEnv.js"), require$$0$4 = require("path"), require$$1$2 = require("module"), require$$0$5 = require("fs"), telemetry = require("@sanity/telemetry"), childProcess$2 = require("node:child_process"), fs$q = require("node:fs/promises"), util$b = require("node:util"), require$$0$6 = require("os"), require$$0$a = 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$$5$1 = require("assert"), require$$3$1 = require("events"), require$$6$1 = require("http"), semver$2 = require("semver"), pkgDir = require("pkg-dir"), client$1 = require("@sanity/client"), require$$3$2 = require("crypto"), require$$0$b = require("child_process"), require$$0$c = require("fs/promises"), fs$s = require("@sanity/util/fs"), decompress = require("decompress"), validateNpmPackageName = require("validate-npm-package-name"), getCliConfig = require("./getCliConfig.js"), require$$0$d = require("buffer"), silverFleece = require("silver-fleece"), journeyConfig = require("./journeyConfig.js"), http$1 = require("node:http"), traverse = require("@babel/traverse"), process$2 = require("node:process"), require$$2$2 = require("readline"), require$$0$e = require("tty");
3
3
  function _interopDefaultCompat(e) {
4
4
  return e && typeof e == "object" && "default" in e ? e : { default: e };
5
5
  }
@@ -33240,6 +33240,17 @@ function requireLib$1() {
33240
33240
  syntaxPlugin
33241
33241
  }) {
33242
33242
  const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
33243
+ {
33244
+ const oldReasonCodes = {
33245
+ AccessorCannotDeclareThisParameter: "AccesorCannotDeclareThisParameter",
33246
+ AccessorCannotHaveTypeParameters: "AccesorCannotHaveTypeParameters",
33247
+ ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",
33248
+ SetAccessorCannotHaveOptionalParameter: "SetAccesorCannotHaveOptionalParameter",
33249
+ SetAccessorCannotHaveRestParameter: "SetAccesorCannotHaveRestParameter",
33250
+ SetAccessorCannotHaveReturnType: "SetAccesorCannotHaveReturnType"
33251
+ };
33252
+ oldReasonCodes[reasonCode] && (reasonCode = oldReasonCodes[reasonCode]);
33253
+ }
33243
33254
  return function constructor(loc, details) {
33244
33255
  const error2 = new SyntaxError();
33245
33256
  return error2.code = code2, error2.reasonCode = reasonCode, error2.loc = loc, error2.pos = loc.index, error2.syntaxPlugin = syntaxPlugin, hasMissingPlugin && (error2.missingPlugin = details.missingPlugin), defineHidden(error2, "clone", function(overrides = {}) {
@@ -38029,12 +38040,12 @@ function requireLib$1() {
38029
38040
  AbstractPropertyHasInitializer: ({
38030
38041
  propertyName
38031
38042
  }) => `Property '${propertyName}' cannot have an initializer because it is marked abstract.`,
38032
- AccesorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
38033
- AccesorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
38034
38043
  AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
38044
+ AccessorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
38045
+ AccessorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
38035
38046
  ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
38036
38047
  ClassMethodHasReadonly: "Class methods cannot have the 'readonly' modifier.",
38037
- ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
38048
+ ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
38038
38049
  ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
38039
38050
  DeclareAccessor: ({
38040
38051
  kind
@@ -38093,9 +38104,9 @@ function requireLib$1() {
38093
38104
  ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
38094
38105
  ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
38095
38106
  ReservedTypeAssertion: "This syntax is reserved in files with the .mts or .cts extension. Use an `as` expression instead.",
38096
- SetAccesorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
38097
- SetAccesorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
38098
- SetAccesorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
38107
+ SetAccessorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
38108
+ SetAccessorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
38109
+ SetAccessorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
38099
38110
  SingleTypeParameterWithoutTrailingComma: ({
38100
38111
  typeParameterName
38101
38112
  }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
@@ -38170,10 +38181,13 @@ function requireLib$1() {
38170
38181
  return tokenIsIdentifier(this.state.type);
38171
38182
  }
38172
38183
  tsTokenCanFollowModifier() {
38173
- return (this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(138) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
38184
+ return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(138) || this.isLiteralPropertyName();
38185
+ }
38186
+ tsNextTokenOnSameLineAndCanFollowModifier() {
38187
+ return this.next(), this.hasPrecedingLineBreak() ? !1 : this.tsTokenCanFollowModifier();
38174
38188
  }
38175
38189
  tsNextTokenCanFollowModifier() {
38176
- return this.next(), this.tsTokenCanFollowModifier();
38190
+ return this.match(106) ? (this.next(), this.tsTokenCanFollowModifier()) : this.tsNextTokenOnSameLineAndCanFollowModifier();
38177
38191
  }
38178
38192
  tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
38179
38193
  if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58 && this.state.type !== 75)
@@ -38348,18 +38362,18 @@ function requireLib$1() {
38348
38362
  if (this.match(10) || this.match(47)) {
38349
38363
  readonly && this.raise(TSErrors.ReadonlyForMethodSignature, node);
38350
38364
  const method = nodeAny;
38351
- method.kind && this.match(47) && this.raise(TSErrors.AccesorCannotHaveTypeParameters, this.state.curPosition()), this.tsFillSignature(14, method), this.tsParseTypeMemberSemicolon();
38365
+ method.kind && this.match(47) && this.raise(TSErrors.AccessorCannotHaveTypeParameters, this.state.curPosition()), this.tsFillSignature(14, method), this.tsParseTypeMemberSemicolon();
38352
38366
  const paramsKey = "parameters", returnTypeKey = "typeAnnotation";
38353
38367
  if (method.kind === "get")
38354
- method[paramsKey].length > 0 && (this.raise(Errors.BadGetterArity, this.state.curPosition()), this.isThisParam(method[paramsKey][0]) && this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition()));
38368
+ method[paramsKey].length > 0 && (this.raise(Errors.BadGetterArity, this.state.curPosition()), this.isThisParam(method[paramsKey][0]) && this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition()));
38355
38369
  else if (method.kind === "set") {
38356
38370
  if (method[paramsKey].length !== 1)
38357
38371
  this.raise(Errors.BadSetterArity, this.state.curPosition());
38358
38372
  else {
38359
38373
  const firstParameter = method[paramsKey][0];
38360
- this.isThisParam(firstParameter) && this.raise(TSErrors.AccesorCannotDeclareThisParameter, this.state.curPosition()), firstParameter.type === "Identifier" && firstParameter.optional && this.raise(TSErrors.SetAccesorCannotHaveOptionalParameter, this.state.curPosition()), firstParameter.type === "RestElement" && this.raise(TSErrors.SetAccesorCannotHaveRestParameter, this.state.curPosition());
38374
+ this.isThisParam(firstParameter) && this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition()), firstParameter.type === "Identifier" && firstParameter.optional && this.raise(TSErrors.SetAccessorCannotHaveOptionalParameter, this.state.curPosition()), firstParameter.type === "RestElement" && this.raise(TSErrors.SetAccessorCannotHaveRestParameter, this.state.curPosition());
38361
38375
  }
38362
- method[returnTypeKey] && this.raise(TSErrors.SetAccesorCannotHaveReturnType, method[returnTypeKey]);
38376
+ method[returnTypeKey] && this.raise(TSErrors.SetAccessorCannotHaveReturnType, method[returnTypeKey]);
38363
38377
  } else
38364
38378
  method.kind = "method";
38365
38379
  return this.finishNode(method, "TSMethodSignature");
@@ -38397,13 +38411,14 @@ function requireLib$1() {
38397
38411
  tsIsStartOfMappedType() {
38398
38412
  return this.next(), this.eat(53) ? this.isContextual(122) : (this.isContextual(122) && this.next(), !this.match(0) || (this.next(), !this.tsIsIdentifier()) ? !1 : (this.next(), this.match(58)));
38399
38413
  }
38400
- tsParseMappedTypeParameter() {
38401
- const node = this.startNode();
38402
- return node.name = this.tsParseTypeParameterName(), node.constraint = this.tsExpectThenParseType(58), this.finishNode(node, "TSTypeParameter");
38403
- }
38404
38414
  tsParseMappedType() {
38405
38415
  const node = this.startNode();
38406
- return this.expect(5), this.match(53) ? (node.readonly = this.state.value, this.next(), this.expectContextual(122)) : this.eatContextual(122) && (node.readonly = !0), this.expect(0), node.typeParameter = this.tsParseMappedTypeParameter(), node.nameType = this.eatContextual(93) ? this.tsParseType() : null, this.expect(3), this.match(53) ? (node.optional = this.state.value, this.next(), this.expect(17)) : this.eat(17) && (node.optional = !0), node.typeAnnotation = this.tsTryParseType(), this.semicolon(), this.expect(8), this.finishNode(node, "TSMappedType");
38416
+ this.expect(5), this.match(53) ? (node.readonly = this.state.value, this.next(), this.expectContextual(122)) : this.eatContextual(122) && (node.readonly = !0), this.expect(0);
38417
+ {
38418
+ const typeParameter = this.startNode();
38419
+ typeParameter.name = this.tsParseTypeParameterName(), typeParameter.constraint = this.tsExpectThenParseType(58), node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
38420
+ }
38421
+ return node.nameType = this.eatContextual(93) ? this.tsParseType() : null, this.expect(3), this.match(53) ? (node.optional = this.state.value, this.next(), this.expect(17)) : this.eat(17) && (node.optional = !0), node.typeAnnotation = this.tsTryParseType(), this.semicolon(), this.expect(8), this.finishNode(node, "TSMappedType");
38407
38422
  }
38408
38423
  tsParseTupleType() {
38409
38424
  const node = this.startNode();
@@ -39081,7 +39096,7 @@ function requireLib$1() {
39081
39096
  id,
39082
39097
  init
39083
39098
  } of declaration.declarations)
39084
- init && (kind !== "const" || id.typeAnnotation ? this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init) : isValidAmbientConstInitializer(init, this.hasPlugin("estree")) || this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, init));
39099
+ init && (kind !== "const" || id.typeAnnotation ? this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init) : isValidAmbientConstInitializer(init, this.hasPlugin("estree")) || this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init));
39085
39100
  return declaration;
39086
39101
  }
39087
39102
  parseStatementContent(flags, decorators) {
@@ -44409,13 +44424,21 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
44409
44424
  projectName: displayName || answers.projectName
44410
44425
  }
44411
44426
  }, shouldImport = !unattended && template.datasetUrl && await promptForDatasetImport(template.importPrompt);
44412
- trace.log({ step: "importTemplateDataset", selectedOption: shouldImport ? "yes" : "no" }), await bootstrapTemplate(templateOptions, context), apiClient({ api: { projectId } }).request({ uri: `/projects/${projectId}` }).then((project) => project?.metadata?.cliInitializedAt ? Promise.resolve() : apiClient({ api: { projectId } }).request({
44413
- method: "PATCH",
44414
- uri: `/projects/${projectId}`,
44415
- body: { metadata: { cliInitializedAt: (/* @__PURE__ */ new Date()).toISOString() } }
44416
- })).catch(() => {
44417
- loadEnv.debug("Failed to update cliInitializedAt metadata");
44418
- });
44427
+ trace.log({ step: "importTemplateDataset", selectedOption: shouldImport ? "yes" : "no" });
44428
+ const [_2, bootstrapPromise] = await Promise.allSettled([
44429
+ // record template files attempted to be created locally
44430
+ apiClient({ api: { projectId } }).request({ uri: `/projects/${projectId}` }).then((project) => project?.metadata?.cliInitializedAt ? Promise.resolve() : apiClient({ api: { projectId } }).request({
44431
+ method: "PATCH",
44432
+ uri: `/projects/${projectId}`,
44433
+ body: { metadata: { cliInitializedAt: (/* @__PURE__ */ new Date()).toISOString() } }
44434
+ })).catch(() => {
44435
+ loadEnv.debug("Failed to update cliInitializedAt metadata");
44436
+ }),
44437
+ // Bootstrap Sanity, creating required project files, manifests etc
44438
+ bootstrapTemplate(templateOptions, context)
44439
+ ]);
44440
+ if (bootstrapPromise.status === "rejected" && bootstrapPromise.reason instanceof Error)
44441
+ throw bootstrapPromise.reason;
44419
44442
  let pkgManager;
44420
44443
  if (packageManager && ALLOWED_PACKAGE_MANAGERS.includes(packageManager) ? pkgManager = packageManager : (pkgManager = (await getPackageManagerChoice(outputPath, {
44421
44444
  prompt: prompt2,
@@ -45080,9 +45103,9 @@ Examples
45080
45103
  requireUser: !0,
45081
45104
  requireProject: !1
45082
45105
  }).projects.list(), ordered = lodashExports.sortBy(
45083
- projects.map(({ displayName, id, members = [], studioHost = "", createdAt }) => {
45084
- const studio = studioHost ? `https://${studioHost}.sanity.studio` : "Not deployed";
45085
- return [id, members.length, displayName, studio, createdAt].map(String);
45106
+ projects.map(({ displayName, id, members = [], createdAt }) => {
45107
+ const manage = `https://www.sanity.io/manage/project/${id}`;
45108
+ return [id, members.length, displayName, manage, createdAt].map(String);
45086
45109
  }),
45087
45110
  [headings.indexOf(flags.sort)]
45088
45111
  ), rows = flags.order === "asc" ? ordered : ordered.reverse(), maxWidths = rows.reduce(
@@ -70290,7 +70313,6 @@ async function runCli(cliRoot, { cliVersion }) {
70290
70313
  Promise.race([wait(2e3), flushTelemetry()])
70291
70314
  )
70292
70315
  ), telemetry2.updateUserProperties({
70293
- deviceId: await nodeMachineId.machineId(),
70294
70316
  runtimeVersion: process.version,
70295
70317
  runtime: detectRuntime(),
70296
70318
  cliVersion: pkg.version,