expo-modules-autolinking 3.0.16 → 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 +6 -0
- package/build/fileUtils.d.ts +3 -3
- package/build/fileUtils.js +13 -4
- package/build/fileUtils.js.map +1 -1
- package/package.json +2 -2
- package/src/fileUtils.ts +16 -7
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,12 @@
|
|
|
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
|
+
|
|
13
19
|
## 3.0.16 — 2025-10-20
|
|
14
20
|
|
|
15
21
|
### 🐛 Bug fixes
|
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,7 +19,10 @@ 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
28
|
for await (const globPath of globStream) {
|
|
@@ -42,10 +45,16 @@ async function globMatchFunctorAllAsync(globPattern, matchFunctor, options) {
|
|
|
42
45
|
* Search files that match the glob pattern and return the first match from the matchFunctor.
|
|
43
46
|
*/
|
|
44
47
|
async function globMatchFunctorFirstAsync(globPattern, matchFunctor, options) {
|
|
45
|
-
const globStream = glob_1.glob.stream(globPattern, {
|
|
48
|
+
const globStream = glob_1.glob.stream(globPattern, {
|
|
49
|
+
...options,
|
|
50
|
+
withFileTypes: true,
|
|
51
|
+
});
|
|
46
52
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
47
|
-
for await (const
|
|
48
|
-
|
|
53
|
+
for await (const globPath of globStream) {
|
|
54
|
+
if (!globPath.isFile()) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
let filePath = globPath.fullpath();
|
|
49
58
|
if (!path_1.default.isAbsolute(filePath)) {
|
|
50
59
|
filePath = path_1.default.resolve(cwd, filePath);
|
|
51
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,GAAG,QAAQ,CAAC,QAAQ,EAAE,CAAC;QACnC,IAAI,CAAC,cAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YAC/B,QAAQ,GAAG,cAAI,CAA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AE,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
|
}
|
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,9 +20,12 @@ 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
31
|
for await (const globPath of globStream) {
|
|
@@ -48,12 +51,18 @@ export async function globMatchFunctorAllAsync(
|
|
|
48
51
|
export async function globMatchFunctorFirstAsync(
|
|
49
52
|
globPattern: string,
|
|
50
53
|
matchFunctor: MatchFunctor,
|
|
51
|
-
options?: GlobOptions
|
|
54
|
+
options?: Omit<GlobOptions, 'withFileTypes'>
|
|
52
55
|
): Promise<string | null> {
|
|
53
|
-
const globStream = glob.stream(globPattern, {
|
|
56
|
+
const globStream = glob.stream(globPattern, {
|
|
57
|
+
...options,
|
|
58
|
+
withFileTypes: true,
|
|
59
|
+
} as GlobOptionsWithFileTypesTrue);
|
|
54
60
|
const cwd = options?.cwd !== undefined ? `${options.cwd}` : process.cwd();
|
|
55
|
-
for await (const
|
|
56
|
-
|
|
61
|
+
for await (const globPath of globStream) {
|
|
62
|
+
if (!globPath.isFile()) {
|
|
63
|
+
continue;
|
|
64
|
+
}
|
|
65
|
+
let filePath = globPath.fullpath();
|
|
57
66
|
if (!path.isAbsolute(filePath)) {
|
|
58
67
|
filePath = path.resolve(cwd, filePath);
|
|
59
68
|
}
|