@lowdefy/build 0.0.0-experimental-20251203202233 → 0.0.0-experimental-20251203205559

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.
@@ -28,11 +28,14 @@ async function buildRefs({ context }) {
28
28
  changedFiles: context.changedFiles,
29
29
  dependencyGraph: context.dependencyGraph,
30
30
  parsedContentCache: context.parsedContentCache,
31
+ refCache: context.refCache,
32
+ pathToRefHashes: context.pathToRefHashes,
31
33
  logger: context.logger
32
34
  });
33
35
  }
34
36
  const refDef = makeRefDefinition('lowdefy.yaml', null, context.refMap);
35
- const refCache = new Map();
37
+ // Use persistent refCache from context for incremental builds
38
+ const refCache = context.refCache;
36
39
  let components = await profiler.time('recursiveBuild', ()=>recursiveBuild({
37
40
  context,
38
41
  refDef,
@@ -90,6 +90,13 @@ async function recursiveBuild({ context, refDef, count, referencedFrom, refCache
90
90
  return value;
91
91
  };
92
92
  refCache.set(newRefDef.hash, JSON.parse(JSON.stringify(withRefKey), reviver));
93
+ // Track path -> hash mapping for incremental invalidation
94
+ if (parsedRefDef.path) {
95
+ if (!context.pathToRefHashes.has(parsedRefDef.path)) {
96
+ context.pathToRefHashes.set(parsedRefDef.path, new Set());
97
+ }
98
+ context.pathToRefHashes.get(parsedRefDef.path).add(newRefDef.hash);
99
+ }
93
100
  });
94
101
  }
95
102
  const result = timeSync('populateRefs:final', ()=>populateRefs({
@@ -98,6 +105,13 @@ async function recursiveBuild({ context, refDef, count, referencedFrom, refCache
98
105
  refDef
99
106
  }));
100
107
  refCache.set(refDef.hash, result);
108
+ // Track path -> hash mapping for the current file
109
+ if (refDef.path) {
110
+ if (!context.pathToRefHashes.has(refDef.path)) {
111
+ context.pathToRefHashes.set(refDef.path, new Set());
112
+ }
113
+ context.pathToRefHashes.get(refDef.path).add(refDef.hash);
114
+ }
101
115
  return result;
102
116
  }
103
117
  export default recursiveBuild;
@@ -28,6 +28,8 @@ function createContext({ customTypesMap, directories, logger, refResolver, stage
28
28
  // Otherwise create fresh Maps
29
29
  const dependencyGraph = buildState?.dependencyGraph ?? new Map();
30
30
  const parsedContentCache = buildState?.parsedContentCache ?? new Map();
31
+ const refCache = buildState?.refCache ?? new Map();
32
+ const pathToRefHashes = buildState?.pathToRefHashes ?? new Map();
31
33
  const context = {
32
34
  changedFiles,
33
35
  dependencyGraph,
@@ -37,9 +39,11 @@ function createContext({ customTypesMap, directories, logger, refResolver, stage
37
39
  logger,
38
40
  operatorsParser,
39
41
  parsedContentCache,
42
+ pathToRefHashes,
40
43
  readConfigFile: createReadConfigFile({
41
44
  directories
42
45
  }),
46
+ refCache,
43
47
  refMap: {},
44
48
  refResolver,
45
49
  stage,