Comparing version 0.1.1 to 0.2.0
@@ -8,7 +8,4 @@ var fs = require('fs'), | ||
var requireCode = fs.readFileSync(__dirname + '/require.js', 'utf8') | ||
.replace(/\/*([^/]+)\/\n/g, '') | ||
.replace(/\n/g, '') | ||
.replace(/ +/g, ' '); | ||
var requireCode = fs.readFileSync(__dirname + '/require/require.new.min.js', 'utf8') | ||
.replace(/\/*([^/]+)\/\n/g, ''); | ||
var defaults = { | ||
@@ -114,3 +111,5 @@ main: 'index.js', | ||
this.build.render(result, function(pkgId) { | ||
var relpath = self.build.main.replace(/^\.\//, '').replace(new RegExp('^'+self.build.basepath), ''); | ||
var relpath = self.build.main.replace(/^\.\//, '').replace(new RegExp('^' + | ||
(path.sep == '\\' ? self.build.basepath.replace(/\\/g, '\\\\') : self.build.basepath ) // windows | ||
), ''); | ||
onDone({ | ||
@@ -139,3 +138,3 @@ replaced: self.replaced, | ||
+ requireCode | ||
+ '\n' | ||
+ '\nrequire.m = [];\n' | ||
+ out.modules.reduce(function(str, o, counter) { | ||
@@ -146,3 +145,3 @@ var keys = []; | ||
}); | ||
return str + 'require.modules['+counter+'] = { ' + keys.join(',\n') + '};\n'; | ||
return str + 'require.m['+counter+'] = { ' + keys.join(',\n') + '};\n'; | ||
}, '') | ||
@@ -182,3 +181,3 @@ // name to export | ||
basepath = this._fullPath(basepath); | ||
basepath += (basepath[basepath.length-1] !== '/' ? '/' : ''); | ||
basepath += (basepath[basepath.length-1] !== path.sep ? path.sep : ''); | ||
this.build.basepath = basepath; | ||
@@ -189,3 +188,3 @@ } | ||
if(p.substr(0, 1) == '.') { | ||
p = path.normalize(this.options.reqpath + '/' + p); | ||
p = path.normalize(this.options.reqpath + path.sep + p); | ||
} | ||
@@ -192,0 +191,0 @@ return p; |
@@ -1,2 +0,3 @@ | ||
var fs = require('fs'); | ||
var fs = require('fs'), | ||
path = require('path'); | ||
@@ -19,6 +20,7 @@ // A set of file/folder paths defined as: | ||
paths.forEach(function(p) { | ||
p = path.normalize(p); // for windows | ||
var isDirectory = fs.statSync(p).isDirectory(); | ||
if (isDirectory) { | ||
p += (p[p.length-1] !== '/' ? '/' : ''); | ||
p += (p[p.length-1] !== path.sep ? path.sep : ''); | ||
return fs.readdirSync(p).forEach(function (f) { | ||
@@ -25,0 +27,0 @@ self.include(p + f); |
@@ -63,3 +63,3 @@ var fs = require('fs'), | ||
child.files = files; | ||
child.main = main.replace(new RegExp('^'+basePath), ''); | ||
child.main = (main.substr(0, basePath.length) == basePath ? main.substr(basePath.length) : main); | ||
child.basepath = basePath; | ||
@@ -79,3 +79,7 @@ dependencies.forEach(function(dep) { | ||
function relative(filename){ | ||
return filename.replace(new RegExp('^'+self.basepath), ''); | ||
var temp = (filename.substr(0, self.basepath.length) == self.basepath ? filename.substr(self.basepath.length) : filename); | ||
if(path.sep != '/') { | ||
temp = temp.replace(/\\/g, '/'); // windows | ||
} | ||
return temp; | ||
} | ||
@@ -149,4 +153,4 @@ var opts = { relative: relative }, | ||
result[selfId][child.name] = JSON.stringify({ | ||
context: childId, | ||
main: (child.main.substr(0, 1) == '/' ? child.main : '/'+child.main) | ||
c: childId, // context | ||
m: (child.main.substr(0, 1) == '/' ? child.main : '/'+child.main) // main | ||
}); | ||
@@ -153,0 +157,0 @@ done(); |
{ | ||
"name": "gluejs", | ||
"description": "Build CommonJS modules for the browser via a chainable API", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"author": { | ||
@@ -24,3 +24,3 @@ "name": "Mikito Takada", | ||
"dependencies": { | ||
"package-json-resolver": "git://github.com/mixu/package-json-resolver.git#master", | ||
"package-json-resolver": "0.0.1", | ||
"minilog": "0.0.4", | ||
@@ -27,0 +27,0 @@ "argsparser": "0.0.6" |
@@ -145,3 +145,3 @@ # gluejs | ||
Note that source URLs require that scripts are wrapped in a eval block, which is a bit ugly, so you probably don't want that in production mode. | ||
Note that source URLs require that scripts are wrapped in a eval block with a special comment, which is not supported by IE, so don't use source URLs for production builds. | ||
@@ -148,0 +148,0 @@ ## Handling template files and compile-to-JS files |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
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
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable and can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
31819
14
525
0
3
12
+ Addedlru-cache@2.7.3(transitive)
+ Addedminimatch@0.2.14(transitive)
+ Addedpackage-json-resolver@0.0.1(transitive)
+ Addedsigmund@1.0.1(transitive)
Updatedpackage-json-resolver@0.0.1