@tsrx/react 0.1.20 → 0.1.22

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": "React compiler built on @tsrx/core",
4
4
  "license": "MIT",
5
5
  "author": "Dominic Gannaway",
6
- "version": "0.1.20",
6
+ "version": "0.1.22",
7
7
  "type": "module",
8
8
  "publishConfig": {
9
9
  "access": "public"
@@ -22,15 +22,15 @@
22
22
  "types": "./types/error-boundary.d.ts",
23
23
  "default": "./src/error-boundary.js"
24
24
  },
25
- "./merge-refs": {
26
- "types": "./types/merge-refs.d.ts",
27
- "default": "./src/merge-refs.js"
25
+ "./ref": {
26
+ "types": "./types/ref.d.ts",
27
+ "default": "./src/ref.js"
28
28
  }
29
29
  },
30
30
  "dependencies": {
31
31
  "esrap": "^2.1.0",
32
32
  "zimmerframe": "^1.1.2",
33
- "@tsrx/core": "0.0.26"
33
+ "@tsrx/core": "0.0.28"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "react": ">=18"
package/src/index.js CHANGED
@@ -4,6 +4,8 @@
4
4
  import { createVolarMappingsResult, dedupeMappings, parseModule } from '@tsrx/core';
5
5
  import { transform } from './transform.js';
6
6
 
7
+ export { isRefProp } from './ref.js';
8
+
7
9
  /**
8
10
  * Parse tsrx-react source code to an ESTree AST.
9
11
  * @param {string} source
@@ -22,7 +24,7 @@ export function parse(source, filename, options) {
22
24
  * @param {string} source
23
25
  * @param {string} [filename]
24
26
  * @param {{ collect?: boolean, loose?: boolean }} [options]
25
- * @returns {{ code: string, map: any, css: { code: string, hash: string } | null, errors: CompileError[] }}
27
+ * @returns {{ code: string, map: any, css: string, cssHash: string | null, errors: CompileError[] }}
26
28
  */
27
29
  export function compile(source, filename, options) {
28
30
  const errors = /** @type {CompileError[]} */ ([]);
@@ -63,6 +65,8 @@ export function compile_to_volar_mappings(source, filename, options) {
63
65
  const transformed = transform(ast, source, filename, {
64
66
  collect: true,
65
67
  loose: !!options?.loose,
68
+ moduleScopedHookComponents: false,
69
+ typeOnly: true,
66
70
  errors,
67
71
  comments,
68
72
  });
package/src/ref.js ADDED
@@ -0,0 +1 @@
1
+ export * from '@tsrx/core/runtime/ref';
package/src/transform.js CHANGED
@@ -17,7 +17,8 @@ const react_platform = {
17
17
  fragment: 'react',
18
18
  suspense: 'react',
19
19
  errorBoundary: '@tsrx/react/error-boundary',
20
- mergeRefs: '@tsrx/react/merge-refs',
20
+ mergeRefs: '@tsrx/react/ref',
21
+ refProp: '@tsrx/react/ref',
21
22
  },
22
23
  jsx: {
23
24
  rewriteClassAttr: true,
@@ -27,6 +28,9 @@ const react_platform = {
27
28
  validation: {
28
29
  requireUseServerForAwait: false,
29
30
  },
31
+ hooks: {
32
+ moduleScopedHookComponents: true,
33
+ },
30
34
  };
31
35
 
32
36
  export const transform = createJsxTransform(react_platform);
package/types/index.d.ts CHANGED
@@ -1,21 +1,10 @@
1
1
  import type { Program } from 'estree';
2
- import type { CompileError, ParseOptions, VolarMappingsResult } from '@tsrx/core/types';
2
+ import type { CompileFn, ParseOptions, VolarCompileFn } from '@tsrx/core/types';
3
3
 
4
4
  export function parse(source: string, filename?: string, options?: ParseOptions): Program;
5
5
 
6
- export function compile(
7
- source: string,
8
- filename?: string,
9
- options?: { collect?: boolean; loose?: boolean },
10
- ): {
11
- code: string;
12
- map: unknown;
13
- css: { code: string; hash: string } | null;
14
- errors: CompileError[];
15
- };
6
+ export { isRefProp } from './ref.js';
16
7
 
17
- export function compile_to_volar_mappings(
18
- source: string,
19
- filename?: string,
20
- options?: ParseOptions,
21
- ): VolarMappingsResult;
8
+ export const compile: CompileFn;
9
+
10
+ export const compile_to_volar_mappings: VolarCompileFn;
package/types/ref.d.ts ADDED
@@ -0,0 +1 @@
1
+ export * from '@tsrx/core/runtime/ref';
package/src/merge-refs.js DELETED
@@ -1 +0,0 @@
1
- export { mergeRefs } from '@tsrx/core/runtime/merge-refs';
@@ -1 +0,0 @@
1
- export { mergeRefs } from '@tsrx/core/runtime/merge-refs';