New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@teleporthq/teleport-uidl-resolver

Package Overview
Dependencies
Maintainers
3
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teleporthq/teleport-uidl-resolver - npm Package Compare versions

Comparing version

to
0.19.19

12

dist/cjs/resolver.js

@@ -15,3 +15,7 @@ "use strict";

if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {

@@ -68,7 +72,7 @@ if (k2 === undefined) k2 = k;

var uidl = teleport_shared_1.UIDLUtils.cloneObject(input);
uidl.styleSetDefinitions = style_set_definitions_1.resolveStyleSetDefinitions(input.styleSetDefinitions || {});
uidl.styleSetDefinitions = (0, style_set_definitions_1.resolveStyleSetDefinitions)(input.styleSetDefinitions || {});
teleport_shared_1.UIDLUtils.setFriendlyOutputOptions(uidl);
utils.checkForIllegalNames(uidl, mapping);
abilities_1.resolveAbilities(uidl, newOptions);
referenced_styles_1.resolveReferencedStyle(uidl);
(0, abilities_1.resolveAbilities)(uidl, newOptions);
(0, referenced_styles_1.resolveReferencedStyle)(uidl);
// TODO: Rename into apply mappings

@@ -75,0 +79,0 @@ utils.resolveNode(uidl.node, newOptions);

@@ -6,5 +6,5 @@ "use strict";

var resolveAbilities = function (uidl, options) {
uidl.node = utils_1.insertLinks(uidl.node, options);
uidl.node = (0, utils_1.insertLinks)(uidl.node, options);
};
exports.resolveAbilities = resolveAbilities;
//# sourceMappingURL=index.js.map

@@ -26,12 +26,12 @@ "use strict";

if (child.type === 'element') {
return exports.insertLinks(child, options, linkInNode, node);
return (0, exports.insertLinks)(child, options, linkInNode, node);
}
if (child.type === 'repeat') {
child.content.node = exports.insertLinks(child.content.node, options, linkInNode, node);
child.content.node = (0, exports.insertLinks)(child.content.node, options, linkInNode, node);
}
if (child.type === 'conditional' && child.content.node.type === 'element') {
child.content.node = exports.insertLinks(child.content.node, options, linkInNode, node);
child.content.node = (0, exports.insertLinks)(child.content.node, options, linkInNode, node);
}
if (child.type === 'slot' && ((_a = child.content.fallback) === null || _a === void 0 ? void 0 : _a.type) === 'element') {
child.content.fallback = exports.insertLinks(child.content.fallback, options, linkInNode, node);
child.content.fallback = (0, exports.insertLinks)(child.content.fallback, options, linkInNode, node);
}

@@ -61,3 +61,3 @@ return child;

}
var linkNode = exports.createLinkNode(abilities.link, options);
var linkNode = (0, exports.createLinkNode)(abilities.link, options);
linkNode.content.children.push(node);

@@ -107,3 +107,3 @@ if (((_b = (_a = parentNode === null || parentNode === void 0 ? void 0 : parentNode.content.style) === null || _a === void 0 ? void 0 : _a.display) === null || _b === void 0 ? void 0 : _b.content) === 'flex') {

type: 'static',
content: "#" + link.content.section,
content: "#".concat(link.content.section),
},

@@ -121,5 +121,5 @@ };

case 'mail': {
var mailUrl = "mailto:" + link.content.mail + "?subject=" + ((_a = link.content.subject) !== null && _a !== void 0 ? _a : '');
var mailUrl = "mailto:".concat(link.content.mail, "?subject=").concat((_a = link.content.subject) !== null && _a !== void 0 ? _a : '');
if (link.content.body) {
mailUrl = mailUrl + ("&body=" + link.content.body);
mailUrl = mailUrl + "&body=".concat(link.content.body);
}

@@ -132,7 +132,7 @@ return {

return {
url: { type: 'static', content: "tel:" + link.content.phone },
url: { type: 'static', content: "tel:".concat(link.content.phone) },
};
}
default:
throw new Error("createLinkNode called with invalid link type '" + link.type + "'");
throw new Error("createLinkNode called with invalid link type '".concat(link.type, "'"));
}

@@ -154,6 +154,6 @@ };

