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

@teleporthq/teleport-shared

Package Overview
Dependencies
Maintainers
4
Versions
116
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teleporthq/teleport-shared - npm Package Compare versions

Comparing version

to
0.26.5

dist/cjs/constants/index.d.ts.map

37

__tests__/utils/uidl-utils.ts

@@ -458,13 +458,38 @@ import {

describe('prefixAssetsPath', () => {
it('returns the original string if the assets identifier is not found', () => {
expect(prefixAssetsPath('/static', '/no/identifier')).toBe('/no/identifier')
it('returns the concatenated path and adds a slash', () => {
expect(
prefixAssetsPath('/kitten.png', {
prefix: '/static',
identifier: 'playground_assets',
mappings: { 'kitten.png': '' },
})
).toBe('/static/playground_assets/kitten.png')
})
it('returns the concatenated path', () => {
expect(prefixAssetsPath('/static', '/playground_assets')).toBe('/static/playground_assets')
it('returns the original string appended with custom path for the asset', () => {
expect(
prefixAssetsPath('/kitten.png', {
prefix: '/no',
identifier: 'identifier',
mappings: { 'kitten.png': 'custom' },
})
).toBe('/no/identifier/custom/kitten.png')
})
it('returns the concatenated path and adds a slash', () => {
expect(prefixAssetsPath('/static', 'playground_assets')).toBe('/static/playground_assets')
it('returns the original string appended with custom path for the asset without identifier', () => {
expect(
prefixAssetsPath('/kitten.png', {
prefix: '/noidentifier',
mappings: { 'kitten.png': 'custom' },
})
).toBe('/noidentifier/custom/kitten.png')
})
it('returns the original string appended with prefix without identifier', () => {
expect(
prefixAssetsPath('/kitten.png', {
prefix: '/noidentifier',
})
).toBe('/noidentifier/kitten.png')
})
})

@@ -471,0 +496,0 @@

import { PrettierFormatOptions } from '@teleporthq/teleport-types';
export declare const ASSETS_IDENTIFIER = "playground_assets";
export declare const PRETTIER_CONFIG: PrettierFormatOptions;
//# sourceMappingURL=index.d.ts.map

@@ -5,1 +5,2 @@ import * as Constants from './constants';

export { Constants, StringUtils, UIDLUtils };
//# sourceMappingURL=index.d.ts.map

@@ -12,1 +12,2 @@ export declare const camelCaseToDashCase: (str: string) => string;

export declare const generateCSSVariableName: (name: string) => string;
//# sourceMappingURL=string-utils.d.ts.map

5

dist/cjs/utils/uidl-utils.d.ts

@@ -1,2 +0,2 @@

import { ComponentUIDL, UIDLStyleDefinitions, UIDLConditionalNode, UIDLElement, UIDLNode, UIDLStaticValue, UIDLAttributeValue, UIDLDynamicReference, UIDLRepeatContent, UIDLRepeatMeta, UIDLElementNode, UIDLDependency, UIDLStyleValue, UIDLStyleSheetContent, UIDLComponentStyleReference, UIDLRootComponent } from '@teleporthq/teleport-types';
import { ComponentUIDL, UIDLStyleDefinitions, UIDLConditionalNode, UIDLElement, UIDLNode, UIDLStaticValue, UIDLAttributeValue, UIDLDynamicReference, UIDLRepeatContent, UIDLRepeatMeta, UIDLElementNode, UIDLDependency, UIDLStyleValue, UIDLStyleSheetContent, UIDLComponentStyleReference, UIDLRootComponent, GeneratorOptions } from '@teleporthq/teleport-types';
export declare const extractRoutes: (rootComponent: UIDLRootComponent) => UIDLConditionalNode[];

@@ -14,3 +14,3 @@ export declare const createWebComponentFriendlyName: (componentName: string) => string;

};
export declare const prefixAssetsPath: (prefix: string, originalString: string | undefined) => string;
export declare const prefixAssetsPath: (originalString: string | undefined, assets?: GeneratorOptions['assets']) => string;
export declare const cloneObject: <T>(node: T) => T;

@@ -44,1 +44,2 @@ export declare const traverseNodes: (node: UIDLNode | UIDLComponentStyleReference, fn: (node: UIDLNode | UIDLComponentStyleReference, parentNode: UIDLNode) => void, parent?: UIDLNode | null) => void;

export {};
//# sourceMappingURL=uidl-utils.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.extractExternalDependencies = exports.removeChildNodes = exports.findFirstElementNode = exports.transformAttributesAssignmentsToJson = exports.transformStylesAssignmentsToJson = exports.transformStringAssignmentToJson = exports.transformDynamicStyles = exports.cleanupDynamicStyles = exports.splitDynamicAndStaticStyles = exports.traverseRepeats = exports.traverseElements = exports.traverseNodes = exports.cloneObject = exports.prefixAssetsPath = exports.getRepeatIteratorNameAndKey = exports.getComponentClassName = exports.getComponentFolderPath = exports.getTemplateFileName = exports.getStyleFileName = exports.getComponentFileName = exports.setFriendlyOutputOptions = exports.createWebComponentFriendlyName = exports.extractRoutes = void 0;
var constants_1 = require("../constants");
var string_utils_1 = require("./string-utils");
var path_1 = require("path");
var extractRoutes = function (rootComponent) {

@@ -93,10 +93,27 @@ // Assuming root element starts with a UIDLElementNode

exports.getRepeatIteratorNameAndKey = getRepeatIteratorNameAndKey;
var prefixAssetsPath = function (prefix, originalString) {
if (!originalString || !originalString.includes(constants_1.ASSETS_IDENTIFIER)) {
var prefixAssetsPath = function (originalString, assets) {
if (assets === void 0) { assets = {}; }
if (!originalString) {
return originalString;
}
if (originalString.startsWith('/')) {
return prefix + originalString;
if (!originalString.startsWith('/')) {
return originalString;
}
return "".concat(prefix, "/").concat(originalString);
var prefix = assets.prefix, _a = assets.mappings, mappings = _a === void 0 ? {} : _a, identifier = assets.identifier;
var assetName = (0, path_1.basename)(originalString);
/*
If the value is missing from the mapping, it means
- asset is missing in the project packer
- It's not a asset and so we don't need to provide any mapping for it
*/
if (!mappings[assetName]) {
if (!identifier) {
return [prefix, assetName].join('/');
}
return [prefix, identifier, assetName].join('/');
}
if (!identifier) {
return [prefix, mappings[assetName], assetName].join('/');
}
return [prefix, identifier, mappings[assetName], assetName].join('/');
};

@@ -103,0 +120,0 @@ exports.prefixAssetsPath = prefixAssetsPath;

import { PrettierFormatOptions } from '@teleporthq/teleport-types';
export declare const ASSETS_IDENTIFIER = "playground_assets";
export declare const PRETTIER_CONFIG: PrettierFormatOptions;
//# sourceMappingURL=index.d.ts.map

@@ -5,1 +5,2 @@ import * as Constants from './constants';

export { Constants, StringUtils, UIDLUtils };
//# sourceMappingURL=index.d.ts.map

@@ -12,1 +12,2 @@ export declare const camelCaseToDashCase: (str: string) => string;

export declare const generateCSSVariableName: (name: string) => string;
//# sourceMappingURL=string-utils.d.ts.map

@@ -1,2 +0,2 @@

import { ComponentUIDL, UIDLStyleDefinitions, UIDLConditionalNode, UIDLElement, UIDLNode, UIDLStaticValue, UIDLAttributeValue, UIDLDynamicReference, UIDLRepeatContent, UIDLRepeatMeta, UIDLElementNode, UIDLDependency, UIDLStyleValue, UIDLStyleSheetContent, UIDLComponentStyleReference, UIDLRootComponent } from '@teleporthq/teleport-types';
import { ComponentUIDL, UIDLStyleDefinitions, UIDLConditionalNode, UIDLElement, UIDLNode, UIDLStaticValue, UIDLAttributeValue, UIDLDynamicReference, UIDLRepeatContent, UIDLRepeatMeta, UIDLElementNode, UIDLDependency, UIDLStyleValue, UIDLStyleSheetContent, UIDLComponentStyleReference, UIDLRootComponent, GeneratorOptions } from '@teleporthq/teleport-types';
export declare const extractRoutes: (rootComponent: UIDLRootComponent) => UIDLConditionalNode[];

@@ -14,3 +14,3 @@ export declare const createWebComponentFriendlyName: (componentName: string) => string;

};
export declare const prefixAssetsPath: (prefix: string, originalString: string | undefined) => string;
export declare const prefixAssetsPath: (originalString: string | undefined, assets?: GeneratorOptions['assets']) => string;
export declare const cloneObject: <T>(node: T) => T;

@@ -44,1 +44,2 @@ export declare const traverseNodes: (node: UIDLNode | UIDLComponentStyleReference, fn: (node: UIDLNode | UIDLComponentStyleReference, parentNode: UIDLNode) => void, parent?: UIDLNode | null) => void;

export {};
//# sourceMappingURL=uidl-utils.d.ts.map

@@ -1,3 +0,3 @@

import { ASSETS_IDENTIFIER } from '../constants';
import { camelCaseToDashCase, removeIllegalCharacters, dashCaseToUpperCamelCase, } from './string-utils';
import { basename } from 'path';
export var extractRoutes = function (rootComponent) {

@@ -81,10 +81,27 @@ // Assuming root element starts with a UIDLElementNode

};
export var prefixAssetsPath = function (prefix, originalString) {
if (!originalString || !originalString.includes(ASSETS_IDENTIFIER)) {
export var prefixAssetsPath = function (originalString, assets) {
if (assets === void 0) { assets = {}; }
if (!originalString) {
return originalString;
}
if (originalString.startsWith('/')) {
return prefix + originalString;
if (!originalString.startsWith('/')) {
return originalString;
}
return "".concat(prefix, "/").concat(originalString);
var prefix = assets.prefix, _a = assets.mappings, mappings = _a === void 0 ? {} : _a, identifier = assets.identifier;
var assetName = basename(originalString);
/*
If the value is missing from the mapping, it means
- asset is missing in the project packer
- It's not a asset and so we don't need to provide any mapping for it
*/
if (!mappings[assetName]) {
if (!identifier) {
return [prefix, assetName].join('/');
}
return [prefix, identifier, assetName].join('/');
}
if (!identifier) {
return [prefix, mappings[assetName], assetName].join('/');
}
return [prefix, identifier, mappings[assetName], assetName].join('/');
};

@@ -91,0 +108,0 @@ // Clones existing objects while keeping the type cast

{
"name": "@teleporthq/teleport-shared",
"version": "0.26.0",
"version": "0.26.5",
"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.0",
"@teleporthq/teleport-types": "^0.26.5",
"jss": "^10.0.0",
"jss-preset-default": "^10.0.0"
},
"gitHead": "702881894b97ccf5a40c93b1735d108d413424b6"
"gitHead": "564e726c5481e2b39e16e79b76319aa72d12bbb5"
}

@@ -1,2 +0,1 @@

import { ASSETS_IDENTIFIER } from '../constants'
import {

@@ -24,3 +23,5 @@ camelCaseToDashCase,

UIDLRootComponent,
GeneratorOptions,
} from '@teleporthq/teleport-types'
import { basename } from 'path'

@@ -123,12 +124,34 @@ export const extractRoutes = (rootComponent: UIDLRootComponent) => {

export const prefixAssetsPath = (prefix: string, originalString: string | undefined) => {
if (!originalString || !originalString.includes(ASSETS_IDENTIFIER)) {
export const prefixAssetsPath = (
originalString: string | undefined,
assets: GeneratorOptions['assets'] = {}
) => {
if (!originalString) {
return originalString
}
if (originalString.startsWith('/')) {
return prefix + originalString
if (!originalString.startsWith('/')) {
return originalString
}
return `${prefix}/${originalString}`
const { prefix, mappings = {}, identifier } = assets
const assetName = basename(originalString)
/*
If the value is missing from the mapping, it means
- asset is missing in the project packer
- It's not a asset and so we don't need to provide any mapping for it
*/
if (!mappings[assetName]) {
if (!identifier) {
return [prefix, assetName].join('/')
}
return [prefix, identifier, assetName].join('/')
}
if (!identifier) {
return [prefix, mappings[assetName], assetName].join('/')
}
return [prefix, identifier, mappings[assetName], assetName].join('/')
}

@@ -135,0 +158,0 @@

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