diff options
author | 2024-08-07 16:01:23 +0800 | |
---|---|---|
committer | 2024-08-07 16:01:23 +0800 | |
commit | ea82b03cd6d40c6bd541046f2f9aedfed058ff4f (patch) | |
tree | 620fbe169215cba926d7f6376a8b75cb7c12c8e3 /packages/integrations/markdoc/src | |
parent | 74a093056df99b2714ecc30fc2c36e88778dd9ce (diff) | |
download | astro-ea82b03cd6d40c6bd541046f2f9aedfed058ff4f.tar.gz astro-ea82b03cd6d40c6bd541046f2f9aedfed058ff4f.tar.zst astro-ea82b03cd6d40c6bd541046f2f9aedfed058ff4f.zip |
Improve regex performance (#11635)
Diffstat (limited to 'packages/integrations/markdoc/src')
-rw-r--r-- | packages/integrations/markdoc/src/content-entry-type.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/packages/integrations/markdoc/src/content-entry-type.ts b/packages/integrations/markdoc/src/content-entry-type.ts index 8fc4bd77c..bd19e1ccd 100644 --- a/packages/integrations/markdoc/src/content-entry-type.ts +++ b/packages/integrations/markdoc/src/content-entry-type.ts @@ -245,7 +245,7 @@ function raiseValidationErrors({ e.error.id !== 'variable-undefined' && // Ignore missing partial errors. // We will resolve these in `resolvePartials`. - !(e.error.id === 'attribute-value-invalid' && e.error.message.match(/^Partial .+ not found/)) + !(e.error.id === 'attribute-value-invalid' && /^Partial .+ not found/.test(e.error.message)) ); }); @@ -275,7 +275,7 @@ function getUsedTags(markdocAst: Node) { // This is our signal that a tag is being used! for (const { error } of validationErrors) { if (error.id === 'tag-undefined') { - const [, tagName] = error.message.match(/Undefined tag: '(.*)'/) ?? []; + const [, tagName] = /Undefined tag: '(.*)'/.exec(error.message) ?? []; tags.add(tagName); } } |