From 7f9e5fd87a0d4022bddb5b2eed96061fa70bf5b5 Mon Sep 17 00:00:00 2001 From: Patrick Roberts Date: Fri, 30 Oct 2020 01:51:03 -0500 Subject: [PATCH] Exported Handler type from public API --- package.json | 182 +++++++++++++++++++++---------------------- src/Service/index.ts | 2 + src/index.ts | 2 +- 3 files changed, 94 insertions(+), 92 deletions(-) diff --git a/package.json b/package.json index 458c060..4bcef26 100644 --- a/package.json +++ b/package.json @@ -1,91 +1,91 @@ -{ - "name": "suspense-service", - "version": "0.2.0", - "description": "Suspense integration library for React", - "repository": "github:patrickroberts/suspense-service", - "main": "dst/cjs/suspense-service.js", - "module": "dst/esm/suspense-service.js", - "browser": "dst/umd/suspense-service.js", - "types": "dst/esm/suspense-service.d.ts", - "scripts": { - "clean": "rimraf dst docs/**/*.md", - "lint": "eslint . --ext .js,.ts,.tsx", - "test": "jest", - "build": "rollup --config --environment NODE_ENV:production", - "rebuild": "npm run clean && npm run build", - "docs": "typedoc src/index.ts", - "watch:build": "npm run build -- --environment NODE_ENV:development --watch", - "watch:test": "npm test -- --watch", - "watch": "concurrently 'npm:watch:*'", - "prepublishOnly": "npm run clean && npm run lint && npm test && npm run build && npm run docs" - }, - "author": "Patrick Roberts", - "license": "MIT", - "devDependencies": { - "@babel/preset-react": "^7.10.4", - "@rollup/plugin-commonjs": "^15.1.0", - "@rollup/plugin-node-resolve": "^9.0.0", - "@types/jest": "^26.0.14", - "@types/react": "^16.9.51", - "@types/react-dom": "^16.9.8", - "@types/react-test-renderer": "^16.9.3", - "@typescript-eslint/eslint-plugin": "4.0.1", - "@typescript-eslint/parser": "4.0.1", - "@wessberg/rollup-plugin-ts": "^1.3.5", - "concurrently": "^5.3.0", - "eslint": "^7.10.0", - "eslint-config-airbnb": "^18.2.0", - "eslint-plugin-import": "^2.22.1", - "eslint-plugin-jest": "^24.1.0", - "eslint-plugin-jsx-a11y": "^6.3.1", - "eslint-plugin-react": "^7.21.3", - "eslint-plugin-react-hooks": "^4.1.2", - "jest": "^26.5.3", - "prettier": "^2.1.2", - "react": "^16.13.1", - "react-dom": "^16.13.1", - "react-test-renderer": "^16.14.0", - "rimraf": "^3.0.2", - "rollup": "^2.28.2", - "rollup-plugin-terser": "^7.0.2", - "ts-jest": "^26.4.1", - "typedoc": "^0.19.2", - "typedoc-plugin-markdown": "^3.0.7", - "typedoc-plugin-sourcefile-url": "^1.0.6", - "typescript": "^4.0.3" - }, - "peerDependencies": { - "react": "^16.13.1" - }, - "keywords": [ - "concurrent", - "context", - "data", - "fetching", - "hooks", - "integration", - "library", - "react", - "service", - "suspense", - "typescript" - ], - "babel": { - "presets": [ - "@babel/preset-react" - ] - }, - "browserslist": { - "development": [ - "last 1 chrome version", - "last 1 firefox version", - "maintained node versions" - ], - "production": [ - "defaults" - ], - "test": [ - "maintained node versions" - ] - } -} +{ + "name": "suspense-service", + "version": "0.2.1", + "description": "Suspense integration library for React", + "repository": "github:patrickroberts/suspense-service", + "main": "dst/cjs/suspense-service.js", + "module": "dst/esm/suspense-service.js", + "browser": "dst/umd/suspense-service.js", + "types": "dst/esm/suspense-service.d.ts", + "scripts": { + "clean": "rimraf dst docs/**/*.md", + "lint": "eslint . --ext .js,.ts,.tsx", + "test": "jest", + "build": "rollup --config --environment NODE_ENV:production", + "rebuild": "npm run clean && npm run build", + "docs": "typedoc src/index.ts", + "watch:build": "npm run build -- --environment NODE_ENV:development --watch", + "watch:test": "npm test -- --watch", + "watch": "concurrently 'npm:watch:*'", + "prepublishOnly": "npm run clean && npm run lint && npm test && npm run build && npm run docs" + }, + "author": "Patrick Roberts", + "license": "MIT", + "devDependencies": { + "@babel/preset-react": "^7.10.4", + "@rollup/plugin-commonjs": "^15.1.0", + "@rollup/plugin-node-resolve": "^9.0.0", + "@types/jest": "^26.0.14", + "@types/react": "^16.9.51", + "@types/react-dom": "^16.9.8", + "@types/react-test-renderer": "^16.9.3", + "@typescript-eslint/eslint-plugin": "4.0.1", + "@typescript-eslint/parser": "4.0.1", + "@wessberg/rollup-plugin-ts": "^1.3.5", + "concurrently": "^5.3.0", + "eslint": "^7.10.0", + "eslint-config-airbnb": "^18.2.0", + "eslint-plugin-import": "^2.22.1", + "eslint-plugin-jest": "^24.1.0", + "eslint-plugin-jsx-a11y": "^6.3.1", + "eslint-plugin-react": "^7.21.3", + "eslint-plugin-react-hooks": "^4.1.2", + "jest": "^26.5.3", + "prettier": "^2.1.2", + "react": "^16.13.1", + "react-dom": "^16.13.1", + "react-test-renderer": "^16.14.0", + "rimraf": "^3.0.2", + "rollup": "^2.28.2", + "rollup-plugin-terser": "^7.0.2", + "ts-jest": "^26.4.1", + "typedoc": "^0.19.2", + "typedoc-plugin-markdown": "^3.0.7", + "typedoc-plugin-sourcefile-url": "^1.0.6", + "typescript": "^4.0.3" + }, + "peerDependencies": { + "react": "^16.13.1" + }, + "keywords": [ + "concurrent", + "context", + "data", + "fetching", + "hooks", + "integration", + "library", + "react", + "service", + "suspense", + "typescript" + ], + "babel": { + "presets": [ + "@babel/preset-react" + ] + }, + "browserslist": { + "development": [ + "last 1 chrome version", + "last 1 firefox version", + "maintained node versions" + ], + "production": [ + "defaults" + ], + "test": [ + "maintained node versions" + ] + } +} diff --git a/src/Service/index.ts b/src/Service/index.ts index 9b20fc8..9807969 100644 --- a/src/Service/index.ts +++ b/src/Service/index.ts @@ -22,6 +22,8 @@ export default interface Service { [kResource]: IdContext<[Resource, Dispatch>]>; } +export { Handler }; + const defaultFn = () => { throw new Error('Provider is not in scope'); }; const defaultValue: [Resource, Dispatch] = [defaultFn, defaultFn]; diff --git a/src/index.ts b/src/index.ts index c73ee66..c365f2c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,5 +4,5 @@ export { default as IdContextProvider, IdContextProviderProps } from './IdContex export { default as IdContext, createIdContext, useIdContext } from './IdContext'; export { default as ServiceConsumer, ServiceConsumerProps } from './Service/Consumer'; export { default as ServiceProvider, ServiceProviderProps } from './Service/Provider'; -export { default as Service, createService, useService, useServiceState } from './Service'; +export { default as Service, Handler, createService, useService, useServiceState } from './Service'; export { default as Reset } from './State/Reset';