@sanity/cli 3.72.2-corel.23 → 3.72.2-corel.577
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 = ""
|
26709
|
+
const templateContent = await fs.readFile(path$3.join(root2, templatePath), "utf8"), { projectId, dataset, readToken = "" } = 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,8 +26721,7 @@ 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 }
|
26725
|
-
{ pattern: ENV_VAR.WRITE_TOKEN, value: writeToken }
|
26724
|
+
{ pattern: ENV_VAR.READ_TOKEN, value: readToken }
|
26726
26725
|
], useQuotes = templateContent.includes('="');
|
26727
26726
|
for (const { pattern, value } of vars)
|
26728
26727
|
envContent = findAndReplaceVariable(envContent, pattern, value, useQuotes);
|
@@ -37616,7 +37615,7 @@ function requireLib$1() {
|
|
37616
37615
|
StrictWith: "'with' in strict mode."
|
37617
37616
|
};
|
37618
37617
|
const UnparenthesizedPipeBodyDescriptions = /* @__PURE__ */ new Set(["ArrowFunctionExpression", "AssignmentExpression", "ConditionalExpression", "YieldExpression"]);
|
37619
|
-
var PipelineOperatorErrors =
|
37618
|
+
var PipelineOperatorErrors = {
|
37620
37619
|
PipeBodyIsTighter: "Unexpected yield after pipeline body; any yield expression acting as Hack-style pipe body must be parenthesized due to its loose operator precedence.",
|
37621
37620
|
PipeTopicRequiresHackPipes: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.',
|
37622
37621
|
PipeTopicUnbound: "Topic reference is unbound; it must be inside a pipe body.",
|
@@ -37628,15 +37627,14 @@ function requireLib$1() {
|
|
37628
37627
|
type: type2
|
37629
37628
|
}) => `Hack-style pipe body cannot be an unparenthesized ${toNodeDescription({
|
37630
37629
|
type: type2
|
37631
|
-
})}; please wrap it in parentheses
|
37632
|
-
}, {
|
37630
|
+
})}; please wrap it in parentheses.`,
|
37633
37631
|
PipelineBodyNoArrow: 'Unexpected arrow "=>" after pipeline body; arrow function in pipeline body must be parenthesized.',
|
37634
37632
|
PipelineBodySequenceExpression: "Pipeline body may not be a comma-separated sequence expression.",
|
37635
37633
|
PipelineHeadSequenceExpression: "Pipeline head should not be a comma-separated sequence expression.",
|
37636
37634
|
PipelineTopicUnused: "Pipeline is in topic style but does not use topic reference.",
|
37637
37635
|
PrimaryTopicNotAllowed: "Topic reference was used in a lexical context without topic binding.",
|
37638
37636
|
PrimaryTopicRequiresSmartPipeline: 'Topic reference is used, but the pipelineOperator plugin was not passed a "proposal": "hack" or "smart" option.'
|
37639
|
-
}
|
37637
|
+
};
|
37640
37638
|
const _excluded = ["message"];
|
37641
37639
|
function defineHidden(obj, key2, value) {
|
37642
37640
|
Object.defineProperty(obj, key2, {
|
@@ -37860,7 +37858,7 @@ function requireLib$1() {
|
|
37860
37858
|
const {
|
37861
37859
|
typeParameters
|
37862
37860
|
} = node;
|
37863
|
-
return typeParameters && (delete node.typeParameters, funcNode.typeParameters = typeParameters,
|
37861
|
+
return typeParameters && (delete node.typeParameters, funcNode.typeParameters = typeParameters, funcNode.start = typeParameters.start, funcNode.loc.start = typeParameters.loc.start), type2 === "ClassPrivateMethod" && (node.computed = !1), this.finishNode(node, "MethodDefinition");
|
37864
37862
|
}
|
37865
37863
|
nameIsConstructor(key2) {
|
37866
37864
|
return key2.type === "Literal" ? key2.value === "constructor" : super.nameIsConstructor(key2);
|
@@ -42778,28 +42776,19 @@ function requireLib$1() {
|
|
42778
42776
|
}
|
42779
42777
|
tsParseImportType() {
|
42780
42778
|
const node = this.startNode();
|
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(
|
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");
|
42782
42780
|
}
|
42783
|
-
tsParseEntityName(
|
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));
|
42781
|
+
tsParseEntityName(allowReservedWords = !0) {
|
42782
|
+
let entity = this.parseIdentifier(allowReservedWords);
|
42794
42783
|
for (; this.eat(16); ) {
|
42795
42784
|
const node = this.startNodeAtNode(entity);
|
42796
|
-
node.left = entity, node.right = this.parseIdentifier(
|
42785
|
+
node.left = entity, node.right = this.parseIdentifier(allowReservedWords), entity = this.finishNode(node, "TSQualifiedName");
|
42797
42786
|
}
|
42798
42787
|
return entity;
|
42799
42788
|
}
|
42800
42789
|
tsParseTypeReference() {
|
42801
42790
|
const node = this.startNode();
|
42802
|
-
return node.typeName = this.tsParseEntityName(
|
42791
|
+
return node.typeName = this.tsParseEntityName(), !this.hasPrecedingLineBreak() && this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSTypeReference");
|
42803
42792
|
}
|
42804
42793
|
tsParseThisTypePredicate(lhs) {
|
42805
42794
|
this.next();
|
@@ -42812,7 +42801,7 @@ function requireLib$1() {
|
|
42812
42801
|
}
|
42813
42802
|
tsParseTypeQuery() {
|
42814
42803
|
const node = this.startNode();
|
42815
|
-
return this.expect(87), this.match(83) ? node.exprName = this.tsParseImportType() : node.exprName = this.tsParseEntityName(
|
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");
|
42816
42805
|
}
|
42817
42806
|
tsParseTypeParameter(parseModifiers) {
|
42818
42807
|
const node = this.startNode();
|
@@ -43198,7 +43187,7 @@ function requireLib$1() {
|
|
43198
43187
|
tsParseHeritageClause(token2) {
|
43199
43188
|
const originalStartLoc = this.state.startLoc, delimitedList = this.tsParseDelimitedList("HeritageClauseElement", () => {
|
43200
43189
|
const node = this.startNode();
|
43201
|
-
return node.expression = this.tsParseEntityName(
|
43190
|
+
return node.expression = this.tsParseEntityName(), this.match(47) && (node.typeParameters = this.tsParseTypeArguments()), this.finishNode(node, "TSExpressionWithTypeArguments");
|
43202
43191
|
});
|
43203
43192
|
return delimitedList.length || this.raise(TSErrors.EmptyHeritageClauseType, originalStartLoc, {
|
43204
43193
|
token: token2
|
@@ -43303,7 +43292,7 @@ function requireLib$1() {
|
|
43303
43292
|
return this.isContextual(119) && this.lookaheadCharCode() === 40;
|
43304
43293
|
}
|
43305
43294
|
tsParseModuleReference() {
|
43306
|
-
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(
|
43295
|
+
return this.tsIsExternalModuleReference() ? this.tsParseExternalModuleReference() : this.tsParseEntityName(!1);
|
43307
43296
|
}
|
43308
43297
|
tsParseExternalModuleReference() {
|
43309
43298
|
const node = this.startNode();
|
@@ -44421,15 +44410,15 @@ function requireLib$1() {
|
|
44421
44410
|
switch (this.getPluginOption("pipelineOperator", "proposal")) {
|
44422
44411
|
case "hack":
|
44423
44412
|
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
|
+
});
|
44424
44419
|
case "fsharp":
|
44425
44420
|
return this.withSoloAwaitPermittingContext(() => this.parseFSharpPipelineBody(prec));
|
44426
44421
|
}
|
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
|
-
});
|
44433
44422
|
default:
|
44434
44423
|
return this.parseExprOpBaseRightExpr(op, prec);
|
44435
44424
|
}
|
@@ -44715,11 +44704,13 @@ function requireLib$1() {
|
|
44715
44704
|
return this.next(), this.finishTopicReference(node, startLoc, pipeProposal, tokenType);
|
44716
44705
|
}
|
44717
44706
|
finishTopicReference(node, startLoc, pipeProposal, tokenType) {
|
44718
|
-
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType))
|
44719
|
-
|
44720
|
-
|
44721
|
-
|
44722
|
-
|
44707
|
+
if (this.testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType)) {
|
44708
|
+
const nodeType = pipeProposal === "smart" ? "PipelinePrimaryTopicReference" : "TopicReference";
|
44709
|
+
return this.topicReferenceIsAllowedInCurrentContext() || this.raise(pipeProposal === "smart" ? Errors.PrimaryTopicNotAllowed : Errors.PipeTopicUnbound, startLoc), this.registerTopicReference(), this.finishNode(node, nodeType);
|
44710
|
+
} else
|
44711
|
+
throw this.raise(Errors.PipeTopicUnconfiguredToken, startLoc, {
|
44712
|
+
token: tokenLabelName(tokenType)
|
44713
|
+
});
|
44723
44714
|
}
|
44724
44715
|
testTopicReferenceConfiguration(pipeProposal, startLoc, tokenType) {
|
44725
44716
|
switch (pipeProposal) {
|
@@ -51926,7 +51917,7 @@ async function bootstrapRemoteTemplate(opts, context) {
|
|
51926
51917
|
}), port = getDefaultPortForFramework(packageFramework?.slug);
|
51927
51918
|
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);
|
51928
51919
|
const envName = packageFramework?.slug === "nextjs" ? ".env.local" : ".env";
|
51929
|
-
await applyEnvVariables(packagePath, { ...variables, readToken
|
51920
|
+
await applyEnvVariables(packagePath, { ...variables, readToken }, envName);
|
51930
51921
|
}
|
51931
51922
|
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})`);
|
51932
51923
|
}
|