@@ -14,13 +14,8 @@ export function replaceResources(
14
14
shouldTransform : ( fileName : string ) => boolean ,
15
15
getTypeChecker : ( ) => ts . TypeChecker ,
16
16
directTemplateLoading = false ,
17
- inlineStyleMimeType ?: string ,
18
17
inlineStyleFileExtension ?: string ,
19
18
) : ts . TransformerFactory < ts . SourceFile > {
20
- if ( inlineStyleMimeType && ! / ^ t e x t \/ [ - . \w ] + $ / . test ( inlineStyleMimeType ) ) {
21
- throw new Error ( 'Invalid inline style MIME type.' ) ;
22
- }
23
-
24
19
return ( context : ts . TransformationContext ) => {
25
20
const typeChecker = getTypeChecker ( ) ;
26
21
const resourceImportDeclarations : ts . ImportDeclaration [ ] = [ ] ;
@@ -38,7 +33,6 @@ export function replaceResources(
38
33
directTemplateLoading ,
39
34
resourceImportDeclarations ,
40
35
moduleKind ,
41
- inlineStyleMimeType ,
42
36
inlineStyleFileExtension ,
43
37
)
44
38
: node ,
@@ -90,7 +84,6 @@ function visitDecorator(
90
84
directTemplateLoading : boolean ,
91
85
resourceImportDeclarations : ts . ImportDeclaration [ ] ,
92
86
moduleKind ?: ts . ModuleKind ,
93
- inlineStyleMimeType ?: string ,
94
87
inlineStyleFileExtension ?: string ,
95
88
) : ts . Decorator {
96
89
if ( ! isComponentDecorator ( node , typeChecker ) ) {
@@ -121,7 +114,6 @@ function visitDecorator(
121
114
directTemplateLoading ,
122
115
resourceImportDeclarations ,
123
116
moduleKind ,
124
- inlineStyleMimeType ,
125
117
inlineStyleFileExtension ,
126
118
)
127
119
: node ,
@@ -155,7 +147,6 @@ function visitComponentMetadata(
155
147
directTemplateLoading : boolean ,
156
148
resourceImportDeclarations : ts . ImportDeclaration [ ] ,
157
149
moduleKind ?: ts . ModuleKind ,
158
- inlineStyleMimeType ?: string ,
159
150
inlineStyleFileExtension ?: string ,
160
151
) : ts . ObjectLiteralElementLike | undefined {
161
152
if ( ! ts . isPropertyAssignment ( node ) || ts . isComputedPropertyName ( node . name ) ) {
@@ -205,10 +196,7 @@ function visitComponentMetadata(
205
196
206
197
let url ;
207
198
if ( isInlineStyle ) {
208
- if ( inlineStyleMimeType ) {
209
- const data = Buffer . from ( node . text ) . toString ( 'base64' ) ;
210
- url = `data:${ inlineStyleMimeType } ;charset=utf-8;base64,${ data } ` ;
211
- } else if ( inlineStyleFileExtension ) {
199
+ if ( inlineStyleFileExtension ) {
212
200
const data = Buffer . from ( node . text ) . toString ( 'base64' ) ;
213
201
const containingFile = node . getSourceFile ( ) . fileName ;
214
202
url = `${ containingFile } .${ inlineStyleFileExtension } !=!${ InlineAngularResourceLoaderPath } ?data=${ encodeURIComponent (
0 commit comments