@yeyelailou/co 0.0.8 → 0.0.9

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/README.md CHANGED
@@ -116,7 +116,7 @@ Apache-2.0,见 `LICENSE`。
116
116
 
117
117
  ## 开发准则
118
118
 
119
- > 本文件是仓库唯一的 Markdown 文档(2026-10-28 起使用说明与开发准则合并为单一 README.md)。最后更新:2026-12-03;源码版本:**0.0.8**。
119
+ > 本文件是仓库唯一的 Markdown 文档(2026-10-28 起使用说明与开发准则合并为单一 README.md)。最后更新:2026-12-03;源码版本:**0.0.9**。
120
120
 
121
121
  ---
122
122
 
@@ -1079,7 +1079,7 @@ npm pack --dry-run
1079
1079
 
1080
1080
  | 项目 | 状态 |
1081
1081
  |------|------|
1082
- | 版本 | 0.0.8 |
1082
+ | 版本 | 0.0.9 |
1083
1083
  | 首批包 | 20 个,三通道逐一验证(2026-11-09 实测 20/20) |
1084
1084
  | 注册表 | 本地发布/安装/导入闭环已验证(`cocn-path` 实测 publish → install → 导入 → 运行) |
1085
1085
  | 语言套件 | 38 个(2026-11-09 在 x86-64 实测 eval/vm/native 各 38/38、三通道逐字节一致) |
@@ -26,6 +26,7 @@ const fs = require('fs');
26
26
  const { spawn } = require('child_process');
27
27
 
28
28
  const PKG_DIR = path.join(__dirname, '..');
29
+ const PKG_VERSION = require(path.join(PKG_DIR, 'package.json')).version;
29
30
  const SRC_DIR = path.join(PKG_DIR, 'src');
30
31
  const BIN_DIR = path.join(__dirname);
31
32
  const NATIVE_DIR = path.join(PKG_DIR, '工具', '原生编译器');
@@ -109,6 +110,12 @@ function pipeExit(child, label) {
109
110
  }
110
111
 
111
112
  const userArgs = process.argv.slice(2);
113
+
114
+ if (userArgs[0] === '--version' || userArgs[0] === '-v' || userArgs[0] === 'version') {
115
+ console.log(PKG_VERSION);
116
+ process.exit(0);
117
+ }
118
+
112
119
  // 程序参数(源文件之后):编码进 COCN_ARGV 以换行分隔,供层内置 读取命令行 取回。
113
120
  // 宿主不提供命令行参数能力,此为层扩展;以换行分隔,故参数不应含换行(CLI 约定)。
114
121
  const cocnArgv = userArgs.length > 1 ? userArgs.slice(1).join('\n') : '';
package/index.js CHANGED
@@ -15,8 +15,7 @@ const { spawn } = require('child_process');
15
15
  const PKG_DIR = __dirname;
16
16
  const SRC_DIR = path.join(PKG_DIR, 'src');
17
17
  const BIN_DIR = path.join(PKG_DIR, 'bin');
18
- const BOOTSTRAP_NAME = process.platform === 'win32' ? 'cocn.exe' : 'cocn';
19
- const BOOTSTRAP_PATH = path.join(BIN_DIR, BOOTSTRAP_NAME);
18
+ const MAIN_BOOTSTRAP_PATH = path.join(BIN_DIR, process.platform === 'win32' ? '引导器.exe' : '引导器');
20
19
  const INTERPRETER_PATH = path.join(SRC_DIR, '解释器.co');
21
20
  const REPL_PATH = path.join(SRC_DIR, 'repl.co');
22
21
  const PKG_VERSION = (() => {
@@ -30,9 +29,7 @@ function platformSuffix() {
30
29
  }
31
30
 
32
31
  function findBootstrap() {
33
- if (fs.existsSync(BOOTSTRAP_PATH)) return BOOTSTRAP_PATH;
34
- const alt = path.join(BIN_DIR, process.platform === 'win32' ? 'co.exe' : 'co');
35
- if (fs.existsSync(alt)) return alt;
32
+ if (fs.existsSync(MAIN_BOOTSTRAP_PATH)) return MAIN_BOOTSTRAP_PATH;
36
33
 
37
34
  const suffix = platformSuffix();
38
35
  if (suffix) {
@@ -79,7 +76,7 @@ module.exports = {
79
76
  }
80
77
  const baseDir = options.cwd || process.cwd();
81
78
  const absTarget = path.resolve(baseDir, targetProgram);
82
- const env = Object.assign({}, process.env, { COCN_TARGET: absTarget });
79
+ const env = Object.assign({}, process.env, { COCN_TARGET: absTarget, PWD: baseDir });
83
80
  return spawn(bootstrap, [INTERPRETER_PATH], {
84
81
  stdio: options.stdio || 'inherit',
85
82
  env,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@yeyelailou/co",
3
- "version": "0.0.8",
4
- "_buildIter": 8,
3
+ "version": "0.0.9",
4
+ "_buildIter": 9,
5
5
  "description": "cocn(原 coCN)—— 用 cocn 自身编写的中文编程语言。当前 20 个首批包、38 个三通道语言套件、crates.io 式注册表与 Cargo 风格工具链;0.0.3 修复 npm 安装后的引导器查找,0.0.4 清理其他语言,0.0.5 解除字典 256 键上限(动态扩容+插入序)并让原生后端支持字典/尝试捕获/匿名函数。开发规范见 README.md。",
6
6
  "main": "index.js",
7
7
  "bin": {
@@ -9,8 +9,8 @@
9
9
  "cocn": "bin/cocn.js"
10
10
  },
11
11
  "optionalDependencies": {
12
- "@yeyelailou/co-linux-x64": "0.0.8",
13
- "@yeyelailou/co-linux-arm64": "0.0.8"
12
+ "@yeyelailou/co-linux-x64": "0.0.9",
13
+ "@yeyelailou/co-linux-arm64": "0.0.9"
14
14
  },
15
15
  "files": [
16
16
  "bin/cocn.js",
@@ -24,16 +24,10 @@
24
24
  "工具/原生编译器/*.c",
25
25
  "工具/原生编译器/*.h",
26
26
  "工具/原生编译器/*.sh",
27
- "工具/原生编译器/运行时/",
28
- "工具/原生编译器/优化器/",
29
- "工具/原生编译器/类型系统/",
30
27
  "工具/原生编译器/测试/",
31
28
  "工具/原生编译器/编译器合并.co",
32
29
  "工具/自举编译器/",
33
30
  "工具/生态/",
34
- "工具/lsp/",
35
- "工具/vscode-cocn/",
36
- "工具/语言对比/",
37
31
  "示例包/",
38
32
  "示例/",
39
33
  "测试/",
@@ -92,7 +86,7 @@
92
86
  "url": "https://gitee.com/COSMOnb666/cocn/issues"
93
87
  },
94
88
  "engines": {
95
- "node": ">=14.0.0"
89
+ "node": ">=18.0.0"
96
90
  },
97
91
  "os": [
98
92
  "darwin",