ChunkIncludeExcludeTester.js 1.3 KB

123456789101112131415161718192021222324252627282930
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.ChunkIncludeExcludeTester = void 0;
  4. var ChunkIncludeExcludeTester = /** @class */ (function () {
  5. function ChunkIncludeExcludeTester(includeExcludeTest) {
  6. this.includeExcludeTest = includeExcludeTest;
  7. }
  8. ChunkIncludeExcludeTester.prototype.isIncluded = function (chunkName) {
  9. if (typeof this.includeExcludeTest === 'function') {
  10. return this.includeExcludeTest(chunkName);
  11. }
  12. // only include
  13. if (this.includeExcludeTest.include && !this.includeExcludeTest.exclude) {
  14. return this.includeExcludeTest.include.indexOf(chunkName) > -1;
  15. }
  16. // only exclude
  17. if (this.includeExcludeTest.exclude && !this.includeExcludeTest.include) {
  18. // included as long as it's not excluded
  19. return !(this.includeExcludeTest.exclude.indexOf(chunkName) > -1);
  20. }
  21. // include and exclude together
  22. if (this.includeExcludeTest.include && this.includeExcludeTest.exclude) {
  23. return (!(this.includeExcludeTest.exclude.indexOf(chunkName) > -1) &&
  24. this.includeExcludeTest.include.indexOf(chunkName) > -1);
  25. }
  26. return true;
  27. };
  28. return ChunkIncludeExcludeTester;
  29. }());
  30. exports.ChunkIncludeExcludeTester = ChunkIncludeExcludeTester;