@sentry/bundler-plugin-core 2.18.0 → 2.20.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 +225 -116
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +225 -116
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/debug-id-upload.d.ts +2 -2
- package/dist/types/debug-id-upload.d.ts.map +1 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/plugins/release-management.d.ts +2 -1
- package/dist/types/plugins/release-management.d.ts.map +1 -1
- package/dist/types/plugins/sourcemap-deletion.d.ts +11 -0
- package/dist/types/plugins/sourcemap-deletion.d.ts.map +1 -0
- package/dist/types/utils.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/cjs/index.js
CHANGED
|
@@ -612,30 +612,77 @@ function gitRevision() {
|
|
|
612
612
|
* Tries to guess a release name based on environmental data.
|
|
613
613
|
*/
|
|
614
614
|
function determineReleaseName() {
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
615
|
+
// This list is in approximate alpha order, separated into 3 categories:
|
|
616
|
+
// 1. Git providers
|
|
617
|
+
// 2. CI providers with specific environment variables (has the provider name in the variable name)
|
|
618
|
+
// 3. CI providers with generic environment variables (checked for last to prevent possible false positives)
|
|
619
|
+
|
|
620
|
+
var possibleReleaseNameOfGitProvider =
|
|
621
|
+
// GitHub Actions - https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables
|
|
622
|
+
process.env["GITHUB_SHA"] ||
|
|
623
|
+
// GitLab CI - https://docs.gitlab.com/ee/ci/variables/predefined_variables.html
|
|
624
|
+
process.env["CI_MERGE_REQUEST_SOURCE_BRANCH_SHA"] || process.env["CI_BUILD_REF"] || process.env["CI_COMMIT_SHA"] ||
|
|
625
|
+
// Bitbucket - https://support.atlassian.com/bitbucket-cloud/docs/variables-and-secrets/
|
|
626
|
+
process.env["BITBUCKET_COMMIT"];
|
|
627
|
+
var possibleReleaseNameOfCiProvidersWithSpecificEnvVar =
|
|
628
|
+
// AppVeyor - https://www.appveyor.com/docs/environment-variables/
|
|
629
|
+
process.env["APPVEYOR_PULL_REQUEST_HEAD_COMMIT"] || process.env["APPVEYOR_REPO_COMMIT"] ||
|
|
630
|
+
// AWS CodeBuild - https://docs.aws.amazon.com/codebuild/latest/userguide/build-env-ref-env-vars.html
|
|
631
|
+
process.env["CODEBUILD_RESOLVED_SOURCE_VERSION"] ||
|
|
632
|
+
// AWS Amplify - https://docs.aws.amazon.com/amplify/latest/userguide/environment-variables.html
|
|
633
|
+
process.env["AWS_COMMIT_ID"] ||
|
|
634
|
+
// Azure Pipelines - https://docs.microsoft.com/en-us/azure/devops/pipelines/build/variables?view=azure-devops&tabs=yaml
|
|
635
|
+
process.env["BUILD_SOURCEVERSION"] ||
|
|
636
|
+
// Bitrise - https://devcenter.bitrise.io/builds/available-environment-variables/
|
|
637
|
+
process.env["GIT_CLONE_COMMIT_HASH"] ||
|
|
638
|
+
// Buddy CI - https://buddy.works/docs/pipelines/environment-variables#default-environment-variables
|
|
639
|
+
process.env["BUDDY_EXECUTION_REVISION"] ||
|
|
640
|
+
// Builtkite - https://buildkite.com/docs/pipelines/environment-variables
|
|
641
|
+
process.env["BUILDKITE_COMMIT"] ||
|
|
642
|
+
// CircleCI - https://circleci.com/docs/variables/
|
|
643
|
+
process.env["CIRCLE_SHA1"] ||
|
|
644
|
+
// Cirrus CI - https://cirrus-ci.org/guide/writing-tasks/#environment-variables
|
|
645
|
+
process.env["CIRRUS_CHANGE_IN_REPO"] ||
|
|
646
|
+
// Codefresh - https://codefresh.io/docs/docs/codefresh-yaml/variables/
|
|
647
|
+
process.env["CF_REVISION"] ||
|
|
648
|
+
// Codemagic - https://docs.codemagic.io/yaml-basic-configuration/environment-variables/
|
|
649
|
+
process.env["CM_COMMIT"] ||
|
|
650
|
+
// Cloudflare Pages - https://developers.cloudflare.com/pages/platform/build-configuration/#environment-variables
|
|
651
|
+
process.env["CF_PAGES_COMMIT_SHA"] ||
|
|
652
|
+
// Drone - https://docs.drone.io/pipeline/environment/reference/
|
|
653
|
+
process.env["DRONE_COMMIT_SHA"] ||
|
|
654
|
+
// Flightcontrol - https://www.flightcontrol.dev/docs/guides/flightcontrol/environment-variables#built-in-environment-variables
|
|
655
|
+
process.env["FC_GIT_COMMIT_SHA"] ||
|
|
656
|
+
// Heroku #1 https://devcenter.heroku.com/articles/heroku-ci
|
|
657
|
+
process.env["HEROKU_TEST_RUN_COMMIT_VERSION"] ||
|
|
658
|
+
// Heroku #2 https://docs.sentry.io/product/integrations/deployment/heroku/#configure-releases
|
|
659
|
+
process.env["HEROKU_SLUG_COMMIT"] ||
|
|
660
|
+
// Render - https://render.com/docs/environment-variables
|
|
661
|
+
process.env["RENDER_GIT_COMMIT"] ||
|
|
662
|
+
// Semaphore CI - https://docs.semaphoreci.com/ci-cd-environment/environment-variables
|
|
663
|
+
process.env["SEMAPHORE_GIT_SHA"] ||
|
|
664
|
+
// TravisCI - https://docs.travis-ci.com/user/environment-variables/#default-environment-variables
|
|
665
|
+
process.env["TRAVIS_PULL_REQUEST_SHA"] ||
|
|
666
|
+
// Vercel - https://vercel.com/docs/v2/build-step#system-environment-variables
|
|
667
|
+
process.env["VERCEL_GIT_COMMIT_SHA"] || process.env["VERCEL_GITHUB_COMMIT_SHA"] || process.env["VERCEL_GITLAB_COMMIT_SHA"] || process.env["VERCEL_BITBUCKET_COMMIT_SHA"] ||
|
|
668
|
+
// Zeit (now known as Vercel)
|
|
669
|
+
process.env["ZEIT_GITHUB_COMMIT_SHA"] || process.env["ZEIT_GITLAB_COMMIT_SHA"] || process.env["ZEIT_BITBUCKET_COMMIT_SHA"];
|
|
670
|
+
var possibleReleaseNameOfCiProvidersWithGenericEnvVar =
|
|
671
|
+
// CloudBees CodeShip - https://docs.cloudbees.com/docs/cloudbees-codeship/latest/pro-builds-and-configuration/environment-variables
|
|
672
|
+
process.env["CI_COMMIT_ID"] ||
|
|
673
|
+
// Coolify - https://coolify.io/docs/knowledge-base/environment-variables
|
|
674
|
+
process.env["SOURCE_COMMIT"] ||
|
|
675
|
+
// Heroku #3 https://devcenter.heroku.com/changelog-items/630
|
|
676
|
+
process.env["SOURCE_VERSION"] ||
|
|
677
|
+
// Jenkins - https://plugins.jenkins.io/git/#environment-variables
|
|
678
|
+
process.env["GIT_COMMIT"] ||
|
|
679
|
+
// Netlify - https://docs.netlify.com/configure-builds/environment-variables/#build-metadata
|
|
680
|
+
process.env["COMMIT_REF"] ||
|
|
681
|
+
// TeamCity - https://www.jetbrains.com/help/teamcity/predefined-build-parameters.html
|
|
682
|
+
process.env["BUILD_VCS_NUMBER"] ||
|
|
683
|
+
// Woodpecker CI - https://woodpecker-ci.org/docs/usage/environment
|
|
684
|
+
process.env["CI_COMMIT_SHA"];
|
|
685
|
+
return possibleReleaseNameOfGitProvider || possibleReleaseNameOfCiProvidersWithSpecificEnvVar || possibleReleaseNameOfCiProvidersWithGenericEnvVar || gitRevision();
|
|
639
686
|
}
|
|
640
687
|
|
|
641
688
|
/**
|
|
@@ -13612,7 +13659,7 @@ function createSentryInstance(options, shouldSendTelemetry, bundler) {
|
|
|
13612
13659
|
dsn: "https://4c2bae7d9fbc413e8f7385f55c515d51@o1.ingest.sentry.io/6690737",
|
|
13613
13660
|
tracesSampleRate: 1,
|
|
13614
13661
|
sampleRate: 1,
|
|
13615
|
-
release: "2.
|
|
13662
|
+
release: "2.20.0",
|
|
13616
13663
|
integrations: [],
|
|
13617
13664
|
tracePropagationTargets: ["sentry.io/api"],
|
|
13618
13665
|
stackParser: defaultStackParser,
|
|
@@ -13814,10 +13861,10 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
13814
13861
|
sentryClient = _ref.sentryClient,
|
|
13815
13862
|
sentryCliOptions = _ref.sentryCliOptions,
|
|
13816
13863
|
rewriteSourcesHook = _ref.rewriteSourcesHook,
|
|
13817
|
-
|
|
13864
|
+
deleteFilesUpForDeletion = _ref.deleteFilesUpForDeletion;
|
|
13818
13865
|
return /*#__PURE__*/function () {
|
|
13819
13866
|
var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(buildArtifactPaths) {
|
|
13820
|
-
var artifactBundleUploadTransaction, folderToCleanUp, mkdtempSpan, tmpUploadFolder, globAssets, globSpan, globResult, debugIdChunkFilePaths, prepareSpan, preparationTasks, workers, worker, workerIndex, files, stats, uploadSize, uploadSpan, cliInstance,
|
|
13867
|
+
var artifactBundleUploadTransaction, folderToCleanUp, mkdtempSpan, tmpUploadFolder, globAssets, globSpan, globResult, debugIdChunkFilePaths, prepareSpan, preparationTasks, workers, worker, workerIndex, files, stats, uploadSize, uploadSpan, cliInstance, cleanupSpan;
|
|
13821
13868
|
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
13822
13869
|
while (1) switch (_context3.prev = _context3.next) {
|
|
13823
13870
|
case 0:
|
|
@@ -13970,51 +14017,21 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
13970
14017
|
uploadSpan.finish();
|
|
13971
14018
|
logger.info("Successfully uploaded source maps to Sentry");
|
|
13972
14019
|
case 47:
|
|
13973
|
-
|
|
13974
|
-
|
|
13975
|
-
|
|
13976
|
-
|
|
13977
|
-
deleteGlobSpan = artifactBundleUploadTransaction.startChild({
|
|
13978
|
-
description: "delete-glob"
|
|
13979
|
-
});
|
|
13980
|
-
_context3.next = 51;
|
|
13981
|
-
return glob.glob(filesToDeleteAfterUpload, {
|
|
13982
|
-
absolute: true,
|
|
13983
|
-
nodir: true
|
|
13984
|
-
});
|
|
13985
|
-
case 51:
|
|
13986
|
-
filePathsToDelete = _context3.sent;
|
|
13987
|
-
deleteGlobSpan.finish();
|
|
13988
|
-
filePathsToDelete.forEach(function (filePathToDelete) {
|
|
13989
|
-
logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
|
|
13990
|
-
});
|
|
13991
|
-
deleteSpan = artifactBundleUploadTransaction.startChild({
|
|
13992
|
-
description: "delete-files-after-upload"
|
|
13993
|
-
});
|
|
13994
|
-
_context3.next = 57;
|
|
13995
|
-
return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
|
|
13996
|
-
return fs__default["default"].promises.rm(filePathToDelete, {
|
|
13997
|
-
force: true
|
|
13998
|
-
})["catch"](function (e) {
|
|
13999
|
-
// This is allowed to fail - we just don't do anything
|
|
14000
|
-
logger.debug("An error occured while attempting to delete asset: ".concat(filePathToDelete), e);
|
|
14001
|
-
});
|
|
14002
|
-
}));
|
|
14003
|
-
case 57:
|
|
14004
|
-
deleteSpan.finish();
|
|
14005
|
-
case 58:
|
|
14006
|
-
_context3.next = 64;
|
|
14020
|
+
_context3.next = 49;
|
|
14021
|
+
return deleteFilesUpForDeletion();
|
|
14022
|
+
case 49:
|
|
14023
|
+
_context3.next = 55;
|
|
14007
14024
|
break;
|
|
14008
|
-
case
|
|
14009
|
-
_context3.prev =
|
|
14025
|
+
case 51:
|
|
14026
|
+
_context3.prev = 51;
|
|
14010
14027
|
_context3.t0 = _context3["catch"](1);
|
|
14011
14028
|
sentryHub.withScope(function (scope) {
|
|
14012
14029
|
scope.setSpan(artifactBundleUploadTransaction);
|
|
14013
14030
|
sentryHub.captureException('Error in "debugIdUploadPlugin" writeBundle hook');
|
|
14014
14031
|
});
|
|
14015
14032
|
handleRecoverableError(_context3.t0);
|
|
14016
|
-
case
|
|
14017
|
-
_context3.prev =
|
|
14033
|
+
case 55:
|
|
14034
|
+
_context3.prev = 55;
|
|
14018
14035
|
if (folderToCleanUp) {
|
|
14019
14036
|
cleanupSpan = artifactBundleUploadTransaction.startChild({
|
|
14020
14037
|
description: "cleanup"
|
|
@@ -14026,15 +14043,15 @@ function createDebugIdUploadFunction(_ref) {
|
|
|
14026
14043
|
cleanupSpan.finish();
|
|
14027
14044
|
}
|
|
14028
14045
|
artifactBundleUploadTransaction.finish();
|
|
14029
|
-
_context3.next =
|
|
14046
|
+
_context3.next = 60;
|
|
14030
14047
|
return safeFlushTelemetry(sentryClient);
|
|
14031
|
-
case
|
|
14032
|
-
return _context3.finish(
|
|
14033
|
-
case
|
|
14048
|
+
case 60:
|
|
14049
|
+
return _context3.finish(55);
|
|
14050
|
+
case 61:
|
|
14034
14051
|
case "end":
|
|
14035
14052
|
return _context3.stop();
|
|
14036
14053
|
}
|
|
14037
|
-
}, _callee3, null, [[1,
|
|
14054
|
+
}, _callee3, null, [[1, 51, 55, 61]]);
|
|
14038
14055
|
}));
|
|
14039
14056
|
return function (_x) {
|
|
14040
14057
|
return _ref2.apply(this, arguments);
|
|
@@ -14280,7 +14297,8 @@ function releaseManagementPlugin(_ref) {
|
|
|
14280
14297
|
handleRecoverableError = _ref.handleRecoverableError,
|
|
14281
14298
|
sentryHub = _ref.sentryHub,
|
|
14282
14299
|
sentryClient = _ref.sentryClient,
|
|
14283
|
-
sentryCliOptions = _ref.sentryCliOptions
|
|
14300
|
+
sentryCliOptions = _ref.sentryCliOptions,
|
|
14301
|
+
deleteFilesUpForDeletion = _ref.deleteFilesUpForDeletion;
|
|
14284
14302
|
return {
|
|
14285
14303
|
name: "sentry-debug-id-upload-plugin",
|
|
14286
14304
|
writeBundle: function writeBundle() {
|
|
@@ -14343,21 +14361,24 @@ function releaseManagementPlugin(_ref) {
|
|
|
14343
14361
|
_context.next = 18;
|
|
14344
14362
|
return cliInstance.releases.newDeploy(releaseName, deployOptions);
|
|
14345
14363
|
case 18:
|
|
14346
|
-
_context.next =
|
|
14347
|
-
|
|
14364
|
+
_context.next = 20;
|
|
14365
|
+
return deleteFilesUpForDeletion();
|
|
14348
14366
|
case 20:
|
|
14349
|
-
_context.
|
|
14367
|
+
_context.next = 28;
|
|
14368
|
+
break;
|
|
14369
|
+
case 22:
|
|
14370
|
+
_context.prev = 22;
|
|
14350
14371
|
_context.t0 = _context["catch"](0);
|
|
14351
14372
|
sentryHub.captureException('Error in "releaseManagementPlugin" writeBundle hook');
|
|
14352
|
-
_context.next =
|
|
14373
|
+
_context.next = 27;
|
|
14353
14374
|
return safeFlushTelemetry(sentryClient);
|
|
14354
|
-
case
|
|
14375
|
+
case 27:
|
|
14355
14376
|
handleRecoverableError(_context.t0);
|
|
14356
|
-
case
|
|
14377
|
+
case 28:
|
|
14357
14378
|
case "end":
|
|
14358
14379
|
return _context.stop();
|
|
14359
14380
|
}
|
|
14360
|
-
}, _callee, null, [[0,
|
|
14381
|
+
}, _callee, null, [[0, 22]]);
|
|
14361
14382
|
}))();
|
|
14362
14383
|
}
|
|
14363
14384
|
};
|
|
@@ -14382,7 +14403,7 @@ function telemetryPlugin(_ref) {
|
|
|
14382
14403
|
_context.next = 7;
|
|
14383
14404
|
break;
|
|
14384
14405
|
}
|
|
14385
|
-
logger.info("Sending
|
|
14406
|
+
logger.info("Sending telemetry data on issues and performance to Sentry. To disable telemetry, set `options.telemetry` to `false`.");
|
|
14386
14407
|
sentryHub.startTransaction({
|
|
14387
14408
|
name: "Sentry Bundler Plugin execution"
|
|
14388
14409
|
}).finish();
|
|
@@ -14443,6 +14464,42 @@ function createLogger(options) {
|
|
|
14443
14464
|
};
|
|
14444
14465
|
}
|
|
14445
14466
|
|
|
14467
|
+
function fileDeletionPlugin(_ref) {
|
|
14468
|
+
var handleRecoverableError = _ref.handleRecoverableError,
|
|
14469
|
+
sentryHub = _ref.sentryHub,
|
|
14470
|
+
sentryClient = _ref.sentryClient,
|
|
14471
|
+
deleteFilesUpForDeletion = _ref.deleteFilesUpForDeletion;
|
|
14472
|
+
return {
|
|
14473
|
+
name: "sentry-file-deletion-plugin",
|
|
14474
|
+
writeBundle: function writeBundle() {
|
|
14475
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
14476
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
14477
|
+
while (1) switch (_context.prev = _context.next) {
|
|
14478
|
+
case 0:
|
|
14479
|
+
_context.prev = 0;
|
|
14480
|
+
_context.next = 3;
|
|
14481
|
+
return deleteFilesUpForDeletion();
|
|
14482
|
+
case 3:
|
|
14483
|
+
_context.next = 11;
|
|
14484
|
+
break;
|
|
14485
|
+
case 5:
|
|
14486
|
+
_context.prev = 5;
|
|
14487
|
+
_context.t0 = _context["catch"](0);
|
|
14488
|
+
sentryHub.captureException('Error in "sentry-file-deletion-plugin" buildEnd hook');
|
|
14489
|
+
_context.next = 10;
|
|
14490
|
+
return safeFlushTelemetry(sentryClient);
|
|
14491
|
+
case 10:
|
|
14492
|
+
handleRecoverableError(_context.t0);
|
|
14493
|
+
case 11:
|
|
14494
|
+
case "end":
|
|
14495
|
+
return _context.stop();
|
|
14496
|
+
}
|
|
14497
|
+
}, _callee, null, [[0, 5]]);
|
|
14498
|
+
}))();
|
|
14499
|
+
}
|
|
14500
|
+
};
|
|
14501
|
+
}
|
|
14502
|
+
|
|
14446
14503
|
/**
|
|
14447
14504
|
* The sentry bundler plugin concerns itself with two things:
|
|
14448
14505
|
* - Release injection
|
|
@@ -14489,7 +14546,10 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14489
14546
|
var dotenvFile = fs__namespace.readFileSync(path__namespace.join(process.cwd(), ".env.sentry-build-plugin"), "utf-8");
|
|
14490
14547
|
// 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.
|
|
14491
14548
|
var dotenvResult = dotenv__namespace.parse(dotenvFile);
|
|
14492
|
-
|
|
14549
|
+
|
|
14550
|
+
// Vite has a bug/behaviour where spreading into process.env will cause it to crash
|
|
14551
|
+
// https://github.com/vitest-dev/vitest/issues/1870#issuecomment-1501140251
|
|
14552
|
+
Object.assign(process.env, dotenvResult);
|
|
14493
14553
|
logger.info('Using environment variables configured in ".env.sentry-build-plugin".');
|
|
14494
14554
|
} catch (e) {
|
|
14495
14555
|
// Ignore "file not found" errors but throw all others
|
|
@@ -14524,7 +14584,7 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14524
14584
|
});
|
|
14525
14585
|
|
|
14526
14586
|
// Set the User-Agent that Sentry CLI will use when interacting with Sentry
|
|
14527
|
-
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.
|
|
14587
|
+
process.env["SENTRY_PIPELINE"] = "".concat(unpluginMetaContext.framework, "-plugin/", "2.20.0");
|
|
14528
14588
|
function handleRecoverableError(unknownError) {
|
|
14529
14589
|
sentrySession.status = "abnormal";
|
|
14530
14590
|
try {
|
|
@@ -14560,6 +14620,48 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14560
14620
|
logger: logger,
|
|
14561
14621
|
shouldSendTelemetry: shouldSendTelemetry
|
|
14562
14622
|
}));
|
|
14623
|
+
function deleteFilesUpForDeletion() {
|
|
14624
|
+
return _deleteFilesUpForDeletion.apply(this, arguments);
|
|
14625
|
+
}
|
|
14626
|
+
function _deleteFilesUpForDeletion() {
|
|
14627
|
+
_deleteFilesUpForDeletion = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
|
|
14628
|
+
var _options$sourcemaps$f, _options$sourcemaps4, _options$sourcemaps5;
|
|
14629
|
+
var filesToDeleteAfterUpload, filePathsToDelete;
|
|
14630
|
+
return _regeneratorRuntime().wrap(function _callee$(_context) {
|
|
14631
|
+
while (1) switch (_context.prev = _context.next) {
|
|
14632
|
+
case 0:
|
|
14633
|
+
filesToDeleteAfterUpload = (_options$sourcemaps$f = (_options$sourcemaps4 = options.sourcemaps) === null || _options$sourcemaps4 === void 0 ? void 0 : _options$sourcemaps4.filesToDeleteAfterUpload) !== null && _options$sourcemaps$f !== void 0 ? _options$sourcemaps$f : (_options$sourcemaps5 = options.sourcemaps) === null || _options$sourcemaps5 === void 0 ? void 0 : _options$sourcemaps5.deleteFilesAfterUpload;
|
|
14634
|
+
if (!filesToDeleteAfterUpload) {
|
|
14635
|
+
_context.next = 8;
|
|
14636
|
+
break;
|
|
14637
|
+
}
|
|
14638
|
+
_context.next = 4;
|
|
14639
|
+
return glob.glob(filesToDeleteAfterUpload, {
|
|
14640
|
+
absolute: true,
|
|
14641
|
+
nodir: true
|
|
14642
|
+
});
|
|
14643
|
+
case 4:
|
|
14644
|
+
filePathsToDelete = _context.sent;
|
|
14645
|
+
filePathsToDelete.forEach(function (filePathToDelete) {
|
|
14646
|
+
logger.debug("Deleting asset after upload: ".concat(filePathToDelete));
|
|
14647
|
+
});
|
|
14648
|
+
_context.next = 8;
|
|
14649
|
+
return Promise.all(filePathsToDelete.map(function (filePathToDelete) {
|
|
14650
|
+
return fs__namespace.promises.rm(filePathToDelete, {
|
|
14651
|
+
force: true
|
|
14652
|
+
})["catch"](function (e) {
|
|
14653
|
+
// This is allowed to fail - we just don't do anything
|
|
14654
|
+
logger.debug("An error occurred while attempting to delete asset: ".concat(filePathToDelete), e);
|
|
14655
|
+
});
|
|
14656
|
+
}));
|
|
14657
|
+
case 8:
|
|
14658
|
+
case "end":
|
|
14659
|
+
return _context.stop();
|
|
14660
|
+
}
|
|
14661
|
+
}, _callee);
|
|
14662
|
+
}));
|
|
14663
|
+
return _deleteFilesUpForDeletion.apply(this, arguments);
|
|
14664
|
+
}
|
|
14563
14665
|
if (options.bundleSizeOptimizations) {
|
|
14564
14666
|
var bundleSizeOptimizations = options.bundleSizeOptimizations;
|
|
14565
14667
|
var replacementValues = {};
|
|
@@ -14651,10 +14753,17 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14651
14753
|
url: options.url,
|
|
14652
14754
|
vcsRemote: options.release.vcsRemote,
|
|
14653
14755
|
headers: options.headers
|
|
14654
|
-
}
|
|
14756
|
+
},
|
|
14757
|
+
deleteFilesUpForDeletion: deleteFilesUpForDeletion
|
|
14655
14758
|
}));
|
|
14656
14759
|
}
|
|
14657
14760
|
plugins.push(debugIdInjectionPlugin(logger));
|
|
14761
|
+
plugins.push(fileDeletionPlugin({
|
|
14762
|
+
deleteFilesUpForDeletion: deleteFilesUpForDeletion,
|
|
14763
|
+
handleRecoverableError: handleRecoverableError,
|
|
14764
|
+
sentryHub: sentryHub,
|
|
14765
|
+
sentryClient: sentryClient
|
|
14766
|
+
}));
|
|
14658
14767
|
if (!options.authToken) {
|
|
14659
14768
|
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/");
|
|
14660
14769
|
} else if (!options.org && !options.authToken.startsWith("sntrys_")) {
|
|
@@ -14662,16 +14771,16 @@ function sentryUnpluginFactory(_ref) {
|
|
|
14662
14771
|
} else if (!options.project) {
|
|
14663
14772
|
logger.warn("No project provided. Will not upload source maps. Please set the `project` option to your Sentry project slug.");
|
|
14664
14773
|
} else {
|
|
14665
|
-
var _options$sourcemaps, _options$sourcemaps2, _options$
|
|
14774
|
+
var _options$sourcemaps, _options$sourcemaps2, _options$sourcemaps3;
|
|
14666
14775
|
plugins.push(debugIdUploadPlugin(createDebugIdUploadFunction({
|
|
14667
14776
|
assets: (_options$sourcemaps = options.sourcemaps) === null || _options$sourcemaps === void 0 ? void 0 : _options$sourcemaps.assets,
|
|
14668
14777
|
ignore: (_options$sourcemaps2 = options.sourcemaps) === null || _options$sourcemaps2 === void 0 ? void 0 : _options$sourcemaps2.ignore,
|
|
14669
|
-
|
|
14778
|
+
deleteFilesUpForDeletion: deleteFilesUpForDeletion,
|
|
14670
14779
|
dist: options.release.dist,
|
|
14671
14780
|
releaseName: options.release.name,
|
|
14672
14781
|
logger: logger,
|
|
14673
14782
|
handleRecoverableError: handleRecoverableError,
|
|
14674
|
-
rewriteSourcesHook: (_options$
|
|
14783
|
+
rewriteSourcesHook: (_options$sourcemaps3 = options.sourcemaps) === null || _options$sourcemaps3 === void 0 ? void 0 : _options$sourcemaps3.rewriteSources,
|
|
14675
14784
|
sentryHub: sentryHub,
|
|
14676
14785
|
sentryClient: sentryClient,
|
|
14677
14786
|
sentryCliOptions: {
|
|
@@ -14858,50 +14967,50 @@ function createRollupModuleMetadataInjectionHooks(injectionCode) {
|
|
|
14858
14967
|
function createRollupDebugIdUploadHooks(upload) {
|
|
14859
14968
|
return {
|
|
14860
14969
|
writeBundle: function writeBundle(outputOptions, bundle) {
|
|
14861
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
14970
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
|
|
14862
14971
|
var outputDir, _buildArtifacts, _buildArtifacts2;
|
|
14863
|
-
return _regeneratorRuntime().wrap(function
|
|
14864
|
-
while (1) switch (
|
|
14972
|
+
return _regeneratorRuntime().wrap(function _callee2$(_context2) {
|
|
14973
|
+
while (1) switch (_context2.prev = _context2.next) {
|
|
14865
14974
|
case 0:
|
|
14866
14975
|
if (!outputOptions.dir) {
|
|
14867
|
-
|
|
14976
|
+
_context2.next = 9;
|
|
14868
14977
|
break;
|
|
14869
14978
|
}
|
|
14870
14979
|
outputDir = outputOptions.dir;
|
|
14871
|
-
|
|
14980
|
+
_context2.next = 4;
|
|
14872
14981
|
return glob.glob(["/**/*.js", "/**/*.mjs", "/**/*.cjs", "/**/*.js.map", "/**/*.mjs.map", "/**/*.cjs.map"], {
|
|
14873
14982
|
root: outputDir,
|
|
14874
14983
|
absolute: true,
|
|
14875
14984
|
nodir: true
|
|
14876
14985
|
});
|
|
14877
14986
|
case 4:
|
|
14878
|
-
_buildArtifacts =
|
|
14879
|
-
|
|
14987
|
+
_buildArtifacts = _context2.sent;
|
|
14988
|
+
_context2.next = 7;
|
|
14880
14989
|
return upload(_buildArtifacts);
|
|
14881
14990
|
case 7:
|
|
14882
|
-
|
|
14991
|
+
_context2.next = 17;
|
|
14883
14992
|
break;
|
|
14884
14993
|
case 9:
|
|
14885
14994
|
if (!outputOptions.file) {
|
|
14886
|
-
|
|
14995
|
+
_context2.next = 14;
|
|
14887
14996
|
break;
|
|
14888
14997
|
}
|
|
14889
|
-
|
|
14998
|
+
_context2.next = 12;
|
|
14890
14999
|
return upload([outputOptions.file]);
|
|
14891
15000
|
case 12:
|
|
14892
|
-
|
|
15001
|
+
_context2.next = 17;
|
|
14893
15002
|
break;
|
|
14894
15003
|
case 14:
|
|
14895
15004
|
_buildArtifacts2 = Object.keys(bundle).map(function (asset) {
|
|
14896
15005
|
return path__namespace.join(path__namespace.resolve(), asset);
|
|
14897
15006
|
});
|
|
14898
|
-
|
|
15007
|
+
_context2.next = 17;
|
|
14899
15008
|
return upload(_buildArtifacts2);
|
|
14900
15009
|
case 17:
|
|
14901
15010
|
case "end":
|
|
14902
|
-
return
|
|
15011
|
+
return _context2.stop();
|
|
14903
15012
|
}
|
|
14904
|
-
},
|
|
15013
|
+
}, _callee2);
|
|
14905
15014
|
}))();
|
|
14906
15015
|
}
|
|
14907
15016
|
};
|
|
@@ -14909,26 +15018,26 @@ function createRollupDebugIdUploadHooks(upload) {
|
|
|
14909
15018
|
function createComponentNameAnnotateHooks() {
|
|
14910
15019
|
return {
|
|
14911
15020
|
transform: function transform(code, id) {
|
|
14912
|
-
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function
|
|
15021
|
+
return _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
|
|
14913
15022
|
var idWithoutQueryAndHash, parserPlugins, _result$code, result;
|
|
14914
|
-
return _regeneratorRuntime().wrap(function
|
|
14915
|
-
while (1) switch (
|
|
15023
|
+
return _regeneratorRuntime().wrap(function _callee3$(_context3) {
|
|
15024
|
+
while (1) switch (_context3.prev = _context3.next) {
|
|
14916
15025
|
case 0:
|
|
14917
15026
|
// id may contain query and hash which will trip up our file extension logic below
|
|
14918
15027
|
idWithoutQueryAndHash = stripQueryAndHashFromPath(id);
|
|
14919
15028
|
if (!idWithoutQueryAndHash.match(/\\node_modules\\|\/node_modules\//)) {
|
|
14920
|
-
|
|
15029
|
+
_context3.next = 3;
|
|
14921
15030
|
break;
|
|
14922
15031
|
}
|
|
14923
|
-
return
|
|
15032
|
+
return _context3.abrupt("return", null);
|
|
14924
15033
|
case 3:
|
|
14925
15034
|
if ([".jsx", ".tsx"].some(function (ending) {
|
|
14926
15035
|
return idWithoutQueryAndHash.endsWith(ending);
|
|
14927
15036
|
})) {
|
|
14928
|
-
|
|
15037
|
+
_context3.next = 5;
|
|
14929
15038
|
break;
|
|
14930
15039
|
}
|
|
14931
|
-
return
|
|
15040
|
+
return _context3.abrupt("return", null);
|
|
14932
15041
|
case 5:
|
|
14933
15042
|
parserPlugins = [];
|
|
14934
15043
|
if (idWithoutQueryAndHash.endsWith(".jsx")) {
|
|
@@ -14936,8 +15045,8 @@ function createComponentNameAnnotateHooks() {
|
|
|
14936
15045
|
} else if (idWithoutQueryAndHash.endsWith(".tsx")) {
|
|
14937
15046
|
parserPlugins.push("jsx", "typescript");
|
|
14938
15047
|
}
|
|
14939
|
-
|
|
14940
|
-
|
|
15048
|
+
_context3.prev = 7;
|
|
15049
|
+
_context3.next = 10;
|
|
14941
15050
|
return core.transformAsync(code, {
|
|
14942
15051
|
plugins: [[componentNameAnnotatePlugin__default["default"]]],
|
|
14943
15052
|
filename: id,
|
|
@@ -14952,24 +15061,24 @@ function createComponentNameAnnotateHooks() {
|
|
|
14952
15061
|
sourceMaps: true
|
|
14953
15062
|
});
|
|
14954
15063
|
case 10:
|
|
14955
|
-
result =
|
|
14956
|
-
return
|
|
15064
|
+
result = _context3.sent;
|
|
15065
|
+
return _context3.abrupt("return", {
|
|
14957
15066
|
code: (_result$code = result === null || result === void 0 ? void 0 : result.code) !== null && _result$code !== void 0 ? _result$code : code,
|
|
14958
15067
|
map: result === null || result === void 0 ? void 0 : result.map
|
|
14959
15068
|
});
|
|
14960
15069
|
case 14:
|
|
14961
|
-
|
|
14962
|
-
|
|
14963
|
-
logger.error("Failed to apply react annotate plugin",
|
|
15070
|
+
_context3.prev = 14;
|
|
15071
|
+
_context3.t0 = _context3["catch"](7);
|
|
15072
|
+
logger.error("Failed to apply react annotate plugin", _context3.t0);
|
|
14964
15073
|
case 17:
|
|
14965
|
-
return
|
|
15074
|
+
return _context3.abrupt("return", {
|
|
14966
15075
|
code: code
|
|
14967
15076
|
});
|
|
14968
15077
|
case 18:
|
|
14969
15078
|
case "end":
|
|
14970
|
-
return
|
|
15079
|
+
return _context3.stop();
|
|
14971
15080
|
}
|
|
14972
|
-
},
|
|
15081
|
+
}, _callee3, null, [[7, 14]]);
|
|
14973
15082
|
}))();
|
|
14974
15083
|
}
|
|
14975
15084
|
};
|