rollbar 3.0.0-beta.5 → 3.0.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 (101) hide show
  1. package/.git-blame-ignore-revs +3 -1
  2. package/AGENTS.md +21 -0
  3. package/CONTRIBUTING.md +68 -73
  4. package/babel.config.json +7 -0
  5. package/bower.json +1 -1
  6. package/dist/plugins/jquery.min.js +1 -1
  7. package/dist/rollbar.cjs +2216 -2022
  8. package/dist/rollbar.js +6098 -5886
  9. package/dist/rollbar.js.map +1 -1
  10. package/dist/rollbar.min.cjs +1 -1
  11. package/dist/rollbar.min.cjs.LICENSE.txt +1 -1
  12. package/dist/rollbar.min.js +1 -1
  13. package/dist/rollbar.min.js.LICENSE.txt +1 -1
  14. package/dist/rollbar.min.js.map +1 -1
  15. package/dist/rollbar.named-amd.js +6097 -5886
  16. package/dist/rollbar.named-amd.js.map +1 -1
  17. package/dist/rollbar.named-amd.min.js +1 -1
  18. package/dist/rollbar.named-amd.min.js.LICENSE.txt +1 -1
  19. package/dist/rollbar.named-amd.min.js.map +1 -1
  20. package/dist/rollbar.noconflict.umd.js +6097 -5886
  21. package/dist/rollbar.noconflict.umd.js.map +1 -1
  22. package/dist/rollbar.noconflict.umd.min.js +1 -1
  23. package/dist/rollbar.noconflict.umd.min.js.LICENSE.txt +1 -1
  24. package/dist/rollbar.noconflict.umd.min.js.map +1 -1
  25. package/dist/rollbar.replay.js +8123 -7924
  26. package/dist/rollbar.replay.js.map +1 -1
  27. package/dist/rollbar.replay.min.js +1 -1
  28. package/dist/rollbar.replay.min.js.LICENSE.txt +1 -1
  29. package/dist/rollbar.replay.min.js.map +1 -1
  30. package/dist/rollbar.replay.noconflict.umd.js +8122 -7924
  31. package/dist/rollbar.replay.noconflict.umd.js.map +1 -1
  32. package/dist/rollbar.replay.noconflict.umd.min.js +1 -1
  33. package/dist/rollbar.replay.noconflict.umd.min.js.LICENSE.txt +1 -1
  34. package/dist/rollbar.replay.noconflict.umd.min.js.map +1 -1
  35. package/dist/rollbar.replay.umd.js +8122 -7924
  36. package/dist/rollbar.replay.umd.js.map +1 -1
  37. package/dist/rollbar.replay.umd.min.js +1 -1
  38. package/dist/rollbar.replay.umd.min.js.LICENSE.txt +1 -1
  39. package/dist/rollbar.replay.umd.min.js.map +1 -1
  40. package/dist/rollbar.snippet.js +1 -1
  41. package/dist/rollbar.umd.js +6097 -5886
  42. package/dist/rollbar.umd.js.map +1 -1
  43. package/dist/rollbar.umd.min.js +1 -1
  44. package/dist/rollbar.umd.min.js.LICENSE.txt +1 -1
  45. package/dist/rollbar.umd.min.js.map +1 -1
  46. package/eslint.config.js +151 -0
  47. package/index.d.ts +45 -13
  48. package/package.json +26 -6
  49. package/src/api.js +130 -136
  50. package/src/apiUtility.js +2 -2
  51. package/src/browser/bundles/rollbar.snippet.js +1 -0
  52. package/src/browser/core.js +31 -42
  53. package/src/browser/domUtility.js +11 -17
  54. package/src/browser/globalSetup.js +3 -3
  55. package/src/browser/replay/checkoutWatchdog.js +104 -0
  56. package/src/browser/replay/recorder.d.ts +5 -2
  57. package/src/browser/replay/recorder.js +22 -4
  58. package/src/browser/replay/replay.js +8 -4
  59. package/src/browser/replay/replayPredicates.js +1 -1
  60. package/src/browser/rollbar.js +5 -4
  61. package/src/browser/rollbarReplay.js +6 -5
  62. package/src/browser/rollbarWrapper.js +2 -2
  63. package/src/browser/shim.js +15 -15
  64. package/src/browser/telemetry.js +26 -22
  65. package/src/browser/transforms.js +4 -4
  66. package/src/browser/transport/xhr.js +4 -4
  67. package/src/browser/transport.js +9 -10
  68. package/src/browser/wrapGlobals.js +3 -4
  69. package/src/defaults.js +1 -1
  70. package/src/errorParser.js +1 -1
  71. package/src/logger.js +1 -0
  72. package/src/notifier.js +102 -100
  73. package/src/predicates.js +3 -4
  74. package/src/rateLimiter.js +107 -104
  75. package/src/react-native/rollbar.js +9 -10
  76. package/src/react-native/transforms.js +4 -5
  77. package/src/react-native/transport.js +7 -7
  78. package/src/rollbar.js +7 -4
  79. package/src/scrub.js +16 -20
  80. package/src/server/locals.js +7 -7
  81. package/src/server/parser.js +9 -6
  82. package/src/server/rollbar.js +54 -49
  83. package/src/server/sourceMap/stackTrace.js +7 -6
  84. package/src/server/telemetry/urlHelpers.js +2 -1
  85. package/src/server/telemetry.js +10 -10
  86. package/src/server/transforms.js +10 -6
  87. package/src/server/transport.js +8 -7
  88. package/src/telemetry.js +22 -25
  89. package/src/tracing/tracer.js +2 -2
  90. package/src/tracing/tracing.js +2 -2
  91. package/src/truncation.js +6 -6
  92. package/src/utility/headers.js +4 -2
  93. package/src/utility/traverse.js +1 -1
  94. package/src/utility.js +111 -33
  95. package/tsconfig.json +16 -0
  96. package/tsconfig.test.json +10 -0
  97. package/{web-test-runner.config.mjs → web-test-runner.config.js} +10 -0
  98. package/{webpack.config.cjs → webpack.config.js} +39 -27
  99. package/.eslintrc +0 -27
  100. package/eslint.config.mjs +0 -33
  101. package/src/merge.js +0 -61
