-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(compat): set up correct imports & get build working for rxjs-comapt
- Loading branch information
Showing
139 changed files
with
618 additions
and
516 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ typings/ | |
|
||
# Generated | ||
dist/ | ||
dist-compat/ | ||
tmp/ | ||
coverage/ | ||
img/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
"use strict"; | ||
|
||
let pkg = require('./compat/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; | ||
|
||
const ROOT = 'dist-compat/'; | ||
const CJS_ROOT = ROOT + 'cjs/compat/'; | ||
const ESM5_ROOT = ROOT + 'esm5/compat/'; | ||
const ESM2015_ROOT = ROOT + 'esm2015/compat/'; | ||
const TYPE_ROOT = ROOT + 'typings/compat/'; | ||
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 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; | ||
|
||
// Recreate the distribution folder | ||
fs.removeSync(PKG_ROOT); | ||
mkdirp.sync(PKG_ROOT); | ||
|
||
// Copy over the sources | ||
fs.copySync(TYPE_ROOT, TYPE_PKG); | ||
copySources(CJS_ROOT, CJS_PKG); | ||
copySources(ESM5_ROOT, ESM5_PKG, true); | ||
copySources(ESM2015_ROOT, ESM2015_PKG, true); | ||
|
||
fs.copySync('compat/package.json', PKG_ROOT + '/package.json'); | ||
|
||
function copySources(rootDir, packageDir, ignoreMissing) { | ||
// If we are ignoring missing directories, early return when source doesn't exist | ||
if (!fs.existsSync(rootDir)) { | ||
if (ignoreMissing) { | ||
return; | ||
} else { | ||
throw "Source root dir does not exist!"; | ||
} | ||
} | ||
// Copy over the CommonJS files | ||
fs.copySync(rootDir, packageDir); | ||
fs.copySync('./LICENSE.txt', packageDir + 'LICENSE.txt'); | ||
fs.copySync('./compat/README.md', packageDir + 'README.md'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# RxJS Compatibility Package | ||
|
||
This package is required to get backwards compatibility with RxJS pervious to version 6. It contains the imports to add operators to `Observable.prototype` and creation methods to `Observable`. This is what allows, for instance, dot-chaining: | ||
|
||
``` | ||
Observable.interval(1) | ||
.map(i => i * i) | ||
``` | ||
|
||
vs | ||
|
||
``` | ||
Observable.interval(1) | ||
.pipe(map(i => i * i)) | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
import { Observable } from '../../internal/Observable'; | ||
import { iif } from '../../internal/observable/iif'; | ||
import { Observable, iif } from 'rxjs'; | ||
|
||
//tslint:disable-next-line:no-any TypeScript doesn't like `if` | ||
(Observable as any).if = iif; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.