@sentry/rollup-plugin 4.9.1 → 5.0.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 +144 -50
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.mjs +112 -48
- package/dist/esm/index.mjs.map +1 -1
- package/dist/types/index.d.ts +51 -1
- package/package.json +8 -13
package/dist/cjs/index.js
CHANGED
|
@@ -1,61 +1,155 @@
|
|
|
1
|
-
'
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
14
|
+
__defProp(to, key, {
|
|
15
|
+
get: ((k) => from[k]).bind(null, key),
|
|
16
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
24
|
+
value: mod,
|
|
25
|
+
enumerable: true
|
|
26
|
+
}) : target, mod));
|
|
2
27
|
|
|
3
|
-
|
|
28
|
+
//#endregion
|
|
29
|
+
let _sentry_bundler_plugin_core = require("@sentry/bundler-plugin-core");
|
|
30
|
+
let magic_string = require("magic-string");
|
|
31
|
+
magic_string = __toESM(magic_string);
|
|
32
|
+
let node_path = require("node:path");
|
|
33
|
+
node_path = __toESM(node_path);
|
|
34
|
+
let node_module = require("node:module");
|
|
4
35
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
rollup: bundlerPluginCore.createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml)
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
function rollupInjectionPlugin(injectionCode, debugIds) {
|
|
15
|
-
return {
|
|
16
|
-
name: "sentry-rollup-injection-plugin",
|
|
17
|
-
rollup: bundlerPluginCore.createRollupInjectionHooks(injectionCode, debugIds)
|
|
18
|
-
};
|
|
36
|
+
//#region src/index.ts
|
|
37
|
+
function hasExistingDebugID(code) {
|
|
38
|
+
const chunkStartSnippet = code.slice(0, 6e3);
|
|
39
|
+
const chunkEndSnippet = code.slice(-500);
|
|
40
|
+
if (chunkStartSnippet.includes("_sentryDebugIdIdentifier") || chunkEndSnippet.includes("//# debugId=")) return true;
|
|
41
|
+
return false;
|
|
19
42
|
}
|
|
20
|
-
function
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
43
|
+
function getRollupMajorVersion() {
|
|
44
|
+
try {
|
|
45
|
+
return (0, node_module.createRequire)(require("url").pathToFileURL(__filename).href)("rollup").VERSION?.split(".")[0];
|
|
46
|
+
} catch (err) {}
|
|
25
47
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
48
|
+
/**
|
|
49
|
+
* @ignore - this is the internal plugin factory function only used for the Vite plugin!
|
|
50
|
+
*/
|
|
51
|
+
function _rollupPluginInternal(userOptions = {}, buildTool, buildToolMajorVersion) {
|
|
52
|
+
const sentryBuildPluginManager = (0, _sentry_bundler_plugin_core.createSentryBuildPluginManager)(userOptions, {
|
|
53
|
+
loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[sentry-${buildTool}-plugin]`,
|
|
54
|
+
buildTool,
|
|
55
|
+
buildToolMajorVersion: buildToolMajorVersion || getRollupMajorVersion()
|
|
56
|
+
});
|
|
57
|
+
const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
|
|
58
|
+
if (options.disable) return { name: "sentry-noop-plugin" };
|
|
59
|
+
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
60
|
+
const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
61
|
+
const upload = (0, _sentry_bundler_plugin_core.createDebugIdUploadFunction)({ sentryBuildPluginManager });
|
|
62
|
+
const sourcemapsEnabled = options.sourcemaps?.disable !== true;
|
|
63
|
+
const staticInjectionCode = new _sentry_bundler_plugin_core.CodeInjection();
|
|
64
|
+
if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
|
|
65
|
+
else if (!options.release.name) logger.debug("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
|
|
66
|
+
else staticInjectionCode.append((0, _sentry_bundler_plugin_core.generateReleaseInjectorCode)({
|
|
67
|
+
release: options.release.name,
|
|
68
|
+
injectBuildInformation: options._experiments.injectBuildInformation || false
|
|
69
|
+
}));
|
|
70
|
+
if (Object.keys(bundleMetadata).length > 0) staticInjectionCode.append((0, _sentry_bundler_plugin_core.generateModuleMetadataInjectorCode)(bundleMetadata));
|
|
71
|
+
const transformAnnotations = options.reactComponentAnnotation?.enabled ? (0, _sentry_bundler_plugin_core.createComponentNameAnnotateHooks)(options.reactComponentAnnotation?.ignoredComponents || [], !!options.reactComponentAnnotation?._experimentalInjectIntoHtml) : void 0;
|
|
72
|
+
const transformReplace = Object.keys(replacementValues).length > 0;
|
|
73
|
+
const shouldTransform = transformAnnotations || transformReplace;
|
|
74
|
+
function buildStart() {
|
|
75
|
+
sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
|
|
76
|
+
}
|
|
77
|
+
async function transform(code, id) {
|
|
78
|
+
if (transformAnnotations?.transform) {
|
|
79
|
+
const result = await transformAnnotations.transform(code, id);
|
|
80
|
+
if (result) return result;
|
|
81
|
+
}
|
|
82
|
+
if (transformReplace) return (0, _sentry_bundler_plugin_core.replaceBooleanFlagsInCode)(code, replacementValues);
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
function renderChunk(code, chunk, _, meta) {
|
|
86
|
+
if (!(0, _sentry_bundler_plugin_core.isJsFile)(chunk.fileName)) return null;
|
|
87
|
+
if ((0, _sentry_bundler_plugin_core.shouldSkipCodeInjection)(code, chunk.facadeModuleId)) return null;
|
|
88
|
+
const injectCode = staticInjectionCode.clone();
|
|
89
|
+
if (sourcemapsEnabled && !hasExistingDebugID(code)) {
|
|
90
|
+
const debugId = (0, _sentry_bundler_plugin_core.stringToUUID)(code);
|
|
91
|
+
injectCode.append((0, _sentry_bundler_plugin_core.getDebugIdSnippet)(debugId));
|
|
92
|
+
}
|
|
93
|
+
if (injectCode.isEmpty()) return null;
|
|
94
|
+
const ms = meta?.magicString || new magic_string.default(code, { filename: chunk.fileName });
|
|
95
|
+
const match = code.match(_sentry_bundler_plugin_core.COMMENT_USE_STRICT_REGEX)?.[0];
|
|
96
|
+
if (match) ms.appendLeft(match.length, injectCode.code());
|
|
97
|
+
else ms.prepend(injectCode.code());
|
|
98
|
+
if (ms?.constructor?.name === "BindingMagicString") return { code: ms };
|
|
99
|
+
return {
|
|
100
|
+
code: ms.toString(),
|
|
101
|
+
map: ms.generateMap({
|
|
102
|
+
file: chunk.fileName,
|
|
103
|
+
hires: "boundary"
|
|
104
|
+
})
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
async function writeBundle(outputOptions, bundle) {
|
|
108
|
+
try {
|
|
109
|
+
await sentryBuildPluginManager.createRelease();
|
|
110
|
+
if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") if (outputOptions.dir) {
|
|
111
|
+
const outputDir = outputOptions.dir;
|
|
112
|
+
await upload(await (0, _sentry_bundler_plugin_core.globFiles)([
|
|
113
|
+
"/**/*.js",
|
|
114
|
+
"/**/*.mjs",
|
|
115
|
+
"/**/*.cjs",
|
|
116
|
+
"/**/*.js.map",
|
|
117
|
+
"/**/*.mjs.map",
|
|
118
|
+
"/**/*.cjs.map"
|
|
119
|
+
].map((q) => `${q}?(\\?*)?(#*)`), { root: outputDir }));
|
|
120
|
+
} else if (outputOptions.file) await upload([outputOptions.file]);
|
|
121
|
+
else await upload(Object.keys(bundle).map((asset) => node_path.join(node_path.resolve(), asset)));
|
|
122
|
+
} finally {
|
|
123
|
+
freeGlobalDependencyOnBuildArtifacts();
|
|
124
|
+
await sentryBuildPluginManager.deleteArtifacts();
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const name = `sentry-${buildTool}-plugin`;
|
|
128
|
+
if (shouldTransform) return {
|
|
129
|
+
name,
|
|
130
|
+
buildStart,
|
|
131
|
+
transform,
|
|
132
|
+
renderChunk,
|
|
133
|
+
writeBundle
|
|
134
|
+
};
|
|
135
|
+
return {
|
|
136
|
+
name,
|
|
137
|
+
buildStart,
|
|
138
|
+
renderChunk,
|
|
139
|
+
writeBundle
|
|
140
|
+
};
|
|
31
141
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
var _rollup$VERSION;
|
|
35
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
36
|
-
// @ts-ignore - Rollup already transpiles this for us
|
|
37
|
-
var req = node_module.createRequire((typeof document === 'undefined' ? new (require('u' + 'rl').URL)('file:' + __filename).href : (document.currentScript && document.currentScript.src || new URL('index.js', document.baseURI).href)));
|
|
38
|
-
var rollup = req("rollup");
|
|
39
|
-
return (_rollup$VERSION = rollup.VERSION) === null || _rollup$VERSION === void 0 ? void 0 : _rollup$VERSION.split(".")[0];
|
|
40
|
-
} catch (err) {
|
|
41
|
-
// do nothing, we'll just not report a version
|
|
42
|
-
}
|
|
43
|
-
return undefined;
|
|
142
|
+
function sentryRollupPlugin(userOptions = {}) {
|
|
143
|
+
return [_rollupPluginInternal(userOptions, "rollup")];
|
|
44
144
|
}
|
|
45
|
-
var sentryUnplugin = bundlerPluginCore.sentryUnpluginFactory({
|
|
46
|
-
injectionPlugin: rollupInjectionPlugin,
|
|
47
|
-
componentNameAnnotatePlugin: rollupComponentNameAnnotatePlugin,
|
|
48
|
-
debugIdUploadPlugin: rollupDebugIdUploadPlugin,
|
|
49
|
-
bundleSizeOptimizationsPlugin: rollupBundleSizeOptimizationsPlugin,
|
|
50
|
-
getBundlerMajorVersion: getRollupMajorVersion
|
|
51
|
-
});
|
|
52
|
-
|
|
53
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
54
|
-
var sentryRollupPlugin = sentryUnplugin.rollup;
|
|
55
145
|
|
|
146
|
+
//#endregion
|
|
147
|
+
exports._rollupPluginInternal = _rollupPluginInternal;
|
|
56
148
|
Object.defineProperty(exports, 'sentryCliBinaryExists', {
|
|
57
149
|
enumerable: true,
|
|
58
|
-
get: function () {
|
|
150
|
+
get: function () {
|
|
151
|
+
return _sentry_bundler_plugin_core.sentryCliBinaryExists;
|
|
152
|
+
}
|
|
59
153
|
});
|
|
60
154
|
exports.sentryRollupPlugin = sentryRollupPlugin;
|
|
61
|
-
//# sourceMappingURL=index.js.map
|
|
155
|
+
//# sourceMappingURL=index.js.map
|
package/dist/cjs/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["import {\n CodeInjection,\n sentryUnpluginFactory,\n Options,\n createRollupInjectionHooks,\n createRollupDebugIdUploadHooks,\n SentrySDKBuildFlags,\n createRollupBundleSizeOptimizationHooks,\n createComponentNameAnnotateHooks,\n Logger,\n} from \"@sentry/bundler-plugin-core\";\nimport { createRequire } from \"node:module\";\nimport type { UnpluginOptions } from \"unplugin\";\n\nfunction rollupComponentNameAnnotatePlugin(\n ignoredComponents: string[],\n injectIntoHtml: boolean\n): UnpluginOptions {\n return {\n name: \"sentry-rollup-component-name-annotate-plugin\",\n rollup: createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml),\n };\n}\n\nfunction rollupInjectionPlugin(injectionCode: CodeInjection, debugIds: boolean): UnpluginOptions {\n return {\n name: \"sentry-rollup-injection-plugin\",\n rollup: createRollupInjectionHooks(injectionCode, debugIds),\n };\n}\n\nfunction rollupDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n createDependencyOnBuildArtifacts: () => () => void\n): UnpluginOptions {\n return {\n name: \"sentry-rollup-debug-id-upload-plugin\",\n rollup: createRollupDebugIdUploadHooks(upload, logger, createDependencyOnBuildArtifacts),\n };\n}\n\nfunction rollupBundleSizeOptimizationsPlugin(\n replacementValues: SentrySDKBuildFlags\n): UnpluginOptions {\n return {\n name: \"sentry-rollup-bundle-size-optimizations-plugin\",\n rollup: createRollupBundleSizeOptimizationHooks(replacementValues),\n };\n}\n\nfunction getRollupMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const rollup = req(\"rollup\") as { VERSION?: string };\n return rollup.VERSION?.split(\".\")[0];\n } catch (err) {\n // do nothing, we'll just not report a version\n }\n\n return undefined;\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n injectionPlugin: rollupInjectionPlugin,\n componentNameAnnotatePlugin: rollupComponentNameAnnotatePlugin,\n debugIdUploadPlugin: rollupDebugIdUploadPlugin,\n bundleSizeOptimizationsPlugin: rollupBundleSizeOptimizationsPlugin,\n getBundlerMajorVersion: getRollupMajorVersion,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryRollupPlugin: (options?: Options) => any = sentryUnplugin.rollup;\n\nexport type { Options as SentryRollupPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"names":["rollupComponentNameAnnotatePlugin","ignoredComponents","injectIntoHtml","name","rollup","createComponentNameAnnotateHooks","rollupInjectionPlugin","injectionCode","debugIds","createRollupInjectionHooks","rollupDebugIdUploadPlugin","upload","logger","createDependencyOnBuildArtifacts","createRollupDebugIdUploadHooks","rollupBundleSizeOptimizationsPlugin","replacementValues","createRollupBundleSizeOptimizationHooks","getRollupMajorVersion","_rollup$VERSION","req","createRequire","import","VERSION","split","err","undefined","sentryUnplugin","sentryUnpluginFactory","injectionPlugin","componentNameAnnotatePlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin","getBundlerMajorVersion","sentryRollupPlugin"],"mappings":";;;;;;;AAcA,SAASA,iCAAiCA,CACxCC,iBAA2B,EAC3BC,cAAuB,EACN;EACjB,OAAO;AACLC,IAAAA,IAAI,EAAE,8CAA8C;AACpDC,IAAAA,MAAM,EAAEC,kDAAgC,CAACJ,iBAAiB,EAAEC,cAAc,CAAA;GAC3E,CAAA;AACH,CAAA;AAEA,SAASI,qBAAqBA,CAACC,aAA4B,EAAEC,QAAiB,EAAmB;EAC/F,OAAO;AACLL,IAAAA,IAAI,EAAE,gCAAgC;AACtCC,IAAAA,MAAM,EAAEK,4CAA0B,CAACF,aAAa,EAAEC,QAAQ,CAAA;GAC3D,CAAA;AACH,CAAA;AAEA,SAASE,yBAAyBA,CAChCC,MAAmD,EACnDC,MAAc,EACdC,gCAAkD,EACjC;EACjB,OAAO;AACLV,IAAAA,IAAI,EAAE,sCAAsC;AAC5CC,IAAAA,MAAM,EAAEU,gDAA8B,CAACH,MAAM,EAAEC,MAAM,EAAEC,gCAAgC,CAAA;GACxF,CAAA;AACH,CAAA;AAEA,SAASE,mCAAmCA,CAC1CC,iBAAsC,EACrB;EACjB,OAAO;AACLb,IAAAA,IAAI,EAAE,gDAAgD;IACtDC,MAAM,EAAEa,yDAAuC,CAACD,iBAAiB,CAAA;GAClE,CAAA;AACH,CAAA;AAEA,SAASE,qBAAqBA,GAAuB;EACnD,IAAI;AAAA,IAAA,IAAAC,eAAA,CAAA;AACF;AACA;IACA,IAAMC,GAAG,GAAGC,yBAAa,CAACC,mMAAe,CAAC,CAAA;AAC1C,IAAA,IAAMlB,MAAM,GAAGgB,GAAG,CAAC,QAAQ,CAAyB,CAAA;AACpD,IAAA,OAAA,CAAAD,eAAA,GAAOf,MAAM,CAACmB,OAAO,cAAAJ,eAAA,KAAA,KAAA,CAAA,GAAA,KAAA,CAAA,GAAdA,eAAA,CAAgBK,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;GACrC,CAAC,OAAOC,GAAG,EAAE;AACZ;AAAA,GAAA;AAGF,EAAA,OAAOC,SAAS,CAAA;AAClB,CAAA;AAEA,IAAMC,cAAc,GAAGC,uCAAqB,CAAC;AAC3CC,EAAAA,eAAe,EAAEvB,qBAAqB;AACtCwB,EAAAA,2BAA2B,EAAE9B,iCAAiC;AAC9D+B,EAAAA,mBAAmB,EAAErB,yBAAyB;AAC9CsB,EAAAA,6BAA6B,EAAEjB,mCAAmC;AAClEkB,EAAAA,sBAAsB,EAAEf,qBAAAA;AAC1B,CAAC,CAAC,CAAA;;AAEF;AACagB,IAAAA,kBAA8C,GAAGP,cAAc,CAACvB;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"index.js","names":["CodeInjection","MagicString","COMMENT_USE_STRICT_REGEX","path"],"sources":["../../src/index.ts"],"sourcesContent":["import {\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n isJsFile,\n shouldSkipCodeInjection,\n Options,\n getDebugIdSnippet,\n stringToUUID,\n COMMENT_USE_STRICT_REGEX,\n createDebugIdUploadFunction,\n globFiles,\n createComponentNameAnnotateHooks,\n replaceBooleanFlagsInCode,\n CodeInjection,\n} from \"@sentry/bundler-plugin-core\";\nimport MagicString, { SourceMap } from \"magic-string\";\nimport type { TransformResult } from \"rollup\";\nimport * as path from \"node:path\";\nimport { createRequire } from \"node:module\";\n\nfunction hasExistingDebugID(code: string): boolean {\n // Check if a debug ID has already been injected to avoid duplicate injection (e.g. by another plugin or Sentry CLI)\n const chunkStartSnippet = code.slice(0, 6000);\n const chunkEndSnippet = code.slice(-500);\n\n if (\n chunkStartSnippet.includes(\"_sentryDebugIdIdentifier\") ||\n chunkEndSnippet.includes(\"//# debugId=\")\n ) {\n return true; // Debug ID already present, skip injection\n }\n\n return false;\n}\n\nfunction getRollupMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const rollup = req(\"rollup\") as { VERSION?: string };\n return rollup.VERSION?.split(\".\")[0];\n } catch (err) {\n // do nothing, we'll just not report a version\n }\n\n return undefined;\n}\n\n/**\n * @ignore - this is the internal plugin factory function only used for the Vite plugin!\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function _rollupPluginInternal(\n userOptions: Options = {},\n buildTool: \"rollup\" | \"vite\",\n buildToolMajorVersion?: string\n) {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[sentry-${buildTool}-plugin]`,\n buildTool,\n buildToolMajorVersion: buildToolMajorVersion || getRollupMajorVersion(),\n });\n\n const {\n logger,\n normalizedOptions: options,\n bundleSizeOptimizationReplacementValues: replacementValues,\n bundleMetadata,\n createDependencyOnBuildArtifacts,\n } = sentryBuildPluginManager;\n\n if (options.disable) {\n return {\n name: \"sentry-noop-plugin\",\n };\n }\n\n if (process.cwd().match(/\\\\node_modules\\\\|\\/node_modules\\//)) {\n logger.warn(\n \"Running Sentry plugin from within a `node_modules` folder. Some features may not work.\"\n );\n }\n\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n const sourcemapsEnabled = options.sourcemaps?.disable !== true;\n const staticInjectionCode = new CodeInjection();\n\n if (!options.release.inject) {\n logger.debug(\n \"Release injection disabled via `release.inject` option. Will not inject release.\"\n );\n } else if (!options.release.name) {\n logger.debug(\n \"No release name provided. Will not inject release. Please set the `release.name` option to identify your release.\"\n );\n } else {\n staticInjectionCode.append(\n generateReleaseInjectorCode({\n release: options.release.name,\n injectBuildInformation: options._experiments.injectBuildInformation || false,\n })\n );\n }\n\n if (Object.keys(bundleMetadata).length > 0) {\n staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));\n }\n\n const transformAnnotations = options.reactComponentAnnotation?.enabled\n ? createComponentNameAnnotateHooks(\n options.reactComponentAnnotation?.ignoredComponents || [],\n !!options.reactComponentAnnotation?._experimentalInjectIntoHtml\n )\n : undefined;\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n const shouldTransform = transformAnnotations || transformReplace;\n\n function buildStart(): void {\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n }\n\n async function transform(code: string, id: string): Promise<TransformResult> {\n // Component annotations are only in user code and boolean flag replacements are\n // only in Sentry code. If we successfully add annotations, we can return early.\n\n if (transformAnnotations?.transform) {\n const result = await transformAnnotations.transform(code, id);\n if (result) {\n return result;\n }\n }\n\n if (transformReplace) {\n return replaceBooleanFlagsInCode(code, replacementValues);\n }\n\n return null;\n }\n\n function renderChunk(\n code: string,\n chunk: { fileName: string; facadeModuleId?: string | null },\n _?: unknown,\n meta?: { magicString?: MagicString }\n ): {\n code: string;\n map?: SourceMap;\n } | null {\n if (!isJsFile(chunk.fileName)) {\n return null; // returning null means not modifying the chunk at all\n }\n\n // Skip empty chunks and HTML facade chunks (Vite MPA)\n if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {\n return null;\n }\n\n const injectCode = staticInjectionCode.clone();\n\n if (sourcemapsEnabled && !hasExistingDebugID(code)) {\n const debugId = stringToUUID(code); // generate a deterministic debug ID\n injectCode.append(getDebugIdSnippet(debugId));\n }\n\n if (injectCode.isEmpty()) {\n return null;\n }\n\n const ms = meta?.magicString || new MagicString(code, { filename: chunk.fileName });\n const match = code.match(COMMENT_USE_STRICT_REGEX)?.[0];\n\n if (match) {\n // Add injected code after any comments or \"use strict\" at the beginning of the bundle.\n ms.appendLeft(match.length, injectCode.code());\n } else {\n // ms.replace() doesn't work when there is an empty string match (which happens if\n // there is neither, a comment, nor a \"use strict\" at the top of the chunk) so we\n // need this special case here.\n ms.prepend(injectCode.code());\n }\n\n // Rolldown can pass a native MagicString instance in meta.magicString\n // https://rolldown.rs/in-depth/native-magic-string#usage-examples\n if (ms?.constructor?.name === \"BindingMagicString\") {\n // Rolldown docs say to return the magic string instance directly in this case\n return { code: ms as unknown as string };\n }\n\n return {\n code: ms.toString(),\n map: ms.generateMap({ file: chunk.fileName, hires: \"boundary\" as unknown as undefined }),\n };\n }\n\n async function writeBundle(\n outputOptions: { dir?: string; file?: string },\n bundle: { [fileName: string]: unknown }\n ): Promise<void> {\n try {\n await sentryBuildPluginManager.createRelease();\n\n if (sourcemapsEnabled && options.sourcemaps?.disable !== \"disable-upload\") {\n if (outputOptions.dir) {\n const outputDir = outputOptions.dir;\n const JS_AND_MAP_PATTERNS = [\n \"/**/*.js\",\n \"/**/*.mjs\",\n \"/**/*.cjs\",\n \"/**/*.js.map\",\n \"/**/*.mjs.map\",\n \"/**/*.cjs.map\",\n ].map((q) => `${q}?(\\\\?*)?(#*)`); // We want to allow query and hash strings at the end of files\n const buildArtifacts = await globFiles(JS_AND_MAP_PATTERNS, { root: outputDir });\n await upload(buildArtifacts);\n } else if (outputOptions.file) {\n await upload([outputOptions.file]);\n } else {\n const buildArtifacts = Object.keys(bundle).map((asset) =>\n path.join(path.resolve(), asset)\n );\n await upload(buildArtifacts);\n }\n }\n } finally {\n freeGlobalDependencyOnBuildArtifacts();\n await sentryBuildPluginManager.deleteArtifacts();\n }\n }\n\n const name = `sentry-${buildTool}-plugin`;\n\n if (shouldTransform) {\n return {\n name,\n buildStart,\n transform,\n renderChunk,\n writeBundle,\n };\n }\n\n return {\n name,\n buildStart,\n renderChunk,\n writeBundle,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-explicit-any\nexport function sentryRollupPlugin(userOptions: Options = {}): any {\n // We return an array here so we don't break backwards compatibility with what\n // unplugin used to return\n return [_rollupPluginInternal(userOptions, \"rollup\")];\n}\n\nexport type { Options as SentryRollupPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqBA,SAAS,mBAAmB,MAAuB;CAEjD,MAAM,oBAAoB,KAAK,MAAM,GAAG,IAAK;CAC7C,MAAM,kBAAkB,KAAK,MAAM,KAAK;AAExC,KACE,kBAAkB,SAAS,2BAA2B,IACtD,gBAAgB,SAAS,eAAe,CAExC,QAAO;AAGT,QAAO;;AAGT,SAAS,wBAA4C;AACnD,KAAI;AAKF,sFAF0C,CACvB,SAAS,CACd,SAAS,MAAM,IAAI,CAAC;UAC3B,KAAK;;;;;AAWhB,SAAgB,sBACd,cAAuB,EAAE,EACzB,WACA,uBACA;CACA,MAAM,2FAA0D,aAAa;EAC3E,cAAc,YAAY,cAAc,wBAAwB,WAAW,UAAU;EACrF;EACA,uBAAuB,yBAAyB,uBAAuB;EACxE,CAAC;CAEF,MAAM,EACJ,QACA,mBAAmB,SACnB,yCAAyC,mBACzC,gBACA,qCACE;AAEJ,KAAI,QAAQ,QACV,QAAO,EACL,MAAM,sBACP;AAGH,KAAI,QAAQ,KAAK,CAAC,MAAM,oCAAoC,CAC1D,QAAO,KACL,yFACD;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ENT_USE_STRICT_REGEX, CodeInjection, createComponentNameAnnotateHooks, createDebugIdUploadFunction, createSentryBuildPluginManager, generateModuleMetadataInjectorCode, generateReleaseInjectorCode, getDebugIdSnippet, globFiles, isJsFile, replaceBooleanFlagsInCode, sentryCliBinaryExists, shouldSkipCodeInjection, stringToUUID } from "@sentry/bundler-plugin-core";
|
|
3
|
+
import MagicString from "magic-string";
|
|
4
|
+
import * as path from "node:path";
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
//#region src/index.ts
|
|
7
|
+
function hasExistingDebugID(code) {
|
|
8
|
+
const chunkStartSnippet = code.slice(0, 6e3);
|
|
9
|
+
const chunkEndSnippet = code.slice(-500);
|
|
10
|
+
if (chunkStartSnippet.includes("_sentryDebugIdIdentifier") || chunkEndSnippet.includes("//# debugId=")) return true;
|
|
11
|
+
return false;
|
|
10
12
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
function rollupDebugIdUploadPlugin(upload, logger, createDependencyOnBuildArtifacts) {
|
|
18
|
-
return {
|
|
19
|
-
name: "sentry-rollup-debug-id-upload-plugin",
|
|
20
|
-
rollup: createRollupDebugIdUploadHooks(upload, logger, createDependencyOnBuildArtifacts)
|
|
21
|
-
};
|
|
13
|
+
function getRollupMajorVersion() {
|
|
14
|
+
try {
|
|
15
|
+
return createRequire(import.meta.url)("rollup").VERSION?.split(".")[0];
|
|
16
|
+
} catch (err) {}
|
|
22
17
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @ignore - this is the internal plugin factory function only used for the Vite plugin!
|
|
20
|
+
*/
|
|
21
|
+
function _rollupPluginInternal(userOptions = {}, buildTool, buildToolMajorVersion) {
|
|
22
|
+
const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {
|
|
23
|
+
loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[sentry-${buildTool}-plugin]`,
|
|
24
|
+
buildTool,
|
|
25
|
+
buildToolMajorVersion: buildToolMajorVersion || getRollupMajorVersion()
|
|
26
|
+
});
|
|
27
|
+
const { logger, normalizedOptions: options, bundleSizeOptimizationReplacementValues: replacementValues, bundleMetadata, createDependencyOnBuildArtifacts } = sentryBuildPluginManager;
|
|
28
|
+
if (options.disable) return { name: "sentry-noop-plugin" };
|
|
29
|
+
if (process.cwd().match(/\\node_modules\\|\/node_modules\//)) logger.warn("Running Sentry plugin from within a `node_modules` folder. Some features may not work.");
|
|
30
|
+
const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();
|
|
31
|
+
const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });
|
|
32
|
+
const sourcemapsEnabled = options.sourcemaps?.disable !== true;
|
|
33
|
+
const staticInjectionCode = new CodeInjection();
|
|
34
|
+
if (!options.release.inject) logger.debug("Release injection disabled via `release.inject` option. Will not inject release.");
|
|
35
|
+
else if (!options.release.name) logger.debug("No release name provided. Will not inject release. Please set the `release.name` option to identify your release.");
|
|
36
|
+
else staticInjectionCode.append(generateReleaseInjectorCode({
|
|
37
|
+
release: options.release.name,
|
|
38
|
+
injectBuildInformation: options._experiments.injectBuildInformation || false
|
|
39
|
+
}));
|
|
40
|
+
if (Object.keys(bundleMetadata).length > 0) staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));
|
|
41
|
+
const transformAnnotations = options.reactComponentAnnotation?.enabled ? createComponentNameAnnotateHooks(options.reactComponentAnnotation?.ignoredComponents || [], !!options.reactComponentAnnotation?._experimentalInjectIntoHtml) : void 0;
|
|
42
|
+
const transformReplace = Object.keys(replacementValues).length > 0;
|
|
43
|
+
const shouldTransform = transformAnnotations || transformReplace;
|
|
44
|
+
function buildStart() {
|
|
45
|
+
sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {});
|
|
46
|
+
}
|
|
47
|
+
async function transform(code, id) {
|
|
48
|
+
if (transformAnnotations?.transform) {
|
|
49
|
+
const result = await transformAnnotations.transform(code, id);
|
|
50
|
+
if (result) return result;
|
|
51
|
+
}
|
|
52
|
+
if (transformReplace) return replaceBooleanFlagsInCode(code, replacementValues);
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
function renderChunk(code, chunk, _, meta) {
|
|
56
|
+
if (!isJsFile(chunk.fileName)) return null;
|
|
57
|
+
if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) return null;
|
|
58
|
+
const injectCode = staticInjectionCode.clone();
|
|
59
|
+
if (sourcemapsEnabled && !hasExistingDebugID(code)) {
|
|
60
|
+
const debugId = stringToUUID(code);
|
|
61
|
+
injectCode.append(getDebugIdSnippet(debugId));
|
|
62
|
+
}
|
|
63
|
+
if (injectCode.isEmpty()) return null;
|
|
64
|
+
const ms = meta?.magicString || new MagicString(code, { filename: chunk.fileName });
|
|
65
|
+
const match = code.match(COMMENT_USE_STRICT_REGEX)?.[0];
|
|
66
|
+
if (match) ms.appendLeft(match.length, injectCode.code());
|
|
67
|
+
else ms.prepend(injectCode.code());
|
|
68
|
+
if (ms?.constructor?.name === "BindingMagicString") return { code: ms };
|
|
69
|
+
return {
|
|
70
|
+
code: ms.toString(),
|
|
71
|
+
map: ms.generateMap({
|
|
72
|
+
file: chunk.fileName,
|
|
73
|
+
hires: "boundary"
|
|
74
|
+
})
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async function writeBundle(outputOptions, bundle) {
|
|
78
|
+
try {
|
|
79
|
+
await sentryBuildPluginManager.createRelease();
|
|
80
|
+
if (sourcemapsEnabled && options.sourcemaps?.disable !== "disable-upload") if (outputOptions.dir) {
|
|
81
|
+
const outputDir = outputOptions.dir;
|
|
82
|
+
await upload(await globFiles([
|
|
83
|
+
"/**/*.js",
|
|
84
|
+
"/**/*.mjs",
|
|
85
|
+
"/**/*.cjs",
|
|
86
|
+
"/**/*.js.map",
|
|
87
|
+
"/**/*.mjs.map",
|
|
88
|
+
"/**/*.cjs.map"
|
|
89
|
+
].map((q) => `${q}?(\\?*)?(#*)`), { root: outputDir }));
|
|
90
|
+
} else if (outputOptions.file) await upload([outputOptions.file]);
|
|
91
|
+
else await upload(Object.keys(bundle).map((asset) => path.join(path.resolve(), asset)));
|
|
92
|
+
} finally {
|
|
93
|
+
freeGlobalDependencyOnBuildArtifacts();
|
|
94
|
+
await sentryBuildPluginManager.deleteArtifacts();
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
const name = `sentry-${buildTool}-plugin`;
|
|
98
|
+
if (shouldTransform) return {
|
|
99
|
+
name,
|
|
100
|
+
buildStart,
|
|
101
|
+
transform,
|
|
102
|
+
renderChunk,
|
|
103
|
+
writeBundle
|
|
104
|
+
};
|
|
105
|
+
return {
|
|
106
|
+
name,
|
|
107
|
+
buildStart,
|
|
108
|
+
renderChunk,
|
|
109
|
+
writeBundle
|
|
110
|
+
};
|
|
28
111
|
}
|
|
29
|
-
function
|
|
30
|
-
|
|
31
|
-
var _rollup$VERSION;
|
|
32
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
33
|
-
// @ts-ignore - Rollup already transpiles this for us
|
|
34
|
-
var req = createRequire(import.meta.url);
|
|
35
|
-
var rollup = req("rollup");
|
|
36
|
-
return (_rollup$VERSION = rollup.VERSION) === null || _rollup$VERSION === void 0 ? void 0 : _rollup$VERSION.split(".")[0];
|
|
37
|
-
} catch (err) {
|
|
38
|
-
// do nothing, we'll just not report a version
|
|
39
|
-
}
|
|
40
|
-
return undefined;
|
|
112
|
+
function sentryRollupPlugin(userOptions = {}) {
|
|
113
|
+
return [_rollupPluginInternal(userOptions, "rollup")];
|
|
41
114
|
}
|
|
42
|
-
var sentryUnplugin = sentryUnpluginFactory({
|
|
43
|
-
injectionPlugin: rollupInjectionPlugin,
|
|
44
|
-
componentNameAnnotatePlugin: rollupComponentNameAnnotatePlugin,
|
|
45
|
-
debugIdUploadPlugin: rollupDebugIdUploadPlugin,
|
|
46
|
-
bundleSizeOptimizationsPlugin: rollupBundleSizeOptimizationsPlugin,
|
|
47
|
-
getBundlerMajorVersion: getRollupMajorVersion
|
|
48
|
-
});
|
|
49
|
-
|
|
50
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
|
-
var sentryRollupPlugin = sentryUnplugin.rollup;
|
|
52
115
|
|
|
53
|
-
|
|
54
|
-
|
|
116
|
+
//#endregion
|
|
117
|
+
export { _rollupPluginInternal, sentryCliBinaryExists, sentryRollupPlugin };
|
|
118
|
+
//# sourceMappingURL=index.mjs.map
|
package/dist/esm/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sources":["../../src/index.ts"],"sourcesContent":["import {\n CodeInjection,\n sentryUnpluginFactory,\n Options,\n createRollupInjectionHooks,\n createRollupDebugIdUploadHooks,\n SentrySDKBuildFlags,\n createRollupBundleSizeOptimizationHooks,\n createComponentNameAnnotateHooks,\n Logger,\n} from \"@sentry/bundler-plugin-core\";\nimport { createRequire } from \"node:module\";\nimport type { UnpluginOptions } from \"unplugin\";\n\nfunction rollupComponentNameAnnotatePlugin(\n ignoredComponents: string[],\n injectIntoHtml: boolean\n): UnpluginOptions {\n return {\n name: \"sentry-rollup-component-name-annotate-plugin\",\n rollup: createComponentNameAnnotateHooks(ignoredComponents, injectIntoHtml),\n };\n}\n\nfunction rollupInjectionPlugin(injectionCode: CodeInjection, debugIds: boolean): UnpluginOptions {\n return {\n name: \"sentry-rollup-injection-plugin\",\n rollup: createRollupInjectionHooks(injectionCode, debugIds),\n };\n}\n\nfunction rollupDebugIdUploadPlugin(\n upload: (buildArtifacts: string[]) => Promise<void>,\n logger: Logger,\n createDependencyOnBuildArtifacts: () => () => void\n): UnpluginOptions {\n return {\n name: \"sentry-rollup-debug-id-upload-plugin\",\n rollup: createRollupDebugIdUploadHooks(upload, logger, createDependencyOnBuildArtifacts),\n };\n}\n\nfunction rollupBundleSizeOptimizationsPlugin(\n replacementValues: SentrySDKBuildFlags\n): UnpluginOptions {\n return {\n name: \"sentry-rollup-bundle-size-optimizations-plugin\",\n rollup: createRollupBundleSizeOptimizationHooks(replacementValues),\n };\n}\n\nfunction getRollupMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const rollup = req(\"rollup\") as { VERSION?: string };\n return rollup.VERSION?.split(\".\")[0];\n } catch (err) {\n // do nothing, we'll just not report a version\n }\n\n return undefined;\n}\n\nconst sentryUnplugin = sentryUnpluginFactory({\n injectionPlugin: rollupInjectionPlugin,\n componentNameAnnotatePlugin: rollupComponentNameAnnotatePlugin,\n debugIdUploadPlugin: rollupDebugIdUploadPlugin,\n bundleSizeOptimizationsPlugin: rollupBundleSizeOptimizationsPlugin,\n getBundlerMajorVersion: getRollupMajorVersion,\n});\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const sentryRollupPlugin: (options?: Options) => any = sentryUnplugin.rollup;\n\nexport type { Options as SentryRollupPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"names":["rollupComponentNameAnnotatePlugin","ignoredComponents","injectIntoHtml","name","rollup","createComponentNameAnnotateHooks","rollupInjectionPlugin","injectionCode","debugIds","createRollupInjectionHooks","rollupDebugIdUploadPlugin","upload","logger","createDependencyOnBuildArtifacts","createRollupDebugIdUploadHooks","rollupBundleSizeOptimizationsPlugin","replacementValues","createRollupBundleSizeOptimizationHooks","getRollupMajorVersion","_rollup$VERSION","req","createRequire","import","meta","url","VERSION","split","err","undefined","sentryUnplugin","sentryUnpluginFactory","injectionPlugin","componentNameAnnotatePlugin","debugIdUploadPlugin","bundleSizeOptimizationsPlugin","getBundlerMajorVersion","sentryRollupPlugin"],"mappings":";;;;AAcA,SAASA,iCAAiC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OC,SAAS,CAAA;AAClB,CAAA;AAEA,IAAMC,cAAc,GAAGC,qBAAqB,CAAC;AAC3CC,EAAAA,eAAe,EAAEzB,qBAAqB;AACtC0B,EAAAA,2BAA2B,EAAEhC,iCAAiC;AAC9DiC,EAAAA,mBAAmB,EAAEvB,yBAAyB;AAC9CwB,EAAAA,6BAA6B,EAAEnB,mCAAmC;AAClEoB,EAAAA,sBAAsB,EAAEjB,qBAAAA;AAC1B,CAAC,CAAC,CAAA;;AAEF;AACakB,IAAAA,kBAA8C,GAAGP,cAAc,CAACzB;;;;"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["import {\n createSentryBuildPluginManager,\n generateReleaseInjectorCode,\n generateModuleMetadataInjectorCode,\n isJsFile,\n shouldSkipCodeInjection,\n Options,\n getDebugIdSnippet,\n stringToUUID,\n COMMENT_USE_STRICT_REGEX,\n createDebugIdUploadFunction,\n globFiles,\n createComponentNameAnnotateHooks,\n replaceBooleanFlagsInCode,\n CodeInjection,\n} from \"@sentry/bundler-plugin-core\";\nimport MagicString, { SourceMap } from \"magic-string\";\nimport type { TransformResult } from \"rollup\";\nimport * as path from \"node:path\";\nimport { createRequire } from \"node:module\";\n\nfunction hasExistingDebugID(code: string): boolean {\n // Check if a debug ID has already been injected to avoid duplicate injection (e.g. by another plugin or Sentry CLI)\n const chunkStartSnippet = code.slice(0, 6000);\n const chunkEndSnippet = code.slice(-500);\n\n if (\n chunkStartSnippet.includes(\"_sentryDebugIdIdentifier\") ||\n chunkEndSnippet.includes(\"//# debugId=\")\n ) {\n return true; // Debug ID already present, skip injection\n }\n\n return false;\n}\n\nfunction getRollupMajorVersion(): string | undefined {\n try {\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment\n // @ts-ignore - Rollup already transpiles this for us\n const req = createRequire(import.meta.url);\n const rollup = req(\"rollup\") as { VERSION?: string };\n return rollup.VERSION?.split(\".\")[0];\n } catch (err) {\n // do nothing, we'll just not report a version\n }\n\n return undefined;\n}\n\n/**\n * @ignore - this is the internal plugin factory function only used for the Vite plugin!\n */\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type\nexport function _rollupPluginInternal(\n userOptions: Options = {},\n buildTool: \"rollup\" | \"vite\",\n buildToolMajorVersion?: string\n) {\n const sentryBuildPluginManager = createSentryBuildPluginManager(userOptions, {\n loggerPrefix: userOptions._metaOptions?.loggerPrefixOverride ?? `[sentry-${buildTool}-plugin]`,\n buildTool,\n buildToolMajorVersion: buildToolMajorVersion || getRollupMajorVersion(),\n });\n\n const {\n logger,\n normalizedOptions: options,\n bundleSizeOptimizationReplacementValues: replacementValues,\n bundleMetadata,\n createDependencyOnBuildArtifacts,\n } = sentryBuildPluginManager;\n\n if (options.disable) {\n return {\n name: \"sentry-noop-plugin\",\n };\n }\n\n if (process.cwd().match(/\\\\node_modules\\\\|\\/node_modules\\//)) {\n logger.warn(\n \"Running Sentry plugin from within a `node_modules` folder. Some features may not work.\"\n );\n }\n\n const freeGlobalDependencyOnBuildArtifacts = createDependencyOnBuildArtifacts();\n const upload = createDebugIdUploadFunction({ sentryBuildPluginManager });\n const sourcemapsEnabled = options.sourcemaps?.disable !== true;\n const staticInjectionCode = new CodeInjection();\n\n if (!options.release.inject) {\n logger.debug(\n \"Release injection disabled via `release.inject` option. Will not inject release.\"\n );\n } else if (!options.release.name) {\n logger.debug(\n \"No release name provided. Will not inject release. Please set the `release.name` option to identify your release.\"\n );\n } else {\n staticInjectionCode.append(\n generateReleaseInjectorCode({\n release: options.release.name,\n injectBuildInformation: options._experiments.injectBuildInformation || false,\n })\n );\n }\n\n if (Object.keys(bundleMetadata).length > 0) {\n staticInjectionCode.append(generateModuleMetadataInjectorCode(bundleMetadata));\n }\n\n const transformAnnotations = options.reactComponentAnnotation?.enabled\n ? createComponentNameAnnotateHooks(\n options.reactComponentAnnotation?.ignoredComponents || [],\n !!options.reactComponentAnnotation?._experimentalInjectIntoHtml\n )\n : undefined;\n\n const transformReplace = Object.keys(replacementValues).length > 0;\n const shouldTransform = transformAnnotations || transformReplace;\n\n function buildStart(): void {\n void sentryBuildPluginManager.telemetry.emitBundlerPluginExecutionSignal().catch(() => {\n // Telemetry failures are acceptable\n });\n }\n\n async function transform(code: string, id: string): Promise<TransformResult> {\n // Component annotations are only in user code and boolean flag replacements are\n // only in Sentry code. If we successfully add annotations, we can return early.\n\n if (transformAnnotations?.transform) {\n const result = await transformAnnotations.transform(code, id);\n if (result) {\n return result;\n }\n }\n\n if (transformReplace) {\n return replaceBooleanFlagsInCode(code, replacementValues);\n }\n\n return null;\n }\n\n function renderChunk(\n code: string,\n chunk: { fileName: string; facadeModuleId?: string | null },\n _?: unknown,\n meta?: { magicString?: MagicString }\n ): {\n code: string;\n map?: SourceMap;\n } | null {\n if (!isJsFile(chunk.fileName)) {\n return null; // returning null means not modifying the chunk at all\n }\n\n // Skip empty chunks and HTML facade chunks (Vite MPA)\n if (shouldSkipCodeInjection(code, chunk.facadeModuleId)) {\n return null;\n }\n\n const injectCode = staticInjectionCode.clone();\n\n if (sourcemapsEnabled && !hasExistingDebugID(code)) {\n const debugId = stringToUUID(code); // generate a deterministic debug ID\n injectCode.append(getDebugIdSnippet(debugId));\n }\n\n if (injectCode.isEmpty()) {\n return null;\n }\n\n const ms = meta?.magicString || new MagicString(code, { filename: chunk.fileName });\n const match = code.match(COMMENT_USE_STRICT_REGEX)?.[0];\n\n if (match) {\n // Add injected code after any comments or \"use strict\" at the beginning of the bundle.\n ms.appendLeft(match.length, injectCode.code());\n } else {\n // ms.replace() doesn't work when there is an empty string match (which happens if\n // there is neither, a comment, nor a \"use strict\" at the top of the chunk) so we\n // need this special case here.\n ms.prepend(injectCode.code());\n }\n\n // Rolldown can pass a native MagicString instance in meta.magicString\n // https://rolldown.rs/in-depth/native-magic-string#usage-examples\n if (ms?.constructor?.name === \"BindingMagicString\") {\n // Rolldown docs say to return the magic string instance directly in this case\n return { code: ms as unknown as string };\n }\n\n return {\n code: ms.toString(),\n map: ms.generateMap({ file: chunk.fileName, hires: \"boundary\" as unknown as undefined }),\n };\n }\n\n async function writeBundle(\n outputOptions: { dir?: string; file?: string },\n bundle: { [fileName: string]: unknown }\n ): Promise<void> {\n try {\n await sentryBuildPluginManager.createRelease();\n\n if (sourcemapsEnabled && options.sourcemaps?.disable !== \"disable-upload\") {\n if (outputOptions.dir) {\n const outputDir = outputOptions.dir;\n const JS_AND_MAP_PATTERNS = [\n \"/**/*.js\",\n \"/**/*.mjs\",\n \"/**/*.cjs\",\n \"/**/*.js.map\",\n \"/**/*.mjs.map\",\n \"/**/*.cjs.map\",\n ].map((q) => `${q}?(\\\\?*)?(#*)`); // We want to allow query and hash strings at the end of files\n const buildArtifacts = await globFiles(JS_AND_MAP_PATTERNS, { root: outputDir });\n await upload(buildArtifacts);\n } else if (outputOptions.file) {\n await upload([outputOptions.file]);\n } else {\n const buildArtifacts = Object.keys(bundle).map((asset) =>\n path.join(path.resolve(), asset)\n );\n await upload(buildArtifacts);\n }\n }\n } finally {\n freeGlobalDependencyOnBuildArtifacts();\n await sentryBuildPluginManager.deleteArtifacts();\n }\n }\n\n const name = `sentry-${buildTool}-plugin`;\n\n if (shouldTransform) {\n return {\n name,\n buildStart,\n transform,\n renderChunk,\n writeBundle,\n };\n }\n\n return {\n name,\n buildStart,\n renderChunk,\n writeBundle,\n };\n}\n\n// eslint-disable-next-line @typescript-eslint/explicit-function-return-type, @typescript-eslint/no-explicit-any\nexport function sentryRollupPlugin(userOptions: Options = {}): any {\n // We return an array here so we don't break backwards compatibility with what\n // unplugin used to return\n return [_rollupPluginInternal(userOptions, \"rollup\")];\n}\n\nexport type { Options as SentryRollupPluginOptions } from \"@sentry/bundler-plugin-core\";\nexport { sentryCliBinaryExists } from \"@sentry/bundler-plugin-core\";\n"],"mappings":";;;;;;AAqBA,SAAS,mBAAmB,MAAuB;CAEjD,MAAM,oBAAoB,KAAK,MAAM,GAAG,IAAK;CAC7C,MAAM,kBAAkB,KAAK,MAAM,KAAK;AAEx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AAG,EAAE,cAAc,EAC4B,EAAE,MAAM,WAAW,CAAC,CACpD;cACnB,cAAc,KACvB,OAAM,OAAO,CAAC,cAAc,KAAK,CAAC;OAKlC,OAAM,OAHiB,OAAO,KAAK,OAAO,CAAC,KAAK,UAC9C,KAAK,KAAK,KAAK,SAAS,EAAE,MAAM,CACjC,CAC2B;YAGxB;AACR,yCAAsC;AACtC,SAAM,yBAAyB,iBAAiB;;;CAIpD,MAAM,OAAO,UAAU,UAAU;AAEjC,KAAI,gBACF,QAAO;EACL;EACA;EACA;EACA;EACA;EACD;AAGH,QAAO;EACL;EACA;EACA;EACA;EACD;;AAIH,SAAgB,mBAAmB,cAAuB,EAAE,EAAO;AAGjE,QAAO,CAAC,sBAAsB,aAAa,SAAS,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,54 @@
|
|
|
1
1
|
import { Options } from "@sentry/bundler-plugin-core";
|
|
2
|
-
|
|
2
|
+
import MagicString, { SourceMap } from "magic-string";
|
|
3
|
+
import type { TransformResult } from "rollup";
|
|
4
|
+
/**
|
|
5
|
+
* @ignore - this is the internal plugin factory function only used for the Vite plugin!
|
|
6
|
+
*/
|
|
7
|
+
export declare function _rollupPluginInternal(userOptions: Options | undefined, buildTool: "rollup" | "vite", buildToolMajorVersion?: string): {
|
|
8
|
+
name: string;
|
|
9
|
+
buildStart?: undefined;
|
|
10
|
+
transform?: undefined;
|
|
11
|
+
renderChunk?: undefined;
|
|
12
|
+
writeBundle?: undefined;
|
|
13
|
+
} | {
|
|
14
|
+
name: string;
|
|
15
|
+
buildStart: () => void;
|
|
16
|
+
transform: (code: string, id: string) => Promise<TransformResult>;
|
|
17
|
+
renderChunk: (code: string, chunk: {
|
|
18
|
+
fileName: string;
|
|
19
|
+
facadeModuleId?: string | null;
|
|
20
|
+
}, _?: unknown, meta?: {
|
|
21
|
+
magicString?: MagicString;
|
|
22
|
+
}) => {
|
|
23
|
+
code: string;
|
|
24
|
+
map?: SourceMap | undefined;
|
|
25
|
+
} | null;
|
|
26
|
+
writeBundle: (outputOptions: {
|
|
27
|
+
dir?: string;
|
|
28
|
+
file?: string;
|
|
29
|
+
}, bundle: {
|
|
30
|
+
[fileName: string]: unknown;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
} | {
|
|
33
|
+
name: string;
|
|
34
|
+
buildStart: () => void;
|
|
35
|
+
renderChunk: (code: string, chunk: {
|
|
36
|
+
fileName: string;
|
|
37
|
+
facadeModuleId?: string | null;
|
|
38
|
+
}, _?: unknown, meta?: {
|
|
39
|
+
magicString?: MagicString;
|
|
40
|
+
}) => {
|
|
41
|
+
code: string;
|
|
42
|
+
map?: SourceMap | undefined;
|
|
43
|
+
} | null;
|
|
44
|
+
writeBundle: (outputOptions: {
|
|
45
|
+
dir?: string;
|
|
46
|
+
file?: string;
|
|
47
|
+
}, bundle: {
|
|
48
|
+
[fileName: string]: unknown;
|
|
49
|
+
}) => Promise<void>;
|
|
50
|
+
transform?: undefined;
|
|
51
|
+
};
|
|
52
|
+
export declare function sentryRollupPlugin(userOptions?: Options): any;
|
|
3
53
|
export type { Options as SentryRollupPluginOptions } from "@sentry/bundler-plugin-core";
|
|
4
54
|
export { sentryCliBinaryExists } from "@sentry/bundler-plugin-core";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentry/rollup-plugin",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"description": "Official Sentry Rollup plugin",
|
|
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/rollup-plugin",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"scripts": {
|
|
33
33
|
"build": "premove ./out && run-p build:rollup build:types",
|
|
34
34
|
"build:watch": "run-p build:rollup:watch build:types:watch",
|
|
35
|
-
"build:rollup": "
|
|
36
|
-
"build:rollup:watch": "
|
|
35
|
+
"build:rollup": "rolldown --config rollup.config.mjs",
|
|
36
|
+
"build:rollup:watch": "rolldown --config rollup.config.mjs --watch --no-watch.clearScreen",
|
|
37
37
|
"build:types": "tsc --project types.tsconfig.json",
|
|
38
38
|
"build:types:watch": "tsc --project types.tsconfig.json --watch --preserveWatchOutput",
|
|
39
39
|
"build:npm": "npm pack",
|
|
@@ -49,20 +49,15 @@
|
|
|
49
49
|
"prepack": "ts-node ./src/prepack.ts"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@sentry/bundler-plugin-core": "
|
|
53
|
-
"
|
|
52
|
+
"@sentry/bundler-plugin-core": "5.0.0",
|
|
53
|
+
"magic-string": "0.30.8"
|
|
54
54
|
},
|
|
55
55
|
"peerDependencies": {
|
|
56
56
|
"rollup": ">=3.2.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@
|
|
60
|
-
"@
|
|
61
|
-
"@babel/preset-typescript": "7.17.12",
|
|
62
|
-
"@rollup/plugin-babel": "5.3.1",
|
|
63
|
-
"@rollup/plugin-node-resolve": "13.3.0",
|
|
64
|
-
"@sentry-internal/eslint-config": "4.9.1",
|
|
65
|
-
"@sentry-internal/sentry-bundler-plugin-tsconfig": "4.9.1",
|
|
59
|
+
"@sentry-internal/eslint-config": "5.0.0",
|
|
60
|
+
"@sentry-internal/sentry-bundler-plugin-tsconfig": "5.0.0",
|
|
66
61
|
"@swc/core": "^1.2.205",
|
|
67
62
|
"@swc/jest": "^0.2.21",
|
|
68
63
|
"@types/jest": "^28.1.3",
|
|
@@ -70,7 +65,7 @@
|
|
|
70
65
|
"eslint": "^8.18.0",
|
|
71
66
|
"jest": "^28.1.1",
|
|
72
67
|
"premove": "^4.0.0",
|
|
73
|
-
"
|
|
68
|
+
"rolldown": "^1.0.0-rc.4",
|
|
74
69
|
"ts-node": "^10.9.1",
|
|
75
70
|
"typescript": "^4.7.4"
|
|
76
71
|
},
|