mixpanel-browser 2.73.0 → 2.75.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 (55) hide show
  1. package/.eslintrc.json +7 -4
  2. package/.github/workflows/integration-tests.yml +52 -0
  3. package/.github/workflows/unit-tests.yml +40 -0
  4. package/CHANGELOG.md +12 -0
  5. package/README.md +3 -3
  6. package/build.sh +1 -5
  7. package/dist/mixpanel-core.cjs.d.ts +12 -1
  8. package/dist/mixpanel-core.cjs.js +432 -34
  9. package/dist/mixpanel-recorder.js +5364 -684
  10. package/dist/mixpanel-recorder.min.js +1 -1
  11. package/dist/mixpanel-recorder.min.js.map +1 -1
  12. package/dist/mixpanel-targeting.js +2576 -0
  13. package/dist/mixpanel-targeting.min.js +2 -0
  14. package/dist/mixpanel-targeting.min.js.map +1 -0
  15. package/dist/mixpanel-with-async-modules.cjs.d.ts +522 -0
  16. package/dist/mixpanel-with-async-modules.cjs.js +9700 -0
  17. package/dist/mixpanel-with-async-recorder.cjs.d.ts +12 -1
  18. package/dist/mixpanel-with-async-recorder.cjs.js +432 -34
  19. package/dist/mixpanel-with-recorder.d.ts +12 -1
  20. package/dist/mixpanel-with-recorder.js +7889 -2839
  21. package/dist/mixpanel-with-recorder.min.d.ts +12 -1
  22. package/dist/mixpanel-with-recorder.min.js +1 -1
  23. package/dist/mixpanel.amd.d.ts +12 -1
  24. package/dist/mixpanel.amd.js +8446 -2813
  25. package/dist/mixpanel.cjs.d.ts +12 -1
  26. package/dist/mixpanel.cjs.js +8446 -2813
  27. package/dist/mixpanel.globals.js +432 -34
  28. package/dist/mixpanel.min.js +182 -173
  29. package/dist/mixpanel.module.d.ts +12 -1
  30. package/dist/mixpanel.module.js +8446 -2813
  31. package/dist/mixpanel.umd.d.ts +12 -1
  32. package/dist/mixpanel.umd.js +8446 -2813
  33. package/dist/rrweb-bundled.js +4434 -596
  34. package/dist/rrweb-compiled.js +5078 -646
  35. package/package.json +33 -7
  36. package/rollup.config.mjs +286 -224
  37. package/src/autocapture/utils.js +15 -7
  38. package/src/config.js +1 -1
  39. package/src/flags/index.js +269 -8
  40. package/src/globals.js +14 -0
  41. package/src/index.d.ts +12 -1
  42. package/src/loaders/loader-module.js +1 -0
  43. package/src/mixpanel-core.js +101 -8
  44. package/src/recorder/index.js +2 -1
  45. package/src/recorder/masking.js +197 -0
  46. package/src/recorder/rrweb-entrypoint.js +2 -1
  47. package/src/recorder/session-recording.js +43 -4
  48. package/src/recorder/utils.js +5 -1
  49. package/src/targeting/event-matcher.js +97 -0
  50. package/src/targeting/index.js +11 -0
  51. package/src/targeting/loader.js +36 -0
  52. package/src/utils.js +12 -10
  53. package/testServer.js +51 -7
  54. package/.github/workflows/tests.yml +0 -25
  55. /package/src/loaders/{loader-module-with-async-recorder.js → loader-module-with-async-modules.js} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mixpanel-browser",
3
- "version": "2.73.0",
3
+ "version": "2.75.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",
@@ -9,17 +9,29 @@
9
9
  },
