@tsrx/bun-plugin-vue 0.0.62 → 0.0.63
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 +4 -1
- package/types/index.d.ts +3 -0
package/README.md
CHANGED
|
@@ -36,5 +36,17 @@ Bun.plugin(tsrxVue());
|
|
|
36
36
|
## Options
|
|
37
37
|
|
|
38
38
|
- `vapor`: options forwarded to `vue-jsx-vapor`.
|
|
39
|
+
- `runtimeImports`: helper import mode (`'compiler'` by default, or `'direct'` for
|
|
40
|
+
standalone runtime imports).
|
|
39
41
|
- `emitCss`: whether to emit virtual CSS imports (default: `true`).
|
|
40
42
|
- `include`, `exclude`: regex filters for source files.
|
|
43
|
+
|
|
44
|
+
When using `runtimeImports: 'direct'`, install the runtime as a direct production
|
|
45
|
+
dependency of the package that owns the compiled modules:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pnpm add @tsrx/vue-runtime
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Bun may bundle the helpers into its output, but this plugin only emits bare
|
|
52
|
+
`@tsrx/vue-runtime/*` imports and does not provide the runtime package.
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Bun plugin for @tsrx/vue (.tsrx modules)",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.63",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@tsrx/vue": "0.1.
|
|
23
|
+
"@tsrx/vue": "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/vue' */
|
|
2
3
|
|
|
3
4
|
import { readFile } from 'node:fs/promises';
|
|
4
5
|
import { createRequire } from 'node:module';
|
|
@@ -25,6 +26,7 @@ const DEFAULT_VAPOR_OPTIONS = {
|
|
|
25
26
|
* include?: RegExp,
|
|
26
27
|
* exclude?: RegExp | RegExp[],
|
|
27
28
|
* emitCss?: boolean,
|
|
29
|
+
* runtimeImports?: RuntimeImportMode,
|
|
28
30
|
* vapor?: {
|
|
29
31
|
* macros?: boolean | object,
|
|
30
32
|
* compiler?: { runtimeModuleName?: string },
|
|
@@ -128,6 +130,7 @@ function resolve_vapor_options(options) {
|
|
|
128
130
|
export function tsrxVue(options = {}) {
|
|
129
131
|
const emit_css = options.emitCss ?? true;
|
|
130
132
|
const vapor_options = resolve_vapor_options(options.vapor);
|
|
133
|
+
const compile_options = { runtimeImports: options.runtimeImports };
|
|
131
134
|
|
|
132
135
|
/** @type {Map<string, string>} */
|
|
133
136
|
const css_cache = new Map();
|
|
@@ -156,7 +159,7 @@ export function tsrxVue(options = {}) {
|
|
|
156
159
|
if (!should_compile(options, args.path)) return undefined;
|
|
157
160
|
|
|
158
161
|
const source = await readFile(args.path, 'utf-8');
|
|
159
|
-
const { code, css } = compile(source, args.path);
|
|
162
|
+
const { code, css } = compile(source, args.path, compile_options);
|
|
160
163
|
const css_id = to_css_id(args.path);
|
|
161
164
|
|
|
162
165
|
let output = code;
|
package/types/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { BunPlugin } from 'bun';
|
|
2
|
+
import type { RuntimeImportMode } from '@tsrx/vue';
|
|
2
3
|
|
|
3
4
|
export interface TsrxVueBunPluginVaporOptions {
|
|
4
5
|
macros?: boolean | object;
|
|
@@ -8,6 +9,8 @@ export interface TsrxVueBunPluginVaporOptions {
|
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
export interface TsrxVueBunPluginOptions {
|
|
12
|
+
/** Direct mode requires `@tsrx/vue-runtime` as a direct production dependency. */
|
|
13
|
+
runtimeImports?: RuntimeImportMode;
|
|
11
14
|
include?: RegExp;
|
|
12
15
|
exclude?: RegExp | RegExp[];
|
|
13
16
|
emitCss?: boolean;
|