if (!transitionRoute) {
return "/" + friendlyURL;
return "/".concat(friendlyURL);
}
return (_b = (_a = transitionRoute === null || transitionRoute === void 0 ? void 0 : transitionRoute.pageOptions) === null || _a === void 0 ? void 0 : _a.navLink) !== null && _b !== void 0 ? _b : "/" + friendlyURL;
return (_b = (_a = transitionRoute === null || transitionRoute === void 0 ? void 0 : transitionRoute.pageOptions) === null || _a === void 0 ? void 0 : _a.navLink) !== null && _b !== void 0 ? _b : "/".concat(friendlyURL);
};
//# sourceMappingURL=utils.js.map

@@ -75,3 +75,3 @@ "use strict";

default: {
throw new Error("Invalid referenceStyle passed - " + JSON.stringify(styleRef.content, null, 2));
throw new Error("Invalid referenceStyle passed - ".concat(JSON.stringify(styleRef.content, null, 2)));
}

@@ -78,0 +78,0 @@ }

@@ -17,6 +17,10 @@ "use strict";

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -39,3 +43,3 @@ Object.defineProperty(exports, "__esModule", { value: true });

var elementStateConditions = conditions.filter(function (item) { return item.type === 'element-state'; });
acc[styleId] = __assign(__assign({}, styleRef), { conditions: __spreadArray(__spreadArray([], elementStateConditions), mediaConditions) });
acc[styleId] = __assign(__assign({}, styleRef), { conditions: __spreadArray(__spreadArray([], elementStateConditions, true), mediaConditions, true) });
return acc;

@@ -42,0 +46,0 @@ }, {});

@@ -13,6 +13,10 @@ "use strict";

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -33,3 +37,3 @@ var __importDefault = (this && this.__importDefault) || function (mod) {

if (deepMerge === true) {
return deepmerge_1.default(oldMapping, newMapping);
return (0, deepmerge_1.default)(oldMapping, newMapping);
}

@@ -40,4 +44,4 @@ return {

attributes: __assign(__assign({}, oldMapping.attributes), newMapping.attributes),
illegalClassNames: __spreadArray(__spreadArray([], (oldMapping.illegalClassNames || [])), (newMapping.illegalClassNames || [])),
illegalPropNames: __spreadArray(__spreadArray([], (oldMapping.illegalPropNames || [])), (newMapping.illegalPropNames || [])),
illegalClassNames: __spreadArray(__spreadArray([], (oldMapping.illegalClassNames || []), true), (newMapping.illegalClassNames || []), true),
illegalPropNames: __spreadArray(__spreadArray([], (oldMapping.illegalPropNames || []), true), (newMapping.illegalPropNames || []), true),
};

@@ -70,3 +74,3 @@ };

if (node.type === 'element') {
exports.resolveElement(node.content, options);
(0, exports.resolveElement)(node.content, options);
}

@@ -134,3 +138,3 @@ if (node.type === 'repeat') {

if (mappedElement.children) {
originalElement.children = exports.resolveChildren(mappedElement.children, originalElement.children);
originalElement.children = (0, exports.resolveChildren)(mappedElement.children, originalElement.children);
// Solves an edge case for next.js by passing the styles from the <Link> tag to the <a> tag

@@ -178,3 +182,3 @@ var anchorChild = originalElement.children.find(function (child) { return child.type === 'element' && child.content.elementType === 'a'; });

// If no placeholder was found, newChildren are appended to the original children
return __spreadArray(__spreadArray([], originalChildren), newChildren);
return __spreadArray(__spreadArray([], originalChildren, true), newChildren, true);
};

@@ -189,3 +193,3 @@ exports.resolveChildren = resolveChildren;

if (isPlaceholderNode(nodes[index])) {
var retValue = __spreadArray(__spreadArray(__spreadArray([], nodes.slice(0, index)), insertedNodes), nodes.slice(index + 1, nodes.length));
var retValue = __spreadArray(__spreadArray(__spreadArray([], nodes.slice(0, index), true), insertedNodes, true), nodes.slice(index + 1, nodes.length), true);
return retValue;

@@ -275,3 +279,3 @@ }

repeat.meta = repeat.meta || {};
repeat.meta.dataSourceIdentifier = index === 0 ? 'items' : "items" + index;
repeat.meta.dataSourceIdentifier = index === 0 ? 'items' : "items".concat(index);
index += 1;

@@ -321,3 +325,3 @@ }

