@mintlify/previewing 4.0.959 → 4.0.961

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.
@@ -1,10 +1,9 @@
1
- import { findAndRemoveImports, replaceVariables, stringifyTree, topologicalSort, hasImports, optionallyAddLeadingSlash, optionallyRemoveLeadingSlash, resolveImportPath, } from '@mintlify/common';
1
+ import { findAndRemoveImports, stringifyTree, topologicalSort, hasImports, optionallyAddLeadingSlash, optionallyRemoveLeadingSlash, resolveImportPath, } from '@mintlify/common';
2
2
  import { outputFile } from 'fs-extra';
3
3
  import { join } from 'path';
4
4
  import { NEXT_PUBLIC_PATH } from '../../constants.js';
5
5
  import { getOriginalSnippets } from './getSnippets.js';
6
6
  import { resolveAllImports } from './resolveAllImports.js';
7
- import { getCurrentVariables } from './utils.js';
8
7
  const findAllDependents = async (initialFileWithSlash, allSnippets, processedDataCache) => {
9
8
  const affected = new Set([initialFileWithSlash]);
10
9
  const queue = [initialFileWithSlash];
@@ -36,11 +35,7 @@ const findAllDependents = async (initialFileWithSlash, allSnippets, processedDat
36
35
  };
37
36
  export const generateDependentSnippets = async (changedFilename, newImportData) => {
38
37
  const processedDataCache = new Map();
39
- const [allOriginalSnippets, variables] = await Promise.all([
40
- getOriginalSnippets(),
41
- getCurrentVariables(),
42
- ]);
43
- const vars = variables ?? {};
38
+ const allOriginalSnippets = await getOriginalSnippets();
44
39
  const updatedSnippetFileKey = optionallyAddLeadingSlash(changedFilename);
45
40
  const affectedSnippets = await findAllDependents(updatedSnippetFileKey, allOriginalSnippets, processedDataCache);
46
41
  const snippetPromises = Array.from(affectedSnippets).map(async (filename) => {
@@ -87,9 +82,7 @@ export const generateDependentSnippets = async (changedFilename, newImportData)
87
82
  }
88
83
  const targetFilename = optionallyRemoveLeadingSlash(currentSnippet.filename);
89
84
  const targetPath = join(NEXT_PUBLIC_PATH, targetFilename);
90
- await outputFile(targetPath, replaceVariables(stringifyTree(processedTree), vars), {
91
- flag: 'w',
92
- });
85
+ await outputFile(targetPath, stringifyTree(processedTree), { flag: 'w' });
93
86
  processedSnippets.push(targetFilename);
94
87
  }
95
88
  return processedSnippets;
@@ -201,9 +201,7 @@ const onUpdateEvent = async (filename, callback, options = {}) => {
201
201
  break;
202
202
  }
203
203
  case 'snippet': {
204
- const variables = await getCurrentVariables();
205
- const rawContent = (await readFile(filePath)).toString();
206
- await fse.outputFile(targetPath, replaceVariables(rawContent, variables), { flag: 'w' });
204
+ await fse.copy(filePath, targetPath);
207
205
  break;
208
206
  }
209
207
  case 'snippet-v2': {