Skip to content

Commit

Permalink
@uppy/store-default: refactor to ESM (#3746)
Browse files Browse the repository at this point in the history
  • Loading branch information
aduh95 committed May 17, 2022
1 parent 538c37b commit 440f3ae
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ module.exports = {
'packages/@uppy/redux-dev-tools/src/**/*.js',
'packages/@uppy/screen-capture/src/**/*.js',
'packages/@uppy/status-bar/src/**/*.js',
'packages/@uppy/store-default/src/**/*.js',
'packages/@uppy/store-redux/src/**/*.js',
'packages/@uppy/svelte/src/**/*.js',
'packages/@uppy/svelte/rollup.config.js',
Expand Down
1 change: 1 addition & 0 deletions packages/@uppy/store-default/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"license": "MIT",
"main": "lib/index.js",
"types": "types/index.d.ts",
"type": "module",
"keywords": [
"file uploader",
"uppy",
Expand Down
8 changes: 5 additions & 3 deletions packages/@uppy/store-default/src/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import packageJson from '../package.json'
/**
* Default store that keeps state in a simple object.
*/
class DefaultStore {
static VERSION = require('../package.json').version
static VERSION = packageJson.version

constructor () {
this.state = {}
this.callbacks = []
this.callbacks = [] // TODO: use a Set instead, make it a private prop
}

getState () {
Expand Down Expand Up @@ -39,6 +40,7 @@ class DefaultStore {
}
}

module.exports = function defaultStore () {
// TODO: export the class instead in the next major.
export default function defaultStore () {
return new DefaultStore()
}
2 changes: 1 addition & 1 deletion packages/@uppy/store-default/src/index.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const DefaultStore = require('./index')
import DefaultStore from './index.js'

describe('DefaultStore', () => {
it('can be created with or without new', () => {
Expand Down

0 comments on commit 440f3ae

Please sign in to comment.