10
10
  "scripts": {
11
11
  "build": "./build.sh",
12
+ "build-watch": "npx rollup -c rollup.config.mjs -w",
13
+ "build-watch:full": "FULL=1 npx rollup -c rollup.config.mjs -w",
12
14
  "build-dist": "DIST=1 ./build.sh",
13
15
  "build-full": "FULL=1 ./build.sh",
14
16
  "build-test-polyfill": "webpack tests/vendor/core-js-polyfills.src.js tests/vendor/core-js-polyfills.js",
17
+ "build-browser-tests": "npx rollup -c tests/browser/client/rollup.config.mjs -w",
15
18
  "dox": "node doc/build-docs.js",
16
19
  "dox-publish": "rdme docs:single doc/readme.io/javascript-full-api-reference.md --key=$RDME_API_KEY --version=$RDME_DOC_VERSION",
17
- "integration_test": "echo 'Browse to localhost:3000/tests' && node testServer.js",
20
+ "test-server": "echo 'Browse to localhost:3001/tests' && node testServer.js",
21
+ "test-server:background": "screen -S testServer -X stuff $^C; screen -X -S testServer quit; screen -d -m -S testServer bash -c 'npm run test-server; exec bash' && wait-on --timeout 10000 http://localhost:3001/tests",
18
22
  "lint": "eslint ./src",
23
+ "lint-fix": "eslint --fix ./src && eslint --fix ./tests/browser",
19
24
  "prepublishOnly": "npm run build-dist",
20
25
  "start": "pushd examples; python -m SimpleHTTPServer; popd",
21
26
  "test": "npm run lint && npm run unit-test",
27
+ "test:ci": "npm run lint && npm run unit-test:ci",
22
28
  "unit-test": "BABEL_ENV=test mocha --require babel-core/register tests/unit/*.js",
29
+ "unit-test:ci": "BABEL_ENV=test mocha --require babel-core/register tests/unit/*.js --reporter json --reporter-option output=tests/unit/results/results.json",
30
+ "integration-test:local": "wdio run tests/browser/wdio.local.mjs",
31
+ "integration-test:local:watch": "wdio run tests/browser/wdio.local.mjs --watch",
32
+ "integration-test:sauce": "wdio run tests/browser/wdio.sauce.mjs",
33
+ "integration-test": "DEV=1 npm run integration-test:local:watch",
34
+ "integration-test:full": "npm run integration-test:local:watch",
23
35
  "validate": "npm ls"
24
36
  },
25
37
  "types": "./src/index.d.ts",
@@ -33,40 +45,54 @@
33
45
  "url": "https://github.com/mixpanel/mixpanel-js/issues"
34
46
  },
35
47
  "homepage": "https://github.com/mixpanel/mixpanel-js",
48
+ "engines": {
49
+ "node": ">=20 <26"
50
+ },
36
51
  "devDependencies": {
37
52
  "@ampproject/rollup-plugin-closure-compiler": "0.27.0",
38
53
  "@rollup/plugin-alias": "5.1.1",
54
+ "@rollup/plugin-commonjs": "28.0.3",
39
55
  "@rollup/plugin-node-resolve": "15.2.3",
40
56
  "@rollup/plugin-swc": "0.4.0",
41
57
  "@swc/core": "1.11.7",
42
- "babel": "6.5.2",
58
+ "@wdio/cli": "9.12.0",
59
+ "@wdio/junit-reporter": "9.12.2",
60
+ "@wdio/local-runner": "9.12.0",
61
+ "@wdio/mocha-framework": "9.11.0",
62
+ "@wdio/sauce-service": "9.21.0",
63
+ "@wdio/spec-reporter": "9.11.0",
43
64
  "babel-core": "6.7.2",
44
65
  "babel-preset-es2015": "6.6.0",
45
66
  "babelify": "6.1.2",
46
67
  "browserify": "10.2.4",
47
68
  "chai": "4.0.0",
69
+ "chromedriver": "134.0.3",
48
70
  "cookie-parser": "1.3.4",
49
71
  "core-js": "3.6.5",
50
72
  "dox": "0.9.0",
51
73
  "eslint": "4.18.2",
52
- "express": "4.12.2",
74
+ "express": "5.2.1",
53
75
  "fake-indexeddb": "6.0.0",
54
76
  "jsdom": "16.5.0",
55
77
  "jsdom-global": "3.0.2",
56
78
  "localStorage": "1.0.4",
57
79
  "lodash": "4.17.21",
58
- "mocha": "7.1.1",
80
+ "mocha": "11.1.0",
59
81
  "morgan": "1.9.1",
82
+ "pug": "3.0.3",
60
83
  "rdme": "7.5.0",
61
84
  "request": "2.88.0",
62
85
  "rollup": "4.34.9",
63
86
  "rollup-plugin-esbuild": "6.2.1",
64
87
  "sinon": "8.1.1",
65
88
  "sinon-chai": "3.5.0",
89
+ "wait-on": "8.0.3",
90
+ "wdio-ctrf-json-reporter": "0.0.13",
66
91
  "webpack": "1.12.2"
67
92
  },
