@@ -14,13 +14,8 @@ export function replaceResources(
1414 shouldTransform : ( fileName : string ) => boolean ,
1515 getTypeChecker : ( ) => ts . TypeChecker ,
1616 directTemplateLoading = false ,
17- inlineStyleMimeType ?: string ,
1817 inlineStyleFileExtension ?: string ,
1918) : 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-
2419 return ( context : ts . TransformationContext ) => {
2520 const typeChecker = getTypeChecker ( ) ;
2621 const resourceImportDeclarations : ts . ImportDeclaration [ ] = [ ] ;
@@ -38,7 +33,6 @@ export function replaceResources(
3833 directTemplateLoading ,
3934 resourceImportDeclarations ,
4035 moduleKind ,
41- inlineStyleMimeType ,
4236 inlineStyleFileExtension ,
4337 )
4438 : node ,
@@ -90,7 +84,6 @@ function visitDecorator(
9084 directTemplateLoading : boolean ,
9185 resourceImportDeclarations : ts . ImportDeclaration [ ] ,
9286 moduleKind ?: ts . ModuleKind ,
93- inlineStyleMimeType ?: string ,
9487 inlineStyleFileExtension ?: string ,
9588) : ts . Decorator {
9689 if ( ! isComponentDecorator ( node , typeChecker ) ) {
@@ -121,7 +114,6 @@ function visitDecorator(
121114 directTemplateLoading ,
122115 resourceImportDeclarations ,
123116 moduleKind ,
124- inlineStyleMimeType ,
125117 inlineStyleFileExtension ,
126118 )
127119 : node ,
@@ -155,7 +147,6 @@ function visitComponentMetadata(
155147 directTemplateLoading : boolean ,
156148 resourceImportDeclarations : ts . ImportDeclaration [ ] ,
157149 moduleKind ?: ts . ModuleKind ,
158- inlineStyleMimeType ?: string ,
159150 inlineStyleFileExtension ?: string ,
160151) : ts . ObjectLiteralElementLike | undefined {
161152 if ( ! ts . isPropertyAssignment ( node ) || ts . isComputedPropertyName ( node . name ) ) {
@@ -205,10 +196,7 @@ function visitComponentMetadata(
205196
206197 let url ;
207198 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 ) {
212200 const data = Buffer . from ( node . text ) . toString ( 'base64' ) ;
213201 const containingFile = node . getSourceFile ( ) . fileName ;
214202 url = `${ containingFile } .${ inlineStyleFileExtension } !=!${ InlineAngularResourceLoaderPath } ?data=${ encodeURIComponent (
0 commit comments