Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
P
protobuf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
protobuf
Commits
7726cd20
Commit
7726cd20
authored
Feb 16, 2016
by
Josh Haberman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Integrate review comments.
parent
5195b7f2
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
6 deletions
+18
-6
README.md
js/README.md
+3
-1
utils_test.js
js/binary/utils_test.js
+1
-1
export.js
js/commonjs/export.js
+6
-0
export_asserts.js
js/commonjs/export_asserts.js
+4
-0
rewrite_tests_for_commonjs.js
js/commonjs/rewrite_tests_for_commonjs.js
+4
-4
No files found.
js/README.md
View file @
7726cd20
...
...
@@ -22,7 +22,9 @@ To use Protocol Buffers with JavaScript, you need two main components:
`npm install google-protobuf`
, or use the files in this directory.
2.
The Protocol Compiler
`protoc`
. This translates
`.proto`
files
into
`.js`
files. The compiler is not currently available via
npm -- you must download and compile it from GitHub or a tarball.
npm, but you can download a pre-built binary
[
on GitHub
](
https://github.com/google/protobuf/releases
)
(look for the
`protoc-*.zip`
files under
**Downloads**
).
Setup
...
...
js/binary/utils_test.js
View file @
7726cd20
...
...
@@ -39,7 +39,7 @@
goog
.
require
(
'goog.crypt.base64'
);
goog
.
require
(
'goog.testing.asserts'
);
// CommonJS-LoadFromFile: google
_p
rotobuf
// CommonJS-LoadFromFile: google
P
rotobuf
goog
.
require
(
'jspb.BinaryConstants'
);
goog
.
require
(
'jspb.BinaryWriter'
);
goog
.
require
(
'jspb.utils'
);
...
...
js/commonjs/export.js
View file @
7726cd20
...
...
@@ -5,6 +5,12 @@
* the google-protobuf.js file that we build at distribution time.
*/
goog
.
require
(
'goog.object'
);
goog
.
require
(
'jspb.BinaryReader'
);
goog
.
require
(
'jspb.BinaryWriter'
);
goog
.
require
(
'jspb.ExtensionFieldInfo'
);
goog
.
require
(
'jspb.Message'
);
exports
.
Message
=
jspb
.
Message
;
exports
.
BinaryReader
=
jspb
.
BinaryReader
;
exports
.
BinaryWriter
=
jspb
.
BinaryWriter
;
...
...
js/commonjs/export_asserts.js
View file @
7726cd20
...
...
@@ -30,4 +30,8 @@ for (var key in global) {
}
}
// The COMPILED variable is set by Closure compiler to "true" when it compiles
// JavaScript, so in practice this is equivalent to "exports.COMPILED = true".
// This will disable some debugging functionality in debug.js. We could
// investigate whether this can/should be enabled in CommonJS builds.
exports
.
COMPILED
=
COMPILED
js/commonjs/rewrite_tests_for_commonjs.js
View file @
7726cd20
...
...
@@ -46,21 +46,21 @@ lineReader.on('line', function(line) {
if
(
module
)
{
// Skip goog.require() lines before the first directive.
var
full_sym
=
is_require
[
1
];
var
sym
=
tryStripPrefix
(
full_sym
,
pkg
);
console
.
log
(
"google
_p
rotobuf.exportSymbol('"
+
full_sym
+
"', "
+
module
+
sym
+
', global);'
);
console
.
log
(
"google
P
rotobuf.exportSymbol('"
+
full_sym
+
"', "
+
module
+
sym
+
', global);'
);
}
}
else
if
(
is_loadfromfile
)
{
if
(
!
module
)
{
console
.
log
(
"var google
_p
rotobuf = require('google-protobuf');"
);
console
.
log
(
"var google
P
rotobuf = require('google-protobuf');"
);
console
.
log
(
"var asserts = require('closure_asserts_commonjs');"
);
console
.
log
(
"var global = Function('return this')();"
);
console
.
log
(
""
);
console
.
log
(
"// Bring asserts into the global namespace."
);
console
.
log
(
"google
_p
rotobuf.object.extend(global, asserts);"
);
console
.
log
(
"google
P
rotobuf.object.extend(global, asserts);"
);
}
module
=
is_loadfromfile
[
1
].
replace
(
"-"
,
"_"
);
pkg
=
is_loadfromfile
[
2
];
if
(
module
!=
"google
_p
rotobuf"
)
{
// We unconditionally require this in the header.
if
(
module
!=
"google
P
rotobuf"
)
{
// We unconditionally require this in the header.
console
.
log
(
"var "
+
module
+
" = require('"
+
is_loadfromfile
[
1
]
+
"');"
);
}
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment