Permalink
Browse files

Merge of noopto branch that moves the node/rhin adapter and optimizer…

… to a separate r.js project.
  • Loading branch information...
jrburke committed May 15, 2011
2 parents 72d2840 + 3b4847d commit 0b6c3aa621cbd5e9d78206d0ada4457b354bff14
Showing with 435 additions and 7,835 deletions.
  1. +0 −73 adapt/dist.js
  2. +0 −77 adapt/node.js
  3. +0 −26 adapt/rhino.js
  4. +0 −49 adapt/tests/all.js
  5. +0 −3 adapt/tests/alpha.js
  6. +0 −6 adapt/tests/beta.js
  7. +0 −37 adapt/tests/node/canvasTest.js
  8. +0 −11 adapt/tests/node/index.js
  9. +0 −6 adapt/tests/node/tests/alpha/foo.js
  10. +0 −9 adapt/tests/node/tests/alpha/hello.html
  11. +0 −3 adapt/tests/node/tests/foo.js
  12. +0 −11 adapt/tests/node/tests/server.js
  13. +0 −10 adapt/tests/relative.js
  14. +0 −3 adapt/tests/sub/betaSub.js
  15. +0 −6 bin/x
  16. +0 −2 bin/x.bat
  17. +0 −131 bin/x.js
  18. +0 −7 bin/xdebug
  19. +0 −2 bin/xdebug.bat
  20. +0 −6 bin/xj
  21. +0 −2 bin/xj.bat
  22. +0 −4 bin/xjdebug
  23. +0 −2 bin/xjdebug.bat
  24. +0 −2 build/build.bat
  25. +0 −49 build/build.js
  26. +0 −4 build/build.sh
  27. +0 −2 build/buildebug.bat
  28. +0 −4 build/buildebug.sh
  29. +0 −4 build/buildebugj.sh
  30. +0 −2 build/buildj.bat
  31. +0 −4 build/buildj.sh
  32. +0 −2 build/buildjdebug.bat
  33. +0 −2 build/convert/commonjs/convert.bat
  34. +0 −33 build/convert/commonjs/convert.js
  35. +0 −4 build/convert/commonjs/convert.sh
  36. +0 −214 build/convert/stealjs/parse.js
  37. +0 −23 build/convert/stealjs/tests/all.js
  38. +0 −20 build/convert/stealjs/tests/parse.js
  39. +0 −183 build/example.build.js
  40. +0 −4 build/jslib/blank.js
  41. +0 −725 build/jslib/build.js
  42. +0 −23 build/jslib/commandLine.js
  43. +0 −152 build/jslib/commonJs.js
  44. +0 −47 build/jslib/env.js
  45. +0 −49 build/jslib/lang.js
  46. +0 −53 build/jslib/logger.js
  47. +0 −15 build/jslib/node/args.js
  48. +0 −223 build/jslib/node/file.js
  49. +0 −17 build/jslib/node/load.js
  50. +0 −10 build/jslib/node/optimize.js
  51. +0 −16 build/jslib/node/print.js
  52. +0 −253 build/jslib/optimize.js
  53. +0 −11 build/jslib/opto.build.js
  54. +0 −387 build/jslib/parse.js
  55. +0 −117 build/jslib/pragma.js
  56. +0 −207 build/jslib/requirePatch.js
  57. +0 −16 build/jslib/rhino/args.js
  58. +0 −239 build/jslib/rhino/file.js
  59. +0 −12 build/jslib/rhino/load.js
  60. +0 −95 build/jslib/rhino/optimize.js
  61. +0 −12 build/jslib/rhino/print.js
  62. +0 −13 build/jslib/uglifyjs/README.md
  63. +0 −5 build/jslib/uglifyjs/index.js
  64. +0 −1,249 build/jslib/uglifyjs/parse-js.js
  65. +0 −1,568 build/jslib/uglifyjs/process.js
  66. +0 −26 build/jslib/uglifyjs/squeeze-more.js
  67. +0 −202 build/lib/closure/COPYING
  68. +0 −261 build/lib/closure/README
  69. BIN build/lib/closure/compiler.jar
  70. +0 −4 build/lib/rhino/LICENSE
  71. BIN build/lib/rhino/js.jar
  72. +0 −43 build/tests/all.js
  73. +0 −7 build/tests/anonSimple.build.js
  74. +0 −138 build/tests/builds.js
  75. +0 −18 build/tests/circular.build.js
  76. +0 −18 build/tests/convert.js
  77. +0 −6 build/tests/css.build.js
  78. +0 −4 build/tests/css/common/common.css
  79. +0 −10 build/tests/css/master.css
  80. +0 −7 build/tests/css/sub/sub1.css
  81. +0 −13 build/tests/cssTestCompare.css
  82. +0 −12 build/tests/exports.build.js
  83. +0 −10 build/tests/hasTestModule.build.js
  84. +0 −30 build/tests/hasTestModule.js
  85. +0 −17 build/tests/i18n.build.js
  86. +0 −8 build/tests/indexBuilder.build.js
  87. +0 −16 build/tests/order.build.js
  88. +0 −59 build/tests/packages.build.js
  89. +0 −105 build/tests/parse.js
  90. +0 −13 build/tests/simple.build.js
  91. +0 −15 build/tests/text.build.js
  92. +0 −16 build/tests/textExclude.build.js
  93. +0 −13 dist/dist-build.sh
  94. +96 −97 dist/dist-site.js
  95. +227 −0 dist/file.js
  96. +1 −1 docs/api.html
  97. +1 −1 docs/commonjs.html
  98. +29 −50 docs/download.html
  99. +6 −13 docs/jquery.html
  100. +3 −3 docs/node.html
  101. +19 −38 docs/optimization.html
  102. +1 −1 docs/start.html
  103. +4 −4 require.js
  104. +15 −0 tasks.txt
  105. +33 −0 updatesubs.sh