default:
throw new Error("Invalid styleValue type '" + styleValue + "'");
throw new Error("Invalid styleValue type '".concat(styleValue, "'"));
}

@@ -392,4 +396,4 @@ return acc;

if (illegalClassNames.includes(uidl.outputOptions.componentClassName)) {
console.warn("Illegal component name '" + uidl.outputOptions.componentClassName + "'. Appending 'App' in front of it");
uidl.outputOptions.componentClassName = "App" + uidl.outputOptions.componentClassName;
console.warn("Illegal component name '".concat(uidl.outputOptions.componentClassName, "'. Appending 'App' in front of it"));
uidl.outputOptions.componentClassName = "App".concat(uidl.outputOptions.componentClassName);
}

@@ -399,3 +403,3 @@ if (uidl.propDefinitions) {

if (illegalPropNames.includes(prop)) {
throw new Error("Illegal prop key '" + prop + "'");
throw new Error("Illegal prop key '".concat(prop, "'"));
}

@@ -407,3 +411,3 @@ });

if (illegalPropNames.includes(state)) {
throw new Error("Illegal state key '" + state + "'");
throw new Error("Illegal state key '".concat(state, "'"));
}

@@ -410,0 +414,0 @@ });

@@ -100,3 +100,3 @@ var __assign = (this && this.__assign) || function () {

type: 'static',
content: "#" + link.content.section,
content: "#".concat(link.content.section),
},

@@ -114,5 +114,5 @@ };

case 'mail': {
var mailUrl = "mailto:" + link.content.mail + "?subject=" + ((_a = link.content.subject) !== null && _a !== void 0 ? _a : '');
var mailUrl = "mailto:".concat(link.content.mail, "?subject=").concat((_a = link.content.subject) !== null && _a !== void 0 ? _a : '');
if (link.content.body) {
mailUrl = mailUrl + ("&body=" + link.content.body);
mailUrl = mailUrl + "&body=".concat(link.content.body);
}

@@ -125,7 +125,7 @@ return {

return {
url: { type: 'static', content: "tel:" + link.content.phone },
url: { type: 'static', content: "tel:".concat(link.content.phone) },
};
}
default:
throw new Error("createLinkNode called with invalid link type '" + link.type + "'");
throw new Error("createLinkNode called with invalid link type '".concat(link.type, "'"));
}

@@ -147,6 +147,6 @@ };

if (!transitionRoute) {
return "/" + friendlyURL;
return "/".concat(friendlyURL);
}
return (_b = (_a = transitionRoute === null || transitionRoute === void 0 ? void 0 : transitionRoute.pageOptions) === null || _a === void 0 ? void 0 : _a.navLink) !== null && _b !== void 0 ? _b : "/" + friendlyURL;
return (_b = (_a = transitionRoute === null || transitionRoute === void 0 ? void 0 : transitionRoute.pageOptions) === null || _a === void 0 ? void 0 : _a.navLink) !== null && _b !== void 0 ? _b : "/".concat(friendlyURL);
};
//# sourceMappingURL=utils.js.map

