@sanity/cli 3.96.1-next.0.e71a6cc27e → 3.96.1-next.10.d11da65361

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.
@@ -3767,7 +3767,7 @@ function print() { __p += __j.call(arguments, '') }
3767
3767
  }(lodash$1, lodash$1.exports)), lodash$1.exports;
3768
3768
  }
3769
3769
  var lodashExports = requireLodash();
3770
- const helpText$m = `
3770
+ const helpText$n = `
3771
3771
  Arguments
3772
3772
  <type> Type of Resource to add (currently only 'function' is supported)
3773
3773
 
@@ -3809,7 +3809,7 @@ Examples:
3809
3809
  }, addBlueprintsCommand = {
3810
3810
  name: "add",
3811
3811
  group: "blueprints",
3812
- helpText: helpText$m,
3812
+ helpText: helpText$n,
3813
3813
  signature: "<type> [--name <name>] [--fn-type <document-publish>] [--fn-lang <ts|js>] [--javascript]",
3814
3814
  description: "Add a Resource to a Blueprint",
3815
3815
  async action(args, context) {
@@ -3870,7 +3870,7 @@ Examples:
3870
3870
  signature: "[COMMAND]",
3871
3871
  isGroupRoot: !0,
3872
3872
  description: "Deploy and manage Sanity Blueprints and Stacks (IaC)"
3873
- }, helpText$l = `
3873
+ }, helpText$m = `
3874
3874
  Options
3875
3875
  --edit, -e Edit the configuration
3876
3876
  --test, -t Test the configuration
@@ -3893,7 +3893,7 @@ Examples:
3893
3893
  }, configBlueprintsCommand = {
3894
3894
  name: "config",
3895
3895
  group: "blueprints",
3896
- helpText: helpText$l,
3896
+ helpText: helpText$m,
3897
3897
  signature: "[--edit] [-e] [--test] [-t] [--project-id <id>]",
3898
3898
  description: "View or edit local Blueprints configuration",
3899
3899
  async action(args, context) {
@@ -3920,7 +3920,7 @@ Examples:
3920
3920
  });
3921
3921
  if (!success) throw new Error(error2);
3922
3922
  }
3923
- }, helpText$k = `
3923
+ }, helpText$l = `
3924
3924
  Options
3925
3925
  --no-wait Do not wait for deployment to complete
3926
3926
 
@@ -3935,7 +3935,7 @@ Examples:
3935
3935
  }, deployBlueprintsCommand = {
3936
3936
  name: "deploy",
3937
3937
  group: "blueprints",
3938
- helpText: helpText$k,
3938
+ helpText: helpText$l,
3939
3939
  signature: "[--no-wait]",
3940
3940
  description: "Deploy a Blueprint to create or update a Stack",
3941
3941
  async action(args, context) {
@@ -3958,7 +3958,7 @@ Examples:
3958
3958
  });
3959
3959
  if (!success) throw new Error(error2);
3960
3960
  }
3961
- }, helpText$j = `
3961
+ }, helpText$k = `
3962
3962
  Options
3963
3963
  --force, -f Force destroy without confirmation
3964
3964
  --no-wait Do not wait for destroy to complete
@@ -3977,7 +3977,7 @@ Examples:
3977
3977
  }, destroyBlueprintsCommand = {
3978
3978
  name: "destroy",
3979
3979
  group: "blueprints",
3980
- helpText: helpText$j,
3980
+ helpText: helpText$k,
3981
3981
  signature: "[--force] [-f] [--no-wait]",
3982
3982
  description: "Destroy a Blueprint deployment",
3983
3983
  async action(args, context) {
@@ -4003,7 +4003,7 @@ Examples:
4003
4003
  });
4004
4004
  if (!success) throw new Error(error2);
4005
4005
  }
4006
- }, helpText$i = `
4006
+ }, helpText$j = `
4007
4007
  Examples:
4008
4008
  # Retrieve information about the current Stack
4009
4009
  sanity blueprints info
@@ -4012,7 +4012,7 @@ Examples:
4012
4012
  }, infoBlueprintsCommand = {
4013
4013
  name: "info",
4014
4014
  group: "blueprints",
4015
- helpText: helpText$i,
4015
+ helpText: helpText$j,
4016
4016
  signature: "",
4017
4017
  description: "Retrieve information about a Blueprint Stack",
4018
4018
  async action(args, context) {
@@ -4033,7 +4033,7 @@ Examples:
4033
4033
  });
4034
4034
  if (!success) throw new Error(error2);
4035
4035
  }
4036
- }, helpText$h = `
4036
+ }, helpText$i = `
4037
4037
  Arguments
4038
4038
  [dir] Path to initialize the Blueprint in
4039
4039
 
@@ -4055,7 +4055,7 @@ Examples:
4055
4055
  }, initBlueprintsCommand = {
4056
4056
  name: "init",
4057
4057
  group: "blueprints",
4058
- helpText: helpText$h,
4058
+ helpText: helpText$i,
4059
4059
  signature: "[dir] [--blueprint-type <type>] [--project-id <id>]",
4060
4060
  description: "Initialize a new Blueprint manifest file",
4061
4061
  async action(args, context) {
@@ -4095,7 +4095,7 @@ Examples:
4095
4095
  });
4096
4096
  if (!success) throw new Error(error2);
4097
4097
  }
4098
- }, helpText$g = `
4098
+ }, helpText$h = `
4099
4099
  Options
4100
4100
  --watch, -w Watch for new logs (streaming mode)
4101
4101
 
@@ -4110,7 +4110,7 @@ Examples:
4110
4110
  }, logsBlueprintsCommand = {
4111
4111
  name: "logs",
4112
4112
  group: "blueprints",
4113
- helpText: helpText$g,
4113
+ helpText: helpText$h,
4114
4114
  signature: "[--watch] [-w]",
4115
4115
  description: "Display logs for the current Blueprint Stack",
4116
4116
  async action(args, context) {
@@ -4133,7 +4133,7 @@ Examples:
4133
4133
  });
4134
4134
  if (streaming && await streaming, !success) throw new Error(error2);
4135
4135
  }
4136
- }, helpText$f = `
4136
+ }, helpText$g = `
4137
4137
  Safe to run at any time. Will not modify any Resources.
4138
4138
 
4139
4139
  Examples:
@@ -4142,7 +4142,7 @@ Examples:
4142
4142
  `, planBlueprintsCommand = {
4143
4143
  name: "plan",
4144
4144
  group: "blueprints",
4145
- helpText: helpText$f,
4145
+ helpText: helpText$g,
4146
4146
  signature: "",
4147
4147
  description: "Enumerate Resources to be deployed",
4148
4148
  async action(args, context) {
@@ -4162,7 +4162,7 @@ Examples:
4162
4162
  });
4163
4163
  if (!success) throw new Error(error2);
4164
4164
  }
4165
- }, helpText$e = `
4165
+ }, helpText$f = `
4166
4166
  Options
4167
4167
  --project-id <id> Project ID to use
4168
4168
 
@@ -4177,7 +4177,7 @@ Examples:
4177
4177
  }, stacksBlueprintsCommand = {
4178
4178
  name: "stacks",
4179
4179
  group: "blueprints",
4180
- helpText: helpText$e,
4180
+ helpText: helpText$f,
4181
4181
  signature: "[--project-id <id>]",
4182
4182
  description: "List all Blueprint Stacks for the current Project",
4183
4183
  hideFromHelp: !0,
@@ -4345,7 +4345,7 @@ function ensureNpx() {
4345
4345
  );
4346
4346
  }
4347
4347
  }
4348
- const helpText$d = `
4348
+ const helpText$e = `
4349
4349
  Runs a given code modification script on the current studio folder.
4350
4350
  Running the command without a specified codemod name will list available transformations.
4351
4351
 
@@ -4367,7 +4367,7 @@ Examples
4367
4367
  name: "codemod",
4368
4368
  signature: "[CODEMOD_NAME]",
4369
4369
  description: "Updates Sanity Studio codebase with a code modification script",
4370
- helpText: helpText$d,
4370
+ helpText: helpText$e,
4371
4371
  action: codemodAction
4372
4372
  };
4373
4373
  var lodash_isplainobject, hasRequiredLodash_isplainobject;
@@ -7905,7 +7905,7 @@ const docsCommand = {
7905
7905
  const { output } = context, { print } = output, url = "https://www.sanity.io/docs";
7906
7906
  print(`Opening ${url}`), await open(url);
7907
7907
  }
7908
- }, helpText$c = `
7908
+ }, helpText$d = `
7909
7909
  Options
7910
7910
  --port <port> Port to start emulator on
7911
7911
  --open Open dev server in a new browser tab
@@ -7925,7 +7925,7 @@ Examples
7925
7925
  }, devFunctionsCommand = {
7926
7926
  name: "dev",
7927
7927
  group: "functions",
7928
- helpText: helpText$c,
7928
+ helpText: helpText$d,
7929
7929
  signature: "[--port <port> --open]",
7930
7930
  description: "Start the Sanity Function emulator",
7931
7931
  async action(args, context) {
@@ -7946,7 +7946,7 @@ Examples
7946
7946
  if (!success) throw new Error(error2);
7947
7947
  shouldOpen && open(`http://localhost:${flags.port}`);
7948
7948
  }
7949
- }, helpText$b = `
7949
+ }, helpText$c = `
7950
7950
  Commands
7951
7951
  add Add or update an environment variable
7952
7952
  list List the environment variables
