@bufbuild/protoc-gen-es 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -121,14 +121,29 @@ Multiple values can be given by separating them with `+`, for example
121
121
  `target=js+dts`.
122
122
 
123
123
  By default, we generate JavaScript and TypeScript declaration files, which
124
- produces the smallest code size. If you prefer to generate TypeScript, use
125
- `target=ts`.
124
+ produces the smallest code size and is the most compatible with various
125
+ bundler configurations. If you prefer to generate TypeScript, use `target=ts`.
126
+
127
+ ### `import_extension=.js`
128
+
129
+ By default, [protoc-gen-es](https://www.npmjs.com/package/@bufbuild/protoc-gen-es)
130
+ (and all other plugins based on [@bufbuild/protoplugin](https://www.npmjs.com/package/@bufbuild/protoplugin))
131
+ uses a `.js` file extensions in import paths, even in TypeScript files.
132
+
133
+ This is unintuitive, but necessary for [ECMAScript modules in Node.js](https://www.typescriptlang.org/docs/handbook/esm-node.html).
134
+ Unfortunately, not all bundlers and tools have caught up yet, and Deno
135
+ requires `.ts`. With this plugin option, you can replace `.js` extensions
136
+ in import paths with the given value. For example, set
137
+
138
+ - `import_extension=none` to remove the `.js` extension
139
+ - `import_extension=.ts` to replace the `.js` extension with `.ts`
140
+
126
141
 
127
142
  ### `keep_empty_files=true`
128
143
 
129
- By default, [protoc-gen-es](https://www.npmjs.com/package/@bufbuild/protoc-gen-es)
130
- (and all other plugins based on [@bufbuild/protoplugin](https://www.npmjs.com/package/@bufbuild/protoplugin))
131
- omit empty files from the plugin output. This option disables pruning of
132
- empty files, to allow for smooth interoperation with Bazel and similar
144
+ By default, [protoc-gen-es](https://www.npmjs.com/package/@bufbuild/protoc-gen-es)
145
+ (and all other plugins based on [@bufbuild/protoplugin](https://www.npmjs.com/package/@bufbuild/protoplugin))
146
+ omit empty files from the plugin output. This option disables pruning of
147
+ empty files, to allow for smooth interoperation with Bazel and similar
133
148
  tooling that requires all output files to be declared ahead of time.
134
149
  Unless you use Bazel, it is very unlikely that you need this option.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protoc-gen-es",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Protocol Buffers code generator for ECMAScript",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,10 +20,10 @@
20
20
  },
21
21
  "preferUnplugged": true,
22
22
  "dependencies": {
23
- "@bufbuild/protoplugin": "0.3.0"
23
+ "@bufbuild/protoplugin": "0.4.0"
24
24
  },
25
25
  "peerDependencies": {
26
- "@bufbuild/protobuf": "0.3.0"
26
+ "@bufbuild/protobuf": "0.4.0"
27
27
  },
28
28
  "peerDependenciesMeta": {
29
29
  "@bufbuild/protobuf": {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protoc-gen-es",
3
- "version": "0.3.0",
3
+ "version": "0.4.0",
4
4
  "description": "Protocol Buffers code generator for ECMAScript",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -20,10 +20,10 @@
20
20
  },
21
21
  "preferUnplugged": true,
22
22
  "dependencies": {
23
- "@bufbuild/protoplugin": "0.3.0"
23
+ "@bufbuild/protoplugin": "0.4.0"
24
24
  },
25
25
  "peerDependencies": {
26
- "@bufbuild/protobuf": "0.3.0"
26
+ "@bufbuild/protobuf": "0.4.0"
27
27
  },
28
28
  "peerDependenciesMeta": {
29
29
  "@bufbuild/protobuf": {