From 83ab2881b02c90f94a26024f5b5907f77a81ca7a Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Sun, 29 Oct 2017 17:59:26 -0700 Subject: [PATCH] feat(operators): rename __modules.ts to index.ts for tree-shaking (#120) Closes #52 --- gulpfile.js | 6 +++--- src/Ix.internal.ts | 16 ++++++++++------ src/asynciterable/{__modules.ts => index.ts} | 0 .../pipe/{__modules.ts => index.ts} | 0 src/iterable/{__modules.ts => index.ts} | 0 src/iterable/pipe/{__modules.ts => index.ts} | 0 6 files changed, 13 insertions(+), 9 deletions(-) rename src/asynciterable/{__modules.ts => index.ts} (100%) rename src/asynciterable/pipe/{__modules.ts => index.ts} (100%) rename src/iterable/{__modules.ts => index.ts} (100%) rename src/iterable/pipe/{__modules.ts => index.ts} (100%) diff --git a/gulpfile.js b/gulpfile.js index fc03b292..fe50b1b1 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -495,10 +495,10 @@ function _dir(target, format) { return path.join(releasesRootDir, ...(!format ? function* combinations(_targets, _modules) { - const targets = known(knownTargets, _targets || [`all`]); - const modules = known(knownModules, _modules || [`all`]); + const targets = known(knownTargets, _targets || (_targets = [`all`])); + const modules = known(knownModules, _modules || (_modules = [`all`])); - if (targets[0] === `all` && modules[0] === `all`) { + if (_targets[0] === `all` && _modules[0] === `all`) { yield [`ts`, ``]; yield [`ix`, ``]; } diff --git a/src/Ix.internal.ts b/src/Ix.internal.ts index 18d39e10..5584111d 100644 --- a/src/Ix.internal.ts +++ b/src/Ix.internal.ts @@ -1,9 +1,13 @@ -import * as iterableX from './iterable/__modules'; -import * as iterableXPipe from './iterable/pipe/__modules'; -import * as asynciterableX from './asynciterable/__modules'; -import * as asynciterableXPipe from './asynciterable/pipe/__modules'; -export { iterableX as iterable, asynciterableX as asynciterable }; -export { iterableXPipe as iterablePipe, asynciterableXPipe as asynciterablePipe }; +/* `/index` required for closure compiler */ +import * as iterableX from './iterable/index'; +import * as iterableXPipe from './iterable/pipe/index'; +import * as asynciterableX from './asynciterable/index'; +import * as asynciterableXPipe from './asynciterable/pipe/index'; + +export { iterableX as iterable }; +export { iterableXPipe as iterablePipe }; +export { asynciterableX as asynciterable }; +export { asynciterableXPipe as asynciterablePipe }; /* These declarations are needed for the closure/umd targets */ export declare namespace Symbol { diff --git a/src/asynciterable/__modules.ts b/src/asynciterable/index.ts similarity index 100% rename from src/asynciterable/__modules.ts rename to src/asynciterable/index.ts diff --git a/src/asynciterable/pipe/__modules.ts b/src/asynciterable/pipe/index.ts similarity index 100% rename from src/asynciterable/pipe/__modules.ts rename to src/asynciterable/pipe/index.ts diff --git a/src/iterable/__modules.ts b/src/iterable/index.ts similarity index 100% rename from src/iterable/__modules.ts rename to src/iterable/index.ts diff --git a/src/iterable/pipe/__modules.ts b/src/iterable/pipe/index.ts similarity index 100% rename from src/iterable/pipe/__modules.ts rename to src/iterable/pipe/index.ts