diff --git a/CHANGELOG.md b/CHANGELOG.md
index 90e7deeda5..004f104955 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,20 @@
# Changelog
+## 7.1.0 (2020-05-21)
+
+This update contains some substantial changes to plugin type definitions. If you are using TypeScript alongside a framework, you may need to make changes to your app. Please refer to the [upgrade guide](./UPGRADING.md).
+
+### Changed
+
+- (plugin-react|plugin-vue): Support late passing of framework reference [#839](https://github.com/bugsnag/bugsnag-js/pull/839)
+
+### Added
+
+- (plugin-react): Add type definitions for `Bugsnag.getPlugin('react')` [#839](https://github.com/bugsnag/bugsnag-js/pull/839)
+- (plugin-vue): Add type definitions for `Bugsnag.getPlugin('vue')` [#839](https://github.com/bugsnag/bugsnag-js/pull/839)
+- (plugin-react): Add `clearError` prop to `ErrorBoundary` [#797](https://github.com/bugsnag/bugsnag-js/pull/797)
+- (plugin-express|plugin-koa|plugin-restify): Add full type definitions for plugins [#853](https://github.com/bugsnag/bugsnag-js/pull/853)
+
## 7.0.2 (2020-05-12)
### Fixed
diff --git a/UPGRADING.md b/UPGRADING.md
index 2cc8ed4b30..08f651f526 100644
--- a/UPGRADING.md
+++ b/UPGRADING.md
@@ -1,6 +1,70 @@
Upgrading
=========
+## 7.0 to 7.1
+
+This release contains an update to the way the React and Vue plugins work, allowing the reference to the framework to be supplied after Bugsnag has been initialized.
+
+### Types
+
+From a JS perspective, the update is backwards compatible. Despite being compatible at runtime, the change to type definitions will cause a compile error when TypeScript is used in conjunction with `@bugsnag/plugin-react`. The error is straightforward to resolve:
+
+```TypeScript
+// WRONG: return type was 'any', this will now fail to compile
+const ErrorBoundary = Bugsnag.getPlugin('react')
+
+// OK: to use exactly the same logic you will need to cast
+const ErrorBoundary = Bugsnag.getPlugin('react') as unknown as React.Component
+
+// RECOMMENDED: to make use of the provided type definitions, update to the new api
+const ErrorBoundary = Bugsnag.getPlugin('react')!.createErrorBoundary()
+```
+
+_Note the use of the `!` operator._ The `getPlugin('react')` call will only return something if the react plugin was provided to `Bugsnag.start({ plugins: […] })`.
+
+### Plugins
+
+In order to work, the React and Vue plugins both require a reference to the respective framework to be passed in. This was required in the constructor, which meant there was no way to load Bugsnag _before_ the framework. To support this, we now support supplying the framework reference _after_ Bugsnag has started.
+
+Note that the existing usage is still supported.
+
+#### React
+
+```diff
+import Bugsnag from '@bugsnag/js'
+import BugsnagPluginReact from '@bugsnag/plugin-react'
+import * as React from 'react'
+
+Bugsnag.start({
+ apiKey: 'YOUR_API_KEY',
+ plugins: [
+- new BugsnagPluginReact(React)
++ new BugsnagPluginReact()
+ ]
+})
+
+- const ErrorBoundary = Bugsnag.getPlugin('react')
++ const ErrorBoundary = Bugsnag.getPlugin('react').createErrorBoundary(React)
+```
+
+#### Vue
+
+```diff
+import Bugsnag from '@bugsnag/js'
+import BugsnagPluginVue from '@bugsnag/plugin-vue'
+import Vue from 'vue'
+
+Bugsnag.start({
+ apiKey: 'YOUR_API_KEY',
+ plugins: [
+- new BugsnagPluginVue(Vue)
++ new BugsnagPluginVue()
+ ]
+})
+
++ Bugsnag.getPlugin('vue').installVueErrorHandler(Vue)
+```
+
## 6.x to 7.x
__This version contains many breaking changes__. It is part of an effort to unify our notifier libraries across platforms, making the user interface more consistent, and implementations better on multi-layered environments where multiple Bugsnag libraries need to work together (such as React Native).
@@ -290,7 +354,7 @@ Here are some examples:
// adding metadata
- bugsnagClient.notify(err, {
- metaData: {
-- component: {
+- component: {
- instanceId: component.instanceId
- }
- }
diff --git a/bin/bundle-types b/bin/bundle-types
deleted file mode 100755
index cfb7f8a9cb..0000000000
--- a/bin/bundle-types
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-
-# exit on all errors
-set -e
-
-if [ -z "$1" ]; then
- echo "ERROR: bin/bundle-types {name} :: {name} argument is required"
- exit 1
-fi
-
-# ensure directory exists
-mkdir -p dist/types/bugsnag-core
-
-# copy all .d.ts files from @bugsnag/core
-cp node_modules/@bugsnag/core/types/*.d.ts dist/types/bugsnag-core
-
-# copy all .d.ts files from this module
-cp types/*.d.ts dist/types
-
-# replace any references to @bugsnag/core with the new, bundled, local path
-cat types/$1.d.ts | sed 's/@bugsnag\/core/\.\/bugsnag-core/' > dist/types/$1.d.ts
diff --git a/dockerfiles/Dockerfile.browser b/dockerfiles/Dockerfile.browser
index 33aefc836f..3a9426f860 100644
--- a/dockerfiles/Dockerfile.browser
+++ b/dockerfiles/Dockerfile.browser
@@ -37,7 +37,7 @@ RUN npm install --no-package-lock --no-save \
# install the dependencies and build each fixture
WORKDIR /app/test/browser/features/fixtures
-RUN find . -name package.json -type f -mindepth 2 -maxdepth 3 | \
+RUN find . -name package.json -type f -mindepth 2 -maxdepth 3 ! -path "./node_modules/*" | \
xargs -I % bash -c 'cd `dirname %` && npm install --no-package-lock && npm run build'
# once the fixtures are built we no longer need node_modules and
diff --git a/examples/js/react/src/index.js b/examples/js/react/src/index.js
index 6270bc3d14..09d83bbf0a 100644
--- a/examples/js/react/src/index.js
+++ b/examples/js/react/src/index.js
@@ -12,11 +12,12 @@ Bugsnag.start({
const ErrorBoundary = Bugsnag.getPlugin('react')
-const ErrorScreen = () =>
+const ErrorScreen = ({ clearError }) =>
⚠️ Error ⚠️
Uh oh, there was an error in the component tree!
This FallbackComponent
prop can be used to show something useful to your users when such errors occur.
+
Reset
const onError = event => {
diff --git a/lerna.json b/lerna.json
index 943997eec4..041e091a94 100644
--- a/lerna.json
+++ b/lerna.json
@@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
- "version": "7.0.2"
+ "version": "7.1.0-alpha.0"
}
diff --git a/package-lock.json b/package-lock.json
index 037783e3fc..4d4cbfe488 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19923,9 +19923,9 @@
}
},
"typescript": {
- "version": "3.7.5",
- "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.7.5.tgz",
- "integrity": "sha512-/P5lkRXkWHNAbcJIiHPfRoKqyd7bsyCma1hZNUGfn20qm64T6ZBlrzprymeu918H+mB/0rIg2gGK/BXkhhYgBw==",
+ "version": "3.9.2",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.2.tgz",
+ "integrity": "sha512-q2ktq4n/uLuNNShyayit+DTobV2ApPEo/6so68JaD5ojvc/6GClBipedB9zNWYxRSAlZXAe405Rlijzl6qDiSw==",
"dev": true
},
"ua-parser-js": {
diff --git a/package.json b/package.json
index 8548a34176..fa4d29d76b 100644
--- a/package.json
+++ b/package.json
@@ -52,7 +52,7 @@
"react-test-renderer": "^16.13.1",
"rimraf": "^3.0.0",
"timekeeper": "^2.2.0",
- "typescript": "^3.7.5",
+ "typescript": "^3.9.2",
"uglify-js": "^3.4.9"
},
"scripts": {
diff --git a/packages/browser/package-lock.json b/packages/browser/package-lock.json
index 216dc22ce6..31fb0d1948 100644
--- a/packages/browser/package-lock.json
+++ b/packages/browser/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/browser",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/browser/package.json b/packages/browser/package.json
index 38f6606cbb..d5f0c77bba 100644
--- a/packages/browser/package.json
+++ b/packages/browser/package.json
@@ -1,8 +1,8 @@
{
"name": "@bugsnag/browser",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "dist/bugsnag.js",
- "types": "dist/types/bugsnag.d.ts",
+ "types": "types/bugsnag.d.ts",
"description": "Bugsnag error reporter for browser JavaScript",
"homepage": "https://www.bugsnag.com/",
"repository": {
@@ -10,19 +10,19 @@
"url": "git@github.com:bugsnag/bugsnag-js.git"
},
"browser": {
- "dist/types/bugsnag": "./dist/bugsnag.js"
+ "types/bugsnag": "./dist/bugsnag.js"
},
"publishConfig": {
"access": "public"
},
"files": [
- "dist"
+ "dist",
+ "types"
],
"scripts": {
"size": "./bin/size",
"clean": "rm -fr dist && mkdir dist",
- "bundle-types": "../../bin/bundle-types bugsnag",
- "build": "npm run clean && npm run build:dist && npm run build:dist:min && npm run bundle-types",
+ "build": "npm run clean && npm run build:dist && npm run build:dist:min",
"build:dist": "NODE_ENV=production IS_BROWSER=yes ../../bin/bundle src/notifier.js --standalone=Bugsnag | ../../bin/extract-source-map dist/bugsnag.js",
"build:dist:min": "NODE_ENV=production IS_BROWSER=yes ../../bin/bundle src/notifier.js --standalone=Bugsnag | ../../bin/minify dist/bugsnag.min.js",
"test:types": "jasmine 'types/**/*.test.js'",
@@ -33,22 +33,22 @@
"license": "MIT",
"devDependencies": {
"@bugsnag/core": "^7.0.1",
- "@bugsnag/delivery-x-domain-request": "^7.0.1",
- "@bugsnag/delivery-xml-http-request": "^7.0.1",
- "@bugsnag/plugin-browser-context": "^7.0.1",
- "@bugsnag/plugin-browser-device": "^7.0.1",
- "@bugsnag/plugin-browser-request": "^7.0.1",
- "@bugsnag/plugin-browser-session": "^7.0.1",
- "@bugsnag/plugin-client-ip": "^7.0.1",
- "@bugsnag/plugin-console-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-inline-script-content": "^7.0.1",
- "@bugsnag/plugin-interaction-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-navigation-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-network-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-simple-throttle": "^7.0.1",
- "@bugsnag/plugin-strip-query-string": "^7.0.1",
- "@bugsnag/plugin-window-onerror": "^7.0.1",
- "@bugsnag/plugin-window-unhandled-rejection": "^7.0.1",
+ "@bugsnag/delivery-x-domain-request": "^7.1.0-alpha.0",
+ "@bugsnag/delivery-xml-http-request": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-browser-context": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-browser-device": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-browser-request": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-browser-session": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-client-ip": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-console-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-inline-script-content": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-interaction-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-navigation-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-network-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-simple-throttle": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-strip-query-string": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-window-onerror": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-window-unhandled-rejection": "^7.1.0-alpha.0",
"cloudfront": "^0.4.1",
"jasmine": "^3.1.0",
"knox": "^0.9.2",
@@ -56,5 +56,8 @@
"nyc": "^12.0.2",
"semver": "^5.5.1",
"typescript": "^3.7.5"
+ },
+ "dependencies": {
+ "@bugsnag/core": "^7.1.0-alpha.0"
}
}
diff --git a/packages/core/package-lock.json b/packages/core/package-lock.json
index 51f419c8bf..061fe05a3a 100644
--- a/packages/core/package-lock.json
+++ b/packages/core/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/core",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/core/package.json b/packages/core/package.json
index 5c600baed3..49a5dc399e 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -1,7 +1,7 @@
{
"name": "@bugsnag/core",
"main": "index.js",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"types": "types/index.d.ts",
"description": "Core classes and utilities for Bugsnag notifiers",
"homepage": "https://www.bugsnag.com/",
diff --git a/packages/core/test/config.test.ts b/packages/core/test/config.test.ts
index 9b09b0d3da..75f40f32fb 100644
--- a/packages/core/test/config.test.ts
+++ b/packages/core/test/config.test.ts
@@ -6,6 +6,7 @@ describe('@bugsnag/core/config', () => {
Object.keys(config.schema).forEach(k => {
const key = k as unknown as keyof typeof config.schema
config.schema[key].defaultValue(undefined)
+ // @ts-expect-error
config.schema[key].validate()
config.schema[key].validate(-1)
config.schema[key].validate('stringy stringerson')
diff --git a/packages/delivery-expo/package-lock.json b/packages/delivery-expo/package-lock.json
index f7750963f2..0c5477c70c 100644
--- a/packages/delivery-expo/package-lock.json
+++ b/packages/delivery-expo/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/delivery-expo",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/delivery-expo/package.json b/packages/delivery-expo/package.json
index 332c40e656..7aca1d9ed6 100644
--- a/packages/delivery-expo/package.json
+++ b/packages/delivery-expo/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/delivery-expo",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "delivery.js",
"description": "@bugsnag/js delivery mechanism to send events and sessions from Expo, using the FileSystem API to cache and retry sending failed payloads",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"@react-native-community/netinfo": "5.5.0",
"expo-file-system": "^6.0.2"
},
diff --git a/packages/delivery-node/package-lock.json b/packages/delivery-node/package-lock.json
index cb9b094020..9357713272 100644
--- a/packages/delivery-node/package-lock.json
+++ b/packages/delivery-node/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/delivery-node",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/delivery-node/package.json b/packages/delivery-node/package.json
index c523978122..6fcd773c44 100644
--- a/packages/delivery-node/package.json
+++ b/packages/delivery-node/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/delivery-node",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "delivery.js",
"description": "@bugsnag/node delivery mechanism",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/delivery-x-domain-request/package-lock.json b/packages/delivery-x-domain-request/package-lock.json
index 3fc73b2c1b..f7196cb2bf 100644
--- a/packages/delivery-x-domain-request/package-lock.json
+++ b/packages/delivery-x-domain-request/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/delivery-x-domain-request",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/delivery-x-domain-request/package.json b/packages/delivery-x-domain-request/package.json
index 6945652f21..a69c87fb67 100644
--- a/packages/delivery-x-domain-request/package.json
+++ b/packages/delivery-x-domain-request/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/delivery-x-domain-request",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "delivery.js",
"description": "@bugsnag/js delivery mechanism for IE 8, 9 and 10",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/delivery-xml-http-request/package-lock.json b/packages/delivery-xml-http-request/package-lock.json
index e755376844..ad94b7b2ca 100644
--- a/packages/delivery-xml-http-request/package-lock.json
+++ b/packages/delivery-xml-http-request/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/delivery-xml-http-request",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/delivery-xml-http-request/package.json b/packages/delivery-xml-http-request/package.json
index e5d409e5e8..6f9120c925 100644
--- a/packages/delivery-xml-http-request/package.json
+++ b/packages/delivery-xml-http-request/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/delivery-xml-http-request",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "delivery.js",
"description": "@bugsnag/js delivery mechanism for most browsers",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/expo/package-lock.json b/packages/expo/package-lock.json
index 9eb00145af..c12f4adf10 100644
--- a/packages/expo/package-lock.json
+++ b/packages/expo/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/expo",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/expo/package.json b/packages/expo/package.json
index 5871b344ac..d72598b2f5 100644
--- a/packages/expo/package.json
+++ b/packages/expo/package.json
@@ -1,8 +1,8 @@
{
"name": "@bugsnag/expo",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "src/notifier.js",
- "types": "dist/types/bugsnag.d.ts",
+ "types": "types/bugsnag.d.ts",
"description": "Bugsnag error reporter for Expo applications",
"keywords": [
"bugsnag",
@@ -27,14 +27,10 @@
"files": [
"src",
"hooks",
- "dist"
+ "types"
],
"scripts": {
- "clean": "rm -fr dist && mkdir dist",
- "bundle-types": "../../bin/bundle-types bugsnag",
- "build": "npm run clean && npm run bundle-types",
- "test:types": "jasmine 'types/**/*.test.js'",
- "postversion": "npm run build"
+ "test:types": "jasmine 'types/**/*.test.js'"
},
"author": "Bugsnag",
"license": "MIT",
@@ -45,19 +41,19 @@
"typescript": "^3.7.5"
},
"dependencies": {
- "@bugsnag/core": "^7.0.1",
- "@bugsnag/delivery-expo": "^7.0.1",
- "@bugsnag/plugin-browser-session": "^7.0.1",
- "@bugsnag/plugin-console-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-expo-app": "^7.0.1",
- "@bugsnag/plugin-expo-device": "^7.0.1",
- "@bugsnag/plugin-network-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-react": "^7.0.1",
- "@bugsnag/plugin-react-native-app-state-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-react-native-connectivity-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-react-native-global-error-handler": "^7.0.1",
- "@bugsnag/plugin-react-native-orientation-breadcrumbs": "^7.0.1",
- "@bugsnag/plugin-react-native-unhandled-rejection": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
+ "@bugsnag/delivery-expo": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-browser-session": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-console-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-expo-app": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-expo-device": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-network-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-react": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-react-native-app-state-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-react-native-connectivity-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-react-native-global-error-handler": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-react-native-orientation-breadcrumbs": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-react-native-unhandled-rejection": "^7.1.0-alpha.0",
"bugsnag-build-reporter": "^1.0.1",
"bugsnag-sourcemaps": "^1.1.0",
"expo-constants": "^6.0.0"
diff --git a/packages/js/package-lock.json b/packages/js/package-lock.json
index dae43989c9..54bae25a04 100644
--- a/packages/js/package-lock.json
+++ b/packages/js/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/js",
- "version": "7.0.2",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/js/package.json b/packages/js/package.json
index 2f616d2ee1..b24195125e 100644
--- a/packages/js/package.json
+++ b/packages/js/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/js",
- "version": "7.0.2",
+ "version": "7.1.0-alpha.0",
"main": "node/notifier.js",
"browser": "browser/notifier.js",
"types": "types.d.ts",
@@ -33,8 +33,8 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/browser": "^7.0.1",
- "@bugsnag/node": "^7.0.1"
+ "@bugsnag/browser": "^7.1.0-alpha.0",
+ "@bugsnag/node": "^7.1.0-alpha.0"
},
"devDependencies": {
"@babel/cli": "^7.0.0",
diff --git a/packages/node/package-lock.json b/packages/node/package-lock.json
index 7a0139689c..ebc2fbb37e 100644
--- a/packages/node/package-lock.json
+++ b/packages/node/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/node",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/node/package.json b/packages/node/package.json
index f944ce9f48..97bceecfbe 100644
--- a/packages/node/package.json
+++ b/packages/node/package.json
@@ -1,8 +1,8 @@
{
"name": "@bugsnag/node",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "dist/bugsnag.js",
- "types": "dist/types/bugsnag.d.ts",
+ "types": "types/bugsnag.d.ts",
"description": "Bugsnag error reporter for Node.js",
"homepage": "https://www.bugsnag.com/",
"repository": {
@@ -13,33 +13,33 @@
"access": "public"
},
"files": [
- "dist"
+ "dist",
+ "types"
],
"scripts": {
"clean": "rm -fr dist && mkdir dist",
- "bundle-types": "../../bin/bundle-types bugsnag",
- "build": "npm run clean && npm run build:dist && npm run bundle-types",
+ "build": "npm run clean && npm run build:dist",
"build:dist": "../../bin/bundle src/notifier.js --node --exclude=iserror,stack-generator,error-stack-parser,pump,byline --standalone=bugsnag | ../../bin/extract-source-map dist/bugsnag.js",
"postversion": "npm run build"
},
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
- "@bugsnag/delivery-node": "^7.0.1",
- "@bugsnag/plugin-contextualize": "^7.0.1",
- "@bugsnag/plugin-intercept": "^7.0.1",
- "@bugsnag/plugin-node-device": "^7.0.1",
- "@bugsnag/plugin-node-in-project": "^7.0.1",
- "@bugsnag/plugin-node-surrounding-code": "^7.0.1",
- "@bugsnag/plugin-node-uncaught-exception": "^7.0.1",
- "@bugsnag/plugin-node-unhandled-rejection": "^7.0.1",
- "@bugsnag/plugin-server-session": "^7.0.1",
- "@bugsnag/plugin-strip-project-root": "^7.0.1",
+ "@bugsnag/delivery-node": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-contextualize": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-intercept": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-node-device": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-node-in-project": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-node-surrounding-code": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-node-uncaught-exception": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-node-unhandled-rejection": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-server-session": "^7.1.0-alpha.0",
+ "@bugsnag/plugin-strip-project-root": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
},
"dependencies": {
+ "@bugsnag/core": "^7.1.0-alpha.0",
"byline": "^5.0.0",
"error-stack-parser": "^2.0.2",
"iserror": "^0.0.2",
diff --git a/packages/plugin-angular/package-lock.json b/packages/plugin-angular/package-lock.json
index 5777d6086b..d192c69661 100644
--- a/packages/plugin-angular/package-lock.json
+++ b/packages/plugin-angular/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-angular",
- "version": "7.0.2",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-angular/package.json b/packages/plugin-angular/package.json
index d77b2eace6..078d470303 100644
--- a/packages/plugin-angular/package.json
+++ b/packages/plugin-angular/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-angular",
- "version": "7.0.2",
+ "version": "7.1.0-alpha.0",
"description": "Angular integration for bugsnag-js",
"main": "dist/es5/index.js",
"browser": "dist/es5/index.js",
@@ -35,7 +35,7 @@
"@angular/compiler": "^7.2.15",
"@angular/compiler-cli": "^7.2.15",
"@angular/core": "^7.2.15",
- "@bugsnag/js": "^7.0.2",
+ "@bugsnag/js": "^7.1.0-alpha.0",
"rxjs": "^5.5.8",
"typescript": "^3.2.4",
"zone.js": "^0.8.26"
diff --git a/packages/plugin-browser-context/package-lock.json b/packages/plugin-browser-context/package-lock.json
index f2c102f5b4..ddc3c0dbe7 100644
--- a/packages/plugin-browser-context/package-lock.json
+++ b/packages/plugin-browser-context/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-browser-context",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-browser-context/package.json b/packages/plugin-browser-context/package.json
index e86bbe5c6c..9625172c63 100644
--- a/packages/plugin-browser-context/package.json
+++ b/packages/plugin-browser-context/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-browser-context",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "context.js",
"description": "@bugsnag/js plugin to set event context in browsers",
"homepage": "https://www.bugsnag.com/",
@@ -17,6 +17,6 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
}
}
diff --git a/packages/plugin-browser-device/package-lock.json b/packages/plugin-browser-device/package-lock.json
index 8225fd5f55..bd202eb483 100644
--- a/packages/plugin-browser-device/package-lock.json
+++ b/packages/plugin-browser-device/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-browser-device",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-browser-device/package.json b/packages/plugin-browser-device/package.json
index 14c4f635b6..c73aeae9dd 100644
--- a/packages/plugin-browser-device/package.json
+++ b/packages/plugin-browser-device/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-browser-device",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "device.js",
"description": "@bugsnag/js plugin to set device info in browsers",
"homepage": "https://www.bugsnag.com/",
@@ -17,6 +17,6 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
}
}
diff --git a/packages/plugin-browser-request/package-lock.json b/packages/plugin-browser-request/package-lock.json
index 9d4e57f7f6..b6ee857410 100644
--- a/packages/plugin-browser-request/package-lock.json
+++ b/packages/plugin-browser-request/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-browser-request",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-browser-request/package.json b/packages/plugin-browser-request/package.json
index 921e9aaa12..412d2d2900 100644
--- a/packages/plugin-browser-request/package.json
+++ b/packages/plugin-browser-request/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-browser-request",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "request.js",
"description": "@bugsnag/js plugin to set request info in browsers",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-browser-session/package-lock.json b/packages/plugin-browser-session/package-lock.json
index dddac21879..363a97f967 100644
--- a/packages/plugin-browser-session/package-lock.json
+++ b/packages/plugin-browser-session/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-browser-session",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-browser-session/package.json b/packages/plugin-browser-session/package.json
index 5e6c26163a..7e0175639e 100644
--- a/packages/plugin-browser-session/package.json
+++ b/packages/plugin-browser-session/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-browser-session",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "session.js",
"description": "@bugsnag/js plugin to enable session tracking in browsers",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-client-ip/package-lock.json b/packages/plugin-client-ip/package-lock.json
index 30b5f0152c..6b1f928312 100644
--- a/packages/plugin-client-ip/package-lock.json
+++ b/packages/plugin-client-ip/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-client-ip",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-client-ip/package.json b/packages/plugin-client-ip/package.json
index 612d39d095..69b773ccb0 100644
--- a/packages/plugin-client-ip/package.json
+++ b/packages/plugin-client-ip/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-client-ip",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "client-ip.js",
"description": "@bugsnag/js plugin to disable client IP from error reports",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-console-breadcrumbs/package-lock.json b/packages/plugin-console-breadcrumbs/package-lock.json
index ae2b73c872..a686f494d1 100644
--- a/packages/plugin-console-breadcrumbs/package-lock.json
+++ b/packages/plugin-console-breadcrumbs/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-console-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-console-breadcrumbs/package.json b/packages/plugin-console-breadcrumbs/package.json
index 1f4f38c72b..4c820de796 100644
--- a/packages/plugin-console-breadcrumbs/package.json
+++ b/packages/plugin-console-breadcrumbs/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-console-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "console-breadcrumbs.js",
"description": "@bugsnag/js plugin to record console log method calls as breadcrumbs",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-contextualize/package-lock.json b/packages/plugin-contextualize/package-lock.json
index ba0e97cd30..026c0c02cc 100644
--- a/packages/plugin-contextualize/package-lock.json
+++ b/packages/plugin-contextualize/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-contextualize",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-contextualize/package.json b/packages/plugin-contextualize/package.json
index 303de16530..40bb3c2c88 100644
--- a/packages/plugin-contextualize/package.json
+++ b/packages/plugin-contextualize/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-contextualize",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "contextualize.js",
"description": "@bugsnag/js plugin to add context to unhandled events",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-expo-app/package-lock.json b/packages/plugin-expo-app/package-lock.json
index 06c308ed82..d44b7bf389 100644
--- a/packages/plugin-expo-app/package-lock.json
+++ b/packages/plugin-expo-app/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-expo-app",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-expo-app/package.json b/packages/plugin-expo-app/package.json
index d026ff74a2..c69e818738 100644
--- a/packages/plugin-expo-app/package.json
+++ b/packages/plugin-expo-app/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-expo-app",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "app.js",
"description": "@bugsnag/js plugin to provide information about an Expo app",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "3.1.0",
"nyc": "^12.0.2"
},
diff --git a/packages/plugin-expo-device/package-lock.json b/packages/plugin-expo-device/package-lock.json
index df4b1ac871..a04760d549 100644
--- a/packages/plugin-expo-device/package-lock.json
+++ b/packages/plugin-expo-device/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-expo-device",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-expo-device/package.json b/packages/plugin-expo-device/package.json
index e10eef8ba3..e90c402ca1 100644
--- a/packages/plugin-expo-device/package.json
+++ b/packages/plugin-expo-device/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-expo-device",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "device.js",
"description": "@bugsnag/js plugin to attach Expo-specific device info to events",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "3.1.0",
"nyc": "^12.0.2"
},
diff --git a/packages/plugin-express/package-lock.json b/packages/plugin-express/package-lock.json
index ea7b5e3855..638c279858 100644
--- a/packages/plugin-express/package-lock.json
+++ b/packages/plugin-express/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-express",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -113,6 +113,82 @@
"to-fast-properties": "^2.0.0"
}
},
+ "@types/body-parser": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz",
+ "integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==",
+ "dev": true,
+ "requires": {
+ "@types/connect": "*",
+ "@types/node": "*"
+ }
+ },
+ "@types/connect": {
+ "version": "3.4.33",
+ "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.33.tgz",
+ "integrity": "sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "@types/express": {
+ "version": "4.17.6",
+ "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.6.tgz",
+ "integrity": "sha512-n/mr9tZI83kd4azlPG5y997C/M4DNABK9yErhFM6hKdym4kkmd9j0vtsJyjFIwfRBxtrxZtAfGZCNRIBMFLK5w==",
+ "dev": true,
+ "requires": {
+ "@types/body-parser": "*",
+ "@types/express-serve-static-core": "*",
+ "@types/qs": "*",
+ "@types/serve-static": "*"
+ }
+ },
+ "@types/express-serve-static-core": {
+ "version": "4.17.7",
+ "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.7.tgz",
+ "integrity": "sha512-EMgTj/DF9qpgLXyc+Btimg+XoH7A2liE8uKul8qSmMTHCeNYzydDKFdsJskDvw42UsesCnhO63dO0Grbj8J4Dw==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*",
+ "@types/qs": "*",
+ "@types/range-parser": "*"
+ }
+ },
+ "@types/mime": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.1.tgz",
+ "integrity": "sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==",
+ "dev": true
+ },
+ "@types/node": {
+ "version": "14.0.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.1.tgz",
+ "integrity": "sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==",
+ "dev": true
+ },
+ "@types/qs": {
+ "version": "6.9.2",
+ "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.2.tgz",
+ "integrity": "sha512-a9bDi4Z3zCZf4Lv1X/vwnvbbDYSNz59h3i3KdyuYYN+YrLjSeJD0dnphdULDfySvUv6Exy/O0K6wX/kQpnPQ+A==",
+ "dev": true
+ },
+ "@types/range-parser": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz",
+ "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==",
+ "dev": true
+ },
+ "@types/serve-static": {
+ "version": "1.13.3",
+ "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.3.tgz",
+ "integrity": "sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g==",
+ "dev": true,
+ "requires": {
+ "@types/express-serve-static-core": "*",
+ "@types/mime": "*"
+ }
+ },
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
diff --git a/packages/plugin-express/package.json b/packages/plugin-express/package.json
index db6e44d477..3e308384ed 100644
--- a/packages/plugin-express/package.json
+++ b/packages/plugin-express/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-express",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "dist/bugsnag-express.js",
"types": "types/bugsnag-express.d.ts",
"description": "@bugsnag/js error handling middleware for Express (and Connect) web servers",
@@ -29,11 +29,12 @@
"@bugsnag/js": "*"
},
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@types/express": "^4.17.6",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
},
"dependencies": {
+ "@bugsnag/core": "^7.1.0-alpha.0",
"iserror": "^0.0.2"
}
}
diff --git a/packages/plugin-express/types/bugsnag-express.d.ts b/packages/plugin-express/types/bugsnag-express.d.ts
index aa09ed6ef6..4fb404dd00 100644
--- a/packages/plugin-express/types/bugsnag-express.d.ts
+++ b/packages/plugin-express/types/bugsnag-express.d.ts
@@ -1,3 +1,28 @@
-import { Plugin } from '@bugsnag/node'
+import { Plugin, Client } from '@bugsnag/core'
+import express from 'express'
+
declare const bugsnagPluginExpress: Plugin
export default bugsnagPluginExpress
+
+interface BugsnagPluginExpressResult {
+ errorHandler: express.ErrorRequestHandler
+ requestHandler: express.RequestHandler
+}
+
+// add a new call signature for the getPlugin() method that types the plugin result
+declare module '@bugsnag/core' {
+ interface Client {
+ getPlugin(id: 'express'): BugsnagPluginExpressResult | undefined
+ }
+}
+
+// define req.bugsnag for express request handlers by declaration merging on the
+// global interfaces according to the pattern described in the DefinitelyTyped repo:
+// https://github.com/DefinitelyTyped/DefinitelyTyped/blob/0bd28530564c3da2e728518084f22648af3a683c/types/express-serve-static-core/index.d.ts#L18-L26
+declare global {
+ namespace Express {
+ export interface Request {
+ bugsnag?: Client
+ }
+ }
+}
diff --git a/packages/plugin-inline-script-content/package-lock.json b/packages/plugin-inline-script-content/package-lock.json
index 20d538dc88..1c37778c22 100644
--- a/packages/plugin-inline-script-content/package-lock.json
+++ b/packages/plugin-inline-script-content/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-inline-script-content",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-inline-script-content/package.json b/packages/plugin-inline-script-content/package.json
index 15c367b3e6..9d7550b054 100644
--- a/packages/plugin-inline-script-content/package.json
+++ b/packages/plugin-inline-script-content/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-inline-script-content",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "inline-script-content.js",
"description": "@bugsnag/js plugin to attach inline script content to error events",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-interaction-breadcrumbs/package-lock.json b/packages/plugin-interaction-breadcrumbs/package-lock.json
index 2f67b2f4f4..5dfb02e0f9 100644
--- a/packages/plugin-interaction-breadcrumbs/package-lock.json
+++ b/packages/plugin-interaction-breadcrumbs/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-interaction-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-interaction-breadcrumbs/package.json b/packages/plugin-interaction-breadcrumbs/package.json
index c619a839be..252cd0f091 100644
--- a/packages/plugin-interaction-breadcrumbs/package.json
+++ b/packages/plugin-interaction-breadcrumbs/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-interaction-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "interaction-breadcrumbs.js",
"description": "@bugsnag/js plugin to record UI click events as breadcrumbs",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-intercept/package-lock.json b/packages/plugin-intercept/package-lock.json
index 847c61f0f7..27457568b0 100644
--- a/packages/plugin-intercept/package-lock.json
+++ b/packages/plugin-intercept/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-intercept",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-intercept/package.json b/packages/plugin-intercept/package.json
index f6bdc5f68a..710d72e279 100644
--- a/packages/plugin-intercept/package.json
+++ b/packages/plugin-intercept/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-intercept",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "intercept.js",
"description": "@bugsnag/js plugin providing convenience functions for intercepting asynchronous errors",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-koa/package-lock.json b/packages/plugin-koa/package-lock.json
index c6c7e362f7..30e90cd480 100644
--- a/packages/plugin-koa/package-lock.json
+++ b/packages/plugin-koa/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-koa",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -113,6 +113,145 @@
"to-fast-properties": "^2.0.0"
}
},
+ "@types/accepts": {
+ "version": "1.3.5",
+ "resolved": "https://registry.npmjs.org/@types/accepts/-/accepts-1.3.5.tgz",
+ "integrity": "sha512-jOdnI/3qTpHABjM5cx1Hc0sKsPoYCp+DP/GJRGtDlPd7fiV9oXGGIcjW/ZOxLIvjGz8MA+uMZI9metHlgqbgwQ==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "@types/body-parser": {
+ "version": "1.19.0",
+ "resolved": "https://registry.npmjs.org/@types/body-parser/-/body-parser-1.19.0.tgz",
+ "integrity": "sha512-W98JrE0j2K78swW4ukqMleo8R7h/pFETjM2DQ90MF6XK2i4LO4W3gQ71Lt4w3bfm2EvVSyWHplECvB5sK22yFQ==",
+ "dev": true,
+ "requires": {
+ "@types/connect": "*",
+ "@types/node": "*"
+ }
+ },
+ "@types/connect": {
+ "version": "3.4.33",
+ "resolved": "https://registry.npmjs.org/@types/connect/-/connect-3.4.33.tgz",
+ "integrity": "sha512-2+FrkXY4zllzTNfJth7jOqEHC+enpLeGslEhpnTAkg21GkRrWV4SsAtqchtT4YS9/nODBU2/ZfsBY2X4J/dX7A==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "@types/content-disposition": {
+ "version": "0.5.3",
+ "resolved": "https://registry.npmjs.org/@types/content-disposition/-/content-disposition-0.5.3.tgz",
+ "integrity": "sha512-P1bffQfhD3O4LW0ioENXUhZ9OIa0Zn+P7M+pWgkCKaT53wVLSq0mrKksCID/FGHpFhRSxRGhgrQmfhRuzwtKdg==",
+ "dev": true
+ },
+ "@types/cookies": {
+ "version": "0.7.4",
+ "resolved": "https://registry.npmjs.org/@types/cookies/-/cookies-0.7.4.tgz",
+ "integrity": "sha512-oTGtMzZZAVuEjTwCjIh8T8FrC8n/uwy+PG0yTvQcdZ7etoel7C7/3MSd7qrukENTgQtotG7gvBlBojuVs7X5rw==",
+ "dev": true,
+ "requires": {
+ "@types/connect": "*",
+ "@types/express": "*",
+ "@types/keygrip": "*",
+ "@types/node": "*"
+ }
+ },
+ "@types/express": {
+ "version": "4.17.6",
+ "resolved": "https://registry.npmjs.org/@types/express/-/express-4.17.6.tgz",
+ "integrity": "sha512-n/mr9tZI83kd4azlPG5y997C/M4DNABK9yErhFM6hKdym4kkmd9j0vtsJyjFIwfRBxtrxZtAfGZCNRIBMFLK5w==",
+ "dev": true,
+ "requires": {
+ "@types/body-parser": "*",
+ "@types/express-serve-static-core": "*",
+ "@types/qs": "*",
+ "@types/serve-static": "*"
+ }
+ },
+ "@types/express-serve-static-core": {
+ "version": "4.17.7",
+ "resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.17.7.tgz",
+ "integrity": "sha512-EMgTj/DF9qpgLXyc+Btimg+XoH7A2liE8uKul8qSmMTHCeNYzydDKFdsJskDvw42UsesCnhO63dO0Grbj8J4Dw==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*",
+ "@types/qs": "*",
+ "@types/range-parser": "*"
+ }
+ },
+ "@types/http-assert": {
+ "version": "1.5.1",
+ "resolved": "https://registry.npmjs.org/@types/http-assert/-/http-assert-1.5.1.tgz",
+ "integrity": "sha512-PGAK759pxyfXE78NbKxyfRcWYA/KwW17X290cNev/qAsn9eQIxkH4shoNBafH37wewhDG/0p1cHPbK6+SzZjWQ==",
+ "dev": true
+ },
+ "@types/keygrip": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@types/keygrip/-/keygrip-1.0.2.tgz",
+ "integrity": "sha512-GJhpTepz2udxGexqos8wgaBx4I/zWIDPh/KOGEwAqtuGDkOUJu5eFvwmdBX4AmB8Odsr+9pHCQqiAqDL/yKMKw==",
+ "dev": true
+ },
+ "@types/koa": {
+ "version": "2.11.3",
+ "resolved": "https://registry.npmjs.org/@types/koa/-/koa-2.11.3.tgz",
+ "integrity": "sha512-ABxVkrNWa4O/Jp24EYI/hRNqEVRlhB9g09p48neQp4m3xL1TJtdWk2NyNQSMCU45ejeELMQZBYyfstyVvO2H3Q==",
+ "dev": true,
+ "requires": {
+ "@types/accepts": "*",
+ "@types/content-disposition": "*",
+ "@types/cookies": "*",
+ "@types/http-assert": "*",
+ "@types/keygrip": "*",
+ "@types/koa-compose": "*",
+ "@types/node": "*"
+ }
+ },
+ "@types/koa-compose": {
+ "version": "3.2.5",
+ "resolved": "https://registry.npmjs.org/@types/koa-compose/-/koa-compose-3.2.5.tgz",
+ "integrity": "sha512-B8nG/OoE1ORZqCkBVsup/AKcvjdgoHnfi4pZMn5UwAPCbhk/96xyv284eBYW8JlQbQ7zDmnpFr68I/40mFoIBQ==",
+ "dev": true,
+ "requires": {
+ "@types/koa": "*"
+ }
+ },
+ "@types/mime": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/@types/mime/-/mime-2.0.1.tgz",
+ "integrity": "sha512-FwI9gX75FgVBJ7ywgnq/P7tw+/o1GUbtP0KzbtusLigAOgIgNISRK0ZPl4qertvXSIE8YbsVJueQ90cDt9YYyw==",
+ "dev": true
+ },
+ "@types/node": {
+ "version": "14.0.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.1.tgz",
+ "integrity": "sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==",
+ "dev": true
+ },
+ "@types/qs": {
+ "version": "6.9.2",
+ "resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.2.tgz",
+ "integrity": "sha512-a9bDi4Z3zCZf4Lv1X/vwnvbbDYSNz59h3i3KdyuYYN+YrLjSeJD0dnphdULDfySvUv6Exy/O0K6wX/kQpnPQ+A==",
+ "dev": true
+ },
+ "@types/range-parser": {
+ "version": "1.2.3",
+ "resolved": "https://registry.npmjs.org/@types/range-parser/-/range-parser-1.2.3.tgz",
+ "integrity": "sha512-ewFXqrQHlFsgc09MK5jP5iR7vumV/BYayNC6PgJO2LPe8vrnNFyjQjSppfEngITi0qvfKtzFvgKymGheFM9UOA==",
+ "dev": true
+ },
+ "@types/serve-static": {
+ "version": "1.13.3",
+ "resolved": "https://registry.npmjs.org/@types/serve-static/-/serve-static-1.13.3.tgz",
+ "integrity": "sha512-oprSwp094zOglVrXdlo/4bAHtKTAxX6VT8FOZlBKrmyLbNvE1zxZyJ6yikMVtHIvwP45+ZQGJn+FdXGKTozq0g==",
+ "dev": true,
+ "requires": {
+ "@types/express-serve-static-core": "*",
+ "@types/mime": "*"
+ }
+ },
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
diff --git a/packages/plugin-koa/package.json b/packages/plugin-koa/package.json
index 88cac8b170..5a5a4b79ce 100644
--- a/packages/plugin-koa/package.json
+++ b/packages/plugin-koa/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-koa",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "dist/bugsnag-koa.js",
"types": "types/bugsnag-koa.d.ts",
"description": "@bugsnag/js error handling middleware for Koa web servers",
@@ -29,11 +29,12 @@
"@bugsnag/js": "*"
},
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@types/koa": "^2.11.3",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
},
"dependencies": {
+ "@bugsnag/core": "^7.1.0-alpha.0",
"iserror": "^0.0.2"
}
}
diff --git a/packages/plugin-koa/types/bugsnag-koa.d.ts b/packages/plugin-koa/types/bugsnag-koa.d.ts
index aaf28628bb..513166ac4b 100644
--- a/packages/plugin-koa/types/bugsnag-koa.d.ts
+++ b/packages/plugin-koa/types/bugsnag-koa.d.ts
@@ -1,3 +1,23 @@
-import { Plugin } from '@bugsnag/node'
+import { Client, Plugin } from '@bugsnag/core'
+import * as Koa from 'koa'
declare const bugsnagPluginKoa: Plugin
export default bugsnagPluginKoa
+
+interface BugsnagPluginKoaResult {
+ errorHandler: (err: Error, ctx: Koa.Context) => void
+ requestHandler: Koa.Middleware
+}
+
+// add a new call signature for the getPlugin() method that types the plugin result
+declare module '@bugsnag/core' {
+ interface Client {
+ getPlugin(id: 'koa'): BugsnagPluginKoaResult | undefined
+ }
+}
+
+// define ctx.bugsnag for koa middleware by declaration merging
+declare module 'koa' {
+ interface BaseContext {
+ bugsnag?: Client
+ }
+}
diff --git a/packages/plugin-navigation-breadcrumbs/package-lock.json b/packages/plugin-navigation-breadcrumbs/package-lock.json
index 5a3fe5e7e9..4687953ca8 100644
--- a/packages/plugin-navigation-breadcrumbs/package-lock.json
+++ b/packages/plugin-navigation-breadcrumbs/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-navigation-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-navigation-breadcrumbs/package.json b/packages/plugin-navigation-breadcrumbs/package.json
index 78838f9afb..c44ecfa353 100644
--- a/packages/plugin-navigation-breadcrumbs/package.json
+++ b/packages/plugin-navigation-breadcrumbs/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-navigation-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "navigation-breadcrumbs.js",
"description": "@bugsnag/js plugin to record browser navigation as breadcrumbs",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-network-breadcrumbs/package-lock.json b/packages/plugin-network-breadcrumbs/package-lock.json
index bd29b175ad..b45d5e912a 100644
--- a/packages/plugin-network-breadcrumbs/package-lock.json
+++ b/packages/plugin-network-breadcrumbs/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-network-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-network-breadcrumbs/package.json b/packages/plugin-network-breadcrumbs/package.json
index 9f1698b911..1edc0b42b6 100644
--- a/packages/plugin-network-breadcrumbs/package.json
+++ b/packages/plugin-network-breadcrumbs/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-network-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "network-breadcrumbs.js",
"description": "@bugsnag/js plugin to record browser requests as breadcrumbs",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-node-device/package-lock.json b/packages/plugin-node-device/package-lock.json
index f19740482e..7aa6347b13 100644
--- a/packages/plugin-node-device/package-lock.json
+++ b/packages/plugin-node-device/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-device",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-node-device/package.json b/packages/plugin-node-device/package.json
index aa9c0345fc..be4aed728f 100644
--- a/packages/plugin-node-device/package.json
+++ b/packages/plugin-node-device/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-device",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "device.js",
"description": "@bugsnag/js plugin to set device info in node",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-node-in-project/package-lock.json b/packages/plugin-node-in-project/package-lock.json
index 6d80d7005c..a7f1507f68 100644
--- a/packages/plugin-node-in-project/package-lock.json
+++ b/packages/plugin-node-in-project/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-in-project",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-node-in-project/package.json b/packages/plugin-node-in-project/package.json
index 4480095eea..f440629c7a 100644
--- a/packages/plugin-node-in-project/package.json
+++ b/packages/plugin-node-in-project/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-in-project",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "in-project.js",
"description": "@bugsnag/js plugin to mark wether stackframes are 'in-project'",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-node-surrounding-code/package-lock.json b/packages/plugin-node-surrounding-code/package-lock.json
index 61bb37eb16..a831af2a7b 100644
--- a/packages/plugin-node-surrounding-code/package-lock.json
+++ b/packages/plugin-node-surrounding-code/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-surrounding-code",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-node-surrounding-code/package.json b/packages/plugin-node-surrounding-code/package.json
index 18db58dc74..5331fa9954 100644
--- a/packages/plugin-node-surrounding-code/package.json
+++ b/packages/plugin-node-surrounding-code/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-surrounding-code",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "surrounding-code.js",
"description": "@bugsnag/js plugin to load surrounding code in Node stacktraces",
"homepage": "https://www.bugsnag.com/",
@@ -24,7 +24,7 @@
"pump": "^3.0.0"
},
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-node-uncaught-exception/package-lock.json b/packages/plugin-node-uncaught-exception/package-lock.json
index f2627fb3bd..1295fbe851 100644
--- a/packages/plugin-node-uncaught-exception/package-lock.json
+++ b/packages/plugin-node-uncaught-exception/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-uncaught-exception",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-node-uncaught-exception/package.json b/packages/plugin-node-uncaught-exception/package.json
index 334ad82e77..f4c61dac7a 100644
--- a/packages/plugin-node-uncaught-exception/package.json
+++ b/packages/plugin-node-uncaught-exception/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-uncaught-exception",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "uncaught-exception.js",
"description": "@bugsnag/js plugin to capture and report uncaught exceptions",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-node-unhandled-rejection/package-lock.json b/packages/plugin-node-unhandled-rejection/package-lock.json
index fc0677a4ee..ee10eb4f03 100644
--- a/packages/plugin-node-unhandled-rejection/package-lock.json
+++ b/packages/plugin-node-unhandled-rejection/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-unhandled-rejection",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-node-unhandled-rejection/package.json b/packages/plugin-node-unhandled-rejection/package.json
index b5d4308eaa..051b1f6a98 100644
--- a/packages/plugin-node-unhandled-rejection/package.json
+++ b/packages/plugin-node-unhandled-rejection/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-node-unhandled-rejection",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "unhandled-rejection.js",
"description": "@bugsnag/js plugin to capture and report unhandled rejections",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-react-native-app-state-breadcrumbs/package-lock.json b/packages/plugin-react-native-app-state-breadcrumbs/package-lock.json
index 5273bcf9bb..7571d281a7 100644
--- a/packages/plugin-react-native-app-state-breadcrumbs/package-lock.json
+++ b/packages/plugin-react-native-app-state-breadcrumbs/package-lock.json
@@ -2133,5 +2133,5 @@
"integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
}
},
- "version": "7.0.1"
+ "version": "7.1.0-alpha.0"
}
diff --git a/packages/plugin-react-native-app-state-breadcrumbs/package.json b/packages/plugin-react-native-app-state-breadcrumbs/package.json
index 87e0be8bfc..df493066f8 100644
--- a/packages/plugin-react-native-app-state-breadcrumbs/package.json
+++ b/packages/plugin-react-native-app-state-breadcrumbs/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-app-state-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "app-state.js",
"description": "@bugsnag/js plugin to create breadcrumbs when a React Native app enters the foreground/background",
"homepage": "https://www.bugsnag.com/",
@@ -17,6 +17,6 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
}
}
diff --git a/packages/plugin-react-native-connectivity-breadcrumbs/package-lock.json b/packages/plugin-react-native-connectivity-breadcrumbs/package-lock.json
index f65ea00609..7e9a34b30a 100644
--- a/packages/plugin-react-native-connectivity-breadcrumbs/package-lock.json
+++ b/packages/plugin-react-native-connectivity-breadcrumbs/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-connectivity-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-react-native-connectivity-breadcrumbs/package.json b/packages/plugin-react-native-connectivity-breadcrumbs/package.json
index eb3fd9face..7f9bc27fbc 100644
--- a/packages/plugin-react-native-connectivity-breadcrumbs/package.json
+++ b/packages/plugin-react-native-connectivity-breadcrumbs/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-connectivity-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "connectivity.js",
"description": "@bugsnag/js plugin to create breadcrumbs when the network status changes in a React Native app",
"homepage": "https://www.bugsnag.com/",
@@ -23,7 +23,7 @@
"@react-native-community/netinfo": "5.5.0"
},
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-react-native-global-error-handler/package-lock.json b/packages/plugin-react-native-global-error-handler/package-lock.json
index f954e218b4..b4cd9fce9e 100644
--- a/packages/plugin-react-native-global-error-handler/package-lock.json
+++ b/packages/plugin-react-native-global-error-handler/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-global-error-handler",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-react-native-global-error-handler/package.json b/packages/plugin-react-native-global-error-handler/package.json
index f65423b418..a9d74a3680 100644
--- a/packages/plugin-react-native-global-error-handler/package.json
+++ b/packages/plugin-react-native-global-error-handler/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-global-error-handler",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "error-handler.js",
"description": "@bugsnag/js plugin to report unhandled exceptions in React Native",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-react-native-orientation-breadcrumbs/package-lock.json b/packages/plugin-react-native-orientation-breadcrumbs/package-lock.json
index d8c39deb62..0f5645d156 100644
--- a/packages/plugin-react-native-orientation-breadcrumbs/package-lock.json
+++ b/packages/plugin-react-native-orientation-breadcrumbs/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-orientation-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-react-native-orientation-breadcrumbs/package.json b/packages/plugin-react-native-orientation-breadcrumbs/package.json
index 486bc010ae..d9bf6a4622 100644
--- a/packages/plugin-react-native-orientation-breadcrumbs/package.json
+++ b/packages/plugin-react-native-orientation-breadcrumbs/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-orientation-breadcrumbs",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "orientation.js",
"description": "@bugsnag/js plugin to create breadcrumbs when the device orientation changes in a React Native app",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-react-native-unhandled-rejection/package-lock.json b/packages/plugin-react-native-unhandled-rejection/package-lock.json
index b3b78bf5ea..ca762d08e7 100644
--- a/packages/plugin-react-native-unhandled-rejection/package-lock.json
+++ b/packages/plugin-react-native-unhandled-rejection/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-unhandled-rejection",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-react-native-unhandled-rejection/package.json b/packages/plugin-react-native-unhandled-rejection/package.json
index 26b9f5ec61..1b434afdc7 100644
--- a/packages/plugin-react-native-unhandled-rejection/package.json
+++ b/packages/plugin-react-native-unhandled-rejection/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react-native-unhandled-rejection",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "rejection-handler.js",
"description": "@bugsnag/js plugin to report unhandled promise rejections in React Native",
"homepage": "https://www.bugsnag.com/",
@@ -17,7 +17,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"promise": "^8.0.2"
}
}
diff --git a/packages/plugin-react/package-lock.json b/packages/plugin-react/package-lock.json
index eeb44eebfe..8b7a25a1a9 100644
--- a/packages/plugin-react/package-lock.json
+++ b/packages/plugin-react/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-react",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-react/package.json b/packages/plugin-react/package.json
index 3fecd93504..2793350ab6 100644
--- a/packages/plugin-react/package.json
+++ b/packages/plugin-react/package.json
@@ -1,10 +1,10 @@
{
"name": "@bugsnag/plugin-react",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "dist/bugsnag-react.js",
"description": "React integration for @bugsnag/js",
"browser": "dist/bugsnag-react.js",
- "types": "dist/types/bugsnag-plugin-react.d.ts",
+ "types": "types/bugsnag-plugin-react.d.ts",
"homepage": "https://www.bugsnag.com/",
"repository": {
"type": "git",
@@ -14,17 +14,17 @@
"access": "public"
},
"files": [
- "dist"
+ "dist",
+ "types"
],
"scripts": {
"clean": "rm -fr dist && mkdir dist",
- "bundle-types": "../../bin/bundle-types bugsnag-plugin-react",
- "build": "npm run clean && ../../bin/bundle src/index.js --standalone=BugsnagPluginReact | ../../bin/extract-source-map dist/bugsnag-react.js && npm run bundle-types",
+ "build": "npm run clean && ../../bin/bundle src/index.js --standalone=BugsnagPluginReact | ../../bin/extract-source-map dist/bugsnag-react.js",
"postversion": "npm run build"
},
"author": "Bugsnag",
"license": "MIT",
- "devDependencies": {
- "@bugsnag/core": "^7.0.1"
+ "dependencies": {
+ "@bugsnag/core": "^7.1.0-alpha.0"
}
}
diff --git a/packages/plugin-react/src/index.js b/packages/plugin-react/src/index.js
index e05c50152c..69fa63b25c 100644
--- a/packages/plugin-react/src/index.js
+++ b/packages/plugin-react/src/index.js
@@ -1,48 +1,38 @@
-module.exports = class BugsnagReactPlugin {
- constructor (React = window.React) {
- if (!React) throw new Error('cannot find React')
- this.React = React
+module.exports = class BugsnagPluginReact {
+ constructor (...args) {
this.name = 'react'
+ this.lazy = args.length === 0 && !window.React
+ if (!this.lazy) {
+ this.React = args[0] || window.React
+ if (!this.React) throw new Error('@bugsnag/plugin-react reference to `React` was undefined')
+ }
}
load (client) {
- const React = this.React
-
- class ErrorBoundary extends React.Component {
- constructor (props) {
- super(props)
- this.state = {
- error: null,
- info: null
- }
- }
-
- componentDidCatch (error, info) {
- const { onError } = this.props
- const handledState = { severity: 'error', unhandled: true, severityReason: { type: 'unhandledException' } }
- const event = client.Event.create(
- error,
- true,
- handledState,
- 1
- )
- if (info && info.componentStack) info.componentStack = formatComponentStack(info.componentStack)
- event.addMetadata('react', info)
- client._notify(event, onError)
- this.setState({ error, info })
- }
-
- render () {
- const { error } = this.state
- if (error) {
- const { FallbackComponent } = this.props
- if (FallbackComponent) return React.createElement(FallbackComponent, this.state)
- return null
- }
- return this.props.children
- }
+ if (!this.lazy) {
+ const ErrorBoundary = createClass(this.React, client)
+ ErrorBoundary.createErrorBoundary = () => ErrorBoundary
+ return ErrorBoundary
+ }
+
+ const BugsnagPluginReactLazyInitializer = function () {
+ throw new Error(`@bugsnag/plugin-react was used incorrectly. Valid usage is as follows:
+Pass React to the plugin constructor
+
+ \`Bugsnag.start({ plugins: [new BugsnagPluginReact(React)] })\`
+and then call \`const ErrorBoundary = Bugsnag.getPlugin('react').createErrorBoundary()\`
+
+Or if React is not available until after Bugsnag has started,
+construct the plugin with no arguments
+ \`Bugsnag.start({ plugins: [new BugsnagPluginReact()] })\`,
+then pass in React when available to construct your error boundary
+ \`const ErrorBoundary = Bugsnag.getPlugin('react').createErrorBoundary(React)\``)
}
- return ErrorBoundary
+ BugsnagPluginReactLazyInitializer.createErrorBoundary = (React) => {
+ if (!React) throw new Error('@bugsnag/plugin-react reference to `React` was undefined')
+ return createClass(React, client)
+ }
+ return BugsnagPluginReactLazyInitializer
}
}
@@ -55,5 +45,45 @@ const formatComponentStack = str => {
return ret
}
+const createClass = (React, client) => class ErrorBoundary extends React.Component {
+ constructor (props) {
+ super(props)
+ this.state = {
+ error: null,
+ info: null
+ }
+ this.handleClearError = this.handleClearError.bind(this)
+ }
+
+ handleClearError () {
+ this.setState({ error: null, info: null })
+ }
+
+ componentDidCatch (error, info) {
+ const { onError } = this.props
+ const handledState = { severity: 'error', unhandled: true, severityReason: { type: 'unhandledException' } }
+ const event = client.Event.create(
+ error,
+ true,
+ handledState,
+ 1
+ )
+ if (info && info.componentStack) info.componentStack = formatComponentStack(info.componentStack)
+ event.addMetadata('react', info)
+ client._notify(event, onError)
+ this.setState({ error, info })
+ }
+
+ render () {
+ const { error } = this.state
+ if (error) {
+ const { FallbackComponent } = this.props
+ if (FallbackComponent) return React.createElement(FallbackComponent, { ...this.state, clearError: this.handleClearError })
+ return null
+ }
+ return this.props.children
+ }
+}
+
module.exports.formatComponentStack = formatComponentStack
module.exports.default = module.exports
diff --git a/packages/plugin-react/src/test/__snapshots__/index.test.tsx.snap b/packages/plugin-react/src/test/__snapshots__/index.test.tsx.snap
index fa3365b3a4..6370955c27 100644
--- a/packages/plugin-react/src/test/__snapshots__/index.test.tsx.snap
+++ b/packages/plugin-react/src/test/__snapshots__/index.test.tsx.snap
@@ -5,3 +5,11 @@ exports[`does not render FallbackComponent when no error 1`] = `"test"`;
exports[`renders FallbackComponent on error 1`] = `"fallback"`;
exports[`renders correctly 1`] = `"test"`;
+
+exports[`resets the error boundary when the FallbackComponent calls the passed clearError prop 1`] = `
+
+ click for error
+
+`;
diff --git a/packages/plugin-react/src/test/index.test.tsx b/packages/plugin-react/src/test/index.test.tsx
index ef14aad973..0f47e2b25d 100644
--- a/packages/plugin-react/src/test/index.test.tsx
+++ b/packages/plugin-react/src/test/index.test.tsx
@@ -1,28 +1,22 @@
-import React from 'react'
-import renderer from 'react-test-renderer'
+import React, { useState } from 'react'
+import { create, act } from 'react-test-renderer'
import BugsnagPluginReact from '..'
+import Client from '@bugsnag/core/client'
-class Event {
- static create () {
- return new Event()
- }
-
- addMetadata () {
- return this
- }
-}
+const client = new Client({ apiKey: '123', plugins: [new BugsnagPluginReact(React)] }, undefined)
+client._notify = jest.fn()
-const bugsnag = {
- Event,
- _notify: jest.fn()
+interface FallbackComponentProps {
+ error: Error
+ info: React.ErrorInfo
+ clearError: () => void
}
+type FallbackComponentType = React.ComponentType
-const plugin = new BugsnagPluginReact(React)
-const ErrorBoundary = plugin.load(bugsnag)
+// eslint-disable-next-line
+const ErrorBoundary = client.getPlugin('react')!.createErrorBoundary()
-beforeEach(() => {
- bugsnag._notify.mockReset()
-})
+beforeEach(() => (client._notify as jest.Mock).mockClear())
test('formatComponentStack(str)', () => {
const str = `
@@ -39,61 +33,111 @@ const BadComponent = () => {
// see https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20544
const GoodComponent = (): JSX.Element => 'test' as unknown as JSX.Element
+const ComponentWithBadButton = () => {
+ const [clicked, setClicked] = useState(false)
+
+ if (clicked) {
+ throw new Error('bad button')
+ }
+ return setClicked(true)}>click for error
+}
+
it('renders correctly', () => {
- const tree = renderer
- .create( )
+ const tree = create( )
.toJSON()
expect(tree).toMatchSnapshot()
})
it('renders correctly on error', () => {
- const tree = renderer
- .create( )
+ const tree = create( )
.toJSON()
expect(tree).toBe(null)
})
it('calls notify on error', () => {
- renderer
- .create( )
+ create( )
.toJSON()
- expect(bugsnag._notify).toHaveBeenCalledTimes(1)
+ expect(client._notify).toHaveBeenCalledTimes(1)
})
it('does not render FallbackComponent when no error', () => {
- const FallbackComponent = jest.fn(() => 'fallback')
- const tree = renderer
- .create( )
+ const FallbackComponent = jest.fn(() => 'fallback') as unknown as FallbackComponentType
+ const tree = create( )
.toJSON()
expect(tree).toMatchSnapshot()
expect(FallbackComponent).toHaveBeenCalledTimes(0)
})
it('renders FallbackComponent on error', () => {
- const FallbackComponent = jest.fn(() => 'fallback')
- const tree = renderer
- .create( )
+ const FallbackComponent = jest.fn(() => 'fallback') as unknown as FallbackComponentType
+ const tree = create( )
.toJSON()
expect(tree).toMatchSnapshot()
})
it('passes the props to the FallbackComponent', () => {
- const FallbackComponent = jest.fn(() => 'fallback')
- renderer
- .create( )
+ const FallbackComponent = jest.fn(() => 'fallback') as unknown as FallbackComponentType
+ create( )
expect(FallbackComponent).toBeCalledWith({
error: expect.any(Error),
- info: { componentStack: expect.any(String) }
+ info: { componentStack: expect.any(String) },
+ clearError: expect.any(Function)
}, {})
})
+it('resets the error boundary when the FallbackComponent calls the passed clearError prop', () => {
+ const FallbackComponent = ({ clearError }: FallbackComponentProps) => {
+ return (
+ clearError()}>clearError
+ )
+ }
+
+ const component = create( )
+ const instance = component.root
+
+ // Trigger a render exception
+ const badButton = instance.findByType(ComponentWithBadButton).findByType('button')
+ act(() => {
+ badButton.props.onClick()
+ })
+
+ // Click the button in the fallback, which calls clearError
+ const button = instance.findByType(FallbackComponent).findByType('button')
+ act(() => {
+ button.props.onClick()
+ })
+
+ // expect to see ComponentWithBadButton again
+ expect(component.toJSON()).toMatchSnapshot()
+})
+
+it('a bad FallbackComponent implementation does not trigger stack overflow', () => {
+ const BadFallbackComponentImplementation = ({ error, info, clearError }: FallbackComponentProps) => {
+ function log (o: any) {}
+ log(error)
+ clearError()
+
+ return fallback
+ }
+
+ expect(() => {
+ create( )
+ }).toThrow()
+})
+
it('it passes the onError function to the Bugsnag notify call', () => {
const onError = () => {}
- renderer
- .create( )
+ create( )
.toJSON()
- expect(bugsnag._notify).toBeCalledWith(
- expect.any(Event),
+ expect(client._notify).toBeCalledWith(
+ expect.any(client.Event),
onError
)
})
+
+it('supports passing reference to React when the error boundary is created', () => {
+ const client = new Client({ apiKey: '123', plugins: [new BugsnagPluginReact()] }, undefined)
+ // eslint-disable-next-line
+ const ErrorBoundary = client.getPlugin('react')!.createErrorBoundary(React)
+ expect(ErrorBoundary).toBeTruthy()
+})
diff --git a/packages/plugin-react/types/bugsnag-plugin-react.d.ts b/packages/plugin-react/types/bugsnag-plugin-react.d.ts
index 8d5a41ea8e..e36f86fba1 100644
--- a/packages/plugin-react/types/bugsnag-plugin-react.d.ts
+++ b/packages/plugin-react/types/bugsnag-plugin-react.d.ts
@@ -1,4 +1,4 @@
-import { Plugin } from '@bugsnag/core'
+import { Plugin, Client, OnErrorCallback } from '@bugsnag/core'
import React from 'react'
// eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -8,4 +8,24 @@ declare class BugsnagPluginReact {
constructor(react?: typeof React)
}
+type BugsnagErrorBoundary = React.ComponentType<{
+ onError?: OnErrorCallback
+ FallbackComponent?: React.ComponentType<{
+ error: Error
+ info: React.ErrorInfo
+ clearError: () => void
+ }>
+}>
+
+interface BugsnagPluginReactResult {
+ createErrorBoundary(react?: typeof React): BugsnagErrorBoundary
+}
+
+// add a new call signature for the getPlugin() method that types the react plugin result
+declare module '@bugsnag/core' {
+ interface Client {
+ getPlugin(id: 'react'): BugsnagPluginReactResult | undefined
+ }
+}
+
export default BugsnagPluginReact
diff --git a/packages/plugin-restify/package-lock.json b/packages/plugin-restify/package-lock.json
index 4fbed0e90a..178436119f 100644
--- a/packages/plugin-restify/package-lock.json
+++ b/packages/plugin-restify/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-restify",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
@@ -113,6 +113,58 @@
"to-fast-properties": "^2.0.0"
}
},
+ "@types/bunyan": {
+ "version": "1.8.6",
+ "resolved": "https://registry.npmjs.org/@types/bunyan/-/bunyan-1.8.6.tgz",
+ "integrity": "sha512-YiozPOOsS6bIuz31ilYqR5SlLif4TBWsousN2aCWLi5233nZSX19tFbcQUPdR7xJ8ypPyxkCGNxg0CIV5n9qxQ==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "@types/events": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz",
+ "integrity": "sha512-EaObqwIvayI5a8dCzhFrjKzVwKLxjoG9T6Ppd5CEo07LRKfQ8Yokw54r5+Wq7FaBQ+yXRvQAYPrHwya1/UFt9g==",
+ "dev": true
+ },
+ "@types/formidable": {
+ "version": "1.0.31",
+ "resolved": "https://registry.npmjs.org/@types/formidable/-/formidable-1.0.31.tgz",
+ "integrity": "sha512-dIhM5t8lRP0oWe2HF8MuPvdd1TpPTjhDMAqemcq6oIZQCBQTovhBAdTQ5L5veJB4pdQChadmHuxtB0YzqvfU3Q==",
+ "dev": true,
+ "requires": {
+ "@types/events": "*",
+ "@types/node": "*"
+ }
+ },
+ "@types/node": {
+ "version": "14.0.1",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.0.1.tgz",
+ "integrity": "sha512-FAYBGwC+W6F9+huFIDtn43cpy7+SzG+atzRiTfdp3inUKL2hXnd4rG8hylJLIh4+hqrQy1P17kvJByE/z825hA==",
+ "dev": true
+ },
+ "@types/restify": {
+ "version": "8.4.2",
+ "resolved": "https://registry.npmjs.org/@types/restify/-/restify-8.4.2.tgz",
+ "integrity": "sha512-jdXB0IrsigqMccBMs3a2kBUUAlYTbjLCbfC63sI00rwTXc+B4UQniGkAJCGS27CAxwkJFAFXzpk0msOQtQ1RXA==",
+ "dev": true,
+ "requires": {
+ "@types/bunyan": "*",
+ "@types/formidable": "*",
+ "@types/node": "*",
+ "@types/spdy": "*"
+ }
+ },
+ "@types/spdy": {
+ "version": "3.4.4",
+ "resolved": "https://registry.npmjs.org/@types/spdy/-/spdy-3.4.4.tgz",
+ "integrity": "sha512-N9LBlbVRRYq6HgYpPkqQc3a9HJ/iEtVZToW6xlTtJiMhmRJ7jJdV7TaZQJw/Ve/1ePUsQiCTDc4JMuzzag94GA==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
"ansi-styles": {
"version": "3.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
diff --git a/packages/plugin-restify/package.json b/packages/plugin-restify/package.json
index b30c179f03..712934da57 100644
--- a/packages/plugin-restify/package.json
+++ b/packages/plugin-restify/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-restify",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "dist/bugsnag-restify.js",
"types": "types/bugsnag-restify.d.ts",
"description": "@bugsnag/js error handling middleware for Restify web servers",
@@ -29,11 +29,12 @@
"@bugsnag/js": "*"
},
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@types/restify": "^8.4.2",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
},
"dependencies": {
+ "@bugsnag/core": "^7.1.0-alpha.0",
"iserror": "^0.0.2"
}
}
diff --git a/packages/plugin-restify/types/bugsnag-restify.d.ts b/packages/plugin-restify/types/bugsnag-restify.d.ts
index 6fedc4ec15..16542a5c4a 100644
--- a/packages/plugin-restify/types/bugsnag-restify.d.ts
+++ b/packages/plugin-restify/types/bugsnag-restify.d.ts
@@ -1,3 +1,23 @@
-import { Plugin } from '@bugsnag/node'
+import { Client, Plugin } from '@bugsnag/core'
+import restify from 'restify'
+
declare const bugsnagPluginRestify: Plugin
export default bugsnagPluginRestify
+
+interface BugsnagPluginRestifyResult {
+ requestHandler: restify.RequestHandler
+ errorHandler: (req: restify.Request, res: restify.Response, err: Error, cb: (...args: any[]) => void) => void
+}
+
+// add a new call signature for the getPlugin() method that types the plugin result
+declare module '@bugsnag/core' {
+ interface Client {
+ getPlugin(id: 'restify'): BugsnagPluginRestifyResult | undefined
+ }
+}
+
+declare module 'restify' {
+ interface Request {
+ bugsnag?: Client
+ }
+}
diff --git a/packages/plugin-server-session/package-lock.json b/packages/plugin-server-session/package-lock.json
index 85b21d2fa1..8cea04cde0 100644
--- a/packages/plugin-server-session/package-lock.json
+++ b/packages/plugin-server-session/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-server-session",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-server-session/package.json b/packages/plugin-server-session/package.json
index 3d0c637546..847090be74 100644
--- a/packages/plugin-server-session/package.json
+++ b/packages/plugin-server-session/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-server-session",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "session.js",
"description": "@bugsnag/js plugin to enable session tracking in server applications",
"homepage": "https://www.bugsnag.com/",
@@ -17,7 +17,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"backo": "^1.1.0"
}
}
diff --git a/packages/plugin-simple-throttle/package-lock.json b/packages/plugin-simple-throttle/package-lock.json
index b667da89d0..e56d65ff68 100644
--- a/packages/plugin-simple-throttle/package-lock.json
+++ b/packages/plugin-simple-throttle/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-simple-throttle",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-simple-throttle/package.json b/packages/plugin-simple-throttle/package.json
index 6e000d087d..75449294b0 100644
--- a/packages/plugin-simple-throttle/package.json
+++ b/packages/plugin-simple-throttle/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-simple-throttle",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "throttle.js",
"description": "@bugsnag/js plugin to prevent too many events from being sent",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-strip-project-root/package-lock.json b/packages/plugin-strip-project-root/package-lock.json
index 0dfce15839..f69d83940e 100644
--- a/packages/plugin-strip-project-root/package-lock.json
+++ b/packages/plugin-strip-project-root/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-strip-project-root",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-strip-project-root/package.json b/packages/plugin-strip-project-root/package.json
index 821ec06c58..53da698d3e 100644
--- a/packages/plugin-strip-project-root/package.json
+++ b/packages/plugin-strip-project-root/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-strip-project-root",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "strip-project-root.js",
"description": "@bugsnag/js plugin to remove common project root paths from stacktraces",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-strip-query-string/package-lock.json b/packages/plugin-strip-query-string/package-lock.json
index 38f8e12853..22bfdf5049 100644
--- a/packages/plugin-strip-query-string/package-lock.json
+++ b/packages/plugin-strip-query-string/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-strip-query-string",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-strip-query-string/package.json b/packages/plugin-strip-query-string/package.json
index e4abe74091..7999bb61da 100644
--- a/packages/plugin-strip-query-string/package.json
+++ b/packages/plugin-strip-query-string/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-strip-query-string",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "strip-query-string.js",
"description": "@bugsnag/js plugin to strip query string and document fragment from stackframe filenames",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"dependencies": {
- "@bugsnag/core": "^7.0.1"
+ "@bugsnag/core": "^7.1.0-alpha.0"
},
"devDependencies": {
"jasmine": "^3.1.0",
diff --git a/packages/plugin-vue/package-lock.json b/packages/plugin-vue/package-lock.json
index 76ea81eb2a..96c8954c94 100644
--- a/packages/plugin-vue/package-lock.json
+++ b/packages/plugin-vue/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-vue",
- "version": "7.0.2",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-vue/package.json b/packages/plugin-vue/package.json
index e67a33ea5d..83ccc50bbe 100644
--- a/packages/plugin-vue/package.json
+++ b/packages/plugin-vue/package.json
@@ -1,10 +1,10 @@
{
"name": "@bugsnag/plugin-vue",
- "version": "7.0.2",
+ "version": "7.1.0-alpha.0",
"description": "Vue.js integration for bugsnag-js",
"main": "dist/bugsnag-vue.js",
"browser": "dist/bugsnag-vue.js",
- "types": "dist/types/bugsnag-plugin-vue.d.ts",
+ "types": "types/bugsnag-plugin-vue.d.ts",
"homepage": "https://www.bugsnag.com/",
"repository": {
"type": "git",
@@ -14,12 +14,12 @@
"access": "public"
},
"files": [
- "dist"
+ "dist",
+ "types"
],
"scripts": {
"clean": "rm -fr dist && mkdir dist",
- "bundle-types": "../../bin/bundle-types bugsnag-plugin-vue",
- "build": "npm run clean && ../../bin/bundle src/index.js --standalone=BugsnagPluginVue | ../../bin/extract-source-map dist/bugsnag-vue.js && npm run bundle-types",
+ "build": "npm run clean && ../../bin/bundle src/index.js --standalone=BugsnagPluginVue | ../../bin/extract-source-map dist/bugsnag-vue.js",
"postversion": "npm run build"
},
"author": "Bugsnag",
@@ -28,9 +28,11 @@
"@bugsnag/js": "*"
},
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
"jasmine": "^3.1.0",
"nyc": "^12.0.2",
"vue": "^2.5.8"
+ },
+ "dependencies": {
+ "@bugsnag/core": "^7.1.0-alpha.0"
}
}
diff --git a/packages/plugin-vue/src/index.js b/packages/plugin-vue/src/index.js
index aa1b379b38..74a9e4c517 100644
--- a/packages/plugin-vue/src/index.js
+++ b/packages/plugin-vue/src/index.js
@@ -1,33 +1,49 @@
-module.exports = class BugsnagVuePlugin {
- constructor (Vue = window.Vue) {
- if (!Vue) throw new Error('cannot find Vue')
- this.Vue = Vue
+module.exports = class BugsnagPluginVue {
+ constructor (...args) {
this.name = 'vue'
+ this.lazy = args.length === 0 && !window.Vue
+ if (!this.lazy) {
+ this.Vue = args[0] || window.Vue
+ if (!this.Vue) throw new Error('@bugsnag/plugin-vue reference to `Vue` was undefined')
+ }
}
load (client) {
- const Vue = this.Vue
- const prev = Vue.config.errorHandler
+ if (this.Vue) {
+ install(this.Vue, client)
+ return {
+ installVueErrorHandler: () => client._logger.warn('installVueErrorHandler() was called unnecessarily')
+ }
+ }
+ return {
+ installVueErrorHandler: Vue => {
+ if (!Vue) client._logger.error(new Error('@bugsnag/plugin-vue reference to `Vue` was undefined'))
+ install(Vue, client)
+ }
+ }
+ }
+}
- const handler = (err, vm, info) => {
- const handledState = { severity: 'error', unhandled: true, severityReason: { type: 'unhandledException' } }
- const event = client.Event.create(err, true, handledState, 1)
+const install = (Vue, client) => {
+ const prev = Vue.config.errorHandler
- event.addMetadata('vue', {
- errorInfo: info,
- component: vm ? formatComponentName(vm, true) : undefined,
- props: vm ? vm.$options.propsData : undefined
- })
+ const handler = (err, vm, info) => {
+ const handledState = { severity: 'error', unhandled: true, severityReason: { type: 'unhandledException' } }
+ const event = client.Event.create(err, true, handledState, 1)
- client._notify(event)
- if (typeof console !== 'undefined' && typeof console.error === 'function') console.error(err)
+ event.addMetadata('vue', {
+ errorInfo: info,
+ component: vm ? formatComponentName(vm, true) : undefined,
+ props: vm ? vm.$options.propsData : undefined
+ })
- if (typeof prev === 'function') prev.call(this, err, vm, info)
- }
+ client._notify(event)
+ if (typeof console !== 'undefined' && typeof console.error === 'function') console.error(err)
- Vue.config.errorHandler = handler
- return null
+ if (typeof prev === 'function') prev.call(this, err, vm, info)
}
+
+ Vue.config.errorHandler = handler
}
// taken and reworked from Vue.js source
diff --git a/packages/plugin-vue/test/index.test.ts b/packages/plugin-vue/test/index.test.ts
index 604520410c..b972d05824 100644
--- a/packages/plugin-vue/test/index.test.ts
+++ b/packages/plugin-vue/test/index.test.ts
@@ -5,7 +5,7 @@ import Vue from 'vue'
describe('bugsnag vue', () => {
it('throws when missing Vue', () => {
expect(() => {
- new BugsnagVuePlugin().load(new Client({ apiKey: 'API_KEYYY' }))
+ new BugsnagVuePlugin(undefined).load(new Client({ apiKey: 'API_KEYYY' }))
}).toThrow()
})
@@ -24,6 +24,23 @@ describe('bugsnag vue', () => {
Vue.config.errorHandler(new Error('oops'), { $root: true, $options: {} } as unknown as Vue, 'callback for watcher "fooBarBaz"')
})
+ it('supports Vue being passed later', done => {
+ const client = new Client({ apiKey: 'API_KEYYY', plugins: [new BugsnagVuePlugin()] })
+ // eslint-disable-next-line
+ client.getPlugin('vue')!.installVueErrorHandler(Vue)
+ client._setDelivery(client => ({
+ sendEvent: (payload) => {
+ expect(payload.events[0].errors[0].errorClass).toBe('Error')
+ expect(payload.events[0].errors[0].errorMessage).toBe('oops')
+ expect(payload.events[0]._metadata.vue).toBeDefined()
+ done()
+ },
+ sendSession: () => {}
+ }))
+ expect(typeof Vue.config.errorHandler).toBe('function')
+ Vue.config.errorHandler(new Error('oops'), { $root: true, $options: {} } as unknown as Vue, 'callback for watcher "fooBarBaz"')
+ })
+
it('bugsnag vue: classify(str)', () => {
expect(BugsnagVuePlugin.classify('foo_bar')).toBe('FooBar')
expect(BugsnagVuePlugin.classify('foo-bar')).toBe('FooBar')
diff --git a/packages/plugin-vue/types/bugsnag-plugin-vue.d.ts b/packages/plugin-vue/types/bugsnag-plugin-vue.d.ts
index 8982cbfc6b..b405b13fd4 100644
--- a/packages/plugin-vue/types/bugsnag-plugin-vue.d.ts
+++ b/packages/plugin-vue/types/bugsnag-plugin-vue.d.ts
@@ -1,4 +1,4 @@
-import { Plugin } from '@bugsnag/core'
+import { Plugin, Client } from '@bugsnag/core'
import { VueConstructor } from 'vue'
// eslint-disable-next-line @typescript-eslint/no-empty-interface
@@ -8,4 +8,15 @@ declare class BugsnagPluginVue {
constructor(Vue?: VueConstructor)
}
+interface BugsnagPluginVueResult {
+ installVueErrorHandler(vue?: VueConstructor): void
+}
+
+// add a new call signature for the getPlugin() method that types the vue plugin result
+declare module '@bugsnag/core' {
+ interface Client {
+ getPlugin(id: 'vue'): BugsnagPluginVueResult | undefined
+ }
+}
+
export default BugsnagPluginVue
diff --git a/packages/plugin-window-onerror/package-lock.json b/packages/plugin-window-onerror/package-lock.json
index f2b50967fe..752c4c6ba0 100644
--- a/packages/plugin-window-onerror/package-lock.json
+++ b/packages/plugin-window-onerror/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-window-onerror",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-window-onerror/package.json b/packages/plugin-window-onerror/package.json
index c968e97cf4..1dace9efe8 100644
--- a/packages/plugin-window-onerror/package.json
+++ b/packages/plugin-window-onerror/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-window-onerror",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "onerror.js",
"description": "@bugsnag/js plugin to report unhandled exceptions in browsers",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/packages/plugin-window-unhandled-rejection/package-lock.json b/packages/plugin-window-unhandled-rejection/package-lock.json
index af0dfc0e95..f83da14464 100644
--- a/packages/plugin-window-unhandled-rejection/package-lock.json
+++ b/packages/plugin-window-unhandled-rejection/package-lock.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-window-unhandled-rejection",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
diff --git a/packages/plugin-window-unhandled-rejection/package.json b/packages/plugin-window-unhandled-rejection/package.json
index 1463107250..303cb6abaf 100644
--- a/packages/plugin-window-unhandled-rejection/package.json
+++ b/packages/plugin-window-unhandled-rejection/package.json
@@ -1,6 +1,6 @@
{
"name": "@bugsnag/plugin-window-unhandled-rejection",
- "version": "7.0.1",
+ "version": "7.1.0-alpha.0",
"main": "unhandled-rejection.js",
"description": "@bugsnag/js plugin to report unhandled promise rejections in browsers",
"homepage": "https://www.bugsnag.com/",
@@ -20,7 +20,7 @@
"author": "Bugsnag",
"license": "MIT",
"devDependencies": {
- "@bugsnag/core": "^7.0.1",
+ "@bugsnag/core": "^7.1.0-alpha.0",
"jasmine": "^3.1.0",
"nyc": "^12.0.2"
}
diff --git a/tsconfig.json b/tsconfig.json
index e4d7cc788e..55bdce4227 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -68,5 +68,8 @@
"packages/plugin-server-session",
"packages/plugin-react",
"packages/plugin-vue",
+ "packages/plugin-express",
+ "packages/plugin-koa",
+ "packages/plugin-restify",
]
}