@polyglot-bundles/th-stories 0.2.2 → 0.3.0

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,44 +1,55 @@
1
1
  # Thai Stories Bundle
2
2
 
3
- **Package:** `@polyglot/bundle-th-stories`
3
+ **Package:** `@polyglot-bundles/th-stories`
4
4
 
5
- Thai GLOST stories including Little Scoops and Graded Readers.
5
+ Thai Little Scoops stories in raw `.ink` format.
6
6
 
7
- ## Stories Included
7
+ ## Stories Included (9)
8
8
 
9
- - Work Life Balance
10
- - ซูเปอร์มาร์เก็ต (Supermarket)
11
- - Pete's Defense
12
- - Mary's Hobbies
13
- - Making Requests
14
- - Getting Breakfast
15
- - A Job Interview
16
- - วันหนึ่งที่สวนสาธารณะ (A Day at the Park)
9
+ | Slug | Story Name |
10
+ |------|-----------|
11
+ | `a-day-at-the-park` | วันหนึ่งที่สวนสาธารณะ |
12
+ | `a-job-interview` | A Job Interview |
13
+ | `getting-breakfast` | Getting Breakfast |
14
+ | `making-requests` | Making Requests |
15
+ | `marys-hobbies` | Mary's Hobbies |
16
+ | `petes-defense` | Pete's Defense |
17
+ | `supermarket` | ซูเปอร์มาร์เก็ต |
18
+ | `supermarket.test` | Supermarket (test) |
19
+ | `work-life-balance` | Work Life Balance |
17
20
 
18
21
  ## Usage
19
22
 
20
23
  ```typescript
21
- import { getAllStories, loadStory } from "@polyglot/bundle-th-stories";
22
-
23
- // Get all story metadata
24
- const stories = await getAllStories();
25
-
26
- // Load a specific story
27
- const story = await loadStory("a-day-at-the-park");
28
- console.log(story.metadata.title);
24
+ import { stories, Story } from "@polyglot-bundles/th-stories";
25
+
26
+ // All stories as raw .ink source strings
27
+ for (const story of stories) {
28
+ console.log(`${story.slug}: ${story.content.length} chars`);
29
+ }
30
+
31
+ // Type definition
32
+ interface Story {
33
+ slug: string; // filename without extension, e.g. "a-day-at-the-park"
34
+ content: string; // raw .ink source
35
+ }
29
36
  ```
30
37
 
31
38
  ## Structure
32
39
 
33
40
  ```
34
41
  src/
35
- ├── stories/ # Story JSON files (copied from lalia-prism)
36
- │ ├── *.glost.json
37
- │ └── graded-readers/
38
- ├── manifest.json # Story metadata
39
- └── index.ts # Exports
42
+ ├── stories/ # .ink source files
43
+ │ ├── *.ink
44
+ │ └── *.test.ink
45
+ ├── index.ts # Loads and exports all stories via Vite glob
46
+ └── env.d.ts # Vite client types
40
47
  ```
41
48
 
42
- ## Source
49
+ ## Import in Vite-based Projects
50
+
51
+ This package uses Vite's `import.meta.glob` to load `.ink` files at build time. The raw content is bundled directly - no runtime file system access needed.
52
+
53
+ ## Note
43
54
 
44
- This bundle is automatically synced from `lalia-prism/packages/content/th-content-stories/generated/`.
55
+ This package exports **raw `.ink` source**, not compiled GLOST JSON. Consuming projects are responsible for compiling `.ink` to GLOST format using inkjs.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@polyglot-bundles/th-stories",
3
- "version": "0.2.2",
3
+ "version": "0.3.0",
4
4
  "type": "module",
5
5
  "description": "Thai Little Scoops stories - .ink source files from polyglot-bundles",
6
6
  "main": "./src/index.ts",
@@ -25,7 +25,11 @@
25
25
  "url": "https://github.com/fustilio/polyglot-bundles",
26
26
  "directory": "packages/th/stories"
27
27
  },
28
+ "devDependencies": {
29
+ "@polyglot-bundles/lang-tooling": "0.0.0"
30
+ },
28
31
  "scripts": {
32
+ "typecheck": "tsc --noEmit",
29
33
  "build": "echo 'No build needed - source files only'",
30
34
  "clean": "echo 'No cleanup needed'"
31
35
  }
package/src/env.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ /// <reference types="vite/client" />
2
+
3
+ declare module "*.ink?raw" {
4
+ const content: string;
5
+ export default content;
6
+ }
package/src/index.ts CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * Example usage:
8
8
  * ```ts
9
- * import { stories } from '@syllst/th/stories';
9
+ * import { stories } from '@polyglot-bundles/th-stories';
10
10
  * // stories is an array of .ink source strings
11
11
  * ```
12
12
  */
@@ -16,7 +16,14 @@ export interface Story {
16
16
  content: string;
17
17
  }
18
18
 
19
- /**
20
- * Load all stories from the source directory
21
- */
22
- export const stories: Story[] = [];
19
+ // Load all .ink files from src/stories/ at build time via Vite's glob import
20
+ const modules = import.meta.glob<string>("./stories/*.ink", {
21
+ query: "?raw",
22
+ import: "default",
23
+ eager: true,
24
+ });
25
+
26
+ export const stories: Story[] = Object.entries(modules).map(([path, content]) => ({
27
+ slug: path.replace("./stories/", "").replace(".ink", ""),
28
+ content,
29
+ }));