@cloudcare/browser-core 1.2.4 → 1.2.6

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/cjs/dataMap.js CHANGED
@@ -36,6 +36,8 @@ var commonTags = {
36
36
  view_url: 'view.url',
37
37
  view_host: 'view.host',
38
38
  view_path: 'view.path',
39
+ view_name: 'view.path',
40
+ // 冗余一个字段
39
41
  view_path_group: 'view.path_group',
40
42
  view_url_query: 'view.url_query'
41
43
  }; // 需要用双引号将字符串类型的field value括起来, 这里有数组标示[string, path]
@@ -96,7 +98,14 @@ var dataMap = {
96
98
  resource_ssl: 'resource.ssl',
97
99
  resource_ttfb: 'resource.ttfb',
98
100
  resource_trans: 'resource.trans',
99
- resource_first_byte: 'resource.firstbyte'
101
+ resource_redirect: 'resource.redirect',
102
+ resource_first_byte: 'resource.firstbyte',
103
+ resource_dns_time: 'resource.dns_time',
104
+ resource_download_time: 'resource.download_time',
105
+ resource_first_byte_time: 'resource.first_byte_time',
106
+ resource_connect_time: 'resource.connect_time',
107
+ resource_ssl_time: 'resource.ssl_time',
108
+ resource_redirect_time: 'resource.redirect_time'
100
109
  }
101
110
  },
102
111
  error: {
package/esm/dataMap.js CHANGED
@@ -28,6 +28,8 @@ export var commonTags = {
28
28
  view_url: 'view.url',
29
29
  view_host: 'view.host',
30
30
  view_path: 'view.path',
31
+ view_name: 'view.path',
32
+ // 冗余一个字段
31
33
  view_path_group: 'view.path_group',
32
34
  view_url_query: 'view.url_query'
33
35
  }; // 需要用双引号将字符串类型的field value括起来, 这里有数组标示[string, path]
@@ -87,7 +89,14 @@ export var dataMap = {
87
89
  resource_ssl: 'resource.ssl',
88
90
  resource_ttfb: 'resource.ttfb',
89
91
  resource_trans: 'resource.trans',
90
- resource_first_byte: 'resource.firstbyte'
92
+ resource_redirect: 'resource.redirect',
93
+ resource_first_byte: 'resource.firstbyte',
94
+ resource_dns_time: 'resource.dns_time',
95
+ resource_download_time: 'resource.download_time',
96
+ resource_first_byte_time: 'resource.first_byte_time',
97
+ resource_connect_time: 'resource.connect_time',
98
+ resource_ssl_time: 'resource.ssl_time',
99
+ resource_redirect_time: 'resource.redirect_time'
91
100
  }
92
101
  },
