@optique/logtape 1.0.0-dev.1344 → 1.0.0-dev.1359
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/index.cjs +8 -3
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +8 -3
- package/package.json +6 -4
package/dist/index.cjs
CHANGED
|
@@ -350,7 +350,11 @@ function createConsoleSink(options = {}) {
|
|
|
350
350
|
* @param output The log output destination.
|
|
351
351
|
* @param consoleSinkOptions Options for console sink (only used when output is console).
|
|
352
352
|
* @returns A promise that resolves to a {@link Sink}.
|
|
353
|
-
* @throws {Error} If file output is requested but `@logtape/file` is not
|
|
353
|
+
* @throws {Error} If file output is requested but `@logtape/file` is not
|
|
354
|
+
* installed.
|
|
355
|
+
* @throws If `@logtape/file` is installed but `getFileSink(output.path)` fails
|
|
356
|
+
* at runtime (e.g., the target directory does not exist), the original error
|
|
357
|
+
* propagates as-is.
|
|
354
358
|
*
|
|
355
359
|
* @example Console output
|
|
356
360
|
* ```typescript
|
|
@@ -370,9 +374,9 @@ function createConsoleSink(options = {}) {
|
|
|
370
374
|
*/
|
|
371
375
|
async function createSink(output, consoleSinkOptions = {}) {
|
|
372
376
|
if (output.type === "console") return createConsoleSink(consoleSinkOptions);
|
|
377
|
+
let getFileSink;
|
|
373
378
|
try {
|
|
374
|
-
|
|
375
|
-
return getFileSink(output.path);
|
|
379
|
+
({getFileSink} = await import("@logtape/file"));
|
|
376
380
|
} catch (e) {
|
|
377
381
|
throw new Error(`File sink requires @logtape/file package. Install it with:
|
|
378
382
|
npm install @logtape/file
|
|
@@ -381,6 +385,7 @@ async function createSink(output, consoleSinkOptions = {}) {
|
|
|
381
385
|
|
|
382
386
|
Original error: ${e}`);
|
|
383
387
|
}
|
|
388
|
+
return getFileSink(output.path);
|
|
384
389
|
}
|
|
385
390
|
|
|
386
391
|
//#endregion
|
package/dist/index.d.cts
CHANGED
|
@@ -343,7 +343,11 @@ declare function createConsoleSink(options?: ConsoleSinkOptions): Sink$1;
|
|
|
343
343
|
* @param output The log output destination.
|
|
344
344
|
* @param consoleSinkOptions Options for console sink (only used when output is console).
|
|
345
345
|
* @returns A promise that resolves to a {@link Sink}.
|
|
346
|
-
* @throws {Error} If file output is requested but `@logtape/file` is not
|
|
346
|
+
* @throws {Error} If file output is requested but `@logtape/file` is not
|
|
347
|
+
* installed.
|
|
348
|
+
* @throws If `@logtape/file` is installed but `getFileSink(output.path)` fails
|
|
349
|
+
* at runtime (e.g., the target directory does not exist), the original error
|
|
350
|
+
* propagates as-is.
|
|
347
351
|
*
|
|
348
352
|
* @example Console output
|
|
349
353
|
* ```typescript
|
package/dist/index.d.ts
CHANGED
|
@@ -343,7 +343,11 @@ declare function createConsoleSink(options?: ConsoleSinkOptions): Sink$1;
|
|
|
343
343
|
* @param output The log output destination.
|
|
344
344
|
* @param consoleSinkOptions Options for console sink (only used when output is console).
|
|
345
345
|
* @returns A promise that resolves to a {@link Sink}.
|
|
346
|
-
* @throws {Error} If file output is requested but `@logtape/file` is not
|
|
346
|
+
* @throws {Error} If file output is requested but `@logtape/file` is not
|
|
347
|
+
* installed.
|
|
348
|
+
* @throws If `@logtape/file` is installed but `getFileSink(output.path)` fails
|
|
349
|
+
* at runtime (e.g., the target directory does not exist), the original error
|
|
350
|
+
* propagates as-is.
|
|
347
351
|
*
|
|
348
352
|
* @example Console output
|
|
349
353
|
* ```typescript
|
package/dist/index.js
CHANGED
|
@@ -327,7 +327,11 @@ function createConsoleSink(options = {}) {
|
|
|
327
327
|
* @param output The log output destination.
|
|
328
328
|
* @param consoleSinkOptions Options for console sink (only used when output is console).
|
|
329
329
|
* @returns A promise that resolves to a {@link Sink}.
|
|
330
|
-
* @throws {Error} If file output is requested but `@logtape/file` is not
|
|
330
|
+
* @throws {Error} If file output is requested but `@logtape/file` is not
|
|
331
|
+
* installed.
|
|
332
|
+
* @throws If `@logtape/file` is installed but `getFileSink(output.path)` fails
|
|
333
|
+
* at runtime (e.g., the target directory does not exist), the original error
|
|
334
|
+
* propagates as-is.
|
|
331
335
|
*
|
|
332
336
|
* @example Console output
|
|
333
337
|
* ```typescript
|
|
@@ -347,9 +351,9 @@ function createConsoleSink(options = {}) {
|
|
|
347
351
|
*/
|
|
348
352
|
async function createSink(output, consoleSinkOptions = {}) {
|
|
349
353
|
if (output.type === "console") return createConsoleSink(consoleSinkOptions);
|
|
354
|
+
let getFileSink;
|
|
350
355
|
try {
|
|
351
|
-
|
|
352
|
-
return getFileSink(output.path);
|
|
356
|
+
({getFileSink} = await import("@logtape/file"));
|
|
353
357
|
} catch (e) {
|
|
354
358
|
throw new Error(`File sink requires @logtape/file package. Install it with:
|
|
355
359
|
npm install @logtape/file
|
|
@@ -358,6 +362,7 @@ async function createSink(output, consoleSinkOptions = {}) {
|
|
|
358
362
|
|
|
359
363
|
Original error: ${e}`);
|
|
360
364
|
}
|
|
365
|
+
return getFileSink(output.path);
|
|
361
366
|
}
|
|
362
367
|
|
|
363
368
|
//#endregion
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@optique/logtape",
|
|
3
|
-
"version": "1.0.0-dev.
|
|
3
|
+
"version": "1.0.0-dev.1359+1fa707c2",
|
|
4
4
|
"description": "LogTape logging integration for Optique CLI parser",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"CLI",
|
|
@@ -54,7 +54,8 @@
|
|
|
54
54
|
},
|
|
55
55
|
"sideEffects": false,
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"@logtape/
|
|
57
|
+
"@logtape/file": "^2.0.4",
|
|
58
|
+
"@logtape/logtape": "^2.0.4"
|
|
58
59
|
},
|
|
59
60
|
"peerDependenciesMeta": {
|
|
60
61
|
"@logtape/file": {
|
|
@@ -62,10 +63,11 @@
|
|
|
62
63
|
}
|
|
63
64
|
},
|
|
64
65
|
"dependencies": {
|
|
65
|
-
"@optique/core": "1.0.0-dev.
|
|
66
|
+
"@optique/core": "1.0.0-dev.1359+1fa707c2"
|
|
66
67
|
},
|
|
67
68
|
"devDependencies": {
|
|
68
|
-
"@logtape/
|
|
69
|
+
"@logtape/file": "^2.0.4",
|
|
70
|
+
"@logtape/logtape": "^2.0.4",
|
|
69
71
|
"@types/node": "^20.19.9",
|
|
70
72
|
"tsdown": "^0.13.0",
|
|
71
73
|
"typescript": "^5.8.3"
|