-
Notifications
You must be signed in to change notification settings - Fork 282
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #504 from socketstream/feature/465-bundler
#465 bundler basics. More tests required.
- Loading branch information
Showing
51 changed files
with
2,068 additions
and
628 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ node_modules | |
dump.rdb | ||
npm-debug.log | ||
*.tgz | ||
test/fixtures/project/client/static/assets/abc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<h1><code ng:non-bindable="">default</code> | ||
<div><span class="hint">service in module <code ng:non-bindable="">bundler</code> | ||
</span> | ||
</div> | ||
</h1> | ||
<div><h2 id="description">Description</h2> | ||
<div class="description"><div class="bundler-default-page bundler-default-default-page"><p>The default bundler of HTML, CSS & JS</p> | ||
</div></div> | ||
<div class="member method"><h2 id="methods">Methods</h2> | ||
<ul class="methods"><li><h3 id="methods_assetloader">assetLoader()</h3> | ||
<div class="assetloader"><div class="bundler-default-page bundler-default-default-assetloader-page"><p>Return entry for the JS loader depending on the includes.system client config.</p> | ||
</div><h5 id="methods_assetloader_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-assetentry">AssetEntry</a></td><td><div class="bundler-default-page bundler-default-default-assetloader-page"><p>Loader resource</p> | ||
</div></td></tr></table></div> | ||
</li> | ||
<li><h3 id="methods_assetstart">assetStart()</h3> | ||
<div class="assetstart"><div class="bundler-default-page bundler-default-default-assetstart-page"><p>Return the resource for starting the view. It is code for immediate execution at the end of the page.</p> | ||
</div><h5 id="methods_assetstart_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-assetentry">AssetEntry</a></td><td><div class="bundler-default-page bundler-default-default-assetstart-page"><p>Start Script resource</p> | ||
</div></td></tr></table></div> | ||
</li> | ||
<li><h3 id="methods_entries">entries(assetType, systemAssets)</h3> | ||
<div class="entries"><div class="bundler-default-page bundler-default-default-entries-page"><p>Provides the view and the pack functions with a | ||
list of entries for an asset type relative to the client directory. | ||
The default implementation is used.</p> | ||
</div><h5 id="methods_entries_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>assetType</td><td><a href="" class="label type-hint type-hint-string">String</a></td><td><div class="bundler-default-page bundler-default-default-entries-page"><p>js/css</p> | ||
</div></td></tr><tr><td>systemAssets</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="bundler-default-page bundler-default-default-entries-page"><p>Collection of libs, modules, initCode</p> | ||
</div></td></tr></tbody></table><h5 id="methods_entries_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">[AssetEntry]</a></td><td><div class="bundler-default-page bundler-default-default-entries-page"><p>List of output entries</p> | ||
</div></td></tr></table></div> | ||
</li> | ||
<li><h3 id="methods_systemmodule">systemModule(name)</h3> | ||
<div class="systemmodule"><div class="bundler-default-page bundler-default-default-systemmodule-page"><p>Return the resource for a registered system module by the given name. It uses | ||
the default wrapCode for module registration with require.</p> | ||
</div><h5 id="methods_systemmodule_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">String</a></td><td><div class="bundler-default-page bundler-default-default-systemmodule-page"><p>Logical Module Name</p> | ||
</div></td></tr></tbody></table><h5 id="methods_systemmodule_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-assetentry">AssetEntry</a></td><td><div class="bundler-default-page bundler-default-default-systemmodule-page"><p>Module resource</p> | ||
</div></td></tr></table></div> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<h1><code ng:non-bindable="">bundler</code> | ||
<div><span class="hint"></span> | ||
</div> | ||
</h1> | ||
<div><h2 id="description">Description</h2> | ||
<div class="description"><div class="bundler-page"><p>Bundlers included.</p> | ||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<h1><code ng:non-bindable="">webpack</code> | ||
<div><span class="hint">service in module <code ng:non-bindable="">bundler</code> | ||
</span> | ||
</div> | ||
</h1> | ||
<div><h2 id="description">Description</h2> | ||
<div class="description"><div class="bundler-webpack-page bundler-webpack-webpack-page"><p>The webpack bundler of HTML, CSS & JS</p> | ||
<p>This is just for demonstration purposes and to validate the custom bundler concept. It can be improved.</p> | ||
</div></div> | ||
<div class="member method"><h2 id="methods">Methods</h2> | ||
<ul class="methods"><li><h3 id="methods_entries">entries(assetType, systemAssets)</h3> | ||
<div class="entries"><div class="bundler-webpack-page bundler-webpack-default-entries-page"><p>Provides the view and the pack functions with a | ||
list of entries for an asset type relative to the client directory.</p> | ||
</div><h5 id="methods_entries_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>assetType</td><td><a href="" class="label type-hint type-hint-string">String</a></td><td><div class="bundler-webpack-page bundler-webpack-default-entries-page"><p>js/css</p> | ||
</div></td></tr><tr><td>systemAssets</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="bundler-webpack-page bundler-webpack-default-entries-page"><p>Collection of libs, modules, initCode</p> | ||
</div></td></tr></tbody></table><h5 id="methods_entries_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">[AssetEntry]</a></td><td><div class="bundler-webpack-page bundler-webpack-default-entries-page"><p>List of output entries</p> | ||
</div></td></tr></table></div> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h1><code ng:non-bindable="">events</code> | ||
<div><span class="hint"></span> | ||
</div> | ||
</h1> | ||
<div><h2 id="description">Description</h2> | ||
<div class="description"><div class="events-page"><p>Internal Event bus.</p> | ||
<p>Note: only used by the ss-console module for now. This idea will be expended upon in SocketStream 0.4</p> | ||
<p>'server:start' is emitted when the server starts. If in production the assets will be saved before the event.</p> | ||
</div></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<h1><code ng:non-bindable="">add</code> | ||
<div><span class="hint">service in module <code ng:non-bindable="">ss</code> | ||
</span> | ||
</div> | ||
</h1> | ||
<div><h2 id="description">Description</h2> | ||
<div class="description"><div class="ss-add-page"><p>Call from your app to safely extend the 'ss' internal API object passed through to your /server code</p> | ||
</div></div> | ||
<h2 id="usage">Usage</h2> | ||
<div class="usage"><pre class="prettyprint linenums">add(name, fn);</pre> | ||
<h4 id="usage_parameters">Parameters</h4><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ss-add-page"><ul> | ||
<li>Key in the <code>ss</code> API.</li> | ||
</ul> | ||
</div></td></tr><tr><td>fn</td><td><a href="" class="label type-hint type-hint-function">function</a><a href="" class="label type-hint type-hint-number">number</a><a href="" class="label type-hint type-hint-boolean">boolean</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ss-add-page"><ul> | ||
<li>value or function</li> | ||
</ul> | ||
</div></td></tr></tbody></table></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<h1><code ng:non-bindable="">bundler</code> | ||
<div><span class="hint">service in module <code ng:non-bindable="">ss</code> | ||
</span> | ||
</div> | ||
</h1> | ||
<div><h2 id="description">Description</h2> | ||
<div class="description"><div class="ss-bundler-page ss-bundler-bundler-page"><h4 id="description_client-bundling-api">Client bundling API</h4> | ||
<p>Client bundling API for implementing a custom bundler.</p> | ||
</div></div> | ||
<div class="member method"><h2 id="methods">Methods</h2> | ||
<ul class="methods"><li><h3 id="methods_define">define(client, args)</h3> | ||
<div class="define"><h5 id="methods_define_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>client</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ss-bundler-page ss-bundler-bundler-define-page"><p>object to store the definition in</p> | ||
</div></td></tr><tr><td>args</td><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="ss-bundler-page ss-bundler-bundler-define-page"><p>arguments passed to define</p> | ||
</div></td></tr></tbody></table></div> | ||
</li> | ||
<li><h3 id="methods_destsfor">destsFor(client)</h3> | ||
<div class="destsfor"><div class="ss-bundler-page ss-bundler-bundler-destsfor-page"><p>The define client method of all bundlers must return the file locations for the client.</p> | ||
<pre><code>return ss.bundler.destsFor(client); | ||
</code></pre><p>To offer a very different way to define the entry-points for assets the bundler can tweak | ||
the paths or replace them.</p> | ||
</div><h5 id="methods_destsfor_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>client</td><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="ss-bundler-page ss-bundler-bundler-destsfor-page"><p>Object describing the client.</p> | ||
</div></td></tr></tbody></table><h5 id="methods_destsfor_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-object">object</a></td><td><div class="ss-bundler-page ss-bundler-bundler-destsfor-page"><p>Destinations paths, relPaths, dir, containerDir</p> | ||
</div></td></tr></table></div> | ||
</li> | ||
<li><h3 id="methods_get">get(client)</h3> | ||
<div class="get"><div class="ss-bundler-page ss-bundler-bundler-get-page"><p>Determine the bundler for a client</p> | ||
</div><h5 id="methods_get_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>client</td><td><a href="" class="label type-hint type-hint-object">object</a><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ss-bundler-page ss-bundler-bundler-get-page"><p>Query params with client=name or an actual client object</p> | ||
</div></td></tr></tbody></table></div> | ||
</li> | ||
<li><h3 id="methods_systemlibs">systemLibs()</h3> | ||
<div class="systemlibs"><div class="ss-bundler-page ss-bundler-bundler-systemlibs-page"><p>A single entry for all system libraries.</p> | ||
</div><h5 id="methods_systemlibs_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-assetentry">AssetEntry</a></td><td><div class="ss-bundler-page ss-bundler-bundler-systemlibs-page"><p>Entry</p> | ||
</div></td></tr></table></div> | ||
</li> | ||
<li><h3 id="methods_systemmodule">systemModule(name, wrap)</h3> | ||
<div class="systemmodule"><div class="ss-bundler-page ss-bundler-bundler-systemmodule-page"><p>Describe a system module.</p> | ||
</div><h5 id="methods_systemmodule_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">String</a></td><td><div class="ss-bundler-page ss-bundler-bundler-systemmodule-page"><p>Name of the system module to return in a descriptor</p> | ||
</div></td></tr><tr><td>wrap</td><td><a href="" class="label type-hint type-hint-boolean">boolean</a></td><td><div class="ss-bundler-page ss-bundler-bundler-systemmodule-page"><p>Shall the content be wrapped in <code>require.define</code>. Default is true.</p> | ||
</div></td></tr></tbody></table><h5 id="methods_systemmodule_returns">Returns</h5><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-assetentry">AssetEntry</a></td><td><div class="ss-bundler-page ss-bundler-bundler-systemmodule-page"><p>Entry</p> | ||
</div></td></tr></table></div> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<h1><code ng:non-bindable="">client</code> | ||
<div><span class="hint">service in module <code ng:non-bindable="">ss</code> | ||
</span> | ||
</div> | ||
</h1> | ||
<div><h2 id="description">Description</h2> | ||
<div class="description"><div class="ss-client-page ss-client-client-page"><h4 id="description_client-serving,-bundling,-development,-building">Client serving, bundling, development, building.</h4> | ||
<p>One or more clients are defined and will be served in production as a single HTML, CSS, and JS file.</p> | ||
</div></div> | ||
<div class="member method"><h2 id="methods">Methods</h2> | ||
<ul class="methods"><li><h3 id="methods_send">send(name, content, options)</h3> | ||
<div class="send"><div class="ss-client-page ss-client-client-send-page"><p>Allow other libs to send assets to the client. add new System Library or Module</p> | ||
</div><h5 id="methods_send_parameters">Parameters</h5><table class="variables-matrix table table-bordered table-striped"><thead><tr><th>Param</th><th>Type</th><th>Details</th></tr></thead><tbody><tr><td>name</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ss-client-page ss-client-client-send-page"><ul> | ||
<li>Module name for require.</li> | ||
</ul> | ||
</div></td></tr><tr><td>content</td><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ss-client-page ss-client-client-send-page"><ul> | ||
<li>The JS code</li> | ||
</ul> | ||
</div></td></tr><tr><td>options</td><td><a href="" class="label type-hint type-hint-object">Object</a></td><td><div class="ss-client-page ss-client-client-send-page"><ul> | ||
<li>Allows you to specify <code>compress</code> and <code>coffee</code> format flags.</li> | ||
</ul> | ||
</div></td></tr></tbody></table></div> | ||
</li> | ||
</ul> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<h1><code ng:non-bindable="">env</code> | ||
<div><span class="hint">service in module <code ng:non-bindable="">ss</code> | ||
</span> | ||
</div> | ||
</h1> | ||
<div><h2 id="usage">Usage</h2> | ||
<div class="usage"><pre class="prettyprint linenums">ss.env</pre> | ||
<h4 id="usage_returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ss-env-page"><p>Execution environment type. To change set environment variable <code>NODE_ENV</code> or <code>SS_ENV</code>. 'development' by default.</p> | ||
</div></td></tr></table></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<h1><code ng:non-bindable=""></code> | ||
<div><span class="hint"></span> | ||
</div> | ||
</h1> | ||
<div><div class="ss-page"><p>Internal API object which is passed to sub-modules and can be used within your app</p> | ||
<p>To access it without it being passed <code>var ss = require('socketstream').api;</code></p> | ||
</div></div> |
22 changes: 11 additions & 11 deletions
22
docs/partials/api/utils.log.log.html → docs/partials/api/ss.log.log.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<h1><code ng:non-bindable="">root</code> | ||
<div><span class="hint">service in module <code ng:non-bindable="">ss</code> | ||
</span> | ||
</div> | ||
</h1> | ||
<div><h2 id="description">Description</h2> | ||
<div class="description"><div class="ss-root-page"><p>By default the project root is the current working directory</p> | ||
</div></div> | ||
<h2 id="usage">Usage</h2> | ||
<div class="usage"><pre class="prettyprint linenums">ss.root</pre> | ||
<h4 id="usage_returns">Returns</h4><table class="variables-matrix"><tr><td><a href="" class="label type-hint type-hint-string">string</a></td><td><div class="ss-root-page"><p>Project root</p> | ||
</div></td></tr></table></div> | ||
</div> |
Oops, something went wrong.