Skip to content

Commit c301e27

Browse files
authored
fix(instrumenter): Allow script tags with type "module" to be mutated (#5230)
1 parent 92ddf02 commit c301e27

File tree

5 files changed

+867
-1
lines changed

5 files changed

+867
-1
lines changed

packages/instrumenter/src/parsers/html-parser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ParseError } from './parse-error.js';
77

88
const TSX_SCRIPT_TYPES = Object.freeze(['tsx', 'text/tsx']);
99
const TS_SCRIPT_TYPES = Object.freeze(['ts', 'text/typescript', 'typescript']);
10-
const JS_SCRIPT_TYPES = Object.freeze(['js', 'text/javascript', 'javascript']);
10+
const JS_SCRIPT_TYPES = Object.freeze(['js', 'text/javascript', 'javascript', 'module']);
1111

1212
/*
1313
The parser implementation in this file is heavily based on prettier's html parser

packages/instrumenter/test/integration/parsers.it.spec.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ describe('parsers integration', () => {
1616
expect(actual).to.matchSnapshot();
1717
});
1818

19+
it('should allow to parse html with module script tags', async () => {
20+
const actual = await actAssertHtml('index-module.html');
21+
expect(actual.root.scripts).lengthOf(2);
22+
expect(actual).to.matchSnapshot();
23+
});
24+
1925
it('should allow to parse a *.vue file', async () => {
2026
const actual = await actAssertHtml('App.vue');
2127
expect(actual.format).eq(AstFormat.Html);

0 commit comments

Comments
 (0)