mikuru 1.0.2 → 1.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.0.3
4
+
5
+ - Added `mikuru/env` for package-provided `.mikuru` TypeScript declarations.
6
+
3
7
  ## 1.0.2
4
8
 
5
9
  - Reworked the README for npm package consumers with CLI-first setup, Vite integration, package exports, TypeScript declarations, and v1 limits.
package/README.md CHANGED
@@ -20,7 +20,7 @@ npm install
20
20
  npm run dev
21
21
  ```
22
22
 
23
- The generated starter includes Vite, TypeScript, a `.mikuru` module declaration, and a welcome component at `src/App.mikuru`.
23
+ The generated starter includes Vite, TypeScript, the package-provided `.mikuru` module declaration, and a welcome component at `src/App.mikuru`.
24
24
 
25
25
  ## Add Mikuru to a Vite App
26
26
 
@@ -82,26 +82,10 @@ mount(app);
82
82
 
83
83
  ## TypeScript Declarations
84
84
 
85
- Until Mikuru ships global `.mikuru` declarations, add a local declaration file such as `src/mikuru-env.d.ts`:
85
+ For TypeScript projects, add a local declaration file such as `src/mikuru-env.d.ts` that imports Mikuru's package-provided `.mikuru` module declaration:
86
86
 
87
87
  ```ts
88
- declare module "*.mikuru" {
89
- export type MikuruComponentInstance = {
90
- element: Element | Comment;
91
- unmount(): void;
92
- };
93
-
94
- export function mount(
95
- target: Element | DocumentFragment,
96
- props?: Record<string, unknown>
97
- ): MikuruComponentInstance;
98
-
99
- const component: {
100
- mount: typeof mount;
101
- };
102
-
103
- export default component;
104
- }
88
+ import "mikuru/env";
105
89
  ```
106
90
 
107
91
  ## Supported v1 Surface
@@ -132,6 +116,12 @@ The Vite plugin is available from `mikuru/vite`:
132
116
  import { mikuru } from "mikuru/vite";
133
117
  ```
134
118
 
119
+ The `.mikuru` TypeScript declaration is available from `mikuru/env`:
120
+
121
+ ```ts
122
+ import "mikuru/env";
123
+ ```
124
+
135
125
  Compiler and runtime entries are public for lower-level integrations:
136
126
 
137
127
  ```ts
package/dist/env.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/env.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"env.js","sourceRoot":"","sources":["../src/env.ts"],"names":[],"mappings":""}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mikuru",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "description": "A compile-first JavaScript framework with Vue-like authoring and Svelte-like generated DOM updates.",
@@ -25,6 +25,10 @@
25
25
  "types": "./dist/runtime/index.d.ts",
26
26
  "default": "./dist/runtime/index.js"
27
27
  },
28
+ "./env": {
29
+ "types": "./types/env.d.ts",
30
+ "default": "./dist/env.js"
31
+ },
28
32
  "./vite": {
29
33
  "types": "./dist/vite.d.ts",
30
34
  "default": "./dist/vite.js"
@@ -35,6 +39,7 @@
35
39
  },
36
40
  "files": [
37
41
  "dist",
42
+ "types",
38
43
  "templates",
39
44
  "README.md",
40
45
  "CHANGELOG.md"
@@ -9,7 +9,7 @@
9
9
  "preview": "vite preview"
10
10
  },
11
11
  "dependencies": {
12
- "mikuru": "^1.0.2"
12
+ "mikuru": "^1.0.3"
13
13
  },
14
14
  "devDependencies": {
15
15
  "typescript": "^6.0.3",
@@ -1,17 +1 @@
1
- declare module "*.mikuru" {
2
- export type MikuruComponentInstance = {
3
- element: Element | Comment;
4
- unmount(): void;
5
- };
6
-
7
- export function mount(
8
- target: Element | DocumentFragment,
9
- props?: Record<string, unknown>
10
- ): MikuruComponentInstance;
11
-
12
- const component: {
13
- mount: typeof mount;
14
- };
15
-
16
- export default component;
17
- }
1
+ import "mikuru/env";
package/types/env.d.ts ADDED
@@ -0,0 +1,29 @@
1
+ type EnvMikuruComponentInstance = {
2
+ element: Element | Comment;
3
+ unmount(): void;
4
+ };
5
+
6
+ type EnvMikuruMount = (
7
+ target: Element | DocumentFragment,
8
+ props?: Record<string, unknown>
9
+ ) => EnvMikuruComponentInstance;
10
+
11
+ type EnvMikuruComponent = {
12
+ mount: EnvMikuruMount;
13
+ };
14
+
15
+ declare module "mikuru/env" {
16
+ export type MikuruComponentInstance = EnvMikuruComponentInstance;
17
+ export type MikuruMount = EnvMikuruMount;
18
+ export type MikuruComponent = EnvMikuruComponent;
19
+ }
20
+
21
+ declare module "*.mikuru" {
22
+ export function mount(
23
+ target: Element | DocumentFragment,
24
+ props?: Record<string, unknown>
25
+ ): EnvMikuruComponentInstance;
26
+
27
+ const component: EnvMikuruComponent;
28
+ export default component;
29
+ }