Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/angry-views-draw.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@bengsfort/stdlib': minor
---

BREAKING: Moves logging and error modules from top level to their own directories.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { describe, expect, it } from 'vitest';

import { getErrorMessage } from '../errors.js';
import { getErrorMessage } from '../helpers.js';

describe('errors', () => {
describe('errors/helpers', () => {
describe('getErrorMessage', () => {
it('should return the message of an error', () => {
const message = 'message';
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/logging.ts → lib/logging/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-console */

import { getCurrentTimestamp, Logger } from './internal/logging-utils.js';
import { getCurrentTimestamp, Logger } from './internal/utils.js';

// Runtime cache for re-using loggers to reduce memory footprint.
const cache = new Map<string, Logger>();
Expand Down
2 changes: 1 addition & 1 deletion lib/node/logging.ts → lib/logging/node/logger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import console from 'node:console';

import { getCurrentTimestamp, Logger } from '../internal/logging-utils.js';
import { getCurrentTimestamp, Logger } from '../internal/utils.js';

const cache = new Map<string, Logger>();

Expand Down
23 changes: 14 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,22 @@
},
"type": "module",
"exports": {
"./*": {
"default": "./dist/*.js",
"import": "./dist/*.js",
"types": "./dist/*.d.ts"
"./errors/*": {
"default": "./dist/errors/*.js",
"types": "./dist/errors/*.d.ts"
},
"./**/*": {
"default": "./dist/**/*.js",
"import": "./dist/**/*.js",
"types": "./dist/**/*.d.ts"
"./math/*": {
"default": "./dist/math/*.js",
"types": "./dist/math/*.d.ts"
},
"./internal/*": null
"./logging/*": {
"default": "./dist/logging/*.js",
"types": "./dist/logging/*.d.ts"
},
"./logging/node/*": {
"default": "./dist/logging/node/*.js",
"types": "./dist/logging/node/*.d.ts"
}
},
"files": [
"README.md",
Expand Down