From: Subject: Debian changes The Debian packaging of node-rollup-plugin-dts is maintained in git, using a workflow similar to the one described in dgit-maint-merge(7). The Debian delta is represented by this one combined patch; there isn't a patch queue that can be represented as a quilt series. A detailed breakdown of the changes is available from their canonical representation -- git commits in the packaging repository. For example, to see the changes made by the Debian maintainer in the first upload of upstream version 1.2.3, you could use: % git clone https://git.dgit.debian.org/node-rollup-plugin-dts % cd node-rollup-plugin-dts % git log --oneline 1.2.3..debian/1.2.3-1 -- . ':!debian' (If you have dgit, use `dgit clone node-rollup-plugin-dts`, rather than plain `git clone`.) We don't use debian/source/options single-debian-patch because it has bugs. Therefore, NMUs etc. may nevertheless have made additional patches. --- diff --git a/package.json b/package.json index abca6e4..f5d3605 100644 --- a/package.json +++ b/package.json @@ -68,7 +68,7 @@ "@babel/code-frame": "^7.29.0" }, "dependencies": { - "@jridgewell/remapping": "^2.3.5", + "@ampproject/remapping": "^2.2.0", "@jridgewell/sourcemap-codec": "^1.5.5", "convert-source-map": "^2.0.0", "magic-string": "^0.30.21" diff --git a/rollup.config.ts b/rollup.config.ts index 2ac1d20..b37fa04 100644 --- a/rollup.config.ts +++ b/rollup.config.ts @@ -3,7 +3,7 @@ import type { RollupWatchOptions } from "rollup"; import dts from "./src/index.js"; const pkg = JSON.parse(fs.readFileSync("./package.json", { encoding: "utf-8" })); -const external = ["node:module", "node:path", "node:fs", "node:fs/promises", "typescript", "rollup", "@babel/code-frame", "magic-string", "@jridgewell/remapping", "@jridgewell/sourcemap-codec", "convert-source-map"]; +const external = ["node:module", "node:path", "node:fs", "node:fs/promises", "typescript", "rollup", "@babel/code-frame", "magic-string", "@ampproject/remapping", "@jridgewell/sourcemap-codec", "convert-source-map"]; const config: Array = [ { diff --git a/src/transform/index.ts b/src/transform/index.ts index 0e6c06b..08a1e7e 100644 --- a/src/transform/index.ts +++ b/src/transform/index.ts @@ -1,7 +1,7 @@ import * as path from "node:path"; import type { Plugin, SourceMap } from "rollup"; -import remapping from "@jridgewell/remapping"; -import type { RawSourceMap } from "@jridgewell/remapping"; +import * as remapping from "@ampproject/remapping"; +import type { RawSourceMap } from "@ampproject/remapping"; import { NamespaceFixer } from "./NamespaceFixer.js"; import { preProcess } from "./preprocess.js"; import { convert } from "./Transformer.js"; @@ -11,6 +11,11 @@ import { ModuleDeclarationFixer } from "./ModuleDeclarationFixer.js"; import MagicString from "magic-string"; import { loadInputSourcemap, hydrateSourcemap, type InputSourceMap, type SourcemapInfo } from "./sourcemap.js"; +type RemappingFn = ( + input: RawSourceMap, + loader: (file: string) => RawSourceMap | null, +) => { sources: Array; mappings: string | unknown; names?: string[] }; + /** * This is the *transform* part of `rollup-plugin-dts`. * @@ -347,7 +352,8 @@ export const transform = (enableSourcemap: boolean) => { // point back to foo.ts. If we return the same map when resolving foo.ts, // @jridgewell/remapping will recursively try to resolve foo.ts again → infinite loop. const visitedFiles = new Set(); - const remapped = remapping(chunk.map as unknown as RawSourceMap, (file) => { + const remap = remapping.default as unknown as RemappingFn; + const remapped = remap(chunk.map as unknown as RawSourceMap, (file: string) => { // File paths from remapping are relative to the chunk's output location const absolutePath = path.resolve(chunkDir, file); diff --git a/tests/testcases/include-external/meta.js b/tests/testcases/include-external/meta.js index 2cd3f55..a0d9335 100644 --- a/tests/testcases/include-external/meta.js +++ b/tests/testcases/include-external/meta.js @@ -2,6 +2,6 @@ /** @type {import('../../testcases').Meta} */ export default { options: { - includeExternal: ['@types/d3-drag'], + includeExternal: ['@types/d3-drag', 'd3-drag'], }, };