Skip to content

Commit

Permalink
Starting the doc updates for the 2.0 code.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrburke committed May 28, 2012
1 parent 3713200 commit 96d31a5
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 308 deletions.
248 changes: 151 additions & 97 deletions docs/api.html

Large diffs are not rendered by default.

179 changes: 4 additions & 175 deletions docs/download.html
Expand Up @@ -11,9 +11,8 @@ <h1>Download RequireJS</h1>
<ul>
<li class="hbox"><a href="#text">text</a><span class="spacer boxFlex"></span><span class="sect">&sect; 2.1</span></li>
<li class="hbox"><a href="#domReady">domReady</a><span class="spacer boxFlex"></span><span class="sect">&sect; 2.2</span></li>
<li class="hbox"><a href="#order">order</a><span class="spacer boxFlex"></span><span class="sect">&sect; 2.3</span></li>
<li class="hbox"><a href="#cs">cs (CoffeeScript)</a><span class="spacer boxFlex"></span><span class="sect">&sect; 2.4</span></li>
<li class="hbox"><a href="#i18n">i18n</a><span class="spacer boxFlex"></span><span class="sect">&sect; 2.5</span></li>
<li class="hbox"><a href="#cs">cs (CoffeeScript)</a><span class="spacer boxFlex"></span><span class="sect">&sect; 2.3</span></li>
<li class="hbox"><a href="#i18n">i18n</a><span class="spacer boxFlex"></span><span class="sect">&sect; 2.4</span></li>
</ul>
<li class="hbox"><a href="#releasenotes">Release Notes</a><span class="spacer boxFlex"></span><span class="sect">&sect; 3</span></li>
</ul>
Expand All @@ -36,9 +35,9 @@ <h4 class="hbox">

<div class="subSection">
<h4 class="hbox">
<a name="samplejquery">Sample RequireJS 1.0.8 + jQuery 1.7.2 project</a>
<a name="samplejquery">Sample RequireJS 2.0.0 + jQuery 1.7.2 project</a>
<span class="boxFlex"></span>
<a class="download" href="http://requirejs.org/docs/release/jquery-require/jquery1.7.2-requirejs1.0.8/jquery-require-sample.zip">Download</a>
<a class="download" href="http://requirejs.org/docs/release/jquery-require/jquery1.7.2-requirejs2.0.0/jquery-require-sample.zip">Download</a>
</h4>

<p>A zip file containing a sample project that uses jQuery and RequireJS.</p>
Expand Down Expand Up @@ -86,17 +85,6 @@ <h4 class="hbox">
logic until the DOM is ready for querying/modification.</p>
</div>

<div class="subSection">
<h4 class="hbox">
<a name="order">order</a>
<span class="boxFlex"></span>
<a class="download" href="http://requirejs.org/docs/release/1.0.5/minified/order.js">Minified</a>
<a class="download" href="http://requirejs.org/docs/release/1.0.5/comments/order.js">With Comments</a>
</h4>
<p><a href="api.html#order">Load script in the order specified in the dependency array</a>. Useful for existing scripts that have implied dependencies instead of calling define() to create modular code.</p>
</div>


<div class="subSection">
<h4 class="hbox">
<a name="cs">cs (CoffeeScript)</a>
Expand Down Expand Up @@ -212,163 +200,4 @@ <h3 id="1-0-1">1.0.1</h3>
<li><a href="https://github.com/jrburke/r.js/issues?milestone=2&state=closed">r.js 1.0.1 changes</a></li>
</ul>

<h3 id="1-0-0">1.0.0</h3>

<p>Same as RequireJS 0.27.1 release, with some document updates and a
small fix to the optimizer's regular expression for converting CommonJS modules to AMD.</p>

<h3 id="0-27-1">0.27.1</h3>

<p>RequireJS 1.0 release candidate. Small bugfixes for 0.27.0:</p>

