------------------
Full support for sourcemaps; changes that make it possible follows:
- High level read/write functionality provided by a new ``io`` module.
- There is now a ``Deferrable`` rule type for marking certain Tokens
that need extra handling. The support for this has changed the
various API that deals with setting up of this.
- For support of the sourcemap generation, a number of new ruletypes
have been added.
- The sourcemap write function had its argument order modified to
better support the sourcepath tracking feature of input Nodes. Its
return value also now match the ordering of the encode_sourcemap
function.
- The chunk types in ruletypes have been renamed, and also a new type
called StreamFragment is introduced, so that multiple sources output
to a single stream can be properly tracked by the source mapping
processes.
- `rspivak/slimit66 <https://github.com/rspivak/slimit/issues/66>`_
should be fully supported now.
Minify printer now has ability to shorten/obfuscate identifiers:
- Provide a name obfuscation function for shortening identifiers, to
further achieve minified output. Note that this does not yet fully
achieve the level of minification ``slimit`` had; future versions
may implement this functionality as various AST transformations.
- Also provided ability to drop unneeded semicolons.
Other significant changes:
- Various changes to internal class and function names for the 1.0.0
release. A non exhaustive listing of changes to modules relative to
the root of this package name as compared to previous major release
follows:
``asttypes``
- All ``slimit`` compatibility features removed.
- ``Switch`` (the incorrect version) removed.
- ``SwitchStatement`` -> ``Switch``
- ``SetPropAssign`` constructor: ``parameters`` -> ``parameter``
- ``UnaryOp`` -> ``UnaryExpr``
- Other general deprecated features also removed.
``factory``
- ``Factory`` -> ``SRFactory``
``visitors``
- Removed (details follow).
``walkers``
- ``visitors.generic.ReprVisitor`` -> ``walkers.ReprWalker``
``layouts``
- Module was split and reorganised; the simple base ones can be
found in ``handlers.core``, the indentation related features are
now in ``handlers.indentation``.
``unparsers.base``
- ``.default_layout_handlers`` -> ``handlers.core.default_rules``
- ``.minimum_layout_handlers`` -> ``handlers.core.minimum_rules``
``unparsers.prettyprint``
- Renamed to ``unparsers.walker``.
- The implementation was actually standard tree walking, no
correctly implemented visitor functions/classes were ever present.
``vlq``
- ``.create_sourcemap`` -> ``sourcemap.create_sourcemap``
- Broke up the visitors class as they weren't really visitors as
described. The new implementations (calmjs.parse-0.9.0) were really
walkers, so move them to that name and leave it at that. Methods
were also renamed to better reflect their implementation and purpose.
- Many slimit compatibility modules, classes and incorrectly implemented
functionalities removed.
- The usage of the Python 3 ``str`` type (``unicode`` in Python 2) is
now enforced for the parser, to avoid various failure cases where
mismatch types occur.
- The base Node asttype has a sourcepath attribute which is to be used
for tracking the original source of the node; if assigned, all its
subnodes without sourcepath defined should be treated as from that
source.
- Also provide an even higher level function for usage with streams
through the ``calmjs.parse.io`` module.
- Semicolons and braces added as structures to be rendered.
Bug fixes:
- Functions starting with a non-word character will now always have a
whitespace rendered before it to avoid syntax error.
- Correct an incorrect iterator usage in the walk function.
- Ensure List separators don't use the rowcol positions of a subsequent
Elision node.
- Lexer will only report real lexer tokens on errors (ASI generated
tokens are now dropped as they don't exist in the original source
which results in confusing rowcol reporting).
- `rspivak/slimit57 <https://github.com/rspivak/slimit/issues/57>`_,
as it turns out ``'\0'`` is not considered to be octal, but is a <NUL>
character, which the rule to parse was not actually included in the
lexer patches that were pulled in previous to this version.
- `rspivak/slimit75 <https://github.com/rspivak/slimit/issues/75>`_,
Option for shadowing of names of named closures, which is now disabled
by default (obfuscated named closures will not be shadowed by other
obfuscated names in children).
- Expressions can no longer contain an unnamed function.