Skip to content

Commit b805f9c

Browse files
committed
remove plugin
1 parent 76cc560 commit b805f9c

File tree

10 files changed

+0
-242
lines changed

10 files changed

+0
-242
lines changed

packages/next-plugin-sentry/LICENSE

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

packages/next-plugin-sentry/README.md

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

packages/next-plugin-sentry/env.js

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

packages/next-plugin-sentry/package.json

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

packages/next-plugin-sentry/src/on-error-client.js

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

packages/next-plugin-sentry/src/on-error-server.js

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

packages/next-plugin-sentry/src/on-init-client.js

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

packages/next-plugin-sentry/src/on-init-server.js

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

packages/nextjs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
"dependencies": {
2020
"@sentry/core": "6.3.1",
2121
"@sentry/integrations": "6.3.1",
22-
"@sentry/next-plugin-sentry": "6.3.1",
2322
"@sentry/node": "6.3.1",
2423
"@sentry/react": "6.3.1",
2524
"@sentry/utils": "6.3.1",

packages/nextjs/src/utils/config.ts

Lines changed: 0 additions & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,7 @@
1-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
2-
/* eslint-disable @typescript-eslint/no-var-requires */
3-
/* eslint-disable @typescript-eslint/no-explicit-any */
41
import { getSentryRelease } from '@sentry/node';
52
import { logger } from '@sentry/utils';
63
import defaultWebpackPlugin, { SentryCliPluginOptions } from '@sentry/webpack-plugin';
74
import * as SentryWebpackPlugin from '@sentry/webpack-plugin';
8-
import * as fs from 'fs';
9-
import * as path from 'path';
10-
11-
/**
12-
* Starting at `startPath`, move up one directory at a time, searching for `searchFile`.
13-
*
14-
* @param startPath The location from which to start the search.
15-
* @param searchFile The file to search for
16-
* @returns The absolute path of the file, if it's found, or undefined if it's not
17-
*/
18-
function findUp(startPath: string, searchFile: string): string | undefined {
19-
if (!fs.existsSync(startPath)) {
20-
throw new Error(`The given \`startPath\` value (${startPath}) does not exist.`);
21-
}
22-
23-
// if the last segment of `startPath` is a file, trim it off so that we start looking in its parent directory
24-
let currentDir = fs.statSync(startPath).isFile() ? path.dirname(startPath) : startPath;
25-
// eslint-disable-next-line no-constant-condition
26-
while (true) {
27-
const possiblePath = path.join(currentDir, searchFile);
28-
if (fs.existsSync(possiblePath)) {
29-
return possiblePath;
30-
}
31-
32-
const parentDir = path.resolve(currentDir, '..');
33-
// this means we've gotten to the root
34-
if (currentDir === parentDir) {
35-
break;
36-
}
37-
currentDir = parentDir;
38-
}
39-
40-
return undefined;
41-
}
42-
43-
/**
44-
* Next requires that plugins be tagged with the same version number as the currently-running `next.js` package, so
45-
* modify our `package.json` to trick it into thinking we comply. Run before the plugin is loaded at server startup.
46-
*/
47-
export function syncPluginVersionWithNextVersion(): void {
48-
// TODO Once we get at least to TS 2.9, we can use `"resolveJsonModule": true` in our `compilerOptions` and we'll be
49-
// able to do:
50-
// import { version as nextVersion } from './node_modules/next/package.json';
51-
let nextVersion;
52-
53-
try {
54-
// `require.resolve` returns the location of the packages `"main"` entry point, as specified in its `package.json`
55-
const nextResolvedMain = require.resolve('next');
56-
// since we don't know where in the package's directory that entry point is, search upward until we find a folder
57-
// containing `package.json`
58-
const nextPackageJsonPath = findUp(nextResolvedMain, 'package.json');
59-
nextVersion = nextPackageJsonPath && (require(nextPackageJsonPath) as { version: string }).version;
60-
} catch (err) {
61-
// eslint-disable-next-line no-console
62-
console.error(`[next-plugin-sentry] Cannot read next.js version. Plug-in will not work.\nReceived error: ${err}`);
63-
return;
64-
}
65-
66-
let pluginPackageJsonPath, pluginPackageJson;
67-
68-
try {
69-
const pluginResolvedMain = require.resolve('@sentry/next-plugin-sentry');
70-
// see notes above about why we need to call `findUp`
71-
pluginPackageJsonPath = findUp(pluginResolvedMain, 'package.json');
72-
pluginPackageJson = pluginPackageJsonPath && require(pluginPackageJsonPath);
73-
} catch (err) {
74-
// eslint-disable-next-line no-console
75-
console.error(
76-
`[next-plugin-sentry] Cannot find \`@sentry/next-plugin-sentry\`. Plug-in will not work. ` +
77-
`Please try reinstalling \`@sentry/nextjs\`.\nReceived error: ${err}`,
78-
);
79-
return;
80-
}
81-
82-
(pluginPackageJson as { version: string }).version = nextVersion!;
83-
fs.writeFileSync(pluginPackageJsonPath!, JSON.stringify(pluginPackageJson));
84-
}
855

866
type WebpackConfig = { devtool: string; plugins: Array<{ [key: string]: any }> };
877
type NextConfigExports = {
@@ -120,8 +40,6 @@ export function withSentryConfig(
12040

12141
return {
12242
...providedExports,
123-
experimental: { ...(providedExports.experimental || {}), plugins: true },
124-
plugins: [...(providedExports.plugins || []), '@sentry/next-plugin-sentry'],
12543
productionBrowserSourceMaps: true,
12644
webpack: (originalConfig, options) => {
12745
let config = originalConfig;
@@ -149,10 +67,3 @@ export function withSentryConfig(
14967
},
15068
};
15169
}
152-
153-
try {
154-
syncPluginVersionWithNextVersion();
155-
} catch (error) {
156-
logger.warn(`[next-plugin-sentry] Cannot sync plug-in and next versions. Plug-in may not work, versions must match.`);
157-
logger.warn('[next-plugin-sentry] A local project build should sync the versions, before deploying it.');
158-
}

0 commit comments

Comments
 (0)