@vue/shared 3.2.32 → 3.2.34

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.
@@ -404,6 +404,11 @@ function looseEqual(a, b) {
404
404
  if (aValidType || bValidType) {
405
405
  return aValidType && bValidType ? a.getTime() === b.getTime() : false;
406
406
  }
407
+ aValidType = isSymbol(a);
408
+ bValidType = isSymbol(b);
409
+ if (aValidType || bValidType) {
410
+ return a === b;
411
+ }
407
412
  aValidType = isArray(a);
408
413
  bValidType = isArray(b);
409
414
  if (aValidType || bValidType) {
@@ -499,7 +504,7 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
499
504
  const isArray = Array.isArray;
500
505
  const isMap = (val) => toTypeString(val) === '[object Map]';
501
506
  const isSet = (val) => toTypeString(val) === '[object Set]';
502
- const isDate = (val) => val instanceof Date;
507
+ const isDate = (val) => toTypeString(val) === '[object Date]';
503
508
  const isFunction = (val) => typeof val === 'function';
504
509
  const isString = (val) => typeof val === 'string';
505
510
  const isSymbol = (val) => typeof val === 'symbol';
@@ -583,7 +588,13 @@ const getGlobalThis = () => {
583
588
  : typeof global !== 'undefined'
584
589
  ? global
585
590
  : {}));
586
- };
591
+ };
592
+ const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
593
+ function genPropsAccessExp(name) {
594
+ return identRE.test(name)
595
+ ? `__props.${name}`
596
+ : `__props[${JSON.stringify(name)}]`;
597
+ }
587
598
 
588
599
  exports.EMPTY_ARR = EMPTY_ARR;
589
600
  exports.EMPTY_OBJ = EMPTY_OBJ;
@@ -596,6 +607,7 @@ exports.def = def;
596
607
  exports.escapeHtml = escapeHtml;
597
608
  exports.escapeHtmlComment = escapeHtmlComment;
598
609
  exports.extend = extend;
610
+ exports.genPropsAccessExp = genPropsAccessExp;
599
611
  exports.generateCodeFrame = generateCodeFrame;
600
612
  exports.getGlobalThis = getGlobalThis;
601
613
  exports.hasChanged = hasChanged;
@@ -404,6 +404,11 @@ function looseEqual(a, b) {
404
404
  if (aValidType || bValidType) {
405
405
  return aValidType && bValidType ? a.getTime() === b.getTime() : false;
406
406
  }
407
+ aValidType = isSymbol(a);
408
+ bValidType = isSymbol(b);
409
+ if (aValidType || bValidType) {
410
+ return a === b;
411
+ }
407
412
  aValidType = isArray(a);
408
413
  bValidType = isArray(b);
409
414
  if (aValidType || bValidType) {
@@ -498,7 +503,7 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
498
503
  const isArray = Array.isArray;
499
504
  const isMap = (val) => toTypeString(val) === '[object Map]';
500
505
  const isSet = (val) => toTypeString(val) === '[object Set]';
501
- const isDate = (val) => val instanceof Date;
506
+ const isDate = (val) => toTypeString(val) === '[object Date]';
502
507
  const isFunction = (val) => typeof val === 'function';
503
508
  const isString = (val) => typeof val === 'string';
504
509
  const isSymbol = (val) => typeof val === 'symbol';
@@ -582,7 +587,13 @@ const getGlobalThis = () => {
582
587
  : typeof global !== 'undefined'
583
588
  ? global
584
589
  : {}));
585
- };
590
+ };
591
+ const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
592
+ function genPropsAccessExp(name) {
593
+ return identRE.test(name)
594
+ ? `__props.${name}`
595
+ : `__props[${JSON.stringify(name)}]`;
596
+ }
586
597
 
587
598
  exports.EMPTY_ARR = EMPTY_ARR;
588
599
  exports.EMPTY_OBJ = EMPTY_OBJ;
@@ -595,6 +606,7 @@ exports.def = def;
595
606
  exports.escapeHtml = escapeHtml;
596
607
  exports.escapeHtmlComment = escapeHtmlComment;
597
608
  exports.extend = extend;
609
+ exports.genPropsAccessExp = genPropsAccessExp;
598
610
  exports.generateCodeFrame = generateCodeFrame;
