
Security News
Vite+ Joins the Push to Consolidate JavaScript Tooling
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
@swanide/extension
Advanced tools
swanide 扩展 API,可以在 百度小程序开发工具 中进行扩展开发。
下载 百度小程序开发工具。
在开发者工具 extension
扩展中:
import {swanideInExtension as swanide} from '@swanide/extension';
export function activate() {
swanide.ideReady(() => {
swanide.executeCommand('swanide.simulator.refresh');
});
}
注意: extension 扩展的加载顺序可能会在工具 ready 之前,需要调用 ideReady
事件才可以运行工具提供的函数。
在开发者工具 widget
扩展中:
import {ExtensionContext} from 'vscode';
import {swanideInWidget as swanide} from '@swanide/extension';
export function activate(context: ExtensionContext) {
swanide.executeCommand('swanide.simulator.refresh');
}
在开发者工具 window
窗口中:
import {swanideInWindow as swanide} from '@swanide/extension';
swanide.executeCommand('swanide.simulator.refresh');
开发者工具对 vscode 扩展点做了增强,增加了以下几个扩展点:
开发者工具扩展支持在 renderer 视图注入 widget,每个 widget 为一个扩展模块,在 workbench 主视图加载后进行加载。 widget 模块 为工具提供操作主视图的能力,同时支持更多 swanide 相关API。
package.json 扩展点如下:
"contributes": {
// widget 扩展点
"widgets": [
{
// widget id 模块唯一标识,不可重复
"id": "swanide-extension-example.widget",
// widget 入口
"entry": "./dist/widget.js",
// 入口加载模式,默认为 amd,由于开发者工具更依赖 commonjs 模块,这里提供了 commonjs 加载模式
"entryType": "commonjs"
}
]
},
widget 入口模块:
/**
* swanide widget 扩展
*/
import {swanide, WidgetContext} from '@swanide/extension';
export function activate(context: WidgetContext) {
console.log('swanide extension path', context.extensionPath);
swanide.executeCommand('swanide-extension-example.helloWorld');
}
开发者工具扩展支持工具栏按钮设置,点击按钮运行指定命令。
package.json 扩展点如下:
"contributes": {
// toolbars 扩展点
"toolbars": [
{
"name": "swanide-extension-example-btn",
"text": "示例扩展按钮",
"icon": "search",
"command": "editor.action.formatDocument",
"tooltip": "示例扩展按钮",
"type": "button",
// 分组:develop | deploy | debug | cloud | guide | info
"group": "right",
// 分组内排序
"order": 100
}
]
},
FAQs
swanide extension api
The npm package @swanide/extension receives a total of 4 weekly downloads. As such, @swanide/extension popularity was classified as not popular.
We found that @swanide/extension demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Evan You announces Vite+, a commercial, Rust-powered toolchain built on the Vite ecosystem to unify JavaScript development and fund open source.
Security News
Ruby Central’s incident report on the RubyGems.org access dispute sparks backlash from former maintainers and renewed debate over project governance.
Research
/Security News
Socket researchers uncover how threat actors weaponize Discord across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.