jazz-jss 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/dist/handlebars/handlebars.js +1493 -0
- data/dist/hashchange/{jquery.ba-hashchange.js → hashchange.js} +0 -0
- data/dist/jazz/lib/controller.js +1 -1
- data/dist/jazz/lib/core.js +3 -0
- data/dist/jazz/lib/db.js +1 -1
- data/dist/jazz/lib/helper.js +2 -1
- data/dist/jazz/lib/model.js +11 -4
- data/dist/jazz/lib/view.js +1 -1
- data/dist/jazz/module.js +15 -0
- data/dist/jquery/jquery.js +0 -0
- data/dist/require/require.js +0 -0
- data/dist/require/template.js +98 -0
- data/dist/underscore/underscore.js +0 -0
- data/lib/jazz/app_detector.rb +6 -3
- data/lib/jazz/app_generator.rb +12 -8
- data/lib/jazz/helper_generator.rb +30 -0
- data/lib/jazz/scaffold_generator.rb +4 -0
- data/templates/app_root/Rakefile +11 -0
- data/templates/app_root/{app → development/app}/assets/javascripts/application.js +0 -0
- data/templates/app_root/{app → development/app}/assets/stylesheets/application.css +0 -0
- data/templates/app_root/development/app/controllers/application_controller.js +11 -0
- data/templates/app_root/development/app/helpers/application_helper.js +7 -0
- data/templates/app_root/development/config/glue.js +9 -0
- data/templates/app_root/development/config/routes.js +5 -0
- data/templates/app_root/scripts/build.js +30 -0
- data/templates/app_root/scripts/r.js/LICENSE +58 -0
- data/templates/app_root/scripts/r.js/README.md +177 -0
- data/templates/app_root/scripts/r.js/build/build.js +26 -0
- data/templates/app_root/scripts/r.js/build/buildebug.sh +4 -0
- data/templates/app_root/scripts/r.js/build/example.build.js +296 -0
- data/templates/app_root/scripts/r.js/build/jslib/blank.js +4 -0
- data/templates/app_root/scripts/r.js/build/jslib/build.js +952 -0
- data/templates/app_root/scripts/r.js/build/jslib/commandLine.js +23 -0
- data/templates/app_root/scripts/r.js/build/jslib/commonJs.js +152 -0
- data/templates/app_root/scripts/r.js/build/jslib/env.js +47 -0
- data/templates/app_root/scripts/r.js/build/jslib/lang.js +49 -0
- data/templates/app_root/scripts/r.js/build/jslib/logger.js +58 -0
- data/templates/app_root/scripts/r.js/build/jslib/node.js +106 -0
- data/templates/app_root/scripts/r.js/build/jslib/node/args.js +20 -0
- data/templates/app_root/scripts/r.js/build/jslib/node/file.js +263 -0
- data/templates/app_root/scripts/r.js/build/jslib/node/load.js +17 -0
- data/templates/app_root/scripts/r.js/build/jslib/node/optimize.js +10 -0
- data/templates/app_root/scripts/r.js/build/jslib/node/print.js +16 -0
- data/templates/app_root/scripts/r.js/build/jslib/optimize.js +279 -0
- data/templates/app_root/scripts/r.js/build/jslib/opto.build.js +11 -0
- data/templates/app_root/scripts/r.js/build/jslib/parse.js +590 -0
- data/templates/app_root/scripts/r.js/build/jslib/pragma.js +251 -0
- data/templates/app_root/scripts/r.js/build/jslib/requirePatch.js +286 -0
- data/templates/app_root/scripts/r.js/build/jslib/rhino.js +22 -0
- data/templates/app_root/scripts/r.js/build/jslib/rhino/args.js +21 -0
- data/templates/app_root/scripts/r.js/build/jslib/rhino/file.js +244 -0
- data/templates/app_root/scripts/r.js/build/jslib/rhino/load.js +12 -0
- data/templates/app_root/scripts/r.js/build/jslib/rhino/optimize.js +100 -0
- data/templates/app_root/scripts/r.js/build/jslib/rhino/print.js +12 -0
- data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/README.md +16 -0
- data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/index.js +21 -0
- data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/parse-js.js +1342 -0
- data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/process.js +2005 -0
- data/templates/app_root/scripts/r.js/build/jslib/uglifyjs/squeeze-more.js +55 -0
- data/templates/app_root/scripts/r.js/build/jslib/x.js +243 -0
- data/templates/app_root/scripts/r.js/build/tests/all.js +47 -0
- data/templates/app_root/scripts/r.js/build/tests/allj.sh +3 -0
- data/templates/app_root/scripts/r.js/build/tests/alln.sh +18 -0
- data/templates/app_root/scripts/r.js/build/tests/anonSimple.build.js +7 -0
- data/templates/app_root/scripts/r.js/build/tests/buildUtils.js +19 -0
- data/templates/app_root/scripts/r.js/build/tests/builds.js +489 -0
- data/templates/app_root/scripts/r.js/build/tests/circular.build.js +18 -0
- data/templates/app_root/scripts/r.js/build/tests/convert.js +18 -0
- data/templates/app_root/scripts/r.js/build/tests/css.build.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/css/common/common.css +4 -0
- data/templates/app_root/scripts/r.js/build/tests/css/master.css +10 -0
- data/templates/app_root/scripts/r.js/build/tests/css/sub/sub1.css +7 -0
- data/templates/app_root/scripts/r.js/build/tests/cssTestCompare.css +13 -0
- data/templates/app_root/scripts/r.js/build/tests/end.frag +3 -0
- data/templates/app_root/scripts/r.js/build/tests/expected/unoExcludeShallow.js +23 -0
- data/templates/app_root/scripts/r.js/build/tests/exports.build.js +12 -0
- data/templates/app_root/scripts/r.js/build/tests/hasTestModule.build.js +10 -0
- data/templates/app_root/scripts/r.js/build/tests/hasTestModule.js +30 -0
- data/templates/app_root/scripts/r.js/build/tests/http/httpBuild.js +70 -0
- data/templates/app_root/scripts/r.js/build/tests/http/main.html +28 -0
- data/templates/app_root/scripts/r.js/build/tests/http/scripts/main.js +18 -0
- data/templates/app_root/scripts/r.js/build/tests/http/scripts/one.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/http/scripts/three.js +5 -0
- data/templates/app_root/scripts/r.js/build/tests/http/scripts/two.js +7 -0
- data/templates/app_root/scripts/r.js/build/tests/i18n.build.js +17 -0
- data/templates/app_root/scripts/r.js/build/tests/indexBuilder.build.js +8 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/a.js +17 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/b.js +8 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/build.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/c.js +7 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/d.js +5 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/expected.js +36 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/node_modules/amdefine/LICENSE +58 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/node_modules/amdefine/amdefine.js +188 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/amdefine/node_modules/amdefine/package.json +21 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/comments/bang.js +10 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/comments/build.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/comments/expected.js +9 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/comments/license.js +13 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/dotpackage/scripts/app.build.js +15 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/dotpackage/scripts/main-expected.js +13 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/dotpackage/scripts/main.js +7 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/empty/build.js +13 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/empty/expected.js +8 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/empty/main.js +1 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/empty/sub1.js +1 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/empty/sub2.js +1 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nameInsertion/build.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nameInsertion/expected.js +12 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nameInsertion/main.js +9 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/namespace/build.js +8 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/namespace/expected.js +47 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/namespace/main.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/namespace/modules/four.js +7 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/namespace/modules/one.js +9 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/namespace/modules/three.js +14 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/namespace/modules/two.js +5 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/a.js +12 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/b.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/build.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/buildWithCE.js +7 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/c.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/d.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/e.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/expected-built.js +36 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/expected-builtWithCE.js +42 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/main.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nested/top.js +10 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/a.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/b.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/build.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNeedAll.js +9 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNeedB.js +11 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNeedC.js +11 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNeedD.js +11 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/buildNested.js +7 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/c.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/d.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-built.js +21 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNeedAll.js +31 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNeedB.js +24 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNeedC.js +24 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNeedD.js +25 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/expected-builtNested.js +31 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/nestedHas/main.js +17 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/plugins/build.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/plugins/converter.js +11 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/plugins/main.js +6 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/plugins/plug.js +29 -0
- data/templates/app_root/scripts/r.js/build/tests/lib/plugins/util.js +7 -0
- data/templates/app_root/scripts/r.js/build/tests/nameOnly.build.js +10 -0
- data/templates/app_root/scripts/r.js/build/tests/nodeAll.js +3 -0
- data/templates/app_root/scripts/r.js/build/tests/nodeOptimize.js +12 -0
- data/templates/app_root/scripts/r.js/build/tests/nodeOptimizeNoCallback.js +10 -0
- data/templates/app_root/scripts/r.js/build/tests/order.build.js +16 -0
- data/templates/app_root/scripts/r.js/build/tests/override/override.js +36 -0
- data/templates/app_root/scripts/r.js/build/tests/packages.build.js +59 -0
- data/templates/app_root/scripts/r.js/build/tests/parse.js +103 -0
- data/templates/app_root/scripts/r.js/build/tests/simple.build.js +13 -0
- data/templates/app_root/scripts/r.js/build/tests/simpleNamespace.build.js +17 -0
- data/templates/app_root/scripts/r.js/build/tests/start.frag +4 -0
- data/templates/app_root/scripts/r.js/build/tests/text.build.js +16 -0
- data/templates/app_root/scripts/r.js/build/tests/textExclude.build.js +16 -0
- data/templates/app_root/scripts/r.js/dist.js +95 -0
- data/templates/app_root/scripts/r.js/dist/README.md +6 -0
- data/templates/app_root/scripts/r.js/dist/r-1.0.0.js +9042 -0
- data/templates/app_root/scripts/r.js/dist/r-edge.js +9191 -0
- data/templates/app_root/scripts/r.js/dist/r.js +9099 -0
- data/templates/app_root/scripts/r.js/lib/closure/COPYING +202 -0
- data/templates/app_root/scripts/r.js/lib/closure/README +292 -0
- data/templates/app_root/scripts/r.js/lib/closure/compiler.jar +0 -0
- data/templates/app_root/scripts/r.js/lib/rhino/LICENSE +4 -0
- data/templates/app_root/scripts/r.js/lib/rhino/js.jar +0 -0
- data/templates/app_root/scripts/r.js/require.js +1952 -0
- data/templates/app_root/scripts/r.js/tasks.txt +2 -0
- data/templates/app_root/scripts/r.js/tests/all.js +49 -0
- data/templates/app_root/scripts/r.js/tests/allNode.js +3 -0
- data/templates/app_root/scripts/r.js/tests/allj.sh +1 -0
- data/templates/app_root/scripts/r.js/tests/alln.sh +2 -0
- data/templates/app_root/scripts/r.js/tests/alpha.js +3 -0
- data/templates/app_root/scripts/r.js/tests/beta.js +6 -0
- data/templates/app_root/scripts/r.js/tests/doh/LICENSE +195 -0
- data/templates/app_root/scripts/r.js/tests/doh/README +12 -0
- data/templates/app_root/scripts/r.js/tests/doh/_browserRunner.js +855 -0
- data/templates/app_root/scripts/r.js/tests/doh/_nodeRunner.js +20 -0
- data/templates/app_root/scripts/r.js/tests/doh/_rhinoRunner.js +17 -0
- data/templates/app_root/scripts/r.js/tests/doh/_sounds/LICENSE +10 -0
- data/templates/app_root/scripts/r.js/tests/doh/_sounds/doh.wav +0 -0
- data/templates/app_root/scripts/r.js/tests/doh/_sounds/dohaaa.wav +0 -0
- data/templates/app_root/scripts/r.js/tests/doh/_sounds/woohoo.wav +0 -0
- data/templates/app_root/scripts/r.js/tests/doh/runner.html +316 -0
- data/templates/app_root/scripts/r.js/tests/doh/runner.js +1499 -0
- data/templates/app_root/scripts/r.js/tests/doh/runner.sh +3 -0
- data/templates/app_root/scripts/r.js/tests/doh/small_logo.png +0 -0
- data/templates/app_root/scripts/r.js/tests/node/canvasTest.js +39 -0
- data/templates/app_root/scripts/r.js/tests/node/embedded/README.md +15 -0
- data/templates/app_root/scripts/r.js/tests/node/embedded/coffee/foo.coffee +1 -0
- data/templates/app_root/scripts/r.js/tests/node/embedded/main.js +13 -0
- data/templates/app_root/scripts/r.js/tests/node/embedded/scripts/bar.js +13 -0
- data/templates/app_root/scripts/r.js/tests/node/index.js +11 -0
- data/templates/app_root/scripts/r.js/tests/node/tests/alpha/foo.js +6 -0
- data/templates/app_root/scripts/r.js/tests/node/tests/alpha/hello.html +9 -0
- data/templates/app_root/scripts/r.js/tests/node/tests/foo.js +3 -0
- data/templates/app_root/scripts/r.js/tests/node/tests/server.js +11 -0
- data/templates/app_root/scripts/r.js/tests/relative.js +10 -0
- data/templates/app_root/scripts/r.js/tests/sub/betaSub.js +3 -0
- data/templates/application.js +6 -5
- data/templates/boot.js +42 -0
- data/templates/helper.js +9 -0
- data/templates/index.html +1 -1
- metadata +201 -11
- data/dist/jazz/main.js +0 -65
- data/dist/mustache/mustache.js +0 -324
- data/templates/app_root/config/routes.js +0 -4
- data/templates/glue.js +0 -4
@@ -0,0 +1,177 @@
|
|
1
|
+
# r.js
|
2
|
+
|
3
|
+
A command line tool for running JavaScript scripts that use the
|
4
|
+
[Asychronous Module Defintion API (AMD)](http://wiki.commonjs.org/wiki/Modules/AsynchronousDefinition)
|
5
|
+
for declaring and using JavaScript modules and regular JavaScript script files.
|
6
|
+
|
7
|
+
It is part of the [RequireJS project](http://requirejs.org), and works will with
|
8
|
+
the RequireJS implementation of AMD.
|
9
|
+
|
10
|
+
r.js is a single script that has two major functions:
|
11
|
+
|
12
|
+
* Run AMD-based projects in Node and Rhino.
|
13
|
+
* Includes the RequireJS Optimizer that combines scripts for optimal browser
|
14
|
+
delivery.
|
15
|
+
|
16
|
+
Releases of r.js are kept in the **dist** directory. To build your own from
|
17
|
+
the files in this repo, run:
|
18
|
+
|
19
|
+
node dist.js
|
20
|
+
|
21
|
+
That will generate an r.js file in the same directory as dist.js
|
22
|
+
|
23
|
+
|
24
|
+
# Running AMD-based projects
|
25
|
+
|
26
|
+
If your JS project's main application file is called main.js, then do
|
27
|
+
the following:
|
28
|
+
|
29
|
+
## Node
|
30
|
+
|
31
|
+
node path/to/r.js main.js
|
32
|
+
|
33
|
+
Requires Node 0.4 or later.
|
34
|
+
|
35
|
+
r.js allows using Node modules installed via npm. For more info see the
|
36
|
+
[Use with Node](http://requirejs.org/docs/node.html) docs.
|
37
|
+
|
38
|
+
## Java
|
39
|
+
|
40
|
+
Java requires some JAR files in the CLASSPATH for it to work:
|
41
|
+
|
42
|
+
* [rhino.jar](https://github.com/jrburke/r.js/blob/master/lib/rhino/js.jar?raw=true) from the [Rhino project](http://www.mozilla.org/rhino/).
|
43
|
+
* [compiler.jar](https://github.com/jrburke/r.js/blob/master/lib/closure/compiler.jar?raw=true) if you are using the optimizer and want to use
|
44
|
+
[Closure Compiler](http://code.google.com/closure/compiler/).
|
45
|
+
|
46
|
+
Download those files to your machine. To run r.js, you can use this type of
|
47
|
+
command:
|
48
|
+
|
49
|
+
### OS X/Linux/Unix:
|
50
|
+
|
51
|
+
java -classpath path/to/rhino/js.jar:path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js main.js
|
52
|
+
|
53
|
+
### Windows
|
54
|
+
|
55
|
+
java -classpath path/to/rhino/js.jar;path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js main.js
|
56
|
+
|
57
|
+
If you want to run it in the debugger, replace
|
58
|
+
org.mozilla.javascript.tools.shell.Main with
|
59
|
+
**org.mozilla.javascript.tools.debugger.Main**.
|
60
|
+
|
61
|
+
All further examples will use the Node notation, but substitute **node r.js** in the commands with the appropriate java command.
|
62
|
+
|
63
|
+
# Optimizer
|
64
|
+
|
65
|
+
The optimizer can be run by passing the **-o** command to r.js:
|
66
|
+
|
67
|
+
node r.js -o path/to/buildconfig.js
|
68
|
+
|
69
|
+
See the [Optimization doc](http://requirejs.org/docs/optimization.html) for more
|
70
|
+
information on the optimizer.
|
71
|
+
|
72
|
+
If running in **Java**, be sure to grab the Rhino and Closure Compiler jar files in the lib/ directory, then run this command:
|
73
|
+
|
74
|
+
### OS X/Linux/Unix:
|
75
|
+
|
76
|
+
java -classpath path/to/rhino/js.jar:path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js -o path/to/buildconfig.js
|
77
|
+
|
78
|
+
### Windows
|
79
|
+
|
80
|
+
java -classpath path/to/rhino/js.jar;path/to/closure/compiler.jar org.mozilla.javascript.tools.shell.Main r.js -o path/to/buildconfig.js
|
81
|
+
|
82
|
+
|
83
|
+
## What makes it special
|
84
|
+
|
85
|
+
The optimizer is better than using a plain concatenation script because it runs
|
86
|
+
require.js as part of the optimization, so it knows how to:
|
87
|
+
|
88
|
+
* Use [Loader Plugins](http://requirejs.org/docs/plugins.html) to load non-script
|
89
|
+
dependencies and inline them in built files.
|
90
|
+
* [Name anonymous modules](http://requirejs.org/docs/api.html#modulename).
|
91
|
+
If your optimization step does not do this, and you use anonymous modules, you
|
92
|
+
will get errors running the built code.
|
93
|
+
|
94
|
+
# Other r.js commands
|
95
|
+
|
96
|
+
## Get Version
|
97
|
+
|
98
|
+
To get the version of r.js and the version of require.js used by r.js:
|
99
|
+
|
100
|
+
node r.js -v
|
101
|
+
|
102
|
+
## Convert CommonJS modules
|
103
|
+
|
104
|
+
To convert a directory of CommonJS modules to ones that have define() wrappers:
|
105
|
+
|
106
|
+
node r.js -convert path/to/commonjs/dir output/dir
|
107
|
+
|
108
|
+
Most, but not all, CommonJS modules can be converted to define()-wrapped modules
|
109
|
+
and still work.
|
110
|
+
|
111
|
+
However, there are some modules that may fail if:
|
112
|
+
|
113
|
+
* They use code branches like if/else or try/catch to call require(). There are
|
114
|
+
problems supporting this kind of dynamic module calls in an async environment.
|
115
|
+
* Some kinds of circular dependencies will not work right. The kinds that fail
|
116
|
+
are normally very brittle and depend on the execution order of the dependent
|
117
|
+
modules.
|
118
|
+
|
119
|
+
# Directory layout
|
120
|
+
|
121
|
+
**NOTE**: If you clone this repository, it **must** be a sibling to a clone of the
|
122
|
+
[RequireJS repository](https://github.com/jrburke/requirejs), where that
|
123
|
+
repository is called **requirejs**. Otherwise the tests will not run.
|
124
|
+
|
125
|
+
* **dist.js**: the script that builds r.js
|
126
|
+
* **require.js**: the version of require.js to include in r.js
|
127
|
+
* **dist** the directory containing releases of r.js
|
128
|
+
* **build**: The files that make up the optimizer. dist.js includes a list of
|
129
|
+
the files from this directory to build into r.js.
|
130
|
+
* **lib**: The Java libraries for Rhino and Closure Compiler. Only needed if using
|
131
|
+
Java/Rhino to run r.js
|
132
|
+
* **tests**: command line tests. Run it under Node and Rhino by doing ../r.js all.js
|
133
|
+
|
134
|
+
dist.js takes the build/jslib/x.js file and injects the require.js files and other
|
135
|
+
files from the build/jslib directory into it.
|
136
|
+
|
137
|
+
If you make changes to any of those files, you will need to run **node dist.js**
|
138
|
+
to generate a new r.js. Be sure to run it through the tests , using both Node
|
139
|
+
and Java/Rhino:
|
140
|
+
|
141
|
+
* node dist.js
|
142
|
+
* cd tests
|
143
|
+
* node ../r.js all.js
|
144
|
+
* java -classpath ../lib/rhino/js.jar:../lib/closure/compiler.jar org.mozilla.javascript.tools.shell.Main ./r.js all.js
|
145
|
+
* cd ../build/tests
|
146
|
+
* node ../../r.js all.js
|
147
|
+
* java -classpath ../../lib/rhino/js.jar:../../lib/closure/compiler.jar org.mozilla.javascript.tools.shell.Main ../../r.js all.js
|
148
|
+
|
149
|
+
# Contributing code changes
|
150
|
+
|
151
|
+
See the [RequireJS Contributing](http://requirejs.org/docs/contributing.html)
|
152
|
+
page for info on how to contribute code/bug fixes to this project.
|
153
|
+
|
154
|
+
Use GitHub pull requests to point to code changes, although for larger changes,
|
155
|
+
contact the [requirejs mailing list](http://groups.google.com/group/requirejs)
|
156
|
+
to discuss them first.
|
157
|
+
|
158
|
+
# Doing a release
|
159
|
+
|
160
|
+
To do a release of version 0.0.0:
|
161
|
+
|
162
|
+
* git checkout -b 0.0.0
|
163
|
+
* Make sure the right version of require.js is in the project.
|
164
|
+
* Modify build/jslib/x.js to update the r.js version number in two places.
|
165
|
+
* node dist.js
|
166
|
+
* Run the tests (see above). They should pass. :)
|
167
|
+
* mv r.js dist/r-0.0.0.js
|
168
|
+
* git add dist/r-0.0.0.js
|
169
|
+
* git commit -a -m "Release 0.0.0"
|
170
|
+
* git tag -am "Release 0.0.0" 0.0.0
|
171
|
+
* git checkout master
|
172
|
+
* git merge 0.0.0
|
173
|
+
* git push origin master
|
174
|
+
* git push --tags
|
175
|
+
* git branch -d 0.0.0
|
176
|
+
|
177
|
+
Update the RequireJS download site to point to the latest release.
|
@@ -0,0 +1,26 @@
|
|
1
|
+
/**
|
2
|
+
* @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
|
3
|
+
* Available via the MIT or new BSD license.
|
4
|
+
* see: http://github.com/jrburke/requirejs for details
|
5
|
+
*/
|
6
|
+
|
7
|
+
/*
|
8
|
+
* Create a build.js file that has the build options you want and pass that
|
9
|
+
* build file to this file to do the build. See example.build.js for more information.
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*jslint strict: false, nomen: false */
|
13
|
+
/*global require: false */
|
14
|
+
|
15
|
+
require({
|
16
|
+
baseUrl: require.s.contexts._.config.baseUrl,
|
17
|
+
//Use a separate context than the default context so that the
|
18
|
+
//build can use the default context.
|
19
|
+
context: 'build',
|
20
|
+
catchError: {
|
21
|
+
define: true
|
22
|
+
}
|
23
|
+
}, ['env!env/args', 'build'],
|
24
|
+
function (args, build) {
|
25
|
+
build(args);
|
26
|
+
});
|
@@ -0,0 +1,296 @@
|
|
1
|
+
/*
|
2
|
+
* This is an example build file that demonstrates how to use the build system for
|
3
|
+
* require.js.
|
4
|
+
*
|
5
|
+
* THIS BUILD FILE WILL NOT WORK. It is referencing paths that probably
|
6
|
+
* do not exist on your machine. Just use it as a guide.
|
7
|
+
*
|
8
|
+
*
|
9
|
+
*/
|
10
|
+
|
11
|
+
({
|
12
|
+
//The top level directory that contains your app. If this option is used
|
13
|
+
//then it assumed your scripts are in a subdirectory under this path.
|
14
|
+
//This option is not required. If it is not specified, then baseUrl
|
15
|
+
//below is the anchor point for finding things. If this option is specified,
|
16
|
+
//then all the files from the app directory will be copied to the dir:
|
17
|
+
//output area, and baseUrl will assume to be a relative path under
|
18
|
+
//this directory.
|
19
|
+
appDir: "some/path/",
|
20
|
+
|
21
|
+
//By default, all modules are located relative to this path. If baseUrl
|
22
|
+
//is not explicitly set, then all modules are loaded relative to
|
23
|
+
//the directory that holds the build file. If appDir is set, then
|
24
|
+
//baseUrl should be specified as relative to the appDir.
|
25
|
+
baseUrl: "./",
|
26
|
+
|
27
|
+
//Set paths for modules. If relative paths, set relative to baseUrl above.
|
28
|
+
//If a special value of "empty:" is used for the path value, then that
|
29
|
+
//acts like mapping the path to an empty file. It allows the optimizer to
|
30
|
+
//resolve the dependency to path, but then does not include it in the output.
|
31
|
+
//Useful to map module names that are to resources on a CDN or other
|
32
|
+
//http: URL when running in the browser and during an optimization that
|
33
|
+
//file should be skipped because it has no dependencies.
|
34
|
+
paths: {
|
35
|
+
"foo.bar": "../scripts/foo/bar",
|
36
|
+
"baz": "../another/path/baz"
|
37
|
+
},
|
38
|
+
|
39
|
+
//Configure CommonJS packages. See http://requirejs.org/docs/api.html#packages
|
40
|
+
//for more information.
|
41
|
+
packagePaths: [],
|
42
|
+
packages: [],
|
43
|
+
|
44
|
+
//The directory path to save the output. If not specified, then
|
45
|
+
//the path will default to be a directory called "build" as a sibling
|
46
|
+
//to the build file. All relative paths are relative to the build file.
|
47
|
+
dir: "../some/path",
|
48
|
+
|
49
|
+
//Used to inline i18n resources into the built file. If no locale
|
50
|
+
//is specified, i18n resources will not be inlined. Only one locale
|
51
|
+
//can be inlined for a build. Root bundles referenced by a build layer
|
52
|
+
//will be included in a build layer regardless of locale being set.
|
53
|
+
locale: "en-us",
|
54
|
+
|
55
|
+
//How to optimize all the JS files in the build output directory.
|
56
|
+
//Right now only the following values
|
57
|
+
//are supported:
|
58
|
+
//- "uglify": (default) uses UglifyJS to minify the code.
|
59
|
+
//- "closure": uses Google's Closure Compiler in simple optimization
|
60
|
+
//mode to minify the code. Only available if running the optimizer using
|
61
|
+
//Java.
|
62
|
+
//- "closure.keepLines": Same as closure option, but keeps line returns
|
63
|
+
//in the minified files.
|
64
|
+
//- "none": no minification will be done.
|
65
|
+
optimize: "uglify",
|
66
|
+
|
67
|
+
//If using UglifyJS for script optimization, these config options can be
|
68
|
+
//used to pass configuration values to UglifyJS.
|
69
|
+
//See https://github.com/mishoo/UglifyJS for the possible values.
|
70
|
+
uglify: {
|
71
|
+
gen_codeOptions: {},
|
72
|
+
strict_semicolons: {},
|
73
|
+
do_toplevel: {},
|
74
|
+
ast_squeezeOptions: {}
|
75
|
+
},
|
76
|
+
|
77
|
+
//If using Closure Compiler for script optimization, these config options
|
78
|
+
//can be used to configure Closure Compiler. See the documentation for
|
79
|
+
//Closure compiler for more information.
|
80
|
+
closure: {
|
81
|
+
CompilerOptions: {},
|
82
|
+
CompilationLevel: 'SIMPLE_OPTIMIZATIONS',
|
83
|
+
loggingLevel: 'WARNING'
|
84
|
+
}
|
85
|
+
|
86
|
+
//Allow CSS optimizations. Allowed values:
|
87
|
+
//- "standard": @import inlining, comment removal and line returns.
|
88
|
+
//Removing line returns may have problems in IE, depending on the type
|
89
|
+
//of CSS.
|
90
|
+
//- "standard.keepLines": like "standard" but keeps line returns.
|
91
|
+
//- "none": skip CSS optimizations.
|
92
|
+
optimizeCss: "standard.keepLines",
|
93
|
+
|
94
|
+
//If optimizeCss is in use, a list of of files to ignore for the @import
|
95
|
+
//inlining. The value of this option should be a comma separated list
|
96
|
+
//of CSS file names to ignore. The file names should match whatever
|
97
|
+
//strings are used in the @import calls.
|
98
|
+
cssImportIgnore: null,
|
99
|
+
|
100
|
+
//Inlines the text for any text! dependencies, to avoid the separate
|
101
|
+
//async XMLHttpRequest calls to load those dependencies.
|
102
|
+
inlineText: true,
|
103
|
+
|
104
|
+
//Allow "use strict"; be included in the RequireJS files.
|
105
|
+
//Default is false because there are not many browsers that can properly
|
106
|
+
//process and give errors on code for ES5 strict mode,
|
107
|
+
//and there is a lot of legacy code that will not work in strict mode.
|
108
|
+
useStrict: false,
|
109
|
+
|
110
|
+
//Specify build pragmas. If the source files contain comments like so:
|
111
|
+
//>>excludeStart("fooExclude", pragmas.fooExclude);
|
112
|
+
//>>excludeEnd("fooExclude");
|
113
|
+
//Then the comments that start with //>> are the build pragmas.
|
114
|
+
//excludeStart/excludeEnd and includeStart/includeEnd work, and the
|
115
|
+
//the pragmas value to the includeStart or excludeStart lines
|
116
|
+
//is evaluated to see if the code between the Start and End pragma
|
117
|
+
//lines should be included or excluded. If you have a choice to use
|
118
|
+
//"has" code or pragmas, use "has" code instead. Pragmas are harder
|
119
|
+
//to read, but they can be a bit more flexible on code removal vs.
|
120
|
+
//has-based code, which must follow JavaScript language rules.
|
121
|
+
//Pragmas also remove code in non-minified source, where has branch
|
122
|
+
//trimming is only done if the code is minified via UglifyJS or
|
123
|
+
//Closure Compiler.
|
124
|
+
pragmas: {
|
125
|
+
fooExclude: true
|
126
|
+
},
|
127
|
+
|
128
|
+
//Same as "pragmas", but only applied once during the file save phase
|
129
|
+
//of an optimization. "pragmas" are applied both during the dependency
|
130
|
+
//mapping and file saving phases on an optimization. Some pragmas
|
131
|
+
//should not be processed during the dependency mapping phase of an
|
132
|
+
//operation, such as the pragma in the CoffeeScript loader plugin,
|
133
|
+
//which wants the CoffeeScript compiler during the dependency mapping
|
134
|
+
//phase, but once files are saved as plain JavaScript, the CoffeeScript
|
135
|
+
//compiler is no longer needed. In that case, pragmasOnSave would be used
|
136
|
+
//to exclude the compiler code during the save phase.
|
137
|
+
pragmasOnSave: {
|
138
|
+
//Just an example
|
139
|
+
excludeCoffeeScript: true
|
140
|
+
},
|
141
|
+
|
142
|
+
//Allows trimming of code branches that use has.js-based feature detection:
|
143
|
+
//https://github.com/phiggins42/has.js
|
144
|
+
//The code branch trimming only happens if minification with UglifyJS or
|
145
|
+
//Closure Compiler is done. For more information, see:
|
146
|
+
//http://requirejs.org/docs/optimization.html#hasjs
|
147
|
+
has: {
|
148
|
+
'function-bind': true,
|
149
|
+
'string-trim': false
|
150
|
+
},
|
151
|
+
|
152
|
+
//Similar to pragmasOnSave, but for has tests -- only applied during the
|
153
|
+
//file save phase of optimization, where "has" is applied to both
|
154
|
+
//dependency mapping and file save phases.
|
155
|
+
hasOnSave: {
|
156
|
+
'function-bind': true,
|
157
|
+
'string-trim': false
|
158
|
+
},
|
159
|
+
|
160
|
+
//Allows namespacing requirejs, require and define calls to a new name.
|
161
|
+
//This allows stronger assurances of getting a module space that will
|
162
|
+
//not interfere with others using a define/require AMD-based module
|
163
|
+
//system. The example below will rename define() calls to foo.define().
|
164
|
+
//See http://requirejs.org/docs/faq-advanced.html#rename for a more
|
165
|
+
//complete example.
|
166
|
+
namespace: 'foo',
|
167
|
+
|
168
|
+
//Skip processing for pragmas.
|
169
|
+
skipPragmas: false,
|
170
|
+
|
171
|
+
//If skipModuleInsertion is false, then files that do not use define()
|
172
|
+
//to define modules will get a define() placeholder inserted for them.
|
173
|
+
//Also, require.pause/resume calls will be inserted.
|
174
|
+
//Set it to true to avoid this. This is useful if you are building code that
|
175
|
+
//does not use require() in the built project or in the JS files, but you
|
176
|
+
//still want to use the optimization tool from RequireJS to concatenate modules
|
177
|
+
//together.
|
178
|
+
skipModuleInsertion: false,
|
179
|
+
|
180
|
+
//If it is not a one file optimization, scan through all .js files in the
|
181
|
+
//output directory for any plugin resource dependencies, and if the plugin
|
182
|
+
//supports optimizing them as separate files, optimize them. Can be a
|
183
|
+
//slower optimization. Only use if there are some plugins that use things
|
184
|
+
//like XMLHttpRequest that do not work across domains, but the built code
|
185
|
+
//will be placed on another domain.
|
186
|
+
optimizeAllPluginResources: false,
|
187
|
+
|
188
|
+
//Finds require() dependencies inside a require() or define call. By default
|
189
|
+
//this value is false, because those resources should be considered dynamic/runtime
|
190
|
+
//calls. However, for some optimization scenarios,
|
191
|
+
//Introduced in 1.0.3. Previous versions incorrectly found the nested calls
|
192
|
+
//by default.
|
193
|
+
findNestedDependencies: false,
|
194
|
+
|
195
|
+
//List the modules that will be optimized. All their immediate and deep
|
196
|
+
//dependencies will be included in the module's file when the build is
|
197
|
+
//done. If that module or any of its dependencies includes i18n bundles,
|
198
|
+
//only the root bundles will be included unless the locale: section is set above.
|
199
|
+
modules: [
|
200
|
+
//Just specifying a module name means that module will be converted into
|
201
|
+
//a built file that contains all of its dependencies. If that module or any
|
202
|
+
//of its dependencies includes i18n bundles, they may not be included in the
|
203
|
+
//built file unless the locale: section is set above.
|
204
|
+
{
|
205
|
+
name: "foo/bar/bop",
|
206
|
+
|
207
|
+
//For build profiles that contain more than one modules entry,
|
208
|
+
//allow overrides for the properties that set for the whole build,
|
209
|
+
//for example a different set of pragmas for this module.
|
210
|
+
//The override's value is an object that can
|
211
|
+
//contain any of the other build options in this file.
|
212
|
+
override: {
|
213
|
+
pragmas: {
|
214
|
+
fooExclude: true
|
215
|
+
}
|
216
|
+
}
|
217
|
+
},
|
218
|
+
|
219
|
+
//This module entry combines all the dependencies of foo/bar/bop and foo/bar/bee
|
220
|
+
//and any of their dependencies into one file.
|
221
|
+
{
|
222
|
+
name: "foo/bar/bop",
|
223
|
+
include: ["foo/bar/bee"]
|
224
|
+
},
|
225
|
+
|
226
|
+
//This module entry combines all the dependencies of foo/bar/bip into one file,
|
227
|
+
//but excludes foo/bar/bop and its dependencies from the built file. If you want
|
228
|
+
//to exclude a module that is also another module being optimized, it is more
|
229
|
+
//efficient if you define that module optimization entry before using it
|
230
|
+
//in an exclude array.
|
231
|
+
{
|
232
|
+
name: "foo/bar/bip",
|
233
|
+
exclude: [
|
234
|
+
"foo/bar/bop"
|
235
|
+
]
|
236
|
+
},
|
237
|
+
|
238
|
+
//This module entry shows how to specify a specific module be excluded
|
239
|
+
//from the built module file. excludeShallow means just exclude that
|
240
|
+
//specific module, but if that module has nested dependencies that are
|
241
|
+
//part of the built file, keep them in there. This is useful during
|
242
|
+
//development when you want to have a fast bundled set of modules, but
|
243
|
+
//just develop/debug one or two modules at a time.
|
244
|
+
{
|
245
|
+
name: "foo/bar/bin",
|
246
|
+
excludeShallow: [
|
247
|
+
"foo/bar/bot"
|
248
|
+
]
|
249
|
+
}
|
250
|
+
],
|
251
|
+
|
252
|
+
//Wrap any build layer in a start and end text specified by wrap.
|
253
|
+
//Use this to encapsulate the module code so that define/require are
|
254
|
+
//not globals. The end text can expose some globals from your file,
|
255
|
+
//making it easy to create stand-alone libraries that do not mandate
|
256
|
+
//the end user use requirejs.
|
257
|
+
wrap: {
|
258
|
+
start: "(function() {",
|
259
|
+
end: "}());"
|
260
|
+
},
|
261
|
+
|
262
|
+
//Another way to use wrap, but uses default wrapping of:
|
263
|
+
//(function() { + content + }());
|
264
|
+
wrap: true,
|
265
|
+
|
266
|
+
//Another way to use wrap, but uses file paths. This makes it easier
|
267
|
+
//to have the start text contain license information and the end text
|
268
|
+
//to contain the global variable exports, like
|
269
|
+
//window.myGlobal = requirejs('myModule');
|
270
|
+
//File paths are relative to the build file, or if running a commmand
|
271
|
+
//line build, the current directory.
|
272
|
+
wrap: {
|
273
|
+
startFile: "part/start.frag",
|
274
|
+
endFile: "parts/end.frag"
|
275
|
+
},
|
276
|
+
|
277
|
+
//When the optimizer copies files from the source location to the
|
278
|
+
//destination directory, it will skip directories and files that start
|
279
|
+
//with a ".". If you want to copy .directories or certain .files, for
|
280
|
+
//instance if you keep some packages in a .packages directory, or copy
|
281
|
+
//over .htaccess files, you can set this to null. If you want to change
|
282
|
+
//the exclusion rules, change it to a different regexp. If the regexp
|
283
|
+
//matches, it means the directory will be excluded. This used to be
|
284
|
+
//called dirExclusionRegExp before the 1.0.2 release.
|
285
|
+
//As of 1.0.3, this value can also be a string that is converted to a
|
286
|
+
//RegExp via new RegExp().
|
287
|
+
fileExclusionRegExp: /^\./,
|
288
|
+
|
289
|
+
//By default, comments that have a license in them are preserved in the
|
290
|
+
//output. However, for a larger built files there could be a lot of
|
291
|
+
//comment files that may be better served by having a smaller comment
|
292
|
+
//at the top of the file that points to the list of all the licenses.
|
293
|
+
//This option will turn off the auto-preservation, but you will need
|
294
|
+
//work out how best to surface the license information.
|
295
|
+
preserveLicenseComments: true
|
296
|
+
})
|