@posthog/nuxt 0.0.8 → 0.0.10
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 +1 -1
- package/dist/module.mjs +36 -46
- package/dist/runtime/nitro-plugin.js +3 -0
- package/package.json +4 -4
package/dist/module.json
CHANGED
package/dist/module.mjs
CHANGED
|
@@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
import { dirname } from 'node:path';
|
|
5
5
|
|
|
6
6
|
const VUE_OUTPUT_DIRECTORY = ".output/public";
|
|
7
|
-
const NITRO_OUTPUT_DIRECTORY = ".output/server
|
|
7
|
+
const NITRO_OUTPUT_DIRECTORY = ".output/server";
|
|
8
8
|
const filename = fileURLToPath(import.meta.url);
|
|
9
9
|
const resolvedDirname = dirname(filename);
|
|
10
10
|
const module = defineNuxtModule({
|
|
@@ -34,12 +34,29 @@ const module = defineNuxtModule({
|
|
|
34
34
|
return;
|
|
35
35
|
}
|
|
36
36
|
const sourcemapsConfig = options.sourcemaps;
|
|
37
|
+
const cliEnv = {
|
|
38
|
+
...process.env,
|
|
39
|
+
POSTHOG_CLI_ENV_ID: sourcemapsConfig.envId,
|
|
40
|
+
POSTHOG_CLI_TOKEN: sourcemapsConfig.personalApiKey
|
|
41
|
+
};
|
|
42
|
+
const sharedInjectOptions = [
|
|
43
|
+
"--host",
|
|
44
|
+
options.host,
|
|
45
|
+
"sourcemap",
|
|
46
|
+
"inject",
|
|
47
|
+
"--ignore",
|
|
48
|
+
"**/node_modules/**"
|
|
49
|
+
];
|
|
50
|
+
if (options.sourcemaps.project) {
|
|
51
|
+
sharedInjectOptions.push("--project", options.sourcemaps.project);
|
|
52
|
+
}
|
|
53
|
+
if (options.sourcemaps.version) {
|
|
54
|
+
sharedInjectOptions.push("--version", options.sourcemaps.version);
|
|
55
|
+
}
|
|
37
56
|
nuxt.hooks.hook("nitro:build:public-assets", async () => {
|
|
38
57
|
try {
|
|
39
|
-
await spawnLocal("posthog-cli", [
|
|
40
|
-
env:
|
|
41
|
-
...process.env
|
|
42
|
-
},
|
|
58
|
+
await spawnLocal("posthog-cli", [...sharedInjectOptions, "--directory", VUE_OUTPUT_DIRECTORY], {
|
|
59
|
+
env: cliEnv,
|
|
43
60
|
cwd: process.cwd(),
|
|
44
61
|
resolveFrom: resolvedDirname,
|
|
45
62
|
stdio: "inherit",
|
|
@@ -52,10 +69,8 @@ const module = defineNuxtModule({
|
|
|
52
69
|
});
|
|
53
70
|
nuxt.hooks.hook("close", async () => {
|
|
54
71
|
try {
|
|
55
|
-
await spawnLocal("posthog-cli", [
|
|
56
|
-
env:
|
|
57
|
-
...process.env
|
|
58
|
-
},
|
|
72
|
+
await spawnLocal("posthog-cli", [...sharedInjectOptions, "--directory", NITRO_OUTPUT_DIRECTORY], {
|
|
73
|
+
env: cliEnv,
|
|
59
74
|
cwd: process.cwd(),
|
|
60
75
|
resolveFrom: resolvedDirname,
|
|
61
76
|
stdio: "inherit",
|
|
@@ -65,44 +80,19 @@ const module = defineNuxtModule({
|
|
|
65
80
|
} catch (error) {
|
|
66
81
|
console.error("PostHog sourcemap inject failed:", error);
|
|
67
82
|
}
|
|
68
|
-
const
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
serverUploadBaseOptions.push("--version", sourcemapsConfig.version);
|
|
79
|
-
}
|
|
80
|
-
if (sourcemapsConfig.project) {
|
|
81
|
-
serverUploadBaseOptions.push("--project", sourcemapsConfig.project);
|
|
82
|
-
}
|
|
83
|
-
const nitroUploadConfig = [...serverUploadBaseOptions, "--directory", NITRO_OUTPUT_DIRECTORY];
|
|
84
|
-
const vueUploadConfig = [...serverUploadBaseOptions, "--directory", VUE_OUTPUT_DIRECTORY];
|
|
85
|
-
try {
|
|
86
|
-
await spawnLocal("posthog-cli", nitroUploadConfig, {
|
|
87
|
-
env: {
|
|
88
|
-
...process.env,
|
|
89
|
-
...uploadEnv
|
|
90
|
-
},
|
|
91
|
-
cwd: process.cwd(),
|
|
92
|
-
resolveFrom: resolvedDirname,
|
|
93
|
-
stdio: "inherit",
|
|
94
|
-
onBinaryFound: () => {
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
|
-
} catch (error) {
|
|
98
|
-
console.error("PostHog sourcemap upload failed:", error);
|
|
99
|
-
}
|
|
83
|
+
const uploadOptions = [
|
|
84
|
+
"--host",
|
|
85
|
+
options.host,
|
|
86
|
+
"sourcemap",
|
|
87
|
+
"upload",
|
|
88
|
+
"--directory",
|
|
89
|
+
".output",
|
|
90
|
+
"--ignore",
|
|
91
|
+
"**/node_modules/**"
|
|
92
|
+
];
|
|
100
93
|
try {
|
|
101
|
-
await spawnLocal("posthog-cli",
|
|
102
|
-
env:
|
|
103
|
-
...process.env,
|
|
104
|
-
...uploadEnv
|
|
105
|
-
},
|
|
94
|
+
await spawnLocal("posthog-cli", uploadOptions, {
|
|
95
|
+
env: cliEnv,
|
|
106
96
|
cwd: process.cwd(),
|
|
107
97
|
resolveFrom: resolvedDirname,
|
|
108
98
|
stdio: "inherit",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/nuxt",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.10",
|
|
4
4
|
"description": "Nuxt module for Posthog 🦔",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,11 +20,11 @@
|
|
|
20
20
|
"dist"
|
|
21
21
|
],
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@posthog/cli": "
|
|
23
|
+
"@posthog/cli": "0.5.1",
|
|
24
24
|
"@nuxt/kit": ">=3.7.0",
|
|
25
|
-
"posthog-js": "1.276.0",
|
|
26
25
|
"@posthog/core": "1.3.0",
|
|
27
|
-
"posthog-node": "5.10.0"
|
|
26
|
+
"posthog-node": "5.10.0",
|
|
27
|
+
"posthog-js": "1.276.0"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/node": "^20.0.0",
|