chore: consistently import node modules with prefix (#3013)

Co-authored-by: N. Taylor Mullen <ntaylormullen@google.com>
This commit is contained in:
Pascal Birchler
2025-08-25 22:11:27 +02:00
committed by GitHub
parent 415d3413c4
commit ee4feea006
168 changed files with 420 additions and 405 deletions

View File

@@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { promises as fs } from 'fs';
import { join } from 'path';
import { promises as fs } from 'node:fs';
import { join } from 'node:path';
import { Storage } from '@google/gemini-cli-core';
const cleanupFunctions: Array<(() => void) | (() => Promise<void>)> = [];

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { EventEmitter } from 'events';
import { EventEmitter } from 'node:events';
export enum AppEvent {
OpenDebugConsole = 'open-debug-console',

View File

@@ -5,7 +5,7 @@
*/
import { vi, describe, expect, it, afterEach, beforeEach } from 'vitest';
import * as child_process from 'child_process';
import * as child_process from 'node:child_process';
import {
isGitHubRepository,
getGitRepoRoot,

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { execSync } from 'child_process';
import { execSync } from 'node:child_process';
import { ProxyAgent } from 'undici';
/**

View File

@@ -10,7 +10,7 @@ import { getInstallationInfo } from './installationInfo.js';
import { updateEventEmitter } from './updateEventEmitter.js';
import { HistoryItem, MessageType } from '../ui/types.js';
import { spawnWrapper } from './spawnWrapper.js';
import { spawn } from 'child_process';
import { spawn } from 'node:child_process';
export function handleAutoUpdate(
info: UpdateObject | null,

View File

@@ -6,9 +6,9 @@
import { vi, describe, it, expect, beforeEach, afterEach } from 'vitest';
import { getInstallationInfo, PackageManager } from './installationInfo.js';
import * as fs from 'fs';
import * as path from 'path';
import * as childProcess from 'child_process';
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as childProcess from 'node:child_process';
import { isGitRepository } from '@google/gemini-cli-core';
vi.mock('@google/gemini-cli-core', () => ({

View File

@@ -5,9 +5,9 @@
*/
import { isGitRepository } from '@google/gemini-cli-core';
import * as fs from 'fs';
import * as path from 'path';
import * as childProcess from 'child_process';
import * as fs from 'node:fs';
import * as path from 'node:path';
import * as childProcess from 'node:child_process';
export enum PackageManager {
NPM = 'npm',

View File

@@ -8,8 +8,8 @@ import {
readPackageUp,
type PackageJson as BasePackageJson,
} from 'read-package-up';
import { fileURLToPath } from 'url';
import path from 'path';
import { fileURLToPath } from 'node:url';
import path from 'node:path';
export type PackageJson = BasePackageJson & {
config?: {

View File

@@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
import * as os from 'os';
import * as path from 'path';
import * as os from 'node:os';
import * as path from 'node:path';
export function resolvePath(p: string): string {
if (!p) {

View File

@@ -15,7 +15,7 @@ import {
USER_SETTINGS_DIR,
SETTINGS_DIRECTORY_NAME,
} from '../config/settings.js';
import { promisify } from 'util';
import { promisify } from 'node:util';
import { Config, SandboxConfig } from '@google/gemini-cli-core';
import { ConsolePatcher } from '../ui/utils/ConsolePatcher.js';

View File

@@ -4,6 +4,6 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { spawn } from 'child_process';
import { spawn } from 'node:child_process';
export const spawnWrapper = spawn;

View File

@@ -6,7 +6,7 @@
import { describe, it, expect, vi, beforeEach } from 'vitest';
import { getStartupWarnings } from './startupWarnings.js';
import * as fs from 'fs/promises';
import * as fs from 'node:fs/promises';
import { getErrorMessage } from '@google/gemini-cli-core';
vi.mock('fs/promises');

View File

@@ -4,8 +4,8 @@
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'fs/promises';
import os from 'os';
import fs from 'node:fs/promises';
import os from 'node:os';
import { join as pathJoin } from 'node:path';
import { getErrorMessage } from '@google/gemini-cli-core';

View File

@@ -4,7 +4,7 @@
* SPDX-License-Identifier: Apache-2.0
*/
import { EventEmitter } from 'events';
import { EventEmitter } from 'node:events';
/**
* A shared event emitter for application-wide communication

View File

@@ -6,9 +6,9 @@
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import { getUserStartupWarnings } from './userStartupWarnings.js';
import * as os from 'os';
import fs from 'fs/promises';
import path from 'path';
import * as os from 'node:os';
import fs from 'node:fs/promises';
import path from 'node:path';
// Mock os.homedir to control the home directory in tests
vi.mock('os', async (importOriginal) => {

View File

@@ -4,9 +4,9 @@
* SPDX-License-Identifier: Apache-2.0
*/
import fs from 'fs/promises';
import * as os from 'os';
import path from 'path';
import fs from 'node:fs/promises';
import * as os from 'node:os';
import path from 'node:path';
type WarningCheck = {
id: string;