source: trip-planner-front/node_modules/license-webpack-plugin/dist/WebpackModuleFileIterator.js@ 76712b2

Last change on this file since 76712b2 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.6 KB
RevLine 
[6a3a178]1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.WebpackModuleFileIterator = void 0;
4var WebpackModuleFileIterator = /** @class */ (function () {
5 function WebpackModuleFileIterator(requireResolve) {
6 this.requireResolve = requireResolve;
7 }
8 WebpackModuleFileIterator.prototype.iterateFiles = function (chunkModule, callback) {
9 var internalCallback = this.internalCallback.bind(this, callback);
10 internalCallback(chunkModule.resource ||
11 (chunkModule.rootModule && chunkModule.rootModule.resource));
12 if (Array.isArray(chunkModule.fileDependencies)) {
13 var fileDependencies = chunkModule.fileDependencies;
14 fileDependencies.forEach(internalCallback);
15 }
16 if (Array.isArray(chunkModule.dependencies)) {
17 chunkModule.dependencies.forEach(function (module) {
18 return internalCallback(module.originModule && module.originModule.resource);
19 });
20 }
21 };
22 WebpackModuleFileIterator.prototype.internalCallback = function (callback, filename) {
23 var actualFileName = this.getActualFilename(filename);
24 if (actualFileName) {
25 callback(actualFileName);
26 }
27 };
28 WebpackModuleFileIterator.prototype.getActualFilename = function (filename) {
29 if (!filename ||
30 filename.indexOf('external ') === 0 ||
31 filename.indexOf('container entry ') === 0 ||
32 filename.indexOf('ignored|') === 0 ||
33 filename.indexOf('remote ') === 0 ||
34 filename.indexOf('data:') === 0) {
35 return null;
36 }
37 if (filename.indexOf('webpack/runtime') === 0) {
38 return this.requireResolve('webpack');
39 }
40 if (filename.indexOf('!') > -1) {
41 // file was procesed by loader, last item after ! is the actual file
42 var tokens = filename.split('!');
43 return tokens[tokens.length - 1];
44 }
45 if (filename.indexOf('provide module') === 0) {
46 return filename.split('=')[1].trim();
47 }
48 if (filename.indexOf('consume-shared-module') === 0) {
49 var tokens = filename.split('|');
50 // 3rd to last item is the filename, see identifier() function in node_modules/webpack/lib/sharing/ConsumeSharedModule.js
51 var actualFilename = tokens[tokens.length - 3];
52 if (actualFilename === 'undefined') {
53 return null;
54 }
55 return actualFilename;
56 }
57 return filename;
58 };
59 return WebpackModuleFileIterator;
60}());
61exports.WebpackModuleFileIterator = WebpackModuleFileIterator;
Note: See TracBrowser for help on using the repository browser.