@bufbuild/protoplugin 1.7.0 → 1.7.2

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.
@@ -216,19 +216,26 @@ function processImports(el, importerPath, rewriteImportPath, makeImportStatement
216
216
  const foreignSymbols = [];
217
217
  // Walk through all symbols used and populate the collections above.
218
218
  for (const s of el) {
219
- if (typeof s != "object" || s.kind !== "es_symbol") {
219
+ if (typeof s != "object") {
220
220
  continue;
221
221
  }
222
- symbolToIdentifier.set(s.id, s.name);
223
- if (!s.typeOnly) {
224
- // a symbol is only type-imported as long as all uses are type-only
225
- symbolToIsValue.set(s.id, true);
226
- }
227
- if (s.from === importerPath) {
228
- identifiersTaken.add(s.name);
229
- }
230
- else {
231
- foreignSymbols.push(s);
222
+ switch (s.kind) {
223
+ case "es_symbol":
224
+ symbolToIdentifier.set(s.id, s.name);
225
+ if (!s.typeOnly) {
226
+ // a symbol is only type-imported as long as all uses are type-only
227
+ symbolToIsValue.set(s.id, true);
228
+ }
229
+ if (s.from === importerPath) {
230
+ identifiersTaken.add(s.name);
231
+ }
232
+ else {
233
+ foreignSymbols.push(s);
234
+ }
235
+ break;
236
+ case "es_export_stmt":
237
+ identifiersTaken.add(s.name);
238
+ break;
232
239
  }
233
240
  }
234
241
  // Walk through all foreign symbols and make their identifiers unique.
@@ -323,7 +330,7 @@ function literalBigint(value, runtimeImports) {
323
330
  }
324
331
  return [
325
332
  runtimeImports.protoInt64,
326
- ".parse(",
333
+ value > 0 ? ".uParse(" : ".parse(",
327
334
  (0, gencommon_js_1.literalString)(value.toString()),
328
335
  ")",
329
336
  ];
@@ -212,19 +212,26 @@ function processImports(el, importerPath, rewriteImportPath, makeImportStatement
212
212
  const foreignSymbols = [];
213
213
  // Walk through all symbols used and populate the collections above.
214
214
  for (const s of el) {
215
- if (typeof s != "object" || s.kind !== "es_symbol") {
215
+ if (typeof s != "object") {
216
216
  continue;
217
217
  }
218
- symbolToIdentifier.set(s.id, s.name);
219
- if (!s.typeOnly) {
220
- // a symbol is only type-imported as long as all uses are type-only
221
- symbolToIsValue.set(s.id, true);
222
- }
223
- if (s.from === importerPath) {
224
- identifiersTaken.add(s.name);
225
- }
226
- else {
227
- foreignSymbols.push(s);
218
+ switch (s.kind) {
219
+ case "es_symbol":
220
+ symbolToIdentifier.set(s.id, s.name);
221
+ if (!s.typeOnly) {
222
+ // a symbol is only type-imported as long as all uses are type-only
223
+ symbolToIsValue.set(s.id, true);
224
+ }
225
+ if (s.from === importerPath) {
226
+ identifiersTaken.add(s.name);
227
+ }
228
+ else {
229
+ foreignSymbols.push(s);
230
+ }
231
+ break;
232
+ case "es_export_stmt":
233
+ identifiersTaken.add(s.name);
234
+ break;
228
235
  }
229
236
  }
230
237
  // Walk through all foreign symbols and make their identifiers unique.
@@ -319,7 +326,7 @@ function literalBigint(value, runtimeImports) {
319
326
  }
320
327
  return [
321
328
  runtimeImports.protoInt64,
322
- ".parse(",
329
+ value > 0 ? ".uParse(" : ".parse(",
323
330
  literalString(value.toString()),
324
331
  ")",
325
332
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bufbuild/protoplugin",
3
- "version": "1.7.0",
3
+ "version": "1.7.2",
4
4
  "license": "(Apache-2.0 AND BSD-3-Clause)",
5
5
  "description": "Helps to create your own Protocol Buffers code generators.",
6
6
  "repository": {
@@ -47,7 +47,7 @@
47
47
  }
48
48
  },
49
49
  "dependencies": {
50
- "@bufbuild/protobuf": "1.7.0",
50
+ "@bufbuild/protobuf": "1.7.2",
51
51
  "@typescript/vfs": "^1.4.0",
52
52
  "typescript": "4.5.2"
53
53
  },