@leanbase.com/js 0.1.2 → 0.2.0-alpha.0

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 (136) hide show
  1. package/dist/autocapture-utils.d.ts +17 -0
  2. package/dist/autocapture.d.ts +35 -0
  3. package/dist/config.d.ts +5 -0
  4. package/dist/constants.d.ts +54 -0
  5. package/dist/entrypoints/main.cjs.d.ts +4 -0
  6. package/dist/entrypoints/module.es.d.ts +4 -0
  7. package/dist/extensions/rageclick.d.ts +9 -0
  8. package/dist/iife.d.ts +19 -0
  9. package/dist/index.d.ts +2 -779
  10. package/dist/leanbase-logger.d.ts +6 -0
  11. package/dist/leanbase-persistence.d.ts +64 -0
  12. package/dist/leanbase.d.ts +49 -0
  13. package/dist/leanbase.iife.js +1 -4745
  14. package/dist/leanbase.iife.js.map +1 -1
  15. package/dist/main.js +2 -0
  16. package/dist/main.js.map +1 -0
  17. package/dist/module.d.ts +780 -0
  18. package/dist/module.js +2 -0
  19. package/dist/module.js.map +1 -0
  20. package/dist/page-view.d.ts +29 -0
  21. package/dist/scroll-manager.d.ts +21 -0
  22. package/dist/session-props.d.ts +32 -0
  23. package/dist/sessionid.d.ts +50 -0
  24. package/dist/storage.d.ts +24 -0
  25. package/{src/types.ts → dist/types.d.ts} +145 -235
  26. package/dist/utils/blocked-uas.d.ts +17 -0
  27. package/dist/utils/element-utils.d.ts +5 -0
  28. package/dist/utils/event-utils.d.ts +22 -0
  29. package/dist/utils/index.d.ts +44 -0
  30. package/dist/utils/request-utils.d.ts +12 -0
  31. package/dist/utils/simple-event-emitter.d.ts +6 -0
  32. package/dist/utils/user-agent-utils.d.ts +18 -0
  33. package/dist/uuidv7.d.ts +43 -0
  34. package/dist/version.d.ts +1 -0
  35. package/lib/autocapture-utils.d.ts +17 -0
  36. package/{src/autocapture-utils.ts → lib/autocapture-utils.js} +196 -280
  37. package/lib/autocapture-utils.js.map +1 -0
  38. package/lib/autocapture.d.ts +35 -0
  39. package/lib/autocapture.js +311 -0
  40. package/lib/autocapture.js.map +1 -0
  41. package/lib/config.d.ts +5 -0
  42. package/lib/config.js +7 -0
  43. package/lib/config.js.map +1 -0
  44. package/lib/constants.d.ts +54 -0
  45. package/{src/constants.ts → lib/constants.js} +58 -55
  46. package/lib/constants.js.map +1 -0
  47. package/lib/entrypoints/main.cjs.d.ts +4 -0
  48. package/lib/entrypoints/main.cjs.js +3 -0
  49. package/lib/entrypoints/main.cjs.js.map +1 -0
  50. package/lib/entrypoints/module.es.d.ts +4 -0
  51. package/lib/entrypoints/module.es.js +3 -0
  52. package/lib/entrypoints/module.es.js.map +1 -0
  53. package/lib/extensions/rageclick.d.ts +9 -0
  54. package/lib/extensions/rageclick.js +27 -0
  55. package/lib/extensions/rageclick.js.map +1 -0
  56. package/lib/iife.d.ts +19 -0
  57. package/lib/iife.js +67 -0
  58. package/lib/iife.js.map +1 -0
  59. package/{src/index.ts → lib/index.d.ts} +2 -2
  60. package/lib/index.js +2 -0
  61. package/lib/index.js.map +1 -0
  62. package/lib/leanbase-logger.d.ts +6 -0
  63. package/lib/leanbase-logger.js +25 -0
  64. package/lib/leanbase-logger.js.map +1 -0
  65. package/lib/leanbase-persistence.d.ts +64 -0
  66. package/lib/leanbase-persistence.js +287 -0
  67. package/lib/leanbase-persistence.js.map +1 -0
  68. package/lib/leanbase.d.ts +49 -0
  69. package/lib/leanbase.js +294 -0
  70. package/lib/leanbase.js.map +1 -0
  71. package/lib/page-view.d.ts +29 -0
  72. package/lib/page-view.js +81 -0
  73. package/lib/page-view.js.map +1 -0
  74. package/lib/scroll-manager.d.ts +21 -0
  75. package/lib/scroll-manager.js +79 -0
  76. package/lib/scroll-manager.js.map +1 -0
  77. package/lib/session-props.d.ts +32 -0
  78. package/lib/session-props.js +73 -0
  79. package/lib/session-props.js.map +1 -0
  80. package/lib/sessionid.d.ts +50 -0
  81. package/{src/sessionid.ts → lib/sessionid.js} +128 -204
  82. package/lib/sessionid.js.map +1 -0
  83. package/lib/storage.d.ts +24 -0
  84. package/{src/storage.ts → lib/storage.js} +182 -225
  85. package/lib/storage.js.map +1 -0
  86. package/lib/types.d.ts +544 -0
  87. package/lib/types.js +7 -0
  88. package/lib/types.js.map +1 -0
  89. package/lib/utils/blocked-uas.d.ts +17 -0
  90. package/{src/utils/blocked-uas.ts → lib/utils/blocked-uas.js} +19 -48
  91. package/lib/utils/blocked-uas.js.map +1 -0
  92. package/lib/utils/element-utils.d.ts +5 -0
  93. package/{src/utils/element-utils.ts → lib/utils/element-utils.js} +13 -17
  94. package/lib/utils/element-utils.js.map +1 -0
  95. package/lib/utils/event-utils.d.ts +22 -0
  96. package/lib/utils/event-utils.js +258 -0
  97. package/lib/utils/event-utils.js.map +1 -0
  98. package/lib/utils/index.d.ts +44 -0
  99. package/lib/utils/index.js +183 -0
  100. package/lib/utils/index.js.map +1 -0
  101. package/lib/utils/request-utils.d.ts +12 -0
  102. package/lib/utils/request-utils.js +107 -0
  103. package/lib/utils/request-utils.js.map +1 -0
  104. package/lib/utils/simple-event-emitter.d.ts +6 -0
  105. package/lib/utils/simple-event-emitter.js +24 -0
  106. package/lib/utils/simple-event-emitter.js.map +1 -0
  107. package/lib/utils/user-agent-utils.d.ts +18 -0
  108. package/lib/utils/user-agent-utils.js +369 -0
  109. package/lib/utils/user-agent-utils.js.map +1 -0
  110. package/lib/uuidv7.d.ts +43 -0
  111. package/{src/uuidv7.ts → lib/uuidv7.js} +103 -131
  112. package/lib/uuidv7.js.map +1 -0
  113. package/lib/version.d.ts +1 -0
  114. package/lib/version.js +2 -0
  115. package/lib/version.js.map +1 -0
  116. package/package.json +23 -11
  117. package/dist/index.cjs +0 -3032
  118. package/dist/index.cjs.map +0 -1
  119. package/dist/index.mjs +0 -3030
  120. package/dist/index.mjs.map +0 -1
  121. package/src/autocapture.ts +0 -415
  122. package/src/config.ts +0 -8
  123. package/src/extensions/rageclick.ts +0 -34
  124. package/src/iife.ts +0 -87
  125. package/src/leanbase-logger.ts +0 -26
  126. package/src/leanbase-persistence.ts +0 -374
  127. package/src/leanbase.ts +0 -424
  128. package/src/page-view.ts +0 -124
  129. package/src/scroll-manager.ts +0 -103
  130. package/src/session-props.ts +0 -114
  131. package/src/utils/event-utils.ts +0 -304
  132. package/src/utils/index.ts +0 -222
  133. package/src/utils/request-utils.ts +0 -128
  134. package/src/utils/simple-event-emitter.ts +0 -27
  135. package/src/utils/user-agent-utils.ts +0 -357
  136. package/src/version.ts +0 -1
