@soda-gql/common 0.11.10 → 0.11.11
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/{canonical-id-BJahCcrS.mjs → canonical-id-9alor9gv.mjs} +66 -7
- package/dist/canonical-id-9alor9gv.mjs.map +1 -0
- package/dist/{canonical-id-CgMNOZyn.cjs → canonical-id-DHdeYIsT.cjs} +76 -5
- package/dist/canonical-id-DHdeYIsT.cjs.map +1 -0
- package/dist/canonical-id.cjs +5 -3
- package/dist/canonical-id.d.cts +2 -2
- package/dist/canonical-id.d.mts +2 -2
- package/dist/canonical-id.mjs +3 -3
- package/dist/{index-Cm2Zwk9m.d.cts → index-AqkJhrm3.d.mts} +53 -3
- package/dist/index-AqkJhrm3.d.mts.map +1 -0
- package/dist/index-BCu9PNbZ.d.mts +139 -0
- package/dist/index-BCu9PNbZ.d.mts.map +1 -0
- package/dist/{index-D1tzB3W5.d.cts → index-BMa2_rDb.d.mts} +6 -35
- package/dist/index-BMa2_rDb.d.mts.map +1 -0
- package/dist/index-BMl8pzFY.d.cts +139 -0
- package/dist/index-BMl8pzFY.d.cts.map +1 -0
- package/dist/{index-B424kKYS.d.mts → index-CbQyueYV.d.cts} +6 -35
- package/dist/index-CbQyueYV.d.cts.map +1 -0
- package/dist/{index-CPpVc8Id.d.mts → index-DZSebwar.d.cts} +53 -3
- package/dist/index-DZSebwar.d.cts.map +1 -0
- package/dist/index-Dit86qkX.d.mts.map +1 -1
- package/dist/index.cjs +9 -7
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.mjs +4 -4
- package/dist/portable-B3K3IE7E.cjs +239 -0
- package/dist/portable-B3K3IE7E.cjs.map +1 -0
- package/dist/portable-BFrcBOaX.mjs +196 -0
- package/dist/portable-BFrcBOaX.mjs.map +1 -0
- package/dist/portable.cjs +2 -5
- package/dist/portable.d.cts +2 -2
- package/dist/portable.d.mts +2 -2
- package/dist/portable.mjs +2 -2
- package/dist/utils-Rs7YbafF.cjs +431 -0
- package/dist/utils-Rs7YbafF.cjs.map +1 -0
- package/dist/utils-ZCE_eqCf.mjs +371 -0
- package/dist/utils-ZCE_eqCf.mjs.map +1 -0
- package/dist/utils.cjs +4 -1
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.mts +2 -2
- package/dist/utils.mjs +2 -2
- package/dist/{zod-C_6JfuYV.cjs → zod-DjI3IUH3.cjs} +2 -2
- package/dist/{zod-C_6JfuYV.cjs.map → zod-DjI3IUH3.cjs.map} +1 -1
- package/dist/zod.cjs +1 -1
- package/package.json +1 -1
- package/dist/canonical-id-BJahCcrS.mjs.map +0 -1
- package/dist/canonical-id-CgMNOZyn.cjs.map +0 -1
- package/dist/index-B424kKYS.d.mts.map +0 -1
- package/dist/index-CPpVc8Id.d.mts.map +0 -1
- package/dist/index-Cm2Zwk9m.d.cts.map +0 -1
- package/dist/index-D1tzB3W5.d.cts.map +0 -1
- package/dist/index-Dv8spPt0.d.mts +0 -61
- package/dist/index-Dv8spPt0.d.mts.map +0 -1
- package/dist/index-LaXfl_e_.d.cts +0 -61
- package/dist/index-LaXfl_e_.d.cts.map +0 -1
- package/dist/portable-BT3ahkQN.mjs +0 -391
- package/dist/portable-BT3ahkQN.mjs.map +0 -1
- package/dist/portable-cJqkfeHw.cjs +0 -451
- package/dist/portable-cJqkfeHw.cjs.map +0 -1
- package/dist/utils-CsTwS1dw.cjs +0 -148
- package/dist/utils-CsTwS1dw.cjs.map +0 -1
- package/dist/utils-DLEgAn7q.mjs +0 -106
- package/dist/utils-DLEgAn7q.mjs.map +0 -1
package/dist/utils-DLEgAn7q.mjs
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { dirname, join, normalize, resolve } from "node:path";
|
|
2
|
-
import { existsSync, statSync } from "node:fs";
|
|
3
|
-
|
|
4
|
-
//#region packages/common/src/utils/cached-fn.ts
|
|
5
|
-
const cachedFn = (fn) => {
|
|
6
|
-
let cached = null;
|
|
7
|
-
const ensure = () => (cached ??= { value: fn() }).value;
|
|
8
|
-
ensure.clear = () => {
|
|
9
|
-
cached = null;
|
|
10
|
-
};
|
|
11
|
-
return ensure;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region packages/common/src/utils/path.ts
|
|
16
|
-
/**
|
|
17
|
-
* File extensions to try when resolving module specifiers.
|
|
18
|
-
* Ordered to match TypeScript's module resolution order.
|
|
19
|
-
* @see https://www.typescriptlang.org/docs/handbook/module-resolution.html
|
|
20
|
-
*/
|
|
21
|
-
const MODULE_EXTENSION_CANDIDATES = [
|
|
22
|
-
".ts",
|
|
23
|
-
".tsx",
|
|
24
|
-
".mts",
|
|
25
|
-
".cts",
|
|
26
|
-
".js",
|
|
27
|
-
".mjs",
|
|
28
|
-
".cjs",
|
|
29
|
-
".jsx"
|
|
30
|
-
];
|
|
31
|
-
/**
|
|
32
|
-
* Normalize path to use forward slashes (cross-platform).
|
|
33
|
-
* Ensures consistent path handling across platforms.
|
|
34
|
-
*/
|
|
35
|
-
const normalizePath = (value) => normalize(value).replace(/\\/g, "/");
|
|
36
|
-
/**
|
|
37
|
-
* Resolve a relative import specifier to an absolute file path.
|
|
38
|
-
* Tries the specifier as-is, with extensions, and as a directory with index files.
|
|
39
|
-
*
|
|
40
|
-
* @param from - Absolute path to the importing file
|
|
41
|
-
* @param specifier - Relative module specifier (must start with '.')
|
|
42
|
-
* @returns Absolute POSIX path to the resolved file, or null if not found
|
|
43
|
-
*/
|
|
44
|
-
const resolveRelativeImportWithExistenceCheck = ({ filePath, specifier }) => {
|
|
45
|
-
const base = resolve(dirname(filePath), specifier);
|
|
46
|
-
for (const ext of MODULE_EXTENSION_CANDIDATES) {
|
|
47
|
-
const candidate = `${base}${ext}`;
|
|
48
|
-
if (existsSync(candidate)) {
|
|
49
|
-
return normalizePath(candidate);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
for (const ext of MODULE_EXTENSION_CANDIDATES) {
|
|
53
|
-
const candidate = join(base, `index${ext}`);
|
|
54
|
-
if (existsSync(candidate)) {
|
|
55
|
-
return normalizePath(candidate);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
if (existsSync(base)) {
|
|
59
|
-
try {
|
|
60
|
-
const stat = statSync(base);
|
|
61
|
-
if (stat.isFile()) {
|
|
62
|
-
return normalizePath(base);
|
|
63
|
-
}
|
|
64
|
-
} catch {}
|
|
65
|
-
}
|
|
66
|
-
return null;
|
|
67
|
-
};
|
|
68
|
-
/**
|
|
69
|
-
* Resolve a relative import specifier to an absolute file path.
|
|
70
|
-
* Tries the specifier as-is, with extensions, and as a directory with index files.
|
|
71
|
-
*
|
|
72
|
-
* @param from - Absolute path to the importing file
|
|
73
|
-
* @param specifier - Relative module specifier (must start with '.')
|
|
74
|
-
* @returns Absolute POSIX path to the resolved file, or null if not found
|
|
75
|
-
*/
|
|
76
|
-
const resolveRelativeImportWithReferences = ({ filePath, specifier, references }) => {
|
|
77
|
-
const base = resolve(dirname(filePath), specifier);
|
|
78
|
-
if (references.has(base)) {
|
|
79
|
-
return normalizePath(base);
|
|
80
|
-
}
|
|
81
|
-
for (const ext of MODULE_EXTENSION_CANDIDATES) {
|
|
82
|
-
const candidate = `${base}${ext}`;
|
|
83
|
-
if (references.has(candidate)) {
|
|
84
|
-
return normalizePath(candidate);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
for (const ext of MODULE_EXTENSION_CANDIDATES) {
|
|
88
|
-
const candidate = join(base, `index${ext}`);
|
|
89
|
-
if (references.has(candidate)) {
|
|
90
|
-
return normalizePath(candidate);
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
return null;
|
|
94
|
-
};
|
|
95
|
-
/**
|
|
96
|
-
* Check if a module specifier is relative (starts with '.' or '..')
|
|
97
|
-
*/
|
|
98
|
-
const isRelativeSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../");
|
|
99
|
-
/**
|
|
100
|
-
* Check if a module specifier is external (package name, not relative)
|
|
101
|
-
*/
|
|
102
|
-
const isExternalSpecifier = (specifier) => !isRelativeSpecifier(specifier);
|
|
103
|
-
|
|
104
|
-
//#endregion
|
|
105
|
-
export { resolveRelativeImportWithExistenceCheck as a, normalizePath as i, isExternalSpecifier as n, resolveRelativeImportWithReferences as o, isRelativeSpecifier as r, cachedFn as s, MODULE_EXTENSION_CANDIDATES as t };
|
|
106
|
-
//# sourceMappingURL=utils-DLEgAn7q.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils-DLEgAn7q.mjs","names":["cached: { value: T } | null"],"sources":["../src/utils/cached-fn.ts","../src/utils/path.ts"],"sourcesContent":["export const cachedFn = <T>(fn: () => T) => {\n let cached: { value: T } | null = null;\n\n const ensure = () => (cached ??= { value: fn() }).value;\n ensure.clear = () => {\n cached = null;\n };\n\n return ensure;\n};\n","import { existsSync, statSync } from \"node:fs\";\nimport { dirname, join, normalize, resolve } from \"node:path\";\n\n/**\n * File extensions to try when resolving module specifiers.\n * Ordered to match TypeScript's module resolution order.\n * @see https://www.typescriptlang.org/docs/handbook/module-resolution.html\n */\nexport const MODULE_EXTENSION_CANDIDATES = [\".ts\", \".tsx\", \".mts\", \".cts\", \".js\", \".mjs\", \".cjs\", \".jsx\"] as const;\n\n/**\n * Normalize path to use forward slashes (cross-platform).\n * Ensures consistent path handling across platforms.\n */\nexport const normalizePath = (value: string): string => normalize(value).replace(/\\\\/g, \"/\");\n\n/**\n * Resolve a relative import specifier to an absolute file path.\n * Tries the specifier as-is, with extensions, and as a directory with index files.\n *\n * @param from - Absolute path to the importing file\n * @param specifier - Relative module specifier (must start with '.')\n * @returns Absolute POSIX path to the resolved file, or null if not found\n */\nexport const resolveRelativeImportWithExistenceCheck = ({\n filePath,\n specifier,\n}: {\n filePath: string;\n specifier: string;\n}): string | null => {\n const base = resolve(dirname(filePath), specifier);\n\n // Try with extensions first (most common case)\n // This handles cases like \"./constants\" resolving to \"./constants.ts\"\n // even when a \"./constants\" directory exists\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = `${base}${ext}`;\n if (existsSync(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n // Try as directory with index files\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = join(base, `index${ext}`);\n if (existsSync(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n // Try exact path last (only if it's a file, not directory)\n if (existsSync(base)) {\n try {\n const stat = statSync(base);\n if (stat.isFile()) {\n return normalizePath(base);\n }\n } catch {\n // Ignore stat errors\n }\n }\n\n return null;\n};\n\n/**\n * Resolve a relative import specifier to an absolute file path.\n * Tries the specifier as-is, with extensions, and as a directory with index files.\n *\n * @param from - Absolute path to the importing file\n * @param specifier - Relative module specifier (must start with '.')\n * @returns Absolute POSIX path to the resolved file, or null if not found\n */\nexport const resolveRelativeImportWithReferences = <_>({\n filePath,\n specifier,\n references,\n}: {\n filePath: string;\n specifier: string;\n references: Map<string, _> | Set<string>;\n}): string | null => {\n const base = resolve(dirname(filePath), specifier);\n\n // Try exact path first\n if (references.has(base)) {\n return normalizePath(base);\n }\n\n // Try with extensions\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = `${base}${ext}`;\n if (references.has(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n // Try as directory with index files\n for (const ext of MODULE_EXTENSION_CANDIDATES) {\n const candidate = join(base, `index${ext}`);\n if (references.has(candidate)) {\n return normalizePath(candidate);\n }\n }\n\n return null;\n};\n\n/**\n * Check if a module specifier is relative (starts with '.' or '..')\n */\nexport const isRelativeSpecifier = (specifier: string): boolean => specifier.startsWith(\"./\") || specifier.startsWith(\"../\");\n\n/**\n * Check if a module specifier is external (package name, not relative)\n */\nexport const isExternalSpecifier = (specifier: string): boolean => !isRelativeSpecifier(specifier);\n"],"mappings":";;;;AAAA,MAAa,YAAe,OAAgB;CAC1C,IAAIA,SAA8B;CAElC,MAAM,gBAAgB,WAAW,EAAE,OAAO,IA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