Skip to content

Commit 7bc04dc

Browse files
authored
fix: Update commentUseStrictRegex to be lazy instead of greedy (#309)
1 parent 5d59878 commit 7bc04dc

File tree

1 file changed

+1
-1
lines changed
  • packages/bundler-plugin-core/src

1 file changed

+1
-1
lines changed

packages/bundler-plugin-core/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ export function createRollupDebugIdInjectionHooks() {
344344
// As an additional complication `"use strict";`s may come after any number of comments.
345345
const commentUseStrictRegex =
346346
// Note: CodeQL complains that this regex potentially has n^2 runtime. This likely won't affect realistic files.
347-
/^(?:\s*|\/\*(?:.|\r|\n)*\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
347+
/^(?:\s*|\/\*(?:.|\r|\n)*?\*\/|\/\/.*[\n\r])*(?:"[^"]*";|'[^']*';)?/;
348348

349349
const match = code.match(commentUseStrictRegex)?.[0];
350350

0 commit comments

Comments
 (0)