create-yeow 0.4.0 → 0.4.2
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
|
Binary file
|
|
@@ -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,
|
|
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: [
|
|
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,26 +284,6 @@ export function makeAssetPlugin({ root, pkgJson, outDir, prepared }) {
|
|
|
284
284
|
};
|
|
285
285
|
}
|
|
286
286
|
|
|
287
|
-
// ── esbuild 插件:统一 yeow-api/yeow-command/yeow-server 到主项目实例 ──
|
|
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-command$/ }, () => ({
|
|
298
|
-
path: resolve(root, 'node_modules', 'yeow-command', 'src', 'index.ts').replace(/\\/g, '/'),
|
|
299
|
-
}));
|
|
300
|
-
build.onResolve({ filter: /^yeow-server$/ }, () => ({
|
|
301
|
-
path: resolve(root, 'node_modules', 'yeow-server', 'src', 'index.ts').replace(/\\/g, '/'),
|
|
302
|
-
}));
|
|
303
|
-
},
|
|
304
|
-
};
|
|
305
|
-
}
|
|
306
|
-
|
|
307
287
|
// ── 资产输出目录(供 build.js 打包 JAR)────────────────────────────
|
|
308
288
|
export function assetsOutDirFor(outDir) {
|
|
309
289
|
return resolve(outDir, '.assets');
|
|
@@ -23,11 +23,11 @@
|
|
|
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
|
|
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(工程化/线程分离/平台无关/原生扩展)、对比表、文档与工具链索引 |
|
|
30
|
-
| 更新日志 | `https://yexin.wiki/yeow/v1/changelog` | 按日期的更新记录(2026-08-
|
|
30
|
+
| 更新日志 | `https://yexin.wiki/yeow/v1/changelog` | 按日期的更新记录(2026-08-08 起) |
|
|
31
31
|
|
|
32
32
|
## API 参考(/v1/api/)
|
|
33
33
|
|
|
@@ -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/
|
|
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` | 粒子生成:类型、位置、数量、偏移、颜色/方块/物品粒子 |
|
|
@@ -56,11 +56,12 @@
|
|
|
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-server):洋葱中间件、路由、mount/mountAssets 静态挂载、二进制响应(
|
|
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,构建期注入命名空间)+ 读取/解压(单文件与目录) |
|
|
63
63
|
| PDC | `https://yexin.wiki/yeow/v1/api/pdc` | 持久数据容器:JSON 自动序列化、全量读取、插件命名空间(跨插件不冲突)、Player/Block 实例方法 |
|
|
64
|
+
| Util | `https://yexin.wiki/yeow/v1/api/util` | 数据工具:gzip 压缩/解压、UTF-8 ↔ 字节转换(含分块流式 Gzip) |
|
|
64
65
|
| Log | `https://yexin.wiki/yeow/v1/api/log` | 日志:`log`/`Logger`/`console`(自动插件名前缀) |
|
|
65
66
|
| Text | `https://yexin.wiki/yeow/v1/api/text` | 文本与 MiniMessage:标记语法、转义规则(真实换行 vs 字面 `\n`)、Message 对象(可翻译组件 {key,args,text}) |
|
|
66
67
|
|
|
@@ -69,6 +70,7 @@
|
|
|
69
70
|
| 页面 | URL | 摘要 |
|
|
70
71
|
| -------------- | ----------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
71
72
|
| 规范总览 | `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 等);版本变迁域规则+链接(方块/物品/实体/生物群系/音效/粒子/附魔/药水/属性/伤害类型/游戏规则/翻译键/进度/配方) |
|
|
72
74
|
| Java 插件集成 | `https://yexin.wiki/yeow/v1/specifications/java-api` | 其他 Java 插件调用 Yeow 服务(requestService 请求-响应、subscribeService 订阅事件)、提交游戏任务、约束 |
|
|
73
75
|
| 适配器规范 | `https://yexin.wiki/yeow/v1/specifications/adapter/` | 多语言/社区适配器:PluginEntity 接口、消息契约、submitTask、注册 API、检查清单 |
|
|
74
76
|
| 运行时环境标准 | `https://yexin.wiki/yeow/v1/specifications/runtime/` | JS 环境:语言标准(ES2025+SecU8)、回调系统(cb 语义)、事件循环、通道总览与权限、全局变量($send/$dev/fetch/timers) |
|
|
@@ -78,11 +80,11 @@
|
|
|
78
80
|
|
|
79
81
|
| 页面 | URL | 摘要 |
|
|
80
82
|
| --------- | ------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
81
|
-
| 通道总览 | `https://yexin.wiki/yeow/v1/specifications/message/` | 全部通道索引(task/timer/fs/http/assets/lifecycle/log/env/
|
|
83
|
+
| 通道总览 | `https://yexin.wiki/yeow/v1/specifications/message/` | 全部通道索引(task/timer/fs/http/assets/lifecycle/log/env/debug/service/util/worker)+ 通用通道说明 |
|
|
82
84
|
| Task | `https://yexin.wiki/yeow/v1/specifications/message/task` | task 通道:游戏任务请求/响应格式、同步 vs 异步(cb)、错误格式 |
|
|
83
85
|
| Timer | `https://yexin.wiki/yeow/v1/specifications/message/timer` | 定时器通道:timeout/interval 消息格式 |
|
|
84
86
|
| 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
|
|
87
|
+
| HTTP | `https://yexin.wiki/yeow/v1/specifications/message/http` | http 通道:listen/respond(body + encoding 二进制)/close/request/requestAsync 消息格式 |
|
|
86
88
|
| Assets | `https://yexin.wiki/yeow/v1/specifications/message/assets` | assets 通道:read/readBase64/extract/extractDir 消息格式(命名空间路径) |
|
|
87
89
|
| Service | `https://yexin.wiki/yeow/v1/specifications/message/service` | service 通道:注册(plugin/native)、请求、订阅/发布、原生 terminate 回调 |
|
|
88
90
|
| Log | `https://yexin.wiki/yeow/v1/specifications/message/log` | log 通道:日志消息格式 |
|
|
@@ -125,6 +127,6 @@
|
|
|
125
127
|
开始:概览 · 快速开始 · CLI 参考 · 构建与分发 · 运行时警告 · 路线图 · 站点地图
|
|
126
128
|
进阶(默认折叠):关于 Yeow · 进阶索引(架构/调度器/事件/生命周期/通道/服务/运维与安全)
|
|
127
129
|
依赖包开发:编写依赖包
|
|
128
|
-
API 参考:索引 → 玩家与服务器(Player/Server/Env) · 世界与方块(World/Chunk/Location/Block/Material) · 实体(Entity/Potion/Particle) · 交互界面(Inventory/BossBar/Scoreboard/Advancement/Recipe) · 事件与命令(Event/Command) · 物品(ItemStack) · 服务与网络(Service/HTTP/HTTP Server) · 多线程(Worker) · 文件与数据(FS/Assets/PDC) · 文本(Text) · 日志(Log)
|
|
130
|
+
API 参考:索引 → 玩家与服务器(Player/Server/Env) · 世界与方块(World/Chunk/Location/Block/Material) · 实体(Entity/Potion/Particle) · 交互界面(Inventory/BossBar/Scoreboard/Advancement/Recipe) · 事件与命令(Event/Command) · 物品(ItemStack) · 服务与网络(Service/HTTP/HTTP Server) · 多线程(Worker) · 文件与数据(FS/Assets/PDC/Util) · 文本(Text) · 日志(Log)
|
|
129
131
|
平台规范:规范总览 → 消息通道 · 任务类型 · 事件 · 运行时 · 原生服务 · 适配器
|
|
130
132
|
```
|