efront 3.0.3 → 3.0.9
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/basic/parseURL.js +2 -2
- package/coms/basic/parseURL_test.js +32 -0
- package/coms/compile/scanner2.js +13 -3
- package/coms/zimoli/anchor2.js +0 -1
- package/coms/zimoli/data.js +1 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic/parseURL.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
//
|
|
2
|
-
var reg = /^([
|
|
1
|
+
// -------/// ---------------1-------------//////////////2---3--------//////// ----4----2/////5-----------------------6------------------------//////////////-7--5///8----9----//10--11---10///--12-----8//
|
|
2
|
+
var reg = /^([^\:\/\?#]+\:(?![^\:\/\?\#]*@))?(?:\/\/)?(?:(([^\:\/\?#]+)?(?:\:([^\/\?#]+))?)@)?(([^\/@\:\?\#]*(?:[^\d\@\:\/\?#]|\.)[^\/@\:\?\#]*)?(?:(?:\:|^)(\d+))?)((\/[^\?#]*)?(\?([^#]*))?(#[\s\S]*)?)$/;
|
|
3
3
|
function parseURL(url) {
|
|
4
4
|
if (url === undefined || url === null) url = '';
|
|
5
5
|
var [__, protocol, auth, username, password, host, hostname, port, path, pathname, search, query, hash] = reg.exec(url);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
var parseURL = require("./parseURL");
|
|
2
|
+
require("../efront/console");
|
|
3
|
+
var test = function (url, key, value) {
|
|
4
|
+
var parsed = parseURL(url);
|
|
5
|
+
if (parsed[key] !== value) console.log(parsed), console.fail(`url:${url}, key:${key}, expect:${value}, result:${parsed[key]}`);
|
|
6
|
+
else console.pass(`url:${url}, key:${key}, expect:${value}, result:${parsed[key]}`);
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
test('http://efront.cc/kugou', 'pathname', '/kugou')
|
|
10
|
+
test('http://efront.cc/kugou?a', 'path', '/kugou?a')
|
|
11
|
+
test('http://yunxu1019@live.cn@github.com/?a', 'username', 'yunxu1019@live.cn')
|
|
12
|
+
test('localhost', 'host', 'localhost')
|
|
13
|
+
test('localhost:80', 'port', '80')
|
|
14
|
+
test('localhost:80/', 'port', '80')
|
|
15
|
+
test(':80', 'port', '80')
|
|
16
|
+
test('80', 'port', '80')
|
|
17
|
+
test('/80', 'pathname', '/80')
|
|
18
|
+
test('a80', 'host', 'a80')
|
|
19
|
+
test('a:80', 'host', 'a:80')
|
|
20
|
+
test('a:b:80', 'host', 'b:80')
|
|
21
|
+
test('a:b@a80', 'auth', 'a:b')
|
|
22
|
+
test('c:a:b@a80', 'auth', 'a:b')
|
|
23
|
+
test('c:d:a:b@a80', 'password', 'a:b')
|
|
24
|
+
test('localhost:', 'protocol', 'localhost:')
|
|
25
|
+
test('localhost:80', 'hostname', 'localhost')
|
|
26
|
+
test('http//:80', 'hostname', 'http')
|
|
27
|
+
test('http//:80', 'pathname', '//:80')
|
|
28
|
+
test('//h:80', 'host', 'h:80')
|
|
29
|
+
test('?80', 'path', '?80')
|
|
30
|
+
test('?80', 'search', '?80')
|
|
31
|
+
test('?80', 'query', '80')
|
|
32
|
+
test('#?80', 'hash', '#?80')
|
package/coms/compile/scanner2.js
CHANGED
|
@@ -711,10 +711,18 @@ class Javascript {
|
|
|
711
711
|
queue.__proto__ = Program.prototype;
|
|
712
712
|
var origin = queue;
|
|
713
713
|
var queue_push = function (scope) {
|
|
714
|
-
|
|
714
|
+
var last = queue.lastUncomment;
|
|
715
|
+
if (~[VALUE, QUOTED].indexOf(scope.type)) {
|
|
715
716
|
scope.isprop = isProperty();
|
|
716
717
|
}
|
|
717
|
-
|
|
718
|
+
else if (scope.type === SCOPED && scope.entry === '[') {
|
|
719
|
+
if (queue.isObject) {
|
|
720
|
+
scope.isprop = !last || last.type === STAMP && /^(\+\+|\-\-|;)$/.test(last.text)
|
|
721
|
+
}
|
|
722
|
+
else if (queue.isClass) {
|
|
723
|
+
scope.isprop = !last || last.type === STAMP && last.text === ','
|
|
724
|
+
}
|
|
725
|
+
}
|
|
718
726
|
if (scope.type !== COMMENT && scope.type !== SPACE) {
|
|
719
727
|
if (last) {
|
|
720
728
|
scope.prev = last;
|
|
@@ -889,7 +897,9 @@ class Javascript {
|
|
|
889
897
|
return !prev || prev.type === STAMP && prev.text === "," || prev.type === PROPERTY && /^(get|set|async)$/.test(prev.text);
|
|
890
898
|
}
|
|
891
899
|
if (queue.isClass) {
|
|
892
|
-
|
|
900
|
+
if (!prev) return true;
|
|
901
|
+
if (prev.type === STAMP) return /^(\+\+|\-\-|;)$/.test(prev.text);
|
|
902
|
+
return prev.type === EXPRESS && !/\.$/.test(prev.text) || ~[SCOPED, VALUE, QUOTED, PROPERTY].indexOf(prev.type);
|
|
893
903
|
}
|
|
894
904
|
return false;
|
|
895
905
|
};
|
package/coms/zimoli/anchor2.js
CHANGED
package/coms/zimoli/data.js
CHANGED
|
@@ -114,7 +114,7 @@ function transpile(src, trans, apiMap, delTransMap) {
|
|
|
114
114
|
}
|
|
115
115
|
return res;
|
|
116
116
|
}
|
|
117
|
-
data = extend({}, src && src.querySelector ? null : src);
|
|
117
|
+
var data = extend({}, src && src.querySelector ? null : src);
|
|
118
118
|
for (var k in trans) {
|
|
119
119
|
var v = trans[k];
|
|
120
120
|
if (!(k in data)) {
|