Explict imports & exports with type modifier (#3774)

This commit is contained in:
Pascal Birchler
2025-08-26 00:04:53 +02:00
committed by GitHub
parent 71c090c696
commit 0f031a7f89
332 changed files with 1086 additions and 1105 deletions
+5 -3
View File
@@ -4,11 +4,13 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { AuthType, ContentGenerator } from '../core/contentGenerator.js';
import type { ContentGenerator } from '../core/contentGenerator.js';
import { AuthType } from '../core/contentGenerator.js';
import { getOauthClient } from './oauth2.js';
import { setupUser } from './setup.js';
import { CodeAssistServer, HttpOptions } from './server.js';
import { Config } from '../config/config.js';
import type { HttpOptions } from './server.js';
import { CodeAssistServer } from './server.js';
import type { Config } from '../config/config.js';
export async function createCodeAssistContentGenerator(
httpOptions: HttpOptions,
@@ -5,19 +5,21 @@
*/
import { describe, it, expect } from 'vitest';
import type { CaGenerateContentResponse } from './converter.js';
import {
toGenerateContentRequest,
fromGenerateContentResponse,
CaGenerateContentResponse,
toContents,
} from './converter.js';
import {
import type {
ContentListUnion,
GenerateContentParameters,
} from '@google/genai';
import {
GenerateContentResponse,
FinishReason,
BlockedReason,
Part,
type Part,
} from '@google/genai';
describe('converter', () => {
+2 -2
View File
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import {
import type {
Content,
ContentListUnion,
ContentUnion,
@@ -12,7 +12,6 @@ import {
GenerateContentParameters,
CountTokensParameters,
CountTokensResponse,
GenerateContentResponse,
GenerationConfigRoutingConfig,
MediaResolution,
Candidate,
@@ -27,6 +26,7 @@ import {
ToolListUnion,
ToolConfig,
} from '@google/genai';
import { GenerateContentResponse } from '@google/genai';
export interface CAGenerateContentRequest {
model: string;
+3 -2
View File
@@ -4,7 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { describe, it, expect, vi, beforeEach, afterEach, Mock } from 'vitest';
import type { Mock } from 'vitest';
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import {
getOauthClient,
resetOauthClientForTesting,
@@ -20,7 +21,7 @@ import open from 'open';
import crypto from 'node:crypto';
import * as os from 'node:os';
import { AuthType } from '../core/contentGenerator.js';
import { Config } from '../config/config.js';
import type { Config } from '../config/config.js';
import readline from 'node:readline';
vi.mock('os', async (importOriginal) => {
+2 -2
View File
@@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
import type { Credentials } from 'google-auth-library';
import {
OAuth2Client,
Credentials,
Compute,
CodeChallengeMethod,
} from 'google-auth-library';
@@ -17,7 +17,7 @@ import * as net from 'node:net';
import open from 'open';
import path from 'node:path';
import { promises as fs } from 'node:fs';
import { Config } from '../config/config.js';
import type { Config } from '../config/config.js';
import { getErrorMessage } from '../utils/errors.js';
import { UserAccountManager } from '../utils/userAccountManager.js';
import { AuthType } from '../core/contentGenerator.js';
+8 -6
View File
@@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { OAuth2Client } from 'google-auth-library';
import {
import type { OAuth2Client } from 'google-auth-library';
import type {
CodeAssistGlobalUserSettingResponse,
LoadCodeAssistRequest,
LoadCodeAssistResponse,
@@ -13,7 +13,7 @@ import {
OnboardUserRequest,
SetCodeAssistGlobalUserSettingRequest,
} from './types.js';
import {
import type {
CountTokensParameters,
CountTokensResponse,
EmbedContentParameters,
@@ -22,11 +22,13 @@ import {
GenerateContentResponse,
} from '@google/genai';
import * as readline from 'node:readline';
import { ContentGenerator } from '../core/contentGenerator.js';
import { UserTierId } from './types.js';
import {
import type { ContentGenerator } from '../core/contentGenerator.js';
import type { UserTierId } from './types.js';
import type {
CaCountTokenResponse,
CaGenerateContentResponse,
} from './converter.js';
import {
fromCountTokenResponse,
fromGenerateContentResponse,
toCountTokenRequest,
+3 -2
View File
@@ -11,8 +11,9 @@ import {
ProjectAccessError,
} from './setup.js';
import { CodeAssistServer } from '../code_assist/server.js';
import { OAuth2Client } from 'google-auth-library';
import { GeminiUserTier, UserTierId } from './types.js';
import type { OAuth2Client } from 'google-auth-library';
import type { GeminiUserTier } from './types.js';
import { UserTierId } from './types.js';
import { AuthType } from '../core/contentGenerator.js';
vi.mock('../code_assist/server.js');
+3 -3
View File
@@ -4,15 +4,15 @@
* SPDX-License-Identifier: Apache-2.0
*/
import {
import type {
ClientMetadata,
GeminiUserTier,
LoadCodeAssistResponse,
OnboardUserRequest,
UserTierId,
} from './types.js';
import { UserTierId } from './types.js';
import { CodeAssistServer } from './server.js';
import { OAuth2Client } from 'google-auth-library';
import type { OAuth2Client } from 'google-auth-library';
import { AuthType } from '../core/contentGenerator.js';
export class ProjectIdRequiredError extends Error {