-
Notifications
You must be signed in to change notification settings - Fork 206
/
@cosmology+telescope+1.4.12.patch
183 lines (176 loc) · 8.29 KB
/
@cosmology+telescope+1.4.12.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
diff --git a/node_modules/@cosmology/telescope/main/generators/create-bundle.js b/node_modules/@cosmology/telescope/main/generators/create-bundle.js
index 22a4f0b..47b5ad9 100644
--- a/node_modules/@cosmology/telescope/main/generators/create-bundle.js
+++ b/node_modules/@cosmology/telescope/main/generators/create-bundle.js
@@ -6,6 +6,13 @@ const plugin = (builder, bundler) => {
if (!builder.options.bundle.enabled) {
return;
}
+ const importStmts = bundler.bundle.importPaths;
+ for (const stmt of importStmts) {
+ if (stmt.source.value.startsWith('.') && !stmt.source.value.endsWith('.js')) {
+ stmt.source.value += '.js';
+ }
+ }
+
// [x] bundle
const body = (0, ast_1.recursiveModuleBundle)(builder.options, bundler.bundle.bundleVariables);
const prog = []
diff --git a/node_modules/@cosmology/telescope/main/generators/create-rpc-msg-clients.js b/node_modules/@cosmology/telescope/main/generators/create-rpc-msg-clients.js
index f37a528..2f84d84 100644
--- a/node_modules/@cosmology/telescope/main/generators/create-rpc-msg-clients.js
+++ b/node_modules/@cosmology/telescope/main/generators/create-rpc-msg-clients.js
@@ -92,6 +92,7 @@ const plugin = (builder, bundler) => {
const serviceImports = (0, imports_1.getDepsFromQueries)(ctx.mutations, localname);
// TODO we do NOT need all imports...
const imports = (0, imports_1.buildAllImports)(ctx, serviceImports, localname);
+
const prog = []
.concat(imports)
.concat(ctx.body)
diff --git a/node_modules/@cosmology/telescope/main/generators/create-stargate-clients.js b/node_modules/@cosmology/telescope/main/generators/create-stargate-clients.js
index 7e75d9e..b593a81 100644
--- a/node_modules/@cosmology/telescope/main/generators/create-stargate-clients.js
+++ b/node_modules/@cosmology/telescope/main/generators/create-stargate-clients.js
@@ -30,6 +30,9 @@ const plugin = (builder, bundler) => {
let rel = (0, path_1.relative)((0, path_1.dirname)(clientFile), registry.localname);
if (!rel.startsWith('.'))
rel = `./${rel}`;
+ // if (!rel.endsWith('.js'))
+ // rel = `./${rel}.js`;
+
const variable = (0, utils_1.variableSlug)(registry.localname);
registryVariables.push(variable);
registryImports.push((0, ast_1.importNamespace)(variable, rel));
@@ -71,7 +74,13 @@ const plugin = (builder, bundler) => {
getTxRpc = (0, ast_1.createGetTxRpc)(ctx, txRpcName, name);
}
const imports = (0, imports_1.buildAllImportsFromGenericContext)(ctx, clientFile);
- let cProg = [...imports, ...registryImports, ...converterImports]
+ const importStmts = [...imports, ...registryImports, ...converterImports];
+ for (const stmt of importStmts) {
+ if (stmt.source.value.startsWith('.') && !stmt.source.value.endsWith('.js')) {
+ stmt.source.value += '.js';
+ }
+ }
+ let cProg = importStmts
.concat(aminos)
.concat(protos)
.concat(clientOptions)
diff --git a/node_modules/@cosmology/telescope/main/helpers/binary-coder.js b/node_modules/@cosmology/telescope/main/helpers/binary-coder.js
index 768b9c5..a456537 100644
--- a/node_modules/@cosmology/telescope/main/helpers/binary-coder.js
+++ b/node_modules/@cosmology/telescope/main/helpers/binary-coder.js
@@ -36,7 +36,7 @@ exports.binary = `
// standalone and requires a support library to be linked with it. This
// support library is itself covered by the above license.
-import { utf8Length, utf8Read, utf8Write } from "./utf8";
+import { utf8Length, utf8Read, utf8Write } from "./utf8.js";
import {
int64ToString,
readInt32,
@@ -52,7 +52,7 @@ import {
writeByte,
zzDecode,
zzEncode,
-} from "./varint";
+} from "./varint.js";
export enum WireType {
Varint = 0,
diff --git a/node_modules/@cosmology/telescope/main/utils/common-create-bundle.js b/node_modules/@cosmology/telescope/main/utils/common-create-bundle.js
index 87c1dbe..66bd4fc 100644
--- a/node_modules/@cosmology/telescope/main/utils/common-create-bundle.js
+++ b/node_modules/@cosmology/telescope/main/utils/common-create-bundle.js
@@ -8,6 +8,7 @@ const files_1 = require("../utils/files");
const utils_1 = require("../utils");
const proto_parser_1 = require("@cosmology/proto-parser");
const commonBundlePlugin = (builder, bundleFilename, packageMappings, astFn) => {
+ console.log('commonBundlePlugin');
const localname = bundleFilename;
// create proto ref for context
const pkg = '@root';
@@ -18,6 +19,7 @@ const commonBundlePlugin = (builder, bundleFilename, packageMappings, astFn) =>
const ast = astFn(pCtx.proto, packageMappings);
// generate imports added by context.addUtil
const imports = (0, utils_1.fixlocalpaths)((0, imports_1.aggregateImports)(pCtx, {}, localname));
+
const importStmts = (0, imports_1.getImportStatements)(localname, imports);
// construct the AST
const prog = [].concat(importStmts).concat(ast);
diff --git a/node_modules/@cosmology/telescope/main/utils/index.js b/node_modules/@cosmology/telescope/main/utils/index.js
index 5527e77..20bb1ce 100644
--- a/node_modules/@cosmology/telescope/main/utils/index.js
+++ b/node_modules/@cosmology/telescope/main/utils/index.js
@@ -130,7 +130,7 @@ const getRelativePath = (f1, f2) => {
let importPath = rel.replace((0, path_1.extname)(rel), '');
if (!/^\./.test(importPath))
importPath = `./${importPath}`;
- return importPath;
+ return `${importPath}.js`;
};
exports.getRelativePath = getRelativePath;
__exportStar(require("./common-create-bundle"), exports);
diff --git a/node_modules/@cosmology/telescope/module/helpers/binary-coder.js b/node_modules/@cosmology/telescope/module/helpers/binary-coder.js
index d61377a..76fb6b0 100644
--- a/node_modules/@cosmology/telescope/module/helpers/binary-coder.js
+++ b/node_modules/@cosmology/telescope/module/helpers/binary-coder.js
@@ -33,7 +33,7 @@ export const binary = `
// standalone and requires a support library to be linked with it. This
// support library is itself covered by the above license.
-import { utf8Length, utf8Read, utf8Write } from "./utf8";
+import { utf8Length, utf8Read, utf8Write } from "./utf8.js";
import {
int64ToString,
readInt32,
@@ -49,7 +49,7 @@ import {
writeByte,
zzDecode,
zzEncode,
-} from "./varint";
+} from "./varint.js";
export enum WireType {
Varint = 0,
diff --git a/node_modules/@cosmology/telescope/module/utils/index.js b/node_modules/@cosmology/telescope/module/utils/index.js
index 2348081..b7621eb 100644
--- a/node_modules/@cosmology/telescope/module/utils/index.js
+++ b/node_modules/@cosmology/telescope/module/utils/index.js
@@ -111,6 +111,6 @@ export const getRelativePath = (f1, f2) => {
let importPath = rel.replace(extname(rel), '');
if (!/^\./.test(importPath))
importPath = `./${importPath}`;
- return importPath;
+ return `${importPath}.js`;
};
export * from './common-create-bundle';
diff --git a/node_modules/@cosmology/telescope/src/helpers/binary-coder.ts b/node_modules/@cosmology/telescope/src/helpers/binary-coder.ts
index d61377a..76fb6b0 100644
--- a/node_modules/@cosmology/telescope/src/helpers/binary-coder.ts
+++ b/node_modules/@cosmology/telescope/src/helpers/binary-coder.ts
@@ -33,7 +33,7 @@ export const binary = `
// standalone and requires a support library to be linked with it. This
// support library is itself covered by the above license.
-import { utf8Length, utf8Read, utf8Write } from "./utf8";
+import { utf8Length, utf8Read, utf8Write } from "./utf8.js";
import {
int64ToString,
readInt32,
@@ -49,7 +49,7 @@ import {
writeByte,
zzDecode,
zzEncode,
-} from "./varint";
+} from "./varint.js";
export enum WireType {
Varint = 0,
diff --git a/node_modules/@cosmology/telescope/src/utils/index.ts b/node_modules/@cosmology/telescope/src/utils/index.ts
index ca1c186..cb60a50 100644
--- a/node_modules/@cosmology/telescope/src/utils/index.ts
+++ b/node_modules/@cosmology/telescope/src/utils/index.ts
@@ -117,7 +117,7 @@ export const getRelativePath = (f1: string, f2: string) => {
const rel = relative(dirname(f1), f2);
let importPath = rel.replace(extname(rel), '');
if (!/^\./.test(importPath)) importPath = `./${importPath}`;
- return importPath;
+ return `${importPath}.js`;
}
export * from './common-create-bundle';