summaryrefslogtreecommitdiff
path: root/benchmark/packages/timer/src/index.ts
diff options
context:
space:
mode:
authorGravatar Bjorn Lu <bjornlu.dev@gmail.com> 2023-03-07 10:52:47 +0800
committerGravatar GitHub <noreply@github.com> 2023-03-07 10:52:47 +0800
commit00a0af7ed44f5bb275f570ca38bbd0b798ce84ad (patch)
tree4c15d9223bffbcd4999a1950580cbd3a02a8ae5f /benchmark/packages/timer/src/index.ts
parentaf05a4fa4637bad9b20b9928e6d2c2f894aa9139 (diff)
downloadastro-00a0af7ed44f5bb275f570ca38bbd0b798ce84ad.tar.gz
astro-00a0af7ed44f5bb275f570ca38bbd0b798ce84ad.tar.zst
astro-00a0af7ed44f5bb275f570ca38bbd0b798ce84ad.zip
Move benchmark package and update changeset config (#6433)
Diffstat (limited to 'benchmark/packages/timer/src/index.ts')
-rw-r--r--benchmark/packages/timer/src/index.ts35
1 files changed, 35 insertions, 0 deletions
diff --git a/benchmark/packages/timer/src/index.ts b/benchmark/packages/timer/src/index.ts
new file mode 100644
index 000000000..49edcb5e8
--- /dev/null
+++ b/benchmark/packages/timer/src/index.ts
@@ -0,0 +1,35 @@
+import type { AstroAdapter, AstroIntegration } from 'astro';
+
+export function getAdapter(): AstroAdapter {
+ return {
+ name: '@benchmark/timer',
+ serverEntrypoint: '@benchmark/timer/server.js',
+ previewEntrypoint: '@benchmark/timer/preview.js',
+ exports: ['handler'],
+ };
+}
+
+export default function createIntegration(): AstroIntegration {
+ return {
+ name: '@benchmark/timer',
+ hooks: {
+ 'astro:config:setup': ({ updateConfig }) => {
+ updateConfig({
+ vite: {
+ ssr: {
+ noExternal: ['@benchmark/timer'],
+ },
+ },
+ });
+ },
+ 'astro:config:done': ({ setAdapter, config }) => {
+ setAdapter(getAdapter());
+
+ if (config.output === 'static') {
+ // eslint-disable-next-line no-console
+ console.warn(`[@benchmark/timer] \`output: "server"\` is required to use this adapter.`);
+ }
+ },
+ },
+ };
+}