diff --git a/.circleci/config.yml b/.circleci/config.yml index 90024cc636..a8a1a7ead4 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -29,7 +29,7 @@ jobs: - checkout - *restore_cache - run: npm i - - run: npm run build_all + - run: npm run build:package - persist_to_workspace: root: . paths: @@ -63,7 +63,7 @@ jobs: steps: - attach_workspace: *attach_options - run: npm i --no-save typescript@3.5.* - - run: npm run build_cjs + - run: npm run compile workflows: version: 2 diff --git a/.gitignore b/.gitignore index 8aaee07d39..cd54df624b 100644 --- a/.gitignore +++ b/.gitignore @@ -19,10 +19,18 @@ img/ spec-js/ spec-build/ .out/ +.tmp/ + +ajax/ +fetch/ +operators/ +testing/ +webSocket/ # Misc npm-debug.log .DS_STORE +*.tgz # The check-side-effects package generates and deletes this file. # If the process is killed, it will be left behind. diff --git a/.make-packages.js b/.make-packages.js deleted file mode 100644 index a043f0b512..0000000000 --- a/.make-packages.js +++ /dev/null @@ -1,137 +0,0 @@ -"use strict"; - -let pkg = require('./package.json'); -let fs = require('fs-extra'); -let mkdirp = require('mkdirp'); -let path = require('path'); -let klawSync = require('klaw-sync'); -let licenseTool = require('./tools/add-license-to-file'); -let addLicenseToFile = licenseTool.addLicenseToFile; -let addLicenseTextToFile = licenseTool.addLicenseTextToFile; -let makePackages = require('./.make-helpers'); -let copySources = makePackages.copySources; -let cleanSourceMapRoot = makePackages.cleanSourceMapRoot; -let bo = null; -// Build Optimizer is not available on Node 4.x. Using a try/catch -// here to make sure the build passes on Travis using Node 4, but -// the NPM distribution will run through build-optimizer. -try { - bo = require('@angular-devkit/build-optimizer'); -} catch (e) {} - - -const ROOT = 'dist/'; -const CJS_ROOT = ROOT + 'cjs/'; -const ESM5_ROOT = ROOT + 'esm5/'; -const ESM2015_ROOT = ROOT + 'esm2015/'; -const UMD_ROOT = ROOT + 'global/'; -const ESM5_FOR_ROLLUP_ROOT = ROOT + 'esm5_for_rollup/'; -const TYPE_ROOT = ROOT + 'typings/'; -const PKG_ROOT = ROOT + 'package/'; -const CJS_PKG = PKG_ROOT + ''; -const ESM5_PKG = PKG_ROOT + '_esm5/'; -const ESM2015_PKG = PKG_ROOT + '_esm2015/'; -const UMD_PKG = PKG_ROOT + 'bundles/'; -const SRC_ROOT_PKG = PKG_ROOT + 'src/'; -const TYPE_PKG = PKG_ROOT; - -// License info for minified files -let licenseUrl = 'https://github.com/ReactiveX/RxJS/blob/master/LICENSE.txt'; -let license = 'Apache License 2.0 ' + licenseUrl; - -delete pkg.scripts; -fs.removeSync(PKG_ROOT); - -let rootPackageJson = Object.assign({}, pkg, { - name: 'rxjs', - main: './index.js', - typings: './index.d.ts', - module: './_esm5/index.js', - es2015: './_esm2015/index.js' -}); - -// Execute build optimizer transforms on ESM5 files -klawSync(ESM5_ROOT, { - nodir: true, - filter: function(item) { - return item.path.endsWith('.js'); - } -}) -.map(item => item.path.slice((`${__dirname}/${ESM5_ROOT}`).length)) -.map(fileName => { - if (!bo) return fileName; - let fullPath = path.resolve(__dirname, ESM5_ROOT, fileName); - // The file won't exist when running build_test as we don't create the ESM5 sources - if (!fs.existsSync(fullPath)) return fileName; - let content = fs.readFileSync(fullPath).toString(); - let transformed = bo.transformJavascript({ - content: content, - getTransforms: [bo.getPrefixClassesTransformer, bo.getPrefixFunctionsTransformer, bo.getFoldFileTransformer] - }); - fs.writeFileSync(fullPath, transformed.content); - return fileName; -}); - -// Make the distribution folder -mkdirp.sync(PKG_ROOT); - -// Copy over the sources -copySources('src/', SRC_ROOT_PKG); - -copySources(CJS_ROOT, CJS_PKG); - -// Clean up the source maps for CJS sources -cleanSourceMapRoot(PKG_ROOT, SRC_ROOT_PKG); -fs.copySync(TYPE_ROOT, TYPE_PKG); - -copySources(ESM5_ROOT, ESM5_PKG, true); -cleanSourceMapRoot(ESM5_PKG, SRC_ROOT_PKG); -copySources(ESM2015_ROOT, ESM2015_PKG, true); -cleanSourceMapRoot(ESM2015_PKG, SRC_ROOT_PKG); - -// Copy over tsconfig.json for bazel build support -fs.copySync('./tsconfig.base.json', PKG_ROOT + 'src/tsconfig.json'); - -fs.writeJsonSync(PKG_ROOT + 'package.json', rootPackageJson, {spaces: 2}); -fs.copySync('src/operators/package.json', PKG_ROOT + '/operators/package.json'); -fs.copySync('src/ajax/package.json', PKG_ROOT + '/ajax/package.json'); -fs.copySync('src/fetch/package.json', PKG_ROOT + '/fetch/package.json'); -fs.copySync('src/webSocket/package.json', PKG_ROOT + '/webSocket/package.json'); -fs.copySync('src/testing/package.json', PKG_ROOT + '/testing/package.json'); - -if (fs.existsSync(UMD_ROOT)) { - fs.copySync(UMD_ROOT, UMD_PKG); - // Clean up source map paths so they can be re-mapped - klawSync(UMD_PKG, {filter: (item) => item.path.endsWith('.js.map')}) - .map(f => f.path) - .forEach(fName => { - const sourceMap = fs.readJsonSync(fName); - sourceMap.sources = sourceMap.sources.map(s => { - const nm = 'node_modules/'; - const rr = path.resolve(ESM5_FOR_ROLLUP_ROOT); - if (s.includes(nm)) { - return s.substring(s.indexOf(nm) + nm.length); - } else if (s.includes(rr)) { - return s.substring(s.indexOf(rr) + rr.length); - } - return s; - }); - fs.writeJsonSync(fName, sourceMap); - }); - - // Add licenses to tops of bundles - addLicenseToFile('LICENSE.txt', UMD_PKG + 'rxjs.umd.js'); - addLicenseTextToFile(license, UMD_PKG + 'rxjs.umd.min.js'); - addLicenseToFile('LICENSE.txt', UMD_PKG + 'rxjs.umd.js'); - addLicenseTextToFile(license, UMD_PKG + 'rxjs.umd.min.js'); - cleanSourceMapRoot(UMD_PKG, PKG_ROOT); -} - -// remove umd.js/umd.d.ts files that are only needed for creation of the umd bundle -fs.removeSync(CJS_PKG + '/internal/umd.js'); -fs.removeSync(CJS_PKG + '/internal/umd.js.map'); -fs.removeSync(ESM5_PKG + '/internal/umd.js'); -fs.removeSync(ESM5_PKG + '/internal/umd.js.map'); -fs.removeSync(ESM2015_PKG + '/internal/umd.js'); -fs.removeSync(ESM2015_PKG + '/internal/umd.js.map'); -fs.removeSync(TYPE_PKG + '/internal/umd.d.ts'); diff --git a/.npmignore b/.npmignore deleted file mode 100644 index 15c1529e88..0000000000 --- a/.npmignore +++ /dev/null @@ -1,7 +0,0 @@ -perf -spec -.git -yarn.lock -coverage -typings/ -docs_app \ No newline at end of file diff --git a/index.js b/index.js deleted file mode 100644 index 6c3b0dc179..0000000000 --- a/index.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = require('./dist/package/Rx'); diff --git a/integration/side-effects/side-effects.json b/integration/side-effects/side-effects.json index af8a31c18b..b02f7b1d45 100644 --- a/integration/side-effects/side-effects.json +++ b/integration/side-effects/side-effects.json @@ -5,48 +5,48 @@ "expectedOutput": "./snapshots/esm5/index.js" }, { - "esModules": "../../dist/esm2015/index.js", - "expectedOutput": "./snapshots/esm2015/index.js" + "esModules": "../../dist/esm/index.js", + "expectedOutput": "./snapshots/esm/index.js" }, { "esModules": "../../dist/esm5/ajax/index.js", "expectedOutput": "./snapshots/esm5/ajax.js" }, { - "esModules": "../../dist/esm2015/ajax/index.js", - "expectedOutput": "./snapshots/esm2015/ajax.js" + "esModules": "../../dist/esm/ajax/index.js", + "expectedOutput": "./snapshots/esm/ajax.js" }, { "esModules": "../../dist/esm5/fetch/index.js", "expectedOutput": "./snapshots/esm5/fetch.js" }, { - "esModules": "../../dist/esm2015/fetch/index.js", - "expectedOutput": "./snapshots/esm2015/fetch.js" + "esModules": "../../dist/esm/fetch/index.js", + "expectedOutput": "./snapshots/esm/fetch.js" }, { "esModules": "../../dist/esm5/operators/index.js", "expectedOutput": "./snapshots/esm5/operators.js" }, { - "esModules": "../../dist/esm2015/operators/index.js", - "expectedOutput": "./snapshots/esm2015/operators.js" + "esModules": "../../dist/esm/operators/index.js", + "expectedOutput": "./snapshots/esm/operators.js" }, { "esModules": "../../dist/esm5/testing/index.js", "expectedOutput": "./snapshots/esm5/testing.js" }, { - "esModules": "../../dist/esm2015/testing/index.js", - "expectedOutput": "./snapshots/esm2015/testing.js" + "esModules": "../../dist/esm/testing/index.js", + "expectedOutput": "./snapshots/esm/testing.js" }, { "esModules": "../../dist/esm5/webSocket/index.js", "expectedOutput": "./snapshots/esm5/websocket.js" }, { - "esModules": "../../dist/esm2015/webSocket/index.js", - "expectedOutput": "./snapshots/esm2015/websocket.js" + "esModules": "../../dist/esm/webSocket/index.js", + "expectedOutput": "./snapshots/esm/websocket.js" } ] } diff --git a/integration/side-effects/snapshots/esm/ajax.js b/integration/side-effects/snapshots/esm/ajax.js new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/integration/side-effects/snapshots/esm/ajax.js @@ -0,0 +1 @@ + diff --git a/integration/side-effects/snapshots/esm/fetch.js b/integration/side-effects/snapshots/esm/fetch.js new file mode 100644 index 0000000000..8b13789179 --- /dev/null +++ b/integration/side-effects/snapshots/esm/fetch.js @@ -0,0 +1 @@ + diff --git a/integration/side-effects/snapshots/esm/index.js b/integration/side-effects/snapshots/esm/index.js new file mode 100644 index 0000000000..792fba30c0 --- /dev/null +++ b/integration/side-effects/snapshots/esm/index.js @@ -0,0 +1,7 @@ +var NotificationKind; + +(function(NotificationKind) { + NotificationKind["NEXT"] = "N"; + NotificationKind["ERROR"] = "E"; + NotificationKind["COMPLETE"] = "C"; +})(NotificationKind || (NotificationKind = {})); diff --git a/integration/side-effects/snapshots/esm/operators.js b/integration/side-effects/snapshots/esm/operators.js new file mode 100644 index 0000000000..792fba30c0 --- /dev/null +++ b/integration/side-effects/snapshots/esm/operators.js @@ -0,0 +1,7 @@ +var NotificationKind; + +(function(NotificationKind) { + NotificationKind["NEXT"] = "N"; + NotificationKind["ERROR"] = "E"; + NotificationKind["COMPLETE"] = "C"; +})(NotificationKind || (NotificationKind = {})); diff --git a/integration/side-effects/snapshots/esm/testing.js b/integration/side-effects/snapshots/esm/testing.js new file mode 100644 index 0000000000..792fba30c0 --- /dev/null +++ b/integration/side-effects/snapshots/esm/testing.js @@ -0,0 +1,7 @@ +var NotificationKind; + +(function(NotificationKind) { + NotificationKind["NEXT"] = "N"; + NotificationKind["ERROR"] = "E"; + NotificationKind["COMPLETE"] = "C"; +})(NotificationKind || (NotificationKind = {})); diff --git a/integration/side-effects/snapshots/esm/websocket.js b/integration/side-effects/snapshots/esm/websocket.js new file mode 100644 index 0000000000..792fba30c0 --- /dev/null +++ b/integration/side-effects/snapshots/esm/websocket.js @@ -0,0 +1,7 @@ +var NotificationKind; + +(function(NotificationKind) { + NotificationKind["NEXT"] = "N"; + NotificationKind["ERROR"] = "E"; + NotificationKind["COMPLETE"] = "C"; +})(NotificationKind || (NotificationKind = {})); diff --git a/integration/side-effects/snapshots/esm5/index.js b/integration/side-effects/snapshots/esm5/index.js index 5d63e0559f..70c2dab83c 100644 --- a/integration/side-effects/snapshots/esm5/index.js +++ b/integration/side-effects/snapshots/esm5/index.js @@ -1 +1,9 @@ import "tslib"; + +var NotificationKind; + +(function(NotificationKind) { + NotificationKind["NEXT"] = "N"; + NotificationKind["ERROR"] = "E"; + NotificationKind["COMPLETE"] = "C"; +})(NotificationKind || (NotificationKind = {})); diff --git a/integration/side-effects/snapshots/esm5/operators.js b/integration/side-effects/snapshots/esm5/operators.js index 5d63e0559f..70c2dab83c 100644 --- a/integration/side-effects/snapshots/esm5/operators.js +++ b/integration/side-effects/snapshots/esm5/operators.js @@ -1 +1,9 @@ import "tslib"; + +var NotificationKind; + +(function(NotificationKind) { + NotificationKind["NEXT"] = "N"; + NotificationKind["ERROR"] = "E"; + NotificationKind["COMPLETE"] = "C"; +})(NotificationKind || (NotificationKind = {})); diff --git a/integration/side-effects/snapshots/esm5/testing.js b/integration/side-effects/snapshots/esm5/testing.js index 5d63e0559f..70c2dab83c 100644 --- a/integration/side-effects/snapshots/esm5/testing.js +++ b/integration/side-effects/snapshots/esm5/testing.js @@ -1 +1,9 @@ import "tslib"; + +var NotificationKind; + +(function(NotificationKind) { + NotificationKind["NEXT"] = "N"; + NotificationKind["ERROR"] = "E"; + NotificationKind["COMPLETE"] = "C"; +})(NotificationKind || (NotificationKind = {})); diff --git a/integration/side-effects/snapshots/esm5/websocket.js b/integration/side-effects/snapshots/esm5/websocket.js index 5d63e0559f..70c2dab83c 100644 --- a/integration/side-effects/snapshots/esm5/websocket.js +++ b/integration/side-effects/snapshots/esm5/websocket.js @@ -1 +1,9 @@ import "tslib"; + +var NotificationKind; + +(function(NotificationKind) { + NotificationKind["NEXT"] = "N"; + NotificationKind["ERROR"] = "E"; + NotificationKind["COMPLETE"] = "C"; +})(NotificationKind || (NotificationKind = {})); diff --git a/integration/systemjs/systemjs-compatibility-spec.js b/integration/systemjs/systemjs-compatibility-spec.js index cb1713c2c5..c9e06d152e 100644 --- a/integration/systemjs/systemjs-compatibility-spec.js +++ b/integration/systemjs/systemjs-compatibility-spec.js @@ -2,7 +2,7 @@ var System = require('systemjs'); var path = require('path'); System.config({ - map: { 'rxjs': path.join(__dirname, '..', '..', 'dist', 'package', '/') }, + map: { 'rxjs': path.join(__dirname, '..', '..', 'dist', 'cjs', '/') }, packages: { 'rxjs': {main: 'index.js', defaultExtension: 'js' }, 'rxjs/ajax': {main: 'index.js', defaultExtension: 'js' }, diff --git a/package-lock.json b/package-lock.json index 582650a554..893f37966b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,5 +1,5 @@ { - "name": "@reactivex/rxjs", + "name": "rxjs", "version": "7.0.0-alpha.0", "lockfileVersion": 1, "requires": true, @@ -92,68 +92,6 @@ } } }, - "@commitlint/execute-rule": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@commitlint/execute-rule/-/execute-rule-8.1.0.tgz", - "integrity": "sha512-+vpH3RFuO6ypuCqhP2rSqTjFTQ7ClzXtUvXphpROv9v9+7zH4L+Ex+wZLVkL8Xj2cxefSLn/5Kcqa9XyJTn3kg==", - "dev": true, - "optional": true - }, - "@commitlint/load": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@commitlint/load/-/load-8.1.0.tgz", - "integrity": "sha512-ra02Dvmd7Gp1+uFLzTY3yGOpHjPzl5T9wYg/xrtPJNiOWXvQ0Mw7THw+ucd1M5iLUWjvdavv2N87YDRc428wHg==", - "dev": true, - "optional": true, - "requires": { - "@commitlint/execute-rule": "^8.1.0", - "@commitlint/resolve-extends": "^8.1.0", - "babel-runtime": "^6.23.0", - "chalk": "2.4.2", - "cosmiconfig": "^5.2.0", - "lodash": "4.17.14", - "resolve-from": "^5.0.0" - }, - "dependencies": { - "lodash": { - "version": "4.17.14", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", - "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==", - "dev": true, - "optional": true - } - } - }, - "@commitlint/resolve-extends": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/@commitlint/resolve-extends/-/resolve-extends-8.1.0.tgz", - "integrity": "sha512-r/y+CeKW72Oa9BUctS1+I/MFCDiI3lfhwfQ65Tpfn6eZ4CuBYKzrCRi++GTHeAFKE3y8q1epJq5Rl/1GBejtBw==", - "dev": true, - "optional": true, - "requires": { - "@types/node": "^12.0.2", - "import-fresh": "^3.0.0", - "lodash": "4.17.14", - "resolve-from": "^5.0.0", - "resolve-global": "^1.0.0" - }, - "dependencies": { - "@types/node": { - "version": "12.7.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-12.7.4.tgz", - "integrity": "sha512-W0+n1Y+gK/8G2P/piTkBBN38Qc5Q1ZSO6B5H3QmPCUewaiXOo2GCAWZ4ElZCcNhjJuBSUSLGFUJnmlCn5+nxOQ==", - "dev": true, - "optional": true - }, - "lodash": { - "version": "4.17.14", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", - "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==", - "dev": true, - "optional": true - } - } - }, "@phenomnomnominal/tsquery": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@phenomnomnominal/tsquery/-/tsquery-3.0.0.tgz", @@ -737,12 +675,6 @@ "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", "dev": true }, - "async": { - "version": "1.5.2", - "resolved": "https://registry.npmjs.org/async/-/async-1.5.2.tgz", - "integrity": "sha1-7GphrlZIDAw8skHJVhjiCJL5Zyo=", - "dev": true - }, "async-each": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.3.tgz", @@ -937,16 +869,6 @@ "tweetnacl": "^0.14.3" } }, - "benchmark": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/benchmark/-/benchmark-2.1.0.tgz", - "integrity": "sha1-fWPHu0PkVwTj4TK67g9I53D+oLg=", - "dev": true, - "requires": { - "lodash": "^4.0.1", - "platform": "^1.3.1" - } - }, "big.js": { "version": "5.2.2", "resolved": "https://registry.npmjs.org/big.js/-/big.js-5.2.2.tgz", @@ -1216,12 +1138,6 @@ "unset-value": "^1.0.0" } }, - "cachedir": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cachedir/-/cachedir-2.2.0.tgz", - "integrity": "sha512-VvxA0xhNqIIfg0V9AmJkDg91DaJwryutH5rVEZAhcNi4iJFj9f+QxmAjgK1LT9I8OgToX27fypX6/MeCXVbBjQ==", - "dev": true - }, "caller-callsite": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/caller-callsite/-/caller-callsite-2.0.0.tgz", @@ -1248,13 +1164,6 @@ "caller-callsite": "^2.0.0" } }, - "callsites": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-3.1.0.tgz", - "integrity": "sha512-P8BjAsXvZS+VIDUI11hHCQEv74YT67YUi5JJFNWIqL235sBmjX4+qx9Muvls5ivyNENctx46xQLQ3aTuE7ssaQ==", - "dev": true, - "optional": true - }, "camelcase": { "version": "5.3.1", "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", @@ -1727,71 +1636,6 @@ "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "dev": true }, - "commitizen": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/commitizen/-/commitizen-4.0.3.tgz", - "integrity": "sha512-lxu0F/Iq4dudoFeIl5pY3h3CQJzkmQuh3ygnaOvqhAD8Wu2pYBI17ofqSuPHNsBTEOh1r1AVa9kR4Hp0FAHKcQ==", - "dev": true, - "requires": { - "cachedir": "2.2.0", - "cz-conventional-changelog": "3.0.1", - "dedent": "0.7.0", - "detect-indent": "6.0.0", - "find-node-modules": "2.0.0", - "find-root": "1.1.0", - "fs-extra": "8.1.0", - "glob": "7.1.4", - "inquirer": "6.5.0", - "is-utf8": "^0.2.1", - "lodash": "4.17.15", - "minimist": "1.2.0", - "shelljs": "0.7.6", - "strip-bom": "4.0.0", - "strip-json-comments": "3.0.1" - }, - "dependencies": { - "cz-conventional-changelog": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-3.0.1.tgz", - "integrity": "sha512-7KASIwB8/ClEyCRvQrCPbN7WkQnUSjSSVNyPM+gDJ0jskLi8h8N2hrdpyeCk7fIqKMRzziqVSOBTB8yyLTMHGQ==", - "dev": true, - "requires": { - "@commitlint/load": ">6.1.1", - "chalk": "^2.4.1", - "conventional-commit-types": "^2.0.0", - "lodash.map": "^4.5.1", - "longest": "^2.0.1", - "right-pad": "^1.0.1", - "word-wrap": "^1.0.3" - } - }, - "fs-extra": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", - "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", - "dev": true, - "requires": { - "graceful-fs": "^4.2.0", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "glob": { - "version": "7.1.4", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz", - "integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - } - } - }, "commondir": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", @@ -2258,18 +2102,6 @@ "minimalistic-assert": "^1.0.0" } }, - "detect-file": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/detect-file/-/detect-file-1.0.0.tgz", - "integrity": "sha1-8NZtA2cqglyxtzvbP+YjEMjlUrc=", - "dev": true - }, - "detect-indent": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-6.0.0.tgz", - "integrity": "sha512-oSyFlqaTHCItVRGK5RmrmjB+CmaMOW7IaNA/kdxqhoa6d17j/5ce9O9eWXmV/KEdRwqpQA+Vqe8a8Bsybu4YnA==", - "dev": true - }, "diff": { "version": "3.5.0", "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", @@ -2870,15 +2702,6 @@ } } }, - "expand-tilde": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/expand-tilde/-/expand-tilde-2.0.2.tgz", - "integrity": "sha1-l+gBqgUt8CRU3kawK/YhZCzchQI=", - "dev": true, - "requires": { - "homedir-polyfill": "^1.0.1" - } - }, "extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", @@ -3071,28 +2894,12 @@ "pkg-dir": "^3.0.0" } }, - "find-node-modules": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/find-node-modules/-/find-node-modules-2.0.0.tgz", - "integrity": "sha512-8MWIBRgJi/WpjjfVXumjPKCtmQ10B+fjx6zmSA+770GMJirLhWIzg8l763rhjl9xaeaHbnxPNRQKq2mgMhr+aw==", - "dev": true, - "requires": { - "findup-sync": "^3.0.0", - "merge": "^1.2.1" - } - }, "find-parent-dir": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/find-parent-dir/-/find-parent-dir-0.3.0.tgz", "integrity": "sha1-M8RLQpqysvBkYpnF+fcY83b/jVQ=", "dev": true }, - "find-root": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/find-root/-/find-root-1.1.0.tgz", - "integrity": "sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng==", - "dev": true - }, "find-up": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", @@ -3126,18 +2933,6 @@ } } }, - "findup-sync": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-3.0.0.tgz", - "integrity": "sha512-YbffarhcicEhOrm4CtrwdKBdCuz576RLdhJDsIfvNtxUuhdRet1qZcsMjqbePtAseKdAnDyM/IyXbu7PRPRLYg==", - "dev": true, - "requires": { - "detect-file": "^1.0.0", - "is-glob": "^4.0.0", - "micromatch": "^3.0.4", - "resolve-dir": "^1.0.1" - } - }, "flat-cache": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz", @@ -3215,12 +3010,12 @@ } }, "fs-extra": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-5.0.0.tgz", - "integrity": "sha512-66Pm4RYbjzdyeuqudYqhFiNBbCIuI9kgRqLPSHIlXHidW8NIQtVdkM1yeZ4lXwuhbTETv3EUGMNHAAw6hiundQ==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", "dev": true, "requires": { - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.2.0", "jsonfile": "^4.0.0", "universalify": "^0.1.0" } @@ -3880,28 +3675,12 @@ "simple-git": "^1.85.0" } }, - "gar": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/gar/-/gar-1.0.4.tgz", - "integrity": "sha512-w4n9cPWyP7aHxKxYHFQMegj7WIAsL/YX/C4Bs5Rr8s1H9M1rNtRWRsw+ovYMkXDQ5S4ZbYHsHAPmevPjPgw44w==", - "dev": true - }, "get-caller-file": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.3.tgz", "integrity": "sha512-3t6rVToeoZfYSGd8YoLFR2DJkiQrIiUrGcjvFX2mDw3bn6k2OtwHN0TNCLbBO+w8qTvimhDkv+LSscbJY1vE6w==", "dev": true }, - "get-folder-size": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/get-folder-size/-/get-folder-size-1.0.1.tgz", - "integrity": "sha1-gC+kIIQ03nEgUYKxWrfxNSCI5YA=", - "dev": true, - "requires": { - "async": "^1.4.2", - "gar": "^1.0.2" - } - }, "get-func-name": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", @@ -3979,40 +3758,6 @@ } } }, - "global-dirs": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/global-dirs/-/global-dirs-0.1.1.tgz", - "integrity": "sha1-sxnA3UYH81PzvpzKTHL8FIxJ9EU=", - "dev": true, - "optional": true, - "requires": { - "ini": "^1.3.4" - } - }, - "global-modules": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/global-modules/-/global-modules-1.0.0.tgz", - "integrity": "sha512-sKzpEkf11GpOFuw0Zzjzmt4B4UZwjOcG757PPvrfhxcLFbq0wpsgpOqxpxtxFiCG4DtG93M6XRVbF2oGdev7bg==", - "dev": true, - "requires": { - "global-prefix": "^1.0.1", - "is-windows": "^1.0.1", - "resolve-dir": "^1.0.0" - } - }, - "global-prefix": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/global-prefix/-/global-prefix-1.0.2.tgz", - "integrity": "sha1-2/dDxsFJklk8ZVVoy2btMsASLr4=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.2", - "homedir-polyfill": "^1.0.1", - "ini": "^1.3.4", - "is-windows": "^1.0.1", - "which": "^1.2.14" - } - }, "globals": { "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", @@ -4102,16 +3847,6 @@ "integrity": "sha512-hKlsbA5Vu3xsh1Cg3J7jSmX/WaW6A5oBeqzM88oNbCRQFz+zUaXm6yxS4RVytp1scBoJzSYl4YAEOQIt6O8V1Q==", "dev": true }, - "gzip-size": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/gzip-size/-/gzip-size-4.1.0.tgz", - "integrity": "sha1-iuCWJX6r59acRb4rZ8RIEk/7UXw=", - "dev": true, - "requires": { - "duplexer": "^0.1.1", - "pify": "^3.0.0" - } - }, "handlebars": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", @@ -4255,15 +3990,6 @@ "minimalistic-crypto-utils": "^1.0.1" } }, - "homedir-polyfill": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/homedir-polyfill/-/homedir-polyfill-1.0.3.tgz", - "integrity": "sha512-eSmmWE5bZTK2Nou4g0AI3zZ9rswp7GRKoKXS1BLUkvPviOqs4YTN1djQIqrXy9k5gEtdLPy86JjRwsNM9tnDcA==", - "dev": true, - "requires": { - "parse-passwd": "^1.0.0" - } - }, "hosted-git-info": { "version": "2.8.4", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.8.4.tgz", @@ -4314,26 +4040,6 @@ "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", "dev": true }, - "import-fresh": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.1.0.tgz", - "integrity": "sha512-PpuksHKGt8rXfWEr9m9EHIpgyyaltBy8+eF6GJM0QCAxMgxCfucMF3mjecK2QsJr0amJW7gTqh5/wht0z2UhEQ==", - "dev": true, - "optional": true, - "requires": { - "parent-module": "^1.0.0", - "resolve-from": "^4.0.0" - }, - "dependencies": { - "resolve-from": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", - "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", - "dev": true, - "optional": true - } - } - }, "imurmurhash": { "version": "0.1.4", "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", @@ -4368,12 +4074,6 @@ "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", "dev": true }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true - }, "inquirer": { "version": "6.5.0", "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.5.0.tgz", @@ -5154,12 +4854,6 @@ "integrity": "sha512-l9x0+1offnKKIzYVjyXU2SiwhXDLekRzKyhnbyldPHvC7BvLPVpdNUNR2KeMAiCN2D/kLNttZgQD5WjSxuBx3Q==", "dev": true }, - "longest": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/longest/-/longest-2.0.1.tgz", - "integrity": "sha1-eB4YMpaqlPbU2RbcM10NF676I/g=", - "dev": true - }, "loud-rejection": { "version": "1.6.0", "resolved": "https://registry.npmjs.org/loud-rejection/-/loud-rejection-1.6.0.tgz", @@ -5334,12 +5028,6 @@ "trim-newlines": "^1.0.0" } }, - "merge": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/merge/-/merge-1.2.1.tgz", - "integrity": "sha512-VjFo4P5Whtj4vsLzsYBu5ayHhoHJ0UqNm7ibvShmbmoz7tGi0vXaoJbGdB+GmDMLUdg8DpQXEIeVDAe8MaABvQ==", - "dev": true - }, "merge-stream": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz", @@ -6009,16 +5697,6 @@ "readable-stream": "^2.1.5" } }, - "parent-module": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/parent-module/-/parent-module-1.0.1.tgz", - "integrity": "sha512-GQ2EWRpQV8/o+Aw8YqtfZZPfNRWZYkbidE9k5rpl/hC3vtHHBfGm2Ifi6qWV+coDGkrUKZAxE3Lot5kcsRlh+g==", - "dev": true, - "optional": true, - "requires": { - "callsites": "^3.0.0" - } - }, "parse-asn1": { "version": "5.1.4", "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.4.tgz", @@ -6043,12 +5721,6 @@ "json-parse-better-errors": "^1.0.1" } }, - "parse-passwd": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/parse-passwd/-/parse-passwd-1.0.0.tgz", - "integrity": "sha1-bVuTSkVpk7I9N/QKOC1vFmao5cY=", - "dev": true - }, "parsimmon": { "version": "1.13.0", "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-1.13.0.tgz", @@ -6685,33 +6357,6 @@ "path-parse": "^1.0.6" } }, - "resolve-dir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-dir/-/resolve-dir-1.0.1.tgz", - "integrity": "sha1-eaQGRMNivoLybv/nOcm7U4IEb0M=", - "dev": true, - "requires": { - "expand-tilde": "^2.0.0", - "global-modules": "^1.0.0" - } - }, - "resolve-from": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-5.0.0.tgz", - "integrity": "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==", - "dev": true, - "optional": true - }, - "resolve-global": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/resolve-global/-/resolve-global-1.0.0.tgz", - "integrity": "sha512-zFa12V4OLtT5XUX/Q4VLvTfBf+Ok0SPc1FNGM/z9ctUdiU618qwKpWnd0CHs3+RqROfyEg/DhuHbMWYqcgljEw==", - "dev": true, - "optional": true, - "requires": { - "global-dirs": "^0.1.1" - } - }, "resolve-url": { "version": "0.2.1", "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", @@ -7548,12 +7193,6 @@ } } }, - "strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true - }, "strip-eof": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", @@ -7577,12 +7216,6 @@ } } }, - "strip-json-comments": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", - "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", - "dev": true - }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", diff --git a/package.json b/package.json index 34c006ab20..a8ae30e409 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,11 @@ { - "name": "@reactivex/rxjs", + "name": "rxjs", "version": "7.0.0-alpha.0", "description": "Reactive Extensions for modern JavaScript", - "main": "index.js", + "main": "./dist/cjs/index.js", + "module": "./dist/esm5/index.js", + "es2015": "./dist/esm/index.js", + "types": "./dist/types/index.d.ts", "sideEffects": false, "config": { "commitizen": { @@ -22,53 +25,26 @@ "scripts": { "precommit": "lint-staged", "commitmsg": "validate-commit-msg", - "build_all": "npm-run-all clean_dist copy_sources build_cjs build_esm5 build_esm2015 build_esm5_for_rollup build_umd build_types generate_packages", - "build_cjs": "npm-run-all clean_dist_cjs compile_dist_cjs", - "build_esm5": "npm-run-all clean_dist_esm5 compile_dist_esm5", - "build_esm5_for_rollup": "npm-run-all clean_dist_esm5_for_rollup compile_dist_esm5_for_rollup && mkdirp dist/esm5_for_rollup/node_modules", - "build_esm2015": "npm-run-all clean_dist_esm2015 compile_dist_esm2015", - "build_types": "npm-run-all clean_dist_types compile_dist_types", - "build_closure_core": "node ./tools/make-closure-core.js", - "build_global": "npm-run-all clean_dist_global build_esm5_for_rollup && mkdirp ./dist/global && node ./tools/make-umd-bundle.js && npm-run-all build_closure_core clean_dist_esm5_for_rollup", - "build_umd": "npm-run-all clean_dist_global && mkdirp ./dist/global && node ./tools/make-umd-bundle.js && npm-run-all build_closure_core", - "build_perf": "webdriver-manager update && npm-run-all build_cjs build_global perf", - "build_spec": "npm-run-all build_cjs generate_packages", - "build_spec_full": "npm-run-all build_spec", "build:spec:browser": "echo \"Browser test is not working currently\" && exit -1 && webpack --config spec/support/webpack.mocha.config.js", - "clean_dist": "shx rm -rf ./dist", - "clean_dist_cjs": "shx rm -rf ./dist/cjs", - "clean_dist_esm5": "shx rm -rf ./dist/esm5", - "clean_dist_esm5_for_rollup": "shx rm -rf ./dist/esm5_for_rollup", - "clean_dist_esm2015": "shx rm -rf ./dist/esm2015", - "clean_dist_global": "shx rm -rf ./dist/global", - "clean_dist_types": "shx rm -rf ./dist/typings", - "commit": "git-cz", - "compile_dist_cjs": "tsc -p ./tsconfig/tsconfig.cjs.json", - "compile_dist_esm5": "tsc -p ./tsconfig/tsconfig.esm5.json", - "compile_dist_esm2015": "tsc -p ./tsconfig/tsconfig.esm2015.json", - "compile_dist_esm5_for_rollup": "tsc -p ./tsconfig/tsconfig.esm5.rollup.json", - "compile_dist_types": "tsc -p ./tsconfig/tsconfig.types.json", - "copy_sources": "mkdirp dist && shx cp -r ./src/ ./dist/src", "decision_tree_widget": "cd doc/decision-tree-widget && npm run build && cd ../..", - "generate_packages": "node .make-packages.js", - "lint_perf": "eslint perf/", "lint_spec": "tslint -c tslint.json \"spec/**/*.ts\"", "lint_src": "tslint -c tslint.json \"src/**/*.ts\"", "lint": "npm-run-all --parallel lint_*", - "dtslint": "npm run build_types && dtslint --localTs ./node_modules/typescript/lib --expectOnly ./spec-dtslint", - "perf:micro": "node ./perf/micro/index.js", - "prepublish": "shx rm -rf ./typings && npm run build_all", + "dtslint": "npm run compile && dtslint --localTs ./node_modules/typescript/lib --expectOnly ./spec-dtslint", + "prepublishOnly": "npm run build:package", "postpublish": "./docs_app/scripts/publish-docs.sh", "publish_docs": "./publish_docs.sh", - "test": "cross-env TS_NODE_PROJECT=spec/tsconfig.json mocha --opts spec/support/default.opts \"spec/**/*-spec.ts\"", - "test_no_cache": "cross-env TS_NODE_PROJECT=spec/tsconfig.json TS_NODE_CACHE=false mocha --opts spec/support/default.opts \"spec/**/*-spec.ts\"", - "test_transpile_only": "cross-env TS_NODE_PROJECT=spec/tsconfig.json TS_NODE_TRANSPILE_ONLY=true mocha --opts spec/support/default.opts \"spec/**/*-spec.ts\"", + "test": "npm run compile && shx cp -Rf ./dist/cjs ./dist/src && mocha --opts spec/support/default.opts \"dist/spec/**/*-spec.js\"", "test:browser": "echo \"Browser test is not working currently\" && exit -1 && npm-run-all build:spec:browser && opn spec/support/mocha-browser-runner.html", "test:circular": "dependency-cruise --validate .dependency-cruiser.json -x \"^node_modules\" dist/esm5", "test:systemjs": "node integration/systemjs/systemjs-compatibility-spec.js", "test:side-effects": "check-side-effects --test integration/side-effects/side-effects.json", "test:side-effects:update": "npm run test:side-effects -- --update", - "tests2png": "mkdirp docs_app/content/img && mocha --opts spec/support/tests2png.opts \"spec/**/*-spec.ts\"" + "tests2png": "mkdirp docs_app/content/img && mocha --opts spec/support/tests2png.opts \"spec/**/*-spec.ts\"", + "compile": "tsc -b --verbose ./src/tsconfig.cjs.json ./src/tsconfig.esm.json ./src/tsconfig.esm5.json ./src/tsconfig.esm5.rollup.json ./src/tsconfig.types.json ./spec/tsconfig.json", + "build:clean": "shx rm -rf ./dist", + "build:global": "node ./tools/make-umd-bundle.js && node ./tools/make-closure-core.js", + "build:package": "npm-run-all build:clean compile build:global && node ./tools/prepare-package.js && node ./tools/generate-alias.js" }, "repository": { "type": "git", @@ -132,12 +108,10 @@ "@types/sinon-chai": "2.7.29", "@types/source-map": "^0.5.2", "babel-polyfill": "6.26.0", - "benchmark": "2.1.0", "chai": "4.1.2", "check-side-effects": "0.0.20", "color": "3.0.0", "colors": "1.1.2", - "commitizen": "^4.0.3", "cross-env": "5.1.3", "cz-conventional-changelog": "1.2.0", "dependency-cruiser": "^4.27.3", @@ -145,12 +119,10 @@ "escape-string-regexp": "1.0.5", "eslint": "4.17.0", "eslint-plugin-jasmine": "^2.10.1", - "fs-extra": "5.0.0", - "get-folder-size": "1.0.1", + "fs-extra": "^8.1.0", "glob": "7.1.2", "gm": "1.23.1", "google-closure-compiler-js": "20170218.0.0", - "gzip-size": "4.1.0", "klaw-sync": "3.0.2", "lint-staged": "^8.1.6", "lodash": "^4.17.15", @@ -180,8 +152,23 @@ "validate-commit-msg": "2.14.0", "webpack": "^4.31.0" }, - "engines": { - "npm": ">=2.0.0" - }, - "typings": "./dist/package/Rx.d.ts" + "files": [ + "dist/bundles", + "dist/cjs/**/!(*.tsbuildinfo)", + "dist/esm/**/!(*.tsbuildinfo)", + "dist/esm5/**/!(*.tsbuildinfo)", + "dist/types/**/!(*.tsbuildinfo)", + "ajax", + "fetch", + "operators", + "testing", + "webSocket", + "src", + "CHANGELOG.md", + "CODE_OF_CONDUCT.md", + "LICENSE.txt", + "package.json", + "README.md", + "tsconfig.json" + ] } diff --git a/spec/observables/dom/animationFrames-spec.ts b/spec/observables/dom/animationFrames-spec.ts index 91fce1d060..afd6df5643 100644 --- a/spec/observables/dom/animationFrames-spec.ts +++ b/spec/observables/dom/animationFrames-spec.ts @@ -2,7 +2,7 @@ import { expect } from 'chai'; import { animationFrames, Subject } from 'rxjs'; import * as sinon from 'sinon'; import { take, takeUntil } from 'rxjs/operators'; -import { RAFTestTools, stubRAF } from 'spec/helpers/test-helper'; +import { RAFTestTools, stubRAF } from '../../helpers/test-helper'; describe('animationFrame', () => { let raf: RAFTestTools; diff --git a/spec/support/default.opts b/spec/support/default.opts index 32264362e9..00d7c3f3e6 100644 --- a/spec/support/default.opts +++ b/spec/support/default.opts @@ -1,8 +1,8 @@ --require ts-node/register --require tsconfig-paths/register ---require spec/helpers/polyfills.ts ---require spec/helpers/testScheduler-ui.ts ---ui spec/helpers/testScheduler-ui.ts +--require dist/spec/helpers/polyfills.js +--require dist/spec/helpers/testScheduler-ui.js +--ui dist/spec/helpers/testScheduler-ui.js --reporter dot diff --git a/spec/tsconfig.json b/spec/tsconfig.json index 8b4ff64231..16f791edd5 100644 --- a/spec/tsconfig.json +++ b/spec/tsconfig.json @@ -1,3 +1,14 @@ { - "extends": "../tsconfig.json" + "extends": "../tsconfig.json", + "compilerOptions": { + "noEmit": false, + "outDir": "../dist/spec", + "target": "es5", + "module": "commonjs" + }, + "references": [ + { + "path": "../src/tsconfig.types.json" + } + ] } \ No newline at end of file diff --git a/src/ajax/package.json b/src/ajax/package.json deleted file mode 100644 index 898cd05dd7..0000000000 --- a/src/ajax/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "rxjs/ajax", - "typings": "./index.d.ts", - "main": "./index.js", - "module": "../_esm5/ajax/index.js", - "es2015": "../_esm2015/ajax/index.js", - "sideEffects": false -} diff --git a/src/fetch/package.json b/src/fetch/package.json deleted file mode 100644 index dff5519633..0000000000 --- a/src/fetch/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "rxjs/fetch", - "typings": "./index.d.ts", - "main": "./index.js", - "module": "../_esm5/fetch/index.js", - "es2015": "../_esm2015/fetch/index.js", - "sideEffects": false -} diff --git a/src/operators/package.json b/src/operators/package.json deleted file mode 100644 index eefac38c61..0000000000 --- a/src/operators/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "rxjs/operators", - "typings": "./index.d.ts", - "main": "./index.js", - "module": "../_esm5/operators/index.js", - "es2015": "../_esm2015/operators/index.js", - "sideEffects": false -} diff --git a/src/testing/package.json b/src/testing/package.json deleted file mode 100644 index 1a11a9f088..0000000000 --- a/src/testing/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "rxjs/testing", - "typings": "./index.d.ts", - "main": "./index.js", - "module": "../_esm5/testing/index.js", - "es2015": "../_esm2015/testing/index.js", - "sideEffects": false -} diff --git a/src/tsconfig.base.json b/src/tsconfig.base.json new file mode 100644 index 0000000000..447e1a4f6a --- /dev/null +++ b/src/tsconfig.base.json @@ -0,0 +1,14 @@ +{ + "extends": "../tsconfig.json", + "compilerOptions": { + "noEmit": false, + "baseUrl": ".", + "paths": { + "rxjs": ["./"], + "rxjs/*": ["./*"] + } + }, + "include": [ + "./**/*.ts" + ] +} diff --git a/tsconfig/tsconfig.cjs.json b/src/tsconfig.cjs.json similarity index 74% rename from tsconfig/tsconfig.cjs.json rename to src/tsconfig.cjs.json index 8c6a8c29a3..e3f65420c7 100644 --- a/tsconfig/tsconfig.cjs.json +++ b/src/tsconfig.cjs.json @@ -4,5 +4,8 @@ "module": "commonjs", "target": "es5", "outDir": "../dist/cjs" - } + }, + "exclude": [ + "./internal/umd.ts" + ] } \ No newline at end of file diff --git a/tsconfig/tsconfig.esm2015.json b/src/tsconfig.esm.json similarity index 57% rename from tsconfig/tsconfig.esm2015.json rename to src/tsconfig.esm.json index d974ef0120..76e710d477 100644 --- a/tsconfig/tsconfig.esm2015.json +++ b/src/tsconfig.esm.json @@ -1,10 +1,9 @@ { "extends": "./tsconfig.base.json", "compilerOptions": { - "module": "es2015", + "module": "esnext", "importHelpers": true, - "moduleResolution": "node", "target": "es2015", - "outDir": "../dist/esm2015" + "outDir": "../dist/esm" } } \ No newline at end of file diff --git a/tsconfig/tsconfig.esm5.json b/src/tsconfig.esm5.json similarity index 66% rename from tsconfig/tsconfig.esm5.json rename to src/tsconfig.esm5.json index d2c71f9f8f..830c221431 100644 --- a/tsconfig/tsconfig.esm5.json +++ b/src/tsconfig.esm5.json @@ -1,10 +1,12 @@ { "extends": "./tsconfig.base.json", "compilerOptions": { - "module": "es2015", + "module": "esnext", "importHelpers": true, - "moduleResolution": "node", "target": "es5", "outDir": "../dist/esm5" - } + }, + "exclude": [ + "./internal/umd.ts" + ] } \ No newline at end of file diff --git a/tsconfig/tsconfig.esm5.rollup.json b/src/tsconfig.esm5.rollup.json similarity index 86% rename from tsconfig/tsconfig.esm5.rollup.json rename to src/tsconfig.esm5.rollup.json index cbe7bfe90c..61e713452b 100644 --- a/tsconfig/tsconfig.esm5.rollup.json +++ b/src/tsconfig.esm5.rollup.json @@ -3,5 +3,6 @@ "compilerOptions": { "outDir": "../dist/esm5_for_rollup", "noEmitHelpers": true - } + }, + "exclude": [] } \ No newline at end of file diff --git a/src/tsconfig.types.json b/src/tsconfig.types.json new file mode 100644 index 0000000000..5abd2e439d --- /dev/null +++ b/src/tsconfig.types.json @@ -0,0 +1,16 @@ +{ + "extends": "./tsconfig.esm.json", + "compilerOptions": { + "composite": true, + "module": "es2015", + "target": "esnext", + "removeComments": false, + "declaration": true, + "declarationMap": true, + "declarationDir": "../dist/types", + "emitDeclarationOnly": true + }, + "exclude": [ + "./internal/umd.ts" + ] +} \ No newline at end of file diff --git a/src/webSocket/package.json b/src/webSocket/package.json deleted file mode 100644 index 34020bdec1..0000000000 --- a/src/webSocket/package.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "rxjs/webSocket", - "typings": "./index.d.ts", - "main": "./index.js", - "module": "../_esm5/webSocket/index.js", - "es2015": "../_esm2015/webSocket/index.js", - "sideEffects": false -} diff --git a/tools/generate-alias.js b/tools/generate-alias.js new file mode 100644 index 0000000000..3be48a72ec --- /dev/null +++ b/tools/generate-alias.js @@ -0,0 +1,32 @@ +/** + * Alias subpath import (`dist/cjs/*`) to top-level path mapping (`rxjs/*`) + * Previously this was done by placing cjs to top-level package when it's published - + * Now build uses `dist` as explicit output subpath so we generate top-level alias here instead. + */ +const fs = require('fs-extra'); +const path = require('path'); + +const aliasRoot = [ + 'ajax', 'fetch', 'operators', 'testing', 'webSocket' +] + +aliasRoot.map((alias) => path.resolve(__dirname, `../${alias}`)).forEach((alias) => { + if (fs.existsSync(alias)) { + fs.removeSync(alias); + } + fs.ensureDirSync(alias); +}); + +aliasRoot.forEach((alias) => { + const pkgManifest = { + "name": `rxjs/${alias}`, + "typings": `../dist/types/${alias}/index.d.ts`, + "main": `../dist/cjs/${alias}/index.js`, + "module": `../dist/esm5/${alias}/index.js`, + "es2015": `../dist/esm/${alias}/index.js`, + "sideEffects": false + }; + + fs.writeJSON(path.resolve(__dirname, `../${alias}/package.json`), pkgManifest, { spaces: 2 }); +}); + diff --git a/tools/make-umd-bundle.js b/tools/make-umd-bundle.js index 350eca7cf0..b82b007bec 100644 --- a/tools/make-umd-bundle.js +++ b/tools/make-umd-bundle.js @@ -1,4 +1,7 @@ -var rollupBundle = require('./rollup-bundle'); +const rollupBundle = require('./rollup-bundle'); +const fs = require('fs-extra'); + +fs.ensureDirSync('dist/global'); rollupBundle({ input: 'dist/esm5_for_rollup/internal/umd.js', diff --git a/tools/prepare-package.js b/tools/prepare-package.js new file mode 100644 index 0000000000..6d9750d709 --- /dev/null +++ b/tools/prepare-package.js @@ -0,0 +1,78 @@ +const path = require('path'); +const klawSync = require('klaw-sync'); +const bo = require('@angular-devkit/build-optimizer'); +const fs = require('fs-extra'); +const { addLicenseTextToFile, addLicenseToFile } = require('./add-license-to-file'); +const { cleanSourceMapRoot } = require('../.make-helpers'); + +const ROOT = 'dist/'; +const CJS_ROOT = ROOT + 'cjs/'; +const ESM5_ROOT = ROOT + 'esm5/'; +const ESM2015_ROOT = ROOT + 'esm2015/'; +const UMD_ROOT = ROOT + 'global/'; +const ESM5_FOR_ROLLUP_ROOT = ROOT + 'esm5_for_rollup/'; +const TYPE_ROOT = ROOT + 'types/'; +const UMD_PKG = ROOT + 'bundles/'; + +// License info for minified files +let licenseUrl = 'https://github.com/ReactiveX/RxJS/blob/master/LICENSE.txt'; +let license = 'Apache License 2.0 ' + licenseUrl; + +// Execute build optimizer transforms on ESM5 files +klawSync(ESM5_ROOT, { + nodir: true, + filter: function (item) { + return item.path.endsWith('.js'); + } +}) + .map(item => item.path.slice((`${__dirname}/${ESM5_ROOT}`).length)) + .map(fileName => { + if (!bo) return fileName; + let fullPath = path.resolve(__dirname, ESM5_ROOT, fileName); + // The file won't exist when running build_test as we don't create the ESM5 sources + if (!fs.existsSync(fullPath)) return fileName; + let content = fs.readFileSync(fullPath).toString(); + let transformed = bo.transformJavascript({ + content: content, + getTransforms: [bo.getPrefixClassesTransformer, bo.getPrefixFunctionsTransformer, bo.getFoldFileTransformer] + }); + fs.writeFileSync(fullPath, transformed.content); + return fileName; + }); + +if (fs.existsSync(UMD_ROOT)) { + fs.copySync(UMD_ROOT, UMD_PKG); + // Clean up source map paths so they can be re-mapped + klawSync(UMD_PKG, { filter: (item) => item.path.endsWith('.js.map') }) + .map(f => f.path) + .forEach(fName => { + const sourceMap = fs.readJsonSync(fName); + sourceMap.sources = sourceMap.sources.map(s => { + const nm = 'node_modules/'; + const rr = path.resolve(ESM5_FOR_ROLLUP_ROOT); + if (s.includes(nm)) { + return s.substring(s.indexOf(nm) + nm.length); + } else if (s.includes(rr)) { + return s.substring(s.indexOf(rr) + rr.length); + } + return s; + }); + fs.writeJsonSync(fName, sourceMap); + }); + + // Add licenses to tops of bundles + addLicenseToFile('LICENSE.txt', UMD_PKG + 'rxjs.umd.js'); + addLicenseTextToFile(license, UMD_PKG + 'rxjs.umd.min.js'); + addLicenseToFile('LICENSE.txt', UMD_PKG + 'rxjs.umd.js'); + addLicenseTextToFile(license, UMD_PKG + 'rxjs.umd.min.js'); + cleanSourceMapRoot(UMD_PKG, CJS_ROOT); +} + +// remove umd.js/umd.d.ts files that are only needed for creation of the umd bundle +fs.removeSync(CJS_ROOT + '/internal/umd.js'); +fs.removeSync(CJS_ROOT + '/internal/umd.js.map'); +fs.removeSync(ESM5_ROOT + '/internal/umd.js'); +fs.removeSync(ESM5_ROOT + '/internal/umd.js.map'); +fs.removeSync(ESM2015_ROOT + '/internal/umd.js'); +fs.removeSync(ESM2015_ROOT + '/internal/umd.js.map'); +fs.removeSync(TYPE_ROOT + '/internal/umd.d.ts'); diff --git a/tsconfig.base.json b/tsconfig.base.json deleted file mode 100644 index f5da547783..0000000000 --- a/tsconfig.base.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "removeComments": true, - "preserveConstEnums": true, - "sourceMap": true, - "strictFunctionTypes": true, - "noImplicitAny": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "suppressImplicitAnyIndexErrors": true, - "moduleResolution": "node", - "stripInternal": false, - "target": "es5", - "outDir": "./.out", - "lib": [ - "es5", - "es2018", - "dom" - ] - }, - "formatCodeOptions": { - "indentSize": 2, - "tabSize": 2 - }, - "bazelOptions": { - "suppressTsconfigOverrideWarnings": true - } -} diff --git a/tsconfig.json b/tsconfig.json index f35d9f5fe5..8f38522375 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,6 +1,22 @@ { - "extends": "./tsconfig.base.json", "compilerOptions": { + "incremental": true, + "removeComments": true, + "preserveConstEnums": true, + "sourceMap": true, + "strictFunctionTypes": true, + "noImplicitAny": true, + "noImplicitReturns": true, + "noImplicitThis": true, + "suppressImplicitAnyIndexErrors": true, + "moduleResolution": "node", + "stripInternal": false, + "noEmit": true, + "lib": [ + "es5", + "es2018", + "dom" + ], "baseUrl": ".", "paths": { "rxjs": ["./src/index"], @@ -12,5 +28,7 @@ "rxjs/internal/*": ["./src/internal/*"] } }, - "exclude": ["./dist"] + "bazelOptions": { + "suppressTsconfigOverrideWarnings": true + } } diff --git a/tsconfig.vscode.json b/tsconfig.vscode.json deleted file mode 100644 index 968de1d32c..0000000000 --- a/tsconfig.vscode.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "noEmit": true - }, - "exclude": [ - "dist" - ], - "formatCodeOptions": { - "indentSize": 2, - "tabSize": 2 - } -} \ No newline at end of file diff --git a/tsconfig/tsconfig.base.json b/tsconfig/tsconfig.base.json deleted file mode 100644 index 2fe64707f1..0000000000 --- a/tsconfig/tsconfig.base.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "extends": "../tsconfig.base.json", - "compilerOptions": { - "noEmit": false, - "baseUrl": "../src", - "sourceRoot": "../src", - "paths": { - "rxjs": ["./"], - "rxjs/*": ["./*"] - } - }, - "files": [ - // entry-points - "../src/index.ts", - "../src/ajax/index.ts", - "../src/fetch/index.ts", - "../src/operators/index.ts", - "../src/testing/index.ts", - "../src/webSocket/index.ts", - - // umd entry-point - "../src/internal/umd.ts" - ] -} diff --git a/tsconfig/tsconfig.types.json b/tsconfig/tsconfig.types.json deleted file mode 100644 index ed802d1256..0000000000 --- a/tsconfig/tsconfig.types.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.base.json", - "compilerOptions": { - "module": "es2015", - "target": "esnext", - "removeComments": false, - "declaration": true, - "declarationDir": "../dist/typings", - "emitDeclarationOnly": true - } -} \ No newline at end of file