1 | (function (factory) {
|
---|
2 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
3 | var v = factory(require, exports);
|
---|
4 | if (v !== undefined) module.exports = v;
|
---|
5 | }
|
---|
6 | else if (typeof define === "function" && define.amd) {
|
---|
7 | define("@angular/compiler-cli/ngcc/src/dependencies/commonjs_dependency_host", ["require", "exports", "tslib", "typescript", "@angular/compiler-cli/ngcc/src/host/commonjs_umd_utils", "@angular/compiler-cli/ngcc/src/dependencies/dependency_host"], factory);
|
---|
8 | }
|
---|
9 | })(function (require, exports) {
|
---|
10 | "use strict";
|
---|
11 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
12 | exports.hasRequireCalls = exports.CommonJsDependencyHost = void 0;
|
---|
13 | var tslib_1 = require("tslib");
|
---|
14 | /**
|
---|
15 | * @license
|
---|
16 | * Copyright Google LLC All Rights Reserved.
|
---|
17 | *
|
---|
18 | * Use of this source code is governed by an MIT-style license that can be
|
---|
19 | * found in the LICENSE file at https://angular.io/license
|
---|
20 | */
|
---|
21 | var ts = require("typescript");
|
---|
22 | var commonjs_umd_utils_1 = require("@angular/compiler-cli/ngcc/src/host/commonjs_umd_utils");
|
---|
23 | var dependency_host_1 = require("@angular/compiler-cli/ngcc/src/dependencies/dependency_host");
|
---|
24 | /**
|
---|
25 | * Helper functions for computing dependencies.
|
---|
26 | */
|
---|
27 | var CommonJsDependencyHost = /** @class */ (function (_super) {
|
---|
28 | tslib_1.__extends(CommonJsDependencyHost, _super);
|
---|
29 | function CommonJsDependencyHost() {
|
---|
30 | return _super !== null && _super.apply(this, arguments) || this;
|
---|
31 | }
|
---|
32 | CommonJsDependencyHost.prototype.canSkipFile = function (fileContents) {
|
---|
33 | return !hasRequireCalls(fileContents);
|
---|
34 | };
|
---|
35 | CommonJsDependencyHost.prototype.extractImports = function (file, fileContents) {
|
---|
36 | var e_1, _a, e_2, _b;
|
---|
37 | // Parse the source into a TypeScript AST and then walk it looking for imports and re-exports.
|
---|
38 | var sf = ts.createSourceFile(file, fileContents, ts.ScriptTarget.ES2015, false, ts.ScriptKind.JS);
|
---|
39 | var requireCalls = [];
|
---|
40 | try {
|
---|
41 | for (var _c = tslib_1.__values(sf.statements), _d = _c.next(); !_d.done; _d = _c.next()) {
|
---|
42 | var stmt = _d.value;
|
---|
43 | if (ts.isVariableStatement(stmt)) {
|
---|
44 | // Regular import(s):
|
---|
45 | // `var foo = require('...')` or `var foo = require('...'), bar = require('...')`
|
---|
46 | var declarations = stmt.declarationList.declarations;
|
---|
47 | try {
|
---|
48 | for (var declarations_1 = (e_2 = void 0, tslib_1.__values(declarations)), declarations_1_1 = declarations_1.next(); !declarations_1_1.done; declarations_1_1 = declarations_1.next()) {
|
---|
49 | var declaration = declarations_1_1.value;
|
---|
50 | if ((declaration.initializer !== undefined) && commonjs_umd_utils_1.isRequireCall(declaration.initializer)) {
|
---|
51 | requireCalls.push(declaration.initializer);
|
---|
52 | }
|
---|
53 | }
|
---|
54 | }
|
---|
55 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
---|
56 | finally {
|
---|
57 | try {
|
---|
58 | if (declarations_1_1 && !declarations_1_1.done && (_b = declarations_1.return)) _b.call(declarations_1);
|
---|
59 | }
|
---|
60 | finally { if (e_2) throw e_2.error; }
|
---|
61 | }
|
---|
62 | }
|
---|
63 | else if (ts.isExpressionStatement(stmt)) {
|
---|
64 | if (commonjs_umd_utils_1.isRequireCall(stmt.expression)) {
|
---|
65 | // Import for the side-effects only:
|
---|
66 | // `require('...')`
|
---|
67 | requireCalls.push(stmt.expression);
|
---|
68 | }
|
---|
69 | else if (commonjs_umd_utils_1.isWildcardReexportStatement(stmt)) {
|
---|
70 | // Re-export in one of the following formats:
|
---|
71 | // - `__export(require('...'))`
|
---|
72 | // - `__export(<identifier>)`
|
---|
73 | // - `tslib_1.__exportStar(require('...'), exports)`
|
---|
74 | // - `tslib_1.__exportStar(<identifier>, exports)`
|
---|
75 | var firstExportArg = stmt.expression.arguments[0];
|
---|
76 | if (commonjs_umd_utils_1.isRequireCall(firstExportArg)) {
|
---|
77 | // Re-export with `require()` call:
|
---|
78 | // `__export(require('...'))` or `tslib_1.__exportStar(require('...'), exports)`
|
---|
79 | requireCalls.push(firstExportArg);
|
---|
80 | }
|
---|
81 | }
|
---|
82 | else if (ts.isBinaryExpression(stmt.expression) &&
|
---|
83 | (stmt.expression.operatorToken.kind === ts.SyntaxKind.EqualsToken)) {
|
---|
84 | if (commonjs_umd_utils_1.isRequireCall(stmt.expression.right)) {
|
---|
85 | // Import with assignment. E.g.:
|
---|
86 | // `exports.foo = require('...')`
|
---|
87 | requireCalls.push(stmt.expression.right);
|
---|
88 | }
|
---|
89 | else if (ts.isObjectLiteralExpression(stmt.expression.right)) {
|
---|
90 | // Import in object literal. E.g.:
|
---|
91 | // `module.exports = {foo: require('...')}`
|
---|
92 | stmt.expression.right.properties.forEach(function (prop) {
|
---|
93 | if (ts.isPropertyAssignment(prop) && commonjs_umd_utils_1.isRequireCall(prop.initializer)) {
|
---|
94 | requireCalls.push(prop.initializer);
|
---|
95 | }
|
---|
96 | });
|
---|
97 | }
|
---|
98 | }
|
---|
99 | }
|
---|
100 | }
|
---|
101 | }
|
---|
102 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
---|
103 | finally {
|
---|
104 | try {
|
---|
105 | if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
|
---|
106 | }
|
---|
107 | finally { if (e_1) throw e_1.error; }
|
---|
108 | }
|
---|
109 | return new Set(requireCalls.map(function (call) { return call.arguments[0].text; }));
|
---|
110 | };
|
---|
111 | return CommonJsDependencyHost;
|
---|
112 | }(dependency_host_1.DependencyHostBase));
|
---|
113 | exports.CommonJsDependencyHost = CommonJsDependencyHost;
|
---|
114 | /**
|
---|
115 | * Check whether a source file needs to be parsed for imports.
|
---|
116 | * This is a performance short-circuit, which saves us from creating
|
---|
117 | * a TypeScript AST unnecessarily.
|
---|
118 | *
|
---|
119 | * @param source The content of the source file to check.
|
---|
120 | *
|
---|
121 | * @returns false if there are definitely no require calls
|
---|
122 | * in this file, true otherwise.
|
---|
123 | */
|
---|
124 | function hasRequireCalls(source) {
|
---|
125 | return /require\(['"]/.test(source);
|
---|
126 | }
|
---|
127 | exports.hasRequireCalls = hasRequireCalls;
|
---|
128 | });
|
---|
129 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tbW9uanNfZGVwZW5kZW5jeV9ob3N0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXItY2xpL25nY2Mvc3JjL2RlcGVuZGVuY2llcy9jb21tb25qc19kZXBlbmRlbmN5X2hvc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztJQUFBOzs7Ozs7T0FNRztJQUNILCtCQUFpQztJQUdqQyw2RkFBbUc7SUFFbkcsK0ZBQXFEO0lBRXJEOztPQUVHO0lBQ0g7UUFBNEMsa0RBQWtCO1FBQTlEOztRQTZEQSxDQUFDO1FBNURvQiw0Q0FBVyxHQUE5QixVQUErQixZQUFvQjtZQUNqRCxPQUFPLENBQUMsZUFBZSxDQUFDLFlBQVksQ0FBQyxDQUFDO1FBQ3hDLENBQUM7UUFFa0IsK0NBQWMsR0FBakMsVUFBa0MsSUFBb0IsRUFBRSxZQUFvQjs7WUFDMUUsOEZBQThGO1lBQzlGLElBQU0sRUFBRSxHQUNKLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQyxJQUFJLEVBQUUsWUFBWSxFQUFFLEVBQUUsQ0FBQyxZQUFZLENBQUMsTUFBTSxFQUFFLEtBQUssRUFBRSxFQUFFLENBQUMsVUFBVSxDQUFDLEVBQUUsQ0FBQyxDQUFDO1lBQzdGLElBQU0sWUFBWSxHQUFrQixFQUFFLENBQUM7O2dCQUV2QyxLQUFtQixJQUFBLEtBQUEsaUJBQUEsRUFBRSxDQUFD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