@sentry/bundler-plugin-core 3.3.0 → 3.4.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/dist/cjs/index.js +1534 -1459
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +1552 -1478
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/build-plugin-manager.d.ts +126 -0
- package/dist/types/build-plugin-manager.d.ts.map +1 -0
- package/dist/types/debug-id-upload.d.ts +5 -24
- package/dist/types/debug-id-upload.d.ts.map +1 -1
- package/dist/types/index.d.ts +10 -29
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/logger.d.ts.map +1 -0
- package/dist/types/options-mapping.d.ts +1 -1
- package/dist/types/options-mapping.d.ts.map +1 -1
- package/dist/types/sentry/telemetry.d.ts +2 -2
- package/dist/types/sentry/telemetry.d.ts.map +1 -1
- package/dist/types/utils.d.ts +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/types/plugins/release-management.d.ts +0 -40
- package/dist/types/plugins/release-management.d.ts.map +0 -1
- package/dist/types/plugins/sourcemap-deletion.d.ts +0 -16
- package/dist/types/plugins/sourcemap-deletion.d.ts.map +0 -1
- package/dist/types/plugins/telemetry.d.ts +0 -13
- package/dist/types/plugins/telemetry.d.ts.map +0 -1
- package/dist/types/sentry/logger.d.ts.map +0 -1
- /package/dist/types/{sentry/logger.d.ts → logger.d.ts} +0 -0
package/dist/esm/index.mjs
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import SentryCli from '@sentry/cli';
|
|
2
1
|
import { transformAsync } from '@babel/core';
|
|
3
2
|
import componentNameAnnotatePlugin from '@sentry/babel-plugin-component-annotate';
|
|
3
|
+
import SentryCli from '@sentry/cli';
|
|
4
4
|
import * as fs from 'fs';
|
|
5
5
|
import fs__default from 'fs';
|
|
6
|
+
import { glob } from 'glob';
|
|
7
|
+
import MagicString from 'magic-string';
|
|
6
8
|
import * as path from 'path';
|
|
7
9
|
import path__default from 'path';
|
|
8
|
-
import MagicString from 'magic-string';
|
|
9
10
|
import { createUnplugin } from 'unplugin';
|
|
11
|
+
import * as dotenv from 'dotenv';
|
|
12
|
+
import * as os from 'os';
|
|
13
|
+
import os__default from 'os';
|
|
10
14
|
import findUp from 'find-up';
|
|
11
|
-
import os from 'os';
|
|
12
15
|
import crypto from 'crypto';
|
|
13
16
|
import childProcess from 'child_process';
|
|
14
|
-
import { glob } from 'glob';
|
|
15
|
-
import * as util from 'util';
|
|
16
|
-
import { promisify } from 'util';
|
|
17
17
|
import * as https from 'node:https';
|
|
18
18
|
import { Readable } from 'node:stream';
|
|
19
19
|
import { createGzip } from 'node:zlib';
|
|
20
|
-
import * as
|
|
20
|
+
import * as util from 'util';
|
|
21
|
+
import { promisify } from 'util';
|
|
21
22
|
|
|
22
23
|
function ownKeys(object, enumerableOnly) {
|
|
23
24
|
var keys = Object.keys(object);
|
|
@@ -409,578 +410,187 @@ function _toPropertyKey(arg) {
|
|
|
409
410
|
return typeof key === "symbol" ? key : String(key);
|
|
410
411
|
}
|
|
411
412
|
|
|
413
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
414
|
+
const objectToString = Object.prototype.toString;
|
|
415
|
+
|
|
412
416
|
/**
|
|
413
|
-
* Checks whether
|
|
417
|
+
* Checks whether given value's type is one of a few Error or Error-like
|
|
418
|
+
* {@link isError}.
|
|
414
419
|
*
|
|
415
|
-
* @param
|
|
416
|
-
* @returns
|
|
420
|
+
* @param wat A value to be checked.
|
|
421
|
+
* @returns A boolean representing the result.
|
|
417
422
|
*/
|
|
418
|
-
function
|
|
419
|
-
|
|
423
|
+
function isError(wat) {
|
|
424
|
+
switch (objectToString.call(wat)) {
|
|
425
|
+
case '[object Error]':
|
|
426
|
+
case '[object Exception]':
|
|
427
|
+
case '[object DOMException]':
|
|
428
|
+
return true;
|
|
429
|
+
default:
|
|
430
|
+
return isInstanceOf(wat, Error);
|
|
431
|
+
}
|
|
420
432
|
}
|
|
421
433
|
/**
|
|
422
|
-
*
|
|
423
|
-
*
|
|
424
|
-
*
|
|
425
|
-
*
|
|
434
|
+
* Checks whether given value is an instance of the given built-in class.
|
|
435
|
+
*
|
|
436
|
+
* @param wat The value to be checked
|
|
437
|
+
* @param className
|
|
438
|
+
* @returns A boolean representing the result.
|
|
426
439
|
*/
|
|
427
|
-
function
|
|
428
|
-
|
|
429
|
-
cwd = _ref.cwd,
|
|
430
|
-
stopAt = _ref.stopAt;
|
|
431
|
-
return lookupPackageJson(cwd !== null && cwd !== void 0 ? cwd : process.cwd(), path__default.normalize(stopAt !== null && stopAt !== void 0 ? stopAt : os.homedir()));
|
|
440
|
+
function isBuiltin(wat, className) {
|
|
441
|
+
return objectToString.call(wat) === `[object ${className}]`;
|
|
432
442
|
}
|
|
433
|
-
function parseMajorVersion(version) {
|
|
434
|
-
// if it has a `v` prefix, remove it
|
|
435
|
-
if (version.startsWith("v")) {
|
|
436
|
-
version = version.slice(1);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
// First, try simple lookup of exact, ~ and ^ versions
|
|
440
|
-
var regex = /^[\^~]?(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
441
|
-
var match = version.match(regex);
|
|
442
|
-
if (match) {
|
|
443
|
-
return parseInt(match[1], 10);
|
|
444
|
-
}
|
|
445
|
-
|
|
446
|
-
// Try to parse e.g. 1.x
|
|
447
|
-
var coerced = parseInt(version, 10);
|
|
448
|
-
if (!Number.isNaN(coerced)) {
|
|
449
|
-
return coerced;
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// Match <= and >= ranges.
|
|
453
|
-
var gteLteRegex = /^[<>]=\s*(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
454
|
-
var gteLteMatch = version.match(gteLteRegex);
|
|
455
|
-
if (gteLteMatch) {
|
|
456
|
-
return parseInt(gteLteMatch[1], 10);
|
|
457
|
-
}
|
|
458
|
-
|
|
459
|
-
// match < ranges
|
|
460
|
-
var ltRegex = /^<\s*(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
461
|
-
var ltMatch = version.match(ltRegex);
|
|
462
|
-
if (ltMatch) {
|
|
463
|
-
// Two scenarios:
|
|
464
|
-
// a) < 2.0.0 --> return 1
|
|
465
|
-
// b) < 2.1.0 --> return 2
|
|
466
443
|
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
444
|
+
/**
|
|
445
|
+
* Checks whether given value's type is ErrorEvent
|
|
446
|
+
* {@link isErrorEvent}.
|
|
447
|
+
*
|
|
448
|
+
* @param wat A value to be checked.
|
|
449
|
+
* @returns A boolean representing the result.
|
|
450
|
+
*/
|
|
451
|
+
function isErrorEvent$1(wat) {
|
|
452
|
+
return isBuiltin(wat, 'ErrorEvent');
|
|
453
|
+
}
|
|
477
454
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
return undefined;
|
|
455
|
+
/**
|
|
456
|
+
* Checks whether given value's type is a string
|
|
457
|
+
* {@link isString}.
|
|
458
|
+
*
|
|
459
|
+
* @param wat A value to be checked.
|
|
460
|
+
* @returns A boolean representing the result.
|
|
461
|
+
*/
|
|
462
|
+
function isString(wat) {
|
|
463
|
+
return isBuiltin(wat, 'String');
|
|
488
464
|
}
|
|
489
465
|
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
return depsVersions;
|
|
505
|
-
}, {});
|
|
506
|
-
return {
|
|
507
|
-
deps: deps,
|
|
508
|
-
depsVersions: depsVersions
|
|
509
|
-
};
|
|
466
|
+
/**
|
|
467
|
+
* Checks whether given string is parameterized
|
|
468
|
+
* {@link isParameterizedString}.
|
|
469
|
+
*
|
|
470
|
+
* @param wat A value to be checked.
|
|
471
|
+
* @returns A boolean representing the result.
|
|
472
|
+
*/
|
|
473
|
+
function isParameterizedString(wat) {
|
|
474
|
+
return (
|
|
475
|
+
typeof wat === 'object' &&
|
|
476
|
+
wat !== null &&
|
|
477
|
+
'__sentry_template_string__' in wat &&
|
|
478
|
+
'__sentry_template_values__' in wat
|
|
479
|
+
);
|
|
510
480
|
}
|
|
511
|
-
function lookupPackageJson(cwd, stopAt) {
|
|
512
|
-
var jsonPath = findUp.sync(function (dirName) {
|
|
513
|
-
// Stop if we reach this dir
|
|
514
|
-
if (path__default.normalize(dirName) === stopAt) {
|
|
515
|
-
return findUp.stop;
|
|
516
|
-
}
|
|
517
|
-
return findUp.sync.exists(dirName + "/package.json") ? "package.json" : undefined;
|
|
518
|
-
}, {
|
|
519
|
-
cwd: cwd
|
|
520
|
-
});
|
|
521
|
-
if (!jsonPath) {
|
|
522
|
-
return undefined;
|
|
523
|
-
}
|
|
524
|
-
try {
|
|
525
|
-
var jsonStr = fs__default.readFileSync(jsonPath, "utf8");
|
|
526
|
-
var json = JSON.parse(jsonStr);
|
|
527
481
|
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
482
|
+
/**
|
|
483
|
+
* Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)
|
|
484
|
+
* {@link isPrimitive}.
|
|
485
|
+
*
|
|
486
|
+
* @param wat A value to be checked.
|
|
487
|
+
* @returns A boolean representing the result.
|
|
488
|
+
*/
|
|
489
|
+
function isPrimitive(wat) {
|
|
490
|
+
return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');
|
|
491
|
+
}
|
|
536
492
|
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
493
|
+
/**
|
|
494
|
+
* Checks whether given value's type is an object literal, or a class instance.
|
|
495
|
+
* {@link isPlainObject}.
|
|
496
|
+
*
|
|
497
|
+
* @param wat A value to be checked.
|
|
498
|
+
* @returns A boolean representing the result.
|
|
499
|
+
*/
|
|
500
|
+
function isPlainObject(wat) {
|
|
501
|
+
return isBuiltin(wat, 'Object');
|
|
540
502
|
}
|
|
541
503
|
|
|
542
504
|
/**
|
|
543
|
-
*
|
|
505
|
+
* Checks whether given value's type is an Event instance
|
|
506
|
+
* {@link isEvent}.
|
|
507
|
+
*
|
|
508
|
+
* @param wat A value to be checked.
|
|
509
|
+
* @returns A boolean representing the result.
|
|
544
510
|
*/
|
|
545
|
-
function
|
|
546
|
-
|
|
511
|
+
function isEvent(wat) {
|
|
512
|
+
return typeof Event !== 'undefined' && isInstanceOf(wat, Event);
|
|
513
|
+
}
|
|
547
514
|
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
515
|
+
/**
|
|
516
|
+
* Checks whether given value's type is an Element instance
|
|
517
|
+
* {@link isElement}.
|
|
518
|
+
*
|
|
519
|
+
* @param wat A value to be checked.
|
|
520
|
+
* @returns A boolean representing the result.
|
|
521
|
+
*/
|
|
522
|
+
function isElement(wat) {
|
|
523
|
+
return typeof Element !== 'undefined' && isInstanceOf(wat, Element);
|
|
552
524
|
}
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
}
|
|
562
|
-
return gitRevision;
|
|
525
|
+
|
|
526
|
+
/**
|
|
527
|
+
* Checks whether given value has a then function.
|
|
528
|
+
* @param wat A value to be checked.
|
|
529
|
+
*/
|
|
530
|
+
function isThenable(wat) {
|
|
531
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
532
|
+
return Boolean(wat && wat.then && typeof wat.then === 'function');
|
|
563
533
|
}
|
|
564
534
|
|
|
565
535
|
/**
|
|
566
|
-
*
|
|
536
|
+
* Checks whether given value's type is a SyntheticEvent
|
|
537
|
+
* {@link isSyntheticEvent}.
|
|
538
|
+
*
|
|
539
|
+
* @param wat A value to be checked.
|
|
540
|
+
* @returns A boolean representing the result.
|
|
567
541
|
*/
|
|
568
|
-
function
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
// 2. CI providers with specific environment variables (has the provider name in the variable name)
|
|
572
|
-
// 3. CI providers with generic environment variables (checked for last to prevent possible false positives)
|
|
573
|
-
|
|
574
|
-
var possibleReleaseNameOfGitProvider =
|
|
575
|
-
// GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
|
|
576
|
-
process.env["GITHUB_SHA"] ||
|
|
577
|
-
// GitLab CI - https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
|
|
578
|
-
process.env["CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"] || process.env["CI_BUILD_REF"] || process.env["CI_COMMIT_SHA"] ||
|
|
579
|
-
// Bitbucket - https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/
|
|
580
|
-
process.env["BITBUCKET_COMMIT"];
|
|
581
|
-
var possibleReleaseNameOfCiProvidersWithSpecificEnvVar =
|
|
582
|
-
// AppVeyor - https://www.appveyor.com/docs/environment-variables/
|
|
583
|
-
process.env["APPVEYOR_PULL_REQUEST_HEAD_COMMIT"] || process.env["APPVEYOR_REPO_COMMIT"] ||
|
|
584
|
-
// AWS CodeBuild - https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
|
|
585
|
-
process.env["CODEBUILD_RESOLVED_SOURCE_VERSION"] ||
|
|
586
|
-
// AWS Amplify - https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html
|
|
587
|
-
process.env["AWS_COMMIT_ID"] ||
|
|
588
|
-
// Azure Pipelines - https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
|
|
589
|
-
process.env["BUILD_SOURCEVERSION"] ||
|
|
590
|
-
// Bitrise - https://devcenter.bitrise.io/builds/available-environment-variables/
|
|
591
|
-
process.env["GIT_CLONE_COMMIT_HASH"] ||
|
|
592
|
-
// Buddy CI - https://buddy.works/docs/pipelines/environment-variables#default-environment-variables
|
|
593
|
-
process.env["BUDDY_EXECUTION_REVISION"] ||
|
|
594
|
-
// Builtkite - https://buildkite.com/docs/pipelines/environment-variables
|
|
595
|
-
process.env["BUILDKITE_COMMIT"] ||
|
|
596
|
-
// CircleCI - https://circleci.com/docs/variables/
|
|
597
|
-
process.env["CIRCLE_SHA1"] ||
|
|
598
|
-
// Cirrus CI - https://cirrus-ci.org/guide/writing-tasks/#environment-variables
|
|
599
|
-
process.env["CIRRUS_CHANGE_IN_REPO"] ||
|
|
600
|
-
// Codefresh - https://codefresh.io/docs/docs/codefresh-yaml/variables/
|
|
601
|
-
process.env["CF_REVISION"] ||
|
|
602
|
-
// Codemagic - https://docs.codemagic.io/yaml-basic-configuration/environment-variables/
|
|
603
|
-
process.env["CM_COMMIT"] ||
|
|
604
|
-
// Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables
|
|
605
|
-
process.env["CF_PAGES_COMMIT_SHA"] ||
|
|
606
|
-
// Drone - https://docs.drone.io/pipeline/environment/reference/
|
|
607
|
-
process.env["DRONE_COMMIT_SHA"] ||
|
|
608
|
-
// Flightcontrol - https://www.flightcontrol.dev/docs/guides/flightcontrol/environment-variables#built-in-environment-variables
|
|
609
|
-
process.env["FC_GIT_COMMIT_SHA"] ||
|
|
610
|
-
// Heroku #1 https://devcenter.heroku.com/articles/heroku-ci
|
|
611
|
-
process.env["HEROKU_TEST_RUN_COMMIT_VERSION"] ||
|
|
612
|
-
// Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases
|
|
613
|
-
process.env["HEROKU_SLUG_COMMIT"] ||
|
|
614
|
-
// Railway - https://docs.railway.app/reference/variables#git-variables
|
|
615
|
-
process.env["RAILWAY_GIT_COMMIT_SHA"] ||
|
|
616
|
-
// Render - https://render.com/docs/environment-variables
|
|
617
|
-
process.env["RENDER_GIT_COMMIT"] ||
|
|
618
|
-
// Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables
|
|
619
|
-
process.env["SEMAPHORE_GIT_SHA"] ||
|
|
620
|
-
// TravisCI - https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
|
|
621
|
-
process.env["TRAVIS_PULL_REQUEST_SHA"] ||
|
|
622
|
-
// Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables
|
|
623
|
-
process.env["VERCEL_GIT_COMMIT_SHA"] || process.env["VERCEL_GITHUB_COMMIT_SHA"] || process.env["VERCEL_GITLAB_COMMIT_SHA"] || process.env["VERCEL_BITBUCKET_COMMIT_SHA"] ||
|
|
624
|
-
// Zeit (now known as Vercel)
|
|
625
|
-
process.env["ZEIT_GITHUB_COMMIT_SHA"] || process.env["ZEIT_GITLAB_COMMIT_SHA"] || process.env["ZEIT_BITBUCKET_COMMIT_SHA"];
|
|
626
|
-
var possibleReleaseNameOfCiProvidersWithGenericEnvVar =
|
|
627
|
-
// CloudBees CodeShip - https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables
|
|
628
|
-
process.env["CI_COMMIT_ID"] ||
|
|
629
|
-
// Coolify - https://coolify.io/docs/knowledge-base/environment-variables
|
|
630
|
-
process.env["SOURCE_COMMIT"] ||
|
|
631
|
-
// Heroku #3 https://devcenter.heroku.com/changelog-items/630
|
|
632
|
-
process.env["SOURCE_VERSION"] ||
|
|
633
|
-
// Jenkins - https://plugins.jenkins.io/git/#environment-variables
|
|
634
|
-
process.env["GIT_COMMIT"] ||
|
|
635
|
-
// Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
|
|
636
|
-
process.env["COMMIT_REF"] ||
|
|
637
|
-
// TeamCity - https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html
|
|
638
|
-
process.env["BUILD_VCS_NUMBER"] ||
|
|
639
|
-
// Woodpecker CI - https://woodpecker-ci.org/docs/usage/environment
|
|
640
|
-
process.env["CI_COMMIT_SHA"];
|
|
641
|
-
return possibleReleaseNameOfGitProvider || possibleReleaseNameOfCiProvidersWithSpecificEnvVar || possibleReleaseNameOfCiProvidersWithGenericEnvVar || gitRevision();
|
|
642
|
-
}
|
|
542
|
+
function isSyntheticEvent(wat) {
|
|
543
|
+
return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;
|
|
544
|
+
}
|
|
643
545
|
|
|
644
546
|
/**
|
|
645
|
-
*
|
|
646
|
-
*
|
|
547
|
+
* Checks whether given value's type is an instance of provided constructor.
|
|
548
|
+
* {@link isInstanceOf}.
|
|
549
|
+
*
|
|
550
|
+
* @param wat A value to be checked.
|
|
551
|
+
* @param base A constructor to be used in a check.
|
|
552
|
+
* @returns A boolean representing the result.
|
|
647
553
|
*/
|
|
648
|
-
function
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
var code = "{\n let _global =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\n typeof globalThis !== 'undefined' ?\n globalThis :\n typeof self !== 'undefined' ?\n self :\n {};\n\n _global.SENTRY_RELEASE={id:".concat(JSON.stringify(release), "};");
|
|
654
|
-
if (injectBuildInformation) {
|
|
655
|
-
var buildInfo = getBuildInformation$1();
|
|
656
|
-
code += "\n _global.SENTRY_BUILD_INFO=".concat(JSON.stringify(buildInfo), ";");
|
|
657
|
-
}
|
|
658
|
-
code += "}";
|
|
659
|
-
return code;
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
663
|
-
function generateModuleMetadataInjectorCode(metadata) {
|
|
664
|
-
// The code below is mostly ternary operators because it saves bundle size.
|
|
665
|
-
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
666
|
-
// We are merging the metadata objects in case modules are bundled twice with the plugin
|
|
667
|
-
return "{\n let _sentryModuleMetadataGlobal =\n typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\n : typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata =\n _sentryModuleMetadataGlobal._sentryModuleMetadata || {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new _sentryModuleMetadataGlobal.Error().stack] =\n Object.assign(\n {},\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new _sentryModuleMetadataGlobal.Error().stack],\n ".concat(JSON.stringify(metadata), "\n );\n}");
|
|
668
|
-
}
|
|
669
|
-
function getBuildInformation$1() {
|
|
670
|
-
var packageJson = getPackageJson();
|
|
671
|
-
var _ref3 = packageJson ? getDependencies(packageJson) : {
|
|
672
|
-
deps: [],
|
|
673
|
-
depsVersions: {}
|
|
674
|
-
},
|
|
675
|
-
deps = _ref3.deps,
|
|
676
|
-
depsVersions = _ref3.depsVersions;
|
|
677
|
-
return {
|
|
678
|
-
deps: deps,
|
|
679
|
-
depsVersions: depsVersions,
|
|
680
|
-
nodeVersion: parseMajorVersion(process.version)
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
function stripQueryAndHashFromPath(path) {
|
|
684
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
685
|
-
return path.split("?")[0].split("#")[0];
|
|
686
|
-
}
|
|
687
|
-
function replaceBooleanFlagsInCode(code, replacementValues) {
|
|
688
|
-
var ms = new MagicString(code);
|
|
689
|
-
Object.keys(replacementValues).forEach(function (key) {
|
|
690
|
-
var value = replacementValues[key];
|
|
691
|
-
if (typeof value === "boolean") {
|
|
692
|
-
ms.replaceAll(key, JSON.stringify(value));
|
|
693
|
-
}
|
|
694
|
-
});
|
|
695
|
-
if (ms.hasChanged()) {
|
|
696
|
-
return {
|
|
697
|
-
code: ms.toString(),
|
|
698
|
-
map: ms.generateMap({
|
|
699
|
-
hires: "boundary"
|
|
700
|
-
})
|
|
701
|
-
};
|
|
554
|
+
function isInstanceOf(wat, base) {
|
|
555
|
+
try {
|
|
556
|
+
return wat instanceof base;
|
|
557
|
+
} catch (_e) {
|
|
558
|
+
return false;
|
|
702
559
|
}
|
|
703
|
-
return null;
|
|
704
560
|
}
|
|
705
561
|
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
debug: (_userOptions$debug = userOptions.debug) !== null && _userOptions$debug !== void 0 ? _userOptions$debug : false,
|
|
716
|
-
silent: (_userOptions$silent = userOptions.silent) !== null && _userOptions$silent !== void 0 ? _userOptions$silent : false,
|
|
717
|
-
errorHandler: userOptions.errorHandler,
|
|
718
|
-
telemetry: (_userOptions$telemetr = userOptions.telemetry) !== null && _userOptions$telemetr !== void 0 ? _userOptions$telemetr : true,
|
|
719
|
-
disable: (_userOptions$disable = userOptions.disable) !== null && _userOptions$disable !== void 0 ? _userOptions$disable : false,
|
|
720
|
-
sourcemaps: userOptions.sourcemaps,
|
|
721
|
-
release: _objectSpread2(_objectSpread2({}, userOptions.release), {}, {
|
|
722
|
-
name: (_ref2 = (_userOptions$release$ = (_userOptions$release = userOptions.release) === null || _userOptions$release === void 0 ? void 0 : _userOptions$release.name) !== null && _userOptions$release$ !== void 0 ? _userOptions$release$ : process.env["SENTRY_RELEASE"]) !== null && _ref2 !== void 0 ? _ref2 : determineReleaseName(),
|
|
723
|
-
inject: (_userOptions$release$2 = (_userOptions$release2 = userOptions.release) === null || _userOptions$release2 === void 0 ? void 0 : _userOptions$release2.inject) !== null && _userOptions$release$2 !== void 0 ? _userOptions$release$2 : true,
|
|
724
|
-
create: (_userOptions$release$3 = (_userOptions$release3 = userOptions.release) === null || _userOptions$release3 === void 0 ? void 0 : _userOptions$release3.create) !== null && _userOptions$release$3 !== void 0 ? _userOptions$release$3 : true,
|
|
725
|
-
finalize: (_userOptions$release$4 = (_userOptions$release4 = userOptions.release) === null || _userOptions$release4 === void 0 ? void 0 : _userOptions$release4.finalize) !== null && _userOptions$release$4 !== void 0 ? _userOptions$release$4 : true,
|
|
726
|
-
vcsRemote: (_ref3 = (_userOptions$release$5 = (_userOptions$release5 = userOptions.release) === null || _userOptions$release5 === void 0 ? void 0 : _userOptions$release5.vcsRemote) !== null && _userOptions$release$5 !== void 0 ? _userOptions$release$5 : process.env["SENTRY_VSC_REMOTE"]) !== null && _ref3 !== void 0 ? _ref3 : "origin",
|
|
727
|
-
setCommits: (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.setCommits
|
|
728
|
-
}),
|
|
729
|
-
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
|
|
730
|
-
reactComponentAnnotation: userOptions.reactComponentAnnotation,
|
|
731
|
-
_metaOptions: {
|
|
732
|
-
telemetry: {
|
|
733
|
-
metaFramework: (_userOptions$_metaOpt = userOptions._metaOptions) === null || _userOptions$_metaOpt === void 0 ? void 0 : (_userOptions$_metaOpt2 = _userOptions$_metaOpt.telemetry) === null || _userOptions$_metaOpt2 === void 0 ? void 0 : _userOptions$_metaOpt2.metaFramework
|
|
734
|
-
}
|
|
735
|
-
},
|
|
736
|
-
applicationKey: userOptions.applicationKey,
|
|
737
|
-
moduleMetadata: userOptions.moduleMetadata,
|
|
738
|
-
_experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
|
|
739
|
-
};
|
|
740
|
-
if (options.release.setCommits === undefined) {
|
|
741
|
-
if (process.env["VERCEL"] && process.env["VERCEL_GIT_COMMIT_SHA"] && process.env["VERCEL_GIT_REPO_SLUG"] && process.env["VERCEL_GIT_REPO_OWNER"] &&
|
|
742
|
-
// We only want to set commits for the production env because Sentry becomes extremely noisy (eg on slack) for
|
|
743
|
-
// preview environments because the previous commit is always the "stem" commit of the preview/PR causing Sentry
|
|
744
|
-
// to notify you for other people creating PRs.
|
|
745
|
-
process.env["VERCEL_TARGET_ENV"] === "production") {
|
|
746
|
-
options.release.setCommits = {
|
|
747
|
-
shouldNotThrowOnFailure: true,
|
|
748
|
-
commit: process.env["VERCEL_GIT_COMMIT_SHA"],
|
|
749
|
-
previousCommit: process.env["VERCEL_GIT_PREVIOUS_SHA"],
|
|
750
|
-
repo: "".concat(process.env["VERCEL_GIT_REPO_OWNER"], "/").concat(process.env["VERCEL_GIT_REPO_SLUG"]),
|
|
751
|
-
ignoreEmpty: true,
|
|
752
|
-
ignoreMissing: true
|
|
753
|
-
};
|
|
754
|
-
} else {
|
|
755
|
-
options.release.setCommits = {
|
|
756
|
-
shouldNotThrowOnFailure: true,
|
|
757
|
-
auto: true,
|
|
758
|
-
ignoreEmpty: true,
|
|
759
|
-
ignoreMissing: true
|
|
760
|
-
};
|
|
761
|
-
}
|
|
762
|
-
}
|
|
763
|
-
if (options.release.deploy === undefined && process.env["VERCEL"] && process.env["VERCEL_TARGET_ENV"]) {
|
|
764
|
-
options.release.deploy = {
|
|
765
|
-
env: "vercel-".concat(process.env["VERCEL_TARGET_ENV"]),
|
|
766
|
-
url: process.env["VERCEL_URL"] ? "https://".concat(process.env["VERCEL_URL"]) : undefined
|
|
767
|
-
};
|
|
768
|
-
}
|
|
769
|
-
return options;
|
|
562
|
+
/**
|
|
563
|
+
* Checks whether given value's type is a Vue ViewModel.
|
|
564
|
+
*
|
|
565
|
+
* @param wat A value to be checked.
|
|
566
|
+
* @returns A boolean representing the result.
|
|
567
|
+
*/
|
|
568
|
+
function isVueViewModel(wat) {
|
|
569
|
+
// Not using Object.prototype.toString because in Vue 3 it would read the instance's Symbol(Symbol.toStringTag) property.
|
|
570
|
+
return !!(typeof wat === 'object' && wat !== null && ((wat ).__isVue || (wat )._isVue));
|
|
770
571
|
}
|
|
771
572
|
|
|
772
573
|
/**
|
|
773
|
-
*
|
|
774
|
-
*
|
|
775
|
-
* For all other options, we can rely on Sentry CLI to validate them. In fact,
|
|
776
|
-
* we can't validate them in the plugin because Sentry CLI might pick up options from
|
|
777
|
-
* its config file.
|
|
778
|
-
*
|
|
779
|
-
* @param options the internal options
|
|
780
|
-
* @param logger the logger
|
|
574
|
+
* Truncates given string to the maximum characters count
|
|
781
575
|
*
|
|
782
|
-
* @
|
|
576
|
+
* @param str An object that contains serializable values
|
|
577
|
+
* @param max Maximum number of characters in truncated string (0 = unlimited)
|
|
578
|
+
* @returns string Encoded
|
|
783
579
|
*/
|
|
784
|
-
function
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
if (setCommits) {
|
|
788
|
-
if (!setCommits.auto && !(setCommits.repo && setCommits.commit)) {
|
|
789
|
-
logger.error("The `setCommits` option was specified but is missing required properties.", "Please set either `auto` or both, `repo` and `commit`.");
|
|
790
|
-
return false;
|
|
791
|
-
}
|
|
792
|
-
if (setCommits.auto && setCommits.repo && setCommits) {
|
|
793
|
-
logger.warn("The `setCommits` options includes `auto` but also `repo` and `commit`.", "Ignoring `repo` and `commit`.", "Please only set either `auto` or both, `repo` and `commit`.");
|
|
794
|
-
}
|
|
795
|
-
}
|
|
796
|
-
if ((_options$release2 = options.release) !== null && _options$release2 !== void 0 && _options$release2.deploy && !((_options$release3 = options.release) !== null && _options$release3 !== void 0 && _options$release3.deploy.env)) {
|
|
797
|
-
logger.error("The `deploy` option was specified but is missing the required `env` property.", "Please set the `env` property.");
|
|
798
|
-
return false;
|
|
580
|
+
function truncate(str, max = 0) {
|
|
581
|
+
if (typeof str !== 'string' || max === 0) {
|
|
582
|
+
return str;
|
|
799
583
|
}
|
|
800
|
-
return
|
|
584
|
+
return str.length <= max ? str : `${str.slice(0, max)}...`;
|
|
801
585
|
}
|
|
802
586
|
|
|
803
|
-
|
|
804
|
-
|
|
587
|
+
const SDK_VERSION = '8.30.0';
|
|
588
|
+
|
|
589
|
+
/** Get's the global object for the current JavaScript runtime */
|
|
590
|
+
const GLOBAL_OBJ = globalThis ;
|
|
805
591
|
|
|
806
592
|
/**
|
|
807
|
-
*
|
|
808
|
-
* {@link isError}.
|
|
809
|
-
*
|
|
810
|
-
* @param wat A value to be checked.
|
|
811
|
-
* @returns A boolean representing the result.
|
|
812
|
-
*/
|
|
813
|
-
function isError(wat) {
|
|
814
|
-
switch (objectToString.call(wat)) {
|
|
815
|
-
case '[object Error]':
|
|
816
|
-
case '[object Exception]':
|
|
817
|
-
case '[object DOMException]':
|
|
818
|
-
return true;
|
|
819
|
-
default:
|
|
820
|
-
return isInstanceOf(wat, Error);
|
|
821
|
-
}
|
|
822
|
-
}
|
|
823
|
-
/**
|
|
824
|
-
* Checks whether given value is an instance of the given built-in class.
|
|
825
|
-
*
|
|
826
|
-
* @param wat The value to be checked
|
|
827
|
-
* @param className
|
|
828
|
-
* @returns A boolean representing the result.
|
|
829
|
-
*/
|
|
830
|
-
function isBuiltin(wat, className) {
|
|
831
|
-
return objectToString.call(wat) === `[object ${className}]`;
|
|
832
|
-
}
|
|
833
|
-
|
|
834
|
-
/**
|
|
835
|
-
* Checks whether given value's type is ErrorEvent
|
|
836
|
-
* {@link isErrorEvent}.
|
|
837
|
-
*
|
|
838
|
-
* @param wat A value to be checked.
|
|
839
|
-
* @returns A boolean representing the result.
|
|
840
|
-
*/
|
|
841
|
-
function isErrorEvent$1(wat) {
|
|
842
|
-
return isBuiltin(wat, 'ErrorEvent');
|
|
843
|
-
}
|
|
844
|
-
|
|
845
|
-
/**
|
|
846
|
-
* Checks whether given value's type is a string
|
|
847
|
-
* {@link isString}.
|
|
848
|
-
*
|
|
849
|
-
* @param wat A value to be checked.
|
|
850
|
-
* @returns A boolean representing the result.
|
|
851
|
-
*/
|
|
852
|
-
function isString(wat) {
|
|
853
|
-
return isBuiltin(wat, 'String');
|
|
854
|
-
}
|
|
855
|
-
|
|
856
|
-
/**
|
|
857
|
-
* Checks whether given string is parameterized
|
|
858
|
-
* {@link isParameterizedString}.
|
|
859
|
-
*
|
|
860
|
-
* @param wat A value to be checked.
|
|
861
|
-
* @returns A boolean representing the result.
|
|
862
|
-
*/
|
|
863
|
-
function isParameterizedString(wat) {
|
|
864
|
-
return (
|
|
865
|
-
typeof wat === 'object' &&
|
|
866
|
-
wat !== null &&
|
|
867
|
-
'__sentry_template_string__' in wat &&
|
|
868
|
-
'__sentry_template_values__' in wat
|
|
869
|
-
);
|
|
870
|
-
}
|
|
871
|
-
|
|
872
|
-
/**
|
|
873
|
-
* Checks whether given value is a primitive (undefined, null, number, boolean, string, bigint, symbol)
|
|
874
|
-
* {@link isPrimitive}.
|
|
875
|
-
*
|
|
876
|
-
* @param wat A value to be checked.
|
|
877
|
-
* @returns A boolean representing the result.
|
|
878
|
-
*/
|
|
879
|
-
function isPrimitive(wat) {
|
|
880
|
-
return wat === null || isParameterizedString(wat) || (typeof wat !== 'object' && typeof wat !== 'function');
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* Checks whether given value's type is an object literal, or a class instance.
|
|
885
|
-
* {@link isPlainObject}.
|
|
886
|
-
*
|
|
887
|
-
* @param wat A value to be checked.
|
|
888
|
-
* @returns A boolean representing the result.
|
|
889
|
-
*/
|
|
890
|
-
function isPlainObject(wat) {
|
|
891
|
-
return isBuiltin(wat, 'Object');
|
|
892
|
-
}
|
|
893
|
-
|
|
894
|
-
/**
|
|
895
|
-
* Checks whether given value's type is an Event instance
|
|
896
|
-
* {@link isEvent}.
|
|
897
|
-
*
|
|
898
|
-
* @param wat A value to be checked.
|
|
899
|
-
* @returns A boolean representing the result.
|
|
900
|
-
*/
|
|
901
|
-
function isEvent(wat) {
|
|
902
|
-
return typeof Event !== 'undefined' && isInstanceOf(wat, Event);
|
|
903
|
-
}
|
|
904
|
-
|
|
905
|
-
/**
|
|
906
|
-
* Checks whether given value's type is an Element instance
|
|
907
|
-
* {@link isElement}.
|
|
908
|
-
*
|
|
909
|
-
* @param wat A value to be checked.
|
|
910
|
-
* @returns A boolean representing the result.
|
|
911
|
-
*/
|
|
912
|
-
function isElement(wat) {
|
|
913
|
-
return typeof Element !== 'undefined' && isInstanceOf(wat, Element);
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
/**
|
|
917
|
-
* Checks whether given value has a then function.
|
|
918
|
-
* @param wat A value to be checked.
|
|
919
|
-
*/
|
|
920
|
-
function isThenable(wat) {
|
|
921
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
|
|
922
|
-
return Boolean(wat && wat.then && typeof wat.then === 'function');
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
/**
|
|
926
|
-
* Checks whether given value's type is a SyntheticEvent
|
|
927
|
-
* {@link isSyntheticEvent}.
|
|
928
|
-
*
|
|
929
|
-
* @param wat A value to be checked.
|
|
930
|
-
* @returns A boolean representing the result.
|
|
931
|
-
*/
|
|
932
|
-
function isSyntheticEvent(wat) {
|
|
933
|
-
return isPlainObject(wat) && 'nativeEvent' in wat && 'preventDefault' in wat && 'stopPropagation' in wat;
|
|
934
|
-
}
|
|
935
|
-
|
|
936
|
-
/**
|
|
937
|
-
* Checks whether given value's type is an instance of provided constructor.
|
|
938
|
-
* {@link isInstanceOf}.
|
|
939
|
-
*
|
|
940
|
-
* @param wat A value to be checked.
|
|
941
|
-
* @param base A constructor to be used in a check.
|
|
942
|
-
* @returns A boolean representing the result.
|
|
943
|
-
*/
|
|
944
|
-
function isInstanceOf(wat, base) {
|
|
945
|
-
try {
|
|
946
|
-
return wat instanceof base;
|
|
947
|
-
} catch (_e) {
|
|
948
|
-
return false;
|
|
949
|
-
}
|
|
950
|
-
}
|
|
951
|
-
|
|
952
|
-
/**
|
|
953
|
-
* Checks whether given value's type is a Vue ViewModel.
|
|
954
|
-
*
|
|
955
|
-
* @param wat A value to be checked.
|
|
956
|
-
* @returns A boolean representing the result.
|
|
957
|
-
*/
|
|
958
|
-
function isVueViewModel(wat) {
|
|
959
|
-
// Not using Object.prototype.toString because in Vue 3 it would read the instance's Symbol(Symbol.toStringTag) property.
|
|
960
|
-
return !!(typeof wat === 'object' && wat !== null && ((wat ).__isVue || (wat )._isVue));
|
|
961
|
-
}
|
|
962
|
-
|
|
963
|
-
/**
|
|
964
|
-
* Truncates given string to the maximum characters count
|
|
965
|
-
*
|
|
966
|
-
* @param str An object that contains serializable values
|
|
967
|
-
* @param max Maximum number of characters in truncated string (0 = unlimited)
|
|
968
|
-
* @returns string Encoded
|
|
969
|
-
*/
|
|
970
|
-
function truncate(str, max = 0) {
|
|
971
|
-
if (typeof str !== 'string' || max === 0) {
|
|
972
|
-
return str;
|
|
973
|
-
}
|
|
974
|
-
return str.length <= max ? str : `${str.slice(0, max)}...`;
|
|
975
|
-
}
|
|
976
|
-
|
|
977
|
-
const SDK_VERSION = '8.30.0';
|
|
978
|
-
|
|
979
|
-
/** Get's the global object for the current JavaScript runtime */
|
|
980
|
-
const GLOBAL_OBJ = globalThis ;
|
|
981
|
-
|
|
982
|
-
/**
|
|
983
|
-
* Returns a global singleton contained in the global `__SENTRY__[]` object.
|
|
593
|
+
* Returns a global singleton contained in the global `__SENTRY__[]` object.
|
|
984
594
|
*
|
|
985
595
|
* If the singleton doesn't already exist in `__SENTRY__`, it will be created using the given factory
|
|
986
596
|
* function and added to the `__SENTRY__` object.
|
|
@@ -2073,7 +1683,7 @@ function checkOrSetAlreadyCaught(exception) {
|
|
|
2073
1683
|
* @param maybeArray Input to turn into an array, if necessary
|
|
2074
1684
|
* @returns The input, if already an array, or an array with the input as the only element, if not
|
|
2075
1685
|
*/
|
|
2076
|
-
function arrayify(maybeArray) {
|
|
1686
|
+
function arrayify$1(maybeArray) {
|
|
2077
1687
|
return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
|
|
2078
1688
|
}
|
|
2079
1689
|
|
|
@@ -6193,7 +5803,7 @@ function applySpanToEvent(event, span) {
|
|
|
6193
5803
|
*/
|
|
6194
5804
|
function applyFingerprintToEvent(event, fingerprint) {
|
|
6195
5805
|
// Make sure it's an array first and we actually have something in place
|
|
6196
|
-
event.fingerprint = event.fingerprint ? arrayify(event.fingerprint) : [];
|
|
5806
|
+
event.fingerprint = event.fingerprint ? arrayify$1(event.fingerprint) : [];
|
|
6197
5807
|
|
|
6198
5808
|
// If we have something on the scope, then merge it with event
|
|
6199
5809
|
if (fingerprint) {
|
|
@@ -7924,44 +7534,486 @@ function createTransport(
|
|
|
7924
7534
|
send,
|
|
7925
7535
|
flush,
|
|
7926
7536
|
};
|
|
7927
|
-
}
|
|
7928
|
-
|
|
7929
|
-
function getEventForEnvelopeItem(item, type) {
|
|
7930
|
-
if (type !== 'event' && type !== 'transaction') {
|
|
7931
|
-
return undefined;
|
|
7537
|
+
}
|
|
7538
|
+
|
|
7539
|
+
function getEventForEnvelopeItem(item, type) {
|
|
7540
|
+
if (type !== 'event' && type !== 'transaction') {
|
|
7541
|
+
return undefined;
|
|
7542
|
+
}
|
|
7543
|
+
|
|
7544
|
+
return Array.isArray(item) ? (item )[1] : undefined;
|
|
7545
|
+
}
|
|
7546
|
+
|
|
7547
|
+
/**
|
|
7548
|
+
* A builder for the SDK metadata in the options for the SDK initialization.
|
|
7549
|
+
*
|
|
7550
|
+
* Note: This function is identical to `buildMetadata` in Remix and NextJS and SvelteKit.
|
|
7551
|
+
* We don't extract it for bundle size reasons.
|
|
7552
|
+
* @see https://github.com/getsentry/sentry-javascript/pull/7404
|
|
7553
|
+
* @see https://github.com/getsentry/sentry-javascript/pull/4196
|
|
7554
|
+
*
|
|
7555
|
+
* If you make changes to this function consider updating the others as well.
|
|
7556
|
+
*
|
|
7557
|
+
* @param options SDK options object that gets mutated
|
|
7558
|
+
* @param names list of package names
|
|
7559
|
+
*/
|
|
7560
|
+
function applySdkMetadata(options, name, names = [name], source = 'npm') {
|
|
7561
|
+
const metadata = options._metadata || {};
|
|
7562
|
+
|
|
7563
|
+
if (!metadata.sdk) {
|
|
7564
|
+
metadata.sdk = {
|
|
7565
|
+
name: `sentry.javascript.${name}`,
|
|
7566
|
+
packages: names.map(name => ({
|
|
7567
|
+
name: `${source}:@sentry/${name}`,
|
|
7568
|
+
version: SDK_VERSION,
|
|
7569
|
+
})),
|
|
7570
|
+
version: SDK_VERSION,
|
|
7571
|
+
};
|
|
7572
|
+
}
|
|
7573
|
+
|
|
7574
|
+
options._metadata = metadata;
|
|
7575
|
+
}
|
|
7576
|
+
|
|
7577
|
+
/**
|
|
7578
|
+
* Checks whether the given input is already an array, and if it isn't, wraps it in one.
|
|
7579
|
+
*
|
|
7580
|
+
* @param maybeArray Input to turn into an array, if necessary
|
|
7581
|
+
* @returns The input, if already an array, or an array with the input as the only element, if not
|
|
7582
|
+
*/
|
|
7583
|
+
function arrayify(maybeArray) {
|
|
7584
|
+
return Array.isArray(maybeArray) ? maybeArray : [maybeArray];
|
|
7585
|
+
}
|
|
7586
|
+
/**
|
|
7587
|
+
* Get the closes package.json from a given starting point upwards.
|
|
7588
|
+
* This handles a few edge cases:
|
|
7589
|
+
* * Check if a given file package.json appears to be an actual NPM package.json file
|
|
7590
|
+
* * Stop at the home dir, to avoid looking too deeply
|
|
7591
|
+
*/
|
|
7592
|
+
function getPackageJson() {
|
|
7593
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
7594
|
+
cwd = _ref.cwd,
|
|
7595
|
+
stopAt = _ref.stopAt;
|
|
7596
|
+
return lookupPackageJson(cwd !== null && cwd !== void 0 ? cwd : process.cwd(), path__default.normalize(stopAt !== null && stopAt !== void 0 ? stopAt : os__default.homedir()));
|
|
7597
|
+
}
|
|
7598
|
+
function parseMajorVersion(version) {
|
|
7599
|
+
// if it has a `v` prefix, remove it
|
|
7600
|
+
if (version.startsWith("v")) {
|
|
7601
|
+
version = version.slice(1);
|
|
7602
|
+
}
|
|
7603
|
+
|
|
7604
|
+
// First, try simple lookup of exact, ~ and ^ versions
|
|
7605
|
+
var regex = /^[\^~]?(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
7606
|
+
var match = version.match(regex);
|
|
7607
|
+
if (match) {
|
|
7608
|
+
return parseInt(match[1], 10);
|
|
7609
|
+
}
|
|
7610
|
+
|
|
7611
|
+
// Try to parse e.g. 1.x
|
|
7612
|
+
var coerced = parseInt(version, 10);
|
|
7613
|
+
if (!Number.isNaN(coerced)) {
|
|
7614
|
+
return coerced;
|
|
7615
|
+
}
|
|
7616
|
+
|
|
7617
|
+
// Match <= and >= ranges.
|
|
7618
|
+
var gteLteRegex = /^[<>]=\s*(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
7619
|
+
var gteLteMatch = version.match(gteLteRegex);
|
|
7620
|
+
if (gteLteMatch) {
|
|
7621
|
+
return parseInt(gteLteMatch[1], 10);
|
|
7622
|
+
}
|
|
7623
|
+
|
|
7624
|
+
// match < ranges
|
|
7625
|
+
var ltRegex = /^<\s*(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
7626
|
+
var ltMatch = version.match(ltRegex);
|
|
7627
|
+
if (ltMatch) {
|
|
7628
|
+
// Two scenarios:
|
|
7629
|
+
// a) < 2.0.0 --> return 1
|
|
7630
|
+
// b) < 2.1.0 --> return 2
|
|
7631
|
+
|
|
7632
|
+
var major = parseInt(ltMatch[1], 10);
|
|
7633
|
+
if (
|
|
7634
|
+
// minor version > 0
|
|
7635
|
+
typeof ltMatch[2] === "string" && parseInt(ltMatch[2].slice(1), 10) > 0 ||
|
|
7636
|
+
// patch version > 0
|
|
7637
|
+
typeof ltMatch[3] === "string" && parseInt(ltMatch[3].slice(1), 10) > 0) {
|
|
7638
|
+
return major;
|
|
7639
|
+
}
|
|
7640
|
+
return major - 1;
|
|
7641
|
+
}
|
|
7642
|
+
|
|
7643
|
+
// match > ranges
|
|
7644
|
+
var gtRegex = /^>\s*(\d+)(\.\d+)?(\.\d+)?(-.+)?/;
|
|
7645
|
+
var gtMatch = version.match(gtRegex);
|
|
7646
|
+
if (gtMatch) {
|
|
7647
|
+
// We always return the version here, even though it _may_ be incorrect
|
|
7648
|
+
// E.g. if given > 2.0.0, it should be 2 if there exists any 2.x.x version, else 3
|
|
7649
|
+
// Since there is no way for us to know this, we're going to assume any kind of patch/feature release probably exists
|
|
7650
|
+
return parseInt(gtMatch[1], 10);
|
|
7651
|
+
}
|
|
7652
|
+
return undefined;
|
|
7653
|
+
}
|
|
7654
|
+
|
|
7655
|
+
// This is an explicit list of packages where we want to include the (major) version number.
|
|
7656
|
+
var PACKAGES_TO_INCLUDE_VERSION = ["react", "@angular/core", "vue", "ember-source", "svelte", "@sveltejs/kit", "webpack", "vite", "gatsby", "next", "remix", "rollup", "esbuild"];
|
|
7657
|
+
function getDependencies(packageJson) {
|
|
7658
|
+
var _packageJson$devDepen, _packageJson$dependen;
|
|
7659
|
+
var dependencies = Object.assign({}, (_packageJson$devDepen = packageJson["devDependencies"]) !== null && _packageJson$devDepen !== void 0 ? _packageJson$devDepen : {}, (_packageJson$dependen = packageJson["dependencies"]) !== null && _packageJson$dependen !== void 0 ? _packageJson$dependen : {});
|
|
7660
|
+
var deps = Object.keys(dependencies).sort();
|
|
7661
|
+
var depsVersions = deps.reduce(function (depsVersions, depName) {
|
|
7662
|
+
if (PACKAGES_TO_INCLUDE_VERSION.includes(depName)) {
|
|
7663
|
+
var version = dependencies[depName];
|
|
7664
|
+
var majorVersion = parseMajorVersion(version);
|
|
7665
|
+
if (majorVersion) {
|
|
7666
|
+
depsVersions[depName] = majorVersion;
|
|
7667
|
+
}
|
|
7668
|
+
}
|
|
7669
|
+
return depsVersions;
|
|
7670
|
+
}, {});
|
|
7671
|
+
return {
|
|
7672
|
+
deps: deps,
|
|
7673
|
+
depsVersions: depsVersions
|
|
7674
|
+
};
|
|
7675
|
+
}
|
|
7676
|
+
function lookupPackageJson(cwd, stopAt) {
|
|
7677
|
+
var jsonPath = findUp.sync(function (dirName) {
|
|
7678
|
+
// Stop if we reach this dir
|
|
7679
|
+
if (path__default.normalize(dirName) === stopAt) {
|
|
7680
|
+
return findUp.stop;
|
|
7681
|
+
}
|
|
7682
|
+
return findUp.sync.exists(dirName + "/package.json") ? "package.json" : undefined;
|
|
7683
|
+
}, {
|
|
7684
|
+
cwd: cwd
|
|
7685
|
+
});
|
|
7686
|
+
if (!jsonPath) {
|
|
7687
|
+
return undefined;
|
|
7688
|
+
}
|
|
7689
|
+
try {
|
|
7690
|
+
var jsonStr = fs__default.readFileSync(jsonPath, "utf8");
|
|
7691
|
+
var json = JSON.parse(jsonStr);
|
|
7692
|
+
|
|
7693
|
+
// Ensure it is an actual package.json
|
|
7694
|
+
// This is very much not bulletproof, but should be good enough
|
|
7695
|
+
if ("name" in json || "private" in json) {
|
|
7696
|
+
return json;
|
|
7697
|
+
}
|
|
7698
|
+
} catch (error) {
|
|
7699
|
+
// Ignore and walk up
|
|
7700
|
+
}
|
|
7701
|
+
|
|
7702
|
+
// Continue up the tree, if we find a fitting package.json
|
|
7703
|
+
var newCwd = path__default.dirname(path__default.resolve(jsonPath + "/.."));
|
|
7704
|
+
return lookupPackageJson(newCwd, stopAt);
|
|
7705
|
+
}
|
|
7706
|
+
|
|
7707
|
+
/**
|
|
7708
|
+
* Deterministically hashes a string and turns the hash into a uuid.
|
|
7709
|
+
*/
|
|
7710
|
+
function stringToUUID(str) {
|
|
7711
|
+
var sha256Hash = crypto.createHash("sha256").update(str).digest("hex");
|
|
7712
|
+
|
|
7713
|
+
// Position 16 is fixed to either 8, 9, a, or b in the uuid v4 spec (10xx in binary)
|
|
7714
|
+
// RFC 4122 section 4.4
|
|
7715
|
+
var v4variant = ["8", "9", "a", "b"][sha256Hash.substring(16, 17).charCodeAt(0) % 4];
|
|
7716
|
+
return (sha256Hash.substring(0, 8) + "-" + sha256Hash.substring(8, 12) + "-4" + sha256Hash.substring(13, 16) + "-" + v4variant + sha256Hash.substring(17, 20) + "-" + sha256Hash.substring(20, 32)).toLowerCase();
|
|
7717
|
+
}
|
|
7718
|
+
function gitRevision() {
|
|
7719
|
+
var gitRevision;
|
|
7720
|
+
try {
|
|
7721
|
+
gitRevision = childProcess.execSync("git rev-parse HEAD", {
|
|
7722
|
+
stdio: ["ignore", "pipe", "ignore"]
|
|
7723
|
+
}).toString().trim();
|
|
7724
|
+
} catch (e) {
|
|
7725
|
+
// noop
|
|
7726
|
+
}
|
|
7727
|
+
return gitRevision;
|
|
7728
|
+
}
|
|
7729
|
+
|
|
7730
|
+
/**
|
|
7731
|
+
* Tries to guess a release name based on environmental data.
|
|
7732
|
+
*/
|
|
7733
|
+
function determineReleaseName() {
|
|
7734
|
+
// This list is in approximate alpha order, separated into 3 categories:
|
|
7735
|
+
// 1. Git providers
|
|
7736
|
+
// 2. CI providers with specific environment variables (has the provider name in the variable name)
|
|
7737
|
+
// 3. CI providers with generic environment variables (checked for last to prevent possible false positives)
|
|
7738
|
+
|
|
7739
|
+
var possibleReleaseNameOfGitProvider =
|
|
7740
|
+
// GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
|
|
7741
|
+
process.env["GITHUB_SHA"] ||
|
|
7742
|
+
// GitLab CI - https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
|
|
7743
|
+
process.env["CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"] || process.env["CI_BUILD_REF"] || process.env["CI_COMMIT_SHA"] ||
|
|
7744
|
+
// Bitbucket - https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/
|
|
7745
|
+
process.env["BITBUCKET_COMMIT"];
|
|
7746
|
+
var possibleReleaseNameOfCiProvidersWithSpecificEnvVar =
|
|
7747
|
+
// AppVeyor - https://www.appveyor.com/docs/environment-variables/
|
|
7748
|
+
process.env["APPVEYOR_PULL_REQUEST_HEAD_COMMIT"] || process.env["APPVEYOR_REPO_COMMIT"] ||
|
|
7749
|
+
// AWS CodeBuild - https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
|
|
7750
|
+
process.env["CODEBUILD_RESOLVED_SOURCE_VERSION"] ||
|
|
7751
|
+
// AWS Amplify - https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html
|
|
7752
|
+
process.env["AWS_COMMIT_ID"] ||
|
|
7753
|
+
// Azure Pipelines - https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
|
|
7754
|
+
process.env["BUILD_SOURCEVERSION"] ||
|
|
7755
|
+
// Bitrise - https://devcenter.bitrise.io/builds/available-environment-variables/
|
|
7756
|
+
process.env["GIT_CLONE_COMMIT_HASH"] ||
|
|
7757
|
+
// Buddy CI - https://buddy.works/docs/pipelines/environment-variables#default-environment-variables
|
|
7758
|
+
process.env["BUDDY_EXECUTION_REVISION"] ||
|
|
7759
|
+
// Builtkite - https://buildkite.com/docs/pipelines/environment-variables
|
|
7760
|
+
process.env["BUILDKITE_COMMIT"] ||
|
|
7761
|
+
// CircleCI - https://circleci.com/docs/variables/
|
|
7762
|
+
process.env["CIRCLE_SHA1"] ||
|
|
7763
|
+
// Cirrus CI - https://cirrus-ci.org/guide/writing-tasks/#environment-variables
|
|
7764
|
+
process.env["CIRRUS_CHANGE_IN_REPO"] ||
|
|
7765
|
+
// Codefresh - https://codefresh.io/docs/docs/codefresh-yaml/variables/
|
|
7766
|
+
process.env["CF_REVISION"] ||
|
|
7767
|
+
// Codemagic - https://docs.codemagic.io/yaml-basic-configuration/environment-variables/
|
|
7768
|
+
process.env["CM_COMMIT"] ||
|
|
7769
|
+
// Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables
|
|
7770
|
+
process.env["CF_PAGES_COMMIT_SHA"] ||
|
|
7771
|
+
// Drone - https://docs.drone.io/pipeline/environment/reference/
|
|
7772
|
+
process.env["DRONE_COMMIT_SHA"] ||
|
|
7773
|
+
// Flightcontrol - https://www.flightcontrol.dev/docs/guides/flightcontrol/environment-variables#built-in-environment-variables
|
|
7774
|
+
process.env["FC_GIT_COMMIT_SHA"] ||
|
|
7775
|
+
// Heroku #1 https://devcenter.heroku.com/articles/heroku-ci
|
|
7776
|
+
process.env["HEROKU_TEST_RUN_COMMIT_VERSION"] ||
|
|
7777
|
+
// Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases
|
|
7778
|
+
process.env["HEROKU_SLUG_COMMIT"] ||
|
|
7779
|
+
// Railway - https://docs.railway.app/reference/variables#git-variables
|
|
7780
|
+
process.env["RAILWAY_GIT_COMMIT_SHA"] ||
|
|
7781
|
+
// Render - https://render.com/docs/environment-variables
|
|
7782
|
+
process.env["RENDER_GIT_COMMIT"] ||
|
|
7783
|
+
// Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables
|
|
7784
|
+
process.env["SEMAPHORE_GIT_SHA"] ||
|
|
7785
|
+
// TravisCI - https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
|
|
7786
|
+
process.env["TRAVIS_PULL_REQUEST_SHA"] ||
|
|
7787
|
+
// Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables
|
|
7788
|
+
process.env["VERCEL_GIT_COMMIT_SHA"] || process.env["VERCEL_GITHUB_COMMIT_SHA"] || process.env["VERCEL_GITLAB_COMMIT_SHA"] || process.env["VERCEL_BITBUCKET_COMMIT_SHA"] ||
|
|
7789
|
+
// Zeit (now known as Vercel)
|
|
7790
|
+
process.env["ZEIT_GITHUB_COMMIT_SHA"] || process.env["ZEIT_GITLAB_COMMIT_SHA"] || process.env["ZEIT_BITBUCKET_COMMIT_SHA"];
|
|
7791
|
+
var possibleReleaseNameOfCiProvidersWithGenericEnvVar =
|
|
7792
|
+
// CloudBees CodeShip - https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables
|
|
7793
|
+
process.env["CI_COMMIT_ID"] ||
|
|
7794
|
+
// Coolify - https://coolify.io/docs/knowledge-base/environment-variables
|
|
7795
|
+
process.env["SOURCE_COMMIT"] ||
|
|
7796
|
+
// Heroku #3 https://devcenter.heroku.com/changelog-items/630
|
|
7797
|
+
process.env["SOURCE_VERSION"] ||
|
|
7798
|
+
// Jenkins - https://plugins.jenkins.io/git/#environment-variables
|
|
7799
|
+
process.env["GIT_COMMIT"] ||
|
|
7800
|
+
// Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
|
|
7801
|
+
process.env["COMMIT_REF"] ||
|
|
7802
|
+
// TeamCity - https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html
|
|
7803
|
+
process.env["BUILD_VCS_NUMBER"] ||
|
|
7804
|
+
// Woodpecker CI - https://woodpecker-ci.org/docs/usage/environment
|
|
7805
|
+
process.env["CI_COMMIT_SHA"];
|
|
7806
|
+
return possibleReleaseNameOfGitProvider || possibleReleaseNameOfCiProvidersWithSpecificEnvVar || possibleReleaseNameOfCiProvidersWithGenericEnvVar || gitRevision();
|
|
7807
|
+
}
|
|
7808
|
+
|
|
7809
|
+
/**
|
|
7810
|
+
* Generates code for the global injector which is responsible for setting the global
|
|
7811
|
+
* `SENTRY_RELEASE` & `SENTRY_BUILD_INFO` variables.
|
|
7812
|
+
*/
|
|
7813
|
+
function generateGlobalInjectorCode(_ref2) {
|
|
7814
|
+
var release = _ref2.release,
|
|
7815
|
+
injectBuildInformation = _ref2.injectBuildInformation;
|
|
7816
|
+
// The code below is mostly ternary operators because it saves bundle size.
|
|
7817
|
+
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
7818
|
+
var code = "{\n let _global =\n typeof window !== 'undefined' ?\n window :\n typeof global !== 'undefined' ?\n global :\n typeof globalThis !== 'undefined' ?\n globalThis :\n typeof self !== 'undefined' ?\n self :\n {};\n\n _global.SENTRY_RELEASE={id:".concat(JSON.stringify(release), "};");
|
|
7819
|
+
if (injectBuildInformation) {
|
|
7820
|
+
var buildInfo = getBuildInformation$1();
|
|
7821
|
+
code += "\n _global.SENTRY_BUILD_INFO=".concat(JSON.stringify(buildInfo), ";");
|
|
7822
|
+
}
|
|
7823
|
+
code += "}";
|
|
7824
|
+
return code;
|
|
7825
|
+
}
|
|
7826
|
+
|
|
7827
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
7828
|
+
function generateModuleMetadataInjectorCode(metadata) {
|
|
7829
|
+
// The code below is mostly ternary operators because it saves bundle size.
|
|
7830
|
+
// The checks are to support as many environments as possible. (Node.js, Browser, webworkers, etc.)
|
|
7831
|
+
// We are merging the metadata objects in case modules are bundled twice with the plugin
|
|
7832
|
+
return "{\n let _sentryModuleMetadataGlobal =\n typeof window !== \"undefined\"\n ? window\n : typeof global !== \"undefined\"\n ? global\n : typeof globalThis !== \"undefined\"\n ? globalThis\n : typeof self !== \"undefined\"\n ? self\n : {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata =\n _sentryModuleMetadataGlobal._sentryModuleMetadata || {};\n\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new _sentryModuleMetadataGlobal.Error().stack] =\n Object.assign(\n {},\n _sentryModuleMetadataGlobal._sentryModuleMetadata[new _sentryModuleMetadataGlobal.Error().stack],\n ".concat(JSON.stringify(metadata), "\n );\n}");
|
|
7833
|
+
}
|
|
7834
|
+
function getBuildInformation$1() {
|
|
7835
|
+
var packageJson = getPackageJson();
|
|
7836
|
+
var _ref3 = packageJson ? getDependencies(packageJson) : {
|
|
7837
|
+
deps: [],
|
|
7838
|
+
depsVersions: {}
|
|
7839
|
+
},
|
|
7840
|
+
deps = _ref3.deps,
|
|
7841
|
+
depsVersions = _ref3.depsVersions;
|
|
7842
|
+
return {
|
|
7843
|
+
deps: deps,
|
|
7844
|
+
depsVersions: depsVersions,
|
|
7845
|
+
nodeVersion: parseMajorVersion(process.version)
|
|
7846
|
+
};
|
|
7847
|
+
}
|
|
7848
|
+
function stripQueryAndHashFromPath(path) {
|
|
7849
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
7850
|
+
return path.split("?")[0].split("#")[0];
|
|
7851
|
+
}
|
|
7852
|
+
function replaceBooleanFlagsInCode(code, replacementValues) {
|
|
7853
|
+
var ms = new MagicString(code);
|
|
7854
|
+
Object.keys(replacementValues).forEach(function (key) {
|
|
7855
|
+
var value = replacementValues[key];
|
|
7856
|
+
if (typeof value === "boolean") {
|
|
7857
|
+
ms.replaceAll(key, JSON.stringify(value));
|
|
7858
|
+
}
|
|
7859
|
+
});
|
|
7860
|
+
if (ms.hasChanged()) {
|
|
7861
|
+
return {
|
|
7862
|
+
code: ms.toString(),
|
|
7863
|
+
map: ms.generateMap({
|
|
7864
|
+
hires: "boundary"
|
|
7865
|
+
})
|
|
7866
|
+
};
|
|
7867
|
+
}
|
|
7868
|
+
return null;
|
|
7869
|
+
}
|
|
7870
|
+
|
|
7871
|
+
// https://turbo.build/repo/docs/reference/system-environment-variables#environment-variables-in-tasks
|
|
7872
|
+
function getTurborepoEnvPassthroughWarning(envVarName) {
|
|
7873
|
+
return process.env["TURBO_HASH"] ? "\nYou seem to be using Turborepo, did you forget to put ".concat(envVarName, " in `passThroughEnv`? https://turbo.build/repo/docs/reference/configuration#passthroughenv") : "";
|
|
7874
|
+
}
|
|
7875
|
+
|
|
7876
|
+
var SENTRY_SAAS_URL = "https://sentry.io";
|
|
7877
|
+
function normalizeUserOptions(userOptions) {
|
|
7878
|
+
var _userOptions$org, _userOptions$project, _userOptions$authToke, _ref, _userOptions$url, _userOptions$debug, _userOptions$silent, _userOptions$telemetr, _userOptions$disable, _ref2, _userOptions$release$, _userOptions$release, _userOptions$release$2, _userOptions$release2, _userOptions$release$3, _userOptions$release3, _userOptions$release$4, _userOptions$release4, _ref3, _userOptions$release$5, _userOptions$release5, _userOptions$release6, _userOptions$_metaOpt, _userOptions$_metaOpt2, _userOptions$_experim;
|
|
7879
|
+
var options = {
|
|
7880
|
+
org: (_userOptions$org = userOptions.org) !== null && _userOptions$org !== void 0 ? _userOptions$org : process.env["SENTRY_ORG"],
|
|
7881
|
+
project: (_userOptions$project = userOptions.project) !== null && _userOptions$project !== void 0 ? _userOptions$project : process.env["SENTRY_PROJECT"],
|
|
7882
|
+
authToken: (_userOptions$authToke = userOptions.authToken) !== null && _userOptions$authToke !== void 0 ? _userOptions$authToke : process.env["SENTRY_AUTH_TOKEN"],
|
|
7883
|
+
url: (_ref = (_userOptions$url = userOptions.url) !== null && _userOptions$url !== void 0 ? _userOptions$url : process.env["SENTRY_URL"]) !== null && _ref !== void 0 ? _ref : SENTRY_SAAS_URL,
|
|
7884
|
+
headers: userOptions.headers,
|
|
7885
|
+
debug: (_userOptions$debug = userOptions.debug) !== null && _userOptions$debug !== void 0 ? _userOptions$debug : false,
|
|
7886
|
+
silent: (_userOptions$silent = userOptions.silent) !== null && _userOptions$silent !== void 0 ? _userOptions$silent : false,
|
|
7887
|
+
errorHandler: userOptions.errorHandler,
|
|
7888
|
+
telemetry: (_userOptions$telemetr = userOptions.telemetry) !== null && _userOptions$telemetr !== void 0 ? _userOptions$telemetr : true,
|
|
7889
|
+
disable: (_userOptions$disable = userOptions.disable) !== null && _userOptions$disable !== void 0 ? _userOptions$disable : false,
|
|
7890
|
+
sourcemaps: userOptions.sourcemaps,
|
|
7891
|
+
release: _objectSpread2(_objectSpread2({}, userOptions.release), {}, {
|
|
7892
|
+
name: (_ref2 = (_userOptions$release$ = (_userOptions$release = userOptions.release) === null || _userOptions$release === void 0 ? void 0 : _userOptions$release.name) !== null && _userOptions$release$ !== void 0 ? _userOptions$release$ : process.env["SENTRY_RELEASE"]) !== null && _ref2 !== void 0 ? _ref2 : determineReleaseName(),
|
|
7893
|
+
inject: (_userOptions$release$2 = (_userOptions$release2 = userOptions.release) === null || _userOptions$release2 === void 0 ? void 0 : _userOptions$release2.inject) !== null && _userOptions$release$2 !== void 0 ? _userOptions$release$2 : true,
|
|
7894
|
+
create: (_userOptions$release$3 = (_userOptions$release3 = userOptions.release) === null || _userOptions$release3 === void 0 ? void 0 : _userOptions$release3.create) !== null && _userOptions$release$3 !== void 0 ? _userOptions$release$3 : true,
|
|
7895
|
+
finalize: (_userOptions$release$4 = (_userOptions$release4 = userOptions.release) === null || _userOptions$release4 === void 0 ? void 0 : _userOptions$release4.finalize) !== null && _userOptions$release$4 !== void 0 ? _userOptions$release$4 : true,
|
|
7896
|
+
vcsRemote: (_ref3 = (_userOptions$release$5 = (_userOptions$release5 = userOptions.release) === null || _userOptions$release5 === void 0 ? void 0 : _userOptions$release5.vcsRemote) !== null && _userOptions$release$5 !== void 0 ? _userOptions$release$5 : process.env["SENTRY_VSC_REMOTE"]) !== null && _ref3 !== void 0 ? _ref3 : "origin",
|
|
7897
|
+
setCommits: (_userOptions$release6 = userOptions.release) === null || _userOptions$release6 === void 0 ? void 0 : _userOptions$release6.setCommits
|
|
7898
|
+
}),
|
|
7899
|
+
bundleSizeOptimizations: userOptions.bundleSizeOptimizations,
|
|
7900
|
+
reactComponentAnnotation: userOptions.reactComponentAnnotation,
|
|
7901
|
+
_metaOptions: {
|
|
7902
|
+
telemetry: {
|
|
7903
|
+
metaFramework: (_userOptions$_metaOpt = userOptions._metaOptions) === null || _userOptions$_metaOpt === void 0 ? void 0 : (_userOptions$_metaOpt2 = _userOptions$_metaOpt.telemetry) === null || _userOptions$_metaOpt2 === void 0 ? void 0 : _userOptions$_metaOpt2.metaFramework
|
|
7904
|
+
}
|
|
7905
|
+
},
|
|
7906
|
+
applicationKey: userOptions.applicationKey,
|
|
7907
|
+
moduleMetadata: userOptions.moduleMetadata,
|
|
7908
|
+
_experiments: (_userOptions$_experim = userOptions._experiments) !== null && _userOptions$_experim !== void 0 ? _userOptions$_experim : {}
|
|
7909
|
+
};
|
|
7910
|
+
if (options.release.setCommits === undefined) {
|
|
7911
|
+
if (process.env["VERCEL"] && process.env["VERCEL_GIT_COMMIT_SHA"] && process.env["VERCEL_GIT_REPO_SLUG"] && process.env["VERCEL_GIT_REPO_OWNER"] &&
|
|
7912
|
+
// We only want to set commits for the production env because Sentry becomes extremely noisy (eg on slack) for
|
|
7913
|
+
// preview environments because the previous commit is always the "stem" commit of the preview/PR causing Sentry
|
|
7914
|
+
// to notify you for other people creating PRs.
|
|
7915
|
+
process.env["VERCEL_TARGET_ENV"] === "production") {
|
|
7916
|
+
options.release.setCommits = {
|
|
7917
|
+
shouldNotThrowOnFailure: true,
|
|
7918
|
+
commit: process.env["VERCEL_GIT_COMMIT_SHA"],
|
|
7919
|
+
previousCommit: process.env["VERCEL_GIT_PREVIOUS_SHA"],
|
|
7920
|
+
repo: "".concat(process.env["VERCEL_GIT_REPO_OWNER"], "/").concat(process.env["VERCEL_GIT_REPO_SLUG"]),
|
|
7921
|
+
ignoreEmpty: true,
|
|
7922
|
+
ignoreMissing: true
|
|
7923
|
+
};
|
|
7924
|
+
} else {
|
|
7925
|
+
options.release.setCommits = {
|
|
7926
|
+
shouldNotThrowOnFailure: true,
|
|
7927
|
+
auto: true,
|
|
7928
|
+
ignoreEmpty: true,
|
|
7929
|
+
ignoreMissing: true
|
|
7930
|
+
};
|
|
7931
|
+
}
|
|
7932
7932
|
}
|
|
7933
|
-
|
|
7934
|
-
|
|
7933
|
+
if (options.release.deploy === undefined && process.env["VERCEL"] && process.env["VERCEL_TARGET_ENV"]) {
|
|
7934
|
+
options.release.deploy = {
|
|
7935
|
+
env: "vercel-".concat(process.env["VERCEL_TARGET_ENV"]),
|
|
7936
|
+
url: process.env["VERCEL_URL"] ? "https://".concat(process.env["VERCEL_URL"]) : undefined
|
|
7937
|
+
};
|
|
7938
|
+
}
|
|
7939
|
+
return options;
|
|
7935
7940
|
}
|
|
7936
7941
|
|
|
7937
7942
|
/**
|
|
7938
|
-
*
|
|
7943
|
+
* Validates a few combinations of options that are not checked by Sentry CLI.
|
|
7939
7944
|
*
|
|
7940
|
-
*
|
|
7941
|
-
*
|
|
7942
|
-
*
|
|
7943
|
-
* @see https://github.com/getsentry/sentry-javascript/pull/4196
|
|
7945
|
+
* For all other options, we can rely on Sentry CLI to validate them. In fact,
|
|
7946
|
+
* we can't validate them in the plugin because Sentry CLI might pick up options from
|
|
7947
|
+
* its config file.
|
|
7944
7948
|
*
|
|
7945
|
-
*
|
|
7949
|
+
* @param options the internal options
|
|
7950
|
+
* @param logger the logger
|
|
7946
7951
|
*
|
|
7947
|
-
* @
|
|
7948
|
-
* @param names list of package names
|
|
7952
|
+
* @returns `true` if the options are valid, `false` otherwise
|
|
7949
7953
|
*/
|
|
7950
|
-
function
|
|
7951
|
-
|
|
7952
|
-
|
|
7953
|
-
if (
|
|
7954
|
-
|
|
7955
|
-
|
|
7956
|
-
|
|
7957
|
-
|
|
7958
|
-
|
|
7959
|
-
|
|
7960
|
-
|
|
7961
|
-
};
|
|
7954
|
+
function validateOptions(options, logger) {
|
|
7955
|
+
var _options$release, _options$release2, _options$release3;
|
|
7956
|
+
var setCommits = (_options$release = options.release) === null || _options$release === void 0 ? void 0 : _options$release.setCommits;
|
|
7957
|
+
if (setCommits) {
|
|
7958
|
+
if (!setCommits.auto && !(setCommits.repo && setCommits.commit)) {
|
|
7959
|
+
logger.error("The `setCommits` option was specified but is missing required properties.", "Please set either `auto` or both, `repo` and `commit`.");
|
|
7960
|
+
return false;
|
|
7961
|
+
}
|
|
7962
|
+
if (setCommits.auto && setCommits.repo && setCommits) {
|
|
7963
|
+
logger.warn("The `setCommits` options includes `auto` but also `repo` and `commit`.", "Ignoring `repo` and `commit`.", "Please only set either `auto` or both, `repo` and `commit`.");
|
|
7964
|
+
}
|
|
7962
7965
|
}
|
|
7966
|
+
if ((_options$release2 = options.release) !== null && _options$release2 !== void 0 && _options$release2.deploy && !((_options$release3 = options.release) !== null && _options$release3 !== void 0 && _options$release3.deploy.env)) {
|
|
7967
|
+
logger.error("The `deploy` option was specified but is missing the required `env` property.", "Please set the `env` property.");
|
|
7968
|
+
return false;
|
|
7969
|
+
}
|
|
7970
|
+
return true;
|
|
7971
|
+
}
|
|
7963
7972
|
|
|
7964
|
-
|
|
7973
|
+
// Logging everything to stderr not to interfere with stdout
|
|
7974
|
+
function createLogger(options) {
|
|
7975
|
+
return {
|
|
7976
|
+
info: function info(message) {
|
|
7977
|
+
if (!options.silent) {
|
|
7978
|
+
var _console;
|
|
7979
|
+
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
7980
|
+
params[_key - 1] = arguments[_key];
|
|
7981
|
+
}
|
|
7982
|
+
// eslint-disable-next-line no-console
|
|
7983
|
+
(_console = console).info.apply(_console, ["".concat(options.prefix, " Info: ").concat(message)].concat(params));
|
|
7984
|
+
}
|
|
7985
|
+
},
|
|
7986
|
+
warn: function warn(message) {
|
|
7987
|
+
if (!options.silent) {
|
|
7988
|
+
var _console2;
|
|
7989
|
+
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
7990
|
+
params[_key2 - 1] = arguments[_key2];
|
|
7991
|
+
}
|
|
7992
|
+
// eslint-disable-next-line no-console
|
|
7993
|
+
(_console2 = console).warn.apply(_console2, ["".concat(options.prefix, " Warning: ").concat(message)].concat(params));
|
|
7994
|
+
}
|
|
7995
|
+
},
|
|
7996
|
+
error: function error(message) {
|
|
7997
|
+
if (!options.silent) {
|
|
7998
|
+
var _console3;
|
|
7999
|
+
for (var _len3 = arguments.length, params = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
8000
|
+
params[_key3 - 1] = arguments[_key3];
|
|
8001
|
+
}
|
|
8002
|
+
// eslint-disable-next-line no-console
|
|
8003
|
+
(_console3 = console).error.apply(_console3, ["".concat(options.prefix, " Error: ").concat(message)].concat(params));
|
|
8004
|
+
}
|
|
8005
|
+
},
|
|
8006
|
+
debug: function debug(message) {
|
|
8007
|
+
if (!options.silent && options.debug) {
|
|
8008
|
+
var _console4;
|
|
8009
|
+
for (var _len4 = arguments.length, params = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
|
8010
|
+
params[_key4 - 1] = arguments[_key4];
|
|
8011
|
+
}
|
|
8012
|
+
// eslint-disable-next-line no-console
|
|
8013
|
+
(_console4 = console).debug.apply(_console4, ["".concat(options.prefix, " Debug: ").concat(message)].concat(params));
|
|
8014
|
+
}
|
|
8015
|
+
}
|
|
8016
|
+
};
|
|
7965
8017
|
}
|
|
7966
8018
|
|
|
7967
8019
|
// Estimated maximum size for reasonable standalone event
|
|
@@ -8095,7 +8147,7 @@ function makeOptionallyEnabledNodeTransport(shouldSendTelemetry) {
|
|
|
8095
8147
|
|
|
8096
8148
|
var SENTRY_SAAS_HOSTNAME = "sentry.io";
|
|
8097
8149
|
var stackParser = createStackParser(nodeStackLineParser());
|
|
8098
|
-
function createSentryInstance(options, shouldSendTelemetry,
|
|
8150
|
+
function createSentryInstance(options, shouldSendTelemetry, buildTool) {
|
|
8099
8151
|
var clientOptions = {
|
|
8100
8152
|
platform: "node",
|
|
8101
8153
|
runtime: {
|
|
@@ -8105,7 +8157,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
8105
8157
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
8106
8158
|
tracesSampleRate: 1,
|
|
8107
8159
|
sampleRate: 1,
|
|
8108
|
-
release: "3.
|
|
8160
|
+
release: "3.4.0",
|
|
8109
8161
|
integrations: [],
|
|
8110
8162
|
tracePropagationTargets: ["sentry.io/api"],
|
|
8111
8163
|
stackParser: stackParser,
|
|
@@ -8129,13 +8181,13 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
8129
8181
|
var client = new ServerRuntimeClient(clientOptions);
|
|
8130
8182
|
var scope = new Scope();
|
|
8131
8183
|
scope.setClient(client);
|
|
8132
|
-
setTelemetryDataOnScope(options, scope,
|
|
8184
|
+
setTelemetryDataOnScope(options, scope, buildTool);
|
|
8133
8185
|
return {
|
|
8134
8186
|
sentryScope: scope,
|
|
8135
8187
|
sentryClient: client
|
|
8136
8188
|
};
|
|
8137
8189
|
}
|
|
8138
|
-
function setTelemetryDataOnScope(options, scope,
|
|
8190
|
+
function setTelemetryDataOnScope(options, scope, buildTool) {
|
|
8139
8191
|
var _options$_metaOptions;
|
|
8140
8192
|
var org = options.org,
|
|
8141
8193
|
project = options.project,
|
|
@@ -8173,7 +8225,7 @@ function setTelemetryDataOnScope(options, scope, bundler) {
|
|
|
8173
8225
|
scope.setTags({
|
|
8174
8226
|
organization: org,
|
|
8175
8227
|
project: project,
|
|
8176
|
-
bundler:
|
|
8228
|
+
bundler: buildTool
|
|
8177
8229
|
});
|
|
8178
8230
|
scope.setUser({
|
|
8179
8231
|
id: org
|
|
@@ -8270,297 +8322,26 @@ function _safeFlushTelemetry() {
|
|
|
8270
8322
|
}
|
|
8271
8323
|
|
|
8272
8324
|
function createDebugIdUploadFunction(_ref) {
|
|
8273
|
-
var
|
|
8274
|
-
ignore = _ref.ignore,
|
|
8275
|
-
logger = _ref.logger,
|
|
8276
|
-
releaseName = _ref.releaseName,
|
|
8277
|
-
dist = _ref.dist,
|
|
8278
|
-
handleRecoverableError = _ref.handleRecoverableError,
|
|
8279
|
-
sentryScope = _ref.sentryScope,
|
|
8280
|
-
sentryClient = _ref.sentryClient,
|
|
8281
|
-
sentryCliOptions = _ref.sentryCliOptions,
|
|
8282
|
-
rewriteSourcesHook = _ref.rewriteSourcesHook,
|
|
8283
|
-
createDependencyOnSourcemapFiles = _ref.createDependencyOnSourcemapFiles;
|
|
8284
|
-
var freeGlobalDependencyOnSourcemapFiles = createDependencyOnSourcemapFiles();
|
|
8325
|
+
var sentryBuildPluginManager = _ref.sentryBuildPluginManager;
|
|
8285
8326
|
return /*#__PURE__*/function () {
|
|
8286
|
-
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8287
|
-
return _regeneratorRuntime().wrap(function
|
|
8288
|
-
while (1) switch (
|
|
8327
|
+
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(buildArtifactPaths) {
|
|
8328
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8329
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8289
8330
|
case 0:
|
|
8290
|
-
|
|
8291
|
-
return
|
|
8292
|
-
// This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
|
|
8293
|
-
{
|
|
8294
|
-
name: "debug-id-sourcemap-upload",
|
|
8295
|
-
scope: sentryScope,
|
|
8296
|
-
forceTransaction: true
|
|
8297
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8() {
|
|
8298
|
-
var folderToCleanUp, freeUploadDependencyOnSourcemapFiles, tmpUploadFolder, globAssets, globResult, debugIdChunkFilePaths;
|
|
8299
|
-
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
8300
|
-
while (1) switch (_context8.prev = _context8.next) {
|
|
8301
|
-
case 0:
|
|
8302
|
-
// It is possible that this writeBundle hook (which calls this function) is called multiple times in one build (for example when reusing the plugin, or when using build tooling like `@vitejs/plugin-legacy`)
|
|
8303
|
-
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
8304
|
-
freeUploadDependencyOnSourcemapFiles = createDependencyOnSourcemapFiles();
|
|
8305
|
-
_context8.prev = 1;
|
|
8306
|
-
_context8.next = 4;
|
|
8307
|
-
return startSpan({
|
|
8308
|
-
name: "mkdtemp",
|
|
8309
|
-
scope: sentryScope
|
|
8310
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8311
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8312
|
-
while (1) switch (_context.prev = _context.next) {
|
|
8313
|
-
case 0:
|
|
8314
|
-
_context.next = 2;
|
|
8315
|
-
return fs__default.promises.mkdtemp(path__default.join(os.tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
8316
|
-
case 2:
|
|
8317
|
-
return _context.abrupt("return", _context.sent);
|
|
8318
|
-
case 3:
|
|
8319
|
-
case "end":
|
|
8320
|
-
return _context.stop();
|
|
8321
|
-
}
|
|
8322
|
-
}, _callee);
|
|
8323
|
-
})));
|
|
8324
|
-
case 4:
|
|
8325
|
-
tmpUploadFolder = _context8.sent;
|
|
8326
|
-
folderToCleanUp = tmpUploadFolder;
|
|
8327
|
-
if (assets) {
|
|
8328
|
-
globAssets = assets;
|
|
8329
|
-
} else {
|
|
8330
|
-
logger.debug("No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.");
|
|
8331
|
-
globAssets = buildArtifactPaths;
|
|
8332
|
-
}
|
|
8333
|
-
_context8.next = 9;
|
|
8334
|
-
return startSpan({
|
|
8335
|
-
name: "glob",
|
|
8336
|
-
scope: sentryScope
|
|
8337
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8338
|
-
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8339
|
-
while (1) switch (_context2.prev = _context2.next) {
|
|
8340
|
-
case 0:
|
|
8341
|
-
_context2.next = 2;
|
|
8342
|
-
return glob(globAssets, {
|
|
8343
|
-
absolute: true,
|
|
8344
|
-
nodir: true,
|
|
8345
|
-
ignore: ignore
|
|
8346
|
-
});
|
|
8347
|
-
case 2:
|
|
8348
|
-
return _context2.abrupt("return", _context2.sent);
|
|
8349
|
-
case 3:
|
|
8350
|
-
case "end":
|
|
8351
|
-
return _context2.stop();
|
|
8352
|
-
}
|
|
8353
|
-
}, _callee2);
|
|
8354
|
-
})));
|
|
8355
|
-
case 9:
|
|
8356
|
-
globResult = _context8.sent;
|
|
8357
|
-
debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
|
|
8358
|
-
return !!stripQueryAndHashFromPath(debugIdChunkFilePath).match(/\.(js|mjs|cjs)$/);
|
|
8359
|
-
}); // The order of the files output by glob() is not deterministic
|
|
8360
|
-
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
8361
|
-
debugIdChunkFilePaths.sort();
|
|
8362
|
-
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
8363
|
-
_context8.next = 16;
|
|
8364
|
-
break;
|
|
8365
|
-
}
|
|
8366
|
-
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
8367
|
-
_context8.next = 23;
|
|
8368
|
-
break;
|
|
8369
|
-
case 16:
|
|
8370
|
-
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
8371
|
-
_context8.next = 20;
|
|
8372
|
-
break;
|
|
8373
|
-
}
|
|
8374
|
-
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
8375
|
-
_context8.next = 23;
|
|
8376
|
-
break;
|
|
8377
|
-
case 20:
|
|
8378
|
-
_context8.next = 22;
|
|
8379
|
-
return startSpan({
|
|
8380
|
-
name: "prepare-bundles",
|
|
8381
|
-
scope: sentryScope
|
|
8382
|
-
}, /*#__PURE__*/function () {
|
|
8383
|
-
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6(prepBundlesSpan) {
|
|
8384
|
-
var preparationTasks, workers, worker, workerIndex, files, stats, uploadSize;
|
|
8385
|
-
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
8386
|
-
while (1) switch (_context6.prev = _context6.next) {
|
|
8387
|
-
case 0:
|
|
8388
|
-
// Preparing the bundles can be a lot of work and doing it all at once has the potential of nuking the heap so
|
|
8389
|
-
// instead we do it with a maximum of 16 concurrent workers
|
|
8390
|
-
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
8391
|
-
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
8392
|
-
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8393
|
-
while (1) switch (_context3.prev = _context3.next) {
|
|
8394
|
-
case 0:
|
|
8395
|
-
_context3.next = 2;
|
|
8396
|
-
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, rewriteSourcesHook !== null && rewriteSourcesHook !== void 0 ? rewriteSourcesHook : defaultRewriteSourcesHook);
|
|
8397
|
-
case 2:
|
|
8398
|
-
case "end":
|
|
8399
|
-
return _context3.stop();
|
|
8400
|
-
}
|
|
8401
|
-
}, _callee3);
|
|
8402
|
-
}));
|
|
8403
|
-
});
|
|
8404
|
-
workers = [];
|
|
8405
|
-
worker = /*#__PURE__*/function () {
|
|
8406
|
-
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
8407
|
-
var task;
|
|
8408
|
-
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8409
|
-
while (1) switch (_context4.prev = _context4.next) {
|
|
8410
|
-
case 0:
|
|
8411
|
-
if (!(preparationTasks.length > 0)) {
|
|
8412
|
-
_context4.next = 7;
|
|
8413
|
-
break;
|
|
8414
|
-
}
|
|
8415
|
-
task = preparationTasks.shift();
|
|
8416
|
-
if (!task) {
|
|
8417
|
-
_context4.next = 5;
|
|
8418
|
-
break;
|
|
8419
|
-
}
|
|
8420
|
-
_context4.next = 5;
|
|
8421
|
-
return task();
|
|
8422
|
-
case 5:
|
|
8423
|
-
_context4.next = 0;
|
|
8424
|
-
break;
|
|
8425
|
-
case 7:
|
|
8426
|
-
case "end":
|
|
8427
|
-
return _context4.stop();
|
|
8428
|
-
}
|
|
8429
|
-
}, _callee4);
|
|
8430
|
-
}));
|
|
8431
|
-
return function worker() {
|
|
8432
|
-
return _ref8.apply(this, arguments);
|
|
8433
|
-
};
|
|
8434
|
-
}();
|
|
8435
|
-
for (workerIndex = 0; workerIndex < 16; workerIndex++) {
|
|
8436
|
-
workers.push(worker());
|
|
8437
|
-
}
|
|
8438
|
-
_context6.next = 6;
|
|
8439
|
-
return Promise.all(workers);
|
|
8440
|
-
case 6:
|
|
8441
|
-
_context6.next = 8;
|
|
8442
|
-
return fs__default.promises.readdir(tmpUploadFolder);
|
|
8443
|
-
case 8:
|
|
8444
|
-
files = _context6.sent;
|
|
8445
|
-
stats = files.map(function (file) {
|
|
8446
|
-
return fs__default.promises.stat(path__default.join(tmpUploadFolder, file));
|
|
8447
|
-
});
|
|
8448
|
-
_context6.next = 12;
|
|
8449
|
-
return Promise.all(stats);
|
|
8450
|
-
case 12:
|
|
8451
|
-
uploadSize = _context6.sent.reduce(function (accumulator, _ref9) {
|
|
8452
|
-
var size = _ref9.size;
|
|
8453
|
-
return accumulator + size;
|
|
8454
|
-
}, 0);
|
|
8455
|
-
setMeasurement("files", files.length, "none", prepBundlesSpan);
|
|
8456
|
-
setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
|
|
8457
|
-
_context6.next = 17;
|
|
8458
|
-
return startSpan({
|
|
8459
|
-
name: "upload",
|
|
8460
|
-
scope: sentryScope
|
|
8461
|
-
}, /*#__PURE__*/function () {
|
|
8462
|
-
var _ref10 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(uploadSpan) {
|
|
8463
|
-
var cliInstance;
|
|
8464
|
-
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
8465
|
-
while (1) switch (_context5.prev = _context5.next) {
|
|
8466
|
-
case 0:
|
|
8467
|
-
cliInstance = new SentryCli(null, _objectSpread2(_objectSpread2({}, sentryCliOptions), {}, {
|
|
8468
|
-
headers: _objectSpread2({
|
|
8469
|
-
"sentry-trace": spanToTraceHeader(uploadSpan),
|
|
8470
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8471
|
-
baggage: dynamicSamplingContextToSentryBaggageHeader(getDynamicSamplingContextFromSpan(uploadSpan))
|
|
8472
|
-
}, sentryCliOptions.headers)
|
|
8473
|
-
}));
|
|
8474
|
-
_context5.next = 3;
|
|
8475
|
-
return cliInstance.releases.uploadSourceMaps(releaseName !== null && releaseName !== void 0 ? releaseName : "undefined",
|
|
8476
|
-
// unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
8477
|
-
{
|
|
8478
|
-
include: [{
|
|
8479
|
-
paths: [tmpUploadFolder],
|
|
8480
|
-
rewrite: false,
|
|
8481
|
-
dist: dist
|
|
8482
|
-
}]
|
|
8483
|
-
});
|
|
8484
|
-
case 3:
|
|
8485
|
-
case "end":
|
|
8486
|
-
return _context5.stop();
|
|
8487
|
-
}
|
|
8488
|
-
}, _callee5);
|
|
8489
|
-
}));
|
|
8490
|
-
return function (_x3) {
|
|
8491
|
-
return _ref10.apply(this, arguments);
|
|
8492
|
-
};
|
|
8493
|
-
}());
|
|
8494
|
-
case 17:
|
|
8495
|
-
case "end":
|
|
8496
|
-
return _context6.stop();
|
|
8497
|
-
}
|
|
8498
|
-
}, _callee6);
|
|
8499
|
-
}));
|
|
8500
|
-
return function (_x2) {
|
|
8501
|
-
return _ref6.apply(this, arguments);
|
|
8502
|
-
};
|
|
8503
|
-
}());
|
|
8504
|
-
case 22:
|
|
8505
|
-
logger.info("Successfully uploaded source maps to Sentry");
|
|
8506
|
-
case 23:
|
|
8507
|
-
_context8.next = 29;
|
|
8508
|
-
break;
|
|
8509
|
-
case 25:
|
|
8510
|
-
_context8.prev = 25;
|
|
8511
|
-
_context8.t0 = _context8["catch"](1);
|
|
8512
|
-
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
8513
|
-
handleRecoverableError(_context8.t0, false);
|
|
8514
|
-
case 29:
|
|
8515
|
-
_context8.prev = 29;
|
|
8516
|
-
if (folderToCleanUp) {
|
|
8517
|
-
void startSpan({
|
|
8518
|
-
name: "cleanup",
|
|
8519
|
-
scope: sentryScope
|
|
8520
|
-
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {
|
|
8521
|
-
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
8522
|
-
while (1) switch (_context7.prev = _context7.next) {
|
|
8523
|
-
case 0:
|
|
8524
|
-
if (!folderToCleanUp) {
|
|
8525
|
-
_context7.next = 3;
|
|
8526
|
-
break;
|
|
8527
|
-
}
|
|
8528
|
-
_context7.next = 3;
|
|
8529
|
-
return fs__default.promises.rm(folderToCleanUp, {
|
|
8530
|
-
recursive: true,
|
|
8531
|
-
force: true
|
|
8532
|
-
});
|
|
8533
|
-
case 3:
|
|
8534
|
-
case "end":
|
|
8535
|
-
return _context7.stop();
|
|
8536
|
-
}
|
|
8537
|
-
}, _callee7);
|
|
8538
|
-
})));
|
|
8539
|
-
}
|
|
8540
|
-
freeGlobalDependencyOnSourcemapFiles();
|
|
8541
|
-
freeUploadDependencyOnSourcemapFiles();
|
|
8542
|
-
_context8.next = 35;
|
|
8543
|
-
return safeFlushTelemetry(sentryClient);
|
|
8544
|
-
case 35:
|
|
8545
|
-
return _context8.finish(29);
|
|
8546
|
-
case 36:
|
|
8547
|
-
case "end":
|
|
8548
|
-
return _context8.stop();
|
|
8549
|
-
}
|
|
8550
|
-
}, _callee8, null, [[1, 25, 29, 36]]);
|
|
8551
|
-
})));
|
|
8331
|
+
_context.next = 2;
|
|
8332
|
+
return sentryBuildPluginManager.uploadSourcemaps(buildArtifactPaths);
|
|
8552
8333
|
case 2:
|
|
8553
8334
|
case "end":
|
|
8554
|
-
return
|
|
8335
|
+
return _context.stop();
|
|
8555
8336
|
}
|
|
8556
|
-
},
|
|
8337
|
+
}, _callee);
|
|
8557
8338
|
}));
|
|
8558
8339
|
return function (_x) {
|
|
8559
8340
|
return _ref2.apply(this, arguments);
|
|
8560
8341
|
};
|
|
8561
8342
|
}();
|
|
8562
8343
|
}
|
|
8563
|
-
function prepareBundleForDebugIdUpload(
|
|
8344
|
+
function prepareBundleForDebugIdUpload(_x2, _x3, _x4, _x5, _x6) {
|
|
8564
8345
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
8565
8346
|
}
|
|
8566
8347
|
|
|
@@ -8571,66 +8352,66 @@ function prepareBundleForDebugIdUpload(_x4, _x5, _x6, _x7, _x8) {
|
|
|
8571
8352
|
* The string pattern is injected via the debug ID injection snipped.
|
|
8572
8353
|
*/
|
|
8573
8354
|
function _prepareBundleForDebugIdUpload() {
|
|
8574
|
-
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8355
|
+
_prepareBundleForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(bundleFilePath, uploadFolder, chunkIndex, logger, rewriteSourcesHook) {
|
|
8575
8356
|
var bundleContent, debugId, uniqueUploadName, writeSourceFilePromise, writeSourceMapFilePromise;
|
|
8576
|
-
return _regeneratorRuntime().wrap(function
|
|
8577
|
-
while (1) switch (
|
|
8357
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
8358
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
8578
8359
|
case 0:
|
|
8579
|
-
|
|
8580
|
-
|
|
8360
|
+
_context3.prev = 0;
|
|
8361
|
+
_context3.next = 3;
|
|
8581
8362
|
return promisify(fs__default.readFile)(bundleFilePath, "utf8");
|
|
8582
8363
|
case 3:
|
|
8583
|
-
bundleContent =
|
|
8584
|
-
|
|
8364
|
+
bundleContent = _context3.sent;
|
|
8365
|
+
_context3.next = 10;
|
|
8585
8366
|
break;
|
|
8586
8367
|
case 6:
|
|
8587
|
-
|
|
8588
|
-
|
|
8589
|
-
logger.error("Could not read bundle to determine debug ID and source map: ".concat(bundleFilePath),
|
|
8590
|
-
return
|
|
8368
|
+
_context3.prev = 6;
|
|
8369
|
+
_context3.t0 = _context3["catch"](0);
|
|
8370
|
+
logger.error("Could not read bundle to determine debug ID and source map: ".concat(bundleFilePath), _context3.t0);
|
|
8371
|
+
return _context3.abrupt("return");
|
|
8591
8372
|
case 10:
|
|
8592
8373
|
debugId = determineDebugIdFromBundleSource(bundleContent);
|
|
8593
8374
|
if (!(debugId === undefined)) {
|
|
8594
|
-
|
|
8375
|
+
_context3.next = 14;
|
|
8595
8376
|
break;
|
|
8596
8377
|
}
|
|
8597
8378
|
logger.debug("Could not determine debug ID from bundle. This can happen if you did not clean your output folder before installing the Sentry plugin. File will not be source mapped: ".concat(bundleFilePath));
|
|
8598
|
-
return
|
|
8379
|
+
return _context3.abrupt("return");
|
|
8599
8380
|
case 14:
|
|
8600
8381
|
uniqueUploadName = "".concat(debugId, "-").concat(chunkIndex);
|
|
8601
|
-
bundleContent
|
|
8382
|
+
bundleContent = addDebugIdToBundleSource(bundleContent, debugId);
|
|
8602
8383
|
writeSourceFilePromise = fs__default.promises.writeFile(path__default.join(uploadFolder, "".concat(uniqueUploadName, ".js")), bundleContent, "utf-8");
|
|
8603
8384
|
writeSourceMapFilePromise = determineSourceMapPathFromBundle(bundleFilePath, bundleContent, logger).then( /*#__PURE__*/function () {
|
|
8604
|
-
var
|
|
8605
|
-
return _regeneratorRuntime().wrap(function
|
|
8606
|
-
while (1) switch (
|
|
8385
|
+
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(sourceMapPath) {
|
|
8386
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8387
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8607
8388
|
case 0:
|
|
8608
8389
|
if (!sourceMapPath) {
|
|
8609
|
-
|
|
8390
|
+
_context2.next = 3;
|
|
8610
8391
|
break;
|
|
8611
8392
|
}
|
|
8612
|
-
|
|
8393
|
+
_context2.next = 3;
|
|
8613
8394
|
return prepareSourceMapForDebugIdUpload(sourceMapPath, path__default.join(uploadFolder, "".concat(uniqueUploadName, ".js.map")), debugId, rewriteSourcesHook, logger);
|
|
8614
8395
|
case 3:
|
|
8615
8396
|
case "end":
|
|
8616
|
-
return
|
|
8397
|
+
return _context2.stop();
|
|
8617
8398
|
}
|
|
8618
|
-
},
|
|
8399
|
+
}, _callee2);
|
|
8619
8400
|
}));
|
|
8620
|
-
return function (
|
|
8621
|
-
return
|
|
8401
|
+
return function (_x15) {
|
|
8402
|
+
return _ref3.apply(this, arguments);
|
|
8622
8403
|
};
|
|
8623
8404
|
}());
|
|
8624
|
-
|
|
8405
|
+
_context3.next = 20;
|
|
8625
8406
|
return writeSourceFilePromise;
|
|
8626
8407
|
case 20:
|
|
8627
|
-
|
|
8408
|
+
_context3.next = 22;
|
|
8628
8409
|
return writeSourceMapFilePromise;
|
|
8629
8410
|
case 22:
|
|
8630
8411
|
case "end":
|
|
8631
|
-
return
|
|
8412
|
+
return _context3.stop();
|
|
8632
8413
|
}
|
|
8633
|
-
},
|
|
8414
|
+
}, _callee3, null, [[0, 6]]);
|
|
8634
8415
|
}));
|
|
8635
8416
|
return _prepareBundleForDebugIdUpload.apply(this, arguments);
|
|
8636
8417
|
}
|
|
@@ -8642,28 +8423,39 @@ function determineDebugIdFromBundleSource(code) {
|
|
|
8642
8423
|
return undefined;
|
|
8643
8424
|
}
|
|
8644
8425
|
}
|
|
8426
|
+
var SPEC_LAST_DEBUG_ID_REGEX = /\/\/# debugId=([a-fA-F0-9-]+)(?![\s\S]*\/\/# debugId=)/m;
|
|
8427
|
+
function hasSpecCompliantDebugId(bundleSource) {
|
|
8428
|
+
return SPEC_LAST_DEBUG_ID_REGEX.test(bundleSource);
|
|
8429
|
+
}
|
|
8430
|
+
function addDebugIdToBundleSource(bundleSource, debugId) {
|
|
8431
|
+
if (hasSpecCompliantDebugId(bundleSource)) {
|
|
8432
|
+
return bundleSource.replace(SPEC_LAST_DEBUG_ID_REGEX, "//# debugId=".concat(debugId));
|
|
8433
|
+
} else {
|
|
8434
|
+
return "".concat(bundleSource, "\n//# debugId=").concat(debugId);
|
|
8435
|
+
}
|
|
8436
|
+
}
|
|
8645
8437
|
|
|
8646
8438
|
/**
|
|
8647
8439
|
* Applies a set of heuristics to find the source map for a particular bundle.
|
|
8648
8440
|
*
|
|
8649
8441
|
* @returns the path to the bundle's source map or `undefined` if none could be found.
|
|
8650
8442
|
*/
|
|
8651
|
-
function determineSourceMapPathFromBundle(
|
|
8443
|
+
function determineSourceMapPathFromBundle(_x7, _x8, _x9) {
|
|
8652
8444
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
8653
8445
|
}
|
|
8654
8446
|
/**
|
|
8655
8447
|
* Reads a source map, injects debug ID fields, and writes the source map to the target path.
|
|
8656
8448
|
*/
|
|
8657
8449
|
function _determineSourceMapPathFromBundle() {
|
|
8658
|
-
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8450
|
+
_determineSourceMapPathFromBundle = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(bundlePath, bundleSource, logger) {
|
|
8659
8451
|
var sourceMappingUrlMatch, sourceMappingUrl, isUrl, isSupportedUrl, url, absoluteSourceMapPath, adjacentSourceMapFilePath;
|
|
8660
|
-
return _regeneratorRuntime().wrap(function
|
|
8661
|
-
while (1) switch (
|
|
8452
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
8453
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
8662
8454
|
case 0:
|
|
8663
8455
|
// 1. try to find source map at `sourceMappingURL` location
|
|
8664
8456
|
sourceMappingUrlMatch = bundleSource.match(/^\s*\/\/# sourceMappingURL=(.*)$/m);
|
|
8665
8457
|
if (!sourceMappingUrlMatch) {
|
|
8666
|
-
|
|
8458
|
+
_context4.next = 14;
|
|
8667
8459
|
break;
|
|
8668
8460
|
}
|
|
8669
8461
|
sourceMappingUrl = path__default.normalize(sourceMappingUrlMatch[1]);
|
|
@@ -8683,156 +8475,435 @@ function _determineSourceMapPathFromBundle() {
|
|
|
8683
8475
|
absoluteSourceMapPath = path__default.join(path__default.dirname(bundlePath), sourceMappingUrl);
|
|
8684
8476
|
}
|
|
8685
8477
|
if (!absoluteSourceMapPath) {
|
|
8686
|
-
|
|
8478
|
+
_context4.next = 14;
|
|
8687
8479
|
break;
|
|
8688
8480
|
}
|
|
8689
|
-
|
|
8690
|
-
|
|
8481
|
+
_context4.prev = 6;
|
|
8482
|
+
_context4.next = 9;
|
|
8691
8483
|
return util.promisify(fs__default.access)(absoluteSourceMapPath);
|
|
8692
8484
|
case 9:
|
|
8693
|
-
return
|
|
8485
|
+
return _context4.abrupt("return", absoluteSourceMapPath);
|
|
8694
8486
|
case 12:
|
|
8695
|
-
|
|
8696
|
-
|
|
8487
|
+
_context4.prev = 12;
|
|
8488
|
+
_context4.t0 = _context4["catch"](6);
|
|
8697
8489
|
case 14:
|
|
8698
|
-
|
|
8490
|
+
_context4.prev = 14;
|
|
8699
8491
|
adjacentSourceMapFilePath = bundlePath + ".map";
|
|
8700
|
-
|
|
8492
|
+
_context4.next = 18;
|
|
8701
8493
|
return util.promisify(fs__default.access)(adjacentSourceMapFilePath);
|
|
8702
8494
|
case 18:
|
|
8703
|
-
return
|
|
8495
|
+
return _context4.abrupt("return", adjacentSourceMapFilePath);
|
|
8704
8496
|
case 21:
|
|
8705
|
-
|
|
8706
|
-
|
|
8497
|
+
_context4.prev = 21;
|
|
8498
|
+
_context4.t1 = _context4["catch"](14);
|
|
8707
8499
|
case 23:
|
|
8708
8500
|
// This is just a debug message because it can be quite spammy for some frameworks
|
|
8709
8501
|
logger.debug("Could not determine source map path for bundle: ".concat(bundlePath, " - Did you turn on source map generation in your bundler?"));
|
|
8710
|
-
return
|
|
8502
|
+
return _context4.abrupt("return", undefined);
|
|
8711
8503
|
case 25:
|
|
8712
8504
|
case "end":
|
|
8713
|
-
return
|
|
8505
|
+
return _context4.stop();
|
|
8714
8506
|
}
|
|
8715
|
-
},
|
|
8507
|
+
}, _callee4, null, [[6, 12], [14, 21]]);
|
|
8716
8508
|
}));
|
|
8717
8509
|
return _determineSourceMapPathFromBundle.apply(this, arguments);
|
|
8718
8510
|
}
|
|
8719
|
-
function prepareSourceMapForDebugIdUpload(
|
|
8511
|
+
function prepareSourceMapForDebugIdUpload(_x10, _x11, _x12, _x13, _x14) {
|
|
8720
8512
|
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
8721
8513
|
}
|
|
8722
8514
|
function _prepareSourceMapForDebugIdUpload() {
|
|
8723
|
-
_prepareSourceMapForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
8515
|
+
_prepareSourceMapForDebugIdUpload = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(sourceMapPath, targetPath, debugId, rewriteSourcesHook, logger) {
|
|
8724
8516
|
var sourceMapFileContent, map;
|
|
8725
|
-
return _regeneratorRuntime().wrap(function
|
|
8726
|
-
while (1) switch (
|
|
8517
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
8518
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
8727
8519
|
case 0:
|
|
8728
|
-
|
|
8729
|
-
|
|
8520
|
+
_context5.prev = 0;
|
|
8521
|
+
_context5.next = 3;
|
|
8730
8522
|
return util.promisify(fs__default.readFile)(sourceMapPath, {
|
|
8731
8523
|
encoding: "utf8"
|
|
8732
8524
|
});
|
|
8733
8525
|
case 3:
|
|
8734
|
-
sourceMapFileContent =
|
|
8735
|
-
|
|
8526
|
+
sourceMapFileContent = _context5.sent;
|
|
8527
|
+
_context5.next = 10;
|
|
8736
8528
|
break;
|
|
8737
8529
|
case 6:
|
|
8738
|
-
|
|
8739
|
-
|
|
8740
|
-
logger.error("Failed to read source map for debug ID upload: ".concat(sourceMapPath),
|
|
8741
|
-
return
|
|
8530
|
+
_context5.prev = 6;
|
|
8531
|
+
_context5.t0 = _context5["catch"](0);
|
|
8532
|
+
logger.error("Failed to read source map for debug ID upload: ".concat(sourceMapPath), _context5.t0);
|
|
8533
|
+
return _context5.abrupt("return");
|
|
8742
8534
|
case 10:
|
|
8743
|
-
|
|
8535
|
+
_context5.prev = 10;
|
|
8744
8536
|
map = JSON.parse(sourceMapFileContent);
|
|
8745
8537
|
// For now we write both fields until we know what will become the standard - if ever.
|
|
8746
8538
|
map["debug_id"] = debugId;
|
|
8747
8539
|
map["debugId"] = debugId;
|
|
8748
|
-
|
|
8540
|
+
_context5.next = 20;
|
|
8749
8541
|
break;
|
|
8750
8542
|
case 16:
|
|
8751
|
-
|
|
8752
|
-
|
|
8543
|
+
_context5.prev = 16;
|
|
8544
|
+
_context5.t1 = _context5["catch"](10);
|
|
8753
8545
|
logger.error("Failed to parse source map for debug ID upload: ".concat(sourceMapPath));
|
|
8754
|
-
return
|
|
8546
|
+
return _context5.abrupt("return");
|
|
8755
8547
|
case 20:
|
|
8756
8548
|
if (map["sources"] && Array.isArray(map["sources"])) {
|
|
8757
8549
|
map["sources"] = map["sources"].map(function (source) {
|
|
8758
8550
|
return rewriteSourcesHook(source, map);
|
|
8759
8551
|
});
|
|
8760
8552
|
}
|
|
8761
|
-
|
|
8762
|
-
|
|
8553
|
+
_context5.prev = 21;
|
|
8554
|
+
_context5.next = 24;
|
|
8763
8555
|
return util.promisify(fs__default.writeFile)(targetPath, JSON.stringify(map), {
|
|
8764
8556
|
encoding: "utf8"
|
|
8765
8557
|
});
|
|
8766
8558
|
case 24:
|
|
8767
|
-
|
|
8559
|
+
_context5.next = 30;
|
|
8768
8560
|
break;
|
|
8769
8561
|
case 26:
|
|
8770
|
-
|
|
8771
|
-
|
|
8772
|
-
logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath),
|
|
8773
|
-
return
|
|
8562
|
+
_context5.prev = 26;
|
|
8563
|
+
_context5.t2 = _context5["catch"](21);
|
|
8564
|
+
logger.error("Failed to prepare source map for debug ID upload: ".concat(sourceMapPath), _context5.t2);
|
|
8565
|
+
return _context5.abrupt("return");
|
|
8774
8566
|
case 30:
|
|
8775
8567
|
case "end":
|
|
8776
|
-
return
|
|
8568
|
+
return _context5.stop();
|
|
8569
|
+
}
|
|
8570
|
+
}, _callee5, null, [[0, 6], [10, 16], [21, 26]]);
|
|
8571
|
+
}));
|
|
8572
|
+
return _prepareSourceMapForDebugIdUpload.apply(this, arguments);
|
|
8573
|
+
}
|
|
8574
|
+
var PROTOCOL_REGEX = /^[a-zA-Z][a-zA-Z0-9+\-.]*:\/\//;
|
|
8575
|
+
function defaultRewriteSourcesHook(source) {
|
|
8576
|
+
if (source.match(PROTOCOL_REGEX)) {
|
|
8577
|
+
return source.replace(PROTOCOL_REGEX, "");
|
|
8578
|
+
} else {
|
|
8579
|
+
return path__default.relative(process.cwd(), path__default.normalize(source));
|
|
8580
|
+
}
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
/**
|
|
8584
|
+
* Creates a build plugin manager that exposes primitives for everything that a Sentry JavaScript SDK or build tooling may do during a build.
|
|
8585
|
+
*
|
|
8586
|
+
* The build plugin manager's behavior strongly depends on the options that are passed in.
|
|
8587
|
+
*/
|
|
8588
|
+
function createSentryBuildPluginManager(userOptions, bundlerPluginMetaContext) {
|
|
8589
|
+
var _userOptions$silent, _userOptions$debug;
|
|
8590
|
+
var logger = createLogger({
|
|
8591
|
+
prefix: bundlerPluginMetaContext.loggerPrefix,
|
|
8592
|
+
silent: (_userOptions$silent = userOptions.silent) !== null && _userOptions$silent !== void 0 ? _userOptions$silent : false,
|
|
8593
|
+
debug: (_userOptions$debug = userOptions.debug) !== null && _userOptions$debug !== void 0 ? _userOptions$debug : false
|
|
8594
|
+
});
|
|
8595
|
+
try {
|
|
8596
|
+
var dotenvFile = fs.readFileSync(path.join(process.cwd(), ".env.sentry-build-plugin"), "utf-8");
|
|
8597
|
+
// NOTE: Do not use the dotenv.config API directly to read the dotenv file! For some ungodly reason, it falls back to reading `${process.cwd()}/.env` which is absolutely not what we want.
|
|
8598
|
+
var dotenvResult = dotenv.parse(dotenvFile);
|
|
8599
|
+
|
|
8600
|
+
// Vite has a bug/behaviour where spreading into process.env will cause it to crash
|
|
8601
|
+
// https://github.com/vitest-dev/vitest/issues/1870#issuecomment-1501140251
|
|
8602
|
+
Object.assign(process.env, dotenvResult);
|
|
8603
|
+
logger.info('Using environment variables configured in ".env.sentry-build-plugin".');
|
|
8604
|
+
} catch (e) {
|
|
8605
|
+
// Ignore "file not found" errors but throw all others
|
|
8606
|
+
if (_typeof(e) === "object" && e && "code" in e && e.code !== "ENOENT") {
|
|
8607
|
+
throw e;
|
|
8608
|
+
}
|
|
8609
|
+
}
|
|
8610
|
+
var options = normalizeUserOptions(userOptions);
|
|
8611
|
+
var shouldSendTelemetry = allowedToSendTelemetry(options);
|
|
8612
|
+
var _createSentryInstance = createSentryInstance(options, shouldSendTelemetry, bundlerPluginMetaContext.buildTool),
|
|
8613
|
+
sentryScope = _createSentryInstance.sentryScope,
|
|
8614
|
+
sentryClient = _createSentryInstance.sentryClient;
|
|
8615
|
+
var _sentryClient$getOpti = sentryClient.getOptions(),
|
|
8616
|
+
release = _sentryClient$getOpti.release,
|
|
8617
|
+
_sentryClient$getOpti2 = _sentryClient$getOpti.environment,
|
|
8618
|
+
environment = _sentryClient$getOpti2 === void 0 ? DEFAULT_ENVIRONMENT : _sentryClient$getOpti2;
|
|
8619
|
+
var sentrySession = makeSession({
|
|
8620
|
+
release: release,
|
|
8621
|
+
environment: environment
|
|
8622
|
+
});
|
|
8623
|
+
sentryScope.setSession(sentrySession);
|
|
8624
|
+
// Send the start of the session
|
|
8625
|
+
sentryClient.captureSession(sentrySession);
|
|
8626
|
+
var sessionHasEnded = false; // Just to prevent infinite loops with beforeExit, which is called whenever the event loop empties out
|
|
8627
|
+
|
|
8628
|
+
function endSession() {
|
|
8629
|
+
if (sessionHasEnded) {
|
|
8630
|
+
return;
|
|
8631
|
+
}
|
|
8632
|
+
closeSession(sentrySession);
|
|
8633
|
+
sentryClient.captureSession(sentrySession);
|
|
8634
|
+
sessionHasEnded = true;
|
|
8635
|
+
}
|
|
8636
|
+
|
|
8637
|
+
// We also need to manually end sessions on errors because beforeExit is not called on crashes
|
|
8638
|
+
process.on("beforeExit", function () {
|
|
8639
|
+
endSession();
|
|
8640
|
+
});
|
|
8641
|
+
|
|
8642
|
+
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
8643
|
+
process.env["SENTRY_PIPELINE"] = "".concat(bundlerPluginMetaContext.buildTool, "-plugin/", "3.4.0");
|
|
8644
|
+
|
|
8645
|
+
// Not a bulletproof check but should be good enough to at least sometimes determine
|
|
8646
|
+
// if the plugin is called in dev/watch mode or for a prod build. The important part
|
|
8647
|
+
// here is to avoid a false positive. False negatives are okay.
|
|
8648
|
+
var isDevMode = process.env["NODE_ENV"] === "development";
|
|
8649
|
+
|
|
8650
|
+
/**
|
|
8651
|
+
* Handles errors caught and emitted in various areas of the plugin.
|
|
8652
|
+
*
|
|
8653
|
+
* Also sets the sentry session status according to the error handling.
|
|
8654
|
+
*
|
|
8655
|
+
* If users specify their custom `errorHandler` we'll leave the decision to throw
|
|
8656
|
+
* or continue up to them. By default, @param throwByDefault controls if the plugin
|
|
8657
|
+
* should throw an error (which causes a build fail in most bundlers) or continue.
|
|
8658
|
+
*/
|
|
8659
|
+
function handleRecoverableError(unknownError, throwByDefault) {
|
|
8660
|
+
sentrySession.status = "abnormal";
|
|
8661
|
+
try {
|
|
8662
|
+
if (options.errorHandler) {
|
|
8663
|
+
try {
|
|
8664
|
+
if (unknownError instanceof Error) {
|
|
8665
|
+
options.errorHandler(unknownError);
|
|
8666
|
+
} else {
|
|
8667
|
+
options.errorHandler(new Error("An unknown error occurred"));
|
|
8668
|
+
}
|
|
8669
|
+
} catch (e) {
|
|
8670
|
+
sentrySession.status = "crashed";
|
|
8671
|
+
throw e;
|
|
8672
|
+
}
|
|
8673
|
+
} else {
|
|
8674
|
+
// setting the session to "crashed" b/c from a plugin perspective this run failed.
|
|
8675
|
+
// However, we're intentionally not rethrowing the error to avoid breaking the user build.
|
|
8676
|
+
sentrySession.status = "crashed";
|
|
8677
|
+
if (throwByDefault) {
|
|
8678
|
+
throw unknownError;
|
|
8679
|
+
}
|
|
8680
|
+
logger.error("An error occurred. Couldn't finish all operations:", unknownError);
|
|
8681
|
+
}
|
|
8682
|
+
} finally {
|
|
8683
|
+
endSession();
|
|
8684
|
+
}
|
|
8685
|
+
}
|
|
8686
|
+
if (!validateOptions(options, logger)) {
|
|
8687
|
+
// Throwing by default to avoid a misconfigured plugin going unnoticed.
|
|
8688
|
+
handleRecoverableError(new Error("Options were not set correctly. See output above for more details."), true);
|
|
8689
|
+
}
|
|
8690
|
+
|
|
8691
|
+
// We have multiple plugins depending on generated source map files. (debug ID upload, legacy upload)
|
|
8692
|
+
// Additionally, we also want to have the functionality to delete files after uploading sourcemaps.
|
|
8693
|
+
// All of these plugins and the delete functionality need to run in the same hook (`writeBundle`).
|
|
8694
|
+
// Since the plugins among themselves are not aware of when they run and finish, we need a system to
|
|
8695
|
+
// track their dependencies on the generated files, so that we can initiate the file deletion only after
|
|
8696
|
+
// nothing depends on the files anymore.
|
|
8697
|
+
var dependenciesOnBuildArtifacts = new Set();
|
|
8698
|
+
var buildArtifactsDependencySubscribers = [];
|
|
8699
|
+
function notifyBuildArtifactDependencySubscribers() {
|
|
8700
|
+
buildArtifactsDependencySubscribers.forEach(function (subscriber) {
|
|
8701
|
+
subscriber();
|
|
8702
|
+
});
|
|
8703
|
+
}
|
|
8704
|
+
function createDependencyOnBuildArtifacts() {
|
|
8705
|
+
var dependencyIdentifier = Symbol();
|
|
8706
|
+
dependenciesOnBuildArtifacts.add(dependencyIdentifier);
|
|
8707
|
+
return function freeDependencyOnBuildArtifacts() {
|
|
8708
|
+
dependenciesOnBuildArtifacts["delete"](dependencyIdentifier);
|
|
8709
|
+
notifyBuildArtifactDependencySubscribers();
|
|
8710
|
+
};
|
|
8711
|
+
}
|
|
8712
|
+
|
|
8713
|
+
/**
|
|
8714
|
+
* Returns a Promise that resolves when all the currently active dependencies are freed again.
|
|
8715
|
+
*
|
|
8716
|
+
* It is very important that this function is called as late as possible before wanting to await the Promise to give
|
|
8717
|
+
* the dependency producers as much time as possible to register themselves.
|
|
8718
|
+
*/
|
|
8719
|
+
function waitUntilBuildArtifactDependenciesAreFreed() {
|
|
8720
|
+
return new Promise(function (resolve) {
|
|
8721
|
+
buildArtifactsDependencySubscribers.push(function () {
|
|
8722
|
+
if (dependenciesOnBuildArtifacts.size === 0) {
|
|
8723
|
+
resolve();
|
|
8724
|
+
}
|
|
8725
|
+
});
|
|
8726
|
+
if (dependenciesOnBuildArtifacts.size === 0) {
|
|
8727
|
+
resolve();
|
|
8728
|
+
}
|
|
8729
|
+
});
|
|
8730
|
+
}
|
|
8731
|
+
var bundleSizeOptimizationReplacementValues = {};
|
|
8732
|
+
if (options.bundleSizeOptimizations) {
|
|
8733
|
+
var bundleSizeOptimizations = options.bundleSizeOptimizations;
|
|
8734
|
+
if (bundleSizeOptimizations.excludeDebugStatements) {
|
|
8735
|
+
bundleSizeOptimizationReplacementValues["__SENTRY_DEBUG__"] = false;
|
|
8736
|
+
}
|
|
8737
|
+
if (bundleSizeOptimizations.excludeTracing) {
|
|
8738
|
+
bundleSizeOptimizationReplacementValues["__SENTRY_TRACING__"] = false;
|
|
8739
|
+
}
|
|
8740
|
+
if (bundleSizeOptimizations.excludeReplayCanvas) {
|
|
8741
|
+
bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_CANVAS__"] = true;
|
|
8742
|
+
}
|
|
8743
|
+
if (bundleSizeOptimizations.excludeReplayIframe) {
|
|
8744
|
+
bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_IFRAME__"] = true;
|
|
8745
|
+
}
|
|
8746
|
+
if (bundleSizeOptimizations.excludeReplayShadowDom) {
|
|
8747
|
+
bundleSizeOptimizationReplacementValues["__RRWEB_EXCLUDE_SHADOW_DOM__"] = true;
|
|
8748
|
+
}
|
|
8749
|
+
if (bundleSizeOptimizations.excludeReplayWorker) {
|
|
8750
|
+
bundleSizeOptimizationReplacementValues["__SENTRY_EXCLUDE_REPLAY_WORKER__"] = true;
|
|
8751
|
+
}
|
|
8752
|
+
}
|
|
8753
|
+
var bundleMetadata = {};
|
|
8754
|
+
if (options.moduleMetadata || options.applicationKey) {
|
|
8755
|
+
if (options.applicationKey) {
|
|
8756
|
+
// We use different keys so that if user-code receives multiple bundling passes, we will store the application keys of all the passes.
|
|
8757
|
+
// It is a bit unfortunate that we have to inject the metadata snippet at the top, because after multiple
|
|
8758
|
+
// injections, the first injection will always "win" because it comes last in the code. We would generally be
|
|
8759
|
+
// fine with making the last bundling pass win. But because it cannot win, we have to use a workaround of storing
|
|
8760
|
+
// the app keys in different object keys.
|
|
8761
|
+
// We can simply use the `_sentryBundlerPluginAppKey:` to filter for app keys in the SDK.
|
|
8762
|
+
bundleMetadata["_sentryBundlerPluginAppKey:".concat(options.applicationKey)] = true;
|
|
8763
|
+
}
|
|
8764
|
+
if (typeof options.moduleMetadata === "function") {
|
|
8765
|
+
var args = {
|
|
8766
|
+
org: options.org,
|
|
8767
|
+
project: options.project,
|
|
8768
|
+
release: options.release.name
|
|
8769
|
+
};
|
|
8770
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
8771
|
+
bundleMetadata = _objectSpread2(_objectSpread2({}, bundleMetadata), options.moduleMetadata(args));
|
|
8772
|
+
} else {
|
|
8773
|
+
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
8774
|
+
bundleMetadata = _objectSpread2(_objectSpread2({}, bundleMetadata), options.moduleMetadata);
|
|
8775
|
+
}
|
|
8776
|
+
}
|
|
8777
|
+
return {
|
|
8778
|
+
/**
|
|
8779
|
+
* A logger instance that takes the options passed to the build plugin manager into account. (for silencing and log level etc.)
|
|
8780
|
+
*/
|
|
8781
|
+
logger: logger,
|
|
8782
|
+
/**
|
|
8783
|
+
* Options after normalization. Includes things like the inferred release name.
|
|
8784
|
+
*/
|
|
8785
|
+
normalizedOptions: options,
|
|
8786
|
+
/**
|
|
8787
|
+
* Magic strings and their replacement values that can be used for bundle size optimizations. This already takes
|
|
8788
|
+
* into account the options passed to the build plugin manager.
|
|
8789
|
+
*/
|
|
8790
|
+
bundleSizeOptimizationReplacementValues: bundleSizeOptimizationReplacementValues,
|
|
8791
|
+
/**
|
|
8792
|
+
* Metadata that should be injected into bundles if possible. Takes into account options passed to the build plugin manager.
|
|
8793
|
+
*/
|
|
8794
|
+
// See `generateModuleMetadataInjectorCode` for how this should be used exactly
|
|
8795
|
+
bundleMetadata: bundleMetadata,
|
|
8796
|
+
/**
|
|
8797
|
+
* Contains utility functions for emitting telemetry via the build plugin manager.
|
|
8798
|
+
*/
|
|
8799
|
+
telemetry: {
|
|
8800
|
+
/**
|
|
8801
|
+
* Emits a `Sentry Bundler Plugin execution` signal.
|
|
8802
|
+
*/
|
|
8803
|
+
emitBundlerPluginExecutionSignal: function emitBundlerPluginExecutionSignal() {
|
|
8804
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8805
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8806
|
+
while (1) switch (_context.prev = _context.next) {
|
|
8807
|
+
case 0:
|
|
8808
|
+
_context.next = 2;
|
|
8809
|
+
return shouldSendTelemetry;
|
|
8810
|
+
case 2:
|
|
8811
|
+
if (!_context.sent) {
|
|
8812
|
+
_context.next = 7;
|
|
8813
|
+
break;
|
|
8814
|
+
}
|
|
8815
|
+
logger.info("Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.");
|
|
8816
|
+
startSpan({
|
|
8817
|
+
name: "Sentry Bundler Plugin execution",
|
|
8818
|
+
scope: sentryScope
|
|
8819
|
+
}, function () {
|
|
8820
|
+
//
|
|
8821
|
+
});
|
|
8822
|
+
_context.next = 7;
|
|
8823
|
+
return safeFlushTelemetry(sentryClient);
|
|
8824
|
+
case 7:
|
|
8825
|
+
case "end":
|
|
8826
|
+
return _context.stop();
|
|
8827
|
+
}
|
|
8828
|
+
}, _callee);
|
|
8829
|
+
}))();
|
|
8777
8830
|
}
|
|
8778
|
-
},
|
|
8779
|
-
|
|
8780
|
-
|
|
8781
|
-
|
|
8782
|
-
|
|
8783
|
-
|
|
8784
|
-
|
|
8785
|
-
|
|
8786
|
-
|
|
8787
|
-
|
|
8788
|
-
|
|
8789
|
-
|
|
8790
|
-
|
|
8791
|
-
/**
|
|
8792
|
-
* Creates a plugin that creates releases, sets commits, deploys and finalizes releases.
|
|
8793
|
-
*
|
|
8794
|
-
* Additionally, if legacy upload options are set, it uploads source maps in the legacy (non-debugId) way.
|
|
8795
|
-
*/
|
|
8796
|
-
function releaseManagementPlugin(_ref) {
|
|
8797
|
-
var logger = _ref.logger,
|
|
8798
|
-
releaseName = _ref.releaseName,
|
|
8799
|
-
include = _ref.include,
|
|
8800
|
-
dist = _ref.dist,
|
|
8801
|
-
setCommitsOption = _ref.setCommitsOption,
|
|
8802
|
-
shouldCreateRelease = _ref.shouldCreateRelease,
|
|
8803
|
-
shouldFinalizeRelease = _ref.shouldFinalizeRelease,
|
|
8804
|
-
deployOptions = _ref.deployOptions,
|
|
8805
|
-
handleRecoverableError = _ref.handleRecoverableError,
|
|
8806
|
-
sentryScope = _ref.sentryScope,
|
|
8807
|
-
sentryClient = _ref.sentryClient,
|
|
8808
|
-
sentryCliOptions = _ref.sentryCliOptions,
|
|
8809
|
-
createDependencyOnSourcemapFiles = _ref.createDependencyOnSourcemapFiles;
|
|
8810
|
-
var freeGlobalDependencyOnSourcemapFiles = createDependencyOnSourcemapFiles();
|
|
8811
|
-
return {
|
|
8812
|
-
name: "sentry-release-management-plugin",
|
|
8813
|
-
writeBundle: function writeBundle() {
|
|
8814
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8831
|
+
},
|
|
8832
|
+
/**
|
|
8833
|
+
* Will potentially create a release based on the build plugin manager options.
|
|
8834
|
+
*
|
|
8835
|
+
* Also
|
|
8836
|
+
* - finalizes the release
|
|
8837
|
+
* - sets commits
|
|
8838
|
+
* - uploads legacy sourcemaps
|
|
8839
|
+
* - adds deploy information
|
|
8840
|
+
*/
|
|
8841
|
+
createRelease: function createRelease() {
|
|
8842
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
8815
8843
|
var freeWriteBundleInvocationDependencyOnSourcemapFiles, cliInstance, normalizedInclude;
|
|
8816
|
-
return _regeneratorRuntime().wrap(function
|
|
8817
|
-
while (1) switch (
|
|
8844
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
8845
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
8818
8846
|
case 0:
|
|
8847
|
+
if (options.release.name) {
|
|
8848
|
+
_context2.next = 5;
|
|
8849
|
+
break;
|
|
8850
|
+
}
|
|
8851
|
+
logger.debug("No release name provided. Will not create release. Please set the `release.name` option to identify your release.");
|
|
8852
|
+
return _context2.abrupt("return");
|
|
8853
|
+
case 5:
|
|
8854
|
+
if (!isDevMode) {
|
|
8855
|
+
_context2.next = 10;
|
|
8856
|
+
break;
|
|
8857
|
+
}
|
|
8858
|
+
logger.debug("Running in development mode. Will not create release.");
|
|
8859
|
+
return _context2.abrupt("return");
|
|
8860
|
+
case 10:
|
|
8861
|
+
if (options.authToken) {
|
|
8862
|
+
_context2.next = 15;
|
|
8863
|
+
break;
|
|
8864
|
+
}
|
|
8865
|
+
logger.warn("No auth token provided. Will not create release. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" + getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN"));
|
|
8866
|
+
return _context2.abrupt("return");
|
|
8867
|
+
case 15:
|
|
8868
|
+
if (!(!options.org && !options.authToken.startsWith("sntrys_"))) {
|
|
8869
|
+
_context2.next = 20;
|
|
8870
|
+
break;
|
|
8871
|
+
}
|
|
8872
|
+
logger.warn("No organization slug provided. Will not create release. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
8873
|
+
return _context2.abrupt("return");
|
|
8874
|
+
case 20:
|
|
8875
|
+
if (options.project) {
|
|
8876
|
+
_context2.next = 23;
|
|
8877
|
+
break;
|
|
8878
|
+
}
|
|
8879
|
+
logger.warn("No project provided. Will not create release. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
8880
|
+
return _context2.abrupt("return");
|
|
8881
|
+
case 23:
|
|
8819
8882
|
// It is possible that this writeBundle hook is called multiple times in one build (for example when reusing the plugin, or when using build tooling like `@vitejs/plugin-legacy`)
|
|
8820
8883
|
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
8821
|
-
freeWriteBundleInvocationDependencyOnSourcemapFiles =
|
|
8822
|
-
|
|
8823
|
-
cliInstance = new SentryCli(null,
|
|
8824
|
-
|
|
8825
|
-
|
|
8884
|
+
freeWriteBundleInvocationDependencyOnSourcemapFiles = createDependencyOnBuildArtifacts();
|
|
8885
|
+
_context2.prev = 24;
|
|
8886
|
+
cliInstance = new SentryCli(null, {
|
|
8887
|
+
authToken: options.authToken,
|
|
8888
|
+
org: options.org,
|
|
8889
|
+
project: options.project,
|
|
8890
|
+
silent: options.silent,
|
|
8891
|
+
url: options.url,
|
|
8892
|
+
vcsRemote: options.release.vcsRemote,
|
|
8893
|
+
headers: options.headers
|
|
8894
|
+
});
|
|
8895
|
+
if (!options.release.create) {
|
|
8896
|
+
_context2.next = 29;
|
|
8826
8897
|
break;
|
|
8827
8898
|
}
|
|
8828
|
-
|
|
8829
|
-
return cliInstance.releases["new"](
|
|
8830
|
-
case
|
|
8831
|
-
if (!
|
|
8832
|
-
|
|
8899
|
+
_context2.next = 29;
|
|
8900
|
+
return cliInstance.releases["new"](options.release.name);
|
|
8901
|
+
case 29:
|
|
8902
|
+
if (!options.release.uploadLegacySourcemaps) {
|
|
8903
|
+
_context2.next = 33;
|
|
8833
8904
|
break;
|
|
8834
8905
|
}
|
|
8835
|
-
normalizedInclude = arrayify
|
|
8906
|
+
normalizedInclude = arrayify(options.release.uploadLegacySourcemaps).map(function (includeItem) {
|
|
8836
8907
|
return typeof includeItem === "string" ? {
|
|
8837
8908
|
paths: [includeItem]
|
|
8838
8909
|
} : includeItem;
|
|
@@ -8843,202 +8914,417 @@ function releaseManagementPlugin(_ref) {
|
|
|
8843
8914
|
ext: includeEntry.ext ? includeEntry.ext.map(function (extension) {
|
|
8844
8915
|
return ".".concat(extension.replace(/^\./, ""));
|
|
8845
8916
|
}) : [".js", ".map", ".jsbundle", ".bundle"],
|
|
8846
|
-
ignore: includeEntry.ignore ? arrayify
|
|
8917
|
+
ignore: includeEntry.ignore ? arrayify(includeEntry.ignore) : undefined
|
|
8847
8918
|
});
|
|
8848
8919
|
});
|
|
8849
|
-
|
|
8850
|
-
return cliInstance.releases.uploadSourceMaps(
|
|
8920
|
+
_context2.next = 33;
|
|
8921
|
+
return cliInstance.releases.uploadSourceMaps(options.release.name, {
|
|
8851
8922
|
include: normalizedInclude,
|
|
8852
|
-
dist: dist
|
|
8923
|
+
dist: options.release.dist
|
|
8853
8924
|
});
|
|
8854
|
-
case
|
|
8855
|
-
if (!(
|
|
8856
|
-
|
|
8925
|
+
case 33:
|
|
8926
|
+
if (!(options.release.setCommits !== false)) {
|
|
8927
|
+
_context2.next = 46;
|
|
8857
8928
|
break;
|
|
8858
8929
|
}
|
|
8859
|
-
|
|
8860
|
-
|
|
8861
|
-
return cliInstance.releases.setCommits(
|
|
8862
|
-
|
|
8863
|
-
|
|
8930
|
+
_context2.prev = 34;
|
|
8931
|
+
_context2.next = 37;
|
|
8932
|
+
return cliInstance.releases.setCommits(options.release.name,
|
|
8933
|
+
// set commits always exists due to the normalize function
|
|
8934
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
8935
|
+
options.release.setCommits);
|
|
8936
|
+
case 37:
|
|
8937
|
+
_context2.next = 46;
|
|
8864
8938
|
break;
|
|
8865
|
-
case
|
|
8866
|
-
|
|
8867
|
-
|
|
8868
|
-
if (!("shouldNotThrowOnFailure" in
|
|
8869
|
-
|
|
8939
|
+
case 39:
|
|
8940
|
+
_context2.prev = 39;
|
|
8941
|
+
_context2.t0 = _context2["catch"](34);
|
|
8942
|
+
if (!(options.release.setCommits && "shouldNotThrowOnFailure" in options.release.setCommits && options.release.setCommits.shouldNotThrowOnFailure)) {
|
|
8943
|
+
_context2.next = 45;
|
|
8870
8944
|
break;
|
|
8871
8945
|
}
|
|
8872
|
-
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):",
|
|
8873
|
-
|
|
8946
|
+
logger.debug("An error occurred setting commits on release (this message can be ignored unless you commits on release are desired):", _context2.t0);
|
|
8947
|
+
_context2.next = 46;
|
|
8874
8948
|
break;
|
|
8875
|
-
case
|
|
8876
|
-
throw
|
|
8877
|
-
case
|
|
8878
|
-
if (!
|
|
8879
|
-
|
|
8949
|
+
case 45:
|
|
8950
|
+
throw _context2.t0;
|
|
8951
|
+
case 46:
|
|
8952
|
+
if (!options.release.finalize) {
|
|
8953
|
+
_context2.next = 49;
|
|
8880
8954
|
break;
|
|
8881
8955
|
}
|
|
8882
|
-
|
|
8883
|
-
return cliInstance.releases.finalize(
|
|
8884
|
-
case
|
|
8885
|
-
if (!
|
|
8886
|
-
|
|
8956
|
+
_context2.next = 49;
|
|
8957
|
+
return cliInstance.releases.finalize(options.release.name);
|
|
8958
|
+
case 49:
|
|
8959
|
+
if (!options.release.deploy) {
|
|
8960
|
+
_context2.next = 52;
|
|
8887
8961
|
break;
|
|
8888
8962
|
}
|
|
8889
|
-
|
|
8890
|
-
return cliInstance.releases.newDeploy(
|
|
8891
|
-
case
|
|
8892
|
-
|
|
8963
|
+
_context2.next = 52;
|
|
8964
|
+
return cliInstance.releases.newDeploy(options.release.name, options.release.deploy);
|
|
8965
|
+
case 52:
|
|
8966
|
+
_context2.next = 60;
|
|
8893
8967
|
break;
|
|
8894
|
-
case
|
|
8895
|
-
|
|
8896
|
-
|
|
8968
|
+
case 54:
|
|
8969
|
+
_context2.prev = 54;
|
|
8970
|
+
_context2.t1 = _context2["catch"](24);
|
|
8897
8971
|
sentryScope.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
8898
|
-
|
|
8972
|
+
_context2.next = 59;
|
|
8899
8973
|
return safeFlushTelemetry(sentryClient);
|
|
8900
|
-
case
|
|
8901
|
-
handleRecoverableError(
|
|
8902
|
-
case
|
|
8903
|
-
|
|
8904
|
-
freeGlobalDependencyOnSourcemapFiles();
|
|
8974
|
+
case 59:
|
|
8975
|
+
handleRecoverableError(_context2.t1, false);
|
|
8976
|
+
case 60:
|
|
8977
|
+
_context2.prev = 60;
|
|
8905
8978
|
freeWriteBundleInvocationDependencyOnSourcemapFiles();
|
|
8906
|
-
return
|
|
8907
|
-
case
|
|
8979
|
+
return _context2.finish(60);
|
|
8980
|
+
case 63:
|
|
8908
8981
|
case "end":
|
|
8909
|
-
return
|
|
8982
|
+
return _context2.stop();
|
|
8910
8983
|
}
|
|
8911
|
-
},
|
|
8984
|
+
}, _callee2, null, [[24, 54, 60, 63], [34, 39]]);
|
|
8912
8985
|
}))();
|
|
8913
|
-
}
|
|
8914
|
-
|
|
8915
|
-
|
|
8916
|
-
|
|
8917
|
-
function
|
|
8918
|
-
|
|
8919
|
-
|
|
8920
|
-
|
|
8921
|
-
|
|
8922
|
-
return {
|
|
8923
|
-
name: "sentry-telemetry-plugin",
|
|
8924
|
-
buildStart: function buildStart() {
|
|
8925
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
8926
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
8927
|
-
while (1) switch (_context.prev = _context.next) {
|
|
8986
|
+
},
|
|
8987
|
+
/**
|
|
8988
|
+
* Uploads sourcemaps using the "Debug ID" method. This function takes a list of build artifact paths that will be uploaded
|
|
8989
|
+
*/
|
|
8990
|
+
uploadSourcemaps: function uploadSourcemaps(buildArtifactPaths) {
|
|
8991
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11() {
|
|
8992
|
+
var _options$sourcemaps;
|
|
8993
|
+
return _regeneratorRuntime().wrap(function _callee11$(_context11) {
|
|
8994
|
+
while (1) switch (_context11.prev = _context11.next) {
|
|
8928
8995
|
case 0:
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8996
|
+
if ((_options$sourcemaps = options.sourcemaps) !== null && _options$sourcemaps !== void 0 && _options$sourcemaps.disable) {
|
|
8997
|
+
logger.debug("Source map upload was disabled. Will not upload sourcemaps using debug ID process.");
|
|
8998
|
+
} else if (isDevMode) {
|
|
8999
|
+
logger.debug("Running in development mode. Will not upload sourcemaps.");
|
|
9000
|
+
} else if (!options.authToken) {
|
|
9001
|
+
logger.warn("No auth token provided. Will not upload source maps. Please set the `authToken` option. You can find information on how to generate a Sentry auth token here: https://docs.sentry.io/api/auth/" + getTurborepoEnvPassthroughWarning("SENTRY_AUTH_TOKEN"));
|
|
9002
|
+
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9003
|
+
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9004
|
+
} else if (!options.project) {
|
|
9005
|
+
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
8935
9006
|
}
|
|
8936
|
-
|
|
8937
|
-
startSpan(
|
|
8938
|
-
|
|
8939
|
-
|
|
8940
|
-
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
9007
|
+
_context11.next = 3;
|
|
9008
|
+
return startSpan(
|
|
9009
|
+
// This is `forceTransaction`ed because this span is used in dashboards in the form of indexed transactions.
|
|
9010
|
+
{
|
|
9011
|
+
name: "debug-id-sourcemap-upload",
|
|
9012
|
+
scope: sentryScope,
|
|
9013
|
+
forceTransaction: true
|
|
9014
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10() {
|
|
9015
|
+
var folderToCleanUp, freeUploadDependencyOnBuildArtifacts, _options$sourcemaps2, tmpUploadFolder, assets, globAssets, globResult, debugIdChunkFilePaths, _process$env2;
|
|
9016
|
+
return _regeneratorRuntime().wrap(function _callee10$(_context10) {
|
|
9017
|
+
while (1) switch (_context10.prev = _context10.next) {
|
|
9018
|
+
case 0:
|
|
9019
|
+
// It is possible that this writeBundle hook (which calls this function) is called multiple times in one build (for example when reusing the plugin, or when using build tooling like `@vitejs/plugin-legacy`)
|
|
9020
|
+
// Therefore we need to actually register the execution of this hook as dependency on the sourcemap files.
|
|
9021
|
+
freeUploadDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
9022
|
+
_context10.prev = 1;
|
|
9023
|
+
_context10.next = 4;
|
|
9024
|
+
return startSpan({
|
|
9025
|
+
name: "mkdtemp",
|
|
9026
|
+
scope: sentryScope
|
|
9027
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
9028
|
+
var _process$env;
|
|
9029
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
9030
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
9031
|
+
case 0:
|
|
9032
|
+
_context3.t0 = (_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env["SENTRY_TEST_OVERRIDE_TEMP_DIR"];
|
|
9033
|
+
if (_context3.t0) {
|
|
9034
|
+
_context3.next = 5;
|
|
9035
|
+
break;
|
|
9036
|
+
}
|
|
9037
|
+
_context3.next = 4;
|
|
9038
|
+
return fs.promises.mkdtemp(path.join(os.tmpdir(), "sentry-bundler-plugin-upload-"));
|
|
9039
|
+
case 4:
|
|
9040
|
+
_context3.t0 = _context3.sent;
|
|
9041
|
+
case 5:
|
|
9042
|
+
return _context3.abrupt("return", _context3.t0);
|
|
9043
|
+
case 6:
|
|
9044
|
+
case "end":
|
|
9045
|
+
return _context3.stop();
|
|
9046
|
+
}
|
|
9047
|
+
}, _callee3);
|
|
9048
|
+
})));
|
|
9049
|
+
case 4:
|
|
9050
|
+
tmpUploadFolder = _context10.sent;
|
|
9051
|
+
folderToCleanUp = tmpUploadFolder;
|
|
9052
|
+
assets = (_options$sourcemaps2 = options.sourcemaps) === null || _options$sourcemaps2 === void 0 ? void 0 : _options$sourcemaps2.assets;
|
|
9053
|
+
if (assets) {
|
|
9054
|
+
globAssets = assets;
|
|
9055
|
+
} else {
|
|
9056
|
+
logger.debug("No `sourcemaps.assets` option provided, falling back to uploading detected build artifacts.");
|
|
9057
|
+
globAssets = buildArtifactPaths;
|
|
9058
|
+
}
|
|
9059
|
+
_context10.next = 10;
|
|
9060
|
+
return startSpan({
|
|
9061
|
+
name: "glob",
|
|
9062
|
+
scope: sentryScope
|
|
9063
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
9064
|
+
var _options$sourcemaps3;
|
|
9065
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
9066
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
9067
|
+
case 0:
|
|
9068
|
+
_context4.next = 2;
|
|
9069
|
+
return glob(globAssets, {
|
|
9070
|
+
absolute: true,
|
|
9071
|
+
nodir: true,
|
|
9072
|
+
ignore: (_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.ignore
|
|
9073
|
+
});
|
|
9074
|
+
case 2:
|
|
9075
|
+
return _context4.abrupt("return", _context4.sent);
|
|
9076
|
+
case 3:
|
|
9077
|
+
case "end":
|
|
9078
|
+
return _context4.stop();
|
|
9079
|
+
}
|
|
9080
|
+
}, _callee4);
|
|
9081
|
+
})));
|
|
9082
|
+
case 10:
|
|
9083
|
+
globResult = _context10.sent;
|
|
9084
|
+
debugIdChunkFilePaths = globResult.filter(function (debugIdChunkFilePath) {
|
|
9085
|
+
return !!stripQueryAndHashFromPath(debugIdChunkFilePath).match(/\.(js|mjs|cjs)$/);
|
|
9086
|
+
}); // The order of the files output by glob() is not deterministic
|
|
9087
|
+
// Ensure order within the files so that {debug-id}-{chunkIndex} coupling is consistent
|
|
9088
|
+
debugIdChunkFilePaths.sort();
|
|
9089
|
+
if (!(Array.isArray(assets) && assets.length === 0)) {
|
|
9090
|
+
_context10.next = 17;
|
|
9091
|
+
break;
|
|
9092
|
+
}
|
|
9093
|
+
logger.debug("Empty `sourcemaps.assets` option provided. Will not upload sourcemaps with debug ID.");
|
|
9094
|
+
_context10.next = 24;
|
|
9095
|
+
break;
|
|
9096
|
+
case 17:
|
|
9097
|
+
if (!(debugIdChunkFilePaths.length === 0)) {
|
|
9098
|
+
_context10.next = 21;
|
|
9099
|
+
break;
|
|
9100
|
+
}
|
|
9101
|
+
logger.warn("Didn't find any matching sources for debug ID upload. Please check the `sourcemaps.assets` option.");
|
|
9102
|
+
_context10.next = 24;
|
|
9103
|
+
break;
|
|
9104
|
+
case 21:
|
|
9105
|
+
_context10.next = 23;
|
|
9106
|
+
return startSpan({
|
|
9107
|
+
name: "prepare-bundles",
|
|
9108
|
+
scope: sentryScope
|
|
9109
|
+
}, /*#__PURE__*/function () {
|
|
9110
|
+
var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(prepBundlesSpan) {
|
|
9111
|
+
var preparationTasks, workers, worker, workerIndex, files, stats, uploadSize;
|
|
9112
|
+
return _regeneratorRuntime().wrap(function _callee8$(_context8) {
|
|
9113
|
+
while (1) switch (_context8.prev = _context8.next) {
|
|
9114
|
+
case 0:
|
|
9115
|
+
// Preparing the bundles can be a lot of work and doing it all at once has the potential of nuking the heap so
|
|
9116
|
+
// instead we do it with a maximum of 16 concurrent workers
|
|
9117
|
+
preparationTasks = debugIdChunkFilePaths.map(function (chunkFilePath, chunkIndex) {
|
|
9118
|
+
return /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
9119
|
+
var _options$sourcemaps$r, _options$sourcemaps4;
|
|
9120
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
9121
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
9122
|
+
case 0:
|
|
9123
|
+
_context5.next = 2;
|
|
9124
|
+
return prepareBundleForDebugIdUpload(chunkFilePath, tmpUploadFolder, chunkIndex, logger, (_options$sourcemaps$r = (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.rewriteSources) !== null && _options$sourcemaps$r !== void 0 ? _options$sourcemaps$r : defaultRewriteSourcesHook);
|
|
9125
|
+
case 2:
|
|
9126
|
+
case "end":
|
|
9127
|
+
return _context5.stop();
|
|
9128
|
+
}
|
|
9129
|
+
}, _callee5);
|
|
9130
|
+
}));
|
|
9131
|
+
});
|
|
9132
|
+
workers = [];
|
|
9133
|
+
worker = /*#__PURE__*/function () {
|
|
9134
|
+
var _ref6 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {
|
|
9135
|
+
var task;
|
|
9136
|
+
return _regeneratorRuntime().wrap(function _callee6$(_context6) {
|
|
9137
|
+
while (1) switch (_context6.prev = _context6.next) {
|
|
9138
|
+
case 0:
|
|
9139
|
+
if (!(preparationTasks.length > 0)) {
|
|
9140
|
+
_context6.next = 7;
|
|
9141
|
+
break;
|
|
9142
|
+
}
|
|
9143
|
+
task = preparationTasks.shift();
|
|
9144
|
+
if (!task) {
|
|
9145
|
+
_context6.next = 5;
|
|
9146
|
+
break;
|
|
9147
|
+
}
|
|
9148
|
+
_context6.next = 5;
|
|
9149
|
+
return task();
|
|
9150
|
+
case 5:
|
|
9151
|
+
_context6.next = 0;
|
|
9152
|
+
break;
|
|
9153
|
+
case 7:
|
|
9154
|
+
case "end":
|
|
9155
|
+
return _context6.stop();
|
|
9156
|
+
}
|
|
9157
|
+
}, _callee6);
|
|
9158
|
+
}));
|
|
9159
|
+
return function worker() {
|
|
9160
|
+
return _ref6.apply(this, arguments);
|
|
9161
|
+
};
|
|
9162
|
+
}();
|
|
9163
|
+
for (workerIndex = 0; workerIndex < 16; workerIndex++) {
|
|
9164
|
+
workers.push(worker());
|
|
9165
|
+
}
|
|
9166
|
+
_context8.next = 6;
|
|
9167
|
+
return Promise.all(workers);
|
|
9168
|
+
case 6:
|
|
9169
|
+
_context8.next = 8;
|
|
9170
|
+
return fs.promises.readdir(tmpUploadFolder);
|
|
9171
|
+
case 8:
|
|
9172
|
+
files = _context8.sent;
|
|
9173
|
+
stats = files.map(function (file) {
|
|
9174
|
+
return fs.promises.stat(path.join(tmpUploadFolder, file));
|
|
9175
|
+
});
|
|
9176
|
+
_context8.next = 12;
|
|
9177
|
+
return Promise.all(stats);
|
|
9178
|
+
case 12:
|
|
9179
|
+
uploadSize = _context8.sent.reduce(function (accumulator, _ref7) {
|
|
9180
|
+
var size = _ref7.size;
|
|
9181
|
+
return accumulator + size;
|
|
9182
|
+
}, 0);
|
|
9183
|
+
setMeasurement("files", files.length, "none", prepBundlesSpan);
|
|
9184
|
+
setMeasurement("upload_size", uploadSize, "byte", prepBundlesSpan);
|
|
9185
|
+
_context8.next = 17;
|
|
9186
|
+
return startSpan({
|
|
9187
|
+
name: "upload",
|
|
9188
|
+
scope: sentryScope
|
|
9189
|
+
}, /*#__PURE__*/function () {
|
|
9190
|
+
var _ref8 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7(uploadSpan) {
|
|
9191
|
+
var _options$release$name;
|
|
9192
|
+
var cliInstance;
|
|
9193
|
+
return _regeneratorRuntime().wrap(function _callee7$(_context7) {
|
|
9194
|
+
while (1) switch (_context7.prev = _context7.next) {
|
|
9195
|
+
case 0:
|
|
9196
|
+
cliInstance = new SentryCli(null, {
|
|
9197
|
+
authToken: options.authToken,
|
|
9198
|
+
org: options.org,
|
|
9199
|
+
project: options.project,
|
|
9200
|
+
silent: options.silent,
|
|
9201
|
+
url: options.url,
|
|
9202
|
+
vcsRemote: options.release.vcsRemote,
|
|
9203
|
+
headers: _objectSpread2({
|
|
9204
|
+
"sentry-trace": spanToTraceHeader(uploadSpan),
|
|
9205
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
9206
|
+
baggage: dynamicSamplingContextToSentryBaggageHeader(getDynamicSamplingContextFromSpan(uploadSpan))
|
|
9207
|
+
}, options.headers)
|
|
9208
|
+
});
|
|
9209
|
+
_context7.next = 3;
|
|
9210
|
+
return cliInstance.releases.uploadSourceMaps((_options$release$name = options.release.name) !== null && _options$release$name !== void 0 ? _options$release$name : "undefined",
|
|
9211
|
+
// unfortunately this needs a value for now but it will not matter since debug IDs overpower releases anyhow
|
|
9212
|
+
{
|
|
9213
|
+
include: [{
|
|
9214
|
+
paths: [tmpUploadFolder],
|
|
9215
|
+
rewrite: false,
|
|
9216
|
+
dist: options.release.dist
|
|
9217
|
+
}]
|
|
9218
|
+
});
|
|
9219
|
+
case 3:
|
|
9220
|
+
case "end":
|
|
9221
|
+
return _context7.stop();
|
|
9222
|
+
}
|
|
9223
|
+
}, _callee7);
|
|
9224
|
+
}));
|
|
9225
|
+
return function (_x2) {
|
|
9226
|
+
return _ref8.apply(this, arguments);
|
|
9227
|
+
};
|
|
9228
|
+
}());
|
|
9229
|
+
case 17:
|
|
9230
|
+
case "end":
|
|
9231
|
+
return _context8.stop();
|
|
9232
|
+
}
|
|
9233
|
+
}, _callee8);
|
|
9234
|
+
}));
|
|
9235
|
+
return function (_x) {
|
|
9236
|
+
return _ref4.apply(this, arguments);
|
|
9237
|
+
};
|
|
9238
|
+
}());
|
|
9239
|
+
case 23:
|
|
9240
|
+
logger.info("Successfully uploaded source maps to Sentry");
|
|
9241
|
+
case 24:
|
|
9242
|
+
_context10.next = 30;
|
|
9243
|
+
break;
|
|
9244
|
+
case 26:
|
|
9245
|
+
_context10.prev = 26;
|
|
9246
|
+
_context10.t0 = _context10["catch"](1);
|
|
9247
|
+
sentryScope.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
9248
|
+
handleRecoverableError(_context10.t0, false);
|
|
9249
|
+
case 30:
|
|
9250
|
+
_context10.prev = 30;
|
|
9251
|
+
if (folderToCleanUp && !((_process$env2 = process.env) !== null && _process$env2 !== void 0 && _process$env2["SENTRY_TEST_OVERRIDE_TEMP_DIR"])) {
|
|
9252
|
+
void startSpan({
|
|
9253
|
+
name: "cleanup",
|
|
9254
|
+
scope: sentryScope
|
|
9255
|
+
}, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9() {
|
|
9256
|
+
return _regeneratorRuntime().wrap(function _callee9$(_context9) {
|
|
9257
|
+
while (1) switch (_context9.prev = _context9.next) {
|
|
9258
|
+
case 0:
|
|
9259
|
+
if (!folderToCleanUp) {
|
|
9260
|
+
_context9.next = 3;
|
|
9261
|
+
break;
|
|
9262
|
+
}
|
|
9263
|
+
_context9.next = 3;
|
|
9264
|
+
return fs.promises.rm(folderToCleanUp, {
|
|
9265
|
+
recursive: true,
|
|
9266
|
+
force: true
|
|
9267
|
+
});
|
|
9268
|
+
case 3:
|
|
9269
|
+
case "end":
|
|
9270
|
+
return _context9.stop();
|
|
9271
|
+
}
|
|
9272
|
+
}, _callee9);
|
|
9273
|
+
})));
|
|
9274
|
+
}
|
|
9275
|
+
freeUploadDependencyOnBuildArtifacts();
|
|
9276
|
+
_context10.next = 35;
|
|
9277
|
+
return safeFlushTelemetry(sentryClient);
|
|
9278
|
+
case 35:
|
|
9279
|
+
return _context10.finish(30);
|
|
9280
|
+
case 36:
|
|
9281
|
+
case "end":
|
|
9282
|
+
return _context10.stop();
|
|
9283
|
+
}
|
|
9284
|
+
}, _callee10, null, [[1, 26, 30, 36]]);
|
|
9285
|
+
})));
|
|
9286
|
+
case 3:
|
|
8946
9287
|
case "end":
|
|
8947
|
-
return
|
|
9288
|
+
return _context11.stop();
|
|
8948
9289
|
}
|
|
8949
|
-
},
|
|
9290
|
+
}, _callee11);
|
|
8950
9291
|
}))();
|
|
8951
|
-
}
|
|
8952
|
-
};
|
|
8953
|
-
}
|
|
8954
|
-
|
|
8955
|
-
// Logging everything to stderr not to interfere with stdout
|
|
8956
|
-
function createLogger(options) {
|
|
8957
|
-
return {
|
|
8958
|
-
info: function info(message) {
|
|
8959
|
-
if (!options.silent) {
|
|
8960
|
-
var _console;
|
|
8961
|
-
for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
8962
|
-
params[_key - 1] = arguments[_key];
|
|
8963
|
-
}
|
|
8964
|
-
// eslint-disable-next-line no-console
|
|
8965
|
-
(_console = console).info.apply(_console, ["".concat(options.prefix, " Info: ").concat(message)].concat(params));
|
|
8966
|
-
}
|
|
8967
|
-
},
|
|
8968
|
-
warn: function warn(message) {
|
|
8969
|
-
if (!options.silent) {
|
|
8970
|
-
var _console2;
|
|
8971
|
-
for (var _len2 = arguments.length, params = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
8972
|
-
params[_key2 - 1] = arguments[_key2];
|
|
8973
|
-
}
|
|
8974
|
-
// eslint-disable-next-line no-console
|
|
8975
|
-
(_console2 = console).warn.apply(_console2, ["".concat(options.prefix, " Warning: ").concat(message)].concat(params));
|
|
8976
|
-
}
|
|
8977
|
-
},
|
|
8978
|
-
error: function error(message) {
|
|
8979
|
-
if (!options.silent) {
|
|
8980
|
-
var _console3;
|
|
8981
|
-
for (var _len3 = arguments.length, params = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
|
|
8982
|
-
params[_key3 - 1] = arguments[_key3];
|
|
8983
|
-
}
|
|
8984
|
-
// eslint-disable-next-line no-console
|
|
8985
|
-
(_console3 = console).error.apply(_console3, ["".concat(options.prefix, " Error: ").concat(message)].concat(params));
|
|
8986
|
-
}
|
|
8987
9292
|
},
|
|
8988
|
-
|
|
8989
|
-
|
|
8990
|
-
|
|
8991
|
-
|
|
8992
|
-
|
|
8993
|
-
|
|
8994
|
-
|
|
8995
|
-
|
|
8996
|
-
}
|
|
8997
|
-
}
|
|
8998
|
-
};
|
|
8999
|
-
}
|
|
9000
|
-
|
|
9001
|
-
function fileDeletionPlugin(_ref) {
|
|
9002
|
-
var handleRecoverableError = _ref.handleRecoverableError,
|
|
9003
|
-
sentryScope = _ref.sentryScope,
|
|
9004
|
-
sentryClient = _ref.sentryClient,
|
|
9005
|
-
filesToDeleteAfterUpload = _ref.filesToDeleteAfterUpload,
|
|
9006
|
-
waitUntilSourcemapFileDependenciesAreFreed = _ref.waitUntilSourcemapFileDependenciesAreFreed,
|
|
9007
|
-
logger = _ref.logger;
|
|
9008
|
-
return {
|
|
9009
|
-
name: "sentry-file-deletion-plugin",
|
|
9010
|
-
writeBundle: function writeBundle() {
|
|
9011
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9012
|
-
var filesToDelete, filePathsToDelete;
|
|
9013
|
-
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9014
|
-
while (1) switch (_context.prev = _context.next) {
|
|
9293
|
+
/**
|
|
9294
|
+
* Will delete artifacts based on the passed `sourcemaps.filesToDeleteAfterUpload` option.
|
|
9295
|
+
*/
|
|
9296
|
+
deleteArtifacts: function deleteArtifacts() {
|
|
9297
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee12() {
|
|
9298
|
+
var _options$sourcemaps5, filesToDelete, filePathsToDelete;
|
|
9299
|
+
return _regeneratorRuntime().wrap(function _callee12$(_context12) {
|
|
9300
|
+
while (1) switch (_context12.prev = _context12.next) {
|
|
9015
9301
|
case 0:
|
|
9016
|
-
|
|
9017
|
-
|
|
9018
|
-
return filesToDeleteAfterUpload;
|
|
9302
|
+
_context12.prev = 0;
|
|
9303
|
+
_context12.next = 3;
|
|
9304
|
+
return (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.filesToDeleteAfterUpload;
|
|
9019
9305
|
case 3:
|
|
9020
|
-
filesToDelete =
|
|
9306
|
+
filesToDelete = _context12.sent;
|
|
9021
9307
|
if (!(filesToDelete !== undefined)) {
|
|
9022
|
-
|
|
9308
|
+
_context12.next = 14;
|
|
9023
9309
|
break;
|
|
9024
9310
|
}
|
|
9025
|
-
|
|
9311
|
+
_context12.next = 7;
|
|
9026
9312
|
return glob(filesToDelete, {
|
|
9027
9313
|
absolute: true,
|
|
9028
9314
|
nodir: true
|
|
9029
9315
|
});
|
|
9030
9316
|
case 7:
|
|
9031
|
-
filePathsToDelete =
|
|
9317
|
+
filePathsToDelete = _context12.sent;
|
|
9032
9318
|
logger.debug("Waiting for dependencies on generated files to be freed before deleting...");
|
|
9033
|
-
|
|
9034
|
-
return
|
|
9319
|
+
_context12.next = 11;
|
|
9320
|
+
return waitUntilBuildArtifactDependenciesAreFreed();
|
|
9035
9321
|
case 11:
|
|
9036
9322
|
filePathsToDelete.forEach(function (filePathToDelete) {
|
|
9037
9323
|
logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
|
|
9038
9324
|
});
|
|
9039
|
-
|
|
9325
|
+
_context12.next = 14;
|
|
9040
9326
|
return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
|
|
9041
|
-
return
|
|
9327
|
+
return fs.promises.rm(filePathToDelete, {
|
|
9042
9328
|
force: true
|
|
9043
9329
|
})["catch"](function (e) {
|
|
9044
9330
|
// This is allowed to fail - we just don't do anything
|
|
@@ -9046,53 +9332,31 @@ function fileDeletionPlugin(_ref) {
|
|
|
9046
9332
|
});
|
|
9047
9333
|
}));
|
|
9048
9334
|
case 14:
|
|
9049
|
-
|
|
9335
|
+
_context12.next = 22;
|
|
9050
9336
|
break;
|
|
9051
9337
|
case 16:
|
|
9052
|
-
|
|
9053
|
-
|
|
9338
|
+
_context12.prev = 16;
|
|
9339
|
+
_context12.t0 = _context12["catch"](0);
|
|
9054
9340
|
sentryScope.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
|
|
9055
|
-
|
|
9341
|
+
_context12.next = 21;
|
|
9056
9342
|
return safeFlushTelemetry(sentryClient);
|
|
9057
9343
|
case 21:
|
|
9058
9344
|
// We throw by default if we get here b/c not being able to delete
|
|
9059
9345
|
// source maps could leak them to production
|
|
9060
|
-
handleRecoverableError(
|
|
9346
|
+
handleRecoverableError(_context12.t0, true);
|
|
9061
9347
|
case 22:
|
|
9062
9348
|
case "end":
|
|
9063
|
-
return
|
|
9349
|
+
return _context12.stop();
|
|
9064
9350
|
}
|
|
9065
|
-
},
|
|
9351
|
+
}, _callee12, null, [[0, 16]]);
|
|
9066
9352
|
}))();
|
|
9067
|
-
}
|
|
9353
|
+
},
|
|
9354
|
+
createDependencyOnBuildArtifacts: createDependencyOnBuildArtifacts
|
|
9068
9355
|
};
|
|
9069
9356
|
}
|
|
9070
9357
|
|
|
9071
9358
|
/**
|
|
9072
|
-
*
|
|
9073
|
-
* - Release injection
|
|
9074
|
-
* - Sourcemaps upload
|
|
9075
|
-
*
|
|
9076
|
-
* Release injection:
|
|
9077
|
-
* Per default the sentry bundler plugin will inject a global `SENTRY_RELEASE` into each JavaScript/TypeScript module
|
|
9078
|
-
* that is part of the bundle. On a technical level this is done by appending an import (`import "sentry-release-injector";`)
|
|
9079
|
-
* to all entrypoint files of the user code (see `transformInclude` and `transform` hooks). This import is then resolved
|
|
9080
|
-
* by the sentry plugin to a virtual module that sets the global variable (see `resolveId` and `load` hooks).
|
|
9081
|
-
* If a user wants to inject the release into a particular set of modules they can use the `releaseInjectionTargets` option.
|
|
9082
|
-
*
|
|
9083
|
-
* Source maps upload:
|
|
9084
|
-
*
|
|
9085
|
-
* The sentry bundler plugin will also take care of uploading source maps to Sentry. This
|
|
9086
|
-
* is all done in the `writeBundle` hook. In this hook the sentry plugin will execute the
|
|
9087
|
-
* release creation pipeline:
|
|
9088
|
-
*
|
|
9089
|
-
* 1. Create a new release
|
|
9090
|
-
* 2. Upload sourcemaps based on `include` and source-map-specific options
|
|
9091
|
-
* 3. Associate a range of commits with the release (if `setCommits` is specified)
|
|
9092
|
-
* 4. Finalize the release (unless `finalize` is disabled)
|
|
9093
|
-
* 5. Add deploy information to the release (if `deploy` is specified)
|
|
9094
|
-
*
|
|
9095
|
-
* This release creation pipeline relies on Sentry CLI to execute the different steps.
|
|
9359
|
+
* Creates an unplugin instance used to create Sentry plugins for Vite, Rollup, esbuild, and Webpack.
|
|
9096
9360
|
*/
|
|
9097
9361
|
function sentryUnpluginFactory(_ref) {
|
|
9098
9362
|
var releaseInjectionPlugin = _ref.releaseInjectionPlugin,
|
|
@@ -9102,189 +9366,46 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9102
9366
|
debugIdUploadPlugin = _ref.debugIdUploadPlugin,
|
|
9103
9367
|
bundleSizeOptimizationsPlugin = _ref.bundleSizeOptimizationsPlugin;
|
|
9104
9368
|
return createUnplugin(function () {
|
|
9105
|
-
var _userOptions$_metaOpt, _userOptions$_metaOpt2,
|
|
9369
|
+
var _userOptions$_metaOpt, _userOptions$_metaOpt2, _options$sourcemaps;
|
|
9106
9370
|
var userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
9107
9371
|
var unpluginMetaContext = arguments.length > 1 ? arguments[1] : undefined;
|
|
9108
|
-
var
|
|
9109
|
-
|
|
9110
|
-
|
|
9111
|
-
debug: (_userOptions$debug = userOptions.debug) !== null && _userOptions$debug !== void 0 ? _userOptions$debug : false
|
|
9372
|
+
var sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {
|
|
9373
|
+
loggerPrefix: (_userOptions$_metaOpt = (_userOptions$_metaOpt2 = userOptions._metaOptions) === null || _userOptions$_metaOpt2 === void 0 ? void 0 : _userOptions$_metaOpt2.loggerPrefixOverride) !== null && _userOptions$_metaOpt !== void 0 ? _userOptions$_metaOpt : "[sentry-".concat(unpluginMetaContext.framework, "-plugin]"),
|
|
9374
|
+
buildTool: unpluginMetaContext.framework
|
|
9112
9375
|
});
|
|
9113
|
-
|
|
9114
|
-
|
|
9115
|
-
|
|
9116
|
-
// here is to avoid a false positive. False negatives are okay.
|
|
9117
|
-
var isDevMode = process.env["NODE_ENV"] === "development";
|
|
9118
|
-
try {
|
|
9119
|
-
var dotenvFile = fs.readFileSync(path.join(process.cwd(), ".env.sentry-build-plugin"), "utf-8");
|
|
9120
|
-
// NOTE: Do not use the dotenv.config API directly to read the dotenv file! For some ungodly reason, it falls back to reading `${process.cwd()}/.env` which is absolutely not what we want.
|
|
9121
|
-
var dotenvResult = dotenv.parse(dotenvFile);
|
|
9122
|
-
|
|
9123
|
-
// Vite has a bug/behaviour where spreading into process.env will cause it to crash
|
|
9124
|
-
// https://github.com/vitest-dev/vitest/issues/1870#issuecomment-1501140251
|
|
9125
|
-
Object.assign(process.env, dotenvResult);
|
|
9126
|
-
logger.info('Using environment variables configured in ".env.sentry-build-plugin".');
|
|
9127
|
-
} catch (e) {
|
|
9128
|
-
// Ignore "file not found" errors but throw all others
|
|
9129
|
-
if (_typeof(e) === "object" && e && "code" in e && e.code !== "ENOENT") {
|
|
9130
|
-
throw e;
|
|
9131
|
-
}
|
|
9132
|
-
}
|
|
9133
|
-
var options = normalizeUserOptions(userOptions);
|
|
9376
|
+
var logger = sentryBuildPluginManager.logger,
|
|
9377
|
+
options = sentryBuildPluginManager.normalizedOptions,
|
|
9378
|
+
bundleSizeOptimizationReplacementValues = sentryBuildPluginManager.bundleSizeOptimizationReplacementValues;
|
|
9134
9379
|
if (options.disable) {
|
|
9135
9380
|
return [{
|
|
9136
9381
|
name: "sentry-noop-plugin"
|
|
9137
9382
|
}];
|
|
9138
9383
|
}
|
|
9139
|
-
var shouldSendTelemetry = allowedToSendTelemetry(options);
|
|
9140
|
-
var _createSentryInstance = createSentryInstance(options, shouldSendTelemetry, unpluginMetaContext.framework),
|
|
9141
|
-
sentryScope = _createSentryInstance.sentryScope,
|
|
9142
|
-
sentryClient = _createSentryInstance.sentryClient;
|
|
9143
|
-
var _sentryClient$getOpti = sentryClient.getOptions(),
|
|
9144
|
-
release = _sentryClient$getOpti.release,
|
|
9145
|
-
_sentryClient$getOpti2 = _sentryClient$getOpti.environment,
|
|
9146
|
-
environment = _sentryClient$getOpti2 === void 0 ? DEFAULT_ENVIRONMENT : _sentryClient$getOpti2;
|
|
9147
|
-
var sentrySession = makeSession({
|
|
9148
|
-
release: release,
|
|
9149
|
-
environment: environment
|
|
9150
|
-
});
|
|
9151
|
-
sentryScope.setSession(sentrySession);
|
|
9152
|
-
// Send the start of the session
|
|
9153
|
-
sentryClient.captureSession(sentrySession);
|
|
9154
|
-
var sessionHasEnded = false; // Just to prevent infinite loops with beforeExit, which is called whenever the event loop empties out
|
|
9155
|
-
|
|
9156
|
-
function endSession() {
|
|
9157
|
-
if (sessionHasEnded) {
|
|
9158
|
-
return;
|
|
9159
|
-
}
|
|
9160
|
-
closeSession(sentrySession);
|
|
9161
|
-
sentryClient.captureSession(sentrySession);
|
|
9162
|
-
sessionHasEnded = true;
|
|
9163
|
-
}
|
|
9164
|
-
|
|
9165
|
-
// We also need to manually end sessions on errors because beforeExit is not called on crashes
|
|
9166
|
-
process.on("beforeExit", function () {
|
|
9167
|
-
endSession();
|
|
9168
|
-
});
|
|
9169
|
-
|
|
9170
|
-
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
9171
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "3.3.0");
|
|
9172
|
-
|
|
9173
|
-
/**
|
|
9174
|
-
* Handles errors caught and emitted in various areas of the plugin.
|
|
9175
|
-
*
|
|
9176
|
-
* Also sets the sentry session status according to the error handling.
|
|
9177
|
-
*
|
|
9178
|
-
* If users specify their custom `errorHandler` we'll leave the decision to throw
|
|
9179
|
-
* or continue up to them. By default, @param throwByDefault controls if the plugin
|
|
9180
|
-
* should throw an error (which causes a build fail in most bundlers) or continue.
|
|
9181
|
-
*/
|
|
9182
|
-
function handleRecoverableError(unknownError, throwByDefault) {
|
|
9183
|
-
sentrySession.status = "abnormal";
|
|
9184
|
-
try {
|
|
9185
|
-
if (options.errorHandler) {
|
|
9186
|
-
try {
|
|
9187
|
-
if (unknownError instanceof Error) {
|
|
9188
|
-
options.errorHandler(unknownError);
|
|
9189
|
-
} else {
|
|
9190
|
-
options.errorHandler(new Error("An unknown error occured"));
|
|
9191
|
-
}
|
|
9192
|
-
} catch (e) {
|
|
9193
|
-
sentrySession.status = "crashed";
|
|
9194
|
-
throw e;
|
|
9195
|
-
}
|
|
9196
|
-
} else {
|
|
9197
|
-
// setting the session to "crashed" b/c from a plugin perspective this run failed.
|
|
9198
|
-
// However, we're intentionally not rethrowing the error to avoid breaking the user build.
|
|
9199
|
-
sentrySession.status = "crashed";
|
|
9200
|
-
if (throwByDefault) {
|
|
9201
|
-
throw unknownError;
|
|
9202
|
-
}
|
|
9203
|
-
logger.error("An error occurred. Couldn't finish all operations:", unknownError);
|
|
9204
|
-
}
|
|
9205
|
-
} finally {
|
|
9206
|
-
endSession();
|
|
9207
|
-
}
|
|
9208
|
-
}
|
|
9209
|
-
if (!validateOptions(options, logger)) {
|
|
9210
|
-
// Throwing by default to avoid a misconfigured plugin going unnoticed.
|
|
9211
|
-
handleRecoverableError(new Error("Options were not set correctly. See output above for more details."), true);
|
|
9212
|
-
}
|
|
9213
9384
|
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) {
|
|
9214
9385
|
logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
9215
9386
|
}
|
|
9216
9387
|
var plugins = [];
|
|
9217
|
-
plugins.push(telemetryPlugin({
|
|
9218
|
-
sentryClient: sentryClient,
|
|
9219
|
-
sentryScope: sentryScope,
|
|
9220
|
-
logger: logger,
|
|
9221
|
-
shouldSendTelemetry: shouldSendTelemetry
|
|
9222
|
-
}));
|
|
9223
9388
|
|
|
9224
|
-
//
|
|
9225
|
-
|
|
9226
|
-
|
|
9227
|
-
|
|
9228
|
-
|
|
9229
|
-
|
|
9230
|
-
|
|
9231
|
-
|
|
9232
|
-
|
|
9233
|
-
|
|
9234
|
-
|
|
9235
|
-
|
|
9236
|
-
|
|
9237
|
-
|
|
9238
|
-
|
|
9239
|
-
|
|
9240
|
-
return function freeDependencyOnSourcemapFiles() {
|
|
9241
|
-
dependenciesOnSourcemapFiles["delete"](dependencyIdentifier);
|
|
9242
|
-
notifySourcemapFileDependencySubscribers();
|
|
9243
|
-
};
|
|
9244
|
-
}
|
|
9245
|
-
|
|
9246
|
-
/**
|
|
9247
|
-
* Returns a Promise that resolves when all the currently active dependencies are freed again.
|
|
9248
|
-
*
|
|
9249
|
-
* It is very important that this function is called as late as possible before wanting to await the Promise to give
|
|
9250
|
-
* the dependency producers as much time as possible to register themselves.
|
|
9251
|
-
*/
|
|
9252
|
-
function waitUntilSourcemapFileDependenciesAreFreed() {
|
|
9253
|
-
return new Promise(function (resolve) {
|
|
9254
|
-
sourcemapFileDependencySubscribers.push(function () {
|
|
9255
|
-
if (dependenciesOnSourcemapFiles.size === 0) {
|
|
9256
|
-
resolve();
|
|
9257
|
-
}
|
|
9258
|
-
});
|
|
9259
|
-
if (dependenciesOnSourcemapFiles.size === 0) {
|
|
9260
|
-
resolve();
|
|
9261
|
-
}
|
|
9262
|
-
});
|
|
9263
|
-
}
|
|
9264
|
-
if (options.bundleSizeOptimizations) {
|
|
9265
|
-
var bundleSizeOptimizations = options.bundleSizeOptimizations;
|
|
9266
|
-
var replacementValues = {};
|
|
9267
|
-
if (bundleSizeOptimizations.excludeDebugStatements) {
|
|
9268
|
-
replacementValues["__SENTRY_DEBUG__"] = false;
|
|
9269
|
-
}
|
|
9270
|
-
if (bundleSizeOptimizations.excludeTracing) {
|
|
9271
|
-
replacementValues["__SENTRY_TRACING__"] = false;
|
|
9272
|
-
}
|
|
9273
|
-
if (bundleSizeOptimizations.excludeReplayCanvas) {
|
|
9274
|
-
replacementValues["__RRWEB_EXCLUDE_CANVAS__"] = true;
|
|
9275
|
-
}
|
|
9276
|
-
if (bundleSizeOptimizations.excludeReplayIframe) {
|
|
9277
|
-
replacementValues["__RRWEB_EXCLUDE_IFRAME__"] = true;
|
|
9278
|
-
}
|
|
9279
|
-
if (bundleSizeOptimizations.excludeReplayShadowDom) {
|
|
9280
|
-
replacementValues["__RRWEB_EXCLUDE_SHADOW_DOM__"] = true;
|
|
9281
|
-
}
|
|
9282
|
-
if (bundleSizeOptimizations.excludeReplayWorker) {
|
|
9283
|
-
replacementValues["__SENTRY_EXCLUDE_REPLAY_WORKER__"] = true;
|
|
9284
|
-
}
|
|
9285
|
-
if (Object.keys(replacementValues).length > 0) {
|
|
9286
|
-
plugins.push(bundleSizeOptimizationsPlugin(replacementValues));
|
|
9389
|
+
// Add plugin to emit a telemetry signal when the build starts
|
|
9390
|
+
plugins.push({
|
|
9391
|
+
name: "sentry-telemetry-plugin",
|
|
9392
|
+
buildStart: function buildStart() {
|
|
9393
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
9394
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
9395
|
+
while (1) switch (_context.prev = _context.next) {
|
|
9396
|
+
case 0:
|
|
9397
|
+
_context.next = 2;
|
|
9398
|
+
return sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal();
|
|
9399
|
+
case 2:
|
|
9400
|
+
case "end":
|
|
9401
|
+
return _context.stop();
|
|
9402
|
+
}
|
|
9403
|
+
}, _callee);
|
|
9404
|
+
}))();
|
|
9287
9405
|
}
|
|
9406
|
+
});
|
|
9407
|
+
if (Object.keys(bundleSizeOptimizationReplacementValues).length > 0) {
|
|
9408
|
+
plugins.push(bundleSizeOptimizationsPlugin(bundleSizeOptimizationReplacementValues));
|
|
9288
9409
|
}
|
|
9289
9410
|
if (!options.release.inject) {
|
|
9290
9411
|
logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
|
|
@@ -9297,113 +9418,44 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9297
9418
|
});
|
|
9298
9419
|
plugins.push(releaseInjectionPlugin(_injectionCode));
|
|
9299
9420
|
}
|
|
9300
|
-
if (
|
|
9301
|
-
var
|
|
9302
|
-
if (options.applicationKey) {
|
|
9303
|
-
// We use different keys so that if user-code receives multiple bundling passes, we will store the application keys of all the passes.
|
|
9304
|
-
// It is a bit unfortunate that we have to inject the metadata snippet at the top, because after multiple
|
|
9305
|
-
// injections, the first injection will always "win" because it comes last in the code. We would generally be
|
|
9306
|
-
// fine with making the last bundling pass win. But because it cannot win, we have to use a workaround of storing
|
|
9307
|
-
// the app keys in different object keys.
|
|
9308
|
-
// We can simply use the `_sentryBundlerPluginAppKey:` to filter for app keys in the SDK.
|
|
9309
|
-
metadata["_sentryBundlerPluginAppKey:".concat(options.applicationKey)] = true;
|
|
9310
|
-
}
|
|
9311
|
-
if (typeof options.moduleMetadata === "function") {
|
|
9312
|
-
var args = {
|
|
9313
|
-
org: options.org,
|
|
9314
|
-
project: options.project,
|
|
9315
|
-
release: options.release.name
|
|
9316
|
-
};
|
|
9317
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
9318
|
-
metadata = _objectSpread2(_objectSpread2({}, metadata), options.moduleMetadata(args));
|
|
9319
|
-
} else {
|
|
9320
|
-
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
|
|
9321
|
-
metadata = _objectSpread2(_objectSpread2({}, metadata), options.moduleMetadata);
|
|
9322
|
-
}
|
|
9323
|
-
var _injectionCode2 = generateModuleMetadataInjectorCode(metadata);
|
|
9421
|
+
if (Object.keys(sentryBuildPluginManager.bundleMetadata).length > 0) {
|
|
9422
|
+
var _injectionCode2 = generateModuleMetadataInjectorCode(sentryBuildPluginManager.bundleMetadata);
|
|
9324
9423
|
plugins.push(moduleMetadataInjectionPlugin(_injectionCode2));
|
|
9325
9424
|
}
|
|
9326
|
-
|
|
9327
|
-
|
|
9328
|
-
var
|
|
9329
|
-
|
|
9330
|
-
|
|
9331
|
-
|
|
9332
|
-
|
|
9333
|
-
|
|
9334
|
-
|
|
9335
|
-
|
|
9336
|
-
|
|
9337
|
-
|
|
9338
|
-
|
|
9339
|
-
|
|
9340
|
-
|
|
9341
|
-
|
|
9342
|
-
|
|
9343
|
-
|
|
9344
|
-
|
|
9345
|
-
|
|
9346
|
-
|
|
9347
|
-
|
|
9348
|
-
|
|
9349
|
-
|
|
9350
|
-
|
|
9351
|
-
deployOptions: options.release.deploy,
|
|
9352
|
-
dist: options.release.dist,
|
|
9353
|
-
handleRecoverableError: handleRecoverableError,
|
|
9354
|
-
sentryScope: sentryScope,
|
|
9355
|
-
sentryClient: sentryClient,
|
|
9356
|
-
sentryCliOptions: {
|
|
9357
|
-
authToken: options.authToken,
|
|
9358
|
-
org: options.org,
|
|
9359
|
-
project: options.project,
|
|
9360
|
-
silent: options.silent,
|
|
9361
|
-
url: options.url,
|
|
9362
|
-
vcsRemote: options.release.vcsRemote,
|
|
9363
|
-
headers: options.headers
|
|
9364
|
-
},
|
|
9365
|
-
createDependencyOnSourcemapFiles: createDependencyOnSourcemapFiles
|
|
9366
|
-
}));
|
|
9367
|
-
}
|
|
9425
|
+
|
|
9426
|
+
// Add plugin to create and finalize releases, and also take care of adding commits and legacy sourcemaps
|
|
9427
|
+
var freeGlobalDependencyOnBuildArtifacts = sentryBuildPluginManager.createDependencyOnBuildArtifacts();
|
|
9428
|
+
plugins.push({
|
|
9429
|
+
name: "sentry-release-management-plugin",
|
|
9430
|
+
writeBundle: function writeBundle() {
|
|
9431
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
9432
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
9433
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
9434
|
+
case 0:
|
|
9435
|
+
_context2.prev = 0;
|
|
9436
|
+
_context2.next = 3;
|
|
9437
|
+
return sentryBuildPluginManager.createRelease();
|
|
9438
|
+
case 3:
|
|
9439
|
+
_context2.prev = 3;
|
|
9440
|
+
freeGlobalDependencyOnBuildArtifacts();
|
|
9441
|
+
return _context2.finish(3);
|
|
9442
|
+
case 6:
|
|
9443
|
+
case "end":
|
|
9444
|
+
return _context2.stop();
|
|
9445
|
+
}
|
|
9446
|
+
}, _callee2, null, [[0,, 3, 6]]);
|
|
9447
|
+
}))();
|
|
9448
|
+
}
|
|
9449
|
+
});
|
|
9368
9450
|
if (!((_options$sourcemaps = options.sourcemaps) !== null && _options$sourcemaps !== void 0 && _options$sourcemaps.disable)) {
|
|
9369
9451
|
plugins.push(debugIdInjectionPlugin(logger));
|
|
9370
9452
|
}
|
|
9371
|
-
|
|
9372
|
-
|
|
9373
|
-
|
|
9374
|
-
|
|
9375
|
-
|
|
9376
|
-
|
|
9377
|
-
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
9378
|
-
logger.warn("No org provided. Will not upload source maps. Please set the `org` option to your Sentry organization slug." + getTurborepoEnvPassthroughWarning("SENTRY_ORG"));
|
|
9379
|
-
} else if (!options.project) {
|
|
9380
|
-
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug." + getTurborepoEnvPassthroughWarning("SENTRY_PROJECT"));
|
|
9381
|
-
} else {
|
|
9382
|
-
var _options$sourcemaps3, _options$sourcemaps4, _options$sourcemaps5;
|
|
9383
|
-
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
|
|
9384
|
-
var _webpack_forceExitOnBuildComplete = typeof options._experiments["forceExitOnBuildCompletion"] === "boolean" ? options._experiments["forceExitOnBuildCompletion"] : undefined;
|
|
9385
|
-
plugins.push(debugIdUploadPlugin(createDebugIdUploadFunction({
|
|
9386
|
-
assets: (_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.assets,
|
|
9387
|
-
ignore: (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.ignore,
|
|
9388
|
-
createDependencyOnSourcemapFiles: createDependencyOnSourcemapFiles,
|
|
9389
|
-
dist: options.release.dist,
|
|
9390
|
-
releaseName: options.release.name,
|
|
9391
|
-
logger: logger,
|
|
9392
|
-
handleRecoverableError: handleRecoverableError,
|
|
9393
|
-
rewriteSourcesHook: (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.rewriteSources,
|
|
9394
|
-
sentryScope: sentryScope,
|
|
9395
|
-
sentryClient: sentryClient,
|
|
9396
|
-
sentryCliOptions: {
|
|
9397
|
-
authToken: options.authToken,
|
|
9398
|
-
org: options.org,
|
|
9399
|
-
project: options.project,
|
|
9400
|
-
silent: options.silent,
|
|
9401
|
-
url: options.url,
|
|
9402
|
-
vcsRemote: options.release.vcsRemote,
|
|
9403
|
-
headers: options.headers
|
|
9404
|
-
}
|
|
9405
|
-
}), logger, _webpack_forceExitOnBuildComplete));
|
|
9406
|
-
}
|
|
9453
|
+
|
|
9454
|
+
// This option is only strongly typed for the webpack plugin, where it is used. It has no effect on other plugins
|
|
9455
|
+
var webpack_forceExitOnBuildComplete = typeof options._experiments["forceExitOnBuildCompletion"] === "boolean" ? options._experiments["forceExitOnBuildCompletion"] : undefined;
|
|
9456
|
+
plugins.push(debugIdUploadPlugin(createDebugIdUploadFunction({
|
|
9457
|
+
sentryBuildPluginManager: sentryBuildPluginManager
|
|
9458
|
+
}), logger, sentryBuildPluginManager.createDependencyOnBuildArtifacts, webpack_forceExitOnBuildComplete));
|
|
9407
9459
|
if (options.reactComponentAnnotation) {
|
|
9408
9460
|
if (!options.reactComponentAnnotation.enabled) {
|
|
9409
9461
|
logger.debug("The component name annotate plugin is currently disabled. Skipping component name annotations.");
|
|
@@ -9413,17 +9465,33 @@ function sentryUnpluginFactory(_ref) {
|
|
|
9413
9465
|
componentNameAnnotatePlugin && plugins.push(componentNameAnnotatePlugin(options.reactComponentAnnotation.ignoredComponents));
|
|
9414
9466
|
}
|
|
9415
9467
|
}
|
|
9416
|
-
|
|
9417
|
-
|
|
9418
|
-
|
|
9419
|
-
|
|
9420
|
-
|
|
9421
|
-
|
|
9422
|
-
|
|
9423
|
-
|
|
9468
|
+
|
|
9469
|
+
// Add plugin to delete unwanted artifacts like source maps after the uploads have completed
|
|
9470
|
+
plugins.push({
|
|
9471
|
+
name: "sentry-file-deletion-plugin",
|
|
9472
|
+
writeBundle: function writeBundle() {
|
|
9473
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
9474
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
9475
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
9476
|
+
case 0:
|
|
9477
|
+
_context3.next = 2;
|
|
9478
|
+
return sentryBuildPluginManager.deleteArtifacts();
|
|
9479
|
+
case 2:
|
|
9480
|
+
case "end":
|
|
9481
|
+
return _context3.stop();
|
|
9482
|
+
}
|
|
9483
|
+
}, _callee3);
|
|
9484
|
+
}))();
|
|
9485
|
+
}
|
|
9486
|
+
});
|
|
9424
9487
|
return plugins;
|
|
9425
9488
|
});
|
|
9426
9489
|
}
|
|
9490
|
+
|
|
9491
|
+
/**
|
|
9492
|
+
* @deprecated
|
|
9493
|
+
*/
|
|
9494
|
+
// TODO(v4): Don't export this from the package
|
|
9427
9495
|
function getBuildInformation() {
|
|
9428
9496
|
var packageJson = getPackageJson();
|
|
9429
9497
|
var _ref2 = packageJson ? getDependencies(packageJson) : {
|
|
@@ -9584,20 +9652,22 @@ function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
|
9584
9652
|
};
|
|
9585
9653
|
}
|
|
9586
9654
|
|
|
9587
|
-
function createRollupDebugIdUploadHooks(upload) {
|
|
9655
|
+
function createRollupDebugIdUploadHooks(upload, _logger, createDependencyOnBuildArtifacts) {
|
|
9656
|
+
var freeGlobalDependencyOnDebugIdSourcemapArtifacts = createDependencyOnBuildArtifacts();
|
|
9588
9657
|
return {
|
|
9589
9658
|
writeBundle: function writeBundle(outputOptions, bundle) {
|
|
9590
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9659
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
|
|
9591
9660
|
var outputDir, _buildArtifacts, _buildArtifacts2;
|
|
9592
|
-
return _regeneratorRuntime().wrap(function
|
|
9593
|
-
while (1) switch (
|
|
9661
|
+
return _regeneratorRuntime().wrap(function _callee4$(_context4) {
|
|
9662
|
+
while (1) switch (_context4.prev = _context4.next) {
|
|
9594
9663
|
case 0:
|
|
9664
|
+
_context4.prev = 0;
|
|
9595
9665
|
if (!outputOptions.dir) {
|
|
9596
|
-
|
|
9666
|
+
_context4.next = 10;
|
|
9597
9667
|
break;
|
|
9598
9668
|
}
|
|
9599
9669
|
outputDir = outputOptions.dir;
|
|
9600
|
-
|
|
9670
|
+
_context4.next = 5;
|
|
9601
9671
|
return glob(["/**/*.js", "/**/*.mjs", "/**/*.cjs", "/**/*.js.map", "/**/*.mjs.map", "/**/*.cjs.map"].map(function (q) {
|
|
9602
9672
|
return "".concat(q, "?(\\?*)?(#*)");
|
|
9603
9673
|
}),
|
|
@@ -9607,34 +9677,38 @@ function createRollupDebugIdUploadHooks(upload) {
|
|
|
9607
9677
|
absolute: true,
|
|
9608
9678
|
nodir: true
|
|
9609
9679
|
});
|
|
9610
|
-
case
|
|
9611
|
-
_buildArtifacts =
|
|
9612
|
-
|
|
9680
|
+
case 5:
|
|
9681
|
+
_buildArtifacts = _context4.sent;
|
|
9682
|
+
_context4.next = 8;
|
|
9613
9683
|
return upload(_buildArtifacts);
|
|
9614
|
-
case
|
|
9615
|
-
|
|
9684
|
+
case 8:
|
|
9685
|
+
_context4.next = 18;
|
|
9616
9686
|
break;
|
|
9617
|
-
case
|
|
9687
|
+
case 10:
|
|
9618
9688
|
if (!outputOptions.file) {
|
|
9619
|
-
|
|
9689
|
+
_context4.next = 15;
|
|
9620
9690
|
break;
|
|
9621
9691
|
}
|
|
9622
|
-
|
|
9692
|
+
_context4.next = 13;
|
|
9623
9693
|
return upload([outputOptions.file]);
|
|
9624
|
-
case
|
|
9625
|
-
|
|
9694
|
+
case 13:
|
|
9695
|
+
_context4.next = 18;
|
|
9626
9696
|
break;
|
|
9627
|
-
case
|
|
9697
|
+
case 15:
|
|
9628
9698
|
_buildArtifacts2 = Object.keys(bundle).map(function (asset) {
|
|
9629
9699
|
return path.join(path.resolve(), asset);
|
|
9630
9700
|
});
|
|
9631
|
-
|
|
9701
|
+
_context4.next = 18;
|
|
9632
9702
|
return upload(_buildArtifacts2);
|
|
9633
|
-
case
|
|
9703
|
+
case 18:
|
|
9704
|
+
_context4.prev = 18;
|
|
9705
|
+
freeGlobalDependencyOnDebugIdSourcemapArtifacts();
|
|
9706
|
+
return _context4.finish(18);
|
|
9707
|
+
case 21:
|
|
9634
9708
|
case "end":
|
|
9635
|
-
return
|
|
9709
|
+
return _context4.stop();
|
|
9636
9710
|
}
|
|
9637
|
-
},
|
|
9711
|
+
}, _callee4, null, [[0,, 18, 21]]);
|
|
9638
9712
|
}))();
|
|
9639
9713
|
}
|
|
9640
9714
|
};
|
|
@@ -9642,26 +9716,26 @@ function createRollupDebugIdUploadHooks(upload) {
|
|
|
9642
9716
|
function createComponentNameAnnotateHooks(ignoredComponents) {
|
|
9643
9717
|
return {
|
|
9644
9718
|
transform: function transform(code, id) {
|
|
9645
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
9719
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5() {
|
|
9646
9720
|
var idWithoutQueryAndHash, parserPlugins, _result$code, result;
|
|
9647
|
-
return _regeneratorRuntime().wrap(function
|
|
9648
|
-
while (1) switch (
|
|
9721
|
+
return _regeneratorRuntime().wrap(function _callee5$(_context5) {
|
|
9722
|
+
while (1) switch (_context5.prev = _context5.next) {
|
|
9649
9723
|
case 0:
|
|
9650
9724
|
// id may contain query and hash which will trip up our file extension logic below
|
|
9651
9725
|
idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
|
|
9652
9726
|
if (!idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
|
|
9653
|
-
|
|
9727
|
+
_context5.next = 3;
|
|
9654
9728
|
break;
|
|
9655
9729
|
}
|
|
9656
|
-
return
|
|
9730
|
+
return _context5.abrupt("return", null);
|
|
9657
9731
|
case 3:
|
|
9658
9732
|
if ([".jsx", ".tsx"].some(function (ending) {
|
|
9659
9733
|
return idWithoutQueryAndHash.endsWith(ending);
|
|
9660
9734
|
})) {
|
|
9661
|
-
|
|
9735
|
+
_context5.next = 5;
|
|
9662
9736
|
break;
|
|
9663
9737
|
}
|
|
9664
|
-
return
|
|
9738
|
+
return _context5.abrupt("return", null);
|
|
9665
9739
|
case 5:
|
|
9666
9740
|
parserPlugins = [];
|
|
9667
9741
|
if (idWithoutQueryAndHash.endsWith(".jsx")) {
|
|
@@ -9669,8 +9743,8 @@ function createComponentNameAnnotateHooks(ignoredComponents) {
|
|
|
9669
9743
|
} else if (idWithoutQueryAndHash.endsWith(".tsx")) {
|
|
9670
9744
|
parserPlugins.push("jsx", "typescript");
|
|
9671
9745
|
}
|
|
9672
|
-
|
|
9673
|
-
|
|
9746
|
+
_context5.prev = 7;
|
|
9747
|
+
_context5.next = 10;
|
|
9674
9748
|
return transformAsync(code, {
|
|
9675
9749
|
plugins: [[componentNameAnnotatePlugin, {
|
|
9676
9750
|
ignoredComponents: ignoredComponents
|
|
@@ -9687,24 +9761,24 @@ function createComponentNameAnnotateHooks(ignoredComponents) {
|
|
|
9687
9761
|
sourceMaps: true
|
|
9688
9762
|
});
|
|
9689
9763
|
case 10:
|
|
9690
|
-
result =
|
|
9691
|
-
return
|
|
9764
|
+
result = _context5.sent;
|
|
9765
|
+
return _context5.abrupt("return", {
|
|
9692
9766
|
code: (_result$code = result === null || result === void 0 ? void 0 : result.code) !== null && _result$code !== void 0 ? _result$code : code,
|
|
9693
9767
|
map: result === null || result === void 0 ? void 0 : result.map
|
|
9694
9768
|
});
|
|
9695
9769
|
case 14:
|
|
9696
|
-
|
|
9697
|
-
|
|
9698
|
-
logger.error("Failed to apply react annotate plugin",
|
|
9770
|
+
_context5.prev = 14;
|
|
9771
|
+
_context5.t0 = _context5["catch"](7);
|
|
9772
|
+
logger.error("Failed to apply react annotate plugin", _context5.t0);
|
|
9699
9773
|
case 17:
|
|
9700
|
-
return
|
|
9774
|
+
return _context5.abrupt("return", {
|
|
9701
9775
|
code: code
|
|
9702
9776
|
});
|
|
9703
9777
|
case 18:
|
|
9704
9778
|
case "end":
|
|
9705
|
-
return
|
|
9779
|
+
return _context5.stop();
|
|
9706
9780
|
}
|
|
9707
|
-
},
|
|
9781
|
+
}, _callee5, null, [[7, 14]]);
|
|
9708
9782
|
}))();
|
|
9709
9783
|
}
|
|
9710
9784
|
};
|
|
@@ -9713,5 +9787,5 @@ function getDebugIdSnippet(debugId) {
|
|
|
9713
9787
|
return ";{try{let e=\"undefined\"!=typeof window?window:\"undefined\"!=typeof global?global:\"undefined\"!=typeof globalThis?globalThis:\"undefined\"!=typeof self?self:{},n=(new e.Error).stack;n&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[n]=\"".concat(debugId, "\",e._sentryDebugIdIdentifier=\"sentry-dbid-").concat(debugId, "\")}catch(e){}};");
|
|
9714
9788
|
}
|
|
9715
9789
|
|
|
9716
|
-
export { createComponentNameAnnotateHooks, createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, getBuildInformation, getDebugIdSnippet, replaceBooleanFlagsInCode, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
9790
|
+
export { createComponentNameAnnotateHooks, createRollupBundleSizeOptimizationHooks, createRollupDebugIdInjectionHooks, createRollupDebugIdUploadHooks, createRollupModuleMetadataInjectionHooks, createRollupReleaseInjectionHooks, createSentryBuildPluginManager, getBuildInformation, getDebugIdSnippet, replaceBooleanFlagsInCode, sentryCliBinaryExists, sentryUnpluginFactory, stringToUUID };
|
|
9717
9791
|
//# sourceMappingURL=index.mjs.map
|