<ul>
<li>define(id, function () {}) where the function has require('') dependencies will now be scanned
for dependencies. Allows for smaller universal module adapters.</li>
<li>Loader plugin that depends on a different plugin's loaded resource works as it did in 0.26.0.</li>
<li>Optimizer: update UglifyJS to 1.1.</li>
<li>Optimizer: semicolons are inserted between files if concatenating would cause errors.</li>
<li>Optimizer: always strip BOM files on all platforms when file transforms/concatenations are done.</li>
<li>Optimizer: allow override of modules used in optimizer. <a href="https://github.com/jrburke/r.js/blob/master/build/tests/override/override.js">Example</a>.</li>
<li>Optimizer: allow copying of .directories via build config option.</li>
<li>Optimizer: Resolving paths for .js dependencies might fail if an appDir was not part of the config.</li>
</ul>


<h3 id="0-27-0">0.27.0</h3>

<p>RequireJS 1.0 release candidate.</p>

<ul>
<li><b>require.ready() has been removed</b>. In its place, use the <a href="api.html#pageload">domReady plugin</a>.
This allows better interoperability with other AMD loaders and better separation of concerns.</li>
<li>A new <a href="faq-optimization.html#wrap">wrap config option</a> for the optimizer is available,
for wrapping built code in a function. Allows for better API hiding and tiny builds with the
<a href="https://github.com/jrburke/almond">almond API shim</a>.</li>
<li>The order plugin is improved for IE.</li>
<li>Loader plugins can now have dependencies and they will work in the optimizer, as long as the
dependencies work in the optimizer environment (Node, Rhino).</li>
<li>The <a href="faq-optimization.html#namespace">namespace config option</a> for the optimizer is more robust.</li>
<li>Removed require.def(), use define() instead.</li>
<li>Removed module.setExports, use module.exports instead.</li>
</ul>

<h3 id="0-26-0">0.26.0</h3>

<ul>
<li><strong>npm install requirejs</strong> to allow require("requirejs"). This allows you to:
<ul>
<li><a href="node.html#usage">Load AMD modules inside node</a> without running a bootstrap script. It also
fixes some path issues using traditional Node modules alongside AMD modules.</li>
<li>Exposes the optimizer as require("requirejs").optimize() to
<a href="https://github.com/jrburke/r.js/blob/master/build/tests/http/httpBuild.js">allow dynamic server builds</a>
for people who like to do "<a href="node.html#optimizer">only one script tag
in the page at the end of body" development</a>. With the "excludeShallow" optimizer config,
you can still debug a single module/script while having the rest combined into one script.</li>
</ul>
This is now the recommended path for using RequireJS in Node. More information on
the <a href="node.html">Use with Node</a> page.</li>

<li>UglifyJS in the minifier is updated to 1.0.6. The upside: now
<a href="optimization.html#hasjs">has() branch trimming</a> now works with
the default minifier.</li>

<li>Fixes for running under Node on Windows using the native node.exe builds that are now available
in the Node 0.5.x series. Now there is less of a need to use Java to drive the RequireJS
Optimizer!</li>

<li>Configuration is now done via a require.config({}) call, to get in line with
the <a href="https://github.com/amdjs/amdjs-api/wiki/require#wiki-globalConfig">amdjs require API</a>.
The old require({}) method works on the global require()
for backwards compatibility, but the suggested API going forward is require.config({}).
The <a href="api.html">API doc</a> has been updated to show proper usage.

<li>There is <a href="faq-advanced.html#rename">a namespace option now for builds</a>,
to allow moving require() and define()
calls under a different namespace. This allows you to build an optimized file that uses
RequireJS but does not interfere with any other AMD loader on the page, and you can make
sure only your modules are loaded in that namespaced object.</li>

<li>The default error behavior when a define() factory function throws an error is
to not catch it. The catching done in 0.25.0 made it more difficult to debug. However,
there are some situations where catching the errors is preferred. Setting the config
value <a href="api.html#config-catchError">catchError.define = true</a> will switch to catching the errors
and allow processing via require.onError()</li>

