diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7efefdaec4..3b9985f3fa 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -8,7 +8,7 @@ jobs: - uses: actions/setup-node@v2.1.2 with: - node-version: '16' + node-version: '20.11' - run: yarn - run: yarn lint:check diff --git a/jest.config.js b/jest.config.js deleted file mode 100644 index 9f2eb74d3c..0000000000 --- a/jest.config.js +++ /dev/null @@ -1,188 +0,0 @@ -// For a detailed explanation regarding each configuration property, visit: -// https://jestjs.io/docs/en/configuration.html - -module.exports = { - // All imported modules in your tests should be mocked automatically - // automock: false, - - // Stop running tests after `n` failures - // bail: 0, - - // Respect "browser" field in package.json when resolving modules - // browser: false, - - // The directory where Jest should store its cached dependency information - // cacheDirectory: "/tmp/jest_rs", - - // Automatically clear mock calls and instances between every test - clearMocks: true, - - // Indicates whether the coverage information should be collected while executing the test - collectCoverage: true, - - // An array of glob patterns indicating a set of files for which coverage information should be collected - // collectCoverageFrom: null, - - // The directory where Jest should output its coverage files - coverageDirectory: "./test/coverage", - - // An array of regexp pattern strings used to skip coverage collection - // coveragePathIgnorePatterns: [ - // "/node_modules/" - // ], - - // A list of reporter names that Jest uses when writing coverage reports - // coverageReporters: [ - // "json", - // "text", - // "lcov", - // "clover" - // ], - - // An object that configures minimum threshold enforcement for coverage results - // coverageThreshold: null, - - // A path to a custom dependency extractor - // dependencyExtractor: null, - - // Make calling deprecated APIs throw helpful error messages - // errorOnDeprecated: false, - - // Force coverage collection from ignored files using an array of glob patterns - // forceCoverageMatch: [], - - // A path to a module which exports an async function that is triggered once before all test suites - // globalSetup: null, - - // A path to a module which exports an async function that is triggered once after all test suites - // globalTeardown: null, - - // A set of global variables that need to be available in all test environments - // globals: {}, - - // The maximum amount of workers used to run your tests. Can be specified as % or a number. E.g. maxWorkers: 10% will use 10% of your CPU amount + 1 as the maximum worker number. maxWorkers: 2 will use a maximum of 2 workers. - // maxWorkers: "50%", - - // An array of directory names to be searched recursively up from the requiring module's location - // moduleDirectories: [ - // "node_modules" - // ], - - // An array of file extensions your modules use - // moduleFileExtensions: [ - // "js", - // "json", - // "jsx", - // "ts", - // "tsx", - // "node" - // ], - - // A map from regular expressions to module names that allow to stub out resources with a single module - // moduleNameMapper: {}, - - // An array of regexp pattern strings, matched against all module paths before considered 'visible' to the module loader - // modulePathIgnorePatterns: [], - - // Activates notifications for test results - // notify: false, - - // An enum that specifies notification mode. Requires { notify: true } - // notifyMode: "failure-change", - - // A preset that is used as a base for Jest's configuration - preset: "ts-jest", - - // Run tests from one or more projects - // projects: null, - - // Use this configuration option to add custom reporters to Jest - // reporters: undefined, - - // Automatically reset mock state between every test - resetMocks: true, - - // Reset the module registry before running each individual test - resetModules: true, - - // A path to a custom resolver - // resolver: null, - - // Automatically restore mock state between every test - // restoreMocks: false, - - // The root directory that Jest should scan for tests and modules within - // rootDir: null, - - // A list of paths to directories that Jest should use to search for files in - // roots: [ - // "" - // ], - - // Allows you to use a custom runner instead of Jest's default test runner - // runner: "jest-runner", - - // The paths to modules that run some code to configure or set up the testing environment before each test - // setupFiles: [], - - // A list of paths to modules that run some code to configure or set up the testing framework before each test - // setupFilesAfterEnv: [], - - // A list of paths to snapshot serializer modules Jest should use for snapshot testing - // snapshotSerializers: [], - - // The test environment that will be used for testing - testEnvironment: "node", - - // Options that will be passed to the testEnvironment - // testEnvironmentOptions: {}, - - // Adds a location field to test results - // testLocationInResults: false, - - // The glob patterns Jest uses to detect test files - // testMatch: [ - // "**/__tests__/**/*.[jt]s?(x)", - // "**/?(*.)+(spec|test).[tj]s?(x)" - // ], - - // An array of regexp pattern strings that are matched against all test paths, matched tests are skipped - // testPathIgnorePatterns: [ - // "/node_modules/" - // ], - - // The regexp pattern or array of patterns that Jest uses to detect test files - // testRegex: [], - - // This option allows the use of a custom results processor - // testResultsProcessor: null, - - // This option allows use of a custom test runner - // testRunner: "jasmine2", - - // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href - // testURL: "http://localhost", - - // Setting this value to "fake" allows the use of fake timers for functions such as "setTimeout" - // timers: "real", - - // A map from regular expressions to paths to transformers - // transform: null, - - // An array of regexp pattern strings that are matched against all source file paths, matched files will skip transformation - // transformIgnorePatterns: [ - // "/node_modules/" - // ], - - // An array of regexp pattern strings that are matched against all modules before the module loader will automatically return a mock for them - // unmockedModulePathPatterns: undefined, - - // Indicates whether each individual test should be reported during the run - // verbose: null, - - // An array of regexp patterns that are matched against all source file paths before re-running tests in watch mode - // watchPathIgnorePatterns: [], - - // Whether to use watchman for file crawling - // watchman: true, -}; diff --git a/package.json b/package.json index d08c2bbdd6..463d74e507 100644 --- a/package.json +++ b/package.json @@ -1,31 +1,37 @@ { "name": "witnet-radon-js", - "version": "0.11.0", + "version": "1.0.0", "description": "", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", + "type": "module", "files": [ "dist/**/*" ], + "exports": { + ".": "./dist/src/index.js" + }, "scripts": { "build": "tsc -p tsconfig.build.json", "lint": "prettier --write '{src,test}/**/*.{t,j}s'", "lint:check": "prettier --check '{src,test}/**/*.{t,j}s'", - "test": "jest", + "test": "vitest", "prepare": "npm run build" }, - "keywords": ["radon", "witnet"], + "keywords": [ + "radon", + "witnet" + ], "author": "Witnet Foundation ", "license": "GPL-3.0", "devDependencies": { - "@types/jest": "latest", - "jest": "latest", - "ts-jest": "latest", - "typescript": "latest" + "typescript": "latest", + "vitest": "^1.2.2" }, "dependencies": { + "@types/node": "^20.11.10", "json5": "2.2.3", - "prettier": "2.8.8", + "prettier": "3.2.4", "rosetta": "1.1.0" }, "repository": { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000000..1ed54da92e --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,953 @@ +lockfileVersion: '6.0' + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false + +dependencies: + '@types/node': + specifier: ^20.11.10 + version: 20.11.10 + json5: + specifier: 2.2.3 + version: 2.2.3 + prettier: + specifier: 3.2.4 + version: 3.2.4 + rosetta: + specifier: 1.1.0 + version: 1.1.0 + +devDependencies: + typescript: + specifier: latest + version: 5.2.2 + vitest: + specifier: ^1.2.2 + version: 1.2.2(@types/node@20.11.10) + +packages: + + /@esbuild/aix-ppc64@0.19.12: + resolution: {integrity: sha512-bmoCYyWdEL3wDQIVbcyzRyeKLgk2WtWLTWz1ZIAZF/EGbNOwSA6ew3PftJ1PqMiOOGu0OyFMzG53L0zqIpPeNA==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [aix] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm64@0.19.12: + resolution: {integrity: sha512-P0UVNGIienjZv3f5zq0DP3Nt2IE/3plFzuaS96vihvD0Hd6H/q4WXUGpCxD/E8YrSXfNyRPbpTq+T8ZQioSuPA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-arm@0.19.12: + resolution: {integrity: sha512-qg/Lj1mu3CdQlDEEiWrlC4eaPZ1KztwGJ9B6J+/6G+/4ewxJg7gqj8eVYWvao1bXrqGiW2rsBZFSX3q2lcW05w==} + engines: {node: '>=12'} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/android-x64@0.19.12: + resolution: {integrity: sha512-3k7ZoUW6Q6YqhdhIaq/WZ7HwBpnFBlW905Fa4s4qWJyiNOgT1dOqDiVAQFwBH7gBRZr17gLrlFCRzF6jFh7Kew==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-arm64@0.19.12: + resolution: {integrity: sha512-B6IeSgZgtEzGC42jsI+YYu9Z3HKRxp8ZT3cqhvliEHovq8HSX2YX8lNocDn79gCKJXOSaEot9MVYky7AKjCs8g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/darwin-x64@0.19.12: + resolution: {integrity: sha512-hKoVkKzFiToTgn+41qGhsUJXFlIjxI/jSYeZf3ugemDYZldIXIxhvwN6erJGlX4t5h417iFuheZ7l+YVn05N3A==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-arm64@0.19.12: + resolution: {integrity: sha512-4aRvFIXmwAcDBw9AueDQ2YnGmz5L6obe5kmPT8Vd+/+x/JMVKCgdcRwH6APrbpNXsPz+K653Qg8HB/oXvXVukA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/freebsd-x64@0.19.12: + resolution: {integrity: sha512-EYoXZ4d8xtBoVN7CEwWY2IN4ho76xjYXqSXMNccFSx2lgqOG/1TBPW0yPx1bJZk94qu3tX0fycJeeQsKovA8gg==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm64@0.19.12: + resolution: {integrity: sha512-EoTjyYyLuVPfdPLsGVVVC8a0p1BFFvtpQDB/YLEhaXyf/5bczaGeN15QkR+O4S5LeJ92Tqotve7i1jn35qwvdA==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-arm@0.19.12: + resolution: {integrity: sha512-J5jPms//KhSNv+LO1S1TX1UWp1ucM6N6XuL6ITdKWElCu8wXP72l9MM0zDTzzeikVyqFE6U8YAV9/tFyj0ti+w==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ia32@0.19.12: + resolution: {integrity: sha512-Thsa42rrP1+UIGaWz47uydHSBOgTUnwBwNq59khgIwktK6x60Hivfbux9iNR0eHCHzOLjLMLfUMLCypBkZXMHA==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-loong64@0.19.12: + resolution: {integrity: sha512-LiXdXA0s3IqRRjm6rV6XaWATScKAXjI4R4LoDlvO7+yQqFdlr1Bax62sRwkVvRIrwXxvtYEHHI4dm50jAXkuAA==} + engines: {node: '>=12'} + cpu: [loong64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-mips64el@0.19.12: + resolution: {integrity: sha512-fEnAuj5VGTanfJ07ff0gOA6IPsvrVHLVb6Lyd1g2/ed67oU1eFzL0r9WL7ZzscD+/N6i3dWumGE1Un4f7Amf+w==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-ppc64@0.19.12: + resolution: {integrity: sha512-nYJA2/QPimDQOh1rKWedNOe3Gfc8PabU7HT3iXWtNUbRzXS9+vgB0Fjaqr//XNbd82mCxHzik2qotuI89cfixg==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-riscv64@0.19.12: + resolution: {integrity: sha512-2MueBrlPQCw5dVJJpQdUYgeqIzDQgw3QtiAHUC4RBz9FXPrskyyU3VI1hw7C0BSKB9OduwSJ79FTCqtGMWqJHg==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-s390x@0.19.12: + resolution: {integrity: sha512-+Pil1Nv3Umes4m3AZKqA2anfhJiVmNCYkPchwFJNEJN5QxmTs1uzyy4TvmDrCRNT2ApwSari7ZIgrPeUx4UZDg==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/linux-x64@0.19.12: + resolution: {integrity: sha512-B71g1QpxfwBvNrfyJdVDexenDIt1CiDN1TIXLbhOw0KhJzE78KIFGX6OJ9MrtC0oOqMWf+0xop4qEU8JrJTwCg==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@esbuild/netbsd-x64@0.19.12: + resolution: {integrity: sha512-3ltjQ7n1owJgFbuC61Oj++XhtzmymoCihNFgT84UAmJnxJfm4sYCiSLTXZtE00VWYpPMYc+ZQmB6xbSdVh0JWA==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/openbsd-x64@0.19.12: + resolution: {integrity: sha512-RbrfTB9SWsr0kWmb9srfF+L933uMDdu9BIzdA7os2t0TXhCRjrQyCeOt6wVxr79CKD4c+p+YhCj31HBkYcXebw==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + + /@esbuild/sunos-x64@0.19.12: + resolution: {integrity: sha512-HKjJwRrW8uWtCQnQOz9qcU3mUZhTUQvi56Q8DPTLLB+DawoiQdjsYq+j+D3s9I8VFtDr+F9CjgXKKC4ss89IeA==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-arm64@0.19.12: + resolution: {integrity: sha512-URgtR1dJnmGvX864pn1B2YUYNzjmXkuJOIqG2HdU62MVS4EHpU2946OZoTMnRUHklGtJdJZ33QfzdjGACXhn1A==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-ia32@0.19.12: + resolution: {integrity: sha512-+ZOE6pUkMOJfmxmBZElNOx72NKpIa/HFOMGzu8fqzQJ5kgf6aTGrcJaFsNiVMH4JKpMipyK+7k0n2UXN7a8YKQ==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@esbuild/win32-x64@0.19.12: + resolution: {integrity: sha512-T1QyPSDCyMXaO3pzBkF96E8xMkiRYbUEZADd29SyPGabqxMViNoii+NcK7eWJAEoU6RZyEm5lVSIjTmcdoB9HA==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@jest/schemas@29.6.3: + resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@sinclair/typebox': 0.27.8 + dev: true + + /@jridgewell/sourcemap-codec@1.4.15: + resolution: {integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==} + dev: true + + /@rollup/rollup-android-arm-eabi@4.9.6: + resolution: {integrity: sha512-MVNXSSYN6QXOulbHpLMKYi60ppyO13W9my1qogeiAqtjb2yR4LSmfU2+POvDkLzhjYLXz9Rf9+9a3zFHW1Lecg==} + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-android-arm64@4.9.6: + resolution: {integrity: sha512-T14aNLpqJ5wzKNf5jEDpv5zgyIqcpn1MlwCrUXLrwoADr2RkWA0vOWP4XxbO9aiO3dvMCQICZdKeDrFl7UMClw==} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-arm64@4.9.6: + resolution: {integrity: sha512-CqNNAyhRkTbo8VVZ5R85X73H3R5NX9ONnKbXuHisGWC0qRbTTxnF1U4V9NafzJbgGM0sHZpdO83pLPzq8uOZFw==} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-x64@4.9.6: + resolution: {integrity: sha512-zRDtdJuRvA1dc9Mp6BWYqAsU5oeLixdfUvkTHuiYOHwqYuQ4YgSmi6+/lPvSsqc/I0Omw3DdICx4Tfacdzmhog==} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-gnueabihf@4.9.6: + resolution: {integrity: sha512-oNk8YXDDnNyG4qlNb6is1ojTOGL/tRhbbKeE/YuccItzerEZT68Z9gHrY3ROh7axDc974+zYAPxK5SH0j/G+QQ==} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.9.6: + resolution: {integrity: sha512-Z3O60yxPtuCYobrtzjo0wlmvDdx2qZfeAWTyfOjEDqd08kthDKexLpV97KfAeUXPosENKd8uyJMRDfFMxcYkDQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-musl@4.9.6: + resolution: {integrity: sha512-gpiG0qQJNdYEVad+1iAsGAbgAnZ8j07FapmnIAQgODKcOTjLEWM9sRb+MbQyVsYCnA0Im6M6QIq6ax7liws6eQ==} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.9.6: + resolution: {integrity: sha512-+uCOcvVmFUYvVDr27aiyun9WgZk0tXe7ThuzoUTAukZJOwS5MrGbmSlNOhx1j80GdpqbOty05XqSl5w4dQvcOA==} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.9.6: + resolution: {integrity: sha512-HUNqM32dGzfBKuaDUBqFB7tP6VMN74eLZ33Q9Y1TBqRDn+qDonkAUyKWwF9BR9unV7QUzffLnz9GrnKvMqC/fw==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-musl@4.9.6: + resolution: {integrity: sha512-ch7M+9Tr5R4FK40FHQk8VnML0Szi2KRujUgHXd/HjuH9ifH72GUmw6lStZBo3c3GB82vHa0ZoUfjfcM7JiiMrQ==} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.9.6: + resolution: {integrity: sha512-VD6qnR99dhmTQ1mJhIzXsRcTBvTjbfbGGwKAHcu+52cVl15AC/kplkhxzW/uT0Xl62Y/meBKDZvoJSJN+vTeGA==} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.9.6: + resolution: {integrity: sha512-J9AFDq/xiRI58eR2NIDfyVmTYGyIZmRcvcAoJ48oDld/NTR8wyiPUu2X/v1navJ+N/FGg68LEbX3Ejd6l8B7MQ==} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-x64-msvc@4.9.6: + resolution: {integrity: sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ==} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@sinclair/typebox@0.27.8: + resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} + dev: true + + /@types/estree@1.0.5: + resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + dev: true + + /@types/node@20.11.10: + resolution: {integrity: sha512-rZEfe/hJSGYmdfX9tvcPMYeYPW2sNl50nsw4jZmRcaG0HIAb0WYEpsB05GOb53vjqpyE9GUhlDQ4jLSoB5q9kg==} + dependencies: + undici-types: 5.26.5 + + /@vitest/expect@1.2.2: + resolution: {integrity: sha512-3jpcdPAD7LwHUUiT2pZTj2U82I2Tcgg2oVPvKxhn6mDI2On6tfvPQTjAI4628GUGDZrCm4Zna9iQHm5cEexOAg==} + dependencies: + '@vitest/spy': 1.2.2 + '@vitest/utils': 1.2.2 + chai: 4.4.1 + dev: true + + /@vitest/runner@1.2.2: + resolution: {integrity: sha512-JctG7QZ4LSDXr5CsUweFgcpEvrcxOV1Gft7uHrvkQ+fsAVylmWQvnaAr/HDp3LAH1fztGMQZugIheTWjaGzYIg==} + dependencies: + '@vitest/utils': 1.2.2 + p-limit: 5.0.0 + pathe: 1.1.2 + dev: true + + /@vitest/snapshot@1.2.2: + resolution: {integrity: sha512-SmGY4saEw1+bwE1th6S/cZmPxz/Q4JWsl7LvbQIky2tKE35US4gd0Mjzqfr84/4OD0tikGWaWdMja/nWL5NIPA==} + dependencies: + magic-string: 0.30.5 + pathe: 1.1.2 + pretty-format: 29.7.0 + dev: true + + /@vitest/spy@1.2.2: + resolution: {integrity: sha512-k9Gcahssw8d7X3pSLq3e3XEu/0L78mUkCjivUqCQeXJm9clfXR/Td8+AP+VC1O6fKPIDLcHDTAmBOINVuv6+7g==} + dependencies: + tinyspy: 2.2.0 + dev: true + + /@vitest/utils@1.2.2: + resolution: {integrity: sha512-WKITBHLsBHlpjnDQahr+XK6RE7MiAsgrIkr0pGhQ9ygoxBfUeG0lUG5iLlzqjmKSlBv3+j5EGsriBzh+C3Tq9g==} + dependencies: + diff-sequences: 29.6.3 + estree-walker: 3.0.3 + loupe: 2.3.7 + pretty-format: 29.7.0 + dev: true + + /acorn-walk@8.3.2: + resolution: {integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==} + engines: {node: '>=0.4.0'} + dev: true + + /acorn@8.11.3: + resolution: {integrity: sha512-Y9rRfJG5jcKOE0CLisYbojUjIrIEE7AGMzA/Sm4BslANhbS+cDMpgBdcPT91oJ7OuJ9hYJBx59RjbhxVnrF8Xg==} + engines: {node: '>=0.4.0'} + hasBin: true + dev: true + + /ansi-styles@5.2.0: + resolution: {integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==} + engines: {node: '>=10'} + dev: true + + /assertion-error@1.1.0: + resolution: {integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==} + dev: true + + /cac@6.7.14: + resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} + engines: {node: '>=8'} + dev: true + + /chai@4.4.1: + resolution: {integrity: sha512-13sOfMv2+DWduEU+/xbun3LScLoqN17nBeTLUsmDfKdoiC1fr0n9PU4guu4AhRcOVFk/sW8LyZWHuhWtQZiF+g==} + engines: {node: '>=4'} + dependencies: + assertion-error: 1.1.0 + check-error: 1.0.3 + deep-eql: 4.1.3 + get-func-name: 2.0.2 + loupe: 2.3.7 + pathval: 1.1.1 + type-detect: 4.0.8 + dev: true + + /check-error@1.0.3: + resolution: {integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==} + dependencies: + get-func-name: 2.0.2 + dev: true + + /cross-spawn@7.0.3: + resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==} + engines: {node: '>= 8'} + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + dev: true + + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + dev: true + + /deep-eql@4.1.3: + resolution: {integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==} + engines: {node: '>=6'} + dependencies: + type-detect: 4.0.8 + dev: true + + /diff-sequences@29.6.3: + resolution: {integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dev: true + + /dlv@1.1.3: + resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==} + dev: false + + /esbuild@0.19.12: + resolution: {integrity: sha512-aARqgq8roFBj054KvQr5f1sFu0D65G+miZRCuJyJ0G13Zwx7vRar5Zhn2tkQNzIXcBrNVsv/8stehpj+GAjgbg==} + engines: {node: '>=12'} + hasBin: true + requiresBuild: true + optionalDependencies: + '@esbuild/aix-ppc64': 0.19.12 + '@esbuild/android-arm': 0.19.12 + '@esbuild/android-arm64': 0.19.12 + '@esbuild/android-x64': 0.19.12 + '@esbuild/darwin-arm64': 0.19.12 + '@esbuild/darwin-x64': 0.19.12 + '@esbuild/freebsd-arm64': 0.19.12 + '@esbuild/freebsd-x64': 0.19.12 + '@esbuild/linux-arm': 0.19.12 + '@esbuild/linux-arm64': 0.19.12 + '@esbuild/linux-ia32': 0.19.12 + '@esbuild/linux-loong64': 0.19.12 + '@esbuild/linux-mips64el': 0.19.12 + '@esbuild/linux-ppc64': 0.19.12 + '@esbuild/linux-riscv64': 0.19.12 + '@esbuild/linux-s390x': 0.19.12 + '@esbuild/linux-x64': 0.19.12 + '@esbuild/netbsd-x64': 0.19.12 + '@esbuild/openbsd-x64': 0.19.12 + '@esbuild/sunos-x64': 0.19.12 + '@esbuild/win32-arm64': 0.19.12 + '@esbuild/win32-ia32': 0.19.12 + '@esbuild/win32-x64': 0.19.12 + dev: true + + /estree-walker@3.0.3: + resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} + dependencies: + '@types/estree': 1.0.5 + dev: true + + /execa@8.0.1: + resolution: {integrity: sha512-VyhnebXciFV2DESc+p6B+y0LjSm0krU4OgJN44qFAhBY0TJ+1V61tYD2+wHusZ6F9n5K+vl8k0sTy7PEfV4qpg==} + engines: {node: '>=16.17'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 8.0.1 + human-signals: 5.0.0 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.2.0 + onetime: 6.0.0 + signal-exit: 4.1.0 + strip-final-newline: 3.0.0 + dev: true + + /fsevents@2.3.3: + resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} + engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /get-func-name@2.0.2: + resolution: {integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==} + dev: true + + /get-stream@8.0.1: + resolution: {integrity: sha512-VaUJspBffn/LMCJVoMvSAdmscJyS1auj5Zulnn5UoYcY531UWmdwhRWkcGKnGU93m5HSXP9LP2usOryrBtQowA==} + engines: {node: '>=16'} + dev: true + + /human-signals@5.0.0: + resolution: {integrity: sha512-AXcZb6vzzrFAUE61HnN4mpLqd/cSIwNQjtNWR0euPm6y0iqx3G4gOXaIDdtdDwZmhwe82LA6+zinmW4UBWVePQ==} + engines: {node: '>=16.17.0'} + dev: true + + /is-stream@3.0.0: + resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + + /isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + dev: true + + /json5@2.2.3: + resolution: {integrity: sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==} + engines: {node: '>=6'} + hasBin: true + dev: false + + /jsonc-parser@3.2.1: + resolution: {integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==} + dev: true + + /local-pkg@0.5.0: + resolution: {integrity: sha512-ok6z3qlYyCDS4ZEU27HaU6x/xZa9Whf8jD4ptH5UZTQYZVYeb9bnZ3ojVhiJNLiXK1Hfc0GNbLXcmZ5plLDDBg==} + engines: {node: '>=14'} + dependencies: + mlly: 1.5.0 + pkg-types: 1.0.3 + dev: true + + /loupe@2.3.7: + resolution: {integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==} + dependencies: + get-func-name: 2.0.2 + dev: true + + /magic-string@0.30.5: + resolution: {integrity: sha512-7xlpfBaQaP/T6Vh8MO/EqXSW5En6INHEvEXQiuff7Gku0PWjU3uf6w/j9o7O+SpB5fOAkrI5HeoNgwjEO0pFsA==} + engines: {node: '>=12'} + dependencies: + '@jridgewell/sourcemap-codec': 1.4.15 + dev: true + + /merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + dev: true + + /mimic-fn@4.0.0: + resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} + engines: {node: '>=12'} + dev: true + + /mlly@1.5.0: + resolution: {integrity: sha512-NPVQvAY1xr1QoVeG0cy8yUYC7FQcOx6evl/RjT1wL5FvzPnzOysoqB/jmx/DhssT2dYa8nxECLAaFI/+gVLhDQ==} + dependencies: + acorn: 8.11.3 + pathe: 1.1.2 + pkg-types: 1.0.3 + ufo: 1.3.2 + dev: true + + /ms@2.1.2: + resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} + dev: true + + /nanoid@3.3.7: + resolution: {integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==} + engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} + hasBin: true + dev: true + + /npm-run-path@5.2.0: + resolution: {integrity: sha512-W4/tgAXFqFA0iL7fk0+uQ3g7wkL8xJmx3XdK0VGb4cHW//eZTtKGvFBBoRKVTpY7n6ze4NL9ly7rgXcHufqXKg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + path-key: 4.0.0 + dev: true + + /onetime@6.0.0: + resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} + engines: {node: '>=12'} + dependencies: + mimic-fn: 4.0.0 + dev: true + + /p-limit@5.0.0: + resolution: {integrity: sha512-/Eaoq+QyLSiXQ4lyYV23f14mZRQcXnxfHrN0vCai+ak9G0pp9iEQukIIZq5NccEvwRB8PUnZT0KsOoDCINS1qQ==} + engines: {node: '>=18'} + dependencies: + yocto-queue: 1.0.0 + dev: true + + /path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + dev: true + + /path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + dev: true + + /pathe@1.1.2: + resolution: {integrity: sha512-whLdWMYL2TwI08hn8/ZqAbrVemu0LNaNNJZX73O6qaIdCTfXutsLhMkjdENX0qhsQ9uIimo4/aQOmXkoon2nDQ==} + dev: true + + /pathval@1.1.1: + resolution: {integrity: sha512-Dp6zGqpTdETdR63lehJYPeIOqpiNBNtc7BpWSLrOje7UaIsE5aY92r/AunQA7rsXvet3lrJ3JnZX29UPTKXyKQ==} + dev: true + + /picocolors@1.0.0: + resolution: {integrity: sha512-1fygroTLlHu66zi26VoTDv8yRgm0Fccecssto+MhsZ0D/DGW2sm8E8AjW7NU5VVTRt5GxbeZ5qBuJr+HyLYkjQ==} + dev: true + + /pkg-types@1.0.3: + resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} + dependencies: + jsonc-parser: 3.2.1 + mlly: 1.5.0 + pathe: 1.1.2 + dev: true + + /postcss@8.4.33: + resolution: {integrity: sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: true + + /prettier@3.2.4: + resolution: {integrity: sha512-FWu1oLHKCrtpO1ypU6J0SbK2d9Ckwysq6bHj/uaCP26DxrPpppCLQRGVuqAxSTvhF00AcvDRyYrLNW7ocBhFFQ==} + engines: {node: '>=14'} + hasBin: true + dev: false + + /pretty-format@29.7.0: + resolution: {integrity: sha512-Pdlw/oPxN+aXdmM9R00JVC9WVFoCLTKJvDVLgmJ+qAffBMxsV85l/Lu7sNx4zSzPyoL2euImuEwHhOXdEgNFZQ==} + engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} + dependencies: + '@jest/schemas': 29.6.3 + ansi-styles: 5.2.0 + react-is: 18.2.0 + dev: true + + /react-is@18.2.0: + resolution: {integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==} + dev: true + + /rollup@4.9.6: + resolution: {integrity: sha512-05lzkCS2uASX0CiLFybYfVkwNbKZG5NFQ6Go0VWyogFTXXbR039UVsegViTntkk4OglHBdF54ccApXRRuXRbsg==} + engines: {node: '>=18.0.0', npm: '>=8.0.0'} + hasBin: true + dependencies: + '@types/estree': 1.0.5 + optionalDependencies: + '@rollup/rollup-android-arm-eabi': 4.9.6 + '@rollup/rollup-android-arm64': 4.9.6 + '@rollup/rollup-darwin-arm64': 4.9.6 + '@rollup/rollup-darwin-x64': 4.9.6 + '@rollup/rollup-linux-arm-gnueabihf': 4.9.6 + '@rollup/rollup-linux-arm64-gnu': 4.9.6 + '@rollup/rollup-linux-arm64-musl': 4.9.6 + '@rollup/rollup-linux-riscv64-gnu': 4.9.6 + '@rollup/rollup-linux-x64-gnu': 4.9.6 + '@rollup/rollup-linux-x64-musl': 4.9.6 + '@rollup/rollup-win32-arm64-msvc': 4.9.6 + '@rollup/rollup-win32-ia32-msvc': 4.9.6 + '@rollup/rollup-win32-x64-msvc': 4.9.6 + fsevents: 2.3.3 + dev: true + + /rosetta@1.1.0: + resolution: {integrity: sha512-3jQaCo2ySoDqLIPjy7+AvN3rluLfkG8A27hg0virL0gRAB5BJ3V35IBdkL/t6k1dGK0TVTyUEwXVUJsygyx4pA==} + engines: {node: '>=8'} + dependencies: + dlv: 1.1.3 + templite: 1.2.0 + dev: false + + /shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + dependencies: + shebang-regex: 3.0.0 + dev: true + + /shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + dev: true + + /siginfo@2.0.0: + resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} + dev: true + + /signal-exit@4.1.0: + resolution: {integrity: sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==} + engines: {node: '>=14'} + dev: true + + /source-map-js@1.0.2: + resolution: {integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==} + engines: {node: '>=0.10.0'} + dev: true + + /stackback@0.0.2: + resolution: {integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==} + dev: true + + /std-env@3.7.0: + resolution: {integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==} + dev: true + + /strip-final-newline@3.0.0: + resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} + engines: {node: '>=12'} + dev: true + + /strip-literal@1.3.0: + resolution: {integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==} + dependencies: + acorn: 8.11.3 + dev: true + + /templite@1.2.0: + resolution: {integrity: sha512-O9BpPXF44a9Pg84Be6mjzlrqOtbP2I/B5PNLWu5hb1n9UQ1GTLsjdMg1z5ROCkF6NFXsO5LQfRXEpgTGrZ7Q0Q==} + dev: false + + /tinybench@2.6.0: + resolution: {integrity: sha512-N8hW3PG/3aOoZAN5V/NSAEDz0ZixDSSt5b/a05iqtpgfLWMSVuCo7w0k2vVvEjdrIoeGqZzweX2WlyioNIHchA==} + dev: true + + /tinypool@0.8.2: + resolution: {integrity: sha512-SUszKYe5wgsxnNOVlBYO6IC+8VGWdVGZWAqUxp3UErNBtptZvWbwyUOyzNL59zigz2rCA92QiL3wvG+JDSdJdQ==} + engines: {node: '>=14.0.0'} + dev: true + + /tinyspy@2.2.0: + resolution: {integrity: sha512-d2eda04AN/cPOR89F7Xv5bK/jrQEhmcLFe6HFldoeO9AJtps+fqEnh486vnT/8y4bw38pSyxDcTCAq+Ks2aJTg==} + engines: {node: '>=14.0.0'} + dev: true + + /type-detect@4.0.8: + resolution: {integrity: sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==} + engines: {node: '>=4'} + dev: true + + /typescript@5.2.2: + resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} + engines: {node: '>=14.17'} + hasBin: true + dev: true + + /ufo@1.3.2: + resolution: {integrity: sha512-o+ORpgGwaYQXgqGDwd+hkS4PuZ3QnmqMMxRuajK/a38L6fTpcE5GPIfrf+L/KemFzfUpeUQc1rRS1iDBozvnFA==} + dev: true + + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + + /vite-node@1.2.2(@types/node@20.11.10): + resolution: {integrity: sha512-1as4rDTgVWJO3n1uHmUYqq7nsFgINQ9u+mRcXpjeOMJUmviqNKjcZB7UfRZrlM7MjYXMKpuWp5oGkjaFLnjawg==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + dependencies: + cac: 6.7.14 + debug: 4.3.4 + pathe: 1.1.2 + picocolors: 1.0.0 + vite: 5.0.12(@types/node@20.11.10) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + + /vite@5.0.12(@types/node@20.11.10): + resolution: {integrity: sha512-4hsnEkG3q0N4Tzf1+t6NdN9dg/L3BM+q8SWgbSPnJvrgH2kgdyzfVJwbR1ic69/4uMJJ/3dqDZZE5/WwqW8U1w==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@types/node': ^18.0.0 || >=20.0.0 + less: '*' + lightningcss: ^1.21.0 + sass: '*' + stylus: '*' + sugarss: '*' + terser: ^5.4.0 + peerDependenciesMeta: + '@types/node': + optional: true + less: + optional: true + lightningcss: + optional: true + sass: + optional: true + stylus: + optional: true + sugarss: + optional: true + terser: + optional: true + dependencies: + '@types/node': 20.11.10 + esbuild: 0.19.12 + postcss: 8.4.33 + rollup: 4.9.6 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /vitest@1.2.2(@types/node@20.11.10): + resolution: {integrity: sha512-d5Ouvrnms3GD9USIK36KG8OZ5bEvKEkITFtnGv56HFaSlbItJuYr7hv2Lkn903+AvRAgSixiamozUVfORUekjw==} + engines: {node: ^18.0.0 || >=20.0.0} + hasBin: true + peerDependencies: + '@edge-runtime/vm': '*' + '@types/node': ^18.0.0 || >=20.0.0 + '@vitest/browser': ^1.0.0 + '@vitest/ui': ^1.0.0 + happy-dom: '*' + jsdom: '*' + peerDependenciesMeta: + '@edge-runtime/vm': + optional: true + '@types/node': + optional: true + '@vitest/browser': + optional: true + '@vitest/ui': + optional: true + happy-dom: + optional: true + jsdom: + optional: true + dependencies: + '@types/node': 20.11.10 + '@vitest/expect': 1.2.2 + '@vitest/runner': 1.2.2 + '@vitest/snapshot': 1.2.2 + '@vitest/spy': 1.2.2 + '@vitest/utils': 1.2.2 + acorn-walk: 8.3.2 + cac: 6.7.14 + chai: 4.4.1 + debug: 4.3.4 + execa: 8.0.1 + local-pkg: 0.5.0 + magic-string: 0.30.5 + pathe: 1.1.2 + picocolors: 1.0.0 + std-env: 3.7.0 + strip-literal: 1.3.0 + tinybench: 2.6.0 + tinypool: 0.8.2 + vite: 5.0.12(@types/node@20.11.10) + vite-node: 1.2.2(@types/node@20.11.10) + why-is-node-running: 2.2.2 + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + + /which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + dependencies: + isexe: 2.0.0 + dev: true + + /why-is-node-running@2.2.2: + resolution: {integrity: sha512-6tSwToZxTOcotxHeA+qGCq1mVzKR3CwcJGmVcY+QE8SHy6TnpFnh8PAvPNHYr7EcuVeG0QSMxtYCuO1ta/G/oA==} + engines: {node: '>=8'} + hasBin: true + dependencies: + siginfo: 2.0.0 + stackback: 0.0.2 + dev: true + + /yocto-queue@1.0.0: + resolution: {integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==} + engines: {node: '>=12.20'} + dev: true diff --git a/src/aggregationTallyFilterArgument.ts b/src/aggregationTallyFilterArgument.ts index f9f9061c6e..85a18576ed 100644 --- a/src/aggregationTallyFilterArgument.ts +++ b/src/aggregationTallyFilterArgument.ts @@ -5,7 +5,7 @@ import { MarkupType, MirArgument, Context, -} from './types' +} from './types.js' export class AggregationTallyFilterArgument { public context: Context diff --git a/src/aggregationTallyOperatorFilter.ts b/src/aggregationTallyOperatorFilter.ts index df2a05a9fe..e3d72cba31 100644 --- a/src/aggregationTallyOperatorFilter.ts +++ b/src/aggregationTallyOperatorFilter.ts @@ -6,9 +6,9 @@ import { MirAggregationTallyFilterOperator, OutputType, Context, -} from './types' -import { aggregationTallyFilterDescriptions, aTFilterMarkupOptions } from './structures' -import { AggregationTallyFilterArgument } from './aggregationTallyFilterArgument' +} from './types.js' +import { aggregationTallyFilterDescriptions, aTFilterMarkupOptions } from './structures.js' +import { AggregationTallyFilterArgument } from './aggregationTallyFilterArgument.js' export class AggregationTallyOperatorFilter { public context: Context diff --git a/src/aggregationTallyOperatorReducer.ts b/src/aggregationTallyOperatorReducer.ts index 9eda007aa1..0ae9bef68f 100644 --- a/src/aggregationTallyOperatorReducer.ts +++ b/src/aggregationTallyOperatorReducer.ts @@ -5,12 +5,12 @@ import { MarkupType, OutputType, Context, -} from './types' +} from './types.js' import { aggregationTallyReducerDescriptions, aTReducerMarkupOptions, aTRNGReducerMarkupOptions, -} from './structures' +} from './structures.js' export class AggregationTallyOperatorReducer { public context: Context diff --git a/src/aggregationTallyScript.ts b/src/aggregationTallyScript.ts index c15fed43c1..f726c3142e 100644 --- a/src/aggregationTallyScript.ts +++ b/src/aggregationTallyScript.ts @@ -4,9 +4,9 @@ import { MirAggregationTallyScript, Context, AggregationTallyReducer, -} from './types' -import { AggregationTallyOperatorReducer } from './aggregationTallyOperatorReducer' -import { AggregationTallyOperatorFilter } from './aggregationTallyOperatorFilter' +} from './types.js' +import { AggregationTallyOperatorReducer } from './aggregationTallyOperatorReducer.js' +import { AggregationTallyOperatorFilter } from './aggregationTallyOperatorFilter.js' export class AggregationTallyScript { public context: Context diff --git a/src/argument.ts b/src/argument.ts index 13f2523a56..bc3cb4a0cf 100755 --- a/src/argument.ts +++ b/src/argument.ts @@ -18,10 +18,10 @@ import { Reducer, Context, Kind, -} from './types' -import { DEFAULT_OPERATOR } from './constants' -import { getArgumentInfoType, getEnumNames, getMarkupInputTypeFromArgumentType } from './utils' -import { Script } from './script' +} from './types.js' +import { DEFAULT_OPERATOR } from './constants.js' +import { getArgumentInfoType, getEnumNames, getMarkupInputTypeFromArgumentType } from './utils.js' +import { Script } from './script.js' export class Argument { public argument: Argument | Script | null diff --git a/src/constants.ts b/src/constants.ts index ec681098bf..b5d718d343 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,4 +1,4 @@ -import { OperatorCode, OutputType, Kind } from './types' +import { OperatorCode, OutputType, Kind } from './types.js' export const DEFAULT_OPERATOR = OperatorCode.ArrayCount export const DEFAULT_INPUT_TYPE = OutputType.Array diff --git a/src/i18n.ts b/src/i18n.ts index e3f389017d..47f55bcc0e 100644 --- a/src/i18n.ts +++ b/src/i18n.ts @@ -1,7 +1,8 @@ import rosetta, { Rosetta } from 'rosetta' - -import en from './locales/en.json' -import es from './locales/es.json' +import { createRequire } from 'module' +const require = createRequire(import.meta.url) +const en = require('./locales/en.json') +const es = require('./locales/es.json') export type Locale = 'en' | 'es' diff --git a/src/index.ts b/src/index.ts index e4232db9a9..a40488c4d6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,7 @@ -import { Radon } from './radon' -import { Source } from './source' -import { Script } from './script' -import { Operator } from './operator' +import { Radon } from './radon.js' +import { Source } from './source.js' +import { Script } from './script.js' +import { Operator } from './operator.js' export { Radon, Source, Script, Operator } export default { diff --git a/src/operator.ts b/src/operator.ts index 209f1e6523..191996f819 100755 --- a/src/operator.ts +++ b/src/operator.ts @@ -13,12 +13,12 @@ import { OutputType, MirArgumentType, Filter, -} from './types' -import { operatorInfos, markupOptions, allMarkupOptions } from './structures' -import { getDefaultMirArgumentByType, getMirOperatorInfo } from './utils' -import { Argument } from './argument' -import { DEFAULT_OPERATOR, DEFAULT_INPUT_TYPE } from './constants' -import { MirScript, Context } from './types' +} from './types.js' +import { operatorInfos, markupOptions, allMarkupOptions } from './structures.js' +import { getDefaultMirArgumentByType, getMirOperatorInfo } from './utils.js' +import { Argument } from './argument.js' +import { DEFAULT_OPERATOR, DEFAULT_INPUT_TYPE } from './constants.js' +import { MirScript, Context } from './types.js' export class Operator { public arguments: Array diff --git a/src/radon.ts b/src/radon.ts index 608965774f..a4670f424e 100644 --- a/src/radon.ts +++ b/src/radon.ts @@ -1,13 +1,13 @@ -import { MirRequest, OperatorCode, MarkupRequest, Context, Kind } from './types' -import { KIND_OPTIONS, DEFAULT_KIND_OPTION, CONTENT_TYPE_OPTIONS } from './constants' -import { Cache } from './structures' -import { Source } from './source' -import { AggregationTallyScript } from './aggregationTallyScript' -import { Script } from './script' -import { Operator } from './operator' -import { Argument } from './argument' -import { formatJs } from './utils' -import { I18n, Locale } from './i18n' +import { MirRequest, OperatorCode, MarkupRequest, Context, Kind } from './types.js' +import { KIND_OPTIONS, DEFAULT_KIND_OPTION, CONTENT_TYPE_OPTIONS } from './constants.js' +import { Cache } from './structures.js' +import { Source } from './source.js' +import { AggregationTallyScript } from './aggregationTallyScript.js' +import { Script } from './script.js' +import { Operator } from './operator.js' +import { Argument } from './argument.js' +import { formatJs } from './utils.js' +import { I18n, Locale } from './i18n.js' export class Radon { public timelock: number @@ -92,7 +92,7 @@ export class Radon { this.retrieve.splice(sourceIndex, 1) } - public getJs(): string { + public async getJs(): Promise { const sourcesDeclaration = this.retrieve .map((source, index) => `${source.getJs(index)}`) .join('\n') diff --git a/src/script.ts b/src/script.ts index 2931857353..1fe7897a15 100644 --- a/src/script.ts +++ b/src/script.ts @@ -8,14 +8,14 @@ import { Type, Context, Kind, -} from './types' -import { Operator } from './operator' -import { DEFAULT_SCRIPT_FIRST_TYPE } from './constants' +} from './types.js' +import { Operator } from './operator.js' +import { DEFAULT_SCRIPT_FIRST_TYPE } from './constants.js' import { fromOutputTypeToType, getDefaultMirOperatorByType, areValidConsecutiveOperators, -} from './utils' +} from './utils.js' export class Script { public context: Context diff --git a/src/source.ts b/src/source.ts index 08e6c3319c..d52bf84856 100644 --- a/src/source.ts +++ b/src/source.ts @@ -7,11 +7,11 @@ import { Kind, EventEmitter, ContentTypeOptions, -} from './types' -import { KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from './constants' -import { Cache } from './structures' -import { Script } from './script' -import { I18n } from './i18n' +} from './types.js' +import { KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from './constants.js' +import { Cache } from './structures.js' +import { Script } from './script.js' +import { I18n } from './i18n.js' import { OutgoingHttpHeaders } from 'http' export class Source { diff --git a/src/structures.ts b/src/structures.ts index 34da13e4aa..2833ce85a0 100644 --- a/src/structures.ts +++ b/src/structures.ts @@ -18,9 +18,9 @@ import { AggregationTallyReducer, AggregationTallyFilterDescriptions, AggregationTallyReducerDescriptions, -} from './types' -import { I18n } from './i18n' -import { getEnumNames } from './utils' +} from './types.js' +import { I18n } from './i18n.js' +import { getEnumNames } from './utils.js' export const typeSystem: TypeSystem = { [Type.Array]: { [ArrayOperatorName.Count]: [OperatorCode.ArrayCount, OutputType.Integer], diff --git a/src/types.ts b/src/types.ts index 6795fa8f00..9df4110581 100644 --- a/src/types.ts +++ b/src/types.ts @@ -1,13 +1,13 @@ -import { AggregationTallyFilterArgument } from './aggregationTallyFilterArgument' -import { AggregationTallyOperatorFilter } from './aggregationTallyOperatorFilter' -import { AggregationTallyOperatorReducer } from './aggregationTallyOperatorReducer' -import { AggregationTallyScript } from './aggregationTallyScript' -import { Argument } from './argument' -import { Operator } from './operator' -import { Script } from './script' -import { Source } from './source' -import { Cache } from './structures' -import { I18n } from './i18n' +import { AggregationTallyFilterArgument } from './aggregationTallyFilterArgument.js' +import { AggregationTallyOperatorFilter } from './aggregationTallyOperatorFilter.js' +import { AggregationTallyOperatorReducer } from './aggregationTallyOperatorReducer.js' +import { AggregationTallyScript } from './aggregationTallyScript.js' +import { Argument } from './argument.js' +import { Operator } from './operator.js' +import { Script } from './script.js' +import { Source } from './source.js' +import { Cache } from './structures.js' +import { I18n } from './i18n.js' import { OutgoingHttpHeaders } from 'http' export type EventEmitter = { diff --git a/src/utils.ts b/src/utils.ts index 0ca16efd7e..98f5cf850e 100644 --- a/src/utils.ts +++ b/src/utils.ts @@ -1,5 +1,4 @@ -import prettier from 'prettier/standalone' -import parserBabel from 'prettier/parser-babel' +import * as prettier from 'prettier' import { ArgumentInfo, @@ -13,10 +12,10 @@ import { Filter, Reducer, Type, -} from './types' -import { DEFAULT_OPERATOR } from './constants' -import { markupOptions } from './structures' -import { Operator } from './operator' +} from './types.js' +import { DEFAULT_OPERATOR } from './constants.js' +import { markupOptions } from './structures.js' +import { Operator } from './operator.js' // check if contains the same elements export function areSoftEqualArrays(arr1: any[], arr2: any[]): boolean { @@ -58,8 +57,8 @@ export function fromOutputTypeToType(type: OutputType): Type | null { } } -export function formatJs(source: string) { - return prettier.format(source, { semi: false, plugins: [parserBabel], parser: 'babel' }) +export async function formatJs(source: string): Promise { + return prettier.format(source, { semi: false, parser: 'babel' }) } export function getEnumNames(e: any): Array { diff --git a/test/src/AggregationTallyFilterArgument.spec.ts b/test/src/AggregationTallyFilterArgument.spec.ts index 790cdf7c2b..00b50d3e84 100644 --- a/test/src/AggregationTallyFilterArgument.spec.ts +++ b/test/src/AggregationTallyFilterArgument.spec.ts @@ -1,6 +1,6 @@ -import { I18n } from '../../src/i18n' -import { AggregationTallyFilterArgument } from '../../src/aggregationTallyFilterArgument' -import { Cache } from '../../src/structures' +import { I18n } from '../../src/i18n.js' +import { AggregationTallyFilterArgument } from '../../src/aggregationTallyFilterArgument.js' +import { Cache } from '../../src/structures.js' describe('AggregationTallyFilterArgument', () => { it('getMarkup', () => { diff --git a/test/src/AggregationTallyOperatorFilter.spec.ts b/test/src/AggregationTallyOperatorFilter.spec.ts index 49c9ca1a6f..1e2ae82f1f 100644 --- a/test/src/AggregationTallyOperatorFilter.spec.ts +++ b/test/src/AggregationTallyOperatorFilter.spec.ts @@ -1,7 +1,7 @@ -import { AggregationTallyOperatorFilter } from '../../src/aggregationTallyOperatorFilter' -import { Cache } from '../../src/structures' -import { AggregationTallyFilter, MirAggregationTallyFilterOperator } from '../../src/types' -import { I18n } from '../../src/i18n' +import { AggregationTallyOperatorFilter } from '../../src/aggregationTallyOperatorFilter.js' +import { Cache } from '../../src/structures.js' +import { AggregationTallyFilter, MirAggregationTallyFilterOperator } from '../../src/types.js' +import { I18n } from '../../src/i18n.js' describe('AggregationTallyOperatorFilter', () => { describe('getJs', () => { diff --git a/test/src/AggregationTallyOperatorReducer.spec.ts b/test/src/AggregationTallyOperatorReducer.spec.ts index 3f68f11525..1a7defbbb7 100644 --- a/test/src/AggregationTallyOperatorReducer.spec.ts +++ b/test/src/AggregationTallyOperatorReducer.spec.ts @@ -1,7 +1,7 @@ -import { AggregationTallyOperatorReducer } from '../../src/aggregationTallyOperatorReducer' -import { Cache } from '../../src/structures' -import { AggregationTallyReducer } from '../../src/types' -import { I18n } from '../../src/i18n' +import { AggregationTallyOperatorReducer } from '../../src/aggregationTallyOperatorReducer.js' +import { Cache } from '../../src/structures.js' +import { AggregationTallyReducer } from '../../src/types.js' +import { I18n } from '../../src/i18n.js' describe('AggregationTallyOperatorReducer', () => { it('getJs', () => { diff --git a/test/src/AggregationTallyScript.spec.ts b/test/src/AggregationTallyScript.spec.ts index 63613def51..8f513f1041 100644 --- a/test/src/AggregationTallyScript.spec.ts +++ b/test/src/AggregationTallyScript.spec.ts @@ -1,8 +1,8 @@ -import { I18n } from '../../src/i18n' -import { AggregationTallyScript } from '../../src/aggregationTallyScript' -import { Cache } from '../../src/structures' -import { AggregationTallyFilter, MirAggregationTallyScript } from '../../src/types' -import { formatJsTest } from '../utils' +import { I18n } from '../../src/i18n.js' +import { AggregationTallyScript } from '../../src/aggregationTallyScript.js' +import { Cache } from '../../src/structures.js' +import { AggregationTallyFilter, MirAggregationTallyScript } from '../../src/types.js' +import { formatJsTest } from '../utils.js' describe('AggregationTallyScript', () => { describe('addOperator', () => { diff --git a/test/src/argument.spec.ts b/test/src/argument.spec.ts index 66ec0015d2..7183133993 100644 --- a/test/src/argument.spec.ts +++ b/test/src/argument.spec.ts @@ -1,6 +1,6 @@ -import { Argument, generateReducerArgumentOptions } from '../../src/argument' -import { Cache, operatorInfos } from '../../src/structures' -import { DEFAULT_OPERATOR } from '../../src/constants' +import { Argument, generateReducerArgumentOptions } from '../../src/argument.js' +import { Cache, operatorInfos } from '../../src/structures.js' +import { DEFAULT_OPERATOR } from '../../src/constants.js' import { OutputType, OperatorCode, @@ -13,9 +13,9 @@ import { Reducer, MirScript, Context, -} from '../../src/types' -import { formatJsTest } from '../utils' -import { I18n } from '../../src/i18n' +} from '../../src/types.js' +import { formatJsTest } from '../utils.js' +import { I18n } from '../../src/i18n.js' const reducerOptions = generateReducerArgumentOptions() @@ -546,7 +546,7 @@ describe('Argument methods', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } const argument = new Argument(context, argumentInfo, [operator[1], operator[2]] as [ Filter, - number + number, ]) const result = argument.getMarkup() const expected = { diff --git a/test/src/createRadonRequest.spec.ts b/test/src/createRadonRequest.spec.ts index 69195b4903..a9730ac9e8 100644 --- a/test/src/createRadonRequest.spec.ts +++ b/test/src/createRadonRequest.spec.ts @@ -1,6 +1,6 @@ -import { Radon } from '../../src/radon' -import { DEFAULT_KIND_OPTION, KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from '../../src/constants' -import { MirRequest, AggregationTallyReducer, MarkupInput } from '../../src/types' +import { Radon } from '../../src/radon.js' +import { DEFAULT_KIND_OPTION, KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from '../../src/constants.js' +import { MirRequest, AggregationTallyReducer, MarkupInput } from '../../src/types.js' describe('Radon', () => { it('addOperator', () => { diff --git a/test/src/createRngRequest.spec.ts b/test/src/createRngRequest.spec.ts index f071fc0e4e..0aa4b2c347 100644 --- a/test/src/createRngRequest.spec.ts +++ b/test/src/createRngRequest.spec.ts @@ -1,7 +1,7 @@ -import { Radon } from '../../src/radon' -import { KIND_OPTIONS, DEFAULT_KIND_OPTION, CONTENT_TYPE_OPTIONS } from '../../src/constants' -import { I18n } from '../../src/i18n' -import { Cache } from '../../src/structures' +import { Radon } from '../../src/radon.js' +import { KIND_OPTIONS, DEFAULT_KIND_OPTION, CONTENT_TYPE_OPTIONS } from '../../src/constants.js' +import { I18n } from '../../src/i18n.js' +import { Cache } from '../../src/structures.js' import { MirRequest, AggregationTallyReducer, @@ -9,9 +9,9 @@ import { MirAggregationTallyScript, AggregationTallyFilter, OperatorCode, -} from '../../src/types' -import { AggregationTallyScript } from '../../src/aggregationTallyScript' -import { formatJsTest } from '../utils' +} from '../../src/types.js' +import { AggregationTallyScript } from '../../src/aggregationTallyScript.js' +import { formatJsTest } from '../utils.js' describe('RandomNumberGenerator request', () => { const mir: MirRequest = { @@ -307,7 +307,7 @@ describe('RandomNumberGenerator request', () => { }) }) describe('JS', () => { - it('maintain empty script', () => { + it('maintain empty script', async () => { const mir: MirRequest = { timelock: 0, retrieve: [ @@ -333,7 +333,7 @@ describe('RandomNumberGenerator request', () => { const radon = new Radon(mir) radon.addOperator(2) - const expected = formatJsTest(`import * as Witnet from "witnet-requests" + const expected = await formatJsTest(`import * as Witnet from "witnet-requests" const request = new Witnet.Request() const source_0 = new Witnet.Source("") const aggregator = new Witnet.aggregator({ filters: [], reducer: Witnet.Types.REDUCERS.hashConcatenate,}) @@ -346,9 +346,9 @@ describe('RandomNumberGenerator request', () => { .setFees(10, 1, 1, 1) // Set economic incentives .schedule(0) // Make this request immediately solvable export { request as default }`) - expect(formatJsTest(radon.getJs())).toBe(expected) + expect(await formatJsTest(await radon.getJs())).toBe(expected) }) - it('correctly updates the source deleting source script operators', () => { + it('correctly updates the source deleting source script operators', async () => { const radon = new Radon(mir) radon.addOperator(2) radon.retrieve[0].update({ @@ -356,7 +356,7 @@ describe('RandomNumberGenerator request', () => { url: '', contentType: Kind.RNG, }) - const expected = formatJsTest(`import * as Witnet from "witnet-requests" + const expected = await formatJsTest(`import * as Witnet from "witnet-requests" const request = new Witnet.Request() const source_0 = new Witnet.Source("") const aggregator = new Witnet.aggregator({ filters: [], reducer: Witnet.Types.REDUCERS.hashConcatenate,}) @@ -369,7 +369,7 @@ describe('RandomNumberGenerator request', () => { .setFees(10, 1, 1, 1) // Set economic incentives .schedule(0) // Make this request immediately solvable export { request as default }`) - expect(formatJsTest(radon.getJs())).toBe(expected) + expect(await formatJsTest(await radon.getJs())).toBe(expected) }) }) }) diff --git a/test/src/i18n.spec.ts b/test/src/i18n.spec.ts index d5810931a8..b8c7ad889d 100644 --- a/test/src/i18n.spec.ts +++ b/test/src/i18n.spec.ts @@ -1,4 +1,4 @@ -import { I18n } from '../../src/i18n' +import { I18n } from '../../src/i18n.js' describe('i18n', () => { it('should use en as default locale', () => { diff --git a/test/src/operator.spec.ts b/test/src/operator.spec.ts index 372d27d0eb..9af54a1e13 100644 --- a/test/src/operator.spec.ts +++ b/test/src/operator.spec.ts @@ -1,8 +1,9 @@ -import { Operator } from '../../src/operator' -import { OperatorCode, OutputType, MirOperator, Context } from '../../src/types' -import { Cache, markupOptions, allMarkupOptions, operatorInfos } from '../../src/structures' -import { DEFAULT_OPERATOR } from '../../src/constants' -import { I18n } from '../../src/i18n' +import { Operator } from '../../src/operator.js' +import { OperatorCode, OutputType, MirOperator, Context } from '../../src/types.js' +import { Cache, markupOptions, allMarkupOptions, operatorInfos } from '../../src/structures.js' +import { DEFAULT_OPERATOR } from '../../src/constants.js' +import { I18n } from '../../src/i18n.js' +import { vi } from 'vitest' describe('Operator methods', () => { describe('getJs', () => { @@ -1140,7 +1141,7 @@ describe('Operator methods', () => { describe('from operator code ', () => { it('map with subscript argument', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const op = OperatorCode.ArrayCount const operator = new Operator(context, 0, OutputType.SubscriptOutput, op, { emit: emitMock, @@ -1156,7 +1157,7 @@ describe('Operator methods', () => { it('default operator', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const operator = new Operator(context, 0, null, null, { emit: emitMock }) const newOperatorCode = OperatorCode.BooleanAsString @@ -1173,7 +1174,7 @@ describe('Operator methods', () => { it('array', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const op = OperatorCode.ArrayCount const operator = new Operator(context, 0, OutputType.Array, op, { emit: emitMock }) const newOperatorCode = OperatorCode.BooleanAsString @@ -1188,7 +1189,7 @@ describe('Operator methods', () => { it('boolean', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const op = OperatorCode.BooleanAsString const operator = new Operator(context, 0, OutputType.Boolean, op, { emit: emitMock }) const newOperatorCode = OperatorCode.ArrayCount @@ -1203,7 +1204,7 @@ describe('Operator methods', () => { it('bytes', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const op = OperatorCode.BytesAsString const operator = new Operator(context, 0, OutputType.Bytes, op, { emit: emitMock }) const newOperatorCode = OperatorCode.ArrayCount @@ -1218,7 +1219,7 @@ describe('Operator methods', () => { it('integer', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const op = OperatorCode.IntegerAsString const operator = new Operator(context, 0, OutputType.Integer, op, { emit: emitMock }) const newOperatorCode = OperatorCode.FloatGreaterThan @@ -1233,7 +1234,7 @@ describe('Operator methods', () => { it('float', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const op = OperatorCode.FloatAbsolute const operator = new Operator(context, 0, OutputType.Float, op, { emit: emitMock }) const newOperatorCode = OperatorCode.FloatCeiling @@ -1248,7 +1249,7 @@ describe('Operator methods', () => { it('map', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const op = OperatorCode.MapKeys const operator = new Operator(context, 0, OutputType.Map, op, { emit: emitMock }) const newOperatorCode = OperatorCode.MapGetString @@ -1263,7 +1264,7 @@ describe('Operator methods', () => { it('string', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const op = OperatorCode.StringAsFloat const operator = new Operator(context, 0, OutputType.String, op, { emit: emitMock }) const newOperatorCode = OperatorCode.StringAsInteger @@ -1280,7 +1281,7 @@ describe('Operator methods', () => { describe('from operator name', () => { it('array', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const operatorName = 'ArrayFilter' const operator = new Operator(context, 0, OutputType.Array, OperatorCode[operatorName], { emit: emitMock, @@ -1298,7 +1299,7 @@ describe('Operator methods', () => { it('boolean', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const operatorName = 'BooleanAsString' const operator = new Operator(context, 0, OutputType.Boolean, OperatorCode[operatorName], { emit: emitMock, @@ -1316,7 +1317,7 @@ describe('Operator methods', () => { it('bytes', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const operatorName = 'BytesAsString' const operator = new Operator(context, 0, OutputType.Bytes, OperatorCode[operatorName], { emit: emitMock, @@ -1333,7 +1334,7 @@ describe('Operator methods', () => { it('integer', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const operatorName = 'IntegerAsString' const operator = new Operator(context, 0, OutputType.Integer, OperatorCode[operatorName], { emit: emitMock, @@ -1350,7 +1351,7 @@ describe('Operator methods', () => { it('float', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const operatorName = 'FloatAbsolute' const operator = new Operator(context, 0, OutputType.Float, OperatorCode[operatorName], { emit: emitMock, @@ -1368,7 +1369,7 @@ describe('Operator methods', () => { it('map', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const operatorName = 'MapGetString' const operator = new Operator(context, 0, OutputType.Map, OperatorCode[operatorName], { emit: emitMock, @@ -1386,7 +1387,7 @@ describe('Operator methods', () => { it('string', () => { const context: Context = { cache: new Cache(), i18n: new I18n() } - const emitMock = jest.fn() + const emitMock = vi.fn() const operatorName = 'StringMatch' const operator = new Operator(context, 0, OutputType.String, OperatorCode[operatorName], { emit: emitMock, diff --git a/test/src/radon.spec.ts b/test/src/radon.spec.ts index 2d8a27325a..da6df4e6ad 100755 --- a/test/src/radon.spec.ts +++ b/test/src/radon.spec.ts @@ -1,15 +1,19 @@ -import { Radon } from '../../src/radon' -import { Operator } from '../../src/operator' -import { DEFAULT_KIND_OPTION, KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from '../../src/constants' +import { Radon } from '../../src/radon.js' +import { Operator } from '../../src/operator.js' +import { DEFAULT_KIND_OPTION, KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from '../../src/constants.js' import { MirRequest, OperatorCode, AggregationTallyReducer, AggregationTallyFilter, Kind, -} from '../../src/types' -import { markupOptions, aTFilterMarkupOptions, aTReducerMarkupOptions } from '../../src/structures' -import { formatJsTest } from '../utils' +} from '../../src/types.js' +import { + markupOptions, + aTFilterMarkupOptions, + aTReducerMarkupOptions, +} from '../../src/structures.js' +import { formatJsTest } from '../utils.js' describe('Radon', () => { it('addOperator', () => { @@ -3222,7 +3226,7 @@ describe('Radon', () => { }) describe('getJs method', () => { - it('case 1', () => { + it('case 1', async () => { const mirRequest: MirRequest = { timelock: 0, retrieve: [ @@ -3264,8 +3268,8 @@ describe('Radon', () => { } const radon = new Radon(mirRequest) - const js = formatJsTest(radon.getJs()) - const expected = formatJsTest( + const js = await formatJsTest(await radon.getJs()) + const expected = await formatJsTest( `import * as Witnet from \"witnet-requests\" const request = new Witnet.Request() const source_0 = new Witnet.Source(\"source_1\") @@ -3302,7 +3306,7 @@ describe('Radon', () => { expect(js).toBe(expected) }) - it('case 2', () => { + it('case 2', async () => { const mirRequest: MirRequest = { timelock: 0, retrieve: [ @@ -3363,8 +3367,8 @@ describe('Radon', () => { }, } const radon = new Radon(mirRequest) - const js = formatJsTest(radon.getJs()) - const expected = formatJsTest( + const js = await formatJsTest(await radon.getJs()) + const expected = await formatJsTest( `import * as Witnet from \"witnet-requests\" const request = new Witnet.Request() const source_0 = new Witnet.Source(\"https://api.bithumb.com/public/ticker/BTC\") diff --git a/test/src/sanity.ts b/test/src/sanity.ts deleted file mode 100644 index 460af7ceec..0000000000 --- a/test/src/sanity.ts +++ /dev/null @@ -1,3 +0,0 @@ -test('sanity', () => { - expect(true).toBe(true) -}) diff --git a/test/src/script.spec.ts b/test/src/script.spec.ts index 633c31aaed..2d8ee2ce8e 100644 --- a/test/src/script.spec.ts +++ b/test/src/script.spec.ts @@ -1,10 +1,10 @@ -import { MirScript, OperatorCode, OutputType, Kind } from '../../src/types' -import { Script } from '../../src/script' -import { Operator } from '../../src/operator' -import { DEFAULT_SCRIPT_FIRST_TYPE } from '../../src/constants' -import { Cache, markupOptions } from '../../src/structures' -import { removeBreakLine } from '../utils' -import { I18n } from '../../src/i18n' +import { MirScript, OperatorCode, OutputType, Kind } from '../../src/types.js' +import { Script } from '../../src/script.js' +import { Operator } from '../../src/operator.js' +import { DEFAULT_SCRIPT_FIRST_TYPE } from '../../src/constants.js' +import { Cache, markupOptions } from '../../src/structures.js' +import { removeBreakLine } from '../utils.js' +import { I18n } from '../../src/i18n.js' // TODO: validateScript describe('Script methods', () => { diff --git a/test/src/source.spec.ts b/test/src/source.spec.ts index 00071bbeb2..d4fc261e48 100644 --- a/test/src/source.spec.ts +++ b/test/src/source.spec.ts @@ -1,9 +1,9 @@ -import { MirScript, OperatorCode, Kind } from '../../src/types' -import { Source } from '../../src/source' -import { Cache, markupOptions } from '../../src/structures' -import { formatJsTest } from '../utils' -import { I18n } from '../../src/i18n' -import { KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from '../../src/constants' +import { MirScript, OperatorCode, Kind } from '../../src/types.js' +import { Source } from '../../src/source.js' +import { Cache, markupOptions } from '../../src/structures.js' +import { formatJsTest } from '../utils.js' +import { I18n } from '../../src/i18n.js' +import { KIND_OPTIONS, CONTENT_TYPE_OPTIONS } from '../../src/constants.js' const onChildrenEvent = () => { return { @@ -38,7 +38,7 @@ describe('Source', () => { expect(result).toStrictEqual(expected) }) - it('multiple operators', () => { + it('multiple operators', async () => { const context = { cache: new Cache(), i18n: new I18n() } const mirScript: MirScript = [ @@ -57,7 +57,7 @@ describe('Source', () => { headers: {}, } - const result = formatJsTest(new Source(context, mirSource, onChildrenEvent()).getJs(0)) + const result = await formatJsTest(new Source(context, mirSource, onChildrenEvent()).getJs(0)) const expected = 'const source_0 = new Witnet.Source("url").asBoolean().negate().asString()' diff --git a/test/src/utils.spec.ts b/test/src/utils.spec.ts index b40d590a1a..05c03afeaa 100644 --- a/test/src/utils.spec.ts +++ b/test/src/utils.spec.ts @@ -1,4 +1,4 @@ -import { areSoftEqualArrays, getEnumValues, getEnumNames } from '../../src/utils' +import { areSoftEqualArrays, getEnumValues, getEnumNames } from '../../src/utils.js' describe('areSoftEqualArrays', () => { it('check if two diffrent arrays return false', () => { diff --git a/test/utils.ts b/test/utils.ts index ff1fed370b..5887c30013 100644 --- a/test/utils.ts +++ b/test/utils.ts @@ -1,7 +1,7 @@ -import { formatJs } from '../src/utils' +import { formatJs } from '../src/utils.js' -export function formatJsTest(source: string): string { - return removeBreakLine(formatJs(source)) +export async function formatJsTest(source: string): Promise { + return removeBreakLine(await formatJs(source)) } export function removeBreakLine(source: string): string { diff --git a/tsconfig.json b/tsconfig.json index 33e3bdc70b..20e449e67d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,70 +1,29 @@ { "compilerOptions": { - /* Basic Options */ - "incremental": true, /* Enable incremental compilation */ - "target": "es5", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ - "module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ - "lib": ["es2020", "DOM"], /* Specify library files to be included in the compilation. */ - // "allowJs": true, /* Allow javascript files to be compiled. */ - // "checkJs": true, /* Report errors in .js files. */ - // "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */ - "declaration": true, /* Generates corresponding '.d.ts' file. */ - "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */ - // "sourceMap": true, /* Generates corresponding '.map' file. */ - // "outFile": "./", /* Concatenate and emit output to single file. */ - "outDir": "./dist", /* Redirect output structure to the directory. */ - // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ - // "composite": true, /* Enable project compilation */ - // "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */ - // "removeComments": true, /* Do not emit comments to output. */ - // "noEmit": true, /* Do not emit outputs. */ - // "importHelpers": true, /* Import emit helpers from 'tslib'. */ - "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ - // "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */ - - /* Strict Type-Checking Options */ - "strict": true, /* Enable all strict type-checking options. */ - // "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ - "strictNullChecks": true, /* Enable strict null checks. */ - "strictFunctionTypes": true, /* Enable strict checking of function types. */ - // "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */ - "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */ - "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */ - "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */ - - /* Additional Checks */ - "noUnusedLocals": true, /* Report errors on unused locals. */ - "noUnusedParameters": true, /* Report errors on unused parameters. */ - "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ - // "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ - - /* Module Resolution Options */ - // "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */ - "baseUrl": "./", /* Base directory to resolve non-absolute module names. */ - // "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */ - // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - "typeRoots": ["./node_modules/@types", "@types"], /* List of folders to include type definitions from. */ - // "types": [], /* Type declaration files to be included in compilation. */ - // "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */ - "esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ - // "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */ - // "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */ - - /* Source Map Options */ - // "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */ - // "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */ - // "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */ - // "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */ - - /* Experimental Options */ - // "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */ - // "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ + "alwaysStrict": true, + "baseUrl": "./", + "declaration": true, + "declarationMap": true, + "downlevelIteration": true, + "esModuleInterop": true, + "incremental": true, + "lib": ["es2020", "DOM"], + "module": "NodeNext", + "moduleResolution": "NodeNext", + "noImplicitReturns": true, + "noImplicitThis": true, + "noUnusedLocals": true, + "noUnusedParameters": true, + "outDir": "./dist", + "resolveJsonModule": true, "skipLibCheck": true, - "resolveJsonModule": true, + "strict": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "strictPropertyInitialization": true, + "target": "ESNext", + "typeRoots": ["./node_modules/@types", "@types"], }, - "exclude": [ - "**/*.d.ts", - "node_modules", - // "dist/" -] + "include": ["./**/*.ts"], + "exclude": ["node_modules", "dist"], } diff --git a/vitest.config.js b/vitest.config.js new file mode 100644 index 0000000000..3e82c1ae8a --- /dev/null +++ b/vitest.config.js @@ -0,0 +1,8 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + plugins: [], + test: { + globals: true + }, +}) \ No newline at end of file