component-builder
Advanced tools
Comparing version 0.11.1 to 0.11.2
0.11.2 / 2013-12-30 | ||
================== | ||
* fix main aliasing support | ||
0.11.1 / 2013-12-30 | ||
@@ -3,0 +8,0 @@ ================== |
@@ -820,12 +820,8 @@ /** | ||
function register(builder, file, js){ | ||
var main = builder.config.main; | ||
var orig = file; | ||
// strip ./ | ||
if ('./' == file.slice(0, 2)) file = file.slice(2); | ||
// rewrite main to index.js | ||
// so that require() still grabs | ||
// the correct file without aliases | ||
if (file == main) file = 'index.js'; | ||
var main = builder.config.main; | ||
var isMain = main == file; | ||
var orig = file; | ||
@@ -838,6 +834,8 @@ // determine prefix | ||
// prefix | ||
file = prefix + '/' + file; | ||
// rewrite requires for dependencies, | ||
// and fix relative requires when .main | ||
// is not index.js | ||
js = requires(js, function(require){ | ||
@@ -850,13 +848,28 @@ var deps = builder.config.dependencies || {}; | ||
// register the module | ||
if (builder.sourceUrls) { | ||
js = JSON.stringify(js + '//@ sourceURL=' + prefix + '/' + orig); | ||
js = JSON.stringify(js + '//@ sourceURL=' + file); | ||
js = js.replace(/\\n/g, '\\n\\\n'); | ||
return 'require.register("' + file + '", Function("exports, require, module",\n' | ||
js = 'require.register("' + file + '", Function("exports, require, module",\n' | ||
+ js | ||
+ '\n));'; | ||
} else { | ||
return 'require.register("' + file + '", function(exports, require, module){\n' | ||
js = 'require.register("' + file + '", function(exports, require, module){\n' | ||
+ js | ||
+ '\n});'; | ||
} | ||
// main support | ||
// TODO: dear god, this is nasty, doesnt belong | ||
// in here but doing a separate tree walk is lame | ||
// so screw it, works for now, need to rewrite this thing | ||
// once we produce a dep tree first then we can completely | ||
// remove all of this junk, as we'll know what all the mains | ||
// are and can simply rewrite | ||
if (isMain && 'index.js' != orig) { | ||
js += '\nrequire.main("' + prefix + '", "' + orig + '")'; | ||
} | ||
return js; | ||
} | ||
@@ -863,0 +876,0 @@ |
{ | ||
"name": "component-builder", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "Component build tool", | ||
@@ -11,3 +11,3 @@ "keywords": [ | ||
"dependencies": { | ||
"component-require": "1.0.0", | ||
"component-require": "1.0.1", | ||
"batch": "0.2.1", | ||
@@ -14,0 +14,0 @@ "mkdirp": "0.3.4", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
29004
840
+ Addedcomponent-require@1.0.1(transitive)
- Removedcomponent-require@1.0.0(transitive)
Updatedcomponent-require@1.0.1