@reliverse/relinka 1.3.2 → 1.3.4

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.
Files changed (64) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +87 -134
  3. package/bin/libs/core/core-impl/deprecated/components/core/core.d.ts +1 -0
  4. package/bin/libs/core/core-impl/deprecated/components/core/core.js +1 -0
  5. package/bin/libs/core/core-impl/deprecated/components/levels/levels.d.ts +26 -0
  6. package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/levels/levels.js +15 -15
  7. package/bin/libs/core/core-impl/deprecated/components/modes/basic.d.ts +20 -0
  8. package/bin/libs/core/core-impl/deprecated/components/modes/basic.js +21 -0
  9. package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/modes/browser.d.ts +19 -19
  10. package/bin/libs/core/core-impl/deprecated/components/modes/browser.js +12 -0
  11. package/bin/libs/core/core-impl/deprecated/components/modes/shared.d.ts +3 -0
  12. package/bin/libs/core/core-impl/deprecated/components/modes/shared.js +4 -0
  13. package/{dist-npm/components/relinka → bin/libs/core/core-impl/deprecated/components/relinka-deprecated}/logger.d.ts +5 -5
  14. package/bin/libs/core/core-impl/deprecated/components/relinka-deprecated/logger.js +5 -0
  15. package/{dist-npm/components/relinka → bin/libs/core/core-impl/deprecated/components/relinka-deprecated}/mod.d.ts +21 -21
  16. package/bin/libs/core/core-impl/deprecated/components/relinka-deprecated/mod.js +34 -0
  17. package/{dist-npm/components/relinka → bin/libs/core/core-impl/deprecated/components/relinka-deprecated}/relinka.d.ts +141 -140
  18. package/{dist-npm/components/relinka → bin/libs/core/core-impl/deprecated/components/relinka-deprecated}/relinka.js +30 -27
  19. package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/basic.d.ts +11 -11
  20. package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/basic.js +10 -6
  21. package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/browser.d.ts +10 -10
  22. package/bin/libs/core/core-impl/deprecated/components/reporters/fancy.d.ts +10 -0
  23. package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/fancy.js +19 -12
  24. package/{dist-npm → bin/libs/core/core-impl/deprecated}/types/mod.d.ts +150 -149
  25. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/box.d.ts +114 -114
  26. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/box.js +1 -1
  27. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/deprecatedColors.d.ts +69 -69
  28. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/deprecatedColors.js +3 -12
  29. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/error.d.ts +6 -6
  30. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/format.d.ts +14 -14
  31. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/format.js +2 -2
  32. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/log.d.ts +13 -13
  33. package/bin/libs/core/core-impl/deprecated/utils/mod.d.ts +3 -0
  34. package/bin/libs/core/core-impl/deprecated/utils/mod.js +9 -0
  35. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/stream.d.ts +15 -14
  36. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/string.d.ts +50 -50
  37. package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/tree.d.ts +41 -41
  38. package/bin/libs/core/core-main.d.ts +23 -0
  39. package/bin/libs/core/core-main.js +49 -0
  40. package/bin/main.d.ts +1 -0
  41. package/bin/main.js +1 -0
  42. package/package.json +47 -83
  43. package/dist-npm/components/core/core.d.ts +0 -2
  44. package/dist-npm/components/core/core.js +0 -2
  45. package/dist-npm/components/levels/levels.d.ts +0 -26
  46. package/dist-npm/components/modes/basic.d.ts +0 -20
  47. package/dist-npm/components/modes/basic.js +0 -21
  48. package/dist-npm/components/modes/browser.js +0 -12
  49. package/dist-npm/components/modes/shared.d.ts +0 -5
  50. package/dist-npm/components/modes/shared.js +0 -2
  51. package/dist-npm/components/relinka/logger.js +0 -5
  52. package/dist-npm/components/relinka/mod.js +0 -34
  53. package/dist-npm/components/reporters/fancy.d.ts +0 -10
  54. package/dist-npm/main.d.ts +0 -2
  55. package/dist-npm/main.js +0 -2
  56. package/dist-npm/utils/mod.d.ts +0 -3
  57. package/dist-npm/utils/mod.js +0 -9
  58. /package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/browser.js +0 -0
  59. /package/{dist-npm → bin/libs/core/core-impl/deprecated}/types/mod.js +0 -0
  60. /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/error.js +0 -0
  61. /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/log.js +0 -0
  62. /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/stream.js +0 -0
  63. /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/string.js +0 -0
  64. /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/tree.js +0 -0
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  # MIT License
2
2
 
