Skip to content

Commit

Permalink
Support node v18 and drop node v12, make exports ESM-friendly (#86)
Browse files Browse the repository at this point in the history
* Support node v18, drop node v12, make exports ESM-friendly

* Clearer heading in API docs

Co-authored-by: Gil Pedersen <[email protected]>

Co-authored-by: Gil Pedersen <[email protected]>
  • Loading branch information
devinivy and kanongil authored May 16, 2022
1 parent 6f1a84c commit f5d4702
Show file tree
Hide file tree
Showing 7 changed files with 40 additions and 10 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/ci-module.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,5 @@ on:
jobs:
test:
uses: hapijs/.github/.github/workflows/ci-module.yml@master
with:
min-node-version: 14
2 changes: 1 addition & 1 deletion API.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ Memory adapter for [catbox](https://github.com/hapijs/catbox).
This adapter is not designed to share a common cache between multiple processes (e.g. in a cluster
mode). It uses a single interval timeout to look for expired records and clean them from memory.

### Options
### `new CatboxMemory.Engine(options)`

- `maxByteSize` - sets an upper limit on the number of bytes that can be stored in the
cache. Once this limit is reached no additional items will be added to the cache
Expand Down
5 changes: 3 additions & 2 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
Copyright (c) 2012-2020, Sideway Inc, and project contributors
Copyright (c) 2012-2014, Walmart.
Copyright (c) 2012-2022, Project contributors
Copyright (c) 2012-2020, Sideway Inc
Copyright (c) 2012-2014, Walmart.
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
Expand Down
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internals.defaults = {
};


exports = module.exports = internals.Connection = class {
exports.Engine = class CatboxMemoryEngine {

constructor(options = {}) {

Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,14 @@
]
},
"dependencies": {
"@hapi/boom": "9.x.x",
"@hapi/hoek": "9.x.x"
"@hapi/boom": "^10.0.0",
"@hapi/hoek": "^10.0.0"
},
"devDependencies": {
"@hapi/catbox": "11.x.x",
"@hapi/code": "8.x.x",
"@hapi/catbox": "^12.0.0",
"@hapi/code": "^9.0.0",
"@hapi/eslint-plugin": "*",
"@hapi/lab": "24.x.x"
"@hapi/lab": "^25.0.1"
},
"scripts": {
"test": "lab -a @hapi/code -L -t 100",
Expand Down
27 changes: 27 additions & 0 deletions test/esm.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
'use strict';

const Code = require('@hapi/code');
const Lab = require('@hapi/lab');


const { before, describe, it } = exports.lab = Lab.script();
const expect = Code.expect;


describe('import()', () => {

let CatboxMemory;

before(async () => {

CatboxMemory = await import('../lib/index.js');
});

it('exposes all methods and classes as named imports', () => {

expect(Object.keys(CatboxMemory)).to.equal([
'Engine',
'default'
]);
});
});
2 changes: 1 addition & 1 deletion test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const Catbox = require('@hapi/catbox');
const Code = require('@hapi/code');
const Hoek = require('@hapi/hoek');
const Lab = require('@hapi/lab');
const Memory = require('..');
const { Engine: Memory } = require('..');


const internals = {};
Expand Down

0 comments on commit f5d4702

Please sign in to comment.