ts-proto 1.154.0 → 1.155.1
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/build/main.js +3 -19
- package/build/options.js +6 -3
- package/package.json +3 -3
package/build/main.js
CHANGED
|
@@ -310,29 +310,13 @@ function makeProtobufStructWrapper(options) {
|
|
|
310
310
|
function makeLongUtils(options, bytes) {
|
|
311
311
|
// Regardless of which `forceLong` config option we're using, we always use
|
|
312
312
|
// the `long` library to either represent or at least sanity-check 64-bit values
|
|
313
|
-
const util = (0, utils_1.impFile)(options,
|
|
314
|
-
const configure = (0, utils_1.impFile)(options,
|
|
315
|
-
|
|
316
|
-
// an `export =` module and exports only the Long constructor (which is callable).
|
|
317
|
-
// See https://www.typescriptlang.org/docs/handbook/modules.html#export--and-import--require.
|
|
318
|
-
//
|
|
319
|
-
// With esModuleInterop on, `* as Long` is no longer the constructor, it's the module,
|
|
320
|
-
// so we want to go back to `import { Long } from long`, which is specifically forbidden
|
|
321
|
-
// due to `export =` w/o esModuleInterop.
|
|
322
|
-
//
|
|
323
|
-
// I.e there is not an import for long that "just works" in both esModuleInterop and
|
|
324
|
-
// not esModuleInterop.
|
|
325
|
-
const LongImp = options.esModuleInterop ? (0, ts_poet_1.imp)("Long=long") : (0, ts_poet_1.imp)("Long*long");
|
|
326
|
-
const disclaimer = options.esModuleInterop
|
|
327
|
-
? ""
|
|
328
|
-
: `
|
|
329
|
-
// If you get a compile-error about 'Constructor<Long> and ... have no overlap',
|
|
330
|
-
// add '--ts_proto_opt=esModuleInterop=true' as a flag when calling 'protoc'.`;
|
|
313
|
+
const util = (0, utils_1.impFile)(options, `util@protobufjs/minimal`);
|
|
314
|
+
const configure = (0, utils_1.impFile)(options, `configure@protobufjs/minimal`);
|
|
315
|
+
const LongImp = (0, ts_poet_1.imp)("Long=long");
|
|
331
316
|
// Instead of exposing `LongImp` directly, let callers think that they are getting the
|
|
332
317
|
// `imp(Long)` but really it is that + our long initialization snippet. This means the
|
|
333
318
|
// initialization code will only be emitted in files that actually use the Long import.
|
|
334
319
|
const Long = (0, ts_poet_1.conditionalOutput)("Long", (0, ts_poet_1.code) `
|
|
335
|
-
${disclaimer}
|
|
336
320
|
if (${util}.Long !== ${LongImp}) {
|
|
337
321
|
${util}.Long = ${LongImp} as any;
|
|
338
322
|
${configure}();
|
package/build/options.js
CHANGED
|
@@ -202,12 +202,15 @@ function parseParameter(parameter) {
|
|
|
202
202
|
function parseParamValue(value) {
|
|
203
203
|
return value === "true" ? true : value === "false" ? false : value;
|
|
204
204
|
}
|
|
205
|
-
function getTsPoetOpts(
|
|
206
|
-
const
|
|
205
|
+
function getTsPoetOpts(options) {
|
|
206
|
+
const { importSuffix, esModuleInterop } = options;
|
|
207
|
+
const pbjs = "protobufjs/minimal" + importSuffix;
|
|
207
208
|
return {
|
|
208
209
|
prefix: `/* eslint-disable */`,
|
|
209
210
|
dprintOptions: { preferSingleLine: true, lineWidth: 120 },
|
|
210
|
-
|
|
211
|
+
forceRequireImport: esModuleInterop ? [] : ["long"],
|
|
212
|
+
forceDefaultImport: esModuleInterop ? [pbjs] : [],
|
|
213
|
+
forceModuleImport: esModuleInterop ? [] : [pbjs],
|
|
211
214
|
};
|
|
212
215
|
}
|
|
213
216
|
exports.getTsPoetOpts = getTsPoetOpts;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-proto",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.155.1",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "build/plugin.js",
|
|
6
6
|
"repository": "github:stephenh/ts-proto",
|
|
@@ -67,8 +67,8 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"case-anything": "^2.1.13",
|
|
69
69
|
"protobufjs": "^7.2.4",
|
|
70
|
-
"ts-poet": "^6.
|
|
71
|
-
"ts-proto-descriptors": "1.
|
|
70
|
+
"ts-poet": "^6.5.0",
|
|
71
|
+
"ts-proto-descriptors": "1.14.0"
|
|
72
72
|
},
|
|
73
73
|
"packageManager": "yarn@3.6.0"
|
|
74
74
|
}
|