@bunary/core 0.0.3 → 0.0.4
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/config.d.ts +19 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +18 -1
- package/dist/types.d.ts +21 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +9 -1
package/dist/config.d.ts
CHANGED
|
@@ -11,8 +11,27 @@ import type { BunaryConfig } from "./types";
|
|
|
11
11
|
* name: "MyApp",
|
|
12
12
|
* env: "development",
|
|
13
13
|
* },
|
|
14
|
+
* orm: {
|
|
15
|
+
* database: {
|
|
16
|
+
* type: "sqlite",
|
|
17
|
+
* sqlite: { path: "./database.sqlite" }
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
14
20
|
* });
|
|
15
21
|
* ```
|
|
16
22
|
*/
|
|
17
23
|
export declare function defineConfig(config: BunaryConfig): BunaryConfig;
|
|
24
|
+
/**
|
|
25
|
+
* Get the global Bunary configuration
|
|
26
|
+
*
|
|
27
|
+
* @returns The current Bunary configuration
|
|
28
|
+
* @throws If configuration has not been set
|
|
29
|
+
*/
|
|
30
|
+
export declare function getBunaryConfig(): BunaryConfig;
|
|
31
|
+
/**
|
|
32
|
+
* Clear the global Bunary configuration (useful for testing)
|
|
33
|
+
*
|
|
34
|
+
* @internal
|
|
35
|
+
*/
|
|
36
|
+
export declare function clearBunaryConfig(): void;
|
|
18
37
|
//# sourceMappingURL=config.d.ts.map
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAI5C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAmB/D;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAK9C;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAExC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* @bunary/core
|
|
3
3
|
* Foundation module for Bunary - config, environment, and app helpers
|
|
4
4
|
*/
|
|
5
|
-
export { defineConfig } from "./config";
|
|
5
|
+
export { defineConfig, getBunaryConfig, clearBunaryConfig } from "./config";
|
|
6
6
|
export { Environment, type EnvironmentType } from "./constants";
|
|
7
7
|
export { env, isDev, isProd, isTest } from "./environment";
|
|
8
|
-
export type { BunaryConfig, AppConfig } from "./types";
|
|
8
|
+
export type { BunaryConfig, AppConfig, OrmConfig } from "./types";
|
|
9
9
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAC5E,OAAO,EAAE,WAAW,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAChE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC3D,YAAY,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,14 +7,29 @@ var Environment = {
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
// src/config.ts
|
|
10
|
+
var globalBunaryConfig = null;
|
|
10
11
|
function defineConfig(config) {
|
|
11
|
-
|
|
12
|
+
const validated = {
|
|
12
13
|
app: {
|
|
13
14
|
name: config.app.name,
|
|
14
15
|
env: config.app.env ?? Bun.env.NODE_ENV ?? Environment.DEVELOPMENT,
|
|
15
16
|
debug: config.app.debug ?? Bun.env.DEBUG === "true"
|
|
16
17
|
}
|
|
17
18
|
};
|
|
19
|
+
if (config.orm) {
|
|
20
|
+
validated.orm = config.orm;
|
|
21
|
+
}
|
|
22
|
+
globalBunaryConfig = validated;
|
|
23
|
+
return validated;
|
|
24
|
+
}
|
|
25
|
+
function getBunaryConfig() {
|
|
26
|
+
if (!globalBunaryConfig) {
|
|
27
|
+
throw new Error("Bunary configuration not set. Call defineConfig() first.");
|
|
28
|
+
}
|
|
29
|
+
return globalBunaryConfig;
|
|
30
|
+
}
|
|
31
|
+
function clearBunaryConfig() {
|
|
32
|
+
globalBunaryConfig = null;
|
|
18
33
|
}
|
|
19
34
|
// src/environment.ts
|
|
20
35
|
function env(key, defaultValue) {
|
|
@@ -44,7 +59,9 @@ export {
|
|
|
44
59
|
isTest,
|
|
45
60
|
isProd,
|
|
46
61
|
isDev,
|
|
62
|
+
getBunaryConfig,
|
|
47
63
|
env,
|
|
48
64
|
defineConfig,
|
|
65
|
+
clearBunaryConfig,
|
|
49
66
|
Environment
|
|
50
67
|
};
|
package/dist/types.d.ts
CHANGED
|
@@ -10,10 +10,31 @@ export interface AppConfig {
|
|
|
10
10
|
/** Debug mode */
|
|
11
11
|
debug?: boolean;
|
|
12
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* ORM configuration type (matches @bunary/orm OrmConfig)
|
|
15
|
+
* Defined here to avoid circular dependency
|
|
16
|
+
*/
|
|
17
|
+
export interface OrmConfig {
|
|
18
|
+
database: {
|
|
19
|
+
type: "sqlite" | "mysql" | "postgres";
|
|
20
|
+
sqlite?: {
|
|
21
|
+
path: string;
|
|
22
|
+
};
|
|
23
|
+
mysql?: {
|
|
24
|
+
host: string;
|
|
25
|
+
port?: number;
|
|
26
|
+
user: string;
|
|
27
|
+
password: string;
|
|
28
|
+
database: string;
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
}
|
|
13
32
|
/**
|
|
14
33
|
* Root Bunary configuration
|
|
15
34
|
*/
|
|
16
35
|
export interface BunaryConfig {
|
|
17
36
|
app: AppConfig;
|
|
37
|
+
/** Optional ORM configuration (from @bunary/orm) */
|
|
38
|
+
orm?: OrmConfig;
|
|
18
39
|
}
|
|
19
40
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,iBAAiB;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,uBAAuB;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,iDAAiD;IACjD,GAAG,CAAC,EAAE,eAAe,CAAC;IACtB,iBAAiB;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;GAGG;AACH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE;QACR,IAAI,EAAE,QAAQ,GAAG,OAAO,GAAG,UAAU,CAAC;QACtC,MAAM,CAAC,EAAE;YACP,IAAI,EAAE,MAAM,CAAC;SACd,CAAC;QACF,KAAK,CAAC,EAAE;YACN,IAAI,EAAE,MAAM,CAAC;YACb,IAAI,CAAC,EAAE,MAAM,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;YACb,QAAQ,EAAE,MAAM,CAAC;YACjB,QAAQ,EAAE,MAAM,CAAC;SAClB,CAAC;KACH,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,GAAG,EAAE,SAAS,CAAC;IACf,oDAAoD;IACpD,GAAG,CAAC,EAAE,SAAS,CAAC;CACjB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bunary/core",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "Foundation module for Bunary - config, environment, and app helpers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,6 +30,14 @@
|
|
|
30
30
|
],
|
|
31
31
|
"author": "Paul Radford",
|
|
32
32
|
"license": "MIT",
|
|
33
|
+
"repository": {
|
|
34
|
+
"type": "git",
|
|
35
|
+
"url": "https://github.com/bunary-dev/core.git"
|
|
36
|
+
},
|
|
37
|
+
"homepage": "https://github.com/bunary-dev/core#readme",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/bunary-dev/core/issues"
|
|
40
|
+
},
|
|
33
41
|
"engines": {
|
|
34
42
|
"bun": ">=1.0.0"
|
|
35
43
|
},
|