@tsrx/bun-plugin-solid 0.0.52 → 0.0.54

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 CHANGED
@@ -36,5 +36,17 @@ Bun.plugin(tsrxSolid());
36
36
  ## Options
37
37
 
38
38
  - `solid`: options forwarded to `babel-preset-solid`.
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/solid-runtime
49
+ ```
50
+
51
+ Bun may bundle the helpers into its output, but this plugin only emits bare
52
+ `@tsrx/solid-runtime/*` imports and does not provide the runtime package.
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Bun plugin for @tsrx/solid (.tsrx modules)",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.0.52",
6
+ "version": "0.0.54",
7
7
  "type": "module",
8
8
  "publishConfig": {
9
9
  "access": "public"
@@ -23,7 +23,7 @@
23
23
  "@babel/core": "^7.29.0",
24
24
  "@babel/preset-typescript": "^7.28.5",
25
25
  "babel-preset-solid": "2.0.0-beta.15",
26
- "@tsrx/solid": "0.1.58"
26
+ "@tsrx/solid": "0.1.60"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "@solidjs/web": "2.0.0-beta.15",
package/src/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  /** @import { BunPlugin } from 'bun' */
2
+ /** @import { RuntimeImportMode } from '@tsrx/solid' */
2
3
 
3
4
  import { readFile } from 'node:fs/promises';
4
5
  import { createRequire } from 'node:module';
@@ -19,6 +20,7 @@ const CSS_QUERY_PATTERN = /\?tsrx-css&lang\.css$/;
19
20
  * exclude?: RegExp | RegExp[],
20
21
  * emitCss?: boolean,
21
22
  * solid?: object,
23
+ * runtimeImports?: RuntimeImportMode,
22
24
  * }} TsrxSolidBunPluginOptions
23
25
  */
24
26
 
@@ -99,6 +101,7 @@ async function transform_solid(source, file_path, solid_options) {
99
101
  */
100
102
  export function tsrxSolid(options = {}) {
101
103
  const emit_css = options.emitCss ?? true;
104
+ const compile_options = { runtimeImports: options.runtimeImports };
102
105
 
103
106
  /** @type {Map<string, string>} */
104
107
  const css_cache = new Map();
@@ -122,7 +125,7 @@ export function tsrxSolid(options = {}) {
122
125
  if (!should_compile(options, args.path)) return undefined;
123
126
 
124
127
  const source = await readFile(args.path, 'utf-8');
125
- const { code, css } = compile(source, args.path);
128
+ const { code, css } = compile(source, args.path, compile_options);
126
129
  const css_id = to_css_id(args.path);
127
130
 
128
131
  let output = code;
package/types/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { BunPlugin } from 'bun';
2
+ import type { RuntimeImportMode } from '@tsrx/solid';
2
3
 
3
4
  export interface TsrxSolidBunPluginOptions {
5
+ /** Direct mode requires `@tsrx/solid-runtime` as a direct production dependency. */
6
+ runtimeImports?: RuntimeImportMode;
4
7
  include?: RegExp;
5
8
  exclude?: RegExp | RegExp[];
6
9
  emitCss?: boolean;