@sanity/cli 3.96.1-next.10.d11da65361 → 3.96.1-next.2.8733f9a16d
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/_chunks-cjs/cli.js +140 -414
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/package.json +9 -9
package/lib/_chunks-cjs/cli.js
CHANGED
|
@@ -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$
|
|
3770
|
+
const helpText$m = `
|
|
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$
|
|
3812
|
+
helpText: helpText$m,
|
|
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$
|
|
3873
|
+
}, helpText$l = `
|
|
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$
|
|
3896
|
+
helpText: helpText$l,
|
|
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$
|
|
3923
|
+
}, helpText$k = `
|
|
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$
|
|
3938
|
+
helpText: helpText$k,
|
|
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$
|
|
3961
|
+
}, helpText$j = `
|
|
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$
|
|
3980
|
+
helpText: helpText$j,
|
|
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$
|
|
4006
|
+
}, helpText$i = `
|
|
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$
|
|
4015
|
+
helpText: helpText$i,
|
|
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$
|
|
4036
|
+
}, helpText$h = `
|
|
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$
|
|
4058
|
+
helpText: helpText$h,
|
|
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$
|
|
4098
|
+
}, helpText$g = `
|
|
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$
|
|
4113
|
+
helpText: helpText$g,
|
|
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$
|
|
4136
|
+
}, helpText$f = `
|
|
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$
|
|
4145
|
+
helpText: helpText$f,
|
|
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$
|
|
4165
|
+
}, helpText$e = `
|
|
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$
|
|
4180
|
+
helpText: helpText$e,
|
|
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$
|
|
4348
|
+
const helpText$d = `
|
|
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$
|
|
4370
|
+
helpText: helpText$d,
|
|
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$
|
|
7908
|
+
}, helpText$c = `
|
|
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$
|
|
7928
|
+
helpText: helpText$c,
|
|
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$
|
|
7949
|
+
}, helpText$b = `
|
|
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$
|
|
7972
|
+
helpText: helpText$b,
|
|
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$
|
|
8028
|
+
}, helpText$a = `
|
|
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$
|
|
8065
|
+
helpText: helpText$a,
|
|
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$
|
|
8090
|
+
}, helpText$9 = `
|
|
8091
8091
|
Arguments
|
|
8092
8092
|
<name> The name of the Sanity Function
|
|
8093
8093
|
|
|
@@ -8098,7 +8098,6 @@ 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()
|
|
8102
8101
|
|
|
8103
8102
|
|
|
8104
8103
|
Examples
|
|
@@ -8111,14 +8110,13 @@ Examples
|
|
|
8111
8110
|
# Test function passing event data on command line and cap execution time to 60 seconds
|
|
8112
8111
|
sanity functions test echo --data '{ "id": 1 }' --timeout 60
|
|
8113
8112
|
`, defaultFlags$1 = {
|
|
8114
|
-
timeout: 10
|
|
8113
|
+
timeout: 10
|
|
8115
8114
|
// seconds
|
|
8116
|
-
"with-user-token": !1
|
|
8117
8115
|
}, testFunctionsCommand = {
|
|
8118
8116
|
name: "test",
|
|
8119
8117
|
group: "functions",
|
|
8120
|
-
helpText: helpText$
|
|
8121
|
-
signature: "<name> [--data <json>] [--file <filename>] [--timeout <seconds>] [--api <version>] [--dataset <name>] [--project-id] <id>]
|
|
8118
|
+
helpText: helpText$9,
|
|
8119
|
+
signature: "<name> [--data <json>] [--file <filename>] [--timeout <seconds>] [--api <version>] [--dataset <name>] [--project-id] <id>]",
|
|
8122
8120
|
description: "Invoke a local Sanity Function",
|
|
8123
8121
|
async action(args, context) {
|
|
8124
8122
|
const { apiClient, output } = context, [name] = args.argsWithoutOptions, flags = { ...defaultFlags$1, ...args.extOptions }, client2 = apiClient({
|
|
@@ -8143,8 +8141,7 @@ Examples
|
|
|
8143
8141
|
timeout: flags.timeout,
|
|
8144
8142
|
api: flags.api,
|
|
8145
8143
|
dataset: flags.dataset || actualDataset,
|
|
8146
|
-
"project-id": flags["project-id"] || projectId
|
|
8147
|
-
"with-user-token": flags["with-user-token"]
|
|
8144
|
+
"project-id": flags["project-id"] || projectId
|
|
8148
8145
|
}
|
|
8149
8146
|
});
|
|
8150
8147
|
if (!success) throw new Error(error2);
|
|
@@ -8198,11 +8195,11 @@ const commonMistakes = { get: "list" }, levenThreshold = 3, coreCommands = [
|
|
|
8198
8195
|
"undeploy",
|
|
8199
8196
|
"uninstall",
|
|
8200
8197
|
"users"
|
|
8201
|
-
], discouragedCommands = ["upgrade", "check", "configcheck", "uninstall"], helpText$
|
|
8198
|
+
], discouragedCommands = ["upgrade", "check", "configcheck", "uninstall"], helpText$8 = `
|
|
8202
8199
|
Run the command again within a Sanity project directory, where "sanity"
|
|
8203
8200
|
is installed as a dependency.`;
|
|
8204
8201
|
function getNoSuchCommandText(cmdName, parentGroupName, groups) {
|
|
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$
|
|
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 : []);
|
|
8206
8203
|
}
|
|
8207
8204
|
function suggestCommand(cmdName, group, parentGroupName = null) {
|
|
8208
8205
|
const closest = group.filter((command2) => !discouragedCommands.includes(command2.name)).map((command2) => leven(command2.name, cmdName)).reduce(
|
|
@@ -38212,7 +38209,6 @@ function requireLib$1() {
|
|
|
38212
38209
|
IncompatibleRegExpUVFlags: "The 'u' and 'v' regular expression flags cannot be enabled at the same time.",
|
|
38213
38210
|
InvalidBigIntLiteral: "Invalid BigIntLiteral.",
|
|
38214
38211
|
InvalidCodePoint: "Code point out of bounds.",
|
|
38215
|
-
InvalidCoverDiscardElement: "'void' must be followed by an expression when not used in a binding position.",
|
|
38216
38212
|
InvalidCoverInitializedName: "Invalid shorthand property initializer.",
|
|
38217
38213
|
InvalidDecimal: "Invalid decimal.",
|
|
38218
38214
|
InvalidDigit: ({
|
|
@@ -38330,7 +38326,6 @@ function requireLib$1() {
|
|
|
38330
38326
|
}) => `Unexpected token${unexpected ? ` '${unexpected}'.` : ""}${expected ? `, expected "${expected}"` : ""}`,
|
|
38331
38327
|
UnexpectedTokenUnaryExponentiation: "Illegal expression. Wrap left hand side or entire exponentiation in parentheses.",
|
|
38332
38328
|
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.",
|
|
38334
38329
|
UnsupportedBind: "Binding should be performed on object property.",
|
|
38335
38330
|
UnsupportedDecoratorExport: "A decorated export must export a class declaration.",
|
|
38336
38331
|
UnsupportedDefaultExport: "Only expressions, functions or classes are allowed as the `default` export.",
|
|
@@ -38351,8 +38346,6 @@ function requireLib$1() {
|
|
|
38351
38346
|
VarRedeclaration: ({
|
|
38352
38347
|
identifierName
|
|
38353
38348
|
}) => `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.",
|
|
38356
38349
|
YieldBindingIdentifier: "Can not use 'yield' as identifier inside a generator.",
|
|
38357
38350
|
YieldInParameter: "Yield expression is not allowed in formal parameters.",
|
|
38358
38351
|
YieldNotInGeneratorFunction: "'yield' is only allowed within generator functions.",
|
|
@@ -38508,14 +38501,6 @@ function requireLib$1() {
|
|
|
38508
38501
|
opts.startIndex == null && options2.startColumn > 0 ? options2.startIndex = options2.startColumn : opts.startColumn == null && options2.startIndex > 0 && (options2.startColumn = options2.startIndex);
|
|
38509
38502
|
else if ((opts.startColumn == null || opts.startIndex == null) && opts.startIndex != null)
|
|
38510
38503
|
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
|
-
}
|
|
38519
38504
|
return options2;
|
|
38520
38505
|
}
|
|
38521
38506
|
const {
|
|
@@ -39172,7 +39157,7 @@ function requireLib$1() {
|
|
|
39172
39157
|
startsExpr
|
|
39173
39158
|
}),
|
|
39174
39159
|
placeholder: createToken("%%", {
|
|
39175
|
-
startsExpr
|
|
39160
|
+
startsExpr: !0
|
|
39176
39161
|
}),
|
|
39177
39162
|
string: createToken("string", {
|
|
39178
39163
|
startsExpr
|
|
@@ -39195,10 +39180,10 @@ function requireLib$1() {
|
|
|
39195
39180
|
eof: createToken("eof"),
|
|
39196
39181
|
jsxName: createToken("jsxName"),
|
|
39197
39182
|
jsxText: createToken("jsxText", {
|
|
39198
|
-
beforeExpr
|
|
39183
|
+
beforeExpr: !0
|
|
39199
39184
|
}),
|
|
39200
39185
|
jsxTagStart: createToken("jsxTagStart", {
|
|
39201
|
-
startsExpr
|
|
39186
|
+
startsExpr: !0
|
|
39202
39187
|
}),
|
|
39203
39188
|
jsxTagEnd: createToken("jsxTagEnd")
|
|
39204
39189
|
};
|
|
@@ -39337,9 +39322,6 @@ function requireLib$1() {
|
|
|
39337
39322
|
get allowDirectSuper() {
|
|
39338
39323
|
return (this.currentThisScopeFlags() & 32) > 0;
|
|
39339
39324
|
}
|
|
39340
|
-
get allowNewTarget() {
|
|
39341
|
-
return (this.currentThisScopeFlags() & 512) > 0;
|
|
39342
|
-
}
|
|
39343
39325
|
get inClass() {
|
|
39344
39326
|
return (this.currentThisScopeFlags() & 64) > 0;
|
|
39345
39327
|
}
|
|
@@ -39354,7 +39336,7 @@ function requireLib$1() {
|
|
|
39354
39336
|
} = this.scopeStack[i];
|
|
39355
39337
|
if (flags & 128)
|
|
39356
39338
|
return !0;
|
|
39357
|
-
if (flags &
|
|
39339
|
+
if (flags & 707)
|
|
39358
39340
|
return !1;
|
|
39359
39341
|
}
|
|
39360
39342
|
}
|
|
@@ -39386,7 +39368,7 @@ function requireLib$1() {
|
|
|
39386
39368
|
let type2 = scope2.names.get(name) || 0;
|
|
39387
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);
|
|
39388
39370
|
} else if (bindingType & 4)
|
|
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 &
|
|
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)
|
|
39390
39372
|
;
|
|
39391
39373
|
this.parser.inModule && scope2.flags & 1 && this.undefinedExports.delete(name);
|
|
39392
39374
|
}
|
|
@@ -39419,7 +39401,7 @@ function requireLib$1() {
|
|
|
39419
39401
|
const {
|
|
39420
39402
|
flags
|
|
39421
39403
|
} = this.scopeStack[i];
|
|
39422
|
-
if (flags &
|
|
39404
|
+
if (flags & 643)
|
|
39423
39405
|
return flags;
|
|
39424
39406
|
}
|
|
39425
39407
|
}
|
|
@@ -39428,7 +39410,7 @@ function requireLib$1() {
|
|
|
39428
39410
|
const {
|
|
39429
39411
|
flags
|
|
39430
39412
|
} = this.scopeStack[i];
|
|
39431
|
-
if (flags &
|
|
39413
|
+
if (flags & 707 && !(flags & 4))
|
|
39432
39414
|
return flags;
|
|
39433
39415
|
}
|
|
39434
39416
|
}
|
|
@@ -40197,7 +40179,7 @@ function requireLib$1() {
|
|
|
40197
40179
|
}
|
|
40198
40180
|
finishArrowValidation(node) {
|
|
40199
40181
|
var _node$extra;
|
|
40200
|
-
this.toAssignableList(node.params, (_node$extra = node.extra) == null ? void 0 : _node$extra.trailingCommaLoc, !1), this.scope.enter(
|
|
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();
|
|
40201
40183
|
}
|
|
40202
40184
|
forwardNoArrowParamsConversionAt(node, parse4) {
|
|
40203
40185
|
let result;
|
|
@@ -40503,7 +40485,7 @@ function requireLib$1() {
|
|
|
40503
40485
|
if (base2.type === "Identifier" && base2.name === "async" && this.state.noArrowAt.includes(startLoc.index)) {
|
|
40504
40486
|
this.next();
|
|
40505
40487
|
const node = this.startNodeAt(startLoc);
|
|
40506
|
-
node.callee = base2, node.arguments = super.parseCallExpressionArguments(), base2 = this.finishNode(node, "CallExpression");
|
|
40488
|
+
node.callee = base2, node.arguments = super.parseCallExpressionArguments(11), base2 = this.finishNode(node, "CallExpression");
|
|
40507
40489
|
} else if (base2.type === "Identifier" && base2.name === "async" && this.match(47)) {
|
|
40508
40490
|
const state = this.state.clone(), arrow4 = this.tryParse((abort) => this.parseAsyncArrowWithTypeParameters(startLoc) || abort(), state);
|
|
40509
40491
|
if (!arrow4.error && !arrow4.aborted) return arrow4.node;
|
|
@@ -40523,11 +40505,11 @@ function requireLib$1() {
|
|
|
40523
40505
|
return subscriptState.stop = !0, base2;
|
|
40524
40506
|
this.next();
|
|
40525
40507
|
const node = this.startNodeAt(startLoc);
|
|
40526
|
-
return node.callee = base2, node.typeArguments = this.flowParseTypeParameterInstantiationInExpression(), this.expect(10), node.arguments = this.parseCallExpressionArguments(), node.optional = !0, this.finishCallExpression(node, !0);
|
|
40508
|
+
return node.callee = base2, node.typeArguments = this.flowParseTypeParameterInstantiationInExpression(), this.expect(10), node.arguments = this.parseCallExpressionArguments(11), node.optional = !0, this.finishCallExpression(node, !0);
|
|
40527
40509
|
} else if (!noCalls && this.shouldParseTypes() && (this.match(47) || this.match(51))) {
|
|
40528
40510
|
const node = this.startNodeAt(startLoc);
|
|
40529
40511
|
node.callee = base2;
|
|
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)));
|
|
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)));
|
|
40531
40513
|
if (result.node)
|
|
40532
40514
|
return result.error && (this.state = result.failState), result.node;
|
|
40533
40515
|
}
|
|
@@ -41431,11 +41413,11 @@ function requireLib$1() {
|
|
|
41431
41413
|
return this.importsStack.push(/* @__PURE__ */ new Set()), new TypeScriptScope(flags);
|
|
41432
41414
|
}
|
|
41433
41415
|
enter(flags) {
|
|
41434
|
-
flags ===
|
|
41416
|
+
flags === 512 && this.importsStack.push(/* @__PURE__ */ new Set()), super.enter(flags);
|
|
41435
41417
|
}
|
|
41436
41418
|
exit() {
|
|
41437
41419
|
const flags = super.exit();
|
|
41438
|
-
return flags ===
|
|
41420
|
+
return flags === 512 && this.importsStack.pop(), flags;
|
|
41439
41421
|
}
|
|
41440
41422
|
hasImport(name, allowShadow) {
|
|
41441
41423
|
const len = this.importsStack.length;
|
|
@@ -42851,8 +42833,9 @@ function requireLib$1() {
|
|
|
42851
42833
|
return this.state.type === token2 && !this.state.containsEsc;
|
|
42852
42834
|
}
|
|
42853
42835
|
isUnparsedContextual(nameStart, name) {
|
|
42854
|
-
|
|
42855
|
-
|
|
42836
|
+
const nameEnd = nameStart + name.length;
|
|
42837
|
+
if (this.input.slice(nameStart, nameEnd) === name) {
|
|
42838
|
+
const nextCh = this.input.charCodeAt(nameEnd);
|
|
42856
42839
|
return !(isIdentifierChar(nextCh) || (nextCh & 64512) === 55296);
|
|
42857
42840
|
}
|
|
42858
42841
|
return !1;
|
|
@@ -42941,12 +42924,11 @@ function requireLib$1() {
|
|
|
42941
42924
|
shorthandAssignLoc,
|
|
42942
42925
|
doubleProtoLoc,
|
|
42943
42926
|
privateKeyLoc,
|
|
42944
|
-
optionalParametersLoc
|
|
42945
|
-
|
|
42946
|
-
} = refExpressionErrors, hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc || !!voidPatternLoc;
|
|
42927
|
+
optionalParametersLoc
|
|
42928
|
+
} = refExpressionErrors, hasErrors = !!shorthandAssignLoc || !!doubleProtoLoc || !!optionalParametersLoc || !!privateKeyLoc;
|
|
42947
42929
|
if (!andThrow)
|
|
42948
42930
|
return hasErrors;
|
|
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)
|
|
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);
|
|
42950
42932
|
}
|
|
42951
42933
|
isLiteralPropertyName() {
|
|
42952
42934
|
return tokenIsLiteralPropertyName(this.state.type);
|
|
@@ -42986,11 +42968,7 @@ function requireLib$1() {
|
|
|
42986
42968
|
}
|
|
42987
42969
|
enterInitialScopes() {
|
|
42988
42970
|
let paramFlags = 0;
|
|
42989
|
-
|
|
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);
|
|
42971
|
+
this.inModule && (paramFlags |= 2), this.optionFlags & 32 && (paramFlags |= 1), this.scope.enter(1), this.prodParam.enter(paramFlags);
|
|
42994
42972
|
}
|
|
42995
42973
|
checkDestructuringPrivate(refExpressionErrors) {
|
|
42996
42974
|
const {
|
|
@@ -43001,7 +42979,7 @@ function requireLib$1() {
|
|
|
43001
42979
|
}
|
|
43002
42980
|
class ExpressionErrors {
|
|
43003
42981
|
constructor() {
|
|
43004
|
-
this.shorthandAssignLoc = null, this.doubleProtoLoc = null, this.privateKeyLoc = null, this.optionalParametersLoc = null
|
|
42982
|
+
this.shorthandAssignLoc = null, this.doubleProtoLoc = null, this.privateKeyLoc = null, this.optionalParametersLoc = null;
|
|
43005
42983
|
}
|
|
43006
42984
|
}
|
|
43007
42985
|
class Node {
|
|
@@ -43081,7 +43059,6 @@ function requireLib$1() {
|
|
|
43081
43059
|
case "ArrayPattern":
|
|
43082
43060
|
case "AssignmentPattern":
|
|
43083
43061
|
case "RestElement":
|
|
43084
|
-
case "VoidPattern":
|
|
43085
43062
|
break;
|
|
43086
43063
|
case "ObjectExpression":
|
|
43087
43064
|
this.castNodeTo(node, "ObjectPattern");
|
|
@@ -43105,7 +43082,7 @@ function requireLib$1() {
|
|
|
43105
43082
|
this.castNodeTo(node, "ArrayPattern"), this.toAssignableList(node.elements, (_node$extra3 = node.extra) == null ? void 0 : _node$extra3.trailingCommaLoc, isLHS);
|
|
43106
43083
|
break;
|
|
43107
43084
|
case "AssignmentExpression":
|
|
43108
|
-
node.operator !== "=" && this.raise(Errors.MissingEqInAssignment, node.left.loc.end), this.castNodeTo(node, "AssignmentPattern"), delete node.operator,
|
|
43085
|
+
node.operator !== "=" && this.raise(Errors.MissingEqInAssignment, node.left.loc.end), this.castNodeTo(node, "AssignmentPattern"), delete node.operator, this.toAssignable(node.left, isLHS);
|
|
43109
43086
|
break;
|
|
43110
43087
|
case "ParenthesizedExpression":
|
|
43111
43088
|
this.toAssignable(parenthesized, isLHS);
|
|
@@ -43145,7 +43122,6 @@ function requireLib$1() {
|
|
|
43145
43122
|
case "ArrayPattern":
|
|
43146
43123
|
case "AssignmentPattern":
|
|
43147
43124
|
case "RestElement":
|
|
43148
|
-
case "VoidPattern":
|
|
43149
43125
|
return !0;
|
|
43150
43126
|
case "ObjectExpression": {
|
|
43151
43127
|
const last2 = node.properties.length - 1;
|
|
@@ -43182,9 +43158,7 @@ function requireLib$1() {
|
|
|
43182
43158
|
}
|
|
43183
43159
|
parseRestBinding() {
|
|
43184
43160
|
const node = this.startNode();
|
|
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");
|
|
43161
|
+
return this.next(), node.argument = this.parseBindingAtom(), this.finishNode(node, "RestElement");
|
|
43188
43162
|
}
|
|
43189
43163
|
parseBindingAtom() {
|
|
43190
43164
|
switch (this.state.type) {
|
|
@@ -43194,8 +43168,6 @@ function requireLib$1() {
|
|
|
43194
43168
|
}
|
|
43195
43169
|
case 5:
|
|
43196
43170
|
return this.parseObjectLike(8, !0);
|
|
43197
|
-
case 88:
|
|
43198
|
-
return this.parseVoidPattern(null);
|
|
43199
43171
|
}
|
|
43200
43172
|
return this.parseIdentifier();
|
|
43201
43173
|
}
|
|
@@ -43225,7 +43197,7 @@ function requireLib$1() {
|
|
|
43225
43197
|
return elts;
|
|
43226
43198
|
}
|
|
43227
43199
|
parseBindingRestProperty(prop) {
|
|
43228
|
-
return this.next(),
|
|
43200
|
+
return this.next(), prop.argument = this.parseIdentifier(), this.checkCommaAfterRest(125), this.finishNode(prop, "RestElement");
|
|
43229
43201
|
}
|
|
43230
43202
|
parseBindingProperty() {
|
|
43231
43203
|
const {
|
|
@@ -43247,7 +43219,7 @@ function requireLib$1() {
|
|
|
43247
43219
|
parseMaybeDefault(startLoc, left) {
|
|
43248
43220
|
if (startLoc ?? (startLoc = this.state.startLoc), left = left ?? this.parseBindingAtom(), !this.eat(29)) return left;
|
|
43249
43221
|
const node = this.startNodeAt(startLoc);
|
|
43250
|
-
return
|
|
43222
|
+
return node.left = left, node.right = this.parseMaybeAssignAllowIn(), this.finishNode(node, "AssignmentPattern");
|
|
43251
43223
|
}
|
|
43252
43224
|
isValidLVal(type2, isUnparenthesizedInAssign, binding) {
|
|
43253
43225
|
switch (type2) {
|
|
@@ -43263,8 +43235,6 @@ function requireLib$1() {
|
|
|
43263
43235
|
return "elements";
|
|
43264
43236
|
case "ObjectPattern":
|
|
43265
43237
|
return "properties";
|
|
43266
|
-
case "VoidPattern":
|
|
43267
|
-
return !0;
|
|
43268
43238
|
}
|
|
43269
43239
|
return !1;
|
|
43270
43240
|
}
|
|
@@ -43289,7 +43259,7 @@ function requireLib$1() {
|
|
|
43289
43259
|
} = expression;
|
|
43290
43260
|
checkClashes && (checkClashes.has(name) ? this.raise(Errors.ParamDupe, expression) : checkClashes.add(name));
|
|
43291
43261
|
return;
|
|
43292
|
-
}
|
|
43262
|
+
}
|
|
43293
43263
|
const validity = this.isValidLVal(type2, !(hasParenthesizedAncestor || (_expression$extra = expression.extra) != null && _expression$extra.parenthesized) && ancestor.type === "AssignmentExpression", binding);
|
|
43294
43264
|
if (validity === !0) return;
|
|
43295
43265
|
if (validity === !1) {
|
|
@@ -43443,8 +43413,7 @@ function requireLib$1() {
|
|
|
43443
43413
|
UnsupportedParameterPropertyKind: "A parameter property may not be declared using a binding pattern.",
|
|
43444
43414
|
UnsupportedSignatureParameterKind: ({
|
|
43445
43415
|
type: 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.`
|
|
43416
|
+
}) => `Name in a signature must be an Identifier, ObjectPattern or ArrayPattern, instead got ${type2}.`
|
|
43448
43417
|
});
|
|
43449
43418
|
function keywordTypeFromName(value) {
|
|
43450
43419
|
switch (value) {
|
|
@@ -44023,7 +43992,7 @@ function requireLib$1() {
|
|
|
44023
43992
|
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");
|
|
44024
43993
|
}
|
|
44025
43994
|
isAbstractConstructorSignature() {
|
|
44026
|
-
return this.isContextual(124) && this.
|
|
43995
|
+
return this.isContextual(124) && this.lookahead().type === 77;
|
|
44027
43996
|
}
|
|
44028
43997
|
tsParseNonConditionalType() {
|
|
44029
43998
|
return this.tsIsStartOfFunctionType() ? this.tsParseFunctionOrConstructorType("TSFunctionType") : this.match(77) ? this.tsParseFunctionOrConstructorType("TSConstructorType") : this.isAbstractConstructorSignature() ? this.tsParseFunctionOrConstructorType("TSConstructorType", !0) : this.tsParseUnionTypeOrHigher();
|
|
@@ -44052,7 +44021,7 @@ function requireLib$1() {
|
|
|
44052
44021
|
}
|
|
44053
44022
|
tsParseTypeAliasDeclaration(node) {
|
|
44054
44023
|
return node.id = this.parseIdentifier(), this.checkIdentifier(node.id, 2), node.typeAnnotation = this.tsInType(() => {
|
|
44055
|
-
if (node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers), this.expect(29), this.isContextual(114) && this.
|
|
44024
|
+
if (node.typeParameters = this.tsTryParseTypeParameters(this.tsParseInOutModifiers), this.expect(29), this.isContextual(114) && this.lookahead().type !== 16) {
|
|
44056
44025
|
const node2 = this.startNode();
|
|
44057
44026
|
return this.next(), this.finishNode(node2, "TSIntrinsicKeyword");
|
|
44058
44027
|
}
|
|
@@ -44128,11 +44097,11 @@ function requireLib$1() {
|
|
|
44128
44097
|
const inner = this.startNode();
|
|
44129
44098
|
this.tsParseModuleOrNamespaceDeclaration(inner, !0), node.body = inner;
|
|
44130
44099
|
} else
|
|
44131
|
-
this.scope.enter(
|
|
44100
|
+
this.scope.enter(512), this.prodParam.enter(0), node.body = this.tsParseModuleBlock(), this.prodParam.exit(), this.scope.exit();
|
|
44132
44101
|
return this.finishNode(node, "TSModuleDeclaration");
|
|
44133
44102
|
}
|
|
44134
44103
|
tsParseAmbientExternalModuleDeclaration(node) {
|
|
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(
|
|
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");
|
|
44136
44105
|
}
|
|
44137
44106
|
tsParseImportEqualsDeclaration(node, maybeDefaultIdentifier, isExport) {
|
|
44138
44107
|
node.isExport = isExport || !1, node.id = maybeDefaultIdentifier || this.parseIdentifier(), this.checkIdentifier(node.id, 4096), this.expect(29);
|
|
@@ -44190,11 +44159,11 @@ function requireLib$1() {
|
|
|
44190
44159
|
declare: !0
|
|
44191
44160
|
}));
|
|
44192
44161
|
case 107:
|
|
44193
|
-
if (this.isUsing())
|
|
44162
|
+
if (this.hasPlugin("explicitResourceManagement") && this.isUsing())
|
|
44194
44163
|
return this.raise(TSErrors.InvalidModifierOnUsingDeclaration, this.state.startLoc, "declare"), node.declare = !0, this.parseVarStatement(node, "using", !0);
|
|
44195
44164
|
break;
|
|
44196
44165
|
case 96:
|
|
44197
|
-
if (this.isAwaitUsing())
|
|
44166
|
+
if (this.hasPlugin("explicitResourceManagement") && this.isAwaitUsing())
|
|
44198
44167
|
return this.raise(TSErrors.InvalidModifierOnAwaitUsingDeclaration, this.state.startLoc, "declare"), node.declare = !0, this.next(), this.parseVarStatement(node, "await using", !0);
|
|
44199
44168
|
break;
|
|
44200
44169
|
case 129: {
|
|
@@ -44220,7 +44189,7 @@ function requireLib$1() {
|
|
|
44220
44189
|
}
|
|
44221
44190
|
case "global":
|
|
44222
44191
|
if (this.match(5)) {
|
|
44223
|
-
this.scope.enter(
|
|
44192
|
+
this.scope.enter(512), this.prodParam.enter(0);
|
|
44224
44193
|
const mod = node;
|
|
44225
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");
|
|
44226
44195
|
}
|
|
@@ -44359,7 +44328,7 @@ function requireLib$1() {
|
|
|
44359
44328
|
}
|
|
44360
44329
|
if (!noCalls && this.eat(10)) {
|
|
44361
44330
|
const node2 = this.startNodeAt(startLoc);
|
|
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);
|
|
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);
|
|
44363
44332
|
}
|
|
44364
44333
|
const tokenType = this.state.type;
|
|
44365
44334
|
if (tokenType === 48 || tokenType === 52 || tokenType !== 10 && tokenCanStartExpression(tokenType) && !this.hasPrecedingLineBreak())
|
|
@@ -44440,7 +44409,7 @@ function requireLib$1() {
|
|
|
44440
44409
|
return super.parseExport(node, decorators);
|
|
44441
44410
|
}
|
|
44442
44411
|
isAbstractClass() {
|
|
44443
|
-
return this.isContextual(124) && this.
|
|
44412
|
+
return this.isContextual(124) && this.lookahead().type === 80;
|
|
44444
44413
|
}
|
|
44445
44414
|
parseExportDefaultExpression() {
|
|
44446
44415
|
if (this.isAbstractClass()) {
|
|
@@ -44458,8 +44427,6 @@ function requireLib$1() {
|
|
|
44458
44427
|
isAmbientContext
|
|
44459
44428
|
} = this.state, declaration = super.parseVarStatement(node, kind, allowMissingInitializer || isAmbientContext);
|
|
44460
44429
|
if (!isAmbientContext) return declaration;
|
|
44461
|
-
if (!node.declare && (kind === "using" || kind === "await using"))
|
|
44462
|
-
return this.raiseOverwrite(TSErrors.UsingDeclarationInAmbientContext, node, kind), declaration;
|
|
44463
44430
|
for (const {
|
|
44464
44431
|
id,
|
|
44465
44432
|
init
|
|
@@ -45063,10 +45030,7 @@ function requireLib$1() {
|
|
|
45063
45030
|
node && node.type === "Placeholder" && node.expectedNode === "Expression" ? node.expectedNode = "Pattern" : super.toAssignable(node, isLHS);
|
|
45064
45031
|
}
|
|
45065
45032
|
chStartsBindingIdentifier(ch, pos2) {
|
|
45066
|
-
|
|
45067
|
-
return !0;
|
|
45068
|
-
const next = this.nextTokenStart();
|
|
45069
|
-
return this.input.charCodeAt(next) === 37 && this.input.charCodeAt(next + 1) === 37;
|
|
45033
|
+
return !!(super.chStartsBindingIdentifier(ch, pos2) || this.lookahead().type === 133);
|
|
45070
45034
|
}
|
|
45071
45035
|
verifyBreakContinue(node, isBreak) {
|
|
45072
45036
|
node.label && node.label.type === "Placeholder" || super.verifyBreakContinue(node, isBreak);
|
|
@@ -45226,8 +45190,6 @@ function requireLib$1() {
|
|
|
45226
45190
|
}
|
|
45227
45191
|
if (pluginsMap.has("optionalChainingAssign") && pluginsMap.get("optionalChainingAssign").version !== "2023-07")
|
|
45228
45192
|
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'.");
|
|
45231
45193
|
}
|
|
45232
45194
|
const mixinPlugins = {
|
|
45233
45195
|
estree,
|
|
@@ -45298,7 +45260,7 @@ function requireLib$1() {
|
|
|
45298
45260
|
if (node.operator = operator, this.match(29)) {
|
|
45299
45261
|
this.toAssignable(left, !0), node.left = left;
|
|
45300
45262
|
const startIndex = startLoc.index;
|
|
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)
|
|
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);
|
|
45302
45264
|
} else
|
|
45303
45265
|
node.left = left;
|
|
45304
45266
|
return this.next(), node.right = this.parseMaybeAssign(), this.checkLVal(left, this.finishNode(node, "AssignmentExpression")), node;
|
|
@@ -45497,7 +45459,7 @@ function requireLib$1() {
|
|
|
45497
45459
|
maybeAsyncArrow,
|
|
45498
45460
|
optionalChainMember
|
|
45499
45461
|
} = state;
|
|
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);
|
|
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);
|
|
45501
45463
|
let finishedNode = this.finishCallExpression(node, optionalChainMember);
|
|
45502
45464
|
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;
|
|
45503
45465
|
}
|
|
@@ -45520,18 +45482,18 @@ function requireLib$1() {
|
|
|
45520
45482
|
arg.type === "SpreadElement" && this.raise(Errors.ImportCallSpreadArgument, arg);
|
|
45521
45483
|
return this.finishNode(node, optional ? "OptionalCallExpression" : "CallExpression");
|
|
45522
45484
|
}
|
|
45523
|
-
parseCallExpressionArguments(allowPlaceholder, nodeForExtra, refExpressionErrors) {
|
|
45485
|
+
parseCallExpressionArguments(close, allowPlaceholder, nodeForExtra, refExpressionErrors) {
|
|
45524
45486
|
const elts = [];
|
|
45525
45487
|
let first2 = !0;
|
|
45526
45488
|
const oldInFSharpPipelineDirectBody = this.state.inFSharpPipelineDirectBody;
|
|
45527
|
-
for (this.state.inFSharpPipelineDirectBody = !1; !this.eat(
|
|
45489
|
+
for (this.state.inFSharpPipelineDirectBody = !1; !this.eat(close); ) {
|
|
45528
45490
|
if (first2)
|
|
45529
45491
|
first2 = !1;
|
|
45530
|
-
else if (this.expect(12), this.match(
|
|
45492
|
+
else if (this.expect(12), this.match(close)) {
|
|
45531
45493
|
nodeForExtra && this.addTrailingCommaExtraToNode(nodeForExtra), this.next();
|
|
45532
45494
|
break;
|
|
45533
45495
|
}
|
|
45534
|
-
elts.push(this.parseExprListItem(
|
|
45496
|
+
elts.push(this.parseExprListItem(!1, refExpressionErrors, allowPlaceholder));
|
|
45535
45497
|
}
|
|
45536
45498
|
return this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody, elts;
|
|
45537
45499
|
}
|
|
@@ -45778,7 +45740,7 @@ function requireLib$1() {
|
|
|
45778
45740
|
if (spreadStartLoc = this.state.startLoc, exprList.push(this.parseParenItem(this.parseRestBinding(), spreadNodeStartLoc)), !this.checkCommaAfterRest(41))
|
|
45779
45741
|
break;
|
|
45780
45742
|
} else
|
|
45781
|
-
exprList.push(this.
|
|
45743
|
+
exprList.push(this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem));
|
|
45782
45744
|
}
|
|
45783
45745
|
const innerEndLoc = this.state.lastTokEndLoc;
|
|
45784
45746
|
this.expect(11), this.state.maybeInArrowParameters = oldMaybeInArrowParameters, this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody;
|
|
@@ -45807,7 +45769,7 @@ function requireLib$1() {
|
|
|
45807
45769
|
const meta = this.createIdentifier(this.startNodeAtNode(node), "new");
|
|
45808
45770
|
this.next();
|
|
45809
45771
|
const metaProp = this.parseMetaProperty(node, meta, "target");
|
|
45810
|
-
return this.scope.
|
|
45772
|
+
return !this.scope.inNonArrowFunction && !this.scope.inClass && !(this.optionFlags & 4) && this.raise(Errors.UnexpectedNewTarget, metaProp), metaProp;
|
|
45811
45773
|
}
|
|
45812
45774
|
return this.parseNew(node);
|
|
45813
45775
|
}
|
|
@@ -45921,7 +45883,7 @@ function requireLib$1() {
|
|
|
45921
45883
|
}
|
|
45922
45884
|
parseObjectProperty(prop, startLoc, isPattern, refExpressionErrors) {
|
|
45923
45885
|
if (prop.shorthand = !1, this.eat(14))
|
|
45924
|
-
return prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.
|
|
45886
|
+
return prop.value = isPattern ? this.parseMaybeDefault(this.state.startLoc) : this.parseMaybeAssignAllowIn(refExpressionErrors), this.finishObjectProperty(prop);
|
|
45925
45887
|
if (!prop.computed && prop.key.type === "Identifier") {
|
|
45926
45888
|
if (this.checkReservedWord(prop.key.name, prop.key.loc.start, !0, !1), isPattern)
|
|
45927
45889
|
prop.value = this.parseMaybeDefault(startLoc, this.cloneIdentifier(prop.key));
|
|
@@ -45981,7 +45943,7 @@ function requireLib$1() {
|
|
|
45981
45943
|
node.id = null, node.generator = !1, node.async = isAsync;
|
|
45982
45944
|
}
|
|
45983
45945
|
parseMethod(node, isGenerator, isAsync, isConstructor, allowDirectSuper, type2, inClassScope = !1) {
|
|
45984
|
-
this.initFunction(node, isAsync), node.generator = isGenerator, this.scope.enter(
|
|
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);
|
|
45985
45947
|
const finishedNode = this.parseFunctionBodyAndFinish(node, type2, !0);
|
|
45986
45948
|
return this.prodParam.exit(), this.scope.exit(), finishedNode;
|
|
45987
45949
|
}
|
|
@@ -45993,7 +45955,7 @@ function requireLib$1() {
|
|
|
45993
45955
|
return this.next(), node.elements = this.parseExprList(close, !isTuple, refExpressionErrors, node), this.state.inFSharpPipelineDirectBody = oldInFSharpPipelineDirectBody, this.finishNode(node, isTuple ? "TupleExpression" : "ArrayExpression");
|
|
45994
45956
|
}
|
|
45995
45957
|
parseArrowExpression(node, params, isAsync, trailingCommaLoc) {
|
|
45996
|
-
this.scope.enter(
|
|
45958
|
+
this.scope.enter(6);
|
|
45997
45959
|
let flags = functionFlags(isAsync, !1);
|
|
45998
45960
|
!this.match(5) && this.prodParam.hasIn && (flags |= 8), this.prodParam.enter(flags), this.initFunction(node, isAsync);
|
|
45999
45961
|
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
|
@@ -46045,11 +46007,11 @@ function requireLib$1() {
|
|
|
46045
46007
|
nodeForExtra && this.addTrailingCommaExtraToNode(nodeForExtra), this.next();
|
|
46046
46008
|
break;
|
|
46047
46009
|
}
|
|
46048
|
-
elts.push(this.parseExprListItem(
|
|
46010
|
+
elts.push(this.parseExprListItem(allowEmpty, refExpressionErrors));
|
|
46049
46011
|
}
|
|
46050
46012
|
return elts;
|
|
46051
46013
|
}
|
|
46052
|
-
parseExprListItem(
|
|
46014
|
+
parseExprListItem(allowEmpty, refExpressionErrors, allowPlaceholder) {
|
|
46053
46015
|
let elt;
|
|
46054
46016
|
if (this.match(12))
|
|
46055
46017
|
allowEmpty || this.raise(Errors.UnexpectedToken, this.state.curPosition(), {
|
|
@@ -46063,7 +46025,7 @@ function requireLib$1() {
|
|
|
46063
46025
|
const node = this.startNode();
|
|
46064
46026
|
this.next(), elt = this.finishNode(node, "ArgumentPlaceholder");
|
|
46065
46027
|
} else
|
|
46066
|
-
elt = this.
|
|
46028
|
+
elt = this.parseMaybeAssignAllowIn(refExpressionErrors, this.parseParenItem);
|
|
46067
46029
|
return elt;
|
|
46068
46030
|
}
|
|
46069
46031
|
parseIdentifier(liberal) {
|
|
@@ -46121,7 +46083,7 @@ function requireLib$1() {
|
|
|
46121
46083
|
}
|
|
46122
46084
|
}
|
|
46123
46085
|
recordAwaitIfAllowed() {
|
|
46124
|
-
const isAwaitAllowed = this.prodParam.hasAwait;
|
|
46086
|
+
const isAwaitAllowed = this.prodParam.hasAwait || this.optionFlags & 1 && !this.scope.inFunction;
|
|
46125
46087
|
return isAwaitAllowed && !this.scope.inFunction && (this.state.hasTopLevelAwait = !0), isAwaitAllowed;
|
|
46126
46088
|
}
|
|
46127
46089
|
parseAwait(startLoc) {
|
|
@@ -46291,19 +46253,6 @@ function requireLib$1() {
|
|
|
46291
46253
|
}
|
|
46292
46254
|
return this.finishNode(node, "ModuleExpression");
|
|
46293
46255
|
}
|
|
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
|
-
}
|
|
46307
46256
|
parsePropertyNamePrefixOperator(prop) {
|
|
46308
46257
|
}
|
|
46309
46258
|
}
|
|
@@ -46399,9 +46348,9 @@ function requireLib$1() {
|
|
|
46399
46348
|
}
|
|
46400
46349
|
class StatementParser extends ExpressionParser {
|
|
46401
46350
|
parseTopLevel(file, program) {
|
|
46402
|
-
return file.program = this.parseProgram(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");
|
|
46403
46352
|
}
|
|
46404
|
-
parseProgram(program, end, sourceType) {
|
|
46353
|
+
parseProgram(program, end = 140, sourceType = this.options.sourceType) {
|
|
46405
46354
|
if (program.sourceType = sourceType, program.interpreter = this.parseInterpreterDirective(), this.parseBlockBody(program, !0, !0, end), this.inModule) {
|
|
46406
46355
|
if (!(this.optionFlags & 64) && this.scope.undefinedExports.size > 0)
|
|
46407
46356
|
for (const [localName, at] of Array.from(this.scope.undefinedExports))
|
|
@@ -46432,17 +46381,6 @@ function requireLib$1() {
|
|
|
46432
46381
|
const next = this.nextTokenInLineStart(), nextCh = this.codePointAtPos(next);
|
|
46433
46382
|
return this.chStartsBindingIdentifier(nextCh, next);
|
|
46434
46383
|
}
|
|
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
|
-
}
|
|
46446
46384
|
isAwaitUsing() {
|
|
46447
46385
|
if (!this.isContextual(96))
|
|
46448
46386
|
return !1;
|
|
@@ -46451,7 +46389,7 @@ function requireLib$1() {
|
|
|
46451
46389
|
next = this.nextTokenInLineStartSince(next + 5);
|
|
46452
46390
|
const nextCh = this.codePointAtPos(next);
|
|
46453
46391
|
if (this.chStartsBindingIdentifier(nextCh, next))
|
|
46454
|
-
return !0;
|
|
46392
|
+
return this.expectPlugin("explicitResourceManagement"), !0;
|
|
46455
46393
|
}
|
|
46456
46394
|
return !1;
|
|
46457
46395
|
}
|
|
@@ -46476,6 +46414,19 @@ function requireLib$1() {
|
|
|
46476
46414
|
const next = this.nextTokenInLineStart(), nextCh = this.codePointAtPos(next);
|
|
46477
46415
|
return nextCh === 123 || this.chStartsBindingIdentifier(nextCh, next);
|
|
46478
46416
|
}
|
|
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
|
+
}
|
|
46479
46430
|
allowsUsing() {
|
|
46480
46431
|
return (this.scope.inModule || !this.scope.inTopLevel) && !this.scope.inBareCaseStatement;
|
|
46481
46432
|
}
|
|
@@ -46531,7 +46482,7 @@ function requireLib$1() {
|
|
|
46531
46482
|
case 107:
|
|
46532
46483
|
if (this.state.containsEsc || !this.hasInLineFollowingBindingIdentifierOrBrace())
|
|
46533
46484
|
break;
|
|
46534
|
-
return this.allowsUsing() ? allowDeclaration || this.raise(Errors.UnexpectedLexicalDeclaration, this.state.startLoc) : this.raise(Errors.UnexpectedUsingDeclaration, 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");
|
|
46535
46486
|
case 100: {
|
|
46536
46487
|
if (this.state.containsEsc)
|
|
46537
46488
|
break;
|
|
@@ -46622,7 +46573,7 @@ function requireLib$1() {
|
|
|
46622
46573
|
parseMaybeDecoratorArguments(expr, startLoc) {
|
|
46623
46574
|
if (this.eat(10)) {
|
|
46624
46575
|
const node = this.startNodeAt(startLoc);
|
|
46625
|
-
return node.callee = expr, node.arguments = this.parseCallExpressionArguments(), this.toReferencedList(node.arguments), this.finishNode(node, "CallExpression");
|
|
46576
|
+
return node.callee = expr, node.arguments = this.parseCallExpressionArguments(11), this.toReferencedList(node.arguments), this.finishNode(node, "CallExpression");
|
|
46626
46577
|
}
|
|
46627
46578
|
return expr;
|
|
46628
46579
|
}
|
|
@@ -46661,7 +46612,7 @@ function requireLib$1() {
|
|
|
46661
46612
|
return awaitAt !== null && this.unexpected(awaitAt), this.parseFor(node, null);
|
|
46662
46613
|
const startsWithLet = this.isContextual(100);
|
|
46663
46614
|
{
|
|
46664
|
-
const startsWithAwaitUsing = this.isAwaitUsing(), starsWithUsingDeclaration = startsWithAwaitUsing || this.
|
|
46615
|
+
const startsWithAwaitUsing = this.isAwaitUsing(), starsWithUsingDeclaration = startsWithAwaitUsing || this.isContextual(107) && this.allowsForUsing(), isLetOrUsing = startsWithLet && this.hasFollowingBindingAtom() || starsWithUsingDeclaration;
|
|
46665
46616
|
if (this.match(74) || this.match(75) || isLetOrUsing) {
|
|
46666
46617
|
const initNode = this.startNode();
|
|
46667
46618
|
let kind;
|
|
@@ -46688,7 +46639,7 @@ function requireLib$1() {
|
|
|
46688
46639
|
return this.next(), node.test = this.parseHeaderExpression(), node.consequent = this.parseStatementOrSloppyAnnexBFunctionDeclaration(), node.alternate = this.eat(66) ? this.parseStatementOrSloppyAnnexBFunctionDeclaration() : null, this.finishNode(node, "IfStatement");
|
|
46689
46640
|
}
|
|
46690
46641
|
parseReturnStatement(node) {
|
|
46691
|
-
return this.prodParam.hasReturn
|
|
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");
|
|
46692
46643
|
}
|
|
46693
46644
|
parseSwitchStatement(node) {
|
|
46694
46645
|
this.next(), node.discriminant = this.parseHeaderExpression();
|
|
@@ -46808,7 +46759,7 @@ function requireLib$1() {
|
|
|
46808
46759
|
}
|
|
46809
46760
|
parseVarId(decl, kind) {
|
|
46810
46761
|
const id = this.parseBindingAtom();
|
|
46811
|
-
kind === "using" || kind === "await using"
|
|
46762
|
+
(kind === "using" || kind === "await using") && (id.type === "ArrayPattern" || id.type === "ObjectPattern") && this.raise(Errors.UsingDeclarationHasBindingPattern, id.loc.start), this.checkLVal(id, {
|
|
46812
46763
|
type: "VariableDeclarator"
|
|
46813
46764
|
}, kind === "var" ? 5 : 8201), decl.id = id;
|
|
46814
46765
|
}
|
|
@@ -46819,7 +46770,7 @@ function requireLib$1() {
|
|
|
46819
46770
|
const hangingDeclaration = flags & 2, isDeclaration = !!(flags & 1), requireId = isDeclaration && !(flags & 4), isAsync = !!(flags & 8);
|
|
46820
46771
|
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));
|
|
46821
46772
|
const oldMaybeInArrowParameters = this.state.maybeInArrowParameters;
|
|
46822
|
-
return this.state.maybeInArrowParameters = !1, this.scope.enter(
|
|
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(() => {
|
|
46823
46774
|
this.parseFunctionBodyAndFinish(node, isDeclaration ? "FunctionDeclaration" : "FunctionExpression");
|
|
46824
46775
|
}), this.prodParam.exit(), this.scope.exit(), isDeclaration && !hangingDeclaration && this.registerFunctionStatementId(node), this.state.maybeInArrowParameters = oldMaybeInArrowParameters, node;
|
|
46825
46776
|
}
|
|
@@ -46951,7 +46902,7 @@ function requireLib$1() {
|
|
|
46951
46902
|
}
|
|
46952
46903
|
parseClassStaticBlock(classBody, member) {
|
|
46953
46904
|
var _member$decorators;
|
|
46954
|
-
this.scope.enter(
|
|
46905
|
+
this.scope.enter(208);
|
|
46955
46906
|
const oldLabels = this.state.labels;
|
|
46956
46907
|
this.state.labels = [], this.prodParam.enter(0);
|
|
46957
46908
|
const body = member.body = [];
|
|
@@ -46993,7 +46944,7 @@ function requireLib$1() {
|
|
|
46993
46944
|
return this.parseInitializer(node), this.semicolon(), this.finishNode(node, "ClassAccessorProperty");
|
|
46994
46945
|
}
|
|
46995
46946
|
parseInitializer(node) {
|
|
46996
|
-
this.scope.enter(
|
|
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();
|
|
46997
46948
|
}
|
|
46998
46949
|
parseClassId(node, isStatement, optionalId, bindingType = 8331) {
|
|
46999
46950
|
if (tokenIsIdentifier(this.state.type))
|
|
@@ -47088,7 +47039,7 @@ function requireLib$1() {
|
|
|
47088
47039
|
return this.parseClass(expr, !0, !0);
|
|
47089
47040
|
if (this.match(26))
|
|
47090
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);
|
|
47091
|
-
if (this.match(75) || this.match(74) || this.isLet() || this.isUsing() || this.isAwaitUsing())
|
|
47042
|
+
if (this.match(75) || this.match(74) || this.isLet() || this.hasPlugin("explicitResourceManagement") && (this.isUsing() || this.isAwaitUsing()))
|
|
47092
47043
|
throw this.raise(Errors.UnsupportedDefaultExport, this.state.startLoc);
|
|
47093
47044
|
const res = this.parseMaybeAssignAllowIn();
|
|
47094
47045
|
return this.semicolon(), res;
|
|
@@ -47104,8 +47055,10 @@ function requireLib$1() {
|
|
|
47104
47055
|
if (type2 === 95 && !this.state.containsEsc || type2 === 100)
|
|
47105
47056
|
return !1;
|
|
47106
47057
|
if ((type2 === 130 || type2 === 129) && !this.state.containsEsc) {
|
|
47107
|
-
const
|
|
47108
|
-
|
|
47058
|
+
const {
|
|
47059
|
+
type: nextType
|
|
47060
|
+
} = this.lookahead();
|
|
47061
|
+
if (tokenIsIdentifier(nextType) && nextType !== 98 || nextType === 5)
|
|
47109
47062
|
return this.expectOnePlugin(["flow", "typescript"]), !1;
|
|
47110
47063
|
}
|
|
47111
47064
|
} else if (!this.match(65))
|
|
@@ -47126,7 +47079,15 @@ function requireLib$1() {
|
|
|
47126
47079
|
const {
|
|
47127
47080
|
type: type2
|
|
47128
47081
|
} = this.state;
|
|
47129
|
-
|
|
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();
|
|
47130
47091
|
}
|
|
47131
47092
|
checkExport(node, checkNames, isDefault, isFrom) {
|
|
47132
47093
|
if (checkNames) {
|
|
@@ -53944,7 +53905,7 @@ ${err.message}`);
|
|
|
53944
53905
|
throw new Error(
|
|
53945
53906
|
`Given organization ID (${flags.organization}) not found, or you do not have access to it`
|
|
53946
53907
|
);
|
|
53947
|
-
if (!await
|
|
53908
|
+
if (!await hasProjectAttachGrant(flags.organization))
|
|
53948
53909
|
throw new Error(
|
|
53949
53910
|
"You lack the necessary permissions to attach a project to this organization"
|
|
53950
53911
|
);
|
|
@@ -54152,7 +54113,6 @@ The default dataset configuration has a public dataset named "production".`;
|
|
|
54152
54113
|
};
|
|
54153
54114
|
}
|
|
54154
54115
|
async function prepareFlags() {
|
|
54155
|
-
cliFlags["project-id"] && !cliFlags.project && (cliFlags.project = cliFlags["project-id"]);
|
|
54156
54116
|
const createProjectName = cliFlags["create-project"];
|
|
54157
54117
|
if ((cliFlags.dataset || cliFlags.visibility || cliFlags["dataset-default"] || unattended) && (showDefaultConfigPrompt = !1), cliFlags.project && createProjectName)
|
|
54158
54118
|
throw new Error(
|
|
@@ -54209,7 +54169,7 @@ The default dataset configuration has a public dataset named "production".`;
|
|
|
54209
54169
|
}
|
|
54210
54170
|
return cliFlags;
|
|
54211
54171
|
}
|
|
54212
|
-
async function
|
|
54172
|
+
async function createOrganization(props = {}) {
|
|
54213
54173
|
const name = props.name || await prompt2.single({
|
|
54214
54174
|
type: "input",
|
|
54215
54175
|
message: "Organization name:",
|
|
@@ -54239,13 +54199,13 @@ The default dataset configuration has a public dataset named "production".`;
|
|
|
54239
54199
|
default: defaultOrganizationId || void 0,
|
|
54240
54200
|
choices: organizationChoices
|
|
54241
54201
|
});
|
|
54242
|
-
return chosenOrg === "-new-" ?
|
|
54202
|
+
return chosenOrg === "-new-" ? createOrganization().then((org) => org.id) : chosenOrg || void 0;
|
|
54243
54203
|
}
|
|
54244
54204
|
async function getOrganizationId(organizations) {
|
|
54245
54205
|
if (organizations.length === 0)
|
|
54246
|
-
return
|
|
54206
|
+
return createOrganization().then((org) => org.id);
|
|
54247
54207
|
loadEnv.debug(`User has ${organizations.length} organization(s), checking attach access`);
|
|
54248
|
-
const withGrantInfo = await
|
|
54208
|
+
const withGrantInfo = await getOrganizationsWithAttachGrantInfo(organizations), withAttach = withGrantInfo.filter(({ hasAttachGrant }) => hasAttachGrant);
|
|
54249
54209
|
loadEnv.debug("User has attach access to %d organizations.", withAttach.length);
|
|
54250
54210
|
const organizationChoices = [
|
|
54251
54211
|
...withGrantInfo.map(({ organization, hasAttachGrant }) => ({
|
|
@@ -54262,9 +54222,9 @@ The default dataset configuration has a public dataset named "production".`;
|
|
|
54262
54222
|
default: defaultOrganizationId || void 0,
|
|
54263
54223
|
choices: organizationChoices
|
|
54264
54224
|
});
|
|
54265
|
-
return chosenOrg === "-new-" ?
|
|
54225
|
+
return chosenOrg === "-new-" ? createOrganization().then((org) => org.id) : chosenOrg || void 0;
|
|
54266
54226
|
}
|
|
54267
|
-
async function
|
|
54227
|
+
async function hasProjectAttachGrant(orgId) {
|
|
54268
54228
|
const requiredGrantGroup = "sanity.organization.projects", requiredGrant = "attach", client2 = apiClient({ requireProject: !1, requireUser: !0 }).clone().config({ apiVersion: "v2021-06-07" });
|
|
54269
54229
|
try {
|
|
54270
54230
|
return ((await client2.request({ uri: `organizations/${orgId}/grants` }))[requiredGrantGroup] || []).some(
|
|
@@ -54274,11 +54234,11 @@ The default dataset configuration has a public dataset named "production".`;
|
|
|
54274
54234
|
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);
|
|
54275
54235
|
}
|
|
54276
54236
|
}
|
|
54277
|
-
function
|
|
54237
|
+
function getOrganizationsWithAttachGrantInfo(organizations) {
|
|
54278
54238
|
return pMap(
|
|
54279
54239
|
organizations,
|
|
54280
54240
|
async (organization) => ({
|
|
54281
|
-
hasAttachGrant: await
|
|
54241
|
+
hasAttachGrant: await hasProjectAttachGrant(organization.id),
|
|
54282
54242
|
organization
|
|
54283
54243
|
}),
|
|
54284
54244
|
{ concurrency: 3 }
|
|
@@ -54418,10 +54378,10 @@ function getImportCommand(outputPath, studioVersion) {
|
|
|
54418
54378
|
);
|
|
54419
54379
|
}
|
|
54420
54380
|
}
|
|
54421
|
-
const helpText$
|
|
54381
|
+
const helpText$7 = `
|
|
54422
54382
|
Options
|
|
54423
54383
|
-y, --yes Use unattended mode, accepting defaults and using only flags for choices
|
|
54424
|
-
--project
|
|
54384
|
+
--project <projectId> Project ID to use for the studio
|
|
54425
54385
|
--organization <organizationId> Organization ID to use for the project
|
|
54426
54386
|
--dataset <dataset> Dataset name for the studio
|
|
54427
54387
|
--dataset-default Set up a project with a public dataset named "production"
|
|
@@ -54471,7 +54431,7 @@ Examples
|
|
|
54471
54431
|
name: "init",
|
|
54472
54432
|
signature: "",
|
|
54473
54433
|
description: "Initializes a new Sanity Studio and/or project",
|
|
54474
|
-
helpText: helpText$
|
|
54434
|
+
helpText: helpText$7,
|
|
54475
54435
|
action: async (args, context) => {
|
|
54476
54436
|
const [type2] = args.argsWithoutOptions;
|
|
54477
54437
|
if (type2)
|
|
@@ -54509,7 +54469,7 @@ Examples
|
|
|
54509
54469
|
const { output } = context, { print } = output, url = "https://www.sanity.io/learn";
|
|
54510
54470
|
print(`Opening ${url}`), await open(url);
|
|
54511
54471
|
}
|
|
54512
|
-
}, helpText$
|
|
54472
|
+
}, helpText$6 = `
|
|
54513
54473
|
Options
|
|
54514
54474
|
--sso <slug> Log in using Single Sign On, using the given slug
|
|
54515
54475
|
--provider <providerId> Authenticate against a specific provider
|
|
@@ -54527,16 +54487,16 @@ Examples
|
|
|
54527
54487
|
`, loginCommand = {
|
|
54528
54488
|
name: "login",
|
|
54529
54489
|
signature: "[--sso <slug>] [--provider <providerId>] [--no-open]",
|
|
54530
|
-
helpText: helpText$
|
|
54490
|
+
helpText: helpText$6,
|
|
54531
54491
|
description: "Authenticates the CLI for access to Sanity projects",
|
|
54532
54492
|
action: login
|
|
54533
|
-
}, helpText$
|
|
54493
|
+
}, helpText$5 = `
|
|
54534
54494
|
Examples
|
|
54535
54495
|
# Log out of the CLI
|
|
54536
54496
|
sanity logout
|
|
54537
54497
|
`, logoutCommand = {
|
|
54538
54498
|
name: "logout",
|
|
54539
|
-
helpText: helpText$
|
|
54499
|
+
helpText: helpText$5,
|
|
54540
54500
|
signature: "logout",
|
|
54541
54501
|
description: "Logs out the CLI from the current user session",
|
|
54542
54502
|
async action(args, { output, apiClient }) {
|
|
@@ -54566,239 +54526,6 @@ ${err.message}`));
|
|
|
54566
54526
|
const { output, cliConfig } = context, { print } = output, projectId = cliConfig?.api?.projectId, url = projectId ? `https://www.sanity.io/manage/project/${projectId}` : "https://www.sanity.io/manage/";
|
|
54567
54527
|
print(`Opening ${url}`), await open(url);
|
|
54568
54528
|
}
|
|
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
|
-
}
|
|
54802
54529
|
}, headings = ["id", "members", "name", "url", "created"], helpText$4 = `
|
|
54803
54530
|
Options
|
|
54804
54531
|
--sort <field> Sort output by specified column
|
|
@@ -54839,7 +54566,7 @@ Examples
|
|
|
54839
54566
|
name: "projects",
|
|
54840
54567
|
signature: "[COMMAND]",
|
|
54841
54568
|
isGroupRoot: !0,
|
|
54842
|
-
description: "
|
|
54569
|
+
description: "Lists all projects associated with your logged-in account"
|
|
54843
54570
|
}, helpText$3 = `
|
|
54844
54571
|
Examples
|
|
54845
54572
|
# Check telemetry consent status for your logged in user
|
|
@@ -55060,7 +54787,6 @@ const baseCommands = [
|
|
|
55060
54787
|
projectGroup,
|
|
55061
54788
|
learnCommand,
|
|
55062
54789
|
listProjectsCommand,
|
|
55063
|
-
createProjectCommand,
|
|
55064
54790
|
codemodCommand,
|
|
55065
54791
|
telemetryGroup,
|
|
55066
54792
|
disableTelemetryCommand,
|