@atscript/typescript 0.1.38 → 0.1.39

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/README.md +46 -28
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,6 +1,20 @@
1
- # @atscript/typescript
1
+ <p align="center">
2
+ <img src="https://atscript.moost.org/logo.svg" alt="Atscript" width="120" />
3
+ </p>
2
4
 
3
- TypeScript language extension for [Atscript](https://atscript.moost.org). Compiles `.as` files into `.d.ts` type declarations and `.js` runtime modules with full metadata, validation, and JSON Schema support.
5
+ <h1 align="center">@atscript/typescript</h1>
6
+
7
+ <p align="center">
8
+ <strong>Define your models once</strong> — get TypeScript types, runtime validation, and DB metadata from a single <code>.as</code> model.
9
+ </p>
10
+
11
+ <p align="center">
12
+ <a href="https://atscript.moost.org">Documentation</a> · <a href="https://atscript.moost.org/packages/typescript/">TypeScript Guide</a>
13
+ </p>
14
+
15
+ ---
16
+
17
+ TypeScript language extension for Atscript. Compiles `.as` files to `.d.ts` type declarations and `.js` runtime modules with validation, serialization, and JSON Schema support. Includes the `asc` CLI.
4
18
 
5
19
  ## Installation
6
20
 
@@ -8,43 +22,47 @@ TypeScript language extension for [Atscript](https://atscript.moost.org). Compil
8
22
  pnpm add @atscript/typescript @atscript/core
9
23
  ```
10
24
 
11
- For build-tool integration (Vite, Webpack, Rollup, esbuild, Rspack), also add:
25
+ ## Quick Start
12
26
 
13
27
  ```bash
14
- pnpm add unplugin-atscript
28
+ # Compile .as files to .d.ts + .js
29
+ npx asc -f js
30
+
31
+ # Diagnostics only
32
+ npx asc --noEmit
15
33
  ```
16
34
 
17
- ## AI Agent Skills
35
+ ```ts
36
+ // Runtime validation
37
+ import { Validator, buildJsonSchema } from '@atscript/typescript/utils'
38
+ import { User } from './schema/user.as'
18
39
 
19
- This package ships with structured skill files for AI coding agents (Claude Code, Cursor, Windsurf, Codex, etc.).
40
+ const errors = new Validator().validate(User, inputData)
41
+ const schema = buildJsonSchema(User)
42
+ ```
20
43
 
21
- ```bash
22
- # Project-local (recommended — version-locked, commits with your repo)
23
- npx atscript-typescript-skill
44
+ ## Features
24
45
 
25
- # Global (available across all your projects)
26
- npx atscript-typescript-skill --global
27
- ```
46
+ - Generates `.d.ts` type declarations and `.js` runtime modules from `.as` files
47
+ - CLI (`asc`) for batch compilation with diagnostics
48
+ - `Validator` class for runtime data validation against `@expect.*` constraints
49
+ - JSON Schema generation (`buildJsonSchema`) and parsing (`fromJsonSchema`)
50
+ - Serialization for JSON-safe round-trip of type definitions
51
+ - Type-safe utility types: `FlatOf<T>`, `PrimaryKeyOf<T>`, `OwnPropsOf<T>`, `NavPropsOf<T>`
52
+ - Global `atscript.d.ts` generation for typed metadata access
28
53
 
29
- To keep skills automatically up-to-date, add a postinstall script to your `package.json`:
54
+ ## AI Agent Skills
30
55
 
31
- ```json
32
- {
33
- "scripts": {
34
- "postinstall": "atscript-typescript-skill --postinstall"
35
- }
36
- }
56
+ ```bash
57
+ npx atscript-typescript-skill # Install skills locally
58
+ npx atscript-typescript-skill --global # Install globally
37
59
  ```
38
60
 
39
- ## Features
61
+ ## Documentation
40
62
 
41
- - **Type declarations** — `.d.ts` files from `.as` interfaces and types
42
- - **Runtime metadata** — `.js` files with full metadata for validators and serializers
43
- - **JSON Schema** — Build, parse, and merge JSON schemas from annotated types
44
- - **Validation** — Validate data against types with plugin support
45
- - **Serialization** — JSON-safe round-trip serialization/deserialization
46
- - **CLI** — `asc` command for compiling `.as` files
63
+ - [TypeScript Guide](https://atscript.moost.org/packages/typescript/)
64
+ - [Full Documentation](https://atscript.moost.org)
47
65
 
48
- ## Documentation
66
+ ## License
49
67
 
50
- Full documentation: [atscript.moost.org](https://atscript.moost.org)
68
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/typescript",
3
- "version": "0.1.38",
3
+ "version": "0.1.39",
4
4
  "description": "Atscript: typescript-gen support.",
5
5
  "keywords": [
6
6
  "annotations",
@@ -64,8 +64,8 @@
64
64
  "vitest": "3.2.4"
65
65
  },
66
66
  "peerDependencies": {
67
- "@atscript/core": "^0.1.38",
68
- "@atscript/db": "^0.1.38"
67
+ "@atscript/core": "^0.1.39",
68
+ "@atscript/db": "^0.1.39"
69
69
  },
70
70
  "peerDependenciesMeta": {
71
71
  "@atscript/db": {