-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use ECMAScript module format for .mjs. * Update rollup_bundle tests with Jasmine specs. * Update comment and fix grpc service exports. * Add tests for GRPC service exports. * Add exception for nexted exports and example to tests.
- Loading branch information
Showing
8 changed files
with
149 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,16 @@ | ||
const commonjs = require('rollup-plugin-commonjs'); | ||
const nodeRequire = require('rollup-plugin-node-resolve'); | ||
|
||
module.exports = { | ||
plugins: [ | ||
nodeRequire(), | ||
commonjs({ | ||
extensions: ['.js', '.mjs'], | ||
// Temporary fix until https://github.com/improbable-eng/grpc-web/issues/369 is resolved. | ||
namedExports: { | ||
'./node_modules/@improbable-eng/grpc-web/dist/grpc-web-client.js': [ | ||
'grpc', | ||
], | ||
} | ||
}), | ||
], | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
const bundle = require('rules_typescript_proto/test/test_es6_bundling/'); | ||
|
||
describe('Rollup', () => { | ||
it('should define Pizza with protobuf API', () => { | ||
expect(bundle.Pizza).toBeDefined(); | ||
|
||
const pizza = new bundle.Pizza(); | ||
pizza.setSize(bundle.PizzaSize.PIZZA_SIZE_LARGE); | ||
|
||
expect(pizza.getSize()).toBe(bundle.PizzaSize.PIZZA_SIZE_LARGE); | ||
expect(Array.isArray(pizza.getToppingIdsList())).toBe(true); | ||
}); | ||
|
||
it('should define DeliveryPerson', () => { | ||
expect(bundle.DeliveryPerson).toBeDefined(); | ||
expect(new bundle.DeliveryPerson()).toBeTruthy(); | ||
}); | ||
|
||
it('should define PizzaService', () => { | ||
expect(bundle.PizzaService).toBeDefined(); | ||
expect(bundle.PizzaService.serviceName).toBe('test.bazel.proto.PizzaService'); | ||
expect(bundle.PizzaService.OrderPizza.methodName).toBe('OrderPizza'); | ||
}); | ||
|
||
it('should define PizzaServiceClient', () => { | ||
expect(bundle.PizzaServiceClient).toBeDefined(); | ||
const client = new bundle.PizzaServiceClient('http://localhost', {}); | ||
expect(typeof client.orderPizza).toBe('function'); | ||
}); | ||
|
||
it('should follow expected naming styles', () => { | ||
expect(new bundle.alllowercase().setTest(1)).toBeTruthy(); | ||
expect(new bundle.ALLUPPERCASE().setTest(1)).toBeTruthy(); | ||
expect(new bundle.lowerCamelCase().setTest(1)).toBeTruthy(); | ||
expect(new bundle.UpperCamelCase().setTest(1)).toBeTruthy(); | ||
expect(new bundle.snake_case_snake_case().setTest(1)).toBeTruthy(); | ||
expect(new bundle.Upper_snake_Case().setTest(1)).toBeTruthy(); | ||
expect(new bundle.M2M().setTest(1)).toBeTruthy(); | ||
expect(new bundle.M_2M().setTest(1)).toBeTruthy(); | ||
expect(new bundle.M2_M().setTest(1)).toBeTruthy(); | ||
expect(new bundle.M2M_().setTest(1)).toBeTruthy(); | ||
expect(new bundle.m_22M().setTest(1)).toBeTruthy(); | ||
expect(new bundle.m42_M().setTest(1)).toBeTruthy(); | ||
expect(new bundle.m24M_().setTest(1)).toBeTruthy(); | ||
expect(new bundle.M9().setTest(1)).toBeTruthy(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,4 @@ | ||
import {DeliveryPerson} from 'rules_typescript_proto/test/proto/common/delivery_person_pb'; | ||
import {alllowercase, ALLUPPERCASE, lowerCamelCase, m24M_, M2_M, M2M, M2M_, m42_M, M9, m_22M, M_2M, snake_case_snake_case, Upper_snake_Case, UpperCamelCase,} from 'rules_typescript_proto/test/proto/naming_styles_pb'; | ||
|
||
const person = new DeliveryPerson(); | ||
console.log(person); | ||
|
||
console.log(new alllowercase().setTest(1)); | ||
console.log(new ALLUPPERCASE().setTest(1)); | ||
console.log(new lowerCamelCase().setTest(1)); | ||
console.log(new UpperCamelCase().setTest(1)); | ||
console.log(new snake_case_snake_case().setTest(1)); | ||
console.log(new Upper_snake_Case().setTest(1)); | ||
console.log(new M2M().setTest(1)); | ||
console.log(new M_2M().setTest(1)); | ||
console.log(new M2_M().setTest(1)); | ||
console.log(new M2M_().setTest(1)); | ||
console.log(new m_22M().setTest(1)); | ||
console.log(new m42_M().setTest(1)); | ||
console.log(new m24M_().setTest(1)); | ||
console.log(new M9().setTest(1)); | ||
export {alllowercase, ALLUPPERCASE, lowerCamelCase, m24M_, M2_M, M2M, M2M_, m42_M, M9, m_22M, M_2M, snake_case_snake_case, Upper_snake_Case, UpperCamelCase,} from 'rules_typescript_proto/test/proto/naming_styles_pb'; | ||
export { DeliveryPerson } from 'rules_typescript_proto/test/proto/common/delivery_person_pb'; | ||
export { Pizza, PizzaSize } from 'rules_typescript_proto/test/proto/common/pizza_pb'; | ||
export { PizzaService, PizzaServiceClient } from 'rules_typescript_proto/test/proto/pizza_service_pb_service'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,6 +159,13 @@ | |
resolved "https://registry.yarnpkg.com/@types/normalize-package-data/-/normalize-package-data-2.4.0.tgz#e486d0d97396d79beedd0a6e33f4534ff6b4973e" | ||
integrity sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA== | ||
|
||
"@types/[email protected]": | ||
version "0.0.8" | ||
resolved "https://registry.yarnpkg.com/@types/resolve/-/resolve-0.0.8.tgz#f26074d238e02659e323ce1a13d041eee280e194" | ||
integrity sha512-auApPaJf3NPfe18hSoJkp8EbZzer2ISk7o8mCC3M9he/a04+gbMF97NkpD2S8riMGvm4BMRI59/SZQSaLTKpsQ== | ||
dependencies: | ||
"@types/node" "*" | ||
|
||
abbrev@1: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/abbrev/-/abbrev-1.1.1.tgz#f8f2c887ad10bf67f634f005b6987fed3179aac8" | ||
|
@@ -419,6 +426,11 @@ buffer-from@^1.0.0: | |
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" | ||
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== | ||
|
||
builtin-modules@^3.1.0: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/builtin-modules/-/builtin-modules-3.1.0.tgz#aad97c15131eb76b65b50ef208e7584cd76a7484" | ||
integrity sha512-k0KL0aWZuBt2lrxrcASWDfwOLMnodeQjodT/1SxEQAXsHANgo6ZC/VEaSEHCXt7aSTZ4/4H5LKa+tBXmW7Vtvw== | ||
|
||
[email protected]: | ||
version "3.1.0" | ||
resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.0.tgz#f6cf7933a360e0588fa9fde85651cdc7f805d1f6" | ||
|
@@ -1467,6 +1479,11 @@ is-glob@^4.0.0: | |
dependencies: | ||
is-extglob "^2.1.1" | ||
|
||
is-module@^1.0.0: | ||
version "1.0.0" | ||
resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" | ||
integrity sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE= | ||
|
||
is-number@^3.0.0: | ||
version "3.0.0" | ||
resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" | ||
|
@@ -2539,6 +2556,13 @@ resolve@^1.1.6, resolve@^1.10.0, resolve@^1.11.0: | |
dependencies: | ||
path-parse "^1.0.6" | ||
|
||
resolve@^1.11.1: | ||
version "1.13.0" | ||
resolved "https://registry.yarnpkg.com/resolve/-/resolve-1.13.0.tgz#e879eb397efb40511056ede7300b6ac28c51290b" | ||
integrity sha512-HHZ3hmOrk5SvybTb18xq4Ek2uLqLO5/goFCYUyvn26nWox4hdlKlfC/+dChIZ6qc4ZeYcN9ekTz0yyHsFgumMw== | ||
dependencies: | ||
path-parse "^1.0.6" | ||
|
||
ret@~0.1.10: | ||
version "0.1.15" | ||
resolved "https://registry.yarnpkg.com/ret/-/ret-0.1.15.tgz#b8a4825d5bdb1fc3f6f53c2bc33f81388681c7bc" | ||
|
@@ -2567,6 +2591,17 @@ rollup-plugin-commonjs@^10.1.0: | |
resolve "^1.11.0" | ||
rollup-pluginutils "^2.8.1" | ||
|
||
rollup-plugin-node-resolve@^5.2.0: | ||
version "5.2.0" | ||
resolved "https://registry.yarnpkg.com/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-5.2.0.tgz#730f93d10ed202473b1fb54a5997a7db8c6d8523" | ||
integrity sha512-jUlyaDXts7TW2CqQ4GaO5VJ4PwwaV8VUGA7+km3n6k6xtOEacf61u0VXwN80phY/evMcaS+9eIeJ9MOyDxt5Zw== | ||
dependencies: | ||
"@types/resolve" "0.0.8" | ||
builtin-modules "^3.1.0" | ||
is-module "^1.0.0" | ||
resolve "^1.11.1" | ||
rollup-pluginutils "^2.8.1" | ||
|
||
rollup-pluginutils@^2.8.1: | ||
version "2.8.2" | ||
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz#72f2af0748b592364dbd3389e600e5a9444a351e" | ||
|