@teleporthq/teleport-shared
Advanced tools
Comparing version
@@ -491,2 +491,3 @@ import { | ||
prefix: '/noidentifier', | ||
mappings: { 'kitten.png': '' }, | ||
}) | ||
@@ -493,0 +494,0 @@ ).toBe('/noidentifier/kitten.png') |
@@ -103,2 +103,3 @@ "use strict"; | ||
var assetName = (0, path_1.basename)(originalString); | ||
var decodedAssetName = decodeURIComponent(assetName); | ||
/* | ||
@@ -108,3 +109,15 @@ If the value is missing from the mapping, it means | ||
- It's not a asset and so we don't need to provide any mapping for it | ||
Note: We need to check for decoded asset name as well as for some special characters such as katakana / kanjis / hiraganas | ||
the src / url leading to the asset can be encoded and we need to check the decoded version against the asset mapping | ||
*/ | ||
if (!(typeof mappings[assetName] === 'string') && | ||
!(typeof mappings[decodedAssetName] === 'string')) { | ||
return originalString; | ||
} | ||
/* | ||
If the value from the mapping is an empty string | ||
we need to not join it in the return path as it would append | ||
a wrong / | ||
*/ | ||
if (!mappings[assetName]) { | ||
@@ -111,0 +124,0 @@ if (!identifier) { |
@@ -91,2 +91,3 @@ import { camelCaseToDashCase, removeIllegalCharacters, dashCaseToUpperCamelCase, } from './string-utils'; | ||
var assetName = basename(originalString); | ||
var decodedAssetName = decodeURIComponent(assetName); | ||
/* | ||
@@ -96,3 +97,15 @@ If the value is missing from the mapping, it means | ||
- It's not a asset and so we don't need to provide any mapping for it | ||
Note: We need to check for decoded asset name as well as for some special characters such as katakana / kanjis / hiraganas | ||
the src / url leading to the asset can be encoded and we need to check the decoded version against the asset mapping | ||
*/ | ||
if (!(typeof mappings[assetName] === 'string') && | ||
!(typeof mappings[decodedAssetName] === 'string')) { | ||
return originalString; | ||
} | ||
/* | ||
If the value from the mapping is an empty string | ||
we need to not join it in the return path as it would append | ||
a wrong / | ||
*/ | ||
if (!mappings[assetName]) { | ||
@@ -99,0 +112,0 @@ if (!identifier) { |
{ | ||
"name": "@teleporthq/teleport-shared", | ||
"version": "0.26.5", | ||
"version": "0.27.0", | ||
"description": "A utility belt for the entire teleportHQ ecosystem", | ||
@@ -28,7 +28,7 @@ "author": "teleportHQ", | ||
"@babel/types": "^7.5.5", | ||
"@teleporthq/teleport-types": "^0.26.5", | ||
"@teleporthq/teleport-types": "^0.27.0", | ||
"jss": "^10.0.0", | ||
"jss-preset-default": "^10.0.0" | ||
}, | ||
"gitHead": "564e726c5481e2b39e16e79b76319aa72d12bbb5" | ||
"gitHead": "d11357eea374e782b24d2813eb36b6bee378f954" | ||
} |
@@ -137,2 +137,3 @@ import { | ||
const assetName = basename(originalString) | ||
const decodedAssetName = decodeURIComponent(assetName) | ||
@@ -143,4 +144,20 @@ /* | ||
- It's not a asset and so we don't need to provide any mapping for it | ||
Note: We need to check for decoded asset name as well as for some special characters such as katakana / kanjis / hiraganas | ||
the src / url leading to the asset can be encoded and we need to check the decoded version against the asset mapping | ||
*/ | ||
if ( | ||
!(typeof mappings[assetName] === 'string') && | ||
!(typeof mappings[decodedAssetName] === 'string') | ||
) { | ||
return originalString | ||
} | ||
/* | ||
If the value from the mapping is an empty string | ||
we need to not join it in the return path as it would append | ||
a wrong / | ||
*/ | ||
if (!mappings[assetName]) { | ||
@@ -147,0 +164,0 @@ if (!identifier) { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
178947
1.3%2506
1.58%+ Added
- Removed