68
93
  "dependencies": {
69
- "@mixpanel/rrweb": "2.0.0-alpha.18.2",
70
- "@mixpanel/rrweb-plugin-console-record": "2.0.0-alpha.18.2"
94
+ "@mixpanel/rrweb": "2.0.0-alpha.18.3",
95
+ "@mixpanel/rrweb-plugin-console-record": "2.0.0-alpha.18.3",
96
+ "json-logic-js": "2.0.5"
71
97
  }
72
98
  }
package/rollup.config.mjs CHANGED
@@ -1,258 +1,320 @@
1
- import nodeResolve from '@rollup/plugin-node-resolve';
2
- import swc from '@rollup/plugin-swc';
3
- import esbuild from 'rollup-plugin-esbuild';
4
1
  import alias from '@rollup/plugin-alias';
5
2
  import closureCompiler from '@ampproject/rollup-plugin-closure-compiler';
3
+ import commonjs from '@rollup/plugin-commonjs';
6
4
  import fs from 'fs';
7
5
  import path from 'path';
6
+ import esbuild from 'rollup-plugin-esbuild';
7
+ import nodeResolve from '@rollup/plugin-node-resolve';
8
+ import swc from '@rollup/plugin-swc';
9
+ import browserTestBuilds from './tests/browser/client/rollup.config.mjs';
8
10
 
9
- const COMPILED_RRWEB_PATH = 'build/rrweb-compiled.js';
10
- const BUNDLED_RRWEB_PATH = 'build/rrweb-bundled.js';
11
+ const COMPILED_RRWEB_PATH = `build/rrweb-compiled.js`;
12
+ const BUNDLED_RRWEB_PATH = `build/rrweb-bundled.js`;
13
+
14
+ // Delete output files at build start so build errors don't silently use stale files
15
+ const cleanOnRebuild = () => {
16
+ let outputFiles = [];
17
+ return {
18
+ name: `clean-on-rebuild`,
19
+ options(opts) {
20
+ const outputs = Array.isArray(opts.output) ? opts.output : [opts.output];
21
+ outputFiles = outputs.map(o => o && o.file).filter(Boolean);
22
+ },
23
+ buildStart() {
24
+ // Delete outputs right before this specific build runs
25
+ for (const file of outputFiles) {
26
+ if (fs.existsSync(file)) {
27
+ fs.unlinkSync(file);
28
+ }
29
+ }
30
+ }
31
+ };
32
+ };
33
+
34
+ const withCleanOnRebuild = (builds) => builds.map(build => ({
35
+ ...build,
36
+ plugins: [cleanOnRebuild(), ...(build.plugins || [])]
37
+ }));
11
38
 
12
39
  const aliasRrweb = () => alias({
13
- entries: [
14
- { find: /rrweb-entrypoint(?:\.js)?$/, replacement: COMPILED_RRWEB_PATH },
15
- ]
40
+ entries: [
41
+ { find: /rrweb-entrypoint(?:\.js)?$/, replacement: COMPILED_RRWEB_PATH },
42
+ ]
16
43
  });
17
44
 
