plugin type
Plugin Name | Plugin Description | Runtime | Input | Output | Status |
---|---|---|---|---|---|
inspectPlugin | Check the problems and tips on the design draft | Before transcoding | JSONSchema | D2CInspect[] | 🚧 |
schemaPlugin | Intervention in schema before JSX generation | Before JSON Schema output | JSONSchema | JSONSchema | 🚧 |
generatePlugin | Custom transcoding output content | Before outputting code products | GeneratePluginInput | GeneratePluginOutput | ✅ |
###InspectPlugin
Check out the Design Inspection custom plugins section.
GeneratePlugin
Plugin packaging configuration
target
browser, the plug-in package runs in the browser environment, and should not contain node-related APIs after packaging.
format
UMD format, preferably standalone, can introduce common third-party packages through global variables to reduce package size.
externals
externals means a package provided globally, and third-party plug-ins do not need to be packaged into the plug-in.
The reference path of the package in the source code | Converted to the name of the reference global variable after packaging |
---|---|
lodash | _ |
prettier | prettier |
prettier/parser-babel | prettierBabelParser |
prettier/parser-postcss | prettierPostCSSParser |
Buffer | buffer |
Notice
- The packaged product does not contain node API
- The packaged product should not require third-party packages, modules should be built-in or use packages contained in externals
- The supported externals package will be mounted on the global variable, and each package has a specific name, which should be configured when packaging, otherwise the corresponding package may not be found
Plugin usage
The settings page adds custom plugins by configuring the URL.
Error handling
When using the Figma plugin, if the custom plugin reports an error, perform the following actions.
- Skip the plugin without affecting the next conversion logic
- Perform the following conversion on the content originally input to the plug-in
- Show error message