@optique/logtape 1.0.0-dev.1335 → 1.0.0-dev.1354

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 CHANGED
@@ -25,6 +25,7 @@ const __optique_core_valueparser = __toESM(require("@optique/core/valueparser"))
25
25
  const __optique_core_primitives = __toESM(require("@optique/core/primitives"));
26
26
  const __optique_core_modifiers = __toESM(require("@optique/core/modifiers"));
27
27
  const __optique_core_message = __toESM(require("@optique/core/message"));
28
+ const node_path = __toESM(require("node:path"));
28
29
  const __optique_core_constructs = __toESM(require("@optique/core/constructs"));
29
30
 
30
31
  //#region src/loglevel.ts
@@ -251,7 +252,8 @@ function logOutputValueParser(options = {}) {
251
252
  yield {
252
253
  kind: "file",
253
254
  type: "file",
254
- pattern: prefix
255
+ pattern: prefix,
256
+ includeHidden: (0, node_path.basename)(prefix).startsWith(".") && (0, node_path.basename)(prefix) !== ".."
255
257
  };
256
258
  }
257
259
  };
@@ -348,7 +350,11 @@ function createConsoleSink(options = {}) {
348
350
  * @param output The log output destination.
349
351
  * @param consoleSinkOptions Options for console sink (only used when output is console).
350
352
  * @returns A promise that resolves to a {@link Sink}.
351
- * @throws {Error} If file output is requested but `@logtape/file` is not installed.
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.
352
358
  *
353
359
  * @example Console output
354
360
  * ```typescript
@@ -368,9 +374,9 @@ function createConsoleSink(options = {}) {
368
374
  */
369
375
  async function createSink(output, consoleSinkOptions = {}) {
370
376
  if (output.type === "console") return createConsoleSink(consoleSinkOptions);
377
+ let getFileSink;
371
378
  try {
372
- const { getFileSink } = await import("@logtape/file");
373
- return getFileSink(output.path);
379
+ ({getFileSink} = await import("@logtape/file"));
374
380
  } catch (e) {
375
381
  throw new Error(`File sink requires @logtape/file package. Install it with:
376
382
  npm install @logtape/file
@@ -379,6 +385,7 @@ async function createSink(output, consoleSinkOptions = {}) {
379
385
 
380
386
  Original error: ${e}`);
381
387
  }
388
+ return getFileSink(output.path);
382
389
  }
383
390
 
384
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 installed.
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 installed.
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
@@ -2,6 +2,7 @@ import { choice } from "@optique/core/valueparser";
2
2
  import { flag, option } from "@optique/core/primitives";
3
3
  import { map, multiple, optional, withDefault } from "@optique/core/modifiers";
4
4
  import { message } from "@optique/core/message";
5
+ import { basename } from "node:path";
5
6
  import { group, object } from "@optique/core/constructs";
6
7
 
7
8
  //#region src/loglevel.ts
@@ -228,7 +229,8 @@ function logOutputValueParser(options = {}) {
228
229
  yield {
229
230
  kind: "file",
230
231
  type: "file",
231
- pattern: prefix
232
+ pattern: prefix,
233
+ includeHidden: basename(prefix).startsWith(".") && basename(prefix) !== ".."
232
234
  };
233
235
  }
234
236
  };
@@ -325,7 +327,11 @@ function createConsoleSink(options = {}) {
325
327
  * @param output The log output destination.
326
328
  * @param consoleSinkOptions Options for console sink (only used when output is console).
327
329
  * @returns A promise that resolves to a {@link Sink}.
328
- * @throws {Error} If file output is requested but `@logtape/file` is not installed.
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.
329
335
  *
330
336
  * @example Console output
331
337
  * ```typescript
@@ -345,9 +351,9 @@ function createConsoleSink(options = {}) {
345
351
  */
346
352
  async function createSink(output, consoleSinkOptions = {}) {
347
353
  if (output.type === "console") return createConsoleSink(consoleSinkOptions);
354
+ let getFileSink;
348
355
  try {
349
- const { getFileSink } = await import("@logtape/file");
350
- return getFileSink(output.path);
356
+ ({getFileSink} = await import("@logtape/file"));
351
357
  } catch (e) {
352
358
  throw new Error(`File sink requires @logtape/file package. Install it with:
353
359
  npm install @logtape/file
@@ -356,6 +362,7 @@ async function createSink(output, consoleSinkOptions = {}) {
356
362
 
357
363
  Original error: ${e}`);
358
364
  }
365
+ return getFileSink(output.path);
359
366
  }
360
367
 
361
368
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optique/logtape",
3
- "version": "1.0.0-dev.1335+e6f8ec57",
3
+ "version": "1.0.0-dev.1354+b0af7b96",
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/logtape": "^1.2.2"
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.1335+e6f8ec57"
66
+ "@optique/core": "1.0.0-dev.1354+b0af7b96"
66
67
  },
67
68
  "devDependencies": {
68
- "@logtape/logtape": "^1.2.2",
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"