apibara 2.1.0-beta.30 → 2.1.0-beta.31
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunks/add.mjs +1 -0
- package/dist/chunks/add.mjs.map +1 -0
- package/dist/chunks/build.mjs +1 -0
- package/dist/chunks/build.mjs.map +1 -0
- package/dist/chunks/dev.mjs +14 -9
- package/dist/chunks/dev.mjs.map +1 -0
- package/dist/chunks/init.mjs +1 -0
- package/dist/chunks/init.mjs.map +1 -0
- package/dist/chunks/prepare.mjs +1 -0
- package/dist/chunks/prepare.mjs.map +1 -0
- package/dist/chunks/start.mjs +3 -8
- package/dist/chunks/start.mjs.map +1 -0
- package/dist/chunks/write-project-info.mjs +1 -0
- package/dist/chunks/write-project-info.mjs.map +1 -0
- package/dist/cli/index.mjs +1 -0
- package/dist/cli/index.mjs.map +1 -0
- package/dist/common/index.d.mts +28 -0
- package/dist/common/index.d.ts +28 -0
- package/dist/common/index.mjs +64 -0
- package/dist/common/index.mjs.map +1 -0
- package/dist/config/index.mjs +1 -0
- package/dist/config/index.mjs.map +1 -0
- package/dist/core/index.mjs +41 -6
- package/dist/core/index.mjs.map +1 -0
- package/dist/create/index.mjs +3 -4
- package/dist/create/index.mjs.map +1 -0
- package/dist/hooks/index.mjs +6 -1
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/indexer/index.d.ts +1 -0
- package/dist/indexer/index.mjs +1 -0
- package/dist/indexer/plugins.d.ts +1 -0
- package/dist/indexer/plugins.mjs +1 -0
- package/dist/indexer/testing.d.ts +1 -0
- package/dist/indexer/testing.mjs +1 -0
- package/dist/indexer/vcr.d.ts +1 -0
- package/dist/indexer/vcr.mjs +1 -0
- package/dist/rolldown/index.mjs +1 -38
- package/dist/rolldown/index.mjs.map +1 -0
- package/dist/runtime/dev.mjs +10 -7
- package/dist/runtime/internal/app.d.ts +11 -1
- package/dist/runtime/internal/app.mjs +12 -13
- package/dist/runtime/project-info.mjs +17 -3
- package/dist/runtime/start.mjs +10 -7
- package/dist/shared/apibara.63c9a277.mjs +1 -0
- package/dist/shared/apibara.63c9a277.mjs.map +1 -0
- package/dist/shared/apibara.730bb1e4.mjs +1 -0
- package/dist/shared/apibara.730bb1e4.mjs.map +1 -0
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/index.mjs +1 -0
- package/dist/types/index.mjs.map +1 -0
- package/package.json +24 -4
- package/src/cli/commands/dev.ts +10 -9
- package/src/cli/commands/start.ts +2 -8
- package/src/common/constants.ts +6 -0
- package/src/common/helper.ts +86 -0
- package/src/common/index.ts +2 -0
- package/src/core/apibara.ts +2 -2
- package/src/core/build/dev.ts +2 -0
- package/src/core/config/loader.ts +3 -1
- package/src/core/config/resolvers/runtime.resolver.ts +44 -0
- package/src/core/config/update.ts +6 -2
- package/src/create/constants.ts +0 -1
- package/src/create/templates.ts +2 -3
- package/src/hooks/useRuntimeConfig.ts +4 -1
- package/src/indexer/index.ts +1 -0
- package/src/indexer/plugins.ts +1 -0
- package/src/indexer/testing.ts +1 -0
- package/src/indexer/vcr.ts +1 -0
- package/src/rolldown/config.ts +0 -27
- package/src/runtime/dev.ts +10 -6
- package/src/runtime/internal/app.ts +19 -14
- package/src/runtime/project-info.ts +21 -3
- package/src/runtime/start.ts +10 -6
- package/src/types/config.ts +4 -1
- package/dist/runtime/internal/helper.d.ts +0 -12
- package/dist/runtime/internal/helper.mjs +0 -33
- package/src/core/config/resolvers/preset.resolver.ts +0 -12
- package/src/rolldown/plugins/config.ts +0 -17
- package/src/runtime/internal/helper.ts +0 -55
- package/src/types/virtual/config.d.ts +0 -6
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import defu from "defu";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Get the merged runtime config from the process.env.APIBARA_RUNTIME_CONFIG, presets and defaults.
|
|
5
|
-
* Priority (Highest to lowest):
|
|
6
|
-
* 1. process.env.APIBARA_RUNTIME_CONFIG
|
|
7
|
-
* 2. Preset
|
|
8
|
-
* 3. Defaults
|
|
9
|
-
*/
|
|
10
|
-
export function getProcessedRuntimeConfig({
|
|
11
|
-
preset,
|
|
12
|
-
presets,
|
|
13
|
-
runtimeConfig,
|
|
14
|
-
}: {
|
|
15
|
-
preset?: string;
|
|
16
|
-
presets?: Record<string, unknown>;
|
|
17
|
-
runtimeConfig?: Record<string, unknown>;
|
|
18
|
-
}) {
|
|
19
|
-
let _runtimeConfig: Record<string, unknown> = { ...runtimeConfig };
|
|
20
|
-
const envRuntimeConfig = process.env.APIBARA_RUNTIME_CONFIG;
|
|
21
|
-
|
|
22
|
-
if (preset) {
|
|
23
|
-
if (presets === undefined) {
|
|
24
|
-
throw new Error(
|
|
25
|
-
`Specified preset "${preset}" but no presets were defined`,
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (presets[preset] === undefined) {
|
|
30
|
-
throw new Error(`Specified preset "${preset}" but it was not defined`);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const presetValue = presets[preset] as {
|
|
34
|
-
runtimeConfig: Record<string, unknown>;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
// Preset applied
|
|
38
|
-
_runtimeConfig = defu(presetValue.runtimeConfig, _runtimeConfig);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (envRuntimeConfig) {
|
|
42
|
-
try {
|
|
43
|
-
// Environment runtime config applied
|
|
44
|
-
const envRuntimeConfigValue = JSON.parse(envRuntimeConfig);
|
|
45
|
-
_runtimeConfig = defu(envRuntimeConfigValue, _runtimeConfig);
|
|
46
|
-
} catch (error) {
|
|
47
|
-
throw new Error(
|
|
48
|
-
"Failed to parse runtime config from process.env.APIBARA_RUNTIME_CONFIG. Please ensure it is a valid JSON string.",
|
|
49
|
-
{ cause: error },
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
return _runtimeConfig;
|
|
55
|
-
}
|