summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Smit Patel <thebinarymutant@users.noreply.github.com> 2023-03-28 14:14:54 +0530
committerGravatar GitHub <noreply@github.com> 2023-03-28 16:44:54 +0800
commitaff53c109c4f7b08b6b80e58e9ca5cb481131eb5 (patch)
tree5a190e9234df99a203c2645c59294a2653063b2b
parent9352e0056c54de87fb5f229fe15924672c3e6e0e (diff)
downloadastro-aff53c109c4f7b08b6b80e58e9ca5cb481131eb5.tar.gz
astro-aff53c109c4f7b08b6b80e58e9ca5cb481131eb5.tar.zst
astro-aff53c109c4f7b08b6b80e58e9ca5cb481131eb5.zip
Expose partytown config options from astro plugin (#6667)
-rw-r--r--.changeset/chilly-dingos-eat.md5
-rw-r--r--packages/integrations/partytown/README.md2
-rw-r--r--packages/integrations/partytown/src/index.ts15
3 files changed, 14 insertions, 8 deletions
diff --git a/.changeset/chilly-dingos-eat.md b/.changeset/chilly-dingos-eat.md
new file mode 100644
index 000000000..fbbd4a522
--- /dev/null
+++ b/.changeset/chilly-dingos-eat.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/partytown': minor
+---
+
+Expose more partytown config properties
diff --git a/packages/integrations/partytown/README.md b/packages/integrations/partytown/README.md
index 68a2e5533..43b611922 100644
--- a/packages/integrations/partytown/README.md
+++ b/packages/integrations/partytown/README.md
@@ -85,7 +85,7 @@ export default defineConfig({
});
```
-This mirrors the [Partytown config object](https://partytown.builder.io/configuration), but only `debug` and `forward` are exposed by this integration.
+This mirrors the [Partytown config object](https://partytown.builder.io/configuration).
### config.debug
diff --git a/packages/integrations/partytown/src/index.ts b/packages/integrations/partytown/src/index.ts
index adeab75dd..9f05ae809 100644
--- a/packages/integrations/partytown/src/index.ts
+++ b/packages/integrations/partytown/src/index.ts
@@ -1,4 +1,5 @@
import { partytownSnippet } from '@builder.io/partytown/integration';
+import type { PartytownConfig } from '@builder.io/partytown/integration';
import { copyLibFiles, libDirPath } from '@builder.io/partytown/utils';
import type { AstroConfig, AstroIntegration } from 'astro';
import * as fs from 'fs';
@@ -10,10 +11,7 @@ const resolve = createRequire(import.meta.url).resolve;
type PartytownOptions =
| {
- config?: {
- forward?: string[];
- debug?: boolean;
- };
+ config?: PartytownConfig;
}
| undefined;
@@ -31,9 +29,12 @@ export default function createPlugin(options: PartytownOptions): AstroIntegratio
hooks: {
'astro:config:setup': ({ config: _config, command, injectScript }) => {
const lib = `${appendForwardSlash(_config.base)}~partytown/`;
- const forward = options?.config?.forward || [];
- const debug = options?.config?.debug || command === 'dev';
- partytownSnippetHtml = partytownSnippet({ lib, debug, forward });
+ const partytownConfig = {
+ ...options?.config,
+ lib,
+ debug: options?.config?.debug ?? command === 'dev',
+ };
+ partytownSnippetHtml = partytownSnippet(partytownConfig);
injectScript('head-inline', partytownSnippetHtml);
},
'astro:config:done': ({ config: _config }) => {