@let-value/translate-extract-static 1.0.30
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/cli.cjs +23 -0
- package/dist/bin/cli.d.cts +1 -0
- package/dist/bin/cli.d.ts +1 -0
- package/dist/bin/cli.js +23 -0
- package/dist/scripts/postinstall.cjs +39 -0
- package/dist/scripts/postinstall.d.cts +1 -0
- package/dist/scripts/postinstall.d.ts +1 -0
- package/dist/scripts/postinstall.js +38 -0
- package/dist/src/index.cjs +11 -0
- package/dist/src/index.d.cts +10 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/index.js +3 -0
- package/dist/src-Dvwnfabp.cjs +96 -0
- package/dist/src-P8KovMIH.js +18 -0
- package/package.json +40 -0
- package/postinstall.cjs +8 -0
package/dist/bin/cli.cjs
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_src = require('../src-Dvwnfabp.cjs');
|
|
3
|
+
let node_child_process = require("node:child_process");
|
|
4
|
+
node_child_process = require_src.__toESM(node_child_process);
|
|
5
|
+
|
|
6
|
+
//#region bin/cli.ts
|
|
7
|
+
const child = (0, node_child_process.spawn)(require_src.binaryPath, process.argv.slice(2), {
|
|
8
|
+
stdio: "inherit",
|
|
9
|
+
windowsHide: true
|
|
10
|
+
});
|
|
11
|
+
child.on("error", (error) => {
|
|
12
|
+
console.error(error);
|
|
13
|
+
process.exit(1);
|
|
14
|
+
});
|
|
15
|
+
child.on("exit", (code, signal) => {
|
|
16
|
+
if (signal) {
|
|
17
|
+
process.kill(process.pid, signal);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
process.exit(code ?? 1);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/bin/cli.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { binaryPath } from "../src-P8KovMIH.js";
|
|
3
|
+
import { spawn } from "node:child_process";
|
|
4
|
+
|
|
5
|
+
//#region bin/cli.ts
|
|
6
|
+
const child = spawn(binaryPath, process.argv.slice(2), {
|
|
7
|
+
stdio: "inherit",
|
|
8
|
+
windowsHide: true
|
|
9
|
+
});
|
|
10
|
+
child.on("error", (error) => {
|
|
11
|
+
console.error(error);
|
|
12
|
+
process.exit(1);
|
|
13
|
+
});
|
|
14
|
+
child.on("exit", (code, signal) => {
|
|
15
|
+
if (signal) {
|
|
16
|
+
process.kill(process.pid, signal);
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
process.exit(code ?? 1);
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const require_src = require('../src-Dvwnfabp.cjs');
|
|
2
|
+
let node_path = require("node:path");
|
|
3
|
+
node_path = require_src.__toESM(node_path);
|
|
4
|
+
let node_fs = require("node:fs");
|
|
5
|
+
node_fs = require_src.__toESM(node_fs);
|
|
6
|
+
|
|
7
|
+
//#region scripts/postinstall.ts
|
|
8
|
+
const root = (0, node_path.resolve)(__dirname, "../..");
|
|
9
|
+
const dist = (0, node_path.resolve)(root, "dist");
|
|
10
|
+
const pkg = JSON.parse((0, node_fs.readFileSync)((0, node_path.resolve)(root, "package.json"), "utf8"));
|
|
11
|
+
const repo = "https://github.com/let-value/translate";
|
|
12
|
+
const tag = `v${pkg.version}`;
|
|
13
|
+
const url = `${repo}/releases/download/${tag}/${require_src.binaryName}`;
|
|
14
|
+
async function downloadBinary() {
|
|
15
|
+
try {
|
|
16
|
+
const response = await fetch(url, {
|
|
17
|
+
redirect: "follow",
|
|
18
|
+
signal: AbortSignal.timeout(3e4),
|
|
19
|
+
headers: { "user-agent": "@let-value/translate-extract-static postinstall" }
|
|
20
|
+
});
|
|
21
|
+
(0, node_fs.writeFileSync)(require_src.binaryPath, Buffer.from(await response.arrayBuffer()));
|
|
22
|
+
if (require_src.platform !== "win32") (0, node_fs.chmodSync)(require_src.binaryPath, 493);
|
|
23
|
+
return true;
|
|
24
|
+
} catch {}
|
|
25
|
+
}
|
|
26
|
+
async function main() {
|
|
27
|
+
(0, node_fs.mkdirSync)(dist, { recursive: true });
|
|
28
|
+
if ((0, node_fs.existsSync)(require_src.binaryPath)) return;
|
|
29
|
+
if (await downloadBinary()) {
|
|
30
|
+
console.log(`Downloaded binary: ${require_src.binaryName}`);
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
console.warn(`Could not download a binary for ${require_src.binaryName}.`);
|
|
34
|
+
}
|
|
35
|
+
main().catch((error) => {
|
|
36
|
+
console.warn(`Binary download failed: ${String(error)}`);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { binaryName, binaryPath, platform } from "../src-P8KovMIH.js";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
4
|
+
|
|
5
|
+
//#region scripts/postinstall.ts
|
|
6
|
+
const root = resolve(import.meta.dirname, "../..");
|
|
7
|
+
const dist = resolve(root, "dist");
|
|
8
|
+
const pkg = JSON.parse(readFileSync(resolve(root, "package.json"), "utf8"));
|
|
9
|
+
const repo = "https://github.com/let-value/translate";
|
|
10
|
+
const tag = `v${pkg.version}`;
|
|
11
|
+
const url = `${repo}/releases/download/${tag}/${binaryName}`;
|
|
12
|
+
async function downloadBinary() {
|
|
13
|
+
try {
|
|
14
|
+
const response = await fetch(url, {
|
|
15
|
+
redirect: "follow",
|
|
16
|
+
signal: AbortSignal.timeout(3e4),
|
|
17
|
+
headers: { "user-agent": "@let-value/translate-extract-static postinstall" }
|
|
18
|
+
});
|
|
19
|
+
writeFileSync(binaryPath, Buffer.from(await response.arrayBuffer()));
|
|
20
|
+
if (platform !== "win32") chmodSync(binaryPath, 493);
|
|
21
|
+
return true;
|
|
22
|
+
} catch {}
|
|
23
|
+
}
|
|
24
|
+
async function main() {
|
|
25
|
+
mkdirSync(dist, { recursive: true });
|
|
26
|
+
if (existsSync(binaryPath)) return;
|
|
27
|
+
if (await downloadBinary()) {
|
|
28
|
+
console.log(`Downloaded binary: ${binaryName}`);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
console.warn(`Could not download a binary for ${binaryName}.`);
|
|
32
|
+
}
|
|
33
|
+
main().catch((error) => {
|
|
34
|
+
console.warn(`Binary download failed: ${String(error)}`);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
export { };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
|
+
const require_src = require('../src-Dvwnfabp.cjs');
|
|
3
|
+
|
|
4
|
+
exports.arch = require_src.arch;
|
|
5
|
+
exports.binaryName = require_src.binaryName;
|
|
6
|
+
exports.binaryPath = require_src.binaryPath;
|
|
7
|
+
exports.default = require_src.src_default;
|
|
8
|
+
exports.getBinaryName = require_src.getBinaryName;
|
|
9
|
+
exports.libc = require_src.libc;
|
|
10
|
+
exports.platform = require_src.platform;
|
|
11
|
+
exports.root = require_src.root;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
declare const root: string;
|
|
3
|
+
declare const platform: NodeJS.Platform;
|
|
4
|
+
declare const arch: NodeJS.Architecture;
|
|
5
|
+
declare const libc: string | null;
|
|
6
|
+
declare function getBinaryName(platform: string, arch: string, libc?: string | null): string;
|
|
7
|
+
declare const binaryName: string;
|
|
8
|
+
declare const binaryPath: string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { arch, binaryName, binaryPath, binaryPath as default, getBinaryName, libc, platform, root };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/index.d.ts
|
|
2
|
+
declare const root: string;
|
|
3
|
+
declare const platform: NodeJS.Platform;
|
|
4
|
+
declare const arch: NodeJS.Architecture;
|
|
5
|
+
declare const libc: string | null;
|
|
6
|
+
declare function getBinaryName(platform: string, arch: string, libc?: string | null): string;
|
|
7
|
+
declare const binaryName: string;
|
|
8
|
+
declare const binaryPath: string;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { arch, binaryName, binaryPath, binaryPath as default, getBinaryName, libc, platform, root };
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
//#region rolldown:runtime
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
10
|
+
key = keys[i];
|
|
11
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
12
|
+
get: ((k) => from[k]).bind(null, key),
|
|
13
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
19
|
+
value: mod,
|
|
20
|
+
enumerable: true
|
|
21
|
+
}) : target, mod));
|
|
22
|
+
|
|
23
|
+
//#endregion
|
|
24
|
+
let node_path = require("node:path");
|
|
25
|
+
node_path = __toESM(node_path);
|
|
26
|
+
let detect_libc = require("detect-libc");
|
|
27
|
+
detect_libc = __toESM(detect_libc);
|
|
28
|
+
|
|
29
|
+
//#region src/index.ts
|
|
30
|
+
const root = (0, node_path.resolve)(__dirname, "..");
|
|
31
|
+
const platform = process.platform;
|
|
32
|
+
const arch = process.arch;
|
|
33
|
+
const libc = (0, detect_libc.familySync)() || null;
|
|
34
|
+
function getBinaryName(platform$1, arch$1, libc$1) {
|
|
35
|
+
const extension = platform$1 === "win32" ? ".exe" : "";
|
|
36
|
+
return `extract-${platform$1}-${arch$1}${libc$1 ? `-${libc$1}` : ""}${extension}`;
|
|
37
|
+
}
|
|
38
|
+
const binaryName = getBinaryName(platform, arch, libc);
|
|
39
|
+
const binaryPath = (0, node_path.resolve)(root, "dist", binaryName);
|
|
40
|
+
var src_default = binaryPath;
|
|
41
|
+
|
|
42
|
+
//#endregion
|
|
43
|
+
Object.defineProperty(exports, '__toESM', {
|
|
44
|
+
enumerable: true,
|
|
45
|
+
get: function () {
|
|
46
|
+
return __toESM;
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
Object.defineProperty(exports, 'arch', {
|
|
50
|
+
enumerable: true,
|
|
51
|
+
get: function () {
|
|
52
|
+
return arch;
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
Object.defineProperty(exports, 'binaryName', {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
get: function () {
|
|
58
|
+
return binaryName;
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
Object.defineProperty(exports, 'binaryPath', {
|
|
62
|
+
enumerable: true,
|
|
63
|
+
get: function () {
|
|
64
|
+
return binaryPath;
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
Object.defineProperty(exports, 'getBinaryName', {
|
|
68
|
+
enumerable: true,
|
|
69
|
+
get: function () {
|
|
70
|
+
return getBinaryName;
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
Object.defineProperty(exports, 'libc', {
|
|
74
|
+
enumerable: true,
|
|
75
|
+
get: function () {
|
|
76
|
+
return libc;
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
Object.defineProperty(exports, 'platform', {
|
|
80
|
+
enumerable: true,
|
|
81
|
+
get: function () {
|
|
82
|
+
return platform;
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
Object.defineProperty(exports, 'root', {
|
|
86
|
+
enumerable: true,
|
|
87
|
+
get: function () {
|
|
88
|
+
return root;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
Object.defineProperty(exports, 'src_default', {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return src_default;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { familySync } from "detect-libc";
|
|
3
|
+
|
|
4
|
+
//#region src/index.ts
|
|
5
|
+
const root = resolve(import.meta.dirname, "..");
|
|
6
|
+
const platform = process.platform;
|
|
7
|
+
const arch = process.arch;
|
|
8
|
+
const libc = familySync() || null;
|
|
9
|
+
function getBinaryName(platform$1, arch$1, libc$1) {
|
|
10
|
+
const extension = platform$1 === "win32" ? ".exe" : "";
|
|
11
|
+
return `extract-${platform$1}-${arch$1}${libc$1 ? `-${libc$1}` : ""}${extension}`;
|
|
12
|
+
}
|
|
13
|
+
const binaryName = getBinaryName(platform, arch, libc);
|
|
14
|
+
const binaryPath = resolve(root, "dist", binaryName);
|
|
15
|
+
var src_default = binaryPath;
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { arch, binaryName, binaryPath, getBinaryName, libc, platform, root, src_default };
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@let-value/translate-extract-static",
|
|
3
|
+
"version": "1.0.30",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/src/index.cjs",
|
|
6
|
+
"module": "./dist/src/index.js",
|
|
7
|
+
"types": "./dist/src/index.d.ts",
|
|
8
|
+
"bin": {
|
|
9
|
+
"extract": "./dist/bin/cli.js"
|
|
10
|
+
},
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"types": "./dist/src/index.d.ts",
|
|
14
|
+
"import": "./dist/src/index.js",
|
|
15
|
+
"require": "./dist/src/index.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./package.json": "./package.json"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"dist",
|
|
21
|
+
"postinstall.cjs"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"postinstall": "node postinstall.cjs",
|
|
25
|
+
"build": "tsdown",
|
|
26
|
+
"check": "biome check .",
|
|
27
|
+
"format": "biome check --write .",
|
|
28
|
+
"typecheck": "tsc --build",
|
|
29
|
+
"test": "node --test"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@types/bun": "1.3.8",
|
|
33
|
+
"@types/node": "22.10.2",
|
|
34
|
+
"tsdown": "0.15.2",
|
|
35
|
+
"typescript": "5.9.2"
|
|
36
|
+
},
|
|
37
|
+
"dependencies": {
|
|
38
|
+
"detect-libc": "2.1.2"
|
|
39
|
+
}
|
|
40
|
+
}
|
package/postinstall.cjs
ADDED