grandi 1.3.1 → 2.0.1

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["loadErrors: Error[]","noopAddon: GrandiAddon","addon: GrandiAddon","grandi: Grandi"],"sources":["../node_modules/tsdown/esm-shims.js","../src/types.ts","../src/index.ts"],"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","export enum FrameType {\n\tInterlaced = 0,\n\tProgressive = 1,\n\tField0 = 2,\n\tField1 = 3,\n}\n\nexport enum ColorFormat {\n\tBGRX_BGRA = 0,\n\tUYVY_BGRA = 1,\n\tRGBX_RGBA = 2,\n\tUYVY_RGBA = 3,\n\tFastest = 100,\n\tBest = 101,\n\t// Windows-only NDI SDK extension: 1000 + BGRX_BGRA.\n\tBGRX_BGRA_FLIPPED = 1000,\n}\n\nexport enum AudioFormat {\n\tFloat32Separate = 0,\n\tFloat32Interleaved = 1,\n\tInt16Interleaved = 2,\n}\n\nexport enum Bandwidth {\n\tMetadataOnly = -10,\n\tAudioOnly = 10,\n\tLowest = 0,\n\tHighest = 100,\n}\n\nexport enum FourCC {\n\tUYVY = 1498831189,\n\tUYVA = 1096178005,\n\tP216 = 909193808,\n\tPA16 = 909197648,\n\tYV12 = 842094169,\n\tI420 = 808596553,\n\tNV12 = 842094158,\n\tBGRA = 1095911234,\n\tBGRX = 1481787202,\n\tRGBA = 1094862674,\n\tRGBX = 1480738642,\n\tFLTp = 1884572742,\n}\n\nexport type PtpTimestamp = [number, number]; // [seconds, nanoseconds]\nexport type Timecode = bigint | number | PtpTimestamp;\n\nexport interface Source {\n\tname: string;\n\turlAddress?: string;\n}\n\nexport interface VideoFrame {\n\ttype?: \"video\";\n\txres: number;\n\tyres: number;\n\tframeRateN: number;\n\tframeRateD: number;\n\tpictureAspectRatio: number;\n\tfourCC: FourCC;\n\tframeFormatType: FrameType;\n\tlineStrideBytes: number;\n\tdata: Buffer;\n\ttimecode?: Timecode;\n\t/**\n\t * Receive-only timestamp filled by the NDI SDK (UTC time, 100ns units under the hood).\n\t * NDI ignores this field when sending.\n\t */\n\ttimestamp?: PtpTimestamp;\n\tmetadata?: string;\n}\n\nexport interface ReceivedVideoFrame extends VideoFrame {\n\ttype: \"video\";\n\ttimecode: PtpTimestamp;\n\ttimestamp: PtpTimestamp;\n\tmetadata?: string;\n}\n\nexport interface AudioFrame {\n\ttype?: \"audio\";\n\tsampleRate: number;\n\tnoChannels: number;\n\tnoSamples: number;\n\tchannelStrideBytes: number;\n\tdata: Buffer;\n\tfourCC: FourCC;\n\ttimecode?: Timecode;\n\t/**\n\t * Receive-only timestamp filled by the NDI SDK (UTC time, 100ns units under the hood).\n\t * NDI ignores this field when sending.\n\t */\n\ttimestamp?: PtpTimestamp;\n\tmetadata?: string;\n}\n\nexport interface ReceivedAudioFrame {\n\ttype: \"audio\";\n\taudioFormat: AudioFormat;\n\treferenceLevel?: number;\n\tsampleRate: number;\n\tchannels: number;\n\tsamples: number;\n\tchannelStrideInBytes: number;\n\tdata: Buffer;\n\ttimecode: PtpTimestamp;\n\ttimestamp: PtpTimestamp;\n\tmetadata?: string;\n}\n\nexport interface ReceivedMetadataFrame {\n\ttype: \"metadata\";\n\tlength: number;\n\ttimecode: PtpTimestamp;\n\ttimestamp: PtpTimestamp;\n\tdata: string;\n}\n\nexport interface SourceChangeEvent {\n\ttype: \"sourceChange\";\n}\n\nexport interface StatusChangeEvent {\n\ttype: \"statusChange\";\n}\n\nexport interface TimeoutEvent {\n\ttype: \"timeout\";\n}\n\nexport type ReceiverDataFrame =\n\t| ReceivedVideoFrame\n\t| ReceivedAudioFrame\n\t| ReceivedMetadataFrame\n\t| SourceChangeEvent\n\t| StatusChangeEvent\n\t| TimeoutEvent;\n\nexport interface AudioReceiveOptions {\n\taudioFormat?: AudioFormat;\n\treferenceLevel?: number;\n}\n\nexport interface Receiver {\n\tembedded: unknown;\n\tsource: Source;\n\tcolorFormat: ColorFormat;\n\tbandwidth: Bandwidth;\n\tallowVideoFields: boolean;\n\tname?: string;\n\tvideo(timeoutMs?: number): Promise<ReceivedVideoFrame>;\n\taudio(timeoutMs?: number): Promise<ReceivedAudioFrame>;\n\taudio(\n\t\toptions: AudioReceiveOptions,\n\t\ttimeoutMs?: number,\n\t): Promise<ReceivedAudioFrame>;\n\tmetadata(timeoutMs?: number): Promise<ReceivedMetadataFrame>;\n\tdata(timeoutMs?: number): Promise<ReceiverDataFrame>;\n\tdata(\n\t\toptions: AudioReceiveOptions,\n\t\ttimeoutMs?: number,\n\t): Promise<ReceiverDataFrame>;\n\ttally(state: ReceiverTallyState): boolean;\n\tdestroy(): boolean;\n}\n\nexport interface ReceiverTallyState {\n\tonProgram?: boolean;\n\tonPreview?: boolean;\n}\n\nexport interface SenderTally {\n\tchanged: boolean;\n\ton_program: boolean;\n\ton_preview: boolean;\n}\n\nexport interface Sender {\n\tembedded: unknown;\n\tname: string;\n\tgroups?: string;\n\tclockVideo: boolean;\n\tclockAudio: boolean;\n\tvideo(frame: VideoFrame): Promise<void>;\n\taudio(frame: AudioFrame): Promise<void>;\n\tconnections(): number;\n\tmetadata(data: string): boolean;\n\ttally(): SenderTally;\n\tsourcename(): string;\n\tdestroy(): boolean;\n}\n\nexport interface Routing {\n\tembedded: unknown;\n\tname?: string;\n\tgroups?: string;\n\tdestroy(): boolean;\n\tchange(source: Source): boolean;\n\tclear(): boolean;\n\tconnections(): number;\n\tsourcename(): string;\n}\n\nexport interface FrameSyncAudioOptions {\n\tsampleRate?: number;\n\tnoChannels?: number;\n\tnoSamples?: number;\n}\n\nexport interface FrameSync {\n\tembedded: unknown;\n\t/**\n\t * Captures a video frame using NDI frame-synchronization (time base correction).\n\t * Always returns immediately.\n\t *\n\t * If no video has ever been received, resolves with `{ type: \"timeout\" }`.\n\t */\n\tvideo(fieldType?: FrameType): Promise<ReceivedVideoFrame | TimeoutEvent>;\n\t/**\n\t * Captures audio using NDI frame-synchronization (resampled to match your calls).\n\t * Always returns immediately and may insert silence if no audio is present.\n\t */\n\taudio(options?: FrameSyncAudioOptions): Promise<ReceivedAudioFrame>;\n\t/**\n\t * Returns an approximate depth of the internal audio queue in samples.\n\t */\n\taudioQueueDepth(): number;\n\tdestroy(): boolean;\n}\n\nexport interface Finder {\n\tsources(): Source[];\n\twait(timeoutMs?: number): boolean;\n\tdestroy(): boolean;\n}\n\nexport interface FindOptions {\n\tshowLocalSources?: boolean;\n\tgroups?: string;\n\textraIPs?: string;\n}\n\nexport interface ReceiveOptions {\n\tsource: Source;\n\tcolorFormat?: ColorFormat;\n\tbandwidth?: Bandwidth;\n\t/**\n\t * If `colorFormat` is `ColorFormat.Fastest` or `ColorFormat.Best`, the NDI SDK\n\t * implicitly enables video fields and this option is forced to `true`.\n\t */\n\tallowVideoFields?: boolean;\n\tname?: string;\n}\n\nexport interface SendOptions {\n\tname: string;\n\tgroups?: string;\n\tclockVideo?: boolean;\n\tclockAudio?: boolean;\n}\n\nexport interface Grandi {\n\t/**\n\t * Gets the NDI SDK version string (e.g. `\"NDI SDK 6.0.0.0\"`).\n\t * @returns The NDI SDK version string.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * console.log(grandi.version());\n\t * ```\n\t */\n\tversion(): string;\n\t/**\n\t * Checks if the current CPU architecture is supported by NDI.\n\t * @returns `true` when NDI is supported on this CPU/platform.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * if (!grandi.isSupportedCPU()) throw new Error(\"NDI unsupported here\");\n\t * ```\n\t */\n\tisSupportedCPU(): boolean;\n\t/**\n\t * Initializes the NDI library. Must be called before using any other NDI functions.\n\t * Call this once per process, before creating senders/receivers/finders.\n\t * @returns `true` if initialization was successful.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * if (!grandi.initialize()) throw new Error(\"NDI init failed\");\n\t * ```\n\t */\n\tinitialize(): boolean;\n\t/**\n\t * Destroys the NDI library instance and cleans up resources.\n\t * Should be called when done using NDI to free resources.\n\t * @returns `true` if destruction was successful.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.destroy();\n\t * ```\n\t */\n\tdestroy(): boolean;\n\t/**\n\t * Creates an NDI sender for transmitting video and audio over the network.\n\t * @param params Sender options.\n\t * @returns A promise that resolves to a Sender instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const sender = await grandi.send({ name: \"My Source\" });\n\t * ```\n\t */\n\tsend(params: SendOptions): Promise<Sender>;\n\t/**\n\t * Creates an NDI receiver for receiving video and audio from an NDI source.\n\t * @param params Receiver options.\n\t * @returns A promise that resolves to a Receiver instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const finder = await grandi.find({ showLocalSources: true });\n\t * finder.wait(1000);\n\t * const source = finder.sources()[0];\n\t * finder.destroy();\n\t * const receiver = await grandi.receive({ source });\n\t * const frame = await receiver.video(1000);\n\t * receiver.destroy();\n\t * ```\n\t */\n\treceive(params: ReceiveOptions): Promise<Receiver>;\n\t/**\n\t * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.\n\t * Use this when you want smooth playback clocked to your own render/audio loop.\n\t *\n\t * Note: destroy the frame-sync before destroying the receiver.\n\t */\n\tframesync(receiver: Receiver): Promise<FrameSync>;\n\t/**\n\t * Creates an NDI router for switching between different NDI sources.\n\t * @param params Router options.\n\t * @returns A promise that resolves to a Routing instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const router = await grandi.routing({ name: \"My Router\" });\n\t * // router.change(source) to route a discovered source\n\t * router.destroy();\n\t * ```\n\t */\n\trouting(params: { name?: string; groups?: string }): Promise<Routing>;\n\t/**\n\t * Creates a finder to discover NDI sources on the network.\n\t * @param params Discovery options.\n\t * @returns A promise that resolves to a Finder instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const finder = await grandi.find({ showLocalSources: true });\n\t * finder.wait(1000);\n\t * console.log(finder.sources());\n\t * finder.destroy();\n\t * ```\n\t */\n\tfind(params?: FindOptions): Promise<Finder>;\n\n\t/**\n\t * Enum: receiver video color formats.\n\t */\n\tColorFormat: typeof ColorFormat;\n\t/**\n\t * Enum: supported raw audio formats for helpers/receive conversions.\n\t */\n\tAudioFormat: typeof AudioFormat;\n\t/**\n\t * Enum: receiver bandwidth modes.\n\t */\n\tBandwidth: typeof Bandwidth;\n\t/**\n\t * Enum: video frame format types (progressive/interlaced/fields).\n\t */\n\tFrameType: typeof FrameType;\n\t/**\n\t * Enum: FourCC pixel/audio formats used in frames.\n\t */\n\tFourCC: typeof FourCC;\n\n\t// Constant aliases for backwards compatibility / convenience.\n\t/**\n\t * Alias of `ColorFormat.BGRX_BGRA`.\n\t */\n\tCOLOR_FORMAT_BGRX_BGRA: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.UYVY_BGRA`.\n\t */\n\tCOLOR_FORMAT_UYVY_BGRA: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.RGBX_RGBA`.\n\t */\n\tCOLOR_FORMAT_RGBX_RGBA: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.UYVY_RGBA`.\n\t */\n\tCOLOR_FORMAT_UYVY_RGBA: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.Fastest`.\n\t */\n\tCOLOR_FORMAT_FASTEST: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.Best`.\n\t */\n\tCOLOR_FORMAT_BEST: ColorFormat;\n\t/**\n\t * Alias of `ColorFormat.BGRX_BGRA_FLIPPED` (Windows-only).\n\t */\n\tCOLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat;\n\n\t/**\n\t * Alias of `Bandwidth.MetadataOnly`.\n\t */\n\tBANDWIDTH_METADATA_ONLY: Bandwidth;\n\t/**\n\t * Alias of `Bandwidth.AudioOnly`.\n\t */\n\tBANDWIDTH_AUDIO_ONLY: Bandwidth;\n\t/**\n\t * Alias of `Bandwidth.Lowest`.\n\t */\n\tBANDWIDTH_LOWEST: Bandwidth;\n\t/**\n\t * Alias of `Bandwidth.Highest`.\n\t */\n\tBANDWIDTH_HIGHEST: Bandwidth;\n\n\t/**\n\t * Alias of `FrameType.Progressive`.\n\t */\n\tFORMAT_TYPE_PROGRESSIVE: FrameType;\n\t/**\n\t * Alias of `FrameType.Interlaced`.\n\t */\n\tFORMAT_TYPE_INTERLACED: FrameType;\n\t/**\n\t * Alias of `FrameType.Field0`.\n\t */\n\tFORMAT_TYPE_FIELD_0: FrameType;\n\t/**\n\t * Alias of `FrameType.Field1`.\n\t */\n\tFORMAT_TYPE_FIELD_1: FrameType;\n\n\t/**\n\t * Alias of `AudioFormat.Float32Separate`.\n\t */\n\tAUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat;\n\t/**\n\t * Alias of `AudioFormat.Float32Interleaved`.\n\t */\n\tAUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat;\n\t/**\n\t * Alias of `AudioFormat.Int16Interleaved`.\n\t */\n\tAUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat;\n\n\t/**\n\t * Alias of `FourCC.UYVY`.\n\t */\n\tFOURCC_UYVY: FourCC;\n\t/**\n\t * Alias of `FourCC.UYVA`.\n\t */\n\tFOURCC_UYVA: FourCC;\n\t/**\n\t * Alias of `FourCC.P216`.\n\t */\n\tFOURCC_P216: FourCC;\n\t/**\n\t * Alias of `FourCC.PA16`.\n\t */\n\tFOURCC_PA16: FourCC;\n\t/**\n\t * Alias of `FourCC.YV12`.\n\t */\n\tFOURCC_YV12: FourCC;\n\t/**\n\t * Alias of `FourCC.I420`.\n\t */\n\tFOURCC_I420: FourCC;\n\t/**\n\t * Alias of `FourCC.NV12`.\n\t */\n\tFOURCC_NV12: FourCC;\n\t/**\n\t * Alias of `FourCC.BGRA`.\n\t */\n\tFOURCC_BGRA: FourCC;\n\t/**\n\t * Alias of `FourCC.BGRX`.\n\t */\n\tFOURCC_BGRX: FourCC;\n\t/**\n\t * Alias of `FourCC.RGBA`.\n\t */\n\tFOURCC_RGBA: FourCC;\n\t/**\n\t * Alias of `FourCC.RGBX`.\n\t */\n\tFOURCC_RGBX: FourCC;\n\t/**\n\t * Alias of `FourCC.FLTp`.\n\t */\n\tFOURCC_FLTp: FourCC;\n}\n","import path from \"node:path\";\nimport nodeGypBuild from \"node-gyp-build\";\n\nimport type {\n\tFinder,\n\tFindOptions,\n\tFrameSync,\n\tGrandi,\n\tReceiveOptions,\n\tReceiver,\n\tRouting,\n\tSender,\n\tSendOptions,\n} from \"./types\";\nimport {\n\tAudioFormat,\n\tBandwidth,\n\tColorFormat,\n\tFourCC,\n\tFrameType,\n} from \"./types\";\n\n/**\n * Checks if the current platform and architecture are supported by NDI.\n * @returns {boolean} True if the platform is supported (darwin, linux, or win32 with ia32/x64), false otherwise.\n */\nfunction isSupportedPlatform(): boolean {\n\treturn (\n\t\tprocess.platform === \"darwin\" ||\n\t\tprocess.platform === \"linux\" ||\n\t\t(process.platform === \"win32\" && [\"ia32\", \"x64\"].includes(process.arch))\n\t);\n}\n\nfunction tryRequireArchPackage(): GrandiAddon | null {\n\tconst archKey = `${process.platform}-${process.arch}`;\n\tconst map: Record<string, string> = {\n\t\t\"linux-x64\": \"@grandi/linux-x64\",\n\t\t\"linux-arm64\": \"@grandi/linux-arm64\",\n\t\t\"linux-arm\": \"@grandi/linux-armv7l\",\n\t\t\"win32-x64\": \"@grandi/win32-x64\",\n\t\t\"win32-ia32\": \"@grandi/win32-ia32\",\n\t\t\"darwin-x64\": \"@grandi/darwin-x64\",\n\t\t\"darwin-arm64\": \"@grandi/darwin-arm64\",\n\t};\n\tconst pkg = map[archKey];\n\tif (!pkg) throw new Error(`Unsupported platform or architecture: ${archKey}`);\n\ttry {\n\t\t// eslint-disable-next-line @typescript-eslint/no-var-requires\n\t\treturn require(pkg) as GrandiAddon;\n\t} catch {\n\t\tthrow new Error(\n\t\t\t`Failed to find prebuilt package for ${archKey}. Please ensure that the package \"${pkg}\" is installed`,\n\t\t);\n\t}\n}\n\nfunction loadAddon(): GrandiAddon {\n\tconst loadErrors: Error[] = [];\n\tif (!isSupportedPlatform()) {\n\t\tconsole.error(\n\t\t\t`Unsupported platform or architecture: ${process.platform}-${process.arch}`,\n\t\t);\n\t\treturn noopAddon;\n\t}\n\n\ttry {\n\t\tconst localBinding = nodeGypBuild(\n\t\t\tpath.join(__dirname, \"..\"),\n\t\t) as GrandiAddon;\n\t\tif (localBinding) return localBinding;\n\t} catch (err) {\n\t\tloadErrors.push(err as Error);\n\t}\n\n\ttry {\n\t\tconst archAddon = tryRequireArchPackage();\n\t\tif (archAddon) return archAddon;\n\t} catch (err) {\n\t\tloadErrors.push(err as Error);\n\t}\n\n\tif (loadErrors.length > 0) {\n\t\tconst aggregateError = new Error(\n\t\t\t\"Failed to load native addon:\\n\" +\n\t\t\t\tloadErrors.map((e, i) => ` [${i + 1}] ${e.message}`).join(\"\\n\"),\n\t\t);\n\t\tconsole.error(aggregateError);\n\t}\n\treturn noopAddon;\n}\n\nexport interface GrandiAddon {\n\tversion(): string;\n\tisSupportedCPU(): boolean;\n\tinitialize(): boolean;\n\tdestroy(): boolean;\n\tfind(params?: FindOptions): Promise<Finder>;\n\treceive(params: ReceiveOptions): Promise<Receiver>;\n\tframesync(receiver: Receiver): Promise<FrameSync>;\n\tsend(params: SendOptions): Promise<Sender>;\n\trouting(params: { name?: string; groups?: string }): Promise<Routing>;\n}\n\nconst noopAddon: GrandiAddon = {\n\tversion() {\n\t\treturn \"\";\n\t},\n\tisSupportedCPU() {\n\t\treturn false;\n\t},\n\tinitialize() {\n\t\treturn false;\n\t},\n\tdestroy() {\n\t\treturn false;\n\t},\n\tsend(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\treceive(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\tframesync(_receiver) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\trouting() {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\tfind(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n};\n\nconst addon: GrandiAddon = loadAddon();\n/**\n * Creates a finder to discover NDI sources on the network.\n * @param {FindOptions} [params={}] - Options for finding sources.\n * @param {boolean} [params.showLocalSources] - Whether to show local sources.\n * @param {string} [params.groups] - Multicast groups to search in.\n * @param {string} [params.extraIPs] - Additional IP addresses to search.\n * @returns {Promise<Finder>} A promise that resolves to a Finder instance for discovering sources.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.\n *\n * @example\n * ```js\n * import { find, initialize } from \"grandi\";\n * initialize();\n * const finder = await find({ showLocalSources: true });\n * finder.wait(1000);\n * console.log(finder.sources());\n * finder.destroy();\n * ```\n */\nexport function find(params: FindOptions = {}): Promise<Finder> {\n\treturn addon.find(params);\n}\n// Named runtime exports\n/**\n * Gets the version of the NDI SDK.\n * @returns {string} The NDI SDK version string.\n */\nexport const version = addon.version;\n/**\n * Checks if the current CPU architecture is supported by NDI.\n * @returns {boolean} True if the CPU is supported, false otherwise.\n */\nexport const isSupportedCPU = addon.isSupportedCPU;\n/**\n * Initializes the NDI library. Must be called before using any other NDI functions.\n * @returns {boolean} True if initialization was successful, false otherwise.\n *\n * @example\n * ```js\n * import { initialize } from \"grandi\";\n * if (!initialize()) throw new Error(\"NDI init failed\");\n * ```\n */\nexport const initialize = addon.initialize;\n/**\n * Destroys the NDI library instance and cleans up resources.\n * Should be called when done using NDI to free resources.\n * @returns {boolean} True if destruction was successful, false otherwise.\n *\n * @example\n * ```js\n * import { destroy } from \"grandi\";\n * destroy();\n * ```\n */\nexport const destroy = addon.destroy;\n/**\n * Creates an NDI sender for transmitting video and audio over the network.\n * @param {SendOptions} params - Options for creating the sender.\n * @param {string} params.name - The name of the NDI source.\n * @param {string} [params.groups] - Multicast groups to send to.\n * @param {boolean} [params.clockVideo] - Whether to clock video frames.\n * @param {boolean} [params.clockAudio] - Whether to clock audio frames.\n * @returns {Promise<Sender>} A promise that resolves to a Sender instance for transmitting data.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.\n *\n * @example\n * ```js\n * import { initialize, send } from \"grandi\";\n * initialize();\n * const sender = await send({ name: \"My Source\" });\n * // sender.video(...) / sender.audio(...)\n * sender.destroy();\n * ```\n */\nexport const send = addon.send;\n/**\n * Creates an NDI receiver for receiving video and audio from an NDI source.\n * @param {ReceiveOptions} params - Options for creating the receiver.\n * @param {ReceiveOptions[\"source\"]} params.source - The NDI source to connect to.\n * @param {ReceiveOptions[\"colorFormat\"]} [params.colorFormat] - The color format for received video.\n * @param {ReceiveOptions[\"bandwidth\"]} [params.bandwidth] - The bandwidth limitation for the connection.\n * @param {boolean} [params.allowVideoFields] - Whether to allow video fields.\n * @param {string} [params.name] - The name for the receiver.\n * @returns {Promise<Receiver>} A promise that resolves to a Receiver instance for receiving data.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.\n *\n * @example\n * ```js\n * import { find, initialize, receive } from \"grandi\";\n * initialize();\n * const finder = await find({ showLocalSources: true });\n * finder.wait(1000);\n * const source = finder.sources()[0];\n * finder.destroy();\n * const receiver = await receive({ source });\n * const frame = await receiver.video(1000);\n * receiver.destroy();\n * ```\n */\nexport const receive = addon.receive;\n/**\n * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.\n * Use this when you want smooth playback clocked to your own render/audio loop.\n *\n * Note: destroy the frame-sync before destroying the receiver.\n * @param {Receiver} receiver - The receiver instance to frame-sync.\n * @returns {Promise<FrameSync>} A promise that resolves to a FrameSync instance.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if framesync creation fails.\n *\n * @example\n * ```js\n * import grandi from \"grandi\";\n * grandi.initialize();\n * const receiver = await grandi.receive({ source });\n * const fs = await grandi.framesync(receiver);\n * const frame = await fs.video(grandi.FrameType.Progressive);\n * fs.destroy();\n * receiver.destroy();\n * ```\n */\nexport const framesync = addon.framesync;\n/**\n * Creates an NDI router for switching between different NDI sources.\n * @param {Object} params - Options for creating the router.\n * @param {string} [params.name] - The name for the router.\n * @param {string} [params.groups] - Multicast groups for the router.\n * @returns {Promise<Routing>} A promise that resolves to a Routing instance for source switching.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.\n *\n * @example\n * ```js\n * import { initialize, routing } from \"grandi\";\n * initialize();\n * const router = await routing({ name: \"My Router\" });\n * // router.change(source)\n * router.destroy();\n * ```\n */\nexport const routing = addon.routing;\n\n// Re-export enums and types for convenient named imports\nexport { ColorFormat, AudioFormat, Bandwidth, FrameType, FourCC };\nexport type {\n\tAudioFrame,\n\tAudioReceiveOptions,\n\tFinder,\n\tFindOptions,\n\tFrameSync,\n\tFrameSyncAudioOptions,\n\tGrandi,\n\tPtpTimestamp,\n\tReceivedAudioFrame,\n\tReceivedMetadataFrame,\n\tReceivedVideoFrame,\n\tReceiveOptions,\n\tReceiverDataFrame,\n\tReceiverTallyState,\n\tRouting,\n\tSender,\n\tSenderTally,\n\tSource,\n\tSourceChangeEvent,\n\tStatusChangeEvent,\n\tTimecode,\n\tTimeoutEvent,\n\tVideoFrame,\n} from \"./types\";\n\nconst grandi: Grandi = {\n\tversion,\n\tisSupportedCPU,\n\tinitialize,\n\tdestroy,\n\tsend,\n\treceive,\n\tframesync,\n\trouting,\n\tfind,\n\tColorFormat,\n\tAudioFormat,\n\tBandwidth,\n\tFrameType,\n\tFourCC,\n\n\t// Constants mapped to enum values\n\tCOLOR_FORMAT_BGRX_BGRA: ColorFormat.BGRX_BGRA,\n\tCOLOR_FORMAT_UYVY_BGRA: ColorFormat.UYVY_BGRA,\n\tCOLOR_FORMAT_RGBX_RGBA: ColorFormat.RGBX_RGBA,\n\tCOLOR_FORMAT_UYVY_RGBA: ColorFormat.UYVY_RGBA,\n\tCOLOR_FORMAT_FASTEST: ColorFormat.Fastest,\n\tCOLOR_FORMAT_BEST: ColorFormat.Best,\n\tCOLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat.BGRX_BGRA_FLIPPED,\n\n\tBANDWIDTH_METADATA_ONLY: Bandwidth.MetadataOnly,\n\tBANDWIDTH_AUDIO_ONLY: Bandwidth.AudioOnly,\n\tBANDWIDTH_LOWEST: Bandwidth.Lowest,\n\tBANDWIDTH_HIGHEST: Bandwidth.Highest,\n\n\tFORMAT_TYPE_PROGRESSIVE: FrameType.Progressive,\n\tFORMAT_TYPE_INTERLACED: FrameType.Interlaced,\n\tFORMAT_TYPE_FIELD_0: FrameType.Field0,\n\tFORMAT_TYPE_FIELD_1: FrameType.Field1,\n\n\tAUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat.Float32Separate,\n\tAUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat.Float32Interleaved,\n\tAUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat.Int16Interleaved,\n\n\t// FourCC helpers/constants\n\tFOURCC_UYVY: FourCC.UYVY,\n\tFOURCC_UYVA: FourCC.UYVA,\n\tFOURCC_P216: FourCC.P216,\n\tFOURCC_PA16: FourCC.PA16,\n\tFOURCC_YV12: FourCC.YV12,\n\tFOURCC_I420: FourCC.I420,\n\tFOURCC_NV12: FourCC.NV12,\n\tFOURCC_BGRA: FourCC.BGRA,\n\tFOURCC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;;;;AAqB7B,MAAa,YAAY,MAAM;;;;;;;;;;;;;;;;;;AAkB/B,MAAa,UAAU,MAAM;AA8B7B,MAAMC,SAAiB;CACtB;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CAGA,wBAAwB,YAAY;CACpC,wBAAwB,YAAY;CACpC,wBAAwB,YAAY;CACpC,wBAAwB,YAAY;CACpC,sBAAsB,YAAY;CAClC,mBAAmB,YAAY;CAC/B,gCAAgC,YAAY;CAE5C,yBAAyB,UAAU;CACnC,sBAAsB,UAAU;CAChC,kBAAkB,UAAU;CAC5B,mBAAmB,UAAU;CAE7B,yBAAyB,UAAU;CACnC,wBAAwB,UAAU;CAClC,qBAAqB,UAAU;CAC/B,qBAAqB,UAAU;CAE/B,gCAAgC,YAAY;CAC5C,mCAAmC,YAAY;CAC/C,iCAAiC,YAAY;CAG7C,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB,aAAa,OAAO;CACpB;AAED,kBAAe"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":["../node_modules/tsdown/esm-shims.js","../src/platforms.json","../src/types.ts","../src/index.ts"],"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","","export enum FrameType {\n\tInterlaced = 0,\n\tProgressive = 1,\n\tField0 = 2,\n\tField1 = 3,\n}\n\nexport enum ColorFormat {\n\tBGRX_BGRA = 0,\n\tUYVY_BGRA = 1,\n\tRGBX_RGBA = 2,\n\tUYVY_RGBA = 3,\n\tFastest = 100,\n\tBest = 101,\n\t// Windows-only NDI SDK extension: 1000 + BGRX_BGRA.\n\tBGRX_BGRA_FLIPPED = 1000,\n}\n\nexport enum AudioFormat {\n\tFloat32Separate = 0,\n\tFloat32Interleaved = 1,\n\tInt16Interleaved = 2,\n}\n\nexport enum Bandwidth {\n\tMetadataOnly = -10,\n\tAudioOnly = 10,\n\tLowest = 0,\n\tHighest = 100,\n}\n\nexport enum FourCC {\n\tUYVY = 1498831189,\n\tUYVA = 1096178005,\n\tP216 = 909193808,\n\tPA16 = 909197648,\n\tYV12 = 842094169,\n\tI420 = 808596553,\n\tNV12 = 842094158,\n\tBGRA = 1095911234,\n\tBGRX = 1481787202,\n\tRGBA = 1094862674,\n\tRGBX = 1480738642,\n\tFLTp = 1884572742,\n}\n\nexport type VideoFourCC =\n\t| FourCC.UYVY\n\t| FourCC.UYVA\n\t| FourCC.P216\n\t| FourCC.PA16\n\t| FourCC.YV12\n\t| FourCC.I420\n\t| FourCC.NV12\n\t| FourCC.BGRA\n\t| FourCC.BGRX\n\t| FourCC.RGBA\n\t| FourCC.RGBX;\n\nexport type AudioFourCC = FourCC.FLTp;\n\n/**\n * NDI sentinel that asks the SDK to generate synthesized timecode.\n *\n * @see [Synthesized timecode in the NDI SDK documentation](https://docs.ndi.video/all/getting-started/white-paper/time-timecode-and-sync-for-ndi#synthesized-timecode)\n */\nexport const TIMECODE_SYNTHESIZE = 9223372036854775807n;\nexport type Timecode = bigint;\n\nexport interface Source {\n\tname: string;\n\turlAddress?: string;\n}\n\nexport interface VideoFrame {\n\ttype?: \"video\";\n\txres: number;\n\tyres: number;\n\tframeRateN: number;\n\tframeRateD: number;\n\tpictureAspectRatio: number;\n\tfourCC: VideoFourCC;\n\tframeFormatType: FrameType;\n\tlineStrideBytes: number;\n\tdata: Buffer;\n\ttimecode?: Timecode;\n\tmetadata?: string;\n}\n\nexport interface ReceivedVideoFrame extends VideoFrame {\n\ttype: \"video\";\n\ttimecode: bigint;\n\t/** Omitted when the NDI SDK reports that the receive timestamp is unavailable. */\n\ttimestamp?: bigint;\n\tmetadata?: string;\n}\n\nexport type AudioFrame = {\n\ttype?: \"audio\";\n\tsampleRate: number;\n\tchannelStrideBytes: number;\n\tdata: Buffer;\n\tfourCC: AudioFourCC;\n\ttimecode?: Timecode;\n\tmetadata?: string;\n} & (\n\t| {\n\t\t\tchannels: number;\n\t\t\t/** @deprecated Use `channels` instead. */\n\t\t\tnoChannels?: number;\n\t }\n\t| {\n\t\t\tchannels?: number;\n\t\t\t/** @deprecated Use `channels` instead. */\n\t\t\tnoChannels: number;\n\t }\n) &\n\t(\n\t\t| {\n\t\t\t\tsamples: number;\n\t\t\t\t/** @deprecated Use `samples` instead. */\n\t\t\t\tnoSamples?: number;\n\t\t }\n\t\t| {\n\t\t\t\tsamples?: number;\n\t\t\t\t/** @deprecated Use `samples` instead. */\n\t\t\t\tnoSamples: number;\n\t\t }\n\t);\n\nexport interface ReceivedAudioFrame {\n\ttype: \"audio\";\n\taudioFormat: AudioFormat;\n\treferenceLevel?: number;\n\tsampleRate: number;\n\tchannels: number;\n\tsamples: number;\n\tchannelStrideInBytes: number;\n\tdata: Buffer;\n\ttimecode: bigint;\n\t/** Omitted when the NDI SDK reports that the receive timestamp is unavailable. */\n\ttimestamp?: bigint;\n\tmetadata?: string;\n}\n\nexport interface ReceivedMetadataFrame {\n\ttype: \"metadata\";\n\tlength: number;\n\ttimecode: bigint;\n\tdata: string;\n}\n\nexport interface SourceChangeEvent {\n\ttype: \"sourceChange\";\n}\n\nexport interface StatusChangeEvent {\n\ttype: \"statusChange\";\n}\n\nexport interface TimeoutEvent {\n\ttype: \"timeout\";\n}\n\nexport type ReceiverDataFrame =\n\t| ReceivedVideoFrame\n\t| ReceivedAudioFrame\n\t| ReceivedMetadataFrame\n\t| SourceChangeEvent\n\t| StatusChangeEvent\n\t| TimeoutEvent;\n\nexport interface AudioReceiveOptions {\n\taudioFormat?: AudioFormat;\n\treferenceLevel?: number;\n}\n\nexport interface ReceiverPerformance {\n\ttotal: { videoFrames: number; audioFrames: number; metadataFrames: number };\n\tdropped: { videoFrames: number; audioFrames: number; metadataFrames: number };\n}\n\nexport interface ReceiverQueue {\n\tvideoFrames: number;\n\taudioFrames: number;\n}\n\nexport interface Receiver {\n\tsource: Source;\n\tcolorFormat: ColorFormat;\n\tbandwidth: Bandwidth;\n\tallowVideoFields: boolean;\n\tname?: string;\n\tvideo(timeoutMs?: number): Promise<ReceivedVideoFrame>;\n\taudio(timeoutMs?: number): Promise<ReceivedAudioFrame>;\n\taudio(\n\t\toptions: AudioReceiveOptions,\n\t\ttimeoutMs?: number,\n\t): Promise<ReceivedAudioFrame>;\n\tmetadata(timeoutMs?: number): Promise<ReceivedMetadataFrame>;\n\tdata(timeoutMs?: number): Promise<ReceiverDataFrame>;\n\tdata(\n\t\toptions: AudioReceiveOptions,\n\t\ttimeoutMs?: number,\n\t): Promise<ReceiverDataFrame>;\n\ttally(state: ReceiverTallyState): boolean;\n\tdestroy(): boolean;\n\tperformance(): ReceiverPerformance;\n\tqueue(): ReceiverQueue;\n\tconnections(): number;\n}\n\nexport interface ReceiverTallyState {\n\tonProgram?: boolean;\n\tonPreview?: boolean;\n}\n\nexport interface SenderTally {\n\tchanged: boolean;\n\tonProgram: boolean;\n\tonPreview: boolean;\n\t/** @deprecated Use `onProgram` instead. */\n\ton_program: boolean;\n\t/** @deprecated Use `onPreview` instead. */\n\ton_preview: boolean;\n}\n\nexport interface Sender {\n\tname: string;\n\tgroups?: string;\n\tclockVideo: boolean;\n\tclockAudio: boolean;\n\tvideo(frame: VideoFrame): Promise<void>;\n\taudio(frame: AudioFrame): Promise<void>;\n\tconnections(): number;\n\tmetadata(data: string): boolean;\n\ttally(): SenderTally;\n\tsourceName(): string;\n\t/** @deprecated Use `sourceName` instead. */\n\tsourcename(): string;\n\tdestroy(): boolean;\n}\n\nexport interface Routing {\n\tname?: string;\n\tgroups?: string;\n\tdestroy(): boolean;\n\tchange(source: Source | null | undefined): boolean;\n\tclear(): boolean;\n\tconnections(): number;\n\tsourceName(): string;\n\t/** @deprecated Use `sourceName` instead. */\n\tsourcename(): string;\n}\n\nexport interface FrameSyncAudioOptionsBase {\n\tsampleRate?: number;\n\tchannels?: number;\n\t/** @deprecated Use `channels` instead. */\n\tnoChannels?: number;\n}\n\nexport type FrameSyncAudioOptions =\n\t| (FrameSyncAudioOptionsBase & {\n\t\t\tsamples: number;\n\t\t\t/** @deprecated Use `samples` instead. */\n\t\t\tnoSamples?: number;\n\t })\n\t| (FrameSyncAudioOptionsBase & {\n\t\t\tsamples?: never;\n\t\t\t/** @deprecated Use `samples` instead. */\n\t\t\tnoSamples: number;\n\t });\n\nexport interface FrameSyncAudioFormat {\n\tsampleRate: number;\n\tchannels: number;\n}\n\nexport interface FrameSync {\n\t/**\n\t * Captures a video frame using NDI frame-synchronization (time base correction).\n\t * Always returns immediately.\n\t *\n\t * If no video has ever been received, resolves with `{ type: \"timeout\" }`.\n\t */\n\tvideo(fieldType?: FrameType): Promise<ReceivedVideoFrame | TimeoutEvent>;\n\t/**\n\t * Captures audio using NDI frame-synchronization (resampled to match your calls).\n\t * Always returns immediately and may insert silence if no audio is present.\n\t * `samples` must be greater than zero.\n\t */\n\taudio(options: FrameSyncAudioOptions): Promise<ReceivedAudioFrame>;\n\t/**\n\t * Returns the current incoming audio format, or `undefined` when no audio\n\t * format has been received yet.\n\t */\n\taudioFormat(): FrameSyncAudioFormat | undefined;\n\t/**\n\t * Returns an approximate depth of the internal audio queue in samples.\n\t */\n\taudioQueueDepth(): number;\n\tdestroy(): boolean;\n}\n\nexport interface Finder {\n\tsources(): Source[];\n\twait(timeoutMs?: number): Promise<boolean>;\n\tdestroy(): boolean;\n}\n\nexport interface FindOptions {\n\tshowLocalSources?: boolean;\n\tgroups?: string;\n\t/** @deprecated Use `extraIPs` instead. */\n\textraIps?: string;\n\textraIPs?: string;\n}\n\nexport interface ReceiveOptions {\n\tsource: Source;\n\tcolorFormat?: ColorFormat;\n\tbandwidth?: Bandwidth;\n\t/**\n\t * If `colorFormat` is `ColorFormat.Fastest` or `ColorFormat.Best`, the NDI SDK\n\t * implicitly enables video fields and this option is forced to `true`.\n\t */\n\tallowVideoFields?: boolean;\n\tname?: string;\n}\n\nexport interface SendOptions {\n\tname: string;\n\tgroups?: string;\n\tclockVideo?: boolean;\n\tclockAudio?: boolean;\n}\n\nexport interface Grandi {\n\t/**\n\t * Gets the NDI SDK version string (e.g. `\"NDI SDK 6.0.0.0\"`).\n\t * @returns The NDI SDK version string.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * console.log(grandi.version());\n\t * ```\n\t */\n\tversion(): string;\n\t/**\n\t * Checks if the current CPU architecture is supported by NDI.\n\t * @returns `true` when NDI is supported on this CPU/platform.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * if (!grandi.isSupportedCPU()) throw new Error(\"NDI unsupported here\");\n\t * ```\n\t */\n\tisSupportedCPU(): boolean;\n\t/**\n\t * Optionally initializes the process-global NDI library.\n\t * The SDK does not require this call, but eager initialization is recommended\n\t * when the application explicitly manages startup and shutdown.\n\t * @returns `true` if initialization succeeded and the CPU is supported.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * if (!grandi.initialize()) throw new Error(\"NDI init failed\");\n\t * ```\n\t */\n\tinitialize(): boolean;\n\t/**\n\t * Optionally shuts down the process-global NDI library.\n\t * When managing the lifecycle explicitly, destroy all native objects first.\n\t * @returns `true` after requesting shutdown.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.destroy();\n\t * ```\n\t */\n\tdestroy(): boolean;\n\t/**\n\t * Creates an NDI sender for transmitting video and audio over the network.\n\t * @param params Sender options.\n\t * @returns A promise that resolves to a Sender instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const sender = await grandi.send({ name: \"My Source\" });\n\t * ```\n\t */\n\tsend(params: SendOptions): Promise<Sender>;\n\t/**\n\t * Creates an NDI receiver for receiving video and audio from an NDI source.\n\t * @param params Receiver options.\n\t * @returns A promise that resolves to a Receiver instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const finder = await grandi.find({ showLocalSources: true });\n\t * await finder.wait(1000);\n\t * const source = finder.sources()[0];\n\t * finder.destroy();\n\t * const receiver = await grandi.receive({ source });\n\t * const frame = await receiver.video(1000);\n\t * receiver.destroy();\n\t * ```\n\t */\n\treceive(params: ReceiveOptions): Promise<Receiver>;\n\t/**\n\t * Creates an NDI frame-synchronizer (time base corrector) backed by an existing receiver.\n\t * While it exists, direct `video`, `audio`, and `data` captures on that\n\t * receiver are unavailable; metadata and control methods such as `tally` remain usable.\n\t * Destroy the frame-sync before the receiver. Direct capture becomes available\n\t * again after the frame-sync is destroyed.\n\t */\n\tframeSync(receiver: Receiver): Promise<FrameSync>;\n\t/**\n\t * Creates an NDI router for switching between different NDI sources.\n\t * @param params Router options.\n\t * @returns A promise that resolves to a Routing instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if routing creation fails.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const router = await grandi.routing({ name: \"My Router\" });\n\t * // router.change(source) to route a discovered source\n\t * router.destroy();\n\t * ```\n\t */\n\trouting(params: { name?: string; groups?: string }): Promise<Routing>;\n\t/**\n\t * Creates a finder to discover NDI sources on the network.\n\t * @param params Discovery options.\n\t * @returns A promise that resolves to a Finder instance.\n\t * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.\n\t *\n\t * @example\n\t * ```js\n\t * import grandi from \"grandi\";\n\t * grandi.initialize();\n\t * const finder = await grandi.find({ showLocalSources: true });\n\t * await finder.wait(1000);\n\t * console.log(finder.sources());\n\t * finder.destroy();\n\t * ```\n\t */\n\tfind(params?: FindOptions): Promise<Finder>;\n\n\t/**\n\t * Enum: receiver video color formats.\n\t */\n\tColorFormat: typeof ColorFormat;\n\t/** @deprecated Use `ColorFormat.BGRX_BGRA` instead. */\n\tCOLOR_FORMAT_BGRX_BGRA: ColorFormat.BGRX_BGRA;\n\t/** @deprecated Use `ColorFormat.UYVY_BGRA` instead. */\n\tCOLOR_FORMAT_UYVY_BGRA: ColorFormat.UYVY_BGRA;\n\t/** @deprecated Use `ColorFormat.RGBX_RGBA` instead. */\n\tCOLOR_FORMAT_RGBX_RGBA: ColorFormat.RGBX_RGBA;\n\t/** @deprecated Use `ColorFormat.UYVY_RGBA` instead. */\n\tCOLOR_FORMAT_UYVY_RGBA: ColorFormat.UYVY_RGBA;\n\t/** @deprecated Use `ColorFormat.Fastest` instead. */\n\tCOLOR_FORMAT_FASTEST: ColorFormat.Fastest;\n\t/** @deprecated Use `ColorFormat.Best` instead. */\n\tCOLOR_FORMAT_BEST: ColorFormat.Best;\n\t/** @deprecated Use `ColorFormat.BGRX_BGRA_FLIPPED` instead. */\n\tCOLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat.BGRX_BGRA_FLIPPED;\n\t/**\n\t * Enum: supported raw audio formats for helpers/receive conversions.\n\t */\n\tAudioFormat: typeof AudioFormat;\n\t/** @deprecated Use `AudioFormat.Float32Separate` instead. */\n\tAUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat.Float32Separate;\n\t/** @deprecated Use `AudioFormat.Float32Interleaved` instead. */\n\tAUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat.Float32Interleaved;\n\t/** @deprecated Use `AudioFormat.Int16Interleaved` instead. */\n\tAUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat.Int16Interleaved;\n\t/**\n\t * Enum: receiver bandwidth modes.\n\t */\n\tBandwidth: typeof Bandwidth;\n\t/** @deprecated Use `Bandwidth.MetadataOnly` instead. */\n\tBANDWIDTH_METADATA_ONLY: Bandwidth.MetadataOnly;\n\t/** @deprecated Use `Bandwidth.AudioOnly` instead. */\n\tBANDWIDTH_AUDIO_ONLY: Bandwidth.AudioOnly;\n\t/** @deprecated Use `Bandwidth.Lowest` instead. */\n\tBANDWIDTH_LOWEST: Bandwidth.Lowest;\n\t/** @deprecated Use `Bandwidth.Highest` instead. */\n\tBANDWIDTH_HIGHEST: Bandwidth.Highest;\n\t/**\n\t * Enum: video frame format types (progressive/interlaced/fields).\n\t */\n\tFrameType: typeof FrameType;\n\t/** @deprecated Use `FrameType.Progressive` instead. */\n\tFORMAT_TYPE_PROGRESSIVE: FrameType.Progressive;\n\t/** @deprecated Use `FrameType.Interlaced` instead. */\n\tFORMAT_TYPE_INTERLACED: FrameType.Interlaced;\n\t/** @deprecated Use `FrameType.Field0` instead. */\n\tFORMAT_TYPE_FIELD_0: FrameType.Field0;\n\t/** @deprecated Use `FrameType.Field1` instead. */\n\tFORMAT_TYPE_FIELD_1: FrameType.Field1;\n\t/**\n\t * Enum: FourCC pixel/audio formats used in frames.\n\t */\n\tFourCC: typeof FourCC;\n\t/** @deprecated Use `FourCC.UYVY` instead. */\n\tFOURCC_UYVY: FourCC.UYVY;\n\t/** @deprecated Use `FourCC.UYVA` instead. */\n\tFOURCC_UYVA: FourCC.UYVA;\n\t/** @deprecated Use `FourCC.P216` instead. */\n\tFOURCC_P216: FourCC.P216;\n\t/** @deprecated Use `FourCC.PA16` instead. */\n\tFOURCC_PA16: FourCC.PA16;\n\t/** @deprecated Use `FourCC.YV12` instead. */\n\tFOURCC_YV12: FourCC.YV12;\n\t/** @deprecated Use `FourCC.I420` instead. */\n\tFOURCC_I420: FourCC.I420;\n\t/** @deprecated Use `FourCC.NV12` instead. */\n\tFOURCC_NV12: FourCC.NV12;\n\t/** @deprecated Use `FourCC.BGRA` instead. */\n\tFOURCC_BGRA: FourCC.BGRA;\n\t/** @deprecated Use `FourCC.BGRX` instead. */\n\tFOURCC_BGRX: FourCC.BGRX;\n\t/** @deprecated Use `FourCC.RGBA` instead. */\n\tFOURCC_RGBA: FourCC.RGBA;\n\t/** @deprecated Use `FourCC.RGBX` instead. */\n\tFOURCC_RGBX: FourCC.RGBX;\n\t/** @deprecated Use `FourCC.FLTp` instead. */\n\tFOURCC_FLTp: FourCC.FLTp;\n\t/**\n\t * NDI sentinel that asks the SDK to synthesize the timecode.\n\t *\n\t * @see [Synthesized timecode in the NDI SDK documentation](https://docs.ndi.video/all/getting-started/white-paper/time-timecode-and-sync-for-ndi#synthesized-timecode)\n\t */\n\tTIMECODE_SYNTHESIZE: bigint;\n}\n","import path from \"node:path\";\nimport nodeGypBuild from \"node-gyp-build\";\nimport platformTargets from \"./platforms.json\" with { type: \"json\" };\n\nimport type {\n\tFinder,\n\tFindOptions,\n\tFrameSync,\n\tGrandi,\n\tReceiveOptions,\n\tReceiver,\n\tRouting,\n\tSender,\n\tSendOptions,\n} from \"./types.js\";\nimport {\n\tAudioFormat,\n\tBandwidth,\n\tColorFormat,\n\tFourCC,\n\tFrameType,\n\tTIMECODE_SYNTHESIZE,\n} from \"./types.js\";\n\nfunction currentPlatformTarget() {\n\treturn platformTargets.find(\n\t\t(target) =>\n\t\t\ttarget.platform === process.platform && target.arch === process.arch,\n\t);\n}\n\n/**\n * Checks if the current platform and architecture are supported by NDI.\n * @returns {boolean} True if the platform and architecture are supported, false otherwise.\n */\nfunction isSupportedPlatform(): boolean {\n\treturn currentPlatformTarget() !== undefined;\n}\n\nfunction tryRequireArchPackage(): GrandiAddon | null {\n\tconst archKey = `${process.platform}-${process.arch}`;\n\tconst target = currentPlatformTarget();\n\tif (!target)\n\t\tthrow new Error(`Unsupported platform or architecture: ${archKey}`);\n\tconst pkg = target.packageName;\n\ttry {\n\t\t// eslint-disable-next-line @typescript-eslint/no-var-requires\n\t\treturn require(pkg) as GrandiAddon;\n\t} catch (cause) {\n\t\tconst packageError = new Error(\n\t\t\t`Failed to find prebuilt package for ${archKey}. Please ensure that the package \"${pkg}\" is installed`,\n\t\t);\n\t\tObject.defineProperty(packageError, \"cause\", {\n\t\t\tconfigurable: true,\n\t\t\tvalue: cause,\n\t\t});\n\t\tthrow packageError;\n\t}\n}\n\nfunction loadAddon(): GrandiAddon {\n\tconst loadErrors: Error[] = [];\n\tif (!isSupportedPlatform()) {\n\t\tconsole.error(\n\t\t\t`Unsupported platform or architecture: ${process.platform}-${process.arch}`,\n\t\t);\n\t\treturn noopAddon;\n\t}\n\n\ttry {\n\t\tconst localBinding = nodeGypBuild(\n\t\t\tpath.join(__dirname, \"..\"),\n\t\t) as GrandiAddon;\n\t\tif (localBinding) return localBinding;\n\t} catch (err) {\n\t\tloadErrors.push(err as Error);\n\t}\n\n\ttry {\n\t\tconst archAddon = tryRequireArchPackage();\n\t\tif (archAddon) return archAddon;\n\t\tloadErrors.push(\n\t\t\tnew Error(\n\t\t\t\t`Prebuilt package for ${process.platform}-${process.arch} did not provide an addon`,\n\t\t\t),\n\t\t);\n\t} catch (err) {\n\t\tloadErrors.push(err as Error);\n\t}\n\n\tif (loadErrors.length > 0) {\n\t\tconst message =\n\t\t\t\"Failed to load native addon:\\n\" +\n\t\t\tloadErrors.map((e, i) => ` [${i + 1}] ${e.message}`).join(\"\\n\");\n\t\ttype AddonLoadError = Error & { errors: Error[] };\n\t\tconst AggregateErrorConstructor = (\n\t\t\tglobalThis as typeof globalThis & {\n\t\t\t\tAggregateError?: new (\n\t\t\t\t\terrors: Error[],\n\t\t\t\t\tmessage: string,\n\t\t\t\t) => AddonLoadError;\n\t\t\t}\n\t\t).AggregateError;\n\t\tthrow AggregateErrorConstructor\n\t\t\t? new AggregateErrorConstructor(loadErrors, message)\n\t\t\t: Object.assign(new Error(message), { errors: loadErrors });\n\t}\n\tthrow new Error(\"Failed to load native addon\");\n}\n\n/** @internal Native addon contract used by the JavaScript wrapper. */\nexport interface GrandiAddon {\n\tversion(): string;\n\tisSupportedCPU(): boolean;\n\tinitialize(): boolean;\n\tdestroy(): boolean;\n\tfind(params?: FindOptions): Promise<Finder>;\n\treceive(params: ReceiveOptions): Promise<Receiver>;\n\tframesync(receiver: Receiver): Promise<FrameSync>;\n\tsend(params: SendOptions): Promise<Sender>;\n\trouting(params: { name?: string; groups?: string }): Promise<Routing>;\n}\n\nconst noopAddon: GrandiAddon = {\n\tversion() {\n\t\treturn \"\";\n\t},\n\tisSupportedCPU() {\n\t\treturn false;\n\t},\n\tinitialize() {\n\t\treturn false;\n\t},\n\tdestroy() {\n\t\treturn false;\n\t},\n\tsend(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\treceive(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\tframesync(_receiver) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\trouting() {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n\tfind(_params) {\n\t\treturn Promise.reject(new Error(\"Unsupported platform or CPU\"));\n\t},\n};\n\nconst addon: GrandiAddon = loadAddon();\n/**\n * Creates a finder to discover NDI sources on the network.\n * @param {FindOptions} params - Options for finding sources.\n * @param {boolean} [params.showLocalSources] - Whether to show local sources.\n * @param {string} [params.groups] - Multicast groups to search in.\n * @param {string} [params.extraIPs] - Additional IP addresses to search.\n * @returns {Promise<Finder>} A promise that resolves to a Finder instance for discovering sources.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if the finder cannot be created.\n *\n * @example\n * ```js\n * import { find, initialize } from \"grandi\";\n * initialize();\n * const finder = await find({ showLocalSources: true });\n * await finder.wait(1000);\n * console.log(finder.sources());\n * finder.destroy();\n * ```\n */\nexport function find(params: FindOptions = {}): Promise<Finder> {\n\tconst { extraIPs, extraIps, ...options } = params;\n\tconst normalizedExtraIps = extraIPs ?? extraIps;\n\treturn addon.find(\n\t\tnormalizedExtraIps === undefined\n\t\t\t? options\n\t\t\t: { ...options, extraIPs: normalizedExtraIps },\n\t);\n}\n// Named runtime exports\n/**\n * Gets the version of the NDI SDK.\n * @returns {string} The NDI SDK version string.\n */\nexport const version = addon.version;\n/**\n * Checks if the current CPU architecture is supported by NDI.\n * @returns {boolean} True if the CPU is supported, false otherwise.\n */\nexport const isSupportedCPU = addon.isSupportedCPU;\n/**\n * Optionally initializes the process-global NDI library. The SDK does not require\n * this call, but eager initialization is recommended for explicit lifecycle management.\n * @returns {boolean} True if initialization was successful and the CPU is supported.\n *\n * @example\n * ```js\n * import { initialize } from \"grandi\";\n * if (!initialize()) throw new Error(\"NDI init failed\");\n * ```\n */\nexport const initialize = addon.initialize;\n/**\n * Optionally shuts down the process-global NDI library.\n * When managing the lifecycle explicitly, destroy all native objects before calling this.\n * @returns {boolean} True after requesting shutdown.\n *\n * @example\n * ```js\n * import { destroy } from \"grandi\";\n * destroy();\n * ```\n */\nexport const destroy = addon.destroy;\n/**\n * Creates an NDI sender for transmitting video and audio over the network.\n * @param {SendOptions} params - Options for creating the sender.\n * @param {string} params.name - The name of the NDI source.\n * @param {string} [params.groups] - Multicast groups to send to.\n * @param {boolean} [params.clockVideo] - Whether to clock video frames.\n * @param {boolean} [params.clockAudio] - Whether to clock audio frames.\n * @returns {Promise<Sender>} A promise that resolves to a Sender instance for transmitting data.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if sender creation fails.\n *\n * @example\n * ```js\n * import { initialize, send } from \"grandi\";\n * initialize();\n * const sender = await send({ name: \"My Source\" });\n * // sender.video(...) / sender.audio(...)\n * sender.destroy();\n * ```\n */\nexport async function send(params: SendOptions): Promise<Sender> {\n\tconst native = await addon.send(params);\n\tObject.defineProperty(native, \"sourceName\", {\n\t\tconfigurable: true,\n\t\tvalue: native.sourcename,\n\t});\n\tconst origTally = native.tally;\n\tnative.tally = () => {\n\t\tconst result = origTally.call(native);\n\t\tObject.defineProperties(result, {\n\t\t\tonProgram: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tget() {\n\t\t\t\t\treturn this.on_program;\n\t\t\t\t},\n\t\t\t},\n\t\t\tonPreview: {\n\t\t\t\tconfigurable: true,\n\t\t\t\tget() {\n\t\t\t\t\treturn this.on_preview;\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\t\treturn result;\n\t};\n\treturn native;\n}\n/**\n * Creates an NDI receiver for receiving video and audio from an NDI source.\n * @param {ReceiveOptions} params - Options for creating the receiver.\n * @param {ReceiveOptions[\"source\"]} params.source - The NDI source to connect to.\n * @param {ReceiveOptions[\"colorFormat\"]} [params.colorFormat] - The color format for received video.\n * @param {ReceiveOptions[\"bandwidth\"]} [params.bandwidth] - The bandwidth limitation for the connection.\n * @param {boolean} [params.allowVideoFields] - Whether to allow video fields.\n * @param {string} [params.name] - The name for the receiver.\n * @returns {Promise<Receiver>} A promise that resolves to a Receiver instance for receiving data.\n * @throws {Error} Promise rejects on unsupported platform/CPU or if receiver creation fails.\n *\n * @example\n * ```js\n * import { find, initialize, receive } from \"grandi\";\n * initialize();\n * const finder = await find({ showLocalSources: true });\n * await finder.wait(1000);\n * const source = finder.sources()[0];\n * finder.destroy();\n * const receiver = await receive({ source });\n * const frame = await receiver.video(1000);\n * receiver.destroy();\n * ```\n */\nexport const receive = addon.receive;\nexport const frameSync = addon.framesync;\n/** @deprecated Use `frameSync` instead. */\nexport const framesync = addon.framesync;\nexport async function routing(params: {\n\tname?: string;\n\tgroups?: string;\n}): Promise<Routing> {\n\tconst native = await addon.routing(params);\n\tObject.defineProperty(native, \"sourceName\", {\n\t\tconfigurable: true,\n\t\tvalue: native.sourcename,\n\t});\n\treturn native;\n}\n\n// Re-export enums and timing constants for convenient named imports\nexport {\n\tAudioFormat,\n\tBandwidth,\n\tColorFormat,\n\tFourCC,\n\tFrameType,\n\tTIMECODE_SYNTHESIZE,\n};\nexport type {\n\tAudioFourCC,\n\tAudioFrame,\n\tAudioReceiveOptions,\n\tFinder,\n\tFindOptions,\n\tFrameSync,\n\tFrameSyncAudioFormat,\n\tFrameSyncAudioOptions,\n\tFrameSyncAudioOptionsBase,\n\tGrandi,\n\tReceivedAudioFrame,\n\tReceivedMetadataFrame,\n\tReceivedVideoFrame,\n\tReceiveOptions,\n\tReceiverDataFrame,\n\tReceiver,\n\tReceiverPerformance,\n\tReceiverQueue,\n\tReceiverTallyState,\n\tRouting,\n\tSender,\n\tSendOptions,\n\tSenderTally,\n\tSource,\n\tSourceChangeEvent,\n\tStatusChangeEvent,\n\tTimecode,\n\tTimeoutEvent,\n\tVideoFourCC,\n\tVideoFrame,\n} from \"./types.js\";\n\nconst grandi: Grandi = {\n\tversion,\n\tisSupportedCPU,\n\tinitialize,\n\tdestroy,\n\tsend,\n\treceive,\n\tframeSync,\n\trouting,\n\tfind,\n\tColorFormat,\n\tAudioFormat,\n\tBandwidth,\n\tFrameType,\n\tFourCC,\n\tCOLOR_FORMAT_BGRX_BGRA: ColorFormat.BGRX_BGRA,\n\tCOLOR_FORMAT_UYVY_BGRA: ColorFormat.UYVY_BGRA,\n\tCOLOR_FORMAT_RGBX_RGBA: ColorFormat.RGBX_RGBA,\n\tCOLOR_FORMAT_UYVY_RGBA: ColorFormat.UYVY_RGBA,\n\tCOLOR_FORMAT_FASTEST: ColorFormat.Fastest,\n\tCOLOR_FORMAT_BEST: ColorFormat.Best,\n\tCOLOR_FORMAT_BGRX_BGRA_FLIPPED: ColorFormat.BGRX_BGRA_FLIPPED,\n\tAUDIO_FORMAT_FLOAT_32_SEPARATE: AudioFormat.Float32Separate,\n\tAUDIO_FORMAT_FLOAT_32_INTERLEAVED: AudioFormat.Float32Interleaved,\n\tAUDIO_FORMAT_INT_16_INTERLEAVED: AudioFormat.Int16Interleaved,\n\tBANDWIDTH_METADATA_ONLY: Bandwidth.MetadataOnly,\n\tBANDWIDTH_AUDIO_ONLY: Bandwidth.AudioOnly,\n\tBANDWIDTH_LOWEST: Bandwidth.Lowest,\n\tBANDWIDTH_HIGHEST: Bandwidth.Highest,\n\tFORMAT_TYPE_PROGRESSIVE: FrameType.Progressive,\n\tFORMAT_TYPE_INTERLACED: FrameType.Interlaced,\n\tFORMAT_TYPE_FIELD_0: FrameType.Field0,\n\tFORMAT_TYPE_FIELD_1: FrameType.Field1,\n\tFOURCC_UYVY: FourCC.UYVY,\n\tFOURCC_UYVA: FourCC.UYVA,\n\tFOURCC_P216: FourCC.P216,\n\tFOURCC_PA16: FourCC.PA16,\n\tFOURCC_YV12: FourCC.YV12,\n\tFOURCC_I420: FourCC.I420,\n\tFOURCC_NV12: FourCC.NV12,\n\tFOURCC_BGRA: FourCC.BGRA,\n\tFOURCC_BGRX: FourCC.BGRX,\n\tFOURCC_RGBA: FourCC.RGBA,\n\tFOURCC_RGBX: FourCC.RGBX,\n\tFOURCC_FLTp: FourCC.FLTp,\n\tTIMECODE_SYNTHESIZE,\n};\n\nexport default grandi;\n"],"x_google_ignoreList":[0],"mappings":";;;;;;;;AAIA,MAAM,oBAAoB,cAAc,OAAO,KAAK,GAAG;AACvD,MAAM,mBAAmB,KAAK,QAAQ,YAAY,CAAC;AAEnD,MAAa,YAA4B,2BAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AEPpD,IAAY,YAAL,yBAAA,WAAA;CACN,UAAA,UAAA,gBAAA,KAAA;CACA,UAAA,UAAA,iBAAA,KAAA;CACA,UAAA,UAAA,YAAA,KAAA;CACA,UAAA,UAAA,YAAA,KAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAY,cAAL,yBAAA,aAAA;CACN,YAAA,YAAA,eAAA,KAAA;CACA,YAAA,YAAA,eAAA,KAAA;CACA,YAAA,YAAA,eAAA,KAAA;CACA,YAAA,YAAA,eAAA,KAAA;CACA,YAAA,YAAA,aAAA,OAAA;CACA,YAAA,YAAA,UAAA,OAAA;CAEA,YAAA,YAAA,uBAAA,OAAA;;AACD,EAAA,CAAA,CAAA;AAEA,IAAY,cAAL,yBAAA,aAAA;CACN,YAAA,YAAA,qBAA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;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA,wBAAA;CACA,wBAAA;CACA,wBAAA;CACA,wBAAA;CACA,sBAAA;CACA,mBAAA;CACA,gCAAA;CACA,gCAAA;CACA,mCAAA;CACA,iCAAA;CACA,yBAAA;CACA,sBAAA;CACA,kBAAA;CACA,mBAAA;CACA,yBAAA;CACA,wBAAA;CACA,qBAAA;CACA,qBAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA,aAAA;CACA;AACD"}
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "grandi",
3
- "version": "1.3.1",
4
- "description": "Node.JS native bindings to the Newtek NDI SDK.",
5
- "homepage": "https://github.com/tux-tn/grandi#readme",
3
+ "version": "2.0.1",
4
+ "description": "TypeScript-first native Node.js bindings to the NDI SDK.",
5
+ "homepage": "https://tux-tn.github.io/grandi/",
6
6
  "keywords": [
7
7
  "Newtek",
8
8
  "NDI",
@@ -12,6 +12,7 @@
12
12
  ],
13
13
  "author": "Sarhan Aissi <npm@tux.tn>",
14
14
  "license": "Apache-2.0",
15
+ "type": "module",
15
16
  "files": [
16
17
  "dist",
17
18
  "LICENSE",
@@ -33,53 +34,63 @@
33
34
  "url": "https://github.com/tux-tn/grandi/issues"
34
35
  },
35
36
  "optionalDependencies": {
36
- "@grandi/darwin-x64": "1.3.1",
37
- "@grandi/darwin-arm64": "1.3.1",
38
- "@grandi/linux-arm64": "1.3.1",
39
- "@grandi/linux-armv7l": "1.3.1",
40
- "@grandi/linux-x64": "1.3.1",
41
- "@grandi/win32-ia32": "1.3.1",
42
- "@grandi/win32-x64": "1.3.1"
37
+ "@grandi/darwin-arm64": "2.0.1",
38
+ "@grandi/darwin-x64": "2.0.1",
39
+ "@grandi/linux-arm64": "2.0.1",
40
+ "@grandi/linux-armv7l": "2.0.1",
41
+ "@grandi/linux-x64": "2.0.1",
42
+ "@grandi/win32-ia32": "2.0.1",
43
+ "@grandi/win32-x64": "2.0.1"
43
44
  },
44
45
  "dependencies": {
45
46
  "node-gyp-build": "^4.8.4"
46
47
  },
47
48
  "devDependencies": {
48
- "@biomejs/biome": "2.3.9",
49
- "@types/bindings": "^1.5.5",
50
49
  "@types/cross-zip": "^4.0.2",
51
- "@types/node": "^25.0.2",
50
+ "@types/node": "^26.1.1",
52
51
  "@types/shelljs": "^0.10.0",
53
52
  "@types/tmp": "^0.2.6",
54
- "@vitest/coverage-v8": "^4.0.15",
55
- "cross-env": "^10.1.0",
56
- "cross-spawn": "7.0.6",
53
+ "@vitest/coverage-v8": "^4.1.10",
54
+ "conventional-changelog": "^8.1.0",
55
+ "conventional-changelog-conventionalcommits": "^10.2.1",
57
56
  "cross-zip": "4.0.1",
58
- "execa": "9.6.1",
59
- "got": "14.6.5",
60
- "node-gyp": "^12.1.0",
57
+ "electron": "43.1.1",
58
+ "execa": "10.0.0",
59
+ "got": "15.1.0",
60
+ "node-gyp": "^13.0.1",
61
+ "oxfmt": "0.60.0",
62
+ "oxlint": "1.75.0",
63
+ "oxlint-tsgolint": "^7.0.2001",
61
64
  "shelljs": "0.10.0",
62
65
  "shx": "0.4.0",
63
- "standard-version": "^9.5.0",
64
- "tmp": "0.2.5",
65
- "tsdown": "^0.18.0",
66
- "typescript": "^5.9.3",
67
- "vitest": "^4.0.15"
66
+ "tmp": "0.2.7",
67
+ "tsdown": "^0.22.13",
68
+ "typescript": "^7.0.2",
69
+ "vitest": "^4.1.10",
70
+ "yaml": "^2.9.0"
68
71
  },
69
72
  "scripts": {
70
73
  "bench": "node --expose-gc scripts/benchmark.mjs",
71
74
  "build": "tsdown",
72
75
  "build:addon": "node scripts/build-addon.mjs",
76
+ "changelog": "conventional-changelog -p conventionalcommits -i CHANGELOG.md -s",
73
77
  "clean": "shx rm -rf ndi build",
74
- "format": "biome format",
78
+ "docs:api": "npm --prefix docs run api",
79
+ "docs:build": "npm --prefix docs run build",
80
+ "docs:dev": "npm --prefix docs run dev",
81
+ "docs:preview": "npm --prefix docs run preview",
82
+ "format": "oxfmt --check",
83
+ "format:fix": "oxfmt",
75
84
  "format:cpp": "clang-format -i lib/*.cc lib/*.h",
76
- "install": "exit 0",
77
- "lint": "biome lint",
85
+ "lint": "oxlint",
86
+ "lint:fix": "oxlint --fix",
78
87
  "test": "vitest run",
79
88
  "test:coverage": "vitest run --coverage",
80
89
  "test:integration": "vitest run test/integration",
90
+ "test:electron": "npm run build && electron test/electron --no-sandbox",
81
91
  "test:unit": "vitest run test/unit",
82
- "test:watch": "vitest"
92
+ "test:watch": "vitest",
93
+ "validate:platforms": "node scripts/validate-platforms.mjs"
83
94
  },
84
95
  "engines": {
85
96
  "node": ">=20.19.5"