Under TypeScript node16 module resolution, I often find myself needing to fix broken ESM types in packages by copying their type definition files (example package).
These diffs currently show a new file command with the full content of the copied file, which makes them very long and hard to maintain from release to release.
diff --git a/dist/hls.js.d.ts b/dist/hls.d.mts
similarity index 100%
rename from dist/hls.js.d.ts
rename to dist/hls.d.mts
diff --git a/dist/hls.d.ts b/dist/hls.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..7ba8086b369797b5778b5295443cdd07e6beb72c
--- /dev/null
+++ b/dist/hls.d.ts
@@ -0,0 +1,3105 @@
+export declare interface AbrComponentAPI extends ComponentAPI {
+ firstAutoLevel: number;
+ forcedAutoLevel: number;
(3000+ more lines)
I can generate my own much smaller patch using git diff --find-copies-harder. It's both easier to understand and easier to keep updated with the underlying package.
diff --git a/dist/hls.js.d.ts b/dist/hls.d.mts
similarity index 100%
copy from dist/hls.js.d.ts
copy to dist/hls.d.mts
diff --git a/dist/hls.js.d.ts b/dist/hls.d.ts
similarity index 100%
rename from dist/hls.js.d.ts
rename to dist/hls.d.ts
Unfortunately patch-package silently ignores these copy from/copy to headers.
When applying a patch generated by git diff, it would be great if this package would copy files. If that's not possible, then it should at least refuse to apply the patch.
Under TypeScript
node16
module resolution, I often find myself needing to fix broken ESM types in packages by copying their type definition files (example package).These diffs currently show a
new file
command with the full content of the copied file, which makes them very long and hard to maintain from release to release.I can generate my own much smaller patch using
git diff --find-copies-harder
. It's both easier to understand and easier to keep updated with the underlying package.Unfortunately
patch-package
silently ignores thesecopy from
/copy to
headers.When applying a patch generated by
git diff
, it would be great if this package would copy files. If that's not possible, then it should at least refuse to apply the patch.Full list of extended header lines: https://git-scm.com/docs/diff-generate-patch#generate_patch_text_with_p
Thanks!