mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
t
This commit is contained in:
1 parent
9247b71b5f
commit
7d3bdc2dd1
4 files changed
+331
-352
No files matched your search
+23
-10
@@ -1,24 +1,37 @@
|
|||||||
const fs = require('fs');
|
const fs = require('fs');
|
||||||
const { root } = require('./utils');
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
formidable: () => {
|
formidable: () => {
|
||||||
const tasks = ['incoming_form', 'file', 'json_parser', 'querystring_parser'];
|
const tasks = ['incoming_form', 'file', 'json_parser', 'querystring_parser'];
|
||||||
for (const task of tasks) {
|
for (const task of tasks) {
|
||||||
let file = fs.readFileSync(root(`node_modules/formidable/lib/${task}.js`)).toString();
|
const p = require.resolve(`formidable/lib/${task}`);
|
||||||
if (file.startsWith('if (global.GENTLY) require = GENTLY.hijack(require);')) {
|
const file = fs.readFileSync(p).toString().split('\n');
|
||||||
file = file.split('\n');
|
if (file[0].includes('if (global.GENTLY) require = GENTLY.hijack(require);')) {
|
||||||
file[0] = '';
|
file[0] = '// Hacked';
|
||||||
file = file.join('\n');
|
fs.writeFileSync(p, file.join('\n'));
|
||||||
fs.writeFileSync(root(`node_modules/formidable/lib/${task}.js`), file);
|
} else if (!file[0].includes('// Hacked')) {
|
||||||
|
console.error('Cannot hack formidable', task);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
sockjs: () => {
|
sockjs: () => {
|
||||||
const file = fs.readFileSync(root('node_modules/sockjs/lib/sockjs.js')).toString().split('\n');
|
const p = require.resolve('sockjs/lib/sockjs.js');
|
||||||
|
const file = fs.readFileSync(p).toString().split('\n');
|
||||||
if (file[139].includes('this.app.log')) {
|
if (file[139].includes('this.app.log')) {
|
||||||
file[139] = '';
|
file[139] = '// Hacked';
|
||||||
fs.writeFileSync(root('node_modules/sockjs/lib/sockjs.js'), file.join('\n'));
|
fs.writeFileSync(p, file.join('\n'));
|
||||||
|
} else if (!file[139].includes('// Hacked')) {
|
||||||
|
console.error('Cannot hack sockjs');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
yargs: () => {
|
||||||
|
const p = require.resolve('yargs');
|
||||||
|
const file = fs.readFileSync(p).toString().split('\n');
|
||||||
|
if (file[12].includes('const argv = yargs(processArgs, cwd, require)')) {
|
||||||
|
file[12] = 'const argv = yargs(processArgs, cwd)';
|
||||||
|
fs.writeFileSync(p, file.join('\n'));
|
||||||
|
} else if (!file[12].includes('const argv = yargs(processArgs, cwd)')) {
|
||||||
|
console.error('Cannot hack yargs');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@@ -23,6 +23,7 @@ const Mark = require('markdown-it-mark');
|
|||||||
// :::warn This page requires javascript. :::
|
// :::warn This page requires javascript. :::
|
||||||
// :::record-pass Accepted :::
|
// :::record-pass Accepted :::
|
||||||
const Container = require('markdown-it-container');
|
const Container = require('markdown-it-container');
|
||||||
|
// FIXME doesn't work for webpack
|
||||||
const Anchor = require('markdown-it-anchor');
|
const Anchor = require('markdown-it-anchor');
|
||||||
const TOC = require('markdown-it-table-of-contents');
|
const TOC = require('markdown-it-table-of-contents');
|
||||||
|
|
||||||
|
|||||||
+7
-7
@@ -12,13 +12,13 @@
|
|||||||
"bson": "^4.0.2",
|
"bson": "^4.0.2",
|
||||||
"detect-browser": "^5.1.1",
|
"detect-browser": "^5.1.1",
|
||||||
"js-yaml": "^3.13.1",
|
"js-yaml": "^3.13.1",
|
||||||
"koa": "^2.11.0",
|
"koa": "^2.12.1",
|
||||||
"koa-body": "^4.1.1",
|
"koa-body": "^4.2.0",
|
||||||
"koa-morgan": "^1.0.1",
|
"koa-morgan": "^1.0.1",
|
||||||
"koa-router": "^8.0.8",
|
"koa-router": "^8.0.8",
|
||||||
"koa-static-cache": "^5.1.3",
|
"koa-static-cache": "^5.1.3",
|
||||||
"lodash": "^4.17.15",
|
"lodash": "^4.17.15",
|
||||||
"markdown-it": "^10.0.0",
|
"markdown-it": "^11.0.0",
|
||||||
"markdown-it-anchor": "^5.3.0",
|
"markdown-it-anchor": "^5.3.0",
|
||||||
"markdown-it-container": "^3.0.0",
|
"markdown-it-container": "^3.0.0",
|
||||||
"markdown-it-footnote": "^3.0.2",
|
"markdown-it-footnote": "^3.0.2",
|
||||||
@@ -27,8 +27,8 @@
|
|||||||
"markdown-it-mark": "^3.0.0",
|
"markdown-it-mark": "^3.0.0",
|
||||||
"markdown-it-table-of-contents": "^0.4.4",
|
"markdown-it-table-of-contents": "^0.4.4",
|
||||||
"moment-timezone": "^0.5.31",
|
"moment-timezone": "^0.5.31",
|
||||||
"mongodb": "^3.5.7",
|
"mongodb": "^3.5.9",
|
||||||
"nodemailer": "^6.3.1",
|
"nodemailer": "^6.4.10",
|
||||||
"nunjucks": "^3.2.1",
|
"nunjucks": "^3.2.1",
|
||||||
"prismjs": "^1.20.0",
|
"prismjs": "^1.20.0",
|
||||||
"sockjs": "^0.3.20",
|
"sockjs": "^0.3.20",
|
||||||
@@ -36,8 +36,8 @@
|
|||||||
"yargs": "^15.3.1"
|
"yargs": "^15.3.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^7.2.0",
|
||||||
"eslint-config-airbnb-base": "^14.1.0",
|
"eslint-config-airbnb-base": "^14.2.0",
|
||||||
"eslint-plugin-import": "^2.20.2",
|
"eslint-plugin-import": "^2.20.2",
|
||||||
"friendly-errors-webpack-plugin": "^1.7.0",
|
"friendly-errors-webpack-plugin": "^1.7.0",
|
||||||
"webpack": "^4.42.1"
|
"webpack": "^4.42.1"
|
||||||
|
|||||||
Reference in new issue
Block a user