miaoda-game-devkit 0.2.0 → 0.2.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/dist/cli/lint.js CHANGED
@@ -33,8 +33,11 @@ function run(name, packageName, binName, args) {
33
33
  console.error(`[${name}] ${error.message}`);
34
34
  resolveResult({ name, ok: false });
35
35
  });
36
- child.once("exit", (code) => {
37
- resolveResult({ name, ok: code === 0 });
36
+ child.once("close", (code, signal) => {
37
+ if (signal) {
38
+ console.error(`[${name}] terminated by ${signal}`);
39
+ }
40
+ resolveResult({ name, ok: code === 0 && signal === null });
38
41
  });
39
42
  });
40
43
  }
@@ -14,7 +14,9 @@ var vitest_config_default = defineConfig({
14
14
  test: {
15
15
  server: {
16
16
  deps: {
17
- inline: [/miaoda-game-/]
17
+ // 合约文件运行在 Vitest 的 Node worker 中,不能被 Vite
18
+ // 按浏览器模块转换。
19
+ external: [/miaoda-game-devkit/]
18
20
  }
19
21
  },
20
22
  environment: "jsdom",
@@ -359,7 +359,10 @@ function defineGameVitestConfig(options) {
359
359
  hookTimeout: options.hookTimeout,
360
360
  server: {
361
361
  deps: {
362
- inline: [/miaoda-game-/]
362
+ // devkit 模块需要在配置和审计阶段使用 Node 内置模块。
363
+ // 如果强制内联,Vite 会把这些模块按浏览器模块转换,
364
+ // 最终触发 "No such built-in module: node:"。
365
+ external: [/miaoda-game-devkit/]
363
366
  }
364
367
  },
365
368
  environment: "jsdom",
@@ -419,6 +422,11 @@ describe("defineGameVitestConfig", () => {
419
422
  });
420
423
  expect(config.test).toMatchObject({
421
424
  include: ["tests/**/*.test.ts"],
425
+ server: {
426
+ deps: {
427
+ external: [/miaoda-game-devkit/]
428
+ }
429
+ },
422
430
  environment: "jsdom",
423
431
  environmentOptions: { jsdom: { url: "http://localhost/" } },
424
432
  setupFiles: ["miaoda-game-devkit/vitest-setup"],
@@ -379,7 +379,10 @@ function defineGameVitestConfig(options) {
379
379
  hookTimeout: options.hookTimeout,
380
380
  server: {
381
381
  deps: {
382
- inline: [/miaoda-game-/]
382
+ // devkit 模块需要在配置和审计阶段使用 Node 内置模块。
383
+ // 如果强制内联,Vite 会把这些模块按浏览器模块转换,
384
+ // 最终触发 "No such built-in module: node:"。
385
+ external: [/miaoda-game-devkit/]
383
386
  }
384
387
  },
385
388
  environment: "jsdom",
@@ -355,7 +355,10 @@ function defineGameVitestConfig(options) {
355
355
  hookTimeout: options.hookTimeout,
356
356
  server: {
357
357
  deps: {
358
- inline: [/miaoda-game-/]
358
+ // devkit 模块需要在配置和审计阶段使用 Node 内置模块。
359
+ // 如果强制内联,Vite 会把这些模块按浏览器模块转换,
360
+ // 最终触发 "No such built-in module: node:"。
361
+ external: [/miaoda-game-devkit/]
359
362
  }
360
363
  },
361
364
  environment: "jsdom",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miaoda-game-devkit",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Shared lint and deterministic Phaser HEADLESS testing tools for Miaoda games",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",