@tsrx/bun-plugin-solid 0.0.64 → 0.0.66

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
@@ -39,6 +39,10 @@ Bun.plugin(tsrxSolid());
39
39
  - `solid`: options forwarded to `babel-preset-solid`.
40
40
  - `runtimeImports`: helper import mode (`'compiler'` by default, or `'direct'` for
41
41
  standalone runtime imports).
42
+ - `platform`: optional override/fallback for the compile-time platform. Normally
43
+ the plugin reads `tsrx.platform` from Bun's selected/nearest tsconfig, including
44
+ `extends`. An override must match tsconfig. For `Bun.build`, all three exact
45
+ flags are defined and conflicting definitions are rejected.
42
46
  - `emitCss`: whether to emit virtual CSS imports (default: `true`).
43
47
  - `include`, `exclude`: regex filters for source files.
44
48
 
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.64",
6
+ "version": "0.0.66",
7
7
  "type": "module",
8
8
  "publishConfig": {
9
9
  "access": "public"
@@ -23,7 +23,8 @@
23
23
  "@babel/core": "^7.29.0",
24
24
  "@babel/preset-typescript": "^7.28.5",
25
25
  "babel-preset-solid": "2.0.0-rc.3",
26
- "@tsrx/solid": "0.1.70"
26
+ "@tsrx/core": "0.2.0",
27
+ "@tsrx/solid": "0.2.0"
27
28
  },
28
29
  "peerDependencies": {
29
30
  "@solidjs/web": "2.0.0-rc.3",
package/src/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  /** @import { BunPlugin } from 'bun' */
2
- /** @import { RuntimeImportMode } from '@tsrx/solid' */
2
+ /** @import { Platform, RuntimeImportMode } from '@tsrx/solid' */
3
3
 
4
4
  import { readFile } from 'node:fs/promises';
5
5
  import { createRequire } from 'node:module';
6
6
  import { compile } from '@tsrx/solid';
7
+ import { mergePlatformDefinitions, validatePlatform } from '@tsrx/core';
8
+ import { resolveBuildPlatform } from '@tsrx/core/config';
7
9
 
8
10
  const require = createRequire(import.meta.url);
9
11
  const { transformAsync } = require('@babel/core');
@@ -21,6 +23,7 @@ const CSS_QUERY_PATTERN = /\?tsrx-css&lang\.css$/;
21
23
  * emitCss?: boolean,
22
24
  * solid?: object,
23
25
  * runtimeImports?: RuntimeImportMode,
26
+ * platform?: Platform,
24
27
  * }} TsrxSolidBunPluginOptions
25
28
  */
26
29
 
@@ -100,8 +103,8 @@ async function transform_solid(source, file_path, solid_options) {
100
103
  * @returns {BunPlugin}
101
104
  */
102
105
  export function tsrxSolid(options = {}) {
106
+ const explicit_platform = validatePlatform(options.platform);
103
107
  const emit_css = options.emitCss ?? true;
104
- const compile_options = { runtimeImports: options.runtimeImports };
105
108
 
106
109
  /** @type {Map<string, string>} */
107
110
  const css_cache = new Map();
@@ -110,6 +113,22 @@ export function tsrxSolid(options = {}) {
110
113
  name: '@tsrx/bun-plugin-solid',
111
114
 
112
115
  setup(build) {
116
+ const build_config = build.config ?? {};
117
+ const platform = resolveBuildPlatform({
118
+ root: build_config.root ?? process.cwd(),
119
+ tsconfig: typeof build_config.tsconfig === 'string' ? build_config.tsconfig : undefined,
120
+ platform: explicit_platform,
121
+ integration: '@tsrx/bun-plugin-solid',
122
+ });
123
+ const compile_options = { runtimeImports: options.runtimeImports, platform };
124
+ if (platform !== undefined && build.config) {
125
+ build.config.define = /** @type {Record<string, string>} */ (
126
+ mergePlatformDefinitions(build.config.define, platform, {
127
+ integration: 'Bun',
128
+ serialize: true,
129
+ })
130
+ );
131
+ }
113
132
  build.onResolve({ filter: CSS_QUERY_PATTERN }, (args) => ({
114
133
  path: args.path,
115
134
  }));
package/types/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import type { BunPlugin } from 'bun';
2
- import type { RuntimeImportMode } from '@tsrx/solid';
2
+ import type { Platform, RuntimeImportMode } from '@tsrx/solid';
3
3
 
4
4
  export interface TsrxSolidBunPluginOptions {
5
5
  /** Direct mode requires `@tsrx/solid-runtime` as a direct production dependency. */
6
6
  runtimeImports?: RuntimeImportMode;
7
+ /** Optional override; inferred from tsconfig by default and must agree when both exist. */
8
+ platform?: Platform;
7
9
  include?: RegExp;
8
10
  exclude?: RegExp | RegExp[];
9
11
  emitCss?: boolean;