18
45
  const copyTypes = () => ({
19
- name: 'copy-types',
20
- generateBundle(_options, bundle) {
21
- try {
22
- for (const builtFileName of Object.keys(bundle)) {
23
- const buildDir = 'build';
24
- const types = fs.readFileSync('src/index.d.ts', 'utf8');
25
- const builtFile = path.basename(builtFileName, path.extname(builtFileName)) + '.d.ts';
26
- fs.writeFileSync(path.join(buildDir, builtFile), types);
27
- }
46
+ name: `copy-types`,
47
+ generateBundle(_options, bundle) {
48
+ try {
49
+ for (const builtFileName of Object.keys(bundle)) {
50
+ const buildDir = `build`;
51
+ const types = fs.readFileSync(`src/index.d.ts`, `utf8`);
52
+ const builtFile = path.basename(builtFileName, path.extname(builtFileName)) + `.d.ts`;
53
+ fs.writeFileSync(path.join(buildDir, builtFile), types);
54
+ }
28
55
 
29
- } catch (err) {
30
- console.warn('Could not copy type files:', err.message);
31
- throw err;
32
- }
56
+ } catch (err) {
57
+ console.warn(`Could not copy type files:`, err.message);
58
+ throw err;
33
59
  }
60
+ }
34
61
  });
35
62
 
36
63
  const COMMON_CLOSURE_FLAGS = {
37
- compilation_level: 'ADVANCED_OPTIMIZATIONS',
38
- language_in: 'ECMASCRIPT5',
39
- externs: ['src/externs.js'],
64
+ compilation_level: `ADVANCED_OPTIMIZATIONS`,
65
+ language_in: `ECMASCRIPT5`,
66
+ externs: [`src/externs.js`],
67
+ create_source_map: true,
40
68
  };
41
69
 
42
70
  const MINIFY = process.env.MINIFY || process.env.FULL;
43
71
 
44
72
  // Main builds used to develop / iterate quickly
45
73
  const MAIN_BUILDS = [
46
- {
47
- 'input': 'src/recorder/rrweb-entrypoint.js',
48
- 'output': [
49
- {
50
- file: BUNDLED_RRWEB_PATH,
51
- format: 'es',
52
- }
53
- ],
54
- plugins: [nodeResolve({browser: true})]
55
- },
56
- {
57
- 'input': BUNDLED_RRWEB_PATH,
58
- 'output': [
59
- {
60
- file: COMPILED_RRWEB_PATH,
61
- format: 'es',
62
- }
63
- ],
64
- plugins: [swc({swc: {jsc: {target: 'es5'}}})]
65
- },
74
+ {
75
+ 'input': `src/recorder/rrweb-entrypoint.js`,
76
+ 'output': [
77
+ {
78
+ file: BUNDLED_RRWEB_PATH,
79
+ format: `es`,
80
+ }
81
+ ],
82
+ plugins: [nodeResolve({browser: true})]
83
+ },
84
+ {
85
+ 'input': BUNDLED_RRWEB_PATH,
86
+ 'output': [
87
+ {
88
+ file: COMPILED_RRWEB_PATH,
89
+ format: `es`,
90
+ }
91
+ ],
92
+ plugins: [swc({swc: {jsc: {target: `es5`}}})]
93
+ },
66
94
 
67
- // IIFE recorder bundle that is loaded asynchronously
68
- // rrweb uses esbuild to minify, so do that here as well
69
- {
70
- input: 'src/recorder/index.js',
71
- output: [
72
- {
73
- file: 'build/mixpanel-recorder.js',
74
- name: 'mixpanel_recorder',
75
- format: 'iife',
76
- },
77
- ...(MINIFY
78
- ? [
79
- {
80
- file: 'build/mixpanel-recorder.min.js',
81
- name: 'mixpanel_recorder',
82
- format: 'iife',
83
- plugins: [esbuild({target: 'es5', minify: true, sourceMap: true})],
84
- sourcemap: true,
85
- },
86
- ]
87
- : []),
88
- ],
89
- plugins: [aliasRrweb()],
90
- },
95
+ // IIFE recorder bundle that is loaded asynchronously
96
+ // rrweb uses esbuild to minify, so do that here as well
97
+ {
98
+ input: `src/recorder/index.js`,
99
+ output: [
100
+ {
101
+ file: `build/mixpanel-recorder.js`,
102
+ name: `mixpanel_recorder`,
103
+ format: `iife`,
104
+ },
105
+ ...(MINIFY
106
+ ? [
107
+ {
108
+ file: `build/mixpanel-recorder.min.js`,
109
+ name: `mixpanel_recorder`,
110
+ format: `iife`,
111
+ plugins: [esbuild({target: `es5`, minify: true, sourceMap: true})],
112
+ sourcemap: true,
113
+ },
114
+ ]
115
+ : []),
116
+ ],
117
+ plugins: [aliasRrweb()],
118
+ },
91
119
 
92
- // IIFE main mixpanel build
93
- {
94
- input: 'src/loaders/loader-globals.js',
95
- output: [
96
- {
97
- file: 'build/mixpanel.globals.js',
98
- name: 'mixpanel',
99
- format: 'iife',
100
- },
101
- ...(MINIFY
102
- ? [
103
- {
104
- file: 'build/mixpanel.min.js',
105
- format: 'iife',
106
- plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)],
107
- },
108
- ]
109
- : []),
110
- ],
111
- plugins: [
112
- nodeResolve({
113
- browser: true,
114
- main: true,
115
- jsnext: true,
116
- })
120
+ // IIFE targeting bundle that is loaded asynchronously
121
+ {
122
+ input: `src/targeting/index.js`,
123
+ output: [
124
+ {
125
+ file: `build/mixpanel-targeting.js`,
126
+ name: `mixpanel_targeting`,
127
+ format: `iife`,
128
+ },
129
+ ...(MINIFY
130
+ ? [
131
+ {
132
+ file: `build/mixpanel-targeting.min.js`,
133
+ name: `mixpanel_targeting`,
134
+ format: `iife`,
135
+ plugins: [esbuild({target: `es5`, minify: true, sourceMap: true})],
136
+ sourcemap: true,
137
+ },
117
138
  ]
118
- },
119
- ]
139
+ : []),
140
+ ],
141
+ plugins: [commonjs(), nodeResolve({browser: true})],
142
+ },
143
+
144
+ // IIFE main mixpanel build
145
+ {
146
+ input: `src/loaders/loader-globals.js`,
147
+ output: [
148
+ {
149
+ file: `build/mixpanel.globals.js`,
150
+ name: `mixpanel`,
151
+ format: `iife`,
152
+ },
153
+ ...(MINIFY
154
+ ? [
155
+ {
156
+ file: `build/mixpanel.min.js`,
157
+ format: `iife`,
158
+ plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)],
159
+ },
160
+ ]
161
+ : []),
162
+ ],
163
+ plugins: [
164
+ nodeResolve({
165
+ browser: true,
166
+ main: true,
167
+ jsnext: true,
168
+ })
169
+ ]
170
+ },
171
+ ];
120
172
 
