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

@teleporthq/teleport-plugin-react-base-component

Package Overview
Dependencies
Maintainers
5
Versions
132
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@teleporthq/teleport-plugin-react-base-component - npm Package Compare versions

Comparing version 0.9.0 to 0.10.0-alpha.0

16

dist/cjs/constants.d.ts

@@ -1,16 +0,6 @@

export declare const REACT_LIBRARY_DEPENDENCY: {
type: string;
path: string;
version: string;
};
export declare const USE_STATE_DEPENDENCY: {
type: string;
path: string;
version: string;
meta: {
namedImport: boolean;
};
};
import { UIDLDependency } from '@teleporthq/teleport-types';
export declare const REACT_LIBRARY_DEPENDENCY: UIDLDependency;
export declare const USE_STATE_DEPENDENCY: UIDLDependency;
export declare const DEFAULT_COMPONENT_CHUNK_NAME = "jsx-component";
export declare const DEFAULT_EXPORT_CHUNK_NAME = "export";
export declare const DEFAULT_IMPORT_CHUNK_NAME = "import-local";

2

dist/cjs/index.js

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

jsxTagStructure = node_to_jsx_1.default(uidl.node, jsxParams, jsxOptions);
pureComponent = utils_1.createPureComponent(uidl.name, propDefinitions, stateDefinitions, jsxTagStructure, uidl.node.type);
pureComponent = utils_1.createPureComponent(uidl.name, stateDefinitions, jsxTagStructure);
structure.chunks.push({

@@ -79,0 +79,0 @@ type: constants_2.CHUNK_TYPE.AST,

import * as types from '@babel/types';
import { UIDLStateDefinition, UIDLPropDefinition } from '@teleporthq/teleport-types';
import { JSXRootReturnType } from '@teleporthq/teleport-shared/dist/cjs/node-handlers/node-to-jsx/types';
export declare const createPureComponent: (name: string, propDefinitions: Record<string, UIDLPropDefinition>, stateDefinitions: Record<string, UIDLStateDefinition>, jsxTagTree: JSXRootReturnType, nodeType: string, t?: typeof types) => types.VariableDeclaration;
import { UIDLStateDefinition } from '@teleporthq/teleport-types';
export declare const createPureComponent: (name: string, stateDefinitions: Record<string, UIDLStateDefinition>, jsxTagTree: types.JSXElement, t?: typeof types) => types.VariableDeclaration;

@@ -13,20 +13,5 @@ "use strict";

var string_utils_1 = require("@teleporthq/teleport-shared/dist/cjs/utils/string-utils");
exports.createPureComponent = function (name, propDefinitions, stateDefinitions, jsxTagTree, nodeType, t) {
exports.createPureComponent = function (name, stateDefinitions, jsxTagTree, t) {
if (t === void 0) { t = types; }
var arrowFunctionBody;
switch (nodeType) {
case 'static':
arrowFunctionBody = typeof jsxTagTree === 'string' && types.stringLiteral(jsxTagTree);
break;
case 'dynamic':
case 'conditional':
arrowFunctionBody =
Object.keys(stateDefinitions).length === 0
? jsxTagTree
: createReturnExpressionSyntax(stateDefinitions, jsxTagTree);
break;
default:
arrowFunctionBody = createReturnExpressionSyntax(stateDefinitions, jsxTagTree);
break;
}
var arrowFunctionBody = createReturnExpressionSyntax(stateDefinitions, jsxTagTree);
var arrowFunctionProps = [t.identifier('props')];

@@ -33,0 +18,0 @@ var arrowFunction = t.arrowFunctionExpression(arrowFunctionProps, arrowFunctionBody);

@@ -1,16 +0,6 @@

export declare const REACT_LIBRARY_DEPENDENCY: {
type: string;
path: string;
version: string;
};
export declare const USE_STATE_DEPENDENCY: {
type: string;
path: string;
version: string;
meta: {
namedImport: boolean;
};
};
import { UIDLDependency } from '@teleporthq/teleport-types';
export declare const REACT_LIBRARY_DEPENDENCY: UIDLDependency;
export declare const USE_STATE_DEPENDENCY: UIDLDependency;
export declare const DEFAULT_COMPONENT_CHUNK_NAME = "jsx-component";
export declare const DEFAULT_EXPORT_CHUNK_NAME = "export";
export declare const DEFAULT_IMPORT_CHUNK_NAME = "import-local";

@@ -36,3 +36,3 @@ import { createDefaultExport } from '@teleporthq/teleport-shared/dist/cjs/builders/ast-builders';

const jsxTagStructure = createJSXSyntax(uidl.node, jsxParams, jsxOptions);
const pureComponent = createPureComponent(uidl.name, propDefinitions, stateDefinitions, jsxTagStructure, uidl.node.type);
const pureComponent = createPureComponent(uidl.name, stateDefinitions, jsxTagStructure);
structure.chunks.push({

@@ -39,0 +39,0 @@ type: CHUNK_TYPE.AST,

import * as types from '@babel/types';
import { UIDLStateDefinition, UIDLPropDefinition } from '@teleporthq/teleport-types';
import { JSXRootReturnType } from '@teleporthq/teleport-shared/dist/cjs/node-handlers/node-to-jsx/types';
export declare const createPureComponent: (name: string, propDefinitions: Record<string, UIDLPropDefinition>, stateDefinitions: Record<string, UIDLStateDefinition>, jsxTagTree: JSXRootReturnType, nodeType: string, t?: typeof types) => types.VariableDeclaration;
import { UIDLStateDefinition } from '@teleporthq/teleport-types';
export declare const createPureComponent: (name: string, stateDefinitions: Record<string, UIDLStateDefinition>, jsxTagTree: types.JSXElement, t?: typeof types) => types.VariableDeclaration;
import * as types from '@babel/types';
import { convertValueToLiteral } from '@teleporthq/teleport-shared/dist/cjs/utils/ast-js-utils';
import { capitalize } from '@teleporthq/teleport-shared/dist/cjs/utils/string-utils';
export const createPureComponent = (name, propDefinitions, stateDefinitions, jsxTagTree, nodeType, t = types) => {
let arrowFunctionBody;
switch (nodeType) {
case 'static':
arrowFunctionBody = typeof jsxTagTree === 'string' && types.stringLiteral(jsxTagTree);
break;
case 'dynamic':
case 'conditional':
arrowFunctionBody =
Object.keys(stateDefinitions).length === 0
? jsxTagTree
: createReturnExpressionSyntax(stateDefinitions, jsxTagTree);
break;
default:
arrowFunctionBody = createReturnExpressionSyntax(stateDefinitions, jsxTagTree);
break;
}
export const createPureComponent = (name, stateDefinitions, jsxTagTree, t = types) => {
const arrowFunctionBody = createReturnExpressionSyntax(stateDefinitions, jsxTagTree);
const arrowFunctionProps = [t.identifier('props')];

@@ -22,0 +7,0 @@ const arrowFunction = t.arrowFunctionExpression(arrowFunctionProps, arrowFunctionBody);

{
"name": "@teleporthq/teleport-plugin-react-base-component",
"version": "0.9.0",
"version": "0.10.0-alpha.0",
"description": "A plugin for handling the skeleton/baseline of a React component",

@@ -28,7 +28,7 @@ "author": "teleportHQ",

"dependencies": {
"@babel/types": "^7.3.3",
"@teleporthq/teleport-shared": "^0.9.0",
"@teleporthq/teleport-types": "^0.9.0"
"@babel/types": "^7.5.5",
"@teleporthq/teleport-shared": "^0.10.0-alpha.0",
"@teleporthq/teleport-types": "^0.10.0-alpha.0"
},
"gitHead": "596c96d8a650d6a7a91d34e16e4d21b03db58096"
"gitHead": "480608bdc4929aff12210f6c4b994a6251fc2f6e"
}

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

export const REACT_LIBRARY_DEPENDENCY = {
import { UIDLDependency } from '@teleporthq/teleport-types'
export const REACT_LIBRARY_DEPENDENCY: UIDLDependency = {
type: 'library',

@@ -7,3 +9,3 @@ path: 'react',

export const USE_STATE_DEPENDENCY = {
export const USE_STATE_DEPENDENCY: UIDLDependency = {
type: 'library',

@@ -10,0 +12,0 @@ path: 'react',

@@ -65,9 +65,3 @@ import { createDefaultExport } from '@teleporthq/teleport-shared/dist/cjs/builders/ast-builders'

const pureComponent = createPureComponent(
uidl.name,
propDefinitions,
stateDefinitions,
jsxTagStructure,
uidl.node.type
)
const pureComponent = createPureComponent(uidl.name, stateDefinitions, jsxTagStructure)

@@ -74,0 +68,0 @@ structure.chunks.push({

@@ -5,36 +5,12 @@ import * as types from '@babel/types'

import { capitalize } from '@teleporthq/teleport-shared/dist/cjs/utils/string-utils'
import { UIDLStateDefinition, UIDLPropDefinition } from '@teleporthq/teleport-types'
import { UIDLStateDefinition } from '@teleporthq/teleport-types'
import { JSXRootReturnType } from '@teleporthq/teleport-shared/dist/cjs/node-handlers/node-to-jsx/types'
export const createPureComponent = (
name: string,
propDefinitions: Record<string, UIDLPropDefinition>,
stateDefinitions: Record<string, UIDLStateDefinition>,
jsxTagTree: JSXRootReturnType,
nodeType: string,
jsxTagTree: types.JSXElement,
t = types
): types.VariableDeclaration => {
let arrowFunctionBody: any
switch (nodeType) {
case 'static':
arrowFunctionBody = typeof jsxTagTree === 'string' && types.stringLiteral(jsxTagTree)
break
case 'dynamic':
case 'conditional':
arrowFunctionBody =
Object.keys(stateDefinitions).length === 0
? jsxTagTree
: createReturnExpressionSyntax(stateDefinitions, jsxTagTree as types.JSXElement)
break
default:
arrowFunctionBody = createReturnExpressionSyntax(
stateDefinitions,
jsxTagTree as types.JSXElement
)
break
}
const arrowFunctionBody = createReturnExpressionSyntax(stateDefinitions, jsxTagTree)
const arrowFunctionProps = [t.identifier('props')]
const arrowFunction = t.arrowFunctionExpression(arrowFunctionProps, arrowFunctionBody)

@@ -41,0 +17,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

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc