@teleporthq/teleport-plugin-react-base-component
Advanced tools
Comparing version
@@ -48,10 +48,9 @@ "use strict"; | ||
var reactComponentPlugin = function (structure) { return __awaiter(void 0, void 0, void 0, function () { | ||
var uidl, dependencies, options, projectContexts, projectResources, _a, stateDefinitions, _b, propDefinitions, nodesLookup, windowImports, jsxParams, jsxOptions, jsxTagStructure, componentName, pureComponent; | ||
var uidl, dependencies, _a, stateDefinitions, _b, propDefinitions, nodesLookup, windowImports, jsxParams, jsxOptions, jsxTagStructure, componentName, pureComponent; | ||
return __generator(this, function (_c) { | ||
uidl = structure.uidl, dependencies = structure.dependencies, options = structure.options; | ||
projectContexts = options.projectContexts, projectResources = options.projectResources; | ||
uidl = structure.uidl, dependencies = structure.dependencies; | ||
_a = uidl.stateDefinitions, stateDefinitions = _a === void 0 ? {} : _a, _b = uidl.propDefinitions, propDefinitions = _b === void 0 ? {} : _b; | ||
dependencies.React = constants_1.REACT_LIBRARY_DEPENDENCY; | ||
if (Object.keys(stateDefinitions).length > 0) { | ||
dependencies.useState = teleport_shared_1.Constants.USE_STATE_DEPENDENCY; | ||
dependencies.useState = constants_1.USE_STATE_DEPENDENCY; | ||
} | ||
@@ -65,4 +64,2 @@ nodesLookup = {}; | ||
dependencies: dependencies, | ||
projectContexts: projectContexts, | ||
projectResources: projectResources, | ||
windowImports: windowImports, | ||
@@ -75,3 +72,2 @@ }; | ||
local: '', | ||
ctx: '', | ||
}, | ||
@@ -87,3 +83,3 @@ dependencyHandling: 'import', | ||
if (Object.keys(windowImports).length) { | ||
dependencies.useEffect = teleport_shared_1.Constants.USE_STATE_DEPENDENCY; | ||
dependencies.useEffect = constants_1.USE_STATE_DEPENDENCY; | ||
} | ||
@@ -90,0 +86,0 @@ structure.chunks.push({ |
@@ -38,17 +38,16 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { createDOMInjectionNode } from './utils'; | ||
import { Constants, UIDLUtils } from '@teleporthq/teleport-shared'; | ||
import { UIDLUtils } from '@teleporthq/teleport-shared'; | ||
import { createJSXSyntax, ASTBuilders, ASTUtils, } from '@teleporthq/teleport-plugin-common'; | ||
import { ChunkType, FileType, } from '@teleporthq/teleport-types'; | ||
import { DEFAULT_COMPONENT_CHUNK_NAME, DEFAULT_EXPORT_CHUNK_NAME, DEFAULT_IMPORT_CHUNK_NAME, REACT_LIBRARY_DEPENDENCY, } from './constants'; | ||
import { DEFAULT_COMPONENT_CHUNK_NAME, DEFAULT_EXPORT_CHUNK_NAME, DEFAULT_IMPORT_CHUNK_NAME, REACT_LIBRARY_DEPENDENCY, USE_STATE_DEPENDENCY, } from './constants'; | ||
export var createReactComponentPlugin = function (config) { | ||
var _a = config || {}, _b = _a.componentChunkName, componentChunkName = _b === void 0 ? DEFAULT_COMPONENT_CHUNK_NAME : _b, _c = _a.exportChunkName, exportChunkName = _c === void 0 ? DEFAULT_EXPORT_CHUNK_NAME : _c, _d = _a.importChunkName, importChunkName = _d === void 0 ? DEFAULT_IMPORT_CHUNK_NAME : _d; | ||
var reactComponentPlugin = function (structure) { return __awaiter(void 0, void 0, void 0, function () { | ||
var uidl, dependencies, options, projectContexts, projectResources, _a, stateDefinitions, _b, propDefinitions, nodesLookup, windowImports, jsxParams, jsxOptions, jsxTagStructure, componentName, pureComponent; | ||
var uidl, dependencies, _a, stateDefinitions, _b, propDefinitions, nodesLookup, windowImports, jsxParams, jsxOptions, jsxTagStructure, componentName, pureComponent; | ||
return __generator(this, function (_c) { | ||
uidl = structure.uidl, dependencies = structure.dependencies, options = structure.options; | ||
projectContexts = options.projectContexts, projectResources = options.projectResources; | ||
uidl = structure.uidl, dependencies = structure.dependencies; | ||
_a = uidl.stateDefinitions, stateDefinitions = _a === void 0 ? {} : _a, _b = uidl.propDefinitions, propDefinitions = _b === void 0 ? {} : _b; | ||
dependencies.React = REACT_LIBRARY_DEPENDENCY; | ||
if (Object.keys(stateDefinitions).length > 0) { | ||
dependencies.useState = Constants.USE_STATE_DEPENDENCY; | ||
dependencies.useState = USE_STATE_DEPENDENCY; | ||
} | ||
@@ -62,4 +61,2 @@ nodesLookup = {}; | ||
dependencies: dependencies, | ||
projectContexts: projectContexts, | ||
projectResources: projectResources, | ||
windowImports: windowImports, | ||
@@ -72,3 +69,2 @@ }; | ||
local: '', | ||
ctx: '', | ||
}, | ||
@@ -84,3 +80,3 @@ dependencyHandling: 'import', | ||
if (Object.keys(windowImports).length) { | ||
dependencies.useEffect = Constants.USE_STATE_DEPENDENCY; | ||
dependencies.useEffect = USE_STATE_DEPENDENCY; | ||
} | ||
@@ -87,0 +83,0 @@ structure.chunks.push({ |
{ | ||
"name": "@teleporthq/teleport-plugin-react-base-component", | ||
"version": "0.27.3-alpha.3", | ||
"version": "0.27.3", | ||
"description": "A plugin for handling the skeleton/baseline of a React component", | ||
@@ -28,7 +28,7 @@ "author": "teleportHQ", | ||
"@babel/types": "^7.5.5", | ||
"@teleporthq/teleport-plugin-common": "^0.27.3-alpha.3", | ||
"@teleporthq/teleport-shared": "^0.27.3-alpha.3", | ||
"@teleporthq/teleport-types": "^0.27.3-alpha.3" | ||
"@teleporthq/teleport-plugin-common": "^0.27.3", | ||
"@teleporthq/teleport-shared": "^0.27.3", | ||
"@teleporthq/teleport-types": "^0.27.3" | ||
}, | ||
"gitHead": "776fa2beea05204929e2ef93ab70aa619fe7b0e3" | ||
"gitHead": "14f69b861cb0838d502a5ba226bb7cb5c1291fbb" | ||
} |
import { createDOMInjectionNode } from './utils' | ||
import { Constants, UIDLUtils } from '@teleporthq/teleport-shared' | ||
import { UIDLUtils } from '@teleporthq/teleport-shared' | ||
import { | ||
@@ -23,2 +23,3 @@ createJSXSyntax, | ||
REACT_LIBRARY_DEPENDENCY, | ||
USE_STATE_DEPENDENCY, | ||
} from './constants' | ||
@@ -40,4 +41,3 @@ | ||
const reactComponentPlugin: ComponentPlugin = async (structure) => { | ||
const { uidl, dependencies, options } = structure | ||
const { projectContexts, projectResources } = options | ||
const { uidl, dependencies } = structure | ||
const { stateDefinitions = {}, propDefinitions = {} } = uidl | ||
@@ -48,3 +48,3 @@ | ||
if (Object.keys(stateDefinitions).length > 0) { | ||
dependencies.useState = Constants.USE_STATE_DEPENDENCY | ||
dependencies.useState = USE_STATE_DEPENDENCY | ||
} | ||
@@ -62,4 +62,2 @@ | ||
dependencies, | ||
projectContexts, | ||
projectResources, | ||
windowImports, | ||
@@ -73,3 +71,2 @@ } | ||
local: '', | ||
ctx: '', | ||
}, | ||
@@ -93,3 +90,3 @@ dependencyHandling: 'import', | ||
if (Object.keys(windowImports).length) { | ||
dependencies.useEffect = Constants.USE_STATE_DEPENDENCY | ||
dependencies.useEffect = USE_STATE_DEPENDENCY | ||
} | ||
@@ -96,0 +93,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
78392
-1.86%541
-1.99%