mixpanel-browser 2.62.0 → 2.63.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.
- package/CHANGELOG.md +4 -0
- package/build.sh +4 -21
- package/dist/mixpanel-core.cjs.js +10 -3
- package/dist/mixpanel-js-wrapper.min.js +5 -5
- package/dist/mixpanel-jslib-snippet.min.js +3 -3
- package/dist/mixpanel-jslib-snippet.min.test.js +3 -3
- package/dist/mixpanel-recorder.js +13552 -4502
- package/dist/mixpanel-recorder.min.js +1 -38
- package/dist/mixpanel-recorder.min.js.map +1 -1
- package/dist/mixpanel-with-async-recorder.cjs.js +9 -3
- package/dist/mixpanel-with-recorder.js +22218 -0
- package/dist/mixpanel-with-recorder.min.js +1 -0
- package/dist/mixpanel.amd.js +13558 -4501
- package/dist/mixpanel.cjs.js +13558 -4501
- package/dist/mixpanel.globals.js +9 -3
- package/dist/mixpanel.min.js +144 -144
- package/dist/mixpanel.module.js +13558 -4501
- package/dist/mixpanel.umd.js +13558 -4501
- package/dist/rrweb-compiled.js +18693 -0
- package/package.json +8 -4
- package/rollup.config.mjs +223 -0
- package/src/config.js +1 -1
- package/src/loaders/loader-globals-with-recorder.js +7 -0
- package/src/recorder/session-recording.js +1 -1
- package/src/storage/local-storage.js +2 -1
- package/rollup.config.js +0 -11
- package/src/recorder/rollup.config.js +0 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mixpanel-browser",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.63.0",
|
|
4
4
|
"description": "The official Mixpanel JavaScript browser client library",
|
|
5
5
|
"main": "dist/mixpanel.cjs.js",
|
|
6
6
|
"module": "dist/mixpanel.module.js",
|
|
@@ -33,7 +33,11 @@
|
|
|
33
33
|
},
|
|
34
34
|
"homepage": "https://github.com/mixpanel/mixpanel-js",
|
|
35
35
|
"devDependencies": {
|
|
36
|
+
"@ampproject/rollup-plugin-closure-compiler": "0.27.0",
|
|
37
|
+
"@rollup/plugin-alias": "5.1.1",
|
|
36
38
|
"@rollup/plugin-node-resolve": "15.2.3",
|
|
39
|
+
"@rollup/plugin-swc": "0.4.0",
|
|
40
|
+
"@swc/core": "1.11.7",
|
|
37
41
|
"babel": "6.5.2",
|
|
38
42
|
"babel-core": "6.7.2",
|
|
39
43
|
"babel-preset-es2015": "6.6.0",
|
|
@@ -54,13 +58,13 @@
|
|
|
54
58
|
"morgan": "1.9.1",
|
|
55
59
|
"rdme": "7.5.0",
|
|
56
60
|
"request": "2.88.0",
|
|
57
|
-
"rollup": "
|
|
58
|
-
"rollup-plugin-esbuild": "
|
|
61
|
+
"rollup": "4.34.9",
|
|
62
|
+
"rollup-plugin-esbuild": "6.2.1",
|
|
59
63
|
"sinon": "8.1.1",
|
|
60
64
|
"sinon-chai": "3.5.0",
|
|
61
65
|
"webpack": "1.12.2"
|
|
62
66
|
},
|
|
63
67
|
"dependencies": {
|
|
64
|
-
"rrweb": "2.0.0-alpha.
|
|
68
|
+
"rrweb": "2.0.0-alpha.18"
|
|
65
69
|
}
|
|
66
70
|
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import nodeResolve from '@rollup/plugin-node-resolve';
|
|
2
|
+
import swc from '@rollup/plugin-swc';
|
|
3
|
+
import esbuild from 'rollup-plugin-esbuild';
|
|
4
|
+
import alias from '@rollup/plugin-alias';
|
|
5
|
+
import closureCompiler from '@ampproject/rollup-plugin-closure-compiler';
|
|
6
|
+
|
|
7
|
+
const COMPILED_RRWEB_PATH = 'build/rrweb-compiled.js';
|
|
8
|
+
|
|
9
|
+
const aliasRrweb = () => alias({
|
|
10
|
+
entries: [
|
|
11
|
+
{ find: 'rrweb', replacement: COMPILED_RRWEB_PATH },
|
|
12
|
+
]
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const COMMON_CLOSURE_FLAGS = {
|
|
16
|
+
compilation_level: 'ADVANCED_OPTIMIZATIONS',
|
|
17
|
+
language_in: 'ECMASCRIPT5',
|
|
18
|
+
externs: ['src/externs.js'],
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
const MINIFY = process.env.MINIFY || process.env.FULL;
|
|
22
|
+
|
|
23
|
+
// Main builds used to develop / iterate quickly
|
|
24
|
+
const MAIN_BUILDS = [
|
|
25
|
+
// compile rrweb first to es5 with swc, we'll replace the import later on
|
|
26
|
+
{
|
|
27
|
+
'input': 'rrweb',
|
|
28
|
+
'output': [
|
|
29
|
+
{
|
|
30
|
+
file: COMPILED_RRWEB_PATH,
|
|
31
|
+
}
|
|
32
|
+
],
|
|
33
|
+
plugins: [nodeResolve({browser: true}), swc({swc: {jsc: {target: 'es5'}}})]
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
// IIFE recorder bundle that is loaded asynchronously
|
|
37
|
+
// rrweb uses esbuild to minify, so do that here as well
|
|
38
|
+
{
|
|
39
|
+
input: 'src/recorder/index.js',
|
|
40
|
+
output: [
|
|
41
|
+
{
|
|
42
|
+
file: 'build/mixpanel-recorder.js',
|
|
43
|
+
name: 'mixpanel_recorder',
|
|
44
|
+
format: 'iife',
|
|
45
|
+
},
|
|
46
|
+
...(MINIFY
|
|
47
|
+
? [
|
|
48
|
+
{
|
|
49
|
+
file: 'build/mixpanel-recorder.min.js',
|
|
50
|
+
name: 'mixpanel_recorder',
|
|
51
|
+
format: 'iife',
|
|
52
|
+
plugins: [esbuild({target: 'es5', minify: true, sourceMap: true})],
|
|
53
|
+
sourcemap: true,
|
|
54
|
+
},
|
|
55
|
+
]
|
|
56
|
+
: []),
|
|
57
|
+
],
|
|
58
|
+
plugins: [aliasRrweb()],
|
|
59
|
+
},
|
|
60
|
+
|
|
61
|
+
// IIFE main mixpanel build
|
|
62
|
+
{
|
|
63
|
+
input: 'src/loaders/loader-globals.js',
|
|
64
|
+
output: [
|
|
65
|
+
{
|
|
66
|
+
file: 'build/mixpanel.globals.js',
|
|
67
|
+
name: 'mixpanel',
|
|
68
|
+
format: 'iife',
|
|
69
|
+
},
|
|
70
|
+
...(MINIFY
|
|
71
|
+
? [
|
|
72
|
+
{
|
|
73
|
+
file: 'build/mixpanel.min.js',
|
|
74
|
+
format: 'iife',
|
|
75
|
+
plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)],
|
|
76
|
+
},
|
|
77
|
+
]
|
|
78
|
+
: []),
|
|
79
|
+
],
|
|
80
|
+
plugins: [
|
|
81
|
+
nodeResolve({
|
|
82
|
+
browser: true,
|
|
83
|
+
main: true,
|
|
84
|
+
jsnext: true,
|
|
85
|
+
})
|
|
86
|
+
]
|
|
87
|
+
},
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
const ALL_BUILDS = [
|
|
91
|
+
...MAIN_BUILDS,
|
|
92
|
+
// Minified snippets for loading mixpanel
|
|
93
|
+
{
|
|
94
|
+
input: 'src/loaders/mixpanel-jslib-snippet.js',
|
|
95
|
+
output: [
|
|
96
|
+
{
|
|
97
|
+
file: 'build/mixpanel-jslib-snippet.min.js',
|
|
98
|
+
plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)]
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
file: 'build/mixpanel-jslib-snippet.min.test.js',
|
|
102
|
+
plugins: [closureCompiler({...COMMON_CLOSURE_FLAGS, define: 'MIXPANEL_LIB_URL="../build/mixpanel.min.js"'})],
|
|
103
|
+
}
|
|
104
|
+
],
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
// IIFE mixpanel snippet loader
|
|
108
|
+
{
|
|
109
|
+
input: 'src/loaders/mixpanel-js-wrapper.js',
|
|
110
|
+
output: [
|
|
111
|
+
{
|
|
112
|
+
file: 'build/mixpanel-js-wrapper.js',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
file: 'build/mixpanel-js-wrapper.min.js',
|
|
116
|
+
plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)],
|
|
117
|
+
}
|
|
118
|
+
],
|
|
119
|
+
},
|
|
120
|
+
|
|
121
|
+
// IIFE mixpanel core with bundled recorder
|
|
122
|
+
{
|
|
123
|
+
input: 'src/loaders/loader-globals-with-recorder.js',
|
|
124
|
+
output: [
|
|
125
|
+
{
|
|
126
|
+
file: 'build/mixpanel-with-recorder.js',
|
|
127
|
+
name: 'mixpanel',
|
|
128
|
+
format: 'iife',
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
file: 'build/mixpanel-with-recorder.min.js',
|
|
132
|
+
name: 'mixpanel',
|
|
133
|
+
format: 'iife',
|
|
134
|
+
plugins: [esbuild({target: 'es5', minify: true, sourceMap: true})],
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
plugins: [
|
|
138
|
+
aliasRrweb(),
|
|
139
|
+
nodeResolve({
|
|
140
|
+
browser: true,
|
|
141
|
+
main: true,
|
|
142
|
+
jsnext: true,
|
|
143
|
+
})
|
|
144
|
+
],
|
|
145
|
+
},
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
// Modules builds that are bundled with the recorder
|
|
149
|
+
{
|
|
150
|
+
input: 'src/loaders/loader-module.js',
|
|
151
|
+
output: [
|
|
152
|
+
{
|
|
153
|
+
file: 'build/mixpanel.cjs.js',
|
|
154
|
+
name: 'mixpanel',
|
|
155
|
+
format: 'cjs',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
file: 'build/mixpanel.amd.js',
|
|
159
|
+
name: 'mixpanel',
|
|
160
|
+
format: 'amd',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
file: 'build/mixpanel.umd.js',
|
|
164
|
+
name: 'mixpanel',
|
|
165
|
+
format: 'umd',
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
file: 'build/mixpanel.module.js',
|
|
169
|
+
name: 'mixpanel',
|
|
170
|
+
format: 'es',
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
plugins: [
|
|
174
|
+
aliasRrweb(),
|
|
175
|
+
nodeResolve({
|
|
176
|
+
browser: true,
|
|
177
|
+
main: true,
|
|
178
|
+
jsnext: true,
|
|
179
|
+
})
|
|
180
|
+
],
|
|
181
|
+
},
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
// Alternative CJS builds without recorder
|
|
185
|
+
{
|
|
186
|
+
input: 'src/loaders/loader-module-core.js',
|
|
187
|
+
output: [
|
|
188
|
+
{
|
|
189
|
+
file: 'build/mixpanel-core.cjs.js',
|
|
190
|
+
name: 'mixpanel',
|
|
191
|
+
format: 'cjs',
|
|
192
|
+
},
|
|
193
|
+
],
|
|
194
|
+
plugins: [
|
|
195
|
+
aliasRrweb(),
|
|
196
|
+
nodeResolve({
|
|
197
|
+
browser: true,
|
|
198
|
+
main: true,
|
|
199
|
+
jsnext: true,
|
|
200
|
+
})
|
|
201
|
+
],
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
input: 'src/loaders/loader-module-with-async-recorder.js',
|
|
205
|
+
output: [
|
|
206
|
+
{
|
|
207
|
+
file: 'build/mixpanel-with-async-recorder.cjs.js',
|
|
208
|
+
name: 'mixpanel',
|
|
209
|
+
format: 'cjs',
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
plugins: [
|
|
213
|
+
aliasRrweb(),
|
|
214
|
+
nodeResolve({
|
|
215
|
+
browser: true,
|
|
216
|
+
main: true,
|
|
217
|
+
jsnext: true,
|
|
218
|
+
})
|
|
219
|
+
],
|
|
220
|
+
}
|
|
221
|
+
];
|
|
222
|
+
|
|
223
|
+
export default process.env.FULL ? ALL_BUILDS : MAIN_BUILDS;
|
package/src/config.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { window } from '../window';
|
|
2
|
-
import { IncrementalSource, EventType } from '
|
|
2
|
+
import { IncrementalSource, EventType } from 'rrweb';
|
|
3
3
|
import { MAX_RECORDING_MS, MAX_VALUE_FOR_MIN_RECORDING_MS, console_with_prefix, NOOP_FUNC, _, localStorageSupported} from '../utils'; // eslint-disable-line camelcase
|
|
4
4
|
import { IDBStorageWrapper, RECORDING_EVENTS_STORE_NAME } from '../storage/indexed-db';
|
|
5
5
|
import { addOptOutCheckMixpanelLib } from '../gdpr-utils';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Promise } from '../promise-polyfill';
|
|
2
2
|
import { _, JSONParse, JSONStringify } from '../utils'; // eslint-disable-line camelcase
|
|
3
|
+
import { window } from '../window';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* @type {import('./wrapper').StorageWrapper}
|
|
6
7
|
*/
|
|
7
8
|
var LocalStorageWrapper = function (storageOverride) {
|
|
8
|
-
this.storage = storageOverride || localStorage;
|
|
9
|
+
this.storage = storageOverride || window.localStorage;
|
|
9
10
|
};
|
|
10
11
|
|
|
11
12
|
LocalStorageWrapper.prototype.init = function () {
|
package/rollup.config.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import esbuild from 'rollup-plugin-esbuild';
|
|
2
|
-
import { nodeResolve } from '@rollup/plugin-node-resolve';
|
|
3
|
-
|
|
4
|
-
export default {
|
|
5
|
-
input: 'index.js',
|
|
6
|
-
output: [
|
|
7
|
-
{
|
|
8
|
-
file: 'build/mixpanel-recorder.js',
|
|
9
|
-
format: 'esm'
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
file: 'build/mixpanel-recorder.min.js',
|
|
13
|
-
format: 'esm',
|
|
14
|
-
name: 'version',
|
|
15
|
-
plugins: [esbuild({minify: true, sourceMap: true})],
|
|
16
|
-
sourcemap: true,
|
|
17
|
-
}
|
|
18
|
-
],
|
|
19
|
-
plugins: [nodeResolve({browser: true})],
|
|
20
|
-
};
|