Skip to content

Commit a46459a

Browse files
authored
Merge pull request #2412 from bugsnag/plat-12947-9
Ensure all changes are included in base
2 parents 04b5760 + 26f2412 commit a46459a

30 files changed

Lines changed: 53 additions & 73 deletions

File tree

packages/browser/src/config.ts

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,29 @@
11
import { schema } from '@bugsnag/core'
2-
import assign from '@bugsnag/core/lib/es-utils/assign'
32
import getPrefixedConsole from './get-prefixed-console'
43

54
const config = {
6-
releaseStage: assign({}, schema.releaseStage, {
7-
defaultValue: () => {
8-
if (/^localhost(:\d+)?$/.test(window.location.host)) return 'development'
9-
return 'production'
5+
releaseStage: {
6+
...schema.releaseStage, ...{
7+
defaultValue: () => {
8+
if (/^localhost(:\d+)?$/.test(window.location.host)) return 'development'
9+
return 'production'
10+
}
1011
}
11-
}),
12-
appType: assign({}, schema.appType, {
13-
defaultValue: () => 'browser'
14-
}),
15-
logger: assign({}, schema.logger, {
16-
defaultValue: () =>
17-
// set logger based on browser capability
18-
(typeof console !== 'undefined' && typeof console.debug === 'function')
19-
? getPrefixedConsole()
20-
: undefined
21-
})
12+
},
13+
appType: {
14+
...schema.appType, ...{
15+
defaultValue: () => 'browser'
16+
}
17+
},
18+
logger: {
19+
...schema.logger, ...{
20+
defaultValue: () =>
21+
// set logger based on browser capability
22+
(typeof console !== 'undefined' && typeof console.debug === 'function')
23+
? getPrefixedConsole()
24+
: undefined
25+
}
26+
}
2227
}
2328

2429
export default config

packages/browser/src/get-prefixed-console.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import map from '@bugsnag/core/lib/es-utils/map'
2-
31
type LoggerMethod = 'debug' | 'info' | 'warn' | 'error'
42

53
const getPrefixedConsole = () => {
64
const logger: Record<string, unknown> = {}
75
const consoleLog = console.log
8-
map(['debug', 'info', 'warn', 'error'], (method: LoggerMethod) => {
6+
const loggerMethods = ['debug', 'info', 'warn', 'error'] as const
7+
loggerMethods.map((method: LoggerMethod) => {
98
const consoleMethod = console[method]
109
logger[method] = typeof consoleMethod === 'function'
1110
? consoleMethod.bind(console, '[bugsnag]')

packages/core/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
"./lib/json-payload": "./src/lib/json-payload.js",
1313
"./lib/es-utils/assign": "./src/lib/es-utils/assign.js",
1414
"./lib/validators/int-range": "./src/lib/validators/int-range.js",
15-
"./lib/es-utils/map": "./src/lib/es-utils/map.js",
1615
"./lib/es-utils/includes": "./src/lib/es-utils/includes.js",
1716
"./lib/es-utils/filter": "./src/lib/es-utils/filter.js",
1817
"./lib/iserror": "./src/lib/iserror.js",

packages/core/src/lib/es-utils/map.d.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/core/src/lib/es-utils/map.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

packages/core/src/lib/feature-flag-delegate.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
const map = require('./es-utils/map')
21
const filter = require('./es-utils/filter')
32
const isArray = require('./es-utils/is-array')
43
const jsonStringify = require('@bugsnag/safe-json-stringify')
@@ -47,8 +46,7 @@ function merge (existingFeatures, newFeatures, existingFeatureKeys) {
4746
// by the Bugsnag Event API:
4847
// [{ featureFlag: 'name', variant: 'variant' }, { featureFlag: 'name 2' }]
4948
function toEventApi (featureFlags) {
50-
return map(
51-
filter(featureFlags, Boolean),
49+
return filter(featureFlags, Boolean).map(
5250
({ name, variant }) => {
5351
const flag = { featureFlag: name }
5452

packages/core/test/lib/es-utils.test.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import map from '../../src/lib/es-utils/map'
21
import reduce from '../../src/lib/es-utils/reduce'
32
import filter from '../../src/lib/es-utils/filter'
43
import keys from '../../src/lib/es-utils/keys'
@@ -13,13 +12,6 @@ describe('es-utils', () => {
1312
})
1413
})
1514

16-
describe('map(arr, fn)', () => {
17-
it('works with a variety of examples', () => {
18-
expect(map(['a', 'b', 'c'], x => x)).toEqual(['a', 'b', 'c'])
19-
expect(map(['a', 'b', 'c'], (x) => x.toUpperCase())).toEqual(['A', 'B', 'C'])
20-
})
21-
})
22-
2315
describe('filter(arr, fn)', () => {
2416
it('works with a variety of examples', () => {
2517
const arr = ['a', 0, false, undefined, 1, 'undefined']

packages/delivery-x-domain-request/rollup.config.npm.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import createRollupConfig from "../../.rollup/index.mjs";
22

33
export default createRollupConfig({
44
input: "src/delivery.ts",
5-
external: ['@bugsnag/core', '@bugsnag/core/lib/json-payload']
5+
external: [/node_modules/]
66
});

packages/delivery-xml-http-request/rollup.config.npm.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ import createRollupConfig from "../../.rollup/index.mjs";
22

33
export default createRollupConfig({
44
input: "src/delivery.ts",
5-
external: ['@bugsnag/core', '@bugsnag/core/lib/json-payload']
5+
external: [/node_modules/]
66
});

packages/node/src/get-prefixed-console.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import map from '@bugsnag/core/lib/es-utils/map'
2-
31
type LoggerMethod = 'debug' | 'info' | 'warn' | 'error'
42

53
const getPrefixedConsole = () => {
64
const logger: Record<string, unknown> = {}
75
const consoleLog = console.log
8-
map(['debug', 'info', 'warn', 'error'], (method: LoggerMethod) => {
6+
const loggerMethods = ['debug', 'info', 'warn', 'error'] as const
7+
loggerMethods.map((method: LoggerMethod) => {
98
const consoleMethod = console[method]
109
logger[method] = typeof consoleMethod === 'function'
1110
? consoleMethod.bind(console, '[bugsnag]')

0 commit comments

Comments
 (0)