webstudio 0.302.0 → 0.304.0
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/cli.js +403 -118
- package/package.json +21 -21
- package/templates/cloudflare/package.json +1 -1
- package/templates/defaults/package.json +8 -8
- package/templates/react-router/package.json +8 -8
- package/templates/react-router-cloudflare/package.json +1 -1
- package/templates/ssg/package.json +6 -6
package/lib/cli.js
CHANGED
|
@@ -20,7 +20,7 @@ import fs, { rm, mkdtemp, writeFile, readFile, access, constants as constants$1,
|
|
|
20
20
|
import { gzip } from "node:zlib";
|
|
21
21
|
import { execFile, spawn } from "node:child_process";
|
|
22
22
|
import { promisify, isDeepStrictEqual } from "node:util";
|
|
23
|
-
import { readdirSync, constants as constants$2, createWriteStream, existsSync, realpathSync, readFileSync } from "node:fs";
|
|
23
|
+
import { readdirSync, constants as constants$2, createWriteStream, existsSync, createReadStream, realpathSync, readFileSync } from "node:fs";
|
|
24
24
|
import envPaths from "env-paths";
|
|
25
25
|
import { randomUUID, createHash } from "node:crypto";
|
|
26
26
|
import { text as text$d, isCancel, cancel, log, spinner, confirm, select as select$3 } from "@clack/prompts";
|
|
@@ -59876,12 +59876,29 @@ const diagnosticContext = {
|
|
|
59876
59876
|
renderScope: string$5().min(1).optional(),
|
|
59877
59877
|
sourceRange: contentBlockSourceRange.optional()
|
|
59878
59878
|
};
|
|
59879
|
+
const invalidMdxDiagnosticReason = _enum([
|
|
59880
|
+
// The MDX source was identified, but reading it from asset storage failed.
|
|
59881
|
+
"source-read-failed",
|
|
59882
|
+
// The MDX document exists, but its revision, content reference, or source text is unavailable.
|
|
59883
|
+
"missing-source",
|
|
59884
|
+
// No MDX document in the publication artifact matches the requested asset ID.
|
|
59885
|
+
"missing-asset",
|
|
59886
|
+
// A document referenced from MDX frontmatter could not be loaded or resolved.
|
|
59887
|
+
"linked-document-unavailable",
|
|
59888
|
+
// The rendered MDX violates HTML nesting rules, such as a link inside a link.
|
|
59889
|
+
"html-content-model",
|
|
59890
|
+
// Dynamic MDX contains Resources that cannot be selected safely for a Collection item or action.
|
|
59891
|
+
"dynamic-resource",
|
|
59892
|
+
// A dynamic source has no known candidates or exceeds the supported candidate limit.
|
|
59893
|
+
"dynamic-source-unbounded"
|
|
59894
|
+
]);
|
|
59879
59895
|
const contentBlockDiagnostic = discriminatedUnion("code", [
|
|
59880
59896
|
strictObject({
|
|
59881
59897
|
...diagnosticContext,
|
|
59882
59898
|
code: literal$2("invalid-mdx"),
|
|
59883
59899
|
severity: literal$2("error"),
|
|
59884
|
-
message: string$5().min(1)
|
|
59900
|
+
message: string$5().min(1),
|
|
59901
|
+
reason: invalidMdxDiagnosticReason.optional()
|
|
59885
59902
|
}),
|
|
59886
59903
|
strictObject({
|
|
59887
59904
|
...diagnosticContext,
|
|
@@ -63515,6 +63532,18 @@ const runtimeOperationContractData = [
|
|
|
63515
63532
|
message: {
|
|
63516
63533
|
type: "string",
|
|
63517
63534
|
minLength: 1
|
|
63535
|
+
},
|
|
63536
|
+
reason: {
|
|
63537
|
+
type: "string",
|
|
63538
|
+
enum: [
|
|
63539
|
+
"source-read-failed",
|
|
63540
|
+
"missing-source",
|
|
63541
|
+
"missing-asset",
|
|
63542
|
+
"linked-document-unavailable",
|
|
63543
|
+
"html-content-model",
|
|
63544
|
+
"dynamic-resource",
|
|
63545
|
+
"dynamic-source-unbounded"
|
|
63546
|
+
]
|
|
63518
63547
|
}
|
|
63519
63548
|
},
|
|
63520
63549
|
required: ["blockInstanceId", "code", "severity", "message"],
|
|
@@ -64093,6 +64122,18 @@ const runtimeOperationContractData = [
|
|
|
64093
64122
|
message: {
|
|
64094
64123
|
type: "string",
|
|
64095
64124
|
minLength: 1
|
|
64125
|
+
},
|
|
64126
|
+
reason: {
|
|
64127
|
+
type: "string",
|
|
64128
|
+
enum: [
|
|
64129
|
+
"source-read-failed",
|
|
64130
|
+
"missing-source",
|
|
64131
|
+
"missing-asset",
|
|
64132
|
+
"linked-document-unavailable",
|
|
64133
|
+
"html-content-model",
|
|
64134
|
+
"dynamic-resource",
|
|
64135
|
+
"dynamic-source-unbounded"
|
|
64136
|
+
]
|
|
64096
64137
|
}
|
|
64097
64138
|
},
|
|
64098
64139
|
required: ["blockInstanceId", "code", "severity", "message"],
|
|
@@ -64690,6 +64731,18 @@ const runtimeOperationContractData = [
|
|
|
64690
64731
|
message: {
|
|
64691
64732
|
type: "string",
|
|
64692
64733
|
minLength: 1
|
|
64734
|
+
},
|
|
64735
|
+
reason: {
|
|
64736
|
+
type: "string",
|
|
64737
|
+
enum: [
|
|
64738
|
+
"source-read-failed",
|
|
64739
|
+
"missing-source",
|
|
64740
|
+
"missing-asset",
|
|
64741
|
+
"linked-document-unavailable",
|
|
64742
|
+
"html-content-model",
|
|
64743
|
+
"dynamic-resource",
|
|
64744
|
+
"dynamic-source-unbounded"
|
|
64745
|
+
]
|
|
64693
64746
|
}
|
|
64694
64747
|
},
|
|
64695
64748
|
required: ["blockInstanceId", "code", "severity", "message"],
|
|
@@ -65253,6 +65306,18 @@ const runtimeOperationContractData = [
|
|
|
65253
65306
|
message: {
|
|
65254
65307
|
type: "string",
|
|
65255
65308
|
minLength: 1
|
|
65309
|
+
},
|
|
65310
|
+
reason: {
|
|
65311
|
+
type: "string",
|
|
65312
|
+
enum: [
|
|
65313
|
+
"source-read-failed",
|
|
65314
|
+
"missing-source",
|
|
65315
|
+
"missing-asset",
|
|
65316
|
+
"linked-document-unavailable",
|
|
65317
|
+
"html-content-model",
|
|
65318
|
+
"dynamic-resource",
|
|
65319
|
+
"dynamic-source-unbounded"
|
|
65320
|
+
]
|
|
65256
65321
|
}
|
|
65257
65322
|
},
|
|
65258
65323
|
required: ["blockInstanceId", "code", "severity", "message"],
|
|
@@ -65822,6 +65887,18 @@ const runtimeOperationContractData = [
|
|
|
65822
65887
|
message: {
|
|
65823
65888
|
type: "string",
|
|
65824
65889
|
minLength: 1
|
|
65890
|
+
},
|
|
65891
|
+
reason: {
|
|
65892
|
+
type: "string",
|
|
65893
|
+
enum: [
|
|
65894
|
+
"source-read-failed",
|
|
65895
|
+
"missing-source",
|
|
65896
|
+
"missing-asset",
|
|
65897
|
+
"linked-document-unavailable",
|
|
65898
|
+
"html-content-model",
|
|
65899
|
+
"dynamic-resource",
|
|
65900
|
+
"dynamic-source-unbounded"
|
|
65901
|
+
]
|
|
65825
65902
|
}
|
|
65826
65903
|
},
|
|
65827
65904
|
required: ["blockInstanceId", "code", "severity", "message"],
|
|
@@ -66373,6 +66450,18 @@ const runtimeOperationContractData = [
|
|
|
66373
66450
|
message: {
|
|
66374
66451
|
type: "string",
|
|
66375
66452
|
minLength: 1
|
|
66453
|
+
},
|
|
66454
|
+
reason: {
|
|
66455
|
+
type: "string",
|
|
66456
|
+
enum: [
|
|
66457
|
+
"source-read-failed",
|
|
66458
|
+
"missing-source",
|
|
66459
|
+
"missing-asset",
|
|
66460
|
+
"linked-document-unavailable",
|
|
66461
|
+
"html-content-model",
|
|
66462
|
+
"dynamic-resource",
|
|
66463
|
+
"dynamic-source-unbounded"
|
|
66464
|
+
]
|
|
66376
66465
|
}
|
|
66377
66466
|
},
|
|
66378
66467
|
required: ["blockInstanceId", "code", "severity", "message"],
|
|
@@ -66917,6 +67006,18 @@ const runtimeOperationContractData = [
|
|
|
66917
67006
|
message: {
|
|
66918
67007
|
type: "string",
|
|
66919
67008
|
minLength: 1
|
|
67009
|
+
},
|
|
67010
|
+
reason: {
|
|
67011
|
+
type: "string",
|
|
67012
|
+
enum: [
|
|
67013
|
+
"source-read-failed",
|
|
67014
|
+
"missing-source",
|
|
67015
|
+
"missing-asset",
|
|
67016
|
+
"linked-document-unavailable",
|
|
67017
|
+
"html-content-model",
|
|
67018
|
+
"dynamic-resource",
|
|
67019
|
+
"dynamic-source-unbounded"
|
|
67020
|
+
]
|
|
66920
67021
|
}
|
|
66921
67022
|
},
|
|
66922
67023
|
required: ["blockInstanceId", "code", "severity", "message"],
|
|
@@ -114137,6 +114238,18 @@ const runtimeOperationContractData = [
|
|
|
114137
114238
|
message: {
|
|
114138
114239
|
type: "string",
|
|
114139
114240
|
minLength: 1
|
|
114241
|
+
},
|
|
114242
|
+
reason: {
|
|
114243
|
+
type: "string",
|
|
114244
|
+
enum: [
|
|
114245
|
+
"source-read-failed",
|
|
114246
|
+
"missing-source",
|
|
114247
|
+
"missing-asset",
|
|
114248
|
+
"linked-document-unavailable",
|
|
114249
|
+
"html-content-model",
|
|
114250
|
+
"dynamic-resource",
|
|
114251
|
+
"dynamic-source-unbounded"
|
|
114252
|
+
]
|
|
114140
114253
|
}
|
|
114141
114254
|
},
|
|
114142
114255
|
required: ["blockInstanceId", "code", "severity", "message"],
|
|
@@ -188102,29 +188215,41 @@ const findVariablesByInstanceId = ({
|
|
|
188102
188215
|
}
|
|
188103
188216
|
return { maskedIdByName, availableDataSourceIds };
|
|
188104
188217
|
};
|
|
188218
|
+
const createFindAvailableVariables = ({
|
|
188219
|
+
instances,
|
|
188220
|
+
dataSources
|
|
188221
|
+
}) => {
|
|
188222
|
+
const parentInstanceById = getParentInstanceById(instances);
|
|
188223
|
+
const dataSourcesByScopeInstanceId = getDataSourcesByScopeInstanceId(dataSources);
|
|
188224
|
+
return (startingInstanceId) => {
|
|
188225
|
+
const { maskedIdByName } = findVariablesByInstanceId({
|
|
188226
|
+
startingInstanceId,
|
|
188227
|
+
parentInstanceById,
|
|
188228
|
+
instances,
|
|
188229
|
+
dataSources,
|
|
188230
|
+
dataSourcesByScopeInstanceId
|
|
188231
|
+
});
|
|
188232
|
+
const availableVariables = [];
|
|
188233
|
+
for (const dataSourceId2 of maskedIdByName.values()) {
|
|
188234
|
+
const dataSource2 = dataSources.get(dataSourceId2);
|
|
188235
|
+
if (dataSource2) {
|
|
188236
|
+
availableVariables.push(dataSource2);
|
|
188237
|
+
}
|
|
188238
|
+
if (dataSourceId2 === SYSTEM_VARIABLE_ID) {
|
|
188239
|
+
availableVariables.push(systemParameter);
|
|
188240
|
+
}
|
|
188241
|
+
}
|
|
188242
|
+
return availableVariables;
|
|
188243
|
+
};
|
|
188244
|
+
};
|
|
188105
188245
|
const findAvailableVariables = ({
|
|
188106
188246
|
startingInstanceId,
|
|
188107
188247
|
instances,
|
|
188108
188248
|
dataSources
|
|
188109
188249
|
}) => {
|
|
188110
|
-
|
|
188111
|
-
startingInstanceId
|
|
188112
|
-
|
|
188113
|
-
instances,
|
|
188114
|
-
dataSources,
|
|
188115
|
-
dataSourcesByScopeInstanceId: getDataSourcesByScopeInstanceId(dataSources)
|
|
188116
|
-
});
|
|
188117
|
-
const availableVariables = [];
|
|
188118
|
-
for (const dataSourceId2 of maskedIdByName.values()) {
|
|
188119
|
-
const dataSource2 = dataSources.get(dataSourceId2);
|
|
188120
|
-
if (dataSource2) {
|
|
188121
|
-
availableVariables.push(dataSource2);
|
|
188122
|
-
}
|
|
188123
|
-
if (dataSourceId2 === SYSTEM_VARIABLE_ID) {
|
|
188124
|
-
availableVariables.push(systemParameter);
|
|
188125
|
-
}
|
|
188126
|
-
}
|
|
188127
|
-
return availableVariables;
|
|
188250
|
+
return createFindAvailableVariables({ instances, dataSources })(
|
|
188251
|
+
startingInstanceId
|
|
188252
|
+
);
|
|
188128
188253
|
};
|
|
188129
188254
|
const bindExpressionToInstanceScope = ({
|
|
188130
188255
|
expression: expression2,
|
|
@@ -193559,7 +193684,7 @@ const propsCollapsible = {
|
|
|
193559
193684
|
const propsCollapsibleTrigger = {};
|
|
193560
193685
|
const propsCollapsibleContent = {
|
|
193561
193686
|
forceMount: {
|
|
193562
|
-
description: "
|
|
193687
|
+
description: "When true, closed content stays mounted. Keep an explicit closed-state CSS rule such as height: 0; Radix's animation-only example assumes unmounted content. Radix suppresses CSS transitions and animations while measuring height, so the first open may not animate.",
|
|
193563
193688
|
required: false,
|
|
193564
193689
|
control: "boolean",
|
|
193565
193690
|
type: "boolean"
|
|
@@ -194168,10 +194293,10 @@ const propsAccordionHeader = {};
|
|
|
194168
194293
|
const propsAccordionTrigger = {};
|
|
194169
194294
|
const propsAccordionContent = {
|
|
194170
194295
|
forceMount: {
|
|
194171
|
-
description: "Used to force mounting when more control is needed. Useful when controlling animation with React animation libraries or keeping content available in the DOM.",
|
|
194172
194296
|
required: false,
|
|
194173
194297
|
control: "boolean",
|
|
194174
|
-
type: "boolean"
|
|
194298
|
+
type: "boolean",
|
|
194299
|
+
description: "When true, closed content stays mounted. Keep an explicit closed-state CSS rule such as height: 0; Radix's animation-only example assumes unmounted content. Radix suppresses CSS transitions and animations while measuring height, so the first open may not animate."
|
|
194175
194300
|
}
|
|
194176
194301
|
};
|
|
194177
194302
|
const metaAccordion = {
|
|
@@ -278903,7 +279028,7 @@ const AccordionItem = reactExports.forwardRef(({ value: value2, ...props2 }, ref
|
|
|
278903
279028
|
});
|
|
278904
279029
|
const AccordionHeader = Header;
|
|
278905
279030
|
const AccordionTrigger = Trigger2;
|
|
278906
|
-
const AccordionContent = Content2$1;
|
|
279031
|
+
const AccordionContent = reactExports.forwardRef(({ forceMount, ...props2 }, ref2) => /* @__PURE__ */ jsxRuntimeExports.jsx(Content2$1, { ref: ref2, forceMount: forceMount ? true : void 0, ...props2 }));
|
|
278907
279032
|
const namespace$2 = "@webstudio-is/sdk-components-react-radix";
|
|
278908
279033
|
const hooksAccordion = {
|
|
278909
279034
|
onNavigatorSelect: (context, event) => {
|
|
@@ -286877,7 +287002,8 @@ const materializeMdxTemplates = async ({
|
|
|
286877
287002
|
data: data2,
|
|
286878
287003
|
metas,
|
|
286879
287004
|
projectId,
|
|
286880
|
-
assetReferences = []
|
|
287005
|
+
assetReferences = [],
|
|
287006
|
+
findAvailableVariables: sharedFindAvailableVariables
|
|
286881
287007
|
}) => {
|
|
286882
287008
|
const materializedTemplates = [];
|
|
286883
287009
|
const diagnostics = [...resolution2.diagnostics];
|
|
@@ -286888,6 +287014,11 @@ const materializeMdxTemplates = async ({
|
|
|
286888
287014
|
reference
|
|
286889
287015
|
])
|
|
286890
287016
|
);
|
|
287017
|
+
let findAvailableVariables2 = sharedFindAvailableVariables;
|
|
287018
|
+
const getFindAvailableVariables = () => findAvailableVariables2 ??= createFindAvailableVariables({
|
|
287019
|
+
instances: data2.instances,
|
|
287020
|
+
dataSources: data2.dataSources
|
|
287021
|
+
});
|
|
286891
287022
|
for (const reference of resolution2.references) {
|
|
286892
287023
|
if (reference.type === "unresolved-template") {
|
|
286893
287024
|
materializedTemplates.push({
|
|
@@ -286934,11 +287065,9 @@ const materializeMdxTemplates = async ({
|
|
|
286934
287065
|
const { newInstanceIds } = insertWebstudioFragmentCopy({
|
|
286935
287066
|
data: materializedData,
|
|
286936
287067
|
fragment: sourceFragment2,
|
|
286937
|
-
availableVariables:
|
|
286938
|
-
|
|
286939
|
-
|
|
286940
|
-
dataSources: data2.dataSources
|
|
286941
|
-
}),
|
|
287068
|
+
availableVariables: getFindAvailableVariables()(
|
|
287069
|
+
reference.templateInstanceId
|
|
287070
|
+
),
|
|
286942
287071
|
projectId,
|
|
286943
287072
|
createId: createId2
|
|
286944
287073
|
});
|
|
@@ -323332,8 +323461,9 @@ const capabilityAreas = [
|
|
|
323332
323461
|
},
|
|
323333
323462
|
{
|
|
323334
323463
|
area: "publish",
|
|
323335
|
-
goal: "
|
|
323464
|
+
goal: "Validate and publish projects, inspect publish jobs, and manage domains.",
|
|
323336
323465
|
tools: [
|
|
323466
|
+
"validate-publish",
|
|
323337
323467
|
"publish",
|
|
323338
323468
|
"list-publishes",
|
|
323339
323469
|
"get-publish-job",
|
|
@@ -327679,7 +327809,7 @@ const createContractVersion = (schema2, additionalSchemas = []) => {
|
|
|
327679
327809
|
})
|
|
327680
327810
|
)}`;
|
|
327681
327811
|
};
|
|
327682
|
-
const maxProjectBundleSize =
|
|
327812
|
+
const maxProjectBundleSize = 32 * 1024 * 1024;
|
|
327683
327813
|
const stagedUploadPath = "/rest/staged-upload";
|
|
327684
327814
|
const stagedUploadProjectIdHeader = "x-webstudio-project-id";
|
|
327685
327815
|
const projectSessionRestorePointPath = "build.restorePoint";
|
|
@@ -329287,10 +329417,10 @@ const serverOnlyRouterOperationMetadata = {
|
|
|
329287
329417
|
},
|
|
329288
329418
|
"publish.validate": {
|
|
329289
329419
|
id: "publish.validate",
|
|
329290
|
-
command: "
|
|
329420
|
+
command: "validate-publish",
|
|
329291
329421
|
method: "query",
|
|
329292
329422
|
path: "api.publish.validate",
|
|
329293
|
-
client: "
|
|
329423
|
+
client: "validatePublish",
|
|
329294
329424
|
permit: "edit",
|
|
329295
329425
|
inputSchema: {
|
|
329296
329426
|
type: "object",
|
|
@@ -330281,12 +330411,12 @@ const curatedPublicApiOperationDocumentation = [
|
|
|
330281
330411
|
examples: ["webstudio delete-resource --resource resource-id --json"]
|
|
330282
330412
|
},
|
|
330283
330413
|
{
|
|
330284
|
-
command: "
|
|
330285
|
-
description: "
|
|
330414
|
+
command: "validate-publish",
|
|
330415
|
+
description: "Validate publish access, selected domains, and content diagnostics without starting a publish. Use audit for project-wide quality checks.",
|
|
330286
330416
|
requiredOptions: ["target", "json"],
|
|
330287
330417
|
examples: [
|
|
330288
|
-
"webstudio
|
|
330289
|
-
'MCP tool:
|
|
330418
|
+
"webstudio validate-publish --target production --json",
|
|
330419
|
+
'MCP tool: validate-publish {"target":"production"}'
|
|
330290
330420
|
]
|
|
330291
330421
|
},
|
|
330292
330422
|
{
|
|
@@ -332333,7 +332463,7 @@ const createResource = projectMutationInput("create-resource");
|
|
|
332333
332463
|
const updateResource = projectMutationInput("update-resource");
|
|
332334
332464
|
const deleteResource = projectMutationInput("delete-resource");
|
|
332335
332465
|
const listPublishes = projectQueryInput("list-publishes");
|
|
332336
|
-
const
|
|
332466
|
+
const validatePublish = projectQueryInput("validate-publish");
|
|
332337
332467
|
const publish = projectMutationInput("publish");
|
|
332338
332468
|
const getPublishJob = projectQueryInput("get-publish-job");
|
|
332339
332469
|
const unpublish = projectConfirmedMutationInput("unpublish");
|
|
@@ -332498,7 +332628,6 @@ const httpClient = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
332498
332628
|
bindProps,
|
|
332499
332629
|
bundleVersion,
|
|
332500
332630
|
checkProjectBuildPermission,
|
|
332501
|
-
checkPublishReadiness,
|
|
332502
332631
|
clearStyleSourceStyles,
|
|
332503
332632
|
cloneInstance,
|
|
332504
332633
|
connectContentBlockSource,
|
|
@@ -332682,6 +332811,7 @@ const httpClient = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePr
|
|
|
332682
332811
|
upsertResource,
|
|
332683
332812
|
upsertResourceProp,
|
|
332684
332813
|
validateAssetQuery,
|
|
332814
|
+
validatePublish,
|
|
332685
332815
|
verifyBindings,
|
|
332686
332816
|
verifyDomain,
|
|
332687
332817
|
wrapInstance
|
|
@@ -332694,7 +332824,7 @@ class HandledCliError extends Error {
|
|
|
332694
332824
|
}
|
|
332695
332825
|
const isHandledCliError = (error) => error instanceof HandledCliError;
|
|
332696
332826
|
const name = "webstudio";
|
|
332697
|
-
const version$1 = "0.
|
|
332827
|
+
const version$1 = "0.304.0";
|
|
332698
332828
|
const description = "Webstudio CLI";
|
|
332699
332829
|
const author = "Webstudio <github@webstudio.is>";
|
|
332700
332830
|
const homepage = "https://webstudio.is";
|
|
@@ -333060,7 +333190,10 @@ const materializeManagedAgents = async ({
|
|
|
333060
333190
|
await dependencies2.writeFileAtomic(path2, next);
|
|
333061
333191
|
return { path: path2, status: current4 === void 0 ? "created" : "updated" };
|
|
333062
333192
|
};
|
|
333193
|
+
const maxConcurrentMdxDependencyBlocks = 4;
|
|
333194
|
+
const maxConcurrentMdxDependenciesPerBlock = 8;
|
|
333063
333195
|
const publishedMdxTotalBytes = 32 * 1024 * 1024;
|
|
333196
|
+
const getPublishedMdxAssetIds = (assets) => new Set(assets.filter(isMdxFileAsset).map(({ id: id2 }) => id2));
|
|
333064
333197
|
const getPublishedMdxContentDatabaseMaxBytes = ({
|
|
333065
333198
|
baseBytes,
|
|
333066
333199
|
assets
|
|
@@ -333165,7 +333298,11 @@ const createPublishedBuildContentCompilationPlan = (build2, dynamicAssetIdsByBlo
|
|
|
333165
333298
|
const resolvePublishedMdxDependencyClosureWithParser = async ({
|
|
333166
333299
|
build: build2,
|
|
333167
333300
|
artifact,
|
|
333301
|
+
loadDocumentSource,
|
|
333168
333302
|
onTemplateOmission,
|
|
333303
|
+
onDependencyReadFailure,
|
|
333304
|
+
onMdxBlockInstanceId,
|
|
333305
|
+
allMdxAssetIds,
|
|
333169
333306
|
parseDocument: parseDocument2
|
|
333170
333307
|
}) => {
|
|
333171
333308
|
const instances = new Map(
|
|
@@ -333203,60 +333340,102 @@ const resolvePublishedMdxDependencyClosureWithParser = async ({
|
|
|
333203
333340
|
}
|
|
333204
333341
|
};
|
|
333205
333342
|
while (pending.length > 0) {
|
|
333206
|
-
const
|
|
333207
|
-
|
|
333208
|
-
|
|
333209
|
-
|
|
333210
|
-
|
|
333211
|
-
|
|
333212
|
-
|
|
333213
|
-
|
|
333214
|
-
|
|
333215
|
-
|
|
333216
|
-
|
|
333217
|
-
|
|
333218
|
-
|
|
333219
|
-
|
|
333220
|
-
|
|
333221
|
-
|
|
333222
|
-
|
|
333223
|
-
|
|
333224
|
-
|
|
333225
|
-
|
|
333226
|
-
|
|
333227
|
-
|
|
333228
|
-
|
|
333229
|
-
|
|
333230
|
-
|
|
333231
|
-
|
|
333232
|
-
|
|
333233
|
-
|
|
333234
|
-
|
|
333343
|
+
const blockIds = pending.splice(0);
|
|
333344
|
+
const parsedDocumentsByBlock = await mapBounded(
|
|
333345
|
+
blockIds,
|
|
333346
|
+
maxConcurrentMdxDependencyBlocks,
|
|
333347
|
+
async (blockId) => {
|
|
333348
|
+
if (processed.has(blockId)) {
|
|
333349
|
+
return { blockId, parsedDocuments: [] };
|
|
333350
|
+
}
|
|
333351
|
+
processed.add(blockId);
|
|
333352
|
+
const source = sourcesByBlockId.get(blockId);
|
|
333353
|
+
if (source === void 0) {
|
|
333354
|
+
return { blockId, parsedDocuments: [] };
|
|
333355
|
+
}
|
|
333356
|
+
onMdxBlockInstanceId?.(blockId);
|
|
333357
|
+
const staticValue = getStaticContentBlockSourceAssetId(source);
|
|
333358
|
+
const assetIds = typeof staticValue === "string" ? [staticValue] : resolvePublishedMdxAssetCandidates({
|
|
333359
|
+
build: build2,
|
|
333360
|
+
artifact,
|
|
333361
|
+
blockInstanceIds: /* @__PURE__ */ new Set([blockId]),
|
|
333362
|
+
allMdxAssetIds
|
|
333363
|
+
}).get(blockId) ?? [];
|
|
333364
|
+
const parsedDocuments = await mapBounded(
|
|
333365
|
+
assetIds,
|
|
333366
|
+
maxConcurrentMdxDependenciesPerBlock,
|
|
333367
|
+
async (assetId2) => {
|
|
333368
|
+
const documentEntry = documentsById.get(assetId2);
|
|
333369
|
+
if (documentEntry?.extension?.toLowerCase() !== "mdx" && documentEntry?.mimeType !== "text/mdx") {
|
|
333370
|
+
return;
|
|
333371
|
+
}
|
|
333372
|
+
let sourceText = documentEntry.contentRef === void 0 ? void 0 : artifact.contents?.[documentEntry.contentRef];
|
|
333373
|
+
if (sourceText === void 0 && documentEntry.revision !== void 0 && documentEntry.contentRef !== void 0 && loadDocumentSource !== void 0) {
|
|
333374
|
+
try {
|
|
333375
|
+
sourceText = await loadDocumentSource({
|
|
333376
|
+
id: assetId2,
|
|
333377
|
+
revision: documentEntry.revision,
|
|
333378
|
+
contentRef: documentEntry.contentRef
|
|
333379
|
+
});
|
|
333380
|
+
} catch (error) {
|
|
333381
|
+
onDependencyReadFailure?.({
|
|
333382
|
+
blockInstanceId: blockId,
|
|
333383
|
+
assetId: assetId2,
|
|
333384
|
+
contentRef: documentEntry.contentRef,
|
|
333385
|
+
message: `Could not inspect this MDX source: ${error instanceof Error ? error.message : String(error)}`
|
|
333386
|
+
});
|
|
333387
|
+
return;
|
|
333388
|
+
}
|
|
333389
|
+
}
|
|
333390
|
+
if (documentEntry.revision === void 0 || documentEntry.contentRef === void 0 || sourceText === void 0) {
|
|
333391
|
+
return;
|
|
333392
|
+
}
|
|
333393
|
+
const parsed = await parseDocument2({
|
|
333394
|
+
assetId: assetId2,
|
|
333395
|
+
revision: documentEntry.revision,
|
|
333396
|
+
contentRef: documentEntry.contentRef,
|
|
333397
|
+
source: sourceText
|
|
333398
|
+
});
|
|
333399
|
+
return parsed.status === "unrecoverable" ? void 0 : { assetId: assetId2, documentEntry, document: parsed.document };
|
|
333400
|
+
}
|
|
333401
|
+
);
|
|
333402
|
+
return {
|
|
333403
|
+
blockId,
|
|
333404
|
+
parsedDocuments: parsedDocuments.filter(
|
|
333405
|
+
(document2) => document2 !== void 0
|
|
333406
|
+
)
|
|
333407
|
+
};
|
|
333235
333408
|
}
|
|
333236
|
-
|
|
333237
|
-
|
|
333238
|
-
|
|
333239
|
-
|
|
333240
|
-
|
|
333241
|
-
|
|
333242
|
-
|
|
333243
|
-
|
|
333244
|
-
|
|
333245
|
-
},
|
|
333246
|
-
instances,
|
|
333247
|
-
props: propsById,
|
|
333248
|
-
metas: componentMetas
|
|
333249
|
-
});
|
|
333250
|
-
assertMdxTemplateStructure(resolution2);
|
|
333251
|
-
for (const reference of resolution2.references) {
|
|
333252
|
-
if (reference.type === "resolved-template") {
|
|
333253
|
-
visitTemplateSubtree(reference.templateInstanceId);
|
|
333254
|
-
} else {
|
|
333255
|
-
onTemplateOmission?.({
|
|
333409
|
+
);
|
|
333410
|
+
for (const { blockId, parsedDocuments } of parsedDocumentsByBlock) {
|
|
333411
|
+
for (const { assetId: assetId2, documentEntry, document: document2 } of parsedDocuments) {
|
|
333412
|
+
if (documentEntry.revision === void 0 || documentEntry.contentRef === void 0) {
|
|
333413
|
+
continue;
|
|
333414
|
+
}
|
|
333415
|
+
const resolution2 = resolveMdxTemplates({
|
|
333416
|
+
document: document2,
|
|
333417
|
+
identity: {
|
|
333256
333418
|
blockInstanceId: blockId,
|
|
333257
333419
|
assetId: assetId2,
|
|
333258
|
-
|
|
333259
|
-
|
|
333420
|
+
revision: documentEntry.revision,
|
|
333421
|
+
contentRef: documentEntry.contentRef,
|
|
333422
|
+
renderScope: "publication-dependency-discovery"
|
|
333423
|
+
},
|
|
333424
|
+
instances,
|
|
333425
|
+
props: propsById,
|
|
333426
|
+
metas: componentMetas
|
|
333427
|
+
});
|
|
333428
|
+
assertMdxTemplateStructure(resolution2);
|
|
333429
|
+
for (const reference of resolution2.references) {
|
|
333430
|
+
if (reference.type === "resolved-template") {
|
|
333431
|
+
visitTemplateSubtree(reference.templateInstanceId);
|
|
333432
|
+
} else {
|
|
333433
|
+
onTemplateOmission?.({
|
|
333434
|
+
blockInstanceId: blockId,
|
|
333435
|
+
assetId: assetId2,
|
|
333436
|
+
templateName: reference.templateName
|
|
333437
|
+
});
|
|
333438
|
+
}
|
|
333260
333439
|
}
|
|
333261
333440
|
}
|
|
333262
333441
|
}
|
|
@@ -333265,7 +333444,8 @@ const resolvePublishedMdxDependencyClosureWithParser = async ({
|
|
|
333265
333444
|
build: build2,
|
|
333266
333445
|
artifact,
|
|
333267
333446
|
blockInstanceIds: reachableIds,
|
|
333268
|
-
allowUnresolved: true
|
|
333447
|
+
allowUnresolved: true,
|
|
333448
|
+
allMdxAssetIds
|
|
333269
333449
|
});
|
|
333270
333450
|
return createPublishedBuildContentCompilationPlan(
|
|
333271
333451
|
build2,
|
|
@@ -333290,8 +333470,11 @@ const createPublishedMdxDependencyClosureResolver = (dependencies2 = { parseMdxD
|
|
|
333290
333470
|
};
|
|
333291
333471
|
const candidateDocumentKey = Symbol("candidate-document");
|
|
333292
333472
|
const isCandidateDocument = (value2) => typeof value2 === "object" && value2 !== null && candidateDocumentKey in value2;
|
|
333293
|
-
const getValueAtPath = (value2, path2) => {
|
|
333473
|
+
const getValueAtPath = (value2, path2, knownNonMdxAssetIds) => {
|
|
333294
333474
|
if (isCandidateDocument(value2)) {
|
|
333475
|
+
if (knownNonMdxAssetIds?.has(value2[candidateDocumentKey]._id) && (path2.length === 0 || path2.length === 1 && (path2[0] === "id" || path2[0] === "_id"))) {
|
|
333476
|
+
return;
|
|
333477
|
+
}
|
|
333295
333478
|
if (path2[0] === "properties" && value2.graph !== void 0 && isDocumentGraphFieldAffected({
|
|
333296
333479
|
graph: value2.graph,
|
|
333297
333480
|
sourceId: value2[candidateDocumentKey]._id,
|
|
@@ -333316,7 +333499,9 @@ const resolvePublishedMdxAssetCandidates = ({
|
|
|
333316
333499
|
build: build2,
|
|
333317
333500
|
artifact,
|
|
333318
333501
|
allowUnresolved = false,
|
|
333319
|
-
blockInstanceIds = getPublishedInstanceIds(build2)
|
|
333502
|
+
blockInstanceIds = getPublishedInstanceIds(build2),
|
|
333503
|
+
allAssetIds,
|
|
333504
|
+
allMdxAssetIds
|
|
333320
333505
|
}) => {
|
|
333321
333506
|
const instances = new Map(
|
|
333322
333507
|
getBuildValues(build2.instances).map((instance2) => [
|
|
@@ -333343,7 +333528,10 @@ const resolvePublishedMdxAssetCandidates = ({
|
|
|
333343
333528
|
);
|
|
333344
333529
|
const documentGraph = artifact?.documentGraph === void 0 ? void 0 : createDocumentGraph(artifact.documentGraph);
|
|
333345
333530
|
const documents = artifact?.documents ?? [];
|
|
333346
|
-
const
|
|
333531
|
+
const knownNonMdxAssetIds = allAssetIds === void 0 || allMdxAssetIds === void 0 ? void 0 : new Set(
|
|
333532
|
+
[...allAssetIds].filter((assetId2) => !allMdxAssetIds.has(assetId2))
|
|
333533
|
+
);
|
|
333534
|
+
const evaluateDataSource = (dataSourceId2, path2, visiting = /* @__PURE__ */ new Set(), mutableVariables = /* @__PURE__ */ new Set()) => {
|
|
333347
333535
|
if (visiting.has(dataSourceId2)) {
|
|
333348
333536
|
throw new Error("Dynamic MDX source data dependency is cyclic");
|
|
333349
333537
|
}
|
|
@@ -333352,6 +333540,7 @@ const resolvePublishedMdxAssetCandidates = ({
|
|
|
333352
333540
|
return [];
|
|
333353
333541
|
}
|
|
333354
333542
|
if (dataSource2.type === "variable") {
|
|
333543
|
+
mutableVariables.add(dataSourceId2);
|
|
333355
333544
|
return [];
|
|
333356
333545
|
}
|
|
333357
333546
|
if (dataSource2.type === "resource") {
|
|
@@ -333404,7 +333593,8 @@ const resolvePublishedMdxAssetCandidates = ({
|
|
|
333404
333593
|
graph: documentGraph
|
|
333405
333594
|
} : getValueAtPath(
|
|
333406
333595
|
{ [candidateDocumentKey]: document2, graph: documentGraph },
|
|
333407
|
-
fieldPath
|
|
333596
|
+
fieldPath,
|
|
333597
|
+
knownNonMdxAssetIds
|
|
333408
333598
|
)
|
|
333409
333599
|
);
|
|
333410
333600
|
}
|
|
@@ -333430,7 +333620,8 @@ const resolvePublishedMdxAssetCandidates = ({
|
|
|
333430
333620
|
iterables = evaluateDataSource(
|
|
333431
333621
|
dependencyId,
|
|
333432
333622
|
dataPath.slice(1),
|
|
333433
|
-
visiting
|
|
333623
|
+
visiting,
|
|
333624
|
+
mutableVariables
|
|
333434
333625
|
);
|
|
333435
333626
|
visiting.delete(dataSourceId2);
|
|
333436
333627
|
}
|
|
@@ -333444,7 +333635,7 @@ const resolvePublishedMdxAssetCandidates = ({
|
|
|
333444
333635
|
}
|
|
333445
333636
|
return [iterable];
|
|
333446
333637
|
});
|
|
333447
|
-
return items.map((item) => getValueAtPath(item, path2));
|
|
333638
|
+
return items.map((item) => getValueAtPath(item, path2, knownNonMdxAssetIds));
|
|
333448
333639
|
};
|
|
333449
333640
|
const candidatesByBlock = /* @__PURE__ */ new Map();
|
|
333450
333641
|
for (const blockInstanceId of blockInstanceIds) {
|
|
@@ -333461,8 +333652,14 @@ const resolvePublishedMdxAssetCandidates = ({
|
|
|
333461
333652
|
const path2 = parseStaticMemberPath(source.value);
|
|
333462
333653
|
const dataSourceId2 = path2 === void 0 ? void 0 : decodeDataVariableId(path2[0]);
|
|
333463
333654
|
let assetIds = [];
|
|
333655
|
+
const mutableVariables = /* @__PURE__ */ new Set();
|
|
333464
333656
|
try {
|
|
333465
|
-
assetIds = dataSourceId2 === void 0 || path2 === void 0 ? [] : evaluateDataSource(
|
|
333657
|
+
assetIds = dataSourceId2 === void 0 || path2 === void 0 ? [] : evaluateDataSource(
|
|
333658
|
+
dataSourceId2,
|
|
333659
|
+
path2.slice(1),
|
|
333660
|
+
/* @__PURE__ */ new Set(),
|
|
333661
|
+
mutableVariables
|
|
333662
|
+
).filter(
|
|
333466
333663
|
(value2) => typeof value2 === "string" && value2.length > 0
|
|
333467
333664
|
);
|
|
333468
333665
|
} catch (error) {
|
|
@@ -333470,6 +333667,9 @@ const resolvePublishedMdxAssetCandidates = ({
|
|
|
333470
333667
|
throw error;
|
|
333471
333668
|
}
|
|
333472
333669
|
}
|
|
333670
|
+
if (mutableVariables.size > 0 && allMdxAssetIds !== void 0) {
|
|
333671
|
+
assetIds.push(...allMdxAssetIds);
|
|
333672
|
+
}
|
|
333473
333673
|
if (assetIds.length === 0) {
|
|
333474
333674
|
if (allowUnresolved) {
|
|
333475
333675
|
continue;
|
|
@@ -333845,10 +334045,12 @@ const sync = async (options, dependencies2 = defaultSyncDependencies) => {
|
|
|
333845
334045
|
...project.build,
|
|
333846
334046
|
pages: migratePages(project.build.pages)
|
|
333847
334047
|
};
|
|
334048
|
+
const allMdxAssetIds = getPublishedMdxAssetIds(project.assets);
|
|
333848
334049
|
const projectCandidates = resolvePublishedMdxAssetCandidates({
|
|
333849
334050
|
build: publicationBuild,
|
|
333850
334051
|
artifact: project.assetIndex,
|
|
333851
|
-
allowUnresolved: true
|
|
334052
|
+
allowUnresolved: true,
|
|
334053
|
+
allMdxAssetIds
|
|
333852
334054
|
});
|
|
333853
334055
|
const dynamicBlockIds = getDynamicPublishedMdxSourceBlockIds(publicationBuild);
|
|
333854
334056
|
const publicationPlan = createPublishedBuildContentCompilationPlan(
|
|
@@ -333908,7 +334110,11 @@ const sync = async (options, dependencies2 = defaultSyncDependencies) => {
|
|
|
333908
334110
|
project.assetIndex = await compileContentUntilPlanIsStable({
|
|
333909
334111
|
plan,
|
|
333910
334112
|
compile,
|
|
333911
|
-
resolvePlan: async (artifact) => await resolvePlan({
|
|
334113
|
+
resolvePlan: async (artifact) => await resolvePlan({
|
|
334114
|
+
build: publicationBuild,
|
|
334115
|
+
artifact,
|
|
334116
|
+
allMdxAssetIds
|
|
334117
|
+
})
|
|
333912
334118
|
});
|
|
333913
334119
|
} else {
|
|
333914
334120
|
project.assetIndex = await compile(plan);
|
|
@@ -340049,6 +340255,7 @@ const createMdxContentModelDiagnostics = ({
|
|
|
340049
340255
|
{
|
|
340050
340256
|
code: "invalid-mdx",
|
|
340051
340257
|
severity: "error",
|
|
340258
|
+
reason: "html-content-model",
|
|
340052
340259
|
blockInstanceId: root2.identity.blockInstanceId,
|
|
340053
340260
|
assetId: root2.identity.assetId,
|
|
340054
340261
|
contentRef: root2.identity.contentRef,
|
|
@@ -340619,6 +340826,7 @@ const getUnsafeDynamicPublishedMdxDiagnostic = ({
|
|
|
340619
340826
|
return {
|
|
340620
340827
|
code: "invalid-mdx",
|
|
340621
340828
|
severity: "error",
|
|
340829
|
+
reason: "dynamic-resource",
|
|
340622
340830
|
blockInstanceId: root2.identity.blockInstanceId,
|
|
340623
340831
|
assetId: root2.identity.assetId,
|
|
340624
340832
|
renderScope: `route:${route}:block:${root2.identity.blockInstanceId}`,
|
|
@@ -340634,6 +340842,7 @@ const getUnsafeDynamicPublishedMdxDiagnostic = ({
|
|
|
340634
340842
|
return {
|
|
340635
340843
|
code: "invalid-mdx",
|
|
340636
340844
|
severity: "error",
|
|
340845
|
+
reason: "dynamic-resource",
|
|
340637
340846
|
blockInstanceId: root2.identity.blockInstanceId,
|
|
340638
340847
|
assetId: root2.identity.assetId,
|
|
340639
340848
|
renderScope: `route:${route}:block:${root2.identity.blockInstanceId}`,
|
|
@@ -340698,7 +340907,8 @@ const materializePublishedMdx = async ({
|
|
|
340698
340907
|
cache = createPublishedMdxMaterializationCache(),
|
|
340699
340908
|
dynamicAssetIdsByBlock = /* @__PURE__ */ new Map(),
|
|
340700
340909
|
blockInstanceIds,
|
|
340701
|
-
runtimeAssets: providedRuntimeAssets
|
|
340910
|
+
runtimeAssets: providedRuntimeAssets,
|
|
340911
|
+
loadDocumentSource
|
|
340702
340912
|
}) => {
|
|
340703
340913
|
const documentsById = new Map(
|
|
340704
340914
|
artifact.documents.map((document2) => [document2._id, document2])
|
|
@@ -340726,7 +340936,7 @@ const materializePublishedMdx = async ({
|
|
|
340726
340936
|
assetValueReferences: artifact.assetValueReferences,
|
|
340727
340937
|
runtimeAssets,
|
|
340728
340938
|
load: async (node2) => {
|
|
340729
|
-
const source = artifact.contents?.[node2.contentRef];
|
|
340939
|
+
const source = artifact.contents?.[node2.contentRef] ?? await loadDocumentSource?.(node2);
|
|
340730
340940
|
if (source === void 0 || node2.format === void 0) {
|
|
340731
340941
|
throw new Error(`Published document ${node2.id} is unavailable`);
|
|
340732
340942
|
}
|
|
@@ -340753,9 +340963,11 @@ const materializePublishedMdx = async ({
|
|
|
340753
340963
|
});
|
|
340754
340964
|
const roots = [];
|
|
340755
340965
|
const warnings = [];
|
|
340966
|
+
let findAvailableVariables2;
|
|
340756
340967
|
const warnUnavailableSource = ({
|
|
340757
340968
|
blockInstanceId,
|
|
340758
340969
|
assetId: assetId2,
|
|
340970
|
+
reason,
|
|
340759
340971
|
message
|
|
340760
340972
|
}) => {
|
|
340761
340973
|
warnings.push({
|
|
@@ -340763,6 +340975,7 @@ const materializePublishedMdx = async ({
|
|
|
340763
340975
|
diagnostic: {
|
|
340764
340976
|
code: "invalid-mdx",
|
|
340765
340977
|
severity: "error",
|
|
340978
|
+
...reason === void 0 ? {} : { reason },
|
|
340766
340979
|
blockInstanceId,
|
|
340767
340980
|
...assetId2 === void 0 ? {} : { assetId: assetId2 },
|
|
340768
340981
|
renderScope: `route:${route}:block:${blockInstanceId}`,
|
|
@@ -340784,6 +340997,7 @@ const materializePublishedMdx = async ({
|
|
|
340784
340997
|
if (resolvedAssetIds.length > contentEngineLimits.candidateDocuments) {
|
|
340785
340998
|
warnUnavailableSource({
|
|
340786
340999
|
blockInstanceId: block.id,
|
|
341000
|
+
reason: "dynamic-source-unbounded",
|
|
340787
341001
|
message: `Published Content Block "${block.id}" exceeds the safe MDX candidate limit`
|
|
340788
341002
|
});
|
|
340789
341003
|
continue;
|
|
@@ -340791,6 +341005,7 @@ const materializePublishedMdx = async ({
|
|
|
340791
341005
|
if (resolvedAssetIds.length === 0) {
|
|
340792
341006
|
warnUnavailableSource({
|
|
340793
341007
|
blockInstanceId: block.id,
|
|
341008
|
+
reason: "dynamic-source-unbounded",
|
|
340794
341009
|
message: `Published Content Block "${block.id}" has no bounded dynamic MDX dependency set`
|
|
340795
341010
|
});
|
|
340796
341011
|
continue;
|
|
@@ -340806,6 +341021,7 @@ const materializePublishedMdx = async ({
|
|
|
340806
341021
|
warnUnavailableSource({
|
|
340807
341022
|
blockInstanceId: block.id,
|
|
340808
341023
|
assetId: assetId2,
|
|
341024
|
+
reason: "missing-asset",
|
|
340809
341025
|
message: `Published Content Block "${block.id}" requires unavailable MDX Asset "${assetId2}"`
|
|
340810
341026
|
});
|
|
340811
341027
|
}
|
|
@@ -340814,15 +341030,34 @@ const materializePublishedMdx = async ({
|
|
|
340814
341030
|
warnUnavailableSource({
|
|
340815
341031
|
blockInstanceId: block.id,
|
|
340816
341032
|
assetId: candidate._id,
|
|
341033
|
+
reason: "missing-source",
|
|
340817
341034
|
message: `Published MDX Asset "${candidate._id}" has no revision identity`
|
|
340818
341035
|
});
|
|
340819
341036
|
continue;
|
|
340820
341037
|
}
|
|
340821
|
-
|
|
341038
|
+
let sourceText = artifact.contents?.[candidate.contentRef];
|
|
341039
|
+
if (sourceText === void 0 && loadDocumentSource !== void 0) {
|
|
341040
|
+
try {
|
|
341041
|
+
sourceText = await loadDocumentSource({
|
|
341042
|
+
id: candidate._id,
|
|
341043
|
+
revision: candidate.revision,
|
|
341044
|
+
contentRef: candidate.contentRef
|
|
341045
|
+
});
|
|
341046
|
+
} catch (error) {
|
|
341047
|
+
warnUnavailableSource({
|
|
341048
|
+
blockInstanceId: block.id,
|
|
341049
|
+
assetId: candidate._id,
|
|
341050
|
+
reason: "source-read-failed",
|
|
341051
|
+
message: `Published MDX Asset "${candidate._id}" could not be loaded: ${error instanceof Error ? error.message : String(error)}`
|
|
341052
|
+
});
|
|
341053
|
+
continue;
|
|
341054
|
+
}
|
|
341055
|
+
}
|
|
340822
341056
|
if (sourceText === void 0) {
|
|
340823
341057
|
warnUnavailableSource({
|
|
340824
341058
|
blockInstanceId: block.id,
|
|
340825
341059
|
assetId: candidate._id,
|
|
341060
|
+
reason: "missing-source",
|
|
340826
341061
|
message: `Published MDX Asset "${candidate._id}" content is unavailable`
|
|
340827
341062
|
});
|
|
340828
341063
|
continue;
|
|
@@ -340868,19 +341103,49 @@ const materializePublishedMdx = async ({
|
|
|
340868
341103
|
metas
|
|
340869
341104
|
});
|
|
340870
341105
|
assertMdxTemplateStructure(resolution2);
|
|
341106
|
+
if (findAvailableVariables2 === void 0 && resolution2.references.some(
|
|
341107
|
+
(reference) => reference.type === "resolved-template"
|
|
341108
|
+
)) {
|
|
341109
|
+
findAvailableVariables2 = createFindAvailableVariables({
|
|
341110
|
+
instances: data2.instances,
|
|
341111
|
+
dataSources: data2.dataSources
|
|
341112
|
+
});
|
|
341113
|
+
}
|
|
340871
341114
|
const templates2 = await materializeMdxTemplates({
|
|
340872
341115
|
identity,
|
|
340873
341116
|
resolution: resolution2,
|
|
340874
341117
|
data: data2,
|
|
340875
341118
|
metas,
|
|
340876
341119
|
projectId,
|
|
340877
|
-
assetReferences
|
|
341120
|
+
assetReferences,
|
|
341121
|
+
findAvailableVariables: findAvailableVariables2
|
|
340878
341122
|
});
|
|
340879
341123
|
const referencedTemplateNames = Array.from(
|
|
340880
341124
|
new Set(
|
|
340881
341125
|
resolution2.references.map((reference) => reference.templateName)
|
|
340882
341126
|
)
|
|
340883
341127
|
);
|
|
341128
|
+
let resolvedFrontmatter = document2.frontmatter.properties;
|
|
341129
|
+
try {
|
|
341130
|
+
resolvedFrontmatter = await resolveFrontmatter(candidate._id, document2);
|
|
341131
|
+
} catch (error) {
|
|
341132
|
+
if (error instanceof DocumentGraphResolutionError && error.code === "REQUEST_CANCELLED") {
|
|
341133
|
+
throw error;
|
|
341134
|
+
}
|
|
341135
|
+
if (error instanceof DocumentGraphResolutionError) {
|
|
341136
|
+
const linkedDocument = error.documentId === void 0 ? "Linked document" : `Linked document "${error.documentId}"`;
|
|
341137
|
+
const reference = error.referenceId === void 0 ? "" : ` (reference "${error.referenceId}")`;
|
|
341138
|
+
const failure = error.code === "DOCUMENT_LOAD_FAILED" ? "could not be loaded" : `could not be resolved: ${error.message}`;
|
|
341139
|
+
warnUnavailableSource({
|
|
341140
|
+
blockInstanceId: block.id,
|
|
341141
|
+
assetId: candidate._id,
|
|
341142
|
+
reason: "linked-document-unavailable",
|
|
341143
|
+
message: `${linkedDocument} ${failure}${reference} while resolving frontmatter for published MDX Asset "${candidate._id}".`
|
|
341144
|
+
});
|
|
341145
|
+
} else {
|
|
341146
|
+
throw error;
|
|
341147
|
+
}
|
|
341148
|
+
}
|
|
340884
341149
|
const materialized = materializeMdxAuthoredContent({
|
|
340885
341150
|
identity,
|
|
340886
341151
|
document: document2,
|
|
@@ -340913,7 +341178,7 @@ const materializePublishedMdx = async ({
|
|
|
340913
341178
|
dynamic: isDynamicSource,
|
|
340914
341179
|
identity,
|
|
340915
341180
|
document: document2,
|
|
340916
|
-
resolvedFrontmatter
|
|
341181
|
+
resolvedFrontmatter,
|
|
340917
341182
|
fragment: materialized.fragment,
|
|
340918
341183
|
templateDependencies: templates2.dependencies.templates,
|
|
340919
341184
|
templateNames: referencedTemplateNames,
|
|
@@ -346980,6 +347245,8 @@ Please check webstudio --help for more details`
|
|
|
346980
347245
|
const siteData = parsedSiteData.data;
|
|
346981
347246
|
const pages2 = migratePages(siteData.build.pages);
|
|
346982
347247
|
const publicationBuild = { ...siteData.build, pages: pages2 };
|
|
347248
|
+
const allAssetIds = new Set(siteData.assets.map(({ id: id2 }) => id2));
|
|
347249
|
+
const allMdxAssetIds = getPublishedMdxAssetIds(siteData.assets);
|
|
346983
347250
|
if (siteData.assetIndex === void 0 && (createPublishedBuildContentCompilationPlan(publicationBuild) !== void 0 || hasDynamicPublishedMdxSources(publicationBuild))) {
|
|
346984
347251
|
throw new Error(
|
|
346985
347252
|
"Assets queries require a content database. Sync the project again before building."
|
|
@@ -347036,10 +347303,12 @@ Please check webstudio --help for more details`
|
|
|
347036
347303
|
}
|
|
347037
347304
|
let dynamicMdxCandidates;
|
|
347038
347305
|
if (hasDynamicPublishedMdxSources(publicationBuild)) {
|
|
347039
|
-
dynamicMdxCandidates =
|
|
347306
|
+
dynamicMdxCandidates = resolvePublishedMdxAssetCandidates({
|
|
347040
347307
|
build: publicationBuild,
|
|
347041
347308
|
artifact: verifiedAssetIndex,
|
|
347042
|
-
allowUnresolved: true
|
|
347309
|
+
allowUnresolved: true,
|
|
347310
|
+
allAssetIds,
|
|
347311
|
+
allMdxAssetIds
|
|
347043
347312
|
});
|
|
347044
347313
|
for (const blockInstanceId of getDynamicPublishedMdxSourceBlockIds(
|
|
347045
347314
|
publicationBuild
|
|
@@ -347273,7 +347542,9 @@ Please check webstudio --help for more details`
|
|
|
347273
347542
|
) ? resolvePublishedMdxAssetCandidates({
|
|
347274
347543
|
build: pageBuild,
|
|
347275
347544
|
artifact: verifiedAssetIndex,
|
|
347276
|
-
blockInstanceIds: pendingBlockIds
|
|
347545
|
+
blockInstanceIds: pendingBlockIds,
|
|
347546
|
+
allAssetIds,
|
|
347547
|
+
allMdxAssetIds
|
|
347277
347548
|
}) : void 0;
|
|
347278
347549
|
const materialized = await materializePublishedMdx({
|
|
347279
347550
|
route,
|
|
@@ -347294,7 +347565,21 @@ Please check webstudio --help for more details`
|
|
|
347294
347565
|
cache,
|
|
347295
347566
|
dynamicAssetIdsByBlock: pageDynamicCandidates,
|
|
347296
347567
|
blockInstanceIds: pendingBlockIds,
|
|
347297
|
-
runtimeAssets: runtimeAssetsById
|
|
347568
|
+
runtimeAssets: runtimeAssetsById,
|
|
347569
|
+
loadDocumentSource: async ({ contentRef }) => {
|
|
347570
|
+
const source = createReadStream(
|
|
347571
|
+
getLocalAssetPath(
|
|
347572
|
+
contentRef,
|
|
347573
|
+
options.sourceAssetsDirectory ?? join$2(buildRoot, LOCAL_ASSETS_DIR)
|
|
347574
|
+
)
|
|
347575
|
+
);
|
|
347576
|
+
return decodeUtf8$1(
|
|
347577
|
+
await readBoundedBytes(
|
|
347578
|
+
source,
|
|
347579
|
+
contentEngineLimits.hydratedFileBytes
|
|
347580
|
+
)
|
|
347581
|
+
);
|
|
347582
|
+
}
|
|
347298
347583
|
});
|
|
347299
347584
|
for (const root2 of materialized.roots) {
|
|
347300
347585
|
const diagnostic = getUnsafeDynamicPublishedMdxDiagnostic({
|
|
@@ -350363,7 +350648,7 @@ const publishCommandOptions = (yargs) => publishDomainsOption(publishTargetOptio
|
|
|
350363
350648
|
type: "string",
|
|
350364
350649
|
describe: "Optional idempotency key for retrying the same publish"
|
|
350365
350650
|
});
|
|
350366
|
-
const
|
|
350651
|
+
const validatePublishCommandOptions = (yargs) => publishDomainsOption(publishTargetOption(apiCommandOptions(yargs)));
|
|
350367
350652
|
const publishJobCommandOptions = (yargs) => apiCommandOptions(yargs).option("job", {
|
|
350368
350653
|
type: "string",
|
|
350369
350654
|
describe: "Required publish job id returned by publish or unpublish",
|
|
@@ -351803,13 +352088,13 @@ const apiCommandHandlers = {
|
|
|
351803
352088
|
};
|
|
351804
352089
|
return runProjectSessionCommand("publish", input2, connection, dependencies2);
|
|
351805
352090
|
},
|
|
351806
|
-
"
|
|
352091
|
+
"validate-publish": async (options, connection, dependencies2) => {
|
|
351807
352092
|
const input2 = {
|
|
351808
352093
|
target: publishTargetValue(options.target),
|
|
351809
352094
|
domains: listStringOption(options.domain)
|
|
351810
352095
|
};
|
|
351811
352096
|
return runProjectSessionCommand(
|
|
351812
|
-
"
|
|
352097
|
+
"validate-publish",
|
|
351813
352098
|
input2,
|
|
351814
352099
|
connection,
|
|
351815
352100
|
dependencies2
|
|
@@ -352266,7 +352551,7 @@ const apiCommandOptionsByCommand = {
|
|
|
352266
352551
|
"delete-resource": deleteResourceCommandOptions,
|
|
352267
352552
|
"list-domains": paginatedListCommandOptions,
|
|
352268
352553
|
publish: publishCommandOptions,
|
|
352269
|
-
"
|
|
352554
|
+
"validate-publish": validatePublishCommandOptions,
|
|
352270
352555
|
"get-publish-job": publishJobCommandOptions,
|
|
352271
352556
|
unpublish: unpublishCommandOptions,
|
|
352272
352557
|
"create-domain": createDomainCommandOptions,
|
|
@@ -352299,8 +352584,8 @@ const apiCommandMetadata = publicApiOperations.map((operation) => ({
|
|
|
352299
352584
|
const highLevelCliCommands = [
|
|
352300
352585
|
{ command: "audit", operation: "audit" },
|
|
352301
352586
|
{
|
|
352302
|
-
command: "
|
|
352303
|
-
operation: "
|
|
352587
|
+
command: "validate-publish",
|
|
352588
|
+
operation: "validate-publish"
|
|
352304
352589
|
},
|
|
352305
352590
|
{ command: "permissions", operation: "permissions" },
|
|
352306
352591
|
{ command: "get-assets-resource", operation: "get-assets-resource" },
|
|
@@ -352854,7 +353139,7 @@ const apiCommandsByArea = {
|
|
|
352854
353139
|
projectQuality: cliCommandMetadata.filter(({ cliCommand }) => cliCommand === "audit").map(({ cliCommand }) => cliCommand),
|
|
352855
353140
|
assetsAndIndexes: cliCommandMetadata.filter(({ cliCommand }) => cliCommand.includes("asset")).map(({ cliCommand }) => cliCommand),
|
|
352856
353141
|
publishAndDomains: cliCommandMetadata.filter(
|
|
352857
|
-
({ cliCommand }) => cliCommand === "
|
|
353142
|
+
({ cliCommand }) => cliCommand === "validate-publish" || cliCommand.startsWith("publish ") || cliCommand.startsWith("domains ")
|
|
352858
353143
|
).map(({ cliCommand }) => cliCommand),
|
|
352859
353144
|
pagesAndSettings: cliCommandMetadata.filter(
|
|
352860
353145
|
({ cliCommand }) => [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "webstudio",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.304.0",
|
|
4
4
|
"description": "Webstudio CLI",
|
|
5
5
|
"author": "Webstudio <github@webstudio.is>",
|
|
6
6
|
"homepage": "https://webstudio.is",
|
|
@@ -53,10 +53,10 @@
|
|
|
53
53
|
"which": "^5.0.0",
|
|
54
54
|
"yargs": "^17.7.2",
|
|
55
55
|
"zod": "^4.4.3",
|
|
56
|
-
"@webstudio-is/http-client": "0.
|
|
57
|
-
"@webstudio-is/project-migrations": "0.
|
|
58
|
-
"@webstudio-is/
|
|
59
|
-
"@webstudio-is/
|
|
56
|
+
"@webstudio-is/http-client": "0.304.0",
|
|
57
|
+
"@webstudio-is/project-migrations": "0.304.0",
|
|
58
|
+
"@webstudio-is/sync-client": "0.0.0",
|
|
59
|
+
"@webstudio-is/protocol": "0.304.0"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
62
|
"@cloudflare/vite-plugin": "^1.1.0",
|
|
@@ -99,24 +99,24 @@
|
|
|
99
99
|
"vite": "^6.3.4",
|
|
100
100
|
"vitest": "^3.1.2",
|
|
101
101
|
"wrangler": "4.130.0",
|
|
102
|
-
"@webstudio-is/css-engine": "0.
|
|
103
|
-
"@webstudio-is/
|
|
104
|
-
"@webstudio-is/
|
|
105
|
-
"@webstudio-is/
|
|
106
|
-
"@webstudio-is/image": "0.
|
|
102
|
+
"@webstudio-is/css-engine": "0.304.0",
|
|
103
|
+
"@webstudio-is/expression": "0.304.0",
|
|
104
|
+
"@webstudio-is/content-engine": "0.304.0",
|
|
105
|
+
"@webstudio-is/fonts": "0.304.0",
|
|
106
|
+
"@webstudio-is/image": "0.304.0",
|
|
107
107
|
"@webstudio-is/project-build": "0.0.0",
|
|
108
|
-
"@webstudio-is/query-builder": "0.
|
|
109
|
-
"@webstudio-is/react-
|
|
110
|
-
"@webstudio-is/sdk-components-
|
|
111
|
-
"@webstudio-is/sdk": "0.
|
|
112
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
113
|
-
"@webstudio-is/sdk-components-react-remix": "0.302.0",
|
|
114
|
-
"@webstudio-is/sdk-components-react-radix": "0.302.0",
|
|
115
|
-
"@webstudio-is/sdk-components-react-router": "0.302.0",
|
|
116
|
-
"@webstudio-is/sdk-components-registry": "0.302.0",
|
|
117
|
-
"@webstudio-is/tsconfig": "1.0.7",
|
|
108
|
+
"@webstudio-is/query-builder": "0.304.0",
|
|
109
|
+
"@webstudio-is/sdk-components-react-radix": "0.304.0",
|
|
110
|
+
"@webstudio-is/sdk-components-react-remix": "0.304.0",
|
|
111
|
+
"@webstudio-is/sdk-components-react": "0.304.0",
|
|
112
|
+
"@webstudio-is/sdk-components-react-router": "0.304.0",
|
|
118
113
|
"@webstudio-is/vision": "0.0.0",
|
|
119
|
-
"@webstudio-is/
|
|
114
|
+
"@webstudio-is/sdk-components-animation": "0.304.0",
|
|
115
|
+
"@webstudio-is/sdk-components-registry": "0.304.0",
|
|
116
|
+
"@webstudio-is/tsconfig": "1.0.7",
|
|
117
|
+
"@webstudio-is/react-sdk": "0.304.0",
|
|
118
|
+
"@webstudio-is/sdk": "0.304.0",
|
|
119
|
+
"@webstudio-is/wsauth": "0.304.0"
|
|
120
120
|
},
|
|
121
121
|
"scripts": {
|
|
122
122
|
"typecheck": "tsc --noEmit",
|
|
@@ -13,14 +13,14 @@
|
|
|
13
13
|
"@remix-run/node": "2.16.5",
|
|
14
14
|
"@remix-run/react": "2.16.5",
|
|
15
15
|
"@remix-run/server-runtime": "2.16.5",
|
|
16
|
-
"@webstudio-is/image": "0.
|
|
17
|
-
"@webstudio-is/react-sdk": "0.
|
|
18
|
-
"@webstudio-is/sdk": "0.
|
|
19
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
20
|
-
"@webstudio-is/sdk-components-animation": "0.
|
|
21
|
-
"@webstudio-is/sdk-components-react-radix": "0.
|
|
22
|
-
"@webstudio-is/sdk-components-react-remix": "0.
|
|
23
|
-
"@webstudio-is/wsauth": "0.
|
|
16
|
+
"@webstudio-is/image": "0.304.0",
|
|
17
|
+
"@webstudio-is/react-sdk": "0.304.0",
|
|
18
|
+
"@webstudio-is/sdk": "0.304.0",
|
|
19
|
+
"@webstudio-is/sdk-components-react": "0.304.0",
|
|
20
|
+
"@webstudio-is/sdk-components-animation": "0.304.0",
|
|
21
|
+
"@webstudio-is/sdk-components-react-radix": "0.304.0",
|
|
22
|
+
"@webstudio-is/sdk-components-react-remix": "0.304.0",
|
|
23
|
+
"@webstudio-is/wsauth": "0.304.0",
|
|
24
24
|
"isbot": "^5.1.25",
|
|
25
25
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
26
26
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
@@ -15,14 +15,14 @@
|
|
|
15
15
|
"@react-router/fs-routes": "^7.5.3",
|
|
16
16
|
"@react-router/node": "^7.5.3",
|
|
17
17
|
"@react-router/serve": "^7.5.3",
|
|
18
|
-
"@webstudio-is/image": "0.
|
|
19
|
-
"@webstudio-is/react-sdk": "0.
|
|
20
|
-
"@webstudio-is/sdk": "0.
|
|
21
|
-
"@webstudio-is/sdk-components-animation": "0.
|
|
22
|
-
"@webstudio-is/sdk-components-react-radix": "0.
|
|
23
|
-
"@webstudio-is/sdk-components-react-router": "0.
|
|
24
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
25
|
-
"@webstudio-is/wsauth": "0.
|
|
18
|
+
"@webstudio-is/image": "0.304.0",
|
|
19
|
+
"@webstudio-is/react-sdk": "0.304.0",
|
|
20
|
+
"@webstudio-is/sdk": "0.304.0",
|
|
21
|
+
"@webstudio-is/sdk-components-animation": "0.304.0",
|
|
22
|
+
"@webstudio-is/sdk-components-react-radix": "0.304.0",
|
|
23
|
+
"@webstudio-is/sdk-components-react-router": "0.304.0",
|
|
24
|
+
"@webstudio-is/sdk-components-react": "0.304.0",
|
|
25
|
+
"@webstudio-is/wsauth": "0.304.0",
|
|
26
26
|
"isbot": "^5.1.25",
|
|
27
27
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
28
28
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
@@ -11,12 +11,12 @@
|
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@shikijs/langs": "4.4.1",
|
|
13
13
|
"@shikijs/themes": "4.4.1",
|
|
14
|
-
"@webstudio-is/image": "0.
|
|
15
|
-
"@webstudio-is/react-sdk": "0.
|
|
16
|
-
"@webstudio-is/sdk": "0.
|
|
17
|
-
"@webstudio-is/sdk-components-react": "0.
|
|
18
|
-
"@webstudio-is/sdk-components-animation": "0.
|
|
19
|
-
"@webstudio-is/sdk-components-react-radix": "0.
|
|
14
|
+
"@webstudio-is/image": "0.304.0",
|
|
15
|
+
"@webstudio-is/react-sdk": "0.304.0",
|
|
16
|
+
"@webstudio-is/sdk": "0.304.0",
|
|
17
|
+
"@webstudio-is/sdk-components-react": "0.304.0",
|
|
18
|
+
"@webstudio-is/sdk-components-animation": "0.304.0",
|
|
19
|
+
"@webstudio-is/sdk-components-react-radix": "0.304.0",
|
|
20
20
|
"react": "18.3.0-canary-14898b6a9-20240318",
|
|
21
21
|
"react-dom": "18.3.0-canary-14898b6a9-20240318",
|
|
22
22
|
"shiki": "4.4.1",
|