rwsdk 0.1.0-alpha.5 → 0.1.0-alpha.6
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/lib/getSrcPaths.js
CHANGED
|
@@ -6,6 +6,7 @@ import debug from "debug";
|
|
|
6
6
|
import { normalizeModulePath } from "./normalizeModulePath.mjs";
|
|
7
7
|
import { ensureAliasArray } from "./ensureAliasArray.mjs";
|
|
8
8
|
import { pathExists } from "fs-extra";
|
|
9
|
+
import { stat } from "fs/promises";
|
|
9
10
|
import { getSrcPaths } from "../lib/getSrcPaths.js";
|
|
10
11
|
export const findFilesContainingDirective = async ({ projectRootDir, files, directive, debugNamespace, }) => {
|
|
11
12
|
const log = debug(debugNamespace);
|
|
@@ -15,11 +16,17 @@ export const findFilesContainingDirective = async ({ projectRootDir, files, dire
|
|
|
15
16
|
const filesInsideNodeModules = await glob("**/node_modules/**/*.{js,mjs,cjs}", {
|
|
16
17
|
cwd: projectRootDir,
|
|
17
18
|
absolute: true,
|
|
19
|
+
nodir: true,
|
|
18
20
|
});
|
|
19
21
|
const allFiles = [...filesOutsideNodeModules, ...filesInsideNodeModules];
|
|
20
22
|
log("Found %d files to scan for '%s' directive", allFiles.length, directive);
|
|
21
23
|
for (const file of allFiles) {
|
|
22
24
|
try {
|
|
25
|
+
const stats = await stat(file);
|
|
26
|
+
if (!stats.isFile()) {
|
|
27
|
+
verboseLog("Skipping %s (not a file)", file);
|
|
28
|
+
continue;
|
|
29
|
+
}
|
|
23
30
|
verboseLog("Scanning file: %s", file);
|
|
24
31
|
const content = await readFile(file, "utf-8");
|
|
25
32
|
const lines = content.split("\n");
|