@vue/shared
Advanced tools
Comparing version 3.5.0-alpha.2 to 3.5.0-alpha.3
/** | ||
* @vue/shared v3.5.0-alpha.2 | ||
* @vue/shared v3.5.0-alpha.3 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -83,5 +83,5 @@ * @license MIT | ||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
const invokeArrayFns = (fns, arg) => { | ||
const invokeArrayFns = (fns, ...arg) => { | ||
for (let i = 0; i < fns.length; i++) { | ||
fns[i](arg); | ||
fns[i](...arg); | ||
} | ||
@@ -139,4 +139,4 @@ }; | ||
"2048": "DEV_ROOT_FRAGMENT", | ||
"HOISTED": -1, | ||
"-1": "HOISTED", | ||
"CACHED": -1, | ||
"-1": "CACHED", | ||
"BAIL": -2, | ||
@@ -201,3 +201,3 @@ "-2": "BAIL" | ||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | ||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; | ||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
@@ -208,2 +208,5 @@ const isGloballyWhitelisted = isGloballyAllowed; | ||
function generateCodeFrame(source, start = 0, end = source.length) { | ||
start = Math.max(0, Math.min(start, source.length)); | ||
end = Math.max(0, Math.min(end, source.length)); | ||
if (start > end) return ""; | ||
let lines = source.split(/(\r?\n)/); | ||
@@ -218,4 +221,3 @@ const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
for (let j = i - range; j <= i + range || end > count; j++) { | ||
if (j < 0 || j >= lines.length) | ||
continue; | ||
if (j < 0 || j >= lines.length) continue; | ||
const line = j + 1; | ||
@@ -285,4 +287,4 @@ res.push( | ||
const value = styles[key]; | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
if (isString(value) || typeof value === "number") { | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
ret += `${normalizedKey}:${value};`; | ||
@@ -314,4 +316,3 @@ } | ||
function normalizeProps(props) { | ||
if (!props) | ||
return null; | ||
if (!props) return null; | ||
let { class: klass, style } = props; | ||
@@ -421,4 +422,3 @@ if (klass && !isString(klass)) { | ||
function looseCompareArrays(a, b) { | ||
if (a.length !== b.length) | ||
return false; | ||
if (a.length !== b.length) return false; | ||
let equal = true; | ||
@@ -431,4 +431,3 @@ for (let i = 0; equal && i < a.length; i++) { | ||
function looseEqual(a, b) { | ||
if (a === b) | ||
return true; | ||
if (a === b) return true; | ||
let aValidType = isDate(a); | ||
@@ -474,7 +473,10 @@ let bValidType = isDate(b); | ||
const isRef = (val) => { | ||
return !!(val && val["__v_isRef"] === true); | ||
}; | ||
const toDisplayString = (val) => { | ||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val); | ||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | ||
}; | ||
const replacer = (_key, val) => { | ||
if (val && val.__v_isRef) { | ||
if (isRef(val)) { | ||
return replacer(_key, val.value); | ||
@@ -481,0 +483,0 @@ } else if (isMap(val)) { |
/** | ||
* @vue/shared v3.5.0-alpha.2 | ||
* @vue/shared v3.5.0-alpha.3 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -83,5 +83,5 @@ * @license MIT | ||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
const invokeArrayFns = (fns, arg) => { | ||
const invokeArrayFns = (fns, ...arg) => { | ||
for (let i = 0; i < fns.length; i++) { | ||
fns[i](arg); | ||
fns[i](...arg); | ||
} | ||
@@ -139,4 +139,4 @@ }; | ||
"2048": "DEV_ROOT_FRAGMENT", | ||
"HOISTED": -1, | ||
"-1": "HOISTED", | ||
"CACHED": -1, | ||
"-1": "CACHED", | ||
"BAIL": -2, | ||
@@ -201,3 +201,3 @@ "-2": "BAIL" | ||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | ||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; | ||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
@@ -208,2 +208,5 @@ const isGloballyWhitelisted = isGloballyAllowed; | ||
function generateCodeFrame(source, start = 0, end = source.length) { | ||
start = Math.max(0, Math.min(start, source.length)); | ||
end = Math.max(0, Math.min(end, source.length)); | ||
if (start > end) return ""; | ||
let lines = source.split(/(\r?\n)/); | ||
@@ -218,4 +221,3 @@ const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
for (let j = i - range; j <= i + range || end > count; j++) { | ||
if (j < 0 || j >= lines.length) | ||
continue; | ||
if (j < 0 || j >= lines.length) continue; | ||
const line = j + 1; | ||
@@ -285,4 +287,4 @@ res.push( | ||
const value = styles[key]; | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
if (isString(value) || typeof value === "number") { | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
ret += `${normalizedKey}:${value};`; | ||
@@ -314,4 +316,3 @@ } | ||
function normalizeProps(props) { | ||
if (!props) | ||
return null; | ||
if (!props) return null; | ||
let { class: klass, style } = props; | ||
@@ -421,4 +422,3 @@ if (klass && !isString(klass)) { | ||
function looseCompareArrays(a, b) { | ||
if (a.length !== b.length) | ||
return false; | ||
if (a.length !== b.length) return false; | ||
let equal = true; | ||
@@ -431,4 +431,3 @@ for (let i = 0; equal && i < a.length; i++) { | ||
function looseEqual(a, b) { | ||
if (a === b) | ||
return true; | ||
if (a === b) return true; | ||
let aValidType = isDate(a); | ||
@@ -474,7 +473,10 @@ let bValidType = isDate(b); | ||
const isRef = (val) => { | ||
return !!(val && val["__v_isRef"] === true); | ||
}; | ||
const toDisplayString = (val) => { | ||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val); | ||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | ||
}; | ||
const replacer = (_key, val) => { | ||
if (val && val.__v_isRef) { | ||
if (isRef(val)) { | ||
return replacer(_key, val.value); | ||
@@ -481,0 +483,0 @@ } else if (isMap(val)) { |
@@ -64,3 +64,3 @@ /** | ||
export declare const hasChanged: (value: any, oldValue: any) => boolean; | ||
export declare const invokeArrayFns: (fns: Function[], arg?: any) => void; | ||
export declare const invokeArrayFns: (fns: Function[], ...arg: any[]) => void; | ||
export declare const def: (obj: object, key: string | symbol, value: any, writable?: boolean) => void; | ||
@@ -178,6 +178,6 @@ /** | ||
/** | ||
* Indicates a hoisted static vnode. This is a hint for hydration to skip | ||
* Indicates a cached static vnode. This is also a hint for hydration to skip | ||
* the entire sub tree since static content never needs to be updated. | ||
*/ | ||
HOISTED = -1, | ||
CACHED = -1, | ||
/** | ||
@@ -184,0 +184,0 @@ * A special flag that indicates that the diffing algorithm should bail out |
/** | ||
* @vue/shared v3.5.0-alpha.2 | ||
* @vue/shared v3.5.0-alpha.3 | ||
* (c) 2018-present Yuxi (Evan) You and Vue contributors | ||
@@ -79,5 +79,5 @@ * @license MIT | ||
const hasChanged = (value, oldValue) => !Object.is(value, oldValue); | ||
const invokeArrayFns = (fns, arg) => { | ||
const invokeArrayFns = (fns, ...arg) => { | ||
for (let i = 0; i < fns.length; i++) { | ||
fns[i](arg); | ||
fns[i](...arg); | ||
} | ||
@@ -135,4 +135,4 @@ }; | ||
"2048": "DEV_ROOT_FRAGMENT", | ||
"HOISTED": -1, | ||
"-1": "HOISTED", | ||
"CACHED": -1, | ||
"-1": "CACHED", | ||
"BAIL": -2, | ||
@@ -197,3 +197,3 @@ "-2": "BAIL" | ||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error"; | ||
const GLOBALS_ALLOWED = "Infinity,undefined,NaN,isFinite,isNaN,parseFloat,parseInt,decodeURI,decodeURIComponent,encodeURI,encodeURIComponent,Math,Number,Date,Array,Object,Boolean,String,RegExp,Map,Set,JSON,Intl,BigInt,console,Error,Symbol"; | ||
const isGloballyAllowed = /* @__PURE__ */ makeMap(GLOBALS_ALLOWED); | ||
@@ -204,2 +204,5 @@ const isGloballyWhitelisted = isGloballyAllowed; | ||
function generateCodeFrame(source, start = 0, end = source.length) { | ||
start = Math.max(0, Math.min(start, source.length)); | ||
end = Math.max(0, Math.min(end, source.length)); | ||
if (start > end) return ""; | ||
let lines = source.split(/(\r?\n)/); | ||
@@ -214,4 +217,3 @@ const newlineSequences = lines.filter((_, idx) => idx % 2 === 1); | ||
for (let j = i - range; j <= i + range || end > count; j++) { | ||
if (j < 0 || j >= lines.length) | ||
continue; | ||
if (j < 0 || j >= lines.length) continue; | ||
const line = j + 1; | ||
@@ -281,4 +283,4 @@ res.push( | ||
const value = styles[key]; | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
if (isString(value) || typeof value === "number") { | ||
const normalizedKey = key.startsWith(`--`) ? key : hyphenate(key); | ||
ret += `${normalizedKey}:${value};`; | ||
@@ -310,4 +312,3 @@ } | ||
function normalizeProps(props) { | ||
if (!props) | ||
return null; | ||
if (!props) return null; | ||
let { class: klass, style } = props; | ||
@@ -417,4 +418,3 @@ if (klass && !isString(klass)) { | ||
function looseCompareArrays(a, b) { | ||
if (a.length !== b.length) | ||
return false; | ||
if (a.length !== b.length) return false; | ||
let equal = true; | ||
@@ -427,4 +427,3 @@ for (let i = 0; equal && i < a.length; i++) { | ||
function looseEqual(a, b) { | ||
if (a === b) | ||
return true; | ||
if (a === b) return true; | ||
let aValidType = isDate(a); | ||
@@ -470,7 +469,10 @@ let bValidType = isDate(b); | ||
const isRef = (val) => { | ||
return !!(val && val["__v_isRef"] === true); | ||
}; | ||
const toDisplayString = (val) => { | ||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? JSON.stringify(val, replacer, 2) : String(val); | ||
return isString(val) ? val : val == null ? "" : isArray(val) || isObject(val) && (val.toString === objectToString || !isFunction(val.toString)) ? isRef(val) ? toDisplayString(val.value) : JSON.stringify(val, replacer, 2) : String(val); | ||
}; | ||
const replacer = (_key, val) => { | ||
if (val && val.__v_isRef) { | ||
if (isRef(val)) { | ||
return replacer(_key, val.value); | ||
@@ -477,0 +479,0 @@ } else if (isMap(val)) { |
{ | ||
"name": "@vue/shared", | ||
"version": "3.5.0-alpha.2", | ||
"version": "3.5.0-alpha.3", | ||
"description": "internal utils shared across @vue packages", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
82214
1978