@sanity/cli 3.92.1-next.7.5a04a23c77 → 3.92.1-next.70.04dfd4f162

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.
Files changed (40) hide show
  1. package/codemods/partsTypeDirective.js +1 -2
  2. package/lib/_chunks-cjs/cli.js +210 -130
  3. package/lib/_chunks-cjs/cli.js.map +1 -1
  4. package/lib/_chunks-cjs/cliWorker.js.map +1 -1
  5. package/lib/_chunks-cjs/getCliConfig.js +4 -2
  6. package/lib/_chunks-cjs/getCliConfig.js.map +1 -1
  7. package/lib/_chunks-cjs/journeyConfig.js.map +1 -1
  8. package/lib/_chunks-cjs/loadEnv.js +10 -5
  9. package/lib/_chunks-cjs/loadEnv.js.map +1 -1
  10. package/lib/index.mjs.map +1 -1
  11. package/lib/workers/typegenGenerate.js +3 -4
  12. package/lib/workers/typegenGenerate.js.map +1 -1
  13. package/package.json +15 -13
  14. package/src/actions/codemod/codemodAction.ts +1 -1
  15. package/src/actions/codemod/mods/reactIconsV3.ts +1 -1
  16. package/src/actions/init-plugin/bootstrapFromTemplate.ts +2 -3
  17. package/src/actions/init-project/bootstrapLocalTemplate.ts +2 -2
  18. package/src/actions/init-project/git.ts +4 -4
  19. package/src/actions/init-project/initProject.ts +25 -13
  20. package/src/actions/init-project/readPackageJson.ts +1 -2
  21. package/src/actions/versions/findSanityModuleVersions.ts +1 -1
  22. package/src/cli.ts +3 -0
  23. package/src/commands/blueprints/addBlueprintsCommand.ts +32 -2
  24. package/src/commands/blueprints/initBlueprintsCommand.ts +23 -2
  25. package/src/commands/init/initCommand.ts +1 -1
  26. package/src/packageManager/installPackages.ts +33 -21
  27. package/src/util/cliWorker.ts +1 -1
  28. package/src/util/clientWrapper.ts +2 -2
  29. package/src/util/getCliConfig.ts +3 -3
  30. package/src/util/getLocalVersion.ts +1 -1
  31. package/src/util/journeyConfig.ts +2 -2
  32. package/src/util/remoteTemplate.ts +2 -2
  33. package/src/workers/typegenGenerate.ts +0 -1
  34. package/templates/blog/README.md +1 -1
  35. package/templates/clean/README.md +1 -1
  36. package/templates/ecommerce/README.md +1 -1
  37. package/templates/get-started/README.md +1 -1
  38. package/templates/moviedb/README.md +1 -1
  39. package/templates/quickstart/README.md +1 -1
  40. package/templates/.eslintrc +0 -8
@@ -1452,7 +1452,7 @@ function requireLodash() {
1452
1452
  if (isSymbol(value))
1453
1453
  return symbolToString ? symbolToString.call(value) : "";
1454
1454
  var result2 = value + "";
1455
- return result2 == "0" && 1 / value == -1 / 0 ? "-0" : result2;
1455
+ return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
1456
1456
  }
