vite-plugin-ember 0.0.0 → 0.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +121 -0
  3. package/package.json +13 -13
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Alexey Kulakov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,121 @@
1
+ # vite-plugin-ember
2
+
3
+ [![CI](https://github.com/aklkv/vite-plugin-ember/actions/workflows/ci.yml/badge.svg)](https://github.com/aklkv/vite-plugin-ember/actions/workflows/ci.yml)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](./LICENSE)
5
+
6
+ A [Vite](https://vitejs.dev/) plugin that lets you render live, interactive [Ember](https://emberjs.com/) components inside [VitePress](https://vitepress.dev/) documentation pages.
7
+
8
+ Write `.gjs` / `.gts` code fences in markdown and see them rendered on the page — no full Ember app required.
9
+
10
+ **[View the live documentation →](https://aklkv.github.io/vite-plugin-ember/)**
11
+
12
+ ## Features
13
+
14
+ - **Inline code fences** — use ` ```gjs live ` in markdown for instant interactive previews
15
+ - **Full Ember support** — class components, `@tracked` state, `{{on}}` modifier, and TypeScript via `.gts`
16
+ - **Zero-config compilation** — content-tag preprocessing, Babel template compilation, decorator transforms, and `@ember/*` / `@glimmer/*` module resolution handled automatically
17
+ - **`@embroider/macros` shim** — runtime stubs so `ember-source` ESM imports just work
18
+ - **Vue wrapper** — ships a `<CodePreview>` component for seamless VitePress integration
19
+
20
+ ## Quick Start
21
+
22
+ ### 1. Install
23
+
24
+ ```sh
25
+ pnpm add vite-plugin-ember ember-source @glimmer/component
26
+ ```
27
+
28
+ ### 2. Configure VitePress
29
+
30
+ ```ts
31
+ // .vitepress/config.ts
32
+ import { defineConfig } from 'vitepress';
33
+ import vitePluginEmber, { emberFence } from 'vite-plugin-ember';
34
+
35
+ export default defineConfig({
36
+ vite: {
37
+ plugins: [vitePluginEmber()],
38
+ },
39
+ markdown: {
40
+ config(md) {
41
+ emberFence(md);
42
+ },
43
+ },
44
+ });
45
+ ```
46
+
47
+ ### 3. Register the component
48
+
49
+ ```ts
50
+ // .vitepress/theme/index.ts
51
+ import DefaultTheme from 'vitepress/theme';
52
+ import CodePreview from 'vite-plugin-ember/components/code-preview.vue';
53
+ import type { Theme } from 'vitepress';
54
+
55
+ export default {
56
+ ...DefaultTheme,
57
+ enhanceApp({ app }) {
58
+ app.component('CodePreview', CodePreview);
59
+ },
60
+ } satisfies Theme;
61
+ ```
62
+
63
+ ### 4. Write a live demo
64
+
65
+ In any markdown file:
66
+
67
+ ````md
68
+ ```gjs live
69
+ import Component from '@glimmer/component';
70
+ import { tracked } from '@glimmer/tracking';
71
+ import { on } from '@ember/modifier';
72
+
73
+ export default class Counter extends Component {
74
+ @tracked count = 0;
75
+
76
+ increment = () => { this.count += 1; };
77
+
78
+ <template>
79
+ <button {{on "click" this.increment}}>
80
+ Clicked {{this.count}} times
81
+ </button>
82
+ </template>
83
+ }
84
+ ```
85
+ ````
86
+
87
+ Start the dev server with `pnpm dev` and see it live.
88
+
89
+ ## Documentation
90
+
91
+ Full docs (built with this plugin!) are in the [`docs/`](./docs) directory. Run locally:
92
+
93
+ ```sh
94
+ pnpm install
95
+ pnpm dev
96
+ ```
97
+
98
+ ## Project Structure
99
+
100
+ ````text
101
+ ├── vite-plugin-ember/ # The Vite plugin (publishable package)
102
+ │ └── src/
103
+ │ ├── index.ts # Plugin + Ember compilation pipeline
104
+ │ └── vitepress/
105
+ │ ├── ember-fence.ts # markdown-it plugin for ```gjs live fences
106
+ │ └── code-preview.vue # Vue wrapper component
107
+ ├── docs/ # VitePress documentation site
108
+ │ ├── demos/ # .gjs/.gts demo components
109
+ │ └── guide/ # Documentation pages
110
+ ├── package.json # Workspace root
111
+ └── pnpm-workspace.yaml
112
+ ````
113
+
114
+ ## Requirements
115
+
116
+ - Node.js ≥ 20
117
+ - pnpm ≥ 10
118
+
119
+ ## License
120
+
121
+ [MIT](./LICENSE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plugin-ember",
3
- "version": "0.0.0",
3
+ "version": "0.0.3",
4
4
  "description": "Vite plugin for rendering live Ember components in VitePress documentation",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -42,18 +42,6 @@
42
42
  "dist",
43
43
  "src/vitepress/code-preview.vue"
44
44
  ],
45
- "scripts": {
46
- "build": "tsc -p tsconfig.json",
47
- "lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
48
- "lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
49
- "lint:js": "eslint .",
50
- "lint:js:fix": "eslint . --fix",
51
- "lint:format": "prettier . --cache --check",
52
- "lint:format:fix": "prettier . --cache --write",
53
- "lint:types": "tsc --noEmit",
54
- "format": "prettier . --cache --write",
55
- "format:check": "prettier . --cache --check"
56
- },
57
45
  "dependencies": {
58
46
  "@babel/core": "^7.29.0",
59
47
  "@babel/plugin-transform-typescript": "^7.28.6",
@@ -82,5 +70,17 @@
82
70
  "vite": ">=5",
83
71
  "vitepress": ">=1",
84
72
  "vue": ">=3"
73
+ },
74
+ "scripts": {
75
+ "build": "tsc -p tsconfig.json",
76
+ "lint": "concurrently 'npm:lint:*(!fix)' --names 'lint:'",
77
+ "lint:fix": "concurrently 'npm:lint:*:fix' --names 'fix:'",
78
+ "lint:js": "eslint .",
79
+ "lint:js:fix": "eslint . --fix",
80
+ "lint:format": "prettier . --cache --check",
81
+ "lint:format:fix": "prettier . --cache --write",
82
+ "lint:types": "tsc --noEmit",
83
+ "format": "prettier . --cache --write",
84
+ "format:check": "prettier . --cache --check"
85
85
  }
86
86
  }