[6a3a178] | 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/src/metadata/bundler", ["require", "exports", "tslib", "path", "typescript", "@angular/compiler-cli/src/metadata/collector", "@angular/compiler-cli/src/metadata/schema"], factory);
|
---|
| 8 | }
|
---|
| 9 | })(function (require, exports) {
|
---|
| 10 | "use strict";
|
---|
| 11 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 12 | exports.CompilerHostAdapter = exports.MetadataBundler = 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 path = require("path");
|
---|
| 22 | var ts = require("typescript");
|
---|
| 23 | var collector_1 = require("@angular/compiler-cli/src/metadata/collector");
|
---|
| 24 | var schema_1 = require("@angular/compiler-cli/src/metadata/schema");
|
---|
| 25 | // The character set used to produce private names.
|
---|
| 26 | var PRIVATE_NAME_CHARS = 'abcdefghijklmnopqrstuvwxyz';
|
---|
| 27 | var MetadataBundler = /** @class */ (function () {
|
---|
| 28 | function MetadataBundler(root, importAs, host, privateSymbolPrefix) {
|
---|
| 29 | this.root = root;
|
---|
| 30 | this.importAs = importAs;
|
---|
| 31 | this.host = host;
|
---|
| 32 | this.symbolMap = new Map();
|
---|
| 33 | this.metadataCache = new Map();
|
---|
| 34 | this.exports = new Map();
|
---|
| 35 | this.rootModule = "./" + path.basename(root);
|
---|
| 36 | this.privateSymbolPrefix = (privateSymbolPrefix || '').replace(/\W/g, '_');
|
---|
| 37 | }
|
---|
| 38 | MetadataBundler.prototype.getMetadataBundle = function () {
|
---|
| 39 | // Export the root module. This also collects the transitive closure of all values referenced by
|
---|
| 40 | // the exports.
|
---|
| 41 | var exportedSymbols = this.exportAll(this.rootModule);
|
---|
| 42 | this.canonicalizeSymbols(exportedSymbols);
|
---|
| 43 | // TODO: exports? e.g. a module re-exports a symbol from another bundle
|
---|
| 44 | var metadata = this.getEntries(exportedSymbols);
|
---|
| 45 | var privates = Array.from(this.symbolMap.values())
|
---|
| 46 | .filter(function (s) { return s.referenced && s.isPrivate; })
|
---|
| 47 | .map(function (s) { return ({
|
---|
| 48 | privateName: s.privateName,
|
---|
| 49 | name: s.declaration.name,
|
---|
| 50 | module: s.declaration.module
|
---|
| 51 | }); });
|
---|
| 52 | var origins = Array.from(this.symbolMap.values())
|
---|
| 53 | .filter(function (s) { return s.referenced && !s.reexport; })
|
---|
| 54 | .reduce(function (p, s) {
|
---|
| 55 | p[s.isPrivate ? s.privateName : s.name] = s.declaration.module;
|
---|
| 56 | return p;
|
---|
| 57 | }, {});
|
---|
| 58 | var exports = this.getReExports(exportedSymbols);
|
---|
| 59 | return {
|
---|
| 60 | metadata: {
|
---|
| 61 | __symbolic: 'module',
|
---|
| 62 | version: schema_1.METADATA_VERSION,
|
---|
| 63 | exports: exports.length ? exports : undefined,
|
---|
| 64 | metadata: metadata,
|
---|
| 65 | origins: origins,
|
---|
| 66 | importAs: this.importAs
|
---|
| 67 | },
|
---|
| 68 | privates: privates
|
---|
| 69 | };
|
---|
| 70 | };
|
---|
| 71 | MetadataBundler.resolveModule = function (importName, from) {
|
---|
| 72 | return resolveModule(importName, from);
|
---|
| 73 | };
|
---|
| 74 | MetadataBundler.prototype.getMetadata = function (moduleName) {
|
---|
| 75 | var result = this.metadataCache.get(moduleName);
|
---|
| 76 | if (!result) {
|
---|
| 77 | if (moduleName.startsWith('.')) {
|
---|
| 78 | var fullModuleName = resolveModule(moduleName, this.root);
|
---|
| 79 | result = this.host.getMetadataFor(fullModuleName, this.root);
|
---|
| 80 | }
|
---|
| 81 | this.metadataCache.set(moduleName, result);
|
---|
| 82 | }
|
---|
| 83 | return result;
|
---|
| 84 | };
|
---|
| 85 | MetadataBundler.prototype.exportAll = function (moduleName) {
|
---|
| 86 | var e_1, _a, e_2, _b, e_3, _c;
|
---|
| 87 | var _this = this;
|
---|
| 88 | var module = this.getMetadata(moduleName);
|
---|
| 89 | var result = this.exports.get(moduleName);
|
---|
| 90 | if (result) {
|
---|
| 91 | return result;
|
---|
| 92 | }
|
---|
| 93 | result = [];
|
---|
| 94 | var exportSymbol = function (exportedSymbol, exportAs) {
|
---|
| 95 | var symbol = _this.symbolOf(moduleName, exportAs);
|
---|
| 96 | result.push(symbol);
|
---|
| 97 | exportedSymbol.reexportedAs = symbol;
|
---|
| 98 | symbol.exports = exportedSymbol;
|
---|
| 99 | };
|
---|
| 100 | // Export all the symbols defined in this module.
|
---|
| 101 | if (module && module.metadata) {
|
---|
| 102 | for (var key in module.metadata) {
|
---|
| 103 | var data = module.metadata[key];
|
---|
| 104 | if (schema_1.isMetadataImportedSymbolReferenceExpression(data)) {
|
---|
| 105 | // This is a re-export of an imported symbol. Record this as a re-export.
|
---|
| 106 | var exportFrom = resolveModule(data.module, moduleName);
|
---|
| 107 | this.exportAll(exportFrom);
|
---|
| 108 | var symbol = this.symbolOf(exportFrom, data.name);
|
---|
| 109 | exportSymbol(symbol, key);
|
---|
| 110 | }
|
---|
| 111 | else {
|
---|
| 112 | // Record that this symbol is exported by this module.
|
---|
| 113 | result.push(this.symbolOf(moduleName, key));
|
---|
| 114 | }
|
---|
| 115 | }
|
---|
| 116 | }
|
---|
| 117 | // Export all the re-exports from this module
|
---|
| 118 | if (module && module.exports) {
|
---|
| 119 | var unnamedModuleExportsIdx = 0;
|
---|
| 120 | try {
|
---|
| 121 | for (var _d = tslib_1.__values(module.exports), _e = _d.next(); !_e.done; _e = _d.next()) {
|
---|
| 122 | var exportDeclaration = _e.value;
|
---|
| 123 | var exportFrom = resolveModule(exportDeclaration.from, moduleName);
|
---|
| 124 | // Record all the exports from the module even if we don't use it directly.
|
---|
| 125 | var exportedSymbols = this.exportAll(exportFrom);
|
---|
| 126 | if (exportDeclaration.export) {
|
---|
| 127 | try {
|
---|
| 128 | // Re-export all the named exports from a module.
|
---|
| 129 | for (var _f = (e_2 = void 0, tslib_1.__values(exportDeclaration.export)), _g = _f.next(); !_g.done; _g = _f.next()) {
|
---|
| 130 | var exportItem = _g.value;
|
---|
| 131 | var name = typeof exportItem == 'string' ? exportItem : exportItem.name;
|
---|
| 132 | var exportAs = typeof exportItem == 'string' ? exportItem : exportItem.as;
|
---|
| 133 | var symbol = this.symbolOf(exportFrom, name);
|
---|
| 134 | if (exportedSymbols && exportedSymbols.length == 1 && exportedSymbols[0].reexport &&
|
---|
| 135 | exportedSymbols[0].name == '*') {
|
---|
| 136 | // This is a named export from a module we have no metadata about. Record the named
|
---|
| 137 | // export as a re-export.
|
---|
| 138 | symbol.reexport = true;
|
---|
| 139 | }
|
---|
| 140 | exportSymbol(this.symbolOf(exportFrom, name), exportAs);
|
---|
| 141 | }
|
---|
| 142 | }
|
---|
| 143 | catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
---|
| 144 | finally {
|
---|
| 145 | try {
|
---|
| 146 | if (_g && !_g.done && (_b = _f.return)) _b.call(_f);
|
---|
| 147 | }
|
---|
| 148 | finally { if (e_2) throw e_2.error; }
|
---|
| 149 | }
|
---|
| 150 | }
|
---|
| 151 | else {
|
---|
| 152 | // Re-export all the symbols from the module
|
---|
| 153 | var exportedSymbols_2 = this.exportAll(exportFrom);
|
---|
| 154 | try {
|
---|
| 155 | for (var exportedSymbols_1 = (e_3 = void 0, tslib_1.__values(exportedSymbols_2)), exportedSymbols_1_1 = exportedSymbols_1.next(); !exportedSymbols_1_1.done; exportedSymbols_1_1 = exportedSymbols_1.next()) {
|
---|
| 156 | var exportedSymbol = exportedSymbols_1_1.value;
|
---|
| 157 | // In case the exported symbol does not have a name, we need to give it an unique
|
---|
| 158 | // name for the current module. This is necessary because there can be multiple
|
---|
| 159 | // unnamed re-exports in a given module.
|
---|
| 160 | var name = exportedSymbol.name === '*' ?
|
---|
| 161 | "unnamed_reexport_" + unnamedModuleExportsIdx++ :
|
---|
| 162 | exportedSymbol.name;
|
---|
| 163 | exportSymbol(exportedSymbol, name);
|
---|
| 164 | }
|
---|
| 165 | }
|
---|
| 166 | catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
---|
| 167 | finally {
|
---|
| 168 | try {
|
---|
| 169 | if (exportedSymbols_1_1 && !exportedSymbols_1_1.done && (_c = exportedSymbols_1.return)) _c.call(exportedSymbols_1);
|
---|
| 170 | }
|
---|
| 171 | finally { if (e_3) throw e_3.error; }
|
---|
| 172 | }
|
---|
| 173 | }
|
---|
| 174 | }
|
---|
| 175 | }
|
---|
| 176 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
---|
| 177 | finally {
|
---|
| 178 | try {
|
---|
| 179 | if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
---|
| 180 | }
|
---|
| 181 | finally { if (e_1) throw e_1.error; }
|
---|
| 182 | }
|
---|
| 183 | }
|
---|
| 184 | if (!module) {
|
---|
| 185 | // If no metadata is found for this import then it is considered external to the
|
---|
| 186 | // library and should be recorded as a re-export in the final metadata if it is
|
---|
| 187 | // eventually re-exported.
|
---|
| 188 | var symbol = this.symbolOf(moduleName, '*');
|
---|
| 189 | symbol.reexport = true;
|
---|
| 190 | result.push(symbol);
|
---|
| 191 | }
|
---|
| 192 | this.exports.set(moduleName, result);
|
---|
| 193 | return result;
|
---|
| 194 | };
|
---|
| 195 | /**
|
---|
| 196 | * Fill in the canonicalSymbol which is the symbol that should be imported by factories.
|
---|
| 197 | * The canonical symbol is the one exported by the index file for the bundle or definition
|
---|
| 198 | * symbol for private symbols that are not exported by bundle index.
|
---|
| 199 | */
|
---|
| 200 | MetadataBundler.prototype.canonicalizeSymbols = function (exportedSymbols) {
|
---|
| 201 | var symbols = Array.from(this.symbolMap.values());
|
---|
| 202 | this.exported = new Set(exportedSymbols);
|
---|
| 203 | symbols.forEach(this.canonicalizeSymbol, this);
|
---|
| 204 | };
|
---|
| 205 | MetadataBundler.prototype.canonicalizeSymbol = function (symbol) {
|
---|
| 206 | var rootExport = getRootExport(symbol);
|
---|
| 207 | var declaration = getSymbolDeclaration(symbol);
|
---|
| 208 | var isPrivate = !this.exported.has(rootExport);
|
---|
| 209 | var canonicalSymbol = isPrivate ? declaration : rootExport;
|
---|
| 210 | symbol.isPrivate = isPrivate;
|
---|
| 211 | symbol.declaration = declaration;
|
---|
| 212 | symbol.canonicalSymbol = canonicalSymbol;
|
---|
| 213 | symbol.reexport = declaration.reexport;
|
---|
| 214 | };
|
---|
| 215 | MetadataBundler.prototype.getEntries = function (exportedSymbols) {
|
---|
| 216 | var _this = this;
|
---|
| 217 | var result = {};
|
---|
| 218 | var exportedNames = new Set(exportedSymbols.map(function (s) { return s.name; }));
|
---|
| 219 | var privateName = 0;
|
---|
| 220 | function newPrivateName(prefix) {
|
---|
| 221 | while (true) {
|
---|
| 222 | var digits = [];
|
---|
| 223 | var index = privateName++;
|
---|
| 224 | var base = PRIVATE_NAME_CHARS;
|
---|
| 225 | while (!digits.length || index > 0) {
|
---|
| 226 | digits.unshift(base[index % base.length]);
|
---|
| 227 | index = Math.floor(index / base.length);
|
---|
| 228 | }
|
---|
| 229 | var result_1 = "\u0275" + prefix + digits.join('');
|
---|
| 230 | if (!exportedNames.has(result_1))
|
---|
| 231 | return result_1;
|
---|
| 232 | }
|
---|
| 233 | }
|
---|
| 234 | exportedSymbols.forEach(function (symbol) { return _this.convertSymbol(symbol); });
|
---|
| 235 | var symbolsMap = new Map();
|
---|
| 236 | Array.from(this.symbolMap.values()).forEach(function (symbol) {
|
---|
| 237 | if (symbol.referenced && !symbol.reexport) {
|
---|
| 238 | var name = symbol.name;
|
---|
| 239 | var identifier = symbol.declaration.module + ":" + symbol.declaration.name;
|
---|
| 240 | if (symbol.isPrivate && !symbol.privateName) {
|
---|
| 241 | name = newPrivateName(_this.privateSymbolPrefix);
|
---|
| 242 | symbol.privateName = name;
|
---|
| 243 | }
|
---|
| 244 | if (symbolsMap.has(identifier)) {
|
---|
| 245 | var names = symbolsMap.get(identifier);
|
---|
| 246 | names.push(name);
|
---|
| 247 | }
|
---|
| 248 | else {
|
---|
| 249 | symbolsMap.set(identifier, [name]);
|
---|
| 250 | }
|
---|
| 251 | result[name] = symbol.value;
|
---|
| 252 | }
|
---|
| 253 | });
|
---|
| 254 | // check for duplicated entries
|
---|
| 255 | symbolsMap.forEach(function (names, identifier) {
|
---|
| 256 | if (names.length > 1) {
|
---|
| 257 | var _a = tslib_1.__read(identifier.split(':'), 2), module_1 = _a[0], declaredName = _a[1];
|
---|
| 258 | // prefer the export that uses the declared name (if any)
|
---|
| 259 | var reference_1 = names.indexOf(declaredName);
|
---|
| 260 | if (reference_1 === -1) {
|
---|
| 261 | reference_1 = 0;
|
---|
| 262 | }
|
---|
| 263 | // keep one entry and replace the others by references
|
---|
| 264 | names.forEach(function (name, i) {
|
---|
| 265 | if (i !== reference_1) {
|
---|
| 266 | result[name] = { __symbolic: 'reference', name: names[reference_1] };
|
---|
| 267 | }
|
---|
| 268 | });
|
---|
| 269 | }
|
---|
| 270 | });
|
---|
| 271 | return result;
|
---|
| 272 | };
|
---|
| 273 | MetadataBundler.prototype.getReExports = function (exportedSymbols) {
|
---|
| 274 | var e_4, _a;
|
---|
| 275 | var modules = new Map();
|
---|
| 276 | var exportAlls = new Set();
|
---|
| 277 | try {
|
---|
| 278 | for (var exportedSymbols_3 = tslib_1.__values(exportedSymbols), exportedSymbols_3_1 = exportedSymbols_3.next(); !exportedSymbols_3_1.done; exportedSymbols_3_1 = exportedSymbols_3.next()) {
|
---|
| 279 | var symbol = exportedSymbols_3_1.value;
|
---|
| 280 | if (symbol.reexport) {
|
---|
| 281 | // symbol.declaration is guaranteed to be defined during the phase this method is called.
|
---|
| 282 | var declaration = symbol.declaration;
|
---|
| 283 | var module_2 = declaration.module;
|
---|
| 284 | if (declaration.name == '*') {
|
---|
| 285 | // Reexport all the symbols.
|
---|
| 286 | exportAlls.add(declaration.module);
|
---|
| 287 | }
|
---|
| 288 | else {
|
---|
| 289 | // Re-export the symbol as the exported name.
|
---|
| 290 | var entry = modules.get(module_2);
|
---|
| 291 | if (!entry) {
|
---|
| 292 | entry = [];
|
---|
| 293 | modules.set(module_2, entry);
|
---|
| 294 | }
|
---|
| 295 | var as = symbol.name;
|
---|
| 296 | var name = declaration.name;
|
---|
| 297 | entry.push({ name: name, as: as });
|
---|
| 298 | }
|
---|
| 299 | }
|
---|
| 300 | }
|
---|
| 301 | }
|
---|
| 302 | catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
---|
| 303 | finally {
|
---|
| 304 | try {
|
---|
| 305 | if (exportedSymbols_3_1 && !exportedSymbols_3_1.done && (_a = exportedSymbols_3.return)) _a.call(exportedSymbols_3);
|
---|
| 306 | }
|
---|
| 307 | finally { if (e_4) throw e_4.error; }
|
---|
| 308 | }
|
---|
| 309 | return tslib_1.__spreadArray(tslib_1.__spreadArray([], tslib_1.__read(Array.from(exportAlls.values()).map(function (from) { return ({ from: from }); }))), tslib_1.__read(Array.from(modules.entries()).map(function (_a) {
|
---|
| 310 | var _b = tslib_1.__read(_a, 2), from = _b[0], exports = _b[1];
|
---|
| 311 | return ({ export: exports, from: from });
|
---|
| 312 | })));
|
---|
| 313 | };
|
---|
| 314 | MetadataBundler.prototype.convertSymbol = function (symbol) {
|
---|
| 315 | // canonicalSymbol is ensured to be defined before this is called.
|
---|
| 316 | var canonicalSymbol = symbol.canonicalSymbol;
|
---|
| 317 | if (!canonicalSymbol.referenced) {
|
---|
| 318 | canonicalSymbol.referenced = true;
|
---|
| 319 | // declaration is ensured to be definded before this method is called.
|
---|
| 320 | var declaration = canonicalSymbol.declaration;
|
---|
| 321 | var module_3 = this.getMetadata(declaration.module);
|
---|
| 322 | if (module_3) {
|
---|
| 323 | var value = module_3.metadata[declaration.name];
|
---|
| 324 | if (value && !declaration.name.startsWith('___')) {
|
---|
| 325 | canonicalSymbol.value = this.convertEntry(declaration.module, value);
|
---|
| 326 | }
|
---|
| 327 | }
|
---|
| 328 | }
|
---|
| 329 | };
|
---|
| 330 | MetadataBundler.prototype.convertEntry = function (moduleName, value) {
|
---|
| 331 | if (schema_1.isClassMetadata(value)) {
|
---|
| 332 | return this.convertClass(moduleName, value);
|
---|
| 333 | }
|
---|
| 334 | if (schema_1.isFunctionMetadata(value)) {
|
---|
| 335 | return this.convertFunction(moduleName, value);
|
---|
| 336 | }
|
---|
| 337 | if (schema_1.isInterfaceMetadata(value)) {
|
---|
| 338 | return value;
|
---|
| 339 | }
|
---|
| 340 | return this.convertValue(moduleName, value);
|
---|
| 341 | };
|
---|
| 342 | MetadataBundler.prototype.convertClass = function (moduleName, value) {
|
---|
| 343 | var _this = this;
|
---|
| 344 | return {
|
---|
| 345 | __symbolic: 'class',
|
---|
| 346 | arity: value.arity,
|
---|
| 347 | extends: this.convertExpression(moduleName, value.extends),
|
---|
| 348 | decorators: value.decorators && value.decorators.map(function (d) { return _this.convertExpression(moduleName, d); }),
|
---|
| 349 | members: this.convertMembers(moduleName, value.members),
|
---|
| 350 | statics: value.statics && this.convertStatics(moduleName, value.statics)
|
---|
| 351 | };
|
---|
| 352 | };
|
---|
| 353 | MetadataBundler.prototype.convertMembers = function (moduleName, members) {
|
---|
| 354 | var _this = this;
|
---|
| 355 | var result = {};
|
---|
| 356 | for (var name in members) {
|
---|
| 357 | var value = members[name];
|
---|
| 358 | result[name] = value.map(function (v) { return _this.convertMember(moduleName, v); });
|
---|
| 359 | }
|
---|
| 360 | return result;
|
---|
| 361 | };
|
---|
| 362 | MetadataBundler.prototype.convertMember = function (moduleName, member) {
|
---|
| 363 | var _this = this;
|
---|
| 364 | var result = { __symbolic: member.__symbolic };
|
---|
| 365 | result.decorators =
|
---|
| 366 | member.decorators && member.decorators.map(function (d) { return _this.convertExpression(moduleName, d); });
|
---|
| 367 | if (schema_1.isMethodMetadata(member)) {
|
---|
| 368 | result.parameterDecorators = member.parameterDecorators &&
|
---|
| 369 | member.parameterDecorators.map(function (d) { return d && d.map(function (p) { return _this.convertExpression(moduleName, p); }); });
|
---|
| 370 | if (schema_1.isConstructorMetadata(member)) {
|
---|
| 371 | if (member.parameters) {
|
---|
| 372 | result.parameters =
|
---|
| 373 | member.parameters.map(function (p) { return _this.convertExpression(moduleName, p); });
|
---|
| 374 | }
|
---|
| 375 | }
|
---|
| 376 | }
|
---|
| 377 | return result;
|
---|
| 378 | };
|
---|
| 379 | MetadataBundler.prototype.convertStatics = function (moduleName, statics) {
|
---|
| 380 | var result = {};
|
---|
| 381 | for (var key in statics) {
|
---|
| 382 | var value = statics[key];
|
---|
| 383 | if (schema_1.isFunctionMetadata(value)) {
|
---|
| 384 | result[key] = this.convertFunction(moduleName, value);
|
---|
| 385 | }
|
---|
| 386 | else if (schema_1.isMetadataSymbolicCallExpression(value)) {
|
---|
| 387 | // Class members can also contain static members that call a function with module
|
---|
| 388 | // references. e.g. "static ɵprov = ɵɵdefineInjectable(..)". We also need to
|
---|
| 389 | // convert these module references because otherwise these resolve to non-existent files.
|
---|
| 390 | result[key] = this.convertValue(moduleName, value);
|
---|
| 391 | }
|
---|
| 392 | else {
|
---|
| 393 | result[key] = value;
|
---|
| 394 | }
|
---|
| 395 | }
|
---|
| 396 | return result;
|
---|
| 397 | };
|
---|
| 398 | MetadataBundler.prototype.convertFunction = function (moduleName, value) {
|
---|
| 399 | var _this = this;
|
---|
| 400 | return {
|
---|
| 401 | __symbolic: 'function',
|
---|
| 402 | parameters: value.parameters,
|
---|
| 403 | defaults: value.defaults && value.defaults.map(function (v) { return _this.convertValue(moduleName, v); }),
|
---|
| 404 | value: this.convertValue(moduleName, value.value)
|
---|
| 405 | };
|
---|
| 406 | };
|
---|
| 407 | MetadataBundler.prototype.convertValue = function (moduleName, value) {
|
---|
| 408 | var _this = this;
|
---|
| 409 | if (isPrimitive(value)) {
|
---|
| 410 | return value;
|
---|
| 411 | }
|
---|
| 412 | if (schema_1.isMetadataError(value)) {
|
---|
| 413 | return this.convertError(moduleName, value);
|
---|
| 414 | }
|
---|
| 415 | if (schema_1.isMetadataSymbolicExpression(value)) {
|
---|
| 416 | return this.convertExpression(moduleName, value);
|
---|
| 417 | }
|
---|
| 418 | if (Array.isArray(value)) {
|
---|
| 419 | return value.map(function (v) { return _this.convertValue(moduleName, v); });
|
---|
| 420 | }
|
---|
| 421 | // Otherwise it is a metadata object.
|
---|
| 422 | var object = value;
|
---|
| 423 | var result = {};
|
---|
| 424 | for (var key in object) {
|
---|
| 425 | result[key] = this.convertValue(moduleName, object[key]);
|
---|
| 426 | }
|
---|
| 427 | return result;
|
---|
| 428 | };
|
---|
| 429 | MetadataBundler.prototype.convertExpression = function (moduleName, value) {
|
---|
| 430 | if (value) {
|
---|
| 431 | switch (value.__symbolic) {
|
---|
| 432 | case 'error':
|
---|
| 433 | return this.convertError(moduleName, value);
|
---|
| 434 | case 'reference':
|
---|
| 435 | return this.convertReference(moduleName, value);
|
---|
| 436 | default:
|
---|
| 437 | return this.convertExpressionNode(moduleName, value);
|
---|
| 438 | }
|
---|
| 439 | }
|
---|
| 440 | return value;
|
---|
| 441 | };
|
---|
| 442 | MetadataBundler.prototype.convertError = function (module, value) {
|
---|
| 443 | return {
|
---|
| 444 | __symbolic: 'error',
|
---|
| 445 | message: value.message,
|
---|
| 446 | line: value.line,
|
---|
| 447 | character: value.character,
|
---|
| 448 | context: value.context,
|
---|
| 449 | module: module
|
---|
| 450 | };
|
---|
| 451 | };
|
---|
| 452 | MetadataBundler.prototype.convertReference = function (moduleName, value) {
|
---|
| 453 | var _this = this;
|
---|
| 454 | var createReference = function (symbol) {
|
---|
| 455 | var declaration = symbol.declaration;
|
---|
| 456 | if (declaration.module.startsWith('.')) {
|
---|
| 457 | // Reference to a symbol defined in the module. Ensure it is converted then return a
|
---|
| 458 | // references to the final symbol.
|
---|
| 459 | _this.convertSymbol(symbol);
|
---|
| 460 | return {
|
---|
| 461 | __symbolic: 'reference',
|
---|
| 462 | get name() {
|
---|
| 463 | // Resolved lazily because private names are assigned late.
|
---|
| 464 | var canonicalSymbol = symbol.canonicalSymbol;
|
---|
| 465 | if (canonicalSymbol.isPrivate == null) {
|
---|
| 466 | throw Error('Invalid state: isPrivate was not initialized');
|
---|
| 467 | }
|
---|
| 468 | return canonicalSymbol.isPrivate ? canonicalSymbol.privateName : canonicalSymbol.name;
|
---|
| 469 | }
|
---|
| 470 | };
|
---|
| 471 | }
|
---|
| 472 | else {
|
---|
| 473 | // The symbol was a re-exported symbol from another module. Return a reference to the
|
---|
| 474 | // original imported symbol.
|
---|
| 475 | return { __symbolic: 'reference', name: declaration.name, module: declaration.module };
|
---|
| 476 | }
|
---|
| 477 | };
|
---|
| 478 | if (schema_1.isMetadataGlobalReferenceExpression(value)) {
|
---|
| 479 | var metadata = this.getMetadata(moduleName);
|
---|
| 480 | if (metadata && metadata.metadata && metadata.metadata[value.name]) {
|
---|
| 481 | // Reference to a symbol defined in the module
|
---|
| 482 | return createReference(this.canonicalSymbolOf(moduleName, value.name));
|
---|
| 483 | }
|
---|
| 484 | // If a reference has arguments, the arguments need to be converted.
|
---|
| 485 | if (value.arguments) {
|
---|
| 486 | return {
|
---|
| 487 | __symbolic: 'reference',
|
---|
| 488 | name: value.name,
|
---|
| 489 | arguments: value.arguments.map(function (a) { return _this.convertValue(moduleName, a); })
|
---|
| 490 | };
|
---|
| 491 | }
|
---|
| 492 | // Global references without arguments (such as to Math or JSON) are unmodified.
|
---|
| 493 | return value;
|
---|
| 494 | }
|
---|
| 495 | if (schema_1.isMetadataImportedSymbolReferenceExpression(value)) {
|
---|
| 496 | // References to imported symbols are separated into two, references to bundled modules and
|
---|
| 497 | // references to modules external to the bundle. If the module reference is relative it is
|
---|
| 498 | // assumed to be in the bundle. If it is Global it is assumed to be outside the bundle.
|
---|
| 499 | // References to symbols outside the bundle are left unmodified. References to symbol inside
|
---|
| 500 | // the bundle need to be converted to a bundle import reference reachable from the bundle
|
---|
| 501 | // index.
|
---|
| 502 | if (value.module.startsWith('.')) {
|
---|
| 503 | // Reference is to a symbol defined inside the module. Convert the reference to a reference
|
---|
| 504 | // to the canonical symbol.
|
---|
| 505 | var referencedModule = resolveModule(value.module, moduleName);
|
---|
| 506 | var referencedName = value.name;
|
---|
| 507 | return createReference(this.canonicalSymbolOf(referencedModule, referencedName));
|
---|
| 508 | }
|
---|
| 509 | // Value is a reference to a symbol defined outside the module.
|
---|
| 510 | if (value.arguments) {
|
---|
| 511 | // If a reference has arguments the arguments need to be converted.
|
---|
| 512 | return {
|
---|
| 513 | __symbolic: 'reference',
|
---|
| 514 | name: value.name,
|
---|
| 515 | module: value.module,
|
---|
| 516 | arguments: value.arguments.map(function (a) { return _this.convertValue(moduleName, a); })
|
---|
| 517 | };
|
---|
| 518 | }
|
---|
| 519 | return value;
|
---|
| 520 | }
|
---|
| 521 | if (schema_1.isMetadataModuleReferenceExpression(value)) {
|
---|
| 522 | // Cannot support references to bundled modules as the internal modules of a bundle are erased
|
---|
| 523 | // by the bundler.
|
---|
| 524 | if (value.module.startsWith('.')) {
|
---|
| 525 | return {
|
---|
| 526 | __symbolic: 'error',
|
---|
| 527 | message: 'Unsupported bundled module reference',
|
---|
| 528 | context: { module: value.module }
|
---|
| 529 | };
|
---|
| 530 | }
|
---|
| 531 | // References to unbundled modules are unmodified.
|
---|
| 532 | return value;
|
---|
| 533 | }
|
---|
| 534 | };
|
---|
| 535 | MetadataBundler.prototype.convertExpressionNode = function (moduleName, value) {
|
---|
| 536 | var result = { __symbolic: value.__symbolic };
|
---|
| 537 | for (var key in value) {
|
---|
| 538 | result[key] = this.convertValue(moduleName, value[key]);
|
---|
| 539 | }
|
---|
| 540 | return result;
|
---|
| 541 | };
|
---|
| 542 | MetadataBundler.prototype.symbolOf = function (module, name) {
|
---|
| 543 | var symbolKey = module + ":" + name;
|
---|
| 544 | var symbol = this.symbolMap.get(symbolKey);
|
---|
| 545 | if (!symbol) {
|
---|
| 546 | symbol = { module: module, name: name };
|
---|
| 547 | this.symbolMap.set(symbolKey, symbol);
|
---|
| 548 | }
|
---|
| 549 | return symbol;
|
---|
| 550 | };
|
---|
| 551 | MetadataBundler.prototype.canonicalSymbolOf = function (module, name) {
|
---|
| 552 | // Ensure the module has been seen.
|
---|
| 553 | this.exportAll(module);
|
---|
| 554 | var symbol = this.symbolOf(module, name);
|
---|
| 555 | if (!symbol.canonicalSymbol) {
|
---|
| 556 | this.canonicalizeSymbol(symbol);
|
---|
| 557 | }
|
---|
| 558 | return symbol;
|
---|
| 559 | };
|
---|
| 560 | return MetadataBundler;
|
---|
| 561 | }());
|
---|
| 562 | exports.MetadataBundler = MetadataBundler;
|
---|
| 563 | var CompilerHostAdapter = /** @class */ (function () {
|
---|
| 564 | function CompilerHostAdapter(host, cache, options) {
|
---|
| 565 | this.host = host;
|
---|
| 566 | this.cache = cache;
|
---|
| 567 | this.options = options;
|
---|
| 568 | this.collector = new collector_1.MetadataCollector();
|
---|
| 569 | }
|
---|
| 570 | CompilerHostAdapter.prototype.getMetadataFor = function (fileName, containingFile) {
|
---|
| 571 | var resolvedModule = ts.resolveModuleName(fileName, containingFile, this.options, this.host).resolvedModule;
|
---|
| 572 | var sourceFile;
|
---|
| 573 | if (resolvedModule) {
|
---|
| 574 | var resolvedFileName = resolvedModule.resolvedFileName;
|
---|
| 575 | if (resolvedModule.extension !== '.ts') {
|
---|
| 576 | resolvedFileName = resolvedFileName.replace(/(\.d\.ts|\.js)$/, '.ts');
|
---|
| 577 | }
|
---|
| 578 | sourceFile = this.host.getSourceFile(resolvedFileName, ts.ScriptTarget.Latest);
|
---|
| 579 | }
|
---|
| 580 | else {
|
---|
| 581 | // If typescript is unable to resolve the file, fallback on old behavior
|
---|
| 582 | if (!this.host.fileExists(fileName + '.ts'))
|
---|
| 583 | return undefined;
|
---|
| 584 | sourceFile = this.host.getSourceFile(fileName + '.ts', ts.ScriptTarget.Latest);
|
---|
| 585 | }
|
---|
| 586 | // If there is a metadata cache, use it to get the metadata for this source file. Otherwise,
|
---|
| 587 | // fall back on the locally created MetadataCollector.
|
---|
| 588 | if (!sourceFile) {
|
---|
| 589 | return undefined;
|
---|
| 590 | }
|
---|
| 591 | else if (this.cache) {
|
---|
| 592 | return this.cache.getMetadata(sourceFile);
|
---|
| 593 | }
|
---|
| 594 | else {
|
---|
| 595 | return this.collector.getMetadata(sourceFile);
|
---|
| 596 | }
|
---|
| 597 | };
|
---|
| 598 | return CompilerHostAdapter;
|
---|
| 599 | }());
|
---|
| 600 | exports.CompilerHostAdapter = CompilerHostAdapter;
|
---|
| 601 | function resolveModule(importName, from) {
|
---|
| 602 | if (importName.startsWith('.') && from) {
|
---|
| 603 | var normalPath = path.normalize(path.join(path.dirname(from), importName));
|
---|
| 604 | if (!normalPath.startsWith('.') && from.startsWith('.')) {
|
---|
| 605 | // path.normalize() preserves leading '../' but not './'. This adds it back.
|
---|
| 606 | normalPath = "." + path.sep + normalPath;
|
---|
| 607 | }
|
---|
| 608 | // Replace windows path delimiters with forward-slashes. Otherwise the paths are not
|
---|
| 609 | // TypeScript compatible when building the bundle.
|
---|
| 610 | return normalPath.replace(/\\/g, '/');
|
---|
| 611 | }
|
---|
| 612 | return importName;
|
---|
| 613 | }
|
---|
| 614 | function isPrimitive(o) {
|
---|
| 615 | return o === null || (typeof o !== 'function' && typeof o !== 'object');
|
---|
| 616 | }
|
---|
| 617 | function getRootExport(symbol) {
|
---|
| 618 | return symbol.reexportedAs ? getRootExport(symbol.reexportedAs) : symbol;
|
---|
| 619 | }
|
---|
| 620 | function getSymbolDeclaration(symbol) {
|
---|
| 621 | return symbol.exports ? getSymbolDeclaration(symbol.exports) : symbol;
|
---|
| 622 | }
|
---|
| 623 | });
|
---|
| 624 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiYnVuZGxlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4u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GEgbW9kdWxlIHJlLWV4cG9ydHMgYSBzeW1ib2wgZnJvbSBhbm90aGVyIGJ1bmRsZVxuICAgIGNvbnN0IG1ldGFkYXRhID0gdGhpcy5nZXRFbnRyaWVzKGV4cG9ydGVkU3ltYm9scyk7XG4gICAgY29uc3QgcHJpdmF0ZXMgPSBBcnJheS5mcm9tKHRoaXMuc3ltYm9sTWFwLnZhbHVlcygpKVxuICAgICAgICAgICAgICAgICAgICAgICAgIC5maWx0ZXIocyA9PiBzLnJlZmVyZW5jZWQgJiYgcy5pc1ByaXZhdGUpXG4gICAgICAgICAgICAgICAgICAgICAgICAgLm1hcChzID0+ICh7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIHByaXZhdGVOYW1lOiBzLnByaXZhdGVOYW1lISxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbmFtZTogcy5kZWNsYXJhdGlvbiEubmFtZSxcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgbW9kdWxlOiBzLmRlY2xhcmF0aW9uIS5tb2R1bGVcbiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIH0pKTtcbiAgICBjb25zdCBvcmlnaW5zID0gQXJyYXkuZnJvbSh0aGlzLnN5bWJvbE1hcC52YWx1ZXMoKSlcbiAgICAgICAgICAgICAgICAgICAgICAgIC5maWx0ZXIocyA9PiBzLnJlZmVyZW5jZWQgJiYgIXMucmVleHBvcnQpXG4gICAgICAgICAgICAgICAgICAgICAgICAucmVkdWNlPHtbbmFtZTogc3RyaW5nXTogc3RyaW5nfT4oKHAsIHMpID0+IHtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcFtzLmlzUHJpdmF0ZSA/IHMucHJpdmF0ZU5hbWUhIDogcy5uYW1lXSA9IHMuZGVjbGFyYXRpb24hLm1vZHVsZTtcbiAgICAgICAgICAgICAgICAgICAgICAgICAgcmV0dXJuIHA7XG4gICAgICAgICAgICAgICAgICAgICAgICB9LCB7fSk7XG4gICAgY29uc3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