apibara 2.0.0-beta.6 → 2.0.0-beta.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  import { createApibara, prepare, writeTypes, build as build$1 } from 'apibara/core';
2
2
  import { defineCommand } from 'citty';
3
- import consola from 'consola';
3
+ import consola__default from 'consola';
4
4
  import { resolve } from 'pathe';
5
5
  import { c as commonArgs } from '../shared/apibara.1b515d04.mjs';
6
6
 
@@ -13,7 +13,7 @@ const build = defineCommand({
13
13
  ...commonArgs
14
14
  },
15
15
  async run({ args }) {
16
- consola.start("Building");
16
+ consola__default.start("Building");
17
17
  const rootDir = resolve(args.dir || args._dir || ".");
18
18
  const apibara = await createApibara({
19
19
  rootDir
@@ -1,7 +1,7 @@
1
1
  import { spawn } from 'node:child_process';
2
2
  import { createApibara, prepare, writeTypes, build } from 'apibara/core';
3
3
  import { defineCommand } from 'citty';
4
- import consola from 'consola';
4
+ import consola__default from 'consola';
5
5
  import { resolve } from 'pathe';
6
6
  import { c as commonArgs } from '../shared/apibara.1b515d04.mjs';
7
7
 
@@ -28,12 +28,12 @@ const dev = defineCommand({
28
28
  }
29
29
  },
30
30
  async run({ args }) {
31
- consola.start("Starting dev server");
31
+ consola__default.start("Starting dev server");
32
32
  const rootDir = resolve(args.dir || args._dir || ".");
33
33
  let apibara;
34
34
  const reload = async () => {
35
35
  if (apibara) {
36
- consola.info("Restarting dev server");
36
+ consola__default.info("Restarting dev server");
37
37
  if ("unwatch" in apibara.options._c12) {
38
38
  await apibara.options._c12.unwatch();
39
39
  }
@@ -51,7 +51,7 @@ const dev = defineCommand({
51
51
  if (diff.length === 0) {
52
52
  return;
53
53
  }
54
- consola.info(
54
+ consola__default.info(
55
55
  `Nitro config updated:
56
56
  ${diff.map((entry) => ` ${entry.toString()}`).join("\n")}`
57
57
  );
@@ -67,11 +67,11 @@ const dev = defineCommand({
67
67
  await build(apibara);
68
68
  apibara.hooks.hook("dev:reload", () => {
69
69
  if (childProcess) {
70
- consola.start("Restarting indexers");
70
+ consola__default.start("Restarting indexers");
71
71
  childProcess.kill();
72
72
  } else {
73
- consola.success("Dev server started");
74
- consola.success("Starting indexers");
73
+ consola__default.success("Dev server started");
74
+ consola__default.success("Starting indexers");
75
75
  }
76
76
  const childArgs = [
77
77
  resolve(apibara.options.outputDir || "./.apibara/build", "main.mjs"),
@@ -79,12 +79,12 @@ const dev = defineCommand({
79
79
  ...args.preset ? ["--preset", args.preset] : [],
80
80
  ...args.sink ? ["--sink", args.sink] : []
81
81
  ];
82
- childProcess = spawn("jiti", childArgs, {
82
+ childProcess = spawn("node", childArgs, {
83
83
  stdio: "inherit"
84
84
  });
85
85
  childProcess.on("close", (code) => {
86
86
  if (code !== null) {
87
- consola.log(`Indexers process exited with code ${code}`);
87
+ consola__default.log(`Indexers process exited with code ${code}`);
88
88
  }
89
89
  });
90
90
  });
@@ -1,6 +1,6 @@
1
1
  import { createApibara, writeTypes } from 'apibara/core';
2
2
  import { defineCommand } from 'citty';
3
- import consola from 'consola';
3
+ import consola__default from 'consola';
4
4
  import { resolve } from 'pathe';
5
5
  import { c as commonArgs } from '../shared/apibara.1b515d04.mjs';
6
6
 
@@ -13,7 +13,7 @@ const prepare = defineCommand({
13
13
  ...commonArgs
14
14
  },
15
15
  async run({ args }) {
16
- consola.start("Preparing Types");
16
+ consola__default.start("Preparing Types");
17
17
  const rootDir = resolve(args.dir || ".");
18
18
  const apibara = await createApibara({ rootDir });
19
19
  await writeTypes(apibara);
@@ -1,4 +1,4 @@
1
- import consola from 'consola';
1
+ import consola__default from 'consola';
2
2
  import { createHooks } from 'hookable';
3
3
  import { watchConfig, loadConfig } from 'c12';
4
4
  import { klona } from 'klona/full';
@@ -85,7 +85,7 @@ async function _loadUserConfig(configOverrides = {}, opts = {}, dev = false) {
85
85
 
86
86
  async function updateApibaraConfig(apibara, config) {
87
87
  await apibara.hooks.callHook("rollup:reload");
88
- consola.success("Apibara config hot reloaded!");
88
+ consola__default.success("Apibara config hot reloaded!");
89
89
  }
90
90
 
91
91
  async function createApibara(config = {}, opts = {}, dev = false) {
@@ -94,7 +94,7 @@ async function createApibara(config = {}, opts = {}, dev = false) {
94
94
  options,
95
95
  hooks: createHooks(),
96
96
  close: () => apibara.hooks.callHook("close"),
97
- logger: consola.withTag("apibara"),
97
+ logger: consola__default.withTag("apibara"),
98
98
  async updateConfig(config2) {
99
99
  updateApibaraConfig(apibara);
100
100
  }
@@ -200,7 +200,7 @@ async function buildProduction(apibara, rollupConfig) {
200
200
  throw new Error("No output options specified in Rollup config");
201
201
  }
202
202
  await bundle.close();
203
- consola.success("Build completed successfully!");
203
+ consola__default.success("Build completed successfully!");
204
204
  } catch (error) {
205
205
  console.error("Build failed:", error);
206
206
  throw error;
@@ -216,7 +216,7 @@ async function build(apibara) {
216
216
  async function prepare(apibara) {
217
217
  await prepareDir(apibara.options.buildDir);
218
218
  await prepareDir(apibara.options.outputDir);
219
- consola.success("Output directory cleaned");
219
+ consola__default.success("Output directory cleaned");
220
220
  }
221
221
  async function prepareDir(dir) {
222
222
  await fsp.mkdir(dir, { recursive: true });
@@ -334,7 +334,7 @@ declare module "apibara/types" {`,
334
334
  await fsp.writeFile(_file, file.contents);
335
335
  })
336
336
  );
337
- consola.success("Types generated");
337
+ consola__default.success("Types generated");
338
338
  }
339
339
  const RELATIVE_RE = /^\.{1,2}\//;
340
340
  function relativeWithDot(from, to) {
@@ -0,0 +1 @@
1
+ export * from 'citty';
@@ -0,0 +1 @@
1
+ export * from 'citty';
@@ -0,0 +1 @@
1
+ export * from 'citty';
@@ -0,0 +1,2 @@
1
+ export * from 'consola';
2
+ import 'citty';
@@ -0,0 +1,2 @@
1
+ export * from 'consola';
2
+ import 'citty';
@@ -0,0 +1 @@
1
+ export * from 'consola';
@@ -40,10 +40,12 @@ const getRollupConfig = (apibara, dev = false) => {
40
40
  const mainContent = `
41
41
  import { createClient } from "@apibara/protocol";
42
42
  import { createIndexer, run } from "@apibara/indexer";
43
- import consola from "consola";
44
- import { defineCommand, runMain } from "citty";
43
+ import { consola as _consola } from "apibara/internal/consola";
44
+ import { defineCommand, runMain } from "apibara/internal/citty";
45
45
  import config from './${configPath}';
46
46
 
47
+ const consola = _consola.withTag("Apibara | ");
48
+
47
49
  ${indexerImports}
48
50
 
49
51
  const indexers = {
@@ -177,8 +179,7 @@ runMain(command);
177
179
  "@apibara/protocol",
178
180
  "@apibara/evm",
179
181
  "@apibara/starknet",
180
- "@apibara/beaconchain",
181
- "@apibara/cli"
182
+ "@apibara/beaconchain"
182
183
  ]
183
184
  };
184
185
  };
package/package.json CHANGED
@@ -1,8 +1,7 @@
1
1
  {
2
2
  "name": "apibara",
3
- "version": "2.0.0-beta.6",
3
+ "version": "2.0.0-beta.8",
4
4
  "type": "module",
5
- "source": "./src/core/index.ts",
6
5
  "main": "./dist/core/index.mjs",
7
6
  "exports": {
8
7
  ".": {
@@ -32,6 +31,14 @@
32
31
  "./hooks": {
33
32
  "types": "./dist/hooks/index.d.ts",
34
33
  "import": "./dist/hooks/index.mjs"
34
+ },
35
+ "./internal/consola": {
36
+ "import": "./dist/internal/consola/index.mjs",
37
+ "types": "./dist/internal/consola/index.d.ts"
38
+ },
39
+ "./internal/citty": {
40
+ "import": "./dist/internal/citty/index.mjs",
41
+ "types": "./dist/internal/citty/index.d.ts"
35
42
  }
36
43
  },
37
44
  "bin": {
@@ -64,10 +71,10 @@
64
71
  "vitest": "^1.6.0"
65
72
  },
66
73
  "dependencies": {
67
- "@apibara/evm": "2.0.0-beta.6",
68
- "@apibara/indexer": "2.0.0-beta.6",
69
- "@apibara/protocol": "2.0.0-beta.6",
70
- "@apibara/starknet": "2.0.0-beta.6",
74
+ "@apibara/evm": "2.0.1-beta.0",
75
+ "@apibara/indexer": "2.0.0-beta.8",
76
+ "@apibara/protocol": "2.0.0-beta.8",
77
+ "@apibara/starknet": "2.0.0-beta.8",
71
78
  "@rollup/plugin-commonjs": "^26.0.1",
72
79
  "@rollup/plugin-json": "^6.1.0",
73
80
  "@rollup/plugin-node-resolve": "^15.2.3",
@@ -93,7 +93,7 @@ export default defineCommand({
93
93
  ...(args.sink ? ["--sink", args.sink] : []),
94
94
  ];
95
95
 
96
- childProcess = spawn("jiti", childArgs, {
96
+ childProcess = spawn("node", childArgs, {
97
97
  stdio: "inherit",
98
98
  });
99
99
 
@@ -0,0 +1 @@
1
+ export * from "citty";
@@ -0,0 +1 @@
1
+ export * from "consola";
@@ -57,10 +57,12 @@ export const getRollupConfig = (
57
57
  const mainContent = `
58
58
  import { createClient } from "@apibara/protocol";
59
59
  import { createIndexer, run } from "@apibara/indexer";
60
- import consola from "consola";
61
- import { defineCommand, runMain } from "citty";
60
+ import { consola as _consola } from "apibara/internal/consola";
61
+ import { defineCommand, runMain } from "apibara/internal/citty";
62
62
  import config from './${configPath}';
63
63
 
64
+ const consola = _consola.withTag("Apibara | ");
65
+
64
66
  ${indexerImports}
65
67
 
66
68
  const indexers = {
@@ -202,7 +204,6 @@ runMain(command);
202
204
  "@apibara/evm",
203
205
  "@apibara/starknet",
204
206
  "@apibara/beaconchain",
205
- "@apibara/cli",
206
207
  ],
207
208
  };
208
209
  };