@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.
- package/LICENSE +1 -1
- package/README.md +87 -134
- package/bin/libs/core/core-impl/deprecated/components/core/core.d.ts +1 -0
- package/bin/libs/core/core-impl/deprecated/components/core/core.js +1 -0
- package/bin/libs/core/core-impl/deprecated/components/levels/levels.d.ts +26 -0
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/levels/levels.js +15 -15
- package/bin/libs/core/core-impl/deprecated/components/modes/basic.d.ts +20 -0
- package/bin/libs/core/core-impl/deprecated/components/modes/basic.js +21 -0
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/modes/browser.d.ts +19 -19
- package/bin/libs/core/core-impl/deprecated/components/modes/browser.js +12 -0
- package/bin/libs/core/core-impl/deprecated/components/modes/shared.d.ts +3 -0
- package/bin/libs/core/core-impl/deprecated/components/modes/shared.js +4 -0
- package/{dist-npm/components/relinka → bin/libs/core/core-impl/deprecated/components/relinka-deprecated}/logger.d.ts +5 -5
- package/bin/libs/core/core-impl/deprecated/components/relinka-deprecated/logger.js +5 -0
- package/{dist-npm/components/relinka → bin/libs/core/core-impl/deprecated/components/relinka-deprecated}/mod.d.ts +21 -21
- package/bin/libs/core/core-impl/deprecated/components/relinka-deprecated/mod.js +34 -0
- package/{dist-npm/components/relinka → bin/libs/core/core-impl/deprecated/components/relinka-deprecated}/relinka.d.ts +141 -140
- package/{dist-npm/components/relinka → bin/libs/core/core-impl/deprecated/components/relinka-deprecated}/relinka.js +30 -27
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/basic.d.ts +11 -11
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/basic.js +10 -6
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/browser.d.ts +10 -10
- package/bin/libs/core/core-impl/deprecated/components/reporters/fancy.d.ts +10 -0
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/fancy.js +19 -12
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/types/mod.d.ts +150 -149
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/box.d.ts +114 -114
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/box.js +1 -1
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/deprecatedColors.d.ts +69 -69
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/deprecatedColors.js +3 -12
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/error.d.ts +6 -6
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/format.d.ts +14 -14
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/format.js +2 -2
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/log.d.ts +13 -13
- package/bin/libs/core/core-impl/deprecated/utils/mod.d.ts +3 -0
- package/bin/libs/core/core-impl/deprecated/utils/mod.js +9 -0
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/stream.d.ts +15 -14
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/string.d.ts +50 -50
- package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/tree.d.ts +41 -41
- package/bin/libs/core/core-main.d.ts +23 -0
- package/bin/libs/core/core-main.js +49 -0
- package/bin/main.d.ts +1 -0
- package/bin/main.js +1 -0
- package/package.json +47 -83
- package/dist-npm/components/core/core.d.ts +0 -2
- package/dist-npm/components/core/core.js +0 -2
- package/dist-npm/components/levels/levels.d.ts +0 -26
- package/dist-npm/components/modes/basic.d.ts +0 -20
- package/dist-npm/components/modes/basic.js +0 -21
- package/dist-npm/components/modes/browser.js +0 -12
- package/dist-npm/components/modes/shared.d.ts +0 -5
- package/dist-npm/components/modes/shared.js +0 -2
- package/dist-npm/components/relinka/logger.js +0 -5
- package/dist-npm/components/relinka/mod.js +0 -34
- package/dist-npm/components/reporters/fancy.d.ts +0 -10
- package/dist-npm/main.d.ts +0 -2
- package/dist-npm/main.js +0 -2
- package/dist-npm/utils/mod.d.ts +0 -3
- package/dist-npm/utils/mod.js +0 -9
- /package/{dist-npm → bin/libs/core/core-impl/deprecated}/components/reporters/browser.js +0 -0
- /package/{dist-npm → bin/libs/core/core-impl/deprecated}/types/mod.js +0 -0
- /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/error.js +0 -0
- /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/log.js +0 -0
- /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/stream.js +0 -0
- /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/string.js +0 -0
- /package/{dist-npm → bin/libs/core/core-impl/deprecated}/utils/tree.js +0 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,163 +1,116 @@
|
|
|
1
|
-
#
|
|
2
|
-
|
|
3
|
-
[
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
-
|
|
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
|
-
|
|
38
|
+
1. **Install globally**:
|
|
36
39
|
|
|
37
|
-
|
|
40
|
+
```sh
|
|
41
|
+
bun i -g @reliverse/relidler
|
|
42
|
+
```
|
|
38
43
|
|
|
39
|
-
|
|
44
|
+
**Or update as needed**:
|
|
40
45
|
|
|
41
|
-
|
|
46
|
+
```sh
|
|
47
|
+
bun -g update --latest
|
|
48
|
+
```
|
|
42
49
|
|
|
43
|
-
|
|
50
|
+
2. **Prepare your project**:
|
|
44
51
|
|
|
45
|
-
|
|
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
|
-
|
|
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
|
-
|
|
61
|
+
b. **Install config intellisense**:
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
-
|
|
67
|
+
c. **Initialize `relidler.cfg.ts`**:
|
|
62
68
|
|
|
63
|
-
|
|
69
|
+
```sh
|
|
70
|
+
relidler
|
|
71
|
+
```
|
|
64
72
|
|
|
65
|
-
|
|
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
|
-
|
|
77
|
+
3. **Run and enjoy**:
|
|
68
78
|
|
|
69
|
-
|
|
79
|
+
```sh
|
|
80
|
+
relidler
|
|
81
|
+
```
|
|
70
82
|
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
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
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
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
|
-
##
|
|
97
|
+
## TODO
|
|
152
98
|
|
|
153
|
-
- [
|
|
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
|
-
##
|
|
108
|
+
## Related
|
|
156
109
|
|
|
157
|
-
|
|
110
|
+
Kudos to the following project that made Relinka possible:
|
|
158
111
|
|
|
159
|
-
|
|
112
|
+
- [unjs/consola](https://github.com/unjs/consola#readme)
|
|
160
113
|
|
|
161
114
|
## License
|
|
162
115
|
|
|
163
|
-
[MIT](./LICENSE
|
|
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
|
|
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
|
|
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:
|
|
24
|
+
level: LogLevelsDeprecated.fatal
|
|
25
25
|
},
|
|
26
26
|
error: {
|
|
27
|
-
level:
|
|
27
|
+
level: LogLevelsDeprecated.error
|
|
28
28
|
},
|
|
29
29
|
// Level 1
|
|
30
30
|
warn: {
|
|
31
|
-
level:
|
|
31
|
+
level: LogLevelsDeprecated.warn
|
|
32
32
|
},
|
|
33
33
|
// Level 2
|
|
34
34
|
log: {
|
|
35
|
-
level:
|
|
35
|
+
level: LogLevelsDeprecated.log
|
|
36
36
|
},
|
|
37
37
|
// Level 3
|
|
38
38
|
info: {
|
|
39
|
-
level:
|
|
39
|
+
level: LogLevelsDeprecated.info
|
|
40
40
|
},
|
|
41
41
|
success: {
|
|
42
|
-
level:
|
|
42
|
+
level: LogLevelsDeprecated.success
|
|
43
43
|
},
|
|
44
44
|
fail: {
|
|
45
|
-
level:
|
|
45
|
+
level: LogLevelsDeprecated.fail
|
|
46
46
|
},
|
|
47
47
|
ready: {
|
|
48
|
-
level:
|
|
48
|
+
level: LogLevelsDeprecated.info
|
|
49
49
|
},
|
|
50
50
|
start: {
|
|
51
|
-
level:
|
|
51
|
+
level: LogLevelsDeprecated.info
|
|
52
52
|
},
|
|
53
53
|
box: {
|
|
54
|
-
level:
|
|
54
|
+
level: LogLevelsDeprecated.info
|
|
55
55
|
},
|
|
56
56
|
// Level 4
|
|
57
57
|
debug: {
|
|
58
|
-
level:
|
|
58
|
+
level: LogLevelsDeprecated.debug
|
|
59
59
|
},
|
|
60
60
|
// Level 5
|
|
61
61
|
trace: {
|
|
62
|
-
level:
|
|
62
|
+
level: LogLevelsDeprecated.trace
|
|
63
63
|
},
|
|
64
64
|
// Verbose
|
|
65
65
|
verbose: {
|
|
66
|
-
level:
|
|
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 {
|
|
10
|
-
*/
|
|
11
|
-
export declare function
|
|
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 {
|
|
17
|
-
*/
|
|
18
|
-
export declare const
|
|
19
|
-
export default
|
|
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;
|
|
@@ -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
|
|
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 {};
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import type { RelinkaOptions } from "../../types/mod.js";
|
|
2
|
-
import type {
|
|
3
|
-
export * from "
|
|
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 {
|
|
10
|
-
*/
|
|
11
|
-
export declare function
|
|
12
|
-
fancy: boolean;
|
|
13
|
-
}>):
|
|
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 {
|
|
19
|
-
*/
|
|
20
|
-
export declare const
|
|
21
|
-
export default
|
|
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;
|