Built motion from commit 6a09e18b.|2.6.11
[motion2.git] / legacy-libs / grpc-cloned / node_modules / protobufjs / cli / pbjs / targets / commonjs.js
diff --git a/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/commonjs.js b/legacy-libs/grpc-cloned/node_modules/protobufjs/cli/pbjs/targets/commonjs.js
new file mode 100644 (file)
index 0000000..11d1cfd
--- /dev/null
@@ -0,0 +1,42 @@
+/*\r
+ Copyright 2013 Daniel Wirtz <dcode@dcode.io>\r
+\r
+ Licensed under the Apache License, Version 2.0 (the "License");\r
+ you may not use this file except in compliance with the License.\r
+ You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+ */\r
+var description = "Runtime structures as CommonJS module";\r
+\r
+var util = require("../util.js"),\r
+    js = require("./js.js");\r
+\r
+/**\r
+ * pbjs target: Runtime structures as a CommonJS module\r
+ * @exports pbjs/targets/commonjs\r
+ * @function\r
+ * @param {!ProtoBuf.Builder} builder Builder\r
+ * @param {!Object.<string,*>=} options Options\r
+ * @returns {string}\r
+ */\r
+var commonjs = module.exports = function(builder, options) {\r
+    options = options || {};\r
+    return [\r
+        "module.exports", options.min ? "=" : " = ",\r
+        "require(", JSON.stringify(options.dependency || "protobufjs"), ")",\r
+        js.build(builder, options)\r
+    ].join('');\r
+};\r
+\r
+/**\r
+ * Module description.\r
+ * @type {string}\r
+ */\r
+commonjs.description = description;\r