opencode-copilot-account-switcher 0.14.31 → 0.14.32
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.
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
export type JitiLoader = (path: string) => unknown;
|
|
2
2
|
type CreateJiti = (id: string | URL, options?: Record<string, unknown>) => JitiLoader;
|
|
3
3
|
type JitiImport = (specifier: string) => Promise<unknown> | unknown;
|
|
4
|
+
type JitiResolve = (specifier: string) => string;
|
|
4
5
|
type JitiNamespace = {
|
|
5
6
|
createJiti?: unknown;
|
|
6
7
|
default?: unknown;
|
|
7
8
|
};
|
|
8
9
|
export declare function resolveCreateJiti(namespace: JitiNamespace): CreateJiti;
|
|
9
|
-
export declare function
|
|
10
|
+
export declare function resolveJitiEsmEntry(resolveImpl?: JitiResolve): string;
|
|
11
|
+
export declare function loadJiti(importImpl?: JitiImport, resolveImpl?: JitiResolve): Promise<{
|
|
10
12
|
createJiti: CreateJiti;
|
|
11
13
|
}>;
|
|
12
14
|
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { pathToFileURL } from "node:url";
|
|
1
4
|
function isCreateJiti(value) {
|
|
2
5
|
return typeof value === "function";
|
|
3
6
|
}
|
|
@@ -18,8 +21,12 @@ export function resolveCreateJiti(namespace) {
|
|
|
18
21
|
}
|
|
19
22
|
throw new Error("[wechat-compat] createJiti export unavailable");
|
|
20
23
|
}
|
|
21
|
-
export
|
|
22
|
-
const
|
|
24
|
+
export function resolveJitiEsmEntry(resolveImpl = createRequire(import.meta.url).resolve) {
|
|
25
|
+
const packageJsonPath = resolveImpl("jiti/package.json");
|
|
26
|
+
return pathToFileURL(path.join(path.dirname(packageJsonPath), "lib", "jiti.mjs")).href;
|
|
27
|
+
}
|
|
28
|
+
export async function loadJiti(importImpl = (specifier) => import(specifier), resolveImpl = createRequire(import.meta.url).resolve) {
|
|
29
|
+
const namespace = await Promise.resolve(importImpl(resolveJitiEsmEntry(resolveImpl)));
|
|
23
30
|
return {
|
|
24
31
|
createJiti: resolveCreateJiti(namespace),
|
|
25
32
|
};
|