revojs 0.2.58 → 0.2.60
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.
- package/dist/bin/base64.d.ts +1 -0
- package/dist/bin/base64.js +41 -0
- package/dist/bin/index.js +3 -0
- package/dist/package.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function installBase64(): void;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Buffer } from "node:buffer";
|
|
2
|
+
//#region src/bin/base64.ts
|
|
3
|
+
function installBase64() {
|
|
4
|
+
if (typeof Uint8Array.prototype.toBase64 === "function") return;
|
|
5
|
+
Object.defineProperties(Uint8Array.prototype, {
|
|
6
|
+
toBase64: {
|
|
7
|
+
configurable: true,
|
|
8
|
+
writable: true,
|
|
9
|
+
value(options = {}) {
|
|
10
|
+
const encoded = Buffer.from(this.buffer, this.byteOffset, this.byteLength).toString("base64");
|
|
11
|
+
const alphabet = options.alphabet === "base64url" ? encoded.replaceAll("+", "-").replaceAll("/", "_") : encoded;
|
|
12
|
+
return options.omitPadding ? alphabet.replace(/=+$/, "") : alphabet;
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
toHex: {
|
|
16
|
+
configurable: true,
|
|
17
|
+
writable: true,
|
|
18
|
+
value() {
|
|
19
|
+
return Buffer.from(this.buffer, this.byteOffset, this.byteLength).toString("hex");
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
Object.defineProperties(Uint8Array, {
|
|
24
|
+
fromBase64: {
|
|
25
|
+
configurable: true,
|
|
26
|
+
writable: true,
|
|
27
|
+
value(value, options = {}) {
|
|
28
|
+
return new Uint8Array(Buffer.from(value, options.alphabet === "base64url" ? "base64url" : "base64"));
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
fromHex: {
|
|
32
|
+
configurable: true,
|
|
33
|
+
writable: true,
|
|
34
|
+
value(value) {
|
|
35
|
+
return new Uint8Array(Buffer.from(value, "hex"));
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { installBase64 };
|
package/dist/bin/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createCommandTree, runCommands } from "../commands/index.js";
|
|
3
|
+
import { installBase64 } from "./base64.js";
|
|
3
4
|
import { createRunnableDevEnvironment, createServer, isRunnableDevEnvironment, loadEnv } from "vite";
|
|
4
5
|
import { parseArgs } from "util";
|
|
5
6
|
//#region src/bin/index.ts
|
|
7
|
+
installBase64();
|
|
6
8
|
var args = process.argv.slice(2);
|
|
7
9
|
var parsed = parseArgs({
|
|
8
10
|
args,
|
|
@@ -64,6 +66,7 @@ try {
|
|
|
64
66
|
process.exitCode = 1;
|
|
65
67
|
} finally {
|
|
66
68
|
await server.close();
|
|
69
|
+
process.exit();
|
|
67
70
|
}
|
|
68
71
|
//#endregion
|
|
69
72
|
export {};
|
package/dist/package.js
CHANGED