121
173
  const ALL_BUILDS = [
122
- ...MAIN_BUILDS,
123
- // Minified snippets for loading mixpanel
124
- {
125
- input: 'src/loaders/mixpanel-jslib-snippet.js',
126
- output: [
127
- {
128
- file: 'build/mixpanel-jslib-snippet.min.js',
129
- plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)]
130
- },
131
- {
132
- file: 'build/mixpanel-jslib-snippet.min.test.js',
133
- plugins: [closureCompiler({...COMMON_CLOSURE_FLAGS, define: 'MIXPANEL_LIB_URL="../build/mixpanel.min.js"'})],
134
- }
135
- ],
136
- },
174
+ ...MAIN_BUILDS,
175
+ // Minified snippets for loading mixpanel
176
+ {
177
+ input: `src/loaders/mixpanel-jslib-snippet.js`,
178
+ output: [
179
+ {
180
+ file: `build/mixpanel-jslib-snippet.min.js`,
181
+ plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)]
182
+ },
183
+ {
184
+ file: `build/mixpanel-jslib-snippet.min.test.js`,
185
+ plugins: [closureCompiler({...COMMON_CLOSURE_FLAGS, define: `MIXPANEL_LIB_URL="../build/mixpanel.min.js"`})],
186
+ }
187
+ ],
188
+ },
137
189
 
