create-yeow 0.3.10 → 0.4.1

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.3.10",
3
+ "version": "0.4.1",
4
4
  "description": "Scaffold a Yeow plugin project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -4,7 +4,7 @@ import { resolve, dirname } from 'path';
4
4
  import { fileURLToPath } from 'url';
5
5
  import AdmZip from 'adm-zip';
6
6
  import { execSync } from 'child_process';
7
- import { makeAssetPlugin, makeDedupePlugin, assetsOutDirFor, readMergedPermissions, prepareAssets, computeNativeManifest } from './yeow-assets.mjs';
7
+ import { makeAssetPlugin, assetsOutDirFor, readMergedPermissions, prepareAssets, computeNativeManifest } from './yeow-assets.mjs';
8
8
 
9
9
  const root = resolve(fileURLToPath(import.meta.url), '..', '..');
10
10
  const cfg = JSON.parse(readFileSync(resolve(root, 'yeow.config.json'), 'utf-8'));
@@ -82,7 +82,7 @@ async function main() {
82
82
  treeShaking: true,
83
83
  minify: false,
84
84
  sourcemap: isDev ? 'linked' : false,
85
- plugins: [makeDedupePlugin(root), makeAssetPlugin({ root, pkgJson, outDir, prepared })],
85
+ plugins: [makeAssetPlugin({ root, pkgJson, outDir, prepared })],
86
86
  });
87
87
  console.log(' \u2713 Worker bundled: ' + w.name + ' (' + w.entry + ' \u2192 ' + w.dist + ')');
88
88
  }
@@ -108,7 +108,6 @@ async function main() {
108
108
  minify: false,
109
109
  sourcemap: isDev ? 'linked' : false,
110
110
  plugins: [
111
- makeDedupePlugin(root),
112
111
  makeAssetPlugin({ root, pkgJson, outDir, prepared }),
113
112
  ],
114
113
  });
@@ -284,23 +284,6 @@ export function makeAssetPlugin({ root, pkgJson, outDir, prepared }) {
284
284
  };
285
285
  }
286
286
 
287
- // ── esbuild 插件:统一 yeow-api/yeow-utils 到主项目实例 ──────────
288
- // 避免依赖包自带副本导致全局状态分裂(如 __yeowInitCbs 被覆盖)
289
- // 注意:返回路径必须用正斜杠,否则 Windows 下 esbuild 解析失败
290
- export function makeDedupePlugin(root) {
291
- return {
292
- name: 'dedupe-yeow-core',
293
- setup(build) {
294
- build.onResolve({ filter: /^yeow-api$/ }, () => ({
295
- path: resolve(root, 'node_modules', 'yeow-api', 'src', 'index.ts').replace(/\\/g, '/'),
296
- }));
297
- build.onResolve({ filter: /^yeow-utils$/ }, () => ({
298
- path: resolve(root, 'node_modules', 'yeow-utils', 'src', 'index.ts').replace(/\\/g, '/'),
299
- }));
300
- },
301
- };
302
- }
303
-
304
287
  // ── 资产输出目录(供 build.js 打包 JAR)────────────────────────────
305
288
  export function assetsOutDirFor(outDir) {
306
289
  return resolve(outDir, '.assets');
@@ -15,7 +15,7 @@
15
15
  - **语言**:TypeScript / JavaScript(Node.js 18+,开发)
16
16
  - **构建**:esbuild(bundle → IIFE,`target: esnext`),脚本在 `.yeow/build.js`
17
17
  - **开发服务器**:`.yeow/dev-server.js`(下载并启动 Paper、WebSocket 热重载、source-map 错误定位)
18
- - **API**:`yeow-api`(运行时 API:Player/World/Event/Command/Worker/fs/http…)与 `yeow-utils`(高层工具:HTTP 服务器、命令构造器)——均打包进产物
18
+ - **API**:`yeow-api`(运行时 API:Player/World/Event/Command/Worker/fs/http…)——打包进产物
19
19
  - **运行时**:`yeow-runtime`(Java 21,Paper 插件)——仓库 `yeow-runtime/`;本模板 `.yeow/assets/` 内置其 jar
20
20
  - **Worker(虚拟插件)**:`createWorker` 提供独立线程;配置见 `yeow.config.json` 的 `dev.worker`
21
21
 
@@ -8,8 +8,7 @@
8
8
  "permissions": "node .yeow/permissions.js"
9
9
  },
10
10
  "dependencies": {
11
- "yeow-api": "^0.3.0",
12
- "yeow-utils": "^0.1.21"
11
+ "yeow-api": "^0.4.0"
13
12
  },
