malinajs 0.8.0-a3 → 0.8.0-a4

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.
Files changed (3) hide show
  1. package/malina.js +15 -9
  2. package/malina.mjs +15 -9
  3. package/package.json +1 -1
package/malina.js CHANGED
@@ -8571,13 +8571,18 @@
8571
8571
  comments: []
8572
8572
  };
8573
8573
  if (source) {
8574
- source = source.split(/\n/).map(line => {
8575
- let rx = line.match(/^(\s*)\/\/(.*)$/);
8576
- if (!rx) return line;
8577
- let code = rx[2].trim();
8578
- if (code != '!no-check') return line;
8579
- return rx[1] + '$$_noCheck;';
8580
- }).join('\n');
8574
+ if (this.scriptNodes[0].attributes?.some(a => a.name == 'manual')) {
8575
+ this.require('apply');
8576
+ this.script.manual = true;
8577
+ } else {
8578
+ source = source.split(/\n/).map(line => {
8579
+ let rx = line.match(/^(\s*)\/\/(.*)$/);
8580
+ if (!rx) return line;
8581
+ let code = rx[2].trim();
8582
+ if (code != '!no-check') return line;
8583
+ return rx[1] + '$$_noCheck;';
8584
+ }).join('\n');
8585
+ }
8581
8586
 
8582
8587
  const onComment = (isBlockComment, value, start, end) => {
8583
8588
  if (isBlockComment) return;
@@ -8745,7 +8750,7 @@
8745
8750
  }
8746
8751
  }
8747
8752
  }
8748
- walk(ast, null);
8753
+ if (!this.script.manual) walk(ast, null);
8749
8754
 
8750
8755
  function makeVariable(name) {
8751
8756
  return {
@@ -9118,6 +9123,7 @@
9118
9123
  if (n.value || this.inuse.rootCD) {
9119
9124
  this.require('componentFn');
9120
9125
  ctx.writeLine('const $$apply = $runtime.makeApply();');
9126
+ if (this.script.manual) ctx.writeLine('const $render = $$apply;');
9121
9127
  }
9122
9128
  };
9123
9129
  this.module.head.unshift(this.glob.apply);
@@ -26575,7 +26581,7 @@
26575
26581
  });
26576
26582
  }
26577
26583
 
26578
- const version = '0.8.0-a3';
26584
+ const version = '0.8.0-a4';
26579
26585
 
26580
26586
 
26581
26587
  async function compile(source, config = {}) {
package/malina.mjs CHANGED
@@ -8565,13 +8565,18 @@ function parse() {
8565
8565
  comments: []
8566
8566
  };
8567
8567
  if (source) {
8568
- source = source.split(/\n/).map(line => {
8569
- let rx = line.match(/^(\s*)\/\/(.*)$/);
8570
- if (!rx) return line;
8571
- let code = rx[2].trim();
8572
- if (code != '!no-check') return line;
8573
- return rx[1] + '$$_noCheck;';
8574
- }).join('\n');
8568
+ if (this.scriptNodes[0].attributes?.some(a => a.name == 'manual')) {
8569
+ this.require('apply');
8570
+ this.script.manual = true;
8571
+ } else {
8572
+ source = source.split(/\n/).map(line => {
8573
+ let rx = line.match(/^(\s*)\/\/(.*)$/);
8574
+ if (!rx) return line;
8575
+ let code = rx[2].trim();
8576
+ if (code != '!no-check') return line;
8577
+ return rx[1] + '$$_noCheck;';
8578
+ }).join('\n');
8579
+ }
8575
8580
 
8576
8581
  const onComment = (isBlockComment, value, start, end) => {
8577
8582
  if (isBlockComment) return;
@@ -8739,7 +8744,7 @@ function transform() {
8739
8744
  }
8740
8745
  }
8741
8746
  }
8742
- walk(ast, null);
8747
+ if (!this.script.manual) walk(ast, null);
8743
8748
 
8744
8749
  function makeVariable(name) {
8745
8750
  return {
@@ -9112,6 +9117,7 @@ function buildRuntime() {
9112
9117
  if (n.value || this.inuse.rootCD) {
9113
9118
  this.require('componentFn');
9114
9119
  ctx.writeLine('const $$apply = $runtime.makeApply();');
9120
+ if (this.script.manual) ctx.writeLine('const $render = $$apply;');
9115
9121
  }
9116
9122
  };
9117
9123
  this.module.head.unshift(this.glob.apply);
@@ -26569,7 +26575,7 @@ function makeKeepAlive(node) {
26569
26575
  });
26570
26576
  }
26571
26577
 
26572
- const version = '0.8.0-a3';
26578
+ const version = '0.8.0-a4';
26573
26579
 
26574
26580
 
26575
26581
  async function compile(source, config = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "malinajs",
3
- "version": "0.8.0-a3",
3
+ "version": "0.8.0-a4",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "build": "rollup -c",