@@ -7969,7 +7969,7 @@ Examples
7969
7969
  `, envFunctionsCommand = {
7970
7970
  name: "env",
7971
7971
  group: "functions",
7972
- helpText: helpText$b,
7972
+ helpText: helpText$c,
7973
7973
  signature: "<add|list|remove> <name> [key] [value]",
7974
7974
  description: "Add or remove an environment variable or list environment variables for a Sanity function",
7975
7975
  async action(args, context) {
@@ -8025,7 +8025,7 @@ Examples
8025
8025
  signature: "[COMMAND]",
8026
8026
  isGroupRoot: !0,
8027
8027
  description: "Manage, test, and observe Sanity Functions"
8028
- }, helpText$a = `
8028
+ }, helpText$b = `
8029
8029
  Arguments
8030
8030
  <name> The name of the Function to retrieve logs for
8031
8031
 
@@ -8062,7 +8062,7 @@ Examples
8062
8062
  }, logsFunctionsCommand = {
8063
8063
  name: "logs",
8064
8064
  group: "functions",
8065
- helpText: helpText$a,
8065
+ helpText: helpText$b,
8066
8066
  signature: "<name> [--limit <number>] [--json] [--utc] [--delete [--force]] [--watch]",
8067
8067
  description: "Retrieve or delete logs for a Sanity Function",
8068
8068
  async action(args, context) {
@@ -8087,7 +8087,7 @@ Examples
8087
8087
  });
8088
8088
  if (!success) throw new Error(error2);
8089
8089
  }
8090
- }, helpText$9 = `
8090
+ }, helpText$a = `
8091
8091
  Arguments
8092
8092
  <name> The name of the Sanity Function
8093
8093
 
@@ -8098,6 +8098,7 @@ Options
8098
8098
  --api <version> Sanity API Version to use
8099
8099
  --dataset <dataset> The Sanity dataset to use
8100
8100
  --project-id <id> Sanity Project ID to use
8101
+ --with-user-token Prime access token from CLI config into getCliClient()
8101
8102
 
8102
8103
 
8103
8104
  Examples
@@ -8110,13 +8111,14 @@ Examples
8110
8111
  # Test function passing event data on command line and cap execution time to 60 seconds
8111
8112
  sanity functions test echo --data '{ "id": 1 }' --timeout 60
8112
8113
  `, defaultFlags$1 = {
8113
- timeout: 10
8114
+ timeout: 10,
8114
8115
  // seconds
8116
+ "with-user-token": !1
8115
8117
  }, testFunctionsCommand = {
8116
8118
  name: "test",
8117
8119
  group: "functions",
8118
- helpText: helpText$9,
8119
- signature: "<name> [--data <json>] [--file <filename>] [--timeout <seconds>] [--api <version>] [--dataset <name>] [--project-id] <id>]",
8120
+ helpText: helpText$a,
8121
+ signature: "<name> [--data <json>] [--file <filename>] [--timeout <seconds>] [--api <version>] [--dataset <name>] [--project-id] <id>] [--with-user-token]",
8120
8122
  description: "Invoke a local Sanity Function",
8121
8123
  async action(args, context) {
8122
8124
  const { apiClient, output } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$1, ...args.extOptions }, client2 = apiClient({
@@ -8141,7 +8143,8 @@ Examples
8141
8143
  timeout: flags.timeout,
8142
8144
  api: flags.api,
8143
8145
  dataset: flags.dataset || actualDataset,
8144
- "project-id": flags["project-id"] || projectId
8146
+ "project-id": flags["project-id"] || projectId,
8147
+ "with-user-token": flags["with-user-token"]
8145
8148
  }
8146
8149
  });
8147
8150
  if (!success) throw new Error(error2);
@@ -8195,11 +8198,11 @@ const commonMistakes = { get: "list" }, levenThreshold = 3, coreCommands = [
8195
8198
  "undeploy",
8196
8199
  "uninstall",
8197
8200
  "users"
8198
- ], discouragedCommands = ["upgrade", "check", "configcheck", "uninstall"], helpText$8 = `
8201
+ ], discouragedCommands = ["upgrade", "check", "configcheck", "uninstall"], helpText$9 = `
8199
8202
  Run the command again within a Sanity project directory, where "sanity"