599
611
  exports.getGlobalThis = getGlobalThis;
600
612
  exports.hasChanged = hasChanged;
package/dist/shared.d.ts CHANGED
@@ -29,6 +29,8 @@ export declare const extend: {
29
29
 
30
30
  export declare function generateCodeFrame(source: string, start?: number, end?: number): string;
31
31
 
32
+ export declare function genPropsAccessExp(name: string): string;
33
+
32
34
  export declare const getGlobalThis: () => any;
33
35
 
34
36
  export declare const hasChanged: (value: any, oldValue: any) => boolean;
@@ -40,7 +42,7 @@ export declare const hasOwn: (val: object, key: string | symbol) => key is never
40
42
  */
41
43
  export declare const hyphenate: (str: string) => string;
42
44
 
43
- export declare type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N;
45
+ export declare type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N;
44
46
 
45
47
  /**
46
48
  * Boolean attributes should be included if the value is truthy or ''.
@@ -400,6 +400,11 @@ function looseEqual(a, b) {
400
400
  if (aValidType || bValidType) {
401
401
  return aValidType && bValidType ? a.getTime() === b.getTime() : false;
402
402
  }
403
+ aValidType = isSymbol(a);
404
+ bValidType = isSymbol(b);
405
+ if (aValidType || bValidType) {
406
+ return a === b;
407
+ }
403
408
  aValidType = isArray(a);
404
409
  bValidType = isArray(b);
405
410
  if (aValidType || bValidType) {
@@ -496,7 +501,7 @@ const hasOwn = (val, key) => hasOwnProperty.call(val, key);
496
501
  const isArray = Array.isArray;
497
502
  const isMap = (val) => toTypeString(val) === '[object Map]';
498
503
  const isSet = (val) => toTypeString(val) === '[object Set]';
499
- const isDate = (val) => val instanceof Date;
504
+ const isDate = (val) => toTypeString(val) === '[object Date]';
500
505
  const isFunction = (val) => typeof val === 'function';
501
506
  const isString = (val) => typeof val === 'string';
502
507
  const isSymbol = (val) => typeof val === 'symbol';
@@ -580,6 +585,12 @@ const getGlobalThis = () => {
580
585
  : typeof global !== 'undefined'
581
586
  ? global
582
587
  : {}));
583
- };
588
+ };
589
+ const identRE = /^[_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*$/;
590
+ function genPropsAccessExp(name) {
591
+ return identRE.test(name)
592
+ ? `__props.${name}`
593
+ : `__props[${JSON.stringify(name)}]`;
594
+ }
584
595
 
585
- export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
596
+ export { EMPTY_ARR, EMPTY_OBJ, NO, NOOP, PatchFlagNames, camelize, capitalize, def, escapeHtml, escapeHtmlComment, extend, genPropsAccessExp, generateCodeFrame, getGlobalThis, hasChanged, hasOwn, hyphenate, includeBooleanAttr, invokeArrayFns, isArray, isBooleanAttr, isBuiltInDirective, isDate, isFunction, isGloballyWhitelisted, isHTMLTag, isIntegerKey, isKnownHtmlAttr, isKnownSvgAttr, isMap, isModelListener, isNoUnitNumericStyleProp, isObject, isOn, isPlainObject, isPromise, isReservedProp, isSSRSafeAttrName, isSVGTag, isSet, isSpecialBooleanAttr, isString, isSymbol, isVoidTag, looseEqual, looseIndexOf, makeMap, normalizeClass, normalizeProps, normalizeStyle, objectToString, parseStringStyle, propsToAttrMap, remove, slotFlagsText, stringifyStyle, toDisplayString, toHandlerKey, toNumber, toRawType, toTypeString };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vue/shared",
3
- "version": "3.2.32",
3
+ "version": "3.2.34",
4
4
  "description": "internal utils shared across @vue packages",
5
5
  "main": "index.js",
6
6
  "module": "dist/shared.esm-bundler.js",
@@ -9,6 +9,7 @@
9
9
  "index.js",
10
10
  "dist"
11
11
  ],
12
+ "sideEffects": false,
12
13
  "buildOptions": {
13
14
  "formats": [
14
15
  "esm-bundler",