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
d6a186a8
Commit
d6a186a8
authored
Feb 04, 2016
by
Josh Haberman
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some documentation in comments.
parent
9e60036c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
export.js
js/commonjs/export.js
+3
-0
export_asserts.js
js/commonjs/export_asserts.js
+7
-1
rewrite_tests_for_commonjs.js
js/commonjs/rewrite_tests_for_commonjs.js
+21
-1
No files found.
js/commonjs/export.js
View file @
d6a186a8
/**
/**
* @fileoverview Export symbols needed by generated code in CommonJS style.
* @fileoverview Export symbols needed by generated code in CommonJS style.
*
* This effectively is our canonical list of what we publicly export from
* the google-protobuf.js file that we build at distribution time.
*/
*/
exports
.
Message
=
jspb
.
Message
;
exports
.
Message
=
jspb
.
Message
;
...
...
js/commonjs/export_asserts.js
View file @
d6a186a8
/**
/**
* @fileoverview Description of this file.
* @fileoverview Exports symbols needed only by tests.
*
* This file exports several Closure Library symbols that are only
* used by tests. It is used to generate a file
* closure_asserts_commonjs.js that is only used at testing time.
*/
*/
goog
.
require
(
'goog.testing.asserts'
);
goog
.
require
(
'goog.testing.asserts'
);
var
global
=
Function
(
'return this'
)();
var
global
=
Function
(
'return this'
)();
// All of the closure "assert" functions are exported at the global level.
//
// The Google Closure assert functions start with assert, eg.
// The Google Closure assert functions start with assert, eg.
// assertThrows
// assertThrows
// assertNotThrows
// assertNotThrows
...
...
js/commonjs/rewrite_tests_for_commonjs.js
View file @
d6a186a8
/**
/**
* @fileoverview Description of this file.
* @fileoverview Utility to translate test files to CommonJS imports.
*
* This is a somewhat hacky tool designed to do one very specific thing.
* All of the test files in *_test.js are written with Closure-style
* imports (goog.require()). This works great for running the tests
* against Closure-style generated code, but we also want to run the
* tests against CommonJS-style generated code without having to fork
* the tests.
*
* Closure-style imports import each individual type by name. This is
* very different than CommonJS imports which are by file. So we put
* special comments in these tests like:
*
* // CommonJS-LoadFromFile: test_pb
* goog.require('proto.jspb.test.CloneExtension');
* goog.require('proto.jspb.test.Complex');
* goog.require('proto.jspb.test.DefaultValues');
*
* This script parses that special comment and uses it to generate proper
* CommonJS require() statements so that the tests can run and pass using
* CommonJS imports.
*/
*/
var
lineReader
=
require
(
'readline'
).
createInterface
({
var
lineReader
=
require
(
'readline'
).
createInterface
({
...
...
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