diff --git a/packages/router/src/exports.spec.ts b/packages/router/src/exports.spec.ts new file mode 100644 index 00000000..ae68f97c --- /dev/null +++ b/packages/router/src/exports.spec.ts @@ -0,0 +1,24 @@ +import { + NgReduxRouter, + NgReduxRouterModule, + routerReducer, + UPDATE_LOCATION, +} from './index'; + +describe('The @angular-redux/router package exports', () => { + it('should contain the NgReduxRouter class', () => { + expect(NgReduxRouter).toBeDefined(); + }); + + it('should contain the NgReduxRouterModule class', () => { + expect(NgReduxRouterModule).toBeDefined(); + }); + + it('should contain the routerReducer function', () => { + expect(routerReducer).toBeDefined(); + }); + + it('should contain the UPDATE_LOCATION const', () => { + expect(UPDATE_LOCATION).toBeDefined(); + }); +}); diff --git a/packages/router/src/index.ts b/packages/router/src/index.ts index cbb602ae..8f111997 100644 --- a/packages/router/src/index.ts +++ b/packages/router/src/index.ts @@ -1,16 +1,16 @@ -import { ModuleWithProviders, NgModule } from '@angular/core'; import { UPDATE_LOCATION } from './actions'; +import { NgReduxRouterModule } from './module'; import { RouterAction, routerReducer } from './reducer'; import { NgReduxRouter } from './router'; -@NgModule() -export class NgReduxRouterModule { - static forRoot(): ModuleWithProviders { - return { - ngModule: NgReduxRouterModule, - providers: [NgReduxRouter], - }; - } -} - -export { NgReduxRouter, RouterAction, routerReducer, UPDATE_LOCATION }; +// Warning: don't do this: +// export * from './foo' +// ... because it breaks rollup. See +// https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by-module +export { + NgReduxRouter, + NgReduxRouterModule, + RouterAction, + routerReducer, + UPDATE_LOCATION, +}; diff --git a/packages/router/src/module.ts b/packages/router/src/module.ts new file mode 100644 index 00000000..97c5f4d9 --- /dev/null +++ b/packages/router/src/module.ts @@ -0,0 +1,12 @@ +import { ModuleWithProviders, NgModule } from '@angular/core'; +import { NgReduxRouter } from './router'; + +@NgModule() +export class NgReduxRouterModule { + static forRoot(): ModuleWithProviders { + return { + ngModule: NgReduxRouterModule, + providers: [NgReduxRouter], + }; + } +}