@builder.io/dev-tools 1.25.0-dev.202602061535.438a13c38 → 1.25.0-dev.202602091025.fe9dae917

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,9 +1,17 @@
1
- import { type RequestInit } from "undici";
1
+ import { type RequestInit, Dispatcher } from "undici";
2
2
  import { NetworkError } from "../common/errors";
3
- export declare const safeFetch: (
4
- input: string | URL,
5
- init?: RequestInit,
6
- ) => ReturnType<typeof globalThis.fetch>;
3
+ /**
4
+ * Detect PAC (Proxy Auto-Configuration) URL from macOS system settings
5
+ * Only runs on macOS and caches the result
6
+ */
7
+ declare function getActiveServicePacUrl(): string | null;
8
+ /**
9
+ * Resolve proxy for a URL using PAC resolver
10
+ * Returns proxy URL string or undefined for direct connection
11
+ */
12
+ declare function resolveProxyFromPac(url: string): Promise<string | undefined>;
13
+ declare function getAgent(url?: string): Promise<Dispatcher>;
14
+ export declare const safeFetch: (input: string | URL, init?: RequestInit) => ReturnType<typeof globalThis.fetch>;
7
15
  /**
8
16
  * Checks the health of the Builder.io API by attempting to fetch the health endpoint.
9
17
  * Retries up to 3 times with a delay between attempts.
@@ -11,6 +19,11 @@ export declare const safeFetch: (
11
19
  * @returns undefined if all attempts fail
12
20
  * @throws NetworkError if all retry attempts fail
13
21
  */
14
- export declare function checkBuilderHealth(
15
- delayMs?: number,
16
- ): Promise<NetworkError | undefined>;
22
+ export declare function checkBuilderHealth(delayMs?: number): Promise<NetworkError | undefined>;
23
+ export declare const __testing__: {
24
+ getActiveServicePacUrl: typeof getActiveServicePacUrl;
25
+ resolveProxyFromPac: typeof resolveProxyFromPac;
26
+ getAgent: typeof getAgent;
27
+ resetCache: () => void;
28
+ };
29
+ export {};
@@ -0,0 +1 @@
1
+ export {};
@@ -1,166 +1,100 @@
1
1
  import type { DevToolsSys } from "@builder.io/dev-tools/core";
2
- import {
3
- type FusionConfig,
4
- type WorkspaceFolder,
5
- type InitState,
6
- type InitStateStep,
7
- type InitStatusLog,
8
- } from "$/ai-utils";
9
- type ValidatedWorkspaceFolder = WorkspaceFolder &
10
- Required<Pick<WorkspaceFolder, "name" | "path">>;
11
- type WorkspaceFolderWithRepoInfo = ValidatedWorkspaceFolder &
12
- Required<Pick<WorkspaceFolder, "repoName" | "repoUrl">>;
2
+ import { type FusionConfig, type WorkspaceFolder, type InitState, type InitStateStep, type InitStatusLog } from "$/ai-utils";
3
+ type ValidatedWorkspaceFolder = WorkspaceFolder & Required<Pick<WorkspaceFolder, "name" | "path">>;
4
+ type WorkspaceFolderWithRepoInfo = ValidatedWorkspaceFolder & Required<Pick<WorkspaceFolder, "repoName" | "repoUrl">>;
13
5
  import type { Credentials } from "../credentials";
14
6
  import { type GitBackupDownloadResult } from "../backup";
15
7
  export interface InitConfig {
16
- fusionConfig: FusionConfig;
17
- credentials: Credentials;
18
- sys: DevToolsSys;
19
- debug?: boolean;
20
- sentryTags?: Record<string, string>;
8
+ fusionConfig: FusionConfig;
9
+ credentials: Credentials;
10
+ sys: DevToolsSys;
11
+ debug?: boolean;
12
+ sentryTags?: Record<string, string>;
21
13
  }
22
14
  export interface InitStatus {
23
- message: string;
24
- error?: string;
15
+ message: string;
16
+ error?: string;
25
17
  }
