From 333d11559802d0a2e2da59b2242af2b5106ceaeb Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:06:44 +0000 Subject: [PATCH 1/5] Initial plan From 5a836becb7bc5c9de5ee5e308a036a5329d1d036 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:14:33 +0000 Subject: [PATCH 2/5] Initial investigation: mlx.core.full() is already implemented Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com> --- node/package-lock.json | 1265 +--------------------------------------- 1 file changed, 5 insertions(+), 1260 deletions(-) diff --git a/node/package-lock.json b/node/package-lock.json index b38328f9..18e704d5 100644 --- a/node/package-lock.json +++ b/node/package-lock.json @@ -1,1270 +1,15 @@ { - "name": "mlx-node", - "version": "0.1.0", + "name": "mlx", + "version": "0.0.1", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "mlx-node", - "version": "0.1.0", - "dependencies": { - "fmt": "^2.0.0", - "nan": "^2.23.0", - "node-addon-api": "^7.0.0" - }, - "devDependencies": { - "@types/mocha": "^10.0.6", - "@types/node": "^22.5.5", - "@types/react": "^19.0.0", - "mocha": "^11.0.1", - "typescript": "^5.8.3" - }, - "peerDependencies": { - "react": "^19.0.0-0", - "react-dom": "^19.0.0-0" - } - }, - "node_modules/@isaacs/cliui": { - "version": "8.0.2", - "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", - "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^5.1.2", - "string-width-cjs": "npm:string-width@^4.2.0", - "strip-ansi": "^7.0.1", - "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", - "wrap-ansi": "^8.1.0", - "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/@isaacs/cliui/node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/@isaacs/cliui/node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/@pkgjs/parseargs": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", - "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", - "dev": true, - "license": "MIT", - "optional": true, - "engines": { - "node": ">=14" - } - }, - "node_modules/@types/mocha": { - "version": "10.0.10", - "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", - "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", - "dev": true, - "license": "MIT" - }, - "node_modules/@types/node": { - "version": "22.18.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.18.6.tgz", - "integrity": "sha512-r8uszLPpeIWbNKtvWRt/DbVi5zbqZyj1PTmhRMqBMvDnaz1QpmSKujUtJLrqGZeoM8v72MfYggDceY4K1itzWQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "undici-types": "~6.21.0" - } - }, - "node_modules/@types/react": { - "version": "19.1.13", - "resolved": "https://registry.npmjs.org/@types/react/-/react-19.1.13.tgz", - "integrity": "sha512-hHkbU/eoO3EG5/MZkuFSKmYqPbSVk5byPFa3e7y/8TybHiLMACgI8seVYlicwk7H5K/rI2px9xrQp/C+AUDTiQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "csstype": "^3.0.2" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true, - "license": "Python-2.0" - }, - "node_modules/balanced-match": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", - "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==", - "dev": true, - "license": "MIT" - }, - "node_modules/brace-expansion": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.2.tgz", - "integrity": "sha512-Jt0vHyM+jmUBqojB7E1NIYadt0vI0Qxjxd2TErW94wDz+E2LAm5vKMXXwg6ZZBTHPuUlDgQHKXvjGBdfcF1ZDQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "balanced-match": "^1.0.0" - } - }, - "node_modules/browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", - "dev": true, - "license": "ISC" - }, - "node_modules/camelcase": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-6.3.0.tgz", - "integrity": "sha512-Gmy6FhYlCY7uOElZUSbxo2UCDH8owEk996gkbrpsgGtrJLM3J7jGxl9Ic7Qwwj4ivOE5AWZWRMecDdF7hqGjFA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chalk/node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/chokidar": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", - "integrity": "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA==", - "dev": true, - "license": "MIT", - "dependencies": { - "readdirp": "^4.0.1" - }, - "engines": { - "node": ">= 14.16.0" - }, - "funding": { - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/cliui": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", - "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", - "dev": true, - "license": "ISC", - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.1", - "wrap-ansi": "^7.0.0" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/cliui/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/cliui/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cliui/node_modules/wrap-ansi": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true, - "license": "MIT" - }, - "node_modules/cross-spawn": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", - "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", - "dev": true, - "license": "MIT", - "dependencies": { - "path-key": "^3.1.0", - "shebang-command": "^2.0.0", - "which": "^2.0.1" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/csstype": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true, - "license": "MIT" - }, - "node_modules/debug": { - "version": "4.4.3", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", - "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ms": "^2.1.3" - }, - "engines": { - "node": ">=6.0" - }, - "peerDependenciesMeta": { - "supports-color": { - "optional": true - } - } - }, - "node_modules/decamelize": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-4.0.0.tgz", - "integrity": "sha512-9iE1PgSik9HeIIw2JO94IidnE3eBoQrFJ3w7sFuzSX4DpmZ3v5sZpUiV5Swcf6mQEF+Y0ru8Neo+p+nyh2J+hQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/diff": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-7.0.0.tgz", - "integrity": "sha512-PJWHUb1RFevKCwaFA9RlG5tCd+FO5iRh9A8HEtkmBH2Li03iJriB6m6JIN4rGz3K3JLawI7/veA1xzRKP6ISBw==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.3.1" - } - }, - "node_modules/eastasianwidth": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", - "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", - "dev": true, - "license": "MIT" - }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true, - "license": "MIT" - }, - "node_modules/escalade": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", - "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, - "node_modules/escape-string-regexp": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", - "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-up": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz", - "integrity": "sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==", - "dev": true, - "license": "MIT", - "dependencies": { - "locate-path": "^6.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/flat": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/flat/-/flat-5.0.2.tgz", - "integrity": "sha512-b6suED+5/3rTpUBdG1gupIl8MPFCAMA0QXwmljLhvCUKcUvdE4gWky9zpuGCcXHOsz4J9wPGNWq6OKpmIzz3hQ==", - "dev": true, - "license": "BSD-3-Clause", - "bin": { - "flat": "cli.js" - } - }, - "node_modules/fmt": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fmt/-/fmt-2.0.0.tgz", - "integrity": "sha512-LpTujbFuTMPcLLQaY893c+6v6OO92ZvoKfgxge6xMo1uUUP4jyPZUtQWjZsj/f5kO7WtmPBgF/cFMi+iHEi/LQ==", - "license": "MIT", - "dependencies": { - "strip-ansi": "^6.0.0" - } - }, - "node_modules/foreground-child": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", - "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", - "dev": true, - "license": "ISC", - "dependencies": { - "cross-spawn": "^7.0.6", - "signal-exit": "^4.0.1" - }, - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "license": "ISC", - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/glob": { - "version": "10.4.5", - "resolved": "https://registry.npmjs.org/glob/-/glob-10.4.5.tgz", - "integrity": "sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==", - "dev": true, - "license": "ISC", - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^3.1.2", - "minimatch": "^9.0.4", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^1.11.1" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/he": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", - "integrity": "sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw==", - "dev": true, - "license": "MIT", - "bin": { - "he": "bin/he" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-plain-obj": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-2.1.0.tgz", - "integrity": "sha512-YWnfyRwxL/+SsrWYfOpUtz5b3YD+nyfkHvjbcanzk8zgyO4ASD67uVMRt8k5bM4lLMDnXfriRhOpemw+NfT1eA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/is-unicode-supported": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-0.1.0.tgz", - "integrity": "sha512-knxG2q4UC3u8stRGyAVJCOdxFmv5DZiRcdlIaAQXAbSfJya+OhopNotLQrstBhququ4ZpuKbDc/8S6mgXgPFPw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", - "dev": true, - "license": "ISC" - }, - "node_modules/jackspeak": { - "version": "3.4.3", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-3.4.3.tgz", - "integrity": "sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - }, - "optionalDependencies": { - "@pkgjs/parseargs": "^0.11.0" - } - }, - "node_modules/js-yaml": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", - "integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==", - "dev": true, - "license": "MIT", - "dependencies": { - "argparse": "^2.0.1" - }, - "bin": { - "js-yaml": "bin/js-yaml.js" - } - }, - "node_modules/locate-path": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-6.0.0.tgz", - "integrity": "sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-locate": "^5.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/log-symbols": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-4.1.0.tgz", - "integrity": "sha512-8XPvpAA8uyhfteu8pIvQxpJZ7SYYdpUivZpGy6sFsBuKRY/7rQGavedeB8aK+Zkyq6upMFVL/9AW6vOYzfRyLg==", - "dev": true, - "license": "MIT", - "dependencies": { - "chalk": "^4.1.0", - "is-unicode-supported": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true, - "license": "ISC" - }, - "node_modules/minimatch": { - "version": "9.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", - "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", - "dev": true, - "license": "ISC", - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": ">=16 || 14 >=14.17" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/minipass": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.1.2.tgz", - "integrity": "sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, - "node_modules/mocha": { - "version": "11.7.2", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-11.7.2.tgz", - "integrity": "sha512-lkqVJPmqqG/w5jmmFtiRvtA2jkDyNVUcefFJKb2uyX4dekk8Okgqop3cgbFiaIvj8uCRJVTP5x9dfxGyXm2jvQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "browser-stdout": "^1.3.1", - "chokidar": "^4.0.1", - "debug": "^4.3.5", - "diff": "^7.0.0", - "escape-string-regexp": "^4.0.0", - "find-up": "^5.0.0", - "glob": "^10.4.5", - "he": "^1.2.0", - "js-yaml": "^4.1.0", - "log-symbols": "^4.1.0", - "minimatch": "^9.0.5", - "ms": "^2.1.3", - "picocolors": "^1.1.1", - "serialize-javascript": "^6.0.2", - "strip-json-comments": "^3.1.1", - "supports-color": "^8.1.1", - "workerpool": "^9.2.0", - "yargs": "^17.7.2", - "yargs-parser": "^21.1.1", - "yargs-unparser": "^2.0.0" - }, - "bin": { - "_mocha": "bin/_mocha", - "mocha": "bin/mocha.js" - }, - "engines": { - "node": "^18.18.0 || ^20.9.0 || >=21.1.0" - } - }, - "node_modules/ms": { - "version": "2.1.3", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", - "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", - "dev": true, - "license": "MIT" - }, - "node_modules/nan": { - "version": "2.23.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.23.0.tgz", - "integrity": "sha512-1UxuyYGdoQHcGg87Lkqm3FzefucTa0NAiOcuRsDmysep3c1LVCRK2krrUDafMWtjSG04htvAmvg96+SDknOmgQ==", - "license": "MIT" - }, - "node_modules/node-addon-api": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-7.1.1.tgz", - "integrity": "sha512-5m3bsyrjFWE1xf7nz7YXdN4udnVtXK6/Yfgn5qnahL6bCkf2yKt4k3nuTKAtT4r3IG8JNR2ncsIMdZuAzJjHQQ==", - "license": "MIT" - }, - "node_modules/p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "yocto-queue": "^0.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-5.0.0.tgz", - "integrity": "sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==", - "dev": true, - "license": "MIT", - "dependencies": { - "p-limit": "^3.0.2" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/package-json-from-dist": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/package-json-from-dist/-/package-json-from-dist-1.0.1.tgz", - "integrity": "sha512-UEZIS3/by4OC8vL3P2dTXRETpebLI2NiI5vIrjaD/5UtrkFX/tNbwjTSRAGC/+7CAo2pIcBaRgWmcBBHcsaCIw==", - "dev": true, - "license": "BlueOak-1.0.0" - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-key": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", - "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/path-scurry": { - "version": "1.11.1", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.11.1.tgz", - "integrity": "sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==", - "dev": true, - "license": "BlueOak-1.0.0", - "dependencies": { - "lru-cache": "^10.2.0", - "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" - }, - "engines": { - "node": ">=16 || 14 >=14.18" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/picocolors": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", - "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", - "dev": true, - "license": "ISC" - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/react": { - "version": "19.1.1", - "resolved": "https://registry.npmjs.org/react/-/react-19.1.1.tgz", - "integrity": "sha512-w8nqGImo45dmMIfljjMwOGtbmC/mk4CMYhWIicdSflH91J9TyCyczcPFXJzrZ/ZXcgGRFeP6BU0BEJTw6tZdfQ==", - "license": "MIT", - "peer": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/react-dom": { - "version": "19.1.1", - "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-19.1.1.tgz", - "integrity": "sha512-Dlq/5LAZgF0Gaz6yiqZCf6VCcZs1ghAJyrsu84Q/GT0gV+mCxbfmKNoGRKBYMJ8IEdGPqu49YWXD02GCknEDkw==", - "license": "MIT", - "peer": true, - "dependencies": { - "scheduler": "^0.26.0" - }, - "peerDependencies": { - "react": "^19.1.1" - } - }, - "node_modules/readdirp": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-4.1.2.tgz", - "integrity": "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.18.0" - }, - "funding": { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, - "node_modules/scheduler": { - "version": "0.26.0", - "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.26.0.tgz", - "integrity": "sha512-NlHwttCI/l5gCPR3D1nNXtWABUmBwvZpEQiD4IXSbIDq8BzLIK/7Ir5gTFSGZDUu37K5cMNp0hFtzO38sC7gWA==", - "license": "MIT", - "peer": true - }, - "node_modules/serialize-javascript": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.2.tgz", - "integrity": "sha512-Saa1xPByTTq2gdeFZYLLo+RFE35NHZkAbqZeWNd3BpzppeVisAqpDjcp8dyf6uIvEqJRd46jemmyA4iFIeVk8g==", - "dev": true, - "license": "BSD-3-Clause", - "dependencies": { - "randombytes": "^2.1.0" - } - }, - "node_modules/shebang-command": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", - "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", - "dev": true, - "license": "MIT", - "dependencies": { - "shebang-regex": "^3.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/shebang-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", - "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, - "node_modules/signal-exit": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", - "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=14" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, - "node_modules/string-width": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", - "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", - "dev": true, - "license": "MIT", - "dependencies": { - "eastasianwidth": "^0.2.0", - "emoji-regex": "^9.2.2", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/string-width-cjs": { - "name": "string-width", - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/string-width-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/string-width/node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/string-width/node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi-cjs": { - "name": "strip-ansi", - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-json-comments": { - "version": "3.1.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", - "integrity": "sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/supports-color": { - "version": "8.1.1", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-8.1.1.tgz", - "integrity": "sha512-MpUEN2OodtUzxvKQl72cUF7RQ5EiHsGvSsVG0ia9c5RbWGL2CI4C7EpPS8UTBIplnlzZiNuV56w+FuNxy3ty2Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/supports-color?sponsor=1" - } - }, - "node_modules/typescript": { - "version": "5.9.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.2.tgz", - "integrity": "sha512-CWBzXQrc/qOkhidw1OzBTQuYRbfyxDXJMVJ1XNwUHGROVmuaeiEm3OslpZ1RV96d7SKKjZKrSJu3+t/xlw3R9A==", - "dev": true, - "license": "Apache-2.0", - "bin": { - "tsc": "bin/tsc", - "tsserver": "bin/tsserver" - }, - "engines": { - "node": ">=14.17" - } - }, - "node_modules/undici-types": { - "version": "6.21.0", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", - "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", - "dev": true, - "license": "MIT" - }, - "node_modules/which": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", - "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", - "dev": true, - "license": "ISC", - "dependencies": { - "isexe": "^2.0.0" - }, - "bin": { - "node-which": "bin/node-which" - }, - "engines": { - "node": ">= 8" - } - }, - "node_modules/workerpool": { - "version": "9.3.4", - "resolved": "https://registry.npmjs.org/workerpool/-/workerpool-9.3.4.tgz", - "integrity": "sha512-TmPRQYYSAnnDiEB0P/Ytip7bFGvqnSU6I2BcuSw7Hx+JSg/DsUi5ebYfc8GYaSdpuvOcEs6dXxPurOYpe9QFwg==", - "dev": true, - "license": "Apache-2.0" - }, - "node_modules/wrap-ansi": { - "version": "8.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", - "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^6.1.0", - "string-width": "^5.0.1", - "strip-ansi": "^7.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs": { - "name": "wrap-ansi", - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", - "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/wrap-ansi?sponsor=1" - } - }, - "node_modules/wrap-ansi-cjs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/wrap-ansi-cjs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-regex": { - "version": "6.2.2", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.2.2.tgz", - "integrity": "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-regex?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/ansi-styles": { - "version": "6.2.3", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.3.tgz", - "integrity": "sha512-4Dj6M28JB+oAH8kFkTLUo+a2jwOFkuqb3yucU0CANcRRUbxS0cP0nZYCGjcc3BNXwRIsUVmDGgzawme7zvJHvg==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/wrap-ansi/node_modules/strip-ansi": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.2.tgz", - "integrity": "sha512-gmBGslpoQJtgnMAvOVqGZpEz9dyoKTCzy2nfz/n8aIFhN/jCE/rCmcxabB6jOOHV+0WNnylOxaxBQPSvcWklhA==", - "dev": true, - "license": "MIT", - "dependencies": { - "ansi-regex": "^6.0.1" - }, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/chalk/strip-ansi?sponsor=1" - } - }, - "node_modules/y18n": { - "version": "5.0.8", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", - "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs": { - "version": "17.7.2", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", - "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", - "dev": true, - "license": "MIT", - "dependencies": { - "cliui": "^8.0.1", - "escalade": "^3.1.1", - "get-caller-file": "^2.0.5", - "require-directory": "^2.1.1", - "string-width": "^4.2.3", - "y18n": "^5.0.5", - "yargs-parser": "^21.1.1" - }, - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-parser": { - "version": "21.1.1", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", - "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", - "dev": true, - "license": "ISC", - "engines": { - "node": ">=12" - } - }, - "node_modules/yargs-unparser": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/yargs-unparser/-/yargs-unparser-2.0.0.tgz", - "integrity": "sha512-7pRTIA9Qc1caZ0bZ6RYRGbHJthJWuakf+WmHK0rVeLkNrrGhfoabBNdue6kdINI6r4if7ocq9aD/n7xwKOdzOA==", - "dev": true, - "license": "MIT", - "dependencies": { - "camelcase": "^6.0.0", - "decamelize": "^4.0.0", - "flat": "^5.0.2", - "is-plain-obj": "^2.1.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/yargs/node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true, - "license": "MIT" - }, - "node_modules/yargs/node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "license": "MIT", - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true, + "name": "mlx", + "version": "0.0.1", "license": "MIT", "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" + "node": ">=22" } } } From 4638e53fcd88bc1338f3559b79073af7ed189c16 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:18:46 +0000 Subject: [PATCH 3/5] feat: enhance mlx.core.full() with array value support and comprehensive tests Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com> --- node/package-lock.json | 28 +++++++++++++ node/package.json | 17 ++++++-- node/src/core/array.ts | 42 ++++++++++++++++++-- node/test/core/array.test.ts | 76 ++++++++++++++++++++++++++++++++++++ 4 files changed, 157 insertions(+), 6 deletions(-) diff --git a/node/package-lock.json b/node/package-lock.json index 18e704d5..40a41f3e 100644 --- a/node/package-lock.json +++ b/node/package-lock.json @@ -8,9 +8,37 @@ "name": "mlx", "version": "0.0.1", "license": "MIT", + "devDependencies": { + "@types/mocha": "^10.0.10", + "@types/node": "^24.7.2" + }, "engines": { "node": ">=22" } + }, + "node_modules/@types/mocha": { + "version": "10.0.10", + "resolved": "https://registry.npmjs.org/@types/mocha/-/mocha-10.0.10.tgz", + "integrity": "sha512-xPyYSz1cMPnJQhl0CLMH68j3gprKZaTjG3s5Vi+fDgx+uhG9NOXwbVt52eFS8ECyXhyKcjDLCBEqBExKuiZb7Q==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.7.2", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.7.2.tgz", + "integrity": "sha512-/NbVmcGTP+lj5oa4yiYxxeBjRivKQ5Ns1eSZeB99ExsEQ6rX5XYU1Zy/gGxY/ilqtD4Etx9mKyrPxZRetiahhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.14.0" + } + }, + "node_modules/undici-types": { + "version": "7.14.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.14.0.tgz", + "integrity": "sha512-QQiYxHuyZ9gQUIrmPo3IA+hUl4KYk8uSA7cHrcKd/l3p1OTpZcM0Tbp9x7FAtXdAYhlasd60ncPpgu6ihG6TOA==", + "dev": true, + "license": "MIT" } } } diff --git a/node/package.json b/node/package.json index 17338676..f84a666e 100644 --- a/node/package.json +++ b/node/package.json @@ -7,10 +7,21 @@ "engines": { "node": ">=22" }, - "keywords": ["mlx", "metal", "gpu", "ml", "ai", "apple", "node-addon-api"], + "keywords": [ + "mlx", + "metal", + "gpu", + "ml", + "ai", + "apple", + "node-addon-api" + ], "files": [ "index.js", "build/Release/mlx.node" - ] + ], + "devDependencies": { + "@types/mocha": "^10.0.10", + "@types/node": "^24.7.2" + } } - diff --git a/node/src/core/array.ts b/node/src/core/array.ts index 26f5cefe..307c54cd 100644 --- a/node/src/core/array.ts +++ b/node/src/core/array.ts @@ -301,13 +301,49 @@ export function ones( return MLXArray.fromHandle(addon.ones(normalizeShapeInput(shape), dtype)); } +/** + * Construct an array with the given value. + * + * Constructs an array of size `shape` filled with `value`. + * + * @param shape - The shape of the output array. + * @param value - Value to fill the array with (scalar number, TypedArray, or MLXArray). + * @param dtype - Data type of the output array. If unspecified, inferred from value. + * @returns The filled array. + * + * @example + * ```typescript + * // Create array filled with scalar + * const a = mlx.core.full([2, 3], 5.0); + * // a.shape = [2, 3], all elements = 5.0 + * + * // Create array with explicit dtype + * const b = mlx.core.full([3], 7.5, 'float64'); + * // b.dtype = 'float64' + * ``` + */ export function full( shape: readonly number[], - value: number, - dtype: DType = 'float32', + value: number | SupportedTypedArray | MLXArray, + dtype?: DType, ): MLXArray { + // Handle MLXArray values + if (value instanceof MLXArray) { + return MLXArray.fromHandle( + addon.full(normalizeShapeInput(shape), value.toNative(), dtype), + ); + } + + // Handle TypedArray values + if (isTypedArray(value)) { + return MLXArray.fromHandle( + addon.full(normalizeShapeInput(shape), value, dtype), + ); + } + + // Handle scalar values return MLXArray.fromHandle( - addon.full(normalizeShapeInput(shape), value, dtype), + addon.full(normalizeShapeInput(shape), value as number, dtype), ); } diff --git a/node/test/core/array.test.ts b/node/test/core/array.test.ts index 85548dd9..08e231c7 100644 --- a/node/test/core/array.test.ts +++ b/node/test/core/array.test.ts @@ -89,4 +89,80 @@ describe('mlx.core.array', () => { assert.equal(onesLike.dtype, 'float32'); assert.ok(onesLike.toArray().every((value) => value === 1)); }); + + describe('mlx.core.full', () => { + it('creates array with scalar value and 1D shape', () => { + const x = mlx.core.full([2], 3.0); + assert.deepEqual(x.shape, [2]); + assert.deepEqual(x.toArray(), [3.0, 3.0]); + }); + + it('creates array with scalar value and 2D shape', () => { + const x = mlx.core.full([2, 3], 2.0); + assert.equal(x.dtype, 'float32'); + assert.deepEqual(x.shape, [2, 3]); + assert.deepEqual(x.toArray(), [ + [2, 2, 2], + [2, 2, 2], + ]); + }); + + it('creates array with explicit dtype', () => { + const x = mlx.core.full([3], 7.5, 'float64'); + assert.deepEqual(x.shape, [3]); + assert.equal(x.dtype, 'float64'); + assert.deepEqual(x.toArray(), [7.5, 7.5, 7.5]); + }); + + it('creates array with integer value', () => { + const x = mlx.core.full([2, 2], 5, 'int32'); + assert.equal(x.dtype, 'int32'); + assert.deepEqual(x.toArray(), [ + [5, 5], + [5, 5], + ]); + }); + + it('creates array with boolean dtype', () => { + const x = mlx.core.full([2], 1, 'bool'); + assert.equal(x.dtype, 'bool'); + assert.deepEqual(x.toArray(), [true, true]); + }); + + it('infers int32 dtype from integer scalar', () => { + const x = mlx.core.full([3], 42); + assert.equal(x.dtype, 'int32'); + assert.deepEqual(x.toArray(), [42, 42, 42]); + }); + + it('infers float32 dtype from float scalar', () => { + const x = mlx.core.full([2], 3.14); + assert.equal(x.dtype, 'float32'); + assert.ok( + x.toArray().every((val) => Math.abs((val as number) - 3.14) < 0.001), + ); + }); + + it('broadcasts array value across shape', () => { + const value = mlx.core.array([1, 2], [2], 'int32'); + const x = mlx.core.full([3, 2], value); + assert.deepEqual(x.shape, [3, 2]); + assert.deepEqual(x.toArray(), [ + [1, 2], + [1, 2], + [1, 2], + ]); + }); + + it('broadcasts TypedArray value', () => { + const value = new Float32Array([2.0, 3.0]); + const x = mlx.core.full([2, 2], value); + assert.deepEqual(x.shape, [2, 2]); + const result = x.toArray(); + assert.deepEqual(result, [ + [2, 3], + [2, 3], + ]); + }); + }); }); From 7745cf1e7f85dfe0ab8492cf05db274bbd2b58bc Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 04:21:55 +0000 Subject: [PATCH 4/5] style: format code with prettier Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com> --- node/src/core/array.ts | 96 ++++++++++++++++----------------- node/test/core/array.test.ts | 100 +++++++++++++++++------------------ 2 files changed, 98 insertions(+), 98 deletions(-) diff --git a/node/src/core/array.ts b/node/src/core/array.ts index 307c54cd..ef090ab8 100644 --- a/node/src/core/array.ts +++ b/node/src/core/array.ts @@ -1,5 +1,5 @@ -import addon from '../internal/addon'; -import type { DTypeKey } from './dtype'; +import addon from "../internal/addon"; +import type { DTypeKey } from "./dtype"; export type DType = DTypeKey; @@ -19,7 +19,7 @@ type SupportedTypedArray = function normalizeShape(shape: readonly number[]): number[] { if (!Array.isArray(shape)) { - throw new Error('Shape must be an array'); + throw new Error("Shape must be an array"); } return shape.map((dim, index) => { if (!Number.isFinite(dim) || dim < 0) { @@ -41,18 +41,18 @@ function isTypedArray(input: unknown): input is SupportedTypedArray { } function inferDTypeFromTypedArray(array: SupportedTypedArray): DType { - if (array instanceof Float32Array) return 'float32'; - if (array instanceof Float64Array) return 'float64'; - if (array instanceof Int8Array) return 'int8'; + if (array instanceof Float32Array) return "float32"; + if (array instanceof Float64Array) return "float64"; + if (array instanceof Int8Array) return "int8"; if (array instanceof Uint8Array || array instanceof Uint8ClampedArray) - return 'uint8'; - if (array instanceof Int16Array) return 'int16'; - if (array instanceof Uint16Array) return 'uint16'; - if (array instanceof Int32Array) return 'int32'; - if (array instanceof Uint32Array) return 'uint32'; - if (array instanceof BigInt64Array) return 'int64'; - if (array instanceof BigUint64Array) return 'uint64'; - throw new Error('Unsupported TypedArray input'); + return "uint8"; + if (array instanceof Int16Array) return "int16"; + if (array instanceof Uint16Array) return "uint16"; + if (array instanceof Int32Array) return "int32"; + if (array instanceof Uint32Array) return "uint32"; + if (array instanceof BigInt64Array) return "int64"; + if (array instanceof BigUint64Array) return "uint64"; + throw new Error("Unsupported TypedArray input"); } function createTypedArrayFromNumbers( @@ -60,9 +60,9 @@ function createTypedArrayFromNumbers( dtype: DType, elementCount: number, ): SupportedTypedArray { - if (dtype === 'complex64') { + if (dtype === "complex64") { if (data.length !== elementCount * 2) { - throw new Error('Complex64 data length must be elementCount * 2'); + throw new Error("Complex64 data length must be elementCount * 2"); } const output = new Float32Array(data.length); data.forEach((value, index) => { @@ -72,88 +72,88 @@ function createTypedArrayFromNumbers( } if (data.length !== elementCount) { - throw new Error('Data length does not match the provided shape'); + throw new Error("Data length does not match the provided shape"); } switch (dtype) { - case 'float32': { + case "float32": { const output = new Float32Array(elementCount); data.forEach((value, index) => { output[index] = Number(value); }); return output; } - case 'float64': { + case "float64": { const output = new Float64Array(elementCount); data.forEach((value, index) => { output[index] = Number(value); }); return output; } - case 'int8': { + case "int8": { const output = new Int8Array(elementCount); data.forEach((value, index) => { output[index] = Number(value); }); return output; } - case 'uint8': - case 'bool': { + case "uint8": + case "bool": { const output = new Uint8Array(elementCount); data.forEach((value, index) => { const n = Number(value); - output[index] = dtype === 'bool' ? (n ? 1 : 0) : n; + output[index] = dtype === "bool" ? (n ? 1 : 0) : n; }); return output; } - case 'int16': { + case "int16": { const output = new Int16Array(elementCount); data.forEach((value, index) => { output[index] = Number(value); }); return output; } - case 'uint16': { + case "uint16": { const output = new Uint16Array(elementCount); data.forEach((value, index) => { output[index] = Number(value); }); return output; } - case 'int32': { + case "int32": { const output = new Int32Array(elementCount); data.forEach((value, index) => { output[index] = Number(value); }); return output; } - case 'uint32': { + case "uint32": { const output = new Uint32Array(elementCount); data.forEach((value, index) => { output[index] = Number(value); }); return output; } - case 'int64': { + case "int64": { const output = new BigInt64Array(elementCount); data.forEach((value, index) => { output[index] = BigInt(value); }); return output; } - case 'uint64': { + case "uint64": { const output = new BigUint64Array(elementCount); data.forEach((value, index) => { const big = BigInt(value); if (big < 0n) { - throw new Error('uint64 values must be non-negative'); + throw new Error("uint64 values must be non-negative"); } output[index] = big; }); return output; } - case 'float16': - case 'bfloat16': + case "float16": + case "bfloat16": throw new Error( `${dtype} requires a Uint16Array input. Provide encoded raw values.`, ); @@ -169,11 +169,11 @@ function castTypedArrayToDType( ): SupportedTypedArray { const currentDType = inferDTypeFromTypedArray(array); if (currentDType === dtype) { - if (dtype === 'complex64' && array.length !== elementCount * 2) { - throw new Error('Complex64 data length must be elementCount * 2'); + if (dtype === "complex64" && array.length !== elementCount * 2) { + throw new Error("Complex64 data length must be elementCount * 2"); } - if (dtype !== 'complex64' && array.length !== elementCount) { - throw new Error('Data length does not match the provided shape'); + if (dtype !== "complex64" && array.length !== elementCount) { + throw new Error("Data length does not match the provided shape"); } return array; } @@ -208,7 +208,7 @@ export class MLXArray { static from( data: SupportedTypedArray | NumericArray, shape: readonly number[], - dtype: DType = 'float32', + dtype: DType = "float32", ): MLXArray { const normalizedShape = normalizeShape(shape); const elements = elementCount(normalizedShape); @@ -221,7 +221,7 @@ export class MLXArray { data: Float32Array | readonly number[], shape: readonly number[], ): MLXArray { - return MLXArray.from(data, shape, 'float32'); + return MLXArray.from(data, shape, "float32"); } get shape(): number[] { @@ -242,8 +242,8 @@ export class MLXArray { } toFloat32Array(): Float32Array { - if (this.dtype !== 'float32') { - throw new Error('Array dtype is not float32'); + if (this.dtype !== "float32") { + throw new Error("Array dtype is not float32"); } return this.handle.toFloat32Array(); } @@ -255,9 +255,9 @@ export class MLXArray { toArray(): ArrayElement[] { const data = this.toTypedArray(); switch (this.dtype) { - case 'bool': + case "bool": return Array.from(data as Uint8Array, (value) => value !== 0); - case 'complex64': { + case "complex64": { const values = data as Float32Array; const output: ArrayElement[] = []; for (let i = 0; i < values.length; i += 2) { @@ -274,7 +274,7 @@ export class MLXArray { export function array( data: SupportedTypedArray | NumericArray, shape: readonly number[], - dtype: DType = 'float32', + dtype: DType = "float32", ): MLXArray { return MLXArray.from(data, shape, dtype); } @@ -282,21 +282,21 @@ export function array( export const normalizeShapeInput = (shape: readonly number[]): number[] => Array.from(shape, (dim) => { if (!Number.isFinite(dim)) { - throw new Error('Shape entries must be finite numbers'); + throw new Error("Shape entries must be finite numbers"); } return Math.trunc(dim); }); export function zeros( shape: readonly number[], - dtype: DType = 'float32', + dtype: DType = "float32", ): MLXArray { return MLXArray.fromHandle(addon.zeros(normalizeShapeInput(shape), dtype)); } export function ones( shape: readonly number[], - dtype: DType = 'float32', + dtype: DType = "float32", ): MLXArray { return MLXArray.fromHandle(addon.ones(normalizeShapeInput(shape), dtype)); } @@ -333,14 +333,14 @@ export function full( addon.full(normalizeShapeInput(shape), value.toNative(), dtype), ); } - + // Handle TypedArray values if (isTypedArray(value)) { return MLXArray.fromHandle( addon.full(normalizeShapeInput(shape), value, dtype), ); } - + // Handle scalar values return MLXArray.fromHandle( addon.full(normalizeShapeInput(shape), value as number, dtype), diff --git a/node/test/core/array.test.ts b/node/test/core/array.test.ts index 08e231c7..f025f184 100644 --- a/node/test/core/array.test.ts +++ b/node/test/core/array.test.ts @@ -1,47 +1,47 @@ -import { strict as assert } from 'assert'; -import mlx, { array as createArray, Array as MLXArray } from '../../src'; +import { strict as assert } from "assert"; +import mlx, { array as createArray, Array as MLXArray } from "../../src"; -describe('mlx.core.array', () => { - it('creates float32 array from typed array', () => { +describe("mlx.core.array", () => { + it("creates float32 array from typed array", () => { const data = new Float32Array([1, 2, 3, 4, 5, 6]); - const arr = mlx.core.array(data, [2, 3], 'float32'); + const arr = mlx.core.array(data, [2, 3], "float32"); assert.ok(arr instanceof MLXArray); assert.deepEqual(arr.shape, [2, 3]); - assert.equal(arr.dtype, 'float32'); + assert.equal(arr.dtype, "float32"); assert.deepEqual(Array.from(arr.toFloat32Array()), Array.from(data)); assert.deepEqual(arr.toArray(), Array.from(data)); }); - it('throws when shape does not match data length', () => { + it("throws when shape does not match data length", () => { const data = new Float32Array([1, 2, 3, 4]); assert.throws(() => { - mlx.core.array(data, [3, 3], 'float32'); + mlx.core.array(data, [3, 3], "float32"); }); }); - it('supports boolean arrays', () => { - const arr = mlx.core.array([1, 0, 1, 1], [2, 2], 'bool'); - assert.equal(arr.dtype, 'bool'); + it("supports boolean arrays", () => { + const arr = mlx.core.array([1, 0, 1, 1], [2, 2], "bool"); + assert.equal(arr.dtype, "bool"); assert.deepEqual(arr.shape, [2, 2]); assert.deepEqual(arr.toArray(), [true, false, true, true]); const typed = arr.toTypedArray(); assert.ok(typed instanceof Uint8Array); }); - it('supports int32 arrays from typed array', () => { + it("supports int32 arrays from typed array", () => { const data = new Int32Array([1, -2, 3, -4]); - const arr = mlx.core.array(data, [2, 2], 'int32'); - assert.equal(arr.dtype, 'int32'); + const arr = mlx.core.array(data, [2, 2], "int32"); + assert.equal(arr.dtype, "int32"); assert.deepEqual(arr.toArray(), [1, -2, 3, -4]); const typed = arr.toTypedArray(); assert.ok(typed instanceof Int32Array); }); - it('supports complex64 arrays', () => { + it("supports complex64 arrays", () => { const data = new Float32Array([1, 2, 3, 4]); - const arr = mlx.core.array(data, [2], 'complex64'); - assert.equal(arr.dtype, 'complex64'); + const arr = mlx.core.array(data, [2], "complex64"); + assert.equal(arr.dtype, "complex64"); assert.deepEqual(arr.shape, [2]); assert.deepEqual(arr.toArray(), [ [1, 2], @@ -52,54 +52,54 @@ describe('mlx.core.array', () => { assert.deepEqual(Array.from(typed as Float32Array), Array.from(data)); }); - it('exposes convenience entry points', () => { + it("exposes convenience entry points", () => { const data = new Float32Array([0, 1]); - const viaNamedExport = createArray(data, [2], 'float32'); - const viaClass = MLXArray.from(data, [2], 'float32'); + const viaNamedExport = createArray(data, [2], "float32"); + const viaClass = MLXArray.from(data, [2], "float32"); assert.deepEqual(viaNamedExport.toArray(), [0, 1]); assert.deepEqual(viaClass.toArray(), [0, 1]); }); - it('creates scalar-filled arrays', () => { - const zeros = mlx.core.zeros([2, 3], 'float32'); + it("creates scalar-filled arrays", () => { + const zeros = mlx.core.zeros([2, 3], "float32"); assert.deepEqual(zeros.shape, [2, 3]); - assert.equal(zeros.dtype, 'float32'); + assert.equal(zeros.dtype, "float32"); assert.ok(zeros.toArray().every((value) => value === 0)); const ones = mlx.core.ones([2, 2]); assert.deepEqual(ones.shape, [2, 2]); - assert.equal(ones.dtype, 'float32'); + assert.equal(ones.dtype, "float32"); assert.ok(ones.toArray().every((value) => value === 1)); - const full = mlx.core.full([3], 7.5, 'float64'); + const full = mlx.core.full([3], 7.5, "float64"); assert.deepEqual(full.shape, [3]); - assert.equal(full.dtype, 'float64'); + assert.equal(full.dtype, "float64"); assert.ok(full.toArray().every((value) => value === 7.5)); }); - it('supports *_like helpers', () => { - const base = mlx.core.zeros([4], 'float32'); + it("supports *_like helpers", () => { + const base = mlx.core.zeros([4], "float32"); const zerosLike = mlx.core.zeros_like(base); assert.deepEqual(zerosLike.shape, [4]); - assert.equal(zerosLike.dtype, 'float32'); + assert.equal(zerosLike.dtype, "float32"); assert.ok(zerosLike.toArray().every((value) => value === 0)); const onesLike = mlx.core.ones_like(base); - assert.equal(onesLike.dtype, 'float32'); + assert.equal(onesLike.dtype, "float32"); assert.ok(onesLike.toArray().every((value) => value === 1)); }); - describe('mlx.core.full', () => { - it('creates array with scalar value and 1D shape', () => { + describe("mlx.core.full", () => { + it("creates array with scalar value and 1D shape", () => { const x = mlx.core.full([2], 3.0); assert.deepEqual(x.shape, [2]); assert.deepEqual(x.toArray(), [3.0, 3.0]); }); - it('creates array with scalar value and 2D shape', () => { + it("creates array with scalar value and 2D shape", () => { const x = mlx.core.full([2, 3], 2.0); - assert.equal(x.dtype, 'float32'); + assert.equal(x.dtype, "float32"); assert.deepEqual(x.shape, [2, 3]); assert.deepEqual(x.toArray(), [ [2, 2, 2], @@ -107,44 +107,44 @@ describe('mlx.core.array', () => { ]); }); - it('creates array with explicit dtype', () => { - const x = mlx.core.full([3], 7.5, 'float64'); + it("creates array with explicit dtype", () => { + const x = mlx.core.full([3], 7.5, "float64"); assert.deepEqual(x.shape, [3]); - assert.equal(x.dtype, 'float64'); + assert.equal(x.dtype, "float64"); assert.deepEqual(x.toArray(), [7.5, 7.5, 7.5]); }); - it('creates array with integer value', () => { - const x = mlx.core.full([2, 2], 5, 'int32'); - assert.equal(x.dtype, 'int32'); + it("creates array with integer value", () => { + const x = mlx.core.full([2, 2], 5, "int32"); + assert.equal(x.dtype, "int32"); assert.deepEqual(x.toArray(), [ [5, 5], [5, 5], ]); }); - it('creates array with boolean dtype', () => { - const x = mlx.core.full([2], 1, 'bool'); - assert.equal(x.dtype, 'bool'); + it("creates array with boolean dtype", () => { + const x = mlx.core.full([2], 1, "bool"); + assert.equal(x.dtype, "bool"); assert.deepEqual(x.toArray(), [true, true]); }); - it('infers int32 dtype from integer scalar', () => { + it("infers int32 dtype from integer scalar", () => { const x = mlx.core.full([3], 42); - assert.equal(x.dtype, 'int32'); + assert.equal(x.dtype, "int32"); assert.deepEqual(x.toArray(), [42, 42, 42]); }); - it('infers float32 dtype from float scalar', () => { + it("infers float32 dtype from float scalar", () => { const x = mlx.core.full([2], 3.14); - assert.equal(x.dtype, 'float32'); + assert.equal(x.dtype, "float32"); assert.ok( x.toArray().every((val) => Math.abs((val as number) - 3.14) < 0.001), ); }); - it('broadcasts array value across shape', () => { - const value = mlx.core.array([1, 2], [2], 'int32'); + it("broadcasts array value across shape", () => { + const value = mlx.core.array([1, 2], [2], "int32"); const x = mlx.core.full([3, 2], value); assert.deepEqual(x.shape, [3, 2]); assert.deepEqual(x.toArray(), [ @@ -154,7 +154,7 @@ describe('mlx.core.array', () => { ]); }); - it('broadcasts TypedArray value', () => { + it("broadcasts TypedArray value", () => { const value = new Float32Array([2.0, 3.0]); const x = mlx.core.full([2, 2], value); assert.deepEqual(x.shape, [2, 2]); From fb0be2f606021537a340c74bea583243b1234c94 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 16 Oct 2025 05:58:23 +0000 Subject: [PATCH 5/5] fix: avoid passing undefined dtype to C++ addon, improve docs Co-authored-by: sydneyrenee <188732394+sydneyrenee@users.noreply.github.com> --- node/src/core/array.ts | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/node/src/core/array.ts b/node/src/core/array.ts index ef090ab8..e542e84e 100644 --- a/node/src/core/array.ts +++ b/node/src/core/array.ts @@ -309,6 +309,9 @@ export function ones( * @param shape - The shape of the output array. * @param value - Value to fill the array with (scalar number, TypedArray, or MLXArray). * @param dtype - Data type of the output array. If unspecified, inferred from value. + * For MLXArray values, preserves the array's dtype when not specified. + * For TypedArray values, infers from the TypedArray type. + * For scalar values, infers int32 for integers or float32 for floats. * @returns The filled array. * * @example @@ -320,6 +323,11 @@ export function ones( * // Create array with explicit dtype * const b = mlx.core.full([3], 7.5, 'float64'); * // b.dtype = 'float64' + * + * // Array value broadcasting (preserves source dtype) + * const arr = mlx.core.array([1, 2], [2], 'int32'); + * const c = mlx.core.full([3, 2], arr); + * // c.dtype = 'int32' (from source array) * ``` */ export function full( @@ -327,24 +335,39 @@ export function full( value: number | SupportedTypedArray | MLXArray, dtype?: DType, ): MLXArray { + const normalizedShape = normalizeShapeInput(shape); + // Handle MLXArray values if (value instanceof MLXArray) { - return MLXArray.fromHandle( - addon.full(normalizeShapeInput(shape), value.toNative(), dtype), - ); + // Pass dtype only if explicitly provided + // C++ implementation preserves source array dtype when dtype is omitted + if (dtype !== undefined) { + return MLXArray.fromHandle( + addon.full(normalizedShape, value.toNative(), dtype), + ); + } + return MLXArray.fromHandle(addon.full(normalizedShape, value.toNative())); } // Handle TypedArray values if (isTypedArray(value)) { - return MLXArray.fromHandle( - addon.full(normalizeShapeInput(shape), value, dtype), - ); + // Pass dtype only if explicitly provided + // C++ implementation infers from TypedArray type when dtype is omitted + if (dtype !== undefined) { + return MLXArray.fromHandle(addon.full(normalizedShape, value, dtype)); + } + return MLXArray.fromHandle(addon.full(normalizedShape, value)); } // Handle scalar values - return MLXArray.fromHandle( - addon.full(normalizeShapeInput(shape), value as number, dtype), - ); + // Pass dtype only if explicitly provided + // C++ implementation infers from scalar value when dtype is omitted + if (dtype !== undefined) { + return MLXArray.fromHandle( + addon.full(normalizedShape, value as number, dtype), + ); + } + return MLXArray.fromHandle(addon.full(normalizedShape, value as number)); } export function zeros_like(base: MLXArray): MLXArray {