@posthog/rollup-plugin 1.1.5 → 1.1.7
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/README.md +86 -2
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/package.json +3 -3
- package/src/index.ts +6 -0
package/README.md
CHANGED
|
@@ -1,3 +1,87 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @posthog/rollup-plugin
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Rollup plugin for uploading source maps to PostHog for error tracking.
|
|
4
|
+
|
|
5
|
+
[SEE FULL DOCS](https://posthog.com/docs/error-tracking/upload-source-maps/rollup)
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @posthog/rollup-plugin --save-dev
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
Add the plugin to your Rollup configuration:
|
|
16
|
+
|
|
17
|
+
```javascript
|
|
18
|
+
import posthog from '@posthog/rollup-plugin'
|
|
19
|
+
|
|
20
|
+
export default {
|
|
21
|
+
input: './src/index.ts',
|
|
22
|
+
output: {
|
|
23
|
+
format: 'es',
|
|
24
|
+
dir: 'dist',
|
|
25
|
+
},
|
|
26
|
+
plugins: [
|
|
27
|
+
posthog({
|
|
28
|
+
personalApiKey: process.env.POSTHOG_PERSONAL_API_KEY,
|
|
29
|
+
envId: process.env.POSTHOG_PROJECT_ID,
|
|
30
|
+
sourcemaps: {
|
|
31
|
+
enabled: true,
|
|
32
|
+
project: 'my-app',
|
|
33
|
+
version: '1.0.0',
|
|
34
|
+
},
|
|
35
|
+
}),
|
|
36
|
+
],
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Configuration Options
|
|
41
|
+
|
|
42
|
+
| Option | Type | Required | Default | Description |
|
|
43
|
+
| ------------------------------ | ---------------------------------------------------- | -------- | -------------------------- | ------------------------------------------- |
|
|
44
|
+
| `personalApiKey` | `string` | Yes | - | Your PostHog personal API key |
|
|
45
|
+
| `envId` | `string` | Yes | - | Your PostHog project/environment ID |
|
|
46
|
+
| `host` | `string` | No | `https://us.i.posthog.com` | PostHog instance host |
|
|
47
|
+
| `logLevel` | `'debug' \| 'info' \| 'warn' \| 'error' \| 'silent'` | No | `'info'` | Logging verbosity |
|
|
48
|
+
| `cliBinaryPath` | `string` | No | Auto-detected | Path to the PostHog CLI binary |
|
|
49
|
+
| `sourcemaps.enabled` | `boolean` | No | `true` | Enable source map processing |
|
|
50
|
+
| `sourcemaps.project` | `string` | No | - | Project name for source map grouping |
|
|
51
|
+
| `sourcemaps.version` | `string` | No | - | Version identifier for the release |
|
|
52
|
+
| `sourcemaps.deleteAfterUpload` | `boolean` | No | `true` | Delete source maps after upload |
|
|
53
|
+
| `sourcemaps.batchSize` | `number` | No | - | Number of source maps to upload in parallel |
|
|
54
|
+
|
|
55
|
+
### Full Example
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import posthog from '@posthog/rollup-plugin'
|
|
59
|
+
import packageJson from './package.json' with { type: 'json' }
|
|
60
|
+
|
|
61
|
+
export default {
|
|
62
|
+
input: './src/index.ts',
|
|
63
|
+
output: [
|
|
64
|
+
{
|
|
65
|
+
format: 'es',
|
|
66
|
+
dir: 'dist/esm',
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
plugins: [
|
|
70
|
+
posthog({
|
|
71
|
+
personalApiKey: process.env.POSTHOG_PERSONAL_API_KEY,
|
|
72
|
+
envId: process.env.POSTHOG_PROJECT_ID,
|
|
73
|
+
host: process.env.POSTHOG_API_HOST,
|
|
74
|
+
logLevel: 'info',
|
|
75
|
+
sourcemaps: {
|
|
76
|
+
enabled: true,
|
|
77
|
+
project: packageJson.name,
|
|
78
|
+
version: packageJson.version,
|
|
79
|
+
},
|
|
80
|
+
}),
|
|
81
|
+
],
|
|
82
|
+
}
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Questions?
|
|
86
|
+
|
|
87
|
+
### [Check out our community page.](https://posthog.com/docs/error-tracking/upload-source-maps/rollup)
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA2C,MAAM,QAAQ,CAAA;AAC7E,OAAO,EAAiC,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAG/E,MAAM,WAAW,0BAA0B;IACvC,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,UAAU,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,iBAAiB,CAAC,EAAE,OAAO,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAA2C,MAAM,QAAQ,CAAA;AAC7E,OAAO,EAAiC,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAG/E,MAAM,WAAW,0BAA0B;IACvC,cAAc,EAAE,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,EAAE,QAAQ,CAAA;IACnB,UAAU,CAAC,EAAE;QACT,OAAO,CAAC,EAAE,OAAO,CAAA;QACjB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,OAAO,CAAC,EAAE,MAAM,CAAA;QAChB,iBAAiB,CAAC,EAAE,OAAO,CAAA;QAC3B,SAAS,CAAC,EAAE,MAAM,CAAA;KACrB,CAAA;CACJ;AAiBD,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,WAAW,EAAE,0BAA0B,GAqD1E,MAAM,CACd"}
|
package/dist/index.js
CHANGED
|
@@ -34,6 +34,7 @@ function posthogRollupPlugin(userOptions) {
|
|
|
34
34
|
if (posthogOptions.sourcemaps.project) args.push('--project', posthogOptions.sourcemaps.project);
|
|
35
35
|
if (posthogOptions.sourcemaps.version) args.push('--version', posthogOptions.sourcemaps.version);
|
|
36
36
|
if (posthogOptions.sourcemaps.deleteAfterUpload) args.push('--delete-after');
|
|
37
|
+
if (posthogOptions.sourcemaps.batchSize) args.push('--batch-size', posthogOptions.sourcemaps.batchSize.toString());
|
|
37
38
|
await spawnLocal(cliPath, args, {
|
|
38
39
|
env: {
|
|
39
40
|
...process.env,
|
|
@@ -66,7 +67,8 @@ function resolveOptions(userOptions) {
|
|
|
66
67
|
logLevel: null != (_userOptions_logLevel = userOptions.logLevel) ? _userOptions_logLevel : 'info',
|
|
67
68
|
sourcemaps: {
|
|
68
69
|
enabled: null != (_userSourcemaps_enabled = userSourcemaps.enabled) ? _userSourcemaps_enabled : true,
|
|
69
|
-
deleteAfterUpload: null != (_userSourcemaps_deleteAfterUpload = userSourcemaps.deleteAfterUpload) ? _userSourcemaps_deleteAfterUpload : true
|
|
70
|
+
deleteAfterUpload: null != (_userSourcemaps_deleteAfterUpload = userSourcemaps.deleteAfterUpload) ? _userSourcemaps_deleteAfterUpload : true,
|
|
71
|
+
batchSize: userSourcemaps.batchSize
|
|
70
72
|
}
|
|
71
73
|
};
|
|
72
74
|
return posthogOptions;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@posthog/rollup-plugin",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.7",
|
|
4
4
|
"description": "PostHog Rollup plugin",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
"dist"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@posthog/cli": "~0.5.
|
|
19
|
-
"@posthog/core": "1.
|
|
18
|
+
"@posthog/cli": "~0.5.20",
|
|
19
|
+
"@posthog/core": "1.9.1"
|
|
20
20
|
},
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"rollup": ">= 4.0.0"
|
package/src/index.ts
CHANGED
|
@@ -13,6 +13,7 @@ export interface PostHogRollupPluginOptions {
|
|
|
13
13
|
project?: string
|
|
14
14
|
version?: string
|
|
15
15
|
deleteAfterUpload?: boolean
|
|
16
|
+
batchSize?: number
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -27,6 +28,7 @@ interface ResolvedPostHogRollupPluginOptions {
|
|
|
27
28
|
project?: string
|
|
28
29
|
version?: string
|
|
29
30
|
deleteAfterUpload: boolean
|
|
31
|
+
batchSize?: number
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
34
|
|
|
@@ -68,6 +70,9 @@ export default function posthogRollupPlugin(userOptions: PostHogRollupPluginOpti
|
|
|
68
70
|
if (posthogOptions.sourcemaps.deleteAfterUpload) {
|
|
69
71
|
args.push('--delete-after')
|
|
70
72
|
}
|
|
73
|
+
if (posthogOptions.sourcemaps.batchSize) {
|
|
74
|
+
args.push('--batch-size', posthogOptions.sourcemaps.batchSize.toString())
|
|
75
|
+
}
|
|
71
76
|
await spawnLocal(cliPath, args, {
|
|
72
77
|
env: {
|
|
73
78
|
...process.env,
|
|
@@ -104,6 +109,7 @@ function resolveOptions(userOptions: PostHogRollupPluginOptions): ResolvedPostHo
|
|
|
104
109
|
sourcemaps: {
|
|
105
110
|
enabled: userSourcemaps.enabled ?? true,
|
|
106
111
|
deleteAfterUpload: userSourcemaps.deleteAfterUpload ?? true,
|
|
112
|
+
batchSize: userSourcemaps.batchSize,
|
|
107
113
|
},
|
|
108
114
|
}
|
|
109
115
|
return posthogOptions
|