diff --git a/.eslintrc.cjs b/.eslintrc.cjs index c1e4e03d..afdf43f6 100644 --- a/.eslintrc.cjs +++ b/.eslintrc.cjs @@ -35,6 +35,13 @@ module.exports = defineConfig({ curly: ['error'], 'linebreak-style': ['error', 'unix'], 'no-case-declarations': 'warn', + 'no-restricted-globals': [ + 'error', + { + name: '__dirname', + message: "Use `fileURLToPath(new URL('.', import.meta.url))` instead.", + }, + ], quotes: ['error', 'single', { avoidEscape: true }], semi: ['error', 'always'], @@ -98,9 +105,11 @@ module.exports = defineConfig({ 'coffeescript', 'colno', 'doctype', + 'dts', 'ecmascript', 'endregion', 'eos', + 'esm', 'fallthrough', 'filenames', 'frameset', @@ -115,6 +124,7 @@ module.exports = defineConfig({ 'lf', 'lineno', 'loc', + 'minify', 'multiline', 'multilines', 'num', @@ -122,6 +132,7 @@ module.exports = defineConfig({ 'parens', 'pipeless', 'plist', + 'postcss', 'pragma', 'prepend', 'readdir', diff --git a/.github/ISSUE_TEMPLATE/bug-report-issue-forms-beta.yml b/.github/ISSUE_TEMPLATE/bug-report-issue-forms-beta.yml index af867bd3..b16a95e9 100644 --- a/.github/ISSUE_TEMPLATE/bug-report-issue-forms-beta.yml +++ b/.github/ISSUE_TEMPLATE/bug-report-issue-forms-beta.yml @@ -8,14 +8,14 @@ body: id: plugin-version attributes: label: Plugin Version - placeholder: v2.x.x + placeholder: v3.x.x validations: required: true - type: input id: prettier-version attributes: label: Prettier Version - placeholder: v2.x.x + placeholder: v3.x.x validations: required: true - type: checkboxes diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md index 1ecc26b1..7ce7d080 100644 --- a/.github/ISSUE_TEMPLATE/bug-report.md +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -10,8 +10,8 @@ assignees: '' | Tool | Version | | --------- | ----------------------- | -| Plugin | v2.x.x | -| Prettier | v2.x.x | +| Plugin | v3.x.x | +| Prettier | v3.x.x | | Framework | none,vue,angular,svelte | | Node | vx.x.x | | OS | win,linux,mac | diff --git a/.prettierrc.cjs b/.prettierrc.cjs index 05bb7f71..c2226c36 100644 --- a/.prettierrc.cjs +++ b/.prettierrc.cjs @@ -5,7 +5,7 @@ * @type {import('prettier').Options} */ module.exports = { - plugins: [require.resolve('prettier-plugin-organize-imports')], + plugins: ['prettier-plugin-organize-imports'], singleQuote: true, trailingComma: 'all', overrides: [ diff --git a/CHANGELOG.md b/CHANGELOG.md index 1816f3a3..f7d62422 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,18 @@ # Next -[diff](https://github.com/prettier/plugin-pug/compare/2.5.2...main) +[diff](https://github.com/prettier/plugin-pug/compare/3.0.0...main) + +# 3.0.0 + +[diff](https://github.com/prettier/plugin-pug/compare/2.5.2...3.0.0) + +## BREAKING CHANGES + +**Dropped support for Prettier v2 and CJS** ([#458]) + +If you are using Prettier v2 / CJS, you need to stay on `2.5.2`. + +[#458]: https://github.com/prettier/plugin-pug/pull/458 # 2.5.2 diff --git a/docs/guide/index.md b/docs/guide/index.md index b2c35a76..d65aef14 100644 --- a/docs/guide/index.md +++ b/docs/guide/index.md @@ -95,8 +95,7 @@ You can write your `.prettierrc.cjs` like this to get fully type check support w * @type {import('prettier').Options} */ module.exports = { - // `require.resolve` is needed for e.g. `pnpm` - plugins: [require.resolve('@prettier/plugin-pug')], + plugins: ['@prettier/plugin-pug'], printWidth: 120, singleQuote: true, diff --git a/package.json b/package.json index dde8aa80..f01c9b31 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,11 @@ { "name": "@prettier/plugin-pug", - "version": "2.5.2", + "version": "3.0.0", "description": "Prettier Pug Plugin", - "main": "dist/index.js", "scripts": { "clean": "rimraf coverage .eslintcache dist junit.xml docs/.vitepress/dist pnpm-lock.yaml node_modules", "build:clean": "rimraf dist", - "build:code": "tsc --project tsconfig.build.json", + "build:code": "tsup-node", "build": "run-s build:clean build:code", "docs:build": "vitepress build docs", "docs:dev": "vitepress dev docs", @@ -19,6 +18,20 @@ "prepublishOnly": "pnpm run clean && pnpm install && pnpm run build", "preflight": "pnpm install && run-s format lint build test ts-check" }, + "type": "module", + "main": "dist/index.js", + "module": "dist/index.js", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + }, + "./src/*": { + "types": "./src/*.d.ts", + "default": "./src/*.ts" + }, + "./package.json": "./package.json" + }, "keywords": [ "pug", "prettier-plugin", @@ -56,10 +69,9 @@ "pug-lexer": "^5.0.1" }, "devDependencies": { - "@types/node": "~20.4.4", - "@types/prettier": "~2.7.3", - "@typescript-eslint/eslint-plugin": "~6.1.0", - "@typescript-eslint/parser": "~6.1.0", + "@types/node": "~20.4.5", + "@typescript-eslint/eslint-plugin": "~6.2.0", + "@typescript-eslint/parser": "~6.2.0", "@vitest/coverage-v8": "~0.33.0", "benchmark": "~2.1.4", "eslint": "~8.45.0", @@ -68,21 +80,22 @@ "eslint-gitignore": "~0.1.0", "eslint-plugin-inclusive-language": "~2.2.0", "eslint-plugin-jsdoc": "~46.4.4", - "eslint-plugin-prettier": "~4.2.1", + "eslint-plugin-prettier": "~5.0.0", "eslint-plugin-spellcheck": "~0.0.20", "npm-run-all": "~4.1.5", - "prettier": "2.8.8", + "prettier": "3.0.0", "prettier-plugin-organize-imports": "~3.2.3", "rimraf": "~5.0.1", + "tsup": "~7.1.0", "typescript": "~5.1.6", - "vite": "~4.4.6", + "vite": "~4.4.7", "vitepress": "1.0.0-beta.6", "vitest": "~0.33.0" }, "peerDependencies": { - "prettier": "^2.3.0" + "prettier": "^3.0.0" }, - "packageManager": "pnpm@8.6.9", + "packageManager": "pnpm@8.6.10", "engines": { "node": "^16.13.0 || >=18.0.0", "npm": ">=7.10.0" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f9baeb19..463c2551 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -11,17 +11,14 @@ dependencies: devDependencies: '@types/node': - specifier: ~20.4.4 - version: 20.4.4 - '@types/prettier': - specifier: ~2.7.3 - version: 2.7.3 + specifier: ~20.4.5 + version: 20.4.5 '@typescript-eslint/eslint-plugin': - specifier: ~6.1.0 - version: 6.1.0(@typescript-eslint/parser@6.1.0)(eslint@8.45.0)(typescript@5.1.6) + specifier: ~6.2.0 + version: 6.2.0(@typescript-eslint/parser@6.2.0)(eslint@8.45.0)(typescript@5.1.6) '@typescript-eslint/parser': - specifier: ~6.1.0 - version: 6.1.0(eslint@8.45.0)(typescript@5.1.6) + specifier: ~6.2.0 + version: 6.2.0(eslint@8.45.0)(typescript@5.1.6) '@vitest/coverage-v8': specifier: ~0.33.0 version: 0.33.0(vitest@0.33.0) @@ -47,8 +44,8 @@ devDependencies: specifier: ~46.4.4 version: 46.4.4(eslint@8.45.0) eslint-plugin-prettier: - specifier: ~4.2.1 - version: 4.2.1(eslint-config-prettier@8.8.0)(eslint@8.45.0)(prettier@2.8.8) + specifier: ~5.0.0 + version: 5.0.0(eslint-config-prettier@8.8.0)(eslint@8.45.0)(prettier@3.0.0) eslint-plugin-spellcheck: specifier: ~0.0.20 version: 0.0.20(eslint@8.45.0) @@ -56,23 +53,26 @@ devDependencies: specifier: ~4.1.5 version: 4.1.5 prettier: - specifier: 2.8.8 - version: 2.8.8 + specifier: 3.0.0 + version: 3.0.0 prettier-plugin-organize-imports: specifier: ~3.2.3 - version: 3.2.3(prettier@2.8.8)(typescript@5.1.6) + version: 3.2.3(prettier@3.0.0)(typescript@5.1.6) rimraf: specifier: ~5.0.1 version: 5.0.1 + tsup: + specifier: ~7.1.0 + version: 7.1.0(typescript@5.1.6) typescript: specifier: ~5.1.6 version: 5.1.6 vite: - specifier: ~4.4.6 - version: 4.4.6(@types/node@20.4.4) + specifier: ~4.4.7 + version: 4.4.7(@types/node@20.4.5) vitepress: specifier: 1.0.0-beta.6 - version: 1.0.0-beta.6(@types/node@20.4.4)(search-insights@2.7.0) + version: 1.0.0-beta.6(@types/node@20.4.5)(search-insights@2.7.0) vitest: specifier: ~0.33.0 version: 0.33.0 @@ -310,8 +310,8 @@ packages: jsdoc-type-pratt-parser: 4.0.0 dev: true - /@esbuild/android-arm64@0.18.16: - resolution: {integrity: sha512-wsCqSPqLz+6Ov+OM4EthU43DyYVVyfn15S4j1bJzylDpc1r1jZFFfJQNfDuT8SlgwuqpmpJXK4uPlHGw6ve7eA==} + /@esbuild/android-arm64@0.18.17: + resolution: {integrity: sha512-9np+YYdNDed5+Jgr1TdWBsozZ85U1Oa3xW0c7TWqH0y2aGghXtZsuT8nYRbzOMcl0bXZXjOGbksoTtVOlWrRZg==} engines: {node: '>=12'} cpu: [arm64] os: [android] @@ -319,8 +319,8 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.18.16: - resolution: {integrity: sha512-gCHjjQmA8L0soklKbLKA6pgsLk1byULuHe94lkZDzcO3/Ta+bbeewJioEn1Fr7kgy9NWNFy/C+MrBwC6I/WCug==} + /@esbuild/android-arm@0.18.17: + resolution: {integrity: sha512-wHsmJG/dnL3OkpAcwbgoBTTMHVi4Uyou3F5mf58ZtmUyIKfcdA7TROav/6tCzET4A3QW2Q2FC+eFneMU+iyOxg==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -328,8 +328,8 @@ packages: dev: true optional: true - /@esbuild/android-x64@0.18.16: - resolution: {integrity: sha512-ldsTXolyA3eTQ1//4DS+E15xl0H/3DTRJaRL0/0PgkqDsI0fV/FlOtD+h0u/AUJr+eOTlZv4aC9gvfppo3C4sw==} + /@esbuild/android-x64@0.18.17: + resolution: {integrity: sha512-O+FeWB/+xya0aLg23hHEM2E3hbfwZzjqumKMSIqcHbNvDa+dza2D0yLuymRBQQnC34CWrsJUXyH2MG5VnLd6uw==} engines: {node: '>=12'} cpu: [x64] os: [android] @@ -337,8 +337,8 @@ packages: dev: true optional: true - /@esbuild/darwin-arm64@0.18.16: - resolution: {integrity: sha512-aBxruWCII+OtluORR/KvisEw0ALuw/qDQWvkoosA+c/ngC/Kwk0lLaZ+B++LLS481/VdydB2u6tYpWxUfnLAIw==} + /@esbuild/darwin-arm64@0.18.17: + resolution: {integrity: sha512-M9uJ9VSB1oli2BE/dJs3zVr9kcCBBsE883prage1NWz6pBS++1oNn/7soPNS3+1DGj0FrkSvnED4Bmlu1VAE9g==} engines: {node: '>=12'} cpu: [arm64] os: [darwin] @@ -346,8 +346,8 @@ packages: dev: true optional: true - /@esbuild/darwin-x64@0.18.16: - resolution: {integrity: sha512-6w4Dbue280+rp3LnkgmriS1icOUZDyPuZo/9VsuMUTns7SYEiOaJ7Ca1cbhu9KVObAWfmdjUl4gwy9TIgiO5eA==} + /@esbuild/darwin-x64@0.18.17: + resolution: {integrity: sha512-XDre+J5YeIJDMfp3n0279DFNrGCXlxOuGsWIkRb1NThMZ0BsrWXoTg23Jer7fEXQ9Ye5QjrvXpxnhzl3bHtk0g==} engines: {node: '>=12'} cpu: [x64] os: [darwin] @@ -355,8 +355,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-arm64@0.18.16: - resolution: {integrity: sha512-x35fCebhe9s979DGKbVAwXUOcTmCIE32AIqB9CB1GralMIvxdnMLAw5CnID17ipEw9/3MvDsusj/cspYt2ZLNQ==} + /@esbuild/freebsd-arm64@0.18.17: + resolution: {integrity: sha512-cjTzGa3QlNfERa0+ptykyxs5A6FEUQQF0MuilYXYBGdBxD3vxJcKnzDlhDCa1VAJCmAxed6mYhA2KaJIbtiNuQ==} engines: {node: '>=12'} cpu: [arm64] os: [freebsd] @@ -364,8 +364,8 @@ packages: dev: true optional: true - /@esbuild/freebsd-x64@0.18.16: - resolution: {integrity: sha512-YM98f+PeNXF3GbxIJlUsj+McUWG1irguBHkszCIwfr3BXtXZsXo0vqybjUDFfu9a8Wr7uUD/YSmHib+EeGAFlg==} + /@esbuild/freebsd-x64@0.18.17: + resolution: {integrity: sha512-sOxEvR8d7V7Kw8QqzxWc7bFfnWnGdaFBut1dRUYtu+EIRXefBc/eIsiUiShnW0hM3FmQ5Zf27suDuHsKgZ5QrA==} engines: {node: '>=12'} cpu: [x64] os: [freebsd] @@ -373,8 +373,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm64@0.18.16: - resolution: {integrity: sha512-XIqhNUxJiuy+zsR77+H5Z2f7s4YRlriSJKtvx99nJuG5ATuJPjmZ9n0ANgnGlPCpXGSReFpgcJ7O3SMtzIFeiQ==} + /@esbuild/linux-arm64@0.18.17: + resolution: {integrity: sha512-c9w3tE7qA3CYWjT+M3BMbwMt+0JYOp3vCMKgVBrCl1nwjAlOMYzEo+gG7QaZ9AtqZFj5MbUc885wuBBmu6aADQ==} engines: {node: '>=12'} cpu: [arm64] os: [linux] @@ -382,8 +382,8 @@ packages: dev: true optional: true - /@esbuild/linux-arm@0.18.16: - resolution: {integrity: sha512-b5ABb+5Ha2C9JkeZXV+b+OruR1tJ33ePmv9ZwMeETSEKlmu/WJ45XTTG+l6a2KDsQtJJ66qo/hbSGBtk0XVLHw==} + /@esbuild/linux-arm@0.18.17: + resolution: {integrity: sha512-2d3Lw6wkwgSLC2fIvXKoMNGVaeY8qdN0IC3rfuVxJp89CRfA3e3VqWifGDfuakPmp90+ZirmTfye1n4ncjv2lg==} engines: {node: '>=12'} cpu: [arm] os: [linux] @@ -391,8 +391,8 @@ packages: dev: true optional: true - /@esbuild/linux-ia32@0.18.16: - resolution: {integrity: sha512-no+pfEpwnRvIyH+txbBAWtjxPU9grslmTBfsmDndj7bnBmr55rOo/PfQmRfz7Qg9isswt1FP5hBbWb23fRWnow==} + /@esbuild/linux-ia32@0.18.17: + resolution: {integrity: sha512-1DS9F966pn5pPnqXYz16dQqWIB0dmDfAQZd6jSSpiT9eX1NzKh07J6VKR3AoXXXEk6CqZMojiVDSZi1SlmKVdg==} engines: {node: '>=12'} cpu: [ia32] os: [linux] @@ -400,8 +400,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.18.16: - resolution: {integrity: sha512-Zbnczs9ZXjmo0oZSS0zbNlJbcwKXa/fcNhYQjahDs4Xg18UumpXG/lwM2lcSvHS3mTrRyCYZvJbmzYc4laRI1g==} + /@esbuild/linux-loong64@0.18.17: + resolution: {integrity: sha512-EvLsxCk6ZF0fpCB6w6eOI2Fc8KW5N6sHlIovNe8uOFObL2O+Mr0bflPHyHwLT6rwMg9r77WOAWb2FqCQrVnwFg==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -409,8 +409,8 @@ packages: dev: true optional: true - /@esbuild/linux-mips64el@0.18.16: - resolution: {integrity: sha512-YMF7hih1HVR/hQVa/ot4UVffc5ZlrzEb3k2ip0nZr1w6fnYypll9td2qcoMLvd3o8j3y6EbJM3MyIcXIVzXvQQ==} + /@esbuild/linux-mips64el@0.18.17: + resolution: {integrity: sha512-e0bIdHA5p6l+lwqTE36NAW5hHtw2tNRmHlGBygZC14QObsA3bD4C6sXLJjvnDIjSKhW1/0S3eDy+QmX/uZWEYQ==} engines: {node: '>=12'} cpu: [mips64el] os: [linux] @@ -418,8 +418,8 @@ packages: dev: true optional: true - /@esbuild/linux-ppc64@0.18.16: - resolution: {integrity: sha512-Wkz++LZ29lDwUyTSEnzDaaP5OveOgTU69q9IyIw9WqLRxM4BjTBjz9un4G6TOvehWpf/J3gYVFN96TjGHrbcNQ==} + /@esbuild/linux-ppc64@0.18.17: + resolution: {integrity: sha512-BAAilJ0M5O2uMxHYGjFKn4nJKF6fNCdP1E0o5t5fvMYYzeIqy2JdAP88Az5LHt9qBoUa4tDaRpfWt21ep5/WqQ==} engines: {node: '>=12'} cpu: [ppc64] os: [linux] @@ -427,8 +427,8 @@ packages: dev: true optional: true - /@esbuild/linux-riscv64@0.18.16: - resolution: {integrity: sha512-LFMKZ30tk78/mUv1ygvIP+568bwf4oN6reG/uczXnz6SvFn4e2QUFpUpZY9iSJT6Qpgstrhef/nMykIXZtZWGQ==} + /@esbuild/linux-riscv64@0.18.17: + resolution: {integrity: sha512-Wh/HW2MPnC3b8BqRSIme/9Zhab36PPH+3zam5pqGRH4pE+4xTrVLx2+XdGp6fVS3L2x+DrsIcsbMleex8fbE6g==} engines: {node: '>=12'} cpu: [riscv64] os: [linux] @@ -436,8 +436,8 @@ packages: dev: true optional: true - /@esbuild/linux-s390x@0.18.16: - resolution: {integrity: sha512-3ZC0BgyYHYKfZo3AV2/66TD/I9tlSBaW7eWTEIkrQQKfJIifKMMttXl9FrAg+UT0SGYsCRLI35Gwdmm96vlOjg==} + /@esbuild/linux-s390x@0.18.17: + resolution: {integrity: sha512-j/34jAl3ul3PNcK3pfI0NSlBANduT2UO5kZ7FCaK33XFv3chDhICLY8wJJWIhiQ+YNdQ9dxqQctRg2bvrMlYgg==} engines: {node: '>=12'} cpu: [s390x] os: [linux] @@ -445,8 +445,8 @@ packages: dev: true optional: true - /@esbuild/linux-x64@0.18.16: - resolution: {integrity: sha512-xu86B3647DihHJHv/wx3NCz2Dg1gjQ8bbf9cVYZzWKY+gsvxYmn/lnVlqDRazObc3UMwoHpUhNYaZset4X8IPA==} + /@esbuild/linux-x64@0.18.17: + resolution: {integrity: sha512-QM50vJ/y+8I60qEmFxMoxIx4de03pGo2HwxdBeFd4nMh364X6TIBZ6VQ5UQmPbQWUVWHWws5MmJXlHAXvJEmpQ==} engines: {node: '>=12'} cpu: [x64] os: [linux] @@ -454,8 +454,8 @@ packages: dev: true optional: true - /@esbuild/netbsd-x64@0.18.16: - resolution: {integrity: sha512-uVAgpimx9Ffw3xowtg/7qQPwHFx94yCje+DoBx+LNm2ePDpQXHrzE+Sb0Si2VBObYz+LcRps15cq+95YM7gkUw==} + /@esbuild/netbsd-x64@0.18.17: + resolution: {integrity: sha512-/jGlhWR7Sj9JPZHzXyyMZ1RFMkNPjC6QIAan0sDOtIo2TYk3tZn5UDrkE0XgsTQCxWTTOcMPf9p6Rh2hXtl5TQ==} engines: {node: '>=12'} cpu: [x64] os: [netbsd] @@ -463,8 +463,8 @@ packages: dev: true optional: true - /@esbuild/openbsd-x64@0.18.16: - resolution: {integrity: sha512-6OjCQM9wf7z8/MBi6BOWaTL2AS/SZudsZtBziXMtNI8r/U41AxS9x7jn0ATOwVy08OotwkPqGRMkpPR2wcTJXA==} + /@esbuild/openbsd-x64@0.18.17: + resolution: {integrity: sha512-rSEeYaGgyGGf4qZM2NonMhMOP/5EHp4u9ehFiBrg7stH6BYEEjlkVREuDEcQ0LfIl53OXLxNbfuIj7mr5m29TA==} engines: {node: '>=12'} cpu: [x64] os: [openbsd] @@ -472,8 +472,8 @@ packages: dev: true optional: true - /@esbuild/sunos-x64@0.18.16: - resolution: {integrity: sha512-ZoNkruFYJp9d1LbUYCh8awgQDvB9uOMZqlQ+gGEZR7v6C+N6u7vPr86c+Chih8niBR81Q/bHOSKGBK3brJyvkQ==} + /@esbuild/sunos-x64@0.18.17: + resolution: {integrity: sha512-Y7ZBbkLqlSgn4+zot4KUNYst0bFoO68tRgI6mY2FIM+b7ZbyNVtNbDP5y8qlu4/knZZ73fgJDlXID+ohY5zt5g==} engines: {node: '>=12'} cpu: [x64] os: [sunos] @@ -481,8 +481,8 @@ packages: dev: true optional: true - /@esbuild/win32-arm64@0.18.16: - resolution: {integrity: sha512-+j4anzQ9hrs+iqO+/wa8UE6TVkKua1pXUb0XWFOx0FiAj6R9INJ+WE//1/Xo6FG1vB5EpH3ko+XcgwiDXTxcdw==} + /@esbuild/win32-arm64@0.18.17: + resolution: {integrity: sha512-bwPmTJsEQcbZk26oYpc4c/8PvTY3J5/QK8jM19DVlEsAB41M39aWovWoHtNm78sd6ip6prilxeHosPADXtEJFw==} engines: {node: '>=12'} cpu: [arm64] os: [win32] @@ -490,8 +490,8 @@ packages: dev: true optional: true - /@esbuild/win32-ia32@0.18.16: - resolution: {integrity: sha512-5PFPmq3sSKTp9cT9dzvI67WNfRZGvEVctcZa1KGjDDu4n3H8k59Inbk0du1fz0KrAbKKNpJbdFXQMDUz7BG4rQ==} + /@esbuild/win32-ia32@0.18.17: + resolution: {integrity: sha512-H/XaPtPKli2MhW+3CQueo6Ni3Avggi6hP/YvgkEe1aSaxw+AeO8MFjq8DlgfTd9Iz4Yih3QCZI6YLMoyccnPRg==} engines: {node: '>=12'} cpu: [ia32] os: [win32] @@ -499,8 +499,8 @@ packages: dev: true optional: true - /@esbuild/win32-x64@0.18.16: - resolution: {integrity: sha512-sCIVrrtcWN5Ua7jYXNG1xD199IalrbfV2+0k/2Zf2OyV2FtnQnMgdzgpRAbi4AWlKJj1jkX+M+fEGPQj6BQB4w==} + /@esbuild/win32-x64@0.18.17: + resolution: {integrity: sha512-fGEb8f2BSA3CW7riJVurug65ACLuQAzKq0SSqkY2b2yHHH0MzDfbLyKIGzHwOI/gkHcxM/leuSW6D5w/LMNitA==} engines: {node: '>=12'} cpu: [x64] os: [win32] @@ -518,8 +518,8 @@ packages: eslint-visitor-keys: 3.4.1 dev: true - /@eslint-community/regexpp@4.6.0: - resolution: {integrity: sha512-uiPeRISaglZnaZk8vwrjQZ1CxogZeY/4IYft6gBOTqu1WhVXWmCmZMWxUv2Q/pxSvPdp1JPaO62kLOcOkMqWrw==} + /@eslint-community/regexpp@4.6.2: + resolution: {integrity: sha512-pPTNuaAG3QMH+buKyBIGJs3g/S5y0caxw0ygM3YyE6yJFySwiGGSzA+mM3KJ8QQvzeLh3blwgSonkFjgQdxzMw==} engines: {node: ^12.0.0 || ^14.0.0 || >=16.0.0} dev: true @@ -651,6 +651,18 @@ packages: dev: true optional: true + /@pkgr/utils@2.4.2: + resolution: {integrity: sha512-POgTXhjrTfbTV63DiFXav4lBHiICLKKwDeaKn9Nphwj7WH6m0hMMCaJkMyRWjgtPFyRKRVoMXXjczsTQRDEhYw==} + engines: {node: ^12.20.0 || ^14.18.0 || >=16.0.0} + dependencies: + cross-spawn: 7.0.3 + fast-glob: 3.3.1 + is-glob: 4.0.3 + open: 9.1.0 + picocolors: 1.0.0 + tslib: 2.6.1 + dev: true + /@sinclair/typebox@0.27.8: resolution: {integrity: sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==} dev: true @@ -673,12 +685,8 @@ packages: resolution: {integrity: sha512-Hr5Jfhc9eYOQNPYO5WLDq/n4jqijdHNlDXjuAQkkt+mWdQR+XJToOHrsD4cPaMXpn6KO7y2+wM8AZEs8VpBLVA==} dev: true - /@types/node@20.4.4: - resolution: {integrity: sha512-CukZhumInROvLq3+b5gLev+vgpsIqC2D0deQr/yS1WnxvmYLlJXZpaQrQiseMY+6xusl79E04UjWoqyr+t1/Ew==} - dev: true - - /@types/prettier@2.7.3: - resolution: {integrity: sha512-+68kP9yzs4LMp7VNh8gdzMSPZFL44MLGqiHWvttYJe+6qnuVr4Ek9wSBQoveqY/r+LwjCcU29kNVkidwim+kYA==} + /@types/node@20.4.5: + resolution: {integrity: sha512-rt40Nk13II9JwQBdeYqmbn2Q6IVTA5uPhvSO+JVqdXw/6/4glI6oR9ezty/A9Hg5u7JH4OmYmuQ+XvjKm0Datg==} dev: true /@types/semver@7.5.0: @@ -689,8 +697,8 @@ packages: resolution: {integrity: sha512-4p9vcSmxAayx72yn70joFoL44c9MO/0+iVEBIQXe3v2h2SiAsEIo/G5v6ObFWvNKRFjbrVadNf9LqEEZeQPzdA==} dev: true - /@typescript-eslint/eslint-plugin@6.1.0(@typescript-eslint/parser@6.1.0)(eslint@8.45.0)(typescript@5.1.6): - resolution: {integrity: sha512-qg7Bm5TyP/I7iilGyp6DRqqkt8na00lI6HbjWZObgk3FFSzH5ypRwAHXJhJkwiRtTcfn+xYQIMOR5kJgpo6upw==} + /@typescript-eslint/eslint-plugin@6.2.0(@typescript-eslint/parser@6.2.0)(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-rClGrMuyS/3j0ETa1Ui7s6GkLhfZGKZL3ZrChLeAiACBE/tRc1wq8SNZESUuluxhLj9FkUefRs2l6bCIArWBiQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha @@ -700,12 +708,12 @@ packages: typescript: optional: true dependencies: - '@eslint-community/regexpp': 4.6.0 - '@typescript-eslint/parser': 6.1.0(eslint@8.45.0)(typescript@5.1.6) - '@typescript-eslint/scope-manager': 6.1.0 - '@typescript-eslint/type-utils': 6.1.0(eslint@8.45.0)(typescript@5.1.6) - '@typescript-eslint/utils': 6.1.0(eslint@8.45.0)(typescript@5.1.6) - '@typescript-eslint/visitor-keys': 6.1.0 + '@eslint-community/regexpp': 4.6.2 + '@typescript-eslint/parser': 6.2.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/scope-manager': 6.2.0 + '@typescript-eslint/type-utils': 6.2.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/utils': 6.2.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/visitor-keys': 6.2.0 debug: 4.3.4 eslint: 8.45.0 graphemer: 1.4.0 @@ -719,8 +727,8 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.1.0(eslint@8.45.0)(typescript@5.1.6): - resolution: {integrity: sha512-hIzCPvX4vDs4qL07SYzyomamcs2/tQYXg5DtdAfj35AyJ5PIUqhsLf4YrEIFzZcND7R2E8tpQIZKayxg8/6Wbw==} + /@typescript-eslint/parser@6.2.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-igVYOqtiK/UsvKAmmloQAruAdUHihsOCvplJpplPZ+3h4aDkC/UKZZNKgB6h93ayuYLuEymU3h8nF1xMRbh37g==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -729,10 +737,10 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/scope-manager': 6.1.0 - '@typescript-eslint/types': 6.1.0 - '@typescript-eslint/typescript-estree': 6.1.0(typescript@5.1.6) - '@typescript-eslint/visitor-keys': 6.1.0 + '@typescript-eslint/scope-manager': 6.2.0 + '@typescript-eslint/types': 6.2.0 + '@typescript-eslint/typescript-estree': 6.2.0(typescript@5.1.6) + '@typescript-eslint/visitor-keys': 6.2.0 debug: 4.3.4 eslint: 8.45.0 typescript: 5.1.6 @@ -740,16 +748,16 @@ packages: - supports-color dev: true - /@typescript-eslint/scope-manager@6.1.0: - resolution: {integrity: sha512-AxjgxDn27hgPpe2rQe19k0tXw84YCOsjDJ2r61cIebq1t+AIxbgiXKvD4999Wk49GVaAcdJ/d49FYel+Pp3jjw==} + /@typescript-eslint/scope-manager@6.2.0: + resolution: {integrity: sha512-1ZMNVgm5nnHURU8ZSJ3snsHzpFeNK84rdZjluEVBGNu7jDymfqceB3kdIZ6A4xCfEFFhRIB6rF8q/JIqJd2R0Q==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.1.0 - '@typescript-eslint/visitor-keys': 6.1.0 + '@typescript-eslint/types': 6.2.0 + '@typescript-eslint/visitor-keys': 6.2.0 dev: true - /@typescript-eslint/type-utils@6.1.0(eslint@8.45.0)(typescript@5.1.6): - resolution: {integrity: sha512-kFXBx6QWS1ZZ5Ni89TyT1X9Ag6RXVIVhqDs0vZE/jUeWlBv/ixq2diua6G7ece6+fXw3TvNRxP77/5mOMusx2w==} + /@typescript-eslint/type-utils@6.2.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-DnGZuNU2JN3AYwddYIqrVkYW0uUQdv0AY+kz2M25euVNlujcN2u+rJgfJsBFlUEzBB6OQkUqSZPyuTLf2bP5mw==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -758,8 +766,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/typescript-estree': 6.1.0(typescript@5.1.6) - '@typescript-eslint/utils': 6.1.0(eslint@8.45.0)(typescript@5.1.6) + '@typescript-eslint/typescript-estree': 6.2.0(typescript@5.1.6) + '@typescript-eslint/utils': 6.2.0(eslint@8.45.0)(typescript@5.1.6) debug: 4.3.4 eslint: 8.45.0 ts-api-utils: 1.0.1(typescript@5.1.6) @@ -768,13 +776,13 @@ packages: - supports-color dev: true - /@typescript-eslint/types@6.1.0: - resolution: {integrity: sha512-+Gfd5NHCpDoHDOaU/yIF3WWRI2PcBRKKpP91ZcVbL0t5tQpqYWBs3z/GGhvU+EV1D0262g9XCnyqQh19prU0JQ==} + /@typescript-eslint/types@6.2.0: + resolution: {integrity: sha512-1nRRaDlp/XYJQLvkQJG5F3uBTno5SHPT7XVcJ5n1/k2WfNI28nJsvLakxwZRNY5spuatEKO7d5nZWsQpkqXwBA==} engines: {node: ^16.0.0 || >=18.0.0} dev: true - /@typescript-eslint/typescript-estree@6.1.0(typescript@5.1.6): - resolution: {integrity: sha512-nUKAPWOaP/tQjU1IQw9sOPCDavs/iU5iYLiY/6u7gxS7oKQoi4aUxXS1nrrVGTyBBaGesjkcwwHkbkiD5eBvcg==} + /@typescript-eslint/typescript-estree@6.2.0(typescript@5.1.6): + resolution: {integrity: sha512-Mts6+3HQMSM+LZCglsc2yMIny37IhUgp1Qe8yJUYVyO6rHP7/vN0vajKu3JvHCBIy8TSiKddJ/Zwu80jhnGj1w==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: typescript: '*' @@ -782,8 +790,8 @@ packages: typescript: optional: true dependencies: - '@typescript-eslint/types': 6.1.0 - '@typescript-eslint/visitor-keys': 6.1.0 + '@typescript-eslint/types': 6.2.0 + '@typescript-eslint/visitor-keys': 6.2.0 debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 @@ -794,8 +802,8 @@ packages: - supports-color dev: true - /@typescript-eslint/utils@6.1.0(eslint@8.45.0)(typescript@5.1.6): - resolution: {integrity: sha512-wp652EogZlKmQoMS5hAvWqRKplXvkuOnNzZSE0PVvsKjpexd/XznRVHAtrfHFYmqaJz0DFkjlDsGYC9OXw+OhQ==} + /@typescript-eslint/utils@6.2.0(eslint@8.45.0)(typescript@5.1.6): + resolution: {integrity: sha512-RCFrC1lXiX1qEZN8LmLrxYRhOkElEsPKTVSNout8DMzf8PeWoQG7Rxz2SadpJa3VSh5oYKGwt7j7X/VRg+Y3OQ==} engines: {node: ^16.0.0 || >=18.0.0} peerDependencies: eslint: ^7.0.0 || ^8.0.0 @@ -803,9 +811,9 @@ packages: '@eslint-community/eslint-utils': 4.4.0(eslint@8.45.0) '@types/json-schema': 7.0.12 '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 6.1.0 - '@typescript-eslint/types': 6.1.0 - '@typescript-eslint/typescript-estree': 6.1.0(typescript@5.1.6) + '@typescript-eslint/scope-manager': 6.2.0 + '@typescript-eslint/types': 6.2.0 + '@typescript-eslint/typescript-estree': 6.2.0(typescript@5.1.6) eslint: 8.45.0 semver: 7.5.4 transitivePeerDependencies: @@ -813,22 +821,22 @@ packages: - typescript dev: true - /@typescript-eslint/visitor-keys@6.1.0: - resolution: {integrity: sha512-yQeh+EXhquh119Eis4k0kYhj9vmFzNpbhM3LftWQVwqVjipCkwHBQOZutcYW+JVkjtTG9k8nrZU1UoNedPDd1A==} + /@typescript-eslint/visitor-keys@6.2.0: + resolution: {integrity: sha512-QbaYUQVKKo9bgCzpjz45llCfwakyoxHetIy8CAvYCtd16Zu1KrpzNHofwF8kGkpPOxZB2o6kz+0nqH8ZkIzuoQ==} engines: {node: ^16.0.0 || >=18.0.0} dependencies: - '@typescript-eslint/types': 6.1.0 + '@typescript-eslint/types': 6.2.0 eslint-visitor-keys: 3.4.1 dev: true - /@vitejs/plugin-vue@4.2.3(vite@4.4.6)(vue@3.3.4): + /@vitejs/plugin-vue@4.2.3(vite@4.4.7)(vue@3.3.4): resolution: {integrity: sha512-R6JDUfiZbJA9cMiguQ7jxALsgiprjBeHL5ikpXfJCH62pPHtI+JdJ5xWj6Ev73yXSlYl86+blXn1kZHQ7uElxw==} engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: vite: ^4.0.0 vue: ^3.2.25 dependencies: - vite: 4.4.6(@types/node@20.4.4) + vite: 4.4.7(@types/node@20.4.5) vue: 3.3.4 dev: true @@ -840,9 +848,9 @@ packages: '@ampproject/remapping': 2.2.1 '@bcoe/v8-coverage': 0.2.3 istanbul-lib-coverage: 3.2.0 - istanbul-lib-report: 3.0.0 + istanbul-lib-report: 3.0.1 istanbul-lib-source-maps: 4.0.1 - istanbul-reports: 3.1.5 + istanbul-reports: 3.1.6 magic-string: 0.30.1 picocolors: 1.0.0 std-env: 3.3.3 @@ -1144,6 +1152,18 @@ packages: engines: {node: '>=12'} dev: true + /any-promise@1.3.0: + resolution: {integrity: sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==} + dev: true + + /anymatch@3.1.3: + resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} + engines: {node: '>= 8'} + dependencies: + normalize-path: 3.0.0 + picomatch: 2.3.1 + dev: true + /are-docs-informative@0.0.2: resolution: {integrity: sha512-ixiS0nLNNG5jNQzgZJNoUpBKdo9yTYZMGJ+QgT2jmjR7G7+QHRCc4v6LQ3NgE7EBJq+o0ams3waJwkrlBom8Ig==} engines: {node: '>=14'} @@ -1207,10 +1227,27 @@ packages: platform: 1.3.6 dev: true + /big-integer@1.6.51: + resolution: {integrity: sha512-GPEid2Y9QU1Exl1rpO9B2IPJGHPSupF5GnVIP0blYvNOMer2bTvSWs1jGOUg04hTmu67nmLsQ9TBo1puaotBHg==} + engines: {node: '>=0.6'} + dev: true + + /binary-extensions@2.2.0: + resolution: {integrity: sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA==} + engines: {node: '>=8'} + dev: true + /body-scroll-lock@4.0.0-beta.0: resolution: {integrity: sha512-a7tP5+0Mw3YlUJcGAKUqIBkYYGlYxk2fnCasq/FUph1hadxlTRjF+gAcZksxANnaMnALjxEddmSi/H3OR8ugcQ==} dev: true + /bplist-parser@0.2.0: + resolution: {integrity: sha512-z0M+byMThzQmD9NILRniCUXYsYpjwnlO8N5uCFaCqIOpqRsJCrQL9NK3JsD67CN5a08nF5oIL2bD6loTdHOuKw==} + engines: {node: '>= 5.10.0'} + dependencies: + big-integer: 1.6.51 + dev: true + /brace-expansion@1.1.11: resolution: {integrity: sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==} dependencies: @@ -1236,6 +1273,23 @@ packages: engines: {node: '>=6'} dev: true + /bundle-name@3.0.0: + resolution: {integrity: sha512-PKA4BeSvBpQKQ8iPOGCSiell+N8P+Tf1DlwqmYhpe2gAhKPHn8EYOxVT+ShuGmhg8lN8XiSlS80yiExKXrURlw==} + engines: {node: '>=12'} + dependencies: + run-applescript: 5.0.0 + dev: true + + /bundle-require@4.0.1(esbuild@0.18.17): + resolution: {integrity: sha512-9NQkRHlNdNpDBGmLpngF3EFDcwodhMUuLz9PaWYciVcQF9SE4LFjM2DB/xV1Li5JiuDMv7ZUWuC3rGbqR0MAXQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + peerDependencies: + esbuild: '>=0.17' + dependencies: + esbuild: 0.18.17 + load-tsconfig: 0.2.5 + dev: true + /cac@6.7.14: resolution: {integrity: sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ==} engines: {node: '>=8'} @@ -1292,6 +1346,21 @@ packages: resolution: {integrity: sha512-BrgHpW9NURQgzoNyjfq0Wu6VFO6D7IZEmJNdtgNqpzGG8RuNFHt2jQxWlAs4HMe119chBnv+34syEZtc6IhLtA==} dev: true + /chokidar@3.5.3: + resolution: {integrity: sha512-Dr3sfKRP6oTcjf2JmUmFJfeVMvXBdegxB0iVQ5eb2V10uFJUCAS8OByZdVAyVb8xXNz3GjjTgj9kLWsZTqE6kw==} + engines: {node: '>= 8.10.0'} + dependencies: + anymatch: 3.1.3 + braces: 3.0.2 + glob-parent: 5.1.2 + is-binary-path: 2.1.0 + is-glob: 4.0.3 + normalize-path: 3.0.0 + readdirp: 3.6.0 + optionalDependencies: + fsevents: 2.3.2 + dev: true + /color-convert@1.9.3: resolution: {integrity: sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==} dependencies: @@ -1313,6 +1382,11 @@ packages: resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==} dev: true + /commander@4.1.1: + resolution: {integrity: sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==} + engines: {node: '>= 6'} + dev: true + /comment-parser@1.3.1: resolution: {integrity: sha512-B52sN2VNghyq5ofvUsqZjmk6YkihBX5vMSChmSK9v4ShjKf3Vk5Xcmgpw4o+iIgtrnM/u5FiMpz9VKb8lpBveA==} engines: {node: '>= 12.0.0'} @@ -1373,6 +1447,29 @@ packages: resolution: {integrity: sha512-oIPzksmTg4/MriiaYGO+okXDT7ztn/w3Eptv/+gSIdMdKsJo0u4CfYNFJPy+4SKMuCqGw2wxnA+URMg3t8a/bQ==} dev: true + /default-browser-id@3.0.0: + resolution: {integrity: sha512-OZ1y3y0SqSICtE8DE4S8YOE9UZOJ8wO16fKWVP5J1Qz42kV9jcnMVFrEE/noXb/ss3Q4pZIH79kxofzyNNtUNA==} + engines: {node: '>=12'} + dependencies: + bplist-parser: 0.2.0 + untildify: 4.0.0 + dev: true + + /default-browser@4.0.0: + resolution: {integrity: sha512-wX5pXO1+BrhMkSbROFsyxUm0i/cJEScyNhA4PPxc41ICuv05ZZB/MX28s8aZx6xjmatvebIapF6hLEKEcpneUA==} + engines: {node: '>=14.16'} + dependencies: + bundle-name: 3.0.0 + default-browser-id: 3.0.0 + execa: 7.1.1 + titleize: 3.0.0 + dev: true + + /define-lazy-prop@3.0.0: + resolution: {integrity: sha512-N+MeXYoqr3pOgn8xfyRPREN7gHakLYjhsHhWGT3fWAiL4IkAt0iDw14QiiEm2bE30c5XX5q0FtAA3CK5f9/BUg==} + engines: {node: '>=12'} + dev: true + /define-properties@1.2.0: resolution: {integrity: sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==} engines: {node: '>= 0.4'} @@ -1487,34 +1584,34 @@ packages: is-symbol: 1.0.4 dev: true - /esbuild@0.18.16: - resolution: {integrity: sha512-1xLsOXrDqwdHxyXb/x/SOyg59jpf/SH7YMvU5RNSU7z3TInaASNJWNFJ6iRvLvLETZMasF3d1DdZLg7sgRimRQ==} + /esbuild@0.18.17: + resolution: {integrity: sha512-1GJtYnUxsJreHYA0Y+iQz2UEykonY66HNWOb0yXYZi9/kNrORUEHVg87eQsCtqh59PEJ5YVZJO98JHznMJSWjg==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.18.16 - '@esbuild/android-arm64': 0.18.16 - '@esbuild/android-x64': 0.18.16 - '@esbuild/darwin-arm64': 0.18.16 - '@esbuild/darwin-x64': 0.18.16 - '@esbuild/freebsd-arm64': 0.18.16 - '@esbuild/freebsd-x64': 0.18.16 - '@esbuild/linux-arm': 0.18.16 - '@esbuild/linux-arm64': 0.18.16 - '@esbuild/linux-ia32': 0.18.16 - '@esbuild/linux-loong64': 0.18.16 - '@esbuild/linux-mips64el': 0.18.16 - '@esbuild/linux-ppc64': 0.18.16 - '@esbuild/linux-riscv64': 0.18.16 - '@esbuild/linux-s390x': 0.18.16 - '@esbuild/linux-x64': 0.18.16 - '@esbuild/netbsd-x64': 0.18.16 - '@esbuild/openbsd-x64': 0.18.16 - '@esbuild/sunos-x64': 0.18.16 - '@esbuild/win32-arm64': 0.18.16 - '@esbuild/win32-ia32': 0.18.16 - '@esbuild/win32-x64': 0.18.16 + '@esbuild/android-arm': 0.18.17 + '@esbuild/android-arm64': 0.18.17 + '@esbuild/android-x64': 0.18.17 + '@esbuild/darwin-arm64': 0.18.17 + '@esbuild/darwin-x64': 0.18.17 + '@esbuild/freebsd-arm64': 0.18.17 + '@esbuild/freebsd-x64': 0.18.17 + '@esbuild/linux-arm': 0.18.17 + '@esbuild/linux-arm64': 0.18.17 + '@esbuild/linux-ia32': 0.18.17 + '@esbuild/linux-loong64': 0.18.17 + '@esbuild/linux-mips64el': 0.18.17 + '@esbuild/linux-ppc64': 0.18.17 + '@esbuild/linux-riscv64': 0.18.17 + '@esbuild/linux-s390x': 0.18.17 + '@esbuild/linux-x64': 0.18.17 + '@esbuild/netbsd-x64': 0.18.17 + '@esbuild/openbsd-x64': 0.18.17 + '@esbuild/sunos-x64': 0.18.17 + '@esbuild/win32-arm64': 0.18.17 + '@esbuild/win32-ia32': 0.18.17 + '@esbuild/win32-x64': 0.18.17 dev: true /escape-string-regexp@1.0.5: @@ -1581,21 +1678,25 @@ packages: - supports-color dev: true - /eslint-plugin-prettier@4.2.1(eslint-config-prettier@8.8.0)(eslint@8.45.0)(prettier@2.8.8): - resolution: {integrity: sha512-f/0rXLXUt0oFYs8ra4w49wYZBG5GKZpAYsJSm6rnYL5uVDjd+zowwMwVZHnAjf4edNrKpCDYfXDgmRE/Ak7QyQ==} - engines: {node: '>=12.0.0'} + /eslint-plugin-prettier@5.0.0(eslint-config-prettier@8.8.0)(eslint@8.45.0)(prettier@3.0.0): + resolution: {integrity: sha512-AgaZCVuYDXHUGxj/ZGu1u8H8CYgDY3iG6w5kUFw4AzMVXzB7VvbKgYR4nATIN+OvUrghMbiDLeimVjVY5ilq3w==} + engines: {node: ^14.18.0 || >=16.0.0} peerDependencies: - eslint: '>=7.28.0' + '@types/eslint': '>=8.0.0' + eslint: '>=8.0.0' eslint-config-prettier: '*' - prettier: '>=2.0.0' + prettier: '>=3.0.0' peerDependenciesMeta: + '@types/eslint': + optional: true eslint-config-prettier: optional: true dependencies: eslint: 8.45.0 eslint-config-prettier: 8.8.0(eslint@8.45.0) - prettier: 2.8.8 + prettier: 3.0.0 prettier-linter-helpers: 1.0.0 + synckit: 0.8.5 dev: true /eslint-plugin-spellcheck@0.0.20(eslint@8.45.0): @@ -1628,7 +1729,7 @@ packages: hasBin: true dependencies: '@eslint-community/eslint-utils': 4.4.0(eslint@8.45.0) - '@eslint-community/regexpp': 4.6.0 + '@eslint-community/regexpp': 4.6.2 '@eslint/eslintrc': 2.1.0 '@eslint/js': 8.44.0 '@humanwhocodes/config-array': 0.11.10 @@ -1705,6 +1806,36 @@ packages: engines: {node: '>=0.10.0'} dev: true + /execa@5.1.1: + resolution: {integrity: sha512-8uSpZZocAZRBAPIEINJj3Lo9HyGitllczc27Eh5YYojjMFMn8yHMDMaUHE2Jqfq05D/wucwI4JGURyXt1vchyg==} + engines: {node: '>=10'} + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 2.1.0 + is-stream: 2.0.1 + merge-stream: 2.0.0 + npm-run-path: 4.0.1 + onetime: 5.1.2 + signal-exit: 3.0.7 + strip-final-newline: 2.0.0 + dev: true + + /execa@7.1.1: + resolution: {integrity: sha512-wH0eMf/UXckdUYnO21+HDztteVv05rq2GXksxT4fCGeHkBhw1DROXh40wcjMcRqDOWE7iPJ4n3M7e2+YFP+76Q==} + engines: {node: ^14.18.0 || ^16.14.0 || >=18.0.0} + dependencies: + cross-spawn: 7.0.3 + get-stream: 6.0.1 + human-signals: 4.3.1 + is-stream: 3.0.0 + merge-stream: 2.0.0 + npm-run-path: 5.1.0 + onetime: 6.0.0 + signal-exit: 3.0.7 + strip-final-newline: 3.0.0 + dev: true + /fast-deep-equal@3.1.3: resolution: {integrity: sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==} dev: true @@ -1833,6 +1964,11 @@ packages: has-proto: 1.0.1 has-symbols: 1.0.3 + /get-stream@6.0.1: + resolution: {integrity: sha512-ts6Wi+2j3jQjqi70w5AlN8DFnkSwC+MqmxEzdEALB2qXZYV3X/b1CTfgPLGJNMeAWxdPfU8FO1ms3NUfaHCPYg==} + engines: {node: '>=10'} + dev: true + /get-symbol-description@1.0.0: resolution: {integrity: sha512-2EmdH1YvIQiZpltCNgkuiUnyukzxM/R6NDJX31Ke3BG1Nq5b0S2PhX59UKi9vZpPDQVdqn+1IcaAwnzTT5vCjw==} engines: {node: '>= 0.4'} @@ -1861,12 +1997,23 @@ packages: hasBin: true dependencies: foreground-child: 3.1.1 - jackspeak: 2.2.1 + jackspeak: 2.2.2 minimatch: 9.0.3 minipass: 7.0.2 path-scurry: 1.10.1 dev: true + /glob@7.1.6: + resolution: {integrity: sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==} + dependencies: + fs.realpath: 1.0.0 + inflight: 1.0.6 + inherits: 2.0.4 + minimatch: 3.1.2 + once: 1.4.0 + path-is-absolute: 1.0.1 + dev: true + /glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} dependencies: @@ -1966,6 +2113,16 @@ packages: resolution: {integrity: sha512-H2iMtd0I4Mt5eYiapRdIDjp+XzelXQ0tFE4JS7YFwFevXXMmOp9myNrUvCg0D6ws8iqkRPBfKHgbwig1SmlLfg==} dev: true + /human-signals@2.1.0: + resolution: {integrity: sha512-B4FFZ6q/T2jhhksgkbEW3HBvWIfDW85snkQgawt07S7J5QXTk6BkNV+0yAeZrM5QpMAdYlocGoljn0sJ/WQkFw==} + engines: {node: '>=10.17.0'} + dev: true + + /human-signals@4.3.1: + resolution: {integrity: sha512-nZXjEF2nbo7lIw3mgYjItAfgQXog3OjJogSbKa2CQIIvSGWcKgeJnQlNXip6NglNzYH45nSRiEVimMvYL8DDqQ==} + engines: {node: '>=14.18.0'} + dev: true + /humps@2.0.1: resolution: {integrity: sha512-E0eIbrFWUhwfXJmsbdjRQFQPrl5pTEoKlz163j1mTqqUnU9PgR4AgB8AIITzuB3vLBdxZXyZ9TDIrwB2OASz4g==} dev: true @@ -2031,6 +2188,13 @@ packages: has-bigints: 1.0.2 dev: true + /is-binary-path@2.1.0: + resolution: {integrity: sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==} + engines: {node: '>=8'} + dependencies: + binary-extensions: 2.2.0 + dev: true + /is-boolean-object@1.1.2: resolution: {integrity: sha512-gDYaKHJmnj4aWxyj6YHyXVpdQawtVLHU5cb+eztPGczf6cjuTdwve5ZIEfgXqH4e57An1D1AKf8CZ3kYrQRqYA==} engines: {node: '>= 0.4'} @@ -2064,6 +2228,18 @@ packages: has-tostringtag: 1.0.0 dev: true + /is-docker@2.2.1: + resolution: {integrity: sha512-F+i2BKsFrH66iaUFc0woD8sLy8getkwTwtOBjvs56Cx4CgJDeKQeqfz8wAYiSb8JOprWhHH5p77PbmYCvvUuXQ==} + engines: {node: '>=8'} + hasBin: true + dev: true + + /is-docker@3.0.0: + resolution: {integrity: sha512-eljcgEDlEns/7AXFosB5K/2nCM4P7FQPkGc/DWLy5rmFEWvZayGrik1d9/QIY5nJ4f9YsVvBkA6kJpHn9rISdQ==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + hasBin: true + dev: true + /is-expression@4.0.0: resolution: {integrity: sha512-zMIXX63sxzG3XrkHkrAPvm/OVZVSCPNkwMHU8oTX7/U3AL78I0QXCEICXUM13BIa8TYGZ68PiTKfQz3yaTNr4A==} dependencies: @@ -2088,6 +2264,14 @@ packages: is-extglob: 2.1.1 dev: true + /is-inside-container@1.0.0: + resolution: {integrity: sha512-KIYLCCJghfHZxqjYBE7rEy0OBuTd5xCHS7tHVgvCLkx7StIoaxwNW3hCALgEUjFfeRk+MG/Qxmp/vtETEF3tRA==} + engines: {node: '>=14.16'} + hasBin: true + dependencies: + is-docker: 3.0.0 + dev: true + /is-negative-zero@2.0.2: resolution: {integrity: sha512-dqJvarLawXsFbNDeJW7zAz8ItJ9cd28YufuuFzh0G8pNHjJMnY08Dv7sYX2uF5UpQOwieAeOExEYAWWfu7ZZUA==} engines: {node: '>= 0.4'} @@ -2123,6 +2307,16 @@ packages: call-bind: 1.0.2 dev: true + /is-stream@2.0.1: + resolution: {integrity: sha512-hFoiJiTl63nn+kstHGBtewWSKnQLpyb155KHheA1l39uvtO9nWIop1p3udqPcUd/xbF1VLMO4n7OI6p7RbngDg==} + engines: {node: '>=8'} + dev: true + + /is-stream@3.0.0: + resolution: {integrity: sha512-LnQR4bZ9IADDRSkvpqMGvt/tEJWclzklNgSw48V5EAaAeDd6qGvN8ei6k5p0tvxSR171VmGyHuTiAOfxAbr8kA==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /is-string@1.0.7: resolution: {integrity: sha512-tE2UXzivje6ofPW7l23cjDOMa09gb7xlAqG6jG5ej6uPV32TlWP3NKPigtaGeHNu9fohccRYvIiZMfOOnOYUtg==} engines: {node: '>= 0.4'} @@ -2150,6 +2344,13 @@ packages: call-bind: 1.0.2 dev: true + /is-wsl@2.2.0: + resolution: {integrity: sha512-fKzAra0rGJUUBwGBgNkHZuToZcn+TtXHpeCgmkMJMMYx1sQDYaCSyjJBSCa2nH1DGm7s3n1oBnohoVTBaN7Lww==} + engines: {node: '>=8'} + dependencies: + is-docker: 2.2.1 + dev: true + /isarray@2.0.5: resolution: {integrity: sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==} dev: true @@ -2163,12 +2364,12 @@ packages: engines: {node: '>=8'} dev: true - /istanbul-lib-report@3.0.0: - resolution: {integrity: sha512-wcdi+uAKzfiGT2abPpKZ0hSU1rGQjUQnLvtY5MpQ7QCTahD3VODhcu4wcfY1YtkGaDD5yuydOLINXsfbus9ROw==} - engines: {node: '>=8'} + /istanbul-lib-report@3.0.1: + resolution: {integrity: sha512-GCfE1mtsHGOELCU8e/Z7YWzpmybrx/+dSTfLrvY8qRmaY6zXTKWn6WQIjaAFw069icm6GVMNkgu0NzI4iPZUNw==} + engines: {node: '>=10'} dependencies: istanbul-lib-coverage: 3.2.0 - make-dir: 3.1.0 + make-dir: 4.0.0 supports-color: 7.2.0 dev: true @@ -2183,16 +2384,16 @@ packages: - supports-color dev: true - /istanbul-reports@3.1.5: - resolution: {integrity: sha512-nUsEMa9pBt/NOHqbcbeJEgqIlY/K7rVWUX6Lql2orY5e9roQOthbR3vtY4zzf2orPELg80fnxxk9zUyPlgwD1w==} + /istanbul-reports@3.1.6: + resolution: {integrity: sha512-TLgnMkKg3iTDsQ9PbPTdpfAK2DzjF9mqUG7RMgcQl8oFjad8ob4laGxv5XV5U9MAfx8D6tSJiUyuAwzLicaxlg==} engines: {node: '>=8'} dependencies: html-escaper: 2.0.2 - istanbul-lib-report: 3.0.0 + istanbul-lib-report: 3.0.1 dev: true - /jackspeak@2.2.1: - resolution: {integrity: sha512-MXbxovZ/Pm42f6cDIDkl3xpwv1AGwObKwfmjs2nQePiy85tP3fatofl3FC1aBsOtP/6fq5SbtgHwWcMsLP+bDw==} + /jackspeak@2.2.2: + resolution: {integrity: sha512-mgNtVv4vUuaKA97yxUHoA3+FkuhtxkjdXEWOyB/N76fjy0FjezEt34oy3epBtvCvS+7DyKwqCFWx/oJLV5+kCg==} engines: {node: '>=14'} dependencies: '@isaacs/cliui': 8.0.2 @@ -2200,6 +2401,11 @@ packages: '@pkgjs/parseargs': 0.11.0 dev: true + /joycon@3.1.1: + resolution: {integrity: sha512-34wB/Y7MW7bzjKRjUKTa46I2Z7eV62Rkhva+KkopW7Qvv/OSWBqvkSY7vusOPrNuZcUG3tApvdVgNB8POj3SPw==} + engines: {node: '>=10'} + dev: true + /js-yaml@4.1.0: resolution: {integrity: sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==} hasBin: true @@ -2236,6 +2442,15 @@ packages: type-check: 0.4.0 dev: true + /lilconfig@2.1.0: + resolution: {integrity: sha512-utWOt/GHzuUxnLKxB6dk81RoOeoNeHgbrXiuGk4yyF5qlRz+iIVWu56E2fqGHFrXz0QNUhLB/8nKqvRH66JKGQ==} + engines: {node: '>=10'} + dev: true + + /lines-and-columns@1.2.4: + resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==} + dev: true + /load-json-file@4.0.0: resolution: {integrity: sha512-Kx8hMakjX03tiGTLAIdJ+lL0htKnXjEZN6hk/tozf/WOuYGdZBJrZ+rCJRbVCugsjB3jMLn9746NsQIf5VjBMw==} engines: {node: '>=4'} @@ -2246,6 +2461,11 @@ packages: strip-bom: 3.0.0 dev: true + /load-tsconfig@0.2.5: + resolution: {integrity: sha512-IXO6OCs9yg8tMKzfPZ1YmheJbZCiEsnBdcB03l0OcfK9prKnJb96siuHCr5Fl37/yo9DnKU+TLpxzTUspw9shg==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dev: true + /local-pkg@0.4.3: resolution: {integrity: sha512-SFppqq5p42fe2qcZQqqEOiVRXl+WCP1MdT6k7BDEW1j++sp5fIY+/fdRQitvKgB5BrBcmrs5m/L0v2FrU5MY1g==} engines: {node: '>=14'} @@ -2262,6 +2482,10 @@ packages: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true + /lodash.sortby@4.7.0: + resolution: {integrity: sha512-HDWXG8isMntAyRF5vZ7xKuEvOhT4AhlRt/3czTSjvGUxjYCBVRQY48ViDHyfYz9VIoBkW4TMGQNapx+l3RUwdA==} + dev: true + /lodash@4.17.21: resolution: {integrity: sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==} dev: true @@ -2291,11 +2515,11 @@ packages: '@jridgewell/sourcemap-codec': 1.4.15 dev: true - /make-dir@3.1.0: - resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==} - engines: {node: '>=8'} + /make-dir@4.0.0: + resolution: {integrity: sha512-hXdUTZYIVOt1Ex//jAQi+wTZZpUpwBj/0QsOzqegb3rGMMeJiSEu5xLHnYfBrRV4RH2+OCSOO95Is/7x1WJ4bw==} + engines: {node: '>=10'} dependencies: - semver: 6.3.1 + semver: 7.5.4 dev: true /mark.js@8.11.1: @@ -2307,6 +2531,10 @@ packages: engines: {node: '>= 0.10.0'} dev: true + /merge-stream@2.0.0: + resolution: {integrity: sha512-abv/qOcuPfk3URPfDzmZU1LKmuw8kT+0nIHvKrKgFrwifol/doWcdA4ZqsWQ8ENrFKkd67Mfpo/LovbIUsbt3w==} + dev: true + /merge2@1.4.1: resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==} engines: {node: '>= 8'} @@ -2320,6 +2548,16 @@ packages: picomatch: 2.3.1 dev: true + /mimic-fn@2.1.0: + resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} + engines: {node: '>=6'} + dev: true + + /mimic-fn@4.0.0: + resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} + engines: {node: '>=12'} + dev: true + /minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} dependencies: @@ -2355,6 +2593,14 @@ packages: resolution: {integrity: sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==} dev: true + /mz@2.7.0: + resolution: {integrity: sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==} + dependencies: + any-promise: 1.3.0 + object-assign: 4.1.1 + thenify-all: 1.6.0 + dev: true + /nanoid@3.3.6: resolution: {integrity: sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==} engines: {node: ^10 || ^12 || ^13.7 || ^14 || >=15.0.1} @@ -2382,6 +2628,11 @@ packages: validate-npm-package-license: 3.0.4 dev: true + /normalize-path@3.0.0: + resolution: {integrity: sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==} + engines: {node: '>=0.10.0'} + dev: true + /npm-run-all@4.1.5: resolution: {integrity: sha512-Oo82gJDAVcaMdi3nuoKFavkIHBRVqQ1qvMb+9LHk/cF4P6B2m8aP04hGf7oL6wZ9BuGwX1onlLhpuoofSyoQDQ==} engines: {node: '>= 4'} @@ -2398,10 +2649,23 @@ packages: string.prototype.padend: 3.1.4 dev: true + /npm-run-path@4.0.1: + resolution: {integrity: sha512-S48WzZW777zhNIrn7gxOlISNAqi9ZC/uQFnRdbeIHhZhCA6UqpkOT8T1G7BvfdgP4Er8gF4sUbaS0i7QvIfCWw==} + engines: {node: '>=8'} + dependencies: + path-key: 3.1.1 + dev: true + + /npm-run-path@5.1.0: + resolution: {integrity: sha512-sJOdmRGrY2sjNTRMbSvluQqg+8X7ZK61yvzBEIDhz4f8z1TZFYABsqjjCBd/0PUNE9M6QDgHJXQkGUEm7Q+l9Q==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} + dependencies: + path-key: 4.0.0 + dev: true + /object-assign@4.1.1: resolution: {integrity: sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==} engines: {node: '>=0.10.0'} - dev: false /object-inspect@1.12.3: resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==} @@ -2428,6 +2692,30 @@ packages: wrappy: 1.0.2 dev: true + /onetime@5.1.2: + resolution: {integrity: sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==} + engines: {node: '>=6'} + dependencies: + mimic-fn: 2.1.0 + dev: true + + /onetime@6.0.0: + resolution: {integrity: sha512-1FlR+gjXK7X+AsAHso35MnyN5KqGwJRi/31ft6x0M194ht7S+rWAvd7PHss9xSKMzE0asv1pyIHaJYq+BbacAQ==} + engines: {node: '>=12'} + dependencies: + mimic-fn: 4.0.0 + dev: true + + /open@9.1.0: + resolution: {integrity: sha512-OS+QTnw1/4vrf+9hh1jc1jnYjzSG4ttTBB8UxOwAnInG3Uo4ssetzC1ihqaIHjLJnA5GGlRl6QlZXOTQhRBUvg==} + engines: {node: '>=14.16'} + dependencies: + default-browser: 4.0.0 + define-lazy-prop: 3.0.0 + is-inside-container: 1.0.0 + is-wsl: 2.2.0 + dev: true + /optionator@0.9.3: resolution: {integrity: sha512-JjCoypp+jKn1ttEFExxhetCKeJt9zhAgAve5FXHixTvFDW/5aEktX9bufBKLRRMdU7bNtpLfcGu94B3cdEJgjg==} engines: {node: '>= 0.8.0'} @@ -2496,6 +2784,11 @@ packages: engines: {node: '>=8'} dev: true + /path-key@4.0.0: + resolution: {integrity: sha512-haREypq7xkM7ErfgIyA0z+Bj4AGKlMSdlQE2jvJo6huWD1EdkKYV+G/T4nq0YEF2vgTT8kqMFKo1uHn950r4SQ==} + engines: {node: '>=12'} + dev: true + /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} dev: true @@ -2548,6 +2841,11 @@ packages: engines: {node: '>=4'} dev: true + /pirates@4.0.6: + resolution: {integrity: sha512-saLsH7WeYYPiD25LDuLRRY/i+6HaPYr6G1OUlN39otzkSTxKnubR9RTxS3/Kk50s1g2JTgFwWQDQyplC5/SHZg==} + engines: {node: '>= 6'} + dev: true + /pkg-types@1.0.3: resolution: {integrity: sha512-nN7pYi0AQqJnoLPC9eHFQ8AcyaixBUOwvqc5TDnIKCMEE6I0y8P7OKA7fPexsXGCGxQDl/cmrLAp26LhcwxZ4A==} dependencies: @@ -2560,6 +2858,22 @@ packages: resolution: {integrity: sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==} dev: true + /postcss-load-config@4.0.1: + resolution: {integrity: sha512-vEJIc8RdiBRu3oRAI0ymerOn+7rPuMvRXslTvZUKZonDHFIczxztIyJ1urxM1x9JXEikvpWWTUUqal5j/8QgvA==} + engines: {node: '>= 14'} + peerDependencies: + postcss: '>=8.0.9' + ts-node: '>=9.0.0' + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + dependencies: + lilconfig: 2.1.0 + yaml: 2.3.1 + dev: true + /postcss@8.4.27: resolution: {integrity: sha512-gY/ACJtJPSmUFPDCHtX78+01fHa64FaU4zaaWfuh1MhGJISufJAH4cun6k/8fwsHYeK4UQmENQK+tRLCFJE8JQ==} engines: {node: ^10 || ^12 || >=14} @@ -2585,7 +2899,7 @@ packages: fast-diff: 1.3.0 dev: true - /prettier-plugin-organize-imports@3.2.3(prettier@2.8.8)(typescript@5.1.6): + /prettier-plugin-organize-imports@3.2.3(prettier@3.0.0)(typescript@5.1.6): resolution: {integrity: sha512-KFvk8C/zGyvUaE3RvxN2MhCLwzV6OBbFSkwZ2OamCrs9ZY4i5L77jQ/w4UmUr+lqX8qbaqVq6bZZkApn+IgJSg==} peerDependencies: '@volar/vue-language-plugin-pug': ^1.0.4 @@ -2598,13 +2912,13 @@ packages: '@volar/vue-typescript': optional: true dependencies: - prettier: 2.8.8 + prettier: 3.0.0 typescript: 5.1.6 dev: true - /prettier@2.8.8: - resolution: {integrity: sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==} - engines: {node: '>=10.13.0'} + /prettier@3.0.0: + resolution: {integrity: sha512-zBf5eHpwHOGPC47h0zrPyNn+eAEIdEzfywMoYn2XPi0P44Zp0tSq64rq0xAREh4auw2cJZHo9QUob+NqCQky4g==} + engines: {node: '>=14'} hasBin: true dev: true @@ -2651,6 +2965,13 @@ packages: path-type: 3.0.0 dev: true + /readdirp@3.6.0: + resolution: {integrity: sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==} + engines: {node: '>=8.10.0'} + dependencies: + picomatch: 2.3.1 + dev: true + /regexp.prototype.flags@1.5.0: resolution: {integrity: sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==} engines: {node: '>= 0.4'} @@ -2665,6 +2986,11 @@ packages: engines: {node: '>=4'} dev: true + /resolve-from@5.0.0: + resolution: {integrity: sha512-qYg9KP24dD5qka9J47d0aVky0N+b4fTU89LN9iDnjB5waksiC49rvMB0PrUJQGoTmH50XPiqOvAjDfaijGxYZw==} + engines: {node: '>=8'} + dev: true + /resolve@1.22.2: resolution: {integrity: sha512-Sb+mjNHOULsBv818T40qSPeRiuWLyaGMa5ewydRLFimneixmVy2zdivRl+AF6jaYPC8ERxGDmFSiqui6SfPd+g==} hasBin: true @@ -2702,6 +3028,13 @@ packages: fsevents: 2.3.2 dev: true + /run-applescript@5.0.0: + resolution: {integrity: sha512-XcT5rBksx1QdIhlFOCtgZkB99ZEouFZ1E2Kc2LHqNW13U3/74YGdkQRmThTwxy4QIyookibDKYZOPqX//6BlAg==} + engines: {node: '>=12'} + dependencies: + execa: 5.1.1 + dev: true + /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -2736,11 +3069,6 @@ packages: hasBin: true dev: true - /semver@6.3.1: - resolution: {integrity: sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==} - hasBin: true - dev: true - /semver@7.5.4: resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} engines: {node: '>=10'} @@ -2798,6 +3126,10 @@ packages: resolution: {integrity: sha512-ybx0WO1/8bSBLEWXZvEd7gMW3Sn3JFlW3TvX1nREbDLRNQNaeNN8WK0meBwPdAaOI7TtRRRJn/Es1zhrrCHu7g==} dev: true + /signal-exit@3.0.7: + resolution: {integrity: sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==} + dev: true + /signal-exit@4.0.2: resolution: {integrity: sha512-MY2/qGx4enyjprQnFaZsHib3Yadh3IXyV2C321GY0pjGfVBu4un0uDJkwgdxqO+Rdx8JMT8IfJIRwbYVz3Ob3Q==} engines: {node: '>=14'} @@ -2818,6 +3150,13 @@ packages: engines: {node: '>=0.10.0'} dev: true + /source-map@0.8.0-beta.0: + resolution: {integrity: sha512-2ymg6oRBpebeZi9UUNsgQ89bhx01TcTkmNTGnNO88imTmbSgy4nfujrgVEFKWpMTEGA11EDkTt7mqObTPdigIA==} + engines: {node: '>= 8'} + dependencies: + whatwg-url: 7.1.0 + dev: true + /spdx-correct@3.2.0: resolution: {integrity: sha512-kN9dJbvnySHULIluDHy32WHRUu3Og7B9sbY7tsFLctQkIqnMh3hErYgdMjTYuqmcXX+lK5T1lnUt3G7zNswmZA==} dependencies: @@ -2919,6 +3258,16 @@ packages: engines: {node: '>=4'} dev: true + /strip-final-newline@2.0.0: + resolution: {integrity: sha512-BrpvfNAE3dcvq7ll3xVumzjKjZQ5tI1sEUIKr3Uoks0XUl45St3FlatVqef9prk4jRDzhW6WZg+3bk93y6pLjA==} + engines: {node: '>=6'} + dev: true + + /strip-final-newline@3.0.0: + resolution: {integrity: sha512-dOESqjYr96iWYylGObzd39EuNTa5VJxyvVAEm5Jnh7KGo75V43Hk1odPQkNDyXNmUR6k+gEiDVXnjB8HJ3crXw==} + engines: {node: '>=12'} + dev: true + /strip-json-comments@3.1.1: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} @@ -2930,6 +3279,20 @@ packages: acorn: 8.10.0 dev: true + /sucrase@3.34.0: + resolution: {integrity: sha512-70/LQEZ07TEcxiU2dz51FKaE6hCTWC6vr7FOk3Gr0U60C3shtAN+H+BFr9XlYe5xqf3RA8nrc+VIwzCfnxuXJw==} + engines: {node: '>=8'} + hasBin: true + dependencies: + '@jridgewell/gen-mapping': 0.3.3 + commander: 4.1.1 + glob: 7.1.6 + 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: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -2949,6 +3312,14 @@ packages: engines: {node: '>= 0.4'} dev: true + /synckit@0.8.5: + resolution: {integrity: sha512-L1dapNV6vu2s/4Sputv8xGsCdAVlb5nRDMFU/E27D44l5U6cw1g0dGd45uLc+OXjNMmF4ntiMdCimzcjFKQI8Q==} + engines: {node: ^14.18.0 || >=16.0.0} + dependencies: + '@pkgr/utils': 2.4.2 + tslib: 2.6.1 + dev: true + /tabbable@6.2.0: resolution: {integrity: sha512-Cat63mxsVJlzYvN51JmVXIgNoUokrIaT2zLclCXjRd8boZ0004U4KCs/sToJ75C6sdlByWxpYnb5Boif1VSFew==} dev: true @@ -2966,6 +3337,19 @@ packages: resolution: {integrity: sha512-N+8UisAXDGk8PFXP4HAzVR9nbfmVJ3zYLAWiTIoqC5v5isinhr+r5uaO8+7r3BMfuNIufIsA7RdpVgacC2cSpw==} dev: true + /thenify-all@1.6.0: + resolution: {integrity: sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==} + engines: {node: '>=0.8'} + dependencies: + thenify: 3.3.1 + dev: true + + /thenify@3.3.1: + resolution: {integrity: sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==} + dependencies: + any-promise: 1.3.0 + dev: true + /tinybench@2.5.0: resolution: {integrity: sha512-kRwSG8Zx4tjF9ZiyH4bhaebu+EDz1BOx9hOigYHlUW4xxI/wKIUQUqo018UlU4ar6ATPBsaMrdbKZ+tmPdohFA==} dev: true @@ -2980,6 +3364,11 @@ packages: engines: {node: '>=14.0.0'} dev: true + /titleize@3.0.0: + resolution: {integrity: sha512-KxVu8EYHDPBdUYdKZdKtU2aj2XfEx9AfjXxE/Aj0vT06w2icA09Vus1rh6eSu1y01akYg6BjIK/hxyLJINoMLQ==} + engines: {node: '>=12'} + dev: true + /to-fast-properties@2.0.0: resolution: {integrity: sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==} engines: {node: '>=4'} @@ -2992,6 +3381,17 @@ packages: is-number: 7.0.0 dev: true + /tr46@1.0.1: + resolution: {integrity: sha512-dTpowEjclQ7Kgx5SdBkqRzVhERQXov8/l9Ft9dVM9fmg0W0KQSVaXX9T4i6twCPNtYiZM53lpSSUAwJbFPOHxA==} + dependencies: + punycode: 2.3.0 + dev: true + + /tree-kill@1.2.2: + resolution: {integrity: sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==} + hasBin: true + dev: true + /ts-api-utils@1.0.1(typescript@5.1.6): resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} engines: {node: '>=16.13.0'} @@ -3001,6 +3401,50 @@ packages: typescript: 5.1.6 dev: true + /ts-interface-checker@0.1.13: + resolution: {integrity: sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==} + dev: true + + /tslib@2.6.1: + resolution: {integrity: sha512-t0hLfiEKfMUoqhG+U1oid7Pva4bbDPHYfJNiB7BiIjRkj1pyC++4N3huJfqY6aRH6VTB0rvtzQwjM4K6qpfOig==} + dev: true + + /tsup@7.1.0(typescript@5.1.6): + resolution: {integrity: sha512-mazl/GRAk70j8S43/AbSYXGgvRP54oQeX8Un4iZxzATHt0roW0t6HYDVZIXMw0ZQIpvr1nFMniIVnN5186lW7w==} + engines: {node: '>=16.14'} + hasBin: true + peerDependencies: + '@swc/core': ^1 + postcss: ^8.4.12 + typescript: '>=4.1.0' + peerDependenciesMeta: + '@swc/core': + optional: true + postcss: + optional: true + typescript: + optional: true + dependencies: + bundle-require: 4.0.1(esbuild@0.18.17) + cac: 6.7.14 + chokidar: 3.5.3 + debug: 4.3.4 + esbuild: 0.18.17 + execa: 5.1.1 + globby: 11.1.0 + joycon: 3.1.1 + postcss-load-config: 4.0.1 + resolve-from: 5.0.0 + rollup: 3.26.3 + source-map: 0.8.0-beta.0 + sucrase: 3.34.0 + tree-kill: 1.2.2 + typescript: 5.1.6 + transitivePeerDependencies: + - supports-color + - ts-node + dev: true + /type-check@0.4.0: resolution: {integrity: sha512-XleUoc9uwGXqjWwXaUTZAmzMcFZ5858QA2vvx1Ur5xIcixXIP+8LnFDgRplU30us6teqdlskFfu+ae4K79Ooew==} engines: {node: '>= 0.8.0'} @@ -3075,6 +3519,11 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /untildify@4.0.0: + resolution: {integrity: sha512-KK8xQ1mkzZeg9inewmFVDNkg3l5LUhoq9kN6iWYB/CC9YMG8HA+c1Q8HwDe6dEX7kErrEVNVBO3fWsVq5iDgtw==} + engines: {node: '>=8'} + dev: true + /uri-js@4.4.1: resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==} dependencies: @@ -3097,7 +3546,7 @@ packages: spdx-expression-parse: 3.0.1 dev: true - /vite-node@0.33.0(@types/node@20.4.4): + /vite-node@0.33.0(@types/node@20.4.5): resolution: {integrity: sha512-19FpHYbwWWxDr73ruNahC+vtEdza52kA90Qb3La98yZ0xULqV8A5JLNPUff0f5zID4984tW7l3DH2przTJUZSw==} engines: {node: '>=v14.18.0'} hasBin: true @@ -3107,7 +3556,7 @@ packages: mlly: 1.4.0 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.4.6(@types/node@20.4.4) + vite: 4.4.7(@types/node@20.4.5) transitivePeerDependencies: - '@types/node' - less @@ -3119,8 +3568,8 @@ packages: - terser dev: true - /vite@4.4.6(@types/node@20.4.4): - resolution: {integrity: sha512-EY6Mm8vJ++S3D4tNAckaZfw3JwG3wa794Vt70M6cNJ6NxT87yhq7EC8Rcap3ahyHdo8AhCmV9PTk+vG1HiYn1A==} + /vite@4.4.7(@types/node@20.4.5): + resolution: {integrity: sha512-6pYf9QJ1mHylfVh39HpuSfMPojPSKVxZvnclX1K1FyZ1PXDOcLBibdq5t1qxJSnL63ca8Wf4zts6mD8u8oc9Fw==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true peerDependencies: @@ -3147,21 +3596,21 @@ packages: terser: optional: true dependencies: - '@types/node': 20.4.4 - esbuild: 0.18.16 + '@types/node': 20.4.5 + esbuild: 0.18.17 postcss: 8.4.27 rollup: 3.26.3 optionalDependencies: fsevents: 2.3.2 dev: true - /vitepress@1.0.0-beta.6(@types/node@20.4.4)(search-insights@2.7.0): + /vitepress@1.0.0-beta.6(@types/node@20.4.5)(search-insights@2.7.0): resolution: {integrity: sha512-xK/ulKgQpKZVbvlL4+/vW49VG7ySi5nmSoKUNH1G4kM+Cj9JwYM+PDJO7jSJROv8zW99G0ise+maDYnaLlbGBQ==} hasBin: true dependencies: '@docsearch/css': 3.5.1 '@docsearch/js': 3.5.1(search-insights@2.7.0) - '@vitejs/plugin-vue': 4.2.3(vite@4.4.6)(vue@3.3.4) + '@vitejs/plugin-vue': 4.2.3(vite@4.4.7)(vue@3.3.4) '@vue/devtools-api': 6.5.0 '@vueuse/core': 10.2.1(vue@3.3.4) '@vueuse/integrations': 10.2.1(focus-trap@7.5.2)(vue@3.3.4) @@ -3170,7 +3619,7 @@ packages: mark.js: 8.11.1 minisearch: 6.1.0 shiki: 0.14.3 - vite: 4.4.6(@types/node@20.4.4) + vite: 4.4.7(@types/node@20.4.5) vue: 3.3.4 transitivePeerDependencies: - '@algolia/client-search' @@ -3232,7 +3681,7 @@ packages: dependencies: '@types/chai': 4.3.5 '@types/chai-subset': 1.3.3 - '@types/node': 20.4.4 + '@types/node': 20.4.5 '@vitest/expect': 0.33.0 '@vitest/runner': 0.33.0 '@vitest/snapshot': 0.33.0 @@ -3251,8 +3700,8 @@ packages: strip-literal: 1.0.1 tinybench: 2.5.0 tinypool: 0.6.0 - vite: 4.4.6(@types/node@20.4.4) - vite-node: 0.33.0(@types/node@20.4.4) + vite: 4.4.7(@types/node@20.4.5) + vite-node: 0.33.0(@types/node@20.4.5) why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -3297,6 +3746,18 @@ packages: '@vue/shared': 3.3.4 dev: true + /webidl-conversions@4.0.2: + resolution: {integrity: sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==} + dev: true + + /whatwg-url@7.1.0: + resolution: {integrity: sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg==} + dependencies: + lodash.sortby: 4.7.0 + tr46: 1.0.1 + webidl-conversions: 4.0.2 + dev: true + /which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} dependencies: @@ -3368,6 +3829,11 @@ packages: resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==} dev: true + /yaml@2.3.1: + resolution: {integrity: sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==} + engines: {node: '>= 14'} + dev: true + /yocto-queue@0.1.0: resolution: {integrity: sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==} engines: {node: '>=10'} diff --git a/src/index.ts b/src/index.ts index 6ebe9161..28fd328f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,7 +1,4 @@ import type { - AstPath, - Doc, - Options, Parser, ParserOptions, Plugin, @@ -26,7 +23,7 @@ interface AstPathStackEntry { } /** The plugin object that is picked up by prettier. */ -export const plugin: Plugin = { +export const plugin: Plugin = { languages: [ { name: 'Pug', @@ -43,11 +40,7 @@ export const plugin: Plugin = { /* eslint-disable jsdoc/require-jsdoc */ parsers: { pug: { - parse( - text: string, - parsers: { [parserName: string]: Parser }, - options: ParserOptions, - ): AstPathStackEntry { + parse(text, options) { logger.debug('[parsers:pug:parse]:', { text }); let trimmedAndAlignedContent: string = text.replace(/^\s*\n/, ''); @@ -72,21 +65,26 @@ export const plugin: Plugin = { // logger.debug('[parsers:pug:parse]: ast', JSON.stringify(ast, undefined, 2)); return { content, tokens }; }, + astFormat: 'pug-ast', - hasPragma(text: string): boolean { + + hasPragma(text) { return ( text.startsWith('//- @prettier\n') || text.startsWith('//- @format\n') ); }, - locStart(node: unknown): number { + + locStart(node) { logger.debug('[parsers:pug:locStart]:', { node }); return 0; }, - locEnd(node: unknown): number { + + locEnd(node) { logger.debug('[parsers:pug:locEnd]:', { node }); return 0; }, - preprocess(text: string, options: ParserOptions): string { + + preprocess(text, options) { logger.debug('[parsers:pug:preprocess]:', { text }); return text; }, @@ -94,28 +92,17 @@ export const plugin: Plugin = { }, printers: { 'pug-ast': { - print( - path: AstPath, - options: ParserOptions & PugParserOptions, - print: (path: AstPath) => Doc, - ): Doc { - const entry: AstPathStackEntry = path.stack[0]; + // @ts-expect-error: Prettier allow it to be async if we don't do recursively print + async print(path, options: ParserOptions & PugParserOptions) { + const entry: AstPathStackEntry = path.stack[0]!; const { content, tokens } = entry; const pugOptions: PugPrinterOptions = convergeOptions(options); const printer: PugPrinter = new PugPrinter(content, tokens, pugOptions); - const result: string = printer.build(); + const result: string = await printer.build(); logger.debug('[printers:pug-ast:print]:', result); return result; }, - embed( - path: AstPath, - print: (path: AstPath) => Doc, - textToDoc: (text: string, options: Options) => Doc, - options: ParserOptions, - ): Doc | null { - // logger.debug('[printers:pug-ast:embed]:', JSON.stringify(path, undefined, 2)); - return null; - }, + insertPragma(text: string): string { return `//- @prettier\n${text}`; }, diff --git a/src/options/attribute-sorting/index.ts b/src/options/attribute-sorting/index.ts index 4ecf6ec5..5692d001 100644 --- a/src/options/attribute-sorting/index.ts +++ b/src/options/attribute-sorting/index.ts @@ -2,7 +2,7 @@ import type { ChoiceSupportOption, PathArraySupportOption } from 'prettier'; import { CATEGORY_PUG } from '../constants'; const pugSortAttributesOption: PathArraySupportOption = { - since: '1.7.0', + // since: '1.7.0', category: CATEGORY_PUG, type: 'path', array: true, @@ -27,7 +27,7 @@ export const PUG_SORT_ATTRIBUTES_END_OPTION: PathArraySupportOption = { /** Pug sort attributes option. */ export const PUG_SORT_ATTRIBUTES_OPTION: ChoiceSupportOption = { - since: '1.8.0', + // since: '1.8.0', category: CATEGORY_PUG, type: 'choice', default: 'as-is', diff --git a/src/options/common.ts b/src/options/common.ts index fa4bb18b..cb2f7bd4 100644 --- a/src/options/common.ts +++ b/src/options/common.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug print width option. */ export const PUG_PRINT_WIDTH_OPTION: IntSupportOption = { - since: '1.6.0', + // since: '1.6.0', category: CATEGORY_PUG, type: 'int', default: -1, @@ -15,7 +15,7 @@ export const PUG_PRINT_WIDTH_OPTION: IntSupportOption = { export const PUG_SINGLE_QUOTE_OPTION: ChoiceSupportOption< boolean | 'true' | null > = { - since: '1.6.0', + // since: '1.6.0', category: CATEGORY_PUG, type: 'choice', default: null, @@ -43,7 +43,7 @@ export const PUG_SINGLE_QUOTE_OPTION: ChoiceSupportOption< /** Pug tab width option. */ export const PUG_TAB_WIDTH_OPTION: IntSupportOption = { - since: '1.6.0', + // since: '1.6.0', category: CATEGORY_PUG, type: 'int', default: -1, @@ -54,7 +54,7 @@ export const PUG_TAB_WIDTH_OPTION: IntSupportOption = { /** Pug use tabs option. */ export const PUG_USE_TABS_OPTION: ChoiceSupportOption = { - since: '1.6.0', + // since: '1.6.0', category: CATEGORY_PUG, type: 'choice', default: null, @@ -84,7 +84,7 @@ export const PUG_USE_TABS_OPTION: ChoiceSupportOption = export const PUG_BRACKET_SPACING_OPTION: ChoiceSupportOption< boolean | 'true' | null > = { - since: '1.6.0', + // since: '1.6.0', category: CATEGORY_PUG, type: 'choice', default: null, @@ -112,7 +112,7 @@ export const PUG_BRACKET_SPACING_OPTION: ChoiceSupportOption< /** Pug semi option. */ export const PUG_SEMI_OPTION: ChoiceSupportOption = { - since: '1.6.0', + // since: '1.6.0', category: CATEGORY_PUG, type: 'choice', default: null, @@ -142,7 +142,7 @@ export const PUG_SEMI_OPTION: ChoiceSupportOption = { /** Pug arrow parens option. */ export const PUG_ARROW_PARENS_OPTION: ChoiceSupportOption = { - since: '1.7.0', + // since: '1.7.0', category: CATEGORY_PUG, type: 'choice', default: null, @@ -170,7 +170,7 @@ export type ArrowParens = 'avoid' | 'always'; export const PUG_BRACKET_SAME_LINE_OPTION: ChoiceSupportOption< boolean | 'true' | null > = { - since: '1.17.0', + // since: '1.17.0', category: CATEGORY_PUG, type: 'choice', default: null, diff --git a/src/options/converge.ts b/src/options/converge.ts index d14e139d..de3013a4 100644 --- a/src/options/converge.ts +++ b/src/options/converge.ts @@ -21,8 +21,8 @@ export function convergeOptions( tabWidth: options.tabWidth, pugTabWidth: options.pugTabWidth !== -1 ? options.pugTabWidth : options.tabWidth, - useTabs: options.useTabs, - pugUseTabs: options.pugUseTabs ?? options.useTabs, + useTabs: options.useTabs ?? false, + pugUseTabs: options.pugUseTabs ?? options.useTabs ?? false, bracketSpacing: options.bracketSpacing, pugBracketSpacing: options.pugBracketSpacing ?? options.bracketSpacing, arrowParens: options.arrowParens, diff --git a/src/options/empty-attributes/index.ts b/src/options/empty-attributes/index.ts index 83b2b7aa..b2ee0b2f 100644 --- a/src/options/empty-attributes/index.ts +++ b/src/options/empty-attributes/index.ts @@ -5,7 +5,7 @@ import type { PugEmptyAttributes } from './types'; /** Pug empty attributes option. */ export const PUG_EMPTY_ATTRIBUTES_OPTION: ChoiceSupportOption = { - since: '1.10.0', + // since: '1.10.0', category: CATEGORY_PUG, type: 'choice', default: 'as-is', @@ -31,7 +31,7 @@ export const PUG_EMPTY_ATTRIBUTES_OPTION: ChoiceSupportOption = { - since: '1.6.0', + // since: '1.6.0', category: CATEGORY_PUG, type: 'choice', default: 'always', diff --git a/src/options/pug-class-location.ts b/src/options/pug-class-location.ts index 99717bda..4c43866c 100644 --- a/src/options/pug-class-location.ts +++ b/src/options/pug-class-location.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug class location. */ export const PUG_CLASS_LOCATION: ChoiceSupportOption = { - since: '1.19.0', + // since: '1.19.0', category: CATEGORY_PUG, type: 'choice', default: 'before-attributes', diff --git a/src/options/pug-class-notation.ts b/src/options/pug-class-notation.ts index b1922dd4..62c72309 100644 --- a/src/options/pug-class-notation.ts +++ b/src/options/pug-class-notation.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug class notation. */ export const PUG_CLASS_NOTATION: ChoiceSupportOption = { - since: '1.13.0', + // since: '1.13.0', category: CATEGORY_PUG, type: 'choice', default: 'literal', diff --git a/src/options/pug-comment-preserve-spaces.ts b/src/options/pug-comment-preserve-spaces.ts index 0cf3c17d..47271858 100644 --- a/src/options/pug-comment-preserve-spaces.ts +++ b/src/options/pug-comment-preserve-spaces.ts @@ -4,7 +4,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug comment preserve spaces option. */ export const PUG_COMMENT_PRESERVE_SPACES_OPTION: ChoiceSupportOption = { - since: '1.6.0', + // since: '1.6.0', category: CATEGORY_PUG, type: 'choice', default: 'keep-all', diff --git a/src/options/pug-explicit-div.ts b/src/options/pug-explicit-div.ts index c308d730..a4bc9ac9 100644 --- a/src/options/pug-explicit-div.ts +++ b/src/options/pug-explicit-div.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug default div tag. */ export const PUG_EXPLICIT_DIV: BooleanSupportOption = { - since: '1.16.0', + // since: '1.16.0', category: CATEGORY_PUG, type: 'boolean', default: false, diff --git a/src/options/pug-framework.ts b/src/options/pug-framework.ts index bae083d8..a25c5d21 100644 --- a/src/options/pug-framework.ts +++ b/src/options/pug-framework.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug Framework. */ export const PUG_FRAMEWORK: ChoiceSupportOption = { - since: '1.14.0', + // since: '1.14.0', category: CATEGORY_PUG, type: 'choice', default: 'auto', diff --git a/src/options/pug-id-notation.ts b/src/options/pug-id-notation.ts index f3dca824..8a1b9e48 100644 --- a/src/options/pug-id-notation.ts +++ b/src/options/pug-id-notation.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug id notation. */ export const PUG_ID_NOTATION: ChoiceSupportOption = { - since: '1.13.0', + // since: '1.13.0', category: CATEGORY_PUG, type: 'choice', default: 'literal', diff --git a/src/options/pug-preserve-attribute-brackets.ts b/src/options/pug-preserve-attribute-brackets.ts index 500aab31..37b4f7ae 100644 --- a/src/options/pug-preserve-attribute-brackets.ts +++ b/src/options/pug-preserve-attribute-brackets.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug preserve attribute brackets. */ export const PUG_PRESERVE_ATTRIBUTE_BRACKETS: BooleanSupportOption = { - since: '2.2.0', + // since: '2.2.0', category: CATEGORY_PUG, type: 'boolean', default: false, diff --git a/src/options/pug-single-file-component-indentation.ts b/src/options/pug-single-file-component-indentation.ts index f405fb15..041e0389 100644 --- a/src/options/pug-single-file-component-indentation.ts +++ b/src/options/pug-single-file-component-indentation.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Pug single file component indentation. */ export const PUG_SINGLE_FILE_COMPONENT_INDENTATION: BooleanSupportOption = { - since: '1.9.0', + // since: '1.9.0', category: CATEGORY_PUG, type: 'boolean', default: false, diff --git a/src/options/pug-wrap-attributes.ts b/src/options/pug-wrap-attributes.ts index d976c09c..d9d1a721 100644 --- a/src/options/pug-wrap-attributes.ts +++ b/src/options/pug-wrap-attributes.ts @@ -3,7 +3,7 @@ import { CATEGORY_PUG } from './constants'; /** Wrap attributes threshold. */ export const PUG_WRAP_ATTRIBUTES_THRESHOLD: IntSupportOption = { - since: '1.8.0', + // since: '1.8.0', category: CATEGORY_PUG, type: 'int', default: -1, @@ -14,7 +14,7 @@ export const PUG_WRAP_ATTRIBUTES_THRESHOLD: IntSupportOption = { /** Wrap attributes pattern. */ export const PUG_WRAP_ATTRIBUTES_PATTERN: PathSupportOption = { - since: '1.8.0', + // since: '1.8.0', category: CATEGORY_PUG, type: 'path', default: '', diff --git a/src/printer.ts b/src/printer.ts index 8973774a..8962a69e 100644 --- a/src/printer.ts +++ b/src/printer.ts @@ -1,10 +1,10 @@ import { types } from 'node:util'; import type { BuiltInParserName, Options, RequiredOptions } from 'prettier'; import { format } from 'prettier'; -import type { parsers as AngularParsers } from 'prettier/parser-angular'; -import type { parsers as BabelParsers } from 'prettier/parser-babel'; -import type { parsers as HtmlParsers } from 'prettier/parser-html'; -import type { parsers as PostCssParsers } from 'prettier/parser-postcss'; +import type PrettierAngularPlugin from 'prettier/plugins/angular'; +import type PrettierBabelPlugin from 'prettier/plugins/babel'; +import type PrettierHtmlPlugin from 'prettier/plugins/html'; +import type PrettierPostcssPlugin from 'prettier/plugins/postcss'; import type { AndAttributesToken, AttributeToken, @@ -157,10 +157,10 @@ interface FormatDelegatePrettierOptions { * Supported parsers for the `formatDelegatePrettier` function. */ type FormatDelegatePrettierSupportedParser = keyof Pick< - typeof AngularParsers & - typeof BabelParsers & - typeof HtmlParsers & - typeof PostCssParsers, + typeof PrettierAngularPlugin.parsers & + typeof PrettierBabelPlugin.parsers & + typeof PrettierHtmlPlugin.parsers & + typeof PrettierPostcssPlugin.parsers, | 'css' | 'vue' | '__vue_event_binding' @@ -313,7 +313,7 @@ export class PugPrinter { * * @returns The formatted pug content. */ - public build(): string { + public async build(): Promise { if (logger.isDebugEnabled()) { logger.debug('[PugPrinter]:', JSON.stringify(this.tokens)); } @@ -336,8 +336,10 @@ export class PugPrinter { case 'eos': // TODO: These tokens write directly into the result this.result = results.join(''); - // @ts-expect-error: The function is always valid - this[token.type](token); + await this[token.type]( + // @ts-expect-error: The function is always valid + token, + ); results.length = 0; results.push(this.result); break; @@ -353,8 +355,12 @@ export class PugPrinter { if (typeof this[token.type] !== 'function') { throw new Error('Unhandled token: ' + JSON.stringify(token)); } - // @ts-expect-error: If the function would be invalid, it would be caught above - results.push(this[token.type](token)); + results.push( + await this[token.type]( + // @ts-expect-error: If the function would be invalid, it would be caught above + token, + ), + ); break; } } @@ -448,7 +454,7 @@ export class PugPrinter { } } - private frameworkFormat(code: string): string { + private async frameworkFormat(code: string): Promise { const options: Options = { ...this.codeInterpolationOptions, // we need to keep the original singleQuote option @@ -467,14 +473,14 @@ export class PugPrinter { options.semi = false; } - let result: string = format(code, options); + let result: string = await format(code, options); if (result[0] === ';') { result = result.slice(1); } return result; } - private formatText(text: string): string { + private async formatText(text: string): Promise { let result: string = ''; while (text) { // Find double curly brackets @@ -505,7 +511,7 @@ export class PugPrinter { text = text.slice(end + 2); continue; } else { - code = this.frameworkFormat(code); + code = await this.frameworkFormat(code); } } catch (error: unknown) { if (typeof error === 'string') { @@ -551,7 +557,7 @@ export class PugPrinter { logger.warn('[PugPrinter:formatText]: ', error); } try { - code = format(code, { + code = await format(code, { parser: 'babel', ...this.codeInterpolationOptions, semi: false, @@ -600,12 +606,12 @@ export class PugPrinter { text = text.slice(end2 + 1); continue; } else { - code = this.frameworkFormat(code); + code = await this.frameworkFormat(code); } } catch (error: unknown) { logger.warn('[PugPrinter:formatText]: ', error); try { - code = format(code, { + code = await format(code, { parser: 'babel', ...this.codeInterpolationOptions, semi: false, @@ -638,11 +644,11 @@ export class PugPrinter { return result; } - private formatDelegatePrettier( + private async formatDelegatePrettier( val: string, parser: FormatDelegatePrettierSupportedParser, formatOptions: FormatDelegatePrettierOptions = {}, - ): string { + ): Promise { const { trimTrailingSemicolon = false, trimLeadingSemicolon = true } = formatOptions; val = val.trim(); @@ -652,7 +658,7 @@ export class PugPrinter { options.singleQuote = !this.options.pugSingleQuote; val = val.slice(1, -1); // Remove quotes } - val = format(val, { parser, ...options }); + val = await format(val, { parser, ...options }); if (this.quotes === '"') { val = val.replace(/"/g, '\\"'); } else { @@ -668,39 +674,42 @@ export class PugPrinter { return wasQuoted ? this.quoteString(val) : val; } - private formatStyleAttribute(val: string): string { + private async formatStyleAttribute(val: string): Promise { return this.formatDelegatePrettier(val, 'css', { trimTrailingSemicolon: true, }); } - private formatVueEventBinding(val: string): string { + private async formatVueEventBinding(val: string): Promise { return this.formatDelegatePrettier(val, '__vue_event_binding', { trimTrailingSemicolon: true, }); } - private formatVueExpression(val: string): string { + private async formatVueExpression(val: string): Promise { return this.formatDelegatePrettier(val, '__vue_expression'); } - private formatAngularBinding(val: string): string { + private async formatAngularBinding(val: string): Promise { return this.formatDelegatePrettier(val, '__ng_binding'); } - private formatAngularAction(val: string): string { + private async formatAngularAction(val: string): Promise { return this.formatDelegatePrettier(val, '__ng_action'); } - private formatAngularDirective(val: string): string { + private async formatAngularDirective(val: string): Promise { return this.formatDelegatePrettier(val, '__ng_directive'); } - private formatFrameworkInterpolation( + private async formatFrameworkInterpolation( val: string, - parser: keyof Pick, // TODO: may be changed to allow a special parser for svelte + parser: keyof Pick< + typeof PrettierAngularPlugin.parsers, + '__ng_interpolation' + >, // TODO: may be changed to allow a special parser for svelte [opening, closing]: ['{{', '}}'] | ['{', '}'], - ): string { + ): Promise { val = val.slice(1, -1); // Remove quotes val = val.slice(opening.length, -closing.length); // Remove braces val = val.trim(); @@ -715,7 +724,7 @@ export class PugPrinter { singleQuote: !this.options.pugSingleQuote, }; try { - val = format(val, { parser, ...options }); + val = await format(val, { parser, ...options }); } catch (error) { logger.warn( 'The following expression could not be formatted correctly. Please try to fix it yourself and if there is a problem, please open a bug issue:', @@ -731,14 +740,14 @@ export class PugPrinter { return this.quoteString(val); } - private formatAngularInterpolation(val: string): string { + private async formatAngularInterpolation(val: string): Promise { return this.formatFrameworkInterpolation(val, '__ng_interpolation', [ '{{', '}}', ]); } - private formatSvelteInterpolation(val: string): string { + private async formatSvelteInterpolation(val: string): Promise { return this.formatFrameworkInterpolation(val, '__ng_interpolation', [ '{', '}', @@ -932,7 +941,7 @@ export class PugPrinter { return result; } - private attribute(token: AttributeToken): void { + private async attribute(token: AttributeToken): Promise { formatEmptyAttribute( token, this.options.pugEmptyAttributes, @@ -1079,29 +1088,29 @@ export class PugPrinter { // cannot format due to it would expect e.g. json in js and then see a dollar sign that cannot be handled // see https://github.com/prettier/plugin-pug/issues/238#issuecomment-873224173 } else if (isVueVForWithOf(token.name, val)) { - val = this.formatDelegatePrettier(val, 'vue'); + val = await this.formatDelegatePrettier(val, 'vue'); } else if (isVueExpression(token.name)) { - val = this.formatVueExpression(val); + val = await this.formatVueExpression(val); } else if (isVueEventBinding(token.name)) { - val = this.formatVueEventBinding(val); + val = await this.formatVueEventBinding(val); } else if (this.framework === 'vue' && isVueVDirective(token.name)) { - val = this.formatVueExpression(val); + val = await this.formatVueExpression(val); } else if (isVueVBindExpression(token.name)) { - val = this.formatDelegatePrettier(val, '__js_expression'); + val = await this.formatDelegatePrettier(val, '__js_expression'); } else if (isVueVOnExpression(token.name)) { - val = this.formatDelegatePrettier(val, '__js_expression'); + val = await this.formatDelegatePrettier(val, '__js_expression'); } else if (isAngularBinding(token.name)) { - val = this.formatAngularBinding(val); + val = await this.formatAngularBinding(val); } else if (isAngularAction(token.name)) { - val = this.formatAngularAction(val); + val = await this.formatAngularAction(val); } else if (isAngularDirective(token.name)) { - val = this.formatAngularDirective(val); + val = await this.formatAngularDirective(val); } else if (isAngularInterpolation(val)) { - val = this.formatAngularInterpolation(val); + val = await this.formatAngularInterpolation(val); } else if (isSvelteInterpolation(val)) { - val = this.formatSvelteInterpolation(val); + val = await this.formatSvelteInterpolation(val); } else if (isStyleAttribute(token.name, token.val)) { - val = this.formatStyleAttribute(val); + val = await this.formatStyleAttribute(val); } else { // Prevent wrong quotation if there is an extra whitespace at the end const rightTrimmedVal: string = val.trimEnd(); @@ -1111,7 +1120,7 @@ export class PugPrinter { // The value is exactly true and is not quoted return; } else if (token.mustEscape) { - val = format(val, { + val = await format(val, { parser: '__js_expression', ...this.codeInterpolationOptions, }); @@ -1485,7 +1494,7 @@ export class PugPrinter { return result; } - private text(token: TextToken): string { + private async text(token: TextToken): Promise { let result: string = ''; let val: string = token.val; let needsTrailingWhitespace: boolean = false; @@ -1562,7 +1571,7 @@ export class PugPrinter { } val = val.trim(); - val = this.formatText(val); + val = await this.formatText(val); val = val.replace(/#(\{|\[)/g, '\\#$1'); } @@ -1623,7 +1632,7 @@ export class PugPrinter { return result; } - private code(token: CodeToken): string { + private async code(token: CodeToken): Promise { let result: string = this.computedIndent; if (!token.mustEscape && token.buffer) { result += '!'; @@ -1636,7 +1645,7 @@ export class PugPrinter { let val: string = token.val; try { const valBackup: string = val; - val = format(val, { + val = await format(val, { parser: 'babel', ...this.codeInterpolationOptions, semi: useSemi, @@ -1685,7 +1694,9 @@ export class PugPrinter { } } - private ['start-pipeless-text'](token: StartPipelessTextToken): string { + private async ['start-pipeless-text']( + token: StartPipelessTextToken, + ): Promise { this.pipelessText = true; let result: string = `\n${this.indentString.repeat(this.indentLevel)}`; @@ -1742,7 +1753,7 @@ export class PugPrinter { } try { - result = format(rawText, { + result = await format(rawText, { parser, ...this.codeInterpolationOptions, }); @@ -1961,9 +1972,9 @@ export class PugPrinter { return result; } - private eachOf(token: EachOfToken): string { + private async eachOf(token: EachOfToken): Promise { let value: string = token.value.trim(); - value = format(value, { + value = await format(value, { parser: 'babel', ...this.codeInterpolationOptions, semi: false, diff --git a/tests/attributes/boolean-attributes/boolean-attributes.test.ts b/tests/attributes/boolean-attributes/boolean-attributes.test.ts index aba419ac..890b25b1 100644 --- a/tests/attributes/boolean-attributes/boolean-attributes.test.ts +++ b/tests/attributes/boolean-attributes/boolean-attributes.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Attributes', () => { - it('should shorten truthy attributes', () => { - const { expected, actual } = compareFiles(__dirname); + it('should shorten truthy attributes', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/attributes/class-attributes/class-attributes.test.ts b/tests/attributes/class-attributes/class-attributes.test.ts index 80a69ea3..dd68f70e 100644 --- a/tests/attributes/class-attributes/class-attributes.test.ts +++ b/tests/attributes/class-attributes/class-attributes.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Attributes', () => { - it('should handle class attributes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle class attributes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { semi: false }, }); expect(actual).toBe(expected); diff --git a/tests/attributes/no-attributes/no-attributes.test.ts b/tests/attributes/no-attributes/no-attributes.test.ts index 5088d7c2..ff98e0b8 100644 --- a/tests/attributes/no-attributes/no-attributes.test.ts +++ b/tests/attributes/no-attributes/no-attributes.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Attributes', () => { - it('should handle no attributes', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle no attributes', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/attributes/style-attributes/style-attributes.test.ts b/tests/attributes/style-attributes/style-attributes.test.ts index a29c2ad0..b486c7dd 100644 --- a/tests/attributes/style-attributes/style-attributes.test.ts +++ b/tests/attributes/style-attributes/style-attributes.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Attributes', () => { - it('should handle style attributes', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle style attributes', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/comments/comments.test.ts b/tests/comments/comments.test.ts index 0818ec07..576268fd 100644 --- a/tests/comments/comments.test.ts +++ b/tests/comments/comments.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Comments', () => { - it('should handle comments', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle comments', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugCommentPreserveSpaces: 'trim-all' }, }); expect(actual).toBe(expected); diff --git a/tests/common.ts b/tests/common.ts index d25c5674..89931026 100644 --- a/tests/common.ts +++ b/tests/common.ts @@ -1,5 +1,6 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import type { Options } from 'prettier'; import { format } from 'prettier'; import type { AttributeToken } from 'pug-lexer'; @@ -75,26 +76,28 @@ export interface CompareFilesResult { /** * Compare two files with each other and returns the result to be passed in expect calls. * - * @param dirname Pass `__dirname`, so the function can relative resolve the files. + * @param metaUrl Pass `import.meta.url`, so the function can relative resolve the files. * @param param1 Compare options. * @param param1.source The source file. Default `'unformatted.pug'`. * @param param1.target The target file. Default `'formatted.pug'`. Pass `null` to explicitly only check the given source. * @param param1.formatOptions Further format options. Default `{ parser: 'pug', plugins: [plugin] }`. You can also override the parser and plugins key. * @returns The result to be passed in expect calls. */ -export function compareFiles( - dirname: string, +export async function compareFiles( + metaUrl: string, { source = 'unformatted.pug', target = 'formatted.pug', formatOptions = {}, }: CompareFilesOptions = {}, -): CompareFilesResult { +): Promise { + const dirname: string = fileURLToPath(new URL('.', metaUrl)); + const expected: string | null = target ? readFileSync(resolve(dirname, target), 'utf8') : null; const code: string = readFileSync(resolve(dirname, source), 'utf8'); - const actual: string = format(code, { + const actual: string = await format(code, { parser: 'pug', plugins: [plugin], ...formatOptions, diff --git a/tests/conditionals/conditionals.test.ts b/tests/conditionals/conditionals.test.ts index 54601f70..76e49514 100644 --- a/tests/conditionals/conditionals.test.ts +++ b/tests/conditionals/conditionals.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Comments', () => { - it('should handle conditionals', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle conditionals', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/embed/md/embed.test.ts b/tests/embed/md/embed.test.ts index d4daf111..d7ff59a8 100644 --- a/tests/embed/md/embed.test.ts +++ b/tests/embed/md/embed.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Embedded', () => { - it('should format when embedded in markdown', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format when embedded in markdown', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.md', target: 'formatted.md', formatOptions: { parser: 'markdown' }, diff --git a/tests/embed/vue/embed.test.ts b/tests/embed/vue/embed.test.ts index 5c92aae4..c6b11158 100644 --- a/tests/embed/vue/embed.test.ts +++ b/tests/embed/vue/embed.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Embedded', () => { - it('should format when embedded in vue', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format when embedded in vue', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.vue', target: 'formatted.vue', formatOptions: { @@ -13,8 +13,8 @@ describe('Embedded', () => { expect(actual).toBe(expected); }); - it('should format when embedded in vue html reference', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format when embedded in vue html reference', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted-html-reference.vue', target: 'formatted-html-reference.vue', formatOptions: { @@ -24,8 +24,8 @@ describe('Embedded', () => { expect(actual).toBe(expected); }); - it('should format when embedded in vue empty template', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format when embedded in vue empty template', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted-empty-template.vue', target: 'formatted-empty-template.vue', formatOptions: { diff --git a/tests/frameworks/svelte/svelte.test.ts b/tests/frameworks/svelte/svelte.test.ts index 9046e420..2ce0fd65 100644 --- a/tests/frameworks/svelte/svelte.test.ts +++ b/tests/frameworks/svelte/svelte.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Frameworks', () => { describe('Svelte', () => { - it('should format svelte', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format svelte', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugFramework: 'svelte' }, }); diff --git a/tests/frameworks/vue/v-bind/v-bind.test.ts b/tests/frameworks/vue/v-bind/v-bind.test.ts index 1cd6e684..48bb5a45 100644 --- a/tests/frameworks/vue/v-bind/v-bind.test.ts +++ b/tests/frameworks/vue/v-bind/v-bind.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Frameworks', () => { describe('Vue', () => { - it('should format v-bind', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format v-bind', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugFramework: 'vue' }, }); diff --git a/tests/frameworks/vue/v-model/v-model.test.ts b/tests/frameworks/vue/v-model/v-model.test.ts index 3f65a7de..5e9f0efd 100644 --- a/tests/frameworks/vue/v-model/v-model.test.ts +++ b/tests/frameworks/vue/v-model/v-model.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Frameworks', () => { describe('Vue', () => { - it('should format v-model', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format v-model', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugFramework: 'vue' }, }); diff --git a/tests/frameworks/vue/v-on/v-on.test.ts b/tests/frameworks/vue/v-on/v-on.test.ts index 1abf09d3..1190bd7a 100644 --- a/tests/frameworks/vue/v-on/v-on.test.ts +++ b/tests/frameworks/vue/v-on/v-on.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Frameworks', () => { describe('Vue', () => { - it('should format v-on', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format v-on', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugFramework: 'vue' }, }); diff --git a/tests/frameworks/vue/v-slot/v-slot.test.ts b/tests/frameworks/vue/v-slot/v-slot.test.ts index 593ba08c..6fc6b5d8 100644 --- a/tests/frameworks/vue/v-slot/v-slot.test.ts +++ b/tests/frameworks/vue/v-slot/v-slot.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Frameworks', () => { describe('Vue', () => { - it('should format v-slot', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format v-slot', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugFramework: 'vue' }, }); diff --git a/tests/indents/indents.test.ts b/tests/indents/indents.test.ts index e45e6028..c9de45d3 100644 --- a/tests/indents/indents.test.ts +++ b/tests/indents/indents.test.ts @@ -2,15 +2,15 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Indents', () => { - it('should indent by default with 2 spaces', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent by default with 2 spaces', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-2-spaces.pug', }); expect(actual).toBe(expected); }); - it('should indent with 2 spaces', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent with 2 spaces', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-2-spaces.pug', formatOptions: { tabWidth: 2, @@ -19,8 +19,8 @@ describe('Indents', () => { expect(actual).toBe(expected); }); - it('should indent with 3 spaces', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent with 3 spaces', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-3-spaces.pug', formatOptions: { tabWidth: 3, @@ -29,8 +29,8 @@ describe('Indents', () => { expect(actual).toBe(expected); }); - it('should indent with 4 spaces', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent with 4 spaces', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-4-spaces.pug', formatOptions: { tabWidth: 4, @@ -39,8 +39,8 @@ describe('Indents', () => { expect(actual).toBe(expected); }); - it('should indent with tabs', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent with tabs', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-tabs.pug', formatOptions: { useTabs: true, diff --git a/tests/inheritance/blocks/inheritance.test.ts b/tests/inheritance/blocks/inheritance.test.ts index 997eaa1c..1618f9f1 100644 --- a/tests/inheritance/blocks/inheritance.test.ts +++ b/tests/inheritance/blocks/inheritance.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Inheritance', () => { - it('should handle blocks', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle blocks', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/interpolations/interpolations.test.ts b/tests/interpolations/interpolations.test.ts index 6be0b28c..c7da4e3e 100644 --- a/tests/interpolations/interpolations.test.ts +++ b/tests/interpolations/interpolations.test.ts @@ -1,10 +1,13 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import { format } from 'prettier'; import { plugin } from 'src/index'; import { compareFiles } from 'tests/common'; import { afterEach, describe, expect, it } from 'vitest'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + describe('Interpolations', () => { const backupProcessEnv: Record = process.env; @@ -12,15 +15,15 @@ describe('Interpolations', () => { process.env = { ...backupProcessEnv }; }); - it('should handle Neutral interpolations', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle Neutral interpolations', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted_none.pug', target: 'formatted_none.pug', }); expect(actual).toBe(expected); }); - it('should handle Angular interpolations', () => { + it('should handle Angular interpolations', async () => { const expected: string = readFileSync( resolve(__dirname, 'formatted_angular.pug'), 'utf8', @@ -33,7 +36,7 @@ describe('Interpolations', () => { // process.env should be ignored process.env.npm_package_dependencies_vue = 'some version'; - const actual: string = format(code, { + const actual: string = await format(code, { parser: 'pug', plugins: [plugin], @@ -42,7 +45,7 @@ describe('Interpolations', () => { expect(actual).toBe(expected); }); - it('should handle Vue interpolations', () => { + it('should handle Vue interpolations', async () => { const expected: string = readFileSync( resolve(__dirname, 'formatted_vue.pug'), 'utf8', @@ -55,7 +58,7 @@ describe('Interpolations', () => { // process.env should be ignored process.env.npm_package_devDependencies_svelte = 'some version'; - const actual: string = format(code, { + const actual: string = await format(code, { parser: 'pug', plugins: [plugin], diff --git a/tests/issues/issue-105/issue-105.test.ts b/tests/issues/issue-105/issue-105.test.ts index 9b919e9a..9fc3f599 100644 --- a/tests/issues/issue-105/issue-105.test.ts +++ b/tests/issues/issue-105/issue-105.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should prefer pug aliased option', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should prefer pug aliased option', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.vue', target: 'formatted.vue', formatOptions: { diff --git a/tests/issues/issue-107/issue-107.test.ts b/tests/issues/issue-107/issue-107.test.ts index 0ffb2b27..cebc79ed 100644 --- a/tests/issues/issue-107/issue-107.test.ts +++ b/tests/issues/issue-107/issue-107.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not wrap pug in brackets into multi line', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not wrap pug in brackets into multi line', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { printWidth: 80, }, diff --git a/tests/issues/issue-11/issue-11.test.ts b/tests/issues/issue-11/issue-11.test.ts index 4a597051..d646d157 100644 --- a/tests/issues/issue-11/issue-11.test.ts +++ b/tests/issues/issue-11/issue-11.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle mixins', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle mixins', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-110/issue-110.test.ts b/tests/issues/issue-110/issue-110.test.ts index 411be12d..b6db0e65 100644 --- a/tests/issues/issue-110/issue-110.test.ts +++ b/tests/issues/issue-110/issue-110.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should correctly indent objects in class attributes', () => { - const { expected, actual } = compareFiles(__dirname); + it('should correctly indent objects in class attributes', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-115/issue-115.test.ts b/tests/issues/issue-115/issue-115.test.ts index 829d99ca..67572c34 100644 --- a/tests/issues/issue-115/issue-115.test.ts +++ b/tests/issues/issue-115/issue-115.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should format vue filters within brackets', () => { - const { expected, actual } = compareFiles(__dirname); + it('should format vue filters within brackets', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-129/issue-129.test.ts b/tests/issues/issue-129/issue-129.test.ts index 22aab0c4..2ee8fa43 100644 --- a/tests/issues/issue-129/issue-129.test.ts +++ b/tests/issues/issue-129/issue-129.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it("should handle vue's v-for with for...of style", () => { - const { expected, actual } = compareFiles(__dirname); + it("should handle vue's v-for with for...of style", async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-145/issue-145.test.ts b/tests/issues/issue-145/issue-145.test.ts index 28916b03..ecd33a5c 100644 --- a/tests/issues/issue-145/issue-145.test.ts +++ b/tests/issues/issue-145/issue-145.test.ts @@ -2,13 +2,13 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should preserve multi-root nodes', () => { - const { expected, actual } = compareFiles(__dirname); + it('should preserve multi-root nodes', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); - it('should preserve multi-root nodes with pugSingleFileComponentIndentation', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should preserve multi-root nodes with pugSingleFileComponentIndentation', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.vue', target: 'formatted.vue', formatOptions: { @@ -20,8 +20,8 @@ describe('Issues', () => { expect(actual).toBe(expected); }); - it('should preserve multi-root nodes with pugSingleFileComponentIndentation for extends', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should preserve multi-root nodes with pugSingleFileComponentIndentation for extends', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'extends-unformatted.vue', target: 'extends-formatted.vue', formatOptions: { diff --git a/tests/issues/issue-147/issue-147.test.ts b/tests/issues/issue-147/issue-147.test.ts index ea1a3c42..7ae02bf8 100644 --- a/tests/issues/issue-147/issue-147.test.ts +++ b/tests/issues/issue-147/issue-147.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle parsed object shorthand notation', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle parsed object shorthand notation', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-148/issue-148.test.ts b/tests/issues/issue-148/issue-148.test.ts index a4b20db0..b371d169 100644 --- a/tests/issues/issue-148/issue-148.test.ts +++ b/tests/issues/issue-148/issue-148.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should correctly format vue bracket interpolation with pugSingleFileComponentIndentation', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should correctly format vue bracket interpolation with pugSingleFileComponentIndentation', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.vue', target: 'formatted.vue', formatOptions: { diff --git a/tests/issues/issue-149/issue-149.test.ts b/tests/issues/issue-149/issue-149.test.ts index ddbd9c4e..adce0741 100644 --- a/tests/issues/issue-149/issue-149.test.ts +++ b/tests/issues/issue-149/issue-149.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not break attribute wrapping in interpolated tags', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not break attribute wrapping in interpolated tags', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { arrowParens: 'avoid', bracketSpacing: true, diff --git a/tests/issues/issue-156/issue-156.test.ts b/tests/issues/issue-156/issue-156.test.ts index a76186aa..b9ccb259 100644 --- a/tests/issues/issue-156/issue-156.test.ts +++ b/tests/issues/issue-156/issue-156.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle multiline inline script', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle multiline inline script', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { printWidth: 120, endOfLine: 'auto', diff --git a/tests/issues/issue-158/issue-158.test.ts b/tests/issues/issue-158/issue-158.test.ts index e86aa881..7bbb65ff 100644 --- a/tests/issues/issue-158/issue-158.test.ts +++ b/tests/issues/issue-158/issue-158.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should format inline JavaScript in text block', () => { - const { expected, actual } = compareFiles(__dirname); + it('should format inline JavaScript in text block', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-162/issue-162.test.ts b/tests/issues/issue-162/issue-162.test.ts index 832e5e65..a4ddcace 100644 --- a/tests/issues/issue-162/issue-162.test.ts +++ b/tests/issues/issue-162/issue-162.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should format value of style attribute in tags', () => { - const { expected, actual } = compareFiles(__dirname); + it('should format value of style attribute in tags', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-169/issue-169.test.ts b/tests/issues/issue-169/issue-169.test.ts index 0eedec77..e13add22 100644 --- a/tests/issues/issue-169/issue-169.test.ts +++ b/tests/issues/issue-169/issue-169.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle unescaped interpolations in pipeless script tag', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle unescaped interpolations in pipeless script tag', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-171/issue-171.test.ts b/tests/issues/issue-171/issue-171.test.ts index 5516fbf1..dd349f70 100644 --- a/tests/issues/issue-171/issue-171.test.ts +++ b/tests/issues/issue-171/issue-171.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not indent blank lines with an indent in inline syntax', () => { - const { expected, actual } = compareFiles(__dirname); + it('should not indent blank lines with an indent in inline syntax', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-176/issue-176.test.ts b/tests/issues/issue-176/issue-176.test.ts index 82916be0..16aea559 100644 --- a/tests/issues/issue-176/issue-176.test.ts +++ b/tests/issues/issue-176/issue-176.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle spread destructuring in Vue syntax', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle spread destructuring in Vue syntax', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-18/issue-18.test.ts b/tests/issues/issue-18/issue-18.test.ts index 8eeddd39..e6f2fcf1 100644 --- a/tests/issues/issue-18/issue-18.test.ts +++ b/tests/issues/issue-18/issue-18.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle include', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle include', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-180/issue-180.test.ts b/tests/issues/issue-180/issue-180.test.ts index 4b4c114d..0688ecc0 100644 --- a/tests/issues/issue-180/issue-180.test.ts +++ b/tests/issues/issue-180/issue-180.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle v-slot expression', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle v-slot expression', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-182/issue-182.test.ts b/tests/issues/issue-182/issue-182.test.ts index f13685b8..f8612333 100644 --- a/tests/issues/issue-182/issue-182.test.ts +++ b/tests/issues/issue-182/issue-182.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle autocloseable tag with trailing text correctly', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle autocloseable tag with trailing text correctly', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-192/issue-192.test.ts b/tests/issues/issue-192/issue-192.test.ts index 2814bac1..acadf4ab 100644 --- a/tests/issues/issue-192/issue-192.test.ts +++ b/tests/issues/issue-192/issue-192.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should sort more stabilized', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should sort more stabilized', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugSortAttributesBeginning: [ '^v-else$', diff --git a/tests/issues/issue-20/issue-20.test.ts b/tests/issues/issue-20/issue-20.test.ts index 14be8a1e..3683eef7 100644 --- a/tests/issues/issue-20/issue-20.test.ts +++ b/tests/issues/issue-20/issue-20.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should preserve spaces around interpolated tags', () => { - const { expected, actual } = compareFiles(__dirname); + it('should preserve spaces around interpolated tags', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-206/issue-206.test.ts b/tests/issues/issue-206/issue-206.test.ts index 0b732185..ab7a3dec 100644 --- a/tests/issues/issue-206/issue-206.test.ts +++ b/tests/issues/issue-206/issue-206.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not add semicolon in front of template string', () => { - const { expected, actual } = compareFiles(__dirname); + it('should not add semicolon in front of template string', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-238/issue-238.test.ts b/tests/issues/issue-238/issue-238.test.ts index c6f59889..ac8e41a8 100644 --- a/tests/issues/issue-238/issue-238.test.ts +++ b/tests/issues/issue-238/issue-238.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should interpolate pug variable in a Vue directive', () => { - const { expected, actual } = compareFiles(__dirname); + it('should interpolate pug variable in a Vue directive', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-24/issue-24.test.ts b/tests/issues/issue-24/issue-24.test.ts index 17013335..5f6f254a 100644 --- a/tests/issues/issue-24/issue-24.test.ts +++ b/tests/issues/issue-24/issue-24.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle html tags', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle html tags', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-244/issue-244.test.ts b/tests/issues/issue-244/issue-244.test.ts index 90bdebd2..ae8d7ff9 100644 --- a/tests/issues/issue-244/issue-244.test.ts +++ b/tests/issues/issue-244/issue-244.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle non-JS script content', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle non-JS script content', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-250/issue-250.test.ts b/tests/issues/issue-250/issue-250.test.ts index 1b86f549..02a0f537 100644 --- a/tests/issues/issue-250/issue-250.test.ts +++ b/tests/issues/issue-250/issue-250.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not quote pug variables assigned to Vue props', () => { - const { expected, actual } = compareFiles(__dirname); + it('should not quote pug variables assigned to Vue props', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-255/issue-255.test.ts b/tests/issues/issue-255/issue-255.test.ts index e3beca40..9650271e 100644 --- a/tests/issues/issue-255/issue-255.test.ts +++ b/tests/issues/issue-255/issue-255.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should consistently format quotes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should consistently format quotes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { semi: false, singleQuote: true, diff --git a/tests/issues/issue-261/issue-261.test.ts b/tests/issues/issue-261/issue-261.test.ts index bf599146..280bf025 100644 --- a/tests/issues/issue-261/issue-261.test.ts +++ b/tests/issues/issue-261/issue-261.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should preserve backticks for class and id attributes', () => { - const { expected, actual } = compareFiles(__dirname); + it('should preserve backticks for class and id attributes', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-262/issue-262.test.ts b/tests/issues/issue-262/issue-262.test.ts index c4dd4268..7a1006f8 100644 --- a/tests/issues/issue-262/issue-262.test.ts +++ b/tests/issues/issue-262/issue-262.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should format inline css styles', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format inline css styles', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { useTabs: true, }, diff --git a/tests/issues/issue-268/issue-268.test.ts b/tests/issues/issue-268/issue-268.test.ts index 488f4883..1532ec74 100644 --- a/tests/issues/issue-268/issue-268.test.ts +++ b/tests/issues/issue-268/issue-268.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should consider tabWidth when using useTabs', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should consider tabWidth when using useTabs', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { useTabs: true, tabWidth: 8, diff --git a/tests/issues/issue-27/issue-27.test.ts b/tests/issues/issue-27/issue-27.test.ts index 879838a7..da77e77f 100644 --- a/tests/issues/issue-27/issue-27.test.ts +++ b/tests/issues/issue-27/issue-27.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should interpolation', () => { - const { expected, actual } = compareFiles(__dirname); + it('should interpolation', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-278/issue-278.test.ts b/tests/issues/issue-278/issue-278.test.ts index 534293c1..05794187 100644 --- a/tests/issues/issue-278/issue-278.test.ts +++ b/tests/issues/issue-278/issue-278.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should trim indentations', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should trim indentations', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: true, useTabs: true, diff --git a/tests/issues/issue-282/issue-282.test.ts b/tests/issues/issue-282/issue-282.test.ts index c2796532..dadac00d 100644 --- a/tests/issues/issue-282/issue-282.test.ts +++ b/tests/issues/issue-282/issue-282.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should indent templates starting with literal class when using pugSingleFileComponentIndentation', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent templates starting with literal class when using pugSingleFileComponentIndentation', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'class-not-indented.vue', target: 'class-indented.vue', formatOptions: { @@ -15,8 +15,8 @@ describe('Issues', () => { expect(actual).toBe(expected); }); - it('should indent templates starting with literal ID when using pugSingleFileComponentIndentation', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent templates starting with literal ID when using pugSingleFileComponentIndentation', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'id-not-indented.vue', target: 'id-indented.vue', formatOptions: { diff --git a/tests/issues/issue-289/issue-289.test.ts b/tests/issues/issue-289/issue-289.test.ts index 8b5c4c7d..b3256207 100644 --- a/tests/issues/issue-289/issue-289.test.ts +++ b/tests/issues/issue-289/issue-289.test.ts @@ -2,13 +2,13 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle vue slot shorthand syntax', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle vue slot shorthand syntax', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); - it('should handle vue slot shorthand syntax in vue file', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle vue slot shorthand syntax in vue file', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.vue', target: 'formatted.vue', formatOptions: { diff --git a/tests/issues/issue-29/issue-29.test.ts b/tests/issues/issue-29/issue-29.test.ts index 369263f4..012ac40f 100644 --- a/tests/issues/issue-29/issue-29.test.ts +++ b/tests/issues/issue-29/issue-29.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle each', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle each', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-292/issue-292.test.ts b/tests/issues/issue-292/issue-292.test.ts index 35fdf082..6e783dd1 100644 --- a/tests/issues/issue-292/issue-292.test.ts +++ b/tests/issues/issue-292/issue-292.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle prettier-ignore', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle prettier-ignore', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-303/issue-303.test.ts b/tests/issues/issue-303/issue-303.test.ts index 7da34ba9..6b71e72e 100644 --- a/tests/issues/issue-303/issue-303.test.ts +++ b/tests/issues/issue-303/issue-303.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should ignore escaping chars in vue prop', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should ignore escaping chars in vue prop', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: true, diff --git a/tests/issues/issue-307/issue-307.test.ts b/tests/issues/issue-307/issue-307.test.ts index 1ed3927b..54a2f59c 100644 --- a/tests/issues/issue-307/issue-307.test.ts +++ b/tests/issues/issue-307/issue-307.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should set tab to 4 spaces', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should set tab to 4 spaces', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { arrowParens: 'avoid', singleQuote: true, diff --git a/tests/issues/issue-31/issue-31.test.ts b/tests/issues/issue-31/issue-31.test.ts index f2d6b50f..818acfa6 100644 --- a/tests/issues/issue-31/issue-31.test.ts +++ b/tests/issues/issue-31/issue-31.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should leave the buffered code unchanged', () => { - const { expected, actual } = compareFiles(__dirname); + it('should leave the buffered code unchanged', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-310/issue-310.test.ts b/tests/issues/issue-310/issue-310.test.ts index 236d7537..3d951ffb 100644 --- a/tests/issues/issue-310/issue-310.test.ts +++ b/tests/issues/issue-310/issue-310.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should format v-t directive from vue-i18n', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format v-t directive from vue-i18n', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugFramework: 'vue', }, diff --git a/tests/issues/issue-315/issue-315.test.ts b/tests/issues/issue-315/issue-315.test.ts index 73c53e26..0f19e280 100644 --- a/tests/issues/issue-315/issue-315.test.ts +++ b/tests/issues/issue-315/issue-315.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not add double "." when formatting class location', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not add double "." when formatting class location', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugClassLocation: 'after-attributes' }, }); expect(actual).toBe(expected); diff --git a/tests/issues/issue-317/issue-317.test.ts b/tests/issues/issue-317/issue-317.test.ts index 293dda6a..fd1572fd 100644 --- a/tests/issues/issue-317/issue-317.test.ts +++ b/tests/issues/issue-317/issue-317.test.ts @@ -4,8 +4,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should respect printWidth and pugClassLocation with pugSortAttributesEnd', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should respect printWidth and pugClassLocation with pugSortAttributesEnd', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { printWidth: 120, @@ -16,8 +16,8 @@ describe('Issues', () => { expect(actual).toBe(expected); }); - it('should keep same format after two runs with printWidth and pugClassLocation', () => { - const { code, expected } = compareFiles(__dirname, { + it('should keep same format after two runs with printWidth and pugClassLocation', async () => { + const { code, expected } = await compareFiles(import.meta.url, { formatOptions: { printWidth: 120, @@ -25,7 +25,7 @@ describe('Issues', () => { }, }); - const run2: string = format(code, { + const run2: string = await format(code, { parser: 'pug', plugins: [plugin], diff --git a/tests/issues/issue-329/issue-329.test.ts b/tests/issues/issue-329/issue-329.test.ts index f61e2d18..a9c6da83 100644 --- a/tests/issues/issue-329/issue-329.test.ts +++ b/tests/issues/issue-329/issue-329.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle nested angular translations', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle nested angular translations', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { printWidth: 120, pugFramework: 'angular', diff --git a/tests/issues/issue-339/issue-339.test.ts b/tests/issues/issue-339/issue-339.test.ts index 73e42d58..312c2b07 100644 --- a/tests/issues/issue-339/issue-339.test.ts +++ b/tests/issues/issue-339/issue-339.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle singleQuote:true + pugSingleQuote:false in framework interpolation', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle singleQuote:true + pugSingleQuote:false in framework interpolation', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'double-quotes.pug', target: 'single-quotes.pug', formatOptions: { @@ -14,8 +14,8 @@ describe('Issues', () => { expect(actual).toBe(expected); }); - it('should handle singleQuote:false + pugSingleQuote:true in framework interpolation', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle singleQuote:false + pugSingleQuote:true in framework interpolation', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'single-quotes.pug', target: 'double-quotes.pug', formatOptions: { diff --git a/tests/issues/issue-34/issue-34.test.ts b/tests/issues/issue-34/issue-34.test.ts index 2fde593e..c64006cb 100644 --- a/tests/issues/issue-34/issue-34.test.ts +++ b/tests/issues/issue-34/issue-34.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle while and case', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle while and case', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-362/issue-362.test.ts b/tests/issues/issue-362/issue-362.test.ts index 76817c97..09f0ce7a 100644 --- a/tests/issues/issue-362/issue-362.test.ts +++ b/tests/issues/issue-362/issue-362.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle nested quotes in properties', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle nested quotes in properties', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: false, pugSingleQuote: false, @@ -13,8 +13,8 @@ describe('Issues', () => { expect(actual).toBe(expected); }); - it('should handle nested quotes in properties in vue files', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle nested quotes in properties in vue files', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.vue', target: 'formatted.vue', formatOptions: { diff --git a/tests/issues/issue-38/issue-38.test.ts b/tests/issues/issue-38/issue-38.test.ts index 322e65c8..e190fb4d 100644 --- a/tests/issues/issue-38/issue-38.test.ts +++ b/tests/issues/issue-38/issue-38.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle else if', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle else if', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-39/issue-39.test.ts b/tests/issues/issue-39/issue-39.test.ts index 1acaa477..2fa6efc2 100644 --- a/tests/issues/issue-39/issue-39.test.ts +++ b/tests/issues/issue-39/issue-39.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle multilines javascript', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle multilines javascript', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-40/issue-40.test.ts b/tests/issues/issue-40/issue-40.test.ts index d9ba66d3..08c1ddfc 100644 --- a/tests/issues/issue-40/issue-40.test.ts +++ b/tests/issues/issue-40/issue-40.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle interpolation', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle interpolation', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-402/issue-402.test.ts b/tests/issues/issue-402/issue-402.test.ts index 5e1209b7..de76fef7 100644 --- a/tests/issues/issue-402/issue-402.test.ts +++ b/tests/issues/issue-402/issue-402.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should preserve script tag after prettier-ignore', () => { - const { actual, expected } = compareFiles(__dirname); + it('should preserve script tag after prettier-ignore', async () => { + const { actual, expected } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-405/issue-405.test.ts b/tests/issues/issue-405/issue-405.test.ts index af176d5c..d14df074 100644 --- a/tests/issues/issue-405/issue-405.test.ts +++ b/tests/issues/issue-405/issue-405.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should preserve script tag after prettier-ignore', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should preserve script tag after prettier-ignore', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.vue', target: 'formatted.vue', formatOptions: { diff --git a/tests/issues/issue-417/issue-417.test.ts b/tests/issues/issue-417/issue-417.test.ts index b8d248e2..bd985d84 100644 --- a/tests/issues/issue-417/issue-417.test.ts +++ b/tests/issues/issue-417/issue-417.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should add two empty piped lines before and after link tag', () => { - const { expected, actual } = compareFiles(__dirname); + it('should add two empty piped lines before and after link tag', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-425/issue-425.test.ts b/tests/issues/issue-425/issue-425.test.ts index a984530c..92967a62 100644 --- a/tests/issues/issue-425/issue-425.test.ts +++ b/tests/issues/issue-425/issue-425.test.ts @@ -2,13 +2,13 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should trim trailing whitespace after tag', () => { - const { expected, actual } = compareFiles(__dirname); + it('should trim trailing whitespace after tag', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); - it('should not change', () => { - const { expected, actual } = compareFiles(__dirname, { + it('should not change', async () => { + const { expected, actual } = await compareFiles(import.meta.url, { source: 'formatted.pug', }); expect(actual).toBe(expected); diff --git a/tests/issues/issue-428/issue-428.test.ts b/tests/issues/issue-428/issue-428.test.ts index 6e40d3fc..d5568dee 100644 --- a/tests/issues/issue-428/issue-428.test.ts +++ b/tests/issues/issue-428/issue-428.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not log error', () => { - const { expected, actual } = compareFiles(__dirname, { + it('should not log error', async () => { + const { expected, actual } = await compareFiles(import.meta.url, { formatOptions: { semi: false, singleQuote: true, diff --git a/tests/issues/issue-439/issue-439.test.ts b/tests/issues/issue-439/issue-439.test.ts index 76a4d302..c5f59765 100644 --- a/tests/issues/issue-439/issue-439.test.ts +++ b/tests/issues/issue-439/issue-439.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle trailing whitespace after class', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle trailing whitespace after class', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-447/issue-447.test.ts b/tests/issues/issue-447/issue-447.test.ts index 0a832a55..93a07e85 100644 --- a/tests/issues/issue-447/issue-447.test.ts +++ b/tests/issues/issue-447/issue-447.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle whitespace in interpolations', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle whitespace in interpolations', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-49/issue-49.test.ts b/tests/issues/issue-49/issue-49.test.ts index 0b77c686..b4038a94 100644 --- a/tests/issues/issue-49/issue-49.test.ts +++ b/tests/issues/issue-49/issue-49.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle interpolation following id', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle interpolation following id', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-51/issue-51.test.ts b/tests/issues/issue-51/issue-51.test.ts index 24ec7aac..55f7b1d3 100644 --- a/tests/issues/issue-51/issue-51.test.ts +++ b/tests/issues/issue-51/issue-51.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle non-valid id', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle non-valid id', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-52/issue-52.test.ts b/tests/issues/issue-52/issue-52.test.ts index dec3e2ec..0cf91307 100644 --- a/tests/issues/issue-52/issue-52.test.ts +++ b/tests/issues/issue-52/issue-52.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle literal line', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle literal line', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-58/issue-58.test.ts b/tests/issues/issue-58/issue-58.test.ts index d15cd1ad..f71a09be 100644 --- a/tests/issues/issue-58/issue-58.test.ts +++ b/tests/issues/issue-58/issue-58.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should treat attribute interpolation using quotes properly', () => { - const { expected, actual } = compareFiles(__dirname); + it('should treat attribute interpolation using quotes properly', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-59/issue-59.test.ts b/tests/issues/issue-59/issue-59.test.ts index cbe0a597..8cadbefc 100644 --- a/tests/issues/issue-59/issue-59.test.ts +++ b/tests/issues/issue-59/issue-59.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not remove valid backslash escaping', () => { - const { expected, actual } = compareFiles(__dirname); + it('should not remove valid backslash escaping', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-61/issue-61.test.ts b/tests/issues/issue-61/issue-61.test.ts index e62b64ad..6e107716 100644 --- a/tests/issues/issue-61/issue-61.test.ts +++ b/tests/issues/issue-61/issue-61.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not wrap chained data-bindings', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not wrap chained data-bindings', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { semi: false, singleQuote: true, diff --git a/tests/issues/issue-63/issue-63.test.ts b/tests/issues/issue-63/issue-63.test.ts index b25411bb..a271bc08 100644 --- a/tests/issues/issue-63/issue-63.test.ts +++ b/tests/issues/issue-63/issue-63.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle id behind attribute with dot', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle id behind attribute with dot', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-65/issue-65.test.ts b/tests/issues/issue-65/issue-65.test.ts index b25411bb..a271bc08 100644 --- a/tests/issues/issue-65/issue-65.test.ts +++ b/tests/issues/issue-65/issue-65.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle id behind attribute with dot', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle id behind attribute with dot', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-67/formatted.pug b/tests/issues/issue-67/formatted.pug index bb073257..a7032642 100644 --- a/tests/issues/issue-67/formatted.pug +++ b/tests/issues/issue-67/formatted.pug @@ -1,2 +1,2 @@ -.foo([myAttribute]="{ param: 'hello {name}' | translate : { name: arg } }") +.foo([myAttribute]="{ param: 'hello {name}' | translate: { name: arg } }") .foo(*ngIf="myObjectAsync | async as myObject; else fallbackTemplate") diff --git a/tests/issues/issue-67/issue-67.test.ts b/tests/issues/issue-67/issue-67.test.ts index c41c358c..2055ec41 100644 --- a/tests/issues/issue-67/issue-67.test.ts +++ b/tests/issues/issue-67/issue-67.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle Angular expressions', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle Angular expressions', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-70/formatted.pug b/tests/issues/issue-70/formatted.pug index e1a9f68e..f92468fb 100644 --- a/tests/issues/issue-70/formatted.pug +++ b/tests/issues/issue-70/formatted.pug @@ -1,4 +1,4 @@ div - | {{ "foo" | baz : bar }} + | {{ "foo" | baz: bar }} .headline {{ $t("langkey", { id: `${model.id}` }) }} diff --git a/tests/issues/issue-70/issue-70.test.ts b/tests/issues/issue-70/issue-70.test.ts index c9fb9af6..aa324c35 100644 --- a/tests/issues/issue-70/issue-70.test.ts +++ b/tests/issues/issue-70/issue-70.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle angular framework interpolation', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle angular framework interpolation', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugFramework: 'angular' }, }); expect(actual).toBe(expected); diff --git a/tests/issues/issue-80/issue-80.test.ts b/tests/issues/issue-80/issue-80.test.ts index 3e421c96..fd4d8269 100644 --- a/tests/issues/issue-80/issue-80.test.ts +++ b/tests/issues/issue-80/issue-80.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should not reformat multiline interpolation strings', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not reformat multiline interpolation strings', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { semi: false, singleQuote: true, diff --git a/tests/issues/issue-85/issue-85.test.ts b/tests/issues/issue-85/issue-85.test.ts index 43001aa3..da360273 100644 --- a/tests/issues/issue-85/issue-85.test.ts +++ b/tests/issues/issue-85/issue-85.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle code interpolation', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle code interpolation', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-89/issue-89.test.ts b/tests/issues/issue-89/issue-89.test.ts index 12ec3d03..30068ac5 100644 --- a/tests/issues/issue-89/issue-89.test.ts +++ b/tests/issues/issue-89/issue-89.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should handle blank lines in multiline', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle blank lines in multiline', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/issues/issue-9/issue-9.test.ts b/tests/issues/issue-9/issue-9.test.ts index 41d5f15f..9346e614 100644 --- a/tests/issues/issue-9/issue-9.test.ts +++ b/tests/issues/issue-9/issue-9.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should escape quotes correctly in angular', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should escape quotes correctly in angular', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugFramework: 'angular', printWidth: 120, diff --git a/tests/issues/issue-95/issue-95.test.ts b/tests/issues/issue-95/issue-95.test.ts index b20acdab..1cd0198a 100644 --- a/tests/issues/issue-95/issue-95.test.ts +++ b/tests/issues/issue-95/issue-95.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Issues', () => { - it('should order classes and ids in correct manner', () => { - const { expected, actual } = compareFiles(__dirname); + it('should order classes and ids in correct manner', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/literals/class-literals/class-literals.test.ts b/tests/literals/class-literals/class-literals.test.ts index 7ce6d00e..7a235e3e 100644 --- a/tests/literals/class-literals/class-literals.test.ts +++ b/tests/literals/class-literals/class-literals.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Attributes', () => { - it('should handle class literals', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle class literals', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/literals/id-class-literals/id-class-literals.test.ts b/tests/literals/id-class-literals/id-class-literals.test.ts index 0b25e1f3..a5a4f185 100644 --- a/tests/literals/id-class-literals/id-class-literals.test.ts +++ b/tests/literals/id-class-literals/id-class-literals.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Attributes', () => { - it('should handle id and class literals combined', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle id and class literals combined', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/literals/id-literals/id-literals.test.ts b/tests/literals/id-literals/id-literals.test.ts index 042f2b7d..bbdc1978 100644 --- a/tests/literals/id-literals/id-literals.test.ts +++ b/tests/literals/id-literals/id-literals.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Attributes', () => { - it('should handle id literals', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle id literals', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/literals/matching-content/matching-content.test.ts b/tests/literals/matching-content/matching-content.test.ts index 403f4ce7..c7ebc0d4 100644 --- a/tests/literals/matching-content/matching-content.test.ts +++ b/tests/literals/matching-content/matching-content.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Attributes', () => { - it('should not replace matching literal strings in text content', () => { - const { expected, actual } = compareFiles(__dirname); + it('should not replace matching literal strings in text content', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/mixins/mixins.test.ts b/tests/mixins/mixins.test.ts index 7254d74d..89eeb242 100644 --- a/tests/mixins/mixins.test.ts +++ b/tests/mixins/mixins.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Mixins', () => { - it('should handle mixins', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle mixins', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/options/bracketSameLine/bracket-same-line.test.ts b/tests/options/bracketSameLine/bracket-same-line.test.ts index d1fac47e..417c449a 100644 --- a/tests/options/bracketSameLine/bracket-same-line.test.ts +++ b/tests/options/bracketSameLine/bracket-same-line.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('bracketSameLine', () => { - it('should handle bracketSameLine:true', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle bracketSameLine:true', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'same-line.pug', formatOptions: { bracketSameLine: true, @@ -13,8 +13,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should handle pugBracketSameLine:true', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle pugBracketSameLine:true', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'same-line.pug', formatOptions: { pugBracketSameLine: true, @@ -23,8 +23,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should handle bracketSameLine:false', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle bracketSameLine:false', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'new-line.pug', formatOptions: { bracketSameLine: false, @@ -33,8 +33,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should handle pugBracketSameLine:false', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle pugBracketSameLine:false', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'new-line.pug', formatOptions: { pugBracketSameLine: false, @@ -43,8 +43,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should handle default', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle default', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'new-line.pug', }); expect(actual).toBe(expected); diff --git a/tests/options/bracketSpacing/bracket-spacing.test.ts b/tests/options/bracketSpacing/bracket-spacing.test.ts index 531b33f5..54f66d18 100644 --- a/tests/options/bracketSpacing/bracket-spacing.test.ts +++ b/tests/options/bracketSpacing/bracket-spacing.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('bracketSpacing', () => { - it('should handle bracketSpacing', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle bracketSpacing', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { bracketSpacing: false, }, diff --git a/tests/options/emptyAttributes/empty-attributes.test.ts b/tests/options/emptyAttributes/empty-attributes.test.ts index 13195368..da8764f9 100644 --- a/tests/options/emptyAttributes/empty-attributes.test.ts +++ b/tests/options/emptyAttributes/empty-attributes.test.ts @@ -9,8 +9,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('emptyAttributes', () => { - it('should remove empty quotes and keep attributes starting with #', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should remove empty quotes and keep attributes starting with #', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugEmptyAttributes: 'none', pugEmptyAttributesForceQuotes: ['foo'], diff --git a/tests/options/printWidth/print-width.test.ts b/tests/options/printWidth/print-width.test.ts index 273d28d2..40c23b49 100644 --- a/tests/options/printWidth/print-width.test.ts +++ b/tests/options/printWidth/print-width.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('printWidth', () => { - it('should handle printWidth', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle printWidth', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { printWidth: 120, }, diff --git a/tests/options/pugAttributeSeparator/always/always.test.ts b/tests/options/pugAttributeSeparator/always/always.test.ts index 6a0c062d..b1a27b68 100644 --- a/tests/options/pugAttributeSeparator/always/always.test.ts +++ b/tests/options/pugAttributeSeparator/always/always.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugAttributeSeparator', () => { - it('should always insert commas between attributes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should always insert commas between attributes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { // The `.length-test` elements are tested against a `printWidth` of 80 (currently also the default): printWidth: 80, @@ -15,8 +15,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should always insert commas between attributes by default', () => { - const { actual, expected } = compareFiles(__dirname); + it('should always insert commas between attributes by default', async () => { + const { actual, expected } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/options/pugAttributeSeparator/as-needed/as-needed.test.ts b/tests/options/pugAttributeSeparator/as-needed/as-needed.test.ts index b7d5720a..30fdb5c9 100644 --- a/tests/options/pugAttributeSeparator/as-needed/as-needed.test.ts +++ b/tests/options/pugAttributeSeparator/as-needed/as-needed.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugAttributeSeparator', () => { - it('should insert commas between attributes as-needed', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should insert commas between attributes as-needed', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { // The `.length-test` elements are tested against a `printWidth` of 80 (currently also the default): printWidth: 80, diff --git a/tests/options/pugAttributeSeparator/none/none.test.ts b/tests/options/pugAttributeSeparator/none/none.test.ts index 254f9920..622a6820 100644 --- a/tests/options/pugAttributeSeparator/none/none.test.ts +++ b/tests/options/pugAttributeSeparator/none/none.test.ts @@ -4,8 +4,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugAttributeSeparator', () => { - it('should never insert commas between attributes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should never insert commas between attributes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { // The `.length-test` elements are tested against a `printWidth` of 80 (currently also the default): printWidth: 80, @@ -16,8 +16,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it("should work with 'none' option and angular syntax, but produce invalid output", () => { - const { actual, expected } = compareFiles(__dirname, { + it("should work with 'none' option and angular syntax, but produce invalid output", async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'angular-unformatted.pug', target: 'angular-formatted.pug', formatOptions: { @@ -27,7 +27,7 @@ describe('Options', () => { expect(actual).toBe(expected); expect(() => { // ts-jest needs the exclamation mark, so it does not have the impression that the variables are undefined - parsers!.pug!.parse(actual, parsers!, null!); + parsers!.pug!.parse(actual, null!); }).toThrow('Assigning to rvalue'); }); }); diff --git a/tests/options/pugClassLocation/pug-class-location.test.ts b/tests/options/pugClassLocation/pug-class-location.test.ts index aa0c385a..a6a9de95 100644 --- a/tests/options/pugClassLocation/pug-class-location.test.ts +++ b/tests/options/pugClassLocation/pug-class-location.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugClassLocation', () => { - it('should position class literals before attributes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should position class literals before attributes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-before.pug', formatOptions: { pugClassLocation: 'before-attributes', @@ -13,8 +13,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should position class literals after attributes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should position class literals after attributes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-after.pug', formatOptions: { pugClassLocation: 'after-attributes', diff --git a/tests/options/pugClassNotation/pug-class-notation.test.ts b/tests/options/pugClassNotation/pug-class-notation.test.ts index f8c359ad..ea76a6df 100644 --- a/tests/options/pugClassNotation/pug-class-notation.test.ts +++ b/tests/options/pugClassNotation/pug-class-notation.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugClassNotation', () => { - it('should keep classes as is', () => { - const { actual, code } = compareFiles(__dirname, { + it('should keep classes as is', async () => { + const { actual, code } = await compareFiles(import.meta.url, { target: null, formatOptions: { pugClassNotation: 'as-is', @@ -13,8 +13,8 @@ describe('Options', () => { expect(actual).toBe(code); }); - it('should keep classes as literals', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should keep classes as literals', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-literal.pug', formatOptions: { pugClassNotation: 'literal', @@ -23,8 +23,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should keep classes as attributes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should keep classes as attributes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-attribute.pug', formatOptions: { pugClassNotation: 'attribute', @@ -33,8 +33,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should keep classes as literals by default', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should keep classes as literals by default', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { target: 'formatted-literal.pug', }); expect(actual).toBe(expected); diff --git a/tests/options/pugCommentPreserveSpaces/keep-all/keep-all.test.ts b/tests/options/pugCommentPreserveSpaces/keep-all/keep-all.test.ts index 08405fa3..f1202dde 100644 --- a/tests/options/pugCommentPreserveSpaces/keep-all/keep-all.test.ts +++ b/tests/options/pugCommentPreserveSpaces/keep-all/keep-all.test.ts @@ -1,9 +1,12 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import { format } from 'prettier'; import { plugin } from 'src/index'; import { describe, expect, it } from 'vitest'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + describe('Options', () => { describe('pugCommentPreserveSpaces', () => { const expected: string = readFileSync( @@ -15,8 +18,8 @@ describe('Options', () => { 'utf8', ); - it('should keep all spaces within comments', () => { - const actual: string = format(code, { + it('should keep all spaces within comments', async () => { + const actual: string = await format(code, { parser: 'pug', plugins: [plugin], @@ -26,8 +29,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should keep all spaces within comments by default', () => { - const actual: string = format(code, { + it('should keep all spaces within comments by default', async () => { + const actual: string = await format(code, { parser: 'pug', plugins: [plugin], }); diff --git a/tests/options/pugCommentPreserveSpaces/keep-leading/keep-leading.test.ts b/tests/options/pugCommentPreserveSpaces/keep-leading/keep-leading.test.ts index 7e1887dd..48c26534 100644 --- a/tests/options/pugCommentPreserveSpaces/keep-leading/keep-leading.test.ts +++ b/tests/options/pugCommentPreserveSpaces/keep-leading/keep-leading.test.ts @@ -1,9 +1,12 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import { format } from 'prettier'; import { plugin } from 'src/index'; import { describe, expect, it } from 'vitest'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + describe('Options', () => { describe('pugCommentPreserveSpaces', () => { const expected: string = readFileSync( @@ -15,8 +18,8 @@ describe('Options', () => { 'utf8', ); - it('should keep leading spaces within comments', () => { - const actual: string = format(code, { + it('should keep leading spaces within comments', async () => { + const actual: string = await format(code, { parser: 'pug', plugins: [plugin], diff --git a/tests/options/pugCommentPreserveSpaces/trim-all/trim-all.test.ts b/tests/options/pugCommentPreserveSpaces/trim-all/trim-all.test.ts index 1af6d3f0..09cc47e7 100644 --- a/tests/options/pugCommentPreserveSpaces/trim-all/trim-all.test.ts +++ b/tests/options/pugCommentPreserveSpaces/trim-all/trim-all.test.ts @@ -1,9 +1,12 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import { format } from 'prettier'; import { plugin } from 'src/index'; import { describe, expect, it } from 'vitest'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + describe('Options', () => { describe('pugCommentPreserveSpaces', () => { const expected: string = readFileSync( @@ -14,8 +17,9 @@ describe('Options', () => { resolve(__dirname, 'unformatted.pug'), 'utf8', ); - it('should trim all spaces within comments', () => { - const actual: string = format(code, { + + it('should trim all spaces within comments', async () => { + const actual: string = await format(code, { parser: 'pug', plugins: [plugin], diff --git a/tests/options/pugExplicitDiv/pug-explicit-div.test.ts b/tests/options/pugExplicitDiv/pug-explicit-div.test.ts index f0917276..3ce6d70f 100644 --- a/tests/options/pugExplicitDiv/pug-explicit-div.test.ts +++ b/tests/options/pugExplicitDiv/pug-explicit-div.test.ts @@ -1,10 +1,13 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import type { Options } from 'prettier'; import { format } from 'prettier'; import { plugin } from 'src/index'; import { describe, expect, it } from 'vitest'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + describe('Options', () => { describe('pugExplicitDiv', () => { const code: string = readFileSync( @@ -21,24 +24,24 @@ describe('Options', () => { pugPrintWidth: 80, }; - it('should handle unspecified pugExplicitDiv', () => { + it('should handle unspecified pugExplicitDiv', async () => { const expected: string = readFileSync( resolve(__dirname, 'formatted-implicit-div.pug'), 'utf8', ); - const actual: string = format(code, { + const actual: string = await format(code, { ...commonOptions, }); expect(actual).toBe(expected); }); - it('should handle pugExplicitDiv:false', () => { + it('should handle pugExplicitDiv:false', async () => { const expected: string = readFileSync( resolve(__dirname, 'formatted-implicit-div.pug'), 'utf8', ); - const actual: string = format(code, { + const actual: string = await format(code, { ...commonOptions, pugExplicitDiv: false, @@ -47,12 +50,12 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should handle pugExplicitDiv:true', () => { + it('should handle pugExplicitDiv:true', async () => { const expected: string = readFileSync( resolve(__dirname, 'formatted-explicit-div.pug'), 'utf8', ); - const actual: string = format(code, { + const actual: string = await format(code, { ...commonOptions, pugExplicitDiv: true, diff --git a/tests/options/pugIdNotation/pug-id-notation.test.ts b/tests/options/pugIdNotation/pug-id-notation.test.ts index b44dbfbc..1123c314 100644 --- a/tests/options/pugIdNotation/pug-id-notation.test.ts +++ b/tests/options/pugIdNotation/pug-id-notation.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('useIdLiterals', () => { - it('should keep classes as is', () => { - const { actual, code } = compareFiles(__dirname, { + it('should keep classes as is', async () => { + const { actual, code } = await compareFiles(import.meta.url, { source: 'formatted-attribute.pug', target: null, formatOptions: { @@ -14,8 +14,8 @@ describe('Options', () => { expect(actual).toBe(code); }); - it('should keep classes as literals', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should keep classes as literals', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'formatted-attribute.pug', target: 'formatted-literal.pug', formatOptions: { @@ -25,8 +25,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should keep classes as literals by default', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should keep classes as literals by default', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'formatted-attribute.pug', target: 'formatted-literal.pug', }); diff --git a/tests/options/pugPreserveAttributeBrackets/pug-preserve-attribute-brackets.test.ts b/tests/options/pugPreserveAttributeBrackets/pug-preserve-attribute-brackets.test.ts index 213e6f52..1c913dec 100644 --- a/tests/options/pugPreserveAttributeBrackets/pug-preserve-attribute-brackets.test.ts +++ b/tests/options/pugPreserveAttributeBrackets/pug-preserve-attribute-brackets.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugPreserveAttributeBrackets', () => { - it('should preserve attribute brackets', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should preserve attribute brackets', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.pug', target: 'formatted-true.pug', formatOptions: { @@ -14,8 +14,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not preserve attribute brackets', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not preserve attribute brackets', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.pug', target: 'formatted-false.pug', formatOptions: { @@ -25,8 +25,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not preserve attribute brackets by default', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not preserve attribute brackets by default', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'unformatted.pug', target: 'formatted-false.pug', }); diff --git a/tests/options/pugTemplateTagIndentation/pug-template-tag-indentation.test.ts b/tests/options/pugTemplateTagIndentation/pug-template-tag-indentation.test.ts index d3238860..27f51f47 100644 --- a/tests/options/pugTemplateTagIndentation/pug-template-tag-indentation.test.ts +++ b/tests/options/pugTemplateTagIndentation/pug-template-tag-indentation.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugSingleFileComponentIndentation', () => { - it('should indent', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'not-indented.vue', target: 'indented.vue', formatOptions: { @@ -16,8 +16,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not indent', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not indent', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'indented.vue', target: 'not-indented.vue', formatOptions: { @@ -29,8 +29,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not indent by default', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not indent by default', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'indented.vue', target: 'not-indented.vue', formatOptions: { @@ -40,8 +40,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not affect markdown', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not affect markdown', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'not-indented.md', target: 'not-indented.md', formatOptions: { @@ -53,8 +53,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not change two-div-not-indented-flat', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not change two-div-not-indented-flat', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'two-div-not-indented-flat.vue', target: 'two-div-not-indented-flat.vue', formatOptions: { @@ -64,8 +64,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not change two-div-not-indented-tree', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not change two-div-not-indented-tree', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'two-div-not-indented-tree.vue', target: 'two-div-not-indented-tree.vue', formatOptions: { @@ -75,8 +75,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not change two-div-indented-flat', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not change two-div-indented-flat', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'two-div-indented-flat.vue', target: 'two-div-indented-flat.vue', formatOptions: { @@ -88,8 +88,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not change two-div-indented-tree', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not change two-div-indented-tree', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'two-div-indented-tree.vue', target: 'two-div-indented-tree.vue', formatOptions: { @@ -101,8 +101,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should indent two-div-not-indented-flat', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent two-div-not-indented-flat', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'two-div-not-indented-flat.vue', target: 'two-div-indented-flat.vue', formatOptions: { @@ -114,8 +114,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should indent two-div-not-indented-tree', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should indent two-div-not-indented-tree', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'two-div-not-indented-tree.vue', target: 'two-div-indented-tree.vue', formatOptions: { @@ -127,8 +127,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not indent two-div-indented-flat', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not indent two-div-indented-flat', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'two-div-indented-flat.vue', target: 'two-div-not-indented-flat.vue', formatOptions: { @@ -138,8 +138,8 @@ describe('Options', () => { expect(actual).toBe(expected); }); - it('should not indent two-div-indented-tree', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not indent two-div-indented-tree', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'two-div-indented-tree.vue', target: 'two-div-not-indented-tree.vue', formatOptions: { diff --git a/tests/options/pugWrapAttributesPattern/wrap-attributes-pattern.test.ts b/tests/options/pugWrapAttributesPattern/wrap-attributes-pattern.test.ts index aca04c73..f6aeda0e 100644 --- a/tests/options/pugWrapAttributesPattern/wrap-attributes-pattern.test.ts +++ b/tests/options/pugWrapAttributesPattern/wrap-attributes-pattern.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugWrapAttributesPattern', () => { - it('should always wrap elements with attributes matching provided pattern', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should always wrap elements with attributes matching provided pattern', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugWrapAttributesPattern: '^v-(if|else|for)' }, }); diff --git a/tests/options/pugWrapAttributesThreshold/0/0.test.ts b/tests/options/pugWrapAttributesThreshold/0/0.test.ts index 1b323c7f..9d3bd971 100644 --- a/tests/options/pugWrapAttributesThreshold/0/0.test.ts +++ b/tests/options/pugWrapAttributesThreshold/0/0.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugWrapAttributesThreshold', () => { - it('should never allow an attribute without being wrapped', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should never allow an attribute without being wrapped', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugWrapAttributesThreshold: 0 }, }); diff --git a/tests/options/pugWrapAttributesThreshold/1/1.test.ts b/tests/options/pugWrapAttributesThreshold/1/1.test.ts index ca85fe30..84ab5aa2 100644 --- a/tests/options/pugWrapAttributesThreshold/1/1.test.ts +++ b/tests/options/pugWrapAttributesThreshold/1/1.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugWrapAttributesThreshold', () => { - it('should not allow more than one attribute as one-liner', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not allow more than one attribute as one-liner', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugWrapAttributesThreshold: 1 }, }); diff --git a/tests/options/pugWrapAttributesThreshold/2/2.test.ts b/tests/options/pugWrapAttributesThreshold/2/2.test.ts index 125d46b0..79d689ac 100644 --- a/tests/options/pugWrapAttributesThreshold/2/2.test.ts +++ b/tests/options/pugWrapAttributesThreshold/2/2.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugWrapAttributesThreshold', () => { - it('should not allow more than two attributes as one-liner', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not allow more than two attributes as one-liner', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugWrapAttributesThreshold: 2 }, }); diff --git a/tests/options/pugWrapAttributesThreshold/default/default.test.ts b/tests/options/pugWrapAttributesThreshold/default/default.test.ts index da3cc3d1..5cd3df01 100644 --- a/tests/options/pugWrapAttributesThreshold/default/default.test.ts +++ b/tests/options/pugWrapAttributesThreshold/default/default.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('pugWrapAttributesThreshold', () => { - it('should not restrict the amount of attributes as one-liner', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not restrict the amount of attributes as one-liner', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugWrapAttributesThreshold: -1 }, }); diff --git a/tests/options/semi/semi.test.ts b/tests/options/semi/semi.test.ts index dfe91d3b..713801dd 100644 --- a/tests/options/semi/semi.test.ts +++ b/tests/options/semi/semi.test.ts @@ -1,4 +1,3 @@ -import { join } from 'node:path'; import type { CompareFilesOptions } from 'tests/common'; import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; @@ -11,13 +10,14 @@ describe('semi handling', () => { ['none', 'none'], ] as const)( 'should format script tags with %s inline code to %s', - (from, to) => { - const fixturesPath: string = join(__dirname, `${from}-${to}`); + async (from, to) => { const options: CompareFilesOptions = { + source: `${from}-${to}/unformatted.pug`, + target: `${from}-${to}/formatted.pug`, formatOptions: { semi: to === 'semi' }, }; - const { expected, actual } = compareFiles(fixturesPath, options); + const { expected, actual } = await compareFiles(import.meta.url, options); expect(actual).toBe(expected); }, diff --git a/tests/options/singleQuote/single-false-pug-false/single-false-pug-false.test.ts b/tests/options/singleQuote/single-false-pug-false/single-false-pug-false.test.ts index 4c29bb7d..683aa8d5 100644 --- a/tests/options/singleQuote/single-false-pug-false/single-false-pug-false.test.ts +++ b/tests/options/singleQuote/single-false-pug-false/single-false-pug-false.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('singleQuote', () => { - it('should handle singleQuote:false + pugSingleQuote:false', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle singleQuote:false + pugSingleQuote:false', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: false, pugSingleQuote: false, diff --git a/tests/options/singleQuote/single-false-pug-true/single-false-pug-true.test.ts b/tests/options/singleQuote/single-false-pug-true/single-false-pug-true.test.ts index 4a072bf7..d9a4b1d9 100644 --- a/tests/options/singleQuote/single-false-pug-true/single-false-pug-true.test.ts +++ b/tests/options/singleQuote/single-false-pug-true/single-false-pug-true.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('singleQuote', () => { - it('should handle singleQuote:false + pugSingleQuote:true', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle singleQuote:false + pugSingleQuote:true', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: false, pugSingleQuote: true, diff --git a/tests/options/singleQuote/single-false/single-false.test.ts b/tests/options/singleQuote/single-false/single-false.test.ts index 723b452b..5051316d 100644 --- a/tests/options/singleQuote/single-false/single-false.test.ts +++ b/tests/options/singleQuote/single-false/single-false.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('singleQuote', () => { - it('should handle singleQuote:false', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle singleQuote:false', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: false }, }); diff --git a/tests/options/singleQuote/single-true-pug-false/single-true-pug-false.test.ts b/tests/options/singleQuote/single-true-pug-false/single-true-pug-false.test.ts index 05505f5b..3d12379d 100644 --- a/tests/options/singleQuote/single-true-pug-false/single-true-pug-false.test.ts +++ b/tests/options/singleQuote/single-true-pug-false/single-true-pug-false.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('singleQuote', () => { - it('should handle singleQuote:true + pugSingleQuote:false', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle singleQuote:true + pugSingleQuote:false', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: true, pugSingleQuote: false, diff --git a/tests/options/singleQuote/single-true-pug-true/single-true-pug-true.test.ts b/tests/options/singleQuote/single-true-pug-true/single-true-pug-true.test.ts index 1e0fd54f..ea598898 100644 --- a/tests/options/singleQuote/single-true-pug-true/single-true-pug-true.test.ts +++ b/tests/options/singleQuote/single-true-pug-true/single-true-pug-true.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('singleQuote', () => { - it('should handle singleQuote:true + pugSingleQuote:true', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle singleQuote:true + pugSingleQuote:true', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: true, pugSingleQuote: true, diff --git a/tests/options/singleQuote/single-true/single-true.test.ts b/tests/options/singleQuote/single-true/single-true.test.ts index a6e80da5..07a0aefa 100644 --- a/tests/options/singleQuote/single-true/single-true.test.ts +++ b/tests/options/singleQuote/single-true/single-true.test.ts @@ -3,8 +3,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('singleQuote', () => { - it('should handle singleQuote:true', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should handle singleQuote:true', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: true }, }); diff --git a/tests/options/sortAttributes/sort-attributes.test.ts b/tests/options/sortAttributes/sort-attributes.test.ts index a59624da..7a800bf9 100644 --- a/tests/options/sortAttributes/sort-attributes.test.ts +++ b/tests/options/sortAttributes/sort-attributes.test.ts @@ -8,8 +8,8 @@ import { describe, expect, it } from 'vitest'; describe('Options', () => { describe('sortAttributes', () => { - it('should sort attributes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should sort attributes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { pugSortAttributesBeginning: ['v-for', ':key', 'src', 'alt'], pugSortAttributesEnd: ['@click'], diff --git a/tests/plain-text/plain-text.test.ts b/tests/plain-text/plain-text.test.ts index e744017f..8be07847 100644 --- a/tests/plain-text/plain-text.test.ts +++ b/tests/plain-text/plain-text.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Text-Html', () => { - it('should handle plain-text at after outdent', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle plain-text at after outdent', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/pragma/detect-pragma/detect-pragma.test.ts b/tests/pragma/detect-pragma/detect-pragma.test.ts index 2d4cbefa..acdd4cd0 100644 --- a/tests/pragma/detect-pragma/detect-pragma.test.ts +++ b/tests/pragma/detect-pragma/detect-pragma.test.ts @@ -1,9 +1,12 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import type { Parser } from 'prettier'; import { parsers } from 'src/index'; import { describe, expect, it } from 'vitest'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + // ts-jest needs the exclamation mark, so it does not have the impression that the variables are undefined const pugParser: Parser = parsers!.pug!; diff --git a/tests/pragma/insert-pragma/insert-pragma.test.ts b/tests/pragma/insert-pragma/insert-pragma.test.ts index 517f05a6..65368e4d 100644 --- a/tests/pragma/insert-pragma/insert-pragma.test.ts +++ b/tests/pragma/insert-pragma/insert-pragma.test.ts @@ -4,8 +4,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Pragma', () => { - it('should insert pragma if option is set', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should insert pragma if option is set', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'no-pragma.pug', target: 'with-pragma.pug', formatOptions: { @@ -16,8 +16,8 @@ describe('Pragma', () => { expect(actual).toBe(expected); }); - it('should not insert multiple pragma if option is set', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not insert multiple pragma if option is set', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'no-pragma.pug', target: 'with-pragma.pug', formatOptions: { @@ -25,7 +25,7 @@ describe('Pragma', () => { bracketSpacing: false, }, }); - const actualSecondRun: string = format(actual, { + const actualSecondRun: string = await format(actual, { parser: 'pug', plugins: [plugin], @@ -35,8 +35,8 @@ describe('Pragma', () => { expect(actualSecondRun).toBe(expected); }); - it('should not insert pragma if option is not set', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should not insert pragma if option is not set', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { source: 'no-pragma.pug', target: 'no-pragma.pug', formatOptions: { diff --git a/tests/prettier-ignore/prettier-ignore.test.ts b/tests/prettier-ignore/prettier-ignore.test.ts index d5c1a8ce..5551df0f 100644 --- a/tests/prettier-ignore/prettier-ignore.test.ts +++ b/tests/prettier-ignore/prettier-ignore.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('prettier-ignore', () => { - it('should handle // prettier-ignore statements', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle // prettier-ignore statements', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/pug-tests/pug.test.ts b/tests/pug-tests/pug.test.ts index 99c1b6b5..2fd74371 100644 --- a/tests/pug-tests/pug.test.ts +++ b/tests/pug-tests/pug.test.ts @@ -1,9 +1,12 @@ import { readdirSync, readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { fileURLToPath, URL } from 'node:url'; import { format } from 'prettier'; import { plugin } from 'src/index'; import { describe, expect, it } from 'vitest'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + describe('Pug Tests', () => { const filenames: string[] = readdirSync(resolve(__dirname), 'utf8'); @@ -30,7 +33,7 @@ describe('Pug Tests', () => { if (filename.endsWith('.formatted.pug')) { const unformattedFilename: string = filename.replace('.formatted', ''); if (!ignores.includes(unformattedFilename)) { - it(unformattedFilename, () => { + it(unformattedFilename, async () => { const expected: string = readFileSync( resolve(__dirname, filename), 'utf8', @@ -39,7 +42,7 @@ describe('Pug Tests', () => { resolve(__dirname, unformattedFilename), 'utf8', ); - const actual: string = format(code, { + const actual: string = await format(code, { parser: 'pug', plugins: [plugin], }); diff --git a/tests/quotes/double-to-single/double-to-single.test.ts b/tests/quotes/double-to-single/double-to-single.test.ts index d97426c9..f67d3f04 100644 --- a/tests/quotes/double-to-single/double-to-single.test.ts +++ b/tests/quotes/double-to-single/double-to-single.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Quotes', () => { - it('should format double to single quotes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format double to single quotes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: true, }, diff --git a/tests/quotes/single-to-double/single-to-double-quotes.test.ts b/tests/quotes/single-to-double/single-to-double-quotes.test.ts index a2675633..b991f09a 100644 --- a/tests/quotes/single-to-double/single-to-double-quotes.test.ts +++ b/tests/quotes/single-to-double/single-to-double-quotes.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Quotes', () => { - it('should format single to double quotes', () => { - const { actual, expected } = compareFiles(__dirname, { + it('should format single to double quotes', async () => { + const { actual, expected } = await compareFiles(import.meta.url, { formatOptions: { singleQuote: false, }, @@ -11,8 +11,8 @@ describe('Quotes', () => { expect(actual).toBe(expected); }); - it('should use double quotes by default', () => { - const { expected, actual } = compareFiles(__dirname); + it('should use double quotes by default', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/slash/slash.test.ts b/tests/slash/slash.test.ts index 10e3d074..31987cc1 100644 --- a/tests/slash/slash.test.ts +++ b/tests/slash/slash.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Slash', () => { - it('should handle slash token', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle slash token', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/spaces/spaces.test.ts b/tests/spaces/spaces.test.ts index 3f8fe0b8..39f7907c 100644 --- a/tests/spaces/spaces.test.ts +++ b/tests/spaces/spaces.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Spaces', () => { - it('should strip spaces', () => { - const { expected, actual } = compareFiles(__dirname); + it('should strip spaces', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/syntax-errors/syntax-errors.test.ts b/tests/syntax-errors/syntax-errors.test.ts index 62138e50..b5292fcf 100644 --- a/tests/syntax-errors/syntax-errors.test.ts +++ b/tests/syntax-errors/syntax-errors.test.ts @@ -1,37 +1,40 @@ import { readFileSync } from 'node:fs'; import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import { format } from 'prettier'; import { plugin } from 'src/index'; import { describe, expect, it } from 'vitest'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + describe('Syntax-Errors', () => { - it('should not format if attributes is not closed', () => { + it('should not format if attributes is not closed', async () => { const code: string = readFileSync( resolve(__dirname, 'attributes-not-closed.pug'), 'utf8', ); - expect(() => { - format(code, { parser: 'pug', plugins: [plugin] }); - }).toThrow(); + await expect( + format(code, { parser: 'pug', plugins: [plugin] }), + ).rejects.toThrow(); }); - it('should not format if pipeless script tag has syntax error', () => { + it('should not format if pipeless script tag has syntax error', async () => { const code: string = readFileSync( resolve(__dirname, 'pipeless-script-tag.pug'), 'utf8', ); - expect(() => { - format(code, { parser: 'pug', plugins: [plugin] }); - }).toThrow(); + await expect( + format(code, { parser: 'pug', plugins: [plugin] }), + ).rejects.toThrow(); }); - it('should format non-JS script without syntax error', () => { + it('should format non-JS script without syntax error', async () => { const code: string = readFileSync( resolve(__dirname, 'scripts-with-non-js-contents.pug'), 'utf8', ); - expect(() => { - format(code, { parser: 'pug', plugins: [plugin] }); - }).not.toThrow(); + await expect( + format(code, { parser: 'pug', plugins: [plugin] }), + ).resolves.not.toThrow(); }); }); diff --git a/tests/text-html/text-html.test.ts b/tests/text-html/text-html.test.ts index d76a567b..356cdc40 100644 --- a/tests/text-html/text-html.test.ts +++ b/tests/text-html/text-html.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Text-Html', () => { - it('should handle text-html token', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle text-html token', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tests/yield/yield.test.ts b/tests/yield/yield.test.ts index 4bd0ea97..5725f284 100644 --- a/tests/yield/yield.test.ts +++ b/tests/yield/yield.test.ts @@ -2,8 +2,8 @@ import { compareFiles } from 'tests/common'; import { describe, expect, it } from 'vitest'; describe('Yield', () => { - it('should handle yield token', () => { - const { expected, actual } = compareFiles(__dirname); + it('should handle yield token', async () => { + const { expected, actual } = await compareFiles(import.meta.url); expect(actual).toBe(expected); }); }); diff --git a/tsconfig.build.json b/tsconfig.build.json deleted file mode 100644 index 666ed67d..00000000 --- a/tsconfig.build.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "extends": "./tsconfig.json", - "compilerOptions": { - "target": "ES2022", - "noEmit": false, - "inlineSourceMap": true, - "rootDir": "src", - "outDir": "dist" - }, - "include": ["src"] -} diff --git a/tsconfig.json b/tsconfig.json index e7526692..d9a4bc82 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,8 +1,8 @@ { "compilerOptions": { "target": "ES2022", - "module": "CommonJS", - "moduleResolution": "node", + "module": "ESNext", + "moduleResolution": "Node", "strict": true, "noEmit": true, "esModuleInterop": true, diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 00000000..a9b5bd63 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,12 @@ +import { defineConfig } from 'tsup'; + +export default defineConfig({ + entry: ['src/index.ts'], + outDir: 'dist', + clean: true, + format: 'esm', + target: 'node16', + dts: true, + minify: true, + sourcemap: true, +}); diff --git a/vite.config.ts b/vite.config.ts index d1f9f4cf..e15ddf48 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,7 +1,10 @@ /// import { resolve } from 'node:path'; +import { URL, fileURLToPath } from 'node:url'; import { defineConfig } from 'vite'; +const __dirname: string = fileURLToPath(new URL('.', import.meta.url)); + export default defineConfig({ resolve: { alias: {