@posthog/nuxt 1.7.1 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "compatibility": {
5
5
  "nuxt": ">=3.7.0"
6
6
  },
7
- "version": "1.7.1",
7
+ "version": "1.7.3",
8
8
  "builder": {
9
9
  "@nuxt/module-builder": "1.0.2",
10
10
  "unbuild": "unknown"
package/dist/module.mjs CHANGED
@@ -5,6 +5,17 @@ import { dirname } from 'node:path';
5
5
 
6
6
  const filename = fileURLToPath(import.meta.url);
7
7
  const resolvedDirname = dirname(filename);
8
+ const DEFAULT_NUXT_HOST = "https://us.i.posthog.com";
9
+ function normalizeApiKey(value) {
10
+ return typeof value === "string" ? value.trim() : "";
11
+ }
12
+ function normalizePersonalApiKey(value) {
13
+ return typeof value === "string" ? value.trim() : "";
14
+ }
15
+ function normalizeHost(value) {
16
+ const normalizedValue = typeof value === "string" ? value.trim() : "";
17
+ return normalizedValue || DEFAULT_NUXT_HOST;
18
+ }
8
19
  const module$1 = defineNuxtModule({
9
20
  meta: {
10
21
  name: "@posthog/nuxt",
@@ -21,13 +32,15 @@ const module$1 = defineNuxtModule({
21
32
  }),
22
33
  setup(options, nuxt) {
23
34
  const resolver = createResolver(import.meta.url);
35
+ const normalizedPublicKey = normalizeApiKey(options.publicKey);
36
+ const normalizedHost = normalizeHost(options.host);
24
37
  addPlugin(resolver.resolve("./runtime/vue-plugin"));
25
38
  addServerPlugin(resolver.resolve("./runtime/nitro-plugin"));
26
39
  addImportsDir(resolver.resolve("./runtime/composables"));
27
40
  Object.assign(nuxt.options.runtimeConfig.public, {
28
41
  posthog: {
29
- publicKey: options.publicKey,
30
- host: options.host,
42
+ publicKey: normalizedPublicKey,
43
+ host: normalizedHost,
31
44
  debug: options.debug
32
45
  },
33
46
  posthogClientConfig: options.clientConfig
@@ -74,9 +87,9 @@ const module$1 = defineNuxtModule({
74
87
  const cliEnv = {
75
88
  ...process.env,
76
89
  RUST_LOG: `posthog_cli=${logLevel}`,
77
- POSTHOG_CLI_HOST: options.host,
90
+ POSTHOG_CLI_HOST: normalizedHost,
78
91
  POSTHOG_CLI_PROJECT_ID: projectId,
79
- POSTHOG_CLI_API_KEY: sourcemapsConfig.personalApiKey
92
+ POSTHOG_CLI_API_KEY: normalizePersonalApiKey(sourcemapsConfig.personalApiKey)
80
93
  };
81
94
  return (args) => {
82
95
  return spawnLocal(cliBinaryPath, args, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/nuxt",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "Nuxt module for Posthog 🦔",
5
5
  "repository": {
6
6
  "type": "git",
@@ -25,10 +25,10 @@
25
25
  "dependencies": {
26
26
  "@posthog/cli": "~0.7.3",
27
27
  "@nuxt/kit": ">=3.7.0",
28
- "posthog-node": "5.29.2",
29
- "@posthog/plugin-utils": "1.1.0",
30
- "@posthog/core": "1.25.2",
31
- "posthog-js": "1.369.4"
28
+ "posthog-node": "5.29.4",
29
+ "@posthog/plugin-utils": "1.1.1",
30
+ "@posthog/core": "1.25.3",
31
+ "posthog-js": "1.369.5"
32
32
  },
33
33
  "devDependencies": {
34
34
  "@types/node": "^20.0.0",