@tsrx/preact 0.3.5 → 0.4.1
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 +8 -4
- package/src/index.js +3 -1
- package/src/transform.js +10 -0
- package/src/try-body.js +1 -0
- package/types/try-body.d.ts +1 -0
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Preact compiler built on @tsrx/core",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.
|
|
6
|
+
"version": "0.4.1",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
"./dynamic": {
|
|
26
26
|
"types": "./types/dynamic.d.ts"
|
|
27
27
|
},
|
|
28
|
+
"./try-body": {
|
|
29
|
+
"types": "./types/try-body.d.ts",
|
|
30
|
+
"default": "./src/try-body.js"
|
|
31
|
+
},
|
|
28
32
|
"./ref": {
|
|
29
33
|
"types": "./types/ref.d.ts",
|
|
30
34
|
"default": "./src/ref.js"
|
|
@@ -35,10 +39,10 @@
|
|
|
35
39
|
}
|
|
36
40
|
},
|
|
37
41
|
"dependencies": {
|
|
38
|
-
"esrap": "^2.
|
|
42
|
+
"esrap": "^2.4.0",
|
|
39
43
|
"zimmerframe": "^1.1.2",
|
|
40
|
-
"@tsrx/core": "0.
|
|
41
|
-
"@tsrx/preact-runtime": "0.
|
|
44
|
+
"@tsrx/core": "0.6.1",
|
|
45
|
+
"@tsrx/preact-runtime": "0.2.0"
|
|
42
46
|
},
|
|
43
47
|
"peerDependencies": {
|
|
44
48
|
"preact": ">=10"
|
package/src/index.js
CHANGED
|
@@ -128,5 +128,7 @@ export function compile_to_volar_mappings(source, filename, options) {
|
|
|
128
128
|
...result,
|
|
129
129
|
mappings: dedupeMappings(result.mappings),
|
|
130
130
|
};
|
|
131
|
-
return uses_platform_flags
|
|
131
|
+
return uses_platform_flags
|
|
132
|
+
? withPlatformTypes(deduped, options?.platform, transformed.ast)
|
|
133
|
+
: deduped;
|
|
132
134
|
}
|
package/src/transform.js
CHANGED
|
@@ -31,20 +31,30 @@ const preact_platform = {
|
|
|
31
31
|
// type-only transform keeps the `Dynamic` component shape (types only).
|
|
32
32
|
dynamicFactory: {},
|
|
33
33
|
errorBoundary: '@tsrx/preact/error-boundary',
|
|
34
|
+
tryBody: '@tsrx/preact/try-body',
|
|
34
35
|
mergeRefs: '@tsrx/preact/ref',
|
|
35
36
|
refProp: '@tsrx/preact/ref',
|
|
36
37
|
forOfIterableHelper: '@tsrx/preact/runtime/iterable',
|
|
37
38
|
},
|
|
38
39
|
directRuntimeImports: {
|
|
39
40
|
errorBoundary: '@tsrx/preact-runtime/error-boundary',
|
|
41
|
+
tryBody: '@tsrx/preact-runtime/try-body',
|
|
40
42
|
mergeRefs: '@tsrx/preact-runtime/ref',
|
|
41
43
|
refProp: '@tsrx/preact-runtime/ref',
|
|
42
44
|
forOfIterableHelper: '@tsrx/preact-runtime/iterable',
|
|
43
45
|
},
|
|
44
46
|
jsx: {
|
|
45
47
|
rewriteClassAttr: false,
|
|
48
|
+
// Preact reads a class from either prop.
|
|
49
|
+
hostSpreadClassProps: ['class', 'className'],
|
|
50
|
+
// Preact renders `class={true}` as `true`. (`className={false}` renders
|
|
51
|
+
// `false` too, which the shared join leaves out.)
|
|
52
|
+
classValue: 'text-true',
|
|
46
53
|
multiRefStrategy: 'merge-refs',
|
|
54
|
+
// No `shareMergedRefs`: Preact stores a ref's cleanup on the function, so
|
|
55
|
+
// elements sharing one merged ref would run each other's cleanups.
|
|
47
56
|
hostSpreadRefBinding: 'in-place',
|
|
57
|
+
pendingFallback: 'try-body',
|
|
48
58
|
// preact-render-to-string escapes a string child of `<script>` like
|
|
49
59
|
// text; `dangerouslySetInnerHTML` renders the body as written on the
|
|
50
60
|
// client and the server.
|
package/src/try-body.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tsrx/preact-runtime/try-body';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@tsrx/preact-runtime/try-body';
|