diff options
Diffstat (limited to 'packages/integrations')
4 files changed, 6 insertions, 6 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); } } diff --git a/packages/integrations/mdx/test/units/rehype-optimize-static.test.js b/packages/integrations/mdx/test/units/rehype-optimize-static.test.js index 132f3849f..675bc3478 100644 --- a/packages/integrations/mdx/test/units/rehype-optimize-static.test.js +++ b/packages/integrations/mdx/test/units/rehype-optimize-static.test.js @@ -15,7 +15,7 @@ async function compile(mdxCode, options) { }); const code = result.toString(); // Capture the returned JSX code for testing - const jsx = code.match(/return (.+);\n\}\nexport default function MDXContent/s)?.[1]; + const jsx = /return (.+);\n\}\nexport default function MDXContent/s.exec(code)?.[1]; if (jsx == null) throw new Error('Could not find JSX code in compiled MDX'); return dedent(jsx); } diff --git a/packages/integrations/node/src/serve-static.ts b/packages/integrations/node/src/serve-static.ts index 0ec129d9f..8256c588e 100644 --- a/packages/integrations/node/src/serve-static.ts +++ b/packages/integrations/node/src/serve-static.ts @@ -52,7 +52,7 @@ export function createStaticHandler(app: NodeApp, options: Options) { break; case 'always': // trailing slash is not added to "subresources" - if (!hasSlash && !urlPath.match(isSubresourceRegex)) { + if (!hasSlash && !isSubresourceRegex.test(urlPath)) { pathname = urlPath + '/' + (urlQuery ? '?' + urlQuery : ''); res.statusCode = 301; res.setHeader('Location', pathname); diff --git a/packages/integrations/vue/src/editor.cts b/packages/integrations/vue/src/editor.cts index d4f10aab6..64b34b45b 100644 --- a/packages/integrations/vue/src/editor.cts +++ b/packages/integrations/vue/src/editor.cts @@ -24,7 +24,7 @@ export function toTSX(code: string, className: string): string { if (scriptSetup) { const codeWithoutComments = scriptSetup.content.replace(/\/\/.*|\/\*[\s\S]*?\*\//g, ''); - const definePropsType = codeWithoutComments.match(/defineProps<([\s\S]+?)>\s?\(\)/); + const definePropsType = /defineProps<([\s\S]+?)>\s?\(\)/.exec(codeWithoutComments); const propsGeneric = scriptSetup.attrs.generic; const propsGenericType = propsGeneric ? `<${propsGeneric}>` : ''; @@ -41,7 +41,7 @@ export function toTSX(code: string, className: string): string { // TODO. Find a way to support generics when using defineProps without passing explicit types. // Right now something like this `defineProps({ prop: { type: Array as PropType<T[]> } })` // won't be correctly typed in Astro. - const defineProps = codeWithoutComments.match(/defineProps\([\s\S]+?\)/); + const defineProps = /defineProps\([\s\S]+?\)/.exec(codeWithoutComments); if (defineProps) { result = ` import { defineProps } from 'vue'; |