3
- Copyright (c) 2024 Nazarii Korniienko
3
+ Copyright (c) 2025 blefnk Nazar Kornienko
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,163 +1,116 @@
1
- # @reliverse/relinka
2
-
3
- [**Docs**](.github/DOCS.md) | [**npmjs.com**](https://npmjs.com/package/@reliverse/relinka) | [**GitHub**](https://github.com/reliverse/relinka)
4
-
5
- <p align="left">
6
- <a href="https://npmjs.org/package/@reliverse/relinka">
7
- <img src="https://img.shields.io/npm/v/@reliverse/relinka.svg" alt="version" />
8
- </a>
9
- <!-- <a href="https://github.com/reliverse/relinka/actions/workflows/test.yml">
10
- <img src="https://github.com/reliverse/relinka/actions/workflows/test.yml/badge.svg" alt="test" />
11
- </a> -->
12
- <a href="https://npmjs.org/package/@reliverse/relinka">
13
- <img src="https://img.shields.io/npm/dm/@reliverse/relinka.svg" alt="downloads" />
14
- </a>
15
- <!-- <a href="https://licenses.dev/npm/@reliverse/relinka">
16
- <img src="https://licenses.dev/b/npm/@reliverse/relinka" alt="licenses" />
17
- </a> -->
18
- <!---
19
- <a href="https://packagephobia.now.sh/result?p=@reliverse/relinka">
20
- <img src="https://packagephobia.now.sh/badge?p=@reliverse/relinka" alt="install size" />
21
- </a>
22
- --->
23
- </p>
24
-
25
- **Style your terminal or browser console like never before.** @reliverse/relinka is your next powerful logger. It's a full-featured alternative to winston, unjs relinka, pino, bristol, node-bunyan, and similar libraries. Used by [@reliverse/prompts](https://github.com/reliverse/prompts#readme) and [@reliverse/cli](https://github.com/blefnk/reliverse#readme).
26
-
27
- ## Installation
1
+ # Relidler: Reliverse Bundler
2
+
3
+ [💖 GitHub Sponsors](https://github.com/sponsors/blefnk) • [💬 Discord](https://discord.gg/Pb8uKbwpsJ) [✨ Repo](https://github.com/reliverse/relinka-logger) [📦 NPM](https://npmjs.com/@reliverse/relinka) • [📚 Docs](https://docs.reliverse.org)
4
+
5
+ **@reliverse/relinka** is your next powerful logger, which allows you to style your terminal or browser console like never before.
6
+
7
+ ## Features
8
+
9
+ - 😘 Drop-in replacement for `consola`
10
+ - ⚡ `relinka` works via CLI and SDK
11
+ - 📦 Automated NPM/JSR publishing
12
+ - ✅ Ensures reliable JS/TS builds
13
+ - 🔄 Handles automatic version bumps
14
+ - 🔧 Eliminates `package.json` headaches
15
+ - 🎯 Optimized for speed and modern workflows
16
+ - 🛠️ Converts TypeScript aliases to relative paths
17
+ - ✨ Packed with powerful features under the hood
18
+ - 📝 Highly configurable flow via a configuration file
19
+ - 🔌 Plugin system with one built-in plugin included
20
+
21
+ ## Getting Started
22
+
23
+ Ensure [Git](https://git-scm.com/downloads), [Node.js](https://nodejs.org), and a package manager ([bun](https://bun.sh)/[pnpm](https://pnpm.io)/[yarn](https://yarnpkg.com)/[npm](https://docs.npmjs.com/downloading-and-installing-node-js-and-npm)) are installed. Then follow these steps:
24
+
25
+ ### Example Playground
26
+
27
+ Want to test Relinka before integrating it into your project? Clone the repo and launch the example:
28
28
 
29
29
  ```sh
30
- bun add @reliverse/relinka # Replace 'bun' with npm, pnpm, or yarn if desired
30
+ git clone https://github.com/reliverse/relinka-logger.git
31
+ cd relinka-logger
32
+ bun i
33
+ bun dev # bun examples/main.ts
31
34
  ```
32
35
 
33
- ---
36
+ ### Relidler Usage
34
37
 
35
- > **Warning:** The @reliverse/relinka README.md was based on the @reliverse/prompts README.md. Some of the information may be not related to the current library. And will be updated soon.
38
+ 1. **Install globally**:
36
39
 
37
- ---
40
+ ```sh
41
+ bun i -g @reliverse/relidler
42
+ ```
38
43
 
39
- ## Screenshot
44
+ **Or update as needed**:
40
45
 
41
- [![CLI Example](./example.png)](./example.png)
46
+ ```sh
47
+ bun -g update --latest
48
+ ```
42
49
 
43
- ## Key Features
50
+ 2. **Prepare your project**:
44
51
 
45
- - **Type Safety**: Built with TypeScript, ensuring strong typing to prevent runtime errors.
46
- - **Schema Validation**: Validates user inputs using schemas for enhanced reliability.
47
- - **Flexible Prompt Types**: Supports a range of prompt types, including text, password, number, select, and multiselect.
48
- - **Crash Resilience**: Designed to handle cancellations and errors gracefully, ensuring stability.
52
+ a. **Configure `.gitignore`**:
49
53
 
50
- ## Prompt Types
54
+ ```sh
55
+ echo "*.log" >> .gitignore
56
+ echo "dist-npm" >> .gitignore
57
+ echo "dist-jsr" >> .gitignore
58
+ echo "dist-libs" >> .gitignore
59
+ ```
51
60
 
52
- Each type has its own validation and display logic. More types are planned for future releases.
61
+ b. **Install config intellisense**:
53
62
 
54
- - **Text**: Collects text input.
55
- - **Password**: Hidden input for secure password entries.
56
- - **Number**: Numeric input with optional validation.
57
- - **Confirm**: Simple Yes/No prompt.
58
- - **Select**: Dropdown selection for multiple choices.
59
- - **Multiselect**: Allows users to select multiple items from a list.
63
+ ```sh
64
+ bun add -D @reliverse/relidler-cfg
65
+ ```
60
66
 
61
- ## Input Validation
67
+ c. **Initialize `relidler.cfg.ts`**:
62
68
 
63
- All prompts support custom validation logic, providing immediate feedback to users.
69
+ ```sh
70
+ relidler
71
+ ```
64
72
 
65
- ## Contributing
73
+ - The `relidler.cfg.ts` file is created automatically on the first run.
74
+ - **It's recommended to customize this file according to your needs.**
75
+ - Supported names: `relidler.cfg.ts` • `relidler.config.ts` • `build.pub.ts` • `build.cfg.ts`.
66
76
 
67
- @reliverse/relinka is a work in progress. We welcome feedback and contributions to help make it the best library it can be. Thank you!
77
+ 3. **Run and enjoy**:
68
78
 
69
- Here is how to install the library for development:
79
+ ```sh
80
+ relidler
81
+ ```
70
82
 
71
- ```sh
72
- git clone https://github.com/reliverse/relinka.git
73
- cd relinka
74
- bun i
75
- ```
83
+ ## Plugins & SDK
84
+
85
+ Relidler includes a plugin system, with the following official built-in plugin already available:
76
86
 
77
- ## Playground
78
-
79
- Run `bun dev` to launch the [examples/run-example.ts](./examples/run-example.ts) CLI, where you can dive into and explore any of the examples listed below. Experiment with @reliverse/relinka by running examples locally or reviewing the linked code:
80
-
81
- 1. **[1-main-example.ts](./examples/1-main-example.ts)**: A comprehensive example of a CLI application featuring a well styled UI config. This example showcases all available prompt components, with code organized into separate functions and files for better readability and clarity.
82
- 2. **[2-mono-example.ts](./examples/2-mono-example.ts)**: A quiz game example inspired by Fireship's [video](https://youtube.com/watch?v=_oHByo8tiEY). It demonstrates the dynamic capabilities of @reliverse/relinka by using a prompt() that includes all prompt components, so you don't need to import each component separately.
83
- 3. **[3-basic-example.ts](./examples/3-basic-example.ts)**: A simple example highlighting the core functionalities of @reliverse/relinka. The entire implementation is contained within a single file for easy understanding.
84
-
85
- ## Logger Library Comparison
86
-
87
- > **Note:** This table contains approximate and placeholder values. More detailed assessments will be provided as libraries continue to evolve.
88
-
89
- **Icon Legend:**
90
-
91
- - 🟡: Not yet verified
92
- - 🟢: Fully supported
93
- - 🔵: Partially supported
94
- - 🔴: Not supported
95
-
96
- | **Feature** | **@reliverse/relinka** | **@unjs/consola** | **@klaudiosinani/signale** | **pino** | **@TomFrost/Bristol** | **@trentm/node-bunyan** | **winston** | **log4js-node** |
97
- | -----------------------------------------------------------|----------------------------------------------------|------------------------|-----------------------------|---------------------|------------------------|---------------------------|------------------------|--------------------|
98
- | **Full Node.js Modules Support** | 🟢 Native ES module package | 🟢 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
99
- | **Works both in node, bun, and deno environments** | 🔵 node+bun (deno support is coming soon) | 🔵 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
100
- | **Codebase typesafety with intellisense** | 🔵 | 🔵 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
101
- | **Runtime typesafety with schema validation** | 🔵 | 🔵 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
102
- | **Usage Examples** | 🟢 | 🟢 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
103
- | **Prompts Components** | 🟢 Can be enabled using @reliverse/prompts library | 🟢 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
104
- | **Customization** | 🟢 Colors, typography, variants, borders, and more | 🟢 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
105
- | **Custom Validation** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
106
- | **Error Handling** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
107
- | **Ease of Setup** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
108
- | **Crash Resilience** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
109
- | **General DX** | 🔵 Clean and understandable TypeScript code | 🔵 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
110
- | **DX: Classes** | 🟢 Minimal number of classes as possible | 🟢 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
111
- | **Documentation** | 🔵 | 🔵 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
112
- | **Designed With UX/DX in Mind** | 🟢 | 🟢 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
113
- | **Fast and lightweight argument parser** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
114
- | **Smart value parsing with typecast** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
115
- | **Boolean shortcuts and unknown flag handling** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
116
- | **Nested sub-commands** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
117
- | **Lazy and Async commands** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
118
- | **Pluggable and composable API** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
119
- | **Auto generated usage and help** | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 | 🟡 |
120
-
121
- **Related Links**: [ESM/CJS](https://dev.to/iggredible/what-the-heck-are-cjs-amd-umd-and-esm-ikm), ["Pure ESM package"](https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c), [Clean code](https://github.com/ryanmcdermott/clean-code-javascript#readme), ["UX patterns for CLI tools"](https://lucasfcosta.com/2022/06/01/ux-patterns-cli-tools.html), [DX (Developer Experience)](https://github.blog/enterprise-software/collaboration/developer-experience-what-is-it-and-why-should-you-care), [TypeBox](https://github.com/sinclairzx81/typebox#readme), ["ANSI Escape Sequences"](https://gist.github.com/ConnerWill/d4b6c776b509add763e17f9f113fd25b)
122
-
123
- ## Wrap-Up
124
-
125
- @reliverse/relinka is a versatile library designed to accelerate CLI development by providing customizable prompt components. Integrated into the [Reliverse CLI](https://github.com/blefnk/reliverse#readme), @reliverse/relinka enables you to create a unique design aligned with your CLI app’s aesthetics, similar to how @shadcn/ui supports customizable web UI components. Quickly get started by copying configurations from the [Reliverse Docs](https://docs.reliverse.org/relinka) and using components that fit your project, making it faster to bring your CLI app to life. You’re free to customize each component as desired, with default designs provided to ensure an attractive interface from the start.
126
-
127
- **Example Configuration:**
128
-
129
- ```typescript
130
- const basicConfig = {
131
- titleColor: "cyanBright",
132
- titleTypography: "bold",
133
- borderColor: "viceGradient",
134
- } satisfies OptionalPromptOptions;
135
-
136
- const extendedConfig = {
137
- ...basicConfig,
138
- contentTypography: "italic",
139
- contentColor: "dim",
140
- } satisfies OptionalPromptOptions;
141
-
142
- const username = await textPrompt({
143
- id: "username",
144
- title: "We're glad you're testing our library!",
145
- content: "Let's get to know each other!\nWhat's your username?",
146
- schema: schema.properties.username,
147
- ...extendedConfig,
148
- });
87
+ - **`libraries-relidler-plugin`**: Builds and publishes specified subdirectories of your main project as separate packages.
88
+
89
+ ### API (for advanced users)
90
+
91
+ The SDK allows you to create new Relidler plugins and even extend your own CLI functionality.
92
+
93
+ ```sh
94
+ bun add -D @reliverse/relidler-sdk
149
95
  ```
150
96
 
151
- ## Learn More
97
+ ## TODO
152
98
 
153
- - [Reliverse Docs](https://docs.reliverse.org)
99
+ - [x] ~~Implement stable `regular` build and publish~~
100
+ - [ ] Implement stable `library` build and publish
101
+ - [ ] Allow to minify dist with comments preserved
102
+ - [ ] Achieve full drop-in replacement for `unbuild`
103
+ - [ ] Support auto migration from `build.config.ts`
104
+ - [ ] Allow plugins to extend Relidler's `defineConfig`
105
+ - [ ] Support configuration via `reliverse.{ts,jsonc}`
106
+ - [ ] Make config file optional with sensible defaults
154
107
 
155
- ## Special Thanks
108
+ ## Related
156
109
 
157
- This project wouldn’t exist without the amazing work of the huge number of contributors to the list of projects below. Many of the @reliverse/relinka features are based on the incredible work of:
110
+ Kudos to the following project that made Relinka possible:
158
111
 
159
- [@reliverse/prompts](https://github.com/reliverse/prompts#readme) | [@unjs/consola](https://github.com/unjs/consola#readme)
112
+ - [unjs/consola](https://github.com/unjs/consola#readme)
160
113
 
161
114
  ## License
162
115
 
163
- [MIT](./LICENSE.md) © [Nazarii Korniienko](https://github.com/blefnk)
116
+ 🩷 [MIT](./LICENSE) © [blefnk Nazar Kornienko](https://github.com/blefnk)
@@ -0,0 +1 @@
1
+ export * from "../modes/shared.js";
@@ -0,0 +1 @@
1
+ export * from "../modes/shared.js";
@@ -0,0 +1,26 @@
1
+ import type { LogObject } from "../../types/mod.js";
2
+ /**
3
+ * Defines the level of logs as specific numbers or special number types.
4
+ *
5
+ * @type {0 | 1 | 2 | 3 | 4 | 5 | (number & {})} LogLevelDeprecated - Represents the log level.
6
+ * @default 0 - Represents the default log level.
7
+ */
8
+ export type LogLevelDeprecated = 0 | 1 | 2 | 3 | 4 | 5 | (number & {});
9
+ /**
10
+ * A mapping of `LogTypeDeprecated` to its corresponding numeric log level.
11
+ *
12
+ * @type {Record<LogTypeDeprecated, number>} LogLevelsDeprecated - key-value pairs of log types to their numeric levels. See {@link LogTypeDeprecated}.
13
+ */
14
+ export declare const LogLevelsDeprecated: Record<LogTypeDeprecated, number>;
15
+ /**
16
+ * Lists the types of log messages supported by the system.
17
+ *
18
+ * @type {"silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose"} LogTypeDeprecated - Represents the specific type of log message.
19
+ */
20
+ export type LogTypeDeprecated = "silent" | "fatal" | "error" | "warn" | "log" | "info" | "success" | "fail" | "ready" | "start" | "box" | "debug" | "trace" | "verbose";
21
+ /**
22
+ * Maps `LogTypeDeprecated` to a `Partial<LogObject>`, primarily defining the log level.
23
+ *
24
+ * @type {Record<LogTypeDeprecated, Partial<LogObject>>} LogTypesDeprecated - key-value pairs of log types to partial log objects, specifying log levels. See {@link LogTypeDeprecated} and {@link LogObject}.
25
+ */
26
+ export declare const LogTypesDeprecated: Record<LogTypeDeprecated, Partial<LogObject>>;
@@ -1,4 +1,4 @@
1
- export const LogLevels = {
1
+ export const LogLevelsDeprecated = {
2
2
  silent: Number.NEGATIVE_INFINITY,
3
3
  fatal: 0,
4
4
  error: 0,
@@ -14,55 +14,55 @@ export const LogLevels = {
14
14
  trace: 5,
15
15
  verbose: Number.POSITIVE_INFINITY
16
16
  };
17
- export const LogTypes = {
17
+ export const LogTypesDeprecated = {
18
18
  // Silent
19
19
  silent: {
20
20
  level: -1
21
21
  },
22
22
  // Level 0
23
23
  fatal: {
24
- level: LogLevels.fatal
24
+ level: LogLevelsDeprecated.fatal
25
25
  },
26
26
  error: {
27
- level: LogLevels.error
27
+ level: LogLevelsDeprecated.error
28
28
  },
29
29
  // Level 1
30
30
  warn: {
31
- level: LogLevels.warn
31
+ level: LogLevelsDeprecated.warn
32
32
  },
33
33
  // Level 2
34
34
  log: {
35
- level: LogLevels.log
35
+ level: LogLevelsDeprecated.log
36
36
  },
37
37
  // Level 3
38
38
  info: {
39
- level: LogLevels.info
39
+ level: LogLevelsDeprecated.info
40
40
  },
41
41
  success: {
42
- level: LogLevels.success
42
+ level: LogLevelsDeprecated.success
43
43
  },
44
44
  fail: {
45
- level: LogLevels.fail
45
+ level: LogLevelsDeprecated.fail
46
46
  },
47
47
  ready: {
48
- level: LogLevels.info
48
+ level: LogLevelsDeprecated.info
49
49
  },
50
50
  start: {
51
- level: LogLevels.info
51
+ level: LogLevelsDeprecated.info
52
52
  },
53
53
  box: {
54
- level: LogLevels.info
54
+ level: LogLevelsDeprecated.info
55
55
  },
56
56
  // Level 4
57
57
  debug: {
58
- level: LogLevels.debug
58
+ level: LogLevelsDeprecated.debug
59
59
  },
60
60
  // Level 5
61
61
  trace: {
62
- level: LogLevels.trace
62
+ level: LogLevelsDeprecated.trace
63
63
  },
64
64
  // Verbose
65
65
  verbose: {
66
- level: LogLevels.verbose
66
+ level: LogLevelsDeprecated.verbose
67
67
  }
68
68
  };
@@ -0,0 +1,20 @@
1
+ import type { RelinkaInstanceDeprecated } from "../relinka-deprecated/relinka.js";
2
+ import type { RelinkaOptions } from "../../types/mod.js";
3
+ export * from "./shared.js";
4
+ /**
5
+ * Factory function to create a new Relinka instance
6
+ *
7
+ * @param {Partial<RelinkaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptions}.
8
+ * @returns {RelinkaInstanceDeprecated} A new Relinka instance configured with the given options.
9
+ */
10
+ export declare function createRelinkaBaseDeprecated(options?: Partial<RelinkaOptions & {
11
+ fancy: boolean;
12
+ }>): RelinkaInstanceDeprecated;
13
+ /**
14
+ * Creates and exports a standard instance of Relinka with the default configuration.
15
+ * This instance can be used directly for logging throughout the application.
16
+ *
17
+ * @type {RelinkaInstanceDeprecated} relinka - The default instance of Relinka.
18
+ */
19
+ export declare const relinkaBasicDeprecated: RelinkaInstanceDeprecated;
20
+ export default relinkaBasicDeprecated;
@@ -0,0 +1,21 @@
1
+ import { LogLevelsDeprecated } from "../levels/levels.js";
2
+ import { createRelinkaDeprecated as _createRelinkaDeprecated } from "../relinka-deprecated/relinka.js";
3
+ import { BasicReporter } from "../reporters/basic.js";
4
+ export * from "./shared.js";
5
+ export function createRelinkaBaseDeprecated(options = {}) {
6
+ let level = LogLevelsDeprecated.info;
7
+ if (process.env.RELINKA_LEVEL) {
8
+ level = Number.parseInt(process.env.RELINKA_LEVEL) ?? level;
9
+ }
10
+ const relinka = _createRelinkaDeprecated({
11
+ level,
12
+ defaults: { level },
13
+ stdout: process.stdout,
14
+ stderr: process.stderr,
15
+ reporters: options.reporters || [new BasicReporter()],
16
+ ...options
17
+ });
18
+ return relinka;
19
+ }
20
+ export const relinkaBasicDeprecated = createRelinkaBaseDeprecated();
21
+ export default relinkaBasicDeprecated;
@@ -1,19 +1,19 @@
1
- import type { RelinkaOptions } from "../../types/mod.js";
2
- export * from "./shared.js";
3
- /**
4
- * Creates a new Relinka instance configured specifically for browser environments.
5
- * This function sets up default reporters and a prompt method tailored to the browser's dialogue APIs.
6
- *
7
- * @param {Partial<RelinkaOptions>} [options={}] - Optional configuration options.
8
- * The options can override the default reporter and prompt behavior. See {@link RelinkaOptions}.
9
- * @returns {RelinkaInstance} A new Relinka instance optimized for use in browser environments.
10
- */
11
- export declare function createRelinka(options?: Partial<RelinkaOptions>): any;
12
- /**
13
- * A standard Relinka instance created with browser-specific configurations.
14
- * This instance can be used throughout a browser-based project.
15
- *
16
- * @type {RelinkaInstance} relinka - The default browser-configured Relinka instance.
17
- */
18
- export declare const relinkaBrowser: any;
19
- export default relinkaBrowser;
1
+ import type { RelinkaOptions } from "../../types/mod.js";
2
+ export * from "./shared.js";
3
+ /**
4
+ * Creates a new Relinka instance configured specifically for browser environments.
5
+ * This function sets up default reporters and a prompt method tailored to the browser's dialogue APIs.
6
+ *
7
+ * @param {Partial<RelinkaOptions>} [options={}] - Optional configuration options.
8
+ * The options can override the default reporter and prompt behavior. See {@link RelinkaOptions}.
9
+ * @returns {RelinkaInstanceDeprecated} A new Relinka instance optimized for use in browser environments.
10
+ */
11
+ export declare function createRelinkaBrowserDeprecatedDeprecated(options?: Partial<RelinkaOptions>): any;
12
+ /**
13
+ * A standard Relinka instance created with browser-specific configurations.
14
+ * This instance can be used throughout a browser-based project.
15
+ *
16
+ * @type {RelinkaInstanceDeprecated} relinka - The default browser-configured Relinka instance.
17
+ */
18
+ export declare const relinkaBrowserDeprecated: any;
19
+ export default relinkaBrowserDeprecated;
@@ -0,0 +1,12 @@
1
+ import { createRelinkaDeprecated as _createRelinkaDeprecated } from "../relinka-deprecated/relinka.js";
2
+ import { BrowserReporter } from "../reporters/browser.js";
3
+ export * from "./shared.js";
4
+ export function createRelinkaBrowserDeprecatedDeprecated(options = {}) {
5
+ const relinka = _createRelinkaDeprecated({
6
+ reporters: options.reporters || [new BrowserReporter({})],
7
+ ...options
8
+ });
9
+ return relinka;
10
+ }
11
+ export const relinkaBrowserDeprecated = createRelinkaBrowserDeprecatedDeprecated();
12
+ export default relinkaBrowserDeprecated;
@@ -0,0 +1,3 @@
1
+ export { LogLevelsDeprecated, LogTypesDeprecated, } from "../levels/levels.js";
2
+ export type * from "../../types/mod.js";
3
+ export type { LogLevelDeprecated, LogTypeDeprecated, } from "../levels/levels.js";
@@ -0,0 +1,4 @@
1
+ export {
2
+ LogLevelsDeprecated,
3
+ LogTypesDeprecated
4
+ } from "../levels/levels.js";
@@ -1,5 +1,5 @@
1
- type MessageKind = "log" | "info" | "warn" | "error" | "success";
2
- type VerboseKind = `${MessageKind}-verbose`;
3
- type AllKinds = MessageKind | VerboseKind;
4
- export declare const deprecatedRelinka: (_kind: AllKinds, title: string, content?: string, hint?: string) => void;
5
- export {};
1
+ type MessageKind = "log" | "info" | "warn" | "error" | "success";
2
+ type VerboseKind = `${MessageKind}-verbose`;
3
+ type AllKinds = MessageKind | VerboseKind;
4
+ export declare const relinkaDeprecated: (_kind: AllKinds, title: string, content?: string, hint?: string) => void;
5
+ export {};
@@ -0,0 +1,5 @@
1
+ export const relinkaDeprecated = (_kind, title, content, hint) => {
2
+ console.log(`${title}
3
+ ${content}
4
+ ${hint}`);
5
+ };
@@ -1,21 +1,21 @@
1
- import type { RelinkaOptions } from "../../types/mod.js";
2
- import type { RelinkaInstance } from "./relinka.js";
3
- export * from "../../components/modes/shared.js";
4
- /**
5
- * Factory function to create a new Relinka instance tailored for use in different environments.
6
- * It automatically adjusts logging levels based on environment variables and execution context.
7
- *
8
- * @param {Partial<RelinkaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptions}.
9
- * @returns {RelinkaInstance} A new Relinka instance with configurations based on the given options and the execution environment.
10
- */
11
- export declare function createRelinka(options?: Partial<RelinkaOptions & {
12
- fancy: boolean;
13
- }>): RelinkaInstance;
14
- /**
15
- * A default instance of Relinka, created and configured for immediate use.
16
- * This instance is configured based on the execution environment and the options provided.
17
- *
18
- * @type {RelinkaInstance} relinka - The default Relinka instance, ready to use.
19
- */
20
- export declare const relinkaInstance: RelinkaInstance;
21
- export default relinkaInstance;
1
+ import type { RelinkaOptions } from "../../types/mod.js";
2
+ import type { RelinkaInstanceDeprecated } from "./relinka.js";
3
+ export * from "../modes/shared.js";
4
+ /**
5
+ * Factory function to create a new Relinka instance tailored for use in different environments.
6
+ * It automatically adjusts logging levels based on environment variables and execution context.
7
+ *
8
+ * @param {Partial<RelinkaOptions & { fancy: boolean }>} [options={}] - Optional configuration options. See {@link RelinkaOptions}.
9
+ * @returns {RelinkaInstanceDeprecated} A new Relinka instance with configurations based on the given options and the execution environment.
10
+ */
11
+ export declare function createRelinkaSharedDeprecated(options?: Partial<RelinkaOptions & {
12
+ fancy: boolean;
13
+ }>): RelinkaInstanceDeprecated;
14
+ /**
15
+ * A default instance of Relinka, created and configured for immediate use.
16
+ * This instance is configured based on the execution environment and the options provided.
17
+ *
18
+ * @type {RelinkaInstanceDeprecated} relinka - The default Relinka instance, ready to use.
19
+ */
20
+ export declare const relinkaInstanceDeprecated: RelinkaInstanceDeprecated;
21
+ export default relinkaInstanceDeprecated;
@@ -0,0 +1,34 @@
1
+ import { isDebug, isTest, isCI } from "std-env";
2
+ import { LogLevelsDeprecated } from "../levels/levels.js";
3
+ import { BasicReporter } from "../reporters/basic.js";
4
+ import { FancyReporter } from "../reporters/fancy.js";
5
+ import { createRelinkaDeprecated as _createRelinkaDeprecated } from "./relinka.js";
6
+ export * from "../modes/shared.js";
7
+ export function createRelinkaSharedDeprecated(options = {}) {
8
+ let level = _getDefaultLogLevelDeprecated();
9
+ if (process.env.RELINKA_LEVEL) {
10
+ level = Number.parseInt(process.env.RELINKA_LEVEL) ?? level;
11
+ }
12
+ const relinka = _createRelinkaDeprecated({
13
+ level,
14
+ defaults: { level },
15
+ stdout: process.stdout,
16
+ stderr: process.stderr,
17
+ reporters: options.reporters || [
18
+ options.fancy ?? !(isCI || isTest) ? new FancyReporter() : new BasicReporter()
19
+ ],
20
+ ...options
21
+ });
22
+ return relinka;
23
+ }
24
+ function _getDefaultLogLevelDeprecated() {
25
+ if (isDebug) {
26
+ return LogLevelsDeprecated.debug;
27
+ }
28
+ if (isTest) {
29
+ return LogLevelsDeprecated.warn;
30
+ }
31
+ return LogLevelsDeprecated.info;
32
+ }
33
+ export const relinkaInstanceDeprecated = createRelinkaSharedDeprecated();
34
+ export default relinkaInstanceDeprecated;