File: tsc-workaround.patch

package info (click to toggle)
node-rollup-plugin-typescript2 0.34.1%2Bds%2B~cs6.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,032 kB
  • sloc: javascript: 1,211; sh: 4; makefile: 2
file content (76 lines) | stat: -rw-r--r-- 2,277 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
Description: some ts workarounds
Author: Yadd <yadd@debian.org>
Forwarded: not-needed
Last-Update: 2022-12-04

--- a/__tests__/integration/helpers.ts
+++ b/__tests__/integration/helpers.ts
@@ -40,6 +40,7 @@
   const { output: files } = esm;
   for (const file of files) {
     if ("isAsset" in file) {
+// @ts-ignore
       const optIsAsset = file as Partial<Pick<OutputAsset, "isAsset">> & Omit<OutputAsset, "isAsset">;
       delete optIsAsset["isAsset"];
     }
--- a/src/index.ts
+++ b/src/index.ts
@@ -4,7 +4,7 @@
 import { normalizePath as normalize } from "@rollup/pluginutils";
 import { blue, red, yellow, green } from "colors/safe";
 import { satisfies } from "semver";
-import findCacheDir from "find-cache-dir";
+const findCacheDir = require("find-cache-dir");
 
 import { RollupContext, VerbosityLevel } from "./context";
 import { LanguageServiceHost } from "./host";
--- a/src/tscache.ts
+++ b/src/tscache.ts
@@ -1,8 +1,8 @@
 import * as tsTypes from "typescript";
 import * as fs from "fs-extra";
 import * as _ from "lodash";
-import { Graph, alg } from "graphlib";
-import objHash from "object-hash";
+const { Graph, alg } = require('graphlib');
+const objHash = require("object-hash");
 import { blue, yellow, green } from "colors/safe";
 
 import { RollupContext } from "./context";
@@ -68,7 +68,7 @@
 {
 	private cacheVersion = "9";
 	private cachePrefix = "rpt2_";
-	private dependencyTree: Graph;
+	private dependencyTree: typeof Graph;
 	private ambientTypes!: ITypeSnapshot[];
 	private ambientTypesDirty = false;
 	private cacheDir!: string;
@@ -98,6 +98,7 @@
 				rollupConfig: this.rollupConfig,
 				tsVersion: tsModule.version,
 			},
+// @ts-ignore
 			this.hashOptions,
 		)}`;
 
@@ -155,9 +156,11 @@
 	public walkTree(cb: (id: string) => void | false): void
 	{
 		if (alg.isAcyclic(this.dependencyTree))
+// @ts-ignore
 			return alg.topsort(this.dependencyTree).forEach(id => cb(id));
 
 		this.context.info(yellow("import tree has cycles"));
+// @ts-ignore
 		this.dependencyTree.nodes().forEach(id => cb(id));
 	}
 
@@ -293,6 +296,7 @@
 	private createHash(id: string, snapshot: tsTypes.IScriptSnapshot)
 	{
 		const data = snapshot.getText(0, snapshot.getLength());
+// @ts-ignore
 		return objHash({ data, id }, this.hashOptions);
 	}
 }