@514labs/moose-lib 0.6.268-ci-25-gc7e0e198 → 0.6.268-ci-2-g822d274c

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.mjs CHANGED
@@ -685,6 +685,7 @@ function getSourceDir() {
685
685
  return process2.env.MOOSE_SOURCE_DIR || "app";
686
686
  }
687
687
  var isClientOnlyMode = () => process2.env.MOOSE_CLIENT_ONLY === "true";
688
+ var isProductionMode = () => process2.env.NODE_ENV === "production";
688
689
  var moose_internal = {
689
690
  tables: /* @__PURE__ */ new Map(),
690
691
  streams: /* @__PURE__ */ new Map(),
@@ -699,7 +700,11 @@ var getMooseInternal = () => globalThis.moose_internal;
699
700
  if (getMooseInternal() === void 0) {
700
701
  globalThis.moose_internal = moose_internal;
701
702
  }
702
- var loadIndex = () => {
703
+ var isRegistryEmpty = () => {
704
+ const registry = getMooseInternal();
705
+ return registry.tables.size === 0 && registry.streams.size === 0 && registry.ingestApis.size === 0 && registry.apis.size === 0 && registry.sqlResources.size === 0 && registry.workflows.size === 0 && registry.webApps.size === 0;
706
+ };
707
+ var reloadIndex = () => {
703
708
  const registry = getMooseInternal();
704
709
  registry.tables.clear();
705
710
  registry.streams.clear();
@@ -708,12 +713,14 @@ var loadIndex = () => {
708
713
  registry.sqlResources.clear();
709
714
  registry.workflows.clear();
710
715
  registry.webApps.clear();
711
- const appDir = `${process2.cwd()}/${getSourceDir()}`;
712
- Object.keys(__require.cache).forEach((key) => {
713
- if (key.startsWith(appDir)) {
714
- delete __require.cache[key];
715
- }
716
- });
716
+ if (!isProductionMode()) {
717
+ const appDir = `${process2.cwd()}/${getSourceDir()}`;
718
+ Object.keys(__require.cache).forEach((key) => {
719
+ if (key.startsWith(appDir)) {
720
+ delete __require.cache[key];
721
+ }
722
+ });
723
+ }
717
724
  try {
718
725
  __require(`${process2.cwd()}/${getSourceDir()}/index.ts`);
719
726
  } catch (error) {
@@ -727,6 +734,11 @@ var loadIndex = () => {
727
734
  throw new Error(errorMsg, { cause });
728
735
  }
729
736
  };
737
+ var ensureIndexLoaded = () => {
738
+ if (isRegistryEmpty()) {
739
+ reloadIndex();
740
+ }
741
+ };
730
742
  var dlqSchema = {
731
743
  version: "3.1",
732
744
  components: {
@@ -847,7 +859,7 @@ var dlqColumns = [
847
859
  }
848
860
  ];
849
861
  var getWorkflows = async () => {
850
- loadIndex();
862
+ ensureIndexLoaded();
851
863
  const registry = getMooseInternal();
852
864
  return registry.workflows;
853
865
  };