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,29 @@
|
|
1
|
+
define(['converter'], function (converter) {
|
2
|
+
var buildMap = {};
|
3
|
+
|
4
|
+
function jsEscape(content) {
|
5
|
+
return content.replace(/(['\\])/g, '\\$1')
|
6
|
+
.replace(/[\f]/g, "\\f")
|
7
|
+
.replace(/[\b]/g, "\\b")
|
8
|
+
.replace(/[\n]/g, "\\n")
|
9
|
+
.replace(/[\t]/g, "\\t")
|
10
|
+
.replace(/[\r]/g, "\\r");
|
11
|
+
}
|
12
|
+
|
13
|
+
return {
|
14
|
+
version: '1',
|
15
|
+
load: function (name, require, onLoad, config) {
|
16
|
+
var converted = converter.convert(name);
|
17
|
+
buildMap[name] = converted;
|
18
|
+
onLoad(converted);
|
19
|
+
},
|
20
|
+
|
21
|
+
write: function (pluginName, moduleName, write, config) {
|
22
|
+
if (moduleName in buildMap) {
|
23
|
+
var content = jsEscape(buildMap[moduleName]);
|
24
|
+
write("define('" + pluginName + "!" + moduleName +
|
25
|
+
"', function () { return '" + content + "';});\n");
|
26
|
+
}
|
27
|
+
}
|
28
|
+
};
|
29
|
+
});
|
@@ -0,0 +1,10 @@
|
|
1
|
+
//A simple build file using the tests directory for requirejs
|
2
|
+
{
|
3
|
+
baseUrl: "../../../requirejs/tests/plugins",
|
4
|
+
paths: {
|
5
|
+
nameOnly: "../../../requirejs/tests/plugins/nameOnly"
|
6
|
+
},
|
7
|
+
out: "builds/tests-nameOnly.js",
|
8
|
+
name: "nameOnly-tests",
|
9
|
+
optimize: "none"
|
10
|
+
}
|
@@ -0,0 +1,12 @@
|
|
1
|
+
var requirejs = require('../../r.js');
|
2
|
+
|
3
|
+
//Try an optimization pass.
|
4
|
+
requirejs.optimize({
|
5
|
+
baseUrl: '../../../requirejs/tests',
|
6
|
+
name: 'one',
|
7
|
+
include: 'dimple',
|
8
|
+
out: 'builds/outSingleOpt.js',
|
9
|
+
optimize: 'none'
|
10
|
+
}, function (resultText) {
|
11
|
+
console.log('requirejs.optimize:\n===================\n' + resultText);
|
12
|
+
});
|
@@ -0,0 +1,16 @@
|
|
1
|
+
//A simple build file using the tests directory for requirejs
|
2
|
+
{
|
3
|
+
baseUrl: "../../../requirejs/tests/order",
|
4
|
+
dir: "builds/order",
|
5
|
+
optimize: "none",
|
6
|
+
|
7
|
+
paths: {
|
8
|
+
"order": "../../order"
|
9
|
+
},
|
10
|
+
|
11
|
+
modules: [
|
12
|
+
{
|
13
|
+
name: "foo",
|
14
|
+
}
|
15
|
+
]
|
16
|
+
}
|
@@ -0,0 +1,36 @@
|
|
1
|
+
/**
|
2
|
+
* Sample showing how you might override one of the core modules used inside
|
3
|
+
* requirejs for a build.
|
4
|
+
*
|
5
|
+
* To get this example to work:
|
6
|
+
*
|
7
|
+
* npm install uglify-js
|
8
|
+
*/
|
9
|
+
|
10
|
+
/*jslint strict: false */
|
11
|
+
/*global require: false */
|
12
|
+
|
13
|
+
var uglify = require('uglify-js'),
|
14
|
+
requirejs = require('../../../r.js');
|
15
|
+
|
16
|
+
//Register the replacement module. Note that for uglifyjs, r.js uses the
|
17
|
+
//"uglifyjs/index" module name for it. The list of replaceable modules
|
18
|
+
//can be found in r.js/
|
19
|
+
requirejs.define('uglifyjs/index', [], function () {
|
20
|
+
return uglify;
|
21
|
+
});
|
22
|
+
|
23
|
+
//Do the build.
|
24
|
+
requirejs.optimize({
|
25
|
+
baseUrl: "../../../../requirejs/tests",
|
26
|
+
name: "one",
|
27
|
+
include: "dimple",
|
28
|
+
out: "one-built.js",
|
29
|
+
//Usually requirejs.optimize() runs in "silent mode"
|
30
|
+
//when called in this way. Use logLevel to get the
|
31
|
+
//normal output out.
|
32
|
+
logLevel: 0
|
33
|
+
}, function () {
|
34
|
+
//Do not really care about the build output summary,
|
35
|
+
//since the logLevel: 0 will show it anyway in the console.
|
36
|
+
});
|
@@ -0,0 +1,59 @@
|
|
1
|
+
({
|
2
|
+
baseUrl: "../../../requirejs/tests/packages/",
|
3
|
+
dir: "builds/packages",
|
4
|
+
optimize: "none",
|
5
|
+
|
6
|
+
paths: {
|
7
|
+
'alpha/replace' : 'replace'
|
8
|
+
},
|
9
|
+
packagePaths: {
|
10
|
+
'pkgs': [
|
11
|
+
'alpha',
|
12
|
+
{
|
13
|
+
name: 'beta',
|
14
|
+
location: 'beta/0.2',
|
15
|
+
lib: 'scripts',
|
16
|
+
main: 'scripts/beta'
|
17
|
+
},
|
18
|
+
'dojox/chair',
|
19
|
+
{
|
20
|
+
name: 'dojox/table',
|
21
|
+
lib: '.',
|
22
|
+
main: 'table'
|
23
|
+
}
|
24
|
+
]
|
25
|
+
},
|
26
|
+
packages: [
|
27
|
+
{
|
28
|
+
name: 'bar',
|
29
|
+
location: 'bar/0.4',
|
30
|
+
lib: 'scripts',
|
31
|
+
main: 'scripts/main'
|
32
|
+
},
|
33
|
+
{
|
34
|
+
name: 'foo',
|
35
|
+
location: 'foo'
|
36
|
+
},
|
37
|
+
{
|
38
|
+
name: 'funky',
|
39
|
+
main: 'index'
|
40
|
+
},
|
41
|
+
{
|
42
|
+
name: 'baz',
|
43
|
+
location: 'baz',
|
44
|
+
main: 'lib/index'
|
45
|
+
},
|
46
|
+
{
|
47
|
+
name: 'dojox/window',
|
48
|
+
location: 'dojox/window',
|
49
|
+
lib: '.',
|
50
|
+
main: 'window'
|
51
|
+
}
|
52
|
+
],
|
53
|
+
|
54
|
+
modules: [
|
55
|
+
{
|
56
|
+
name: "packages-tests"
|
57
|
+
}
|
58
|
+
]
|
59
|
+
})
|
@@ -0,0 +1,103 @@
|
|
1
|
+
/*jslint plusplus: false, strict: false */
|
2
|
+
/*global load: false, doh: false, define:false */
|
3
|
+
|
4
|
+
define(['parse'], function (parse) {
|
5
|
+
|
6
|
+
doh.register("parseRequire",
|
7
|
+
[
|
8
|
+
function parseRequire(t) {
|
9
|
+
var good1 = "require(['one', 'two'], function(){});",
|
10
|
+
good2 = "require({baseUrl: './'}, ['one', 'two']);",
|
11
|
+
good3 = "requirejs(['one', 'two'], function(){});",
|
12
|
+
good4 = "requirejs({baseUrl: './'}, ['one', 'two']);",
|
13
|
+
bad1 = "require([foo, 'me'], function() {});",
|
14
|
+
bad2 = "require({baseUrl: './'});";
|
15
|
+
|
16
|
+
t.is('define("good1",["one","two"]);', parse("good1", "good1", good1));
|
17
|
+
t.is('define("good2",["one","two"]);', parse("good2", "good2", good2));
|
18
|
+
t.is('define("good3",["one","two"]);', parse("good3", "good3", good3));
|
19
|
+
t.is('define("good4",["one","two"]);', parse("good4", "good4", good4));
|
20
|
+
t.is('define("bad1",["me"]);', parse("bad1", "bad1", bad1));
|
21
|
+
t.is(null, parse("bad2", "bad2", bad2));
|
22
|
+
}
|
23
|
+
]
|
24
|
+
);
|
25
|
+
doh.run();
|
26
|
+
|
27
|
+
doh.register('parseDefineCall',
|
28
|
+
[
|
29
|
+
function parseDefineCall(t) {
|
30
|
+
var good1 = "define('one', ['two', 'three'], function(){});",
|
31
|
+
good2 = "define('one', function(){});",
|
32
|
+
good3 = 'function baz(){ var foo = { bar: function() { define("one", ["two"], function(){}); } };}',
|
33
|
+
good4 = '(function (define) { define("one", function(){}); }(myGlobalDefine))',
|
34
|
+
nested1 = "(function () {\nvar foo = {\nbar: 'baz'\n}\n\n define('foo', [], foo); \n }());",
|
35
|
+
bad1 = "define('one', [foo, 'me'], function() {});",
|
36
|
+
bad2 = "define('one', somevar)",
|
37
|
+
bad3 = "function define(foo) { return foo };",
|
38
|
+
bad4 = "define(a[0]);",
|
39
|
+
goodAnon1 = "define(function(require){ var foo = require('foo'); });",
|
40
|
+
goodAnon2 = "define(function (require, exports, module) { if (true) { callback(function () { require(\"bar\"); })}});",
|
41
|
+
goodAnon3 = "define(function(require, exports, module) { exports.name = 'empty'; });",
|
42
|
+
good5 = "define(function (require) {\n" +
|
43
|
+
' return {\n' +
|
44
|
+
' getA: function () {\n' +
|
45
|
+
' return require("../index!0?./a:./b:./c");\n' +
|
46
|
+
' },\n' +
|
47
|
+
' getC: function () {\n' +
|
48
|
+
' return require("../index!2?./a:./b:./c");\n' +
|
49
|
+
' },\n' +
|
50
|
+
' getB: function () {\n' +
|
51
|
+
' return require("../index!1?./a:./b:./c");\n' +
|
52
|
+
' }\n' +
|
53
|
+
' };\n' +
|
54
|
+
'});\n',
|
55
|
+
good6 = 'function baz(){ var foo = { bar: function() { define("one", function(){ var two = require("two"); }); } };}',
|
56
|
+
good7 = "(function (factory){\nif(typeof define === 'function' && define.amd){\ndefine(['dep'], factory);\n}else{\nfactory(this.dep);\n}\n}(function(dep){\n}));",
|
57
|
+
good8 = "(function (factory){\nif(typeof define === 'function' && define.amd){\ndefine('some/name', ['dep1', 'dep2'], factory);\n}else{\nfactory(this.dep);\n}\n}(function(dep){\n}));",
|
58
|
+
good9 = "define(function (require) {\n//Dependencies with no usable return value.\nrequire('plugin!some/value');\n});",
|
59
|
+
emptyAnon1 = "define(function(){ return 'foo'; });";
|
60
|
+
|
61
|
+
t.is('define("one",["two","three"]);', parse("good1", "good1", good1));
|
62
|
+
t.is('define("one",[]);', parse("good2", "good2", good2));
|
63
|
+
t.is('define("one",["two"]);', parse("good3", "good3", good3));
|
64
|
+
t.is('define("one",[]);', parse("good4", "good4", good4));
|
65
|
+
t.is('define("good5",["require","../index!0?./a:./b:./c","../index!2?./a:./b:./c","../index!1?./a:./b:./c"]);', parse("good5", "good5", good5));
|
66
|
+
t.is('define("one",["two"]);', parse("good6", "good6", good6));
|
67
|
+
t.is('define("good7",["dep"]);', parse("good7", "good7", good7));
|
68
|
+
t.is('define("some/name",["dep1","dep2"]);', parse("good8", "good8", good8));
|
69
|
+
t.is('define("good9",["require","plugin!some/value"]);', parse("good9", "good9", good9));
|
70
|
+
t.is('define("foo",[]);', parse("nested1", "nested1", nested1));
|
71
|
+
t.is('define("one",["me"]);', parse("bad1", "bad1", bad1));
|
72
|
+
t.is(null, parse("bad2", "bad2", bad2));
|
73
|
+
t.is(null, parse("bad3", "bad3", bad3));
|
74
|
+
t.is(null, parse("bad4", "bad4", bad4));
|
75
|
+
|
76
|
+
t.is(['require', 'foo'], parse.getAnonDeps("goodAnon1", goodAnon1));
|
77
|
+
t.is(['require', 'exports', 'module', 'bar'], parse.getAnonDeps("goodAnon2", goodAnon2));
|
78
|
+
t.is(['require', 'exports', 'module'], parse.getAnonDeps("goodAnon3", goodAnon3));
|
79
|
+
t.is(['require', 'plugin!some/value'], parse.getAnonDeps("good9", good9));
|
80
|
+
t.is(0, parse.getAnonDeps("emptyAnon1", emptyAnon1).length);
|
81
|
+
}
|
82
|
+
]
|
83
|
+
);
|
84
|
+
doh.run();
|
85
|
+
|
86
|
+
doh.register('parseHasRequire',
|
87
|
+
[
|
88
|
+
function parseHasRequire(t) {
|
89
|
+
var good1 = "var require, define; (function(){ define = function(){}; define.amd = {};}());",
|
90
|
+
good2 = "var myGlobalRequire = (function () { var define = {}; (function(){ define = function(){}; define.amd = {};}()); }());",
|
91
|
+
bad1 = "var define; function boom(){ var define = function(){}; define.amd(); }",
|
92
|
+
bad2 = "(function(define) { define(); }(myvar));";
|
93
|
+
|
94
|
+
t.is(true, parse.definesRequire("good1", good1));
|
95
|
+
t.is(true, parse.definesRequire("good2", good2));
|
96
|
+
t.is(false, parse.definesRequire("bad1", bad1));
|
97
|
+
t.is(false, parse.definesRequire("bad2", bad2));
|
98
|
+
}
|
99
|
+
]
|
100
|
+
);
|
101
|
+
doh.run();
|
102
|
+
|
103
|
+
});
|
@@ -0,0 +1,17 @@
|
|
1
|
+
({
|
2
|
+
baseUrl: "../../../requirejs/tests",
|
3
|
+
optimize: "none",
|
4
|
+
//optimize: "uglify",
|
5
|
+
dir: "builds/simpleNamespace",
|
6
|
+
namespace: "NAMESPACE",
|
7
|
+
paths: {
|
8
|
+
requireLib: '../require'
|
9
|
+
},
|
10
|
+
modules: [
|
11
|
+
{
|
12
|
+
name: "NAMESPACE",
|
13
|
+
include: ["requireLib", "one", "dimple"],
|
14
|
+
create: true
|
15
|
+
}
|
16
|
+
]
|
17
|
+
})
|
@@ -0,0 +1,16 @@
|
|
1
|
+
//A simple build file using the tests directory for requirejs
|
2
|
+
{
|
3
|
+
baseUrl: "../../../requirejs/tests/text",
|
4
|
+
paths: {
|
5
|
+
text: "../../../requirejs/text"
|
6
|
+
},
|
7
|
+
dir: "builds/text",
|
8
|
+
optimize: "none",
|
9
|
+
optimizeAllPluginResources: true,
|
10
|
+
|
11
|
+
modules: [
|
12
|
+
{
|
13
|
+
name: "widget"
|
14
|
+
}
|
15
|
+
]
|
16
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
//A simple build file using the tests directory for requirejs
|
2
|
+
{
|
3
|
+
baseUrl: "../../../requirejs/tests/text",
|
4
|
+
paths: {
|
5
|
+
text: "../../../requirejs/text"
|
6
|
+
},
|
7
|
+
dir: "builds/textExclude",
|
8
|
+
optimize: "none",
|
9
|
+
|
10
|
+
modules: [
|
11
|
+
{
|
12
|
+
name: "widget",
|
13
|
+
exclude: ['text!subwidget2.html']
|
14
|
+
}
|
15
|
+
]
|
16
|
+
}
|
@@ -0,0 +1,95 @@
|
|
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
|
+
* This script will create the final r.js file used in node projects to use
|
9
|
+
* RequireJS.
|
10
|
+
*
|
11
|
+
* This file uses Node to run:
|
12
|
+
* node dist.js
|
13
|
+
*/
|
14
|
+
|
15
|
+
/*jslint strict: false */
|
16
|
+
/*global require: false, process: false, console: false */
|
17
|
+
|
18
|
+
|
19
|
+
var fs = require('fs'),
|
20
|
+
child_process = require('child_process'),
|
21
|
+
contents = fs.readFileSync('build/jslib/x.js', 'utf8'),
|
22
|
+
loadRegExp = /\/\/INSERT ([\w\/\.]+)/g,
|
23
|
+
moduleNameRegExp = /build\/jslib\/([\w\/\-]+)\.js$/,
|
24
|
+
defRegExp = /define\s*\(/,
|
25
|
+
envs = ['node', 'rhino'],
|
26
|
+
//Update this list of files by running the optimizer against
|
27
|
+
//build/jslib/opto.build.js,
|
28
|
+
//but then remove any jslib/node entries and make sure there is
|
29
|
+
//an env! entry for each one of them. Include
|
30
|
+
//build/jslib/commonjs.js in the list, but remove build/build.js
|
31
|
+
//since it is loaded separately.
|
32
|
+
libFiles = [
|
33
|
+
'build/jslib/env.js',
|
34
|
+
'env!env/args',
|
35
|
+
'env!env/load',
|
36
|
+
'env!env/file',
|
37
|
+
'build/jslib/lang.js',
|
38
|
+
'env!env/print',
|
39
|
+
'build/jslib/logger.js',
|
40
|
+
'build/jslib/blank.js',
|
41
|
+
'build/jslib/blank.js',
|
42
|
+
'build/jslib/uglifyjs/parse-js.js',
|
43
|
+
'build/jslib/uglifyjs/squeeze-more.js',
|
44
|
+
'build/jslib/uglifyjs/process.js',
|
45
|
+
'build/jslib/uglifyjs/index.js',
|
46
|
+
'build/jslib/parse.js',
|
47
|
+
'build/jslib/pragma.js',
|
48
|
+
'env!env/optimize',
|
49
|
+
'build/jslib/optimize.js',
|
50
|
+
'build/jslib/requirePatch.js',
|
51
|
+
'build/jslib/commonJs.js',
|
52
|
+
'build/jslib/build.js'
|
53
|
+
],
|
54
|
+
optimizerStartFile = 'build/build.js',
|
55
|
+
libText = '';
|
56
|
+
|
57
|
+
function readAndNameModule(fileName) {
|
58
|
+
var contents = fs.readFileSync(fileName, 'utf8'),
|
59
|
+
match = moduleNameRegExp.exec(fileName),
|
60
|
+
moduleName = (match && match[1]) || fileName;
|
61
|
+
|
62
|
+
//Insert the module name.
|
63
|
+
return contents.replace(defRegExp, function (match) {
|
64
|
+
return match + "'" + moduleName + "', ";
|
65
|
+
});
|
66
|
+
}
|
67
|
+
|
68
|
+
//Load up all the optimizer files.
|
69
|
+
libFiles.forEach(function (fileName) {
|
70
|
+
if (fileName.indexOf('env!') === 0) {
|
71
|
+
envs.forEach(function (env) {
|
72
|
+
libText += "\nif(env === '" + env + "') {\n" +
|
73
|
+
readAndNameModule(fileName.replace(/env!env\//, 'build/jslib/' + env + '/') + '.js') +
|
74
|
+
"\n}\n";
|
75
|
+
});
|
76
|
+
} else {
|
77
|
+
libText += readAndNameModule(fileName, 'utf8');
|
78
|
+
}
|
79
|
+
});
|
80
|
+
|
81
|
+
//Inline file contents
|
82
|
+
contents = contents.replace(loadRegExp, function (match, fileName) {
|
83
|
+
if (fileName === 'LIB') {
|
84
|
+
return libText;
|
85
|
+
} else {
|
86
|
+
var text = fs.readFileSync(fileName, 'utf8');
|
87
|
+
if (fileName.indexOf('require.js') !== -1) {
|
88
|
+
text = text.replace(/var requirejs, require\, define\;/, '');
|
89
|
+
}
|
90
|
+
return text;
|
91
|
+
}
|
92
|
+
});
|
93
|
+
|
94
|
+
//Set the isOpto flag to true
|
95
|
+
fs.writeFileSync('r.js', contents, 'utf8');
|