UNPKG

2.3 kBJavaScriptView Raw
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.io/license
8 */
9var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10 if (k2 === undefined) k2 = k;
11 Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
12}) : (function(o, m, k, k2) {
13 if (k2 === undefined) k2 = k;
14 o[k2] = m[k];
15}));
16var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17 Object.defineProperty(o, "default", { enumerable: true, value: v });
18}) : function(o, v) {
19 o["default"] = v;
20});
21var __importStar = (this && this.__importStar) || function (mod) {
22 if (mod && mod.__esModule) return mod;
23 var result = {};
24 if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25 __setModuleDefault(result, mod);
26 return result;
27};
28Object.defineProperty(exports, "__esModule", { value: true });
29exports.getEmittedFiles = void 0;
30const path = __importStar(require("path"));
31function getEmittedFiles(compilation) {
32 var _a;
33 const files = [];
34 const chunkFileNames = new Set();
35 // adds all chunks to the list of emitted files such as lazy loaded modules
36 for (const chunk of compilation.chunks) {
37 for (const file of chunk.files) {
38 if (chunkFileNames.has(file)) {
39 continue;
40 }
41 chunkFileNames.add(file);
42 files.push({
43 id: (_a = chunk.id) === null || _a === void 0 ? void 0 : _a.toString(),
44 name: chunk.name,
45 file,
46 extension: path.extname(file),
47 initial: chunk.isOnlyInitial(),
48 });
49 }
50 }
51 // add all other files
52 for (const file of Object.keys(compilation.assets)) {
53 // Chunk files have already been added to the files list above
54 if (chunkFileNames.has(file)) {
55 continue;
56 }
57 files.push({ file, extension: path.extname(file), initial: false, asset: true });
58 }
59 return files;
60}
61exports.getEmittedFiles = getEmittedFiles;