@sentry/wizard 3.36.0 → 3.37.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 +7 -0
- package/dist/e2e-tests/tests/nuxt-3.test.js +7 -13
- package/dist/e2e-tests/tests/nuxt-3.test.js.map +1 -1
- package/dist/e2e-tests/tests/nuxt-4.test.js +7 -13
- package/dist/e2e-tests/tests/nuxt-4.test.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/nuxt/nuxt-wizard.js +26 -20
- package/dist/src/nuxt/nuxt-wizard.js.map +1 -1
- package/dist/src/nuxt/sdk-setup.d.ts +6 -2
- package/dist/src/nuxt/sdk-setup.js +106 -43
- package/dist/src/nuxt/sdk-setup.js.map +1 -1
- package/dist/src/nuxt/templates.d.ts +1 -1
- package/dist/src/nuxt/templates.js +5 -3
- package/dist/src/nuxt/templates.js.map +1 -1
- package/dist/src/nuxt/types.d.ts +2 -0
- package/dist/src/nuxt/types.js +10 -0
- package/dist/src/nuxt/types.js.map +1 -0
- package/dist/src/nuxt/utils.js +42 -6
- package/dist/src/nuxt/utils.js.map +1 -1
- package/dist/src/utils/clack-utils.d.ts +5 -0
- package/dist/src/utils/clack-utils.js +15 -3
- package/dist/src/utils/clack-utils.js.map +1 -1
- package/dist/test/nuxt/templates.test.js +10 -1
- package/dist/test/nuxt/templates.test.js.map +1 -1
- package/e2e-tests/test-applications/nuxt-4-test-app/README.md +75 -0
- package/e2e-tests/test-applications/nuxt-4-test-app/nuxt.config.ts +6 -0
- package/e2e-tests/test-applications/nuxt-4-test-app/package.json +18 -0
- package/e2e-tests/test-applications/nuxt-4-test-app/public/favicon.ico +0 -0
- package/e2e-tests/test-applications/nuxt-4-test-app/public/robots.txt +1 -0
- package/e2e-tests/tests/nuxt-3.test.ts +6 -9
- package/e2e-tests/tests/nuxt-4.test.ts +6 -9
- package/package.json +1 -1
- package/src/nuxt/nuxt-wizard.ts +11 -4
- package/src/nuxt/sdk-setup.ts +134 -37
- package/src/nuxt/templates.ts +15 -8
- package/src/nuxt/types.ts +8 -0
- package/src/nuxt/utils.ts +17 -7
- package/src/utils/clack-utils.ts +13 -1
- package/test/nuxt/templates.test.ts +33 -6
|
@@ -82,9 +82,9 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
82
82
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
83
83
|
};
|
|
84
84
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
85
|
-
exports.addNuxtOverrides = exports.createConfigFiles = exports.addSDKModule = exports.getNuxtConfig = void 0;
|
|
85
|
+
exports.confirmReadImportDocs = exports.addNuxtOverrides = exports.createConfigFiles = exports.addSDKModule = exports.askDeploymentPlatform = exports.getNuxtConfig = void 0;
|
|
86
86
|
// @ts-expect-error - clack is ESM and TS complains about that. It works though
|
|
87
|
-
var
|
|
87
|
+
var clack = __importStar(require("@clack/prompts"));
|
|
88
88
|
var Sentry = __importStar(require("@sentry/node"));
|
|
89
89
|
var chalk_1 = __importDefault(require("chalk"));
|
|
90
90
|
var fs_1 = __importDefault(require("fs"));
|
|
@@ -97,6 +97,9 @@ var templates_1 = require("./templates");
|
|
|
97
97
|
var clack_utils_1 = require("../utils/clack-utils");
|
|
98
98
|
var telemetry_1 = require("../telemetry");
|
|
99
99
|
var semver_1 = require("semver");
|
|
100
|
+
var package_manager_1 = require("../utils/package-manager");
|
|
101
|
+
var package_json_1 = require("../utils/package-json");
|
|
102
|
+
var types_1 = require("./types");
|
|
100
103
|
var possibleNuxtConfig = [
|
|
101
104
|
'nuxt.config.js',
|
|
102
105
|
'nuxt.config.mjs',
|
|
@@ -115,14 +118,14 @@ function getNuxtConfig() {
|
|
|
115
118
|
return fs_1.default.existsSync(path_1.default.join(process.cwd(), fileName));
|
|
116
119
|
});
|
|
117
120
|
if (!!configFile) return [3 /*break*/, 2];
|
|
118
|
-
|
|
121
|
+
clack.log.info('No Nuxt config file found, creating a new one.');
|
|
119
122
|
Sentry.setTag('nuxt-config-strategy', 'create');
|
|
120
123
|
// nuxt recommends its config to be .ts by default
|
|
121
124
|
configFile = 'nuxt.config.ts';
|
|
122
125
|
return [4 /*yield*/, fs_1.default.promises.writeFile(path_1.default.join(process.cwd(), configFile), (0, templates_1.getDefaultNuxtConfig)(), { encoding: 'utf-8', flag: 'w' })];
|
|
123
126
|
case 1:
|
|
124
127
|
_a.sent();
|
|
125
|
-
|
|
128
|
+
clack.log.success("Created ".concat(chalk_1.default.cyan('nuxt.config.ts'), "."));
|
|
126
129
|
_a.label = 2;
|
|
127
130
|
case 2: return [2 /*return*/, path_1.default.join(process.cwd(), configFile)];
|
|
128
131
|
}
|
|
@@ -130,49 +133,67 @@ function getNuxtConfig() {
|
|
|
130
133
|
});
|
|
131
134
|
}
|
|
132
135
|
exports.getNuxtConfig = getNuxtConfig;
|
|
133
|
-
function
|
|
136
|
+
function askDeploymentPlatform() {
|
|
134
137
|
return __awaiter(this, void 0, void 0, function () {
|
|
135
|
-
|
|
138
|
+
return __generator(this, function (_a) {
|
|
139
|
+
switch (_a.label) {
|
|
140
|
+
case 0: return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(clack.select({
|
|
141
|
+
message: 'Please select your deployment platform.',
|
|
142
|
+
options: types_1.deploymentPlatforms.map(function (platform) { return ({
|
|
143
|
+
value: platform,
|
|
144
|
+
label: "".concat(platform.charAt(0).toUpperCase()).concat(platform.slice(1)),
|
|
145
|
+
}); }),
|
|
146
|
+
}))];
|
|
147
|
+
case 1: return [2 /*return*/, _a.sent()];
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
exports.askDeploymentPlatform = askDeploymentPlatform;
|
|
153
|
+
function addSDKModule(config, options, deploymentPlatform) {
|
|
154
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
155
|
+
var shouldTopLevelImport, mod, code, e_1;
|
|
136
156
|
return __generator(this, function (_a) {
|
|
137
157
|
switch (_a.label) {
|
|
138
158
|
case 0:
|
|
139
|
-
|
|
140
|
-
|
|
159
|
+
shouldTopLevelImport = deploymentPlatform === 'vercel' || deploymentPlatform === 'netlify';
|
|
160
|
+
if (shouldTopLevelImport) {
|
|
161
|
+
clack.log.warn("Sentry needs to be initialized before the application starts. ".concat(chalk_1.default.cyan("".concat(deploymentPlatform
|
|
162
|
+
.charAt(0)
|
|
163
|
+
.toUpperCase()).concat(deploymentPlatform.slice(1))), " does not support this yet.\n\nWe will inject the Sentry server-side config at the top of your Nuxt server entry file instead.\n\nThis comes with some restrictions, for more info see:\n\n").concat(chalk_1.default.underline('https://docs.sentry.io/platforms/javascript/guides/nuxt/install/top-level-import/'), " "));
|
|
164
|
+
}
|
|
165
|
+
_a.label = 1;
|
|
141
166
|
case 1:
|
|
167
|
+
_a.trys.push([1, 4, , 5]);
|
|
168
|
+
return [4 /*yield*/, (0, magicast_1.loadFile)(config)];
|
|
169
|
+
case 2:
|
|
142
170
|
mod = _a.sent();
|
|
143
|
-
(0, helpers_1.addNuxtModule)(mod, '@sentry/nuxt/module', 'sentry', {
|
|
144
|
-
|
|
145
|
-
});
|
|
171
|
+
(0, helpers_1.addNuxtModule)(mod, '@sentry/nuxt/module', 'sentry', __assign({ sourceMapsUploadOptions: __assign({ org: options.org, project: options.project }, (options.selfHosted && { url: options.url })) }, (shouldTopLevelImport && {
|
|
172
|
+
autoInjectServerSentry: 'top-level-import',
|
|
173
|
+
})));
|
|
146
174
|
(0, helpers_1.addNuxtModule)(mod, '@sentry/nuxt/module', 'sourcemap', {
|
|
147
175
|
client: 'hidden',
|
|
148
176
|
});
|
|
149
177
|
code = (0, magicast_1.generateCode)(mod).code;
|
|
150
178
|
return [4 /*yield*/, fs_1.default.promises.writeFile(config, code, { encoding: 'utf-8', flag: 'w' })];
|
|
151
|
-
case 2:
|
|
152
|
-
_a.sent();
|
|
153
|
-
prompts_1.default.log.success("Added Sentry Nuxt Module to ".concat(chalk_1.default.cyan(path_1.default.basename(config)), "."));
|
|
154
|
-
return [3 /*break*/, 7];
|
|
155
179
|
case 3:
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
// eslint-disable-next-line no-console
|
|
160
|
-
console.log("\n\n".concat((0, templates_1.getNuxtModuleFallbackTemplate)(options), "\n\n"));
|
|
161
|
-
return [3 /*break*/, 6];
|
|
180
|
+
_a.sent();
|
|
181
|
+
clack.log.success("Added Sentry Nuxt Module to ".concat(chalk_1.default.cyan(path_1.default.basename(config)), "."));
|
|
182
|
+
return [3 /*break*/, 5];
|
|
162
183
|
case 4:
|
|
163
|
-
|
|
164
|
-
|
|
184
|
+
e_1 = _a.sent();
|
|
185
|
+
clack.log.error('Error while adding the Sentry Nuxt Module to the Nuxt config.');
|
|
186
|
+
clack.log.info(chalk_1.default.dim(typeof e_1 === 'object' && e_1 != null && 'toString' in e_1
|
|
165
187
|
? e_1.toString()
|
|
166
188
|
: typeof e_1 === 'string'
|
|
167
189
|
? e_1
|
|
168
190
|
: 'Unknown error'));
|
|
169
|
-
Sentry.captureException('Error while setting up the Nuxt
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
case
|
|
175
|
-
case 7: return [2 /*return*/];
|
|
191
|
+
Sentry.captureException('Error while setting up the Nuxt Module in nuxt config');
|
|
192
|
+
clack.log.warn("Please add the following settings to ".concat(chalk_1.default.cyan(path_1.default.basename(config)), ":"));
|
|
193
|
+
// eslint-disable-next-line no-console
|
|
194
|
+
console.log("\n\n".concat((0, templates_1.getNuxtModuleFallbackTemplate)(options, shouldTopLevelImport), "\n\n"));
|
|
195
|
+
return [3 /*break*/, 5];
|
|
196
|
+
case 5: return [2 /*return*/];
|
|
176
197
|
}
|
|
177
198
|
});
|
|
178
199
|
});
|
|
@@ -221,7 +242,7 @@ function createConfigFiles(dsn) {
|
|
|
221
242
|
if (tsConfigExists) {
|
|
222
243
|
existingConfigs.push(tsConfig);
|
|
223
244
|
}
|
|
224
|
-
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(
|
|
245
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(clack.confirm({
|
|
225
246
|
message: "Found existing Sentry ".concat(configVariant, " config (").concat(existingConfigs.join(', '), "). Overwrite ").concat(existingConfigs.length > 1 ? 'them' : 'it', "?"),
|
|
226
247
|
}))];
|
|
227
248
|
case 1:
|
|
@@ -231,11 +252,11 @@ function createConfigFiles(dsn) {
|
|
|
231
252
|
if (overwriteExistingConfigs) {
|
|
232
253
|
if (jsConfigExists) {
|
|
233
254
|
fs_1.default.unlinkSync(path_1.default.join(process.cwd(), jsConfig));
|
|
234
|
-
|
|
255
|
+
clack.log.warn("Removed existing ".concat(chalk_1.default.cyan(jsConfig), "."));
|
|
235
256
|
}
|
|
236
257
|
if (tsConfigExists) {
|
|
237
258
|
fs_1.default.unlinkSync(path_1.default.join(process.cwd(), tsConfig));
|
|
238
|
-
|
|
259
|
+
clack.log.warn("Removed existing ".concat(chalk_1.default.cyan(tsConfig), "."));
|
|
239
260
|
}
|
|
240
261
|
}
|
|
241
262
|
_a.label = 2;
|
|
@@ -244,11 +265,11 @@ function createConfigFiles(dsn) {
|
|
|
244
265
|
return [4 /*yield*/, fs_1.default.promises.writeFile(path_1.default.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig), (0, templates_1.getSentryConfigContents)(dsn, configVariant, selectedFeatures), { encoding: 'utf8', flag: 'w' })];
|
|
245
266
|
case 3:
|
|
246
267
|
_a.sent();
|
|
247
|
-
|
|
268
|
+
clack.log.success("Created new ".concat(chalk_1.default.cyan(typeScriptDetected ? tsConfig : jsConfig), "."));
|
|
248
269
|
Sentry.setTag("created-".concat(configVariant, "-config"), true);
|
|
249
270
|
return [3 /*break*/, 5];
|
|
250
271
|
case 4:
|
|
251
|
-
|
|
272
|
+
clack.log.info("Okay, here are the changes your ".concat(chalk_1.default.cyan(typeScriptDetected ? tsConfig : jsConfig), " should contain:"));
|
|
252
273
|
// eslint-disable-next-line no-console
|
|
253
274
|
console.log('\n\n ' +
|
|
254
275
|
(0, templates_1.getConfigBody)(dsn, configVariant, selectedFeatures) +
|
|
@@ -282,17 +303,14 @@ function createConfigFiles(dsn) {
|
|
|
282
303
|
});
|
|
283
304
|
}
|
|
284
305
|
exports.createConfigFiles = createConfigFiles;
|
|
285
|
-
function addNuxtOverrides(packageManager, nuxtMinVer) {
|
|
306
|
+
function addNuxtOverrides(packageJson, packageManager, nuxtMinVer) {
|
|
286
307
|
return __awaiter(this, void 0, void 0, function () {
|
|
287
|
-
var overrides, _i, overrides_1, _a, pkgName, pkgVersion, shouldAddOverride;
|
|
308
|
+
var isPNPM, overrides, _i, overrides_1, _a, pkgName, pkgVersion, shouldAddOverride, iitmAlreadyInstalled, shouldInstallIitm;
|
|
288
309
|
return __generator(this, function (_b) {
|
|
289
310
|
switch (_b.label) {
|
|
290
311
|
case 0:
|
|
312
|
+
isPNPM = package_manager_1.PNPM.detect();
|
|
291
313
|
overrides = __spreadArray([
|
|
292
|
-
{
|
|
293
|
-
pkgName: 'nitropack',
|
|
294
|
-
pkgVersion: '~2.9.7',
|
|
295
|
-
},
|
|
296
314
|
{
|
|
297
315
|
pkgName: '@vercel/nft',
|
|
298
316
|
pkgVersion: '^0.27.4',
|
|
@@ -300,7 +318,9 @@ function addNuxtOverrides(packageManager, nuxtMinVer) {
|
|
|
300
318
|
], (nuxtMinVer && (0, semver_1.lt)(nuxtMinVer, '3.14.0')
|
|
301
319
|
? [{ pkgName: 'ofetch', pkgVersion: '^1.4.0' }]
|
|
302
320
|
: []), true);
|
|
303
|
-
|
|
321
|
+
clack.log.warn("To ensure Sentry can properly instrument your code it needs to add version overrides for some Nuxt dependencies".concat(isPNPM ? " and install ".concat(chalk_1.default.cyan('import-in-the-middle'), ".") : '.', "\n\nFor more info see: ").concat(chalk_1.default.underline('https://github.com/getsentry/sentry-javascript/issues/14514')).concat(isPNPM
|
|
322
|
+
? "\n\nand ".concat(chalk_1.default.underline('https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle'))
|
|
323
|
+
: ''));
|
|
304
324
|
_i = 0, overrides_1 = overrides;
|
|
305
325
|
_b.label = 1;
|
|
306
326
|
case 1:
|
|
@@ -317,10 +337,53 @@ function addNuxtOverrides(packageManager, nuxtMinVer) {
|
|
|
317
337
|
case 4:
|
|
318
338
|
_i++;
|
|
319
339
|
return [3 /*break*/, 1];
|
|
320
|
-
case 5:
|
|
340
|
+
case 5:
|
|
341
|
+
if (!package_manager_1.PNPM.detect()) return [3 /*break*/, 8];
|
|
342
|
+
iitmAlreadyInstalled = (0, package_json_1.hasPackageInstalled)('import-in-the-middle', packageJson);
|
|
343
|
+
Sentry.setTag('iitm-already-installed', iitmAlreadyInstalled);
|
|
344
|
+
return [4 /*yield*/, (0, clack_utils_1.askShouldInstallPackage)('import-in-the-middle')];
|
|
345
|
+
case 6:
|
|
346
|
+
shouldInstallIitm = _b.sent();
|
|
347
|
+
if (!shouldInstallIitm) return [3 /*break*/, 8];
|
|
348
|
+
return [4 /*yield*/, (0, clack_utils_1.installPackage)({
|
|
349
|
+
packageName: 'import-in-the-middle',
|
|
350
|
+
alreadyInstalled: iitmAlreadyInstalled,
|
|
351
|
+
packageManager: packageManager,
|
|
352
|
+
})];
|
|
353
|
+
case 7:
|
|
354
|
+
_b.sent();
|
|
355
|
+
_b.label = 8;
|
|
356
|
+
case 8: return [2 /*return*/];
|
|
321
357
|
}
|
|
322
358
|
});
|
|
323
359
|
});
|
|
324
360
|
}
|
|
325
361
|
exports.addNuxtOverrides = addNuxtOverrides;
|
|
362
|
+
function confirmReadImportDocs(deploymentPlatform) {
|
|
363
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
364
|
+
var canImportSentryServerConfigFile, docsUrl, shouldOpenDocs;
|
|
365
|
+
return __generator(this, function (_a) {
|
|
366
|
+
switch (_a.label) {
|
|
367
|
+
case 0:
|
|
368
|
+
canImportSentryServerConfigFile = deploymentPlatform !== 'vercel' && deploymentPlatform !== 'netlify';
|
|
369
|
+
if (!canImportSentryServerConfigFile) {
|
|
370
|
+
// Nothing to do, users have been set up with automatic top-level-import instead
|
|
371
|
+
return [2 /*return*/];
|
|
372
|
+
}
|
|
373
|
+
docsUrl = 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import/#initializing-sentry-with---import';
|
|
374
|
+
clack.log.info("After building your Nuxt app, you need to ".concat(chalk_1.default.bold('--import'), " the Sentry server config file when running your app.\n\nFor more info, see:\n\n").concat(chalk_1.default.underline(docsUrl)));
|
|
375
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(clack.confirm({ message: 'Do you want to open the docs?' }))];
|
|
376
|
+
case 1:
|
|
377
|
+
shouldOpenDocs = _a.sent();
|
|
378
|
+
if (shouldOpenDocs) {
|
|
379
|
+
(0, clack_utils_1.opn)(docsUrl, { wait: false }).catch(function () {
|
|
380
|
+
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
return [2 /*return*/];
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
}
|
|
388
|
+
exports.confirmReadImportDocs = confirmReadImportDocs;
|
|
326
389
|
//# sourceMappingURL=sdk-setup.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/nuxt/sdk-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,2DAAmC;AACnC,mDAAuC;AACvC,gDAA0B;AAC1B,0CAAoB;AACpB,kFAAkF;AAClF,qCAAiE;AACjE,kFAAkF;AAClF,4CAAiD;AACjD,8CAAwB;AACxB,yCAKqB;AACrB,oDAM8B;AAC9B,0CAAyC;AACzC,iCAAoC;AAGpC,IAA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AAE,EAAC,UAAU,EAAE,QAAQ,CAAC;wBACxC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC;wBAC/C,CAAC,CAAC,EAAE,CAAC,OACR,CAAC;oBAEF,iBAAK,CAAC,GAAG,CAAC,IAAI,CACZ,iJAA0I,eAAK,CAAC,IAAI,CAClJ,6DAA6D,CAC9D,CAAE,CACJ,CAAC;0BAE6C,EAAT,uBAAS;;;yBAAT,CAAA,uBAAS,CAAA;oBAApC,oBAAuB,EAArB,OAAO,aAAA,EAAE,UAAU,gBAAA;oBACJ,qBAAM,IAAA,yCAA2B,EACzD,OAAO,EACP,UAAU,CACX,EAAA;;oBAHK,iBAAiB,GAAG,SAGzB;yBAEG,iBAAiB,EAAjB,wBAAiB;oBACnB,qBAAM,cAAc,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,CAAC,EAAA;;oBAArD,SAAqD,CAAC;;;oBAPpB,IAAS,CAAA;;;;;;CAUhD;AAlCD,4CAkCC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\nimport fs from 'fs';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile, generateCode, MagicastError } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { addNuxtModule } from 'magicast/helpers';\nimport path from 'path';\nimport {\n getConfigBody,\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from './templates';\nimport {\n abort,\n abortIfCancelled,\n askShouldAddPackageOverride,\n featureSelectionPrompt,\n isUsingTypeScript,\n} from '../utils/clack-utils';\nimport { traceStep } from '../telemetry';\nimport { lt, SemVer } from 'semver';\nimport { PackageManager } from '../utils/package-manager';\n\nconst possibleNuxtConfig = [\n 'nuxt.config.js',\n 'nuxt.config.mjs',\n 'nuxt.config.cjs',\n 'nuxt.config.ts',\n 'nuxt.config.mts',\n 'nuxt.config.cts',\n];\n\nexport async function getNuxtConfig(): Promise<string> {\n let configFile = possibleNuxtConfig.find((fileName) =>\n fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!configFile) {\n clack.log.info('No Nuxt config file found, creating a new one.');\n Sentry.setTag('nuxt-config-strategy', 'create');\n // nuxt recommends its config to be .ts by default\n configFile = 'nuxt.config.ts';\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFile),\n getDefaultNuxtConfig(),\n { encoding: 'utf-8', flag: 'w' },\n );\n\n clack.log.success(`Created ${chalk.cyan('nuxt.config.ts')}.`);\n }\n\n return path.join(process.cwd(), configFile);\n}\n\nexport async function addSDKModule(\n config: string,\n options: { org: string; project: string; url: string; selfHosted: boolean },\n): Promise<void> {\n try {\n const mod = await loadFile(config);\n\n addNuxtModule(mod, '@sentry/nuxt/module', 'sentry', {\n sourceMapsUploadOptions: {\n org: options.org,\n project: options.project,\n ...(options.selfHosted && { url: options.url }),\n },\n });\n addNuxtModule(mod, '@sentry/nuxt/module', 'sourcemap', {\n client: 'hidden',\n });\n\n const { code } = generateCode(mod);\n\n await fs.promises.writeFile(config, code, { encoding: 'utf-8', flag: 'w' });\n\n clack.log.success(\n `Added Sentry Nuxt Module to ${chalk.cyan(path.basename(config))}.`,\n );\n } catch (e: unknown) {\n // Cases where users spread options are not covered by magicast,\n // so we fall back to showing how to configure the nuxt config\n // manually.\n if (e instanceof MagicastError) {\n clack.log.warn(\n `Automatic configuration of ${chalk.cyan(\n path.basename(config),\n )} failed, please add the following settings:`,\n );\n // eslint-disable-next-line no-console\n console.log(`\\n\\n${getNuxtModuleFallbackTemplate(options)}\\n\\n`);\n } else {\n clack.log.error(\n 'Error while adding the Sentry Nuxt Module to the Nuxt config.',\n );\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException('Error while setting up the Nuxt SDK');\n await abort('Exiting Wizard');\n }\n }\n}\n\nexport async function createConfigFiles(dsn: string) {\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryConfigContents(dsn, configVariant, selectedFeatures),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created new ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n } else {\n clack.log.info(\n `Okay, here are the changes your ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )} should contain:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n '\\n\\n ' +\n getConfigBody(dsn, configVariant, selectedFeatures) +\n '\\n\\n',\n );\n }\n });\n }\n}\n\nexport async function addNuxtOverrides(\n packageManager: PackageManager,\n nuxtMinVer: SemVer | null,\n) {\n const overrides = [\n {\n pkgName: 'nitropack',\n pkgVersion: '~2.9.7',\n },\n {\n pkgName: '@vercel/nft',\n pkgVersion: '^0.27.4',\n },\n ...(nuxtMinVer && lt(nuxtMinVer, '3.14.0')\n ? [{ pkgName: 'ofetch', pkgVersion: '^1.4.0' }]\n : []),\n ];\n\n clack.log.warn(\n `To ensure Sentry can properly instrument your code it needs to add version overrides for some Nuxt dependencies.\\n\\nFor more info see: ${chalk.cyan(\n 'https://github.com/getsentry/sentry-javascript/issues/14514',\n )}`,\n );\n\n for (const { pkgName, pkgVersion } of overrides) {\n const shouldAddOverride = await askShouldAddPackageOverride(\n pkgName,\n pkgVersion,\n );\n\n if (shouldAddOverride) {\n await packageManager.addOverride(pkgName, pkgVersion);\n }\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"sdk-setup.js","sourceRoot":"","sources":["../../../src/nuxt/sdk-setup.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+EAA+E;AAC/E,oDAAwC;AACxC,mDAAuC;AACvC,gDAA0B;AAC1B,0CAAoB;AACpB,kFAAkF;AAClF,qCAAkD;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GAAG,CAAC,IAAI,CACZ,oDAA6C,eAAK,CAAC,IAAI,CACrD,UAAU,CACX,6FAAmF,eAAK,CAAC,SAAS,CACjG,OAAO,CACR,CAAE,CACJ,CAAC;oBAEqB,qBAAM,IAAA,8BAAgB,EAC3C,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC,CAC5D,EAAA;;oBAFK,cAAc,GAAG,SAEtB;oBAED,IAAI,cAAc,EAAE;wBAClB,IAAA,iBAAG,EAAC,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC;4BAClC,iGAAiG;wBACnG,CAAC,CAAC,CAAC;qBACJ;;;;;CACF;AA/BD,sDA+BC","sourcesContent":["// @ts-expect-error - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport * as Sentry from '@sentry/node';\nimport chalk from 'chalk';\nimport fs from 'fs';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile, generateCode } from 'magicast';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { addNuxtModule } from 'magicast/helpers';\nimport path from 'path';\nimport {\n getConfigBody,\n getDefaultNuxtConfig,\n getNuxtModuleFallbackTemplate,\n getSentryConfigContents,\n} from './templates';\nimport {\n abortIfCancelled,\n askShouldAddPackageOverride,\n askShouldInstallPackage,\n featureSelectionPrompt,\n installPackage,\n isUsingTypeScript,\n opn,\n} from '../utils/clack-utils';\nimport { traceStep } from '../telemetry';\nimport { lt, SemVer } from 'semver';\nimport { PackageManager, PNPM } from '../utils/package-manager';\nimport { hasPackageInstalled, PackageDotJson } from '../utils/package-json';\nimport { deploymentPlatforms, DeploymentPlatform } from './types';\n\nconst possibleNuxtConfig = [\n 'nuxt.config.js',\n 'nuxt.config.mjs',\n 'nuxt.config.cjs',\n 'nuxt.config.ts',\n 'nuxt.config.mts',\n 'nuxt.config.cts',\n];\n\nexport async function getNuxtConfig(): Promise<string> {\n let configFile = possibleNuxtConfig.find((fileName) =>\n fs.existsSync(path.join(process.cwd(), fileName)),\n );\n\n if (!configFile) {\n clack.log.info('No Nuxt config file found, creating a new one.');\n Sentry.setTag('nuxt-config-strategy', 'create');\n // nuxt recommends its config to be .ts by default\n configFile = 'nuxt.config.ts';\n\n await fs.promises.writeFile(\n path.join(process.cwd(), configFile),\n getDefaultNuxtConfig(),\n { encoding: 'utf-8', flag: 'w' },\n );\n\n clack.log.success(`Created ${chalk.cyan('nuxt.config.ts')}.`);\n }\n\n return path.join(process.cwd(), configFile);\n}\n\nexport async function askDeploymentPlatform(): Promise<\n DeploymentPlatform | symbol\n> {\n return await abortIfCancelled(\n clack.select({\n message: 'Please select your deployment platform.',\n options: deploymentPlatforms.map((platform) => ({\n value: platform,\n label: `${platform.charAt(0).toUpperCase()}${platform.slice(1)}`,\n })),\n }),\n );\n}\n\nexport async function addSDKModule(\n config: string,\n options: { org: string; project: string; url: string; selfHosted: boolean },\n deploymentPlatform: DeploymentPlatform | symbol,\n): Promise<void> {\n const shouldTopLevelImport =\n deploymentPlatform === 'vercel' || deploymentPlatform === 'netlify';\n\n if (shouldTopLevelImport) {\n clack.log.warn(\n `Sentry needs to be initialized before the application starts. ${chalk.cyan(\n `${deploymentPlatform\n .charAt(0)\n .toUpperCase()}${deploymentPlatform.slice(1)}`,\n )} does not support this yet.\\n\\nWe will inject the Sentry server-side config at the top of your Nuxt server entry file instead.\\n\\nThis comes with some restrictions, for more info see:\\n\\n${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/top-level-import/',\n )} `,\n );\n }\n\n try {\n const mod = await loadFile(config);\n\n addNuxtModule(mod, '@sentry/nuxt/module', 'sentry', {\n sourceMapsUploadOptions: {\n org: options.org,\n project: options.project,\n ...(options.selfHosted && { url: options.url }),\n },\n ...(shouldTopLevelImport && {\n autoInjectServerSentry: 'top-level-import',\n }),\n });\n addNuxtModule(mod, '@sentry/nuxt/module', 'sourcemap', {\n client: 'hidden',\n });\n\n const { code } = generateCode(mod);\n\n await fs.promises.writeFile(config, code, { encoding: 'utf-8', flag: 'w' });\n\n clack.log.success(\n `Added Sentry Nuxt Module to ${chalk.cyan(path.basename(config))}.`,\n );\n } catch (e: unknown) {\n clack.log.error(\n 'Error while adding the Sentry Nuxt Module to the Nuxt config.',\n );\n clack.log.info(\n chalk.dim(\n typeof e === 'object' && e != null && 'toString' in e\n ? e.toString()\n : typeof e === 'string'\n ? e\n : 'Unknown error',\n ),\n );\n Sentry.captureException(\n 'Error while setting up the Nuxt Module in nuxt config',\n );\n\n clack.log.warn(\n `Please add the following settings to ${chalk.cyan(\n path.basename(config),\n )}:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n `\\n\\n${getNuxtModuleFallbackTemplate(options, shouldTopLevelImport)}\\n\\n`,\n );\n }\n}\n\nexport async function createConfigFiles(dsn: string) {\n const selectedFeatures = await featureSelectionPrompt([\n {\n id: 'performance',\n prompt: `Do you want to enable ${chalk.bold(\n 'Tracing',\n )} to track the performance of your application?`,\n enabledHint: 'recommended',\n },\n {\n id: 'replay',\n prompt: `Do you want to enable ${chalk.bold(\n 'Sentry Session Replay',\n )} to get a video-like reproduction of errors during a user session?`,\n enabledHint: 'recommended, but increases bundle size',\n },\n ] as const);\n\n const typeScriptDetected = isUsingTypeScript();\n\n const configVariants = ['server', 'client'] as const;\n\n for (const configVariant of configVariants) {\n await traceStep(`create-sentry-${configVariant}-config`, async () => {\n const jsConfig = `sentry.${configVariant}.config.js`;\n const tsConfig = `sentry.${configVariant}.config.ts`;\n\n const jsConfigExists = fs.existsSync(path.join(process.cwd(), jsConfig));\n const tsConfigExists = fs.existsSync(path.join(process.cwd(), tsConfig));\n\n let shouldWriteFile = true;\n\n if (jsConfigExists || tsConfigExists) {\n const existingConfigs = [];\n\n if (jsConfigExists) {\n existingConfigs.push(jsConfig);\n }\n\n if (tsConfigExists) {\n existingConfigs.push(tsConfig);\n }\n\n const overwriteExistingConfigs = await abortIfCancelled(\n clack.confirm({\n message: `Found existing Sentry ${configVariant} config (${existingConfigs.join(\n ', ',\n )}). Overwrite ${existingConfigs.length > 1 ? 'them' : 'it'}?`,\n }),\n );\n Sentry.setTag(\n `overwrite-${configVariant}-config`,\n overwriteExistingConfigs,\n );\n\n shouldWriteFile = overwriteExistingConfigs;\n\n if (overwriteExistingConfigs) {\n if (jsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), jsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(jsConfig)}.`);\n }\n if (tsConfigExists) {\n fs.unlinkSync(path.join(process.cwd(), tsConfig));\n clack.log.warn(`Removed existing ${chalk.cyan(tsConfig)}.`);\n }\n }\n }\n\n if (shouldWriteFile) {\n await fs.promises.writeFile(\n path.join(process.cwd(), typeScriptDetected ? tsConfig : jsConfig),\n getSentryConfigContents(dsn, configVariant, selectedFeatures),\n { encoding: 'utf8', flag: 'w' },\n );\n clack.log.success(\n `Created new ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )}.`,\n );\n Sentry.setTag(`created-${configVariant}-config`, true);\n } else {\n clack.log.info(\n `Okay, here are the changes your ${chalk.cyan(\n typeScriptDetected ? tsConfig : jsConfig,\n )} should contain:`,\n );\n // eslint-disable-next-line no-console\n console.log(\n '\\n\\n ' +\n getConfigBody(dsn, configVariant, selectedFeatures) +\n '\\n\\n',\n );\n }\n });\n }\n}\n\nexport async function addNuxtOverrides(\n packageJson: PackageDotJson,\n packageManager: PackageManager,\n nuxtMinVer: SemVer | null,\n) {\n const isPNPM = PNPM.detect();\n\n const overrides = [\n {\n pkgName: '@vercel/nft',\n pkgVersion: '^0.27.4',\n },\n ...(nuxtMinVer && lt(nuxtMinVer, '3.14.0')\n ? [{ pkgName: 'ofetch', pkgVersion: '^1.4.0' }]\n : []),\n ];\n\n clack.log.warn(\n `To ensure Sentry can properly instrument your code it needs to add version overrides for some Nuxt dependencies${\n isPNPM ? ` and install ${chalk.cyan('import-in-the-middle')}.` : '.'\n }\\n\\nFor more info see: ${chalk.underline(\n 'https://github.com/getsentry/sentry-javascript/issues/14514',\n )}${\n isPNPM\n ? `\\n\\nand ${chalk.underline(\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle',\n )}`\n : ''\n }`,\n );\n\n for (const { pkgName, pkgVersion } of overrides) {\n const shouldAddOverride = await askShouldAddPackageOverride(\n pkgName,\n pkgVersion,\n );\n\n if (shouldAddOverride) {\n await packageManager.addOverride(pkgName, pkgVersion);\n }\n }\n\n if (PNPM.detect()) {\n // For pnpm, we want to install iitm\n // See: https://docs.sentry.io/platforms/javascript/guides/nuxt/troubleshooting/#pnpm-dev-cannot-find-package-import-in-the-middle\n const iitmAlreadyInstalled = hasPackageInstalled(\n 'import-in-the-middle',\n packageJson,\n );\n Sentry.setTag('iitm-already-installed', iitmAlreadyInstalled);\n\n const shouldInstallIitm = await askShouldInstallPackage(\n 'import-in-the-middle',\n );\n\n if (shouldInstallIitm) {\n await installPackage({\n packageName: 'import-in-the-middle',\n alreadyInstalled: iitmAlreadyInstalled,\n packageManager,\n });\n }\n }\n}\n\nexport async function confirmReadImportDocs(\n deploymentPlatform: DeploymentPlatform | symbol,\n) {\n const canImportSentryServerConfigFile =\n deploymentPlatform !== 'vercel' && deploymentPlatform !== 'netlify';\n\n if (!canImportSentryServerConfigFile) {\n // Nothing to do, users have been set up with automatic top-level-import instead\n return;\n }\n\n const docsUrl =\n 'https://docs.sentry.io/platforms/javascript/guides/nuxt/install/cli-import/#initializing-sentry-with---import';\n\n clack.log.info(\n `After building your Nuxt app, you need to ${chalk.bold(\n '--import',\n )} the Sentry server config file when running your app.\\n\\nFor more info, see:\\n\\n${chalk.underline(\n docsUrl,\n )}`,\n );\n\n const shouldOpenDocs = await abortIfCancelled(\n clack.confirm({ message: 'Do you want to open the docs?' }),\n );\n\n if (shouldOpenDocs) {\n opn(docsUrl, { wait: false }).catch(() => {\n // opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here\n });\n }\n}\n"]}
|
|
@@ -8,7 +8,7 @@ export declare function getNuxtModuleFallbackTemplate(options: {
|
|
|
8
8
|
project: string;
|
|
9
9
|
url: string;
|
|
10
10
|
selfHosted: boolean;
|
|
11
|
-
}): string;
|
|
11
|
+
}, shouldTopLevelImport: boolean): string;
|
|
12
12
|
export declare function getSentryConfigContents(dsn: string, config: 'client' | 'server', selectedFeatures: SelectedSentryFeatures): string;
|
|
13
13
|
export declare function getConfigBody(dsn: string, variant: 'client' | 'server', selectedFeatures: SelectedSentryFeatures): string;
|
|
14
14
|
export declare function getIndexRouteTemplate(): string;
|
|
@@ -6,8 +6,10 @@ function getDefaultNuxtConfig() {
|
|
|
6
6
|
return "// https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n})\n";
|
|
7
7
|
}
|
|
8
8
|
exports.getDefaultNuxtConfig = getDefaultNuxtConfig;
|
|
9
|
-
function getNuxtModuleFallbackTemplate(options) {
|
|
10
|
-
return " modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"".concat(options.org, "\",\n project: \"").concat(options.project, "\",").concat(options.selfHosted ? "\n url: \"".concat(options.url, "\",") : '', "\n }
|
|
9
|
+
function getNuxtModuleFallbackTemplate(options, shouldTopLevelImport) {
|
|
10
|
+
return " modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"".concat(options.org, "\",\n project: \"").concat(options.project, "\",").concat(options.selfHosted ? "\n url: \"".concat(options.url, "\",") : '', "\n },").concat(shouldTopLevelImport
|
|
11
|
+
? "\n autoInjectServerSentry: \"top-level-import\","
|
|
12
|
+
: '', "\n },\n sourcemap: { client: \"hidden\" },");
|
|
11
13
|
}
|
|
12
14
|
exports.getNuxtModuleFallbackTemplate = getNuxtModuleFallbackTemplate;
|
|
13
15
|
function getSentryConfigContents(dsn, config, selectedFeatures) {
|
|
@@ -74,7 +76,7 @@ function getSentryExamplePageTemplate(options) {
|
|
|
74
76
|
}
|
|
75
77
|
exports.getSentryExamplePageTemplate = getSentryExamplePageTemplate;
|
|
76
78
|
function getSentryExampleApiTemplate() {
|
|
77
|
-
return "// This is just a very simple API route that throws an example error.\n// Feel free to delete this file.\nimport { defineEventHandler } from '#imports';\n\nexport default defineEventHandler(
|
|
79
|
+
return "// This is just a very simple API route that throws an example error.\n// Feel free to delete this file.\nimport { defineEventHandler } from '#imports';\n\nexport default defineEventHandler(() => {\n throw new Error(\"Sentry Example API Route Error\");\n});\n";
|
|
78
80
|
}
|
|
79
81
|
exports.getSentryExampleApiTemplate = getSentryExampleApiTemplate;
|
|
80
82
|
function getSentryErrorButtonTemplate() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nuxt/templates.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;AAOjD,SAAgB,oBAAoB;IAClC,OAAO,oKAKR,CAAC;AACF,CAAC;AAPD,oDAOC;AAED,SAAgB,6BAA6B,CAAC,OAK7C;IACC,OAAO,2GAGK,OAAO,CAAC,GAAG,mCACP,OAAO,CAAC,OAAO,gBAC7B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAiB,OAAO,CAAC,GAAG,QAAI,CAAC,CAAC,CAAC,EAAE,yDAI3B,CAAC;AACpC,CAAC;AAhBD,sEAgBC;AAED,SAAgB,uBAAuB,CACrC,GAAW,EACX,MAA2B,EAC3B,gBAAwC;IAExC,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,OAAO,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;KAC7D;IAED,OAAO,6BAA6B,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;AAC9D,CAAC;AAVD,0DAUC;AAED,IAAM,iBAAiB,GAAiD;IACtE,WAAW,EAAE;QACX,8EAA8E;QAC9E,wBAAwB;QACxB,0BAA0B;KAC3B,CAAC,I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APD,sDAOC;AAED,SAAgB,4BAA4B,CAAC,OAI5C;IACS,IAAA,GAAG,GAAqB,OAAO,IAA5B,EAAE,GAAG,GAAgB,OAAO,IAAvB,EAAE,SAAS,GAAK,OAAO,UAAZ,CAAa;IACxC,IAAM,cAAc,GAAG,IAAA,uBAAiB,EAAC,EAAE,GAAG,KAAA,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;IAE3E,OAAO,k1EA4CQ,cAAc,m7BA8C9B,CAAC;AACF,CAAC;AAnGD,oEAmGC;AAED,SAAgB,2BAA2B;IACzC,OAAO,yQAOR,CAAC;AACF,CAAC;AATD,kEASC;AAED,SAAgB,4BAA4B;IAC1C,OAAO,y8BA8CR,CAAC;AACF,CAAC;AAhDD,oEAgDC","sourcesContent":["import { getIssueStreamUrl } from '../utils/url';\n\ntype SelectedSentryFeatures = {\n performance: boolean;\n replay: boolean;\n};\n\nexport function getDefaultNuxtConfig(): string {\n return `// https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n})\n`;\n}\n\nexport function getNuxtModuleFallbackTemplate(options: {\n org: string;\n project: string;\n url: string;\n selfHosted: boolean;\n}): string {\n return ` modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"${options.org}\",\n project: \"${options.project}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n },\n },\n sourcemap: { client: \"hidden\" },`;\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n): string {\n if (config === 'client') {\n return getSentryClientConfigContents(dsn, selectedFeatures);\n }\n\n return getSentryServerConfigContents(dsn, selectedFeatures);\n}\n\nconst featuresConfigMap: Record<keyof SelectedSentryFeatures, string> = {\n performance: [\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ].join('\\n'),\n replay: [\n ' // This sets the sample rate to be 10%. You may want this to be 100% while',\n ' // in development and sample at a lower rate in production',\n ' replaysSessionSampleRate: 0.1,',\n ' ',\n ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n ' ',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ].join('\\n'),\n};\n\nconst featuresMap: Record<\n 'client' | 'server',\n Array<keyof SelectedSentryFeatures>\n> = {\n client: ['performance', 'replay'],\n server: ['performance'],\n};\n\nexport function getConfigBody(\n dsn: string,\n variant: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n) {\n return [\n `dsn: \"${dsn}\",`,\n Object.entries(selectedFeatures)\n .map(([feature, activated]: [keyof SelectedSentryFeatures, boolean]) => {\n return featuresMap[variant].includes(feature) && activated\n ? featuresConfigMap[feature]\n : null;\n })\n .filter(Boolean)\n .join('\\n\\n'),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\nfunction getSentryClientConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n\nSentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n ${getConfigBody(dsn, 'client', selectedFeatures)}\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nfunction getSentryServerConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n \nSentry.init({\n ${getConfigBody(dsn, 'server', selectedFeatures)}\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nexport function getIndexRouteTemplate(): string {\n return `<!--\nThis is just to verify the sentry-example-page.\nFeel free to delete this file.\n-->\n\n<template></template>`;\n}\n\nexport function getSentryExamplePageTemplate(options: {\n url: string;\n org: string;\n projectId: string;\n}): string {\n const { url, org, projectId } = options;\n const issuesPageLink = getIssueStreamUrl({ url, orgSlug: org, projectId });\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n import { useFetch} from '#imports'\n \n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const { error } = await useFetch('/api/sentry-example-api');\n if (error.value) {\n throw new Error('Sentry Example Frontend Error');\n }\n }\n )\n }\n</script>\n\n<template>\n <title>Sentry Onboarding</title>\n <div>\n <main>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\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 <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button type=\"button\" @click=\"getSentryData\"> Throw error! </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nuxt/\">\n Sentry Nuxt Documentation\n </a>\n </p>\n </main>\n</div>\n</template>\n\n<style scoped>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n svg {\n font-size: 4rem;\n margin: 14px 0;\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiTemplate() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file.\nimport { defineEventHandler } from '#imports';\n\nexport default defineEventHandler(event => {\n throw new Error(\"Sentry Example API Route Error\");\n});\n`;\n}\n\nexport function getSentryErrorButtonTemplate() {\n return `<!--\nThis is just a very simple component that throws an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n \n const throwError = () => {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n () => {\n throw new Error('Sentry Example Error');\n }\n )\n };\n</script>\n\n<template>\n <button id=\"errorBtn\" @click=\"throwError\"> Throw Error! </button>\n</template>\n\n<style scoped>\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/nuxt/templates.ts"],"names":[],"mappings":";;;AAAA,oCAAiD;AAOjD,SAAgB,oBAAoB;IAClC,OAAO,oKAKR,CAAC;AACF,CAAC;AAPD,oDAOC;AAED,SAAgB,6BAA6B,CAC3C,OAKC,EACD,oBAA6B;IAE7B,OAAO,2GAGK,OAAO,CAAC,GAAG,mCACP,OAAO,CAAC,OAAO,gBAC7B,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,yBAAiB,OAAO,CAAC,GAAG,QAAI,CAAC,CAAC,CAAC,EAAE,qBAGxD,oBAAoB;QAClB,CAAC,CAAC,qDAAmD;QACrD,CAAC,CAAC,EAAE,iDAGuB,CAAC;AACpC,CAAC;AAvBD,sEAuBC;AAED,SAAgB,uBAAuB,CACrC,GAAW,EACX,MAA2B,EAC3B,gBAAwC;IAExC,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,OAAO,6BAA6B,CAAC,GAAG,EAAE,gB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;AACF,CAAC;AAED,SAAS,6BAA6B,CACpC,GAAW,EACX,gBAAwC;IAExC,OAAO,yEAGL,aAAa,CAAC,GAAG,EAAE,QAAQ,EAAE,gBAAgB,CAAC,gJAKjD,CAAC;AACF,CAAC;AAED,SAAgB,qBAAqB;IACnC,OAAO,qHAKa,CAAC;AACvB,CAAC;AAPD,sDAOC;AAED,SAAgB,4BAA4B,CAAC,OAI5C;IACS,IAAA,GAAG,GAAqB,OAAO,IAA5B,EAAE,GAAG,GAAgB,OAAO,IAAvB,EAAE,SAAS,GAAK,OAAO,UAAZ,CAAa;IACxC,IAAM,cAAc,GAAG,IAAA,uBAAiB,EAAC,EAAE,GAAG,KAAA,EAAE,OAAO,EAAE,GAAG,EAAE,SAAS,WAAA,EAAE,CAAC,CAAC;IAE3E,OAAO,k1EA4CQ,cAAc,m7BA8C9B,CAAC;AACF,CAAC;AAnGD,oEAmGC;AAED,SAAgB,2BAA2B;IACzC,OAAO,sQAOR,CAAC;AACF,CAAC;AATD,kEASC;AAED,SAAgB,4BAA4B;IAC1C,OAAO,y8BA8CR,CAAC;AACF,CAAC;AAhDD,oEAgDC","sourcesContent":["import { getIssueStreamUrl } from '../utils/url';\n\ntype SelectedSentryFeatures = {\n performance: boolean;\n replay: boolean;\n};\n\nexport function getDefaultNuxtConfig(): string {\n return `// https://nuxt.com/docs/api/configuration/nuxt-config\nexport default defineNuxtConfig({\n compatibilityDate: '2024-04-03',\n devtools: { enabled: true }\n})\n`;\n}\n\nexport function getNuxtModuleFallbackTemplate(\n options: {\n org: string;\n project: string;\n url: string;\n selfHosted: boolean;\n },\n shouldTopLevelImport: boolean,\n): string {\n return ` modules: [\"@sentry/nuxt/module\"],\n sentry: {\n sourceMapsUploadOptions: {\n org: \"${options.org}\",\n project: \"${options.project}\",${\n options.selfHosted ? `\\n url: \"${options.url}\",` : ''\n }\n },${\n shouldTopLevelImport\n ? `\\n autoInjectServerSentry: \"top-level-import\",`\n : ''\n }\n },\n sourcemap: { client: \"hidden\" },`;\n}\n\nexport function getSentryConfigContents(\n dsn: string,\n config: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n): string {\n if (config === 'client') {\n return getSentryClientConfigContents(dsn, selectedFeatures);\n }\n\n return getSentryServerConfigContents(dsn, selectedFeatures);\n}\n\nconst featuresConfigMap: Record<keyof SelectedSentryFeatures, string> = {\n performance: [\n ' // We recommend adjusting this value in production, or using tracesSampler',\n ' // for finer control',\n ' tracesSampleRate: 1.0,',\n ].join('\\n'),\n replay: [\n ' // This sets the sample rate to be 10%. You may want this to be 100% while',\n ' // in development and sample at a lower rate in production',\n ' replaysSessionSampleRate: 0.1,',\n ' ',\n ' // If the entire session is not sampled, use the below sample rate to sample',\n ' // sessions when an error occurs.',\n ' replaysOnErrorSampleRate: 1.0,',\n ' ',\n \" // If you don't want to use Session Replay, just remove the line below:\",\n ' integrations: [Sentry.replayIntegration()],',\n ].join('\\n'),\n};\n\nconst featuresMap: Record<\n 'client' | 'server',\n Array<keyof SelectedSentryFeatures>\n> = {\n client: ['performance', 'replay'],\n server: ['performance'],\n};\n\nexport function getConfigBody(\n dsn: string,\n variant: 'client' | 'server',\n selectedFeatures: SelectedSentryFeatures,\n) {\n return [\n `dsn: \"${dsn}\",`,\n Object.entries(selectedFeatures)\n .map(([feature, activated]: [keyof SelectedSentryFeatures, boolean]) => {\n return featuresMap[variant].includes(feature) && activated\n ? featuresConfigMap[feature]\n : null;\n })\n .filter(Boolean)\n .join('\\n\\n'),\n ]\n .filter(Boolean)\n .join('\\n\\n');\n}\n\nfunction getSentryClientConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n\nSentry.init({\n // If set up, you can use your runtime config here\n // dsn: useRuntimeConfig().public.sentry.dsn,\n ${getConfigBody(dsn, 'client', selectedFeatures)}\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nfunction getSentryServerConfigContents(\n dsn: string,\n selectedFeatures: SelectedSentryFeatures,\n): string {\n return `import * as Sentry from \"@sentry/nuxt\";\n \nSentry.init({\n ${getConfigBody(dsn, 'server', selectedFeatures)}\n \n // Setting this option to true will print useful information to the console while you're setting up Sentry.\n debug: false,\n});\n`;\n}\n\nexport function getIndexRouteTemplate(): string {\n return `<!--\nThis is just to verify the sentry-example-page.\nFeel free to delete this file.\n-->\n\n<template></template>`;\n}\n\nexport function getSentryExamplePageTemplate(options: {\n url: string;\n org: string;\n projectId: string;\n}): string {\n const { url, org, projectId } = options;\n const issuesPageLink = getIssueStreamUrl({ url, orgSlug: org, projectId });\n\n return `<!--\nThis is just a very simple page with a button to throw an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n import { useFetch} from '#imports'\n \n function getSentryData() {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n async () => {\n const { error } = await useFetch('/api/sentry-example-api');\n if (error.value) {\n throw new Error('Sentry Example Frontend Error');\n }\n }\n )\n }\n</script>\n\n<template>\n <title>Sentry Onboarding</title>\n <div>\n <main>\n <svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 200 44\">\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 <p>\n Get Started with this <strong>simple Example:</strong>\n </p>\n\n <p>1. Send us a sample error:</p>\n <button type=\"button\" @click=\"getSentryData\"> Throw error! </button>\n\n <p>\n 2. Look for the error on the\n <a href=\"${issuesPageLink}\">Issues Page</a>.\n </p>\n <p style=\"margin-top: 24px;\">\n For more information, take a look at the\n <a href=\"https://docs.sentry.io/platforms/javascript/guides/nuxt/\">\n Sentry Nuxt Documentation\n </a>\n </p>\n </main>\n</div>\n</template>\n\n<style scoped>\n main {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n }\n\n svg {\n font-size: 4rem;\n margin: 14px 0;\n height: 1em;\n }\n\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n\nexport function getSentryExampleApiTemplate() {\n return `// This is just a very simple API route that throws an example error.\n// Feel free to delete this file.\nimport { defineEventHandler } from '#imports';\n\nexport default defineEventHandler(() => {\n throw new Error(\"Sentry Example API Route Error\");\n});\n`;\n}\n\nexport function getSentryErrorButtonTemplate() {\n return `<!--\nThis is just a very simple component that throws an example error.\nFeel free to delete this file.\n-->\n\n<script setup>\n import * as Sentry from '@sentry/nuxt';\n \n const throwError = () => {\n Sentry.startSpan(\n {\n name: 'Example Frontend Span',\n op: 'test'\n },\n () => {\n throw new Error('Sentry Example Error');\n }\n )\n };\n</script>\n\n<template>\n <button id=\"errorBtn\" @click=\"throwError\"> Throw Error! </button>\n</template>\n\n<style scoped>\n button {\n padding: 12px;\n cursor: pointer;\n background-color: rgb(54, 45, 89);\n border-radius: 4px;\n border: none;\n color: white;\n font-size: 1em;\n margin: 1em;\n transition: all 0.25s ease-in-out;\n }\n button:hover {\n background-color: #8c5393;\n box-shadow: 4px;\n box-shadow: 0px 0px 15px 2px rgba(140, 83, 147, 0.5);\n }\n button:active {\n background-color: #c73852;\n }\n</style>\n`;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/nuxt/types.ts"],"names":[],"mappings":";;;AAAa,QAAA,mBAAmB,GAAG;IACjC,QAAQ;IACR,SAAS;IACT,OAAO;IACP,MAAM;CACE,CAAC","sourcesContent":["export const deploymentPlatforms = [\n 'vercel',\n 'netlify',\n 'other',\n 'none',\n] as const;\n\nexport type DeploymentPlatform = (typeof deploymentPlatforms)[number];\n"]}
|
package/dist/src/nuxt/utils.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
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;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -37,14 +60,17 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
37
60
|
};
|
|
38
61
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
62
|
exports.isNuxtV4 = void 0;
|
|
63
|
+
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
64
|
+
var clack = __importStar(require("@clack/prompts"));
|
|
40
65
|
var semver_1 = require("semver");
|
|
41
66
|
// @ts-expect-error - magicast is ESM and TS complains about that. It works though
|
|
42
67
|
var magicast_1 = require("magicast");
|
|
68
|
+
var clack_utils_1 = require("../utils/clack-utils");
|
|
43
69
|
function isNuxtV4(nuxtConfig, packageVersion) {
|
|
44
70
|
return __awaiter(this, void 0, void 0, function () {
|
|
45
|
-
var minVer, mod, config;
|
|
46
|
-
return __generator(this, function (
|
|
47
|
-
switch (
|
|
71
|
+
var minVer, mod, config, _a;
|
|
72
|
+
return __generator(this, function (_b) {
|
|
73
|
+
switch (_b.label) {
|
|
48
74
|
case 0:
|
|
49
75
|
if (!packageVersion) {
|
|
50
76
|
return [2 /*return*/, false];
|
|
@@ -53,16 +79,26 @@ function isNuxtV4(nuxtConfig, packageVersion) {
|
|
|
53
79
|
if (minVer && (0, semver_1.gte)(minVer, '4.0.0')) {
|
|
54
80
|
return [2 /*return*/, true];
|
|
55
81
|
}
|
|
56
|
-
|
|
82
|
+
_b.label = 1;
|
|
57
83
|
case 1:
|
|
58
|
-
|
|
84
|
+
_b.trys.push([1, 3, , 5]);
|
|
85
|
+
return [4 /*yield*/, (0, magicast_1.loadFile)(nuxtConfig)];
|
|
86
|
+
case 2:
|
|
87
|
+
mod = _b.sent();
|
|
59
88
|
config = mod.exports.default.$type === 'function-call'
|
|
60
89
|
? mod.exports.default.$args[0]
|
|
61
90
|
: mod.exports.default;
|
|
62
91
|
if (config && config.future && config.future.compatibilityVersion === 4) {
|
|
63
92
|
return [2 /*return*/, true];
|
|
64
93
|
}
|
|
65
|
-
return [
|
|
94
|
+
return [3 /*break*/, 5];
|
|
95
|
+
case 3:
|
|
96
|
+
_a = _b.sent();
|
|
97
|
+
return [4 /*yield*/, (0, clack_utils_1.abortIfCancelled)(clack.confirm({ message: 'Are you using Nuxt version 4?' }))];
|
|
98
|
+
case 4:
|
|
99
|
+
// If we cannot parse their config, just ask.
|
|
100
|
+
return [2 /*return*/, _b.sent()];
|
|
101
|
+
case 5: return [2 /*return*/, false];
|
|
66
102
|
}
|
|
67
103
|
});
|
|
68
104
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nuxt/utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/nuxt/utils.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAyE;AACzE,oDAAwC;AACxC,iCAAyC;AACzC,kFAAkF;AAClF,qCAAoC;AACpC,oDAAwD;AAExD,SAAsB,QAAQ,CAC5B,UAAkB,EAClB,cAAkC;;;;;;oBAElC,IAAI,CAAC,cAAc,EAAE;wBACnB,sBAAO,KAAK,EAAC;qBACd;oBAEK,MAAM,GAAG,IAAA,mBAAU,EAAC,cAAc,CAAC,CAAC;oBAC1C,IAAI,MAAM,IAAI,IAAA,YAAG,EAAC,MAAM,EAAE,OAAO,CAAC,EAAE;wBAClC,sBAAO,IAAI,EAAC;qBACb;;;;oBAMa,qBAAM,IAAA,mBAAQ,EAAC,UAAU,CAAC,EAAA;;oBAAhC,GAAG,GAAG,SAA0B;oBAChC,MAAM,GACV,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,KAAK,eAAe;wBAC3C,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;wBAC9B,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC;oBAE1B,IAAI,MAAM,IAAI,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,MAAM,CAAC,oBAAoB,KAAK,CAAC,EAAE;wBACvE,sBAAO,IAAI,EAAC;qBACb;;;;oBAGM,qBAAM,IAAA,8BAAgB,EAC3B,KAAK,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,CAAC,CAC5D,EAAA;;gBAHD,6CAA6C;gBAC7C,sBAAO,SAEN,EAAC;wBAGJ,sBAAO,KAAK,EAAC;;;;CACd;AAlCD,4BAkCC","sourcesContent":["// @ts-ignore - clack is ESM and TS complains about that. It works though\nimport * as clack from '@clack/prompts';\nimport { gte, minVersion } from 'semver';\n// @ts-expect-error - magicast is ESM and TS complains about that. It works though\nimport { loadFile } from 'magicast';\nimport { abortIfCancelled } from '../utils/clack-utils';\n\nexport async function isNuxtV4(\n nuxtConfig: string,\n packageVersion: string | undefined,\n) {\n if (!packageVersion) {\n return false;\n }\n\n const minVer = minVersion(packageVersion);\n if (minVer && gte(minVer, '4.0.0')) {\n return true;\n }\n\n // At the time of writing, nuxt 4 is not on its own\n // major yet. We must read the `compatibilityVersion`\n // from the nuxt config.\n try {\n const mod = await loadFile(nuxtConfig);\n const config =\n mod.exports.default.$type === 'function-call'\n ? mod.exports.default.$args[0]\n : mod.exports.default;\n\n if (config && config.future && config.future.compatibilityVersion === 4) {\n return true;\n }\n } catch {\n // If we cannot parse their config, just ask.\n return await abortIfCancelled(\n clack.confirm({ message: 'Are you using Nuxt version 4?' }),\n );\n }\n\n return false;\n}\n"]}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import * as childProcess from 'child_process';
|
|
1
2
|
import { PackageDotJson } from './package-json';
|
|
2
3
|
import { Feature, SentryProjectData, WizardOptions } from './types';
|
|
3
4
|
import { PackageManager } from './package-manager';
|
|
5
|
+
export declare const opn: (url: string, options?: {
|
|
6
|
+
wait?: boolean;
|
|
7
|
+
}) => Promise<childProcess.ChildProcess>;
|
|
4
8
|
export declare const SENTRY_DOT_ENV_FILE = ".env.sentry-build-plugin";
|
|
5
9
|
export declare const SENTRY_CLI_RC_FILE = ".sentryclirc";
|
|
6
10
|
export declare const SENTRY_PROPERTIES_FILE = "sentry.properties";
|
|
@@ -186,5 +190,6 @@ export declare function askShouldCreateExampleComponent(): Promise<boolean>;
|
|
|
186
190
|
export declare function featureSelectionPrompt<F extends ReadonlyArray<Feature>>(features: F): Promise<{
|
|
187
191
|
[key in F[number]['id']]: boolean;
|
|
188
192
|
}>;
|
|
193
|
+
export declare function askShouldInstallPackage(pkgName: string): Promise<boolean>;
|
|
189
194
|
export declare function askShouldAddPackageOverride(pkgName: string, pkgVersion: string): Promise<boolean>;
|
|
190
195
|
export {};
|
|
@@ -62,7 +62,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
62
62
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
63
63
|
};
|
|
64
64
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
65
|
-
exports.askShouldAddPackageOverride = exports.featureSelectionPrompt = exports.askShouldCreateExampleComponent = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageManager = exports.updatePackageDotJson = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.runPrettierIfInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.getUncommittedOrUntrackedFiles = exports.isInGitRepo = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = void 0;
|
|
65
|
+
exports.askShouldAddPackageOverride = exports.askShouldInstallPackage = exports.featureSelectionPrompt = exports.askShouldCreateExampleComponent = exports.askShouldCreateExamplePage = exports.createNewConfigFile = exports.makeCodeSnippet = exports.showCopyPasteInstructions = exports.askForToolConfigPath = exports.getOrAskForProjectData = exports.isUsingTypeScript = exports.getPackageManager = exports.updatePackageDotJson = exports.getPackageDotJson = exports.ensurePackageIsInstalled = exports.runPrettierIfInstalled = exports.addDotEnvSentryBuildPluginFile = exports.addSentryCliConfig = exports.installPackage = exports.confirmContinueIfPackageVersionNotSupported = exports.askForItemSelection = exports.askToInstallSentryCLI = exports.getUncommittedOrUntrackedFiles = exports.isInGitRepo = exports.confirmContinueIfNoOrDirtyGitRepo = exports.printWelcome = exports.abortIfCancelled = exports.abort = exports.propertiesCliSetupConfig = exports.rcCliSetupConfig = exports.SENTRY_PROPERTIES_FILE = exports.SENTRY_CLI_RC_FILE = exports.SENTRY_DOT_ENV_FILE = exports.opn = void 0;
|
|
66
66
|
// @ts-ignore - clack is ESM and TS complains about that. It works though
|
|
67
67
|
var clack = __importStar(require("@clack/prompts"));
|
|
68
68
|
var axios_1 = __importDefault(require("axios"));
|
|
@@ -79,7 +79,7 @@ var telemetry_1 = require("../telemetry");
|
|
|
79
79
|
var package_manager_1 = require("./package-manager");
|
|
80
80
|
var debug_1 = require("./debug");
|
|
81
81
|
var semver_1 = require("./semver");
|
|
82
|
-
|
|
82
|
+
exports.opn = require('opn');
|
|
83
83
|
exports.SENTRY_DOT_ENV_FILE = '.env.sentry-build-plugin';
|
|
84
84
|
exports.SENTRY_CLI_RC_FILE = '.sentryclirc';
|
|
85
85
|
exports.SENTRY_PROPERTIES_FILE = 'sentry.properties';
|
|
@@ -1019,7 +1019,7 @@ function askForWizardLogin(options) {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
urlToOpen = loginUrl.toString();
|
|
1021
1021
|
clack.log.info("".concat(chalk_1.default.bold("If the browser window didn't open automatically, please open the following link to ".concat(hasSentryAccount ? 'log' : 'sign', " into Sentry:")), "\n\n").concat(chalk_1.default.cyan(urlToOpen)));
|
|
1022
|
-
opn(urlToOpen, { wait: false }).catch(function () {
|
|
1022
|
+
(0, exports.opn)(urlToOpen, { wait: false }).catch(function () {
|
|
1023
1023
|
// opn throws in environments that don't have a browser (e.g. remote shells) so we just noop here
|
|
1024
1024
|
});
|
|
1025
1025
|
loginSpinner = clack.spinner();
|
|
@@ -1372,6 +1372,18 @@ function featureSelectionPrompt(features) {
|
|
|
1372
1372
|
});
|
|
1373
1373
|
}
|
|
1374
1374
|
exports.featureSelectionPrompt = featureSelectionPrompt;
|
|
1375
|
+
function askShouldInstallPackage(pkgName) {
|
|
1376
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
1377
|
+
return __generator(this, function (_a) {
|
|
1378
|
+
return [2 /*return*/, (0, telemetry_1.traceStep)("ask-install-package", function () {
|
|
1379
|
+
return abortIfCancelled(clack.confirm({
|
|
1380
|
+
message: "Do you want to install ".concat(chalk_1.default.cyan(pkgName), "?"),
|
|
1381
|
+
}));
|
|
1382
|
+
})];
|
|
1383
|
+
});
|
|
1384
|
+
});
|
|
1385
|
+
}
|
|
1386
|
+
exports.askShouldInstallPackage = askShouldInstallPackage;
|
|
1375
1387
|
function askShouldAddPackageOverride(pkgName, pkgVersion) {
|
|
1376
1388
|
return __awaiter(this, void 0, void 0, function () {
|
|
1377
1389
|
return __generator(this, function (_a) {
|