@kilnai/tools 1.0.1
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/README.md +6 -0
- package/dist/index.d.ts +25 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +59 -0
- package/dist/index.js.map +1 -0
- package/package.json +45 -0
package/README.md
ADDED
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare const VENDORED_TOOLS: readonly ["rg", "fd", "jq"];
|
|
2
|
+
export type VendoredToolBinary = (typeof VENDORED_TOOLS)[number];
|
|
3
|
+
export interface VendoredPlatformPackageDescriptor {
|
|
4
|
+
readonly packageName: string;
|
|
5
|
+
readonly platform: string;
|
|
6
|
+
readonly arch: string;
|
|
7
|
+
readonly binaries: readonly VendoredToolBinary[];
|
|
8
|
+
}
|
|
9
|
+
export interface ResolvedVendoredPlatformPackage extends VendoredPlatformPackageDescriptor {
|
|
10
|
+
readonly packageJsonPath: string;
|
|
11
|
+
}
|
|
12
|
+
export interface VendoredPackageTarget {
|
|
13
|
+
readonly platform: string;
|
|
14
|
+
readonly arch: string;
|
|
15
|
+
}
|
|
16
|
+
export interface ResolveVendoredPackageOptions {
|
|
17
|
+
readonly platform?: string;
|
|
18
|
+
readonly arch?: string;
|
|
19
|
+
readonly resolvePackageJson?: (specifier: string) => string;
|
|
20
|
+
}
|
|
21
|
+
export declare function listVendoredPlatformPackages(): readonly VendoredPlatformPackageDescriptor[];
|
|
22
|
+
export declare function getVendoredPackageCandidates(target?: VendoredPackageTarget): readonly VendoredPlatformPackageDescriptor[];
|
|
23
|
+
export declare function resolveVendoredPlatformPackage(options?: ResolveVendoredPackageOptions): ResolvedVendoredPlatformPackage | undefined;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,cAAc,6BAA8B,CAAC;AAEnD,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAEjE,MAAM,WAAW,iCAAiC;IAChD,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,kBAAkB,EAAE,CAAC;CAClD;AAED,MAAM,WAAW,+BAAgC,SAAQ,iCAAiC;IACxF,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC;CAC7D;AA6BD,wBAAgB,4BAA4B,IAAI,SAAS,iCAAiC,EAAE,CAE3F;AAED,wBAAgB,4BAA4B,CAC1C,MAAM,GAAE,qBAA0E,GACjF,SAAS,iCAAiC,EAAE,CAU9C;AAED,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,6BAAkC,GAC1C,+BAA+B,GAAG,SAAS,CAkB7C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
const requireFromHere = createRequire(import.meta.url);
|
|
3
|
+
const VENDORED_TOOLS = ["rg", "fd", "jq"];
|
|
4
|
+
const PLATFORM_PACKAGES = [
|
|
5
|
+
{
|
|
6
|
+
packageName: "@kilnai/tools-win32-x64",
|
|
7
|
+
platform: "win32",
|
|
8
|
+
arch: "x64",
|
|
9
|
+
binaries: VENDORED_TOOLS,
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
packageName: "@kilnai/tools-darwin-arm64",
|
|
13
|
+
platform: "darwin",
|
|
14
|
+
arch: "arm64",
|
|
15
|
+
binaries: VENDORED_TOOLS,
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
packageName: "@kilnai/tools-darwin-x64",
|
|
19
|
+
platform: "darwin",
|
|
20
|
+
arch: "x64",
|
|
21
|
+
binaries: VENDORED_TOOLS,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
packageName: "@kilnai/tools-linux-x64",
|
|
25
|
+
platform: "linux",
|
|
26
|
+
arch: "x64",
|
|
27
|
+
binaries: VENDORED_TOOLS,
|
|
28
|
+
},
|
|
29
|
+
];
|
|
30
|
+
export function listVendoredPlatformPackages() {
|
|
31
|
+
return PLATFORM_PACKAGES;
|
|
32
|
+
}
|
|
33
|
+
export function getVendoredPackageCandidates(target = { platform: process.platform, arch: process.arch }) {
|
|
34
|
+
const preferred = PLATFORM_PACKAGES.filter((candidate) => candidate.platform === target.platform && candidate.arch === target.arch);
|
|
35
|
+
const remaining = PLATFORM_PACKAGES.filter((candidate) => candidate.platform !== target.platform || candidate.arch !== target.arch);
|
|
36
|
+
return [...preferred, ...remaining];
|
|
37
|
+
}
|
|
38
|
+
export function resolveVendoredPlatformPackage(options = {}) {
|
|
39
|
+
const platform = options.platform ?? process.platform;
|
|
40
|
+
const arch = options.arch ?? process.arch;
|
|
41
|
+
const resolvePackageJson = options.resolvePackageJson ?? defaultResolvePackageJson;
|
|
42
|
+
for (const candidate of getVendoredPackageCandidates({ platform, arch })) {
|
|
43
|
+
try {
|
|
44
|
+
const packageJsonPath = resolvePackageJson(`${candidate.packageName}/package.json`);
|
|
45
|
+
return {
|
|
46
|
+
...candidate,
|
|
47
|
+
packageJsonPath,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// Continue probing candidates until one resolves.
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
function defaultResolvePackageJson(specifier) {
|
|
57
|
+
return requireFromHere.resolve(specifier);
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,eAAe,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACvD,MAAM,cAAc,GAAG,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAU,CAAC;AA0BnD,MAAM,iBAAiB,GAAiD;IACtE;QACE,WAAW,EAAE,yBAAyB;QACtC,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,cAAc;KACzB;IACD;QACE,WAAW,EAAE,4BAA4B;QACzC,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,OAAO;QACb,QAAQ,EAAE,cAAc;KACzB;IACD;QACE,WAAW,EAAE,0BAA0B;QACvC,QAAQ,EAAE,QAAQ;QAClB,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,cAAc;KACzB;IACD;QACE,WAAW,EAAE,yBAAyB;QACtC,QAAQ,EAAE,OAAO;QACjB,IAAI,EAAE,KAAK;QACX,QAAQ,EAAE,cAAc;KACzB;CACO,CAAC;AAEX,MAAM,UAAU,4BAA4B;IAC1C,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,SAAgC,EAAE,QAAQ,EAAE,OAAO,CAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE;IAElF,MAAM,SAAS,GAAG,iBAAiB,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
|
|
4
|
+
"description": "Vendored developer tool binary resolver for Kiln",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"import": "./dist/index.js"
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"typecheck": "tsc --noEmit",
|
|
20
|
+
"test": "vitest run"
|
|
21
|
+
},
|
|
22
|
+
"license": "Apache-2.0",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "https://github.com/sequelcore/kiln.git",
|
|
26
|
+
"directory": "packages/tools"
|
|
27
|
+
},
|
|
28
|
+
"homepage": "https://github.com/sequelcore/kiln/tree/main/packages/tools",
|
|
29
|
+
"keywords": [
|
|
30
|
+
"kiln",
|
|
31
|
+
"tools",
|
|
32
|
+
"ripgrep",
|
|
33
|
+
"fd",
|
|
34
|
+
"jq"
|
|
35
|
+
],
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
38
|
+
},
|
|
39
|
+
"optionalDependencies": {
|
|
40
|
+
"@kilnai/tools-darwin-arm64": "1.0.1",
|
|
41
|
+
"@kilnai/tools-darwin-x64": "1.0.1",
|
|
42
|
+
"@kilnai/tools-linux-x64": "1.0.1",
|
|
43
|
+
"@kilnai/tools-win32-x64": "1.0.1"
|
|
44
|
+
}
|
|
45
|
+
}
|