efront 3.22.10 → 3.24.3

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.
Files changed (39) hide show
  1. package/coms/basic/BigNumber.js +28 -5
  2. package/coms/basic/BigNumber_test.js +14 -1
  3. package/coms/basic/[]map.js +18 -13
  4. package/coms/basic/assert.js +10 -2
  5. package/coms/basic/extends_.js +13 -0
  6. package/coms/basic/loader.js +47 -28
  7. package/coms/basic/mark.js +155 -0
  8. package/coms/basic/queue.js +11 -14
  9. package/coms/basic/rest_.js +27 -0
  10. package/coms/kugou/parseSongsList.js +1 -1
  11. package/coms/kugou/player.js +3 -2
  12. package/coms/zimoli/Promise.js +84 -133
  13. package/coms/zimoli/appendChild.js +4 -14
  14. package/coms/zimoli/cless.js +11 -5
  15. package/coms/zimoli/color.js +0 -1
  16. package/coms/zimoli/compile.js +64 -1
  17. package/coms/{compile → zimoli}/compile_test.js +0 -0
  18. package/coms/zimoli/cross.js +1 -1
  19. package/coms/zimoli/data.js +6 -2
  20. package/coms/zimoli/dispatch.js +1 -1
  21. package/coms/zimoli/on.js +64 -47
  22. package/coms/zimoli/remove.js +0 -9
  23. package/coms/zimoli/render.js +2 -2
  24. package/coms/zimoli/zimoli.js +2 -2
  25. package/package.json +1 -1
  26. package/public/efront.js +1 -1
  27. package/coms/compile/breakcode.js +0 -78
  28. package/coms/compile/common.js +0 -683
  29. package/coms/compile/compile.js +0 -64
  30. package/coms/compile/keywords.js +0 -6
  31. package/coms/compile/namelist.js +0 -142
  32. package/coms/compile/namelist_test.js +0 -7
  33. package/coms/compile/required.js +0 -20
  34. package/coms/compile/scanner.js +0 -653
  35. package/coms/compile/scanner2.js +0 -909
  36. package/coms/compile/scanner2_test.js +0 -85
  37. package/coms/compile/scanner_test.js +0 -10
  38. package/coms/compile/washcode.js +0 -313
  39. package/coms/zimoli/mark.js +0 -70
@@ -1,78 +0,0 @@
1
- var scanner = require("./scanner");
2
- var keywords = require("./keywords");
3
- var strings = require("../basic/strings");
4
- var hasOwnProperty = {}.hasOwnProperty;
5
- var getReadableKey = function ($key, value) {
6
- value = value.replace(/-->/g, '--\\>');
7
- if (!/^[a-z][\w\$]*$/i.test($key)) {
8
- $key = $key.replace(/[^\w\$]+/g, '_');
9
- if ($key.length > 20) $key = $key.slice(0, 4) + $key.slice(-20);
10
- }
11
- $key = $key.replace(/(\d\.?)px/ig, "$1_px");
12
- var id = 0;
13
- while (($key in paramsMap) && paramsMap[$key] !== value || $key in keywords) {
14
- $key = $key.replace(/\d+$/, '') + ++id;
15
- }
16
- if (!hasOwnProperty.call(paramsMap, $key)) {
17
- paramsMap[$key] = value;
18
- }
19
- return $key;
20
- };
21
- var setMatchedConstString = function (k) {
22
-
23
- if (/^(['"])user?\s+strict\1$/i.test(k)) return `"use strict"`;
24
- if (k.length < 3) return k;
25
- k = strings.decode(k);
26
- k = strings.encode(k);
27
- var $key = "str_" + k.replace(/^(['"])([\s\S]*)\1$/g, '$2');
28
- var key = getReadableKey($key, k);
29
- return " " + key + " ";
30
- };
31
- var setMatchedConstRegExp = function (k) {
32
- var $key = "reg_" + k.replace(/^\/([\s\S]*)\/(\w*)$/g, '$1_$2');
33
- $key = getReadableKey($key, k);
34
- return " " + $key + " ";
35
- };
36
- var trimStringLiteral = function (block) {
37
- var block_string = module_string.slice(block.start, block.end);
38
- if (block.type === block.single_quote_scanner || block.type === block.double_quote_scanner) {
39
- return setMatchedConstString(block_string);
40
- }
41
- if (block.type === block.regexp_quote_scanner) {
42
- return setMatchedConstRegExp(block_string);
43
- }
44
- if (block.type === block.template_quote_scanner) {
45
- var { start, end } = block;
46
- if (block.children) {
47
- var res = [];
48
- for (var c of block.children) {
49
- res.push(
50
- module_string.slice(start, c.start),
51
- trimStringLiteral(c)
52
- );
53
- start = c.end;
54
- }
55
- res.push(module_string.slice(start, end));
56
- return res.join('');
57
- }
58
- }
59
- return block_string;
60
- };
61
- var paramsMap = Object.create(null);
62
- var module_string = '';
63
- function breakcode(data, args) {
64
- if (!args) return [data];
65
- module_string = data;
66
- Object.keys(args).forEach(function (key) {
67
- paramsMap[key] = true;
68
- });
69
- var code_blocks = scanner(module_string);
70
- module_string = code_blocks.map(trimStringLiteral).join("");
71
- var res = Object.keys(paramsMap).filter(k => !hasOwnProperty.call(args, k));
72
- var val = res.map(k => paramsMap[k]);
73
- paramsMap = Object.create(null);
74
- data = module_string;
75
- module_string = '';
76
- return [data, res, val];
77
- }
78
- module.exports = breakcode;