@@ -7,36 +7,30 @@
7
7
  *
8
8
  * from https://github.com/LiosK/uuidv7/blob/e501462ea3d23241de13192ceae726956f9b3b7d/src/index.ts
9
9
  */
10
-
11
10
  // polyfill for IE11
12
- import { window } from './utils'
13
-
14
- import { isNumber, isUndefined } from '@posthog/core'
15
-
11
+ import { window } from './utils';
12
+ import { isNumber, isUndefined } from '@posthog/core';
16
13
  if (!Math.trunc) {
17
14
  Math.trunc = function (v) {
18
- return v < 0 ? Math.ceil(v) : Math.floor(v)
19
- }
15
+ return v < 0 ? Math.ceil(v) : Math.floor(v);
16
+ };
20
17
  }
21
-
22
18
  // polyfill for IE11
23
19
  if (!Number.isInteger) {
24
20
  Number.isInteger = function (value) {
25
- return isNumber(value) && isFinite(value) && Math.floor(value) === value
26
- }
21
+ return isNumber(value) && isFinite(value) && Math.floor(value) === value;
22
+ };
27
23
  }
28
-
29
- const DIGITS = '0123456789abcdef'
30
-
24
+ const DIGITS = '0123456789abcdef';
31
25
  /** Represents a UUID as a 16-byte byte array. */
