sinwan-compiler 0.2.3 → 0.2.4
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/dist/index.js +12 -1
- package/dist/transform.d.ts +3 -3
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -183,7 +183,18 @@ function elementToHtml(node, slots, path, filename, counter) {
|
|
|
183
183
|
if (attrName === "children")
|
|
184
184
|
continue;
|
|
185
185
|
if (attrName === "ref") {
|
|
186
|
-
|
|
186
|
+
if (attr.value?.type === "JSXExpressionContainer") {
|
|
187
|
+
const expr = attr.value.expression;
|
|
188
|
+
if (expr.type !== "JSXEmptyExpression") {
|
|
189
|
+
slots.push({
|
|
190
|
+
path: [...path],
|
|
191
|
+
type: "ref",
|
|
192
|
+
name: "ref",
|
|
193
|
+
expr
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
continue;
|
|
187
198
|
}
|
|
188
199
|
if (attr.value?.type === "JSXExpressionContainer") {
|
|
189
200
|
const expr = attr.value.expression;
|
package/dist/transform.d.ts
CHANGED
|
@@ -35,9 +35,9 @@ export interface TransformOptions {
|
|
|
35
35
|
* in sync.
|
|
36
36
|
*/
|
|
37
37
|
export declare const COMPILER_TEMPLATE_SLOT_PROTOCOL: {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
slotPrefix: string;
|
|
39
|
+
encodeSlot(index: number): string;
|
|
40
|
+
decodeSlot(data: string): number | null;
|
|
41
41
|
};
|
|
42
42
|
export declare function transformJSX(code: string, filename: string, options?: TransformOptions): {
|
|
43
43
|
code: string;
|