@bunary/core 0.0.3 → 0.0.5

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 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
@@ -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;AAE5C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CAW/D"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAU5C;;;;;;;;;;;;;;;;;;;;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
@@ -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;AACxC,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,MAAM,SAAS,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,32 @@ var Environment = {
7
7
  };
8
8
 
9
9
  // src/config.ts
10
+ var globalBunaryConfig = null;
11
+ globalThis.__bunaryCoreConfig = {
12
+ getConfig: () => globalBunaryConfig
13
+ };
10
14
  function defineConfig(config) {
11
- return {
15
+ const validated = {
12
16
  app: {
13
17
  name: config.app.name,
14
18
  env: config.app.env ?? Bun.env.NODE_ENV ?? Environment.DEVELOPMENT,
15
19
  debug: config.app.debug ?? Bun.env.DEBUG === "true"
16
20
  }
17
21
  };
22
+ if (config.orm) {
23
+ validated.orm = config.orm;
24
+ }
25
+ globalBunaryConfig = validated;
26
+ return validated;
27
+ }
28
+ function getBunaryConfig() {
29
+ if (!globalBunaryConfig) {
30
+ throw new Error("Bunary configuration not set. Call defineConfig() first.");
31
+ }
32
+ return globalBunaryConfig;
33
+ }
34
+ function clearBunaryConfig() {
35
+ globalBunaryConfig = null;
18
36
  }
19
37
  // src/environment.ts
20
38
  function env(key, defaultValue) {
@@ -44,7 +62,9 @@ export {
44
62
  isTest,
45
63
  isProd,
46
64
  isDev,
65
+ getBunaryConfig,
47
66
  env,
48
67
  defineConfig,
68
+ clearBunaryConfig,
49
69
  Environment
50
70
  };
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
@@ -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;CAChB"}
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",
3
+ "version": "0.0.5",
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
  },