138
- // IIFE mixpanel snippet loader
139
- {
140
- input: 'src/loaders/mixpanel-js-wrapper.js',
141
- output: [
142
- {
143
- file: 'build/mixpanel-js-wrapper.js',
144
- },
145
- {
146
- file: 'build/mixpanel-js-wrapper.min.js',
147
- plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)],
148
- }
149
- ],
150
- },
190
+ // IIFE mixpanel snippet loader
191
+ {
192
+ input: `src/loaders/mixpanel-js-wrapper.js`,
193
+ output: [
194
+ {
195
+ file: `build/mixpanel-js-wrapper.js`,
196
+ },
197
+ {
198
+ file: `build/mixpanel-js-wrapper.min.js`,
199
+ plugins: [closureCompiler(COMMON_CLOSURE_FLAGS)],
200
+ }
201
+ ],
202
+ },
151
203
 
152
- // IIFE mixpanel core with bundled recorder
153
- {
154
- input: 'src/loaders/loader-globals-with-recorder.js',
155
- output: [
156
- {
157
- file: 'build/mixpanel-with-recorder.js',
158
- name: 'mixpanel',
159
- format: 'iife',
160
- },
161
- {
162
- file: 'build/mixpanel-with-recorder.min.js',
163
- name: 'mixpanel',
164
- format: 'iife',
165
- plugins: [esbuild({target: 'es5', minify: true, sourceMap: true})],
166
- },
167
- ],
168
- plugins: [
169
- aliasRrweb(),
170
- nodeResolve({
171
- browser: true,
172
- main: true,
173
- jsnext: true,
174
- }),
175
- copyTypes(),
176
- ],
177
- },
204
+ // IIFE mixpanel core with bundled recorder
205
+ {
206
+ input: `src/loaders/loader-globals-with-recorder.js`,
207
+ output: [
208
+ {
209
+ file: `build/mixpanel-with-recorder.js`,
210
+ name: `mixpanel`,
211
+ format: `iife`,
212
+ },
213
+ {
214
+ file: `build/mixpanel-with-recorder.min.js`,
215
+ name: `mixpanel`,
216
+ format: `iife`,
217
+ plugins: [esbuild({target: `es5`, minify: true, sourceMap: true})],
218
+ },
219
+ ],
220
+ plugins: [
221
+ aliasRrweb(),
222
+ nodeResolve({
223
+ browser: true,
224
+ main: true,
225
+ jsnext: true,
226
+ }),
227
+ copyTypes(),
228
+ ],
229
+ },
178
230
 
179
231
 
