diff --git a/.copier-answers.yaml b/.copier-answers.yaml index 218ca63..9574d14 100644 --- a/.copier-answers.yaml +++ b/.copier-answers.yaml @@ -1,5 +1,5 @@ # Changes here will be overwritten by Copier -_commit: 84508d6 +_commit: ebda788 _src_path: https://github.com/python-project-templates/base.git add_docs: true add_extension: rustjswasm diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index dab99f9..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "eslint.workingDirectories": ["./js"] -} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 7cb2996..82ad1aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,9 +43,9 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "portable-atomic" -version = "1.14.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d20d5497ef88037a52ff98267d066e7f11fcc5e99bbfbd58a42336193aacec3" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" [[package]] name = "proc-macro2" diff --git a/docs/wiki/contribute/Build-from-Source.md b/docs/wiki/contribute/Build-from-Source.md index ad883cf..9224286 100644 --- a/docs/wiki/contribute/Build-from-Source.md +++ b/docs/wiki/contribute/Build-from-Source.md @@ -62,13 +62,14 @@ make build `python-template-rust` has linting and auto formatting. -| Language | Linter | Autoformatter | Description | -| :------- | :---------- | :------------ | :---------- | -| Python | `ruff` | `ruff` | Style | -| Python | `ruff` | `ruff` | Imports | -| Rust | `clippy` | `clippy` | Style | -| Markdown | `mdformat` | `mdformat` | Style | -| Markdown | `codespell` | | Spelling | +| Language | Linter | Autoformatter | Description | +| :--------- | :---------- | :------------ | :---------- | +| Python | `ruff` | `ruff` | Style | +| Python | `ruff` | `ruff` | Imports | +| Rust | `clippy` | `clippy` | Style | +| JavaScript | `oxlint` | `oxfmt` | Style | +| Markdown | `mdformat` | `mdformat` | Style | +| Markdown | `codespell` | | Spelling | **Python Linting** diff --git a/js/.oxfmtrc.json b/js/.oxfmtrc.json new file mode 100644 index 0000000..a6f0347 --- /dev/null +++ b/js/.oxfmtrc.json @@ -0,0 +1,5 @@ +{ + "$schema": "./node_modules/oxfmt/configuration_schema.json", + "printWidth": 80, + "sortPackageJson": false +} diff --git a/js/.oxlintrc.json b/js/.oxlintrc.json new file mode 100644 index 0000000..1436dd0 --- /dev/null +++ b/js/.oxlintrc.json @@ -0,0 +1,11 @@ +{ + "$schema": "./node_modules/oxlint/configuration_schema.json", + "env": { + "browser": true, + "es6": true, + "node": true + }, + "rules": { + "unicorn/no-empty-file": "off" + } +} diff --git a/js/package.json b/js/package.json index 16a3c65..f231401 100644 --- a/js/package.json +++ b/js/package.json @@ -34,10 +34,10 @@ "build": "npm-run-all build:rust build:wasm-bindgen build:prod", "clean": "rm -rf dist lib playwright-report ../python_template_rust/extension", "dev": "npm-run-all -p start watch", - "lint:js": "prettier --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", + "lint:js": "oxlint . && oxfmt --check \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", "lint:rust": "cargo clippy --all-features && cargo fmt --all -- --check", "lint": "npm-run-all lint:*", - "fix:js": "prettier --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", + "fix:js": "oxlint --fix . && oxfmt --write \"src/**/*.{js,ts,jsx,tsx,css}\" \"tests/**/*.{js,ts,jsx,tsx}\" \"*.mjs\" \"*.json\"", "fix:rust": "cargo fmt --all", "fix": "npm-run-all fix:*", "preinstall": "npx only-allow pnpm", @@ -58,7 +58,8 @@ "http-server": "^14.1.1", "nodemon": "^3.1.14", "npm-run-all": "^4.1.5", - "prettier": "^3.9.6", + "oxfmt": "^0.63.0", + "oxlint": "^1.78.0", "typescript": "^7.0.2" } } diff --git a/js/pnpm-lock.yaml b/js/pnpm-lock.yaml index 44c8762..5c281b2 100644 --- a/js/pnpm-lock.yaml +++ b/js/pnpm-lock.yaml @@ -29,9 +29,12 @@ importers: npm-run-all: specifier: ^4.1.5 version: 4.1.5 - prettier: - specifier: ^3.9.6 - version: 3.9.6 + oxfmt: + specifier: ^0.63.0 + version: 0.63.0 + oxlint: + specifier: ^1.78.0 + version: 1.78.0 typescript: specifier: ^7.0.2 version: 7.0.2 @@ -206,6 +209,250 @@ packages: resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==} engines: {node: '>= 8'} + '@oxfmt/binding-android-arm-eabi@0.63.0': + resolution: {integrity: sha512-YmRth4ZPGgEXcgmkhvANbC9uD67dxmSobW7DQuyt5tOBOKvPnIpk5SVHBj88E+7wMNRI2FhqaDbOhQFBix+b8A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxfmt/binding-android-arm64@0.63.0': + resolution: {integrity: sha512-icbahX8X2X3sRamOMecvdYeZXWjPDazRDIfvWfy7Ca1nc/ZDT2Y9k5Nt7s46EqFd7NQPdgk+CM3/SgIT5LPCaQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxfmt/binding-darwin-arm64@0.63.0': + resolution: {integrity: sha512-WV+Ze5v5gI2qoj8jpAovt8KBTW8pjEz/AiMXXjeTQS+Bmf/MmZXTS40S8xNPDszX+W8WDv2Bbk6qKrMTtUGu1A==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxfmt/binding-darwin-x64@0.63.0': + resolution: {integrity: sha512-CJGSBdDxXOWIpoFXHpverimCvz084KA7L483rqJ44c3jDtzv6d4qOSoR/V9ywSHfV+Ks1lwIj2P49BFhunLNAA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxfmt/binding-freebsd-x64@0.63.0': + resolution: {integrity: sha512-BDfKY+KhL2078cgswBBFQPAYuxCy93bS/iC5frdSeSbTLcGrR6VC2hsuPTanoJmg84+wSyWl0wWC1eR+uTnkRg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxfmt/binding-linux-arm-gnueabihf@0.63.0': + resolution: {integrity: sha512-Ov1cQEXT4mj7cojAokWSS1eoxkoyvbDfAbxNsGIKY2o36kvdAaFzPxRN6NxFRk9fD72B8oCoTTX/NuYTUWlpsg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxfmt/binding-linux-arm-musleabihf@0.63.0': + resolution: {integrity: sha512-0LE7ro3+6L79jcMANycAZfRaC7zxr9YZ2+vEL5uMD9QlEep+rS/r1kSJsnuLl991NXJZD60euh0PC1GHrR20vw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxfmt/binding-linux-arm64-gnu@0.63.0': + resolution: {integrity: sha512-izPk+2Z4gjuZK32Fqh5qXoMpT/2NXzLh++ob57HiEiVSQZ1iYXu8EKMzb+K5AvWyIEXhdDIt7ADjGGtFhkT9Bw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-arm64-musl@0.63.0': + resolution: {integrity: sha512-alPmbOuWXFXiSo+lOtv6X71C7SYMEDW2WVvywOvf9BwKgEhSNGhMTLeFVSjKUMCamcjbbgVdsWF8GN1uy8xshg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-linux-ppc64-gnu@0.63.0': + resolution: {integrity: sha512-BdzCPvolJc4AWZ+YMzgUDJcDzbQWrFjYuqBHoNHNqP1aCaluQRJNs4k3vNU5IG7vTpjf9zeD73D7MFM1TecZpg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-riscv64-gnu@0.63.0': + resolution: {integrity: sha512-7sIgfLzqtNKSkMGsGVyRpHwpjNezRg2XONvUOheFZs95TSZpM0JAuPpA8KrQFsWc4wPU95roX2O69JgH8igOgw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-riscv64-musl@0.63.0': + resolution: {integrity: sha512-9Tcg0y0WcVa6Mm9AgcgFMseDS+VkFJZpKZ8We9SpDY4gg5jewSwln+0sO04QLcTS1BtfDl9MwR+NfID8L7PUTg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-linux-s390x-gnu@0.63.0': + resolution: {integrity: sha512-qWKC1pEOpx1qYhXaugPhHUeXwSfqEOk2wJH2LqVXGPV5iQYfdAZdt+d2XDiX4DTSWA2QDMUcFB+wEORh3Xn/sA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-x64-gnu@0.63.0': + resolution: {integrity: sha512-S9wXYOiGSqYGS4Fx/TFsY+xDd/7dE5s+rUgbA4TsHiVF9e8J3ZcKmP7dsP/7iqLI9Wz7Ic7TzEr3mdthRCTdrA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxfmt/binding-linux-x64-musl@0.63.0': + resolution: {integrity: sha512-5eGyTJuMZNwBSHCivXt8Yuta6GeTYksOPXRk2MIhajiyFGQx7bjaHIwY+ZusAoFHhT157A9x6sktLjYo9D5oMQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxfmt/binding-openharmony-arm64@0.63.0': + resolution: {integrity: sha512-Rz7hx+Dv3DoW/S6pwVAyjfFXp7/trdQ1zg+vNmsdsdDNlUccugp4XNqambSuEAeP0DaG9k72AtNyfDXCEg0AGw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxfmt/binding-win32-arm64-msvc@0.63.0': + resolution: {integrity: sha512-T/IuizKN9mr4Xw6YYnptkXRNdLkyIlUZ7c8zfTOBpoytZyJ1BAsMUvsMDEx0X4YvSMpaivm+DR8112rQfzC25g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxfmt/binding-win32-ia32-msvc@0.63.0': + resolution: {integrity: sha512-XjrO5FJ5Wl9vsAxtCP1G/eaeT6y1K2s9CICUHGE42cEjou32/J6S+B1KnrOAboj6E7uhJnwPbRSvznWcxNdA0g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxfmt/binding-win32-x64-msvc@0.63.0': + resolution: {integrity: sha512-sgsHCQy432OTQH4Ikk3tZptp3GqwnhwUDuY0loBH41zyHWfMZY9v8Dy78wsnSofHejvFozZGgJgBB1A0LQRwMQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + + '@oxlint/binding-android-arm-eabi@1.78.0': + resolution: {integrity: sha512-Bu819lmAfZMUHErrpe0cEWj3iaefuUODHSU8+UbXy67V/r7/7f4K3FL0NmbD85E+wiFLDYuhP8Zlv0XnVeXshw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [android] + + '@oxlint/binding-android-arm64@1.78.0': + resolution: {integrity: sha512-CDfxZgB61B7buRdY2FJoAYYPPXCZ1EoC1LKscnC5dg3kjobdxiconvAvvN1BmHyW4PyFT3jRLDag/BY/roSNBQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [android] + + '@oxlint/binding-darwin-arm64@1.78.0': + resolution: {integrity: sha512-2Y2U9Ahrz+OO0Ej88f9SJYq51/jUBp1Mc7iZu0ukrbeeZ3gpRGfzIFnoqfHDY96xr0GEfNrPUBFEy0nN5aD7HA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [darwin] + + '@oxlint/binding-darwin-x64@1.78.0': + resolution: {integrity: sha512-rpych6eJq6m9jDRypTEaPD1xysaEW5h9+xuxhGK/QhOg+/xaqPZrCrTNoIl/f3nEjuJeCEmstNDlrE9rJi/3/g==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [darwin] + + '@oxlint/binding-freebsd-x64@1.78.0': + resolution: {integrity: sha512-IcMGrQT3QizkOESUJd5et+rOhVqSkNDfNik1cvrKDqIbzqx9KMtRswpFgkCuNTSwylCFLKhGUu8KmqY1ZnC0Dg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [freebsd] + + '@oxlint/binding-linux-arm-gnueabihf@1.78.0': + resolution: {integrity: sha512-/uLdoJ0IXE6vo/0f0LKjinQAp+re+VMaCWaNT8ENIv2EOCkSsc8SGaflXAuW0Jua2dq5+GLVWm1NQK7P3UFSNQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm-musleabihf@1.78.0': + resolution: {integrity: sha512-7xi4Wb/O8NRJhLoUXmDJMUVpNYvB5kefdhFU1Jb8rtae4QoXlTiLwI14X4YvAXVZLNZChP8m5qO9SQAlWQTbkQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm] + os: [linux] + + '@oxlint/binding-linux-arm64-gnu@1.78.0': + resolution: {integrity: sha512-4hFW0+fVXa3OIh1Y4A5SPkmvI4wuuBSrCVKzOyE7PTjhc7yEqZ1pmvEEeS5Lj/MaqvegFxXyF33N+6jkehxdyg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-arm64-musl@1.78.0': + resolution: {integrity: sha512-oC0mvsgBJjlMijSDEhx9KuvR9zYeHXceA9MjbuXB1F8NSR78Yj2unOBrstEvTVaq+pko+kuue6DajC00eqvTdg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [linux] + libc: [musl] + + '@oxlint/binding-linux-ppc64-gnu@1.78.0': + resolution: {integrity: sha512-XAllT5SUZS+ohjuZ3/5S0cwe0r7eboiuigeStCZ5DXRYx/2KVM2UvQXvAfyzXEimtQjAB7cDQ2YxDe2Zl2WNQQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ppc64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-riscv64-gnu@1.78.0': + resolution: {integrity: sha512-trucMER/0QtecoXvc1y/UVqE3kwJipDwrx4oHfj+nNm3dq2zjP44WT0CfHNDPM3G1DXIkx/gY6lAD21NSCZVhA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-riscv64-musl@1.78.0': + resolution: {integrity: sha512-cm3O4F/HQbdzOUX5mKHqG5KDL6E5w0pnlZ+fbBy2rmLryPOowkuLagFHTopQsEIpjcaZoPOrL+BmmAytAG9HFg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [riscv64] + os: [linux] + libc: [musl] + + '@oxlint/binding-linux-s390x-gnu@1.78.0': + resolution: {integrity: sha512-33wRf6HqGNsybJ3qX4cGaQN2ODPxNmc1rMa0mrTmx3eFq1VzOnvQooi9bIGVYakW8a/wmqVx1mgsUm8R2xfTiw==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [s390x] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-x64-gnu@1.78.0': + resolution: {integrity: sha512-rRdISSYegj6VganMZ9tjRjijowfHJ09IZU01i0toBAqr6n5LEtwHq2IeS4FjW2RoskOHlb6efB26H5izYb3GEQ==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [glibc] + + '@oxlint/binding-linux-x64-musl@1.78.0': + resolution: {integrity: sha512-GmsP4rW0xTL6u5CVdcDsaN5Fbc7hBc382Wmar1kttbnwSEviM+rSINKOMQ+UQ6iH+AGwC+8gaAiwu134Tgh6Lg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [linux] + libc: [musl] + + '@oxlint/binding-openharmony-arm64@1.78.0': + resolution: {integrity: sha512-sy9yeYuADc8a+n4TLBayzMCZiHPW78DcIFVpOXTmdKHWQeM9xe5uzkqIIZmi326D5hY9XVwacipEB1p7tQjPAg==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [openharmony] + + '@oxlint/binding-win32-arm64-msvc@1.78.0': + resolution: {integrity: sha512-rjc2hF1KfMi8fZj1X/m3AmnHbdsF3rL0v6KQg0Uc880Yb2khjz+3U14sfdZ7jWTpRnN1m1NQa/TT7uU9lJWPrA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [arm64] + os: [win32] + + '@oxlint/binding-win32-ia32-msvc@1.78.0': + resolution: {integrity: sha512-zcuXFVrEFHIafRfkCQT8w/Xe41o07ozl/vwHq7p94vB29xVzsB0sZGYORU1jhcYKv3Lr0J3HbJ2T4fHH5rWmvA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [ia32] + os: [win32] + + '@oxlint/binding-win32-x64-msvc@1.78.0': + resolution: {integrity: sha512-Sb5ocmLSuYeOuXd+CFOToGKp/gjXUEWDnvIGwhnh8aq8wY4TMmEnKnvbogSW7RdMZv77JSARduS7/gv+khYEjA==} + engines: {node: ^20.19.0 || >=22.12.0} + cpu: [x64] + os: [win32] + '@playwright/test@1.62.1': resolution: {integrity: sha512-DTcUc8qii+cpHvtOwggMtBRMjKZHXYWdw8syRYu2vtzuq4Wxphqq4NfCs5Zt44L6mA8rfDfj+PHnxFc/FeK6mQ==} engines: {node: '>=20'} @@ -941,6 +1188,32 @@ packages: resolution: {integrity: sha512-qFOyK5PjiWZd+QQIh+1jhdb9LpxTF0qs7Pm8o5QHYZ0M3vKqSqzsZaEB6oWlxZ+q2sJBMI/Ktgd2N5ZwQoRHfg==} engines: {node: '>= 0.4'} + oxfmt@0.63.0: + resolution: {integrity: sha512-kgdDwv35wvVf6554U2Ab8Jnd0zTM+TsEQWwaB70RAjK3gICFAFGO+2Hd3Be27GMoXj3XRL9IKSNRVl7KBQL6iw==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + svelte: ^5.0.0 + vite-plus: '*' + peerDependenciesMeta: + svelte: + optional: true + vite-plus: + optional: true + + oxlint@1.78.0: + resolution: {integrity: sha512-QgQePuxIqKOzo1KSjG2EnITEeWvWnKAm77eq8nrMtf6AGoA+zyGc4PFYtDNJSD25g/ibOwfQ851hZ4/SPkMVoA==} + engines: {node: ^20.19.0 || >=22.12.0} + hasBin: true + peerDependencies: + oxlint-tsgolint: '>=7.0.2001' + vite-plus: '*' + peerDependenciesMeta: + oxlint-tsgolint: + optional: true + vite-plus: + optional: true + p-event@6.0.1: resolution: {integrity: sha512-Q6Bekk5wpzW5qIyUP4gdMEujObYstZl6DMMOSenwBvV0BlE5LkDwkjs5yHbZmdCEq2o4RJx4tE1vwxFVf2FG1w==} engines: {node: '>=16.17'} @@ -1003,11 +1276,6 @@ packages: resolution: {integrity: sha512-/+5VFTchJDoVj3bhoqi6UeymcD00DAwb1nJwamzPvHEszJ4FpF6SNNbUbOS8yI56qHzdV8eK0qEfOSiodkTdxg==} engines: {node: '>= 0.4'} - prettier@3.9.6: - resolution: {integrity: sha512-OpN0zzVdiaiAhxpuuj5efpIS4sY9j7bY6uR5mnj5yPzGkdkjNKSJeUThPb60Jw29QuAZgA4o+/iB49kFiaBX6g==} - engines: {node: '>=14'} - hasBin: true - pstree.remy@1.1.8: resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==} @@ -1175,6 +1443,10 @@ packages: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} engines: {node: '>= 0.4'} + tinypool@2.1.0: + resolution: {integrity: sha512-Pugqs6M0m7Lv1I7FtxN4aoyToKg1C4tu+/381vH35y8oENM/Ai7f7C4StcoK4/+BSw9ebcS8jRiVrORFKCALLw==} + engines: {node: ^20.0.0 || >=22.0.0} + to-regex-range@5.0.1: resolution: {integrity: sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==} engines: {node: '>=8.0'} @@ -1342,6 +1614,120 @@ snapshots: '@nodelib/fs.scandir': 2.1.5 fastq: 1.20.1 + '@oxfmt/binding-android-arm-eabi@0.63.0': + optional: true + + '@oxfmt/binding-android-arm64@0.63.0': + optional: true + + '@oxfmt/binding-darwin-arm64@0.63.0': + optional: true + + '@oxfmt/binding-darwin-x64@0.63.0': + optional: true + + '@oxfmt/binding-freebsd-x64@0.63.0': + optional: true + + '@oxfmt/binding-linux-arm-gnueabihf@0.63.0': + optional: true + + '@oxfmt/binding-linux-arm-musleabihf@0.63.0': + optional: true + + '@oxfmt/binding-linux-arm64-gnu@0.63.0': + optional: true + + '@oxfmt/binding-linux-arm64-musl@0.63.0': + optional: true + + '@oxfmt/binding-linux-ppc64-gnu@0.63.0': + optional: true + + '@oxfmt/binding-linux-riscv64-gnu@0.63.0': + optional: true + + '@oxfmt/binding-linux-riscv64-musl@0.63.0': + optional: true + + '@oxfmt/binding-linux-s390x-gnu@0.63.0': + optional: true + + '@oxfmt/binding-linux-x64-gnu@0.63.0': + optional: true + + '@oxfmt/binding-linux-x64-musl@0.63.0': + optional: true + + '@oxfmt/binding-openharmony-arm64@0.63.0': + optional: true + + '@oxfmt/binding-win32-arm64-msvc@0.63.0': + optional: true + + '@oxfmt/binding-win32-ia32-msvc@0.63.0': + optional: true + + '@oxfmt/binding-win32-x64-msvc@0.63.0': + optional: true + + '@oxlint/binding-android-arm-eabi@1.78.0': + optional: true + + '@oxlint/binding-android-arm64@1.78.0': + optional: true + + '@oxlint/binding-darwin-arm64@1.78.0': + optional: true + + '@oxlint/binding-darwin-x64@1.78.0': + optional: true + + '@oxlint/binding-freebsd-x64@1.78.0': + optional: true + + '@oxlint/binding-linux-arm-gnueabihf@1.78.0': + optional: true + + '@oxlint/binding-linux-arm-musleabihf@1.78.0': + optional: true + + '@oxlint/binding-linux-arm64-gnu@1.78.0': + optional: true + + '@oxlint/binding-linux-arm64-musl@1.78.0': + optional: true + + '@oxlint/binding-linux-ppc64-gnu@1.78.0': + optional: true + + '@oxlint/binding-linux-riscv64-gnu@1.78.0': + optional: true + + '@oxlint/binding-linux-riscv64-musl@1.78.0': + optional: true + + '@oxlint/binding-linux-s390x-gnu@1.78.0': + optional: true + + '@oxlint/binding-linux-x64-gnu@1.78.0': + optional: true + + '@oxlint/binding-linux-x64-musl@1.78.0': + optional: true + + '@oxlint/binding-openharmony-arm64@1.78.0': + optional: true + + '@oxlint/binding-win32-arm64-msvc@1.78.0': + optional: true + + '@oxlint/binding-win32-ia32-msvc@1.78.0': + optional: true + + '@oxlint/binding-win32-x64-msvc@1.78.0': + optional: true + '@playwright/test@1.62.1': dependencies: playwright: 1.62.1 @@ -2127,6 +2513,52 @@ snapshots: object-keys: 1.1.1 safe-push-apply: 1.0.0 + oxfmt@0.63.0: + dependencies: + tinypool: 2.1.0 + optionalDependencies: + '@oxfmt/binding-android-arm-eabi': 0.63.0 + '@oxfmt/binding-android-arm64': 0.63.0 + '@oxfmt/binding-darwin-arm64': 0.63.0 + '@oxfmt/binding-darwin-x64': 0.63.0 + '@oxfmt/binding-freebsd-x64': 0.63.0 + '@oxfmt/binding-linux-arm-gnueabihf': 0.63.0 + '@oxfmt/binding-linux-arm-musleabihf': 0.63.0 + '@oxfmt/binding-linux-arm64-gnu': 0.63.0 + '@oxfmt/binding-linux-arm64-musl': 0.63.0 + '@oxfmt/binding-linux-ppc64-gnu': 0.63.0 + '@oxfmt/binding-linux-riscv64-gnu': 0.63.0 + '@oxfmt/binding-linux-riscv64-musl': 0.63.0 + '@oxfmt/binding-linux-s390x-gnu': 0.63.0 + '@oxfmt/binding-linux-x64-gnu': 0.63.0 + '@oxfmt/binding-linux-x64-musl': 0.63.0 + '@oxfmt/binding-openharmony-arm64': 0.63.0 + '@oxfmt/binding-win32-arm64-msvc': 0.63.0 + '@oxfmt/binding-win32-ia32-msvc': 0.63.0 + '@oxfmt/binding-win32-x64-msvc': 0.63.0 + + oxlint@1.78.0: + optionalDependencies: + '@oxlint/binding-android-arm-eabi': 1.78.0 + '@oxlint/binding-android-arm64': 1.78.0 + '@oxlint/binding-darwin-arm64': 1.78.0 + '@oxlint/binding-darwin-x64': 1.78.0 + '@oxlint/binding-freebsd-x64': 1.78.0 + '@oxlint/binding-linux-arm-gnueabihf': 1.78.0 + '@oxlint/binding-linux-arm-musleabihf': 1.78.0 + '@oxlint/binding-linux-arm64-gnu': 1.78.0 + '@oxlint/binding-linux-arm64-musl': 1.78.0 + '@oxlint/binding-linux-ppc64-gnu': 1.78.0 + '@oxlint/binding-linux-riscv64-gnu': 1.78.0 + '@oxlint/binding-linux-riscv64-musl': 1.78.0 + '@oxlint/binding-linux-s390x-gnu': 1.78.0 + '@oxlint/binding-linux-x64-gnu': 1.78.0 + '@oxlint/binding-linux-x64-musl': 1.78.0 + '@oxlint/binding-openharmony-arm64': 1.78.0 + '@oxlint/binding-win32-arm64-msvc': 1.78.0 + '@oxlint/binding-win32-ia32-msvc': 1.78.0 + '@oxlint/binding-win32-x64-msvc': 1.78.0 + p-event@6.0.1: dependencies: p-timeout: 6.1.4 @@ -2175,8 +2607,6 @@ snapshots: possible-typed-array-names@1.1.0: {} - prettier@3.9.6: {} - pstree.remy@1.1.8: {} qs@6.14.0: @@ -2383,6 +2813,8 @@ snapshots: supports-preserve-symlinks-flag@1.0.0: {} + tinypool@2.1.0: {} + to-regex-range@5.0.1: dependencies: is-number: 7.0.0 diff --git a/js/tests/index.spec.js b/js/tests/index.spec.js index 0fa5b16..2370e6b 100644 --- a/js/tests/index.spec.js +++ b/js/tests/index.spec.js @@ -1,7 +1,7 @@ import { test, expect } from "@playwright/test"; test.describe("Basics", () => { - test("basic", async ({ page }) => { + test("basic", async () => { await expect("").toBe(""); }); }); diff --git a/js/tools/bundle.mjs b/js/tools/bundle.mjs index b417871..f493141 100644 --- a/js/tools/bundle.mjs +++ b/js/tools/bundle.mjs @@ -11,49 +11,49 @@ const COMMON_DEFINE = { }; const COMMON_LOADER = { - ".css": "text", - ".html": "text", - ".jsx": "jsx", - ".png": "file", - ".ttf": "file", - ".wasm": "file", + ".css": "text", + ".html": "text", + ".jsx": "jsx", + ".png": "file", + ".ttf": "file", + ".wasm": "file", }; const DEFAULT_BUILD = { - target: ["es2022"], - bundle: true, - format: "esm", - minify: DEBUG, - sourcemap: true, - metafile: true, - entryNames: "[name]", - chunkNames: "[name]", - assetNames: "[name]", - define: COMMON_DEFINE, - loader: COMMON_LOADER, - plugins: [], + target: ["es2022"], + bundle: true, + format: "esm", + minify: DEBUG, + sourcemap: true, + metafile: true, + entryNames: "[name]", + chunkNames: "[name]", + assetNames: "[name]", + define: COMMON_DEFINE, + loader: COMMON_LOADER, + plugins: [], }; export const bundle = async (config) => { - const result = await esbuild.build({ - ...DEFAULT_BUILD, - ...config, - }); - - if (result.metafile) { - for (const output of Object.keys(result.metafile.outputs)) { - const { inputs, bytes } = result.metafile.outputs[output]; - for (const input of Object.keys(inputs)) { - if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) { - delete inputs[input]; - } - } + const result = await esbuild.build({ + ...DEFAULT_BUILD, + ...config, + }); + + if (result.metafile) { + for (const output of Object.keys(result.metafile.outputs)) { + const { inputs, bytes } = result.metafile.outputs[output]; + for (const input of Object.keys(inputs)) { + if (inputs[input].bytesInOutput / bytes < CUTOFF_PERCENT) { + delete inputs[input]; } + } + } - const text = await esbuild.analyzeMetafile(result.metafile, { - color: true, - }); + const text = await esbuild.analyzeMetafile(result.metafile, { + color: true, + }); - console.log(text); - } + console.log(text); + } }; diff --git a/js/tools/css.mjs b/js/tools/css.mjs index 67aa219..e7b2168 100644 --- a/js/tools/css.mjs +++ b/js/tools/css.mjs @@ -39,7 +39,10 @@ const bundle_one = async (file, resolver) => { fs.writeFileSync(path.join("./dist/css", outName), code); }; -export const bundle_css = async (root = "src/css/index.css", resolver = null) => { +export const bundle_css = async ( + root = "src/css/index.css", + resolver = null, +) => { const resolved = path.resolve(root); if (fs.statSync(resolved).isDirectory()) { const files = fs.readdirSync(resolved).filter((f) => f.endsWith(".css")); @@ -49,4 +52,4 @@ export const bundle_css = async (root = "src/css/index.css", resolver = null) => } else { await bundle_one(root, resolver); } -} +}; diff --git a/js/tools/externals.mjs b/js/tools/externals.mjs index 0ee4835..9542759 100644 --- a/js/tools/externals.mjs +++ b/js/tools/externals.mjs @@ -1,18 +1,18 @@ export const node_modules_external = (whitelist) => { - function setup(build) { - build.onResolve({ filter: /^[A-Za-z0-9\@]/ }, (args) => { - if (!whitelist || !args.path.startsWith(whitelist)) { - return { - path: args.path, - external: true, - namespace: "skip-node-modules", - }; - } - }); - } + function setup(build) { + build.onResolve({ filter: /^[A-Za-z0-9@]/ }, (args) => { + if (!whitelist || !args.path.startsWith(whitelist)) { + return { + path: args.path, + external: true, + namespace: "skip-node-modules", + }; + } + }); + } - return { - name: "node_modules_external", - setup, - }; + return { + name: "node_modules_external", + setup, + }; }; diff --git a/js/tools/getarg.mjs b/js/tools/getarg.mjs index 9cfe88c..34cb7e8 100644 --- a/js/tools/getarg.mjs +++ b/js/tools/getarg.mjs @@ -1,23 +1,23 @@ export const getarg = (flag, ...args) => { - if (Array.isArray(flag)) { - flag = flag.map((x, i) => x + (args[i] || "")).join(""); - } - const argv = process.argv.slice(2); - if (flag) { - const index = argv.indexOf(flag); - if (index > -1) { - const next = argv[index + 1]; - if (next) { - return next; - } else { - return true; - } + if (Array.isArray(flag)) { + flag = flag.map((x, i) => x + (args[i] || "")).join(""); + } + const argv = process.argv.slice(2); + if (flag) { + const index = argv.indexOf(flag); + if (index > -1) { + const next = argv[index + 1]; + if (next) { + return next; + } else { + return true; } - } else { - return argv - .map(function (arg) { - return "'" + arg.replace(/'/g, "'\\''") + "'"; - }) - .join(" "); } - }; + } else { + return argv + .map(function (arg) { + return "'" + arg.replace(/'/g, "'\\''") + "'"; + }) + .join(" "); + } +}; diff --git a/pyproject.toml b/pyproject.toml index 8b72943..4c09982 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,11 @@ current_version = "0.1.0" commit = true tag = true commit_args = "-s" +pre_commit_hooks = [ + "cargo update --workspace", + "pnpm --dir js install --lockfile-only --no-frozen-lockfile --ignore-scripts", + "git add Cargo.lock js/pnpm-lock.yaml", +] [[tool.bumpversion.files]] filename = "python_template_rust/__init__.py"