@zuplo/cli 7.9.18 → 7.9.20

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.
Files changed (41) hide show
  1. package/node_modules/@posthog/core/dist/error-tracking/chunk-ids.d.ts.map +1 -1
  2. package/node_modules/@posthog/core/dist/error-tracking/chunk-ids.js +36 -22
  3. package/node_modules/@posthog/core/dist/error-tracking/chunk-ids.mjs +36 -22
  4. package/node_modules/@posthog/core/dist/error-tracking/release.d.ts +3 -5
  5. package/node_modules/@posthog/core/dist/error-tracking/release.d.ts.map +1 -1
  6. package/node_modules/@posthog/core/dist/error-tracking/release.js +4 -0
  7. package/node_modules/@posthog/core/dist/error-tracking/release.mjs +4 -0
  8. package/node_modules/@posthog/core/package.json +1 -1
  9. package/node_modules/@posthog/core/src/error-tracking/chunk-ids.spec.ts +77 -0
  10. package/node_modules/@posthog/core/src/error-tracking/chunk-ids.ts +50 -25
  11. package/node_modules/@posthog/core/src/error-tracking/release.spec.ts +34 -0
  12. package/node_modules/@posthog/core/src/error-tracking/release.ts +10 -5
  13. package/node_modules/@zuplo/core/package.json +1 -1
  14. package/node_modules/@zuplo/graphql/package.json +1 -1
  15. package/node_modules/@zuplo/openapi-tools/package.json +1 -1
  16. package/node_modules/@zuplo/otel/package.json +1 -1
  17. package/node_modules/@zuplo/runtime/out/esm/{chunk-GYEX3OZM.js → chunk-6YPRGG62.js} +31 -31
  18. package/node_modules/@zuplo/runtime/out/esm/{chunk-GYEX3OZM.js.map → chunk-6YPRGG62.js.map} +1 -1
  19. package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
  20. package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
  21. package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
  22. package/node_modules/@zuplo/runtime/package.json +1 -1
  23. package/node_modules/content-disposition/README.md +105 -35
  24. package/node_modules/content-disposition/dist/index.d.ts +72 -0
  25. package/node_modules/content-disposition/dist/index.js +388 -0
  26. package/node_modules/content-disposition/dist/index.js.map +1 -0
  27. package/node_modules/content-disposition/package.json +31 -19
  28. package/node_modules/express/Readme.md +15 -9
  29. package/node_modules/express/lib/application.js +2 -2
  30. package/node_modules/express/lib/request.js +32 -19
  31. package/node_modules/express/lib/response.js +27 -30
  32. package/node_modules/express/node_modules/content-type/LICENSE +22 -0
  33. package/node_modules/express/node_modules/content-type/README.md +71 -0
  34. package/node_modules/express/node_modules/content-type/dist/index.d.ts +46 -0
  35. package/node_modules/express/node_modules/content-type/dist/index.js +176 -0
  36. package/node_modules/express/node_modules/content-type/dist/index.js.map +1 -0
  37. package/node_modules/express/node_modules/content-type/package.json +52 -0
  38. package/node_modules/express/package.json +10 -10
  39. package/package.json +11 -11
  40. package/node_modules/content-disposition/index.js +0 -536
  41. /package/node_modules/@zuplo/runtime/out/esm/{chunk-GYEX3OZM.js.LEGAL.txt → chunk-6YPRGG62.js.LEGAL.txt} +0 -0
