srcpack 0.1.0
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/LICENSE +21 -0
- package/README.md +165 -0
- package/dist/bundle.d.ts +37 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +189620 -0
- package/dist/config.d.ts +45 -0
- package/dist/gdrive.d.ts +33 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +187079 -0
- package/dist/init.d.ts +1 -0
- package/dist/src/bundle.d.ts +37 -0
- package/dist/src/cli.d.ts +2 -0
- package/dist/src/config.d.ts +45 -0
- package/dist/src/gdrive.d.ts +33 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/init.d.ts +1 -0
- package/dist/tests/bundle.test.d.ts +1 -0
- package/dist/tests/cli.test.d.ts +1 -0
- package/dist/tests/config.test.d.ts +1 -0
- package/package.json +74 -0
- package/src/bundle.ts +237 -0
- package/src/cli.ts +266 -0
- package/src/config.ts +107 -0
- package/src/gdrive.ts +200 -0
- package/src/index.ts +4 -0
- package/src/init.ts +144 -0
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare function expandPath(p: string): string;
|
|
3
|
+
declare const BundleConfigSchema: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
4
|
+
include: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
5
|
+
outfile: z.ZodOptional<z.ZodString>;
|
|
6
|
+
index: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
}, z.core.$strip>]>;
|
|
8
|
+
declare const UploadConfigSchema: z.ZodObject<{
|
|
9
|
+
provider: z.ZodLiteral<"gdrive">;
|
|
10
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
11
|
+
clientId: z.ZodString;
|
|
12
|
+
clientSecret: z.ZodString;
|
|
13
|
+
}, z.core.$strip>;
|
|
14
|
+
declare const ConfigSchema: z.ZodObject<{
|
|
15
|
+
outDir: z.ZodDefault<z.ZodString>;
|
|
16
|
+
upload: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
17
|
+
provider: z.ZodLiteral<"gdrive">;
|
|
18
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
19
|
+
clientId: z.ZodString;
|
|
20
|
+
clientSecret: z.ZodString;
|
|
21
|
+
}, z.core.$strip>, z.ZodArray<z.ZodObject<{
|
|
22
|
+
provider: z.ZodLiteral<"gdrive">;
|
|
23
|
+
folder: z.ZodOptional<z.ZodString>;
|
|
24
|
+
clientId: z.ZodString;
|
|
25
|
+
clientSecret: z.ZodString;
|
|
26
|
+
}, z.core.$strip>>]>>;
|
|
27
|
+
bundles: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>, z.ZodObject<{
|
|
28
|
+
include: z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>;
|
|
29
|
+
outfile: z.ZodOptional<z.ZodString>;
|
|
30
|
+
index: z.ZodDefault<z.ZodBoolean>;
|
|
31
|
+
}, z.core.$strip>]>>;
|
|
32
|
+
}, z.core.$strip>;
|
|
33
|
+
export type UploadConfig = z.infer<typeof UploadConfigSchema>;
|
|
34
|
+
export type BundleConfig = z.infer<typeof BundleConfigSchema>;
|
|
35
|
+
export type BundleConfigInput = z.input<typeof BundleConfigSchema>;
|
|
36
|
+
export type Config = z.infer<typeof ConfigSchema>;
|
|
37
|
+
export type ConfigInput = z.input<typeof ConfigSchema>;
|
|
38
|
+
export declare function defineConfig(config: ConfigInput): ConfigInput;
|
|
39
|
+
export declare class ConfigError extends Error {
|
|
40
|
+
constructor(message: string);
|
|
41
|
+
}
|
|
42
|
+
export declare function parseConfig(value: unknown): Config;
|
|
43
|
+
export declare function loadConfig(searchFrom?: string): Promise<Config | null>;
|
|
44
|
+
export declare function loadConfigFromFile(filepath: string): Promise<Config | null>;
|
|
45
|
+
export {};
|
package/dist/gdrive.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { OAuthError } from "oauth-callback";
|
|
2
|
+
import type { UploadConfig } from "./config.ts";
|
|
3
|
+
export interface Tokens {
|
|
4
|
+
access_token: string;
|
|
5
|
+
refresh_token?: string;
|
|
6
|
+
expires_at?: number;
|
|
7
|
+
token_type: string;
|
|
8
|
+
scope: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Loads stored tokens from disk.
|
|
12
|
+
* Returns null if no tokens exist or they cannot be read.
|
|
13
|
+
*/
|
|
14
|
+
export declare function loadTokens(): Promise<Tokens | null>;
|
|
15
|
+
/**
|
|
16
|
+
* Removes stored tokens from disk.
|
|
17
|
+
*/
|
|
18
|
+
export declare function clearTokens(): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Gets valid tokens, refreshing if necessary.
|
|
21
|
+
* Returns null if no tokens exist or refresh fails.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getValidTokens(config: UploadConfig): Promise<Tokens | null>;
|
|
24
|
+
/**
|
|
25
|
+
* Performs OAuth login flow - opens browser for user consent.
|
|
26
|
+
* Stores tokens on success for future use.
|
|
27
|
+
*/
|
|
28
|
+
export declare function login(config: UploadConfig): Promise<Tokens>;
|
|
29
|
+
/**
|
|
30
|
+
* Ensures we have valid tokens - loads existing or triggers login.
|
|
31
|
+
*/
|
|
32
|
+
export declare function ensureAuthenticated(config: UploadConfig): Promise<Tokens>;
|
|
33
|
+
export { OAuthError };
|
package/dist/index.d.ts
ADDED