View
@@ -1,73 +0,0 @@
-/**
- * @license Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-
-/*
- * This script will create the final r.js file used in node projects to use
- * RequireJS.
- *
- * This file uses Node to run:
- * node dist.js
- */
-
-/*jslint strict: false */
-/*global require: false, process: false, console: false */
-
-/**
- * Escapes a string so it is safe as a JS string
- * Taken from Dojo's buildUtil.jsEscape
- * @param {String} str
- * @returns {String}
- */
-function jsEscape(str) {
- return ('"' + str.replace(/(["\\])/g, '\\$1') + '"'
- ).replace(/[\f]/g, '\\f'
- ).replace(/[\b]/g, '\\b'
- ).replace(/[\n]/g, '\\n'
- ).replace(/[\t]/g, '\\t'
- ).replace(/[\r]/g, '\\r'); // string
-}
-
-var fs = require('fs'),
- child_process = require('child_process'),
- contents = fs.readFileSync('../bin/x.js', 'utf8'),
- loadRegExp = /readFile\(requireBuildPath \+ '([\w\/\.]+)'\)/g;
-
-//Inline file contents
-contents = contents.replace(loadRegExp, function (match, fileName) {
- return jsEscape(fs.readFileSync('../' + fileName, 'utf8'));
-});
-
-//Switch the behavior to "inlined mode"
-contents = contents.replace(/useRequireBuildPath \= true/, 'useRequireBuildPath = false');
-
-if (process.argv[2] === 'opto') {
- //Build the optimizer into one file, opto.js
- //Run the opto.build.js and insert the result into the built file.
- child_process.exec('cd ../build/jslib && ../build.sh opto.build.js && cd ../../adapt',
- function (error, stdout, stderr) {
- if (error) {
- console.log('Could not build opto: ' + error);
- return;
- }
-
- var optoBuildFileName = '../build/jslib/optotext.js',
- optoText = fs.readFileSync(optoBuildFileName, 'utf8');
-
- //Inject the content into the final output.
- contents = contents.replace('exec(readFile(fileName), fileName);', optoText);
-
- //Set the isOpto flag to true
- contents = contents.replace('isOpto = false', 'isOpto = true');
- fs.writeFileSync('opto.js', contents, 'utf8');
-
- //Remove build output since no longer needed.
- fs.unlinkSync(optoBuildFileName);
-
- }
- );
-} else {
- fs.writeFileSync('r.js', contents, 'utf8');
-}
View
@@ -1,77 +0,0 @@
-/**
- * @license RequireJS node Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-
-/*jslint regexp: false, strict: false */
-/*global require: false, define: false, nodeRequire: true, process: false */
-
-/**
- * This adapter assumes that x.js has loaded it and set up
- * some variables. This adapter just allows limited RequireJS
- * usage from within the requirejs directory. The general
- * node adapater is r.js.
- */
-(function () {
- var req = nodeRequire,
- fs = req('fs'),
- path = req('path'),
- vm = req('vm');
-
- //Clear out the global set by x.js
- nodeRequire = null;
-
- //Make nodeRequire available off of require, to allow a script to
- //add things to its require.paths for example.
- require.nodeRequire = req;
-
- //Supply an implementation that allows synchronous get of a module.
- require.get = function (context, moduleName, relModuleMap) {
- if (moduleName === "require" || moduleName === "exports" || moduleName === "module") {
- require.onError(new Error("Explicit require of " + moduleName + " is not allowed."));
- }
-
- var ret,
- moduleMap = context.makeModuleMap(moduleName, relModuleMap);
-
- //Normalize module name, if it contains . or ..
- moduleName = moduleMap.fullName;
-
- if (moduleName in context.defined) {
- ret = context.defined[moduleName];
- } else {
- if (ret === undefined) {
- //Try to dynamically fetch it.
- require.load(context, moduleName, moduleMap.url);
- //The above call is sync, so can do the next thing safely.
- ret = context.defined[moduleName];
- }
- }
-
- return ret;
- };
-
- require.load = function (context, moduleName, url) {
- var contents;
-
- //isDone is used by require.ready()
- require.s.isDone = false;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- if (path.existsSync(url)) {
- contents = fs.readFileSync(url, 'utf8');
- vm.runInThisContext(contents, url);
- } else {
- define(moduleName, function () {
- return req(moduleName);
- });
- }
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-}());
View
@@ -1,26 +0,0 @@
-/**
- * @license RequireJS rhino Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-
-/*jslint strict: false */
-/*global require: false, java: false, load: false */
-
-(function () {
-
- require.load = function (context, moduleName, url) {
- //isDone is used by require.ready()
- require.s.isDone = false;
-
- //Indicate a the module is in process of loading.
- context.loaded[moduleName] = false;
- context.scriptCount += 1;
-
- load(url);
-
- //Support anonymous modules.
- context.completeLoad(moduleName);
- };
-
-}());
View
@@ -1,49 +0,0 @@
-/**
- * @license RequireJS Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- * Available via the MIT or new BSD license.
- * see: http://github.com/jrburke/requirejs for details
- */
-
-/**
- * BUILD r.js IN THIS DIRECTORY FIRST BEFORE RUNNING THIS FILE
- *
- * To run in Node:
- * node ../r.js all.js
- *
- * To run in Rhino:
- * java -jar ../../build/lib/rhino/js.jar ../r.js all.js
- * Debug:
- * java -classpath ../../build/lib/rhino/js.jar org.mozilla.javascript.tools.debugger.Main ../r.js all.js
- */
-
-/*jslint strict: false */
-/*global require: false, doh: false */
-
-//Special global flag used by DOH.
-skipDohSetup = true;
-
-require({
- paths: {
- env: '../../build/jslib/env'
- }
-}, [
- 'alpha',
- 'beta',
- '../../tests/doh/runner.js',
- 'env!../../tests/doh/_{env}Runner.js'
-], function (alpha, beta) {
-
- doh.register('rjsTests',
- [
- function rjsTests(t) {
- t.is('alpha', alpha.name);
- t.is('beta', beta.name);
- t.is('betaSubName', beta.subName);
- }
- ]
- );
- doh.run();
-
- //Print out the test summary.
- doh.run();
-});
View
@@ -1,3 +0,0 @@
-define(function(require, exports) {
- exports.name = 'alpha';
-});
View
@@ -1,6 +0,0 @@
-define(['./sub/betaSub'], function (betaSub) {
- return {
- name: 'beta',
- subName: betaSub.name
- };
-});
@@ -1,37 +0,0 @@
-//Tested with nave, node 0.2.5,
-//npm install canvas
-//npm install express
-
-/*jslint strict: false */
-/*global require: false, console: false */
-
-var Canvas = require('canvas'),
- express = require('express'),
- canvas = new Canvas(200, 200),
- ctx = canvas.getContext('2d'),
- app = express.createServer();
-
-
-app.configure(function () {
-
- app.get('/', function (req, res) {
- res.send('hello world');
- });
-
- app.use(express.gzip());
- app.listen(3000);
-});
-
-
-ctx.font = '30px Impact';
-ctx.rotate(0.1);
-ctx.fillText("Awesome!", 50, 100);
-
-var te = ctx.measureText('Awesome!');
-ctx.strokeStyle = 'rgba(0,0,0,0.5)';
-ctx.beginPath();
-ctx.lineTo(50, 102);
-ctx.lineTo(50 + te.width, 102);
-ctx.stroke();
-
-console.log('<img src="' + canvas.toDataURL() + '" />');
View
@@ -1,11 +0,0 @@
-//The traditional nodejs http example
-
-require(['sys', 'http'], function (sys, http) {
- http.createServer(function (req, res) {
- setTimeout(function () {
- res.writeHead(200, {'Content-Type': 'text/plain'});
- res.end('Hello World\n');
- }, 2000);
- }).listen(8000);
- sys.puts('Server running at http://127.0.0.1:8000/');
-});
@@ -1,6 +0,0 @@
-define(function (require) {
- var foo = require('../foo');
- return {
- name: 'ALPHA' + foo.name
- };
-});
@@ -1,9 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Hello World</title>
-</head>
-<body>
- <h1>Hello World</h1>
-</body>
-</html>
@@ -1,3 +0,0 @@
-define({
- name: 'foo'
-});
@@ -1,11 +0,0 @@
-//The traditional nodejs http example
-
-require(['sys', 'foo', 'http', 'alpha/foo', 'text!alpha/hello.html'], function (sys, foo, http, alphaFoo, helloHtml) {
- http.createServer(function (req, res) {
- res.writeHead(200, {'Content-Type': 'text/plain'});
- res.write('Hello ' + foo.name + '\nHello ' + alphaFoo.name + '\n');
- res.write(helloHtml)
- res.end('\n');
- }).listen(8000);
- sys.puts('Server running at http://127.0.0.1:8000/');
-});
View
@@ -1,10 +0,0 @@
-/*
-Run this file from a directory that is not the directory containing this file
-to see if the baseUrl of this file is used instead of the current directory.
-*/
-
-require(['alpha', 'beta'], function (alpha, beta) {
- console.log('alpha === ' + alpha.name);
- console.log('beta === ' + beta.name);
- console.log('betaSubName === ' + beta.subName);
-});
@@ -1,3 +0,0 @@
-define({
- name: 'betaSubName'
-});
View
6 bin/x
@@ -1,6 +0,0 @@
-#!/bin/sh
-
-# A command line tool to run some RequireJS scripts via Node
-
-MYDIR=`cd \`dirname "$0"\`; pwd`
-node $MYDIR/x.js $MYDIR "$@"
View
@@ -1,2 +0,0 @@
-set MYDIR=%~dp0
-node %MYDIR%x.js %MYDIR% %*
Oops, something went wrong.

0 comments on commit 0b6c3aa

Please sign in to comment.