@caatinga/core 2.0.0 → 2.0.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.
- package/dist/index.cjs +22 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +23 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -143,7 +143,7 @@ function toCaatingaError(error) {
|
|
|
143
143
|
}
|
|
144
144
|
|
|
145
145
|
// src/version.ts
|
|
146
|
-
var CAATINGA_CORE_VERSION = "2.0.
|
|
146
|
+
var CAATINGA_CORE_VERSION = "2.0.2";
|
|
147
147
|
|
|
148
148
|
// src/config/config.schema.ts
|
|
149
149
|
var import_zod = require("zod");
|
|
@@ -1202,6 +1202,20 @@ async function deployContractGraph(options) {
|
|
|
1202
1202
|
// src/contracts/generate-bindings.ts
|
|
1203
1203
|
var import_promises5 = require("fs/promises");
|
|
1204
1204
|
var import_node_path7 = __toESM(require("path"), 1);
|
|
1205
|
+
function toBindingImportPath(bindingsOutput, contractName) {
|
|
1206
|
+
const normalized = bindingsOutput.replace(/^\.\//, "").split(import_node_path7.default.sep).join("/");
|
|
1207
|
+
return `./${import_node_path7.default.posix.join(normalized, contractName, "src", "index.js")}`;
|
|
1208
|
+
}
|
|
1209
|
+
async function removeLegacyBindingStub(cwd, bindingsOutput, contractName) {
|
|
1210
|
+
const legacyPath = import_node_path7.default.resolve(cwd, bindingsOutput, `${contractName}.ts`);
|
|
1211
|
+
try {
|
|
1212
|
+
await (0, import_promises5.access)(legacyPath);
|
|
1213
|
+
await (0, import_promises5.unlink)(legacyPath);
|
|
1214
|
+
return true;
|
|
1215
|
+
} catch {
|
|
1216
|
+
return false;
|
|
1217
|
+
}
|
|
1218
|
+
}
|
|
1205
1219
|
async function generateBindings(options) {
|
|
1206
1220
|
const cwd = options.cwd ?? process.cwd();
|
|
1207
1221
|
const network = resolveNetwork(options.config, options.networkName);
|
|
@@ -1231,10 +1245,17 @@ async function generateBindings(options) {
|
|
|
1231
1245
|
cwd,
|
|
1232
1246
|
failureCode: CaatingaErrorCode.BINDINGS_FAILED
|
|
1233
1247
|
});
|
|
1248
|
+
const legacyStubRemoved = await removeLegacyBindingStub(
|
|
1249
|
+
cwd,
|
|
1250
|
+
options.config.frontend.bindingsOutput,
|
|
1251
|
+
options.contractName
|
|
1252
|
+
);
|
|
1234
1253
|
return {
|
|
1235
1254
|
contractName: options.contractName,
|
|
1236
1255
|
network,
|
|
1237
1256
|
outputDir,
|
|
1257
|
+
importPath: toBindingImportPath(options.config.frontend.bindingsOutput, options.contractName),
|
|
1258
|
+
legacyStubRemoved,
|
|
1238
1259
|
output: result.all || result.stdout
|
|
1239
1260
|
};
|
|
1240
1261
|
}
|
package/dist/index.d.cts
CHANGED
|
@@ -2,7 +2,7 @@ import { C as CaatingaArtifacts, a as ContractArtifact, b as CaatingaErrorCodeVa
|
|
|
2
2
|
export { d as CaatingaArtifactsSchema, e as CaatingaErrorCode, t as toCaatingaError } from './browser-djYObNl8.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
declare const CAATINGA_CORE_VERSION = "2.0.
|
|
5
|
+
declare const CAATINGA_CORE_VERSION = "2.0.2";
|
|
6
6
|
|
|
7
7
|
declare const ContractConfigSchema: z.ZodObject<{
|
|
8
8
|
path: z.ZodString;
|
|
@@ -325,6 +325,8 @@ declare function generateBindings(options: GenerateBindingsOptions): Promise<{
|
|
|
325
325
|
contractName: string;
|
|
326
326
|
network: ResolvedNetwork;
|
|
327
327
|
outputDir: string;
|
|
328
|
+
importPath: string;
|
|
329
|
+
legacyStubRemoved: boolean;
|
|
328
330
|
output: string;
|
|
329
331
|
}>;
|
|
330
332
|
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { C as CaatingaArtifacts, a as ContractArtifact, b as CaatingaErrorCodeVa
|
|
|
2
2
|
export { d as CaatingaArtifactsSchema, e as CaatingaErrorCode, t as toCaatingaError } from './browser-djYObNl8.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
declare const CAATINGA_CORE_VERSION = "2.0.
|
|
5
|
+
declare const CAATINGA_CORE_VERSION = "2.0.2";
|
|
6
6
|
|
|
7
7
|
declare const ContractConfigSchema: z.ZodObject<{
|
|
8
8
|
path: z.ZodString;
|
|
@@ -325,6 +325,8 @@ declare function generateBindings(options: GenerateBindingsOptions): Promise<{
|
|
|
325
325
|
contractName: string;
|
|
326
326
|
network: ResolvedNetwork;
|
|
327
327
|
outputDir: string;
|
|
328
|
+
importPath: string;
|
|
329
|
+
legacyStubRemoved: boolean;
|
|
328
330
|
output: string;
|
|
329
331
|
}>;
|
|
330
332
|
|
package/dist/index.js
CHANGED
|
@@ -72,7 +72,7 @@ function toCaatingaError(error) {
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
// src/version.ts
|
|
75
|
-
var CAATINGA_CORE_VERSION = "2.0.
|
|
75
|
+
var CAATINGA_CORE_VERSION = "2.0.2";
|
|
76
76
|
|
|
77
77
|
// src/config/config.schema.ts
|
|
78
78
|
import { z } from "zod";
|
|
@@ -1128,8 +1128,22 @@ async function deployContractGraph(options) {
|
|
|
1128
1128
|
}
|
|
1129
1129
|
|
|
1130
1130
|
// src/contracts/generate-bindings.ts
|
|
1131
|
-
import { mkdir as mkdir2 } from "fs/promises";
|
|
1131
|
+
import { access as access3, mkdir as mkdir2, unlink } from "fs/promises";
|
|
1132
1132
|
import path7 from "path";
|
|
1133
|
+
function toBindingImportPath(bindingsOutput, contractName) {
|
|
1134
|
+
const normalized = bindingsOutput.replace(/^\.\//, "").split(path7.sep).join("/");
|
|
1135
|
+
return `./${path7.posix.join(normalized, contractName, "src", "index.js")}`;
|
|
1136
|
+
}
|
|
1137
|
+
async function removeLegacyBindingStub(cwd, bindingsOutput, contractName) {
|
|
1138
|
+
const legacyPath = path7.resolve(cwd, bindingsOutput, `${contractName}.ts`);
|
|
1139
|
+
try {
|
|
1140
|
+
await access3(legacyPath);
|
|
1141
|
+
await unlink(legacyPath);
|
|
1142
|
+
return true;
|
|
1143
|
+
} catch {
|
|
1144
|
+
return false;
|
|
1145
|
+
}
|
|
1146
|
+
}
|
|
1133
1147
|
async function generateBindings(options) {
|
|
1134
1148
|
const cwd = options.cwd ?? process.cwd();
|
|
1135
1149
|
const network = resolveNetwork(options.config, options.networkName);
|
|
@@ -1159,10 +1173,17 @@ async function generateBindings(options) {
|
|
|
1159
1173
|
cwd,
|
|
1160
1174
|
failureCode: CaatingaErrorCode.BINDINGS_FAILED
|
|
1161
1175
|
});
|
|
1176
|
+
const legacyStubRemoved = await removeLegacyBindingStub(
|
|
1177
|
+
cwd,
|
|
1178
|
+
options.config.frontend.bindingsOutput,
|
|
1179
|
+
options.contractName
|
|
1180
|
+
);
|
|
1162
1181
|
return {
|
|
1163
1182
|
contractName: options.contractName,
|
|
1164
1183
|
network,
|
|
1165
1184
|
outputDir,
|
|
1185
|
+
importPath: toBindingImportPath(options.config.frontend.bindingsOutput, options.contractName),
|
|
1186
|
+
legacyStubRemoved,
|
|
1166
1187
|
output: result.all || result.stdout
|
|
1167
1188
|
};
|
|
1168
1189
|
}
|