-
Notifications
You must be signed in to change notification settings - Fork 816
Async rendering API and "pure" image fetching #472
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lordofthelake
wants to merge
50
commits into
airbnb:master
Choose a base branch
from
compositive:pure-make-image-from-url-implementation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 16 commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
a69b850
Transpile to ES2017 to avoid regenerator-runtime for now
lordofthelake 042fdae
Use weakRequire instead of ad-hoc evals
lordofthelake 22b7f60
Make everything async
lordofthelake 2968a64
Add getImageDataFromURL() implementation using fetch
lordofthelake 1ad2d17
Split the bridges in their own objects
lordofthelake dfd88c9
Change the interface of getSketchVersion()
lordofthelake 08d1a2e
Use strong imports in NodeMacOSBridge
lordofthelake f9c83a9
Add PlatformBridge injection everywhere
lordofthelake 67fc4ce
Group together files by method instead than by implementation
lordofthelake 6d6c801
Rename the *SJSON functions
lordofthelake 5bae926
Don't use the console in prodution
lordofthelake d849c9b
Reorganize exports
lordofthelake b8bc142
Split entrypoints by platform
lordofthelake 2d063e6
Change the bridge injection for TextStyles
lordofthelake 0dbd5b0
Use a dynamic import instead of weakRequire
lordofthelake 12dd68c
Fix compilation errors
lordofthelake 435bce2
Move back StyleSheet -> stylesheet
lordofthelake 65e011d
Fix the test suite
lordofthelake 9c82687
Add multiple entrypoints in package.json
lordofthelake b267fcd
Add the node-fetch dependency
lordofthelake 8e6b485
Revert targeting es5
lordofthelake 7bacf27
Update @skpm/builder everywhere
lordofthelake 48766e4
Add implementation to read from file: protocol
lordofthelake 8d6d1ff
Add TODO about moving the bridge out
lordofthelake 414c845
Merge branch 'master' of github.com:compositive/react-sketchapp into …
lordofthelake a0a9012
Fix types to work with strict
lordofthelake 87b175a
Use static platform switching
lordofthelake 13ee09d
Don't account for skpm-fetch peculiarities
lordofthelake f88bd56
Add npm build to Travis to check whether the types work
lordofthelake f143562
Add sideEffects flag to allow tree shaking
lordofthelake 87ff628
Revert changes to getSketchVersion()
lordofthelake 5adf6b5
Revert changes to logging
lordofthelake a6ddb65
Revert adding extra scripts to examples/profile-cards
lordofthelake 7c41cf6
Revert renaming the *SJON functions
lordofthelake d5a3f26
Start documenting changes
lordofthelake 215adec
Update TypeScript version
lordofthelake 7c6c02f
Merge branch 'master' of github.com:airbnb/react-sketchapp into pure-…
lordofthelake cadae33
Fix the TypeScript errors
lordofthelake bc20d9d
Update API docs
lordofthelake c0b681d
Clean up left-overs of refactors already implemented
lordofthelake 8708fc2
Correct the link to the `PlatformBridge` type
lordofthelake 55b2c3d
Disable node_modules cache
lordofthelake 9cbae7b
Forcibly clean the cached node_modules
lordofthelake 8b02a46
Remove footnote in `API.md`
lordofthelake 79fec51
Merge branch 'master' into pure-make-image-from-url-implementation
lordofthelake 21e52ee
Update Travis config and npm
lordofthelake 451cadb
Merge branch 'pure-make-image-from-url-implementation' of github.com:…
lordofthelake 7c6da8e
Change the compile target to `es2017` in tsconfig.json
lordofthelake abffbba
Don't use the npm cache
lordofthelake 2bc1bf6
Add libraries for retrocompatibility
lordofthelake File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export { default as Document } from './Document'; | ||
export { default as Page } from './Page'; | ||
export { default as Artboard } from './Artboard'; | ||
export { default as Image } from './Image'; | ||
export { default as RedBox } from './RedBox'; | ||
export { default as Svg } from './Svg'; | ||
export { default as View } from './View'; | ||
export { default as Text } from './Text'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
export { default as Platform } from './Platform'; | ||
export { default as StyleSheet } from './StyleSheet'; | ||
export * from './components'; | ||
export { getSymbolComponentByName, getSymbolMasterByName, injectSymbols } from './symbol'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { default as _render } from './render'; | ||
import { default as _renderToJSON } from './renderToJSON'; | ||
import { makeSymbol as _makeSymbol, SymbolMasterProps } from './symbol'; | ||
import { | ||
SketchLayer, | ||
WrappedSketchLayer, | ||
PlatformBridge, | ||
SketchDocumentData, | ||
WrappedSketchDocument, | ||
SketchDocument, | ||
} from './types'; | ||
import { FileFormat1 as FileFormat } from '@sketch-hq/sketch-file-format-ts'; | ||
import { default as _TextStyles } from './sharedStyles/TextStyles'; | ||
|
||
function getDefaultPlatformBridge() { | ||
return require('./platformBridges/NodeMacOSBridge'); | ||
} | ||
|
||
export async function render( | ||
element: React.ReactElement, | ||
container?: SketchLayer | WrappedSketchLayer, | ||
platformBridge: PlatformBridge = getDefaultPlatformBridge(), | ||
): Promise<SketchLayer | Array<SketchLayer>> { | ||
return _render(element, container, platformBridge); | ||
} | ||
|
||
export async function renderToJSON( | ||
element: React.ReactElement, | ||
platformBridge: PlatformBridge = getDefaultPlatformBridge(), | ||
): Promise<FileFormat.AnyLayer> { | ||
return _renderToJSON(element, platformBridge); | ||
} | ||
|
||
export async function makeSymbol( | ||
Component: React.ComponentType<any>, | ||
symbolProps?: string | SymbolMasterProps, | ||
document?: SketchDocumentData | SketchDocument | WrappedSketchDocument, | ||
bridge: PlatformBridge = getDefaultPlatformBridge(), | ||
) { | ||
return _makeSymbol(Component, symbolProps, document, bridge); | ||
} | ||
|
||
export const TextStyles = _TextStyles(getDefaultPlatformBridge); | ||
|
||
export * from './index.common'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { default as _render } from './render'; | ||
import { default as _renderToJSON } from './renderToJSON'; | ||
import { makeSymbol as _makeSymbol, SymbolMasterProps } from './symbol'; | ||
import { | ||
SketchLayer, | ||
WrappedSketchLayer, | ||
PlatformBridge, | ||
SketchDocumentData, | ||
WrappedSketchDocument, | ||
SketchDocument, | ||
} from './types'; | ||
import { FileFormat1 as FileFormat } from '@sketch-hq/sketch-file-format-ts'; | ||
import { default as _TextStyles } from './sharedStyles/TextStyles'; | ||
import SketchBridge from './platformBridges/SketchBridge'; | ||
|
||
export async function render( | ||
element: React.ReactElement, | ||
container?: SketchLayer | WrappedSketchLayer, | ||
platformBridge: PlatformBridge = SketchBridge, | ||
): Promise<SketchLayer | Array<SketchLayer>> { | ||
return _render(element, container, platformBridge); | ||
} | ||
|
||
export async function renderToJSON( | ||
element: React.ReactElement, | ||
platformBridge: PlatformBridge = SketchBridge, | ||
): Promise<FileFormat.AnyLayer> { | ||
return _renderToJSON(element, platformBridge); | ||
} | ||
|
||
export async function makeSymbol( | ||
Component: React.ComponentType<any>, | ||
symbolProps?: string | SymbolMasterProps, | ||
document?: SketchDocumentData | SketchDocument | WrappedSketchDocument, | ||
bridge: PlatformBridge = SketchBridge, | ||
) { | ||
return _makeSymbol(Component, symbolProps, document, bridge); | ||
} | ||
|
||
export const TextStyles = _TextStyles(() => SketchBridge); | ||
|
||
export * from './index.common'; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.