All Projects โ†’ jirutka โ†’ luasrcdiet

jirutka / luasrcdiet

Licence: other
Compresses Lua source code by removing unnecessary characters (updated fork of http://luasrcdiet.luaforge.net/)

Programming Languages

lua
6591 projects
shell
77523 projects

Projects that are alternatives of or similar to luasrcdiet

Babel Plugin Transform React Remove Prop Types
Remove unnecessary React propTypes from the production build. ๐ŸŽˆ
Stars: โœญ 890 (+1383.33%)
Mutual labels:  minification
Yii2 Minify View
Yii2 View component with minification css & js
Stars: โœญ 186 (+210%)
Mutual labels:  minification
bootstrap-4-boilerplate
Basic Bootstrap 4 Starter Template
Stars: โœญ 50 (-16.67%)
Mutual labels:  minification
Brackets Minifier
Minifies and Concatenates JS and CSS in Brackets using UglifyJS3 and CleanCSS
Stars: โœญ 56 (-6.67%)
Mutual labels:  minification
Static Site Boilerplate
A better workflow for building modern static websites.
Stars: โœญ 1,633 (+2621.67%)
Mutual labels:  minification
Webpack Tricks
Tips and tricks in using Webpack
Stars: โœญ 2,364 (+3840%)
Mutual labels:  minification
Wp Rocket
Performance optimization plugin for WordPress
Stars: โœญ 394 (+556.67%)
Mutual labels:  minification
source-map-unpack
Unpack ๐Ÿ› your JS source maps ๐Ÿ—บ to original files and folders.
Stars: โœญ 115 (+91.67%)
Mutual labels:  minification
Wpgulp
An advanced Gulp workflow for WordPress development with extensive documentation. Used by 40,000+ themes and plugins.
Stars: โœญ 1,733 (+2788.33%)
Mutual labels:  minification
clean-css
Fast and efficient CSS optimizer for node.js and the Web
Stars: โœญ 4,048 (+6646.67%)
Mutual labels:  minification
Jekyll Minibundle
A minimalistic asset bundling plugin for Jekyll
Stars: โœญ 65 (+8.33%)
Mutual labels:  minification
Fontmin Webpack
Minifies icon fonts to just the used glyphs.
Stars: โœญ 93 (+55%)
Mutual labels:  minification
Image Shrinker
App for macOS. Minify your images and graphics with just one drop. Autorenamed in the same place where it comes from. Immediately!
Stars: โœญ 217 (+261.67%)
Mutual labels:  minification
Babel Plugin Styled Components
Improve the debugging experience and add server-side rendering support to styled-components
Stars: โœญ 878 (+1363.33%)
Mutual labels:  minification
MinifyAll
A ๐—ฉ๐—ฆ๐—–๐—ผ๐—ฑ๐—ฒ ๐—บ๐—ถ๐—ป๐—ถ๐—ณ๐—ถ๐—ฒ๐—ฟ for JS, JSON/C, CSS, and HTML, you will love its simplicity! ๐ŸŒŸ ๐˜พ๐™ค๐™ข๐™ฅ๐™ง๐™š๐™จ๐™จ and ๐™œ๐™ฏ๐™ž๐™ฅ files and folders ๐Ÿ“ฆ Reduce your bundle and file sizes with lightning speed โšก
Stars: โœญ 54 (-10%)
Mutual labels:  minification
Free Style
Make CSS easier and more maintainable by using JavaScript
Stars: โœญ 693 (+1055%)
Mutual labels:  minification
Mediancut Posterizer
Lossy PNG compressor for RGBA PNGs. Has two modes: lossy averaging filter (blurizer) that denoises the image and optimal posterization using Median Cut quantization to reduce number of unique colors in the image with minimal visual distortion
Stars: โœญ 203 (+238.33%)
Mutual labels:  minification
MinifyAllCli
๐Ÿ“ฆ A lightweight, simple and easy npm tool to ๐—บ๐—ถ๐—ป๐—ถ๐—ณ๐˜† JSON/C, HTML and CSS! Also known as MinifyAll core! โญ Usable as ๐‘ช๐‘ณ๐‘ฐ tool or ๐’Š๐’Ž๐’‘๐’๐’“๐’•๐’‚๐’ƒ๐’๐’† in TS/JS as a ๐‘ด๐‘ถ๐‘ซ๐‘ผ๐‘ณ๐‘ฌ ๐Ÿฅฐ
Stars: โœญ 21 (-65%)
Mutual labels:  minification
rollup-plugin-html
Import HTML files as strings in rollup build
Stars: โœญ 36 (-40%)
Mutual labels:  minification
Static Html Webpack Boilerplate
๐Ÿ”ฎ modern tooling for old-school static webpage development
Stars: โœญ 226 (+276.67%)
Mutual labels:  minification

LuaSrcDiet

Build Status LDoc

Compresses Lua source code by removing unnecessary characters.

This is revival of LuaSrcDiet originally written by Kein-Hong Man.

Table of Contents

Introduction

LuaSrcDiet is a utility written in Lua for the purpose of turning Lua 5.1+ source code like this:

local function calc_indent(s)
  local col = 0
  for i = 1, #s do
    local c = sub(s, i, i)
    col = col + 1
    if c == "\t" then  -- tab
      while col % 8 > 0 do col = col + 1 end
    end
  end--for
  return math.floor(col / 8)
end

into a more compact or โ€œsqueezedโ€ form (minus a lot of unnecessary characters) like this:

local function _(l)local e=0
for o=1,#l do
local n=n(l,o,o)e=e+1
if n=="\t"then
while e%8>0 do e=e+1 end
end
end
return r.floor(e/8)end

and still be able to run normally under standard Lua 5.1+ or LuaJIT 2.0+.

LuaSrcDiet reduces the size of Lua 5.1+ source files by aggressively removing all unnecessary whitespace and comments, optimizing constant tokens, and renaming local variables to shorter names. For example, LuaSrcDiet squeezes its own sources from 156 kiB down to 42 kiB. Further bzip2 or lzma compression can bring the file size further down to under 13 kiB. Thatโ€™s 12ร— reduction in size, if you donโ€™t mind the decompression and compilation time.

LuaSrcDiet is broadly similar to Luizโ€™s lstrip (tar.gz) for Lua 5.1, which can be found on Luizโ€™s Libraries and tools for Lua page. LuaSrcDiet with its modified Lua source code lexer and parser allows most optimization options to be enabled or disabled separately, and can do a bit more like renaming local variable names.

There is also Matthew Wildโ€™s squish, which incorporates LuaSrcDiet and offers more code compression options. Squish goes beyond what LuaSrcDiet does, as the latter (as a matter of policy) only sticks to source code readable by standard Lua binaries.

LuaSrcDiet and Obfuscation

Owing to the use of LuaSrcDiet among certain things like WoW add-ons, the following is a clarification of this authorโ€™s intentions:

  • LuaSrcDiet can be used as a weak obfuscator. However, note that the structure and arrangement of the source code stays exactly the same, so do not depend on such a weak form of obfuscation if you really needed heavy-duty obfuscation.

  • LuaSrcDiet was written for the purpose of comparing minimum-sized sources with binary chunks, their compressibility, and the parsing performance of the Lua interpreter. I donโ€™t care one iota about obfuscation, itโ€™s compression Iโ€™m interested in.

  • This is experimental software. If you want to use it for important stuff, be sure to apply source and binary equivalence checking. Iโ€™m not, of course, responsible for anything you do.

  • Treat it like a text filter tool or a compiler. There is no legal requirement to acknowledge LuaSrcDiet or to place its copyright notice anywhere for the source code you processed. Your app is stuff you wrote, LuaSrcDiet is stuff I wrote. Simples.

  • Obfuscation cannot be defined precisely so we are dealing with subjective judgements. I think itโ€™s fair if people want to apply a mild deterrent against casual plagiarism. Those desperate for original sources should instead turn their energies towards Open Source or Free Software.

Changes in This Fork

  • Code-base updated to be compatible with Lua 5.1โ€“5.3.

  • Added support for processing Lua 5.2โ€“5.3 code (except binary equivalence checking).

  • Published on LuaRocks (the Lua package manager).

  • Documentation comments converted to LDocโ€™s format (except lparser.lua).

  • Documentation wiki pages converted to AsciiDoc.

Installation

Note: If you want to bootstrap development environment for running tests, read the next section.

Using LuaRocks

You can install luasrcdiet using LuaRocks (the Lua package manager):

luarocks install luasrcdiet

or to get the latest development version:

luarocks install --server=http://luarocks.org/dev luasrcdiet

Set Up Development Environment

  1. Clone this repository:

    git clone https://github.com/jirutka/luasrcdiet.git
    cd luasrcdiet
  2. Source file .envrc into your shell (or manually add $(pwd)/.venv/bin to your PATH):

    source .envrc
  3. Install Lua and modules for running tests into directory .venv:

    ./script/bootstrap
  4. Start hacking!

  5. Run linters and tests:

    ./script/test

Acknowledgements

  • The original author of LuaSrcDiet and its documentation is Kein-Hong Man. History of this repository until 2012 has been recreated from release tarballs hosted on Google Code.

  • Parts of LuaSrcDiet is based on Yueliang, which is in turn based on the Lua sources.

License

This project is licensed under MIT License. For the full text of the license, see the COPYRIGHT file.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].