@haex-space/vault-sdk 4.1.0 → 4.3.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/README.md +69 -0
- package/dist/cli/index.js +2 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/index.mjs +2 -1
- package/dist/cli/index.mjs.map +1 -1
- package/dist/{client-Cx4ZyQFL.d.mts → client-CDox5_KH.d.mts} +263 -27
- package/dist/{client-CD5QZi7F.d.ts → client-pppDo5Q3.d.ts} +263 -27
- package/dist/haex_bundle_bg.wasm +0 -0
- package/dist/index.d.mts +45 -6
- package/dist/index.d.ts +45 -6
- package/dist/index.js +363 -14
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +360 -15
- package/dist/index.mjs.map +1 -1
- package/dist/node.d.mts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +2 -1
- package/dist/node.js.map +1 -1
- package/dist/node.mjs +2 -1
- package/dist/node.mjs.map +1 -1
- package/dist/nuxt.js +10 -2
- package/dist/nuxt.js.map +1 -1
- package/dist/nuxt.mjs +10 -2
- package/dist/nuxt.mjs.map +1 -1
- package/dist/react.d.mts +2 -2
- package/dist/react.d.ts +2 -2
- package/dist/react.js +339 -14
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +339 -14
- package/dist/react.mjs.map +1 -1
- package/dist/runtime/nuxt.plugin.client.d.mts +2 -2
- package/dist/runtime/nuxt.plugin.client.d.ts +2 -2
- package/dist/runtime/nuxt.plugin.client.js +329 -14
- package/dist/runtime/nuxt.plugin.client.js.map +1 -1
- package/dist/runtime/nuxt.plugin.client.mjs +329 -14
- package/dist/runtime/nuxt.plugin.client.mjs.map +1 -1
- package/dist/svelte.d.mts +2 -2
- package/dist/svelte.d.ts +2 -2
- package/dist/svelte.js +339 -14
- package/dist/svelte.js.map +1 -1
- package/dist/svelte.mjs +339 -14
- package/dist/svelte.mjs.map +1 -1
- package/dist/{types-BwFKGH70.d.mts → types-DoNvKiW_.d.mts} +75 -1
- package/dist/{types-BwFKGH70.d.ts → types-DoNvKiW_.d.ts} +75 -1
- package/dist/vite.js +8 -1
- package/dist/vite.js.map +1 -1
- package/dist/vite.mjs +8 -1
- package/dist/vite.mjs.map +1 -1
- package/dist/vue.d.mts +2 -2
- package/dist/vue.d.ts +2 -2
- package/dist/vue.js +339 -14
- package/dist/vue.js.map +1 -1
- package/dist/vue.mjs +339 -14
- package/dist/vue.mjs.map +1 -1
- package/package.json +1 -1
package/dist/node.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.mjs';
|
|
2
|
-
import { a as ExtensionManifest } from './types-
|
|
2
|
+
import { a as ExtensionManifest } from './types-DoNvKiW_.mjs';
|
|
3
3
|
|
|
4
4
|
interface ReadManifestOptions {
|
|
5
5
|
/** Root directory of the project */
|
package/dist/node.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { H as HaextensionConfig, g as getExtensionDir, r as readHaextensionConfig } from './config-D_HXjsEV.js';
|
|
2
|
-
import { a as ExtensionManifest } from './types-
|
|
2
|
+
import { a as ExtensionManifest } from './types-DoNvKiW_.js';
|
|
3
3
|
|
|
4
4
|
interface ReadManifestOptions {
|
|
5
5
|
/** Root directory of the project */
|
package/dist/node.js
CHANGED
|
@@ -66,7 +66,8 @@ function readManifest(options) {
|
|
|
66
66
|
singleInstance: parsed.singleInstance ?? null,
|
|
67
67
|
displayMode: parsed.displayMode ?? null,
|
|
68
68
|
migrationsDir: parsed.migrationsDir ?? null,
|
|
69
|
-
i18n: parsed.i18n ?? null
|
|
69
|
+
i18n: parsed.i18n ?? null,
|
|
70
|
+
tools: parsed.tools ?? null
|
|
70
71
|
};
|
|
71
72
|
console.log(`\u2713 [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);
|
|
72
73
|
return manifest;
|
package/dist/node.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/config.ts","../src/manifest.ts","../src/bundle/wasm/haex_bundle.js","../src/bundle/index.ts"],"names":["resolve","existsSync","readFileSync","resolvePath","ptr","join"],"mappings":";;;;;;AAiCO,SAAS,qBAAA,CAAsB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAA6B;AAC/F,EAAA,MAAM,UAAA,GAAaA,YAAA,CAAQ,OAAA,EAAS,yBAAyB,CAAA;AAE7D,EAAA,IAAI,CAACC,aAAA,CAAW,UAAU,CAAA,EAAG;AAC3B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAAUC,eAAA,CAAa,UAAA,EAAY,OAAO,CAAA;AAChD,IAAA,OAAO,IAAA,CAAK,MAAM,OAAO,CAAA;AAAA,EAC3B,SAAS,KAAA,EAAO;AACd,IAAA,OAAA,CAAQ,IAAA,CAAK,CAAA,yCAAA,EAA4C,KAAK,CAAA,CAAE,CAAA;AAChE,IAAA,OAAO,IAAA;AAAA,EACT;AACF;AAKO,SAAS,eAAA,CAAgB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAAW;AACvE,EAAA,MAAM,MAAA,GAAS,sBAAsB,OAAO,CAAA;AAC5C,EAAA,OAAO,MAAA,EAAQ,KAAK,eAAA,IAAmB,aAAA;AACzC;ACnCO,SAAS,aAAa,OAAA,EAAwD;AACnF,EAAA,MAAM,EAAE,OAAA,EAAS,YAAA,EAAc,YAAA,GAAe,eAAc,GAAI,OAAA;AAGhE,EAAA,MAAM,oBAAA,GAAuB,eACzBC,YAAA,CAAY,OAAA,EAAS,YAAY,CAAA,GACjCA,YAAA,CAAY,OAAA,EAAS,YAAA,EAAc,eAAe,CAAA;AAEtD,EAAA,IAAI;AACF,IAAA,MAAM,eAAA,GAAkBD,eAAAA,CAAa,oBAAA,EAAsB,OAAO,CAAA;AAElE,IAAA,MAAM,EAAE,WAAW,gBAAA,EAAkB,GA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EAAS,MAAA,CAAO,IAAI,CAAA;AACjF,EAAA,OAAO,EAAE,UAAU,MAAA,CAAO,QAAA,EAAU,OAAO,MAAA,CAAO,KAAA,EAAO,UAAA,EAAY,MAAA,CAAO,UAAA,EAAW;AACzF;AAGA,IAAM,cAAA,GAAiB,wEAAA;AAOhB,SAAS,WAAA,CACd,KAAA,EACA,QAAA,EACA,eAAA,EACY;AACZ,EAAA,KAAA,MAAW,QAAQ,KAAA,EAAO;AACxB,IAAA,IAAI,cAAA,CAAe,IAAA,CAAK,IAAA,CAAK,IAAI,CAAA,EAAG;AAClC,MAAA,MAAM,IAAI,WAAA,CAAY,oBAAA,EAAsB,4CAAA,EAA8C,KAAK,IAAI,CAAA;AAAA,IACrG;AAAA,EACF;AACA,EAAA,OAAO,SAAS,MAAM;AACpB,IAAA,MAAM,OAAA,GAAU,IAAI,aAAA,EAAc;AAClC,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO,OAAA,CAAQ,QAAQ,IAAA,CAAK,IAAA,EAAM,KAAK,IAAI,CAAA;AAC9D,IAAA,IAAI;AACF,MAAA,OAAO,QAAQ,KAAA,CAAM,IAAA,CAAK,SAAA,CAAU,QAAQ,GAAG,eAAe,CAAA;AAAA,IAChE,SAAS,KAAA,EAAO;AACd,MAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,MAAM,KAAA;AACrC,MAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,MAAK,GAAI,IAAA,CAAK,MAAM,KAAK,CAAA;AAChD,MAAA,MAAM,IAAI,WAAA,CAAY,IAAA,EAAM,OAAA,EAAS,IAAI,CAAA;AAAA,IAC3C;AAAA,EACF,CAAC,CAAA;AACH","file":"node.js","sourcesContent":["/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n","/**\n * Utility for reading and processing extension manifest files\n */\nimport { readFileSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { ExtensionManifest } from \"./types\";\n\nexport interface ReadManifestOptions {\n /** Root directory of the project */\n rootDir: string;\n /** Path to manifest.json (if not provided, will use extensionDir) */\n manifestPath?: string;\n /** Directory containing extension files (default: \"haextension\") */\n extensionDir?: string;\n}\n\n/**\n * Reads and processes the extension manifest.json file\n * Falls back to package.json version if manifest doesn't specify one\n */\nexport function readManifest(options: ReadManifestOptions): ExtensionManifest | null {\n const { rootDir, manifestPath, extensionDir = \"haextension\" } = options;\n\n // Determine manifest path\n const resolvedManifestPath = manifestPath\n ? resolvePath(rootDir, manifestPath)\n : resolvePath(rootDir, extensionDir, \"manifest.json\");\n\n try {\n const manifestContent = readFileSync(resolvedManifestPath, \"utf-8\");\n // `signature` belonged to the pre-v2 bundle format; signing now writes `haextension/signature.json`.\n const { signature: _legacySignature, ...parsed } = JSON.parse(manifestContent) as Partial<ExtensionManifest> & {\n signature?: unknown;\n };\n\n // Read fallback values from package.json\n let packageJson: { name?: string; version?: string; author?: string; homepage?: string } = {};\n try {\n const packageJsonPath = resolvePath(rootDir, \"package.json\");\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n } catch {\n console.warn(`[@haex-space/vault-sdk] Warning: Could not read package.json`);\n }\n\n // Always use package.json name as stable technical identifier\n // Display names are handled via i18n in the manifest\n const name = packageJson.name;\n const version = parsed.version ?? packageJson.version;\n const author = parsed.author ?? packageJson.author ?? null;\n const homepage = parsed.homepage ?? packageJson.homepage ?? null;\n\n if (!name) {\n console.warn(`[@haex-space/vault-sdk] Warning: No name found in manifest or package.json`);\n return null;\n }\n\n if (!version) {\n console.warn(`[@haex-space/vault-sdk] Warning: No version found in manifest or package.json`);\n return null;\n }\n\n const manifest: ExtensionManifest = {\n // Keep every field the developer wrote (e.g. displayName); the fallbacks below win.\n ...parsed,\n name,\n version,\n author,\n entry: parsed.entry ?? null,\n icon: parsed.icon ?? null,\n publicKey: parsed.publicKey ?? \"\",\n permissions: parsed.permissions ?? {\n database: [],\n filesystem: [],\n http: [],\n shell: [],\n },\n homepage,\n description: parsed.description ?? null,\n singleInstance: parsed.singleInstance ?? null,\n displayMode: parsed.displayMode ?? null,\n migrationsDir: parsed.migrationsDir ?? null,\n i18n: parsed.i18n ?? null,\n };\n\n console.log(`✓ [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);\n return manifest;\n } catch {\n console.warn(\n `[@haex-space/vault-sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`\n );\n return null;\n }\n}\n","/* @ts-self-types=\"./haex_bundle.d.ts\" */\n\n/**\n * Collects the files of a bundle and builds the signed archive.\n */\nexport class BundleBuilder {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BundleBuilderFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_bundlebuilder_free(ptr, 0);\n }\n /**\n * Adds an app file (no control file).\n * @param {string} path\n * @param {Uint8Array} data\n */\n addFile(path, data) {\n const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n wasm.bundlebuilder_addFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);\n }\n /**\n * Signs with the PKCS#8 Ed25519 key, writes the archive and verifies it. `manifest_json` is\n * the manifest without `signature`; its `publicKey` is set from the key. Throws the JSON of a\n * `BundleError` (`{kind, message, path?}`).\n * @param {string} manifest_json\n * @param {Uint8Array} private_key_pkcs8\n * @returns {Uint8Array}\n */\n build(manifest_json, private_key_pkcs8) {\n try {\n const ptr = this.__destroy_into_raw();\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(manifest_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(private_key_pkcs8, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n wasm.bundlebuilder_build(retptr, ptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n if (r3) {\n throw takeObject(r2);\n }\n var v3 = getArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export3(r0, r1 * 1, 1);\n return v3;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n constructor() {\n const ret = wasm.bundlebuilder_new();\n this.__wbg_ptr = ret;\n BundleBuilderFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n}\nif (Symbol.dispose) BundleBuilder.prototype[Symbol.dispose] = BundleBuilder.prototype.free;\n\n/**\n * Every error kind as JSON array, so the SDK can test its `BundleErrorKind` type against it.\n * @returns {string}\n */\nexport function errorKinds() {\n let deferred1_0;\n let deferred1_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.errorKinds(retptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred1_0 = r0;\n deferred1_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);\n }\n}\n\n/**\n * Largest archive a host accepts, so callers can refuse a bigger file before reading it.\n * @returns {number}\n */\nexport function maxArchiveBytes() {\n const ret = wasm.maxArchiveBytes();\n return ret;\n}\n\n/**\n * Verifies a `.xt` archive exactly like a host does. Returns\n * `{\"valid\":true,\"manifest\":…,\"files\":[…],\"migrations\":[…]}` or\n * `{\"valid\":false,\"kind\":…,\"message\":…,\"path\"?:…}`.\n * @param {Uint8Array} archive\n * @returns {string}\n */\nexport function verifyArchive(archive) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(archive, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.verifyArchive(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);\n }\n}\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbindgen_generic_0000000000000001: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n };\n return {\n __proto__: null,\n \"./haex_bundle_bg.js\": import0,\n };\n}\n\nconst BundleBuilderFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_bundlebuilder_free(ptr, 1));\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction dropObject(idx) {\n if (idx < 1028) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return decodeText(ptr >>> 0, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap = new Array(1024).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n };\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasmInstance, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasmInstance = instance;\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (!module.ok) {\n throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);\n }\n\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (module_or_path === undefined) {\n module_or_path = new URL('haex_bundle_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n","/**\n * Bundle format `haextension-bundle/2` for the `haex` tool (Node.js only).\n *\n * Every rule lives in the Rust crate `crates/haex-bundle`, which hosts such as holzi use natively;\n * this module only calls its WebAssembly build (`pnpm build:wasm`). Nothing of the format is\n * implemented here, so the tool and the hosts cannot drift apart.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { BundleBuilder, initSync, maxArchiveBytes, verifyArchive } from \"./wasm/haex_bundle\";\n\nexport const BUNDLE_FILE_EXTENSION = \".xt\";\n\n/** The error kinds of the crate (`ErrorKind::ALL`, checked by `src/bundle/__tests__/wasm.test.ts`). */\nexport const BUNDLE_ERROR_KINDS = [\n \"archive_too_large\",\n \"archive_invalid\",\n \"entry_path_invalid\",\n \"entry_duplicate\",\n \"entry_too_large\",\n \"entry_ratio\",\n \"entry_kind\",\n \"manifest_not_canonical\",\n \"manifest_invalid\",\n \"file_mismatch\",\n \"public_key_mismatch\",\n \"signature_invalid\",\n \"legacy_signature_format\",\n] as const;\n\nexport type BundleErrorKind = (typeof BUNDLE_ERROR_KINDS)[number];\n\n/** One file of a bundle: its path inside the archive and its exact bytes. */\nexport interface BundleEntry {\n path: string;\n data: Uint8Array;\n}\n\nexport interface SignedFile {\n path: string;\n sha256: string;\n size: number;\n}\n\nexport interface VerifiedBundle {\n manifest: Record<string, unknown>;\n /** Every entry except `signature.json`, in UTF-8 byte order. */\n files: SignedFile[];\n /** The migrations in the order they apply. */\n migrations: { name: string; path: string }[];\n}\n\n/**\n * A rejected bundle. `kind` is one of the error kinds of `test-vectors/bundles/README.md`;\n * `path` names the entry for entry-level errors and the first differing file for `file_mismatch`.\n */\nexport class BundleError extends Error {\n constructor(\n public readonly kind: BundleErrorKind,\n message: string,\n public readonly path?: string,\n ) {\n super(`${kind}: ${message}`);\n this.name = \"BundleError\";\n }\n}\n\nconst WASM_FILE = \"haex_bundle_bg.wasm\";\n\n/**\n * The module ships once as `dist/haex_bundle_bg.wasm`. The bundled entries live in `dist/` and\n * `dist/cli/`; from the sources (tests) it is the generated `wasm/` folder next to this file.\n */\nfunction wasmPath(): string {\n const candidates = [join(__dirname, WASM_FILE), join(__dirname, \"..\", WASM_FILE), join(__dirname, \"wasm\", WASM_FILE)];\n const found = candidates.find((candidate) => existsSync(candidate));\n if (!found) throw new Error(`${WASM_FILE} not found next to ${__dirname}; run \\`pnpm build:wasm\\``);\n return found;\n}\n\nlet state: \"new\" | \"ready\" | \"crashed\" = \"new\";\n\n/**\n * Runs `call` in the module. A panic in Rust traps (`panic = \"abort\"`) and leaves the instance in\n * an undefined state, so the module is not used again in this process.\n */\nfunction inModule<T>(call: () => T): T {\n if (state === \"crashed\") throw new Error(\"haex-bundle crashed earlier in this process; restart it\");\n if (state === \"new\") {\n initSync({ module: readFileSync(wasmPath()) });\n state = \"ready\";\n }\n try {\n return call();\n } catch (error) {\n if (error instanceof WebAssembly.RuntimeError) {\n state = \"crashed\";\n throw new Error(`haex-bundle crashed (a bug, please report it): ${error.message}`, { cause: error });\n }\n throw error;\n }\n}\n\n/** Largest `.xt` file a host accepts; check it before reading a file into memory. */\nexport function maxBundleBytes(): number {\n return inModule(() => maxArchiveBytes());\n}\n\n/** Verifies a `.xt` archive exactly like a host does. Throws a `BundleError` for the first failing rule. */\nexport function verifyBundle(archive: Uint8Array): VerifiedBundle {\n const result = JSON.parse(inModule(() => verifyArchive(archive))) as\n | ({ valid: true } & VerifiedBundle)\n | { valid: false; kind: BundleErrorKind; message: string; path?: string };\n if (!result.valid) throw new BundleError(result.kind, result.message, result.path);\n return { manifest: result.manifest, files: result.files, migrations: result.migrations };\n}\n\n/** A lone UTF-16 surrogate, which would silently become U+FFFD on the way into the module. */\nconst LONE_SURROGATE = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/;\n\n/**\n * Signs the app files with the manifest (without `signature`; its `publicKey` is set from the\n * key), writes the deterministic archive and verifies it. `privateKeyPkcs8` is the Ed25519 key\n * as `haex keygen` writes it. Throws a `BundleError`.\n */\nexport function buildBundle(\n files: readonly BundleEntry[],\n manifest: Record<string, unknown>,\n privateKeyPkcs8: Uint8Array,\n): Uint8Array {\n for (const file of files) {\n if (LONE_SURROGATE.test(file.path)) {\n throw new BundleError(\"entry_path_invalid\", \"path is not valid Unicode (lone surrogate)\", file.path);\n }\n }\n return inModule(() => {\n const builder = new BundleBuilder();\n for (const file of files) builder.addFile(file.path, file.data);\n try {\n return builder.build(JSON.stringify(manifest), privateKeyPkcs8);\n } catch (error) {\n if (typeof error !== \"string\") throw error;\n const { kind, message, path } = JSON.parse(error) as { kind: BundleErrorKind; message: string; path?: string };\n throw new BundleError(kind, message, path);\n }\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/config.ts","../src/manifest.ts","../src/bundle/wasm/haex_bundle.js","../src/bundle/index.ts"],"names":["resolve","existsSync","readFileSync","resolvePath","ptr","join"],"mappings":";;;;;;AAiCO,SAAS,qBAAA,CAAsB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAA6B;AAC/F,EAAA,MAAM,UAAA,GAAaA,YAAA,CAAQ,OAAA,EAAS,yBAAyB,CAAA;AAE7D,EAAA,IAAI,CAACC,aAAA,CAAW,UAAU,CAAA,EAAG;AAC3B,IAAA,OAAO,IAAA;AAAA,EACT;AAEA,EAAA,IAAI;AACF,IAAA,MAAM,OAAA,GAAUC,eAAA,CAAa,UAAA,EAAY,OAAO,CAAA;AAChD,IAAA,OAAO,IAAA,CAAK,MAAM,OAAO,CAAA;AAAA,EAC3B,SAAS,K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,MAAM;AACpB,IAAA,MAAM,OAAA,GAAU,IAAI,aAAA,EAAc;AAClC,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO,OAAA,CAAQ,QAAQ,IAAA,CAAK,IAAA,EAAM,KAAK,IAAI,CAAA;AAC9D,IAAA,IAAI;AACF,MAAA,OAAO,QAAQ,KAAA,CAAM,IAAA,CAAK,SAAA,CAAU,QAAQ,GAAG,eAAe,CAAA;AAAA,IAChE,SAAS,KAAA,EAAO;AACd,MAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,MAAM,KAAA;AACrC,MAAA,MAAM,EAAE,IAAA,EAAM,OAAA,EAAS,MAAK,GAAI,IAAA,CAAK,MAAM,KAAK,CAAA;AAChD,MAAA,MAAM,IAAI,WAAA,CAAY,IAAA,EAAM,OAAA,EAAS,IAAI,CAAA;AAAA,IAC3C;AAAA,EACF,CAAC,CAAA;AACH","file":"node.js","sourcesContent":["/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n","/**\n * Utility for reading and processing extension manifest files\n */\nimport { readFileSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { ExtensionManifest } from \"./types\";\n\nexport interface ReadManifestOptions {\n /** Root directory of the project */\n rootDir: string;\n /** Path to manifest.json (if not provided, will use extensionDir) */\n manifestPath?: string;\n /** Directory containing extension files (default: \"haextension\") */\n extensionDir?: string;\n}\n\n/**\n * Reads and processes the extension manifest.json file\n * Falls back to package.json version if manifest doesn't specify one\n */\nexport function readManifest(options: ReadManifestOptions): ExtensionManifest | null {\n const { rootDir, manifestPath, extensionDir = \"haextension\" } = options;\n\n // Determine manifest path\n const resolvedManifestPath = manifestPath\n ? resolvePath(rootDir, manifestPath)\n : resolvePath(rootDir, extensionDir, \"manifest.json\");\n\n try {\n const manifestContent = readFileSync(resolvedManifestPath, \"utf-8\");\n // `signature` belonged to the pre-v2 bundle format; signing now writes `haextension/signature.json`.\n const { signature: _legacySignature, ...parsed } = JSON.parse(manifestContent) as Partial<ExtensionManifest> & {\n signature?: unknown;\n };\n\n // Read fallback values from package.json\n let packageJson: { name?: string; version?: string; author?: string; homepage?: string } = {};\n try {\n const packageJsonPath = resolvePath(rootDir, \"package.json\");\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n } catch {\n console.warn(`[@haex-space/vault-sdk] Warning: Could not read package.json`);\n }\n\n // Always use package.json name as stable technical identifier\n // Display names are handled via i18n in the manifest\n const name = packageJson.name;\n const version = parsed.version ?? packageJson.version;\n const author = parsed.author ?? packageJson.author ?? null;\n const homepage = parsed.homepage ?? packageJson.homepage ?? null;\n\n if (!name) {\n console.warn(`[@haex-space/vault-sdk] Warning: No name found in manifest or package.json`);\n return null;\n }\n\n if (!version) {\n console.warn(`[@haex-space/vault-sdk] Warning: No version found in manifest or package.json`);\n return null;\n }\n\n const manifest: ExtensionManifest = {\n // Keep every field the developer wrote (e.g. displayName); the fallbacks below win.\n ...parsed,\n name,\n version,\n author,\n entry: parsed.entry ?? null,\n icon: parsed.icon ?? null,\n publicKey: parsed.publicKey ?? \"\",\n permissions: parsed.permissions ?? {\n database: [],\n filesystem: [],\n http: [],\n shell: [],\n },\n homepage,\n description: parsed.description ?? null,\n singleInstance: parsed.singleInstance ?? null,\n displayMode: parsed.displayMode ?? null,\n migrationsDir: parsed.migrationsDir ?? null,\n i18n: parsed.i18n ?? null,\n tools: parsed.tools ?? null,\n };\n\n console.log(`✓ [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);\n return manifest;\n } catch {\n console.warn(\n `[@haex-space/vault-sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`\n );\n return null;\n }\n}\n","/* @ts-self-types=\"./haex_bundle.d.ts\" */\n\n/**\n * Collects the files of a bundle and builds the signed archive.\n */\nexport class BundleBuilder {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BundleBuilderFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_bundlebuilder_free(ptr, 0);\n }\n /**\n * Adds an app file (no control file).\n * @param {string} path\n * @param {Uint8Array} data\n */\n addFile(path, data) {\n const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n wasm.bundlebuilder_addFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);\n }\n /**\n * Signs with the PKCS#8 Ed25519 key, writes the archive and verifies it. `manifest_json` is\n * the manifest without `signature`; its `publicKey` is set from the key. Throws the JSON of a\n * `BundleError` (`{kind, message, path?}`).\n * @param {string} manifest_json\n * @param {Uint8Array} private_key_pkcs8\n * @returns {Uint8Array}\n */\n build(manifest_json, private_key_pkcs8) {\n try {\n const ptr = this.__destroy_into_raw();\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(manifest_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(private_key_pkcs8, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n wasm.bundlebuilder_build(retptr, ptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n if (r3) {\n throw takeObject(r2);\n }\n var v3 = getArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export3(r0, r1 * 1, 1);\n return v3;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n constructor() {\n const ret = wasm.bundlebuilder_new();\n this.__wbg_ptr = ret;\n BundleBuilderFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n}\nif (Symbol.dispose) BundleBuilder.prototype[Symbol.dispose] = BundleBuilder.prototype.free;\n\n/**\n * Every error kind as JSON array, so the SDK can test its `BundleErrorKind` type against it.\n * @returns {string}\n */\nexport function errorKinds() {\n let deferred1_0;\n let deferred1_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.errorKinds(retptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred1_0 = r0;\n deferred1_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);\n }\n}\n\n/**\n * Largest archive a host accepts, so callers can refuse a bigger file before reading it.\n * @returns {number}\n */\nexport function maxArchiveBytes() {\n const ret = wasm.maxArchiveBytes();\n return ret;\n}\n\n/**\n * Verifies a `.xt` archive exactly like a host does. Returns\n * `{\"valid\":true,\"manifest\":…,\"files\":[…],\"migrations\":[…]}` or\n * `{\"valid\":false,\"kind\":…,\"message\":…,\"path\"?:…}`.\n * @param {Uint8Array} archive\n * @returns {string}\n */\nexport function verifyArchive(archive) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(archive, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.verifyArchive(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);\n }\n}\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbindgen_generic_0000000000000001: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n };\n return {\n __proto__: null,\n \"./haex_bundle_bg.js\": import0,\n };\n}\n\nconst BundleBuilderFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_bundlebuilder_free(ptr, 1));\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction dropObject(idx) {\n if (idx < 1028) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return decodeText(ptr >>> 0, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap = new Array(1024).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n };\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasmInstance, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasmInstance = instance;\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (!module.ok) {\n throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);\n }\n\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (module_or_path === undefined) {\n module_or_path = new URL('haex_bundle_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n","/**\n * Bundle format `haextension-bundle/2` for the `haex` tool (Node.js only).\n *\n * Every rule lives in the Rust crate `crates/haex-bundle`, which hosts such as holzi use natively;\n * this module only calls its WebAssembly build (`pnpm build:wasm`). Nothing of the format is\n * implemented here, so the tool and the hosts cannot drift apart.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { BundleBuilder, initSync, maxArchiveBytes, verifyArchive } from \"./wasm/haex_bundle\";\n\nexport const BUNDLE_FILE_EXTENSION = \".xt\";\n\n/** The error kinds of the crate (`ErrorKind::ALL`, checked by `src/bundle/__tests__/wasm.test.ts`). */\nexport const BUNDLE_ERROR_KINDS = [\n \"archive_too_large\",\n \"archive_invalid\",\n \"entry_path_invalid\",\n \"entry_duplicate\",\n \"entry_too_large\",\n \"entry_ratio\",\n \"entry_kind\",\n \"manifest_not_canonical\",\n \"manifest_invalid\",\n \"file_mismatch\",\n \"public_key_mismatch\",\n \"signature_invalid\",\n \"legacy_signature_format\",\n] as const;\n\nexport type BundleErrorKind = (typeof BUNDLE_ERROR_KINDS)[number];\n\n/** One file of a bundle: its path inside the archive and its exact bytes. */\nexport interface BundleEntry {\n path: string;\n data: Uint8Array;\n}\n\nexport interface SignedFile {\n path: string;\n sha256: string;\n size: number;\n}\n\nexport interface VerifiedBundle {\n manifest: Record<string, unknown>;\n /** Every entry except `signature.json`, in UTF-8 byte order. */\n files: SignedFile[];\n /** The migrations in the order they apply. */\n migrations: { name: string; path: string }[];\n}\n\n/**\n * A rejected bundle. `kind` is one of the error kinds of `test-vectors/bundles/README.md`;\n * `path` names the entry for entry-level errors and the first differing file for `file_mismatch`.\n */\nexport class BundleError extends Error {\n constructor(\n public readonly kind: BundleErrorKind,\n message: string,\n public readonly path?: string,\n ) {\n super(`${kind}: ${message}`);\n this.name = \"BundleError\";\n }\n}\n\nconst WASM_FILE = \"haex_bundle_bg.wasm\";\n\n/**\n * The module ships once as `dist/haex_bundle_bg.wasm`. The bundled entries live in `dist/` and\n * `dist/cli/`; from the sources (tests) it is the generated `wasm/` folder next to this file.\n */\nfunction wasmPath(): string {\n const candidates = [join(__dirname, WASM_FILE), join(__dirname, \"..\", WASM_FILE), join(__dirname, \"wasm\", WASM_FILE)];\n const found = candidates.find((candidate) => existsSync(candidate));\n if (!found) throw new Error(`${WASM_FILE} not found next to ${__dirname}; run \\`pnpm build:wasm\\``);\n return found;\n}\n\nlet state: \"new\" | \"ready\" | \"crashed\" = \"new\";\n\n/**\n * Runs `call` in the module. A panic in Rust traps (`panic = \"abort\"`) and leaves the instance in\n * an undefined state, so the module is not used again in this process.\n */\nfunction inModule<T>(call: () => T): T {\n if (state === \"crashed\") throw new Error(\"haex-bundle crashed earlier in this process; restart it\");\n if (state === \"new\") {\n initSync({ module: readFileSync(wasmPath()) });\n state = \"ready\";\n }\n try {\n return call();\n } catch (error) {\n if (error instanceof WebAssembly.RuntimeError) {\n state = \"crashed\";\n throw new Error(`haex-bundle crashed (a bug, please report it): ${error.message}`, { cause: error });\n }\n throw error;\n }\n}\n\n/** Largest `.xt` file a host accepts; check it before reading a file into memory. */\nexport function maxBundleBytes(): number {\n return inModule(() => maxArchiveBytes());\n}\n\n/** Verifies a `.xt` archive exactly like a host does. Throws a `BundleError` for the first failing rule. */\nexport function verifyBundle(archive: Uint8Array): VerifiedBundle {\n const result = JSON.parse(inModule(() => verifyArchive(archive))) as\n | ({ valid: true } & VerifiedBundle)\n | { valid: false; kind: BundleErrorKind; message: string; path?: string };\n if (!result.valid) throw new BundleError(result.kind, result.message, result.path);\n return { manifest: result.manifest, files: result.files, migrations: result.migrations };\n}\n\n/** A lone UTF-16 surrogate, which would silently become U+FFFD on the way into the module. */\nconst LONE_SURROGATE = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/;\n\n/**\n * Signs the app files with the manifest (without `signature`; its `publicKey` is set from the\n * key), writes the deterministic archive and verifies it. `privateKeyPkcs8` is the Ed25519 key\n * as `haex keygen` writes it. Throws a `BundleError`.\n */\nexport function buildBundle(\n files: readonly BundleEntry[],\n manifest: Record<string, unknown>,\n privateKeyPkcs8: Uint8Array,\n): Uint8Array {\n for (const file of files) {\n if (LONE_SURROGATE.test(file.path)) {\n throw new BundleError(\"entry_path_invalid\", \"path is not valid Unicode (lone surrogate)\", file.path);\n }\n }\n return inModule(() => {\n const builder = new BundleBuilder();\n for (const file of files) builder.addFile(file.path, file.data);\n try {\n return builder.build(JSON.stringify(manifest), privateKeyPkcs8);\n } catch (error) {\n if (typeof error !== \"string\") throw error;\n const { kind, message, path } = JSON.parse(error) as { kind: BundleErrorKind; message: string; path?: string };\n throw new BundleError(kind, message, path);\n }\n });\n}\n"]}
|
package/dist/node.mjs
CHANGED
|
@@ -68,7 +68,8 @@ function readManifest(options) {
|
|
|
68
68
|
singleInstance: parsed.singleInstance ?? null,
|
|
69
69
|
displayMode: parsed.displayMode ?? null,
|
|
70
70
|
migrationsDir: parsed.migrationsDir ?? null,
|
|
71
|
-
i18n: parsed.i18n ?? null
|
|
71
|
+
i18n: parsed.i18n ?? null,
|
|
72
|
+
tools: parsed.tools ?? null
|
|
72
73
|
};
|
|
73
74
|
console.log(`\u2713 [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);
|
|
74
75
|
return manifest;
|
package/dist/node.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.29_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js","../src/config.ts","../src/manifest.ts","../src/bundle/wasm/haex_bundle.js","../src/bundle/index.ts"],"names":["__dirname","resolvePath","readFileSync","path","ptr","existsSync"],"mappings":";;;;;AAIA,IAAM,WAAA,GAAc,MAAM,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AACvD,IAAM,UAAA,GAAa,MAAM,IAAA,CAAK,OAAA,CAAQ,aAAa,CAAA;AAE5C,IAAMA,8BAA4B,UAAA,EAAW;AC0B7C,SAAS,qBAAA,CAAsB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAA6B;AAC/F,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,OAAA,EAAS,yBAAyB,CAAA;AAE7D,EAAA,IAAI,CAAC,UAA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CAAe,IAAA,CAAK,IAAA,CAAK,IAAI,CAAA,EAAG;AAClC,MAAA,MAAM,IAAI,WAAA,CAAY,oBAAA,EAAsB,4CAAA,EAA8C,KAAK,IAAI,CAAA;AAAA,IACrG;AAAA,EACF;AACA,EAAA,OAAO,SAAS,MAAM;AACpB,IAAA,MAAM,OAAA,GAAU,IAAI,aAAA,EAAc;AAClC,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO,OAAA,CAAQ,QAAQ,IAAA,CAAK,IAAA,EAAM,KAAK,IAAI,CAAA;AAC9D,IAAA,IAAI;AACF,MAAA,OAAO,QAAQ,KAAA,CAAM,IAAA,CAAK,SAAA,CAAU,QAAQ,GAAG,eAAe,CAAA;AAAA,IAChE,SAAS,KAAA,EAAO;AACd,MAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,MAAM,KAAA;AACrC,MAAA,MAAM,EAAE,MAAM,OAAA,EAAS,IAAA,EAAAC,OAAK,GAAI,IAAA,CAAK,MAAM,KAAK,CAAA;AAChD,MAAA,MAAM,IAAI,WAAA,CAAY,IAAA,EAAM,OAAA,EAASA,KAAI,CAAA;AAAA,IAC3C;AAAA,EACF,CAAC,CAAA;AACH","file":"node.mjs","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n","/**\n * Utility for reading and processing extension manifest files\n */\nimport { readFileSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { ExtensionManifest } from \"./types\";\n\nexport interface ReadManifestOptions {\n /** Root directory of the project */\n rootDir: string;\n /** Path to manifest.json (if not provided, will use extensionDir) */\n manifestPath?: string;\n /** Directory containing extension files (default: \"haextension\") */\n extensionDir?: string;\n}\n\n/**\n * Reads and processes the extension manifest.json file\n * Falls back to package.json version if manifest doesn't specify one\n */\nexport function readManifest(options: ReadManifestOptions): ExtensionManifest | null {\n const { rootDir, manifestPath, extensionDir = \"haextension\" } = options;\n\n // Determine manifest path\n const resolvedManifestPath = manifestPath\n ? resolvePath(rootDir, manifestPath)\n : resolvePath(rootDir, extensionDir, \"manifest.json\");\n\n try {\n const manifestContent = readFileSync(resolvedManifestPath, \"utf-8\");\n // `signature` belonged to the pre-v2 bundle format; signing now writes `haextension/signature.json`.\n const { signature: _legacySignature, ...parsed } = JSON.parse(manifestContent) as Partial<ExtensionManifest> & {\n signature?: unknown;\n };\n\n // Read fallback values from package.json\n let packageJson: { name?: string; version?: string; author?: string; homepage?: string } = {};\n try {\n const packageJsonPath = resolvePath(rootDir, \"package.json\");\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n } catch {\n console.warn(`[@haex-space/vault-sdk] Warning: Could not read package.json`);\n }\n\n // Always use package.json name as stable technical identifier\n // Display names are handled via i18n in the manifest\n const name = packageJson.name;\n const version = parsed.version ?? packageJson.version;\n const author = parsed.author ?? packageJson.author ?? null;\n const homepage = parsed.homepage ?? packageJson.homepage ?? null;\n\n if (!name) {\n console.warn(`[@haex-space/vault-sdk] Warning: No name found in manifest or package.json`);\n return null;\n }\n\n if (!version) {\n console.warn(`[@haex-space/vault-sdk] Warning: No version found in manifest or package.json`);\n return null;\n }\n\n const manifest: ExtensionManifest = {\n // Keep every field the developer wrote (e.g. displayName); the fallbacks below win.\n ...parsed,\n name,\n version,\n author,\n entry: parsed.entry ?? null,\n icon: parsed.icon ?? null,\n publicKey: parsed.publicKey ?? \"\",\n permissions: parsed.permissions ?? {\n database: [],\n filesystem: [],\n http: [],\n shell: [],\n },\n homepage,\n description: parsed.description ?? null,\n singleInstance: parsed.singleInstance ?? null,\n displayMode: parsed.displayMode ?? null,\n migrationsDir: parsed.migrationsDir ?? null,\n i18n: parsed.i18n ?? null,\n };\n\n console.log(`✓ [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);\n return manifest;\n } catch {\n console.warn(\n `[@haex-space/vault-sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`\n );\n return null;\n }\n}\n","/* @ts-self-types=\"./haex_bundle.d.ts\" */\n\n/**\n * Collects the files of a bundle and builds the signed archive.\n */\nexport class BundleBuilder {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BundleBuilderFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_bundlebuilder_free(ptr, 0);\n }\n /**\n * Adds an app file (no control file).\n * @param {string} path\n * @param {Uint8Array} data\n */\n addFile(path, data) {\n const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n wasm.bundlebuilder_addFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);\n }\n /**\n * Signs with the PKCS#8 Ed25519 key, writes the archive and verifies it. `manifest_json` is\n * the manifest without `signature`; its `publicKey` is set from the key. Throws the JSON of a\n * `BundleError` (`{kind, message, path?}`).\n * @param {string} manifest_json\n * @param {Uint8Array} private_key_pkcs8\n * @returns {Uint8Array}\n */\n build(manifest_json, private_key_pkcs8) {\n try {\n const ptr = this.__destroy_into_raw();\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(manifest_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(private_key_pkcs8, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n wasm.bundlebuilder_build(retptr, ptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n if (r3) {\n throw takeObject(r2);\n }\n var v3 = getArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export3(r0, r1 * 1, 1);\n return v3;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n constructor() {\n const ret = wasm.bundlebuilder_new();\n this.__wbg_ptr = ret;\n BundleBuilderFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n}\nif (Symbol.dispose) BundleBuilder.prototype[Symbol.dispose] = BundleBuilder.prototype.free;\n\n/**\n * Every error kind as JSON array, so the SDK can test its `BundleErrorKind` type against it.\n * @returns {string}\n */\nexport function errorKinds() {\n let deferred1_0;\n let deferred1_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.errorKinds(retptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred1_0 = r0;\n deferred1_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);\n }\n}\n\n/**\n * Largest archive a host accepts, so callers can refuse a bigger file before reading it.\n * @returns {number}\n */\nexport function maxArchiveBytes() {\n const ret = wasm.maxArchiveBytes();\n return ret;\n}\n\n/**\n * Verifies a `.xt` archive exactly like a host does. Returns\n * `{\"valid\":true,\"manifest\":…,\"files\":[…],\"migrations\":[…]}` or\n * `{\"valid\":false,\"kind\":…,\"message\":…,\"path\"?:…}`.\n * @param {Uint8Array} archive\n * @returns {string}\n */\nexport function verifyArchive(archive) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(archive, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.verifyArchive(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);\n }\n}\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbindgen_generic_0000000000000001: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n };\n return {\n __proto__: null,\n \"./haex_bundle_bg.js\": import0,\n };\n}\n\nconst BundleBuilderFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_bundlebuilder_free(ptr, 1));\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction dropObject(idx) {\n if (idx < 1028) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return decodeText(ptr >>> 0, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap = new Array(1024).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n };\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasmInstance, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasmInstance = instance;\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (!module.ok) {\n throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);\n }\n\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (module_or_path === undefined) {\n module_or_path = new URL('haex_bundle_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n","/**\n * Bundle format `haextension-bundle/2` for the `haex` tool (Node.js only).\n *\n * Every rule lives in the Rust crate `crates/haex-bundle`, which hosts such as holzi use natively;\n * this module only calls its WebAssembly build (`pnpm build:wasm`). Nothing of the format is\n * implemented here, so the tool and the hosts cannot drift apart.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { BundleBuilder, initSync, maxArchiveBytes, verifyArchive } from \"./wasm/haex_bundle\";\n\nexport const BUNDLE_FILE_EXTENSION = \".xt\";\n\n/** The error kinds of the crate (`ErrorKind::ALL`, checked by `src/bundle/__tests__/wasm.test.ts`). */\nexport const BUNDLE_ERROR_KINDS = [\n \"archive_too_large\",\n \"archive_invalid\",\n \"entry_path_invalid\",\n \"entry_duplicate\",\n \"entry_too_large\",\n \"entry_ratio\",\n \"entry_kind\",\n \"manifest_not_canonical\",\n \"manifest_invalid\",\n \"file_mismatch\",\n \"public_key_mismatch\",\n \"signature_invalid\",\n \"legacy_signature_format\",\n] as const;\n\nexport type BundleErrorKind = (typeof BUNDLE_ERROR_KINDS)[number];\n\n/** One file of a bundle: its path inside the archive and its exact bytes. */\nexport interface BundleEntry {\n path: string;\n data: Uint8Array;\n}\n\nexport interface SignedFile {\n path: string;\n sha256: string;\n size: number;\n}\n\nexport interface VerifiedBundle {\n manifest: Record<string, unknown>;\n /** Every entry except `signature.json`, in UTF-8 byte order. */\n files: SignedFile[];\n /** The migrations in the order they apply. */\n migrations: { name: string; path: string }[];\n}\n\n/**\n * A rejected bundle. `kind` is one of the error kinds of `test-vectors/bundles/README.md`;\n * `path` names the entry for entry-level errors and the first differing file for `file_mismatch`.\n */\nexport class BundleError extends Error {\n constructor(\n public readonly kind: BundleErrorKind,\n message: string,\n public readonly path?: string,\n ) {\n super(`${kind}: ${message}`);\n this.name = \"BundleError\";\n }\n}\n\nconst WASM_FILE = \"haex_bundle_bg.wasm\";\n\n/**\n * The module ships once as `dist/haex_bundle_bg.wasm`. The bundled entries live in `dist/` and\n * `dist/cli/`; from the sources (tests) it is the generated `wasm/` folder next to this file.\n */\nfunction wasmPath(): string {\n const candidates = [join(__dirname, WASM_FILE), join(__dirname, \"..\", WASM_FILE), join(__dirname, \"wasm\", WASM_FILE)];\n const found = candidates.find((candidate) => existsSync(candidate));\n if (!found) throw new Error(`${WASM_FILE} not found next to ${__dirname}; run \\`pnpm build:wasm\\``);\n return found;\n}\n\nlet state: \"new\" | \"ready\" | \"crashed\" = \"new\";\n\n/**\n * Runs `call` in the module. A panic in Rust traps (`panic = \"abort\"`) and leaves the instance in\n * an undefined state, so the module is not used again in this process.\n */\nfunction inModule<T>(call: () => T): T {\n if (state === \"crashed\") throw new Error(\"haex-bundle crashed earlier in this process; restart it\");\n if (state === \"new\") {\n initSync({ module: readFileSync(wasmPath()) });\n state = \"ready\";\n }\n try {\n return call();\n } catch (error) {\n if (error instanceof WebAssembly.RuntimeError) {\n state = \"crashed\";\n throw new Error(`haex-bundle crashed (a bug, please report it): ${error.message}`, { cause: error });\n }\n throw error;\n }\n}\n\n/** Largest `.xt` file a host accepts; check it before reading a file into memory. */\nexport function maxBundleBytes(): number {\n return inModule(() => maxArchiveBytes());\n}\n\n/** Verifies a `.xt` archive exactly like a host does. Throws a `BundleError` for the first failing rule. */\nexport function verifyBundle(archive: Uint8Array): VerifiedBundle {\n const result = JSON.parse(inModule(() => verifyArchive(archive))) as\n | ({ valid: true } & VerifiedBundle)\n | { valid: false; kind: BundleErrorKind; message: string; path?: string };\n if (!result.valid) throw new BundleError(result.kind, result.message, result.path);\n return { manifest: result.manifest, files: result.files, migrations: result.migrations };\n}\n\n/** A lone UTF-16 surrogate, which would silently become U+FFFD on the way into the module. */\nconst LONE_SURROGATE = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/;\n\n/**\n * Signs the app files with the manifest (without `signature`; its `publicKey` is set from the\n * key), writes the deterministic archive and verifies it. `privateKeyPkcs8` is the Ed25519 key\n * as `haex keygen` writes it. Throws a `BundleError`.\n */\nexport function buildBundle(\n files: readonly BundleEntry[],\n manifest: Record<string, unknown>,\n privateKeyPkcs8: Uint8Array,\n): Uint8Array {\n for (const file of files) {\n if (LONE_SURROGATE.test(file.path)) {\n throw new BundleError(\"entry_path_invalid\", \"path is not valid Unicode (lone surrogate)\", file.path);\n }\n }\n return inModule(() => {\n const builder = new BundleBuilder();\n for (const file of files) builder.addFile(file.path, file.data);\n try {\n return builder.build(JSON.stringify(manifest), privateKeyPkcs8);\n } catch (error) {\n if (typeof error !== \"string\") throw error;\n const { kind, message, path } = JSON.parse(error) as { kind: BundleErrorKind; message: string; path?: string };\n throw new BundleError(kind, message, path);\n }\n });\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["../node_modules/.pnpm/tsup@8.5.1_jiti@2.7.0_postcss@8.5.29_typescript@6.0.3_yaml@2.9.0/node_modules/tsup/assets/esm_shims.js","../src/config.ts","../src/manifest.ts","../src/bundle/wasm/haex_bundle.js","../src/bundle/index.ts"],"names":["__dirname","resolvePath","readFileSync","path","ptr","existsSync"],"mappings":";;;;;AAIA,IAAM,WAAA,GAAc,MAAM,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AACvD,IAAM,UAAA,GAAa,MAAM,IAAA,CAAK,OAAA,CAAQ,aAAa,CAAA;AAE5C,IAAMA,8BAA4B,UAAA,EAAW;AC0B7C,SAAS,qBAAA,CAAsB,OAAA,GAAkB,OAAA,CAAQ,GAAA,EAAI,EAA6B;AAC/F,EAAA,MAAM,UAAA,GAAa,OAAA,CAAQ,OAAA,EAAS,yBAAyB,CAAA;AAE7D,EAAA,IAAI,CAAC,UAAA,CAAW,UAAU,CAAA,EAAG;AAC3B,IAAA,OAAO,IAAA;AAAA,E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,CAAK,IAAA,CAAK,IAAI,CAAA,EAAG;AAClC,MAAA,MAAM,IAAI,WAAA,CAAY,oBAAA,EAAsB,4CAAA,EAA8C,KAAK,IAAI,CAAA;AAAA,IACrG;AAAA,EACF;AACA,EAAA,OAAO,SAAS,MAAM;AACpB,IAAA,MAAM,OAAA,GAAU,IAAI,aAAA,EAAc;AAClC,IAAA,KAAA,MAAW,QAAQ,KAAA,EAAO,OAAA,CAAQ,QAAQ,IAAA,CAAK,IAAA,EAAM,KAAK,IAAI,CAAA;AAC9D,IAAA,IAAI;AACF,MAAA,OAAO,QAAQ,KAAA,CAAM,IAAA,CAAK,SAAA,CAAU,QAAQ,GAAG,eAAe,CAAA;AAAA,IAChE,SAAS,KAAA,EAAO;AACd,MAAA,IAAI,OAAO,KAAA,KAAU,QAAA,EAAU,MAAM,KAAA;AACrC,MAAA,MAAM,EAAE,MAAM,OAAA,EAAS,IAAA,EAAAC,OAAK,GAAI,IAAA,CAAK,MAAM,KAAK,CAAA;AAChD,MAAA,MAAM,IAAI,WAAA,CAAY,IAAA,EAAM,OAAA,EAASA,KAAI,CAAA;AAAA,IAC3C;AAAA,EACF,CAAC,CAAA;AACH","file":"node.mjs","sourcesContent":["// Shim globals in esm bundle\nimport path from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\nconst getFilename = () => fileURLToPath(import.meta.url)\nconst getDirname = () => path.dirname(getFilename())\n\nexport const __dirname = /* @__PURE__ */ getDirname()\nexport const __filename = /* @__PURE__ */ getFilename()\n","/**\n * Utility to read haextension.config.json\n */\nimport { readFileSync, existsSync } from 'fs'\nimport { resolve } from 'path'\n\nexport interface HaextensionConfig {\n dev?: {\n port?: number\n host?: string\n haextension_dir?: string\n }\n keys?: {\n public_key_path?: string\n private_key_path?: string\n }\n build?: {\n distDir?: string\n /**\n * Source path for migrations directory (relative to project root).\n * If manifest.migrationsDir is set, this directory will be copied\n * to the bundle at the path specified in migrationsDir.\n * Default: \"app/{migrationsDir}\" (for Nuxt projects)\n * Example: \"app/database/migrations\" -> copies to \"database/migrations\" in bundle\n */\n migrationsSourceDir?: string\n }\n}\n\n/**\n * Read haextension.config.json from the project root\n * Returns null if file doesn't exist\n */\nexport function readHaextensionConfig(rootDir: string = process.cwd()): HaextensionConfig | null {\n const configPath = resolve(rootDir, 'haextension.config.json')\n \n if (!existsSync(configPath)) {\n return null\n }\n\n try {\n const content = readFileSync(configPath, 'utf-8')\n return JSON.parse(content)\n } catch (error) {\n console.warn(`Failed to parse haextension.config.json: ${error}`)\n return null\n }\n}\n\n/**\n * Get extension directory from config or use default\n */\nexport function getExtensionDir(rootDir: string = process.cwd()): string {\n const config = readHaextensionConfig(rootDir)\n return config?.dev?.haextension_dir || 'haextension'\n}\n","/**\n * Utility for reading and processing extension manifest files\n */\nimport { readFileSync } from \"node:fs\";\nimport { resolve as resolvePath } from \"node:path\";\nimport type { ExtensionManifest } from \"./types\";\n\nexport interface ReadManifestOptions {\n /** Root directory of the project */\n rootDir: string;\n /** Path to manifest.json (if not provided, will use extensionDir) */\n manifestPath?: string;\n /** Directory containing extension files (default: \"haextension\") */\n extensionDir?: string;\n}\n\n/**\n * Reads and processes the extension manifest.json file\n * Falls back to package.json version if manifest doesn't specify one\n */\nexport function readManifest(options: ReadManifestOptions): ExtensionManifest | null {\n const { rootDir, manifestPath, extensionDir = \"haextension\" } = options;\n\n // Determine manifest path\n const resolvedManifestPath = manifestPath\n ? resolvePath(rootDir, manifestPath)\n : resolvePath(rootDir, extensionDir, \"manifest.json\");\n\n try {\n const manifestContent = readFileSync(resolvedManifestPath, \"utf-8\");\n // `signature` belonged to the pre-v2 bundle format; signing now writes `haextension/signature.json`.\n const { signature: _legacySignature, ...parsed } = JSON.parse(manifestContent) as Partial<ExtensionManifest> & {\n signature?: unknown;\n };\n\n // Read fallback values from package.json\n let packageJson: { name?: string; version?: string; author?: string; homepage?: string } = {};\n try {\n const packageJsonPath = resolvePath(rootDir, \"package.json\");\n packageJson = JSON.parse(readFileSync(packageJsonPath, \"utf-8\"));\n } catch {\n console.warn(`[@haex-space/vault-sdk] Warning: Could not read package.json`);\n }\n\n // Always use package.json name as stable technical identifier\n // Display names are handled via i18n in the manifest\n const name = packageJson.name;\n const version = parsed.version ?? packageJson.version;\n const author = parsed.author ?? packageJson.author ?? null;\n const homepage = parsed.homepage ?? packageJson.homepage ?? null;\n\n if (!name) {\n console.warn(`[@haex-space/vault-sdk] Warning: No name found in manifest or package.json`);\n return null;\n }\n\n if (!version) {\n console.warn(`[@haex-space/vault-sdk] Warning: No version found in manifest or package.json`);\n return null;\n }\n\n const manifest: ExtensionManifest = {\n // Keep every field the developer wrote (e.g. displayName); the fallbacks below win.\n ...parsed,\n name,\n version,\n author,\n entry: parsed.entry ?? null,\n icon: parsed.icon ?? null,\n publicKey: parsed.publicKey ?? \"\",\n permissions: parsed.permissions ?? {\n database: [],\n filesystem: [],\n http: [],\n shell: [],\n },\n homepage,\n description: parsed.description ?? null,\n singleInstance: parsed.singleInstance ?? null,\n displayMode: parsed.displayMode ?? null,\n migrationsDir: parsed.migrationsDir ?? null,\n i18n: parsed.i18n ?? null,\n tools: parsed.tools ?? null,\n };\n\n console.log(`✓ [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);\n return manifest;\n } catch {\n console.warn(\n `[@haex-space/vault-sdk] Warning: manifest.json not found at ${resolvedManifestPath}, extension info will not be available`\n );\n return null;\n }\n}\n","/* @ts-self-types=\"./haex_bundle.d.ts\" */\n\n/**\n * Collects the files of a bundle and builds the signed archive.\n */\nexport class BundleBuilder {\n __destroy_into_raw() {\n const ptr = this.__wbg_ptr;\n this.__wbg_ptr = 0;\n BundleBuilderFinalization.unregister(this);\n return ptr;\n }\n free() {\n const ptr = this.__destroy_into_raw();\n wasm.__wbg_bundlebuilder_free(ptr, 0);\n }\n /**\n * Adds an app file (no control file).\n * @param {string} path\n * @param {Uint8Array} data\n */\n addFile(path, data) {\n const ptr0 = passStringToWasm0(path, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(data, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n wasm.bundlebuilder_addFile(this.__wbg_ptr, ptr0, len0, ptr1, len1);\n }\n /**\n * Signs with the PKCS#8 Ed25519 key, writes the archive and verifies it. `manifest_json` is\n * the manifest without `signature`; its `publicKey` is set from the key. Throws the JSON of a\n * `BundleError` (`{kind, message, path?}`).\n * @param {string} manifest_json\n * @param {Uint8Array} private_key_pkcs8\n * @returns {Uint8Array}\n */\n build(manifest_json, private_key_pkcs8) {\n try {\n const ptr = this.__destroy_into_raw();\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(manifest_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passArray8ToWasm0(private_key_pkcs8, wasm.__wbindgen_export);\n const len1 = WASM_VECTOR_LEN;\n wasm.bundlebuilder_build(retptr, ptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);\n var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);\n if (r3) {\n throw takeObject(r2);\n }\n var v3 = getArrayU8FromWasm0(r0, r1).slice();\n wasm.__wbindgen_export3(r0, r1 * 1, 1);\n return v3;\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n }\n }\n constructor() {\n const ret = wasm.bundlebuilder_new();\n this.__wbg_ptr = ret;\n BundleBuilderFinalization.register(this, this.__wbg_ptr, this);\n return this;\n }\n}\nif (Symbol.dispose) BundleBuilder.prototype[Symbol.dispose] = BundleBuilder.prototype.free;\n\n/**\n * Every error kind as JSON array, so the SDK can test its `BundleErrorKind` type against it.\n * @returns {string}\n */\nexport function errorKinds() {\n let deferred1_0;\n let deferred1_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n wasm.errorKinds(retptr);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred1_0 = r0;\n deferred1_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export3(deferred1_0, deferred1_1, 1);\n }\n}\n\n/**\n * Largest archive a host accepts, so callers can refuse a bigger file before reading it.\n * @returns {number}\n */\nexport function maxArchiveBytes() {\n const ret = wasm.maxArchiveBytes();\n return ret;\n}\n\n/**\n * Verifies a `.xt` archive exactly like a host does. Returns\n * `{\"valid\":true,\"manifest\":…,\"files\":[…],\"migrations\":[…]}` or\n * `{\"valid\":false,\"kind\":…,\"message\":…,\"path\"?:…}`.\n * @param {Uint8Array} archive\n * @returns {string}\n */\nexport function verifyArchive(archive) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passArray8ToWasm0(archive, wasm.__wbindgen_export);\n const len0 = WASM_VECTOR_LEN;\n wasm.verifyArchive(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export3(deferred2_0, deferred2_1, 1);\n }\n}\nfunction __wbg_get_imports() {\n const import0 = {\n __proto__: null,\n __wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {\n throw new Error(getStringFromWasm0(arg0, arg1));\n },\n __wbindgen_generic_0000000000000001: function(arg0, arg1) {\n // Cast intrinsic for `Ref(String) -> Externref`.\n const ret = getStringFromWasm0(arg0, arg1);\n return addHeapObject(ret);\n },\n };\n return {\n __proto__: null,\n \"./haex_bundle_bg.js\": import0,\n };\n}\n\nconst BundleBuilderFinalization = (typeof FinalizationRegistry === 'undefined')\n ? { register: () => {}, unregister: () => {} }\n : new FinalizationRegistry(ptr => wasm.__wbg_bundlebuilder_free(ptr, 1));\n\nfunction addHeapObject(obj) {\n if (heap_next === heap.length) heap.push(heap.length + 1);\n const idx = heap_next;\n heap_next = heap[idx];\n\n heap[idx] = obj;\n return idx;\n}\n\nfunction dropObject(idx) {\n if (idx < 1028) return;\n heap[idx] = heap_next;\n heap_next = idx;\n}\n\nfunction getArrayU8FromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);\n}\n\nlet cachedDataViewMemory0 = null;\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nfunction getStringFromWasm0(ptr, len) {\n return decodeText(ptr >>> 0, len);\n}\n\nlet cachedUint8ArrayMemory0 = null;\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nfunction getObject(idx) { return heap[idx]; }\n\nlet heap = new Array(1024).fill(undefined);\nheap.push(undefined, null, true, false);\n\nlet heap_next = heap.length;\n\nfunction passArray8ToWasm0(arg, malloc) {\n const ptr = malloc(arg.length * 1, 1) >>> 0;\n getUint8ArrayMemory0().set(arg, ptr / 1);\n WASM_VECTOR_LEN = arg.length;\n return ptr;\n}\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = cachedTextEncoder.encodeInto(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nfunction takeObject(idx) {\n const ret = getObject(idx);\n dropObject(idx);\n return ret;\n}\n\nlet cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\ncachedTextDecoder.decode();\nconst MAX_SAFARI_DECODE_BYTES = 2146435072;\nlet numBytesDecoded = 0;\nfunction decodeText(ptr, len) {\n numBytesDecoded += len;\n if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {\n cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });\n cachedTextDecoder.decode();\n numBytesDecoded = len;\n }\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n\nconst cachedTextEncoder = new TextEncoder();\n\nif (!('encodeInto' in cachedTextEncoder)) {\n cachedTextEncoder.encodeInto = function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n };\n}\n\nlet WASM_VECTOR_LEN = 0;\n\nlet wasmModule, wasmInstance, wasm;\nfunction __wbg_finalize_init(instance, module) {\n wasmInstance = instance;\n wasm = instance.exports;\n wasmModule = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n return wasm;\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (!module.ok) {\n throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);\n }\n\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n } catch (e) {\n const validResponse = expectedResponseType(module.type);\n\n if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else { throw e; }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n } else {\n return instance;\n }\n }\n\n function expectedResponseType(type) {\n switch (type) {\n case 'basic': case 'cors': case 'default': return true;\n }\n return false;\n }\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (module !== undefined) {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n const instance = new WebAssembly.Instance(module, imports);\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (module_or_path !== undefined) {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (module_or_path === undefined) {\n module_or_path = new URL('haex_bundle_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync, __wbg_init as default };\n","/**\n * Bundle format `haextension-bundle/2` for the `haex` tool (Node.js only).\n *\n * Every rule lives in the Rust crate `crates/haex-bundle`, which hosts such as holzi use natively;\n * this module only calls its WebAssembly build (`pnpm build:wasm`). Nothing of the format is\n * implemented here, so the tool and the hosts cannot drift apart.\n */\n\nimport { existsSync, readFileSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { BundleBuilder, initSync, maxArchiveBytes, verifyArchive } from \"./wasm/haex_bundle\";\n\nexport const BUNDLE_FILE_EXTENSION = \".xt\";\n\n/** The error kinds of the crate (`ErrorKind::ALL`, checked by `src/bundle/__tests__/wasm.test.ts`). */\nexport const BUNDLE_ERROR_KINDS = [\n \"archive_too_large\",\n \"archive_invalid\",\n \"entry_path_invalid\",\n \"entry_duplicate\",\n \"entry_too_large\",\n \"entry_ratio\",\n \"entry_kind\",\n \"manifest_not_canonical\",\n \"manifest_invalid\",\n \"file_mismatch\",\n \"public_key_mismatch\",\n \"signature_invalid\",\n \"legacy_signature_format\",\n] as const;\n\nexport type BundleErrorKind = (typeof BUNDLE_ERROR_KINDS)[number];\n\n/** One file of a bundle: its path inside the archive and its exact bytes. */\nexport interface BundleEntry {\n path: string;\n data: Uint8Array;\n}\n\nexport interface SignedFile {\n path: string;\n sha256: string;\n size: number;\n}\n\nexport interface VerifiedBundle {\n manifest: Record<string, unknown>;\n /** Every entry except `signature.json`, in UTF-8 byte order. */\n files: SignedFile[];\n /** The migrations in the order they apply. */\n migrations: { name: string; path: string }[];\n}\n\n/**\n * A rejected bundle. `kind` is one of the error kinds of `test-vectors/bundles/README.md`;\n * `path` names the entry for entry-level errors and the first differing file for `file_mismatch`.\n */\nexport class BundleError extends Error {\n constructor(\n public readonly kind: BundleErrorKind,\n message: string,\n public readonly path?: string,\n ) {\n super(`${kind}: ${message}`);\n this.name = \"BundleError\";\n }\n}\n\nconst WASM_FILE = \"haex_bundle_bg.wasm\";\n\n/**\n * The module ships once as `dist/haex_bundle_bg.wasm`. The bundled entries live in `dist/` and\n * `dist/cli/`; from the sources (tests) it is the generated `wasm/` folder next to this file.\n */\nfunction wasmPath(): string {\n const candidates = [join(__dirname, WASM_FILE), join(__dirname, \"..\", WASM_FILE), join(__dirname, \"wasm\", WASM_FILE)];\n const found = candidates.find((candidate) => existsSync(candidate));\n if (!found) throw new Error(`${WASM_FILE} not found next to ${__dirname}; run \\`pnpm build:wasm\\``);\n return found;\n}\n\nlet state: \"new\" | \"ready\" | \"crashed\" = \"new\";\n\n/**\n * Runs `call` in the module. A panic in Rust traps (`panic = \"abort\"`) and leaves the instance in\n * an undefined state, so the module is not used again in this process.\n */\nfunction inModule<T>(call: () => T): T {\n if (state === \"crashed\") throw new Error(\"haex-bundle crashed earlier in this process; restart it\");\n if (state === \"new\") {\n initSync({ module: readFileSync(wasmPath()) });\n state = \"ready\";\n }\n try {\n return call();\n } catch (error) {\n if (error instanceof WebAssembly.RuntimeError) {\n state = \"crashed\";\n throw new Error(`haex-bundle crashed (a bug, please report it): ${error.message}`, { cause: error });\n }\n throw error;\n }\n}\n\n/** Largest `.xt` file a host accepts; check it before reading a file into memory. */\nexport function maxBundleBytes(): number {\n return inModule(() => maxArchiveBytes());\n}\n\n/** Verifies a `.xt` archive exactly like a host does. Throws a `BundleError` for the first failing rule. */\nexport function verifyBundle(archive: Uint8Array): VerifiedBundle {\n const result = JSON.parse(inModule(() => verifyArchive(archive))) as\n | ({ valid: true } & VerifiedBundle)\n | { valid: false; kind: BundleErrorKind; message: string; path?: string };\n if (!result.valid) throw new BundleError(result.kind, result.message, result.path);\n return { manifest: result.manifest, files: result.files, migrations: result.migrations };\n}\n\n/** A lone UTF-16 surrogate, which would silently become U+FFFD on the way into the module. */\nconst LONE_SURROGATE = /[\\uD800-\\uDBFF](?![\\uDC00-\\uDFFF])|(?<![\\uD800-\\uDBFF])[\\uDC00-\\uDFFF]/;\n\n/**\n * Signs the app files with the manifest (without `signature`; its `publicKey` is set from the\n * key), writes the deterministic archive and verifies it. `privateKeyPkcs8` is the Ed25519 key\n * as `haex keygen` writes it. Throws a `BundleError`.\n */\nexport function buildBundle(\n files: readonly BundleEntry[],\n manifest: Record<string, unknown>,\n privateKeyPkcs8: Uint8Array,\n): Uint8Array {\n for (const file of files) {\n if (LONE_SURROGATE.test(file.path)) {\n throw new BundleError(\"entry_path_invalid\", \"path is not valid Unicode (lone surrogate)\", file.path);\n }\n }\n return inModule(() => {\n const builder = new BundleBuilder();\n for (const file of files) builder.addFile(file.path, file.data);\n try {\n return builder.build(JSON.stringify(manifest), privateKeyPkcs8);\n } catch (error) {\n if (typeof error !== \"string\") throw error;\n const { kind, message, path } = JSON.parse(error) as { kind: BundleErrorKind; message: string; path?: string };\n throw new BundleError(kind, message, path);\n }\n });\n}\n"]}
|
package/dist/nuxt.js
CHANGED
|
@@ -274,7 +274,14 @@ var HAEXSPACE_MESSAGE_TYPES = {
|
|
|
274
274
|
*
|
|
275
275
|
* Payload: `{ type: PORT_READY }` — no data.
|
|
276
276
|
*/
|
|
277
|
-
PORT_READY: "haexspace:port:ready"
|
|
277
|
+
PORT_READY: "haexspace:port:ready",
|
|
278
|
+
/**
|
|
279
|
+
* One MCP message of the tool connection (holzi spec 018), in both directions over the
|
|
280
|
+
* MessagePort: the host calls the extension's tools, `sdk.tools` answers.
|
|
281
|
+
*
|
|
282
|
+
* Payload: `{ type: MCP, message }`, where `message` is a JSON-RPC 2.0 object.
|
|
283
|
+
*/
|
|
284
|
+
MCP: "haexspace:mcp"
|
|
278
285
|
};
|
|
279
286
|
|
|
280
287
|
// src/polyfills/debug.ts
|
|
@@ -385,7 +392,8 @@ function readManifest(options) {
|
|
|
385
392
|
singleInstance: parsed.singleInstance ?? null,
|
|
386
393
|
displayMode: parsed.displayMode ?? null,
|
|
387
394
|
migrationsDir: parsed.migrationsDir ?? null,
|
|
388
|
-
i18n: parsed.i18n ?? null
|
|
395
|
+
i18n: parsed.i18n ?? null,
|
|
396
|
+
tools: parsed.tools ?? null
|
|
389
397
|
};
|
|
390
398
|
console.log(`\u2713 [@haex-space/vault-sdk] Loaded ${resolvedManifestPath}`);
|
|
391
399
|
return manifest;
|