26
18
  export declare class InitStateMachine {
27
- logIdCounter: number;
28
- initStatusLogs: InitStatusLog[];
29
- sys: DevToolsSys;
30
- config: InitConfig;
31
- /**
32
- * @deprecated use addInitLog instead. Do not use this directly.
33
- */
34
- debug: boolean;
35
- initState: InitState;
36
- constructor(config: InitConfig);
37
- checkout(branchName: string, ref: string, repoPath: string): Promise<boolean>;
38
- execAsync(
39
- exec: string,
40
- args: string[],
41
- cwd?: string,
42
- retry?: number,
43
- ): Promise<string>;
44
- git(
45
- args: string[],
46
- cwd: string,
47
- retry?: number,
48
- timeout?: number,
49
- ): Promise<string>;
50
- performBackup({
51
- sys,
52
- credentials,
53
- fusionConfig,
54
- volumePath,
55
- repositories,
56
- isConnectedToProvider,
57
- forcedFullBackup,
58
- }: {
59
- sys: DevToolsSys;
60
- credentials: Credentials;
61
- fusionConfig: FusionConfig;
62
- volumePath: string;
63
- repositories: ValidatedWorkspaceFolder[];
64
- isConnectedToProvider: boolean;
65
- forcedFullBackup: boolean;
66
- }): Promise<void>;
67
- performRegularBackup(
68
- args: Omit<
69
- Parameters<typeof this.performBackup>[0],
70
- "isConnectedToProvider" | "forcedFullBackup"
71
- >,
72
- ): Promise<void>;
73
- performOfflineBackup(
74
- args: Omit<
75
- Parameters<typeof this.performBackup>[0],
76
- "isConnectedToProvider" | "forcedFullBackup"
77
- >,
78
- ): Promise<void>;
79
- performForcedFullBackup(
80
- args: Omit<
81
- Parameters<typeof this.performBackup>[0],
82
- "isConnectedToProvider" | "forcedFullBackup"
83
- >,
84
- ): Promise<void>;
85
- init(): Promise<boolean>;
86
- addInitLog(
87
- type: "status" | "log" | "error" | "complete",
88
- message: string,
89
- options?: {
90
- step?: InitStateStep;
91
- error?: string;
92
- success?: boolean;
93
- },
94
- ): void;
95
- clearInitLogs(): void;
96
- hasFilesButNoGit(repoPath: string): Promise<boolean>;
97
- step1CheckDirectories(
98
- volumePath: string,
99
- repositories: ValidatedWorkspaceFolder[],
100
- ): Promise<void>;
101
- step2ConfigureGitRepositories(
102
- volumePath: string,
103
- repositories: ValidatedWorkspaceFolder[],
104
- ): Promise<void>;
105
- step3ConfigureGitUser(
106
- volumePath: string,
107
- repositories: ValidatedWorkspaceFolder[],
108
- ): Promise<void>;
109
- step4CollectRepoInfo(
110
- config: InitConfig,
111
- volumePath: string,
112
- repositories: ValidatedWorkspaceFolder[],
113
- ): Promise<void>;
114
- private isGitConfigured;
115
- private getGitRemoteUrl;
116
- private sanitizeGitRemoteUrl;
117
- /**
118
- * Check if the repository URL is from a standard git hosting provider
119
- */
120
- private isStandardGitHost;
121
- /**
122
- * Check if the repository host is reachable via network
123
- * Performs DNS resolution and TCP connection check
124
- */
125
- private checkHostConnectivity;
126
- private checkConnectivityDirect;
127
- private checkConnectivityViaProxy;
128
- /**
129
- * Ensures the parent directory of the given path exists.
130
- * Handles nested repo.path like "subdir/myproject".
131
- */
132
- private ensureParentDirExists;
133
- private cleanupLockFiles;
134
- validateGitRepo(repoPath: string): Promise<void>;
135
- /**
136
- * If a backup is available, perform a backup recovery (and throw if it fails and cannot be recovered from).
137
- * If no backup is available, do nothing.
138
- */
139
- private restoreFromPartialBackup;
140
- private initializeGitRepo;
141
- private refreshRepoConfig;
142
- runInitializationCommand({
143
- repo,
144
- tempCloningDir,
145
- repoPath,
146
- initCommand,
147
- }: {
148
- repo: ValidatedWorkspaceFolder;
149
- tempCloningDir: string;
150
- repoPath: string;
151
- initCommand: string;
152
- }): Promise<{
153
- outcome: boolean;
154
- error?: Error;
155
- }>;
156
- cloneRepository({
157
- repo,
158
- repoPath,
159
- backupResult,
160
- }: {
161
- repo: WorkspaceFolderWithRepoInfo;
162
- repoPath: string;
163
- backupResult: GitBackupDownloadResult | undefined;
164
- }): Promise<boolean>;
19
+ logIdCounter: number;
20
+ initStatusLogs: InitStatusLog[];
21
+ sys: DevToolsSys;
22
+ config: InitConfig;
23
+ /**
24
+ * @deprecated use addInitLog instead. Do not use this directly.
25
+ */
26
+ debug: boolean;
27
+ initState: InitState;
28
+ constructor(config: InitConfig);
29
+ checkout(branchName: string, ref: string, repoPath: string): Promise<boolean>;
30
+ execAsync(exec: string, args: string[], cwd?: string, retry?: number): Promise<string>;
31
+ git(args: string[], cwd: string, retry?: number, timeout?: number): Promise<string>;
32
+ performBackup({ sys, credentials, fusionConfig, volumePath, repositories, isConnectedToProvider, forcedFullBackup, }: {
33
+ sys: DevToolsSys;
34
+ credentials: Credentials;
35
+ fusionConfig: FusionConfig;
36
+ volumePath: string;
37
+ repositories: ValidatedWorkspaceFolder[];
38
+ isConnectedToProvider: boolean;
39
+ forcedFullBackup: boolean;
40
+ }): Promise<void>;
41
+ performRegularBackup(args: Omit<Parameters<typeof this.performBackup>[0], "isConnectedToProvider" | "forcedFullBackup">): Promise<void>;
42
+ performOfflineBackup(args: Omit<Parameters<typeof this.performBackup>[0], "isConnectedToProvider" | "forcedFullBackup">): Promise<void>;
43
+ performForcedFullBackup(args: Omit<Parameters<typeof this.performBackup>[0], "isConnectedToProvider" | "forcedFullBackup">): Promise<void>;
44
+ init(): Promise<boolean>;
45
+ addInitLog(type: "status" | "log" | "error" | "complete", message: string, options?: {
46
+ step?: InitStateStep;
47
+ error?: string;
48
+ success?: boolean;
49
+ }): void;
50
+ clearInitLogs(): void;
51
+ hasFilesButNoGit(repoPath: string): Promise<boolean>;
52
+ step1CheckDirectories(volumePath: string, repositories: ValidatedWorkspaceFolder[]): Promise<void>;
53
+ step2ConfigureGitRepositories(volumePath: string, repositories: ValidatedWorkspaceFolder[]): Promise<void>;
54
+ step3ConfigureGitUser(volumePath: string, repositories: ValidatedWorkspaceFolder[]): Promise<void>;
55
+ step4CollectRepoInfo(config: InitConfig, volumePath: string, repositories: ValidatedWorkspaceFolder[]): Promise<void>;
56
+ private isGitConfigured;
57
+ private getGitRemoteUrl;
58
+ private sanitizeGitRemoteUrl;
59
+ /**
60
+ * Check if the repository URL is from a standard git hosting provider
61
+ */
62
+ private isStandardGitHost;
63
+ /**
64
+ * Check if the repository host is reachable via network
65
+ * Performs DNS resolution and TCP connection check
66
+ */
67
+ private checkHostConnectivity;
68
+ private checkConnectivityDirect;
69
+ private checkConnectivityViaProxy;
70
+ /**
71
+ * Ensures the parent directory of the given path exists.
72
+ * Handles nested repo.path like "subdir/myproject".
73
+ */
74
+ private ensureParentDirExists;
75
+ private cleanupLockFiles;
76
+ validateGitRepo(repoPath: string): Promise<void>;
77
+ /**
78
+ * If a backup is available, perform a backup recovery (and throw if it fails and cannot be recovered from).
79
+ * If no backup is available, do nothing.
80
+ */
81
+ private restoreFromPartialBackup;
82
+ private initializeGitRepo;
83
+ private refreshRepoConfig;
84
+ runInitializationCommand({ repo, tempCloningDir, repoPath, initCommand, }: {
85
+ repo: ValidatedWorkspaceFolder;
86
+ tempCloningDir: string;
87
+ repoPath: string;
88
+ initCommand: string;
89
+ }): Promise<{
90
+ outcome: boolean;
91
+ error?: Error;
92
+ }>;
93
+ cloneRepository({ repo, repoPath, backupResult, }: {
94
+ repo: WorkspaceFolderWithRepoInfo;
95
+ repoPath: string;
96
+ backupResult: GitBackupDownloadResult | undefined;
97
+ }): Promise<boolean>;
98
+ markGitSafe(repoPath: string): Promise<string>;
165
99
  }
166
100
  export {};