@depup/ngtools__webpack 21.2.2-depup.0
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/LICENSE +21 -0
- package/README.md +25 -0
- package/changes.json +5 -0
- package/index.d.ts +8 -0
- package/index.js +25 -0
- package/index.js.map +1 -0
- package/package.json +50 -0
- package/src/benchmark.d.ts +9 -0
- package/src/benchmark.js +27 -0
- package/src/benchmark.js.map +1 -0
- package/src/index.d.ts +8 -0
- package/src/index.js +19 -0
- package/src/index.js.map +1 -0
- package/src/ivy/cache.d.ts +14 -0
- package/src/ivy/cache.js +33 -0
- package/src/ivy/cache.js.map +1 -0
- package/src/ivy/diagnostics.d.ts +13 -0
- package/src/ivy/diagnostics.js +33 -0
- package/src/ivy/diagnostics.js.map +1 -0
- package/src/ivy/host.d.ts +32 -0
- package/src/ivy/host.js +226 -0
- package/src/ivy/host.js.map +1 -0
- package/src/ivy/index.d.ts +10 -0
- package/src/ivy/index.js +17 -0
- package/src/ivy/index.js.map +1 -0
- package/src/ivy/loader.d.ts +10 -0
- package/src/ivy/loader.js +95 -0
- package/src/ivy/loader.js.map +1 -0
- package/src/ivy/paths.d.ts +11 -0
- package/src/ivy/paths.js +70 -0
- package/src/ivy/paths.js.map +1 -0
- package/src/ivy/plugin.d.ts +53 -0
- package/src/ivy/plugin.js +556 -0
- package/src/ivy/plugin.js.map +1 -0
- package/src/ivy/symbol.d.ts +25 -0
- package/src/ivy/symbol.js +45 -0
- package/src/ivy/symbol.js.map +1 -0
- package/src/ivy/system.d.ts +15 -0
- package/src/ivy/system.js +115 -0
- package/src/ivy/system.js.map +1 -0
- package/src/ivy/transformation.d.ts +18 -0
- package/src/ivy/transformation.js +137 -0
- package/src/ivy/transformation.js.map +1 -0
- package/src/loaders/inline-resource.d.ts +16 -0
- package/src/loaders/inline-resource.js +25 -0
- package/src/loaders/inline-resource.js.map +1 -0
- package/src/paths-plugin.d.ts +32 -0
- package/src/paths-plugin.js +255 -0
- package/src/paths-plugin.js.map +1 -0
- package/src/resource_loader.d.ts +29 -0
- package/src/resource_loader.js +321 -0
- package/src/resource_loader.js.map +1 -0
- package/src/transformers/elide_imports.d.ts +9 -0
- package/src/transformers/elide_imports.js +165 -0
- package/src/transformers/elide_imports.js.map +1 -0
- package/src/transformers/find_image_domains.d.ts +9 -0
- package/src/transformers/find_image_domains.js +132 -0
- package/src/transformers/find_image_domains.js.map +1 -0
- package/src/transformers/index.d.ts +9 -0
- package/src/transformers/index.js +26 -0
- package/src/transformers/index.js.map +1 -0
- package/src/transformers/remove-ivy-jit-support-calls.d.ts +9 -0
- package/src/transformers/remove-ivy-jit-support-calls.js +136 -0
- package/src/transformers/remove-ivy-jit-support-calls.js.map +1 -0
- package/src/transformers/replace_resources.d.ts +11 -0
- package/src/transformers/replace_resources.js +250 -0
- package/src/transformers/replace_resources.js.map +1 -0
- package/src/transformers/spec_helpers.d.ts +13 -0
- package/src/transformers/spec_helpers.js +89 -0
- package/src/transformers/spec_helpers.js.map +1 -0
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
10
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.findImageDomains = findImageDomains;
|
|
14
|
+
const typescript_1 = __importDefault(require("typescript"));
|
|
15
|
+
const BUILTIN_LOADERS = new Set([
|
|
16
|
+
'provideCloudflareLoader',
|
|
17
|
+
'provideCloudinaryLoader',
|
|
18
|
+
'provideImageKitLoader',
|
|
19
|
+
'provideImgixLoader',
|
|
20
|
+
]);
|
|
21
|
+
const URL_REGEX = /(https?:\/\/[^/]*)\//g;
|
|
22
|
+
function findImageDomains(imageDomains) {
|
|
23
|
+
return (context) => {
|
|
24
|
+
return (sourceFile) => {
|
|
25
|
+
const isBuiltinImageLoader = (node) => {
|
|
26
|
+
return BUILTIN_LOADERS.has(node.expression.getText());
|
|
27
|
+
};
|
|
28
|
+
const findDomainString = (node) => {
|
|
29
|
+
if (typescript_1.default.isStringLiteral(node) ||
|
|
30
|
+
typescript_1.default.isTemplateHead(node) ||
|
|
31
|
+
typescript_1.default.isTemplateMiddle(node) ||
|
|
32
|
+
typescript_1.default.isTemplateTail(node)) {
|
|
33
|
+
const domain = node.text.match(URL_REGEX);
|
|
34
|
+
if (domain && domain[0]) {
|
|
35
|
+
imageDomains.add(domain[0]);
|
|
36
|
+
return node;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
typescript_1.default.visitEachChild(node, findDomainString, context);
|
|
40
|
+
return node;
|
|
41
|
+
};
|
|
42
|
+
function isImageProviderKey(property) {
|
|
43
|
+
return (typescript_1.default.isPropertyAssignment(property) &&
|
|
44
|
+
property.name.getText() === 'provide' &&
|
|
45
|
+
property.initializer.getText() === 'IMAGE_LOADER');
|
|
46
|
+
}
|
|
47
|
+
function isImageProviderValue(property) {
|
|
48
|
+
return typescript_1.default.isPropertyAssignment(property) && property.name.getText() === 'useValue';
|
|
49
|
+
}
|
|
50
|
+
function checkForDomain(node) {
|
|
51
|
+
if (node.properties.find(isImageProviderKey)) {
|
|
52
|
+
const value = node.properties.find(isImageProviderValue);
|
|
53
|
+
if (value && typescript_1.default.isPropertyAssignment(value)) {
|
|
54
|
+
if (typescript_1.default.isArrowFunction(value.initializer) ||
|
|
55
|
+
typescript_1.default.isFunctionExpression(value.initializer)) {
|
|
56
|
+
typescript_1.default.visitEachChild(node, findDomainString, context);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
function findImageLoaders(node) {
|
|
62
|
+
if (typescript_1.default.isCallExpression(node)) {
|
|
63
|
+
if (isBuiltinImageLoader(node)) {
|
|
64
|
+
const firstArg = node.arguments[0];
|
|
65
|
+
if (typescript_1.default.isStringLiteralLike(firstArg)) {
|
|
66
|
+
imageDomains.add(firstArg.text);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else if (typescript_1.default.isObjectLiteralExpression(node)) {
|
|
71
|
+
checkForDomain(node);
|
|
72
|
+
}
|
|
73
|
+
return node;
|
|
74
|
+
}
|
|
75
|
+
function findProvidersAssignment(node) {
|
|
76
|
+
if (typescript_1.default.isPropertyAssignment(node)) {
|
|
77
|
+
if (typescript_1.default.isIdentifier(node.name) && node.name.escapedText === 'providers') {
|
|
78
|
+
typescript_1.default.visitEachChild(node.initializer, findImageLoaders, context);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
return node;
|
|
82
|
+
}
|
|
83
|
+
function findFeaturesAssignment(node) {
|
|
84
|
+
if (typescript_1.default.isPropertyAssignment(node)) {
|
|
85
|
+
if (typescript_1.default.isIdentifier(node.name) &&
|
|
86
|
+
node.name.escapedText === 'features' &&
|
|
87
|
+
typescript_1.default.isArrayLiteralExpression(node.initializer)) {
|
|
88
|
+
const providerElement = node.initializer.elements.find(isProvidersFeatureElement);
|
|
89
|
+
if (providerElement &&
|
|
90
|
+
typescript_1.default.isCallExpression(providerElement) &&
|
|
91
|
+
providerElement.arguments[0]) {
|
|
92
|
+
typescript_1.default.visitEachChild(providerElement.arguments[0], findImageLoaders, context);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return node;
|
|
97
|
+
}
|
|
98
|
+
function isProvidersFeatureElement(node) {
|
|
99
|
+
return (typescript_1.default.isCallExpression(node) &&
|
|
100
|
+
typescript_1.default.isPropertyAccessExpression(node.expression) &&
|
|
101
|
+
typescript_1.default.isIdentifier(node.expression.expression) &&
|
|
102
|
+
node.expression.expression.escapedText === 'i0' &&
|
|
103
|
+
typescript_1.default.isIdentifier(node.expression.name) &&
|
|
104
|
+
node.expression.name.escapedText === 'ɵɵProvidersFeature');
|
|
105
|
+
}
|
|
106
|
+
function findPropertyDeclaration(node) {
|
|
107
|
+
if (typescript_1.default.isPropertyDeclaration(node) &&
|
|
108
|
+
typescript_1.default.isIdentifier(node.name) &&
|
|
109
|
+
node.initializer &&
|
|
110
|
+
typescript_1.default.isCallExpression(node.initializer) &&
|
|
111
|
+
node.initializer.arguments[0]) {
|
|
112
|
+
if (node.name.escapedText === 'ɵinj') {
|
|
113
|
+
typescript_1.default.visitEachChild(node.initializer.arguments[0], findProvidersAssignment, context);
|
|
114
|
+
}
|
|
115
|
+
else if (node.name.escapedText === 'ɵcmp') {
|
|
116
|
+
typescript_1.default.visitEachChild(node.initializer.arguments[0], findFeaturesAssignment, context);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return node;
|
|
120
|
+
}
|
|
121
|
+
function findClassDeclaration(node) {
|
|
122
|
+
if (typescript_1.default.isClassDeclaration(node)) {
|
|
123
|
+
typescript_1.default.visitEachChild(node, findPropertyDeclaration, context);
|
|
124
|
+
}
|
|
125
|
+
return node;
|
|
126
|
+
}
|
|
127
|
+
typescript_1.default.visitEachChild(sourceFile, findClassDeclaration, context);
|
|
128
|
+
return sourceFile;
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=find_image_domains.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find_image_domains.js","sourceRoot":"","sources":["find_image_domains.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AAYH,4CA4IC;AAtJD,4DAA4B;AAE5B,MAAM,eAAe,GAAG,IAAI,GAAG,CAAC;IAC9B,yBAAyB;IACzB,yBAAyB;IACzB,uBAAuB;IACvB,oBAAoB;CACrB,CAAC,CAAC;AACH,MAAM,SAAS,GAAG,uBAAuB,CAAC;AAE1C,SAAgB,g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
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
export * from './elide_imports';
|
|
9
|
+
export * from './replace_resources';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
21
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
__exportStar(require("./elide_imports"), exports);
|
|
25
|
+
__exportStar(require("./replace_resources"), exports);
|
|
26
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;AAEH,kDAAgC;AAChC,sDAAoC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
export declare function removeIvyJitSupportCalls(classMetadata: boolean, ngModuleScope: boolean, debugInfo: boolean, getTypeChecker: () => ts.TypeChecker): ts.TransformerFactory<ts.SourceFile>;
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.removeIvyJitSupportCalls = removeIvyJitSupportCalls;
|
|
44
|
+
const ts = __importStar(require("typescript"));
|
|
45
|
+
const elide_imports_1 = require("./elide_imports");
|
|
46
|
+
function removeIvyJitSupportCalls(classMetadata, ngModuleScope, debugInfo, getTypeChecker) {
|
|
47
|
+
return (context) => {
|
|
48
|
+
const removedNodes = [];
|
|
49
|
+
const visitNode = (node) => {
|
|
50
|
+
const innerExpression = ts.isExpressionStatement(node) ? getIifeExpression(node) : null;
|
|
51
|
+
if (innerExpression) {
|
|
52
|
+
if (ngModuleScope &&
|
|
53
|
+
ts.isBinaryExpression(innerExpression) &&
|
|
54
|
+
isIvyPrivateCallExpression(innerExpression.right, 'ɵɵsetNgModuleScope')) {
|
|
55
|
+
removedNodes.push(innerExpression);
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
if (classMetadata) {
|
|
59
|
+
const expression = ts.isBinaryExpression(innerExpression)
|
|
60
|
+
? innerExpression.right
|
|
61
|
+
: innerExpression;
|
|
62
|
+
if (isIvyPrivateCallExpression(expression, 'ɵsetClassMetadata') ||
|
|
63
|
+
isIvyPrivateCallExpression(expression, 'ɵsetClassMetadataAsync')) {
|
|
64
|
+
removedNodes.push(innerExpression);
|
|
65
|
+
return undefined;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (debugInfo &&
|
|
69
|
+
ts.isBinaryExpression(innerExpression) &&
|
|
70
|
+
isIvyPrivateCallExpression(innerExpression.right, 'ɵsetClassDebugInfo')) {
|
|
71
|
+
removedNodes.push(innerExpression);
|
|
72
|
+
return undefined;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return ts.visitEachChild(node, visitNode, context);
|
|
76
|
+
};
|
|
77
|
+
return (sourceFile) => {
|
|
78
|
+
let updatedSourceFile = ts.visitEachChild(sourceFile, visitNode, context);
|
|
79
|
+
if (removedNodes.length > 0) {
|
|
80
|
+
// Remove any unused imports
|
|
81
|
+
const importRemovals = (0, elide_imports_1.elideImports)(updatedSourceFile, removedNodes, getTypeChecker, context.getCompilerOptions());
|
|
82
|
+
if (importRemovals.size > 0) {
|
|
83
|
+
updatedSourceFile = ts.visitEachChild(updatedSourceFile, function visitForRemoval(node) {
|
|
84
|
+
return importRemovals.has(node)
|
|
85
|
+
? undefined
|
|
86
|
+
: ts.visitEachChild(node, visitForRemoval, context);
|
|
87
|
+
}, context);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
return updatedSourceFile;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
// Each Ivy private call expression is inside an IIFE
|
|
95
|
+
function getIifeExpression(exprStmt) {
|
|
96
|
+
const expression = exprStmt.expression;
|
|
97
|
+
if (!expression || !ts.isCallExpression(expression) || expression.arguments.length !== 0) {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
const parenExpr = expression;
|
|
101
|
+
if (!ts.isParenthesizedExpression(parenExpr.expression)) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
const funExpr = parenExpr.expression.expression;
|
|
105
|
+
if (!ts.isFunctionExpression(funExpr) && !ts.isArrowFunction(funExpr)) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
if (!ts.isBlock(funExpr.body)) {
|
|
109
|
+
return funExpr.body;
|
|
110
|
+
}
|
|
111
|
+
const innerStmts = funExpr.body.statements;
|
|
112
|
+
if (innerStmts.length !== 1) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
const innerExprStmt = innerStmts[0];
|
|
116
|
+
if (!ts.isExpressionStatement(innerExprStmt)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
return innerExprStmt.expression;
|
|
120
|
+
}
|
|
121
|
+
function isIvyPrivateCallExpression(expression, name) {
|
|
122
|
+
// Now we're in the IIFE and have the inner expression statement. We can check if it matches
|
|
123
|
+
// a private Ivy call.
|
|
124
|
+
if (!ts.isCallExpression(expression)) {
|
|
125
|
+
return false;
|
|
126
|
+
}
|
|
127
|
+
const propAccExpr = expression.expression;
|
|
128
|
+
if (!ts.isPropertyAccessExpression(propAccExpr)) {
|
|
129
|
+
return false;
|
|
130
|
+
}
|
|
131
|
+
if (propAccExpr.name.text !== name) {
|
|
132
|
+
return false;
|
|
133
|
+
}
|
|
134
|
+
return true;
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=remove-ivy-jit-support-calls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-ivy-jit-support-calls.js","sourceRoot":"","sources":["remove-ivy-jit-support-calls.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKH,4DA6EC;AAhFD,+CAAiC;AACjC,mDAA+C;AAE/C,SAAgB,wBAAwB,CACtC,aAAsB,EACtB,aAAsB,EACtB,SAAkB,EAClB,cAAoC;IAEpC,OAAO,CAAC,OAAiC,EAAE,EAAE;QAC3C,MAAM,YAAY,GAAc,EAAE,CAAC;QAEnC,MAAM,SAAS,GAAe,CAAC,IAAa,EAAE,EAAE;YAC9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C;IACd,CAAC;IAED,IAAI,CAAC,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QAC9B,OAAO,OAAO,CAAC,IAAI,CAAC;IACtB,CAAC;IAED,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,UAAU,CAAC;IAC3C,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,aAAa,GAAG,UAAU,CAAC,CAAC,CAAC,CAAC;IACpC,IAAI,CAAC,EAAE,CAAC,qBAAqB,CAAC,aAAa,CAAC,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,aAAa,CAAC,UAAU,CAAC;AAClC,CAAC;AAED,SAAS,0BAA0B,CAAC,UAAyB,EAAE,IAAY;IACzE,4FAA4F;IAC5F,sBAAsB;IACtB,IAAI,CAAC,EAAE,CAAC,gBAAgB,CAAC,UAAU,CAAC,EAAE,CAAC;QACrC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,MAAM,WAAW,GAAG,UAAU,CAAC,UAAU,CAAC;IAC1C,IAAI,CAAC,EAAE,CAAC,0BAA0B,CAAC,WAAW,CAAC,EAAE,CAAC;QAChD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;QACnC,OAAO,KAAK,CAAC;IACf,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import * as ts from 'typescript';
|
|
9
|
+
export declare const NG_COMPONENT_RESOURCE_QUERY = "ngResource";
|
|
10
|
+
export declare function replaceResources(shouldTransform: (fileName: string) => boolean, getTypeChecker: () => ts.TypeChecker, inlineStyleFileExtension?: string): ts.TransformerFactory<ts.SourceFile>;
|
|
11
|
+
export declare function getResourceUrl(node: ts.Node): string | null;
|
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @license
|
|
4
|
+
* Copyright Google LLC All Rights Reserved.
|
|
5
|
+
*
|
|
6
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
7
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
8
|
+
*/
|
|
9
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
12
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
13
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
14
|
+
}
|
|
15
|
+
Object.defineProperty(o, k2, desc);
|
|
16
|
+
}) : (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
o[k2] = m[k];
|
|
19
|
+
}));
|
|
20
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
21
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
22
|
+
}) : function(o, v) {
|
|
23
|
+
o["default"] = v;
|
|
24
|
+
});
|
|
25
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
26
|
+
var ownKeys = function(o) {
|
|
27
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
28
|
+
var ar = [];
|
|
29
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
30
|
+
return ar;
|
|
31
|
+
};
|
|
32
|
+
return ownKeys(o);
|
|
33
|
+
};
|
|
34
|
+
return function (mod) {
|
|
35
|
+
if (mod && mod.__esModule) return mod;
|
|
36
|
+
var result = {};
|
|
37
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
38
|
+
__setModuleDefault(result, mod);
|
|
39
|
+
return result;
|
|
40
|
+
};
|
|
41
|
+
})();
|
|
42
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
43
|
+
exports.NG_COMPONENT_RESOURCE_QUERY = void 0;
|
|
44
|
+
exports.replaceResources = replaceResources;
|
|
45
|
+
exports.getResourceUrl = getResourceUrl;
|
|
46
|
+
const ts = __importStar(require("typescript"));
|
|
47
|
+
const inline_resource_1 = require("../loaders/inline-resource");
|
|
48
|
+
exports.NG_COMPONENT_RESOURCE_QUERY = 'ngResource';
|
|
49
|
+
function replaceResources(shouldTransform, getTypeChecker, inlineStyleFileExtension) {
|
|
50
|
+
return (context) => {
|
|
51
|
+
const typeChecker = getTypeChecker();
|
|
52
|
+
const resourceImportDeclarations = [];
|
|
53
|
+
const moduleKind = context.getCompilerOptions().module;
|
|
54
|
+
const nodeFactory = context.factory;
|
|
55
|
+
const visitNode = (node) => {
|
|
56
|
+
if (ts.isClassDeclaration(node)) {
|
|
57
|
+
const decorators = ts.getDecorators(node);
|
|
58
|
+
if (!decorators || decorators.length === 0) {
|
|
59
|
+
return node;
|
|
60
|
+
}
|
|
61
|
+
return nodeFactory.updateClassDeclaration(node, [
|
|
62
|
+
...decorators.map((current) => visitDecorator(nodeFactory, current, typeChecker, resourceImportDeclarations, moduleKind, inlineStyleFileExtension)),
|
|
63
|
+
...(ts.getModifiers(node) ?? []),
|
|
64
|
+
], node.name, node.typeParameters, node.heritageClauses, node.members);
|
|
65
|
+
}
|
|
66
|
+
return ts.visitEachChild(node, visitNode, context);
|
|
67
|
+
};
|
|
68
|
+
return (sourceFile) => {
|
|
69
|
+
if (!shouldTransform(sourceFile.fileName)) {
|
|
70
|
+
return sourceFile;
|
|
71
|
+
}
|
|
72
|
+
const updatedSourceFile = ts.visitNode(sourceFile, visitNode);
|
|
73
|
+
if (resourceImportDeclarations.length) {
|
|
74
|
+
// Add resource imports
|
|
75
|
+
return context.factory.updateSourceFile(updatedSourceFile, ts.setTextRange(context.factory.createNodeArray([
|
|
76
|
+
...resourceImportDeclarations,
|
|
77
|
+
...updatedSourceFile.statements,
|
|
78
|
+
]), updatedSourceFile.statements));
|
|
79
|
+
}
|
|
80
|
+
return updatedSourceFile;
|
|
81
|
+
};
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function visitDecorator(nodeFactory, node, typeChecker, resourceImportDeclarations, moduleKind, inlineStyleFileExtension) {
|
|
85
|
+
if (!isComponentDecorator(node, typeChecker)) {
|
|
86
|
+
return node;
|
|
87
|
+
}
|
|
88
|
+
if (!ts.isCallExpression(node.expression)) {
|
|
89
|
+
return node;
|
|
90
|
+
}
|
|
91
|
+
const decoratorFactory = node.expression;
|
|
92
|
+
const args = decoratorFactory.arguments;
|
|
93
|
+
if (args.length !== 1 || !ts.isObjectLiteralExpression(args[0])) {
|
|
94
|
+
// Unsupported component metadata
|
|
95
|
+
return node;
|
|
96
|
+
}
|
|
97
|
+
const objectExpression = args[0];
|
|
98
|
+
const styleReplacements = [];
|
|
99
|
+
// visit all properties
|
|
100
|
+
let properties = ts.visitNodes(objectExpression.properties, (node) => ts.isObjectLiteralElementLike(node)
|
|
101
|
+
? visitComponentMetadata(nodeFactory, node, styleReplacements, resourceImportDeclarations, moduleKind, inlineStyleFileExtension)
|
|
102
|
+
: node);
|
|
103
|
+
// replace properties with updated properties
|
|
104
|
+
if (styleReplacements.length > 0) {
|
|
105
|
+
const styleProperty = nodeFactory.createPropertyAssignment(nodeFactory.createIdentifier('styles'), nodeFactory.createArrayLiteralExpression(styleReplacements));
|
|
106
|
+
properties = nodeFactory.createNodeArray([...properties, styleProperty]);
|
|
107
|
+
}
|
|
108
|
+
return nodeFactory.updateDecorator(node, nodeFactory.updateCallExpression(decoratorFactory, decoratorFactory.expression, decoratorFactory.typeArguments, [nodeFactory.updateObjectLiteralExpression(objectExpression, properties)]));
|
|
109
|
+
}
|
|
110
|
+
function visitComponentMetadata(nodeFactory, node, styleReplacements, resourceImportDeclarations, moduleKind = ts.ModuleKind.ES2015, inlineStyleFileExtension) {
|
|
111
|
+
if (!ts.isPropertyAssignment(node) || ts.isComputedPropertyName(node.name)) {
|
|
112
|
+
return node;
|
|
113
|
+
}
|
|
114
|
+
const name = node.name.text;
|
|
115
|
+
switch (name) {
|
|
116
|
+
case 'moduleId':
|
|
117
|
+
return undefined;
|
|
118
|
+
case 'templateUrl': {
|
|
119
|
+
const url = getResourceUrl(node.initializer);
|
|
120
|
+
if (!url) {
|
|
121
|
+
return node;
|
|
122
|
+
}
|
|
123
|
+
const importName = createResourceImport(nodeFactory, url, resourceImportDeclarations, moduleKind);
|
|
124
|
+
if (!importName) {
|
|
125
|
+
return node;
|
|
126
|
+
}
|
|
127
|
+
return nodeFactory.updatePropertyAssignment(node, nodeFactory.createIdentifier('template'), importName);
|
|
128
|
+
}
|
|
129
|
+
case 'styles':
|
|
130
|
+
case 'styleUrl':
|
|
131
|
+
case 'styleUrls': {
|
|
132
|
+
const isInlineStyle = name === 'styles';
|
|
133
|
+
let styles;
|
|
134
|
+
if (ts.isStringLiteralLike(node.initializer)) {
|
|
135
|
+
styles = [
|
|
136
|
+
transformInlineStyleLiteral(node.initializer, nodeFactory, isInlineStyle, inlineStyleFileExtension, resourceImportDeclarations, moduleKind),
|
|
137
|
+
];
|
|
138
|
+
}
|
|
139
|
+
else if (ts.isArrayLiteralExpression(node.initializer)) {
|
|
140
|
+
styles = ts.visitNodes(node.initializer.elements, (node) => transformInlineStyleLiteral(node, nodeFactory, isInlineStyle, inlineStyleFileExtension, resourceImportDeclarations, moduleKind));
|
|
141
|
+
}
|
|
142
|
+
else {
|
|
143
|
+
return node;
|
|
144
|
+
}
|
|
145
|
+
// Styles should be placed first
|
|
146
|
+
if (isInlineStyle) {
|
|
147
|
+
styleReplacements.unshift(...styles);
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
styleReplacements.push(...styles);
|
|
151
|
+
}
|
|
152
|
+
return undefined;
|
|
153
|
+
}
|
|
154
|
+
default:
|
|
155
|
+
return node;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
function transformInlineStyleLiteral(node, nodeFactory, isInlineStyle, inlineStyleFileExtension, resourceImportDeclarations, moduleKind) {
|
|
159
|
+
if (!ts.isStringLiteralLike(node)) {
|
|
160
|
+
return node;
|
|
161
|
+
}
|
|
162
|
+
// Don't transform empty strings as PostCSS will choke on them. No work to do anyways.
|
|
163
|
+
if (node.text === '') {
|
|
164
|
+
return node;
|
|
165
|
+
}
|
|
166
|
+
if (!isInlineStyle) {
|
|
167
|
+
const url = getResourceUrl(node);
|
|
168
|
+
return url
|
|
169
|
+
? createResourceImport(nodeFactory, url, resourceImportDeclarations, moduleKind)
|
|
170
|
+
: node;
|
|
171
|
+
}
|
|
172
|
+
if (!inlineStyleFileExtension) {
|
|
173
|
+
return nodeFactory.createStringLiteral(node.text);
|
|
174
|
+
}
|
|
175
|
+
const data = Buffer.from(node.text).toString('base64');
|
|
176
|
+
const containingFile = node.getSourceFile().fileName;
|
|
177
|
+
// app.component.ts.css?ngResource!=!@ngtools/webpack/src/loaders/inline-resource.js?data=...!app.component.ts
|
|
178
|
+
const url = `${containingFile}.${inlineStyleFileExtension}?${exports.NG_COMPONENT_RESOURCE_QUERY}` +
|
|
179
|
+
`!=!${inline_resource_1.InlineAngularResourceLoaderPath}?data=${encodeURIComponent(data)}!${containingFile}`;
|
|
180
|
+
return createResourceImport(nodeFactory, url, resourceImportDeclarations, moduleKind);
|
|
181
|
+
}
|
|
182
|
+
function getResourceUrl(node) {
|
|
183
|
+
// only analyze strings
|
|
184
|
+
if (!ts.isStringLiteralLike(node)) {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
return `${/^\.?\.\//.test(node.text) ? '' : './'}${node.text}?${exports.NG_COMPONENT_RESOURCE_QUERY}`;
|
|
188
|
+
}
|
|
189
|
+
function isComponentDecorator(node, typeChecker) {
|
|
190
|
+
if (!ts.isDecorator(node)) {
|
|
191
|
+
return false;
|
|
192
|
+
}
|
|
193
|
+
const origin = getDecoratorOrigin(node, typeChecker);
|
|
194
|
+
if (origin && origin.module === '@angular/core' && origin.name === 'Component') {
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
return false;
|
|
198
|
+
}
|
|
199
|
+
function createResourceImport(nodeFactory, url, resourceImportDeclarations, moduleKind) {
|
|
200
|
+
const urlLiteral = nodeFactory.createStringLiteral(url);
|
|
201
|
+
if (moduleKind < ts.ModuleKind.ES2015) {
|
|
202
|
+
return nodeFactory.createCallExpression(nodeFactory.createIdentifier('require'), [], [urlLiteral]);
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
const importName = nodeFactory.createIdentifier(`__NG_CLI_RESOURCE__${resourceImportDeclarations.length}`);
|
|
206
|
+
resourceImportDeclarations.push(nodeFactory.createImportDeclaration(undefined, nodeFactory.createImportClause(undefined, importName, undefined), urlLiteral));
|
|
207
|
+
return importName;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function getDecoratorOrigin(decorator, typeChecker) {
|
|
211
|
+
if (!ts.isCallExpression(decorator.expression)) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
let identifier;
|
|
215
|
+
let name = '';
|
|
216
|
+
if (ts.isPropertyAccessExpression(decorator.expression.expression)) {
|
|
217
|
+
identifier = decorator.expression.expression.expression;
|
|
218
|
+
name = decorator.expression.expression.name.text;
|
|
219
|
+
}
|
|
220
|
+
else if (ts.isIdentifier(decorator.expression.expression)) {
|
|
221
|
+
identifier = decorator.expression.expression;
|
|
222
|
+
}
|
|
223
|
+
else {
|
|
224
|
+
return null;
|
|
225
|
+
}
|
|
226
|
+
// NOTE: resolver.getReferencedImportDeclaration would work as well but is internal
|
|
227
|
+
const symbol = typeChecker.getSymbolAtLocation(identifier);
|
|
228
|
+
if (symbol && symbol.declarations && symbol.declarations.length > 0) {
|
|
229
|
+
const declaration = symbol.declarations[0];
|
|
230
|
+
let module;
|
|
231
|
+
if (ts.isImportSpecifier(declaration)) {
|
|
232
|
+
name = (declaration.propertyName || declaration.name).text;
|
|
233
|
+
module = declaration.parent.parent.parent.moduleSpecifier.text;
|
|
234
|
+
}
|
|
235
|
+
else if (ts.isNamespaceImport(declaration)) {
|
|
236
|
+
// Use the name from the decorator namespace property access
|
|
237
|
+
module = declaration.parent.parent.moduleSpecifier.text;
|
|
238
|
+
}
|
|
239
|
+
else if (ts.isImportClause(declaration)) {
|
|
240
|
+
name = declaration.name.text;
|
|
241
|
+
module = declaration.parent.moduleSpecifier.text;
|
|
242
|
+
}
|
|
243
|
+
else {
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
return { name, module };
|
|
247
|
+
}
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
//# sourceMappingURL=replace_resources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"replace_resources.js","sourceRoot":"","sources":["replace_resources.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOH,4CAmEC;AA4LD,wCAOC;AA3QD,+CAAiC;AACjC,gEAA6E;AAEhE,QAAA,2BAA2B,GAAG,YAAY,CAAC;AAExD,SAAgB,gBAAgB,CAC9B,eAA8C,EAC9C,cAAoC,EACpC,wBAAiC;IAEjC,OAAO,CAAC,OAAiC,EAAE,EAAE;QAC3C,MAAM,WAAW,GAAG,cAAc,EAAE,CAAC;QACrC,MAAM,0BAA0B,GAA2B,EAAE,CAAC;QAC9D,MAAM,UAAU,GAAG,OAAO,CAAC,kBAAkB,EAAE,CAAC,MAAM,CAAC;QACvD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;QAEpC,MAAM,SAAS,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,CAAC,MAAM,CAAC,MAAM,CAAC,eAAiC,CAAC,IAAI,CAAC;QAC7E,CAAC;aAAM,IAAI,EAAE,CAAC,cAAc,CAAC,WAAW,CAAC,EAAE,CAAC;YAC1C,IAAI,GAAI,WAAW,CAAC,IAAsB,CAAC,IAAI,CAAC;YAChD,MAAM,GAAI,WAAW,CAAC,MAAM,CAAC,eAAiC,CAAC,IAAI,CAAC;QACtE,CAAC;aAAM,CAAC;YACN,OAAO,IAAI,CAAC;QACd,CAAC;QAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC1B,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import ts from 'typescript';
|
|
9
|
+
export declare function createTypescriptContext(content: string, additionalFiles?: Record<string, string>, useLibs?: boolean, extraCompilerOptions?: ts.CompilerOptions, jsxFile?: boolean): {
|
|
10
|
+
compilerHost: ts.CompilerHost;
|
|
11
|
+
program: ts.Program;
|
|
12
|
+
};
|
|
13
|
+
export declare function transformTypescript(content: string | undefined, transformers: ts.TransformerFactory<ts.SourceFile>[], program?: ts.Program, compilerHost?: ts.CompilerHost): string | undefined;
|