hodor-loader

5.0.0 • Public • Published

hodor-loader

 _| | |_  _                 _        _     _      _                  _
|_  .  _|| |_      ___     | |    __| |   | |_   | |_      ___    __| |    ___     ___      _ _
|_     _|| ' \    / _ \    | |   / _` |   |  _|  | ' \    / -_)  / _` |   / _ \   / _ \    | '_|
  |_|_|  |_||_|   \___/   _|_|_  \__,_|   _\__|  |_||_|   \___|  \__,_|   \___/   \___/   _|_|_
_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'

travis build codecov coverage version downloads WTFPL License

This webpack loader allows statically replacing string literal and literal template syntax in JavaScript source code with Hodor before it gets bundled and interpreted.

Smells like an experimental manipulative Lexer, huh?!

Heads-up: I simply do this for fun; use at your own risk.

Image of Hodor by Jack Spellman

Hold the door! Holddoor! Hodor! https://youtu.be/5DoBY8M_bCg

Why?

Installation

npm isntall hodor-loader --save-dev

Usage

Documentation: Using loaders

Example

Given this webpack config:

{
  // ...,
  module: {
    rules: [
      {
        test: /\.m?js$/,
        use: 'hodor-loader'
      }
    ]
  },
  // ...
}

It will transform the matching JS file source code, e.g.

console.log('hello, world');
 
document.querySelector('#app').textContent = 'the quick brown fox jumps over a lazy dog';
 
// alert("hold the door");
 
document.writeln('hold, the; door!');
 
const x = 42;
console.log(`the answer is ${x}`);

...into:

console.log('HODOR, HODOR');
 
document.querySelector('#HODOR').textContent =
  'HODOR HODOR HODOR HODOR HODOR HODOR HODOR HODOR HODOR';
 
// alert("hold the door");
 
document.writeln('HODOR, HODOR; HODOR!');
 
const x = 42;
console.log(`HODOR HODOR HODOR HODOR`);

Author

Glenn Dwiyatcita (@dwiyatci)

License

WTFPL – Do What the Fuck You Want to Public License.

See LICENSE.txt.

WTFPL

Package Sidebar

Install

npm i hodor-loader

Weekly Downloads

1

Version

5.0.0

License

SEE LICENSE IN LICENSE.txt

Unpacked Size

233 kB

Total Files

19

Last publish

Collaborators

  • dwiyatci