malinajs 0.6.61 → 0.6.64
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 +11 -8
- package/malina.js +12 -9
- package/package.json +2 -2
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:
|
|
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:
|
|
308
|
+
self.ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 'latest'});
|
|
309
309
|
|
|
310
310
|
self.transform = function(fn) {
|
|
311
311
|
const rec = (n, pk) => {
|
|
@@ -1010,6 +1010,9 @@ function parse() {
|
|
|
1010
1010
|
assert(parent.type === 'fragment', 'Fragment error: /fragment');
|
|
1011
1011
|
return;
|
|
1012
1012
|
} else throw 'Error binding: ' + bind.value;
|
|
1013
|
+
} else {
|
|
1014
|
+
addText(readBinding().raw);
|
|
1015
|
+
continue;
|
|
1013
1016
|
}
|
|
1014
1017
|
}
|
|
1015
1018
|
|
|
@@ -1126,7 +1129,7 @@ function parse$1() {
|
|
|
1126
1129
|
if(isBlockComment) return;
|
|
1127
1130
|
this.script.comments.push({start, end, value});
|
|
1128
1131
|
};
|
|
1129
|
-
this.script.ast = acorn.parse(source, {sourceType: 'module', ecmaVersion:
|
|
1132
|
+
this.script.ast = acorn.parse(source, {sourceType: 'module', ecmaVersion: 'latest', onComment});
|
|
1130
1133
|
|
|
1131
1134
|
if(source.includes('$props')) this.require('$props');
|
|
1132
1135
|
if(source.includes('$attributes')) this.require('$attributes');
|
|
@@ -4681,7 +4684,7 @@ function bindProp(prop, node, element) {
|
|
|
4681
4684
|
ctx.writeLine(`$runtime.bindInput($cd, ${n.el}, '${attr}', () => ${exp}, ${argName} => {${exp} = ${argName}; $$apply();});`);
|
|
4682
4685
|
})};
|
|
4683
4686
|
} else if(name == 'style' && arg) {
|
|
4684
|
-
let styleName =
|
|
4687
|
+
let styleName = arg;
|
|
4685
4688
|
let exp;
|
|
4686
4689
|
if(prop.value) {
|
|
4687
4690
|
if(isExpression(prop.value)) {
|
|
@@ -4698,12 +4701,12 @@ function bindProp(prop, node, element) {
|
|
|
4698
4701
|
name: styleName,
|
|
4699
4702
|
value: prop.value
|
|
4700
4703
|
}, (ctx, n) => {
|
|
4701
|
-
ctx.writeLine(`${n.el}.style.${n.name} = \`${this.Q(n.value)}\`;`);
|
|
4704
|
+
ctx.writeLine(`${n.el}.style.${toCamelCase(n.name)} = \`${this.Q(n.value)}\`;`);
|
|
4702
4705
|
})};
|
|
4703
4706
|
}
|
|
4704
4707
|
}
|
|
4705
4708
|
} else {
|
|
4706
|
-
exp = styleName;
|
|
4709
|
+
exp = toCamelCase(styleName);
|
|
4707
4710
|
}
|
|
4708
4711
|
|
|
4709
4712
|
let hasElement = exp.includes('$element');
|
|
@@ -4719,7 +4722,7 @@ function bindProp(prop, node, element) {
|
|
|
4719
4722
|
if(ctx.inuse.apply) {
|
|
4720
4723
|
ctx.writeLine(`$runtime.bindStyle($cd, ${n.el}, '${n.styleName}', () => (${n.exp}));`);
|
|
4721
4724
|
} else {
|
|
4722
|
-
ctx.writeLine(`${n.el}.style.${n.styleName} = ${n.exp};`);
|
|
4725
|
+
ctx.writeLine(`${n.el}.style.${toCamelCase(n.styleName)} = ${n.exp};`);
|
|
4723
4726
|
}
|
|
4724
4727
|
})]
|
|
4725
4728
|
})};
|
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:
|
|
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:
|
|
309
|
+
self.ast = acorn.parse(exp, {sourceType: 'module', ecmaVersion: 'latest'});
|
|
310
310
|
|
|
311
311
|
self.transform = function(fn) {
|
|
312
312
|
const rec = (n, pk) => {
|
|
@@ -1011,6 +1011,9 @@
|
|
|
1011
1011
|
assert(parent.type === 'fragment', 'Fragment error: /fragment');
|
|
1012
1012
|
return;
|
|
1013
1013
|
} else throw 'Error binding: ' + bind.value;
|
|
1014
|
+
} else {
|
|
1015
|
+
addText(readBinding().raw);
|
|
1016
|
+
continue;
|
|
1014
1017
|
}
|
|
1015
1018
|
}
|
|
1016
1019
|
|
|
@@ -1127,7 +1130,7 @@
|
|
|
1127
1130
|
if(isBlockComment) return;
|
|
1128
1131
|
this.script.comments.push({start, end, value});
|
|
1129
1132
|
};
|
|
1130
|
-
this.script.ast = acorn.parse(source, {sourceType: 'module', ecmaVersion:
|
|
1133
|
+
this.script.ast = acorn.parse(source, {sourceType: 'module', ecmaVersion: 'latest', onComment});
|
|
1131
1134
|
|
|
1132
1135
|
if(source.includes('$props')) this.require('$props');
|
|
1133
1136
|
if(source.includes('$attributes')) this.require('$attributes');
|
|
@@ -4682,7 +4685,7 @@
|
|
|
4682
4685
|
ctx.writeLine(`$runtime.bindInput($cd, ${n.el}, '${attr}', () => ${exp}, ${argName} => {${exp} = ${argName}; $$apply();});`);
|
|
4683
4686
|
})};
|
|
4684
4687
|
} else if(name == 'style' && arg) {
|
|
4685
|
-
let styleName =
|
|
4688
|
+
let styleName = arg;
|
|
4686
4689
|
let exp;
|
|
4687
4690
|
if(prop.value) {
|
|
4688
4691
|
if(isExpression(prop.value)) {
|
|
@@ -4699,12 +4702,12 @@
|
|
|
4699
4702
|
name: styleName,
|
|
4700
4703
|
value: prop.value
|
|
4701
4704
|
}, (ctx, n) => {
|
|
4702
|
-
ctx.writeLine(`${n.el}.style.${n.name} = \`${this.Q(n.value)}\`;`);
|
|
4705
|
+
ctx.writeLine(`${n.el}.style.${toCamelCase(n.name)} = \`${this.Q(n.value)}\`;`);
|
|
4703
4706
|
})};
|
|
4704
4707
|
}
|
|
4705
4708
|
}
|
|
4706
4709
|
} else {
|
|
4707
|
-
exp = styleName;
|
|
4710
|
+
exp = toCamelCase(styleName);
|
|
4708
4711
|
}
|
|
4709
4712
|
|
|
4710
4713
|
let hasElement = exp.includes('$element');
|
|
@@ -4720,7 +4723,7 @@
|
|
|
4720
4723
|
if(ctx.inuse.apply) {
|
|
4721
4724
|
ctx.writeLine(`$runtime.bindStyle($cd, ${n.el}, '${n.styleName}', () => (${n.exp}));`);
|
|
4722
4725
|
} else {
|
|
4723
|
-
ctx.writeLine(`${n.el}.style.${n.styleName} = ${n.exp};`);
|
|
4726
|
+
ctx.writeLine(`${n.el}.style.${toCamelCase(n.styleName)} = ${n.exp};`);
|
|
4724
4727
|
}
|
|
4725
4728
|
})]
|
|
4726
4729
|
})};
|
|
@@ -5931,7 +5934,7 @@
|
|
|
5931
5934
|
return {event, fn};
|
|
5932
5935
|
}
|
|
5933
5936
|
|
|
5934
|
-
const version = '0.6.
|
|
5937
|
+
const version = '0.6.64';
|
|
5935
5938
|
|
|
5936
5939
|
|
|
5937
5940
|
async function compile(source, config = {}) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "malinajs",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.64",
|
|
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.
|
|
18
|
+
"acorn": "^8.7.1",
|
|
19
19
|
"astring": "^1.4.3",
|
|
20
20
|
"css-tree": "^1.0.0-alpha.39"
|
|
21
21
|
},
|