prool 0.0.25 → 0.1.0
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/{LICENSE → LICENSE.md} +1 -1
- package/README.md +46 -163
- package/{_lib/instance.d.ts → dist/Instance.d.ts} +28 -25
- package/dist/Instance.d.ts.map +1 -0
- package/{_lib/instance.js → dist/Instance.js} +9 -4
- package/dist/Instance.js.map +1 -0
- package/{_lib/pool.d.ts → dist/Pool.d.ts} +15 -13
- package/dist/Pool.d.ts.map +1 -0
- package/{_lib/pool.js → dist/Pool.js} +3 -3
- package/dist/Pool.js.map +1 -0
- package/{_lib/server.d.ts → dist/Server.d.ts} +7 -10
- package/dist/Server.d.ts.map +1 -0
- package/{_lib/server.js → dist/Server.js} +8 -9
- package/dist/Server.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/instances/alto.d.ts +452 -0
- package/dist/instances/alto.d.ts.map +1 -0
- package/{_lib → dist}/instances/alto.js +4 -4
- package/dist/instances/alto.js.map +1 -0
- package/dist/instances/anvil.d.ts +458 -0
- package/dist/instances/anvil.d.ts.map +1 -0
- package/{_lib → dist}/instances/anvil.js +4 -4
- package/dist/instances/anvil.js.map +1 -0
- package/dist/instances/tempo.d.ts +157 -0
- package/dist/instances/tempo.d.ts.map +1 -0
- package/dist/instances/tempo.js +187 -0
- package/dist/instances/tempo.js.map +1 -0
- package/dist/internal/utils.d.ts.map +1 -0
- package/{_lib → dist/internal}/utils.js +1 -1
- package/dist/internal/utils.js.map +1 -0
- package/{_lib → dist}/processes/execa.d.ts +11 -10
- package/dist/processes/execa.d.ts.map +1 -0
- package/{_lib → dist}/processes/execa.js +1 -1
- package/dist/processes/execa.js.map +1 -0
- package/package.json +17 -16
- package/{instance.test.ts → src/Instance.test.ts} +12 -12
- package/{instance.ts → src/Instance.ts} +51 -42
- package/{pool.test.ts → src/Pool.test.ts} +41 -55
- package/{pool.ts → src/Pool.ts} +21 -19
- package/{server.test.ts → src/Server.test.ts} +26 -149
- package/{server.ts → src/Server.ts} +9 -11
- package/src/index.ts +3 -0
- package/{instances → src/instances}/alto.test.ts +8 -11
- package/src/instances/alto.ts +289 -0
- package/{instances → src/instances}/anvil.test.ts +5 -6
- package/src/instances/anvil.ts +306 -0
- package/{instances/silius.test.ts → src/instances/tempo.test.ts} +20 -44
- package/src/instances/tempo.ts +278 -0
- package/{utils.test.ts → src/internal/utils.test.ts} +6 -6
- package/{utils.ts → src/internal/utils.ts} +1 -1
- package/{processes → src/processes}/execa.test.ts +6 -11
- package/{processes → src/processes}/execa.ts +19 -15
- package/src/processes/index.ts +1 -0
- package/CHANGELOG.md +0 -154
- package/_lib/exports/index.d.ts +0 -5
- package/_lib/exports/index.d.ts.map +0 -1
- package/_lib/exports/index.js +0 -5
- package/_lib/exports/index.js.map +0 -1
- package/_lib/exports/instances.d.ts +0 -7
- package/_lib/exports/instances.d.ts.map +0 -1
- package/_lib/exports/instances.js +0 -7
- package/_lib/exports/instances.js.map +0 -1
- package/_lib/exports/processes.d.ts +0 -2
- package/_lib/exports/processes.d.ts.map +0 -1
- package/_lib/exports/processes.js +0 -2
- package/_lib/exports/processes.js.map +0 -1
- package/_lib/instance.d.ts.map +0 -1
- package/_lib/instance.js.map +0 -1
- package/_lib/instances/alto.d.ts +0 -449
- package/_lib/instances/alto.d.ts.map +0 -1
- package/_lib/instances/alto.js.map +0 -1
- package/_lib/instances/anvil.d.ts +0 -455
- package/_lib/instances/anvil.d.ts.map +0 -1
- package/_lib/instances/anvil.js.map +0 -1
- package/_lib/instances/rundler.d.ts +0 -604
- package/_lib/instances/rundler.d.ts.map +0 -1
- package/_lib/instances/rundler.js +0 -86
- package/_lib/instances/rundler.js.map +0 -1
- package/_lib/instances/silius.d.ts +0 -224
- package/_lib/instances/silius.d.ts.map +0 -1
- package/_lib/instances/silius.js +0 -117
- package/_lib/instances/silius.js.map +0 -1
- package/_lib/instances/stackup.d.ts +0 -86
- package/_lib/instances/stackup.d.ts.map +0 -1
- package/_lib/instances/stackup.js +0 -89
- package/_lib/instances/stackup.js.map +0 -1
- package/_lib/pool.d.ts.map +0 -1
- package/_lib/pool.js.map +0 -1
- package/_lib/processes/execa.d.ts.map +0 -1
- package/_lib/processes/execa.js.map +0 -1
- package/_lib/server.d.ts.map +0 -1
- package/_lib/server.js.map +0 -1
- package/_lib/utils.d.ts.map +0 -1
- package/_lib/utils.js.map +0 -1
- package/exports/index.test.ts +0 -16
- package/exports/index.ts +0 -29
- package/exports/instances.test.ts +0 -15
- package/exports/instances.ts +0 -13
- package/exports/processes.test.ts +0 -10
- package/exports/processes.ts +0 -8
- package/instances/alto.ts +0 -280
- package/instances/anvil.ts +0 -304
- package/instances/package.json +0 -5
- package/instances/rundler.test.ts +0 -111
- package/instances/rundler.ts +0 -451
- package/instances/silius.ts +0 -347
- package/instances/stackup.test.ts +0 -106
- package/instances/stackup.ts +0 -162
- package/processes/package.json +0 -5
- package/tsconfig.build.tsbuildinfo +0 -1
- /package/{_lib → dist/internal}/utils.d.ts +0 -0
|
@@ -1,26 +1,17 @@
|
|
|
1
1
|
import getPort from 'get-port'
|
|
2
|
-
import {
|
|
2
|
+
import { Instance } from 'prool'
|
|
3
|
+
import { afterEach, expect, test } from 'vitest'
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
import type { Instance } from '../instance.js'
|
|
6
|
-
import { anvil } from './anvil.js'
|
|
7
|
-
import { silius } from './silius.js'
|
|
8
|
-
|
|
9
|
-
const instances: Instance[] = []
|
|
5
|
+
const instances: Instance.Instance[] = []
|
|
10
6
|
|
|
11
7
|
const port = await getPort()
|
|
12
8
|
|
|
13
|
-
const defineInstance = (parameters
|
|
14
|
-
const instance =
|
|
15
|
-
...siliusOptions({ port, pool: false }),
|
|
16
|
-
...parameters,
|
|
17
|
-
})
|
|
9
|
+
const defineInstance = (parameters: Instance.tempo.Parameters = {}) => {
|
|
10
|
+
const instance = Instance.tempo({ port, ...parameters })
|
|
18
11
|
instances.push(instance)
|
|
19
12
|
return instance
|
|
20
13
|
}
|
|
21
14
|
|
|
22
|
-
beforeAll(() => anvil({ port }).start())
|
|
23
|
-
|
|
24
15
|
afterEach(async () => {
|
|
25
16
|
for (const instance of instances) await instance.stop().catch(() => {})
|
|
26
17
|
})
|
|
@@ -52,15 +43,11 @@ test('default', async () => {
|
|
|
52
43
|
})
|
|
53
44
|
|
|
54
45
|
test('behavior: instance errored (duplicate ports)', async () => {
|
|
55
|
-
const instance_1 = defineInstance({
|
|
56
|
-
|
|
57
|
-
})
|
|
58
|
-
const instance_2 = defineInstance({
|
|
59
|
-
port: 1337,
|
|
60
|
-
})
|
|
46
|
+
const instance_1 = defineInstance({ port: 8546 })
|
|
47
|
+
const instance_2 = defineInstance({ port: 8546 })
|
|
61
48
|
|
|
62
49
|
await instance_1.start()
|
|
63
|
-
await expect(() => instance_2.start()).rejects.toThrowError()
|
|
50
|
+
await expect(() => instance_2.start()).rejects.toThrowError('Failed to start')
|
|
64
51
|
})
|
|
65
52
|
|
|
66
53
|
test('behavior: start and stop multiple times', async () => {
|
|
@@ -76,33 +63,22 @@ test('behavior: start and stop multiple times', async () => {
|
|
|
76
63
|
await instance.stop()
|
|
77
64
|
})
|
|
78
65
|
|
|
79
|
-
test('behavior: can subscribe to
|
|
66
|
+
test('behavior: can subscribe to stdout', async () => {
|
|
80
67
|
const messages: string[] = []
|
|
81
|
-
|
|
82
|
-
const instance_1 = defineInstance({ port: 1338 })
|
|
83
|
-
const instance_2 = defineInstance({ port: 1338 })
|
|
84
|
-
|
|
85
|
-
await instance_1.start()
|
|
86
|
-
instance_2.on('stderr', (message) => messages.push(message))
|
|
87
|
-
await expect(instance_2.start()).rejects.toThrowError()
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
test('behavior: exit', async () => {
|
|
91
68
|
const instance = defineInstance()
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
let exitCode: number | null | undefined = undefined
|
|
95
|
-
instance.on('exit', (code) => {
|
|
96
|
-
exitCode = code
|
|
97
|
-
resolve()
|
|
98
|
-
})
|
|
69
|
+
instance.on('stdout', (message) => messages.push(message))
|
|
99
70
|
|
|
100
71
|
await instance.start()
|
|
101
|
-
expect(
|
|
72
|
+
expect(messages.length).toBeGreaterThanOrEqual(1)
|
|
73
|
+
})
|
|
102
74
|
|
|
103
|
-
|
|
75
|
+
test('behavior: can subscribe to stderr', async () => {
|
|
76
|
+
const messages: string[] = []
|
|
104
77
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
78
|
+
const instance_1 = defineInstance({ port: 8546 })
|
|
79
|
+
const instance_2 = defineInstance({ port: 8546 })
|
|
80
|
+
|
|
81
|
+
await instance_1.start()
|
|
82
|
+
instance_2.on('stderr', (message) => messages.push(message))
|
|
83
|
+
await expect(instance_2.start()).rejects.toThrow('Failed to start')
|
|
108
84
|
})
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import * as os from 'node:os'
|
|
2
|
+
import * as path from 'node:path'
|
|
3
|
+
import {
|
|
4
|
+
GenericContainer,
|
|
5
|
+
type StartedTestContainer,
|
|
6
|
+
Wait,
|
|
7
|
+
} from 'testcontainers'
|
|
8
|
+
import * as Instance from '../Instance.js'
|
|
9
|
+
import { execa } from '../processes/execa.js'
|
|
10
|
+
|
|
11
|
+
export function command(parameters: tempo.Parameters): string[] {
|
|
12
|
+
const { faucet, port } = parameters
|
|
13
|
+
const dataDir = path.join(os.tmpdir(), '.prool', `tempo.${port}`)
|
|
14
|
+
return [
|
|
15
|
+
'node',
|
|
16
|
+
`--authrpc.port=${port! + 30}`,
|
|
17
|
+
`--datadir=${dataDir}`,
|
|
18
|
+
'--dev',
|
|
19
|
+
`--dev.block-time=${parameters?.blockTime ?? '50ms'}`,
|
|
20
|
+
'--engine.disable-precompile-cache',
|
|
21
|
+
'--engine.legacy-state-root',
|
|
22
|
+
'--faucet.address',
|
|
23
|
+
...(faucet?.addresses ?? [
|
|
24
|
+
'0x20c0000000000000000000000000000000000000',
|
|
25
|
+
'0x20c0000000000000000000000000000000000001',
|
|
26
|
+
'0x20c0000000000000000000000000000000000002',
|
|
27
|
+
'0x20c0000000000000000000000000000000000003',
|
|
28
|
+
]),
|
|
29
|
+
`--faucet.amount=${faucet?.amount ?? '1000000000000'}`,
|
|
30
|
+
'--faucet.enabled',
|
|
31
|
+
`--faucet.private-key=${faucet?.privateKey ?? '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80'}`,
|
|
32
|
+
'--http',
|
|
33
|
+
'--http.addr=0.0.0.0',
|
|
34
|
+
'--http.api=all',
|
|
35
|
+
'--http.corsdomain=*',
|
|
36
|
+
`--http.port=${port!}`,
|
|
37
|
+
`--port=${port! + 10}`,
|
|
38
|
+
'--txpool.basefee-max-count=10000000000000',
|
|
39
|
+
'--txpool.basefee-max-size=10000',
|
|
40
|
+
'--txpool.max-account-slots=500000',
|
|
41
|
+
'--txpool.pending-max-count=10000000000000',
|
|
42
|
+
'--txpool.pending-max-size=10000',
|
|
43
|
+
'--txpool.queued-max-count=10000000000000',
|
|
44
|
+
'--txpool.queued-max-size=10000',
|
|
45
|
+
`--ws.port=${port! + 20}`,
|
|
46
|
+
]
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Defines a Tempo instance.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```ts
|
|
54
|
+
* const instance = Instance.tempo({ port: 8545 })
|
|
55
|
+
* await instance.start()
|
|
56
|
+
* // ...
|
|
57
|
+
* await instance.stop()
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export const tempo = Instance.define((parameters?: tempo.Parameters) => {
|
|
61
|
+
const { binary = 'tempo', log: log_, ...args } = parameters || {}
|
|
62
|
+
|
|
63
|
+
const log = (() => {
|
|
64
|
+
try {
|
|
65
|
+
return JSON.parse(log_ as string)
|
|
66
|
+
} catch {
|
|
67
|
+
return log_
|
|
68
|
+
}
|
|
69
|
+
})()
|
|
70
|
+
const RUST_LOG = log && typeof log !== 'boolean' ? log : ''
|
|
71
|
+
|
|
72
|
+
const name = 'tempo'
|
|
73
|
+
const process = execa({ name })
|
|
74
|
+
|
|
75
|
+
return {
|
|
76
|
+
_internal: {
|
|
77
|
+
args,
|
|
78
|
+
get process() {
|
|
79
|
+
return process._internal.process
|
|
80
|
+
},
|
|
81
|
+
},
|
|
82
|
+
host: args.host ?? 'localhost',
|
|
83
|
+
name,
|
|
84
|
+
port: args.port ?? 8545,
|
|
85
|
+
async start({ port = args.port }, options) {
|
|
86
|
+
return await process.start(
|
|
87
|
+
($) =>
|
|
88
|
+
$({
|
|
89
|
+
env: {
|
|
90
|
+
RUST_LOG,
|
|
91
|
+
},
|
|
92
|
+
})`${[binary, ...command({ ...parameters, port })]}`,
|
|
93
|
+
{
|
|
94
|
+
...options,
|
|
95
|
+
// Resolve when the process is listening via "RPC HTTP server started" message.
|
|
96
|
+
resolver({ process, reject, resolve }) {
|
|
97
|
+
process.stdout.on('data', (data) => {
|
|
98
|
+
const message = data.toString()
|
|
99
|
+
if (log) console.log(message)
|
|
100
|
+
if (message.includes('RPC HTTP server started')) resolve()
|
|
101
|
+
if (message.includes('shutting down')) reject('shutting down')
|
|
102
|
+
})
|
|
103
|
+
process.stderr.on('data', (data) => {
|
|
104
|
+
const message = data.toString()
|
|
105
|
+
if (log) console.error(message)
|
|
106
|
+
})
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
)
|
|
110
|
+
},
|
|
111
|
+
async stop() {
|
|
112
|
+
await process.stop()
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
})
|
|
116
|
+
|
|
117
|
+
export declare namespace tempo {
|
|
118
|
+
export type Parameters = {
|
|
119
|
+
/**
|
|
120
|
+
* Path or alias to the Tempo binary.
|
|
121
|
+
*/
|
|
122
|
+
binary?: string | undefined
|
|
123
|
+
/**
|
|
124
|
+
* Interval between blocks.
|
|
125
|
+
*/
|
|
126
|
+
blockTime?: string | undefined
|
|
127
|
+
/**
|
|
128
|
+
* Faucet options.
|
|
129
|
+
*/
|
|
130
|
+
faucet?:
|
|
131
|
+
| {
|
|
132
|
+
/**
|
|
133
|
+
* Target token addresses for the faucet to be funding with
|
|
134
|
+
*/
|
|
135
|
+
addresses?: string[] | undefined
|
|
136
|
+
/**
|
|
137
|
+
* Amount for each faucet funding transaction
|
|
138
|
+
*/
|
|
139
|
+
amount?: bigint | undefined
|
|
140
|
+
/**
|
|
141
|
+
* Faucet funding mnemonic
|
|
142
|
+
*/
|
|
143
|
+
privateKey?: string | undefined
|
|
144
|
+
}
|
|
145
|
+
| undefined
|
|
146
|
+
/**
|
|
147
|
+
* Rust log level configuration (sets RUST_LOG environment variable).
|
|
148
|
+
* Can be a log level or a custom filter string.
|
|
149
|
+
*/
|
|
150
|
+
log?:
|
|
151
|
+
| 'trace'
|
|
152
|
+
| 'debug'
|
|
153
|
+
| 'info'
|
|
154
|
+
| 'warn'
|
|
155
|
+
| 'error'
|
|
156
|
+
| (string & {})
|
|
157
|
+
| boolean
|
|
158
|
+
| undefined
|
|
159
|
+
/**
|
|
160
|
+
* Host the server will listen on.
|
|
161
|
+
*/
|
|
162
|
+
host?: string | undefined
|
|
163
|
+
/**
|
|
164
|
+
* Port the server will listen on.
|
|
165
|
+
*/
|
|
166
|
+
port?: number | undefined
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
/**
|
|
171
|
+
* Defines a Tempo instance.
|
|
172
|
+
*
|
|
173
|
+
* @example
|
|
174
|
+
* ```ts
|
|
175
|
+
* const instance = Instance.tempoDocker({ port: 8545 })
|
|
176
|
+
* await instance.start()
|
|
177
|
+
* // ...
|
|
178
|
+
* await instance.stop()
|
|
179
|
+
* ```
|
|
180
|
+
*/
|
|
181
|
+
export const tempoDocker = Instance.define(
|
|
182
|
+
(parameters?: tempoDocker.Parameters) => {
|
|
183
|
+
const {
|
|
184
|
+
containerName = `tempo.${crypto.randomUUID()}`,
|
|
185
|
+
image = 'ghcr.io/tempoxyz/tempo:latest',
|
|
186
|
+
log: log_,
|
|
187
|
+
...args
|
|
188
|
+
} = parameters || {}
|
|
189
|
+
|
|
190
|
+
const log = (() => {
|
|
191
|
+
try {
|
|
192
|
+
return JSON.parse(log_ as string)
|
|
193
|
+
} catch {
|
|
194
|
+
return log_
|
|
195
|
+
}
|
|
196
|
+
})()
|
|
197
|
+
const RUST_LOG = log && typeof log !== 'boolean' ? log : ''
|
|
198
|
+
|
|
199
|
+
const name = 'tempo'
|
|
200
|
+
let container: StartedTestContainer | undefined
|
|
201
|
+
|
|
202
|
+
return {
|
|
203
|
+
_internal: {
|
|
204
|
+
args,
|
|
205
|
+
},
|
|
206
|
+
host: args.host ?? 'localhost',
|
|
207
|
+
name,
|
|
208
|
+
port: args.port ?? 8545,
|
|
209
|
+
async start({ port = args.port }, { emitter }) {
|
|
210
|
+
const promise = Promise.withResolvers<void>()
|
|
211
|
+
|
|
212
|
+
const c = new GenericContainer(image)
|
|
213
|
+
.withPlatform('linux/x86_64')
|
|
214
|
+
.withNetworkMode('host')
|
|
215
|
+
.withExtraHosts([
|
|
216
|
+
{ host: 'host.docker.internal', ipAddress: 'host-gateway' },
|
|
217
|
+
{ host: 'localhost', ipAddress: 'host-gateway' },
|
|
218
|
+
])
|
|
219
|
+
.withName(containerName)
|
|
220
|
+
.withEnvironment({ RUST_LOG })
|
|
221
|
+
.withCommand(command({ ...parameters, port }))
|
|
222
|
+
.withWaitStrategy(Wait.forLogMessage(/RPC HTTP server started/))
|
|
223
|
+
.withLogConsumer((stream) => {
|
|
224
|
+
stream.on('data', (data) => {
|
|
225
|
+
const message = data.toString()
|
|
226
|
+
emitter.emit('message', message)
|
|
227
|
+
emitter.emit('stdout', message)
|
|
228
|
+
if (log) console.log(message)
|
|
229
|
+
if (message.includes('shutting down'))
|
|
230
|
+
promise.reject(new Error(`Failed to start: ${message}`))
|
|
231
|
+
})
|
|
232
|
+
stream.on('error', (error) => {
|
|
233
|
+
if (log) console.error(error.message)
|
|
234
|
+
emitter.emit('message', error.message)
|
|
235
|
+
emitter.emit('stderr', error.message)
|
|
236
|
+
promise.reject(new Error(`Failed to start: ${error.message}`))
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
.withStartupTimeout(10_000)
|
|
240
|
+
|
|
241
|
+
c.start()
|
|
242
|
+
.then((c) => {
|
|
243
|
+
container = c
|
|
244
|
+
promise.resolve()
|
|
245
|
+
})
|
|
246
|
+
.catch(promise.reject)
|
|
247
|
+
|
|
248
|
+
return promise.promise
|
|
249
|
+
},
|
|
250
|
+
async stop() {
|
|
251
|
+
if (!container) return
|
|
252
|
+
await container.stop()
|
|
253
|
+
container = undefined
|
|
254
|
+
},
|
|
255
|
+
}
|
|
256
|
+
},
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
export declare namespace tempoDocker {
|
|
260
|
+
export type Parameters = Omit<tempo.Parameters, 'binary'> & {
|
|
261
|
+
/**
|
|
262
|
+
* Name of the container.
|
|
263
|
+
*/
|
|
264
|
+
containerName?: string | undefined
|
|
265
|
+
/**
|
|
266
|
+
* Docker image to use.
|
|
267
|
+
*/
|
|
268
|
+
image?: string | undefined
|
|
269
|
+
/**
|
|
270
|
+
* Host the server will listen on.
|
|
271
|
+
*/
|
|
272
|
+
host?: string | undefined
|
|
273
|
+
/**
|
|
274
|
+
* Port the server will listen on.
|
|
275
|
+
*/
|
|
276
|
+
port?: number | undefined
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -43,12 +43,12 @@ test.each([
|
|
|
43
43
|
[{ foo: { barBaz: 'test' } }, { casing: 'snake' }],
|
|
44
44
|
['--foo.bar_baz', 'test'],
|
|
45
45
|
],
|
|
46
|
-
] as [Parameters<typeof toArgs>, string[]][])(
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
)
|
|
46
|
+
] as [Parameters<typeof toArgs>, string[]][])('toArgs(%o) -> %o', ([
|
|
47
|
+
input,
|
|
48
|
+
options,
|
|
49
|
+
], expected) => {
|
|
50
|
+
expect(toArgs(input, options)).toEqual(expected)
|
|
51
|
+
})
|
|
52
52
|
|
|
53
53
|
test.each([
|
|
54
54
|
['foo', '--foo'],
|
|
@@ -30,7 +30,7 @@ export function extractPath(request: string): ExtractPathReturnType {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const ansiColorRegex =
|
|
33
|
-
// biome-ignore lint/suspicious/noControlCharactersInRegex:
|
|
33
|
+
// biome-ignore lint/suspicious/noControlCharactersInRegex: _
|
|
34
34
|
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g
|
|
35
35
|
|
|
36
36
|
/**
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { EventEmitter } from 'eventemitter3'
|
|
2
|
+
import getPort from 'get-port'
|
|
2
3
|
import { afterEach, expect, test } from 'vitest'
|
|
3
|
-
import {
|
|
4
|
+
import { execa } from './execa.js'
|
|
4
5
|
|
|
5
|
-
const processes:
|
|
6
|
+
const processes: execa.ReturnType[] = []
|
|
6
7
|
function createProcess() {
|
|
7
8
|
const process = execa({ name: 'foo' })
|
|
8
9
|
processes.push(process)
|
|
@@ -82,14 +83,7 @@ test('start (error)', async () => {
|
|
|
82
83
|
process.stderr.on('data', reject)
|
|
83
84
|
},
|
|
84
85
|
}),
|
|
85
|
-
).rejects.
|
|
86
|
-
[Error: Failed to start process "foo": error: unexpected argument '--lol' found
|
|
87
|
-
|
|
88
|
-
Usage: anvil [OPTIONS] [COMMAND]
|
|
89
|
-
|
|
90
|
-
For more information, try '--help'.
|
|
91
|
-
]
|
|
92
|
-
`)
|
|
86
|
+
).rejects.toThrowError('Failed to start process "foo"')
|
|
93
87
|
await expect(resolvers.message.promise).resolves.toBeDefined()
|
|
94
88
|
await expect(resolvers.stderr.promise).resolves.toBeDefined()
|
|
95
89
|
})
|
|
@@ -128,7 +122,8 @@ test('behavior: exit when status is starting', async () => {
|
|
|
128
122
|
emitter.on('exit', resolvers.exit.resolve)
|
|
129
123
|
|
|
130
124
|
// Invalid argument
|
|
131
|
-
await
|
|
125
|
+
const port = await getPort()
|
|
126
|
+
await process.start(($) => $`anvil --port ${port}`, {
|
|
132
127
|
emitter,
|
|
133
128
|
status: 'starting',
|
|
134
129
|
resolver({ process, resolve }) {
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import type { SignalConstants } from 'node:os'
|
|
2
|
-
import {
|
|
3
|
-
import type
|
|
4
|
-
import { stripColors } from '../utils.js'
|
|
2
|
+
import { execa as exec, type ResultPromise } from 'execa'
|
|
3
|
+
import type * as Instance from '../Instance.js'
|
|
4
|
+
import { stripColors } from '../internal/utils.js'
|
|
5
5
|
|
|
6
6
|
export type Process_internal = ResultPromise<{ cleanup: true; reject: false }>
|
|
7
7
|
|
|
8
|
-
export type ExecaStartOptions =
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type ExecaParameters = { name: string }
|
|
8
|
+
export type ExecaStartOptions =
|
|
9
|
+
Instance.define.InstanceStartOptions_internal & {
|
|
10
|
+
resolver(options: {
|
|
11
|
+
process: Process_internal
|
|
12
|
+
reject(data: string): Promise<void>
|
|
13
|
+
resolve(): void
|
|
14
|
+
}): void
|
|
15
|
+
}
|
|
17
16
|
|
|
18
|
-
export type
|
|
17
|
+
export type Process = {
|
|
19
18
|
_internal: {
|
|
20
19
|
process: Process_internal
|
|
21
20
|
}
|
|
@@ -26,9 +25,8 @@ export type ExecaProcess = {
|
|
|
26
25
|
): Promise<void>
|
|
27
26
|
stop(signal?: keyof SignalConstants | number): Promise<void>
|
|
28
27
|
}
|
|
29
|
-
export type ExecaReturnType = ExecaProcess
|
|
30
28
|
|
|
31
|
-
export function execa(parameters:
|
|
29
|
+
export function execa(parameters: execa.Parameters): execa.ReturnType {
|
|
32
30
|
const { name } = parameters
|
|
33
31
|
|
|
34
32
|
const errorMessages: string[] = []
|
|
@@ -112,3 +110,9 @@ export function execa(parameters: ExecaParameters): ExecaReturnType {
|
|
|
112
110
|
},
|
|
113
111
|
}
|
|
114
112
|
}
|
|
113
|
+
|
|
114
|
+
export declare namespace execa {
|
|
115
|
+
export type Parameters = { name: string }
|
|
116
|
+
|
|
117
|
+
export type ReturnType = Process
|
|
118
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * as execa from './execa.js'
|
package/CHANGELOG.md
DELETED
|
@@ -1,154 +0,0 @@
|
|
|
1
|
-
# prool
|
|
2
|
-
|
|
3
|
-
## 0.0.25
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- [`2b25d5e`](https://github.com/wevm/prool/commit/2b25d5efac3b4355166407eae6a90a44572e7750) Thanks [@jxom](https://github.com/jxom)! - Added CORS headers.
|
|
8
|
-
|
|
9
|
-
## 0.0.24
|
|
10
|
-
|
|
11
|
-
### Patch Changes
|
|
12
|
-
|
|
13
|
-
- [#46](https://github.com/wevm/prool/pull/46) [`e8e711e`](https://github.com/wevm/prool/commit/e8e711ede52b9028c2bd986a873f818d36421bd2) Thanks [@jxom](https://github.com/jxom)! - Updated Alto.
|
|
14
|
-
|
|
15
|
-
## 0.0.23
|
|
16
|
-
|
|
17
|
-
### Patch Changes
|
|
18
|
-
|
|
19
|
-
- [`af68957`](https://github.com/wevm/prool/commit/af68957fdae33421a55757aafbc7a29accea2479) Thanks [@jxom](https://github.com/jxom)! - Added `FOUNDRY_DISABLE_NIGHTLY_WARNING` env var to Anvil instance.
|
|
20
|
-
|
|
21
|
-
## 0.0.22
|
|
22
|
-
|
|
23
|
-
### Patch Changes
|
|
24
|
-
|
|
25
|
-
- [`6354fcb`](https://github.com/wevm/prool/commit/6354fcbefddada249fb9a3abaaa7fe69bd04f1b2) Thanks [@jxom](https://github.com/jxom)! - Fixed Anvil warning.
|
|
26
|
-
|
|
27
|
-
## 0.0.21
|
|
28
|
-
|
|
29
|
-
### Patch Changes
|
|
30
|
-
|
|
31
|
-
- [`7552ac7`](https://github.com/wevm/prool/commit/7552ac70a0182039b6f8dac3a704f2939ead5185) Thanks [@jxom](https://github.com/jxom)! - Reverted `SIGKILL` changes.
|
|
32
|
-
|
|
33
|
-
## 0.0.20
|
|
34
|
-
|
|
35
|
-
### Patch Changes
|
|
36
|
-
|
|
37
|
-
- [`39cdcbd`](https://github.com/wevm/prool/commit/39cdcbd4286fa1bb3728a0c7679d12931d4d44bb) Thanks [@jxom](https://github.com/jxom)! - Added `/destroy` endpoint.
|
|
38
|
-
|
|
39
|
-
## 0.0.19
|
|
40
|
-
|
|
41
|
-
### Patch Changes
|
|
42
|
-
|
|
43
|
-
- [`88946fe`](https://github.com/wevm/prool/commit/88946fe5cc611d2847ccb912a0ee41675d335e7b) Thanks [@jxom](https://github.com/jxom)! - Updated to kill process via `SIGKILL`.
|
|
44
|
-
|
|
45
|
-
## 0.0.18
|
|
46
|
-
|
|
47
|
-
### Patch Changes
|
|
48
|
-
|
|
49
|
-
- [`64e1cb7`](https://github.com/wevm/prool/commit/64e1cb75f69f50ed50da9f9ec50c4a2e59e9450f) Thanks [@jxom](https://github.com/jxom)! - Added `defineInstance` and utils exports.
|
|
50
|
-
|
|
51
|
-
## 0.0.17
|
|
52
|
-
|
|
53
|
-
### Patch Changes
|
|
54
|
-
|
|
55
|
-
- [`7afec3b`](https://github.com/wevm/prool/commit/7afec3ba7cf0c8aa9ede914dce9043e89664f889) Thanks [@jxom](https://github.com/jxom)! - Fixed Anvil nightly instances crashing due to warnings being piped to stderr.
|
|
56
|
-
|
|
57
|
-
## 0.0.16
|
|
58
|
-
|
|
59
|
-
### Patch Changes
|
|
60
|
-
|
|
61
|
-
- [`c7ab4a5`](https://github.com/wevm/prool/commit/c7ab4a524c8f3761b3fca6ea35cfa18ee39fb442) Thanks [@jxom](https://github.com/jxom)! - Added `"Prague"` to Anvil `hardfork` union.
|
|
62
|
-
|
|
63
|
-
## 0.0.15
|
|
64
|
-
|
|
65
|
-
### Patch Changes
|
|
66
|
-
|
|
67
|
-
- [#20](https://github.com/wevm/prool/pull/20) [`e1ebc61`](https://github.com/wevm/prool/commit/e1ebc61a888751298526f7126fe69d042551da7b) Thanks [@jxom](https://github.com/jxom)! - Added Silius instance.
|
|
68
|
-
|
|
69
|
-
## 0.0.14
|
|
70
|
-
|
|
71
|
-
### Patch Changes
|
|
72
|
-
|
|
73
|
-
- [`0187ef8`](https://github.com/wevm/prool/commit/0187ef8a00ea4b25367b8427ed00d217388f3d65) Thanks [@jxom](https://github.com/jxom)! - Added Rundler instance.
|
|
74
|
-
|
|
75
|
-
## 0.0.13
|
|
76
|
-
|
|
77
|
-
### Patch Changes
|
|
78
|
-
|
|
79
|
-
- [`a879039`](https://github.com/wevm/prool/commit/a879039aeec7e0018f51b8b7fcc11c314eba94db) Thanks [@jxom](https://github.com/jxom)! - Added proxy packages for entrypoints.
|
|
80
|
-
|
|
81
|
-
## 0.0.12
|
|
82
|
-
|
|
83
|
-
### Patch Changes
|
|
84
|
-
|
|
85
|
-
- [`e516006`](https://github.com/wevm/prool/commit/e516006a6c858108bcec40c1006725c586e7a569) Thanks [@jxom](https://github.com/jxom)! - Removed \`package.json\` modification in \`alto\` instance.
|
|
86
|
-
|
|
87
|
-
## 0.0.11
|
|
88
|
-
|
|
89
|
-
### Patch Changes
|
|
90
|
-
|
|
91
|
-
- [`ccef6a7`](https://github.com/wevm/prool/commit/ccef6a797a65e948e7d98b7df5064bd33d6a62e7) Thanks [@jxom](https://github.com/jxom)! - Fixed falsy flags.
|
|
92
|
-
|
|
93
|
-
## 0.0.10
|
|
94
|
-
|
|
95
|
-
### Patch Changes
|
|
96
|
-
|
|
97
|
-
- [`55fb258`](https://github.com/wevm/prool/commit/55fb25899f2e7ace291bf897c92b688740b27206) Thanks [@jxom](https://github.com/jxom)! - Fixed module resolution in `alto` instance.
|
|
98
|
-
|
|
99
|
-
## 0.0.9
|
|
100
|
-
|
|
101
|
-
### Patch Changes
|
|
102
|
-
|
|
103
|
-
- [#10](https://github.com/wevm/prool/pull/10) [`b7a4c95`](https://github.com/wevm/prool/commit/b7a4c9595bde2e4568e41d204f310540d0a16e3d) Thanks [@jxom](https://github.com/jxom)! - Added `alto` instance.
|
|
104
|
-
|
|
105
|
-
## 0.0.8
|
|
106
|
-
|
|
107
|
-
### Patch Changes
|
|
108
|
-
|
|
109
|
-
- [`cfc07ae`](https://github.com/wevm/prool/commit/cfc07ae5f8aa975155b1c9746d04eacbcd349366) Thanks [@jxom](https://github.com/jxom)! - Exported types.
|
|
110
|
-
|
|
111
|
-
## 0.0.7
|
|
112
|
-
|
|
113
|
-
### Patch Changes
|
|
114
|
-
|
|
115
|
-
- [`366a4ec`](https://github.com/wevm/prool/commit/366a4ecf23535c50b79fc15304a945af6e400d1f) Thanks [@jxom](https://github.com/jxom)! - Fixed `stackup` docker args.
|
|
116
|
-
|
|
117
|
-
## 0.0.6
|
|
118
|
-
|
|
119
|
-
### Patch Changes
|
|
120
|
-
|
|
121
|
-
- [`75382d1`](https://github.com/wevm/prool/commit/75382d155ab18d231d58d74510c3ce4a4da56aea) Thanks [@jxom](https://github.com/jxom)! - Exported `stackup`.
|
|
122
|
-
|
|
123
|
-
## 0.0.5
|
|
124
|
-
|
|
125
|
-
### Patch Changes
|
|
126
|
-
|
|
127
|
-
- [`cb371f6`](https://github.com/wevm/prool/commit/cb371f64ddd50d3611aa959f618506f18688f46d) Thanks [@jxom](https://github.com/jxom)! - Added `stackup` instance.
|
|
128
|
-
|
|
129
|
-
- [`c7348a3`](https://github.com/wevm/prool/commit/c7348a3e6b54881b45e5ce0caf25198dacfb2a7c) Thanks [@jxom](https://github.com/jxom)! - Added support for a callback `instance`.
|
|
130
|
-
|
|
131
|
-
## 0.0.4
|
|
132
|
-
|
|
133
|
-
### Patch Changes
|
|
134
|
-
|
|
135
|
-
- [`c208423`](https://github.com/wevm/prool/commit/c2084231b277cecb840e4f9957cc4fc2e5b0b7a2) Thanks [@jxom](https://github.com/jxom)! - Added `/restart` endpoint to the Pool Server.
|
|
136
|
-
Added `restart` method to pool instances.
|
|
137
|
-
|
|
138
|
-
## 0.0.3
|
|
139
|
-
|
|
140
|
-
### Patch Changes
|
|
141
|
-
|
|
142
|
-
- [`0750b15`](https://github.com/wevm/prool/commit/0750b15aa06565002a75ea3333286a0d6c6d86bb) Thanks [@jxom](https://github.com/jxom)! - Fixed ESM interop.
|
|
143
|
-
|
|
144
|
-
## 0.0.2
|
|
145
|
-
|
|
146
|
-
### Patch Changes
|
|
147
|
-
|
|
148
|
-
- [`00ccce6`](https://github.com/wevm/prool/commit/00ccce6c93ad34e940c1bd8366cfad27a65a2e78) Thanks [@jxom](https://github.com/jxom)! - `defineProxyPool` -> `createServer`
|
|
149
|
-
|
|
150
|
-
## 0.0.1
|
|
151
|
-
|
|
152
|
-
### Patch Changes
|
|
153
|
-
|
|
154
|
-
- [`1fd1b21`](https://github.com/wevm/prool/commit/1fd1b21096f463e4458c2df7f1cd9f855dc1d7ca) Thanks [@jxom](https://github.com/jxom)! - Initial release
|
package/_lib/exports/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { type DefineInstanceFn, type DefineInstanceReturnType, type Instance, type InstanceOptions, type InstanceStartOptions, defineInstance, } from '../instance.js';
|
|
2
|
-
export { type DefinePoolParameters, type DefinePoolReturnType, type Pool, definePool, } from '../pool.js';
|
|
3
|
-
export { type CreateServerParameters, type CreateServerReturnType, createServer, } from '../server.js';
|
|
4
|
-
export { type ExtractPathReturnType, extractPath, stripColors, toArgs, toFlagCase, } from '../utils.js';
|
|
5
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,gBAAgB,EACrB,KAAK,wBAAwB,EAC7B,KAAK,QAAQ,EACb,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,cAAc,GACf,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,oBAAoB,EACzB,KAAK,IAAI,EACT,UAAU,GACX,MAAM,YAAY,CAAA;AAEnB,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,YAAY,GACb,MAAM,cAAc,CAAA;AAErB,OAAO,EACL,KAAK,qBAAqB,EAC1B,WAAW,EACX,WAAW,EACX,MAAM,EACN,UAAU,GACX,MAAM,aAAa,CAAA"}
|
package/_lib/exports/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../exports/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,cAAc,GACf,MAAM,gBAAgB,CAAA;AAEvB,OAAO,EAIL,UAAU,GACX,MAAM,YAAY,CAAA;AAEnB,OAAO,EAGL,YAAY,GACb,MAAM,cAAc,CAAA;AAErB,OAAO,EAEL,WAAW,EACX,WAAW,EACX,MAAM,EACN,UAAU,GACX,MAAM,aAAa,CAAA"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { alto, type AltoParameters } from '../instances/alto.js';
|
|
2
|
-
export { anvil, type AnvilParameters } from '../instances/anvil.js';
|
|
3
|
-
export { rundler, type RundlerParameters } from '../instances/rundler.js';
|
|
4
|
-
export { silius, type SiliusParameters } from '../instances/silius.js';
|
|
5
|
-
export { stackup, type StackupParameters } from '../instances/stackup.js';
|
|
6
|
-
export { defineInstance, type DefineInstanceFn, type DefineInstanceReturnType, type Instance, type InstanceOptions, type InstanceStartOptions, } from '../instance.js';
|
|
7
|
-
//# sourceMappingURL=instances.d.ts.map
|