mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
fix
This commit is contained in:
1 parent
160b4482cc
commit
605f8fc65d
13 files changed
+119
-66
No files matched your search
@@ -0,0 +1,24 @@
|
||||
const fs = require('fs');
|
||||
const { root } = require('./utils');
|
||||
|
||||
module.exports = {
|
||||
formidable: () => {
|
||||
const tasks = ['incoming_form', 'file', 'json_parser', 'querystring_parser'];
|
||||
for (const task of tasks) {
|
||||
let file = fs.readFileSync(root(`node_modules/formidable/lib/${task}.js`)).toString();
|
||||
if (file.startsWith('if (global.GENTLY) require = GENTLY.hijack(require);')) {
|
||||
file = file.split('\n');
|
||||
file[0] = '';
|
||||
file = file.join('\n');
|
||||
fs.writeFileSync(root(`node_modules/formidable/lib/${task}.js`), file);
|
||||
}
|
||||
}
|
||||
},
|
||||
sockjs: () => {
|
||||
const file = fs.readFileSync(root('node_modules/sockjs/lib/sockjs.js')).toString().split('\n');
|
||||
if (file[139].includes('this.app.log')) {
|
||||
file[139] = '';
|
||||
fs.writeFileSync(root('node_modules/sockjs/lib/sockjs.js'), file.join('\n'));
|
||||
}
|
||||
},
|
||||
};
|
||||
+9
-5
@@ -5,6 +5,7 @@ const zlib = require('zlib');
|
||||
const yaml = require('js-yaml');
|
||||
const { root, ignoreFailure, rmdir } = require('./utils');
|
||||
const template = require('./template');
|
||||
const hack = require('./hack');
|
||||
|
||||
const fsp = fs.promises;
|
||||
|
||||
@@ -24,6 +25,11 @@ async function build(type) {
|
||||
if (!['development', 'production'].includes(type)) throw new Error(`Unknown type: ${type}`);
|
||||
ignoreFailure(fs.mkdirSync, root('.build'));
|
||||
ignoreFailure(fs.mkdirSync, root('.build/module'));
|
||||
|
||||
for (const task in hack) {
|
||||
hack[task]();
|
||||
}
|
||||
|
||||
const langs = fs.readdirSync(root('locales'));
|
||||
const locale = {};
|
||||
for (const i of langs) {
|
||||
@@ -34,14 +40,14 @@ async function build(type) {
|
||||
id: 'builtin',
|
||||
locale,
|
||||
template: template('templates'),
|
||||
file: {},
|
||||
public: {},
|
||||
};
|
||||
const files = getFiles('.uibuild');
|
||||
for (const f of files) {
|
||||
if (fs.statSync(root(`.uibuild/${f}`)).isDirectory()) {
|
||||
builtin.file[f] = null;
|
||||
builtin.public[f] = null;
|
||||
} else {
|
||||
builtin.file[f] = fs.readFileSync(root(`.uibuild/${f}`)).toString('base64');
|
||||
builtin.public[f] = fs.readFileSync(root(`.uibuild/${f}`)).toString('base64');
|
||||
}
|
||||
}
|
||||
const data = zlib.gzipSync(Buffer.from(yaml.safeDump(builtin)), { level: -1 });
|
||||
@@ -68,8 +74,6 @@ async function build(type) {
|
||||
}
|
||||
const f = fs.readFileSync(root('.build/app.js')).toString();
|
||||
const installer = fs.readFileSync(root('tool/install.js')).toString();
|
||||
const file = `global._hydroModule=${JSON.stringify(j)};${f}`;
|
||||
fs.writeFileSync(root('.build/full.js'), file);
|
||||
const hydro = {};
|
||||
hydro.app = Buffer.from(f).toString('base64');
|
||||
hydro.modules = j;
|
||||
|
||||
@@ -1,24 +1,9 @@
|
||||
/* eslint-disable import/no-extraneous-dependencies */
|
||||
const fs = require('fs');
|
||||
const webpack = require('webpack');
|
||||
const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin');
|
||||
const { root } = require('./utils');
|
||||
|
||||
const build = async (type) => {
|
||||
function hackNodeModuleFormidable() {
|
||||
const tasks = ['incoming_form', 'file', 'json_parser', 'querystring_parser'];
|
||||
for (const task of tasks) {
|
||||
let file = fs.readFileSync(root(`node_modules/formidable/lib/${task}.js`)).toString();
|
||||
if (file.startsWith('if (global.GENTLY) require = GENTLY.hijack(require);')) {
|
||||
file = file.split('\n');
|
||||
file[0] = '';
|
||||
file = file.join('\n');
|
||||
fs.writeFileSync(root(`node_modules/formidable/lib/${task}.js`), file);
|
||||
}
|
||||
}
|
||||
}
|
||||
hackNodeModuleFormidable();
|
||||
|
||||
const config = {
|
||||
mode: type,
|
||||
entry: {
|
||||
|
||||
Reference in new issue
Block a user