diff --git a/.gitignore b/.gitignore index 1096dab..ceb39b2 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ .DS_Store node_modules dist +build/ # local history folder -/.history \ No newline at end of file +/.history diff --git a/.vscode/settings.json b/.vscode/settings.json index 811ad5c..eed65aa 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,20 +1,45 @@ { - "typescript.validate.enable": true, - "editor.defaultFormatter": "esbenp.prettier-vscode", - "editor.formatOnSave": true, - "editor.formatOnPaste": true, - "files.trimTrailingWhitespace": true, - "[markdown]": { - "files.trimTrailingWhitespace": false - }, - "files.exclude": { - "**/.git": true, - "**/.svn": true, - "**/.hg": true, - "**/.history": true, - "**/CVS": true, - "**/.DS_Store": true, - "**/*.js.map": true, - "node_modules": true - } + "typescript.validate.enable": true, + "typescript.tsdk": "./node_modules/typescript/lib", + "editor.defaultFormatter": "esbenp.prettier-vscode", + "editor.formatOnSave": true, + "editor.formatOnPaste": true, + "files.trimTrailingWhitespace": true, + "files.autoSave": "onFocusChange", + "[markdown]": { + "files.trimTrailingWhitespace": false + }, + "files.exclude": { + "**/.git": true, + "**/.svn": true, + "**/.hg": true, + "**/.history": true, + "**/CVS": true, + "**/.DS_Store": true, + "**/*.js.map": true, + "node_modules": true + }, + "markdownlint.config": { + "MD007": { + "indent": 4 + }, + "MD026": false, + "MD033": false, + "MD030": { + "ul_single": 3, + "ul_multi": 3 + } + }, + "editor.codeActionsOnSave": { + "source.fixAll.markdownlint": "explicit" + }, + "[dotenv]": { + "editor.formatOnSave": false + }, + "json.schemas": [ + { + "url": "./tsup.schema.json", + "fileMatch": ["package.json", "tsup.config.json"] + } + ] } diff --git a/package.json b/package.json index 36322eb..c84af72 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "main": "dist/index.js", "module": "dist/crestron-ch5-helper.esm.js", "typings": "dist/index.d.ts", + "type": "module", "repository": { "type": "git", "url": "https://github.com/Norgate-AV/crestron-ch5-helper.git" @@ -28,10 +29,10 @@ "scripts": { "start": "tsdx watch", "prebuild": "pnpm clean && pnpm lint:fix", - "build": "tsdx build", - "test": "tsdx test --passWithNoTests", - "lint": "eslint .", - "lint:fix": "eslint . --fix", + "build": "tsup", + "test": "vitest", + "lint": "tsc && eslint .", + "lint:fix": "tsc && eslint . --fix", "prepare": "husky", "size": "size-limit", "analyze": "size-limit --why", @@ -60,6 +61,7 @@ "@semantic-release/changelog": "^6.0.3", "@semantic-release/git": "^10.0.1", "@size-limit/preset-small-lib": "^11.0.2", + "@types/node": "^20.11.17", "@typescript-eslint/eslint-plugin": "^7.0.1", "@typescript-eslint/parser": "^7.0.1", "all-contributors-cli": "^6.20.0", @@ -72,8 +74,11 @@ "rimraf": "^5.0.5", "semantic-release": "^23.0.2", "size-limit": "^11.0.2", + "terser": "^5.27.0", "tsdx": "^0.14.1", "tslib": "^2.6.2", - "typescript": "^5.3.3" + "tsup": "^8.0.2", + "typescript": "^5.3.3", + "vitest": "^1.2.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef066a9..41b1f22 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -20,6 +20,9 @@ devDependencies: "@size-limit/preset-small-lib": specifier: ^11.0.2 version: 11.0.2(size-limit@11.0.2) + "@types/node": + specifier: ^20.11.17 + version: 20.11.17 "@typescript-eslint/eslint-plugin": specifier: ^7.0.1 version: 7.0.1(@typescript-eslint/parser@7.0.1)(eslint@8.56.0)(typescript@5.3.3) @@ -56,15 +59,24 @@ devDependencies: size-limit: specifier: ^11.0.2 version: 11.0.2 + terser: + specifier: ^5.27.0 + version: 5.27.0 tsdx: specifier: ^0.14.1 version: 0.14.1(@types/node@20.11.17) tslib: specifier: ^2.6.2 version: 2.6.2 + tsup: + specifier: ^8.0.2 + version: 8.0.2(typescript@5.3.3) typescript: specifier: ^5.3.3 version: 5.3.3 + vitest: + specifier: ^1.2.2 + version: 1.2.2(@types/node@20.11.17)(terser@5.27.0) packages: /@aashutoshrathi/word-wrap@1.2.6: @@ -2391,6 +2403,16 @@ packages: - supports-color dev: 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 + /@jest/source-map@25.5.0: resolution: { @@ -2503,6 +2525,16 @@ packages: engines: { node: ">=6.0.0" } dev: true + /@jridgewell/source-map@0.3.5: + resolution: + { + integrity: sha512-UTYAUj/wviwdsMfzoSJspJxbkH5o1snzwX0//0ENX1u/55kkZZkcTZP6u9bwKGkv+dkk9at4m1Cpt0uY80kcpQ==, + } + dependencies: + "@jridgewell/gen-mapping": 0.3.3 + "@jridgewell/trace-mapping": 0.3.22 + dev: true + /@jridgewell/sourcemap-codec@1.4.15: resolution: { @@ -2817,6 +2849,149 @@ packages: rollup: 1.32.1 dev: true + /@rollup/rollup-android-arm-eabi@4.10.0: + resolution: + { + integrity: sha512-/MeDQmcD96nVoRumKUljsYOLqfv1YFJps+0pTrb2Z9Nl/w5qNUysMaWQsrd1mvAlNT4yza1iVyIu4Q4AgF6V3A==, + } + cpu: [arm] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-android-arm64@4.10.0: + resolution: + { + integrity: sha512-lvu0jK97mZDJdpZKDnZI93I0Om8lSDaiPx3OiCk0RXn3E8CMPJNS/wxjAvSJJzhhZpfjXsjLWL8LnS6qET4VNQ==, + } + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-arm64@4.10.0: + resolution: + { + integrity: sha512-uFpayx8I8tyOvDkD7X6n0PriDRWxcqEjqgtlxnUA/G9oS93ur9aZ8c8BEpzFmsed1TH5WZNG5IONB8IiW90TQg==, + } + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-darwin-x64@4.10.0: + resolution: + { + integrity: sha512-nIdCX03qFKoR/MwQegQBK+qZoSpO3LESurVAC6s6jazLA1Mpmgzo3Nj3H1vydXp/JM29bkCiuF7tDuToj4+U9Q==, + } + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm-gnueabihf@4.10.0: + resolution: + { + integrity: sha512-Fz7a+y5sYhYZMQFRkOyCs4PLhICAnxRX/GnWYReaAoruUzuRtcf+Qnw+T0CoAWbHCuz2gBUwmWnUgQ67fb3FYw==, + } + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-gnu@4.10.0: + resolution: + { + integrity: sha512-yPtF9jIix88orwfTi0lJiqINnlWo6p93MtZEoaehZnmCzEmLL0eqjA3eGVeyQhMtxdV+Mlsgfwhh0+M/k1/V7Q==, + } + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-arm64-musl@4.10.0: + resolution: + { + integrity: sha512-9GW9yA30ib+vfFiwjX+N7PnjTnCMiUffhWj4vkG4ukYv1kJ4T9gHNg8zw+ChsOccM27G9yXrEtMScf1LaCuoWQ==, + } + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-riscv64-gnu@4.10.0: + resolution: + { + integrity: sha512-X1ES+V4bMq2ws5fF4zHornxebNxMXye0ZZjUrzOrf7UMx1d6wMQtfcchZ8SqUnQPPHdOyOLW6fTcUiFgHFadRA==, + } + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-gnu@4.10.0: + resolution: + { + integrity: sha512-w/5OpT2EnI/Xvypw4FIhV34jmNqU5PZjZue2l2Y3ty1Ootm3SqhI+AmfhlUYGBTd9JnpneZCDnt3uNOiOBkMyw==, + } + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-linux-x64-musl@4.10.0: + resolution: + { + integrity: sha512-q/meftEe3QlwQiGYxD9rWwB21DoKQ9Q8wA40of/of6yGHhZuGfZO0c3WYkN9dNlopHlNT3mf5BPsUSxoPuVQaw==, + } + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-arm64-msvc@4.10.0: + resolution: + { + integrity: sha512-NrR6667wlUfP0BHaEIKgYM/2va+Oj+RjZSASbBMnszM9k+1AmliRjHc3lJIiOehtSSjqYiO7R6KLNrWOX+YNSQ==, + } + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-ia32-msvc@4.10.0: + resolution: + { + integrity: sha512-FV0Tpt84LPYDduIDcXvEC7HKtyXxdvhdAOvOeWMWbQNulxViH2O07QXkT/FffX4FqEI02jEbCJbr+YcuKdyyMg==, + } + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + + /@rollup/rollup-win32-x64-msvc@4.10.0: + resolution: + { + integrity: sha512-OZoJd+o5TaTSQeFFQ6WjFCiltiYVjIdsXxwu/XZ8qRpsvMQr4UsVrE5UyT9RIvsnuF47DqkJKhhVZ2Q9YW9IpQ==, + } + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@semantic-release/changelog@6.0.3(semantic-release@23.0.2): resolution: { @@ -2971,6 +3146,13 @@ packages: - supports-color dev: true + /@sinclair/typebox@0.27.8: + resolution: + { + integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==, + } + dev: true + /@sindresorhus/is@4.6.0: resolution: { @@ -3528,6 +3710,60 @@ packages: } dev: true + /@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.7 + 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.1 + 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 + /JSONStream@1.3.5: resolution: { @@ -3587,6 +3823,14 @@ packages: engines: { node: ">=0.4.0" } dev: true + /acorn-walk@8.3.2: + resolution: + { + integrity: sha512-cjkyv4OtNCIeqhHrfS81QWXoCBPExR/J62oyEqepVw8WaQeSqpW2uhuLPh1m9eWhDuOo/jUXVTlifvesOWp/4A==, + } + engines: { node: ">=0.4.0" } + dev: true + /acorn@6.4.2: resolution: { @@ -3793,6 +4037,14 @@ packages: color-convert: 2.0.1 dev: true + /ansi-styles@5.2.0: + resolution: + { + integrity: sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==, + } + engines: { node: ">=10" } + dev: true + /ansi-styles@6.2.1: resolution: { @@ -4051,6 +4303,13 @@ packages: engines: { node: ">=0.8" } dev: true + /assertion-error@1.1.0: + resolution: + { + integrity: sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==, + } + dev: true + /assign-symbols@1.0.0: resolution: { @@ -4569,6 +4828,19 @@ packages: engines: { node: ">=6" } dev: true + /bundle-require@4.0.2(esbuild@0.19.12): + resolution: + { + integrity: sha512-jwzPOChofl67PSTW2SGubV9HBQAhhR2i6nskiOThauo9dzwDUgOWQScFVaJkjEfYX+UXiD+LEx8EblQMc2wIag==, + } + engines: { node: ^12.20.0 || ^14.13.1 || >=16.0.0 } + peerDependencies: + esbuild: ">=0.17" + dependencies: + esbuild: 0.19.12 + load-tsconfig: 0.2.5 + dev: true + /bytes-iec@3.1.1: resolution: { @@ -4577,6 +4849,14 @@ packages: engines: { node: ">= 0.8" } dev: true + /cac@6.7.14: + resolution: + { + integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==, + } + engines: { node: ">=8" } + dev: true + /cache-base@1.0.1: resolution: { @@ -4684,6 +4964,22 @@ packages: } 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 + /chalk@2.4.2: resolution: { @@ -4762,6 +5058,15 @@ packages: } dev: true + /check-error@1.0.3: + resolution: + { + integrity: sha512-iKEoDYaRmd1mxM90a2OEfWhjsjPpYPuQ+lMYsoxB126+t8fw7ySEO48nmDg5COTjxDI65/Y2OWpeEHk3ZOe8zg==, + } + dependencies: + get-func-name: 2.0.2 + dev: true + /chokidar@3.6.0: resolution: { @@ -5044,6 +5349,14 @@ packages: } dev: true + /commander@4.1.1: + resolution: + { + integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==, + } + engines: { node: ">= 6" } + dev: true + /commitizen@4.3.0(@types/node@20.11.17)(typescript@5.3.3): resolution: { @@ -5491,6 +5804,16 @@ packages: } dev: true + /deep-eql@4.1.3: + resolution: + { + integrity: sha512-WaEtAOpRA1MQ0eohqZjpGD8zdI0Ovsm8mmFhaDN8dvDZzyoUMcYDnf5Y6iu7HTXxf8JDS23qWa4a+hKCDyOPzw==, + } + engines: { node: ">=6" } + dependencies: + type-detect: 4.0.8 + dev: true + /deep-extend@0.6.0: resolution: { @@ -5640,6 +5963,14 @@ packages: engines: { node: ">= 8.3" } dev: true + /diff-sequences@29.6.3: + resolution: + { + integrity: sha512-EjePK1srD3P08o2j4f0ExnylqRs5B9tJjcp9t1krH2qRi8CCdsYfwe9JgSLurFBWwq4uOlipzfk5fHNvwFKr8Q==, + } + engines: { node: ^14.15.0 || ^16.10.0 || >=18.0.0 } + dev: true + /dir-glob@3.0.1: resolution: { @@ -6588,6 +6919,15 @@ packages: } dev: true + /estree-walker@3.0.3: + resolution: + { + integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==, + } + dependencies: + "@types/estree": 1.0.5 + dev: true + /esutils@2.0.3: resolution: { @@ -7277,6 +7617,13 @@ packages: engines: { node: ">=18" } dev: true + /get-func-name@2.0.2: + resolution: + { + integrity: sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==, + } + dev: true + /get-intrinsic@1.2.4: resolution: { @@ -9410,6 +9757,14 @@ packages: requiresBuild: true dev: true + /joycon@3.1.1: + resolution: + { + integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==, + } + engines: { node: ">=10" } + dev: true + /jpjs@1.2.1: resolution: { @@ -9599,6 +9954,13 @@ packages: hasBin: true dev: true + /jsonc-parser@3.2.1: + resolution: + { + integrity: sha512-AilxAyFOAcK5wA1+LeaySVBrHsGQvUFCDWXKpZjzaL0PqW+xfBOttn8GNtWKFWqneyMZj41MWF9Kl6iPWLwgOA==, + } + dev: true + /jsonfile@4.0.0: resolution: { @@ -9810,10 +10172,29 @@ packages: strip-bom: 3.0.0 dev: true - /locate-path@2.0.0: + /load-tsconfig@0.2.5: resolution: { - integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==, + integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==, + } + engines: { node: ^12.20.0 || ^14.13.1 || >=16.0.0 } + 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 + + /locate-path@2.0.0: + resolution: + { + integrity: sha512-NCI2kiDkyR7VeEKm27Kda/iQHyKJe1Bu0FlTbYp3CqJu+9IFe9bLyAjMxf5ZDDbEg+iMPzB5zYyUTSm8wVTKmA==, } engines: { node: ">=4" } dependencies: @@ -10062,6 +10443,15 @@ packages: js-tokens: 4.0.0 dev: true + /loupe@2.3.7: + resolution: + { + integrity: sha512-zSMINGVYkdpYSOBmLi0D1Uo7JU9nVdQKrHxC8eYlV+9YKK9WePqAlL7lSlorG/U2Fw1w0hTBmaa/jrQ3UbPHtA==, + } + dependencies: + get-func-name: 2.0.2 + dev: true + /lower-case@2.0.2: resolution: { @@ -10107,6 +10497,16 @@ packages: sourcemap-codec: 1.4.8 dev: true + /magic-string@0.30.7: + resolution: + { + integrity: sha512-8vBuFF/I/+OSLRmdf2wwFCJCz+nSn0m6DPvGH1fS/KiQoSaR+sETbov0eIk9KhEKy8CYqIkIAnbohxT/4H0kuA==, + } + engines: { node: ">=12" } + dependencies: + "@jridgewell/sourcemap-codec": 1.4.15 + dev: true + /make-dir@3.1.0: resolution: { @@ -10654,6 +11054,18 @@ packages: minimist: 1.2.8 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.4.0 + dev: true + /mri@1.2.0: resolution: { @@ -10701,6 +11113,15 @@ packages: thenify-all: 1.6.0 dev: true + /nanoid@3.3.7: + resolution: + { + integrity: sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==, + } + engines: { node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1 } + hasBin: true + dev: true + /nanoid@5.0.5: resolution: { @@ -11343,6 +11764,16 @@ packages: yocto-queue: 0.1.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 + /p-locate@2.0.0: resolution: { @@ -11611,6 +12042,20 @@ packages: 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 + /pegjs@0.10.0: resolution: { @@ -11696,6 +12141,17 @@ packages: find-up: 4.1.0 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 + /pn@1.1.0: resolution: { @@ -11711,6 +12167,37 @@ packages: engines: { node: ">=0.10.0" } dev: true + /postcss-load-config@4.0.2: + resolution: + { + integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==, + } + engines: { node: ">= 14" } + peerDependencies: + postcss: ">=8.0.9" + ts-node: ">=9.0.0" + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + dependencies: + lilconfig: 3.0.0 + yaml: 2.3.4 + dev: true + + /postcss@8.4.35: + resolution: + { + integrity: sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==, + } + engines: { node: ^10 || ^12 || >=14 } + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.0 + source-map-js: 1.0.2 + dev: true + /prelude-ls@1.1.2: resolution: { @@ -11770,6 +12257,18 @@ packages: react-is: 16.13.1 dev: true + /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 + /process-nextick-args@2.0.1: resolution: { @@ -11903,6 +12402,13 @@ packages: } dev: true + /react-is@18.2.0: + resolution: + { + integrity: sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==, + } + dev: true + /read-pkg-up@11.0.0: resolution: { @@ -12559,6 +13065,32 @@ packages: acorn: 7.4.1 dev: true + /rollup@4.10.0: + resolution: + { + integrity: sha512-t2v9G2AKxcQ8yrG+WGxctBes1AomT0M4ND7jTFBCVPXQ/WFTvNSefIrNSmLKhIKBrvN8SG+CZslimJcT3W2u2g==, + } + engines: { node: ">=18.0.0", npm: ">=8.0.0" } + hasBin: true + dependencies: + "@types/estree": 1.0.5 + optionalDependencies: + "@rollup/rollup-android-arm-eabi": 4.10.0 + "@rollup/rollup-android-arm64": 4.10.0 + "@rollup/rollup-darwin-arm64": 4.10.0 + "@rollup/rollup-darwin-x64": 4.10.0 + "@rollup/rollup-linux-arm-gnueabihf": 4.10.0 + "@rollup/rollup-linux-arm64-gnu": 4.10.0 + "@rollup/rollup-linux-arm64-musl": 4.10.0 + "@rollup/rollup-linux-riscv64-gnu": 4.10.0 + "@rollup/rollup-linux-x64-gnu": 4.10.0 + "@rollup/rollup-linux-x64-musl": 4.10.0 + "@rollup/rollup-win32-arm64-msvc": 4.10.0 + "@rollup/rollup-win32-ia32-msvc": 4.10.0 + "@rollup/rollup-win32-x64-msvc": 4.10.0 + fsevents: 2.3.3 + dev: true + /rsvp@4.8.5: resolution: { @@ -12914,6 +13446,13 @@ packages: object-inspect: 1.13.1 dev: true + /siginfo@2.0.0: + resolution: + { + integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==, + } + dev: true + /signal-exit@3.0.7: resolution: { @@ -13065,6 +13604,14 @@ packages: - supports-color dev: true + /source-map-js@1.0.2: + resolution: + { + integrity: sha512-R0XvVJ9WusLiqTCEiGCmICCMplcCkIwwR11mOSD9CR5u+IXYdiseeEuXCVAjS54zqwkLcPNnmU4OeJ6tUrWhDw==, + } + engines: { node: ">=0.10.0" } + dev: true + /source-map-resolve@0.5.3: resolution: { @@ -13132,6 +13679,16 @@ packages: engines: { node: ">= 8" } dev: true + /source-map@0.8.0-beta.0: + resolution: + { + integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==, + } + engines: { node: ">= 8" } + dependencies: + whatwg-url: 7.1.0 + dev: true + /sourcemap-codec@1.4.8: resolution: { @@ -13253,6 +13810,13 @@ packages: escape-string-regexp: 2.0.0 dev: true + /stackback@0.0.2: + resolution: + { + integrity: sha512-1XMJE5fQo1jGH6Y/7ebnwPOBEkIEnT4QF32d5R1+VXdXveM0IBMJt8zfaxX1P3QhVwrYe+576+jkANtSS2mBbw==, + } + dev: true + /static-extend@0.1.2: resolution: { @@ -13264,6 +13828,13 @@ packages: object-copy: 0.1.0 dev: true + /std-env@3.7.0: + resolution: + { + integrity: sha512-JPbdCEQLj1w5GilpiHAx3qJvFndqybBysA3qUOnznweH4QbNYUsW/ea8QzSrnh0vNsezMMw5bcVool8lM0gwzg==, + } + dev: true + /stealthy-require@1.1.1: resolution: { @@ -13535,6 +14106,32 @@ packages: engines: { node: ">=8" } dev: true + /strip-literal@1.3.0: + resolution: + { + integrity: sha512-PugKzOsyXpArk0yWmUwqOZecSO0GH0bPoctLcqNDH9J04pVW3lflYE0ujElBGTloevcxF5MofAOZ7C5l2b+wLg==, + } + dependencies: + acorn: 8.11.3 + dev: true + + /sucrase@3.35.0: + resolution: + { + integrity: sha512-8EbVDiu9iN/nESwxeSxDKe0dunta1GOlHufmSSXxMD2z2/tMZpDMpvXQGsc+ajGo8y2uYUmixaSRUc/QPoQ0GA==, + } + engines: { node: ">=16 || 14 >=14.17" } + hasBin: true + dependencies: + "@jridgewell/gen-mapping": 0.3.3 + commander: 4.1.1 + glob: 10.3.10 + lines-and-columns: 1.2.4 + mz: 2.7.0 + pirates: 4.0.6 + ts-interface-checker: 0.1.13 + dev: true + /supports-color@5.5.0: resolution: { @@ -13661,6 +14258,20 @@ packages: source-map-support: 0.5.21 dev: true + /terser@5.27.0: + resolution: + { + integrity: sha512-bi1HRwVRskAjheeYl291n3JC4GgO/Ty4z1nVs5AAsmonJulGxpSektecnNedrwK9C7vpvVtcX3cw00VSLt7U2A==, + } + engines: { node: ">=10" } + hasBin: true + dependencies: + "@jridgewell/source-map": 0.3.5 + acorn: 8.11.3 + commander: 2.20.3 + source-map-support: 0.5.21 + dev: true + /test-exclude@6.0.0: resolution: { @@ -13750,6 +14361,29 @@ packages: globrex: 0.1.2 dev: true + /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.1: + resolution: + { + integrity: sha512-KYad6Vy5VDWV4GH3fjpseMQ/XU2BhIYP7Vzd0LG44qRWm/Yt2WCOTicFdvmgo6gWaqooMQCawTtILVQJupKu7A==, + } + engines: { node: ">=14.0.0" } + dev: true + /tmp@0.0.33: resolution: { @@ -13866,6 +14500,14 @@ packages: engines: { node: ">= 0.4" } dev: true + /tree-kill@1.2.2: + resolution: + { + integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==, + } + hasBin: true + dev: true + /trim-newlines@3.0.1: resolution: { @@ -13893,6 +14535,13 @@ packages: typescript: 5.3.3 dev: true + /ts-interface-checker@0.1.13: + resolution: + { + integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==, + } + dev: true + /ts-jest@25.5.1(jest@25.5.4)(typescript@3.9.10): resolution: { @@ -14026,6 +14675,48 @@ packages: } dev: true + /tsup@8.0.2(typescript@5.3.3): + resolution: + { + integrity: sha512-NY8xtQXdH7hDUAZwcQdY/Vzlw9johQsaqf7iwZ6g1DOUlFYQ5/AtVAjTvihhEyeRlGo4dLRVHtrRaL35M1daqQ==, + } + engines: { node: ">=18" } + hasBin: true + peerDependencies: + "@microsoft/api-extractor": ^7.36.0 + "@swc/core": ^1 + postcss: ^8.4.12 + typescript: ">=4.5.0" + peerDependenciesMeta: + "@microsoft/api-extractor": + optional: true + "@swc/core": + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + bundle-require: 4.0.2(esbuild@0.19.12) + cac: 6.7.14 + chokidar: 3.6.0 + debug: 4.3.4 + esbuild: 0.19.12 + execa: 5.1.1 + globby: 11.1.0 + joycon: 3.1.1 + postcss-load-config: 4.0.2 + resolve-from: 5.0.0 + rollup: 4.10.0 + source-map: 0.8.0-beta.0 + sucrase: 3.35.0 + tree-kill: 1.2.2 + typescript: 5.3.3 + transitivePeerDependencies: + - supports-color + - ts-node + dev: true + /tsutils@3.21.0(typescript@3.9.10): resolution: { @@ -14232,6 +14923,13 @@ packages: hasBin: true dev: true + /ufo@1.4.0: + resolution: + { + integrity: sha512-Hhy+BhRBleFjpJ2vchUNN40qgkh0366FWJGqVLYBHev0vpHTrXSA0ryT+74UiW6KWsldNurQMKGqCm1M2zBciQ==, + } + dev: true + /uglify-js@3.17.4: resolution: { @@ -14551,6 +15249,130 @@ packages: vfile-message: 2.0.4 dev: true + /vite-node@1.2.2(@types/node@20.11.17)(terser@5.27.0): + 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.1.2(@types/node@20.11.17)(terser@5.27.0) + transitivePeerDependencies: + - "@types/node" + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + + /vite@5.1.2(@types/node@20.11.17)(terser@5.27.0): + resolution: + { + integrity: sha512-uwiFebQbTWRIGbCaTEBVAfKqgqKNKMJ2uPXsXeLIZxM8MVMjoS3j0cG8NrPxdDIadaWnPSjrkLWffLSC+uiP3Q==, + } + 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.17 + esbuild: 0.19.12 + postcss: 8.4.35 + rollup: 4.10.0 + terser: 5.27.0 + optionalDependencies: + fsevents: 2.3.3 + dev: true + + /vitest@1.2.2(@types/node@20.11.17)(terser@5.27.0): + 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.17 + "@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.7 + 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.1.2(@types/node@20.11.17)(terser@5.27.0) + vite-node: 1.2.2(@types/node@20.11.17)(terser@5.27.0) + why-is-node-running: 2.2.2 + transitivePeerDependencies: + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + /w3c-hr-time@1.0.2: resolution: { @@ -14729,6 +15551,18 @@ packages: 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 + /word-wrap@1.2.5: resolution: { @@ -15002,6 +15836,14 @@ packages: engines: { node: ">=10" } dev: true + /yocto-queue@1.0.0: + resolution: + { + integrity: sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g==, + } + engines: { node: ">=12.20" } + dev: true + /zwitch@1.0.5: resolution: { diff --git a/src/CrestronCH5/ReservedJoin/index.ts b/src/CrestronCH5/ReservedJoin/index.ts index e1a6d22..877f954 100644 --- a/src/CrestronCH5/ReservedJoin/index.ts +++ b/src/CrestronCH5/ReservedJoin/index.ts @@ -1,4 +1,4 @@ -import { Digital, Analog, Serial } from "../enums"; +import { Digital, Analog, Serial } from "../enums/index.js"; export const ReservedJoin = { Digital, diff --git a/src/CrestronCH5/enums/Analog/index.ts b/src/CrestronCH5/enums/Analog/index.ts index dbe557c..ed684f2 100644 --- a/src/CrestronCH5/enums/Analog/index.ts +++ b/src/CrestronCH5/enums/Analog/index.ts @@ -1,5 +1,5 @@ -import Event from "./Event"; -import State from "./State"; +import Event from "./Event/index.js"; +import State from "./State/index.js"; export const Analog = { Event, diff --git a/src/CrestronCH5/enums/Digital/index.ts b/src/CrestronCH5/enums/Digital/index.ts index c747d45..df9fc17 100644 --- a/src/CrestronCH5/enums/Digital/index.ts +++ b/src/CrestronCH5/enums/Digital/index.ts @@ -1,5 +1,5 @@ -import Event from "./Event"; -import State from "./State"; +import Event from "./Event/index.js"; +import State from "./State/index.js"; export const Digital = { Event, diff --git a/src/CrestronCH5/enums/Serial/index.ts b/src/CrestronCH5/enums/Serial/index.ts index 4de6ef5..a45373b 100644 --- a/src/CrestronCH5/enums/Serial/index.ts +++ b/src/CrestronCH5/enums/Serial/index.ts @@ -1,5 +1,5 @@ -import Event from "./Event"; -import State from "./State"; +import Event from "./Event/index.js"; +import State from "./State/index.js"; export const Serial = { Event, diff --git a/src/CrestronCH5/enums/index.ts b/src/CrestronCH5/enums/index.ts index 84f465f..8630d3a 100644 --- a/src/CrestronCH5/enums/index.ts +++ b/src/CrestronCH5/enums/index.ts @@ -1,4 +1,4 @@ -export * from "./Digital"; -export * from "./Analog"; -export * from "./Serial"; -export * from "./SignalType"; +export * from "./Digital/index.js"; +export * from "./Analog/index.js"; +export * from "./Serial/index.js"; +export * from "./SignalType/index.js"; diff --git a/src/CrestronCH5/index.ts b/src/CrestronCH5/index.ts index 4e420b4..5d50c5b 100644 --- a/src/CrestronCH5/index.ts +++ b/src/CrestronCH5/index.ts @@ -1,5 +1,5 @@ -import { SignalType } from "./enums"; -import { ReservedJoin } from "./ReservedJoin"; +import { SignalType } from "./enums/index.js"; +import { ReservedJoin } from "./ReservedJoin/index.js"; export const CrestronCH5 = { SignalType, diff --git a/src/index.ts b/src/index.ts index b7ce323..0016bb1 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,3 @@ -import { CrestronCH5 } from "./CrestronCH5"; +import { CrestronCH5 } from "./CrestronCH5/index.js"; export default CrestronCH5; diff --git a/tests/reserved.test.ts b/tests/reserved.test.ts new file mode 100644 index 0000000..60579b4 --- /dev/null +++ b/tests/reserved.test.ts @@ -0,0 +1,32 @@ +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import { describe, it, expect } from "vitest"; +import type CrestronCH5 from "../src/index.js"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const object = (await import( + `${path.resolve(__dirname, "../dist/index.js")}` +)) as typeof CrestronCH5; + +console.log(object); + +describe("Crestron CH5 Reserved Joins", () => { + it("should import default export without error", () => { + expect(object).toBeDefined(); + }); + + it("should contain the correct values", () => { + // Traverse the object and check for the correct values + expect(object.ReservedJoin.Analog.Event.Csig_All_Audio_Volume).toBe( + "Csig.All_Audio_Volume", + ); + + expect(object.ReservedJoin.Analog.Event.Csig_Auto_Answer_Delay).toBe( + "Csig.Auto_Answer_Delay", + ); + }); + + it("should always pass", () => { + expect(true).toBe(true); + }); +}); diff --git a/tsconfig.json b/tsconfig.json index 2c85b2d..f70d1b8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,35 +1,22 @@ { - // see https://www.typescriptlang.org/tsconfig to better understand tsconfigs - "include": ["src", "types"], - "compilerOptions": { - "module": "esnext", - "lib": ["dom", "esnext"], - "importHelpers": true, - // output .d.ts declaration files for consumers - "declaration": true, - // output .js.map sourcemap files for consumers - "sourceMap": true, - // match output dir to input dir. e.g. dist/index instead of dist/src/index - "rootDir": "./src", - // stricter type-checking for stronger correctness. Recommended by TS - "strict": true, - // linter checks for common issues - "noImplicitReturns": true, - "noFallthroughCasesInSwitch": true, - // noUnused* overlap with @typescript-eslint/no-unused-vars, can disable if duplicative - "noUnusedLocals": true, - "noUnusedParameters": true, - // use Node's module resolution algorithm, instead of the legacy TS one - "moduleResolution": "node", - // transpile JSX to React.createElement - "jsx": "react", - // interop between ESM and CJS modules. Recommended by TS - "esModuleInterop": true, - // significant perf increase by skipping checking .d.ts files, particularly those in node_modules. Recommended by TS - "skipLibCheck": true, - // error out if import and file system have a casing mismatch. Recommended by TS - "forceConsistentCasingInFileNames": true, - // `tsdx build` ignores this option, but it is commonly used when type-checking separately with `tsc` - "noEmit": true, - } + "$schema": "https://json.schemastore.org/tsconfig", + "display": "Node LTS", + "_version": "18.1.0", + "compilerOptions": { + "lib": ["ESNext", "DOM"], + "module": "NodeNext", + "target": "es2022", + "strict": true, + "esModuleInterop": true, + "skipLibCheck": true, + "forceConsistentCasingInFileNames": true, + "moduleResolution": "NodeNext", + "noUncheckedIndexedAccess": true, + "resolveJsonModule": true, + "types": ["node"], + "typeRoots": ["node_modules/@types"], + "allowSyntheticDefaultImports": true, + "noEmit": true + }, + "include": ["src/**/*", "tests/**/*", "vitest.config.ts"] } diff --git a/tsup.config.json b/tsup.config.json new file mode 100644 index 0000000..71315d3 --- /dev/null +++ b/tsup.config.json @@ -0,0 +1,16 @@ +{ + "entry": { + "index": "src/index.ts" + }, + "format": ["esm", "cjs"], + "target": "node20", + "outDir": "dist", + "minify": "terser", + "dts": true, + "minifyWhitespace": true, + "minifyIdentifiers": true, + "minifySyntax": true, + "treeshake": true, + "sourcemap": true, + "splitting": true +} diff --git a/tsup.schema.json b/tsup.schema.json new file mode 100644 index 0000000..9e923d6 --- /dev/null +++ b/tsup.schema.json @@ -0,0 +1,359 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema", + "$id": "tsup", + "version": 1.1, + "anyOf": [ + { + "type": "object", + "required": ["tsup"], + "additionalProperties": true, + "properties": { + "tsup": { + "type": ["object", "array"], + "oneOf": [ + { + "type": "object", + "additionalProperties": false, + "$ref": "#/definitions/options" + }, + { + "type": "array", + "items": { + "additionalProperties": false, + "$ref": "#/definitions/options" + } + } + ] + } + } + }, + { + "type": ["object", "array"], + "oneOf": [ + { + "type": "object", + "$ref": "#/definitions/options" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/options" + } + } + ] + } + ], + "definitions": { + "options": { + "type": "object", + "markdownDescription": "Configuration options for [tsup](https://tsup.egoist.dev)", + "properties": { + "entry": { + "markdownDescription": "Files that each serve as an input to the bundling algorithm.\n\n---\nReferences:\n- [Entry Points](https://esbuild.github.io/api/#entry-points) - esbuild\n - [Multiple Entrypoints](https://tsup.egoist.dev/#multiple-entrypoints) - tsup", + "oneOf": [ + { + "type": "array", + "items": { + "type": "string" + } + }, + { + "type": "object" + } + ] + }, + "treeshake": { + "markdownDescription": "By default esbuild already does treeshaking but this option allow you to perform additional treeshaking with Rollup and result in smaller bundle size.", + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": ["smallest", "safest", "recommended"] + } + ] + }, + "name": { + "type": "string", + "description": "Optional config name to show in CLI output" + }, + "legacyOutput": { + "type": "boolean", + "description": "Output different formats to different folder instead of using different extension" + }, + "target": { + "markdownDescription": "This sets the target environment for the generated code\n\n---\nReferences:\n- [Target](https://esbuild.github.io/api/#target) - esbuild", + "default": "node14", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "minify": { + "description": "When enabled, the generated code will be minified instead of pretty-printed.", + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "enum": ["terser"] + } + ] + }, + "minifyWhitespace": { + "type": "boolean" + }, + "minifyIdentifiers": { + "type": "boolean" + }, + "minifySyntax": { + "type": "boolean" + }, + "keepNames": { + "type": "boolean" + }, + "watch": { + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "string", + "items": { + "type": "string" + } + }, + { + "type": "array", + "items": { + "type": ["string", "boolean"] + } + } + ] + }, + "ignoreWatch": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "onSuccess": { + "type": "string" + }, + "jsxFactory": { + "type": "string" + }, + "jsxFragment": { + "type": "string" + }, + "outDir": { + "type": "string" + }, + "format": { + "oneOf": [ + { + "enum": ["cjs", "iife", "esm"], + "type": "string" + }, + { + "type": "array", + "uniqueItems": true, + "items": { + "type": "string", + "enum": ["cjs", "iife", "esm"] + } + } + ] + }, + "globalName": { + "type": "string" + }, + "env": { + "type": "object" + }, + "define": { + "type": "object" + }, + "dts": { + "markdownDescription": "This will emit `./dist/index.js` and `./dist/index.d.ts`.\n\nIf you have multiple entry files, each entry will get a corresponding `.d.ts` file. So when you only want to generate declaration file for a single entry, use `--dts ` format, e.g. `--dts src/index.ts`.\n\n**Note** that `--dts` does not resolve external (aka in node_modules) types used in the `.d.ts file`, if that's somehow a requirement, try the experimental `--dts-resolve` flag instead.", + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "string" + }, + { + "type": "object", + "properties": { + "entry": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + } + } + } + ] + }, + "sourcemap": { + "oneOf": [ + { + "type": "boolean" + }, + { + "enum": ["inline"] + } + ] + }, + "noExternal": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Always bundle modules matching given patterns" + }, + "external": { + "description": "Don't bundle these modules", + "type": "array", + "items": { + "type": "string" + } + }, + "replaceNodeEnv": { + "type": "boolean", + "markdownDescription": "Replace `process.env.NODE_ENV` with `production` or `development` `production` when the bundled is minified, `development` otherwise" + }, + "splitting": { + "type": "boolean", + "default": true, + "markdownDescription": "You may want to disable code splitting sometimes: [`#255`](https://github.com/egoist/tsup/issues/255)" + }, + "clean": { + "description": "Clean output directory before each buil", + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "silent": { + "type": "boolean", + "description": "Suppress non-error logs (excluding \"onSuccess\" process output)" + }, + "skipNodeModulesBundle": { + "type": "boolean", + "description": "Skip node_modules bundling" + }, + "pure": { + "markdownDescription": "See:\n- [Pure](https://esbuild.github.io/api/#pure) - esbuild", + "oneOf": [ + { + "type": "boolean" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ] + }, + "bundle": { + "default": true, + "type": "boolean", + "description": "Disable bundling, default to true" + }, + "inject": { + "markdownDescription": "This option allows you to automatically replace a global variable with an import from another file.\n\n---\nSee:\n- [Inject](https://esbuild.github.io/api/#inject) - esbuild", + "type": "array", + "items": { + "type": "string" + } + }, + "metafile": { + "type": "boolean", + "markdownDescription": "Emit esbuild metafile.\n\n---\nSee:\n- [Metafile](https://esbuild.github.io/api/#metafile) - esbuild" + }, + "footer": { + "type": "object", + "properties": { + "js": { + "type": "string" + }, + "css": { + "type": "string" + } + } + }, + "banner": { + "type": "object", + "properties": { + "js": { + "type": "string" + }, + "css": { + "type": "string" + } + } + }, + "platform": { + "description": "Target platform", + "type": "string", + "default": "node", + "enum": ["node", "browser"] + }, + "config": { + "markdownDescription": "Disable config file with `false` or pass a custom config filename", + "type": ["boolean", "string"] + }, + "tsconfig": { + "type": "string", + "description": " Use a custom tsconfig" + }, + "injectStyle": { + "type": "boolean", + "default": false, + "description": "Inject CSS as style tags to document head" + }, + "shims": { + "type": "boolean", + "default": false, + "description": "Inject cjs and esm shims if needed" + } + } + } + } +} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 0000000..b6f0b63 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from "vitest/config"; + +export default defineConfig({ + test: { + environment: "node", + testTimeout: 60000, + resolveSnapshotPath(path, extension) { + return path + extension; + }, + include: ["tests/**/*.test.ts"], + }, +});