<li>Closure Compiler in the optimizer was updated. As a result, the code
to invoke Closure Compiler changed, and will likely only work with the latest
Closure Compiler release. You can grab a version known to work with
the optimizer in the optimizer's <a href="https://github.com/jrburke/r.js/tree/master/lib/closure">lib/closure directory</a>.</li>

<li>There is now a pragmasOnSave build option, which is used in the
<a href="https://github.com/jrburke/require-cs/blob/master/demo/build.js">require-cs CoffeeScript loader plugin build profile</a>
to strip out the
CoffeeScript compiler after a build. The end result: tiny build layers
of converted CoffeeScript code.</li>
</ul>

<h3 id="0-25-0">0.25.0</h3>

<p>The awesome part: the optimizer is now just one JS file! It also doubles as a bootstrap script that supports the full capability of AMD modules and loader plugins in Node and in Rhino.</p>

<p>To use the optimizer, pass the "-o" option to r.js:</p>

<pre> node r.js -o app.build.js</pre>

<p>To run your AMD-based project via the adapter (assuming server.js is your top-level AMD module):</p>

<pre> node r.js server.js</pre>

<p>There is more information about <a href="http://requirejs.org/docs/node.html">running AMD modules in Node</a>. The <a href="http://requirejs.org/docs/optimization.html">optimizer docs</a> have been updated to the new optimizer syntax, and the r.js script has <a href="https://github.com/jrburke/r.js">its own project now</a>, to allow releases that are decoupled from require.js.</p>

<p>Other highlights:</p>

<ul><li>The loader plugin API changed to allow plugins to create cross-domain-accessible resources. The main use case: you use the text plugin to dynamically load text resources, but you want to deploy those scripts to a CDN. See the <a href="http://requirejs.org/docs/download.html#text">text plugin</a>'s implementation of writeFile() as an example.
</li><li>There is now a global <span style="font-weight: bold;">requirejs()</span> function object that is the same as the old global <span style="font-weight: bold;">require()</span> function object. This should allow RequireJS to work better in environments like <a href="http://mozillalabs.com/chromeless/">Mozilla Chromeless</a>, which already have a built-in require() function that does not have full AMD/loader plugin capabilities.
</li><li>It is now possible to <a href="http://requirejs.org/docs/api.html#config-jQuery">specify the precise version of jQuery</a> to allow in a RequireJS context. This is useful if you know of other scripts that load different versions of jQuery on a page.</li></ul>

<p>Some changes in the name of compatibility with other AMD module loaders and Node:</p>


<ul><li>The "lib" directory configuration in package support was removed. It was always very awkward to support, and Node no longer supports it, so it was enough justification to remove it.</li><li>Relative module IDs are now relative to the related module ID, not the related module ID path.</li><li>includeRequire in the optimizer config was removed, Use a paths config to include require.js instead. See the Optimization docs for more details.</li></ul>

<p>A small change to the context-specific require() passed to <a href="http://requirejs.org/docs/plugins.html#apiload">a loader plugin's load() call</a>: require.isDefined() is now require.defined() and there is require. specified().</p>

<h3>0.24.0</h3>