32
26
  export class UUID {
33
27
  /** @param bytes - The 16-byte byte array representation. */
34
- constructor(readonly bytes: Readonly<Uint8Array>) {
28
+ constructor(bytes) {
29
+ this.bytes = bytes;
35
30
  if (bytes.length !== 16) {
36
- throw new TypeError('not 128-bit length')
31
+ throw new TypeError('not 128-bit length');
37
32
  }
38
33
  }
39
-
40
34
  /**
41
35
  * Builds a byte array from UUIDv7 field values.
42
36
  *
@@ -45,9 +39,8 @@ export class UUID {
45
39
  * @param randBHi - The higher 30 bits of 62-bit `rand_b` field value.
46
40
  * @param randBLo - The lower 32 bits of 62-bit `rand_b` field value.
47
41
  */
48
- static fromFieldsV7(unixTsMs: number, randA: number, randBHi: number, randBLo: number): UUID {
49
- if (
50
- !Number.isInteger(unixTsMs) ||
42
+ static fromFieldsV7(unixTsMs, randA, randBHi, randBLo) {
43
+ if (!Number.isInteger(unixTsMs) ||
51
44
  !Number.isInteger(randA) ||
52
45
  !Number.isInteger(randBHi) ||
53
46
  !Number.isInteger(randBLo) ||
@@ -55,83 +48,76 @@ export class UUID {
55
48
  randA < 0 ||
56
49
  randBHi < 0 ||
57
50
  randBLo < 0 ||
58
- unixTsMs > 0xffff_ffff_ffff ||
51
+ unixTsMs > 281474976710655 ||
59
52
  randA > 0xfff ||
60
- randBHi > 0x3fff_ffff ||
61
- randBLo > 0xffff_ffff
62
- ) {
63
- throw new RangeError('invalid field value')
53
+ randBHi > 1073741823 ||
54
+ randBLo > 4294967295) {
55
+ throw new RangeError('invalid field value');
64
56
  }
65
-
66
- const bytes = new Uint8Array(16)
67
- bytes[0] = unixTsMs / 2 ** 40
68
- bytes[1] = unixTsMs / 2 ** 32
69
- bytes[2] = unixTsMs / 2 ** 24
70
- bytes[3] = unixTsMs / 2 ** 16
71
- bytes[4] = unixTsMs / 2 ** 8
72
- bytes[5] = unixTsMs
73
- bytes[6] = 0x70 | (randA >>> 8)
74
- bytes[7] = randA
75
- bytes[8] = 0x80 | (randBHi >>> 24)
76
- bytes[9] = randBHi >>> 16
77
- bytes[10] = randBHi >>> 8
78
- bytes[11] = randBHi
79
- bytes[12] = randBLo >>> 24
80
- bytes[13] = randBLo >>> 16
81
- bytes[14] = randBLo >>> 8
82
- bytes[15] = randBLo
83
- return new UUID(bytes)
57
+ const bytes = new Uint8Array(16);
58
+ bytes[0] = unixTsMs / 2 ** 40;
59
+ bytes[1] = unixTsMs / 2 ** 32;
60
+ bytes[2] = unixTsMs / 2 ** 24;
61
+ bytes[3] = unixTsMs / 2 ** 16;
62
+ bytes[4] = unixTsMs / 2 ** 8;
63
+ bytes[5] = unixTsMs;
64
+ bytes[6] = 0x70 | (randA >>> 8);
65
+ bytes[7] = randA;
66
+ bytes[8] = 0x80 | (randBHi >>> 24);
67
+ bytes[9] = randBHi >>> 16;
68
+ bytes[10] = randBHi >>> 8;
69
+ bytes[11] = randBHi;
70
+ bytes[12] = randBLo >>> 24;
71
+ bytes[13] = randBLo >>> 16;
72
+ bytes[14] = randBLo >>> 8;
73
+ bytes[15] = randBLo;
74
+ return new UUID(bytes);
84
75
  }
85
-
86
76
  /** @returns The 8-4-4-4-12 canonical hexadecimal string representation. */
87
- toString(): string {
88
- let text = ''
77
+ toString() {
78
+ let text = '';
89
79
  for (let i = 0; i < this.bytes.length; i++) {
90
- text = text + DIGITS.charAt(this.bytes[i] >>> 4) + DIGITS.charAt(this.bytes[i] & 0xf)
80
+ text = text + DIGITS.charAt(this.bytes[i] >>> 4) + DIGITS.charAt(this.bytes[i] & 0xf);
91
81
  if (i === 3 || i === 5 || i === 7 || i === 9) {
92
- text += '-'
82
+ text += '-';
93
83
  }
94
84
  }
95
-
96
85
  if (text.length !== 36) {
97
86
  // We saw one customer whose bundling code was mangling the UUID generation
98
87
  // rather than accept a bad UUID, we throw an error here.
99
- throw new Error('Invalid UUIDv7 was generated')
88
+ throw new Error('Invalid UUIDv7 was generated');
100
89
  }
101
- return text
90
+ return text;
102
91
  }
103
-
104
92
  /** Creates an object from `this`. */
105
- clone(): UUID {
106
- return new UUID(this.bytes.slice(0))
93
+ clone() {
94
+ return new UUID(this.bytes.slice(0));
107
95
  }
108
-
109
96
  /** Returns true if `this` is equivalent to `other`. */
110
- equals(other: UUID): boolean {
111
- return this.compareTo(other) === 0
97
+ equals(other) {
98
+ return this.compareTo(other) === 0;
112
99
  }
113
-
114
100
  /**
115
101
  * Returns a negative integer, zero, or positive integer if `this` is less
116
102
  * than, equal to, or greater than `other`, respectively.
117
103
  */
118
- compareTo(other: UUID): number {
104
+ compareTo(other) {
119
105
  for (let i = 0; i < 16; i++) {
120
- const diff = this.bytes[i] - other.bytes[i]
106
+ const diff = this.bytes[i] - other.bytes[i];
121
107
  if (diff !== 0) {
122
- return Math.sign(diff)
108
+ return Math.sign(diff);
123
109
  }
124
110
  }
125
- return 0
111
+ return 0;
126
112
  }
127
113
  }
128
-
129
114
  /** Encapsulates the monotonic counter state. */
130
115
  class V7Generator {
131
- private _timestamp = 0
132
- private _counter = 0
133
- private readonly _random = new DefaultRandom()
134
-
116
+ constructor() {
117
+ this._timestamp = 0;
118
+ this._counter = 0;
119
+ this._random = new DefaultRandom();
120
+ }
135
121
  /**
136
122
  * Generates a new UUIDv7 object from the current timestamp, or resets the
137
123
  * generator upon significant timestamp rollback.
@@ -142,21 +128,21 @@ class V7Generator {
142
128
  * rollback is detected, this method resets the generator and returns a new
143
129
  * UUID based on the current timestamp.
144
130
  */
145
- generate(): UUID {
146
- const value = this.generateOrAbort()
131
+ generate() {
132
+ const value = this.generateOrAbort();
147
133
  if (!isUndefined(value)) {
148
- return value
149
- } else {
134
+ return value;
135
+ }
136
+ else {
150
137
  // reset state and resume
151
- this._timestamp = 0
152
- const valueAfterReset = this.generateOrAbort()
138
+ this._timestamp = 0;
139
+ const valueAfterReset = this.generateOrAbort();
153
140
  if (isUndefined(valueAfterReset)) {
154
- throw new Error('Could not generate UUID after timestamp reset')
141
+ throw new Error('Could not generate UUID after timestamp reset');
155
142
  }
156
- return valueAfterReset
143
+ return valueAfterReset;
157
144
  }
158
145
  }
159
-
160
146
  /**
161
147
  * Generates a new UUIDv7 object from the current timestamp, or returns
162
148
  * `undefined` upon significant timestamp rollback.
@@ -166,103 +152,89 @@ class V7Generator {
166
152
  * embedded in the immediately preceding UUID. If such a significant clock
167
153
  * rollback is detected, this method aborts and returns `undefined`.
168
154
  */
169
- generateOrAbort(): UUID | undefined {
170
- const MAX_COUNTER = 0x3ff_ffff_ffff
171
- const ROLLBACK_ALLOWANCE = 10_000 // 10 seconds
172
-
173
- const ts = Date.now()
155
+ generateOrAbort() {
156
+ const MAX_COUNTER = 4398046511103;
157
+ const ROLLBACK_ALLOWANCE = 10000; // 10 seconds
158
+ const ts = Date.now();
174
159
  if (ts > this._timestamp) {
175
- this._timestamp = ts
176
- this._resetCounter()
177
- } else if (ts + ROLLBACK_ALLOWANCE > this._timestamp) {
160
+ this._timestamp = ts;
161
+ this._resetCounter();
162
+ }
163
+ else if (ts + ROLLBACK_ALLOWANCE > this._timestamp) {
178
164
  // go on with previous timestamp if new one is not much smaller
179
- this._counter++
165
+ this._counter++;
180
166
  if (this._counter > MAX_COUNTER) {
181
167
  // increment timestamp at counter overflow
182
- this._timestamp++
183
- this._resetCounter()
168
+ this._timestamp++;
169
+ this._resetCounter();
184
170
  }
185
- } else {
171
+ }
172
+ else {
186
173
  // abort if clock went backwards to unbearable extent
187
- return undefined
174
+ return undefined;
188
175
  }
189
-
190
- return UUID.fromFieldsV7(
191
- this._timestamp,
192
- Math.trunc(this._counter / 2 ** 30),
193
- this._counter & (2 ** 30 - 1),
194
- this._random.nextUint32()
195
- )
176
+ return UUID.fromFieldsV7(this._timestamp, Math.trunc(this._counter / 2 ** 30), this._counter & (2 ** 30 - 1), this._random.nextUint32());
196
177
  }
197
-
198
178
  /** Initializes the counter at a 42-bit random integer. */
199
- private _resetCounter(): void {
200
- this._counter = this._random.nextUint32() * 0x400 + (this._random.nextUint32() & 0x3ff)
179
+ _resetCounter() {
180
+ this._counter = this._random.nextUint32() * 0x400 + (this._random.nextUint32() & 0x3ff);
201
181
  }
202
182
  }
203
-
204
- /** A global flag to force use of cryptographically strong RNG. */
205
- declare const UUIDV7_DENY_WEAK_RNG: boolean
206
-
207
183
  /** Stores `crypto.getRandomValues()` available in the environment. */
208
- let getRandomValues: <T extends Uint8Array | Uint32Array>(buffer: T) => T = (buffer) => {
184
+ let getRandomValues = (buffer) => {
209
185
  // fall back on Math.random() unless the flag is set to true
210
186
  // TRICKY: don't use the isUndefined method here as can't pass the reference
211
187
  if (typeof UUIDV7_DENY_WEAK_RNG !== 'undefined' && UUIDV7_DENY_WEAK_RNG) {
212
- throw new Error('no cryptographically strong RNG available')
188
+ throw new Error('no cryptographically strong RNG available');
213
189
  }
214
-
215
190
  for (let i = 0; i < buffer.length; i++) {
216
- buffer[i] = Math.trunc(Math.random() * 0x1_0000) * 0x1_0000 + Math.trunc(Math.random() * 0x1_0000)
191
+ buffer[i] = Math.trunc(Math.random() * 65536) * 65536 + Math.trunc(Math.random() * 65536);
217
192
  }
218
- return buffer
219
- }
220
-
193
+ return buffer;
194
+ };
221
195
  // detect Web Crypto API
222
196
  if (window && !isUndefined(window.crypto) && crypto.getRandomValues) {
223
- getRandomValues = (buffer) => crypto.getRandomValues(buffer)
197
+ getRandomValues = (buffer) => crypto.getRandomValues(buffer);
224
198
  }
225
-
226
199
  /**
227
200
  * Wraps `crypto.getRandomValues()` and compatibles to enable buffering; this
228
201
  * uses a small buffer by default to avoid unbearable throughput decline in some
229
202
  * environments as well as the waste of time and space for unused values.
230
203
  */
231
204
  class DefaultRandom {
232
- private readonly _buffer = new Uint32Array(8)
233
- private _cursor = Infinity
234
- nextUint32(): number {
205
+ constructor() {
206
+ this._buffer = new Uint32Array(8);
207
+ this._cursor = Infinity;
208
+ }
209
+ nextUint32() {
235
210
  if (this._cursor >= this._buffer.length) {
236
- getRandomValues(this._buffer)
237
- this._cursor = 0
211
+ getRandomValues(this._buffer);
212
+ this._cursor = 0;
238
213
  }
239
- return this._buffer[this._cursor++]
214
+ return this._buffer[this._cursor++];
240
215
  }
241
216
  }
242
-
243
- let defaultGenerator: V7Generator | undefined
244
-
217
+ let defaultGenerator;
245
218
  /**
246
219
  * Generates a UUIDv7 string.
247
220
  *
248
221
  * @returns The 8-4-4-4-12 canonical hexadecimal string representation
249
222
  * ("xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx").
250
223
  */
251
- export const uuidv7 = (): string => uuidv7obj().toString()
252
-
224
+ export const uuidv7 = () => uuidv7obj().toString();
253
225
  /** Generates a UUIDv7 object. */
254
- const uuidv7obj = (): UUID => (defaultGenerator || (defaultGenerator = new V7Generator())).generate()
255
-
256
- export const uuid7ToTimestampMs = (uuid: string): number => {
226
+ const uuidv7obj = () => (defaultGenerator || (defaultGenerator = new V7Generator())).generate();
227
+ export const uuid7ToTimestampMs = (uuid) => {
257
228
  // remove hyphens
258
- const hex = uuid.replace(/-/g, '')
229
+ const hex = uuid.replace(/-/g, '');
259
230
  // ensure that it's a version 7 UUID
260
231
  if (hex.length !== 32) {
261
- throw new Error('Not a valid UUID')
232
+ throw new Error('Not a valid UUID');
262
233
  }
263
234
  if (hex[12] !== '7') {
264
- throw new Error('Not a UUIDv7')
235
+ throw new Error('Not a UUIDv7');
265
236
  }
266
237
  // the first 6 bytes are the timestamp, which means that we can read only the first 12 hex characters
267
- return parseInt(hex.substring(0, 12), 16)
268
- }
238
+ return parseInt(hex.substring(0, 12), 16);
239
+ };
240
+ //# sourceMappingURL=uuidv7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"uuidv7.js","sourceRoot":"","sources":["../src/uuidv7.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,oBAAoB;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAA;AAEhC,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAErD,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC;IACd,IAAI,CAAC,KAAK,GAAG,UAAU,CAAC;QACpB,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC/C,CAAC,CAAA;AACL,CAAC;AAED,oBAAoB;AACpB,IAAI,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC;IACpB,MAAM,CAAC,SAAS,GAAG,UAAU,KAAK;QAC9B,OAAO,QAAQ,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 //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,eAAe,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leanbase.com/js",
3
- "version": "0.1.2",
3
+ "version": "0.2.0-alpha.0",
4
4
  "description": "Leanbase browser SDK - event tracking, autocapture, and session replay",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,14 +8,14 @@
8
8
  },
9
9
  "author": "leanbase",
10
10
  "license": "Copyrighted by Leanflag Limited",
11
- "main": "dist/index.cjs",
12
- "module": "dist/index.mjs",
13
- "types": "dist/index.d.ts",
11
+ "main": "dist/main.js",
12
+ "module": "dist/module.js",
13
+ "types": "dist/module.d.ts",
14
14
  "unpkg": "dist/leanbase.iife.js",
15
15
  "jsdelivr": "dist/leanbase.iife.js",
16
16
  "files": [
17
- "dist",
18
- "src",
17
+ "lib/*",
18
+ "dist/*",
19
19
  "README.md"
20
20
  ],
21
21
  "publishConfig": {
@@ -25,21 +25,33 @@
25
25
  "@posthog/core": "1.3.1"
26
26
  },
27
27
  "devDependencies": {
28
+ "@babel/core": "^7.27.1",
29
+ "@babel/plugin-transform-exponentiation-operator": "^7.27.1",
30
+ "@babel/plugin-transform-nullish-coalescing-operator": "^7.27.1",
31
+ "@babel/preset-env": "^7.27.2",
32
+ "@rollup/plugin-babel": "^6.0.4",
33
+ "@rollup/plugin-commonjs": "^28.0.6",
34
+ "@rollup/plugin-json": "^6.1.0",
35
+ "@rollup/plugin-node-resolve": "^16.0.1",
36
+ "@rollup/plugin-terser": "^0.4.4",
37
+ "@rollup/plugin-typescript": "^12.1.4",
38
+ "rollup-plugin-dts": "^6.2.3",
28
39
  "jest": "^29.7.0",
29
40
  "jest-environment-jsdom": "^29.7.0",
30
41
  "rollup": "^4.44.1",
31
42
  "rimraf": "^6.0.1",
32
- "@posthog-tooling/tsconfig-base": "1.0.0",
33
- "@posthog-tooling/rollup-utils": "1.0.0"
43
+ "typescript": "5.8.2",
44
+ "@posthog-tooling/rollup-utils": "1.0.0",
45
+ "@posthog-tooling/tsconfig-base": "1.0.0"
34
46
  },
35
47
  "scripts": {
36
- "clean": "rimraf dist coverage",
48
+ "clean": "rimraf dist lib coverage",
37
49
  "test:unit": "jest -c jest.config.js",
38
50
  "lint": "eslint src test",
39
51
  "lint:fix": "eslint src test --fix",
40
- "prebuild": "node -p \"'export const version = \\'' + require('./package.json').version + '\\''\" > src/version.ts",
52
+ "prebuild": "node -p \"'export const version = \\'' + require('./package.json').version + '\\''\" > src/version.ts && tsc -b",
41
53
  "build": "rollup -c",
42
- "dev": "rollup -c -w",
54
+ "dev": "tsc -b && rollup -c -w",
43
55
  "package": "mkdir -p ../../target && pnpm pack --pack-destination ../../target"
44
56
  }
45
57
  }