ts-proto 1.167.0 → 1.167.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 +8 -0
- package/package.json +1 -1
package/build/main.js
CHANGED
|
@@ -249,6 +249,14 @@ function generateFile(ctx, fileDesc) {
|
|
|
249
249
|
if (options.outputSchema) {
|
|
250
250
|
chunks.push(...(0, schema_1.generateSchema)(ctx, fileDesc, sourceInfo));
|
|
251
251
|
}
|
|
252
|
+
// https://www.typescriptlang.org/docs/handbook/2/modules.html:
|
|
253
|
+
// > In TypeScript, just as in ECMAScript 2015, any file containing a top-level import or export is considered a module.
|
|
254
|
+
// > Conversely, a file without any top-level import or export declarations is treated as a script whose contents are available in the global scope (and therefore to modules as well).
|
|
255
|
+
//
|
|
256
|
+
// Thus, to mark an empty file a module, we need to add `export {}` to it.
|
|
257
|
+
if (options.esModuleInterop && chunks.length === 0) {
|
|
258
|
+
chunks.push((0, ts_poet_1.code) `export {};`);
|
|
259
|
+
}
|
|
252
260
|
chunks.push(...Object.values(utils).map((v) => {
|
|
253
261
|
if (v instanceof ConditionalOutput_1.ConditionalOutput) {
|
|
254
262
|
return (0, ts_poet_1.code) `${v.ifUsed}`;
|