From 71836c0698317fd782f1f8c7f443b9533b5e68bc Mon Sep 17 00:00:00 2001 From: CodeColorist Date: Thu, 4 Jul 2019 00:14:52 +0800 Subject: [PATCH] fix #51 --- lib/rpc.js | 8 ++------ package.json | 3 +-- scripts/lib/compile.js | 8 ++++---- 3 files changed, 7 insertions(+), 12 deletions(-) diff --git a/lib/rpc.js b/lib/rpc.js index b23622d..1ee9bf5 100644 --- a/lib/rpc.js +++ b/lib/rpc.js @@ -47,12 +47,8 @@ class Handler { async getAgent(name) { const prefix = path.join(__dirname, '..', 'agent', `${name}.bundle`) - if (process.env.NODE_ENV === 'development') { - const source = await readFile(`${prefix}.js`, 'utf8') - return this.session.createScript(source) - } - const bytes = await readFile(`${prefix}.bin`) - return this.session.createScriptFromBytes(bytes) + const source = await readFile(`${prefix}.js`, 'utf8') + return this.session.createScript(source) } } diff --git a/package.json b/package.json index 99b03f9..ae89471 100644 --- a/package.json +++ b/package.json @@ -34,8 +34,7 @@ "lib/", "bin/", "scripts/post-install.js", - "agent/*.bundle.js", - "agent/*.bundle.bin" + "agent/*.bundle.js" ], "author": "CodeColorist", "license": "MIT", diff --git a/scripts/lib/compile.js b/scripts/lib/compile.js index 4b11aa1..f6736e5 100644 --- a/scripts/lib/compile.js +++ b/scripts/lib/compile.js @@ -3,13 +3,13 @@ const compiler = require('frida-compile') const TAG_FRIDA = '[Frida]'.yellow const tasks = [{ src: 'agent/app/index.js', - dest: 'agent/app.bundle', + dest: 'agent/app.bundle.js', }] exports.run = function(watch) { const opt = { - bytecode: !watch, + bytecode: false, compress: false, babelify: true, sourcemap: watch, @@ -18,7 +18,7 @@ exports.run = function(watch) { } if (watch) { - tasks.forEach(task => compiler.watch(task.src, `${task.dest}.js`, opt) + tasks.forEach(task => compiler.watch(task.src, task.dest, opt) .on('compile', (details) => { const count = details.files.length const { duration } = details @@ -26,7 +26,7 @@ exports.run = function(watch) { })) } else { Promise - .all(tasks.map(task => compiler.build(task.src, `${task.dest}.bin`, opt))) + .all(tasks.map(task => compiler.build(task.src, task.dest, opt))) .catch(err => console.error(err)) } }