feat(plugins): add source-control extension contracts (#2117)
This commit is contained in:
@@ -298,14 +298,16 @@ function assertFeatureClipShape(clip) {
|
||||
"filenames",
|
||||
Boolean(
|
||||
clip.filenames &&
|
||||
typeof clip.filenames === "object" &&
|
||||
!Array.isArray(clip.filenames),
|
||||
typeof clip.filenames === "object" &&
|
||||
!Array.isArray(clip.filenames),
|
||||
),
|
||||
],
|
||||
[
|
||||
"files",
|
||||
Boolean(
|
||||
clip.files && typeof clip.files === "object" && !Array.isArray(clip.files),
|
||||
clip.files &&
|
||||
typeof clip.files === "object" &&
|
||||
!Array.isArray(clip.files),
|
||||
),
|
||||
],
|
||||
];
|
||||
@@ -335,10 +337,7 @@ function hasCompleteFeatureMediaEmbed(markdown, filenames) {
|
||||
...match[0].matchAll(
|
||||
/\b(webm|mp4|poster)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,
|
||||
),
|
||||
].map((attribute) => [
|
||||
attribute[1],
|
||||
attribute[2] ?? attribute[3],
|
||||
]),
|
||||
].map((attribute) => [attribute[1], attribute[2] ?? attribute[3]]),
|
||||
);
|
||||
|
||||
return Object.entries(filenames).every(
|
||||
@@ -738,7 +737,9 @@ async function collectFilesWithExtension(dir, extension) {
|
||||
function assertCompleteSurfaceCoverage(shipped, covered, excluded, label) {
|
||||
for (const value of covered) {
|
||||
if (excluded.has(value)) {
|
||||
throw new Error(`coverage.json both covers and excludes ${label}: ${value}`);
|
||||
throw new Error(
|
||||
`coverage.json both covers and excludes ${label}: ${value}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
for (const value of shipped) {
|
||||
@@ -871,9 +872,7 @@ function assertExperimentalCalloutPlacement(file, markdown) {
|
||||
const heading = headings[headingIndex];
|
||||
if (
|
||||
!heading ||
|
||||
source
|
||||
.slice(heading.index + heading[0].length, callout.index)
|
||||
.trim()
|
||||
source.slice(heading.index + heading[0].length, callout.index).trim()
|
||||
) {
|
||||
throw new Error(
|
||||
`${file} experimental callouts must immediately follow a descriptive heading`,
|
||||
@@ -888,9 +887,7 @@ function assertExperimentalCalloutPlacement(file, markdown) {
|
||||
const sectionEnd = nextHeading?.index ?? source.length;
|
||||
const calloutBlock = source
|
||||
.slice(callout.index)
|
||||
.match(
|
||||
/^>\s*\[!EXPERIMENTAL\]\s*\r?\n(?:^>.*(?:\r?\n|$))*/im,
|
||||
)?.[0];
|
||||
.match(/^>\s*\[!EXPERIMENTAL\]\s*\r?\n(?:^>.*(?:\r?\n|$))*/im)?.[0];
|
||||
const sectionContent = source
|
||||
.slice(
|
||||
callout.index + (calloutBlock?.length ?? callout[0].length),
|
||||
|
||||
Reference in New Issue
Block a user