Skip to content

Commit 3883482

Browse files
committed
Simplifying imports and removing legacy MIME types for JS
1 parent b1291cb commit 3883482

File tree

4 files changed

+3
-31
lines changed

4 files changed

+3
-31
lines changed

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,6 @@
174174
"ora": "5.4.1",
175175
"pacote": "20.0.0",
176176
"parse5-html-rewriting-stream": "7.0.0",
177-
"parse5-sax-parser": "7.0.0",
178177
"picomatch": "4.0.2",
179178
"piscina": "4.7.0",
180179
"postcss": "8.4.47",

packages/angular/build/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ ts_library(
8989
"@npm//magic-string",
9090
"@npm//mrmime",
9191
"@npm//parse5-html-rewriting-stream",
92-
"@npm//parse5-sax-parser",
9392
"@npm//picomatch",
9493
"@npm//piscina",
9594
"@npm//postcss",

packages/angular/build/src/utils/index-file/auto-csp.ts

Lines changed: 2 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,14 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import { RewritingStream } from 'parse5-html-rewriting-stream';
10-
import { StartTag } from 'parse5-sax-parser';
11-
import { htmlRewritingStream } from './html-rewriting-stream';
9+
import { htmlRewritingStream, StartTag } from './html-rewriting-stream';
1210
import * as crypto from 'node:crypto';
1311

1412
/**
1513
* The hash function to use for hash directives to use in the CSP.
1614
*/
1715
const HASH_FUNCTION = 'sha256';
1816

19-
/**
20-
* Appropriate and legacy JS MIME types from
21-
* https://developer.mozilla.org/en-US/docs/Web/HTTP/MIME_types#textjavascript
22-
*/
23-
const JS_MIME_TYPES = new Set([
24-
'text/javascript',
25-
'application/javascript',
26-
'application/ecmascript',
27-
'application/x-ecmascript',
28-
'application/x-javascript',
29-
'text/ecmascript',
30-
'text/javascript1.0',
31-
'text/javascript1.1',
32-
'text/javascript1.2',
33-
'text/javascript1.3',
34-
'text/javascript1.4',
35-
'text/javascript1.5',
36-
'text/jscript',
37-
'text/livescript',
38-
'text/x-ecmascript',
39-
'text/x-javascript',
40-
]);
41-
4217
/**
4318
* Store the appropriate attributes of a sourced script tag to generate the loader script.
4419
*/
@@ -67,7 +42,7 @@ function getScriptAttributeValue(tag: StartTag, attrName: string): string | unde
6742
* @returns whether the string is a MIME type that is associated with JavaScript
6843
*/
6944
function isJavascriptMimeType(mimeType: string): boolean {
70-
return JS_MIME_TYPES.has(mimeType.split(';')[0]);
45+
return mimeType.split(';')[0] === 'text/javascript';
7146
}
7247

7348
/**

yarn.lock

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,6 @@ __metadata:
752752
ora: "npm:5.4.1"
753753
pacote: "npm:20.0.0"
754754
parse5-html-rewriting-stream: "npm:7.0.0"
755-
parse5-sax-parser: "npm:7.0.0"
756755
picomatch: "npm:4.0.2"
757756
piscina: "npm:4.7.0"
758757
postcss: "npm:8.4.47"
@@ -14301,7 +14300,7 @@ __metadata:
1430114300
languageName: node
1430214301
linkType: hard
1430314302

14304-
"parse5-sax-parser@npm:7.0.0, parse5-sax-parser@npm:^7.0.0":
14303+
"parse5-sax-parser@npm:^7.0.0":
1430514304
version: 7.0.0
1430614305
resolution: "parse5-sax-parser@npm:7.0.0"
1430714306
dependencies:

0 commit comments

Comments
 (0)