-
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
12 changed files
with
122 additions
and
33 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,12 +1,18 @@ | ||
import { defineBuildConfig } from 'unbuild' | ||
import { defineBuildConfig } from 'unbuild'; | ||
|
||
export default defineBuildConfig({ | ||
entries: [ | ||
'src/index', | ||
], | ||
entries: ['src/index'], | ||
declaration: true, | ||
clean: true, | ||
rollup: { | ||
emitCJS: true, | ||
}, | ||
}); | ||
esbuild: { | ||
jsxFactory: 'h', | ||
jsxFragment: 'fragment', | ||
loaders: { | ||
'.ts': 'ts', | ||
'.tsx': 'tsx' | ||
} | ||
} | ||
} | ||
}); |
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 './bundle'; |
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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
declare global { | ||
namespace JSX { | ||
interface IntrinsicElements extends EpubIntrinsicElements {} | ||
} | ||
} | ||
|
||
export interface EpubIntrinsicElements { | ||
li: {}; | ||
ol: {}; | ||
span: {}; | ||
a: { 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
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,7 +1,7 @@ | ||
import { describe, expect, it } from 'vitest' | ||
import { describe, expect, it } from 'vitest'; | ||
|
||
describe('hello', () => { | ||
it('should work', () => { | ||
expect('Hello').toEqual('Hello'); | ||
}); | ||
}); | ||
}); |
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,27 @@ | ||
import { defineConfig } from 'vitest/config'; | ||
|
||
import { transform } from 'esbuild'; | ||
|
||
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' | ||
}); | ||
} | ||
} | ||
} | ||
], | ||
test: { | ||
transformMode: { | ||
web: [/\.[jt]sx$/] | ||
} | ||
} | ||
}); |
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,15 @@ | ||
diff --git a/dist/shared/unbuild.e1e6feef.mjs b/dist/shared/unbuild.e1e6feef.mjs | ||
index 5efb149df405e81132bb6ed0f906765036a6514e..dc5493f0b2ea75df3bdb235c7d3a43567d4f1d5e 100644 | ||
--- a/dist/shared/unbuild.e1e6feef.mjs | ||
+++ b/dist/shared/unbuild.e1e6feef.mjs | ||
@@ -363,7 +363,9 @@ function esbuild(options) { | ||
target: options.target, | ||
define: options.define, | ||
sourcemap: options.sourceMap, | ||
- sourcefile: id | ||
+ sourcefile: id, | ||
+ jsxFactory: options.jsxFactory, | ||
+ jsxFragment: options.jsxFragment | ||
}); | ||
printWarnings(id, result, this); | ||
return result.code && { |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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