mikuru 1.0.1 → 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,20 +1,30 @@
1
- # Changelog
2
-
3
- ## 1.0.1
4
-
5
- - Added the `mikuru` CLI with `mikuru create [project-name]`.
6
- - Added a Vite starter template that shows a Mikuru welcome screen and counter after setup.
7
- - Added create CLI smoke coverage and included it in CI.
8
-
9
- ## 1.0.0
10
-
11
- - Stabilized the v1 SFC compiler surface for `.mikuru` files.
1
+ # Changelog
2
+
3
+ ## 1.0.3
4
+
5
+ - Added `mikuru/env` for package-provided `.mikuru` TypeScript declarations.
6
+
7
+ ## 1.0.2
8
+
9
+ - Reworked the README for npm package consumers with CLI-first setup, Vite integration, package exports, TypeScript declarations, and v1 limits.
10
+ - Updated npm usage docs and release documentation to match the published package contents.
11
+ - Updated the starter template to depend on `mikuru@^1.0.2`.
12
+
13
+ ## 1.0.1
14
+
15
+ - Added the `mikuru` CLI with `mikuru create [project-name]`.
16
+ - Added a Vite starter template that shows a Mikuru welcome screen and counter after setup.
17
+ - Added create CLI smoke coverage and included it in CI.
18
+
19
+ ## 1.0.0
20
+
21
+ - Stabilized the v1 SFC compiler surface for `.mikuru` files.
12
22
  - Added Vite integration, generated DOM cleanup, component props/events/slots, `defineProps`, and `defineEmits`.
13
23
  - Added `v-if` / `v-else-if` / `v-else`, `v-show`, `v-for`, `v-model`, DOM event modifiers, style injection, and basic scoped CSS support.
14
24
  - Added CI, library build checks, basic example build checks, and browser E2E coverage.
15
25
  - Added a realworld example, public package smoke test, parser-limit coverage, debug sourceURL support, and performance smoke coverage.
16
- - Added v3 source maps, keyed `v-for` reuse, npm pack smoke coverage, and a v1 API contract.
17
- - Added a dogfood notes app written in Mikuru to exercise daily authoring flows.
18
- - Added generated DOM coverage for keyed insert/remove/reorder behavior, component cleanup, and slot cleanup.
19
- - Added explicit unsupported-syntax errors with source frames, Vite error forwarding coverage, and debug `sourceURL` path normalization coverage.
20
- - Documented runtime helpers including `nextTick`, `watch`, lifecycle callbacks, `provide`, and `inject`.
26
+ - Added v3 source maps, keyed `v-for` reuse, npm pack smoke coverage, and a v1 API contract.
27
+ - Added a dogfood notes app written in Mikuru to exercise daily authoring flows.
28
+ - Added generated DOM coverage for keyed insert/remove/reorder behavior, component cleanup, and slot cleanup.
29
+ - Added explicit unsupported-syntax errors with source frames, Vite error forwarding coverage, and debug `sourceURL` path normalization coverage.
30
+ - Documented runtime helpers including `nextTick`, `watch`, lifecycle callbacks, `provide`, and `inject`.
package/README.md CHANGED
@@ -1,18 +1,48 @@
1
1
  # Mikuru
2
2
 
3
- Mikuruは、Vueの書き心地を残しながら、Svelte寄りにDOM更新コードを生成するコンパイル型JavaScriptフレームワークです。
3
+ Mikuru is a compile-first JavaScript framework for Vue-like single-file components that generate direct DOM update code instead of using a virtual DOM.
4
4
 
5
- Vueのように単一ファイルコンポーネントと宣言的なテンプレートで書き、Svelteのようにビルド時にテンプレートを解析して、仮想DOMに依存しない小さなJavaScriptへ変換することを目指します。
5
+ It is intentionally small. Mikuru v1 is a practical validation release for writing `.mikuru` components in Vite apps, not a Vue compatibility layer.
6
6
 
7
- ## 目標
7
+ ## Requirements
8
8
 
9
- - `.mikuru` ファイルでコンポーネントを書く。
10
- - `<template>` / `<script>` / `<style>` のSFC構造を使う。
11
- - `ref`、`computed`、`effect` 風の小さなリアクティビティを提供する。
12
- - `{{ value }}`、`@click` / `v-on:click`、`:class` / `v-bind:class`、`v-if`、`v-for` のようなVue風テンプレート構文を使う。
13
- - コンパイラが更新箇所を静的に把握し、直接DOMを更新するコードを生成する。
9
+ - Node.js 22 or newer
10
+ - Vite 8 or newer for app development
14
11
 
