expo-modules-autolinking 3.0.15 → 3.0.17
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/CHANGELOG.md +13 -0
- package/build/dependencies/utils.d.ts +0 -1
- package/build/dependencies/utils.js +0 -3
- package/build/dependencies/utils.js.map +1 -1
- package/build/fileUtils.d.ts +3 -3
- package/build/fileUtils.js +18 -6
- package/build/fileUtils.js.map +1 -1
- package/package.json +2 -2
- package/src/dependencies/utils.ts +1 -3
- package/src/fileUtils.ts +21 -9
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,19 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 3.0.17 — 2025-10-21
|
|
14
|
+
|
|
15
|
+
### 🐛 Bug fixes
|
|
16
|
+
|
|
17
|
+
- fix globMatchFunctorAllAsync to check if globbed path is a file to prevent errors ([#40437](https://github.com/expo/expo/pull/40437) by [@artus9033](https://github.com/artus9033)) ([#40501](https://github.com/expo/expo/pull/40501) by [@kitten](https://github.com/kitten))
|
|
18
|
+
|
|
19
|
+
## 3.0.16 — 2025-10-20
|
|
20
|
+
|
|
21
|
+
### 🐛 Bug fixes
|
|
22
|
+
|
|
23
|
+
- Ignore missing `package.json` name property when scanning dependencies ([#40367](https://github.com/expo/expo/pull/40367) by [@kitten](https://github.com/kitten))
|
|
24
|
+
- fix globMatchFunctorAllAsync to check if globbed path is a file to prevent errors ([#40437](https://github.com/expo/expo/pull/40437) by [@artus9033](https://github.com/artus9033))
|
|
25
|
+
|
|
13
26
|
## 3.0.15 — 2025-10-09
|
|
14
27
|
|
|
15
28
|
### 🐛 Bug fixes
|
|
@@ -3,7 +3,6 @@ export declare function defaultShouldIncludeDependency(dependencyName: string):
|
|
|
3
3
|
export declare const fastJoin: (from: string, append: string) => string;
|
|
4
4
|
export declare const maybeRealpath: (target: string) => Promise<string | null>;
|
|
5
5
|
export type PackageJson = Record<string, unknown> & {
|
|
6
|
-
name: string;
|
|
7
6
|
version?: string;
|
|
8
7
|
};
|
|
9
8
|
export declare const loadPackageJson: (input: string, ...args: any[]) => Promise<any>;
|
|
@@ -56,9 +56,6 @@ exports.loadPackageJson = (0, utils_1.memoize)(async function loadPackageJson(js
|
|
|
56
56
|
if (typeof json !== 'object' || json == null) {
|
|
57
57
|
return null;
|
|
58
58
|
}
|
|
59
|
-
else if (typeof json.name !== 'string' || !json.name) {
|
|
60
|
-
return null;
|
|
61
|
-
}
|
|
62
59
|
return json;
|
|
63
60
|
}
|
|
64
61
|
catch {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/dependencies/utils.ts"],"names":[],"mappings":";;;;;;AASA,wEA0BC;
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/dependencies/utils.ts"],"names":[],"mappings":";;;;;;AASA,wEA0BC;AAiCD,gDA4CC;AAED,8DAkBC;AAED,wDAiBC;AAvJD,4CAAoB;AACpB,gDAAwB;AAExB,oCAAmC;AAGnC,MAAM,oBAAoB,GAAG,GAAG,cAAI,CAAC,GAAG,eAAe,cAAI,CAAC,GAAG,EAAE,CAAC;AAElE,oGAAoG;AACpG,SAAgB,8BAA8B,CAAC,cAAsB;IACnE,MAAM,SAAS,GACb,cAAc,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC1F,IACE,SAAS,KAAK,OAAO;QACrB,SAAS,KAAK,OAAO;QACrB,SAAS,KAAK,QAAQ;QACtB,SAAS,KAAK,mBAAmB,EACjC,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,QAAQ,cAAc,EAAE,CAAC;QACvB,KAAK,WAAW,CAAC;QACjB,KAAK,cAAc,CAAC;QACpB,KAAK,oBAAo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,CAAC;QACvC,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,SAAgB,sBAAsB,CAAC,OAA2B;IAChE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,OAAO,CAAC,CAAC,CAAC,CAAC;IACpB,CAAC;IACD,MAAM,MAAM,GAAqB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACrD,KAAK,IAAI,GAAG,GAAG,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE,CAAC;QAC9C,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;YAC/B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,GAAG,CAAE,CAAC;YACtC,MAAM,cAAc,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;YACnC,IAAI,cAAc,IAAI,IAAI,EAAE,CAAC;gBAC3B,MAAM,CAAC,GAAG,CAAC,GAAG,kBAAkB,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;YAC/D,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,GAAG,CAAC,GAAG,UAAU,CAAC;YAC3B,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["import fs from 'fs';\nimport path from 'path';\n\nimport { memoize } from '../utils';\nimport type { DependencyResolution, ResolutionResult } from './types';\n\nconst NODE_MODULES_PATTERN = `${path.sep}node_modules${path.sep}`;\n\n// The default dependencies we exclude don't contain dependency chains leading to autolinked modules\nexport function defaultShouldIncludeDependency(dependencyName: string): boolean {\n const scopeName =\n dependencyName[0] === '@' ? dependencyName.slice(1, dependencyName.indexOf('/')) : null;\n if (\n scopeName === 'babel' ||\n scopeName === 'types' ||\n scopeName === 'eslint' ||\n scopeName === 'typescript-eslint'\n ) {\n return false;\n }\n switch (dependencyName) {\n case '@expo/cli':\n case '@expo/config':\n case '@expo/metro-config':\n case '@expo/package-manager':\n case '@expo/prebuild-config':\n case '@expo/env':\n case '@react-native/codegen':\n case 'eslint':\n case 'eslint-config-expo':\n case 'eslint-plugin-expo':\n return false;\n default:\n return true;\n }\n}\n\nexport const fastJoin: (from: string, append: string) => string =\n path.sep === '/'\n ? (from, append) => `${from}${path.sep}${append}`\n : (from, append) =>\n `${from}${path.sep}${append[0] === '@' ? append.replace('/', path.sep) : append}`;\n\nexport const maybeRealpath = async (target: string): Promise<string | null> => {\n try {\n return await fs.promises.realpath(target);\n } catch {\n return null;\n }\n};\n\nexport type PackageJson = Record<string, unknown> & { version?: string };\n\nexport const loadPackageJson = memoize(async function loadPackageJson(\n jsonPath: string\n): Promise<PackageJson | null> {\n try {\n const packageJsonText = await fs.promises.readFile(jsonPath, 'utf8');\n const json = JSON.parse(packageJsonText);\n if (typeof json !== 'object' || json == null) {\n return null;\n }\n return json;\n } catch {\n return null;\n }\n});\n\nexport function mergeWithDuplicate(\n a: DependencyResolution,\n b: DependencyResolution\n): DependencyResolution {\n let target: DependencyResolution;\n let duplicate: DependencyResolution;\n if (a.depth < b.depth) {\n target = a;\n duplicate = b;\n } else if (b.depth < a.depth) {\n target = b;\n duplicate = a;\n } else {\n // If both are equal, then the shallowest path wins\n const pathDepthA = a.originPath.split(NODE_MODULES_PATTERN).length;\n const pathDepthB = b.originPath.split(NODE_MODULES_PATTERN).length;\n if (pathDepthA < pathDepthB) {\n target = a;\n duplicate = b;\n } else if (pathDepthB < pathDepthA) {\n target = b;\n duplicate = a;\n } else {\n target = a;\n duplicate = b;\n }\n }\n const duplicates = target.duplicates || (target.duplicates = []);\n if (target.path !== duplicate.path) {\n duplicates.push({\n name: duplicate.name,\n version: duplicate.version,\n path: duplicate.path,\n originPath: duplicate.originPath,\n });\n }\n if (duplicate.duplicates?.length) {\n duplicates.push(\n ...duplicate.duplicates.filter((child) =>\n duplicates.every((parent) => parent.path !== child.path)\n )\n );\n }\n return target;\n}\n\nexport async function filterMapResolutionResult<T extends { name: string }>(\n results: ResolutionResult,\n filterMap: (resolution: DependencyResolution) => Promise<T | null> | T | null\n): Promise<Record<string, T>> {\n const resolutions = await Promise.all(\n Object.keys(results).map(async (key) => {\n const resolution = results[key];\n return resolution ? await filterMap(resolution) : null;\n })\n );\n const output: Record<string, T> = Object.create(null);\n for (let idx = 0; idx < resolutions.length; idx++) {\n const resolution = resolutions[idx];\n if (resolution != null) {\n output[resolution.name] = resolution;\n }\n }\n return output;\n}\n\nexport function mergeResolutionResults(results: ResolutionResult[]) {\n if (results.length === 1) {\n return results[0];\n }\n const output: ResolutionResult = Object.create(null);\n for (let idx = 0; idx < results.length; idx++) {\n for (const key in results[idx]) {\n const resolution = results[idx][key]!;\n const prevResolution = output[key];\n if (prevResolution != null) {\n output[key] = mergeWithDuplicate(prevResolution, resolution);\n } else {\n output[key] = resolution;\n }\n }\n }\n return output;\n}\n"]}
|
package/build/fileUtils.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { GlobOptions } from 'glob';
|
|
1
|
+
import { type GlobOptions } from 'glob';
|
|
2
2
|
/**
|
|
3
3
|
* A matching function that takes a file path and its contents and returns a string if it matches, or null otherwise.
|
|
4
4
|
*/
|
|
@@ -10,9 +10,9 @@ export declare function fileExistsAsync(file: string): Promise<boolean>;
|
|
|
10
10
|
/**
|
|
11
11
|
* Search files that match the glob pattern and return all matches from the matchFunctor.
|
|
12
12
|
*/
|
|
13
|
-
export declare function globMatchFunctorAllAsync(globPattern: string, matchFunctor: MatchFunctor, options?: GlobOptions): Promise<string[]>;
|
|
13
|
+
export declare function globMatchFunctorAllAsync(globPattern: string, matchFunctor: MatchFunctor, options?: Omit<GlobOptions, 'withFileTypes'>): Promise<string[]>;
|
|
14
14
|
/**
|
|
15
15
|
* Search files that match the glob pattern and return the first match from the matchFunctor.
|
|
16
16
|
*/
|
|
17
|
-
export declare function globMatchFunctorFirstAsync(globPattern: string, matchFunctor: MatchFunctor, options?: GlobOptions): Promise<string | null>;
|
|
17
|
+
export declare function globMatchFunctorFirstAsync(globPattern: string, matchFunctor: MatchFunctor, options?: Omit<GlobOptions, 'withFileTypes'>): Promise<string | null>;
|
|
18
18
|
export {};
|
package/build/fileUtils.js
CHANGED
|
@@ -19,11 +19,17 @@ async function fileExistsAsync(file) {
|
|
|
19
19
|
* Search files that match the glob pattern and return all matches from the matchFunctor.
|
|
20
20
|
*/
|
|
21
21
|
async function globMatchFunctorAllAsync(globPattern, matchFunctor, options) {
|
|
22
|
-
const globStream = glob_1.glob.stream(globPattern, {
|
|
22
|
+
const globStream = glob_1.glob.stream(globPattern, {
|
|
23
|
+
...options,
|
|
24
|
+
withFileTypes: true,
|
|
25
|
+
});
|
|
23
26
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
24
27
|
const results = [];
|
|
25
|
-
for await (const
|
|
26
|
-
|
|
28
|
+
for await (const globPath of globStream) {
|
|
29
|
+
if (!globPath.isFile()) {
|
|
30
|
+
continue;
|
|
31
|
+
}
|
|
32
|
+
let filePath = globPath.fullpath();
|
|
27
33
|
if (!path_1.default.isAbsolute(filePath)) {
|
|
28
34
|
filePath = path_1.default.resolve(cwd, filePath);
|
|
29
35
|
}
|
|
@@ -39,10 +45,16 @@ async function globMatchFunctorAllAsync(globPattern, matchFunctor, options) {
|
|
|
39
45
|
* Search files that match the glob pattern and return the first match from the matchFunctor.
|
|
40
46
|
*/
|
|
41
47
|
async function globMatchFunctorFirstAsync(globPattern, matchFunctor, options) {
|
|
42
|
-
const globStream = glob_1.glob.stream(globPattern, {
|
|
48
|
+
const globStream = glob_1.glob.stream(globPattern, {
|
|
49
|
+
...options,
|
|
50
|
+
withFileTypes: true,
|
|
51
|
+
});
|
|
43
52
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
44
|
-
for await (const
|
|
45
|
-
|
|
53
|
+
for await (const globPath of globStream) {
|
|
54
|
+
if (!globPath.isFile()) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
let filePath = globPath.fullpath();
|
|
46
58
|
if (!path_1.default.isAbsolute(filePath)) {
|
|
47
59
|
filePath = path_1.default.resolve(cwd, filePath);
|
|
48
60
|
}
|
package/build/fileUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../src/fileUtils.ts"],"names":[],"mappings":";;;;;AAYA,0CAEC;AAKD,
|
|
1
|
+
{"version":3,"file":"fileUtils.js","sourceRoot":"","sources":["../src/fileUtils.ts"],"names":[],"mappings":";;;;;AAYA,0CAEC;AAKD,4DA0BC;AAKD,gEAyBC;AA3ED,2DAA6B;AAC7B,+BAAiF;AACjF,gDAAwB;AAOxB;;GAEG;AACI,KAAK,UAAU,eAAe,CAAC,IAAY;IAChD,OAAO,CAAC,MAAM,kBAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,KAAK,CAAC;AACpE,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,wBAAwB,CAC5C,WAAmB,EACnB,YAA0B,EAC1B,OAA4C;IAE5C,MAAM,UAAU,GAAG,WAAI,CAAC,MAAM,CAAC,WAAW,EAAE;QAC1C,GAAG,OAAO;QACV,aAAa,EAAE,IAAI;KACY,CAAC,CAAC;IACnC,MAAM,GAAG,GAAG,OAAO,EAAE,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1E,MAAM,OAAO,GAAa,EAAE,CAAC;IAC7B,IAAI,KAAK,EAAE,MAAM,QAAQ,IAAI,UAAU,EAAE,CAAC;QACxC,IAAI,CAAC,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAC;YACvB,SAAS;QACX,CAAC;QACD,IAAI,QAAQ,GA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AAQ,CAAC,QAAQ,CAAC,CAAC;QAC7C,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC;QACjD,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;YACpB,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import fs from 'fs/promises';\nimport { glob, type GlobOptions, type GlobOptionsWithFileTypesTrue } from 'glob';\nimport path from 'path';\n\n/**\n * A matching function that takes a file path and its contents and returns a string if it matches, or null otherwise.\n */\ntype MatchFunctor = (filePath: string, contents: Buffer) => string | null;\n\n/**\n * Check if the file exists.\n */\nexport async function fileExistsAsync(file: string): Promise<boolean> {\n return (await fs.stat(file).catch(() => null))?.isFile() ?? false;\n}\n\n/**\n * Search files that match the glob pattern and return all matches from the matchFunctor.\n */\nexport async function globMatchFunctorAllAsync(\n globPattern: string,\n matchFunctor: MatchFunctor,\n options?: Omit<GlobOptions, 'withFileTypes'>\n): Promise<string[]> {\n const globStream = glob.stream(globPattern, {\n ...options,\n withFileTypes: true,\n } as GlobOptionsWithFileTypesTrue);\n const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();\n const results: string[] = [];\n for await (const globPath of globStream) {\n if (!globPath.isFile()) {\n continue;\n }\n let filePath = globPath.fullpath();\n if (!path.isAbsolute(filePath)) {\n filePath = path.resolve(cwd, filePath);\n }\n const contents = await fs.readFile(filePath);\n const matched = matchFunctor(filePath, contents);\n if (matched != null) {\n results.push(matched);\n }\n }\n return results;\n}\n\n/**\n * Search files that match the glob pattern and return the first match from the matchFunctor.\n */\nexport async function globMatchFunctorFirstAsync(\n globPattern: string,\n matchFunctor: MatchFunctor,\n options?: Omit<GlobOptions, 'withFileTypes'>\n): Promise<string | null> {\n const globStream = glob.stream(globPattern, {\n ...options,\n withFileTypes: true,\n } as GlobOptionsWithFileTypesTrue);\n const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();\n for await (const globPath of globStream) {\n if (!globPath.isFile()) {\n continue;\n }\n let filePath = globPath.fullpath();\n if (!path.isAbsolute(filePath)) {\n filePath = path.resolve(cwd, filePath);\n }\n const contents = await fs.readFile(filePath);\n const matched = matchFunctor(filePath, contents);\n if (matched != null) {\n return matched;\n }\n }\n return null;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-modules-autolinking",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.17",
|
|
4
4
|
"description": "Scripts that autolink Expo modules.",
|
|
5
5
|
"main": "build/index.js",
|
|
6
6
|
"types": "build/index.d.ts",
|
|
@@ -46,5 +46,5 @@
|
|
|
46
46
|
"require-from-string": "^2.0.2",
|
|
47
47
|
"resolve-from": "^5.0.0"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "dbb1e7d24b4a668336e3ad34a4fb0ca4fafdf191"
|
|
50
50
|
}
|
|
@@ -49,7 +49,7 @@ export const maybeRealpath = async (target: string): Promise<string | null> => {
|
|
|
49
49
|
}
|
|
50
50
|
};
|
|
51
51
|
|
|
52
|
-
export type PackageJson = Record<string, unknown> & {
|
|
52
|
+
export type PackageJson = Record<string, unknown> & { version?: string };
|
|
53
53
|
|
|
54
54
|
export const loadPackageJson = memoize(async function loadPackageJson(
|
|
55
55
|
jsonPath: string
|
|
@@ -59,8 +59,6 @@ export const loadPackageJson = memoize(async function loadPackageJson(
|
|
|
59
59
|
const json = JSON.parse(packageJsonText);
|
|
60
60
|
if (typeof json !== 'object' || json == null) {
|
|
61
61
|
return null;
|
|
62
|
-
} else if (typeof json.name !== 'string' || !json.name) {
|
|
63
|
-
return null;
|
|
64
62
|
}
|
|
65
63
|
return json;
|
|
66
64
|
} catch {
|
package/src/fileUtils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import fs from 'fs/promises';
|
|
2
|
-
import { glob, GlobOptions } from 'glob';
|
|
2
|
+
import { glob, type GlobOptions, type GlobOptionsWithFileTypesTrue } from 'glob';
|
|
3
3
|
import path from 'path';
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -20,13 +20,19 @@ export async function fileExistsAsync(file: string): Promise<boolean> {
|
|
|
20
20
|
export async function globMatchFunctorAllAsync(
|
|
21
21
|
globPattern: string,
|
|
22
22
|
matchFunctor: MatchFunctor,
|
|
23
|
-
options?: GlobOptions
|
|
23
|
+
options?: Omit<GlobOptions, 'withFileTypes'>
|
|
24
24
|
): Promise<string[]> {
|
|
25
|
-
const globStream = glob.stream(globPattern, {
|
|
25
|
+
const globStream = glob.stream(globPattern, {
|
|
26
|
+
...options,
|
|
27
|
+
withFileTypes: true,
|
|
28
|
+
} as GlobOptionsWithFileTypesTrue);
|
|
26
29
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
27
30
|
const results: string[] = [];
|
|
28
|
-
for await (const
|
|
29
|
-
|
|
31
|
+
for await (const globPath of globStream) {
|
|
32
|
+
if (!globPath.isFile()) {
|
|
33
|
+
continue;
|
|
34
|
+
}
|
|
35
|
+
let filePath = globPath.fullpath();
|
|
30
36
|
if (!path.isAbsolute(filePath)) {
|
|
31
37
|
filePath = path.resolve(cwd, filePath);
|
|
32
38
|
}
|
|
@@ -45,12 +51,18 @@ export async function globMatchFunctorAllAsync(
|
|
|
45
51
|
export async function globMatchFunctorFirstAsync(
|
|
46
52
|
globPattern: string,
|
|
47
53
|
matchFunctor: MatchFunctor,
|
|
48
|
-
options?: GlobOptions
|
|
54
|
+
options?: Omit<GlobOptions, 'withFileTypes'>
|
|
49
55
|
): Promise<string | null> {
|
|
50
|
-
const globStream = glob.stream(globPattern, {
|
|
56
|
+
const globStream = glob.stream(globPattern, {
|
|
57
|
+
...options,
|
|
58
|
+
withFileTypes: true,
|
|
59
|
+
} as GlobOptionsWithFileTypesTrue);
|
|
51
60
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
52
|
-
for await (const
|
|
53
|
-
|
|
61
|
+
for await (const globPath of globStream) {
|
|
62
|
+
if (!globPath.isFile()) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let filePath = globPath.fullpath();
|
|
54
66
|
if (!path.isAbsolute(filePath)) {
|
|
55
67
|
filePath = path.resolve(cwd, filePath);
|
|
56
68
|
}
|