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