@@ -1 +1 @@
1
- {"version":3,"file":"chunk-ids.d.ts","sourceRoot":"","sources":["../../src/error-tracking/chunk-ids.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAK1C,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAM5C,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,CA2C5F"}
1
+ {"version":3,"file":"chunk-ids.d.ts","sourceRoot":"","sources":["../../src/error-tracking/chunk-ids.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAK1C,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;AAO5C,wBAAgB,uBAAuB,CAAC,WAAW,EAAE,WAAW,GAAG,cAAc,GAAG,SAAS,CAwD5F"}
@@ -28,38 +28,52 @@ var __webpack_require__ = {};
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  let parsedStackResults;
31
- let lastKeysCount;
31
+ let lastPostHogChunkIds;
32
+ let lastNativeDebugIds;
32
33
  let cachedFilenameChunkIds;
33
34
  function getFilenameToChunkIdMap(stackParser) {
34
- const chunkIdMap = globalThis._posthogChunkIds;
35
- if (!chunkIdMap) return;
36
- const chunkIdKeys = Object.keys(chunkIdMap);
37
- if (cachedFilenameChunkIds && chunkIdKeys.length === lastKeysCount) return cachedFilenameChunkIds;
38
- lastKeysCount = chunkIdKeys.length;
39
- cachedFilenameChunkIds = chunkIdKeys.reduce((acc, stackKey)=>{
40
- if (!parsedStackResults) parsedStackResults = {};
41
- const result = parsedStackResults[stackKey];
42
- if (result) acc[result[0]] = result[1];
43
- else {
35
+ const posthogChunkIds = globalThis._posthogChunkIds;
36
+ const nativeDebugIds = globalThis._debugIds;
37
+ if (!posthogChunkIds && !nativeDebugIds) return;
38
+ const posthogKeys = posthogChunkIds ? Object.keys(posthogChunkIds) : [];
39
+ const nativeKeys = nativeDebugIds ? Object.keys(nativeDebugIds) : [];
40
+ if (cachedFilenameChunkIds && matchesSnapshot(posthogChunkIds, posthogKeys, lastPostHogChunkIds) && matchesSnapshot(nativeDebugIds, nativeKeys, lastNativeDebugIds)) return cachedFilenameChunkIds;
41
+ lastPostHogChunkIds = posthogChunkIds ? {
42
+ ...posthogChunkIds
43
+ } : void 0;
44
+ lastNativeDebugIds = nativeDebugIds ? {
45
+ ...nativeDebugIds
46
+ } : void 0;
47
+ cachedFilenameChunkIds = {};
48
+ parsedStackResults ??= {};
49
+ const addChunkIds = (keys, chunkIds)=>{
50
+ for (const stackKey of keys){
51
+ const chunkId = chunkIds[stackKey];
52
+ if (!chunkId) continue;
53
+ const cachedFilename = parsedStackResults?.[stackKey];
54
+ if (cachedFilename) {
55
+ cachedFilenameChunkIds[cachedFilename] = chunkId;
56
+ continue;
57
+ }
44
58
  const parsedStack = stackParser(stackKey);
45
59
  for(let i = parsedStack.length - 1; i >= 0; i--){
46
- const stackFrame = parsedStack[i];
47
- const filename = stackFrame?.filename;
48
- const chunkId = chunkIdMap[stackKey];
49
- if (filename && chunkId) {
50
- acc[filename] = chunkId;
51
- parsedStackResults[stackKey] = [
52
- filename,
53
- chunkId
54
- ];
60
+ const filename = parsedStack[i]?.filename;
61
+ if (filename) {
62
+ cachedFilenameChunkIds[filename] = chunkId;
63
+ parsedStackResults[stackKey] = filename;
55
64
  break;
56
65
  }
57
66
  }
58
67
  }
59
- return acc;
60
- }, {});
68
+ };
69
+ if (nativeDebugIds) addChunkIds(nativeKeys, nativeDebugIds);
70
+ if (posthogChunkIds) addChunkIds(posthogKeys, posthogChunkIds);
61
71
  return cachedFilenameChunkIds;
62
72
  }
73
+ function matchesSnapshot(chunkIds, keys, snapshot) {
74
+ if (!chunkIds || !snapshot) return chunkIds === snapshot;
75
+ return keys.length === Object.keys(snapshot).length && keys.every((key)=>chunkIds[key] === snapshot[key]);
76
+ }
63
77
  __webpack_require__.d(__webpack_exports__, {
64
78
  getFilenameToChunkIdMap: ()=>getFilenameToChunkIdMap
65
79
  });
@@ -1,34 +1,48 @@
1
1
  let parsedStackResults;
2
- let lastKeysCount;
2
+ let lastPostHogChunkIds;
3
+ let lastNativeDebugIds;
3
4
  let cachedFilenameChunkIds;
4
5
  function getFilenameToChunkIdMap(stackParser) {
5
- const chunkIdMap = globalThis._posthogChunkIds;
6
- if (!chunkIdMap) return;
7
- const chunkIdKeys = Object.keys(chunkIdMap);
8
- if (cachedFilenameChunkIds && chunkIdKeys.length === lastKeysCount) return cachedFilenameChunkIds;
9
- lastKeysCount = chunkIdKeys.length;
10
- cachedFilenameChunkIds = chunkIdKeys.reduce((acc, stackKey)=>{
11
- if (!parsedStackResults) parsedStackResults = {};
12
- const result = parsedStackResults[stackKey];
13
- if (result) acc[result[0]] = result[1];
14
- else {
6
+ const posthogChunkIds = globalThis._posthogChunkIds;
7
+ const nativeDebugIds = globalThis._debugIds;
8
+ if (!posthogChunkIds && !nativeDebugIds) return;
9
+ const posthogKeys = posthogChunkIds ? Object.keys(posthogChunkIds) : [];
10
+ const nativeKeys = nativeDebugIds ? Object.keys(nativeDebugIds) : [];
11
+ if (cachedFilenameChunkIds && matchesSnapshot(posthogChunkIds, posthogKeys, lastPostHogChunkIds) && matchesSnapshot(nativeDebugIds, nativeKeys, lastNativeDebugIds)) return cachedFilenameChunkIds;
12
+ lastPostHogChunkIds = posthogChunkIds ? {
13
+ ...posthogChunkIds
14
+ } : void 0;
15
+ lastNativeDebugIds = nativeDebugIds ? {
16
+ ...nativeDebugIds
17
+ } : void 0;
18
+ cachedFilenameChunkIds = {};
19
+ parsedStackResults ??= {};
20
+ const addChunkIds = (keys, chunkIds)=>{
21
+ for (const stackKey of keys){
22
+ const chunkId = chunkIds[stackKey];
23
+ if (!chunkId) continue;
24
+ const cachedFilename = parsedStackResults?.[stackKey];
25
+ if (cachedFilename) {
26
+ cachedFilenameChunkIds[cachedFilename] = chunkId;
27
+ continue;
28
+ }
15
29
  const parsedStack = stackParser(stackKey);
16
30
  for(let i = parsedStack.length - 1; i >= 0; i--){
17
- const stackFrame = parsedStack[i];
18
- const filename = stackFrame?.filename;
19
- const chunkId = chunkIdMap[stackKey];
20
- if (filename && chunkId) {
21
- acc[filename] = chunkId;
22
- parsedStackResults[stackKey] = [
23
- filename,
24
- chunkId
25
- ];
31
+ const filename = parsedStack[i]?.filename;
32
+ if (filename) {
33
+ cachedFilenameChunkIds[filename] = chunkId;
34
+ parsedStackResults[stackKey] = filename;
26
35
  break;
27
36
  }
28
37
  }
29
38
  }
30
- return acc;
31
- }, {});
39
+ };
40
+ if (nativeDebugIds) addChunkIds(nativeKeys, nativeDebugIds);
41
+ if (posthogChunkIds) addChunkIds(posthogKeys, posthogChunkIds);
32
42
  return cachedFilenameChunkIds;
33
43
  }
44
+ function matchesSnapshot(chunkIds, keys, snapshot) {
45
+ if (!chunkIds || !snapshot) return chunkIds === snapshot;
46
+ return keys.length === Object.keys(snapshot).length && keys.every((key)=>chunkIds[key] === snapshot[key]);
47
+ }
34
48
  export { getFilenameToChunkIdMap };
@@ -1,10 +1,8 @@
1
1
  /**
2
- * Read the release id injected into the bundle by posthog-cli.
2
+ * Read the release id embedded at build time or injected into a processed bundle.
3
3
  *
4
- * The CLI prepends a small IIFE to each chunk that sets `globalThis._posthogReleaseId` to the
5
- * release row's id (a string, first write wins so the first loaded chunk pins the release for the
6
- * runtime). The SDK emits it on `$exception` events so the server resolves the release with a plain
7
- * foreign-key lookup. Returns `undefined` when nothing was injected or the value is malformed.
4
+ * Framework integrations can compile `POSTHOG_RELEASE_ID` into browser code before asset hashes
5
+ * are finalized. The global remains as a fallback for bundles processed by posthog-cli.
8
6
  */
9
7
  export declare function getInjectedReleaseId(): string | undefined;
10
8
  //# sourceMappingURL=release.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/error-tracking/release.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAGzD"}
1
+ {"version":3,"file":"release.d.ts","sourceRoot":"","sources":["../../src/error-tracking/release.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,GAAG,SAAS,CAUzD"}
@@ -28,6 +28,10 @@ var __webpack_require__ = {};
28
28
  var __webpack_exports__ = {};
29
29
  __webpack_require__.r(__webpack_exports__);
30
30
  function getInjectedReleaseId() {
31
+ if ("u" > typeof process) {
32
+ const fromEnvironment = process.env.POSTHOG_RELEASE_ID?.trim();
33
+ if (fromEnvironment) return fromEnvironment;
34
+ }
31
35
  const injected = globalThis._posthogReleaseId;
32
36
  return 'string' == typeof injected && injected.length > 0 ? injected : void 0;
33
37
  }
@@ -1,4 +1,8 @@
1
1
  function getInjectedReleaseId() {
2
+ if ("u" > typeof process) {
3
+ const fromEnvironment = process.env.POSTHOG_RELEASE_ID?.trim();
4
+ if (fromEnvironment) return fromEnvironment;
5
+ }
2
6
  const injected = globalThis._posthogReleaseId;
3
7
  return 'string' == typeof injected && injected.length > 0 ? injected : void 0;
4
8
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@posthog/core",
3
- "version": "1.57.3",
3
+ "version": "1.57.4",
4
4
  "bugs": {
5
5
  "url": "https://github.com/PostHog/posthog-js/issues"
6
6
  },
@@ -0,0 +1,77 @@
1
+ import type { StackParser } from './types'
2
+
3
+ const stackParser: StackParser = (stack) => [
4
+ {
5
+ platform: 'web:javascript',
6
+ filename: stack.split('|')[0],
7
+ },
8
+ ]
9
+
10
+ describe('getFilenameToChunkIdMap', () => {
11
+ beforeEach(() => {
12
+ vi.resetModules()
13
+ delete (globalThis as any)._posthogChunkIds
14
+ delete (globalThis as any)._debugIds
15
+ })
16
+
17
+ afterEach(() => {
18
+ delete (globalThis as any)._posthogChunkIds
19
+ delete (globalThis as any)._debugIds
20
+ })
21
+
22
+ it('maps native debug IDs to filenames', async () => {
23
+ ;(globalThis as any)._debugIds = {
24
+ 'https://example.com/chunk.js|native': 'native-debug-id',
25
+ }
26
+ const { getFilenameToChunkIdMap } = await import('./chunk-ids')
27
+
28
+ expect(getFilenameToChunkIdMap(stackParser)).toEqual({
29
+ 'https://example.com/chunk.js': 'native-debug-id',
30
+ })
31
+ })
32
+
33
+ it('prefers PostHog chunk IDs over native debug IDs for the same file', async () => {
34
+ ;(globalThis as any)._debugIds = {
35
+ 'https://example.com/chunk.js|native': 'native-debug-id',
36
+ }
37
+ ;(globalThis as any)._posthogChunkIds = {
38
+ 'https://example.com/chunk.js|posthog': 'posthog-chunk-id',
39
+ }
40
+ const { getFilenameToChunkIdMap } = await import('./chunk-ids')
41
+
42
+ expect(getFilenameToChunkIdMap(stackParser)).toEqual({
43
+ 'https://example.com/chunk.js': 'posthog-chunk-id',
44
+ })
45
+ })
46
+
47
+ it('refreshes the cached map when native debug IDs are added', async () => {
48
+ ;(globalThis as any)._debugIds = {
49
+ 'https://example.com/one.js|native': 'one',
50
+ }
51
+ const { getFilenameToChunkIdMap } = await import('./chunk-ids')
52
+
53
+ expect(getFilenameToChunkIdMap(stackParser)).toEqual({ 'https://example.com/one.js': 'one' })
54
+
55
+ ;(globalThis as any)._debugIds['https://example.com/two.js|native'] = 'two'
56
+
57
+ expect(getFilenameToChunkIdMap(stackParser)).toEqual({
58
+ 'https://example.com/one.js': 'one',
59
+ 'https://example.com/two.js': 'two',
60
+ })
61
+ })
62
+
63
+ it('refreshes the cached map when a debug ID map is replaced with the same number of entries', async () => {
64
+ ;(globalThis as any)._debugIds = {
65
+ 'https://example.com/one.js|native': 'one',
66
+ }
67
+ const { getFilenameToChunkIdMap } = await import('./chunk-ids')
68
+
69
+ expect(getFilenameToChunkIdMap(stackParser)).toEqual({ 'https://example.com/one.js': 'one' })
70
+
71
+ ;(globalThis as any)._debugIds = {
72
+ 'https://example.com/two.js|native': 'two',
73
+ }
74
+
75
+ expect(getFilenameToChunkIdMap(stackParser)).toEqual({ 'https://example.com/two.js': 'two' })
76
+ })
77
+ })
@@ -5,55 +5,80 @@
5
5
  import type { StackParser } from './types'
6
6
 
7
7
  type StackString = string
8
- type CachedResult = [string, string]
8
+ type CachedResult = string
9
9
 
10
10
  type ChunkIdMapType = Record<string, string>
11
11
 
12
12
  let parsedStackResults: Record<StackString, CachedResult> | undefined
13
- let lastKeysCount: number | undefined
13
+ let lastPostHogChunkIds: ChunkIdMapType | undefined
14
+ let lastNativeDebugIds: ChunkIdMapType | undefined
14
15
  let cachedFilenameChunkIds: ChunkIdMapType | undefined
15
16
 
16
17
  export function getFilenameToChunkIdMap(stackParser: StackParser): ChunkIdMapType | undefined {
17
- const chunkIdMap = (globalThis as any)._posthogChunkIds as ChunkIdMapType | undefined
18
- if (!chunkIdMap) {
18
+ const posthogChunkIds = (globalThis as any)._posthogChunkIds as ChunkIdMapType | undefined
19
+ const nativeDebugIds = (globalThis as any)._debugIds as ChunkIdMapType | undefined
20
+ if (!posthogChunkIds && !nativeDebugIds) {
19
21
  return undefined
20
22
  }
21
23
 
22
- const chunkIdKeys = Object.keys(chunkIdMap)
24
+ const posthogKeys = posthogChunkIds ? Object.keys(posthogChunkIds) : []
25
+ const nativeKeys = nativeDebugIds ? Object.keys(nativeDebugIds) : []
23
26
 
24
- if (cachedFilenameChunkIds && chunkIdKeys.length === lastKeysCount) {
27
+ if (
28
+ cachedFilenameChunkIds &&
29
+ matchesSnapshot(posthogChunkIds, posthogKeys, lastPostHogChunkIds) &&
30
+ matchesSnapshot(nativeDebugIds, nativeKeys, lastNativeDebugIds)
31
+ ) {
25
32
  return cachedFilenameChunkIds
26
33
  }
27
34
 
28
- lastKeysCount = chunkIdKeys.length
35
+ lastPostHogChunkIds = posthogChunkIds ? { ...posthogChunkIds } : undefined
36
+ lastNativeDebugIds = nativeDebugIds ? { ...nativeDebugIds } : undefined
37
+ cachedFilenameChunkIds = {}
38
+ parsedStackResults ??= {}
29
39
 
30
- cachedFilenameChunkIds = chunkIdKeys.reduce<Record<string, string>>((acc, stackKey) => {
31
- if (!parsedStackResults) {
32
- parsedStackResults = {}
33
- }
40
+ const addChunkIds = (keys: string[], chunkIds: ChunkIdMapType): void => {
41
+ for (const stackKey of keys) {
42
+ const chunkId = chunkIds[stackKey]
43
+ if (!chunkId) {
44
+ continue
45
+ }
34
46
 
35
- const result = parsedStackResults[stackKey]
47
+ const cachedFilename = parsedStackResults?.[stackKey]
48
+ if (cachedFilename) {
49
+ cachedFilenameChunkIds![cachedFilename] = chunkId
50
+ continue
51
+ }
36
52
 
37
- if (result) {
38
- acc[result[0]] = result[1]
39
- } else {
40
53
  const parsedStack = stackParser(stackKey)
41
-
42
54
  for (let i = parsedStack.length - 1; i >= 0; i--) {
43
- const stackFrame = parsedStack[i]
44
- const filename = stackFrame?.filename
45
- const chunkId = chunkIdMap[stackKey]
46
-
47
- if (filename && chunkId) {
48
- acc[filename] = chunkId
49
- parsedStackResults[stackKey] = [filename, chunkId]
55
+ const filename = parsedStack[i]?.filename
56
+ if (filename) {
57
+ cachedFilenameChunkIds![filename] = chunkId
58
+ parsedStackResults![stackKey] = filename
50
59
  break
51
60
  }
52
61
  }
53
62
  }
63
+ }
54
64
 
55
- return acc
56
- }, {})
65
+ if (nativeDebugIds) {
66
+ addChunkIds(nativeKeys, nativeDebugIds)
67
+ }
68
+ if (posthogChunkIds) {
69
+ addChunkIds(posthogKeys, posthogChunkIds)
70
+ }
57
71
 
58
72
  return cachedFilenameChunkIds
59
73
  }
74
+
75
+ function matchesSnapshot(
76
+ chunkIds: ChunkIdMapType | undefined,
77
+ keys: string[],
78
+ snapshot: ChunkIdMapType | undefined
79
+ ): boolean {
80
+ if (!chunkIds || !snapshot) {
81
+ return chunkIds === snapshot
82
+ }
83
+ return keys.length === Object.keys(snapshot).length && keys.every((key) => chunkIds[key] === snapshot[key])
84
+ }
@@ -0,0 +1,34 @@
1
+ import { getInjectedReleaseId } from './release'
2
+
3
+ describe('getInjectedReleaseId', () => {
4
+ const originalReleaseId = process.env.POSTHOG_RELEASE_ID
5
+
6
+ afterEach(() => {
7
+ if (originalReleaseId === undefined) {
8
+ delete process.env.POSTHOG_RELEASE_ID
9
+ } else {
10
+ process.env.POSTHOG_RELEASE_ID = originalReleaseId
11
+ }
12
+ delete (globalThis as any)._posthogReleaseId
13
+ })
14
+
15
+ it('reads and trims POSTHOG_RELEASE_ID', () => {
16
+ process.env.POSTHOG_RELEASE_ID = ' release-from-environment '
17
+
18
+ expect(getInjectedReleaseId()).toBe('release-from-environment')
19
+ })
20
+
21
+ it('prefers POSTHOG_RELEASE_ID over the injected global', () => {
22
+ process.env.POSTHOG_RELEASE_ID = 'release-from-environment'
23
+ ;(globalThis as any)._posthogReleaseId = 'release-from-injection'
24
+
25
+ expect(getInjectedReleaseId()).toBe('release-from-environment')
26
+ })
27
+
28
+ it('falls back to the injected global when the environment value is empty', () => {
29
+ process.env.POSTHOG_RELEASE_ID = ' '
30
+ ;(globalThis as any)._posthogReleaseId = 'release-from-injection'
31
+
32
+ expect(getInjectedReleaseId()).toBe('release-from-injection')
33
+ })
34
+ })
@@ -1,12 +1,17 @@
1
1
  /**
2
- * Read the release id injected into the bundle by posthog-cli.
2
+ * Read the release id embedded at build time or injected into a processed bundle.
3
3
  *
4
- * The CLI prepends a small IIFE to each chunk that sets `globalThis._posthogReleaseId` to the
5
- * release row's id (a string, first write wins so the first loaded chunk pins the release for the
6
- * runtime). The SDK emits it on `$exception` events so the server resolves the release with a plain
7
- * foreign-key lookup. Returns `undefined` when nothing was injected or the value is malformed.
4
+ * Framework integrations can compile `POSTHOG_RELEASE_ID` into browser code before asset hashes
5
+ * are finalized. The global remains as a fallback for bundles processed by posthog-cli.
8
6
  */
9
7
  export function getInjectedReleaseId(): string | undefined {
8
+ if (typeof process !== 'undefined') {
9
+ const fromEnvironment = process.env.POSTHOG_RELEASE_ID?.trim()
10
+ if (fromEnvironment) {
11
+ return fromEnvironment
12
+ }
13
+ }
14
+
10
15
  const injected = (globalThis as any)._posthogReleaseId
11
16
  return typeof injected === 'string' && injected.length > 0 ? injected : undefined
12
17
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zuplo/core",
3
- "version": "7.9.18",
3
+ "version": "7.9.20",
4
4
  "repository": "https://github.com/zuplo/zuplo",
5
5
  "author": "Zuplo, Inc.",
6
6
  "type": "module",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/graphql",
3
3
  "type": "module",
4
- "version": "7.9.18",
4
+ "version": "7.9.20",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {
@@ -2,7 +2,7 @@
2
2
  "name": "@zuplo/openapi-tools",
3
3
  "type": "module",
4
4
  "sideEffects": false,
5
- "version": "7.9.18",
5
+ "version": "7.9.20",
6
6
  "description": "Tooling for OpenAPI files",
7
7
  "repository": {
8
8
  "type": "git",
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@zuplo/otel",
3
3
  "type": "module",
4
- "version": "7.9.18",
4
+ "version": "7.9.20",
5
5
  "repository": "https://github.com/zuplo/zuplo",
6
6
  "author": "Zuplo, Inc.",
7
7
  "exports": {