@neos21/bookmarkletify

0.0.5 • Public • Published

@neos21/bookmarkletify : Bookmarkletify

NPM Version GPR Version

JavaScript コードを Bookmarklet 形式に圧縮・変換します。

CLI Usage

$ npm install -g @neos21/bookmarkletify

# Input From File
$ bookmarkletify -i ./my-file.js
$ bookmarkletify --input ./my-file.js

# Input From Arguments
$ bookmarkletify "console.log('Test');"
javascript:(()=>{console.log("Test")})();
# Example Output

API Usage

// CJS
const bookmarkletify = require('@neos21/bookmarkletify');
// ESM
import { bookmarkletify } from '@neos21/bookmarkletify';

const input = `javascript:
  ((doc) => {
    let elem = doc.querySelector('#test');
    if(elem) {
      console.log(elem.value);
    }
  })(document);
`;

try {
  const uglified = bookmarkletify(input);
  console.log(uglified);
}
catch(error) {
  console.error(error);
}

Links

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @neos21/bookmarkletify

    Weekly Downloads

    1

    Version

    0.0.5

    License

    MIT

    Unpacked Size

    949 kB

    Total Files

    24

    Last publish

    Collaborators

    • neos21