@goji/core
Advanced tools
Comparing version 0.4.6 to 0.4.7
import { Adaptor, AdaptorType, ExportComponentMeta } from './common'; | ||
import { GojiTarget } from '../constants'; | ||
export * from './common'; | ||
declare type TARGET = 'wechat' | 'baidu' | 'alipay' | 'toutiao'; | ||
export declare const createAdaptor: (type: AdaptorType, target: TARGET, exportMeta?: ExportComponentMeta) => Adaptor; | ||
export declare const createAdaptor: (type: AdaptorType, target: GojiTarget, exportMeta?: ExportComponentMeta) => Adaptor; |
export declare const TYPE_TEXT = "GOJI_TYPE_TEXT"; | ||
export declare const TYPE_SUBTREE = "GOJI_TYPE_SUBTREE"; | ||
export declare type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao'; | ||
export declare const GOJI_TARGET: GojiTarget; | ||
interface SimplifyComponent { | ||
@@ -4,0 +6,0 @@ name: string; |
@@ -5,2 +5,3 @@ "use strict"; | ||
exports.TYPE_SUBTREE = 'GOJI_TYPE_SUBTREE'; | ||
exports.GOJI_TARGET = process.env.GOJI_TARGET || 'wechat'; | ||
exports.SIMPLIFY_COMPONENTS = [ | ||
@@ -7,0 +8,0 @@ { |
@@ -13,3 +13,3 @@ /// <reference types="react" /> | ||
export * from './portal'; | ||
export { SIMPLIFY_COMPONENTS as unstable_SIMPLIFY_COMPONENTS } from './constants'; | ||
export { SIMPLIFY_COMPONENTS as unstable_SIMPLIFY_COMPONENTS, GojiTarget } from './constants'; | ||
export { gojiEvents } from './events'; |
@@ -10,2 +10,3 @@ "use strict"; | ||
const portal_1 = require("./portal"); | ||
const constants_1 = require("./constants"); | ||
const DEFAULT_RENDER_OPTIONS = { | ||
@@ -20,4 +21,3 @@ type: 'page', | ||
}; | ||
// FIXME: use process.env.TARGET | ||
const adaptor = adaptor_1.createAdaptor(type, 'wechat', exportMeta); | ||
const adaptor = adaptor_1.createAdaptor(type, constants_1.GOJI_TARGET, exportMeta); | ||
return adaptor.run(element, container_1.Container); | ||
@@ -37,6 +37,6 @@ }; | ||
// eslint-disable-next-line camelcase | ||
var constants_1 = require("./constants"); | ||
exports.unstable_SIMPLIFY_COMPONENTS = constants_1.SIMPLIFY_COMPONENTS; | ||
var constants_2 = require("./constants"); | ||
exports.unstable_SIMPLIFY_COMPONENTS = constants_2.SIMPLIFY_COMPONENTS; | ||
var events_1 = require("./events"); | ||
exports.gojiEvents = events_1.gojiEvents; | ||
//# sourceMappingURL=index.js.map |
@@ -5,4 +5,3 @@ "use strict"; | ||
const constants_1 = require("./constants"); | ||
// FIXME: use process.env.TARGET to support other platform | ||
const useFlattenBridge = true; | ||
const useFlattenBridge = constants_1.GOJI_TARGET === 'wechat'; | ||
exports.Subtree = (props) => { | ||
@@ -9,0 +8,0 @@ return react_1.createElement(useFlattenBridge ? constants_1.TYPE_SUBTREE : react_1.Fragment, props); |
import { Adaptor, AdaptorType, ExportComponentMeta } from './common'; | ||
import { GojiTarget } from '../constants'; | ||
export * from './common'; | ||
declare type TARGET = 'wechat' | 'baidu' | 'alipay' | 'toutiao'; | ||
export declare const createAdaptor: (type: AdaptorType, target: TARGET, exportMeta?: ExportComponentMeta) => Adaptor; | ||
export declare const createAdaptor: (type: AdaptorType, target: GojiTarget, exportMeta?: ExportComponentMeta) => Adaptor; |
export declare const TYPE_TEXT = "GOJI_TYPE_TEXT"; | ||
export declare const TYPE_SUBTREE = "GOJI_TYPE_SUBTREE"; | ||
export declare type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao'; | ||
export declare const GOJI_TARGET: GojiTarget; | ||
interface SimplifyComponent { | ||
@@ -4,0 +6,0 @@ name: string; |
export const TYPE_TEXT = 'GOJI_TYPE_TEXT'; | ||
export const TYPE_SUBTREE = 'GOJI_TYPE_SUBTREE'; | ||
export const GOJI_TARGET = process.env.GOJI_TARGET || 'wechat'; | ||
export const SIMPLIFY_COMPONENTS = [ | ||
@@ -4,0 +5,0 @@ { |
@@ -13,3 +13,3 @@ /// <reference types="react" /> | ||
export * from './portal'; | ||
export { SIMPLIFY_COMPONENTS as unstable_SIMPLIFY_COMPONENTS } from './constants'; | ||
export { SIMPLIFY_COMPONENTS as unstable_SIMPLIFY_COMPONENTS, GojiTarget } from './constants'; | ||
export { gojiEvents } from './events'; |
@@ -5,2 +5,3 @@ import { useContext } from 'react'; | ||
import { PortalContext } from './portal'; | ||
import { GOJI_TARGET } from './constants'; | ||
const DEFAULT_RENDER_OPTIONS = { | ||
@@ -15,4 +16,3 @@ type: 'page', | ||
}; | ||
// FIXME: use process.env.TARGET | ||
const adaptor = createAdaptor(type, 'wechat', exportMeta); | ||
const adaptor = createAdaptor(type, GOJI_TARGET, exportMeta); | ||
return adaptor.run(element, Container); | ||
@@ -19,0 +19,0 @@ }; |
import { createElement, Fragment } from 'react'; | ||
import { TYPE_SUBTREE } from './constants'; | ||
// FIXME: use process.env.TARGET to support other platform | ||
const useFlattenBridge = true; | ||
import { TYPE_SUBTREE, GOJI_TARGET } from './constants'; | ||
const useFlattenBridge = GOJI_TARGET === 'wechat'; | ||
export const Subtree = (props) => { | ||
@@ -6,0 +5,0 @@ return createElement(useFlattenBridge ? TYPE_SUBTREE : Fragment, props); |
{ | ||
"name": "@goji/core", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "Goji Core", | ||
@@ -79,3 +79,3 @@ "main": "dist/cjs/index.js", | ||
}, | ||
"gitHead": "9330aa82e7bfe1ce08f31f5833eab4e7641f4b0d" | ||
"gitHead": "2041f9be276cd87a347c0a619f3052499feed954" | ||
} |
import { WeChatAdaptor } from './wechat'; | ||
import { Adaptor, AdaptorType, ExportComponentMeta } from './common'; | ||
import { GojiTarget } from '../constants'; | ||
export * from './common'; | ||
type TARGET = 'wechat' | 'baidu' | 'alipay' | 'toutiao'; | ||
export const createAdaptor = ( | ||
type: AdaptorType, | ||
target: TARGET, | ||
target: GojiTarget, | ||
exportMeta: ExportComponentMeta = {}, | ||
@@ -12,0 +11,0 @@ ): Adaptor => { |
export const TYPE_TEXT = 'GOJI_TYPE_TEXT'; | ||
export const TYPE_SUBTREE = 'GOJI_TYPE_SUBTREE'; | ||
export type GojiTarget = 'wechat' | 'baidu' | 'alipay' | 'toutiao'; | ||
export const GOJI_TARGET: GojiTarget = (process.env.GOJI_TARGET as GojiTarget) || 'wechat'; | ||
interface SimplifyComponent { | ||
@@ -5,0 +9,0 @@ name: string; |
@@ -5,2 +5,3 @@ import { useContext } from 'react'; | ||
import { PortalContext } from './portal'; | ||
import { GOJI_TARGET } from './constants'; | ||
@@ -22,4 +23,3 @@ interface RenderOptions { | ||
}; | ||
// FIXME: use process.env.TARGET | ||
const adaptor = createAdaptor(type, 'wechat', exportMeta); | ||
const adaptor = createAdaptor(type, GOJI_TARGET, exportMeta); | ||
return adaptor.run(element, Container); | ||
@@ -40,3 +40,3 @@ }; | ||
// eslint-disable-next-line camelcase | ||
export { SIMPLIFY_COMPONENTS as unstable_SIMPLIFY_COMPONENTS } from './constants'; | ||
export { SIMPLIFY_COMPONENTS as unstable_SIMPLIFY_COMPONENTS, GojiTarget } from './constants'; | ||
export { gojiEvents } from './events'; |
import React, { createElement, Fragment, CSSProperties } from 'react'; | ||
import { TYPE_SUBTREE } from './constants'; | ||
import { TYPE_SUBTREE, GOJI_TARGET } from './constants'; | ||
// FIXME: use process.env.TARGET to support other platform | ||
const useFlattenBridge = true; | ||
const useFlattenBridge = GOJI_TARGET === 'wechat'; | ||
@@ -7,0 +6,0 @@ export const Subtree = ( |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
203078
4003