@typra/emitter 0.2.0 → 0.2.2

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 ADDED
@@ -0,0 +1,30 @@
1
+ # @typra/emitter
2
+
3
+ Generic TypeSpec emitter for generating multi-runtime model, protocol, test,
4
+ JSON AST, and documentation surfaces from TypeSpec.
5
+
6
+ ## Install
7
+
8
+ ```powershell
9
+ npm install --save-dev @typra/emitter
10
+ ```
11
+
12
+ ## CLI
13
+
14
+ The package includes the `typra-generate` command:
15
+
16
+ ```powershell
17
+ npx typra-generate --help
18
+ ```
19
+
20
+ ## TypeSpec emitter
21
+
22
+ Use `@typra/emitter` from TypeSpec configuration to generate runtime surfaces.
23
+ The first Typra fixture slice validates TypeScript and JSON AST generation from
24
+ synthetic TypeSpec shapes.
25
+
26
+ ## Publishing
27
+
28
+ This package is published from GitHub Actions using npm Trusted
29
+ Publishing/OIDC. Do not use an `NPM_TOKEN` secret for the trusted-publishing
30
+ path.
@@ -1,43 +1,43 @@
1
- import "@typra/emitter";
2
-
3
- namespace Typra.Fixtures;
4
-
5
- model FixtureRoot {
6
- @doc("Required scalar field")
7
- name: string;
8
-
9
- @doc("Optional scalar field")
10
- description?: string;
11
-
12
- @doc("Array of scalar tags")
13
- tags: string[];
14
-
15
- @doc("Dictionary-shaped metadata")
16
- metadata?: Record<unknown>;
17
-
18
- @doc("Nested object field")
19
- owner: FixtureOwner;
20
-
21
- @doc("Discriminated union field")
22
- content: FixtureContent;
23
- }
24
-
25
- model FixtureOwner {
26
- id: string;
27
- displayName?: string;
28
- }
29
-
30
- @discriminator("kind")
31
- model FixtureContent {
32
- kind: string;
33
- }
34
-
35
- model TextContent extends FixtureContent {
36
- kind: "text";
37
- text: string;
38
- }
39
-
40
- model ImageContent extends FixtureContent {
41
- kind: "image";
42
- url: string;
43
- }
1
+ import "@typra/emitter";
2
+
3
+ namespace Typra.Fixtures;
4
+
5
+ model FixtureRoot {
6
+ @doc("Required scalar field")
7
+ name: string;
8
+
9
+ @doc("Optional scalar field")
10
+ description?: string;
11
+
12
+ @doc("Array of scalar tags")
13
+ tags: string[];
14
+
15
+ @doc("Dictionary-shaped metadata")
16
+ metadata?: Record<unknown>;
17
+
18
+ @doc("Nested object field")
19
+ owner: FixtureOwner;
20
+
21
+ @doc("Discriminated union field")
22
+ content: FixtureContent;
23
+ }
24
+
25
+ model FixtureOwner {
26
+ id: string;
27
+ displayName?: string;
28
+ }
29
+
30
+ @discriminator("kind")
31
+ model FixtureContent {
32
+ kind: string;
33
+ }
34
+
35
+ model TextContent extends FixtureContent {
36
+ kind: "text";
37
+ text: string;
38
+ }
39
+
40
+ model ImageContent extends FixtureContent {
41
+ kind: "image";
42
+ url: string;
43
+ }
@@ -1,13 +1,13 @@
1
- emit:
2
- - "@typra/emitter"
3
- options:
4
- "@typra/emitter":
5
- emitter-output-dir: "{cwd}/generated/fixtures"
6
- root-object: "Typra.Fixtures.FixtureRoot"
7
- root-namespace: "Typra.Fixtures"
8
- emit-targets:
9
- - type: TypeScript
10
- output-dir: "generated/fixtures/typescript"
11
- test-dir: "generated/fixtures/typescript/tests"
12
- import-path: "../index"
13
- format: false
1
+ emit:
2
+ - "@typra/emitter"
3
+ options:
4
+ "@typra/emitter":
5
+ emitter-output-dir: "{cwd}/generated/fixtures"
6
+ root-object: "Typra.Fixtures.FixtureRoot"
7
+ root-namespace: "Typra.Fixtures"
8
+ emit-targets:
9
+ - type: TypeScript
10
+ output-dir: "generated/fixtures/typescript"
11
+ test-dir: "generated/fixtures/typescript/tests"
12
+ import-path: "../index"
13
+ format: false
package/package.json CHANGED
@@ -1,18 +1,19 @@
1
1
  {
2
2
  "name": "@typra/emitter",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Generic TypeSpec emitter for generating multi-runtime model surfaces",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
8
- "url": "https://github.com/sethjuarez/typra"
8
+ "url": "git+https://github.com/sethjuarez/typra.git",
9
+ "directory": "packages/typra-emitter"
9
10
  },
10
11
  "type": "module",
11
12
  "main": "dist/src/index.js",
12
13
  "types": "dist/src/index.d.ts",
13
14
  "tspMain": "src/lib/main.tsp",
14
15
  "bin": {
15
- "typra-generate": "./dist/src/cli.js"
16
+ "typra-generate": "dist/src/cli.js"
16
17
  },
17
18
  "exports": {
18
19
  ".": {
@@ -29,6 +30,7 @@
29
30
  }
30
31
  },
31
32
  "files": [
33
+ "README.md",
32
34
  "dist/src/**/*.js",
33
35
  "dist/src/**/*.d.ts",
34
36
  "dist/src/**/*.json",
@@ -43,7 +45,6 @@
43
45
  },
44
46
  "devDependencies": {
45
47
  "@types/node": "^24.7.0",
46
-
47
48
  "@typescript-eslint/eslint-plugin": "^8.15.0",
48
49
  "@typescript-eslint/parser": "^8.15.0",
49
50
  "@typespec/compiler": "latest",
@@ -69,8 +70,7 @@
69
70
  },
70
71
  "packageManager": "npm@11.5.1+sha512.232e6f5d9e799bcb486920b3e9ba907fdf96e576cf7e8c9446c8162e33a416096a1d37a9e910d9a918f6b1f606791c99bc6bb61ee2569b496ec74af13d0dbd95",
71
72
  "dependencies": {
72
-
73
73
  "xml-formatter": "^3.6.7",
74
74
  "yaml": "^2.8.1"
75
75
  }
76
- }
76
+ }