- Made request-scope exposed data always inherit the app-scope exposed data.
With this change if a request comes in before data is exposed at the
app-scope, the
app.locals.state
object will be created first. This ensures the semantics of the relationship between app- and request-scoped exposed data. (#20)
-
[!] Deprecated
expose( obj, namespace, local )
API signature, the third argument is nowoptions
, use:expose( obj, namespace, {local: local})
. The deprecated signature will be removed in a future release, and logs a warning when it is used. -
Added
{cache: true}
option that signals Express State to eagerly serialize unchanging data and reuse the result to greatly improve performance of repeatedtoString()
calls (#19). -
Fixed issue with
app
<--res
exposed data inheritance. Previously, the exposed data ares
would inherit from theapp
was locked to the state of the exposed app-scope data at the time of the request. Now, if new data is exposed at the app-scope during a request, it's properly inherited by the request-scoped data. -
Added benchmark tests. They can be run using:
npm run benchmark
. Real world fixture data is used from Photos Near Me and Yahoo Tech. -
Tweaked
toString()
serialization process to gather low-hanging performance fruit (#18).
-
Fixed
npm test
script so it runs on Windows. (#17) -
Added
.npmignore
file. (#15) -
Tweaked closure that's wrapped around the serialized data and namespace initialization. There's no affect on app code, this is merely renaming a local variable from
g
toroot
which is the reference to the root or global object that the namespaces hang off of.
-
Updated object branding used by
extend()
to assign the module'sexport
object as the value of the "branding". This makes it easier compare and determine which Express State module instance was used to extend the Express app. (#14) -
Added "modown" keyword to package.json. (#16)
-
[!] Unsafe HTML characters in string values are now encoded to their Unicode counterparts during serialization to protected against XSS attacks. The encoded characters will
===
the non-encoded characters so there's no worry of this messing up application code. While this change makes Express State safer, untrusted user input should always be escaped! (#11) -
Added "Untrusted User Input" and "Exposing Functions" sections to the README. (#12)
-
Improved README docs to be clearer and better organized. (#10: @zhouyaoji)
-
[!] Changed how this package extends Express. There's now only one way — to explicitly pass an Express app instance to the
extend()
method:var express = require('express'), expstate = require('express-state'), app = express(); // Extend the Express app with Express State's functionality. expstate.extend(app);
This new
extend()
implementation uses the object branding technique. (#6) -
A
TypeError
is now thrown when trying to serialize native build-in functions. This matches the behavior ofJSON.stringify()
with circular references. (#7) -
Added documentation in README.md. (#2)
-
Added
extend()
function which takes anexpress
module instance and adds theexpose()
method to its application and response prototypes, if it does not already exist. (#5) -
Added
augment()
function which takes an Express app instance and adds theexpose()
method to it and its response prototype, if it does not already exist. (#5)
-
Prevented multiple copies of
express-state
from overwritingexpose()
when it already has been plugged into a copy ofexpress
. (#4) -
Added Screwdriver CI integration.
-
Added Travis CI integration.
-
Improved namespace rendering by removing the initialization of leaf namespaces since exposed values will be assigned to them. (#1)
- Initial release.