package/src/utility.js CHANGED
@@ -1,5 +1,3 @@
1
- import merge from './merge.js';
2
-
3
1
  /*
4
2
  * isType - Given a Javascript value and a string, returns true if the type of the value matches the
5
3
  * given string.
@@ -72,8 +70,20 @@ function isNativeFunction(f) {
72
70
  * @returns true is value is an object function is an object)
73
71
  */
74
72
  function isObject(value) {
75
- var type = typeof value;
76
- return value != null && (type == 'object' || type == 'function');
73
+ return (
74
+ value != null && (typeof value == 'object' || typeof value == 'function')
75
+ );
76
+ }
77
+
78
+ /* hasOwn - safe helper around Object.hasOwnProperty */
79
+ function hasOwn(obj, prop) {
80
+ if (obj == null) {
81
+ return false;
82
+ }
83
+ if (Object.hasOwn) {
84
+ return Object.hasOwn(obj, prop);
85
+ }
86
+ return Object.prototype.hasOwnProperty.call(obj, prop);
77
87
  }
78
88
 
79
89
  /* isString - Checks if the argument is a string
@@ -95,16 +105,6 @@ function isFiniteNumber(n) {
95
105
  return Number.isFinite(n);
96
106
  }
97
107
 
98
- /*
99
- * isDefined - a convenience function for checking if a value is not equal to undefined
100
- *
101
- * @param u - any value
102
- * @returns true if u is anything other than undefined
103
- */
104
- function isDefined(u) {
105
- return !isType(u, 'undefined');
106
- }
107
-
108
108
  /*
109
109
  * isIterable - convenience function for checking if a value can be iterated, essentially
110
110
  * whether it is an object or an array.
@@ -156,7 +156,7 @@ function uuid4() {
156
156
  var uuid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(
157
157
  /[xy]/g,
158
158
  function (c) {
159
- var r = (d + Math.random() * 16) % 16 | 0;
159
+ var r = ((d + Math.random() * 16) % 16) | 0;
160
160
  d = Math.floor(d / 16);
161
161
  return (c === 'x' ? r : (r & 0x7) | 0x8).toString(16);
162
162
  },
@@ -226,9 +226,9 @@ var parseUriOptions = {
226
226
  },
227
227
  parser: {
228
228
  strict:
229
- /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
229
+ /^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
230
230
  loose:
231
- /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,
231
+ /^(?:(?![^:@]+:[^:@/]*@)([^:/?#.]+):)?(?:\/\/)?((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#/]*\.[^?#/.]+(?:[?#]|$)))*\/?)?([^?#/]*))(?:\?([^#]*))?(?:#(.*))?)/,
232
232
  },
233
233
  };
234
234
 
@@ -364,7 +364,7 @@ function jsonParse(s) {
364
364
  } catch (e) {
365
365
  error = e;
366
366
  }
367
- return { error: error, value: value };
367
+ return { error, value };
368
368
  }
369
369
 
370
370
  function makeUnhandledStackInfo(
@@ -463,7 +463,11 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
463
463
  case 'undefined':
464
464
  break;
465
465
  case 'string':
466
- message ? extraArgs.push(arg) : (message = arg);
466
+ if (message) {
467
+ extraArgs.push(arg);
468
+ } else {
469
+ message = arg;
470
+ }
467
471
  break;
468
472
  case 'function':
469
473
  callback = wrapCallback(logger, arg);
@@ -474,7 +478,11 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
474
478
  case 'error':
475
479
  case 'domexception':
476
480
  case 'exception': // Firefox Exception type
477
- err ? extraArgs.push(arg) : (err = arg);
481
+ if (err) {
482
+ extraArgs.push(arg);
483
+ } else {
484
+ err = arg;
485
+ }
478
486
  break;
479
487
  case 'object':
480
488
  case 'array':
@@ -482,7 +490,11 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
482
490
  arg instanceof Error ||
483
491
  (typeof DOMException !== 'undefined' && arg instanceof DOMException)
484
492
  ) {
485
- err ? extraArgs.push(arg) : (err = arg);
493
+ if (err) {
494
+ extraArgs.push(arg);
495
+ } else {
496
+ err = arg;
497
+ }
486
498
  break;
487
499
  }
488
500
  if (requestKeys && typ === 'object' && !request) {
@@ -496,14 +508,22 @@ function createItem(args, logger, notifier, requestKeys, lambdaContext) {
496
508
  break;
497
509
  }
498
510
  }
499
- custom ? extraArgs.push(arg) : (custom = arg);
511
+ if (custom) {
512
+ extraArgs.push(arg);
513
+ } else {
514
+ custom = arg;
515
+ }
500
516
  break;
501
517
  default:
502
518
  if (
503
519
  arg instanceof Error ||
504
520
  (typeof DOMException !== 'undefined' && arg instanceof DOMException)
505
521
  ) {
506
- err ? extraArgs.push(arg) : (err = arg);
522
+ if (err) {
523
+ extraArgs.push(arg);
524
+ } else {
525
+ err = arg;
526
+ }
507
527
  break;
508
528
  }
509
529
  extraArgs.push(arg);
@@ -560,9 +580,9 @@ function addErrorContext(item, errors) {
560
580
  var contextAdded = false;
561
581
 
562
582
  try {
563
- for (var i = 0; i < errors.length; ++i) {
564
- if (errors[i].hasOwnProperty('rollbarContext')) {
565
- custom = merge(custom, nonCircularClone(errors[i].rollbarContext));
583
+ for (const error of errors) {
584
+ if (hasOwn(error, 'rollbarContext')) {
585
+ custom = merge(custom, nonCircularClone(error.rollbarContext));
566
586
  contextAdded = true;
567
587
  }
568
588
  }
@@ -587,8 +607,8 @@ var TELEMETRY_TYPES = [
587
607
  var TELEMETRY_LEVELS = ['critical', 'error', 'warning', 'info', 'debug'];
588
608
 
589
609
  function arrayIncludes(arr, val) {
590
- for (var k = 0; k < arr.length; ++k) {
591
- if (arr[k] === val) {
610
+ for (const entry of arr) {
611
+ if (entry === val) {
592
612
  return true;
593
613
  }
594
614
  }
@@ -656,7 +676,7 @@ function get(obj, path) {
656
676
  for (var i = 0, len = keys.length; i < len; ++i) {
657
677
  result = result[keys[i]];
658
678
  }
659
- } catch (e) {
679
+ } catch (_e) {
660
680
  result = undefined;
661
681
  }
662
682
  return result;
@@ -688,7 +708,7 @@ function set(obj, path, value) {
688
708
  }
689
709
  temp[keys[len - 1]] = value;
690
710
  obj[keys[0]] = replacement;
691
- } catch (e) {
711
+ } catch (_e) {
692
712
  return;
693
713
  }
694
714
  }
@@ -723,9 +743,9 @@ function formatArgsAsString(args) {
723
743
 
724
744
  function now() {
725
745
  if (Date.now) {
726
- return +Date.now();
746
+ return Date.now();
727
747
  }
728
- return +new Date();
748
+ return Number(new Date());
729
749
  }
730
750
 
731
751
  function filterIp(requestData, captureIp) {
@@ -757,7 +777,7 @@ function filterIp(requestData, captureIp) {
757
777
  } else {
758
778
  newIp = null;
759
779
  }
760
- } catch (e) {
780
+ } catch (_e) {
761
781
  newIp = null;
762
782
  }
763
783
  }
@@ -790,6 +810,63 @@ function updateDeprecatedOptions(options, logger) {
790
810
  return options;
791
811
  }
792
812
 
813
+ function merge() {
814
+ function isPlainObject(obj) {
815
+ if (!obj || Object.prototype.toString.call(obj) !== '[object Object]') {
816
+ return false;
817
+ }
818
+
819
+ var hasOwnConstructor = hasOwn(obj, 'constructor');
820
+ var hasIsPrototypeOf =
821
+ obj.constructor &&
822
+ obj.constructor.prototype &&
823
+ hasOwn(obj.constructor.prototype, 'isPrototypeOf');
824
+ // Not own constructor property must be Object
825
+ if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
826
+ return false;
827
+ }
828
+
829
+ // Own properties are enumerated firstly, so to speed up,
830
+ // if last one is own, then all properties are own.
831
+ var key;
832
+ for (key in obj) {
833
+ /**/
834
+ }
835
+
836
+ return typeof key === 'undefined' || hasOwn(obj, key);
837
+ }
838
+
839
+ var i,
840
+ src,
841
+ copy,
842
+ clone,
843
+ name,
844
+ result = Object.create(null), // no prototype pollution on Object
845
+ current = null,
846
+ length = arguments.length;
847
+
848
+ for (i = 0; i < length; i++) {
849
+ current = arguments[i];
850
+ if (current === null || current === undefined) {
851
+ continue;
852
+ }
853
+
854
+ for (name in current) {
855
+ src = result[name];
856
+ copy = current[name];
857
+ if (result !== copy) {
858
+ if (copy && isPlainObject(copy)) {
859
+ clone = src && isPlainObject(src) ? src : {};
860
+ result[name] = merge(clone, copy);
861
+ } else if (typeof copy !== 'undefined') {
862
+ result[name] = copy;
863
+ }
864
+ }
865
+ }
866
+ }
867
+ return result;
868
+ }
869
+
793
870
  export {
794
871
  addParamsAndAccessTokenToPath,
795
872
  createItem,
@@ -804,6 +881,7 @@ export {
804
881
  isError,
805
882
  isFiniteNumber,
806
883
  isFunction,
884
+ hasOwn,
807
885
  isIterable,
808
886
  isNativeFunction,
809
887
  isObject,
package/tsconfig.json ADDED
@@ -0,0 +1,16 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2021",
4
+ "module": "nodenext",
5
+ "moduleResolution": "nodenext",
6
+ "allowJs": true,
7
+ "checkJs": false,
8
+ "noEmit": true,
9
+ "strict": false,
10
+ "resolveJsonModule": true,
11
+ "skipLibCheck": true,
12
+ "types": []
13
+ },
14
+ "include": ["src", "scripts"],
15
+ "exclude": ["dist", "coverage", "examples", "node_modules"]
16
+ }
@@ -0,0 +1,10 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compilerOptions": {
4
+ "types": ["mocha", "node", "sinon"],
5
+ "esModuleInterop": true,
6
+ "allowSyntheticDefaultImports": true,
7
+ "allowImportingTsExtensions": true
8
+ },
9
+ "include": ["test", "src", "scripts"]
10
+ }
@@ -1,15 +1,25 @@
1
+ import { esbuildPlugin } from '@web/dev-server-esbuild';
1
2
  import { playwrightLauncher } from '@web/test-runner-playwright';
