@sentry/wizard 3.23.3 → 3.24.0
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/CHANGELOG.md +10 -2
- package/dist/package.json +2 -2
- package/dist/src/react-native/glob.js +24 -4
- package/dist/src/react-native/glob.js.map +1 -1
- package/dist/src/remix/codemods/express-server.d.ts +0 -4
- package/dist/src/remix/codemods/express-server.js +1 -80
- package/dist/src/remix/codemods/express-server.js.map +1 -1
- package/dist/src/remix/codemods/handle-error.js +2 -2
- package/dist/src/remix/codemods/handle-error.js.map +1 -1
- package/dist/src/remix/remix-wizard.js +62 -19
- package/dist/src/remix/remix-wizard.js.map +1 -1
- package/dist/src/remix/sdk-example.js +1 -1
- package/dist/src/remix/sdk-example.js.map +1 -1
- package/dist/src/remix/sdk-setup.d.ts +5 -3
- package/dist/src/remix/sdk-setup.js +98 -38
- package/dist/src/remix/sdk-setup.js.map +1 -1
- package/dist/src/remix/templates.d.ts +1 -1
- package/dist/src/remix/templates.js +1 -1
- package/dist/src/remix/templates.js.map +1 -1
- package/dist/src/remix/utils.d.ts +9 -3
- package/dist/src/remix/utils.js +39 -10
- package/dist/src/remix/utils.js.map +1 -1
- package/package.json +2 -2
- package/src/react-native/glob.ts +1 -1
- package/src/remix/codemods/express-server.ts +0 -121
- package/src/remix/codemods/handle-error.ts +3 -2
- package/src/remix/remix-wizard.ts +45 -17
- package/src/remix/sdk-example.ts +0 -2
- package/src/remix/sdk-setup.ts +125 -33
- package/src/remix/templates.ts +1 -1
- package/src/remix/utils.ts +57 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.24.0
|
|
4
|
+
|
|
5
|
+
- feat(remix): Switch to OTEL setup (#593)
|
|
6
|
+
- feat(remix): Update `start` script for built-in Remix servers (#604)
|
|
7
|
+
- deps: Bump glob to `10.4.2` (#599)
|
|
8
|
+
|
|
3
9
|
## 3.23.3
|
|
4
10
|
|
|
5
11
|
- fix(nextjs): Fix Types of GlobalError (#592)
|
|
@@ -12,12 +18,14 @@
|
|
|
12
18
|
|
|
13
19
|
## 3.23.1
|
|
14
20
|
|
|
15
|
-
- fix(nextjs): Replace `url` with `sentryUrl` in `withSentryConfig` options
|
|
21
|
+
- fix(nextjs): Replace `url` with `sentryUrl` in `withSentryConfig` options
|
|
22
|
+
(#579)
|
|
16
23
|
|
|
17
24
|
## 3.23.0
|
|
18
25
|
|
|
19
26
|
- feat(apple): Disable build script sandboxing (#574)
|
|
20
|
-
- feat(reactnative): Added comment to add spotlight in Sentry.init for React
|
|
27
|
+
- feat(reactnative): Added comment to add spotlight in Sentry.init for React
|
|
28
|
+
Native config (#548)
|
|
21
29
|
- feat(reactnative): Added `withSentryConfig` Metro patch (#575)
|
|
22
30
|
|
|
23
31
|
## 3.22.3
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/wizard",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.24.0",
|
|
4
4
|
"homepage": "https://github.com/getsentry/sentry-wizard",
|
|
5
5
|
"repository": "https://github.com/getsentry/sentry-wizard",
|
|
6
6
|
"description": "Sentry wizard helping you to configure your project",
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"@sentry/node": "^7.69.0",
|
|
30
30
|
"axios": "1.6.0",
|
|
31
31
|
"chalk": "^2.4.1",
|
|
32
|
-
"glob": "^
|
|
32
|
+
"glob": "^8.1.0",
|
|
33
33
|
"inquirer": "^6.2.0",
|
|
34
34
|
"lodash": "^4.17.15",
|
|
35
35
|
"magicast": "^0.2.10",
|
|
@@ -1,15 +1,35 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
4
24
|
};
|
|
5
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
26
|
exports.getFirstMatchedPath = exports.APP_BUILD_GRADLE = exports.XCODE_PROJECT = void 0;
|
|
7
|
-
var
|
|
27
|
+
var glob = __importStar(require("glob"));
|
|
8
28
|
exports.XCODE_PROJECT = 'ios/*.xcodeproj/project.pbxproj';
|
|
9
29
|
exports.APP_BUILD_GRADLE = '**/app/build.gradle';
|
|
10
30
|
var IGNORE_PATTERNS = ['node_modules/**', 'ios/Pods/**', '**/Pods/**'];
|
|
11
31
|
function getFirstMatchedPath(pattern) {
|
|
12
|
-
var matches =
|
|
32
|
+
var matches = glob.sync(pattern, {
|
|
13
33
|
ignore: IGNORE_PATTERNS,
|
|
14
34
|
});
|
|
15
35
|
return matches[0];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/react-native/glob.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../../src/react-native/glob.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yCAA6B;AAEhB,QAAA,aAAa,GAAG,iCAAiC,CAAC;AAClD,QAAA,gBAAgB,GAAG,qBAAqB,CAAC;AAEtD,IAAM,eAAe,GAAG,CAAC,iBAAiB,EAAE,aAAa,EAAE,YAAY,CAAC,CAAC;AACzE,SAAgB,mBAAmB,CAAC,OAAe;IACjD,IAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE;QACjC,MAAM,EAAE,eAAe;KACxB,CAAC,CAAC;IAEH,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC;AAND,kDAMC","sourcesContent":["import * as glob from 'glob';\n\nexport const XCODE_PROJECT = 'ios/*.xcodeproj/project.pbxproj';\nexport const APP_BUILD_GRADLE = '**/app/build.gradle';\n\nconst IGNORE_PATTERNS = ['node_modules/**', 'ios/Pods/**', '**/Pods/**'];\nexport function getFirstMatchedPath(pattern: string): string | undefined {\n const matches = glob.sync(pattern, {\n ignore: IGNORE_PATTERNS,\n });\n\n return matches[0];\n}\n"]}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import * as recast from 'recast';
|
|
2
|
-
import { ProxifiedImportItem } from 'magicast';
|
|
3
1
|
export declare function findCustomExpressServerImplementation(): Promise<string | null>;
|
|
4
|
-
export declare function instrumentExpressCreateRequestHandler(expressServerPath: string): Promise<boolean>;
|
|
5
|
-
export declare function wrapCreateRequestHandlerWithSentry(createRequestHandlerImport: ProxifiedImportItem | undefined): recast.types.namedTypes.VariableDeclaration | undefined;
|
|
@@ -58,19 +58,10 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
58
58
|
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
62
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
|
-
};
|
|
64
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
exports.
|
|
66
|
-
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
67
|
-
var prompts_1 = __importDefault(require("@clack/prompts"));
|
|
68
|
-
var chalk_1 = __importDefault(require("chalk"));
|
|
69
|
-
var recast = __importStar(require("recast"));
|
|
70
|
-
var ast_types_1 = require("ast-types");
|
|
62
|
+
exports.findCustomExpressServerImplementation = void 0;
|
|
71
63
|
var magicast_1 = require("magicast");
|
|
72
64
|
var fs = __importStar(require("fs"));
|
|
73
|
-
var utils_1 = require("../utils");
|
|
74
65
|
var ast_utils_1 = require("../../utils/ast-utils");
|
|
75
66
|
// Try to find the Express server implementation that contains `createRequestHandler` from `@remix-run/express`
|
|
76
67
|
function findCustomExpressServerImplementation() {
|
|
@@ -118,74 +109,4 @@ function findCustomExpressServerImplementation() {
|
|
|
118
109
|
});
|
|
119
110
|
}
|
|
120
111
|
exports.findCustomExpressServerImplementation = findCustomExpressServerImplementation;
|
|
121
|
-
// Wrap createRequestHandler with `wrapExpressCreateRequestHandler` from `@sentry/remix`
|
|
122
|
-
function instrumentExpressCreateRequestHandler(expressServerPath) {
|
|
123
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
124
|
-
var originalExpressServerMod, createRequestHandlerImport, insertionIndex, createRequestHandlerConst, e_1;
|
|
125
|
-
return __generator(this, function (_a) {
|
|
126
|
-
switch (_a.label) {
|
|
127
|
-
case 0: return [4 /*yield*/, (0, magicast_1.loadFile)(expressServerPath)];
|
|
128
|
-
case 1:
|
|
129
|
-
originalExpressServerMod = _a.sent();
|
|
130
|
-
if ((0, utils_1.hasSentryContent)((0, magicast_1.generateCode)(originalExpressServerMod.$ast).code, originalExpressServerMod.$code)) {
|
|
131
|
-
prompts_1.default.log.warn("Express server in ".concat(chalk_1.default.cyan(expressServerPath), " already has Sentry instrumentation. Skipping."));
|
|
132
|
-
return [2 /*return*/, false];
|
|
133
|
-
}
|
|
134
|
-
originalExpressServerMod.imports.$add({
|
|
135
|
-
from: '@sentry/remix',
|
|
136
|
-
imported: 'wrapExpressCreateRequestHandler',
|
|
137
|
-
local: 'wrapExpressCreateRequestHandler',
|
|
138
|
-
});
|
|
139
|
-
createRequestHandlerImport = originalExpressServerMod.imports.$items.find(function (imp) {
|
|
140
|
-
return imp.from === '@remix-run/express' &&
|
|
141
|
-
imp.imported === 'createRequestHandler';
|
|
142
|
-
});
|
|
143
|
-
(0, ast_types_1.visit)(originalExpressServerMod.$ast, {
|
|
144
|
-
visitIdentifier: function (path) {
|
|
145
|
-
if (path.value.name === 'createRequestHandler' &&
|
|
146
|
-
path.parentPath.value.type === 'CallExpression') {
|
|
147
|
-
path.value.name = 'sentryCreateRequestHandler';
|
|
148
|
-
}
|
|
149
|
-
this.traverse(path);
|
|
150
|
-
},
|
|
151
|
-
});
|
|
152
|
-
insertionIndex = (0, utils_1.getInitCallInsertionIndex)(originalExpressServerMod.$ast);
|
|
153
|
-
createRequestHandlerConst = wrapCreateRequestHandlerWithSentry(createRequestHandlerImport);
|
|
154
|
-
if (!createRequestHandlerConst) {
|
|
155
|
-
// Todo: throw error
|
|
156
|
-
}
|
|
157
|
-
originalExpressServerMod.$ast.body.splice(insertionIndex, 0,
|
|
158
|
-
// @ts-expect-error - string works here because the AST is proxified by magicast
|
|
159
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
160
|
-
createRequestHandlerConst);
|
|
161
|
-
_a.label = 2;
|
|
162
|
-
case 2:
|
|
163
|
-
_a.trys.push([2, 4, , 5]);
|
|
164
|
-
return [4 /*yield*/, (0, magicast_1.writeFile)(originalExpressServerMod.$ast, expressServerPath)];
|
|
165
|
-
case 3:
|
|
166
|
-
_a.sent();
|
|
167
|
-
prompts_1.default.log.info("Successfully instrumented Express server in ".concat(chalk_1.default.cyan(expressServerPath), "."));
|
|
168
|
-
return [3 /*break*/, 5];
|
|
169
|
-
case 4:
|
|
170
|
-
e_1 = _a.sent();
|
|
171
|
-
prompts_1.default.log.warn("Could not write to Express server in ".concat(chalk_1.default.cyan(expressServerPath), "."));
|
|
172
|
-
throw e_1;
|
|
173
|
-
case 5: return [2 /*return*/, true];
|
|
174
|
-
}
|
|
175
|
-
});
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
exports.instrumentExpressCreateRequestHandler = instrumentExpressCreateRequestHandler;
|
|
179
|
-
// Wrap `createRequestHandler` with `wrapExpressCreateRequestHandler` and set const name to `sentryCreateRequestHandler`
|
|
180
|
-
function wrapCreateRequestHandlerWithSentry(createRequestHandlerImport) {
|
|
181
|
-
if (!createRequestHandlerImport) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
var createRequestHandler = createRequestHandlerImport.local;
|
|
185
|
-
var wrapCreateRequestHandler = recast.types.builders.callExpression(recast.types.builders.identifier('wrapExpressCreateRequestHandler'), [recast.types.builders.identifier(createRequestHandler)]);
|
|
186
|
-
return recast.types.builders.variableDeclaration('const', [
|
|
187
|
-
recast.types.builders.variableDeclarator(recast.types.builders.identifier('sentryCreateRequestHandler'), wrapCreateRequestHandler),
|
|
188
|
-
]);
|
|
189
|
-
}
|
|
190
|
-
exports.wrapCreateRequestHandlerWithSentry = wrapCreateRequestHandlerWithSentry;
|
|
191
112
|
//# sourceMappingURL=express-server.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"express-server.js","sourceRoot":"","sources":["../../../../src/remix/codemods/express-server.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"express-server.js","sourceRoot":"","sources":["../../../../src/remix/codemods/express-server.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAGkB;AAClB,qCAAyB;AAEzB,mDAAiD;AAEjD,+GAA+G;AAC/G,SAAsB,qCAAqC;;;;;;oBACnD,aAAa,GAAG;wBACpB,QAAQ;wBACR,cAAc;wBACd,YAAY;wBACZ,kBAAkB;qBACnB,CAAC;0BAEkC,EAAb,+BAAa;;;yBAAb,CAAA,2BAAa,CAAA;oBAAzB,QAAQ;oBACX,QAAQ,GAAG,IAAA,oBAAQ,EAAC,QAAQ,CAAC,CAAC;oBAEpC,IAAI,CAAC,QAAQ,EAAE;wBACb,wBAAS;qBACV;oBAEK,QAAQ,GAAG,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;oBAEvC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE;wBACtB,wBAAS;qBACV;oBAEe,qBAAM,IAAA,mBAAQ,EAAC,QAAQ,CAAC,EAAA;;oBAAlC,OAAO,GAAG,SAAwB;oBAClC,0BAA0B,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,CAC5D,UAAC,GAAG;wBACF,OAAA,GAAG,CAAC,IAAI,KAAK,oBAAoB;4BACjC,GAAG,CAAC,QAAQ,KAAK,sBAAsB;oBADvC,CACuC,CAC1C,CAAC;oBAEF,IAAI,0BAA0B,EAAE;wBAC9B,sBAAO,QAAQ,EAAC;qBACjB;;;oBAtBoB,IAAa,CAAA;;wBAyBpC,sBAAO,IAAI,EAAC;;;;CACb;AAlCD,sFAkCC","sourcesContent":["import {\n loadFile,\n // @ts-expect-error - magicast is ESM and TS complains about that. It works though\n} from 'magicast';\nimport * as fs from 'fs';\n\nimport { findFile } from '../../utils/ast-utils';\n\n// Try to find the Express server implementation that contains `createRequestHandler` from `@remix-run/express`\nexport async function findCustomExpressServerImplementation() {\n const possiblePaths = [\n 'server',\n 'server/index',\n 'app/server',\n 'app/server/index',\n ];\n\n for (const filePath of possiblePaths) {\n const filename = findFile(filePath);\n\n if (!filename) {\n continue;\n }\n\n const fileStat = fs.statSync(filename);\n\n if (!fileStat.isFile()) {\n continue;\n }\n\n const fileMod = await loadFile(filename);\n const createRequestHandlerImport = fileMod.imports.$items.find(\n (imp) =>\n imp.from === '@remix-run/express' &&\n imp.imported === 'createRequestHandler',\n );\n\n if (createRequestHandlerImport) {\n return filename;\n }\n }\n\n return null;\n}\n"]}
|
|
@@ -50,12 +50,12 @@ function instrumentHandleError(originalEntryServerMod, serverEntryFilename) {
|
|
|
50
50
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
51
51
|
var implementation = recast.parse(templates_1.HANDLE_ERROR_TEMPLATE_V2).program
|
|
52
52
|
.body[0];
|
|
53
|
-
originalEntryServerModAST.body.splice((0, utils_1.
|
|
53
|
+
originalEntryServerModAST.body.splice((0, utils_1.getAfterImportsInsertionIndex)(originalEntryServerModAST), 0,
|
|
54
54
|
// @ts-expect-error - string works here because the AST is proxified by magicast
|
|
55
55
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
56
56
|
recast.types.builders.exportNamedDeclaration(implementation));
|
|
57
57
|
}
|
|
58
|
-
else if ((0, utils_1.hasSentryContent)((0, magicast_1.generateCode)(handleErrorFunction).code, originalEntryServerMod.$code)) {
|
|
58
|
+
else if ((0, utils_1.hasSentryContent)((0, magicast_1.generateCode)(handleErrorFunction).code, originalEntryServerMod.$code, 'captureRemixServerException')) {
|
|
59
59
|
return false;
|
|
60
60
|
}
|
|
61
61
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handle-error.js","sourceRoot":"","sources":["../../../../src/remix/codemods/handle-error.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM5D,6CAAiC;AAEjC,0CAAwD;AACxD,
|
|
1
|
+
{"version":3,"file":"handle-error.js","sourceRoot":"","sources":["../../../../src/remix/codemods/handle-error.ts"],"names":[],"mappings":";AAAA,4DAA4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAM5D,6CAAiC;AAEjC,0CAAwD;AACxD,kCAA2E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AC,OAAO;aAClE,IAAI,CAAC,CAAC,CAAC,CAAC;QAEX,gFAAgF;QAChF,yGAAyG;QACzG,mBAAmB,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO;QAC/C,sEAAsE;QACtE,MAAM,CAAC,KAAK,CAAC,oCAAwB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CACpE,CAAC;QAEF,+BAA+B;QAC/B,EAAE;QACF,gFAAgF;QAChF,sEAAsE;QACtE,mBAAmB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;QAErE,mDAAmD;QACnD,iEAAiE;QACjE,EAAE;QACF,gFAAgF;QAChF,sEAAsE;QACtE,IAAI,MAAA,MAAA,mBAAmB,CAAC,WAAW,CAAC,MAAM,0CAAG,CAAC,CAAC,0CAAE,UAAU,EAAE;YAC3D,gFAAgF;YAChF,yGAAyG;YACzG,mBAAmB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI;YACvD,sEAAsE;YACtE,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,CACvC,CAAC;SACH;aAAM;YACL,8CAA8C;YAC9C,EAAE;YACF,gFAAgF;YAChF,sEAAsE;YACtE,mBAAmB,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;SACtE;KACF;IAED,OAAO,IAAI,CAAC;AACd,CAAC;AA/ED,sDA+EC","sourcesContent":["/* eslint-disable @typescript-eslint/no-unsafe-assignment */\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport type { ProxifiedModule } from 'magicast';\nimport type { Program } from '@babel/types';\n\nimport * as recast from 'recast';\n\nimport { HANDLE_ERROR_TEMPLATE_V2 } from '../templates';\nimport { getAfterImportsInsertionIndex, hasSentryContent } from '../utils';\n\n// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { generateCode } from 'magicast';\n\nexport function instrumentHandleError(\n originalEntryServerMod: ProxifiedModule<any>,\n serverEntryFilename: string,\n): boolean {\n const originalEntryServerModAST = originalEntryServerMod.$ast as Program;\n\n const handleErrorFunction = originalEntryServerModAST.body.find(\n (node) =>\n node.type === 'ExportNamedDeclaration' &&\n node.declaration?.type === 'FunctionDeclaration' &&\n node.declaration.id?.name === 'handleError',\n );\n\n if (!handleErrorFunction) {\n clack.log.warn(\n `Could not find function ${chalk.cyan('handleError')} in ${chalk.cyan(\n serverEntryFilename,\n )}. Creating one for you.`,\n );\n\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n originalEntryServerModAST.body.splice(\n getAfterImportsInsertionIndex(originalEntryServerModAST),\n 0,\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-argument\n recast.types.builders.exportNamedDeclaration(implementation),\n );\n } else if (\n hasSentryContent(\n generateCode(handleErrorFunction).code,\n originalEntryServerMod.$code,\n 'captureRemixServerException',\n )\n ) {\n return false;\n } else {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n const implementation = recast.parse(HANDLE_ERROR_TEMPLATE_V2).program\n .body[0];\n\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n handleErrorFunction.declaration.body.body.unshift(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n recast.parse(HANDLE_ERROR_TEMPLATE_V2).program.body[0].body.body[0],\n );\n\n // First parameter is the error\n //\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n handleErrorFunction.declaration.params[0] = implementation.params[0];\n\n // Second parameter is the request inside an object\n // Merging the object properties to make sure it includes request\n //\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (handleErrorFunction.declaration.params?.[1]?.properties) {\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call\n handleErrorFunction.declaration.params[1].properties.push(\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n implementation.params[1].properties[0],\n );\n } else {\n // Create second parameter if it doesn't exist\n //\n // @ts-expect-error - string works here because the AST is proxified by magicast\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n handleErrorFunction.declaration.params[1] = implementation.params[1];\n }\n }\n\n return true;\n}\n"]}
|
|
@@ -66,7 +66,7 @@ function runRemixWizard(options) {
|
|
|
66
66
|
exports.runRemixWizard = runRemixWizard;
|
|
67
67
|
function runRemixWizardWithTelemetry(options) {
|
|
68
68
|
return __awaiter(this, void 0, void 0, function () {
|
|
69
|
-
var remixConfig, packageJson, _a, selectedProject, authToken, sentryUrl, selfHosted, dsn, isTS, isV2, viteConfig, shouldCreateExamplePage;
|
|
69
|
+
var remixConfig, packageJson, _a, selectedProject, authToken, sentryUrl, selfHosted, dsn, isTS, isV2, viteConfig, instrumentationFile, serverFileInstrumented, shouldCreateExamplePage;
|
|
70
70
|
var _this = this;
|
|
71
71
|
return __generator(this, function (_b) {
|
|
72
72
|
switch (_b.label) {
|
|
@@ -215,19 +215,20 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
215
215
|
}); })];
|
|
216
216
|
case 13:
|
|
217
217
|
_b.sent();
|
|
218
|
-
|
|
218
|
+
instrumentationFile = '';
|
|
219
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('Create server instrumentation file', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
219
220
|
var e_5;
|
|
220
221
|
return __generator(this, function (_a) {
|
|
221
222
|
switch (_a.label) {
|
|
222
223
|
case 0:
|
|
223
224
|
_a.trys.push([0, 2, , 3]);
|
|
224
|
-
return [4 /*yield*/, (0, sdk_setup_1.
|
|
225
|
+
return [4 /*yield*/, (0, sdk_setup_1.createServerInstrumentationFile)(dsn)];
|
|
225
226
|
case 1:
|
|
226
|
-
_a.sent();
|
|
227
|
+
instrumentationFile = _a.sent();
|
|
227
228
|
return [3 /*break*/, 3];
|
|
228
229
|
case 2:
|
|
229
230
|
e_5 = _a.sent();
|
|
230
|
-
prompts_1.default.log.warn(
|
|
231
|
+
prompts_1.default.log.warn('Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/');
|
|
231
232
|
(0, debug_1.debug)(e_5);
|
|
232
233
|
return [3 /*break*/, 3];
|
|
233
234
|
case 3: return [2 /*return*/];
|
|
@@ -236,23 +237,20 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
236
237
|
}); })];
|
|
237
238
|
case 14:
|
|
238
239
|
_b.sent();
|
|
239
|
-
|
|
240
|
-
|
|
240
|
+
serverFileInstrumented = false;
|
|
241
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('Create server instrumentation file and import it', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
242
|
+
var e_6;
|
|
241
243
|
return __generator(this, function (_a) {
|
|
242
244
|
switch (_a.label) {
|
|
243
245
|
case 0:
|
|
244
246
|
_a.trys.push([0, 2, , 3]);
|
|
245
|
-
|
|
246
|
-
if (!hasExpressAdapter) {
|
|
247
|
-
return [2 /*return*/];
|
|
248
|
-
}
|
|
249
|
-
return [4 /*yield*/, (0, sdk_setup_1.instrumentExpressServer)()];
|
|
247
|
+
return [4 /*yield*/, (0, sdk_setup_1.insertServerInstrumentationFile)(dsn)];
|
|
250
248
|
case 1:
|
|
251
|
-
_a.sent();
|
|
249
|
+
serverFileInstrumented = _a.sent();
|
|
252
250
|
return [3 /*break*/, 3];
|
|
253
251
|
case 2:
|
|
254
252
|
e_6 = _a.sent();
|
|
255
|
-
prompts_1.default.log.warn(
|
|
253
|
+
prompts_1.default.log.warn('Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/');
|
|
256
254
|
(0, debug_1.debug)(e_6);
|
|
257
255
|
return [3 /*break*/, 3];
|
|
258
256
|
case 3: return [2 /*return*/];
|
|
@@ -261,10 +259,55 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
261
259
|
}); })];
|
|
262
260
|
case 15:
|
|
263
261
|
_b.sent();
|
|
264
|
-
return [
|
|
262
|
+
if (!(!serverFileInstrumented && instrumentationFile)) return [3 /*break*/, 17];
|
|
263
|
+
return [4 /*yield*/, (0, telemetry_1.traceStep)('Update `start` script to import instrumentation file.', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
264
|
+
var e_7;
|
|
265
|
+
return __generator(this, function (_a) {
|
|
266
|
+
switch (_a.label) {
|
|
267
|
+
case 0:
|
|
268
|
+
_a.trys.push([0, 2, , 3]);
|
|
269
|
+
return [4 /*yield*/, (0, sdk_setup_1.updateStartScript)(instrumentationFile)];
|
|
270
|
+
case 1:
|
|
271
|
+
_a.sent();
|
|
272
|
+
return [3 /*break*/, 3];
|
|
273
|
+
case 2:
|
|
274
|
+
e_7 = _a.sent();
|
|
275
|
+
prompts_1.default.log
|
|
276
|
+
.warn("Could not automatically add Sentry initialization to server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/");
|
|
277
|
+
(0, debug_1.debug)(e_7);
|
|
278
|
+
return [3 /*break*/, 3];
|
|
279
|
+
case 3: return [2 /*return*/];
|
|
280
|
+
}
|
|
281
|
+
});
|
|
282
|
+
}); })];
|
|
265
283
|
case 16:
|
|
284
|
+
_b.sent();
|
|
285
|
+
_b.label = 17;
|
|
286
|
+
case 17: return [4 /*yield*/, (0, telemetry_1.traceStep)('Instrument server `handleError`', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
287
|
+
var e_8;
|
|
288
|
+
return __generator(this, function (_a) {
|
|
289
|
+
switch (_a.label) {
|
|
290
|
+
case 0:
|
|
291
|
+
_a.trys.push([0, 2, , 3]);
|
|
292
|
+
return [4 /*yield*/, (0, sdk_setup_1.instrumentSentryOnEntryServer)(isV2, isTS)];
|
|
293
|
+
case 1:
|
|
294
|
+
_a.sent();
|
|
295
|
+
return [3 /*break*/, 3];
|
|
296
|
+
case 2:
|
|
297
|
+
e_8 = _a.sent();
|
|
298
|
+
prompts_1.default.log.warn("Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/");
|
|
299
|
+
(0, debug_1.debug)(e_8);
|
|
300
|
+
return [3 /*break*/, 3];
|
|
301
|
+
case 3: return [2 /*return*/];
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
}); })];
|
|
305
|
+
case 18:
|
|
306
|
+
_b.sent();
|
|
307
|
+
return [4 /*yield*/, (0, clack_utils_1.askShouldCreateExamplePage)()];
|
|
308
|
+
case 19:
|
|
266
309
|
shouldCreateExamplePage = _b.sent();
|
|
267
|
-
if (!shouldCreateExamplePage) return [3 /*break*/,
|
|
310
|
+
if (!shouldCreateExamplePage) return [3 /*break*/, 21];
|
|
268
311
|
return [4 /*yield*/, (0, telemetry_1.traceStep)('Create example page', function () { return __awaiter(_this, void 0, void 0, function () {
|
|
269
312
|
return __generator(this, function (_a) {
|
|
270
313
|
switch (_a.label) {
|
|
@@ -281,10 +324,10 @@ function runRemixWizardWithTelemetry(options) {
|
|
|
281
324
|
}
|
|
282
325
|
});
|
|
283
326
|
}); })];
|
|
284
|
-
case
|
|
327
|
+
case 20:
|
|
285
328
|
_b.sent();
|
|
286
|
-
_b.label =
|
|
287
|
-
case
|
|
329
|
+
_b.label = 21;
|
|
330
|
+
case 21:
|
|
288
331
|
prompts_1.default.outro("\n".concat(chalk_1.default.green('Sentry has been successfully configured for your Remix project.'), "\n\n").concat(chalk_1.default.cyan('You can now deploy your project to see Sentry in action.'), "\n\n").concat(chalk_1.default.cyan("To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/")));
|
|
289
332
|
return [2 /*return*/];
|
|
290
333
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remix-wizard.js","sourceRoot":"","sources":["../../../src/remix/remix-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAE1B,oDAW8B;AAC9B,sDAA4D;AAE5D,yCASqB;AACrB,wCAAuC;AACvC,0CAAwD;AACxD,iCAAwC;AACxC,iDAAkD;AAClD,gDAA8C;AAC9C,iDAA+D;AAC/D,6CAAkD;AAElD,SAAsB,cAAc,CAAC,OAAsB;;;YACzD,sBAAO,IAAA,yBAAa,EAClB;oBACE,OAAO,EAAE,OAAO,CAAC,gBAAgB;oBACjC,WAAW,EAAE,OAAO;iBACrB,EACD,cAAM,OAAA,2BAA2B,CAAC,OAAO,CAAC,EAApC,CAAoC,CAC3C,EAAC;;;CACH;AARD,wCAQC;AAED,SAAe,2BAA2B,CACxC,OAAsB;;;;;;;oBAEtB,IAAA,0BAAY,EAAC;wBACX,UAAU,EAAE,qBAAqB;wBACjC,SAAS,EAAE,OAAO,CAAC,SAAS;wBAC5B,gBAAgB,EAAE,OAAO,CAAC,gBAAgB;qBAC3C,CAAC,CAAC;oBAEH,qBAAM,IAAA,+CAAiC,GAAE,EAAA;;oBAAzC,SAAyC,CAAC;oBAEtB,qBAAM,IAAA,2BAAe,GAAE,EAAA;;oBAArC,WAAW,GAAG,SAAuB;oBACvB,qBAAM,IAAA,+BAAiB,GAAE,EAAA;;oBAAvC,WAAW,GAAG,SAAyB;oBAE7C,qEAAqE;oBACrE,qBAAM,IAAA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CACf,CAAC,EAAA;;wCANF,SAME,CAAC;;;;6BACJ,CAAC,EAAA;;oBARF,SAQE,CAAC;;;oBAGL,iBAAK,CAAC,KAAK,CAAC,YACZ,eAAK,CAAC,KAAK,CACX,iEAAiE,CAClE,iBAEC,eAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,iBAEtE,eAAK,CAAC,IAAI,CACV,uIACwD,CACzD,CAAE,CAAC,CAAC;;;;;CACJ","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n rcCliSetupConfig,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport {\n initializeSentryOnEntryClient,\n initializeSentryOnEntryServer,\n updateBuildScript,\n instrumentRootRoute,\n isRemixV2,\n loadRemixConfig,\n runRemixReveal,\n instrumentExpressServer,\n} from './sdk-setup';\nimport { debug } from '../utils/debug';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { isHydrogenApp } from './utils';\nimport { DEFAULT_URL } from '../../lib/Constants';\nimport { findFile } from '../utils/ast-utils';\nimport { configureVitePlugin } from '../sourcemaps/tools/vite';\nimport { createExamplePage } from './sdk-example';\n\nexport async function runRemixWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'remix',\n },\n () => runRemixWizardWithTelemetry(options),\n );\n}\n\nasync function runRemixWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Remix Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const remixConfig = await loadRemixConfig();\n const packageJson = await getPackageDotJson();\n\n // We expect `@remix-run/dev` to be installed for every Remix project\n await ensurePackageIsInstalled(packageJson, '@remix-run/dev', 'Remix');\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-remix');\n\n await installPackage({\n packageName: '@sentry/remix',\n alreadyInstalled: hasPackageInstalled('@sentry/remix', packageJson),\n });\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const isTS = isUsingTypeScript();\n const isV2 = isRemixV2(remixConfig, packageJson);\n const viteConfig = findFile('vite.config');\n\n await addSentryCliConfig({ authToken }, rcCliSetupConfig);\n\n if (viteConfig) {\n await traceStep(\n 'Update vite configuration for sourcemap uploads',\n async () => {\n try {\n await configureVitePlugin({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n selfHosted,\n authToken,\n });\n } catch (e) {\n clack.log\n .warn(`Could not update vite configuration to generate and upload sourcemaps.\n Please update your vite configuration manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n },\n );\n } else {\n await traceStep('Update build script for sourcemap uploads', async () => {\n try {\n await updateBuildScript({\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n url: sentryUrl === DEFAULT_URL ? undefined : sentryUrl,\n isHydrogen: isHydrogenApp(packageJson),\n });\n } catch (e) {\n clack.log\n .warn(`Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n });\n }\n\n await traceStep('Instrument root route', async () => {\n try {\n await instrumentRootRoute(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not instrument root route.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n traceStep('Reveal missing entry files', () => {\n try {\n runRemixReveal(isTS);\n } catch (e) {\n clack.log.warn(`Could not run 'npx remix reveal'.\n Please create your entry files manually`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on client entry', async () => {\n try {\n await initializeSentryOnEntryClient(dsn, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on server entry', async () => {\n try {\n await initializeSentryOnEntryServer(dsn, isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n await traceStep('Instrument custom Express server', async () => {\n try {\n const hasExpressAdapter = hasPackageInstalled(\n '@remix-run/express',\n packageJson,\n );\n\n if (!hasExpressAdapter) {\n return;\n }\n\n await instrumentExpressServer();\n } catch (e) {\n clack.log.warn(`Could not instrument custom Express server.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/#custom-express-server`);\n debug(e);\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('Create example page', async () => {\n await createExamplePage({\n isTS,\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n });\n }\n\n clack.outro(`\n${chalk.green(\n 'Sentry has been successfully configured for your Remix project.',\n)}\n\n${chalk.cyan('You can now deploy your project to see Sentry in action.')}\n\n${chalk.cyan(\n `To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/`,\n)}`);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"remix-wizard.js","sourceRoot":"","sources":["../../../src/remix/remix-wizard.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,2DAAmC;AACnC,gDAA0B;AAE1B,oDAW8B;AAC9B,sDAA4D;AAE5D,yCAWqB;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MAAA;4CACJ,UAAU,YAAA;4CACV,OAAO,EAAE,eAAe,CAAC,YAAY,CAAC,IAAI;4CAC1C,SAAS,EAAE,eAAe,CAAC,EAAE;4CAC7B,GAAG,EAAE,SAAS;yCACf,CAAC,EAAA;;wCANF,SAME,CAAC;;;;6BACJ,CAAC,EAAA;;oBARF,SAQE,CAAC;;;oBAGL,iBAAK,CAAC,KAAK,CAAC,YACZ,eAAK,CAAC,KAAK,CACX,iEAAiE,CAClE,iBAEC,eAAK,CAAC,IAAI,CAAC,0DAA0D,CAAC,iBAEtE,eAAK,CAAC,IAAI,CACV,uIACwD,CACzD,CAAE,CAAC,CAAC;;;;;CACJ","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport chalk from 'chalk';\n\nimport {\n addSentryCliConfig,\n askShouldCreateExamplePage,\n confirmContinueIfNoOrDirtyGitRepo,\n ensurePackageIsInstalled,\n getOrAskForProjectData,\n getPackageDotJson,\n installPackage,\n isUsingTypeScript,\n printWelcome,\n rcCliSetupConfig,\n} from '../utils/clack-utils';\nimport { hasPackageInstalled } from '../utils/package-json';\nimport { WizardOptions } from '../utils/types';\nimport {\n initializeSentryOnEntryClient,\n instrumentSentryOnEntryServer,\n updateBuildScript,\n instrumentRootRoute,\n isRemixV2,\n loadRemixConfig,\n runRemixReveal,\n insertServerInstrumentationFile,\n createServerInstrumentationFile,\n updateStartScript,\n} from './sdk-setup';\nimport { debug } from '../utils/debug';\nimport { traceStep, withTelemetry } from '../telemetry';\nimport { isHydrogenApp } from './utils';\nimport { DEFAULT_URL } from '../../lib/Constants';\nimport { findFile } from '../utils/ast-utils';\nimport { configureVitePlugin } from '../sourcemaps/tools/vite';\nimport { createExamplePage } from './sdk-example';\n\nexport async function runRemixWizard(options: WizardOptions): Promise<void> {\n return withTelemetry(\n {\n enabled: options.telemetryEnabled,\n integration: 'remix',\n },\n () => runRemixWizardWithTelemetry(options),\n );\n}\n\nasync function runRemixWizardWithTelemetry(\n options: WizardOptions,\n): Promise<void> {\n printWelcome({\n wizardName: 'Sentry Remix Wizard',\n promoCode: options.promoCode,\n telemetryEnabled: options.telemetryEnabled,\n });\n\n await confirmContinueIfNoOrDirtyGitRepo();\n\n const remixConfig = await loadRemixConfig();\n const packageJson = await getPackageDotJson();\n\n // We expect `@remix-run/dev` to be installed for every Remix project\n await ensurePackageIsInstalled(packageJson, '@remix-run/dev', 'Remix');\n\n const { selectedProject, authToken, sentryUrl, selfHosted } =\n await getOrAskForProjectData(options, 'javascript-remix');\n\n await installPackage({\n packageName: '@sentry/remix',\n alreadyInstalled: hasPackageInstalled('@sentry/remix', packageJson),\n });\n\n const dsn = selectedProject.keys[0].dsn.public;\n\n const isTS = isUsingTypeScript();\n const isV2 = isRemixV2(remixConfig, packageJson);\n const viteConfig = findFile('vite.config');\n\n await addSentryCliConfig({ authToken }, rcCliSetupConfig);\n\n if (viteConfig) {\n await traceStep(\n 'Update vite configuration for sourcemap uploads',\n async () => {\n try {\n await configureVitePlugin({\n orgSlug: selectedProject.organization.slug,\n projectSlug: selectedProject.slug,\n url: sentryUrl,\n selfHosted,\n authToken,\n });\n } catch (e) {\n clack.log\n .warn(`Could not update vite configuration to generate and upload sourcemaps.\n Please update your vite configuration manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n },\n );\n } else {\n await traceStep('Update build script for sourcemap uploads', async () => {\n try {\n await updateBuildScript({\n org: selectedProject.organization.slug,\n project: selectedProject.slug,\n url: sentryUrl === DEFAULT_URL ? undefined : sentryUrl,\n isHydrogen: isHydrogenApp(packageJson),\n });\n } catch (e) {\n clack.log\n .warn(`Could not update build script to generate and upload sourcemaps.\n Please update your build script manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/sourcemaps/`);\n debug(e);\n }\n });\n }\n\n await traceStep('Instrument root route', async () => {\n try {\n await instrumentRootRoute(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not instrument root route.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n traceStep('Reveal missing entry files', () => {\n try {\n runRemixReveal(isTS);\n } catch (e) {\n clack.log.warn(`Could not run 'npx remix reveal'.\n Please create your entry files manually`);\n debug(e);\n }\n });\n\n await traceStep('Initialize Sentry on client entry', async () => {\n try {\n await initializeSentryOnEntryClient(dsn, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on client entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n let instrumentationFile = '';\n\n await traceStep('Create server instrumentation file', async () => {\n try {\n instrumentationFile = await createServerInstrumentationFile(dsn);\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n });\n\n let serverFileInstrumented = false;\n\n await traceStep(\n 'Create server instrumentation file and import it',\n async () => {\n try {\n serverFileInstrumented = await insertServerInstrumentationFile(dsn);\n } catch (e) {\n clack.log.warn(\n 'Could not create a server instrumentation file. Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/',\n );\n debug(e);\n }\n },\n );\n\n if (!serverFileInstrumented && instrumentationFile) {\n await traceStep(\n 'Update `start` script to import instrumentation file.',\n async () => {\n try {\n await updateStartScript(instrumentationFile);\n } catch (e) {\n clack.log\n .warn(`Could not automatically add Sentry initialization to server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n },\n );\n }\n\n await traceStep('Instrument server `handleError`', async () => {\n try {\n await instrumentSentryOnEntryServer(isV2, isTS);\n } catch (e) {\n clack.log.warn(`Could not initialize Sentry on server entry.\n Please do it manually using instructions from https://docs.sentry.io/platforms/javascript/guides/remix/manual-setup/`);\n debug(e);\n }\n });\n\n const shouldCreateExamplePage = await askShouldCreateExamplePage();\n\n if (shouldCreateExamplePage) {\n await traceStep('Create example page', async () => {\n await createExamplePage({\n isTS,\n selfHosted,\n orgSlug: selectedProject.organization.slug,\n projectId: selectedProject.id,\n url: sentryUrl,\n });\n });\n }\n\n clack.outro(`\n${chalk.green(\n 'Sentry has been successfully configured for your Remix project.',\n)}\n\n${chalk.cyan('You can now deploy your project to see Sentry in action.')}\n\n${chalk.cyan(\n `To learn more about how to use Sentry with Remix, visit our documentation:\nhttps://docs.sentry.io/platforms/javascript/guides/remix/`,\n)}`);\n}\n"]}
|
|
@@ -95,7 +95,7 @@ function getSentryExamplePageContents(options) {
|
|
|
95
95
|
var issuesPageLink = options.selfHosted
|
|
96
96
|
? "".concat(options.url, "organizations/").concat(options.orgSlug, "/issues/?project=").concat(options.projectId)
|
|
97
97
|
: "https://".concat(options.orgSlug, ".sentry.io/issues/?project=").concat(options.projectId);
|
|
98
|
-
return "\
|
|
98
|
+
return "\nexport default function SentryExamplePage() {\n return (\n <div>\n <main\n style={{\n minHeight: \"100vh\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n\n <h1 style={{ fontSize: \"4rem\", margin: \"14px 0\" }}>\n {/* biome-ignore lint/a11y/noSvgWithoutTitle: <explanation> */}\n <svg\n style={{\n height: \"1em\",\n }}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 44\"\n >\n <path\n fill=\"currentColor\"\n d=\"M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z\"\n />\n </svg>\n </h1>\n\n <p>Get started by sending us a sample error:</p>\n\n <button\n type=\"button\"\n style={{\n padding: \"12px\",\n cursor: \"pointer\",\n backgroundColor: \"#AD6CAA\",\n borderRadius: \"4px\",\n border: \"none\",\n color: \"white\",\n fontSize: \"14px\",\n margin: \"18px\",\n }}\n onClick={() => {\n throw new Error(\"Sentry Example Frontend Error\");\n }}\n >\n Throw error!\n </button>\n\n <p>\n Next, look for the error on the{\" \"}\n <a href=\"".concat(issuesPageLink, "\">Issues Page</a>.\n </p>\n <p style={{ marginTop: \"24px\" }}>\n For more information, see{\" \"}\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/remix/\">\n https://docs.sentry.io/platforms/javascript/guides/remix/\n </a>\n </p>\n </main>\n </div>\n );\n}\n");
|
|
99
99
|
}
|
|
100
100
|
exports.getSentryExamplePageContents = getSentryExamplePageContents;
|
|
101
101
|
//# sourceMappingURL=sdk-example.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-example.js","sourceRoot":"","sources":["../../../src/remix/sdk-example.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,qCAAyB;AACzB,yCAA6B;AAC7B,yEAAyE;AACzE,2DAAmC;AAEnC;;GAEG;AACH,SAAsB,iBAAiB,CAAC,OAMvC;;;;;;oBACO,gBAAgB,GAAG,yCACvB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,MACzB,CAAC;oBAEJ,IAAI,EAAE,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAAE;wBACnC,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,8DAAuD,IAAI,CAAC,QAAQ,CAClE,gBAAgB,CACjB,2CAAwC,CAC1C,CAAC;wBACF,sBAAO;qBACR;oBAED,qBAAM,EAAE,CAAC,QAAQ,CAAC,SAAS,CACzB,gBAAgB,EAChB,4BAA4B,CAAC,OAAO,CAAC,CACtC,EAAA;;oBAHD,SAGC,CAAC;oBAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CAAC,yCAAkC,gBAAgB,MAAG,CAAC,CAAC;;;;;CACvE;AA1BD,8CA0BC;AAED,SAAgB,4BAA4B,CAAC,OAM5C;IACC,IAAM,cAAc,GAAG,OAAO,CAAC,UAAU;QACvC,CAAC,CAAC,UAAG,OAAO,CAAC,GAAG,2BAAiB,OAAO,CAAC,OAAO,8BAAoB,OAAO,CAAC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EA6EC","sourcesContent":["import * as fs from 'fs';\nimport * as path from 'path';\n// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\n\n/**\n * Creates an example Remix page to test Sentry\n */\nexport async function createExamplePage(options: {\n selfHosted: boolean;\n orgSlug: string;\n projectId: string;\n url: string;\n isTS: boolean;\n}) {\n const exampleRoutePath = `app/routes/sentry-example-page.${\n options.isTS ? 'ts' : 'js'\n }x`;\n\n if (fs.existsSync(exampleRoutePath)) {\n clack.log.warn(\n `It seems like a sentry example page already exists (${path.basename(\n exampleRoutePath,\n )}). Skipping creation of example route.`,\n );\n return;\n }\n\n await fs.promises.writeFile(\n exampleRoutePath,\n getSentryExamplePageContents(options),\n );\n\n clack.log.info(`Created sentry example page at ${exampleRoutePath}.`);\n}\n\nexport function getSentryExamplePageContents(options: {\n selfHosted: boolean;\n orgSlug: string;\n projectId: string;\n url: string;\n isTS?: boolean;\n}) {\n const issuesPageLink = options.selfHosted\n ? `${options.url}organizations/${options.orgSlug}/issues/?project=${options.projectId}`\n : `https://${options.orgSlug}.sentry.io/issues/?project=${options.projectId}`;\n\n return `\nexport default function SentryExamplePage() {\n return (\n <div>\n <main\n style={{\n minHeight: \"100vh\",\n display: \"flex\",\n flexDirection: \"column\",\n justifyContent: \"center\",\n alignItems: \"center\",\n }}\n >\n\n <h1 style={{ fontSize: \"4rem\", margin: \"14px 0\" }}>\n {/* biome-ignore lint/a11y/noSvgWithoutTitle: <explanation> */}\n <svg\n style={{\n height: \"1em\",\n }}\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 200 44\"\n >\n <path\n fill=\"currentColor\"\n d=\"M124.32,28.28,109.56,9.22h-3.68V34.77h3.73V15.19l15.18,19.58h3.26V9.22h-3.73ZM87.15,23.54h13.23V20.22H87.14V12.53h14.93V9.21H83.34V34.77h18.92V31.45H87.14ZM71.59,20.3h0C66.44,19.06,65,18.08,65,15.7c0-2.14,1.89-3.59,4.71-3.59a12.06,12.06,0,0,1,7.07,2.55l2-2.83a14.1,14.1,0,0,0-9-3c-5.06,0-8.59,3-8.59,7.27,0,4.6,3,6.19,8.46,7.52C74.51,24.74,76,25.78,76,28.11s-2,3.77-5.09,3.77a12.34,12.34,0,0,1-8.3-3.26l-2.25,2.69a15.94,15.94,0,0,0,10.42,3.85c5.48,0,9-2.95,9-7.51C79.75,23.79,77.47,21.72,71.59,20.3ZM195.7,9.22l-7.69,12-7.64-12h-4.46L186,24.67V34.78h3.84V24.55L200,9.22Zm-64.63,3.46h8.37v22.1h3.84V12.68h8.37V9.22H131.08ZM169.41,24.8c3.86-1.07,6-3.77,6-7.63,0-4.91-3.59-8-9.38-8H154.67V34.76h3.8V25.58h6.45l6.48,9.2h4.44l-7-9.82Zm-10.95-2.5V12.6h7.17c3.74,0,5.88,1.77,5.88,4.84s-2.29,4.86-5.84,4.86Z M29,2.26a4.67,4.67,0,0,0-8,0L14.42,13.53A32.21,32.21,0,0,1,32.17,40.19H27.55A27.68,27.68,0,0,0,12.09,17.47L6,28a15.92,15.92,0,0,1,9.23,12.17H4.62A.76.76,0,0,1,4,39.06l2.94-5a10.74,10.74,0,0,0-3.36-1.9l-2.91,5a4.54,4.54,0,0,0,1.69,6.24A4.66,4.66,0,0,0,4.62,44H19.15a19.4,19.4,0,0,0-8-17.31l2.31-4A23.87,23.87,0,0,1,23.76,44H36.07a35.88,35.88,0,0,0-16.41-31.8l4.67-8a.77.77,0,0,1,1.05-.27c.53.29,20.29,34.77,20.66,35.17a.76.76,0,0,1-.68,1.13H40.6q.09,1.91,0,3.81h4.78A4.59,4.59,0,0,0,50,39.43a4.49,4.49,0,0,0-.62-2.28Z\"\n />\n </svg>\n </h1>\n\n <p>Get started by sending us a sample error:</p>\n\n <button\n type=\"button\"\n style={{\n padding: \"12px\",\n cursor: \"pointer\",\n backgroundColor: \"#AD6CAA\",\n borderRadius: \"4px\",\n border: \"none\",\n color: \"white\",\n fontSize: \"14px\",\n margin: \"18px\",\n }}\n onClick={() => {\n throw new Error(\"Sentry Example Frontend Error\");\n }}\n >\n Throw error!\n </button>\n\n <p>\n Next, look for the error on the{\" \"}\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style={{ marginTop: \"24px\" }}>\n For more information, see{\" \"}\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/remix/\">\n https://docs.sentry.io/platforms/javascript/guides/remix/\n </a>\n </p>\n </main>\n </div>\n );\n}\n`;\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PackageDotJson } from '../utils/package-json';
|
|
1
|
+
import type { PackageDotJson } from '../utils/package-json';
|
|
2
2
|
export type PartialRemixConfig = {
|
|
3
3
|
unstable_dev?: boolean;
|
|
4
4
|
future?: {
|
|
@@ -11,6 +11,8 @@ export type PartialRemixConfig = {
|
|
|
11
11
|
};
|
|
12
12
|
};
|
|
13
13
|
export declare function runRemixReveal(isTS: boolean): void;
|
|
14
|
+
export declare function createServerInstrumentationFile(dsn: string): Promise<string>;
|
|
15
|
+
export declare function insertServerInstrumentationFile(dsn: string): Promise<boolean>;
|
|
14
16
|
export declare function isRemixV2(remixConfig: PartialRemixConfig, packageJson: PackageDotJson): boolean;
|
|
15
17
|
export declare function loadRemixConfig(): Promise<PartialRemixConfig>;
|
|
16
18
|
export declare function instrumentRootRoute(isV2?: boolean, isTS?: boolean): Promise<void>;
|
|
@@ -21,5 +23,5 @@ export declare function updateBuildScript(args: {
|
|
|
21
23
|
isHydrogen: boolean;
|
|
22
24
|
}): Promise<void>;
|
|
23
25
|
export declare function initializeSentryOnEntryClient(dsn: string, isTS: boolean): Promise<void>;
|
|
24
|
-
export declare function
|
|
25
|
-
export declare function
|
|
26
|
+
export declare function updateStartScript(instrumentationFile: string): Promise<void>;
|
|
27
|
+
export declare function instrumentSentryOnEntryServer(isV2: boolean, isTS: boolean): Promise<void>;
|