refactor: gathering

This commit is contained in:
cha0s 2024-01-28 11:18:28 -06:00
parent 9cbc9956b4
commit 43cf6be0a3
30 changed files with 104 additions and 107 deletions

View File

@ -26,9 +26,9 @@
"@avocado/resource": "^4.0.0", "@avocado/resource": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@babel/parser": "^7.13.13", "@babel/parser": "^7.13.13",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/react-redux": "^3.0.0", "@flecks/react-redux": "^3.1.3",
"babeler": "^1.0.0", "babeler": "^1.0.0",
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"lodash.set": "^4.3.2", "lodash.set": "^4.3.2",
@ -36,7 +36,7 @@
"natsort": "^2.0.2" "natsort": "^2.0.2"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -15,11 +15,11 @@
"@babel/generator": "7.17.x", "@babel/generator": "7.17.x",
"@babel/parser": "^7.17.7", "@babel/parser": "^7.17.7",
"@babel/types": "^7.17.0", "@babel/types": "^7.17.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"babel-walk": "^3.0.0" "babel-walk": "^3.0.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -19,12 +19,12 @@
"index.js" "index.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"lodash.set": "^4.3.2" "lodash.set": "^4.3.2"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -19,11 +19,11 @@
"index.js" "index.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"chai": "4.2.0" "chai": "4.2.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -20,7 +20,7 @@
], ],
"dependencies": { "dependencies": {
"@avocado/entity": "^4.0.0", "@avocado/entity": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"lodash.get": "^4.4.2", "lodash.get": "^4.4.2",
"lodash.set": "^4.3.2", "lodash.set": "^4.3.2",
"remark-mdx": "2.0.0-next.8", "remark-mdx": "2.0.0-next.8",
@ -29,7 +29,7 @@
"unist-util-visit-parents": "^3.1.1" "unist-util-visit-parents": "^3.1.1"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -12,10 +12,10 @@
"index.js" "index.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.0.0" "@flecks/core": "^3.1.3"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -30,9 +30,9 @@
"@avocado/s13n": "^4.0.0", "@avocado/s13n": "^4.0.0",
"@avocado/timing": "^4.0.0", "@avocado/timing": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"debug": "4.3.1", "debug": "4.3.1",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"lodash.difference": "^4.5.0", "lodash.difference": "^4.5.0",
@ -40,7 +40,7 @@
"react-autosuggest": "^10.1.0" "react-autosuggest": "^10.1.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -18,7 +18,6 @@ beforeEach(async () => {
'@flecks/socket': require('@flecks/socket'), '@flecks/socket': require('@flecks/socket'),
}, },
}); });
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
({Entity} = flecks.avocado.resource.Resources); ({Entity} = flecks.avocado.resource.Resources);
}); });
afterEach(() => { afterEach(() => {

View File

@ -17,7 +17,6 @@ beforeEach(async () => {
'@flecks/socket': require('@flecks/socket'), '@flecks/socket': require('@flecks/socket'),
}, },
}); });
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
({Entity} = flecks.avocado.resource.Resources); ({Entity} = flecks.avocado.resource.Resources);
}); });
afterEach(() => { afterEach(() => {

View File

@ -16,7 +16,6 @@ beforeEach(async () => {
'@flecks/react': require('@flecks/react'), '@flecks/react': require('@flecks/react'),
}, },
}); });
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
({Entity} = flecks.avocado.resource.Resources); ({Entity} = flecks.avocado.resource.Resources);
}); });
afterEach(() => { afterEach(() => {

View File

@ -16,7 +16,6 @@ beforeEach(async () => {
'@flecks/react': require('@flecks/react'), '@flecks/react': require('@flecks/react'),
}, },
}); });
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
({Entity} = flecks.avocado.resource.Resources); ({Entity} = flecks.avocado.resource.Resources);
}); });
afterEach(() => { afterEach(() => {

View File

@ -16,7 +16,6 @@ beforeEach(async () => {
'@flecks/socket': require('@flecks/socket'), '@flecks/socket': require('@flecks/socket'),
}, },
}); });
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
({Entity} = flecks.avocado.resource.Resources); ({Entity} = flecks.avocado.resource.Resources);
}); });
afterEach(() => { afterEach(() => {

View File

@ -16,7 +16,6 @@ beforeEach(async () => {
'@flecks/socket': require('@flecks/socket'), '@flecks/socket': require('@flecks/socket'),
}, },
}); });
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
({Entity} = flecks.avocado.resource.Resources); ({Entity} = flecks.avocado.resource.Resources);
}); });
afterEach(() => { afterEach(() => {

View File

@ -16,7 +16,6 @@ beforeEach(async () => {
'@flecks/socket': require('@flecks/socket'), '@flecks/socket': require('@flecks/socket'),
}, },
}); });
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
({Entity} = flecks.avocado.resource.Resources); ({Entity} = flecks.avocado.resource.Resources);
}); });
afterEach(() => { afterEach(() => {

View File

@ -18,7 +18,6 @@ beforeEach(async () => {
'@flecks/socket': require('@flecks/socket'), '@flecks/socket': require('@flecks/socket'),
}, },
}); });
await Promise.all(flecks.invokeFlat('@flecks/core.starting'));
({Entity, EntityList} = flecks.avocado.resource.Resources); ({Entity, EntityList} = flecks.avocado.resource.Resources);
}); });
afterEach(() => { afterEach(() => {

View File

@ -12,13 +12,13 @@
"client.js" "client.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@pixi/core": "^5.3.9", "@pixi/core": "^5.3.9",
"@pixi/filter-color-matrix": "^5.3.9", "@pixi/filter-color-matrix": "^5.3.9",
"webpack-glsl-loader": "^1.0.1" "webpack-glsl-loader": "^1.0.1"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -23,10 +23,10 @@
"@avocado/core": "^4.0.0", "@avocado/core": "^4.0.0",
"@avocado/math": "^4.0.0", "@avocado/math": "^4.0.0",
"@avocado/resource": "^4.0.0", "@avocado/resource": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/server": "^3.0.0", "@flecks/server": "^3.1.3",
"@flecks/web": "^3.0.0", "@flecks/web": "^3.1.3",
"@pixi/constants": "^5.3.9", "@pixi/constants": "^5.3.9",
"@pixi/core": "^5.3.9", "@pixi/core": "^5.3.9",
"@pixi/display": "^5.3.9", "@pixi/display": "^5.3.9",
@ -43,7 +43,7 @@
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -23,13 +23,13 @@
"@avocado/math": "^4.0.0", "@avocado/math": "^4.0.0",
"@avocado/timing": "^4.0.0", "@avocado/timing": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"debug": "4.3.1", "debug": "4.3.1",
"gamepads": "^1.2.2" "gamepads": "^1.2.2"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -22,13 +22,13 @@
"dependencies": { "dependencies": {
"@avocado/code": "^4.0.0", "@avocado/code": "^4.0.0",
"@avocado/react": "^4.0.0", "@avocado/react": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"graham_scan": "^1.0.4", "graham_scan": "^1.0.4",
"seedrandom": "^3.0.5" "seedrandom": "^3.0.5"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -28,9 +28,9 @@
"@avocado/resource": "^4.0.0", "@avocado/resource": "^4.0.0",
"@avocado/timing": "^4.0.0", "@avocado/timing": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"immutable": "^4.0.0-rc.12", "immutable": "^4.0.0-rc.12",
"kefir": "^3.8.8", "kefir": "^3.8.8",
@ -39,7 +39,7 @@
"proton-engine": "^5.2.7" "proton-engine": "^5.2.7"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -17,8 +17,8 @@
"index.js" "index.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"ace-builds": "^1.4.12", "ace-builds": "^1.4.12",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"react-ace": "^9.4.0", "react-ace": "^9.4.0",
@ -26,7 +26,7 @@
"react-modal": "^3.12.1" "react-modal": "^3.12.1"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -22,10 +22,10 @@
"dependencies": { "dependencies": {
"@avocado/core": "^4.0.0", "@avocado/core": "^4.0.0",
"@avocado/react": "^4.0.0", "@avocado/react": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/react-redux": "^3.0.0", "@flecks/react-redux": "^3.1.3",
"@flecks/redux": "^3.0.0", "@flecks/redux": "^3.1.3",
"deepmerge": "^4.2.2", "deepmerge": "^4.2.2",
"fast-json-patch": "^3.0.0-1", "fast-json-patch": "^3.0.0-1",
"lru-cache": "^6.0.0", "lru-cache": "^6.0.0",
@ -33,7 +33,7 @@
"styled-components": "^5.2.1" "styled-components": "^5.2.1"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -5,20 +5,17 @@ export * as JSONB from './jsonb';
export {default as JsonResource} from './json-resource'; export {default as JsonResource} from './json-resource';
export const hooks = { export const hooks = {
'@flecks/core.gathered': () => ({
resources: {
idProperty: 'resourceId',
typeProperty: 'resourceType',
},
}),
'@flecks/core.hmr': (path) => { '@flecks/core.hmr': (path) => {
if ('@avocado/resource' === path) { if ('@avocado/resource' === path) {
resourceCache.reset(); resourceCache.reset();
} }
}, },
'@flecks/core.starting': (flecks) => {
flecks.avocado.resource.Resources = flecks.gather(
'@avocado/resource.resources',
{
idProperty: 'resourceId',
typeProperty: 'resourceType',
},
);
},
}; };
export const mixin = (Flecks) => class FlecksWithAvocadoResource extends Flecks { export const mixin = (Flecks) => class FlecksWithAvocadoResource extends Flecks {
@ -31,7 +28,11 @@ export const mixin = (Flecks) => class FlecksWithAvocadoResource extends Flecks
if (!this.avocado.resource) { if (!this.avocado.resource) {
this.avocado.resource = {}; this.avocado.resource = {};
} }
this.avocado.resource.Resources = {}; Object.defineProperty(
this.avocado.resource,
'Resources',
{get: () => this.gathered('@avocado/resource.resources')},
);
} }
}; };

View File

@ -19,12 +19,12 @@
"index.js" "index.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"msgpack-lite": "^0.1.26" "msgpack-lite": "^0.1.26"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -24,14 +24,14 @@
"@avocado/react": "^4.0.0", "@avocado/react": "^4.0.0",
"@avocado/resource": "^4.0.0", "@avocado/resource": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"debug": "4.3.1", "debug": "4.3.1",
"lru-cache": "^6.0.0" "lru-cache": "^6.0.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -12,12 +12,12 @@
"index.js" "index.js"
], ],
"dependencies": { "dependencies": {
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@reduxjs/toolkit": "^1.8.1", "@reduxjs/toolkit": "^1.8.1",
"immutable": "^4.0.0" "immutable": "^4.0.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -27,13 +27,13 @@
"@avocado/react": "^4.0.0", "@avocado/react": "^4.0.0",
"@avocado/resource": "^4.0.0", "@avocado/resource": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"lodash.mapvalues": "^4.6.0" "lodash.mapvalues": "^4.6.0"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -29,16 +29,16 @@
"@avocado/s13n": "^4.0.0", "@avocado/s13n": "^4.0.0",
"@avocado/timing": "^4.0.0", "@avocado/timing": "^4.0.0",
"@avocado/traits": "^4.0.0", "@avocado/traits": "^4.0.0",
"@flecks/core": "^3.0.0", "@flecks/core": "^3.1.3",
"@flecks/react": "^3.0.0", "@flecks/react": "^3.1.3",
"@flecks/react-redux": "^3.0.0", "@flecks/react-redux": "^3.1.3",
"@flecks/redux": "^3.0.0", "@flecks/redux": "^3.1.3",
"@flecks/socket": "^3.0.0", "@flecks/socket": "^3.1.3",
"@flecks/web": "^3.0.0", "@flecks/web": "^3.1.3",
"deepmerge": "^4.2.2" "deepmerge": "^4.2.2"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -22,10 +22,10 @@
"dependencies": { "dependencies": {
"@avocado/code": "^4.0.0", "@avocado/code": "^4.0.0",
"@avocado/resource": "^4.0.0", "@avocado/resource": "^4.0.0",
"@flecks/core": "^3.0.0" "@flecks/core": "^3.1.3"
}, },
"devDependencies": { "devDependencies": {
"@flecks/build": "^3.0.0", "@flecks/build": "^3.1.3",
"@flecks/fleck": "^3.0.0" "@flecks/fleck": "^3.1.3"
} }
} }

View File

@ -2,9 +2,9 @@ export {default as Trait} from './trait';
export {default as StateProperty} from './state-property'; export {default as StateProperty} from './state-property';
export const hooks = { export const hooks = {
'@flecks/core.starting': (flecks) => { '@flecks/core.gathered': () => ({
flecks.avocado.traits.Traits = flecks.gather('@avocado/traits.traits'); traits: {},
}, }),
}; };
export const mixin = (Flecks) => class FlecksWithAvocadoTraits extends Flecks { export const mixin = (Flecks) => class FlecksWithAvocadoTraits extends Flecks {
@ -17,7 +17,11 @@ export const mixin = (Flecks) => class FlecksWithAvocadoTraits extends Flecks {
if (!this.avocado.traits) { if (!this.avocado.traits) {
this.avocado.traits = {}; this.avocado.traits = {};
} }
this.avocado.traits.Traits = {}; Object.defineProperty(
this.avocado.traits,
'Traits',
{get: () => this.gathered('@avocado/traits.traits')},
);
} }
}; };