2
3
 
3
4
  export default {
4
5
  files: [
5
6
  'test/**/*.test.js',
7
+ 'test/**/*.test.ts',
6
8
  // Exclude server and React Native tests
7
9
  '!test/server.*.test.js',
10
+ '!test/server.*.test.ts',
8
11
  '!test/react-native.*.test.js',
12
+ '!test/react-native.*.test.ts',
9
13
  ],
10
14
 
11
15
  nodeResolve: true,
12
16
 
17
+ plugins: [
18
+ esbuildPlugin({
19
+ ts: true,
20
+ }),
21
+ ],
22
+
13
23
  browsers: [
14
24
  playwrightLauncher({
15
25
  product: 'chromium',
@@ -1,17 +1,27 @@
1
- const extend = require('util')._extend;
2
- const path = require('path');
3
- const nodeExternals = require('webpack-node-externals');
4
- const TerserPlugin = require('terser-webpack-plugin');
1
+ import path from 'path';
2
+ import { fileURLToPath } from 'url';
3
+
4
+ import TerserPlugin from 'terser-webpack-plugin';
5
+ import nodeExternals from 'webpack-node-externals';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+
10
+ const extend = (target, ...sources) => Object.assign(target, ...sources);
5
11
 
6
12
  const outputPath = path.resolve(__dirname, 'dist');
7
13
 
14
+ const resolveConfig = {
15
+ extensions: ['.ts', '.js', '.json', '.wasm'],
16
+ };
17
+
8
18
  // Packages that need to be transpiled to ES5
9
- const needToTranspile = ['@rrweb', 'error-stack-parser-es'].join('|');
19
+ const needToTranspile = ['@rrweb', 'error-stack-parser-es'];
10
20
  const excludePattern = new RegExp(
11
- 'node_modules/(?!(' + needToTranspile + ')/)',
21
+ `node_modules/(?!(${needToTranspile.join('|')})/)`,
12
22
  );
13
23
 
14
- const uglifyPlugin = new TerserPlugin({
24
+ const terserPlugin = new TerserPlugin({
15
25
  parallel: true,
16
26
  });
17
27
 
@@ -24,11 +34,12 @@ const snippetConfig = {
24
34
  path: outputPath,
25
35
  filename: '[name].js',
26
36
  },
37
+ resolve: resolveConfig,
27
38
  target: ['web', 'es5'],
28
39
  module: {
29
40
  rules: [
30
41
  {
31
- test: /\.m?js$/,
42
+ test: /\.m?[tj]s$/,
32
43
  loader: 'babel-loader',
33
44
  exclude: [excludePattern, /vendor/],
34
45
  },
@@ -42,14 +53,15 @@ const pluginConfig = {
42
53
  jquery: './src/browser/plugins/jquery.js',
43
54
  },
44
55
  output: {
45
- path: outputPath + '/plugins/',
56
+ path: path.join(outputPath, 'plugins'),
46
57
  filename: '[name].min.js',
47
58
  },
59
+ resolve: resolveConfig,
48
60
  target: ['web', 'es5'],
49
61
  module: {
50
62
  rules: [
51
63
  {
52
- test: /\.m?js$/,
64
+ test: /\.m?[tj]s$/,
53
65
  loader: 'babel-loader',
54
66
  exclude: [excludePattern, /vendor/],
55
67
  },
@@ -64,12 +76,13 @@ const vanillaConfigBase = {
64
76
  output: {
65
77
  path: outputPath,
66
78
  },
79
+ resolve: resolveConfig,
67
80
  target: ['web', 'es5'],
68
81
  devtool: 'hidden-source-map',
69
82
  module: {
70
83
  rules: [
71
84
  {
72
- test: /\.m?js$/,
85
+ test: /\.m?[tj]s$/,
73
86
  loader: 'babel-loader',
74
87
  exclude: [excludePattern, /vendor/],
75
88
  },
@@ -88,12 +101,13 @@ const UMDConfigBase = {
88
101
  libraryExport: 'default',
89
102
  globalObject: 'this',
90
103
  },
104
+ resolve: resolveConfig,
91
105
  target: ['web', 'es5'],
92
106
  devtool: 'source-map',
93
107
  module: {
94
108
  rules: [
95
109
  {
96
- test: /\.m?js$/,
110
+ test: /\.m?[tj]s$/,
97
111
  loader: 'babel-loader',
98
112
  exclude: [excludePattern, /vendor/],
99
113
  },
@@ -110,12 +124,13 @@ const serverCJSConfigBase = {
110
124
  libraryTarget: 'commonjs2',
111
125
  libraryExport: 'default',
112
126
  },
127
+ resolve: resolveConfig,
113
128
  target: 'node',
114
129
  externals: [nodeExternals()],
115
130
  module: {
116
131
  rules: [
117
132
  {
118
- test: /\.m?js$/,
133
+ test: /\.m?[tj]s$/,
119
134
  loader: 'babel-loader',
120
135
  exclude: [excludePattern, /vendor/],
121
136
  },
@@ -157,7 +172,7 @@ const config = [snippetConfig, pluginConfig];
157
172
 
158
173
  function optimizationConfig(minimizer) {
159
174
  return {
160
- minimize: minimizer ? true : false,
175
+ minimize: Boolean(minimizer),
161
176
  minimizer: minimizer ? [minimizer] : [],
162
177
  };
163
178
  }
@@ -170,7 +185,7 @@ function addVanillaToConfig(webpackConfig, filename, extraPlugins, minimizer) {
170
185
 
171
186
  vanillaConfig.optimization = optimizationConfig(minimizer);
172
187
 
173
- vanillaConfig.output = extend({ filename: filename }, vanillaConfig.output);
188
+ vanillaConfig.output = extend({ filename }, vanillaConfig.output);
174
189
 
175
190
  webpackConfig.push(vanillaConfig);
176
191
  }
@@ -182,7 +197,7 @@ function addUMDToConfig(webpackConfig, filename, extraPlugins, minimizer) {
182
197
 
183
198
  UMDConfig.optimization = optimizationConfig(minimizer);
184
199
 
185
- UMDConfig.output = extend({ filename: filename }, UMDConfig.output);
200
+ UMDConfig.output = extend({ filename }, UMDConfig.output);
186
201
 
187
202
  webpackConfig.push(UMDConfig);
188
203
  }
@@ -199,10 +214,7 @@ function addNoConflictToConfig(
199
214
 
200
215
  noConflictConfig.optimization = optimizationConfig(minimizer);
201
216
 
202
- noConflictConfig.output = extend(
203
- { filename: filename },
204
- noConflictConfig.output,
205
- );
217
+ noConflictConfig.output = extend({ filename }, noConflictConfig.output);
206
218
 
207
219
  webpackConfig.push(noConflictConfig);
208
220
  }
@@ -214,7 +226,7 @@ function addNamedAMDToConfig(webpackConfig, filename, extraPlugins, minimizer) {
214
226
 
215
227
  AMDConfig.optimization = optimizationConfig(minimizer);
216
228
 
217
- AMDConfig.output = extend({ filename: filename }, AMDConfig.output);
229
+ AMDConfig.output = extend({ filename }, AMDConfig.output);
218
230
 
219
231
  webpackConfig.push(AMDConfig);
220
232
  }
@@ -236,7 +248,7 @@ function addVanillaReplayToConfig(
236
248
  replayConfig.name = filename;
237
249
  replayConfig.plugins = extraPlugins;
238
250
  replayConfig.optimization = optimizationConfig(minimizer);
239
- replayConfig.output = extend({ filename: filename }, replayConfig.output);
251
+ replayConfig.output = extend({ filename }, replayConfig.output);
240
252
  webpackConfig.push(replayConfig);
241
253
  }
242
254
 
@@ -249,7 +261,7 @@ function addUMDReplayToConfig(
249
261
  const replayConfig = extend({}, UMDReplayConfigBase);
250
262
  replayConfig.plugins = extraPlugins;
251
263
  replayConfig.optimization = optimizationConfig(minimizer);
252
- replayConfig.output = extend({ filename: filename }, replayConfig.output);
264
+ replayConfig.output = extend({ filename }, replayConfig.output);
253
265
  webpackConfig.push(replayConfig);
254
266
  }
255
267
 
@@ -262,7 +274,7 @@ function addNoConflictReplayToConfig(
262
274
  const replayConfig = extend({}, noConflictReplayConfigBase);
263
275
  replayConfig.plugins = extraPlugins;
264
276
  replayConfig.optimization = optimizationConfig(minimizer);
265
- replayConfig.output = extend({ filename: filename }, replayConfig.output);
277
+ replayConfig.output = extend({ filename }, replayConfig.output);
266
278
  webpackConfig.push(replayConfig);
267
279
  }
268
280
 
@@ -281,9 +293,9 @@ function generateReplayBuildConfig(name, plugins, minimizer) {
281
293
  }
282
294
 
283
295
  generateBuildConfig('[name].js', []);
284
- generateBuildConfig('[name].min.js', [], uglifyPlugin);
296
+ generateBuildConfig('[name].min.js', [], terserPlugin);
285
297
 
286
298
  generateReplayBuildConfig('[name].js', []);
287
- generateReplayBuildConfig('[name].min.js', [], uglifyPlugin);
299
+ generateReplayBuildConfig('[name].min.js', [], terserPlugin);
288
300
 
289
- module.exports = config;
301
+ export default config;
package/.eslintrc DELETED
@@ -1,27 +0,0 @@
1
- {
2
- "parser": "babel-eslint",
3
- "extends": "eslint:recommended",
4
- "parserOptions": {
5
- "ecmafeatures": {
6
- "modules": true,
7
- },
8
- },
9
- "env": {
10
- // I write for browser
11
- "browser": true,
12
- // in CommonJS
13
- "node": true,
14
- },
15
- "globals": { "Promise": true },
16
- "rules": {
17
- "strict": 0,
18
- "camelcase": [2, { "properties": "never" }],
19
- "quotes": [2, "single", "avoid-escape"],
20
- "no-underscore-dangle": 0,
21
- "no-useless-escape": 0,
22
- "complexity": [2, { "max": 35 }],
23
- "no-use-before-define": [0, { "functions": false }],
24
- "no-unused-vars": [2, { "argsIgnorePattern": "^_" }],
25
- "no-prototype-builtins": 0
26
- }
27
- }
package/eslint.config.mjs DELETED
@@ -1,33 +0,0 @@
1
- import babelParser from '@babel/eslint-parser';
2
- import { defineConfig } from 'eslint/config';
3
-
4
- export default defineConfig([
5
- {
6
- files: ['**/*.js', '**/*.mjs'],
7
- languageOptions: {
8
- ecmaVersion: 2021,
9
- sourceType: 'module',
10
- parser: babelParser,
11
- parserOptions: {
12
- ecmaVersion: 2021,
13
- },
14
- },
15
- rules: {
16
- 'comma-dangle': 'off',
17
- strict: 0,
18
- 'no-underscore-dangle': 0,
19
- 'no-useless-escape': 0,
20
- complexity: [2, { max: 35 }],
21
- 'no-use-before-define': [0, { functions: false }],
22
- 'no-prototype-builtins': 0,
23
-
24
- // Off until issues are fixed
25
- camelcase: 'off', //[2, {'properties': 'never'}],
26
- 'no-unused-vars': 'off', //[2, { 'argsIgnorePattern': '^_' }],
27
- quotes: 'off', //[2, 'single', 'avoid-escape'],
28
- },
29
- },
30
- {
31
- ignores: ['dist', 'examples', 'node_modules', 'vendor'],
32
- },
33
- ]);
package/src/merge.js DELETED
@@ -1,61 +0,0 @@
1
- var hasOwn = Object.prototype.hasOwnProperty;
2
- var toStr = Object.prototype.toString;
3
-
4
- var isPlainObject = function isPlainObject(obj) {
5
- if (!obj || toStr.call(obj) !== '[object Object]') {
6
- return false;
7
- }
8
-
9
- var hasOwnConstructor = hasOwn.call(obj, 'constructor');
10
- var hasIsPrototypeOf =
11
- obj.constructor &&
12
- obj.constructor.prototype &&
13
- hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
14
- // Not own constructor property must be Object
15
- if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
16
- return false;
17
- }
18
-
19
- // Own properties are enumerated firstly, so to speed up,
20
- // if last one is own, then all properties are own.
21
- var key;
22
- for (key in obj) {
23
- /**/
24
- }
25
-
26
- return typeof key === 'undefined' || hasOwn.call(obj, key);
27
- };
28
-
29
- function merge() {
30
- var i,
31
- src,
32
- copy,
33
- clone,
34
- name,
35
- result = Object.create(null), // no prototype pollution on Object
36
- current = null,
37
- length = arguments.length;
38
-
39
- for (i = 0; i < length; i++) {
40
- current = arguments[i];
41
- if (current == null) {
42
- continue;
43
- }
44
-
45
- for (name in current) {
46
- src = result[name];
47
- copy = current[name];
48
- if (result !== copy) {
49
- if (copy && isPlainObject(copy)) {
50
- clone = src && isPlainObject(src) ? src : {};
51
- result[name] = merge(clone, copy);
52
- } else if (typeof copy !== 'undefined') {
53
- result[name] = copy;
54
- }
55
- }
56
- }
57
- }
58
- return result;
59
- }
60
-
61
- export default merge;