@vue/shared 3.4.27 → 3.4.28

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.4.27
2
+ * @vue/shared v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -80,9 +80,9 @@ const toHandlerKey = cacheStringFunction((str) => {
80
80
  return s;
81
81
  });
82
82
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
83
- const invokeArrayFns = (fns, arg) => {
83
+ const invokeArrayFns = (fns, ...arg) => {
84
84
  for (let i = 0; i < fns.length; i++) {
85
- fns[i](arg);
85
+ fns[i](...arg);
86
86
  }
87
87
  };
88
88
  const def = (obj, key, value, writable = false) => {
@@ -202,6 +202,9 @@ const isGloballyWhitelisted = isGloballyAllowed;
202
202
 
203
203
  const range = 2;
204
204
  function generateCodeFrame(source, start = 0, end = source.length) {
205
+ start = Math.max(0, Math.min(start, source.length));
206
+ end = Math.max(0, Math.min(end, source.length));
207
+ if (start > end) return "";
205
208
  let lines = source.split(/(\r?\n)/);
206
209
  const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
207
210
  lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -211,8 +214,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
211
214
  count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
212
215
  if (count >= start) {
213
216
  for (let j = i - range; j <= i + range || end > count; j++) {
214
- if (j < 0 || j >= lines.length)
215
- continue;
217
+ if (j < 0 || j >= lines.length) continue;
216
218
  const line = j + 1;
217
219
  res.push(
218
220
  `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -305,8 +307,7 @@ function normalizeClass(value) {
305
307
  return res.trim();
306
308
  }
307
309
  function normalizeProps(props) {
308
- if (!props)
309
- return null;
310
+ if (!props) return null;
310
311
  let { class: klass, style } = props;
311
312
  if (klass && !isString(klass)) {
312
313
  props.class = normalizeClass(klass);
@@ -411,8 +412,7 @@ function escapeHtmlComment(src) {
411
412
  }
412
413
 
413
414
  function looseCompareArrays(a, b) {
414
- if (a.length !== b.length)
415
- return false;
415
+ if (a.length !== b.length) return false;
416
416
  let equal = true;
417
417
  for (let i = 0; equal && i < a.length; i++) {
418
418
  equal = looseEqual(a[i], b[i]);
@@ -420,8 +420,7 @@ function looseCompareArrays(a, b) {
420
420
  return equal;
421
421
  }
422
422
  function looseEqual(a, b) {
423
- if (a === b)
424
- return true;
423
+ if (a === b) return true;
425
424
  let aValidType = isDate(a);
426
425
  let bValidType = isDate(b);
427
426
  if (aValidType || bValidType) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.4.27
2
+ * @vue/shared v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -80,9 +80,9 @@ const toHandlerKey = cacheStringFunction((str) => {
80
80
  return s;
81
81
  });
82
82
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
83
- const invokeArrayFns = (fns, arg) => {
83
+ const invokeArrayFns = (fns, ...arg) => {
84
84
  for (let i = 0; i < fns.length; i++) {
85
- fns[i](arg);
85
+ fns[i](...arg);
86
86
  }
87
87
  };
88
88
  const def = (obj, key, value, writable = false) => {
@@ -202,6 +202,9 @@ const isGloballyWhitelisted = isGloballyAllowed;
202
202
 
203
203
  const range = 2;
204
204
  function generateCodeFrame(source, start = 0, end = source.length) {
205
+ start = Math.max(0, Math.min(start, source.length));
206
+ end = Math.max(0, Math.min(end, source.length));
207
+ if (start > end) return "";
205
208
  let lines = source.split(/(\r?\n)/);
206
209
  const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
207
210
  lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -211,8 +214,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
211
214
  count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
212
215
  if (count >= start) {
213
216
  for (let j = i - range; j <= i + range || end > count; j++) {
214
- if (j < 0 || j >= lines.length)
215
- continue;
217
+ if (j < 0 || j >= lines.length) continue;
216
218
  const line = j + 1;
217
219
  res.push(
218
220
  `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -305,8 +307,7 @@ function normalizeClass(value) {
305
307
  return res.trim();
306
308
  }
307
309
  function normalizeProps(props) {
308
- if (!props)
309
- return null;
310
+ if (!props) return null;
310
311
  let { class: klass, style } = props;
311
312
  if (klass && !isString(klass)) {
312
313
  props.class = normalizeClass(klass);
@@ -411,8 +412,7 @@ function escapeHtmlComment(src) {
411
412
  }
412
413
 
413
414
  function looseCompareArrays(a, b) {
414
- if (a.length !== b.length)
415
- return false;
415
+ if (a.length !== b.length) return false;
416
416
  let equal = true;
417
417
  for (let i = 0; equal && i < a.length; i++) {
418
418
  equal = looseEqual(a[i], b[i]);
@@ -420,8 +420,7 @@ function looseCompareArrays(a, b) {
420
420
  return equal;
421
421
  }
422
422
  function looseEqual(a, b) {
423
- if (a === b)
424
- return true;
423
+ if (a === b) return true;
425
424
  let aValidType = isDate(a);
426
425
  let bValidType = isDate(b);
427
426
  if (aValidType || bValidType) {
package/dist/shared.d.ts CHANGED
@@ -61,7 +61,7 @@ export declare const capitalize: <T extends string>(str: T) => Capitalize<T>;
61
61
  */
62
62
  export declare const toHandlerKey: <T extends string>(str: T) => T extends "" ? "" : `on${Capitalize<T>}`;
63
63
  export declare const hasChanged: (value: any, oldValue: any) => boolean;
64
- export declare const invokeArrayFns: (fns: Function[], arg?: any) => void;
64
+ export declare const invokeArrayFns: (fns: Function[], ...arg: any[]) => void;
65
65
  export declare const def: (obj: object, key: string | symbol, value: any, writable?: boolean) => void;
66
66
  /**
67
67
  * "123-foo" will be parsed to 123
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @vue/shared v3.4.27
2
+ * @vue/shared v3.4.28
3
3
  * (c) 2018-present Yuxi (Evan) You and Vue contributors
4
4
  * @license MIT
5
5
  **/
@@ -76,9 +76,9 @@ const toHandlerKey = cacheStringFunction((str) => {
76
76
  return s;
77
77
  });
78
78
  const hasChanged = (value, oldValue) => !Object.is(value, oldValue);
79
- const invokeArrayFns = (fns, arg) => {
79
+ const invokeArrayFns = (fns, ...arg) => {
80
80
  for (let i = 0; i < fns.length; i++) {
81
- fns[i](arg);
81
+ fns[i](...arg);
82
82
  }
83
83
  };
84
84
  const def = (obj, key, value, writable = false) => {
@@ -198,6 +198,9 @@ const isGloballyWhitelisted = isGloballyAllowed;
198
198
 
199
199
  const range = 2;
200
200
  function generateCodeFrame(source, start = 0, end = source.length) {
201
+ start = Math.max(0, Math.min(start, source.length));
202
+ end = Math.max(0, Math.min(end, source.length));
203
+ if (start > end) return "";
201
204
  let lines = source.split(/(\r?\n)/);
202
205
  const newlineSequences = lines.filter((_, idx) => idx % 2 === 1);
203
206
  lines = lines.filter((_, idx) => idx % 2 === 0);
@@ -207,8 +210,7 @@ function generateCodeFrame(source, start = 0, end = source.length) {
207
210
  count += lines[i].length + (newlineSequences[i] && newlineSequences[i].length || 0);
208
211
  if (count >= start) {
209
212
  for (let j = i - range; j <= i + range || end > count; j++) {
210
- if (j < 0 || j >= lines.length)
211
- continue;
213
+ if (j < 0 || j >= lines.length) continue;
212
214
  const line = j + 1;
213
215
  res.push(
214
216
  `${line}${" ".repeat(Math.max(3 - String(line).length, 0))}| ${lines[j]}`
@@ -301,8 +303,7 @@ function normalizeClass(value) {
301
303
  return res.trim();
302
304
  }
303
305
  function normalizeProps(props) {
304
- if (!props)
305
- return null;
306
+ if (!props) return null;
306
307
  let { class: klass, style } = props;
307
308
  if (klass && !isString(klass)) {
308
309
  props.class = normalizeClass(klass);
@@ -407,8 +408,7 @@ function escapeHtmlComment(src) {
407
408
  }
408
409
 
409
410
  function looseCompareArrays(a, b) {
410
- if (a.length !== b.length)
411
- return false;
411
+ if (a.length !== b.length) return false;
412
412
  let equal = true;
413
413
  for (let i = 0; equal && i < a.length; i++) {
414
414
  equal = looseEqual(a[i], b[i]);
@@ -416,8 +416,7 @@ function looseCompareArrays(a, b) {
416
416
  return equal;
417
417
  }
418
418
  function looseEqual(a, b) {
419
- if (a === b)
420
- return true;
419
+ if (a === b) return true;
421
420
  let aValidType = isDate(a);
422
421
  let bValidType = isDate(b);
423
422
  if (aValidType || bValidType) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/shared",
3
- "version": "3.4.27",
3
+ "version": "3.4.28",
4
4
  "description": "internal utils shared across @vue packages",
5
5
  "main": "index.js",
6
6
  "module": "dist/shared.esm-bundler.js",