|
9 | 9 | import {existsSync, readFileSync} from 'fs';
|
10 | 10 | import {dirname, resolve} from 'path';
|
11 | 11 | import * as ts from 'typescript';
|
| 12 | +import {isStringLiteralLike} from '../typescript/literal'; |
12 | 13 | import {createComponentFile, ExternalResource} from './component-file';
|
13 | 14 | import {ExternalFailureWalker} from './external-failure-walker';
|
14 | 15 |
|
@@ -60,11 +61,11 @@ export class ComponentWalker extends ExternalFailureWalker {
|
60 | 61 | for (const property of directiveMetadata.properties as ts.NodeArray<ts.PropertyAssignment>) {
|
61 | 62 | const propertyName = property.name.getText();
|
62 | 63 |
|
63 |
| - if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) { |
| 64 | + if (propertyName === 'template' && isStringLiteralLike(property.initializer)) { |
64 | 65 | this.visitInlineTemplate(property.initializer);
|
65 | 66 | }
|
66 | 67 |
|
67 |
| - if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) { |
| 68 | + if (propertyName === 'templateUrl' && isStringLiteralLike(property.initializer)) { |
68 | 69 | this._reportExternalTemplate(property.initializer);
|
69 | 70 | }
|
70 | 71 |
|
@@ -95,15 +96,15 @@ export class ComponentWalker extends ExternalFailureWalker {
|
95 | 96 |
|
96 | 97 | private _reportInlineStyles(expression: ts.ArrayLiteralExpression) {
|
97 | 98 | expression.elements.forEach(node => {
|
98 |
| - if (ts.isStringLiteralLike(node)) { |
| 99 | + if (isStringLiteralLike(node)) { |
99 | 100 | this.visitInlineStylesheet(node);
|
100 | 101 | }
|
101 | 102 | });
|
102 | 103 | }
|
103 | 104 |
|
104 | 105 | private _visitExternalStylesArrayLiteral(expression: ts.ArrayLiteralExpression) {
|
105 | 106 | expression.elements.forEach(node => {
|
106 |
| - if (ts.isStringLiteralLike(node)) { |
| 107 | + if (isStringLiteralLike(node)) { |
107 | 108 | const stylePath = resolve(dirname(this.getSourceFile().fileName), node.text);
|
108 | 109 |
|
109 | 110 | // Check if the external stylesheet file exists before proceeding.
|
|
0 commit comments