unminify
Version 2.0.0
โครงการเล็ก ๆ น้อย ๆ ที่จะยกเลิกสิ่งที่น่ากลัวหลายอย่าง JavaScript Build Tools จะทำกับ JavaScript นอกเหนือจากการยกเลิกการลดขนาดลงส่วนใหญ่แล้วมันยังย้อนกลับบางส่วนของความโง่เขลา แต่เป็นเทคนิค "การทำให้งงงวย" ที่ใช้กันอย่างน่าประหลาดใจที่ใช้ในป่า
มันอาจทำให้คุณลองใช้พูดได้ว่าฉันพบจาวาสคริปต์แบบสุ่มนี้
npm install -g unminify
หรือใช้งานโดยไม่ต้องติดตั้งผ่าน npx (มีตั้งแต่ npm 5.2.0)
npx unminify [...args]
unminify /path/to/file.js
--safety อาจได้รับการเปิดใช้งาน/ปิดการแปลงตามการรับประกันความปลอดภัยที่ผู้ใช้ต้องการ อ้างถึงเอกสารระดับความปลอดภัยสำหรับรายละเอียดเพิ่มเติม มูลค่าของ --safety อาจเป็นหนึ่งในuselesssafe (ค่าเริ่มต้น)mostly-safeunsafewildly-unsafe--additional-transform อาจได้รับศูนย์หรือมากกว่านั้นแต่ละครั้งตามด้วยเส้นทางไปยังโมดูลที่ให้การแปลง AST; ฟังก์ชั่นส่งสัญญาณว่าการแปลงไม่ได้ใช้โดยการส่งคืนอินพุต let { unminifySource } = require ( 'unminify' ) ;
let sourceText = '/* a minified/"obfuscated" JavaScript program */' ;
console . log ( unminify ( sourceText ) ) ;
// or, with options
console . log ( unminifySource ( sourceText , {
safety : unminify . safetyLevels . UNSAFE ,
additionalTransforms : [ function ( ast ) { /* ... */ } ] ,
} ) ) ; หากคุณมีต้นไม้กะอยู่แล้วคุณสามารถใช้ unminifyTree เพื่อหลีกเลี่ยงค่าใช้จ่าย CodeGen & Reparse
let { parseScript } = require ( 'shift-parser' ) ;
let { unminifyTree } = require ( 'unminify' ) ;
let sourceText = '/* a minified/"obfuscated" JavaScript program */' ;
let tree = parseScript ( sourceText ) ;
let unminifiedTree = unminifyTree ( tree ) ; Copyright 2017 Shape Security, Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.