diff --git a/.changeset/angry-views-draw.md b/.changeset/angry-views-draw.md new file mode 100644 index 0000000..63c332e --- /dev/null +++ b/.changeset/angry-views-draw.md @@ -0,0 +1,5 @@ +--- +'@bengsfort/stdlib': minor +--- + +BREAKING: Moves logging and error modules from top level to their own directories. diff --git a/lib/__tests__/errors.test.ts b/lib/errors/__tests__/helpers.test.ts similarity index 91% rename from lib/__tests__/errors.test.ts rename to lib/errors/__tests__/helpers.test.ts index 3c614e9..3844812 100644 --- a/lib/__tests__/errors.test.ts +++ b/lib/errors/__tests__/helpers.test.ts @@ -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'; diff --git a/lib/errors.ts b/lib/errors/helpers.ts similarity index 100% rename from lib/errors.ts rename to lib/errors/helpers.ts diff --git a/lib/internal/logging-utils.ts b/lib/logging/internal/utils.ts similarity index 100% rename from lib/internal/logging-utils.ts rename to lib/logging/internal/utils.ts diff --git a/lib/logging.ts b/lib/logging/logger.ts similarity index 95% rename from lib/logging.ts rename to lib/logging/logger.ts index db5ca9f..d199c6c 100644 --- a/lib/logging.ts +++ b/lib/logging/logger.ts @@ -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(); diff --git a/lib/node/logging.ts b/lib/logging/node/logger.ts similarity index 96% rename from lib/node/logging.ts rename to lib/logging/node/logger.ts index ccb7cda..d399f09 100644 --- a/lib/node/logging.ts +++ b/lib/logging/node/logger.ts @@ -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(); diff --git a/package.json b/package.json index 8355350..546c83e 100644 --- a/package.json +++ b/package.json @@ -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",