15
- ## 最小サンプル
12
+ ## Create a New App
13
+
14
+ The fastest way to try Mikuru is the package CLI:
15
+
16
+ ```sh
17
+ npx mikuru create my-app
18
+ cd my-app
19
+ npm install
20
+ npm run dev
21
+ ```
22
+
23
+ The generated starter includes Vite, TypeScript, the package-provided `.mikuru` module declaration, and a welcome component at `src/App.mikuru`.
24
+
25
+ ## Add Mikuru to a Vite App
26
+
27
+ Install Mikuru and the Vite tooling:
28
+
29
+ ```sh
30
+ npm install mikuru
31
+ npm install -D vite typescript
32
+ ```
33
+
34
+ Configure Vite:
35
+
36
+ ```ts
37
+ import { defineConfig } from "vite";
38
+ import { mikuru } from "mikuru/vite";
39
+
40
+ export default defineConfig({
41
+ plugins: [mikuru()]
42
+ });
43
+ ```
44
+
45
+ Create a `.mikuru` component:
16
46
 
17
47
  ```mikuru
18
48
  <template>
@@ -36,120 +66,114 @@ button {
36
66
  </style>
37
67
  ```
38
68
 
39
- このコンポーネントは、概念的に次のようなJavaScript moduleへ変換されます。
69
+ Mount it from your app entry:
40
70
 
41
- ```js
42
- import { ref, effect } from "mikuru/runtime";
71
+ ```ts
72
+ import { mount } from "./App.mikuru";
43
73
 
