@sf-kmods/kdataforgejs 2026.4.30 → 2026.4.37

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
@@ -1,7 +1,7 @@
1
1
  # @sf-kmods/kdataforgejs
2
2
 
3
3
  TypeScript types for KDataForgeJS packs. They describe the built-in `@sf-kmods/kdataforgejs` module that the runtime
4
- provides to a pack (`defineMeta`, `defineHandler`, `Context`, ...) and ship a strict `tsconfig` base.
4
+ provides to a pack (`ctx`, `defineMeta`, `defineHandler`, `Context`, ...) and ship a strict `tsconfig` base.
5
5
  Use together with [`@sf-kmods/kdataforgejs-cli`](../cli/README.md); `kdf init` sets everything up.
6
6
 
7
7
  ```sh
@@ -15,10 +15,23 @@ npm install --save-dev @sf-kmods/kdataforgejs
15
15
 
16
16
  ```ts
17
17
  // DataForge/scripts/main.ts
18
- import { defineHandler, defineMeta } from "@sf-kmods/kdataforgejs";
18
+ import { ctx, defineHandler, defineMeta } from "@sf-kmods/kdataforgejs";
19
19
 
20
- export const meta = defineMeta({ capabilities: ["kdf.items.define"] }); // optional
20
+ export const meta = defineMeta({ capabilities: [] });
21
+ export default defineHandler(async () => {
22
+ console.info(ctx.catalog().digest);
23
+ });
21
24
  ```
22
25
 
26
+ Import `ctx` in local helper modules too; they share the current script realm's context and need no
27
+ context parameter. Existing `defineHandler(async (ctx) => { ... })` handlers remain supported.
28
+
23
29
  This package is **editor tooling only**. Packs never contain `package.json` or `node_modules`; the runtime resolves
24
30
  `@sf-kmods/kdataforgejs` itself. The declarations are copied from the KDataForgeJS plugin at build time.
31
+
32
+ Use value imports for closed choices: `ImportKind.Yaml`, `Capability.ImportsRead`, `HookPhase.After`,
33
+ `DocumentType.Cdo`, `PropertyOperation.Set`, and the other enums exposed by completion. Raw strings no longer satisfy
34
+ these TypeScript parameters; YAML values are unchanged. Enum values are frozen runtime exports, so `import type`
35
+ alone cannot supply them. Update the runtime, SDK, CLI and VS Code extension together and refresh `kdf game-data`.
36
+
37
+ The package includes `enums.kdfjs.json`, `authoring.kdfjs.json` and the declaration integrity manifest.