From 70d60c7ab20268faf426dfe47f3ac857519b0a5d Mon Sep 17 00:00:00 2001 From: Teffen Ellis <592134+GirlBossRush@users.noreply.github.com> Date: Sat, 3 May 2025 01:48:19 +0200 Subject: [PATCH] web: Use monorepo package utilities to build packages (#14159) * web: Format live reload package. * web: Format package.json. * web: Revise globals. * web: Build entrypoints with a single ESBuild context. Clean up entrypoints. * web: WIP Prepare monorepo package for use. * web: Update build paths. Fix types. * web: WIP Add monorepo dependency. * web: Use monorepo utilities when building. * web: Fix issue where linters collide. Update ignore file. - Remove unused sort override for polyfills. * core: Prepare repo for NPM workspaces. --- .vscode/settings.json | 6 +- package-lock.json | 538 +++++++++++- package.json | 12 +- packages/monorepo/package.json | 19 - packages/monorepo/paths.js | 30 - packages/monorepo/scripts.js | 0 tsconfig.json | 28 + web/.prettierignore | 6 +- web/package-lock.json | 777 ++++++------------ web/package.json | 111 ++- .../esbuild-plugin-live-reload/package.json | 50 +- .../packages}/monorepo/LICENSE.txt | 0 {packages => web/packages}/monorepo/README.md | 1 - web/packages/monorepo/build.js | 42 + .../packages}/monorepo/constants.js | 7 +- {packages => web/packages}/monorepo/index.js | 3 + web/packages/monorepo/package.json | 28 + web/packages/monorepo/paths.js | 45 + .../packages}/monorepo/scripting.js | 0 .../packages}/monorepo/tsconfig.json | 0 web/packages/monorepo/types/global.d.ts | 15 + .../packages}/monorepo/version.js | 2 +- web/paths.js | 78 ++ web/scripts/build-web.mjs | 313 +++---- ...{AdminInterface.ts => index.entrypoint.ts} | 0 web/src/admin/AdminInterface/index.ts | 5 - web/src/admin/users/UserListPage.ts | 2 +- web/src/elements/sidebar/SidebarVersion.ts | 2 +- .../{FlowInterface.ts => index.entrypoint.ts} | 0 .../polyfill/{poly.ts => index.entrypoint.ts} | 1 + web/src/rac/{index.ts => index.entrypoint.ts} | 0 .../{index.ts => index.entrypoint.ts} | 0 .../loading/{index.ts => index.entrypoint.ts} | 0 web/src/user/LibraryApplication/index.ts | 2 +- .../{UserInterface.ts => index.entrypoint.ts} | 0 .../user/user-settings/UserSettingsPage.ts | 2 +- web/tsconfig.json | 2 +- web/types/global.d.ts | 24 +- 38 files changed, 1271 insertions(+), 880 deletions(-) delete mode 100644 packages/monorepo/package.json delete mode 100644 packages/monorepo/paths.js delete mode 100644 packages/monorepo/scripts.js create mode 100644 tsconfig.json rename {packages => web/packages}/monorepo/LICENSE.txt (100%) rename {packages => web/packages}/monorepo/README.md (99%) create mode 100644 web/packages/monorepo/build.js rename {packages => web/packages}/monorepo/constants.js (73%) rename {packages => web/packages}/monorepo/index.js (62%) create mode 100644 web/packages/monorepo/package.json create mode 100644 web/packages/monorepo/paths.js rename {packages => web/packages}/monorepo/scripting.js (100%) rename {packages => web/packages}/monorepo/tsconfig.json (100%) create mode 100644 web/packages/monorepo/types/global.d.ts rename {packages => web/packages}/monorepo/version.js (94%) create mode 100644 web/paths.js rename web/src/admin/AdminInterface/{AdminInterface.ts => index.entrypoint.ts} (100%) delete mode 100644 web/src/admin/AdminInterface/index.ts rename web/src/flow/{FlowInterface.ts => index.entrypoint.ts} (100%) rename web/src/polyfill/{poly.ts => index.entrypoint.ts} (91%) rename web/src/rac/{index.ts => index.entrypoint.ts} (100%) rename web/src/standalone/api-browser/{index.ts => index.entrypoint.ts} (100%) rename web/src/standalone/loading/{index.ts => index.entrypoint.ts} (100%) rename web/src/user/{UserInterface.ts => index.entrypoint.ts} (100%) diff --git a/.vscode/settings.json b/.vscode/settings.json index ea2be46bbd..dd2951f869 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -16,7 +16,7 @@ ], "typescript.preferences.importModuleSpecifier": "non-relative", "typescript.preferences.importModuleSpecifierEnding": "index", - "typescript.tsdk": "./web/node_modules/typescript/lib", + "typescript.tsdk": "./node_modules/typescript/lib", "typescript.enablePromptUseWorkspaceTsdk": true, "yaml.schemas": { "./blueprints/schema.json": "blueprints/**/*.yaml" @@ -30,7 +30,5 @@ } ], "go.testFlags": ["-count=1"], - "github-actions.workflows.pinned.workflows": [ - ".github/workflows/ci-main.yml" - ] + "github-actions.workflows.pinned.workflows": [".github/workflows/ci-main.yml"] } diff --git a/package-lock.json b/package-lock.json index 1196020e4e..f9ac40756c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,546 @@ { "name": "@goauthentik/authentik", - "version": "2025.2.1", + "version": "2025.4.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@goauthentik/authentik", - "version": "2025.2.1" + "version": "2025.4.0", + "devDependencies": { + "@trivago/prettier-plugin-sort-imports": "^5.2.2", + "prettier": "^3.3.3", + "prettier-plugin-organize-imports": "^4.1.0", + "prettier-plugin-packagejson": "^2.5.10", + "typescript": "^5.6.2" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.26.2", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.26.2.tgz", + "integrity": "sha512-RJlIHRueQgwWitWgF8OdFYGZX328Ax5BCemNGlqHfplnRT9ESi8JkFlvaVYbS+UubVY6dpv87Fs2u5M29iNFVQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.25.9", + "js-tokens": "^4.0.0", + "picocolors": "^1.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.27.0.tgz", + "integrity": "sha512-VybsKvpiN1gU1sdMZIp7FcqphVVKEwcuj02x73uvcHE0PTihx1nlBcowYWhDwjpoAXRv43+gDzyggGnn1XZhVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0", + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.25", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.25.9.tgz", + "integrity": "sha512-4A/SCr/2KLd5jrtOMFzaKjVtAei3+2r/NChoBNoZ3EyP/+GlhoaEGoWOZUmFmoITP7zOJyHIMm+DYRd8o3PvHA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.25.9", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.25.9.tgz", + "integrity": "sha512-Ed61U6XJc3CVRfkERJWDz4dJwKe7iLmmJsbOGu9wSloNSFttHV0I8g6UAgb7qnK5ly5bGLPd4oXZlxCdANBOWQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.27.0.tgz", + "integrity": "sha512-iaepho73/2Pz7w2eMS0Q5f83+0RKI7i4xmiYeBmDzfRVbQtTOG7Ts0S4HzJVsTMGI9keU8rNfuZr8DKfSt7Yyg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.27.0" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.27.0.tgz", + "integrity": "sha512-2ncevenBqXI6qRMukPlXwHKHchC7RyMuu4xv5JBXRfOGVcTy1mXCD12qrp7Jsoxll1EV3+9sE4GugBVRjT2jFA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/parser": "^7.27.0", + "@babel/types": "^7.27.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.27.0.tgz", + "integrity": "sha512-19lYZFzYVQkkHkl4Cy4WrAVcqBkgvV2YM2TU3xG6DIwO7O3ecbDPfW3yM3bjAGcqcQHi+CCtjMR3dIEHxsd6bA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.26.2", + "@babel/generator": "^7.27.0", + "@babel/parser": "^7.27.0", + "@babel/template": "^7.27.0", + "@babel/types": "^7.27.0", + "debug": "^4.3.1", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.27.0.tgz", + "integrity": "sha512-H45s8fVLYjbhFH62dIJ3WtmJ6RSPt/3DRO0ZcT2SUiYiQyz3BLVb9ADEnLl91m74aQPS3AzzeajZHYOalWe3bg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.25.9", + "@babel/helper-validator-identifier": "^7.25.9" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.8", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.8.tgz", + "integrity": "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/set-array": "^1.2.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.24" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.2.1.tgz", + "integrity": "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.5.0.tgz", + "integrity": "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.25", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.25.tgz", + "integrity": "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@pkgr/core": { + "version": "0.1.2", + "resolved": "https://registry.npmjs.org/@pkgr/core/-/core-0.1.2.tgz", + "integrity": "sha512-fdDH1LSGfZdTH2sxdpVMw31BanV28K/Gry0cVFxaNP77neJSkd82mM8ErPNYs9e+0O7SdHBLTDzDgwUuy18RnQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/@trivago/prettier-plugin-sort-imports": { + "version": "5.2.2", + "resolved": "https://registry.npmjs.org/@trivago/prettier-plugin-sort-imports/-/prettier-plugin-sort-imports-5.2.2.tgz", + "integrity": "sha512-fYDQA9e6yTNmA13TLVSA+WMQRc5Bn/c0EUBditUHNfMMxN7M82c38b1kEggVE3pLpZ0FwkwJkUEKMiOi52JXFA==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@babel/generator": "^7.26.5", + "@babel/parser": "^7.26.7", + "@babel/traverse": "^7.26.7", + "@babel/types": "^7.26.7", + "javascript-natural-sort": "^0.7.1", + "lodash": "^4.17.21" + }, + "engines": { + "node": ">18.12" + }, + "peerDependencies": { + "@vue/compiler-sfc": "3.x", + "prettier": "2.x - 3.x", + "prettier-plugin-svelte": "3.x", + "svelte": "4.x || 5.x" + }, + "peerDependenciesMeta": { + "@vue/compiler-sfc": { + "optional": true + }, + "prettier-plugin-svelte": { + "optional": true + }, + "svelte": { + "optional": true + } + } + }, + "node_modules/debug": { + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.0.tgz", + "integrity": "sha512-6WTZ/IxCY/T6BALoZHaE4ctp9xm+Z5kY/pzYaCHRFeyVhojxlrm+46y68HA6hr0TcwEssoxNiDEUJQjfPZ/RYA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/detect-indent": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/detect-indent/-/detect-indent-7.0.1.tgz", + "integrity": "sha512-Mc7QhQ8s+cLrnUfU/Ji94vG/r8M26m8f++vyres4ZoojaRDpZ1eSIh/EpzLNwlWuvzSZ3UbDFspjFvTDXe6e/g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.20" + } + }, + "node_modules/detect-newline": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/detect-newline/-/detect-newline-4.0.1.tgz", + "integrity": "sha512-qE3Veg1YXzGHQhlA6jzebZN2qVf6NX+A7m7qlhCGG30dJixrAQhYOsJjsnBjJkCSmuOPpCk30145fr8FV0bzog==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^12.20.0 || ^14.13.1 || >=16.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/fdir": { + "version": "6.4.4", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.4.tgz", + "integrity": "sha512-1NZP+GK4GfuAv3PqKvxQRDMjdSRZjnkq7KfhlNrCNNlZ0ygQFpebfrnfnq/W7fpUnAv9aGWmY1zKx7FYL3gwhg==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/get-stdin": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-9.0.0.tgz", + "integrity": "sha512-dVKBjfWisLAicarI2Sf+JuBE/DghV4UzNAVe9yhEJuzeREd3JhOTE9cUaJTeSa77fsbQUK3pcOpJfM59+VKZaA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/git-hooks-list": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/git-hooks-list/-/git-hooks-list-3.2.0.tgz", + "integrity": "sha512-ZHG9a1gEhUMX1TvGrLdyWb9kDopCBbTnI8z4JgRMYxsijWipgjSEYoPWqBuIB0DnRnvqlQSEeVmzpeuPm7NdFQ==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/fisker/git-hooks-list?sponsor=1" + } + }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=4" + } + }, + "node_modules/is-plain-obj": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/is-plain-obj/-/is-plain-obj-4.1.0.tgz", + "integrity": "sha512-+Pgi+vMuUNkJyExiMBt5IlFoMyKnr5zhJ4Uspz58WOhBF5QoIZkFyNHIbBAtHwzVAgk5RtndVNsDRN61/mmDqg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/javascript-natural-sort": { + "version": "0.7.1", + "resolved": "https://registry.npmjs.org/javascript-natural-sort/-/javascript-natural-sort-0.7.1.tgz", + "integrity": "sha512-nO6jcEfZWQXDhOiBtG2KvKyEptz7RVbpGP4vTD2hLBdmNQSsCiicO2Ioinv6UI4y9ukqnBpy+XZ9H6uLNgJTlw==", + "dev": true, + "license": "MIT" + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true, + "license": "MIT" + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz", + "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/prettier": { + "version": "3.5.3", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.5.3.tgz", + "integrity": "sha512-QQtaxnoDJeAkDvDKWCLiwIXkTgRhwYDEQCghU9Z6q03iyek/rxRh/2lC3HB7P8sWT2xC/y5JDctPLBIGzHKbhw==", + "dev": true, + "license": "MIT", + "bin": { + "prettier": "bin/prettier.cjs" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/prettier/prettier?sponsor=1" + } + }, + "node_modules/prettier-plugin-organize-imports": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/prettier-plugin-organize-imports/-/prettier-plugin-organize-imports-4.1.0.tgz", + "integrity": "sha512-5aWRdCgv645xaa58X8lOxzZoiHAldAPChljr/MT0crXVOWTZ+Svl4hIWlz+niYSlO6ikE5UXkN1JrRvIP2ut0A==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "prettier": ">=2.0", + "typescript": ">=2.9", + "vue-tsc": "^2.1.0" + }, + "peerDependenciesMeta": { + "vue-tsc": { + "optional": true + } + } + }, + "node_modules/prettier-plugin-packagejson": { + "version": "2.5.10", + "resolved": "https://registry.npmjs.org/prettier-plugin-packagejson/-/prettier-plugin-packagejson-2.5.10.tgz", + "integrity": "sha512-LUxATI5YsImIVSaaLJlJ3aE6wTD+nvots18U3GuQMJpUyClChaZlQrqx3dBnbhF20OnKWZyx8EgyZypQtBDtgQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "sort-package-json": "2.15.1", + "synckit": "0.9.2" + }, + "peerDependencies": { + "prettier": ">= 1.16.0" + }, + "peerDependenciesMeta": { + "prettier": { + "optional": true + } + } + }, + "node_modules/semver": { + "version": "7.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", + "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/sort-object-keys": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/sort-object-keys/-/sort-object-keys-1.1.3.tgz", + "integrity": "sha512-855pvK+VkU7PaKYPc+Jjnmt4EzejQHyhhF33q31qG8x7maDzkeFhAAThdCYay11CISO+qAMwjOBP+fPZe0IPyg==", + "dev": true, + "license": "MIT" + }, + "node_modules/sort-package-json": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/sort-package-json/-/sort-package-json-2.15.1.tgz", + "integrity": "sha512-9x9+o8krTT2saA9liI4BljNjwAbvUnWf11Wq+i/iZt8nl2UGYnf3TH5uBydE7VALmP7AGwlfszuEeL8BDyb0YA==", + "dev": true, + "license": "MIT", + "dependencies": { + "detect-indent": "^7.0.1", + "detect-newline": "^4.0.0", + "get-stdin": "^9.0.0", + "git-hooks-list": "^3.0.0", + "is-plain-obj": "^4.1.0", + "semver": "^7.6.0", + "sort-object-keys": "^1.1.3", + "tinyglobby": "^0.2.9" + }, + "bin": { + "sort-package-json": "cli.js" + } + }, + "node_modules/synckit": { + "version": "0.9.2", + "resolved": "https://registry.npmjs.org/synckit/-/synckit-0.9.2.tgz", + "integrity": "sha512-vrozgXDQwYO72vHjUb/HnFbQx1exDjoKzqx23aXEg2a9VIg2TSFZ8FmeZpTjUCFMYw7mpX4BE2SFu8wI7asYsw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@pkgr/core": "^0.1.0", + "tslib": "^2.6.2" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "funding": { + "url": "https://opencollective.com/unts" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.13", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.13.tgz", + "integrity": "sha512-mEwzpUgrLySlveBwEVDMKk5B57bhLPYovRfPAXD5gA/98Opn0rCDj3GtLwFvCvH5RK9uPCExUROW5NjDwvqkxw==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.4.4", + "picomatch": "^4.0.2" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tslib": { + "version": "2.8.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", + "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", + "dev": true, + "license": "0BSD" + }, + "node_modules/typescript": { + "version": "5.8.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.8.3.tgz", + "integrity": "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } } } } diff --git a/package.json b/package.json index 36e433fee1..72a665ebfb 100644 --- a/package.json +++ b/package.json @@ -1,5 +1,15 @@ { "name": "@goauthentik/authentik", "version": "2025.4.0", - "private": true + "private": true, + "type": "module", + "devDependencies": { + "@trivago/prettier-plugin-sort-imports": "^5.2.2", + "prettier": "^3.3.3", + "prettier-plugin-organize-imports": "^4.1.0", + "prettier-plugin-packagejson": "^2.5.10", + "typescript": "^5.6.2" + }, + "workspaces": [], + "prettier": "./packages/prettier-config/index.js" } diff --git a/packages/monorepo/package.json b/packages/monorepo/package.json deleted file mode 100644 index 3c801e6682..0000000000 --- a/packages/monorepo/package.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "name": "@goauthentik/monorepo", - "version": "1.0.0", - "description": "Utilities for the authentik monorepo.", - "private": true, - "license": "MIT", - "type": "module", - "exports": { - "./package.json": "./package.json", - ".": { - "import": "./index.js", - "types": "./out/index.d.ts" - } - }, - "types": "./out/index.d.ts", - "engines": { - "node": ">=20.11" - } -} diff --git a/packages/monorepo/paths.js b/packages/monorepo/paths.js deleted file mode 100644 index adade5d2c3..0000000000 --- a/packages/monorepo/paths.js +++ /dev/null @@ -1,30 +0,0 @@ -import { createRequire } from "node:module"; -import { dirname, join, resolve } from "node:path"; -import { fileURLToPath } from "node:url"; - -const __dirname = dirname(fileURLToPath(import.meta.url)); - -/** - * @typedef {'~authentik'} MonoRepoRoot - */ - -/** - * The root of the authentik monorepo. - */ -export const MonoRepoRoot = /** @type {MonoRepoRoot} */ (resolve(__dirname, "..", "..")); - -const require = createRequire(import.meta.url); - -/** - * Resolve a package name to its location in the monorepo to the single node_modules directory. - * @param {string} packageName - * @returns {string} The resolved path to the package. - * @throws {Error} If the package cannot be resolved. - */ -export function resolvePackage(packageName) { - const packageJSONPath = require.resolve(join(packageName, "package.json"), { - paths: [MonoRepoRoot], - }); - - return dirname(packageJSONPath); -} diff --git a/packages/monorepo/scripts.js b/packages/monorepo/scripts.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000000..eb25b173bf --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,28 @@ +// TypeScript Project Configuration +{ + "extends": "./packages/tsconfig/tsconfig.json", + "compilerOptions": { + "baseUrl": "." + }, + "watchOptions": { + "excludeDirectories": [ + "**/.git", // Git + "**/.yarn", // Yarn + "**/.vscode", // VS Code + "**/.vscode-test-web", // VS Code Web Test + "**/dist", // Distributed build files + "**/out", // Output build files + "**/.drafts", // Drafts + "**/.github", // GitHub + "**/node_modules" // Node modules + ] + }, + + // The root project has no sources of its own. By setting `files` to an empty + // list, TS won't automatically include all sources below root (the default). + "files": [], + "references": [ + // Note that references are in the order we want them to be built. + // TODO: Left blank until TypeScript workspaces are complete. + ] +} diff --git a/web/.prettierignore b/web/.prettierignore index b2ca499a32..120b730774 100644 --- a/web/.prettierignore +++ b/web/.prettierignore @@ -2,15 +2,11 @@ node_modules # don't lint build output (make sure it's set to your correct build folder name) dist +out # don't lint nyc coverage output coverage # Import order matters -poly.ts src/locale-codes.ts src/locales/ storybook-static/ -# Prettier breaks the tsconfig file -tsconfig.json .storybook/css-import-maps* -package.json -packages/**/package.json diff --git a/web/package-lock.json b/web/package-lock.json index faed3230f7..d3f28552d9 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -74,6 +74,7 @@ "devDependencies": { "@eslint/js": "^9.11.1", "@goauthentik/esbuild-plugin-live-reload": "^1.0.4", + "@goauthentik/monorepo": "^1.0.0", "@goauthentik/prettier-config": "^1.0.4", "@goauthentik/tsconfig": "^1.0.4", "@hcaptcha/types": "^1.0.4", @@ -105,13 +106,13 @@ "@wdio/spec-reporter": "^9.1.2", "chromedriver": "^131.0.1", "esbuild": "^0.25.0", + "esbuild-plugin-copy": "^2.1.1", "esbuild-plugin-polyfill-node": "^0.3.0", "esbuild-plugins-node-modules-polyfill": "^1.7.0", "eslint": "^9.11.1", "eslint-plugin-lit": "^1.15.0", "eslint-plugin-wc": "^2.1.1", "github-slugger": "^2.0.0", - "glob": "^11.0.0", "globals": "^15.10.0", "knip": "^5.30.6", "lit-analyzer": "^2.0.3", @@ -122,7 +123,6 @@ "rollup-plugin-postcss-lit": "^2.1.0", "storybook": "^8.3.4", "storybook-addon-mock": "^5.0.0", - "syncpack": "^13.0.0", "turnstile-types": "^1.2.3", "typescript": "^5.6.2", "typescript-eslint": "^8.8.0", @@ -142,6 +142,22 @@ "@rollup/rollup-linux-x64-gnu": "4.23.0" } }, + "../packages/monorepo": { + "name": "@goauthentik/monorepo", + "version": "1.0.4", + "extraneous": true, + "license": "MIT", + "devDependencies": { + "@goauthentik/prettier-config": "^1.0.4", + "@goauthentik/tsconfig": "^1.0.4", + "@types/node": "^22.14.1", + "prettier": "^3.3.3", + "typescript": "^5.6.2" + }, + "engines": { + "node": ">=20.11" + } + }, "node_modules/@ampproject/remapping": { "version": "2.3.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz", @@ -927,18 +943,6 @@ "w3c-keyname": "^2.2.4" } }, - "node_modules/@effect/schema": { - "version": "0.71.1", - "resolved": "https://registry.npmjs.org/@effect/schema/-/schema-0.71.1.tgz", - "integrity": "sha512-XvFttkuBUL3s4ofZ+OVE4Pagb4wsPG8laSS8iO5lVI9Yt1zIM49uxlYIA2BJ45jjS3MdplUepC0NilotKnjU2A==", - "dev": true, - "dependencies": { - "fast-check": "^3.21.0" - }, - "peerDependencies": { - "effect": "^3.6.5" - } - }, "node_modules/@emotion/use-insertion-effect-with-fallbacks": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@emotion/use-insertion-effect-with-fallbacks/-/use-insertion-effect-with-fallbacks-1.1.0.tgz", @@ -1591,6 +1595,10 @@ "resolved": "packages/esbuild-plugin-live-reload", "link": true }, + "node_modules/@goauthentik/monorepo": { + "resolved": "packages/monorepo", + "link": true + }, "node_modules/@goauthentik/prettier-config": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/@goauthentik/prettier-config/-/prettier-config-1.0.4.tgz", @@ -9507,33 +9515,6 @@ "node": ">=4" } }, - "node_modules/chalk-template": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/chalk-template/-/chalk-template-1.1.0.tgz", - "integrity": "sha512-T2VJbcDuZQ0Tb2EWwSotMPJjgpy1/tGee1BTpUNsGZ/qgNjV2t7Mvu+d4600U564nbLesN1x2dPL+xii174Ekg==", - "dev": true, - "dependencies": { - "chalk": "^5.2.0" - }, - "engines": { - "node": ">=14.16" - }, - "funding": { - "url": "https://github.com/chalk/chalk-template?sponsor=1" - } - }, - "node_modules/chalk-template/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, "node_modules/change-case": { "version": "5.4.4", "resolved": "https://registry.npmjs.org/change-case/-/change-case-5.4.4.tgz", @@ -9783,21 +9764,6 @@ "node": ">=6" } }, - "node_modules/cli-cursor": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-4.0.0.tgz", - "integrity": "sha512-VGtlMu3x/4DOtIUwEkRezxUZ2lBacNJCHash0N0WeZDBS+7Ux1dm3XWAgWYxLJFMMdOeXMHXorshEFhbMSGelg==", - "dev": true, - "dependencies": { - "restore-cursor": "^4.0.0" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/cli-spinners": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-3.2.0.tgz", @@ -11395,12 +11361,6 @@ "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", "dev": true }, - "node_modules/effect": { - "version": "3.6.5", - "resolved": "https://registry.npmjs.org/effect/-/effect-3.6.5.tgz", - "integrity": "sha512-NhopZTAKljaAlR0CEroOAJJngdqg7bzlnWcDrCwh4d2WNVohVbBtUS4SGqLt8tUy7IFsTWATYiUtmhDG+YELjA==", - "dev": true - }, "node_modules/ejs": { "version": "3.1.10", "resolved": "https://registry.npmjs.org/ejs/-/ejs-3.1.10.tgz", @@ -11484,31 +11444,6 @@ "node": ">=10.13.0" } }, - "node_modules/enquirer": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/enquirer/-/enquirer-2.4.1.tgz", - "integrity": "sha512-rRqJg/6gd538VHvR3PSrdRBb/1Vy2YfzHqzvbhGIQpDRKIa4FgV/54b5Q1xYSxOOwKvjXweS26E0Q+nAMwp2pQ==", - "dev": true, - "dependencies": { - "ansi-colors": "^4.1.1", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8.6" - } - }, - "node_modules/enquirer/node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, "node_modules/entities": { "version": "4.5.0", "resolved": "https://registry.npmjs.org/entities/-/entities-4.5.0.tgz", @@ -11997,6 +11932,193 @@ "node": ">=12" } }, + "node_modules/esbuild-plugin-copy": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/esbuild-plugin-copy/-/esbuild-plugin-copy-2.1.1.tgz", + "integrity": "sha512-Bk66jpevTcV8KMFzZI1P7MZKZ+uDcrZm2G2egZ2jNIvVnivDpodZI+/KnpL3Jnap0PBdIHU7HwFGB8r+vV5CVw==", + "dev": true, + "license": "MIT", + "dependencies": { + "chalk": "^4.1.2", + "chokidar": "^3.5.3", + "fs-extra": "^10.0.1", + "globby": "^11.0.3" + }, + "peerDependencies": { + "esbuild": ">= 0.14.0" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true, + "license": "MIT" + }, + "node_modules/esbuild-plugin-copy/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/globby": { + "version": "11.1.0", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.1.0.tgz", + "integrity": "sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.2.9", + "ignore": "^5.2.0", + "merge2": "^1.4.1", + "slash": "^3.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/picomatch": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.1.tgz", + "integrity": "sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/esbuild-plugin-copy/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "license": "MIT", + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/esbuild-plugin-polyfill-node": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/esbuild-plugin-polyfill-node/-/esbuild-plugin-polyfill-node-0.3.0.tgz", @@ -12929,28 +13051,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/fast-check": { - "version": "3.21.0", - "resolved": "https://registry.npmjs.org/fast-check/-/fast-check-3.21.0.tgz", - "integrity": "sha512-QpmbiqRFRZ+SIlBJh6xi5d/PgXciUc/xWKc4Vi2RWEHHIRx6oM3f0fWNna++zP9VB5HUBTObUK9gTKQP3vVcrQ==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ], - "dependencies": { - "pure-rand": "^6.1.0" - }, - "engines": { - "node": ">=8.0.0" - } - }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", @@ -13593,18 +13693,6 @@ "node": "6.* || 8.* || >= 10.*" } }, - "node_modules/get-east-asian-width": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-east-asian-width/-/get-east-asian-width-1.2.0.tgz", - "integrity": "sha512-2nk+7SIVb14QrgXFHcm84tD4bKQz0RxPuMT8Ag5KPOq7J5fEmAg0UbXdTOSHqNuHSU28k55qnceesxXRZGzKWA==", - "dev": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/get-intrinsic": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.4.tgz", @@ -13779,29 +13867,6 @@ "integrity": "sha512-IaOQ9puYtjrkq7Y0Ygl9KDZnrf/aiUJYUpVf89y8kyaxbRG7Y1SrX/jaumrv81vc61+kiMempujsM3Yw7w5qcw==", "dev": true }, - "node_modules/glob": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-11.0.0.tgz", - "integrity": "sha512-9UiX/Bl6J2yaBbxKoEBRm4Cipxgok8kQYcOPEhScPwebu2I0HoQOuYdIO6S3hLuWoZgpDpwQZMzTFxgpkyT76g==", - "dev": true, - "dependencies": { - "foreground-child": "^3.1.0", - "jackspeak": "^4.0.1", - "minimatch": "^10.0.0", - "minipass": "^7.1.2", - "package-json-from-dist": "^1.0.0", - "path-scurry": "^2.0.0" - }, - "bin": { - "glob": "dist/esm/bin.mjs" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/glob-parent": { "version": "6.0.2", "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", @@ -13814,21 +13879,6 @@ "node": ">=10.13.0" } }, - "node_modules/glob/node_modules/minimatch": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-10.0.1.tgz", - "integrity": "sha512-ethXTt3SGGR+95gudmqJ1eNhRO7eGEGIgYA9vnPatK4/etz2MEVDno5GMCibdMTuBMyElzIlgxMna3K94XDIDQ==", - "dev": true, - "dependencies": { - "brace-expansion": "^2.0.1" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/globals": { "version": "15.10.0", "resolved": "https://registry.npmjs.org/globals/-/globals-15.10.0.tgz", @@ -13862,6 +13912,7 @@ "resolved": "https://registry.npmjs.org/globby/-/globby-14.0.2.tgz", "integrity": "sha512-s3Fq41ZVh7vbbe2PN3nrW7yC7U7MFVc5c98/iTl9c2GawNMKx/J648KQRW6WKkuU8GIbbh2IXfIRQjOZnXcTnw==", "dev": true, + "optional": true, "dependencies": { "@sindresorhus/merge-streams": "^2.1.0", "fast-glob": "^3.3.2", @@ -13882,6 +13933,7 @@ "resolved": "https://registry.npmjs.org/@sindresorhus/merge-streams/-/merge-streams-2.3.0.tgz", "integrity": "sha512-LtoMMhxAlorcGhmFYI+LhPgbPZCkgP6ra1YL604EeF6U98pLlQ3iWIGMdWSC+vWmPBWBNgmDBAhnAobLROJmwg==", "dev": true, + "optional": true, "engines": { "node": ">=18" }, @@ -14942,18 +14994,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/is-interactive": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-interactive/-/is-interactive-2.0.0.tgz", - "integrity": "sha512-qP1vozQRI+BMOPcjFzrjXuQvdak2pHNUMZoeG2eRbiSqyvbEf/wQtEOTOX1guk6E3t36RkaqiSt8A/6YElNxLQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -15301,21 +15341,6 @@ "node": ">=8" } }, - "node_modules/jackspeak": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-4.0.2.tgz", - "integrity": "sha512-bZsjR/iRjl1Nk1UkjGpAzLNfQtzuijhn2g+pbZb98HQ1Gk8vM9hfbxeMBP+M2/UUdwj0RqGG3mlvk2MsAqwvEw==", - "dev": true, - "dependencies": { - "@isaacs/cliui": "^8.0.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/jake": { "version": "10.9.2", "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.2.tgz", @@ -16678,15 +16703,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/lru-cache": { - "version": "11.0.1", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-11.0.1.tgz", - "integrity": "sha512-CgeuL5uom6j/ZVrg7G/+1IXqRY8JXX4Hghfy5YE0EhoYQWvndP1kufu58cmZLNIDKnRhZrXfdS9urVWx98AipQ==", - "dev": true, - "engines": { - "node": "20 || >=22" - } - }, "node_modules/magic-string": { "version": "0.30.15", "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.30.15.tgz", @@ -18788,39 +18804,6 @@ "url": "https://github.com/sponsors/sindresorhus" } }, - "node_modules/npm-package-arg": { - "version": "11.0.3", - "resolved": "https://registry.npmjs.org/npm-package-arg/-/npm-package-arg-11.0.3.tgz", - "integrity": "sha512-sHGJy8sOC1YraBywpzQlIKBE4pBbGbiF95U6Auspzyem956E0+FtDtsx1ZxlOJkQCZ1AFXAY/yuvtFYrOxF+Bw==", - "dev": true, - "dependencies": { - "hosted-git-info": "^7.0.0", - "proc-log": "^4.0.0", - "semver": "^7.3.5", - "validate-npm-package-name": "^5.0.0" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm-package-arg/node_modules/hosted-git-info": { - "version": "7.0.2", - "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-7.0.2.tgz", - "integrity": "sha512-puUZAUKT5m8Zzvs72XWy3HtvVbTWljRE66cP60bxJzAqf2DgICo7lYTY2IHUmLnNpjYvw5bvmoHvPc0QO2a62w==", - "dev": true, - "dependencies": { - "lru-cache": "^10.0.1" - }, - "engines": { - "node": "^16.14.0 || >=18.0.0" - } - }, - "node_modules/npm-package-arg/node_modules/lru-cache": { - "version": "10.4.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz", - "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==", - "dev": true - }, "node_modules/npm-run-all": { "version": "4.1.5", "resolved": "https://registry.npmjs.org/npm-run-all/-/npm-run-all-4.1.5.tgz", @@ -19303,104 +19286,6 @@ "node": ">= 0.8.0" } }, - "node_modules/ora": { - "version": "8.0.1", - "resolved": "https://registry.npmjs.org/ora/-/ora-8.0.1.tgz", - "integrity": "sha512-ANIvzobt1rls2BDny5fWZ3ZVKyD6nscLvfFRpQgfWsythlcsVUC9kL0zq6j2Z5z9wwp1kd7wpsD/T9qNPVLCaQ==", - "dev": true, - "dependencies": { - "chalk": "^5.3.0", - "cli-cursor": "^4.0.0", - "cli-spinners": "^2.9.2", - "is-interactive": "^2.0.0", - "is-unicode-supported": "^2.0.0", - "log-symbols": "^6.0.0", - "stdin-discarder": "^0.2.1", - "string-width": "^7.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/ora/node_modules/cli-spinners": { - "version": "2.9.2", - "resolved": "https://registry.npmjs.org/cli-spinners/-/cli-spinners-2.9.2.tgz", - "integrity": "sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/emoji-regex": { - "version": "10.4.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-10.4.0.tgz", - "integrity": "sha512-EC+0oUMY1Rqm4O6LLrgjtYDvcVYTy7chDnM4Q7030tP4Kwj3u/pR6gP9ygnp2CJMK5Gq+9Q2oqmrFJAz01DXjw==", - "dev": true - }, - "node_modules/ora/node_modules/log-symbols": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/log-symbols/-/log-symbols-6.0.0.tgz", - "integrity": "sha512-i24m8rpwhmPIS4zscNzK6MSEhk0DUWa/8iYQWxhffV8jkI4Phvs3F+quL5xvS0gdQR0FyTCMMH33Y78dDTzzIw==", - "dev": true, - "dependencies": { - "chalk": "^5.3.0", - "is-unicode-supported": "^1.3.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/log-symbols/node_modules/is-unicode-supported": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/is-unicode-supported/-/is-unicode-supported-1.3.0.tgz", - "integrity": "sha512-43r2mRvz+8JRIKnWJ+3j8JtjRKZ6GmjzfaE/qiBJnikNnYv/6bagRJ1kUhNk8R5EX/GkobD+r+sfxCPJsiKBLQ==", - "dev": true, - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ora/node_modules/string-width": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-7.2.0.tgz", - "integrity": "sha512-tsaTIkKW9b4N+AEj+SVA+WhJzV7/zMhcSu78mLKWSk7cXMOSHsBKFWUs0fWwq8QyK3MgJBQRX6Gbi4kYbdvGkQ==", - "dev": true, - "dependencies": { - "emoji-regex": "^10.3.0", - "get-east-asian-width": "^1.0.0", - "strip-ansi": "^7.1.0" - }, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/os-filter-obj": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/os-filter-obj/-/os-filter-obj-2.0.0.tgz", @@ -19750,22 +19635,6 @@ "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", "dev": true }, - "node_modules/path-scurry": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-2.0.0.tgz", - "integrity": "sha512-ypGJsmGtdXUOeM5u93TyeIEfEhM6s+ljAhrk5vAvSx8uyY/02OvrZnA0YNGUrPXfpJMgI1ODd3nwz8Npx4O4cg==", - "dev": true, - "dependencies": { - "lru-cache": "^11.0.0", - "minipass": "^7.1.2" - }, - "engines": { - "node": "20 || >=22" - }, - "funding": { - "url": "https://github.com/sponsors/isaacs" - } - }, "node_modules/path-to-regexp": { "version": "0.1.10", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.10.tgz", @@ -19777,6 +19646,7 @@ "resolved": "https://registry.npmjs.org/path-type/-/path-type-5.0.0.tgz", "integrity": "sha512-5HviZNaZcfqP95rwpv+1HDgUamezbqdSYTyzjTvwtJSnIH+3vnbmWsItli8OFEndS984VT55M3jduxZbX351gg==", "dev": true, + "optional": true, "engines": { "node": ">=12" }, @@ -20140,15 +20010,6 @@ "node": ">=6" } }, - "node_modules/proc-log": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/proc-log/-/proc-log-4.2.0.tgz", - "integrity": "sha512-g8+OnU/L2v+wyiVK+D5fA34J7EH8jZ8DDlvwhRCMxmMj7UCBvxiO1mGeN+36JXIKF4zevU4kRBd8lVgG9vLelA==", - "dev": true, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, "node_modules/process": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", @@ -20172,28 +20033,6 @@ "node": ">=0.4.0" } }, - "node_modules/prompts": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/prompts/-/prompts-2.4.2.tgz", - "integrity": "sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==", - "dev": true, - "dependencies": { - "kleur": "^3.0.3", - "sisteransi": "^1.0.5" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/prompts/node_modules/kleur": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/kleur/-/kleur-3.0.3.tgz", - "integrity": "sha512-eTIzlVOSUR+JxdDFepEYcBMtZ9Qqdef+rnzWdRZuMbOywu5tO2w2N7rqjoANZ5k9vywhL6Br1VRjUIgTQx4E8w==", - "dev": true, - "engines": { - "node": ">=6" - } - }, "node_modules/prop-types": { "version": "15.8.1", "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.8.1.tgz", @@ -20377,22 +20216,6 @@ "node": ">=18" } }, - "node_modules/pure-rand": { - "version": "6.1.0", - "resolved": "https://registry.npmjs.org/pure-rand/-/pure-rand-6.1.0.tgz", - "integrity": "sha512-bVWawvoZoBYpp6yIoQtQXHZjmz35RSVHnUOTefl8Vcjr8snTPY1wnpSPMWekcFwbxI6gtmT7rSYPFvz71ldiOA==", - "dev": true, - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/dubzzz" - }, - { - "type": "opencollective", - "url": "https://opencollective.com/fast-check" - } - ] - }, "node_modules/qrjs": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/qrjs/-/qrjs-0.2.0.tgz", @@ -20861,28 +20684,6 @@ "node": ">=4" } }, - "node_modules/read-yaml-file": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/read-yaml-file/-/read-yaml-file-2.1.0.tgz", - "integrity": "sha512-UkRNRIwnhG+y7hpqnycCL/xbTk7+ia9VuVTC0S+zVbwd65DI9eUpRMfsWIGrCWxTU/mi+JW8cHQCrv+zfCbEPQ==", - "dev": true, - "dependencies": { - "js-yaml": "^4.0.0", - "strip-bom": "^4.0.0" - }, - "engines": { - "node": ">=10.13" - } - }, - "node_modules/read-yaml-file/node_modules/strip-bom": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-4.0.0.tgz", - "integrity": "sha512-3xurFv5tEgii33Zi8Jtp55wEIILR9eh34FAW00PZf+JnSsTmV/ioewSgQl97JHvgjoRGwPShsWm+IdrxB35d0w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/readable-stream": { "version": "4.5.2", "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-4.5.2.tgz", @@ -21531,28 +21332,6 @@ "integrity": "sha512-bCK/2Z4zLidyB4ReuIsvALH6w31YfAQDmXMqMx6FyfHqvBxtjC0eRumeSu4Bs3XtXwpyIywtSTrVT99BxY1f9w==", "dev": true }, - "node_modules/restore-cursor": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-4.0.0.tgz", - "integrity": "sha512-I9fPXU9geO9bHOt9pHHOhOkYerIMsmVaWB0rA2AI9ERh/+x/i7MV5HKBNrg+ljO5eoPVgCcnFuRjJ9uH6I/3eg==", - "dev": true, - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": "^12.20.0 || ^14.13.1 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/restore-cursor/node_modules/signal-exit": { - "version": "3.0.7", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.7.tgz", - "integrity": "sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ==", - "dev": true - }, "node_modules/ret": { "version": "0.2.2", "resolved": "https://registry.npmjs.org/ret/-/ret-0.2.2.tgz", @@ -22204,17 +21983,12 @@ "url": "https://github.com/sponsors/isaacs" } }, - "node_modules/sisteransi": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/sisteransi/-/sisteransi-1.0.5.tgz", - "integrity": "sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==", - "dev": true - }, "node_modules/slash": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/slash/-/slash-5.1.0.tgz", "integrity": "sha512-ZA6oR3T/pEyuqwMgAKT0/hAv8oAXckzbkmR0UkUosQ+Mc4RxGoJkRmwHgHufaenlyAgE1Mxgpdcrf75y6XcnDg==", "dev": true, + "optional": true, "engines": { "node": ">=14.16" }, @@ -22492,18 +22266,6 @@ "dev": true, "optional": true }, - "node_modules/stdin-discarder": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/stdin-discarder/-/stdin-discarder-0.2.2.tgz", - "integrity": "sha512-UhDfHmA92YAlNnCfhmq0VeNL5bDbiZGg7sZ2IvPsXubGkiNa9EC+tUTsjBRsYUAz87btI6/1wf4XoVvQ3uRnmQ==", - "dev": true, - "engines": { - "node": ">=18" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/store2": { "version": "2.14.4", "resolved": "https://registry.npmjs.org/store2/-/store2-2.14.4.tgz", @@ -22961,68 +22723,6 @@ "url": "https://opencollective.com/unts" } }, - "node_modules/syncpack": { - "version": "13.0.0", - "resolved": "https://registry.npmjs.org/syncpack/-/syncpack-13.0.0.tgz", - "integrity": "sha512-0PIoEWMP2+YkllkcZXw8N9d2sFqpmr8ULBdvms3gc1vG5tnccEMqc6flxHYnF/N+NTTcUnf0J+4xAD5hwH6XGQ==", - "dev": true, - "dependencies": { - "@effect/schema": "0.71.1", - "chalk": "5.3.0", - "chalk-template": "1.1.0", - "commander": "12.1.0", - "cosmiconfig": "9.0.0", - "effect": "3.6.5", - "enquirer": "2.4.1", - "fast-check": "3.21.0", - "globby": "14.0.2", - "jsonc-parser": "3.3.1", - "minimatch": "9.0.5", - "npm-package-arg": "11.0.3", - "ora": "8.0.1", - "prompts": "2.4.2", - "read-yaml-file": "2.1.0", - "semver": "7.6.3", - "tightrope": "0.2.0", - "ts-toolbelt": "9.6.0" - }, - "bin": { - "syncpack": "dist/bin.js", - "syncpack-fix-mismatches": "dist/bin-fix-mismatches/index.js", - "syncpack-format": "dist/bin-format/index.js", - "syncpack-lint": "dist/bin-lint/index.js", - "syncpack-lint-semver-ranges": "dist/bin-lint-semver-ranges/index.js", - "syncpack-list": "dist/bin-list/index.js", - "syncpack-list-mismatches": "dist/bin-list-mismatches/index.js", - "syncpack-prompt": "dist/bin-prompt/index.js", - "syncpack-set-semver-ranges": "dist/bin-set-semver-ranges/index.js", - "syncpack-update": "dist/bin-update/index.js" - }, - "engines": { - "node": ">=18.18.0" - } - }, - "node_modules/syncpack/node_modules/chalk": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-5.3.0.tgz", - "integrity": "sha512-dLitG79d+GV1Nb/VYcCDFivJeK1hiukt9QjRNVOsUtTy1rR1YJsmpGGTZ3qJos+uw7WmWF4wUwBd9jxjocFC2w==", - "dev": true, - "engines": { - "node": "^12.17.0 || ^14.13 || >=16.0.0" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/syncpack/node_modules/commander": { - "version": "12.1.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-12.1.0.tgz", - "integrity": "sha512-Vw8qHK3bZM9y/P10u3Vib8o/DdkvA2OtPtZvD871QKjy74Wj1WSKFILMPRPSdUSx5RFK1arlJzEtA4PkFgnbuA==", - "dev": true, - "engines": { - "node": ">=18" - } - }, "node_modules/tapable": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/tapable/-/tapable-2.2.1.tgz", @@ -23206,15 +22906,6 @@ "integrity": "sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==", "dev": true }, - "node_modules/tightrope": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/tightrope/-/tightrope-0.2.0.tgz", - "integrity": "sha512-Kw36UHxJEELq2VUqdaSGR2/8cAsPgMtvX8uGVU6Jk26O66PhXec0A5ZnRYs47btbtwPDpXXF66+Fo3vimCM9aQ==", - "dev": true, - "engines": { - "node": ">=16" - } - }, "node_modules/tiny-invariant": { "version": "1.3.3", "resolved": "https://registry.npmjs.org/tiny-invariant/-/tiny-invariant-1.3.3.tgz", @@ -24209,6 +23900,7 @@ "resolved": "https://registry.npmjs.org/unicorn-magic/-/unicorn-magic-0.1.0.tgz", "integrity": "sha512-lRfVq8fE8gz6QMBuDM6a+LO3IAzTi05H6gCVaUpir2E1Rwpo4ZUog45KpNXKC/Mn3Yb9UDuHumeFTo9iV/D9FQ==", "dev": true, + "optional": true, "engines": { "node": ">=18" }, @@ -24567,15 +24259,6 @@ "spdx-expression-parse": "^3.0.0" } }, - "node_modules/validate-npm-package-name": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/validate-npm-package-name/-/validate-npm-package-name-5.0.1.tgz", - "integrity": "sha512-OljLrQ9SQdOUqTaQxqL5dEfZWrXExyyWsozYlAWFawPVNuD83igl7uJD2RTkNMbniIYgt8l81eCJGIdQF7avLQ==", - "dev": true, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, "node_modules/vary": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", @@ -26239,6 +25922,38 @@ "dev": true, "license": "MIT" }, + "packages/monorepo": { + "name": "@goauthentik/monorepo", + "version": "1.0.0", + "license": "MIT", + "devDependencies": { + "@goauthentik/prettier-config": "^1.0.4", + "@goauthentik/tsconfig": "^1.0.4", + "@types/node": "^22.14.1", + "prettier": "^3.3.3", + "typescript": "^5.6.2" + }, + "engines": { + "node": ">=20.11" + } + }, + "packages/monorepo/node_modules/@types/node": { + "version": "22.15.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.3.tgz", + "integrity": "sha512-lX7HFZeHf4QG/J7tBZqrCAXwz9J5RD56Y6MpP0eJkka8p+K0RY/yBTW7CYFJ4VGCclxqOLKmiGP5juQc6MKgcw==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~6.21.0" + } + }, + "packages/monorepo/node_modules/undici-types": { + "version": "6.21.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz", + "integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==", + "dev": true, + "license": "MIT" + }, "packages/sfe": { "name": "@goauthentik/web-sfe", "version": "0.0.0", diff --git a/web/package.json b/web/package.json index 052323e4de..96ac4cd051 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,44 @@ { "name": "@goauthentik/web", "version": "0.0.0", + "license": "MIT", + "private": true, + "scripts": { + "build": "wireit", + "build-locales": "wireit", + "build-locales:build": "wireit", + "build-proxy": "wireit", + "build:sfe": "wireit", + "esbuild:watch": "node scripts/build-web.mjs --watch", + "extract-locales": "wireit", + "format": "wireit", + "lint": "wireit", + "lint:imports": "wireit", + "lint:lockfile": "wireit", + "lint:nightmare": "wireit", + "lint:precommit": "wireit", + "lint:types": "wireit", + "lit-analyse": "wireit", + "postinstall": "bash scripts/patch-spotlight.sh", + "precommit": "wireit", + "prettier": "wireit", + "prettier-check": "wireit", + "pseudolocalize": "wireit", + "storybook": "storybook dev -p 6006", + "storybook:build": "wireit", + "test": "wireit", + "test:e2e": "wireit", + "test:e2e:watch": "wireit", + "test:watch": "wireit", + "tsc": "wireit", + "watch": "run-s build-locales esbuild:watch" + }, + "type": "module", + "exports": { + "./package.json": "./package.json", + "./paths": "./paths.js", + "./scripts/*": "./scripts/*.mjs" + }, "dependencies": { "@codemirror/lang-css": "^6.3.1", "@codemirror/lang-html": "^6.4.9", @@ -62,6 +100,7 @@ "devDependencies": { "@eslint/js": "^9.11.1", "@goauthentik/esbuild-plugin-live-reload": "^1.0.4", + "@goauthentik/monorepo": "^1.0.0", "@goauthentik/prettier-config": "^1.0.4", "@goauthentik/tsconfig": "^1.0.4", "@hcaptcha/types": "^1.0.4", @@ -93,13 +132,13 @@ "@wdio/spec-reporter": "^9.1.2", "chromedriver": "^131.0.1", "esbuild": "^0.25.0", + "esbuild-plugin-copy": "^2.1.1", "esbuild-plugin-polyfill-node": "^0.3.0", "esbuild-plugins-node-modules-polyfill": "^1.7.0", "eslint": "^9.11.1", "eslint-plugin-lit": "^1.15.0", "eslint-plugin-wc": "^2.1.1", "github-slugger": "^2.0.0", - "glob": "^11.0.0", "globals": "^15.10.0", "knip": "^5.30.6", "lit-analyzer": "^2.0.3", @@ -110,7 +149,6 @@ "rollup-plugin-postcss-lit": "^2.1.0", "storybook": "^8.3.4", "storybook-addon-mock": "^5.0.0", - "syncpack": "^13.0.0", "turnstile-types": "^1.2.3", "typescript": "^5.6.2", "typescript-eslint": "^8.8.0", @@ -118,10 +156,6 @@ "vite-tsconfig-paths": "^5.0.1", "wireit": "^0.14.9" }, - "engines": { - "node": ">=20" - }, - "license": "MIT", "optionalDependencies": { "@esbuild/darwin-arm64": "^0.24.0", "@esbuild/linux-amd64": "^0.18.11", @@ -130,48 +164,6 @@ "@rollup/rollup-linux-arm64-gnu": "4.23.0", "@rollup/rollup-linux-x64-gnu": "4.23.0" }, - "overrides": { - "rapidoc": { - "@apitools/openapi-parser@": "0.0.37" - }, - "chromedriver": { - "axios": "^1.8.4" - } - }, - "prettier": "@goauthentik/prettier-config", - "private": true, - "scripts": { - "build": "wireit", - "build-locales": "wireit", - "build-locales:build": "wireit", - "build-proxy": "wireit", - "build:sfe": "wireit", - "esbuild:watch": "node scripts/build-web.mjs --watch", - "extract-locales": "wireit", - "format": "wireit", - "lint": "wireit", - "lint:imports": "wireit", - "lint:lockfile": "wireit", - "lint:nightmare": "wireit", - "lint:package": "wireit", - "lint:precommit": "wireit", - "lint:types": "wireit", - "lit-analyse": "wireit", - "postinstall": "bash scripts/patch-spotlight.sh", - "precommit": "wireit", - "prettier": "wireit", - "prettier-check": "wireit", - "pseudolocalize": "wireit", - "storybook": "storybook dev -p 6006", - "storybook:build": "wireit", - "test": "wireit", - "test:e2e": "wireit", - "test:e2e:watch": "wireit", - "test:watch": "wireit", - "tsc": "wireit", - "watch": "run-s build-locales esbuild:watch" - }, - "type": "module", "wireit": { "build": { "#comment": [ @@ -248,10 +240,7 @@ "command": "lit-localize extract" }, "format": { - "command": "prettier --write .", - "dependencies": [ - "lint:package" - ] + "command": "prettier --write ." }, "format:packages": { "dependencies": [ @@ -290,9 +279,6 @@ "./packages/sfe:lint:lockfile" ] }, - "lint:package": { - "command": "syncpack format -i ' '" - }, "lint:nightmare": { "command": "${NODE_RUNNER} ./scripts/eslint.mjs --nightmare", "env": { @@ -323,7 +309,6 @@ "lint:types", "lint:components", "lint:spelling", - "lint:package", "lint:lockfile", "lint:lockfiles", "lint:precommit", @@ -388,8 +373,20 @@ ] } }, + "engines": { + "node": ">=20" + }, "workspaces": [ ".", "./packages/*" - ] + ], + "prettier": "@goauthentik/prettier-config", + "overrides": { + "rapidoc": { + "@apitools/openapi-parser@": "0.0.37" + }, + "chromedriver": { + "axios": "^1.8.4" + } + } } diff --git a/web/packages/esbuild-plugin-live-reload/package.json b/web/packages/esbuild-plugin-live-reload/package.json index 3ddd26f0a4..ac6b9caad7 100644 --- a/web/packages/esbuild-plugin-live-reload/package.json +++ b/web/packages/esbuild-plugin-live-reload/package.json @@ -1,22 +1,11 @@ { "name": "@goauthentik/esbuild-plugin-live-reload", - "description": "ESBuild plugin to watch for file changes and trigger client-side reloads.", "version": "1.0.4", - "dependencies": { - "find-free-ports": "^3.1.1" - }, - "devDependencies": { - "@goauthentik/prettier-config": "^1.0.4", - "@goauthentik/tsconfig": "^1.0.4", - "@trivago/prettier-plugin-sort-imports": "^5.2.2", - "@types/node": "^22.14.1", - "esbuild": "^0.25.0", - "prettier": "^3.3.3", - "typescript": "^5.6.2" - }, - "engines": { - "node": ">=20.11" - }, + "description": "ESBuild plugin to watch for file changes and trigger client-side reloads.", + "license": "MIT", + "private": true, + "main": "index.js", + "type": "module", "exports": { "./package.json": "./package.json", ".": { @@ -32,22 +21,33 @@ "import": "./plugin/index.js" } }, + "dependencies": { + "find-free-ports": "^3.1.1" + }, + "devDependencies": { + "@goauthentik/prettier-config": "^1.0.4", + "@goauthentik/tsconfig": "^1.0.4", + "@trivago/prettier-plugin-sort-imports": "^5.2.2", + "@types/node": "^22.14.1", + "esbuild": "^0.25.0", + "prettier": "^3.3.3", + "typescript": "^5.6.2" + }, + "peerDependencies": { + "esbuild": "^0.25.0" + }, + "engines": { + "node": ">=20.11" + }, + "types": "./out/index.d.ts", "files": [ "./index.js", "client/**/*", "plugin/**/*", "out/**/*" ], - "license": "MIT", - "main": "index.js", - "peerDependencies": { - "esbuild": "^0.25.0" - }, "prettier": "@goauthentik/prettier-config", - "private": true, "publishConfig": { "access": "public" - }, - "type": "module", - "types": "./out/index.d.ts" + } } diff --git a/packages/monorepo/LICENSE.txt b/web/packages/monorepo/LICENSE.txt similarity index 100% rename from packages/monorepo/LICENSE.txt rename to web/packages/monorepo/LICENSE.txt diff --git a/packages/monorepo/README.md b/web/packages/monorepo/README.md similarity index 99% rename from packages/monorepo/README.md rename to web/packages/monorepo/README.md index 533a60093c..a3930c1994 100644 --- a/packages/monorepo/README.md +++ b/web/packages/monorepo/README.md @@ -2,4 +2,3 @@ This package contains utility scripts common to all TypeScript and JavaScript packages in the `@goauthentik` monorepo. - diff --git a/web/packages/monorepo/build.js b/web/packages/monorepo/build.js new file mode 100644 index 0000000000..343d522cd6 --- /dev/null +++ b/web/packages/monorepo/build.js @@ -0,0 +1,42 @@ +/** + * @file Utility functions for building and copying files. + */ + +/** + * A source environment variable, which can be a string, number, boolean, null, or undefined. + * @typedef {string | number | boolean | null | undefined} EnvironmentVariable + */ + +/** + * A type helper for serializing environment variables. + * + * @template {EnvironmentVariable} T + * @typedef {T extends string ? `"${T}"` : T} JSONify + */ + +/** + * Given an object of environment variables, returns a new object with the same keys and values, but + * with the values serialized as strings. + * + * @template {Record} EnvRecord + * @template {string} [Prefix='process.env.'] + * + * @param {EnvRecord} input + * @param {Prefix} [prefix='process.env.'] + * + * @returns {{[K in keyof EnvRecord as `${Prefix}${K}`]: JSONify}} + */ +export function serializeEnvironmentVars(input, prefix = /** @type {Prefix} */ ("process.env.")) { + /** + * @type {Record} + */ + const env = {}; + + for (const [key, value] of Object.entries(input)) { + const namespaceKey = prefix + key; + + env[namespaceKey] = JSON.stringify(value || ""); + } + + return /** @type {any} */ (env); +} diff --git a/packages/monorepo/constants.js b/web/packages/monorepo/constants.js similarity index 73% rename from packages/monorepo/constants.js rename to web/packages/monorepo/constants.js index e091abeb2c..6abf55e8a5 100644 --- a/packages/monorepo/constants.js +++ b/web/packages/monorepo/constants.js @@ -1,8 +1,9 @@ /** * @file Constants for JavaScript and TypeScript files. - * */ +/// + /** * The current Node.js environment, defaulting to "development" when not set. * @@ -12,6 +13,4 @@ * ensure that module tree-shaking works correctly. * */ -export const NodeEnvironment = /** @type {'development' | 'production'} */ ( - process.env.NODE_ENV || "development" -); +export const NodeEnvironment = process.env.NODE_ENV || "development"; diff --git a/packages/monorepo/index.js b/web/packages/monorepo/index.js similarity index 62% rename from packages/monorepo/index.js rename to web/packages/monorepo/index.js index 6c0af406bd..284d2b5d2b 100644 --- a/packages/monorepo/index.js +++ b/web/packages/monorepo/index.js @@ -1,4 +1,7 @@ +/// + export * from "./paths.js"; export * from "./constants.js"; +export * from "./build.js"; export * from "./version.js"; export * from "./scripting.js"; diff --git a/web/packages/monorepo/package.json b/web/packages/monorepo/package.json new file mode 100644 index 0000000000..86b0b3aa21 --- /dev/null +++ b/web/packages/monorepo/package.json @@ -0,0 +1,28 @@ +{ + "name": "@goauthentik/monorepo", + "version": "1.0.0", + "description": "Utilities for the authentik monorepo.", + "license": "MIT", + "private": true, + "main": "index.js", + "type": "module", + "exports": { + "./package.json": "./package.json", + ".": { + "types": "./out/index.d.ts", + "import": "./index.js" + } + }, + "devDependencies": { + "@goauthentik/prettier-config": "^1.0.4", + "@goauthentik/tsconfig": "^1.0.4", + "@types/node": "^22.14.1", + "prettier": "^3.3.3", + "typescript": "^5.6.2" + }, + "engines": { + "node": ">=20.11" + }, + "types": "./out/index.d.ts", + "prettier": "@goauthentik/prettier-config" +} diff --git a/web/packages/monorepo/paths.js b/web/packages/monorepo/paths.js new file mode 100644 index 0000000000..ab923a26af --- /dev/null +++ b/web/packages/monorepo/paths.js @@ -0,0 +1,45 @@ +import { createRequire } from "node:module"; +import { dirname, join, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const relativeDirname = dirname(fileURLToPath(import.meta.url)); + +/** + * @typedef {'~authentik'} MonoRepoRoot + */ + +/** + * The root of the authentik monorepo. + */ +// TODO: Revise when this package is moved to the monorepo's `packages/monorepo` directory. +export const MonoRepoRoot = /** @type {MonoRepoRoot} */ ( + resolve(relativeDirname, "..", "..", "..") +); + +const require = createRequire(import.meta.url); + +/** + * Resolve a package name to its location in the monorepo to the single node_modules directory. + * @param {string} packageName + * + * @returns {string} The resolved path to the package. + * @throws {Error} If the package cannot be resolved. + */ +export function resolvePackage(packageName) { + const relativePackageJSONPath = join(packageName, "package.json"); + + /** @type {string} */ + let absolutePackageJSONPath; + + try { + absolutePackageJSONPath = require.resolve(relativePackageJSONPath); + } catch (cause) { + const error = new Error(`Failed to resolve package "${packageName}"`); + + error.cause = cause; + + throw error; + } + + return dirname(absolutePackageJSONPath); +} diff --git a/packages/monorepo/scripting.js b/web/packages/monorepo/scripting.js similarity index 100% rename from packages/monorepo/scripting.js rename to web/packages/monorepo/scripting.js diff --git a/packages/monorepo/tsconfig.json b/web/packages/monorepo/tsconfig.json similarity index 100% rename from packages/monorepo/tsconfig.json rename to web/packages/monorepo/tsconfig.json diff --git a/web/packages/monorepo/types/global.d.ts b/web/packages/monorepo/types/global.d.ts new file mode 100644 index 0000000000..90ebfa5555 --- /dev/null +++ b/web/packages/monorepo/types/global.d.ts @@ -0,0 +1,15 @@ +declare module "process" { + global { + namespace NodeJS { + interface ProcessEnv { + /** + * An environment variable used to determine + * whether Node.js is running in production mode. + * + * @see {@link https://nodejs.org/en/learn/getting-started/nodejs-the-difference-between-development-and-production | The difference between development and production} + */ + NODE_ENV?: "production" | "development"; + } + } + } +} diff --git a/packages/monorepo/version.js b/web/packages/monorepo/version.js similarity index 94% rename from packages/monorepo/version.js rename to web/packages/monorepo/version.js index ba8ab6a345..e738968d7b 100644 --- a/packages/monorepo/version.js +++ b/web/packages/monorepo/version.js @@ -1,6 +1,6 @@ import { execSync } from "node:child_process"; -import PackageJSON from "../../package.json" with { type: "json" }; +import PackageJSON from "../../../package.json" with { type: "json" }; import { MonoRepoRoot } from "./paths.js"; /** diff --git a/web/paths.js b/web/paths.js new file mode 100644 index 0000000000..5d9dac17de --- /dev/null +++ b/web/paths.js @@ -0,0 +1,78 @@ +import { dirname, resolve } from "node:path"; +import { fileURLToPath } from "node:url"; + +const relativeDirname = dirname(fileURLToPath(import.meta.url)); + +//#region Base paths + +/** + * @typedef {'@goauthentik/web'} WebPackageIdentifier + */ + +/** + * The root of the web package. + */ +export const PackageRoot = /** @type {WebPackageIdentifier} */ (resolve(relativeDirname)); + +/** + * The name of the distribution directory. + */ +export const DistDirectoryName = "dist"; + +/** + * Path to the web package's distribution directory. + * + * This is where the built files are located after running the build process. + */ +export const DistDirectory = /** @type {`${WebPackageIdentifier}/${DistDirectoryName}`} */ ( + resolve(relativeDirname, DistDirectoryName) +); + +//#endregion + +//#region Entry points + +/** + * @typedef {{ in: string, out: string }} EntryPointTarget + * + * ESBuild entrypoint target. + * Matches the type defined in the ESBuild context. + */ + +/** + * Entry points available for building. + * + * @satisfies {Record} + */ +export const EntryPoint = /** @type {const} */ ({ + Admin: { + in: resolve(PackageRoot, "src", "admin", "AdminInterface", "index.entrypoint.ts"), + out: resolve(DistDirectory, "admin", "AdminInterface"), + }, + User: { + in: resolve(PackageRoot, "src", "user", "index.entrypoint.ts"), + out: resolve(DistDirectory, "user", "UserInterface"), + }, + Flow: { + in: resolve(PackageRoot, "src", "flow", "index.entrypoint.ts"), + out: resolve(DistDirectory, "flow", "FlowInterface"), + }, + Standalone: { + in: resolve(PackageRoot, "src", "standalone", "api-browser/index.entrypoint.ts"), + out: resolve(DistDirectory, "standalone", "api-browser", "index"), + }, + StandaloneLoading: { + in: resolve(PackageRoot, "src", "standalone", "loading/index.entrypoint.ts"), + out: resolve(DistDirectory, "standalone", "loading", "index"), + }, + RAC: { + in: resolve(PackageRoot, "src", "rac", "index.entrypoint.ts"), + out: resolve(DistDirectory, "rac", "index"), + }, + Polyfill: { + in: resolve(PackageRoot, "src", "polyfill", "index.entrypoint.ts"), + out: resolve(DistDirectory, "poly"), + }, +}); + +//#endregion diff --git a/web/scripts/build-web.mjs b/web/scripts/build-web.mjs index 07a14e246a..3b1f329e23 100644 --- a/web/scripts/build-web.mjs +++ b/web/scripts/build-web.mjs @@ -4,138 +4,86 @@ * @import { BuildOptions } from "esbuild"; */ import { liveReloadPlugin } from "@goauthentik/esbuild-plugin-live-reload/plugin"; -import { execFileSync } from "child_process"; +import { + MonoRepoRoot, + NodeEnvironment, + readBuildIdentifier, + resolvePackage, + serializeEnvironmentVars, +} from "@goauthentik/monorepo"; +import { DistDirectory, DistDirectoryName, EntryPoint, PackageRoot } from "@goauthentik/web/paths"; import { deepmerge } from "deepmerge-ts"; import esbuild from "esbuild"; +import copy from "esbuild-plugin-copy"; import { polyfillNode } from "esbuild-plugin-polyfill-node"; -import { copyFileSync, mkdirSync, readFileSync, statSync } from "fs"; -import { globSync } from "glob"; -import * as path from "path"; -import { cwd } from "process"; -import process from "process"; -import { fileURLToPath } from "url"; +import * as fs from "node:fs/promises"; +import * as path from "node:path"; import { mdxPlugin } from "./esbuild/build-mdx-plugin.mjs"; -const __dirname = fileURLToPath(new URL(".", import.meta.url)); -let authentikProjectRoot = path.join(__dirname, "..", ".."); +const logPrefix = "[Build]"; -try { - // Use the package.json file in the root folder, as it has the current version information. - authentikProjectRoot = execFileSync("git", ["rev-parse", "--show-toplevel"], { - encoding: "utf8", - }).replace("\n", ""); -} catch (_error) { - // We probably don't have a .git folder, which could happen in container builds. -} +const definitions = serializeEnvironmentVars({ + NODE_ENV: NodeEnvironment, + CWD: process.cwd(), + AK_API_BASE_PATH: process.env.AK_API_BASE_PATH, +}); -const packageJSONPath = path.join(authentikProjectRoot, "./package.json"); -const rootPackage = JSON.parse(readFileSync(packageJSONPath, "utf8")); - -const NODE_ENV = process.env.NODE_ENV || "development"; -const AK_API_BASE_PATH = process.env.AK_API_BASE_PATH || ""; - -const environmentVars = new Map([ - ["NODE_ENV", NODE_ENV], - ["CWD", cwd()], - ["AK_API_BASE_PATH", AK_API_BASE_PATH], -]); - -const definitions = Object.fromEntries( - Array.from(environmentVars).map(([key, value]) => { - return [`process.env.${key}`, JSON.stringify(value)]; - }), -); +const patternflyPath = resolvePackage("@patternfly/patternfly"); /** - * All is magic is just to make sure the assets are copied into the right places. This is a very - * stripped down version of what the rollup-copy-plugin does, without any of the features we don't - * use, and using globSync instead of globby since we already had globSync lying around thanks to - * Typescript. If there's a third argument in an array entry, it's used to replace the internal path - * before concatenating it all together as the destination target. - * @type {Array<[string, string, string?]>} - */ -const assetsFileMappings = [ - ["node_modules/@patternfly/patternfly/patternfly.min.css", "."], - ["node_modules/@patternfly/patternfly/assets/**", ".", "node_modules/@patternfly/patternfly/"], - ["src/common/styles/**", "."], - ["src/assets/images/**", "./assets/images"], - ["./icons/*", "./assets/icons"], -]; - -/** - * @param {string} filePath - */ -const isFile = (filePath) => statSync(filePath).isFile(); - -/** - * @param {string} src Source file - * @param {string} dest Destination folder - * @param {string} [strip] Path to strip from the source file - */ -function nameCopyTarget(src, dest, strip) { - const target = path.join(dest, strip ? src.replace(strip, "") : path.parse(src).base); - return [src, target]; -} - -for (const [source, rawdest, strip] of assetsFileMappings) { - const matchedPaths = globSync(source); - const dest = path.join("dist", rawdest); - - const copyTargets = matchedPaths.map((path) => nameCopyTarget(path, dest, strip)); - - for (const [src, dest] of copyTargets) { - if (isFile(src)) { - mkdirSync(path.dirname(dest), { recursive: true }); - copyFileSync(src, dest); - } - } -} - -/** - * @typedef {[source: string, destination: string]} EntryPoint - */ - -/** - * This starts the definitions used for esbuild: Our targets, our arguments, the function for - * running a build, and three options for building: watching, building, and building the proxy. - * Ordered by largest to smallest interface to build even faster - * - * @type {EntryPoint[]} - */ -const entryPoints = [ - ["admin/AdminInterface/AdminInterface.ts", "admin"], - ["user/UserInterface.ts", "user"], - ["flow/FlowInterface.ts", "flow"], - ["standalone/api-browser/index.ts", "standalone/api-browser"], - ["rac/index.ts", "rac"], - ["standalone/loading/index.ts", "standalone/loading"], - ["polyfill/poly.ts", "."], -]; - -/** - * @type {import("esbuild").BuildOptions} + * @type {Readonly} */ const BASE_ESBUILD_OPTIONS = { + entryNames: `[dir]/[name]-${readBuildIdentifier()}`, + chunkNames: "[dir]/chunks/[name]-[hash]", + assetNames: "assets/[dir]/[name]-[hash]", + publicPath: path.join("/static", DistDirectoryName), + outdir: DistDirectory, bundle: true, write: true, sourcemap: true, - minify: NODE_ENV === "production", + minify: NodeEnvironment === "production", + legalComments: "external", splitting: true, treeShaking: true, external: ["*.woff", "*.woff2"], - tsconfig: path.resolve(__dirname, "..", "tsconfig.build.json"), + tsconfig: path.resolve(PackageRoot, "tsconfig.build.json"), loader: { ".css": "text", }, plugins: [ + copy({ + assets: [ + { + from: path.join(patternflyPath, "patternfly.min.css"), + to: ".", + }, + { + from: path.join(patternflyPath, "assets", "**"), + to: "./assets", + }, + { + from: path.resolve(PackageRoot, "src", "common", "styles", "**"), + to: ".", + }, + { + from: path.resolve(PackageRoot, "src", "assets", "images", "**"), + to: "./assets/images", + }, + { + from: path.resolve(PackageRoot, "icons", "*"), + to: "./assets/icons", + }, + ], + }), polyfillNode({ polyfills: { path: true, }, }), mdxPlugin({ - root: authentikProjectRoot, + root: MonoRepoRoot, }), ], define: definitions, @@ -151,69 +99,43 @@ const BASE_ESBUILD_OPTIONS = { }, }; -/** - * Creates a version ID for the build. - * @returns {string} - */ -function composeVersionID() { - const { version } = rootPackage; - const buildHash = process.env.GIT_BUILD_HASH; +async function cleanDistDirectory() { + const timerLabel = `${logPrefix} ♻️ Cleaning previous builds...`; - if (buildHash) { - return `${version}+${buildHash}`; - } + console.time(timerLabel); - return version; + await fs.rm(DistDirectory, { + recursive: true, + force: true, + }); + + await fs.mkdir(DistDirectory, { + recursive: true, + }); + + console.timeEnd(timerLabel); } /** - * Build a single entry point. + * Creates an ESBuild options, extending the base options with the given overrides. * - * @param {EntryPoint} buildTarget - * @param {Partial} [overrides] - * @throws {Error} on build failure + * @param {BuildOptions} overrides + * @returns {BuildOptions} */ -function createEntryPointOptions([source, dest], overrides = {}) { - const outdir = path.join(__dirname, "..", "dist", dest); - +export function createESBuildOptions(overrides) { /** - * @type {esbuild.BuildOptions} + * @type {BuildOptions} */ + const mergedOptions = deepmerge(BASE_ESBUILD_OPTIONS, overrides); - const entryPointConfig = { - entryPoints: [`./src/${source}`], - entryNames: `[dir]/[name]-${composeVersionID()}`, - publicPath: path.join("/static", "dist", dest), - outdir, - }; - - /** - * @type {esbuild.BuildOptions} - */ - const mergedConfig = deepmerge(BASE_ESBUILD_OPTIONS, entryPointConfig, overrides); - - return mergedConfig; -} - -/** - * Build all entry points in parallel. - * - * @param {EntryPoint[]} entryPoints - * @returns {Promise} - */ -async function buildParallel(entryPoints) { - return Promise.all( - entryPoints.map((entryPoint) => { - return esbuild.build(createEntryPointOptions(entryPoint)); - }), - ); + return mergedOptions; } function doHelp() { console.log(`Build the authentik UI options: - -w, --watch: Build all ${entryPoints.length} interfaces + -w, --watch: Build all interfaces -p, --proxy: Build only the polyfills and the loading application -h, --help: This help message `); @@ -222,27 +144,29 @@ function doHelp() { } async function doWatch() { - console.log("Watching all entry points..."); + console.group(`${logPrefix} 🤖 Watching entry points`); - const buildContexts = await Promise.all( - entryPoints.map((entryPoint) => { - return esbuild.context( - createEntryPointOptions(entryPoint, { - define: definitions, - plugins: [ - liveReloadPlugin({ - logPrefix: `Build Observer (${entryPoint[1]})`, - relativeRoot: path.join(__dirname, ".."), - }), - ], - }), - ); - }), - ); + const entryPoints = Object.entries(EntryPoint).map(([entrypointID, target]) => { + console.log(entrypointID); - await Promise.all(buildContexts.map((context) => context.rebuild())); + return target; + }); - await Promise.allSettled(buildContexts.map((context) => context.watch())); + console.groupEnd(); + + const buildOptions = createESBuildOptions({ + entryPoints, + plugins: [ + liveReloadPlugin({ + relativeRoot: PackageRoot, + }), + ], + }); + + const buildContext = await esbuild.context(buildOptions); + + await buildContext.rebuild(); + await buildContext.watch(); return /** @type {Promise} */ ( new Promise((resolve) => { @@ -254,15 +178,34 @@ async function doWatch() { } async function doBuild() { - console.log("Building all entry points"); + console.group(`${logPrefix} 🚀 Building entry points:`); - return buildParallel(entryPoints); + const entryPoints = Object.entries(EntryPoint).map(([entrypointID, target]) => { + console.log(entrypointID); + + return target; + }); + + console.groupEnd(); + + const buildOptions = createESBuildOptions({ + entryPoints, + }); + + await esbuild.build(buildOptions); + + console.log("Build complete"); } async function doProxy() { - return buildParallel( - entryPoints.filter(([_, dest]) => ["standalone/loading", "."].includes(dest)), - ); + const entryPoints = [EntryPoint.StandaloneLoading]; + + const buildOptions = createESBuildOptions({ + entryPoints, + }); + + await esbuild.build(buildOptions); + console.log("Proxy build complete"); } async function delegateCommand() { @@ -284,12 +227,16 @@ async function delegateCommand() { } } -await delegateCommand() - .then(() => { - console.log("Build complete"); - process.exit(0); - }) - .catch((error) => { - console.error(error); - process.exit(1); - }); +await cleanDistDirectory() + // --- + .then(() => + delegateCommand() + .then(() => { + console.log("Build complete"); + process.exit(0); + }) + .catch((error) => { + console.error(error); + process.exit(1); + }), + ); diff --git a/web/src/admin/AdminInterface/AdminInterface.ts b/web/src/admin/AdminInterface/index.entrypoint.ts similarity index 100% rename from web/src/admin/AdminInterface/AdminInterface.ts rename to web/src/admin/AdminInterface/index.entrypoint.ts diff --git a/web/src/admin/AdminInterface/index.ts b/web/src/admin/AdminInterface/index.ts deleted file mode 100644 index 570b87e3bc..0000000000 --- a/web/src/admin/AdminInterface/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { AdminInterface } from "./AdminInterface"; -import "./AdminInterface"; - -export { AdminInterface }; -export default AdminInterface; diff --git a/web/src/admin/users/UserListPage.ts b/web/src/admin/users/UserListPage.ts index a0c8b7da6f..f54cf58210 100644 --- a/web/src/admin/users/UserListPage.ts +++ b/web/src/admin/users/UserListPage.ts @@ -1,4 +1,4 @@ -import { AdminInterface } from "@goauthentik/admin/AdminInterface"; +import type { AdminInterface } from "@goauthentik/admin/AdminInterface/index.entrypoint.js"; import "@goauthentik/admin/users/ServiceAccountForm"; import "@goauthentik/admin/users/UserActiveForm"; import "@goauthentik/admin/users/UserForm"; diff --git a/web/src/elements/sidebar/SidebarVersion.ts b/web/src/elements/sidebar/SidebarVersion.ts index 35b1e2f253..bc6440139e 100644 --- a/web/src/elements/sidebar/SidebarVersion.ts +++ b/web/src/elements/sidebar/SidebarVersion.ts @@ -1,4 +1,4 @@ -import type { AdminInterface } from "@goauthentik/admin/AdminInterface/AdminInterface"; +import type { AdminInterface } from "@goauthentik/admin/AdminInterface/index.entrypoint.js"; import { globalAK } from "@goauthentik/common/global"; import { DefaultBrand } from "@goauthentik/common/ui/config"; import { AKElement, rootInterface } from "@goauthentik/elements/Base"; diff --git a/web/src/flow/FlowInterface.ts b/web/src/flow/index.entrypoint.ts similarity index 100% rename from web/src/flow/FlowInterface.ts rename to web/src/flow/index.entrypoint.ts diff --git a/web/src/polyfill/poly.ts b/web/src/polyfill/index.entrypoint.ts similarity index 91% rename from web/src/polyfill/poly.ts rename to web/src/polyfill/index.entrypoint.ts index 08d103117a..2703f69c89 100644 --- a/web/src/polyfill/poly.ts +++ b/web/src/polyfill/index.entrypoint.ts @@ -1,3 +1,4 @@ +// sort-imports-ignore import "construct-style-sheets-polyfill"; import "@webcomponents/webcomponentsjs"; import "lit/polyfill-support.js"; diff --git a/web/src/rac/index.ts b/web/src/rac/index.entrypoint.ts similarity index 100% rename from web/src/rac/index.ts rename to web/src/rac/index.entrypoint.ts diff --git a/web/src/standalone/api-browser/index.ts b/web/src/standalone/api-browser/index.entrypoint.ts similarity index 100% rename from web/src/standalone/api-browser/index.ts rename to web/src/standalone/api-browser/index.entrypoint.ts diff --git a/web/src/standalone/loading/index.ts b/web/src/standalone/loading/index.entrypoint.ts similarity index 100% rename from web/src/standalone/loading/index.ts rename to web/src/standalone/loading/index.entrypoint.ts diff --git a/web/src/user/LibraryApplication/index.ts b/web/src/user/LibraryApplication/index.ts index 2f672882bc..6a25826f56 100644 --- a/web/src/user/LibraryApplication/index.ts +++ b/web/src/user/LibraryApplication/index.ts @@ -6,7 +6,7 @@ import { AKElement, rootInterface } from "@goauthentik/elements/Base"; import "@goauthentik/elements/Expand"; import "@goauthentik/user/LibraryApplication/RACLaunchEndpointModal"; import type { RACLaunchEndpointModal } from "@goauthentik/user/LibraryApplication/RACLaunchEndpointModal"; -import { UserInterface } from "@goauthentik/user/UserInterface"; +import type { UserInterface } from "@goauthentik/user/index.entrypoint.js"; import { msg } from "@lit/localize"; import { CSSResult, TemplateResult, css, html, nothing } from "lit"; diff --git a/web/src/user/UserInterface.ts b/web/src/user/index.entrypoint.ts similarity index 100% rename from web/src/user/UserInterface.ts rename to web/src/user/index.entrypoint.ts diff --git a/web/src/user/user-settings/UserSettingsPage.ts b/web/src/user/user-settings/UserSettingsPage.ts index cf4b09ff18..038cfcf3b1 100644 --- a/web/src/user/user-settings/UserSettingsPage.ts +++ b/web/src/user/user-settings/UserSettingsPage.ts @@ -5,7 +5,7 @@ import "@goauthentik/elements/Tabs"; import "@goauthentik/elements/user/SessionList"; import "@goauthentik/elements/user/UserConsentList"; import "@goauthentik/elements/user/sources/SourceSettings"; -import { UserInterface } from "@goauthentik/user/UserInterface"; +import type { UserInterface } from "@goauthentik/user/index.entrypoint.js"; import "@goauthentik/user/user-settings/details/UserPassword"; import "@goauthentik/user/user-settings/details/UserSettingsFlowExecutor"; import "@goauthentik/user/user-settings/mfa/MFADevicesPage"; diff --git a/web/tsconfig.json b/web/tsconfig.json index 3ec01581d7..bc496a7c77 100644 --- a/web/tsconfig.json +++ b/web/tsconfig.json @@ -61,5 +61,5 @@ { "path": "./packages/esbuild-plugin-live-reload" } - ], + ] } diff --git a/web/types/global.d.ts b/web/types/global.d.ts index 5edb41ecd5..4418fb7e9f 100644 --- a/web/types/global.d.ts +++ b/web/types/global.d.ts @@ -2,17 +2,27 @@ * @file Environment variables available via ESBuild. */ +declare module "module" { + global { + /** + * @deprecated This is not present in ESM files. + * + * ```js + * import { dirname } from "node:path"; + * import { fileURLToPath } from "node:url"; + * + * const relativeDirname = dirname(fileURLToPath(import.meta.url)); + * ``` + */ + // eslint-disable-next-line no-var + var __dirname: string; + } +} + declare module "process" { global { namespace NodeJS { interface ProcessEnv { - NODE_ENV: "production" | "development"; - /** - * - * @todo Determine where this is used and if it is needed, - * give it a better name. - * @deprecated - */ CWD: string; /** * @todo Determine where this is used and if it is needed,