Socket
Socket
Sign inDemoInstall

@cycle/history

Package Overview
Dependencies
25
Maintainers
3
Versions
40
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 6.10.0 to 7.0.0

pnpm-debug.log

13

CHANGELOG.md

@@ -0,1 +1,14 @@

## 7.0.0 (2018-10-17)
* fix(history): support TypeScript 3.1 ([4be72b2](https://github.com/cyclejs/cyclejs/commit/4be72b2))
* refactor(history): move history tests to browserstack, run skipped tests ([8a1d5f6](https://github.com/cyclejs/cyclejs/commit/8a1d5f6))
### BREAKING CHANGE
* If you use JavaScript, there are no breaking changes. If you use
TypeScript, this package may not work anymore with versions of TS below
3.1.
<a name="6.10.0"></a>

@@ -2,0 +15,0 @@ # 6.10.0 (2017-11-27)

139

karma.conf.js

@@ -1,125 +0,18 @@

module.exports = function (config) {
const customLaunchers = {
SL_Chrome_49: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 10',
version: '49',
},
const deepmerge = require('deepmerge');
const common = require('../karma.conf.js');
// TODO: fix these!
// SL_IE_10: {
// base: 'SauceLabs',
// browserName: 'internet explorer',
// version: '10',
// },
module.exports = function(config) {
const newCommon = Object.assign({}, common, {
browsers: common.browsers
? common.browsers.filter(s => s !== 'BS_IE_10')
: undefined,
});
// SL_IE_11: {
// base: 'SauceLabs',
// browserName: 'internet explorer',
// version: '11',
// },
SL_Safari_8: {
base: 'SauceLabs',
browserName: 'safari',
version: '8',
},
SL_iphone_8: {
base: 'SauceLabs',
browserName: 'iphone',
version: '8.4',
},
SL_iphone_9: {
base: 'SauceLabs',
browserName: 'iphone',
version: '9.1',
},
SL_android_4_4: {
base: 'SauceLabs',
browserName: 'android',
platform: 'Linux',
version: '4.4',
deviceName: 'Samsung Galaxy S3 Emulator',
},
SL_Safari_Current: {
base: 'SauceLabs',
browserName: 'safari',
version: 'latest',
},
SL_MS_Edge: {
base: 'SauceLabs',
browserName: 'microsoftedge',
},
SL_Firefox_Current: {
base: 'SauceLabs',
browserName: 'firefox',
platform: 'Windows 10',
version: 'latest',
},
SL_Chrome_Current: {
base: 'SauceLabs',
browserName: 'chrome',
platform: 'Windows 10',
version: 'latest',
},
};
const configuration = {
sauceLabs: {
testName: 'Cycle History Karma tests on Sauce Labs',
connectOptions: {
noSslBumpDomains: "all"
}
},
files: [
'src/**/*.ts',
'test/browser/**/*.ts',
],
frameworks: [
'mocha',
'karma-typescript'
],
preprocessors: {
'**/*.ts': ['karma-typescript']
},
reporters: ['dots', 'saucelabs'],
concurrency: 1,
captureTimeout: 300000,
browserNoActivityTimeout: 30000,
// LOG_DISABLE .. LOG_ERROR .. LOG_WARN .. LOG_INFO .. LOG_DEBUG
logLevel: config.LOG_INFO,
customLaunchers: customLaunchers,
browsers: process.env.TRAVIS ? Object.keys(customLaunchers) : ['Chrome'],
karmaTypescriptConfig: {
tsconfig: 'tsconfig.json',
include: [
"test/browser/**/*.ts",
"src/**/*.ts"
],
reports: {
"html": "coverage",
"lcovonly": "coverage",
}
}
};
config.set(configuration);
}
config.set(
deepmerge(newCommon, {
browserStack: {
name: 'Cycle.js history driver',
},
})
);
};
{
"name": "@cycle/history",
"version": "6.10.0",
"version": "7.0.0",
"description": "The standard history driver for Cycle.js",

@@ -18,4 +18,4 @@ "main": "lib/cjs/index.js",

"dependencies": {
"@cycle/run": "*",
"@types/history": "4.6.x",
"@cycle/run": "^5.1.0",
"@types/history": "^4.7.1",
"history": "4.7.x",

@@ -25,20 +25,35 @@ "xstream": "*"

"devDependencies": {
"@cycle/run": "3.4",
"@cycle/dom": "19.2",
"@cycle/rxjs-run": "7.2",
"@types/mocha": "^2.2.32",
"@types/node": "8.0.x",
"rxjs": "5.4.2",
"saucie": "3.3.0",
"@cycle/rxjs-run": "^10.0.0",
"@types/mocha": "^5.2.5",
"@types/node": "^10.11.7",
"@types/sinon": "^5.0.5",
"deepmerge": "^2.2.1",
"karma": "3.0.0",
"karma-browserstack-launcher": "^1.3.0",
"karma-chrome-launcher": "^2.2.0",
"karma-firefox-launcher": "^1.1.0",
"karma-mocha": "^1.3.0",
"karma-typescript": "^3.0.13",
"mocha": "^5.2.0",
"rxjs": "6.3.x",
"sinon": "^6.3.5",
"ts-node": "^7.0.1",
"tslint": "^5.11.0",
"typescript": "^3.1.3",
"xstream": "11.x"
},
"scripts": {
"test-node": "../node_modules/.bin/mocha --require ts-node/register test/node/*.ts --exit",
"test-browser": "../node_modules/.bin/karma start --single-run",
"test-browser-wait": "../node_modules/.bin/karma start",
"test": "npm run test-node && npm run test-browser",
"test-ci": "npm run test",
"browserify": "../node_modules/.bin/browserify lib/cjs/index.js --standalone CycleHistory --outfile dist/cycle-history.js",
"minify": "node ../.scripts/minify.js dist/cycle-history.js dist/cycle-history.min.js"
"build": "pnpm run build-cjs && pnpm run build-es6",
"build-cjs": "tsc --module commonjs --outDir ./lib/cjs",
"build-es6": "tsc --module es6 --outDir ./lib/es6",
"lint": "tslint --project tsconfig.lint.json --config ../tslint.json",
"docs": "cd .. && node .scripts/make-api-docs.js history",
"changelog": "cd .. && node .scripts/update-changelogs.js history",
"test-node": "mocha --require ts-node/register test/node/*.ts --exit",
"test-browser": "karma start",
"test": "pnpm run test-node && pnpm run test-browser",
"test-ci": "CI=true pnpm test",
"test-live": "LIVE=true pnpm test",
"prepublishOnly": "pnpm run build && pnpm run test"
}
}

@@ -1,3 +0,1 @@

/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import * as assert from 'assert';

@@ -13,2 +11,3 @@

import xs, {Stream} from 'xstream';
import debounce from 'xstream/extra/debounce';
import {setup} from '@cycle/run';

@@ -49,6 +48,3 @@ import {setAdapt} from '@cycle/run/lib/adapt';

// This is skipped because somehow, IN LATEST FIREFOX IN WIN10, state is being
// carried around between tests. Tests work when run separately, but when run
// all together, something fails.
describe.skip('makeHashHistoryDriver', () => {
describe('makeHashHistoryDriver', () => {
it('should be a function', () => {

@@ -82,2 +78,3 @@ assert.strictEqual(typeof makeHashHistoryDriver, 'function');

it('should allow listening to link clicks and change route', function(done) {
setAdapt(x => x);
const historyDriver = makeHistoryDriver();

@@ -87,12 +84,15 @@ const sink = xs.never();

const sub = history$.drop(1).subscribe({
next: (location: Location) => {
assert.strictEqual(location.pathname, '/test');
sub.unsubscribe();
sink.shamefullySendComplete();
done();
},
error: err => {},
complete: () => {},
});
const sub = history$
.compose(debounce(5))
.drop(1)
.subscribe({
next: (location: Location) => {
assert.strictEqual(location.pathname, '/test');
sub.unsubscribe();
sink.shamefullySendComplete();
done();
},
error: err => {},
complete: () => {},
});

@@ -105,8 +105,6 @@ const a = document.createElement('a');

a.click();
});
}, 10);
});
it('should remove click listener when disposed of', function(done) {
setAdapt(x => x);
function main(sources: {history: Stream<Location>}) {

@@ -141,3 +139,3 @@ return {

},
error: err => done(err),
error: done,
complete: () => {},

@@ -144,0 +142,0 @@ });

@@ -1,5 +0,2 @@

/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import * as assert from 'assert';
import {

@@ -11,13 +8,19 @@ HistoryInput,

} from '../../src';
import {run, setup} from '@cycle/rxjs-run';
import {setup} from '@cycle/rxjs-run';
import {setAdapt} from '@cycle/run/lib/adapt';
import {Observable} from 'rxjs';
import 'rxjs/add/operator/switchMap';
import {Observable, from, of, interval, never} from 'rxjs';
import {map, take, skip} from 'rxjs/operators';
let dispose = () => {};
// This is skipped because somehow state is being carried around between tests.
// Tests work when run separately, but when run all together, something fails.
describe.skip('historyDriver - RxJS', () => {
describe('historyDriver - RxJS', () => {
beforeEach(function() {
setAdapt(x => from(x as any));
if (window.history) {
window.history.replaceState(undefined, '', '/');
}
});
afterEach(function() {
dispose();

@@ -27,6 +30,6 @@ });

it('should return a stream', () => {
function main(sources: {history: Observable<Location>}) {
assert.strictEqual(typeof sources.history.switchMap, 'function');
function main(_sources: {history: Observable<Location>}) {
assert.strictEqual(typeof _sources.history.pipe, 'function');
return {
history: Observable.never(),
history: never(),
};

@@ -36,9 +39,9 @@ }

const {sources, run} = setup(main, {history: makeHistoryDriver()});
assert.strictEqual(typeof sources.history.switchMap, 'function');
assert.strictEqual(typeof sources.history.pipe, 'function');
});
it('should create a location from pathname', function(done) {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of('/test'),
history: of('/test'),
};

@@ -49,3 +52,3 @@ }

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -64,5 +67,5 @@ assert.strictEqual(location.pathname, '/test');

it('should create a location from PushHistoryInput', function(done) {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of({type: 'push', pathname: '/test'}),
history: of({type: 'push', pathname: '/test'}),
};

@@ -73,3 +76,3 @@ }

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -88,5 +91,5 @@ assert.strictEqual(location.pathname, '/test');

it('should create a location from ReplaceHistoryInput', function(done) {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of({type: 'replace', pathname: '/test'}),
history: of({type: 'replace', pathname: '/test'}),
};

@@ -97,3 +100,3 @@ }

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -111,10 +114,8 @@ assert.strictEqual(location.pathname, '/test');

it('should allow going back/forwards with `go`, `goBack`, `goForward`', function(
done,
) {
function main(sources: {history: Observable<Location>}) {
it('should allow going back/forwards with `go`, `goBack`, `goForward`', function(done) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.interval(100)
.take(6)
.map(
history: interval(100).pipe(
take(6),
map(
i =>

@@ -128,4 +129,5 @@ [

{type: 'goForward'},
][i],
),
][i]
)
),
};

@@ -138,3 +140,3 @@ }

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -141,0 +143,0 @@ assert.strictEqual(location.pathname, expected.shift());

@@ -1,5 +0,2 @@

/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import * as assert from 'assert';
import {

@@ -11,3 +8,3 @@ HistoryInput,

} from '../../src';
import {run, setup} from '@cycle/run';
import {setup} from '@cycle/run';
import xs, {Stream} from 'xstream';

@@ -22,2 +19,8 @@

setAdapt(x => x);
if (window.history) {
window.history.replaceState(undefined, '', '/');
}
});
afterEach(function() {
dispose();

@@ -27,4 +30,4 @@ });

it('should return a stream', () => {
function main(sources: {history: Stream<Location>}) {
assert.strictEqual(typeof sources.history.remember, 'function');
function main(_sources: {history: Stream<Location>}) {
assert.strictEqual(typeof _sources.history.remember, 'function');
return {

@@ -40,3 +43,3 @@ history: xs.never(),

it('should create a location from pathname', function(done) {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -63,3 +66,3 @@ history: xs.of('/test'),

it('should create a location from PushHistoryInput', function(done) {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -86,3 +89,3 @@ history: xs.of({type: 'push', pathname: '/test'}),

it('should create a location from ReplaceHistoryInput', function(done) {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -108,6 +111,4 @@ history: xs.of({type: 'replace', pathname: '/test'}),

it('should allow going back/forwards with `go`, `goBack`, `goForward`', function(
done,
) {
function main(sources: {history: Stream<Location>}) {
it('should allow going back/forwards with `go`, `goBack`, `goForward`', function(done) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -126,3 +127,3 @@ history: xs

{type: 'goForward'},
][i],
][i]
),

@@ -129,0 +130,0 @@ };

@@ -1,3 +0,1 @@

/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import * as assert from 'assert';

@@ -4,0 +2,0 @@ import {Location, makeHistoryDriver, makeServerHistoryDriver} from '../../src';

@@ -1,6 +0,5 @@

/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import * as assert from 'assert';
import {Observable} from 'rxjs';
import {setup, run} from '@cycle/rxjs-run';
import {Observable, of, never} from 'rxjs';
import {skip} from 'rxjs/operators';
import {setup} from '@cycle/rxjs-run';
import {makeServerHistoryDriver, Location, HistoryInput} from '../../src';

@@ -10,6 +9,6 @@

it('should return an Rx Observable as source', function() {
function main(sources: {history: Observable<Location>}) {
assert.strictEqual(typeof sources.history.switchMap, 'function');
function main(_sources: {history: Observable<Location>}) {
assert.strictEqual(typeof _sources.history.pipe, 'function');
return {
history: Observable.never(),
history: never(),
};

@@ -21,9 +20,9 @@ }

});
assert.strictEqual(typeof sources.history.switchMap, 'function');
assert.strictEqual(typeof sources.history.pipe, 'function');
});
it('should create a location from pathname', done => {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of('/test'),
history: of('/test'),
};

@@ -36,3 +35,3 @@ }

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -51,5 +50,5 @@ assert.strictEqual(location.pathname, '/test');

it('should create a location from PushHistoryInput', done => {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of({type: 'push', pathname: '/test'}),
history: of({type: 'push', pathname: '/test'}),
};

@@ -62,3 +61,3 @@ }

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -77,5 +76,5 @@ assert.strictEqual(location.pathname, '/test');

it('should create a location from ReplaceHistoryInput', done => {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of({type: 'replace', pathname: '/test'}),
history: of({type: 'replace', pathname: '/test'}),
};

@@ -88,3 +87,3 @@ }

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -103,5 +102,5 @@ assert.strictEqual(location.pathname, '/test');

it('should allow going back a route with type `go`', done => {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of<HistoryInput | string>('/test', '/other', {
history: of<HistoryInput | string>('/test', '/other', {
type: 'go',

@@ -119,3 +118,3 @@ amount: -1,

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -136,5 +135,5 @@ assert.strictEqual(location.pathname, expected.shift());

it('should allow going back a route with type `goBack`', done => {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of<HistoryInput | string>('/test', '/other', {
history: of<HistoryInput | string>('/test', '/other', {
type: 'goBack',

@@ -151,3 +150,3 @@ }),

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -168,9 +167,9 @@ assert.strictEqual(location.pathname, expected.shift());

it('should allow going forward a route with type `go`', done => {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of<HistoryInput | string>(
history: of<HistoryInput | string>(
'/test',
'/other',
{type: 'go', amount: -1},
{type: 'go', amount: 1},
{type: 'go', amount: 1}
),

@@ -186,3 +185,3 @@ };

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -203,9 +202,9 @@ assert.strictEqual(location.pathname, expected.shift());

it('should allow going forward a route with type `goForward`', done => {
function main(sources: {history: Observable<Location>}) {
function main(_sources: {history: Observable<Location>}) {
return {
history: Observable.of<HistoryInput | string>(
history: of<HistoryInput | string>(
'/test',
'/other',
{type: 'go', amount: -1},
{type: 'goForward'},
{type: 'goForward'}
),

@@ -221,3 +220,3 @@ };

sources.history.skip(1).subscribe({
sources.history.pipe(skip(1)).subscribe({
next(location: Location) {

@@ -224,0 +223,0 @@ assert.strictEqual(location.pathname, expected.shift());

@@ -1,6 +0,4 @@

/// <reference path="../../node_modules/@types/mocha/index.d.ts" />
/// <reference path="../../node_modules/@types/node/index.d.ts" />
import * as assert from 'assert';
import xs, {Stream} from 'xstream';
import {setup, run} from '@cycle/run';
import {setup} from '@cycle/run';
import {setAdapt} from '@cycle/run/lib/adapt';

@@ -15,4 +13,4 @@ import {makeServerHistoryDriver, Location, HistoryInput} from '../../src';

it('should return a stream', function() {
function main(sources: {history: Stream<Location>}) {
assert.strictEqual(typeof sources.history.remember, 'function');
function main(_sources: {history: Stream<Location>}) {
assert.strictEqual(typeof _sources.history.remember, 'function');
return {

@@ -30,3 +28,3 @@ history: xs.never(),

it('should create a location from pathname', done => {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -55,3 +53,3 @@ history: xs.of('/test'),

it('should create a location from PushHistoryInput', done => {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -80,3 +78,3 @@ history: xs.of({type: 'push', pathname: '/test'}),

it('should create a location from ReplaceHistoryInput', done => {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -105,3 +103,3 @@ history: xs.of({type: 'replace', pathname: '/test'}),

it('should allow going back a route with type `go`', done => {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -137,3 +135,3 @@ history: xs.of<HistoryInput | string>('/test', '/other', {

it('should allow going back a route with type `goBack`', done => {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -168,3 +166,3 @@ history: xs.of<HistoryInput | string>('/test', '/other', {

it('should allow going forward a route with type `go`', done => {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -175,3 +173,3 @@ history: xs.of<HistoryInput | string>(

{type: 'go', amount: -1},
{type: 'go', amount: 1},
{type: 'go', amount: 1}
),

@@ -203,3 +201,3 @@ };

it('should allow going forward a route with type `goForward`', done => {
function main(sources: {history: Stream<Location>}) {
function main(_sources: {history: Stream<Location>}) {
return {

@@ -210,3 +208,3 @@ history: xs.of<HistoryInput | string>(

{type: 'go', amount: -1},
{type: 'goForward'},
{type: 'goForward'}
),

@@ -213,0 +211,0 @@ };

@@ -7,6 +7,2 @@ {

"es2015"
],
"types": [
"mocha",
"node"
]

@@ -13,0 +9,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc