Skip to content

Commit c9a61e5

Browse files
committed
Use full library for JSON modules and runtime dependency for static modules, fixes #621
1 parent 8ec2579 commit c9a61e5

File tree

5 files changed

+5
-4
lines changed

5 files changed

+5
-4
lines changed

cli/targets/static-module.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function static_module_target(root, options, callback) {
1919
if (err)
2020
return callback(err);
2121
try {
22-
output = util.wrap(output, options);
22+
output = util.wrap(output, protobuf.util.merge({ dependency: "protobufjs/runtime" }, options));
2323
} catch (e) {
2424
callback(e);
2525
return;

cli/util.js

+1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ exports.wrap = function(OUTPUT, options) {
110110
wrap = fs.readFileSync(path.resolve(process.cwd(), name)).toString("utf8");
111111
}
112112
wrap = wrap.replace(/%ROOT%/g, JSON.stringify(options.root || "default"));
113+
wrap = wrap.replace(/%DEPENDENCY%/g, JSON.stringify(options.dependency || "protobufjs"));
113114
wrap = wrap.replace(/( *)%OUTPUT%/, function($0, $1) {
114115
return $1.length ? OUTPUT.replace(/^/mg, $1) : OUTPUT;
115116
});

cli/wrappers/commonjs.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use strict";
22

3-
var $protobuf = require("protobufjs/runtime");
3+
var $protobuf = require(%DEPENDENCY%);
44

55
%OUTPUT%
66

cli/wrappers/default.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
define(["protobuf"], factory);
55

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

99
})(this, function($protobuf) {
1010
"use strict";

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@
8686
"vinyl-buffer": "^1.0.0",
8787
"vinyl-fs": "^2.4.4",
8888
"vinyl-source-stream": "^1.1.0",
89-
"zuul": "^3.11.1",
89+
"zuul": "dcodeIO/zuul",
9090
"zuul-ngrok": "^4.0.0"
9191
},
9292
"cliDependencies": [

0 commit comments

Comments
 (0)