@companion-surface/base 0.1.5 → 0.2.0

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.2.0](https://github.com/bitfocus/companion-surface-api/compare/companion-surface-base-v0.1.5...companion-surface-base-v0.2.0) (2025-10-23)
4
+
5
+
6
+ ### Features
7
+
8
+ * expose logging utils ([1b12ae0](https://github.com/bitfocus/companion-surface-api/commit/1b12ae0dcd9f70da47d643c7881b3c02d4e5a5d6))
9
+
3
10
  ## [0.1.5](https://github.com/bitfocus/companion-surface-api/compare/companion-surface-base-v0.1.4...companion-surface-base-v0.1.5) (2025-10-21)
4
11
 
5
12
 
@@ -0,0 +1,21 @@
1
+ declare global {
2
+ /**
3
+ * INTERNAL USE ONLY
4
+ */
5
+ var SURFACE_LOGGER: LoggingSink | undefined;
6
+ }
7
+ export type LogLevel = 'info' | 'warn' | 'error' | 'debug';
8
+ export interface ModuleLogger {
9
+ debug: (message: string) => void;
10
+ info: (message: string) => void;
11
+ warn: (message: string) => void;
12
+ error: (message: string) => void;
13
+ }
14
+ export type LoggingSink = (source: string | undefined, level: LogLevel, message: string) => void;
15
+ /**
16
+ * Create a logger instance
17
+ * @param source The source path to use for the logger
18
+ * @returns A logger instance
19
+ */
20
+ export declare function createModuleLogger(source?: string): ModuleLogger;
21
+ //# sourceMappingURL=logging.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.d.ts","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,cAAc,EAAE,WAAW,GAAG,SAAS,CAAA;CAC3C;AAED,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;AAE1D,MAAM,WAAW,YAAY;IAC5B,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAChC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/B,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAChC;AAED,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;AAYhG;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,YAAY,CAOhE"}
@@ -0,0 +1,22 @@
1
+ const defaultLoggingSink = (source, level, message) => {
2
+ // Default logging implementation for unit testing purposes, this should be replaced by the host application
3
+ console.log(`[${level.toUpperCase()}]${source ? ` [${source}]` : ''} ${message}`);
4
+ };
5
+ function logToSink(source, level, message) {
6
+ const sink = typeof global.SURFACE_LOGGER === 'function' ? global.SURFACE_LOGGER : defaultLoggingSink;
7
+ sink(source, level, message);
8
+ }
9
+ /**
10
+ * Create a logger instance
11
+ * @param source The source path to use for the logger
12
+ * @returns A logger instance
13
+ */
14
+ export function createModuleLogger(source) {
15
+ return {
16
+ debug: (message) => logToSink(source, 'debug', message),
17
+ info: (message) => logToSink(source, 'info', message),
18
+ warn: (message) => logToSink(source, 'warn', message),
19
+ error: (message) => logToSink(source, 'error', message),
20
+ };
21
+ }
22
+ //# sourceMappingURL=logging.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logging.js","sourceRoot":"","sources":["../src/logging.ts"],"names":[],"mappings":"AAkBA,MAAM,kBAAkB,GAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE;IAClE,4GAA4G;IAC5G,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,CAAC,WAAW,EAAE,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,MAAM,GAAG,CAAC,CAAC,CAAC,EAAE,IAAI,OAAO,EAAE,CAAC,CAAA;AAClF,CAAC,CAAA;AAED,SAAS,SAAS,CAAC,MAA0B,EAAE,KAAe,EAAE,OAAe;IAC9E,MAAM,IAAI,GAAG,OAAO,MAAM,CAAC,cAAc,KAAK,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,CAAC,kBAAkB,CAAA;IACrG,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,CAAC,CAAA;AAC7B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAC,MAAe;IACjD,OAAO;QACN,KAAK,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;QAC/D,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;QAC7D,IAAI,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,CAAC;QAC7D,KAAK,EAAE,CAAC,OAAe,EAAE,EAAE,CAAC,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC;KAC/D,CAAA;AACF,CAAC"}
package/dist/main.d.ts CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './logging.js';
1
2
  export * from './manifest.js';
2
3
  export * from './surface-api/index.js';
3
4
  export * from './util.js';
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,WAAW,CAAA;AAEzB,mBAAmB,kCAAkC,CAAA"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,WAAW,CAAA;AAEzB,mBAAmB,kCAAkC,CAAA"}
package/dist/main.js CHANGED
@@ -1,3 +1,4 @@
1
+ export * from './logging.js';
1
2
  export * from './manifest.js';
2
3
  export * from './surface-api/index.js';
3
4
  export * from './util.js';
package/dist/main.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,wBAAwB,CAAA;AACtC,cAAc,WAAW,CAAA"}
@@ -1,6 +1,5 @@
1
1
  export * from './cards.js';
2
2
  export * from './context.js';
3
- export * from './enums.js';
4
3
  export * from './instance.js';
5
4
  export * from './pincode.js';
6
5
  export * from './plugin.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/surface-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/surface-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
@@ -1,6 +1,5 @@
1
1
  export * from './cards.js';
2
2
  export * from './context.js';
3
- export * from './enums.js';
4
3
  export * from './instance.js';
5
4
  export * from './pincode.js';
6
5
  export * from './plugin.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/surface-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,YAAY,CAAA;AAC1B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/surface-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA;AAC5B,cAAc,eAAe,CAAA;AAC7B,cAAc,cAAc,CAAA;AAC5B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@companion-surface/base",
3
- "version": "0.1.5",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": "https://github.com/bitfocus/companion-surface-api",
@@ -1,2 +0,0 @@
1
- export type LogLevel = 'info' | 'warn' | 'error' | 'debug';
2
- //# sourceMappingURL=enums.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../../src/surface-api/enums.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=enums.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"enums.js","sourceRoot":"","sources":["../../src/surface-api/enums.ts"],"names":[],"mappings":""}