ChunkIncludeExcludeTester.js 1.3 KB

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