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/packages/transformer", ["require", "exports", "typescript", "@angular/compiler-cli/src/ngtsc/reflection", "@angular/compiler-cli/ngcc/src/analysis/decoration_analyzer", "@angular/compiler-cli/ngcc/src/analysis/module_with_providers_analyzer", "@angular/compiler-cli/ngcc/src/analysis/ngcc_references_registry", "@angular/compiler-cli/ngcc/src/analysis/private_declarations_analyzer", "@angular/compiler-cli/ngcc/src/analysis/switch_marker_analyzer", "@angular/compiler-cli/ngcc/src/execution/tasks/api", "@angular/compiler-cli/ngcc/src/host/commonjs_host", "@angular/compiler-cli/ngcc/src/host/delegating_host", "@angular/compiler-cli/ngcc/src/host/esm2015_host", "@angular/compiler-cli/ngcc/src/host/esm5_host", "@angular/compiler-cli/ngcc/src/host/umd_host", "@angular/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter", "@angular/compiler-cli/ngcc/src/rendering/dts_renderer", "@angular/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter", "@angular/compiler-cli/ngcc/src/rendering/esm_rendering_formatter", "@angular/compiler-cli/ngcc/src/rendering/renderer", "@angular/compiler-cli/ngcc/src/rendering/umd_rendering_formatter"], factory);
|
---|
8 | }
|
---|
9 | })(function (require, exports) {
|
---|
10 | "use strict";
|
---|
11 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
12 | exports.hasErrors = exports.Transformer = void 0;
|
---|
13 | /**
|
---|
14 | * @license
|
---|
15 | * Copyright Google LLC All Rights Reserved.
|
---|
16 | *
|
---|
17 | * Use of this source code is governed by an MIT-style license that can be
|
---|
18 | * found in the LICENSE file at https://angular.io/license
|
---|
19 | */
|
---|
20 | var ts = require("typescript");
|
---|
21 | var reflection_1 = require("@angular/compiler-cli/src/ngtsc/reflection");
|
---|
22 | var decoration_analyzer_1 = require("@angular/compiler-cli/ngcc/src/analysis/decoration_analyzer");
|
---|
23 | var module_with_providers_analyzer_1 = require("@angular/compiler-cli/ngcc/src/analysis/module_with_providers_analyzer");
|
---|
24 | var ngcc_references_registry_1 = require("@angular/compiler-cli/ngcc/src/analysis/ngcc_references_registry");
|
---|
25 | var private_declarations_analyzer_1 = require("@angular/compiler-cli/ngcc/src/analysis/private_declarations_analyzer");
|
---|
26 | var switch_marker_analyzer_1 = require("@angular/compiler-cli/ngcc/src/analysis/switch_marker_analyzer");
|
---|
27 | var api_1 = require("@angular/compiler-cli/ngcc/src/execution/tasks/api");
|
---|
28 | var commonjs_host_1 = require("@angular/compiler-cli/ngcc/src/host/commonjs_host");
|
---|
29 | var delegating_host_1 = require("@angular/compiler-cli/ngcc/src/host/delegating_host");
|
---|
30 | var esm2015_host_1 = require("@angular/compiler-cli/ngcc/src/host/esm2015_host");
|
---|
31 | var esm5_host_1 = require("@angular/compiler-cli/ngcc/src/host/esm5_host");
|
---|
32 | var umd_host_1 = require("@angular/compiler-cli/ngcc/src/host/umd_host");
|
---|
33 | var commonjs_rendering_formatter_1 = require("@angular/compiler-cli/ngcc/src/rendering/commonjs_rendering_formatter");
|
---|
34 | var dts_renderer_1 = require("@angular/compiler-cli/ngcc/src/rendering/dts_renderer");
|
---|
35 | var esm5_rendering_formatter_1 = require("@angular/compiler-cli/ngcc/src/rendering/esm5_rendering_formatter");
|
---|
36 | var esm_rendering_formatter_1 = require("@angular/compiler-cli/ngcc/src/rendering/esm_rendering_formatter");
|
---|
37 | var renderer_1 = require("@angular/compiler-cli/ngcc/src/rendering/renderer");
|
---|
38 | var umd_rendering_formatter_1 = require("@angular/compiler-cli/ngcc/src/rendering/umd_rendering_formatter");
|
---|
39 | /**
|
---|
40 | * A Package is stored in a directory on disk and that directory can contain one or more package
|
---|
41 | * formats - e.g. fesm2015, UMD, etc. Additionally, each package provides typings (`.d.ts` files).
|
---|
42 | *
|
---|
43 | * Each of these formats exposes one or more entry points, which are source files that need to be
|
---|
44 | * parsed to identify the decorated exported classes that need to be analyzed and compiled by one or
|
---|
45 | * more `DecoratorHandler` objects.
|
---|
46 | *
|
---|
47 | * Each entry point to a package is identified by a `package.json` which contains properties that
|
---|
48 | * indicate what formatted bundles are accessible via this end-point.
|
---|
49 | *
|
---|
50 | * Each bundle is identified by a root `SourceFile` that can be parsed and analyzed to
|
---|
51 | * identify classes that need to be transformed; and then finally rendered and written to disk.
|
---|
52 | *
|
---|
53 | * Along with the source files, the corresponding source maps (either inline or external) and
|
---|
54 | * `.d.ts` files are transformed accordingly.
|
---|
55 | *
|
---|
56 | * - Flat file packages have all the classes in a single file.
|
---|
57 | * - Other packages may re-export classes from other non-entry point files.
|
---|
58 | * - Some formats may contain multiple "modules" in a single file.
|
---|
59 | */
|
---|
60 | var Transformer = /** @class */ (function () {
|
---|
61 | function Transformer(fs, logger, tsConfig) {
|
---|
62 | if (tsConfig === void 0) { tsConfig = null; }
|
---|
63 | this.fs = fs;
|
---|
64 | this.logger = logger;
|
---|
65 | this.tsConfig = tsConfig;
|
---|
66 | }
|
---|
67 | /**
|
---|
68 | * Transform the source (and typings) files of a bundle.
|
---|
69 | * @param bundle the bundle to transform.
|
---|
70 | * @returns information about the files that were transformed.
|
---|
71 | */
|
---|
72 | Transformer.prototype.transform = function (bundle) {
|
---|
73 | var ngccReflectionHost = this.getHost(bundle);
|
---|
74 | var tsReflectionHost = new reflection_1.TypeScriptReflectionHost(bundle.src.program.getTypeChecker());
|
---|
75 | var reflectionHost = new delegating_host_1.DelegatingReflectionHost(tsReflectionHost, ngccReflectionHost);
|
---|
76 | // Parse and analyze the files.
|
---|
77 | var _a = this.analyzeProgram(reflectionHost, bundle), decorationAnalyses = _a.decorationAnalyses, switchMarkerAnalyses = _a.switchMarkerAnalyses, privateDeclarationsAnalyses = _a.privateDeclarationsAnalyses, moduleWithProvidersAnalyses = _a.moduleWithProvidersAnalyses, diagnostics = _a.diagnostics;
|
---|
78 | // Bail if the analysis produced any errors.
|
---|
79 | if (hasErrors(diagnostics)) {
|
---|
80 | return { success: false, diagnostics: diagnostics };
|
---|
81 | }
|
---|
82 | // Transform the source files and source maps.
|
---|
83 | var renderedFiles = [];
|
---|
84 | if (bundle.dtsProcessing !== api_1.DtsProcessing.Only) {
|
---|
85 | // Render the transformed JavaScript files only if we are not doing "typings-only" processing.
|
---|
86 | var srcFormatter = this.getRenderingFormatter(ngccReflectionHost, bundle);
|
---|
87 | var renderer = new renderer_1.Renderer(reflectionHost, srcFormatter, this.fs, this.logger, bundle, this.tsConfig);
|
---|
88 | renderedFiles = renderer.renderProgram(decorationAnalyses, switchMarkerAnalyses, privateDeclarationsAnalyses);
|
---|
89 | }
|
---|
90 | if (bundle.dts) {
|
---|
91 | var dtsFormatter = new esm_rendering_formatter_1.EsmRenderingFormatter(this.fs, reflectionHost, bundle.isCore);
|
---|
92 | var dtsRenderer = new dts_renderer_1.DtsRenderer(dtsFormatter, this.fs, this.logger, reflectionHost, bundle);
|
---|
93 | var renderedDtsFiles = dtsRenderer.renderProgram(decorationAnalyses, privateDeclarationsAnalyses, moduleWithProvidersAnalyses);
|
---|
94 | renderedFiles = renderedFiles.concat(renderedDtsFiles);
|
---|
95 | }
|
---|
96 | return { success: true, diagnostics: diagnostics, transformedFiles: renderedFiles };
|
---|
97 | };
|
---|
98 | Transformer.prototype.getHost = function (bundle) {
|
---|
99 | switch (bundle.format) {
|
---|
100 | case 'esm2015':
|
---|
101 | return new esm2015_host_1.Esm2015ReflectionHost(this.logger, bundle.isCore, bundle.src, bundle.dts);
|
---|
102 | case 'esm5':
|
---|
103 | return new esm5_host_1.Esm5ReflectionHost(this.logger, bundle.isCore, bundle.src, bundle.dts);
|
---|
104 | case 'umd':
|
---|
105 | return new umd_host_1.UmdReflectionHost(this.logger, bundle.isCore, bundle.src, bundle.dts);
|
---|
106 | case 'commonjs':
|
---|
107 | return new commonjs_host_1.CommonJsReflectionHost(this.logger, bundle.isCore, bundle.src, bundle.dts);
|
---|
108 | default:
|
---|
109 | throw new Error("Reflection host for \"" + bundle.format + "\" not yet implemented.");
|
---|
110 | }
|
---|
111 | };
|
---|
112 | Transformer.prototype.getRenderingFormatter = function (host, bundle) {
|
---|
113 | switch (bundle.format) {
|
---|
114 | case 'esm2015':
|
---|
115 | return new esm_rendering_formatter_1.EsmRenderingFormatter(this.fs, host, bundle.isCore);
|
---|
116 | case 'esm5':
|
---|
117 | return new esm5_rendering_formatter_1.Esm5RenderingFormatter(this.fs, host, bundle.isCore);
|
---|
118 | case 'umd':
|
---|
119 | if (!(host instanceof umd_host_1.UmdReflectionHost)) {
|
---|
120 | throw new Error('UmdRenderer requires a UmdReflectionHost');
|
---|
121 | }
|
---|
122 | return new umd_rendering_formatter_1.UmdRenderingFormatter(this.fs, host, bundle.isCore);
|
---|
123 | case 'commonjs':
|
---|
124 | return new commonjs_rendering_formatter_1.CommonJsRenderingFormatter(this.fs, host, bundle.isCore);
|
---|
125 | default:
|
---|
126 | throw new Error("Renderer for \"" + bundle.format + "\" not yet implemented.");
|
---|
127 | }
|
---|
128 | };
|
---|
129 | Transformer.prototype.analyzeProgram = function (reflectionHost, bundle) {
|
---|
130 | var referencesRegistry = new ngcc_references_registry_1.NgccReferencesRegistry(reflectionHost);
|
---|
131 | var switchMarkerAnalyzer = new switch_marker_analyzer_1.SwitchMarkerAnalyzer(reflectionHost, bundle.entryPoint.packagePath);
|
---|
132 | var switchMarkerAnalyses = switchMarkerAnalyzer.analyzeProgram(bundle.src.program);
|
---|
133 | var diagnostics = [];
|
---|
134 | var decorationAnalyzer = new decoration_analyzer_1.DecorationAnalyzer(this.fs, bundle, reflectionHost, referencesRegistry, function (diagnostic) { return diagnostics.push(diagnostic); }, this.tsConfig);
|
---|
135 | var decorationAnalyses = decorationAnalyzer.analyzeProgram();
|
---|
136 | var moduleWithProvidersAnalyzer = new module_with_providers_analyzer_1.ModuleWithProvidersAnalyzer(reflectionHost, bundle.src.program.getTypeChecker(), referencesRegistry, bundle.dts !== null);
|
---|
137 | var moduleWithProvidersAnalyses = moduleWithProvidersAnalyzer &&
|
---|
138 | moduleWithProvidersAnalyzer.analyzeProgram(bundle.src.program);
|
---|
139 | var privateDeclarationsAnalyzer = new private_declarations_analyzer_1.PrivateDeclarationsAnalyzer(reflectionHost, referencesRegistry);
|
---|
140 | var privateDeclarationsAnalyses = privateDeclarationsAnalyzer.analyzeProgram(bundle.src.program);
|
---|
141 | return {
|
---|
142 | decorationAnalyses: decorationAnalyses,
|
---|
143 | switchMarkerAnalyses: switchMarkerAnalyses,
|
---|
144 | privateDeclarationsAnalyses: privateDeclarationsAnalyses,
|
---|
145 | moduleWithProvidersAnalyses: moduleWithProvidersAnalyses,
|
---|
146 | diagnostics: diagnostics
|
---|
147 | };
|
---|
148 | };
|
---|
149 | return Transformer;
|
---|
150 | }());
|
---|
151 | exports.Transformer = Transformer;
|
---|
152 | function hasErrors(diagnostics) {
|
---|
153 | return diagnostics.some(function (d) { return d.category === ts.DiagnosticCategory.Error; });
|
---|
154 | }
|
---|
155 | exports.hasErrors = hasErrors;
|
---|
156 | });
|
---|
157 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHJhbnNmb3JtZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci1jbGkvbmdjYy9zcmMvcGFja2FnZXMvdHJhbnNmb3JtZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7O0lBQUE7Ozs7OztPQU1HO0lBQ0gsK0JBQWlDO0lBS2pDLHlFQUF1RTtJQUN2RSxtR0FBbUU7SUFDbkUseUhBQW9IO0lBQ3BILDZHQUE0RTtJQUM1RSx1SEFBa0c7SUFDbEcseUdBQThGO0lBRTlGLDBFQUFxRDtJQUNyRCxtRkFBNkQ7SUFDN0QsdUZBQWlFO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