93
102
  error: {
@@ -1201,7 +1201,7 @@ function createCircularReferenceChecker() {
1201
1201
  if (typeof WeakSet !== 'undefined') {
1202
1202
  var set = new WeakSet();
1203
1203
  return {
1204
- hasAlreadyBeenSeen(value) {
1204
+ hasAlreadyBeenSeen: function hasAlreadyBeenSeen(value) {
1205
1205
  var has = set.has(value);
1206
1206
 
1207
1207
  if (!has) {
@@ -1210,13 +1210,12 @@ function createCircularReferenceChecker() {
1210
1210
 
1211
1211
  return has;
1212
1212
  }
1213
-
1214
1213
  };
1215
1214
  }
1216
1215
 
1217
1216
  var array = [];
1218
1217
  return {
1219
- hasAlreadyBeenSeen(value) {
1218
+ hasAlreadyBeenSeen: function hasAlreadyBeenSeen(value) {
1220
1219
  var has = array.indexOf(value) >= 0;
1221
1220
 
1222
1221
  if (!has) {
@@ -1225,7 +1224,6 @@ function createCircularReferenceChecker() {
1225
1224
 
1226
1225
  return has;
1227
1226
  }
1228
-
1229
1227
  };
1230
1228
  }
1231
1229
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudcare/browser-core",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "main": "cjs/index.js",
5
5
  "module": "esm/index.js",
6
6
  "scripts": {
@@ -20,5 +20,5 @@
20
20
  "author": "dataflux",
21
21
  "license": "MIT",
22
22
  "description": "DataFlux RUM Web 端数据指标监控",
23
- "gitHead": "cbce52b999d27d4fe7b9ac34931f4d1445aecb4f"
23
+ "gitHead": "b386724801c6dd65cd462a65b1dcbf89676ae9a4"
24
24
  }
package/src/.DS_Store CHANGED
Binary file
package/src/dataMap.js CHANGED
@@ -28,6 +28,7 @@ export var commonTags = {
28
28
  view_url: 'view.url',
29
29
  view_host: 'view.host',
30
30
  view_path: 'view.path',
31
+ view_name: 'view.path', // 冗余一个字段
31
32
  view_path_group: 'view.path_group',
32
33
  view_url_query: 'view.url_query'
33
34
  }
@@ -87,7 +88,14 @@ export var dataMap = {
87
88
  resource_ssl: 'resource.ssl',
88
89
  resource_ttfb: 'resource.ttfb',
89
90
  resource_trans: 'resource.trans',
90
- resource_first_byte: 'resource.firstbyte'
91
+ resource_redirect: 'resource.redirect',
92
+ resource_first_byte: 'resource.firstbyte',
93
+ resource_dns_time: 'resource.dns_time',
94
+ resource_download_time: 'resource.download_time',
95
+ resource_first_byte_time: 'resource.first_byte_time',
96
+ resource_connect_time: 'resource.connect_time',
97
+ resource_ssl_time: 'resource.ssl_time',
98
+ resource_redirect_time: 'resource.redirect_time'
91
99
  }
92
100
  },
93
101
  error: {
@@ -40,7 +40,7 @@ export function assign(target) {
40
40
  return target
41
41
  }
42
42
 
43
- export function shallowClone(object){
43
+ export function shallowClone(object) {
44
44
  return assign({}, object)
45
45
  }
46
46
  export var extend = function (obj) {
@@ -178,62 +178,72 @@ export var map = function (arr, fn, self) {
178
178
  }
179
179
  return ret
180
180
  }
181
- export var some = function(arr, fn, self) {
181
+ export var some = function (arr, fn, self) {
182
182
  if (arr.some) {
183
183
  return arr.some(fn)
184
184
  }
185
185
  var flag = false
186
- for(var i = 0; i < arr.length; i++) {
186
+ for (var i = 0; i < arr.length; i++) {
187
187
  if (!hasOwnProperty.call(arr, i)) {
188
188
  continue
189
189
  }
190
190
  var val = arr[i]
191
191
  if (fn.call(self, val, i, arr)) {
192
192
  flag = true
193
- break;
193
+ break
194
194
  }
195
195
  }
196
196
  return flag
197
197
  }
198
- export var every = function(arr, fn, self) {
198
+ export var every = function (arr, fn, self) {
199
199
  if (arr.every) {
200
200
  return arr.every(fn)
201
201
  }
202
202
  var flag = true
203
- for(var i = 0; i < arr.length; i++) {
203
+ for (var i = 0; i < arr.length; i++) {
204
204
  if (!hasOwnProperty.call(arr, i)) {
205
205
  continue
206
206
  }
207
207
  var val = arr[i]
208
208
  if (!fn.call(self, val, i, arr)) {
209
209
  flag = false
210
- break;
210
+ break
211
211
  }
212
212
  }
213
213
  return flag
214
214
  }
215
- export var matchList = function(list, value) {
216
- return some(list, function(item) {return item === value || (item instanceof RegExp && item.test(value))})
215
+ export var matchList = function (list, value) {
216
+ return some(list, function (item) {
217
+ return item === value || (item instanceof RegExp && item.test(value))
218
+ })
217
219
  }
218
220
  // https://github.com/jquery/jquery/blob/a684e6ba836f7c553968d7d026ed7941e1a612d8/src/selector/escapeSelector.js
219
- export var cssEscape = function(str) {
221
+ export var cssEscape = function (str) {
220
222
  if (window.CSS && window.CSS.escape) {
221
223
  return window.CSS.escape(str)
222
224
  }
223
225
 
224
226
  // eslint-disable-next-line no-control-regex
225
- return str.replace(/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g, function (ch, asCodePoint) {
226
- if (asCodePoint) {
227
- // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
228
- if (ch === '\0') {
229
- return '\uFFFD'
227
+ return str.replace(
228
+ /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,
229
+ function (ch, asCodePoint) {
230
+ if (asCodePoint) {
231
+ // U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
232
+ if (ch === '\0') {
233
+ return '\uFFFD'
234
+ }
235
+ // Control characters and (dependent upon position) numbers get escaped as code points
236
+ return (
237
+ ch.slice(0, -1) +
238
+ '\\' +
239
+ ch.charCodeAt(ch.length - 1).toString(16) +
240
+ ' '
241
+ )
230
242
  }
231
- // Control characters and (dependent upon position) numbers get escaped as code points
232
- return ch.slice(0, -1) + '\\' + ch.charCodeAt(ch.length - 1).toString(16) + ' '
243
+ // Other potentially-special ASCII characters get backslash-escaped
244
+ return '\\' + ch
233
245
  }
234
- // Other potentially-special ASCII characters get backslash-escaped
235
- return '\\' + ch
236
- })
246
+ )
237
247
  }
238
248
  export var inherit = function (subclass, superclass) {
239
249
  var F = function () {}
@@ -611,7 +621,6 @@ export function replaceNumberCharByPath(path) {
611
621
  pathGroup = path.replace(/\/([^\/]*)\d([^\/]*)/g, '/?').replace(/\/$/g, '')
612
622
  }
613
623
  return pathGroup || '/'
614
-
615
624
  }
616
625
  export var getQueryParam = function (url, param) {
617
626
  param = param.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]')
@@ -643,7 +652,8 @@ export var urlParse = function (para) {
643
652
  }
644
653
  this._values = {}
645
654
  this._regex = null
646
- this._regex = /^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/
655
+ this._regex =
656
+ /^((\w+):\/\/)?((\w+):?(\w+)?@)?([^\/\?:]+):?(\d+)?(\/?[^\?#]+)?\??([^#]+)?#?(\w*)/
647
657
 
648
658
  if (typeof a != 'undefined') {
649
659
  this._parse(a)
@@ -702,9 +712,12 @@ export var urlParse = function (para) {
702
712
  }
703
713
  }
704
714
  this._values['Path'] = this._values['Path'] || '/'
705
- this._values['Hostname'] = this._values['Host'].replace(/:\d+$/, '')
706
- this._values['Origin'] =
707
- this._values['Protocol'] + '://' + this._values['Hostname'] + (this._values.Port ? ':' + this._values.Port : '')
715
+ this._values['Hostname'] = this._values['Host'].replace(/:\d+$/, '')
716
+ this._values['Origin'] =
717
+ this._values['Protocol'] +
718
+ '://' +
719
+ this._values['Hostname'] +
720
+ (this._values.Port ? ':' + this._values.Port : '')
708
721
  // this._values['Hostname'] = this._values['Host'].replace(/:\d+$/, '')
709
722
  // this._values['Origin'] =
710
723
  // this._values['Protocol'] + '://' + this._values['Hostname']
@@ -1150,30 +1163,30 @@ function createCircularReferenceChecker() {
1150
1163
  if (typeof WeakSet !== 'undefined') {
1151
1164
  var set = new WeakSet()
1152
1165
  return {
1153
- hasAlreadyBeenSeen(value) {
1166
+ hasAlreadyBeenSeen: function (value) {
1154
1167
  var has = set.has(value)
1155
1168
  if (!has) {
1156
1169
  set.add(value)
1157
1170
  }
1158
1171
  return has
1159
- },
1172
+ }
1160
1173
  }
1161
1174
  }
1162
1175
  var array = []
1163
1176
  return {
1164
- hasAlreadyBeenSeen(value) {
1177
+ hasAlreadyBeenSeen: function (value) {
1165
1178
  var has = array.indexOf(value) >= 0
1166
1179
  if (!has) {
1167
1180
  array.push(value)
1168
1181
  }
1169
1182
  return has
1170
- },
1183
+ }
1171
1184
  }
1172
1185
  }
1173
1186
  /**
1174
1187
  * Similar to `typeof`, but distinguish plain objects from `null` and arrays
1175
1188
  */
1176
- export function getType(value) {
1189
+ export function getType(value) {
1177
1190
  if (value === null) {
1178
1191
  return 'null'
1179
1192
  }
@@ -1186,11 +1199,7 @@ function createCircularReferenceChecker() {
1186
1199
  * Iterate over source and affect its sub values into destination, recursively.
1187
1200
  * If the source and destination can't be merged, return source.
1188
1201
  */
1189
- export function mergeInto(
1190
- destination,
1191
- source,
1192
- circularReferenceChecker
1193
- ) {
1202
+ export function mergeInto(destination, source, circularReferenceChecker) {
1194
1203
  // ignore the source if it is undefined
1195
1204
  if (typeof circularReferenceChecker === 'undefined') {
1196
1205
  circularReferenceChecker = createCircularReferenceChecker()
@@ -1213,7 +1222,7 @@ function createCircularReferenceChecker() {
1213
1222
  source.ignoreCase ? 'i' : '',
1214
1223
  source.multiline ? 'm' : '',
1215
1224
  source.sticky ? 'y' : '',
1216
- source.unicode ? 'u' : '',
1225
+ source.unicode ? 'u' : ''
1217
1226
  ].join('')
1218
1227
  return new RegExp(source.source, flags)
1219
1228
  }
@@ -1222,7 +1231,7 @@ function createCircularReferenceChecker() {
1222
1231
  // remove circular references
1223
1232
  return undefined
1224
1233
  } else if (Array.isArray(source)) {
1225
- var merged= Array.isArray(destination) ? destination : []
1234
+ var merged = Array.isArray(destination) ? destination : []
1226
1235
  for (var i = 0; i < source.length; ++i) {
1227
1236
  merged[i] = mergeInto(merged[i], source[i], circularReferenceChecker)
1228
1237
  }
@@ -1232,7 +1241,11 @@ function createCircularReferenceChecker() {
1232
1241
  var merged = getType(destination) === 'object' ? destination : {}
1233
1242
  for (var key in source) {
1234
1243
  if (Object.prototype.hasOwnProperty.call(source, key)) {
1235
- merged[key] = mergeInto(merged[key], source[key], circularReferenceChecker)
1244
+ merged[key] = mergeInto(
1245
+ merged[key],
1246
+ source[key],
1247
+ circularReferenceChecker
1248
+ )
1236
1249
  }
1237
1250
  }
1238
1251
  return merged
@@ -1244,7 +1257,7 @@ function createCircularReferenceChecker() {
1244
1257
  * - It doesn't maintain prototype chains - don't use with instances of custom classes.
1245
1258
  * - It doesn't handle Map and Set
1246
1259
  */
1247
- export function deepClone(value){
1260
+ export function deepClone(value) {
1248
1261
  return mergeInto(undefined, value)
1249
1262
  }
1250
1263
  export var _URL = function (url) {
@@ -1740,23 +1753,23 @@ export function createContextManager() {
1740
1753
  console.error('content 需要传递对象类型数据')
1741
1754
  }
1742
1755
  },
1743
- getContext: function() {
1756
+ getContext: function () {
1744
1757
  return deepClone(context)
1745
1758
  },
1746
1759
 
1747
- setContext: function(newContext) {
1760
+ setContext: function (newContext) {
1748
1761
  context = deepClone(newContext)
1749
1762
  },
1750
1763
 
1751
- setContextProperty: function(key, property){
1764
+ setContextProperty: function (key, property) {
1752
1765
  context[key] = deepClone(property)
1753
1766
  },
1754
1767
 
1755
- removeContextProperty: function(key){
1768
+ removeContextProperty: function (key) {
1756
1769
  delete context[key]
1757
1770
  },
1758
1771
 
1759
- clearContext: function(){
1772
+ clearContext: function () {
1760
1773
  context = {}
1761
1774
  }
1762
1775
  }
@@ -1776,7 +1789,9 @@ export function arrayFrom(arrayLike) {
1776
1789
  }
1777
1790
  var array = []
1778
1791
  if (arrayLike instanceof Set) {
1779
- arrayLike.forEach(function(item) { array.push(item) })
1792
+ arrayLike.forEach(function (item) {
1793
+ array.push(item)
1794
+ })
1780
1795
  } else {
1781
1796
  for (var i = 0; i < arrayLike.length; i++) {
1782
1797
  array.push(arrayLike[i])
@@ -1784,10 +1799,7 @@ export function arrayFrom(arrayLike) {
1784
1799
  }
1785
1800
  return array
1786
1801
  }
1787
- export function findLast(
1788
- array,
1789
- predicate
1790
- ) {
1802
+ export function findLast(array, predicate) {
1791
1803
  for (var i = array.length - 1; i >= 0; i -= 1) {
1792
1804
  var item = array[i]
1793
1805
  if (predicate(item, i, array)) {
@@ -1854,10 +1866,10 @@ export function toSnakeCase(word) {
1854
1866
 
1855
1867
  export function escapeRowData(str) {
1856
1868
  if (typeof str === 'object' && str) {
1857
- str = jsonStringify(str)
1869
+ str = jsonStringify(str)
1858
1870
  } else if (!isString(str)) {
1859
1871
  return str
1860
- }
1872
+ }
1861
1873
  var reg = /[\s=,"]/g
1862
1874
  return String(str).replace(reg, function (word) {
1863
1875
  return '\\' + word
@@ -1872,9 +1884,7 @@ export function escapeJsonValue(value) {
1872
1884
  }
1873
1885
  }
1874
1886
  export function escapeFieldValueStr(str) {
1875
- return '"' +
1876
- str.replace(/[\\]*"/g, '"').replace(/"/g, '\\"') +
1877
- '"'
1887
+ return '"' + str.replace(/[\\]*"/g, '"').replace(/"/g, '\\"') + '"'
1878
1888
  }
1879
1889
  export function escapeRowField(value) {
1880
1890
  if (typeof value === 'object' && value) {
@@ -1885,10 +1895,10 @@ export function escapeRowField(value) {
1885
1895
  return value
1886
1896
  }
1887
1897
  }
1888
- export function isNullUndefinedDefaultValue(data,defaultValue) {
1898
+ export function isNullUndefinedDefaultValue(data, defaultValue) {
1889
1899
  if (data !== null && data !== void 0) {
1890
1900
  return data
1891
1901
  } else {
1892
1902
  return defaultValue
1893
1903
  }
1894
- }
1904
+ }