44
- export function mount(target) {
45
- const count = ref(0);
46
- const button = document.createElement("button");
74
+ const app = document.querySelector("#app");
47
75
 
48
- function increment() {
49
- count.value += 1;
50
- }
76
+ if (!app) {
77
+ throw new Error("Missing #app");
78
+ }
51
79
 
52
- button.addEventListener("click", increment);
80
+ mount(app);
81
+ ```
53
82
 
54
- effect(() => {
55
- button.textContent = `count: ${count.value}`;
56
- });
83
+ ## TypeScript Declarations
57
84
 
58
- target.appendChild(button);
59
- }
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
+
87
+ ```ts
88
+ import "mikuru/env";
60
89
  ```
61
90
 
62
- ## v1範囲
91
+ ## Supported v1 Surface
63
92
 
64
- v1の成功条件は、Vue風の小さなSFC体験をVite上で実用的に書け、ブラウザで安定して動かせることです。最初のカウンターMVPは土台として維持し、v1では親子コンポーネント、フォーム入力、条件分岐、リスト表示、style注入までを公開対象として固定します。
93
+ - `.mikuru` SFCs with `<template>`, `<script>`, and `<style>`
94
+ - Vite plugin support through `mikuru/vite`
95
+ - Template interpolation with `{{ value }}`
96
+ - DOM events with `@click`, `v-on:click`, `.prevent`, and `.stop`
97
+ - Attribute bindings with `:class` and `v-bind:class`
98
+ - `v-if`, `v-else-if`, `v-else`, `v-show`, and `v-for`
99
+ - `v-model` for common form controls and child components
100
+ - Component props, events, `defineProps`, `defineEmits`, and default slots
101
+ - Runtime helpers including `ref`, `computed`, `effect`, `watch`, `nextTick`, lifecycle callbacks, `provide`, and `inject`
102
+ - Style injection and basic `<style scoped>` selector rewriting
103
+ - Compile errors with filenames, line/column information, and code frames
65
104
 
66
- v1では次の機能を対象にします。
105
+ ## Package Exports
67
106
 
68
- - SFC分割: `<template>`、`<script>`、`<style>`
69
- - Vite plugin: `.mikuru` importをJavaScript moduleへ変換
70
- - テキスト補間: `{{ count }}`
71
- - イベント: `@click="increment"`、`v-on:click="increment"`、DOMイベントの `.prevent` / `.stop`
72
- - 属性バインド: `:class="className"`、`v-bind:class="className"`
73
- - class正規化: `:class="['base', { active }]"` の配列・オブジェクト形式
74
- - フォーム同期: `input` / `textarea` / `checkbox` / `select` の `v-model`
75
- - 条件分岐: `v-if` / `v-else-if` / `v-else`
76
- - 表示切り替え: `v-show="visible"`
77
- - 繰り返し: `v-for="item in items"`、`v-for="(item, index) in items"`、`of` エイリアス
78
- - コンポーネント合成: `<Child :count="count" @select="select" />` のprops/event受け渡し、`v-model`
79
- - default slot: `<Panel>content</Panel>` と子側の `<slot />`
80
- - props宣言: `const { title } = defineProps()` のコンパイル専用API
81
- - emits宣言: `const emit = defineEmits()` で親の `@event` ハンドラを呼び出し
82
- - style注入: `<style>` をmount時に一度だけdocumentへ追加し、`<style scoped>` の基本セレクタを書き換える
83
- - unmount: 生成コンポーネントがイベント、effect、子コンポーネントを破棄する
84
- - パーサ強化: コメント、シングルクォート属性、属性値内の `>`、void要素に対応
85
- - 式検証: テンプレート式をExpressionとして検証し、文や代入など危険な構文を拒否
86
- - エラー表示: コンパイルエラーにファイル名、行、列、コードフレームを付与
87
- - 小さなランタイム: `ref`、`computed`、`effect`
107
+ Application code usually imports from `mikuru`:
88
108
 
89
- ## v1の非目標
109
+ ```ts
110
+ import { computed, ref } from "mikuru";
111
+ ```
112
+
113
+ The Vite plugin is available from `mikuru/vite`:
114
+
115
+ ```ts
116
+ import { mikuru } from "mikuru/vite";
117
+ ```
118
+
119
+ The `.mikuru` TypeScript declaration is available from `mikuru/env`:
120
+
121
+ ```ts
122
+ import "mikuru/env";
123
+ ```
124
+
125
+ Compiler and runtime entries are public for lower-level integrations:
126
+
127
+ ```ts
128
+ import { compile } from "mikuru/compiler";
129
+ import { effect, nextTick, ref, unwrap, watch } from "mikuru/runtime";
130
+ ```
90
131
 
91
- MikuruはVue完全互換を目指しません。SSR、hydration、transition、devtools、完全なテンプレート型チェック、Vue互換を名乗るための広範な仕様追従はv1後に検討します。scoped CSSはv1では基本セレクタのみを対象にし、`:global()`、深いセレクタ、複雑なネスト規則は後続課題です。
132
+ The package also provides the `mikuru` binary:
92
133
 
93
- ## 開発
134
+ ```sh
135
+ npx mikuru create my-app
136
+ ```
137
+
138
+ ## Not Included in v1
139
+
140
+ Mikuru does not claim Vue compatibility. The v1 package does not include SSR, hydration, transitions, devtools, named slots, slot props, dynamic components, `v-html`, object-form `v-bind` / `v-on`, or full template type checking.
141
+
142
+ Scoped CSS is a basic selector rewrite, not a full CSS compiler. Avoid relying on `:global()`, deep selectors, complex nesting, CSS Modules, or preprocessors in v1.
143
+
144
+ ## Repository Development
145
+
146
+ For local framework development:
94
147
 
95
148
  ```sh
96
149
  npm install
97
150
  npm run ci
98
151
  ```
99
152
 
100
- 個別に確認する場合は次を使います。
153
+ Useful targeted checks:
101
154
 
102
155
  ```sh
103
156
  npm run typecheck
104
157
  npm test
105
158
  npm run build
106
- npm run build:basic
107
- npm run build:realworld
108
- npm run build:dogfood
109
- npm run test:package
110
- npm run test:pack
111
- npm run test:e2e
112
- npm run test:e2e:dogfood
113
- ```
114
-
115
- 公式exampleはViteで起動できます。
159
+ npm run test:create
160
+ npm run test:package
161
+ npm run test:pack
162
+ npm run test:e2e
163
+ ```
116
164
 
117
- ```sh
118
- npm run dev:basic
119
- npm run dev:realworld
120
- npm run dev:dogfood
121
- ```
122
-
123
- 用途は次の通りです。
124
-
125
- - `examples/basic`: カウンター、props/events、component `v-model`、default slot の最小確認
126
- - `examples/realworld`: 検索、フォーム、keyed list を含むアプリ風の検証
127
- - `examples/dogfood`: Mikuru自身で書いた notes app による日常的な書き心地の検証
128
- - `examples/mikuru-sample` / `examples/mikuru-vue-like`: 追加の手書きDOM/runtimeサンプル
129
-
130
- 表示するときは、ブラウザで example の `index.html` を直接開かず、Viteが表示するローカルURLを開いてください。`.ts` と `.mikuru` はVite pluginで変換されます。
131
-
132
- exampleを本番ビルドする場合は次を使います。
165
+ Examples can be run from the repository root:
133
166
 
134
167
  ```sh
135
- npm run build:basic
136
- npm run build:realworld
137
- npm run build:dogfood
168
+ npm run dev:basic
169
+ npm run dev:realworld
170
+ npm run dev:dogfood
171
+ npm run dev:mikuru-sample
172
+ npm run dev:mikuru-vue-like
138
173
  ```
139
174
 
140
- ## 補足
141
-
142
- Mikuru v1は、Vue完全互換ではなく小さなVue風SFCサブセットです。設計文書、対応構文、非対応構文、リリース前チェック項目などの詳細文書は内部資料として扱います。
143
-
144
- ## Starter
145
-
146
- 新しいMikuruアプリはCLIから作成できます。
147
-
148
- ```sh
149
- npx mikuru create my-app
150
- cd my-app
151
- npm install
152
- npm run dev
153
- ```
154
-
155
- 生成されるスターターは、Viteの初期画面のようにMikuruのウェルカム画面を表示します。`src/App.mikuru` を編集するとHMRで画面が更新されます。
175
+ ## Documentation
176
+
177
+ - `CHANGELOG.md` lists published package changes.
178
+ - `docs/npm-usage.md` shows a manual Vite setup for package consumers.
179
+ - `docs/v1-api-contract.md` describes the v1 compatibility boundary used by this repository.
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.1",
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.1"
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
+ }