@tsrx/vite-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/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Vite 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,8 +20,8 @@
20
20
  }
21
21
  },
22
22
  "dependencies": {
23
- "@tsrx/vue": "0.1.57",
24
- "@tsrx/core": "0.1.57"
23
+ "@tsrx/core": "0.1.59",
24
+ "@tsrx/vue": "0.1.59"
25
25
  },
26
26
  "peerDependencies": {
27
27
  "vite": "*",
package/src/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  /** @import { Plugin } from 'vite' */
2
2
  /** @import { DepScanLoadPlugin } from '@tsrx/core/types/vite/dep-scan' */
3
+ /** @import { RuntimeImportMode } from '@tsrx/vue' */
3
4
 
4
5
  import { readFile } from 'node:fs/promises';
5
6
  import { existsSync } from 'node:fs';
@@ -83,6 +84,7 @@ function create_tsrx_vue_plugin(options) {
83
84
  let rootDir = process.cwd();
84
85
 
85
86
  const includePattern = options.include ?? DEFAULT_TSRX_PATTERN;
87
+ const compile_options = { runtimeImports: options.runtimeImports };
86
88
 
87
89
  /**
88
90
  * @param {string} path
@@ -133,7 +135,7 @@ function create_tsrx_vue_plugin(options) {
133
135
  // `vue-jsx-vapor` downstream; the scan only needs the
134
136
  // imports, so leave the jsx alone.
135
137
  transform: { jsx: 'preserve' },
136
- plugins: [create_tsrx_vue_scan_plugin(isVirtual, toRealPath)],
138
+ plugins: [create_tsrx_vue_scan_plugin(isVirtual, toRealPath, compile_options)],
137
139
  },
138
140
  },
139
141
  };
@@ -186,7 +188,7 @@ function create_tsrx_vue_plugin(options) {
186
188
 
187
189
  const realPath = toRealPath(id.split('?')[0]);
188
190
  const source = await readFile(realPath, 'utf-8');
189
- let { code, css, map } = compile(source, realPath);
191
+ let { code, css, map } = compile(source, realPath, compile_options);
190
192
 
191
193
  if (css) {
192
194
  cssCache.set(realPath, css);
@@ -224,14 +226,15 @@ function create_tsrx_vue_plugin(options) {
224
226
  *
225
227
  * @param {(id: string) => boolean} isVirtual
226
228
  * @param {(id: string) => string} toRealPath
229
+ * @param {{ runtimeImports?: RuntimeImportMode }} compile_options
227
230
  * @returns {DepScanLoadPlugin}
228
231
  */
229
- function create_tsrx_vue_scan_plugin(isVirtual, toRealPath) {
232
+ function create_tsrx_vue_scan_plugin(isVirtual, toRealPath, compile_options) {
230
233
  return createDepScanLoadPlugin({
231
234
  name: '@tsrx/vite-plugin-vue:dep-scan',
232
235
  isVirtual,
233
236
  toRealPath,
234
- compile,
237
+ compile: (code, id) => compile(code, id, compile_options),
235
238
  });
236
239
  }
237
240
 
package/types/index.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { Plugin } from 'vite';
2
+ import type { RuntimeImportMode } from '@tsrx/vue';
2
3
 
3
4
  export interface TsrxVueOptions {
5
+ /** Direct mode requires `@tsrx/vue-runtime` as a direct production dependency. */
6
+ runtimeImports?: RuntimeImportMode;
4
7
  /**
5
8
  * Regular expression matched against file paths to decide which modules
6
9
  * the plugin should compile as tsrx sources. Defaults to `/\.tsrx$/`.