malinajs 0.6.60 → 0.6.63

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/compile.js CHANGED
@@ -53,7 +53,7 @@ const isNumber = (value) => {
53
53
  function detectExpressionType(name) {
54
54
  if(isSimpleName(name)) return 'identifier';
55
55
 
56
- let ast = acorn.parse(name, {allowReturnOutsideFunction: true});
56
+ let ast = acorn.parse(name, {allowReturnOutsideFunction: true, ecmaVersion: 'latest'});
57
57
 
58
58
  function checkIdentificator(body) {
59
59
  if(body.length != 1) return;
@@ -250,7 +250,7 @@ const genId = () => {
250
250
 
251
251
 
252
252
  const extractKeywords = (exp) => {
253
- let ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 12});
253
+ let ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 'latest'});
254
254
 
255
255
  const keys = new Set();
256
256
  const rec = (n) => {
@@ -305,7 +305,7 @@ const replaceElementKeyword = (exp, fn) => {
305
305
 
306
306
  const parseJS = (exp) => {
307
307
  let self = {};
308
- self.ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 12});
308
+ self.ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 'latest'});
309
309
 
310
310
  self.transform = function(fn) {
311
311
  const rec = (n, pk) => {
@@ -1126,7 +1126,7 @@ function parse$1() {
1126
1126
  if(isBlockComment) return;
1127
1127
  this.script.comments.push({start, end, value});
1128
1128
  };
1129
- this.script.ast = acorn.parse(source, {sourceType: 'module', ecmaVersion: 12, onComment});
1129
+ this.script.ast = acorn.parse(source, {sourceType: 'module', ecmaVersion: 'latest', onComment});
1130
1130
 
1131
1131
  if(source.includes('$props')) this.require('$props');
1132
1132
  if(source.includes('$attributes')) this.require('$attributes');
@@ -4681,7 +4681,7 @@ function bindProp(prop, node, element) {
4681
4681
  ctx.writeLine(`$runtime.bindInput($cd, ${n.el}, '${attr}', () => ${exp}, ${argName} => {${exp} = ${argName}; $$apply();});`);
4682
4682
  })};
4683
4683
  } else if(name == 'style' && arg) {
4684
- let styleName = toCamelCase(arg);
4684
+ let styleName = arg;
4685
4685
  let exp;
4686
4686
  if(prop.value) {
4687
4687
  if(isExpression(prop.value)) {
@@ -4698,12 +4698,12 @@ function bindProp(prop, node, element) {
4698
4698
  name: styleName,
4699
4699
  value: prop.value
4700
4700
  }, (ctx, n) => {
4701
- ctx.writeLine(`${n.el}.style.${n.name} = \`${this.Q(n.value)}\`;`);
4701
+ ctx.writeLine(`${n.el}.style.${toCamelCase(n.name)} = \`${this.Q(n.value)}\`;`);
4702
4702
  })};
4703
4703
  }
4704
4704
  }
4705
4705
  } else {
4706
- exp = styleName;
4706
+ exp = toCamelCase(styleName);
4707
4707
  }
4708
4708
 
4709
4709
  let hasElement = exp.includes('$element');
@@ -4719,7 +4719,7 @@ function bindProp(prop, node, element) {
4719
4719
  if(ctx.inuse.apply) {
4720
4720
  ctx.writeLine(`$runtime.bindStyle($cd, ${n.el}, '${n.styleName}', () => (${n.exp}));`);
4721
4721
  } else {
4722
- ctx.writeLine(`${n.el}.style.${n.styleName} = ${n.exp};`);
4722
+ ctx.writeLine(`${n.el}.style.${toCamelCase(n.styleName)} = ${n.exp};`);
4723
4723
  }
4724
4724
  })]
4725
4725
  })};
@@ -5377,6 +5377,11 @@ function makeFragment(node) {
5377
5377
  });
5378
5378
  }
5379
5379
 
5380
+ if(external) {
5381
+ this.require('$component');
5382
+ if(props?.length) this.require('apply');
5383
+ }
5384
+
5380
5385
  return xNode('fragment', {
5381
5386
  name,
5382
5387
  props,
package/malina.js CHANGED
@@ -54,7 +54,7 @@
54
54
  function detectExpressionType(name) {
55
55
  if(isSimpleName(name)) return 'identifier';
56
56
 
57
- let ast = acorn.parse(name, {allowReturnOutsideFunction: true});
57
+ let ast = acorn.parse(name, {allowReturnOutsideFunction: true, ecmaVersion: 'latest'});
58
58
 
59
59
  function checkIdentificator(body) {
60
60
  if(body.length != 1) return;
@@ -251,7 +251,7 @@
251
251
 
252
252
 
253
253
  const extractKeywords = (exp) => {
254
- let ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 12});
254
+ let ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 'latest'});
255
255
 
256
256
  const keys = new Set();
257
257
  const rec = (n) => {
@@ -306,7 +306,7 @@
306
306
 
307
307
  const parseJS = (exp) => {
308
308
  let self = {};
309
- self.ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 12});
309
+ self.ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 'latest'});
310
310
 
