@teleporthq/teleport-plugin-react-base-component
Advanced tools
Comparing version 0.9.0 to 0.10.0-alpha.0
@@ -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"; |
@@ -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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
277560
512
+ Added@babel/runtime@7.26.9(transitive)
+ Added@teleporthq/teleport-shared@0.10.11(transitive)
+ Added@teleporthq/teleport-types@0.10.11(transitive)
+ Addedcss-vendor@2.0.8(transitive)
+ Addedcsstype@3.1.3(transitive)
+ Addedjss@10.10.0(transitive)
+ Addedjss-plugin-camel-case@10.10.0(transitive)
+ Addedjss-plugin-compose@10.10.0(transitive)
+ Addedjss-plugin-default-unit@10.10.0(transitive)
+ Addedjss-plugin-expand@10.10.0(transitive)
+ Addedjss-plugin-extend@10.10.0(transitive)
+ Addedjss-plugin-global@10.10.0(transitive)
+ Addedjss-plugin-nested@10.10.0(transitive)
+ Addedjss-plugin-props-sort@10.10.0(transitive)
+ Addedjss-plugin-rule-value-function@10.10.0(transitive)
+ Addedjss-plugin-rule-value-observable@10.10.0(transitive)
+ Addedjss-plugin-template@10.10.0(transitive)
+ Addedjss-plugin-vendor-prefixer@10.10.0(transitive)
+ Addedjss-preset-default@10.10.0(transitive)
+ Addedregenerator-runtime@0.14.1(transitive)
+ Addedtiny-warning@1.0.3(transitive)
- Removed@teleporthq/teleport-shared@0.9.0(transitive)
- Removed@teleporthq/teleport-types@0.9.0(transitive)
- Removedcss-vendor@0.3.8(transitive)
- Removedjs-tokens@4.0.0(transitive)
- Removedjss@9.8.7(transitive)
- Removedjss-camel-case@6.1.0(transitive)
- Removedjss-compose@5.0.0(transitive)
- Removedjss-default-unit@8.0.2(transitive)
- Removedjss-expand@5.3.0(transitive)
- Removedjss-extend@6.2.0(transitive)
- Removedjss-global@3.0.0(transitive)
- Removedjss-nested@6.0.1(transitive)
- Removedjss-preset-default@4.5.0(transitive)
- Removedjss-props-sort@6.0.0(transitive)
- Removedjss-template@1.0.1(transitive)
- Removedjss-vendor-prefixer@7.0.0(transitive)
- Removedloose-envify@1.4.0(transitive)
- Removedwarning@3.0.0(transitive)
Updated@babel/types@^7.5.5