Matthieu Sieben 09d90ae486
Improve OAuth Example app (#3952)
* Improve OAuth Example app

* Improve style

* bsync: Accept NSID with fragment in operation ns (#3954)

* Add `match: MuteWordMatch` to `muted-word` mod decision `cause` (#2934)

* Return MuteWordMatch instead of simple boolean

* Return full mute word with match

* Add MuteWordMatch to decision cause, update a few tests

* Backwards compat

* Tighter types

* Return all mute word matches

* Clean up types

* Rename

* More cleanup of naming

* Remove unneeded changes

* Format

* Add predicate value to matches

* Better migration path

* Changeset

* Import sort

* Tighten up addMuteWord API

Co-authored-by: Matthieu Sieben <matthieusieben@users.noreply.github.com>

* Mute words: handle `Andor` and `and/or` case (#3948)

* Handle Andor case

* Remove useless escape

* Changeset

---------

Co-authored-by: Matthieu Sieben <matthieusieben@users.noreply.github.com>

* Version packages (#3947)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Update README.md to add some missing details in examples (#3254)

Update README.md

Improve code examples (some OAuth implementation details are missing in these examples)

* Increase oauth session & refresh token lifetimes (#3883)

* Allow HTTPS `redirect_uris` from any origin (#3811)

* bump MST key length from 256 to 1024 chars (#3956)

* bump MST key length from 256 to 1024 chars

* update MST key test

* add a changeset

* Version packages (#3959)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Rename `filter` -> `include` (#3966)

* rename filter -> include

* changeset

* fix tests

* Minor Fixes: Typo Correction and Comment Update (#3961)

* Update blob-resolver.ts

* Update index.ts

* Appview: sync up protos for notification prefs (#3970)

appview: sync up protos for notification prefs

* Version packages (#3969)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Fix invalid use of `invalid_client` (#3967)

* Replace slice() with subarray() in car file parsing (#3971)

* Replace slice() with subarray() in car file parsing

* changeset

---------

Co-authored-by: Devin Ivy <devinivy@gmail.com>

* Re-export all types & utilities needed to instantiate an OAuth client (#3976)

* Re-export all types & utilities needed to instantiate an OAuth client

* Add `jwkPrivateSchema` to ensure a key is private

* Return object instead of array as result of `findPrivateKey`

* Allow override of default `handleResolver` and `runtimeImplementation` options for NodeOAuthClient

* changeset

* Allow `OAuthClient` to be instantiated with custom `didResolver` instance

* Version packages (#3975)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* Perform a bi-directional check when resolving identity from did (#3977)

* Perform a bi-directional check when resolving identity from did

* tidy

* Reject did documents containing invalid `alsoKnownAs` ATProto handles

* Use error classes

* tidy

* Improve identity resolution

* tidy

* Allow non-normalized handles in did document

* pnpm-lock

* Version packages (#3979)

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

* repo: MST should allow tilde in keys (#3981)

* repo: MST should allow tilde in keys

* add changeset

* fic ci

* tidy

* tidy

---------

Co-authored-by: rafael <rafael@blueskyweb.xyz>
Co-authored-by: Eric Bailey <git@esb.lol>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: James Futhey <kidGodzilla@users.noreply.github.com>
Co-authored-by: bnewbold <bnewbold@robocracy.org>
Co-authored-by: Samuel Newman <mozzius@protonmail.com>
Co-authored-by: leopardracer <136604165+leopardracer@users.noreply.github.com>
Co-authored-by: devin ivy <devinivy@gmail.com>
Co-authored-by: Paul Frazee <pfrazee@gmail.com>
2025-06-23 17:31:02 +02:00

125 lines
3.8 KiB
JavaScript

/* eslint-env node */
const { default: commonjs } = require('@rollup/plugin-commonjs')
const { default: html, makeHtmlAttributes } = require('@rollup/plugin-html')
const { default: json } = require('@rollup/plugin-json')
const { default: nodeResolve } = require('@rollup/plugin-node-resolve')
const { default: swc } = require('@rollup/plugin-swc')
const { defineConfig } = require('rollup')
const {
bundleManifest,
} = require('@atproto-labs/rollup-plugin-bundle-manifest')
const postcss = ((m) => m.default || m)(require('rollup-plugin-postcss'))
const serve = ((m) => m.default || m)(require('rollup-plugin-serve'))
module.exports = defineConfig((commandLineArguments) => {
const NODE_ENV =
process.env['NODE_ENV'] ??
(commandLineArguments.watch ? 'development' : 'production')
const devMode = NODE_ENV === 'development'
return {
input: 'src/main.tsx',
output: {
manualChunks: undefined,
sourcemap: true,
file: 'dist/main.js',
format: 'iife',
},
plugins: [
{
name: 'resolve-swc-helpers',
resolveId(src) {
// For some reason, "nodeResolve" doesn't resolve these:
if (src.startsWith('@swc/helpers/')) return require.resolve(src)
},
},
nodeResolve({ preferBuiltins: false, browser: true }),
commonjs(),
json(),
postcss({ config: true, extract: true, minimize: false }),
swc({
swc: {
swcrc: false,
configFile: false,
sourceMaps: true,
minify: !devMode,
jsc: {
minify: {
compress: {
module: true,
unused: true,
},
mangle: true,
},
externalHelpers: true,
target: 'es2020',
parser: { syntax: 'typescript', tsx: true },
transform: {
useDefineForClassFields: true,
react: { runtime: 'automatic' },
optimizer: {
simplify: true,
globals: {
vars: { 'process.env.NODE_ENV': JSON.stringify(NODE_ENV) },
},
},
},
},
},
}),
html({
title: 'OAuth Client Example',
template: ({ attributes, files, meta, publicPath, title }) => `
<!DOCTYPE html>
<html${makeHtmlAttributes(attributes.html)}>
<head>
${meta
.map((attrs) => `<meta${makeHtmlAttributes(attrs)}>`)
.join('\n')}
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>${title}</title>
${files.css
.map(
(asset) =>
`<link${makeHtmlAttributes({
...attributes.link,
rel: 'stylesheet',
href: `${publicPath}${asset.fileName}`,
})}>`,
)
.join('\n')}
</head>
<body class="bg-slate-100 dark:bg-slate-800 min-h-screen">
<div id="root"></div>
${files.js
.map(
(asset) =>
`<script${makeHtmlAttributes({
...attributes.script,
src: `${publicPath}${asset.fileName}`,
})}></script>`,
)
.join('\n')}
</body>
</html>
`,
}),
bundleManifest({ name: 'files.json', data: true }),
commandLineArguments.watch &&
serve({
contentBase: 'dist',
port: 8080,
headers: { 'Cache-Control': 'no-store' },
}),
],
onwarn(warning, warn) {
// 'use client' directives are fine
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') return
warn(warning)
},
}
})