Skip to content

Commit

Permalink
Merge pull request #857 from bugsnag/release/7.1.0
Browse files Browse the repository at this point in the history
Release v7.1.0
  • Loading branch information
bengourley authored May 21, 2020
2 parents 11ff0ba + ced7cc4 commit acb7b24
Show file tree
Hide file tree
Showing 110 changed files with 877 additions and 332 deletions.
15 changes: 15 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
66 changes: 65 additions & 1 deletion UPGRADING.md
Original file line number Diff line number Diff line change
@@ -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).
Expand Down Expand Up @@ -290,7 +354,7 @@ Here are some examples:
// adding metadata
- bugsnagClient.notify(err, {
- metaData: {
- component: {
- component: {
- instanceId: component.instanceId
- }
- }
Expand Down
21 changes: 0 additions & 21 deletions bin/bundle-types

This file was deleted.

2 changes: 1 addition & 1 deletion dockerfiles/Dockerfile.browser
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion examples/js/react/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ Bugsnag.start({

const ErrorBoundary = Bugsnag.getPlugin('react')

const ErrorScreen = () =>
const ErrorScreen = ({ clearError }) =>
<div>
<h1>⚠️ Error ⚠️</h1>
<p><strong>Uh oh, there was an error in the component tree!</strong></p>
<p>This <code>FallbackComponent</code> prop can be used to show something useful to your users when such errors occur.</p>
<button onClick={clearError}>Reset</button>
</div>

const onError = event => {
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"packages": [
"packages/*"
],
"version": "7.0.2"
"version": "7.1.0-alpha.0"
}
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion packages/browser/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

47 changes: 25 additions & 22 deletions packages/browser/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"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": {
"type": "git",
"url": "[email protected]: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'",
Expand All @@ -33,28 +33,31 @@
"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",
"mime": "1.4.1",
"nyc": "^12.0.2",
"semver": "^5.5.1",
"typescript": "^3.7.5"
},
"dependencies": {
"@bugsnag/core": "^7.1.0-alpha.0"
}
}
2 changes: 1 addition & 1 deletion packages/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand Down
1 change: 1 addition & 0 deletions packages/core/test/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion packages/delivery-expo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/delivery-expo/package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand All @@ -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"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/delivery-node/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/delivery-node/package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/delivery-x-domain-request/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/delivery-x-domain-request/package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/delivery-xml-http-request/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions packages/delivery-xml-http-request/package.json
Original file line number Diff line number Diff line change
@@ -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/",
Expand All @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion packages/expo/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit acb7b24

Please sign in to comment.