protobuf.js/cli/targets/static-module.js
Taylor McIntyre da34f43ccd
feat!: move command line tool to a new package named protobufjs-cli (#1234)
* Get protobufjs-cli to a publishable state

* Fix eslint issues

* Fix pbts path

* Install cli package deps on CI 'build' job

* fix: get rid of require-protobufjs.js

* fix: lint

* fix: versions

* chore(deps): update package-lock.json

Co-authored-by: Stacey Sern <stacey@dropbox.com>
Co-authored-by: Gabriel Cangussu <gabrielcangussu@gmail.com>
Co-authored-by: Alexander Fenster <fenster@google.com>
2021-01-15 16:02:00 -08:00

29 lines
978 B
JavaScript

"use strict";
module.exports = static_module_target;
// - The default wrapper supports AMD, CommonJS and the global scope (as window.root), in this order.
// - You can specify a custom wrapper with the --wrap argument.
// - CommonJS modules depend on the minimal build for reduced package size with browserify.
// - AMD and global scope depend on the full library for now.
var util = require("../util"),
protobuf = require("protobufjs");
static_module_target.description = "Static code without reflection as a module";
function static_module_target(root, options, callback) {
require("./static")(root, options, function(err, output) {
if (err) {
callback(err);
return;
}
try {
output = util.wrap(output, protobuf.util.merge({ dependency: "protobufjs/minimal" }, options));
} catch (e) {
callback(e);
return;
}
callback(null, output);
});
}