8200
8203
  is installed as a dependency.`;
8201
8204
  function getNoSuchCommandText(cmdName, parentGroupName, groups) {
8202
- return parentGroupName && groups && groups[parentGroupName] ? suggestCommand(cmdName, groups[parentGroupName], parentGroupName) : coreCommands.includes(cmdName) ? `Command "${cmdName}" is not available outside of a Sanity project context.${helpText$8}` : suggestCommand(cmdName, groups ? groups.default : []);
8205
+ return parentGroupName && groups && groups[parentGroupName] ? suggestCommand(cmdName, groups[parentGroupName], parentGroupName) : coreCommands.includes(cmdName) ? `Command "${cmdName}" is not available outside of a Sanity project context.${helpText$9}` : suggestCommand(cmdName, groups ? groups.default : []);
8203
8206
  }
8204
8207
  function suggestCommand(cmdName, group, parentGroupName = null) {
8205
8208
  const closest = group.filter((command2) => !discouragedCommands.includes(command2.name)).map((command2) => leven(command2.name, cmdName)).reduce(
@@ -38209,6 +38212,7 @@ function requireLib$1() {
38209
38212
  IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
38210
38213
  InvalidBigIntLiteral: "Invalid BigIntLiteral.",
38211
38214
  InvalidCodePoint: "Code point out of bounds.",
38215
+ InvalidCoverDiscardElement: "'void' must be followed by an expression when not used in a binding position.",
38212
38216
  InvalidCoverInitializedName: "Invalid shorthand property initializer.",
38213
38217
  InvalidDecimal: "Invalid decimal.",
38214
38218
  InvalidDigit: ({
@@ -38326,6 +38330,7 @@ function requireLib$1() {
38326
38330
  }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
38327
38331
  UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
38328
38332
  UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
38333
+ UnexpectedVoidPattern: "Unexpected void binding.",
38329
38334
  UnsupportedBind: "Binding should be performed on object property.",
38330
38335
  UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
38331
38336
  UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
@@ -38346,6 +38351,8 @@ function requireLib$1() {
38346
38351
  VarRedeclaration: ({
38347
38352
  identifierName
38348
38353
  }) => `Identifier '${identifierName}' has already been declared.`,
38354
+ VoidPatternCatchClauseParam: "A void binding can not be the catch clause parameter. Use `try { ... } catch { ... }` if you want to discard the caught error.",
38355
+ VoidPatternInitializer: "A void binding may not have an initializer.",
38349
38356
  YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
38350
38357
  YieldInParameter: "Yield expression is not allowed in formal parameters.",
38351
38358
  YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
@@ -38501,6 +38508,14 @@ function requireLib$1() {
38501
38508
  opts.startIndex == null && options2.startColumn > 0 ? options2.startIndex = options2.startColumn : opts.startColumn == null && options2.startIndex > 0 && (options2.startColumn = options2.startIndex);
38502
38509
  else if ((opts.startColumn == null || opts.startIndex == null) && opts.startIndex != null)
38503
38510
  throw new Error("With a `startLine > 1` you must also specify `startIndex` and `startColumn`.");
38511
+ if (options2.sourceType === "commonjs") {
38512
+ if (opts.allowAwaitOutsideFunction != null)
38513
+ throw new Error("The `allowAwaitOutsideFunction` option cannot be used with `sourceType: 'commonjs'`.");
38514
+ if (opts.allowReturnOutsideFunction != null)
38515
+ throw new Error("`sourceType: 'commonjs'` implies `allowReturnOutsideFunction: true`, please remove the `allowReturnOutsideFunction` option or use `sourceType: 'script'`.");
38516
+ if (opts.allowNewTargetOutsideFunction != null)
38517
+ throw new Error("`sourceType: 'commonjs'` implies `allowNewTargetOutsideFunction: true`, please remove the `allowNewTargetOutsideFunction` option or use `sourceType: 'script'`.");
38518
+ }
38504
38519
  return options2;
38505
38520
  }
38506
38521
  const {
@@ -39157,7 +39172,7 @@ function requireLib$1() {
39157
39172
  startsExpr
39158
39173
  }),
39159
39174
  placeholder: createToken("%%", {
39160
- startsExpr: !0
39175
+ startsExpr
39161
39176
  }),
39162
39177
  string: createToken("string", {
39163
39178
  startsExpr
@@ -39180,10 +39195,10 @@ function requireLib$1() {
39180
39195
  eof: createToken("eof"),
39181
39196
  jsxName: createToken("jsxName"),
39182
39197
  jsxText: createToken("jsxText", {
39183
- beforeExpr: !0
39198
+ beforeExpr
39184
39199
  }),
39185
39200
  jsxTagStart: createToken("jsxTagStart", {
39186
- startsExpr: !0
39201
+ startsExpr
39187
39202
  }),
39188
39203
  jsxTagEnd: createToken("jsxTagEnd")
39189
39204
  };
@@ -39322,6 +39337,9 @@ function requireLib$1() {
39322
39337
  get allowDirectSuper() {
39323
39338
  return (this.currentThisScopeFlags() & 32) > 0;
39324
39339
  }
39340
+ get allowNewTarget() {
39341
+ return (this.currentThisScopeFlags() & 512) > 0;
39342
+ }
39325
39343
  get inClass() {
39326
39344
  return (this.currentThisScopeFlags() & 64) > 0;
39327
39345
  }
@@ -39336,7 +39354,7 @@ function requireLib$1() {
39336
39354
  } = this.scopeStack[i];
39337
39355
  if (flags & 128)
39338
39356
  return !0;
39339
- if (flags & 707)
39357
+ if (flags & 1731)
39340
39358
  return !1;
39341
39359
  }
39342
39360
  }
@@ -39368,7 +39386,7 @@ function requireLib$1() {
39368
39386
  let type2 = scope2.names.get(name) || 0;
39369
39387
  bindingType & 16 ? type2 = type2 | 4 : (scope2.firstLexicalName || (scope2.firstLexicalName = name), type2 = type2 | 2), scope2.names.set(name, type2), bindingType & 8 && this.maybeExportDefined(scope2, name);
39370
39388
  } else if (bindingType & 4)
39371
- for (let i = this.scopeStack.length - 1; i >= 0 && (scope2 = this.scopeStack[i], this.checkRedeclarationInScope(scope2, name, bindingType, loc), scope2.names.set(name, (scope2.names.get(name) || 0) | 1), this.maybeExportDefined(scope2, name), !(scope2.flags & 643)); --i)
39389
+ for (let i = this.scopeStack.length - 1; i >= 0 && (scope2 = this.scopeStack[i], this.checkRedeclarationInScope(scope2, name, bindingType, loc), scope2.names.set(name, (scope2.names.get(name) || 0) | 1), this.maybeExportDefined(scope2, name), !(scope2.flags & 1667)); --i)
39372
39390
  ;
39373
39391
  this.parser.inModule && scope2.flags & 1 && this.undefinedExports.delete(name);
39374
39392
  }
@@ -39401,7 +39419,7 @@ function requireLib$1() {
39401
39419
  const {
39402
39420
  flags
39403
39421
  } = this.scopeStack[i];
39404
- if (flags & 643)
39422
+ if (flags & 1667)
39405
39423
  return flags;
39406
39424
  }
39407
39425
  }
@@ -39410,7 +39428,7 @@ function requireLib$1() {
39410
39428
  const {
39411
39429
  flags
39412
39430
  } = this.scopeStack[i];
39413
- if (flags & 707 && !(flags & 4))
39431
+ if (flags & 1731 && !(flags & 4))
39414
39432
  return flags;
39415
39433
  }
39416
39434
  }
@@ -40179,7 +40197,7 @@ function requireLib$1() {
40179
40197
  }
40180
40198
  finishArrowValidation(node) {
40181
40199
  var _node$extra;
40182
- this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, !1), this.scope.enter(6), super.checkParams(node, !1, !0), this.scope.exit();
40200
+ this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, !1), this.scope.enter(518), super.checkParams(node, !1, !0), this.scope.exit();
40183
40201
  }
40184
40202
  forwardNoArrowParamsConversionAt(node, parse4) {
40185
40203
  let result;
@@ -40485,7 +40503,7 @@ function requireLib$1() {
40485
40503
  if (base2.type === "Identifier" && base2.name === "async" && this.state.noArrowAt.includes(startLoc.index)) {
40486
40504
  this.next();
40487
40505
  const node = this.startNodeAt(startLoc);
40488
- node.callee = base2, node.arguments = super.parseCallExpressionArguments(11), base2 = this.finishNode(node, "CallExpression");
40506
+ node.callee = base2, node.arguments = super.parseCallExpressionArguments(), base2 = this.finishNode(node, "CallExpression");
40489
40507
  } else if (base2.type === "Identifier" && base2.name === "async" && this.match(47)) {
40490
40508
  const state = this.state.clone(), arrow4 = this.tryParse((abort) => this.parseAsyncArrowWithTypeParameters(startLoc) || abort(), state);
40491
40509
  if (!arrow4.error && !arrow4.aborted) return arrow4.node;
@@ -40505,11 +40523,11 @@ function requireLib$1() {
40505
40523
  return subscriptState.stop = !0, base2;
40506
40524
  this.next();
40507
40525
  const node = this.startNodeAt(startLoc);
40508
- return node.callee = base2, node.typeArguments = this.flowParseTypeParameterInstantiationInExpression(), this.expect(10), node.arguments = this.parseCallExpressionArguments(11), node.optional = !0, this.finishCallExpression(node, !0);
40526
+ return node.callee = base2, node.typeArguments = this.flowParseTypeParameterInstantiationInExpression(), this.expect(10), node.arguments = this.parseCallExpressionArguments(), node.optional = !0, this.finishCallExpression(node, !0);
40509
40527
  } else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
40510
40528
  const node = this.startNodeAt(startLoc);
40511
40529
  node.callee = base2;
40512
- const result = this.tryParse(() => (node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(), this.expect(10), node.arguments = super.parseCallExpressionArguments(11), subscriptState.optionalChainMember && (node.optional = !1), this.finishCallExpression(node, subscriptState.optionalChainMember)));
40530
+ const result = this.tryParse(() => (node.typeArguments = this.flowParseTypeParameterInstantiationCallOrNew(), this.expect(10), node.arguments = super.parseCallExpressionArguments(), subscriptState.optionalChainMember && (node.optional = !1), this.finishCallExpression(node, subscriptState.optionalChainMember)));
40513
40531
  if (result.node)
40514
40532
  return result.error && (this.state = result.failState), result.node;
40515
40533
  }
@@ -41413,11 +41431,11 @@ function requireLib$1() {
41413
41431
  return this.importsStack.push(/* @__PURE__ */ new Set()), new TypeScriptScope(flags);
41414
41432
  }
41415
41433
  enter(flags) {
41416
- flags === 512 && this.importsStack.push(/* @__PURE__ */ new Set()), super.enter(flags);
41434
+ flags === 1024 && this.importsStack.push(/* @__PURE__ */ new Set()), super.enter(flags);
41417
41435
  }
41418
41436
  exit() {
41419
41437
  const flags = super.exit();
41420
- return flags === 512 && this.importsStack.pop(), flags;
41438
+ return flags === 1024 && this.importsStack.pop(), flags;
41421
41439
  }
41422
41440
  hasImport(name, allowShadow) {
41423
41441
  const len = this.importsStack.length;
@@ -42833,9 +42851,8 @@ function requireLib$1() {
42833
42851
  return this.state.type === token2 && !this.state.containsEsc;
42834
42852
  }
42835
42853
  isUnparsedContextual(nameStart, name) {
42836
- const nameEnd = nameStart + name.length;
42837
- if (this.input.slice(nameStart, nameEnd) === name) {
42838
- const nextCh = this.input.charCodeAt(nameEnd);
42854
+ if (this.input.startsWith(name, nameStart)) {
42855
+ const nextCh = this.input.charCodeAt(nameStart + name.length);
42839
42856
  return !(isIdentifierChar(nextCh) || (nextCh & 64512) === 55296);
42840
42857
  }
42841
42858
  return !1;
@@ -42924,11 +42941,12 @@ function requireLib$1() {
42924
42941
  shorthandAssignLoc,
42925
42942
  doubleProtoLoc,
42926
42943
  privateKeyLoc,
42927
- optionalParametersLoc
42928
- } = refExpressionErrors, hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc;
42944
+ optionalParametersLoc,
42945
+ voidPatternLoc
42946
+ } = refExpressionErrors, hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc || !!voidPatternLoc;
42929
42947
  if (!andThrow)
42930
42948
  return hasErrors;
42931
- shorthandAssignLoc != null && this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc), doubleProtoLoc != null && this.raise(Errors.DuplicateProto, doubleProtoLoc), privateKeyLoc != null && this.raise(Errors.UnexpectedPrivateField, privateKeyLoc), optionalParametersLoc != null && this.unexpected(optionalParametersLoc);
42949
+ shorthandAssignLoc != null && this.raise(Errors.InvalidCoverInitializedName, shorthandAssignLoc), doubleProtoLoc != null && this.raise(Errors.DuplicateProto, doubleProtoLoc), privateKeyLoc != null && this.raise(Errors.UnexpectedPrivateField, privateKeyLoc), optionalParametersLoc != null && this.unexpected(optionalParametersLoc), voidPatternLoc != null && this.raise(Errors.InvalidCoverDiscardElement, voidPatternLoc);
42932
42950
  }
42933
42951
  isLiteralPropertyName() {
42934
42952
  return tokenIsLiteralPropertyName(this.state.type);
@@ -42968,7 +42986,11 @@ function requireLib$1() {
42968
42986
  }
42969
42987
  enterInitialScopes() {
42970
42988
  let paramFlags = 0;
42971
- this.inModule && (paramFlags |= 2), this.optionFlags & 32 && (paramFlags |= 1), this.scope.enter(1), this.prodParam.enter(paramFlags);
42989
+ (this.inModule || this.optionFlags & 1) && (paramFlags |= 2), this.optionFlags & 32 && (paramFlags |= 1);
42990
+ const isCommonJS = !this.inModule && this.options.sourceType === "commonjs";
42991
+ (isCommonJS || this.optionFlags & 2) && (paramFlags |= 4), this.prodParam.enter(paramFlags);
42992
+ let scopeFlags = isCommonJS ? 514 : 1;
42993
+ this.optionFlags & 4 && (scopeFlags |= 512), this.scope.enter(scopeFlags);
42972
42994
  }
42973
42995
  checkDestructuringPrivate(refExpressionErrors) {
42974
42996
  const {
@@ -42979,7 +43001,7 @@ function requireLib$1() {
42979
43001
  }
42980
43002
  class ExpressionErrors {
42981
43003
  constructor() {
42982
- this.shorthandAssignLoc = null, this.doubleProtoLoc = null, this.privateKeyLoc = null, this.optionalParametersLoc = null;
43004
+ this.shorthandAssignLoc = null, this.doubleProtoLoc = null, this.privateKeyLoc = null, this.optionalParametersLoc = null, this.voidPatternLoc = null;
42983
43005
  }
42984
43006
  }
42985
43007
  class Node {
@@ -43059,6 +43081,7 @@ function requireLib$1() {
43059
43081
  case "ArrayPattern":
43060
43082
  case "AssignmentPattern":
43061
43083
  case "RestElement":
43084
+ case "VoidPattern":
43062
43085
  break;
43063
43086
  case "ObjectExpression":
43064
43087
  this.castNodeTo(node, "ObjectPattern");
@@ -43082,7 +43105,7 @@ function requireLib$1() {
43082
43105
  this.castNodeTo(node, "ArrayPattern"), this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingCommaLoc, isLHS);
43083
43106
  break;
43084
43107
  case "AssignmentExpression":
43085
- node.operator !== "=" && this.raise(Errors.MissingEqInAssignment, node.left.loc.end), this.castNodeTo(node, "AssignmentPattern"), delete node.operator, this.toAssignable(node.left, isLHS);
43108
+ node.operator !== "=" && this.raise(Errors.MissingEqInAssignment, node.left.loc.end), this.castNodeTo(node, "AssignmentPattern"), delete node.operator, node.left.type === "VoidPattern" && this.raise(Errors.VoidPatternInitializer, node.left), this.toAssignable(node.left, isLHS);
43086
43109
  break;
43087
43110
  case "ParenthesizedExpression":
43088
43111
  this.toAssignable(parenthesized, isLHS);
@@ -43122,6 +43145,7 @@ function requireLib$1() {
43122
43145
  case "ArrayPattern":
43123
43146
  case "AssignmentPattern":
43124
43147
  case "RestElement":
43148
+ case "VoidPattern":
43125
43149
  return !0;
43126
43150
  case "ObjectExpression": {
43127
43151
  const last2 = node.properties.length - 1;
@@ -43158,7 +43182,9 @@ function requireLib$1() {
43158
43182
  }
43159
43183
  parseRestBinding() {
43160
43184
  const node = this.startNode();
43161
- return this.next(), node.argument = this.parseBindingAtom(), this.finishNode(node, "RestElement");
43185
+ this.next();
43186
+ const argument = this.parseBindingAtom();
43187
+ return argument.type === "VoidPattern" && this.raise(Errors.UnexpectedVoidPattern, argument), node.argument = argument, this.finishNode(node, "RestElement");
43162
43188
  }
43163
43189
  parseBindingAtom() {
43164
43190
  switch (this.state.type) {
@@ -43168,6 +43194,8 @@ function requireLib$1() {
43168
43194
  }
43169
43195
  case 5:
43170
43196
  return this.parseObjectLike(8, !0);
43197
+ case 88:
43198
+ return this.parseVoidPattern(null);
43171
43199
  }
43172
43200
  return this.parseIdentifier();
43173
43201
  }
@@ -43197,7 +43225,7 @@ function requireLib$1() {
43197
43225
  return elts;
43198
43226
  }
43199
43227
  parseBindingRestProperty(prop) {
43200
- return this.next(), prop.argument = this.parseIdentifier(), this.checkCommaAfterRest(125), this.finishNode(prop, "RestElement");
43228
+ return this.next(), this.hasPlugin("discardBinding") && this.match(88) ? (prop.argument = this.parseVoidPattern(null), this.raise(Errors.UnexpectedVoidPattern, prop.argument)) : prop.argument = this.parseIdentifier(), this.checkCommaAfterRest(125), this.finishNode(prop, "RestElement");
43201
43229
  }
43202
43230
  parseBindingProperty() {
43203
43231
  const {
@@ -43219,7 +43247,7 @@ function requireLib$1() {
43219
43247
  parseMaybeDefault(startLoc, left) {
43220
43248
  if (startLoc ?? (startLoc = this.state.startLoc), left = left ?? this.parseBindingAtom(), !this.eat(29)) return left;
43221
43249
  const node = this.startNodeAt(startLoc);
43222
- return node.left = left, node.right = this.parseMaybeAssignAllowIn(), this.finishNode(node, "AssignmentPattern");
43250
+ return left.type === "VoidPattern" && this.raise(Errors.VoidPatternInitializer, left), node.left = left, node.right = this.parseMaybeAssignAllowIn(), this.finishNode(node, "AssignmentPattern");
43223
43251
  }
43224
43252
  isValidLVal(type2, isUnparenthesizedInAssign, binding) {
43225
43253
  switch (type2) {
@@ -43235,6 +43263,8 @@ function requireLib$1() {
43235
43263
  return "elements";
43236
43264
  case "ObjectPattern":
43237
43265
  return "properties";
43266
+ case "VoidPattern":
43267
+ return !0;
43238
43268
  }
43239
43269
  return !1;
43240
43270
  }
@@ -43259,7 +43289,7 @@ function requireLib$1() {
43259
43289
  } = expression;
43260
43290
  checkClashes && (checkClashes.has(name) ? this.raise(Errors.ParamDupe, expression) : checkClashes.add(name));
43261
43291
  return;
43262
- }
43292
+ } else type2 === "VoidPattern" && ancestor.type === "CatchClause" && this.raise(Errors.VoidPatternCatchClauseParam, expression);
43263
43293
  const validity = this.isValidLVal(type2, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
43264
43294
  if (validity === !0) return;
43265
43295
  if (validity === !1) {
@@ -43413,7 +43443,8 @@ function requireLib$1() {
43413
43443
  UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
43414
43444
  UnsupportedSignatureParameterKind: ({
43415
43445
  type: type2
43416
- }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type2}.`
43446
+ }) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type2}.`,
43447
+ UsingDeclarationInAmbientContext: (kind) => `'${kind}' declarations are not allowed in ambient contexts.`
43417
43448
  });
43418
43449
  function keywordTypeFromName(value) {
43419
43450
  switch (value) {
@@ -43992,7 +44023,7 @@ function requireLib$1() {
43992
44023
  return node.checkType = type2, node.extendsType = this.tsInDisallowConditionalTypesContext(() => this.tsParseNonConditionalType()), this.expect(17), node.trueType = this.tsInAllowConditionalTypesContext(() => this.tsParseType()), this.expect(14), node.falseType = this.tsInAllowConditionalTypesContext(() => this.tsParseType()), this.finishNode(node, "TSConditionalType");
43993
44024
  }
43994
44025
  isAbstractConstructorSignature() {
43995
- return this.isContextual(124) && this.lookahead().type === 77;
44026
+ return this.isContextual(124) && this.isLookaheadContextual("new");
43996
44027
  }
43997
44028
  tsParseNonConditionalType() {
43998
44029
  return this.tsIsStartOfFunctionType() ? this.tsParseFunctionOrConstructorType("TSFunctionType") : this.match(77) ? this.tsParseFunctionOrConstructorType("TSConstructorType") : this.isAbstractConstructorSignature() ? this.tsParseFunctionOrConstructorType("TSConstructorType", !0) : this.tsParseUnionTypeOrHigher();
@@ -44021,7 +44052,7 @@ function requireLib$1() {
44021
44052
  }
44022
44053
  tsParseTypeAliasDeclaration(node) {
44023
44054
  return node.id = this.parseIdentifier(), this.checkIdentifier(node.id, 2), node.typeAnnotation = this.tsInType(() => {
44024
- if (node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers), this.expect(29), this.isContextual(114) && this.lookahead().type !== 16) {
44055
+ if (node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers), this.expect(29), this.isContextual(114) && this.lookaheadCharCode() !== 46) {
44025
44056
  const node2 = this.startNode();
44026
44057
  return this.next(), this.finishNode(node2, "TSIntrinsicKeyword");
44027
44058
  }
@@ -44097,11 +44128,11 @@ function requireLib$1() {
44097
44128
  const inner = this.startNode();
44098
44129
  this.tsParseModuleOrNamespaceDeclaration(inner, !0), node.body = inner;
44099
44130
  } else
44100
- this.scope.enter(512), this.prodParam.enter(0), node.body = this.tsParseModuleBlock(), this.prodParam.exit(), this.scope.exit();
44131
+ this.scope.enter(1024), this.prodParam.enter(0), node.body = this.tsParseModuleBlock(), this.prodParam.exit(), this.scope.exit();
44101
44132
  return this.finishNode(node, "TSModuleDeclaration");
44102
44133
  }
44103
44134
  tsParseAmbientExternalModuleDeclaration(node) {
44104
- return this.isContextual(112) ? (node.kind = "global", node.global = !0, node.id = this.parseIdentifier()) : this.match(134) ? (node.kind = "module", node.id = super.parseStringLiteral(this.state.value)) : this.unexpected(), this.match(5) ? (this.scope.enter(512), this.prodParam.enter(0), node.body = this.tsParseModuleBlock(), this.prodParam.exit(), this.scope.exit()) : this.semicolon(), this.finishNode(node, "TSModuleDeclaration");
44135
+ return this.isContextual(112) ? (node.kind = "global", node.global = !0, node.id = this.parseIdentifier()) : this.match(134) ? (node.kind = "module", node.id = super.parseStringLiteral(this.state.value)) : this.unexpected(), this.match(5) ? (this.scope.enter(1024), this.prodParam.enter(0), node.body = this.tsParseModuleBlock(), this.prodParam.exit(), this.scope.exit()) : this.semicolon(), this.finishNode(node, "TSModuleDeclaration");
44105
44136
  }
44106
44137
  tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) {
44107
44138
  node.isExport = isExport || !1, node.id = maybeDefaultIdentifier || this.parseIdentifier(), this.checkIdentifier(node.id, 4096), this.expect(29);
@@ -44159,11 +44190,11 @@ function requireLib$1() {
44159
44190
  declare: !0
44160
44191
  }));
44161
44192
  case 107:
44162
- if (this.hasPlugin("explicitResourceManagement") && this.isUsing())
44193
+ if (this.isUsing())
44163
44194
  return this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare"), node.declare = !0, this.parseVarStatement(node, "using", !0);
44164
44195
  break;
44165
44196
  case 96:
44166
- if (this.hasPlugin("explicitResourceManagement") && this.isAwaitUsing())
44197
+ if (this.isAwaitUsing())
44167
44198
  return this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare"), node.declare = !0, this.next(), this.parseVarStatement(node, "await using", !0);
44168
44199
  break;
44169
44200
  case 129: {
@@ -44189,7 +44220,7 @@ function requireLib$1() {
44189
44220
  }
44190
44221
  case "global":
44191
44222
  if (this.match(5)) {
44192
- this.scope.enter(512), this.prodParam.enter(0);
44223
+ this.scope.enter(1024), this.prodParam.enter(0);
44193
44224
  const mod = node;
44194
44225
  return mod.kind = "global", node.global = !0, mod.id = expr, mod.body = this.tsParseModuleBlock(), this.scope.exit(), this.prodParam.exit(), this.finishNode(mod, "TSModuleDeclaration");
44195
44226
  }
@@ -44328,7 +44359,7 @@ function requireLib$1() {
44328
44359
  }
44329
44360
  if (!noCalls && this.eat(10)) {
44330
44361
  const node2 = this.startNodeAt(startLoc);
44331
- return node2.callee = base2, node2.arguments = this.parseCallExpressionArguments(11), this.tsCheckForInvalidTypeCasts(node2.arguments), node2.typeParameters = typeArguments, state.optionalChainMember && (node2.optional = isOptionalCall), this.finishCallExpression(node2, state.optionalChainMember);
44362
+ return node2.callee = base2, node2.arguments = this.parseCallExpressionArguments(), this.tsCheckForInvalidTypeCasts(node2.arguments), node2.typeParameters = typeArguments, state.optionalChainMember && (node2.optional = isOptionalCall), this.finishCallExpression(node2, state.optionalChainMember);
44332
44363
  }
44333
44364
  const tokenType = this.state.type;
44334
44365
  if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak())
@@ -44409,7 +44440,7 @@ function requireLib$1() {
44409
44440
  return super.parseExport(node, decorators);
44410
44441
  }
44411
44442
  isAbstractClass() {
44412
- return this.isContextual(124) && this.lookahead().type === 80;
44443
+ return this.isContextual(124) && this.isLookaheadContextual("class");
44413
44444
  }
44414
44445
  parseExportDefaultExpression() {
44415
44446
  if (this.isAbstractClass()) {
@@ -44427,6 +44458,8 @@ function requireLib$1() {
44427
44458
  isAmbientContext
44428
44459
  } = this.state, declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
44429
44460
  if (!isAmbientContext) return declaration;
44461
+ if (!node.declare && (kind === "using" || kind === "await using"))
44462
+ return this.raiseOverwrite(TSErrors.UsingDeclarationInAmbientContext, node, kind), declaration;
44430
44463
  for (const {
44431
44464
  id,
44432
44465
  init
@@ -45030,7 +45063,10 @@ function requireLib$1() {
45030
45063
  node && node.type === "Placeholder" && node.expectedNode === "Expression" ? node.expectedNode = "Pattern" : super.toAssignable(node, isLHS);
45031
45064
  }
45032
45065
  chStartsBindingIdentifier(ch, pos2) {
45033
- return !!(super.chStartsBindingIdentifier(ch, pos2) || this.lookahead().type === 133);
45066
+ if (super.chStartsBindingIdentifier(ch, pos2))
45067
+ return !0;
45068
+ const next = this.nextTokenStart();
45069
+ return this.input.charCodeAt(next) === 37 && this.input.charCodeAt(next + 1) === 37;
45034
45070
  }
45035
45071
  verifyBreakContinue(node, isBreak) {
45036
45072
  node.label && node.label.type === "Placeholder" || super.verifyBreakContinue(node, isBreak);
@@ -45190,6 +45226,8 @@ function requireLib$1() {
45190
45226
  }
45191
45227
  if (pluginsMap.has("optionalChainingAssign") && pluginsMap.get("optionalChainingAssign").version !== "2023-07")
45192
45228
  throw new Error("The 'optionalChainingAssign' plugin requires a 'version' option, representing the last proposal update. Currently, the only supported value is '2023-07'.");
45229
+ if (pluginsMap.has("discardBinding") && pluginsMap.get("discardBinding").syntaxType !== "void")
45230
+ throw new Error("The 'discardBinding' plugin requires a 'syntaxType' option. Currently the only supported value is 'void'.");
45193
45231
  }
45194
45232
  const mixinPlugins = {
45195
45233
  estree,
@@ -45260,7 +45298,7 @@ function requireLib$1() {
45260
45298
  if (node.operator = operator, this.match(29)) {
45261
45299
  this.toAssignable(left, !0), node.left = left;
45262
45300
  const startIndex = startLoc.index;
45263
- refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startIndex && (refExpressionErrors.doubleProtoLoc = null), refExpressionErrors.shorthandAssignLoc != null && refExpressionErrors.shorthandAssignLoc.index >= startIndex && (refExpressionErrors.shorthandAssignLoc = null), refExpressionErrors.privateKeyLoc != null && refExpressionErrors.privateKeyLoc.index >= startIndex && (this.checkDestructuringPrivate(refExpressionErrors), refExpressionErrors.privateKeyLoc = null);
45301
+ refExpressionErrors.doubleProtoLoc != null && refExpressionErrors.doubleProtoLoc.index >= startIndex && (refExpressionErrors.doubleProtoLoc = null), refExpressionErrors.shorthandAssignLoc != null && refExpressionErrors.shorthandAssignLoc.index >= startIndex && (refExpressionErrors.shorthandAssignLoc = null), refExpressionErrors.privateKeyLoc != null && refExpressionErrors.privateKeyLoc.index >= startIndex && (this.checkDestructuringPrivate(refExpressionErrors), refExpressionErrors.privateKeyLoc = null), refExpressionErrors.voidPatternLoc != null && refExpressionErrors.voidPatternLoc.index >= startIndex && (refExpressionErrors.voidPatternLoc = null);
45264
45302
  } else
45265
45303
  node.left = left;
45266
45304
  return this.next(), node.right = this.parseMaybeAssign(), this.checkLVal(left, this.finishNode(node, "AssignmentExpression")), node;
@@ -45459,7 +45497,7 @@ function requireLib$1() {
45459
45497
  maybeAsyncArrow,
45460
45498
  optionalChainMember
45461
45499
  } = state;
45462
- maybeAsyncArrow && (this.expressionScope.enter(newAsyncArrowScope()), refExpressionErrors = new ExpressionErrors()), optionalChainMember && (node.optional = optional), optional ? node.arguments = this.parseCallExpressionArguments(11) : node.arguments = this.parseCallExpressionArguments(11, base2.type !== "Super", node, refExpressionErrors);
45500
+ maybeAsyncArrow && (this.expressionScope.enter(newAsyncArrowScope()), refExpressionErrors = new ExpressionErrors()), optionalChainMember && (node.optional = optional), optional ? node.arguments = this.parseCallExpressionArguments() : node.arguments = this.parseCallExpressionArguments(base2.type !== "Super", node, refExpressionErrors);
45463
45501
  let finishedNode = this.finishCallExpression(node, optionalChainMember);
45464
45502
  return maybeAsyncArrow && this.shouldParseAsyncArrow() && !optional ? (state.stop = !0, this.checkDestructuringPrivate(refExpressionErrors), this.expressionScope.validateAsPattern(), this.expressionScope.exit(), finishedNode = this.parseAsyncArrowFromCallExpression(this.startNodeAt(startLoc), finishedNode)) : (maybeAsyncArrow && (this.checkExpressionErrors(refExpressionErrors, !0), this.expressionScope.exit()), this.toReferencedArguments(finishedNode)), this.state.maybeInArrowParameters = oldMaybeInArrowParameters, finishedNode;
45465
45503
  }
@@ -45482,18 +45520,18 @@ function requireLib$1() {
45482
45520
  arg.type === "SpreadElement" && this.raise(Errors.ImportCallSpreadArgument, arg);
45483
45521
  return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
45484
45522
  }
45485
- parseCallExpressionArguments(close, allowPlaceholder, nodeForExtra, refExpressionErrors) {
45523
+ parseCallExpressionArguments(allowPlaceholder, nodeForExtra, refExpressionErrors) {
45486
45524
  const elts = [];
45487
45525
  let first2 = !0;
45488
45526
  const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
45489
- for (this.state.inFSharpPipelineDirectBody = !1; !this.eat(close); ) {
45527
+ for (this.state.inFSharpPipelineDirectBody = !1; !this.eat(11); ) {
45490
45528
  if (first2)
45491
45529
  first2 = !1;
45492
- else if (this.expect(12), this.match(close)) {
45530
+ else if (this.expect(12), this.match(11)) {
45493
45531
  nodeForExtra && this.addTrailingCommaExtraToNode(nodeForExtra), this.next();
45494
45532
  break;
45495
45533
  }
45496
- elts.push(this.parseExprListItem(!1, refExpressionErrors, allowPlaceholder));
45534
+ elts.push(this.parseExprListItem(11, !1, refExpressionErrors, allowPlaceholder));
45497
45535
  }
45498
45536
  return this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody, elts;
45499
45537
  }
@@ -45740,7 +45778,7 @@ function requireLib$1() {
45740
45778
  if (spreadStartLoc = this.state.startLoc, exprList.push(this.parseParenItem(this.parseRestBinding(), spreadNodeStartLoc)), !this.checkCommaAfterRest(41))
45741
45779
  break;
45742
45780
  } else
45743
- exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem));
45781
+ exprList.push(this.parseMaybeAssignAllowInOrVoidPattern(11, refExpressionErrors, this.parseParenItem));
45744
45782
  }
45745
45783
  const innerEndLoc = this.state.lastTokEndLoc;
45746
45784
  this.expect(11), this.state.maybeInArrowParameters = oldMaybeInArrowParameters, this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
@@ -45769,7 +45807,7 @@ function requireLib$1() {
45769
45807
  const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
45770
45808
  this.next();
45771
45809
  const metaProp = this.parseMetaProperty(node, meta, "target");
45772
- return !this.scope.inNonArrowFunction && !this.scope.inClass && !(this.optionFlags & 4) && this.raise(Errors.UnexpectedNewTarget, metaProp), metaProp;
45810
+ return this.scope.allowNewTarget || this.raise(Errors.UnexpectedNewTarget, metaProp), metaProp;
45773
45811
  }
45774
45812
  return this.parseNew(node);
45775
45813
  }
@@ -45883,7 +45921,7 @@ function requireLib$1() {
45883
45921
  }
45884
45922
  parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
45885
45923
  if (prop.shorthand = !1, this.eat(14))
45886
- return prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors), this.finishObjectProperty(prop);
45924
+ return prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowInOrVoidPattern(8, refExpressionErrors), this.finishObjectProperty(prop);
45887
45925
  if (!prop.computed && prop.key.type === "Identifier") {
45888
45926
  if (this.checkReservedWord(prop.key.name, prop.key.loc.start, !0, !1), isPattern)
45889
45927
  prop.value = this.parseMaybeDefault(startLoc, this.cloneIdentifier(prop.key));
@@ -45943,7 +45981,7 @@ function requireLib$1() {
45943
45981
  node.id = null, node.generator = !1, node.async = isAsync;
45944
45982
  }
45945
45983
  parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type2, inClassScope = !1) {
45946
- this.initFunction(node, isAsync), node.generator = isGenerator, this.scope.enter(18 | (inClassScope ? 64 : 0) | (allowDirectSuper ? 32 : 0)), this.prodParam.enter(functionFlags(isAsync, node.generator)), this.parseFunctionParams(node, isConstructor);
45984
+ this.initFunction(node, isAsync), node.generator = isGenerator, this.scope.enter(530 | (inClassScope ? 576 : 0) | (allowDirectSuper ? 32 : 0)), this.prodParam.enter(functionFlags(isAsync, node.generator)), this.parseFunctionParams(node, isConstructor);
45947
45985
  const finishedNode = this.parseFunctionBodyAndFinish(node, type2, !0);
45948
45986
  return this.prodParam.exit(), this.scope.exit(), finishedNode;
45949
45987
  }
@@ -45955,7 +45993,7 @@ function requireLib$1() {
45955
45993
  return this.next(), node.elements = this.parseExprList(close, !isTuple, refExpressionErrors, node), this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody, this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
45956
45994
  }
45957
45995
  parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
45958
- this.scope.enter(6);
45996
+ this.scope.enter(518);
45959
45997
  let flags = functionFlags(isAsync, !1);
45960
45998
  !this.match(5) && this.prodParam.hasIn && (flags |= 8), this.prodParam.enter(flags), this.initFunction(node, isAsync);
45961
45999
  const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
@@ -46007,11 +46045,11 @@ function requireLib$1() {
46007
46045
  nodeForExtra && this.addTrailingCommaExtraToNode(nodeForExtra), this.next();
46008
46046
  break;
46009
46047
  }
46010
- elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors));
46048
+ elts.push(this.parseExprListItem(close, allowEmpty, refExpressionErrors));
46011
46049
  }
46012
46050
  return elts;
46013
46051
  }
46014
- parseExprListItem(allowEmpty, refExpressionErrors, allowPlaceholder) {
46052
+ parseExprListItem(close, allowEmpty, refExpressionErrors, allowPlaceholder) {
46015
46053
  let elt;
46016
46054
  if (this.match(12))
46017
46055
  allowEmpty || this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
@@ -46025,7 +46063,7 @@ function requireLib$1() {
46025
46063
  const node = this.startNode();
46026
46064
  this.next(), elt = this.finishNode(node, "ArgumentPlaceholder");
46027
46065
  } else
46028
- elt = this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem);
46066
+ elt = this.parseMaybeAssignAllowInOrVoidPattern(close, refExpressionErrors, this.parseParenItem);
46029
46067
  return elt;
46030
46068
  }
46031
46069
  parseIdentifier(liberal) {
@@ -46083,7 +46121,7 @@ function requireLib$1() {
46083
46121
  }
46084
46122
  }
46085
46123
  recordAwaitIfAllowed() {
46086
- const isAwaitAllowed = this.prodParam.hasAwait || this.optionFlags & 1 && !this.scope.inFunction;
46124
+ const isAwaitAllowed = this.prodParam.hasAwait;
46087
46125
  return isAwaitAllowed && !this.scope.inFunction && (this.state.hasTopLevelAwait = !0), isAwaitAllowed;
46088
46126
  }
46089
46127
  parseAwait(startLoc) {
@@ -46253,6 +46291,19 @@ function requireLib$1() {
46253
46291
  }
46254
46292
  return this.finishNode(node, "ModuleExpression");
46255
46293
  }
46294
+ parseVoidPattern(refExpressionErrors) {
46295
+ this.expectPlugin("discardBinding");
46296
+ const node = this.startNode();
46297
+ return refExpressionErrors != null && (refExpressionErrors.voidPatternLoc = this.state.startLoc), this.next(), this.finishNode(node, "VoidPattern");
46298
+ }
46299
+ parseMaybeAssignAllowInOrVoidPattern(close, refExpressionErrors, afterLeftParse) {
46300
+ if (refExpressionErrors != null && this.match(88)) {
46301
+ const nextCode = this.lookaheadCharCode();
46302
+ if (nextCode === 44 || nextCode === (close === 3 ? 93 : close === 8 ? 125 : 41) || nextCode === 61)
46303
+ return this.parseMaybeDefault(this.state.startLoc, this.parseVoidPattern(refExpressionErrors));
46304
+ }
46305
+ return this.parseMaybeAssignAllowIn(refExpressionErrors, afterLeftParse);
46306
+ }
46256
46307
  parsePropertyNamePrefixOperator(prop) {
46257
46308
  }
46258
46309
  }
@@ -46348,9 +46399,9 @@ function requireLib$1() {
46348
46399
  }
46349
46400
  class StatementParser extends ExpressionParser {
46350
46401
  parseTopLevel(file, program) {
46351
- return file.program = this.parseProgram(program), file.comments = this.comments, this.optionFlags & 256 && (file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex)), this.finishNode(file, "File");
46402
+ return file.program = this.parseProgram(program, 140, this.options.sourceType === "module" ? "module" : "script"), file.comments = this.comments, this.optionFlags & 256 && (file.tokens = babel7CompatTokens(this.tokens, this.input, this.startIndex)), this.finishNode(file, "File");
46352
46403
  }
46353
- parseProgram(program, end = 140, sourceType = this.options.sourceType) {
46404
+ parseProgram(program, end, sourceType) {
46354
46405
  if (program.sourceType = sourceType, program.interpreter = this.parseInterpreterDirective(), this.parseBlockBody(program, !0, !0, end), this.inModule) {
46355
46406
  if (!(this.optionFlags & 64) && this.scope.undefinedExports.size > 0)
46356
46407
  for (const [localName, at] of Array.from(this.scope.undefinedExports))
@@ -46381,6 +46432,17 @@ function requireLib$1() {
46381
46432
  const next = this.nextTokenInLineStart(), nextCh = this.codePointAtPos(next);
46382
46433
  return this.chStartsBindingIdentifier(nextCh, next);
46383
46434
  }
46435
+ isForUsing() {
46436
+ if (!this.isContextual(107))
46437
+ return !1;
46438
+ const next = this.nextTokenInLineStart(), nextCh = this.codePointAtPos(next);
46439
+ if (this.isUnparsedContextual(next, "of")) {
46440
+ const nextCharAfterOf = this.lookaheadCharCodeSince(next + 2);
46441
+ if (nextCharAfterOf !== 61 && nextCharAfterOf !== 58 && nextCharAfterOf !== 59)
46442
+ return !1;
46443
+ }
46444
+ return !!(this.chStartsBindingIdentifier(nextCh, next) || this.isUnparsedContextual(next, "void"));
46445
+ }
46384
46446
  isAwaitUsing() {
46385
46447
  if (!this.isContextual(96))
46386
46448
  return !1;
@@ -46389,7 +46451,7 @@ function requireLib$1() {
46389
46451
  next = this.nextTokenInLineStartSince(next + 5);
46390
46452
  const nextCh = this.codePointAtPos(next);
46391
46453
  if (this.chStartsBindingIdentifier(nextCh, next))
46392
- return this.expectPlugin("explicitResourceManagement"), !0;
46454
+ return !0;
46393
46455
  }
46394
46456
  return !1;
46395
46457
  }
@@ -46414,19 +46476,6 @@ function requireLib$1() {
46414
46476
  const next = this.nextTokenInLineStart(), nextCh = this.codePointAtPos(next);
46415
46477
  return nextCh === 123 || this.chStartsBindingIdentifier(nextCh, next);
46416
46478
  }
46417
- allowsForUsing() {
46418
- const {
46419
- type: type2,
46420
- containsEsc,
46421
- end
46422
- } = this.lookahead();
46423
- if (type2 === 102 && !containsEsc) {
46424
- const nextCharAfterOf = this.lookaheadCharCodeSince(end);
46425
- if (nextCharAfterOf !== 61 && nextCharAfterOf !== 58 && nextCharAfterOf !== 59)
46426
- return !1;
46427
- }
46428
- return tokenIsIdentifier(type2) && !this.hasFollowingLineBreak() ? (this.expectPlugin("explicitResourceManagement"), !0) : !1;
46429
- }
46430
46479
  allowsUsing() {
46431
46480
  return (this.scope.inModule || !this.scope.inTopLevel) && !this.scope.inBareCaseStatement;
46432
46481
  }
@@ -46482,7 +46531,7 @@ function requireLib$1() {
46482
46531
  case 107:
46483
46532
  if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace())
46484
46533
  break;
46485
- return this.expectPlugin("explicitResourceManagement"), this.allowsUsing() ? allowDeclaration || this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc) : this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc), this.parseVarStatement(node, "using");
46534
+ return this.allowsUsing() ? allowDeclaration || this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc) : this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc), this.parseVarStatement(node, "using");
46486
46535
  case 100: {
46487
46536
  if (this.state.containsEsc)
46488
46537
  break;
@@ -46573,7 +46622,7 @@ function requireLib$1() {
46573
46622
  parseMaybeDecoratorArguments(expr, startLoc) {
46574
46623
  if (this.eat(10)) {
46575
46624
  const node = this.startNodeAt(startLoc);
46576
- return node.callee = expr, node.arguments = this.parseCallExpressionArguments(11), this.toReferencedList(node.arguments), this.finishNode(node, "CallExpression");
46625
+ return node.callee = expr, node.arguments = this.parseCallExpressionArguments(), this.toReferencedList(node.arguments), this.finishNode(node, "CallExpression");
46577
46626
  }
46578
46627
  return expr;
46579
46628
  }
@@ -46612,7 +46661,7 @@ function requireLib$1() {
46612
46661
  return awaitAt !== null && this.unexpected(awaitAt), this.parseFor(node, null);
46613
46662
  const startsWithLet = this.isContextual(100);
46614
46663
  {
46615
- const startsWithAwaitUsing = this.isAwaitUsing(), starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(107) && this.allowsForUsing(), isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
46664
+ const startsWithAwaitUsing = this.isAwaitUsing(), starsWithUsingDeclaration = startsWithAwaitUsing || this.isForUsing(), isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
46616
46665
  if (this.match(74) || this.match(75) || isLetOrUsing) {
46617
46666
  const initNode = this.startNode();
46618
46667
  let kind;
@@ -46639,7 +46688,7 @@ function requireLib$1() {
46639
46688
  return this.next(), node.test = this.parseHeaderExpression(), node.consequent = this.parseStatementOrSloppyAnnexBFunctionDeclaration(), node.alternate = this.eat(66) ? this.parseStatementOrSloppyAnnexBFunctionDeclaration() : null, this.finishNode(node, "IfStatement");
46640
46689
  }
46641
46690
  parseReturnStatement(node) {
46642
- return !this.prodParam.hasReturn && !(this.optionFlags & 2) && this.raise(Errors.IllegalReturn, this.state.startLoc), this.next(), this.isLineTerminator() ? node.argument = null : (node.argument = this.parseExpression(), this.semicolon()), this.finishNode(node, "ReturnStatement");
46691
+ return this.prodParam.hasReturn || this.raise(Errors.IllegalReturn, this.state.startLoc), this.next(), this.isLineTerminator() ? node.argument = null : (node.argument = this.parseExpression(), this.semicolon()), this.finishNode(node, "ReturnStatement");
46643
46692
  }
46644
46693
  parseSwitchStatement(node) {
46645
46694
  this.next(), node.discriminant = this.parseHeaderExpression();
@@ -46759,7 +46808,7 @@ function requireLib$1() {
46759
46808
  }
46760
46809
  parseVarId(decl, kind) {
46761
46810
  const id = this.parseBindingAtom();
46762
- (kind === "using" || kind === "await using") && (id.type === "ArrayPattern" || id.type === "ObjectPattern") && this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start), this.checkLVal(id, {
46811
+ kind === "using" || kind === "await using" ? (id.type === "ArrayPattern" || id.type === "ObjectPattern") && this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start) : id.type === "VoidPattern" && this.raise(Errors.UnexpectedVoidPattern, id.loc.start), this.checkLVal(id, {
46763
46812
  type: "VariableDeclarator"
46764
46813
  }, kind === "var" ? 5 : 8201), decl.id = id;
46765
46814
  }
@@ -46770,7 +46819,7 @@ function requireLib$1() {
46770
46819
  const hangingDeclaration = flags & 2, isDeclaration = !!(flags & 1), requireId = isDeclaration && !(flags & 4), isAsync = !!(flags & 8);
46771
46820
  this.initFunction(node, isAsync), this.match(55) && (hangingDeclaration && this.raise(Errors.GeneratorInSingleStatementContext, this.state.startLoc), this.next(), node.generator = !0), isDeclaration && (node.id = this.parseFunctionId(requireId));
46772
46821
  const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
46773
- return this.state.maybeInArrowParameters = !1, this.scope.enter(2), this.prodParam.enter(functionFlags(isAsync, node.generator)), isDeclaration || (node.id = this.parseFunctionId()), this.parseFunctionParams(node, !1), this.withSmartMixTopicForbiddingContext(() => {
46822
+ return this.state.maybeInArrowParameters = !1, this.scope.enter(514), this.prodParam.enter(functionFlags(isAsync, node.generator)), isDeclaration || (node.id = this.parseFunctionId()), this.parseFunctionParams(node, !1), this.withSmartMixTopicForbiddingContext(() => {
46774
46823
  this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
46775
46824
  }), this.prodParam.exit(), this.scope.exit(), isDeclaration && !hangingDeclaration && this.registerFunctionStatementId(node), this.state.maybeInArrowParameters = oldMaybeInArrowParameters, node;
46776
46825
  }
@@ -46902,7 +46951,7 @@ function requireLib$1() {
46902
46951
  }
46903
46952
  parseClassStaticBlock(classBody, member) {
46904
46953
  var _member$decorators;
46905
- this.scope.enter(208);
46954
+ this.scope.enter(720);
46906
46955
  const oldLabels = this.state.labels;
46907
46956
  this.state.labels = [], this.prodParam.enter(0);
46908
46957
  const body = member.body = [];
@@ -46944,7 +46993,7 @@ function requireLib$1() {
46944
46993
  return this.parseInitializer(node), this.semicolon(), this.finishNode(node, "ClassAccessorProperty");
46945
46994
  }
46946
46995
  parseInitializer(node) {
46947
- this.scope.enter(80), this.expressionScope.enter(newExpressionScope()), this.prodParam.enter(0), node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null, this.expressionScope.exit(), this.prodParam.exit(), this.scope.exit();
46996
+ this.scope.enter(592), this.expressionScope.enter(newExpressionScope()), this.prodParam.enter(0), node.value = this.eat(29) ? this.parseMaybeAssignAllowIn() : null, this.expressionScope.exit(), this.prodParam.exit(), this.scope.exit();
46948
46997
  }
46949
46998
  parseClassId(node, isStatement, optionalId, bindingType = 8331) {
46950
46999
  if (tokenIsIdentifier(this.state.type))
@@ -47039,7 +47088,7 @@ function requireLib$1() {
47039
47088
  return this.parseClass(expr, !0, !0);
47040
47089
  if (this.match(26))
47041
47090
  return this.hasPlugin("decorators") && this.getPluginOption("decorators", "decoratorsBeforeExport") === !0 && this.raise(Errors.DecoratorBeforeExport, this.state.startLoc), this.parseClass(this.maybeTakeDecorators(this.parseDecorators(!1), this.startNode()), !0, !0);
47042
- if (this.match(75) || this.match(74) || this.isLet() || this.hasPlugin("explicitResourceManagement") && (this.isUsing() || this.isAwaitUsing()))
47091
+ if (this.match(75) || this.match(74) || this.isLet() || this.isUsing() || this.isAwaitUsing())
47043
47092
  throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
47044
47093
  const res = this.parseMaybeAssignAllowIn();
47045
47094
  return this.semicolon(), res;
@@ -47055,10 +47104,8 @@ function requireLib$1() {
47055
47104
  if (type2 === 95 && !this.state.containsEsc || type2 === 100)
47056
47105
  return !1;
47057
47106
  if ((type2 === 130 || type2 === 129) && !this.state.containsEsc) {
47058
- const {
47059
- type: nextType
47060
- } = this.lookahead();
47061
- if (tokenIsIdentifier(nextType) && nextType !== 98 || nextType === 5)
47107
+ const next2 = this.nextTokenStart(), nextChar = this.input.charCodeAt(next2);
47108
+ if (nextChar === 123 || this.chStartsBindingIdentifier(nextChar, next2) && !this.input.startsWith("from", next2))
47062
47109
  return this.expectOnePlugin(["flow", "typescript"]), !1;
47063
47110
  }
47064
47111
  } else if (!this.match(65))
@@ -47079,15 +47126,7 @@ function requireLib$1() {
47079
47126
  const {
47080
47127
  type: type2
47081
47128
  } = this.state;
47082
- if (type2 === 26 && (this.expectOnePlugin(["decorators", "decorators-legacy"]), this.hasPlugin("decorators")))
47083
- return this.getPluginOption("decorators", "decoratorsBeforeExport") === !0 && this.raise(Errors.DecoratorBeforeExport, this.state.startLoc), !0;
47084
- if (this.hasPlugin("explicitResourceManagement")) {
47085
- if (this.isUsing())
47086
- return this.raise(Errors.UsingDeclarationExport, this.state.startLoc), !0;
47087
- if (this.isAwaitUsing())
47088
- return this.raise(Errors.UsingDeclarationExport, this.state.startLoc), !0;
47089
- }
47090
- return type2 === 74 || type2 === 75 || type2 === 68 || type2 === 80 || this.isLet() || this.isAsyncFunction();
47129
+ return type2 === 26 && (this.expectOnePlugin(["decorators", "decorators-legacy"]), this.hasPlugin("decorators")) ? (this.getPluginOption("decorators", "decoratorsBeforeExport") === !0 && this.raise(Errors.DecoratorBeforeExport, this.state.startLoc), !0) : this.isUsing() ? (this.raise(Errors.UsingDeclarationExport, this.state.startLoc), !0) : this.isAwaitUsing() ? (this.raise(Errors.UsingDeclarationExport, this.state.startLoc), !0) : type2 === 74 || type2 === 75 || type2 === 68 || type2 === 80 || this.isLet() || this.isAsyncFunction();
47091
47130
  }
47092
47131
  checkExport(node, checkNames, isDefault, isFrom) {
47093
47132
  if (checkNames) {
@@ -53905,7 +53944,7 @@ ${err.message}`);
53905
53944
  throw new Error(
53906
53945
  `Given organization ID (${flags.organization}) not found, or you do not have access to it`
53907
53946
  );