14
13
  "devDependencies": {
15
14
  "esbuild": "^0.25.0",
@@ -23,7 +23,7 @@
23
23
  | 进阶 · 环境能力与通道 | `https://yexin.wiki/yeow/v1/advanced/channels` | $_send/$send 封装、各消息通道说明(运行时配置指向 /operations) |
24
24
  | 进阶 · 服务机制 | `https://yexin.wiki/yeow/v1/advanced/service` | Plugin Service(插件间通信)与 Native Service(原生扩展)的机制(API 用法见 /api/service) |
25
25
  | 关于 Yeow | `https://yexin.wiki/yeow/v1/advanced/about` | 关于 Yeow |
26
- | 编写依赖包 | `https://yexin.wiki/yeow/v1/package-author` | 将共享逻辑与资源封装为 npm 依赖包:assets 命名空间、依赖项识别、构建自动处理(dedupe/权限合并/native 清单) |
26
+ | 编写依赖包 | `https://yexin.wiki/yeow/v1/package-author` | 将共享逻辑与资源封装为 npm 依赖包:assets 命名空间、依赖项识别、构建自动处理(多副本共存/权限合并/native 清单) |
27
27
  | 封装 Service 的依赖包 | `https://yexin.wiki/yeow/v1/package-service` | 依赖包中封装 Service 的三种类型:SDK 调用封装 / JS 服务(全局唯一+降级)/ 原生服务(子进程),与"JS 门面 + 原生引擎"组合模式 |
28
28
  | 路线图 | `https://yexin.wiki/yeow/v1/todo` | v1 方向性规划:API/事件覆盖、调试工具、Folia 支持;Worker API 已实现 |
29
29
  | 索引(README) | `https://yexin.wiki/yeow/v1/` | 文档首页:快速上手命令、为什么用 Yeow(工程化/线程分离/平台无关/原生扩展)、对比表、文档与工具链索引 |
@@ -42,7 +42,7 @@
42
42
  | Chunk | `https://yexin.wiki/yeow/v1/api/chunk` | 区块快照(进阶性能工具):3D 完整快照与 2D 顶部快照(short[] base64 零拷贝视图 + 方块索引映射) |
43
43
  | Location | `https://yexin.wiki/yeow/v1/api/location` | 坐标与朝向:x/y/z/yaw/pitch/world |
44
44
  | Block | `https://yexin.wiki/yeow/v1/api/block` | 统一方块概念:数据描述符(type/state)+ 可选 location;静态数据语义(快照);材料级判断委托 Material;breakNaturally 需 location |
45
- | Material | `https://yexin.wiki/yeow/v1/api/material` | 材料注册表查询(getMaterials/getBlocks/getItems)+ 材料级静态判断对象(isSolid/isLiquid/isAir,不依赖坐标/状态) |
45
+ | Material | `https://yexin.wiki/yeow/v1/api/material` | 材料注册表查询(getMaterials/getBlocks/getItems)+ 材料级静态判断对象(isSolid/isAir,不依赖坐标/状态) |
46
46
  | Entity | `https://yexin.wiki/yeow/v1/api/entity` | 实体:类型/名称/位置、发光/无敌/静默/重力、乘客/载具、碰撞盒、生命值;LivingEntity |
47
47
  | Potion | `https://yexin.wiki/yeow/v1/api/potion` | 药水效果:添加/移除/清除/查询(类型、时长、等级) |
48
48
  | Particle | `https://yexin.wiki/yeow/v1/api/particle` | 粒子生成:类型、位置、数量、偏移、颜色/方块/物品粒子 |
@@ -52,11 +52,11 @@
52
52
  | Advancement | `https://yexin.wiki/yeow/v1/api/advancement` | 进度:授予/撤销、进度查询、判据授予/撤销 |
53
53
  | Recipe | `https://yexin.wiki/yeow/v1/api/recipe` | 配方:有序/无序合成、熔炉/高炉/烟熏/营火;添加/移除/按产物查询 |
54
54
  | Event | `https://yexin.wiki/yeow/v1/api/event` | 事件订阅:`eventOn`/`eventOff`、自动/手动模式(取消、回写)、全事件字段表、消息(Message 对象) |
55
- | Command | `https://yexin.wiki/yeow/v1/api/command` | 命令注册 + Tab 补全(含 yeow-utils 重载式命令 Command.create 与模式化参数) |
55
+ | Command | `https://yexin.wiki/yeow/v1/api/command` | 命令注册 + Tab 补全(含 yeow-command 重载式命令 Command.create 与模式化参数) |
56
56
  | ItemStack | `https://yexin.wiki/yeow/v1/api/item` | 物品纯数据描述符:type/amount/meta(显示名/附魔/耐久/染色/药水/头颅/属性修饰符);构造工具(create/clone/equals);值语义(快照,不绑定真实物品) |
57
57
  | Service | `https://yexin.wiki/yeow/v1/api/service` | 插件间服务(registerService/request/subscribe/publish)与原生服务(registerNativeService,spawn 子进程 + TCP 通信) |
58
58
  | HTTP | `https://yexin.wiki/yeow/v1/api/http` | 底层 HTTP 客户端:request(异步)/requestSync(同步阻塞)/fetch |
59
- | HTTP Server | `https://yexin.wiki/yeow/v1/api/http-server` | 高层 `createServer`(yeow-utils):洋葱中间件、路由、mount/mountAssets 静态挂载、二进制响应(bodyBase64)、返回对象自动 JSON、资源包下载闭环 |
59
+ | HTTP Server | `https://yexin.wiki/yeow/v1/api/http-server` | 高层 `createServer`(yeow-server):洋葱中间件、路由、mount/mountAssets 静态挂载、二进制响应(Uint8Array/encoding)、返回对象自动 JSON、资源包下载闭环 |
60
60
  | Worker | `https://yexin.wiki/yeow/v1/api/worker` | 虚拟插件(独立线程):createWorker(仅注册)/load/unload/reload、双向 postMessage、Worker 侧 onMessage/postMessage;共享数据目录/权限、禁嵌套、/yeow 不覆盖 |
61
61
  | FS | `https://yexin.wiki/yeow/v1/api/fs` | 文件系统:plugin/server/outer 三级(路径安全)、读写/追加/二进制、目录操作、systemPaths、path 工具 |
62
62
  | Assets | `https://yexin.wiki/yeow/v1/api/assets` | 打包资源:`getAssetsPath`(yeow-dev,构建期注入命名空间)+ 读取/解压(单文件与目录) |
@@ -69,6 +69,7 @@
69
69
  | 页面 | URL | 摘要 |
70
70
  | -------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
71
71
  | 规范总览 | `https://yexin.wiki/yeow/v1/specifications/` | 协议层总纲:包结构(yeow.json/.yeow/main.js/assets)、加载流程、权限模型、运行时架构、任务执行器、事件/命令桥、Native Service、合格运行时检查清单 |
72
+ | 值域附录 | `https://yexin.wiki/yeow/v1/specifications/values` | 取值格式规则(R1-R5)与清单:平台枚举直接维护(游戏模式/难度/BossBar/计分板/ClickType/ItemFlag/DamageCause/InventoryType 等);版本变迁域规则+链接(方块/物品/实体/生物群系/音效/粒子/附魔/药水/属性/伤害类型/游戏规则/翻译键/进度/配方) |
72
73
  | Java 插件集成 | `https://yexin.wiki/yeow/v1/specifications/java-api` | 其他 Java 插件调用 Yeow 服务(requestService 请求-响应、subscribeService 订阅事件)、提交游戏任务、约束 |
73
74
  | 适配器规范 | `https://yexin.wiki/yeow/v1/specifications/adapter/` | 多语言/社区适配器:PluginEntity 接口、消息契约、submitTask、注册 API、检查清单 |
74
75
  | 运行时环境标准 | `https://yexin.wiki/yeow/v1/specifications/runtime/` | JS 环境:语言标准(ES2025+SecU8)、回调系统(cb 语义)、事件循环、通道总览与权限、全局变量($send/$dev/fetch/timers) |
@@ -78,11 +79,11 @@
78
79
 
79
80
  | 页面 | URL | 摘要 |
80
81
  | --------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
81
- | 通道总览 | `https://yexin.wiki/yeow/v1/specifications/message/` | 全部通道索引(task/timer/fs/http/assets/lifecycle/log/env/dir/debug/service/worker)+ 通用通道说明 |
82
+ | 通道总览 | `https://yexin.wiki/yeow/v1/specifications/message/` | 全部通道索引(task/timer/fs/http/assets/lifecycle/log/env/debug/service/worker)+ 通用通道说明 |
82
83
  | Task | `https://yexin.wiki/yeow/v1/specifications/message/task` | task 通道:游戏任务请求/响应格式、同步 vs 异步(cb)、错误格式 |
83
84
  | Timer | `https://yexin.wiki/yeow/v1/specifications/message/timer` | 定时器通道:timeout/interval 消息格式 |
84
85
  | FS | `https://yexin.wiki/yeow/v1/specifications/message/fs` | fs 通道:plugin/server/outer 三级、各操作(读写/删除/列出/base64/systemPaths)请求格式与路径规则 |
85
- | HTTP | `https://yexin.wiki/yeow/v1/specifications/message/http` | http 通道:listen/respond(含 bodyBase64 二进制)/close/request/requestAsync 消息格式 |
86
+ | HTTP | `https://yexin.wiki/yeow/v1/specifications/message/http` | http 通道:listen/respond(body + encoding 二进制)/close/request/requestAsync 消息格式 |
86
87
  | Assets | `https://yexin.wiki/yeow/v1/specifications/message/assets` | assets 通道:read/readBase64/extract/extractDir 消息格式(命名空间路径) |
87
88
  | Service | `https://yexin.wiki/yeow/v1/specifications/message/service` | service 通道:注册(plugin/native)、请求、订阅/发布、原生 terminate 回调 |
88
89
  | Log | `https://yexin.wiki/yeow/v1/specifications/message/log` | log 通道:日志消息格式 |