@tsrx/bun-plugin-preact 0.0.80 → 0.0.82
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 +12 -0
- package/package.json +2 -2
- package/src/index.js +3 -0
- package/types/index.d.ts +3 -0
package/README.md
CHANGED
|
@@ -37,5 +37,17 @@ Bun.plugin(tsrxPreact());
|
|
|
37
37
|
|
|
38
38
|
- `jsxImportSource`: automatic JSX runtime import source (default: `'preact'`).
|
|
39
39
|
- `suspenseSource`: module used by the compiler for Suspense imports.
|
|
40
|
+
- `runtimeImports`: helper import mode (`'compiler'` by default, or `'direct'` for
|
|
41
|
+
standalone runtime imports).
|
|
40
42
|
- `emitCss`: whether to emit virtual CSS imports (default: `true`).
|
|
41
43
|
- `include`, `exclude`: regex filters for source files.
|
|
44
|
+
|
|
45
|
+
When using `runtimeImports: 'direct'`, install the runtime as a direct production
|
|
46
|
+
dependency of the package that owns the compiled modules:
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
pnpm add @tsrx/preact-runtime
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Bun may bundle the helpers into its output, but this plugin only emits bare
|
|
53
|
+
`@tsrx/preact-runtime/*` imports and does not provide the runtime package.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Bun plugin for @tsrx/preact (.tsrx modules)",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.82",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@tsrx/preact": "0.1.
|
|
23
|
+
"@tsrx/preact": "0.1.59"
|
|
24
24
|
},
|
|
25
25
|
"peerDependencies": {
|
|
26
26
|
"bun": "^1.0.0",
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/** @import { BunPlugin, Target, Transpiler } from 'bun' */
|
|
2
|
+
/** @import { RuntimeImportMode } from '@tsrx/preact' */
|
|
2
3
|
|
|
3
4
|
import { readFile } from 'node:fs/promises';
|
|
4
5
|
import { compile } from '@tsrx/preact';
|
|
@@ -13,6 +14,7 @@ const CSS_QUERY_PATTERN = /\?tsrx-css&lang\.css$/;
|
|
|
13
14
|
* exclude?: RegExp | RegExp[],
|
|
14
15
|
* jsxImportSource?: string,
|
|
15
16
|
* suspenseSource?: string,
|
|
17
|
+
* runtimeImports?: RuntimeImportMode,
|
|
16
18
|
* emitCss?: boolean,
|
|
17
19
|
* }} TsrxPreactBunPluginOptions
|
|
18
20
|
*/
|
|
@@ -93,6 +95,7 @@ export function tsrxPreact(options = {}) {
|
|
|
93
95
|
const emit_css = options.emitCss ?? true;
|
|
94
96
|
const compile_options = {
|
|
95
97
|
suspenseSource: options.suspenseSource,
|
|
98
|
+
runtimeImports: options.runtimeImports,
|
|
96
99
|
};
|
|
97
100
|
|
|
98
101
|
/** @type {Map<string, string>} */
|
package/types/index.d.ts
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
import type { BunPlugin } from 'bun';
|
|
2
|
+
import type { RuntimeImportMode } from '@tsrx/preact';
|
|
2
3
|
|
|
3
4
|
export interface TsrxPreactBunPluginOptions {
|
|
4
5
|
include?: RegExp;
|
|
5
6
|
exclude?: RegExp | RegExp[];
|
|
6
7
|
jsxImportSource?: string;
|
|
7
8
|
suspenseSource?: string;
|
|
9
|
+
/** Direct mode requires `@tsrx/preact-runtime` as a direct production dependency. */
|
|
10
|
+
runtimeImports?: RuntimeImportMode;
|
|
8
11
|
emitCss?: boolean;
|
|
9
12
|
}
|
|
10
13
|
|