@ngtools/webpack 17.0.0-rc.3 → 17.0.0-rc.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
@@ -93,7 +93,7 @@ function findImageDomains(imageDomains) {
|
|
93
93
|
}
|
94
94
|
return node;
|
95
95
|
}
|
96
|
-
function
|
96
|
+
function findProvidersAssignment(node) {
|
97
97
|
if (ts.isPropertyAssignment(node)) {
|
98
98
|
if (ts.isIdentifier(node.name) && node.name.escapedText === 'providers') {
|
99
99
|
ts.visitEachChild(node.initializer, findImageLoaders, context);
|
@@ -101,18 +101,44 @@ function findImageDomains(imageDomains) {
|
|
101
101
|
}
|
102
102
|
return node;
|
103
103
|
}
|
104
|
+
function findFeaturesAssignment(node) {
|
105
|
+
if (ts.isPropertyAssignment(node)) {
|
106
|
+
if (ts.isIdentifier(node.name) &&
|
107
|
+
node.name.escapedText === 'features' &&
|
108
|
+
ts.isArrayLiteralExpression(node.initializer)) {
|
109
|
+
const providerElement = node.initializer.elements.find(isProvidersFeatureElement);
|
110
|
+
if (providerElement &&
|
111
|
+
ts.isCallExpression(providerElement) &&
|
112
|
+
providerElement.arguments[0]) {
|
113
|
+
ts.visitEachChild(providerElement.arguments[0], findImageLoaders, context);
|
114
|
+
}
|
115
|
+
}
|
116
|
+
}
|
117
|
+
return node;
|
118
|
+
}
|
119
|
+
function isProvidersFeatureElement(node) {
|
120
|
+
return (ts.isCallExpression(node) &&
|
121
|
+
ts.isPropertyAccessExpression(node.expression) &&
|
122
|
+
ts.isIdentifier(node.expression.expression) &&
|
123
|
+
node.expression.expression.escapedText === 'i0' &&
|
124
|
+
ts.isIdentifier(node.expression.name) &&
|
125
|
+
node.expression.name.escapedText === 'ɵɵProvidersFeature');
|
126
|
+
}
|
104
127
|
function findPropertyDeclaration(node) {
|
105
128
|
if (ts.isPropertyDeclaration(node) &&
|
106
129
|
ts.isIdentifier(node.name) &&
|
107
|
-
node.name.escapedText === 'ɵinj' &&
|
108
130
|
node.initializer &&
|
109
131
|
ts.isCallExpression(node.initializer) &&
|
110
132
|
node.initializer.arguments[0]) {
|
111
|
-
|
133
|
+
if (node.name.escapedText === 'ɵinj') {
|
134
|
+
ts.visitEachChild(node.initializer.arguments[0], findProvidersAssignment, context);
|
135
|
+
}
|
136
|
+
else if (node.name.escapedText === 'ɵcmp') {
|
137
|
+
ts.visitEachChild(node.initializer.arguments[0], findFeaturesAssignment, context);
|
138
|
+
}
|
112
139
|
}
|
113
140
|
return node;
|
114
141
|
}
|
115
|
-
// Continue traversal if node is ClassDeclaration and has name "AppModule"
|
116
142
|
function findClassDeclaration(node) {
|
117
143
|
if (ts.isClassDeclaration(node)) {
|
118
144
|
ts.visitEachChild(node, findPropertyDeclaration, context);
|