@chromahq/core 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1197,8 +1197,8 @@ class ApplicationBootstrap {
1197
1197
  }) {
1198
1198
  try {
1199
1199
  this.logger.info("\u{1F680} Starting Chroma application bootstrap...");
1200
- await this.discoverServices();
1201
1200
  await this.discoverAndInitializeStores();
1201
+ await this.discoverServices();
1202
1202
  await this.validateDependencies();
1203
1203
  await this.registerServices();
1204
1204
  await this.registerMessages();
@@ -1270,8 +1270,15 @@ class ApplicationBootstrap {
1270
1270
  this.logger.info(`Initializing ${this.storeDefinitions.length} store(s)...`);
1271
1271
  const chromaGlobal = globalThis.__CHROMA__;
1272
1272
  if (chromaGlobal?.initStores && typeof chromaGlobal.initStores === "function") {
1273
+ let isFirstStore = true;
1273
1274
  for (const store of this.storeDefinitions) {
1274
- const { classes } = await chromaGlobal.initStores(store);
1275
+ const { classes, store: storeInstance } = await chromaGlobal.initStores(store);
1276
+ const diKey = `CentralStore:${store.name}`;
1277
+ container.bind(diKey).toConstantValue(storeInstance);
1278
+ if (isFirstStore) {
1279
+ container.bind("CentralStore").toConstantValue(storeInstance);
1280
+ isFirstStore = false;
1281
+ }
1275
1282
  this.registerMessageClass(classes.GetStoreStateMessage, `store:${store.name}:getState`);
1276
1283
  this.registerMessageClass(classes.SetStoreStateMessage, `store:${store.name}:setState`);
1277
1284
  this.registerMessageClass(
package/dist/index.es.js CHANGED
@@ -1195,8 +1195,8 @@ class ApplicationBootstrap {
1195
1195
  }) {
1196
1196
  try {
1197
1197
  this.logger.info("\u{1F680} Starting Chroma application bootstrap...");
1198
- await this.discoverServices();
1199
1198
  await this.discoverAndInitializeStores();
1199
+ await this.discoverServices();
1200
1200
  await this.validateDependencies();
1201
1201
  await this.registerServices();
1202
1202
  await this.registerMessages();
@@ -1268,8 +1268,15 @@ class ApplicationBootstrap {
1268
1268
  this.logger.info(`Initializing ${this.storeDefinitions.length} store(s)...`);
1269
1269
  const chromaGlobal = globalThis.__CHROMA__;
1270
1270
  if (chromaGlobal?.initStores && typeof chromaGlobal.initStores === "function") {
1271
+ let isFirstStore = true;
1271
1272
  for (const store of this.storeDefinitions) {
1272
- const { classes } = await chromaGlobal.initStores(store);
1273
+ const { classes, store: storeInstance } = await chromaGlobal.initStores(store);
1274
+ const diKey = `CentralStore:${store.name}`;
1275
+ container.bind(diKey).toConstantValue(storeInstance);
1276
+ if (isFirstStore) {
1277
+ container.bind("CentralStore").toConstantValue(storeInstance);
1278
+ isFirstStore = false;
1279
+ }
1273
1280
  this.registerMessageClass(classes.GetStoreStateMessage, `store:${store.name}:getState`);
1274
1281
  this.registerMessageClass(classes.SetStoreStateMessage, `store:${store.name}:setState`);
1275
1282
  this.registerMessageClass(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@chromahq/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Core library for building Chrome extensions with Chroma framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.cjs.js",