180
- // Modules builds that are bundled with the recorder
181
- {
182
- input: 'src/loaders/loader-module.js',
183
- output: [
184
- {
185
- file: 'build/mixpanel.cjs.js',
186
- name: 'mixpanel',
187
- format: 'cjs',
188
- },
189
- {
190
- file: 'build/mixpanel.amd.js',
191
- name: 'mixpanel',
192
- format: 'amd',
193
- },
194
- {
195
- file: 'build/mixpanel.umd.js',
196
- name: 'mixpanel',
197
- format: 'umd',
198
- },
199
- {
200
- file: 'build/mixpanel.module.js',
201
- name: 'mixpanel',
202
- format: 'es',
203
- },
204
- ],
205
- plugins: [
206
- aliasRrweb(),
207
- nodeResolve({
208
- browser: true,
209
- main: true,
210
- jsnext: true,
211
- }),
212
- copyTypes(),
213
- ],
214
- },
232
+ // Modules builds that are bundled with the recorder and targeting
233
+ {
234
+ input: `src/loaders/loader-module.js`,
235
+ output: [
236
+ {
237
+ file: `build/mixpanel.cjs.js`,
238
+ name: `mixpanel`,
239
+ format: `cjs`,
240
+ },
241
+ {
242
+ file: `build/mixpanel.amd.js`,
243
+ name: `mixpanel`,
244
+ format: `amd`,
245
+ },
246
+ {
247
+ file: `build/mixpanel.umd.js`,
248
+ name: `mixpanel`,
249
+ format: `umd`,
250
+ },
251
+ {
252
+ file: `build/mixpanel.module.js`,
253
+ name: `mixpanel`,
254
+ format: `es`,
255
+ },
256
+ ],
257
+ plugins: [
258
+ commonjs(),
259
+ aliasRrweb(),
260
+ nodeResolve({
261
+ browser: true,
262
+ main: true,
263
+ jsnext: true,
264
+ }),
265
+ copyTypes(),
266
+ ],
267
+ },
215
268
 
216
269
 
217
- // Alternative CJS builds without recorder
218
- {
219
- input: 'src/loaders/loader-module-core.js',
220
- output: [
221
- {
222
- file: 'build/mixpanel-core.cjs.js',
223
- name: 'mixpanel',
224
- format: 'cjs',
225
- },
226
- ],
227
- plugins: [
228
- aliasRrweb(),
229
- nodeResolve({
230
- browser: true,
231
- main: true,
232
- jsnext: true,
233
- }),
234
- copyTypes(),
235
- ],
236
- },
237
- {
238
- input: 'src/loaders/loader-module-with-async-recorder.js',
239
- output: [
240
- {
241
- file: 'build/mixpanel-with-async-recorder.cjs.js',
242
- name: 'mixpanel',
243
- format: 'cjs',
244
- },
245
- ],
246
- plugins: [
247
- aliasRrweb(),
248
- nodeResolve({
249
- browser: true,
250
- main: true,
251
- jsnext: true,
252
- }),
253
- copyTypes(),
254
- ],
255
- }
270
+ // Alternative CJS builds without recorder
271
+ {
272
+ input: `src/loaders/loader-module-core.js`,
273
+ output: [
274
+ {
275
+ file: `build/mixpanel-core.cjs.js`,
276
+ name: `mixpanel`,
277
+ format: `cjs`,
278
+ },
279
+ ],
280
+ plugins: [
281
+ aliasRrweb(),
282
+ nodeResolve({
283
+ browser: true,
284
+ main: true,
285
+ jsnext: true,
286
+ }),
287
+ copyTypes(),
288
+ ],
289
+ },
290
+ {
291
+ input: `src/loaders/loader-module-with-async-modules.js`,
292
+ output: [
293
+ {
294
+ file: `build/mixpanel-with-async-modules.cjs.js`,
295
+ name: `mixpanel`,
296
+ format: `cjs`,
297
+ },
298
+ // Backward compatibility: keep old output filename for existing users
299
+ {
300
+ file: `build/mixpanel-with-async-recorder.cjs.js`,
301
+ name: `mixpanel`,
302
+ format: `cjs`,
303
+ },
304
+ ],
305
+ plugins: [
306
+ aliasRrweb(),
307
+ nodeResolve({
308
+ browser: true,
309
+ main: true,
310
+ jsnext: true,
311
+ }),
312
+ copyTypes(),
313
+ ],
314
+ },
315
+
316
+ ...browserTestBuilds,
256
317
  ];
257
318
 
258
- export default process.env.FULL ? ALL_BUILDS : MAIN_BUILDS;
319
+ const builds = process.env.FULL ? ALL_BUILDS : MAIN_BUILDS;
320
+ export default withCleanOnRebuild(builds);