@tsrx/solid 0.0.19 → 0.0.20
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 +2 -2
- package/src/index.js +13 -6
- package/src/transform.js +1 -1
- package/types/index.d.ts +1 -1
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"description": "Solid compiler built on @tsrx/core",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"author": "Dominic Gannaway",
|
|
6
|
-
"version": "0.0.
|
|
6
|
+
"version": "0.0.20",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"publishConfig": {
|
|
9
9
|
"access": "public"
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"esrap": "^2.1.0",
|
|
24
24
|
"zimmerframe": "^1.1.2",
|
|
25
|
-
"@tsrx/core": "0.0.
|
|
25
|
+
"@tsrx/core": "0.0.20"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
28
|
"solid-js": ">=1.8 || >=2.0.0-beta"
|
package/src/index.js
CHANGED
|
@@ -21,23 +21,23 @@ export function parse(source, filename, options) {
|
|
|
21
21
|
*
|
|
22
22
|
* @param {string} source
|
|
23
23
|
* @param {string} [filename]
|
|
24
|
-
* @param {{ loose?: boolean }} [options]
|
|
24
|
+
* @param {{ collect?: boolean, loose?: boolean }} [options]
|
|
25
25
|
* @returns {{ code: string, map: any, css: { code: string, hash: string } | null, errors: CompileError[] }}
|
|
26
26
|
*/
|
|
27
27
|
export function compile(source, filename, options) {
|
|
28
28
|
const errors = /** @type {CompileError[]} */ ([]);
|
|
29
29
|
const comments = /** @type {AST.CommentWithLocation[]} */ ([]);
|
|
30
|
-
const collect = !!options?.loose;
|
|
30
|
+
const collect = !!(options?.collect || options?.loose);
|
|
31
31
|
const ast = parseModule(
|
|
32
32
|
source,
|
|
33
33
|
filename,
|
|
34
|
-
collect ? {
|
|
34
|
+
collect ? { collect: true, loose: !!options?.loose, errors, comments } : undefined,
|
|
35
35
|
);
|
|
36
36
|
const { ast: _ast, ...result } = transform(
|
|
37
37
|
ast,
|
|
38
38
|
source,
|
|
39
39
|
filename,
|
|
40
|
-
collect ? {
|
|
40
|
+
collect ? { collect: true, loose: !!options?.loose, errors, comments } : undefined,
|
|
41
41
|
);
|
|
42
42
|
return { ...result, errors };
|
|
43
43
|
}
|
|
@@ -53,9 +53,16 @@ export function compile(source, filename, options) {
|
|
|
53
53
|
export function compile_to_volar_mappings(source, filename, options) {
|
|
54
54
|
const errors = /** @type {import('@tsrx/core/types').CompileError[]} */ ([]);
|
|
55
55
|
const comments = /** @type {AST.CommentWithLocation[]} */ ([]);
|
|
56
|
-
const ast = parseModule(source, filename, {
|
|
56
|
+
const ast = parseModule(source, filename, {
|
|
57
|
+
...options,
|
|
58
|
+
collect: true,
|
|
59
|
+
loose: !!options?.loose,
|
|
60
|
+
errors,
|
|
61
|
+
comments,
|
|
62
|
+
});
|
|
57
63
|
const transformed = transform(ast, source, filename, {
|
|
58
|
-
|
|
64
|
+
collect: true,
|
|
65
|
+
loose: !!options?.loose,
|
|
59
66
|
errors,
|
|
60
67
|
comments,
|
|
61
68
|
});
|
package/src/transform.js
CHANGED
|
@@ -35,7 +35,7 @@ import {
|
|
|
35
35
|
* Solid extends the shared `JsxTransformContext` with `needs_*` flags that
|
|
36
36
|
* track which Solid runtime primitives (`Show`, `For`, `Switch`, `Match`,
|
|
37
37
|
* `Errored`, `Loading`) the lowered output requires. The factory seeds these
|
|
38
|
-
* via `hooks.initialState`; everything else (filename,
|
|
38
|
+
* via `hooks.initialState`; everything else (filename, collect, errors,
|
|
39
39
|
* helper_state, …) comes from the shared base.
|
|
40
40
|
*
|
|
41
41
|
* @typedef {JsxTransformContext & {
|
package/types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export function parse(source: string, filename?: string, options?: ParseOptions)
|
|
|
6
6
|
export function compile(
|
|
7
7
|
source: string,
|
|
8
8
|
filename?: string,
|
|
9
|
-
options?: { loose?: boolean },
|
|
9
|
+
options?: { collect?: boolean; loose?: boolean },
|
|
10
10
|
): {
|
|
11
11
|
code: string;
|
|
12
12
|
map: unknown;
|