efront 4.35.0 → 4.35.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/package.json +24 -24
- package/public/efront.js +2 -1
- package/public//346/226/207/344/273/266/347/263/273/347/273/237//344/270/273/351/241/265.jsp +2 -2
- package/tools/build-efront +0 -22
- package/tools/build-efront.bat +0 -22
- package/tools/build-efront.js +0 -64
- package/tools/build-setup.bat +0 -9
- package/tools/buildEmoji.js +0 -17
- package/tools/electron.js +0 -37
- package/tools/empty.js +0 -11
- package/tools/fixBuffer.js +0 -41
- package/tools/install-all.js +0 -46
- package/tools/makeUseStrict.js +0 -35
- package/tools/readHelpersFromTypescript.js +0 -82
- package/tools/reload.js +0 -20
- package/tools/run-efront.bat +0 -14
- package/tools/toCRLF.js +0 -30
- package/tools/unwrap-typescript.js +0 -28
- package/tools/update-libs.bat +0 -86
- package/tools/write-utf8.js +0 -39
package/tools/build-efront
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
if [ -L $0 ]
|
|
3
|
-
then
|
|
4
|
-
__dirname=`dirname $(readlink $0)`
|
|
5
|
-
else
|
|
6
|
-
__dirname=`dirname $0`
|
|
7
|
-
fi
|
|
8
|
-
cd $__dirname/..
|
|
9
|
-
clear
|
|
10
|
-
pwd
|
|
11
|
-
export coms_path=./coms
|
|
12
|
-
export page_path=./coms
|
|
13
|
-
export public_path=./public
|
|
14
|
-
export page=./
|
|
15
|
-
export app=efront/index.js
|
|
16
|
-
export extt=.js
|
|
17
|
-
export coms=,reptile
|
|
18
|
-
# libs_path=./
|
|
19
|
-
# libs=typescript,esprima,escodegen,esmangle,pngjs,less-node
|
|
20
|
-
export destpath=efront.js
|
|
21
|
-
rm -rf "$public_path"
|
|
22
|
-
$__dirname/run-efront.bat publish $*
|
package/tools/build-efront.bat
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
@chcp 936
|
|
2
|
-
@echo off
|
|
3
|
-
cls
|
|
4
|
-
setlocal
|
|
5
|
-
pushd
|
|
6
|
-
cd %~dp0..
|
|
7
|
-
echo %cd%
|
|
8
|
-
set coms_path=./coms
|
|
9
|
-
set page_path=./coms
|
|
10
|
-
set public_path=./public
|
|
11
|
-
set page=./
|
|
12
|
-
set app=efront/index.js
|
|
13
|
-
set extt=.js
|
|
14
|
-
set coms=./,reptile
|
|
15
|
-
set symbol_regexp=^^[A-Z][a-z]+\_^|(Statement^|Pattern^|Expression^|Declaration^|Element^|Node^|Literal^|^^Property^$)^$
|
|
16
|
-
set destpath=efront.js
|
|
17
|
-
if exist "%public_path%" rd /s /q "%public_path%"
|
|
18
|
-
call %~dp0\run-efront.bat publish %*
|
|
19
|
-
popd
|
|
20
|
-
endlocal
|
|
21
|
-
goto :end
|
|
22
|
-
:end
|
package/tools/build-efront.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
var path = require("path");
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
function getVersionByTime(rootpath, reverse) {
|
|
4
|
-
return new Promise(function (ok) {
|
|
5
|
-
var savedVersion = 0;
|
|
6
|
-
var resolve = function () {
|
|
7
|
-
ok(savedVersion);
|
|
8
|
-
};
|
|
9
|
-
var roots = [].concat(rootpath);
|
|
10
|
-
var run = function () {
|
|
11
|
-
if (!roots.length) return resolve();
|
|
12
|
-
var filepath = roots.shift();
|
|
13
|
-
fs.stat(filepath, function (error, stat) {
|
|
14
|
-
if (error) return run();
|
|
15
|
-
if (stat.isFile()) {
|
|
16
|
-
var { mtime } = stat;
|
|
17
|
-
if (!savedVersion) {
|
|
18
|
-
savedVersion = mtime;
|
|
19
|
-
}
|
|
20
|
-
if (mtime < savedVersion && reverse > 0) {
|
|
21
|
-
savedVersion = mtime;
|
|
22
|
-
} else if (mtime > savedVersion) {
|
|
23
|
-
savedVersion = mtime;
|
|
24
|
-
}
|
|
25
|
-
run();
|
|
26
|
-
} else {
|
|
27
|
-
fs.readdir(filepath, function (error, names) {
|
|
28
|
-
if (error) return run();
|
|
29
|
-
if (names) roots.push.apply(roots, names.map(name => path.join(filepath, name)));
|
|
30
|
-
run();
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
};
|
|
35
|
-
run();
|
|
36
|
-
})
|
|
37
|
-
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
Promise.all([
|
|
41
|
-
fs.readdirSync(
|
|
42
|
-
path.join(__dirname, '..')
|
|
43
|
-
).filter(a => !/^[\._]|^public$|^build\-efront\.js$/i.test(a))
|
|
44
|
-
.map(a => path.join(__dirname, '..', a))
|
|
45
|
-
.filter(a => fs.statSync(a).isDirectory()),
|
|
46
|
-
path.join(__dirname, '../public')
|
|
47
|
-
].map(getVersionByTime)).then(function ([srcVersion, dstVersion]) {
|
|
48
|
-
if (srcVersion > dstVersion) {
|
|
49
|
-
var fullpath = path.join(__dirname, 'build-efront');
|
|
50
|
-
fs.chmodSync(fullpath, 7);
|
|
51
|
-
var packagepath = path.join(__dirname, "../package.json");
|
|
52
|
-
var data = fs.readFileSync(packagepath).toString();
|
|
53
|
-
data = JSON.parse(data);
|
|
54
|
-
data.main = "public/efront.js";
|
|
55
|
-
data.bin.efront = "public/efront.js";
|
|
56
|
-
fs.writeFileSync(packagepath, JSON.stringify(data, null, 4));
|
|
57
|
-
require("child_process").spawn(fullpath, process.argv.slice(2), {
|
|
58
|
-
stdio: "inherit",
|
|
59
|
-
shell: true
|
|
60
|
-
});
|
|
61
|
-
} else {
|
|
62
|
-
console.log("无需重新编译");
|
|
63
|
-
}
|
|
64
|
-
}).catch(console.log);
|
package/tools/build-setup.bat
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
setlocal
|
|
3
|
-
cd %~dp0..\test\arch\
|
|
4
|
-
call _build.bat "Efront Setup.asm"
|
|
5
|
-
@REM dumpbin /dependents "Efront Setup.exe"
|
|
6
|
-
copy "Efront Setup.exe" ..\..\data\packexe-setup.sfx
|
|
7
|
-
call efront packexe ..\..\public #����abc-64.scr H:\���ذ�ǰ����������\��֦ȸ-
|
|
8
|
-
call efront packexe ..\..\public #����abc-32.scr H:\���ذ�ǰ����������\��֦ȸ-
|
|
9
|
-
endlocal
|
package/tools/buildEmoji.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
var path = require("path");
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
var emojipath = path.join(__dirname, "../data/qq_emoji/");
|
|
4
|
-
var names = fs.readdirSync(emojipath);
|
|
5
|
-
var files = names.map(f => path.join(emojipath, f));
|
|
6
|
-
var datas = {};
|
|
7
|
-
files.map(f => fs.readFileSync(f).toString("base64")).forEach((s, i) => {
|
|
8
|
-
var name = names[i];
|
|
9
|
-
var id = /^(\d+)(.*?)$/.exec(name);
|
|
10
|
-
name = id[1].padStart(3, '0') + id[2];
|
|
11
|
-
datas[name] = s;
|
|
12
|
-
});
|
|
13
|
-
var res = {};
|
|
14
|
-
Object.keys(datas).forEach(k => {
|
|
15
|
-
res[k] = datas[k];
|
|
16
|
-
});
|
|
17
|
-
fs.writeFileSync(path.join(__dirname, "../apps/feedback/emoji.json"), JSON.stringify(datas, null, 4));
|
package/tools/electron.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
|
|
3
|
-
// 用编辑器的开发者工具加载些文件
|
|
4
|
-
// 可以使用如下方式加载
|
|
5
|
-
eval(fs.readFileSync("d:\\work\\efront\\tools\\electron.js").toString())
|
|
6
|
-
("http://localhost/","d:\\work\\efront\\tools\\reload.js");
|
|
7
|
-
|
|
8
|
-
*/
|
|
9
|
-
function run(url, preload) {
|
|
10
|
-
var electron = require("electron");
|
|
11
|
-
var { BrowserWindow } = electron.BrowserWindow ? electron : electron.remote;
|
|
12
|
-
var window = new BrowserWindow({
|
|
13
|
-
width: 800, height: screen.height, show: false,
|
|
14
|
-
webPreferences: {
|
|
15
|
-
// 支持node
|
|
16
|
-
nodeIntegration: true,
|
|
17
|
-
//缩放级别
|
|
18
|
-
zoomFactor: 1.0,
|
|
19
|
-
//使用原生的window.open
|
|
20
|
-
nativeWindowOpen: true,
|
|
21
|
-
//允许跨域资源
|
|
22
|
-
webwebSecurity: true,
|
|
23
|
-
preload
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
window.showInactive();
|
|
27
|
-
window.on('closed', () => {
|
|
28
|
-
window = null
|
|
29
|
-
});
|
|
30
|
-
window.setMenu(null);
|
|
31
|
-
// 加载远程URL
|
|
32
|
-
window.webContents.openDevTools();
|
|
33
|
-
window.setAlwaysOnTop(true);
|
|
34
|
-
window.loadURL(url);
|
|
35
|
-
window.setPosition(innerWidth, 0);
|
|
36
|
-
}
|
|
37
|
-
module.exports = run;
|
package/tools/empty.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
global.promise = new Promise(function (ok, oh) {
|
|
2
|
-
require("fs").readFile(__filename, function (error, buffer) {
|
|
3
|
-
if (error) return oh(error);
|
|
4
|
-
else ok(buffer);
|
|
5
|
-
});
|
|
6
|
-
}).then(function (result) {
|
|
7
|
-
console.log(result);
|
|
8
|
-
require("../../coms/efront/commbuilder")(result, "", __filename, []);
|
|
9
|
-
}).catch(function (result) {
|
|
10
|
-
console.log(result);
|
|
11
|
-
});
|
package/tools/fixBuffer.js
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
var fs = require("fs");
|
|
2
|
-
var path = require("path");
|
|
3
|
-
/**
|
|
4
|
-
* 把dir中的文件的换行符号替换成\r\n chr(13)+chr(10)
|
|
5
|
-
* @param {string} dir 指向一个文件或文件夹
|
|
6
|
-
*/
|
|
7
|
-
var replace = function (dir, deep) {
|
|
8
|
-
if (!fs.existsSync(dir)) {
|
|
9
|
-
return console.warn(i18n`指定的路径${dir}不存在!`);
|
|
10
|
-
}
|
|
11
|
-
if (dir.match(/node_modules/)) {
|
|
12
|
-
if (typeof deep !== "number") {
|
|
13
|
-
return console.error(i18n`不要在这个层级未知的地方下手!`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (deep < 0) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (fs.statSync(dir).isDirectory()) {
|
|
20
|
-
fs.readdirSync(dir).forEach(function (name) {
|
|
21
|
-
replace(path.join(dir, name), deep - 1);
|
|
22
|
-
});
|
|
23
|
-
} else if (dir.match(/\.[tj]sx?$/i)) {
|
|
24
|
-
var buffer = fs.readFileSync(dir);
|
|
25
|
-
var replaceCount = 0;
|
|
26
|
-
var data = String(buffer).replace(/\b(?:new\s+)?Buffer\s*\(\s*([^\(]*?)\s*\)/g, function (match, size) {
|
|
27
|
-
replaceCount++;
|
|
28
|
-
var result = match;
|
|
29
|
-
if (size.split(",").length === 2 || /(SIGNATURE|data|name|value)$/.test(size)) result = `Buffer.from(${size})`;
|
|
30
|
-
else if (/(length|size|num|width|height|\d+)$/i.test(size)) result = `Buffer.alloc(${size})`;
|
|
31
|
-
else replaceCount--;
|
|
32
|
-
match !== result && console.log(dir, match, result);
|
|
33
|
-
return result;
|
|
34
|
-
});
|
|
35
|
-
data.replace(/\bnew\s+Buffer\b.*?\)/g, function (match) {
|
|
36
|
-
console.log(dir, match);
|
|
37
|
-
});
|
|
38
|
-
replaceCount > 0 && fs.writeFileSync(dir, data);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
replace("./", 5);
|
package/tools/install-all.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
var console = require("../coms/reptile/colored_console");
|
|
2
|
-
var child_process = require("child_process");
|
|
3
|
-
var queue = require("../coms/basic/queue");
|
|
4
|
-
var versions = child_process.execSync("npm view . versions");
|
|
5
|
-
var localIP = require("../coms/efront/getLocalIP")();
|
|
6
|
-
var parsed = JSON.parse(String(versions).replace(/\'/g, '"')).reverse();
|
|
7
|
-
var scripts = `
|
|
8
|
-
npm install -g efront
|
|
9
|
-
efront version
|
|
10
|
-
efront help
|
|
11
|
-
efront help version
|
|
12
|
-
efront -v
|
|
13
|
-
efront --version
|
|
14
|
-
`.trim().split(/[\r\n]+/);
|
|
15
|
-
var run = function (script, timelimit) {
|
|
16
|
-
if (!timelimit) timelimit = 200000;
|
|
17
|
-
if (timelimit < 2000) timelimit = 2000;
|
|
18
|
-
var timeStart = +new Date;
|
|
19
|
-
var gram = child_process.exec(script, {
|
|
20
|
-
timeout: timelimit,
|
|
21
|
-
});
|
|
22
|
-
gram.stderr.pipe(process.stderr);
|
|
23
|
-
gram.stdout.pipe(process.stdout);
|
|
24
|
-
var timer = 0;
|
|
25
|
-
return Promise.race([
|
|
26
|
-
ok => gram.once("exit", ok),
|
|
27
|
-
ok => timer = setTimeout(ok, timelimit)
|
|
28
|
-
].map(
|
|
29
|
-
a => new Promise(a)
|
|
30
|
-
)).then(function () {
|
|
31
|
-
gram.kill();
|
|
32
|
-
clearTimeout(timer);
|
|
33
|
-
console.info(`执行: <gray>${script}</gray>,用时: <gray>${((new Date - timeStart) / 1000).toFixed(2)}</gray>秒\r\n`);
|
|
34
|
-
});
|
|
35
|
-
};
|
|
36
|
-
queue.call(parsed, function (version, index) {
|
|
37
|
-
var commands = scripts.slice(0);
|
|
38
|
-
commands[0] += "@" + version;
|
|
39
|
-
if (Math.sqrt(Math.random() * (index + 120) / 240) > .2) return;
|
|
40
|
-
console.clear(version);
|
|
41
|
-
return queue.call(commands, run).then(function () {
|
|
42
|
-
if (!localIP) return;
|
|
43
|
-
if (index < 7) return run('efront live 80 443', 20000);
|
|
44
|
-
return new Promise(a => setTimeout(a, 1600));
|
|
45
|
-
});
|
|
46
|
-
});
|
package/tools/makeUseStrict.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var fs = require("fs");
|
|
3
|
-
var path = require("path");
|
|
4
|
-
/**
|
|
5
|
-
* 把dir中的文件的换行符号替换成\r\n chr(13)+chr(10)
|
|
6
|
-
* @param {string} dir 指向一个文件或文件夹
|
|
7
|
-
*/
|
|
8
|
-
var replace = function (dir, deep) {
|
|
9
|
-
if (!fs.existsSync(dir)) {
|
|
10
|
-
return console.warn(i18n`指定的路径${dir}不存在!`);
|
|
11
|
-
}
|
|
12
|
-
if (dir.match(/node_modules/)) {
|
|
13
|
-
if (typeof deep !== "number") {
|
|
14
|
-
return console.error(i18n`不要在这个层级未知的地方下手!`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
if (deep < 0) {
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
if (fs.statSync(dir).isDirectory()) {
|
|
21
|
-
--deep;
|
|
22
|
-
fs.readdirSync(dir).forEach(function (name) {
|
|
23
|
-
replace(path.join(dir, name), deep);
|
|
24
|
-
});
|
|
25
|
-
} else if (dir.match(/\.(?:jsx?)$/)) {
|
|
26
|
-
var buffer = fs.readFileSync(dir);
|
|
27
|
-
var code = String(buffer);
|
|
28
|
-
if (/(["'`])user? strict\1/i.test(code)) {
|
|
29
|
-
|
|
30
|
-
var data = code.replace(/^(?:\s*(["'`])user? strict\1\s*;?\s*[\r\n]*)+/i, "\"use strict\";\r\n");
|
|
31
|
-
if (code !== data) fs.writeFileSync(dir, data), console.log(dir);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
replace(path.join(__dirname, "../coms"), 5);
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
require("../coms/efront/setupenv");
|
|
2
|
-
var path = require("path");
|
|
3
|
-
var fs = require("fs");
|
|
4
|
-
var console = global.console = require("../coms/reptile/colored_console.js");
|
|
5
|
-
var saveTo = require("../coms/basic/saveToOrderedArray");
|
|
6
|
-
global.isObject = require("../coms/basic/isObject");
|
|
7
|
-
var findIn = global.getIndexFromOrderedArray = require("../coms/basic/getIndexFromOrderedArray");
|
|
8
|
-
var strings = require("../coms/basic/strings");
|
|
9
|
-
var typescript_path = path.join(__dirname, '../coms/typescript');
|
|
10
|
-
var typescript_file = require.resolve(typescript_path);
|
|
11
|
-
var text = fs.readFileSync(typescript_file).toString();
|
|
12
|
-
var codes = text.split(/[\r\n]+var\s+ts/);
|
|
13
|
-
var parsed = [], marked = ["transpile"];
|
|
14
|
-
var typescript = require(typescript_file);
|
|
15
|
-
// codes.slice(1).forEach(function (text, id) {
|
|
16
|
-
// var args = require("../coms/efront/commbuilder").break(text, "typescript.js", "typescript - " + id + ".js", false);
|
|
17
|
-
// var created = [];
|
|
18
|
-
// text.replace(/(?:^\s*|\()ts\.([\w\$]+)\s*=/mg, function (_, c) {
|
|
19
|
-
// created.push(c);
|
|
20
|
-
// });
|
|
21
|
-
// parsed[id] = { text, created, marked: created.includes("Diagnostics") || created.includes("DiagnosticCategory"), id, strs: args[2] && args[2].map(strings.decode).filter(a => typescript.hasOwnProperty(a)) };
|
|
22
|
-
// });
|
|
23
|
-
// bigloop: while (true) {
|
|
24
|
-
// let saved_length = marked.length;
|
|
25
|
-
// for (let cx = 0, dx = parsed.length; cx < dx; cx++) {
|
|
26
|
-
// let { created, strs, marked: mark } = parsed[cx];
|
|
27
|
-
// if (mark || !strs) continue;
|
|
28
|
-
// for (let s of created) {
|
|
29
|
-
// if (/createScanner/.test(s)) console.log(cx);
|
|
30
|
-
// if (marked[findIn(marked, s)] === s) {
|
|
31
|
-
// for (let s of strs) saveTo(marked, s);
|
|
32
|
-
// parsed[cx].marked = true;
|
|
33
|
-
// break;
|
|
34
|
-
// }
|
|
35
|
-
// }
|
|
36
|
-
// }
|
|
37
|
-
// if (marked.length === saved_length) break;
|
|
38
|
-
// }
|
|
39
|
-
// parsed = parsed.filter(a => a.marked);
|
|
40
|
-
// var codeText = [codes[0]].concat(parsed.map(a => a.text)).join("\r\nvar ts");
|
|
41
|
-
var date = new Date();
|
|
42
|
-
// var sign = `\r\n/**\r\n * 这一部分由工具重写\r\n * \r\n * Efront Authors\r\n * ${date.toISOString()}\r\n */\r\nmodule.exports = ts;`;
|
|
43
|
-
// var codeText = codeText.replace(/\(\s*\(?function\b[^\{]*\{\s*[^\}]*?\bglobalThis\b[\s\S]*$/, "");
|
|
44
|
-
// if (text.length > codeText.length) {
|
|
45
|
-
// text = codeText + sign;
|
|
46
|
-
// global.console.log(codeText.length, text.length);
|
|
47
|
-
// fs.writeFileSync(typescript_file, text);
|
|
48
|
-
// }
|
|
49
|
-
var destpath = path.join(__dirname, '../coms/typescript-helpers');
|
|
50
|
-
var helpers = typescript.getAllUnscopedEmitHelpers();
|
|
51
|
-
var helpersMap = {};
|
|
52
|
-
helpers.forEach(o => {
|
|
53
|
-
var { importName, text } = o;
|
|
54
|
-
if (importName) {
|
|
55
|
-
console.test(importName, o.name);
|
|
56
|
-
try {
|
|
57
|
-
text = text.replace(/^[\r\n]+/, '');
|
|
58
|
-
var space = /^\s+/.exec(text);
|
|
59
|
-
if (space) {
|
|
60
|
-
space = space[0];
|
|
61
|
-
text = text.replace(new RegExp(`^\\s{${space.length}}`, 'mg'), '');
|
|
62
|
-
}
|
|
63
|
-
var distname = path.join(destpath, importName + ".js");
|
|
64
|
-
helpersMap[importName] = true;
|
|
65
|
-
var needWrite = true;
|
|
66
|
-
if (fs.existsSync(distname)) {
|
|
67
|
-
var temp = fs.readFileSync(distname).toString().replace(/^\s*\/\*[\s\S]*?\*\/\s*/, '');
|
|
68
|
-
if (temp.replace(/[\r\n]+/g, "\r\n").trim() === text.replace(/[\r\n]+/g, "\r\n").trim()) needWrite = false;
|
|
69
|
-
}
|
|
70
|
-
if (needWrite) {
|
|
71
|
-
text = `/**\r\n * ${o.name}\r\n * 这个文件由工具生成,请不要手动修改\r\n * \r\n * Efront Authors\r\n * ${date.toISOString()}\r\n */\r\n` + text;
|
|
72
|
-
fs.writeFileSync(distname, text);
|
|
73
|
-
}
|
|
74
|
-
console.pass(importName, o.name);
|
|
75
|
-
} catch (e) {
|
|
76
|
-
console.fail(importName, e);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
fs.readdirSync(destpath).forEach(n => {
|
|
81
|
-
if (!helpersMap[n.replace(/\.js$/, '')]) fs.unlinkSync(path.join(destpath, n));
|
|
82
|
-
});
|
package/tools/reload.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
function reload() {
|
|
2
|
-
clearTimeout(reload_timmer);
|
|
3
|
-
reload_timmer = setTimeout(function () {
|
|
4
|
-
require("electron").remote.getCurrentWebContents().reload();
|
|
5
|
-
}, 20);
|
|
6
|
-
}
|
|
7
|
-
var reload_timmer;
|
|
8
|
-
function reloader() {
|
|
9
|
-
var xhr = new XMLHttpRequest;
|
|
10
|
-
var http_port = require("../coms/efront/memery").HTTP_PORT;
|
|
11
|
-
xhr.open("post", `http://localhost${http_port ? ":" + http_port : ""}/reload`);
|
|
12
|
-
xhr.timeout = 0;
|
|
13
|
-
xhr.onerror = reload;
|
|
14
|
-
|
|
15
|
-
xhr.onreadystatechange = function () {
|
|
16
|
-
if (xhr.readyState === 4) reload();
|
|
17
|
-
};
|
|
18
|
-
xhr.send("haha");
|
|
19
|
-
};
|
|
20
|
-
new reloader;
|
package/tools/run-efront.bat
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
:<<a
|
|
2
|
-
goto :win
|
|
3
|
-
a
|
|
4
|
-
if test -L $0; then
|
|
5
|
-
dp=`cd $(dirname $0);cd $(dirname $(readlink $0)); pwd -P`
|
|
6
|
-
else
|
|
7
|
-
dp=`cd $(dirname $0); pwd -P`
|
|
8
|
-
fi
|
|
9
|
-
node $dp/../coms/efront ./efront/index.js $*
|
|
10
|
-
exit
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
:win
|
|
14
|
-
node %~dp0../coms/efront ./efront/index.js %*
|
package/tools/toCRLF.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
var fs = require("fs");
|
|
2
|
-
var path = require("path");
|
|
3
|
-
/**
|
|
4
|
-
* 把dir中的文件的换行符号替换成\r\n chr(13)+chr(10)
|
|
5
|
-
* @param {string} dir 指向一个文件或文件夹
|
|
6
|
-
*/
|
|
7
|
-
var replace = function (dir, deep) {
|
|
8
|
-
if (!fs.existsSync(dir)) {
|
|
9
|
-
return console.warn(i18n`指定的路径${dir}不存在!`);
|
|
10
|
-
}
|
|
11
|
-
if (dir.match(/node_modules/)) {
|
|
12
|
-
if (typeof deep !== "number") {
|
|
13
|
-
return console.error(i18n`不要在这个层级未知的地方下手!`);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
if (deep < 0) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
if (fs.statSync(dir).isDirectory()) {
|
|
20
|
-
fs.readdirSync(dir).forEach(function (name) {
|
|
21
|
-
replace(path.join(dir, name), deep - 1);
|
|
22
|
-
});
|
|
23
|
-
} else if (dir.match(/\.(?:jsx?|css|less|html?|md|json|h|c|cc|cpp|inc)$/)) {
|
|
24
|
-
var buffer = fs.readFileSync(dir);
|
|
25
|
-
var data = String(buffer).replace(/\r\n|\r|\n|\u2028|\u2029/g, "\r\n");
|
|
26
|
-
fs.writeFileSync(dir, data);
|
|
27
|
-
console.log(dir);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
replace("./", 5);
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
var data = fs.readFileSync(path.join(__dirname, "../coms/typescript/index.js")).toString();
|
|
2
|
-
var { STRAP, SCOPED, createString, SPACE, EXPRESS, relink } = compile$common;
|
|
3
|
-
var code = compile$scanner2(data)
|
|
4
|
-
var wraped = code.filter(c => c.type === SCOPED);
|
|
5
|
-
if (wraped.length !== 4) throw "数据异常";
|
|
6
|
-
var unwraped = [...code.slice(0, code.indexOf(wraped[0]) - 3), ...wraped[0][2]];
|
|
7
|
-
for (var cx = unwraped.length - 1; cx >= 0; cx--) {
|
|
8
|
-
var o = unwraped[cx];
|
|
9
|
-
if (o.type === STRAP && o.text === 'return') {
|
|
10
|
-
o.text = "module.exports";
|
|
11
|
-
o.type = EXPRESS;
|
|
12
|
-
unwraped.splice(cx + 1, 0, ...compile$scanner2(" = "));
|
|
13
|
-
break;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
relink(unwraped);
|
|
17
|
-
var replaceSpace = function (c) {
|
|
18
|
-
if (c.type === SPACE) {
|
|
19
|
-
c.text = c.text.replace(/[^\r\n]+/g, function (text) {
|
|
20
|
-
return Array(text.length >> 1).join(" ");
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
else if(c.length){
|
|
24
|
-
c.forEach(replaceSpace);
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
replaceSpace(unwraped);
|
|
28
|
-
fs.writeFileSync(path.join(__dirname, "../coms/typescript/index.js"), createString(unwraped));
|
package/tools/update-libs.bat
DELETED
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
@echo off
|
|
2
|
-
setlocal
|
|
3
|
-
set distpath=coms
|
|
4
|
-
set registry=http://registry.npm.taobao.org
|
|
5
|
-
call :typescript %*
|
|
6
|
-
@REM call :esprima --no-optimize --no-compress %*
|
|
7
|
-
@REM call :esmangle --no-optimize --no-compress %*
|
|
8
|
-
@REM call :escodegen --no-optimize --no-compress %*
|
|
9
|
-
@REM call :lessnode --uplevel --no-crypt --comment %*
|
|
10
|
-
del package-lock.json
|
|
11
|
-
rd /s /q node_modules
|
|
12
|
-
exit /b 0
|
|
13
|
-
|
|
14
|
-
:typescript
|
|
15
|
-
call npm install typescript@latest --registry=%registry%
|
|
16
|
-
copy node_modules\typescript\LICENSE.txt %distpath%\typescript\LICENSE.txt
|
|
17
|
-
copy node_modules\typescript\AUTHORS.md %distpath%\typescript\AUTHORS.md
|
|
18
|
-
copy node_modules\typescript\lib\typescript.js %distpath%\typescript\index.js
|
|
19
|
-
call efront tools\unwrap-typescript.js
|
|
20
|
-
@REM call efront pick %distpath%\typescript\index.js %distpath%\typescript\index.js ts.transpile
|
|
21
|
-
call node tools\readHelpersFromTypescript.js
|
|
22
|
-
call npm uninstall typescript
|
|
23
|
-
|
|
24
|
-
goto :eof
|
|
25
|
-
|
|
26
|
-
:esprima
|
|
27
|
-
call npm install esprima@latest --registry=%registry%
|
|
28
|
-
copy node_modules\esprima\LICENSE.BSD %distpath%\esprima\LICENSE.BSD
|
|
29
|
-
copy node_modules\esprima\dist\esprima.js %distpath%\esprima\index.js
|
|
30
|
-
call node coms\efront publish ./index.js --coms_path=coms/esprima --coms=./ --extt=.js --no-crypt --export_to=module.exports --public_path=coms/esprima --no-polyfill %*
|
|
31
|
-
call npm uninstall esprima
|
|
32
|
-
goto :eof
|
|
33
|
-
|
|
34
|
-
:escodegen
|
|
35
|
-
call npm install escodegen@latest --registry=%registry%
|
|
36
|
-
copy node_modules\escodegen\LICENSE.BSD %distpath%\escodegen\LICENSE.BSD
|
|
37
|
-
set coms_path=node_modules\escodegen\,node_modules
|
|
38
|
-
set coms=./
|
|
39
|
-
set page=./
|
|
40
|
-
set app=./escodegen.js
|
|
41
|
-
set export_to=module.exports
|
|
42
|
-
set public_path=coms\escodegen
|
|
43
|
-
set extt=.js
|
|
44
|
-
call node coms/efront publish --no-polyfill --no-crypt %*
|
|
45
|
-
if exist coms\escodegen\index.js del coms\escodegen\index.js
|
|
46
|
-
move coms\escodegen\escodegen.js coms\escodegen\index.js
|
|
47
|
-
call npm uninstall escodegen
|
|
48
|
-
goto :eof
|
|
49
|
-
|
|
50
|
-
:esmangle
|
|
51
|
-
call npm install esmangle@latest --registry=%registry%
|
|
52
|
-
copy node_modules\esmangle\LICENSE.BSD %distpath%\esmangle\LICENSE.BSD
|
|
53
|
-
set coms_path=node_modules\esmangle\lib,node_modules
|
|
54
|
-
set coms=./
|
|
55
|
-
set page=./
|
|
56
|
-
set app=./esmangle.js
|
|
57
|
-
set export_to=module.exports
|
|
58
|
-
set public_path=coms\esmangle
|
|
59
|
-
set extt=.js
|
|
60
|
-
call node coms/efront publish --no-polyfill --no-crypt %*
|
|
61
|
-
if exist coms\esmangle\index.js del coms\esmangle\index.js
|
|
62
|
-
move coms\esmangle\esmangle.js coms\esmangle\index.js
|
|
63
|
-
call npm uninstall esmangle
|
|
64
|
-
goto :eof
|
|
65
|
-
|
|
66
|
-
:lessnode
|
|
67
|
-
call npm install less@latest --registry=%registry%
|
|
68
|
-
set coms_path=node_modules\less\lib,node_modules
|
|
69
|
-
set coms=./
|
|
70
|
-
set page=./
|
|
71
|
-
set app=./less/index.js
|
|
72
|
-
set export_to=module.exports
|
|
73
|
-
set public_path=coms\less-node
|
|
74
|
-
set extt=.js
|
|
75
|
-
set export_as=default
|
|
76
|
-
call node coms/efront publish --no-polyfill --no-crypt %*
|
|
77
|
-
if exist coms\less-node\index.js del coms\less-node\index.js
|
|
78
|
-
move coms\less-node\less.js coms\less-node\index.js
|
|
79
|
-
call npm uninstall less
|
|
80
|
-
goto :eof
|
|
81
|
-
|
|
82
|
-
REM call %~dp0update-less.bat
|
|
83
|
-
|
|
84
|
-
rd /q /s node_modules
|
|
85
|
-
|
|
86
|
-
if exist package-lock.json del package-lock.json
|
package/tools/write-utf8.js
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
var fs = require("fs");
|
|
2
|
-
// ⏩⏪⏫⏬⏭⏮⏯⏰⏱⏲⏳⏴⏵⏶⏷⏸⏹⏺⏏
|
|
3
|
-
// ⌚⌛
|
|
4
|
-
// ❤ ❣ ✳✴✅❎❌➕➖➗➡
|
|
5
|
-
var points = [
|
|
6
|
-
0x3000, 0x3003,
|
|
7
|
-
0x3005, 0x3017,
|
|
8
|
-
0x301d, 0x301e,
|
|
9
|
-
0x3021, 0x3029,
|
|
10
|
-
0x3041, 0x3093,
|
|
11
|
-
0x309b, 0x309e,
|
|
12
|
-
0x30a1, 0x30f6,
|
|
13
|
-
0x30fc, 0x30fe,
|
|
14
|
-
0x3105, 0x3129,
|
|
15
|
-
0x3220, 0x3229,
|
|
16
|
-
0x3231, 0x3231,
|
|
17
|
-
0x32a3, 0x32a3,
|
|
18
|
-
0x32a3, 0x32a3,
|
|
19
|
-
0x338e, 0x338f,
|
|
20
|
-
0x339c, 0x339e,
|
|
21
|
-
0x33a1, 0x33a1,
|
|
22
|
-
0x33c4, 0x33c4,
|
|
23
|
-
0x33ce, 0x33ce,
|
|
24
|
-
0x33d1, 0x33d2,
|
|
25
|
-
0x33d5, 0x33d5,
|
|
26
|
-
0x4e00, 0x9fa5,
|
|
27
|
-
0xe76c, 0xe76c,
|
|
28
|
-
0xe78d, 0xe796,
|
|
29
|
-
0xe7e7, 0xe7f3,
|
|
30
|
-
0xe815, 0xe864,
|
|
31
|
-
0xff01, 0xff5e
|
|
32
|
-
];
|
|
33
|
-
var texts = [];
|
|
34
|
-
while (points.length) {
|
|
35
|
-
for (var cx = points.shift(), dx = points.shift() + 1; cx < dx; cx++) {
|
|
36
|
-
texts.push(String.fromCharCode(cx));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
fs.writeFileSync('aa.txt', texts.join(''));
|