Permalink
Browse files

0.1.1 - config.exposeRequire can now be used to export require()

  • Loading branch information...
1 parent bb0b2bb commit 5f3fe572f31074ebd6a8948f090e4b5edf670c91 @insin committed Jan 30, 2012
Showing with 37 additions and 14 deletions.
  1. +15 −0 CHANGES.rst
  2. +2 −0 README.rst
  3. +7 −1 lib/buildumb.js
  4. +13 −13 package.json
View
@@ -0,0 +1,15 @@
+0.1.1 / 2012-01-30
+==================
+
+* Added ``config.exposeRequire`` to control exporting of ``require()``
+
+0.1.0 / 2012-01-18
+==================
+
+* Changed ``config.modules`` to expect properties and values in the reverse
+ order, so multiple require strings can be used to require the same module
+
+0.0.1 / 2012-01-18
+==================
+
+* Initial release.
View
@@ -43,6 +43,8 @@ Expected ``config`` properties are:
A comment header for inclusion at the top of output files.
``compress`` *(Optional)*
Path to a compressed output file, which will be created if given.
+``exposeRequire`` *(Optional)*
+ If ``true``, ``require()`` will be exported to the global scope.
The `Closure Compiler Service API`_ is used to compress code - errors, warnings
and statistics it returns will be displayed.
View
@@ -30,9 +30,12 @@ var formatTemplate = exports.formatTemplate = function(templatePath) {
* config.output -- built output file location
* config.header -- comment header for inclusion in output and compressed files (if given)
* config.compress -- compressed output file location (if given)
+ * config.exposeRequire -- if true, require() will be exported to the global scope
*/
exports.build = function(config) {
- config = object.extend({header: '', compress: ''}, config)
+ config = object.extend({
+ header: '', compress: '', exposeRequire: false
+ }, config)
// Input
var exported = []
@@ -51,6 +54,9 @@ exports.build = function(config) {
util.format("window['%s'] = require('%s')", name, config.exports[name])
)
}
+ if (config.exposeRequire) {
+ exported.push("window['require'] = require")
+ }
// Output
var code = formatTemplate(normjoin(__dirname, '../support/template.js'),
View
@@ -1,16 +1,16 @@
{
- "name": "buildumb",
- "description": "Ultra-dumb exporter of Node.js modules for use in the browser",
- "version": "0.1.0",
- "author": "Jonathan Buchanan <jonathan.buchanan@gmail.com> (https://github.com/insin)",
- "tags": ["build", "export", "browser", "modules"],
- "main": "./lib/buildumb",
- "repository": {
- "type": "git",
- "url": "http://github.com/insin/buildumb.git"
- },
- "dependencies": {
- "isomorph": "0.1.x",
- "request": "2.9.x"
+ "name": "buildumb"
+, "description": "Ultra-dumb exporter of Node.js modules for use in the browser"
+, "version": "0.1.1"
+, "author": "Jonathan Buchanan <jonathan.buchanan@gmail.com> (https://github.com/insin)"
+, "tags": ["build", "export", "browser", "modules"]
+, "main": "./lib/buildumb"
+, "repository": {
+ "type": "git"
+ , "url": "http://github.com/insin/buildumb.git"
+ }
+, "dependencies": {
+ "isomorph": "0.1.x"
+ , "request": "2.9.x"
}
}

0 comments on commit 5f3fe57

Please sign in to comment.