@allyhub/sdk 0.3.0 → 0.4.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.
- package/dist/free.d.ts +2 -2
- package/dist/index.d.ts +2 -9
- package/dist/index.js +1 -1
- package/dist/module.d.ts +2 -3
- package/dist/module.js +1 -1
- package/dist/parts.d.ts +2 -2
- package/dist/piece.d.ts +7 -32
- package/dist/piece.js +1 -1
- package/dist/props.d.ts +53 -10
- package/dist/slides.d.ts +8 -0
- package/dist/slides.js +2 -0
- package/docs/README.md +1 -1
- package/docs/batches.md +2 -2
- package/docs/defaults.md +106 -3
- package/docs/docs.md +1 -1
- package/docs/project.md +5 -5
- package/docs/sheets.md +1 -1
- package/docs/slides.md +182 -80
- package/node_modules/@allyhub-next/audio/package.json +1 -1
- package/node_modules/@allyhub-next/formats/dist/data/script.d.ts +22 -0
- package/node_modules/@allyhub-next/formats/dist/data/script.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/data/slides.d.ts +1494 -0
- package/node_modules/@allyhub-next/formats/dist/data/slides.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/index.d.ts +2 -0
- package/node_modules/@allyhub-next/formats/dist/index.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/items.d.ts +21 -0
- package/node_modules/@allyhub-next/formats/dist/items.js +1 -1
- package/node_modules/@allyhub-next/formats/dist/note-shape.d.ts +39 -0
- package/node_modules/@allyhub-next/formats/dist/note-shape.js +2 -0
- package/node_modules/@allyhub-next/formats/dist/schemas.d.ts +418 -0
- package/node_modules/@allyhub-next/formats/dist/schemas.js +1 -1
- package/node_modules/@allyhub-next/formats/package.json +1 -1
- package/node_modules/@allyhub-next/protocol/dist/app.d.ts +0 -64
- package/node_modules/@allyhub-next/protocol/dist/app.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/auth.d.ts +0 -17
- package/node_modules/@allyhub-next/protocol/dist/auth.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/cli.d.ts +0 -4
- package/node_modules/@allyhub-next/protocol/dist/cli.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/editor.d.ts +9 -26
- package/node_modules/@allyhub-next/protocol/dist/editor.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/index.d.ts +1 -0
- package/node_modules/@allyhub-next/protocol/dist/index.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/notes.d.ts +163 -0
- package/node_modules/@allyhub-next/protocol/dist/notes.js +2 -0
- package/node_modules/@allyhub-next/protocol/dist/registry.d.ts +1 -1
- package/node_modules/@allyhub-next/protocol/dist/runtimes.d.ts +3 -0
- package/node_modules/@allyhub-next/protocol/dist/runtimes.js +1 -1
- package/node_modules/@allyhub-next/protocol/dist/tools.d.ts +37 -0
- package/node_modules/@allyhub-next/protocol/dist/tools.js +1 -1
- package/node_modules/@allyhub-next/protocol/package.json +1 -1
- package/node_modules/@allyhub-next/runtimes/dist/errors.d.ts +5 -1
- package/node_modules/@allyhub-next/runtimes/dist/index.d.ts +1 -0
- package/node_modules/@allyhub-next/runtimes/dist/index.js +1 -1
- package/node_modules/@allyhub-next/runtimes/dist/node-program.d.ts +3 -0
- package/node_modules/@allyhub-next/runtimes/dist/node-program.js +2 -0
- package/node_modules/@allyhub-next/runtimes/dist/packages.d.ts +65 -0
- package/node_modules/@allyhub-next/runtimes/dist/packages.js +4 -0
- package/node_modules/@allyhub-next/runtimes/dist/runtimes.js +2 -2
- package/node_modules/@allyhub-next/runtimes/dist/unpack.d.ts +7 -0
- package/node_modules/@allyhub-next/runtimes/dist/unpack.js +1 -1
- package/node_modules/@allyhub-next/runtimes/package.json +5 -1
- package/node_modules/@allyhub-next/runtimes/pins/docx/package-lock.json +67 -0
- package/node_modules/@allyhub-next/runtimes/pins/docx/package.json +9 -0
- package/node_modules/@allyhub-next/runtimes/pins/exceljs/package-lock.json +2533 -0
- package/node_modules/@allyhub-next/runtimes/pins/exceljs/package.json +8 -0
- package/node_modules/@allyhub-next/runtimes/pins/gltf-tools/package-lock.json +753 -0
- package/node_modules/@allyhub-next/runtimes/pins/gltf-tools/package.json +14 -0
- package/node_modules/@allyhub-next/runtimes/pins/manifold-3d/package-lock.json +950 -0
- package/node_modules/@allyhub-next/runtimes/pins/manifold-3d/package.json +8 -0
- package/node_modules/@allyhub-next/runtimes/pins/onnxruntime-node/package-lock.json +227 -0
- package/node_modules/@allyhub-next/runtimes/pins/onnxruntime-node/package.json +8 -0
- package/node_modules/@allyhub-next/runtimes/pins/sherpa-onnx-node/package-lock.json +105 -0
- package/node_modules/@allyhub-next/runtimes/pins/sherpa-onnx-node/package.json +8 -0
- package/node_modules/@allyhub-next/runtimes/pins/tesseract.js/package-lock.json +128 -0
- package/node_modules/@allyhub-next/runtimes/pins/tesseract.js/package.json +9 -0
- package/node_modules/@allyhub-next/runtimes/schemas/runtimes.schema.json +5 -24
- package/node_modules/@allyhub-next/scenery/package.json +1 -1
- package/node_modules/@allyhub-next/slides-core/LICENSE +241 -0
- package/node_modules/@allyhub-next/slides-core/dist/animation.d.ts +129 -0
- package/node_modules/@allyhub-next/slides-core/dist/animation.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/api.d.ts +649 -0
- package/node_modules/@allyhub-next/slides-core/dist/api.js +4 -0
- package/node_modules/@allyhub-next/slides-core/dist/capabilities.d.ts +18 -0
- package/node_modules/@allyhub-next/slides-core/dist/capabilities.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart-api.d.ts +165 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart-api.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart-file.d.ts +11 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart-file.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart.d.ts +184 -0
- package/node_modules/@allyhub-next/slides-core/dist/chart.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/check.d.ts +7 -0
- package/node_modules/@allyhub-next/slides-core/dist/check.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/enums.d.ts +146 -0
- package/node_modules/@allyhub-next/slides-core/dist/enums.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/file.d.ts +109 -0
- package/node_modules/@allyhub-next/slides-core/dist/file.js +4 -0
- package/node_modules/@allyhub-next/slides-core/dist/index.d.ts +21 -0
- package/node_modules/@allyhub-next/slides-core/dist/index.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/measure.d.ts +34 -0
- package/node_modules/@allyhub-next/slides-core/dist/measure.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/model.d.ts +278 -0
- package/node_modules/@allyhub-next/slides-core/dist/model.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/office.d.ts +58 -0
- package/node_modules/@allyhub-next/slides-core/dist/office.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/path.d.ts +6 -0
- package/node_modules/@allyhub-next/slides-core/dist/path.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/placeholders.d.ts +7 -0
- package/node_modules/@allyhub-next/slides-core/dist/placeholders.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/resolve.d.ts +181 -0
- package/node_modules/@allyhub-next/slides-core/dist/resolve.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/script.d.ts +43 -0
- package/node_modules/@allyhub-next/slides-core/dist/script.js +3 -0
- package/node_modules/@allyhub-next/slides-core/dist/stage.d.ts +63 -0
- package/node_modules/@allyhub-next/slides-core/dist/stage.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/strict.d.ts +23 -0
- package/node_modules/@allyhub-next/slides-core/dist/strict.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/theme.d.ts +72 -0
- package/node_modules/@allyhub-next/slides-core/dist/theme.js +2 -0
- package/node_modules/@allyhub-next/slides-core/dist/units.d.ts +35 -0
- package/node_modules/@allyhub-next/slides-core/dist/units.js +2 -0
- package/node_modules/@allyhub-next/slides-core/package.json +14 -0
- package/node_modules/@allyhub-next/video-core/dist/export.d.ts +6 -5
- package/node_modules/@allyhub-next/video-core/dist/export.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/fact.d.ts +173 -4
- package/node_modules/@allyhub-next/video-core/dist/fact.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/formats.d.ts +6 -13
- package/node_modules/@allyhub-next/video-core/dist/formats.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/index.d.ts +0 -1
- package/node_modules/@allyhub-next/video-core/dist/index.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/measure.d.ts +83 -0
- package/node_modules/@allyhub-next/video-core/dist/piece.d.ts +8 -9
- package/node_modules/@allyhub-next/video-core/dist/piece.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/problem.d.ts +5 -1
- package/node_modules/@allyhub-next/video-core/dist/problem.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/schema.d.ts +0 -2
- package/node_modules/@allyhub-next/video-core/dist/script-edit.d.ts +4 -0
- package/node_modules/@allyhub-next/video-core/dist/script.d.ts +8 -0
- package/node_modules/@allyhub-next/video-core/dist/script.js +1 -1
- package/node_modules/@allyhub-next/video-core/dist/timeline.d.ts +34 -1
- package/node_modules/@allyhub-next/video-core/package.json +1 -1
- package/package.json +15 -8
- package/node_modules/@allyhub-next/video-core/dist/slides.d.ts +0 -37
- package/node_modules/@allyhub-next/video-core/dist/slides.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
export function nodeCommand(n=process.env,o=process.versions){const e=n.ALLYHUB_NODE;if(e)return e;if(o.electron!==void 0)throw new Error("This Electron app names no Node.js (ALLYHUB_NODE): its own executable is not Node.");return process.execPath}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export interface PackagesOptions {
|
|
2
|
+
/** The cache folder (default: the system's, `cacheHome`). */
|
|
3
|
+
home?: string;
|
|
4
|
+
/** The folder of pins (default: the ones AllyHub ships). */
|
|
5
|
+
pins?: string;
|
|
6
|
+
env?: Readonly<Record<string, string | undefined>>;
|
|
7
|
+
/** What fills a folder from its package-lock.json (default: `npm ci`). */
|
|
8
|
+
install?: Install;
|
|
9
|
+
}
|
|
10
|
+
export type Install = (dir: string, options: {
|
|
11
|
+
home: string;
|
|
12
|
+
signal?: AbortSignal | undefined;
|
|
13
|
+
}) => Promise<void>;
|
|
14
|
+
export interface LocatedPackage {
|
|
15
|
+
name: string;
|
|
16
|
+
version: string;
|
|
17
|
+
/** Its folder, the one holding its `node_modules`. */
|
|
18
|
+
dir: string;
|
|
19
|
+
}
|
|
20
|
+
export interface EnsurePackageOptions {
|
|
21
|
+
signal?: AbortSignal | undefined;
|
|
22
|
+
/** Called once if the package has to be fetched, before it is. */
|
|
23
|
+
onFetch?: (name: string) => void;
|
|
24
|
+
}
|
|
25
|
+
export interface LoadOptions extends EnsurePackageOptions {
|
|
26
|
+
/** The module to load, for a pin holding several (default: the pin's name). */
|
|
27
|
+
module?: string;
|
|
28
|
+
}
|
|
29
|
+
export interface Packages {
|
|
30
|
+
readonly home: string;
|
|
31
|
+
/** A package if it is there; never fetches, and reads only its record. */
|
|
32
|
+
locate(name: string): LocatedPackage | undefined;
|
|
33
|
+
/** What a package takes on this computer, as near as its pin says (bytes). */
|
|
34
|
+
size(name: string): number;
|
|
35
|
+
/** The file `import(name)` would load, when the package is there. */
|
|
36
|
+
entry(name: string): string | undefined;
|
|
37
|
+
/** The file a module of an ensured package resolves to, which never fetches. */
|
|
38
|
+
resolve(name: string, module: string): string | undefined;
|
|
39
|
+
/** A package, fetched and checked first if it is not there. */
|
|
40
|
+
ensure(name: string, options?: EnsurePackageOptions): Promise<LocatedPackage>;
|
|
41
|
+
/** A package's module, as `import(name)` would give it, ensured first. */
|
|
42
|
+
load<T>(name: string, options?: LoadOptions): Promise<T>;
|
|
43
|
+
/** Takes a package off this computer; it comes back when next ensured. */
|
|
44
|
+
remove(name: string): Promise<void>;
|
|
45
|
+
}
|
|
46
|
+
/** A setting `npx` puts in the environment about its own install. */
|
|
47
|
+
export declare const NPX_SETTING: RegExp;
|
|
48
|
+
/** What went wrong, from what npm wrote: its reason, not its advice. */
|
|
49
|
+
export declare function npmProblem(stderr: string, code: number | null): string;
|
|
50
|
+
export interface NpmCommand {
|
|
51
|
+
command: string;
|
|
52
|
+
/** What comes before npm's own arguments: its script, when Node runs it. */
|
|
53
|
+
script: string[];
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* The npm to install with. An app that brings its own names it (bundled.ts),
|
|
57
|
+
* and `npx` names the one that runs it; else the computer's; and where it has
|
|
58
|
+
* none, as a person who only has Studio may not, the runtime manager's Node
|
|
59
|
+
* and its npm, fetched like any runtime.
|
|
60
|
+
*/
|
|
61
|
+
export declare function findNpm(env: Readonly<Record<string, string | undefined>>, ensureNode: () => Promise<Record<string, string>>): Promise<NpmCommand>;
|
|
62
|
+
/** Runs `npm ci` from the lock, keeping npm's cache in AllyHub's home. */
|
|
63
|
+
export declare const npmCi: Install;
|
|
64
|
+
export declare function createPackages(options?: PackagesOptions): Packages;
|
|
65
|
+
//# sourceMappingURL=packages.d.ts.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
+
import{spawn as _}from"node:child_process";import{createHash as T,randomBytes as H}from"node:crypto";import{existsSync as A,readFileSync as b}from"node:fs";import{copyFile as R,mkdir as E,readdir as y,readFile as C,rename as F,rm as g,writeFile as L}from"node:fs/promises";import{createRequire as I}from"node:module";import{delimiter as z,join as o}from"node:path";import{fileURLToPath as J,pathToFileURL as U}from"node:url";import{RuntimeError as k}from"./errors.js";import{cacheHome as W}from"./home.js";import{withLock as B}from"./lock.js";import{nodeCommand as D}from"./node-program.js";import{createRuntimes as M}from"./runtimes.js";const N=".allyhub-package.json",q=J(new URL("../pins/",import.meta.url));async function G(s){const c=o(s,"node_modules","onnxruntime-node","bin","napi-v6");for(const n of await y(c)){if(n!==process.platform){await g(o(c,n),{recursive:!0,force:!0});continue}for(const p of await y(o(c,n)))p!==process.arch&&await g(o(c,n,p),{recursive:!0,force:!0})}if(process.platform!=="darwin")return;const i=o(c,"darwin",process.arch);for(const n of await y(i))/^libonnxruntime\.\d+\.\d+\.\d+\.dylib$/u.test(n)&&await g(o(i,n),{force:!0})}const V={"onnxruntime-node":G};export const NPX_SETTING=/^npm_config_(global|prefix|location|cache|.*_prefix)/iu;export function npmProblem(s,c){return s.split(`
|
|
3
|
+
`).map(n=>n.replace(/^npm (error|ERR!)\s*/u,"").trim()).find(n=>n!==""&&!/^(code|errno|syscall|path|type|A complete log|Exit handler|This is an error with npm|<https)/u.test(n))??`npm ended with code ${String(c)}`}const X=(s,c)=>(c.PATH??"").split(z).some(i=>i!==""&&A(o(i,s)));export async function findNpm(s,c){const i=s.ALLYHUB_NPM??s.npm_execpath;if(i?.endsWith(".js"))return{command:D(s),script:[i]};if(X("npm",s))return{command:"npm",script:[]};const n=await c(),{node:p,npm:l}=n;if(!p||!l)throw new Error("AllyHub's Node has no npm");return{command:p,script:[l]}}export const npmCi=async(s,{home:c,signal:i})=>{const n=await findNpm(process.env,async()=>(await M({home:c}).ensure("node",{signal:i})).bins),p=Object.fromEntries(Object.entries(process.env).filter(([f])=>!NPX_SETTING.test(f))),l=["ci","--ignore-scripts","--omit=dev","--no-audit","--no-fund","--omit=peer","--loglevel=error","--fetch-retries=1"];await new Promise((f,m)=>{const w=_(n.command,[...n.script,...l],{cwd:s,env:{...p,npm_config_cache:o(c,"packages",".npm")},stdio:["ignore","ignore","pipe"],...i?{signal:i}:{}});let h="";w.stderr.on("data",v=>{h=`${h}${v.toString()}`.slice(-1e3)}),w.on("error",m),w.on("close",v=>{v===0?f():m(new Error(npmProblem(h,v)))})})};export function createPackages(s={}){const c=s.env??process.env,i=s.home??W(c),n=s.pins??q,p=s.install??npmCi,l=o(i,"packages"),f=e=>{const r=o(n,e);let t,a;try{t=JSON.parse(b(o(r,"package.json"),"utf8")),a=b(o(r,"package-lock.json"),"utf8")}catch{throw new k("unknown-package",`AllyHub has no package "${e}".`)}const u=t.dependencies??{},d=u[e]??t.version;if(!d)throw new k("unknown-package",`The pin of "${e}" does not name it.`);return{version:d,holds:u,lock:T("sha256").update(a).digest("hex"),dir:r,size:t.allyhubSize??0}},m=(e,r)=>o(l,`${e}@${r.version}`),w=(e,r)=>{try{const t=JSON.parse(b(o(m(e,r),N),"utf8"));return t.version===r.version&&t.lock===r.lock}catch{return!1}},h=(e,r)=>({name:e,version:r.version,dir:m(e,r)}),v=async(e,r,t)=>{const a=m(e,r),u=`${a}.partial-${String(process.pid)}-${H(4).toString("hex")}`;await E(u,{recursive:!0});try{await R(o(r.dir,"package.json"),o(u,"package.json")),await R(o(r.dir,"package-lock.json"),o(u,"package-lock.json")),await p(u,{home:i,signal:t});for(const[d,j]of Object.entries(r.holds)){const O=JSON.parse(await C(o(u,"node_modules",d,"package.json"),"utf8"));if(O.version!==j)throw new Error(`it holds ${d} ${String(O.version)}, not ${j}`)}await V[e]?.(u),await L(o(u,N),`${JSON.stringify({version:r.version,lock:r.lock,at:new Date().toISOString()})}
|
|
4
|
+
`),await g(a,{recursive:!0,force:!0}),await F(u,a),await P(e,r)}catch(d){throw await g(u,{recursive:!0,force:!0}),t?.aborted?new k("cancelled",`Stopped getting ${e}.`,{cause:d}):new k("install",`Could not get ${e} ${r.version} (${d instanceof Error?d.message:String(d)}). Check the connection and run it again.`,{cause:d})}},P=async(e,r)=>{const t=`${e}@${r.version}`;for(const a of await y(l))a.startsWith(`${e}@`)&&a!==t&&!a.startsWith(`${t}.`)&&await g(o(l,a),{recursive:!0,force:!0})},$=e=>{const r=f(e);return w(e,r)?h(e,r):void 0},S=(e,r)=>I(o(e,"package.json")).resolve(r),x=async(e,r={})=>{const t=f(e);return w(e,t)||(await E(l,{recursive:!0}).catch(a=>{throw new k("install",`Could not get ${e} ${t.version}: AllyHub cannot write to ${l}.`,{cause:a})}),await B(`${m(e,t)}.lock`,async()=>{w(e,t)||(r.onFetch?.(e),await v(e,t,r.signal))},{signal:r.signal})),h(e,t)};return{home:i,locate:$,ensure:x,size:e=>f(e).size,entry(e){const r=$(e);return r?S(r.dir,e):void 0},resolve(e,r){const t=$(e);return t?S(t.dir,r):void 0},async load(e,r){const{dir:t}=await x(e,r),a=S(t,r?.module??e);return await import(U(a).href)},async remove(e){await g(m(e,f(e)),{recursive:!0,force:!0})}}}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{randomBytes as P}from"node:crypto";import{chmod as B,mkdir as S,readFile as D,rename as x,rm as
|
|
3
|
-
`),await
|
|
2
|
+
import{randomBytes as P}from"node:crypto";import{chmod as B,mkdir as S,readFile as D,rename as x,rm as v,writeFile as M}from"node:fs/promises";import{dirname as J,join as u}from"node:path";import{binsOf as L,filesFor as U,platformOf as _}from"@allyhub-next/protocol";import{download as T,sha256Of as V}from"./download.js";import{RuntimeError as p}from"./errors.js";import{cacheHome as Y}from"./home.js";import{withLock as q}from"./lock.js";import{shippedManifest as G}from"./manifest.js";import{inside as A,native as K,undmg as Q,untgz as W,unzip as X}from"./unpack.js";const C=".allyhub-runtime.json";export const binVariable=f=>`ALLYHUB_${f.toUpperCase().replaceAll("-","_")}`;export function createRuntimes(f={}){const j=f.env??process.env,z=f.home??Y(j),b=f.manifest??G(),l="platform"in f?f.platform:_(process.platform,process.arch),F=f.fetch??globalThis.fetch,$=u(z,"runtimes"),O=t=>{const e=Object.hasOwn(b.runtimes,t)?b.runtimes[t]:void 0;if(!e)throw new p("unknown-runtime",`AllyHub has no runtime "${t}".`);return e},d=(t,e)=>u($,`${t}@${e.version}`),h=(t,e)=>{const r=l?U(e,l):void 0;if(!r)throw new p("unsupported",`${t} ${e.version} has no build for ${l??`${process.platform}-${process.arch}`}.`);return r},H=(t,e,r)=>Object.fromEntries(Object.entries(L(h(t,e))).map(([n,s])=>[n,u(r,K(s))])),R=(t,e)=>{const r=[...new Set(Object.values(e.platforms).flatMap(a=>Object.keys(L(a))))];if(r.length===0)return;const n=r.map(a=>[a,j[binVariable(a)]]);if(n.some(([,a])=>!a))return;const s=Object.fromEntries(n),o=n[0]?.[1]??"";return{name:t,version:void 0,dir:J(o),bins:s,from:"env"}},y=async(t,e)=>{try{const r=JSON.parse(await D(u(d(t,e),C),"utf8")),n=h(t,e).map(s=>s.sha256);return r.version===e.version&&JSON.stringify(r.files)===JSON.stringify(n)}catch{return!1}},k=async t=>{const e=O(t),r=R(t,e);if(r)return r;if(!await y(t,e))return;const n=d(t,e);return{name:t,version:e.version,dir:n,bins:H(t,e,n),from:"cache"}},I=async(t,e,r)=>{const n=h(t,e),s=d(t,e),o=`${s}.partial-${String(process.pid)}-${P(4).toString("hex")}`,a=u(o,".downloads");await S(a,{recursive:!0});try{for(const[w,i]of n.entries()){const m=u(a,String(w));if(await T(i.url,m,{size:i.size,sha256:i.sha256,fetch:F,signal:r.signal,onProgress:(c,g)=>{r.onProgress?.({runtime:t,url:i.url,received:c,total:g})}}),i.unpack==="zip")await X(m,o);else if(i.unpack==="tgz")await W(m,o);else if(i.unpack==="dmg")await Q(m,o);else{const c=A(o,i.name??Z(i.url));if(!c)throw new p("unpack",`${i.url} would be kept outside its folder.`);await S(J(c),{recursive:!0}),await x(m,c),i.executable&&await B(c,493)}for(const c of i.check){const g=A(o,c.path),N=g?await V(g).catch(()=>"missing"):"missing";if(N!==c.sha256)throw new p("checksum",`${c.path} from ${i.url} has sha256 ${N}; its pin is ${c.sha256}.`)}}await v(a,{recursive:!0,force:!0}),await M(u(o,C),`${JSON.stringify({version:e.version,files:n.map(w=>w.sha256),at:new Date().toISOString()})}
|
|
3
|
+
`),await v(s,{recursive:!0,force:!0}),await x(o,s)}catch(w){throw await v(o,{recursive:!0,force:!0}),w}},E=async(t,e={})=>{const r=O(t),n=await k(t);if(n)return n;h(t,r),await S($,{recursive:!0}),await q(`${d(t,r)}.lock`,async()=>{await y(t,r)||await I(t,r,e)},{signal:e.signal});const s=await k(t);if(!s)throw new p("download",`${t} was installed but cannot be found in ${$}.`);return s};return{home:z,platform:l,locate:k,ensure:E,async bin(t,e,r){const s=(await E(t,r)).bins[e];if(!s)throw new p("unknown-runtime",`${t} holds no program "${e}".`);return s},async remove(t){const e=O(t);await v(d(t,e),{recursive:!0,force:!0})},async status(){return Promise.all(Object.entries(b.runtimes).map(async([t,e])=>{const r=l?U(e,l):void 0,n=d(t,e),s=R(t,e)!==void 0?"env":r!==void 0&&await y(t,e)?"cache":void 0;return{name:t,about:e.about,version:e.version,license:e.license,available:r!==void 0,installed:s!==void 0,...s?{from:s}:{},size:(r??[]).reduce((o,a)=>o+a.size,0),dir:n}}))}}}const Z=f=>decodeURIComponent(new URL(f).pathname.split("/").pop()??"file");
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
export declare function inside(dir: string, entry: string): string | undefined;
|
|
3
3
|
export declare function unzip(file: string, dir: string): Promise<void>;
|
|
4
4
|
export declare function untgz(file: string, dir: string): Promise<void>;
|
|
5
|
+
/**
|
|
6
|
+
* A macOS disk image's items (an app) copied into `dir`: the image is
|
|
7
|
+
* attached read-only where nothing opens it, each item that is not a link
|
|
8
|
+
* (the Applications shortcut is one) copied with ditto, which keeps an
|
|
9
|
+
* app's own links and signatures, and the image detached.
|
|
10
|
+
*/
|
|
11
|
+
export declare function undmg(file: string, dir: string): Promise<void>;
|
|
5
12
|
/** A path in its system's spelling, from a manifest's forward slashes. */
|
|
6
13
|
export declare const native: (path: string) => string;
|
|
7
14
|
//# sourceMappingURL=unpack.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! AllyHub. Copyright (c) 2026 AllyHub, Inc. All rights reserved. Use is subject to LICENSE.md. */
|
|
2
|
-
import{createWriteStream as
|
|
2
|
+
import{createWriteStream as h}from"node:fs";import{execFile as k}from"node:child_process";import{chmod as $,mkdir as f,mkdtemp as y,readdir as g,rm as x}from"node:fs/promises";import{tmpdir as z}from"node:os";import{dirname as S,isAbsolute as l,join as m,normalize as b,relative as E,sep as v}from"node:path";import{pipeline as W}from"node:stream/promises";import{extract as j}from"tar";import A from"yauzl";import{RuntimeError as u}from"./errors.js";export function inside(e,r){if(r.includes("\0")||l(r)||/^[A-Za-z]:/u.test(r))return;const t=b(m(e,r)),i=E(e,t);if(!(i===""||i.startsWith("..")||l(i)))return t}export async function unzip(e,r){const t=await new Promise((i,a)=>{A.open(e,{lazyEntries:!0,autoClose:!0},(n,o)=>{n?a(new u("unpack",`${e} is not a zip: ${n.message}`,{cause:n})):i(o)})});await new Promise((i,a)=>{const n=o=>{t.close(),a(o instanceof u?o:new u("unpack",`Unpacking ${e} failed: ${String(o)}`,{cause:o}))};t.on("error",n),t.on("end",()=>{i()}),t.on("entry",o=>{const c=o.fileName.split("\\").join("/"),s=inside(r,c);if(!s){n(new u("unpack",`${e} holds ${c}, outside its folder.`));return}const p=o.externalFileAttributes>>>16&65535;if((p&61440)===40960){n(new u("unpack",`${e} holds a link, ${c}.`));return}if(c.endsWith("/")){f(s,{recursive:!0}).then(()=>{t.readEntry()},n);return}t.openReadStream(o,(d,w)=>{if(d){n(d);return}f(S(s),{recursive:!0}).then(()=>W(w,h(s))).then(()=>p&73?$(s,493):void 0).then(()=>{t.readEntry()},n)})}),t.readEntry()})}export async function untgz(e,r){try{await j({file:e,cwd:r,strict:!0,filter:(t,i)=>{const a="type"in i?i.type:void 0;return inside(r,t)!==void 0&&a!=="SymbolicLink"&&a!=="Link"}})}catch(t){throw new u("unpack",`Unpacking ${e} failed: ${t instanceof Error?t.message:String(t)}`,{cause:t})}}export async function undmg(e,r){if(process.platform!=="darwin")throw new u("unpack",`${e} is a macOS disk image.`);const t=await y(m(z(),"allyhub-dmg-")),i=(a,n)=>new Promise((o,c)=>{k(a,n,s=>{s?c(new u("unpack",`${a} ${n[0]??""} ${e} failed: ${s.message}`,{cause:s})):o()})});await i("hdiutil",["attach","-nobrowse","-readonly","-noautoopen","-mountpoint",t,e]);try{for(const a of await g(t,{withFileTypes:!0})){if(a.isSymbolicLink()||a.name.startsWith("."))continue;const n=inside(r,a.name);n&&await i("ditto",[m(t,a.name),n])}}finally{await i("hdiutil",["detach",t,"-force"]).catch(()=>{}),await x(t,{recursive:!0,force:!0})}}export const native=e=>e.split("/").join(v);
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@allyhub-next/runtimes",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
8
8
|
"default": "./dist/index.js"
|
|
9
9
|
},
|
|
10
|
+
"./node": {
|
|
11
|
+
"types": "./dist/node-program.d.ts",
|
|
12
|
+
"default": "./dist/node-program.js"
|
|
13
|
+
},
|
|
10
14
|
"./manifest.json": "./manifest.json"
|
|
11
15
|
},
|
|
12
16
|
"private": true,
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "allyhub-pin-docx",
|
|
3
|
+
"lockfileVersion": 3,
|
|
4
|
+
"requires": true,
|
|
5
|
+
"packages": {
|
|
6
|
+
"": {
|
|
7
|
+
"name": "allyhub-pin-docx",
|
|
8
|
+
"dependencies": {
|
|
9
|
+
"docx": "9.15.1",
|
|
10
|
+
"fflate": "0.8.3"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"node_modules/@types/node": {
|
|
14
|
+
"version": "26.6.6",
|
|
15
|
+
"resolved": "https://registry.npmjs.org/@types/node/-/node-26.6.6.tgz",
|
|
16
|
+
"integrity": "sha512-MzQj+8Kx3XI40OmUAE6Qoh58ZMNstNNMwn2nfd3qWsfe7nDNSqJNzes4njhz6AHwrSHOffSLwXU6yb474Q4aog==",
|
|
17
|
+
"license": "MIT",
|
|
18
|
+
"dependencies": {
|
|
19
|
+
"undici-types": "~8.9.0"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"node_modules/docx": {
|
|
23
|
+
"version": "9.15.1",
|
|
24
|
+
"resolved": "https://registry.npmjs.org/docx/-/docx-9.15.1.tgz",
|
|
25
|
+
"integrity": "sha512-wp8K+wsDov+gjtIE4fA7g4SkCcuefIjwdYUc2OYa8YViCqxKvbASwSODpUXsTIH5BCmoWw7cMVOB1xl3A7Uqig==",
|
|
26
|
+
"license": "MIT",
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@types/node": "^26.6.2",
|
|
29
|
+
"fflate": "^0.8.3",
|
|
30
|
+
"nanoid": "^6.0.1"
|
|
31
|
+
},
|
|
32
|
+
"engines": {
|
|
33
|
+
"node": ">=16"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"node_modules/fflate": {
|
|
37
|
+
"version": "0.8.3",
|
|
38
|
+
"resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.3.tgz",
|
|
39
|
+
"integrity": "sha512-tbZNuJrLwGUp3zshBtdy4W+ORxZuIh8a5ilyIEQDC5rY1f3U20JMry0Ll3WBzU58EZKsEuJFXhb5gwv8CsPvgA==",
|
|
40
|
+
"license": "MIT"
|
|
41
|
+
},
|
|
42
|
+
"node_modules/nanoid": {
|
|
43
|
+
"version": "6.0.2",
|
|
44
|
+
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-6.0.2.tgz",
|
|
45
|
+
"integrity": "sha512-hIvVOb9Qr1p/9CNNLOe0OlWvgx/ziTsVwKN/GDSsuArN2K0wDiafP3s0SWmsm7o2BdnyS8Z9Z64NFBUbn6ziBg==",
|
|
46
|
+
"funding": [
|
|
47
|
+
{
|
|
48
|
+
"type": "github",
|
|
49
|
+
"url": "https://github.com/sponsors/ai"
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"bin": {
|
|
54
|
+
"nanoid": "bin/nanoid.js"
|
|
55
|
+
},
|
|
56
|
+
"engines": {
|
|
57
|
+
"node": "^22 || ^24 || >=26"
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
"node_modules/undici-types": {
|
|
61
|
+
"version": "8.9.0",
|
|
62
|
+
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-8.9.0.tgz",
|
|
63
|
+
"integrity": "sha512-KTDyRTYX8sWmKXAikPHHSyc63CRPETMctyjKFupcC6OBLXT3xsN0e9aF7m+mIXutFWpUXuedtowG7iLOzp0kQg==",
|
|
64
|
+
"license": "MIT"
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|