-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
118 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,7 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
import { transform } from 'esbuild'; | ||
import { Epubook } from '@epubook/xml/vite'; | ||
|
||
export default defineConfig({ | ||
plugins: [ | ||
{ | ||
name: 'epubook:transform-jsx', | ||
enforce: 'pre', | ||
async transform(code, id) { | ||
if (id.endsWith('.tsx')) { | ||
return await transform(code, { | ||
loader: 'tsx', | ||
sourcefile: id, | ||
jsxFactory: 'h', | ||
jsxFragment: 'Fragment' | ||
}); | ||
} | ||
} | ||
} | ||
] | ||
plugins: [Epubook()] | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
export * from './xhtml'; | ||
|
||
export * from './unbuild'; | ||
export * from './xml'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import type { Plugin } from 'vite'; | ||
|
||
export function Epubook(): Plugin { | ||
return { | ||
name: 'epubook:jsx', | ||
config() { | ||
return { | ||
esbuild: { | ||
jsxFactory: '__epubook_xml.h', | ||
jsxFragment: '__epubook_xml.Fragment', | ||
jsxInject: `import * as __epubook_xml from '@epubook/xml'` | ||
} | ||
}; | ||
} | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
declare global { | ||
namespace JSX { | ||
interface IntrinsicElements extends HtmlIntrinsicElements {} | ||
} | ||
} | ||
|
||
export interface XMLNode { | ||
tag: string; | ||
attrs?: Record<string, string>; | ||
children?: Array<string | XMLNode>; | ||
} | ||
|
||
export interface XHTMLNode extends XMLNode {} | ||
|
||
export interface ContainerIntrinsicElements { | ||
containter: { | ||
version: string; | ||
xmlns: string; | ||
}; | ||
|
||
rootfiles: {}; | ||
|
||
rootfile: { | ||
fullPath: string; | ||
mediaType: string; | ||
}; | ||
} | ||
|
||
export interface BaseHtmlElementAttrs { | ||
class?: string; | ||
|
||
id?: string; | ||
|
||
html?: string; | ||
} | ||
|
||
export interface HtmlIntrinsicElements { | ||
div: BaseHtmlElementAttrs & {}; | ||
|
||
nav: BaseHtmlElementAttrs & {}; | ||
ul: BaseHtmlElementAttrs & {}; | ||
ol: BaseHtmlElementAttrs & {}; | ||
li: BaseHtmlElementAttrs & {}; | ||
|
||
h1: BaseHtmlElementAttrs & {}; | ||
h2: BaseHtmlElementAttrs & {}; | ||
h3: BaseHtmlElementAttrs & {}; | ||
h4: BaseHtmlElementAttrs & {}; | ||
h5: BaseHtmlElementAttrs & {}; | ||
h6: BaseHtmlElementAttrs & {}; | ||
|
||
p: BaseHtmlElementAttrs & {}; | ||
pre: BaseHtmlElementAttrs & {}; | ||
|
||
span: BaseHtmlElementAttrs & {}; | ||
code: BaseHtmlElementAttrs & {}; | ||
a: BaseHtmlElementAttrs & { href: string }; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
import { Epubook } from './src/vite'; | ||
|
||
export default defineConfig({ | ||
plugins: [Epubook()] | ||
}); |