refactor: Simplify import paths (#2093)
Co-authored-by: Patryk Kuniczak <p.kuniczak@gmail.com>
This commit is contained in:
@@ -10,7 +10,7 @@ import {
|
||||
prepare,
|
||||
zip,
|
||||
} from '../src';
|
||||
import { normalizePath } from '../src/core/utils/paths';
|
||||
import { normalizePath } from '../src/core/utils';
|
||||
import merge from 'lodash.merge';
|
||||
|
||||
// Run "pnpm wxt" to use the "wxt" dev script, not the "wxt" binary from the
|
||||
|
||||
@@ -27,7 +27,7 @@ import { installSourcemapsSupport } from 'vite-node/source-map';
|
||||
import { createExtensionEnvironment } from '../../utils/environments';
|
||||
import { dirname, extname, join, relative } from 'node:path';
|
||||
import fs from 'fs-extra';
|
||||
import { normalizePath } from '../../utils/paths';
|
||||
import { normalizePath } from '../../utils';
|
||||
|
||||
export async function createViteBuilder(
|
||||
wxtConfig: ResolvedConfig,
|
||||
|
||||
@@ -4,7 +4,7 @@ import {
|
||||
fakeDevServer,
|
||||
fakeResolvedConfig,
|
||||
} from '../../../../utils/testing/fake-objects';
|
||||
import { normalizePath } from '../../../../utils/paths';
|
||||
import { normalizePath } from '../../../../utils';
|
||||
import { resolve } from 'node:path';
|
||||
import { parseHTML } from 'linkedom';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ import { ResolvedConfig, WxtDevServer } from '../../../../types';
|
||||
import { getEntrypointName } from '../../../utils/entrypoints';
|
||||
import { parseHTML } from 'linkedom';
|
||||
import { dirname, relative, resolve } from 'node:path';
|
||||
import { normalizePath } from '../../../utils/paths';
|
||||
import { normalizePath } from '../../../utils';
|
||||
import { hash } from 'ohash';
|
||||
|
||||
// Stored outside the plugin to effect all instances of the devHtmlPrerender plugin.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ResolvedConfig } from '../../../../types';
|
||||
import type * as vite from 'vite';
|
||||
import { normalizePath } from '../../../utils/paths';
|
||||
import { normalizePath } from '../../../utils';
|
||||
import { removeMainFunctionCode } from '../../../utils/transform';
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { Plugin } from 'vite';
|
||||
import { ResolvedConfig } from '../../../../types';
|
||||
import { normalizePath } from '../../../utils/paths';
|
||||
import { normalizePath } from '../../../utils';
|
||||
import {
|
||||
VirtualModuleId,
|
||||
virtualModuleNames,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { parseHTML } from 'linkedom';
|
||||
import type * as vite from 'vite';
|
||||
import { normalizePath } from '../../../utils/paths';
|
||||
import { normalizePath } from '../../../utils';
|
||||
import { ResolvedConfig } from '../../../../types';
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ import fs from 'fs-extra';
|
||||
import { dirname, relative, resolve } from 'node:path';
|
||||
import { getEntrypointBundlePath, isHtmlEntrypoint } from './utils/entrypoints';
|
||||
import { getEntrypointGlobals, getGlobals } from './utils/globals';
|
||||
import { normalizePath } from './utils/paths';
|
||||
import { normalizePath } from './utils';
|
||||
import path from 'node:path';
|
||||
import { Message, parseI18nMessages } from './utils/i18n';
|
||||
import { writeFileIfDifferent, getPublicFiles } from './utils/fs';
|
||||
|
||||
@@ -21,7 +21,7 @@ import consola, { LogLevels } from 'consola';
|
||||
import defu from 'defu';
|
||||
import { NullablyRequired } from './utils/types';
|
||||
import fs from 'fs-extra';
|
||||
import { normalizePath } from './utils/paths';
|
||||
import { normalizePath } from './utils';
|
||||
import glob from 'fast-glob';
|
||||
import { builtinModules } from '../builtin-modules';
|
||||
import { getEslintVersion } from './utils/eslint';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { beforeEach, describe, expect, it } from 'vitest';
|
||||
import { DevModeChange, detectDevChanges } from '../../../utils/building';
|
||||
import { DevModeChange, detectDevChanges } from '../detect-dev-changes';
|
||||
import {
|
||||
fakeBackgroundEntrypoint,
|
||||
fakeContentScriptEntrypoint,
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
fakeOutputChunk,
|
||||
fakeWxt,
|
||||
setFakeWxt,
|
||||
} from '../../../utils/testing/fake-objects';
|
||||
} from '../../testing/fake-objects';
|
||||
import { BuildOutput, BuildStepOutput } from '../../../../types';
|
||||
import { setWxtForTesting } from '../../../wxt';
|
||||
|
||||
|
||||
@@ -13,11 +13,8 @@ import { resolve } from 'path';
|
||||
import { findEntrypoints } from '../find-entrypoints';
|
||||
import fs from 'fs-extra';
|
||||
import glob from 'fast-glob';
|
||||
import {
|
||||
fakeResolvedConfig,
|
||||
setFakeWxt,
|
||||
} from '../../../utils/testing/fake-objects';
|
||||
import { unnormalizePath } from '../../../utils/paths';
|
||||
import { fakeResolvedConfig, setFakeWxt } from '../../testing/fake-objects';
|
||||
import { unnormalizePath } from '../../paths';
|
||||
import { wxt } from '../../../wxt';
|
||||
|
||||
vi.mock('fast-glob');
|
||||
|
||||
@@ -4,8 +4,8 @@ import {
|
||||
EntrypointGroup,
|
||||
OutputFile,
|
||||
} from '../../../types';
|
||||
import { every, some } from '../../utils/arrays';
|
||||
import { normalizePath } from '../../utils/paths';
|
||||
import { every, some } from '../arrays';
|
||||
import { normalizePath } from '../paths';
|
||||
import { wxt } from '../../wxt';
|
||||
|
||||
/**
|
||||
|
||||
@@ -21,9 +21,9 @@ import {
|
||||
isHtmlEntrypoint,
|
||||
isJsEntrypoint,
|
||||
resolvePerBrowserOptions,
|
||||
} from '../../utils/entrypoints';
|
||||
import { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from '../../utils/constants';
|
||||
import { CSS_EXTENSIONS_PATTERN } from '../../utils/paths';
|
||||
} from '../entrypoints';
|
||||
import { VIRTUAL_NOOP_BACKGROUND_MODULE_ID } from '../constants';
|
||||
import { CSS_EXTENSIONS_PATTERN } from '../paths';
|
||||
import pc from 'picocolors';
|
||||
import { wxt } from '../../wxt';
|
||||
import { camelCase } from 'scule';
|
||||
|
||||
@@ -3,10 +3,10 @@ import { BuildOutput, Entrypoint } from '../../../types';
|
||||
import pc from 'picocolors';
|
||||
import fs from 'fs-extra';
|
||||
import { groupEntrypoints } from './group-entrypoints';
|
||||
import { formatDuration } from '../../utils/time';
|
||||
import { printBuildSummary } from '../../utils/log';
|
||||
import { formatDuration } from '../time';
|
||||
import { printBuildSummary } from '../log';
|
||||
import glob from 'fast-glob';
|
||||
import { unnormalizePath } from '../../utils/paths';
|
||||
import { unnormalizePath } from '../paths';
|
||||
import { rebuild } from './rebuild';
|
||||
import { relative } from 'node:path';
|
||||
import {
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
} from '../../../types';
|
||||
import { mock } from 'vitest-mock-extended';
|
||||
import { vi } from 'vitest';
|
||||
import { setWxtForTesting } from '../../../core/wxt';
|
||||
import { setWxtForTesting } from '../../wxt';
|
||||
import type { Browser } from '@wxt-dev/browser';
|
||||
|
||||
faker.seed(import.meta.test.SEED);
|
||||
|
||||
@@ -4,12 +4,12 @@ import fs from 'fs-extra';
|
||||
import { safeFilename } from './utils/strings';
|
||||
import { getPackageJson } from './utils/package';
|
||||
import { formatDuration } from './utils/time';
|
||||
import { printFileList } from './utils/log/printFileList';
|
||||
import { printFileList } from './utils/log';
|
||||
import { findEntrypoints, internalBuild } from './utils/building';
|
||||
import { registerWxt, wxt } from './wxt';
|
||||
import JSZip from 'jszip';
|
||||
import glob from 'fast-glob';
|
||||
import { normalizePath } from './utils/paths';
|
||||
import { normalizePath } from './utils';
|
||||
import { minimatchMultiple } from './utils/minimatch-multiple';
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/** @module wxt/utils/content-script-context */
|
||||
import { ContentScriptDefinition } from '../types';
|
||||
import { browser } from 'wxt/browser';
|
||||
import { logger } from '../utils/internal/logger';
|
||||
import { logger } from './internal/logger';
|
||||
import {
|
||||
WxtLocationChangeEvent,
|
||||
getUniqueEventName,
|
||||
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
isExist as mountDetector,
|
||||
isNotExist as removeDetector,
|
||||
} from '@1natsu/wait-element/detectors';
|
||||
import { logger } from '../../utils/internal/logger';
|
||||
import { logger } from '../internal/logger';
|
||||
|
||||
export function applyPosition(
|
||||
root: HTMLElement,
|
||||
|
||||
Reference in New Issue
Block a user