BREAKING CHANGE(core): switch to esm

This commit is contained in:
Philipp Kunz 2022-03-25 13:31:21 +01:00
parent 431089e23f
commit 592228fc51
9 changed files with 4793 additions and 13871 deletions

18553
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,27 +5,26 @@
"description": "a package that handles state in a good way",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
"author": "Lossless GmbH",
"license": "MIT",
"scripts": {
"test": "(tstest test/)",
"build": "(tsbuild --web && tsbundle npm)"
"build": "(tsbuild --web --allowimplicitany && tsbundle npm)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.29",
"@gitzone/tsbundle": "^1.0.89",
"@gitzone/tstest": "^1.0.60",
"@pushrocks/tapbundle": "^3.2.9",
"@types/node": "^17.0.10",
"tslint": "^6.1.3",
"tslint-config-prettier": "^1.18.0"
"@gitzone/tsbuild": "^2.1.61",
"@gitzone/tsbundle": "^1.0.101",
"@gitzone/tstest": "^1.0.70",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^17.0.23"
},
"dependencies": {
"@pushrocks/isohash": "^1.0.2",
"@pushrocks/lik": "^5.0.1",
"@pushrocks/isohash": "^2.0.0",
"@pushrocks/lik": "^5.0.4",
"@pushrocks/smartjson": "^4.0.6",
"@pushrocks/smartpromise": "^3.1.6",
"@pushrocks/smartrx": "^2.0.20"
"@pushrocks/smartpromise": "^3.1.7",
"@pushrocks/smartrx": "^2.0.25"
},
"files": [
"ts/**/*",

View File

@ -1,5 +1,5 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as smartstate from '../ts/index';
import * as smartstate from '../ts/index.js';
type TMyStateParts = 'testStatePart';
interface TStatePartPayload {
@ -14,7 +14,7 @@ let testStatePart: smartstate.StatePart<TMyStateParts, TStatePartPayload>;
tap.test('should create a new SmartState', async () => {
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 () => {
@ -24,7 +24,7 @@ tap.test('should create a new StatePart', async () => {
hi: 2,
},
});
expect(testStatePart).to.be.instanceOf(smartstate.StatePart);
expect(testStatePart).toBeInstanceOf(smartstate.StatePart);
console.log(testStatePart);
});
@ -32,7 +32,7 @@ tap.test('should select something', async () => {
testStatePart
.select((state) => state.deep.hi)
.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();
});
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;
});

View File

@ -1,3 +1,3 @@
export * from './smartstate.classes.smartstate';
export * from './smartstate.classes.statepart';
export * from './smartstate.classes.stateaction';
export * from './smartstate.classes.smartstate.js';
export * from './smartstate.classes.statepart.js';
export * from './smartstate.classes.stateaction.js';

View File

@ -1,5 +1,5 @@
import * as plugins from './smartstate.plugins';
import { StatePart } from './smartstate.classes.statepart';
import * as plugins from './smartstate.plugins.js';
import { StatePart } from './smartstate.classes.statepart.js';
/**
* Smartstate takes care of providing state

View File

@ -1,5 +1,5 @@
import * as plugins from './smartstate.plugins';
import { StatePart } from './smartstate.classes.statepart';
import * as plugins from './smartstate.plugins.js';
import { StatePart } from './smartstate.classes.statepart.js';
export interface IActionDef<TStateType, TActionPayloadType> {
(stateArg: StatePart<any, TStateType>, actionPayload: TActionPayloadType): Promise<TStateType>;

View File

@ -1,5 +1,5 @@
import * as plugins from './smartstate.plugins';
import { StateAction, IActionDef } from './smartstate.classes.stateaction';
import * as plugins from './smartstate.plugins.js';
import { StateAction, IActionDef } from './smartstate.classes.stateaction.js';
export class StatePart<TStatePartName, TStatePayload> {
public name: TStatePartName;

9
tsconfig.json Normal file
View File

@ -0,0 +1,9 @@
{
"compilerOptions": {
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext"
}
}

View File

@ -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"
}