@sanity/cli 3.57.2-canary.16 → 3.57.2-manifests.69

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
  }
@@ -7275,6 +7275,7 @@ const commonMistakes = { get: "list" }, levenThreshold = 3, coreCommands = [
7275
7275
  "graphql",
7276
7276
  "hook",
7277
7277
  "migration",
7278
+ "manifest",
7278
7279
  "preview",
7279
7280
  "schema",
7280
7281
  "start",
@@ -33240,6 +33241,17 @@ function requireLib$1() {
33240
33241
  syntaxPlugin
33241
33242
  }) {
33242
33243
  const hasMissingPlugin = reasonCode === "MissingPlugin" || reasonCode === "MissingOneOfPlugins";
33244
+ {
33245
+ const oldReasonCodes = {
33246
+ AccessorCannotDeclareThisParameter: "AccesorCannotDeclareThisParameter",
33247
+ AccessorCannotHaveTypeParameters: "AccesorCannotHaveTypeParameters",
33248
+ ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference",
33249
+ SetAccessorCannotHaveOptionalParameter: "SetAccesorCannotHaveOptionalParameter",
33250
+ SetAccessorCannotHaveRestParameter: "SetAccesorCannotHaveRestParameter",
33251
+ SetAccessorCannotHaveReturnType: "SetAccesorCannotHaveReturnType"
33252
+ };
33253
+ oldReasonCodes[reasonCode] && (reasonCode = oldReasonCodes[reasonCode]);
33254
+ }
33243
33255
  return function constructor(loc, details) {
33244
33256
  const error2 = new SyntaxError();
33245
33257
  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 +38041,12 @@ function requireLib$1() {
38029
38041
  AbstractPropertyHasInitializer: ({
38030
38042
  propertyName
38031
38043
  }) => `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
38044
  AccessorCannotBeOptional: "An 'accessor' property cannot be declared optional.",
38045
+ AccessorCannotDeclareThisParameter: "'get' and 'set' accessors cannot declare 'this' parameters.",
38046
+ AccessorCannotHaveTypeParameters: "An accessor cannot have type parameters.",
38035
38047
  ClassMethodHasDeclare: "Class methods cannot have the 'declare' modifier.",
38036
38048
  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.",
38049
+ ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference: "A 'const' initializer in an ambient context must be a string or numeric literal or literal enum reference.",
38038
38050
  ConstructorHasTypeParameters: "Type parameters cannot appear on a constructor declaration.",
38039
38051
  DeclareAccessor: ({
38040
38052
  kind
@@ -38093,9 +38105,9 @@ function requireLib$1() {
38093
38105
  ReadonlyForMethodSignature: "'readonly' modifier can only appear on a property declaration or index signature.",
38094
38106
  ReservedArrowTypeParam: "This syntax is reserved in files with the .mts or .cts extension. Add a trailing comma, as in `<T,>() => ...`.",
38095
38107
  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.",
38108
+ SetAccessorCannotHaveOptionalParameter: "A 'set' accessor cannot have an optional parameter.",
38109
+ SetAccessorCannotHaveRestParameter: "A 'set' accessor cannot have rest parameter.",
38110
+ SetAccessorCannotHaveReturnType: "A 'set' accessor cannot have a return type annotation.",
38099
38111
  SingleTypeParameterWithoutTrailingComma: ({
38100
38112
  typeParameterName
38101
38113
  }) => `Single type parameter ${typeParameterName} should have a trailing comma. Example usage: <${typeParameterName},>.`,
@@ -38170,10 +38182,13 @@ function requireLib$1() {
38170
38182
  return tokenIsIdentifier(this.state.type);
38171
38183
  }
38172
38184
  tsTokenCanFollowModifier() {
38173
- return (this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(138) || this.isLiteralPropertyName()) && !this.hasPrecedingLineBreak();
38185
+ return this.match(0) || this.match(5) || this.match(55) || this.match(21) || this.match(138) || this.isLiteralPropertyName();
38186
+ }
38187
+ tsNextTokenOnSameLineAndCanFollowModifier() {
38188
+ return this.next(), this.hasPrecedingLineBreak() ? !1 : this.tsTokenCanFollowModifier();
38174
38189
  }
38175
38190
  tsNextTokenCanFollowModifier() {
38176
- return this.next(), this.tsTokenCanFollowModifier();
38191
+ return this.match(106) ? (this.next(), this.tsTokenCanFollowModifier()) : this.tsNextTokenOnSameLineAndCanFollowModifier();
38177
38192
  }
38178
38193
  tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
38179
38194
  if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58 && this.state.type !== 75)
@@ -38348,18 +38363,18 @@ function requireLib$1() {
38348
38363
  if (this.match(10) || this.match(47)) {
38349
38364
  readonly && this.raise(TSErrors.ReadonlyForMethodSignature, node);
38350
38365
  const method = nodeAny;
38351
- method.kind && this.match(47) && this.raise(TSErrors.AccesorCannotHaveTypeParameters, this.state.curPosition()), this.tsFillSignature(14, method), this.tsParseTypeMemberSemicolon();
38366
+ method.kind && this.match(47) && this.raise(TSErrors.AccessorCannotHaveTypeParameters, this.state.curPosition()), this.tsFillSignature(14, method), this.tsParseTypeMemberSemicolon();
38352
38367
  const paramsKey = "parameters", returnTypeKey = "typeAnnotation";
38353
38368
  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()));
38369
+ method[paramsKey].length > 0 && (this.raise(Errors.BadGetterArity, this.state.curPosition()), this.isThisParam(method[paramsKey][0]) && this.raise(TSErrors.AccessorCannotDeclareThisParameter, this.state.curPosition()));
38355
38370
  else if (method.kind === "set") {
38356
38371
  if (method[paramsKey].length !== 1)
38357
38372
  this.raise(Errors.BadSetterArity, this.state.curPosition());
38358
38373
  else {
38359
38374
  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());
38375
+ 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
38376
  }
38362
- method[returnTypeKey] && this.raise(TSErrors.SetAccesorCannotHaveReturnType, method[returnTypeKey]);
38377
+ method[returnTypeKey] && this.raise(TSErrors.SetAccessorCannotHaveReturnType, method[returnTypeKey]);
38363
38378
  } else
38364
38379
  method.kind = "method";
38365
38380
  return this.finishNode(method, "TSMethodSignature");
@@ -38397,13 +38412,14 @@ function requireLib$1() {
38397
38412
  tsIsStartOfMappedType() {
38398
38413
  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
38414
  }
38400
- tsParseMappedTypeParameter() {
38401
- const node = this.startNode();
38402
- return node.name = this.tsParseTypeParameterName(), node.constraint = this.tsExpectThenParseType(58), this.finishNode(node, "TSTypeParameter");
38403
- }
38404
38415
  tsParseMappedType() {
38405
38416
  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");
38417
+ 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);
38418
+ {
38419
+ const typeParameter = this.startNode();
38420
+ typeParameter.name = this.tsParseTypeParameterName(), typeParameter.constraint = this.tsExpectThenParseType(58), node.typeParameter = this.finishNode(typeParameter, "TSTypeParameter");
38421
+ }
38422
+ 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
38423
  }
38408
38424
  tsParseTupleType() {
38409
38425
  const node = this.startNode();
@@ -39081,7 +39097,7 @@ function requireLib$1() {
39081
39097
  id,
39082
39098
  init
39083
39099
  } of declaration.declarations)
39084
- init && (kind !== "const" || id.typeAnnotation ? this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init) : isValidAmbientConstInitializer(init, this.hasPlugin("estree")) || this.raise(TSErrors.ConstInitiailizerMustBeStringOrNumericLiteralOrLiteralEnumReference, init));
39100
+ init && (kind !== "const" || id.typeAnnotation ? this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init) : isValidAmbientConstInitializer(init, this.hasPlugin("estree")) || this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init));
39085
39101
  return declaration;
39086
39102
  }
39087
39103
  parseStatementContent(flags, decorators) {
@@ -42019,7 +42035,12 @@ export default defineCliConfig({
42019
42035
  api: {
42020
42036
  projectId: '%projectId%',
42021
42037
  dataset: '%dataset%'
42022
- }
42038
+ },
42039
+ /**
42040
+ * Enable auto-updates for studios.
42041
+ * Learn more at https://www.sanity.io/docs/cli#auto-updates
42042
+ */
42043
+ autoUpdates: __BOOL__autoUpdates__,
42023
42044
  })
42024
42045
  `;
42025
42046
  function createCliConfig(options2) {
@@ -42033,7 +42054,24 @@ function createCliConfig(options2) {
42033
42054
  const variableName = value.slice(1, -1);
42034
42055
  if (!(variableName in variables))
42035
42056
  throw new Error(`Template variable '${value}' not defined`);
42036
- node.value = variables[variableName] || "";
42057
+ const newValue = variables[variableName];
42058
+ node.value = typeof newValue == "string" ? newValue : "";
42059
+ }
42060
+ },
42061
+ Identifier: {
42062
+ enter(path2) {
42063
+ if (!path2.node.name.startsWith("__BOOL__"))
42064
+ return;
42065
+ const variableName = path2.node.name.replace(
42066
+ /^__BOOL__(.+?)__$/,
42067
+ "$1"
42068
+ );
42069
+ if (!(variableName in variables))
42070
+ throw new Error(`Template variable '${variableName}' not defined`);
42071
+ const value = variables[variableName];
42072
+ if (typeof value != "boolean")
42073
+ throw new Error(`Expected boolean value for '${variableName}'`);
42074
+ path2.replaceWith({ type: "BooleanLiteral", value });
42037
42075
  }
42038
42076
  }
42039
42077
  }), main$3.print(ast, { quote: "single" }).code;
@@ -42172,7 +42210,8 @@ function createStudioConfig(options2) {
42172
42210
  const variableName = value.slice(1, -1);
42173
42211
  if (!(variableName in variables))
42174
42212
  throw new Error(`Template variable '${value}' not defined`);
42175
- node.value = variables[variableName] || "";
42213
+ const newValue = variables[variableName];
42214
+ node.value = typeof newValue == "string" ? newValue : "";
42176
42215
  }
42177
42216
  }
