Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

express-yui

Package Overview
Dependencies
Maintainers
6
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

express-yui - npm Package Compare versions

Comparing version 1.1.2 to 1.2.0

7

HISTORY.md

@@ -7,2 +7,9 @@ Express YUI Change History

1.2.0 (2014-02-18)
------------------
* __[!]__ Leverage express-state's `cache` option to improve `expose()` performance.
If changes to the YUI configuration need to be made after the first request, the
app's YUI config now _must_ be re-exposed.
1.1.2 (2014-02-13)

@@ -9,0 +16,0 @@ ------------------

4

lib/loader-patch.js

@@ -46,3 +46,5 @@ /*

patchClient: function () {
var patches = this.config().patches;
var config = this.config(),
patches = config.patches;
patches.push.apply(patches, arguments);

@@ -49,0 +51,0 @@ },

@@ -10,3 +10,3 @@ /*

/**
Provides some basic features to expose yui configurations information thru `res.expose()`
Provides some basic features to expose yui configurations information through `app.expose()`
that could be used to boot `YUI` in the client runtime. It also provide some sugar to

@@ -34,3 +34,3 @@ expose static assests that are YUI related.

/**
Exposes the yui configuration into `res.locals.state`. It also
Exposes the yui configuration into `app.locals.state`. It also
exposes the `express-yui` wrapper for YUI on the client so you can

@@ -59,8 +59,8 @@ access `app.yui.*` on the client side just like you do on the server

yui_config = configCache = req.app.yui.config();
// exposing the `YUI_config`
req.app.expose(yui_config, 'window.YUI_config', {cache: true});
req.app.expose(client, 'window.app.yui', {cache: true});
}
// exposing the `YUI_config`
res.expose(yui_config, 'window.YUI_config');
res.expose(client, 'window.app.yui');
next();

@@ -73,3 +73,3 @@

/**
Expose the seed information into `res.locals.state`. This seed is
Expose the seed information into `app.locals.state`. This seed is
an array of urls based on the call to `app.yui.seed()`, which is

@@ -87,14 +87,19 @@ going to be used by the client bootstrap code to inject YUI into

var seedCache;
var configCache,
seedCache;
return function (req, res, next) {
var yui_seed = seedCache;
var yui_config = configCache,
yui_seed = seedCache;
if (!yui_seed && req.app && req.app.yui) {
// if app.yui exists, we can expose the configuration
if (!(yui_config || yui_seed) && req.app && req.app.yui) {
// one time operation to compute the initial configuration and seed.
yui_config = configCache = req.app.yui.config();
yui_seed = seedCache = req.app.yui.getSeedUrls();
req.app.expose(yui_seed, 'window.YUI_config.seed', {cache: true});
}
res.expose(yui_seed, 'window.YUI_config.seed');
next();

@@ -113,3 +118,3 @@

app = express();
expyui.extend(app);

@@ -120,4 +125,4 @@

In the example above, the `state` of the app will be serialized
per request, and can be used in the template to set up the client
In the example above, the `state` of the app will be serialized *once*, on
the first request, and can be used in the template to set up the client
side to run YUI with the same configuration used on the server side.

@@ -164,5 +169,7 @@ Here is an example of a handlebars template:

/**
Forces a request to use yui in debug mode with combine disabled.
Forces a request to use yui in debug mode with combine disabled. This exposes
YUI configuration overrides per request on `res.locals.state` (which inherits
from `app.locals.state`.)
// exposing yui into the client side thru `state` object
// exposing yui into the client side through `state` object
app.use(expyui.expose());

@@ -174,6 +181,2 @@ // using yui in debug mode when node runs in debug mode with custom filter

Note: the `expyui.debug()` middleware only works if it is called
after the regular `expyui.expose()` middleware was called, otherwise
it will not be able to overrule the default yui config for the app.
More details about the yui debug mode settings

@@ -180,0 +183,0 @@ [in the YUI API Docs](http://yuilibrary.com/yui/docs/api/classes/config.html).

@@ -73,5 +73,3 @@ /*

loaderConfig = loaderConfig || {};
loaderConfig = utils.extend(config, comboConfig, {
utils.extend(config, comboConfig, {
base: utils.joinURLFolder(groupDefaultBase, yuiDir),

@@ -78,0 +76,0 @@ root: utils.joinURLFolder(groupDefaultRoot, yuiDir)

@@ -156,3 +156,3 @@ /*

config.seed = modules;
config.seed = modules;

@@ -159,0 +159,0 @@ return this;

@@ -98,2 +98,3 @@ /*

};
// setting some basic values

@@ -157,3 +158,3 @@ app.set('yui default base', app.get('yui default base') || "/");

args.unshift(this._config);
utils.extend.apply(utils, args);
utils.extend.apply(null, args);
}

@@ -182,2 +183,4 @@

// TODO: This should mutate through an API.
utils.extend(config, {

@@ -184,0 +187,0 @@ base: "http://yui.yahooapis.com/" + version + "/",

{
"name": "express-yui",
"description": "Express extension for YUI Applications",
"version": "1.1.2",
"version": "1.2.0",
"homepage": "https://github.com/yahoo/express-yui",

@@ -15,3 +15,3 @@ "author": "Caridy Patino <caridy@yahoo-inc.com> (http://github.com/caridy)",

"dependencies": {
"express-state": "~1.0.1",
"express-state": "~1.1.1",
"debug": "*"

@@ -18,0 +18,0 @@ },

@@ -56,3 +56,3 @@ Express YUI

```
```js
var express = require('express'),

@@ -80,3 +80,3 @@ expyui = require('express-yui'),

```
```js
var express = require('express'),

@@ -98,3 +98,3 @@ expyui = require('express-yui'),

```
```html
<script>{{{state}}}</script>

@@ -110,3 +110,7 @@ <script>

**Note:** In order to be efficient by default, once the first request comes in
the `expose()` middleware will cache the state of the YUI config for the app.
This means if it needs to be mutated on a per-request basies, it must be re-exposed.
### Using the locator plugin to build the app

@@ -117,3 +121,3 @@

```
```js
var express = require('express'),

@@ -169,3 +173,3 @@ expyui = require('express-yui'),

```
```js
app.get('/forecast', expyui.expose(), function (req, res, next) {

@@ -200,3 +204,3 @@ req.app.yui.use('yql', function (Y) {

```
```js
app.yui.setCoreFromAppOrigin();

@@ -223,3 +227,3 @@ app.use(expyui.static(__dirname + '/build'));

```
```js
app.set('yui default base', 'http://mycdn.com/path/to/build/');

@@ -226,0 +230,0 @@ app.set('yui combo config', {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc