lilact 0.31.13 → 0.31.15

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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lilact",
3
- "version": "0.31.13",
3
+ "version": "0.31.15",
4
4
  "description": "A Little React/JSX Runtime Implementation for Browser",
5
5
  "repository": "github:arashkazemi/lilact",
6
6
  "homepage": "https://arashkazemi.github.io/lilact/",
@@ -715,7 +715,7 @@ class ComponentCore
715
715
  this.element.setAttribute('for', patch[a]);
716
716
  }
717
717
  else if(al!=='value' || ['input', 'textarea', 'select'].indexOf(this.entity)===-1) {
718
- this.element.setAttribute(al, patch[a]);
718
+ this.element.setAttribute(a, patch[a]);
719
719
  }
720
720
  }
721
721
  }
package/src/expscan.js CHANGED
@@ -337,17 +337,18 @@ export function processImportExports(node, jsx, meta)
337
337
  continue;
338
338
  }
339
339
  case 'F':{
340
- const tp = node.out[i];
341
- node.out[i] = null;
340
+
342
341
  i++;
343
- skip_spaces();
342
+
343
+ while(s[i]===' ' || s[i]==='\n' || s[i]==='C') {
344
+ i++;
345
+ }
346
+
344
347
  const name = node.out[i];
345
-
346
- // node.out[i] = null;
347
- // i++;
348
- // skip_spaces();
349
-
350
- node.out[m.index].cjs = `module.exports.${name} = ${tp} `;
348
+
349
+ node.out[m.index].cjs = '';
350
+ node.out[m.index].appendix_js = `module.exports.${name} = ${name};`;
351
+
351
352
  continue;
352
353
  }
353
354
  case '*':
package/src/jsx.js CHANGED
@@ -1085,6 +1085,7 @@ export function transpileJSX( jsx, {
1085
1085
  preprocessPragmas(json);
1086
1086
 
1087
1087
  const flattened_nodes = [];
1088
+ let appendix_js = '\n';
1088
1089
 
1089
1090
  const codify = (outlen, node, is_attr=false, is_xml=false)=> {
1090
1091
 
@@ -1098,7 +1099,10 @@ export function transpileJSX( jsx, {
1098
1099
 
1099
1100
  if(node.type==='string') return jsx.substring(node.begin, node.end);
1100
1101
  if(node.type==='import') return node.cjs;
1101
- if(node.type==='export') return node.cjs;
1102
+ if(node.type==='export') {
1103
+ if(node.appendix_js) appendix_js+=node.appendix_js;
1104
+ return node.cjs;
1105
+ }
1102
1106
  if(node.type==='regex') return jsx.substring(node.begin, node.end);
1103
1107
  if(node.type==='comment') return (discardComments || is_attr)?'':jsx.substring(node.begin, node.end);
1104
1108
  if(node.type==='directive') return node.value;
@@ -1195,6 +1199,8 @@ export function transpileJSX( jsx, {
1195
1199
  }
1196
1200
  out+=codify(out.length, json);
1197
1201
 
1202
+ out+=appendix_js.length>1?appendix_js:'';
1203
+
1198
1204
  if(injectTraceLabels) {
1199
1205
  if(transpilerConfig.enableLabelStack) {
1200
1206
  out += `}catch(e){ if(typeof(e)!=='object') e=new Error(e);e.lilact_trace=[${blocksInfo.counter},e.lilact_trace];throw e}`;