mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-18 20:09:27 +08:00
main.js压缩,类型
This commit is contained in:
parent
023d913ea7
commit
c7168ccfde
13
public/libs/thirdparty/corejs.min.js
vendored
13
public/libs/thirdparty/corejs.min.js
vendored
File diff suppressed because one or more lines are too long
2895
public/libs/thirdparty/zip.js
vendored
2895
public/libs/thirdparty/zip.js
vendored
File diff suppressed because it is too large
Load Diff
@ -216,12 +216,14 @@ function main() {
|
||||
this.__VERSION__ = '2.10.0';
|
||||
this.__VERSION_CODE__ = 510;
|
||||
}
|
||||
// >>>> body end
|
||||
|
||||
main.prototype.init = function (mode, callback) {
|
||||
try {
|
||||
var a = {};
|
||||
var b = {};
|
||||
new Proxy(a, b);
|
||||
new Promise(res => res());
|
||||
const aa = `${123}`;
|
||||
aa;
|
||||
} catch (e) {
|
||||
@ -235,24 +237,12 @@ main.prototype.init = function (mode, callback) {
|
||||
}
|
||||
main.mode = mode;
|
||||
|
||||
Promise.all();
|
||||
|
||||
main.loadJs('project', main.pureData, function () {
|
||||
var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
|
||||
for (var ii in mainData) main[ii] = mainData[ii];
|
||||
|
||||
// main.levelChoose = main.levelChoose || [];
|
||||
// main.levelChoose.forEach(function (value) {
|
||||
// var span = document.createElement('span');
|
||||
// span.setAttribute('class', 'startButton');
|
||||
// span.innerText = value.title || '';
|
||||
// span.id = value.name;
|
||||
// (function (span, str_) {
|
||||
// span.onclick = function () {
|
||||
// core.events.startGame(str_);
|
||||
// };
|
||||
// })(span, value.name || '');
|
||||
// main.dom.levelChooseButtons.appendChild(span);
|
||||
// });
|
||||
|
||||
main.importFonts(main.fonts);
|
||||
|
||||
main.loadJs('libs', main.loadList, function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
// 1000多行,改不动了
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -1,3 +1,4 @@
|
||||
///<reference path="../../../src/types/core.d.ts" />
|
||||
'use strict';
|
||||
|
||||
(function () {
|
||||
|
@ -115,4 +115,29 @@ import { exec } from 'child_process';
|
||||
} catch {
|
||||
console.log('压缩插件失败');
|
||||
}
|
||||
|
||||
// 4. 压缩main.js
|
||||
try {
|
||||
// 先获取不能压缩的部分
|
||||
const main = await fs.readFile('./dist/main.js', 'utf-8');
|
||||
const endIndex = main.indexOf('// >>>> body end');
|
||||
const nonCompress = main.slice(0, endIndex);
|
||||
const needCompress = main.slice(endIndex + 17);
|
||||
await fs.writeFile('./dist/temp.js', needCompress, 'utf-8');
|
||||
await fs.rm('./dist/main.js');
|
||||
exec('babel ./dist/temp.js --out-file ./dist/main.js').on(
|
||||
'close',
|
||||
async () => {
|
||||
const nowMain = await fs.readFile('./dist/main.js', 'utf-8');
|
||||
await fs.writeFile(
|
||||
'./dist/main.js',
|
||||
nonCompress + nowMain,
|
||||
'utf-8'
|
||||
);
|
||||
await fs.rm('./dist/temp.js');
|
||||
}
|
||||
);
|
||||
} catch {
|
||||
console.log('main.js压缩失败');
|
||||
}
|
||||
})();
|
||||
|
Loading…
Reference in New Issue
Block a user