@emberkit/core 0.1.2-alpha.0 → 0.2.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 +73 -0
- package/dist/markdown/index.js +10 -8
- package/dist/runtime/helpers/render.js +24 -10
- package/dist/vite-plugin/index.js +147 -21
- package/package.json +15 -10
- package/LICENSE +0 -199
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# @emberkit/core
|
|
2
|
+
|
|
3
|
+
The core runtime for EmberKit — a minimalist, TypeScript-first JSX framework built for speed, minimal bundle size, and zero JavaScript by default.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @emberkit/core
|
|
9
|
+
# or
|
|
10
|
+
pnpm add @emberkit/core
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## What's Included
|
|
14
|
+
|
|
15
|
+
- **Runtime** — `createElement`, `render`, `hydrate`
|
|
16
|
+
- **Signals** — `createSignal`, `createMemo`, `createEffect`, `batch`, `untrack`
|
|
17
|
+
- **Context** — `createContext`, `useContext`
|
|
18
|
+
- **Navigation** — `navigate`, `preload`, `useNavigate`
|
|
19
|
+
- **Router** — `createRouter`, `matchRoute`
|
|
20
|
+
- **SSR** — `renderToString`, `createHtmlDocument`
|
|
21
|
+
- **Meta/SEO** — `Head` component, `generateMeta`, `generateBreadcrumbs`
|
|
22
|
+
- **Markdown** — `parseMarkdown`, `renderMarkdown`, `createMarkdownParser`
|
|
23
|
+
- **MDX** — `compileMDX`, `compileSync`, `useMDX`
|
|
24
|
+
- **Boundaries** — `createErrorBoundary`, `createLoadingBoundary`
|
|
25
|
+
- **Cache** — `DataCache`, `createCache`, `prefetch`
|
|
26
|
+
- **Vite Plugin** — `emberkitVitePlugin` (import from `@emberkit/core/vite-plugin`)
|
|
27
|
+
- **JSX Runtime** — `@emberkit/core/jsx-runtime` and `@emberkit/core/jsx-dev-runtime`
|
|
28
|
+
|
|
29
|
+
## Quick Start
|
|
30
|
+
|
|
31
|
+
```tsx
|
|
32
|
+
import { render, createSignal } from '@emberkit/core';
|
|
33
|
+
|
|
34
|
+
function Counter() {
|
|
35
|
+
const [count, setCount] = createSignal(0);
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<button onClick={() => setCount(c => c + 1)}>
|
|
39
|
+
Count: {count()}
|
|
40
|
+
</button>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
render(<Counter />, document.getElementById('app'));
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Configuration
|
|
48
|
+
|
|
49
|
+
```ts
|
|
50
|
+
// emberkit.config.ts
|
|
51
|
+
import { defineConfig } from '@emberkit/core';
|
|
52
|
+
|
|
53
|
+
export default defineConfig({
|
|
54
|
+
mode: 'ssr',
|
|
55
|
+
build: { target: 'esnext' },
|
|
56
|
+
});
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Vite Plugin
|
|
60
|
+
|
|
61
|
+
```ts
|
|
62
|
+
// vite.config.ts
|
|
63
|
+
import { defineConfig } from 'vite';
|
|
64
|
+
import { emberkitVitePlugin } from '@emberkit/core/vite-plugin';
|
|
65
|
+
|
|
66
|
+
export default defineConfig({
|
|
67
|
+
plugins: [emberkitVitePlugin()],
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
Apache-2.0
|
package/dist/markdown/index.js
CHANGED
|
@@ -52,8 +52,14 @@ class MarkdownParser {
|
|
|
52
52
|
return markdown.replace(/^---\n[\s\S]*?\n---\n?/, '');
|
|
53
53
|
}
|
|
54
54
|
renderMarkdown(content) {
|
|
55
|
-
|
|
56
|
-
|
|
55
|
+
// Step 1: Extract all fenced code blocks before any markdown processing
|
|
56
|
+
const codeBlocks = [];
|
|
57
|
+
let html = content.replace(/```(\w*)\n([\s\S]*?)```/g, (_match, lang, code) => {
|
|
58
|
+
const escaped = this.escapeHtml(code.trim());
|
|
59
|
+
codeBlocks.push(`<pre><code class="language-${lang}">${escaped}</code></pre>`);
|
|
60
|
+
return `\n__CODE_BLOCK_${codeBlocks.length - 1}__\n`;
|
|
61
|
+
});
|
|
62
|
+
// Step 2: Process all other markdown
|
|
57
63
|
html = this.processHeadings(html);
|
|
58
64
|
html = this.processHorizontalRules(html);
|
|
59
65
|
html = this.processLists(html);
|
|
@@ -65,14 +71,10 @@ class MarkdownParser {
|
|
|
65
71
|
html = this.processEmphasis(html);
|
|
66
72
|
html = this.processLineBreaks(html);
|
|
67
73
|
html = this.processComponents(html);
|
|
74
|
+
// Step 3: Restore code blocks
|
|
75
|
+
html = html.replace(/__CODE_BLOCK_(\d+)__/g, (_, index) => codeBlocks[Number(index)]);
|
|
68
76
|
return html;
|
|
69
77
|
}
|
|
70
|
-
processCodeBlocks(html) {
|
|
71
|
-
return html.replace(/```(\w*)\n([\s\S]*?)```/g, (_match, lang, code) => {
|
|
72
|
-
const escaped = this.escapeHtml(code.trim());
|
|
73
|
-
return `<pre><code class="language-${lang}">${escaped}</code></pre>`;
|
|
74
|
-
});
|
|
75
|
-
}
|
|
76
78
|
processHeadings(html) {
|
|
77
79
|
return html.replace(/^(#{1,6})\s+(.+)$/gm, (_match, hashes, text) => {
|
|
78
80
|
const level = hashes.length;
|
|
@@ -3,6 +3,8 @@ const SELF_CLOSING_TAGS = new Set([
|
|
|
3
3
|
]);
|
|
4
4
|
let handlerCounter = 0;
|
|
5
5
|
const handlerRegistry = new Map();
|
|
6
|
+
let renderDepth = 0;
|
|
7
|
+
const MAX_RENDER_DEPTH = 100;
|
|
6
8
|
export function getHandler(id) {
|
|
7
9
|
return handlerRegistry.get(id);
|
|
8
10
|
}
|
|
@@ -13,9 +15,16 @@ export function clearHandlers() {
|
|
|
13
15
|
export function renderElementToHTML(element) {
|
|
14
16
|
if (!element)
|
|
15
17
|
return '';
|
|
18
|
+
if (renderDepth > MAX_RENDER_DEPTH) {
|
|
19
|
+
renderDepth = 0;
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
renderDepth++;
|
|
16
23
|
let currentType = element.type;
|
|
17
24
|
let props = element.props ?? {};
|
|
18
|
-
|
|
25
|
+
let depth = 0;
|
|
26
|
+
while (typeof currentType === 'function' && depth < 50) {
|
|
27
|
+
depth++;
|
|
19
28
|
try {
|
|
20
29
|
const result = currentType(props);
|
|
21
30
|
if (result && typeof result === 'object' && 'type' in result) {
|
|
@@ -23,28 +32,29 @@ export function renderElementToHTML(element) {
|
|
|
23
32
|
props = result.props ?? {};
|
|
24
33
|
}
|
|
25
34
|
else if (typeof result === 'string' || typeof result === 'number') {
|
|
35
|
+
renderDepth--;
|
|
26
36
|
return String(result);
|
|
27
37
|
}
|
|
38
|
+
else if (Array.isArray(result)) {
|
|
39
|
+
const r = result.map((item) => renderToString(item)).join('');
|
|
40
|
+
renderDepth--;
|
|
41
|
+
return r;
|
|
42
|
+
}
|
|
28
43
|
else {
|
|
44
|
+
renderDepth--;
|
|
29
45
|
return '';
|
|
30
46
|
}
|
|
31
47
|
}
|
|
32
48
|
catch (error) {
|
|
49
|
+
renderDepth--;
|
|
50
|
+
console.error('[EmberKit render error]', error);
|
|
33
51
|
return `<div style="color: red;">Error rendering component</div>`;
|
|
34
52
|
}
|
|
35
53
|
}
|
|
36
54
|
const rawChildren = props.children ?? [];
|
|
37
55
|
const children = Array.isArray(rawChildren) ? rawChildren : [rawChildren];
|
|
38
56
|
const childHtml = children
|
|
39
|
-
.map((child) =>
|
|
40
|
-
if (typeof child === 'string' || typeof child === 'number') {
|
|
41
|
-
return String(child);
|
|
42
|
-
}
|
|
43
|
-
if (typeof child === 'object' && child !== null && 'type' in child) {
|
|
44
|
-
return renderElementToHTML(child);
|
|
45
|
-
}
|
|
46
|
-
return '';
|
|
47
|
-
})
|
|
57
|
+
.map((child) => renderToString(child))
|
|
48
58
|
.join('');
|
|
49
59
|
if (currentType === 'Fragment' || currentType === 'React.Fragment') {
|
|
50
60
|
return childHtml;
|
|
@@ -89,8 +99,10 @@ export function renderElementToHTML(element) {
|
|
|
89
99
|
onclickAttr = ` data-ekclick="${id}"`;
|
|
90
100
|
}
|
|
91
101
|
if (SELF_CLOSING_TAGS.has(currentType)) {
|
|
102
|
+
renderDepth--;
|
|
92
103
|
return `<${currentType}${attributes}${onclickAttr}/>`;
|
|
93
104
|
}
|
|
105
|
+
renderDepth--;
|
|
94
106
|
return `<${currentType}${attributes}${onclickAttr}>${innerHtml}</${currentType}>`;
|
|
95
107
|
}
|
|
96
108
|
export function renderToString(element) {
|
|
@@ -100,6 +112,8 @@ export function renderToString(element) {
|
|
|
100
112
|
return element;
|
|
101
113
|
if (typeof element === 'number')
|
|
102
114
|
return String(element);
|
|
115
|
+
if (Array.isArray(element))
|
|
116
|
+
return element.map((item) => renderToString(item)).join('');
|
|
103
117
|
return renderElementToHTML(element);
|
|
104
118
|
}
|
|
105
119
|
export function getComponentName(type) {
|
|
@@ -2,6 +2,8 @@ import { DEFAULT_CONFIG } from './types.js';
|
|
|
2
2
|
import { readdirSync, statSync } from 'node:fs';
|
|
3
3
|
import { join, relative, dirname, resolve } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
+
import { compile } from '@mdx-js/mdx';
|
|
6
|
+
import remarkGfm from 'remark-gfm';
|
|
5
7
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
8
|
const VIRTUAL_EMBERKIT_CONFIG = 'virtual:emberkit-config';
|
|
7
9
|
const VIRTUAL_EMBERKIT_ROUTES = 'virtual:emberkit-routes';
|
|
@@ -71,7 +73,10 @@ export function emberkitVitePlugin(userOptions = {}) {
|
|
|
71
73
|
}
|
|
72
74
|
return null;
|
|
73
75
|
}
|
|
74
|
-
if (
|
|
76
|
+
if (isMDX) {
|
|
77
|
+
return transformMDX(code, id);
|
|
78
|
+
}
|
|
79
|
+
if (isMD) {
|
|
75
80
|
return transformMarkdownToJSX(code, id, options);
|
|
76
81
|
}
|
|
77
82
|
return code;
|
|
@@ -128,6 +133,122 @@ export default function MDComponent(props) {
|
|
|
128
133
|
`;
|
|
129
134
|
return { code: componentCode };
|
|
130
135
|
}
|
|
136
|
+
async function transformMDX(code, id) {
|
|
137
|
+
const frontmatterMatch = code.match(/^---\n([\s\S]*?)\n---\n?/);
|
|
138
|
+
let frontmatter = {};
|
|
139
|
+
let content = code;
|
|
140
|
+
if (frontmatterMatch) {
|
|
141
|
+
const fmContent = frontmatterMatch[1];
|
|
142
|
+
frontmatter = parseFrontmatter(fmContent);
|
|
143
|
+
content = code.slice(frontmatterMatch[0].length);
|
|
144
|
+
}
|
|
145
|
+
// Extract code blocks before MDX compilation to preserve syntax
|
|
146
|
+
const codeBlocks = [];
|
|
147
|
+
let processedContent = content.replace(/```(\w*)\n([\s\S]*?)```/g, (_match, lang, blockCode) => {
|
|
148
|
+
const html = renderCodeBlock(lang, blockCode);
|
|
149
|
+
codeBlocks.push({ html, index: codeBlocks.length });
|
|
150
|
+
return `<CodeBlock_${codeBlocks.length - 1} />`;
|
|
151
|
+
});
|
|
152
|
+
const compiled = await compile(processedContent, {
|
|
153
|
+
outputFormat: 'program',
|
|
154
|
+
development: false,
|
|
155
|
+
jsx: false,
|
|
156
|
+
jsxImportSource: '@emberkit/core',
|
|
157
|
+
remarkPlugins: [remarkGfm],
|
|
158
|
+
});
|
|
159
|
+
let compiledCode = String(compiled);
|
|
160
|
+
// Build code block component definitions
|
|
161
|
+
const codeBlockComponents = codeBlocks
|
|
162
|
+
.map((block) => {
|
|
163
|
+
const escapedHtml = JSON.stringify(block.html);
|
|
164
|
+
return `function CodeBlock_${block.index}() {
|
|
165
|
+
return createElement('div', {
|
|
166
|
+
dangerouslySetInnerHTML: { __html: ${escapedHtml} }
|
|
167
|
+
});
|
|
168
|
+
}`;
|
|
169
|
+
})
|
|
170
|
+
.join('\n\n');
|
|
171
|
+
// Rename the MDX default export so we can wrap it
|
|
172
|
+
compiledCode = compiledCode.replace('export default function MDXContent', 'function _MDXContent');
|
|
173
|
+
const exportLines = [];
|
|
174
|
+
if (frontmatter.title) {
|
|
175
|
+
exportLines.push(`export const title = ${JSON.stringify(frontmatter.title)};`);
|
|
176
|
+
}
|
|
177
|
+
if (frontmatter.description) {
|
|
178
|
+
exportLines.push(`export const description = ${JSON.stringify(frontmatter.description)};`);
|
|
179
|
+
}
|
|
180
|
+
if (frontmatter.author) {
|
|
181
|
+
exportLines.push(`export const author = ${JSON.stringify(frontmatter.author)};`);
|
|
182
|
+
}
|
|
183
|
+
if (frontmatter.date) {
|
|
184
|
+
exportLines.push(`export const date = ${JSON.stringify(frontmatter.date)};`);
|
|
185
|
+
}
|
|
186
|
+
exportLines.push(`export const metadata = ${JSON.stringify(frontmatter)};`);
|
|
187
|
+
// Build components override object
|
|
188
|
+
const componentsOverride = codeBlocks.length > 0
|
|
189
|
+
? `
|
|
190
|
+
const _codeBlockComponents = {
|
|
191
|
+
${codeBlocks.map(b => `CodeBlock_${b.index}`).join(', ')}
|
|
192
|
+
};
|
|
193
|
+
`
|
|
194
|
+
: '';
|
|
195
|
+
const componentCode = `
|
|
196
|
+
import { createElement } from '@emberkit/core';
|
|
197
|
+
|
|
198
|
+
${exportLines.join('\n')}
|
|
199
|
+
|
|
200
|
+
${codeBlockComponents}
|
|
201
|
+
${componentsOverride}
|
|
202
|
+
|
|
203
|
+
${compiledCode}
|
|
204
|
+
|
|
205
|
+
function _GfmTable(props) {
|
|
206
|
+
return createElement('div', { className: 'table-wrapper' },
|
|
207
|
+
createElement('table', { className: 'gfm-table' }, props.children)
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function _GfmUl(props) {
|
|
212
|
+
return createElement('ul', { className: 'task-list' }, props.children);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
function _GfmLi(props) {
|
|
216
|
+
return createElement('li', { className: 'task-item' }, props.children);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
function _GfmDel(props) {
|
|
220
|
+
return createElement('span', { className: 'strikethrough' }, props.children);
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
function _GfmSup(props) {
|
|
224
|
+
return createElement('span', { className: 'footnote-ref' }, props.children);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
export default function MDXComponent(props) {
|
|
228
|
+
const components = {
|
|
229
|
+
...(props.components || {}),
|
|
230
|
+
${codeBlocks.map(b => `CodeBlock_${b.index}`).join(', ')}
|
|
231
|
+
};
|
|
232
|
+
|
|
233
|
+
return createElement('div', {
|
|
234
|
+
className: 'md-content md-doc',
|
|
235
|
+
'data-file': ${JSON.stringify(id)},
|
|
236
|
+
children: createElement(_MDXContent, {
|
|
237
|
+
...props,
|
|
238
|
+
components: {
|
|
239
|
+
...components,
|
|
240
|
+
table: _GfmTable,
|
|
241
|
+
ul: _GfmUl,
|
|
242
|
+
li: _GfmLi,
|
|
243
|
+
del: _GfmDel,
|
|
244
|
+
sup: _GfmSup,
|
|
245
|
+
}
|
|
246
|
+
})
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
`;
|
|
250
|
+
return { code: componentCode };
|
|
251
|
+
}
|
|
131
252
|
function parseFrontmatter(content) {
|
|
132
253
|
const result = {};
|
|
133
254
|
const lines = content.split('\n');
|
|
@@ -151,8 +272,13 @@ function parseFrontmatter(content) {
|
|
|
151
272
|
return result;
|
|
152
273
|
}
|
|
153
274
|
function markdownToJSX(content, options) {
|
|
154
|
-
|
|
155
|
-
|
|
275
|
+
// Step 1: Extract all fenced code blocks before any markdown processing
|
|
276
|
+
const codeBlocks = [];
|
|
277
|
+
let html = content.replace(/```(\w*)\n([\s\S]*?)```/g, (_match, lang, code) => {
|
|
278
|
+
codeBlocks.push(renderCodeBlock(lang, code));
|
|
279
|
+
return `\n__CODE_BLOCK_${codeBlocks.length - 1}__\n`;
|
|
280
|
+
});
|
|
281
|
+
// Step 2: Process all other markdown (no backticks in code blocks to interfere)
|
|
156
282
|
html = processHeadings(html);
|
|
157
283
|
html = processHorizontalRules(html);
|
|
158
284
|
html = processTables(html);
|
|
@@ -162,6 +288,8 @@ function markdownToJSX(content, options) {
|
|
|
162
288
|
html = processBlockquotes(html);
|
|
163
289
|
html = processEmphasis(html);
|
|
164
290
|
html = processParagraphs(html, options.breaks);
|
|
291
|
+
// Step 3: Restore code blocks
|
|
292
|
+
html = html.replace(/__CODE_BLOCK_(\d+)__/g, (_, index) => codeBlocks[Number(index)]);
|
|
165
293
|
return html;
|
|
166
294
|
}
|
|
167
295
|
function processHeadings(html) {
|
|
@@ -170,24 +298,22 @@ function processHeadings(html) {
|
|
|
170
298
|
return `<h${hashes.length} id="${id}">${text}</h${hashes.length}>`;
|
|
171
299
|
});
|
|
172
300
|
}
|
|
173
|
-
function
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
return `<pre${langAttr}><button class="copy-btn" onclick="(async()=>{await navigator.clipboard.writeText(this.closest('pre').querySelector('code').textContent);this.textContent='Copied!';setTimeout(()=>this.textContent='Copy',1500)})()"><svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg> Copy</button><code class="language-${lang}">${highlighted}</code></pre>`;
|
|
190
|
-
});
|
|
301
|
+
function renderCodeBlock(lang, code) {
|
|
302
|
+
let highlighted = code.trim();
|
|
303
|
+
if (lang === 'ts' || lang === 'tsx' || lang === 'js' || lang === 'jsx' || lang === 'typescript' || lang === 'javascript') {
|
|
304
|
+
highlighted = highlightTS(highlighted);
|
|
305
|
+
}
|
|
306
|
+
else if (lang === 'bash' || lang === 'sh' || lang === 'shell') {
|
|
307
|
+
highlighted = highlightBash(highlighted);
|
|
308
|
+
}
|
|
309
|
+
else if (lang === 'json') {
|
|
310
|
+
highlighted = highlightJSON(highlighted);
|
|
311
|
+
}
|
|
312
|
+
else {
|
|
313
|
+
highlighted = escapeHtml(highlighted);
|
|
314
|
+
}
|
|
315
|
+
const langAttr = lang ? ` data-lang="${lang}"` : '';
|
|
316
|
+
return `<pre${langAttr}><button class="copy-btn" onclick="(async()=>{await navigator.clipboard.writeText(this.closest('pre').querySelector('code').textContent);this.textContent='Copied!';setTimeout(()=>this.textContent='Copy',1500)})()"><svg width=\"16\" height=\"16\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\"><rect x=\"9\" y=\"9\" width=\"13\" height=\"13\" rx=\"2\" ry=\"2\"/><path d=\"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1\"/></svg> Copy</button><code class="language-${lang}">${highlighted}</code></pre>`;
|
|
191
317
|
}
|
|
192
318
|
function escapeHtml(text) {
|
|
193
319
|
return text
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@emberkit/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Lightweight TypeScript-first JSX framework core",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -21,6 +21,9 @@
|
|
|
21
21
|
"sideEffects": false,
|
|
22
22
|
"main": "./dist/index.js",
|
|
23
23
|
"types": "./dist/index.d.ts",
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
24
27
|
"files": [
|
|
25
28
|
"dist"
|
|
26
29
|
],
|
|
@@ -42,7 +45,17 @@
|
|
|
42
45
|
"types": "./dist/jsx-dev-runtime.d.ts"
|
|
43
46
|
}
|
|
44
47
|
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "tsc --build",
|
|
50
|
+
"dev": "tsc --build --watch",
|
|
51
|
+
"lint": "eslint src --ext .ts,.tsx",
|
|
52
|
+
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
53
|
+
"test": "vitest",
|
|
54
|
+
"typecheck": "tsc --noEmit"
|
|
55
|
+
},
|
|
45
56
|
"dependencies": {
|
|
57
|
+
"@mdx-js/mdx": "^3.1.1",
|
|
58
|
+
"remark-gfm": "^4.0.0",
|
|
46
59
|
"vite": "^6.0.0"
|
|
47
60
|
},
|
|
48
61
|
"devDependencies": {
|
|
@@ -54,13 +67,5 @@
|
|
|
54
67
|
"jsdom": "^29.1.1",
|
|
55
68
|
"typescript-eslint": "^8.59.3",
|
|
56
69
|
"vitest": "^3.0.0"
|
|
57
|
-
},
|
|
58
|
-
"scripts": {
|
|
59
|
-
"build": "tsc --build",
|
|
60
|
-
"dev": "tsc --build --watch",
|
|
61
|
-
"lint": "eslint src --ext .ts,.tsx",
|
|
62
|
-
"format": "prettier --write \"src/**/*.{ts,tsx}\"",
|
|
63
|
-
"test": "vitest",
|
|
64
|
-
"typecheck": "tsc --noEmit"
|
|
65
70
|
}
|
|
66
|
-
}
|
|
71
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,199 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by the Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding any notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|
|
177
|
-
|
|
178
|
-
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
-
|
|
180
|
-
To apply the Apache License to your work, attach the following
|
|
181
|
-
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
-
replaced with your own identifying information. (Don't include
|
|
183
|
-
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
-
comment syntax for the file format. Please also get an original
|
|
185
|
-
template from https://www.apache.org/licenses/LICENSE-2.0.txt
|
|
186
|
-
|
|
187
|
-
Copyright 2024 EmberKit Contributors
|
|
188
|
-
|
|
189
|
-
Licensed under the Apache License, Version 2.0 (the "License");
|
|
190
|
-
you may not use this file except in compliance with the License.
|
|
191
|
-
You may obtain a copy of the License at
|
|
192
|
-
|
|
193
|
-
http://www.apache.org/licenses/LICENSE-2.0
|
|
194
|
-
|
|
195
|
-
Unless required by applicable law or agreed to in writing, software
|
|
196
|
-
distributed under the License is distributed on an "AS IS" BASIS,
|
|
197
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
198
|
-
See the License for the specific language governing permissions and
|
|
199
|
-
limitations under the License.
|