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

..--

_setup/23-Nov-2023-3,6812,819

bench/23-Nov-2023-13,9269,377

docs/23-Nov-2023-2,6132,193

LICENSED23-Nov-202311.1 KiB202169

MANIFESTD23-Nov-20231 KiB5857

PKG-INFOD23-Nov-202315.6 KiB305251

README.chromiumD23-Nov-2023765 1916

README.rstD23-Nov-20234.1 KiB14395

package.cfgD23-Nov-20231.5 KiB7761

rjsmin.cD23-Nov-202317.5 KiB511429

rjsmin.pyD23-Nov-202320.2 KiB516430

setup.pyD23-Nov-20231.2 KiB4315

README.chromium

1Short Name: rJSmin
2URL: http://opensource.perlig.de/rjsmin/
3Version: 1.0.12
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 - Added a small hack to not clobber template strings. (Not a complete solution
17   since it won't handle nesting. E.g. `${'`'} foo` would probably cause
18   problems).
19

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- Line terminators after regex literals are handled more sensibly
38- "+ +" and "- -" sequences are not collapsed to '++' or '--'
39- Newlines before ! operators are removed more sensibly
40- Comments starting with an exclamation mark (``!``) can be kept optionally
41- rJSmin does not handle streams, but only complete strings. (However, the
42  module provides a "streamy" interface).
43
44Since most parts of the logic are handled by the regex engine it's way faster
45than the original python port of ``jsmin.c`` by Baruch Even. The speed factor
46varies between about 6 and 55 depending on input and python version (it gets
47faster the more compressed the input already is).  Compared to the
48speed-refactored python port by Dave St.Germain the performance gain is less
49dramatic but still between 3 and 50 (for huge inputs). See the docs/BENCHMARKS
50file for details.
51
52rjsmin.c is a reimplementation of rjsmin.py in C and speeds it up even more.
53
54.. _jsmin.c by Douglas Crockford: http://www.crockford.com/javascript/jsmin.c
55
56
57COPYRIGHT AND LICENSE
58---------------------
59
60Copyright 2011 - 2015
61André Malo or his licensors, as applicable.
62
63The whole package (except for the files in the bench/ directory)
64is distributed under the Apache License Version 2.0. You'll find a copy in the
65root directory of the distribution or online at:
66<http://www.apache.org/licenses/LICENSE-2.0>.
67
68
69SYSTEM REQUIREMENTS
70-------------------
71
72Both python 2 (>=2.4) and python 3 are supported.
73
74
75INSTALLATION
76------------
77
78Using pip
79~~~~~~~~~
80
81$ pip install rjsmin
82
83
84Using distutils
85~~~~~~~~~~~~~~~
86
87$ python setup.py install
88
89The following extra options to the install command may be of interest:
90
91  --without-c-extensions  Don't install C extensions
92  --without-docs          Do not install documentation files
93
94
95Drop-in
96~~~~~~~
97
98rJSmin effectively consists of two files: rjsmin.py and rjsmin.c, the
99latter being entirely optional. So, for simple integration you can just
100copy rjsmin.py into your project and use it.
101
102
103DOCUMENTATION
104-------------
105
106A generated API documentation is available in the docs/apidoc/ directory.
107But you can just look into the module. It provides a simple function,
108called jsmin which takes the script as a string and returns the minified
109script as a string.
110
111The module additionally provides a "streamy" interface similar to the one
112jsmin.c provides:
113
114$ python -mrjsmin <script >minified
115
116It takes two options:
117
118  -b  Keep bang-comments (Comments starting with an exclamation mark)
119  -p  Force using the python implementation (not the C implementation)
120
121The latest documentation is also available online at
122<http://opensource.perlig.de/rjsmin/>.
123
124
125BUGS
126----
127
128No bugs, of course. ;-)
129But if you've found one or have an idea how to improve rjsmin, feel free
130to send a pull request on `github <https://github.com/ndparker/rjsmin>`_
131or send a mail to <rjsmin-bugs@perlig.de>.
132
133
134AUTHOR INFORMATION
135------------------
136
137André "nd" Malo <nd@perlig.de>
138GPG: 0x8103A37E
139
140
141  If God intended people to be naked, they would be born that way.
142                                                   -- Oscar Wilde
143