@polyglot-bundles/th-stories 0.2.2 → 0.2.3
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/package.json +5 -1
- package/src/env.d.ts +6 -0
- package/src/index.ts +12 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polyglot-bundles/th-stories",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
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
package/src/index.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Example usage:
|
|
8
8
|
* ```ts
|
|
9
|
-
* import { stories } from '@
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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
|
+
}));
|