efront 4.0.33 → 4.0.35
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/coms/compile/Javascript.js +5 -5
- package/coms/compile/Javascript_test.js +2 -0
- package/docs/main.xht +29 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
|
@@ -58,7 +58,7 @@ Javascript.prototype.isProperty = function (o) {
|
|
|
58
58
|
return /^(\+\+|\-\-|;)$/.test(prev.text);
|
|
59
59
|
}
|
|
60
60
|
if (prev.type === EXPRESS && !/\.$/.test(prev.text)) return true;
|
|
61
|
-
if (
|
|
61
|
+
if (prev.type & (SCOPED | VALUE | QUOTED | PROPERTY)) return true;
|
|
62
62
|
}
|
|
63
63
|
if (!prev) return false;
|
|
64
64
|
if (prev.type === PROPERTY && propresolve_reg.test(prev.text)) {
|
|
@@ -207,7 +207,7 @@ var isShortMethodEnd = function (o) {
|
|
|
207
207
|
if (o.type !== SCOPED || o.entry !== "(") return false;
|
|
208
208
|
o = o.prev;
|
|
209
209
|
if (!o) return false;
|
|
210
|
-
return o.
|
|
210
|
+
return o.isprop;
|
|
211
211
|
};
|
|
212
212
|
|
|
213
213
|
Javascript.prototype.setType = function (o) {
|
|
@@ -226,7 +226,7 @@ Javascript.prototype.setType = function (o) {
|
|
|
226
226
|
else if (o.type === SCOPED) {
|
|
227
227
|
if (o.entry === '[') {
|
|
228
228
|
if (queue.isObject) o.isprop = this.isProperty(o);
|
|
229
|
-
if (queue.isClass) o.isprop = !last || last.isprop || last.type === STAMP && last.text === ';';
|
|
229
|
+
if (queue.isClass) o.isprop = !last || last.isprop || last.type === STAMP && last.text === ';' || isShortMethodEnd(last);
|
|
230
230
|
}
|
|
231
231
|
else if (o.entry === "{") {
|
|
232
232
|
if (last && last.type === PROPERTY && last.text === 'static') {
|
|
@@ -506,8 +506,9 @@ var removeImport = function (c, i, code) {
|
|
|
506
506
|
var [dec, map, o] = getDeclared(c.next);
|
|
507
507
|
if (dec.length !== 1 || !o) throw new Error("代码结构异常!");
|
|
508
508
|
if (o.type !== STRAP || o.text !== 'from') throw new Error("缺少from语句");
|
|
509
|
+
var oi = code.indexOf(o, i);
|
|
509
510
|
}
|
|
510
|
-
else code.splice(i, 1), o = c;
|
|
511
|
+
else code.splice(i, 1), o = c, oi = i - 1;
|
|
511
512
|
var n = o.next;
|
|
512
513
|
var t = null;
|
|
513
514
|
if (n && n.type === EXPRESS) {
|
|
@@ -522,7 +523,6 @@ var removeImport = function (c, i, code) {
|
|
|
522
523
|
n = n.next;
|
|
523
524
|
}
|
|
524
525
|
if (!n || n.type !== QUOTED) throw new Error("缺少导入路径!");
|
|
525
|
-
var oi = code.indexOf(o, i);
|
|
526
526
|
var ns = skipAssignment(n);
|
|
527
527
|
var nsi = ns ? code.indexOf(ns, i) : code.length;
|
|
528
528
|
var q = scan(`require()`);
|
|
@@ -9,3 +9,5 @@ testFix(`import {a} from "a";console.log(a)`, 'var a1 = require("a"); console.lo
|
|
|
9
9
|
testFix(`console.log(import("a"))`, 'console.log(require("a"))');
|
|
10
10
|
testFix(`import("a")`, 'require("a")');
|
|
11
11
|
testFix(`import "windows.inc"`, 'require("windows.inc")');
|
|
12
|
+
testFix(`import "windows.inc";import "abc.inc";`, 'require("windows.inc"); require("abc.inc");');
|
|
13
|
+
testFix(`import "windows.inc";\r\nimport "abc.inc";`, 'require("windows.inc");\r\nrequire("abc.inc");');
|
package/docs/main.xht
CHANGED
|
@@ -43,6 +43,7 @@
|
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
menu {
|
|
46
|
+
margin: 0;
|
|
46
47
|
width: var(--leftwidth);
|
|
47
48
|
margin-left: -var(--leftwidth);
|
|
48
49
|
height: 100%;
|
|
@@ -51,6 +52,20 @@
|
|
|
51
52
|
max-width: 600px;
|
|
52
53
|
}
|
|
53
54
|
|
|
55
|
+
titlebar {
|
|
56
|
+
background: #2c2c2c;
|
|
57
|
+
-webkit-app-region: drag;
|
|
58
|
+
|
|
59
|
+
>.drop {
|
|
60
|
+
-webkit-app-region: no-drag;
|
|
61
|
+
vertical-align: top;
|
|
62
|
+
right: 20px;
|
|
63
|
+
box-sizing: border-box;
|
|
64
|
+
padding: 0 7px;
|
|
65
|
+
line-height: 44px;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
|
|
54
69
|
div1 {
|
|
55
70
|
display: inline-block;
|
|
56
71
|
width: 100%;
|
|
@@ -204,6 +219,20 @@
|
|
|
204
219
|
};
|
|
205
220
|
var page = document.createElement('grid');
|
|
206
221
|
page.innerHTML = template;
|
|
222
|
+
if (window.require) {
|
|
223
|
+
var title = document.createElement('titlebar');
|
|
224
|
+
title.innerHTML = document.title;
|
|
225
|
+
css(page, { paddingTop: "44px" })
|
|
226
|
+
css(title, { height: '44px', lineHeight: '44px' });
|
|
227
|
+
page.insertBefore(title, page.firstChild);
|
|
228
|
+
var close = drop();
|
|
229
|
+
title.appendChild(close);
|
|
230
|
+
onclick(close, function () {
|
|
231
|
+
window.close();
|
|
232
|
+
})
|
|
233
|
+
titlebar(title, false);
|
|
234
|
+
drag.on(close, window);
|
|
235
|
+
}
|
|
207
236
|
render(page, scope);
|
|
208
237
|
var s = scrollbar();
|
|
209
238
|
on("mounted")(page, initMenus);
|