sublimation 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,28 @@
1
+ name: Run unit tests
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ push:
6
+ branches: [master]
7
+ pull_request:
8
+ branches: [master]
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ steps:
14
+ - uses: actions/checkout@v4
15
+
16
+ - uses: actions/setup-node@v4
17
+ with:
18
+ node-version: "22"
19
+
20
+ - uses: pnpm/action-setup@v4
21
+ with:
22
+ version: "9"
23
+
24
+ - name: Install dependencies
25
+ run: pnpm i
26
+
27
+ - name: Test
28
+ run: pnpm test
package/LICENSE ADDED
@@ -0,0 +1,116 @@
1
+ CC0 1.0 Universal
2
+
3
+ Statement of Purpose
4
+
5
+ The laws of most jurisdictions throughout the world automatically confer
6
+ exclusive Copyright and Related Rights (defined below) upon the creator and
7
+ subsequent owner(s) (each and all, an "owner") of an original work of
8
+ authorship and/or a database (each, a "Work").
9
+
10
+ Certain owners wish to permanently relinquish those rights to a Work for the
11
+ purpose of contributing to a commons of creative, cultural and scientific
12
+ works ("Commons") that the public can reliably and without fear of later
13
+ claims of infringement build upon, modify, incorporate in other works, reuse
14
+ and redistribute as freely as possible in any form whatsoever and for any
15
+ purposes, including without limitation commercial purposes. These owners may
16
+ contribute to the Commons to promote the ideal of a free culture and the
17
+ further production of creative, cultural and scientific works, or to gain
18
+ reputation or greater distribution for their Work in part through the use and
19
+ efforts of others.
20
+
21
+ For these and/or other purposes and motivations, and without any expectation
22
+ of additional consideration or compensation, the person associating CC0 with a
23
+ Work (the "Affirmer"), to the extent that he or she is an owner of Copyright
24
+ and Related Rights in the Work, voluntarily elects to apply CC0 to the Work
25
+ and publicly distribute the Work under its terms, with knowledge of his or her
26
+ Copyright and Related Rights in the Work and the meaning and intended legal
27
+ effect of CC0 on those rights.
28
+
29
+ 1. Copyright and Related Rights. A Work made available under CC0 may be
30
+ protected by copyright and related or neighboring rights ("Copyright and
31
+ Related Rights"). Copyright and Related Rights include, but are not limited
32
+ to, the following:
33
+
34
+ i. the right to reproduce, adapt, distribute, perform, display, communicate,
35
+ and translate a Work;
36
+
37
+ ii. moral rights retained by the original author(s) and/or performer(s);
38
+
39
+ iii. publicity and privacy rights pertaining to a person's image or likeness
40
+ depicted in a Work;
41
+
42
+ iv. rights protecting against unfair competition in regards to a Work,
43
+ subject to the limitations in paragraph 4(a), below;
44
+
45
+ v. rights protecting the extraction, dissemination, use and reuse of data in
46
+ a Work;
47
+
48
+ vi. database rights (such as those arising under Directive 96/9/EC of the
49
+ European Parliament and of the Council of 11 March 1996 on the legal
50
+ protection of databases, and under any national implementation thereof,
51
+ including any amended or successor version of such directive); and
52
+
53
+ vii. other similar, equivalent or corresponding rights throughout the world
54
+ based on applicable law or treaty, and any national implementations thereof.
55
+
56
+ 2. Waiver. To the greatest extent permitted by, but not in contravention of,
57
+ applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and
58
+ unconditionally waives, abandons, and surrenders all of Affirmer's Copyright
59
+ and Related Rights and associated claims and causes of action, whether now
60
+ known or unknown (including existing as well as future claims and causes of
61
+ action), in the Work (i) in all territories worldwide, (ii) for the maximum
62
+ duration provided by applicable law or treaty (including future time
63
+ extensions), (iii) in any current or future medium and for any number of
64
+ copies, and (iv) for any purpose whatsoever, including without limitation
65
+ commercial, advertising or promotional purposes (the "Waiver"). Affirmer makes
66
+ the Waiver for the benefit of each member of the public at large and to the
67
+ detriment of Affirmer's heirs and successors, fully intending that such Waiver
68
+ shall not be subject to revocation, rescission, cancellation, termination, or
69
+ any other legal or equitable action to disrupt the quiet enjoyment of the Work
70
+ by the public as contemplated by Affirmer's express Statement of Purpose.
71
+
72
+ 3. Public License Fallback. Should any part of the Waiver for any reason be
73
+ judged legally invalid or ineffective under applicable law, then the Waiver
74
+ shall be preserved to the maximum extent permitted taking into account
75
+ Affirmer's express Statement of Purpose. In addition, to the extent the Waiver
76
+ is so judged Affirmer hereby grants to each affected person a royalty-free,
77
+ non transferable, non sublicensable, non exclusive, irrevocable and
78
+ unconditional license to exercise Affirmer's Copyright and Related Rights in
79
+ the Work (i) in all territories worldwide, (ii) for the maximum duration
80
+ provided by applicable law or treaty (including future time extensions), (iii)
81
+ in any current or future medium and for any number of copies, and (iv) for any
82
+ purpose whatsoever, including without limitation commercial, advertising or
83
+ promotional purposes (the "License"). The License shall be deemed effective as
84
+ of the date CC0 was applied by Affirmer to the Work. Should any part of the
85
+ License for any reason be judged legally invalid or ineffective under
86
+ applicable law, such partial invalidity or ineffectiveness shall not
87
+ invalidate the remainder of the License, and in such case Affirmer hereby
88
+ affirms that he or she will not (i) exercise any of his or her remaining
89
+ Copyright and Related Rights in the Work or (ii) assert any associated claims
90
+ and causes of action with respect to the Work, in either case contrary to
91
+ Affirmer's express Statement of Purpose.
92
+
93
+ 4. Limitations and Disclaimers.
94
+
95
+ a. No trademark or patent rights held by Affirmer are waived, abandoned,
96
+ surrendered, licensed or otherwise affected by this document.
97
+
98
+ b. Affirmer offers the Work as-is and makes no representations or warranties
99
+ of any kind concerning the Work, express, implied, statutory or otherwise,
100
+ including without limitation warranties of title, merchantability, fitness
101
+ for a particular purpose, non infringement, or the absence of latent or
102
+ other defects, accuracy, or the present or absence of errors, whether or not
103
+ discoverable, all to the greatest extent permissible under applicable law.
104
+
105
+ c. Affirmer disclaims responsibility for clearing rights of other persons
106
+ that may apply to the Work or any use thereof, including without limitation
107
+ any person's Copyright and Related Rights in the Work. Further, Affirmer
108
+ disclaims responsibility for obtaining any necessary consents, permissions
109
+ or other rights required for any use of the Work.
110
+
111
+ d. Affirmer understands and acknowledges that Creative Commons is not a
112
+ party to this document and has no duty or obligation with respect to this
113
+ CC0 or use of the Work.
114
+
115
+ For more information, please see
116
+ <http://creativecommons.org/publicdomain/zero/1.0/>
package/README.md ADDED
@@ -0,0 +1,45 @@
1
+ # sublimation
2
+ A very simple JavaScript monkeypatcher library that inserts your code in both ends.
3
+ > fork of [spitroast](https://github.com/Cumcord/spitroast)
4
+
5
+ # Usage
6
+ ```js
7
+ // ESM
8
+ import * as sublimation from "sublimation";
9
+
10
+ // CJS
11
+ const sublimation = require("sublimation");
12
+
13
+ const exampleObject = { testFunction: () => {} };
14
+
15
+ // Patches that run before the original function
16
+ sublimation.before("testFunction", exampleObject, (args) => { // `args` is an array of arguments passed to the original function
17
+ console.log("Before");
18
+
19
+ // You can modify `args` directly, or return an array to replace the original arguments
20
+ }, false); // Changing the second argument to true here would make the patch one-time, meaning it would unpatch after being called once
21
+
22
+ exampleObject.testFunction(); // logs "Before"
23
+
24
+ // Patches that run after the original function
25
+ sublimation.after("testFunction", exampleObject, (args, ret) => { // `ret` is the return value of the original function
26
+ console.log("After");
27
+
28
+ // You can modify `ret` directly, or return something to replace the original return value
29
+ });
30
+
31
+ // Patches that replace the original function
32
+ const unpatch = sublimation.instead("testFunction", exampleObject, (args, orig) => { // `orig` is the original function itself
33
+ console.log("Instead");
34
+ });
35
+
36
+ // Patches inherit context from the original function, just use `this` as normal
37
+
38
+ exampleObject.testFunction(); // Patches stack - This logs "Before", "Instead", "After"
39
+
40
+ // Unpatches are as simple as calling the return value of the patch function
41
+ unpatch(); // Now if you call the function it'll log just "Before" and "After"
42
+
43
+ // You can also unpatch EVERY patch, but be careful with this!
44
+ sublimation.unpatchAll();
45
+ ```
package/bun.lock ADDED
@@ -0,0 +1,303 @@
1
+ {
2
+ "lockfileVersion": 1,
3
+ "configVersion": 1,
4
+ "workspaces": {
5
+ "": {
6
+ "name": "sublimation",
7
+ "devDependencies": {
8
+ "@types/node": "^25.2.3",
9
+ "tsup": "^8.5.1",
10
+ "typescript": "^5.9.3",
11
+ },
12
+ },
13
+ },
14
+ "packages": {
15
+ "@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.27.3", "", { "os": "aix", "cpu": "ppc64" }, "sha512-9fJMTNFTWZMh5qwrBItuziu834eOCUcEqymSH7pY+zoMVEZg3gcPuBNxH1EvfVYe9h0x/Ptw8KBzv7qxb7l8dg=="],
16
+
17
+ "@esbuild/android-arm": ["@esbuild/android-arm@0.27.3", "", { "os": "android", "cpu": "arm" }, "sha512-i5D1hPY7GIQmXlXhs2w8AWHhenb00+GxjxRncS2ZM7YNVGNfaMxgzSGuO8o8SJzRc/oZwU2bcScvVERk03QhzA=="],
18
+
19
+ "@esbuild/android-arm64": ["@esbuild/android-arm64@0.27.3", "", { "os": "android", "cpu": "arm64" }, "sha512-YdghPYUmj/FX2SYKJ0OZxf+iaKgMsKHVPF1MAq/P8WirnSpCStzKJFjOjzsW0QQ7oIAiccHdcqjbHmJxRb/dmg=="],
20
+
21
+ "@esbuild/android-x64": ["@esbuild/android-x64@0.27.3", "", { "os": "android", "cpu": "x64" }, "sha512-IN/0BNTkHtk8lkOM8JWAYFg4ORxBkZQf9zXiEOfERX/CzxW3Vg1ewAhU7QSWQpVIzTW+b8Xy+lGzdYXV6UZObQ=="],
22
+
23
+ "@esbuild/darwin-arm64": ["@esbuild/darwin-arm64@0.27.3", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Re491k7ByTVRy0t3EKWajdLIr0gz2kKKfzafkth4Q8A5n1xTHrkqZgLLjFEHVD+AXdUGgQMq+Godfq45mGpCKg=="],
24
+
25
+ "@esbuild/darwin-x64": ["@esbuild/darwin-x64@0.27.3", "", { "os": "darwin", "cpu": "x64" }, "sha512-vHk/hA7/1AckjGzRqi6wbo+jaShzRowYip6rt6q7VYEDX4LEy1pZfDpdxCBnGtl+A5zq8iXDcyuxwtv3hNtHFg=="],
26
+
27
+ "@esbuild/freebsd-arm64": ["@esbuild/freebsd-arm64@0.27.3", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-ipTYM2fjt3kQAYOvo6vcxJx3nBYAzPjgTCk7QEgZG8AUO3ydUhvelmhrbOheMnGOlaSFUoHXB6un+A7q4ygY9w=="],
28
+
29
+ "@esbuild/freebsd-x64": ["@esbuild/freebsd-x64@0.27.3", "", { "os": "freebsd", "cpu": "x64" }, "sha512-dDk0X87T7mI6U3K9VjWtHOXqwAMJBNN2r7bejDsc+j03SEjtD9HrOl8gVFByeM0aJksoUuUVU9TBaZa2rgj0oA=="],
30
+
31
+ "@esbuild/linux-arm": ["@esbuild/linux-arm@0.27.3", "", { "os": "linux", "cpu": "arm" }, "sha512-s6nPv2QkSupJwLYyfS+gwdirm0ukyTFNl3KTgZEAiJDd+iHZcbTPPcWCcRYH+WlNbwChgH2QkE9NSlNrMT8Gfw=="],
32
+
33
+ "@esbuild/linux-arm64": ["@esbuild/linux-arm64@0.27.3", "", { "os": "linux", "cpu": "arm64" }, "sha512-sZOuFz/xWnZ4KH3YfFrKCf1WyPZHakVzTiqji3WDc0BCl2kBwiJLCXpzLzUBLgmp4veFZdvN5ChW4Eq/8Fc2Fg=="],
34
+
35
+ "@esbuild/linux-ia32": ["@esbuild/linux-ia32@0.27.3", "", { "os": "linux", "cpu": "ia32" }, "sha512-yGlQYjdxtLdh0a3jHjuwOrxQjOZYD/C9PfdbgJJF3TIZWnm/tMd/RcNiLngiu4iwcBAOezdnSLAwQDPqTmtTYg=="],
36
+
37
+ "@esbuild/linux-loong64": ["@esbuild/linux-loong64@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-WO60Sn8ly3gtzhyjATDgieJNet/KqsDlX5nRC5Y3oTFcS1l0KWba+SEa9Ja1GfDqSF1z6hif/SkpQJbL63cgOA=="],
38
+
39
+ "@esbuild/linux-mips64el": ["@esbuild/linux-mips64el@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-APsymYA6sGcZ4pD6k+UxbDjOFSvPWyZhjaiPyl/f79xKxwTnrn5QUnXR5prvetuaSMsb4jgeHewIDCIWljrSxw=="],
40
+
41
+ "@esbuild/linux-ppc64": ["@esbuild/linux-ppc64@0.27.3", "", { "os": "linux", "cpu": "ppc64" }, "sha512-eizBnTeBefojtDb9nSh4vvVQ3V9Qf9Df01PfawPcRzJH4gFSgrObw+LveUyDoKU3kxi5+9RJTCWlj4FjYXVPEA=="],
42
+
43
+ "@esbuild/linux-riscv64": ["@esbuild/linux-riscv64@0.27.3", "", { "os": "linux", "cpu": "none" }, "sha512-3Emwh0r5wmfm3ssTWRQSyVhbOHvqegUDRd0WhmXKX2mkHJe1SFCMJhagUleMq+Uci34wLSipf8Lagt4LlpRFWQ=="],
44
+
45
+ "@esbuild/linux-s390x": ["@esbuild/linux-s390x@0.27.3", "", { "os": "linux", "cpu": "s390x" }, "sha512-pBHUx9LzXWBc7MFIEEL0yD/ZVtNgLytvx60gES28GcWMqil8ElCYR4kvbV2BDqsHOvVDRrOxGySBM9Fcv744hw=="],
46
+
47
+ "@esbuild/linux-x64": ["@esbuild/linux-x64@0.27.3", "", { "os": "linux", "cpu": "x64" }, "sha512-Czi8yzXUWIQYAtL/2y6vogER8pvcsOsk5cpwL4Gk5nJqH5UZiVByIY8Eorm5R13gq+DQKYg0+JyQoytLQas4dA=="],
48
+
49
+ "@esbuild/netbsd-arm64": ["@esbuild/netbsd-arm64@0.27.3", "", { "os": "none", "cpu": "arm64" }, "sha512-sDpk0RgmTCR/5HguIZa9n9u+HVKf40fbEUt+iTzSnCaGvY9kFP0YKBWZtJaraonFnqef5SlJ8/TiPAxzyS+UoA=="],
50
+
51
+ "@esbuild/netbsd-x64": ["@esbuild/netbsd-x64@0.27.3", "", { "os": "none", "cpu": "x64" }, "sha512-P14lFKJl/DdaE00LItAukUdZO5iqNH7+PjoBm+fLQjtxfcfFE20Xf5CrLsmZdq5LFFZzb5JMZ9grUwvtVYzjiA=="],
52
+
53
+ "@esbuild/openbsd-arm64": ["@esbuild/openbsd-arm64@0.27.3", "", { "os": "openbsd", "cpu": "arm64" }, "sha512-AIcMP77AvirGbRl/UZFTq5hjXK+2wC7qFRGoHSDrZ5v5b8DK/GYpXW3CPRL53NkvDqb9D+alBiC/dV0Fb7eJcw=="],
54
+
55
+ "@esbuild/openbsd-x64": ["@esbuild/openbsd-x64@0.27.3", "", { "os": "openbsd", "cpu": "x64" }, "sha512-DnW2sRrBzA+YnE70LKqnM3P+z8vehfJWHXECbwBmH/CU51z6FiqTQTHFenPlHmo3a8UgpLyH3PT+87OViOh1AQ=="],
56
+
57
+ "@esbuild/openharmony-arm64": ["@esbuild/openharmony-arm64@0.27.3", "", { "os": "none", "cpu": "arm64" }, "sha512-NinAEgr/etERPTsZJ7aEZQvvg/A6IsZG/LgZy+81wON2huV7SrK3e63dU0XhyZP4RKGyTm7aOgmQk0bGp0fy2g=="],
58
+
59
+ "@esbuild/sunos-x64": ["@esbuild/sunos-x64@0.27.3", "", { "os": "sunos", "cpu": "x64" }, "sha512-PanZ+nEz+eWoBJ8/f8HKxTTD172SKwdXebZ0ndd953gt1HRBbhMsaNqjTyYLGLPdoWHy4zLU7bDVJztF5f3BHA=="],
60
+
61
+ "@esbuild/win32-arm64": ["@esbuild/win32-arm64@0.27.3", "", { "os": "win32", "cpu": "arm64" }, "sha512-B2t59lWWYrbRDw/tjiWOuzSsFh1Y/E95ofKz7rIVYSQkUYBjfSgf6oeYPNWHToFRr2zx52JKApIcAS/D5TUBnA=="],
62
+
63
+ "@esbuild/win32-ia32": ["@esbuild/win32-ia32@0.27.3", "", { "os": "win32", "cpu": "ia32" }, "sha512-QLKSFeXNS8+tHW7tZpMtjlNb7HKau0QDpwm49u0vUp9y1WOF+PEzkU84y9GqYaAVW8aH8f3GcBck26jh54cX4Q=="],
64
+
65
+ "@esbuild/win32-x64": ["@esbuild/win32-x64@0.27.3", "", { "os": "win32", "cpu": "x64" }, "sha512-4uJGhsxuptu3OcpVAzli+/gWusVGwZZHTlS63hh++ehExkVT8SgiEf7/uC/PclrPPkLhZqGgCTjd0VWLo6xMqA=="],
66
+
67
+ "@isaacs/cliui": ["@isaacs/cliui@8.0.2", "", { "dependencies": { "string-width": "5.1.2", "string-width-cjs": "npm:string-width@4.2.3", "strip-ansi": "7.1.0", "strip-ansi-cjs": "npm:strip-ansi@6.0.1", "wrap-ansi": "8.1.0", "wrap-ansi-cjs": "npm:wrap-ansi@7.0.0" } }, "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA=="],
68
+
69
+ "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.5", "", { "dependencies": { "@jridgewell/set-array": "1.2.1", "@jridgewell/sourcemap-codec": "1.5.0", "@jridgewell/trace-mapping": "0.3.25" } }, "sha512-IzL8ZoEDIBRWEzlCcRhOaCupYyN5gdIK+Q6fbFdPDg6HqX6jpkItn7DFIpW9LQzXG6Df9sA7+OKnq0qlz/GaQg=="],
70
+
71
+ "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="],
72
+
73
+ "@jridgewell/set-array": ["@jridgewell/set-array@1.2.1", "", {}, "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A=="],
74
+
75
+ "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.5", "", {}, "sha512-cYQ9310grqxueWbl+WuIUIaiUaDcj7WOq5fVhEljNVgRfOUhY9fy2zTvfoqWsnebh8Sl70VScFbICvJnLKB0Og=="],
76
+
77
+ "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "3.1.2", "@jridgewell/sourcemap-codec": "1.5.0" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="],
78
+
79
+ "@pkgjs/parseargs": ["@pkgjs/parseargs@0.11.0", "", {}, "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg=="],
80
+
81
+ "@rollup/rollup-android-arm-eabi": ["@rollup/rollup-android-arm-eabi@4.57.1", "", { "os": "android", "cpu": "arm" }, "sha512-A6ehUVSiSaaliTxai040ZpZ2zTevHYbvu/lDoeAteHI8QnaosIzm4qwtezfRg1jOYaUmnzLX1AOD6Z+UJjtifg=="],
82
+
83
+ "@rollup/rollup-android-arm64": ["@rollup/rollup-android-arm64@4.57.1", "", { "os": "android", "cpu": "arm64" }, "sha512-dQaAddCY9YgkFHZcFNS/606Exo8vcLHwArFZ7vxXq4rigo2bb494/xKMMwRRQW6ug7Js6yXmBZhSBRuBvCCQ3w=="],
84
+
85
+ "@rollup/rollup-darwin-arm64": ["@rollup/rollup-darwin-arm64@4.57.1", "", { "os": "darwin", "cpu": "arm64" }, "sha512-crNPrwJOrRxagUYeMn/DZwqN88SDmwaJ8Cvi/TN1HnWBU7GwknckyosC2gd0IqYRsHDEnXf328o9/HC6OkPgOg=="],
86
+
87
+ "@rollup/rollup-darwin-x64": ["@rollup/rollup-darwin-x64@4.57.1", "", { "os": "darwin", "cpu": "x64" }, "sha512-Ji8g8ChVbKrhFtig5QBV7iMaJrGtpHelkB3lsaKzadFBe58gmjfGXAOfI5FV0lYMH8wiqsxKQ1C9B0YTRXVy4w=="],
88
+
89
+ "@rollup/rollup-freebsd-arm64": ["@rollup/rollup-freebsd-arm64@4.57.1", "", { "os": "freebsd", "cpu": "arm64" }, "sha512-R+/WwhsjmwodAcz65guCGFRkMb4gKWTcIeLy60JJQbXrJ97BOXHxnkPFrP+YwFlaS0m+uWJTstrUA9o+UchFug=="],
90
+
91
+ "@rollup/rollup-freebsd-x64": ["@rollup/rollup-freebsd-x64@4.57.1", "", { "os": "freebsd", "cpu": "x64" }, "sha512-IEQTCHeiTOnAUC3IDQdzRAGj3jOAYNr9kBguI7MQAAZK3caezRrg0GxAb6Hchg4lxdZEI5Oq3iov/w/hnFWY9Q=="],
92
+
93
+ "@rollup/rollup-linux-arm-gnueabihf": ["@rollup/rollup-linux-arm-gnueabihf@4.57.1", "", { "os": "linux", "cpu": "arm" }, "sha512-F8sWbhZ7tyuEfsmOxwc2giKDQzN3+kuBLPwwZGyVkLlKGdV1nvnNwYD0fKQ8+XS6hp9nY7B+ZeK01EBUE7aHaw=="],
94
+
95
+ "@rollup/rollup-linux-arm-musleabihf": ["@rollup/rollup-linux-arm-musleabihf@4.57.1", "", { "os": "linux", "cpu": "arm" }, "sha512-rGfNUfn0GIeXtBP1wL5MnzSj98+PZe/AXaGBCRmT0ts80lU5CATYGxXukeTX39XBKsxzFpEeK+Mrp9faXOlmrw=="],
96
+
97
+ "@rollup/rollup-linux-arm64-gnu": ["@rollup/rollup-linux-arm64-gnu@4.57.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-MMtej3YHWeg/0klK2Qodf3yrNzz6CGjo2UntLvk2RSPlhzgLvYEB3frRvbEF2wRKh1Z2fDIg9KRPe1fawv7C+g=="],
98
+
99
+ "@rollup/rollup-linux-arm64-musl": ["@rollup/rollup-linux-arm64-musl@4.57.1", "", { "os": "linux", "cpu": "arm64" }, "sha512-1a/qhaaOXhqXGpMFMET9VqwZakkljWHLmZOX48R0I/YLbhdxr1m4gtG1Hq7++VhVUmf+L3sTAf9op4JlhQ5u1Q=="],
100
+
101
+ "@rollup/rollup-linux-loong64-gnu": ["@rollup/rollup-linux-loong64-gnu@4.57.1", "", { "os": "linux", "cpu": "none" }, "sha512-QWO6RQTZ/cqYtJMtxhkRkidoNGXc7ERPbZN7dVW5SdURuLeVU7lwKMpo18XdcmpWYd0qsP1bwKPf7DNSUinhvA=="],
102
+
103
+ "@rollup/rollup-linux-loong64-musl": ["@rollup/rollup-linux-loong64-musl@4.57.1", "", { "os": "linux", "cpu": "none" }, "sha512-xpObYIf+8gprgWaPP32xiN5RVTi/s5FCR+XMXSKmhfoJjrpRAjCuuqQXyxUa/eJTdAE6eJ+KDKaoEqjZQxh3Gw=="],
104
+
105
+ "@rollup/rollup-linux-ppc64-gnu": ["@rollup/rollup-linux-ppc64-gnu@4.57.1", "", { "os": "linux", "cpu": "ppc64" }, "sha512-4BrCgrpZo4hvzMDKRqEaW1zeecScDCR+2nZ86ATLhAoJ5FQ+lbHVD3ttKe74/c7tNT9c6F2viwB3ufwp01Oh2w=="],
106
+
107
+ "@rollup/rollup-linux-ppc64-musl": ["@rollup/rollup-linux-ppc64-musl@4.57.1", "", { "os": "linux", "cpu": "ppc64" }, "sha512-NOlUuzesGauESAyEYFSe3QTUguL+lvrN1HtwEEsU2rOwdUDeTMJdO5dUYl/2hKf9jWydJrO9OL/XSSf65R5+Xw=="],
108
+
109
+ "@rollup/rollup-linux-riscv64-gnu": ["@rollup/rollup-linux-riscv64-gnu@4.57.1", "", { "os": "linux", "cpu": "none" }, "sha512-ptA88htVp0AwUUqhVghwDIKlvJMD/fmL/wrQj99PRHFRAG6Z5nbWoWG4o81Nt9FT+IuqUQi+L31ZKAFeJ5Is+A=="],
110
+
111
+ "@rollup/rollup-linux-riscv64-musl": ["@rollup/rollup-linux-riscv64-musl@4.57.1", "", { "os": "linux", "cpu": "none" }, "sha512-S51t7aMMTNdmAMPpBg7OOsTdn4tySRQvklmL3RpDRyknk87+Sp3xaumlatU+ppQ+5raY7sSTcC2beGgvhENfuw=="],
112
+
113
+ "@rollup/rollup-linux-s390x-gnu": ["@rollup/rollup-linux-s390x-gnu@4.57.1", "", { "os": "linux", "cpu": "s390x" }, "sha512-Bl00OFnVFkL82FHbEqy3k5CUCKH6OEJL54KCyx2oqsmZnFTR8IoNqBF+mjQVcRCT5sB6yOvK8A37LNm/kPJiZg=="],
114
+
115
+ "@rollup/rollup-linux-x64-gnu": ["@rollup/rollup-linux-x64-gnu@4.57.1", "", { "os": "linux", "cpu": "x64" }, "sha512-ABca4ceT4N+Tv/GtotnWAeXZUZuM/9AQyCyKYyKnpk4yoA7QIAuBt6Hkgpw8kActYlew2mvckXkvx0FfoInnLg=="],
116
+
117
+ "@rollup/rollup-linux-x64-musl": ["@rollup/rollup-linux-x64-musl@4.57.1", "", { "os": "linux", "cpu": "x64" }, "sha512-HFps0JeGtuOR2convgRRkHCekD7j+gdAuXM+/i6kGzQtFhlCtQkpwtNzkNj6QhCDp7DRJ7+qC/1Vg2jt5iSOFw=="],
118
+
119
+ "@rollup/rollup-openbsd-x64": ["@rollup/rollup-openbsd-x64@4.57.1", "", { "os": "openbsd", "cpu": "x64" }, "sha512-H+hXEv9gdVQuDTgnqD+SQffoWoc0Of59AStSzTEj/feWTBAnSfSD3+Dql1ZruJQxmykT/JVY0dE8Ka7z0DH1hw=="],
120
+
121
+ "@rollup/rollup-openharmony-arm64": ["@rollup/rollup-openharmony-arm64@4.57.1", "", { "os": "none", "cpu": "arm64" }, "sha512-4wYoDpNg6o/oPximyc/NG+mYUejZrCU2q+2w6YZqrAs2UcNUChIZXjtafAiiZSUc7On8v5NyNj34Kzj/Ltk6dQ=="],
122
+
123
+ "@rollup/rollup-win32-arm64-msvc": ["@rollup/rollup-win32-arm64-msvc@4.57.1", "", { "os": "win32", "cpu": "arm64" }, "sha512-O54mtsV/6LW3P8qdTcamQmuC990HDfR71lo44oZMZlXU4tzLrbvTii87Ni9opq60ds0YzuAlEr/GNwuNluZyMQ=="],
124
+
125
+ "@rollup/rollup-win32-ia32-msvc": ["@rollup/rollup-win32-ia32-msvc@4.57.1", "", { "os": "win32", "cpu": "ia32" }, "sha512-P3dLS+IerxCT/7D2q2FYcRdWRl22dNbrbBEtxdWhXrfIMPP9lQhb5h4Du04mdl5Woq05jVCDPCMF7Ub0NAjIew=="],
126
+
127
+ "@rollup/rollup-win32-x64-gnu": ["@rollup/rollup-win32-x64-gnu@4.57.1", "", { "os": "win32", "cpu": "x64" }, "sha512-VMBH2eOOaKGtIJYleXsi2B8CPVADrh+TyNxJ4mWPnKfLB/DBUmzW+5m1xUrcwWoMfSLagIRpjUFeW5CO5hyciQ=="],
128
+
129
+ "@rollup/rollup-win32-x64-msvc": ["@rollup/rollup-win32-x64-msvc@4.57.1", "", { "os": "win32", "cpu": "x64" }, "sha512-mxRFDdHIWRxg3UfIIAwCm6NzvxG0jDX/wBN6KsQFTvKFqqg9vTrWUE68qEjHt19A5wwx5X5aUi2zuZT7YR0jrA=="],
130
+
131
+ "@types/estree": ["@types/estree@1.0.8", "", {}, "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w=="],
132
+
133
+ "@types/node": ["@types/node@25.2.3", "", { "dependencies": { "undici-types": "~7.16.0" } }, "sha512-m0jEgYlYz+mDJZ2+F4v8D1AyQb+QzsNqRuI7xg1VQX/KlKS0qT9r1Mo16yo5F/MtifXFgaofIFsdFMox2SxIbQ=="],
134
+
135
+ "acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="],
136
+
137
+ "ansi-regex": ["ansi-regex@6.0.1", "", {}, "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA=="],
138
+
139
+ "ansi-styles": ["ansi-styles@6.2.1", "", {}, "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug=="],
140
+
141
+ "any-promise": ["any-promise@1.3.0", "", {}, "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A=="],
142
+
143
+ "balanced-match": ["balanced-match@1.0.2", "", {}, "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="],
144
+
145
+ "brace-expansion": ["brace-expansion@2.0.1", "", { "dependencies": { "balanced-match": "1.0.2" } }, "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA=="],
146
+
147
+ "bundle-require": ["bundle-require@5.1.0", "", { "dependencies": { "load-tsconfig": "^0.2.3" }, "peerDependencies": { "esbuild": ">=0.18" } }, "sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA=="],
148
+
149
+ "cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="],
150
+
151
+ "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="],
152
+
153
+ "color-convert": ["color-convert@2.0.1", "", { "dependencies": { "color-name": "1.1.4" } }, "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ=="],
154
+
155
+ "color-name": ["color-name@1.1.4", "", {}, "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="],
156
+
157
+ "commander": ["commander@4.1.1", "", {}, "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="],
158
+
159
+ "confbox": ["confbox@0.1.8", "", {}, "sha512-RMtmw0iFkeR4YV+fUOSucriAQNb9g8zFR52MWCtl+cCZOFRNL6zeB395vPzFhEjjn4fMxXudmELnl/KF/WrK6w=="],
160
+
161
+ "consola": ["consola@3.4.2", "", {}, "sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA=="],
162
+
163
+ "cross-spawn": ["cross-spawn@7.0.3", "", { "dependencies": { "path-key": "3.1.1", "shebang-command": "2.0.0", "which": "2.0.2" } }, "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w=="],
164
+
165
+ "debug": ["debug@4.4.3", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA=="],
166
+
167
+ "eastasianwidth": ["eastasianwidth@0.2.0", "", {}, "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA=="],
168
+
169
+ "emoji-regex": ["emoji-regex@9.2.2", "", {}, "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg=="],
170
+
171
+ "esbuild": ["esbuild@0.27.3", "", { "optionalDependencies": { "@esbuild/aix-ppc64": "0.27.3", "@esbuild/android-arm": "0.27.3", "@esbuild/android-arm64": "0.27.3", "@esbuild/android-x64": "0.27.3", "@esbuild/darwin-arm64": "0.27.3", "@esbuild/darwin-x64": "0.27.3", "@esbuild/freebsd-arm64": "0.27.3", "@esbuild/freebsd-x64": "0.27.3", "@esbuild/linux-arm": "0.27.3", "@esbuild/linux-arm64": "0.27.3", "@esbuild/linux-ia32": "0.27.3", "@esbuild/linux-loong64": "0.27.3", "@esbuild/linux-mips64el": "0.27.3", "@esbuild/linux-ppc64": "0.27.3", "@esbuild/linux-riscv64": "0.27.3", "@esbuild/linux-s390x": "0.27.3", "@esbuild/linux-x64": "0.27.3", "@esbuild/netbsd-arm64": "0.27.3", "@esbuild/netbsd-x64": "0.27.3", "@esbuild/openbsd-arm64": "0.27.3", "@esbuild/openbsd-x64": "0.27.3", "@esbuild/openharmony-arm64": "0.27.3", "@esbuild/sunos-x64": "0.27.3", "@esbuild/win32-arm64": "0.27.3", "@esbuild/win32-ia32": "0.27.3", "@esbuild/win32-x64": "0.27.3" }, "bin": { "esbuild": "bin/esbuild" } }, "sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg=="],
172
+
173
+ "fdir": ["fdir@6.5.0", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg=="],
174
+
175
+ "fix-dts-default-cjs-exports": ["fix-dts-default-cjs-exports@1.0.1", "", { "dependencies": { "magic-string": "^0.30.17", "mlly": "^1.7.4", "rollup": "^4.34.8" } }, "sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg=="],
176
+
177
+ "foreground-child": ["foreground-child@3.3.0", "", { "dependencies": { "cross-spawn": "7.0.3", "signal-exit": "4.1.0" } }, "sha512-Ld2g8rrAyMYFXBhEqMz8ZAHBi4J4uS1i/CxGMDnjyFWddMXLVcDp051DZfu+t7+ab7Wv6SMqpWmyFIj5UbfFvg=="],
178
+
179
+ "fsevents": ["fsevents@2.3.3", "", { "os": "darwin" }, "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw=="],
180
+
181
+ "glob": ["glob@10.4.5", "", { "dependencies": { "foreground-child": "3.3.0", "jackspeak": "3.4.3", "minimatch": "9.0.5", "minipass": "7.1.2", "package-json-from-dist": "1.0.0", "path-scurry": "1.11.1" }, "bin": { "glob": "dist/esm/bin.mjs" } }, "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg=="],
182
+
183
+ "is-fullwidth-code-point": ["is-fullwidth-code-point@3.0.0", "", {}, "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="],
184
+
185
+ "isexe": ["isexe@2.0.0", "", {}, "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw=="],
186
+
187
+ "jackspeak": ["jackspeak@3.4.3", "", { "dependencies": { "@isaacs/cliui": "8.0.2" }, "optionalDependencies": { "@pkgjs/parseargs": "0.11.0" } }, "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw=="],
188
+
189
+ "joycon": ["joycon@3.1.1", "", {}, "sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw=="],
190
+
191
+ "lilconfig": ["lilconfig@3.1.2", "", {}, "sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow=="],
192
+
193
+ "lines-and-columns": ["lines-and-columns@1.2.4", "", {}, "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg=="],
194
+
195
+ "load-tsconfig": ["load-tsconfig@0.2.5", "", {}, "sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg=="],
196
+
197
+ "lru-cache": ["lru-cache@10.4.3", "", {}, "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ=="],
198
+
199
+ "magic-string": ["magic-string@0.30.21", "", { "dependencies": { "@jridgewell/sourcemap-codec": "^1.5.5" } }, "sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ=="],
200
+
201
+ "minimatch": ["minimatch@9.0.5", "", { "dependencies": { "brace-expansion": "2.0.1" } }, "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow=="],
202
+
203
+ "minipass": ["minipass@7.1.2", "", {}, "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw=="],
204
+
205
+ "mlly": ["mlly@1.8.0", "", { "dependencies": { "acorn": "^8.15.0", "pathe": "^2.0.3", "pkg-types": "^1.3.1", "ufo": "^1.6.1" } }, "sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g=="],
206
+
207
+ "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="],
208
+
209
+ "mz": ["mz@2.7.0", "", { "dependencies": { "any-promise": "1.3.0", "object-assign": "4.1.1", "thenify-all": "1.6.0" } }, "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q=="],
210
+
211
+ "object-assign": ["object-assign@4.1.1", "", {}, "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg=="],
212
+
213
+ "package-json-from-dist": ["package-json-from-dist@1.0.0", "", {}, "sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw=="],
214
+
215
+ "path-key": ["path-key@3.1.1", "", {}, "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q=="],
216
+
217
+ "path-scurry": ["path-scurry@1.11.1", "", { "dependencies": { "lru-cache": "10.4.3", "minipass": "7.1.2" } }, "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA=="],
218
+
219
+ "pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="],
220
+
221
+ "picocolors": ["picocolors@1.1.1", "", {}, "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA=="],
222
+
223
+ "picomatch": ["picomatch@4.0.3", "", {}, "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q=="],
224
+
225
+ "pirates": ["pirates@4.0.6", "", {}, "sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg=="],
226
+
227
+ "pkg-types": ["pkg-types@1.3.1", "", { "dependencies": { "confbox": "^0.1.8", "mlly": "^1.7.4", "pathe": "^2.0.1" } }, "sha512-/Jm5M4RvtBFVkKWRu2BLUTNP8/M2a+UwuAX+ae4770q1qVGtfjG+WTCupoZixokjmHiry8uI+dlY8KXYV5HVVQ=="],
228
+
229
+ "postcss-load-config": ["postcss-load-config@6.0.1", "", { "dependencies": { "lilconfig": "3.1.2" } }, "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g=="],
230
+
231
+ "readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="],
232
+
233
+ "resolve-from": ["resolve-from@5.0.0", "", {}, "sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw=="],
234
+
235
+ "rollup": ["rollup@4.57.1", "", { "dependencies": { "@types/estree": "1.0.8" }, "optionalDependencies": { "@rollup/rollup-android-arm-eabi": "4.57.1", "@rollup/rollup-android-arm64": "4.57.1", "@rollup/rollup-darwin-arm64": "4.57.1", "@rollup/rollup-darwin-x64": "4.57.1", "@rollup/rollup-freebsd-arm64": "4.57.1", "@rollup/rollup-freebsd-x64": "4.57.1", "@rollup/rollup-linux-arm-gnueabihf": "4.57.1", "@rollup/rollup-linux-arm-musleabihf": "4.57.1", "@rollup/rollup-linux-arm64-gnu": "4.57.1", "@rollup/rollup-linux-arm64-musl": "4.57.1", "@rollup/rollup-linux-loong64-gnu": "4.57.1", "@rollup/rollup-linux-loong64-musl": "4.57.1", "@rollup/rollup-linux-ppc64-gnu": "4.57.1", "@rollup/rollup-linux-ppc64-musl": "4.57.1", "@rollup/rollup-linux-riscv64-gnu": "4.57.1", "@rollup/rollup-linux-riscv64-musl": "4.57.1", "@rollup/rollup-linux-s390x-gnu": "4.57.1", "@rollup/rollup-linux-x64-gnu": "4.57.1", "@rollup/rollup-linux-x64-musl": "4.57.1", "@rollup/rollup-openbsd-x64": "4.57.1", "@rollup/rollup-openharmony-arm64": "4.57.1", "@rollup/rollup-win32-arm64-msvc": "4.57.1", "@rollup/rollup-win32-ia32-msvc": "4.57.1", "@rollup/rollup-win32-x64-gnu": "4.57.1", "@rollup/rollup-win32-x64-msvc": "4.57.1", "fsevents": "~2.3.2" }, "bin": { "rollup": "dist/bin/rollup" } }, "sha512-oQL6lgK3e2QZeQ7gcgIkS2YZPg5slw37hYufJ3edKlfQSGGm8ICoxswK15ntSzF/a8+h7ekRy7k7oWc3BQ7y8A=="],
236
+
237
+ "shebang-command": ["shebang-command@2.0.0", "", { "dependencies": { "shebang-regex": "3.0.0" } }, "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA=="],
238
+
239
+ "shebang-regex": ["shebang-regex@3.0.0", "", {}, "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A=="],
240
+
241
+ "signal-exit": ["signal-exit@4.1.0", "", {}, "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw=="],
242
+
243
+ "source-map": ["source-map@0.7.6", "", {}, "sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ=="],
244
+
245
+ "string-width": ["string-width@5.1.2", "", { "dependencies": { "eastasianwidth": "0.2.0", "emoji-regex": "9.2.2", "strip-ansi": "7.1.0" } }, "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA=="],
246
+
247
+ "string-width-cjs": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "8.0.0", "is-fullwidth-code-point": "3.0.0", "strip-ansi": "6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
248
+
249
+ "strip-ansi": ["strip-ansi@7.1.0", "", { "dependencies": { "ansi-regex": "6.0.1" } }, "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ=="],
250
+
251
+ "strip-ansi-cjs": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
252
+
253
+ "sucrase": ["sucrase@3.35.0", "", { "dependencies": { "@jridgewell/gen-mapping": "0.3.5", "commander": "4.1.1", "glob": "10.4.5", "lines-and-columns": "1.2.4", "mz": "2.7.0", "pirates": "4.0.6", "ts-interface-checker": "0.1.13" }, "bin": { "sucrase": "bin/sucrase", "sucrase-node": "bin/sucrase-node" } }, "sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA=="],
254
+
255
+ "thenify": ["thenify@3.3.1", "", { "dependencies": { "any-promise": "1.3.0" } }, "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw=="],
256
+
257
+ "thenify-all": ["thenify-all@1.6.0", "", { "dependencies": { "thenify": "3.3.1" } }, "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA=="],
258
+
259
+ "tinyexec": ["tinyexec@0.3.2", "", {}, "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA=="],
260
+
261
+ "tinyglobby": ["tinyglobby@0.2.15", "", { "dependencies": { "fdir": "^6.5.0", "picomatch": "^4.0.3" } }, "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ=="],
262
+
263
+ "tree-kill": ["tree-kill@1.2.2", "", { "bin": { "tree-kill": "cli.js" } }, "sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A=="],
264
+
265
+ "ts-interface-checker": ["ts-interface-checker@0.1.13", "", {}, "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA=="],
266
+
267
+ "tsup": ["tsup@8.5.1", "", { "dependencies": { "bundle-require": "^5.1.0", "cac": "^6.7.14", "chokidar": "^4.0.3", "consola": "^3.4.0", "debug": "^4.4.0", "esbuild": "^0.27.0", "fix-dts-default-cjs-exports": "^1.0.0", "joycon": "^3.1.1", "picocolors": "^1.1.1", "postcss-load-config": "^6.0.1", "resolve-from": "^5.0.0", "rollup": "^4.34.8", "source-map": "^0.7.6", "sucrase": "^3.35.0", "tinyexec": "^0.3.2", "tinyglobby": "^0.2.11", "tree-kill": "^1.2.2" }, "peerDependencies": { "@microsoft/api-extractor": "^7.36.0", "@swc/core": "^1", "postcss": "^8.4.12", "typescript": ">=4.5.0" }, "optionalPeers": ["@microsoft/api-extractor", "@swc/core", "postcss", "typescript"], "bin": { "tsup": "dist/cli-default.js", "tsup-node": "dist/cli-node.js" } }, "sha512-xtgkqwdhpKWr3tKPmCkvYmS9xnQK3m3XgxZHwSUjvfTjp7YfXe5tT3GgWi0F2N+ZSMsOeWeZFh7ZZFg5iPhing=="],
268
+
269
+ "typescript": ["typescript@5.9.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw=="],
270
+
271
+ "ufo": ["ufo@1.6.3", "", {}, "sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q=="],
272
+
273
+ "undici-types": ["undici-types@7.16.0", "", {}, "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw=="],
274
+
275
+ "which": ["which@2.0.2", "", { "dependencies": { "isexe": "2.0.0" }, "bin": { "node-which": "./bin/node-which" } }, "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA=="],
276
+
277
+ "wrap-ansi": ["wrap-ansi@8.1.0", "", { "dependencies": { "ansi-styles": "6.2.1", "string-width": "5.1.2", "strip-ansi": "7.1.0" } }, "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ=="],
278
+
279
+ "wrap-ansi-cjs": ["wrap-ansi@7.0.0", "", { "dependencies": { "ansi-styles": "4.3.0", "string-width": "4.2.3", "strip-ansi": "6.0.1" } }, "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q=="],
280
+
281
+ "@jridgewell/gen-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="],
282
+
283
+ "@jridgewell/trace-mapping/@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="],
284
+
285
+ "string-width-cjs/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
286
+
287
+ "string-width-cjs/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
288
+
289
+ "strip-ansi-cjs/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
290
+
291
+ "wrap-ansi-cjs/ansi-styles": ["ansi-styles@4.3.0", "", { "dependencies": { "color-convert": "2.0.1" } }, "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg=="],
292
+
293
+ "wrap-ansi-cjs/string-width": ["string-width@4.2.3", "", { "dependencies": { "emoji-regex": "8.0.0", "is-fullwidth-code-point": "3.0.0", "strip-ansi": "6.0.1" } }, "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g=="],
294
+
295
+ "wrap-ansi-cjs/strip-ansi": ["strip-ansi@6.0.1", "", { "dependencies": { "ansi-regex": "5.0.1" } }, "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A=="],
296
+
297
+ "string-width-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
298
+
299
+ "wrap-ansi-cjs/string-width/emoji-regex": ["emoji-regex@8.0.0", "", {}, "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="],
300
+
301
+ "wrap-ansi-cjs/strip-ansi/ansi-regex": ["ansi-regex@5.0.1", "", {}, "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ=="],
302
+ }
303
+ }
@@ -0,0 +1,16 @@
1
+ type Patch = {
2
+ n: PropertyKey;
3
+ o: Function;
4
+ p: any;
5
+ c: Function[];
6
+ a: Map<symbol, Function>;
7
+ b: Map<symbol, Function>;
8
+ i: Map<symbol, Function>;
9
+ };
10
+ declare let resetPatches: () => WeakMap<Function, Patch>;
11
+
12
+ declare const before: <N extends keyof P, P extends Record<PropertyKey, any>>(funcName: N, funcParent: P, callback: (args: Parameters<P[N]>) => void | Parameters<P[N]>, oneTime?: boolean) => () => boolean;
13
+ declare const instead: <N extends keyof P, P extends Record<PropertyKey, any>>(funcName: N, funcParent: P, callback: (args: Parameters<P[N]>, origFunc: NonNullable<P[N]>) => ReturnType<P[N]>, oneTime?: boolean) => () => boolean;
14
+ declare const after: <N extends keyof P, P extends Record<PropertyKey, any>>(funcName: N, funcParent: P, callback: (args: Parameters<P[N]>, ret: ReturnType<P[N]>) => void | ReturnType<P[N]>, oneTime?: boolean) => () => boolean;
15
+
16
+ export { after, before, instead, resetPatches as unpatchAll };
@@ -0,0 +1,16 @@
1
+ type Patch = {
2
+ n: PropertyKey;
3
+ o: Function;
4
+ p: any;
5
+ c: Function[];
6
+ a: Map<symbol, Function>;
7
+ b: Map<symbol, Function>;
8
+ i: Map<symbol, Function>;
9
+ };
10
+ declare let resetPatches: () => WeakMap<Function, Patch>;
11
+
12
+ declare const before: <N extends keyof P, P extends Record<PropertyKey, any>>(funcName: N, funcParent: P, callback: (args: Parameters<P[N]>) => void | Parameters<P[N]>, oneTime?: boolean) => () => boolean;
13
+ declare const instead: <N extends keyof P, P extends Record<PropertyKey, any>>(funcName: N, funcParent: P, callback: (args: Parameters<P[N]>, origFunc: NonNullable<P[N]>) => ReturnType<P[N]>, oneTime?: boolean) => () => boolean;
14
+ declare const after: <N extends keyof P, P extends Record<PropertyKey, any>>(funcName: N, funcParent: P, callback: (args: Parameters<P[N]>, ret: ReturnType<P[N]>) => void | ReturnType<P[N]>, oneTime?: boolean) => () => boolean;
15
+
16
+ export { after, before, instead, resetPatches as unpatchAll };
package/dist/index.js ADDED
@@ -0,0 +1,126 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+
19
+ // src/index.ts
20
+ var index_exports = {};
21
+ __export(index_exports, {
22
+ after: () => after,
23
+ before: () => before,
24
+ instead: () => instead,
25
+ unpatchAll: () => resetPatches
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+
29
+ // src/shared.ts
30
+ var patchTypes = ["a", "b", "i"];
31
+ var patchedFunctions;
32
+ var resetPatches = () => patchedFunctions = /* @__PURE__ */ new WeakMap();
33
+ resetPatches();
34
+
35
+ // src/hook.ts
36
+ function hook_default(patchedFunc, origFunc, funcArgs, ctxt) {
37
+ const patch = patchedFunctions.get(patchedFunc);
38
+ if (!patch) return origFunc(...funcArgs);
39
+ for (const hook of patch.b.values()) {
40
+ const maybefuncArgs = hook.call(ctxt, funcArgs);
41
+ if (Array.isArray(maybefuncArgs)) funcArgs = maybefuncArgs;
42
+ }
43
+ let workingRetVal = [...patch.i.values()].reduce(
44
+ (prev, current) => (...args) => current.call(ctxt, args, prev),
45
+ origFunc
46
+ )(...funcArgs);
47
+ for (const hook of patch.a.values())
48
+ workingRetVal = hook.call(ctxt, funcArgs, workingRetVal) ?? workingRetVal;
49
+ for (const cleanup of patch.c) cleanup();
50
+ patch.c = [];
51
+ return workingRetVal;
52
+ }
53
+
54
+ // src/unpatch.ts
55
+ function unpatch(patch, hookId, type) {
56
+ if (!patch || !patch[type].delete(hookId)) return false;
57
+ const funcParent = patch.p;
58
+ if (funcParent && patchTypes.every((t) => patch[t].size === 0)) {
59
+ const funcName = patch.n;
60
+ patchedFunctions.delete(funcParent[funcName]);
61
+ if (!Reflect.defineProperty(funcParent, funcName, {
62
+ value: patch.o,
63
+ writable: true,
64
+ configurable: true
65
+ }))
66
+ funcParent[funcName] = patch.o;
67
+ }
68
+ return true;
69
+ }
70
+
71
+ // src/getPatchFunc.ts
72
+ var getPatchFunc_default = (patchType) => (funcName, funcParent, callback, oneTime = false) => {
73
+ let origFunc = funcParent[funcName];
74
+ if (typeof origFunc !== "function")
75
+ throw new Error(
76
+ `${String(funcName)} is not a function in ${funcParent.constructor.name}`
77
+ );
78
+ let funcPatch = patchedFunctions.get(origFunc);
79
+ if (!funcPatch) {
80
+ funcPatch = {
81
+ n: funcName,
82
+ o: origFunc,
83
+ p: funcParent,
84
+ c: [],
85
+ b: /* @__PURE__ */ new Map(),
86
+ i: /* @__PURE__ */ new Map(),
87
+ a: /* @__PURE__ */ new Map()
88
+ };
89
+ const replaceProxy = new Proxy(origFunc, {
90
+ apply: (_, ctxt, args) => runHook(ctxt, args, false),
91
+ construct: (_, args) => runHook(origFunc, args, true),
92
+ // @ts-expect-error this is manual minification. if you don't like it, kick rocks.
93
+ get: (target, prop, receiver, resolvedProp) => (resolvedProp = Reflect.get(target, prop, receiver), (typeof resolvedProp)[0] == "f") ? resolvedProp.bind(origFunc) : resolvedProp
94
+ });
95
+ const runHook = (ctxt, args, construct) => hook_default(
96
+ replaceProxy,
97
+ (...args2) => construct ? Reflect.construct(origFunc, args2, ctxt) : origFunc.apply(ctxt, args2),
98
+ args,
99
+ ctxt
100
+ );
101
+ patchedFunctions.set(replaceProxy, funcPatch);
102
+ if (!Reflect.defineProperty(funcParent, funcName, {
103
+ value: replaceProxy,
104
+ configurable: true,
105
+ writable: true
106
+ }))
107
+ funcParent[funcName] = replaceProxy;
108
+ }
109
+ const hookId = /* @__PURE__ */ Symbol();
110
+ const unpatchThisPatch = () => unpatch(funcPatch, hookId, patchType);
111
+ if (oneTime) funcPatch.c.push(unpatchThisPatch);
112
+ funcPatch[patchType].set(hookId, callback);
113
+ return unpatchThisPatch;
114
+ };
115
+
116
+ // src/index.ts
117
+ var before = getPatchFunc_default("b");
118
+ var instead = getPatchFunc_default("i");
119
+ var after = getPatchFunc_default("a");
120
+ // Annotate the CommonJS export names for ESM import in node:
121
+ 0 && (module.exports = {
122
+ after,
123
+ before,
124
+ instead,
125
+ unpatchAll
126
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,97 @@
1
+ // src/shared.ts
2
+ var patchTypes = ["a", "b", "i"];
3
+ var patchedFunctions;
4
+ var resetPatches = () => patchedFunctions = /* @__PURE__ */ new WeakMap();
5
+ resetPatches();
6
+
7
+ // src/hook.ts
8
+ function hook_default(patchedFunc, origFunc, funcArgs, ctxt) {
9
+ const patch = patchedFunctions.get(patchedFunc);
10
+ if (!patch) return origFunc(...funcArgs);
11
+ for (const hook of patch.b.values()) {
12
+ const maybefuncArgs = hook.call(ctxt, funcArgs);
13
+ if (Array.isArray(maybefuncArgs)) funcArgs = maybefuncArgs;
14
+ }
15
+ let workingRetVal = [...patch.i.values()].reduce(
16
+ (prev, current) => (...args) => current.call(ctxt, args, prev),
17
+ origFunc
18
+ )(...funcArgs);
19
+ for (const hook of patch.a.values())
20
+ workingRetVal = hook.call(ctxt, funcArgs, workingRetVal) ?? workingRetVal;
21
+ for (const cleanup of patch.c) cleanup();
22
+ patch.c = [];
23
+ return workingRetVal;
24
+ }
25
+
26
+ // src/unpatch.ts
27
+ function unpatch(patch, hookId, type) {
28
+ if (!patch || !patch[type].delete(hookId)) return false;
29
+ const funcParent = patch.p;
30
+ if (funcParent && patchTypes.every((t) => patch[t].size === 0)) {
31
+ const funcName = patch.n;
32
+ patchedFunctions.delete(funcParent[funcName]);
33
+ if (!Reflect.defineProperty(funcParent, funcName, {
34
+ value: patch.o,
35
+ writable: true,
36
+ configurable: true
37
+ }))
38
+ funcParent[funcName] = patch.o;
39
+ }
40
+ return true;
41
+ }
42
+
43
+ // src/getPatchFunc.ts
44
+ var getPatchFunc_default = (patchType) => (funcName, funcParent, callback, oneTime = false) => {
45
+ let origFunc = funcParent[funcName];
46
+ if (typeof origFunc !== "function")
47
+ throw new Error(
48
+ `${String(funcName)} is not a function in ${funcParent.constructor.name}`
49
+ );
50
+ let funcPatch = patchedFunctions.get(origFunc);
51
+ if (!funcPatch) {
52
+ funcPatch = {
53
+ n: funcName,
54
+ o: origFunc,
55
+ p: funcParent,
56
+ c: [],
57
+ b: /* @__PURE__ */ new Map(),
58
+ i: /* @__PURE__ */ new Map(),
59
+ a: /* @__PURE__ */ new Map()
60
+ };
61
+ const replaceProxy = new Proxy(origFunc, {
62
+ apply: (_, ctxt, args) => runHook(ctxt, args, false),
63
+ construct: (_, args) => runHook(origFunc, args, true),
64
+ // @ts-expect-error this is manual minification. if you don't like it, kick rocks.
65
+ get: (target, prop, receiver, resolvedProp) => (resolvedProp = Reflect.get(target, prop, receiver), (typeof resolvedProp)[0] == "f") ? resolvedProp.bind(origFunc) : resolvedProp
66
+ });
67
+ const runHook = (ctxt, args, construct) => hook_default(
68
+ replaceProxy,
69
+ (...args2) => construct ? Reflect.construct(origFunc, args2, ctxt) : origFunc.apply(ctxt, args2),
70
+ args,
71
+ ctxt
72
+ );
73
+ patchedFunctions.set(replaceProxy, funcPatch);
74
+ if (!Reflect.defineProperty(funcParent, funcName, {
75
+ value: replaceProxy,
76
+ configurable: true,
77
+ writable: true
78
+ }))
79
+ funcParent[funcName] = replaceProxy;
80
+ }
81
+ const hookId = /* @__PURE__ */ Symbol();
82
+ const unpatchThisPatch = () => unpatch(funcPatch, hookId, patchType);
83
+ if (oneTime) funcPatch.c.push(unpatchThisPatch);
84
+ funcPatch[patchType].set(hookId, callback);
85
+ return unpatchThisPatch;
86
+ };
87
+
88
+ // src/index.ts
89
+ var before = getPatchFunc_default("b");
90
+ var instead = getPatchFunc_default("i");
91
+ var after = getPatchFunc_default("a");
92
+ export {
93
+ after,
94
+ before,
95
+ instead,
96
+ resetPatches as unpatchAll
97
+ };
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "sublimation",
3
+ "version": "1.0.0",
4
+ "description": "A simple JavaScript function patcher.",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "scripts": {
9
+ "prepublish": "tsup ./src/index.ts --dts --format esm,cjs",
10
+ "test": "npm run prepublish && node --no-warnings --import ./test/setup.mjs --test ./test/index.mjs"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://codeberg.org/raincord/sublimation"
15
+ },
16
+ "author": "creatable",
17
+ "license": "CC0-1.0",
18
+ "devDependencies": {
19
+ "@types/node": "^25.2.3",
20
+ "tsup": "^8.5.1",
21
+ "typescript": "^5.9.3"
22
+ }
23
+ }
@@ -0,0 +1,88 @@
1
+ // curried - getPatchFunc("before")(...)
2
+ // allows us to apply an argument while leaving the rest open much cleaner.
3
+ // functional programming strikes again! -- sink
4
+
5
+ import hook from "./hook";
6
+ import {
7
+ PatchType,
8
+ patchedFunctions,
9
+ } from "./shared";
10
+ import { unpatch } from "./unpatch";
11
+
12
+ interface CallbackTypes<F extends (...args: any[]) => any> {
13
+ b: (args: Parameters<F>) => Parameters<F> | void | undefined;
14
+ i: (args: Parameters<F>, origFunc: NonNullable<F>) => ReturnType<F>;
15
+ a: (args: Parameters<F>, ret: ReturnType<F>) => ReturnType<F> | void | undefined;
16
+ }
17
+
18
+ // creates a hook if needed, else just adds one to the patches array
19
+ export default <T extends PatchType>(patchType: T) =>
20
+ <N extends keyof P, P extends Record<PropertyKey, any>>(
21
+ funcName: N,
22
+ funcParent: P,
23
+ callback: CallbackTypes<P[N]>[T],
24
+ oneTime = false
25
+ ) => {
26
+ let origFunc = funcParent[funcName];
27
+
28
+ if (typeof origFunc !== "function")
29
+ throw new Error(
30
+ `${String(funcName)} is not a function in ${funcParent.constructor.name}`
31
+ );
32
+
33
+ let funcPatch = patchedFunctions.get(origFunc);
34
+
35
+ if (!funcPatch) {
36
+ funcPatch = {
37
+ n: funcName,
38
+ o: origFunc,
39
+ p: funcParent,
40
+ c: [],
41
+ b: new Map(),
42
+ i: new Map(),
43
+ a: new Map(),
44
+ };
45
+
46
+ const replaceProxy = new Proxy(origFunc, {
47
+ apply: (_, ctxt, args) => runHook(ctxt, args, false),
48
+ construct: (_, args) => runHook(origFunc, args, true),
49
+
50
+ // @ts-expect-error this is manual minification. if you don't like it, kick rocks.
51
+ get: (target, prop, receiver, resolvedProp) =>
52
+ ((resolvedProp = Reflect.get(target, prop, receiver)),
53
+ (typeof resolvedProp)[0] == "f")
54
+ ? resolvedProp.bind(origFunc)
55
+ : resolvedProp,
56
+ });
57
+
58
+ const runHook: any = (ctxt: any, args: unknown[], construct: boolean) =>
59
+ hook(
60
+ replaceProxy,
61
+ (...args) =>
62
+ construct
63
+ ? Reflect.construct(origFunc, args, ctxt)
64
+ : origFunc.apply(ctxt, args),
65
+ args,
66
+ ctxt
67
+ );
68
+
69
+ patchedFunctions.set(replaceProxy, funcPatch);
70
+
71
+ if (
72
+ !Reflect.defineProperty(funcParent, funcName, {
73
+ value: replaceProxy,
74
+ configurable: true,
75
+ writable: true,
76
+ })
77
+ )
78
+ funcParent[funcName] = replaceProxy;
79
+ }
80
+
81
+ const hookId = Symbol();
82
+ const unpatchThisPatch = () => unpatch(funcPatch!, hookId, patchType);
83
+
84
+ if (oneTime) funcPatch.c.push(unpatchThisPatch);
85
+ funcPatch[patchType].set(hookId, callback);
86
+
87
+ return unpatchThisPatch;
88
+ };
package/src/hook.ts ADDED
@@ -0,0 +1,38 @@
1
+ // calls relevant patches and returns the final result
2
+ import { patchedFunctions } from "./shared";
3
+
4
+ export default function (
5
+ patchedFunc: Function,
6
+ origFunc: Function,
7
+ funcArgs: unknown[],
8
+ // the value of `this` to apply
9
+ ctxt: any
10
+ ) {
11
+ const patch = patchedFunctions.get(patchedFunc);
12
+
13
+ if (!patch) return origFunc(...funcArgs);
14
+
15
+ // Before patches
16
+ for (const hook of patch.b.values()) {
17
+ const maybefuncArgs = hook.call(ctxt, funcArgs);
18
+ if (Array.isArray(maybefuncArgs)) funcArgs = maybefuncArgs;
19
+ }
20
+
21
+ // Instead patches
22
+ let workingRetVal = [...patch.i.values()].reduce(
23
+ (prev, current) =>
24
+ (...args: unknown[]) =>
25
+ current.call(ctxt, args, prev),
26
+ origFunc
27
+ )(...funcArgs);
28
+
29
+ // After patches
30
+ for (const hook of patch.a.values())
31
+ workingRetVal = hook.call(ctxt, funcArgs, workingRetVal) ?? workingRetVal;
32
+
33
+ // Cleanups (one-times)
34
+ for (const cleanup of patch.c) cleanup();
35
+ patch.c = [];
36
+
37
+ return workingRetVal;
38
+ }
package/src/index.ts ADDED
@@ -0,0 +1,8 @@
1
+ import getPatchFunc from "./getPatchFunc";
2
+
3
+ const before = getPatchFunc("b");
4
+ const instead = getPatchFunc("i");
5
+ const after = getPatchFunc("a");
6
+
7
+ export { instead, before, after };
8
+ export { resetPatches as unpatchAll } from "./shared";
package/src/shared.ts ADDED
@@ -0,0 +1,28 @@
1
+ export type PatchType = "a" | "b" | "i";
2
+
3
+ // we use this array multiple times
4
+ export const patchTypes: PatchType[] = ["a", "b", "i"];
5
+
6
+ export type Patch = {
7
+ // function name
8
+ n: PropertyKey;
9
+ // original function
10
+ o: Function;
11
+ // parent object
12
+ p: any;
13
+ // cleanups
14
+ c: Function[];
15
+ // after hooks
16
+ a: Map<symbol, Function>;
17
+ // before hooks
18
+ b: Map<symbol, Function>;
19
+ // instead hooks
20
+ i: Map<symbol, Function>;
21
+ };
22
+
23
+ export let patchedFunctions: WeakMap<Function, Patch>;
24
+ export let resetPatches = () =>
25
+ (patchedFunctions = new WeakMap<Function, Patch>());
26
+
27
+ // Manual minification is funny
28
+ resetPatches();
package/src/unpatch.ts ADDED
@@ -0,0 +1,27 @@
1
+ import { PatchType, Patch, patchTypes, patchedFunctions } from "./shared";
2
+
3
+ export function unpatch(patch: Patch, hookId: symbol, type: PatchType) {
4
+ if (!patch || !patch[type].delete(hookId)) return false;
5
+ const funcParent = patch.p;
6
+
7
+ // If there are no more hooks for every type, remove the patch
8
+ if (funcParent && patchTypes.every((t) => patch[t].size === 0)) {
9
+ const funcName = patch.n;
10
+
11
+ patchedFunctions.delete(funcParent[funcName]);
12
+
13
+ // reflect defineproperty is like object defineproperty
14
+ // but instead of erroring it returns if it worked or not.
15
+ // this is more easily minifiable, hence its use. -- sink
16
+ if (
17
+ !Reflect.defineProperty(funcParent, funcName, {
18
+ value: patch.o,
19
+ writable: true,
20
+ configurable: true,
21
+ })
22
+ )
23
+ funcParent[funcName] = patch.o;
24
+ }
25
+
26
+ return true;
27
+ }
package/test/index.mjs ADDED
@@ -0,0 +1,4 @@
1
+ import "./suites/after.mjs";
2
+ import "./suites/before.mjs";
3
+ import "./suites/instead.mjs";
4
+ import "./suites/unpatches.mjs";
package/test/setup.mjs ADDED
@@ -0,0 +1,20 @@
1
+ import { notEqual as isNotEqual } from "node:assert/strict";
2
+ import { beforeEach } from "node:test";
3
+
4
+ beforeEach(() => {
5
+ globalThis.testFuncs = {};
6
+
7
+ // for testing basic single patch-unpatch
8
+ testFuncs.simple = (a, b) => a + b;
9
+
10
+ // now we know that works, for testing context
11
+ testFuncs.contextual = function (a) {
12
+ isNotEqual(this?.x, undefined);
13
+ isNotEqual(this.y, undefined);
14
+ isNotEqual(this.z, undefined);
15
+ return (this.x - a) / this.y + this.z;
16
+ };
17
+
18
+ // now we know patching works, for testing patch composing
19
+ testFuncs.passthru = (a) => a;
20
+ });
@@ -0,0 +1,31 @@
1
+ import { equal as isEqual } from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { after } from "../../dist/index.mjs";
4
+
5
+ describe("sublimation after patches", () => {
6
+ it("should patch a simple func", () => {
7
+ after("simple", testFuncs, ([, b], ret) => ret * b);
8
+
9
+ isEqual(testFuncs.simple(1, 2), 6);
10
+ });
11
+
12
+ it("should be unpatchable", () => {
13
+ const unpatch = after("simple", testFuncs, () => 0);
14
+
15
+ unpatch();
16
+
17
+ isEqual(testFuncs.simple(1, 2), 3);
18
+ });
19
+
20
+ it("should maintain context", () => {
21
+ after("contextual", testFuncs, function () {
22
+ isEqual(this?.x, 17);
23
+ isEqual(this.y, 5);
24
+ isEqual(this.z, "test");
25
+ });
26
+
27
+ const ctx = { x: 17, y: 5, z: "test" };
28
+
29
+ isEqual(testFuncs.contextual.call(ctx, 1), "3.2test");
30
+ });
31
+ });
@@ -0,0 +1,31 @@
1
+ import { equal as isEqual } from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { before } from "../../dist/index.mjs";
4
+
5
+ describe("sublimation before patches", () => {
6
+ it("should patch a simple func", () => {
7
+ before("simple", testFuncs, ([a, b]) => [a + b, a * b]);
8
+
9
+ isEqual(testFuncs.simple(1, 2), 5);
10
+ });
11
+
12
+ it("should be unpatchable", () => {
13
+ const unpatch = before("simple", testFuncs, () => [0, 0]);
14
+
15
+ unpatch();
16
+
17
+ isEqual(testFuncs.simple(1, 2), 3);
18
+ });
19
+
20
+ it("should maintain context", () => {
21
+ before("contextual", testFuncs, function () {
22
+ isEqual(this?.x, 17);
23
+ isEqual(this.y, 5);
24
+ isEqual(this.z, "test");
25
+ });
26
+
27
+ const ctx = { x: 17, y: 5, z: "test" };
28
+
29
+ isEqual(testFuncs.contextual.call(ctx, 1), "3.2test");
30
+ });
31
+ });
@@ -0,0 +1,33 @@
1
+ import { equal as isEqual } from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { instead } from "../../dist/index.mjs";
4
+
5
+ describe("sublimation instead patches", () => {
6
+ it("should patch a simple func", () => {
7
+ instead("simple", testFuncs, ([a, b], orig) => orig(a + b, b - a) * b);
8
+
9
+ isEqual(testFuncs.simple(1, 2), 8);
10
+ });
11
+
12
+ it("should be unpatchable", () => {
13
+ const unpatch = instead("simple", testFuncs, () => 0);
14
+
15
+ unpatch();
16
+
17
+ isEqual(testFuncs.simple(1, 2), 3);
18
+ });
19
+
20
+ it("should maintain context", () => {
21
+ instead("contextual", testFuncs, function (args, orig) {
22
+ isEqual(this?.x, 17);
23
+ isEqual(this.y, 5);
24
+ isEqual(this.z, "test");
25
+
26
+ return orig.apply(this, args);
27
+ });
28
+
29
+ const ctx = { x: 17, y: 5, z: "test" };
30
+
31
+ isEqual(testFuncs.contextual.call(ctx, 1), "3.2test");
32
+ });
33
+ });
@@ -0,0 +1,49 @@
1
+ import { equal as isEqual } from "node:assert/strict";
2
+ import { describe, it } from "node:test";
3
+ import { after, before, instead, unpatchAll } from "../../dist/index.mjs";
4
+
5
+ describe("sublimation unpatches", () => {
6
+ it("should be able to unpatch the most recent on a given func", () => {
7
+ after("passthru", testFuncs, ([], ret) => ret + "a");
8
+ const unpatch = after("passthru", testFuncs, ([], ret) => ret + "b");
9
+
10
+ unpatch();
11
+ isEqual(testFuncs.passthru("x_"), "x_a");
12
+ });
13
+
14
+ it("should be able to unpatch the first on a given func", () => {
15
+ const unpatch = after("passthru", testFuncs, ([], ret) => ret + "a");
16
+ after("passthru", testFuncs, ([], ret) => ret + "b");
17
+
18
+ unpatch();
19
+ isEqual(testFuncs.passthru("x_"), "x_b");
20
+ });
21
+
22
+ it("should be able to unpatch an in-between on a given func", () => {
23
+ after("passthru", testFuncs, ([], ret) => ret + "a");
24
+ const unpatch = after("passthru", testFuncs, ([], ret) => ret + "b");
25
+ after("passthru", testFuncs, ([], ret) => ret + "c");
26
+
27
+ unpatch();
28
+ isEqual(testFuncs.passthru("x_"), "x_ac");
29
+ });
30
+
31
+ it("should be able to completely unpatch", () => {
32
+ before("simple", testFuncs, ([a, b]) => [a + 1, b + 1]);
33
+ after("simple", testFuncs, ([], ret) => ret / 2);
34
+
35
+ after("passthru", testFuncs, ([], ret) => ret + "_patched");
36
+
37
+ instead("contextual", testFuncs, ([a], orig) =>
38
+ orig.call({ x: 1, y: 1, z: "a" }, a - 4),
39
+ );
40
+
41
+ unpatchAll();
42
+
43
+ const ctx = { x: 17, y: 5, z: "test" };
44
+
45
+ isEqual(testFuncs.simple(1, 2), 3);
46
+ isEqual(testFuncs.contextual.call(ctx, 1), "3.2test");
47
+ isEqual(testFuncs.passthru("x"), "x");
48
+ });
49
+ });
package/tsconfig.json ADDED
@@ -0,0 +1,9 @@
1
+ {
2
+ "include": ["src/**/*.ts"],
3
+ "compilerOptions": {
4
+ "target": "ES2022",
5
+ "module": "ES2022",
6
+ "moduleResolution": "Bundler",
7
+ "noEmit": true
8
+ }
9
+ }