Skip to content

Commit

Permalink
Use full library for JSON modules and runtime dependency for static m…
Browse files Browse the repository at this point in the history
…odules, fixes protocolbuffers#621
  • Loading branch information
dcodeIO committed Jan 5, 2017
1 parent 8ec2579 commit c9a61e5
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cli/targets/static-module.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function static_module_target(root, options, callback) {
if (err)
return callback(err);
try {
output = util.wrap(output, options);
output = util.wrap(output, protobuf.util.merge({ dependency: "protobufjs/runtime" }, options));
} catch (e) {
callback(e);
return;
Expand Down
1 change: 1 addition & 0 deletions cli/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ exports.wrap = function(OUTPUT, options) {
wrap = fs.readFileSync(path.resolve(process.cwd(), name)).toString("utf8");
}
wrap = wrap.replace(/%ROOT%/g, JSON.stringify(options.root || "default"));
wrap = wrap.replace(/%DEPENDENCY%/g, JSON.stringify(options.dependency || "protobufjs"));
wrap = wrap.replace(/( *)%OUTPUT%/, function($0, $1) {
return $1.length ? OUTPUT.replace(/^/mg, $1) : OUTPUT;
});
Expand Down
2 changes: 1 addition & 1 deletion cli/wrappers/commonjs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use strict";

var $protobuf = require("protobufjs/runtime");
var $protobuf = require(%DEPENDENCY%);

%OUTPUT%

Expand Down
2 changes: 1 addition & 1 deletion cli/wrappers/default.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
define(["protobuf"], factory);

/* CommonJS */ else if (typeof require === 'function' && typeof module === 'object' && module && module.exports)
module.exports = factory(require("protobufjs/runtime"));
module.exports = factory(require(%DEPENDENCY%));

})(this, function($protobuf) {
"use strict";
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"vinyl-buffer": "^1.0.0",
"vinyl-fs": "^2.4.4",
"vinyl-source-stream": "^1.1.0",
"zuul": "^3.11.1",
"zuul": "dcodeIO/zuul",
"zuul-ngrok": "^4.0.0"
},
"cliDependencies": [
Expand Down

0 comments on commit c9a61e5

Please sign in to comment.