@pimlico/alto 0.0.0-staging.20240606T095015 → 0.0.0-staging.20240606T100452
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/lib/cli/alto.d.ts +6 -0
- package/lib/cli/alto.js +92 -0
- package/lib/cli/alto.js.map +1 -0
- package/lib/index.d.ts +1 -5
- package/lib/index.js +1 -91
- package/lib/index.js.map +1 -1
- package/package.json +5 -4
package/lib/cli/alto.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import * as sentry from "@sentry/node";
|
|
2
|
+
import dotenv from "dotenv";
|
|
3
|
+
import yargs from "yargs";
|
|
4
|
+
import { hideBin } from "yargs/helpers";
|
|
5
|
+
import { bundleCompressionOptions, bundlerCommand, bundlerOptions, compatibilityOptions, debugOptions, logOptions, rpcOptions, serverOptions } from "./config/index.js";
|
|
6
|
+
import { registerCommandToYargs } from "./util.js";
|
|
7
|
+
// Load environment variables from .env file
|
|
8
|
+
if (process.env.DOTENV_CONFIG_PATH) {
|
|
9
|
+
dotenv.config({ path: process.env.DOTENV_CONFIG_PATH });
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
dotenv.config();
|
|
13
|
+
}
|
|
14
|
+
if (process.env.SENTRY_DSN) {
|
|
15
|
+
sentry.init({
|
|
16
|
+
dsn: process.env.SENTRY_DSN,
|
|
17
|
+
// Performance Monitoring
|
|
18
|
+
tracesSampleRate: 1.0,
|
|
19
|
+
// Set sampling rate for profiling - this is relative to tracesSampleRate
|
|
20
|
+
profilesSampleRate: 1.0,
|
|
21
|
+
environment: process.env.ENVIRONMENT
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export const yarg = yargs(hideBin(process.argv));
|
|
25
|
+
const topBanner = `🏔 Alto: TypeScript ERC-4337 Bundler.
|
|
26
|
+
* by Pimlico, 2024`;
|
|
27
|
+
const bottomBanner = `📖 For more information, check the our docs:
|
|
28
|
+
* https://docs.pimlico.io/
|
|
29
|
+
`;
|
|
30
|
+
export function getAltoCli() {
|
|
31
|
+
const alto = yarg
|
|
32
|
+
.wrap(null)
|
|
33
|
+
.env("ALTO")
|
|
34
|
+
.parserConfiguration({
|
|
35
|
+
// As of yargs v16.1.0 dot-notation breaks strictOptions()
|
|
36
|
+
// Manually processing options is typesafe tho more verbose
|
|
37
|
+
"dot-notation": true
|
|
38
|
+
})
|
|
39
|
+
.options(bundlerOptions)
|
|
40
|
+
.group(Object.keys(bundlerOptions), "Options:")
|
|
41
|
+
.options(compatibilityOptions)
|
|
42
|
+
.group(Object.keys(compatibilityOptions), "Compatibility Options:")
|
|
43
|
+
.options(serverOptions)
|
|
44
|
+
.group(Object.keys(serverOptions), "Server Options:")
|
|
45
|
+
.options(rpcOptions)
|
|
46
|
+
.group(Object.keys(rpcOptions), "RPC Options:")
|
|
47
|
+
.options(bundleCompressionOptions)
|
|
48
|
+
.group(Object.keys(bundleCompressionOptions), "Bundle Compression Options:")
|
|
49
|
+
.options(logOptions)
|
|
50
|
+
.group(Object.keys(logOptions), "Logging Options:")
|
|
51
|
+
.options(debugOptions)
|
|
52
|
+
.group(Object.keys(debugOptions), "Debug Options:")
|
|
53
|
+
// blank scriptName so that help text doesn't display the cli name before each command
|
|
54
|
+
.scriptName("")
|
|
55
|
+
.demandCommand(1)
|
|
56
|
+
.usage(topBanner)
|
|
57
|
+
.epilogue(bottomBanner)
|
|
58
|
+
// Control show help behaviour below on .fail()
|
|
59
|
+
.showHelpOnFail(false)
|
|
60
|
+
.alias("h", "help")
|
|
61
|
+
.alias("v", "version")
|
|
62
|
+
.recommendCommands();
|
|
63
|
+
// throw an error if we see an unrecognized cmd
|
|
64
|
+
alto.recommendCommands(); //.strict()
|
|
65
|
+
alto.config();
|
|
66
|
+
// yargs.command and all ./cmds
|
|
67
|
+
registerCommandToYargs(alto, bundlerCommand);
|
|
68
|
+
return alto;
|
|
69
|
+
}
|
|
70
|
+
export class YargsError extends Error {
|
|
71
|
+
}
|
|
72
|
+
const alto = getAltoCli();
|
|
73
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
74
|
+
alto.fail((msg, err) => {
|
|
75
|
+
if (msg) {
|
|
76
|
+
// Show command help message when no command is provided
|
|
77
|
+
if (msg.includes("Not enough non-option arguments")) {
|
|
78
|
+
yarg.showHelp();
|
|
79
|
+
// eslint-disable-next-line no-console
|
|
80
|
+
console.log("\n");
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
const errorMessage = err !== undefined
|
|
84
|
+
? err instanceof YargsError
|
|
85
|
+
? err.message
|
|
86
|
+
: err.stack
|
|
87
|
+
: msg || "Unknown error";
|
|
88
|
+
// eslint-disable-next-line no-console
|
|
89
|
+
console.error(` × ${errorMessage}\n`);
|
|
90
|
+
process.exit(1);
|
|
91
|
+
}).parse();
|
|
92
|
+
//# sourceMappingURL=alto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alto.js","sourceRoot":"","sources":["../../cli/alto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,cAAc,CAAA;AACtC,OAAO,MAAM,MAAM,QAAQ,CAAA;AAC3B,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EACH,wBAAwB,EACxB,cAAc,EACd,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,UAAU,EACV,UAAU,EACV,aAAa,EAChB,MAAM,UAAU,CAAA;AACjB,OAAO,EAAE,sBAAsB,EAAE,MAAM,QAAQ,CAAA;AAE/C,4CAA4C;AAC5C,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC;IACjC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,CAAC,kBAAkB,EAAE,CAAC,CAAA;AAC3D,CAAC;KAAM,CAAC;IACJ,MAAM,CAAC,MAAM,EAAE,CAAA;AACnB,CAAC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AAe,CAAA;IAEhC,sCAAsC;IACtC,OAAO,CAAC,KAAK,CAAC,MAAM,YAAY,IAAI,CAAC,CAAA;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACnB,CAAC,CAAC,CAAC,KAAK,EAAE,CAAA"}
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,92 +1,2 @@
|
|
|
1
|
-
import
|
|
2
|
-
import dotenv from "dotenv";
|
|
3
|
-
import yargs from "yargs";
|
|
4
|
-
import { hideBin } from "yargs/helpers";
|
|
5
|
-
import { bundleCompressionOptions, bundlerCommand, bundlerOptions, compatibilityOptions, debugOptions, logOptions, rpcOptions, serverOptions } from "./cli/config/index.js";
|
|
6
|
-
import { registerCommandToYargs } from "./cli/util.js";
|
|
7
|
-
// Load environment variables from .env file
|
|
8
|
-
if (process.env.DOTENV_CONFIG_PATH) {
|
|
9
|
-
dotenv.config({ path: process.env.DOTENV_CONFIG_PATH });
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
dotenv.config();
|
|
13
|
-
}
|
|
14
|
-
if (process.env.SENTRY_DSN) {
|
|
15
|
-
sentry.init({
|
|
16
|
-
dsn: process.env.SENTRY_DSN,
|
|
17
|
-
// Performance Monitoring
|
|
18
|
-
tracesSampleRate: 1.0,
|
|
19
|
-
// Set sampling rate for profiling - this is relative to tracesSampleRate
|
|
20
|
-
profilesSampleRate: 1.0,
|
|
21
|
-
environment: process.env.ENVIRONMENT
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
export const yarg = yargs(hideBin(process.argv));
|
|
25
|
-
const topBanner = `🏔 Alto: TypeScript ERC-4337 Bundler.
|
|
26
|
-
* by Pimlico, 2024`;
|
|
27
|
-
const bottomBanner = `📖 For more information, check the our docs:
|
|
28
|
-
* https://docs.pimlico.io/
|
|
29
|
-
`;
|
|
30
|
-
export function getAltoCli() {
|
|
31
|
-
const alto = yarg
|
|
32
|
-
.wrap(null)
|
|
33
|
-
.env("ALTO")
|
|
34
|
-
.parserConfiguration({
|
|
35
|
-
// As of yargs v16.1.0 dot-notation breaks strictOptions()
|
|
36
|
-
// Manually processing options is typesafe tho more verbose
|
|
37
|
-
"dot-notation": true
|
|
38
|
-
})
|
|
39
|
-
.options(bundlerOptions)
|
|
40
|
-
.group(Object.keys(bundlerOptions), "Options:")
|
|
41
|
-
.options(compatibilityOptions)
|
|
42
|
-
.group(Object.keys(compatibilityOptions), "Compatibility Options:")
|
|
43
|
-
.options(serverOptions)
|
|
44
|
-
.group(Object.keys(serverOptions), "Server Options:")
|
|
45
|
-
.options(rpcOptions)
|
|
46
|
-
.group(Object.keys(rpcOptions), "RPC Options:")
|
|
47
|
-
.options(bundleCompressionOptions)
|
|
48
|
-
.group(Object.keys(bundleCompressionOptions), "Bundle Compression Options:")
|
|
49
|
-
.options(logOptions)
|
|
50
|
-
.group(Object.keys(logOptions), "Logging Options:")
|
|
51
|
-
.options(debugOptions)
|
|
52
|
-
.group(Object.keys(debugOptions), "Debug Options:")
|
|
53
|
-
// blank scriptName so that help text doesn't display the cli name before each command
|
|
54
|
-
.scriptName("")
|
|
55
|
-
.demandCommand(1)
|
|
56
|
-
.usage(topBanner)
|
|
57
|
-
.epilogue(bottomBanner)
|
|
58
|
-
// Control show help behaviour below on .fail()
|
|
59
|
-
.showHelpOnFail(false)
|
|
60
|
-
.alias("h", "help")
|
|
61
|
-
.alias("v", "version")
|
|
62
|
-
.recommendCommands();
|
|
63
|
-
// throw an error if we see an unrecognized cmd
|
|
64
|
-
alto.recommendCommands(); //.strict()
|
|
65
|
-
alto.config();
|
|
66
|
-
// yargs.command and all ./cmds
|
|
67
|
-
registerCommandToYargs(alto, bundlerCommand);
|
|
68
|
-
return alto;
|
|
69
|
-
}
|
|
70
|
-
export class YargsError extends Error {
|
|
71
|
-
}
|
|
72
|
-
const alto = getAltoCli();
|
|
73
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
74
|
-
alto.fail((msg, err) => {
|
|
75
|
-
if (msg) {
|
|
76
|
-
// Show command help message when no command is provided
|
|
77
|
-
if (msg.includes("Not enough non-option arguments")) {
|
|
78
|
-
yarg.showHelp();
|
|
79
|
-
// eslint-disable-next-line no-console
|
|
80
|
-
console.log("\n");
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
const errorMessage = err !== undefined
|
|
84
|
-
? err instanceof YargsError
|
|
85
|
-
? err.message
|
|
86
|
-
: err.stack
|
|
87
|
-
: msg || "Unknown error";
|
|
88
|
-
// eslint-disable-next-line no-console
|
|
89
|
-
console.error(` × ${errorMessage}\n`);
|
|
90
|
-
process.exit(1);
|
|
91
|
-
}).parse();
|
|
1
|
+
import "./cli/alto.js";
|
|
92
2
|
//# sourceMappingURL=index.js.map
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pimlico/alto",
|
|
3
|
-
"version": "0.0.0-staging.
|
|
3
|
+
"version": "0.0.0-staging.20240606T100452",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A performant and modular ERC-4337 Bundler written in Typescript",
|
|
6
6
|
"repository": "https://github.com/pimlicolabs/alto.git",
|
|
@@ -17,13 +17,14 @@
|
|
|
17
17
|
],
|
|
18
18
|
"exports": {
|
|
19
19
|
".": {
|
|
20
|
-
"import": "./
|
|
21
|
-
"require": "./
|
|
20
|
+
"import": "./esm/index.js",
|
|
21
|
+
"require": "./esm/index.js"
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"scripts": {
|
|
25
25
|
"build": "tsc -p ./tsconfig.json && tsc-alias -p tsconfig.json",
|
|
26
|
-
"
|
|
26
|
+
"build:esm": "tsc -p ./tsconfig.esm.json && tsc-alias -p tsconfig.esm.json",
|
|
27
|
+
"dev": "nodemon --exec DOTENV_CONFIG_PATH=$(pwd)/../.env ts-node -r tsconfig-paths/register cli/alto.ts run",
|
|
27
28
|
"test": "test -d test && mocha test/**/*.test.ts --exit || echo 'No test folder found. Skipping tests.'",
|
|
28
29
|
"lint": "eslint src/**/*.ts",
|
|
29
30
|
"lint:fix": "eslint src/**/*.ts --fix"
|