BREAKING CHANGE(core): switch to esm
This commit is contained in:
parent
431089e23f
commit
592228fc51
18587
package-lock.json
generated
18587
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
23
package.json
23
package.json
@ -5,27 +5,26 @@
|
|||||||
"description": "a package that handles state in a good way",
|
"description": "a package that handles state in a good way",
|
||||||
"main": "dist_ts/index.js",
|
"main": "dist_ts/index.js",
|
||||||
"typings": "dist_ts/index.d.ts",
|
"typings": "dist_ts/index.d.ts",
|
||||||
|
"type": "module",
|
||||||
"author": "Lossless GmbH",
|
"author": "Lossless GmbH",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(tstest test/)",
|
"test": "(tstest test/)",
|
||||||
"build": "(tsbuild --web && tsbundle npm)"
|
"build": "(tsbuild --web --allowimplicitany && tsbundle npm)"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@gitzone/tsbuild": "^2.1.29",
|
"@gitzone/tsbuild": "^2.1.61",
|
||||||
"@gitzone/tsbundle": "^1.0.89",
|
"@gitzone/tsbundle": "^1.0.101",
|
||||||
"@gitzone/tstest": "^1.0.60",
|
"@gitzone/tstest": "^1.0.70",
|
||||||
"@pushrocks/tapbundle": "^3.2.9",
|
"@pushrocks/tapbundle": "^5.0.3",
|
||||||
"@types/node": "^17.0.10",
|
"@types/node": "^17.0.23"
|
||||||
"tslint": "^6.1.3",
|
|
||||||
"tslint-config-prettier": "^1.18.0"
|
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@pushrocks/isohash": "^1.0.2",
|
"@pushrocks/isohash": "^2.0.0",
|
||||||
"@pushrocks/lik": "^5.0.1",
|
"@pushrocks/lik": "^5.0.4",
|
||||||
"@pushrocks/smartjson": "^4.0.6",
|
"@pushrocks/smartjson": "^4.0.6",
|
||||||
"@pushrocks/smartpromise": "^3.1.6",
|
"@pushrocks/smartpromise": "^3.1.7",
|
||||||
"@pushrocks/smartrx": "^2.0.20"
|
"@pushrocks/smartrx": "^2.0.25"
|
||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"ts/**/*",
|
"ts/**/*",
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { expect, tap } from '@pushrocks/tapbundle';
|
import { expect, tap } from '@pushrocks/tapbundle';
|
||||||
import * as smartstate from '../ts/index';
|
import * as smartstate from '../ts/index.js';
|
||||||
|
|
||||||
type TMyStateParts = 'testStatePart';
|
type TMyStateParts = 'testStatePart';
|
||||||
interface TStatePartPayload {
|
interface TStatePartPayload {
|
||||||
@ -14,7 +14,7 @@ let testStatePart: smartstate.StatePart<TMyStateParts, TStatePartPayload>;
|
|||||||
|
|
||||||
tap.test('should create a new SmartState', async () => {
|
tap.test('should create a new SmartState', async () => {
|
||||||
testState = new smartstate.Smartstate<TMyStateParts>();
|
testState = new smartstate.Smartstate<TMyStateParts>();
|
||||||
expect(testState).to.be.instanceOf(smartstate.Smartstate);
|
expect(testState).toBeInstanceOf(smartstate.Smartstate);
|
||||||
});
|
});
|
||||||
|
|
||||||
tap.test('should create a new StatePart', async () => {
|
tap.test('should create a new StatePart', async () => {
|
||||||
@ -24,7 +24,7 @@ tap.test('should create a new StatePart', async () => {
|
|||||||
hi: 2,
|
hi: 2,
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
expect(testStatePart).to.be.instanceOf(smartstate.StatePart);
|
expect(testStatePart).toBeInstanceOf(smartstate.StatePart);
|
||||||
console.log(testStatePart);
|
console.log(testStatePart);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ tap.test('should select something', async () => {
|
|||||||
testStatePart
|
testStatePart
|
||||||
.select((state) => state.deep.hi)
|
.select((state) => state.deep.hi)
|
||||||
.subscribe((substate) => {
|
.subscribe((substate) => {
|
||||||
expect(substate).to.equal(2);
|
expect(substate).toEqual(2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ tap.test('should dispatch a state action', async (tools) => {
|
|||||||
done.resolve();
|
done.resolve();
|
||||||
});
|
});
|
||||||
await testStatePart.dispatchAction(addFavourite, 'my favourite things');
|
await testStatePart.dispatchAction(addFavourite, 'my favourite things');
|
||||||
expect(testStatePart.getState().currentFavorites).to.include('my favourite things');
|
expect(testStatePart.getState().currentFavorites).toContain('my favourite things');
|
||||||
await done.promise;
|
await done.promise;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
export * from './smartstate.classes.smartstate';
|
export * from './smartstate.classes.smartstate.js';
|
||||||
export * from './smartstate.classes.statepart';
|
export * from './smartstate.classes.statepart.js';
|
||||||
export * from './smartstate.classes.stateaction';
|
export * from './smartstate.classes.stateaction.js';
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as plugins from './smartstate.plugins';
|
import * as plugins from './smartstate.plugins.js';
|
||||||
import { StatePart } from './smartstate.classes.statepart';
|
import { StatePart } from './smartstate.classes.statepart.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Smartstate takes care of providing state
|
* Smartstate takes care of providing state
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as plugins from './smartstate.plugins';
|
import * as plugins from './smartstate.plugins.js';
|
||||||
import { StatePart } from './smartstate.classes.statepart';
|
import { StatePart } from './smartstate.classes.statepart.js';
|
||||||
|
|
||||||
export interface IActionDef<TStateType, TActionPayloadType> {
|
export interface IActionDef<TStateType, TActionPayloadType> {
|
||||||
(stateArg: StatePart<any, TStateType>, actionPayload: TActionPayloadType): Promise<TStateType>;
|
(stateArg: StatePart<any, TStateType>, actionPayload: TActionPayloadType): Promise<TStateType>;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import * as plugins from './smartstate.plugins';
|
import * as plugins from './smartstate.plugins.js';
|
||||||
import { StateAction, IActionDef } from './smartstate.classes.stateaction';
|
import { StateAction, IActionDef } from './smartstate.classes.stateaction.js';
|
||||||
|
|
||||||
export class StatePart<TStatePartName, TStatePayload> {
|
export class StatePart<TStatePartName, TStatePayload> {
|
||||||
public name: TStatePartName;
|
public name: TStatePartName;
|
||||||
|
9
tsconfig.json
Normal file
9
tsconfig.json
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"useDefineForClassFields": false,
|
||||||
|
"target": "ES2022",
|
||||||
|
"module": "ES2022",
|
||||||
|
"moduleResolution": "nodenext"
|
||||||
|
}
|
||||||
|
}
|
17
tslint.json
17
tslint.json
@ -1,17 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ["tslint:latest", "tslint-config-prettier"],
|
|
||||||
"rules": {
|
|
||||||
"semicolon": [true, "always"],
|
|
||||||
"no-console": false,
|
|
||||||
"ordered-imports": false,
|
|
||||||
"object-literal-sort-keys": false,
|
|
||||||
"member-ordering": {
|
|
||||||
"options":{
|
|
||||||
"order": [
|
|
||||||
"static-method"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"defaultSeverity": "warning"
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user