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.io/license
|
---|
7 | */
|
---|
8 | (function (factory) {
|
---|
9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
10 | var v = factory(require, exports);
|
---|
11 | if (v !== undefined) module.exports = v;
|
---|
12 | }
|
---|
13 | else if (typeof define === "function" && define.amd) {
|
---|
14 | define("@angular/compiler-cli/src/transformers/compiler_host", ["require", "exports", "tslib", "@angular/compiler", "path", "typescript", "@angular/compiler-cli/src/ngtsc/file_system", "@angular/compiler-cli/src/transformers/metadata_reader", "@angular/compiler-cli/src/transformers/util"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.getOriginalReferences = exports.TsCompilerAotCompilerTypeCheckHostAdapter = exports.createCompilerHost = exports.setWrapHostForTest = void 0;
|
---|
20 | var tslib_1 = require("tslib");
|
---|
21 | var compiler_1 = require("@angular/compiler");
|
---|
22 | var path = require("path");
|
---|
23 | var ts = require("typescript");
|
---|
24 | var file_system_1 = require("@angular/compiler-cli/src/ngtsc/file_system");
|
---|
25 | var metadata_reader_1 = require("@angular/compiler-cli/src/transformers/metadata_reader");
|
---|
26 | var util_1 = require("@angular/compiler-cli/src/transformers/util");
|
---|
27 | var NODE_MODULES_PACKAGE_NAME = /node_modules\/((\w|-|\.)+|(@(\w|-|\.)+\/(\w|-|\.)+))/;
|
---|
28 | var EXT = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
|
---|
29 | var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
---|
30 | var wrapHostForTest = null;
|
---|
31 | function setWrapHostForTest(wrapFn) {
|
---|
32 | wrapHostForTest = wrapFn;
|
---|
33 | }
|
---|
34 | exports.setWrapHostForTest = setWrapHostForTest;
|
---|
35 | function createCompilerHost(_a) {
|
---|
36 | var options = _a.options, _b = _a.tsHost, tsHost = _b === void 0 ? ts.createCompilerHost(options, true) : _b;
|
---|
37 | if (wrapHostForTest !== null) {
|
---|
38 | tsHost = wrapHostForTest(tsHost);
|
---|
39 | }
|
---|
40 | return tsHost;
|
---|
41 | }
|
---|
42 | exports.createCompilerHost = createCompilerHost;
|
---|
43 | function assert(condition) {
|
---|
44 | if (!condition) {
|
---|
45 | // TODO(chuckjaz): do the right thing
|
---|
46 | }
|
---|
47 | return condition;
|
---|
48 | }
|
---|
49 | /**
|
---|
50 | * Implements the following hosts based on an api.CompilerHost:
|
---|
51 | * - ts.CompilerHost to be consumed by a ts.Program
|
---|
52 | * - AotCompilerHost for @angular/compiler
|
---|
53 | * - TypeCheckHost for mapping ts errors to ng errors (via translateDiagnostics)
|
---|
54 | */
|
---|
55 | var TsCompilerAotCompilerTypeCheckHostAdapter = /** @class */ (function () {
|
---|
56 | function TsCompilerAotCompilerTypeCheckHostAdapter(rootFiles, options, context, metadataProvider, codeGenerator, librarySummaries) {
|
---|
57 | var _this = this;
|
---|
58 | if (librarySummaries === void 0) { librarySummaries = new Map(); }
|
---|
59 | this.rootFiles = rootFiles;
|
---|
60 | this.options = options;
|
---|
61 | this.context = context;
|
---|
62 | this.metadataProvider = metadataProvider;
|
---|
63 | this.codeGenerator = codeGenerator;
|
---|
64 | this.librarySummaries = librarySummaries;
|
---|
65 | this.metadataReaderCache = metadata_reader_1.createMetadataReaderCache();
|
---|
66 | this.fileNameToModuleNameCache = new Map();
|
---|
67 | this.flatModuleIndexCache = new Map();
|
---|
68 | this.flatModuleIndexNames = new Set();
|
---|
69 | this.flatModuleIndexRedirectNames = new Set();
|
---|
70 | this.originalSourceFiles = new Map();
|
---|
71 | this.originalFileExistsCache = new Map();
|
---|
72 | this.generatedSourceFiles = new Map();
|
---|
73 | this.generatedCodeFor = new Map();
|
---|
74 | this.emitter = new compiler_1.TypeScriptEmitter();
|
---|
75 | this.getDefaultLibFileName = function (options) {
|
---|
76 | return _this.context.getDefaultLibFileName(options);
|
---|
77 | };
|
---|
78 | this.getCurrentDirectory = function () { return _this.context.getCurrentDirectory(); };
|
---|
79 | this.getCanonicalFileName = function (fileName) { return _this.context.getCanonicalFileName(fileName); };
|
---|
80 | this.useCaseSensitiveFileNames = function () { return _this.context.useCaseSensitiveFileNames(); };
|
---|
81 | this.getNewLine = function () { return _this.context.getNewLine(); };
|
---|
82 | // Make sure we do not `host.realpath()` from TS as we do not want to resolve symlinks.
|
---|
83 | // https://github.com/Microsoft/TypeScript/issues/9552
|
---|
84 | this.realpath = function (p) { return p; };
|
---|
85 | this.writeFile = this.context.writeFile.bind(this.context);
|
---|
86 | this.moduleResolutionCache = ts.createModuleResolutionCache(this.context.getCurrentDirectory(), this.context.getCanonicalFileName.bind(this.context));
|
---|
87 | var basePath = this.options.basePath;
|
---|
88 | this.rootDirs =
|
---|
89 | (this.options.rootDirs || [this.options.basePath]).map(function (p) { return path.resolve(basePath, p); });
|
---|
90 | if (context.getDirectories) {
|
---|
91 | this.getDirectories = function (path) { return context.getDirectories(path); };
|
---|
92 | }
|
---|
93 | if (context.directoryExists) {
|
---|
94 | this.directoryExists = function (directoryName) { return context.directoryExists(directoryName); };
|
---|
95 | }
|
---|
96 | if (context.getCancellationToken) {
|
---|
97 | this.getCancellationToken = function () { return context.getCancellationToken(); };
|
---|
98 | }
|
---|
99 | if (context.getDefaultLibLocation) {
|
---|
100 | this.getDefaultLibLocation = function () { return context.getDefaultLibLocation(); };
|
---|
101 | }
|
---|
102 | if (context.resolveTypeReferenceDirectives) {
|
---|
103 | this.resolveTypeReferenceDirectives = function (names, containingFile) {
|
---|
104 | return context.resolveTypeReferenceDirectives(names, containingFile);
|
---|
105 | };
|
---|
106 | }
|
---|
107 | if (context.trace) {
|
---|
108 | this.trace = function (s) { return context.trace(s); };
|
---|
109 | }
|
---|
110 | if (context.fileNameToModuleName) {
|
---|
111 | this.fileNameToModuleName = context.fileNameToModuleName.bind(context);
|
---|
112 | }
|
---|
113 | // Note: don't copy over context.moduleNameToFileName as we first
|
---|
114 | // normalize undefined containingFile to a filled containingFile.
|
---|
115 | if (context.resourceNameToFileName) {
|
---|
116 | this.resourceNameToFileName = context.resourceNameToFileName.bind(context);
|
---|
117 | }
|
---|
118 | if (context.toSummaryFileName) {
|
---|
119 | this.toSummaryFileName = context.toSummaryFileName.bind(context);
|
---|
120 | }
|
---|
121 | if (context.fromSummaryFileName) {
|
---|
122 | this.fromSummaryFileName = context.fromSummaryFileName.bind(context);
|
---|
123 | }
|
---|
124 | this.metadataReaderHost = {
|
---|
125 | cacheMetadata: function () { return true; },
|
---|
126 | getSourceFileMetadata: function (filePath) {
|
---|
127 | var sf = _this.getOriginalSourceFile(filePath);
|
---|
128 | return sf ? _this.metadataProvider.getMetadata(sf) : undefined;
|
---|
129 | },
|
---|
130 | fileExists: function (filePath) { return _this.originalFileExists(filePath); },
|
---|
131 | readFile: function (filePath) { return assert(_this.context.readFile(filePath)); },
|
---|
132 | };
|
---|
133 | }
|
---|
134 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.resolveModuleName = function (moduleName, containingFile) {
|
---|
135 | var rm = ts.resolveModuleName(moduleName, containingFile.replace(/\\/g, '/'), this.options, this, this.moduleResolutionCache)
|
---|
136 | .resolvedModule;
|
---|
137 | if (rm && this.isSourceFile(rm.resolvedFileName) && util_1.DTS.test(rm.resolvedFileName)) {
|
---|
138 | // Case: generateCodeForLibraries = true and moduleName is
|
---|
139 | // a .d.ts file in a node_modules folder.
|
---|
140 | // Need to set isExternalLibraryImport to false so that generated files for that file
|
---|
141 | // are emitted.
|
---|
142 | rm.isExternalLibraryImport = false;
|
---|
143 | }
|
---|
144 | return rm;
|
---|
145 | };
|
---|
146 | // Note: We implement this method so that TypeScript and Angular share the same
|
---|
147 | // ts.ModuleResolutionCache
|
---|
148 | // and that we can tell ts.Program about our different opinion about
|
---|
149 | // ResolvedModule.isExternalLibraryImport
|
---|
150 | // (see our isSourceFile method).
|
---|
151 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.resolveModuleNames = function (moduleNames, containingFile) {
|
---|
152 | var _this = this;
|
---|
153 | // TODO(tbosch): this seems to be a typing error in TypeScript,
|
---|
154 | // as it contains assertions that the result contains the same number of entries
|
---|
155 | // as the given module names.
|
---|
156 | return moduleNames.map(function (moduleName) { return _this.resolveModuleName(moduleName, containingFile); });
|
---|
157 | };
|
---|
158 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.moduleNameToFileName = function (m, containingFile) {
|
---|
159 | if (!containingFile) {
|
---|
160 | if (m.indexOf('.') === 0) {
|
---|
161 | throw new Error('Resolution of relative paths requires a containing file.');
|
---|
162 | }
|
---|
163 | // Any containing file gives the same result for absolute imports
|
---|
164 | containingFile = this.rootFiles[0];
|
---|
165 | }
|
---|
166 | if (this.context.moduleNameToFileName) {
|
---|
167 | return this.context.moduleNameToFileName(m, containingFile);
|
---|
168 | }
|
---|
169 | var resolved = this.resolveModuleName(m, containingFile);
|
---|
170 | return resolved ? resolved.resolvedFileName : null;
|
---|
171 | };
|
---|
172 | /**
|
---|
173 | * We want a moduleId that will appear in import statements in the generated code
|
---|
174 | * which will be written to `containingFile`.
|
---|
175 | *
|
---|
176 | * Note that we also generate files for files in node_modules, as libraries
|
---|
177 | * only ship .metadata.json files but not the generated code.
|
---|
178 | *
|
---|
179 | * Logic:
|
---|
180 | * 1. if the importedFile and the containingFile are from the project sources
|
---|
181 | * or from the same node_modules package, use a relative path
|
---|
182 | * 2. if the importedFile is in a node_modules package,
|
---|
183 | * use a path that starts with the package name.
|
---|
184 | * 3. Error if the containingFile is in the node_modules package
|
---|
185 | * and the importedFile is in the project soures,
|
---|
186 | * as that is a violation of the principle that node_modules packages cannot
|
---|
187 | * import project sources.
|
---|
188 | */
|
---|
189 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.fileNameToModuleName = function (importedFile, containingFile) {
|
---|
190 | var cacheKey = importedFile + ":" + containingFile;
|
---|
191 | var moduleName = this.fileNameToModuleNameCache.get(cacheKey);
|
---|
192 | if (moduleName != null) {
|
---|
193 | return moduleName;
|
---|
194 | }
|
---|
195 | var originalImportedFile = importedFile;
|
---|
196 | if (this.options.traceResolution) {
|
---|
197 | console.error('fileNameToModuleName from containingFile', containingFile, 'to importedFile', importedFile);
|
---|
198 | }
|
---|
199 | // drop extension
|
---|
200 | importedFile = importedFile.replace(EXT, '');
|
---|
201 | var importedFilePackageName = getPackageName(importedFile);
|
---|
202 | var containingFilePackageName = getPackageName(containingFile);
|
---|
203 | if (importedFilePackageName === containingFilePackageName ||
|
---|
204 | util_1.GENERATED_FILES.test(originalImportedFile)) {
|
---|
205 | var rootedContainingFile = util_1.relativeToRootDirs(containingFile, this.rootDirs);
|
---|
206 | var rootedImportedFile = util_1.relativeToRootDirs(importedFile, this.rootDirs);
|
---|
207 | if (rootedContainingFile !== containingFile && rootedImportedFile !== importedFile) {
|
---|
208 | // if both files are contained in the `rootDirs`, then strip the rootDirs
|
---|
209 | containingFile = rootedContainingFile;
|
---|
210 | importedFile = rootedImportedFile;
|
---|
211 | }
|
---|
212 | moduleName = dotRelative(path.dirname(containingFile), importedFile);
|
---|
213 | }
|
---|
214 | else if (importedFilePackageName) {
|
---|
215 | moduleName = stripNodeModulesPrefix(importedFile);
|
---|
216 | if (originalImportedFile.endsWith('.d.ts')) {
|
---|
217 | // the moduleName for these typings could be shortented to the npm package name
|
---|
218 | // if the npm package typings matches the importedFile
|
---|
219 | try {
|
---|
220 | var modulePath = importedFile.substring(0, importedFile.length - moduleName.length) +
|
---|
221 | importedFilePackageName;
|
---|
222 | var packageJson = require(modulePath + '/package.json');
|
---|
223 | var packageTypings = file_system_1.join(modulePath, packageJson.typings);
|
---|
224 | if (packageTypings === originalImportedFile) {
|
---|
225 | moduleName = importedFilePackageName;
|
---|
226 | }
|
---|
227 | }
|
---|
228 | catch (_a) {
|
---|
229 | // the above require() will throw if there is no package.json file
|
---|
230 | // and this is safe to ignore and correct to keep the longer
|
---|
231 | // moduleName in this case
|
---|
232 | }
|
---|
233 | }
|
---|
234 | }
|
---|
235 | else {
|
---|
236 | throw new Error("Trying to import a source file from a node_modules package: import " + originalImportedFile + " from " + containingFile);
|
---|
237 | }
|
---|
238 | this.fileNameToModuleNameCache.set(cacheKey, moduleName);
|
---|
239 | return moduleName;
|
---|
240 | };
|
---|
241 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.resourceNameToFileName = function (resourceName, containingFile) {
|
---|
242 | // Note: we convert package paths into relative paths to be compatible with the the
|
---|
243 | // previous implementation of UrlResolver.
|
---|
244 | var firstChar = resourceName[0];
|
---|
245 | if (firstChar === '/') {
|
---|
246 | resourceName = resourceName.slice(1);
|
---|
247 | }
|
---|
248 | else if (firstChar !== '.') {
|
---|
249 | resourceName = "./" + resourceName;
|
---|
250 | }
|
---|
251 | var filePathWithNgResource = this.moduleNameToFileName(addNgResourceSuffix(resourceName), containingFile);
|
---|
252 | // If the user specified styleUrl pointing to *.scss, but the Sass compiler was run before
|
---|
253 | // Angular, then the resource may have been generated as *.css. Simply try the resolution again.
|
---|
254 | if (!filePathWithNgResource && CSS_PREPROCESSOR_EXT.test(resourceName)) {
|
---|
255 | var fallbackResourceName = resourceName.replace(CSS_PREPROCESSOR_EXT, '.css');
|
---|
256 | filePathWithNgResource =
|
---|
257 | this.moduleNameToFileName(addNgResourceSuffix(fallbackResourceName), containingFile);
|
---|
258 | }
|
---|
259 | var result = filePathWithNgResource ? stripNgResourceSuffix(filePathWithNgResource) : null;
|
---|
260 | // Used under Bazel to report more specific error with remediation advice
|
---|
261 | if (!result && this.context.reportMissingResource) {
|
---|
262 | this.context.reportMissingResource(resourceName);
|
---|
263 | }
|
---|
264 | return result;
|
---|
265 | };
|
---|
266 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.toSummaryFileName = function (fileName, referringSrcFileName) {
|
---|
267 | return this.fileNameToModuleName(fileName, referringSrcFileName);
|
---|
268 | };
|
---|
269 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.fromSummaryFileName = function (fileName, referringLibFileName) {
|
---|
270 | var resolved = this.moduleNameToFileName(fileName, referringLibFileName);
|
---|
271 | if (!resolved) {
|
---|
272 | throw new Error("Could not resolve " + fileName + " from " + referringLibFileName);
|
---|
273 | }
|
---|
274 | return resolved;
|
---|
275 | };
|
---|
276 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.parseSourceSpanOf = function (fileName, line, character) {
|
---|
277 | var data = this.generatedSourceFiles.get(fileName);
|
---|
278 | if (data && data.emitCtx) {
|
---|
279 | return data.emitCtx.spanOf(line, character);
|
---|
280 | }
|
---|
281 | return null;
|
---|
282 | };
|
---|
283 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.getOriginalSourceFile = function (filePath, languageVersion, onError) {
|
---|
284 | // Note: we need the explicit check via `has` as we also cache results
|
---|
285 | // that were null / undefined.
|
---|
286 | if (this.originalSourceFiles.has(filePath)) {
|
---|
287 | return this.originalSourceFiles.get(filePath);
|
---|
288 | }
|
---|
289 | if (!languageVersion) {
|
---|
290 | languageVersion = this.options.target || ts.ScriptTarget.Latest;
|
---|
291 | }
|
---|
292 | // Note: This can also return undefined,
|
---|
293 | // as the TS typings are not correct!
|
---|
294 | var sf = this.context.getSourceFile(filePath, languageVersion, onError) || null;
|
---|
295 | this.originalSourceFiles.set(filePath, sf);
|
---|
296 | return sf;
|
---|
297 | };
|
---|
298 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.updateGeneratedFile = function (genFile) {
|
---|
299 | if (!genFile.stmts) {
|
---|
300 | throw new Error("Invalid Argument: Expected a GenerateFile with statements. " + genFile.genFileUrl);
|
---|
301 | }
|
---|
302 | var oldGenFile = this.generatedSourceFiles.get(genFile.genFileUrl);
|
---|
303 | if (!oldGenFile) {
|
---|
304 | throw new Error("Illegal State: previous GeneratedFile not found for " + genFile.genFileUrl + ".");
|
---|
305 | }
|
---|
306 | var newRefs = genFileExternalReferences(genFile);
|
---|
307 | var oldRefs = oldGenFile.externalReferences;
|
---|
308 | var refsAreEqual = oldRefs.size === newRefs.size;
|
---|
309 | if (refsAreEqual) {
|
---|
310 | newRefs.forEach(function (r) { return refsAreEqual = refsAreEqual && oldRefs.has(r); });
|
---|
311 | }
|
---|
312 | if (!refsAreEqual) {
|
---|
313 | throw new Error("Illegal State: external references changed in " + genFile.genFileUrl + ".\nOld: " + Array.from(oldRefs) + ".\nNew: " + Array.from(newRefs));
|
---|
314 | }
|
---|
315 | return this.addGeneratedFile(genFile, newRefs);
|
---|
316 | };
|
---|
317 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.addGeneratedFile = function (genFile, externalReferences) {
|
---|
318 | if (!genFile.stmts) {
|
---|
319 | throw new Error("Invalid Argument: Expected a GenerateFile with statements. " + genFile.genFileUrl);
|
---|
320 | }
|
---|
321 | var _a = this.emitter.emitStatementsAndContext(genFile.genFileUrl, genFile.stmts, /* preamble */ '',
|
---|
322 | /* emitSourceMaps */ false), sourceText = _a.sourceText, context = _a.context;
|
---|
323 | var sf = ts.createSourceFile(genFile.genFileUrl, sourceText, this.options.target || ts.ScriptTarget.Latest);
|
---|
324 | if (this.options.module === ts.ModuleKind.AMD || this.options.module === ts.ModuleKind.UMD) {
|
---|
325 | if (this.context.amdModuleName) {
|
---|
326 | var moduleName = this.context.amdModuleName(sf);
|
---|
327 | if (moduleName)
|
---|
328 | sf.moduleName = moduleName;
|
---|
329 | }
|
---|
330 | else if (/node_modules/.test(genFile.genFileUrl)) {
|
---|
331 | // If we are generating an ngModule file under node_modules, we know the right module name
|
---|
332 | // We don't need the host to supply a function in this case.
|
---|
333 | sf.moduleName = stripNodeModulesPrefix(genFile.genFileUrl.replace(EXT, ''));
|
---|
334 | }
|
---|
335 | }
|
---|
336 | this.generatedSourceFiles.set(genFile.genFileUrl, {
|
---|
337 | sourceFile: sf,
|
---|
338 | emitCtx: context,
|
---|
339 | externalReferences: externalReferences,
|
---|
340 | });
|
---|
341 | return sf;
|
---|
342 | };
|
---|
343 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.shouldGenerateFile = function (fileName) {
|
---|
344 | var _this = this;
|
---|
345 | // TODO(tbosch): allow generating files that are not in the rootDir
|
---|
346 | // See https://github.com/angular/angular/issues/19337
|
---|
347 | if (!util_1.isInRootDir(fileName, this.options)) {
|
---|
348 | return { generate: false };
|
---|
349 | }
|
---|
350 | var genMatch = util_1.GENERATED_FILES.exec(fileName);
|
---|
351 | if (!genMatch) {
|
---|
352 | return { generate: false };
|
---|
353 | }
|
---|
354 | var _a = tslib_1.__read(genMatch, 4), base = _a[1], genSuffix = _a[2], suffix = _a[3];
|
---|
355 | if (suffix !== 'ts' && suffix !== 'tsx') {
|
---|
356 | return { generate: false };
|
---|
357 | }
|
---|
358 | var baseFileName;
|
---|
359 | if (genSuffix.indexOf('ngstyle') >= 0) {
|
---|
360 | // Note: ngstyle files have names like `afile.css.ngstyle.ts`
|
---|
361 | if (!this.originalFileExists(base)) {
|
---|
362 | return { generate: false };
|
---|
363 | }
|
---|
364 | }
|
---|
365 | else {
|
---|
366 | // Note: on-the-fly generated files always have a `.ts` suffix,
|
---|
367 | // but the file from which we generated it can be a `.ts`/ `.tsx`/ `.d.ts`
|
---|
368 | // (see options.generateCodeForLibraries).
|
---|
369 | baseFileName = [base + ".ts", base + ".tsx", base + ".d.ts"].find(function (baseFileName) { return _this.isSourceFile(baseFileName) && _this.originalFileExists(baseFileName); });
|
---|
370 | if (!baseFileName) {
|
---|
371 | return { generate: false };
|
---|
372 | }
|
---|
373 | }
|
---|
374 | return { generate: true, baseFileName: baseFileName };
|
---|
375 | };
|
---|
376 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.shouldGenerateFilesFor = function (fileName) {
|
---|
377 | // TODO(tbosch): allow generating files that are not in the rootDir
|
---|
378 | // See https://github.com/angular/angular/issues/19337
|
---|
379 | return !util_1.GENERATED_FILES.test(fileName) && this.isSourceFile(fileName) &&
|
---|
380 | util_1.isInRootDir(fileName, this.options);
|
---|
381 | };
|
---|
382 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.getSourceFile = function (fileName, languageVersion, onError) {
|
---|
383 | var _this = this;
|
---|
384 | // Note: Don't exit early in this method to make sure
|
---|
385 | // we always have up to date references on the file!
|
---|
386 | var genFileNames = [];
|
---|
387 | var sf = this.getGeneratedFile(fileName);
|
---|
388 | if (!sf) {
|
---|
389 | var summary = this.librarySummaries.get(fileName);
|
---|
390 | if (summary) {
|
---|
391 | if (!summary.sourceFile) {
|
---|
392 | summary.sourceFile = ts.createSourceFile(fileName, summary.text, this.options.target || ts.ScriptTarget.Latest);
|
---|
393 | }
|
---|
394 | sf = summary.sourceFile;
|
---|
395 | // TypeScript doesn't allow returning redirect source files. To avoid unforseen errors we
|
---|
396 | // return the original source file instead of the redirect target.
|
---|
397 | var redirectInfo = sf.redirectInfo;
|
---|
398 | if (redirectInfo !== undefined) {
|
---|
399 | sf = redirectInfo.unredirected;
|
---|
400 | }
|
---|
401 | genFileNames = [];
|
---|
402 | }
|
---|
403 | }
|
---|
404 | if (!sf) {
|
---|
405 | sf = this.getOriginalSourceFile(fileName);
|
---|
406 | var cachedGenFiles = this.generatedCodeFor.get(fileName);
|
---|
407 | if (cachedGenFiles) {
|
---|
408 | genFileNames = cachedGenFiles;
|
---|
409 | }
|
---|
410 | else {
|
---|
411 | if (!this.options.noResolve && this.shouldGenerateFilesFor(fileName)) {
|
---|
412 | genFileNames = this.codeGenerator.findGeneratedFileNames(fileName).filter(function (fileName) { return _this.shouldGenerateFile(fileName).generate; });
|
---|
413 | }
|
---|
414 | this.generatedCodeFor.set(fileName, genFileNames);
|
---|
415 | }
|
---|
416 | }
|
---|
417 | if (sf) {
|
---|
418 | addReferencesToSourceFile(sf, genFileNames);
|
---|
419 | }
|
---|
420 | // TODO(tbosch): TypeScript's typings for getSourceFile are incorrect,
|
---|
421 | // as it can very well return undefined.
|
---|
422 | return sf;
|
---|
423 | };
|
---|
424 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.getGeneratedFile = function (fileName) {
|
---|
425 | var genSrcFile = this.generatedSourceFiles.get(fileName);
|
---|
426 | if (genSrcFile) {
|
---|
427 | return genSrcFile.sourceFile;
|
---|
428 | }
|
---|
429 | var _a = this.shouldGenerateFile(fileName), generate = _a.generate, baseFileName = _a.baseFileName;
|
---|
430 | if (generate) {
|
---|
431 | var genFile = this.codeGenerator.generateFile(fileName, baseFileName);
|
---|
432 | return this.addGeneratedFile(genFile, genFileExternalReferences(genFile));
|
---|
433 | }
|
---|
434 | return null;
|
---|
435 | };
|
---|
436 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.originalFileExists = function (fileName) {
|
---|
437 | var fileExists = this.originalFileExistsCache.get(fileName);
|
---|
438 | if (fileExists == null) {
|
---|
439 | fileExists = this.context.fileExists(fileName);
|
---|
440 | this.originalFileExistsCache.set(fileName, fileExists);
|
---|
441 | }
|
---|
442 | return fileExists;
|
---|
443 | };
|
---|
444 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.fileExists = function (fileName) {
|
---|
445 | fileName = stripNgResourceSuffix(fileName);
|
---|
446 | if (this.librarySummaries.has(fileName) || this.generatedSourceFiles.has(fileName)) {
|
---|
447 | return true;
|
---|
448 | }
|
---|
449 | if (this.shouldGenerateFile(fileName).generate) {
|
---|
450 | return true;
|
---|
451 | }
|
---|
452 | return this.originalFileExists(fileName);
|
---|
453 | };
|
---|
454 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.loadSummary = function (filePath) {
|
---|
455 | var summary = this.librarySummaries.get(filePath);
|
---|
456 | if (summary) {
|
---|
457 | return summary.text;
|
---|
458 | }
|
---|
459 | if (this.originalFileExists(filePath)) {
|
---|
460 | return assert(this.context.readFile(filePath));
|
---|
461 | }
|
---|
462 | return null;
|
---|
463 | };
|
---|
464 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.isSourceFile = function (filePath) {
|
---|
465 | // Don't generate any files nor typecheck them
|
---|
466 | // if skipTemplateCodegen is set and fullTemplateTypeCheck is not yet set,
|
---|
467 | // for backwards compatibility.
|
---|
468 | if (this.options.skipTemplateCodegen && !this.options.fullTemplateTypeCheck) {
|
---|
469 | return false;
|
---|
470 | }
|
---|
471 | // If we have a summary from a previous compilation,
|
---|
472 | // treat the file never as a source file.
|
---|
473 | if (this.librarySummaries.has(filePath)) {
|
---|
474 | return false;
|
---|
475 | }
|
---|
476 | if (util_1.GENERATED_FILES.test(filePath)) {
|
---|
477 | return false;
|
---|
478 | }
|
---|
479 | if (this.options.generateCodeForLibraries === false && util_1.DTS.test(filePath)) {
|
---|
480 | return false;
|
---|
481 | }
|
---|
482 | if (util_1.DTS.test(filePath)) {
|
---|
483 | // Check for a bundle index.
|
---|
484 | if (this.hasBundleIndex(filePath)) {
|
---|
485 | var normalFilePath = path.normalize(filePath);
|
---|
486 | return this.flatModuleIndexNames.has(normalFilePath) ||
|
---|
487 | this.flatModuleIndexRedirectNames.has(normalFilePath);
|
---|
488 | }
|
---|
489 | }
|
---|
490 | return true;
|
---|
491 | };
|
---|
492 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.readFile = function (fileName) {
|
---|
493 | var summary = this.librarySummaries.get(fileName);
|
---|
494 | if (summary) {
|
---|
495 | return summary.text;
|
---|
496 | }
|
---|
497 | return this.context.readFile(fileName);
|
---|
498 | };
|
---|
499 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.getMetadataFor = function (filePath) {
|
---|
500 | return metadata_reader_1.readMetadata(filePath, this.metadataReaderHost, this.metadataReaderCache);
|
---|
501 | };
|
---|
502 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.loadResource = function (filePath) {
|
---|
503 | if (this.context.readResource)
|
---|
504 | return this.context.readResource(filePath);
|
---|
505 | if (!this.originalFileExists(filePath)) {
|
---|
506 | throw compiler_1.syntaxError("Error: Resource file not found: " + filePath);
|
---|
507 | }
|
---|
508 | return assert(this.context.readFile(filePath));
|
---|
509 | };
|
---|
510 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.getOutputName = function (filePath) {
|
---|
511 | return path.relative(this.getCurrentDirectory(), filePath);
|
---|
512 | };
|
---|
513 | TsCompilerAotCompilerTypeCheckHostAdapter.prototype.hasBundleIndex = function (filePath) {
|
---|
514 | var _this = this;
|
---|
515 | var checkBundleIndex = function (directory) {
|
---|
516 | var result = _this.flatModuleIndexCache.get(directory);
|
---|
517 | if (result == null) {
|
---|
518 | if (path.basename(directory) == 'node_module') {
|
---|
519 | // Don't look outside the node_modules this package is installed in.
|
---|
520 | result = false;
|
---|
521 | }
|
---|
522 | else {
|
---|
523 | // A bundle index exists if the typings .d.ts file has a metadata.json that has an
|
---|
524 | // importAs.
|
---|
525 | try {
|
---|
526 | var packageFile = path.join(directory, 'package.json');
|
---|
527 | if (_this.originalFileExists(packageFile)) {
|
---|
528 | // Once we see a package.json file, assume false until it we find the bundle index.
|
---|
529 | result = false;
|
---|
530 | var packageContent = JSON.parse(assert(_this.context.readFile(packageFile)));
|
---|
531 | if (packageContent.typings) {
|
---|
532 | var typings = path.normalize(path.join(directory, packageContent.typings));
|
---|
533 | if (util_1.DTS.test(typings)) {
|
---|
534 | var metadataFile = typings.replace(util_1.DTS, '.metadata.json');
|
---|
535 | if (_this.originalFileExists(metadataFile)) {
|
---|
536 | var metadata = JSON.parse(assert(_this.context.readFile(metadataFile)));
|
---|
537 | if (metadata.flatModuleIndexRedirect) {
|
---|
538 | _this.flatModuleIndexRedirectNames.add(typings);
|
---|
539 | // Note: don't set result = true,
|
---|
540 | // as this would mark this folder
|
---|
541 | // as having a bundleIndex too early without
|
---|
542 | // filling the bundleIndexNames.
|
---|
543 | }
|
---|
544 | else if (metadata.importAs) {
|
---|
545 | _this.flatModuleIndexNames.add(typings);
|
---|
546 | result = true;
|
---|
547 | }
|
---|
548 | }
|
---|
549 | }
|
---|
550 | }
|
---|
551 | }
|
---|
552 | else {
|
---|
553 | var parent = path.dirname(directory);
|
---|
554 | if (parent != directory) {
|
---|
555 | // Try the parent directory.
|
---|
556 | result = checkBundleIndex(parent);
|
---|
557 | }
|
---|
558 | else {
|
---|
559 | result = false;
|
---|
560 | }
|
---|
561 | }
|
---|
562 | }
|
---|
563 | catch (_a) {
|
---|
564 | // If we encounter any errors assume we this isn't a bundle index.
|
---|
565 | result = false;
|
---|
566 | }
|
---|
567 | }
|
---|
568 | _this.flatModuleIndexCache.set(directory, result);
|
---|
569 | }
|
---|
570 | return result;
|
---|
571 | };
|
---|
572 | return checkBundleIndex(path.dirname(filePath));
|
---|
573 | };
|
---|
574 | return TsCompilerAotCompilerTypeCheckHostAdapter;
|
---|
575 | }());
|
---|
576 | exports.TsCompilerAotCompilerTypeCheckHostAdapter = TsCompilerAotCompilerTypeCheckHostAdapter;
|
---|
577 | function genFileExternalReferences(genFile) {
|
---|
578 | return new Set(compiler_1.collectExternalReferences(genFile.stmts).map(function (er) { return er.moduleName; }));
|
---|
579 | }
|
---|
580 | function addReferencesToSourceFile(sf, genFileNames) {
|
---|
581 | // Note: as we modify ts.SourceFiles we need to keep the original
|
---|
582 | // value for `referencedFiles` around in cache the original host is caching ts.SourceFiles.
|
---|
583 | // Note: cloning the ts.SourceFile is expensive as the nodes in have parent pointers,
|
---|
584 | // i.e. we would also need to clone and adjust all nodes.
|
---|
585 | var originalReferencedFiles = sf.originalReferencedFiles;
|
---|
586 | if (!originalReferencedFiles) {
|
---|
587 | originalReferencedFiles = sf.referencedFiles;
|
---|
588 | sf.originalReferencedFiles = originalReferencedFiles;
|
---|
589 | }
|
---|
590 | var newReferencedFiles = tslib_1.__spreadArray([], tslib_1.__read(originalReferencedFiles));
|
---|
591 | genFileNames.forEach(function (gf) { return newReferencedFiles.push({ fileName: gf, pos: 0, end: 0 }); });
|
---|
592 | sf.referencedFiles = newReferencedFiles;
|
---|
593 | }
|
---|
594 | function getOriginalReferences(sourceFile) {
|
---|
595 | return sourceFile && sourceFile.originalReferencedFiles;
|
---|
596 | }
|
---|
597 | exports.getOriginalReferences = getOriginalReferences;
|
---|
598 | function dotRelative(from, to) {
|
---|
599 | var rPath = path.relative(from, to).replace(/\\/g, '/');
|
---|
600 | return rPath.startsWith('.') ? rPath : './' + rPath;
|
---|
601 | }
|
---|
602 | /**
|
---|
603 | * Moves the path into `genDir` folder while preserving the `node_modules` directory.
|
---|
604 | */
|
---|
605 | function getPackageName(filePath) {
|
---|
606 | var match = NODE_MODULES_PACKAGE_NAME.exec(filePath);
|
---|
607 | return match ? match[1] : null;
|
---|
608 | }
|
---|
609 | function stripNodeModulesPrefix(filePath) {
|
---|
610 | return filePath.replace(/.*node_modules\//, '');
|
---|
611 | }
|
---|
612 | function getNodeModulesPrefix(filePath) {
|
---|
613 | var match = /.*node_modules\//.exec(filePath);
|
---|
614 | return match ? match[1] : null;
|
---|
615 | }
|
---|
616 | function stripNgResourceSuffix(fileName) {
|
---|
617 | return fileName.replace(/\.\$ngresource\$.*/, '');
|
---|
618 | }
|
---|
619 | function addNgResourceSuffix(fileName) {
|
---|
620 | return fileName + ".$ngresource$";
|
---|
621 | }
|
---|
622 | });
|
---|
623 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcGlsZXJfaG9zdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyLWNsaS9zcmMvdHJhbnNmb3JtZXJzL2NvbXBpbGVyX2hvc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7OztJQUVILDhDQUFvSztJQUNwSywyQkFBNkI7SUFDN0IsK0JBQWlDO0lBSWpDLDJFQUEwQztJQUcxQywwRkFBOEY7SUFDOUYsb0VBQTZFO0lBRTdFLElBQU0seUJBQXlCLEdBQUcsc0RBQXNELENBQUM7SUFDekYsSUFBTSxHQUFHLEdBQUcsa0NBQWtDLENBQUM7SUFDL0Ms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zZTtcbiAgICAgICAgICAgICAgY29uc3QgcGFja2FnZUNvbnRlbnQgPVxuICAgICAgICAgICAgICAgICAgSlNPTi5wYXJzZShhc3NlcnQodGhpcy5jb250ZXh0LnJlYWRGaWxlKHBhY2thZ2VGaWxlKSkpIGFzIHt0eXBpbmdzOiBzdHJpbmd9O1xuICAgICAgICAgICAgICBpZiAocGFja2FnZUNvbnRlbnQudHlwaW5ncykge1xuICAgICAgICAgICAgICAgIGNvbnN0IHR5cGluZ3MgPSBwYXRoLm5vcm1hbGl6ZShwYXRoLmpvaW4oZGlyZWN0b3J5LCBwYWNrYWdlQ29udGVudC50eXBpbmdzKSk7XG4gICAgICAgICAgICAgICAgaWYgKERUUy50ZXN0KHR5cGluZ3MpKSB7XG4gICAgICAgICAgICAgICAgICBjb25zdCBtZXRhZGF0YUZpbGUgPSB0eXBpbmdzLnJlcGxhY2UoRFRTLCAnLm1ldGFkYXRhLmpzb24nKTtcbiAgICAgICAgICAgICAgICAgIGlmICh0aGlzLm9yaWdpbmFsRmlsZUV4aXN0cyhtZXRhZGF0YUZpbGUpKSB7XG4gICAgICAgICAgICAgICAgICAgIGNvbnN0IG1ldGFkYXRhID0gSlNPTi5wYXJzZShhc3NlcnQodGhpcy5jb250ZXh0LnJlYWRGaWxlKG1ldGFkYXRhRmlsZSkpKSBhc1xuICAgICAgICAgICAgICAgICAgICAgICAge2ZsYXRNb2R1bGVJbmRleFJlZGlyZWN0OiBzdHJpbmcsIGltcG9ydEFzOiBzdHJpbmd9O1xuICAgICAgICAgICAgICAgICAgICBpZiAobWV0YWRhdGEuZmxhdE1vZHVsZUluZGV4UmVkaXJlY3QpIHtcbiAgICAgICAgICAgICAgICAgICAgICB0aGlzLmZsYXRNb2R1bGVJbmRleFJlZGlyZWN0TmFtZXMuYWRkKHR5cGluZ3MpO1xuICAgICAgICAgICAgICAgICAgICAgIC8vIE5vdGU6IGRvbid0IHNldCByZXN1bHQgPSB0cnVlLFxuICAgICAgICAgICAgICAgICAgICAgIC8vIGFzIHRoaXMgd291bGQgbWFyayB0aGlzIGZvbGRlclxuICAgICAgICAgICAgICAgICAgICAgIC8vIGFzIGhhdmluZyBhIGJ1bmRsZUluZGV4IHRvbyBlYXJseSB3aXRob3V0XG4gICAgICAgICAgICAgICAgICAgICAgLy8gZmlsbGluZyB0aGUgYnVuZGxlSW5kZXhOYW1lcy5cbiAgICAgICAgICAgICAgICAgICAgfSBlbHNlIGlmIChtZXRhZGF0YS5pbXBvcnRBcykge1xuICAgICAgICAgICAgICAgICAgICAgIHRoaXMuZmxhdE1vZHVsZUluZGV4TmFtZXMuYWRkKHR5cGluZ3MpO1xuICAgICAgICAgICAgICAgICAgICAgIHJlc3VsdCA9IHRydWU7XG4gICAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICAgIH1cbiAgICAgICAgICAgICAgICB9XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgIGNvbnN0IHBhcmVudCA9IHBhdGguZGlybmFtZShkaXJlY3RvcnkpO1xuICAgICAgICAgICAgICBpZiAocGFyZW50ICE9IGRpcmVjdG9yeSkge1xuICAgICAgICAgICAgICAgIC8vIFRyeSB0aGUgcGFyZW50IGRpcmVjdG9yeS5cbiAgICAgICAgICAgICAgICByZXN1bHQgPSBjaGVja0J1bmRsZUluZGV4KHBhcmVudCk7XG4gICAgICAgICAgICAgIH0gZWxzZSB7XG4gICAgICAgICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XG4gICAgICAgICAgICAgIH1cbiAgICAgICAgICAgIH1cbiAgICAgICAgICB9IGNhdGNoIHtcbiAgICAgICAgICAgIC8vIElmIHdlIGVuY291bnRlciBhbnkgZXJyb3JzIGFzc3VtZSB3ZSB0aGlzIGlzbid0IGEgYnVuZGxlIGluZGV4LlxuICAgICAgICAgICAgcmVzdWx0ID0gZmFsc2U7XG4gICAgICAgICAgfVxuICAgICAgICB9XG4gICAgICAgIHRoaXMuZmxhdE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