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 06fe6d7..1a29474 100644
--- a/package.json
+++ b/package.json
@@ -75,7 +75,7 @@
     "@babel/code-frame": "^8.0.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 922c572..2a3326b 100644
--- a/rollup.config.ts
+++ b/rollup.config.ts
@@ -4,7 +4,7 @@ import type { Plugin, 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", "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", "rollup", "@babel/code-frame", "magic-string", "@ampproject/remapping", "@jridgewell/sourcemap-codec", "convert-source-map"];
 
 // Substitute src/typescript-shim.mjs for `import ts from "typescript"` in the
 // bundled output. The shim loads the compiler API from the user's `typescript`
diff --git a/src/transform/index.ts b/src/transform/index.ts
index 30feb0c..687eab6 100644
--- a/src/transform/index.ts
+++ b/src/transform/index.ts
@@ -1,7 +1,7 @@
 import * as path from "node:path";
 import type { OutputBundle, Plugin } 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";
@@ -12,6 +12,11 @@ import MagicString from "magic-string";
 import { loadInputSourcemap, hydrateSourcemap, type InputSourceMap, type SourcemapInfo } from "./sourcemap.js";
 import { rewritePortableSharedChunkImportsInBundle } from "./sharedChunkPortability.js";
 
+type RemappingFn = (
+  input: RawSourceMap,
+  loader: (file: string) => RawSourceMap | null,
+) => { sources: Array<string | null>; mappings: string | unknown; names?: string[] };
+
 /**
  * This is the *transform* part of `rollup-plugin-dts`.
  *
@@ -353,7 +358,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<string>();
-          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/src/transform/sharedChunkPortability.ts b/src/transform/sharedChunkPortability.ts
index 82810a0..2d44be9 100644
--- a/src/transform/sharedChunkPortability.ts
+++ b/src/transform/sharedChunkPortability.ts
@@ -1,11 +1,16 @@
 import * as path from "node:path";
 import type { OutputBundle, OutputChunk, 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 ts from "typescript";
 import MagicString from "magic-string";
 import { parse } from "../helpers.js";
 
+type RemappingFn = (
+  input: RawSourceMap,
+  loader: (file: string) => RawSourceMap | null,
+) => { sources: Array<string | null>; mappings: string | unknown; names?: string[] };
+
 type ChunkGraphInfo = {
   exports: string[];
   isEntry: boolean;
@@ -379,7 +384,8 @@ function applyChunkEdits(chunk: Pick<OutputChunk, "code" | "fileName" | "map">,
       includeContent: true,
       source: chunkFileName,
     });
-    const remapped = remapping(rewriteMap as unknown as RawSourceMap, (file) => {
+    const remap = remapping.default as unknown as RemappingFn;
+    const remapped = remap(rewriteMap as unknown as RawSourceMap, (file: string) => {
       if (normalizeChunkPath(file) === chunkFileName) {
         return chunk.map as unknown as RawSourceMap;
       }
diff --git a/tests/downstream-helpers.ts b/tests/downstream-helpers.ts
index d95cfdd..95b76a4 100644
--- a/tests/downstream-helpers.ts
+++ b/tests/downstream-helpers.ts
@@ -109,9 +109,8 @@ export async function assertDownstream(
   downstream: DownstreamCase[],
   bless: boolean,
 ) {
-  // Type-check the bundled output with the native TypeScript 7 compiler
-  // ("typescript" resolves to @typescript/typescript6, whose bin is `tsc6`).
-  const tscBin = path.resolve("node_modules/@typescript/native/bin/tsc");
+  // Type-check the bundled output with the installed TypeScript compiler.
+  const tscBin = path.resolve("node_modules/typescript/lib/tsc.js");
 
   for (const testCase of downstream) {
     const tempRoot = await fs.mkdtemp(path.join(os.tmpdir(), "rollup-plugin-dts-downstream-"));
diff --git a/tests/shim.ts b/tests/shim.ts
index afc2d73..075b46c 100644
--- a/tests/shim.ts
+++ b/tests/shim.ts
@@ -74,7 +74,9 @@ async function createFixture(tempRoot: string) {
 }
 
 function runNode(cwd: string, args: Array<string>) {
-  return spawnSync(process.execPath, args, { cwd, encoding: "utf8" });
+  // Keep the synthetic fixture isolated on distributions whose Node build
+  // searches system-wide module directories in addition to local node_modules.
+  return spawnSync(process.execPath, ["--no-global-search-paths", ...args], { cwd, encoding: "utf8" });
 }
 
 export default (t: Harness) => {
@@ -87,6 +89,10 @@ export default (t: Harness) => {
     // is typescript@7 (which does not)
     const tsWithApi = path.resolve("node_modules/typescript");
     const ts7 = path.resolve("node_modules/@typescript/native");
+    const hasTs7 = await fs.access(ts7).then(
+      () => true,
+      () => false,
+    );
 
     try {
       await createFixture(tempRoot);
@@ -97,29 +103,31 @@ export default (t: Harness) => {
       assert.strictEqual(primary.status, 0, primary.stderr);
       assert.ok(primary.stdout.includes("interface Foo"), primary.stdout);
 
-      // typescript@7 with the @typescript/typescript6 fallback installed
-      await fs.rm(tsLink, { recursive: true, force: true });
-      await link(ts7, tsLink);
-      await link(tsWithApi, ts6Link);
-      const fallback = runNode(tempRoot, ["consumer.mjs"]);
-      assert.strictEqual(fallback.status, 0, fallback.stderr);
-      assert.ok(fallback.stdout.includes("interface Foo"), fallback.stdout);
-      const fallbackCjs = runNode(tempRoot, ["consumer.cjs"]);
-      assert.strictEqual(fallbackCjs.status, 0, fallbackCjs.stderr);
-
-      // the rollup cli loads the config file through its own bundling step,
-      // so also cover that path importing the plugin
-      const rollupBin = path.join(tempRoot, "node_modules", "rollup", "dist", "bin", "rollup");
-      const cli = runNode(tempRoot, [rollupBin, "--config", "--silent"]);
-      assert.strictEqual(cli.status, 0, `${cli.stdout}${cli.stderr}`);
-      const cliOutput = await fs.readFile(path.join(tempRoot, "out", "index.d.ts"), "utf-8");
-      assert.ok(cliOutput.includes("interface Foo"), cliOutput);
-
-      // typescript@7 without the fallback: guided error
-      await fs.rm(ts6Link, { recursive: true, force: true });
-      const missingFallback = runNode(tempRoot, ["consumer.mjs"]);
-      assert.notStrictEqual(missingFallback.status, 0, "expected the consumer to fail without @typescript/typescript6");
-      assert.ok(missingFallback.stderr.includes("npm install -D @typescript/typescript6"), missingFallback.stderr);
+      if (hasTs7) {
+        // typescript@7 with the @typescript/typescript6 fallback installed
+        await fs.rm(tsLink, { recursive: true, force: true });
+        await link(ts7, tsLink);
+        await link(tsWithApi, ts6Link);
+        const fallback = runNode(tempRoot, ["consumer.mjs"]);
+        assert.strictEqual(fallback.status, 0, fallback.stderr);
+        assert.ok(fallback.stdout.includes("interface Foo"), fallback.stdout);
+        const fallbackCjs = runNode(tempRoot, ["consumer.cjs"]);
+        assert.strictEqual(fallbackCjs.status, 0, fallbackCjs.stderr);
+
+        // the rollup cli loads the config file through its own bundling step,
+        // so also cover that path importing the plugin
+        const rollupBin = path.join(tempRoot, "node_modules", "rollup", "dist", "bin", "rollup");
+        const cli = runNode(tempRoot, [rollupBin, "--config", "--silent"]);
+        assert.strictEqual(cli.status, 0, `${cli.stdout}${cli.stderr}`);
+        const cliOutput = await fs.readFile(path.join(tempRoot, "out", "index.d.ts"), "utf-8");
+        assert.ok(cliOutput.includes("interface Foo"), cliOutput);
+
+        // typescript@7 without the fallback: guided error
+        await fs.rm(ts6Link, { recursive: true, force: true });
+        const missingFallback = runNode(tempRoot, ["consumer.mjs"]);
+        assert.notStrictEqual(missingFallback.status, 0, "expected the consumer to fail without @typescript/typescript6");
+        assert.ok(missingFallback.stderr.includes("npm install -D @typescript/typescript6"), missingFallback.stderr);
+      }
 
       // no typescript at all: guided error
       await fs.rm(tsLink, { recursive: true, force: true });
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'],
   },
 };
