Comparing version 0.0.9 to 0.0.10
@@ -175,3 +175,11 @@ var type = require('./type'); | ||
}); | ||
code = code.slice(0, defDeps.params.start) | ||
code = (defDeps.array ? (code.slice(0, defDeps.array.start) | ||
+ code.slice(defDeps.array.start, defDeps.array.end).replace(/(["']).+?\1/g, function(s) { | ||
if(/^['"][^./]/.test(s)) { | ||
s = s.charAt(0) + './' + s.slice(1); | ||
} | ||
return s; | ||
}) | ||
+ code.slice(defDeps.array.end, defDeps.params.start) | ||
) : code.slice(0, defDeps.params.start)) | ||
+ 'require, exports, module' + code.slice(defDeps.params.end, defDeps.fnbody) | ||
@@ -178,0 +186,0 @@ + req |
{ | ||
"name": "ranma", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "A converter between CommonJS/AMD/CMD/other", | ||
@@ -5,0 +5,0 @@ "maintainers": [ |
@@ -249,8 +249,8 @@ var ranma = require('../'); | ||
it('define factory in amd style', function() { | ||
var res = ranma.cmdify('define(["a", "b"], function(a, b) {})'); | ||
expect(res).to.eql('define(["a", "b"], function(require, exports, module) {var a = require("./a");var b = require("./b");})'); | ||
var res = ranma.cmdify('define(["./a", "./b"], function(a, b) {})'); | ||
expect(res).to.eql('define(["./a", "./b"], function(require, exports, module) {var a = require("./a");var b = require("./b");})'); | ||
}); | ||
it('define deps not compact to params', function() { | ||
var res = ranma.cmdify('~function(){define(["a", "b"], function f(a){})}()'); | ||
expect(res).to.eql('~function(){define(["a", "b"], function f(require, exports, module){var a = require("./a");})}()'); | ||
expect(res).to.eql('~function(){define(["./a", "./b"], function f(require, exports, module){var a = require("./a");})}()'); | ||
}); | ||
@@ -257,0 +257,0 @@ it('commonjs', function() { |
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
2110024
56730