@sanity/cli 3.72.2-corel.577 → 3.72.2-coreui.15
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
CHANGED
@@ -26706,7 +26706,7 @@ async function applyEnvVariables(root2, envData, targetName = ".env") {
|
|
26706
26706
|
});
|
26707
26707
|
if (templatePath)
|
26708
26708
|
try {
|
26709
|
-
const templateContent = await fs.readFile(path$3.join(root2, templatePath), "utf8"), { projectId, dataset, readToken = "" } = envData, findAndReplaceVariable = (content, varRegex, value, useQuotes2) => {
|
26709
|
+
const templateContent = await fs.readFile(path$3.join(root2, templatePath), "utf8"), { projectId, dataset, readToken = "", writeToken = "" } = envData, findAndReplaceVariable = (content, varRegex, value, useQuotes2) => {
|
26710
26710
|
const varPattern = typeof varRegex == "string" ? varRegex : varRegex.source, pattern = new RegExp(`.*${varPattern}=.*$`, "gm"), matches = content.matchAll(pattern);
|
26711
26711
|
return Array.from(matches).reduce((updatedContent, match2) => {
|
26712
26712
|
if (!match2[0]) return updatedContent;
|
@@ -26721,7 +26721,8 @@ async function applyEnvVariables(root2, envData, targetName = ".env") {
|
|
26721
26721
|
const vars = [
|
26722
26722
|
{ pattern: ENV_VAR.PROJECT_ID, value: projectId },
|
26723
26723
|
{ pattern: ENV_VAR.DATASET, value: dataset },
|
26724
|
-
{ pattern: ENV_VAR.READ_TOKEN, value: readToken }
|
26724
|
+
{ pattern: ENV_VAR.READ_TOKEN, value: readToken },
|
26725
|
+
{ pattern: ENV_VAR.WRITE_TOKEN, value: writeToken }
|
26725
26726
|
], useQuotes = templateContent.includes('="');
|
26726
26727
|
for (const { pattern, value } of vars)
|
26727
26728
|
envContent = findAndReplaceVariable(envContent, pattern, value, useQuotes);
|
@@ -37615,7 +37616,7 @@ function requireLib$1() {
|
|
37615
37616
|
StrictWith: "'with' in strict mode."
|
37616
37617
|
};
|
37617
37618
|
const UnparenthesizedPipeBodyDescriptions = /* @__PURE__ */ new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
|
37618
|
-
var PipelineOperatorErrors = {
|
37619
|
+
var PipelineOperatorErrors = Object.assign({
|
37619
37620
|
PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
|
37620
37621
|
PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
|
37621
37622
|
PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
|
@@ -37627,14 +37628,15 @@ function requireLib$1() {
|
|
37627
37628
|
type: type2
|
37628
37629
|
}) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({
|
37629
37630
|
type: type2
|
37630
|
-
})}; please wrap it in parentheses
|
37631
|
+
})}; please wrap it in parentheses.`
|
37632
|
+
}, {
|
37631
37633
|
PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',
|
37632
37634
|
PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.",
|
37633
37635
|
PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.",
|
37634
37636
|
PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.",
|
37635
37637
|
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
37636
37638
|
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
37637
|
-
};
|
37639
|
+
});
|
37638
37640
|
const _excluded = ["message"];
|
37639
37641
|
function defineHidden(obj, key2, value) {
|
37640
37642
|
Object.defineProperty(obj, key2, {
|
@@ -37858,7 +37860,7 @@ function requireLib$1() {
|
|
37858
37860
|
const {
|
37859
37861
|
typeParameters
|
37860
37862
|
} = node;
|
37861
|
-
return typeParameters && (delete node.typeParameters, funcNode.typeParameters = typeParameters, funcNode
|
37863
|
+
return typeParameters && (delete node.typeParameters, funcNode.typeParameters = typeParameters, this.resetStartLocationFromNode(funcNode, typeParameters)), type2 === "ClassPrivateMethod" && (node.computed = !1), this.finishNode(node, "MethodDefinition");
|
37862
37864
|
}
|
37863
37865
|
nameIsConstructor(key2) {
|
37864
37866
|
return key2.type === "Literal" ? key2.value === "constructor" : super.nameIsConstructor(key2);
|
@@ -42776,19 +42778,28 @@ function requireLib$1() {
|
|
42776
42778
|
}
|
42777
42779
|
tsParseImportType() {
|
42778
42780
|
const node = this.startNode();
|
42779
|
-
return this.expect(83), this.expect(10), this.match(134) ? node.argument = this.parseStringLiteral(this.state.value) : (this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc), node.argument = super.parseExprAtom()), this.eat(12) && !this.match(11) ? (node.options = super.parseMaybeAssignAllowIn(), this.eat(12)) : node.options = null, this.expect(11), this.eat(16) && (node.qualifier = this.tsParseEntityName()), this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSImportType");
|
42781
|
+
return this.expect(83), this.expect(10), this.match(134) ? node.argument = this.parseStringLiteral(this.state.value) : (this.raise(TSErrors.UnsupportedImportTypeArgument, this.state.startLoc), node.argument = super.parseExprAtom()), this.eat(12) && !this.match(11) ? (node.options = super.parseMaybeAssignAllowIn(), this.eat(12)) : node.options = null, this.expect(11), this.eat(16) && (node.qualifier = this.tsParseEntityName(3)), this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSImportType");
|
42780
42782
|
}
|
42781
|
-
tsParseEntityName(
|
42782
|
-
let entity
|
42783
|
+
tsParseEntityName(flags) {
|
42784
|
+
let entity;
|
42785
|
+
if (flags & 1 && this.match(78))
|
42786
|
+
if (flags & 2)
|
42787
|
+
entity = this.parseIdentifier(!0);
|
42788
|
+
else {
|
42789
|
+
const node = this.startNode();
|
42790
|
+
this.next(), entity = this.finishNode(node, "ThisExpression");
|
42791
|
+
}
|
42792
|
+
else
|
42793
|
+
entity = this.parseIdentifier(!!(flags & 1));
|
42783
42794
|
for (; this.eat(16); ) {
|
42784
42795
|
const node = this.startNodeAtNode(entity);
|
42785
|
-
node.left = entity, node.right = this.parseIdentifier(
|
42796
|
+
node.left = entity, node.right = this.parseIdentifier(!!(flags & 1)), entity = this.finishNode(node, "TSQualifiedName");
|
42786
42797
|
}
|
42787
42798
|
return entity;
|
42788
42799
|
}
|
42789
42800
|
tsParseTypeReference() {
|
42790
42801
|
const node = this.startNode();
|
42791
|
-
return node.typeName = this.tsParseEntityName(), !this.hasPrecedingLineBreak() && this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSTypeReference");
|
42802
|
+
return node.typeName = this.tsParseEntityName(1), !this.hasPrecedingLineBreak() && this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSTypeReference");
|
42792
42803
|
}
|
42793
42804
|
tsParseThisTypePredicate(lhs) {
|
42794
42805
|
this.next();
|
@@ -42801,7 +42812,7 @@ function requireLib$1() {
|
|
42801
42812
|
}
|
42802
42813
|
tsParseTypeQuery() {
|
42803
42814
|
const node = this.startNode();
|
42804
|
-
return this.expect(87), this.match(83) ? node.exprName = this.tsParseImportType() : node.exprName = this.tsParseEntityName(), !this.hasPrecedingLineBreak() && this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSTypeQuery");
|
42815
|
+
return this.expect(87), this.match(83) ? node.exprName = this.tsParseImportType() : node.exprName = this.tsParseEntityName(3), !this.hasPrecedingLineBreak() && this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSTypeQuery");
|
42805
42816
|
}
|
42806
42817
|
tsParseTypeParameter(parseModifiers) {
|
42807
42818
|
const node = this.startNode();
|
@@ -43187,7 +43198,7 @@ function requireLib$1() {
|
|
43187
43198
|
tsParseHeritageClause(token2) {
|
43188
43199
|
const originalStartLoc = this.state.startLoc, delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
|
43189
43200
|
const node = this.startNode();
|
43190
|
-
return node.expression = this.tsParseEntityName(), this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSExpressionWithTypeArguments");
|
43201
|
+
return node.expression = this.tsParseEntityName(3), this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSExpressionWithTypeArguments");
|
43191
43202
|
});
|
43192
43203
|
return delimitedList.length || this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
43193
43204
|
token: token2
|
@@ -43292,7 +43303,7 @@ function requireLib$1() {
|
|
43292
43303
|
return this.isContextual(119) && this.lookaheadCharCode() === 40;
|
43293
43304
|
}
|
43294
43305
|
tsParseModuleReference() {
|
43295
|
-
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(
|
43306
|
+
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(0);
|
43296
43307
|
}
|
43297
43308
|
tsParseExternalModuleReference() {
|
43298
43309
|
const node = this.startNode();
|
@@ -44410,15 +44421,15 @@ function requireLib$1() {
|
|
44410
44421
|
switch (this.getPluginOption("pipelineOperator", "proposal")) {
|
44411
44422
|
case "hack":
|
44412
44423
|
return this.withTopicBindingContext(() => this.parseHackPipeBody());
|
44413
|
-
case "smart":
|
44414
|
-
return this.withTopicBindingContext(() => {
|
44415
|
-
if (this.prodParam.hasYield && this.isContextual(108))
|
44416
|
-
throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
|
44417
|
-
return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
|
44418
|
-
});
|
44419
44424
|
case "fsharp":
|
44420
44425
|
return this.withSoloAwaitPermittingContext(() => this.parseFSharpPipelineBody(prec));
|
44421
44426
|
}
|
44427
|
+
if (this.getPluginOption("pipelineOperator", "proposal") === "smart")
|
44428
|
+
return this.withTopicBindingContext(() => {
|
44429
|
+
if (this.prodParam.hasYield && this.isContextual(108))
|
44430
|
+
throw this.raise(Errors.PipeBodyIsTighter, this.state.startLoc);
|
44431
|
+
return this.parseSmartPipelineBodyInStyle(this.parseExprOpBaseRightExpr(op, prec), startLoc);
|
44432
|
+
});
|
44422
44433
|
default:
|
44423
44434
|
return this.parseExprOpBaseRightExpr(op, prec);
|
44424
44435
|
}
|
@@ -44704,13 +44715,11 @@ function requireLib$1() {
|
|
44704
44715
|
return this.next(), this.finishTopicReference(node, startLoc, pipeProposal, tokenType);
|
44705
44716
|
}
|
44706
44717
|
finishTopicReference(node, startLoc, pipeProposal, tokenType) {
|
44707
|
-
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType))
|
44708
|
-
|
44709
|
-
|
44710
|
-
|
44711
|
-
|
44712
|
-
token: tokenLabelName(tokenType)
|
44713
|
-
});
|
44718
|
+
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType))
|
44719
|
+
return pipeProposal === "hack" ? (this.topicReferenceIsAllowedInCurrentContext() || this.raise(Errors.PipeTopicUnbound, startLoc), this.registerTopicReference(), this.finishNode(node, "TopicReference")) : (this.topicReferenceIsAllowedInCurrentContext() || this.raise(Errors.PrimaryTopicNotAllowed, startLoc), this.registerTopicReference(), this.finishNode(node, "PipelinePrimaryTopicReference"));
|
44720
|
+
throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
|
44721
|
+
token: tokenLabelName(tokenType)
|
44722
|
+
});
|
44714
44723
|
}
|
44715
44724
|
testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType) {
|
44716
44725
|
switch (pipeProposal) {
|
@@ -51917,7 +51926,7 @@ async function bootstrapRemoteTemplate(opts, context) {
|
|
51917
51926
|
}), port = getDefaultPortForFramework(packageFramework?.slug);
|
51918
51927
|
corsAdded.includes(port) === !1 && (loadEnv.debug("Setting CORS origin to http://localhost:%d", port), await setCorsOrigin(`http://localhost:${port}`, variables.projectId, apiClient), corsAdded.push(port)), loadEnv.debug("Applying environment variables to %s", pkg);
|
51919
51928
|
const envName = packageFramework?.slug === "nextjs" ? ".env.local" : ".env";
|
51920
|
-
await applyEnvVariables(packagePath, { ...variables, readToken }, envName);
|
51929
|
+
await applyEnvVariables(packagePath, { ...variables, readToken, writeToken }, envName);
|
51921
51930
|
}
|
51922
51931
|
loadEnv.debug("Setting package name to %s", packageName), await tryApplyPackageName(outputPath, packageName), loadEnv.debug("Initializing git repository"), tryGitInit(outputPath, INITIAL_COMMIT_MESSAGE), loadEnv.debug("Updating initial template metadata"), await updateInitialTemplateMetadata(apiClient, variables.projectId, `external-${name}`), spinner.succeed(), corsAdded.length && output.success(`CORS origins added (${corsAdded.map((p) => `localhost:${p}`).join(", ")})`), readToken && output.success(`API token generated (${READ_TOKEN_LABEL})`), writeToken && output.success(`API token generated (${WRITE_TOKEN_LABEL})`);
|
51923
51932
|
}
|