From 2f0f95dbe27f3555516642a57aef4ccde45f9543 Mon Sep 17 00:00:00 2001 From: Kyle Scott Date: Thu, 9 Nov 2023 21:40:39 -0500 Subject: [PATCH 1/6] almost to esm --- .eslintrc | 4 + package.json | 2 +- packages/core/package.json | 9 +- packages/core/src/Ponder.ts | 49 +-- .../core/src/_test/art-gobblers/app.test.ts | 6 +- packages/core/src/_test/constants.ts | 4 +- packages/core/src/_test/ens/app.test.ts | 6 +- packages/core/src/_test/globalSetup.ts | 2 +- packages/core/src/_test/setup.ts | 30 +- packages/core/src/bin/ponder.ts | 4 +- packages/core/src/build/functions.ts | 10 +- packages/core/src/build/service.ts | 15 +- packages/core/src/codegen/service.ts | 7 +- packages/core/src/config/abi.ts | 2 +- packages/core/src/config/config.test-d.ts | 9 +- packages/core/src/config/database.ts | 10 +- packages/core/src/config/factories.test.ts | 5 +- packages/core/src/config/factories.ts | 9 +- packages/core/src/config/networks.test.ts | 2 +- packages/core/src/config/networks.ts | 12 +- packages/core/src/config/options.ts | 2 +- packages/core/src/config/sources.test.ts | 7 +- packages/core/src/config/sources.ts | 27 +- packages/core/src/errors/postgres.ts | 6 +- packages/core/src/errors/queue.ts | 4 +- packages/core/src/errors/service.ts | 2 +- packages/core/src/errors/sqlite.ts | 4 +- packages/core/src/index.ts | 14 +- .../core/src/indexing-store/postgres/store.ts | 14 +- .../core/src/indexing-store/sqlite/store.ts | 14 +- .../core/src/indexing-store/store.test.ts | 4 +- packages/core/src/indexing-store/store.ts | 4 +- .../core/src/indexing-store/utils/format.ts | 4 +- .../indexing-store/utils/pagination.test.ts | 2 +- .../core/src/indexing-store/utils/where.ts | 6 +- packages/core/src/indexing/model.ts | 8 +- .../core/src/indexing/ponderActions.test.ts | 6 +- packages/core/src/indexing/ponderActions.ts | 4 +- packages/core/src/indexing/service.test.ts | 18 +- packages/core/src/indexing/service.ts | 50 +-- packages/core/src/indexing/trace.ts | 2 +- packages/core/src/indexing/transport.test.ts | 11 +- packages/core/src/indexing/transport.ts | 7 +- packages/core/src/schema/columns.test-d.ts | 12 +- packages/core/src/schema/columns.test.ts | 2 +- packages/core/src/schema/columns.ts | 4 +- packages/core/src/schema/index.ts | 6 +- packages/core/src/schema/schema.test-d.ts | 6 +- packages/core/src/schema/schema.test.ts | 2 +- packages/core/src/schema/schema.ts | 6 +- packages/core/src/schema/types.ts | 4 +- packages/core/src/schema/utils.test.ts | 4 +- packages/core/src/schema/utils.ts | 4 +- packages/core/src/server/graphql/entity.ts | 10 +- packages/core/src/server/graphql/plural.ts | 11 +- .../core/src/server/graphql/schema.test.ts | 4 +- packages/core/src/server/graphql/schema.ts | 10 +- packages/core/src/server/graphql/singular.ts | 8 +- packages/core/src/server/service.test.ts | 16 +- packages/core/src/server/service.ts | 11 +- .../core/src/sync-gateway/service.test.ts | 12 +- packages/core/src/sync-gateway/service.ts | 19 +- .../core/src/sync-historical/service.test.ts | 12 +- packages/core/src/sync-historical/service.ts | 21 +- .../core/src/sync-historical/utils.test.ts | 2 +- packages/core/src/sync-realtime/bloom.ts | 2 +- .../core/src/sync-realtime/filter.test.ts | 2 +- packages/core/src/sync-realtime/filter.ts | 2 +- packages/core/src/sync-realtime/format.ts | 2 +- .../core/src/sync-realtime/service.test.ts | 18 +- packages/core/src/sync-realtime/service.ts | 24 +- .../core/src/sync-store/postgres/format.ts | 2 +- .../sync-store/postgres/migrations.test.ts | 6 +- .../src/sync-store/postgres/migrations.ts | 3 +- .../core/src/sync-store/postgres/store.ts | 22 +- packages/core/src/sync-store/sqlite/format.ts | 4 +- .../src/sync-store/sqlite/migrations.test.ts | 6 +- .../core/src/sync-store/sqlite/migrations.ts | 3 +- packages/core/src/sync-store/sqlite/store.ts | 26 +- packages/core/src/sync-store/store.test.ts | 6 +- packages/core/src/sync-store/store.ts | 8 +- packages/core/src/telemetry/service.test.ts | 2 +- packages/core/src/telemetry/service.ts | 13 +- packages/core/src/types/model.test-d.ts | 6 +- packages/core/src/types/model.ts | 4 +- packages/core/src/types/ponder.test-d.ts | 8 +- packages/core/src/types/ponder.ts | 20 +- packages/core/src/types/transaction.ts | 2 +- packages/core/src/ui/HistoricalBar.tsx | 6 +- packages/core/src/ui/IndexingBar.tsx | 6 +- packages/core/src/ui/app.tsx | 6 +- packages/core/src/ui/service.ts | 8 +- packages/core/src/utils/encoding.test.ts | 2 +- packages/core/src/utils/fragments.test.ts | 4 +- packages/core/src/utils/fragments.ts | 2 +- packages/core/src/utils/interval.test.ts | 2 +- packages/core/src/utils/offset.test.ts | 2 +- packages/core/src/utils/poll.ts | 2 +- packages/core/src/utils/queue.ts | 9 +- packages/core/tsconfig.base.json | 4 +- packages/core/tsconfig.build.json | 2 +- pnpm-lock.yaml | 395 +++++++----------- 102 files changed, 592 insertions(+), 652 deletions(-) diff --git a/.eslintrc b/.eslintrc index 0c768f01c..f215c9658 100644 --- a/.eslintrc +++ b/.eslintrc @@ -15,6 +15,10 @@ "simple-import-sort/exports": "error", "import/first": "error", "import/newline-after-import": "error", + "@typescript-eslint/consistent-type-imports": [ + "error", + { "prefer": "type-imports" } + ], "@typescript-eslint/no-var-requires": "off", "@typescript-eslint/no-explicit-any": "off", "@typescript-eslint/no-non-null-assertion": "off", diff --git a/package.json b/package.json index fc8b9f948..06e14be99 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "lint-staged": "^13.2.3", "prettier": "^2.8.8", "simple-git-hooks": "^2.9.0", - "typescript": "^5.1.3" + "typescript": "^5.2.2" }, "lint-staged": { "*.ts": [ diff --git a/packages/core/package.json b/packages/core/package.json index 2c21d658c..2e9233a2d 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -3,6 +3,7 @@ "version": "0.0.95", "description": "An open-source framework for crypto application backends", "license": "MIT", + "type": "module", "repository": { "type": "git", "url": "https://github.com/0xOlias/ponder", @@ -38,7 +39,7 @@ "async-mutex": "^0.4.0", "better-sqlite3": "^8.7.0", "cac": "^6.7.14", - "conf": "^10.2.0", + "conf": "^12.0.0", "cors": "^2.8.5", "data-uri-to-buffer": "3.0.1", "detect-package-manager": "^2.0.1", @@ -53,7 +54,7 @@ "ink": "^3.2.0", "kysely": "^0.24.2", "p-limit": "3", - "p-queue": "^6.6.2", + "p-queue": "^7.4.1", "pg": "^8.9.0", "picocolors": "^1.0.0", "pino": "^8.14.1", @@ -71,7 +72,7 @@ "@types/cors": "^2.8.12", "@types/express": "^4.17.13", "@types/glob": "^8.0.0", - "@types/node": "^18.7.8", + "@types/node": "^20.9.0", "@types/pg": "^8.6.6", "@types/react": "^18.0.25", "@types/retry": "^0.12.2", @@ -81,7 +82,7 @@ "rimraf": "^5.0.1", "supertest": "^6.3.3", "tsc-alias": "^1.8.2", - "typescript": "^5.1.3", + "typescript": "^5.2.2", "vitest": "^0.34.6" } } diff --git a/packages/core/src/Ponder.ts b/packages/core/src/Ponder.ts index e9c7b371c..712767133 100644 --- a/packages/core/src/Ponder.ts +++ b/packages/core/src/Ponder.ts @@ -1,30 +1,31 @@ import path from "node:path"; import process from "node:process"; -import { BuildService } from "@/build/service"; -import { CodegenService } from "@/codegen/service"; -import { buildDatabase } from "@/config/database"; -import { type Network, buildNetwork } from "@/config/networks"; -import { type Options } from "@/config/options"; -import { UserErrorService } from "@/errors/service"; -import { IndexingService } from "@/indexing/service"; -import { PostgresIndexingStore } from "@/indexing-store/postgres/store"; -import { SqliteIndexingStore } from "@/indexing-store/sqlite/store"; -import { type IndexingStore } from "@/indexing-store/store"; -import { LoggerService } from "@/logs/service"; -import { MetricsService } from "@/metrics/service"; -import { ServerService } from "@/server/service"; -import { SyncGateway } from "@/sync-gateway/service"; -import { HistoricalSyncService } from "@/sync-historical/service"; -import { RealtimeSyncService } from "@/sync-realtime/service"; -import { PostgresSyncStore } from "@/sync-store/postgres/store"; -import { SqliteSyncStore } from "@/sync-store/sqlite/store"; -import { type SyncStore } from "@/sync-store/store"; -import { TelemetryService } from "@/telemetry/service"; -import { UiService } from "@/ui/service"; - -import { hydrateIndexingFunctions } from "./build/functions"; -import { buildSources, Source } from "./config/sources"; +import { BuildService } from "@/build/service.js"; +import { CodegenService } from "@/codegen/service.js"; +import { buildDatabase } from "@/config/database.js"; +import { type Network, buildNetwork } from "@/config/networks.js"; +import { type Options } from "@/config/options.js"; +import { UserErrorService } from "@/errors/service.js"; +import { IndexingService } from "@/indexing/service.js"; +import { PostgresIndexingStore } from "@/indexing-store/postgres/store.js"; +import { SqliteIndexingStore } from "@/indexing-store/sqlite/store.js"; +import { type IndexingStore } from "@/indexing-store/store.js"; +import { LoggerService } from "@/logs/service.js"; +import { MetricsService } from "@/metrics/service.js"; +import { ServerService } from "@/server/service.js"; +import { SyncGateway } from "@/sync-gateway/service.js"; +import { HistoricalSyncService } from "@/sync-historical/service.js"; +import { RealtimeSyncService } from "@/sync-realtime/service.js"; +import { PostgresSyncStore } from "@/sync-store/postgres/store.js"; +import { SqliteSyncStore } from "@/sync-store/sqlite/store.js"; +import { type SyncStore } from "@/sync-store/store.js"; +import { TelemetryService } from "@/telemetry/service.js"; +import { UiService } from "@/ui/service.js"; + +import { hydrateIndexingFunctions } from "./build/functions.js"; +import type { Source } from "./config/sources.js"; +import { buildSources } from "./config/sources.js"; export type Common = { options: Options; diff --git a/packages/core/src/_test/art-gobblers/app.test.ts b/packages/core/src/_test/art-gobblers/app.test.ts index 7b63ab632..bc5bc2a5f 100644 --- a/packages/core/src/_test/art-gobblers/app.test.ts +++ b/packages/core/src/_test/art-gobblers/app.test.ts @@ -2,9 +2,9 @@ import { rmSync } from "node:fs"; import request from "supertest"; import { type TestContext, afterEach, beforeEach, expect, test } from "vitest"; -import { setupIndexingStore, setupSyncStore } from "@/_test/setup"; -import { buildOptions } from "@/config/options"; -import { Ponder } from "@/Ponder"; +import { setupIndexingStore, setupSyncStore } from "@/_test/setup.js"; +import { buildOptions } from "@/config/options.js"; +import { Ponder } from "@/Ponder.js"; beforeEach((context) => setupSyncStore(context)); beforeEach((context) => setupIndexingStore(context)); diff --git a/packages/core/src/_test/constants.ts b/packages/core/src/_test/constants.ts index eb6123dc6..b1bfeb2ce 100644 --- a/packages/core/src/_test/constants.ts +++ b/packages/core/src/_test/constants.ts @@ -5,8 +5,8 @@ import { parseAbiItem, } from "viem"; -import { getEvents } from "@/config/abi"; -import { buildFactoryCriteria } from "@/config/factories"; +import { getEvents } from "@/config/abi.js"; +import { buildFactoryCriteria } from "@/config/factories.js"; export const FORK_BLOCK_NUMBER = 16380000n; diff --git a/packages/core/src/_test/ens/app.test.ts b/packages/core/src/_test/ens/app.test.ts index 46a9726e9..76c6da7f1 100644 --- a/packages/core/src/_test/ens/app.test.ts +++ b/packages/core/src/_test/ens/app.test.ts @@ -2,9 +2,9 @@ import { rmSync } from "node:fs"; import request from "supertest"; import { type TestContext, afterEach, beforeEach, expect, test } from "vitest"; -import { setupIndexingStore, setupSyncStore } from "@/_test/setup"; -import { buildOptions } from "@/config/options"; -import { Ponder } from "@/Ponder"; +import { setupIndexingStore, setupSyncStore } from "@/_test/setup.js"; +import { buildOptions } from "@/config/options.js"; +import { Ponder } from "@/Ponder.js"; beforeEach((context) => setupSyncStore(context)); beforeEach((context) => setupIndexingStore(context)); diff --git a/packages/core/src/_test/globalSetup.ts b/packages/core/src/_test/globalSetup.ts index 0b413ee17..fc5243b2a 100644 --- a/packages/core/src/_test/globalSetup.ts +++ b/packages/core/src/_test/globalSetup.ts @@ -2,7 +2,7 @@ import { startProxy } from "@viem/anvil"; import dotenv from "dotenv"; import { Pool } from "pg"; -import { FORK_BLOCK_NUMBER } from "./constants"; +import { FORK_BLOCK_NUMBER } from "./constants.js"; export default async function () { dotenv.config({ path: ".env.local" }); diff --git a/packages/core/src/_test/setup.ts b/packages/core/src/_test/setup.ts index 6f9e7805d..b978f92a5 100644 --- a/packages/core/src/_test/setup.ts +++ b/packages/core/src/_test/setup.ts @@ -2,22 +2,22 @@ import SqliteDatabase from "better-sqlite3"; import { Pool } from "pg"; import { type TestContext, beforeEach } from "vitest"; -import { patchSqliteDatabase } from "@/config/database"; -import { buildOptions } from "@/config/options"; -import { UserErrorService } from "@/errors/service"; -import { PostgresIndexingStore } from "@/indexing-store/postgres/store"; -import { SqliteIndexingStore } from "@/indexing-store/sqlite/store"; -import type { IndexingStore } from "@/indexing-store/store"; -import { LoggerService } from "@/logs/service"; -import { MetricsService } from "@/metrics/service"; -import type { Common } from "@/Ponder"; -import { PostgresSyncStore } from "@/sync-store/postgres/store"; -import { SqliteSyncStore } from "@/sync-store/sqlite/store"; -import type { SyncStore } from "@/sync-store/store"; -import { TelemetryService } from "@/telemetry/service"; +import { patchSqliteDatabase } from "@/config/database.js"; +import { buildOptions } from "@/config/options.js"; +import { UserErrorService } from "@/errors/service.js"; +import { PostgresIndexingStore } from "@/indexing-store/postgres/store.js"; +import { SqliteIndexingStore } from "@/indexing-store/sqlite/store.js"; +import type { IndexingStore } from "@/indexing-store/store.js"; +import { LoggerService } from "@/logs/service.js"; +import { MetricsService } from "@/metrics/service.js"; +import type { Common } from "@/Ponder.js"; +import { PostgresSyncStore } from "@/sync-store/postgres/store.js"; +import { SqliteSyncStore } from "@/sync-store/sqlite/store.js"; +import type { SyncStore } from "@/sync-store/store.js"; +import { TelemetryService } from "@/telemetry/service.js"; -import { FORK_BLOCK_NUMBER, vitalik } from "./constants"; -import { poolId, testClient } from "./utils"; +import { FORK_BLOCK_NUMBER, vitalik } from "./constants.js"; +import { poolId, testClient } from "./utils.js"; /** * Inject an isolated sync store into the test context. diff --git a/packages/core/src/bin/ponder.ts b/packages/core/src/bin/ponder.ts index aaa0e94c8..32d00ae10 100644 --- a/packages/core/src/bin/ponder.ts +++ b/packages/core/src/bin/ponder.ts @@ -2,8 +2,8 @@ import { cac } from "cac"; import dotenv from "dotenv"; -import { buildOptions } from "@/config/options"; -import { Ponder } from "@/Ponder"; +import { buildOptions } from "@/config/options.js"; +import { Ponder } from "@/Ponder.js"; // NOTE: This is a workaround for tsconfig `rootDir` nonsense. // eslint-disable-next-line @typescript-eslint/ban-ts-comment diff --git a/packages/core/src/build/functions.ts b/packages/core/src/build/functions.ts index 4ab0789bc..d6ef7b9e9 100644 --- a/packages/core/src/build/functions.ts +++ b/packages/core/src/build/functions.ts @@ -1,10 +1,10 @@ import type { Hex } from "viem"; -import type { LogEventMetadata } from "@/config/abi"; -import { Source } from "@/config/sources"; -import type { Block } from "@/types/block"; -import type { Log } from "@/types/log"; -import type { Transaction } from "@/types/transaction"; +import type { LogEventMetadata } from "@/config/abi.js"; +import type { Source } from "@/config/sources.js"; +import type { Block } from "@/types/block.js"; +import type { Log } from "@/types/log.js"; +import type { Transaction } from "@/types/transaction.js"; export interface LogEvent { name: string; diff --git a/packages/core/src/build/service.ts b/packages/core/src/build/service.ts index 6a7dc2c94..b13b9e69e 100644 --- a/packages/core/src/build/service.ts +++ b/packages/core/src/build/service.ts @@ -10,13 +10,14 @@ import type { ViteNodeRunner } from "vite-node/client"; // @ts-ignore import type { ViteNodeServer } from "vite-node/server"; -import type { Config } from "@/config/config"; -import type { Common } from "@/Ponder"; -import type { Schema } from "@/schema/types"; -import { buildGqlSchema } from "@/server/graphql/schema"; - -import type { RawIndexingFunctions } from "./functions"; -import { parseViteNodeError, ViteNodeError } from "./stacktrace"; +import type { Config } from "@/config/config.js"; +import type { Common } from "@/Ponder.js"; +import type { Schema } from "@/schema/types.js"; +import { buildGqlSchema } from "@/server/graphql/schema.js"; + +import type { RawIndexingFunctions } from "./functions.js"; +import type { ViteNodeError } from "./stacktrace.js"; +import { parseViteNodeError } from "./stacktrace.js"; type BuildServiceEvents = { newConfig: { config: Config }; diff --git a/packages/core/src/codegen/service.ts b/packages/core/src/codegen/service.ts index 3cddc1e43..fee777cd1 100644 --- a/packages/core/src/codegen/service.ts +++ b/packages/core/src/codegen/service.ts @@ -1,10 +1,11 @@ import Emittery from "emittery"; -import { GraphQLSchema, printSchema } from "graphql"; +import type { GraphQLSchema } from "graphql"; +import { printSchema } from "graphql"; import { writeFileSync } from "node:fs"; import path from "node:path"; -import type { Common } from "@/Ponder"; -import { ensureDirExists } from "@/utils/exists"; +import type { Common } from "@/Ponder.js"; +import { ensureDirExists } from "@/utils/exists.js"; export class CodegenService extends Emittery { private common: Common; diff --git a/packages/core/src/config/abi.ts b/packages/core/src/config/abi.ts index 948893faf..b97beff18 100644 --- a/packages/core/src/config/abi.ts +++ b/packages/core/src/config/abi.ts @@ -1,7 +1,7 @@ import { type Abi, type AbiEvent, formatAbiItem } from "abitype"; import { type Hex, getEventSelector } from "viem"; -import { getDuplicateElements } from "@/utils/duplicates"; +import { getDuplicateElements } from "@/utils/duplicates.js"; export type LogEventMetadata = { // Event name (if no overloads) or full event signature (if name is overloaded). diff --git a/packages/core/src/config/config.test-d.ts b/packages/core/src/config/config.test-d.ts index a100e744b..973b603b1 100644 --- a/packages/core/src/config/config.test-d.ts +++ b/packages/core/src/config/config.test-d.ts @@ -1,13 +1,14 @@ -import { http, ParseAbi, ParseAbiItem } from "viem"; +import type { ParseAbi, ParseAbiItem } from "viem"; +import { http } from "viem"; import { assertType, test } from "vitest"; -import { +import type { Config, - createConfig, FilterAbiEvents, RecoverAbiEvent, SafeEventNames, -} from "./config"; +} from "./config.js"; +import { createConfig } from "./config.js"; export const abiSimple = [ { diff --git a/packages/core/src/config/database.ts b/packages/core/src/config/database.ts index b7c3e20e1..47cb28a26 100644 --- a/packages/core/src/config/database.ts +++ b/packages/core/src/config/database.ts @@ -2,11 +2,11 @@ import Sqlite from "better-sqlite3"; import path from "node:path"; import pg, { Client, DatabaseError, Pool } from "pg"; -import type { Config } from "@/config/config"; -import { PostgresError } from "@/errors/postgres"; -import { SqliteError } from "@/errors/sqlite"; -import type { Common } from "@/Ponder"; -import { ensureDirExists } from "@/utils/exists"; +import type { Config } from "@/config/config.js"; +import { PostgresError } from "@/errors/postgres.js"; +import { SqliteError } from "@/errors/sqlite.js"; +import type { Common } from "@/Ponder.js"; +import { ensureDirExists } from "@/utils/exists.js"; export interface SqliteDb { kind: "sqlite"; diff --git a/packages/core/src/config/factories.test.ts b/packages/core/src/config/factories.test.ts index e61f8bc26..f4d2f090d 100644 --- a/packages/core/src/config/factories.test.ts +++ b/packages/core/src/config/factories.test.ts @@ -1,10 +1,11 @@ -import { getEventSelector, parseAbiItem, RpcLog } from "viem"; +import type { RpcLog } from "viem"; +import { getEventSelector, parseAbiItem } from "viem"; import { expect, test } from "vitest"; import { buildFactoryCriteria, getAddressFromFactoryEventLog, -} from "./factories"; +} from "./factories.js"; const llamaFactoryEventAbiItem = parseAbiItem( "event LlamaInstanceCreated(address indexed deployer, string indexed name, address llamaCore, address llamaExecutor, address llamaPolicy, uint256 chainId)" diff --git a/packages/core/src/config/factories.ts b/packages/core/src/config/factories.ts index 0c6ad5389..3ab2d5eea 100644 --- a/packages/core/src/config/factories.ts +++ b/packages/core/src/config/factories.ts @@ -1,10 +1,11 @@ import type { AbiEvent } from "abitype"; -import { getEventSelector, RpcLog } from "viem"; +import type { RpcLog } from "viem"; +import { getEventSelector } from "viem"; -import { toLowerCase } from "@/utils/lowercase"; -import { getBytesConsumedByParam } from "@/utils/offset"; +import { toLowerCase } from "@/utils/lowercase.js"; +import { getBytesConsumedByParam } from "@/utils/offset.js"; -import { FactoryCriteria } from "./sources"; +import type { FactoryCriteria } from "./sources.js"; export function buildFactoryCriteria({ address: _address, diff --git a/packages/core/src/config/networks.test.ts b/packages/core/src/config/networks.test.ts index 8a56e56c4..27636b3c0 100644 --- a/packages/core/src/config/networks.test.ts +++ b/packages/core/src/config/networks.test.ts @@ -6,7 +6,7 @@ import { getDefaultMaxBlockRange, getRpcUrlsForClient, isRpcUrlPublic, -} from "./networks"; +} from "./networks.js"; test("getRpcUrlsForClient handles default RPC URL", () => { const client = createPublicClient({ diff --git a/packages/core/src/config/networks.ts b/packages/core/src/config/networks.ts index c3552e8f2..0500c1282 100644 --- a/packages/core/src/config/networks.ts +++ b/packages/core/src/config/networks.ts @@ -1,8 +1,9 @@ +import * as chains from "@wagmi/chains"; import { type Client, type PublicClient, createPublicClient } from "viem"; -import * as chains from "viem/chains"; +import type { Chain } from "viem/chains"; -import type { Config } from "@/config/config"; -import type { Common } from "@/Ponder"; +import type { Config } from "@/config/config.js"; +import type { Common } from "@/Ponder.js"; export type Network = { name: string; @@ -23,8 +24,9 @@ export function buildNetwork({ }) { const { name, chainId, transport } = network; - const defaultChain = - Object.values(chains).find(({ id }) => id === chainId) ?? chains.mainnet; + const defaultChain: Chain = (Object.values(chains).find((c) => + "id" in c ? c.id === chainId : false + ) ?? chains.mainnet) as Chain; const client = createPublicClient({ transport, diff --git a/packages/core/src/config/options.ts b/packages/core/src/config/options.ts index bfb5c7c07..2587494fa 100644 --- a/packages/core/src/config/options.ts +++ b/packages/core/src/config/options.ts @@ -1,7 +1,7 @@ import path from "node:path"; import type { LevelWithSilent } from "pino"; -import type { CliOptions } from "@/bin/ponder"; +import type { CliOptions } from "@/bin/ponder.js"; export type Options = { configFile: string; diff --git a/packages/core/src/config/sources.test.ts b/packages/core/src/config/sources.test.ts index f248e1c46..85c9625f3 100644 --- a/packages/core/src/config/sources.test.ts +++ b/packages/core/src/config/sources.test.ts @@ -1,9 +1,10 @@ import { http } from "viem"; import { expect, test } from "vitest"; -import { Config, createConfig } from "./config"; -import { abiSimple, abiWithSameEvent } from "./config.test-d"; -import { buildSources } from "./sources"; +import type { Config } from "./config.js"; +import { createConfig } from "./config.js"; +import { abiSimple, abiWithSameEvent } from "./config.test-d.js"; +import { buildSources } from "./sources.js"; test("buildSources() builds topics for multiple events", () => { const sources = buildSources({ diff --git a/packages/core/src/config/sources.ts b/packages/core/src/config/sources.ts index fd963d75f..db6234f84 100644 --- a/packages/core/src/config/sources.ts +++ b/packages/core/src/config/sources.ts @@ -1,19 +1,14 @@ -import { AbiEvent, parseAbiItem } from "abitype"; -import { - Abi, - Address, - encodeEventTopics, - getAbiItem, - GetEventArgs, - getEventSelector, - Hex, -} from "viem"; - -import { toLowerCase } from "@/utils/lowercase"; - -import { AbiEvents, getEvents } from "./abi"; -import { Config } from "./config"; -import { buildFactoryCriteria } from "./factories"; +import type { AbiEvent } from "abitype"; +import { parseAbiItem } from "abitype"; +import type { Abi, Address, GetEventArgs, Hex } from "viem"; +import { encodeEventTopics, getAbiItem, getEventSelector } from "viem"; + +import { toLowerCase } from "@/utils/lowercase.js"; + +import type { AbiEvents } from "./abi.js"; +import { getEvents } from "./abi.js"; +import type { Config } from "./config.js"; +import { buildFactoryCriteria } from "./factories.js"; /** * Fix issue with Array.isArray not checking readonly arrays diff --git a/packages/core/src/errors/postgres.ts b/packages/core/src/errors/postgres.ts index 108ed92ac..b4b62c880 100644 --- a/packages/core/src/errors/postgres.ts +++ b/packages/core/src/errors/postgres.ts @@ -1,8 +1,8 @@ -import { DatabaseError } from "pg"; +import type { DatabaseError } from "pg"; -import { prettyPrint } from "@/utils/print"; +import { prettyPrint } from "@/utils/print.js"; -import { BaseError } from "./base"; +import { BaseError } from "./base.js"; export class PostgresError extends BaseError { override name = "PostgresError"; diff --git a/packages/core/src/errors/queue.ts b/packages/core/src/errors/queue.ts index f5fbc6219..75bc039e6 100644 --- a/packages/core/src/errors/queue.ts +++ b/packages/core/src/errors/queue.ts @@ -1,6 +1,6 @@ -import { prettyPrint } from "@/utils/print"; +import { prettyPrint } from "@/utils/print.js"; -import { BaseError } from "./base"; +import { BaseError } from "./base.js"; export class QueueError extends BaseError { override name = "QueueError"; diff --git a/packages/core/src/errors/service.ts b/packages/core/src/errors/service.ts index ca5180788..f18bb319a 100644 --- a/packages/core/src/errors/service.ts +++ b/packages/core/src/errors/service.ts @@ -1,6 +1,6 @@ import Emittery from "emittery"; -import { UserError } from "./user"; +import type { UserError } from "./user.js"; type UserErrorEvents = { error: { error: UserError }; diff --git a/packages/core/src/errors/sqlite.ts b/packages/core/src/errors/sqlite.ts index 9be34096b..033f4349d 100644 --- a/packages/core/src/errors/sqlite.ts +++ b/packages/core/src/errors/sqlite.ts @@ -1,6 +1,6 @@ -import { prettyPrint } from "@/utils/print"; +import { prettyPrint } from "@/utils/print.js"; -import { BaseError } from "./base"; +import { BaseError } from "./base.js"; export class SqliteError extends BaseError { override name = "SqliteError"; diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 890c6b68c..34dd14b23 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,7 +1,7 @@ -export { createConfig } from "@/config/config"; -export * as p from "@/schema"; -export type { Block } from "@/types/block"; -export type { Log } from "@/types/log"; -export type { Model } from "@/types/model"; -export type { PonderApp } from "@/types/ponder"; -export type { Transaction } from "@/types/transaction"; +export { createConfig } from "@/config/config.js"; +export * as p from "@/schema/index.js"; +export type { Block } from "@/types/block.js"; +export type { Log } from "@/types/log.js"; +export type { Model } from "@/types/model.js"; +export type { PonderApp } from "@/types/ponder.js"; +export type { Transaction } from "@/types/transaction.js"; diff --git a/packages/core/src/indexing-store/postgres/store.ts b/packages/core/src/indexing-store/postgres/store.ts index 3b2dbe707..d499dc9e9 100644 --- a/packages/core/src/indexing-store/postgres/store.ts +++ b/packages/core/src/indexing-store/postgres/store.ts @@ -1,26 +1,26 @@ import { randomBytes } from "crypto"; import { CompiledQuery, Kysely, PostgresDialect, sql } from "kysely"; -import { Pool } from "pg"; +import type { Pool } from "pg"; -import type { Scalar, Schema } from "@/schema/types"; +import type { Scalar, Schema } from "@/schema/types.js"; import { isEnumColumn, isReferenceColumn, isVirtualColumn, -} from "@/schema/utils"; +} from "@/schema/utils.js"; import type { IndexingStore, ModelInstance, OrderByInput, WhereInput, -} from "../store"; -import { formatModelFieldValue, formatModelInstance } from "../utils/format"; -import { validateSkip, validateTake } from "../utils/pagination"; +} from "../store.js"; +import { formatModelFieldValue, formatModelInstance } from "../utils/format.js"; +import { validateSkip, validateTake } from "../utils/pagination.js"; import { buildSqlOrderByConditions, buildSqlWhereConditions, -} from "../utils/where"; +} from "../utils/where.js"; const MAX_INTEGER = 2_147_483_647 as const; const MAX_BATCH_SIZE = 1_000 as const; diff --git a/packages/core/src/indexing-store/sqlite/store.ts b/packages/core/src/indexing-store/sqlite/store.ts index 5917261d9..163f9beae 100644 --- a/packages/core/src/indexing-store/sqlite/store.ts +++ b/packages/core/src/indexing-store/sqlite/store.ts @@ -2,26 +2,26 @@ import type Sqlite from "better-sqlite3"; import { randomBytes } from "crypto"; import { Kysely, sql, SqliteDialect } from "kysely"; -import type { Scalar, Schema } from "@/schema/types"; +import type { Scalar, Schema } from "@/schema/types.js"; import { isEnumColumn, isReferenceColumn, isVirtualColumn, -} from "@/schema/utils"; -import { decodeToBigInt } from "@/utils/encoding"; +} from "@/schema/utils.js"; +import { decodeToBigInt } from "@/utils/encoding.js"; import type { IndexingStore, ModelInstance, OrderByInput, WhereInput, -} from "../store"; -import { formatModelFieldValue, formatModelInstance } from "../utils/format"; -import { validateSkip, validateTake } from "../utils/pagination"; +} from "../store.js"; +import { formatModelFieldValue, formatModelInstance } from "../utils/format.js"; +import { validateSkip, validateTake } from "../utils/pagination.js"; import { buildSqlOrderByConditions, buildSqlWhereConditions, -} from "../utils/where"; +} from "../utils/where.js"; const MAX_INTEGER = 2_147_483_647 as const; const MAX_BATCH_SIZE = 1_000 as const; diff --git a/packages/core/src/indexing-store/store.test.ts b/packages/core/src/indexing-store/store.test.ts index f5bb390d4..9dda40647 100644 --- a/packages/core/src/indexing-store/store.test.ts +++ b/packages/core/src/indexing-store/store.test.ts @@ -1,7 +1,7 @@ import { beforeEach, expect, test } from "vitest"; -import { setupIndexingStore } from "@/_test/setup"; -import * as p from "@/schema"; +import { setupIndexingStore } from "@/_test/setup.js"; +import * as p from "@/schema/index.js"; beforeEach((context) => setupIndexingStore(context)); diff --git a/packages/core/src/indexing-store/store.ts b/packages/core/src/indexing-store/store.ts index f2398dd1a..95163cedc 100644 --- a/packages/core/src/indexing-store/store.ts +++ b/packages/core/src/indexing-store/store.ts @@ -1,5 +1,5 @@ -import type { Schema } from "@/schema/types"; -import { Prettify } from "@/types/utils"; +import type { Schema } from "@/schema/types.js"; +import type { Prettify } from "@/types/utils.js"; export type ModelDefinition = { [key: string]: diff --git a/packages/core/src/indexing-store/utils/format.ts b/packages/core/src/indexing-store/utils/format.ts index b08142b6f..88d0725a0 100644 --- a/packages/core/src/indexing-store/utils/format.ts +++ b/packages/core/src/indexing-store/utils/format.ts @@ -1,6 +1,6 @@ -import { encodeAsText } from "@/utils/encoding"; +import { encodeAsText } from "@/utils/encoding.js"; -import type { ModelInstance } from "../store"; +import type { ModelInstance } from "../store.js"; /** * Convert a user-land model instance into a database-ready object. diff --git a/packages/core/src/indexing-store/utils/pagination.test.ts b/packages/core/src/indexing-store/utils/pagination.test.ts index 50d99a9e9..265f22051 100644 --- a/packages/core/src/indexing-store/utils/pagination.test.ts +++ b/packages/core/src/indexing-store/utils/pagination.test.ts @@ -1,6 +1,6 @@ import { expect, test } from "vitest"; -import { validateSkip, validateTake } from "./pagination"; +import { validateSkip, validateTake } from "./pagination.js"; test("validateSkip should throw if more than 5000 records", async () => { expect(() => validateSkip(5001)).toThrowError( diff --git a/packages/core/src/indexing-store/utils/where.ts b/packages/core/src/indexing-store/utils/where.ts index d74a29cef..5d463e59b 100644 --- a/packages/core/src/indexing-store/utils/where.ts +++ b/packages/core/src/indexing-store/utils/where.ts @@ -1,8 +1,8 @@ -import { ComparisonOperatorExpression } from "kysely"; +import type { ComparisonOperatorExpression } from "kysely"; -import { encodeAsText } from "@/utils/encoding"; +import { encodeAsText } from "@/utils/encoding.js"; -import { ModelDefinition, OrderByInput, WhereInput } from "../store"; +import type { ModelDefinition, OrderByInput, WhereInput } from "../store.js"; export const sqlOperatorsByCondition = { // universal diff --git a/packages/core/src/indexing/model.ts b/packages/core/src/indexing/model.ts index 0962c6f68..4bc6867c4 100644 --- a/packages/core/src/indexing/model.ts +++ b/packages/core/src/indexing/model.ts @@ -1,7 +1,7 @@ -import type { IndexingStore, ModelInstance } from "@/indexing-store/store"; -import type { Common } from "@/Ponder"; -import type { Schema } from "@/schema/types"; -import type { Model } from "@/types/model"; +import type { IndexingStore, ModelInstance } from "@/indexing-store/store.js"; +import type { Common } from "@/Ponder.js"; +import type { Schema } from "@/schema/types.js"; +import type { Model } from "@/types/model.js"; export function buildModels({ common, diff --git a/packages/core/src/indexing/ponderActions.test.ts b/packages/core/src/indexing/ponderActions.test.ts index 6480b804e..a28068b8f 100644 --- a/packages/core/src/indexing/ponderActions.test.ts +++ b/packages/core/src/indexing/ponderActions.test.ts @@ -4,10 +4,10 @@ import { expect, test } from "vitest"; import { uniswapV3PoolFactoryConfig, usdcContractConfig, -} from "@/_test/constants"; -import { publicClient } from "@/_test/utils"; +} from "@/_test/constants.js"; +import { publicClient } from "@/_test/utils.js"; -import { ponderActions } from "./ponderActions"; +import { ponderActions } from "./ponderActions.js"; const client = publicClient.extend(ponderActions(() => 16375000n)); diff --git a/packages/core/src/indexing/ponderActions.ts b/packages/core/src/indexing/ponderActions.ts index b72adb751..febc06bd5 100644 --- a/packages/core/src/indexing/ponderActions.ts +++ b/packages/core/src/indexing/ponderActions.ts @@ -1,4 +1,4 @@ -import { +import type { Abi, Chain, Client, @@ -24,7 +24,7 @@ import { readContract as viemReadContract, } from "viem/actions"; -import { Prettify } from "@/types/utils"; +import type { Prettify } from "@/types/utils.js"; export type PonderActions = { getBalance: ( diff --git a/packages/core/src/indexing/service.test.ts b/packages/core/src/indexing/service.test.ts index 4a7f8da8b..0649347bc 100644 --- a/packages/core/src/indexing/service.test.ts +++ b/packages/core/src/indexing/service.test.ts @@ -1,15 +1,15 @@ import { http } from "viem"; import { beforeEach, expect, test, vi } from "vitest"; -import { usdcContractConfig } from "@/_test/constants"; -import { setupIndexingStore, setupSyncStore } from "@/_test/setup"; -import type { IndexingFunctions } from "@/build/functions"; -import { LogEventMetadata } from "@/config/abi"; -import { Source } from "@/config/sources"; -import * as p from "@/schema"; -import { SyncGateway } from "@/sync-gateway/service"; - -import { IndexingService } from "./service"; +import { usdcContractConfig } from "@/_test/constants.js"; +import { setupIndexingStore, setupSyncStore } from "@/_test/setup.js"; +import type { IndexingFunctions } from "@/build/functions.js"; +import type { LogEventMetadata } from "@/config/abi.js"; +import type { Source } from "@/config/sources.js"; +import * as p from "@/schema/index.js"; +import type { SyncGateway } from "@/sync-gateway/service.js"; + +import { IndexingService } from "./service.js"; beforeEach((context) => setupIndexingStore(context)); beforeEach((context) => setupSyncStore(context)); diff --git a/packages/core/src/indexing/service.ts b/packages/core/src/indexing/service.ts index 8e90a8529..6f94cec2f 100644 --- a/packages/core/src/indexing/service.ts +++ b/packages/core/src/indexing/service.ts @@ -1,28 +1,30 @@ import { E_CANCELED, Mutex } from "async-mutex"; import Emittery from "emittery"; -import { Abi, Address, Client, createClient } from "viem"; +import type { Abi, Address, Client } from "viem"; +import type { Chain } from "viem"; +import { createClient } from "viem"; import * as chains from "viem/chains"; -import type { IndexingFunctions } from "@/build/functions"; -import { LogEventMetadata } from "@/config/abi"; -import { Config } from "@/config/config"; -import type { Source } from "@/config/sources"; -import { UserError } from "@/errors/user"; -import type { IndexingStore, ModelInstance } from "@/indexing-store/store"; -import type { Common } from "@/Ponder"; -import type { Schema } from "@/schema/types"; -import type { LogEvent, SyncGateway } from "@/sync-gateway/service"; -import { SyncStore } from "@/sync-store/store"; -import type { Model } from "@/types/model"; -import { formatShortDate } from "@/utils/date"; -import { prettyPrint } from "@/utils/print"; -import { type Queue, type Worker, createQueue } from "@/utils/queue"; -import { wait } from "@/utils/wait"; - -import { buildModels } from "./model"; -import { ponderActions } from "./ponderActions"; -import { getStackTrace } from "./trace"; -import { ponderTransport } from "./transport"; +import type { IndexingFunctions } from "@/build/functions.js"; +import type { LogEventMetadata } from "@/config/abi.js"; +import type { Config } from "@/config/config.js"; +import type { Source } from "@/config/sources.js"; +import { UserError } from "@/errors/user.js"; +import type { IndexingStore, ModelInstance } from "@/indexing-store/store.js"; +import type { Common } from "@/Ponder.js"; +import type { Schema } from "@/schema/types.js"; +import type { LogEvent, SyncGateway } from "@/sync-gateway/service.js"; +import type { SyncStore } from "@/sync-store/store.js"; +import type { Model } from "@/types/model.js"; +import { formatShortDate } from "@/utils/date.js"; +import { prettyPrint } from "@/utils/print.js"; +import { type Queue, type Worker, createQueue } from "@/utils/queue.js"; +import { wait } from "@/utils/wait.js"; + +import { buildModels } from "./model.js"; +import { ponderActions } from "./ponderActions.js"; +import { getStackTrace } from "./trace.js"; +import { ponderTransport } from "./transport.js"; type IndexingEvents = { eventsProcessed: { toTimestamp: number }; @@ -564,9 +566,9 @@ const buildContexts = ( > = {}; networks.forEach((network) => { - const defaultChain = - Object.values(chains).find(({ id }) => id === network.chainId) ?? - chains.mainnet; + const defaultChain: Chain = (Object.values(chains).find((c) => + "id" in c ? c.id === network.chainId : false + ) ?? chains.mainnet) as Chain; const client = createClient({ transport: ponderTransport({ transport: network.transport, syncStore }), diff --git a/packages/core/src/indexing/trace.ts b/packages/core/src/indexing/trace.ts index 785bd8835..b13a5468f 100644 --- a/packages/core/src/indexing/trace.ts +++ b/packages/core/src/indexing/trace.ts @@ -11,7 +11,7 @@ import { readFileSync } from "node:fs"; import path from "node:path"; import { type StackFrame, parse as parseStackTrace } from "stacktrace-parser"; -import type { Options } from "@/config/options"; +import type { Options } from "@/config/options.js"; export const getStackTrace = (error: Error, options: Options) => { if (!error.stack) return undefined; diff --git a/packages/core/src/indexing/transport.test.ts b/packages/core/src/indexing/transport.test.ts index cfce59482..7b5aa03d3 100644 --- a/packages/core/src/indexing/transport.test.ts +++ b/packages/core/src/indexing/transport.test.ts @@ -1,11 +1,12 @@ -import { getFunctionSelector, http, toHex, Transport } from "viem"; +import type { Transport } from "viem"; +import { getFunctionSelector, http, toHex } from "viem"; import { assertType, beforeEach, expect, test, vi } from "vitest"; -import { usdcContractConfig } from "@/_test/constants"; -import { setupSyncStore } from "@/_test/setup"; -import { anvil } from "@/_test/utils"; +import { usdcContractConfig } from "@/_test/constants.js"; +import { setupSyncStore } from "@/_test/setup.js"; +import { anvil } from "@/_test/utils.js"; -import { ponderTransport } from "./transport"; +import { ponderTransport } from "./transport.js"; beforeEach((context) => setupSyncStore(context)); diff --git a/packages/core/src/indexing/transport.ts b/packages/core/src/indexing/transport.ts index a86957ff9..6ea029181 100644 --- a/packages/core/src/indexing/transport.ts +++ b/packages/core/src/indexing/transport.ts @@ -1,7 +1,8 @@ -import { Address, custom, Hex, Transport } from "viem"; +import type { Address, Hex, Transport } from "viem"; +import { custom } from "viem"; -import { SyncStore } from "@/sync-store/store"; -import { toLowerCase } from "@/utils/lowercase"; +import type { SyncStore } from "@/sync-store/store.js"; +import { toLowerCase } from "@/utils/lowercase.js"; export const ponderTransport = ({ transport, diff --git a/packages/core/src/schema/columns.test-d.ts b/packages/core/src/schema/columns.test-d.ts index 5d08fc5ed..2b847079d 100644 --- a/packages/core/src/schema/columns.test-d.ts +++ b/packages/core/src/schema/columns.test-d.ts @@ -1,13 +1,9 @@ -import { Hex } from "viem"; +import type { Hex } from "viem"; import { assertType, test } from "vitest"; -import * as p from "./index"; -import { - type BaseColumn, - type RecoverColumnType, - EnumColumn, - VirtualColumn, -} from "./types"; +import * as p from "./index.js"; +import type { EnumColumn, VirtualColumn } from "./types.js"; +import { type BaseColumn, type RecoverColumnType } from "./types.js"; test("string", () => { const c = p.string(); diff --git a/packages/core/src/schema/columns.test.ts b/packages/core/src/schema/columns.test.ts index 0550539c9..4e0fcdcbd 100644 --- a/packages/core/src/schema/columns.test.ts +++ b/packages/core/src/schema/columns.test.ts @@ -1,6 +1,6 @@ import { expect, test } from "vitest"; -import * as p from "./index"; +import * as p from "./index.js"; test("string", () => { const c = p.string(); diff --git a/packages/core/src/schema/columns.ts b/packages/core/src/schema/columns.ts index a5d6ca9ab..f4527d1ed 100644 --- a/packages/core/src/schema/columns.ts +++ b/packages/core/src/schema/columns.ts @@ -1,10 +1,10 @@ -import { +import type { BaseColumn, InternalColumn, InternalEnum, Scalar, VirtualColumn, -} from "./types"; +} from "./types.js"; type Optional< TScalar extends Scalar, diff --git a/packages/core/src/schema/index.ts b/packages/core/src/schema/index.ts index b09eacf3a..4a9f07b86 100644 --- a/packages/core/src/schema/index.ts +++ b/packages/core/src/schema/index.ts @@ -7,9 +7,9 @@ import { int, string, virtual, -} from "./columns"; -import { createEnum, createSchema, createTable } from "./schema"; -import type { Infer } from "./types"; +} from "./columns.js"; +import { createEnum, createSchema, createTable } from "./schema.js"; +import type { Infer } from "./types.js"; export { bigint, boolean, bytes, _enum as enum, float, int, string, virtual }; export type { Infer }; diff --git a/packages/core/src/schema/schema.test-d.ts b/packages/core/src/schema/schema.test-d.ts index 2d9fc9a4c..9e5d4411c 100644 --- a/packages/core/src/schema/schema.test-d.ts +++ b/packages/core/src/schema/schema.test-d.ts @@ -1,14 +1,14 @@ import { assertType, test } from "vitest"; -import * as p from "./index"; -import { +import * as p from "./index.js"; +import type { BaseColumn, ExtractAllNames, FilterEnums, FilterTables, RecoverTableType, Schema, -} from "./types"; +} from "./types.js"; test("table", () => { const a = p.createTable({ diff --git a/packages/core/src/schema/schema.test.ts b/packages/core/src/schema/schema.test.ts index e94ac4ffa..72b116a81 100644 --- a/packages/core/src/schema/schema.test.ts +++ b/packages/core/src/schema/schema.test.ts @@ -1,6 +1,6 @@ import { expect, test } from "vitest"; -import * as p from "./index"; +import * as p from "./index.js"; test("table", () => { const t = p.createTable({ diff --git a/packages/core/src/schema/schema.ts b/packages/core/src/schema/schema.ts index e7e5c7249..e57f683f5 100644 --- a/packages/core/src/schema/schema.ts +++ b/packages/core/src/schema/schema.ts @@ -1,4 +1,4 @@ -import { +import type { Enum, EnumColumn, ExtractAllNames, @@ -14,13 +14,13 @@ import { Schema, Table, VirtualColumn, -} from "./types"; +} from "./types.js"; import { isEnumColumn, isReferenceColumn, isVirtualColumn, referencedEntityName, -} from "./utils"; +} from "./utils.js"; /** * Fix issue with Array.isArray not checking readonly arrays diff --git a/packages/core/src/schema/types.ts b/packages/core/src/schema/types.ts index 1c2c744d7..7b4ac2318 100644 --- a/packages/core/src/schema/types.ts +++ b/packages/core/src/schema/types.ts @@ -1,6 +1,6 @@ -import { Hex } from "viem"; +import type { Hex } from "viem"; -import { Prettify } from "@/types/utils"; +import type { Prettify } from "@/types/utils.js"; export type Scalar = | "string" diff --git a/packages/core/src/schema/utils.test.ts b/packages/core/src/schema/utils.test.ts index be0dafc57..560d744b7 100644 --- a/packages/core/src/schema/utils.test.ts +++ b/packages/core/src/schema/utils.test.ts @@ -1,7 +1,7 @@ import { expect, test } from "vitest"; -import * as p from "./index"; -import { isEnumColumn, isReferenceColumn, isVirtualColumn } from "./utils"; +import * as p from "./index.js"; +import { isEnumColumn, isReferenceColumn, isVirtualColumn } from "./utils.js"; test("virtual column", () => { expect(isVirtualColumn(p.string()[" column"])).toBe(false); diff --git a/packages/core/src/schema/utils.ts b/packages/core/src/schema/utils.ts index f1cb5e60c..13cbcb5de 100644 --- a/packages/core/src/schema/utils.ts +++ b/packages/core/src/schema/utils.ts @@ -1,9 +1,9 @@ -import { +import type { EnumColumn, NonReferenceColumn, ReferenceColumn, VirtualColumn, -} from "./types"; +} from "./types.js"; /** * Returns the name of the entity that was referenced by a reference column diff --git a/packages/core/src/server/graphql/entity.ts b/packages/core/src/server/graphql/entity.ts index 72fd0848d..857dbc6de 100644 --- a/packages/core/src/server/graphql/entity.ts +++ b/packages/core/src/server/graphql/entity.ts @@ -1,7 +1,7 @@ +import type { GraphQLFieldResolver } from "graphql"; import { type GraphQLFieldConfigMap, GraphQLEnumType, - GraphQLFieldResolver, GraphQLInt, GraphQLList, GraphQLNonNull, @@ -9,16 +9,16 @@ import { GraphQLString, } from "graphql"; -import { Schema } from "@/schema/types"; +import type { Schema } from "@/schema/types.js"; import { isEnumColumn, isReferenceColumn, isVirtualColumn, referencedEntityName, -} from "@/schema/utils"; +} from "@/schema/utils.js"; -import type { Context, Source } from "./schema"; -import { tsTypeToGqlScalar } from "./schema"; +import type { Context, Source } from "./schema.js"; +import { tsTypeToGqlScalar } from "./schema.js"; export const buildEntityTypes = ({ schema, diff --git a/packages/core/src/server/graphql/plural.ts b/packages/core/src/server/graphql/plural.ts index 30219f588..9e2d0dab4 100644 --- a/packages/core/src/server/graphql/plural.ts +++ b/packages/core/src/server/graphql/plural.ts @@ -1,21 +1,20 @@ +import type { GraphQLInputFieldConfigMap, GraphQLObjectType } from "graphql"; import { type GraphQLFieldConfig, type GraphQLFieldResolver, type GraphQLInputType, - GraphQLInputFieldConfigMap, GraphQLInputObjectType, GraphQLInt, GraphQLList, GraphQLNonNull, - GraphQLObjectType, GraphQLString, } from "graphql"; -import type { Scalar, Schema } from "@/schema/types"; -import { isEnumColumn, isVirtualColumn } from "@/schema/utils"; +import type { Scalar, Schema } from "@/schema/types.js"; +import { isEnumColumn, isVirtualColumn } from "@/schema/utils.js"; -import type { Context, Source } from "./schema"; -import { tsTypeToGqlScalar } from "./schema"; +import type { Context, Source } from "./schema.js"; +import { tsTypeToGqlScalar } from "./schema.js"; type PluralArgs = { timestamp?: number; diff --git a/packages/core/src/server/graphql/schema.test.ts b/packages/core/src/server/graphql/schema.test.ts index db99d2f5c..ba355c321 100644 --- a/packages/core/src/server/graphql/schema.test.ts +++ b/packages/core/src/server/graphql/schema.test.ts @@ -1,9 +1,9 @@ import { type GraphQLType } from "graphql"; import { expect, test } from "vitest"; -import * as p from "@/schema"; +import * as p from "@/schema/index.js"; -import { buildGqlSchema } from "./schema"; +import { buildGqlSchema } from "./schema.js"; test("filter type has correct suffixes and types", () => { const s = p.createSchema({ diff --git a/packages/core/src/server/graphql/schema.ts b/packages/core/src/server/graphql/schema.ts index 97f3d7bb2..37288d40e 100644 --- a/packages/core/src/server/graphql/schema.ts +++ b/packages/core/src/server/graphql/schema.ts @@ -9,12 +9,12 @@ import { GraphQLString, } from "graphql"; -import type { IndexingStore } from "@/indexing-store/store"; -import type { Scalar, Schema } from "@/schema/types"; +import type { IndexingStore } from "@/indexing-store/store.js"; +import type { Scalar, Schema } from "@/schema/types.js"; -import { buildEntityTypes } from "./entity"; -import { buildPluralField } from "./plural"; -import { buildSingularField } from "./singular"; +import { buildEntityTypes } from "./entity.js"; +import { buildPluralField } from "./plural.js"; +import { buildSingularField } from "./singular.js"; const GraphQLBigInt = new GraphQLScalarType({ name: "BigInt", diff --git a/packages/core/src/server/graphql/singular.ts b/packages/core/src/server/graphql/singular.ts index c0c7cfa05..701e50678 100644 --- a/packages/core/src/server/graphql/singular.ts +++ b/packages/core/src/server/graphql/singular.ts @@ -1,15 +1,15 @@ +import type { GraphQLObjectType } from "graphql"; import { type GraphQLFieldConfig, type GraphQLFieldResolver, GraphQLInt, GraphQLNonNull, - GraphQLObjectType, } from "graphql"; -import type { BaseColumn, ID, Schema } from "@/schema/types"; +import type { BaseColumn, ID, Schema } from "@/schema/types.js"; -import type { Context, Source } from "./schema"; -import { tsTypeToGqlScalar } from "./schema"; +import type { Context, Source } from "./schema.js"; +import { tsTypeToGqlScalar } from "./schema.js"; type SingularArgs = { id?: string; diff --git a/packages/core/src/server/service.test.ts b/packages/core/src/server/service.test.ts index 8e4828a51..fa40566ee 100644 --- a/packages/core/src/server/service.test.ts +++ b/packages/core/src/server/service.test.ts @@ -1,14 +1,14 @@ import request from "supertest"; import { beforeEach, expect, test } from "vitest"; -import { setupIndexingStore } from "@/_test/setup"; -import type { IndexingStore } from "@/indexing-store/store"; -import type { Common } from "@/Ponder"; -import * as p from "@/schema"; -import { range } from "@/utils/range"; - -import { buildGqlSchema } from "./graphql/schema"; -import { ServerService } from "./service"; +import { setupIndexingStore } from "@/_test/setup.js"; +import type { IndexingStore } from "@/indexing-store/store.js"; +import type { Common } from "@/Ponder.js"; +import * as p from "@/schema/index.js"; +import { range } from "@/utils/range.js"; + +import { buildGqlSchema } from "./graphql/schema.js"; +import { ServerService } from "./service.js"; beforeEach((context) => setupIndexingStore(context)); diff --git a/packages/core/src/server/service.ts b/packages/core/src/server/service.ts index f74580036..f4cfed968 100644 --- a/packages/core/src/server/service.ts +++ b/packages/core/src/server/service.ts @@ -4,12 +4,13 @@ import type { FormattedExecutionResult, GraphQLSchema } from "graphql"; import { formatError, GraphQLError } from "graphql"; import { createHandler } from "graphql-http/lib/use/express"; import { createHttpTerminator } from "http-terminator"; -import { createServer, Server } from "node:http"; +import type { Server } from "node:http"; +import { createServer } from "node:http"; -import type { IndexingStore } from "@/indexing-store/store"; -import type { Common } from "@/Ponder"; -import { graphiQLHtml } from "@/ui/graphiql.html"; -import { startClock } from "@/utils/timer"; +import type { IndexingStore } from "@/indexing-store/store.js"; +import type { Common } from "@/Ponder.js"; +import { graphiQLHtml } from "@/ui/graphiql.html.js"; +import { startClock } from "@/utils/timer.js"; export class ServerService { private common: Common; diff --git a/packages/core/src/sync-gateway/service.test.ts b/packages/core/src/sync-gateway/service.test.ts index e013be24b..87f57cd53 100644 --- a/packages/core/src/sync-gateway/service.test.ts +++ b/packages/core/src/sync-gateway/service.test.ts @@ -1,12 +1,12 @@ import { beforeEach, expect, test, vi } from "vitest"; -import { usdcContractConfig } from "@/_test/constants"; -import { setupSyncStore } from "@/_test/setup"; -import { publicClient } from "@/_test/utils"; -import type { Network } from "@/config/networks"; -import type { Source } from "@/config/sources"; +import { usdcContractConfig } from "@/_test/constants.js"; +import { setupSyncStore } from "@/_test/setup.js"; +import { publicClient } from "@/_test/utils.js"; +import type { Network } from "@/config/networks.js"; +import type { Source } from "@/config/sources.js"; -import { SyncGateway } from "./service"; +import { SyncGateway } from "./service.js"; beforeEach((context) => setupSyncStore(context)); diff --git a/packages/core/src/sync-gateway/service.ts b/packages/core/src/sync-gateway/service.ts index 0a0562a12..ae2fd855d 100644 --- a/packages/core/src/sync-gateway/service.ts +++ b/packages/core/src/sync-gateway/service.ts @@ -1,15 +1,16 @@ import Emittery from "emittery"; import { type Hex, decodeEventLog } from "viem"; -import { LogEventMetadata } from "@/config/abi"; -import type { Network } from "@/config/networks"; -import { Source, sourceIsFactory, sourceIsLogFilter } from "@/config/sources"; -import type { Common } from "@/Ponder"; -import type { SyncStore } from "@/sync-store/store"; -import type { Block } from "@/types/block"; -import type { Log } from "@/types/log"; -import type { Transaction } from "@/types/transaction"; -import { formatShortDate } from "@/utils/date"; +import type { LogEventMetadata } from "@/config/abi.js"; +import type { Network } from "@/config/networks.js"; +import type { Source } from "@/config/sources.js"; +import { sourceIsFactory, sourceIsLogFilter } from "@/config/sources.js"; +import type { Common } from "@/Ponder.js"; +import type { SyncStore } from "@/sync-store/store.js"; +import type { Block } from "@/types/block.js"; +import type { Log } from "@/types/log.js"; +import type { Transaction } from "@/types/transaction.js"; +import { formatShortDate } from "@/utils/date.js"; export type LogEvent = { eventSourceName: string; diff --git a/packages/core/src/sync-historical/service.test.ts b/packages/core/src/sync-historical/service.test.ts index 54673c15b..4555bf69c 100644 --- a/packages/core/src/sync-historical/service.test.ts +++ b/packages/core/src/sync-historical/service.test.ts @@ -8,13 +8,13 @@ import { beforeEach, expect, test, vi } from "vitest"; import { uniswapV3PoolFactoryConfig, usdcContractConfig, -} from "@/_test/constants"; -import { setupSyncStore } from "@/_test/setup"; -import { publicClient } from "@/_test/utils"; -import type { Network } from "@/config/networks"; -import type { Source } from "@/config/sources"; +} from "@/_test/constants.js"; +import { setupSyncStore } from "@/_test/setup.js"; +import { publicClient } from "@/_test/utils.js"; +import type { Network } from "@/config/networks.js"; +import type { Source } from "@/config/sources.js"; -import { HistoricalSyncService } from "./service"; +import { HistoricalSyncService } from "./service.js"; beforeEach((context) => setupSyncStore(context)); diff --git a/packages/core/src/sync-historical/service.ts b/packages/core/src/sync-historical/service.ts index 579430224..4f3a71dfc 100644 --- a/packages/core/src/sync-historical/service.ts +++ b/packages/core/src/sync-historical/service.ts @@ -1,40 +1,39 @@ import Emittery from "emittery"; +import type { Hex, RpcError } from "viem"; import { type Hash, type RpcBlock, type RpcLog, type RpcTransaction, - Hex, hexToNumber, HttpRequestError, InvalidParamsRpcError, LimitExceededRpcError, - RpcError, toHex, } from "viem"; -import type { Network } from "@/config/networks"; +import type { Network } from "@/config/networks.js"; import { type Factory, type LogFilter, type LogFilterCriteria, type Source, sourceIsLogFilter, -} from "@/config/sources"; -import type { Common } from "@/Ponder"; -import type { SyncStore } from "@/sync-store/store"; -import { formatEta, formatPercentage } from "@/utils/format"; +} from "@/config/sources.js"; +import type { Common } from "@/Ponder.js"; +import type { SyncStore } from "@/sync-store/store.js"; +import { formatEta, formatPercentage } from "@/utils/format.js"; import { BlockProgressTracker, getChunks, intervalDifference, intervalSum, ProgressTracker, -} from "@/utils/interval"; -import { type Queue, type Worker, createQueue } from "@/utils/queue"; -import { hrTimeToMs, startClock } from "@/utils/timer"; +} from "@/utils/interval.js"; +import { type Queue, type Worker, createQueue } from "@/utils/queue.js"; +import { hrTimeToMs, startClock } from "@/utils/timer.js"; -import { validateHistoricalBlockRange } from "./utils"; +import { validateHistoricalBlockRange } from "./utils.js"; type HistoricalSyncEvents = { /** diff --git a/packages/core/src/sync-historical/utils.test.ts b/packages/core/src/sync-historical/utils.test.ts index ed61e3a17..1d1e5dec0 100644 --- a/packages/core/src/sync-historical/utils.test.ts +++ b/packages/core/src/sync-historical/utils.test.ts @@ -1,6 +1,6 @@ import { expect, test } from "vitest"; -import { validateHistoricalBlockRange } from "./utils"; +import { validateHistoricalBlockRange } from "./utils.js"; test("validateHistoricalBlockRange throws if start block is greater than latest block", () => { expect(() => diff --git a/packages/core/src/sync-realtime/bloom.ts b/packages/core/src/sync-realtime/bloom.ts index 544c49909..0b279e5de 100644 --- a/packages/core/src/sync-realtime/bloom.ts +++ b/packages/core/src/sync-realtime/bloom.ts @@ -4,7 +4,7 @@ import { } from "ethereum-bloom-filters"; import type { Address, Hex } from "viem"; -import { Topics } from "@/config/sources"; +import type { Topics } from "@/config/sources.js"; export function isMatchedLogInBloomFilter({ bloom, diff --git a/packages/core/src/sync-realtime/filter.test.ts b/packages/core/src/sync-realtime/filter.test.ts index a60e46cdc..ef2923070 100644 --- a/packages/core/src/sync-realtime/filter.test.ts +++ b/packages/core/src/sync-realtime/filter.test.ts @@ -1,7 +1,7 @@ import type { RpcLog } from "viem"; import { expect, test } from "vitest"; -import { filterLogs } from "./filter"; +import { filterLogs } from "./filter.js"; export const logs: RpcLog[] = [ { diff --git a/packages/core/src/sync-realtime/filter.ts b/packages/core/src/sync-realtime/filter.ts index 01171b03e..d88902e22 100644 --- a/packages/core/src/sync-realtime/filter.ts +++ b/packages/core/src/sync-realtime/filter.ts @@ -1,6 +1,6 @@ import type { Address, Hex, RpcLog } from "viem"; -import { Topics } from "@/config/sources"; +import type { Topics } from "@/config/sources.js"; export function filterLogs({ logs, diff --git a/packages/core/src/sync-realtime/format.ts b/packages/core/src/sync-realtime/format.ts index b996032cf..96c743732 100644 --- a/packages/core/src/sync-realtime/format.ts +++ b/packages/core/src/sync-realtime/format.ts @@ -5,7 +5,7 @@ import { hexToNumber, } from "viem"; -import type { Prettify } from "@/types/utils"; +import type { Prettify } from "@/types/utils.js"; export type LightBlock = { hash: Hash; diff --git a/packages/core/src/sync-realtime/service.test.ts b/packages/core/src/sync-realtime/service.test.ts index 55f77bba8..6c400db34 100644 --- a/packages/core/src/sync-realtime/service.test.ts +++ b/packages/core/src/sync-realtime/service.test.ts @@ -7,15 +7,15 @@ import { uniswapV3PoolFactoryConfig, usdcContractConfig, vitalik, -} from "@/_test/constants"; -import { resetTestClient, setupSyncStore } from "@/_test/setup"; -import { publicClient, testClient, walletClient } from "@/_test/utils"; -import type { Network } from "@/config/networks"; -import type { Source } from "@/config/sources"; -import { decodeToBigInt } from "@/utils/encoding"; -import { range } from "@/utils/range"; - -import { RealtimeSyncService } from "./service"; +} from "@/_test/constants.js"; +import { resetTestClient, setupSyncStore } from "@/_test/setup.js"; +import { publicClient, testClient, walletClient } from "@/_test/utils.js"; +import type { Network } from "@/config/networks.js"; +import type { Source } from "@/config/sources.js"; +import { decodeToBigInt } from "@/utils/encoding.js"; +import { range } from "@/utils/range.js"; + +import { RealtimeSyncService } from "./service.js"; beforeEach((context) => setupSyncStore(context)); beforeEach(resetTestClient); diff --git a/packages/core/src/sync-realtime/service.ts b/packages/core/src/sync-realtime/service.ts index b8bc94943..c50569828 100644 --- a/packages/core/src/sync-realtime/service.ts +++ b/packages/core/src/sync-realtime/service.ts @@ -8,26 +8,26 @@ import { numberToHex, } from "viem"; -import type { Network } from "@/config/networks"; +import type { Network } from "@/config/networks.js"; import { type Source, sourceIsFactory, sourceIsLogFilter, -} from "@/config/sources"; -import type { Common } from "@/Ponder"; -import type { SyncStore } from "@/sync-store/store"; -import { poll } from "@/utils/poll"; -import { type Queue, createQueue } from "@/utils/queue"; -import { range } from "@/utils/range"; -import { startClock } from "@/utils/timer"; - -import { isMatchedLogInBloomFilter } from "./bloom"; -import { filterLogs } from "./filter"; +} from "@/config/sources.js"; +import type { Common } from "@/Ponder.js"; +import type { SyncStore } from "@/sync-store/store.js"; +import { poll } from "@/utils/poll.js"; +import { type Queue, createQueue } from "@/utils/queue.js"; +import { range } from "@/utils/range.js"; +import { startClock } from "@/utils/timer.js"; + +import { isMatchedLogInBloomFilter } from "./bloom.js"; +import { filterLogs } from "./filter.js"; import { type BlockWithTransactions, type LightBlock, rpcBlockToLightBlock, -} from "./format"; +} from "./format.js"; type RealtimeSyncEvents = { realtimeCheckpoint: { blockTimestamp: number; blockNumber: number }; diff --git a/packages/core/src/sync-store/postgres/format.ts b/packages/core/src/sync-store/postgres/format.ts index 4627674f6..88f76eeec 100644 --- a/packages/core/src/sync-store/postgres/format.ts +++ b/packages/core/src/sync-store/postgres/format.ts @@ -7,7 +7,7 @@ import { hexToNumber, } from "viem"; -import { toLowerCase } from "@/utils/lowercase"; +import { toLowerCase } from "@/utils/lowercase.js"; type BlocksTable = { baseFeePerGas: bigint | null; diff --git a/packages/core/src/sync-store/postgres/migrations.test.ts b/packages/core/src/sync-store/postgres/migrations.test.ts index edf654658..4259ae457 100644 --- a/packages/core/src/sync-store/postgres/migrations.test.ts +++ b/packages/core/src/sync-store/postgres/migrations.test.ts @@ -6,14 +6,14 @@ import { blockOneLogs, blockOneTransactions, contractReadResultOne, -} from "@/_test/constants"; -import { setupSyncStore } from "@/_test/setup"; +} from "@/_test/constants.js"; +import { setupSyncStore } from "@/_test/setup.js"; import { rpcToPostgresBlock, rpcToPostgresLog, rpcToPostgresTransaction, -} from "./format"; +} from "./format.js"; beforeEach((context) => setupSyncStore(context, { migrateUp: false })); diff --git a/packages/core/src/sync-store/postgres/migrations.ts b/packages/core/src/sync-store/postgres/migrations.ts index 5d357d6f9..f35e33c28 100644 --- a/packages/core/src/sync-store/postgres/migrations.ts +++ b/packages/core/src/sync-store/postgres/migrations.ts @@ -1,4 +1,5 @@ -import { type Migration, type MigrationProvider, Kysely, sql } from "kysely"; +import type { Kysely } from "kysely"; +import { type Migration, type MigrationProvider, sql } from "kysely"; const migrations: Record = { ["2023_05_15_0_initial"]: { diff --git a/packages/core/src/sync-store/postgres/store.ts b/packages/core/src/sync-store/postgres/store.ts index e3deb61e7..111e35379 100644 --- a/packages/core/src/sync-store/postgres/store.ts +++ b/packages/core/src/sync-store/postgres/store.ts @@ -10,26 +10,26 @@ import { import type { Pool } from "pg"; import type { Hex, RpcBlock, RpcLog, RpcTransaction } from "viem"; -import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources"; -import type { Block } from "@/types/block"; -import type { Log } from "@/types/log"; -import type { Transaction } from "@/types/transaction"; -import type { NonNull } from "@/types/utils"; +import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources.js"; +import type { Block } from "@/types/block.js"; +import type { Log } from "@/types/log.js"; +import type { Transaction } from "@/types/transaction.js"; +import type { NonNull } from "@/types/utils.js"; import { buildFactoryFragments, buildLogFilterFragments, -} from "@/utils/fragments"; -import { intervalIntersectionMany, intervalUnion } from "@/utils/interval"; -import { range } from "@/utils/range"; +} from "@/utils/fragments.js"; +import { intervalIntersectionMany, intervalUnion } from "@/utils/interval.js"; +import { range } from "@/utils/range.js"; -import type { SyncStore } from "../store"; +import type { SyncStore } from "../store.js"; import { type SyncStoreTables, rpcToPostgresBlock, rpcToPostgresLog, rpcToPostgresTransaction, -} from "./format"; -import { migrationProvider } from "./migrations"; +} from "./format.js"; +import { migrationProvider } from "./migrations.js"; export class PostgresSyncStore implements SyncStore { kind = "postgres" as const; diff --git a/packages/core/src/sync-store/sqlite/format.ts b/packages/core/src/sync-store/sqlite/format.ts index 8ff6efc3c..58204b34b 100644 --- a/packages/core/src/sync-store/sqlite/format.ts +++ b/packages/core/src/sync-store/sqlite/format.ts @@ -7,8 +7,8 @@ import { hexToNumber, } from "viem"; -import { encodeAsText } from "@/utils/encoding"; -import { toLowerCase } from "@/utils/lowercase"; +import { encodeAsText } from "@/utils/encoding.js"; +import { toLowerCase } from "@/utils/lowercase.js"; export type BigIntText = string; diff --git a/packages/core/src/sync-store/sqlite/migrations.test.ts b/packages/core/src/sync-store/sqlite/migrations.test.ts index 9e8f216ce..4a089984a 100644 --- a/packages/core/src/sync-store/sqlite/migrations.test.ts +++ b/packages/core/src/sync-store/sqlite/migrations.test.ts @@ -6,14 +6,14 @@ import { blockOneLogs, blockOneTransactions, contractReadResultOne, -} from "@/_test/constants"; -import { setupSyncStore } from "@/_test/setup"; +} from "@/_test/constants.js"; +import { setupSyncStore } from "@/_test/setup.js"; import { rpcToSqliteBlock, rpcToSqliteLog, rpcToSqliteTransaction, -} from "./format"; +} from "./format.js"; beforeEach((context) => setupSyncStore(context, { migrateUp: false })); diff --git a/packages/core/src/sync-store/sqlite/migrations.ts b/packages/core/src/sync-store/sqlite/migrations.ts index a2faa51d5..99e3e5cd1 100644 --- a/packages/core/src/sync-store/sqlite/migrations.ts +++ b/packages/core/src/sync-store/sqlite/migrations.ts @@ -1,4 +1,5 @@ -import { type Migration, type MigrationProvider, Kysely } from "kysely"; +import type { Kysely } from "kysely"; +import { type Migration, type MigrationProvider } from "kysely"; const migrations: Record = { ["2023_05_15_0_initial"]: { diff --git a/packages/core/src/sync-store/sqlite/store.ts b/packages/core/src/sync-store/sqlite/store.ts index 0a77addfb..bf0585c1d 100644 --- a/packages/core/src/sync-store/sqlite/store.ts +++ b/packages/core/src/sync-store/sqlite/store.ts @@ -9,28 +9,28 @@ import { } from "kysely"; import type { Hex, RpcBlock, RpcLog, RpcTransaction } from "viem"; -import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources"; -import type { Block } from "@/types/block"; -import type { Log } from "@/types/log"; -import type { Transaction } from "@/types/transaction"; -import type { NonNull } from "@/types/utils"; -import { decodeToBigInt, encodeAsText } from "@/utils/encoding"; +import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources.js"; +import type { Block } from "@/types/block.js"; +import type { Log } from "@/types/log.js"; +import type { Transaction } from "@/types/transaction.js"; +import type { NonNull } from "@/types/utils.js"; +import { decodeToBigInt, encodeAsText } from "@/utils/encoding.js"; import { buildFactoryFragments, buildLogFilterFragments, -} from "@/utils/fragments"; -import { intervalIntersectionMany, intervalUnion } from "@/utils/interval"; -import { range } from "@/utils/range"; +} from "@/utils/fragments.js"; +import { intervalIntersectionMany, intervalUnion } from "@/utils/interval.js"; +import { range } from "@/utils/range.js"; -import type { SyncStore } from "../store"; +import type { SyncStore } from "../store.js"; +import type { BigIntText } from "./format.js"; import { type SyncStoreTables, - BigIntText, rpcToSqliteBlock, rpcToSqliteLog, rpcToSqliteTransaction, -} from "./format"; -import { migrationProvider } from "./migrations"; +} from "./format.js"; +import { migrationProvider } from "./migrations.js"; export class SqliteSyncStore implements SyncStore { kind = "sqlite" as const; diff --git a/packages/core/src/sync-store/store.test.ts b/packages/core/src/sync-store/store.test.ts index 665edd828..d79b6b3c3 100644 --- a/packages/core/src/sync-store/store.test.ts +++ b/packages/core/src/sync-store/store.test.ts @@ -10,9 +10,9 @@ import { blockTwoLogs, blockTwoTransactions, usdcContractConfig, -} from "@/_test/constants"; -import { setupSyncStore } from "@/_test/setup"; -import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources"; +} from "@/_test/constants.js"; +import { setupSyncStore } from "@/_test/setup.js"; +import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources.js"; beforeEach((context) => setupSyncStore(context)); diff --git a/packages/core/src/sync-store/store.ts b/packages/core/src/sync-store/store.ts index af2696c7e..79651d35b 100644 --- a/packages/core/src/sync-store/store.ts +++ b/packages/core/src/sync-store/store.ts @@ -1,10 +1,10 @@ import type { Kysely, Migrator } from "kysely"; import type { Address, Hex, RpcBlock, RpcLog, RpcTransaction } from "viem"; -import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources"; -import type { Block } from "@/types/block"; -import type { Log } from "@/types/log"; -import type { Transaction } from "@/types/transaction"; +import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources.js"; +import type { Block } from "@/types/block.js"; +import type { Log } from "@/types/log.js"; +import type { Transaction } from "@/types/transaction.js"; export interface SyncStore { kind: "sqlite" | "postgres"; diff --git a/packages/core/src/telemetry/service.test.ts b/packages/core/src/telemetry/service.test.ts index 47c7465bc..28af4f31f 100644 --- a/packages/core/src/telemetry/service.test.ts +++ b/packages/core/src/telemetry/service.test.ts @@ -4,7 +4,7 @@ import { tmpdir } from "node:os"; import path from "path"; import { beforeEach, expect, test, vi } from "vitest"; -import { TelemetryService } from "@/telemetry/service"; +import { TelemetryService } from "@/telemetry/service.js"; const fetchSpy = vi.fn(); diff --git a/packages/core/src/telemetry/service.ts b/packages/core/src/telemetry/service.ts index 9d5d774f6..52de3a706 100644 --- a/packages/core/src/telemetry/service.ts +++ b/packages/core/src/telemetry/service.ts @@ -1,17 +1,24 @@ import Conf from "conf"; import { randomBytes } from "crypto"; -import { detect, getNpmVersion } from "detect-package-manager"; +import { createRequire } from "module"; import child_process from "node:child_process"; import { createHash } from "node:crypto"; import fs from "node:fs"; +import url from "node:url"; import os from "os"; import PQueue from "p-queue"; import path from "path"; import pc from "picocolors"; import process from "process"; -import type { Options } from "@/config/options"; -import { getGitRemoteUrl } from "@/telemetry/remote"; +import type { Options } from "@/config/options.js"; +import { getGitRemoteUrl } from "@/telemetry/remote.js"; + +const require = createRequire(import.meta.url); + +const __dirname = url.fileURLToPath(new URL(".", import.meta.url)); + +const { detect, getNpmVersion } = require("detect-package-manager"); type TelemetryEvent = { event: string; diff --git a/packages/core/src/types/model.test-d.ts b/packages/core/src/types/model.test-d.ts index 7a61dec8d..f53ec9540 100644 --- a/packages/core/src/types/model.test-d.ts +++ b/packages/core/src/types/model.test-d.ts @@ -1,9 +1,9 @@ import { test } from "vitest"; -import * as p from "@/schema"; -import { RecoverTableType } from "@/schema/types"; +import * as p from "@/schema/index.js"; +import type { RecoverTableType } from "@/schema/types.js"; -import { Model } from ".."; +import type { Model } from "./model.js"; test("model", () => { const schema = p.createSchema({ diff --git a/packages/core/src/types/model.ts b/packages/core/src/types/model.ts index 44d81acf2..3388ca89f 100644 --- a/packages/core/src/types/model.ts +++ b/packages/core/src/types/model.ts @@ -1,10 +1,10 @@ -import type { OrderByInput, WhereInput } from "@/indexing-store/store"; +import type { OrderByInput, WhereInput } from "@/indexing-store/store.js"; import type { HasOnlyIdProperty, HasRequiredPropertiesOtherThanId, Prettify, -} from "./utils"; +} from "./utils.js"; export type Model = { create: ( diff --git a/packages/core/src/types/ponder.test-d.ts b/packages/core/src/types/ponder.test-d.ts index 9c1dff689..cf443273f 100644 --- a/packages/core/src/types/ponder.test-d.ts +++ b/packages/core/src/types/ponder.test-d.ts @@ -1,7 +1,11 @@ -import { AbiEvent, ParseAbi } from "abitype"; +import type { AbiEvent, ParseAbi } from "abitype"; import { assertType, test } from "vitest"; -import { ExtractAddress, ExtractAllAddresses, PonderApp } from "./ponder"; +import type { + ExtractAddress, + ExtractAllAddresses, + PonderApp, +} from "./ponder.js"; type OneAbi = ParseAbi< ["event Event0(bytes32 indexed arg3)", "event Event1(bytes32 indexed)"] diff --git a/packages/core/src/types/ponder.ts b/packages/core/src/types/ponder.ts index 0d3cbcc42..fad7a3884 100644 --- a/packages/core/src/types/ponder.ts +++ b/packages/core/src/types/ponder.ts @@ -1,20 +1,20 @@ -import { AbiEvent } from "abitype"; -import { Abi, GetEventArgs } from "viem"; +import type { AbiEvent } from "abitype"; +import type { Abi, GetEventArgs } from "viem"; -import { +import type { Config, ContractFilter, ContractRequired, FilterAbiEvents, RecoverAbiEvent, SafeEventNames, -} from "@/config/config"; -import { ReadOnlyClient } from "@/indexing/ponderActions"; -import { Infer, Schema } from "@/schema/types"; -import { Block } from "@/types/block"; -import { Log } from "@/types/log"; -import { Model } from "@/types/model"; -import { Transaction } from "@/types/transaction"; +} from "@/config/config.js"; +import type { ReadOnlyClient } from "@/indexing/ponderActions.js"; +import type { Infer, Schema } from "@/schema/types.js"; +import type { Block } from "@/types/block.js"; +import type { Log } from "@/types/log.js"; +import type { Model } from "@/types/model.js"; +import type { Transaction } from "@/types/transaction.js"; /** "{ContractName}:{EventName}". */ export type Name = diff --git a/packages/core/src/types/transaction.ts b/packages/core/src/types/transaction.ts index 00e034558..c1a5aee8b 100644 --- a/packages/core/src/types/transaction.ts +++ b/packages/core/src/types/transaction.ts @@ -1,6 +1,6 @@ import type { AccessList, Address, Hash, Hex } from "viem"; -import type { Prettify } from "./utils"; +import type { Prettify } from "./utils.js"; /** * A confirmed Ethereum transaction. Contains `legacy`, `EIP-1559`, or `EIP-2930` fee values depending on the transaction `type`. diff --git a/packages/core/src/ui/HistoricalBar.tsx b/packages/core/src/ui/HistoricalBar.tsx index f3fd942ef..5e12b27c6 100644 --- a/packages/core/src/ui/HistoricalBar.tsx +++ b/packages/core/src/ui/HistoricalBar.tsx @@ -1,10 +1,10 @@ import { Box, Text } from "ink"; import React from "react"; -import { formatEta, formatPercentage } from "@/utils/format"; +import { formatEta, formatPercentage } from "@/utils/format.js"; -import type { UiState } from "./app"; -import { ProgressBar } from "./ProgressBar"; +import type { UiState } from "./app.js"; +import { ProgressBar } from "./ProgressBar.js"; export const HistoricalBar = ({ title, diff --git a/packages/core/src/ui/IndexingBar.tsx b/packages/core/src/ui/IndexingBar.tsx index 02846bf1f..5b8125a09 100644 --- a/packages/core/src/ui/IndexingBar.tsx +++ b/packages/core/src/ui/IndexingBar.tsx @@ -1,10 +1,10 @@ import { Box, Text } from "ink"; import React from "react"; -import { formatShortDate } from "@/utils/date"; +import { formatShortDate } from "@/utils/date.js"; -import type { UiState } from "./app"; -import { ProgressBar } from "./ProgressBar"; +import type { UiState } from "./app.js"; +import { ProgressBar } from "./ProgressBar.js"; export const IndexingBar = ({ ui }: { ui: UiState }) => { const completionRate = diff --git a/packages/core/src/ui/app.tsx b/packages/core/src/ui/app.tsx index 79a116e60..3b44b7ffa 100644 --- a/packages/core/src/ui/app.tsx +++ b/packages/core/src/ui/app.tsx @@ -1,10 +1,10 @@ import { Box, Newline, render as inkRender, Text } from "ink"; import React from "react"; -import { Source } from "@/config/sources"; +import type { Source } from "@/config/sources.js"; -import { HistoricalBar } from "./HistoricalBar"; -import { IndexingBar } from "./IndexingBar"; +import { HistoricalBar } from "./HistoricalBar.js"; +import { IndexingBar } from "./IndexingBar.js"; export type UiState = { port: number; diff --git a/packages/core/src/ui/service.ts b/packages/core/src/ui/service.ts index a3aa27a53..f2a09efd7 100644 --- a/packages/core/src/ui/service.ts +++ b/packages/core/src/ui/service.ts @@ -1,14 +1,14 @@ -import { Source } from "@/config/sources"; -import type { Common } from "@/Ponder"; +import type { Source } from "@/config/sources.js"; +import type { Common } from "@/Ponder.js"; -import { type UiState, buildUiState, setupInkApp } from "./app"; +import { type UiState, buildUiState, setupInkApp } from "./app.js"; export class UiService { private common: Common; private sources: Source[]; ui: UiState; - renderInterval: NodeJS.Timer; + renderInterval: NodeJS.Timeout; render: () => void; unmount: () => void; diff --git a/packages/core/src/utils/encoding.test.ts b/packages/core/src/utils/encoding.test.ts index bfad7a8fd..f4f3a70a8 100644 --- a/packages/core/src/utils/encoding.test.ts +++ b/packages/core/src/utils/encoding.test.ts @@ -5,7 +5,7 @@ import { encodeAsText, EVM_MAX_UINT, EVM_MIN_INT, -} from "./encoding"; +} from "./encoding.js"; test("encodeAsText handles small positive integer", () => { const value = 101n; diff --git a/packages/core/src/utils/fragments.test.ts b/packages/core/src/utils/fragments.test.ts index 11e7a8acf..c02ec900f 100644 --- a/packages/core/src/utils/fragments.test.ts +++ b/packages/core/src/utils/fragments.test.ts @@ -1,9 +1,9 @@ import { parseAbiItem } from "viem"; import { expect, test } from "vitest"; -import { buildFactoryCriteria } from "@/config/factories"; +import { buildFactoryCriteria } from "@/config/factories.js"; -import { buildFactoryFragments, buildLogFilterFragments } from "./fragments"; +import { buildFactoryFragments, buildLogFilterFragments } from "./fragments.js"; const llamaFactoryEventAbiItem = parseAbiItem( "event LlamaInstanceCreated(address indexed deployer, string indexed name, address llamaCore, address llamaExecutor, address llamaPolicy, uint256 chainId)" diff --git a/packages/core/src/utils/fragments.ts b/packages/core/src/utils/fragments.ts index c30575613..121440fe6 100644 --- a/packages/core/src/utils/fragments.ts +++ b/packages/core/src/utils/fragments.ts @@ -1,6 +1,6 @@ import type { Address, Hex } from "viem"; -import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources"; +import type { FactoryCriteria, LogFilterCriteria } from "@/config/sources.js"; /** * Generates log filter fragments from a log filter. diff --git a/packages/core/src/utils/interval.test.ts b/packages/core/src/utils/interval.test.ts index 085b9193e..ee8f02988 100644 --- a/packages/core/src/utils/interval.test.ts +++ b/packages/core/src/utils/interval.test.ts @@ -8,7 +8,7 @@ import { intervalSum, intervalUnion, ProgressTracker, -} from "./interval"; +} from "./interval.js"; test("intervalSum handles empty input", () => { const result = intervalSum([]); diff --git a/packages/core/src/utils/offset.test.ts b/packages/core/src/utils/offset.test.ts index 7caff7fdd..5cea87d0e 100644 --- a/packages/core/src/utils/offset.test.ts +++ b/packages/core/src/utils/offset.test.ts @@ -1,6 +1,6 @@ import { expect, test } from "vitest"; -import { getBytesConsumedByParam } from "./offset"; +import { getBytesConsumedByParam } from "./offset.js"; test("getBytesConsumedByParam returns 32 for static primitive types", () => { expect(getBytesConsumedByParam({ type: "uint" })).toBe(32); diff --git a/packages/core/src/utils/poll.ts b/packages/core/src/utils/poll.ts index 57af72710..94d50221d 100644 --- a/packages/core/src/utils/poll.ts +++ b/packages/core/src/utils/poll.ts @@ -1,4 +1,4 @@ -import { wait } from "./wait"; +import { wait } from "./wait.js"; // Adapted from viem. // https://github.com/wagmi-dev/viem/blob/38422ac7617022761ee7aa87310dd89adb34573c/src/utils/poll.ts diff --git a/packages/core/src/utils/queue.ts b/packages/core/src/utils/queue.ts index 13ff9bf94..0370fd8d3 100644 --- a/packages/core/src/utils/queue.ts +++ b/packages/core/src/utils/queue.ts @@ -1,12 +1,9 @@ -import PQueue, { - type DefaultAddOptions, - type Options, - type Queue as TPQueue, -} from "p-queue"; +import type { DefaultAddOptions, Options, Queue as TPQueue } from "p-queue"; +import PQueue from "p-queue"; import retry, { type CreateTimeoutOptions } from "retry"; import { setTimeout } from "timers/promises"; -import type { Prettify } from "@/types/utils"; +import type { Prettify } from "@/types/utils.js"; type TaskOptions = { priority?: number; retry?: boolean }; diff --git a/packages/core/tsconfig.base.json b/packages/core/tsconfig.base.json index 3fccb2508..23f4c5f53 100644 --- a/packages/core/tsconfig.base.json +++ b/packages/core/tsconfig.base.json @@ -22,14 +22,14 @@ "jsx": "react", // Interop constraints. These will remain loose until we start emitting ESM. - "verbatimModuleSyntax": false, + "verbatimModuleSyntax": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, "resolveJsonModule": true, // Language and environment "moduleResolution": "NodeNext", - "module": "ESNext", + "module": "NodeNext", "target": "ESNext", "lib": [ "ES2022", // By using ES2022 we get access to the `.cause` property on `Error` instances. diff --git a/packages/core/tsconfig.build.json b/packages/core/tsconfig.build.json index 1f127bda8..baffa6734 100644 --- a/packages/core/tsconfig.build.json +++ b/packages/core/tsconfig.build.json @@ -4,7 +4,7 @@ "include": ["src"], "exclude": ["src/_test", "src/**/*.test.ts"], "compilerOptions": { - "module": "commonjs", + "module": "NodeNext", "sourceMap": true, "declaration": true, "declarationMap": true, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2b599d72d..3fad19da0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -21,10 +21,10 @@ importers: version: 2.26.1 '@typescript-eslint/eslint-plugin': specifier: ^6.3.0 - version: 6.3.0(@typescript-eslint/parser@6.3.0)(eslint@8.43.0)(typescript@5.1.3) + version: 6.3.0(@typescript-eslint/parser@6.3.0)(eslint@8.43.0)(typescript@5.2.2) '@typescript-eslint/parser': specifier: ^6.3.0 - version: 6.3.0(eslint@8.43.0)(typescript@5.1.3) + version: 6.3.0(eslint@8.43.0)(typescript@5.2.2) eslint: specifier: ^8.43.0 version: 8.43.0 @@ -50,8 +50,8 @@ importers: specifier: ^2.9.0 version: 2.9.0 typescript: - specifier: ^5.1.3 - version: 5.1.3 + specifier: ^5.2.2 + version: 5.2.2 benchmarks: devDependencies: @@ -315,7 +315,7 @@ importers: version: 0.3.18 abitype: specifier: ^0.8.11 - version: 0.8.11(typescript@5.1.3) + version: 0.8.11(typescript@5.2.2) async-mutex: specifier: ^0.4.0 version: 0.4.0 @@ -326,8 +326,8 @@ importers: specifier: ^6.7.14 version: 6.7.14 conf: - specifier: ^10.2.0 - version: 10.2.0 + specifier: ^12.0.0 + version: 12.0.0 cors: specifier: ^2.8.5 version: 2.8.5 @@ -371,8 +371,8 @@ importers: specifier: '3' version: 3.1.0 p-queue: - specifier: ^6.6.2 - version: 6.6.2 + specifier: ^7.4.1 + version: 7.4.1 pg: specifier: ^8.9.0 version: 8.9.0 @@ -396,13 +396,13 @@ importers: version: 0.1.10 viem: specifier: ^1.2.6 - version: 1.2.6(typescript@5.1.3) + version: 1.2.6(typescript@5.2.2) vite: specifier: ^4.5.0 - version: 4.5.0(@types/node@18.16.18) + version: 4.5.0(@types/node@20.9.0) vite-node: specifier: ^0.34.6 - version: 0.34.6(@types/node@18.16.18) + version: 0.34.6(@types/node@20.9.0) devDependencies: '@types/babel__code-frame': specifier: ^7.0.3 @@ -420,8 +420,8 @@ importers: specifier: ^8.0.0 version: 8.0.0 '@types/node': - specifier: ^18.7.8 - version: 18.16.18 + specifier: ^20.9.0 + version: 20.9.0 '@types/pg': specifier: ^8.6.6 version: 8.6.6 @@ -450,8 +450,8 @@ importers: specifier: ^1.8.2 version: 1.8.2 typescript: - specifier: ^5.1.3 - version: 5.1.3 + specifier: ^5.2.2 + version: 5.2.2 vitest: specifier: ^0.34.6 version: 0.34.6 @@ -3248,7 +3248,7 @@ packages: /@types/better-sqlite3@7.6.0: resolution: {integrity: sha512-rnSP9vY+fVsF3iJja5yRGBJV63PNBiezJlYrCkqUmQWFoB16cxAHwOkjsAYEu317miOfKaJpa65cbp0P4XJ/jw==} dependencies: - '@types/node': 18.16.18 + '@types/node': 20.9.0 dev: true /@types/bn.js@5.1.1: @@ -3261,7 +3261,7 @@ packages: resolution: {integrity: sha512-ALYone6pm6QmwZoAgeyNksccT9Q4AWZQ6PvfwR37GT6r6FWUPguq6sUmNGSMV2Wr761oQoBxwGGa6DR5o1DC9g==} dependencies: '@types/connect': 3.4.35 - '@types/node': 18.16.18 + '@types/node': 20.9.0 dev: true /@types/chai-subset@1.3.3: @@ -3289,7 +3289,7 @@ packages: /@types/connect@3.4.35: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: - '@types/node': 18.16.18 + '@types/node': 20.9.0 dev: true /@types/cookiejar@2.1.2: @@ -3319,7 +3319,7 @@ packages: /@types/express-serve-static-core@4.17.30: resolution: {integrity: sha512-gstzbTWro2/nFed1WXtf+TtrpwxH7Ggs4RLYTLbeVgIkUQOI3WG/JKjgeOU1zXDvezllupjrf8OPIdvTbIaVOQ==} dependencies: - '@types/node': 18.16.18 + '@types/node': 20.9.0 '@types/qs': 6.9.7 '@types/range-parser': 1.2.4 dev: true @@ -3343,7 +3343,7 @@ packages: resolution: {integrity: sha512-l6NQsDDyQUVeoTynNpC9uRvCUint/gSUXQA2euwmTuWGvPY5LSDUu6tkCtJB2SvGQlJQzLaKqcGZP4//7EDveA==} dependencies: '@types/minimatch': 5.1.2 - '@types/node': 18.16.18 + '@types/node': 20.9.0 dev: true /@types/hast@2.3.5: @@ -3428,6 +3428,12 @@ packages: /@types/node@18.16.18: resolution: {integrity: sha512-/aNaQZD0+iSBAGnvvN2Cx92HqE5sZCPZtx2TsK+4nvV23fFe09jVDvpArXr2j9DnYlzuU9WuoykDDc6wqvpNcw==} + dev: true + + /@types/node@20.9.0: + resolution: {integrity: sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==} + dependencies: + undici-types: 5.26.5 /@types/node@8.10.66: resolution: {integrity: sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==} @@ -3450,7 +3456,7 @@ packages: /@types/pg@8.6.6: resolution: {integrity: sha512-O2xNmXebtwVekJDD+02udOncjVcMZQuTEQEMpKJ0ZRf5E7/9JJX3izhKUcUifBkyKpljyUM6BTgy2trmviKlpw==} dependencies: - '@types/node': 18.16.18 + '@types/node': 20.9.0 pg-protocol: 1.6.0 pg-types: 2.2.0 dev: true @@ -3514,14 +3520,14 @@ packages: resolution: {integrity: sha512-z5xyF6uh8CbjAu9760KDKsH2FcDxZ2tFCsA4HIMWE6IkiYMXfVoa+4f9KX+FN0ZLsaMw1WNG2ETLA6N+/YA+cg==} dependencies: '@types/mime': 3.0.1 - '@types/node': 18.16.18 + '@types/node': 20.9.0 dev: true /@types/superagent@4.1.16: resolution: {integrity: sha512-tLfnlJf6A5mB6ddqF159GqcDizfzbMUB1/DeT59/wBNqzRTNNKsaw79A/1TZ84X+f/EwWH8FeuSkjlCLyqS/zQ==} dependencies: '@types/cookiejar': 2.1.2 - '@types/node': 18.16.18 + '@types/node': 20.9.0 dev: true /@types/supertest@2.0.12: @@ -3548,36 +3554,6 @@ packages: resolution: {integrity: sha512-S9q47ByT2pPvD65IvrWp7qppVMpk9WGMbVq9wbWZOHg6tnXSD4vyhao6nOSBwwfDdV2p3Kx9evA9vI+XWTfDvw==} dev: false - /@typescript-eslint/eslint-plugin@6.3.0(@typescript-eslint/parser@6.3.0)(eslint@8.43.0)(typescript@5.1.3): - resolution: {integrity: sha512-IZYjYZ0ifGSLZbwMqIip/nOamFiWJ9AH+T/GYNZBWkVcyNQOFGtSMoWV7RvY4poYCMZ/4lHzNl796WOSNxmk8A==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - '@typescript-eslint/parser': ^6.0.0 || ^6.0.0-alpha - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@eslint-community/regexpp': 4.5.1 - '@typescript-eslint/parser': 6.3.0(eslint@8.43.0)(typescript@5.1.3) - '@typescript-eslint/scope-manager': 6.3.0 - '@typescript-eslint/type-utils': 6.3.0(eslint@8.43.0)(typescript@5.1.3) - '@typescript-eslint/utils': 6.3.0(eslint@8.43.0)(typescript@5.1.3) - '@typescript-eslint/visitor-keys': 6.3.0 - debug: 4.3.4(supports-color@8.1.1) - eslint: 8.43.0 - graphemer: 1.4.0 - ignore: 5.2.4 - natural-compare: 1.4.0 - natural-compare-lite: 1.4.0 - semver: 7.5.4 - ts-api-utils: 1.0.1(typescript@5.1.3) - typescript: 5.1.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/eslint-plugin@6.3.0(@typescript-eslint/parser@6.3.0)(eslint@8.43.0)(typescript@5.2.2): resolution: {integrity: sha512-IZYjYZ0ifGSLZbwMqIip/nOamFiWJ9AH+T/GYNZBWkVcyNQOFGtSMoWV7RvY4poYCMZ/4lHzNl796WOSNxmk8A==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3606,7 +3582,6 @@ packages: typescript: 5.2.2 transitivePeerDependencies: - supports-color - dev: false /@typescript-eslint/parser@5.59.11(eslint@8.43.0)(typescript@4.9.5): resolution: {integrity: sha512-s9ZF3M+Nym6CAZEkJJeO2TFHHDsKAM3ecNkLuH4i4s8/RCPnF5JRip2GyviYkeEAcwGMJxkqG9h2dAsnA1nZpA==} @@ -3628,27 +3603,6 @@ packages: - supports-color dev: true - /@typescript-eslint/parser@6.3.0(eslint@8.43.0)(typescript@5.1.3): - resolution: {integrity: sha512-ibP+y2Gr6p0qsUkhs7InMdXrwldjxZw66wpcQq9/PzAroM45wdwyu81T+7RibNCh8oc0AgrsyCwJByncY0Ongg==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/scope-manager': 6.3.0 - '@typescript-eslint/types': 6.3.0 - '@typescript-eslint/typescript-estree': 6.3.0(typescript@5.1.3) - '@typescript-eslint/visitor-keys': 6.3.0 - debug: 4.3.4(supports-color@8.1.1) - eslint: 8.43.0 - typescript: 5.1.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/parser@6.3.0(eslint@8.43.0)(typescript@5.2.2): resolution: {integrity: sha512-ibP+y2Gr6p0qsUkhs7InMdXrwldjxZw66wpcQq9/PzAroM45wdwyu81T+7RibNCh8oc0AgrsyCwJByncY0Ongg==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3668,7 +3622,6 @@ packages: typescript: 5.2.2 transitivePeerDependencies: - supports-color - dev: false /@typescript-eslint/scope-manager@5.59.11: resolution: {integrity: sha512-dHFOsxoLFtrIcSj5h0QoBT/89hxQONwmn3FOQ0GOQcLOOXm+MIrS8zEAhs4tWl5MraxCY3ZJpaXQQdFMc2Tu+Q==} @@ -3685,26 +3638,6 @@ packages: '@typescript-eslint/types': 6.3.0 '@typescript-eslint/visitor-keys': 6.3.0 - /@typescript-eslint/type-utils@6.3.0(eslint@8.43.0)(typescript@5.1.3): - resolution: {integrity: sha512-7Oj+1ox1T2Yc8PKpBvOKWhoI/4rWFd1j7FA/rPE0lbBPXTKjdbtC+7Ev0SeBjEKkIhKWVeZSP+mR7y1Db1CdfQ==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/typescript-estree': 6.3.0(typescript@5.1.3) - '@typescript-eslint/utils': 6.3.0(eslint@8.43.0)(typescript@5.1.3) - debug: 4.3.4(supports-color@8.1.1) - eslint: 8.43.0 - ts-api-utils: 1.0.1(typescript@5.1.3) - typescript: 5.1.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/type-utils@6.3.0(eslint@8.43.0)(typescript@5.2.2): resolution: {integrity: sha512-7Oj+1ox1T2Yc8PKpBvOKWhoI/4rWFd1j7FA/rPE0lbBPXTKjdbtC+7Ev0SeBjEKkIhKWVeZSP+mR7y1Db1CdfQ==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3723,7 +3656,6 @@ packages: typescript: 5.2.2 transitivePeerDependencies: - supports-color - dev: false /@typescript-eslint/types@5.59.11: resolution: {integrity: sha512-epoN6R6tkvBYSc+cllrz+c2sOFWkbisJZWkOE+y3xHtvYaOE6Wk6B8e114McRJwFRjGvYdJwLXQH5c9osME/AA==} @@ -3755,27 +3687,6 @@ packages: - supports-color dev: true - /@typescript-eslint/typescript-estree@6.3.0(typescript@5.1.3): - resolution: {integrity: sha512-Xh4NVDaC4eYKY4O3QGPuQNp5NxBAlEvNQYOqJquR2MePNxO11E5K3t5x4M4Mx53IZvtpW+mBxIT0s274fLUocg==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - typescript: '*' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@typescript-eslint/types': 6.3.0 - '@typescript-eslint/visitor-keys': 6.3.0 - debug: 4.3.4(supports-color@8.1.1) - globby: 11.1.0 - is-glob: 4.0.3 - semver: 7.5.4 - ts-api-utils: 1.0.1(typescript@5.1.3) - typescript: 5.1.3 - transitivePeerDependencies: - - supports-color - dev: true - /@typescript-eslint/typescript-estree@6.3.0(typescript@5.2.2): resolution: {integrity: sha512-Xh4NVDaC4eYKY4O3QGPuQNp5NxBAlEvNQYOqJquR2MePNxO11E5K3t5x4M4Mx53IZvtpW+mBxIT0s274fLUocg==} engines: {node: ^16.0.0 || >=18.0.0} @@ -3795,26 +3706,6 @@ packages: typescript: 5.2.2 transitivePeerDependencies: - supports-color - dev: false - - /@typescript-eslint/utils@6.3.0(eslint@8.43.0)(typescript@5.1.3): - resolution: {integrity: sha512-hLLg3BZE07XHnpzglNBG8P/IXq/ZVXraEbgY7FM0Cnc1ehM8RMdn9mat3LubJ3KBeYXXPxV1nugWbQPjGeJk6Q==} - engines: {node: ^16.0.0 || >=18.0.0} - peerDependencies: - eslint: ^7.0.0 || ^8.0.0 - dependencies: - '@eslint-community/eslint-utils': 4.4.0(eslint@8.43.0) - '@types/json-schema': 7.0.12 - '@types/semver': 7.5.0 - '@typescript-eslint/scope-manager': 6.3.0 - '@typescript-eslint/types': 6.3.0 - '@typescript-eslint/typescript-estree': 6.3.0(typescript@5.1.3) - eslint: 8.43.0 - semver: 7.5.4 - transitivePeerDependencies: - - supports-color - - typescript - dev: true /@typescript-eslint/utils@6.3.0(eslint@8.43.0)(typescript@5.2.2): resolution: {integrity: sha512-hLLg3BZE07XHnpzglNBG8P/IXq/ZVXraEbgY7FM0Cnc1ehM8RMdn9mat3LubJ3KBeYXXPxV1nugWbQPjGeJk6Q==} @@ -3833,7 +3724,6 @@ packages: transitivePeerDependencies: - supports-color - typescript - dev: false /@typescript-eslint/visitor-keys@5.59.11: resolution: {integrity: sha512-KGYniTGG3AMTuKF9QBD7EIrvufkB6O6uX3knP73xbKLMpH+QRPcgnCxjWXSHjMRuOxFLovljqQgQpR0c7GvjoA==} @@ -3925,6 +3815,18 @@ packages: optional: true dependencies: typescript: 5.1.3 + dev: true + + /@wagmi/chains@1.2.0(typescript@5.2.2): + resolution: {integrity: sha512-dmDRipsE54JfyudOBkuhEexqQWcrZqxn/qiujG8SBzMh/az/AH5xlJSA+j1CPWTx9+QofSMF3B7A4gb6XRmSaQ==} + peerDependencies: + typescript: '>=5.0.4' + peerDependenciesMeta: + typescript: + optional: true + dependencies: + typescript: 5.2.2 + dev: false /@whatwg-node/events@0.0.3: resolution: {integrity: sha512-IqnKIDWfXBJkvy/k6tzskWTc2NK3LcqHlb+KHGCrjOCH4jfQckRX0NAiIcC/vIqQkzLYw2r2CTSwAxcrtcD6lA==} @@ -3988,6 +3890,19 @@ packages: optional: true dependencies: typescript: 5.1.3 + dev: true + + /abitype@0.8.11(typescript@5.2.2): + resolution: {integrity: sha512-bM4v2dKvX08sZ9IU38IN5BKmN+ZkOSd2oI4a9f0ejHYZQYV6cDr7j+d95ga0z2XHG36Y4jzoG5Z7qDqxp7fi/A==} + peerDependencies: + typescript: '>=5.0.4' + zod: ^3 >=3.19.1 + peerDependenciesMeta: + zod: + optional: true + dependencies: + typescript: 5.2.2 + dev: false /abitype@0.8.7(typescript@5.1.3): resolution: {integrity: sha512-wQ7hV8Yg/yKmGyFpqrNZufCxbszDe5es4AZGYPBitocfSqXtjrTG9JMWFcc4N30ukl2ve48aBTwt7NJxVQdU3w==} @@ -4332,9 +4247,11 @@ packages: engines: {node: '>=8.0.0'} dev: false - /atomically@1.7.0: - resolution: {integrity: sha512-Xcz9l0z7y9yQ9rdDaxlmaI4uJHf/T8g9hOEzJcsEqX2SjCj4J20uK7+ldkDHMbpJDK76wF7xEIgxc/vSlsfw5w==} - engines: {node: '>=10.12.0'} + /atomically@2.0.2: + resolution: {integrity: sha512-Xfmb4q5QV7uqTlVdMSTtO5eF4DCHfNOdaPyKlbFShkzeNP+3lj3yjjcbdjSmEY4+pDBKJ9g26aP+ImTe88UHoQ==} + dependencies: + stubborn-fs: 1.2.5 + when-exit: 2.1.1 dev: false /auto-bind@4.0.0: @@ -5054,20 +4971,19 @@ packages: yargs: 17.7.2 dev: true - /conf@10.2.0: - resolution: {integrity: sha512-8fLl9F04EJqjSqH+QjITQfJF8BrOVaYr1jewVgSRAEWePfxT0sku4w2hrGQ60BC/TNLGQ2pgxNlTbWQmMPFvXg==} - engines: {node: '>=12'} + /conf@12.0.0: + resolution: {integrity: sha512-fIWyWUXrJ45cHCIQX+Ck1hrZDIf/9DR0P0Zewn3uNht28hbt5OfGUq8rRWsxi96pZWPyBEd0eY9ama01JTaknA==} + engines: {node: '>=18'} dependencies: ajv: 8.12.0 ajv-formats: 2.1.1(ajv@8.12.0) - atomically: 1.7.0 - debounce-fn: 4.0.0 - dot-prop: 6.0.1 - env-paths: 2.2.1 - json-schema-typed: 7.0.3 - onetime: 5.1.2 - pkg-up: 3.1.0 + atomically: 2.0.2 + debounce-fn: 5.1.2 + dot-prop: 8.0.2 + env-paths: 3.0.0 + json-schema-typed: 8.0.1 semver: 7.5.4 + uint8array-extras: 0.3.0 dev: false /content-disposition@0.5.4: @@ -5204,7 +5120,7 @@ packages: dependencies: nice-try: 1.0.5 path-key: 2.0.1 - semver: 5.7.1 + semver: 5.7.2 shebang-command: 1.2.0 which: 1.3.1 dev: true @@ -5589,11 +5505,11 @@ packages: resolution: {integrity: sha512-QvzAURSbQ0pKdIye2txOzNaHmxtUBXerpY0FJsFXUMKbIZeFm5ht1LS/jFsrncjnmtv8HsG0W2g6c0zUjZWmpA==} dev: false - /debounce-fn@4.0.0: - resolution: {integrity: sha512-8pYCQiL9Xdcg0UPSD3d+0KMlOjp+KGU5EPwYddgzQ7DATsg4fuUDjQtsYLmWjnk2obnNHgV3vE2Y4jejSOJVBQ==} - engines: {node: '>=10'} + /debounce-fn@5.1.2: + resolution: {integrity: sha512-Sr4SdOZ4vw6eQDvPYNxHogvrxmCIld/VenC5JbNrFwMiwd7lY/Z18ZFfo+EWNG4DD9nFlAujWAo/wGuOPHmy5A==} + engines: {node: '>=12'} dependencies: - mimic-fn: 3.1.0 + mimic-fn: 4.0.0 dev: false /debug@2.6.9: @@ -5859,11 +5775,11 @@ packages: domhandler: 4.3.1 dev: true - /dot-prop@6.0.1: - resolution: {integrity: sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==} - engines: {node: '>=10'} + /dot-prop@8.0.2: + resolution: {integrity: sha512-xaBe6ZT4DHPkg0k4Ytbvn5xoxgpG0jOS1dYxSOwAHPuNLjP3/OzN0gH55SrLqpx8cBfSaVt91lXYkApjb+nYdQ==} + engines: {node: '>=16'} dependencies: - is-obj: 2.0.0 + type-fest: 3.13.1 dev: false /dotenv@16.0.1: @@ -5986,9 +5902,9 @@ packages: resolution: {integrity: sha512-V0hjH4dGPh9Ao5p0MoRY6BVqtwCjhz6vI5LT8AJ55H+4g9/4vbHx1I54fS0XuclLhDHArPQCiMjDxjaL8fPxhw==} engines: {node: '>=0.12'} - /env-paths@2.2.1: - resolution: {integrity: sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==} - engines: {node: '>=6'} + /env-paths@3.0.0: + resolution: {integrity: sha512-dtJUTepzMW3Lm/NPxRf3wP4642UWhjL2sQxc+ym2YMj1m/H2zDNQOlezafzkHwn6sMstjHTwG6iQQsctDW/b1A==} + engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} dev: false /err-code@3.0.1: @@ -6215,7 +6131,7 @@ packages: eslint-import-resolver-webpack: optional: true dependencies: - '@typescript-eslint/parser': 6.3.0(eslint@8.43.0)(typescript@5.1.3) + '@typescript-eslint/parser': 6.3.0(eslint@8.43.0)(typescript@5.2.2) debug: 3.2.7 eslint: 8.43.0 eslint-import-resolver-node: 0.3.7 @@ -6233,7 +6149,7 @@ packages: '@typescript-eslint/parser': optional: true dependencies: - '@typescript-eslint/parser': 6.3.0(eslint@8.43.0)(typescript@5.1.3) + '@typescript-eslint/parser': 6.3.0(eslint@8.43.0)(typescript@5.2.2) array-includes: 3.1.6 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 @@ -6528,6 +6444,11 @@ packages: /eventemitter3@4.0.7: resolution: {integrity: sha512-8guHBZCwKnFhYdHr2ysuRWErTwhoN2X8XELRlrRwpmfeY2jjuUN4taQMsULKUVo1K4DvZl+0pgfyoysHxvmvEw==} + dev: true + + /eventemitter3@5.0.1: + resolution: {integrity: sha512-GWkBvjiSZK87ELrYOSESUYeVIc9mvLLf/nXalMOS5dYrgZq9o5OVkbZAVM06CVxYsCwH9BDZFPlQTlPA1j4ahA==} + dev: false /events@3.3.0: resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==} @@ -6779,13 +6700,6 @@ packages: - supports-color dev: false - /find-up@3.0.0: - resolution: {integrity: sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==} - engines: {node: '>=6'} - dependencies: - locate-path: 3.0.0 - dev: false - /find-up@4.1.0: resolution: {integrity: sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==} engines: {node: '>=8'} @@ -7995,11 +7909,6 @@ packages: resolution: {integrity: sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==} engines: {node: '>=0.12.0'} - /is-obj@2.0.0: - resolution: {integrity: sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==} - engines: {node: '>=8'} - dev: false - /is-obj@3.0.0: resolution: {integrity: sha512-IlsXEHOjtKhpN8r/tRFj2nDyTmHvcfNeu/nrRIcXE17ROeatXchkojffa1SpdqW4cr/Fj6QkEf/Gn4zf6KKvEQ==} engines: {node: '>=12'} @@ -8286,8 +8195,8 @@ packages: resolution: {integrity: sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==} dev: false - /json-schema-typed@7.0.3: - resolution: {integrity: sha512-7DE8mpG+/fVw+dTpjbxnx47TaMnDfOI1jwft9g1VybltZCduyRQPJPvc+zzKY9WPHxhPWczyFuYa6I8Mw4iU5A==} + /json-schema-typed@8.0.1: + resolution: {integrity: sha512-XQmWYj2Sm4kn4WeTYvmpKEbyPsL7nBsb647c7pMe6l02/yx2+Jfc4dT6UZkEXnIUb5LhD55r2HPsJ1milQ4rDg==} dev: false /json-schema@0.4.0: @@ -8487,14 +8396,6 @@ packages: engines: {node: '>=14'} dev: true - /locate-path@3.0.0: - resolution: {integrity: sha512-7AO748wWnIhNqAuaty2ZWHkQHRSNfPVIsPIfwEOWO22AmaoVrWavlOcMR5nzTLNYvp36X220/maaRsrec1G65A==} - engines: {node: '>=6'} - dependencies: - p-locate: 3.0.0 - path-exists: 3.0.0 - dev: false - /locate-path@5.0.0: resolution: {integrity: sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==} engines: {node: '>=8'} @@ -9382,15 +9283,9 @@ packages: resolution: {integrity: sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==} engines: {node: '>=6'} - /mimic-fn@3.1.0: - resolution: {integrity: sha512-Ysbi9uYW9hFyfrThdDEQuykN4Ey6BuwPD2kpI5ES/nFTDn/98yxYNLZJcgUAKPT/mcrLLKaGzJR9YVxJrIdASQ==} - engines: {node: '>=8'} - dev: false - /mimic-fn@4.0.0: resolution: {integrity: sha512-vqiC06CuhBTUdZH+RYl8sFrL096vA45Ok5ISO6sE/Mr1jRbGH4Csnhi8f3wKVl7x8mO4Au7Ir9D3Oyv1VYMFJw==} engines: {node: '>=12'} - dev: true /mimic-response@3.1.0: resolution: {integrity: sha512-z0yWI+4FDrrweS8Zmt4Ej5HdJmky15+L2e6Wgn3+iK5fWzb6T3fhNFq2+MeTRb064c6Wr4N/wv0DzQTjNzHNGQ==} @@ -10031,6 +9926,7 @@ packages: engines: {node: '>=6'} dependencies: p-try: 2.2.0 + dev: true /p-limit@3.1.0: resolution: {integrity: sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==} @@ -10045,13 +9941,6 @@ packages: yocto-queue: 1.0.0 dev: true - /p-locate@3.0.0: - resolution: {integrity: sha512-x+12w/To+4GFfgJhBEpiDcLozRJGegY+Ei7/z0tSLkMmxGZNybVMSfWj9aJn8Z5Fc7dBUNJOOVgPv2H7IwulSQ==} - engines: {node: '>=6'} - dependencies: - p-limit: 2.3.0 - dev: false - /p-locate@4.1.0: resolution: {integrity: sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==} engines: {node: '>=8'} @@ -10077,12 +9966,12 @@ packages: aggregate-error: 3.1.0 dev: true - /p-queue@6.6.2: - resolution: {integrity: sha512-RwFpb72c/BhQLEXIZ5K2e+AhgNVmIejGlTgiB9MzZ0e93GRvqZ7uSi0dvRF7/XIXDeNkra2fNHBxTyPDGySpjQ==} - engines: {node: '>=8'} + /p-queue@7.4.1: + resolution: {integrity: sha512-vRpMXmIkYF2/1hLBKisKeVYJZ8S2tZ0zEAmIJgdVKP2nq0nh4qCdf8bgw+ZgKrkh71AOCaqzwbJJk1WtdcF3VA==} + engines: {node: '>=12'} dependencies: - eventemitter3: 4.0.7 - p-timeout: 3.2.0 + eventemitter3: 5.0.1 + p-timeout: 5.1.0 dev: false /p-timeout@3.2.0: @@ -10092,9 +9981,15 @@ packages: p-finally: 1.0.0 dev: false + /p-timeout@5.1.0: + resolution: {integrity: sha512-auFDyzzzGZZZdHz3BtET9VEz0SE/uMEAx7uWfGPucfzEwwe/xH0iVeZibQmANYE/hp9T2+UUZT5m+BKyrDp3Ew==} + engines: {node: '>=12'} + dev: false + /p-try@2.2.0: resolution: {integrity: sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==} engines: {node: '>=6'} + dev: true /p-wait-for@3.2.0: resolution: {integrity: sha512-wpgERjNkLrBiFmkMEjuZJEWKKDrNfHCKA1OhyN1wg1FrLkULbviEy6py1AyJUgZ72YWFbZ38FIpnqvVqAlDUwA==} @@ -10189,11 +10084,6 @@ packages: engines: {node: '>=10'} dev: false - /path-exists@3.0.0: - resolution: {integrity: sha512-bpC7GYwiDYQ4wYLe+FA8lhRjhQCMcQGuSgGGqDkg/QerRWw9CmGRT0iSOVRSZJ29NMLZgIzqaljJ63oaL4NIJQ==} - engines: {node: '>=4'} - dev: false - /path-exists@4.0.0: resolution: {integrity: sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==} engines: {node: '>=8'} @@ -10382,13 +10272,6 @@ packages: mlly: 1.4.2 pathe: 1.1.1 - /pkg-up@3.1.0: - resolution: {integrity: sha512-nDywThFk1i4BQK4twPQ6TA4RT8bDY96yeuCVBWL3ePARCiEKDRSrNGbFIgUJpLp+XeIR65v8ra7WuJOFUBtkMA==} - engines: {node: '>=8'} - dependencies: - find-up: 3.0.0 - dev: false - /plimit-lit@1.5.0: resolution: {integrity: sha512-Eb/MqCb1Iv/ok4m1FqIXqvUKPISufcjZ605hl3KM/n8GaX8zfhtgdLwZU3vKjuHGh2O9Rjog/bHTq8ofIShdng==} dependencies: @@ -11246,6 +11129,11 @@ packages: hasBin: true dev: true + /semver@5.7.2: + resolution: {integrity: sha512-cBznnQ9KjJqU67B52RMC65CMarK2600WFnbkcaiwWq3xy/5haFJlshgnpjovMVJ+Hff49d8GEn0b87C5pDQ10g==} + hasBin: true + dev: true + /semver@6.3.0: resolution: {integrity: sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==} hasBin: true @@ -11761,6 +11649,10 @@ packages: acorn: 8.10.0 dev: true + /stubborn-fs@1.2.5: + resolution: {integrity: sha512-H2N9c26eXjzL/S/K+i/RHHcFanE74dptvvjM8iwzwbVcWY/zjBbgRqF3K0DY4+OD+uTTASTBvDoxPDaPN02D7g==} + dev: false + /style-to-object@0.4.1: resolution: {integrity: sha512-HFpbb5gr2ypci7Qw+IOhnP2zOU7e77b+rzM+wTzXzfi1PrtBCX0E7Pk4wL4iTLnhzZ+JgEGAhX81ebTg/aYjQw==} dependencies: @@ -12141,15 +12033,6 @@ packages: resolution: {integrity: sha512-AqTiAOLcj85xS7vQ8QkAV41hPDIJ71XJB4RCUrzo/1GM2CQwhkJGaf9Hgr7BOugMRpgGUrqRg/DrBDl4H40+8g==} dev: false - /ts-api-utils@1.0.1(typescript@5.1.3): - resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} - engines: {node: '>=16.13.0'} - peerDependencies: - typescript: '>=4.2.0' - dependencies: - typescript: 5.1.3 - dev: true - /ts-api-utils@1.0.1(typescript@5.2.2): resolution: {integrity: sha512-lC/RGlPmwdrIBFTX59wwNzqh7aR2otPNPR/5brHZm/XKFYKsfqxihXUe9pU3JI+3vGkl+vyCoNNnPhJn3aLK1A==} engines: {node: '>=16.13.0'} @@ -12157,7 +12040,6 @@ packages: typescript: '>=4.2.0' dependencies: typescript: 5.2.2 - dev: false /ts-dedent@2.2.0: resolution: {integrity: sha512-q5W7tVM71e2xjHZTlgfTDoPF/SmqKG5hddq9SzR49CH2hayqRKJtQ4mtRlSxKaJlR/+9rEM+mnBHf7I2/BQcpQ==} @@ -12350,6 +12232,11 @@ packages: engines: {node: '>=12.20'} dev: false + /type-fest@3.13.1: + resolution: {integrity: sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g==} + engines: {node: '>=14.16'} + dev: false + /type-is@1.6.18: resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==} engines: {node: '>= 0.6'} @@ -12380,16 +12267,21 @@ packages: resolution: {integrity: sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==} engines: {node: '>=14.17'} hasBin: true + dev: true /typescript@5.2.2: resolution: {integrity: sha512-mI4WrpHsbCIcwT9cF4FZvr80QUeKvsUsUvKDoR+X/7XHQH98xYD8YHZg7ANtz2GtZt/CBq2QJ0thkGJMHfqc1w==} engines: {node: '>=14.17'} hasBin: true - dev: false /ufo@1.3.1: resolution: {integrity: sha512-uY/99gMLIOlJPwATcMVYfqDSxUR9//AUcgZMzwfSTJPDKzA1S8mX4VLqa+fiAtveraQUBCz4FFcwVZBGbwBXIw==} + /uint8array-extras@0.3.0: + resolution: {integrity: sha512-erJsJwQ0tKdwuqI0359U8ijkFmfiTcq25JvvzRVc1VP+2son1NJRXhxcAKJmAW3ajM8JSGAfsAXye8g4s+znxA==} + engines: {node: '>=18'} + dev: false + /uint8arrays@3.1.1: resolution: {integrity: sha512-+QJa8QRnbdXVpHYjLoTpJIdCTiw9Ir62nocClWuXIq2JIh4Uta0cQsTSpFL678p2CN8B+XSApwcU+pQEqVpKWg==} dependencies: @@ -12405,6 +12297,9 @@ packages: which-boxed-primitive: 1.0.2 dev: true + /undici-types@5.26.5: + resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==} + /unicode-canonical-property-names-ecmascript@2.0.0: resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==} engines: {node: '>=4'} @@ -12746,8 +12641,30 @@ packages: - bufferutil - utf-8-validate - zod + dev: true + + /viem@1.2.6(typescript@5.2.2): + resolution: {integrity: sha512-3tWiUb0D8dbFj66rUGLg6TKJjH98ZziomkyCyI0evqJFYdNfiEG0K2Ns07MlOXZZF4sGe+a5Mj15DaDOwm7sgw==} + peerDependencies: + typescript: '>=5.0.4' + dependencies: + '@adraffy/ens-normalize': 1.9.0 + '@noble/curves': 1.0.0 + '@noble/hashes': 1.3.0 + '@scure/bip32': 1.3.0 + '@scure/bip39': 1.2.0 + '@wagmi/chains': 1.2.0(typescript@5.2.2) + abitype: 0.8.11(typescript@5.2.2) + isomorphic-ws: 5.0.0(ws@8.12.0) + typescript: 5.2.2 + ws: 8.12.0 + transitivePeerDependencies: + - bufferutil + - utf-8-validate + - zod + dev: false - /vite-node@0.34.6(@types/node@18.16.18): + /vite-node@0.34.6(@types/node@20.9.0): resolution: {integrity: sha512-nlBMJ9x6n7/Amaz6F3zJ97EBwR2FkzhBRxF5e+jE6LA3yi6Wtc2lyTij1OnDMIr34v5g/tVQtsVAzhT0jc5ygA==} engines: {node: '>=v14.18.0'} hasBin: true @@ -12757,7 +12674,7 @@ packages: mlly: 1.4.2 pathe: 1.1.1 picocolors: 1.0.0 - vite: 4.5.0(@types/node@18.16.18) + vite: 4.5.0(@types/node@20.9.0) transitivePeerDependencies: - '@types/node' - less @@ -12768,7 +12685,7 @@ packages: - supports-color - terser - /vite@4.5.0(@types/node@18.16.18): + /vite@4.5.0(@types/node@20.9.0): resolution: {integrity: sha512-ulr8rNLA6rkyFAlVWw2q5YJ91v098AFQ2R0PRFwPzREXOUJQPtFUG0t+/ZikhaOCDqFoDhN6/v8Sq0o4araFAw==} engines: {node: ^14.18.0 || >=16.0.0} hasBin: true @@ -12796,7 +12713,7 @@ packages: terser: optional: true dependencies: - '@types/node': 18.16.18 + '@types/node': 20.9.0 esbuild: 0.18.20 postcss: 8.4.31 rollup: 3.29.4 @@ -12836,7 +12753,7 @@ packages: dependencies: '@types/chai': 4.3.9 '@types/chai-subset': 1.3.3 - '@types/node': 18.16.18 + '@types/node': 20.9.0 '@vitest/expect': 0.34.6 '@vitest/runner': 0.34.6 '@vitest/snapshot': 0.34.6 @@ -12855,8 +12772,8 @@ packages: strip-literal: 1.0.1 tinybench: 2.5.1 tinypool: 0.7.0 - vite: 4.5.0(@types/node@18.16.18) - vite-node: 0.34.6(@types/node@18.16.18) + vite: 4.5.0(@types/node@20.9.0) + vite-node: 0.34.6(@types/node@20.9.0) why-is-node-running: 2.2.2 transitivePeerDependencies: - less @@ -12955,6 +12872,10 @@ packages: webidl-conversions: 4.0.2 dev: true + /when-exit@2.1.1: + resolution: {integrity: sha512-XLipGldz/UcleuGaoQjbYuWwD+ICRnzIjlldtwTaTWr7aZz8yQW49rXk6MHQnh+KxOiWiJpM1vIyaxprOnlW4g==} + dev: false + /which-boxed-primitive@1.0.2: resolution: {integrity: sha512-bwZdv0AKLpplFY2KZRX6TvyuN7ojjr7lwkg6ml0roIy9YeuSr7JS372qlNW18UQYzgYK9ziGcerWqZOmEn9VNg==} dependencies: From 3b618a7ba2b2f5d0d45e02ddd7257d7258b7d686 Mon Sep 17 00:00:00 2001 From: Kyle Scott Date: Thu, 9 Nov 2023 22:07:24 -0500 Subject: [PATCH 2/6] fully move to esm --- packages/core/package.json | 4 ++-- packages/core/src/config/networks.ts | 9 ++++----- packages/core/src/indexing/service.ts | 9 ++++----- packages/core/src/telemetry/detached-flush.js | 2 +- packages/core/src/utils/chains.test.ts | 8 ++++++++ packages/core/src/utils/chains.ts | 3 +++ 6 files changed, 22 insertions(+), 13 deletions(-) create mode 100644 packages/core/src/utils/chains.test.ts create mode 100644 packages/core/src/utils/chains.ts diff --git a/packages/core/package.json b/packages/core/package.json index 2e9233a2d..78c9a3bda 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -18,11 +18,11 @@ "bin": { "ponder": "./dist/bin/ponder.js" }, - "main": "./dist/index.js", + "module": "./dist/index.js", "types": "./dist/index.d.ts", "typings": "./dist/index.d.ts", "exports": { - "default": "./dist/index.js", + "import": "./dist/index.js", "types": "./dist/index.d.ts" }, "scripts": { diff --git a/packages/core/src/config/networks.ts b/packages/core/src/config/networks.ts index 0500c1282..397c514a4 100644 --- a/packages/core/src/config/networks.ts +++ b/packages/core/src/config/networks.ts @@ -1,9 +1,8 @@ -import * as chains from "@wagmi/chains"; import { type Client, type PublicClient, createPublicClient } from "viem"; -import type { Chain } from "viem/chains"; import type { Config } from "@/config/config.js"; import type { Common } from "@/Ponder.js"; +import { chains } from "@/utils/chains.js"; export type Network = { name: string; @@ -24,9 +23,9 @@ export function buildNetwork({ }) { const { name, chainId, transport } = network; - const defaultChain: Chain = (Object.values(chains).find((c) => - "id" in c ? c.id === chainId : false - ) ?? chains.mainnet) as Chain; + const defaultChain = + Object.values(chains).find((c) => ("id" in c ? c.id === chainId : false)) ?? + chains.mainnet; const client = createPublicClient({ transport, diff --git a/packages/core/src/indexing/service.ts b/packages/core/src/indexing/service.ts index 6f94cec2f..5628a78b7 100644 --- a/packages/core/src/indexing/service.ts +++ b/packages/core/src/indexing/service.ts @@ -1,9 +1,7 @@ import { E_CANCELED, Mutex } from "async-mutex"; import Emittery from "emittery"; import type { Abi, Address, Client } from "viem"; -import type { Chain } from "viem"; import { createClient } from "viem"; -import * as chains from "viem/chains"; import type { IndexingFunctions } from "@/build/functions.js"; import type { LogEventMetadata } from "@/config/abi.js"; @@ -16,6 +14,7 @@ import type { Schema } from "@/schema/types.js"; import type { LogEvent, SyncGateway } from "@/sync-gateway/service.js"; import type { SyncStore } from "@/sync-store/store.js"; import type { Model } from "@/types/model.js"; +import { chains } from "@/utils/chains.js"; import { formatShortDate } from "@/utils/date.js"; import { prettyPrint } from "@/utils/print.js"; import { type Queue, type Worker, createQueue } from "@/utils/queue.js"; @@ -566,9 +565,9 @@ const buildContexts = ( > = {}; networks.forEach((network) => { - const defaultChain: Chain = (Object.values(chains).find((c) => - "id" in c ? c.id === network.chainId : false - ) ?? chains.mainnet) as Chain; + const defaultChain = + Object.values(chains).find((c) => c.id === network.chainId) ?? + chains.mainnet; const client = createClient({ transport: ponderTransport({ transport: network.transport, syncStore }), diff --git a/packages/core/src/telemetry/detached-flush.js b/packages/core/src/telemetry/detached-flush.js index bed487d03..9a97d5c6d 100644 --- a/packages/core/src/telemetry/detached-flush.js +++ b/packages/core/src/telemetry/detached-flush.js @@ -1,4 +1,4 @@ -const fs = require("fs"); +import fs from "node:fs"; async function detachedFlush() { const args = [...process.argv]; diff --git a/packages/core/src/utils/chains.test.ts b/packages/core/src/utils/chains.test.ts new file mode 100644 index 000000000..7de3eb2f0 --- /dev/null +++ b/packages/core/src/utils/chains.test.ts @@ -0,0 +1,8 @@ +import { test } from "vitest"; + +import { chains } from "./chains.js"; + +test("test", () => { + // Will throw on error + Object.values(chains).map((c) => c.id); +}); diff --git a/packages/core/src/utils/chains.ts b/packages/core/src/utils/chains.ts new file mode 100644 index 000000000..640baa2b3 --- /dev/null +++ b/packages/core/src/utils/chains.ts @@ -0,0 +1,3 @@ +import * as _chains from "viem/chains"; + +export const chains = _chains as unknown as Record; From 1db1ad4e9fdb1e77ee4e28082f8a91b7987e651b Mon Sep 17 00:00:00 2001 From: Kyle Scott Date: Thu, 9 Nov 2023 22:21:38 -0500 Subject: [PATCH 3/6] fix bugs with esm --- packages/core/package.json | 2 +- packages/core/src/bin/ponder.ts | 2 +- packages/core/src/config/database.ts | 12 ++++----- pnpm-lock.yaml | 37 +++++++++++++++++++--------- 4 files changed, 33 insertions(+), 20 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 78c9a3bda..9588794d2 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -55,7 +55,7 @@ "kysely": "^0.24.2", "p-limit": "3", "p-queue": "^7.4.1", - "pg": "^8.9.0", + "pg": "^8.11.3", "picocolors": "^1.0.0", "pino": "^8.14.1", "prom-client": "^14.2.0", diff --git a/packages/core/src/bin/ponder.ts b/packages/core/src/bin/ponder.ts index 32d00ae10..48ec2febe 100644 --- a/packages/core/src/bin/ponder.ts +++ b/packages/core/src/bin/ponder.ts @@ -8,7 +8,7 @@ import { Ponder } from "@/Ponder.js"; // NOTE: This is a workaround for tsconfig `rootDir` nonsense. // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore -import packageJson from "../../package.json"; +import packageJson from "../../package.json" assert { type: "json" }; dotenv.config({ path: ".env.local" }); diff --git a/packages/core/src/config/database.ts b/packages/core/src/config/database.ts index 47cb28a26..8b0feb41e 100644 --- a/packages/core/src/config/database.ts +++ b/packages/core/src/config/database.ts @@ -1,6 +1,6 @@ import Sqlite from "better-sqlite3"; import path from "node:path"; -import pg, { Client, DatabaseError, Pool } from "pg"; +import pg from "pg"; import type { Config } from "@/config/config.js"; import { PostgresError } from "@/errors/postgres.js"; @@ -15,7 +15,7 @@ export interface SqliteDb { export interface PostgresDb { kind: "postgres"; - pool: Pool; + pool: pg.Pool; } export type Database = SqliteDb | PostgresDb; @@ -26,10 +26,10 @@ pg.types.setTypeParser(1700, BigInt); // Monkeypatch Pool.query to get more informative stack traces. I have no idea why this works. // https://stackoverflow.com/a/70601114 -const originalClientQuery = Client.prototype.query; +const originalClientQuery = pg.Client.prototype.query; // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-ignore -Client.prototype.query = async function query( +pg.Client.prototype.query = async function query( ...args: [queryText: string, values: any[], callback: () => void] ) { try { @@ -37,7 +37,7 @@ Client.prototype.query = async function query( } catch (error) { const [statement, parameters] = args; - if (error instanceof DatabaseError) { + if (error instanceof pg.DatabaseError) { const parameters_ = parameters ?? []; throw new PostgresError({ statement, @@ -132,7 +132,7 @@ export const buildDatabase = ({ return { kind: "sqlite", db }; } else { - const pool = new Pool({ + const pool = new pg.Pool({ connectionString: resolvedDatabaseConfig.connectionString, }); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 3fad19da0..d3f881b3b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -374,8 +374,8 @@ importers: specifier: ^7.4.1 version: 7.4.1 pg: - specifier: ^8.9.0 - version: 8.9.0 + specifier: ^8.11.3 + version: 8.11.3 picocolors: specifier: ^1.0.0 version: 1.0.0 @@ -10154,20 +10154,26 @@ packages: is-reference: 3.0.1 dev: false - /pg-connection-string@2.5.0: - resolution: {integrity: sha512-r5o/V/ORTA6TmUnyWZR9nCj1klXCO2CEKNRlVuJptZe85QuhFayC7WeMic7ndayT5IRIR0S0xFxFi2ousartlQ==} + /pg-cloudflare@1.1.1: + resolution: {integrity: sha512-xWPagP/4B6BgFO+EKz3JONXv3YDgvkbVrGw2mTo3D6tVDQRh1e7cqVGvyR3BE+eQgAvx1XhW/iEASj4/jCWl3Q==} + requiresBuild: true + dev: false + optional: true + + /pg-connection-string@2.6.2: + resolution: {integrity: sha512-ch6OwaeaPYcova4kKZ15sbJ2hKb/VP48ZD2gE7i1J+L4MspCtBMAx8nMgz7bksc7IojCIIWuEhHibSMFH8m8oA==} dev: false /pg-int8@1.0.1: resolution: {integrity: sha512-WCtabS6t3c8SkpDBUlb1kjOs7l66xsGdKpIPZsg4wR+B3+u9UAum2odSsF9tnvxg80h4ZxLWMy4pRjOsFIqQpw==} engines: {node: '>=4.0.0'} - /pg-pool@3.5.2(pg@8.9.0): - resolution: {integrity: sha512-His3Fh17Z4eg7oANLob6ZvH8xIVen3phEZh2QuyrIl4dQSDVEabNducv6ysROKpDNPSD+12tONZVWfSgMvDD9w==} + /pg-pool@3.6.1(pg@8.11.3): + resolution: {integrity: sha512-jizsIzhkIitxCGfPRzJn1ZdcosIt3pz9Sh3V01fm1vZnbnCMgmGl5wvGGdNN2EL9Rmb0EcFoCkixH4Pu+sP9Og==} peerDependencies: pg: '>=8.0' dependencies: - pg: 8.9.0 + pg: 8.11.3 dev: false /pg-protocol@1.6.0: @@ -10183,8 +10189,8 @@ packages: postgres-date: 1.0.7 postgres-interval: 1.2.0 - /pg@8.9.0: - resolution: {integrity: sha512-ZJM+qkEbtOHRuXjmvBtOgNOXOtLSbxiMiUVMgE4rV6Zwocy03RicCVvDXgx8l4Biwo8/qORUnEqn2fdQzV7KCg==} + /pg@8.11.3: + resolution: {integrity: sha512-+9iuvG8QfaaUrrph+kpF24cXkH1YOOUeArRNYIxq1viYHZagBxrTno7cecY1Fa44tJeZvaoG+Djpkc3JwehN5g==} engines: {node: '>= 8.0.0'} peerDependencies: pg-native: '>=3.0.1' @@ -10194,17 +10200,19 @@ packages: dependencies: buffer-writer: 2.0.0 packet-reader: 1.0.0 - pg-connection-string: 2.5.0 - pg-pool: 3.5.2(pg@8.9.0) + pg-connection-string: 2.6.2 + pg-pool: 3.6.1(pg@8.11.3) pg-protocol: 1.6.0 pg-types: 2.2.0 pgpass: 1.0.5 + optionalDependencies: + pg-cloudflare: 1.1.1 dev: false /pgpass@1.0.5: resolution: {integrity: sha512-FdW9r/jQZhSeohs1Z3sI1yxFQNFvMcnmfuj4WBMUTxOrAyLMaTcE1aAMBiTlbMNaXvBCQuVi0R7hd8udDSP7ug==} dependencies: - split2: 4.1.0 + split2: 4.2.0 dev: false /picocolors@1.0.0: @@ -11424,6 +11432,11 @@ packages: engines: {node: '>= 10.x'} dev: false + /split2@4.2.0: + resolution: {integrity: sha512-UcjcJOWknrNkF6PLX83qcHM6KHgVKNkV62Y8a5uYDVv9ydGQVwAHMKqHdJje1VTWpljG0WYpCDhrCdAOYH4TWg==} + engines: {node: '>= 10.x'} + dev: false + /sprintf-js@1.0.3: resolution: {integrity: sha512-D9cPgkvLlV3t3IzL0D0YLvGA9Ahk4PcvVwUbN0dSGr1aP0Nrt4AEnTUbuGvquEC0mA64Gqt1fzirlRs5ibXx8g==} From 8f8d113fb2b634dcf3f415a5f5a6be5373c851dd Mon Sep 17 00:00:00 2001 From: Kyle Scott Date: Thu, 9 Nov 2023 22:38:51 -0500 Subject: [PATCH 4/6] tsconfig --- packages/core/tsconfig.base.json | 2 +- packages/core/tsconfig.build.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/tsconfig.base.json b/packages/core/tsconfig.base.json index 23f4c5f53..f5289be6b 100644 --- a/packages/core/tsconfig.base.json +++ b/packages/core/tsconfig.base.json @@ -21,7 +21,7 @@ "checkJs": false, "jsx": "react", - // Interop constraints. These will remain loose until we start emitting ESM. + // Interop constraints "verbatimModuleSyntax": true, "esModuleInterop": true, "allowSyntheticDefaultImports": true, diff --git a/packages/core/tsconfig.build.json b/packages/core/tsconfig.build.json index baffa6734..d151a7eb4 100644 --- a/packages/core/tsconfig.build.json +++ b/packages/core/tsconfig.build.json @@ -4,7 +4,6 @@ "include": ["src"], "exclude": ["src/_test", "src/**/*.test.ts"], "compilerOptions": { - "module": "NodeNext", "sourceMap": true, "declaration": true, "declarationMap": true, From a4f80859787c3db000f2d8606666290758118e0b Mon Sep 17 00:00:00 2001 From: Kyle Scott Date: Fri, 10 Nov 2023 10:06:37 -0500 Subject: [PATCH 5/6] fix lint --- .eslintrc | 5 ++++- docs/pages/api/telemetry/index.ts | 5 +++-- packages/create-ponder/src/bin/create-ponder.ts | 3 ++- packages/create-ponder/src/index.ts | 3 ++- packages/eslint-config-ponder/index.js | 1 + 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/.eslintrc b/.eslintrc index f215c9658..a50e50014 100644 --- a/.eslintrc +++ b/.eslintrc @@ -17,7 +17,10 @@ "import/newline-after-import": "error", "@typescript-eslint/consistent-type-imports": [ "error", - { "prefer": "type-imports" } + { + "prefer": "type-imports", + "disallowTypeAnnotations": false + } ], "@typescript-eslint/no-var-requires": "off", "@typescript-eslint/no-explicit-any": "off", diff --git a/docs/pages/api/telemetry/index.ts b/docs/pages/api/telemetry/index.ts index f929671de..970169b5b 100644 --- a/docs/pages/api/telemetry/index.ts +++ b/docs/pages/api/telemetry/index.ts @@ -1,5 +1,6 @@ -import { Analytics, TrackParams } from "@segment/analytics-node"; -import { NextApiRequest, NextApiResponse } from "next"; +import type { TrackParams } from "@segment/analytics-node"; +import { Analytics } from "@segment/analytics-node"; +import type { NextApiRequest, NextApiResponse } from "next"; if (!process.env.SEGMENT_WRITE_KEY) { throw new Error('Missing required environment variable "SEGMENT_WRITE_KEY".'); diff --git a/packages/create-ponder/src/bin/create-ponder.ts b/packages/create-ponder/src/bin/create-ponder.ts index c447f1944..b13dfb1fb 100644 --- a/packages/create-ponder/src/bin/create-ponder.ts +++ b/packages/create-ponder/src/bin/create-ponder.ts @@ -3,7 +3,8 @@ import { cac } from "cac"; import path from "node:path"; import prompts from "prompts"; -import { CreatePonderOptions, Template, TemplateKind } from "@/common"; +import type { CreatePonderOptions, Template } from "@/common"; +import { TemplateKind } from "@/common"; import { run } from "@/index"; // NOTE: This is a workaround for tsconfig `rootDir` nonsense. diff --git a/packages/create-ponder/src/index.ts b/packages/create-ponder/src/index.ts index 885cb15dd..fb75e955b 100644 --- a/packages/create-ponder/src/index.ts +++ b/packages/create-ponder/src/index.ts @@ -5,7 +5,8 @@ import path from "node:path"; import pico from "picocolors"; import prettier from "prettier"; -import { CreatePonderOptions, TemplateKind } from "@/common"; +import type { CreatePonderOptions } from "@/common"; +import { TemplateKind } from "@/common"; import { getPackageManager } from "@/helpers/getPackageManager"; import { tryGitInit } from "@/helpers/git"; import { fromBasic } from "@/templates/basic"; diff --git a/packages/eslint-config-ponder/index.js b/packages/eslint-config-ponder/index.js index 99e538512..883a09b39 100644 --- a/packages/eslint-config-ponder/index.js +++ b/packages/eslint-config-ponder/index.js @@ -8,4 +8,5 @@ module.exports = { rules: { "@typescript-eslint/no-floating-promises": "error", }, + // ignorePatterns: ["**/ponder-env.d.ts"], }; From 2bce055dd5be9926569d25e3ec7f96191edd7f23 Mon Sep 17 00:00:00 2001 From: Kyle Scott Date: Fri, 10 Nov 2023 10:07:42 -0500 Subject: [PATCH 6/6] Cleanup --- packages/eslint-config-ponder/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/eslint-config-ponder/index.js b/packages/eslint-config-ponder/index.js index 883a09b39..99e538512 100644 --- a/packages/eslint-config-ponder/index.js +++ b/packages/eslint-config-ponder/index.js @@ -8,5 +8,4 @@ module.exports = { rules: { "@typescript-eslint/no-floating-promises": "error", }, - // ignorePatterns: ["**/ponder-env.d.ts"], };