Skip to content

Use protobuf/minimal when pbjs target is static-module#813

Merged
dcodeIO merged 1 commit intoprotobufjs:masterfrom
betalb:use-minimal-version-when-bunling-modules
May 30, 2017
Merged

Use protobuf/minimal when pbjs target is static-module#813
dcodeIO merged 1 commit intoprotobufjs:masterfrom
betalb:use-minimal-version-when-bunling-modules

Conversation

@betalb
Copy link
Copy Markdown

@betalb betalb commented May 30, 2017

This should fix #798

Change affects AMD wrapper too, to be consistent.

Some modifications to AMD loader configs may be required, i.e. protobufjs/minimal should be mapped to correct file. Other option is to pass dependency argument to pbts and override default module name.

Comment thread cli/pbjs.js
" closure Just a closure adding to protobuf.roots (see -r)",
"",
" --dependency Specifies which version of protobuf to require. Accepts any valid module id",
"",
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently, $DEPENDENCY is defined by the respective target and if I am not mistaken it is not (yet) a used argument.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understood your concern correct, it is actually used in util.wrap called by static-module and json-module targets. This option gets correctly passed down to (json|static)-module target.

I only see one concern at the moment: static-module target sepcifies default value for dependency, but json-module - doesn't

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To be more specific. util.wrap uses protobufjs as default value when dependency option is not provided.
static-module target will use protobufjs/minimal as default if not overwritten by options, provided in arguments, but json-module is not doing this.

To make things consistent we can either remove default value from static-module code and specify default in pbjs.js or update json-module target

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the argument should always be honored in case the user has a legitimate reason to override it, but the targets should have their defaults.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And it will. dependency will be passed inside of options object to target. Target will set dependency to protobufjs/minimal if not provided externally, and will pass options to util.wrap.

@betalb betalb force-pushed the use-minimal-version-when-bunling-modules branch 2 times, most recently from c32c5f9 to 4f74067 Compare May 30, 2017 12:09
@betalb betalb force-pushed the use-minimal-version-when-bunling-modules branch from 4f74067 to 4eac28c Compare May 30, 2017 12:27
@betalb
Copy link
Copy Markdown
Author

betalb commented May 30, 2017

Rebased onto master

@dcodeIO dcodeIO merged commit 5f2f177 into protobufjs:master May 30, 2017
Szpadel pushed a commit to Szpadel/protobuf.js that referenced this pull request Jul 25, 2017
"minimal" doesn't include `Root`, as mentioned in protobufjs#828 and protobufjs#856. Probably caused by protobufjs#813.
ccdunder pushed a commit to ccdunder/protobuf.js that referenced this pull request Nov 27, 2017
"minimal" doesn't include `Root`, as mentioned in protobufjs#828 and protobufjs#856. Probably caused by protobufjs#813.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ES6 Static code import protobufjs isntead of protobufjs/minimal

3 participants