create-yeow 0.4.3 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-yeow",
3
- "version": "0.4.3",
3
+ "version": "0.5.0",
4
4
  "description": "Scaffold a Yeow plugin project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -114,7 +114,7 @@ async function main() {
114
114
  console.log(' \u2713 Bundled (' + (statSync(resolve(outDir, 'main.js')).size / 1024).toFixed(1) + ' KB)');
115
115
 
116
116
  // ── 组装 JAR ──
117
- const zip = new AdmZip(resolve(root, '.yeow', 'assets', 'yeow-template-0.1.0.jar'));
117
+ const zip = new AdmZip(resolve(root, '.yeow', 'assets', 'yeow-template-0.5.0.jar'));
118
118
  zip.updateFile('plugin.yml', Buffer.from(
119
119
  'name: ' + name + '\n' +
120
120
  'version: ' + version + '\n' +
@@ -17,7 +17,6 @@ const WS_PORT = 17368;
17
17
 
18
18
  const YES = process.argv.includes('-y') || process.env.CI === 'true';
19
19
  const EULA = process.argv.includes('--eula') || YES;
20
- const PROXY = process.argv.find(a => a.startsWith('--proxy='))?.split('=').slice(1).join('=');
21
20
  const STOP = (() => { const a = process.argv.find(a => a.startsWith('--stop=')); if (!a) return null; const m = a.split('=')[1].match(/^(\d+)(s|m|h)?$/); return m ? parseInt(m[1]) * (m[2] === 'm' ? 60 : m[2] === 'h' ? 3600 : 1) : null; })();
22
21
 
23
22
  // ── AI 工作流参数(headless 模式)─────────────────────────────
@@ -35,7 +34,7 @@ const HEADLESS = process.argv.includes('--eula') || process.argv.includes('--tim
35
34
  || process.argv.includes('--wait') || process.argv.includes('--outfile') || KEEP;
36
35
 
37
36
  const cfg = JSON.parse(readFileSync(resolve(ROOT, 'yeow.config.json'), 'utf-8'));
38
- const RUNTIME = resolve(ROOT, '.yeow', 'assets', 'yeow-runtime-0.2.0.jar');
37
+ const RUNTIME = resolve(ROOT, '.yeow', 'assets', 'yeow-runtime-0.5.0.jar');
39
38
 
40
39
  // Dev server config (optional, from yeow.config.json)
41
40
  const devCfg = cfg.dev || {};
@@ -139,12 +138,11 @@ function broadcast(msg) {
139
138
  }
140
139
 
141
140
  // ── Download ────────────────────────────────────────────────────
142
- function download(url, dest, agent) {
141
+ function download(url, dest) {
143
142
  return new Promise((resolve, reject) => {
144
143
  const f = createWriteStream(dest);
145
- const o = agent ? { agent } : {};
146
- https.get(url, o, res => {
147
- if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) { f.close(); download(res.headers.location, dest, agent).then(resolve).catch(reject); return; }
144
+ https.get(url, res => {
145
+ if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) { f.close(); download(res.headers.location, dest).then(resolve).catch(reject); return; }
148
146
  if (res.statusCode !== 200) { f.close(); reject(new Error(`HTTP ${res.statusCode}`)); return; }
149
147
  const total = parseInt(res.headers['content-length'], 10);
150
148
  let dl = 0;
@@ -161,10 +159,8 @@ async function ensurePaper() {
161
159
  if (PAPER_URL.startsWith('http://') || PAPER_URL.startsWith('https://')) {
162
160
  if (existsSync(PAPER_PATH) && statSync(PAPER_PATH).size > 1_000_000) { if (!HEADLESS) ok('Paper found in cache'); return; }
163
161
  mkdirSync(CACHE, { recursive: true });
164
- let agent = null;
165
- if (PROXY) { info(`Proxy: ${PROXY}`); try { const { HttpsProxyAgent } = await import('https-proxy-agent'); agent = new HttpsProxyAgent(PROXY); } catch {} }
166
162
  if (!HEADLESS) info('Downloading Paper...');
167
- try { await download(PAPER_URL, PAPER_PATH, agent); if (!HEADLESS) ok('Paper downloaded'); }
163
+ try { await download(PAPER_URL, PAPER_PATH); if (!HEADLESS) ok('Paper downloaded'); }
168
164
  catch (e) { fail('Download failed: ' + e.message); console.log(' Manually: ' + PAPER_PATH); process.exit(1); }
169
165
  } else {
170
166
  if (!existsSync(PAPER_PATH)) { fail(`Paper JAR not found: ${PAPER_PATH}`); process.exit(1); }
@@ -179,7 +175,7 @@ async function ensurePaper() {
179
175
  const versions = await fetch(apiUrl).then(r => r.json());
180
176
  const latestBuild = versions.builds[versions.builds.length - 1];
181
177
  const dlUrl = `https://api.papermc.io/v2/projects/paper/versions/${PAPER_VERSION}/builds/${latestBuild}/downloads/paper-${PAPER_VERSION}-${latestBuild}.jar`;
182
- await download(dlUrl, PAPER_PATH, null);
178
+ await download(dlUrl, PAPER_PATH);
183
179
  if (!HEADLESS) ok('Paper downloaded');
184
180
  } catch (e) {
185
181
  fail('Download failed: ' + e.message);
@@ -8,12 +8,11 @@
8
8
  "permissions": "node .yeow/permissions.js"
9
9
  },
10
10
  "dependencies": {
11
- "yeow-api": "^0.4.0"
11
+ "yeow-api": "^0.5.0"
12
12
  },
13
13
  "devDependencies": {
14
14
  "esbuild": "^0.25.0",
15
15
  "adm-zip": "^0.6.0",
16
- "https-proxy-agent": "^9.0.0",
17
16
  "source-map": "^0.7.4",
18
17
  "ws": "^8.0.0",
19
18
  "typescript": "^7.0.0"
@@ -10,7 +10,8 @@
10
10
  | 概览 | `https://yexin.wiki/yeow/v1/overview` | 项目总览:用 TypeScript 写 Paper 插件(QuickJS 引擎,每插件独立线程)。按角色(初学者/开发者/服主/平台实现者)的文档入口导引 + 关键概念速览 |
11
11
  | AI 辅助启动指南 | `https://yexin.wiki/yeow/v1/ai-agent` | 面向 AI 代理 / Vibe Coding:Yeow 项目简介、启动命令(`--ts`)、下一步、文档查阅策略(站点地图/docs.zip/Harness 用法) |
12
12
  | 快速开始 | `https://yexin.wiki/yeow/v1/getting-started` | 从零开始:`npm create yeow` 建项目 → `npm run dev` 开发(热重载)→ `npm run build` 构建 → 部署方式。含插件示例(/back 传送)、异步/同步约定 |
13
- | CLI 参考 | `https://yexin.wiki/yeow/v1/cli` | create-yeow 脚手架与 dev-server 的命令行用法:交互式/非交互创建、开发服务器参数(-y/--stop/--proxy)、构建脚本、调试体验(source-map 错误定位与异步调用链) |
13
+ | 环境能力 | `https://yexin.wiki/yeow/v1/environment` | 运行时环境速览:全局能力($send/fetch/TextEncoder/TextDecoder/定时器)、线程与异步模型、与浏览器/Node 环境的差异、性能建议 |
14
+ | CLI 参考 | `https://yexin.wiki/yeow/v1/cli` | create-yeow 脚手架与 dev-server 的命令行用法:交互式/非交互创建、开发服务器参数(-y/--stop)、构建脚本、调试体验(source-map 错误定位与异步调用链) |
14
15
  | 构建与分发 | `https://yexin.wiki/yeow/v1/distribution` | 两种产物:标准 Paper JAR(plugins/)与平台无关 .yeow.zip(plugins/Yeow/ 自动扫描或 /yeow install);分发建议与 Modrinth 发布 |
15
16
  | 权限与原生服务可信性 | `https://yexin.wiki/yeow/v1/permissions` | 敏感权限声明(默认拒绝表/通配规则/computedPermissions)、原生服务 SHA-256 可信性声明与一次性批准码机制 |
16
17
  | 运行时运维 | `https://yexin.wiki/yeow/v1/operations` | 服主视角:/yeow 管理命令全集、运行时配置(config.yml 含 Folia 节)、部署形态速查 |
@@ -70,7 +71,7 @@
70
71
  | 页面 | URL | 摘要 |
71
72
  | -------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
72
73
  | 规范总览 | `https://yexin.wiki/yeow/v1/specifications/` | 协议层总纲:包结构(yeow.json/.yeow/main.js/assets)、加载流程、权限模型、运行时架构、任务执行器、事件/命令桥、Native Service、合格运行时检查清单 |
73
- | 值域附录 | `https://yexin.wiki/yeow/v1/specifications/values` | 取值格式规则(R1-R5)与清单:平台枚举直接维护(游戏模式/难度/BossBar/计分板/ClickType/ItemFlag/DamageCause/InventoryType 等);版本变迁域规则+链接(方块/物品/实体/生物群系/音效/粒子/附魔/药水/属性/伤害类型/游戏规则/翻译键/进度/配方) |
74
+ | 值域附录 | `https://yexin.wiki/yeow/v1/specifications/values` | 取值格式规则(R1-R5)与清单:平台枚举直接维护(游戏模式/难度/BossBar/计分板/ClickType/ItemFlag/InventoryType 等);参考实现(非强制:DamageCause/传送原因/回血原因);版本变迁域规则+链接(方块/物品/实体/生物群系/音效/粒子/附魔/药水/属性/伤害类型/游戏规则/翻译键/进度/配方) |
74
75
  | Java 插件集成 | `https://yexin.wiki/yeow/v1/specifications/java-api` | 其他 Java 插件调用 Yeow 服务(requestService 请求-响应、subscribeService 订阅事件)、提交游戏任务、约束 |
75
76
  | 适配器规范 | `https://yexin.wiki/yeow/v1/specifications/adapter/` | 多语言/社区适配器:PluginEntity 接口、消息契约、submitTask、注册 API、检查清单 |
76
77
  | 运行时环境标准 | `https://yexin.wiki/yeow/v1/specifications/runtime/` | JS 环境:语言标准(ES2025+SecU8)、回调系统(cb 语义)、事件循环、通道总览与权限、全局变量($send/$dev/fetch/timers) |