efront 2.41.8 → 2.42.1
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/apps/kugou/index.html +3 -0
- package/coms/compile/scanner2.js +217 -85
- package/coms/compile/scanner2_test.js +52 -9
- package/coms/zimoli/cross.js +11 -13
- package/coms/zimoli/slider.js +1 -1
- package/coms/zimoli/zimoli.js +8 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
var fs = require("fs");
|
|
2
2
|
var path = require("path");
|
|
3
|
+
var esprima = require("../esprima/index");
|
|
4
|
+
var typescript = require("../typescript/index");
|
|
5
|
+
var console = require("../efront/colored_console");
|
|
6
|
+
var scanner = require("./scanner2");
|
|
3
7
|
var data = fs.readFileSync(path.join(__dirname, "../typescript/index.js")).toString();
|
|
4
8
|
var data2 = fs.readFileSync(path.join(__dirname, "./scanner2.js")).toString();
|
|
5
9
|
// data='{ \r\na( ){ return a;} }';
|
|
@@ -10,17 +14,56 @@ function test(parser, name) {
|
|
|
10
14
|
console.log(new Date - time, name);
|
|
11
15
|
return parsed;
|
|
12
16
|
}
|
|
17
|
+
function testSpeed() {
|
|
13
18
|
|
|
14
|
-
|
|
15
|
-
var
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
fs.writeFileSync(path.join(__dirname, "./scanner2_temp.js"), data3);
|
|
19
|
+
console.log(data.slice(6426300,6426400))
|
|
20
|
+
var scanned = test(scanner, 'scanner2');
|
|
21
|
+
var start = new Date();
|
|
22
|
+
var data3 = scanned.press().toString();
|
|
23
|
+
console.log(new Date - start, 'press().toString()');
|
|
24
|
+
fs.writeFileSync(path.join(__dirname, "./scanner2_temp.js"), data3);
|
|
21
25
|
|
|
22
|
-
test(esprima.parse, 'esprima.parse');
|
|
23
|
-
test(esprima.tokenize, 'esprima.tokenize');
|
|
26
|
+
test(esprima.parse, 'esprima.parse');
|
|
27
|
+
test(esprima.tokenize, 'esprima.tokenize');
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
function testVariables() {
|
|
31
|
+
var rootpath = path.join(__dirname, "../zimoli/");
|
|
32
|
+
var getVariables = require("./variables");
|
|
33
|
+
var names = fs.readdirSync(rootpath);
|
|
34
|
+
names.forEach(n => {
|
|
35
|
+
if (!/\.js$/i.test(n)) return;
|
|
36
|
+
var data3 = fs.readFileSync(path.join(rootpath, n)).toString().replace(/^\s*#!/, '//');
|
|
37
|
+
try {
|
|
38
|
+
var jst = esprima.parse(data3);
|
|
39
|
+
} catch (e) {
|
|
40
|
+
data3 = typescript.transpile(data3);
|
|
41
|
+
jst = esprima.parse(data3);
|
|
42
|
+
}
|
|
43
|
+
console.info(n);
|
|
44
|
+
if (n === "grid.js") debugger;
|
|
45
|
+
var globals = scanner(data3).getUndecleared();
|
|
46
|
+
var {
|
|
47
|
+
unDeclaredVariables: undeclares
|
|
48
|
+
} = getVariables(jst);
|
|
49
|
+
var warn = false;
|
|
50
|
+
for (var k in globals) {
|
|
51
|
+
if (!(k in undeclares)) {
|
|
52
|
+
warn = true;
|
|
53
|
+
if (warn) console.warn(n, k, 'globals:', globals[k], 'undeclared:', undeclares[k]);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
for (var k in undeclares) {
|
|
57
|
+
if (!(k in globals)) {
|
|
58
|
+
warn = true;
|
|
59
|
+
if (warn) console.warn(n, k, 'globals:', globals[k], 'undeclared:', undeclares[k]);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
24
62
|
|
|
63
|
+
|
|
64
|
+
})
|
|
65
|
+
}
|
|
66
|
+
testSpeed();
|
|
67
|
+
testVariables();
|
|
25
68
|
// var typescript = require("../typescript/index");
|
|
26
69
|
// typescript.transpile(data.toString(), { noEmitHelpers: true });
|
package/coms/zimoli/cross.js
CHANGED
|
@@ -5,15 +5,11 @@ var domainReg = /^(?:(https?)\:)?\/\/(.*?)(?:\/(.*?))?([\?#].*)?$/i;
|
|
|
5
5
|
var base = domainReg.test(location.href) ? '/' : "http://efront.cc/";
|
|
6
6
|
var location_host = location.href.replace(domainReg, '$1://$2/');
|
|
7
7
|
var setHost = function (host) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
host = (/^https/.test(location_host) ? "https://" : "http://") + host.replace(domainReg, '$2/');
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (host) base = host;
|
|
8
|
+
var parsed = parseURL(host);
|
|
9
|
+
if (!host) return console.error("cross_host格式不正确", host);
|
|
10
|
+
var host = parsed.host + (parsed.pathname || '/');
|
|
11
|
+
host = (/^https/.test(location_host) ? "https://" : "http://") + host;
|
|
12
|
+
base = host;
|
|
17
13
|
};
|
|
18
14
|
var { efrontURI, cross_host = efrontURI } = this;
|
|
19
15
|
if (cross_host) setHost(cross_host);
|
|
@@ -33,9 +29,9 @@ function getDomainPath(url) {
|
|
|
33
29
|
}
|
|
34
30
|
function getRequestProtocol(url) {
|
|
35
31
|
if (/^https:/i.test(url)) {
|
|
36
|
-
return "https";
|
|
32
|
+
return "https:";
|
|
37
33
|
}
|
|
38
|
-
return "http";
|
|
34
|
+
return "http:";
|
|
39
35
|
}
|
|
40
36
|
function getCookies(domainPath) {
|
|
41
37
|
var cookieObject = {};
|
|
@@ -118,9 +114,11 @@ var getCrossUrl = function (domain, headers) {
|
|
|
118
114
|
_headers.Cookie = _cookies;
|
|
119
115
|
}
|
|
120
116
|
extend(_headers, headers);
|
|
117
|
+
_headers = serialize(_headers);
|
|
118
|
+
if (_headers) _headers = "," + _headers;
|
|
121
119
|
return domain
|
|
122
120
|
.replace(/^s?\/\//i, "http$&")
|
|
123
|
-
.replace(domainReg, base + `*${/^(https\:|s\/\/)/i.test(domain) ? "*" : ""}$2
|
|
121
|
+
.replace(domainReg, base + `*${/^(https\:|s\/\/)/i.test(domain) ? "*" : ""}$2${_headers}/$3$4`);
|
|
124
122
|
};
|
|
125
123
|
function cross(method, url, headers) {
|
|
126
124
|
var originDomain = getDomainPath(url);
|
|
@@ -196,7 +194,7 @@ function cross(method, url, headers) {
|
|
|
196
194
|
} else {
|
|
197
195
|
location = originDomain.replace(/[^\/+]$/, location);
|
|
198
196
|
}
|
|
199
|
-
location = getRequestProtocol(url) + "
|
|
197
|
+
location = getRequestProtocol(url) + "//" + location;
|
|
200
198
|
}
|
|
201
199
|
var crs = cross("get", location, headers);
|
|
202
200
|
crs.isRedirected = (xhr.isRedirected || 0) + 1;
|
package/coms/zimoli/slider.js
CHANGED
|
@@ -93,7 +93,7 @@ function slider(autoplay, circle = true) {
|
|
|
93
93
|
var childNodes = outter.childNodes;
|
|
94
94
|
for (var dx = childNodes.length - 1; dx >= 0; dx--) {
|
|
95
95
|
var childNode = childNodes[dx];
|
|
96
|
-
if (childNode !== _imageMain && childNode !== _imageHelp) {
|
|
96
|
+
if (isFinite(childNode.index) && childNode !== _imageMain && childNode !== _imageHelp) {
|
|
97
97
|
remove(childNode);
|
|
98
98
|
}
|
|
99
99
|
}
|
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -388,7 +388,12 @@ function create(pagepath, args, from, needroles) {
|
|
|
388
388
|
return _page;
|
|
389
389
|
|
|
390
390
|
}
|
|
391
|
+
|
|
392
|
+
var zimoliid = 0;
|
|
391
393
|
function zimoli(pagepath, args, history_name, oldpagepath) {
|
|
394
|
+
if (isNode(history_name))
|
|
395
|
+
var zid = history_name.zimoliid = (history_name.zimoliid | 0) + 1;
|
|
396
|
+
else var zid = ++zimoliid;
|
|
392
397
|
if (arguments.length === 0) {
|
|
393
398
|
history_name = current_history;
|
|
394
399
|
var _history = history[history_name] || [];
|
|
@@ -405,6 +410,9 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
|
|
|
405
410
|
}
|
|
406
411
|
if (page_generators[pagepath]) return go(pagepath, args, history_name, oldpagepath);
|
|
407
412
|
return prepare(pagepath, function () {
|
|
413
|
+
if (isNode(history_name)) {
|
|
414
|
+
if (history_name.zimoliid !== zid) return;
|
|
415
|
+
} else if (zid !== zimoliid) return;
|
|
408
416
|
return go(pagepath, args, history_name, oldpagepath);
|
|
409
417
|
});
|
|
410
418
|
}
|