@sentry/gatsby 8.0.0-alpha.5 → 8.0.0-alpha.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -60
- package/cjs/sdk.js +0 -3
- package/cjs/sdk.js.map +1 -1
- package/esm/sdk.js +0 -3
- package/esm/sdk.js.map +1 -1
- package/gatsby-node.d.ts +2 -3
- package/gatsby-node.js +15 -38
- package/package.json +6 -8
- package/types/sdk.d.ts.map +1 -1
- package/cjs/utils/integrations.js +0 -53
- package/cjs/utils/integrations.js.map +0 -1
- package/esm/utils/integrations.js +0 -51
- package/esm/utils/integrations.js.map +0 -1
- package/gatsby-browser.d.ts +0 -1
- package/gatsby-browser.js +0 -45
- package/types/utils/integrations.d.ts +0 -13
- package/types/utils/integrations.d.ts.map +0 -1
- package/types-ts3.8/utils/integrations.d.ts +0 -13
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
|
|
7
7
|
# Official Sentry SDK for GatsbyJS
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
First register the package as a plugin in `gatsby-config.js`:
|
|
10
10
|
|
|
11
11
|
```javascript
|
|
12
12
|
module.exports = {
|
|
@@ -23,66 +23,32 @@ module.exports = {
|
|
|
23
23
|
};
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
[our docs](https://docs.sentry.io/error-reporting/configuration/?platform=javascript). The `environment` value defaults
|
|
28
|
-
to `NODE_ENV` (or `'development'` if `NODE_ENV` is not set).
|
|
29
|
-
|
|
30
|
-
## GitHub Actions
|
|
31
|
-
|
|
32
|
-
The `release` value is inferred from `GITHUB_SHA`.
|
|
33
|
-
|
|
34
|
-
## Netlify
|
|
35
|
-
|
|
36
|
-
The `release` value is inferred from `COMMIT_REF`.
|
|
37
|
-
|
|
38
|
-
## Vercel
|
|
39
|
-
|
|
40
|
-
To automatically capture the `release` value on Vercel you will need to register appropriate
|
|
41
|
-
[system environment variable](https://vercel.com/docs/v2/build-step#system-environment-variables) (e.g.
|
|
42
|
-
`VERCEL_GITHUB_COMMIT_SHA`) in your project.
|
|
43
|
-
|
|
44
|
-
## Sentry Performance
|
|
45
|
-
|
|
46
|
-
To enable tracing, supply either `tracesSampleRate` or `tracesSampler` to the options. This will turn on the
|
|
47
|
-
`BrowserTracing` integration for automatic instrumentation of pageloads and navigations.
|
|
26
|
+
Then configure your `Sentry.init` call:
|
|
48
27
|
|
|
49
28
|
```javascript
|
|
50
|
-
|
|
51
|
-
// ...
|
|
52
|
-
plugins: [
|
|
53
|
-
{
|
|
54
|
-
resolve: '@sentry/gatsby',
|
|
55
|
-
options: {
|
|
56
|
-
dsn: process.env.SENTRY_DSN, // this is the default
|
|
29
|
+
import * as Sentry from '@sentry/gatsby';
|
|
57
30
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
31
|
+
Sentry.init({
|
|
32
|
+
dsn: '__PUBLIC_DSN__',
|
|
33
|
+
integrations: [Sentry.browserTracingIntegration(), Sentry.replayIntegration()],
|
|
61
34
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
// Can return 0 to drop the transaction entirely.
|
|
35
|
+
// Set tracesSampleRate to 1.0 to capture 100%
|
|
36
|
+
// of transactions for performance monitoring.
|
|
37
|
+
// We recommend adjusting this value in production
|
|
38
|
+
tracesSampleRate: 1.0,
|
|
67
39
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
// ...
|
|
81
|
-
],
|
|
82
|
-
};
|
|
40
|
+
// Capture Replay for 10% of all sessions,
|
|
41
|
+
// plus for 100% of sessions with an error
|
|
42
|
+
replaysSessionSampleRate: 0.1,
|
|
43
|
+
replaysOnErrorSampleRate: 1.0,
|
|
44
|
+
|
|
45
|
+
// Set `tracePropagationTargets` to control for which URLs distributed tracing should be enabled
|
|
46
|
+
tracePropagationTargets: ['localhost', /^https:\/\/yourserver\.io\/api/],
|
|
47
|
+
});
|
|
83
48
|
```
|
|
84
49
|
|
|
85
|
-
|
|
50
|
+
The Gatsby SDK also automatically sets up sourcemaps uploading for you. To disable this functionality, set the
|
|
51
|
+
`enableClientWebpackPlugin` option to be `false`.
|
|
86
52
|
|
|
87
53
|
```javascript
|
|
88
54
|
module.exports = {
|
|
@@ -91,12 +57,7 @@ module.exports = {
|
|
|
91
57
|
{
|
|
92
58
|
resolve: '@sentry/gatsby',
|
|
93
59
|
options: {
|
|
94
|
-
|
|
95
|
-
tracesSampleRate: 1, // or tracesSampler (see above)
|
|
96
|
-
browserTracingOptions: {
|
|
97
|
-
// disable creating spans for XHR requests
|
|
98
|
-
traceXHR: false,
|
|
99
|
-
},
|
|
60
|
+
enableClientWebpackPlugin: false,
|
|
100
61
|
},
|
|
101
62
|
},
|
|
102
63
|
// ...
|
package/cjs/sdk.js
CHANGED
|
@@ -2,17 +2,14 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
2
2
|
|
|
3
3
|
const core = require('@sentry/core');
|
|
4
4
|
const react = require('@sentry/react');
|
|
5
|
-
const integrations = require('./utils/integrations.js');
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* Inits the Sentry Gatsby SDK.
|
|
9
8
|
*/
|
|
10
9
|
function init(options) {
|
|
11
10
|
core.applySdkMetadata(options, 'gatsby');
|
|
12
|
-
const integrations$1 = integrations.getIntegrationsFromOptions(options);
|
|
13
11
|
react.init({
|
|
14
12
|
...options,
|
|
15
|
-
integrations: integrations$1,
|
|
16
13
|
});
|
|
17
14
|
}
|
|
18
15
|
|
package/cjs/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { applySdkMetadata } from '@sentry/core';\nimport { init as reactInit } from '@sentry/react';\n\nimport
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { applySdkMetadata } from '@sentry/core';\nimport { init as reactInit } from '@sentry/react';\n\nimport type { GatsbyOptions } from './utils/types';\n\n/**\n * Inits the Sentry Gatsby SDK.\n */\nexport function init(options: GatsbyOptions): void {\n applySdkMetadata(options, 'gatsby');\n reactInit({\n ...options,\n });\n}\n"],"names":["applySdkMetadata","reactInit"],"mappings":";;;;;AAKA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB;AACnD,EAAEA,qBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AACrC,EAAEC,UAAS,CAAC;AACZ,IAAI,GAAG,OAAO;AACd,GAAG,CAAC,CAAA;AACJ;;;;"}
|
package/esm/sdk.js
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { applySdkMetadata } from '@sentry/core';
|
|
2
2
|
import { init as init$1 } from '@sentry/react';
|
|
3
|
-
import { getIntegrationsFromOptions } from './utils/integrations.js';
|
|
4
3
|
|
|
5
4
|
/**
|
|
6
5
|
* Inits the Sentry Gatsby SDK.
|
|
7
6
|
*/
|
|
8
7
|
function init(options) {
|
|
9
8
|
applySdkMetadata(options, 'gatsby');
|
|
10
|
-
const integrations = getIntegrationsFromOptions(options);
|
|
11
9
|
init$1({
|
|
12
10
|
...options,
|
|
13
|
-
integrations,
|
|
14
11
|
});
|
|
15
12
|
}
|
|
16
13
|
|
package/esm/sdk.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { applySdkMetadata } from '@sentry/core';\nimport { init as reactInit } from '@sentry/react';\n\nimport
|
|
1
|
+
{"version":3,"file":"sdk.js","sources":["../../src/sdk.ts"],"sourcesContent":["import { applySdkMetadata } from '@sentry/core';\nimport { init as reactInit } from '@sentry/react';\n\nimport type { GatsbyOptions } from './utils/types';\n\n/**\n * Inits the Sentry Gatsby SDK.\n */\nexport function init(options: GatsbyOptions): void {\n applySdkMetadata(options, 'gatsby');\n reactInit({\n ...options,\n });\n}\n"],"names":["reactInit"],"mappings":";;;AAKA;AACA;AACA;AACO,SAAS,IAAI,CAAC,OAAO,EAAuB;AACnD,EAAE,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAA;AACrC,EAAEA,MAAS,CAAC;AACZ,IAAI,GAAG,OAAO;AACd,GAAG,CAAC,CAAA;AACJ;;;;"}
|
package/gatsby-node.d.ts
CHANGED
package/gatsby-node.js
CHANGED
|
@@ -1,48 +1,25 @@
|
|
|
1
1
|
const fs = require('fs');
|
|
2
2
|
|
|
3
|
-
const
|
|
3
|
+
const { sentryWebpackPlugin } = require('@sentry/webpack-plugin');
|
|
4
4
|
|
|
5
|
-
const sentryRelease = JSON.stringify(
|
|
6
|
-
// Always read first as Sentry takes this as precedence
|
|
7
|
-
process.env.SENTRY_RELEASE ||
|
|
8
|
-
// GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
|
|
9
|
-
process.env.GITHUB_SHA ||
|
|
10
|
-
// Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
|
|
11
|
-
process.env.COMMIT_REF ||
|
|
12
|
-
// Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables
|
|
13
|
-
process.env.VERCEL_GIT_COMMIT_SHA ||
|
|
14
|
-
// Zeit (now known as Vercel)
|
|
15
|
-
process.env.ZEIT_GITHUB_COMMIT_SHA ||
|
|
16
|
-
process.env.ZEIT_GITLAB_COMMIT_SHA ||
|
|
17
|
-
process.env.ZEIT_BITBUCKET_COMMIT_SHA ||
|
|
18
|
-
undefined,
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const sentryDsn = JSON.stringify(process.env.SENTRY_DSN || '');
|
|
22
5
|
const SENTRY_USER_CONFIG = ['./sentry.config.js', './sentry.config.ts'];
|
|
23
6
|
|
|
24
|
-
exports.onCreateWebpackConfig = ({
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
plugins.define({
|
|
28
|
-
__SENTRY_RELEASE__: sentryRelease,
|
|
29
|
-
__SENTRY_DSN__: sentryDsn,
|
|
30
|
-
}),
|
|
31
|
-
],
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
if (process.env.NODE_ENV === 'production') {
|
|
7
|
+
exports.onCreateWebpackConfig = ({ getConfig, actions }, options) => {
|
|
8
|
+
const enableClientWebpackPlugin = options.enableClientWebpackPlugin !== false;
|
|
9
|
+
if (process.env.NODE_ENV === 'production' && enableClientWebpackPlugin) {
|
|
35
10
|
actions.setWebpackConfig({
|
|
36
11
|
plugins: [
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
12
|
+
sentryWebpackPlugin({
|
|
13
|
+
sourcemaps: {
|
|
14
|
+
// Only include files from the build output directory
|
|
15
|
+
assets: ['public'],
|
|
16
|
+
// Ignore files that aren't users' source code related
|
|
17
|
+
ignore: [
|
|
18
|
+
'polyfill-*', // related to polyfills
|
|
19
|
+
'framework-*', // related to the frameworks (e.g. React)
|
|
20
|
+
'webpack-runtime-*', // related to Webpack
|
|
21
|
+
],
|
|
22
|
+
},
|
|
46
23
|
// Handle sentry-cli configuration errors when the user has not done it not to break
|
|
47
24
|
// the build.
|
|
48
25
|
errorHandler(err, invokeErr) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/gatsby",
|
|
3
|
-
"version": "8.0.0-alpha.
|
|
3
|
+
"version": "8.0.0-alpha.8",
|
|
4
4
|
"description": "Official Sentry SDK for Gatsby.js",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript/tree/master/packages/gatsby",
|
|
@@ -18,9 +18,7 @@
|
|
|
18
18
|
"esm",
|
|
19
19
|
"types",
|
|
20
20
|
"types-ts3.8",
|
|
21
|
-
"gatsby-browser.js",
|
|
22
21
|
"gatsby-node.js",
|
|
23
|
-
"gatsby-browser.d.ts",
|
|
24
22
|
"gatsby-node.d.ts"
|
|
25
23
|
],
|
|
26
24
|
"main": "cjs/index.js",
|
|
@@ -50,11 +48,11 @@
|
|
|
50
48
|
"access": "public"
|
|
51
49
|
},
|
|
52
50
|
"dependencies": {
|
|
53
|
-
"@sentry/core": "8.0.0-alpha.
|
|
54
|
-
"@sentry/react": "8.0.0-alpha.
|
|
55
|
-
"@sentry/types": "8.0.0-alpha.
|
|
56
|
-
"@sentry/utils": "8.0.0-alpha.
|
|
57
|
-
"@sentry/webpack-plugin": "
|
|
51
|
+
"@sentry/core": "8.0.0-alpha.8",
|
|
52
|
+
"@sentry/react": "8.0.0-alpha.8",
|
|
53
|
+
"@sentry/types": "8.0.0-alpha.8",
|
|
54
|
+
"@sentry/utils": "8.0.0-alpha.8",
|
|
55
|
+
"@sentry/webpack-plugin": "2.16.0"
|
|
58
56
|
},
|
|
59
57
|
"peerDependencies": {
|
|
60
58
|
"gatsby": "^2.0.0 || ^3.0.0 || ^4.0.0 || ^5.0.0",
|
package/types/sdk.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sdk.d.ts","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD;;GAEG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,aAAa,GAAG,IAAI,CAKjD"}
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
-
|
|
3
|
-
const core = require('@sentry/core');
|
|
4
|
-
const react = require('@sentry/react');
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Returns the integrations to add to the SDK.
|
|
8
|
-
* If tracing is enabled, `BrowserTracing` is always present.
|
|
9
|
-
*
|
|
10
|
-
* @param options The options users have defined.
|
|
11
|
-
*/
|
|
12
|
-
function getIntegrationsFromOptions(options) {
|
|
13
|
-
const isTracingEnabled = core.hasTracingEnabled(options);
|
|
14
|
-
if (options.integrations === undefined) {
|
|
15
|
-
return getIntegrationsFromArray([], isTracingEnabled);
|
|
16
|
-
} else if (Array.isArray(options.integrations)) {
|
|
17
|
-
return getIntegrationsFromArray(options.integrations, isTracingEnabled);
|
|
18
|
-
} else {
|
|
19
|
-
return getIntegrationsFromFunction(options.integrations, isTracingEnabled);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Returns the integrations to add to the SDK, from the given integrations array.
|
|
25
|
-
*
|
|
26
|
-
* @param userIntegrations Array of user's integrations.
|
|
27
|
-
* @param isTracingEnabled Whether the user has enabled tracing.
|
|
28
|
-
*/
|
|
29
|
-
function getIntegrationsFromArray(userIntegrations, isTracingEnabled) {
|
|
30
|
-
if (isTracingEnabled && !userIntegrations.some(integration => integration.name === 'BrowserTracing')) {
|
|
31
|
-
userIntegrations.push(react.browserTracingIntegration());
|
|
32
|
-
}
|
|
33
|
-
return userIntegrations;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Returns the integrations to add to the SDK, from the given function.
|
|
38
|
-
*
|
|
39
|
-
* @param userIntegrations Function returning the user's integrations.
|
|
40
|
-
* @param isTracingEnabled Whether the user has enabled tracing.
|
|
41
|
-
*/
|
|
42
|
-
function getIntegrationsFromFunction(
|
|
43
|
-
userIntegrations,
|
|
44
|
-
isTracingEnabled,
|
|
45
|
-
) {
|
|
46
|
-
const wrapper = (defaultIntegrations) => {
|
|
47
|
-
return getIntegrationsFromArray(userIntegrations(defaultIntegrations), isTracingEnabled);
|
|
48
|
-
};
|
|
49
|
-
return wrapper;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
exports.getIntegrationsFromOptions = getIntegrationsFromOptions;
|
|
53
|
-
//# sourceMappingURL=integrations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.js","sources":["../../../src/utils/integrations.ts"],"sourcesContent":["import { hasTracingEnabled } from '@sentry/core';\nimport { browserTracingIntegration } from '@sentry/react';\nimport type { Integration } from '@sentry/types';\n\nimport type { GatsbyOptions } from './types';\n\ntype UserFnIntegrations = (integrations: Integration[]) => Integration[];\nexport type UserIntegrations = Integration[] | UserFnIntegrations;\n\n/**\n * Returns the integrations to add to the SDK.\n * If tracing is enabled, `BrowserTracing` is always present.\n *\n * @param options The options users have defined.\n */\nexport function getIntegrationsFromOptions(options: GatsbyOptions): UserIntegrations {\n const isTracingEnabled = hasTracingEnabled(options);\n if (options.integrations === undefined) {\n return getIntegrationsFromArray([], isTracingEnabled);\n } else if (Array.isArray(options.integrations)) {\n return getIntegrationsFromArray(options.integrations, isTracingEnabled);\n } else {\n return getIntegrationsFromFunction(options.integrations, isTracingEnabled);\n }\n}\n\n/**\n * Returns the integrations to add to the SDK, from the given integrations array.\n *\n * @param userIntegrations Array of user's integrations.\n * @param isTracingEnabled Whether the user has enabled tracing.\n */\nfunction getIntegrationsFromArray(userIntegrations: Integration[], isTracingEnabled: boolean): Integration[] {\n if (isTracingEnabled && !userIntegrations.some(integration => integration.name === 'BrowserTracing')) {\n userIntegrations.push(browserTracingIntegration());\n }\n return userIntegrations;\n}\n\n/**\n * Returns the integrations to add to the SDK, from the given function.\n *\n * @param userIntegrations Function returning the user's integrations.\n * @param isTracingEnabled Whether the user has enabled tracing.\n */\nfunction getIntegrationsFromFunction(\n userIntegrations: UserFnIntegrations,\n isTracingEnabled: boolean,\n): UserFnIntegrations {\n const wrapper: UserFnIntegrations = (defaultIntegrations: Integration[]) => {\n return getIntegrationsFromArray(userIntegrations(defaultIntegrations), isTracingEnabled);\n };\n return wrapper;\n}\n"],"names":["hasTracingEnabled","browserTracingIntegration"],"mappings":";;;;;AASA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,OAAO,EAAmC;AACrF,EAAE,MAAM,gBAAiB,GAAEA,sBAAiB,CAAC,OAAO,CAAC,CAAA;AACrD,EAAE,IAAI,OAAO,CAAC,YAAa,KAAI,SAAS,EAAE;AAC1C,IAAI,OAAO,wBAAwB,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAA;AACzD,GAAI,MAAK,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AAClD,IAAI,OAAO,wBAAwB,CAAC,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAA;AAC3E,SAAS;AACT,IAAI,OAAO,2BAA2B,CAAC,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAA;AAC9E,GAAE;AACF,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,wBAAwB,CAAC,gBAAgB,EAAiB,gBAAgB,EAA0B;AAC7G,EAAE,IAAI,gBAAA,IAAoB,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAA,IAAe,WAAW,CAAC,SAAS,gBAAgB,CAAC,EAAE;AACxG,IAAI,gBAAgB,CAAC,IAAI,CAACC,+BAAyB,EAAE,CAAC,CAAA;AACtD,GAAE;AACF,EAAE,OAAO,gBAAgB,CAAA;AACzB,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,2BAA2B;AACpC,EAAE,gBAAgB;AAClB,EAAE,gBAAgB;AAClB,EAAsB;AACtB,EAAE,MAAM,OAAO,GAAuB,CAAC,mBAAmB,KAAoB;AAC9E,IAAI,OAAO,wBAAwB,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,EAAE,gBAAgB,CAAC,CAAA;AAC5F,GAAG,CAAA;AACH,EAAE,OAAO,OAAO,CAAA;AAChB;;;;"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { hasTracingEnabled } from '@sentry/core';
|
|
2
|
-
import { browserTracingIntegration } from '@sentry/react';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Returns the integrations to add to the SDK.
|
|
6
|
-
* If tracing is enabled, `BrowserTracing` is always present.
|
|
7
|
-
*
|
|
8
|
-
* @param options The options users have defined.
|
|
9
|
-
*/
|
|
10
|
-
function getIntegrationsFromOptions(options) {
|
|
11
|
-
const isTracingEnabled = hasTracingEnabled(options);
|
|
12
|
-
if (options.integrations === undefined) {
|
|
13
|
-
return getIntegrationsFromArray([], isTracingEnabled);
|
|
14
|
-
} else if (Array.isArray(options.integrations)) {
|
|
15
|
-
return getIntegrationsFromArray(options.integrations, isTracingEnabled);
|
|
16
|
-
} else {
|
|
17
|
-
return getIntegrationsFromFunction(options.integrations, isTracingEnabled);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Returns the integrations to add to the SDK, from the given integrations array.
|
|
23
|
-
*
|
|
24
|
-
* @param userIntegrations Array of user's integrations.
|
|
25
|
-
* @param isTracingEnabled Whether the user has enabled tracing.
|
|
26
|
-
*/
|
|
27
|
-
function getIntegrationsFromArray(userIntegrations, isTracingEnabled) {
|
|
28
|
-
if (isTracingEnabled && !userIntegrations.some(integration => integration.name === 'BrowserTracing')) {
|
|
29
|
-
userIntegrations.push(browserTracingIntegration());
|
|
30
|
-
}
|
|
31
|
-
return userIntegrations;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Returns the integrations to add to the SDK, from the given function.
|
|
36
|
-
*
|
|
37
|
-
* @param userIntegrations Function returning the user's integrations.
|
|
38
|
-
* @param isTracingEnabled Whether the user has enabled tracing.
|
|
39
|
-
*/
|
|
40
|
-
function getIntegrationsFromFunction(
|
|
41
|
-
userIntegrations,
|
|
42
|
-
isTracingEnabled,
|
|
43
|
-
) {
|
|
44
|
-
const wrapper = (defaultIntegrations) => {
|
|
45
|
-
return getIntegrationsFromArray(userIntegrations(defaultIntegrations), isTracingEnabled);
|
|
46
|
-
};
|
|
47
|
-
return wrapper;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
export { getIntegrationsFromOptions };
|
|
51
|
-
//# sourceMappingURL=integrations.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.js","sources":["../../../src/utils/integrations.ts"],"sourcesContent":["import { hasTracingEnabled } from '@sentry/core';\nimport { browserTracingIntegration } from '@sentry/react';\nimport type { Integration } from '@sentry/types';\n\nimport type { GatsbyOptions } from './types';\n\ntype UserFnIntegrations = (integrations: Integration[]) => Integration[];\nexport type UserIntegrations = Integration[] | UserFnIntegrations;\n\n/**\n * Returns the integrations to add to the SDK.\n * If tracing is enabled, `BrowserTracing` is always present.\n *\n * @param options The options users have defined.\n */\nexport function getIntegrationsFromOptions(options: GatsbyOptions): UserIntegrations {\n const isTracingEnabled = hasTracingEnabled(options);\n if (options.integrations === undefined) {\n return getIntegrationsFromArray([], isTracingEnabled);\n } else if (Array.isArray(options.integrations)) {\n return getIntegrationsFromArray(options.integrations, isTracingEnabled);\n } else {\n return getIntegrationsFromFunction(options.integrations, isTracingEnabled);\n }\n}\n\n/**\n * Returns the integrations to add to the SDK, from the given integrations array.\n *\n * @param userIntegrations Array of user's integrations.\n * @param isTracingEnabled Whether the user has enabled tracing.\n */\nfunction getIntegrationsFromArray(userIntegrations: Integration[], isTracingEnabled: boolean): Integration[] {\n if (isTracingEnabled && !userIntegrations.some(integration => integration.name === 'BrowserTracing')) {\n userIntegrations.push(browserTracingIntegration());\n }\n return userIntegrations;\n}\n\n/**\n * Returns the integrations to add to the SDK, from the given function.\n *\n * @param userIntegrations Function returning the user's integrations.\n * @param isTracingEnabled Whether the user has enabled tracing.\n */\nfunction getIntegrationsFromFunction(\n userIntegrations: UserFnIntegrations,\n isTracingEnabled: boolean,\n): UserFnIntegrations {\n const wrapper: UserFnIntegrations = (defaultIntegrations: Integration[]) => {\n return getIntegrationsFromArray(userIntegrations(defaultIntegrations), isTracingEnabled);\n };\n return wrapper;\n}\n"],"names":[],"mappings":";;;AASA;AACA;AACA;AACA;AACA;AACA;AACO,SAAS,0BAA0B,CAAC,OAAO,EAAmC;AACrF,EAAE,MAAM,gBAAiB,GAAE,iBAAiB,CAAC,OAAO,CAAC,CAAA;AACrD,EAAE,IAAI,OAAO,CAAC,YAAa,KAAI,SAAS,EAAE;AAC1C,IAAI,OAAO,wBAAwB,CAAC,EAAE,EAAE,gBAAgB,CAAC,CAAA;AACzD,GAAI,MAAK,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE;AAClD,IAAI,OAAO,wBAAwB,CAAC,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAA;AAC3E,SAAS;AACT,IAAI,OAAO,2BAA2B,CAAC,OAAO,CAAC,YAAY,EAAE,gBAAgB,CAAC,CAAA;AAC9E,GAAE;AACF,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,wBAAwB,CAAC,gBAAgB,EAAiB,gBAAgB,EAA0B;AAC7G,EAAE,IAAI,gBAAA,IAAoB,CAAC,gBAAgB,CAAC,IAAI,CAAC,WAAA,IAAe,WAAW,CAAC,SAAS,gBAAgB,CAAC,EAAE;AACxG,IAAI,gBAAgB,CAAC,IAAI,CAAC,yBAAyB,EAAE,CAAC,CAAA;AACtD,GAAE;AACF,EAAE,OAAO,gBAAgB,CAAA;AACzB,CAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS,2BAA2B;AACpC,EAAE,gBAAgB;AAClB,EAAE,gBAAgB;AAClB,EAAsB;AACtB,EAAE,MAAM,OAAO,GAAuB,CAAC,mBAAmB,KAAoB;AAC9E,IAAI,OAAO,wBAAwB,CAAC,gBAAgB,CAAC,mBAAmB,CAAC,EAAE,gBAAgB,CAAC,CAAA;AAC5F,GAAG,CAAA;AACH,EAAE,OAAO,OAAO,CAAA;AAChB;;;;"}
|
package/gatsby-browser.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function onClientEntry(_: any, pluginParams: any): void;
|
package/gatsby-browser.js
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-console */
|
|
2
|
-
import { getClient, init } from '@sentry/gatsby';
|
|
3
|
-
|
|
4
|
-
export function onClientEntry(_, pluginParams) {
|
|
5
|
-
const isIntialized = isSentryInitialized();
|
|
6
|
-
const areOptionsDefined = areSentryOptionsDefined(pluginParams);
|
|
7
|
-
|
|
8
|
-
if (isIntialized) {
|
|
9
|
-
if (areOptionsDefined) {
|
|
10
|
-
console.warn(
|
|
11
|
-
'Sentry Logger [Warn]: The SDK was initialized in the Sentry config file, but options were found in the Gatsby config. ' +
|
|
12
|
-
'These have been ignored. Merge them to the Sentry config if you want to use them.\n' +
|
|
13
|
-
'Learn more about the Gatsby SDK in https://docs.sentry.io/platforms/javascript/guides/gatsby/.',
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
if (!areOptionsDefined) {
|
|
20
|
-
console.error(
|
|
21
|
-
'Sentry Logger [Error]: No config for the Gatsby SDK was found.\n' +
|
|
22
|
-
'Learn how to configure it in https://docs.sentry.io/platforms/javascript/guides/gatsby/.',
|
|
23
|
-
);
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
init({
|
|
28
|
-
// eslint-disable-next-line no-undef
|
|
29
|
-
dsn: __SENTRY_DSN__,
|
|
30
|
-
...pluginParams,
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function isSentryInitialized() {
|
|
35
|
-
return !!getClient();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function areSentryOptionsDefined(params) {
|
|
39
|
-
if (params == undefined) return false;
|
|
40
|
-
// Even if there aren't any options, there's a `plugins` property defined as an empty array
|
|
41
|
-
if (Object.keys(params).length == 1 && Array.isArray(params.plugins) && params.plugins.length == 0) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { Integration } from '@sentry/types';
|
|
2
|
-
import type { GatsbyOptions } from './types';
|
|
3
|
-
type UserFnIntegrations = (integrations: Integration[]) => Integration[];
|
|
4
|
-
export type UserIntegrations = Integration[] | UserFnIntegrations;
|
|
5
|
-
/**
|
|
6
|
-
* Returns the integrations to add to the SDK.
|
|
7
|
-
* If tracing is enabled, `BrowserTracing` is always present.
|
|
8
|
-
*
|
|
9
|
-
* @param options The options users have defined.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getIntegrationsFromOptions(options: GatsbyOptions): UserIntegrations;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=integrations.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"integrations.d.ts","sourceRoot":"","sources":["../../../src/utils/integrations.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,KAAK,kBAAkB,GAAG,CAAC,YAAY,EAAE,WAAW,EAAE,KAAK,WAAW,EAAE,CAAC;AACzE,MAAM,MAAM,gBAAgB,GAAG,WAAW,EAAE,GAAG,kBAAkB,CAAC;AAElE;;;;;GAKG;AACH,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,aAAa,GAAG,gBAAgB,CASnF"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Integration } from '@sentry/types';
|
|
2
|
-
import { GatsbyOptions } from './types';
|
|
3
|
-
type UserFnIntegrations = (integrations: Integration[]) => Integration[];
|
|
4
|
-
export type UserIntegrations = Integration[] | UserFnIntegrations;
|
|
5
|
-
/**
|
|
6
|
-
* Returns the integrations to add to the SDK.
|
|
7
|
-
* If tracing is enabled, `BrowserTracing` is always present.
|
|
8
|
-
*
|
|
9
|
-
* @param options The options users have defined.
|
|
10
|
-
*/
|
|
11
|
-
export declare function getIntegrationsFromOptions(options: GatsbyOptions): UserIntegrations;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=integrations.d.ts.map
|