@lingfan-engine/stories-build 0.3.0 → 0.3.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/host-plugins.mjs +20 -0
  2. package/package.json +8 -4
@@ -0,0 +1,20 @@
1
+ /**
2
+ * `@lingfan-engine/stories-build/host-plugins` 的 Node 装载垫片。
3
+ *
4
+ * 为什么需要它:本包以 TypeScript 源码出口,而 Node 的类型擦除**拒绝加载
5
+ * node_modules 里的 .ts**(ERR_UNSUPPORTED_NODE_MODULES_TYPE_STRIPPING)。这个子路径
6
+ * 的消费方恰好是 **Node 直接加载的构建配置**(`vite.config.ts` 经 `vite.plugins.ts`
7
+ * 引它),而 vite 默认的配置加载器会把依赖外置成真实的 ESM import——于是配置一加载
8
+ * 就崩在 .ts 上。垫片用本包自带依赖 `tsx` 装载真实实现,扫描逻辑仍然只有一份。
9
+ *
10
+ * 类型不走这里:`package.json` 的 `exports` 对该子路径用条件导出,`types` 条件仍指向
11
+ * `./src/host-plugins/index.ts`,TypeScript 侧看到的还是源码声明。
12
+ */
13
+ import { tsImport } from "tsx/esm/api";
14
+
15
+ const mod = await tsImport("./src/host-plugins/index.ts", import.meta.url);
16
+
17
+ export const STORY_FONTS_MODULE_ID = mod.STORY_FONTS_MODULE_ID;
18
+ export const STORY_LIST_MODULE_ID = mod.STORY_LIST_MODULE_ID;
19
+ export const storyFontsVirtual = mod.storyFontsVirtual;
20
+ export const storyListVirtual = mod.storyListVirtual;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lingfan-engine/stories-build",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "type": "module",
5
5
  "description": "Stories 创作链编译包:把 Stories.src 的多目录原生 TS 源编译成 Resources/Stories/** + project.json,并产出 cell 注册生成物",
6
6
  "license": "Apache-2.0",
@@ -9,7 +9,10 @@
9
9
  "./authoring": "./src/authoring.d.ts",
10
10
  "./cell": "./src/cell/index.ts",
11
11
  "./cli": "./src/cli/cli.ts",
12
- "./host-plugins": "./src/host-plugins/index.ts",
12
+ "./host-plugins": {
13
+ "types": "./src/host-plugins/index.ts",
14
+ "default": "./host-plugins.mjs"
15
+ },
13
16
  "./watch": "./src/pipeline/watch.ts",
14
17
  "./watch-cli": "./src/cli/watch-cli.ts"
15
18
  },
@@ -20,12 +23,13 @@
20
23
  "files": [
21
24
  "src",
22
25
  "bin",
26
+ "host-plugins.mjs",
23
27
  "!src/**/*.test.ts"
24
28
  ],
25
29
  "sideEffects": false,
26
30
  "dependencies": {
27
- "@lingfan-engine/core": "^0.3.0",
28
- "@lingfan-engine/editor": "^0.3.0",
31
+ "@lingfan-engine/core": "^0.3.1",
32
+ "@lingfan-engine/editor": "^0.3.1",
29
33
  "esbuild": "^0.28.2",
30
34
  "tsx": "^4.23.15",
31
35
  "typescript": "~6.0.3"