@@ -23,28 +23,28 @@ import { Hub } from "@sentry/node";
2323const RELEASE_INJECTOR_ID = "\0sentry-release-injector" ;
2424
2525/**
26- * The sentry-unplugin concerns itself with two things:
26+ * The sentry bundler plugin concerns itself with two things:
2727 * - Release injection
2828 * - Sourcemaps upload
2929 *
3030 * Release injection:
3131 *
32- * Per default the sentry-unpugin will inject a global `SENTRY_RELEASE` variable into the entrypoint of all bundles. On
33- * a technical level this is done by appending an import (`import "sentry-release-injector;"`) to all entrypoint files
34- * of the user code (see `transformInclude` and `transform` hooks). This import is then resolved by the sentry-unplugin
32+ * Per default the sentry bundler plugin will inject a global `SENTRY_RELEASE` variable into the entrypoint of all bundles.
33+ * On a technical level this is done by appending an import (`import "sentry-release-injector;"`) to all entrypoint files
34+ * of the user code (see `transformInclude` and `transform` hooks). This import is then resolved by the sentry plugin
3535 * to a virtual module that sets the global variable (see `resolveId` and `load` hooks).
3636 *
3737 * The resulting output approximately looks like this:
3838 *
3939 * ```text
4040 * entrypoint1.js (user file)
41- * ┌───────────────────┐ ┌─────────────────────────────────────────────────┐
42- * │ │ │ import { myFunction } from "./my-library.js"; │
43- * │ sentry-unplugin │ │ │
44- * │ │ │ const myResult = myFunction(); │
45- * └---------│---------┘ │ export { myResult }; │
41+ * ┌─────────────────────────┐ ┌─────────────────────────────────────────────────┐
42+ * │ │ │ import { myFunction } from "./my-library.js"; │
43+ * │ sentry-bundler-plugin │ │ │
44+ * │ │ │ const myResult = myFunction(); │
45+ * └---------│--------------- │ export { myResult }; │
4646 * │ │ │
47- * │ injects │ // injected by sentry-unplugin │
47+ * │ injects │ // injected by sentry plugin │
4848 * ├───────────────────► import "sentry-release-injector"; ─────────────────────┐
4949 * │ └─────────────────────────────────────────────────┘ │
5050 * │ │
@@ -55,24 +55,33 @@ const RELEASE_INJECTOR_ID = "\0sentry-release-injector";
5555 * │ │ return "Hello world!"; │ │
5656 * │ │ } │ │
5757 * │ │ │ │
58- * │ injects │ // injected by sentry-unplugin │ │
58+ * │ injects │ // injected by sentry plugin │ │
5959 * └───────────────────► import "sentry-release-injector"; ─────────────────────┤
6060 * └─────────────────────────────────────────────────┘ │
6161 * │
6262 * │
6363 * sentry-release-injector │
6464 * ┌──────────────────────────────────┐ │
6565 * │ │ is resolved │
66- * │ global.SENTRY_RELEASE = { ... } │ by unplugin │
66+ * │ global.SENTRY_RELEASE = { ... } │ by plugin │
6767 * │ // + a little more logic │<─────────────────────┘
6868 * │ │ (only once)
6969 * └──────────────────────────────────┘
7070 * ```
7171 *
7272 * Source maps upload:
7373 *
74- * The sentry-unplugin will also take care of uploading source maps to Sentry. This is all done in the `writeBundle` hook.
75- * TODO: elaborate a bit on how sourcemaps upload works
74+ * The sentry bundler plugin will also take care of uploading source maps to Sentry. This is all done in the
75+ * `writeBundle` hook. In this hook the sentry plugin will execute the release creation pipeline:
76+ *
77+ * 1. Create a new release
78+ * 2. Delete already uploaded artifacts for this release (if `cleanArtifacts` is enabled)
79+ * 3. Upload sourcemaps based on `include` and source-map-specific options
80+ * 4. Associate a range of commits with the release (if `setCommits` is specified)
81+ * 5. Finalize the release (unless `finalize` is disabled)
82+ * 6. Add deploy information to the release (if `deploy` is specified)
83+ *
84+ * This release creation pipeline relies on Sentry CLI to execute the different steps.
7685 */
7786const unplugin = createUnplugin < Options > ( ( options , unpluginMetaContext ) => {
7887 const internalOptions = normalizeUserOptions ( options ) ;
@@ -188,7 +197,6 @@ const unplugin = createUnplugin<Options>((options, unpluginMetaContext) => {
188197
189198 loadInclude ( id ) {
190199 logger . info ( `Called "loadInclude": ${ JSON . stringify ( { id } ) } ` ) ;
191-
192200 return id === RELEASE_INJECTOR_ID ;
193201 } ,
194202
@@ -218,11 +226,11 @@ const unplugin = createUnplugin<Options>((options, unpluginMetaContext) => {
218226 } ,
219227
220228 /**
221- * This hook determines whether we want to transform a module. In the unplugin we want to transform every entrypoint
229+ * This hook determines whether we want to transform a module. In the sentry bundler plugin we want to transform every entrypoint
222230 * unless configured otherwise with the `entries` option.
223231 *
224232 * @param id Always the absolute (fully resolved) path to the module.
225- * @returns `true` or `false` depending on whether we want to transform the module. For the sentry-unplugin we only
233+ * @returns `true` or `false` depending on whether we want to transform the module. For the sentry bundler plugin we only
226234 * want to transform the release injector file.
227235 */
228236 transformInclude ( id ) {
0 commit comments