diff --git a/packages/uni-h5/dist-x/uni-h5.cjs.js b/packages/uni-h5/dist-x/uni-h5.cjs.js index e83e9088881cbf256facdd7eeaa3fee03683f2e6..e18d32c156ece07bb463596032294cf6aa1d5151 100644 --- a/packages/uni-h5/dist-x/uni-h5.cjs.js +++ b/packages/uni-h5/dist-x/uni-h5.cjs.js @@ -134,6 +134,9 @@ function isAnyType(type) { function isUTSType(type) { return type && type.prototype && type.prototype instanceof UTSType; } +function normalizeGenericValue(value, genericType, isJSONParse = false) { + return value == null ? null : isBaseType(genericType) || isUnknownType(genericType) || isAnyType(genericType) ? value : genericType === Array ? new Array(...value) : new genericType(value, void 0, isJSONParse); +} class UTSType { static get$UTSMetadata$(...args) { return { @@ -161,10 +164,24 @@ class UTSType { } super(); return options.map((item) => { - return item == null ? null : isBaseType(generics[0]) || isUnknownType(generics[0]) || isAnyType(generics[0]) ? item : generics[0] === Array ? new Array(...item) : new generics[0](item, void 0, isJSONParse2); + return normalizeGenericValue(item, generics[0], isJSONParse2); }); } }; + } else if (parent === Map || parent === WeakMap) { + return class UTSMap extends UTSType { + constructor(options, isJSONParse2 = false) { + if (options == null || typeof options !== "object") { + throw new UTSError(`Failed to contruct type, ${options} is not an object`); + } + super(); + const obj = new parent(); + for (const key in options) { + obj.set(normalizeGenericValue(key, generics[0], isJSONParse2), normalizeGenericValue(options[key], generics[1], isJSONParse2)); + } + return obj; + } + }; } else if (isUTSType(parent)) { return class VirtualClassWithGenerics extends parent { static get$UTSMetadata$() { @@ -1664,7 +1681,7 @@ function addBase(filePath) { function getRealPath(filePath) { const { base, assets } = __uniConfig.router; if (base === "./") { - if (filePath.indexOf("./static/") === 0 || assets && filePath.indexOf("./" + assets + "/") === 0) { + if (filePath.indexOf("./") === 0 && (filePath.includes("/static/") || filePath.indexOf("./" + (assets || "assets") + "/") === 0)) { filePath = filePath.slice(1); } } diff --git a/packages/uni-h5/dist-x/uni-h5.es.js b/packages/uni-h5/dist-x/uni-h5.es.js index 16bd206f6771b57a50929172ef55760218a38d36..3b16fda09a14e2fe21fd17e7377b2c642219f542 100644 --- a/packages/uni-h5/dist-x/uni-h5.es.js +++ b/packages/uni-h5/dist-x/uni-h5.es.js @@ -133,6 +133,9 @@ function isAnyType(type) { function isUTSType(type) { return type && type.prototype && type.prototype instanceof UTSType; } +function normalizeGenericValue(value, genericType, isJSONParse = false) { + return value == null ? null : isBaseType(genericType) || isUnknownType(genericType) || isAnyType(genericType) ? value : genericType === Array ? new Array(...value) : new genericType(value, void 0, isJSONParse); +} class UTSType { static get$UTSMetadata$(...args) { return { @@ -160,10 +163,24 @@ class UTSType { } super(); return options.map((item) => { - return item == null ? null : isBaseType(generics[0]) || isUnknownType(generics[0]) || isAnyType(generics[0]) ? item : generics[0] === Array ? new Array(...item) : new generics[0](item, void 0, isJSONParse2); + return normalizeGenericValue(item, generics[0], isJSONParse2); }); } }; + } else if (parent === Map || parent === WeakMap) { + return class UTSMap extends UTSType { + constructor(options, isJSONParse2 = false) { + if (options == null || typeof options !== "object") { + throw new UTSError(`Failed to contruct type, ${options} is not an object`); + } + super(); + const obj = new parent(); + for (const key in options) { + obj.set(normalizeGenericValue(key, generics[0], isJSONParse2), normalizeGenericValue(options[key], generics[1], isJSONParse2)); + } + return obj; + } + }; } else if (isUTSType(parent)) { return class VirtualClassWithGenerics extends parent { static get$UTSMetadata$() { @@ -3021,7 +3038,7 @@ function addBase(filePath) { function getRealPath(filePath) { const { base, assets } = __uniConfig.router; if (base === "./") { - if (filePath.indexOf("./static/") === 0 || assets && filePath.indexOf("./" + assets + "/") === 0) { + if (filePath.indexOf("./") === 0 && (filePath.includes("/static/") || filePath.indexOf("./" + (assets || "assets") + "/") === 0)) { filePath = filePath.slice(1); } } diff --git a/packages/uni-h5/dist/uni-h5.cjs.js b/packages/uni-h5/dist/uni-h5.cjs.js index e72df3436bff9b4c37cfb359239b1975248e4202..8a590ecbc4844803fa372a897f39d11f65df500b 100644 --- a/packages/uni-h5/dist/uni-h5.cjs.js +++ b/packages/uni-h5/dist/uni-h5.cjs.js @@ -1048,7 +1048,7 @@ function addBase(filePath) { function getRealPath(filePath) { const { base, assets } = __uniConfig.router; if (base === "./") { - if (filePath.indexOf("./static/") === 0 || assets && filePath.indexOf("./" + assets + "/") === 0) { + if (filePath.indexOf("./") === 0 && (filePath.includes("/static/") || filePath.indexOf("./" + (assets || "assets") + "/") === 0)) { filePath = filePath.slice(1); } } diff --git a/packages/uni-h5/dist/uni-h5.es.js b/packages/uni-h5/dist/uni-h5.es.js index 8efd1d5d5597197c37cc01a77bde35f81b25e8e5..8b57ae85462a132127ae12bb06c93e82d648d9d5 100644 --- a/packages/uni-h5/dist/uni-h5.es.js +++ b/packages/uni-h5/dist/uni-h5.es.js @@ -2367,7 +2367,7 @@ function addBase(filePath) { function getRealPath(filePath) { const { base, assets } = __uniConfig.router; if (base === "./") { - if (filePath.indexOf("./static/") === 0 || assets && filePath.indexOf("./" + assets + "/") === 0) { + if (filePath.indexOf("./") === 0 && (filePath.includes("/static/") || filePath.indexOf("./" + (assets || "assets") + "/") === 0)) { filePath = filePath.slice(1); } }