assembly-kit 0.0.1 → 0.0.3
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/README.md +2 -2
- package/dist/logger/index.mjs +1 -7
- package/dist/logger/index.mjs.map +1 -1
- package/package.json +4 -9
package/README.md
CHANGED
|
@@ -394,7 +394,7 @@ The payload is validated against `TokenPayloadSchema` before encryption. Throws
|
|
|
394
394
|
|
|
395
395
|
### Logger
|
|
396
396
|
|
|
397
|
-
A request-scoped Pino logger is available from `assembly-kit/logger`. Requires `pino`
|
|
397
|
+
A request-scoped Pino logger is available from `assembly-kit/logger`. Requires `pino` as a peer dependency.
|
|
398
398
|
|
|
399
399
|
```typescript
|
|
400
400
|
import { createLogger, logger } from "assembly-kit/logger";
|
|
@@ -409,7 +409,7 @@ import { logger } from "assembly-kit/logger";
|
|
|
409
409
|
logger.info("starting up");
|
|
410
410
|
```
|
|
411
411
|
|
|
412
|
-
The logger
|
|
412
|
+
The logger emits plain JSON in all environments (no worker-thread transport, so it works in serverless runtimes like Vercel). Pipe output through the `pino-pretty` CLI locally if you want human-readable logs. The default log level respects the `LOG_LEVEL` environment variable.
|
|
413
413
|
|
|
414
414
|
### App Bridge (React Hooks)
|
|
415
415
|
|
package/dist/logger/index.mjs
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
2
|
import pino from "pino";
|
|
3
3
|
//#region src/logger/index.ts
|
|
4
|
-
const DEFAULT_OPTIONS = {
|
|
5
|
-
level: process.env.LOG_LEVEL ?? "info",
|
|
6
|
-
transport: process.env.NODE_ENV === "production" ? void 0 : {
|
|
7
|
-
options: { colorize: true },
|
|
8
|
-
target: "pino-pretty"
|
|
9
|
-
}
|
|
10
|
-
};
|
|
4
|
+
const DEFAULT_OPTIONS = { level: process.env.LOG_LEVEL ?? "info" };
|
|
11
5
|
const buildLogger = (options = {}) => pino({
|
|
12
6
|
...DEFAULT_OPTIONS,
|
|
13
7
|
...options
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/logger/index.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\n\nimport pino from \"pino\";\nimport type { Logger, LoggerOptions } from \"pino\";\n\nexport type { Logger, LoggerOptions } from \"pino\";\n\nconst DEFAULT_OPTIONS: LoggerOptions = {\n level: process.env.LOG_LEVEL ?? \"info\",\n
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/logger/index.ts"],"sourcesContent":["import { AsyncLocalStorage } from \"node:async_hooks\";\n\nimport pino from \"pino\";\nimport type { Logger, LoggerOptions } from \"pino\";\n\nexport type { Logger, LoggerOptions } from \"pino\";\n\n// pino-pretty uses a worker-thread transport that breaks in serverless\n// runtimes (Vercel, Cloudflare). Emit plain JSON everywhere; pipe through\n// the pino-pretty CLI locally if you want pretty output.\nconst DEFAULT_OPTIONS: LoggerOptions = {\n level: process.env.LOG_LEVEL ?? \"info\",\n};\n\nconst buildLogger = (options: LoggerOptions = {}): Logger =>\n pino({ ...DEFAULT_OPTIONS, ...options });\n\nconst store: AsyncLocalStorage<Logger> = new AsyncLocalStorage<Logger>();\n\n/**\n * Get or create a request-scoped logger via `AsyncLocalStorage`.\n * Returns the existing instance if one exists. Pass options to customize\n * on first call; subsequent calls in the same async context return the\n * same instance.\n *\n * @example\n * ```ts\n * const logger = createLogger({ level: \"debug\" });\n * logger.info(\"hello\");\n * logger.warn(\"careful\");\n * logger.error(\"oops\");\n *\n * // Later in the same async context:\n * const same = createLogger(); // returns the same instance\n * ```\n */\nexport const createLogger = (options: LoggerOptions = {}): Logger => {\n const existing = store.getStore();\n if (existing) {\n return existing;\n }\n const instance = buildLogger(options);\n store.enterWith(instance);\n return instance;\n};\n\n/** A default global logger instance for convenience. */\nexport const logger: Logger = buildLogger();\n"],"mappings":";;;AAUA,MAAM,kBAAiC,EACrC,OAAO,QAAQ,IAAI,aAAa,QACjC;AAED,MAAM,eAAe,UAAyB,EAAE,KAC9C,KAAK;CAAE,GAAG;CAAiB,GAAG;CAAS,CAAC;AAE1C,MAAM,QAAmC,IAAI,mBAA2B;;;;;;;;;;;;;;;;;;AAmBxE,MAAa,gBAAgB,UAAyB,EAAE,KAAa;CACnE,MAAM,WAAW,MAAM,UAAU;AACjC,KAAI,SACF,QAAO;CAET,MAAM,WAAW,YAAY,QAAQ;AACrC,OAAM,UAAU,SAAS;AACzB,QAAO;;;AAIT,MAAa,SAAiB,aAAa"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "assembly-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "TypeScript SDK for the Assembly platform",
|
|
5
|
-
"homepage": "https://github.com/
|
|
5
|
+
"homepage": "https://github.com/madebyoutside/assembly-kit#readme",
|
|
6
6
|
"bugs": {
|
|
7
|
-
"url": "https://github.com/
|
|
7
|
+
"url": "https://github.com/madebyoutside/assembly-kit/issues"
|
|
8
8
|
},
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/
|
|
12
|
+
"url": "git+https://github.com/madebyoutside/assembly-kit.git"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"dist",
|
|
@@ -49,7 +49,6 @@
|
|
|
49
49
|
"@typescript/native-preview": "7.0.0-dev.20260505.1",
|
|
50
50
|
"bumpp": "^11.0.1",
|
|
51
51
|
"pino": "^10.3.1",
|
|
52
|
-
"pino-pretty": "^13.1.3",
|
|
53
52
|
"react": "^19.2.5",
|
|
54
53
|
"typescript": "^6.0.3",
|
|
55
54
|
"vite-plus": "^0.1.20",
|
|
@@ -58,7 +57,6 @@
|
|
|
58
57
|
"peerDependencies": {
|
|
59
58
|
"@assembly-js/app-bridge": "^1.1.1",
|
|
60
59
|
"pino": ">=9",
|
|
61
|
-
"pino-pretty": ">=10",
|
|
62
60
|
"react": ">=18",
|
|
63
61
|
"typescript": ">=5",
|
|
64
62
|
"zod": ">=4"
|
|
@@ -70,9 +68,6 @@
|
|
|
70
68
|
"pino": {
|
|
71
69
|
"optional": true
|
|
72
70
|
},
|
|
73
|
-
"pino-pretty": {
|
|
74
|
-
"optional": true
|
|
75
|
-
},
|
|
76
71
|
"react": {
|
|
77
72
|
"optional": true
|
|
78
73
|
},
|