42178
42217
  }), main$3.print(ast, { quote: "single" }).code;
@@ -42406,7 +42445,8 @@ async function bootstrapTemplate(opts, context) {
42406
42445
  variables
42407
42446
  }), cliConfig = await createCliConfig({
42408
42447
  projectId: variables.projectId,
42409
- dataset: variables.dataset
42448
+ dataset: variables.dataset,
42449
+ autoUpdates: variables.autoUpdates
42410
42450
  }), codeExt = useTypeScript ? "ts" : "js";
42411
42451
  await Promise.all([
42412
42452
  writeFileIfNotExists(`sanity.config.${codeExt}`, studioConfig),
@@ -44370,6 +44410,8 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
44370
44410
  const typescriptOnly = template.typescriptOnly === !0;
44371
44411
  let useTypeScript = !0;
44372
44412
  !typescriptOnly && typeof cliFlags.typescript == "boolean" ? useTypeScript = cliFlags.typescript : !typescriptOnly && !unattended && (useTypeScript = await promptForTypeScript(prompt2), trace.log({ step: "useTypeScript", selectedOption: useTypeScript ? "yes" : "no" }));
44413
+ let autoUpdates = !0;
44414
+ typeof cliFlags["auto-updates"] == "boolean" && (autoUpdates = cliFlags["auto-updates"]);
44373
44415
  const templateOptions = {
44374
44416
  outputPath,
44375
44417
  packageName: sluggedName,
@@ -44377,6 +44419,7 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
44377
44419
  schemaUrl,
44378
44420
  useTypeScript,
44379
44421
  variables: {
44422
+ autoUpdates,
44380
44423
  dataset: datasetName,
44381
44424
  projectId,
44382
44425
  projectName: displayName || answers.projectName
@@ -44900,6 +44943,7 @@ Options
44900
44943
  --coupon <name> Optionally select a coupon for a new project (cannot be used with --project-plan)
44901
44944
  --no-typescript Do not use TypeScript for template files
44902
44945
  --package-manager <name> Specify which package manager to use [allowed: ${allowedPackageManagersString}]
44946
+ --no-auto-updates Disable auto updates of studio versions
44903
44947
 
44904
44948
  Examples
44905
44949
  # Initialize a new project, prompt for required information along the way
@@ -70262,7 +70306,6 @@ async function runCli(cliRoot, { cliVersion }) {
70262
70306
  Promise.race([wait(2e3), flushTelemetry()])
70263
70307
  )
70264
70308
  ), telemetry2.updateUserProperties({
70265
- deviceId: await nodeMachineId.machineId(),
70266
70309
  runtimeVersion: process.version,
70267
70310
  runtime: detectRuntime(),
70268
70311
  cliVersion: pkg.version,