53908
- if (!await hasProjectAttachGrant(flags.organization))
53947
+ if (!await hasProjectAttachGrant2(flags.organization))
53909
53948
  throw new Error(
53910
53949
  "You lack the necessary permissions to attach a project to this organization"
53911
53950
  );
@@ -54113,6 +54152,7 @@ The default dataset configuration has a public dataset named "production".`;
54113
54152
  };
54114
54153
  }
54115
54154
  async function prepareFlags() {
54155
+ cliFlags["project-id"] && !cliFlags.project && (cliFlags.project = cliFlags["project-id"]);
54116
54156
  const createProjectName = cliFlags["create-project"];
54117
54157
  if ((cliFlags.dataset || cliFlags.visibility || cliFlags["dataset-default"] || unattended) && (showDefaultConfigPrompt = !1), cliFlags.project && createProjectName)
54118
54158
  throw new Error(
@@ -54169,7 +54209,7 @@ The default dataset configuration has a public dataset named "production".`;
54169
54209
  }
54170
54210
  return cliFlags;
54171
54211
  }
54172
- async function createOrganization(props = {}) {
54212
+ async function createOrganization2(props = {}) {
54173
54213
  const name = props.name || await prompt2.single({
54174
54214
  type: "input",
54175
54215
  message: "Organization name:",
@@ -54199,13 +54239,13 @@ The default dataset configuration has a public dataset named "production".`;
54199
54239
  default: defaultOrganizationId || void 0,
54200
54240
  choices: organizationChoices
54201
54241
  });
54202
- return chosenOrg === "-new-" ? createOrganization().then((org) => org.id) : chosenOrg || void 0;
54242
+ return chosenOrg === "-new-" ? createOrganization2().then((org) => org.id) : chosenOrg || void 0;
54203
54243
  }
54204
54244
  async function getOrganizationId(organizations) {
54205
54245
  if (organizations.length === 0)
54206
- return createOrganization().then((org) => org.id);
54246
+ return createOrganization2().then((org) => org.id);
54207
54247
  loadEnv.debug(`User has ${organizations.length} organization(s), checking attach access`);
54208
- const withGrantInfo = await getOrganizationsWithAttachGrantInfo(organizations), withAttach = withGrantInfo.filter(({ hasAttachGrant }) => hasAttachGrant);
54248
+ const withGrantInfo = await getOrganizationsWithAttachGrantInfo2(organizations), withAttach = withGrantInfo.filter(({ hasAttachGrant }) => hasAttachGrant);
54209
54249
  loadEnv.debug("User has attach access to %d organizations.", withAttach.length);
54210
54250
  const organizationChoices = [
54211
54251
  ...withGrantInfo.map(({ organization, hasAttachGrant }) => ({
@@ -54222,9 +54262,9 @@ The default dataset configuration has a public dataset named "production".`;
54222
54262
  default: defaultOrganizationId || void 0,
54223
54263
  choices: organizationChoices
54224
54264
  });
54225
- return chosenOrg === "-new-" ? createOrganization().then((org) => org.id) : chosenOrg || void 0;
54265
+ return chosenOrg === "-new-" ? createOrganization2().then((org) => org.id) : chosenOrg || void 0;
54226
54266
  }
54227
- async function hasProjectAttachGrant(orgId) {
54267
+ async function hasProjectAttachGrant2(orgId) {
54228
54268
  const requiredGrantGroup = "sanity.organization.projects", requiredGrant = "attach", client2 = apiClient({ requireProject: !1, requireUser: !0 }).clone().config({ apiVersion: "v2021-06-07" });
54229
54269
  try {
54230
54270
  return ((await client2.request({ uri: `organizations/${orgId}/grants` }))[requiredGrantGroup] || []).some(
@@ -54234,11 +54274,11 @@ The default dataset configuration has a public dataset named "production".`;
54234
54274
  return err.statusCode === 401 ? (loadEnv.debug("No access to organization %s (401)", orgId), !1) : (loadEnv.debug("Error checking grants for organization %s: %s", orgId, err.message), !1);
54235
54275
  }
54236
54276
  }
54237
- function getOrganizationsWithAttachGrantInfo(organizations) {
54277
+ function getOrganizationsWithAttachGrantInfo2(organizations) {
54238
54278
  return pMap(
54239
54279
  organizations,
54240
54280
  async (organization) => ({
54241
- hasAttachGrant: await hasProjectAttachGrant(organization.id),
54281
+ hasAttachGrant: await hasProjectAttachGrant2(organization.id),
54242
54282
  organization
54243
54283
  }),
54244
54284
  { concurrency: 3 }
@@ -54378,10 +54418,10 @@ function getImportCommand(outputPath, studioVersion) {
54378
54418
  );
54379
54419
  }
54380
54420
  }
54381
- const helpText$7 = `
54421
+ const helpText$8 = `
54382
54422
  Options
54383
54423
  -y, --yes Use unattended mode, accepting defaults and using only flags for choices
54384
- --project <projectId> Project ID to use for the studio
54424
+ --project, --project-id <projectId> Project ID to use for the studio
54385
54425
  --organization <organizationId> Organization ID to use for the project
54386
54426
  --dataset <dataset> Dataset name for the studio
54387
54427
  --dataset-default Set up a project with a public dataset named "production"
@@ -54431,7 +54471,7 @@ Examples
54431
54471
  name: "init",
54432
54472
  signature: "",
54433
54473
  description: "Initializes a new Sanity Studio and/or project",
54434
- helpText: helpText$7,
54474
+ helpText: helpText$8,
54435
54475
  action: async (args, context) => {
54436
54476
  const [type2] = args.argsWithoutOptions;
54437
54477
  if (type2)
@@ -54469,7 +54509,7 @@ Examples
54469
54509
  const { output } = context, { print } = output, url = "https://www.sanity.io/learn";
54470
54510
  print(`Opening ${url}`), await open(url);
54471
54511
  }
54472
- }, helpText$6 = `
54512
+ }, helpText$7 = `
54473
54513
  Options
54474
54514
  --sso <slug> Log in using Single Sign On, using the given slug
54475
54515
  --provider <providerId> Authenticate against a specific provider
@@ -54487,16 +54527,16 @@ Examples
54487
54527
  `, loginCommand = {
54488
54528
  name: "login",
54489
54529
  signature: "[--sso <slug>] [--provider <providerId>] [--no-open]",
54490
- helpText: helpText$6,
54530
+ helpText: helpText$7,
54491
54531
  description: "Authenticates the CLI for access to Sanity projects",
54492
54532
  action: login
54493
- }, helpText$5 = `
54533
+ }, helpText$6 = `
54494
54534
  Examples
54495
54535
  # Log out of the CLI
54496
54536
  sanity logout
54497
54537
  `, logoutCommand = {
54498
54538
  name: "logout",
54499
- helpText: helpText$5,
54539
+ helpText: helpText$6,
54500
54540
  signature: "logout",
54501
54541
  description: "Logs out the CLI from the current user session",
54502
54542
  async action(args, { output, apiClient }) {
@@ -54526,6 +54566,239 @@ ${err.message}`));
54526
54566
  const { output, cliConfig } = context, { print } = output, projectId = cliConfig?.api?.projectId, url = projectId ? `https://www.sanity.io/manage/project/${projectId}` : "https://www.sanity.io/manage/";
54527
54567
  print(`Opening ${url}`), await open(url);
54528
54568
  }
54569
+ };
54570
+ async function hasProjectAttachGrant(orgId, context) {
54571
+ const requiredGrantGroup = "sanity.organization.projects", requiredGrant = "attach", client2 = context.apiClient({ requireProject: !1, requireUser: !0 }).withConfig({ apiVersion: "v2021-06-07" });
54572
+ try {
54573
+ return ((await client2.request({ uri: `organizations/${orgId}/grants` }))[requiredGrantGroup] || []).some(
54574
+ (resource) => resource.grants && resource.grants.some((grant) => grant.name === requiredGrant)
54575
+ );
54576
+ } catch {
54577
+ return !1;
54578
+ }
54579
+ }
54580
+ function getOrganizationsWithAttachGrantInfo(organizations, context) {
54581
+ return pMap(
54582
+ organizations,
54583
+ async (organization) => ({
54584
+ hasAttachGrant: await hasProjectAttachGrant(organization.id, context),
54585
+ organization
54586
+ }),
54587
+ { concurrency: 3 }
54588
+ );
54589
+ }
54590
+ function getOrganizationChoices(withGrantInfo, prompt2) {
54591
+ const choices2 = withGrantInfo.map(({ organization, hasAttachGrant }) => ({
54592
+ value: organization.id,
54593
+ name: `${organization.name} [${organization.id}]`,
54594
+ disabled: hasAttachGrant ? !1 : "Insufficient permissions"
54595
+ }));
54596
+ return prompt2 && choices2.push(
54597
+ new prompt2.Separator(),
54598
+ { value: "-new-", name: "Create new organization", disabled: !1 },
54599
+ new prompt2.Separator()
54600
+ ), choices2;
54601
+ }
54602
+ async function createOrganization(context, user, props = {}) {
54603
+ const { prompt: prompt2, apiClient } = context, name = props.name || await prompt2.single({
54604
+ type: "input",
54605
+ message: "Organization name:",
54606
+ default: void 0,
54607
+ validate(input2) {
54608
+ return input2.length === 0 ? "Organization name cannot be empty" : input2.length > 100 ? "Organization name cannot be longer than 100 characters" : !0;
54609
+ }
54610
+ }), spinner = context.output.spinner("Creating organization").start(), organization = await apiClient({ requireProject: !1, requireUser: !0 }).request({
54611
+ uri: "/organizations",
54612
+ method: "POST",
54613
+ body: { name }
54614
+ });
54615
+ return spinner.succeed(), organization;
54616
+ }
54617
+ async function promptForOrganizationSelection(choices2, defaultChoice, context) {
54618
+ return context.prompt.single({
54619
+ message: "Select organization:",
54620
+ type: "list",
54621
+ choices: choices2,
54622
+ default: defaultChoice
54623
+ });
54624
+ }
54625
+ async function getOrganization(context, user, unattended, specifiedOrgId) {
54626
+ const { apiClient, output } = context, client2 = apiClient({ requireUser: !0, requireProject: !1 }), spinner = output.spinner("Loading organizations").start();
54627
+ let organizations;
54628
+ try {
54629
+ organizations = await client2.request({ uri: "/organizations" });
54630
+ } catch (error2) {
54631
+ throw spinner.fail(), error2;
54632
+ }
54633
+ if (specifiedOrgId) {
54634
+ const org = organizations.find((o) => o.id === specifiedOrgId || o.slug === specifiedOrgId);
54635
+ if (!org)
54636
+ throw spinner.fail(), new Error(`Organization "${specifiedOrgId}" not found or you don't have access to it`);
54637
+ return spinner.succeed(), org;
54638
+ }
54639
+ if (organizations.length === 0)
54640
+ return spinner.succeed(), output.print("You need to create an organization to create projects."), createOrganization(context).then((org) => ({
54641
+ id: org.id,
54642
+ name: org.name,
54643
+ slug: org.slug || org.id
54644
+ }));
54645
+ const withGrantInfo = await getOrganizationsWithAttachGrantInfo(organizations, context);
54646
+ spinner.succeed();
54647
+ const withAttach = withGrantInfo.filter(({ hasAttachGrant }) => hasAttachGrant);
54648
+ if (unattended || !isInteractive$1)
54649
+ return withAttach.length > 0 ? withAttach[0].organization : void 0;
54650
+ const organizationChoices = getOrganizationChoices(withGrantInfo, context.prompt), defaultOrganizationId = withAttach.length === 1 ? withAttach[0].organization.id : organizations.find((org) => org.name === user?.name)?.id, chosenOrg = await promptForOrganizationSelection(
54651
+ organizationChoices,
54652
+ defaultOrganizationId,
54653
+ context
54654
+ );
54655
+ return chosenOrg === "-new-" ? createOrganization(context).then((org) => ({
54656
+ id: org.id,
54657
+ name: org.name,
54658
+ slug: org.slug || org.id
54659
+ })) : organizations.find((org) => org.id === chosenOrg) || void 0;
54660
+ }
54661
+ function validateProjectName(input2) {
54662
+ return !input2 || input2.trim() === "" ? "Project name cannot be empty" : input2.length > 80 ? "Project name cannot be longer than 80 characters" : !0;
54663
+ }
54664
+ async function promptForProjectName(prompt2) {
54665
+ return prompt2.single({
54666
+ type: "input",
54667
+ message: "Project name:",
54668
+ default: "My Sanity Project",
54669
+ validate: validateProjectName
54670
+ });
54671
+ }
54672
+ const DATASET_INFO_TEXT = `Your content will be stored in a dataset that can be public or private, depending on
54673
+ whether you want to query your content with or without authentication.
54674
+ The default dataset configuration has a public dataset named "production".`;
54675
+ async function promptAndCreateDataset(options2) {
54676
+ const { context, datasetName, datasetVisibility, unattended } = options2, { prompt: prompt2, output } = context;
54677
+ let finalDatasetName, finalVisibility, useDefaultConfig = !1;
54678
+ return datasetName ? finalDatasetName = datasetName : unattended ? (finalDatasetName = "production", useDefaultConfig = !0) : (output.print(DATASET_INFO_TEXT), useDefaultConfig = await promptForDefaultConfig(prompt2), useDefaultConfig ? finalDatasetName = "production" : finalDatasetName = await promptForDatasetName(prompt2, {
54679
+ message: "Name of your first dataset:"
54680
+ })), datasetVisibility ? finalVisibility = datasetVisibility : unattended || useDefaultConfig ? finalVisibility = "public" : finalVisibility = await promptForAclMode(prompt2, output), { name: finalDatasetName, visibility: finalVisibility };
54681
+ }
54682
+ async function createDatasetForProject(context, projectId, datasetName, visibility) {
54683
+ const { apiClient, output } = context, spinner = output.spinner("Creating dataset").start();
54684
+ try {
54685
+ return await apiClient({ api: { projectId } }).datasets.create(datasetName, { aclMode: visibility }), spinner.succeed(), { name: datasetName, visibility };
54686
+ } catch (err) {
54687
+ throw spinner.fail(), err;
54688
+ }
54689
+ }
54690
+ async function createProjectWithMetadata(apiClient, displayName, organizationId, context, extraMetadata = {}) {
54691
+ const { output } = context, spinner = output.spinner("Creating project").start();
54692
+ try {
54693
+ const createOptions = {
54694
+ displayName,
54695
+ organizationId,
54696
+ metadata: {
54697
+ integration: "cli",
54698
+ ...extraMetadata
54699
+ }
54700
+ }, result = await createProject(apiClient, createOptions);
54701
+ return spinner.succeed(), result;
54702
+ } catch (error2) {
54703
+ throw spinner.fail(), error2;
54704
+ }
54705
+ }
54706
+ function formatProjectUrl(projectId, apiHost) {
54707
+ return `https://www.${new URL(apiHost).hostname.split(".").slice(-2).join(".")}/manage/project/${projectId}`;
54708
+ }
54709
+ function printProjectCreationSuccess(result, format, context) {
54710
+ const { output, apiClient } = context;
54711
+ if (format === "json") {
54712
+ output.print(JSON.stringify(result, null, 2));
54713
+ return;
54714
+ }
54715
+ output.print("Project created successfully!"), output.print(`ID: ${result.projectId}`), output.print(`Name: ${result.displayName}`), output.print(`Organization: ${result.organization?.name || "Personal"}`), result.dataset && output.print(`Dataset: ${result.dataset.name} (${result.dataset.visibility})`);
54716
+ const { apiHost } = apiClient({
54717
+ requireProject: !1,
54718
+ requireUser: !1
54719
+ }).config();
54720
+ output.print(""), output.print(`Manage your project: ${formatProjectUrl(result.projectId, apiHost)}`);
54721
+ }
54722
+ async function createProjectAction(options2, context) {
54723
+ const { apiClient, prompt: prompt2 } = context;
54724
+ apiClient({ requireUser: !0, requireProject: !1 });
54725
+ const projectName = options2.projectName || (options2.unattended || !isInteractive$1 ? "My Sanity Project" : await promptForProjectName(prompt2)), organization = await getOrganization(
54726
+ context,
54727
+ void 0,
54728
+ // user - not needed for projects create
54729
+ options2.unattended,
54730
+ options2.organizationId
54731
+ ), project = await createProjectWithMetadata(apiClient, projectName, organization?.id, context), result = {
54732
+ projectId: project.projectId,
54733
+ displayName: project.displayName,
54734
+ organization
54735
+ };
54736
+ if (options2.createDataset) {
54737
+ const { name: datasetName, visibility } = await promptAndCreateDataset({
54738
+ context,
54739
+ datasetName: options2.datasetName,
54740
+ datasetVisibility: options2.datasetVisibility,
54741
+ unattended: options2.unattended || !isInteractive$1
54742
+ });
54743
+ try {
54744
+ const dataset = await createDatasetForProject(
54745
+ context,
54746
+ project.projectId,
54747
+ datasetName,
54748
+ visibility
54749
+ );
54750
+ result.dataset = dataset;
54751
+ } catch (err) {
54752
+ context.output.warn(`Project created but dataset creation failed: ${err.message}`);
54753
+ }
54754
+ }
54755
+ return result;
54756
+ }
54757
+ const helpText$5 = `
54758
+ Examples
54759
+ sanity projects create
54760
+ sanity projects create "My New Project"
54761
+ sanity projects create "My Project" --organization=my-org
54762
+ sanity projects create "My Project" --dataset
54763
+ sanity projects create "My Project" --dataset=staging --dataset-visibility=private
54764
+ sanity projects create "CI Project" --yes --json
54765
+
54766
+ Options
54767
+ --organization <slug|id> Organization to create the project in
54768
+ --dataset [name] Create a dataset. Prompts for name/visibility unless specified or --yes used
54769
+ --dataset-visibility <mode> Dataset visibility: public or private
54770
+ --json JSON output format
54771
+ -y, --yes Skip prompts and use defaults (project: "My Sanity Project", dataset: production, visibility: public)
54772
+ `, createProjectCommand = {
54773
+ name: "create",
54774
+ group: "projects",
54775
+ signature: "[PROJECT_NAME]",
54776
+ helpText: helpText$5,
54777
+ description: "Create a new Sanity project",
54778
+ action: async (args, context) => {
54779
+ const [projectName] = args.argsWithoutOptions, {
54780
+ organization,
54781
+ dataset,
54782
+ "dataset-visibility": datasetVisibility,
54783
+ json: json2,
54784
+ yes,
54785
+ y
54786
+ } = args.extOptions;
54787
+ let datasetName, createDataset = !1;
54788
+ dataset === !0 ? (createDataset = !0, datasetName = void 0) : typeof dataset == "string" && (createDataset = !0, datasetName = dataset);
54789
+ const result = await createProjectAction(
54790
+ {
54791
+ projectName,
54792
+ organizationId: organization,
54793
+ createDataset,
54794
+ datasetName,
54795
+ datasetVisibility,
54796
+ unattended: y || yes
54797
+ },
54798
+ context
54799
+ );
54800
+ printProjectCreationSuccess(result, json2 ? "json" : "text", context);
54801
+ }
54529
54802
  }, headings = ["id", "members", "name", "url", "created"], helpText$4 = `
54530
54803
  Options
54531
54804
  --sort <field> Sort output by specified column
@@ -54566,7 +54839,7 @@ Examples
54566
54839
  name: "projects",
54567
54840
  signature: "[COMMAND]",
54568
54841
  isGroupRoot: !0,
54569
- description: "Lists all projects associated with your logged-in account"
54842
+ description: "Manage Sanity projects - list, create"
54570
54843
  }, helpText$3 = `
54571
54844
  Examples
54572
54845
  # Check telemetry consent status for your logged in user
@@ -54787,6 +55060,7 @@ const baseCommands = [
54787
55060
  projectGroup,
54788
55061
  learnCommand,
54789
55062
  listProjectsCommand,
55063
+ createProjectCommand,
54790
55064
  codemodCommand,
54791
55065
  telemetryGroup,
54792
55066
  disableTelemetryCommand,
@@ -79346,7 +79620,7 @@ Learn what this means for your apps at https://www.sanity.io/blog/a-major-versio
79346
79620
  padding: 1,
79347
79621
  margin: 1
79348
79622
  });
79349
- context.output.print(boxedMessage);
79623
+ console.warn(boxedMessage);
79350
79624
  }
79351
79625
  class CommandRunner {
79352
79626
  handlers;