@tsrx/bun-plugin-vue 0.0.73 → 0.0.75

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(tsrxVue());
39
39
  - `vapor`: options forwarded to `vue-jsx-vapor`.
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/vue (.tsrx modules)",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.0.73",
6
+ "version": "0.0.75",
7
7
  "type": "module",
8
8
  "publishConfig": {
9
9
  "access": "public"
@@ -20,7 +20,8 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@tsrx/vue": "0.1.69"
23
+ "@tsrx/core": "0.1.71",
24
+ "@tsrx/vue": "0.1.71"
24
25
  },
25
26
  "peerDependencies": {
26
27
  "bun": "^1.0.0",
package/src/index.js CHANGED
@@ -1,9 +1,11 @@
1
1
  /** @import { BunPlugin, Target, Transpiler } from 'bun' */
2
- /** @import { RuntimeImportMode } from '@tsrx/vue' */
2
+ /** @import { Platform, RuntimeImportMode } from '@tsrx/vue' */
3
3
 
4
4
  import { readFile } from 'node:fs/promises';
5
5
  import { createRequire } from 'node:module';
6
6
  import { compile } from '@tsrx/vue';
7
+ import { mergePlatformDefinitions, validatePlatform } from '@tsrx/core';
8
+ import { resolveBuildPlatform } from '@tsrx/core/config';
7
9
  import { addVaporInteropToCreateVaporApp } from '@tsrx/vue/interop';
8
10
 
9
11
  const require = createRequire(import.meta.url);
@@ -27,6 +29,7 @@ const DEFAULT_VAPOR_OPTIONS = {
27
29
  * exclude?: RegExp | RegExp[],
28
30
  * emitCss?: boolean,
29
31
  * runtimeImports?: RuntimeImportMode,
32
+ * platform?: Platform,
30
33
  * vapor?: {
31
34
  * macros?: boolean | object,
32
35
  * compiler?: { runtimeModuleName?: string },
@@ -128,9 +131,9 @@ function resolve_vapor_options(options) {
128
131
  * @returns {BunPlugin}
129
132
  */
130
133
  export function tsrxVue(options = {}) {
134
+ const explicit_platform = validatePlatform(options.platform);
131
135
  const emit_css = options.emitCss ?? true;
132
136
  const vapor_options = resolve_vapor_options(options.vapor);
133
- const compile_options = { runtimeImports: options.runtimeImports };
134
137
 
135
138
  /** @type {Map<string, string>} */
136
139
  const css_cache = new Map();
@@ -142,6 +145,21 @@ export function tsrxVue(options = {}) {
142
145
  // build.config is only present for Bun.build(); runtime registration
143
146
  // via Bun.plugin(), including bun:test preloads, does not provide it.
144
147
  const build_config = build.config ?? {};
148
+ const platform = resolveBuildPlatform({
149
+ root: build_config.root ?? process.cwd(),
150
+ tsconfig: typeof build_config.tsconfig === 'string' ? build_config.tsconfig : undefined,
151
+ platform: explicit_platform,
152
+ integration: '@tsrx/bun-plugin-vue',
153
+ });
154
+ const compile_options = { runtimeImports: options.runtimeImports, platform };
155
+ if (platform !== undefined && build.config) {
156
+ build.config.define = /** @type {Record<string, string>} */ (
157
+ mergePlatformDefinitions(build.config.define, platform, {
158
+ integration: 'Bun',
159
+ serialize: true,
160
+ })
161
+ );
162
+ }
145
163
  const transpiler = create_transpiler(build_config.target);
146
164
 
147
165
  build.onResolve({ filter: CSS_QUERY_PATTERN }, (args) => ({
package/types/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import type { BunPlugin } from 'bun';
2
- import type { RuntimeImportMode } from '@tsrx/vue';
2
+ import type { Platform, RuntimeImportMode } from '@tsrx/vue';
3
3
 
4
4
  export interface TsrxVueBunPluginVaporOptions {
5
5
  macros?: boolean | object;
@@ -11,6 +11,8 @@ export interface TsrxVueBunPluginVaporOptions {
11
11
  export interface TsrxVueBunPluginOptions {
12
12
  /** Direct mode requires `@tsrx/vue-runtime` as a direct production dependency. */
13
13
  runtimeImports?: RuntimeImportMode;
14
+ /** Optional override; inferred from tsconfig by default and must agree when both exist. */
15
+ platform?: Platform;
14
16
  include?: RegExp;
15
17
  exclude?: RegExp | RegExp[];
16
18
  emitCss?: boolean;