From 7d7e7235552aa39e20f2b1c5ca3bec49902a3ebe Mon Sep 17 00:00:00 2001 From: Aric Camarata Date: Sun, 8 Mar 2026 11:37:55 -0400 Subject: [PATCH] refactor: code quality improvements across the board --- .editorconfig | 5 +- .github/workflows/ci.yml | 18 +- .gitignore | 10 + .prettierrc | 6 + eslint.config.mjs | 12 + package.json | 47 ++- pnpm-lock.yaml | 751 ++++++++++++++++++++++++++++++++++++++- src/index.ts | 61 ++-- test-cjs.cjs | 100 +++--- test.mjs | 203 +++++------ tsconfig.json | 2 + tsup.config.ts | 4 +- 12 files changed, 999 insertions(+), 220 deletions(-) create mode 100644 .prettierrc create mode 100644 eslint.config.mjs diff --git a/.editorconfig b/.editorconfig index f849911..549f7d0 100644 --- a/.editorconfig +++ b/.editorconfig @@ -3,12 +3,15 @@ root = true [*] end_of_line = lf charset = utf-8 -trim_trailing_whitespace = true insert_final_newline = true +trim_trailing_whitespace = true + +[*.{ts,mts,cts,js,mjs,cjs,json,yaml,yml,md}] indent_style = space indent_size = 2 [*.{c,h}] +indent_style = space indent_size = 4 [Makefile] diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1d0f046..d5a3527 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,8 +22,22 @@ jobs: cache: pnpm - run: pnpm install --frozen-lockfile - run: pnpm run build - - run: node test.mjs - - run: node test-cjs.cjs + - run: node --test test.mjs + - run: node --test test-cjs.cjs + + lint: + name: Lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: pnpm/action-setup@v4 + - uses: actions/setup-node@v4 + with: + node-version: 24 + cache: pnpm + - run: pnpm install --frozen-lockfile + - run: pnpm run lint + - run: pnpm run format:check typecheck: name: Typecheck diff --git a/.gitignore b/.gitignore index b01741f..65e8404 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,13 @@ dist/ # AI agent directories .cursor/ .copilot/ +.aider* +.aider.chat.history.md +.continue/ +.codex/ +.gemini/ +.vscode/* +.idea/ +.aider/ +.windsurf/ +.codeium/ diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000..383f607 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,6 @@ +{ + "singleQuote": true, + "trailingComma": "all", + "printWidth": 100, + "tabWidth": 2 +} diff --git a/eslint.config.mjs b/eslint.config.mjs new file mode 100644 index 0000000..b9816c6 --- /dev/null +++ b/eslint.config.mjs @@ -0,0 +1,12 @@ +import eslint from '@eslint/js'; +import tseslint from 'typescript-eslint'; +import eslintConfigPrettier from 'eslint-config-prettier'; + +export default tseslint.config( + eslint.configs.recommended, + ...tseslint.configs.recommended, + eslintConfigPrettier, + { + ignores: ['dist/', 'node_modules/', 'test.mjs', 'test-cjs.cjs'], + }, +); diff --git a/package.json b/package.json index 2fa3d59..e4cc3a1 100644 --- a/package.json +++ b/package.json @@ -9,8 +9,14 @@ "types": "./dist/index.d.ts", "exports": { ".": { - "import": { "types": "./dist/index.d.mts", "default": "./dist/index.mjs" }, - "require": { "types": "./dist/index.d.ts", "default": "./dist/index.cjs" } + "import": { + "types": "./dist/index.d.mts", + "default": "./dist/index.mjs" + }, + "require": { + "types": "./dist/index.d.ts", + "default": "./dist/index.cjs" + } } }, "sideEffects": false, @@ -23,13 +29,18 @@ "CHANGELOG.md", "LICENSE" ], - "engines": { "node": ">=20" }, + "engines": { + "node": ">=20" + }, "packageManager": "pnpm@10.30.1", "scripts": { "build": "tsup", "typecheck": "tsc --noEmit", "pretest": "tsup", - "test": "node test.mjs && node test-cjs.cjs", + "test": "node --test test.mjs && node --test test-cjs.cjs", + "lint": "eslint src/", + "format": "prettier --write src/", + "format:check": "prettier --check src/", "prepublishOnly": "tsup" }, "keywords": [ @@ -45,16 +56,32 @@ "converter", "typescript" ], - "peerDependencies": { "moment": "^2.0.0", "hijri-core": "^1.0.0" }, + "peerDependencies": { + "hijri-core": "^1.0.0", + "moment": "^2.0.0" + }, "devDependencies": { - "@types/node": "^22.0.0", + "@eslint/js": "^10.0.1", + "@types/node": "^25.3.5", + "eslint": "^10.0.3", + "eslint-config-prettier": "^10.1.8", "hijri-core": "^1.0.0", "moment": "^2.30.0", + "prettier": "^3.8.1", "tsup": "^8.0.0", - "typescript": "^5.5.0" + "typescript": "^5.5.0", + "typescript-eslint": "^8.56.1" + }, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org/" + }, + "repository": { + "type": "git", + "url": "git+https://github.com/acamarata/moment-hijri-plus.git" }, - "publishConfig": { "access": "public", "registry": "https://registry.npmjs.org/" }, - "repository": { "type": "git", "url": "git+https://github.com/acamarata/moment-hijri-plus.git" }, "homepage": "https://github.com/acamarata/moment-hijri-plus#readme", - "bugs": { "url": "https://github.com/acamarata/moment-hijri-plus/issues" } + "bugs": { + "url": "https://github.com/acamarata/moment-hijri-plus/issues" + } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 45be19f..b14819c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,21 +8,36 @@ importers: .: devDependencies: + '@eslint/js': + specifier: ^10.0.1 + version: 10.0.1(eslint@10.0.3) '@types/node': - specifier: ^22.0.0 - version: 22.19.11 + specifier: ^25.3.5 + version: 25.3.5 + eslint: + specifier: ^10.0.3 + version: 10.0.3 + eslint-config-prettier: + specifier: ^10.1.8 + version: 10.1.8(eslint@10.0.3) hijri-core: specifier: ^1.0.0 version: 1.0.0 moment: specifier: ^2.30.0 version: 2.30.1 + prettier: + specifier: ^3.8.1 + version: 3.8.1 tsup: specifier: ^8.0.0 version: 8.5.1(typescript@5.9.3) typescript: specifier: ^5.5.0 version: 5.9.3 + typescript-eslint: + specifier: ^8.56.1 + version: 8.56.1(eslint@10.0.3)(typescript@5.9.3) packages: @@ -182,6 +197,61 @@ packages: cpu: [x64] os: [win32] + '@eslint-community/eslint-utils@4.9.1': + resolution: {integrity: sha512-phrYmNiYppR7znFEdqgfWHXR6NCkZEK7hwWDHZUjit/2/U0r6XvkDl0SYnoM51Hq7FhCGdLDT6zxCCOY1hexsQ==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + peerDependencies: + eslint: ^6.0.0 || ^7.0.0 || >=8.0.0 + + '@eslint-community/regexpp@4.12.2': + resolution: {integrity: sha512-EriSTlt5OC9/7SXkRSCAhfSxxoSUgBm33OH+IkwbdpgoqsSsUg7y3uh+IICI/Qg4BBWr3U2i39RpmycbxMq4ew==} + engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} + + '@eslint/config-array@0.23.3': + resolution: {integrity: sha512-j+eEWmB6YYLwcNOdlwQ6L2OsptI/LO6lNBuLIqe5R7RetD658HLoF+Mn7LzYmAWWNNzdC6cqP+L6r8ujeYXWLw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@eslint/config-helpers@0.5.3': + resolution: {integrity: sha512-lzGN0onllOZCGroKJmRwY6QcEHxbjBw1gwB8SgRSqK8YbbtEXMvKynsXc3553ckIEBxsbMBU7oOZXKIPGZNeZw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@eslint/core@1.1.1': + resolution: {integrity: sha512-QUPblTtE51/7/Zhfv8BDwO0qkkzQL7P/aWWbqcf4xWLEYn1oKjdO0gglQBB4GAsu7u6wjijbCmzsUTy6mnk6oQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@eslint/js@10.0.1': + resolution: {integrity: sha512-zeR9k5pd4gxjZ0abRoIaxdc7I3nDktoXZk2qOv9gCNWx3mVwEn32VRhyLaRsDiJjTs0xq/T8mfPtyuXu7GWBcA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + peerDependencies: + eslint: ^10.0.0 + peerDependenciesMeta: + eslint: + optional: true + + '@eslint/object-schema@3.0.3': + resolution: {integrity: sha512-iM869Pugn9Nsxbh/YHRqYiqd23AmIbxJOcpUMOuWCVNdoQJ5ZtwL6h3t0bcZzJUlC3Dq9jCFCESBZnX0GTv7iQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@eslint/plugin-kit@0.6.1': + resolution: {integrity: sha512-iH1B076HoAshH1mLpHMgwdGeTs0CYwL0SPMkGuSebZrwBp16v415e9NZXg2jtrqPVQjf6IANe2Vtlr5KswtcZQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + '@humanfs/core@0.19.1': + resolution: {integrity: sha512-5DyQ4+1JEUzejeK1JGICcideyfUbGixgS9jNgex5nqkW+cY7WZhxBigmieN5Qnw9ZosSNVC9KQKyb+GUaGyKUA==} + engines: {node: '>=18.18.0'} + + '@humanfs/node@0.16.7': + resolution: {integrity: sha512-/zUx+yOsIrG4Y43Eh2peDeKCxlRt/gET6aHfaKpuq267qXdYDFViVHfMaLyygZOnl0kGWxFIgsBy8QFuTLUXEQ==} + engines: {node: '>=18.18.0'} + + '@humanwhocodes/module-importer@1.0.1': + resolution: {integrity: sha512-bxveV4V8v5Yb4ncFTT3rPSgZBOpCkjfK0y4oVVVJwIuDVBRMDXrPyXRL988i5ap9m9bnyEEjWfm5WkBmtffLfA==} + engines: {node: '>=12.22'} + + '@humanwhocodes/retry@0.4.3': + resolution: {integrity: sha512-bV0Tgo9K4hfPCek+aMAn81RppFKv2ySDQeMoSZuvTASywNTnVJCArCZE2FWqpvIatKu7VMRLWlR1EazvVhDyhQ==} + engines: {node: '>=18.18'} + '@jridgewell/gen-mapping@0.3.13': resolution: {integrity: sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==} @@ -333,20 +403,101 @@ packages: cpu: [x64] os: [win32] + '@types/esrecurse@4.3.1': + resolution: {integrity: sha512-xJBAbDifo5hpffDBuHl0Y8ywswbiAp/Wi7Y/GtAgSlZyIABppyurxVueOPE8LUQOxdlgi6Zqce7uoEpqNTeiUw==} + '@types/estree@1.0.8': resolution: {integrity: sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==} - '@types/node@22.19.11': - resolution: {integrity: sha512-BH7YwL6rA93ReqeQS1c4bsPpcfOmJasG+Fkr6Y59q83f9M1WcBRHR2vM+P9eOisYRcN3ujQoiZY8uk5W+1WL8w==} + '@types/json-schema@7.0.15': + resolution: {integrity: sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==} + + '@types/node@25.3.5': + resolution: {integrity: sha512-oX8xrhvpiyRCQkG1MFchB09f+cXftgIXb3a7UUa4Y3wpmZPw5tyZGTLWhlESOLq1Rq6oDlc8npVU2/9xiCuXMA==} + + '@typescript-eslint/eslint-plugin@8.56.1': + resolution: {integrity: sha512-Jz9ZztpB37dNC+HU2HI28Bs9QXpzCz+y/twHOwhyrIRdbuVDxSytJNDl6z/aAKlaRIwC7y8wJdkBv7FxYGgi0A==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + '@typescript-eslint/parser': ^8.56.1 + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/parser@8.56.1': + resolution: {integrity: sha512-klQbnPAAiGYFyI02+znpBRLyjL4/BrBd0nyWkdC0s/6xFLkXYQ8OoRrSkqacS1ddVxf/LDyODIKbQ5TgKAf/Fg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/project-service@8.56.1': + resolution: {integrity: sha512-TAdqQTzHNNvlVFfR+hu2PDJrURiwKsUvxFn1M0h95BB8ah5jejas08jUWG4dBA68jDMI988IvtfdAI53JzEHOQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/scope-manager@8.56.1': + resolution: {integrity: sha512-YAi4VDKcIZp0O4tz/haYKhmIDZFEUPOreKbfdAN3SzUDMcPhJ8QI99xQXqX+HoUVq8cs85eRKnD+rne2UAnj2w==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/tsconfig-utils@8.56.1': + resolution: {integrity: sha512-qOtCYzKEeyr3aR9f28mPJqBty7+DBqsdd63eO0yyDwc6vgThj2UjWfJIcsFeSucYydqcuudMOprZ+x1SpF3ZuQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/type-utils@8.56.1': + resolution: {integrity: sha512-yB/7dxi7MgTtGhZdaHCemf7PuwrHMenHjmzgUW1aJpO+bBU43OycnM3Wn+DdvDO/8zzA9HlhaJ0AUGuvri4oGg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/types@8.56.1': + resolution: {integrity: sha512-dbMkdIUkIkchgGDIv7KLUpa0Mda4IYjo4IAMJUZ+3xNoUXxMsk9YtKpTHSChRS85o+H9ftm51gsK1dZReY9CVw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + '@typescript-eslint/typescript-estree@8.56.1': + resolution: {integrity: sha512-qzUL1qgalIvKWAf9C1HpvBjif+Vm6rcT5wZd4VoMb9+Km3iS3Cv9DY6dMRMDtPnwRAFyAi7YXJpTIEXLvdfPxg==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/utils@8.56.1': + resolution: {integrity: sha512-HPAVNIME3tABJ61siYlHzSWCGtOoeP2RTIaHXFMPqjrQKCGB9OgUVdiNgH7TJS2JNIQ5qQ4RsAUDuGaGme/KOA==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' + + '@typescript-eslint/visitor-keys@8.56.1': + resolution: {integrity: sha512-KiROIzYdEV85YygXw6BI/Dx4fnBlFQu6Mq4QE4MOH9fFnhohw6wX/OAvDY2/C+ut0I3RSPKenvZJIVYqJNkhEw==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + + acorn-jsx@5.3.2: + resolution: {integrity: sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==} + peerDependencies: + acorn: ^6.0.0 || ^7.0.0 || ^8.0.0 acorn@8.16.0: resolution: {integrity: sha512-UVJyE9MttOsBQIDKw1skb9nAwQuR5wuGD3+82K6JgJlm/Y+KI92oNsMNGZCYdDsVtRHSak0pcV5Dno5+4jh9sw==} engines: {node: '>=0.4.0'} hasBin: true + ajv@6.14.0: + resolution: {integrity: sha512-IWrosm/yrn43eiKqkfkHis7QioDleaXQHdDVPKg0FSwwd/DuvyX79TZnFOnYpB7dcsFAMmtFztZuXPDvSePkFw==} + any-promise@1.3.0: resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + balanced-match@4.0.4: + resolution: {integrity: sha512-BLrgEcRTwX2o6gGxGOCNyMvGSp35YofuYzw9h1IMTRmKqttAZZVU67bdb9Pr2vUHA8+j3i2tJfjO6C6+4myGTA==} + engines: {node: 18 || 20 || >=22} + + brace-expansion@5.0.4: + resolution: {integrity: sha512-h+DEnpVvxmfVefa4jFbCf5HdH5YMDXRsmKflpf1pILZWRFlTbJpxeU55nJl4Smt5HQaGzg1o6RHFPJaOqnmBDg==} + engines: {node: 18 || 20 || >=22} + bundle-require@5.1.0: resolution: {integrity: sha512-3WrrOuZiyaaZPWiEt4G3+IffISVC9HYlWueJEBWED4ZH4aIAC2PnkdnuRrR94M+w6yGWn4AglWtJtBI8YqvgoA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} @@ -372,6 +523,10 @@ packages: resolution: {integrity: sha512-5IKcdX0nnYavi6G7TtOhwkYzyjfJlatbjMjuLSfE2kYT5pMDOilZ4OvMhi637CcDICTmz3wARPoyhqyX1Y+XvA==} engines: {node: ^14.18.0 || >=16.10.0} + cross-spawn@7.0.6: + resolution: {integrity: sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==} + engines: {node: '>= 8'} + debug@4.4.3: resolution: {integrity: sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==} engines: {node: '>=6.0'} @@ -381,11 +536,75 @@ packages: supports-color: optional: true + deep-is@0.1.4: + resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} + esbuild@0.27.3: resolution: {integrity: sha512-8VwMnyGCONIs6cWue2IdpHxHnAjzxnw2Zr7MkVxB2vjmQ2ivqGFb4LEG3SMnv0Gb2F/G/2yA8zUaiL1gywDCCg==} engines: {node: '>=18'} hasBin: true + escape-string-regexp@4.0.0: + resolution: {integrity: sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==} + engines: {node: '>=10'} + + eslint-config-prettier@10.1.8: + resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==} + hasBin: true + peerDependencies: + eslint: '>=7.0.0' + + eslint-scope@9.1.2: + resolution: {integrity: sha512-xS90H51cKw0jltxmvmHy2Iai1LIqrfbw57b79w/J7MfvDfkIkFZ+kj6zC3BjtUwh150HsSSdxXZcsuv72miDFQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + eslint-visitor-keys@3.4.3: + resolution: {integrity: sha512-wpc+LXeiyiisxPlEkUzU6svyS1frIO3Mgxj1fdy7Pm8Ygzguax2N3Fa/D/ag1WqbOprdI+uY6wMUl8/a2G+iag==} + engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} + + eslint-visitor-keys@5.0.1: + resolution: {integrity: sha512-tD40eHxA35h0PEIZNeIjkHoDR4YjjJp34biM0mDvplBe//mB+IHCqHDGV7pxF+7MklTvighcCPPZC7ynWyjdTA==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + eslint@10.0.3: + resolution: {integrity: sha512-COV33RzXZkqhG9P2rZCFl9ZmJ7WL+gQSCRzE7RhkbclbQPtLAWReL7ysA0Sh4c8Im2U9ynybdR56PV0XcKvqaQ==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + hasBin: true + peerDependencies: + jiti: '*' + peerDependenciesMeta: + jiti: + optional: true + + espree@11.2.0: + resolution: {integrity: sha512-7p3DrVEIopW1B1avAGLuCSh1jubc01H2JHc8B4qqGblmg5gI9yumBgACjWo4JlIc04ufug4xJ3SQI8HkS/Rgzw==} + engines: {node: ^20.19.0 || ^22.13.0 || >=24} + + esquery@1.7.0: + resolution: {integrity: sha512-Ap6G0WQwcU/LHsvLwON1fAQX9Zp0A2Y6Y/cJBl9r/JbW90Zyg4/zbG6zzKa2OTALELarYHmKu0GhpM5EO+7T0g==} + engines: {node: '>=0.10'} + + esrecurse@4.3.0: + resolution: {integrity: sha512-KmfKL3b6G+RXvP8N1vr3Tq1kL/oCFgn2NYXEtqP8/L3pKapUA4G8cFVaoF3SU323CD4XypR/ffioHmkti6/Tag==} + engines: {node: '>=4.0'} + + estraverse@5.3.0: + resolution: {integrity: sha512-MMdARuVEQziNTeJD8DgMqmhwR11BRQ/cBP+pLtYdSTnf3MIO8fFeiINEbX36ZdNlfU/7A9f3gUw49B3oQsvwBA==} + engines: {node: '>=4.0'} + + esutils@2.0.3: + resolution: {integrity: sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==} + engines: {node: '>=0.10.0'} + + fast-deep-equal@3.1.3: + resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} + + fast-json-stable-stringify@2.1.0: + resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==} + + fast-levenshtein@2.0.6: + resolution: {integrity: sha512-DCXu6Ifhqcks7TZKY3Hxp3y6qphY5SJZmrWMDrKcERSOXWQdMhU9Ig/PYrzyw/ul9jOIyh0N4M0tbC5hodg8dw==} + fdir@6.5.0: resolution: {integrity: sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==} engines: {node: '>=12.0.0'} @@ -395,22 +614,80 @@ packages: picomatch: optional: true + file-entry-cache@8.0.0: + resolution: {integrity: sha512-XXTUwCvisa5oacNGRP9SfNtYBNAMi+RPwBFmblZEF7N7swHYQS6/Zfk7SRwx4D5j3CH211YNRco1DEMNVfZCnQ==} + engines: {node: '>=16.0.0'} + + find-up@5.0.0: + resolution: {integrity: sha512-78/PXT1wlLLDgTzDs7sjq9hzz0vXD+zn+7wypEe4fXQxCmdmqfGsEPQxmiCSQI3ajFV91bVSsvNtrJRiW6nGng==} + engines: {node: '>=10'} + fix-dts-default-cjs-exports@1.0.1: resolution: {integrity: sha512-pVIECanWFC61Hzl2+oOCtoJ3F17kglZC/6N94eRWycFgBH35hHx0Li604ZIzhseh97mf2p0cv7vVrOZGoqhlEg==} + flat-cache@4.0.1: + resolution: {integrity: sha512-f7ccFPK3SXFHpx15UIGyRJ/FJQctuKZ0zVuN3frBo4HnK3cay9VEW0R6yPYFHC0AgqhukPzKjq22t5DmAyqGyw==} + engines: {node: '>=16'} + + flatted@3.3.4: + resolution: {integrity: sha512-3+mMldrTAPdta5kjX2G2J7iX4zxtnwpdA8Tr2ZSjkyPSanvbZAcy6flmtnXbEybHrDcU9641lxrMfFuUxVz9vA==} + fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} engines: {node: ^8.16.0 || ^10.6.0 || >=11.0.0} os: [darwin] + glob-parent@6.0.2: + resolution: {integrity: sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==} + engines: {node: '>=10.13.0'} + hijri-core@1.0.0: resolution: {integrity: sha512-wImBZLBKbEWEEUE1nrc1CFY/uvx4XjGNWYChImJZlswXIVhrBCzSVaj6DP1AU2gUMJ6KDh2ygXo/u/Qx232CXA==} engines: {node: '>=20'} + ignore@5.3.2: + resolution: {integrity: sha512-hsBTNUqQTDwkWtcdYI2i06Y/nUBEsNEDJKjWdigLvegy8kDuJAS8uRlpkkcQpyEXL0Z/pjDy5HBmMjRCJ2gq+g==} + engines: {node: '>= 4'} + + ignore@7.0.5: + resolution: {integrity: sha512-Hs59xBNfUIunMFgWAbGX5cq6893IbWg4KnrjbYwX3tx0ztorVgTDA6B2sxf8ejHJ4wz8BqGUMYlnzNBer5NvGg==} + engines: {node: '>= 4'} + + imurmurhash@0.1.4: + resolution: {integrity: sha512-JmXMZ6wuvDmLiHEml9ykzqO6lwFbof0GG4IkcGaENdCRDDmMVnny7s5HsIgHCbaq0w2MyPhDqkhTUgS2LU2PHA==} + engines: {node: '>=0.8.19'} + + is-extglob@2.1.1: + resolution: {integrity: sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==} + engines: {node: '>=0.10.0'} + + is-glob@4.0.3: + resolution: {integrity: sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==} + engines: {node: '>=0.10.0'} + + isexe@2.0.0: + resolution: {integrity: sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==} + joycon@3.1.1: resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} engines: {node: '>=10'} + json-buffer@3.0.1: + resolution: {integrity: sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==} + + json-schema-traverse@0.4.1: + resolution: {integrity: sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==} + + json-stable-stringify-without-jsonify@1.0.1: + resolution: {integrity: sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw==} + + keyv@4.5.4: + resolution: {integrity: sha512-oxVHkHR/EJf2CNXnWxRLW6mg7JyCCUcG0DtEGmL2ctUo1PNTin1PUil+r/+4r5MpVgC/fn1kjsx7mjSujKqIpw==} + + levn@0.4.1: + resolution: {integrity: sha512-+bT2uH4E5LGE7h/n3evcS/sQlJXCpIp6ym8OWJ5eV6+67Dsql/LaaT7qJBAt2rzfoa/5QBGBhxDix1dMt2kQKQ==} + engines: {node: '>= 0.8.0'} + lilconfig@3.1.3: resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==} engines: {node: '>=14'} @@ -422,9 +699,17 @@ packages: resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + locate-path@6.0.0: + resolution: {integrity: sha512-iPZK6eYjbxRu3uB4/WZ3EsEIMJFMqAoopl3R+zuq0UjcAm/MO6KCweDgPfP3elTztoKP3KtnVHxTn2NHBSDVUw==} + engines: {node: '>=10'} + magic-string@0.30.21: resolution: {integrity: sha512-vd2F4YUyEXKGcLHoq+TEyCjxueSeHnFxyyjNp80yg0XV4vUhnDer/lvvlqM/arB5bXQN5K2/3oinyCRyx8T2CQ==} + minimatch@10.2.4: + resolution: {integrity: sha512-oRjTw/97aTBN0RHbYCdtF1MQfvusSIBQM0IZEgzl6426+8jSC0nF1a/GmnVLpfB9yyr6g6FTqWqiZVbxrtaCIg==} + engines: {node: 18 || 20 || >=22} + mlly@1.8.0: resolution: {integrity: sha512-l8D9ODSRWLe2KHJSifWGwBqpTZXIXTeo8mlKjY+E2HAakaTeNpqAyBZ8GSqLzHgw4XmHmC8whvpjJNMbFZN7/g==} @@ -437,10 +722,33 @@ packages: mz@2.7.0: resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + natural-compare@1.4.0: + resolution: {integrity: sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==} + object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} + optionator@0.9.4: + resolution: {integrity: sha512-6IpQ7mKUxRcZNLIObR0hz7lxsapSSIYNZJwXPGeF0mTVqGKFIXj1DQcMoT22S3ROcLyY/rz0PWaWZ9ayWmad9g==} + engines: {node: '>= 0.8.0'} + + p-limit@3.1.0: + resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} + engines: {node: '>=10'} + + p-locate@5.0.0: + resolution: {integrity: sha512-LaNjtRWUBY++zB5nE/NwcaoMylSPk+S+ZHNB1TzdbMJMny6dynpAGt7X/tl/QYq3TIeE6nxHppbo2LGymrG5Pw==} + engines: {node: '>=10'} + + path-exists@4.0.0: + resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} + engines: {node: '>=8'} + + path-key@3.1.1: + resolution: {integrity: sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==} + engines: {node: '>=8'} + pathe@2.0.3: resolution: {integrity: sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w==} @@ -476,6 +784,19 @@ packages: yaml: optional: true + prelude-ls@1.2.1: + resolution: {integrity: sha512-vkcDPrRZo1QZLbn5RLGPpg/WmIQ65qoWWhcGKf/b5eplkkarX0m9z8ppCat4mlOqUsWpyNuYgO3VRyrYHSzX5g==} + engines: {node: '>= 0.8.0'} + + prettier@3.8.1: + resolution: {integrity: sha512-UOnG6LftzbdaHZcKoPFtOcCKztrQ57WkHDeRD9t/PTQtmT0NHSeWWepj6pS0z/N7+08BHFDQVUrfmfMRcZwbMg==} + engines: {node: '>=14'} + hasBin: true + + punycode@2.3.1: + resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==} + engines: {node: '>=6'} + readdirp@4.1.2: resolution: {integrity: sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg==} engines: {node: '>= 14.18.0'} @@ -489,6 +810,19 @@ packages: engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true + semver@7.7.4: + resolution: {integrity: sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==} + engines: {node: '>=10'} + hasBin: true + + shebang-command@2.0.0: + resolution: {integrity: sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==} + engines: {node: '>=8'} + + shebang-regex@3.0.0: + resolution: {integrity: sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==} + engines: {node: '>=8'} + source-map@0.7.6: resolution: {integrity: sha512-i5uvt8C3ikiWeNZSVZNWcfZPItFQOsYTUAOkcUPGd8DqDy1uOUikjt5dG+uRlwyvR108Fb9DOd4GvXfT0N2/uQ==} engines: {node: '>= 12'} @@ -516,6 +850,12 @@ packages: resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} hasBin: true + ts-api-utils@2.4.0: + resolution: {integrity: sha512-3TaVTaAv2gTiMB35i3FiGJaRfwb3Pyn/j3m/bfAvGe8FB7CF6u+LMYqYlDh7reQf7UNvoTvdfAqHGmPGOSsPmA==} + engines: {node: '>=18.12'} + peerDependencies: + typescript: '>=4.8.4' + ts-interface-checker@0.1.13: resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} @@ -538,6 +878,17 @@ packages: typescript: optional: true + type-check@0.4.0: + resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} + engines: {node: '>= 0.8.0'} + + typescript-eslint@8.56.1: + resolution: {integrity: sha512-U4lM6pjmBX7J5wk4szltF7I1cGBHXZopnAXCMXb3+fZ3B/0Z3hq3wS/CCUB2NZBNAExK92mCU2tEohWuwVMsDQ==} + engines: {node: ^18.18.0 || ^20.9.0 || >=21.1.0} + peerDependencies: + eslint: ^8.57.0 || ^9.0.0 || ^10.0.0 + typescript: '>=4.8.4 <6.0.0' + typescript@5.9.3: resolution: {integrity: sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==} engines: {node: '>=14.17'} @@ -546,8 +897,24 @@ packages: ufo@1.6.3: resolution: {integrity: sha512-yDJTmhydvl5lJzBmy/hyOAA0d+aqCBuwl818haVdYCRrWV84o7YyeVm4QlVHStqNrrJSTb6jKuFAVqAFsr+K3Q==} - undici-types@6.21.0: - resolution: {integrity: sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==} + undici-types@7.18.2: + resolution: {integrity: sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==} + + uri-js@4.4.1: + resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} + + which@2.0.2: + resolution: {integrity: sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==} + engines: {node: '>= 8'} + hasBin: true + + word-wrap@1.2.5: + resolution: {integrity: sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==} + engines: {node: '>=0.10.0'} + + yocto-queue@0.1.0: + resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} + engines: {node: '>=10'} snapshots: @@ -629,6 +996,51 @@ snapshots: '@esbuild/win32-x64@0.27.3': optional: true + '@eslint-community/eslint-utils@4.9.1(eslint@10.0.3)': + dependencies: + eslint: 10.0.3 + eslint-visitor-keys: 3.4.3 + + '@eslint-community/regexpp@4.12.2': {} + + '@eslint/config-array@0.23.3': + dependencies: + '@eslint/object-schema': 3.0.3 + debug: 4.4.3 + minimatch: 10.2.4 + transitivePeerDependencies: + - supports-color + + '@eslint/config-helpers@0.5.3': + dependencies: + '@eslint/core': 1.1.1 + + '@eslint/core@1.1.1': + dependencies: + '@types/json-schema': 7.0.15 + + '@eslint/js@10.0.1(eslint@10.0.3)': + optionalDependencies: + eslint: 10.0.3 + + '@eslint/object-schema@3.0.3': {} + + '@eslint/plugin-kit@0.6.1': + dependencies: + '@eslint/core': 1.1.1 + levn: 0.4.1 + + '@humanfs/core@0.19.1': {} + + '@humanfs/node@0.16.7': + dependencies: + '@humanfs/core': 0.19.1 + '@humanwhocodes/retry': 0.4.3 + + '@humanwhocodes/module-importer@1.0.1': {} + + '@humanwhocodes/retry@0.4.3': {} + '@jridgewell/gen-mapping@0.3.13': dependencies: '@jridgewell/sourcemap-codec': 1.5.5 @@ -718,16 +1130,128 @@ snapshots: '@rollup/rollup-win32-x64-msvc@4.59.0': optional: true + '@types/esrecurse@4.3.1': {} + '@types/estree@1.0.8': {} - '@types/node@22.19.11': + '@types/json-schema@7.0.15': {} + + '@types/node@25.3.5': dependencies: - undici-types: 6.21.0 + undici-types: 7.18.2 + + '@typescript-eslint/eslint-plugin@8.56.1(@typescript-eslint/parser@8.56.1(eslint@10.0.3)(typescript@5.9.3))(eslint@10.0.3)(typescript@5.9.3)': + dependencies: + '@eslint-community/regexpp': 4.12.2 + '@typescript-eslint/parser': 8.56.1(eslint@10.0.3)(typescript@5.9.3) + '@typescript-eslint/scope-manager': 8.56.1 + '@typescript-eslint/type-utils': 8.56.1(eslint@10.0.3)(typescript@5.9.3) + '@typescript-eslint/utils': 8.56.1(eslint@10.0.3)(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.56.1 + eslint: 10.0.3 + ignore: 7.0.5 + natural-compare: 1.4.0 + ts-api-utils: 2.4.0(typescript@5.9.3) + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/parser@8.56.1(eslint@10.0.3)(typescript@5.9.3)': + dependencies: + '@typescript-eslint/scope-manager': 8.56.1 + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3) + '@typescript-eslint/visitor-keys': 8.56.1 + debug: 4.4.3 + eslint: 10.0.3 + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/project-service@8.56.1(typescript@5.9.3)': + dependencies: + '@typescript-eslint/tsconfig-utils': 8.56.1(typescript@5.9.3) + '@typescript-eslint/types': 8.56.1 + debug: 4.4.3 + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/scope-manager@8.56.1': + dependencies: + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/visitor-keys': 8.56.1 + + '@typescript-eslint/tsconfig-utils@8.56.1(typescript@5.9.3)': + dependencies: + typescript: 5.9.3 + + '@typescript-eslint/type-utils@8.56.1(eslint@10.0.3)(typescript@5.9.3)': + dependencies: + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3) + '@typescript-eslint/utils': 8.56.1(eslint@10.0.3)(typescript@5.9.3) + debug: 4.4.3 + eslint: 10.0.3 + ts-api-utils: 2.4.0(typescript@5.9.3) + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/types@8.56.1': {} + + '@typescript-eslint/typescript-estree@8.56.1(typescript@5.9.3)': + dependencies: + '@typescript-eslint/project-service': 8.56.1(typescript@5.9.3) + '@typescript-eslint/tsconfig-utils': 8.56.1(typescript@5.9.3) + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/visitor-keys': 8.56.1 + debug: 4.4.3 + minimatch: 10.2.4 + semver: 7.7.4 + tinyglobby: 0.2.15 + ts-api-utils: 2.4.0(typescript@5.9.3) + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/utils@8.56.1(eslint@10.0.3)(typescript@5.9.3)': + dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@10.0.3) + '@typescript-eslint/scope-manager': 8.56.1 + '@typescript-eslint/types': 8.56.1 + '@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3) + eslint: 10.0.3 + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + + '@typescript-eslint/visitor-keys@8.56.1': + dependencies: + '@typescript-eslint/types': 8.56.1 + eslint-visitor-keys: 5.0.1 + + acorn-jsx@5.3.2(acorn@8.16.0): + dependencies: + acorn: 8.16.0 acorn@8.16.0: {} + ajv@6.14.0: + dependencies: + fast-deep-equal: 3.1.3 + fast-json-stable-stringify: 2.1.0 + json-schema-traverse: 0.4.1 + uri-js: 4.4.1 + any-promise@1.3.0: {} + balanced-match@4.0.4: {} + + brace-expansion@5.0.4: + dependencies: + balanced-match: 4.0.4 + bundle-require@5.1.0(esbuild@0.27.3): dependencies: esbuild: 0.27.3 @@ -745,10 +1269,18 @@ snapshots: consola@3.4.2: {} + cross-spawn@7.0.6: + dependencies: + path-key: 3.1.1 + shebang-command: 2.0.0 + which: 2.0.2 + debug@4.4.3: dependencies: ms: 2.1.3 + deep-is@0.1.4: {} + esbuild@0.27.3: optionalDependencies: '@esbuild/aix-ppc64': 0.27.3 @@ -778,33 +1310,166 @@ snapshots: '@esbuild/win32-ia32': 0.27.3 '@esbuild/win32-x64': 0.27.3 + escape-string-regexp@4.0.0: {} + + eslint-config-prettier@10.1.8(eslint@10.0.3): + dependencies: + eslint: 10.0.3 + + eslint-scope@9.1.2: + dependencies: + '@types/esrecurse': 4.3.1 + '@types/estree': 1.0.8 + esrecurse: 4.3.0 + estraverse: 5.3.0 + + eslint-visitor-keys@3.4.3: {} + + eslint-visitor-keys@5.0.1: {} + + eslint@10.0.3: + dependencies: + '@eslint-community/eslint-utils': 4.9.1(eslint@10.0.3) + '@eslint-community/regexpp': 4.12.2 + '@eslint/config-array': 0.23.3 + '@eslint/config-helpers': 0.5.3 + '@eslint/core': 1.1.1 + '@eslint/plugin-kit': 0.6.1 + '@humanfs/node': 0.16.7 + '@humanwhocodes/module-importer': 1.0.1 + '@humanwhocodes/retry': 0.4.3 + '@types/estree': 1.0.8 + ajv: 6.14.0 + cross-spawn: 7.0.6 + debug: 4.4.3 + escape-string-regexp: 4.0.0 + eslint-scope: 9.1.2 + eslint-visitor-keys: 5.0.1 + espree: 11.2.0 + esquery: 1.7.0 + esutils: 2.0.3 + fast-deep-equal: 3.1.3 + file-entry-cache: 8.0.0 + find-up: 5.0.0 + glob-parent: 6.0.2 + ignore: 5.3.2 + imurmurhash: 0.1.4 + is-glob: 4.0.3 + json-stable-stringify-without-jsonify: 1.0.1 + minimatch: 10.2.4 + natural-compare: 1.4.0 + optionator: 0.9.4 + transitivePeerDependencies: + - supports-color + + espree@11.2.0: + dependencies: + acorn: 8.16.0 + acorn-jsx: 5.3.2(acorn@8.16.0) + eslint-visitor-keys: 5.0.1 + + esquery@1.7.0: + dependencies: + estraverse: 5.3.0 + + esrecurse@4.3.0: + dependencies: + estraverse: 5.3.0 + + estraverse@5.3.0: {} + + esutils@2.0.3: {} + + fast-deep-equal@3.1.3: {} + + fast-json-stable-stringify@2.1.0: {} + + fast-levenshtein@2.0.6: {} + fdir@6.5.0(picomatch@4.0.3): optionalDependencies: picomatch: 4.0.3 + file-entry-cache@8.0.0: + dependencies: + flat-cache: 4.0.1 + + find-up@5.0.0: + dependencies: + locate-path: 6.0.0 + path-exists: 4.0.0 + fix-dts-default-cjs-exports@1.0.1: dependencies: magic-string: 0.30.21 mlly: 1.8.0 rollup: 4.59.0 + flat-cache@4.0.1: + dependencies: + flatted: 3.3.4 + keyv: 4.5.4 + + flatted@3.3.4: {} + fsevents@2.3.3: optional: true + glob-parent@6.0.2: + dependencies: + is-glob: 4.0.3 + hijri-core@1.0.0: {} + ignore@5.3.2: {} + + ignore@7.0.5: {} + + imurmurhash@0.1.4: {} + + is-extglob@2.1.1: {} + + is-glob@4.0.3: + dependencies: + is-extglob: 2.1.1 + + isexe@2.0.0: {} + joycon@3.1.1: {} + json-buffer@3.0.1: {} + + json-schema-traverse@0.4.1: {} + + json-stable-stringify-without-jsonify@1.0.1: {} + + keyv@4.5.4: + dependencies: + json-buffer: 3.0.1 + + levn@0.4.1: + dependencies: + prelude-ls: 1.2.1 + type-check: 0.4.0 + lilconfig@3.1.3: {} lines-and-columns@1.2.4: {} load-tsconfig@0.2.5: {} + locate-path@6.0.0: + dependencies: + p-locate: 5.0.0 + magic-string@0.30.21: dependencies: '@jridgewell/sourcemap-codec': 1.5.5 + minimatch@10.2.4: + dependencies: + brace-expansion: 5.0.4 + mlly@1.8.0: dependencies: acorn: 8.16.0 @@ -822,8 +1487,31 @@ snapshots: object-assign: 4.1.1 thenify-all: 1.6.0 + natural-compare@1.4.0: {} + object-assign@4.1.1: {} + optionator@0.9.4: + dependencies: + deep-is: 0.1.4 + fast-levenshtein: 2.0.6 + levn: 0.4.1 + prelude-ls: 1.2.1 + type-check: 0.4.0 + word-wrap: 1.2.5 + + p-limit@3.1.0: + dependencies: + yocto-queue: 0.1.0 + + p-locate@5.0.0: + dependencies: + p-limit: 3.1.0 + + path-exists@4.0.0: {} + + path-key@3.1.1: {} + pathe@2.0.3: {} picocolors@1.1.1: {} @@ -842,6 +1530,12 @@ snapshots: dependencies: lilconfig: 3.1.3 + prelude-ls@1.2.1: {} + + prettier@3.8.1: {} + + punycode@2.3.1: {} + readdirp@4.1.2: {} resolve-from@5.0.0: {} @@ -877,6 +1571,14 @@ snapshots: '@rollup/rollup-win32-x64-msvc': 4.59.0 fsevents: 2.3.3 + semver@7.7.4: {} + + shebang-command@2.0.0: + dependencies: + shebang-regex: 3.0.0 + + shebang-regex@3.0.0: {} + source-map@0.7.6: {} sucrase@3.35.1: @@ -906,6 +1608,10 @@ snapshots: tree-kill@1.2.2: {} + ts-api-utils@2.4.0(typescript@5.9.3): + dependencies: + typescript: 5.9.3 + ts-interface-checker@0.1.13: {} tsup@8.5.1(typescript@5.9.3): @@ -935,8 +1641,35 @@ snapshots: - tsx - yaml + type-check@0.4.0: + dependencies: + prelude-ls: 1.2.1 + + typescript-eslint@8.56.1(eslint@10.0.3)(typescript@5.9.3): + dependencies: + '@typescript-eslint/eslint-plugin': 8.56.1(@typescript-eslint/parser@8.56.1(eslint@10.0.3)(typescript@5.9.3))(eslint@10.0.3)(typescript@5.9.3) + '@typescript-eslint/parser': 8.56.1(eslint@10.0.3)(typescript@5.9.3) + '@typescript-eslint/typescript-estree': 8.56.1(typescript@5.9.3) + '@typescript-eslint/utils': 8.56.1(eslint@10.0.3)(typescript@5.9.3) + eslint: 10.0.3 + typescript: 5.9.3 + transitivePeerDependencies: + - supports-color + typescript@5.9.3: {} ufo@1.6.3: {} - undici-types@6.21.0: {} + undici-types@7.18.2: {} + + uri-js@4.4.1: + dependencies: + punycode: 2.3.1 + + which@2.0.2: + dependencies: + isexe: 2.0.0 + + word-wrap@1.2.5: {} + + yocto-queue@0.1.0: {} diff --git a/src/index.ts b/src/index.ts index ffcd2c9..2f2e4fe 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,14 +1,6 @@ import moment from 'moment'; import type { Moment as MomentInstance } from 'moment'; -import { - toHijri, - toGregorian, - hmLong, - hmMedium, - hwLong, - hwShort, - hwNumeric, -} from 'hijri-core'; +import { toHijri, toGregorian, hmLong, hmMedium, hwLong, hwShort, hwNumeric } from 'hijri-core'; import type { HijriDate, ConversionOptions } from './types'; declare module 'moment' { @@ -54,8 +46,7 @@ declare module 'moment' { // Regex matching all Hijri format tokens. Ordered longest-first so iYYYY is // matched before iYY, iMMMM before iMMM, iDD before iD, iEEEE before iEEE. -const HIJRI_TOKEN_RE = - /iYYYY|iYY|iMMMM|iMMM|iMM|iM|iDD|iD|iEEEE|iEEE|iE|ioooo|iooo/g; +const HIJRI_TOKEN_RE = /iYYYY|iYY|iMMMM|iMMM|iMM|iM|iDD|iD|iEEEE|iEEE|iE|ioooo|iooo/g; /** * Escape a literal string so moment.format() treats it as literal text. @@ -94,37 +85,47 @@ function install(momentInstance: typeof moment): void { return this.toHijri(opts) !== null; }; - momentInstance.fn.formatHijri = function ( - formatStr: string, - opts?: ConversionOptions, - ): string { + momentInstance.fn.formatHijri = function (formatStr: string, opts?: ConversionOptions): string { const hijri = this.toHijri(opts); if (!hijri) return ''; - const m = this; + const dow = this.day(); // Replace Hijri tokens with escaped literals, then pass the residual string // to moment.format() so all standard tokens (YYYY, MMM, etc.) resolve correctly. // Escaping is required because values like "Ramadan" would otherwise be // interpreted by moment as format tokens (R, a, m, etc.). const residual = formatStr.replace(HIJRI_TOKEN_RE, (token: string): string => { switch (token) { - case 'iYYYY': return escapeLiteral(String(hijri.hy).padStart(4, '0')); - case 'iYY': return escapeLiteral(String(hijri.hy % 100).padStart(2, '0')); - case 'iMMMM': return escapeLiteral(hmLong[hijri.hm - 1]); - case 'iMMM': return escapeLiteral(hmMedium[hijri.hm - 1]); - case 'iMM': return escapeLiteral(String(hijri.hm).padStart(2, '0')); - case 'iM': return escapeLiteral(String(hijri.hm)); - case 'iDD': return escapeLiteral(String(hijri.hd).padStart(2, '0')); - case 'iD': return escapeLiteral(String(hijri.hd)); - case 'iEEEE': return escapeLiteral(hwLong[m.day()]); - case 'iEEE': return escapeLiteral(hwShort[m.day()]); - case 'iE': return escapeLiteral(String(hwNumeric[m.day()])); + case 'iYYYY': + return escapeLiteral(String(hijri.hy).padStart(4, '0')); + case 'iYY': + return escapeLiteral(String(hijri.hy % 100).padStart(2, '0')); + case 'iMMMM': + return escapeLiteral(hmLong[hijri.hm - 1]); + case 'iMMM': + return escapeLiteral(hmMedium[hijri.hm - 1]); + case 'iMM': + return escapeLiteral(String(hijri.hm).padStart(2, '0')); + case 'iM': + return escapeLiteral(String(hijri.hm)); + case 'iDD': + return escapeLiteral(String(hijri.hd).padStart(2, '0')); + case 'iD': + return escapeLiteral(String(hijri.hd)); + case 'iEEEE': + return escapeLiteral(hwLong[dow]); + case 'iEEE': + return escapeLiteral(hwShort[dow]); + case 'iE': + return escapeLiteral(String(hwNumeric[dow])); // Era tokens: both iooo and ioooo map to the common abbreviation. case 'iooo': - case 'ioooo': return escapeLiteral('AH'); - default: return token; + case 'ioooo': + return escapeLiteral('AH'); + default: + return token; } }); - return m.format(residual); + return this.format(residual); }; // Attach fromHijri as a property on the constructor. We use a type assertion diff --git a/test-cjs.cjs b/test-cjs.cjs index abf7dcd..124bbde 100644 --- a/test-cjs.cjs +++ b/test-cjs.cjs @@ -1,75 +1,63 @@ 'use strict'; +const { describe, it } = require('node:test'); const assert = require('node:assert/strict'); const moment = require('moment'); const installHijri = require('./dist/index.cjs'); installHijri.default(moment); -let passed = 0; -let total = 0; - -function test(name, fn) { - total++; - try { - fn(); - console.log(`[${name}]... PASS`); - passed++; - } catch (err) { - console.error(`[${name}]... FAIL: ${err.message}`); - process.exit(1); - } -} - -// 1. Plugin installs -test('plugin installs (CJS)', () => { - assert.equal(typeof moment.fn.toHijri, 'function'); - assert.equal(typeof moment.fn.formatHijri, 'function'); - assert.equal(typeof moment.fromHijri, 'function'); +describe('CJS: plugin installation', () => { + it('installs all methods', () => { + assert.equal(typeof moment.fn.toHijri, 'function'); + assert.equal(typeof moment.fn.formatHijri, 'function'); + assert.equal(typeof moment.fromHijri, 'function'); + }); }); -// 2. toHijri -test('toHijri: 2023-03-23 => 1444/9/1 (CJS)', () => { - const h = moment(new Date(2023, 2, 23, 12)).toHijri(); - assert.notEqual(h, null); - assert.equal(h.hy, 1444); - assert.equal(h.hm, 9); - assert.equal(h.hd, 1); +describe('CJS: toHijri', () => { + it('2023-03-23 => 1444/9/1', () => { + const h = moment(new Date(2023, 2, 23, 12)).toHijri(); + assert.notEqual(h, null); + assert.equal(h.hy, 1444); + assert.equal(h.hm, 9); + assert.equal(h.hd, 1); + }); }); -// 3. fromHijri -test('fromHijri: 1444/9/1 => 2023-03-23 (CJS)', () => { - const d = moment.fromHijri(1444, 9, 1).toDate(); - assert.equal(d.getFullYear(), 2023); - assert.equal(d.getMonth(), 2); - assert.equal(d.getDate(), 23); +describe('CJS: fromHijri', () => { + it('1444/9/1 => 2023-03-23', () => { + const d = moment.fromHijri(1444, 9, 1).toDate(); + assert.equal(d.getFullYear(), 2023); + assert.equal(d.getMonth(), 2); + assert.equal(d.getDate(), 23); + }); + + it('throws on out-of-range date', () => { + assert.throws(() => moment.fromHijri(999, 1, 1), /Invalid or out-of-range/); + }); }); -// 4. formatHijri: numeric -test('formatHijri: iYYYY-iMM-iDD (CJS)', () => { - const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iYYYY-iMM-iDD'); - assert.equal(result, '1444-09-01'); +describe('CJS: formatHijri', () => { + it('iYYYY-iMM-iDD', () => { + const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iYYYY-iMM-iDD'); + assert.equal(result, '1444-09-01'); + }); + + it('iMMMM => Ramadan', () => { + const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iMMMM'); + assert.equal(result, 'Ramadan'); + }); }); -// 5. formatHijri: month name -test('formatHijri: iMMMM => Ramadan (CJS)', () => { - const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iMMMM'); - assert.equal(result, 'Ramadan'); +describe('CJS: accessors', () => { + it('hijriYear: 1444', () => { + assert.equal(moment(new Date(2023, 2, 23, 12)).hijriYear(), 1444); + }); }); -// 6. fromHijri throws for invalid date -test('fromHijri throws on out-of-range date (CJS)', () => { - assert.throws(() => moment.fromHijri(999, 1, 1), /Invalid or out-of-range/); +describe('CJS: isValidHijri', () => { + it('true for valid date', () => { + assert.equal(moment(new Date(2023, 2, 23, 12)).isValidHijri(), true); + }); }); - -// 7. hijriYear accessor -test('hijriYear: 1444 (CJS)', () => { - assert.equal(moment(new Date(2023, 2, 23, 12)).hijriYear(), 1444); -}); - -// 8. isValidHijri -test('isValidHijri: true for valid date (CJS)', () => { - assert.equal(moment(new Date(2023, 2, 23, 12)).isValidHijri(), true); -}); - -console.log(`\n${passed}/${total} tests passed`); diff --git a/test.mjs b/test.mjs index 627fa6d..e8c0d33 100644 --- a/test.mjs +++ b/test.mjs @@ -1,129 +1,112 @@ +import { describe, it } from 'node:test'; import assert from 'node:assert/strict'; import moment from 'moment'; import installHijri from './dist/index.mjs'; installHijri(moment); -let passed = 0; -let total = 0; - -function test(name, fn) { - total++; - try { - fn(); - console.log(`[${name}]... PASS`); - passed++; - } catch (err) { - console.error(`[${name}]... FAIL: ${err.message}`); - process.exit(1); - } -} - -// 1. Plugin installs -test('plugin installs', () => { - assert.equal(typeof moment.fn.toHijri, 'function'); - assert.equal(typeof moment.fn.hijriYear, 'function'); - assert.equal(typeof moment.fn.hijriMonth, 'function'); - assert.equal(typeof moment.fn.hijriDay, 'function'); - assert.equal(typeof moment.fn.isValidHijri, 'function'); - assert.equal(typeof moment.fn.formatHijri, 'function'); - assert.equal(typeof moment.fromHijri, 'function'); +describe('plugin installation', () => { + it('installs all methods', () => { + assert.equal(typeof moment.fn.toHijri, 'function'); + assert.equal(typeof moment.fn.hijriYear, 'function'); + assert.equal(typeof moment.fn.hijriMonth, 'function'); + assert.equal(typeof moment.fn.hijriDay, 'function'); + assert.equal(typeof moment.fn.isValidHijri, 'function'); + assert.equal(typeof moment.fn.formatHijri, 'function'); + assert.equal(typeof moment.fromHijri, 'function'); + }); }); -// 2. toHijri: 1 Ramadan 1444 AH -test('toHijri: 2023-03-23 => 1444/9/1', () => { - const h = moment(new Date(2023, 2, 23, 12)).toHijri(); - assert.notEqual(h, null); - assert.equal(h.hy, 1444); - assert.equal(h.hm, 9); - assert.equal(h.hd, 1); +describe('toHijri', () => { + it('2023-03-23 => 1444/9/1', () => { + const h = moment(new Date(2023, 2, 23, 12)).toHijri(); + assert.notEqual(h, null); + assert.equal(h.hy, 1444); + assert.equal(h.hm, 9); + assert.equal(h.hd, 1); + }); + + it('2024-07-07 => 1446/1/1', () => { + const h = moment(new Date(2024, 6, 7, 12)).toHijri(); + assert.notEqual(h, null); + assert.equal(h.hy, 1446); + assert.equal(h.hm, 1); + assert.equal(h.hd, 1); + }); }); -// 3. toHijri: 1 Muharram 1446 AH -test('toHijri: 2024-07-07 => 1446/1/1', () => { - const h = moment(new Date(2024, 6, 7, 12)).toHijri(); - assert.notEqual(h, null); - assert.equal(h.hy, 1446); - assert.equal(h.hm, 1); - assert.equal(h.hd, 1); +describe('fromHijri', () => { + it('1444/9/1 => 2023-03-23', () => { + const m = moment.fromHijri(1444, 9, 1); + const d = m.toDate(); + assert.equal(d.getFullYear(), 2023); + assert.equal(d.getMonth(), 2); + assert.equal(d.getDate(), 23); + }); + + it('1446/1/1 => 2024-07-07', () => { + const m = moment.fromHijri(1446, 1, 1); + const d = m.toDate(); + assert.equal(d.getFullYear(), 2024); + assert.equal(d.getMonth(), 6); + assert.equal(d.getDate(), 7); + }); + + it('throws on out-of-range Hijri date', () => { + assert.throws(() => moment.fromHijri(999, 1, 1), /Invalid or out-of-range/); + }); }); -// 4. fromHijri: 1444/9/1 => 2023-03-23 -test('fromHijri: 1444/9/1 => 2023-03-23', () => { - const m = moment.fromHijri(1444, 9, 1); - const d = m.toDate(); - assert.equal(d.getFullYear(), 2023); - assert.equal(d.getMonth(), 2); // March = 2 - assert.equal(d.getDate(), 23); +describe('accessors', () => { + it('hijriYear, hijriMonth, hijriDay on 1 Ramadan 1444', () => { + const m = moment(new Date(2023, 2, 23, 12)); + assert.equal(m.hijriYear(), 1444); + assert.equal(m.hijriMonth(), 9); + assert.equal(m.hijriDay(), 1); + }); }); -// 5. fromHijri: 1446/1/1 => 2024-07-07 -test('fromHijri: 1446/1/1 => 2024-07-07', () => { - const m = moment.fromHijri(1446, 1, 1); - const d = m.toDate(); - assert.equal(d.getFullYear(), 2024); - assert.equal(d.getMonth(), 6); // July = 6 - assert.equal(d.getDate(), 7); +describe('formatHijri', () => { + it('iYYYY-iMM-iDD', () => { + const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iYYYY-iMM-iDD'); + assert.equal(result, '1444-09-01'); + }); + + it('iMMMM => Ramadan', () => { + const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iMMMM'); + assert.equal(result, 'Ramadan'); + }); + + it('iEEEE on Thursday 2023-03-23', () => { + const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iEEEE'); + assert.equal(result, 'Yawm al-Khamis'); + }); + + it('ioooo => AH', () => { + const result = moment(new Date(2023, 2, 23, 12)).formatHijri('ioooo'); + assert.equal(result, 'AH'); + }); + + it('mixed Hijri and Gregorian tokens', () => { + const m = moment(new Date(2023, 2, 23, 12)); + const result = m.formatHijri('iYYYY [CE:] YYYY'); + assert.ok(result.includes('1444'), `Expected Hijri year in: ${result}`); + assert.ok(result.includes('2023'), `Expected Gregorian year in: ${result}`); + }); }); -// 6. hijriYear / hijriMonth / hijriDay -test('hijriYear, hijriMonth, hijriDay on 1 Ramadan 1444', () => { - const m = moment(new Date(2023, 2, 23, 12)); - assert.equal(m.hijriYear(), 1444); - assert.equal(m.hijriMonth(), 9); - assert.equal(m.hijriDay(), 1); +describe('isValidHijri', () => { + it('true for valid date', () => { + assert.equal(moment(new Date(2023, 2, 23, 12)).isValidHijri(), true); + }); }); -// 7. formatHijri: numeric format -test('formatHijri: iYYYY-iMM-iDD', () => { - const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iYYYY-iMM-iDD'); - assert.equal(result, '1444-09-01'); +describe('FCNA calendar', () => { + it('toHijri with { calendar: fcna } returns a HijriDate', () => { + const h = moment(new Date(2023, 2, 23, 12)).toHijri({ calendar: 'fcna' }); + assert.notEqual(h, null); + assert.equal(typeof h.hy, 'number'); + assert.equal(typeof h.hm, 'number'); + assert.equal(typeof h.hd, 'number'); + }); }); - -// 8. formatHijri: long month name -test('formatHijri: iMMMM => Ramadan', () => { - const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iMMMM'); - assert.equal(result, 'Ramadan'); -}); - -// 9. formatHijri: long weekday name (Thursday = Yawm al-Khamis) -test('formatHijri: iEEEE on Thursday 2023-03-23', () => { - const result = moment(new Date(2023, 2, 23, 12)).formatHijri('iEEEE'); - assert.equal(result, 'Yawm al-Khamis'); -}); - -// 10. formatHijri: era token -test('formatHijri: ioooo => AH', () => { - const result = moment(new Date(2023, 2, 23, 12)).formatHijri('ioooo'); - assert.equal(result, 'AH'); -}); - -// 11. isValidHijri: returns true for in-range date -test('isValidHijri: true for valid date', () => { - assert.equal(moment(new Date(2023, 2, 23, 12)).isValidHijri(), true); -}); - -// 12. FCNA calendar option -test('toHijri with { calendar: fcna } returns a HijriDate', () => { - const h = moment(new Date(2023, 2, 23, 12)).toHijri({ calendar: 'fcna' }); - assert.notEqual(h, null); - assert.equal(typeof h.hy, 'number'); - assert.equal(typeof h.hm, 'number'); - assert.equal(typeof h.hd, 'number'); -}); - -// 13. fromHijri throws for out-of-range date -test('fromHijri throws on out-of-range Hijri date', () => { - assert.throws(() => moment.fromHijri(999, 1, 1), /Invalid or out-of-range/); -}); - -// 14. formatHijri: mixed Hijri and Gregorian tokens -test('formatHijri: mixed Hijri and Gregorian tokens', () => { - const m = moment(new Date(2023, 2, 23, 12)); - const result = m.formatHijri('iYYYY [CE:] YYYY'); - // Hijri year should be 1444; Gregorian year should be 2023. - assert.ok(result.includes('1444'), `Expected Hijri year in: ${result}`); - assert.ok(result.includes('2023'), `Expected Gregorian year in: ${result}`); -}); - -console.log(`\n${passed}/${total} tests passed`); diff --git a/tsconfig.json b/tsconfig.json index 15d848f..0b83037 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -9,6 +9,8 @@ "allowSyntheticDefaultImports": true, "declaration": true, "declarationMap": true, + "noImplicitReturns": true, + "noFallthroughCasesInSwitch": true, "sourceMap": true, "outDir": "dist", "rootDir": "src", diff --git a/tsup.config.ts b/tsup.config.ts index 956cd6b..3338af6 100644 --- a/tsup.config.ts +++ b/tsup.config.ts @@ -7,9 +7,9 @@ export default defineConfig({ clean: true, outDir: 'dist', splitting: false, - sourcemap: true, + sourcemap: false, target: 'es2020', - platform: 'node', + platform: 'neutral', external: ['moment', 'hijri-core'], outExtension({ format }) { return { js: format === 'esm' ? '.mjs' : '.cjs' };