Matthieu Sieben f9dc9aa4c9
Permission set (#4108)
* Export constants and type assertion utilities

* Add permission set support to oauth provider

* improve permission set parsing

* Rename `PermissionSet` to `ScopePermissions`

* Improve performance of NSID validation

* Add support for `permission-set` in lexicon document

* Validate NSID syntax using `@atproto/syntax`

* Export all types used in public interfaces (from `lexicon-resolver`)

* Small performance improvement

* Rework scope parsing utilities to work with Lexicon defined permissions

* file rename

* fixup! Rework scope parsing utilities to work with Lexicon defined permissions

* removed outdated comment

* removed outdated comment

* fix comment typo

* Improve `SimpleStore` api

* permission-set NSID auth scopes

* Remove dev dependency on dev-env

* fix build script

* pnpm-lock

* Improve fetch-node unicast protection

* Explicitly set the `redirect: "follow"` `fetch()` option

* Add delay when building oauth-provider-ui in watch mode

* Remove external dependencies from auth-scopes

* Add customizable lexicon authority to pds (for dev purposes)

* fix pds migration

* update permission-set icon

* Add support for `include:` syntax in scopes

* tidy

* Renaming of "resource" concept to better reflect the fact that not all oauth scope values are about resources

* changeset

* ui improvmeents

* i18n

* ui imporvements

* add `AtprotoAudience` type

* Enforce proper formatting of audience (atproto supported did + fragment part)

* tidy

* tidy

* tidy

* fix ci ?

* ci fix ?

* tidy ?

* Apply consistent outline around focusable items

* Use `inheritAud: true` to control `aud` inheritance

* Update packages/oauth/oauth-provider/src/lexicon/lexicon-manager.ts

Co-authored-by: devin ivy <devinivy@gmail.com>

* Review comments

* Add `nsid` property to `LexiconResolutionError`

* improve nsid validation

* i18n

* Improve oauth scope parsing

* Simplify lex scope parsing

* tidy

* docs

* tidy

* ci

* Code simplification

* tidy

* improve type safety

* improve deps graph

* naming

* Improve tests and package structure

* Improve error when resolving a non permission-set

* improve nsid parsing perfs

* benchmark

* Refactor ozone and lexicon into using a common service profile mechanism

* improve perfs

* ci fix (?)

* tidy

* Allow storage of valid lexicons in lexicon store

* Improve handling of lexicon resolution failures

* review comment

* Test both regexp and non regexp based nsid validation

* properly detect presence of port number in https did:web

* Re-enable logging of `safeFetch` requests

* tidy

---------

Co-authored-by: devin ivy <devinivy@gmail.com>
2025-08-29 12:19:19 +02:00

67 lines
1.8 KiB
JavaScript

import { dirname, resolve } from 'node:path'
import { fileURLToPath } from 'node:url'
import { lingui } from '@lingui/vite-plugin'
import tailwindcss from '@tailwindcss/vite'
import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite'
import { bundleManifest } from '@atproto-labs/rollup-plugin-bundle-manifest'
const __dirname = dirname(fileURLToPath(import.meta.url))
export default defineConfig({
resolve: {
alias: {
'#': resolve(__dirname, './src'),
},
},
plugins: [
react({
plugins: [['@lingui/swc-plugin', {}]],
}),
lingui(),
tailwindcss(),
],
build: {
emptyOutDir: false,
outDir: './dist',
sourcemap: true,
rollupOptions: {
input: ['./src/authorization-page.tsx', './src/error-page.tsx'],
output: {
manualChunks: undefined,
format: 'module',
entryFileNames: '[name]-[hash].js',
chunkFileNames: '[name]-[hash].js',
assetFileNames: '[name]-[hash][extname]',
},
plugins: [bundleManifest()],
},
commonjsOptions: {
include: [
/node_modules/,
/did/,
/oauth-scopes/,
/oauth-provider-api/,
/syntax/,
],
},
// this
// @NOTE the "env" arg (when defineConfig is used with a function) does not
// allow to detect watch mode. We do want to set the "buildDelay" though to
// avoid i18n compilation to trigger too many build (and restart of
// dependent services).
watch: process.argv.includes('--watch')
? { buildDelay: 500, clearScreen: false }
: undefined,
},
optimizeDeps: {
// Needed because this is a monorepo and it exposes CommonJS
include: [
'@atproto/oauth-provider-api',
'@atproto/did',
'@atproto/oauth-scopes',
'@atproto/syntax',
],
},
})