From 3d2625cabfa4ae48ecf8a8cfb9b89cce1555b935 Mon Sep 17 00:00:00 2001 From: jaipaljadeja Date: Mon, 29 Jul 2024 15:29:50 +0530 Subject: [PATCH] cli: add build command and refactor cli --- examples/cli/apibara.config.ts | 19 ++ examples/cli/package.json | 36 ++ examples/cli/src/indexer.ts | 93 ++++++ examples/cli/src/indexers/demo.indexer.ts | 9 + examples/cli/src/indexers/test.indexer.ts | 6 + examples/cli/src/instrumentation.ts | 43 +++ examples/cli/src/main.ts | 4 + examples/cli/tsconfig.json | 11 + packages/cli/apibara.config.ts | 13 - packages/cli/package.json | 9 +- packages/cli/src/commands/build.ts | 12 +- packages/cli/src/commands/prepare.ts | 3 +- packages/cli/src/config/defaults.ts | 5 +- packages/cli/src/config/index.ts | 7 +- packages/cli/src/config/loader.ts | 4 +- .../src/config/resolvers/preset.resolver.ts | 11 +- packages/cli/src/core/build/build.ts | 8 + packages/cli/src/core/build/prepare.ts | 12 + packages/cli/src/core/build/prod.ts | 32 ++ packages/cli/src/{ => core}/build/types.ts | 2 +- packages/cli/src/hooks/index.ts | 1 + packages/cli/src/index.ts | 3 + packages/cli/src/main.ts | 8 +- packages/cli/src/rollup/config.ts | 183 ++++++++++ packages/cli/src/types/config.ts | 36 +- packages/cli/src/types/index.ts | 5 + packages/cli/src/types/presets.ts | 2 - pnpm-lock.yaml | 315 +++++++++++++++++- 28 files changed, 826 insertions(+), 66 deletions(-) create mode 100644 examples/cli/apibara.config.ts create mode 100644 examples/cli/package.json create mode 100644 examples/cli/src/indexer.ts create mode 100644 examples/cli/src/indexers/demo.indexer.ts create mode 100644 examples/cli/src/indexers/test.indexer.ts create mode 100644 examples/cli/src/instrumentation.ts create mode 100644 examples/cli/src/main.ts create mode 100644 examples/cli/tsconfig.json delete mode 100644 packages/cli/apibara.config.ts create mode 100644 packages/cli/src/core/build/build.ts create mode 100644 packages/cli/src/core/build/prepare.ts create mode 100644 packages/cli/src/core/build/prod.ts rename packages/cli/src/{ => core}/build/types.ts (91%) create mode 100644 packages/cli/src/hooks/index.ts mode change 100644 => 100755 packages/cli/src/main.ts create mode 100644 packages/cli/src/rollup/config.ts create mode 100644 packages/cli/src/types/index.ts delete mode 100644 packages/cli/src/types/presets.ts diff --git a/examples/cli/apibara.config.ts b/examples/cli/apibara.config.ts new file mode 100644 index 0000000..348c1df --- /dev/null +++ b/examples/cli/apibara.config.ts @@ -0,0 +1,19 @@ +import { defineConfig } from "@apibara/cli"; +import { defaultSink } from "@apibara/indexer"; + +export default defineConfig({ + runtimeConfig: { + test: 123, + check: "something", + }, + presets: { + dev: { + runtimeConfig: { + test: 999, + }, + }, + }, + sink: { + default: () => defaultSink(), + }, +}); diff --git a/examples/cli/package.json b/examples/cli/package.json new file mode 100644 index 0000000..96d4fcd --- /dev/null +++ b/examples/cli/package.json @@ -0,0 +1,36 @@ +{ + "name": "example-cli", + "version": "1.0.0", + "private": true, + "scripts": { + "cli:build": "jiti ./src/main.ts build --dir ./src", + "cli:prepare": "jiti ./src/main.ts prepare --dir ./src", + "cli:start": "jiti ./dist/main.mjs", + "typecheck": "tsc --noEmit", + "lint": "biome check .", + "lint:fix": "pnpm lint --write", + "format": "biome format . --write" + }, + "dependencies": { + "@apibara/evm": "workspace:*", + "@apibara/indexer": "workspace:*", + "@apibara/protocol": "workspace:*", + "@apibara/cli": "workspace:*", + "@opentelemetry/api": "^1.9.0", + "@opentelemetry/exporter-trace-otlp-proto": "^0.52.0", + "@opentelemetry/resources": "^1.25.0", + "@opentelemetry/sdk-node": "^0.52.0", + "@opentelemetry/sdk-trace-base": "^1.25.0", + "@opentelemetry/semantic-conventions": "^1.25.0", + "better-sqlite3": "^11.1.2", + "citty": "^0.1.6", + "consola": "^3.2.3", + "csv-stringify": "^6.5.0", + "viem": "^2.12.4" + }, + "devDependencies": { + "@types/better-sqlite3": "^7.6.11", + "@types/node": "^20.12.12", + "jiti": "^1.21.0" + } +} diff --git a/examples/cli/src/indexer.ts b/examples/cli/src/indexer.ts new file mode 100644 index 0000000..c28dddd --- /dev/null +++ b/examples/cli/src/indexer.ts @@ -0,0 +1,93 @@ +import assert from "node:assert"; +import { EvmStream } from "@apibara/evm"; +import { defineIndexer, useIndexerContext } from "@apibara/indexer"; +import { trace } from "@opentelemetry/api"; +import consola from "consola"; +import { encodeEventTopics, parseAbi } from "viem"; + +const abi = parseAbi([ + "event Transfer(address indexed from, address indexed to, uint256 value)", +]); + +const tracer = trace.getTracer("evm-indexer-demo"); + +export function createIndexerConfig(streamUrl: string) { + return defineIndexer(EvmStream)({ + streamUrl, + finality: "accepted", + startingCursor: { + orderKey: 560875n, + }, + filter: { + logs: [ + { + strict: true, + topics: encodeEventTopics({ + abi, + eventName: "Transfer", + args: { from: null, to: null }, + }) as `0x${string}`[], + }, + ], + }, + async transform({ block: { header, logs, transactions } }) { + const ctx = useIndexerContext(); + ctx.counter += 1; + + if (!transactions || !header || !header.number) return []; + + return tracer.startActiveSpan("parseLogs", (span) => { + const rows = logs.map((log) => { + assert(log.topics.length === 3, "Transfer event has 3 topics"); + + const { args } = tracer.startActiveSpan("decodeEventLog", (span) => { + // const decoded = decodeEventLog({ + // abi, + // topics: log.topics as [`0x${string}`, ...`0x${string}`[]], + // data: log.data, + // eventName: "Transfer", + // }); + const decoded = { args: { from: "0x0", to: "0x0", value: "0" } }; + + span.end(); + return decoded; + }); + + return { + blockNumber: Number(header.number), + blockHash: header.hash, + logIndex: Number(log.logIndex), + fromAddress: args.from, + toAddress: args.to, + value: Number(args.value), + }; + }); + + span.end(); + return rows; + }); + }, + hooks: { + async "run:before"() {}, + "handler:after"({ output }) { + for (const transfer of output) { + consola.debug( + "Transfer", + transfer.blockNumber, + transfer.logIndex, + transfer.fromAddress, + transfer.toAddress, + transfer.value.toString(), + ); + } + }, + "sink:write"({ data }) { + consola.info("Wrote", data.length, "transfers"); + }, + "sink:flush"() { + consola.debug("Flushing"); + }, + }, + plugins: [], + }); +} diff --git a/examples/cli/src/indexers/demo.indexer.ts b/examples/cli/src/indexers/demo.indexer.ts new file mode 100644 index 0000000..263a586 --- /dev/null +++ b/examples/cli/src/indexers/demo.indexer.ts @@ -0,0 +1,9 @@ +import { createIndexer } from "@apibara/indexer"; +import { createIndexerConfig } from "../indexer"; + +export default function demoIndexer(runtimeConfig: unknown) { + console.log("demoIndexer runtimeConfig", runtimeConfig); + return createIndexer( + createIndexerConfig("http://mainnet-v2.starknet.a5a.ch:7007"), + ); +} diff --git a/examples/cli/src/indexers/test.indexer.ts b/examples/cli/src/indexers/test.indexer.ts new file mode 100644 index 0000000..277ae5b --- /dev/null +++ b/examples/cli/src/indexers/test.indexer.ts @@ -0,0 +1,6 @@ +import { createIndexer } from "@apibara/indexer"; +import { createIndexerConfig } from "../indexer"; + +export default createIndexer( + createIndexerConfig("http://mainnet-v2.starknet.a5a.ch:7007"), +); diff --git a/examples/cli/src/instrumentation.ts b/examples/cli/src/instrumentation.ts new file mode 100644 index 0000000..feeb160 --- /dev/null +++ b/examples/cli/src/instrumentation.ts @@ -0,0 +1,43 @@ +import { OTLPTraceExporter } from "@opentelemetry/exporter-trace-otlp-proto"; +import { Resource } from "@opentelemetry/resources"; +import * as opentelemetry from "@opentelemetry/sdk-node"; +import { + BatchSpanProcessor, + type SpanProcessor, +} from "@opentelemetry/sdk-trace-base"; +import { SEMRESATTRS_SERVICE_NAME } from "@opentelemetry/semantic-conventions"; +import consola from "consola"; + +let spanProcessor: SpanProcessor | undefined; + +const axiomApiKey = process.env.AXIOM_API_KEY; +const axiomDataset = process.env.AXIOM_DATASET ?? "evm-indexer-demo"; +if (axiomApiKey) { + const exporter = new OTLPTraceExporter({ + url: "https://api.axiom.co/v1/traces", + headers: { + Authorization: `Bearer ${axiomApiKey}`, + "X-Axiom-Dataset": axiomDataset, + }, + }); + spanProcessor = new BatchSpanProcessor(exporter); + consola.info("Sending traces to Axiom", axiomDataset); +} + +const resource = new Resource({ + [SEMRESATTRS_SERVICE_NAME]: "evm-indexer", +}); + +const sdk = new opentelemetry.NodeSDK( + spanProcessor + ? { + spanProcessor, + resource, + } + : { + resource, + }, +); + +consola.info("Starting OpenTelemetry SDK"); +sdk.start(); diff --git a/examples/cli/src/main.ts b/examples/cli/src/main.ts new file mode 100644 index 0000000..5614928 --- /dev/null +++ b/examples/cli/src/main.ts @@ -0,0 +1,4 @@ +import { mainCli } from "@apibara/cli"; +import { runMain } from "citty"; + +runMain(mainCli); diff --git a/examples/cli/tsconfig.json b/examples/cli/tsconfig.json new file mode 100644 index 0000000..9d05974 --- /dev/null +++ b/examples/cli/tsconfig.json @@ -0,0 +1,11 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "dist", + "declarationDir": "dist", + "noEmit": false, + "rootDir": "src", + "types": ["node"] + }, + "include": ["src/"] +} diff --git a/packages/cli/apibara.config.ts b/packages/cli/apibara.config.ts deleted file mode 100644 index e4949ec..0000000 --- a/packages/cli/apibara.config.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { defineConfig } from "./src/config"; - -export default defineConfig({ - runtimeConfig: { - test: 123, - }, - presets: { - dev: { - dev: true, - }, - }, - preset: "dev", -}); diff --git a/packages/cli/package.json b/packages/cli/package.json index 50e90b4..8f7cf8e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -20,7 +20,6 @@ } }, "scripts": { - "prepare": "jiti ./src/main.ts prepare", "build": "unbuild", "lint": "biome check .", "typecheck": "tsc --noEmit", @@ -28,6 +27,7 @@ "format": "biome format . --write" }, "devDependencies": { + "@types/fs-extra": "^11.0.4", "@types/node": "^20.14.0", "jiti": "^1.21.0", "unbuild": "^2.0.0", @@ -35,14 +35,21 @@ }, "dependencies": { "@apibara/indexer": "workspace:*", + "@rollup/plugin-commonjs": "^26.0.1", + "@rollup/plugin-json": "^6.1.0", + "@rollup/plugin-node-resolve": "^15.2.3", + "@rollup/plugin-typescript": "^11.1.6", "c12": "^1.11.1", "chokidar": "^3.6.0", "citty": "^0.1.6", "consola": "^3.2.3", + "defu": "^6.1.4", + "fs-extra": "^11.2.0", "hookable": "^5.5.3", "klona": "^2.0.6", "pathe": "^1.1.2", "rollup": "^4.18.1", + "tslib": "^2.6.3", "untyped": "^1.4.2" } } diff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.ts index 3fae247..ce189af 100644 --- a/packages/cli/src/commands/build.ts +++ b/packages/cli/src/commands/build.ts @@ -1,5 +1,9 @@ import { defineCommand } from "citty"; +import { resolve } from "pathe"; +import { createApibara } from "../apibara"; import { commonArgs } from "../common"; +import { build } from "../core/build/build"; +import { prepare } from "../core/build/prepare"; export default defineCommand({ meta: { @@ -10,6 +14,12 @@ export default defineCommand({ ...commonArgs, }, async run({ args }) { - // TODO + const rootDir = resolve((args.dir || args._dir || ".") as string); + const apibara = await createApibara({ + rootDir, + }); + await prepare(apibara); + await build(apibara); + await apibara.close(); }, }); diff --git a/packages/cli/src/commands/prepare.ts b/packages/cli/src/commands/prepare.ts index b6edc93..51ea497 100644 --- a/packages/cli/src/commands/prepare.ts +++ b/packages/cli/src/commands/prepare.ts @@ -1,8 +1,8 @@ import { defineCommand } from "citty"; import { resolve } from "pathe"; import { createApibara } from "../apibara"; -import { writeTypes } from "../build/types"; import { commonArgs } from "../common"; +import { writeTypes } from "../core/build/types"; export default defineCommand({ meta: { @@ -13,6 +13,7 @@ export default defineCommand({ ...commonArgs, }, async run({ args }) { + console.log("prepare", args); const rootDir = resolve((args.dir || ".") as string); const apibara = await createApibara({ rootDir }); await writeTypes(apibara); diff --git a/packages/cli/src/config/defaults.ts b/packages/cli/src/config/defaults.ts index 99b199c..4819d62 100644 --- a/packages/cli/src/config/defaults.ts +++ b/packages/cli/src/config/defaults.ts @@ -1,13 +1,12 @@ import { defaultSink } from "@apibara/indexer"; -import { defineConfig } from "."; +import { defineConfig } from "../config"; export const ApibaraDefaults = defineConfig({ - dev: false, rootDir: ".", outputDir: "./dist", runtimeConfig: {}, sink: { - default: defaultSink(), + default: () => defaultSink(), }, hooks: {}, }); diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts index 4164c96..1677c14 100644 --- a/packages/cli/src/config/index.ts +++ b/packages/cli/src/config/index.ts @@ -1,8 +1,11 @@ +import type { DeepPartial } from "../types"; import type { ApibaraConfig } from "../types/config"; export function defineConfig< // biome-ignore lint/complexity/noBannedTypes: - T extends Record>> = {}, ->(config: ApibaraConfig): ApibaraConfig { + T extends Record>> = {}, + // biome-ignore lint/complexity/noBannedTypes: + R extends Record = {}, +>(config: ApibaraConfig): ApibaraConfig { return config; } diff --git a/packages/cli/src/config/loader.ts b/packages/cli/src/config/loader.ts index f954098..13b1ffe 100644 --- a/packages/cli/src/config/loader.ts +++ b/packages/cli/src/config/loader.ts @@ -38,7 +38,9 @@ async function _loadUserConfig( ? watchConfig : loadConfig)({ name: "apibara", - cwd: configOverrides.rootDir, + // path from where apibara.config.ts is loaded + // defautl is "." path + // cwd: configOverrides.rootDir, overrides: { ...configOverrides, }, diff --git a/packages/cli/src/config/resolvers/preset.resolver.ts b/packages/cli/src/config/resolvers/preset.resolver.ts index 7d82356..96a191a 100644 --- a/packages/cli/src/config/resolvers/preset.resolver.ts +++ b/packages/cli/src/config/resolvers/preset.resolver.ts @@ -1,10 +1,9 @@ +import defu from "defu"; import type { ApibaraOptions } from "../../types/config"; export async function presetResolver(options: ApibaraOptions) { - const updateOptions = { - ...options, - ...(options.preset ? options.presets?.[options.preset] : {}), - }; - - Object.assign(options, updateOptions); + if (options.preset && options.presets?.[options.preset]) { + const new_options = defu(options.presets[options.preset], options); + Object.assign(options, new_options); + } } diff --git a/packages/cli/src/core/build/build.ts b/packages/cli/src/core/build/build.ts new file mode 100644 index 0000000..4d1ef98 --- /dev/null +++ b/packages/cli/src/core/build/build.ts @@ -0,0 +1,8 @@ +import { getRollupConfig } from "../../rollup/config"; +import type { Apibara } from "../../types/apibara"; +import { buildProduction } from "./prod"; + +export async function build(apibara: Apibara) { + const rollupConfig = getRollupConfig(apibara); + return await buildProduction(apibara, rollupConfig); +} diff --git a/packages/cli/src/core/build/prepare.ts b/packages/cli/src/core/build/prepare.ts new file mode 100644 index 0000000..f9c03c6 --- /dev/null +++ b/packages/cli/src/core/build/prepare.ts @@ -0,0 +1,12 @@ +import fsp from "node:fs/promises"; +import fse from "fs-extra"; +import type { Apibara } from "../../types/apibara"; + +export async function prepare(apibara: Apibara) { + await prepareDir(apibara.options.outputDir); +} + +async function prepareDir(dir: string) { + await fsp.mkdir(dir, { recursive: true }); + await fse.emptyDir(dir); +} diff --git a/packages/cli/src/core/build/prod.ts b/packages/cli/src/core/build/prod.ts new file mode 100644 index 0000000..7e4703a --- /dev/null +++ b/packages/cli/src/core/build/prod.ts @@ -0,0 +1,32 @@ +import { type OutputOptions, rollup } from "rollup"; +import type { Apibara } from "../../types/apibara"; +import type { RollupConfig } from "../../types/rollup"; + +export async function buildProduction( + apibara: Apibara, + rollupConfig: RollupConfig, +) { + try { + // Create a bundle + const bundle = await rollup(rollupConfig); + + // Generate output + if (Array.isArray(rollupConfig.output)) { + for (const outputOptions of rollupConfig.output) { + await bundle.write(outputOptions); + } + } else if (rollupConfig.output) { + await bundle.write(rollupConfig.output as OutputOptions); + } else { + throw new Error("No output options specified in Rollup config"); + } + + // Close the bundle + await bundle.close(); + + console.log("Build completed successfully!"); + } catch (error) { + console.error("Build failed:", error); + throw error; + } +} diff --git a/packages/cli/src/build/types.ts b/packages/cli/src/core/build/types.ts similarity index 91% rename from packages/cli/src/build/types.ts rename to packages/cli/src/core/build/types.ts index 0049e29..0f25bf0 100644 --- a/packages/cli/src/build/types.ts +++ b/packages/cli/src/core/build/types.ts @@ -1,5 +1,5 @@ import { type JSValue, generateTypes, resolveSchema } from "untyped"; -import type { Apibara } from "../types/apibara"; +import type { Apibara } from "../../types/apibara"; export async function writeTypes(apibara: Apibara) { // TODO write to a file diff --git a/packages/cli/src/hooks/index.ts b/packages/cli/src/hooks/index.ts new file mode 100644 index 0000000..3f315ee --- /dev/null +++ b/packages/cli/src/hooks/index.ts @@ -0,0 +1 @@ +export * from "./useRuntimeConfig"; diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index d66d2cd..c838408 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -1 +1,4 @@ export * from "./main"; +export * from "./types"; +export * from "./hooks"; +export * from "./config"; diff --git a/packages/cli/src/main.ts b/packages/cli/src/main.ts old mode 100644 new mode 100755 index 4b0c2ed..2735e9d --- a/packages/cli/src/main.ts +++ b/packages/cli/src/main.ts @@ -1,6 +1,6 @@ -import { defineCommand, runMain } from "citty"; +import { defineCommand } from "citty"; -const main = defineCommand({ +export const mainCli = defineCommand({ meta: { name: "apibara", description: "Apibara CLI", @@ -12,5 +12,5 @@ const main = defineCommand({ prepare: () => import("./commands/prepare").then((r) => r.default), }, }); - -runMain(main); +// TODO uncomment when we build the CLI +// runMain(mainCli); diff --git a/packages/cli/src/rollup/config.ts b/packages/cli/src/rollup/config.ts new file mode 100644 index 0000000..cd49ec1 --- /dev/null +++ b/packages/cli/src/rollup/config.ts @@ -0,0 +1,183 @@ +import { existsSync } from "node:fs"; +import { builtinModules } from "node:module"; +import commonjs from "@rollup/plugin-commonjs"; +import json from "@rollup/plugin-json"; +import { nodeResolve } from "@rollup/plugin-node-resolve"; +import typescript from "@rollup/plugin-typescript"; +import { readdirSync } from "fs-extra"; +import { basename, join } from "pathe"; +import type { Apibara } from "../types/apibara"; +import type { RollupConfig } from "../types/rollup"; + +export const getRollupConfig = ( + apibara: Apibara, + dev = false, +): RollupConfig => { + const extensions: string[] = [ + ".ts", + ".mjs", + ".js", + ".json", + ".node", + ".tsx", + ".jsx", + ]; + + const indexerDir = join(apibara.options.rootDir, "indexers"); + const configPath = join("./apibara.config.ts"); + + // Check if the indexers directory and config file exist + if (!existsSync(indexerDir)) { + throw new Error(`Indexers directory not found: ${indexerDir}`); + } + if (!existsSync(configPath)) { + throw new Error(`Config file not found: ${configPath}`); + } + + // Check if the indexers directory exists and is not empty + let indexerFiles: string[] = []; + try { + indexerFiles = readdirSync(indexerDir).filter((file) => + file.endsWith(".indexer.ts"), + ); + if (indexerFiles.length === 0) { + console.warn(`No indexer files found in ${indexerDir}`); + } + } catch (error) { + console.error(`Error reading indexers directory: ${error}`); + } + + const indexerImports = indexerFiles + .map( + (file, index) => + `import indexer${index} from '${join(indexerDir, file)}';`, + ) + .join("\n"); + + // Generate main.ts content + const mainContent = ` +import { createClient } from "@apibara/protocol"; +import { run } from "@apibara/indexer"; +import { defineCommand, runMain } from "citty"; +import config from './${configPath}'; + +${indexerImports} + +const indexers = { + ${indexerFiles + .map( + (file, index) => `'${basename(file, ".indexer.ts")}': indexer${index},`, + ) + .join("\n ")} +}; + +const command = defineCommand({ + meta: { + name: "run-indexers", + description: "Run Apibara indexers", + }, + args: { + indexers: { + type: "string", + description: "Comma-separated list of indexers to run", + }, + preset: { + type: "string", + description: "Preset to use", + }, + sink: { + type: "string", + description: "Sink to use", + }, + }, + async run({ args }) { + const selectedIndexers = args.indexers ? args.indexers.split(',') : Object.keys(indexers); + const preset = args.preset || config.preset || 'default'; + const sinkName = args.sink || 'default'; + + // Apply preset + let runtimeConfig = { ...config.runtimeConfig }; + if (preset && config.presets && config.presets[preset]) { + runtimeConfig = { ...runtimeConfig, ...config.presets[preset].runtimeConfig }; + } + + // Get sink function + const sinkFunction = config.sink?.[sinkName]; + if (!sinkFunction) { + throw new Error(\`Sink \${sinkName} not found\`); + } + + await Promise.all(selectedIndexers.map(async (name) => { + if (!indexers[name]) { + console.error(\`Indexer \${name} not found\`); + return; + } + + const indexerFactory = indexers[name]; + const indexer = typeof indexerFactory === 'function' + ? await indexerFactory(runtimeConfig) + : indexerFactory; + + const client = createClient(indexer.streamConfig, indexer.options.streamUrl); + const sink = sinkFunction(); + + try { + console.log("Running Indexer: ", name); + await run(client, indexer, sink); + } catch (error) { + console.error(\`Error in indexer \${name}:\`, error); + } + })); + }, +}); + +runMain(command); +`; + + return { + input: { + main: "virtual:main.ts", + }, + output: { + dir: join(apibara.options.outputDir || "dist"), + format: "esm", + entryFileNames: "[name].mjs", + chunkFileNames: "chunks/[name]-[hash].mjs", + }, + plugins: [ + commonjs(), + json(), + typescript({ + tsconfig: join("./tsconfig.json"), + }), + nodeResolve({ + extensions, + preferBuiltins: true, + }), + { + name: "virtual", + resolveId(id) { + if (id === "virtual:main.ts") { + return id; + } + return null; + }, + load(id) { + if (id === "virtual:main.ts") { + return mainContent; + } + return null; + }, + }, + ], + external: [ + ...builtinModules, + "@apibara/indexer", + "@apibara/protocol", + "@apibara/evm", + "@apibara/starknet", + "@apibara/beaconchain", + "@apibara/cli", + ], + }; +}; diff --git a/packages/cli/src/types/config.ts b/packages/cli/src/types/config.ts index e901b78..ae195ea 100644 --- a/packages/cli/src/types/config.ts +++ b/packages/cli/src/types/config.ts @@ -16,23 +16,20 @@ import type { RollupConfig } from "./rollup"; */ export interface ApibaraConfig< // biome-ignore lint/complexity/noBannedTypes: - T extends Record>> = {}, -> extends DeepPartial, "preset" | "presets">>, - C12InputConfig { + T extends Record>> = {}, + // biome-ignore lint/complexity/noBannedTypes: + R extends Record = {}, +> extends DeepPartial, "preset" | "presets" | "dev">>, + C12InputConfig> { sink?: { - default: Sink; - [key: string]: Sink; + default: () => Sink; + [key: string]: () => Sink; }; - dev?: boolean; - runtimeConfig?: ApibaraRuntimeConfig; + runtimeConfig?: R; presets?: T; preset?: keyof T; } -export interface ApibaraRuntimeConfig { - [key: string]: unknown; -} - export type ApibaraDynamicConfig = Pick; /** @@ -45,16 +42,20 @@ export interface LoadConfigOptions { export interface ApibaraOptions< // biome-ignore lint/complexity/noBannedTypes: - T extends Record>> = {}, + T extends Record>> = {}, + // biome-ignore lint/complexity/noBannedTypes: + R extends Record = {}, > { // Internal - _config: ApibaraConfig; - _c12: ResolvedConfig> | ConfigWatcher>; + _config: ApibaraConfig; + _c12: + | ResolvedConfig> + | ConfigWatcher>; // Sink sink: { - default: Sink; - [key: string]: Sink; + default: () => Sink; + [key: string]: () => Sink; }; // Presets @@ -63,7 +64,7 @@ export interface ApibaraOptions< // General debug: boolean; - runtimeConfig: ApibaraRuntimeConfig; + runtimeConfig: R; rootDir: string; outputDir: string; // Dev @@ -75,4 +76,5 @@ export interface ApibaraOptions< // Rollup rollupConfig?: RollupConfig; entry: string; + minify: boolean; } diff --git a/packages/cli/src/types/index.ts b/packages/cli/src/types/index.ts new file mode 100644 index 0000000..a3ff743 --- /dev/null +++ b/packages/cli/src/types/index.ts @@ -0,0 +1,5 @@ +export * from "./apibara"; +export * from "./_utils"; +export * from "./config"; +export * from "./hooks"; +export * from "./rollup"; diff --git a/packages/cli/src/types/presets.ts b/packages/cli/src/types/presets.ts deleted file mode 100644 index 1ebe7e7..0000000 --- a/packages/cli/src/types/presets.ts +++ /dev/null @@ -1,2 +0,0 @@ -// TODO -export type PresetName = string; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ca9b1a2..65482a4 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -49,6 +49,64 @@ importers: specifier: ^1.21.0 version: 1.21.0 + examples/cli: + dependencies: + '@apibara/cli': + specifier: workspace:* + version: link:../../packages/cli + '@apibara/evm': + specifier: workspace:* + version: link:../../packages/evm + '@apibara/indexer': + specifier: workspace:* + version: link:../../packages/indexer + '@apibara/protocol': + specifier: workspace:* + version: link:../../packages/protocol + '@opentelemetry/api': + specifier: ^1.9.0 + version: 1.9.0 + '@opentelemetry/exporter-trace-otlp-proto': + specifier: ^0.52.0 + version: 0.52.0(@opentelemetry/api@1.9.0) + '@opentelemetry/resources': + specifier: ^1.25.0 + version: 1.25.0(@opentelemetry/api@1.9.0) + '@opentelemetry/sdk-node': + specifier: ^0.52.0 + version: 0.52.0(@opentelemetry/api@1.9.0) + '@opentelemetry/sdk-trace-base': + specifier: ^1.25.0 + version: 1.25.0(@opentelemetry/api@1.9.0) + '@opentelemetry/semantic-conventions': + specifier: ^1.25.0 + version: 1.25.0 + better-sqlite3: + specifier: ^11.1.2 + version: 11.1.2 + citty: + specifier: ^0.1.6 + version: 0.1.6 + consola: + specifier: ^3.2.3 + version: 3.2.3 + csv-stringify: + specifier: ^6.5.0 + version: 6.5.0 + viem: + specifier: ^2.12.4 + version: 2.13.8(typescript@5.4.5) + devDependencies: + '@types/better-sqlite3': + specifier: ^7.6.11 + version: 7.6.11 + '@types/node': + specifier: ^20.12.12 + version: 20.14.0 + jiti: + specifier: ^1.21.0 + version: 1.21.6 + examples/evm-client: dependencies: '@apibara/evm': @@ -257,6 +315,18 @@ importers: '@apibara/indexer': specifier: workspace:* version: link:../indexer + '@rollup/plugin-commonjs': + specifier: ^26.0.1 + version: 26.0.1(rollup@4.18.1) + '@rollup/plugin-json': + specifier: ^6.1.0 + version: 6.1.0(rollup@4.18.1) + '@rollup/plugin-node-resolve': + specifier: ^15.2.3 + version: 15.2.3(rollup@4.18.1) + '@rollup/plugin-typescript': + specifier: ^11.1.6 + version: 11.1.6(rollup@4.18.1)(tslib@2.6.3)(typescript@5.4.5) c12: specifier: ^1.11.1 version: 1.11.1 @@ -269,6 +339,12 @@ importers: consola: specifier: ^3.2.3 version: 3.2.3 + defu: + specifier: ^6.1.4 + version: 6.1.4 + fs-extra: + specifier: ^11.2.0 + version: 11.2.0 hookable: specifier: ^5.5.3 version: 5.5.3 @@ -281,10 +357,16 @@ importers: rollup: specifier: ^4.18.1 version: 4.18.1 + tslib: + specifier: ^2.6.3 + version: 2.6.3 untyped: specifier: ^1.4.2 version: 1.4.2 devDependencies: + '@types/fs-extra': + specifier: ^11.0.4 + version: 11.0.4 '@types/node': specifier: ^20.14.0 version: 20.14.0 @@ -1548,6 +1630,18 @@ packages: yargs: 17.7.2 dev: false + /@isaacs/cliui@8.0.2: + resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==} + engines: {node: '>=12'} + dependencies: + string-width: 5.1.2 + string-width-cjs: /string-width@4.2.3 + strip-ansi: 7.1.0 + strip-ansi-cjs: /strip-ansi@6.0.1 + wrap-ansi: 8.1.0 + wrap-ansi-cjs: /wrap-ansi@7.0.0 + dev: false + /@jest/schemas@29.6.3: resolution: {integrity: sha512-mo5j5X+jIZmJQveBKeS/clAueipV7KgiX1vMgCxam1RNYiqE1w62n0/tJJnHtjW8ZHcQco5gY85jA3mi0L+nSA==} engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0} @@ -1889,6 +1983,13 @@ packages: engines: {node: '>=14'} dev: false + /@pkgjs/parseargs@0.11.0: + resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} + engines: {node: '>=14'} + requiresBuild: true + dev: false + optional: true + /@protobufjs/aspromise@1.1.2: resolution: {integrity: sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==} dev: false @@ -1963,6 +2064,24 @@ packages: rollup: 3.29.4 dev: true + /@rollup/plugin-commonjs@26.0.1(rollup@4.18.1): + resolution: {integrity: sha512-UnsKoZK6/aGIH6AdkptXhNvhaqftcjq3zZdT+LY5Ftms6JR06nADcDsYp5hTU9E2lbJUEOhdlY5J4DNTneM+jQ==} + engines: {node: '>=16.0.0 || 14 >= 14.17'} + peerDependencies: + rollup: ^2.68.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.18.1) + commondir: 1.0.1 + estree-walker: 2.0.2 + glob: 10.4.5 + is-reference: 1.2.1 + magic-string: 0.30.10 + rollup: 4.18.1 + dev: false + /@rollup/plugin-json@6.1.0(rollup@3.29.4): resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} engines: {node: '>=14.0.0'} @@ -1976,6 +2095,19 @@ packages: rollup: 3.29.4 dev: true + /@rollup/plugin-json@6.1.0(rollup@4.18.1): + resolution: {integrity: sha512-EGI2te5ENk1coGeADSIwZ7G2Q8CJS2sF120T7jLw4xFw9n7wIOXHo+kIYRAoVpJAN+kmqZSoO3Fp4JtoNF4ReA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.18.1) + rollup: 4.18.1 + dev: false + /@rollup/plugin-node-resolve@15.2.3(rollup@3.29.4): resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} engines: {node: '>=14.0.0'} @@ -1994,6 +2126,24 @@ packages: rollup: 3.29.4 dev: true + /@rollup/plugin-node-resolve@15.2.3(rollup@4.18.1): + resolution: {integrity: sha512-j/lym8nf5E21LwBT4Df1VD6hRO2L2iwUeUmP7litikRsVp1H6NWx20NEp0Y7su+7XGc476GnXXc4kFeZNGmaSQ==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.78.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.18.1) + '@types/resolve': 1.20.2 + deepmerge: 4.3.1 + is-builtin-module: 3.2.1 + is-module: 1.0.0 + resolve: 1.22.8 + rollup: 4.18.1 + dev: false + /@rollup/plugin-replace@5.0.5(rollup@3.29.4): resolution: {integrity: sha512-rYO4fOi8lMaTg/z5Jb+hKnrHHVn8j2lwkqwyS4kTRhKyWOLf2wST2sWXr4WzWiTcoHTp2sTjqUbqIj2E39slKQ==} engines: {node: '>=14.0.0'} @@ -2008,6 +2158,26 @@ packages: rollup: 3.29.4 dev: true + /@rollup/plugin-typescript@11.1.6(rollup@4.18.1)(tslib@2.6.3)(typescript@5.4.5): + resolution: {integrity: sha512-R92yOmIACgYdJ7dJ97p4K69I8gg6IEHt8M7dUBxN3W6nrO8uUxX5ixl0yU/N3aZTi8WhPuICvOHXQvF6FaykAA==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^2.14.0||^3.0.0||^4.0.0 + tslib: '*' + typescript: '>=3.7.0' + peerDependenciesMeta: + rollup: + optional: true + tslib: + optional: true + dependencies: + '@rollup/pluginutils': 5.1.0(rollup@4.18.1) + resolve: 1.22.8 + rollup: 4.18.1 + tslib: 2.6.3 + typescript: 5.4.5 + dev: false + /@rollup/pluginutils@5.1.0(rollup@3.29.4): resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} engines: {node: '>=14.0.0'} @@ -2023,6 +2193,21 @@ packages: rollup: 3.29.4 dev: true + /@rollup/pluginutils@5.1.0(rollup@4.18.1): + resolution: {integrity: sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==} + engines: {node: '>=14.0.0'} + peerDependencies: + rollup: ^1.20.0||^2.0.0||^3.0.0||^4.0.0 + peerDependenciesMeta: + rollup: + optional: true + dependencies: + '@types/estree': 1.0.5 + estree-walker: 2.0.2 + picomatch: 2.3.1 + rollup: 4.18.1 + dev: false + /@rollup/rollup-android-arm-eabi@4.18.1: resolution: {integrity: sha512-lncuC4aHicncmbORnx+dUaAgzee9cm/PbIqgWz1PpXuwc+sa1Ct83tnqUDy/GFKleLiN7ZIeytM6KJ4cAn1SxA==} cpu: [arm] @@ -2174,6 +2359,19 @@ packages: /@types/estree@1.0.5: resolution: {integrity: sha512-/kYRxGDLWzHOB7q+wtSUQlFrtcdUccpfy+X+9iMBpHK8QLLhx2wIPYuS5DYtR9Wa/YlZAbIovy7qVdB1Aq6Lyw==} + /@types/fs-extra@11.0.4: + resolution: {integrity: sha512-yTbItCNreRooED33qjunPthRcSjERP1r4MqCZc7wv0u2sUkzTFp45tgUfS5+r7FrZPdmCCNflLhVSP/o+SemsQ==} + dependencies: + '@types/jsonfile': 6.1.4 + '@types/node': 20.14.0 + dev: true + + /@types/jsonfile@6.1.4: + resolution: {integrity: sha512-D5qGUYwjvnNNextdU59/+fI+spnwtTFmyQP0h+PfIOSkNfpU6AOICUOkm4i0OnSk+NyjdPJrxCDro0sJsWlRpQ==} + dependencies: + '@types/node': 20.14.0 + dev: true + /@types/long@5.0.0: resolution: {integrity: sha512-eQs9RsucA/LNjnMoJvWG/nXa7Pot/RbBzilF/QRIU/xRl+0ApxrSUFsV5lmf01SvSlqMzJ7Zwxe440wmz2SJGA==} deprecated: This is a stub types definition. long provides its own type definitions, so you do not need this installed. @@ -2212,7 +2410,6 @@ packages: /@types/resolve@1.20.2: resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} - dev: true /@types/semver@7.5.8: resolution: {integrity: sha512-I8EUhyrgfLrcTkzV3TSsGyl1tSuPrEDzr0yd5m90UgNxQkyDXULk3b6MlQqTCpZpNtWe1K0hzclnZkTcLBe2UQ==} @@ -2305,6 +2502,11 @@ packages: resolution: {integrity: sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==} engines: {node: '>=8'} + /ansi-regex@6.0.1: + resolution: {integrity: sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==} + engines: {node: '>=12'} + dev: false + /ansi-styles@3.2.1: resolution: {integrity: sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==} engines: {node: '>=4'} @@ -2323,6 +2525,11 @@ packages: engines: {node: '>=10'} dev: true + /ansi-styles@6.2.1: + resolution: {integrity: sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==} + engines: {node: '>=12'} + dev: false + /anymatch@3.1.3: resolution: {integrity: sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==} engines: {node: '>= 8'} @@ -2408,7 +2615,6 @@ packages: /balanced-match@1.0.2: resolution: {integrity: sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==} - dev: true /base64-js@1.5.1: resolution: {integrity: sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==} @@ -2452,7 +2658,6 @@ packages: resolution: {integrity: sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==} dependencies: balanced-match: 1.0.2 - dev: true /braces@3.0.2: resolution: {integrity: sha512-b8um+L1RzM3WDSzvhm6gIz1yfTbBt6YTlcEKAvsmqCZZFw46z626lVj9j1yEPW33H5H+lBQpZMP1k8l+78Ha0A==} @@ -2485,7 +2690,6 @@ packages: /builtin-modules@3.3.0: resolution: {integrity: sha512-zhaCDicdLuWN5UbN5IMnFqNMhNfo919sH85y2/ea+5Yg9TsTkeZxpL+JLbp6cgYFS4sRLp3YV4S6yDuqVWHYOw==} engines: {node: '>=6'} - dev: true /c12@1.11.1: resolution: {integrity: sha512-KDU0TvSvVdaYcQKQ6iPHATGz/7p/KiVjPg4vQrB6Jg/wX9R0yl5RZxWm9IoZqaIHD2+6PZd81+KMGwRr/lRIUg==} @@ -2684,7 +2888,6 @@ packages: /commondir@1.0.1: resolution: {integrity: sha512-W9pAhw0ja1Edb5GVdIF1mjZw/ASI0AlShXM83UUGe2DVr5TdAPEA1OA8m/g8zWp9x6On7gqufY+FatDbC3MDQg==} - dev: true /confbox@0.1.7: resolution: {integrity: sha512-uJcB/FKZtBMCJpK8MQji6bJHgu1tixKPxRLeGkNzBoOZzpnZUJm0jm2/sBDWcuBx1dYgxV4JU+g5hmNxCyAmdA==} @@ -2924,7 +3127,6 @@ packages: /deepmerge@4.3.1: resolution: {integrity: sha512-3sUqbMEc77XqpdNO7FRyRog+eW3ph+GYCbj+rK+uYyRMuwsVy0rMiVtPn+QJlKFvWP/1PYpapqYn0Me2knFn+A==} engines: {node: '>=0.10.0'} - dev: true /defaults@1.0.4: resolution: {integrity: sha512-eFuaLoy/Rxalv2kr+lqMlUnrDWV+3j4pljOIJgLIhI058IQfWJ7vXhyEIHu+HtC738klGALYxOKDO0bQP3tg8A==} @@ -3015,6 +3217,10 @@ packages: engines: {node: '>=10'} dev: true + /eastasianwidth@0.2.0: + resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} + dev: false + /effect@3.2.6: resolution: {integrity: sha512-0DMjunl0BgBBcn0g5innUONI3fVz2BHLILUeemYivyStCXZl6G7rzMMiipjjFu+0oQ/FKinR+gwwAZEAvdabDw==} dev: false @@ -3025,6 +3231,10 @@ packages: /emoji-regex@8.0.0: resolution: {integrity: sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==} + /emoji-regex@9.2.2: + resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} + dev: false + /end-of-stream@1.4.4: resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==} dependencies: @@ -3227,7 +3437,6 @@ packages: /estree-walker@2.0.2: resolution: {integrity: sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==} - dev: true /estree-walker@3.0.3: resolution: {integrity: sha512-7RUKfXgSMMkzt6ZuXmqapOurLGPPfgj6l9uRZ7lRGolvk0y2yocc35LdcxKC5PQZdn2DMqioAQ2NoWcrTKmm6g==} @@ -3327,6 +3536,14 @@ packages: is-callable: 1.2.7 dev: true + /foreground-child@3.2.1: + resolution: {integrity: sha512-PXUUyLqrR2XCWICfv6ukppP96sdFwWbNEnfEMt7jNsISjMsvaLNinAHNDYyvkyU+SZG2BTSbT5NjG+vZslfGTA==} + engines: {node: '>=14'} + dependencies: + cross-spawn: 7.0.3 + signal-exit: 4.1.0 + dev: false + /fraction.js@4.3.7: resolution: {integrity: sha512-ZsDfxO51wGAXREY55a7la9LScWpwv9RxIrYABrlvOFBlH/ShPnrtsXeuUIfXKKOVicNxQ+o8JTbJvjS4M89yew==} dev: true @@ -3341,7 +3558,6 @@ packages: graceful-fs: 4.2.11 jsonfile: 6.1.0 universalify: 2.0.1 - dev: true /fs-extra@7.0.1: resolution: {integrity: sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==} @@ -3455,6 +3671,18 @@ packages: dependencies: is-glob: 4.0.3 + /glob@10.4.5: + resolution: {integrity: sha512-7Bv8RF0k6xjo7d4A/PxYLbUCfb6c+Vpd2/mB2yRDlew7Jb5hEXiCD9ibfO7wpk8i4sevK6DFny9h7EYbM3/sHg==} + hasBin: true + dependencies: + foreground-child: 3.2.1 + jackspeak: 3.4.3 + minimatch: 9.0.5 + minipass: 7.1.2 + package-json-from-dist: 1.0.0 + path-scurry: 1.11.1 + dev: false + /glob@8.1.0: resolution: {integrity: sha512-r8hpEjiQEYlF2QU0df3dS+nxxSIreXQS1qRhMJM0Q5NDdR386C7jb7Hwwod8Fgiuex+k0GFjgft18yvxm5XoCQ==} engines: {node: '>=12'} @@ -3521,7 +3749,6 @@ packages: /graceful-fs@4.2.11: resolution: {integrity: sha512-RbJ5/jmFcNNCcDV5o9eTnBLJ/HszWV0P73bc+Ff4nS/rJj+YaS6IGyiOL0VoBYX+l1Wrl3k63h/KrH+nhJ0XvQ==} - dev: true /grapheme-splitter@1.0.4: resolution: {integrity: sha512-bzh50DW9kTPM00T8y4o8vQg89Di9oLJVLW/KaOGIXJWP/iqCN6WKYkbNOF04vFLJhwcpYUh9ydh/+5vpOqV4YQ==} @@ -3680,7 +3907,6 @@ packages: engines: {node: '>=6'} dependencies: builtin-modules: 3.3.0 - dev: true /is-callable@1.2.7: resolution: {integrity: sha512-1BC0BVFhS/p0qtw6enp8e+8OD0UrK0oFLztSjNzhcKA3WDuJxxAPXzPuPtKkjEY9UUoEWlX/8fgKeu2S8i9JTA==} @@ -3722,7 +3948,6 @@ packages: /is-module@1.0.0: resolution: {integrity: sha512-51ypPSPCoTEIN9dy5Oy+h4pShgJmPCygKfyRCISBI+JoWT/2oJvK8QPxmwv7b/p239jXrm9M1mlQbyKJ5A152g==} - dev: true /is-negative-zero@2.0.3: resolution: {integrity: sha512-5KoIu2Ngpyek75jXodFvnafB6DJgr3u8uuK0LEZJjrU19DrMD3EVERaR8sjz8CCGgpZvxPl9SuE1GMVPFHx1mw==} @@ -3749,7 +3974,6 @@ packages: resolution: {integrity: sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==} dependencies: '@types/estree': 1.0.5 - dev: true /is-regex@1.1.4: resolution: {integrity: sha512-kvRdxDsxZjhzUX07ZnLydzS1TU/TJlTUHHY4YLL87e37oUA49DfkLqgy+VjFocowy29cKvcSiu+kIv728jTTVg==} @@ -3823,6 +4047,14 @@ packages: dependencies: ws: 8.13.0 + /jackspeak@3.4.3: + resolution: {integrity: sha512-OGlZQpz2yfahA/Rd1Y8Cd9SIEsqvXkLVoSw/cgwhnhFMDbsQFeZYoJJ7bIZBS9BcamUW96asq/npPWugM+RQBw==} + dependencies: + '@isaacs/cliui': 8.0.2 + optionalDependencies: + '@pkgjs/parseargs': 0.11.0 + dev: false + /jiti@1.21.0: resolution: {integrity: sha512-gFqAIbuKyyso/3G2qhiO2OM6shY6EPP/R0+mkDbyspxKazh8BXDC5FiFsUjlczgdNz/vfra0da2y+aHrusLG/Q==} hasBin: true @@ -3874,7 +4106,6 @@ packages: universalify: 2.0.1 optionalDependencies: graceful-fs: 4.2.11 - dev: true /kind-of@6.0.3: resolution: {integrity: sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==} @@ -3961,6 +4192,10 @@ packages: get-func-name: 2.0.2 dev: true + /lru-cache@10.4.3: + resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==} + dev: false + /lru-cache@4.1.5: resolution: {integrity: sha512-sWZlbEP2OsHNkXrMl5GYk/jKk70MBng6UU4YI/qGDYbgf6YbP4EvmqISbXCoJiRKs+1bSpFHVgQxvJ17F2li5g==} dependencies: @@ -4055,6 +4290,13 @@ packages: brace-expansion: 2.0.1 dev: true + /minimatch@9.0.5: + resolution: {integrity: sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==} + engines: {node: '>=16 || 14 >=14.17'} + dependencies: + brace-expansion: 2.0.1 + dev: false + /minimist-options@4.1.0: resolution: {integrity: sha512-Q4r8ghd80yhO/0j1O3B2BjweX3fiHg9cdOwjJd2J76Q135c+NDxGCqdYKQ1SKBuFfgWbAUzBfvYjPUEeNgqN1A==} engines: {node: '>= 6'} @@ -4079,6 +4321,11 @@ packages: engines: {node: '>=8'} dev: false + /minipass@7.1.2: + resolution: {integrity: sha512-qOOzS1cBTWYF4BH8fVePDBOO9iptMnGUEZwNc/cMWnTV2nVLZ7VoNWEPHkYczZA0pdoA7dl6e7FL659nX9S2aw==} + engines: {node: '>=16 || 14 >=14.17'} + dev: false + /minizlib@2.1.2: resolution: {integrity: sha512-bAxsR8BVfj60DWXHE3u30oHzfl4G7khkSuPW+qvpd7jFRHm7dLxOjUk1EHACJ/hxLY8phGJ0YhYHZo7jil7Qdg==} engines: {node: '>= 8'} @@ -4349,6 +4596,10 @@ packages: engines: {node: '>=6'} dev: true + /package-json-from-dist@1.0.0: + resolution: {integrity: sha512-dATvCeZN/8wQsGywez1mzHtTlP22H8OEfPrVMLNr4/eGa+ijtLn/6M5f0dY8UKNrC2O9UCU6SSoG3qRKnt7STw==} + dev: false + /parse-json@5.2.0: resolution: {integrity: sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==} engines: {node: '>=8'} @@ -4375,6 +4626,14 @@ packages: /path-parse@1.0.7: resolution: {integrity: sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==} + /path-scurry@1.11.1: + resolution: {integrity: sha512-Xa4Nw17FS9ApQFJ9umLiJS4orGjm7ZzwUrwamcGQuHSzDyth9boKDaycYdDcZDuqYATXw4HFXgaqWTctW/v1HA==} + engines: {node: '>=16 || 14 >=14.18'} + dependencies: + lru-cache: 10.4.3 + minipass: 7.1.2 + dev: false + /path-type@4.0.0: resolution: {integrity: sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==} engines: {node: '>=8'} @@ -5250,6 +5509,15 @@ packages: is-fullwidth-code-point: 3.0.0 strip-ansi: 6.0.1 + /string-width@5.1.2: + resolution: {integrity: sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==} + engines: {node: '>=12'} + dependencies: + eastasianwidth: 0.2.0 + emoji-regex: 9.2.2 + strip-ansi: 7.1.0 + dev: false + /string.prototype.trim@1.2.9: resolution: {integrity: sha512-klHuCNxiMZ8MlsOihJhJEBJAiMVqU3Z2nEXWfWnIqjN0gEFS9J9+IxKozWWtQGcgoa1WUZzLjKPTr4ZHNFTFxw==} engines: {node: '>= 0.4'} @@ -5289,6 +5557,13 @@ packages: dependencies: ansi-regex: 5.0.1 + /strip-ansi@7.1.0: + resolution: {integrity: sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==} + engines: {node: '>=12'} + dependencies: + ansi-regex: 6.0.1 + dev: false + /strip-bom@3.0.0: resolution: {integrity: sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==} engines: {node: '>=4'} @@ -5437,6 +5712,10 @@ packages: resolution: {integrity: sha512-tLJxacIQUM82IR7JO1UUkKlYuUTmoY9HBJAmNWFzheSlDS5SPMcNIepejHJa4BpPQLAcbRhRf3GDJzyj6rbKvA==} dev: false + /tslib@2.6.3: + resolution: {integrity: sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ==} + dev: false + /tty-table@4.2.3: resolution: {integrity: sha512-Fs15mu0vGzCrj8fmJNP7Ynxt5J7praPXqFN0leZeZBXJwkMxv9cb2D454k1ltrtUSJbZ4yH4e0CynsHLxmUfFA==} engines: {node: '>=8.0.0'} @@ -5662,7 +5941,6 @@ packages: /universalify@2.0.1: resolution: {integrity: sha512-gptHNQghINnc/vTGIk0SOFGFNXw7JVrlRUtConJRlvaw6DuX0wO5Jeko9sWrMBhh+PsYAZ7oXAiOnf/UKogyiw==} engines: {node: '>= 10.0.0'} - dev: true /unplugin@1.10.1: resolution: {integrity: sha512-d6Mhq8RJeGA8UfKCu54Um4lFA0eSaRa3XxdAJg8tIdxbu1ubW0hBCZUL7yI2uGyYCRndvbK8FLHzqy2XKfeMsg==} @@ -6214,6 +6492,15 @@ packages: string-width: 4.2.3 strip-ansi: 6.0.1 + /wrap-ansi@8.1.0: + resolution: {integrity: sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==} + engines: {node: '>=12'} + dependencies: + ansi-styles: 6.2.1 + string-width: 5.1.2 + strip-ansi: 7.1.0 + dev: false + /wrappy@1.0.2: resolution: {integrity: sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==}