@@ -71,3 +71,3 @@ /*

default: {
throw new Error("Invalid referenceStyle passed - " + JSON.stringify(styleRef.content, null, 2));
throw new Error("Invalid referenceStyle passed - ".concat(JSON.stringify(styleRef.content, null, 2)));
}

@@ -74,0 +74,0 @@ }

@@ -16,6 +16,10 @@ /*

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -36,3 +40,3 @@ export var resolveStyleSetDefinitions = function (styleSets) {

var elementStateConditions = conditions.filter(function (item) { return item.type === 'element-state'; });
acc[styleId] = __assign(__assign({}, styleRef), { conditions: __spreadArray(__spreadArray([], elementStateConditions), mediaConditions) });
acc[styleId] = __assign(__assign({}, styleRef), { conditions: __spreadArray(__spreadArray([], elementStateConditions, true), mediaConditions, true) });
return acc;

@@ -39,0 +43,0 @@ }, {});

@@ -12,6 +12,10 @@ var __assign = (this && this.__assign) || function () {

};
var __spreadArray = (this && this.__spreadArray) || function (to, from) {
for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
to[j] = from[i];
return to;
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
if (ar || !(i in from)) {
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
ar[i] = from[i];
}
}
return to.concat(ar || Array.prototype.slice.call(from));
};

@@ -33,4 +37,4 @@ import { UIDLUtils, StringUtils, Constants } from '@teleporthq/teleport-shared';

attributes: __assign(__assign({}, oldMapping.attributes), newMapping.attributes),
illegalClassNames: __spreadArray(__spreadArray([], (oldMapping.illegalClassNames || [])), (newMapping.illegalClassNames || [])),
illegalPropNames: __spreadArray(__spreadArray([], (oldMapping.illegalPropNames || [])), (newMapping.illegalPropNames || [])),
illegalClassNames: __spreadArray(__spreadArray([], (oldMapping.illegalClassNames || []), true), (newMapping.illegalClassNames || []), true),
illegalPropNames: __spreadArray(__spreadArray([], (oldMapping.illegalPropNames || []), true), (newMapping.illegalPropNames || []), true),
};

@@ -164,3 +168,3 @@ };

// If no placeholder was found, newChildren are appended to the original children
return __spreadArray(__spreadArray([], originalChildren), newChildren);
return __spreadArray(__spreadArray([], originalChildren, true), newChildren, true);
};

@@ -174,3 +178,3 @@ var isPlaceholderNode = function (node) {

if (isPlaceholderNode(nodes[index])) {
var retValue = __spreadArray(__spreadArray(__spreadArray([], nodes.slice(0, index)), insertedNodes), nodes.slice(index + 1, nodes.length));
var retValue = __spreadArray(__spreadArray(__spreadArray([], nodes.slice(0, index), true), insertedNodes, true), nodes.slice(index + 1, nodes.length), true);
return retValue;

@@ -258,3 +262,3 @@ }

repeat.meta = repeat.meta || {};
repeat.meta.dataSourceIdentifier = index === 0 ? 'items' : "items" + index;
repeat.meta.dataSourceIdentifier = index === 0 ? 'items' : "items".concat(index);
index += 1;

@@ -303,3 +307,3 @@ }

default:
throw new Error("Invalid styleValue type '" + styleValue + "'");
throw new Error("Invalid styleValue type '".concat(styleValue, "'"));
}

@@ -374,4 +378,4 @@ return acc;

if (illegalClassNames.includes(uidl.outputOptions.componentClassName)) {
console.warn("Illegal component name '" + uidl.outputOptions.componentClassName + "'. Appending 'App' in front of it");
uidl.outputOptions.componentClassName = "App" + uidl.outputOptions.componentClassName;
console.warn("Illegal component name '".concat(uidl.outputOptions.componentClassName, "'. Appending 'App' in front of it"));
uidl.outputOptions.componentClassName = "App".concat(uidl.outputOptions.componentClassName);
}

@@ -381,3 +385,3 @@ if (uidl.propDefinitions) {

if (illegalPropNames.includes(prop)) {
throw new Error("Illegal prop key '" + prop + "'");
throw new Error("Illegal prop key '".concat(prop, "'"));
}

@@ -389,3 +393,3 @@ });

if (illegalPropNames.includes(state)) {
throw new Error("Illegal state key '" + state + "'");
throw new Error("Illegal state key '".concat(state, "'"));
}

@@ -392,0 +396,0 @@ });

{
"name": "@teleporthq/teleport-uidl-resolver",
"version": "0.19.17",
"version": "0.19.19",
"description": "A small package that handles the transition from UIDL to HTML elements and has support for custom mappings.",

@@ -27,8 +27,8 @@ "author": "teleportHQ",

"dependencies": {
"@teleporthq/teleport-shared": "^0.19.17",
"@teleporthq/teleport-types": "^0.19.17",
"@teleporthq/teleport-uidl-builders": "^0.19.17",
"@teleporthq/teleport-shared": "^0.19.19",
"@teleporthq/teleport-types": "^0.19.19",
"@teleporthq/teleport-uidl-builders": "^0.19.19",
"deepmerge": "^4.0.0"
},
"gitHead": "4af7375f20235273eeabb48ef109cab2a02ddceb"
"gitHead": "154a51920ecfcdec93d08b9db2911a2969b61d5c"
}

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

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