@wscytz/dsl 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/cli.js +13 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -12,7 +12,7 @@
12
12
  * 本文件**不进公开 barrel**(node:fs 不许进 web bundle)。
13
13
  * 运行:`pnpm --filter @wscytz/dsl cli <命令> <file.sift>`(tsx,devDep)。
14
14
  */
15
- import { readFileSync } from 'node:fs';
15
+ import { readFileSync, realpathSync } from 'node:fs';
16
16
  import { pathToFileURL } from 'node:url';
17
17
  import { DSL_VERSION } from './dsl-grammar.js';
18
18
  import { parseDslWithDiagnostics } from './dsl-parser.js';
@@ -380,10 +380,20 @@ export function main(argv) {
380
380
  process.stderr.write(result.stderr);
381
381
  return result.code;
382
382
  }
383
- /* 直接执行时才跑 main(被 import / 测试时不触发)。
383
+ /* 直接执行时才跑 main(被 import / 测试时不触发)。npm/npx 经 node_modules/.bin
384
+ * 符号链接启动,argv[1] 是链接路径而 import.meta.url 是真实路径,直接比对必失配
385
+ * (bin 静默空转 exit 0,已实锤)——argv[1] 先过 realpath 再比。
384
386
  * 用 process.exitCode 而非 process.exit:后者不等 stdout 管道 flush,>64KiB 输出
385
387
  * (大画布 render)在 `| jq` 等管道下会静默截断且仍 exit 0。exitCode 让 Node 在
386
388
  * 写队列排空后自然退出。 */
387
- if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
389
+ const argvReal = (() => {
390
+ try {
391
+ return realpathSync(process.argv[1] ?? '');
392
+ }
393
+ catch {
394
+ return '';
395
+ }
396
+ })();
397
+ if (argvReal && import.meta.url === pathToFileURL(argvReal).href) {
388
398
  process.exitCode = main(process.argv.slice(2));
389
399
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wscytz/dsl",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Bidirectional text<->canvas description language: relational layout solved by an engine (group anchors, collision avoidance), structured card fields, zero runtime dependencies.",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": [