@prisma/schema-files-loader 7.9.0-dev.26 → 7.9.0-dev.28
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.d.ts +5 -0
- package/dist/index.js +9 -4
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,11 @@ export declare type FsEntryType = {
|
|
|
30
30
|
kind: 'file';
|
|
31
31
|
} | {
|
|
32
32
|
kind: 'directory';
|
|
33
|
+
/**
|
|
34
|
+
* Canonical path of the directory, if the resolver is able to provide one.
|
|
35
|
+
* Used for detecting directories that are reachable from themselves through symlinks.
|
|
36
|
+
*/
|
|
37
|
+
realPath?: string;
|
|
33
38
|
} | {
|
|
34
39
|
kind: 'symlink';
|
|
35
40
|
realPath: string;
|
package/dist/index.js
CHANGED
|
@@ -179,7 +179,7 @@ var realFsResolver = {
|
|
|
179
179
|
return { kind: "file" };
|
|
180
180
|
}
|
|
181
181
|
if (stat.isDirectory()) {
|
|
182
|
-
return { kind: "directory" };
|
|
182
|
+
return { kind: "directory", realPath: await import_fs_extra.default.realpath(path3) };
|
|
183
183
|
}
|
|
184
184
|
if (stat.isSymbolicLink()) {
|
|
185
185
|
return { kind: "symlink", realPath: await import_fs_extra.default.realpath(path3) };
|
|
@@ -196,14 +196,14 @@ async function loadSchemaFiles(folderPath, filesResolver = realFsResolver) {
|
|
|
196
196
|
const type = await filesResolver.getEntryType(folderPath);
|
|
197
197
|
return processEntry(folderPath, type, filesResolver);
|
|
198
198
|
}
|
|
199
|
-
async function processEntry(entryPath, entryType, filesResolver) {
|
|
199
|
+
async function processEntry(entryPath, entryType, filesResolver, visitedDirs = /* @__PURE__ */ new Set()) {
|
|
200
200
|
if (!entryType) {
|
|
201
201
|
return [];
|
|
202
202
|
}
|
|
203
203
|
if (entryType.kind === "symlink") {
|
|
204
204
|
const realPath = entryType.realPath;
|
|
205
205
|
const realType = await filesResolver.getEntryType(realPath);
|
|
206
|
-
return processEntry(realPath, realType, filesResolver);
|
|
206
|
+
return processEntry(realPath, realType, filesResolver, visitedDirs);
|
|
207
207
|
}
|
|
208
208
|
if (entryType.kind === "file") {
|
|
209
209
|
if (import_node_path.default.extname(entryPath) !== ".prisma") {
|
|
@@ -216,12 +216,17 @@ async function processEntry(entryPath, entryType, filesResolver) {
|
|
|
216
216
|
return [[entryPath, content]];
|
|
217
217
|
}
|
|
218
218
|
if (entryType.kind === "directory") {
|
|
219
|
+
const dirId = entryType.realPath ?? entryPath;
|
|
220
|
+
if (visitedDirs.has(dirId)) {
|
|
221
|
+
return [];
|
|
222
|
+
}
|
|
223
|
+
visitedDirs.add(dirId);
|
|
219
224
|
const dirEntries = await filesResolver.listDirContents(entryPath);
|
|
220
225
|
const nested = await Promise.all(
|
|
221
226
|
dirEntries.map(async (dirEntry) => {
|
|
222
227
|
const fullPath = import_node_path.default.join(entryPath, dirEntry);
|
|
223
228
|
const nestedEntryType = await filesResolver.getEntryType(fullPath);
|
|
224
|
-
return processEntry(fullPath, nestedEntryType, filesResolver);
|
|
229
|
+
return processEntry(fullPath, nestedEntryType, filesResolver, visitedDirs);
|
|
225
230
|
})
|
|
226
231
|
);
|
|
227
232
|
return nested.flat();
|
package/package.json
CHANGED