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.
- package/.git-blame-ignore-revs +3 -1
- package/AGENTS.md +21 -0
- package/CONTRIBUTING.md +68 -73
- package/babel.config.json +7 -0
- package/bower.json +1 -1
- package/dist/plugins/jquery.min.js +1 -1
- package/dist/rollbar.cjs +2216 -2022
- package/dist/rollbar.js +6098 -5886
- package/dist/rollbar.js.map +1 -1
- package/dist/rollbar.min.cjs +1 -1
- package/dist/rollbar.min.cjs.LICENSE.txt +1 -1
- package/dist/rollbar.min.js +1 -1
- package/dist/rollbar.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.min.js.map +1 -1
- package/dist/rollbar.named-amd.js +6097 -5886
- package/dist/rollbar.named-amd.js.map +1 -1
- package/dist/rollbar.named-amd.min.js +1 -1
- package/dist/rollbar.named-amd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.named-amd.min.js.map +1 -1
- package/dist/rollbar.noconflict.umd.js +6097 -5886
- package/dist/rollbar.noconflict.umd.js.map +1 -1
- package/dist/rollbar.noconflict.umd.min.js +1 -1
- package/dist/rollbar.noconflict.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.replay.js +8123 -7924
- package/dist/rollbar.replay.js.map +1 -1
- package/dist/rollbar.replay.min.js +1 -1
- package/dist/rollbar.replay.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.min.js.map +1 -1
- package/dist/rollbar.replay.noconflict.umd.js +8122 -7924
- package/dist/rollbar.replay.noconflict.umd.js.map +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.noconflict.umd.min.js.map +1 -1
- package/dist/rollbar.replay.umd.js +8122 -7924
- package/dist/rollbar.replay.umd.js.map +1 -1
- package/dist/rollbar.replay.umd.min.js +1 -1
- package/dist/rollbar.replay.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.replay.umd.min.js.map +1 -1
- package/dist/rollbar.snippet.js +1 -1
- package/dist/rollbar.umd.js +6097 -5886
- package/dist/rollbar.umd.js.map +1 -1
- package/dist/rollbar.umd.min.js +1 -1
- package/dist/rollbar.umd.min.js.LICENSE.txt +1 -1
- package/dist/rollbar.umd.min.js.map +1 -1
- package/eslint.config.js +151 -0
- package/index.d.ts +45 -13
- package/package.json +26 -6
- package/src/api.js +130 -136
- package/src/apiUtility.js +2 -2
- package/src/browser/bundles/rollbar.snippet.js +1 -0
- package/src/browser/core.js +31 -42
- package/src/browser/domUtility.js +11 -17
- package/src/browser/globalSetup.js +3 -3
- package/src/browser/replay/checkoutWatchdog.js +104 -0
- package/src/browser/replay/recorder.d.ts +5 -2
- package/src/browser/replay/recorder.js +22 -4
- package/src/browser/replay/replay.js +8 -4
- package/src/browser/replay/replayPredicates.js +1 -1
- package/src/browser/rollbar.js +5 -4
- package/src/browser/rollbarReplay.js +6 -5
- package/src/browser/rollbarWrapper.js +2 -2
- package/src/browser/shim.js +15 -15
- package/src/browser/telemetry.js +26 -22
- package/src/browser/transforms.js +4 -4
- package/src/browser/transport/xhr.js +4 -4
- package/src/browser/transport.js +9 -10
- package/src/browser/wrapGlobals.js +3 -4
- package/src/defaults.js +1 -1
- package/src/errorParser.js +1 -1
- package/src/logger.js +1 -0
- package/src/notifier.js +102 -100
- package/src/predicates.js +3 -4
- package/src/rateLimiter.js +107 -104
- package/src/react-native/rollbar.js +9 -10
- package/src/react-native/transforms.js +4 -5
- package/src/react-native/transport.js +7 -7
- package/src/rollbar.js +7 -4
- package/src/scrub.js +16 -20
- package/src/server/locals.js +7 -7
- package/src/server/parser.js +9 -6
- package/src/server/rollbar.js +54 -49
- package/src/server/sourceMap/stackTrace.js +7 -6
- package/src/server/telemetry/urlHelpers.js +2 -1
- package/src/server/telemetry.js +10 -10
- package/src/server/transforms.js +10 -6
- package/src/server/transport.js +8 -7
- package/src/telemetry.js +22 -25
- package/src/tracing/tracer.js +2 -2
- package/src/tracing/tracing.js +2 -2
- package/src/truncation.js +6 -6
- package/src/utility/headers.js +4 -2
- package/src/utility/traverse.js +1 -1
- package/src/utility.js +111 -33
- package/tsconfig.json +16 -0
- package/tsconfig.test.json +10 -0
- package/{web-test-runner.config.mjs → web-test-runner.config.js} +10 -0
- package/{webpack.config.cjs → webpack.config.js} +39 -27
- package/.eslintrc +0 -27
- package/eslint.config.mjs +0 -33
- 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
|
-
|
|
76
|
-
|
|
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
|
-
/^(?:([
|
|
229
|
+
/^(?:([^:/?#]+):)?(?:\/\/((?:(([^:@]*)(?::([^:@]*))?)?@)?([^:/?#]*)(?::(\d*))?))?((((?:[^?#/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
|
|
230
230
|
loose:
|
|
231
|
-
/^(?:(?![^:@]+:[
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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 (
|
|
564
|
-
if (
|
|
565
|
-
custom = merge(custom, nonCircularClone(
|
|
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 (
|
|
591
|
-
if (
|
|
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 (
|
|
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 (
|
|
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
|
|
746
|
+
return Date.now();
|
|
727
747
|
}
|
|
728
|
-
return
|
|
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 (
|
|
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
|
+
}
|
|
@@ -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
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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']
|
|
19
|
+
const needToTranspile = ['@rrweb', 'error-stack-parser-es'];
|
|
10
20
|
const excludePattern = new RegExp(
|
|
11
|
-
|
|
21
|
+
`node_modules/(?!(${needToTranspile.join('|')})/)`,
|
|
12
22
|
);
|
|
13
23
|
|
|
14
|
-
const
|
|
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?
|
|
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
|
|
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?
|
|
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?
|
|
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?
|
|
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?
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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', [],
|
|
296
|
+
generateBuildConfig('[name].min.js', [], terserPlugin);
|
|
285
297
|
|
|
286
298
|
generateReplayBuildConfig('[name].js', []);
|
|
287
|
-
generateReplayBuildConfig('[name].min.js', [],
|
|
299
|
+
generateReplayBuildConfig('[name].min.js', [], terserPlugin);
|
|
288
300
|
|
|
289
|
-
|
|
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;
|