Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects, and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Developer articles
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
tencent-connect
openclaw-qqbot
Repository navigation
Code
Issues
33
(33)
Pull requests
33
(33)
Discussions
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
main
Breadcrumbs
openclaw-qqbot
/
preload.cjs
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
36 lines (32 loc) · 1.23 KB
main
Breadcrumbs
openclaw-qqbot
/
preload.cjs
Copy path
Top
File metadata and controls
Code
Blame
36 lines (32 loc) · 1.23 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/**
* 插件预加载入口(CJS 格式)。
*
* openclaw 框架通过 require() 加载插件,因此需要 .cjs 后缀
* 确保在 "type": "module" 的 package 中也能被正确 require()。
*
* 在 require 真正的插件代码(依赖 openclaw/plugin-sdk)之前,
* 先同步确保 node_modules/openclaw symlink 存在。
*/
"use strict";
const path = require("node:path");
const fs = require("node:fs");
const { ensurePluginSdkSymlink } = require("./scripts/link-sdk-core.cjs");
// 1) 同步创建 symlink(确保 openclaw/plugin-sdk 可解析)
ensurePluginSdkSymlink(__dirname, "[preload]");
// 2) 加载编译产物(向后兼容:优先 .cjs,fallback .js)
const cjsPath = path.join(__dirname, "dist", "index.cjs");
const jsPath = path.join(__dirname, "dist", "index.js");
if (fs.existsSync(cjsPath)) {
module.exports = require(cjsPath);
} else {
// 兼容旧版 tsc 编译产物(ESM .js),需展平 default export
const _mod = require(jsPath);
const _default = _mod.default;
const merged = Object.assign({}, _mod);
if (_default && typeof _default === "object") {
for (const key of Object.keys(_default)) {
if (!(key in merged)) merged[key] = _default[key];
}
}
module.exports = merged;
}
You can’t perform that action at this time.