@sentry/bundler-plugin-core 2.0.0-alpha.0 → 2.0.0-alpha.2
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 +1085 -1361
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +1067 -1368
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +65 -5
- package/dist/types/options-mapping.d.ts +55 -16
- package/dist/types/plugins/debug-id-upload.d.ts +25 -0
- package/dist/types/plugins/release-management.d.ts +30 -0
- package/dist/types/plugins/telemetry.d.ts +11 -0
- package/dist/types/sentry/telemetry.d.ts +5 -10
- package/dist/types/types.d.ts +137 -108
- package/dist/types/utils.d.ts +33 -0
- package/package.json +25 -10
- package/sentry-esbuild-debugid-injection-file.js +18 -0
- package/sentry-release-injection-file.js +4 -0
- package/dist/types/sentry/cli.d.ts +0 -16
- package/dist/types/sentry/releasePipeline.d.ts +0 -8
|
@@ -1,19 +1,59 @@
|
|
|
1
1
|
import { Logger } from "./sentry/logger";
|
|
2
|
-
import {
|
|
3
|
-
declare type
|
|
4
|
-
declare type OptionalInternalOptions = Partial<Pick<UserOptions, "org" | "project" | "authToken" | "url" | "vcsRemote" | "dist" | "errorHandler" | "setCommits" | "deploy" | "configFile" | "headers">>;
|
|
5
|
-
declare type NormalizedInternalOptions = {
|
|
6
|
-
releaseInjectionTargets: (string | RegExp)[] | ((filePath: string) => boolean) | undefined;
|
|
7
|
-
include: InternalIncludeEntry[];
|
|
8
|
-
};
|
|
9
|
-
export declare type InternalOptions = RequiredInternalOptions & OptionalInternalOptions & NormalizedInternalOptions;
|
|
10
|
-
declare type RequiredInternalIncludeEntry = Required<Pick<UserIncludeEntry, "paths" | "ext" | "stripCommonPrefix" | "sourceMapReference" | "rewrite" | "validate">>;
|
|
11
|
-
declare type OptionalInternalIncludeEntry = Partial<Pick<UserIncludeEntry, "ignoreFile" | "urlPrefix" | "urlSuffix" | "stripPrefix">>;
|
|
12
|
-
export declare type InternalIncludeEntry = RequiredInternalIncludeEntry & OptionalInternalIncludeEntry & {
|
|
13
|
-
ignore: string[];
|
|
14
|
-
};
|
|
2
|
+
import { Options as UserOptions } from "./types";
|
|
3
|
+
export declare type NormalizedOptions = ReturnType<typeof normalizeUserOptions>;
|
|
15
4
|
export declare const SENTRY_SAAS_URL = "https://sentry.io";
|
|
16
|
-
export declare function normalizeUserOptions(userOptions: UserOptions):
|
|
5
|
+
export declare function normalizeUserOptions(userOptions: UserOptions): {
|
|
6
|
+
org: string | undefined;
|
|
7
|
+
project: string | undefined;
|
|
8
|
+
authToken: string | undefined;
|
|
9
|
+
url: string;
|
|
10
|
+
headers: Record<string, string> | undefined;
|
|
11
|
+
debug: boolean;
|
|
12
|
+
silent: boolean;
|
|
13
|
+
errorHandler: ((err: Error) => void) | undefined;
|
|
14
|
+
telemetry: boolean;
|
|
15
|
+
disable: boolean;
|
|
16
|
+
sourcemaps: {
|
|
17
|
+
assets: string | string[];
|
|
18
|
+
ignore?: string | string[] | undefined;
|
|
19
|
+
rewriteSources?: ((source: string, map: any) => string) | undefined;
|
|
20
|
+
deleteAfterUpload?: string | string[] | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
release: {
|
|
23
|
+
name: string | undefined;
|
|
24
|
+
inject: boolean;
|
|
25
|
+
create: boolean;
|
|
26
|
+
finalize: boolean;
|
|
27
|
+
dist?: string | undefined;
|
|
28
|
+
vcsRemote: string;
|
|
29
|
+
setCommits?: (({
|
|
30
|
+
auto: true;
|
|
31
|
+
repo?: undefined;
|
|
32
|
+
commit?: undefined;
|
|
33
|
+
} | {
|
|
34
|
+
auto?: false | undefined;
|
|
35
|
+
repo: string;
|
|
36
|
+
commit: string;
|
|
37
|
+
}) & {
|
|
38
|
+
previousCommit?: string | undefined;
|
|
39
|
+
ignoreMissing?: boolean | undefined;
|
|
40
|
+
ignoreEmpty?: boolean | undefined;
|
|
41
|
+
}) | undefined;
|
|
42
|
+
deploy?: {
|
|
43
|
+
env: string;
|
|
44
|
+
started?: string | number | undefined;
|
|
45
|
+
finished?: string | number | undefined;
|
|
46
|
+
time?: number | undefined;
|
|
47
|
+
name?: string | undefined;
|
|
48
|
+
url?: string | undefined;
|
|
49
|
+
} | undefined;
|
|
50
|
+
cleanArtifacts: boolean;
|
|
51
|
+
uploadLegacySourcemaps?: string | import("./types").IncludeEntry | (string | import("./types").IncludeEntry)[] | undefined;
|
|
52
|
+
};
|
|
53
|
+
_experiments: {
|
|
54
|
+
injectBuildInformation?: boolean | undefined;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
17
57
|
/**
|
|
18
58
|
* Validates a few combinations of options that are not checked by Sentry CLI.
|
|
19
59
|
*
|
|
@@ -26,5 +66,4 @@ export declare function normalizeUserOptions(userOptions: UserOptions): Internal
|
|
|
26
66
|
*
|
|
27
67
|
* @returns `true` if the options are valid, `false` otherwise
|
|
28
68
|
*/
|
|
29
|
-
export declare function validateOptions(options:
|
|
30
|
-
export {};
|
|
69
|
+
export declare function validateOptions(options: NormalizedOptions, logger: Logger): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { UnpluginOptions } from "unplugin";
|
|
2
|
+
import { Logger } from "../sentry/logger";
|
|
3
|
+
import { Hub, NodeClient } from "@sentry/node";
|
|
4
|
+
interface DebugIdUploadPluginOptions {
|
|
5
|
+
logger: Logger;
|
|
6
|
+
assets: string | string[];
|
|
7
|
+
ignore?: string | string[];
|
|
8
|
+
releaseName?: string;
|
|
9
|
+
dist?: string;
|
|
10
|
+
handleRecoverableError: (error: unknown) => void;
|
|
11
|
+
sentryHub: Hub;
|
|
12
|
+
sentryClient: NodeClient;
|
|
13
|
+
sentryCliOptions: {
|
|
14
|
+
url: string;
|
|
15
|
+
authToken: string;
|
|
16
|
+
org: string;
|
|
17
|
+
project: string;
|
|
18
|
+
vcsRemote: string;
|
|
19
|
+
silent: boolean;
|
|
20
|
+
headers?: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
export declare function debugIdUploadPlugin({ assets, ignore, logger, releaseName, dist, handleRecoverableError, sentryHub, sentryClient, sentryCliOptions, }: DebugIdUploadPluginOptions): UnpluginOptions;
|
|
24
|
+
export declare function prepareBundleForDebugIdUpload(bundleFilePath: string, uploadFolder: string, uniqueUploadName: string, logger: Logger): Promise<[void, void] | undefined>;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SentryCliCommitsOptions, SentryCliNewDeployOptions } from "@sentry/cli";
|
|
2
|
+
import { Hub, NodeClient } from "@sentry/node";
|
|
3
|
+
import { UnpluginOptions } from "unplugin";
|
|
4
|
+
import { Logger } from "../sentry/logger";
|
|
5
|
+
import { IncludeEntry } from "../types";
|
|
6
|
+
interface ReleaseManagementPluginOptions {
|
|
7
|
+
logger: Logger;
|
|
8
|
+
releaseName: string;
|
|
9
|
+
shouldCreateRelease: boolean;
|
|
10
|
+
shouldCleanArtifacts: boolean;
|
|
11
|
+
shouldFinalizeRelease: boolean;
|
|
12
|
+
include?: string | IncludeEntry | Array<string | IncludeEntry>;
|
|
13
|
+
setCommitsOption?: SentryCliCommitsOptions;
|
|
14
|
+
deployOptions?: SentryCliNewDeployOptions;
|
|
15
|
+
dist?: string;
|
|
16
|
+
handleRecoverableError: (error: unknown) => void;
|
|
17
|
+
sentryHub: Hub;
|
|
18
|
+
sentryClient: NodeClient;
|
|
19
|
+
sentryCliOptions: {
|
|
20
|
+
url: string;
|
|
21
|
+
authToken: string;
|
|
22
|
+
org: string;
|
|
23
|
+
project: string;
|
|
24
|
+
vcsRemote: string;
|
|
25
|
+
silent: boolean;
|
|
26
|
+
headers?: Record<string, string>;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export declare function releaseManagementPlugin({ releaseName, include, dist, setCommitsOption, shouldCreateRelease, shouldCleanArtifacts, shouldFinalizeRelease, deployOptions, handleRecoverableError, sentryHub, sentryClient, sentryCliOptions, }: ReleaseManagementPluginOptions): UnpluginOptions;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { NodeClient, Transaction } from "@sentry/node";
|
|
2
|
+
import { UnpluginOptions } from "unplugin";
|
|
3
|
+
import { Logger } from "../sentry/logger";
|
|
4
|
+
interface TelemetryPluginOptions {
|
|
5
|
+
sentryClient: NodeClient;
|
|
6
|
+
pluginExecutionTransaction: Transaction;
|
|
7
|
+
shouldSendTelemetry: Promise<boolean>;
|
|
8
|
+
logger: Logger;
|
|
9
|
+
}
|
|
10
|
+
export declare function telemetryPlugin({ sentryClient, pluginExecutionTransaction, shouldSendTelemetry, logger, }: TelemetryPluginOptions): UnpluginOptions;
|
|
11
|
+
export {};
|
|
@@ -1,13 +1,8 @@
|
|
|
1
|
-
import { Hub, NodeClient
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
export declare function makeSentryClient(dsn: string, allowedToSendTelemetryPromise: Promise<boolean>, userProject: string | undefined): {
|
|
1
|
+
import { Hub, NodeClient } from "@sentry/node";
|
|
2
|
+
import { NormalizedOptions } from "../options-mapping";
|
|
3
|
+
export declare function createSentryInstance(options: NormalizedOptions, shouldSendTelemetry: Promise<boolean>, bundler: string): {
|
|
5
4
|
sentryHub: Hub;
|
|
6
5
|
sentryClient: NodeClient;
|
|
7
6
|
};
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
*/
|
|
11
|
-
export declare function addSpanToTransaction(ctx: BuildContext, op?: string, description?: string): Span | undefined;
|
|
12
|
-
export declare function addPluginOptionInformationToHub(options: InternalOptions, hub: Hub, bundler: "rollup" | "webpack" | "vite" | "esbuild"): void;
|
|
13
|
-
export declare function shouldSendTelemetry(options: InternalOptions): Promise<boolean>;
|
|
7
|
+
export declare function setTelemetryDataOnHub(options: NormalizedOptions, hub: Hub, bundler: string): void;
|
|
8
|
+
export declare function allowedToSendTelemetry(options: NormalizedOptions): Promise<boolean>;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { Span } from "@sentry/tracing";
|
|
3
|
-
import { SentryCLILike } from "./sentry/cli";
|
|
4
|
-
import { createLogger } from "./sentry/logger";
|
|
5
|
-
/**
|
|
6
|
-
* The main options object holding all plugin options available to users
|
|
7
|
-
*/
|
|
8
|
-
export declare type Options = Omit<IncludeEntry, "paths"> & {
|
|
1
|
+
export interface Options {
|
|
9
2
|
/**
|
|
10
3
|
* The slug of the Sentry organization associated with the app.
|
|
11
|
-
*
|
|
12
|
-
* This value can also be specified via the `SENTRY_ORG` environment variable.
|
|
13
4
|
*/
|
|
14
5
|
org?: string;
|
|
15
6
|
/**
|
|
@@ -35,71 +26,10 @@ export declare type Options = Omit<IncludeEntry, "paths"> & {
|
|
|
35
26
|
* Defaults to https://sentry.io/, which is the correct value for SaaS customers.
|
|
36
27
|
*/
|
|
37
28
|
url?: string;
|
|
38
|
-
/**
|
|
39
|
-
* Unique identifier for the release.
|
|
40
|
-
*
|
|
41
|
-
* This value can also be specified via the `SENTRY_RELEASE` environment variable.
|
|
42
|
-
*
|
|
43
|
-
* Defaults to the output of the sentry-cli releases propose-version command,
|
|
44
|
-
* which automatically detects values for Cordova, Heroku, AWS CodeBuild, CircleCI,
|
|
45
|
-
* Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA. (the latter
|
|
46
|
-
* requires access to git CLI and for the root directory to be a valid repository).
|
|
47
|
-
*/
|
|
48
|
-
release?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Unique identifier for the distribution, used to further segment your release.
|
|
51
|
-
* Usually your build number.
|
|
52
|
-
*/
|
|
53
|
-
dist?: string;
|
|
54
|
-
/**
|
|
55
|
-
* Filter for modules that the release should be injected in.
|
|
56
|
-
*
|
|
57
|
-
* This option takes a string, a regular expression, or an array containing strings,
|
|
58
|
-
* regular expressions, or both. It's also possible to provide a filter function
|
|
59
|
-
* that takes the absolute path of a processed module. It should return `true`
|
|
60
|
-
* if the release should be injected into the module and `false` otherwise. String
|
|
61
|
-
* values of this option require a full match with the absolute path of the module.
|
|
62
|
-
*
|
|
63
|
-
* By default, the release will be injected into all entrypoints. If release
|
|
64
|
-
* injection should be disabled, provide an empty array here.
|
|
65
|
-
*/
|
|
66
|
-
releaseInjectionTargets?: (string | RegExp)[] | RegExp | string | ((filePath: string) => boolean);
|
|
67
|
-
/**
|
|
68
|
-
* Determines if the Sentry release record should be automatically finalized
|
|
69
|
-
* (meaning a date_released timestamp is added) after artifact upload.
|
|
70
|
-
*
|
|
71
|
-
* Defaults to `true`.
|
|
72
|
-
*/
|
|
73
|
-
finalize?: boolean;
|
|
74
|
-
/**
|
|
75
|
-
* One or more paths that Sentry CLI should scan recursively for sources.
|
|
76
|
-
* It will upload all .map files and match associated .js files. Other file
|
|
77
|
-
* types can be uploaded by using the `ext` option.
|
|
78
|
-
* Each path can be given as a string or an object with path-specific options
|
|
79
|
-
*
|
|
80
|
-
* This is a required field.
|
|
81
|
-
*/
|
|
82
|
-
include: string | IncludeEntry | Array<string | IncludeEntry>;
|
|
83
|
-
/**
|
|
84
|
-
* Version control system remote name.
|
|
85
|
-
*
|
|
86
|
-
* This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable.
|
|
87
|
-
*
|
|
88
|
-
* Defaults to 'origin'.
|
|
89
|
-
*/
|
|
90
|
-
vcsRemote?: string;
|
|
91
29
|
/**
|
|
92
30
|
* Headers added to every outgoing network request.
|
|
93
31
|
*/
|
|
94
32
|
headers?: Record<string, string>;
|
|
95
|
-
/**
|
|
96
|
-
* Attempts a dry run (useful for dev environments), making release creation
|
|
97
|
-
* a no-op.
|
|
98
|
-
*
|
|
99
|
-
* Defaults to `false`, but may be automatically set to `true` in development environments
|
|
100
|
-
* by some framework integrations (Next.JS, possibly others).
|
|
101
|
-
*/
|
|
102
|
-
dryRun?: boolean;
|
|
103
33
|
/**
|
|
104
34
|
* Print useful debug information.
|
|
105
35
|
*
|
|
@@ -112,12 +42,6 @@ export declare type Options = Omit<IncludeEntry, "paths"> & {
|
|
|
112
42
|
* Defaults to `false`.
|
|
113
43
|
*/
|
|
114
44
|
silent?: boolean;
|
|
115
|
-
/**
|
|
116
|
-
* Remove all the artifacts in the release before the upload.
|
|
117
|
-
*
|
|
118
|
-
* Defaults to `false`.
|
|
119
|
-
*/
|
|
120
|
-
cleanArtifacts?: boolean;
|
|
121
45
|
/**
|
|
122
46
|
* When an error occurs during rlease creation or sourcemaps upload, the plugin will call this function.
|
|
123
47
|
*
|
|
@@ -134,14 +58,6 @@ export declare type Options = Omit<IncludeEntry, "paths"> & {
|
|
|
134
58
|
* ```
|
|
135
59
|
*/
|
|
136
60
|
errorHandler?: (err: Error) => void;
|
|
137
|
-
/**
|
|
138
|
-
* Associates the release with its commits in Sentry.
|
|
139
|
-
*/
|
|
140
|
-
setCommits?: SetCommitsOptions;
|
|
141
|
-
/**
|
|
142
|
-
* Adds deployment information to the release in Sentry.
|
|
143
|
-
*/
|
|
144
|
-
deploy?: DeployOptions;
|
|
145
61
|
/**
|
|
146
62
|
* If set to true, internal plugin errors and performance data will be sent to Sentry.
|
|
147
63
|
*
|
|
@@ -154,22 +70,145 @@ export declare type Options = Omit<IncludeEntry, "paths"> & {
|
|
|
154
70
|
*/
|
|
155
71
|
telemetry?: boolean;
|
|
156
72
|
/**
|
|
157
|
-
*
|
|
158
|
-
* https://docs.sentry.io/product/cli/configuration/#configuration-file.
|
|
159
|
-
*
|
|
160
|
-
* By default, the config file is looked for upwards from the current path, and
|
|
161
|
-
* defaults from ~/.sentryclirc are always loaded
|
|
162
|
-
*/
|
|
163
|
-
configFile?: string;
|
|
164
|
-
/**
|
|
165
|
-
* If set to true, the plugin will inject an additional `SENTRY_RELEASES` variable that
|
|
166
|
-
* maps from `{org}@{project}` to the `release` value. This might be helpful for webpack
|
|
167
|
-
* module federation or micro frontend setups.
|
|
73
|
+
* Completely disables all functionality of the plugin.
|
|
168
74
|
*
|
|
169
75
|
* Defaults to `false`.
|
|
170
76
|
*/
|
|
171
|
-
|
|
172
|
-
|
|
77
|
+
disable?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* Options for source maps uploading.
|
|
80
|
+
* Leave this option undefined if you do not want to upload source maps to Sentry.
|
|
81
|
+
*/
|
|
82
|
+
sourcemaps?: {
|
|
83
|
+
/**
|
|
84
|
+
* A glob or an array of globs that specifies the build artifacts that should be uploaded to Sentry.
|
|
85
|
+
*
|
|
86
|
+
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
|
|
87
|
+
*
|
|
88
|
+
* Use the `debug` option to print information about which files end up being uploaded.
|
|
89
|
+
*/
|
|
90
|
+
assets: string | string[];
|
|
91
|
+
/**
|
|
92
|
+
* A glob or an array of globs that specifies which build artifacts should not be uploaded to Sentry.
|
|
93
|
+
*
|
|
94
|
+
* Default: `[]`
|
|
95
|
+
*
|
|
96
|
+
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
|
|
97
|
+
*
|
|
98
|
+
* Use the `debug` option to print information about which files end up being uploaded.
|
|
99
|
+
*/
|
|
100
|
+
ignore?: string | string[];
|
|
101
|
+
/**
|
|
102
|
+
* Hook to rewrite the `sources` field inside the source map before being uploaded to Sentry. Does not modify the actual source map.
|
|
103
|
+
*
|
|
104
|
+
* Defaults to making all sources relative to `process.cwd()` while building.
|
|
105
|
+
*
|
|
106
|
+
* @hidden Not yet implemented.
|
|
107
|
+
*/
|
|
108
|
+
rewriteSources?: (source: string, map: any) => string;
|
|
109
|
+
/**
|
|
110
|
+
* A glob or an array of globs that specifies the build artifacts that should be deleted after the artifact upload to Sentry has been completed.
|
|
111
|
+
*
|
|
112
|
+
* The globbing patterns follow the implementation of the `glob` package. (https://www.npmjs.com/package/glob)
|
|
113
|
+
*
|
|
114
|
+
* Use the `debug` option to print information about which files end up being deleted.
|
|
115
|
+
*
|
|
116
|
+
* @hidden Not yet implemented.
|
|
117
|
+
*/
|
|
118
|
+
deleteAfterUpload?: string | string[];
|
|
119
|
+
};
|
|
120
|
+
/**
|
|
121
|
+
* Options related to managing the Sentry releases for a build.
|
|
122
|
+
*
|
|
123
|
+
* More info: https://docs.sentry.io/product/releases/
|
|
124
|
+
*/
|
|
125
|
+
release?: {
|
|
126
|
+
/**
|
|
127
|
+
* Unique identifier for the release you want to create.
|
|
128
|
+
*
|
|
129
|
+
* This value can also be specified via the `SENTRY_RELEASE` environment variable.
|
|
130
|
+
*
|
|
131
|
+
* Defaults to automatically detecting a value for your environment.
|
|
132
|
+
* This includes values for Cordova, Heroku, AWS CodeBuild, CircleCI, Xcode, and Gradle, and otherwise uses the git `HEAD`'s commit SHA.
|
|
133
|
+
* (the latterrequires access to git CLI and for the root directory to be a valid repository)
|
|
134
|
+
*
|
|
135
|
+
* If you didn't provide a value and the plugin can't automatically detect one, no release will be created.
|
|
136
|
+
*/
|
|
137
|
+
name?: string;
|
|
138
|
+
/**
|
|
139
|
+
* Whether the plugin should inject release information into the build for the SDK to pick it up when sending events. (recommended)
|
|
140
|
+
*
|
|
141
|
+
* Defaults to `true`.
|
|
142
|
+
*/
|
|
143
|
+
inject?: boolean;
|
|
144
|
+
/**
|
|
145
|
+
* Whether the plugin should create a release on Sentry during the build.
|
|
146
|
+
* Note that a release may still appear in Sentry even if this is value is `false` because any Sentry event that has a release value attached will automatically create a release.
|
|
147
|
+
* (for example via the `inject` option)
|
|
148
|
+
*
|
|
149
|
+
* Defaults to `true`.
|
|
150
|
+
*/
|
|
151
|
+
create?: boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Whether the Sentry release should be automatically finalized (meaning an end timestamp is added) after the build ends.
|
|
154
|
+
*
|
|
155
|
+
* Defaults to `true`.
|
|
156
|
+
*/
|
|
157
|
+
finalize?: boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Unique identifier for the distribution, used to further segment your release.
|
|
160
|
+
* Usually your build number.
|
|
161
|
+
*/
|
|
162
|
+
dist?: string;
|
|
163
|
+
/**
|
|
164
|
+
* Version control system remote name.
|
|
165
|
+
*
|
|
166
|
+
* This value can also be specified via the `SENTRY_VSC_REMOTE` environment variable.
|
|
167
|
+
*
|
|
168
|
+
* Defaults to 'origin'.
|
|
169
|
+
*/
|
|
170
|
+
vcsRemote?: string;
|
|
171
|
+
/**
|
|
172
|
+
* Associates the release with its commits in Sentry.
|
|
173
|
+
*/
|
|
174
|
+
setCommits?: SetCommitsOptions;
|
|
175
|
+
/**
|
|
176
|
+
* Adds deployment information to the release in Sentry.
|
|
177
|
+
*/
|
|
178
|
+
deploy?: DeployOptions;
|
|
179
|
+
/**
|
|
180
|
+
* Remove all previously uploaded artifacts for this release on Sentry before the upload.
|
|
181
|
+
*
|
|
182
|
+
* Defaults to `false`.
|
|
183
|
+
*/
|
|
184
|
+
cleanArtifacts?: boolean;
|
|
185
|
+
/**
|
|
186
|
+
* Legacy method of uploading source maps. (not recommended unless necessary)
|
|
187
|
+
*
|
|
188
|
+
* One or more paths that should be scanned recursively for sources.
|
|
189
|
+
*
|
|
190
|
+
* Each path can be given as a string or an object with more specific options.
|
|
191
|
+
*
|
|
192
|
+
* The modern version of doing source maps upload is more robust and way easier to get working but has to inject a very small snippet of JavaScript into your output bundles.
|
|
193
|
+
* In situations where this leads to problems (e.g subresource integrity) you can use this option as a fallback.
|
|
194
|
+
*/
|
|
195
|
+
uploadLegacySourcemaps?: string | IncludeEntry | Array<string | IncludeEntry>;
|
|
196
|
+
};
|
|
197
|
+
/**
|
|
198
|
+
* Options that are considered experimental and subject to change.
|
|
199
|
+
*
|
|
200
|
+
* @experimental API that does not follow semantic versioning and may change in any release
|
|
201
|
+
*/
|
|
202
|
+
_experiments?: {
|
|
203
|
+
/**
|
|
204
|
+
* If set to true, the plugin will inject an additional `SENTRY_BUILD_INFO` variable.
|
|
205
|
+
* This contains information about the build, e.g. dependencies, node version and other useful data.
|
|
206
|
+
*
|
|
207
|
+
* Defaults to `false`.
|
|
208
|
+
*/
|
|
209
|
+
injectBuildInformation?: boolean;
|
|
210
|
+
};
|
|
211
|
+
}
|
|
173
212
|
export declare type IncludeEntry = {
|
|
174
213
|
/**
|
|
175
214
|
* One or more paths to scan for files to upload.
|
|
@@ -322,14 +361,4 @@ declare type DeployOptions = {
|
|
|
322
361
|
*/
|
|
323
362
|
url?: string;
|
|
324
363
|
};
|
|
325
|
-
/**
|
|
326
|
-
* Holds data for internal purposes
|
|
327
|
-
* (e.g. telemetry and logging)
|
|
328
|
-
*/
|
|
329
|
-
export declare type BuildContext = {
|
|
330
|
-
hub: Hub;
|
|
331
|
-
parentSpan?: Span;
|
|
332
|
-
logger: ReturnType<typeof createLogger>;
|
|
333
|
-
cli: SentryCLILike;
|
|
334
|
-
};
|
|
335
364
|
export {};
|
package/dist/types/utils.d.ts
CHANGED
|
@@ -5,3 +5,36 @@
|
|
|
5
5
|
* @returns The input, if already an array, or an array with the input as the only element, if not
|
|
6
6
|
*/
|
|
7
7
|
export declare function arrayify<T = unknown>(maybeArray: T | T[]): T[];
|
|
8
|
+
declare type PackageJson = Record<string, unknown>;
|
|
9
|
+
/**
|
|
10
|
+
* Get the closes package.json from a given starting point upwards.
|
|
11
|
+
* This handles a few edge cases:
|
|
12
|
+
* * Check if a given file package.json appears to be an actual NPM package.json file
|
|
13
|
+
* * Stop at the home dir, to avoid looking too deeply
|
|
14
|
+
*/
|
|
15
|
+
export declare function getPackageJson({ cwd, stopAt }?: {
|
|
16
|
+
cwd?: string;
|
|
17
|
+
stopAt?: string;
|
|
18
|
+
}): PackageJson | undefined;
|
|
19
|
+
export declare function parseMajorVersion(version: string): number | undefined;
|
|
20
|
+
export declare function getDependencies(packageJson: PackageJson): {
|
|
21
|
+
deps: string[];
|
|
22
|
+
depsVersions: Record<string, number>;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Deterministically hashes a string and turns the hash into a uuid.
|
|
26
|
+
*/
|
|
27
|
+
export declare function stringToUUID(str: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Tries to guess a release name based on environmental data.
|
|
30
|
+
*/
|
|
31
|
+
export declare function determineReleaseName(): string | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Generates code for the global injector which is responsible for setting the global
|
|
34
|
+
* `SENTRY_RELEASE` & `SENTRY_BUILD_INFO` variables.
|
|
35
|
+
*/
|
|
36
|
+
export declare function generateGlobalInjectorCode({ release, injectBuildInformation, }: {
|
|
37
|
+
release: string;
|
|
38
|
+
injectBuildInformation: boolean;
|
|
39
|
+
}): string;
|
|
40
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/bundler-plugin-core",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.2",
|
|
4
4
|
"description": "Sentry Bundler Plugin Core",
|
|
5
5
|
"repository": "git://github.com/getsentry/sentry-javascript-bundler-plugins.git",
|
|
6
6
|
"homepage": "https://github.com/getsentry/sentry-javascript-bundler-plugins/tree/main/packages/bundler-plugin-core",
|
|
@@ -10,12 +10,23 @@
|
|
|
10
10
|
"access": "public"
|
|
11
11
|
},
|
|
12
12
|
"files": [
|
|
13
|
-
"dist"
|
|
13
|
+
"dist",
|
|
14
|
+
"sentry-release-injection-file.js",
|
|
15
|
+
"sentry-esbuild-debugid-injection-file.js"
|
|
14
16
|
],
|
|
15
17
|
"exports": {
|
|
16
18
|
".": {
|
|
17
19
|
"import": "./dist/esm/index.mjs",
|
|
18
|
-
"require": "./dist/cjs/index.js"
|
|
20
|
+
"require": "./dist/cjs/index.js",
|
|
21
|
+
"types": "./dist/types/index.d.ts"
|
|
22
|
+
},
|
|
23
|
+
"./sentry-release-injection-file": {
|
|
24
|
+
"import": "./sentry-release-injection-file.js",
|
|
25
|
+
"require": "./sentry-release-injection-file.js"
|
|
26
|
+
},
|
|
27
|
+
"./sentry-esbuild-debugid-injection-file": {
|
|
28
|
+
"import": "./sentry-esbuild-debugid-injection-file.js",
|
|
29
|
+
"require": "./sentry-esbuild-debugid-injection-file.js"
|
|
19
30
|
}
|
|
20
31
|
},
|
|
21
32
|
"main": "dist/cjs/index.js",
|
|
@@ -41,9 +52,10 @@
|
|
|
41
52
|
"fix": "eslint ./src ./test --format stylish --fix"
|
|
42
53
|
},
|
|
43
54
|
"dependencies": {
|
|
44
|
-
"@sentry/cli": "^2.
|
|
45
|
-
"@sentry/node": "
|
|
46
|
-
"
|
|
55
|
+
"@sentry/cli": "^2.17.0",
|
|
56
|
+
"@sentry/node": "7.50.0",
|
|
57
|
+
"find-up": "5.0.0",
|
|
58
|
+
"glob": "9.3.2",
|
|
47
59
|
"magic-string": "0.27.0",
|
|
48
60
|
"unplugin": "1.0.1"
|
|
49
61
|
},
|
|
@@ -52,12 +64,11 @@
|
|
|
52
64
|
"@babel/preset-env": "7.18.2",
|
|
53
65
|
"@babel/preset-typescript": "7.17.12",
|
|
54
66
|
"@rollup/plugin-babel": "5.3.1",
|
|
55
|
-
"@rollup/plugin-commonjs": "22.0.1",
|
|
56
67
|
"@rollup/plugin-json": "4.1.0",
|
|
57
68
|
"@rollup/plugin-node-resolve": "13.3.0",
|
|
58
69
|
"@rollup/plugin-replace": "^4.0.0",
|
|
59
|
-
"@sentry-internal/eslint-config": "2.0.0-alpha.
|
|
60
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.0.0-alpha.
|
|
70
|
+
"@sentry-internal/eslint-config": "2.0.0-alpha.2",
|
|
71
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "2.0.0-alpha.2",
|
|
61
72
|
"@swc/core": "^1.2.205",
|
|
62
73
|
"@swc/jest": "^0.2.21",
|
|
63
74
|
"@types/jest": "^28.1.3",
|
|
@@ -73,5 +84,9 @@
|
|
|
73
84
|
},
|
|
74
85
|
"engines": {
|
|
75
86
|
"node": ">= 10"
|
|
76
|
-
}
|
|
87
|
+
},
|
|
88
|
+
"sideEffects": [
|
|
89
|
+
"./sentry-release-injection-file.js",
|
|
90
|
+
"./sentry-esbuild-debugid-injection-file.js"
|
|
91
|
+
]
|
|
77
92
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
try {
|
|
2
|
+
var globalObject =
|
|
3
|
+
"undefined" != typeof window
|
|
4
|
+
? window
|
|
5
|
+
: "undefined" != typeof global
|
|
6
|
+
? global
|
|
7
|
+
: "undefined" != typeof self
|
|
8
|
+
? self
|
|
9
|
+
: {};
|
|
10
|
+
|
|
11
|
+
var stack = new Error().stack;
|
|
12
|
+
|
|
13
|
+
if (stack) {
|
|
14
|
+
globalObject._sentryDebugIds = globalObject._sentryDebugIds || {};
|
|
15
|
+
globalObject._sentryDebugIds[stack] = "__SENTRY_DEBUG_ID__";
|
|
16
|
+
globalObject._sentryDebugIdIdentifier = "sentry-dbid-__SENTRY_DEBUG_ID__";
|
|
17
|
+
}
|
|
18
|
+
} catch (e) {}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import SentryCli, { SentryCliReleases } from "@sentry/cli";
|
|
2
|
-
import { InternalOptions } from "../options-mapping";
|
|
3
|
-
import { Logger } from "./logger";
|
|
4
|
-
declare type SentryDryRunCLI = {
|
|
5
|
-
releases: Omit<SentryCliReleases, "listDeploys">;
|
|
6
|
-
execute: (args: string[], live: boolean) => Promise<string>;
|
|
7
|
-
};
|
|
8
|
-
export declare type SentryCLILike = SentryCli | SentryDryRunCLI;
|
|
9
|
-
/**
|
|
10
|
-
* Creates a new Sentry CLI instance.
|
|
11
|
-
*
|
|
12
|
-
* In case, users selected the `dryRun` options, this returns a stub
|
|
13
|
-
* that makes no-ops out of most CLI operations
|
|
14
|
-
*/
|
|
15
|
-
export declare function getSentryCli(internalOptions: InternalOptions, logger: Logger): SentryCLILike;
|
|
16
|
-
export {};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { InternalOptions } from "../options-mapping";
|
|
2
|
-
import { BuildContext } from "../types";
|
|
3
|
-
export declare function createNewRelease(options: InternalOptions, ctx: BuildContext, releaseName: string): Promise<void>;
|
|
4
|
-
export declare function cleanArtifacts(options: InternalOptions, ctx: BuildContext, releaseName: string): Promise<void>;
|
|
5
|
-
export declare function uploadSourceMaps(options: InternalOptions, ctx: BuildContext, releaseName: string): Promise<void>;
|
|
6
|
-
export declare function setCommits(options: InternalOptions, ctx: BuildContext, releaseName: string): Promise<void>;
|
|
7
|
-
export declare function finalizeRelease(options: InternalOptions, ctx: BuildContext, releaseName: string): Promise<void>;
|
|
8
|
-
export declare function addDeploy(options: InternalOptions, ctx: BuildContext, releaseName: string): Promise<void>;
|