1457
1457
  function baseUniq(array, iteratee2, comparator) {
1458
1458
  var index = -1, includes2 = arrayIncludes, length = array.length, isCommon = !0, result2 = [], seen = result2;
@@ -2311,7 +2311,7 @@ function requireLodash() {
2311
2311
  if (typeof value == "string" || isSymbol(value))
2312
2312
  return value;
2313
2313
  var result2 = value + "";
2314
- return result2 == "0" && 1 / value == -1 / 0 ? "-0" : result2;
2314
+ return result2 == "0" && 1 / value == -INFINITY ? "-0" : result2;
2315
2315
  }
2316
2316
  function toSource(func) {
2317
2317
  if (func != null) {
@@ -3079,7 +3079,7 @@ function requireLodash() {
3079
3079
  }
3080
3080
  var isRegExp = nodeIsRegExp ? baseUnary(nodeIsRegExp) : baseIsRegExp;
3081
3081
  function isSafeInteger(value) {
3082
- return isInteger2(value) && value >= -9007199254740991 && value <= MAX_SAFE_INTEGER;
3082
+ return isInteger2(value) && value >= -MAX_SAFE_INTEGER && value <= MAX_SAFE_INTEGER;
3083
3083
  }
3084
3084
  var isSet = nodeIsSet ? baseUnary(nodeIsSet) : baseIsSet;
3085
3085
  function isString(value) {
@@ -3114,7 +3114,7 @@ function requireLodash() {
3114
3114
  function toFinite(value) {
3115
3115
  if (!value)
3116
3116
  return value === 0 ? value : 0;
3117
- if (value = toNumber(value), value === INFINITY || value === -1 / 0) {
3117
+ if (value = toNumber(value), value === INFINITY || value === -INFINITY) {
3118
3118
  var sign2 = value < 0 ? -1 : 1;
3119
3119
  return sign2 * MAX_INTEGER;
3120
3120
  }
@@ -3146,7 +3146,7 @@ function requireLodash() {
3146
3146
  return copyObject(value, keysIn(value));
3147
3147
  }
3148
3148
  function toSafeInteger(value) {
3149
- return value ? baseClamp(toInteger(value), -9007199254740991, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
3149
+ return value ? baseClamp(toInteger(value), -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER) : value === 0 ? value : 0;
3150
3150
  }
3151
3151
  function toString(value) {
3152
3152
  return value == null ? "" : baseToString(value);
@@ -3792,6 +3792,9 @@ Examples:
3792
3792
  # Add a Function with a specific type
3793
3793
  sanity blueprints add function --fn-type document-publish
3794
3794
 
3795
+ # Add a Function using an example
3796
+ sanity blueprints add function --example example-name
3797
+
3795
3798
  # Add a JavaScript Function
3796
3799
  sanity blueprints add function --js
3797
3800
 
@@ -3810,7 +3813,25 @@ Examples:
3810
3813
  signature: "<type> [--name <name>] [--fn-type <document-publish>] [--fn-lang <ts|js>] [--javascript]",
3811
3814
  description: "Add a Resource to a Blueprint",
3812
3815
  async action(args, context) {
3813
- const { output, apiClient } = context, flags = { ...defaultFlags$b, ...args.extOptions }, client2 = apiClient({
3816
+ const { output, apiClient } = context, { extOptions } = args;
3817
+ if (extOptions.example) {
3818
+ const foundConflict = [
3819
+ "name",
3820
+ "n",
3821
+ "fn-type",
3822
+ "fn-language",
3823
+ "lang",
3824
+ "javascript",
3825
+ "js",
3826
+ "fn-helpers",
3827
+ "helpers",
3828
+ "fn-installer",
3829
+ "installer"
3830
+ ].find((key2) => extOptions[key2]);
3831
+ if (foundConflict)
3832
+ throw new Error(`--example can't be used with --${foundConflict}`);
3833
+ }
3834
+ const flags = { ...defaultFlags$b, ...extOptions }, client2 = apiClient({
3814
3835
  requireUser: !0,
3815
3836
  requireProject: !1
3816
3837
  }), { token: token2 } = client2.config();
@@ -3832,6 +3853,7 @@ Examples:
3832
3853
  ...cmdConfig.value,
3833
3854
  args: { type: resourceType },
3834
3855
  flags: {
3856
+ example: flags.example,
3835
3857
  name: flags.n ?? flags.name,
3836
3858
  "fn-type": flags["fn-type"],
3837
3859
  language: flags.lang ?? flags["fn-language"],
@@ -4020,11 +4042,14 @@ Options
4020
4042
  --project-id <id> Project ID to use
4021
4043
 
4022
4044
  Examples:
4023
- # Create a new Blueprint manifest file in the current directory
4045
+ # Create a new Blueprint project in the current directory
4024
4046
  sanity blueprints init
4025
4047
 
4026
- # Create a new Blueprint manifest file in a specific directory
4048
+ # Create a new Blueprint project in a specific directory
4027
4049
  sanity blueprints init my-sanity-project --type json
4050
+
4051
+ # Create a new Blueprint project in a specific directory with an example
4052
+ sanity blueprints init --example example-name
4028
4053
  `, defaultFlags$6 = {
4029
4054
  //
4030
4055
  }, initBlueprintsCommand = {
@@ -4039,7 +4064,21 @@ Examples:
4039
4064
  requireProject: !1
4040
4065
  }), { token: token2 } = client2.config();
4041
4066
  if (!token2) throw new Error("No API token found. Please run `sanity login`.");
4042
- const { blueprintInitCore } = await import("@sanity/runtime-cli/cores/blueprints"), { success, error: error2 } = await blueprintInitCore({
4067
+ const { blueprintInitCore } = await import("@sanity/runtime-cli/cores/blueprints");
4068
+ if (flags.example) {
4069
+ const foundConflict = [
4070
+ "blueprint-type",
4071
+ "type",
4072
+ "stack-id",
4073
+ "stackId",
4074
+ "stack",
4075
+ "stack-name",
4076
+ "name"
4077
+ ].find((key2) => flags[key2]);
4078
+ if (foundConflict)
4079
+ throw new Error(`--example can't be used with --${foundConflict}`);
4080
+ }
4081
+ const { success, error: error2 } = await blueprintInitCore({
4043
4082
  bin: "sanity",
4044
4083
  log: (message) => output.print(message),
4045
4084
  token: token2,
@@ -4047,6 +4086,7 @@ Examples:
4047
4086
  dir: dir ?? flags.dir
4048
4087
  },
4049
4088
  flags: {
4089
+ example: flags.example,
4050
4090
  "blueprint-type": flags["blueprint-type"] ?? flags.type,
4051
4091
  "project-id": flags["project-id"] ?? flags.projectId ?? flags.project,
4052
4092
  "stack-id": flags["stack-id"] ?? flags.stackId ?? flags.stack,
@@ -7476,8 +7516,8 @@ function getClientWrapper(cliApiConfig, configPath) {
7476
7516
  const requester = client$1.requester.clone();
7477
7517
  return requester.use(authErrors()), function(opts) {
7478
7518
  const sanityEnv2 = process.env.SANITY_INTERNAL_ENV || "production", { requireUser, requireProject, api } = { ...defaults$1, ...opts }, token2 = getCliToken(), apiHost = apiHosts[sanityEnv2], apiConfig = {
7479
- ...cliApiConfig || {},
7480
- ...api || {}
7519
+ ...cliApiConfig,
7520
+ ...api
7481
7521
  };
7482
7522
  if (apiHost && (apiConfig.apiHost = apiHost), requireUser && !token2)
7483
7523
  throw new Error('You must login first - run "sanity login"');
@@ -13225,7 +13265,7 @@ function requireBraceExpansion$1() {
13225
13265
  if (!m || /\$$/.test(m.pre)) return [str2];
13226
13266
  var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body), isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body), isSequence = isNumericSequence || isAlphaSequence, isOptions = m.body.indexOf(",") >= 0;
13227
13267
  if (!isSequence && !isOptions)
13228
- return m.post.match(/,.*\}/) ? (str2 = m.pre + "{" + m.body + escClose + m.post, expand2(str2)) : [str2];
13268
+ return m.post.match(/,(?!,).*\}/) ? (str2 = m.pre + "{" + m.body + escClose + m.post, expand2(str2)) : [str2];
13229
13269
  var n;
13230
13270
  if (isSequence)
13231
13271
  n = m.body.split(/\.\./);
@@ -16211,7 +16251,7 @@ function requireBraceExpansion() {
16211
16251
  else {
16212
16252
  var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body), isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body), isSequence = isNumericSequence || isAlphaSequence, isOptions = m.body.indexOf(",") >= 0;
16213
16253
  if (!isSequence && !isOptions)
16214
- return m.post.match(/,.*\}/) ? (str2 = m.pre + "{" + m.body + escClose + m.post, expand2(str2)) : [str2];
16254
+ return m.post.match(/,(?!,).*\}/) ? (str2 = m.pre + "{" + m.body + escClose + m.post, expand2(str2)) : [str2];
16215
16255
  var n;
16216
16256
  if (isSequence)
16217
16257
  n = m.body.split(/\.\./);
@@ -19160,7 +19200,7 @@ function requireEndOfStream() {
19160
19200
  if (hasRequiredEndOfStream) return endOfStream;
19161
19201
  hasRequiredEndOfStream = 1;
19162
19202
  var once2 = requireOnce(), noop2 = function() {
19163
- }, isRequest = function(stream2) {
19203
+ }, qnt = loadEnv.commonjsGlobal.Bare ? queueMicrotask : process.nextTick.bind(process), isRequest = function(stream2) {
19164
19204
  return stream2.setHeader && typeof stream2.abort == "function";
19165
19205
  }, isChildProcess = function(stream2) {
19166
19206
  return stream2.stdio && Array.isArray(stream2.stdio) && stream2.stdio.length === 3;
@@ -19178,7 +19218,7 @@ function requireEndOfStream() {
19178
19218
  }, onerror = function(err) {
19179
19219
  callback.call(stream2, err);
19180
19220
  }, onclose = function() {
19181
- process.nextTick(onclosenexttick);
19221
+ qnt(onclosenexttick);
19182
19222
  }, onclosenexttick = function() {
19183
19223
  if (!cancelled) {
19184
19224
  if (readable && !(rs && rs.ended && !rs.destroyed)) return callback.call(stream2, new Error("premature close"));
@@ -19203,7 +19243,7 @@ function requirePump() {
19203
19243
  } catch {
19204
19244
  }
19205
19245
  var noop2 = function() {
19206
- }, ancient = /^v?\.0/.test(process.version), isFn = function(fn) {
19246
+ }, ancient = typeof process > "u" ? !1 : /^v?\.0/.test(process.version), isFn = function(fn) {
19207
19247
  return typeof fn == "function";
19208
19248
  }, isFS = function(stream2) {
19209
19249
  return !ancient || !fs2 ? !1 : (stream2 instanceof (fs2.ReadStream || noop2) || stream2 instanceof (fs2.WriteStream || noop2)) && isFn(stream2.close);
@@ -23522,23 +23562,23 @@ async function installDeclaredPackages(cwd, packageManager, context) {
23522
23562
  encoding: "utf8",
23523
23563
  env: getPartialEnvWithNpmPath(cwd),
23524
23564
  cwd,
23525
- stdio: "inherit"
23526
- }, npmArgs = ["install", "--legacy-peer-deps"];
23565
+ stdio: "pipe"
23566
+ };
23527
23567
  let result;
23528
- if (packageManager === "npm")
23529
- output.print(`Running 'npm ${npmArgs.join(" ")}'`), result = await execa("npm", npmArgs, execOptions);
23530
- else if (packageManager === "yarn") {
23531
- const yarnArgs = ["install"];
23532
- output.print(`Running 'yarn ${yarnArgs.join(" ")}'`), result = await execa("yarn", yarnArgs, execOptions);
23533
- } else if (packageManager === "pnpm") {
23534
- const pnpmArgs = ["install"];
23535
- output.print(`Running 'pnpm ${pnpmArgs.join(" ")}'`), result = await execa("pnpm", pnpmArgs, execOptions);
23536
- } else if (packageManager === "bun") {
23537
- const bunArgs = ["install"];
23538
- output.print(`Running 'bun ${bunArgs.join(" ")}'`), result = await execa("bun", bunArgs, execOptions);
23539
- } else packageManager === "manual" && output.print(`Manual installation selected - run 'npm ${npmArgs.join(" ")}' or similar`);
23540
- if (result?.exitCode || result?.failed)
23541
- throw new Error("Dependency installation failed");
23568
+ const installerArgs = {
23569
+ npm: ["install", "--legacy-peer-deps"],
23570
+ yarn: ["install"],
23571
+ pnpm: ["install"],
23572
+ bun: ["install"]
23573
+ };
23574
+ async function handleInstall(cmd, args) {
23575
+ const progress = output.spinner(`Running ${cmd} ${args.join(" ")}
23576
+ `).start();
23577
+ if (result = await execa(cmd, args, execOptions), result?.exitCode || result?.failed)
23578
+ throw progress.fail(), output.print(result.stdout), new Error("Dependency installation failed");
23579
+ progress.succeed();
23580
+ }
23581
+ packageManager === "manual" ? output.print(`Manual installation selected \u2014 run 'npm ${installerArgs.npm} or equivalent'`) : await handleInstall(packageManager, installerArgs[packageManager]);
23542
23582
  }
23543
23583
  async function installNewPackages(options2, context) {
23544
23584
  const { packageManager, packages } = options2, { output, workDir } = context, execOptions = {
@@ -23870,7 +23910,7 @@ async function getProjectDescription({
23870
23910
  isPlugin,
23871
23911
  outputDir
23872
23912
  }) {
23873
- if (!isSanityRoot)
23913
+ if (!(isSanityRoot && !isPlugin))
23874
23914
  return Promise.resolve("");
23875
23915
  try {
23876
23916
  const readmePath = path__default.default.join(outputDir, "README.md"), match2 = (await fs__default.default.readFile(readmePath, { encoding: "utf8" })).match(/^# .*?\n+(\w.*?)(?:$|\n)/);
@@ -33954,14 +33994,14 @@ function requireEsprima$1() {
33954
33994
  return !1;
33955
33995
  }, Parser2.prototype.parseGetterMethod = function() {
33956
33996
  var node = this.createNode(), isGenerator = !1, previousAllowYield = this.context.allowYield;
33957
- this.context.allowYield = !0;
33997
+ this.context.allowYield = !isGenerator;
33958
33998
  var formalParameters = this.parseFormalParameters();
33959
33999
  formalParameters.params.length > 0 && this.tolerateError(messages_1.Messages.BadGetterArity);
33960
34000
  var method = this.parsePropertyMethod(formalParameters);
33961
34001
  return this.context.allowYield = previousAllowYield, this.finalize(node, new Node.FunctionExpression(null, formalParameters.params, method, isGenerator));
33962
34002
  }, Parser2.prototype.parseSetterMethod = function() {
33963
34003
  var node = this.createNode(), isGenerator = !1, previousAllowYield = this.context.allowYield;
33964
- this.context.allowYield = !0;
34004
+ this.context.allowYield = !isGenerator;
33965
34005
  var formalParameters = this.parseFormalParameters();
33966
34006
  formalParameters.params.length !== 1 ? this.tolerateError(messages_1.Messages.BadSetterArity) : formalParameters.params[0] instanceof Node.RestElement && this.tolerateError(messages_1.Messages.BadSetterRestParameter);
33967
34007
  var method = this.parsePropertyMethod(formalParameters);
@@ -38135,9 +38175,6 @@ function requireLib$1() {
38135
38175
  }) => `\`${exportName}\` has already been exported. Exported identifiers must be unique.`,
38136
38176
  DuplicateProto: "Redefinition of __proto__ property.",
38137
38177
  DuplicateRegExpFlags: "Duplicate regular expression flag.",
38138
- DynamicImportPhaseRequiresImportExpressions: ({
38139
- phase
38140
- }) => `'import.${phase}(...)' can only be parsed when using the 'createImportExpressions' option.`,
38141
38178
  ElementAfterRest: "Rest element must be last element.",
38142
38179
  EscapedCharNotAnIdentifier: "Invalid Unicode escape.",
38143
38180
  ExportBindingIsString: ({
@@ -38288,7 +38325,7 @@ function requireLib$1() {
38288
38325
  unexpected
38289
38326
  }) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
38290
38327
  UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
38291
- UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script`.",
38328
+ UnexpectedUsingDeclaration: "Using declaration cannot appear in the top level when source type is `script` or in the bare case statement.",
38292
38329
  UnsupportedBind: "Binding should be performed on object property.",
38293
38330
  UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
38294
38331
  UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
@@ -38325,6 +38362,11 @@ function requireLib$1() {
38325
38362
  StrictNumericEscape: "The only valid numeric escape in strict mode is '\\0'.",
38326
38363
  StrictOctalLiteral: "Legacy octal literals are not allowed in strict mode.",
38327
38364
  StrictWith: "'with' in strict mode."
38365
+ }, ParseExpressionErrors = {
38366
+ ParseExpressionEmptyInput: "Unexpected parseExpression() input: The input is empty or contains only comments.",
38367
+ ParseExpressionExpectsEOF: ({
38368
+ unexpected
38369
+ }) => `Unexpected parseExpression() input: The input should contain exactly one expression, but the first expression is followed by the unexpected character \`${String.fromCodePoint(unexpected)}\`.`
38328
38370
  };
38329
38371
  const UnparenthesizedPipeBodyDescriptions = /* @__PURE__ */ new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
38330
38372
  var PipelineOperatorErrors = Object.assign({
@@ -38421,7 +38463,7 @@ function requireLib$1() {
38421
38463
  }
38422
38464
  return ParseErrorConstructors;
38423
38465
  }
38424
- const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
38466
+ const Errors = Object.assign({}, ParseErrorEnum(ModuleErrors), ParseErrorEnum(StandardErrors), ParseErrorEnum(StrictModeErrors), ParseErrorEnum(ParseExpressionErrors), ParseErrorEnum`pipelineOperator`(PipelineOperatorErrors));
38425
38467
  function createDefaultOptions() {
38426
38468
  return {
38427
38469
  sourceType: "script",
@@ -39294,13 +39336,16 @@ function requireLib$1() {
39294
39336
  } = this.scopeStack[i];
39295
39337
  if (flags & 128)
39296
39338
  return !0;
39297
- if (flags & 451)
39339
+ if (flags & 707)
39298
39340
  return !1;
39299
39341
  }
39300
39342
  }
39301
39343
  get inNonArrowFunction() {
39302
39344
  return (this.currentThisScopeFlags() & 2) > 0;
39303
39345
  }
39346
+ get inBareCaseStatement() {
39347
+ return (this.currentScope().flags & 256) > 0;
39348
+ }
39304
39349
  get treatFunctionsAsVar() {
39305
39350
  return this.treatFunctionsAsVarInScope(this.currentScope());
39306
39351
  }
@@ -39323,7 +39368,7 @@ function requireLib$1() {
39323
39368
  let type2 = scope2.names.get(name) || 0;
39324
39369
  bindingType & 16 ? type2 = type2 | 4 : (scope2.firstLexicalName || (scope2.firstLexicalName = name), type2 = type2 | 2), scope2.names.set(name, type2), bindingType & 8 && this.maybeExportDefined(scope2, name);
39325
39370
  } else if (bindingType & 4)
39326
- 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 & 387)); --i)
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)
39327
39372
  ;
39328
39373
  this.parser.inModule && scope2.flags & 1 && this.undefinedExports.delete(name);
39329
39374
  }
@@ -39356,7 +39401,7 @@ function requireLib$1() {
39356
39401
  const {
39357
39402
  flags
39358
39403
  } = this.scopeStack[i];
39359
- if (flags & 387)
39404
+ if (flags & 643)
39360
39405
  return flags;
39361
39406
  }
39362
39407
  }
@@ -39365,7 +39410,7 @@ function requireLib$1() {
39365
39410
  const {
39366
39411
  flags
39367
39412
  } = this.scopeStack[i];
39368
- if (flags & 451 && !(flags & 4))
39413
+ if (flags & 707 && !(flags & 4))
39369
39414
  return flags;
39370
39415
  }
39371
39416
  }
@@ -41368,11 +41413,11 @@ function requireLib$1() {
41368
41413
  return this.importsStack.push(/* @__PURE__ */ new Set()), new TypeScriptScope(flags);
41369
41414
  }
41370
41415
  enter(flags) {
41371
- flags === 256 && this.importsStack.push(/* @__PURE__ */ new Set()), super.enter(flags);
41416
+ flags === 512 && this.importsStack.push(/* @__PURE__ */ new Set()), super.enter(flags);
41372
41417
  }
41373
41418
  exit() {
41374
41419
  const flags = super.exit();
41375
- return flags === 256 && this.importsStack.pop(), flags;
41420
+ return flags === 512 && this.importsStack.pop(), flags;
41376
41421
  }
41377
41422
  hasImport(name, allowShadow) {
41378
41423
  const len = this.importsStack.length;
@@ -41527,6 +41572,7 @@ function requireLib$1() {
41527
41572
  }
41528
41573
  }
41529
41574
  finalizeComment(commentWS) {
41575
+ var _node$options;
41530
41576
  const {
41531
41577
  comments: comments2
41532
41578
  } = commentWS;
@@ -41548,6 +41594,9 @@ function requireLib$1() {
41548
41594
  case "OptionalCallExpression":
41549
41595
  adjustInnerComments(node, node.arguments, commentWS);
41550
41596
  break;
41597
+ case "ImportExpression":
41598
+ adjustInnerComments(node, [node.source, (_node$options = node.options) != null ? _node$options : null], commentWS);
41599
+ break;
41551
41600
  case "FunctionDeclaration":
41552
41601
  case "FunctionExpression":
41553
41602
  case "ArrowFunctionExpression":
@@ -41596,14 +41645,6 @@ function requireLib$1() {
41596
41645
  const commentWS = commentStack[length - 1];
41597
41646
  commentWS.leadingNode === node && (commentWS.leadingNode = null);
41598
41647
  }
41599
- resetPreviousIdentifierLeadingComments(node) {
41600
- const {
41601
- commentStack
41602
- } = this.state, {
41603
- length
41604
- } = commentStack;
41605
- length !== 0 && (commentStack[length - 1].trailingNode === node ? commentStack[length - 1].trailingNode = null : length >= 2 && commentStack[length - 2].trailingNode === node && (commentStack[length - 2].trailingNode = null));
41606
- }
41607
41648
  takeSurroundingComments(node, start, end) {
41608
41649
  const {
41609
41650
  commentStack
@@ -43297,7 +43338,7 @@ function requireLib$1() {
43297
43338
  DeclareFunctionHasImplementation: "An implementation cannot be declared in ambient contexts.",
43298
43339
  DuplicateAccessibilityModifier: ({
43299
43340
  modifier
43300
- }) => "Accessibility modifier already seen.",
43341
+ }) => `Accessibility modifier already seen: '${modifier}'.`,
43301
43342
  DuplicateModifier: ({
43302
43343
  modifier
43303
43344
  }) => `Duplicate modifier: '${modifier}'.`,
@@ -43323,6 +43364,7 @@ function requireLib$1() {
43323
43364
  InvalidHeritageClauseType: ({
43324
43365
  token: token2
43325
43366
  }) => `'${token2}' list can only include identifiers or qualified-names with optional type arguments.`,
43367
+ InvalidModifierOnAwaitUsingDeclaration: (modifier) => `'${modifier}' modifier cannot appear on an await using declaration.`,
43326
43368
  InvalidModifierOnTypeMember: ({
43327
43369
  modifier
43328
43370
  }) => `'${modifier}' modifier cannot appear on a type member.`,
@@ -43332,6 +43374,7 @@ function requireLib$1() {
43332
43374
  InvalidModifierOnTypeParameterPositions: ({
43333
43375
  modifier
43334
43376
  }) => `'${modifier}' modifier can only appear on a type parameter of a class, interface or type alias.`,
43377
+ InvalidModifierOnUsingDeclaration: (modifier) => `'${modifier}' modifier cannot appear on a using declaration.`,
43335
43378
  InvalidModifiersOrder: ({
43336
43379
  orderedModifiers
43337
43380
  }) => `'${orderedModifiers[0]}' modifier must precede '${orderedModifiers[1]}' modifier.`,
@@ -43339,7 +43382,7 @@ function requireLib$1() {
43339
43382
  InvalidTupleMemberLabel: "Tuple members must be labeled with a simple identifier.",
43340
43383
  MissingInterfaceName: "'interface' declarations must be followed by an identifier.",
43341
43384
  NonAbstractClassHasAbstractMethod: "Abstract methods can only appear within an abstract class.",
43342
- NonClassMethodPropertyHasAbstractModifer: "'abstract' modifier can only appear on a class, method, or property declaration.",
43385
+ NonClassMethodPropertyHasAbstractModifier: "'abstract' modifier can only appear on a class, method, or property declaration.",
43343
43386
  OptionalTypeBeforeRequired: "A required element cannot follow an optional element.",
43344
43387
  OverrideNotInSubClass: "This member cannot have an 'override' modifier because its containing class does not extend another class.",
43345
43388
  PatternIsOptional: "A binding pattern parameter cannot be optional in an implementation signature.",
@@ -43435,12 +43478,12 @@ function requireLib$1() {
43435
43478
  tsNextTokenCanFollowModifier() {
43436
43479
  return this.match(106) ? (this.next(), this.tsTokenCanFollowModifier()) : this.tsNextTokenOnSameLineAndCanFollowModifier();
43437
43480
  }
43438
- tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock) {
43481
+ tsParseModifier(allowedModifiers, stopOnStartOfClassStaticBlock, hasSeenStaticModifier) {
43439
43482
  if (!tokenIsIdentifier(this.state.type) && this.state.type !== 58 && this.state.type !== 75)
43440
43483
  return;
43441
43484
  const modifier = this.state.value;
43442
43485
  if (allowedModifiers.includes(modifier)) {
43443
- if (stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks())
43486
+ if (hasSeenStaticModifier && this.match(106) || stopOnStartOfClassStaticBlock && this.tsIsStartOfStaticBlocks())
43444
43487
  return;
43445
43488
  if (this.tsTryParse(this.tsNextTokenCanFollowModifier.bind(this)))
43446
43489
  return modifier;
@@ -43464,7 +43507,7 @@ function requireLib$1() {
43464
43507
  for (; ; ) {
43465
43508
  const {
43466
43509
  startLoc
43467
- } = this.state, modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers ?? []), stopOnStartOfClassStaticBlock);
43510
+ } = this.state, modifier = this.tsParseModifier(allowedModifiers.concat(disallowedModifiers ?? []), stopOnStartOfClassStaticBlock, modified.static);
43468
43511
  if (!modifier) break;
43469
43512
  tsIsAccessModifier(modifier) ? modified.accessibility ? this.raise(TSErrors.DuplicateAccessibilityModifier, startLoc, {
43470
43513
  modifier
@@ -44054,11 +44097,11 @@ function requireLib$1() {
44054
44097
  const inner = this.startNode();
44055
44098
  this.tsParseModuleOrNamespaceDeclaration(inner, !0), node.body = inner;
44056
44099
  } else
44057
- this.scope.enter(256), this.prodParam.enter(0), node.body = this.tsParseModuleBlock(), this.prodParam.exit(), this.scope.exit();
44100
+ this.scope.enter(512), this.prodParam.enter(0), node.body = this.tsParseModuleBlock(), this.prodParam.exit(), this.scope.exit();
44058
44101
  return this.finishNode(node, "TSModuleDeclaration");
44059
44102
  }
44060
44103
  tsParseAmbientExternalModuleDeclaration(node) {
44061
- 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(256), this.prodParam.enter(0), node.body = this.tsParseModuleBlock(), this.prodParam.exit(), this.scope.exit()) : this.semicolon(), this.finishNode(node, "TSModuleDeclaration");
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");
44062
44105
  }
44063
44106
  tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) {
44064
44107
  node.isExport = isExport || !1, node.id = maybeDefaultIdentifier || this.parseIdentifier(), this.checkIdentifier(node.id, 4096), this.expect(29);
@@ -44090,37 +44133,48 @@ function requireLib$1() {
44090
44133
  return result;
44091
44134
  this.state = state;
44092
44135
  }
44093
- tsTryParseDeclare(nany) {
44136
+ tsTryParseDeclare(node) {
44094
44137
  if (this.isLineTerminator())
44095
44138
  return;
44096
- let startType = this.state.type, kind;
44097
- return this.isContextual(100) && (startType = 74, kind = "let"), this.tsInAmbientContext(() => {
44139
+ const startType = this.state.type;
44140
+ return this.tsInAmbientContext(() => {
44098
44141
  switch (startType) {
44099
44142
  case 68:
44100
- return nany.declare = !0, super.parseFunctionStatement(nany, !1, !1);
44143
+ return node.declare = !0, super.parseFunctionStatement(node, !1, !1);
44101
44144
  case 80:
44102
- return nany.declare = !0, this.parseClass(nany, !0, !1);
44145
+ return node.declare = !0, this.parseClass(node, !0, !1);
44103
44146
  case 126:
44104
- return this.tsParseEnumDeclaration(nany, {
44147
+ return this.tsParseEnumDeclaration(node, {
44105
44148
  declare: !0
44106
44149
  });
44107
44150
  case 112:
44108
- return this.tsParseAmbientExternalModuleDeclaration(nany);
44151
+ return this.tsParseAmbientExternalModuleDeclaration(node);
44152
+ case 100:
44153
+ if (this.state.containsEsc)
44154
+ return;
44109
44155
  case 75:
44110
44156
  case 74:
44111
- return !this.match(75) || !this.isLookaheadContextual("enum") ? (nany.declare = !0, this.parseVarStatement(nany, kind || this.state.value, !0)) : (this.expect(75), this.tsParseEnumDeclaration(nany, {
44157
+ return !this.match(75) || !this.isLookaheadContextual("enum") ? (node.declare = !0, this.parseVarStatement(node, this.state.value, !0)) : (this.expect(75), this.tsParseEnumDeclaration(node, {
44112
44158
  const: !0,
44113
44159
  declare: !0
44114
44160
  }));
44161
+ case 107:
44162
+ if (this.hasPlugin("explicitResourceManagement") && this.isUsing())
44163
+ return this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare"), node.declare = !0, this.parseVarStatement(node, "using", !0);
44164
+ break;
44165
+ case 96:
44166
+ if (this.hasPlugin("explicitResourceManagement") && this.isAwaitUsing())
44167
+ return this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare"), node.declare = !0, this.next(), this.parseVarStatement(node, "await using", !0);
44168
+ break;
44115
44169
  case 129: {
44116
- const result = this.tsParseInterfaceDeclaration(nany, {
44170
+ const result = this.tsParseInterfaceDeclaration(node, {
44117
44171
  declare: !0
44118
44172
  });
44119
44173
  if (result) return result;
44120
44174
  }
44121
44175
  default:
44122
44176
  if (tokenIsIdentifier(startType))
44123
- return this.tsParseDeclaration(nany, this.state.value, !0, null);
44177
+ return this.tsParseDeclaration(node, this.state.value, !0, null);
44124
44178
  }
44125
44179
  });
44126
44180
  }
@@ -44135,7 +44189,7 @@ function requireLib$1() {
44135
44189
  }
44136
44190
  case "global":
44137
44191
  if (this.match(5)) {
44138
- this.scope.enter(256), this.prodParam.enter(0);
44192
+ this.scope.enter(512), this.prodParam.enter(0);
44139
44193
  const mod = node;
44140
44194
  return mod.kind = "global", node.global = !0, mod.id = expr, mod.body = this.tsParseModuleBlock(), this.scope.exit(), this.prodParam.exit(), this.finishNode(mod, "TSModuleDeclaration");
44141
44195
  }
@@ -44377,7 +44431,7 @@ function requireLib$1() {
44377
44431
  id,
44378
44432
  init
44379
44433
  } of declaration.declarations)
44380
- init && (kind !== "const" || id.typeAnnotation ? this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init) : isValidAmbientConstInitializer(init, this.hasPlugin("estree")) || this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init));
44434
+ init && (kind === "var" || kind === "let" || id.typeAnnotation ? this.raise(TSErrors.InitializerNotAllowedInAmbientContext, init) : isValidAmbientConstInitializer(init, this.hasPlugin("estree")) || this.raise(TSErrors.ConstInitializerMustBeStringOrNumericLiteralOrLiteralEnumReference, init));
44381
44435
  return declaration;
44382
44436
  }
44383
44437
  parseStatementContent(flags, decorators) {
@@ -44762,7 +44816,7 @@ function requireLib$1() {
44762
44816
  return node.abstract = !0, this.maybeTakeDecorators(decorators, this.parseClass(node, !0, !1));
44763
44817
  if (this.isContextual(129)) {
44764
44818
  if (!this.hasFollowingLineBreak())
44765
- return node.abstract = !0, this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifer, node), this.tsParseInterfaceDeclaration(node);
44819
+ return node.abstract = !0, this.raise(TSErrors.NonClassMethodPropertyHasAbstractModifier, node), this.tsParseInterfaceDeclaration(node);
44766
44820
  } else
44767
44821
  this.unexpected(null, 80);
44768
44822
  }
@@ -45156,9 +45210,14 @@ function requireLib$1() {
45156
45210
  return expr.type === "ArrowFunctionExpression" && this.offsetToSourcePos(expr.start) === potentialArrowAt;
45157
45211
  }
45158
45212
  getExpression() {
45159
- this.enterInitialScopes(), this.nextToken();
45213
+ if (this.enterInitialScopes(), this.nextToken(), this.match(140))
45214
+ throw this.raise(Errors.ParseExpressionEmptyInput, this.state.startLoc);
45160
45215
  const expr = this.parseExpression();
45161
- return this.match(140) || this.unexpected(), this.finalizeRemainingComments(), expr.comments = this.comments, expr.errors = this.state.errors, this.optionFlags & 256 && (expr.tokens = this.tokens), expr;
45216
+ if (!this.match(140))
45217
+ throw this.raise(Errors.ParseExpressionExpectsEOF, this.state.startLoc, {
45218
+ unexpected: this.input.codePointAt(this.state.start)
45219
+ });
45220
+ return this.finalizeRemainingComments(), expr.comments = this.comments, expr.errors = this.state.errors, this.optionFlags & 256 && (expr.tokens = this.tokens), expr;
45162
45221
  }
45163
45222
  parseExpression(disallowIn, refExpressionErrors) {
45164
45223
  return disallowIn ? this.disallowInAnd(() => this.parseExpressionBase(refExpressionErrors)) : this.allowInAnd(() => this.parseExpressionBase(refExpressionErrors));
@@ -45458,7 +45517,7 @@ function requireLib$1() {
45458
45517
  case 79:
45459
45518
  return this.parseSuper();
45460
45519
  case 83:
45461
- return node = this.startNode(), this.next(), this.match(16) ? this.parseImportMetaProperty(node) : this.match(10) ? this.optionFlags & 512 ? this.parseImportCall(node) : this.finishNode(node, "Import") : (this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc), this.finishNode(node, "Import"));
45520
+ return node = this.startNode(), this.next(), this.match(16) ? this.parseImportMetaPropertyOrPhaseCall(node) : this.match(10) ? this.optionFlags & 512 ? this.parseImportCall(node) : this.finishNode(node, "Import") : (this.raise(Errors.UnsupportedImport, this.state.lastTokStartLoc), this.finishNode(node, "Import"));
45462
45521
  case 78:
45463
45522
  return node = this.startNode(), this.next(), this.finishNode(node, "ThisExpression");
45464
45523
  case 90:
@@ -45621,19 +45680,14 @@ function requireLib$1() {
45621
45680
  onlyValidPropertyName: propertyName
45622
45681
  }), this.finishNode(node, "MetaProperty");
45623
45682
  }
45624
- parseImportMetaProperty(node) {
45625
- const id = this.createIdentifier(this.startNodeAtNode(node), "import");
45626
- if (this.next(), this.isContextual(101))
45627
- this.inModule || this.raise(Errors.ImportMetaOutsideModule, id), this.sawUnambiguousESM = !0;
45628
- else if (this.isContextual(105) || this.isContextual(97)) {
45683
+ parseImportMetaPropertyOrPhaseCall(node) {
45684
+ if (this.next(), this.isContextual(105) || this.isContextual(97)) {
45629
45685
  const isSource = this.isContextual(105);
45630
- if (this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation"), !(this.optionFlags & 512))
45631
- throw this.raise(Errors.DynamicImportPhaseRequiresImportExpressions, this.state.startLoc, {
45632
- phase: this.state.value
45633
- });
45634
- return this.next(), node.phase = isSource ? "source" : "defer", this.parseImportCall(node);
45686
+ return this.expectPlugin(isSource ? "sourcePhaseImports" : "deferredImportEvaluation"), this.next(), node.phase = isSource ? "source" : "defer", this.parseImportCall(node);
45687
+ } else {
45688
+ const id = this.createIdentifierAt(this.startNodeAtNode(node), "import", this.state.lastTokStartLoc);
45689
+ return this.isContextual(101) && (this.inModule || this.raise(Errors.ImportMetaOutsideModule, id), this.sawUnambiguousESM = !0), this.parseMetaProperty(node, id, "meta");
45635
45690
  }
45636
- return this.parseMetaProperty(node, id, "meta");
45637
45691
  }
45638
45692
  parseLiteralAtNode(value, type2, node) {
45639
45693
  return this.addExtra(node, "rawValue", value), this.addExtra(node, "raw", this.input.slice(this.offsetToSourcePos(node.start), this.state.end)), node.value = value, this.next(), this.finishNode(node, type2);
@@ -45981,6 +46035,9 @@ function requireLib$1() {
45981
46035
  createIdentifier(node, name) {
45982
46036
  return node.name = name, node.loc.identifierName = name, this.finishNode(node, "Identifier");
45983
46037
  }
46038
+ createIdentifierAt(node, name, endLoc) {
46039
+ return node.name = name, node.loc.identifierName = name, this.finishNodeAt(node, "Identifier", endLoc);
46040
+ }
45984
46041
  parseIdentifierName(liberal) {
45985
46042
  let name;
45986
46043
  const {
@@ -46061,11 +46118,15 @@ function requireLib$1() {
46061
46118
  return node.delegate = delegating, node.argument = argument, this.finishNode(node, "YieldExpression");
46062
46119
  }
46063
46120
  parseImportCall(node) {
46064
- if (this.next(), node.source = this.parseMaybeAssignAllowIn(), node.options = null, this.eat(12) && !this.match(11) && (node.options = this.parseMaybeAssignAllowIn(), this.eat(12) && !this.match(11))) {
46065
- do
46066
- this.parseMaybeAssignAllowIn();
46067
- while (this.eat(12) && !this.match(11));
46068
- this.raise(Errors.ImportCallArity, node);
46121
+ if (this.next(), node.source = this.parseMaybeAssignAllowIn(), node.options = null, this.eat(12)) {
46122
+ if (this.match(11))
46123
+ this.addTrailingCommaExtraToNode(node.source);
46124
+ else if (node.options = this.parseMaybeAssignAllowIn(), this.eat(12) && (this.addTrailingCommaExtraToNode(node.options), !this.match(11))) {
46125
+ do
46126
+ this.parseMaybeAssignAllowIn();
46127
+ while (this.eat(12) && !this.match(11));
46128
+ this.raise(Errors.ImportCallArity, node);
46129
+ }
46069
46130
  }
46070
46131
  return this.expect(11), this.finishNode(node, "ImportExpression");
46071
46132
  }
@@ -46314,6 +46375,24 @@ function requireLib$1() {
46314
46375
  isLet() {
46315
46376
  return this.isContextual(100) ? this.hasFollowingBindingAtom() : !1;
46316
46377
  }
46378
+ isUsing() {
46379
+ if (!this.isContextual(107))
46380
+ return !1;
46381
+ const next = this.nextTokenInLineStart(), nextCh = this.codePointAtPos(next);
46382
+ return this.chStartsBindingIdentifier(nextCh, next);
46383
+ }
46384
+ isAwaitUsing() {
46385
+ if (!this.isContextual(96))
46386
+ return !1;
46387
+ let next = this.nextTokenInLineStart();
46388
+ if (this.isUnparsedContextual(next, "using")) {
46389
+ next = this.nextTokenInLineStartSince(next + 5);
46390
+ const nextCh = this.codePointAtPos(next);
46391
+ if (this.chStartsBindingIdentifier(nextCh, next))
46392
+ return this.expectPlugin("explicitResourceManagement"), !0;
46393
+ }
46394
+ return !1;
46395
+ }
46317
46396
  chStartsBindingIdentifier(ch, pos2) {
46318
46397
  if (isIdentifierStart(ch)) {
46319
46398
  if (keywordRelationalOperator.lastIndex = pos2, keywordRelationalOperator.test(this.input)) {
@@ -46348,15 +46427,8 @@ function requireLib$1() {
46348
46427
  }
46349
46428
  return tokenIsIdentifier(type2) && !this.hasFollowingLineBreak() ? (this.expectPlugin("explicitResourceManagement"), !0) : !1;
46350
46429
  }
46351
- startsAwaitUsing() {
46352
- let next = this.nextTokenInLineStart();
46353
- if (this.isUnparsedContextual(next, "using")) {
46354
- next = this.nextTokenInLineStartSince(next + 5);
46355
- const nextCh = this.codePointAtPos(next);
46356
- if (this.chStartsBindingIdentifier(nextCh, next))
46357
- return this.expectPlugin("explicitResourceManagement"), !0;
46358
- }
46359
- return !1;
46430
+ allowsUsing() {
46431
+ return (this.scope.inModule || !this.scope.inTopLevel) && !this.scope.inBareCaseStatement;
46360
46432
  }
46361
46433
  parseModuleItem() {
46362
46434
  return this.parseStatementLike(15);
@@ -46404,13 +46476,13 @@ function requireLib$1() {
46404
46476
  case 73:
46405
46477
  return this.parseTryStatement(node);
46406
46478
  case 96:
46407
- if (!this.state.containsEsc && this.startsAwaitUsing())
46408
- return this.recordAwaitIfAllowed() ? allowDeclaration || this.raise(Errors.UnexpectedLexicalDeclaration, node) : this.raise(Errors.AwaitUsingNotInAsyncContext, node), this.next(), this.parseVarStatement(node, "await using");
46479
+ if (this.isAwaitUsing())
46480
+ return this.allowsUsing() ? allowDeclaration ? this.recordAwaitIfAllowed() || this.raise(Errors.AwaitUsingNotInAsyncContext, node) : this.raise(Errors.UnexpectedLexicalDeclaration, node) : this.raise(Errors.UnexpectedUsingDeclaration, node), this.next(), this.parseVarStatement(node, "await using");
46409
46481
  break;
46410
46482
  case 107:
46411
46483
  if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace())
46412
46484
  break;
46413
- return this.expectPlugin("explicitResourceManagement"), !this.scope.inModule && this.scope.inTopLevel ? this.raise(Errors.UnexpectedUsingDeclaration, this.state.startLoc) : allowDeclaration || this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc), this.parseVarStatement(node, "using");
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");
46414
46486
  case 100: {
46415
46487
  if (this.state.containsEsc)
46416
46488
  break;
@@ -46540,7 +46612,7 @@ function requireLib$1() {
46540
46612
  return awaitAt !== null && this.unexpected(awaitAt), this.parseFor(node, null);
46541
46613
  const startsWithLet = this.isContextual(100);
46542
46614
  {
46543
- const startsWithAwaitUsing = this.isContextual(96) && this.startsAwaitUsing(), starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(107) && this.allowsForUsing(), isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
46615
+ const startsWithAwaitUsing = this.isAwaitUsing(), starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(107) && this.allowsForUsing(), isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
46544
46616
  if (this.match(74) || this.match(75) || isLetOrUsing) {
46545
46617
  const initNode = this.startNode();
46546
46618
  let kind;
@@ -46572,7 +46644,7 @@ function requireLib$1() {
46572
46644
  parseSwitchStatement(node) {
46573
46645
  this.next(), node.discriminant = this.parseHeaderExpression();
46574
46646
  const cases = node.cases = [];
46575
- this.expect(5), this.state.labels.push(switchLabel), this.scope.enter(0);
46647
+ this.expect(5), this.state.labels.push(switchLabel), this.scope.enter(256);
46576
46648
  let cur;
46577
46649
  for (let sawDefault; !this.match(8); )
46578
46650
  if (this.match(61) || this.match(65)) {
@@ -46782,7 +46854,7 @@ function requireLib$1() {
46782
46854
  if (member.static = isStatic, this.parsePropertyNamePrefixOperator(member), this.eat(55)) {
46783
46855
  method.kind = "method";
46784
46856
  const isPrivateName = this.match(139);
46785
- if (this.parseClassElementName(method), isPrivateName) {
46857
+ if (this.parseClassElementName(method), this.parsePostMemberNameModifiers(method), isPrivateName) {
46786
46858
  this.pushClassPrivateMethod(classBody, privateMethod, !0, !1);
46787
46859
  return;
46788
46860
  }
@@ -46967,7 +47039,7 @@ function requireLib$1() {
46967
47039
  return this.parseClass(expr, !0, !0);
46968
47040
  if (this.match(26))
46969
47041
  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);
46970
- if (this.match(75) || this.match(74) || this.isLet())
47042
+ if (this.match(75) || this.match(74) || this.isLet() || this.hasPlugin("explicitResourceManagement") && (this.isUsing() || this.isAwaitUsing()))
46971
47043
  throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
46972
47044
  const res = this.parseMaybeAssignAllowIn();
46973
47045
  return this.semicolon(), res;
@@ -47007,7 +47079,15 @@ function requireLib$1() {
47007
47079
  const {
47008
47080
  type: type2
47009
47081
  } = this.state;
47010
- 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.isContextual(107) ? (this.raise(Errors.UsingDeclarationExport, this.state.startLoc), !0) : this.isContextual(96) && this.startsAwaitUsing() ? (this.raise(Errors.UsingDeclarationExport, this.state.startLoc), !0) : type2 === 74 || type2 === 75 || type2 === 68 || type2 === 80 || this.isLet() || this.isAsyncFunction();
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();
47011
47091
  }
47012
47092
  checkExport(node, checkNames, isDefault, isFrom) {
47013
47093
  if (checkNames) {
@@ -47130,10 +47210,10 @@ function requireLib$1() {
47130
47210
  parseMaybeImportPhase(node, isExport) {
47131
47211
  if (!this.isPotentialImportPhase(isExport))
47132
47212
  return this.applyImportPhase(node, isExport, null), null;
47133
- const phaseIdentifier = this.parseIdentifier(!0), {
47213
+ const phaseIdentifier = this.startNode(), phaseIdentifierName = this.parseIdentifierName(!0), {
47134
47214
  type: type2
47135
47215
  } = this.state;
47136
- return (tokenIsKeywordOrIdentifier(type2) ? type2 !== 98 || this.lookaheadCharCode() === 102 : type2 !== 12) ? (this.resetPreviousIdentifierLeadingComments(phaseIdentifier), this.applyImportPhase(node, isExport, phaseIdentifier.name, phaseIdentifier.loc.start), null) : (this.applyImportPhase(node, isExport, null), phaseIdentifier);
47216
+ return (tokenIsKeywordOrIdentifier(type2) ? type2 !== 98 || this.lookaheadCharCode() === 102 : type2 !== 12) ? (this.applyImportPhase(node, isExport, phaseIdentifierName, phaseIdentifier.loc.start), null) : (this.applyImportPhase(node, isExport, null), this.createIdentifier(phaseIdentifier, phaseIdentifierName));
47137
47217
  }
47138
47218
  isPrecedingIdImportPhase(phase) {
47139
47219
  const {
@@ -47844,8 +47924,8 @@ async function bootstrapLocalTemplate(opts, context) {
47844
47924
  const dependencyVersions = await resolveLatestVersions({
47845
47925
  ...isAppTemplate ? {} : studioDependencies.dependencies,
47846
47926
  ...isAppTemplate ? {} : studioDependencies.devDependencies,
47847
- ...template.dependencies || {},
47848
- ...template.devDependencies || {}
47927
+ ...template.dependencies,
47928
+ ...template.devDependencies
47849
47929
  });
47850
47930
  spinner.succeed();
47851
47931
  const dependencies = Object.keys({
@@ -48313,7 +48393,7 @@ class AST {
48313
48393
  const s = this.toString();
48314
48394
  return this.#parts = [s], this.type = null, this.#hasMagic = void 0, [s, unescape(this.toString()), !1, !1];
48315
48395
  }
48316
- let bodyDotAllowed = !repeated || allowDot || dot ? "" : this.#partsToRegExp(!0);
48396
+ let bodyDotAllowed = !repeated || allowDot || dot || !startNoDot ? "" : this.#partsToRegExp(!0);
48317
48397
  bodyDotAllowed === body && (bodyDotAllowed = ""), bodyDotAllowed && (body = `(?:${body})(?:${bodyDotAllowed})*?`);
48318
48398
  let final = "";
48319
48399
  if (this.type === "!" && this.#emptyExt)
@@ -50291,7 +50371,7 @@ const realpathSync = require$$0$4.realpathSync.native, defaultFS = {
50291
50371
  ...defaultFS.promises,
50292
50372
  ...fsOption.promises || {}
50293
50373
  }
50294
- }, uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i, uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\"), eitherSep = /[\\\/]/, UNKNOWN = 0, IFIFO = 1, IFCHR = 2, IFDIR = 4, IFBLK = 6, IFREG = 8, IFLNK = 10, IFSOCK = 12, IFMT = 15, IFMT_UNKNOWN = -16, READDIR_CALLED = 16, LSTAT_CALLED = 32, ENOTDIR = 64, ENOENT = 128, ENOREADLINK = 256, ENOREALPATH = 512, ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH, TYPEMASK = 1023, entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN, normalizeCache = /* @__PURE__ */ new Map(), normalize = (s) => {
50374
+ }, uncDriveRegexp = /^\\\\\?\\([a-z]:)\\?$/i, uncToDrive = (rootPath) => rootPath.replace(/\//g, "\\").replace(uncDriveRegexp, "$1\\"), eitherSep = /[\\\/]/, UNKNOWN = 0, IFIFO = 1, IFCHR = 2, IFDIR = 4, IFBLK = 6, IFREG = 8, IFLNK = 10, IFSOCK = 12, IFMT = 15, IFMT_UNKNOWN = ~IFMT, READDIR_CALLED = 16, LSTAT_CALLED = 32, ENOTDIR = 64, ENOENT = 128, ENOREADLINK = 256, ENOREALPATH = 512, ENOCHILD = ENOTDIR | ENOENT | ENOREALPATH, TYPEMASK = 1023, entToType = (s) => s.isFile() ? IFREG : s.isDirectory() ? IFDIR : s.isSymbolicLink() ? IFLNK : s.isCharacterDevice() ? IFCHR : s.isBlockDevice() ? IFBLK : s.isSocket() ? IFSOCK : s.isFIFO() ? IFIFO : UNKNOWN, normalizeCache = /* @__PURE__ */ new Map(), normalize = (s) => {
50295
50375
  const c2 = normalizeCache.get(s);
50296
50376
  if (c2)
50297
50377
  return c2;
@@ -50510,7 +50590,7 @@ class PathBase {
50510
50590
  if (cached)
50511
50591
  return cached;
50512
50592
  const children = Object.assign([], { provisional: 0 });
50513
- return this.#children.set(this, children), this.#type &= -17, children;
50593
+ return this.#children.set(this, children), this.#type &= ~READDIR_CALLED, children;
50514
50594
  }
50515
50595
  /**
50516
50596
  * Resolves a path portion and returns or creates the child Path.
@@ -53696,18 +53776,15 @@ ${chalk2.green("Success!")} Your Sanity configuration files has been added to th
53696
53776
  pnpm: "pnpm dev",
53697
53777
  bun: "bun dev",
53698
53778
  manual: "npm run dev"
53699
- }[pkgManager];
53700
- outputPath === process.cwd() ? (print(`
53701
- ${chalk2.green("Success!")} Now, use this command to continue:
53702
- `), print(
53703
- `${chalk2.cyan(devCommand)} - to run ${isAppTemplate ? "your Sanity application" : "Sanity Studio"}
53704
- `
53705
- )) : (print(`
53706
- ${chalk2.green("Success!")} Now, use these commands to continue:
53707
- `), print(`First: ${chalk2.cyan(`cd ${outputPath}`)} - to enter project's directory`), print(
53708
- `Then: ${chalk2.cyan(devCommand)} -to run ${isAppTemplate ? "your Sanity application" : "Sanity Studio"}
53709
- `
53710
- )), print("Other helpful commands"), print("npx sanity docs - to open the documentation in a browser"), print("npx sanity manage - to open the project settings in a browser"), print("npx sanity help - to explore the CLI manual"), isFirstProject && (trace.log({ step: "sendCommunityInvite", selectedOption: "yes" }), print(`
53779
+ }[pkgManager], isCurrentDir = outputPath === process.cwd(), goToProjectDir = `(${chalk2.cyan(`cd ${outputPath}`)} to navigate to your new project directory)`;
53780
+ isAppTemplate ? (print(`\u2705 ${chalk2.green.bold("Success!")} Your custom app has been scaffolded.`), isCurrentDir || print(goToProjectDir), print(
53781
+ `
53782
+ ${chalk2.bold("Next")}, configure the project(s) and dataset(s) your app should work with.`
53783
+ ), print("\nGet started in `src/App.tsx`, or refer to our documentation for a walkthrough:"), print(chalk2.blue.underline("https://www.sanity.io/docs/app-sdk/sdk-configuration")), print(`
53784
+ `), print("Other helpful commands:"), print("npx sanity docs to open the documentation in a browser"), print("npx sanity dev to start the development server for your app"), print("npx sanity deploy to deploy your app")) : (print(`\u2705 ${chalk2.green.bold("Success!")} Your Studio has been created.`), isCurrentDir || print(goToProjectDir), print(
53785
+ `Get started by running ${chalk2.cyan(devCommand)} to launch your Studio\u2019s development server`
53786
+ ), print(`
53787
+ `), print("Other helpful commands:"), print("npx sanity docs to open the documentation in a browser"), print("npx sanity manage to open the project settings in a browser"), print("npx sanity help to explore the CLI manual")), isFirstProject && (trace.log({ step: "sendCommunityInvite", selectedOption: "yes" }), print(`
53711
53788
  Join our wonderful developer community as well: ${chalk2.cyan("https://snty.link/community")}`), print(`We look forward to seeing you there!
53712
53789
  `)), trace.complete();
53713
53790
  async function getOrCreateUser() {
@@ -79649,7 +79726,10 @@ async function runCli(cliRoot, { cliVersion }) {
79649
79726
  await flushTelemetry();
79650
79727
  const error2 = typeof err.details == "string" ? err.details : err;
79651
79728
  console.error(`
79652
- ${error2.stack ? neatStack(err) : error2}`), cliCommandTrace.error(error2), process.exit(1);
79729
+ ${error2.stack ? neatStack(err) : error2}`), err.cause && console.error(`
79730
+ Caused by:
79731
+
79732
+ ${err.cause.stack ? neatStack(err.cause) : err.cause}`), cliCommandTrace.error(error2), process.exit(1);
79653
79733
  });
79654
79734
  }
79655
79735
  async function getCoreModulePath(workDir, cliConfig) {