<ul>
<li>Support for IE 9. It has <a href="https://connect.microsoft.com/IE/feedback/details/648057/script-onload-event-is-not-fired-immediately-after-script-execution">a non-conformant script loading behavior</a> that necessitated the change. It would be ideal if IE 9 would change the behavior to be conformant.</li>
<li>Changes to jQuery integration:
<ul>
<li>jQuery 1.5.1 included in sample project.</li>
<li><span style="text-decoration: line-through">No more bundled RequireJS and jQuery file. RequireJS includes special code to detect jQuery as a module, so the combined file is not necessary, and this approach makes it easier to swap in new versions of jQuery as they are released.</span> (Changed on April 1, 2011 back to the old integrated sample)</li>
<li><span style="text-decoration: line-through">Because of that change, the jQuery sample project uses the new priority: config approach.</span> (Changed on April 1, 2011 back to the old integrated sample)</li>
</ul>
<li>allplugins-require.js has been removed. Plugins are no longer bundled with require.js or in the sample jQuery project. There are separate download links to the existing plugins on the download page. Special treatment of these plugins has also been removed from the require.js source, so those plugins behave like any other loader plugin.</li>
<li>There is now a <a href="#cs">CoffeScript plugin</a>. It makes it easy to code in CoffeeScript in the browser, it can participate in the optimizer optimizations, and it works in Node and Rhino. This is the best way to do cross-environment, modular CoffeeScript.</li>
<li>Bug fixes.</li>
</ul>

<h3>0.23.0</h3>

<ul>
<li>Calculation of baseUrl changed. This affects the jQuery Sample project, which has been updated in this release. Instead of baseUrl defaulting to the directory containing require.js, it now defaults to the HTML page's directory. If data-main is used, then the directory used in that attribute becomes the baseUrl. Explicitly setting baseUrl in the configuration overrides the aforementioned defaults.</li>
<li>The RequireJS optimizer now uses Node by default. So, build.sh/.bat are now Node-based. Java/Rhino is still supported via the buildj.sh/.bat scripts.</li>
<li><a href="https://github.com/mishoo/UglifyJS">UglifyJS</a> is now the default minifier for the optimizer, since it works both in Node and in Rhino. However, UglifyJS does not do if/else dead code removal, so the <a href="optimization.html#hasjs">has() optimization</a> is not that great when using UglifyJS. Hopefully this will change in a future version of UglifyJS. If you want the full has() optimization, Closure Compiler can still be used, either by using buildj.sh to use Java/Rhino to do the optimization work, or by running Closure Compiler yourself after the optimizer runs.</li>
<li>The behavior of the Node adapter, r.js has changed. It now assumes that any module found via the RequireJS config uses define() to define modules. If a module is not found via the RequireJS path config, r.js uses Node's native require() function and its pathing rules
to find the module. This allows the most compatible use of npm-installed modules. However it means you <strong>should not</strong> include RequireJS configuration for npm-installed modules/packages.</li>
<li>The r.js adapter now works in Node and Rhino.</li>
<li>The config option, <strong>baseUrlMatch</strong> has been removed, since the data-main baseUrl rule mentioned above removes the need for it.</li>
<li>Some important fixes around loader plugins: a fix to allow multiple modules to use the same plugin resources as a common dependency, and to allow loader plugins that use a define() function callback to work in the optimizer.</li>
<li>A fix for the use of jQuery's readyWait capability when jQuery is detected and used as a module.</li>
<li>Some directory shuffling related to making the rhino and node adapters the same for use in command line tools and in the r.js adapter.</li>
</ul>

<h3>0.22.0</h3>

<ul>
<li>A <a href="plugins.html">full plugin API</a> that supports also including plugin loaded artifacts in optimized builds.</li>
<li><a href="node.html">Robust Node support</a>: now can use npm-installed modules, .node add-ons, and modules on require.paths.</li>
<li>Support for <a href="optimization.html#hasjs">has.js optimizations</a> in the optimizer, including dead code branch removal via Closure Compiler.</a>
<li><a href="https://github.com/jrburke/requirejs/commits/">Bug Fixes from 2010-12-21 through 2011-01-05</a>.</li>
</ul>
</div>
8 changes: 3 additions & 5 deletions docs/jquery.html
Expand Up @@ -157,11 +157,9 @@ <h2>
<p>Some options:</p>

