Skip to content

Commit

Permalink
feat(logger): add esmodule support (#1734)
Browse files Browse the repository at this point in the history
* feat(logger): add esm build output

* fix(Logger): Remove barrel files update references

* test(Logger): update jest/ts-jest to use ESM

* chore(Logger): remove unused lodash.merge

* fix(logger): reinstate lodash.merge

* chore(logger): revert TS assertion

* chore(logger): revert format changes

* chore(logger): update postbuild to remove incremental tsbuildinfo files

* fix(logger): correct reference to types output

* feat(logging): add middleware export

* chore(logger): replace postbuild script with echo statement

* feat(logger): add typesVersions property and barrel files to /types

* chore(logger): file not used, can be added back if needed

* chore(logger): add space back to README

* chore(logger): revert space in README
  • Loading branch information
antstanley authored and dreamorosi committed Mar 6, 2024
1 parent 67e5e94 commit 9e3a811
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 9 deletions.
7 changes: 6 additions & 1 deletion packages/logger/jest.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,12 @@ module.exports = {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.ts?$': 'ts-jest',
'^.+\\.[tj]sx?$': [
'ts-jest',
{
useESM: true,
},
],
},
moduleFileExtensions: ['js', 'ts'],
collectCoverageFrom: ['**/src/**/*.ts', '!**/node_modules/**'],
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -100,4 +100,4 @@
"serverless",
"nodejs"
]
}
}
5 changes: 3 additions & 2 deletions packages/logger/src/formatter/LogFormatterInterface.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { LogAttributes, UnformattedAttributes } from '../types';
import { LogItem } from '../log';
import { LogAttributes } from '../types/Log.js';
import { UnformattedAttributes } from '../types/Logger.js';
import { LogItem } from '../log/LogItem.js';

/**
* @interface
Expand Down
3 changes: 0 additions & 3 deletions packages/logger/src/formatter/index.ts

This file was deleted.

9 changes: 9 additions & 0 deletions packages/logger/src/log/LogItemInterface.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { LogAttributes } from '../types/Log.js';

interface LogItemInterface {
addAttributes(attributes: LogAttributes): void;

getAttributes(): LogAttributes;
}

export { LogItemInterface };
2 changes: 1 addition & 1 deletion packages/logger/src/types/formats/PowertoolsLog.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { LogAttributes, LogLevel } from '..';
import type { LogAttributes, LogLevel } from '../Log.js';

type PowertoolsLog = LogAttributes & {
/**
Expand Down
2 changes: 1 addition & 1 deletion packages/logger/src/types/formats/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './PowertoolsLog';
export type { PowertoolsLog } from './PowertoolsLog.js';

0 comments on commit 9e3a811

Please sign in to comment.