@longzai-intelligence-builder/exe 0.2.13 → 0.2.15
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/index.mjs +1 -1
- package/package.json +15 -15
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"node:module";import e from"node:os";import t from"node:path";import n from"node:process";import{
|
|
1
|
+
import"node:module";import e from"node:os";import t from"node:path";import n from"node:process";import{fsExists as r,fsRemove as i}from"@longzai-intelligence-builder/core";import{Buffer as a}from"node:buffer";import{chmod as o,mkdir as s,rename as c,writeFile as l}from"node:fs/promises";import{createDebug as u}from"obug";import{x as d}from"tinyexec";import f from"semver/functions/satisfies.js";import p from"semver/functions/valid.js";function m(){let r=e.homedir();if(n.platform===`win32`){let e=n.env.LOCALAPPDATA||t.join(r,`AppData/Local`);return t.join(e,`lzi-builder/Caches`)}if(n.platform===`darwin`)return t.join(r,`Library/Caches/lzi-builder`);let i=n.env.XDG_CACHE_HOME||t.join(r,`.cache`);return t.join(i,`lzi-builder`)}function h(e){let n=m(),r=e.platform===`win`?`node.exe`:`node`;return t.join(n,`node`,`v${e.nodeVersion}`,`${e.platform}-${e.arch}`,r)}function g(e){return e===`win`?`zip`:e===`linux`?`tar.xz`:`tar.gz`}function _(e){let{platform:t,arch:n,nodeVersion:r}=e;return`https://nodejs.org/dist/v${r}/node-v${r}-${t}-${n}.${g(t)}`}function v(e){let{platform:t,arch:n,nodeVersion:r}=e,i=`node-v${r}-${t}-${n}`;return t===`win`?`${i}/node.exe`:`${i}/bin/node`}const y=`https://nodejs.org/dist/index.json`;async function b(e){if(e===`latest`||e===`latest-lts`){let t=await fetch(y);if(!t.ok)throw Error(`Failed to fetch Node.js releases: HTTP ${t.status} from ${y}`);let n=await t.json(),r=e===`latest`?n[0]:n.find(e=>e.lts!==!1);if(!r)throw Error(`No matching Node.js release found for "${e}".`);e=r.version.replace(/^v/,``)}let t=p(e);if(!t)throw Error(`Invalid Node.js version: ${e}. Please provide a valid version string (e.g., "25.7.0").`);if(!f(t,`>=25.7.0`))throw Error(`Node.js ${t} does not support SEA (Single Executable Applications). Required minimum version is 25.7.0. Please update the nodeVersion in your target configuration.`);return t}function x(e){return`-${e.platform}-${e.arch}`}const S=u(`lzi-builder:exe:download`);async function C(e,n){S(`Resolving Node.js binary for target: %O`,e),e.nodeVersion=await b(e.nodeVersion);let c=h(e);if(S(`Cache path: %s`,c),await r(c))return S(`Cache hit: %s`,c),n?.info(`Using cached Node.js ${e.nodeVersion} for ${e.platform}-${e.arch}`),c;let u=_(e);S(`Cache miss, downloading from: %s`,u),n?.info(`Downloading Node.js ${e.nodeVersion} for ${e.platform}-${e.arch}...`),n?.info(` ${u}`),await s(t.dirname(c),{recursive:!0});let d=await fetch(u);if(!d.ok)throw Error(`Failed to download Node.js binary: HTTP ${d.status} from ${u}`);let f=`${c}.download.${g(e.platform)}`,p=a.from(await d.arrayBuffer());S(`Downloaded %d bytes, writing to: %s`,p.length,f),await l(f,p);try{await w(f,c,e),e.platform!==`win`&&await o(c,493),S(`Binary cached at: %s`,c),n?.info(`Cached Node.js binary at: ${c}`)}finally{await i(f)}return c}async function w(e,n,r){let i=v(r),a=t.dirname(n);if(S(`Extracting %s from archive to %s`,i,a),r.platform===`win`)await d(`tar`,[`-xf`,e,`-C`,a,`--strip-components=1`,i],{nodeOptions:{stdio:`inherit`},throwOnError:!0});else{let t=e.endsWith(`.tar.xz`)?`J`:`z`;await d(`tar`,[`-x${t}f`,e,`-C`,a,`--strip-components=2`,i],{nodeOptions:{stdio:`inherit`},throwOnError:!0})}let o=r.platform===`win`?`node.exe`:`node`,s=t.join(a,o);s!==n&&await c(s,n)}export{m as getCacheDir,h as getCachedBinaryPath,x as getTargetSuffix,C as resolveNodeBinary};
|
package/package.json
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longzai-intelligence-builder/exe",
|
|
3
|
-
"
|
|
4
|
-
"version": "0.2.13",
|
|
3
|
+
"version": "0.2.15",
|
|
5
4
|
"license": "UNLICENSED",
|
|
6
|
-
"exports": {
|
|
7
|
-
".": "./dist/index.mjs",
|
|
8
|
-
"./package.json": "./package.json"
|
|
9
|
-
},
|
|
10
|
-
"types": "./dist/index.d.mts",
|
|
11
5
|
"files": [
|
|
12
6
|
"dist"
|
|
13
7
|
],
|
|
14
|
-
"
|
|
15
|
-
|
|
8
|
+
"type": "module",
|
|
9
|
+
"types": "./dist/index.d.mts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./dist/index.mjs",
|
|
12
|
+
"./package.json": "./package.json"
|
|
16
13
|
},
|
|
17
14
|
"scripts": {
|
|
18
15
|
"build": "lzi-builder",
|
|
19
|
-
"build:prod": "NODE_ENV=production
|
|
16
|
+
"build:prod": "NODE_ENV=production bun run build",
|
|
20
17
|
"prepublishOnly": "bun run build:prod",
|
|
21
|
-
"typecheck": "tsgo
|
|
18
|
+
"typecheck": "lzi-tsgo typecheck tsconfig.json",
|
|
22
19
|
"lint": "oxlint && oxfmt --check",
|
|
23
20
|
"lint:fix": "oxlint --fix && oxfmt",
|
|
24
21
|
"clean": "lzi-dev-cli clean"
|
|
25
22
|
},
|
|
26
|
-
"peerDependencies": {
|
|
27
|
-
"@longzai-intelligence-builder/core": "0.2.13"
|
|
28
|
-
},
|
|
29
23
|
"dependencies": {
|
|
30
24
|
"obug": "^2.1.3",
|
|
31
25
|
"semver": "^7.8.5",
|
|
32
26
|
"tinyexec": "^1.2.4"
|
|
33
27
|
},
|
|
34
28
|
"devDependencies": {
|
|
35
|
-
"@longzai-intelligence-builder/esm": "0.2.
|
|
29
|
+
"@longzai-intelligence-builder/esm": "0.2.15"
|
|
30
|
+
},
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@longzai-intelligence-builder/core": "0.2.15"
|
|
33
|
+
},
|
|
34
|
+
"engines": {
|
|
35
|
+
"node": "^22.18.0 || >=24.11.0"
|
|
36
36
|
}
|
|
37
37
|
}
|