payload 3.40.0-canary.0 → 3.40.0-internal.e3ed6ab
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/utilities/findUp.js
CHANGED
|
@@ -19,7 +19,7 @@ import path from 'path';
|
|
|
19
19
|
break;
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
|
-
if (!found) {
|
|
22
|
+
if (!found && dir !== root) {
|
|
23
23
|
dir = path.dirname(dir) // Move up one directory level.
|
|
24
24
|
;
|
|
25
25
|
continue;
|
|
@@ -58,7 +58,7 @@ import path from 'path';
|
|
|
58
58
|
break;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
61
|
-
if (!found) {
|
|
61
|
+
if (!found && dir !== root) {
|
|
62
62
|
dir = path.dirname(dir) // Move up one directory level.
|
|
63
63
|
;
|
|
64
64
|
continue;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utilities/findUp.ts"],"sourcesContent":["// @ts-strict-ignore\nimport fs from 'fs'\nimport path from 'path'\n\n/**\n * Synchronously walks up parent directories until a condition is met and/or one of the file names within the fileNames array is found.\n */\nexport function findUpSync({\n condition,\n dir,\n fileNames,\n}: {\n condition?: (dir: string) => boolean | Promise<boolean | string> | string\n dir: string\n fileNames?: string[]\n}): null | string {\n const { root } = path.parse(dir)\n\n while (true) {\n if (fileNames?.length) {\n let found = false\n for (const fileName of fileNames) {\n const filePath = path.join(dir, fileName)\n const exists = pathExistsAndIsAccessibleSync(filePath)\n if (exists) {\n if (!condition) {\n return filePath\n }\n found = true\n break\n }\n }\n if (!found) {\n dir = path.dirname(dir) // Move up one directory level.\n continue\n }\n }\n const result = condition(dir)\n if (result === true) {\n return dir\n }\n if (typeof result === 'string' && result?.length) {\n return result\n }\n if (dir === root) {\n return null // Reached the root directory without a match.\n }\n dir = path.dirname(dir) // Move up one directory level.\n }\n}\n\n/**\n * Asynchronously walks up parent directories until a condition is met and/or one of the file names within the fileNames array is found.\n */\nexport async function findUp({\n condition,\n dir,\n fileNames,\n}: {\n condition?: (dir: string) => boolean | Promise<boolean | string> | string\n dir: string\n fileNames?: string[]\n}): Promise<null | string> {\n const { root } = path.parse(dir)\n\n while (true) {\n if (fileNames?.length) {\n let found = false\n for (const fileName of fileNames) {\n const filePath = path.resolve(dir, fileName)\n const exists = await pathExistsAndIsAccessible(filePath)\n if (exists) {\n if (!condition) {\n return filePath\n }\n found = true\n break\n }\n }\n if (!found) {\n dir = path.dirname(dir) // Move up one directory level.\n continue\n }\n }\n const result = await condition(dir)\n if (result === true) {\n return dir\n }\n if (typeof result === 'string' && result?.length) {\n return result\n }\n if (dir === root) {\n return null // Reached the root directory without a match.\n }\n dir = path.dirname(dir) // Move up one directory level.\n }\n}\n\n// From https://github.com/sindresorhus/path-exists/blob/main/index.js\n// fs.accessSync is preferred over fs.existsSync as it's usually a good idea\n// to check if the process has permission to read/write to a file before doing so.\n// Also see https://github.com/nodejs/node/issues/39960\nexport function pathExistsAndIsAccessibleSync(path: string) {\n try {\n fs.accessSync(path)\n return true\n } catch {\n return false\n }\n}\n\nexport async function pathExistsAndIsAccessible(path: string) {\n try {\n await fs.promises.access(path)\n return true\n } catch {\n return false\n }\n}\n"],"names":["fs","path","findUpSync","condition","dir","fileNames","root","parse","length","found","fileName","filePath","join","exists","pathExistsAndIsAccessibleSync","dirname","result","findUp","resolve","pathExistsAndIsAccessible","accessSync","promises","access"],"mappings":"AAAA,oBAAoB;AACpB,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB;;CAEC,GACD,OAAO,SAASC,WAAW,EACzBC,SAAS,EACTC,GAAG,EACHC,SAAS,EAKV;IACC,MAAM,EAAEC,IAAI,EAAE,GAAGL,KAAKM,KAAK,CAACH;IAE5B,MAAO,KAAM;QACX,IAAIC,WAAWG,QAAQ;YACrB,IAAIC,QAAQ;YACZ,KAAK,MAAMC,YAAYL,UAAW;gBAChC,MAAMM,WAAWV,KAAKW,IAAI,CAACR,KAAKM;gBAChC,MAAMG,SAASC,8BAA8BH;gBAC7C,IAAIE,QAAQ;oBACV,IAAI,CAACV,WAAW;wBACd,OAAOQ;oBACT;oBACAF,QAAQ;oBACR;gBACF;YACF;YACA,IAAI,CAACA,
|
|
1
|
+
{"version":3,"sources":["../../src/utilities/findUp.ts"],"sourcesContent":["// @ts-strict-ignore\nimport fs from 'fs'\nimport path from 'path'\n\n/**\n * Synchronously walks up parent directories until a condition is met and/or one of the file names within the fileNames array is found.\n */\nexport function findUpSync({\n condition,\n dir,\n fileNames,\n}: {\n condition?: (dir: string) => boolean | Promise<boolean | string> | string\n dir: string\n fileNames?: string[]\n}): null | string {\n const { root } = path.parse(dir)\n\n while (true) {\n if (fileNames?.length) {\n let found = false\n for (const fileName of fileNames) {\n const filePath = path.join(dir, fileName)\n const exists = pathExistsAndIsAccessibleSync(filePath)\n if (exists) {\n if (!condition) {\n return filePath\n }\n found = true\n break\n }\n }\n if (!found && dir !== root) {\n dir = path.dirname(dir) // Move up one directory level.\n continue\n }\n }\n const result = condition(dir)\n if (result === true) {\n return dir\n }\n if (typeof result === 'string' && result?.length) {\n return result\n }\n if (dir === root) {\n return null // Reached the root directory without a match.\n }\n dir = path.dirname(dir) // Move up one directory level.\n }\n}\n\n/**\n * Asynchronously walks up parent directories until a condition is met and/or one of the file names within the fileNames array is found.\n */\nexport async function findUp({\n condition,\n dir,\n fileNames,\n}: {\n condition?: (dir: string) => boolean | Promise<boolean | string> | string\n dir: string\n fileNames?: string[]\n}): Promise<null | string> {\n const { root } = path.parse(dir)\n\n while (true) {\n if (fileNames?.length) {\n let found = false\n for (const fileName of fileNames) {\n const filePath = path.resolve(dir, fileName)\n const exists = await pathExistsAndIsAccessible(filePath)\n if (exists) {\n if (!condition) {\n return filePath\n }\n found = true\n break\n }\n }\n if (!found && dir !== root) {\n dir = path.dirname(dir) // Move up one directory level.\n continue\n }\n }\n const result = await condition(dir)\n if (result === true) {\n return dir\n }\n if (typeof result === 'string' && result?.length) {\n return result\n }\n if (dir === root) {\n return null // Reached the root directory without a match.\n }\n dir = path.dirname(dir) // Move up one directory level.\n }\n}\n\n// From https://github.com/sindresorhus/path-exists/blob/main/index.js\n// fs.accessSync is preferred over fs.existsSync as it's usually a good idea\n// to check if the process has permission to read/write to a file before doing so.\n// Also see https://github.com/nodejs/node/issues/39960\nexport function pathExistsAndIsAccessibleSync(path: string) {\n try {\n fs.accessSync(path)\n return true\n } catch {\n return false\n }\n}\n\nexport async function pathExistsAndIsAccessible(path: string) {\n try {\n await fs.promises.access(path)\n return true\n } catch {\n return false\n }\n}\n"],"names":["fs","path","findUpSync","condition","dir","fileNames","root","parse","length","found","fileName","filePath","join","exists","pathExistsAndIsAccessibleSync","dirname","result","findUp","resolve","pathExistsAndIsAccessible","accessSync","promises","access"],"mappings":"AAAA,oBAAoB;AACpB,OAAOA,QAAQ,KAAI;AACnB,OAAOC,UAAU,OAAM;AAEvB;;CAEC,GACD,OAAO,SAASC,WAAW,EACzBC,SAAS,EACTC,GAAG,EACHC,SAAS,EAKV;IACC,MAAM,EAAEC,IAAI,EAAE,GAAGL,KAAKM,KAAK,CAACH;IAE5B,MAAO,KAAM;QACX,IAAIC,WAAWG,QAAQ;YACrB,IAAIC,QAAQ;YACZ,KAAK,MAAMC,YAAYL,UAAW;gBAChC,MAAMM,WAAWV,KAAKW,IAAI,CAACR,KAAKM;gBAChC,MAAMG,SAASC,8BAA8BH;gBAC7C,IAAIE,QAAQ;oBACV,IAAI,CAACV,WAAW;wBACd,OAAOQ;oBACT;oBACAF,QAAQ;oBACR;gBACF;YACF;YACA,IAAI,CAACA,SAASL,QAAQE,MAAM;gBAC1BF,MAAMH,KAAKc,OAAO,CAACX,KAAK,+BAA+B;;gBACvD;YACF;QACF;QACA,MAAMY,SAASb,UAAUC;QACzB,IAAIY,WAAW,MAAM;YACnB,OAAOZ;QACT;QACA,IAAI,OAAOY,WAAW,YAAYA,QAAQR,QAAQ;YAChD,OAAOQ;QACT;QACA,I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}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "payload",
|
|
3
|
-
"version": "3.40.0-
|
|
3
|
+
"version": "3.40.0-internal.e3ed6ab",
|
|
4
4
|
"description": "Node, React, Headless CMS and Application Framework built on Next.js",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"admin panel",
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
"tsx": "4.19.2",
|
|
100
100
|
"uuid": "10.0.0",
|
|
101
101
|
"ws": "^8.16.0",
|
|
102
|
-
"@payloadcms/translations": "3.40.0-
|
|
102
|
+
"@payloadcms/translations": "3.40.0-internal.e3ed6ab"
|
|
103
103
|
},
|
|
104
104
|
"devDependencies": {
|
|
105
105
|
"@hyrious/esbuild-plugin-commonjs": "^0.2.4",
|