@latticexyz/cli 1.31.0 → 1.31.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/dist/commands/call-system.js +9 -7
- package/dist/commands/codegen-libdeploy.js +18 -17
- package/dist/commands/create.js +9 -7
- package/dist/commands/deploy-contracts.js +57 -40
- package/dist/commands/deploy.js +47 -38
- package/dist/commands/devnode.js +9 -7
- package/dist/commands/diamond-abi.js +9 -7
- package/dist/commands/sync-art.js +9 -7
- package/dist/commands/system-types.js +9 -7
- package/dist/commands/test.js +19 -18
- package/dist/commands/trace.js +9 -7
- package/dist/commands/types.js +14 -8
- package/package.json +6 -6
- package/src/commands/codegen-libdeploy.ts +0 -2
- package/src/utils/build.ts +6 -6
- package/src/utils/codegen.ts +6 -4
- package/src/utils/deploy.ts +2 -3
- package/src/utils/hsr.ts +15 -5
|
@@ -41559,7 +41559,7 @@ ${error.message}`;
|
|
|
41559
41559
|
Object.defineProperty(exports2, "__esModule", {
|
|
41560
41560
|
value: true
|
|
41561
41561
|
});
|
|
41562
|
-
exports2.readFile =
|
|
41562
|
+
exports2.readFile = readFile2;
|
|
41563
41563
|
exports2.readFileSync = readFileSync;
|
|
41564
41564
|
var _fs = _interopRequireDefault(require("fs"));
|
|
41565
41565
|
function _interopRequireDefault(obj) {
|
|
@@ -41578,7 +41578,7 @@ ${error.message}`;
|
|
|
41578
41578
|
});
|
|
41579
41579
|
});
|
|
41580
41580
|
}
|
|
41581
|
-
async function
|
|
41581
|
+
async function readFile2(filepath, options = {}) {
|
|
41582
41582
|
const throwNotFound = options.throwNotFound === true;
|
|
41583
41583
|
try {
|
|
41584
41584
|
const content = await fsReadFileAsync(filepath, "utf8");
|
|
@@ -170859,8 +170859,8 @@ ${error.message}`;
|
|
|
170859
170859
|
cb(null, x);
|
|
170860
170860
|
}
|
|
170861
170861
|
};
|
|
170862
|
-
var defaultReadPackage = function defaultReadPackage2(
|
|
170863
|
-
|
|
170862
|
+
var defaultReadPackage = function defaultReadPackage2(readFile2, pkgfile, cb) {
|
|
170863
|
+
readFile2(pkgfile, function(readFileErr, body) {
|
|
170864
170864
|
if (readFileErr)
|
|
170865
170865
|
cb(readFileErr);
|
|
170866
170866
|
else {
|
|
@@ -170896,7 +170896,7 @@ ${error.message}`;
|
|
|
170896
170896
|
opts = normalizeOptions(x, opts);
|
|
170897
170897
|
var isFile = opts.isFile || defaultIsFile;
|
|
170898
170898
|
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
170899
|
-
var
|
|
170899
|
+
var readFile2 = opts.readFile || fs.readFile;
|
|
170900
170900
|
var realpath = opts.realpath || defaultRealpath;
|
|
170901
170901
|
var readPackage = opts.readPackage || defaultReadPackage;
|
|
170902
170902
|
if (opts.readFile && opts.readPackage) {
|
|
@@ -171028,7 +171028,7 @@ ${error.message}`;
|
|
|
171028
171028
|
isFile(pkgfile, function(err2, ex) {
|
|
171029
171029
|
if (!ex)
|
|
171030
171030
|
return loadpkg(path2.dirname(dir), cb2);
|
|
171031
|
-
readPackage(
|
|
171031
|
+
readPackage(readFile2, pkgfile, function(err3, pkgParam) {
|
|
171032
171032
|
if (err3)
|
|
171033
171033
|
cb2(err3);
|
|
171034
171034
|
var pkg = pkgParam;
|
|
@@ -171056,7 +171056,7 @@ ${error.message}`;
|
|
|
171056
171056
|
return cb2(err2);
|
|
171057
171057
|
if (!ex)
|
|
171058
171058
|
return loadAsFile(path2.join(x2, "index"), fpkg, cb2);
|
|
171059
|
-
readPackage(
|
|
171059
|
+
readPackage(readFile2, pkgfile, function(err3, pkgParam) {
|
|
171060
171060
|
if (err3)
|
|
171061
171061
|
return cb2(err3);
|
|
171062
171062
|
var pkg = pkgParam;
|
|
@@ -204023,9 +204023,11 @@ function execLog(command2, options) {
|
|
|
204023
204023
|
var IDregex = new RegExp(new RegExp('(?<=uint256 constant ID = uint256\\(keccak256\\(")(.*)(?="\\))'));
|
|
204024
204024
|
|
|
204025
204025
|
// src/utils/codegen.ts
|
|
204026
|
+
var import_promises = require("fs/promises");
|
|
204026
204027
|
var import_ejs = __toESM(require_ejs());
|
|
204027
204028
|
var import_path = __toESM(require("path"));
|
|
204028
204029
|
var contractsDir = import_path.default.join(__dirname, "../../src/contracts");
|
|
204030
|
+
var stubLibDeploy = (0, import_promises.readFile)(import_path.default.join(contractsDir, "LibDeploy.sol"));
|
|
204029
204031
|
|
|
204030
204032
|
// src/utils/types.ts
|
|
204031
204033
|
var import_typechain = __toESM(require_dist());
|
|
@@ -18305,8 +18305,8 @@ ${error.message}`;
|
|
|
18305
18305
|
Object.defineProperty(exports2, "__esModule", {
|
|
18306
18306
|
value: true
|
|
18307
18307
|
});
|
|
18308
|
-
exports2.readFile =
|
|
18309
|
-
exports2.readFileSync =
|
|
18308
|
+
exports2.readFile = readFile2;
|
|
18309
|
+
exports2.readFileSync = readFileSync;
|
|
18310
18310
|
var _fs = _interopRequireDefault(require("fs"));
|
|
18311
18311
|
function _interopRequireDefault(obj) {
|
|
18312
18312
|
return obj && obj.__esModule ? obj : {
|
|
@@ -18324,7 +18324,7 @@ ${error.message}`;
|
|
|
18324
18324
|
});
|
|
18325
18325
|
});
|
|
18326
18326
|
}
|
|
18327
|
-
async function
|
|
18327
|
+
async function readFile2(filepath, options = {}) {
|
|
18328
18328
|
const throwNotFound = options.throwNotFound === true;
|
|
18329
18329
|
try {
|
|
18330
18330
|
const content = await fsReadFileAsync(filepath, "utf8");
|
|
@@ -18336,7 +18336,7 @@ ${error.message}`;
|
|
|
18336
18336
|
throw error;
|
|
18337
18337
|
}
|
|
18338
18338
|
}
|
|
18339
|
-
function
|
|
18339
|
+
function readFileSync(filepath, options = {}) {
|
|
18340
18340
|
const throwNotFound = options.throwNotFound === true;
|
|
18341
18341
|
try {
|
|
18342
18342
|
const content = _fs.default.readFileSync(filepath, "utf8");
|
|
@@ -147605,8 +147605,8 @@ ${error.message}`;
|
|
|
147605
147605
|
cb(null, x);
|
|
147606
147606
|
}
|
|
147607
147607
|
};
|
|
147608
|
-
var defaultReadPackage = function defaultReadPackage2(
|
|
147609
|
-
|
|
147608
|
+
var defaultReadPackage = function defaultReadPackage2(readFile2, pkgfile, cb) {
|
|
147609
|
+
readFile2(pkgfile, function(readFileErr, body) {
|
|
147610
147610
|
if (readFileErr)
|
|
147611
147611
|
cb(readFileErr);
|
|
147612
147612
|
else {
|
|
@@ -147642,7 +147642,7 @@ ${error.message}`;
|
|
|
147642
147642
|
opts = normalizeOptions(x, opts);
|
|
147643
147643
|
var isFile = opts.isFile || defaultIsFile;
|
|
147644
147644
|
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
147645
|
-
var
|
|
147645
|
+
var readFile2 = opts.readFile || fs.readFile;
|
|
147646
147646
|
var realpath = opts.realpath || defaultRealpath;
|
|
147647
147647
|
var readPackage = opts.readPackage || defaultReadPackage;
|
|
147648
147648
|
if (opts.readFile && opts.readPackage) {
|
|
@@ -147774,7 +147774,7 @@ ${error.message}`;
|
|
|
147774
147774
|
isFile(pkgfile, function(err2, ex) {
|
|
147775
147775
|
if (!ex)
|
|
147776
147776
|
return loadpkg(path2.dirname(dir), cb2);
|
|
147777
|
-
readPackage(
|
|
147777
|
+
readPackage(readFile2, pkgfile, function(err3, pkgParam) {
|
|
147778
147778
|
if (err3)
|
|
147779
147779
|
cb2(err3);
|
|
147780
147780
|
var pkg = pkgParam;
|
|
@@ -147802,7 +147802,7 @@ ${error.message}`;
|
|
|
147802
147802
|
return cb2(err2);
|
|
147803
147803
|
if (!ex)
|
|
147804
147804
|
return loadAsFile(path2.join(x2, "index"), fpkg, cb2);
|
|
147805
|
-
readPackage(
|
|
147805
|
+
readPackage(readFile2, pkgfile, function(err3, pkgParam) {
|
|
147806
147806
|
if (err3)
|
|
147807
147807
|
return cb2(err3);
|
|
147808
147808
|
var pkg = pkgParam;
|
|
@@ -148154,8 +148154,8 @@ ${error.message}`;
|
|
|
148154
148154
|
}
|
|
148155
148155
|
return x;
|
|
148156
148156
|
};
|
|
148157
|
-
var defaultReadPackageSync = function defaultReadPackageSync2(
|
|
148158
|
-
var body =
|
|
148157
|
+
var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync, pkgfile) {
|
|
148158
|
+
var body = readFileSync(pkgfile);
|
|
148159
148159
|
try {
|
|
148160
148160
|
var pkg = JSON.parse(body);
|
|
148161
148161
|
return pkg;
|
|
@@ -148175,7 +148175,7 @@ ${error.message}`;
|
|
|
148175
148175
|
}
|
|
148176
148176
|
var opts = normalizeOptions(x, options);
|
|
148177
148177
|
var isFile = opts.isFile || defaultIsFile;
|
|
148178
|
-
var
|
|
148178
|
+
var readFileSync = opts.readFileSync || fs.readFileSync;
|
|
148179
148179
|
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
148180
148180
|
var realpathSync = opts.realpathSync || defaultRealpathSync;
|
|
148181
148181
|
var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
|
@@ -148237,7 +148237,7 @@ ${error.message}`;
|
|
|
148237
148237
|
if (!isFile(pkgfile)) {
|
|
148238
148238
|
return loadpkg(path2.dirname(dir));
|
|
148239
148239
|
}
|
|
148240
|
-
var pkg = readPackageSync(
|
|
148240
|
+
var pkg = readPackageSync(readFileSync, pkgfile);
|
|
148241
148241
|
if (pkg && opts.packageFilter) {
|
|
148242
148242
|
pkg = opts.packageFilter(pkg, dir);
|
|
148243
148243
|
}
|
|
@@ -148250,7 +148250,7 @@ ${error.message}`;
|
|
|
148250
148250
|
var pkgfile = path2.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
|
|
148251
148251
|
if (isFile(pkgfile)) {
|
|
148252
148252
|
try {
|
|
148253
|
-
var pkg = readPackageSync(
|
|
148253
|
+
var pkg = readPackageSync(readFileSync, pkgfile);
|
|
148254
148254
|
} catch (e) {
|
|
148255
148255
|
}
|
|
148256
148256
|
if (pkg && opts.packageFilter) {
|
|
@@ -180789,13 +180789,14 @@ module.exports = __toCommonJS(codegen_libdeploy_exports);
|
|
|
180789
180789
|
var IDregex = new RegExp(new RegExp('(?<=uint256 constant ID = uint256\\(keccak256\\(")(.*)(?="\\))'));
|
|
180790
180790
|
|
|
180791
180791
|
// src/utils/codegen.ts
|
|
180792
|
-
var
|
|
180792
|
+
var import_promises = require("fs/promises");
|
|
180793
180793
|
var import_ejs = __toESM(require_ejs());
|
|
180794
180794
|
var import_path = __toESM(require("path"));
|
|
180795
180795
|
var contractsDir = import_path.default.join(__dirname, "../../src/contracts");
|
|
180796
|
+
var stubLibDeploy = (0, import_promises.readFile)(import_path.default.join(contractsDir, "LibDeploy.sol"));
|
|
180796
180797
|
function generateLibDeploy(configPath, out, systems) {
|
|
180797
180798
|
return __async(this, null, function* () {
|
|
180798
|
-
const config = JSON.parse((0,
|
|
180799
|
+
const config = JSON.parse(yield (0, import_promises.readFile)(configPath, { encoding: "utf8" }));
|
|
180799
180800
|
if (systems) {
|
|
180800
180801
|
const systemsArray = Array.isArray(systems) ? systems : [systems];
|
|
180801
180802
|
config.systems = config.systems.filter((system) => systemsArray.includes(system.name));
|
|
@@ -180805,7 +180806,7 @@ function generateLibDeploy(configPath, out, systems) {
|
|
|
180805
180806
|
console.log("Generating deployment script");
|
|
180806
180807
|
const LibDeploy = yield import_ejs.default.renderFile(import_path.default.join(contractsDir, "LibDeploy.ejs"), config, { async: true });
|
|
180807
180808
|
const libDeployPath = import_path.default.join(out, "LibDeploy.sol");
|
|
180808
|
-
(0,
|
|
180809
|
+
yield (0, import_promises.writeFile)(libDeployPath, LibDeploy);
|
|
180809
180810
|
return libDeployPath;
|
|
180810
180811
|
});
|
|
180811
180812
|
}
|
package/dist/commands/create.js
CHANGED
|
@@ -18305,7 +18305,7 @@ ${error.message}`;
|
|
|
18305
18305
|
Object.defineProperty(exports2, "__esModule", {
|
|
18306
18306
|
value: true
|
|
18307
18307
|
});
|
|
18308
|
-
exports2.readFile =
|
|
18308
|
+
exports2.readFile = readFile2;
|
|
18309
18309
|
exports2.readFileSync = readFileSync;
|
|
18310
18310
|
var _fs = _interopRequireDefault(require("fs"));
|
|
18311
18311
|
function _interopRequireDefault(obj) {
|
|
@@ -18324,7 +18324,7 @@ ${error.message}`;
|
|
|
18324
18324
|
});
|
|
18325
18325
|
});
|
|
18326
18326
|
}
|
|
18327
|
-
async function
|
|
18327
|
+
async function readFile2(filepath, options = {}) {
|
|
18328
18328
|
const throwNotFound = options.throwNotFound === true;
|
|
18329
18329
|
try {
|
|
18330
18330
|
const content = await fsReadFileAsync(filepath, "utf8");
|
|
@@ -147605,8 +147605,8 @@ ${error.message}`;
|
|
|
147605
147605
|
cb(null, x);
|
|
147606
147606
|
}
|
|
147607
147607
|
};
|
|
147608
|
-
var defaultReadPackage = function defaultReadPackage2(
|
|
147609
|
-
|
|
147608
|
+
var defaultReadPackage = function defaultReadPackage2(readFile2, pkgfile, cb) {
|
|
147609
|
+
readFile2(pkgfile, function(readFileErr, body) {
|
|
147610
147610
|
if (readFileErr)
|
|
147611
147611
|
cb(readFileErr);
|
|
147612
147612
|
else {
|
|
@@ -147642,7 +147642,7 @@ ${error.message}`;
|
|
|
147642
147642
|
opts = normalizeOptions(x, opts);
|
|
147643
147643
|
var isFile = opts.isFile || defaultIsFile;
|
|
147644
147644
|
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
147645
|
-
var
|
|
147645
|
+
var readFile2 = opts.readFile || fs.readFile;
|
|
147646
147646
|
var realpath = opts.realpath || defaultRealpath;
|
|
147647
147647
|
var readPackage = opts.readPackage || defaultReadPackage;
|
|
147648
147648
|
if (opts.readFile && opts.readPackage) {
|
|
@@ -147774,7 +147774,7 @@ ${error.message}`;
|
|
|
147774
147774
|
isFile(pkgfile, function(err2, ex) {
|
|
147775
147775
|
if (!ex)
|
|
147776
147776
|
return loadpkg(path2.dirname(dir), cb2);
|
|
147777
|
-
readPackage(
|
|
147777
|
+
readPackage(readFile2, pkgfile, function(err3, pkgParam) {
|
|
147778
147778
|
if (err3)
|
|
147779
147779
|
cb2(err3);
|
|
147780
147780
|
var pkg = pkgParam;
|
|
@@ -147802,7 +147802,7 @@ ${error.message}`;
|
|
|
147802
147802
|
return cb2(err2);
|
|
147803
147803
|
if (!ex)
|
|
147804
147804
|
return loadAsFile(path2.join(x2, "index"), fpkg, cb2);
|
|
147805
|
-
readPackage(
|
|
147805
|
+
readPackage(readFile2, pkgfile, function(err3, pkgParam) {
|
|
147806
147806
|
if (err3)
|
|
147807
147807
|
return cb2(err3);
|
|
147808
147808
|
var pkg = pkgParam;
|
|
@@ -180815,9 +180815,11 @@ function execLog(command2, options) {
|
|
|
180815
180815
|
var IDregex = new RegExp(new RegExp('(?<=uint256 constant ID = uint256\\(keccak256\\(")(.*)(?="\\))'));
|
|
180816
180816
|
|
|
180817
180817
|
// src/utils/codegen.ts
|
|
180818
|
+
var import_promises = require("fs/promises");
|
|
180818
180819
|
var import_ejs = __toESM(require_ejs());
|
|
180819
180820
|
var import_path = __toESM(require("path"));
|
|
180820
180821
|
var contractsDir = import_path.default.join(__dirname, "../../src/contracts");
|
|
180822
|
+
var stubLibDeploy = (0, import_promises.readFile)(import_path.default.join(contractsDir, "LibDeploy.sol"));
|
|
180821
180823
|
|
|
180822
180824
|
// src/utils/types.ts
|
|
180823
180825
|
var import_typechain = __toESM(require_dist());
|
|
@@ -53750,8 +53750,8 @@ ${error.message}`;
|
|
|
53750
53750
|
Object.defineProperty(exports2, "__esModule", {
|
|
53751
53751
|
value: true
|
|
53752
53752
|
});
|
|
53753
|
-
exports2.readFile =
|
|
53754
|
-
exports2.readFileSync =
|
|
53753
|
+
exports2.readFile = readFile2;
|
|
53754
|
+
exports2.readFileSync = readFileSync3;
|
|
53755
53755
|
var _fs = _interopRequireDefault(require("fs"));
|
|
53756
53756
|
function _interopRequireDefault(obj) {
|
|
53757
53757
|
return obj && obj.__esModule ? obj : {
|
|
@@ -53769,7 +53769,7 @@ ${error.message}`;
|
|
|
53769
53769
|
});
|
|
53770
53770
|
});
|
|
53771
53771
|
}
|
|
53772
|
-
async function
|
|
53772
|
+
async function readFile2(filepath, options = {}) {
|
|
53773
53773
|
const throwNotFound = options.throwNotFound === true;
|
|
53774
53774
|
try {
|
|
53775
53775
|
const content = await fsReadFileAsync(filepath, "utf8");
|
|
@@ -53781,7 +53781,7 @@ ${error.message}`;
|
|
|
53781
53781
|
throw error;
|
|
53782
53782
|
}
|
|
53783
53783
|
}
|
|
53784
|
-
function
|
|
53784
|
+
function readFileSync3(filepath, options = {}) {
|
|
53785
53785
|
const throwNotFound = options.throwNotFound === true;
|
|
53786
53786
|
try {
|
|
53787
53787
|
const content = _fs.default.readFileSync(filepath, "utf8");
|
|
@@ -183050,8 +183050,8 @@ ${error.message}`;
|
|
|
183050
183050
|
cb(null, x);
|
|
183051
183051
|
}
|
|
183052
183052
|
};
|
|
183053
|
-
var defaultReadPackage = function defaultReadPackage2(
|
|
183054
|
-
|
|
183053
|
+
var defaultReadPackage = function defaultReadPackage2(readFile2, pkgfile, cb) {
|
|
183054
|
+
readFile2(pkgfile, function(readFileErr, body) {
|
|
183055
183055
|
if (readFileErr)
|
|
183056
183056
|
cb(readFileErr);
|
|
183057
183057
|
else {
|
|
@@ -183087,7 +183087,7 @@ ${error.message}`;
|
|
|
183087
183087
|
opts = normalizeOptions(x, opts);
|
|
183088
183088
|
var isFile = opts.isFile || defaultIsFile;
|
|
183089
183089
|
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
183090
|
-
var
|
|
183090
|
+
var readFile2 = opts.readFile || fs.readFile;
|
|
183091
183091
|
var realpath = opts.realpath || defaultRealpath;
|
|
183092
183092
|
var readPackage = opts.readPackage || defaultReadPackage;
|
|
183093
183093
|
if (opts.readFile && opts.readPackage) {
|
|
@@ -183219,7 +183219,7 @@ ${error.message}`;
|
|
|
183219
183219
|
isFile(pkgfile, function(err2, ex) {
|
|
183220
183220
|
if (!ex)
|
|
183221
183221
|
return loadpkg(path6.dirname(dir), cb2);
|
|
183222
|
-
readPackage(
|
|
183222
|
+
readPackage(readFile2, pkgfile, function(err3, pkgParam) {
|
|
183223
183223
|
if (err3)
|
|
183224
183224
|
cb2(err3);
|
|
183225
183225
|
var pkg = pkgParam;
|
|
@@ -183247,7 +183247,7 @@ ${error.message}`;
|
|
|
183247
183247
|
return cb2(err2);
|
|
183248
183248
|
if (!ex)
|
|
183249
183249
|
return loadAsFile(path6.join(x2, "index"), fpkg, cb2);
|
|
183250
|
-
readPackage(
|
|
183250
|
+
readPackage(readFile2, pkgfile, function(err3, pkgParam) {
|
|
183251
183251
|
if (err3)
|
|
183252
183252
|
return cb2(err3);
|
|
183253
183253
|
var pkg = pkgParam;
|
|
@@ -183599,8 +183599,8 @@ ${error.message}`;
|
|
|
183599
183599
|
}
|
|
183600
183600
|
return x;
|
|
183601
183601
|
};
|
|
183602
|
-
var defaultReadPackageSync = function defaultReadPackageSync2(
|
|
183603
|
-
var body =
|
|
183602
|
+
var defaultReadPackageSync = function defaultReadPackageSync2(readFileSync3, pkgfile) {
|
|
183603
|
+
var body = readFileSync3(pkgfile);
|
|
183604
183604
|
try {
|
|
183605
183605
|
var pkg = JSON.parse(body);
|
|
183606
183606
|
return pkg;
|
|
@@ -183620,7 +183620,7 @@ ${error.message}`;
|
|
|
183620
183620
|
}
|
|
183621
183621
|
var opts = normalizeOptions(x, options);
|
|
183622
183622
|
var isFile = opts.isFile || defaultIsFile;
|
|
183623
|
-
var
|
|
183623
|
+
var readFileSync3 = opts.readFileSync || fs.readFileSync;
|
|
183624
183624
|
var isDirectory = opts.isDirectory || defaultIsDir;
|
|
183625
183625
|
var realpathSync = opts.realpathSync || defaultRealpathSync;
|
|
183626
183626
|
var readPackageSync = opts.readPackageSync || defaultReadPackageSync;
|
|
@@ -183682,7 +183682,7 @@ ${error.message}`;
|
|
|
183682
183682
|
if (!isFile(pkgfile)) {
|
|
183683
183683
|
return loadpkg(path6.dirname(dir));
|
|
183684
183684
|
}
|
|
183685
|
-
var pkg = readPackageSync(
|
|
183685
|
+
var pkg = readPackageSync(readFileSync3, pkgfile);
|
|
183686
183686
|
if (pkg && opts.packageFilter) {
|
|
183687
183687
|
pkg = opts.packageFilter(pkg, dir);
|
|
183688
183688
|
}
|
|
@@ -183695,7 +183695,7 @@ ${error.message}`;
|
|
|
183695
183695
|
var pkgfile = path6.join(maybeRealpathSync(realpathSync, x2, opts), "/package.json");
|
|
183696
183696
|
if (isFile(pkgfile)) {
|
|
183697
183697
|
try {
|
|
183698
|
-
var pkg = readPackageSync(
|
|
183698
|
+
var pkg = readPackageSync(readFileSync3, pkgfile);
|
|
183699
183699
|
} catch (e) {
|
|
183700
183700
|
}
|
|
183701
183701
|
if (pkg && opts.packageFilter) {
|
|
@@ -216275,13 +216275,14 @@ function extractIdFromFile(path6) {
|
|
|
216275
216275
|
}
|
|
216276
216276
|
|
|
216277
216277
|
// src/utils/codegen.ts
|
|
216278
|
-
var
|
|
216278
|
+
var import_promises = require("fs/promises");
|
|
216279
216279
|
var import_ejs = __toESM(require_ejs());
|
|
216280
216280
|
var import_path = __toESM(require("path"));
|
|
216281
216281
|
var contractsDir = import_path.default.join(__dirname, "../../src/contracts");
|
|
216282
|
+
var stubLibDeploy = (0, import_promises.readFile)(import_path.default.join(contractsDir, "LibDeploy.sol"));
|
|
216282
216283
|
function generateLibDeploy(configPath, out, systems) {
|
|
216283
216284
|
return __async(this, null, function* () {
|
|
216284
|
-
const config = JSON.parse((0,
|
|
216285
|
+
const config = JSON.parse(yield (0, import_promises.readFile)(configPath, { encoding: "utf8" }));
|
|
216285
216286
|
if (systems) {
|
|
216286
216287
|
const systemsArray = Array.isArray(systems) ? systems : [systems];
|
|
216287
216288
|
config.systems = config.systems.filter((system) => systemsArray.includes(system.name));
|
|
@@ -216291,14 +216292,18 @@ function generateLibDeploy(configPath, out, systems) {
|
|
|
216291
216292
|
console.log("Generating deployment script");
|
|
216292
216293
|
const LibDeploy = yield import_ejs.default.renderFile(import_path.default.join(contractsDir, "LibDeploy.ejs"), config, { async: true });
|
|
216293
216294
|
const libDeployPath = import_path.default.join(out, "LibDeploy.sol");
|
|
216294
|
-
(0,
|
|
216295
|
+
yield (0, import_promises.writeFile)(libDeployPath, LibDeploy);
|
|
216295
216296
|
return libDeployPath;
|
|
216296
216297
|
});
|
|
216297
216298
|
}
|
|
216299
|
+
function resetLibDeploy(out) {
|
|
216300
|
+
return __async(this, null, function* () {
|
|
216301
|
+
yield (0, import_promises.writeFile)(import_path.default.join(out, "LibDeploy.sol"), yield stubLibDeploy);
|
|
216302
|
+
});
|
|
216303
|
+
}
|
|
216298
216304
|
|
|
216299
216305
|
// src/utils/deploy.ts
|
|
216300
216306
|
var import_ethers = __toESM(require_lib33());
|
|
216301
|
-
var import_fs5 = require("fs");
|
|
216302
216307
|
|
|
216303
216308
|
// src/utils/findLog.ts
|
|
216304
216309
|
function findLog(deployLogLines, log) {
|
|
@@ -216313,29 +216318,33 @@ function findLog(deployLogLines, log) {
|
|
|
216313
216318
|
// src/utils/types.ts
|
|
216314
216319
|
var import_typechain = __toESM(require_dist());
|
|
216315
216320
|
var import_glob = __toESM(require_glob3());
|
|
216316
|
-
var
|
|
216321
|
+
var import_fs3 = require("fs");
|
|
216317
216322
|
var import_path3 = __toESM(require("path"));
|
|
216318
216323
|
|
|
216319
216324
|
// src/utils/build.ts
|
|
216320
|
-
var
|
|
216325
|
+
var import_fs2 = require("fs");
|
|
216321
216326
|
var import_path2 = __toESM(require("path"));
|
|
216322
216327
|
function forgeBuild(out = "out", options) {
|
|
216323
216328
|
if (options == null ? void 0 : options.clear) {
|
|
216324
216329
|
console.log("Clearing forge build output directory", out);
|
|
216325
|
-
(0,
|
|
216330
|
+
(0, import_fs2.rmSync)(out, { recursive: true, force: true });
|
|
216326
216331
|
}
|
|
216327
216332
|
return execLog("forge", ["build", "-o", out]);
|
|
216328
216333
|
}
|
|
216329
216334
|
function getContractsInDir(dir, exclude) {
|
|
216330
|
-
return (0,
|
|
216335
|
+
return (0, import_fs2.readdirSync)(dir).filter((item) => item.includes(".sol")).map((item) => item.replace(".sol", "")).filter((item) => !(exclude == null ? void 0 : exclude.includes(item)));
|
|
216331
216336
|
}
|
|
216332
216337
|
function copyAbi(inDir, outDir, contract) {
|
|
216333
|
-
|
|
216338
|
+
try {
|
|
216339
|
+
return (0, import_fs2.copyFileSync)(import_path2.default.join(inDir, contract + ".sol", contract + ".json"), import_path2.default.join(outDir, contract + ".json"));
|
|
216340
|
+
} catch (e) {
|
|
216341
|
+
console.warn(e);
|
|
216342
|
+
}
|
|
216334
216343
|
}
|
|
216335
216344
|
function filterAbi(abiIn = "./out", abiOut = "./abi", exclude = ["Component", "IComponent"]) {
|
|
216336
216345
|
console.log(`Cleaning output directory (${abiOut}})`);
|
|
216337
|
-
(0,
|
|
216338
|
-
(0,
|
|
216346
|
+
(0, import_fs2.rmSync)(abiOut, { recursive: true, force: true });
|
|
216347
|
+
(0, import_fs2.mkdirSync)(abiOut);
|
|
216339
216348
|
const include = ["Component", "System", "World", "LibQuery"];
|
|
216340
216349
|
const contracts = getContractsInDir(abiIn, exclude).filter((item) => include.find((i) => item.includes(i)));
|
|
216341
216350
|
console.log("Selected ABIs: ", contracts);
|
|
@@ -216350,7 +216359,7 @@ function generateAbiTypes(inputDir, outputDir, options) {
|
|
|
216350
216359
|
var _a;
|
|
216351
216360
|
if (options == null ? void 0 : options.clear) {
|
|
216352
216361
|
console.log("Clearing typechain output directory", outputDir);
|
|
216353
|
-
(0,
|
|
216362
|
+
(0, import_fs3.rmSync)(outputDir, { recursive: true, force: true });
|
|
216354
216363
|
}
|
|
216355
216364
|
const cwd = (_a = options == null ? void 0 : options.cwd) != null ? _a : process.cwd();
|
|
216356
216365
|
const allFiles = (0, import_typechain.glob)(cwd, [`${inputDir}/**/+([a-zA-Z0-9_]).json`]);
|
|
@@ -216368,10 +216377,10 @@ function generateSystemTypes(inputDir, outputDir, options) {
|
|
|
216368
216377
|
return __async(this, null, function* () {
|
|
216369
216378
|
if (options == null ? void 0 : options.clear) {
|
|
216370
216379
|
console.log("Clearing system type output files", outputDir);
|
|
216371
|
-
(0,
|
|
216372
|
-
(0,
|
|
216373
|
-
(0,
|
|
216374
|
-
(0,
|
|
216380
|
+
(0, import_fs3.rmSync)(import_path3.default.join(outputDir, "/SystemTypes.ts"), { force: true });
|
|
216381
|
+
(0, import_fs3.rmSync)(import_path3.default.join(outputDir, "/SystemAbis.mts"), { force: true });
|
|
216382
|
+
(0, import_fs3.rmSync)(import_path3.default.join(outputDir, "/SystemAbis.mjs"), { force: true });
|
|
216383
|
+
(0, import_fs3.rmSync)(import_path3.default.join(outputDir, "/SystemMappings.ts"), { force: true });
|
|
216375
216384
|
}
|
|
216376
216385
|
let abis = [];
|
|
216377
216386
|
let systems = [];
|
|
@@ -216431,10 +216440,10 @@ ${systems.map((system, index) => ` "${ids[index]}": ${system}.abi,`).join("\n")
|
|
|
216431
216440
|
console.log("SystemTypes.ts", SystemTypes);
|
|
216432
216441
|
console.log("SystemAbis.mts", SystemAbis);
|
|
216433
216442
|
console.log("SystemMappings.ts", SystemMappings);
|
|
216434
|
-
(0,
|
|
216435
|
-
(0,
|
|
216436
|
-
(0,
|
|
216437
|
-
(0,
|
|
216443
|
+
(0, import_fs3.writeFileSync)(`${outputDir}/SystemTypes.ts`, SystemTypes);
|
|
216444
|
+
(0, import_fs3.writeFileSync)(`${outputDir}/SystemAbis.mts`, SystemAbis);
|
|
216445
|
+
(0, import_fs3.writeFileSync)(`${outputDir}/SystemAbis.mjs`, SystemAbis);
|
|
216446
|
+
(0, import_fs3.writeFileSync)(`${outputDir}/SystemMappings.ts`, SystemMappings);
|
|
216438
216447
|
});
|
|
216439
216448
|
}
|
|
216440
216449
|
function generateTypes(abiDir, outputDir = "./types", options) {
|
|
@@ -217402,7 +217411,7 @@ function generateAndDeploy(args) {
|
|
|
217402
217411
|
} finally {
|
|
217403
217412
|
console.log("Cleaning up deployment script");
|
|
217404
217413
|
if (libDeployPath)
|
|
217405
|
-
(
|
|
217414
|
+
resetLibDeploy(contractsDir2);
|
|
217406
217415
|
}
|
|
217407
217416
|
return { deployedWorldAddress, initialBlockNumber };
|
|
217408
217417
|
});
|
|
@@ -217410,17 +217419,23 @@ function generateAndDeploy(args) {
|
|
|
217410
217419
|
|
|
217411
217420
|
// src/utils/hsr.ts
|
|
217412
217421
|
var import_chokidar = __toESM(require_chokidar());
|
|
217413
|
-
var
|
|
217422
|
+
var import_fs4 = require("fs");
|
|
217414
217423
|
var ImportsRegex = new RegExp(new RegExp('(?<=import ").*(?=";)|(?<=from ").*(?=";)', "g"));
|
|
217415
217424
|
function extractImports(path6) {
|
|
217416
|
-
const content = (0,
|
|
217425
|
+
const content = (0, import_fs4.readFileSync)(path6).toString();
|
|
217417
217426
|
const regexResult = [...content.matchAll(ImportsRegex)].map((match) => match[0]).map((path7) => path7.split("/").at(-1));
|
|
217418
217427
|
return regexResult;
|
|
217419
217428
|
}
|
|
217420
|
-
function findDependencies(file, dependencyGraph) {
|
|
217429
|
+
function findDependencies(file, dependencyGraph, visited = []) {
|
|
217421
217430
|
var _a;
|
|
217422
217431
|
const dependencies = (_a = dependencyGraph[file]) != null ? _a : [];
|
|
217423
|
-
const subDependencies = dependencies.flatMap((d) =>
|
|
217432
|
+
const subDependencies = dependencies.flatMap((d) => {
|
|
217433
|
+
if (visited.includes(d)) {
|
|
217434
|
+
console.warn("Circular dependency detected: ", d, dependencyGraph[d]);
|
|
217435
|
+
return [];
|
|
217436
|
+
}
|
|
217437
|
+
return findDependencies(d, dependencyGraph, [...visited, d]);
|
|
217438
|
+
});
|
|
217424
217439
|
return [.../* @__PURE__ */ new Set([...dependencies, ...subDependencies])];
|
|
217425
217440
|
}
|
|
217426
217441
|
function hsr(root, replaceSystems) {
|
|
@@ -217442,7 +217457,9 @@ function hsr(root, replaceSystems) {
|
|
|
217442
217457
|
}
|
|
217443
217458
|
if (event === "change") {
|
|
217444
217459
|
const dependencies = findDependencies(changedFile, dependencyGraph);
|
|
217445
|
-
const changedSystems = [
|
|
217460
|
+
const changedSystems = [
|
|
217461
|
+
...new Set([changedFile, ...dependencies].filter((f) => systems.has(f)).map((f) => f.replace(".sol", "")))
|
|
217462
|
+
];
|
|
217446
217463
|
console.log("Systems to replace", changedSystems);
|
|
217447
217464
|
if (changedSystems.length > 0)
|
|
217448
217465
|
yield replaceSystems(changedSystems);
|