Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@
"dependencies": {
"@apm-js-collab/code-transformer": "^0.18.1",
"es-module-lexer": "^2.1.0",
"magic-string": "^0.30.21",
"magic-string": "^1.1.0",
"module-details-from-path": "^1.0.4"
},
"devDependencies": {
Expand Down
14 changes: 8 additions & 6 deletions src/rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
shouldSkipCodeInjection,
type CodeTransformerPluginOptions,
} from "./core.js";
import MagicString, { SourceMap } from "magic-string";
import MagicString from "magic-string";

export default function codeTransformerRollup(
options: CodeTransformerPluginOptions,
Expand All @@ -27,7 +27,7 @@ export default function codeTransformerRollup(
meta?: { magicString?: MagicString, chunks: unknown },
): {
code: string;
map?: SourceMap;
map?: string;
} | null => {
if (!isJsFile(chunk.fileName)) {
return null; // returning null means not modifying the chunk at all
Expand Down Expand Up @@ -74,10 +74,12 @@ export default function codeTransformerRollup(

return {
code: ms.toString(),
map: ms.generateMap({
file: chunk.fileName,
hires: "boundary" as unknown as undefined,
}),
map: ms
.generateMap({
file: chunk.fileName,
hires: "boundary" as unknown as undefined,
})
.toString(),
};
};

Expand Down
7 changes: 7 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1009,6 +1009,13 @@ magic-string@^0.30.21:
dependencies:
"@jridgewell/sourcemap-codec" "^1.5.5"

magic-string@^1.1.0:
version "1.1.0"
resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-1.1.0.tgz#54a8470aabf2a04b970177f26c0308cabea74a3f"
integrity sha512-kS3VHe0nEPST2saQV4Rbkchcd3UBRkVTQHo1D3h/ZTwFDhai/mfKkmtPAtD129EOI7K3HlHIsFOt0WrI2/oU9g==
dependencies:
"@jridgewell/sourcemap-codec" "^1.5.5"

merge-stream@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/merge-stream/-/merge-stream-2.0.0.tgz#52823629a14dd00c9770fb6ad47dc6310f2c1f60"
Expand Down