@proteus-vue/compiler-backend 0.1.1-beta.0 → 0.3.0-beta.10

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.
@@ -13,6 +13,21 @@ export declare function verifyDualCompilerEquivalence(source: string, opts: {
13
13
  details: string[];
14
14
  reason?: string;
15
15
  };
16
+ /**
17
+ * ★Rust CLI 执行超时预算(2026-09-19 修「冷缓存/首次执行误报」):
18
+ * 健康执行仅 ~10ms,但有两个**合法的慢路径**:
19
+ * ① `bin/cli.js` 是 npm bin 壳——二进制未构建时会先跑 `cargo build --release`(首次编译可达分钟级);
20
+ * ② **macOS 对刚写出的 Mach-O 首次执行要做一次系统校验**——实测 `pnpm verify` 场景
21
+ * (build-packages 重链 release 二进制 → 紧随测试首次执行)**耗时 71s**,第二次回到 0.17s。
22
+ * 固定 30s 超时在①(冷缓存)与②(刚重链)下必然触发 → 底层 ETIMEDOUT → 被上层归为
23
+ * `rust-cli-error`("Rust CLI 执行失败")**掩盖真实原因**;且 `buildDir` 见 mismatch 直接 throw →
24
+ * 设计本意的「二进制缺失 → skipped 降级、构建照常」在冷缓存下失效。
25
+ * 故取单一宽预算(覆盖 ①+②+执行本身):健康的慢只发生一次,而真正的损坏二进制
26
+ * (退出码非 0)依然**立即**失败——超时不是错误检测手段,只是挂死兜底。
27
+ */
28
+ export declare const RUST_CLI_TIMEOUT_MS = 300000;
29
+ /** 兼容旧签名(曾按「是否已构建」给 30s/600s 两档——两档都盖不住 macOS 首次执行校验,见上) */
30
+ export declare function rustCliTimeoutMs(_bin?: string): number;
16
31
  /**
17
32
  * ★定位 Rust CLI 可执行(bin/cli.js——npm bin 壳:release 优先/缺失自动 cargo build):
18
33
  * ① env PROTEUS_CC_RUST 显式路径 → ② 工程/本包解析 @proteus-vue/compiler-backend-rust 包 → null(调用方降级)
package/dist/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export type { ProteusCompilerBackend, CompilerCapabilities, CompilerIR, RenderIR
2
2
  export { runCompilerConformance, DEFAULT_CONFORMANCE_SFC } from './conformance';
3
3
  export type { ConformanceCheck, ConformanceResult } from './conformance';
4
4
  export { createNodeCompilerBackend } from './node';
5
- export { verifyDualCompilerEquivalence, resolveRustCliBin } from './dual-check';
5
+ export { verifyDualCompilerEquivalence, resolveRustCliBin, rustCliTimeoutMs, RUST_CLI_TIMEOUT_MS } from './dual-check';
6
6
  export type { CompilerBackendChoice } from './dual-check';
7
7
  export { createG38NodeBackend, g38Hash } from './g38';
8
8
  export type { G38CompilerBackend, G38CompilerCapabilities, G38SourceFile, G38SourceLoc, G38Diagnostic, G38ElementNode, G38ProgramIR, G38ImportNode, G38CapabilityNode, G38ModuleMetadata, G38IRModule, G38CompiledArtifact, G38IRModuleDiff, G38IncrementalSession, G38CompilerContext, G38ParseContext, G38TransformContext, G38EmitContext, } from './g38';
package/dist/index.js CHANGED
@@ -362,11 +362,15 @@ function verifyDualCompilerEquivalence(source, opts) {
362
362
  }
363
363
  return details.length ? { status: "mismatch", details, reason: "ir-drift" } : { status: "ok", details: [] };
364
364
  }
365
+ var RUST_CLI_TIMEOUT_MS = 3e5;
366
+ function rustCliTimeoutMs(_bin) {
367
+ return RUST_CLI_TIMEOUT_MS;
368
+ }
365
369
  function runRustCli(bin, source) {
366
370
  const tmp = path.join(os.tmpdir(), `proteus-dual-${Math.random().toString(36).slice(2)}.vue`);
367
371
  fs.writeFileSync(tmp, source, "utf-8");
368
372
  try {
369
- return execFileSync(process.execPath, [bin, "compile", tmp], { encoding: "utf-8", timeout: 3e4 });
373
+ return execFileSync(process.execPath, [bin, "compile", tmp], { encoding: "utf-8", timeout: RUST_CLI_TIMEOUT_MS });
370
374
  } finally {
371
375
  fs.rmSync(tmp, { force: true });
372
376
  }
@@ -1071,6 +1075,7 @@ function formatG38Conformance(name, s) {
1071
1075
  }
1072
1076
  export {
1073
1077
  DEFAULT_CONFORMANCE_SFC,
1078
+ RUST_CLI_TIMEOUT_MS,
1074
1079
  createG38FallbackBackend,
1075
1080
  createG38IncrementalSession,
1076
1081
  createG38NodeBackend,
@@ -1081,6 +1086,7 @@ export {
1081
1086
  resolveRustCliBin,
1082
1087
  runCompilerConformance,
1083
1088
  runG38Conformance,
1089
+ rustCliTimeoutMs,
1084
1090
  scanSfcImports,
1085
1091
  verifyDualCompilerEquivalence
1086
1092
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proteus-vue/compiler-backend",
3
- "version": "0.1.1-beta.0",
3
+ "version": "0.3.0-beta.10",
4
4
  "description": "G-29 编译器可插拔后端:CompilerIR 契约 + conformance(CMP002/CMP004 + G-31.1 语义链接)+ NodeBackend 参考实现(真实模板编译 → C-IR 语义树)——编译、逻辑、UI、能力四维可插拔(原则 #10 终极形态)",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -24,7 +24,7 @@
24
24
  "README.md"
25
25
  ],
26
26
  "dependencies": {
27
- "@proteus-vue/component-ir": "0.1.1-beta.0"
27
+ "@proteus-vue/component-ir": "0.3.0-beta.10"
28
28
  },
29
29
  "peerDependencies": {
30
30
  "@vue/compiler-dom": "^3.4",
@@ -33,7 +33,7 @@
33
33
  "devDependencies": {
34
34
  "@vue/compiler-dom": "^3.5.42",
35
35
  "@vue/compiler-sfc": "^3.5.42",
36
- "@proteus-vue/types": "0.2.0-beta.1"
36
+ "@proteus-vue/types": "0.3.0-beta.10"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "tsc -p tsconfig.build.json --emitDeclarationOnly && esbuild src/index.ts --bundle --format=esm --platform=node --outfile=dist/index.js --external:@vue/compiler-sfc --external:@vue/compiler-dom --external:@proteus-vue/component-ir && esbuild src/node.ts --bundle --format=esm --platform=neutral --outfile=dist/node.js --external:@vue/compiler-sfc --external:@vue/compiler-dom --external:@proteus-vue/component-ir"