311
311
  self.transform = function(fn) {
312
312
  const rec = (n, pk) => {
@@ -1127,7 +1127,7 @@
1127
1127
  if(isBlockComment) return;
1128
1128
  this.script.comments.push({start, end, value});
1129
1129
  };
1130
- this.script.ast = acorn.parse(source, {sourceType: 'module', ecmaVersion: 12, onComment});
1130
+ this.script.ast = acorn.parse(source, {sourceType: 'module', ecmaVersion: 'latest', onComment});
1131
1131
 
1132
1132
  if(source.includes('$props')) this.require('$props');
1133
1133
  if(source.includes('$attributes')) this.require('$attributes');
@@ -4682,7 +4682,7 @@
4682
4682
  ctx.writeLine(`$runtime.bindInput($cd, ${n.el}, '${attr}', () => ${exp}, ${argName} => {${exp} = ${argName}; $$apply();});`);
4683
4683
  })};
4684
4684
  } else if(name == 'style' && arg) {
4685
- let styleName = toCamelCase(arg);
4685
+ let styleName = arg;
4686
4686
  let exp;
4687
4687
  if(prop.value) {
4688
4688
  if(isExpression(prop.value)) {
@@ -4699,12 +4699,12 @@
4699
4699
  name: styleName,
4700
4700
  value: prop.value
4701
4701
  }, (ctx, n) => {
4702
- ctx.writeLine(`${n.el}.style.${n.name} = \`${this.Q(n.value)}\`;`);
4702
+ ctx.writeLine(`${n.el}.style.${toCamelCase(n.name)} = \`${this.Q(n.value)}\`;`);
4703
4703
  })};
4704
4704
  }
4705
4705
  }
4706
4706
  } else {
4707
- exp = styleName;
4707
+ exp = toCamelCase(styleName);
4708
4708
  }
4709
4709
 
4710
4710
  let hasElement = exp.includes('$element');
@@ -4720,7 +4720,7 @@
4720
4720
  if(ctx.inuse.apply) {
4721
4721
  ctx.writeLine(`$runtime.bindStyle($cd, ${n.el}, '${n.styleName}', () => (${n.exp}));`);
4722
4722
  } else {
4723
- ctx.writeLine(`${n.el}.style.${n.styleName} = ${n.exp};`);
4723
+ ctx.writeLine(`${n.el}.style.${toCamelCase(n.styleName)} = ${n.exp};`);
4724
4724
  }
4725
4725
  })]
4726
4726
  })};
@@ -5378,6 +5378,11 @@
5378
5378
  });
5379
5379
  }
5380
5380
 
5381
+ if(external) {
5382
+ this.require('$component');
5383
+ if(props?.length) this.require('apply');
5384
+ }
5385
+
5381
5386
  return xNode('fragment', {
5382
5387
  name,
5383
5388
  props,
@@ -5926,7 +5931,7 @@
5926
5931
  return {event, fn};
5927
5932
  }
5928
5933
 
5929
- const version = '0.6.60';
5934
+ const version = '0.6.63';
5930
5935
 
5931
5936
 
5932
5937
  async function compile(source, config = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "malinajs",
3
- "version": "0.6.60",
3
+ "version": "0.6.63",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "prepare": "npm run build",
@@ -15,7 +15,7 @@
15
15
  "brotli": "brotli --input /app/malinajs/example/public/app.min.js --output /app/malinajs/example/public/app.min.js.br; brotli --input /app/malinajs/example/public/app.min2.js --output /app/malinajs/example/public/app.min2.js.br"
16
16
  },
17
17
  "dependencies": {
18
- "acorn": "^7.3.1",
18
+ "acorn": "^8.7.1",
19
19
  "astring": "^1.4.3",
20
20
  "css-tree": "^1.0.0-alpha.39"
21
21
  },
package/runtime.js CHANGED
@@ -718,7 +718,7 @@ const exportFragment = ($component, name, fn) => {
718
718
  let $cd = $childCD.new();
719
719
  cd_onDestroy($parentCD, () => $cd.destroy());
720
720
  fn($cd, label, props, events, slot);
721
- $component.apply();
721
+ $component.apply?.();
722
722
  };
723
723
  };
724
724
 
@@ -734,7 +734,7 @@ const observeProps = (cmp, fn) => {
734
734
  let result;
735
735
  fire($watch(cd, fn, value => {
736
736
  result = value;
737
- target.$$.apply();
737
+ target.$$.apply?.();
738
738
  }, {ro: true, value: {}, cmp}));
739
739
  return () => result;
740
740
  }