From fe9ebd4648aa16eb51073cd108905945900d1b26 Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Thu, 24 Jul 2025 19:31:21 -0300 Subject: [PATCH 01/10] add progress --- package-lock.json | 1069 ++++++++++++++++++++++- packages/ferric/__tests__/build.test.ts | 7 + packages/ferric/package.json | 18 +- packages/ferric/tsconfig.tests.json | 2 +- 4 files changed, 1045 insertions(+), 51 deletions(-) create mode 100644 packages/ferric/__tests__/build.test.ts diff --git a/package-lock.json b/package-lock.json index 5758c0f0..3c0c1f7f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4020,9 +4020,9 @@ } }, "node_modules/@napi-rs/cli": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-3.0.3.tgz", - "integrity": "sha512-5PxtOcax9PoOriYWYf8BFNgOzUnsogYUDRM8p2leT2VtG/NTMZCyoRQMzSMB0qEaw+Durkefc5jXCpEF6wrWbA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/@napi-rs/cli/-/cli-3.0.4.tgz", + "integrity": "sha512-ilbCI69DVDQcIUSUB504LM1+Nhvo0jKycWAzzPJ22YwUoWrru/w0+V5sfjPINgkshQ4Ykv+oZOJXk9Kg1ZBUvg==", "license": "MIT", "dependencies": { "@inquirer/prompts": "^7.4.0", @@ -4037,8 +4037,7 @@ "js-yaml": "^4.1.0", "lodash-es": "^4.17.21", "semver": "^7.7.1", - "typanion": "^3.14.0", - "wasm-sjlj": "^1.0.6" + "typanion": "^3.14.0" }, "bin": { "napi": "dist/cli.js", @@ -5888,6 +5887,286 @@ "node": ">=16.17" } }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.45.1.tgz", + "integrity": "sha512-NEySIFvMY0ZQO+utJkgoMiCAjMrGvnbDLHvcmlA33UXJpYBCvlBEbMMtV837uCkS+plG2umfhn0T5mMAxGrlRA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.45.1.tgz", + "integrity": "sha512-ujQ+sMXJkg4LRJaYreaVx7Z/VMgBBd89wGS4qMrdtfUFZ+TSY5Rs9asgjitLwzeIbhwdEhyj29zhst3L1lKsRQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.45.1.tgz", + "integrity": "sha512-FSncqHvqTm3lC6Y13xncsdOYfxGSLnP+73k815EfNmpewPs+EyM49haPS105Rh4aF5mJKywk9X0ogzLXZzN9lA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.45.1.tgz", + "integrity": "sha512-2/vVn/husP5XI7Fsf/RlhDaQJ7x9zjvC81anIVbr4b/f0xtSmXQTFcGIQ/B1cXIYM6h2nAhJkdMHTnD7OtQ9Og==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.45.1.tgz", + "integrity": "sha512-4g1kaDxQItZsrkVTdYQ0bxu4ZIQ32cotoQbmsAnW1jAE4XCMbcBPDirX5fyUzdhVCKgPcrwWuucI8yrVRBw2+g==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.45.1.tgz", + "integrity": "sha512-L/6JsfiL74i3uK1Ti2ZFSNsp5NMiM4/kbbGEcOCps99aZx3g8SJMO1/9Y0n/qKlWZfn6sScf98lEOUe2mBvW9A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.45.1.tgz", + "integrity": "sha512-RkdOTu2jK7brlu+ZwjMIZfdV2sSYHK2qR08FUWcIoqJC2eywHbXr0L8T/pONFwkGukQqERDheaGTeedG+rra6Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.45.1.tgz", + "integrity": "sha512-3kJ8pgfBt6CIIr1o+HQA7OZ9mp/zDk3ctekGl9qn/pRBgrRgfwiffaUmqioUGN9hv0OHv2gxmvdKOkARCtRb8Q==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.45.1.tgz", + "integrity": "sha512-k3dOKCfIVixWjG7OXTCOmDfJj3vbdhN0QYEqB+OuGArOChek22hn7Uy5A/gTDNAcCy5v2YcXRJ/Qcnm4/ma1xw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.45.1.tgz", + "integrity": "sha512-PmI1vxQetnM58ZmDFl9/Uk2lpBBby6B6rF4muJc65uZbxCs0EA7hhKCk2PKlmZKuyVSHAyIw3+/SiuMLxKxWog==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loongarch64-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.45.1.tgz", + "integrity": "sha512-9UmI0VzGmNJ28ibHW2GpE2nF0PBQqsyiS4kcJ5vK+wuwGnV5RlqdczVocDSUfGX/Na7/XINRVoUgJyFIgipoRg==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.45.1.tgz", + "integrity": "sha512-7nR2KY8oEOUTD3pBAxIBBbZr0U7U+R9HDTPNy+5nVVHDXI4ikYniH1oxQz9VoB5PbBU1CZuDGHkLJkd3zLMWsg==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.45.1.tgz", + "integrity": "sha512-nlcl3jgUultKROfZijKjRQLUu9Ma0PeNv/VFHkZiKbXTBQXhpytS8CIj5/NfBeECZtY2FJQubm6ltIxm/ftxpw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.45.1.tgz", + "integrity": "sha512-HJV65KLS51rW0VY6rvZkiieiBnurSzpzore1bMKAhunQiECPuxsROvyeaot/tcK3A3aGnI+qTHqisrpSgQrpgA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.45.1.tgz", + "integrity": "sha512-NITBOCv3Qqc6hhwFt7jLV78VEO/il4YcBzoMGGNxznLgRQf43VQDae0aAzKiBeEPIxnDrACiMgbqjuihx08OOw==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.45.1.tgz", + "integrity": "sha512-+E/lYl6qu1zqgPEnTrs4WysQtvc/Sh4fC2nByfFExqgYrqkKWp1tWIbe+ELhixnenSpBbLXNi6vbEEJ8M7fiHw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.45.1.tgz", + "integrity": "sha512-a6WIAp89p3kpNoYStITT9RbTbTnqarU7D8N8F2CV+4Cl9fwCOZraLVuVFvlpsW0SbIiYtEnhCZBPLoNdRkjQFw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.45.1.tgz", + "integrity": "sha512-T5Bi/NS3fQiJeYdGvRpTAP5P02kqSOpqiopwhj0uaXB6nzs5JVi2XMJb18JUSKhCOX8+UE1UKQufyD6Or48dJg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.45.1.tgz", + "integrity": "sha512-lxV2Pako3ujjuUe9jiU3/s7KSrDfH6IgTSQOnDWr9aJ92YsFd7EurmClK0ly/t8dzMkDtd04g60WX6yl0sGfdw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.45.1.tgz", + "integrity": "sha512-M/fKi4sasCdM8i0aWJjCSFm2qEnYRR8AMLG2kxp6wD13+tMGA4Z1tVAuHkNRjud5SW2EM3naLuK35w9twvf6aA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, "node_modules/@sideway/address": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz", @@ -5998,10 +6277,27 @@ "@babel/types": "^7.20.7" } }, + "node_modules/@types/chai": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.2.tgz", + "integrity": "sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/deep-eql": "*" + } + }, + "node_modules/@types/deep-eql": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", + "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", + "dev": true, + "license": "MIT" + }, "node_modules/@types/estree": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.7.tgz", - "integrity": "sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==", + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==", "dev": true, "license": "MIT" }, @@ -6302,6 +6598,121 @@ "url": "https://opencollective.com/typescript-eslint" } }, + "node_modules/@vitest/expect": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz", + "integrity": "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/spy": "3.2.4", + "@vitest/utils": "3.2.4", + "chai": "^5.2.0", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/mocker": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.4.tgz", + "integrity": "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/spy": "3.2.4", + "estree-walker": "^3.0.3", + "magic-string": "^0.30.17" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "msw": "^2.4.9", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "peerDependenciesMeta": { + "msw": { + "optional": true + }, + "vite": { + "optional": true + } + } + }, + "node_modules/@vitest/pretty-format": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.4.tgz", + "integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/runner": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.4.tgz", + "integrity": "sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/utils": "3.2.4", + "pathe": "^2.0.3", + "strip-literal": "^3.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/snapshot": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.4.tgz", + "integrity": "sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.4", + "magic-string": "^0.30.17", + "pathe": "^2.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/spy": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.4.tgz", + "integrity": "sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==", + "dev": true, + "license": "MIT", + "dependencies": { + "tinyspy": "^4.0.3" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/@vitest/utils": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.4.tgz", + "integrity": "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@vitest/pretty-format": "3.2.4", + "loupe": "^3.1.4", + "tinyrainbow": "^2.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, "node_modules/@vscode/sudo-prompt": { "version": "9.3.1", "resolved": "https://registry.npmjs.org/@vscode/sudo-prompt/-/sudo-prompt-9.3.1.tgz", @@ -6545,6 +6956,16 @@ "util": "^0.12.5" } }, + "node_modules/assertion-error": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", + "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + } + }, "node_modules/astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -6966,9 +7387,9 @@ "license": "MIT" }, "node_modules/bufout": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/bufout/-/bufout-0.3.2.tgz", - "integrity": "sha512-8C3TSxBG6jbr0L/PvDo90z5lsc+mpebbV2ZeRlg7f/4Lda/88mb8A4sOngfBj5y1V3I7yRrCuMBPpg5T5tGkcg==", + "version": "0.3.4", + "resolved": "https://registry.npmjs.org/bufout/-/bufout-0.3.4.tgz", + "integrity": "sha512-m8iGxYUvWLdQ9CQ9Sjnmr8hJHlpXfRQn2CV3eI5b107MWQqAe/K/pqsCGmczkSy3r7E1HW5u5z86z2aBYbwwxQ==", "license": "ISC" }, "node_modules/bytes": { @@ -6980,6 +7401,16 @@ "node": ">= 0.8" } }, + "node_modules/cac": { + "version": "6.7.14", + "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", + "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, "node_modules/call-bind": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", @@ -7098,6 +7529,23 @@ ], "license": "CC-BY-4.0" }, + "node_modules/chai": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.1.tgz", + "integrity": "sha512-5nFxhUrX0PqtyogoYOA8IPswy5sZFTOsBFl/9bNsmDLgsxYTzSZQJDPppDnZPTQbzSEm0hqGjWPzRemQCYbD6A==", + "dev": true, + "license": "MIT", + "dependencies": { + "assertion-error": "^2.0.1", + "check-error": "^2.1.1", + "deep-eql": "^5.0.1", + "loupe": "^3.1.0", + "pathval": "^2.0.0" + }, + "engines": { + "node": ">=18" + } + }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -7120,6 +7568,16 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "license": "MIT" }, + "node_modules/check-error": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", + "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 16" + } + }, "node_modules/chokidar": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", @@ -7679,6 +8137,16 @@ "node": ">=0.10.0" } }, + "node_modules/deep-eql": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", + "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -7961,6 +8429,13 @@ "node": ">= 0.4" } }, + "node_modules/es-module-lexer": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", + "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", + "dev": true, + "license": "MIT" + }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", @@ -8214,6 +8689,16 @@ "node": ">=4.0" } }, + "node_modules/estree-walker": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", + "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "^1.0.0" + } + }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -8264,6 +8749,16 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, + "node_modules/expect-type": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.2.tgz", + "integrity": "sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=12.0.0" + } + }, "node_modules/exponential-backoff": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.2.tgz", @@ -10096,6 +10591,13 @@ "loose-envify": "cli.js" } }, + "node_modules/loupe": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.0.tgz", + "integrity": "sha512-2NCfZcT5VGVNX9mSZIxLRkEAegDGBpuQZBy13desuHeVORmBDyAET4TkJr4SjqQy3A8JDofMN6LpkK8Xcm/dlw==", + "dev": true, + "license": "MIT" + }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -10105,6 +10607,16 @@ "yallist": "^3.0.2" } }, + "node_modules/magic-string": { + "version": "0.30.17", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", + "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0" + } + }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -10848,6 +11360,25 @@ "node": "^18.17.0 || >=20.5.0" } }, + "node_modules/nanoid": { + "version": "3.3.11", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, "node_modules/natural-compare": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/natural-compare/-/natural-compare-1.4.0.tgz", @@ -11360,6 +11891,23 @@ "node": ">=8" } }, + "node_modules/pathe": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", + "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", + "dev": true, + "license": "MIT" + }, + "node_modules/pathval": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", + "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 14.16" + } + }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -11403,22 +11951,51 @@ "integrity": "sha512-4peoBq4Wks0riS0z8741NVv+/8IiTvqnZAr8QGgtdifrtpdXbNw/FxRS1l6NFqm4EMzuS0EDqNNx4XGaz8cuyQ==", "license": "MIT", "dependencies": { - "find-up-simple": "^1.0.0" - }, - "engines": { - "node": ">=18" + "find-up-simple": "^1.0.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/possible-typed-array-names": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", + "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/postcss": { + "version": "8.5.6", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.11", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.1" }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/possible-typed-array-names": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/possible-typed-array-names/-/possible-typed-array-names-1.1.0.tgz", - "integrity": "sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==", - "license": "MIT", "engines": { - "node": ">= 0.4" + "node": "^10 || ^12 || >=14" } }, "node_modules/prelude-ls": { @@ -12060,6 +12637,46 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/rollup": { + "version": "4.45.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.45.1.tgz", + "integrity": "sha512-4iya7Jb76fVpQyLoiVpzUrsjQ12r3dM7fIVz+4NwoYvZOShknRmiv+iu9CClZml5ZLGb0XMcYLutK6w9tgxHDw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.8" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@rollup/rollup-android-arm-eabi": "4.45.1", + "@rollup/rollup-android-arm64": "4.45.1", + "@rollup/rollup-darwin-arm64": "4.45.1", + "@rollup/rollup-darwin-x64": "4.45.1", + "@rollup/rollup-freebsd-arm64": "4.45.1", + "@rollup/rollup-freebsd-x64": "4.45.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.45.1", + "@rollup/rollup-linux-arm-musleabihf": "4.45.1", + "@rollup/rollup-linux-arm64-gnu": "4.45.1", + "@rollup/rollup-linux-arm64-musl": "4.45.1", + "@rollup/rollup-linux-loongarch64-gnu": "4.45.1", + "@rollup/rollup-linux-powerpc64le-gnu": "4.45.1", + "@rollup/rollup-linux-riscv64-gnu": "4.45.1", + "@rollup/rollup-linux-riscv64-musl": "4.45.1", + "@rollup/rollup-linux-s390x-gnu": "4.45.1", + "@rollup/rollup-linux-x64-gnu": "4.45.1", + "@rollup/rollup-linux-x64-musl": "4.45.1", + "@rollup/rollup-win32-arm64-msvc": "4.45.1", + "@rollup/rollup-win32-ia32-msvc": "4.45.1", + "@rollup/rollup-win32-x64-msvc": "4.45.1", + "fsevents": "~2.3.2" + } + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -12389,6 +13006,13 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/siginfo": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", + "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", + "dev": true, + "license": "ISC" + }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -12469,6 +13093,16 @@ "node": ">=0.10.0" } }, + "node_modules/source-map-js": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, "node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -12571,6 +13205,13 @@ "node": ">=8" } }, + "node_modules/stackback": { + "version": "0.0.2", + "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", + "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", + "dev": true, + "license": "MIT" + }, "node_modules/stackframe": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz", @@ -12598,6 +13239,13 @@ "node": ">= 0.6" } }, + "node_modules/std-env": { + "version": "3.9.0", + "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz", + "integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==", + "dev": true, + "license": "MIT" + }, "node_modules/stdin-discarder": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz", @@ -12703,6 +13351,26 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/strip-literal": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.0.0.tgz", + "integrity": "sha512-TcccoMhJOM3OebGhSBEmp3UZ2SfDMZUEBdRA/9ynfLi8yYajyWX3JiXArcJt4Umh4vISpspkQIY8ZZoCqjbviA==", + "dev": true, + "license": "MIT", + "dependencies": { + "js-tokens": "^9.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/strip-literal/node_modules/js-tokens": { + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", + "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", + "dev": true, + "license": "MIT" + }, "node_modules/strnum": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.1.2.tgz", @@ -12819,6 +13487,95 @@ "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", "license": "MIT" }, + "node_modules/tinybench": { + "version": "2.9.0", + "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", + "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyexec": { + "version": "0.3.2", + "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", + "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", + "dev": true, + "license": "MIT" + }, + "node_modules/tinyglobby": { + "version": "0.2.14", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", + "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/tinypool": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", + "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.0.0 || >=20.0.0" + } + }, + "node_modules/tinyrainbow": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", + "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/tinyspy": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.3.tgz", + "integrity": "sha512-t2T/WLB2WRgZ9EpE4jgPJ9w+i66UZfDc8wHh0xrwiRNN+UwH98GIJkTeZqX9rg0i0ptwzqW+uYeIF0T4F8LR7A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -13207,6 +13964,218 @@ "node": ">= 0.8" } }, + "node_modules/vite": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.6.tgz", + "integrity": "sha512-MHFiOENNBd+Bd9uvc8GEsIzdkn1JxMmEeYX35tI3fv0sJBUTfW5tQsoaOwuY4KhBI09A3dUJ/DXf2yxPVPUceg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.6", + "picomatch": "^4.0.3", + "postcss": "^8.5.6", + "rollup": "^4.40.0", + "tinyglobby": "^0.2.14" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^20.19.0 || >=22.12.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^20.19.0 || >=22.12.0", + "jiti": ">=1.21.0", + "less": "^4.0.0", + "lightningcss": "^1.21.0", + "sass": "^1.70.0", + "sass-embedded": "^1.70.0", + "stylus": ">=0.54.8", + "sugarss": "^5.0.0", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite-node": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", + "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", + "dev": true, + "license": "MIT", + "dependencies": { + "cac": "^6.7.14", + "debug": "^4.4.1", + "es-module-lexer": "^1.7.0", + "pathe": "^2.0.3", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" + }, + "bin": { + "vite-node": "vite-node.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + } + }, + "node_modules/vite/node_modules/fdir": { + "version": "6.4.6", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", + "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/vitest": { + "version": "3.2.4", + "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.4.tgz", + "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/chai": "^5.2.2", + "@vitest/expect": "3.2.4", + "@vitest/mocker": "3.2.4", + "@vitest/pretty-format": "^3.2.4", + "@vitest/runner": "3.2.4", + "@vitest/snapshot": "3.2.4", + "@vitest/spy": "3.2.4", + "@vitest/utils": "3.2.4", + "chai": "^5.2.0", + "debug": "^4.4.1", + "expect-type": "^1.2.1", + "magic-string": "^0.30.17", + "pathe": "^2.0.3", + "picomatch": "^4.0.2", + "std-env": "^3.9.0", + "tinybench": "^2.9.0", + "tinyexec": "^0.3.2", + "tinyglobby": "^0.2.14", + "tinypool": "^1.1.1", + "tinyrainbow": "^2.0.0", + "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", + "vite-node": "3.2.4", + "why-is-node-running": "^2.3.0" + }, + "bin": { + "vitest": "vitest.mjs" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://opencollective.com/vitest" + }, + "peerDependencies": { + "@edge-runtime/vm": "*", + "@types/debug": "^4.1.12", + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "@vitest/browser": "3.2.4", + "@vitest/ui": "3.2.4", + "happy-dom": "*", + "jsdom": "*" + }, + "peerDependenciesMeta": { + "@edge-runtime/vm": { + "optional": true + }, + "@types/debug": { + "optional": true + }, + "@types/node": { + "optional": true + }, + "@vitest/browser": { + "optional": true + }, + "@vitest/ui": { + "optional": true + }, + "happy-dom": { + "optional": true + }, + "jsdom": { + "optional": true + } + } + }, + "node_modules/vitest/node_modules/picomatch": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, "node_modules/vlq": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/vlq/-/vlq-1.0.1.tgz", @@ -13222,12 +14191,6 @@ "makeerror": "1.0.12" } }, - "node_modules/wasm-sjlj": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/wasm-sjlj/-/wasm-sjlj-1.0.6.tgz", - "integrity": "sha512-pjaKtLJejlWm6+okPV2X1A6nIsRDD4qeK97eCh8DP8KXi3Nzn/HY01vpHhZHlhDri12eZqipjm8HhdTVw+ATxw==", - "license": "MIT" - }, "node_modules/wcwidth": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz", @@ -13285,6 +14248,23 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/why-is-node-running": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", + "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", + "dev": true, + "license": "MIT", + "dependencies": { + "siginfo": "^2.0.0", + "stackback": "0.0.2" + }, + "bin": { + "why-is-node-running": "cli.js" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/wide-align": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", @@ -13736,16 +14716,19 @@ "name": "ferric-cli", "version": "0.2.3", "dependencies": { - "@commander-js/extra-typings": "^13.1.0", - "@napi-rs/cli": "~3.0.3", - "bufout": "^0.3.2", + "@commander-js/extra-typings": "14.0.0", + "@napi-rs/cli": "~3.0.4", + "bufout": "0.3.4", "chalk": "^5.4.1", - "commander": "^13.1.0", + "commander": "14.0.0", "ora": "^8.2.0", "react-native-node-api": "0.3.2" }, "bin": { "ferric": "bin/ferric.js" + }, + "devDependencies": { + "vitest": "^3.2.4" } }, "packages/ferric-example": { @@ -13756,12 +14739,12 @@ } }, "packages/ferric/node_modules/@commander-js/extra-typings": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/@commander-js/extra-typings/-/extra-typings-13.1.0.tgz", - "integrity": "sha512-q5P52BYb1hwVWE6dtID7VvuJWrlfbCv4klj7BjUUOqMz4jbSZD4C9fJ9lRjL2jnBGTg+gDDlaXN51rkWcLk4fg==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/@commander-js/extra-typings/-/extra-typings-14.0.0.tgz", + "integrity": "sha512-hIn0ncNaJRLkZrxBIp5AsW/eXEHNKYQBh0aPdoUqNgD+Io3NIykQqpKFyKcuasZhicGaEZJX/JBSIkZ4e5x8Dg==", "license": "MIT", "peerDependencies": { - "commander": "~13.1.0" + "commander": "~14.0.0" } }, "packages/ferric/node_modules/ansi-regex": { @@ -13804,12 +14787,12 @@ } }, "packages/ferric/node_modules/commander": { - "version": "13.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-13.1.0.tgz", - "integrity": "sha512-/rFeCpNJQbhSZjGVwO9RFV3xPqbnERS8MmIQzCtD/zl6gpJuV/bMLuN92oG3F7d8oDEHHRrujSXNUr8fpjntKw==", + "version": "14.0.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-14.0.0.tgz", + "integrity": "sha512-2uM9rYjPvyq39NwLRqaiLtWHyDC1FvryJDa2ATTVims5YAS4PupsEQsDvP14FqhFr0P49CYDugi59xaxJlTXRA==", "license": "MIT", "engines": { - "node": ">=18" + "node": ">=20" } }, "packages/ferric/node_modules/emoji-regex": { diff --git a/packages/ferric/__tests__/build.test.ts b/packages/ferric/__tests__/build.test.ts new file mode 100644 index 00000000..2009fd2d --- /dev/null +++ b/packages/ferric/__tests__/build.test.ts @@ -0,0 +1,7 @@ +import { assert, describe, it } from "vitest"; + +describe("", () => { + it("", () => { + assert.equal(1, 1); + }); +}); diff --git a/packages/ferric/package.json b/packages/ferric/package.json index d862a1a9..28b23daf 100644 --- a/packages/ferric/package.json +++ b/packages/ferric/package.json @@ -13,15 +13,19 @@ "ferric": "./bin/ferric.js" }, "scripts": { - "start": "tsx src/run.ts" + "start": "tsx src/run.ts", + "test": "vitest" }, "dependencies": { - "@napi-rs/cli": "~3.0.3", - "@commander-js/extra-typings": "^13.1.0", - "bufout": "^0.3.2", + "@commander-js/extra-typings": "14.0.0", + "@napi-rs/cli": "~3.0.4", + "bufout": "0.3.4", "chalk": "^5.4.1", - "commander": "^13.1.0", - "react-native-node-api": "0.3.2", - "ora": "^8.2.0" + "commander": "14.0.0", + "ora": "^8.2.0", + "react-native-node-api": "0.3.2" + }, + "devDependencies": { + "vitest": "^3.2.4" } } diff --git a/packages/ferric/tsconfig.tests.json b/packages/ferric/tsconfig.tests.json index 17ee7c84..f6c792b5 100644 --- a/packages/ferric/tsconfig.tests.json +++ b/packages/ferric/tsconfig.tests.json @@ -4,7 +4,7 @@ "composite": true, "emitDeclarationOnly": true }, - "include": ["src/**/*.test.ts"], + "include": ["__tests__/**/*.test.ts"], "exclude": [], "references": [ { From 8f79a562b876e021a8adf919c0f41b667be3b113 Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Fri, 25 Jul 2025 13:28:53 -0300 Subject: [PATCH 02/10] add changes --- packages/ferric/README.md | 15 ++++++++++++++- packages/ferric/src/build.ts | 11 +++++++++-- packages/ferric/src/cargo.ts | 6 ++++-- 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/packages/ferric/README.md b/packages/ferric/README.md index c61bdb9a..d3f8d222 100644 --- a/packages/ferric/README.md +++ b/packages/ferric/README.md @@ -1,3 +1,16 @@ -# `ferric` +# `ferric` (ESM Module) A wrapper around Cargo making it easier to produce prebuilt binaries targeting iOS and Android matching the [the prebuilt binary specification](https://github.com/callstackincubator/react-native-node-api/blob/main/docs/PREBUILDS.md) as well as [napi.rs](https://napi.rs/) to generate bindings from annotated Rust code. + +## Install the project + +`npm install --save-dev ferric-cli` + +## Add scripts + +```json +"scripts": { + "build": "ferric build --cwd folder_path", + "build:release": "npm run build --configuration release", +}, +``` diff --git a/packages/ferric/src/build.ts b/packages/ferric/src/build.ts index 48c10d8b..a362e6e9 100644 --- a/packages/ferric/src/build.ts +++ b/packages/ferric/src/build.ts @@ -97,6 +97,10 @@ const outputPathOption = new Option( "--output ", "Writing outputs to this directory" ).default(process.cwd()); +const cwdPathOption = new Option( + "--cwd ", + "Specify project path" +).default(process.cwd()); const configurationOption = new Option( "--configuration ", "Build configuration" @@ -111,6 +115,7 @@ export const buildCommand = new Command("build") .addOption(androidTarget) .addOption(ndkVersionOption) .addOption(outputPathOption) + .addOption(cwdPathOption) .addOption(configurationOption) .addOption(xcframeworkExtensionOption) .action( @@ -120,6 +125,7 @@ export const buildCommand = new Command("build") android, ndkVersion, output: outputPath, + cwd, configuration, xcframeworkExtension, }) => { @@ -175,7 +181,7 @@ export const buildCommand = new Command("build") Promise.all( appleTargets.map( async (target) => - [target, await build({ configuration, target })] as const + [target, await build({ configuration, target, sourcePath: cwd })] as const ) ), Promise.all( @@ -186,6 +192,7 @@ export const buildCommand = new Command("build") await build({ configuration, target, + sourcePath: cwd, ndkVersion, androidApiLevel: ANDROID_API_LEVEL, }), @@ -274,7 +281,7 @@ export const buildCommand = new Command("build") await oraPromise( generateTypeScriptDeclarations({ outputFilename: declarationsFilename, - createPath: process.cwd(), + createPath: cwd, outputPath, }), { diff --git a/packages/ferric/src/cargo.ts b/packages/ferric/src/cargo.ts index a910ffb2..5d5b0853 100644 --- a/packages/ferric/src/cargo.ts +++ b/packages/ferric/src/cargo.ts @@ -61,6 +61,7 @@ export function ensureCargo() { type BuildOptions = { configuration: "debug" | "release"; + sourcePath: string; } & ( | { target: AndroidTargetName; @@ -75,8 +76,9 @@ type BuildOptions = { ); export async function build(options: BuildOptions) { - const { target, configuration } = options; - const args = ["build", "--target", target] + const { target, configuration, sourcePath } = options; + const manifestBuildPath = `${sourcePath}/Cargo.toml`; + const args = ["build", "--target", target, manifestBuildPath] if (configuration.toLowerCase() === 'release') { args.push('--release') } From 5b524e08120e2c71e53546027156e90417f17590 Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Fri, 25 Jul 2025 16:40:56 -0300 Subject: [PATCH 03/10] added cwd support --- package-lock.json | 1000 +---------------------- packages/ferric/__tests__/build.test.ts | 7 - packages/ferric/package.json | 6 +- packages/ferric/src/build.ts | 618 +++++++------- packages/ferric/src/cargo.ts | 366 +++++---- 5 files changed, 502 insertions(+), 1495 deletions(-) delete mode 100644 packages/ferric/__tests__/build.test.ts diff --git a/package-lock.json b/package-lock.json index c287db31..fdd1dfc8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5887,286 +5887,6 @@ "node": ">=16.17" } }, - "node_modules/@rollup/rollup-android-arm-eabi": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.45.1.tgz", - "integrity": "sha512-NEySIFvMY0ZQO+utJkgoMiCAjMrGvnbDLHvcmlA33UXJpYBCvlBEbMMtV837uCkS+plG2umfhn0T5mMAxGrlRA==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-android-arm64": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.45.1.tgz", - "integrity": "sha512-ujQ+sMXJkg4LRJaYreaVx7Z/VMgBBd89wGS4qMrdtfUFZ+TSY5Rs9asgjitLwzeIbhwdEhyj29zhst3L1lKsRQ==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "android" - ] - }, - "node_modules/@rollup/rollup-darwin-arm64": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.45.1.tgz", - "integrity": "sha512-FSncqHvqTm3lC6Y13xncsdOYfxGSLnP+73k815EfNmpewPs+EyM49haPS105Rh4aF5mJKywk9X0ogzLXZzN9lA==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-darwin-x64": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.45.1.tgz", - "integrity": "sha512-2/vVn/husP5XI7Fsf/RlhDaQJ7x9zjvC81anIVbr4b/f0xtSmXQTFcGIQ/B1cXIYM6h2nAhJkdMHTnD7OtQ9Og==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "darwin" - ] - }, - "node_modules/@rollup/rollup-freebsd-arm64": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.45.1.tgz", - "integrity": "sha512-4g1kaDxQItZsrkVTdYQ0bxu4ZIQ32cotoQbmsAnW1jAE4XCMbcBPDirX5fyUzdhVCKgPcrwWuucI8yrVRBw2+g==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-freebsd-x64": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.45.1.tgz", - "integrity": "sha512-L/6JsfiL74i3uK1Ti2ZFSNsp5NMiM4/kbbGEcOCps99aZx3g8SJMO1/9Y0n/qKlWZfn6sScf98lEOUe2mBvW9A==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "freebsd" - ] - }, - "node_modules/@rollup/rollup-linux-arm-gnueabihf": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.45.1.tgz", - "integrity": "sha512-RkdOTu2jK7brlu+ZwjMIZfdV2sSYHK2qR08FUWcIoqJC2eywHbXr0L8T/pONFwkGukQqERDheaGTeedG+rra6Q==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm-musleabihf": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.45.1.tgz", - "integrity": "sha512-3kJ8pgfBt6CIIr1o+HQA7OZ9mp/zDk3ctekGl9qn/pRBgrRgfwiffaUmqioUGN9hv0OHv2gxmvdKOkARCtRb8Q==", - "cpu": [ - "arm" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-gnu": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.45.1.tgz", - "integrity": "sha512-k3dOKCfIVixWjG7OXTCOmDfJj3vbdhN0QYEqB+OuGArOChek22hn7Uy5A/gTDNAcCy5v2YcXRJ/Qcnm4/ma1xw==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-arm64-musl": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.45.1.tgz", - "integrity": "sha512-PmI1vxQetnM58ZmDFl9/Uk2lpBBby6B6rF4muJc65uZbxCs0EA7hhKCk2PKlmZKuyVSHAyIw3+/SiuMLxKxWog==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-loongarch64-gnu": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loongarch64-gnu/-/rollup-linux-loongarch64-gnu-4.45.1.tgz", - "integrity": "sha512-9UmI0VzGmNJ28ibHW2GpE2nF0PBQqsyiS4kcJ5vK+wuwGnV5RlqdczVocDSUfGX/Na7/XINRVoUgJyFIgipoRg==", - "cpu": [ - "loong64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-powerpc64le-gnu": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-powerpc64le-gnu/-/rollup-linux-powerpc64le-gnu-4.45.1.tgz", - "integrity": "sha512-7nR2KY8oEOUTD3pBAxIBBbZr0U7U+R9HDTPNy+5nVVHDXI4ikYniH1oxQz9VoB5PbBU1CZuDGHkLJkd3zLMWsg==", - "cpu": [ - "ppc64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-gnu": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.45.1.tgz", - "integrity": "sha512-nlcl3jgUultKROfZijKjRQLUu9Ma0PeNv/VFHkZiKbXTBQXhpytS8CIj5/NfBeECZtY2FJQubm6ltIxm/ftxpw==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-riscv64-musl": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.45.1.tgz", - "integrity": "sha512-HJV65KLS51rW0VY6rvZkiieiBnurSzpzore1bMKAhunQiECPuxsROvyeaot/tcK3A3aGnI+qTHqisrpSgQrpgA==", - "cpu": [ - "riscv64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-s390x-gnu": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.45.1.tgz", - "integrity": "sha512-NITBOCv3Qqc6hhwFt7jLV78VEO/il4YcBzoMGGNxznLgRQf43VQDae0aAzKiBeEPIxnDrACiMgbqjuihx08OOw==", - "cpu": [ - "s390x" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-gnu": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.45.1.tgz", - "integrity": "sha512-+E/lYl6qu1zqgPEnTrs4WysQtvc/Sh4fC2nByfFExqgYrqkKWp1tWIbe+ELhixnenSpBbLXNi6vbEEJ8M7fiHw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-linux-x64-musl": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.45.1.tgz", - "integrity": "sha512-a6WIAp89p3kpNoYStITT9RbTbTnqarU7D8N8F2CV+4Cl9fwCOZraLVuVFvlpsW0SbIiYtEnhCZBPLoNdRkjQFw==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "linux" - ] - }, - "node_modules/@rollup/rollup-win32-arm64-msvc": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.45.1.tgz", - "integrity": "sha512-T5Bi/NS3fQiJeYdGvRpTAP5P02kqSOpqiopwhj0uaXB6nzs5JVi2XMJb18JUSKhCOX8+UE1UKQufyD6Or48dJg==", - "cpu": [ - "arm64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-ia32-msvc": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.45.1.tgz", - "integrity": "sha512-lxV2Pako3ujjuUe9jiU3/s7KSrDfH6IgTSQOnDWr9aJ92YsFd7EurmClK0ly/t8dzMkDtd04g60WX6yl0sGfdw==", - "cpu": [ - "ia32" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, - "node_modules/@rollup/rollup-win32-x64-msvc": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.45.1.tgz", - "integrity": "sha512-M/fKi4sasCdM8i0aWJjCSFm2qEnYRR8AMLG2kxp6wD13+tMGA4Z1tVAuHkNRjud5SW2EM3naLuK35w9twvf6aA==", - "cpu": [ - "x64" - ], - "dev": true, - "license": "MIT", - "optional": true, - "os": [ - "win32" - ] - }, "node_modules/@sideway/address": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/@sideway/address/-/address-4.1.5.tgz", @@ -6277,23 +5997,6 @@ "@babel/types": "^7.20.7" } }, - "node_modules/@types/chai": { - "version": "5.2.2", - "resolved": "https://registry.npmjs.org/@types/chai/-/chai-5.2.2.tgz", - "integrity": "sha512-8kB30R7Hwqf40JPiKhVzodJs2Qc1ZJ5zuT3uzw5Hq/dhNCl3G3l83jfpdI1e20BP348+fV7VIL/+FxaXkqBmWg==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/deep-eql": "*" - } - }, - "node_modules/@types/deep-eql": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/deep-eql/-/deep-eql-4.0.2.tgz", - "integrity": "sha512-c9h9dVVMigMPc4bwTvC5dxqtqJZwQPePsWjPlpSOnojbor6pGqdk541lfA7AqFQr5pB1BRdq0juY9db81BwyFw==", - "dev": true, - "license": "MIT" - }, "node_modules/@types/estree": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.8.tgz", @@ -6598,121 +6301,6 @@ "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@vitest/expect": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/expect/-/expect-3.2.4.tgz", - "integrity": "sha512-Io0yyORnB6sikFlt8QW5K7slY4OjqNX9jmJQ02QDda8lyM6B5oNgVWoSoKPac8/kgnCUzuHQKrSLtu/uOqqrig==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/chai": "^5.2.2", - "@vitest/spy": "3.2.4", - "@vitest/utils": "3.2.4", - "chai": "^5.2.0", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/mocker": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.2.4.tgz", - "integrity": "sha512-46ryTE9RZO/rfDd7pEqFl7etuyzekzEhUbTW3BvmeO/BcCMEgq59BKhek3dXDWgAj4oMK6OZi+vRr1wPW6qjEQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/spy": "3.2.4", - "estree-walker": "^3.0.3", - "magic-string": "^0.30.17" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "msw": "^2.4.9", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" - }, - "peerDependenciesMeta": { - "msw": { - "optional": true - }, - "vite": { - "optional": true - } - } - }, - "node_modules/@vitest/pretty-format": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/pretty-format/-/pretty-format-3.2.4.tgz", - "integrity": "sha512-IVNZik8IVRJRTr9fxlitMKeJeXFFFN0JaB9PHPGQ8NKQbGpfjlTx9zO4RefN8gp7eqjNy8nyK3NZmBzOPeIxtA==", - "dev": true, - "license": "MIT", - "dependencies": { - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/runner": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/runner/-/runner-3.2.4.tgz", - "integrity": "sha512-oukfKT9Mk41LreEW09vt45f8wx7DordoWUZMYdY/cyAk7w5TWkTRCNZYF7sX7n2wB7jyGAl74OxgwhPgKaqDMQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/utils": "3.2.4", - "pathe": "^2.0.3", - "strip-literal": "^3.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/snapshot": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/snapshot/-/snapshot-3.2.4.tgz", - "integrity": "sha512-dEYtS7qQP2CjU27QBC5oUOxLE/v5eLkGqPE0ZKEIDGMs4vKWe7IjgLOeauHsR0D5YuuycGRO5oSRXnwnmA78fQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "3.2.4", - "magic-string": "^0.30.17", - "pathe": "^2.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/spy": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/spy/-/spy-3.2.4.tgz", - "integrity": "sha512-vAfasCOe6AIK70iP5UD11Ac4siNUNJ9i/9PZ3NKx07sG6sUxeag1LWdNrMWeKKYBLlzuK+Gn65Yd5nyL6ds+nw==", - "dev": true, - "license": "MIT", - "dependencies": { - "tinyspy": "^4.0.3" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/@vitest/utils": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/@vitest/utils/-/utils-3.2.4.tgz", - "integrity": "sha512-fB2V0JFrQSMsCo9HiSq3Ezpdv4iYaXRG1Sx8edX3MwxfyNn83mKiGzOcH+Fkxt4MHxr3y42fQi1oeAInqgX2QA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@vitest/pretty-format": "3.2.4", - "loupe": "^3.1.4", - "tinyrainbow": "^2.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, "node_modules/@vscode/sudo-prompt": { "version": "9.3.1", "resolved": "https://registry.npmjs.org/@vscode/sudo-prompt/-/sudo-prompt-9.3.1.tgz", @@ -6956,16 +6544,6 @@ "util": "^0.12.5" } }, - "node_modules/assertion-error": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-2.0.1.tgz", - "integrity": "sha512-Izi8RQcffqCeNVgFigKli1ssklIbpHnCYc6AknXGYoB6grJqyeby7jv12JUQgmTAnIDnbck1uxksT4dzN3PWBA==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - } - }, "node_modules/astral-regex": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-1.0.0.tgz", @@ -7401,16 +6979,6 @@ "node": ">= 0.8" } }, - "node_modules/cac": { - "version": "6.7.14", - "resolved": "https://registry.npmjs.org/cac/-/cac-6.7.14.tgz", - "integrity": "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=8" - } - }, "node_modules/call-bind": { "version": "1.0.8", "resolved": "https://registry.npmjs.org/call-bind/-/call-bind-1.0.8.tgz", @@ -7529,23 +7097,6 @@ ], "license": "CC-BY-4.0" }, - "node_modules/chai": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-5.2.1.tgz", - "integrity": "sha512-5nFxhUrX0PqtyogoYOA8IPswy5sZFTOsBFl/9bNsmDLgsxYTzSZQJDPppDnZPTQbzSEm0hqGjWPzRemQCYbD6A==", - "dev": true, - "license": "MIT", - "dependencies": { - "assertion-error": "^2.0.1", - "check-error": "^2.1.1", - "deep-eql": "^5.0.1", - "loupe": "^3.1.0", - "pathval": "^2.0.0" - }, - "engines": { - "node": ">=18" - } - }, "node_modules/chalk": { "version": "4.1.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", @@ -7568,16 +7119,6 @@ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", "license": "MIT" }, - "node_modules/check-error": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-2.1.1.tgz", - "integrity": "sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 16" - } - }, "node_modules/chokidar": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-4.0.3.tgz", @@ -8137,16 +7678,6 @@ "node": ">=0.10.0" } }, - "node_modules/deep-eql": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-5.0.2.tgz", - "integrity": "sha512-h5k/5U50IJJFpzfL6nO9jaaumfjO/f2NjK/oYB2Djzm4p9L+3T9qWpZqZ2hAbLPuuYq9wrU08WQyBTL5GbPk5Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=6" - } - }, "node_modules/deep-extend": { "version": "0.6.0", "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", @@ -8429,13 +7960,6 @@ "node": ">= 0.4" } }, - "node_modules/es-module-lexer": { - "version": "1.7.0", - "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-1.7.0.tgz", - "integrity": "sha512-jEQoCwk8hyb2AZziIOLhDqpm5+2ww5uIE6lkO/6jcOCusfk6LhMHpXXfBLXTZ7Ydyt0j4VoUQv6uGNYbdW+kBA==", - "dev": true, - "license": "MIT" - }, "node_modules/es-object-atoms": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", @@ -8689,16 +8213,6 @@ "node": ">=4.0" } }, - "node_modules/estree-walker": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-3.0.3.tgz", - "integrity": "sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "^1.0.0" - } - }, "node_modules/esutils": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", @@ -8749,16 +8263,6 @@ "url": "https://github.com/sindresorhus/execa?sponsor=1" } }, - "node_modules/expect-type": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/expect-type/-/expect-type-1.2.2.tgz", - "integrity": "sha512-JhFGDVJ7tmDJItKhYgJCGLOWjuK9vPxiXoUFLwLDc99NlmklilbiQJwoctZtt13+xMw91MCk/REan6MWHqDjyA==", - "dev": true, - "license": "Apache-2.0", - "engines": { - "node": ">=12.0.0" - } - }, "node_modules/exponential-backoff": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.2.tgz", @@ -10591,13 +10095,6 @@ "loose-envify": "cli.js" } }, - "node_modules/loupe": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/loupe/-/loupe-3.2.0.tgz", - "integrity": "sha512-2NCfZcT5VGVNX9mSZIxLRkEAegDGBpuQZBy13desuHeVORmBDyAET4TkJr4SjqQy3A8JDofMN6LpkK8Xcm/dlw==", - "dev": true, - "license": "MIT" - }, "node_modules/lru-cache": { "version": "5.1.1", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", @@ -10607,16 +10104,6 @@ "yallist": "^3.0.2" } }, - "node_modules/magic-string": { - "version": "0.30.17", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.17.tgz", - "integrity": "sha512-sNPKHvyjVf7gyjwS4xGTaW/mCnF8wnjtifKBEhxfZ7E/S8tQ0rssrwGNn6q8JH/ohItJfSQp9mBtQYuTlH5QnA==", - "dev": true, - "license": "MIT", - "dependencies": { - "@jridgewell/sourcemap-codec": "^1.5.0" - } - }, "node_modules/makeerror": { "version": "1.0.12", "resolved": "https://registry.npmjs.org/makeerror/-/makeerror-1.0.12.tgz", @@ -11352,31 +10839,12 @@ "license": "MIT" }, "node_modules/mute-stream": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-2.0.0.tgz", - "integrity": "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==", - "license": "ISC", - "engines": { - "node": "^18.17.0 || >=20.5.0" - } - }, - "node_modules/nanoid": { - "version": "3.3.11", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.11.tgz", - "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", - "dev": true, - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "bin": { - "nanoid": "bin/nanoid.cjs" - }, + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-2.0.0.tgz", + "integrity": "sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==", + "license": "ISC", "engines": { - "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + "node": "^18.17.0 || >=20.5.0" } }, "node_modules/natural-compare": { @@ -11891,23 +11359,6 @@ "node": ">=8" } }, - "node_modules/pathe": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/pathe/-/pathe-2.0.3.tgz", - "integrity": "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==", - "dev": true, - "license": "MIT" - }, - "node_modules/pathval": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-2.0.1.tgz", - "integrity": "sha512-//nshmD55c46FuFw26xV/xFAaB5HF9Xdap7HJBBnrKdAd6/GxDBaNA1870O79+9ueg61cZLSVc+OaFlfmObYVQ==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">= 14.16" - } - }, "node_modules/picocolors": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", @@ -11969,35 +11420,6 @@ "node": ">= 0.4" } }, - "node_modules/postcss": { - "version": "8.5.6", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.6.tgz", - "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", - "dev": true, - "funding": [ - { - "type": "opencollective", - "url": "https://opencollective.com/postcss/" - }, - { - "type": "tidelift", - "url": "https://tidelift.com/funding/github/npm/postcss" - }, - { - "type": "github", - "url": "https://github.com/sponsors/ai" - } - ], - "license": "MIT", - "dependencies": { - "nanoid": "^3.3.11", - "picocolors": "^1.1.1", - "source-map-js": "^1.2.1" - }, - "engines": { - "node": "^10 || ^12 || >=14" - } - }, "node_modules/prelude-ls": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/prelude-ls/-/prelude-ls-1.2.1.tgz", @@ -12637,46 +12059,6 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/rollup": { - "version": "4.45.1", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.45.1.tgz", - "integrity": "sha512-4iya7Jb76fVpQyLoiVpzUrsjQ12r3dM7fIVz+4NwoYvZOShknRmiv+iu9CClZml5ZLGb0XMcYLutK6w9tgxHDw==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/estree": "1.0.8" - }, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=18.0.0", - "npm": ">=8.0.0" - }, - "optionalDependencies": { - "@rollup/rollup-android-arm-eabi": "4.45.1", - "@rollup/rollup-android-arm64": "4.45.1", - "@rollup/rollup-darwin-arm64": "4.45.1", - "@rollup/rollup-darwin-x64": "4.45.1", - "@rollup/rollup-freebsd-arm64": "4.45.1", - "@rollup/rollup-freebsd-x64": "4.45.1", - "@rollup/rollup-linux-arm-gnueabihf": "4.45.1", - "@rollup/rollup-linux-arm-musleabihf": "4.45.1", - "@rollup/rollup-linux-arm64-gnu": "4.45.1", - "@rollup/rollup-linux-arm64-musl": "4.45.1", - "@rollup/rollup-linux-loongarch64-gnu": "4.45.1", - "@rollup/rollup-linux-powerpc64le-gnu": "4.45.1", - "@rollup/rollup-linux-riscv64-gnu": "4.45.1", - "@rollup/rollup-linux-riscv64-musl": "4.45.1", - "@rollup/rollup-linux-s390x-gnu": "4.45.1", - "@rollup/rollup-linux-x64-gnu": "4.45.1", - "@rollup/rollup-linux-x64-musl": "4.45.1", - "@rollup/rollup-win32-arm64-msvc": "4.45.1", - "@rollup/rollup-win32-ia32-msvc": "4.45.1", - "@rollup/rollup-win32-x64-msvc": "4.45.1", - "fsevents": "~2.3.2" - } - }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -13006,13 +12388,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/siginfo": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/siginfo/-/siginfo-2.0.0.tgz", - "integrity": "sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==", - "dev": true, - "license": "ISC" - }, "node_modules/signal-exit": { "version": "3.0.7", "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", @@ -13093,16 +12468,6 @@ "node": ">=0.10.0" } }, - "node_modules/source-map-js": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", - "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", - "dev": true, - "license": "BSD-3-Clause", - "engines": { - "node": ">=0.10.0" - } - }, "node_modules/source-map-support": { "version": "0.5.21", "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz", @@ -13205,13 +12570,6 @@ "node": ">=8" } }, - "node_modules/stackback": { - "version": "0.0.2", - "resolved": "https://registry.npmjs.org/stackback/-/stackback-0.0.2.tgz", - "integrity": "sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==", - "dev": true, - "license": "MIT" - }, "node_modules/stackframe": { "version": "1.3.4", "resolved": "https://registry.npmjs.org/stackframe/-/stackframe-1.3.4.tgz", @@ -13239,13 +12597,6 @@ "node": ">= 0.6" } }, - "node_modules/std-env": { - "version": "3.9.0", - "resolved": "https://registry.npmjs.org/std-env/-/std-env-3.9.0.tgz", - "integrity": "sha512-UGvjygr6F6tpH7o2qyqR6QYpwraIjKSdtzyBdyytFOHmPZY917kwdwLG0RbOjWOnKmnm3PeHjaoLLMie7kPLQw==", - "dev": true, - "license": "MIT" - }, "node_modules/stdin-discarder": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz", @@ -13351,26 +12702,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/strip-literal": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-literal/-/strip-literal-3.0.0.tgz", - "integrity": "sha512-TcccoMhJOM3OebGhSBEmp3UZ2SfDMZUEBdRA/9ynfLi8yYajyWX3JiXArcJt4Umh4vISpspkQIY8ZZoCqjbviA==", - "dev": true, - "license": "MIT", - "dependencies": { - "js-tokens": "^9.0.1" - }, - "funding": { - "url": "https://github.com/sponsors/antfu" - } - }, - "node_modules/strip-literal/node_modules/js-tokens": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-9.0.1.tgz", - "integrity": "sha512-mxa9E9ITFOt0ban3j6L5MpjwegGz6lBQmM1IJkWeBZGcMxto50+eWdjC/52xDbS2vy0k7vIMK0Fe2wfL9OQSpQ==", - "dev": true, - "license": "MIT" - }, "node_modules/strnum": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/strnum/-/strnum-1.1.2.tgz", @@ -13487,95 +12818,6 @@ "integrity": "sha512-fcwX4mndzpLQKBS1DVYhGAcYaYt7vsHNIvQV+WXMvnow5cgjPphq5CaayLaGsjRdSCKZFNGt7/GYAuXaNOiYCA==", "license": "MIT" }, - "node_modules/tinybench": { - "version": "2.9.0", - "resolved": "https://registry.npmjs.org/tinybench/-/tinybench-2.9.0.tgz", - "integrity": "sha512-0+DUvqWMValLmha6lr4kD8iAMK1HzV0/aKnCtWb9v9641TnP/MFb7Pc2bxoxQjTXAErryXVgUOfv2YqNllqGeg==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinyexec": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/tinyexec/-/tinyexec-0.3.2.tgz", - "integrity": "sha512-KQQR9yN7R5+OSwaK0XQoj22pwHoTlgYqmUscPYoknOoWCWfj/5/ABTMRi69FrKU5ffPVh5QcFikpWJI/P1ocHA==", - "dev": true, - "license": "MIT" - }, - "node_modules/tinyglobby": { - "version": "0.2.14", - "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.14.tgz", - "integrity": "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ==", - "dev": true, - "license": "MIT", - "dependencies": { - "fdir": "^6.4.4", - "picomatch": "^4.0.2" - }, - "engines": { - "node": ">=12.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/SuperchupuDev" - } - }, - "node_modules/tinyglobby/node_modules/fdir": { - "version": "6.4.6", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", - "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/tinyglobby/node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/tinypool": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/tinypool/-/tinypool-1.1.1.tgz", - "integrity": "sha512-Zba82s87IFq9A9XmjiX5uZA/ARWDrB03OHlq+Vw1fSdt0I+4/Kutwy8BP4Y/y/aORMo61FQ0vIb5j44vSo5Pkg==", - "dev": true, - "license": "MIT", - "engines": { - "node": "^18.0.0 || >=20.0.0" - } - }, - "node_modules/tinyrainbow": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/tinyrainbow/-/tinyrainbow-2.0.0.tgz", - "integrity": "sha512-op4nsTR47R6p0vMUUoYl/a+ljLFVtlfaXkLQmqfLR1qHma1h/ysYk4hEXZ880bf2CYgTskvTa/e196Vd5dDQXw==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, - "node_modules/tinyspy": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/tinyspy/-/tinyspy-4.0.3.tgz", - "integrity": "sha512-t2T/WLB2WRgZ9EpE4jgPJ9w+i66UZfDc8wHh0xrwiRNN+UwH98GIJkTeZqX9rg0i0ptwzqW+uYeIF0T4F8LR7A==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=14.0.0" - } - }, "node_modules/tmp": { "version": "0.0.33", "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", @@ -13964,218 +13206,6 @@ "node": ">= 0.8" } }, - "node_modules/vite": { - "version": "7.0.6", - "resolved": "https://registry.npmjs.org/vite/-/vite-7.0.6.tgz", - "integrity": "sha512-MHFiOENNBd+Bd9uvc8GEsIzdkn1JxMmEeYX35tI3fv0sJBUTfW5tQsoaOwuY4KhBI09A3dUJ/DXf2yxPVPUceg==", - "dev": true, - "license": "MIT", - "dependencies": { - "esbuild": "^0.25.0", - "fdir": "^6.4.6", - "picomatch": "^4.0.3", - "postcss": "^8.5.6", - "rollup": "^4.40.0", - "tinyglobby": "^0.2.14" - }, - "bin": { - "vite": "bin/vite.js" - }, - "engines": { - "node": "^20.19.0 || >=22.12.0" - }, - "funding": { - "url": "https://github.com/vitejs/vite?sponsor=1" - }, - "optionalDependencies": { - "fsevents": "~2.3.3" - }, - "peerDependencies": { - "@types/node": "^20.19.0 || >=22.12.0", - "jiti": ">=1.21.0", - "less": "^4.0.0", - "lightningcss": "^1.21.0", - "sass": "^1.70.0", - "sass-embedded": "^1.70.0", - "stylus": ">=0.54.8", - "sugarss": "^5.0.0", - "terser": "^5.16.0", - "tsx": "^4.8.1", - "yaml": "^2.4.2" - }, - "peerDependenciesMeta": { - "@types/node": { - "optional": true - }, - "jiti": { - "optional": true - }, - "less": { - "optional": true - }, - "lightningcss": { - "optional": true - }, - "sass": { - "optional": true - }, - "sass-embedded": { - "optional": true - }, - "stylus": { - "optional": true - }, - "sugarss": { - "optional": true - }, - "terser": { - "optional": true - }, - "tsx": { - "optional": true - }, - "yaml": { - "optional": true - } - } - }, - "node_modules/vite-node": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/vite-node/-/vite-node-3.2.4.tgz", - "integrity": "sha512-EbKSKh+bh1E1IFxeO0pg1n4dvoOTt0UDiXMd/qn++r98+jPO1xtJilvXldeuQ8giIB5IkpjCgMleHMNEsGH6pg==", - "dev": true, - "license": "MIT", - "dependencies": { - "cac": "^6.7.14", - "debug": "^4.4.1", - "es-module-lexer": "^1.7.0", - "pathe": "^2.0.3", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0" - }, - "bin": { - "vite-node": "vite-node.mjs" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - } - }, - "node_modules/vite/node_modules/fdir": { - "version": "6.4.6", - "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.6.tgz", - "integrity": "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w==", - "dev": true, - "license": "MIT", - "peerDependencies": { - "picomatch": "^3 || ^4" - }, - "peerDependenciesMeta": { - "picomatch": { - "optional": true - } - } - }, - "node_modules/vite/node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, - "node_modules/vitest": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/vitest/-/vitest-3.2.4.tgz", - "integrity": "sha512-LUCP5ev3GURDysTWiP47wRRUpLKMOfPh+yKTx3kVIEiu5KOMeqzpnYNsKyOoVrULivR8tLcks4+lga33Whn90A==", - "dev": true, - "license": "MIT", - "dependencies": { - "@types/chai": "^5.2.2", - "@vitest/expect": "3.2.4", - "@vitest/mocker": "3.2.4", - "@vitest/pretty-format": "^3.2.4", - "@vitest/runner": "3.2.4", - "@vitest/snapshot": "3.2.4", - "@vitest/spy": "3.2.4", - "@vitest/utils": "3.2.4", - "chai": "^5.2.0", - "debug": "^4.4.1", - "expect-type": "^1.2.1", - "magic-string": "^0.30.17", - "pathe": "^2.0.3", - "picomatch": "^4.0.2", - "std-env": "^3.9.0", - "tinybench": "^2.9.0", - "tinyexec": "^0.3.2", - "tinyglobby": "^0.2.14", - "tinypool": "^1.1.1", - "tinyrainbow": "^2.0.0", - "vite": "^5.0.0 || ^6.0.0 || ^7.0.0-0", - "vite-node": "3.2.4", - "why-is-node-running": "^2.3.0" - }, - "bin": { - "vitest": "vitest.mjs" - }, - "engines": { - "node": "^18.0.0 || ^20.0.0 || >=22.0.0" - }, - "funding": { - "url": "https://opencollective.com/vitest" - }, - "peerDependencies": { - "@edge-runtime/vm": "*", - "@types/debug": "^4.1.12", - "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", - "@vitest/browser": "3.2.4", - "@vitest/ui": "3.2.4", - "happy-dom": "*", - "jsdom": "*" - }, - "peerDependenciesMeta": { - "@edge-runtime/vm": { - "optional": true - }, - "@types/debug": { - "optional": true - }, - "@types/node": { - "optional": true - }, - "@vitest/browser": { - "optional": true - }, - "@vitest/ui": { - "optional": true - }, - "happy-dom": { - "optional": true - }, - "jsdom": { - "optional": true - } - } - }, - "node_modules/vitest/node_modules/picomatch": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.3.tgz", - "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==", - "dev": true, - "license": "MIT", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/jonschlinkert" - } - }, "node_modules/vlq": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/vlq/-/vlq-1.0.1.tgz", @@ -14248,23 +13278,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/why-is-node-running": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/why-is-node-running/-/why-is-node-running-2.3.0.tgz", - "integrity": "sha512-hUrmaWBdVDcxvYqnyh09zunKzROWjbZTiNy8dBEjkS7ehEDQibXJ7XvlmtbwuTclUiIyN+CyXQD4Vmko8fNm8w==", - "dev": true, - "license": "MIT", - "dependencies": { - "siginfo": "^2.0.0", - "stackback": "0.0.2" - }, - "bin": { - "why-is-node-running": "cli.js" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/wide-align": { "version": "1.1.5", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.5.tgz", @@ -14726,9 +13739,6 @@ }, "bin": { "ferric": "bin/ferric.js" - }, - "devDependencies": { - "vitest": "^3.2.4" } }, "packages/ferric-example": { diff --git a/packages/ferric/__tests__/build.test.ts b/packages/ferric/__tests__/build.test.ts deleted file mode 100644 index 2009fd2d..00000000 --- a/packages/ferric/__tests__/build.test.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { assert, describe, it } from "vitest"; - -describe("", () => { - it("", () => { - assert.equal(1, 1); - }); -}); diff --git a/packages/ferric/package.json b/packages/ferric/package.json index 28b23daf..26655538 100644 --- a/packages/ferric/package.json +++ b/packages/ferric/package.json @@ -13,8 +13,7 @@ "ferric": "./bin/ferric.js" }, "scripts": { - "start": "tsx src/run.ts", - "test": "vitest" + "start": "tsx src/run.ts" }, "dependencies": { "@commander-js/extra-typings": "14.0.0", @@ -24,8 +23,5 @@ "commander": "14.0.0", "ora": "^8.2.0", "react-native-node-api": "0.3.2" - }, - "devDependencies": { - "vitest": "^3.2.4" } } diff --git a/packages/ferric/src/build.ts b/packages/ferric/src/build.ts index a362e6e9..381acddc 100644 --- a/packages/ferric/src/build.ts +++ b/packages/ferric/src/build.ts @@ -1,61 +1,60 @@ -import path from "node:path"; import fs from "node:fs"; +import path from "node:path"; import { Command, Option } from "@commander-js/extra-typings"; -import chalk from "chalk"; import { SpawnFailure } from "bufout"; +import chalk from "chalk"; import { oraPromise } from "ora"; import { - determineAndroidLibsFilename, - createAndroidLibsDirectory, - AndroidTriplet, - createAppleFramework, - determineXCFrameworkFilename, - createXCframework, - createUniversalAppleLibrary, - determineLibraryBasename, - prettyPath, + type AndroidTriplet, + createAndroidLibsDirectory, + createAppleFramework, + createUniversalAppleLibrary, + createXCframework, + determineAndroidLibsFilename, + determineLibraryBasename, + determineXCFrameworkFilename, + prettyPath, } from "react-native-node-api"; - -import { UsageError, assertFixable } from "./errors.js"; -import { ensureCargo, build } from "./cargo.js"; +import { getBlockComment } from "./banner.js"; +import { build, ensureCargo } from "./cargo.js"; +import { assertFixable, UsageError } from "./errors.js"; +import { generateTypeScriptDeclarations } from "./napi-rs.js"; import { - ALL_TARGETS, - ANDROID_TARGETS, - AndroidTargetName, - APPLE_TARGETS, - AppleTargetName, - ensureInstalledTargets, - filterTargetsByPlatform, + ALL_TARGETS, + ANDROID_TARGETS, + type AndroidTargetName, + APPLE_TARGETS, + type AppleTargetName, + ensureInstalledTargets, + filterTargetsByPlatform, } from "./targets.js"; -import { generateTypeScriptDeclarations } from "./napi-rs.js"; -import { getBlockComment } from "./banner.js"; type EntrypointOptions = { - outputPath: string; - libraryName: string; + outputPath: string; + libraryName: string; }; async function generateEntrypoint({ - outputPath, - libraryName, + outputPath, + libraryName, }: EntrypointOptions) { - await fs.promises.writeFile( - outputPath, - [ - "/* eslint-disable */", - getBlockComment(), - `module.exports = require('./${libraryName}.node');`, - ].join("\n\n") + "\n", - "utf8" - ); + await fs.promises.writeFile( + outputPath, + [ + "/* eslint-disable */", + getBlockComment(), + `module.exports = require('./${libraryName}.node');`, + ].join("\n\n") + "\n", + "utf8", + ); } const ANDROID_TRIPLET_PER_TARGET: Record = { - "aarch64-linux-android": "aarch64-linux-android", - "armv7-linux-androideabi": "armv7a-linux-androideabi", - "i686-linux-android": "i686-linux-android", - "x86_64-linux-android": "x86_64-linux-android", + "aarch64-linux-android": "aarch64-linux-android", + "armv7-linux-androideabi": "armv7a-linux-androideabi", + "i686-linux-android": "i686-linux-android", + "x86_64-linux-android": "x86_64-linux-android", }; // This should match https://github.com/react-native-community/template/blob/main/template/android/build.gradle#L7 @@ -65,311 +64,316 @@ const ANDROID_API_LEVEL = 24; const { FERRIC_TARGETS } = process.env; function getDefaultTargets() { - const result = FERRIC_TARGETS ? FERRIC_TARGETS.split(",") : []; - for (const target of result) { - assertFixable( - (ALL_TARGETS as readonly string[]).includes(target), - `Unexpected target in FERRIC_TARGETS: ${target}`, - { - instructions: - "Pass only valid targets via FERRIC_TARGETS (or remove them)", - } - ); - } - return result as (typeof ALL_TARGETS)[number][]; + const result = FERRIC_TARGETS ? FERRIC_TARGETS.split(",") : []; + for (const target of result) { + assertFixable( + (ALL_TARGETS as readonly string[]).includes(target), + `Unexpected target in FERRIC_TARGETS: ${target}`, + { + instructions: + "Pass only valid targets via FERRIC_TARGETS (or remove them)", + }, + ); + } + return result as (typeof ALL_TARGETS)[number][]; } const targetOption = new Option("--target ", "Target triple") - .choices(ALL_TARGETS) - .default(getDefaultTargets()); + .choices(ALL_TARGETS) + .default(getDefaultTargets()); const appleTarget = new Option("--apple", "Use all Apple targets"); const androidTarget = new Option("--android", "Use all Android targets"); const ndkVersionOption = new Option( - "--ndk-version ", - "The NDK version to use for Android builds" + "--ndk-version ", + "The NDK version to use for Android builds", ).default(DEFAULT_NDK_VERSION); const xcframeworkExtensionOption = new Option( - "--xcframework-extension", - "Don't rename the xcframework to .apple.node" + "--xcframework-extension", + "Don't rename the xcframework to .apple.node", ).default(false); const outputPathOption = new Option( - "--output ", - "Writing outputs to this directory" + "--output ", + "Writing outputs to this directory", ).default(process.cwd()); const cwdPathOption = new Option( - "--cwd ", - "Specify project path" -).default(process.cwd()); + "--cwd ", + "Specify project path", +); const configurationOption = new Option( - "--configuration ", - "Build configuration" + "--configuration ", + "Build configuration", ) - .choices(["debug", "release"]) - .default("debug"); + .choices(["debug", "release"]) + .default("debug"); export const buildCommand = new Command("build") - .description("Build Rust Node-API module") - .addOption(targetOption) - .addOption(appleTarget) - .addOption(androidTarget) - .addOption(ndkVersionOption) - .addOption(outputPathOption) - .addOption(cwdPathOption) - .addOption(configurationOption) - .addOption(xcframeworkExtensionOption) - .action( - async ({ - target: targetArg, - apple, - android, - ndkVersion, - output: outputPath, + .description("Build Rust Node-API module") + .addOption(targetOption) + .addOption(appleTarget) + .addOption(androidTarget) + .addOption(ndkVersionOption) + .addOption(outputPathOption) + .addOption(cwdPathOption) + .addOption(configurationOption) + .addOption(xcframeworkExtensionOption) + .action( + async ({ + target: targetArg, + apple, + android, + ndkVersion, + output: outputPath, cwd, - configuration, - xcframeworkExtension, - }) => { - try { - const targets = new Set([...targetArg]); - if (apple) { - for (const target of APPLE_TARGETS) { - targets.add(target); - } - } - if (android) { - for (const target of ANDROID_TARGETS) { - targets.add(target); - } - } + configuration, + xcframeworkExtension, + }) => { + outputPath = + cwd && cwd.length > 0 ? path.join(outputPath, cwd) : outputPath; + try { + const targets = new Set([...targetArg]); + if (apple) { + for (const target of APPLE_TARGETS) { + targets.add(target); + } + } + if (android) { + for (const target of ANDROID_TARGETS) { + targets.add(target); + } + } - if (targets.size === 0) { - if (isAndroidSupported()) { - if (process.arch === "arm64") { - targets.add("aarch64-linux-android"); - } else if (process.arch === "x64") { - targets.add("x86_64-linux-android"); - } - } - if (isAppleSupported()) { - if (process.arch === "arm64") { - targets.add("aarch64-apple-ios-sim"); - } - } - console.error( - chalk.yellowBright("ℹ"), - chalk.dim( - `Using default targets, pass ${chalk.italic( - "--android" - )}, ${chalk.italic("--apple")} or individual ${chalk.italic( - "--target" - )} options, to avoid this.` - ) - ); - } - ensureCargo(); - ensureInstalledTargets(targets); + if (targets.size === 0) { + if (isAndroidSupported()) { + if (process.arch === "arm64") { + targets.add("aarch64-linux-android"); + } else if (process.arch === "x64") { + targets.add("x86_64-linux-android"); + } + } + if (isAppleSupported()) { + if (process.arch === "arm64") { + targets.add("aarch64-apple-ios-sim"); + } + } + console.error( + chalk.yellowBright("ℹ"), + chalk.dim( + `Using default targets, pass ${chalk.italic( + "--android", + )}, ${chalk.italic("--apple")} or individual ${chalk.italic( + "--target", + )} options, to avoid this.`, + ), + ); + } + ensureCargo(); + ensureInstalledTargets(targets); - const appleTargets = filterTargetsByPlatform(targets, "apple"); - const androidTargets = filterTargetsByPlatform(targets, "android"); + const appleTargets = filterTargetsByPlatform(targets, "apple"); + const androidTargets = filterTargetsByPlatform(targets, "android"); - const targetsDescription = - targets.size + - (targets.size === 1 ? " target" : " targets") + - chalk.dim(" (" + [...targets].join(", ") + ")"); - const [appleLibraries, androidLibraries] = await oraPromise( - Promise.all([ - Promise.all( - appleTargets.map( - async (target) => - [target, await build({ configuration, target, sourcePath: cwd })] as const - ) - ), - Promise.all( - androidTargets.map( - async (target) => - [ - target, - await build({ - configuration, - target, - sourcePath: cwd, - ndkVersion, - androidApiLevel: ANDROID_API_LEVEL, - }), - ] as const - ) - ), - ]), - { - text: `Building ${targetsDescription}`, - successText: `Built ${targetsDescription}`, - failText: (error: Error) => `Failed to build: ${error.message}`, - } - ); + const targetsDescription = + targets.size + + (targets.size === 1 ? " target" : " targets") + + chalk.dim(" (" + [...targets].join(", ") + ")"); + const [appleLibraries, androidLibraries] = await oraPromise( + Promise.all([ + Promise.all( + appleTargets.map( + async (target) => + [ + target, + await build({ configuration, target, sourcePath: outputPath }), + ] as const, + ), + ), + Promise.all( + androidTargets.map( + async (target) => + [ + target, + await build({ + configuration, + target, + sourcePath: outputPath, + ndkVersion, + androidApiLevel: ANDROID_API_LEVEL, + }), + ] as const, + ), + ), + ]), + { + text: `Building ${targetsDescription}`, + successText: `Built ${targetsDescription}`, + failText: (error: Error) => `Failed to build: ${error.message}`, + }, + ); - if (androidLibraries.length > 0) { - const libraryPathByTriplet = Object.fromEntries( - androidLibraries.map(([target, outputPath]) => [ - ANDROID_TRIPLET_PER_TARGET[target], - outputPath, - ]) - ) as Record; + if (androidLibraries.length > 0) { + const libraryPathByTriplet = Object.fromEntries( + androidLibraries.map(([target, outputPath]) => [ + ANDROID_TRIPLET_PER_TARGET[target], + outputPath, + ]), + ) as Record; - const androidLibsFilename = determineAndroidLibsFilename( - Object.values(libraryPathByTriplet) - ); - const androidLibsOutputPath = path.resolve( - outputPath, - androidLibsFilename - ); + const androidLibsFilename = determineAndroidLibsFilename( + Object.values(libraryPathByTriplet), + ); + const androidLibsOutputPath = path.resolve( + outputPath, + androidLibsFilename, + ); - await oraPromise( - createAndroidLibsDirectory({ - outputPath: androidLibsOutputPath, - libraryPathByTriplet, - autoLink: true, - }), - { - text: "Assembling Android libs directory", - successText: `Android libs directory assembled into ${prettyPath( - androidLibsOutputPath - )}`, - failText: ({ message }) => - `Failed to assemble Android libs directory: ${message}`, - } - ); - } + await oraPromise( + createAndroidLibsDirectory({ + outputPath: androidLibsOutputPath, + libraryPathByTriplet, + autoLink: true, + }), + { + text: "Assembling Android libs directory", + successText: `Android libs directory assembled into ${prettyPath( + androidLibsOutputPath, + )}`, + failText: ({ message }) => + `Failed to assemble Android libs directory: ${message}`, + }, + ); + } - if (appleLibraries.length > 0) { - const libraryPaths = await combineLibraries(appleLibraries); - const frameworkPaths = libraryPaths.map(createAppleFramework); - const xcframeworkFilename = determineXCFrameworkFilename( - frameworkPaths, - xcframeworkExtension ? ".xcframework" : ".apple.node" - ); + if (appleLibraries.length > 0) { + const libraryPaths = await combineLibraries(appleLibraries); + const frameworkPaths = libraryPaths.map(createAppleFramework); + const xcframeworkFilename = determineXCFrameworkFilename( + frameworkPaths, + xcframeworkExtension ? ".xcframework" : ".apple.node", + ); - // Create the xcframework - const xcframeworkOutputPath = path.resolve( - outputPath, - xcframeworkFilename - ); + // Create the xcframework + const xcframeworkOutputPath = path.resolve( + outputPath, + xcframeworkFilename, + ); - await oraPromise( - createXCframework({ - outputPath: xcframeworkOutputPath, - frameworkPaths, - autoLink: true, - }), - { - text: "Assembling XCFramework", - successText: `XCFramework assembled into ${chalk.dim( - path.relative(process.cwd(), xcframeworkOutputPath) - )}`, - failText: ({ message }) => - `Failed to assemble XCFramework: ${message}`, - } - ); - } + await oraPromise( + createXCframework({ + outputPath: xcframeworkOutputPath, + frameworkPaths, + autoLink: true, + }), + { + text: "Assembling XCFramework", + successText: `XCFramework assembled into ${chalk.dim( + path.relative(outputPath, xcframeworkOutputPath), + )}`, + failText: ({ message }) => + `Failed to assemble XCFramework: ${message}`, + }, + ); + } - const libraryName = determineLibraryBasename([ - ...androidLibraries.map(([, outputPath]) => outputPath), - ...appleLibraries.map(([, outputPath]) => outputPath), - ]); + const libraryName = determineLibraryBasename([ + ...androidLibraries.map(([, outputPath]) => outputPath), + ...appleLibraries.map(([, outputPath]) => outputPath), + ]); - const declarationsFilename = `${libraryName}.d.ts`; - const declarationsPath = path.join(outputPath, declarationsFilename); - await oraPromise( - generateTypeScriptDeclarations({ - outputFilename: declarationsFilename, - createPath: cwd, - outputPath, - }), - { - text: "Generating TypeScript declarations", - successText: `Generated TypeScript declarations ${prettyPath( - declarationsPath - )}`, - failText: (error) => - `Failed to generate TypeScript declarations: ${error.message}`, - } - ); + const declarationsFilename = `${libraryName}.d.ts`; + const declarationsPath = path.join(outputPath, declarationsFilename); + await oraPromise( + generateTypeScriptDeclarations({ + outputFilename: declarationsFilename, + createPath: outputPath, + outputPath, + }), + { + text: "Generating TypeScript declarations", + successText: `Generated TypeScript declarations ${prettyPath( + declarationsPath, + )}`, + failText: (error) => + `Failed to generate TypeScript declarations: ${error.message}`, + }, + ); - const entrypointPath = path.join(outputPath, `${libraryName}.js`); + const entrypointPath = path.join(outputPath, `${libraryName}.js`); - await oraPromise( - generateEntrypoint({ - libraryName, - outputPath: entrypointPath, - }), - { - text: `Generating entrypoint`, - successText: `Generated entrypoint into ${prettyPath( - entrypointPath - )}`, - failText: (error) => - `Failed to generate entrypoint: ${error.message}`, - } - ); - } catch (error) { - process.exitCode = 1; - if (error instanceof SpawnFailure) { - error.flushOutput("both"); - } - if (error instanceof UsageError || error instanceof SpawnFailure) { - console.error(chalk.red("ERROR"), error.message); - if (error.cause instanceof Error) { - console.error(chalk.red("CAUSE"), error.cause.message); - } - if (error instanceof UsageError && error.fix) { - console.error( - chalk.green("FIX"), - error.fix.command - ? chalk.dim("Run: ") + error.fix.command - : error.fix.instructions - ); - } - } else { - throw error; - } - } - } - ); + await oraPromise( + generateEntrypoint({ + libraryName, + outputPath: entrypointPath, + }), + { + text: `Generating entrypoint`, + successText: `Generated entrypoint into ${prettyPath( + entrypointPath, + )}`, + failText: (error) => + `Failed to generate entrypoint: ${error.message}`, + }, + ); + } catch (error) { + process.exitCode = 1; + if (error instanceof SpawnFailure) { + error.flushOutput("both"); + } + if (error instanceof UsageError || error instanceof SpawnFailure) { + console.error(chalk.red("ERROR"), error.message); + if (error.cause instanceof Error) { + console.error(chalk.red("CAUSE"), error.cause.message); + } + if (error instanceof UsageError && error.fix) { + console.error( + chalk.green("FIX"), + error.fix.command + ? chalk.dim("Run: ") + error.fix.command + : error.fix.instructions, + ); + } + } else { + throw error; + } + } + }, + ); async function combineLibraries( - libraries: Readonly<[AppleTargetName, string]>[] + libraries: Readonly<[AppleTargetName, string]>[], ): Promise { - const result = []; - const darwinLibraries = []; - for (const [target, libraryPath] of libraries) { - if (target.endsWith("-darwin")) { - darwinLibraries.push(libraryPath); - } else { - result.push(libraryPath); - } - } - if (darwinLibraries.length === 0) { - return result; - } else if (darwinLibraries.length === 1) { - return [...result, darwinLibraries[0]]; - } else { - const universalPath = await oraPromise( - createUniversalAppleLibrary(darwinLibraries), - { - text: "Combining Darwin libraries into a universal library", - successText: "Combined Darwin libraries into a universal library", - failText: (error) => - `Failed to combine Darwin libraries: ${error.message}`, - } - ); - return [...result, universalPath]; - } + const result = []; + const darwinLibraries = []; + for (const [target, libraryPath] of libraries) { + if (target.endsWith("-darwin")) { + darwinLibraries.push(libraryPath); + } else { + result.push(libraryPath); + } + } + if (darwinLibraries.length === 0) { + return result; + } else if (darwinLibraries.length === 1) { + return [...result, darwinLibraries[0]]; + } else { + const universalPath = await oraPromise( + createUniversalAppleLibrary(darwinLibraries), + { + text: "Combining Darwin libraries into a universal library", + successText: "Combined Darwin libraries into a universal library", + failText: (error) => + `Failed to combine Darwin libraries: ${error.message}`, + }, + ); + return [...result, universalPath]; + } } export function isAndroidSupported() { - const { ANDROID_HOME } = process.env; - return typeof ANDROID_HOME === "string" && fs.existsSync(ANDROID_HOME); + const { ANDROID_HOME } = process.env; + return typeof ANDROID_HOME === "string" && fs.existsSync(ANDROID_HOME); } export function isAppleSupported() { - return process.platform === "darwin"; + return process.platform === "darwin"; } diff --git a/packages/ferric/src/cargo.ts b/packages/ferric/src/cargo.ts index 5d5b0853..f1408ec9 100644 --- a/packages/ferric/src/cargo.ts +++ b/packages/ferric/src/cargo.ts @@ -5,226 +5,230 @@ import path from "node:path"; import { spawn } from "bufout"; import chalk from "chalk"; - +import { weakNodeApiPath } from "react-native-node-api"; import { assertFixable, UsageError } from "./errors.js"; import { - AndroidTargetName, - AppleTargetName, - isAndroidTarget, - isAppleTarget, + type AndroidTargetName, + type AppleTargetName, + isAndroidTarget, + isAppleTarget, } from "./targets.js"; -import { weakNodeApiPath } from "react-native-node-api"; - const APPLE_XCFRAMEWORK_CHILDS_PER_TARGET: Record = { - "aarch64-apple-darwin": "macos-arm64_x86_64", // Universal - "x86_64-apple-darwin": "macos-arm64_x86_64", // Universal - "aarch64-apple-ios": "ios-arm64", - "aarch64-apple-ios-sim": "ios-arm64-simulator", - // "aarch64-apple-ios-macabi": "", // Catalyst - // "x86_64-apple-ios": "ios-x86_64", - // "x86_64-apple-ios-macabi": "ios-x86_64-simulator", - // "aarch64-apple-tvos": "tvos-arm64", - // "aarch64-apple-tvos-sim": "tvos-arm64-simulator", - // "aarch64-apple-visionos": "xros-arm64", - // "aarch64-apple-visionos-sim": "xros-arm64-simulator", + "aarch64-apple-darwin": "macos-arm64_x86_64", // Universal + "x86_64-apple-darwin": "macos-arm64_x86_64", // Universal + "aarch64-apple-ios": "ios-arm64", + "aarch64-apple-ios-sim": "ios-arm64-simulator", + // "aarch64-apple-ios-macabi": "", // Catalyst + // "x86_64-apple-ios": "ios-x86_64", + // "x86_64-apple-ios-macabi": "ios-x86_64-simulator", + // "aarch64-apple-tvos": "tvos-arm64", + // "aarch64-apple-tvos-sim": "tvos-arm64-simulator", + // "aarch64-apple-visionos": "xros-arm64", + // "aarch64-apple-visionos-sim": "xros-arm64-simulator", }; const ANDROID_ARCH_PR_TARGET: Record = { - "aarch64-linux-android": "arm64-v8a", - "armv7-linux-androideabi": "armeabi-v7a", - "i686-linux-android": "x86", - "x86_64-linux-android": "x86_64", + "aarch64-linux-android": "arm64-v8a", + "armv7-linux-androideabi": "armeabi-v7a", + "i686-linux-android": "x86", + "x86_64-linux-android": "x86_64", }; export function joinPathAndAssertExistence(...pathSegments: string[]) { - const joinedPath = path.join(...pathSegments); - assert(fs.existsSync(joinedPath), `Expected ${joinedPath} to exist`); - return joinedPath; + const joinedPath = path.join(...pathSegments); + assert(fs.existsSync(joinedPath), `Expected ${joinedPath} to exist`); + return joinedPath; } export function ensureCargo() { - try { - const cargoVersion = cp - .execFileSync("cargo", ["--version"], { - encoding: "utf-8", - }) - .trim(); - console.log(chalk.dim(`Using ${cargoVersion}`)); - } catch (error) { - throw new UsageError( - "You need a Rust toolchain: https://doc.rust-lang.org/cargo/getting-started/installation.html#install-rust-and-cargo", - { cause: error } - ); - } + try { + const cargoVersion = cp + .execFileSync("cargo", ["--version"], { + encoding: "utf-8", + }) + .trim(); + console.log(chalk.dim(`Using ${cargoVersion}`)); + } catch (error) { + throw new UsageError( + "You need a Rust toolchain: https://doc.rust-lang.org/cargo/getting-started/installation.html#install-rust-and-cargo", + { cause: error }, + ); + } } type BuildOptions = { - configuration: "debug" | "release"; + configuration: "debug" | "release"; sourcePath: string; } & ( - | { - target: AndroidTargetName; - ndkVersion: string; - androidApiLevel: number; - } - | { - target: AppleTargetName; - ndkVersion?: never; - androidApiLevel?: number; - } -); + | { + target: AndroidTargetName; + ndkVersion: string; + androidApiLevel: number; + } + | { + target: AppleTargetName; + ndkVersion?: never; + androidApiLevel?: number; + } + ); export async function build(options: BuildOptions) { - const { target, configuration, sourcePath } = options; + const { target, configuration, sourcePath } = options; const manifestBuildPath = `${sourcePath}/Cargo.toml`; - const args = ["build", "--target", target, manifestBuildPath] - if (configuration.toLowerCase() === 'release') { - args.push('--release') - } - await spawn("cargo", args, { - outputMode: "buffered", - env: { - ...process.env, - ...getTargetEnvironmentVariables(options), - }, - }); - const targetOutputPath = joinPathAndAssertExistence( - process.cwd(), - "target", - target, - configuration - ); - const dynamicLibraryFile = fs - .readdirSync(targetOutputPath) - .filter((file) => file.endsWith(".so") || file.endsWith(".dylib")); - assert( - dynamicLibraryFile.length === 1, - `Expected a single shared object file in ${targetOutputPath}` - ); - return joinPathAndAssertExistence(targetOutputPath, dynamicLibraryFile[0]); + const args = [ + "build", + "--target", + target, + "--manifest-path", + manifestBuildPath, + ]; + if (configuration.toLowerCase() === "release") { + args.push("--release"); + } + await spawn("cargo", args, { + outputMode: "buffered", + env: { + ...process.env, + ...getTargetEnvironmentVariables(options), + }, + }); + const targetOutputPath = joinPathAndAssertExistence( + sourcePath, + "target", + target, + configuration, + ); + const dynamicLibraryFile = fs + .readdirSync(targetOutputPath) + .filter((file) => file.endsWith(".so") || file.endsWith(".dylib")); + assert( + dynamicLibraryFile.length === 1, + `Expected a single shared object file in ${targetOutputPath}`, + ); + return joinPathAndAssertExistence(targetOutputPath, dynamicLibraryFile[0]); } export function getLLVMToolchainBinPath(ndkPath: string) { - const prebuiltPath = path.join(ndkPath, "toolchains", "llvm", "prebuilt"); - const candidates = fs.readdirSync(prebuiltPath); - if (candidates.length === 0) { - throw new Error("Expected LLVM toolchain to be installed"); - } else if (candidates.length > 1) { - throw new Error("Expected a single LLVM toolchain to be installed"); - } else { - return path.join(prebuiltPath, candidates[0], "bin"); - } + const prebuiltPath = path.join(ndkPath, "toolchains", "llvm", "prebuilt"); + const candidates = fs.readdirSync(prebuiltPath); + if (candidates.length === 0) { + throw new Error("Expected LLVM toolchain to be installed"); + } else if (candidates.length > 1) { + throw new Error("Expected a single LLVM toolchain to be installed"); + } else { + return path.join(prebuiltPath, candidates[0], "bin"); + } } export function getTargetAndroidArch(target: AndroidTargetName) { - const [first] = target.split("-"); - return first === "armv7" ? "armv7a" : first; + const [first] = target.split("-"); + return first === "armv7" ? "armv7a" : first; } export function getTargetAndroidPlatform(target: AndroidTargetName) { - return getTargetAndroidArch(target) === "armv7a" - ? "androideabi24" - : "android24"; + return getTargetAndroidArch(target) === "armv7a" + ? "androideabi24" + : "android24"; } export function getWeakNodeApiFrameworkPath(target: AppleTargetName) { - return joinPathAndAssertExistence( - weakNodeApiPath, - "weak-node-api.xcframework", - APPLE_XCFRAMEWORK_CHILDS_PER_TARGET[target] - ); + return joinPathAndAssertExistence( + weakNodeApiPath, + "weak-node-api.xcframework", + APPLE_XCFRAMEWORK_CHILDS_PER_TARGET[target], + ); } export function getWeakNodeApiAndroidLibraryPath(target: AndroidTargetName) { - return joinPathAndAssertExistence( - weakNodeApiPath, - "weak-node-api.android.node", - ANDROID_ARCH_PR_TARGET[target] - ); + return joinPathAndAssertExistence( + weakNodeApiPath, + "weak-node-api.android.node", + ANDROID_ARCH_PR_TARGET[target], + ); } export function getTargetEnvironmentVariables({ - target, - ndkVersion, - androidApiLevel, + target, + ndkVersion, + androidApiLevel, }: BuildOptions): Record { - if (isAndroidTarget(target)) { - assert(ndkVersion, "Expected ndkVersion to be set for Android targets"); - - const { ANDROID_HOME } = process.env; - assertFixable( - ANDROID_HOME && fs.existsSync(ANDROID_HOME), - `Missing ANDROID_HOME environment variable`, - { - instructions: "Set ANDROID_HOME to the Android SDK directory", - } - ); - const ndkPath = path.join(ANDROID_HOME, "ndk", ndkVersion); - assertFixable(fs.existsSync(ndkPath), `Expected NDK at ${ndkPath}`, { - command: `sdkmanager --install "ndk;${ndkVersion}"`, - }); - - const toolchainBinPath = getLLVMToolchainBinPath(ndkPath); - const targetArch = getTargetAndroidArch(target); - const targetPlatform = getTargetAndroidPlatform(target); - const weakNodeApiPath = getWeakNodeApiAndroidLibraryPath(target); - const cmdMaybe = process.platform === "win32" ? ".cmd" : ""; - const exeMaybe = process.platform === "win32" ? ".exe" : ""; - - return { - CARGO_ENCODED_RUSTFLAGS: [ - "-L", - weakNodeApiPath, - "-l", - "weak-node-api", - ].join(String.fromCharCode(0x1f)), - CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( - toolchainBinPath, - `aarch64-linux-android${androidApiLevel}-clang${cmdMaybe}` - ), - CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER: joinPathAndAssertExistence( - toolchainBinPath, - `armv7a-linux-androideabi${androidApiLevel}-clang${cmdMaybe}` - ), - CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( - toolchainBinPath, - `x86_64-linux-android${androidApiLevel}-clang${cmdMaybe}` - ), - CARGO_TARGET_I686_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( - toolchainBinPath, - `i686-linux-android${androidApiLevel}-clang${cmdMaybe}` - ), - TARGET_CC: joinPathAndAssertExistence( - toolchainBinPath, - `${targetArch}-linux-${targetPlatform}-clang${cmdMaybe}` - ), - TARGET_CXX: joinPathAndAssertExistence( - toolchainBinPath, - `${targetArch}-linux-${targetPlatform}-clang++${cmdMaybe}` - ), - TARGET_AR: joinPathAndAssertExistence( - toolchainBinPath, - `llvm-ar${exeMaybe}` - ), - TARGET_RANLIB: joinPathAndAssertExistence( - toolchainBinPath, - `llvm-ranlib${exeMaybe}` - ), - ANDROID_NDK: ndkPath, - PATH: `${toolchainBinPath}:${process.env.PATH}`, - }; - } else if (isAppleTarget(target)) { - const weakNodeApiFrameworkPath = getWeakNodeApiFrameworkPath(target); - return { - CARGO_ENCODED_RUSTFLAGS: [ - "-L", - `framework=${weakNodeApiFrameworkPath}`, - "-l", - "framework=weak-node-api", - ].join(String.fromCharCode(0x1f)), - }; - } else { - throw new Error(`Unexpected target: ${target}`); - } + if (isAndroidTarget(target)) { + assert(ndkVersion, "Expected ndkVersion to be set for Android targets"); + + const { ANDROID_HOME } = process.env; + assertFixable( + ANDROID_HOME && fs.existsSync(ANDROID_HOME), + `Missing ANDROID_HOME environment variable`, + { + instructions: "Set ANDROID_HOME to the Android SDK directory", + }, + ); + const ndkPath = path.join(ANDROID_HOME, "ndk", ndkVersion); + assertFixable(fs.existsSync(ndkPath), `Expected NDK at ${ndkPath}`, { + command: `sdkmanager --install "ndk;${ndkVersion}"`, + }); + + const toolchainBinPath = getLLVMToolchainBinPath(ndkPath); + const targetArch = getTargetAndroidArch(target); + const targetPlatform = getTargetAndroidPlatform(target); + const weakNodeApiPath = getWeakNodeApiAndroidLibraryPath(target); + const cmdMaybe = process.platform === "win32" ? ".cmd" : ""; + const exeMaybe = process.platform === "win32" ? ".exe" : ""; + + return { + CARGO_ENCODED_RUSTFLAGS: [ + "-L", + weakNodeApiPath, + "-l", + "weak-node-api", + ].join(String.fromCharCode(0x1f)), + CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( + toolchainBinPath, + `aarch64-linux-android${androidApiLevel}-clang${cmdMaybe}`, + ), + CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER: joinPathAndAssertExistence( + toolchainBinPath, + `armv7a-linux-androideabi${androidApiLevel}-clang${cmdMaybe}`, + ), + CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( + toolchainBinPath, + `x86_64-linux-android${androidApiLevel}-clang${cmdMaybe}`, + ), + CARGO_TARGET_I686_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( + toolchainBinPath, + `i686-linux-android${androidApiLevel}-clang${cmdMaybe}`, + ), + TARGET_CC: joinPathAndAssertExistence( + toolchainBinPath, + `${targetArch}-linux-${targetPlatform}-clang${cmdMaybe}`, + ), + TARGET_CXX: joinPathAndAssertExistence( + toolchainBinPath, + `${targetArch}-linux-${targetPlatform}-clang++${cmdMaybe}`, + ), + TARGET_AR: joinPathAndAssertExistence( + toolchainBinPath, + `llvm-ar${exeMaybe}`, + ), + TARGET_RANLIB: joinPathAndAssertExistence( + toolchainBinPath, + `llvm-ranlib${exeMaybe}`, + ), + ANDROID_NDK: ndkPath, + PATH: `${toolchainBinPath}:${process.env.PATH}`, + }; + } else if (isAppleTarget(target)) { + const weakNodeApiFrameworkPath = getWeakNodeApiFrameworkPath(target); + return { + CARGO_ENCODED_RUSTFLAGS: [ + "-L", + `framework=${weakNodeApiFrameworkPath}`, + "-l", + "framework=weak-node-api", + ].join(String.fromCharCode(0x1f)), + }; + } else { + throw new Error(`Unexpected target: ${target}`); + } } From b131b1e9701f27fddb522fb2d2da79b3af07ff99 Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Fri, 25 Jul 2025 17:03:54 -0300 Subject: [PATCH 04/10] add output to dist --- packages/ferric-example/.gitignore | 4 +--- packages/ferric/src/build.ts | 12 ++++++------ 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/ferric-example/.gitignore b/packages/ferric-example/.gitignore index 31c8570c..c984ee9d 100644 --- a/packages/ferric-example/.gitignore +++ b/packages/ferric-example/.gitignore @@ -5,6 +5,4 @@ Cargo.lock /*.apple.node/ /*.android.node/ -# Generated files -/ferric_example.d.ts -/ferric_example.js +dist diff --git a/packages/ferric/src/build.ts b/packages/ferric/src/build.ts index 381acddc..d63ba121 100644 --- a/packages/ferric/src/build.ts +++ b/packages/ferric/src/build.ts @@ -124,12 +124,12 @@ export const buildCommand = new Command("build") android, ndkVersion, output: outputPath, - cwd, + cwd: cwdPath, configuration, xcframeworkExtension, }) => { - outputPath = - cwd && cwd.length > 0 ? path.join(outputPath, cwd) : outputPath; + const sourcePath = cwdPath && cwdPath.length > 0 ? path.join(outputPath, cwdPath) : outputPath; + outputPath = path.join(sourcePath, "dist"); try { const targets = new Set([...targetArg]); if (apple) { @@ -184,7 +184,7 @@ export const buildCommand = new Command("build") async (target) => [ target, - await build({ configuration, target, sourcePath: outputPath }), + await build({ configuration, target, sourcePath }), ] as const, ), ), @@ -196,7 +196,7 @@ export const buildCommand = new Command("build") await build({ configuration, target, - sourcePath: outputPath, + sourcePath, ndkVersion, androidApiLevel: ANDROID_API_LEVEL, }), @@ -285,7 +285,7 @@ export const buildCommand = new Command("build") await oraPromise( generateTypeScriptDeclarations({ outputFilename: declarationsFilename, - createPath: outputPath, + createPath: sourcePath, outputPath, }), { From b10b252ca38ee1e1262653498fa653235f5a76e5 Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Fri, 25 Jul 2025 17:08:49 -0300 Subject: [PATCH 05/10] went back to previous setting --- packages/ferric/tsconfig.tests.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ferric/tsconfig.tests.json b/packages/ferric/tsconfig.tests.json index f6c792b5..17ee7c84 100644 --- a/packages/ferric/tsconfig.tests.json +++ b/packages/ferric/tsconfig.tests.json @@ -4,7 +4,7 @@ "composite": true, "emitDeclarationOnly": true }, - "include": ["__tests__/**/*.test.ts"], + "include": ["src/**/*.test.ts"], "exclude": [], "references": [ { From e97c45c9504dcd7138914ea3f4a834f83a3c7d36 Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Fri, 25 Jul 2025 17:09:23 -0300 Subject: [PATCH 06/10] formatted files --- packages/ferric/src/build.ts | 614 +++++++++++++++++------------------ packages/ferric/src/cargo.ts | 372 ++++++++++----------- 2 files changed, 493 insertions(+), 493 deletions(-) diff --git a/packages/ferric/src/build.ts b/packages/ferric/src/build.ts index d63ba121..daaac198 100644 --- a/packages/ferric/src/build.ts +++ b/packages/ferric/src/build.ts @@ -7,54 +7,54 @@ import chalk from "chalk"; import { oraPromise } from "ora"; import { - type AndroidTriplet, - createAndroidLibsDirectory, - createAppleFramework, - createUniversalAppleLibrary, - createXCframework, - determineAndroidLibsFilename, - determineLibraryBasename, - determineXCFrameworkFilename, - prettyPath, + type AndroidTriplet, + createAndroidLibsDirectory, + createAppleFramework, + createUniversalAppleLibrary, + createXCframework, + determineAndroidLibsFilename, + determineLibraryBasename, + determineXCFrameworkFilename, + prettyPath } from "react-native-node-api"; import { getBlockComment } from "./banner.js"; import { build, ensureCargo } from "./cargo.js"; import { assertFixable, UsageError } from "./errors.js"; import { generateTypeScriptDeclarations } from "./napi-rs.js"; import { - ALL_TARGETS, - ANDROID_TARGETS, - type AndroidTargetName, - APPLE_TARGETS, - type AppleTargetName, - ensureInstalledTargets, - filterTargetsByPlatform, + ALL_TARGETS, + ANDROID_TARGETS, + type AndroidTargetName, + APPLE_TARGETS, + type AppleTargetName, + ensureInstalledTargets, + filterTargetsByPlatform } from "./targets.js"; type EntrypointOptions = { - outputPath: string; - libraryName: string; + outputPath: string; + libraryName: string; }; async function generateEntrypoint({ - outputPath, - libraryName, + outputPath, + libraryName }: EntrypointOptions) { - await fs.promises.writeFile( - outputPath, - [ - "/* eslint-disable */", - getBlockComment(), - `module.exports = require('./${libraryName}.node');`, - ].join("\n\n") + "\n", - "utf8", - ); + await fs.promises.writeFile( + outputPath, + [ + "/* eslint-disable */", + getBlockComment(), + `module.exports = require('./${libraryName}.node');` + ].join("\n\n") + "\n", + "utf8" + ); } const ANDROID_TRIPLET_PER_TARGET: Record = { - "aarch64-linux-android": "aarch64-linux-android", - "armv7-linux-androideabi": "armv7a-linux-androideabi", - "i686-linux-android": "i686-linux-android", - "x86_64-linux-android": "x86_64-linux-android", + "aarch64-linux-android": "aarch64-linux-android", + "armv7-linux-androideabi": "armv7a-linux-androideabi", + "i686-linux-android": "i686-linux-android", + "x86_64-linux-android": "x86_64-linux-android" }; // This should match https://github.com/react-native-community/template/blob/main/template/android/build.gradle#L7 @@ -64,316 +64,316 @@ const ANDROID_API_LEVEL = 24; const { FERRIC_TARGETS } = process.env; function getDefaultTargets() { - const result = FERRIC_TARGETS ? FERRIC_TARGETS.split(",") : []; - for (const target of result) { - assertFixable( - (ALL_TARGETS as readonly string[]).includes(target), - `Unexpected target in FERRIC_TARGETS: ${target}`, - { - instructions: - "Pass only valid targets via FERRIC_TARGETS (or remove them)", - }, - ); - } - return result as (typeof ALL_TARGETS)[number][]; + const result = FERRIC_TARGETS ? FERRIC_TARGETS.split(",") : []; + for (const target of result) { + assertFixable( + (ALL_TARGETS as readonly string[]).includes(target), + `Unexpected target in FERRIC_TARGETS: ${target}`, + { + instructions: + "Pass only valid targets via FERRIC_TARGETS (or remove them)" + } + ); + } + return result as (typeof ALL_TARGETS)[number][]; } const targetOption = new Option("--target ", "Target triple") - .choices(ALL_TARGETS) - .default(getDefaultTargets()); + .choices(ALL_TARGETS) + .default(getDefaultTargets()); const appleTarget = new Option("--apple", "Use all Apple targets"); const androidTarget = new Option("--android", "Use all Android targets"); const ndkVersionOption = new Option( - "--ndk-version ", - "The NDK version to use for Android builds", + "--ndk-version ", + "The NDK version to use for Android builds" ).default(DEFAULT_NDK_VERSION); const xcframeworkExtensionOption = new Option( - "--xcframework-extension", - "Don't rename the xcframework to .apple.node", + "--xcframework-extension", + "Don't rename the xcframework to .apple.node" ).default(false); const outputPathOption = new Option( - "--output ", - "Writing outputs to this directory", + "--output ", + "Writing outputs to this directory" ).default(process.cwd()); -const cwdPathOption = new Option( - "--cwd ", - "Specify project path", -); +const cwdPathOption = new Option("--cwd ", "Specify project path"); const configurationOption = new Option( - "--configuration ", - "Build configuration", + "--configuration ", + "Build configuration" ) - .choices(["debug", "release"]) - .default("debug"); + .choices(["debug", "release"]) + .default("debug"); export const buildCommand = new Command("build") - .description("Build Rust Node-API module") - .addOption(targetOption) - .addOption(appleTarget) - .addOption(androidTarget) - .addOption(ndkVersionOption) - .addOption(outputPathOption) - .addOption(cwdPathOption) - .addOption(configurationOption) - .addOption(xcframeworkExtensionOption) - .action( - async ({ - target: targetArg, - apple, - android, - ndkVersion, - output: outputPath, - cwd: cwdPath, - configuration, - xcframeworkExtension, - }) => { - const sourcePath = cwdPath && cwdPath.length > 0 ? path.join(outputPath, cwdPath) : outputPath; - outputPath = path.join(sourcePath, "dist"); - try { - const targets = new Set([...targetArg]); - if (apple) { - for (const target of APPLE_TARGETS) { - targets.add(target); - } - } - if (android) { - for (const target of ANDROID_TARGETS) { - targets.add(target); - } - } + .description("Build Rust Node-API module") + .addOption(targetOption) + .addOption(appleTarget) + .addOption(androidTarget) + .addOption(ndkVersionOption) + .addOption(outputPathOption) + .addOption(cwdPathOption) + .addOption(configurationOption) + .addOption(xcframeworkExtensionOption) + .action( + async ({ + target: targetArg, + apple, + android, + ndkVersion, + output: outputPath, + cwd: cwdPath, + configuration, + xcframeworkExtension + }) => { + const sourcePath = + cwdPath && cwdPath.length > 0 + ? path.join(outputPath, cwdPath) + : outputPath; + outputPath = path.join(sourcePath, "dist"); + try { + const targets = new Set([...targetArg]); + if (apple) { + for (const target of APPLE_TARGETS) { + targets.add(target); + } + } + if (android) { + for (const target of ANDROID_TARGETS) { + targets.add(target); + } + } - if (targets.size === 0) { - if (isAndroidSupported()) { - if (process.arch === "arm64") { - targets.add("aarch64-linux-android"); - } else if (process.arch === "x64") { - targets.add("x86_64-linux-android"); - } - } - if (isAppleSupported()) { - if (process.arch === "arm64") { - targets.add("aarch64-apple-ios-sim"); - } - } - console.error( - chalk.yellowBright("ℹ"), - chalk.dim( - `Using default targets, pass ${chalk.italic( - "--android", - )}, ${chalk.italic("--apple")} or individual ${chalk.italic( - "--target", - )} options, to avoid this.`, - ), - ); - } - ensureCargo(); - ensureInstalledTargets(targets); + if (targets.size === 0) { + if (isAndroidSupported()) { + if (process.arch === "arm64") { + targets.add("aarch64-linux-android"); + } else if (process.arch === "x64") { + targets.add("x86_64-linux-android"); + } + } + if (isAppleSupported()) { + if (process.arch === "arm64") { + targets.add("aarch64-apple-ios-sim"); + } + } + console.error( + chalk.yellowBright("ℹ"), + chalk.dim( + `Using default targets, pass ${chalk.italic( + "--android" + )}, ${chalk.italic("--apple")} or individual ${chalk.italic( + "--target" + )} options, to avoid this.` + ) + ); + } + ensureCargo(); + ensureInstalledTargets(targets); - const appleTargets = filterTargetsByPlatform(targets, "apple"); - const androidTargets = filterTargetsByPlatform(targets, "android"); + const appleTargets = filterTargetsByPlatform(targets, "apple"); + const androidTargets = filterTargetsByPlatform(targets, "android"); - const targetsDescription = - targets.size + - (targets.size === 1 ? " target" : " targets") + - chalk.dim(" (" + [...targets].join(", ") + ")"); - const [appleLibraries, androidLibraries] = await oraPromise( - Promise.all([ - Promise.all( - appleTargets.map( - async (target) => - [ - target, - await build({ configuration, target, sourcePath }), - ] as const, - ), - ), - Promise.all( - androidTargets.map( - async (target) => - [ - target, - await build({ - configuration, - target, - sourcePath, - ndkVersion, - androidApiLevel: ANDROID_API_LEVEL, - }), - ] as const, - ), - ), - ]), - { - text: `Building ${targetsDescription}`, - successText: `Built ${targetsDescription}`, - failText: (error: Error) => `Failed to build: ${error.message}`, - }, - ); + const targetsDescription = + targets.size + + (targets.size === 1 ? " target" : " targets") + + chalk.dim(" (" + [...targets].join(", ") + ")"); + const [appleLibraries, androidLibraries] = await oraPromise( + Promise.all([ + Promise.all( + appleTargets.map( + async (target) => + [ + target, + await build({ configuration, target, sourcePath }) + ] as const + ) + ), + Promise.all( + androidTargets.map( + async (target) => + [ + target, + await build({ + configuration, + target, + sourcePath, + ndkVersion, + androidApiLevel: ANDROID_API_LEVEL + }) + ] as const + ) + ) + ]), + { + text: `Building ${targetsDescription}`, + successText: `Built ${targetsDescription}`, + failText: (error: Error) => `Failed to build: ${error.message}` + } + ); - if (androidLibraries.length > 0) { - const libraryPathByTriplet = Object.fromEntries( - androidLibraries.map(([target, outputPath]) => [ - ANDROID_TRIPLET_PER_TARGET[target], - outputPath, - ]), - ) as Record; + if (androidLibraries.length > 0) { + const libraryPathByTriplet = Object.fromEntries( + androidLibraries.map(([target, outputPath]) => [ + ANDROID_TRIPLET_PER_TARGET[target], + outputPath + ]) + ) as Record; - const androidLibsFilename = determineAndroidLibsFilename( - Object.values(libraryPathByTriplet), - ); - const androidLibsOutputPath = path.resolve( - outputPath, - androidLibsFilename, - ); + const androidLibsFilename = determineAndroidLibsFilename( + Object.values(libraryPathByTriplet) + ); + const androidLibsOutputPath = path.resolve( + outputPath, + androidLibsFilename + ); - await oraPromise( - createAndroidLibsDirectory({ - outputPath: androidLibsOutputPath, - libraryPathByTriplet, - autoLink: true, - }), - { - text: "Assembling Android libs directory", - successText: `Android libs directory assembled into ${prettyPath( - androidLibsOutputPath, - )}`, - failText: ({ message }) => - `Failed to assemble Android libs directory: ${message}`, - }, - ); - } + await oraPromise( + createAndroidLibsDirectory({ + outputPath: androidLibsOutputPath, + libraryPathByTriplet, + autoLink: true + }), + { + text: "Assembling Android libs directory", + successText: `Android libs directory assembled into ${prettyPath( + androidLibsOutputPath + )}`, + failText: ({ message }) => + `Failed to assemble Android libs directory: ${message}` + } + ); + } - if (appleLibraries.length > 0) { - const libraryPaths = await combineLibraries(appleLibraries); - const frameworkPaths = libraryPaths.map(createAppleFramework); - const xcframeworkFilename = determineXCFrameworkFilename( - frameworkPaths, - xcframeworkExtension ? ".xcframework" : ".apple.node", - ); + if (appleLibraries.length > 0) { + const libraryPaths = await combineLibraries(appleLibraries); + const frameworkPaths = libraryPaths.map(createAppleFramework); + const xcframeworkFilename = determineXCFrameworkFilename( + frameworkPaths, + xcframeworkExtension ? ".xcframework" : ".apple.node" + ); - // Create the xcframework - const xcframeworkOutputPath = path.resolve( - outputPath, - xcframeworkFilename, - ); + // Create the xcframework + const xcframeworkOutputPath = path.resolve( + outputPath, + xcframeworkFilename + ); - await oraPromise( - createXCframework({ - outputPath: xcframeworkOutputPath, - frameworkPaths, - autoLink: true, - }), - { - text: "Assembling XCFramework", - successText: `XCFramework assembled into ${chalk.dim( - path.relative(outputPath, xcframeworkOutputPath), - )}`, - failText: ({ message }) => - `Failed to assemble XCFramework: ${message}`, - }, - ); - } + await oraPromise( + createXCframework({ + outputPath: xcframeworkOutputPath, + frameworkPaths, + autoLink: true + }), + { + text: "Assembling XCFramework", + successText: `XCFramework assembled into ${chalk.dim( + path.relative(outputPath, xcframeworkOutputPath) + )}`, + failText: ({ message }) => + `Failed to assemble XCFramework: ${message}` + } + ); + } - const libraryName = determineLibraryBasename([ - ...androidLibraries.map(([, outputPath]) => outputPath), - ...appleLibraries.map(([, outputPath]) => outputPath), - ]); + const libraryName = determineLibraryBasename([ + ...androidLibraries.map(([, outputPath]) => outputPath), + ...appleLibraries.map(([, outputPath]) => outputPath) + ]); - const declarationsFilename = `${libraryName}.d.ts`; - const declarationsPath = path.join(outputPath, declarationsFilename); - await oraPromise( - generateTypeScriptDeclarations({ - outputFilename: declarationsFilename, - createPath: sourcePath, - outputPath, - }), - { - text: "Generating TypeScript declarations", - successText: `Generated TypeScript declarations ${prettyPath( - declarationsPath, - )}`, - failText: (error) => - `Failed to generate TypeScript declarations: ${error.message}`, - }, - ); + const declarationsFilename = `${libraryName}.d.ts`; + const declarationsPath = path.join(outputPath, declarationsFilename); + await oraPromise( + generateTypeScriptDeclarations({ + outputFilename: declarationsFilename, + createPath: sourcePath, + outputPath + }), + { + text: "Generating TypeScript declarations", + successText: `Generated TypeScript declarations ${prettyPath( + declarationsPath + )}`, + failText: (error) => + `Failed to generate TypeScript declarations: ${error.message}` + } + ); - const entrypointPath = path.join(outputPath, `${libraryName}.js`); + const entrypointPath = path.join(outputPath, `${libraryName}.js`); - await oraPromise( - generateEntrypoint({ - libraryName, - outputPath: entrypointPath, - }), - { - text: `Generating entrypoint`, - successText: `Generated entrypoint into ${prettyPath( - entrypointPath, - )}`, - failText: (error) => - `Failed to generate entrypoint: ${error.message}`, - }, - ); - } catch (error) { - process.exitCode = 1; - if (error instanceof SpawnFailure) { - error.flushOutput("both"); - } - if (error instanceof UsageError || error instanceof SpawnFailure) { - console.error(chalk.red("ERROR"), error.message); - if (error.cause instanceof Error) { - console.error(chalk.red("CAUSE"), error.cause.message); - } - if (error instanceof UsageError && error.fix) { - console.error( - chalk.green("FIX"), - error.fix.command - ? chalk.dim("Run: ") + error.fix.command - : error.fix.instructions, - ); - } - } else { - throw error; - } - } - }, - ); + await oraPromise( + generateEntrypoint({ + libraryName, + outputPath: entrypointPath + }), + { + text: `Generating entrypoint`, + successText: `Generated entrypoint into ${prettyPath( + entrypointPath + )}`, + failText: (error) => + `Failed to generate entrypoint: ${error.message}` + } + ); + } catch (error) { + process.exitCode = 1; + if (error instanceof SpawnFailure) { + error.flushOutput("both"); + } + if (error instanceof UsageError || error instanceof SpawnFailure) { + console.error(chalk.red("ERROR"), error.message); + if (error.cause instanceof Error) { + console.error(chalk.red("CAUSE"), error.cause.message); + } + if (error instanceof UsageError && error.fix) { + console.error( + chalk.green("FIX"), + error.fix.command + ? chalk.dim("Run: ") + error.fix.command + : error.fix.instructions + ); + } + } else { + throw error; + } + } + } + ); async function combineLibraries( - libraries: Readonly<[AppleTargetName, string]>[], + libraries: Readonly<[AppleTargetName, string]>[] ): Promise { - const result = []; - const darwinLibraries = []; - for (const [target, libraryPath] of libraries) { - if (target.endsWith("-darwin")) { - darwinLibraries.push(libraryPath); - } else { - result.push(libraryPath); - } - } - if (darwinLibraries.length === 0) { - return result; - } else if (darwinLibraries.length === 1) { - return [...result, darwinLibraries[0]]; - } else { - const universalPath = await oraPromise( - createUniversalAppleLibrary(darwinLibraries), - { - text: "Combining Darwin libraries into a universal library", - successText: "Combined Darwin libraries into a universal library", - failText: (error) => - `Failed to combine Darwin libraries: ${error.message}`, - }, - ); - return [...result, universalPath]; - } + const result = []; + const darwinLibraries = []; + for (const [target, libraryPath] of libraries) { + if (target.endsWith("-darwin")) { + darwinLibraries.push(libraryPath); + } else { + result.push(libraryPath); + } + } + if (darwinLibraries.length === 0) { + return result; + } else if (darwinLibraries.length === 1) { + return [...result, darwinLibraries[0]]; + } else { + const universalPath = await oraPromise( + createUniversalAppleLibrary(darwinLibraries), + { + text: "Combining Darwin libraries into a universal library", + successText: "Combined Darwin libraries into a universal library", + failText: (error) => + `Failed to combine Darwin libraries: ${error.message}` + } + ); + return [...result, universalPath]; + } } export function isAndroidSupported() { - const { ANDROID_HOME } = process.env; - return typeof ANDROID_HOME === "string" && fs.existsSync(ANDROID_HOME); + const { ANDROID_HOME } = process.env; + return typeof ANDROID_HOME === "string" && fs.existsSync(ANDROID_HOME); } export function isAppleSupported() { - return process.platform === "darwin"; + return process.platform === "darwin"; } diff --git a/packages/ferric/src/cargo.ts b/packages/ferric/src/cargo.ts index f1408ec9..85e98f20 100644 --- a/packages/ferric/src/cargo.ts +++ b/packages/ferric/src/cargo.ts @@ -8,227 +8,227 @@ import chalk from "chalk"; import { weakNodeApiPath } from "react-native-node-api"; import { assertFixable, UsageError } from "./errors.js"; import { - type AndroidTargetName, - type AppleTargetName, - isAndroidTarget, - isAppleTarget, + type AndroidTargetName, + type AppleTargetName, + isAndroidTarget, + isAppleTarget } from "./targets.js"; const APPLE_XCFRAMEWORK_CHILDS_PER_TARGET: Record = { - "aarch64-apple-darwin": "macos-arm64_x86_64", // Universal - "x86_64-apple-darwin": "macos-arm64_x86_64", // Universal - "aarch64-apple-ios": "ios-arm64", - "aarch64-apple-ios-sim": "ios-arm64-simulator", - // "aarch64-apple-ios-macabi": "", // Catalyst - // "x86_64-apple-ios": "ios-x86_64", - // "x86_64-apple-ios-macabi": "ios-x86_64-simulator", - // "aarch64-apple-tvos": "tvos-arm64", - // "aarch64-apple-tvos-sim": "tvos-arm64-simulator", - // "aarch64-apple-visionos": "xros-arm64", - // "aarch64-apple-visionos-sim": "xros-arm64-simulator", + "aarch64-apple-darwin": "macos-arm64_x86_64", // Universal + "x86_64-apple-darwin": "macos-arm64_x86_64", // Universal + "aarch64-apple-ios": "ios-arm64", + "aarch64-apple-ios-sim": "ios-arm64-simulator" + // "aarch64-apple-ios-macabi": "", // Catalyst + // "x86_64-apple-ios": "ios-x86_64", + // "x86_64-apple-ios-macabi": "ios-x86_64-simulator", + // "aarch64-apple-tvos": "tvos-arm64", + // "aarch64-apple-tvos-sim": "tvos-arm64-simulator", + // "aarch64-apple-visionos": "xros-arm64", + // "aarch64-apple-visionos-sim": "xros-arm64-simulator", }; const ANDROID_ARCH_PR_TARGET: Record = { - "aarch64-linux-android": "arm64-v8a", - "armv7-linux-androideabi": "armeabi-v7a", - "i686-linux-android": "x86", - "x86_64-linux-android": "x86_64", + "aarch64-linux-android": "arm64-v8a", + "armv7-linux-androideabi": "armeabi-v7a", + "i686-linux-android": "x86", + "x86_64-linux-android": "x86_64" }; export function joinPathAndAssertExistence(...pathSegments: string[]) { - const joinedPath = path.join(...pathSegments); - assert(fs.existsSync(joinedPath), `Expected ${joinedPath} to exist`); - return joinedPath; + const joinedPath = path.join(...pathSegments); + assert(fs.existsSync(joinedPath), `Expected ${joinedPath} to exist`); + return joinedPath; } export function ensureCargo() { - try { - const cargoVersion = cp - .execFileSync("cargo", ["--version"], { - encoding: "utf-8", - }) - .trim(); - console.log(chalk.dim(`Using ${cargoVersion}`)); - } catch (error) { - throw new UsageError( - "You need a Rust toolchain: https://doc.rust-lang.org/cargo/getting-started/installation.html#install-rust-and-cargo", - { cause: error }, - ); - } + try { + const cargoVersion = cp + .execFileSync("cargo", ["--version"], { + encoding: "utf-8" + }) + .trim(); + console.log(chalk.dim(`Using ${cargoVersion}`)); + } catch (error) { + throw new UsageError( + "You need a Rust toolchain: https://doc.rust-lang.org/cargo/getting-started/installation.html#install-rust-and-cargo", + { cause: error } + ); + } } type BuildOptions = { - configuration: "debug" | "release"; - sourcePath: string; + configuration: "debug" | "release"; + sourcePath: string; } & ( - | { - target: AndroidTargetName; - ndkVersion: string; - androidApiLevel: number; - } - | { - target: AppleTargetName; - ndkVersion?: never; - androidApiLevel?: number; - } - ); + | { + target: AndroidTargetName; + ndkVersion: string; + androidApiLevel: number; + } + | { + target: AppleTargetName; + ndkVersion?: never; + androidApiLevel?: number; + } +); export async function build(options: BuildOptions) { - const { target, configuration, sourcePath } = options; - const manifestBuildPath = `${sourcePath}/Cargo.toml`; - const args = [ - "build", - "--target", - target, - "--manifest-path", - manifestBuildPath, - ]; - if (configuration.toLowerCase() === "release") { - args.push("--release"); - } - await spawn("cargo", args, { - outputMode: "buffered", - env: { - ...process.env, - ...getTargetEnvironmentVariables(options), - }, - }); - const targetOutputPath = joinPathAndAssertExistence( - sourcePath, - "target", - target, - configuration, - ); - const dynamicLibraryFile = fs - .readdirSync(targetOutputPath) - .filter((file) => file.endsWith(".so") || file.endsWith(".dylib")); - assert( - dynamicLibraryFile.length === 1, - `Expected a single shared object file in ${targetOutputPath}`, - ); - return joinPathAndAssertExistence(targetOutputPath, dynamicLibraryFile[0]); + const { target, configuration, sourcePath } = options; + const manifestBuildPath = `${sourcePath}/Cargo.toml`; + const args = [ + "build", + "--target", + target, + "--manifest-path", + manifestBuildPath + ]; + if (configuration.toLowerCase() === "release") { + args.push("--release"); + } + await spawn("cargo", args, { + outputMode: "buffered", + env: { + ...process.env, + ...getTargetEnvironmentVariables(options) + } + }); + const targetOutputPath = joinPathAndAssertExistence( + sourcePath, + "target", + target, + configuration + ); + const dynamicLibraryFile = fs + .readdirSync(targetOutputPath) + .filter((file) => file.endsWith(".so") || file.endsWith(".dylib")); + assert( + dynamicLibraryFile.length === 1, + `Expected a single shared object file in ${targetOutputPath}` + ); + return joinPathAndAssertExistence(targetOutputPath, dynamicLibraryFile[0]); } export function getLLVMToolchainBinPath(ndkPath: string) { - const prebuiltPath = path.join(ndkPath, "toolchains", "llvm", "prebuilt"); - const candidates = fs.readdirSync(prebuiltPath); - if (candidates.length === 0) { - throw new Error("Expected LLVM toolchain to be installed"); - } else if (candidates.length > 1) { - throw new Error("Expected a single LLVM toolchain to be installed"); - } else { - return path.join(prebuiltPath, candidates[0], "bin"); - } + const prebuiltPath = path.join(ndkPath, "toolchains", "llvm", "prebuilt"); + const candidates = fs.readdirSync(prebuiltPath); + if (candidates.length === 0) { + throw new Error("Expected LLVM toolchain to be installed"); + } else if (candidates.length > 1) { + throw new Error("Expected a single LLVM toolchain to be installed"); + } else { + return path.join(prebuiltPath, candidates[0], "bin"); + } } export function getTargetAndroidArch(target: AndroidTargetName) { - const [first] = target.split("-"); - return first === "armv7" ? "armv7a" : first; + const [first] = target.split("-"); + return first === "armv7" ? "armv7a" : first; } export function getTargetAndroidPlatform(target: AndroidTargetName) { - return getTargetAndroidArch(target) === "armv7a" - ? "androideabi24" - : "android24"; + return getTargetAndroidArch(target) === "armv7a" + ? "androideabi24" + : "android24"; } export function getWeakNodeApiFrameworkPath(target: AppleTargetName) { - return joinPathAndAssertExistence( - weakNodeApiPath, - "weak-node-api.xcframework", - APPLE_XCFRAMEWORK_CHILDS_PER_TARGET[target], - ); + return joinPathAndAssertExistence( + weakNodeApiPath, + "weak-node-api.xcframework", + APPLE_XCFRAMEWORK_CHILDS_PER_TARGET[target] + ); } export function getWeakNodeApiAndroidLibraryPath(target: AndroidTargetName) { - return joinPathAndAssertExistence( - weakNodeApiPath, - "weak-node-api.android.node", - ANDROID_ARCH_PR_TARGET[target], - ); + return joinPathAndAssertExistence( + weakNodeApiPath, + "weak-node-api.android.node", + ANDROID_ARCH_PR_TARGET[target] + ); } export function getTargetEnvironmentVariables({ - target, - ndkVersion, - androidApiLevel, + target, + ndkVersion, + androidApiLevel }: BuildOptions): Record { - if (isAndroidTarget(target)) { - assert(ndkVersion, "Expected ndkVersion to be set for Android targets"); - - const { ANDROID_HOME } = process.env; - assertFixable( - ANDROID_HOME && fs.existsSync(ANDROID_HOME), - `Missing ANDROID_HOME environment variable`, - { - instructions: "Set ANDROID_HOME to the Android SDK directory", - }, - ); - const ndkPath = path.join(ANDROID_HOME, "ndk", ndkVersion); - assertFixable(fs.existsSync(ndkPath), `Expected NDK at ${ndkPath}`, { - command: `sdkmanager --install "ndk;${ndkVersion}"`, - }); - - const toolchainBinPath = getLLVMToolchainBinPath(ndkPath); - const targetArch = getTargetAndroidArch(target); - const targetPlatform = getTargetAndroidPlatform(target); - const weakNodeApiPath = getWeakNodeApiAndroidLibraryPath(target); - const cmdMaybe = process.platform === "win32" ? ".cmd" : ""; - const exeMaybe = process.platform === "win32" ? ".exe" : ""; - - return { - CARGO_ENCODED_RUSTFLAGS: [ - "-L", - weakNodeApiPath, - "-l", - "weak-node-api", - ].join(String.fromCharCode(0x1f)), - CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( - toolchainBinPath, - `aarch64-linux-android${androidApiLevel}-clang${cmdMaybe}`, - ), - CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER: joinPathAndAssertExistence( - toolchainBinPath, - `armv7a-linux-androideabi${androidApiLevel}-clang${cmdMaybe}`, - ), - CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( - toolchainBinPath, - `x86_64-linux-android${androidApiLevel}-clang${cmdMaybe}`, - ), - CARGO_TARGET_I686_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( - toolchainBinPath, - `i686-linux-android${androidApiLevel}-clang${cmdMaybe}`, - ), - TARGET_CC: joinPathAndAssertExistence( - toolchainBinPath, - `${targetArch}-linux-${targetPlatform}-clang${cmdMaybe}`, - ), - TARGET_CXX: joinPathAndAssertExistence( - toolchainBinPath, - `${targetArch}-linux-${targetPlatform}-clang++${cmdMaybe}`, - ), - TARGET_AR: joinPathAndAssertExistence( - toolchainBinPath, - `llvm-ar${exeMaybe}`, - ), - TARGET_RANLIB: joinPathAndAssertExistence( - toolchainBinPath, - `llvm-ranlib${exeMaybe}`, - ), - ANDROID_NDK: ndkPath, - PATH: `${toolchainBinPath}:${process.env.PATH}`, - }; - } else if (isAppleTarget(target)) { - const weakNodeApiFrameworkPath = getWeakNodeApiFrameworkPath(target); - return { - CARGO_ENCODED_RUSTFLAGS: [ - "-L", - `framework=${weakNodeApiFrameworkPath}`, - "-l", - "framework=weak-node-api", - ].join(String.fromCharCode(0x1f)), - }; - } else { - throw new Error(`Unexpected target: ${target}`); - } + if (isAndroidTarget(target)) { + assert(ndkVersion, "Expected ndkVersion to be set for Android targets"); + + const { ANDROID_HOME } = process.env; + assertFixable( + ANDROID_HOME && fs.existsSync(ANDROID_HOME), + `Missing ANDROID_HOME environment variable`, + { + instructions: "Set ANDROID_HOME to the Android SDK directory" + } + ); + const ndkPath = path.join(ANDROID_HOME, "ndk", ndkVersion); + assertFixable(fs.existsSync(ndkPath), `Expected NDK at ${ndkPath}`, { + command: `sdkmanager --install "ndk;${ndkVersion}"` + }); + + const toolchainBinPath = getLLVMToolchainBinPath(ndkPath); + const targetArch = getTargetAndroidArch(target); + const targetPlatform = getTargetAndroidPlatform(target); + const weakNodeApiPath = getWeakNodeApiAndroidLibraryPath(target); + const cmdMaybe = process.platform === "win32" ? ".cmd" : ""; + const exeMaybe = process.platform === "win32" ? ".exe" : ""; + + return { + CARGO_ENCODED_RUSTFLAGS: [ + "-L", + weakNodeApiPath, + "-l", + "weak-node-api" + ].join(String.fromCharCode(0x1f)), + CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( + toolchainBinPath, + `aarch64-linux-android${androidApiLevel}-clang${cmdMaybe}` + ), + CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER: joinPathAndAssertExistence( + toolchainBinPath, + `armv7a-linux-androideabi${androidApiLevel}-clang${cmdMaybe}` + ), + CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( + toolchainBinPath, + `x86_64-linux-android${androidApiLevel}-clang${cmdMaybe}` + ), + CARGO_TARGET_I686_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( + toolchainBinPath, + `i686-linux-android${androidApiLevel}-clang${cmdMaybe}` + ), + TARGET_CC: joinPathAndAssertExistence( + toolchainBinPath, + `${targetArch}-linux-${targetPlatform}-clang${cmdMaybe}` + ), + TARGET_CXX: joinPathAndAssertExistence( + toolchainBinPath, + `${targetArch}-linux-${targetPlatform}-clang++${cmdMaybe}` + ), + TARGET_AR: joinPathAndAssertExistence( + toolchainBinPath, + `llvm-ar${exeMaybe}` + ), + TARGET_RANLIB: joinPathAndAssertExistence( + toolchainBinPath, + `llvm-ranlib${exeMaybe}` + ), + ANDROID_NDK: ndkPath, + PATH: `${toolchainBinPath}:${process.env.PATH}` + }; + } else if (isAppleTarget(target)) { + const weakNodeApiFrameworkPath = getWeakNodeApiFrameworkPath(target); + return { + CARGO_ENCODED_RUSTFLAGS: [ + "-L", + `framework=${weakNodeApiFrameworkPath}`, + "-l", + "framework=weak-node-api" + ].join(String.fromCharCode(0x1f)) + }; + } else { + throw new Error(`Unexpected target: ${target}`); + } } From 7e103158d9514ac5617a281c1aebbc01bdd22a43 Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Fri, 25 Jul 2025 17:14:51 -0300 Subject: [PATCH 07/10] updated readme --- packages/ferric/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/ferric/README.md b/packages/ferric/README.md index d3f8d222..8d7f45be 100644 --- a/packages/ferric/README.md +++ b/packages/ferric/README.md @@ -11,6 +11,6 @@ A wrapper around Cargo making it easier to produce prebuilt binaries targeting i ```json "scripts": { "build": "ferric build --cwd folder_path", - "build:release": "npm run build --configuration release", + "build:release": "npm run build -- --configuration release", }, ``` From 34f96f1136d9effeabb06123b3243e189492f83e Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Fri, 25 Jul 2025 17:47:36 -0300 Subject: [PATCH 08/10] added traillingcommas --- packages/ferric/src/build.ts | 110 +++++++++++++++++------------------ packages/ferric/src/cargo.ts | 56 +++++++++--------- 2 files changed, 83 insertions(+), 83 deletions(-) diff --git a/packages/ferric/src/build.ts b/packages/ferric/src/build.ts index daaac198..ef6176b5 100644 --- a/packages/ferric/src/build.ts +++ b/packages/ferric/src/build.ts @@ -15,7 +15,7 @@ import { determineAndroidLibsFilename, determineLibraryBasename, determineXCFrameworkFilename, - prettyPath + prettyPath, } from "react-native-node-api"; import { getBlockComment } from "./banner.js"; import { build, ensureCargo } from "./cargo.js"; @@ -28,7 +28,7 @@ import { APPLE_TARGETS, type AppleTargetName, ensureInstalledTargets, - filterTargetsByPlatform + filterTargetsByPlatform, } from "./targets.js"; type EntrypointOptions = { @@ -37,16 +37,16 @@ type EntrypointOptions = { }; async function generateEntrypoint({ outputPath, - libraryName + libraryName, }: EntrypointOptions) { await fs.promises.writeFile( outputPath, [ "/* eslint-disable */", getBlockComment(), - `module.exports = require('./${libraryName}.node');` + `module.exports = require('./${libraryName}.node');`, ].join("\n\n") + "\n", - "utf8" + "utf8", ); } @@ -54,7 +54,7 @@ const ANDROID_TRIPLET_PER_TARGET: Record = { "aarch64-linux-android": "aarch64-linux-android", "armv7-linux-androideabi": "armv7a-linux-androideabi", "i686-linux-android": "i686-linux-android", - "x86_64-linux-android": "x86_64-linux-android" + "x86_64-linux-android": "x86_64-linux-android", }; // This should match https://github.com/react-native-community/template/blob/main/template/android/build.gradle#L7 @@ -71,8 +71,8 @@ function getDefaultTargets() { `Unexpected target in FERRIC_TARGETS: ${target}`, { instructions: - "Pass only valid targets via FERRIC_TARGETS (or remove them)" - } + "Pass only valid targets via FERRIC_TARGETS (or remove them)", + }, ); } return result as (typeof ALL_TARGETS)[number][]; @@ -85,21 +85,21 @@ const appleTarget = new Option("--apple", "Use all Apple targets"); const androidTarget = new Option("--android", "Use all Android targets"); const ndkVersionOption = new Option( "--ndk-version ", - "The NDK version to use for Android builds" + "The NDK version to use for Android builds", ).default(DEFAULT_NDK_VERSION); const xcframeworkExtensionOption = new Option( "--xcframework-extension", - "Don't rename the xcframework to .apple.node" + "Don't rename the xcframework to .apple.node", ).default(false); const outputPathOption = new Option( "--output ", - "Writing outputs to this directory" + "Writing outputs to this directory", ).default(process.cwd()); const cwdPathOption = new Option("--cwd ", "Specify project path"); const configurationOption = new Option( "--configuration ", - "Build configuration" + "Build configuration", ) .choices(["debug", "release"]) .default("debug"); @@ -123,7 +123,7 @@ export const buildCommand = new Command("build") output: outputPath, cwd: cwdPath, configuration, - xcframeworkExtension + xcframeworkExtension, }) => { const sourcePath = cwdPath && cwdPath.length > 0 @@ -160,11 +160,11 @@ export const buildCommand = new Command("build") chalk.yellowBright("ℹ"), chalk.dim( `Using default targets, pass ${chalk.italic( - "--android" + "--android", )}, ${chalk.italic("--apple")} or individual ${chalk.italic( - "--target" - )} options, to avoid this.` - ) + "--target", + )} options, to avoid this.`, + ), ); } ensureCargo(); @@ -184,9 +184,9 @@ export const buildCommand = new Command("build") async (target) => [ target, - await build({ configuration, target, sourcePath }) - ] as const - ) + await build({ configuration, target, sourcePath }), + ] as const, + ), ), Promise.all( androidTargets.map( @@ -198,49 +198,49 @@ export const buildCommand = new Command("build") target, sourcePath, ndkVersion, - androidApiLevel: ANDROID_API_LEVEL - }) - ] as const - ) - ) + androidApiLevel: ANDROID_API_LEVEL, + }), + ] as const, + ), + ), ]), { text: `Building ${targetsDescription}`, successText: `Built ${targetsDescription}`, - failText: (error: Error) => `Failed to build: ${error.message}` - } + failText: (error: Error) => `Failed to build: ${error.message}`, + }, ); if (androidLibraries.length > 0) { const libraryPathByTriplet = Object.fromEntries( androidLibraries.map(([target, outputPath]) => [ ANDROID_TRIPLET_PER_TARGET[target], - outputPath - ]) + outputPath, + ]), ) as Record; const androidLibsFilename = determineAndroidLibsFilename( - Object.values(libraryPathByTriplet) + Object.values(libraryPathByTriplet), ); const androidLibsOutputPath = path.resolve( outputPath, - androidLibsFilename + androidLibsFilename, ); await oraPromise( createAndroidLibsDirectory({ outputPath: androidLibsOutputPath, libraryPathByTriplet, - autoLink: true + autoLink: true, }), { text: "Assembling Android libs directory", successText: `Android libs directory assembled into ${prettyPath( - androidLibsOutputPath + androidLibsOutputPath, )}`, failText: ({ message }) => - `Failed to assemble Android libs directory: ${message}` - } + `Failed to assemble Android libs directory: ${message}`, + }, ); } @@ -249,35 +249,35 @@ export const buildCommand = new Command("build") const frameworkPaths = libraryPaths.map(createAppleFramework); const xcframeworkFilename = determineXCFrameworkFilename( frameworkPaths, - xcframeworkExtension ? ".xcframework" : ".apple.node" + xcframeworkExtension ? ".xcframework" : ".apple.node", ); // Create the xcframework const xcframeworkOutputPath = path.resolve( outputPath, - xcframeworkFilename + xcframeworkFilename, ); await oraPromise( createXCframework({ outputPath: xcframeworkOutputPath, frameworkPaths, - autoLink: true + autoLink: true, }), { text: "Assembling XCFramework", successText: `XCFramework assembled into ${chalk.dim( - path.relative(outputPath, xcframeworkOutputPath) + path.relative(outputPath, xcframeworkOutputPath), )}`, failText: ({ message }) => - `Failed to assemble XCFramework: ${message}` - } + `Failed to assemble XCFramework: ${message}`, + }, ); } const libraryName = determineLibraryBasename([ ...androidLibraries.map(([, outputPath]) => outputPath), - ...appleLibraries.map(([, outputPath]) => outputPath) + ...appleLibraries.map(([, outputPath]) => outputPath), ]); const declarationsFilename = `${libraryName}.d.ts`; @@ -286,16 +286,16 @@ export const buildCommand = new Command("build") generateTypeScriptDeclarations({ outputFilename: declarationsFilename, createPath: sourcePath, - outputPath + outputPath, }), { text: "Generating TypeScript declarations", successText: `Generated TypeScript declarations ${prettyPath( - declarationsPath + declarationsPath, )}`, failText: (error) => - `Failed to generate TypeScript declarations: ${error.message}` - } + `Failed to generate TypeScript declarations: ${error.message}`, + }, ); const entrypointPath = path.join(outputPath, `${libraryName}.js`); @@ -303,16 +303,16 @@ export const buildCommand = new Command("build") await oraPromise( generateEntrypoint({ libraryName, - outputPath: entrypointPath + outputPath: entrypointPath, }), { text: `Generating entrypoint`, successText: `Generated entrypoint into ${prettyPath( - entrypointPath + entrypointPath, )}`, failText: (error) => - `Failed to generate entrypoint: ${error.message}` - } + `Failed to generate entrypoint: ${error.message}`, + }, ); } catch (error) { process.exitCode = 1; @@ -329,18 +329,18 @@ export const buildCommand = new Command("build") chalk.green("FIX"), error.fix.command ? chalk.dim("Run: ") + error.fix.command - : error.fix.instructions + : error.fix.instructions, ); } } else { throw error; } } - } + }, ); async function combineLibraries( - libraries: Readonly<[AppleTargetName, string]>[] + libraries: Readonly<[AppleTargetName, string]>[], ): Promise { const result = []; const darwinLibraries = []; @@ -362,8 +362,8 @@ async function combineLibraries( text: "Combining Darwin libraries into a universal library", successText: "Combined Darwin libraries into a universal library", failText: (error) => - `Failed to combine Darwin libraries: ${error.message}` - } + `Failed to combine Darwin libraries: ${error.message}`, + }, ); return [...result, universalPath]; } diff --git a/packages/ferric/src/cargo.ts b/packages/ferric/src/cargo.ts index 85e98f20..d1aef0f1 100644 --- a/packages/ferric/src/cargo.ts +++ b/packages/ferric/src/cargo.ts @@ -11,14 +11,14 @@ import { type AndroidTargetName, type AppleTargetName, isAndroidTarget, - isAppleTarget + isAppleTarget, } from "./targets.js"; const APPLE_XCFRAMEWORK_CHILDS_PER_TARGET: Record = { "aarch64-apple-darwin": "macos-arm64_x86_64", // Universal "x86_64-apple-darwin": "macos-arm64_x86_64", // Universal "aarch64-apple-ios": "ios-arm64", - "aarch64-apple-ios-sim": "ios-arm64-simulator" + "aarch64-apple-ios-sim": "ios-arm64-simulator", // "aarch64-apple-ios-macabi": "", // Catalyst // "x86_64-apple-ios": "ios-x86_64", // "x86_64-apple-ios-macabi": "ios-x86_64-simulator", @@ -32,7 +32,7 @@ const ANDROID_ARCH_PR_TARGET: Record = { "aarch64-linux-android": "arm64-v8a", "armv7-linux-androideabi": "armeabi-v7a", "i686-linux-android": "x86", - "x86_64-linux-android": "x86_64" + "x86_64-linux-android": "x86_64", }; export function joinPathAndAssertExistence(...pathSegments: string[]) { @@ -45,14 +45,14 @@ export function ensureCargo() { try { const cargoVersion = cp .execFileSync("cargo", ["--version"], { - encoding: "utf-8" + encoding: "utf-8", }) .trim(); console.log(chalk.dim(`Using ${cargoVersion}`)); } catch (error) { throw new UsageError( "You need a Rust toolchain: https://doc.rust-lang.org/cargo/getting-started/installation.html#install-rust-and-cargo", - { cause: error } + { cause: error }, ); } } @@ -81,7 +81,7 @@ export async function build(options: BuildOptions) { "--target", target, "--manifest-path", - manifestBuildPath + manifestBuildPath, ]; if (configuration.toLowerCase() === "release") { args.push("--release"); @@ -90,21 +90,21 @@ export async function build(options: BuildOptions) { outputMode: "buffered", env: { ...process.env, - ...getTargetEnvironmentVariables(options) - } + ...getTargetEnvironmentVariables(options), + }, }); const targetOutputPath = joinPathAndAssertExistence( sourcePath, "target", target, - configuration + configuration, ); const dynamicLibraryFile = fs .readdirSync(targetOutputPath) .filter((file) => file.endsWith(".so") || file.endsWith(".dylib")); assert( dynamicLibraryFile.length === 1, - `Expected a single shared object file in ${targetOutputPath}` + `Expected a single shared object file in ${targetOutputPath}`, ); return joinPathAndAssertExistence(targetOutputPath, dynamicLibraryFile[0]); } @@ -136,7 +136,7 @@ export function getWeakNodeApiFrameworkPath(target: AppleTargetName) { return joinPathAndAssertExistence( weakNodeApiPath, "weak-node-api.xcframework", - APPLE_XCFRAMEWORK_CHILDS_PER_TARGET[target] + APPLE_XCFRAMEWORK_CHILDS_PER_TARGET[target], ); } @@ -144,14 +144,14 @@ export function getWeakNodeApiAndroidLibraryPath(target: AndroidTargetName) { return joinPathAndAssertExistence( weakNodeApiPath, "weak-node-api.android.node", - ANDROID_ARCH_PR_TARGET[target] + ANDROID_ARCH_PR_TARGET[target], ); } export function getTargetEnvironmentVariables({ target, ndkVersion, - androidApiLevel + androidApiLevel, }: BuildOptions): Record { if (isAndroidTarget(target)) { assert(ndkVersion, "Expected ndkVersion to be set for Android targets"); @@ -161,12 +161,12 @@ export function getTargetEnvironmentVariables({ ANDROID_HOME && fs.existsSync(ANDROID_HOME), `Missing ANDROID_HOME environment variable`, { - instructions: "Set ANDROID_HOME to the Android SDK directory" - } + instructions: "Set ANDROID_HOME to the Android SDK directory", + }, ); const ndkPath = path.join(ANDROID_HOME, "ndk", ndkVersion); assertFixable(fs.existsSync(ndkPath), `Expected NDK at ${ndkPath}`, { - command: `sdkmanager --install "ndk;${ndkVersion}"` + command: `sdkmanager --install "ndk;${ndkVersion}"`, }); const toolchainBinPath = getLLVMToolchainBinPath(ndkPath); @@ -181,42 +181,42 @@ export function getTargetEnvironmentVariables({ "-L", weakNodeApiPath, "-l", - "weak-node-api" + "weak-node-api", ].join(String.fromCharCode(0x1f)), CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( toolchainBinPath, - `aarch64-linux-android${androidApiLevel}-clang${cmdMaybe}` + `aarch64-linux-android${androidApiLevel}-clang${cmdMaybe}`, ), CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER: joinPathAndAssertExistence( toolchainBinPath, - `armv7a-linux-androideabi${androidApiLevel}-clang${cmdMaybe}` + `armv7a-linux-androideabi${androidApiLevel}-clang${cmdMaybe}`, ), CARGO_TARGET_X86_64_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( toolchainBinPath, - `x86_64-linux-android${androidApiLevel}-clang${cmdMaybe}` + `x86_64-linux-android${androidApiLevel}-clang${cmdMaybe}`, ), CARGO_TARGET_I686_LINUX_ANDROID_LINKER: joinPathAndAssertExistence( toolchainBinPath, - `i686-linux-android${androidApiLevel}-clang${cmdMaybe}` + `i686-linux-android${androidApiLevel}-clang${cmdMaybe}`, ), TARGET_CC: joinPathAndAssertExistence( toolchainBinPath, - `${targetArch}-linux-${targetPlatform}-clang${cmdMaybe}` + `${targetArch}-linux-${targetPlatform}-clang${cmdMaybe}`, ), TARGET_CXX: joinPathAndAssertExistence( toolchainBinPath, - `${targetArch}-linux-${targetPlatform}-clang++${cmdMaybe}` + `${targetArch}-linux-${targetPlatform}-clang++${cmdMaybe}`, ), TARGET_AR: joinPathAndAssertExistence( toolchainBinPath, - `llvm-ar${exeMaybe}` + `llvm-ar${exeMaybe}`, ), TARGET_RANLIB: joinPathAndAssertExistence( toolchainBinPath, - `llvm-ranlib${exeMaybe}` + `llvm-ranlib${exeMaybe}`, ), ANDROID_NDK: ndkPath, - PATH: `${toolchainBinPath}:${process.env.PATH}` + PATH: `${toolchainBinPath}:${process.env.PATH}`, }; } else if (isAppleTarget(target)) { const weakNodeApiFrameworkPath = getWeakNodeApiFrameworkPath(target); @@ -225,8 +225,8 @@ export function getTargetEnvironmentVariables({ "-L", `framework=${weakNodeApiFrameworkPath}`, "-l", - "framework=weak-node-api" - ].join(String.fromCharCode(0x1f)) + "framework=weak-node-api", + ].join(String.fromCharCode(0x1f)), }; } else { throw new Error(`Unexpected target: ${target}`); From 674a7615e0d6365a3db386886779537b2d7ef7ca Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Sat, 26 Jul 2025 10:38:25 -0300 Subject: [PATCH 09/10] added changeset --- .changeset/tired-news-sort.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/tired-news-sort.md diff --git a/.changeset/tired-news-sort.md b/.changeset/tired-news-sort.md new file mode 100644 index 00000000..fe10f0f7 --- /dev/null +++ b/.changeset/tired-news-sort.md @@ -0,0 +1,6 @@ +--- +"ferric-cli": patch +--- + +- Add path as arg to build project. +- Changed default build output to send to dist folder. From 263a1f01221f00197299861573402e9808b69186 Mon Sep 17 00:00:00 2001 From: Douglas Galdino Date: Sat, 26 Jul 2025 12:05:52 -0300 Subject: [PATCH 10/10] fixed some paths --- eslint.config.js | 2 +- packages/ferric-example/package.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eslint.config.js b/eslint.config.js index 9b1b463e..108c3abe 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -12,7 +12,7 @@ export default tseslint.config( "apps/test-app/ios/**", "packages/host/hermes/**", "packages/node-addon-examples/examples/**", - "packages/ferric-example/ferric_example.d.ts", + "packages/ferric-example/dist/ferric_example.d.ts", ]), eslint.configs.recommended, tseslint.configs.recommended, diff --git a/packages/ferric-example/package.json b/packages/ferric-example/package.json index 2365f4e5..272aca7b 100644 --- a/packages/ferric-example/package.json +++ b/packages/ferric-example/package.json @@ -9,8 +9,8 @@ "url": "git+https://github.com/callstackincubator/react-native-node-api.git", "directory": "packages/ferric-example" }, - "main": "ferric_example.js", - "types": "ferric_example.d.ts", + "main": "dist/ferric_example.js", + "types": "dist/ferric_example.d.ts", "scripts": { "build": "ferric build", "bootstrap": "npm run build"