• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..--

_setup/22-Nov-2023-3,6312,777

bench/22-Nov-2023-13,7339,278

docs/22-Nov-2023-2,7512,308

LICENSED22-Nov-202311.1 KiB202169

MANIFESTD22-Nov-20231 KiB5756

PKG-INFOD22-Nov-202315.5 KiB304250

README.chromiumD22-Nov-2023598 1613

README.rstD22-Nov-20234.1 KiB14294

package.cfgD22-Nov-20231.5 KiB7963

rjsmin.cD22-Nov-202315.4 KiB457386

rjsmin.pyD22-Nov-202316.4 KiB447373

setup.pyD22-Nov-20231.2 KiB4315

README.chromium

1Short Name: rJSmin
2URL: http://opensource.perlig.de/rjsmin/
3Version: 1.0.10
4License: Apache 2.0
5License File: NOT_SHIPPED
6Security Critical: no
7
8Description:
9rJSmin is a javascript minifier written in python.
10The minifier is based on the semantics of jsmin.c by Douglas Crockford.
11The module is a re-implementation aiming for speed, so it can be used at runtime (rather than during a preprocessing step). Usually it produces the same results as the original jsmin.c.
12
13Modifications made:
14 - Removed the bench.sh since the file doesn't have the licensing info and
15   caused license checker to fail.
16

README.rst

1.. -*- coding: utf-8 -*-
2
3===========================================
4 rJSmin - A Javascript Minifier For Python
5===========================================
6
7TABLE OF CONTENTS
8-----------------
9
101. Introduction
112. Copyright and License
123. System Requirements
134. Installation
145. Documentation
156. Bugs
167. Author Information
17
18
19INTRODUCTION
20------------
21
22rJSmin is a javascript minifier written in python.
23
24The minifier is based on the semantics of `jsmin.c by Douglas Crockford`_\.
25
26The module is a re-implementation aiming for speed, so it can be used at
27runtime (rather than during a preprocessing step). Usually it produces the
28same results as the original ``jsmin.c``. It differs in the following ways:
29
30- there is no error detection: unterminated string, regex and comment
31  literals are treated as regular javascript code and minified as such.
32- Control characters inside string and regex literals are left untouched; they
33  are not converted to spaces (nor to \\n)
34- Newline characters are not allowed inside string and regex literals, except
35  for line continuations in string literals (ECMA-5).
36- "return /regex/" is recognized correctly.
37- "+ +" and "- -" sequences are not collapsed to '++' or '--'
38- Newlines before ! operators are removed more sensibly
39- Comments starting with an exclamation mark (``!``) can be kept optionally
40- rJSmin does not handle streams, but only complete strings. (However, the
41  module provides a "streamy" interface).
42
43Since most parts of the logic are handled by the regex engine it's way faster
44than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
45varies between about 6 and 55 depending on input and python version (it gets
46faster the more compressed the input already is).  Compared to the
47speed-refactored python port by Dave St.Germain the performance gain is less
48dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS
49file for details.
50
51rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
52
53.. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c
54
55
56COPYRIGHT AND LICENSE
57---------------------
58
59Copyright 2011 - 2014
60André Malo or his licensors, as applicable.
61
62The whole package (except for the files in the bench/ directory)
63is distributed under the Apache License Version 2.0. You'll find a copy in the
64root directory of the distribution or online at:
65<http://www.apache.org/licenses/LICENSE-2.0>.
66
67
68SYSTEM REQUIREMENTS
69-------------------
70
71Both python 2 (>=2.4) and python 3 are supported.
72
73
74INSTALLATION
75------------
76
77Using pip
78~~~~~~~~~
79
80$ pip install rjsmin
81
82
83Using distutils
84~~~~~~~~~~~~~~~
85
86$ python setup.py install
87
88The following extra options to the install command may be of interest:
89
90  --without-c-extensions  Don't install C extensions
91  --without-docs          Do not install documentation files
92
93
94Drop-in
95~~~~~~~
96
97rJSmin effectively consists of two files: rjsmin.py and rjsmin.c, the
98latter being entirely optional. So, for simple integration you can just
99copy rjsmin.py into your project and use it.
100
101
102DOCUMENTATION
103-------------
104
105A generated API documentation is available in the docs/apidoc/ directory.
106But you can just look into the module. It provides a simple function,
107called jsmin which takes the script as a string and returns the minified
108script as a string.
109
110The module additionally provides a "streamy" interface similar to the one
111jsmin.c provides:
112
113$ python -mrjsmin <script >minified
114
115It takes two options:
116
117  -b  Keep bang-comments (Comments starting with an exclamation mark)
118  -p  Force using the python implementation (not the C implementation)
119
120The latest documentation is also available online at
121<http://opensource.perlig.de/rjsmin/>.
122
123
124BUGS
125----
126
127No bugs, of course. ;-)
128But if you've found one or have an idea how to improve rjsmin, feel free
129to send a pull request on `github <https://github.com/ndparker/rjsmin>`_
130or send a mail to <rjsmin-bugs@perlig.de>.
131
132
133AUTHOR INFORMATION
134------------------
135
136André "nd" Malo <nd@perlig.de>
137GPG: 0x8103A37E
138
139
140  If God intended people to be naked, they would be born that way.
141                                                   -- Oscar Wilde
142