<ul>
<li>Use the <a href="api.html#order">order plugin</a> to load jQuery and the plugins you
use in the correct order.</li>
<li>Use the priority config to load jQuery before other scripts load. See the
<a href="https://github.com/jrburke/require-jquery">Alternate Integration section
in the require-jquery project</a> for more information.</li>
<li>Use the <a href="api.html#config-shim">shim config</a> to specify the
dependencies for the plugins so that jQuery will load before the
plugin is loaded.</li>
<li>Wrap the plugins in a define() call.</li>
</ul>

Expand Down
2 changes: 0 additions & 2 deletions docs/plugins.html
Expand Up @@ -59,8 +59,6 @@ <h2 id="names">
});
</code></pre>

<p>Note that before 0.24.0, the text!, i18n! and order! plugins were "special" in that you only need to use a name like "text" to refer to it, but the actual module name was "require/text". This was done to support old code that was authored before the Plugin API was fully fleshed out. That magic module name transformation is no longer done in 0.24.0 and greater.</p>

</div>

<div class="section">
Expand Down
6 changes: 3 additions & 3 deletions docs/start.html
Expand Up @@ -84,8 +84,6 @@ <h2>
&lt;/html&gt;
</code></pre>

<span class="note">The path rules used for data-main changed in RequireJS 0.23. Before that version, data-main="main" for the above example.</span>

<p>Inside of main.js, you can use require() to load any other scripts you need to run:</p>

<pre><code>require(["helper/util"], function(util) {
Expand All @@ -96,7 +94,9 @@ <h2>
});
</code></pre>

<p>That is it! Check out the <a href="api.html">API docs</a> to learn more about require() and define().</p>
<p>That will load the helper/util.js script. To get full advantage of RequireJS,
see the <a href="api.html">API docs</a> to learn more about defining and using
modules.</p>
</div>

<div class="section">
Expand Down
27 changes: 1 addition & 26 deletions tasks.txt
Expand Up @@ -3,10 +3,6 @@ Release Notes

Things to mention about 1.1/TODOC:
----------
- requirejs.undef()
- packagePaths removed
- jquery check only for holdReady jquerys that explicitly call define().


Implementation notes
--------
Expand All @@ -16,42 +12,21 @@ they are loaded in between anon define call scripts, since onload on scripts
do not fire immediately after script execution, the wrong names can be associated
with scripts.

1.1 items?
--------------
- support shim exports: 'jQuery.fn.plugin'?

- remove special jquery detection, only do it for define() calls.
- check bug list
- robust handling for anon modules loaded outside loader.
- baseUrl and name optional in optimizer? r.js -o include=a,b out=foo.js
- globals: config to help underscore case?
- remove packagePaths config.
- Just remove packages config altogether, suggest volojs for making adapter modules.
-> Allow 'module': '' and 'module/': '' config instead of packages config.
- allow error handler either per context, or per top-level require call.
- allow define(function(require, exports, module, define)) where that local define
only defines modules visible to the current module, to help with builds of projects
that wrap up all of their defines in a file but still want it usuable to other
modules?
- !removing priority config
- !Remove resourcesReady and jQuery callback holding

DOC updates:
- Talk about paths and baseUrl first,
- Teach how to fail, how to debug first.
- Put in link to the 1.0.8 docs.
- remove require() references, focus on doing data-main and define() instead.
- local require.isBrowser (any other props?) removed. requirejs.isBrowser still available.
- domReady.withResources removed, no more loader done messages? jquery hooks removed too.
- catchError.define removed, now just pass localized error handler.
- Update api.html#errors to mention new local errors, requireType, requireModules.
- plugins: load.error(). Once called, there is no resetting from it, no undef.
- module.config()
- shim: use, always need to use mainConfigFile.
- removed order
- map config with *
- text plugin: make sure to use module.config() and update doc on how to set useXhr
- i18n plugin: make sure to use module.config() and update doc on how to set
locale, config listing on api.html
- enforceDefine: true,
- mention in error handling
- create errors.html section for nodefine
Expand Down

0 comments on commit 96d31a5

Please sign in to comment.