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.
@@ -1,5 +1,5 @@
1
- // -----///////// -1 ----------////////////2---3-----/////// --4------2//////5------6-----////////-7--5///8--9----//10--11---10///--12-----8//
2
- var reg = /^([^\/\:@\?#]+\:)?(?:\/\/)?(?:(([^\/@\:]+)?(?:\:([^\/@\:]+))?)@)?(([^\/\:\?\#]+)?(?:\:(\d+))?)(([^\?#]+)?(\?([^#]*))?(#[\s\S]*)?)$/;
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')
@@ -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
- if (~[VALUE, QUOTED, SCOPED, EXPRESS, PROPERTY].indexOf(scope.type)) {
714
+ var last = queue.lastUncomment;
715
+ if (~[VALUE, QUOTED].indexOf(scope.type)) {
715
716
  scope.isprop = isProperty();
716
717
  }
717
- var last = queue.lastUncomment;
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
- return !prev || prev.type === EXPRESS && !/\.$/.test(prev.text) || ~[SCOPED, VALUE, QUOTED, PROPERTY].indexOf(prev.type) || prev.type === STAMP && /^(\+\+|\-\-|;)$/.test(prev.text);
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
  };
@@ -1,7 +1,6 @@
1
1
  function anchor2(label, href) {
2
2
  var a = document.createElement("a");
3
3
  a.href = href || "";
4
- a.href = "";
5
4
  if (isString(label)) {
6
5
  a.innerHTML = label;
7
6
  } else {
@@ -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)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.0.3",
3
+ "version": "3.0.9",
4
4
  "description": "一个开发工具,开放源代码,自带组件库和编译环境,可以用来开发web组件,web应用或nodejs模块,或做为已有代码的加密工具,也可以做为静态页面服务器或跨域中转服务器使用",
5
5
  "main": "public/efront.js",
6
6
  "directories": {