diff --git a/eslint-rules/local-paths.js b/eslint-rules/local-paths.js new file mode 100644 index 000000000..10fedd255 --- /dev/null +++ b/eslint-rules/local-paths.js @@ -0,0 +1,233 @@ +import path from 'node:path'; + +function normalize(p) { + return p.split(path.sep).join('/'); +} + +function stripExtAndIndex(p) { + return p + .replace(/(\/index)?\.(ts|tsx|js|cjs|mjs|d\.ts)$/, '') + .replace(/\/index$/, ''); +} + +/** + * Single consolidated rule implementing the previous three behaviors: + * - plugins: allow relative within same plugin (plugin may be @scope/name), else require `~` + * - openApi: allow relative only within same first-level openApi folder, else require `~` + * - first-level folders: allow relative only within same first-level folder, else require `~` + */ +const enforceLocalPaths = { + create(context) { + const filename = context.getFilename(); + if (!filename || filename === '') return {}; + + const normalizedFile = normalize(filename); + const srcMarker = '/packages/openapi-ts/src/'; + const srcIdx = normalizedFile.indexOf(srcMarker); + if (srcIdx === -1) return {}; + + const after = normalizedFile.slice(srcIdx + srcMarker.length); + const parts = after.split('/'); + const firstLevel = parts[0]; + + // helpers and mode-specific roots + // compute the absolute normalized bundle root for accurate comparisons + let bundleAbsRoot = + normalizedFile.slice(0, srcIdx + srcMarker.length) + + 'plugins/@hey-api/client-core/bundle/'; + bundleAbsRoot = normalize(bundleAbsRoot); + + let mode = 'first-level'; + let pluginAbsRoot = null; + let openApiFirstRoot = null; + let firstRoot = null; + + if (firstLevel === 'plugins') { + mode = 'plugins'; + // derive plugin folder (support scoped plugin names) + let pluginFolder = parts[1] || ''; + if (pluginFolder.startsWith('@') && parts.length > 2) { + pluginFolder = `${pluginFolder}/${parts[2]}`; + } + pluginAbsRoot = + normalizedFile.slice(0, srcIdx + srcMarker.length) + + `plugins/${pluginFolder}/`; + pluginAbsRoot = normalize(pluginAbsRoot); + } else if (firstLevel === 'openApi') { + mode = 'openApi'; + const apiFirst = parts[1] || ''; + openApiFirstRoot = + normalizedFile.slice(0, srcIdx + srcMarker.length) + + `openApi/${apiFirst}/`; + openApiFirstRoot = normalize(openApiFirstRoot); + } else { + firstRoot = + normalizedFile.slice(0, srcIdx + srcMarker.length) + `${firstLevel}/`; + firstRoot = normalize(firstRoot); + } + + function resolveFromBasedir(basedir, sourceValue) { + try { + return path.resolve(basedir, sourceValue); + } catch { + return null; + } + } + + function resolveTildeToAbs(sourceValue) { + const rest = sourceValue.replace(/^~\/?/, ''); + return path.resolve(process.cwd(), 'packages/openapi-ts/src', rest); + } + + function toTilde(resolvedAbsolutePath) { + const normalized = normalize(resolvedAbsolutePath); + const marker = '/packages/openapi-ts/src/'; + const i = normalized.indexOf(marker); + if (i === -1) return null; + let rest = normalized.slice(i + marker.length); + rest = stripExtAndIndex(rest); + return `~/${rest}`; + } + + function reportReplaceWithTilde(node, sourceValue, message) { + const basedir = path.dirname(filename); + const resolved = resolveFromBasedir(basedir, sourceValue); + if (!resolved) return; + const newImport = toTilde(resolved); + if (!newImport) return; + context.report({ + fix(fixer) { + return fixer.replaceText(node.source, `'${newImport}'`); + }, + message, + node: node.source, + }); + } + + function reportReplaceWithRelative(node, sourceValue, message) { + const resolved = resolveTildeToAbs(sourceValue); + if (!resolved) return; + let relativePath = path + .relative(path.dirname(filename), resolved) + .split(path.sep) + .join('/'); + relativePath = stripExtAndIndex(relativePath); + if (!relativePath.startsWith('.')) relativePath = `./${relativePath}`; + context.report({ + fix(fixer) { + return fixer.replaceText(node.source, `'${relativePath}'`); + }, + message, + node: node.source, + }); + } + + function shouldRewriteRelative(sourceValue) { + if (typeof sourceValue !== 'string') return false; + if (!sourceValue.startsWith('.')) return false; + const basedir = path.dirname(filename); + const resolved = resolveFromBasedir(basedir, sourceValue); + if (!resolved) return false; + const nr = normalize(resolved); + if (!nr.includes('/packages/openapi-ts/src/')) return false; + + if (mode === 'plugins') { + if (nr.startsWith(pluginAbsRoot)) return false; // inside same plugin -> keep relative + if (nr.startsWith(bundleAbsRoot)) return false; // client-core bundle: keep relative + return true; + } + + if (mode === 'openApi') { + // if target is inside same first-level openApi folder -> don't rewrite + if (nr.startsWith(openApiFirstRoot)) return false; + // only rewrite if target is inside openApi at all + return nr.includes('/packages/openapi-ts/src/openApi/'); + } + + // generic first-level folder rule + if (nr.startsWith(firstRoot)) return false; + return true; + } + + function shouldRewriteTilde(sourceValue) { + if (typeof sourceValue !== 'string') return false; + if (!sourceValue.startsWith('~')) return false; + const resolved = resolveTildeToAbs(sourceValue); + if (!resolved) return false; + const nr = normalize(resolved); + + if (mode === 'plugins') { + // prefer relative imports for same-plugin targets or for the shared client-core bundle + return nr.startsWith(pluginAbsRoot) || nr.startsWith(bundleAbsRoot); + } + if (mode === 'openApi') { + return nr.startsWith(openApiFirstRoot); + } + return nr.startsWith(firstRoot); + } + + return { + ExportAllDeclaration(node) { + const sourceValue = node.source && node.source.value; + if (shouldRewriteRelative(sourceValue)) { + reportReplaceWithTilde( + node, + sourceValue, + 'Prefer `~` export for cross-boundary exports (autofixable).', + ); + return; + } + if (shouldRewriteTilde(sourceValue)) { + reportReplaceWithRelative( + node, + sourceValue, + 'Prefer relative export for intra-boundary targets (autofixable).', + ); + return; + } + }, + ImportDeclaration(node) { + const sourceValue = node.source && node.source.value; + if (shouldRewriteRelative(sourceValue)) { + reportReplaceWithTilde( + node, + sourceValue, + 'Prefer `~` import for cross-boundary imports (autofixable).', + ); + return; + } + if (shouldRewriteTilde(sourceValue)) { + reportReplaceWithRelative( + node, + sourceValue, + 'Prefer relative import for intra-boundary targets (autofixable).', + ); + return; + } + }, + }; + }, + meta: { + docs: { + description: + 'Enforce local import path boundaries for openapi-ts sources', + recommended: false, + }, + fixable: 'code', + schema: [], + type: 'suggestion', + }, +}; + +export default { + configs: { + recommended: { + rules: { + 'local-paths/enforce-local-paths': 'error', + }, + }, + }, + rules: { + 'enforce-local-paths': enforceLocalPaths, + }, +}; diff --git a/eslint.config.js b/eslint.config.js index 42826d4b0..93fb9b916 100644 --- a/eslint.config.js +++ b/eslint.config.js @@ -8,9 +8,12 @@ import pluginTypeScriptSortKeys from 'eslint-plugin-typescript-sort-keys'; import globals from 'globals'; import tseslint from 'typescript-eslint'; +import pluginLocalPaths from './eslint-rules/local-paths.js'; + export default tseslint.config( eslint.configs.recommended, ...tseslint.configs.recommended, + pluginLocalPaths.configs.recommended, { languageOptions: { ecmaVersion: 'latest', @@ -19,6 +22,7 @@ export default tseslint.config( }, }, plugins: { + 'local-paths': pluginLocalPaths, 'simple-import-sort': pluginSimpleImportSort, 'sort-destructure-keys': pluginSortDestructureKeys, 'sort-keys-fix': pluginSortKeysFix, diff --git a/packages/openapi-ts-tests/main/test/openapi-ts.config.ts b/packages/openapi-ts-tests/main/test/openapi-ts.config.ts index 68f1ac07c..fb1858316 100644 --- a/packages/openapi-ts-tests/main/test/openapi-ts.config.ts +++ b/packages/openapi-ts-tests/main/test/openapi-ts.config.ts @@ -275,7 +275,7 @@ export default defineConfig(() => { // mutationOptions: { // name: '{{name}}MO', // }, - // name: '@tanstack/react-query', + name: '@tanstack/react-query', // queryKeys: { // name: '{{name}}QK', // }, diff --git a/packages/openapi-ts-tests/main/vitest.config.ts b/packages/openapi-ts-tests/main/vitest.config.ts index d13ef5fee..7c627e64f 100644 --- a/packages/openapi-ts-tests/main/vitest.config.ts +++ b/packages/openapi-ts-tests/main/vitest.config.ts @@ -1,7 +1,15 @@ +import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { createVitestConfig } from '@config/vite-base'; -export default createVitestConfig( - fileURLToPath(new URL('./', import.meta.url)), -); +const rootDir = fileURLToPath(new URL('./', import.meta.url)); + +export default createVitestConfig(rootDir, { + resolve: { + alias: [ + { find: /^~\/(.*)/, replacement: path.resolve(rootDir, 'src/$1') }, + { find: '~', replacement: path.resolve(rootDir, 'src') }, + ], + }, +}); diff --git a/packages/openapi-ts-tests/zod/v3/vitest.config.ts b/packages/openapi-ts-tests/zod/v3/vitest.config.ts index d13ef5fee..7c627e64f 100644 --- a/packages/openapi-ts-tests/zod/v3/vitest.config.ts +++ b/packages/openapi-ts-tests/zod/v3/vitest.config.ts @@ -1,7 +1,15 @@ +import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { createVitestConfig } from '@config/vite-base'; -export default createVitestConfig( - fileURLToPath(new URL('./', import.meta.url)), -); +const rootDir = fileURLToPath(new URL('./', import.meta.url)); + +export default createVitestConfig(rootDir, { + resolve: { + alias: [ + { find: /^~\/(.*)/, replacement: path.resolve(rootDir, 'src/$1') }, + { find: '~', replacement: path.resolve(rootDir, 'src') }, + ], + }, +}); diff --git a/packages/openapi-ts-tests/zod/v4/vitest.config.ts b/packages/openapi-ts-tests/zod/v4/vitest.config.ts index d13ef5fee..7c627e64f 100644 --- a/packages/openapi-ts-tests/zod/v4/vitest.config.ts +++ b/packages/openapi-ts-tests/zod/v4/vitest.config.ts @@ -1,7 +1,15 @@ +import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { createVitestConfig } from '@config/vite-base'; -export default createVitestConfig( - fileURLToPath(new URL('./', import.meta.url)), -); +const rootDir = fileURLToPath(new URL('./', import.meta.url)); + +export default createVitestConfig(rootDir, { + resolve: { + alias: [ + { find: /^~\/(.*)/, replacement: path.resolve(rootDir, 'src/$1') }, + { find: '~', replacement: path.resolve(rootDir, 'src') }, + ], + }, +}); diff --git a/packages/openapi-ts/src/__tests__/createClient.test.ts b/packages/openapi-ts/src/__tests__/createClient.test.ts index 6c4acec07..6b0886dfc 100644 --- a/packages/openapi-ts/src/__tests__/createClient.test.ts +++ b/packages/openapi-ts/src/__tests__/createClient.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { compileInputPath } from '../createClient'; +import { compileInputPath } from '~/createClient'; describe('compileInputPath', () => { it('with raw OpenAPI specification', () => { diff --git a/packages/openapi-ts/src/__tests__/error.test.ts b/packages/openapi-ts/src/__tests__/error.test.ts index 57cff1d4f..15e7abcea 100644 --- a/packages/openapi-ts/src/__tests__/error.test.ts +++ b/packages/openapi-ts/src/__tests__/error.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it, vi } from 'vitest'; -import { shouldReportCrash } from '../error'; +import { shouldReportCrash } from '~/error'; describe('shouldReportCrash', () => { it('should return false when isInteractive is false', async () => { diff --git a/packages/openapi-ts/src/__tests__/index.test.ts b/packages/openapi-ts/src/__tests__/index.test.ts index d2c7b631a..c3374ee5c 100644 --- a/packages/openapi-ts/src/__tests__/index.test.ts +++ b/packages/openapi-ts/src/__tests__/index.test.ts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest'; -import { createClient } from '../index'; +import { createClient } from '~/index'; type Config = Parameters[0]; diff --git a/packages/openapi-ts/src/__tests__/interactive.test.ts b/packages/openapi-ts/src/__tests__/interactive.test.ts index 626e357b4..7812c9546 100644 --- a/packages/openapi-ts/src/__tests__/interactive.test.ts +++ b/packages/openapi-ts/src/__tests__/interactive.test.ts @@ -1,8 +1,8 @@ import { afterEach, describe, expect, it } from 'vitest'; -import { detectInteractiveSession, initConfigs } from '../config/init'; -import { mergeConfigs } from '../config/merge'; -import { Logger } from '../utils/logger'; +import { detectInteractiveSession, initConfigs } from '~/config/init'; +import { mergeConfigs } from '~/config/merge'; +import { Logger } from '~/utils/logger'; describe('interactive config', () => { it('should use detectInteractiveSession when not provided', async () => { diff --git a/packages/openapi-ts/src/config/__tests__/input.test.ts b/packages/openapi-ts/src/config/__tests__/input.test.ts index b55b3246f..c71da149f 100644 --- a/packages/openapi-ts/src/config/__tests__/input.test.ts +++ b/packages/openapi-ts/src/config/__tests__/input.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; -import type { UserConfig } from '../../types/config'; +import type { UserConfig } from '~/types/config'; + import { getInput } from '../input'; describe('input config', () => { diff --git a/packages/openapi-ts/src/config/engine.ts b/packages/openapi-ts/src/config/engine.ts index 637ead0ea..c7189278b 100644 --- a/packages/openapi-ts/src/config/engine.ts +++ b/packages/openapi-ts/src/config/engine.ts @@ -1,4 +1,4 @@ -import { ConfigError } from '../error'; +import { ConfigError } from '~/error'; export const checkNodeVersion = () => { if (typeof Bun !== 'undefined') { diff --git a/packages/openapi-ts/src/config/init.ts b/packages/openapi-ts/src/config/init.ts index 7350a7401..e7d629d36 100644 --- a/packages/openapi-ts/src/config/init.ts +++ b/packages/openapi-ts/src/config/init.ts @@ -2,11 +2,12 @@ import path from 'node:path'; import colors from 'ansi-colors'; -import { ConfigError } from '../error'; -import type { Config, UserConfig } from '../types/config'; -import type { ArrayOnly } from '../types/utils'; -import { isLegacyClient, setConfig } from '../utils/config'; -import type { Logger } from '../utils/logger'; +import { ConfigError } from '~/error'; +import type { Config, UserConfig } from '~/types/config'; +import type { ArrayOnly } from '~/types/utils'; +import { isLegacyClient, setConfig } from '~/utils/config'; +import type { Logger } from '~/utils/logger'; + import { getInput } from './input'; import { getLogs } from './logs'; import { mergeConfigs } from './merge'; diff --git a/packages/openapi-ts/src/config/input.ts b/packages/openapi-ts/src/config/input.ts index 39629a80b..2aea3667d 100644 --- a/packages/openapi-ts/src/config/input.ts +++ b/packages/openapi-ts/src/config/input.ts @@ -1,7 +1,7 @@ -import type { Config, UserConfig } from '../types/config'; -import type { Input, Watch } from '../types/input'; -import { inputToApiRegistry } from '../utils/input'; -import { heyApiRegistryBaseUrl } from '../utils/input/heyApi'; +import type { Config, UserConfig } from '~/types/config'; +import type { Input, Watch } from '~/types/input'; +import { inputToApiRegistry } from '~/utils/input'; +import { heyApiRegistryBaseUrl } from '~/utils/input/heyApi'; const defaultWatch: Watch = { enabled: false, diff --git a/packages/openapi-ts/src/config/logs.ts b/packages/openapi-ts/src/config/logs.ts index ada1300ef..91d5742c5 100644 --- a/packages/openapi-ts/src/config/logs.ts +++ b/packages/openapi-ts/src/config/logs.ts @@ -1,4 +1,4 @@ -import type { Config, UserConfig } from '../types/config'; +import type { Config, UserConfig } from '~/types/config'; export const getLogs = ( userConfig: Pick | undefined, diff --git a/packages/openapi-ts/src/config/merge.ts b/packages/openapi-ts/src/config/merge.ts index 7ade55e4d..5dc7b3a86 100644 --- a/packages/openapi-ts/src/config/merge.ts +++ b/packages/openapi-ts/src/config/merge.ts @@ -1,4 +1,4 @@ -import type { UserConfig } from '../types/config'; +import type { UserConfig } from '~/types/config'; const mergeObjects = ( objA: Record | undefined, diff --git a/packages/openapi-ts/src/config/output.ts b/packages/openapi-ts/src/config/output.ts index e03fff839..98ac0563c 100644 --- a/packages/openapi-ts/src/config/output.ts +++ b/packages/openapi-ts/src/config/output.ts @@ -1,7 +1,8 @@ import ts from 'typescript'; -import { findTsConfigPath, loadTsConfig } from '../generate/tsConfig'; -import type { Config, UserConfig } from '../types/config'; +import { findTsConfigPath, loadTsConfig } from '~/generate/tsConfig'; +import type { Config, UserConfig } from '~/types/config'; + import { valueToObject } from './utils/config'; export const getOutput = (userConfig: UserConfig): Config['output'] => { diff --git a/packages/openapi-ts/src/config/parser.ts b/packages/openapi-ts/src/config/parser.ts index e44f6af86..82aeb2f39 100644 --- a/packages/openapi-ts/src/config/parser.ts +++ b/packages/openapi-ts/src/config/parser.ts @@ -1,4 +1,5 @@ -import type { Config, UserConfig } from '../types/config'; +import type { Config, UserConfig } from '~/types/config'; + import { valueToObject } from './utils/config'; export const defaultPaginationKeywords = [ diff --git a/packages/openapi-ts/src/config/plugins.ts b/packages/openapi-ts/src/config/plugins.ts index 94210a902..7ffb90b21 100644 --- a/packages/openapi-ts/src/config/plugins.ts +++ b/packages/openapi-ts/src/config/plugins.ts @@ -1,10 +1,11 @@ -import { defaultPluginConfigs } from '../plugins/config'; +import { defaultPluginConfigs } from '~/plugins/config'; import type { AnyPluginName, PluginContext, PluginNames, -} from '../plugins/types'; -import type { Config, UserConfig } from '../types/config'; +} from '~/plugins/types'; +import type { Config, UserConfig } from '~/types/config'; + import { valueToObject } from './utils/config'; import { packageFactory } from './utils/package'; diff --git a/packages/openapi-ts/src/createClient.ts b/packages/openapi-ts/src/createClient.ts index 23f63ce23..aa04acf60 100644 --- a/packages/openapi-ts/src/createClient.ts +++ b/packages/openapi-ts/src/createClient.ts @@ -3,22 +3,22 @@ import path from 'node:path'; import { $RefParser } from '@hey-api/json-schema-ref-parser'; import colors from 'ansi-colors'; -import { generateLegacyOutput } from './generate/legacy/output'; -import { generateOutput } from './generate/output'; -import { getSpec } from './getSpec'; -import type { IR } from './ir/types'; -import { parseLegacy, parseOpenApiSpec } from './openApi'; -import { buildGraph } from './openApi/shared/utils/graph'; -import { patchOpenApiSpec } from './openApi/shared/utils/patch'; -import { processOutput } from './processOutput'; -import type { Client } from './types/client'; -import type { Config } from './types/config'; -import type { Input } from './types/input'; -import type { WatchValues } from './types/types'; -import { isLegacyClient, legacyNameFromConfig } from './utils/config'; -import type { Templates } from './utils/handlebars'; -import type { Logger } from './utils/logger'; -import { postProcessClient } from './utils/postprocess'; +import { generateLegacyOutput } from '~/generate/legacy/output'; +import { generateOutput } from '~/generate/output'; +import { getSpec } from '~/getSpec'; +import type { IR } from '~/ir/types'; +import { parseLegacy, parseOpenApiSpec } from '~/openApi'; +import { buildGraph } from '~/openApi/shared/utils/graph'; +import { patchOpenApiSpec } from '~/openApi/shared/utils/patch'; +import { processOutput } from '~/processOutput'; +import type { Client } from '~/types/client'; +import type { Config } from '~/types/config'; +import type { Input } from '~/types/input'; +import type { WatchValues } from '~/types/types'; +import { isLegacyClient, legacyNameFromConfig } from '~/utils/config'; +import type { Templates } from '~/utils/handlebars'; +import type { Logger } from '~/utils/logger'; +import { postProcessClient } from '~/utils/postprocess'; export const compileInputPath = (input: Omit) => { const result: Pick< diff --git a/packages/openapi-ts/src/debug/graph.ts b/packages/openapi-ts/src/debug/graph.ts index c04f6a19a..38f3e7ca5 100644 --- a/packages/openapi-ts/src/debug/graph.ts +++ b/packages/openapi-ts/src/debug/graph.ts @@ -1,4 +1,4 @@ -import type { Graph } from '../openApi/shared/utils/graph'; +import type { Graph } from '~/openApi/shared/utils/graph'; const analyzeStructure = (graph: Graph) => { let maxDepth = 0; diff --git a/packages/openapi-ts/src/debug/ir.ts b/packages/openapi-ts/src/debug/ir.ts index 1a0f62d39..03bf852c1 100644 --- a/packages/openapi-ts/src/debug/ir.ts +++ b/packages/openapi-ts/src/debug/ir.ts @@ -1,7 +1,7 @@ import colors from 'ansi-colors'; -import type { IR } from '../ir/types'; -import { httpMethods } from '../openApi/shared/utils/operation'; +import type { IR } from '~/ir/types'; +import { httpMethods } from '~/openApi/shared/utils/operation'; export interface PrintOptions { /** diff --git a/packages/openapi-ts/src/error.ts b/packages/openapi-ts/src/error.ts index 94173f6dd..229d6ee5d 100644 --- a/packages/openapi-ts/src/error.ts +++ b/packages/openapi-ts/src/error.ts @@ -3,8 +3,8 @@ import path from 'node:path'; import colors from 'ansi-colors'; -import { loadPackageJson } from './generate/tsConfig'; -import { ensureDirSync } from './generate/utils'; +import { loadPackageJson } from '~/generate/tsConfig'; +import { ensureDirSync } from '~/generate/utils'; type IJobError = { error: Error; diff --git a/packages/openapi-ts/src/generate/__tests__/class.test.ts b/packages/openapi-ts/src/generate/__tests__/class.test.ts index 4d56bc0b2..af7c37d34 100644 --- a/packages/openapi-ts/src/generate/__tests__/class.test.ts +++ b/packages/openapi-ts/src/generate/__tests__/class.test.ts @@ -3,8 +3,9 @@ import fs from 'node:fs'; import type ts from 'typescript'; import { describe, expect, it, vi } from 'vitest'; -import type { Config } from '../../types/config'; -import { setConfig } from '../../utils/config'; +import type { Config } from '~/types/config'; +import { setConfig } from '~/utils/config'; + import { generateLegacyClientClass } from '../class'; import { mockTemplates, openApi } from './mocks'; diff --git a/packages/openapi-ts/src/generate/__tests__/core.test.ts b/packages/openapi-ts/src/generate/__tests__/core.test.ts index 89b02629d..9da697ef8 100644 --- a/packages/openapi-ts/src/generate/__tests__/core.test.ts +++ b/packages/openapi-ts/src/generate/__tests__/core.test.ts @@ -4,8 +4,9 @@ import path from 'node:path'; import type ts from 'typescript'; import { beforeEach, describe, expect, it, vi } from 'vitest'; -import type { Config } from '../../types/config'; -import { setConfig } from '../../utils/config'; +import type { Config } from '~/types/config'; +import { setConfig } from '~/utils/config'; + import { generateLegacyCore } from '../core'; import { mockTemplates } from './mocks'; diff --git a/packages/openapi-ts/src/generate/__tests__/mocks.ts b/packages/openapi-ts/src/generate/__tests__/mocks.ts index 6d5718dd3..fdffc1900 100644 --- a/packages/openapi-ts/src/generate/__tests__/mocks.ts +++ b/packages/openapi-ts/src/generate/__tests__/mocks.ts @@ -1,9 +1,9 @@ import { vi } from 'vitest'; -import type { OpenApi } from '../../openApi'; -import type { Client } from '../../types/client'; -import type { Config } from '../../types/config'; -import type { Templates } from '../../utils/handlebars'; +import type { OpenApi } from '~/openApi'; +import type { Client } from '~/types/client'; +import type { Config } from '~/types/config'; +import type { Templates } from '~/utils/handlebars'; export const client: Client = { config: {} as Config, diff --git a/packages/openapi-ts/src/generate/class.ts b/packages/openapi-ts/src/generate/class.ts index 45a93cc03..e40b9f0bb 100644 --- a/packages/openapi-ts/src/generate/class.ts +++ b/packages/openapi-ts/src/generate/class.ts @@ -1,13 +1,14 @@ import fs from 'node:fs'; import path from 'node:path'; -import type { OpenApi } from '../openApi'; -import { getClientPlugin } from '../plugins/@hey-api/client-core/utils'; -import type { Client } from '../types/client'; -import { getConfig, legacyNameFromConfig } from '../utils/config'; -import { getHttpRequestName } from '../utils/getHttpRequestName'; -import type { Templates } from '../utils/handlebars'; -import { sortByName } from '../utils/sort'; +import type { OpenApi } from '~/openApi'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import type { Client } from '~/types/client'; +import { getConfig, legacyNameFromConfig } from '~/utils/config'; +import { getHttpRequestName } from '~/utils/getHttpRequestName'; +import type { Templates } from '~/utils/handlebars'; +import { sortByName } from '~/utils/sort'; + import { ensureDirSync } from './utils'; /** diff --git a/packages/openapi-ts/src/generate/client.ts b/packages/openapi-ts/src/generate/client.ts index fb38b6307..a93d3d214 100644 --- a/packages/openapi-ts/src/generate/client.ts +++ b/packages/openapi-ts/src/generate/client.ts @@ -4,10 +4,11 @@ import { fileURLToPath } from 'node:url'; import type { IProject, ProjectRenderMeta } from '@hey-api/codegen-core'; -import type { Client } from '../plugins/@hey-api/client-core/types'; -import { getClientPlugin } from '../plugins/@hey-api/client-core/utils'; -import type { DefinePlugin } from '../plugins/types'; -import type { Config } from '../types/config'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import type { DefinePlugin } from '~/plugins/types'; +import type { Config } from '~/types/config'; + import { ensureDirSync, relativeModulePath } from './utils'; const __filename = fileURLToPath(import.meta.url); diff --git a/packages/openapi-ts/src/generate/core.ts b/packages/openapi-ts/src/generate/core.ts index d72110874..ba4581bbc 100644 --- a/packages/openapi-ts/src/generate/core.ts +++ b/packages/openapi-ts/src/generate/core.ts @@ -1,11 +1,11 @@ import fs from 'node:fs'; import path from 'node:path'; -import { getClientPlugin } from '../plugins/@hey-api/client-core/utils'; -import type { Client } from '../types/client'; -import { getConfig, legacyNameFromConfig } from '../utils/config'; -import { getHttpRequestName } from '../utils/getHttpRequestName'; -import type { Templates } from '../utils/handlebars'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import type { Client } from '~/types/client'; +import { getConfig, legacyNameFromConfig } from '~/utils/config'; +import { getHttpRequestName } from '~/utils/getHttpRequestName'; +import type { Templates } from '~/utils/handlebars'; /** * Generate OpenAPI core files, this includes the basic boilerplate code to handle requests. diff --git a/packages/openapi-ts/src/generate/file.ts b/packages/openapi-ts/src/generate/file.ts index a928ba54c..684ad95ca 100644 --- a/packages/openapi-ts/src/generate/file.ts +++ b/packages/openapi-ts/src/generate/file.ts @@ -3,8 +3,9 @@ import path from 'node:path'; import ts from 'typescript'; -import { tsc } from '../tsc'; -import { type ImportExportItemObject, tsNodeToString } from '../tsc/utils'; +import { tsc } from '~/tsc'; +import { type ImportExportItemObject, tsNodeToString } from '~/tsc/utils'; + import { ensureDirSync } from './utils'; type FileImportResult< diff --git a/packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts b/packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts index 03c272773..ad794d20e 100644 --- a/packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts +++ b/packages/openapi-ts/src/generate/legacy/__tests__/index.test.ts @@ -4,7 +4,8 @@ import path from 'node:path'; import type ts from 'typescript'; import { describe, expect, it, vi } from 'vitest'; -import { setConfig } from '../../../utils/config'; +import { setConfig } from '~/utils/config'; + import { GeneratedFile } from '../../file'; import { generateIndexFile } from '../indexFile'; diff --git a/packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts b/packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts index 6148cb2eb..c0897c382 100644 --- a/packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts +++ b/packages/openapi-ts/src/generate/legacy/__tests__/output.test.ts @@ -3,9 +3,10 @@ import fs from 'node:fs'; import type ts from 'typescript'; import { describe, expect, it, vi } from 'vitest'; -import type { Client } from '../../../types/client'; -import type { Config } from '../../../types/config'; -import { setConfig } from '../../../utils/config'; +import type { Client } from '~/types/client'; +import type { Config } from '~/types/config'; +import { setConfig } from '~/utils/config'; + import { mockTemplates, openApi } from '../../__tests__/mocks'; import { generateLegacyOutput } from '../output'; diff --git a/packages/openapi-ts/src/generate/legacy/indexFile.ts b/packages/openapi-ts/src/generate/legacy/indexFile.ts index 1afeb9b00..f7b68184c 100644 --- a/packages/openapi-ts/src/generate/legacy/indexFile.ts +++ b/packages/openapi-ts/src/generate/legacy/indexFile.ts @@ -1,7 +1,8 @@ -import { getClientPlugin } from '../../plugins/@hey-api/client-core/utils'; -import { tsc } from '../../tsc'; -import type { Files } from '../../types/utils'; -import { getConfig, legacyNameFromConfig } from '../../utils/config'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { tsc } from '~/tsc'; +import type { Files } from '~/types/utils'; +import { getConfig, legacyNameFromConfig } from '~/utils/config'; + import { GeneratedFile } from '../file'; export const generateIndexFile = ({ files }: { files: Files }): void => { diff --git a/packages/openapi-ts/src/generate/legacy/output.ts b/packages/openapi-ts/src/generate/legacy/output.ts index fb1a5105a..888abd1fa 100644 --- a/packages/openapi-ts/src/generate/legacy/output.ts +++ b/packages/openapi-ts/src/generate/legacy/output.ts @@ -2,12 +2,13 @@ import path from 'node:path'; import type { ProjectRenderMeta } from '@hey-api/codegen-core'; -import type { OpenApi } from '../../openApi'; -import { getClientPlugin } from '../../plugins/@hey-api/client-core/utils'; -import type { Client } from '../../types/client'; -import type { Files } from '../../types/utils'; -import { getConfig, isLegacyClient } from '../../utils/config'; -import type { Templates } from '../../utils/handlebars'; +import type { OpenApi } from '~/openApi'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import type { Client } from '~/types/client'; +import type { Files } from '~/types/utils'; +import { getConfig, isLegacyClient } from '~/utils/config'; +import type { Templates } from '~/utils/handlebars'; + import { generateLegacyClientClass } from '../class'; import { generateClientBundle } from '../client'; import { generateLegacyCore } from '../core'; diff --git a/packages/openapi-ts/src/generate/output.ts b/packages/openapi-ts/src/generate/output.ts index b479f6da6..6022833eb 100644 --- a/packages/openapi-ts/src/generate/output.ts +++ b/packages/openapi-ts/src/generate/output.ts @@ -3,8 +3,9 @@ import path from 'node:path'; import type { ProjectRenderMeta } from '@hey-api/codegen-core'; -import type { IR } from '../ir/types'; -import { getClientPlugin } from '../plugins/@hey-api/client-core/utils'; +import type { IR } from '~/ir/types'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; + import { generateClientBundle } from './client'; import { removeDirSync } from './utils'; diff --git a/packages/openapi-ts/src/generate/renderer.ts b/packages/openapi-ts/src/generate/renderer.ts index 9a25299f2..fd0bfdb46 100644 --- a/packages/openapi-ts/src/generate/renderer.ts +++ b/packages/openapi-ts/src/generate/renderer.ts @@ -12,9 +12,9 @@ import type { import { createBinding, mergeBindings, renderIds } from '@hey-api/codegen-core'; import ts from 'typescript'; -import { ensureValidIdentifier } from '../openApi/shared/utils/identifier'; -import { tsc } from '../tsc'; -import { tsNodeToString } from '../tsc/utils'; +import { ensureValidIdentifier } from '~/openApi/shared/utils/identifier'; +import { tsc } from '~/tsc'; +import { tsNodeToString } from '~/tsc/utils'; const nodeBuiltins = new Set([ 'buffer', diff --git a/packages/openapi-ts/src/generate/tsConfig.ts b/packages/openapi-ts/src/generate/tsConfig.ts index f2040ce68..89b128294 100644 --- a/packages/openapi-ts/src/generate/tsConfig.ts +++ b/packages/openapi-ts/src/generate/tsConfig.ts @@ -4,7 +4,7 @@ import { fileURLToPath } from 'node:url'; import ts from 'typescript'; -import type { UserOutput } from '../types/output'; +import type { UserOutput } from '~/types/output'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); diff --git a/packages/openapi-ts/src/getSpec.ts b/packages/openapi-ts/src/getSpec.ts index 1d5d0f0cf..0841e78bf 100644 --- a/packages/openapi-ts/src/getSpec.ts +++ b/packages/openapi-ts/src/getSpec.ts @@ -1,8 +1,8 @@ import { getResolvedInput, sendRequest } from '@hey-api/json-schema-ref-parser'; -import { mergeHeaders } from './plugins/@hey-api/client-fetch/bundle'; -import type { Input } from './types/input'; -import type { WatchValues } from './types/types'; +import { mergeHeaders } from '~/plugins/@hey-api/client-fetch/bundle'; +import type { Input } from '~/types/input'; +import type { WatchValues } from '~/types/types'; type SpecResponse = { arrayBuffer: ArrayBuffer | undefined; diff --git a/packages/openapi-ts/src/index.ts b/packages/openapi-ts/src/index.ts index 5335bfb04..21aec06ff 100644 --- a/packages/openapi-ts/src/index.ts +++ b/packages/openapi-ts/src/index.ts @@ -5,11 +5,11 @@ import colors from 'ansi-colors'; // @ts-expect-error import colorSupport from 'color-support'; -import { checkNodeVersion } from './config/engine'; -import type { Configs } from './config/init'; -import { initConfigs } from './config/init'; -import { getLogs } from './config/logs'; -import { createClient as pCreateClient } from './createClient'; +import { checkNodeVersion } from '~/config/engine'; +import type { Configs } from '~/config/init'; +import { initConfigs } from '~/config/init'; +import { getLogs } from '~/config/logs'; +import { createClient as pCreateClient } from '~/createClient'; import { ConfigValidationError, JobError, @@ -17,14 +17,14 @@ import { openGitHubIssueWithCrashReport, printCrashReport, shouldReportCrash, -} from './error'; -import type { IR } from './ir/types'; -import type { Client } from './types/client'; -import type { UserConfig } from './types/config'; -import type { LazyOrAsync, MaybeArray } from './types/utils'; -import { printCliIntro } from './utils/cli'; -import { registerHandlebarTemplates } from './utils/handlebars'; -import { Logger } from './utils/logger'; +} from '~/error'; +import type { IR } from '~/ir/types'; +import type { Client } from '~/types/client'; +import type { UserConfig } from '~/types/config'; +import type { LazyOrAsync, MaybeArray } from '~/types/utils'; +import { printCliIntro } from '~/utils/cli'; +import { registerHandlebarTemplates } from '~/utils/handlebars'; +import { Logger } from '~/utils/logger'; colors.enabled = colorSupport().hasBasic; diff --git a/packages/openapi-ts/src/ir/__tests__/graph.test.ts b/packages/openapi-ts/src/ir/__tests__/graph.test.ts index 417dbf423..10335ba61 100644 --- a/packages/openapi-ts/src/ir/__tests__/graph.test.ts +++ b/packages/openapi-ts/src/ir/__tests__/graph.test.ts @@ -1,7 +1,8 @@ import { describe, expect, it } from 'vitest'; -import type { Graph } from '../../openApi/shared/utils/graph'; -import { buildGraph } from '../../openApi/shared/utils/graph'; +import type { Graph } from '~/openApi/shared/utils/graph'; +import { buildGraph } from '~/openApi/shared/utils/graph'; + import type { IrTopLevelKind } from '../graph'; import { matchIrTopLevelPointer, walkTopological } from '../graph'; diff --git a/packages/openapi-ts/src/ir/__tests__/pagination.test.ts b/packages/openapi-ts/src/ir/__tests__/pagination.test.ts index 904666d55..c2b61d951 100644 --- a/packages/openapi-ts/src/ir/__tests__/pagination.test.ts +++ b/packages/openapi-ts/src/ir/__tests__/pagination.test.ts @@ -1,7 +1,8 @@ import { describe, expect, it, vi } from 'vitest'; -import { defaultPaginationKeywords } from '../../config/parser'; -import type { Config } from '../../types/config'; +import { defaultPaginationKeywords } from '~/config/parser'; +import type { Config } from '~/types/config'; + import { operationPagination } from '../operation'; import { getPaginationKeywordsRegExp } from '../pagination'; import type { IR } from '../types'; diff --git a/packages/openapi-ts/src/ir/context.ts b/packages/openapi-ts/src/ir/context.ts index b7abc6c92..93caf1cf9 100644 --- a/packages/openapi-ts/src/ir/context.ts +++ b/packages/openapi-ts/src/ir/context.ts @@ -1,16 +1,17 @@ import { Project } from '@hey-api/codegen-core'; -import type { Package } from '../config/utils/package'; -import { packageFactory } from '../config/utils/package'; -import { TypeScriptRenderer } from '../generate/renderer'; -import type { Graph } from '../openApi/shared/utils/graph'; -import { buildName } from '../openApi/shared/utils/name'; -import type { PluginConfigMap } from '../plugins/config'; -import { PluginInstance } from '../plugins/shared/utils/instance'; -import type { PluginNames } from '../plugins/types'; -import type { Config } from '../types/config'; -import type { Logger } from '../utils/logger'; -import { resolveRef } from '../utils/ref'; +import type { Package } from '~/config/utils/package'; +import { packageFactory } from '~/config/utils/package'; +import { TypeScriptRenderer } from '~/generate/renderer'; +import type { Graph } from '~/openApi/shared/utils/graph'; +import { buildName } from '~/openApi/shared/utils/name'; +import type { PluginConfigMap } from '~/plugins/config'; +import { PluginInstance } from '~/plugins/shared/utils/instance'; +import type { PluginNames } from '~/plugins/types'; +import type { Config } from '~/types/config'; +import type { Logger } from '~/utils/logger'; +import { resolveRef } from '~/utils/ref'; + import type { IR } from './types'; export class IRContext = any> { diff --git a/packages/openapi-ts/src/ir/graph.ts b/packages/openapi-ts/src/ir/graph.ts index ee62ac28f..d92bc9527 100644 --- a/packages/openapi-ts/src/ir/graph.ts +++ b/packages/openapi-ts/src/ir/graph.ts @@ -1,5 +1,5 @@ -import type { Graph, NodeInfo } from '../openApi/shared/utils/graph'; -import { MinHeap } from '../utils/minHeap'; +import type { Graph, NodeInfo } from '~/openApi/shared/utils/graph'; +import { MinHeap } from '~/utils/minHeap'; type KindPriority = Record; type PreferGroups = ReadonlyArray; diff --git a/packages/openapi-ts/src/ir/pagination.ts b/packages/openapi-ts/src/ir/pagination.ts index cb1a7a466..b7f29126c 100644 --- a/packages/openapi-ts/src/ir/pagination.ts +++ b/packages/openapi-ts/src/ir/pagination.ts @@ -1,4 +1,5 @@ -import type { Config } from '../types/config'; +import type { Config } from '~/types/config'; + import type { IR } from './types'; export function getPaginationKeywordsRegExp( diff --git a/packages/openapi-ts/src/ir/types.d.ts b/packages/openapi-ts/src/ir/types.d.ts index 118647198..5f9ec4522 100644 --- a/packages/openapi-ts/src/ir/types.d.ts +++ b/packages/openapi-ts/src/ir/types.d.ts @@ -1,10 +1,11 @@ import type { Symbol } from '@hey-api/codegen-core'; -import type { JsonSchemaDraft2020_12 } from '../openApi/3.1.x/types/json-schema-draft-2020-12'; +import type { JsonSchemaDraft2020_12 } from '~/openApi/3.1.x/types/json-schema-draft-2020-12'; import type { SecuritySchemeObject, ServerObject, -} from '../openApi/3.1.x/types/spec'; +} from '~/openApi/3.1.x/types/spec'; + import type { IRContext } from './context'; import type { IRMediaType } from './mediaType'; diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/server.test.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/server.test.ts index e1a64a0cc..993f21b18 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/server.test.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/server.test.ts @@ -1,7 +1,8 @@ import { describe, expect, it } from 'vitest'; +import type { OpenApi } from '~/openApi/types'; + import type { IR } from '../../../../ir/types'; -import type { OpenApi } from '../../../types'; import { parseServers } from '../server'; describe('parseServers', () => { diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/validate.test.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/validate.test.ts index f4c7bf23a..676c2ddbc 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/validate.test.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/__tests__/validate.test.ts @@ -2,9 +2,10 @@ import path from 'node:path'; import { describe, expect, it } from 'vitest'; +import { getSpecsPath, specFileToJson } from '~/openApi/__tests__/utils'; +import type { ValidatorResult } from '~/openApi/shared/utils/validator'; + import { Logger } from '../../../../utils/logger'; -import { getSpecsPath, specFileToJson } from '../../../__tests__/utils'; -import type { ValidatorResult } from '../../../shared/utils/validator'; import { validateOpenApiSpec } from '../validate'; const specsFolder = path.join(getSpecsPath(), '2.0.x', 'invalid'); diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/filter.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/filter.ts index fe934c174..0894abfc2 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/filter.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/filter.ts @@ -1,7 +1,8 @@ -import { createOperationKey } from '../../../ir/operation'; -import type { Logger } from '../../../utils/logger'; -import { addNamespace, removeNamespace } from '../../shared/utils/filter'; -import { httpMethods } from '../../shared/utils/operation'; +import { createOperationKey } from '~/ir/operation'; +import { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter'; +import { httpMethods } from '~/openApi/shared/utils/operation'; +import type { Logger } from '~/utils/logger'; + import type { OpenApiV2_0_X, OperationObject, diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/index.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/index.ts index 3cf6fdd9c..6b2be37b3 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/index.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/index.ts @@ -1,15 +1,16 @@ -import type { IR } from '../../../ir/types'; -import { buildResourceMetadata } from '../../shared/graph/meta'; -import { transformOpenApiSpec } from '../../shared/transforms'; -import type { State } from '../../shared/types/state'; +import type { IR } from '~/ir/types'; +import { buildResourceMetadata } from '~/openApi/shared/graph/meta'; +import { transformOpenApiSpec } from '~/openApi/shared/transforms'; +import type { State } from '~/openApi/shared/types/state'; import { createFilteredDependencies, createFilters, hasFilters, -} from '../../shared/utils/filter'; -import { buildGraph } from '../../shared/utils/graph'; -import { mergeParametersObjects } from '../../shared/utils/parameter'; -import { handleValidatorResult } from '../../shared/utils/validator'; +} from '~/openApi/shared/utils/filter'; +import { buildGraph } from '~/openApi/shared/utils/graph'; +import { mergeParametersObjects } from '~/openApi/shared/utils/parameter'; +import { handleValidatorResult } from '~/openApi/shared/utils/validator'; + import type { OpenApiV2_0_X, OperationObject, diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/mediaType.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/mediaType.ts index 913f0967b..1c4f3e1b7 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/mediaType.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/mediaType.ts @@ -1,8 +1,6 @@ -import type { IRMediaType } from '../../../ir/mediaType'; -import { - isMediaTypeFileLike, - mediaTypeToIrMediaType, -} from '../../../ir/mediaType'; +import type { IRMediaType } from '~/ir/mediaType'; +import { isMediaTypeFileLike, mediaTypeToIrMediaType } from '~/ir/mediaType'; + import type { ReferenceObject, ResponseObject, diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/operation.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/operation.ts index 83a21f3fa..99c80c34b 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/operation.ts @@ -1,6 +1,7 @@ -import type { IR, IRBodyObject } from '../../../ir/types'; -import type { State } from '../../shared/types/state'; -import { operationToId } from '../../shared/utils/operation'; +import type { IR, IRBodyObject } from '~/ir/types'; +import type { State } from '~/openApi/shared/types/state'; +import { operationToId } from '~/openApi/shared/utils/operation'; + import type { OperationObject, ParameterObject, diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/pagination.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/pagination.ts index bc211b973..f92b727cd 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/pagination.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/pagination.ts @@ -1,6 +1,7 @@ -import { getPaginationKeywordsRegExp } from '../../../ir/pagination'; -import type { IR } from '../../../ir/types'; -import type { SchemaType } from '../../shared/types/schema'; +import { getPaginationKeywordsRegExp } from '~/ir/pagination'; +import type { IR } from '~/ir/types'; +import type { SchemaType } from '~/openApi/shared/types/schema'; + import type { ParameterObject, ReferenceObject } from '../types/spec'; import type { SchemaObject } from '../types/spec'; import { getSchemaType } from './schema'; diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/parameter.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/parameter.ts index 3e51a6304..531f0c0d9 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/parameter.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/parameter.ts @@ -1,4 +1,5 @@ -import type { IR } from '../../../ir/types'; +import type { IR } from '~/ir/types'; + import type { OperationObject, ParameterObject, diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/schema.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/schema.ts index 0208de48b..c48f84164 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/schema.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/schema.ts @@ -1,12 +1,13 @@ -import type { IR } from '../../../ir/types'; -import { addItemsToSchema } from '../../../ir/utils'; -import { refToName } from '../../../utils/ref'; +import type { IR } from '~/ir/types'; +import { addItemsToSchema } from '~/ir/utils'; import type { SchemaState, SchemaType, SchemaWithRequired, -} from '../../shared/types/schema'; -import { discriminatorValues } from '../../shared/utils/discriminator'; +} from '~/openApi/shared/types/schema'; +import { discriminatorValues } from '~/openApi/shared/utils/discriminator'; +import { refToName } from '~/utils/ref'; + import type { SchemaObject } from '../types/spec'; export const getSchemaType = ({ diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/server.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/server.ts index b33f50d30..ee8241316 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/server.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/server.ts @@ -1,5 +1,5 @@ -import type { IR } from '../../../ir/types'; -import { parseUrl } from '../../../utils/url'; +import type { IR } from '~/ir/types'; +import { parseUrl } from '~/utils/url'; export const parseServers = ({ context }: { context: IR.Context }) => { let schemes: ReadonlyArray = context.spec.schemes ?? []; diff --git a/packages/openapi-ts/src/openApi/2.0.x/parser/validate.ts b/packages/openapi-ts/src/openApi/2.0.x/parser/validate.ts index 11944c4ba..a340487ce 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/parser/validate.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/parser/validate.ts @@ -1,10 +1,11 @@ -import { createOperationKey } from '../../../ir/operation'; -import type { Logger } from '../../../utils/logger'; -import { httpMethods } from '../../shared/utils/operation'; +import { createOperationKey } from '~/ir/operation'; +import { httpMethods } from '~/openApi/shared/utils/operation'; import type { ValidatorIssue, ValidatorResult, -} from '../../shared/utils/validator'; +} from '~/openApi/shared/utils/validator'; +import type { Logger } from '~/utils/logger'; + import type { OpenApiV2_0_X, PathItemObject, PathsObject } from '../types/spec'; export const validateOpenApiSpec = ( diff --git a/packages/openapi-ts/src/openApi/2.0.x/types/json-schema-draft-4.d.ts b/packages/openapi-ts/src/openApi/2.0.x/types/json-schema-draft-4.d.ts index 6b0ebb7e0..7f273a5b7 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/types/json-schema-draft-4.d.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/types/json-schema-draft-4.d.ts @@ -1,4 +1,4 @@ -import type { EnumExtensions } from '../../shared/types/openapi-spec-extensions'; +import type { EnumExtensions } from '~/openApi/shared/types/openapi-spec-extensions'; export interface JsonSchemaDraft4 extends EnumExtensions { /** diff --git a/packages/openapi-ts/src/openApi/2.0.x/types/spec.d.ts b/packages/openapi-ts/src/openApi/2.0.x/types/spec.d.ts index 0f41dd545..9f2d530e0 100644 --- a/packages/openapi-ts/src/openApi/2.0.x/types/spec.d.ts +++ b/packages/openapi-ts/src/openApi/2.0.x/types/spec.d.ts @@ -1,4 +1,5 @@ -import type { EnumExtensions } from '../../shared/types/openapi-spec-extensions'; +import type { EnumExtensions } from '~/openApi/shared/types/openapi-spec-extensions'; + import type { JsonSchemaDraft4 } from './json-schema-draft-4'; import type { OpenApiV2_0_X_Nullable_Extensions } from './openapi-spec-extensions'; diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/__tests__/validate.test.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/__tests__/validate.test.ts index 6d06468fc..9af472378 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/__tests__/validate.test.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/__tests__/validate.test.ts @@ -2,9 +2,10 @@ import path from 'node:path'; import { describe, expect, it } from 'vitest'; +import { getSpecsPath, specFileToJson } from '~/openApi/__tests__/utils'; +import type { ValidatorResult } from '~/openApi/shared/utils/validator'; + import { Logger } from '../../../../utils/logger'; -import { getSpecsPath, specFileToJson } from '../../../__tests__/utils'; -import type { ValidatorResult } from '../../../shared/utils/validator'; import { validateOpenApiSpec } from '../validate'; const specsFolder = path.join(getSpecsPath(), '3.0.x', 'invalid'); diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/filter.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/filter.ts index da5570e18..0bec360ac 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/filter.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/filter.ts @@ -1,7 +1,8 @@ -import { createOperationKey } from '../../../ir/operation'; -import type { Logger } from '../../../utils/logger'; -import { addNamespace, removeNamespace } from '../../shared/utils/filter'; -import { httpMethods } from '../../shared/utils/operation'; +import { createOperationKey } from '~/ir/operation'; +import { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter'; +import { httpMethods } from '~/openApi/shared/utils/operation'; +import type { Logger } from '~/utils/logger'; + import type { OpenApiV3_0_X, PathItemObject, PathsObject } from '../types/spec'; /** diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/index.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/index.ts index 60c81716c..f21729226 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/index.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/index.ts @@ -1,15 +1,16 @@ -import type { IR } from '../../../ir/types'; -import { buildResourceMetadata } from '../../shared/graph/meta'; -import { transformOpenApiSpec } from '../../shared/transforms'; -import type { State } from '../../shared/types/state'; +import type { IR } from '~/ir/types'; +import { buildResourceMetadata } from '~/openApi/shared/graph/meta'; +import { transformOpenApiSpec } from '~/openApi/shared/transforms'; +import type { State } from '~/openApi/shared/types/state'; import { createFilteredDependencies, createFilters, hasFilters, -} from '../../shared/utils/filter'; -import { buildGraph } from '../../shared/utils/graph'; -import { mergeParametersObjects } from '../../shared/utils/parameter'; -import { handleValidatorResult } from '../../shared/utils/validator'; +} from '~/openApi/shared/utils/filter'; +import { buildGraph } from '~/openApi/shared/utils/graph'; +import { mergeParametersObjects } from '~/openApi/shared/utils/parameter'; +import { handleValidatorResult } from '~/openApi/shared/utils/validator'; + import type { OpenApiV3_0_X, ParameterObject, diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/mediaType.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/mediaType.ts index 5ed7093ce..784a7ab4d 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/mediaType.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/mediaType.ts @@ -1,8 +1,6 @@ -import type { IRMediaType } from '../../../ir/mediaType'; -import { - isMediaTypeFileLike, - mediaTypeToIrMediaType, -} from '../../../ir/mediaType'; +import type { IRMediaType } from '~/ir/mediaType'; +import { isMediaTypeFileLike, mediaTypeToIrMediaType } from '~/ir/mediaType'; + import type { MediaTypeObject, ReferenceObject, diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/operation.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/operation.ts index c0967839b..6d187a97d 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/operation.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import type { State } from '../../shared/types/state'; -import { operationToId } from '../../shared/utils/operation'; +import type { IR } from '~/ir/types'; +import type { State } from '~/openApi/shared/types/state'; +import { operationToId } from '~/openApi/shared/utils/operation'; + import type { OperationObject, PathItemObject, diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/pagination.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/pagination.ts index 325d626e6..589ac9153 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/pagination.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/pagination.ts @@ -1,6 +1,7 @@ -import { getPaginationKeywordsRegExp } from '../../../ir/pagination'; -import type { IR } from '../../../ir/types'; -import type { SchemaType } from '../../shared/types/schema'; +import { getPaginationKeywordsRegExp } from '~/ir/pagination'; +import type { IR } from '~/ir/types'; +import type { SchemaType } from '~/openApi/shared/types/schema'; + import type { ParameterObject, ReferenceObject, diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/parameter.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/parameter.ts index 56307923e..78622865e 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/parameter.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/parameter.ts @@ -1,5 +1,6 @@ -import type { IR } from '../../../ir/types'; -import { refToName } from '../../../utils/ref'; +import type { IR } from '~/ir/types'; +import { refToName } from '~/utils/ref'; + import type { ParameterObject, ReferenceObject, diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/requestBody.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/requestBody.ts index 3f45e7e1a..593146fa9 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/requestBody.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/requestBody.ts @@ -1,5 +1,6 @@ -import type { IR } from '../../../ir/types'; -import { refToName } from '../../../utils/ref'; +import type { IR } from '~/ir/types'; +import { refToName } from '~/utils/ref'; + import type { RequestBodyObject, SchemaObject } from '../types/spec'; import { mediaTypeObjects } from './mediaType'; import { schemaToIrSchema } from './schema'; diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts index e5679f6a6..aba96eeac 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/schema.ts @@ -1,12 +1,13 @@ -import type { IR } from '../../../ir/types'; -import { addItemsToSchema } from '../../../ir/utils'; -import { refToName } from '../../../utils/ref'; +import type { IR } from '~/ir/types'; +import { addItemsToSchema } from '~/ir/utils'; import type { SchemaState, SchemaType, SchemaWithRequired, -} from '../../shared/types/schema'; -import { discriminatorValues } from '../../shared/utils/discriminator'; +} from '~/openApi/shared/types/schema'; +import { discriminatorValues } from '~/openApi/shared/utils/discriminator'; +import { refToName } from '~/utils/ref'; + import type { ReferenceObject, SchemaObject } from '../types/spec'; export const getSchemaType = ({ diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/server.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/server.ts index 8fb309f00..9732ada5f 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/server.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/server.ts @@ -1,5 +1,5 @@ -import type { IR } from '../../../ir/types'; -import { parseUrl } from '../../../utils/url'; +import type { IR } from '~/ir/types'; +import { parseUrl } from '~/utils/url'; export const parseServers = ({ context }: { context: IR.Context }) => { if (context.spec.servers) { diff --git a/packages/openapi-ts/src/openApi/3.0.x/parser/validate.ts b/packages/openapi-ts/src/openApi/3.0.x/parser/validate.ts index 46220981b..e44ae495c 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/parser/validate.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/parser/validate.ts @@ -1,10 +1,11 @@ -import { createOperationKey } from '../../../ir/operation'; -import type { Logger } from '../../../utils/logger'; -import { httpMethods } from '../../shared/utils/operation'; +import { createOperationKey } from '~/ir/operation'; +import { httpMethods } from '~/openApi/shared/utils/operation'; import type { ValidatorIssue, ValidatorResult, -} from '../../shared/utils/validator'; +} from '~/openApi/shared/utils/validator'; +import type { Logger } from '~/utils/logger'; + import type { OpenApiV3_0_X, PathItemObject, PathsObject } from '../types/spec'; export const validateOpenApiSpec = ( diff --git a/packages/openapi-ts/src/openApi/3.0.x/types/spec.d.ts b/packages/openapi-ts/src/openApi/3.0.x/types/spec.d.ts index 5c6c23682..65adaa4c5 100644 --- a/packages/openapi-ts/src/openApi/3.0.x/types/spec.d.ts +++ b/packages/openapi-ts/src/openApi/3.0.x/types/spec.d.ts @@ -1,4 +1,4 @@ -import type { EnumExtensions } from '../../shared/types/openapi-spec-extensions'; +import type { EnumExtensions } from '~/openApi/shared/types/openapi-spec-extensions'; /** * This is the root object of the {@link https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#openapi-description OpenAPI Description}. diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/__tests__/validate.test.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/__tests__/validate.test.ts index 2071c31e7..878e77990 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/__tests__/validate.test.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/__tests__/validate.test.ts @@ -2,9 +2,10 @@ import path from 'node:path'; import { describe, expect, it } from 'vitest'; +import { getSpecsPath, specFileToJson } from '~/openApi/__tests__/utils'; +import type { ValidatorResult } from '~/openApi/shared/utils/validator'; + import { Logger } from '../../../../utils/logger'; -import { getSpecsPath, specFileToJson } from '../../../__tests__/utils'; -import type { ValidatorResult } from '../../../shared/utils/validator'; import { validateOpenApiSpec } from '../validate'; const specsFolder = path.join(getSpecsPath(), '3.1.x', 'invalid'); diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/filter.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/filter.ts index 87b496390..577e00820 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/filter.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/filter.ts @@ -1,7 +1,8 @@ -import { createOperationKey } from '../../../ir/operation'; -import type { Logger } from '../../../utils/logger'; -import { addNamespace, removeNamespace } from '../../shared/utils/filter'; -import { httpMethods } from '../../shared/utils/operation'; +import { createOperationKey } from '~/ir/operation'; +import { addNamespace, removeNamespace } from '~/openApi/shared/utils/filter'; +import { httpMethods } from '~/openApi/shared/utils/operation'; +import type { Logger } from '~/utils/logger'; + import type { OpenApiV3_1_X, PathItemObject, PathsObject } from '../types/spec'; /** diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/index.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/index.ts index 05c181eae..e5886ed36 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/index.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/index.ts @@ -1,15 +1,16 @@ -import type { IR } from '../../../ir/types'; -import { buildResourceMetadata } from '../../shared/graph/meta'; -import { transformOpenApiSpec } from '../../shared/transforms'; -import type { State } from '../../shared/types/state'; +import type { IR } from '~/ir/types'; +import { buildResourceMetadata } from '~/openApi/shared/graph/meta'; +import { transformOpenApiSpec } from '~/openApi/shared/transforms'; +import type { State } from '~/openApi/shared/types/state'; import { createFilteredDependencies, createFilters, hasFilters, -} from '../../shared/utils/filter'; -import { buildGraph } from '../../shared/utils/graph'; -import { mergeParametersObjects } from '../../shared/utils/parameter'; -import { handleValidatorResult } from '../../shared/utils/validator'; +} from '~/openApi/shared/utils/filter'; +import { buildGraph } from '~/openApi/shared/utils/graph'; +import { mergeParametersObjects } from '~/openApi/shared/utils/parameter'; +import { handleValidatorResult } from '~/openApi/shared/utils/validator'; + import type { OpenApiV3_1_X, ParameterObject, diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/mediaType.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/mediaType.ts index 5b5bf1ae6..b0f956deb 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/mediaType.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/mediaType.ts @@ -1,8 +1,6 @@ -import type { IRMediaType } from '../../../ir/mediaType'; -import { - isMediaTypeFileLike, - mediaTypeToIrMediaType, -} from '../../../ir/mediaType'; +import type { IRMediaType } from '~/ir/mediaType'; +import { isMediaTypeFileLike, mediaTypeToIrMediaType } from '~/ir/mediaType'; + import type { MediaTypeObject, SchemaObject } from '../types/spec'; interface Content { diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/operation.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/operation.ts index 393ef07cf..31824cb37 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/operation.ts @@ -1,7 +1,8 @@ -import type { IR } from '../../../ir/types'; -import type { State } from '../../shared/types/state'; -import type { httpMethods } from '../../shared/utils/operation'; -import { operationToId } from '../../shared/utils/operation'; +import type { IR } from '~/ir/types'; +import type { State } from '~/openApi/shared/types/state'; +import type { httpMethods } from '~/openApi/shared/utils/operation'; +import { operationToId } from '~/openApi/shared/utils/operation'; + import type { OperationObject, RequestBodyObject, diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/pagination.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/pagination.ts index 500a949f0..00ac2aa95 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/pagination.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/pagination.ts @@ -1,6 +1,7 @@ -import { getPaginationKeywordsRegExp } from '../../../ir/pagination'; -import type { IR } from '../../../ir/types'; -import type { SchemaType } from '../../shared/types/schema'; +import { getPaginationKeywordsRegExp } from '~/ir/pagination'; +import type { IR } from '~/ir/types'; +import type { SchemaType } from '~/openApi/shared/types/schema'; + import type { ParameterObject, RequestBodyObject } from '../types/spec'; import type { SchemaObject } from '../types/spec'; import { mediaTypeObjects } from './mediaType'; diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/parameter.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/parameter.ts index be0c87510..607d4db45 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/parameter.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/parameter.ts @@ -1,5 +1,6 @@ -import type { IR } from '../../../ir/types'; -import { refToName } from '../../../utils/ref'; +import type { IR } from '~/ir/types'; +import { refToName } from '~/utils/ref'; + import type { ParameterObject, ReferenceObject, diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/requestBody.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/requestBody.ts index 3f45e7e1a..593146fa9 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/requestBody.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/requestBody.ts @@ -1,5 +1,6 @@ -import type { IR } from '../../../ir/types'; -import { refToName } from '../../../utils/ref'; +import type { IR } from '~/ir/types'; +import { refToName } from '~/utils/ref'; + import type { RequestBodyObject, SchemaObject } from '../types/spec'; import { mediaTypeObjects } from './mediaType'; import { schemaToIrSchema } from './schema'; diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts index 444fc5984..8dea32e73 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/schema.ts @@ -1,12 +1,13 @@ -import type { IR } from '../../../ir/types'; -import { addItemsToSchema } from '../../../ir/utils'; -import { refToName } from '../../../utils/ref'; +import type { IR } from '~/ir/types'; +import { addItemsToSchema } from '~/ir/utils'; import type { SchemaState, SchemaType, SchemaWithRequired, -} from '../../shared/types/schema'; -import { discriminatorValues } from '../../shared/utils/discriminator'; +} from '~/openApi/shared/types/schema'; +import { discriminatorValues } from '~/openApi/shared/utils/discriminator'; +import { refToName } from '~/utils/ref'; + import type { SchemaObject } from '../types/spec'; export const getSchemaTypes = ({ diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/server.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/server.ts index 8fb309f00..9732ada5f 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/server.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/server.ts @@ -1,5 +1,5 @@ -import type { IR } from '../../../ir/types'; -import { parseUrl } from '../../../utils/url'; +import type { IR } from '~/ir/types'; +import { parseUrl } from '~/utils/url'; export const parseServers = ({ context }: { context: IR.Context }) => { if (context.spec.servers) { diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/validate.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/validate.ts index 5d941e1ee..fcdb8e62e 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/validate.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/validate.ts @@ -1,10 +1,11 @@ -import { createOperationKey } from '../../../ir/operation'; -import type { Logger } from '../../../utils/logger'; -import { httpMethods } from '../../shared/utils/operation'; +import { createOperationKey } from '~/ir/operation'; +import { httpMethods } from '~/openApi/shared/utils/operation'; import type { ValidatorIssue, ValidatorResult, -} from '../../shared/utils/validator'; +} from '~/openApi/shared/utils/validator'; +import type { Logger } from '~/utils/logger'; + import type { OpenApiV3_1_X, PathItemObject, PathsObject } from '../types/spec'; export const validateOpenApiSpec = ( diff --git a/packages/openapi-ts/src/openApi/3.1.x/parser/webhook.ts b/packages/openapi-ts/src/openApi/3.1.x/parser/webhook.ts index 653cab559..cbeaf4ac5 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/parser/webhook.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/parser/webhook.ts @@ -1,5 +1,6 @@ -import type { IR } from '../../../ir/types'; -import { mergeParametersObjects } from '../../shared/utils/parameter'; +import type { IR } from '~/ir/types'; +import { mergeParametersObjects } from '~/openApi/shared/utils/parameter'; + import type { OpenApiV3_1_X, PathItemObject } from '../types/spec'; import { parseWebhookOperation } from './operation'; import { parametersArrayToObject } from './parameter'; diff --git a/packages/openapi-ts/src/openApi/3.1.x/types/json-schema-draft-2020-12.d.ts b/packages/openapi-ts/src/openApi/3.1.x/types/json-schema-draft-2020-12.d.ts index 68ce48afe..0acd88981 100644 --- a/packages/openapi-ts/src/openApi/3.1.x/types/json-schema-draft-2020-12.d.ts +++ b/packages/openapi-ts/src/openApi/3.1.x/types/json-schema-draft-2020-12.d.ts @@ -1,5 +1,6 @@ +import type { EnumExtensions } from '~/openApi/shared/types/openapi-spec-extensions'; + import type { MaybeArray } from '../../../types/utils'; -import type { EnumExtensions } from '../../shared/types/openapi-spec-extensions'; import type { OpenApiSchemaExtensions } from './spec-extensions'; // TODO: left out some keywords related to structuring a complex schema and declaring a dialect diff --git a/packages/openapi-ts/src/openApi/__tests__/index.test.ts b/packages/openapi-ts/src/openApi/__tests__/index.test.ts index cee23795c..8ed46431f 100644 --- a/packages/openapi-ts/src/openApi/__tests__/index.test.ts +++ b/packages/openapi-ts/src/openApi/__tests__/index.test.ts @@ -1,13 +1,14 @@ import { afterEach, describe, expect, it, vi } from 'vitest'; +import type { OpenApiV3_0_X } from '~/openApi/3.0.x'; +import { parseV3_0_X } from '~/openApi/3.0.x'; +import type { OpenApiV3_1_X } from '~/openApi/3.1.x'; +import { parseV3_1_X } from '~/openApi/3.1.x'; +import * as parseV2 from '~/openApi/v2'; +import * as parseV3 from '~/openApi/v3'; + import type { Config } from '../../types/config'; import { type OpenApi, parseLegacy, parseOpenApiSpec } from '..'; -import type { OpenApiV3_0_X } from '../3.0.x'; -import { parseV3_0_X } from '../3.0.x'; -import type { OpenApiV3_1_X } from '../3.1.x'; -import { parseV3_1_X } from '../3.1.x'; -import * as parseV2 from '../v2'; -import * as parseV3 from '../v3'; vi.mock('../3.0.x', () => ({ parseV3_0_X: vi.fn(), diff --git a/packages/openapi-ts/src/openApi/common/interfaces/OpenApi.ts b/packages/openapi-ts/src/openApi/common/interfaces/OpenApi.ts index 41a9fe08d..656e638d4 100644 --- a/packages/openapi-ts/src/openApi/common/interfaces/OpenApi.ts +++ b/packages/openapi-ts/src/openApi/common/interfaces/OpenApi.ts @@ -1,4 +1,4 @@ -import type { OpenApi as OpenApiV2 } from '../../v2/interfaces/OpenApi'; -import type { OpenApi as OpenApiV3 } from '../../v3/interfaces/OpenApi'; +import type { OpenApi as OpenApiV2 } from '~/openApi/v2/interfaces/OpenApi'; +import type { OpenApi as OpenApiV3 } from '~/openApi/v3/interfaces/OpenApi'; export type OpenApi = OpenApiV2 | OpenApiV3; diff --git a/packages/openapi-ts/src/openApi/common/interfaces/client.ts b/packages/openapi-ts/src/openApi/common/interfaces/client.ts index f22e2e5d9..b11f7a3c2 100644 --- a/packages/openapi-ts/src/openApi/common/interfaces/client.ts +++ b/packages/openapi-ts/src/openApi/common/interfaces/client.ts @@ -1,5 +1,6 @@ +import type { OpenApiParameter } from '~/openApi/v3/interfaces/OpenApiParameter'; + import type { Config } from '../../../types/config'; -import type { OpenApiParameter } from '../../v3/interfaces/OpenApiParameter'; export interface ModelComposition extends Pick { diff --git a/packages/openapi-ts/src/openApi/common/parser/getDefault.ts b/packages/openapi-ts/src/openApi/common/parser/getDefault.ts index a77126b5e..551f5f953 100644 --- a/packages/openapi-ts/src/openApi/common/parser/getDefault.ts +++ b/packages/openapi-ts/src/openApi/common/parser/getDefault.ts @@ -1,7 +1,8 @@ +import type { OpenApiParameter } from '~/openApi/v2/interfaces/OpenApiParameter'; +import type { OpenApiSchema } from '~/openApi/v3/interfaces/OpenApiSchema'; +import { getDefinitionTypes } from '~/openApi/v3/parser/inferType'; + import type { Model } from '../../common/interfaces/client'; -import type { OpenApiParameter } from '../../v2/interfaces/OpenApiParameter'; -import type { OpenApiSchema } from '../../v3/interfaces/OpenApiSchema'; -import { getDefinitionTypes } from '../../v3/parser/inferType'; import type { OperationParameter } from '../interfaces/client'; export const getDefault = ( diff --git a/packages/openapi-ts/src/openApi/common/parser/getEnums.ts b/packages/openapi-ts/src/openApi/common/parser/getEnums.ts index ac835a40d..81767d450 100644 --- a/packages/openapi-ts/src/openApi/common/parser/getEnums.ts +++ b/packages/openapi-ts/src/openApi/common/parser/getEnums.ts @@ -1,4 +1,5 @@ -import { unique } from '../../../utils/unique'; +import { unique } from '~/utils/unique'; + import type { Enum } from '../interfaces/client'; import type { WithEnumExtension } from '../interfaces/WithEnumExtension'; diff --git a/packages/openapi-ts/src/openApi/common/parser/getRef.ts b/packages/openapi-ts/src/openApi/common/parser/getRef.ts index e2b089b04..98cec868c 100644 --- a/packages/openapi-ts/src/openApi/common/parser/getRef.ts +++ b/packages/openapi-ts/src/openApi/common/parser/getRef.ts @@ -1,5 +1,6 @@ -import type { OpenApiReference as OpenApiReferenceV2 } from '../../v2/interfaces/OpenApiReference'; -import type { OpenApiReference as OpenApiReferenceV3 } from '../../v3/interfaces/OpenApiReference'; +import type { OpenApiReference as OpenApiReferenceV2 } from '~/openApi/v2/interfaces/OpenApiReference'; +import type { OpenApiReference as OpenApiReferenceV3 } from '~/openApi/v3/interfaces/OpenApiReference'; + import type { OpenApi } from '../interfaces/OpenApi'; const ESCAPED_REF_SLASH = /~1/g; diff --git a/packages/openapi-ts/src/openApi/common/parser/operation.ts b/packages/openapi-ts/src/openApi/common/parser/operation.ts index b7fe285d0..c4319a8c2 100644 --- a/packages/openapi-ts/src/openApi/common/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/common/parser/operation.ts @@ -1,7 +1,8 @@ +import { getConfig, isLegacyClient } from '~/utils/config'; +import { stringCase } from '~/utils/stringCase'; +import { transformTypeKeyName } from '~/utils/type'; + import type { Config } from '../../../types/config'; -import { getConfig, isLegacyClient } from '../../../utils/config'; -import { stringCase } from '../../../utils/stringCase'; -import { transformTypeKeyName } from '../../../utils/type'; import type { OperationParameter, OperationResponse, diff --git a/packages/openapi-ts/src/openApi/common/parser/sanitize.ts b/packages/openapi-ts/src/openApi/common/parser/sanitize.ts index d31e565d9..27fa71955 100644 --- a/packages/openapi-ts/src/openApi/common/parser/sanitize.ts +++ b/packages/openapi-ts/src/openApi/common/parser/sanitize.ts @@ -1,4 +1,4 @@ -import { illegalStartCharactersRegExp } from '../../../utils/regexp'; +import { illegalStartCharactersRegExp } from '~/utils/regexp'; export const ensureValidTypeScriptJavaScriptIdentifier = (name: string) => { const replaced = name.replace(/[^$\u200c\u200d\p{ID_Continue}]/gu, '_'); diff --git a/packages/openapi-ts/src/openApi/common/parser/type.ts b/packages/openapi-ts/src/openApi/common/parser/type.ts index 98e8709ca..bd8bde457 100644 --- a/packages/openapi-ts/src/openApi/common/parser/type.ts +++ b/packages/openapi-ts/src/openApi/common/parser/type.ts @@ -1,6 +1,7 @@ -import { refParametersPartial } from '../../../utils/const'; -import { transformTypeName } from '../../../utils/transform'; -import { isDefinitionTypeNullable } from '../../v3/parser/inferType'; +import { isDefinitionTypeNullable } from '~/openApi/v3/parser/inferType'; +import { refParametersPartial } from '~/utils/const'; +import { transformTypeName } from '~/utils/transform'; + import type { Type } from '../interfaces/Type'; import { ensureValidTypeScriptJavaScriptIdentifier } from './sanitize'; import { stripNamespace } from './stripNamespace'; diff --git a/packages/openapi-ts/src/openApi/index.ts b/packages/openapi-ts/src/openApi/index.ts index 06594f164..f27cb4de2 100644 --- a/packages/openapi-ts/src/openApi/index.ts +++ b/packages/openapi-ts/src/openApi/index.ts @@ -1,16 +1,16 @@ -import { satisfies } from '../config/utils/package'; -import { IRContext } from '../ir/context'; -import type { IR } from '../ir/types'; -import type { Config } from '../types/config'; -import type { Logger } from '../utils/logger'; -import { parseV2_0_X } from './2.0.x'; -import { parseV3_0_X } from './3.0.x'; -import { parseV3_1_X } from './3.1.x'; -import type { Client } from './common/interfaces/client'; -import type { OpenApi as LegacyOpenApi } from './common/interfaces/OpenApi'; -import type { OpenApi } from './types'; -import { parse as parseV2 } from './v2'; -import { parse as parseV3 } from './v3'; +import { satisfies } from '~/config/utils/package'; +import { IRContext } from '~/ir/context'; +import type { IR } from '~/ir/types'; +import { parseV2_0_X } from '~/openApi/2.0.x'; +import { parseV3_0_X } from '~/openApi/3.0.x'; +import { parseV3_1_X } from '~/openApi/3.1.x'; +import type { Client } from '~/openApi/common/interfaces/client'; +import type { OpenApi as LegacyOpenApi } from '~/openApi/common/interfaces/OpenApi'; +import type { OpenApi } from '~/openApi/types'; +import { parse as parseV2 } from '~/openApi/v2'; +import { parse as parseV3 } from '~/openApi/v3'; +import type { Config } from '~/types/config'; +import type { Logger } from '~/utils/logger'; export type { Client, diff --git a/packages/openapi-ts/src/openApi/shared/graph/meta.ts b/packages/openapi-ts/src/openApi/shared/graph/meta.ts index 326ab3b69..3d7103db6 100644 --- a/packages/openapi-ts/src/openApi/shared/graph/meta.ts +++ b/packages/openapi-ts/src/openApi/shared/graph/meta.ts @@ -1,6 +1,7 @@ -import { createOperationKey } from '../../../ir/operation'; -import type { Logger } from '../../../utils/logger'; -import { jsonPointerToPath } from '../../../utils/ref'; +import { createOperationKey } from '~/ir/operation'; +import type { Logger } from '~/utils/logger'; +import { jsonPointerToPath } from '~/utils/ref'; + import { addNamespace, stringToNamespace } from '../utils/filter'; import type { Graph } from '../utils/graph'; import { httpMethods } from '../utils/operation'; diff --git a/packages/openapi-ts/src/openApi/shared/transforms/enums.ts b/packages/openapi-ts/src/openApi/shared/transforms/enums.ts index 1552cef51..c8c4f0d86 100644 --- a/packages/openapi-ts/src/openApi/shared/transforms/enums.ts +++ b/packages/openapi-ts/src/openApi/shared/transforms/enums.ts @@ -1,5 +1,6 @@ +import { jsonPointerToPath } from '~/utils/ref'; + import type { Config } from '../../../types/config'; -import { jsonPointerToPath } from '../../../utils/ref'; import { buildName } from '../utils/name'; import { deepClone } from '../utils/schema'; import { childSchemaRelationships } from '../utils/schemaChildRelationships'; diff --git a/packages/openapi-ts/src/openApi/shared/transforms/index.ts b/packages/openapi-ts/src/openApi/shared/transforms/index.ts index 321863c0a..6f34465a8 100644 --- a/packages/openapi-ts/src/openApi/shared/transforms/index.ts +++ b/packages/openapi-ts/src/openApi/shared/transforms/index.ts @@ -1,4 +1,5 @@ -import type { IR } from '../../../ir/types'; +import type { IR } from '~/ir/types'; + import { enumsTransform } from './enums'; import { propertiesRequiredByDefaultTransform } from './propertiesRequiredByDefault'; import { readWriteTransform } from './readWrite'; diff --git a/packages/openapi-ts/src/openApi/shared/transforms/readWrite.ts b/packages/openapi-ts/src/openApi/shared/transforms/readWrite.ts index ce09fb10c..9a59ad39c 100644 --- a/packages/openapi-ts/src/openApi/shared/transforms/readWrite.ts +++ b/packages/openapi-ts/src/openApi/shared/transforms/readWrite.ts @@ -1,6 +1,7 @@ +import type { Logger } from '~/utils/logger'; +import { jsonPointerToPath } from '~/utils/ref'; + import type { Config } from '../../../types/config'; -import type { Logger } from '../../../utils/logger'; -import { jsonPointerToPath } from '../../../utils/ref'; import deepEqual from '../utils/deepEqual'; import { buildGraph, type Graph, type Scope } from '../utils/graph'; import { buildName } from '../utils/name'; diff --git a/packages/openapi-ts/src/openApi/shared/utils/__tests__/patch.test.ts b/packages/openapi-ts/src/openApi/shared/utils/__tests__/patch.test.ts index ec9aaa718..8fbefc62e 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/__tests__/patch.test.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/__tests__/patch.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it, vi } from 'vitest'; -import type { OpenApi } from '../../../../openApi/types'; +import type { OpenApi } from '~/openApi/types'; + import { patchOpenApiSpec } from '../patch'; const specMetadataV2: Pick = { diff --git a/packages/openapi-ts/src/openApi/shared/utils/discriminator.ts b/packages/openapi-ts/src/openApi/shared/utils/discriminator.ts index 836af5986..1e79009d3 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/discriminator.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/discriminator.ts @@ -1,4 +1,4 @@ -import { refToName } from '../../../utils/ref'; +import { refToName } from '~/utils/ref'; export const discriminatorValues = ( $ref: string, diff --git a/packages/openapi-ts/src/openApi/shared/utils/filter.ts b/packages/openapi-ts/src/openApi/shared/utils/filter.ts index 9ffa90630..8c8f66d51 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/filter.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/filter.ts @@ -1,8 +1,9 @@ -import { createOperationKey } from '../../../ir/operation'; +import { createOperationKey } from '~/ir/operation'; +import type { PathItemObject, PathsObject } from '~/openApi/3.1.x/types/spec'; +import type { OpenApi } from '~/openApi/types'; +import type { Logger } from '~/utils/logger'; + import type { Config } from '../../../types/config'; -import type { Logger } from '../../../utils/logger'; -import type { PathItemObject, PathsObject } from '../../3.1.x/types/spec'; -import type { OpenApi } from '../../types'; import type { ResourceMetadata } from '../graph/meta'; import { httpMethods } from './operation'; diff --git a/packages/openapi-ts/src/openApi/shared/utils/graph.ts b/packages/openapi-ts/src/openApi/shared/utils/graph.ts index 562d7b8eb..605cd58b0 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/graph.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/graph.ts @@ -1,5 +1,6 @@ -import type { Logger } from '../../../utils/logger'; -import { normalizeJsonPointer, pathToJsonPointer } from '../../../utils/ref'; +import type { Logger } from '~/utils/logger'; +import { normalizeJsonPointer, pathToJsonPointer } from '~/utils/ref'; + import { childSchemaRelationships } from './schemaChildRelationships'; /** diff --git a/packages/openapi-ts/src/openApi/shared/utils/identifier.ts b/packages/openapi-ts/src/openApi/shared/utils/identifier.ts index 8f8c7e2df..3b9ce2464 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/identifier.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/identifier.ts @@ -5,7 +5,7 @@ import { reservedJavaScriptKeywordsRegExp, reservedNodeGlobalsRegExp, reservedTypeScriptKeywordsRegExp, -} from '../../../utils/regexp'; +} from '~/utils/regexp'; const regexps = [ reservedJavaScriptKeywordsRegExp, diff --git a/packages/openapi-ts/src/openApi/shared/utils/name.ts b/packages/openapi-ts/src/openApi/shared/utils/name.ts index 8f4ab453d..fff76b867 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/name.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/name.ts @@ -1,5 +1,6 @@ +import { stringCase } from '~/utils/stringCase'; + import type { StringCase, StringName } from '../../../types/case'; -import { stringCase } from '../../../utils/stringCase'; export const buildName = ({ config, diff --git a/packages/openapi-ts/src/openApi/shared/utils/operation.ts b/packages/openapi-ts/src/openApi/shared/utils/operation.ts index cc7e1cc1b..119159459 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/operation.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/operation.ts @@ -1,7 +1,8 @@ -import { createOperationKey } from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { stringCase } from '../../../utils/stringCase'; -import { sanitizeNamespaceIdentifier } from '../../common/parser/sanitize'; +import { createOperationKey } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { sanitizeNamespaceIdentifier } from '~/openApi/common/parser/sanitize'; +import { stringCase } from '~/utils/stringCase'; + import type { State } from '../types/state'; export const httpMethods = [ diff --git a/packages/openapi-ts/src/openApi/shared/utils/parameter.ts b/packages/openapi-ts/src/openApi/shared/utils/parameter.ts index a7136ed15..ff507fe2d 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/parameter.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/parameter.ts @@ -1,4 +1,4 @@ -import type { IR } from '../../../ir/types'; +import type { IR } from '~/ir/types'; export const mergeParametersObjects = ({ source, diff --git a/packages/openapi-ts/src/openApi/shared/utils/patch.ts b/packages/openapi-ts/src/openApi/shared/utils/patch.ts index 4dd0e9566..9186ee709 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/patch.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/patch.ts @@ -1,5 +1,6 @@ +import type { OpenApi } from '~/openApi/types'; + import type { Patch } from '../../../types/parser'; -import type { OpenApi } from '../../types'; export const patchOpenApiSpec = ({ patchOptions, diff --git a/packages/openapi-ts/src/openApi/shared/utils/validator.ts b/packages/openapi-ts/src/openApi/shared/utils/validator.ts index c6be15024..db79c7740 100644 --- a/packages/openapi-ts/src/openApi/shared/utils/validator.ts +++ b/packages/openapi-ts/src/openApi/shared/utils/validator.ts @@ -1,6 +1,6 @@ import colors from 'ansi-colors'; -import type { IR } from '../../../ir/types'; +import type { IR } from '~/ir/types'; export interface ValidatorIssue { /** diff --git a/packages/openapi-ts/src/openApi/types.d.ts b/packages/openapi-ts/src/openApi/types.d.ts index 88697a24e..ff0b32f5e 100644 --- a/packages/openapi-ts/src/openApi/types.d.ts +++ b/packages/openapi-ts/src/openApi/types.d.ts @@ -1,6 +1,6 @@ -import type { OpenApiV2_0_X, OpenApiV2_0_XTypes } from './2.0.x'; -import type { OpenApiV3_0_X, OpenApiV3_0_XTypes } from './3.0.x'; -import type { OpenApiV3_1_X, OpenApiV3_1_XTypes } from './3.1.x'; +import type { OpenApiV2_0_X, OpenApiV2_0_XTypes } from '~/openApi/2.0.x'; +import type { OpenApiV3_0_X, OpenApiV3_0_XTypes } from '~/openApi/3.0.x'; +import type { OpenApiV3_1_X, OpenApiV3_1_XTypes } from '~/openApi/3.1.x'; export namespace OpenApi { export type V2_0_X = OpenApiV2_0_X; diff --git a/packages/openapi-ts/src/openApi/v2/index.ts b/packages/openapi-ts/src/openApi/v2/index.ts index 9d35fad1b..eca7c2948 100644 --- a/packages/openapi-ts/src/openApi/v2/index.ts +++ b/packages/openapi-ts/src/openApi/v2/index.ts @@ -1,5 +1,6 @@ -import type { Client } from '../common/interfaces/client'; -import { getServiceVersion } from '../common/parser/service'; +import type { Client } from '~/openApi/common/interfaces/client'; +import { getServiceVersion } from '~/openApi/common/parser/service'; + import type { OpenApi } from './interfaces/OpenApi'; import { getModels } from './parser/getModels'; import { getOperations } from './parser/getOperations'; diff --git a/packages/openapi-ts/src/openApi/v2/interfaces/Model.ts b/packages/openapi-ts/src/openApi/v2/interfaces/Model.ts index 821f21171..c442b81a6 100644 --- a/packages/openapi-ts/src/openApi/v2/interfaces/Model.ts +++ b/packages/openapi-ts/src/openApi/v2/interfaces/Model.ts @@ -1,5 +1,6 @@ +import type { Model, ModelMeta } from '~/openApi/common/interfaces/client'; + import type { Client } from '../../../types/client'; -import type { Model, ModelMeta } from '../../common/interfaces/client'; import type { OpenApi } from './OpenApi'; import type { OpenApiSchema } from './OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApi.ts b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApi.ts index 477938662..5d641a917 100644 --- a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApi.ts +++ b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApi.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiExternalDocs } from './OpenApiExternalDocs'; import type { OpenApiInfo } from './OpenApiInfo'; import type { OpenApiParameter } from './OpenApiParameter'; diff --git a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiHeader.ts b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiHeader.ts index a00de7928..cc595e0df 100644 --- a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiHeader.ts +++ b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiHeader.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiItems } from './OpenApiItems'; /** diff --git a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiItems.ts b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiItems.ts index f7d0cb633..6e0025752 100644 --- a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiItems.ts +++ b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiItems.ts @@ -1,4 +1,4 @@ -import type { WithEnumExtension } from '../../common/interfaces/WithEnumExtension'; +import type { WithEnumExtension } from '~/openApi/common/interfaces/WithEnumExtension'; /** * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#items-object) diff --git a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiParameter.ts b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiParameter.ts index 1210fd0e2..223151007 100644 --- a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiParameter.ts +++ b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiParameter.ts @@ -1,4 +1,5 @@ -import type { WithEnumExtension } from '../../common/interfaces/WithEnumExtension'; +import type { WithEnumExtension } from '~/openApi/common/interfaces/WithEnumExtension'; + import type { WithNullableExtension } from './Extensions/WithNullableExtension'; import type { OpenApiItems } from './OpenApiItems'; import type { OpenApiReference } from './OpenApiReference'; diff --git a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiResponse.ts b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiResponse.ts index 0883cff68..26c372d80 100644 --- a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiResponse.ts +++ b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiResponse.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiExample } from './OpenApiExample'; import type { OpenApiHeader } from './OpenApiHeader'; import type { OpenApiReference } from './OpenApiReference'; diff --git a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSchema.ts b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSchema.ts index 447d4f7fd..65ff39f37 100644 --- a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSchema.ts +++ b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSchema.ts @@ -1,5 +1,6 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; -import type { WithEnumExtension } from '../../common/interfaces/WithEnumExtension'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; +import type { WithEnumExtension } from '~/openApi/common/interfaces/WithEnumExtension'; + import type { WithNullableExtension } from './Extensions/WithNullableExtension'; import type { OpenApiExternalDocs } from './OpenApiExternalDocs'; import type { OpenApiReference } from './OpenApiReference'; diff --git a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSecurityScheme.ts b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSecurityScheme.ts index 341f5af56..2a096b0f6 100644 --- a/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSecurityScheme.ts +++ b/packages/openapi-ts/src/openApi/v2/interfaces/OpenApiSecurityScheme.ts @@ -1,4 +1,4 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; /** * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md#security-scheme-object diff --git a/packages/openapi-ts/src/openApi/v2/parser/getModel.ts b/packages/openapi-ts/src/openApi/v2/parser/getModel.ts index 58c4c32fd..449810818 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getModel.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getModel.ts @@ -1,8 +1,9 @@ +import type { Model, ModelMeta } from '~/openApi/common/interfaces/client'; +import { getEnums } from '~/openApi/common/parser/getEnums'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getType } from '~/openApi/common/parser/type'; + import type { Client } from '../../../types/client'; -import type { Model, ModelMeta } from '../../common/interfaces/client'; -import { getEnums } from '../../common/parser/getEnums'; -import { getPattern } from '../../common/parser/getPattern'; -import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; import { getModelComposition } from './getModelComposition'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getModelComposition.ts b/packages/openapi-ts/src/openApi/v2/parser/getModelComposition.ts index c130c8766..d131b1e79 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getModelComposition.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getModelComposition.ts @@ -1,5 +1,9 @@ +import type { + Model, + ModelComposition, +} from '~/openApi/common/interfaces/client'; + import type { Client } from '../../../types/client'; -import type { Model, ModelComposition } from '../../common/interfaces/client'; import type { GetModelFn } from '../interfaces/Model'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getModelProperties.ts b/packages/openapi-ts/src/openApi/v2/parser/getModelProperties.ts index 25f576710..d3a51c7f5 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getModelProperties.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getModelProperties.ts @@ -1,8 +1,9 @@ +import type { Model } from '~/openApi/common/interfaces/client'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getType } from '~/openApi/common/parser/type'; +import { escapeName } from '~/utils/escape'; + import type { Client } from '../../../types/client'; -import { escapeName } from '../../../utils/escape'; -import type { Model } from '../../common/interfaces/client'; -import { getPattern } from '../../common/parser/getPattern'; -import { getType } from '../../common/parser/type'; import type { GetModelFn } from '../interfaces/Model'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getModels.ts b/packages/openapi-ts/src/openApi/v2/parser/getModels.ts index 5caf1943c..7a87247aa 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getModels.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getModels.ts @@ -1,6 +1,7 @@ +import { getType } from '~/openApi/common/parser/type'; +import { reservedJavaScriptKeywordsRegExp } from '~/utils/regexp'; + import type { Client } from '../../../types/client'; -import { reservedJavaScriptKeywordsRegExp } from '../../../utils/regexp'; -import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import { getModel } from './getModel'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getOperationParameter.ts b/packages/openapi-ts/src/openApi/v2/parser/getOperationParameter.ts index 4a8427e5b..1016e3ea3 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getOperationParameter.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getOperationParameter.ts @@ -1,11 +1,12 @@ +import type { OperationParameter } from '~/openApi/common/interfaces/client'; +import { getDefault } from '~/openApi/common/parser/getDefault'; +import { getEnums } from '~/openApi/common/parser/getEnums'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getRef } from '~/openApi/common/parser/getRef'; +import { operationParameterNameFn } from '~/openApi/common/parser/operation'; +import { getType } from '~/openApi/common/parser/type'; + import type { Client } from '../../../types/client'; -import type { OperationParameter } from '../../common/interfaces/client'; -import { getDefault } from '../../common/parser/getDefault'; -import { getEnums } from '../../common/parser/getEnums'; -import { getPattern } from '../../common/parser/getPattern'; -import { getRef } from '../../common/parser/getRef'; -import { operationParameterNameFn } from '../../common/parser/operation'; -import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiParameter } from '../interfaces/OpenApiParameter'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getOperationParameters.ts b/packages/openapi-ts/src/openApi/v2/parser/getOperationParameters.ts index 8611008d2..392832370 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getOperationParameters.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getOperationParameters.ts @@ -1,7 +1,8 @@ +import type { OperationParameters } from '~/openApi/common/interfaces/client'; +import { getRef } from '~/openApi/common/parser/getRef'; +import { operationParameterFilterFn } from '~/openApi/common/parser/operation'; + import type { Client } from '../../../types/client'; -import type { OperationParameters } from '../../common/interfaces/client'; -import { getRef } from '../../common/parser/getRef'; -import { operationParameterFilterFn } from '../../common/parser/operation'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiParameter } from '../interfaces/OpenApiParameter'; import { getOperationParameter } from './getOperationParameter'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getOperationResponse.ts b/packages/openapi-ts/src/openApi/v2/parser/getOperationResponse.ts index bcc00d6a2..9068c93b3 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getOperationResponse.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getOperationResponse.ts @@ -1,8 +1,9 @@ +import type { OperationResponse } from '~/openApi/common/interfaces/client'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getRef } from '~/openApi/common/parser/getRef'; +import { getType } from '~/openApi/common/parser/type'; + import type { Client } from '../../../types/client'; -import type { OperationResponse } from '../../common/interfaces/client'; -import { getPattern } from '../../common/parser/getPattern'; -import { getRef } from '../../common/parser/getRef'; -import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiResponse } from '../interfaces/OpenApiResponse'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getOperationResponses.ts b/packages/openapi-ts/src/openApi/v2/parser/getOperationResponses.ts index 19dc6a7d1..3ebf13843 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getOperationResponses.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getOperationResponses.ts @@ -1,11 +1,12 @@ -import type { Client } from '../../../types/client'; -import type { OperationResponse } from '../../common/interfaces/client'; -import { getRef } from '../../common/parser/getRef'; +import type { OperationResponse } from '~/openApi/common/interfaces/client'; +import { getRef } from '~/openApi/common/parser/getRef'; import { parseResponseStatusCode, sorterByResponseStatusCode, tagResponseTypes, -} from '../../common/parser/operation'; +} from '~/openApi/common/parser/operation'; + +import type { Client } from '../../../types/client'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiResponse } from '../interfaces/OpenApiResponse'; import type { OpenApiResponses } from '../interfaces/OpenApiResponses'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts b/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts index 332bd3d1f..fe297f310 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getOperations.ts @@ -1,8 +1,9 @@ -import { createOperationKey } from '../../../ir/operation'; -import { getConfig } from '../../../utils/config'; -import type { Client, Operation } from '../../common/interfaces/client'; -import { operationFilterFn } from '../../common/parser/operation'; -import { allowedServiceMethods } from '../../common/parser/service'; +import { createOperationKey } from '~/ir/operation'; +import type { Client, Operation } from '~/openApi/common/interfaces/client'; +import { operationFilterFn } from '~/openApi/common/parser/operation'; +import { allowedServiceMethods } from '~/openApi/common/parser/service'; +import { getConfig } from '~/utils/config'; + import type { OpenApi } from '../interfaces/OpenApi'; import { getOperationParameters } from './getOperationParameters'; import { getOperation } from './operation'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/getRequiredPropertiesFromComposition.ts b/packages/openapi-ts/src/openApi/v2/parser/getRequiredPropertiesFromComposition.ts index bec99562c..b67368619 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/getRequiredPropertiesFromComposition.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/getRequiredPropertiesFromComposition.ts @@ -1,6 +1,7 @@ +import type { Model } from '~/openApi/common/interfaces/client'; +import { getRef } from '~/openApi/common/parser/getRef'; + import type { Client } from '../../../types/client'; -import type { Model } from '../../common/interfaces/client'; -import { getRef } from '../../common/parser/getRef'; import type { GetModelFn } from '../interfaces/Model'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v2/parser/operation.ts b/packages/openapi-ts/src/openApi/v2/parser/operation.ts index 6897b2cd5..9a34b1f27 100644 --- a/packages/openapi-ts/src/openApi/v2/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/v2/parser/operation.ts @@ -1,14 +1,15 @@ -import type { Client } from '../../../types/client'; -import { getConfig } from '../../../utils/config'; import type { Operation, OperationParameters, -} from '../../common/interfaces/client'; +} from '~/openApi/common/interfaces/client'; import { getOperationResponseHeader, operationNameFn, -} from '../../common/parser/operation'; -import { toSortedByRequired } from '../../common/parser/sort'; +} from '~/openApi/common/parser/operation'; +import { toSortedByRequired } from '~/openApi/common/parser/sort'; +import { getConfig } from '~/utils/config'; + +import type { Client } from '../../../types/client'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiOperation } from '../interfaces/OpenApiOperation'; import { getOperationParameters } from './getOperationParameters'; diff --git a/packages/openapi-ts/src/openApi/v3/index.ts b/packages/openapi-ts/src/openApi/v3/index.ts index 9d35fad1b..eca7c2948 100644 --- a/packages/openapi-ts/src/openApi/v3/index.ts +++ b/packages/openapi-ts/src/openApi/v3/index.ts @@ -1,5 +1,6 @@ -import type { Client } from '../common/interfaces/client'; -import { getServiceVersion } from '../common/parser/service'; +import type { Client } from '~/openApi/common/interfaces/client'; +import { getServiceVersion } from '~/openApi/common/parser/service'; + import type { OpenApi } from './interfaces/OpenApi'; import { getModels } from './parser/getModels'; import { getOperations } from './parser/getOperations'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/Model.ts b/packages/openapi-ts/src/openApi/v3/interfaces/Model.ts index 56e35812c..731d6f25c 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/Model.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/Model.ts @@ -1,5 +1,6 @@ +import type { Model, ModelMeta } from '~/openApi/common/interfaces/client'; + import type { Client } from '../../../types/client'; -import type { Model, ModelMeta } from '../../common/interfaces/client'; import type { OpenApi } from './OpenApi'; import type { OpenApiSchema } from './OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiComponents.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiComponents.ts index c6a1f9130..883acb493 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiComponents.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiComponents.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiCallback } from './OpenApiCallback'; import type { OpenApiExample } from './OpenApiExample'; import type { OpenApiHeader } from './OpenApiHeader'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiDiscriminator.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiDiscriminator.ts index 224d9d203..bb33b72b7 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiDiscriminator.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiDiscriminator.ts @@ -1,4 +1,4 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; /** * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#discriminator-object diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiEncoding.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiEncoding.ts index 20e8bfa4a..620eedbee 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiEncoding.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiEncoding.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiHeader } from './OpenApiHeader'; /** diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiHeader.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiHeader.ts index 64044450d..e32ba419d 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiHeader.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiHeader.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiExample } from './OpenApiExample'; import type { OpenApiReference } from './OpenApiReference'; import type { OpenApiSchema } from './OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiLink.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiLink.ts index 7173970d4..6b36c907e 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiLink.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiLink.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiReference } from './OpenApiReference'; import type { OpenApiServer } from './OpenApiServer'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiMediaType.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiMediaType.ts index 3c74d4c62..01d115809 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiMediaType.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiMediaType.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiEncoding } from './OpenApiEncoding'; import type { OpenApiExample } from './OpenApiExample'; import type { OpenApiReference } from './OpenApiReference'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOAuthFlow.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOAuthFlow.ts index be01efeab..5ef94cc65 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOAuthFlow.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOAuthFlow.ts @@ -1,4 +1,4 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; /** * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#oauth-flow-object diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOperation.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOperation.ts index b55c9a1d7..f4bcc9bd9 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOperation.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiOperation.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiCallback } from './OpenApiCallback'; import type { OpenApiExternalDocs } from './OpenApiExternalDocs'; import type { OpenApiParameter } from './OpenApiParameter'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiParameter.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiParameter.ts index 1520ec492..3bf7ec4ac 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiParameter.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiParameter.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiExample } from './OpenApiExample'; import type { OpenApiReference } from './OpenApiReference'; import type { OpenApiSchema } from './OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiRequestBody.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiRequestBody.ts index 0bbc6397a..a001a7a8a 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiRequestBody.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiRequestBody.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiMediaType } from './OpenApiMediaType'; import type { OpenApiReference } from './OpenApiReference'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiResponse.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiResponse.ts index d3914e72b..83fe0c65b 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiResponse.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiResponse.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiHeader } from './OpenApiHeader'; import type { OpenApiLink } from './OpenApiLink'; import type { OpenApiMediaType } from './OpenApiMediaType'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiSchema.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiSchema.ts index ef0b56f87..f8c66cc96 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiSchema.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiSchema.ts @@ -1,5 +1,6 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; -import type { WithEnumExtension } from '../../common/interfaces/WithEnumExtension'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; +import type { WithEnumExtension } from '~/openApi/common/interfaces/WithEnumExtension'; + import type { OpenApiDiscriminator } from './OpenApiDiscriminator'; import type { OpenApiExternalDocs } from './OpenApiExternalDocs'; import type { OpenApiReference } from './OpenApiReference'; diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServer.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServer.ts index 4c1a50c97..d09ccaf6c 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServer.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServer.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApiServerVariable } from './OpenApiServerVariable'; /** diff --git a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServerVariable.ts b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServerVariable.ts index 2673fc174..1477f8fe1 100644 --- a/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServerVariable.ts +++ b/packages/openapi-ts/src/openApi/v3/interfaces/OpenApiServerVariable.ts @@ -1,4 +1,4 @@ -import type { WithEnumExtension } from '../../common/interfaces/WithEnumExtension'; +import type { WithEnumExtension } from '~/openApi/common/interfaces/WithEnumExtension'; /** * {@link} https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#server-variable-object diff --git a/packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.test.ts b/packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.test.ts index 53461cd76..17a3021d7 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.test.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/__tests__/getModel.test.ts @@ -1,9 +1,10 @@ import type ts from 'typescript'; import { describe, expect, it, vi } from 'vitest'; +import { getType } from '~/openApi/common/parser/type'; + import type { Config } from '../../../../types/config'; import { reservedJavaScriptKeywordsRegExp } from '../../../../utils/regexp'; -import { getType } from '../../../common/parser/type'; import { getModel } from '../getModel'; vi.mock('../../../../utils/config', () => { diff --git a/packages/openapi-ts/src/openApi/v3/parser/discriminator.ts b/packages/openapi-ts/src/openApi/v3/parser/discriminator.ts index 4301e4aee..ea3834aec 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/discriminator.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/discriminator.ts @@ -1,6 +1,7 @@ -import type { Model } from '../../common/interfaces/client'; -import type { Dictionary } from '../../common/interfaces/Dictionary'; -import { stripNamespace } from '../../common/parser/stripNamespace'; +import type { Model } from '~/openApi/common/interfaces/client'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; +import { stripNamespace } from '~/openApi/common/parser/stripNamespace'; + import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiDiscriminator } from '../interfaces/OpenApiDiscriminator'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getContent.ts b/packages/openapi-ts/src/openApi/v3/parser/getContent.ts index 6aa21293c..26cbd7f59 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getContent.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getContent.ts @@ -1,4 +1,5 @@ -import type { Dictionary } from '../../common/interfaces/Dictionary'; +import type { Dictionary } from '~/openApi/common/interfaces/Dictionary'; + import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiMediaType } from '../interfaces/OpenApiMediaType'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getModel.ts b/packages/openapi-ts/src/openApi/v3/parser/getModel.ts index 5689222e5..e3dd272d9 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getModel.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getModel.ts @@ -1,10 +1,11 @@ +import type { Model, ModelMeta } from '~/openApi/common/interfaces/client'; +import { getDefault } from '~/openApi/common/parser/getDefault'; +import { getEnums } from '~/openApi/common/parser/getEnums'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getType } from '~/openApi/common/parser/type'; +import { enumMeta } from '~/utils/enum'; + import type { Client } from '../../../types/client'; -import { enumMeta } from '../../../utils/enum'; -import type { Model, ModelMeta } from '../../common/interfaces/client'; -import { getDefault } from '../../common/parser/getDefault'; -import { getEnums } from '../../common/parser/getEnums'; -import { getPattern } from '../../common/parser/getPattern'; -import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; import { diff --git a/packages/openapi-ts/src/openApi/v3/parser/getModelComposition.ts b/packages/openapi-ts/src/openApi/v3/parser/getModelComposition.ts index 583eca71e..ca63a28a9 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getModelComposition.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getModelComposition.ts @@ -1,5 +1,9 @@ +import type { + Model, + ModelComposition, +} from '~/openApi/common/interfaces/client'; + import type { Client } from '../../../types/client'; -import type { Model, ModelComposition } from '../../common/interfaces/client'; import type { GetModelFn } from '../interfaces/Model'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getModelProperties.ts b/packages/openapi-ts/src/openApi/v3/parser/getModelProperties.ts index 5d94c34bc..83f69aeb9 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getModelProperties.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getModelProperties.ts @@ -1,10 +1,11 @@ +import type { Model } from '~/openApi/common/interfaces/client'; +import { getDefault } from '~/openApi/common/parser/getDefault'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getType } from '~/openApi/common/parser/type'; +import { escapeName } from '~/utils/escape'; +import { unique } from '~/utils/unique'; + import type { Client } from '../../../types/client'; -import { escapeName } from '../../../utils/escape'; -import { unique } from '../../../utils/unique'; -import type { Model } from '../../common/interfaces/client'; -import { getDefault } from '../../common/parser/getDefault'; -import { getPattern } from '../../common/parser/getPattern'; -import { getType } from '../../common/parser/type'; import type { GetModelFn } from '../interfaces/Model'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getModels.ts b/packages/openapi-ts/src/openApi/v3/parser/getModels.ts index ee410fa03..9d19db258 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getModels.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getModels.ts @@ -1,5 +1,6 @@ +import { getParametersMeta, getSchemasMeta } from '~/utils/meta'; + import type { Client } from '../../../types/client'; -import { getParametersMeta, getSchemasMeta } from '../../../utils/meta'; import type { OpenApi } from '../interfaces/OpenApi'; import { getModel } from './getModel'; import { getParameterSchema } from './parameter'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperationParameter.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperationParameter.ts index ac45a9ffb..6289c6038 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperationParameter.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperationParameter.ts @@ -1,12 +1,13 @@ +import type { OperationParameter } from '~/openApi/common/interfaces/client'; +import { getDefault } from '~/openApi/common/parser/getDefault'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getRef } from '~/openApi/common/parser/getRef'; +import { operationParameterNameFn } from '~/openApi/common/parser/operation'; +import { getType } from '~/openApi/common/parser/type'; +import { refParametersPartial } from '~/utils/const'; +import { enumMeta } from '~/utils/enum'; + import type { Client } from '../../../types/client'; -import { refParametersPartial } from '../../../utils/const'; -import { enumMeta } from '../../../utils/enum'; -import type { OperationParameter } from '../../common/interfaces/client'; -import { getDefault } from '../../common/parser/getDefault'; -import { getPattern } from '../../common/parser/getPattern'; -import { getRef } from '../../common/parser/getRef'; -import { operationParameterNameFn } from '../../common/parser/operation'; -import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiParameter } from '../interfaces/OpenApiParameter'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperationParameters.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperationParameters.ts index 3748308fd..359106552 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperationParameters.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperationParameters.ts @@ -1,7 +1,8 @@ +import type { OperationParameters } from '~/openApi/common/interfaces/client'; +import { getRef } from '~/openApi/common/parser/getRef'; +import { operationParameterFilterFn } from '~/openApi/common/parser/operation'; + import type { Client } from '../../../types/client'; -import type { OperationParameters } from '../../common/interfaces/client'; -import { getRef } from '../../common/parser/getRef'; -import { operationParameterFilterFn } from '../../common/parser/operation'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiParameter } from '../interfaces/OpenApiParameter'; import { getOperationParameter } from './getOperationParameter'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperationRequestBody.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperationRequestBody.ts index 14bea9135..350f28abd 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperationRequestBody.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperationRequestBody.ts @@ -1,7 +1,8 @@ +import type { OperationParameter } from '~/openApi/common/interfaces/client'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getType } from '~/openApi/common/parser/type'; + import type { Client } from '../../../types/client'; -import type { OperationParameter } from '../../common/interfaces/client'; -import { getPattern } from '../../common/parser/getPattern'; -import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiRequestBody } from '../interfaces/OpenApiRequestBody'; import { getContent } from './getContent'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperationResponse.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperationResponse.ts index 73f3638a0..fb022b20f 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperationResponse.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperationResponse.ts @@ -1,8 +1,9 @@ +import type { OperationResponse } from '~/openApi/common/interfaces/client'; +import { getPattern } from '~/openApi/common/parser/getPattern'; +import { getRef } from '~/openApi/common/parser/getRef'; +import { getType } from '~/openApi/common/parser/type'; + import type { Client } from '../../../types/client'; -import type { OperationResponse } from '../../common/interfaces/client'; -import { getPattern } from '../../common/parser/getPattern'; -import { getRef } from '../../common/parser/getRef'; -import { getType } from '../../common/parser/type'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiResponse } from '../interfaces/OpenApiResponse'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperationResponses.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperationResponses.ts index a935bc84d..2719459ba 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperationResponses.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperationResponses.ts @@ -1,11 +1,12 @@ -import type { Client } from '../../../types/client'; -import type { OperationResponse } from '../../common/interfaces/client'; -import { getRef } from '../../common/parser/getRef'; +import type { OperationResponse } from '~/openApi/common/interfaces/client'; +import { getRef } from '~/openApi/common/parser/getRef'; import { parseResponseStatusCode, sorterByResponseStatusCode, tagResponseTypes, -} from '../../common/parser/operation'; +} from '~/openApi/common/parser/operation'; + +import type { Client } from '../../../types/client'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiResponse } from '../interfaces/OpenApiResponse'; import type { OpenApiResponses } from '../interfaces/OpenApiResponses'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts b/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts index 332bd3d1f..fe297f310 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getOperations.ts @@ -1,8 +1,9 @@ -import { createOperationKey } from '../../../ir/operation'; -import { getConfig } from '../../../utils/config'; -import type { Client, Operation } from '../../common/interfaces/client'; -import { operationFilterFn } from '../../common/parser/operation'; -import { allowedServiceMethods } from '../../common/parser/service'; +import { createOperationKey } from '~/ir/operation'; +import type { Client, Operation } from '~/openApi/common/interfaces/client'; +import { operationFilterFn } from '~/openApi/common/parser/operation'; +import { allowedServiceMethods } from '~/openApi/common/parser/service'; +import { getConfig } from '~/utils/config'; + import type { OpenApi } from '../interfaces/OpenApi'; import { getOperationParameters } from './getOperationParameters'; import { getOperation } from './operation'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/getRequiredPropertiesFromComposition.ts b/packages/openapi-ts/src/openApi/v3/parser/getRequiredPropertiesFromComposition.ts index 187e0f92a..6f99f3288 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/getRequiredPropertiesFromComposition.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/getRequiredPropertiesFromComposition.ts @@ -1,7 +1,8 @@ +import type { Model } from '~/openApi/common/interfaces/client'; +import { getRef } from '~/openApi/common/parser/getRef'; +import { getType } from '~/openApi/common/parser/type'; + import type { Client } from '../../../types/client'; -import type { Model } from '../../common/interfaces/client'; -import { getRef } from '../../common/parser/getRef'; -import { getType } from '../../common/parser/type'; import type { GetModelFn } from '../interfaces/Model'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiSchema } from '../interfaces/OpenApiSchema'; diff --git a/packages/openapi-ts/src/openApi/v3/parser/operation.ts b/packages/openapi-ts/src/openApi/v3/parser/operation.ts index 1669e2f8e..9ac0bc5e9 100644 --- a/packages/openapi-ts/src/openApi/v3/parser/operation.ts +++ b/packages/openapi-ts/src/openApi/v3/parser/operation.ts @@ -1,16 +1,17 @@ -import type { Client } from '../../../types/client'; -import { getConfig } from '../../../utils/config'; import type { Operation, OperationParameter, OperationParameters, -} from '../../common/interfaces/client'; -import { getRef } from '../../common/parser/getRef'; +} from '~/openApi/common/interfaces/client'; +import { getRef } from '~/openApi/common/parser/getRef'; import { getOperationResponseHeader, operationNameFn, -} from '../../common/parser/operation'; -import { toSortedByRequired } from '../../common/parser/sort'; +} from '~/openApi/common/parser/operation'; +import { toSortedByRequired } from '~/openApi/common/parser/sort'; +import { getConfig } from '~/utils/config'; + +import type { Client } from '../../../types/client'; import type { OpenApi } from '../interfaces/OpenApi'; import type { OpenApiOperation } from '../interfaces/OpenApiOperation'; import type { OpenApiRequestBody } from '../interfaces/OpenApiRequestBody'; diff --git a/packages/openapi-ts/src/plugins/@angular/common/api.ts b/packages/openapi-ts/src/plugins/@angular/common/api.ts index 00e28a062..ba721b633 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/api.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = | 'class' diff --git a/packages/openapi-ts/src/plugins/@angular/common/config.ts b/packages/openapi-ts/src/plugins/@angular/common/config.ts index 2e4d5be80..8bc8c001b 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/config.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import type { AngularCommonPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts b/packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts index 7874f75ad..0404d2d0e 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/httpRequests.ts @@ -1,13 +1,14 @@ import type { Symbol } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { stringCase } from '../../../utils/stringCase'; -import { getClientPlugin } from '../../@hey-api/client-core/utils'; -import { operationClasses } from '../../@hey-api/sdk/operation'; -import { isOperationOptionsRequired } from '../../shared/utils/operation'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { operationClasses } from '~/plugins/@hey-api/sdk/operation'; +import { isOperationOptionsRequired } from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; +import { stringCase } from '~/utils/stringCase'; + import type { AngularCommonPlugin } from './types'; interface AngularRequestClassEntry { diff --git a/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts b/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts index 2d7fbb818..76f32d3b9 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/httpResources.ts @@ -1,12 +1,13 @@ import type { Symbol } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { stringCase } from '../../../utils/stringCase'; -import { operationClasses } from '../../@hey-api/sdk/operation'; -import { isOperationOptionsRequired } from '../../shared/utils/operation'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { operationClasses } from '~/plugins/@hey-api/sdk/operation'; +import { isOperationOptionsRequired } from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; +import { stringCase } from '~/utils/stringCase'; + import type { AngularCommonPlugin } from './types'; interface AngularServiceClassEntry { diff --git a/packages/openapi-ts/src/plugins/@angular/common/types.d.ts b/packages/openapi-ts/src/plugins/@angular/common/types.d.ts index a7d7f73e7..680b72b85 100644 --- a/packages/openapi-ts/src/plugins/@angular/common/types.d.ts +++ b/packages/openapi-ts/src/plugins/@angular/common/types.d.ts @@ -1,5 +1,6 @@ -import type { StringName } from '../../../types/case'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@angular/common'> & diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts index 421e8e03e..1fdc9a1f7 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/config.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/config.ts index 206439156..f15b005af 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/config.ts @@ -1,6 +1,10 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; -import { clientPluginHandler } from '../client-core/plugin'; +import { + clientDefaultConfig, + clientDefaultMeta, +} from '~/plugins/@hey-api/client-core/config'; +import { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { HeyApiClientAngularPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts index f00c11617..5bb2cff2f 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-angular/types.d.ts @@ -1,5 +1,6 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@hey-api/client-angular'> & diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts index 08ee36a65..ee544c72c 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/config.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/config.ts index 7cc48c700..cfb1d088f 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/config.ts @@ -1,6 +1,10 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; -import { clientPluginHandler } from '../client-core/plugin'; +import { + clientDefaultConfig, + clientDefaultMeta, +} from '~/plugins/@hey-api/client-core/config'; +import { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { HeyApiClientAxiosPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts index 0d31baa36..058c44449 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-axios/types.d.ts @@ -1,5 +1,6 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@hey-api/client-axios'> & diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts index b7180fc35..d1122ed2c 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/client.ts @@ -1,6 +1,7 @@ -import { clientFolderAbsolutePath } from '../../../generate/client'; -import { tsc } from '../../../tsc'; -import { parseUrl } from '../../../utils/url'; +import { clientFolderAbsolutePath } from '~/generate/client'; +import { tsc } from '~/tsc'; +import { parseUrl } from '~/utils/url'; + import type { PluginHandler } from './types'; import { getClientBaseUrlKey } from './utils'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts index cb39f82ff..732d5e9d7 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/createClientConfig.ts @@ -1,5 +1,6 @@ -import { clientFolderAbsolutePath } from '../../../generate/client'; -import { tsc } from '../../../tsc'; +import { clientFolderAbsolutePath } from '~/generate/client'; +import { tsc } from '~/tsc'; + import type { PluginHandler } from './types'; export const createClientConfigType = ({ diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts index 0b328ab78..d76b102fe 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/types.d.ts @@ -1,10 +1,10 @@ -import type { Plugin } from '../../types'; -import type { HeyApiClientAngularPlugin } from '../client-angular'; -import type { HeyApiClientAxiosPlugin } from '../client-axios'; -import type { HeyApiClientFetchPlugin } from '../client-fetch'; -import type { HeyApiClientNextPlugin } from '../client-next'; -import type { HeyApiClientNuxtPlugin } from '../client-nuxt'; -import type { HeyApiClientOfetchPlugin } from '../client-ofetch'; +import type { HeyApiClientAngularPlugin } from '~/plugins/@hey-api/client-angular'; +import type { HeyApiClientAxiosPlugin } from '~/plugins/@hey-api/client-axios'; +import type { HeyApiClientFetchPlugin } from '~/plugins/@hey-api/client-fetch'; +import type { HeyApiClientNextPlugin } from '~/plugins/@hey-api/client-next'; +import type { HeyApiClientNuxtPlugin } from '~/plugins/@hey-api/client-nuxt'; +import type { HeyApiClientOfetchPlugin } from '~/plugins/@hey-api/client-ofetch'; +import type { Plugin } from '~/plugins/types'; export interface PluginHandler { (...args: Parameters): void; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-core/utils.ts b/packages/openapi-ts/src/plugins/@hey-api/client-core/utils.ts index 9ad8f1adb..05a0cbbf0 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-core/utils.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-core/utils.ts @@ -1,5 +1,5 @@ -import type { Config } from '../../../types/config'; -import type { PluginClientNames } from '../../types'; +import type { PluginClientNames } from '~/plugins/types'; +import type { Config } from '~/types/config'; export const getClientBaseUrlKey = (config: Config) => { const client = getClientPlugin(config); diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts index d72153064..29e1dbc4d 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/config.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/config.ts index e998359d3..0e50f65d0 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/config.ts @@ -1,6 +1,10 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; -import { clientPluginHandler } from '../client-core/plugin'; +import { + clientDefaultConfig, + clientDefaultMeta, +} from '~/plugins/@hey-api/client-core/config'; +import { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { HeyApiClientFetchPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts index 89ccfec08..37d3b06f0 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-fetch/types.d.ts @@ -1,5 +1,6 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@hey-api/client-fetch'> & diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts index 6db16fbf8..d95026b35 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/config.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/config.ts index f97faa6ea..e219b4992 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/config.ts @@ -1,6 +1,10 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; -import { clientPluginHandler } from '../client-core/plugin'; +import { + clientDefaultConfig, + clientDefaultMeta, +} from '~/plugins/@hey-api/client-core/config'; +import { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { HeyApiClientNextPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts index a4ecee19d..7319f3521 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-next/types.d.ts @@ -1,5 +1,6 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@hey-api/client-next'> & diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts index b5965c69b..e84b7849e 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/config.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/config.ts index 3a11f545b..6a686ecd4 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/config.ts @@ -1,6 +1,10 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; -import { clientPluginHandler } from '../client-core/plugin'; +import { + clientDefaultConfig, + clientDefaultMeta, +} from '~/plugins/@hey-api/client-core/config'; +import { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { HeyApiClientNuxtPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts index 1c45f5704..4f297a0bb 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-nuxt/types.d.ts @@ -1,5 +1,6 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@hey-api/client-nuxt'> & Client.Config; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts index 479523b23..2e94cdb89 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'client'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/config.ts b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/config.ts index 6cfaa83bf..adf180f20 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/config.ts @@ -1,6 +1,10 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { clientDefaultConfig, clientDefaultMeta } from '../client-core/config'; -import { clientPluginHandler } from '../client-core/plugin'; +import { + clientDefaultConfig, + clientDefaultMeta, +} from '~/plugins/@hey-api/client-core/config'; +import { clientPluginHandler } from '~/plugins/@hey-api/client-core/plugin'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { HeyApiClientOfetchPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts index 633236a4e..697618a19 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/client-ofetch/types.d.ts @@ -1,5 +1,6 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@hey-api/client-ofetch'> & diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/config.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/config.ts index 9fb818205..7d7064629 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import type { HeyApiClientLegacyAngularPlugin } from './types'; export const defaultConfig: HeyApiClientLegacyAngularPlugin['Config'] = { diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts index c0286e5c7..82f85d754 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-angular/types.d.ts @@ -1,5 +1,5 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/angular'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/config.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/config.ts index b3b649214..796607fe9 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import type { HeyApiClientLegacyAxiosPlugin } from './types'; export const defaultConfig: HeyApiClientLegacyAxiosPlugin['Config'] = { diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts index f0f67e65f..0ca49022f 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-axios/types.d.ts @@ -1,5 +1,5 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/axios'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/config.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/config.ts index b25511763..730df72f0 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import type { HeyApiClientLegacyFetchPlugin } from './types'; export const defaultConfig: HeyApiClientLegacyFetchPlugin['Config'] = { diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts index 953a491c8..448d0020c 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-fetch/types.d.ts @@ -1,5 +1,5 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/fetch'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-node/config.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-node/config.ts index caa7f71ff..71e7051f0 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-node/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-node/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import type { HeyApiClientLegacyNodePlugin } from './types'; export const defaultConfig: HeyApiClientLegacyNodePlugin['Config'] = { diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts index 070b46611..9def74381 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-node/types.d.ts @@ -1,5 +1,5 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/node'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/config.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/config.ts index 617ce2ee9..499b222f1 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import type { HeyApiClientLegacyXhrPlugin } from './types'; export const defaultConfig: HeyApiClientLegacyXhrPlugin['Config'] = { diff --git a/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts index 6e19c613e..7b6d2623c 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/legacy-xhr/types.d.ts @@ -1,5 +1,5 @@ -import type { DefinePlugin, Plugin } from '../../types'; -import type { Client } from '../client-core/types'; +import type { Client } from '~/plugins/@hey-api/client-core/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; export type UserConfig = Plugin.Name<'legacy/xhr'> & Pick; diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts index 073916160..479ea0bcb 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/__tests__/schemas.test.ts @@ -4,11 +4,12 @@ import { Project } from '@hey-api/codegen-core'; import type ts from 'typescript'; import { describe, expect, it, vi } from 'vitest'; -import { client, openApi } from '../../../../generate/__tests__/mocks'; -import type { OpenApiV3Schema } from '../../../../openApi'; -import type { Files } from '../../../../types/utils'; -import { setConfig } from '../../../../utils/config'; -import { PluginInstance } from '../../../shared/utils/instance'; +import { client, openApi } from '~/generate/__tests__/mocks'; +import type { OpenApiV3Schema } from '~/openApi'; +import { PluginInstance } from '~/plugins/shared/utils/instance'; +import type { Files } from '~/types/utils'; +import { setConfig } from '~/utils/config'; + import { handlerLegacy } from '../plugin-legacy'; vi.mock('node:fs'); diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts index 71d0200ed..b24c4005c 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'ref'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts index 55c9a8136..7c4e6b2b2 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import { handlerLegacy } from './plugin-legacy'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/plugin-legacy.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/plugin-legacy.ts index e2a16dc4f..ed0a5ebac 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/plugin-legacy.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/plugin-legacy.ts @@ -1,8 +1,9 @@ -import { GeneratedFile } from '../../../generate/file'; -import type { OpenApiV2Schema, OpenApiV3Schema } from '../../../openApi'; -import { ensureValidTypeScriptJavaScriptIdentifier } from '../../../openApi'; -import { tsc } from '../../../tsc'; -import { getConfig } from '../../../utils/config'; +import { GeneratedFile } from '~/generate/file'; +import type { OpenApiV2Schema, OpenApiV3Schema } from '~/openApi'; +import { ensureValidTypeScriptJavaScriptIdentifier } from '~/openApi'; +import { tsc } from '~/tsc'; +import { getConfig } from '~/utils/config'; + import type { HeyApiSchemasPlugin } from './types'; const ensureValidSchemaOutput = ( diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/plugin.ts index 999f5a693..959bfb539 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/plugin.ts @@ -1,11 +1,12 @@ -import { satisfies } from '../../../config/utils/package'; -import type { IR } from '../../../ir/types'; -import type { OpenApiV2_0_XTypes } from '../../../openApi/2.0.x'; -import type { OpenApiV3_0_XTypes } from '../../../openApi/3.0.x'; -import type { OpenApiV3_1_XTypes } from '../../../openApi/3.1.x'; -import { ensureValidIdentifier } from '../../../openApi/shared/utils/identifier'; -import type { OpenApi } from '../../../openApi/types'; -import { tsc } from '../../../tsc'; +import { satisfies } from '~/config/utils/package'; +import type { IR } from '~/ir/types'; +import type { OpenApiV2_0_XTypes } from '~/openApi/2.0.x'; +import type { OpenApiV3_0_XTypes } from '~/openApi/3.0.x'; +import type { OpenApiV3_1_XTypes } from '~/openApi/3.1.x'; +import { ensureValidIdentifier } from '~/openApi/shared/utils/identifier'; +import type { OpenApi } from '~/openApi/types'; +import { tsc } from '~/tsc'; + import type { HeyApiSchemasPlugin } from './types'; const stripSchema = ({ diff --git a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts index fdffdd1ac..856239acb 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/schemas/types.d.ts @@ -1,8 +1,9 @@ -import type { OpenApiV2Schema, OpenApiV3Schema } from '../../../openApi'; -import type { OpenApiV2_0_XTypes } from '../../../openApi/2.0.x'; -import type { OpenApiV3_0_XTypes } from '../../../openApi/3.0.x'; -import type { OpenApiV3_1_XTypes } from '../../../openApi/3.1.x'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { OpenApiV2Schema, OpenApiV3Schema } from '~/openApi'; +import type { OpenApiV2_0_XTypes } from '~/openApi/2.0.x'; +import type { OpenApiV3_0_XTypes } from '~/openApi/3.0.x'; +import type { OpenApiV3_1_XTypes } from '~/openApi/3.1.x'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@hey-api/schemas'> & diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts index d1e9a4ae5..86b288d48 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/__tests__/plugin.test.ts @@ -5,13 +5,14 @@ import { Project } from '@hey-api/codegen-core'; import type ts from 'typescript'; import { describe, expect, it, vi } from 'vitest'; -import { openApi } from '../../../../generate/__tests__/mocks'; -import { GeneratedFile } from '../../../../generate/file'; -import type { Operation } from '../../../../types/client'; -import type { Config } from '../../../../types/config'; -import type { Files } from '../../../../types/utils'; -import { setConfig } from '../../../../utils/config'; -import { PluginInstance } from '../../../shared/utils/instance'; +import { openApi } from '~/generate/__tests__/mocks'; +import { GeneratedFile } from '~/generate/file'; +import { PluginInstance } from '~/plugins/shared/utils/instance'; +import type { Operation } from '~/types/client'; +import type { Config } from '~/types/config'; +import type { Files } from '~/types/utils'; +import { setConfig } from '~/utils/config'; + import { handlerLegacy } from '../plugin-legacy'; vi.mock('node:fs'); diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts index 313c8a5e4..18031c2fe 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/api.ts @@ -1,6 +1,7 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; + import { createOperationComment } from './comment'; type SelectorType = diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/auth.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/auth.ts index 6b9094486..3766e0cd4 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/auth.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/auth.ts @@ -1,4 +1,5 @@ -import type { IR } from '../../../ir/types'; +import type { IR } from '~/ir/types'; + import type { Auth } from '../client-core/bundle/auth'; import type { HeyApiSdkPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/comment.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/comment.ts index 46a4f9d41..c8229c101 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/comment.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/comment.ts @@ -1,6 +1,6 @@ -import type { IR } from '../../../ir/types'; -import type { Comments } from '../../../tsc'; -import { escapeComment } from '../../../utils/escape'; +import type { IR } from '~/ir/types'; +import type { Comments } from '~/tsc'; +import { escapeComment } from '~/utils/escape'; export const createOperationComment = ({ operation, diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/config.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/config.ts index 967510fa5..956f1e584 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import { handlerLegacy } from './plugin-legacy'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts index 2c2bacce3..e63776dbe 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/operation.ts @@ -1,16 +1,17 @@ import type ts from 'typescript'; -import { statusCodeToGroup } from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { sanitizeNamespaceIdentifier } from '../../../openApi'; -import { ensureValidIdentifier } from '../../../openApi/shared/utils/identifier'; -import { tsc } from '../../../tsc'; -import type { FunctionParameter, ObjectValue } from '../../../tsc/types'; -import { reservedJavaScriptKeywordsRegExp } from '../../../utils/regexp'; -import { stringCase } from '../../../utils/stringCase'; -import { transformClassName } from '../../../utils/transform'; +import { statusCodeToGroup } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { sanitizeNamespaceIdentifier } from '~/openApi'; +import { ensureValidIdentifier } from '~/openApi/shared/utils/identifier'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { tsc } from '~/tsc'; +import type { FunctionParameter, ObjectValue } from '~/tsc/types'; +import { reservedJavaScriptKeywordsRegExp } from '~/utils/regexp'; +import { stringCase } from '~/utils/stringCase'; +import { transformClassName } from '~/utils/transform'; + import type { Field, Fields } from '../client-core/bundle/params'; -import { getClientPlugin } from '../client-core/utils'; import { operationAuth } from './auth'; import { nuxtTypeComposable, nuxtTypeDefault } from './constants'; // import { getSignatureParameters } from './signature'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin-legacy.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin-legacy.ts index 3a8c30c3c..0ed757f26 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin-legacy.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin-legacy.ts @@ -1,32 +1,33 @@ import type ts from 'typescript'; -import { clientModulePath } from '../../../generate/client'; -import { GeneratedFile } from '../../../generate/file'; -import type { IR } from '../../../ir/types'; -import { isOperationParameterRequired } from '../../../openApi'; -import type { Comments, FunctionParameter } from '../../../tsc'; -import { tsc } from '../../../tsc'; -import type { FunctionTypeParameter, ObjectValue } from '../../../tsc/types'; +import { clientModulePath } from '~/generate/client'; +import { GeneratedFile } from '~/generate/file'; +import type { IR } from '~/ir/types'; +import { isOperationParameterRequired } from '~/openApi'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import type { Comments, FunctionParameter } from '~/tsc'; +import { tsc } from '~/tsc'; +import type { FunctionTypeParameter, ObjectValue } from '~/tsc/types'; import type { Client, Model, Operation, OperationParameter, Service, -} from '../../../types/client'; -import type { Config as ClientConfig } from '../../../types/config'; +} from '~/types/client'; +import type { Config as ClientConfig } from '~/types/config'; import { getConfig, isLegacyClient, legacyNameFromConfig, -} from '../../../utils/config'; -import { escapeComment, escapeName } from '../../../utils/escape'; -import { reservedJavaScriptKeywordsRegExp } from '../../../utils/regexp'; -import { stringCase } from '../../../utils/stringCase'; -import { transformClassName } from '../../../utils/transform'; -import { setUniqueTypeName } from '../../../utils/type'; -import { unique } from '../../../utils/unique'; -import { getClientPlugin } from '../client-core/utils'; +} from '~/utils/config'; +import { escapeComment, escapeName } from '~/utils/escape'; +import { reservedJavaScriptKeywordsRegExp } from '~/utils/regexp'; +import { stringCase } from '~/utils/stringCase'; +import { transformClassName } from '~/utils/transform'; +import { setUniqueTypeName } from '~/utils/type'; +import { unique } from '~/utils/unique'; + import type { HeyApiSdkPlugin } from './types'; type OnNode = (node: ts.Node) => void; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts index f583ecac7..8407fe0cb 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/plugin.ts @@ -1,10 +1,11 @@ import type ts from 'typescript'; -import { clientFolderAbsolutePath } from '../../../generate/client'; -import { tsc } from '../../../tsc'; -import { stringCase } from '../../../utils/stringCase'; -import { isOperationOptionsRequired } from '../../shared/utils/operation'; -import { getClientPlugin } from '../client-core/utils'; +import { clientFolderAbsolutePath } from '~/generate/client'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { isOperationOptionsRequired } from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; +import { stringCase } from '~/utils/stringCase'; + import { nuxtTypeComposable, nuxtTypeDefault } from './constants'; import { operationClasses, diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/signature.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/signature.ts index 32f03b753..fbd6042e6 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/signature.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/signature.ts @@ -1,4 +1,4 @@ -import type { IR } from '../../../ir/types'; +import type { IR } from '~/ir/types'; type Location = keyof IR.ParametersObject | 'body'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts index 52e5d0bc8..50efaf4c0 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/typeOptions.ts @@ -1,6 +1,7 @@ -import { clientFolderAbsolutePath } from '../../../generate/client'; -import { tsc } from '../../../tsc'; -import { getClientPlugin } from '../client-core/utils'; +import { clientFolderAbsolutePath } from '~/generate/client'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { tsc } from '~/tsc'; + import { nuxtTypeDefault, nuxtTypeResponse } from './constants'; import type { HeyApiSdkPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts index ffd5d7ad7..54994441e 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/types.d.ts @@ -1,12 +1,13 @@ -import type { IR } from '../../../ir/types'; -import type { StringName } from '../../../types/case'; -import type { Operation } from '../../../types/client'; +import type { IR } from '~/ir/types'; import type { DefinePlugin, Plugin, PluginClientNames, PluginValidatorNames, -} from '../../types'; +} from '~/plugins/types'; +import type { StringName } from '~/types/case'; +import type { Operation } from '~/types/client'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@hey-api/sdk'> & diff --git a/packages/openapi-ts/src/plugins/@hey-api/sdk/validator.ts b/packages/openapi-ts/src/plugins/@hey-api/sdk/validator.ts index 714207fb9..1819ca02c 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/sdk/validator.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/sdk/validator.ts @@ -1,6 +1,7 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; +import type { IR } from '~/ir/types'; + import type { HeyApiSdkPlugin } from './types'; interface ValidatorProps { diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts index 3a60212ba..5b9a9a449 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'response' | 'response-ref'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/config.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/config.ts index 53a7ef0ae..4bbf54984 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { bigIntExpressions, dateExpressions } from './expressions'; import { handler } from './plugin'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/expressions.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/expressions.ts index 4e1e94971..070bd06a9 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/expressions.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/expressions.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { tsc } from '../../../tsc'; +import type { IR } from '~/ir/types'; +import { tsc } from '~/tsc'; + import type { UserConfig } from './types'; export type ExpressionTransformer = ({ diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin-legacy.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin-legacy.ts index 2d5902c17..ae6df43c9 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin-legacy.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin-legacy.ts @@ -1,16 +1,20 @@ import type ts from 'typescript'; -import { createOperationKey } from '../../../ir/operation'; -import { tsc } from '../../../tsc'; -import type { ModelMeta, OperationResponse } from '../../../types/client'; -import { getConfig } from '../../../utils/config'; -import { isModelDate, unsetUniqueTypeName } from '../../../utils/type'; +import { createOperationKey } from '~/ir/operation'; import { modelResponseTransformerTypeName, operationResponseTransformerTypeName, operationResponseTypeName, -} from '../sdk/plugin-legacy'; -import { generateType, type TypesProps } from '../typescript/plugin-legacy'; +} from '~/plugins/@hey-api/sdk/plugin-legacy'; +import { + generateType, + type TypesProps, +} from '~/plugins/@hey-api/typescript/plugin-legacy'; +import { tsc } from '~/tsc'; +import type { ModelMeta, OperationResponse } from '~/types/client'; +import { getConfig } from '~/utils/config'; +import { isModelDate, unsetUniqueTypeName } from '~/utils/type'; + import type { HeyApiTransformersPlugin } from './types'; interface ModelProps extends TypesProps { diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts index 485871b92..6fdfca657 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/plugin.ts @@ -1,13 +1,11 @@ import ts from 'typescript'; -import { - createOperationKey, - operationResponsesMap, -} from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { refToName } from '../../../utils/ref'; +import { createOperationKey, operationResponsesMap } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { tsc } from '~/tsc'; +import { refToName } from '~/utils/ref'; + import type { HeyApiTransformersPlugin } from './types'; const dataVariableName = 'data'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts index 5ac02deac..66efda569 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/transformers/types.d.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { IR } from '~/ir/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; import type { ExpressionTransformer } from './expressions'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts index 3a59329d1..b1935c695 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/__tests__/plugin.test.ts @@ -4,11 +4,12 @@ import { Project } from '@hey-api/codegen-core'; import type ts from 'typescript'; import { describe, expect, it, vi } from 'vitest'; -import { openApi } from '../../../../generate/__tests__/mocks'; -import { GeneratedFile } from '../../../../generate/file'; -import type { Config } from '../../../../types/config'; -import { setConfig } from '../../../../utils/config'; -import { PluginInstance } from '../../../shared/utils/instance'; +import { openApi } from '~/generate/__tests__/mocks'; +import { GeneratedFile } from '~/generate/file'; +import { PluginInstance } from '~/plugins/shared/utils/instance'; +import type { Config } from '~/types/config'; +import { setConfig } from '~/utils/config'; + import { handlerLegacy } from '../plugin-legacy'; vi.mock('node:fs'); diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts index aacaaf16a..3b453b007 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/api.ts @@ -1,7 +1,8 @@ import type { Selector } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; + import { schemaToType } from './plugin'; type SelectorType = diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts index eafcc5e40..e5a032432 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/clientOptions.ts @@ -1,10 +1,14 @@ import type { Symbol } from '@hey-api/codegen-core'; import ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { tsc } from '../../../tsc'; -import { parseUrl } from '../../../utils/url'; -import { getClientBaseUrlKey, getClientPlugin } from '../client-core/utils'; +import type { IR } from '~/ir/types'; +import { + getClientBaseUrlKey, + getClientPlugin, +} from '~/plugins/@hey-api/client-core/utils'; +import { tsc } from '~/tsc'; +import { parseUrl } from '~/utils/url'; + import type { HeyApiTypeScriptPlugin } from './types'; const stringType = tsc.keywordTypeNode({ keyword: 'string' }); diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/config.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/config.ts index ac3575b97..4959c9ab6 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/config.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import { handlerLegacy } from './plugin-legacy'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/export.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/export.ts index 13171b12c..b84ed2e67 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/export.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/export.ts @@ -1,11 +1,12 @@ import type { Symbol } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { tsc } from '../../../tsc'; -import { numberRegExp } from '../../../utils/regexp'; -import { stringCase } from '../../../utils/stringCase'; -import { createSchemaComment } from '../../shared/utils/schema'; +import type { IR } from '~/ir/types'; +import { createSchemaComment } from '~/plugins/shared/utils/schema'; +import { tsc } from '~/tsc'; +import { numberRegExp } from '~/utils/regexp'; +import { stringCase } from '~/utils/stringCase'; + import type { HeyApiTypeScriptPlugin } from './types'; const schemaToEnumObject = ({ diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/operation.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/operation.ts index 1584241f8..490275976 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/operation.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/operation.ts @@ -1,8 +1,9 @@ -import { operationResponsesMap } from '../../../ir/operation'; -import { deduplicateSchema } from '../../../ir/schema'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; +import { operationResponsesMap } from '~/ir/operation'; +import { deduplicateSchema } from '~/ir/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { tsc } from '~/tsc'; + import { schemaToType } from './plugin'; import type { HeyApiTypeScriptPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin-legacy.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin-legacy.ts index 5c7ab2f02..cc368fe34 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin-legacy.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin-legacy.ts @@ -1,28 +1,24 @@ import type ts from 'typescript'; -import { GeneratedFile } from '../../../generate/file'; -import { isOperationParameterRequired } from '../../../openApi'; -import { type Comments, tsc } from '../../../tsc'; -import type { - Client, - Method, - Model, - OperationParameter, -} from '../../../types/client'; -import { getConfig, isLegacyClient } from '../../../utils/config'; -import { enumEntry, enumUnionType } from '../../../utils/enum'; -import { escapeComment } from '../../../utils/escape'; -import { sortByName, sorterByName } from '../../../utils/sort'; -import { - setUniqueTypeName, - type SetUniqueTypeNameResult, - toType, -} from '../../../utils/type'; +import { GeneratedFile } from '~/generate/file'; +import { isOperationParameterRequired } from '~/openApi'; import { operationDataTypeName, operationErrorTypeName, operationResponseTypeName, -} from '../sdk/plugin-legacy'; +} from '~/plugins/@hey-api/sdk/plugin-legacy'; +import { type Comments, tsc } from '~/tsc'; +import type { Client, Method, Model, OperationParameter } from '~/types/client'; +import { getConfig, isLegacyClient } from '~/utils/config'; +import { enumEntry, enumUnionType } from '~/utils/enum'; +import { escapeComment } from '~/utils/escape'; +import { sortByName, sorterByName } from '~/utils/sort'; +import { + setUniqueTypeName, + type SetUniqueTypeNameResult, + toType, +} from '~/utils/type'; + import type { HeyApiTypeScriptPlugin } from './types'; export interface TypesProps { diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts index 0de46c7ba..4907d28a2 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/plugin.ts @@ -1,15 +1,16 @@ import type ts from 'typescript'; -import { deduplicateSchema } from '../../../ir/schema'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import type { Property } from '../../../tsc'; -import { tsc } from '../../../tsc'; -import { refToName } from '../../../utils/ref'; -import { stringCase } from '../../../utils/stringCase'; -import type { SchemaWithType } from '../../shared/types/schema'; -import { fieldName } from '../../shared/utils/case'; -import { createSchemaComment } from '../../shared/utils/schema'; +import { deduplicateSchema } from '~/ir/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { fieldName } from '~/plugins/shared/utils/case'; +import { createSchemaComment } from '~/plugins/shared/utils/schema'; +import type { Property } from '~/tsc'; +import { tsc } from '~/tsc'; +import { refToName } from '~/utils/ref'; +import { stringCase } from '~/utils/stringCase'; + import { createClientOptions } from './clientOptions'; import { exportType } from './export'; import { operationToType } from './operation'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts index 5722a2fe5..fd1659c37 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/types.d.ts @@ -1,5 +1,6 @@ -import type { StringCase, StringName } from '../../../types/case'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type EnumsType = 'javascript' | 'typescript' | 'typescript-const'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/webhook.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/webhook.ts index 7c306aca4..d1874fae1 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/webhook.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/webhook.ts @@ -1,7 +1,8 @@ -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { createSchemaComment } from '../../shared/utils/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { createSchemaComment } from '~/plugins/shared/utils/schema'; +import { tsc } from '~/tsc'; + import { schemaToType } from './plugin'; import type { HeyApiTypeScriptPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@hey-api/typescript/webhooks.ts b/packages/openapi-ts/src/plugins/@hey-api/typescript/webhooks.ts index 4539a468e..242373b74 100644 --- a/packages/openapi-ts/src/plugins/@hey-api/typescript/webhooks.ts +++ b/packages/openapi-ts/src/plugins/@hey-api/typescript/webhooks.ts @@ -1,6 +1,7 @@ import type { Symbol } from '@hey-api/codegen-core'; -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; + import type { HeyApiTypeScriptPlugin } from './types'; export const createWebhooks = ({ diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/api.ts b/packages/openapi-ts/src/plugins/@pinia/colada/api.ts index be883d4c4..e2eb81a04 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/api.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = | '_JSONValue' diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/config.ts b/packages/openapi-ts/src/plugins/@pinia/colada/config.ts index e420831ff..6d3804572 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/config.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import type { PiniaColadaPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/meta.ts b/packages/openapi-ts/src/plugins/@pinia/colada/meta.ts index a2755448e..b07ba694c 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/meta.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/meta.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { tsc } from '../../../tsc'; +import type { IR } from '~/ir/types'; +import { tsc } from '~/tsc'; + import type { PiniaColadaPlugin } from './types'; export const handleMeta = ( diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts b/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts index 8d587d2fc..b8f308c24 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/mutationOptions.ts @@ -1,8 +1,9 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { tsc } from '~/tsc'; + import { handleMeta } from './meta'; import type { PiniaColadaPlugin } from './types'; import { useTypeData, useTypeError, useTypeResponse } from './useType'; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts b/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts index 2adb8654b..b0ccc056d 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/plugin.ts @@ -1,5 +1,6 @@ -import { stringCase } from '../../../utils/stringCase'; -import { operationClasses } from '../../@hey-api/sdk/operation'; +import { operationClasses } from '~/plugins/@hey-api/sdk/operation'; +import { stringCase } from '~/utils/stringCase'; + import { createMutationOptions } from './mutationOptions'; import { createQueryOptions } from './queryOptions'; import type { PiniaColadaPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts b/packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts index b53b75f6a..4e649b21b 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/queryKey.ts @@ -1,15 +1,16 @@ import type { Symbol } from '@hey-api/codegen-core'; import type { Expression } from 'typescript'; -import { clientFolderAbsolutePath } from '../../../generate/client'; -import { hasOperationDataRequired } from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { type Property, tsc } from '../../../tsc'; +import { clientFolderAbsolutePath } from '~/generate/client'; +import { hasOperationDataRequired } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; import { getClientBaseUrlKey, getClientPlugin, -} from '../../@hey-api/client-core/utils'; +} from '~/plugins/@hey-api/client-core/utils'; +import { type Property, tsc } from '~/tsc'; + import type { PiniaColadaPlugin } from './types'; import { useTypeData } from './useType'; import { getPublicTypeData } from './utils'; diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts b/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts index b26ed22c2..804f168f7 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/queryOptions.ts @@ -1,12 +1,13 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; import { hasOperationSse, isOperationOptionsRequired, -} from '../../shared/utils/operation'; +} from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; + import { handleMeta } from './meta'; import { createQueryKeyFunction, diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts b/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts index a69bd0445..efc2d3fd4 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/types.d.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import type { StringCase, StringName } from '../../../types/case'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { IR } from '~/ir/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@pinia/colada'> & diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/useType.ts b/packages/openapi-ts/src/plugins/@pinia/colada/useType.ts index 9bbd47396..e225c2dc8 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/useType.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/useType.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import { getClientPlugin } from '../../@hey-api/client-core/utils'; -import { operationOptionsType } from '../../@hey-api/sdk/operation'; +import type { IR } from '~/ir/types'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { operationOptionsType } from '~/plugins/@hey-api/sdk/operation'; + import type { PiniaColadaPlugin } from './types'; export const useTypeData = ({ diff --git a/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts b/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts index a5757b680..9164b3ee7 100644 --- a/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts +++ b/packages/openapi-ts/src/plugins/@pinia/colada/utils.ts @@ -1,4 +1,5 @@ -import { getClientPlugin } from '../../@hey-api/client-core/utils'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; + import type { PiniaColadaPlugin } from './types'; export const getPublicTypeData = ({ diff --git a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts index 89b5fd940..450cafabc 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/config.ts b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/config.ts index 42a1d2f05..873364817 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/config.ts @@ -1,6 +1,7 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { handler } from '../query-core/plugin'; -import { handlerLegacy } from '../query-core/plugin-legacy'; +import { handler } from '~/plugins/@tanstack/query-core/plugin'; +import { handlerLegacy } from '~/plugins/@tanstack/query-core/plugin-legacy'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { TanStackAngularQueryPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts index 76d319b8f..80334a301 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/angular-query-experimental/types.d.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import type { StringCase, StringName } from '../../../types/case'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { IR } from '~/ir/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@tanstack/angular-query-experimental'> & diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts index adabe1c92..db1cbe65b 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/infiniteQueryOptions.ts @@ -1,11 +1,12 @@ import ts from 'typescript'; -import { operationPagination } from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { tsNodeToString } from '../../../tsc/utils'; -import { isOperationOptionsRequired } from '../../shared/utils/operation'; +import { operationPagination } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { isOperationOptionsRequired } from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; +import { tsNodeToString } from '~/tsc/utils'; + import { handleMeta } from './meta'; import { createQueryKeyFunction, diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/meta.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/meta.ts index f51c356ff..a5bbb901e 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/meta.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/meta.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { tsc } from '../../../tsc'; +import type { IR } from '~/ir/types'; +import { tsc } from '~/tsc'; + import type { PluginInstance } from './types'; export const handleMeta = ( diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts index 26d6f2a02..0d9269f8c 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/mutationOptions.ts @@ -1,8 +1,9 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { tsc } from '~/tsc'; + import { handleMeta } from './meta'; import type { PluginInstance } from './types'; import { useTypeData, useTypeError, useTypeResponse } from './useType'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin-legacy.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin-legacy.ts index 5825d1a46..977ca4334 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin-legacy.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin-legacy.ts @@ -1,29 +1,15 @@ import ts from 'typescript'; -import { clientModulePath } from '../../../generate/client'; -import { relativeModulePath } from '../../../generate/utils'; -import { createOperationKey } from '../../../ir/operation'; -import { getPaginationKeywordsRegExp } from '../../../ir/pagination'; -import type { IR } from '../../../ir/types'; -import { isOperationParameterRequired } from '../../../openApi'; -import { type Property, tsc } from '../../../tsc'; -import type { ImportExportItem } from '../../../tsc/module'; -import type { ImportExportItemObject } from '../../../tsc/utils'; -import type { - Client, - Method, - Model, - Operation, - OperationParameter, -} from '../../../types/client'; -import type { Config } from '../../../types/config'; -import type { Files } from '../../../types/utils'; -import { getConfig, isLegacyClient } from '../../../utils/config'; -import { transformClassName } from '../../../utils/transform'; +import { clientModulePath } from '~/generate/client'; +import { relativeModulePath } from '~/generate/utils'; +import { createOperationKey } from '~/ir/operation'; +import { getPaginationKeywordsRegExp } from '~/ir/pagination'; +import type { IR } from '~/ir/types'; +import { isOperationParameterRequired } from '~/openApi'; import { getClientBaseUrlKey, getClientPlugin, -} from '../../@hey-api/client-core/utils'; +} from '~/plugins/@hey-api/client-core/utils'; import { generateImport, operationDataTypeName, @@ -31,12 +17,26 @@ import { operationOptionsLegacyParserType, operationResponseTypeName, serviceFunctionIdentifier, -} from '../../@hey-api/sdk/plugin-legacy'; -import type { TanStackAngularQueryPlugin } from '../angular-query-experimental'; -import type { TanStackReactQueryPlugin } from '../react-query'; -import type { TanStackSolidQueryPlugin } from '../solid-query'; -import type { TanStackSvelteQueryPlugin } from '../svelte-query'; -import type { TanStackVueQueryPlugin } from '../vue-query'; +} from '~/plugins/@hey-api/sdk/plugin-legacy'; +import type { TanStackAngularQueryPlugin } from '~/plugins/@tanstack/angular-query-experimental'; +import type { TanStackReactQueryPlugin } from '~/plugins/@tanstack/react-query'; +import type { TanStackSolidQueryPlugin } from '~/plugins/@tanstack/solid-query'; +import type { TanStackSvelteQueryPlugin } from '~/plugins/@tanstack/svelte-query'; +import type { TanStackVueQueryPlugin } from '~/plugins/@tanstack/vue-query'; +import { type Property, tsc } from '~/tsc'; +import type { ImportExportItem } from '~/tsc/module'; +import type { ImportExportItemObject } from '~/tsc/utils'; +import type { + Client, + Method, + Model, + Operation, + OperationParameter, +} from '~/types/client'; +import type { Config } from '~/types/config'; +import type { Files } from '~/types/utils'; +import { getConfig, isLegacyClient } from '~/utils/config'; +import { transformClassName } from '~/utils/transform'; const toInfiniteQueryOptionsName = (operation: Operation) => `${serviceFunctionIdentifier({ diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts index 38e10ae6b..4c773dfc2 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/plugin.ts @@ -1,5 +1,6 @@ -import { stringCase } from '../../../utils/stringCase'; -import { operationClasses } from '../../@hey-api/sdk/operation'; +import { operationClasses } from '~/plugins/@hey-api/sdk/operation'; +import { stringCase } from '~/utils/stringCase'; + import { createInfiniteQueryOptions } from './infiniteQueryOptions'; import { createMutationOptions } from './mutationOptions'; import { createQueryOptions } from './queryOptions'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/queryKey.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/queryKey.ts index 1adf95747..434bddbaa 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/queryKey.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/queryKey.ts @@ -1,14 +1,15 @@ import type { Symbol } from '@hey-api/codegen-core'; import type { Expression } from 'typescript'; -import { hasOperationDataRequired } from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { type Property, tsc } from '../../../tsc'; +import { hasOperationDataRequired } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; import { getClientBaseUrlKey, getClientPlugin, -} from '../../@hey-api/client-core/utils'; +} from '~/plugins/@hey-api/client-core/utils'; +import { type Property, tsc } from '~/tsc'; + import type { PluginInstance } from './types'; import { useTypeData } from './useType'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts index 25b52f9e4..d9392010f 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/queryOptions.ts @@ -1,12 +1,13 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; import { hasOperationSse, isOperationOptionsRequired, -} from '../../shared/utils/operation'; +} from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; + import { handleMeta } from './meta'; import { createQueryKeyFunction, diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/types.d.ts index d765a8545..10c381ed2 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/types.d.ts @@ -1,8 +1,8 @@ -import type { TanStackAngularQueryPlugin } from '../angular-query-experimental/types'; -import type { TanStackReactQueryPlugin } from '../react-query/types'; -import type { TanStackSolidQueryPlugin } from '../solid-query/types'; -import type { TanStackSvelteQueryPlugin } from '../svelte-query/types'; -import type { TanStackVueQueryPlugin } from '../vue-query/types'; +import type { TanStackAngularQueryPlugin } from '~/plugins/@tanstack/angular-query-experimental/types'; +import type { TanStackReactQueryPlugin } from '~/plugins/@tanstack/react-query/types'; +import type { TanStackSolidQueryPlugin } from '~/plugins/@tanstack/solid-query/types'; +import type { TanStackSvelteQueryPlugin } from '~/plugins/@tanstack/svelte-query/types'; +import type { TanStackVueQueryPlugin } from '~/plugins/@tanstack/vue-query/types'; export interface PluginHandler { (...args: Parameters): void; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts index 03c88edca..d9ee1d191 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/useQuery.ts @@ -1,10 +1,11 @@ -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; import { hasOperationSse, isOperationOptionsRequired, -} from '../../shared/utils/operation'; +} from '~/plugins/shared/utils/operation'; +import { tsc } from '~/tsc'; + import type { PluginInstance } from './types'; import { useTypeData } from './useType'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts b/packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts index 18e85cef0..573f9b704 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/query-core/useType.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import { getClientPlugin } from '../../@hey-api/client-core/utils'; -import { operationOptionsType } from '../../@hey-api/sdk/operation'; +import type { IR } from '~/ir/types'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import { operationOptionsType } from '~/plugins/@hey-api/sdk/operation'; + import type { PluginInstance } from './types'; export const useTypeData = ({ diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts index 1023a72a1..3d70e15b9 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts index 6e6f1b1bf..87135dd47 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/config.ts @@ -1,6 +1,7 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { handler } from '../query-core/plugin'; -import { handlerLegacy } from '../query-core/plugin-legacy'; +import { handler } from '~/plugins/@tanstack/query-core/plugin'; +import { handlerLegacy } from '~/plugins/@tanstack/query-core/plugin-legacy'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { TanStackReactQueryPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts index 4a0de3251..4ac7abd75 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/react-query/types.d.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import type { StringCase, StringName } from '../../../types/case'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { IR } from '~/ir/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@tanstack/react-query'> & diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts index b6f51efa1..ae14ba2b5 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts index a1e6915c3..d62a3c6bf 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/config.ts @@ -1,6 +1,7 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { handler } from '../query-core/plugin'; -import { handlerLegacy } from '../query-core/plugin-legacy'; +import { handler } from '~/plugins/@tanstack/query-core/plugin'; +import { handlerLegacy } from '~/plugins/@tanstack/query-core/plugin-legacy'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { TanStackSolidQueryPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts index 2758857b1..3f2bdbb40 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/solid-query/types.d.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import type { StringCase, StringName } from '../../../types/case'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { IR } from '~/ir/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@tanstack/solid-query'> & diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts index 50880f8d9..8be5ab3fa 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts index f4c400bae..dfa0b2f4f 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/config.ts @@ -1,6 +1,7 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { handler } from '../query-core/plugin'; -import { handlerLegacy } from '../query-core/plugin-legacy'; +import { handler } from '~/plugins/@tanstack/query-core/plugin'; +import { handlerLegacy } from '~/plugins/@tanstack/query-core/plugin-legacy'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { TanStackSvelteQueryPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts index 2ff589aec..c6442afb2 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/svelte-query/types.d.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import type { StringCase, StringName } from '../../../types/case'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { IR } from '~/ir/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@tanstack/svelte-query'> & diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts index 334f0efed..bb4cd391c 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = | 'AxiosError' diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts index c07182142..fbff14dea 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/config.ts @@ -1,6 +1,7 @@ -import { definePluginConfig } from '../../shared/utils/config'; -import { handler } from '../query-core/plugin'; -import { handlerLegacy } from '../query-core/plugin-legacy'; +import { handler } from '~/plugins/@tanstack/query-core/plugin'; +import { handlerLegacy } from '~/plugins/@tanstack/query-core/plugin-legacy'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import type { TanStackVueQueryPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts index 99562511e..1c546c59b 100644 --- a/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts +++ b/packages/openapi-ts/src/plugins/@tanstack/vue-query/types.d.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import type { StringCase, StringName } from '../../../types/case'; -import type { DefinePlugin, Plugin } from '../../types'; +import type { IR } from '~/ir/types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'@tanstack/vue-query'> & diff --git a/packages/openapi-ts/src/plugins/arktype/api.ts b/packages/openapi-ts/src/plugins/arktype/api.ts index 610106a3b..48d65b53d 100644 --- a/packages/openapi-ts/src/plugins/arktype/api.ts +++ b/packages/openapi-ts/src/plugins/arktype/api.ts @@ -1,7 +1,8 @@ import type { Selector } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { Plugin } from '../types'; +import type { Plugin } from '~/plugins/types'; + import type { ValidatorArgs } from './shared/types'; import { createRequestValidatorV2, createResponseValidatorV2 } from './v2/api'; diff --git a/packages/openapi-ts/src/plugins/arktype/config.ts b/packages/openapi-ts/src/plugins/arktype/config.ts index 60bde7267..36a2107d1 100644 --- a/packages/openapi-ts/src/plugins/arktype/config.ts +++ b/packages/openapi-ts/src/plugins/arktype/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig, mappers } from '../shared/utils/config'; +import { definePluginConfig, mappers } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import type { ArktypePlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/arktype/constants.ts b/packages/openapi-ts/src/plugins/arktype/constants.ts index 7744ee056..4663f2f05 100644 --- a/packages/openapi-ts/src/plugins/arktype/constants.ts +++ b/packages/openapi-ts/src/plugins/arktype/constants.ts @@ -1,4 +1,4 @@ -import { tsc } from '../../tsc'; +import { tsc } from '~/tsc'; export const identifiers = { keywords: { diff --git a/packages/openapi-ts/src/plugins/arktype/shared/export.ts b/packages/openapi-ts/src/plugins/arktype/shared/export.ts index c08731bd8..76349c01b 100644 --- a/packages/openapi-ts/src/plugins/arktype/shared/export.ts +++ b/packages/openapi-ts/src/plugins/arktype/shared/export.ts @@ -1,9 +1,10 @@ import type { Symbol } from '@hey-api/codegen-core'; import ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { tsc } from '../../../tsc'; -import { createSchemaComment } from '../../shared/utils/schema'; +import type { IR } from '~/ir/types'; +import { createSchemaComment } from '~/plugins/shared/utils/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../constants'; import type { ArktypePlugin } from '../types'; import type { Ast } from './types'; diff --git a/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts b/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts index 810a96dad..dfa46bcff 100644 --- a/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/arktype/shared/types.d.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import type { ToRefs } from '../../shared/types/refs'; +import type { IR } from '~/ir/types'; +import type { ToRefs } from '~/plugins/shared/types/refs'; + import type { ArktypePlugin } from '../types'; export type Ast = { diff --git a/packages/openapi-ts/src/plugins/arktype/types.d.ts b/packages/openapi-ts/src/plugins/arktype/types.d.ts index e7f940787..6f78cded3 100644 --- a/packages/openapi-ts/src/plugins/arktype/types.d.ts +++ b/packages/openapi-ts/src/plugins/arktype/types.d.ts @@ -1,5 +1,6 @@ -import type { StringCase, StringName } from '../../types/case'; -import type { DefinePlugin, Plugin } from '../types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'arktype'> & diff --git a/packages/openapi-ts/src/plugins/arktype/v2/api.ts b/packages/openapi-ts/src/plugins/arktype/v2/api.ts index 9dfeb7bcb..5a679ad3c 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/api.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/api.ts @@ -1,6 +1,7 @@ import type ts from 'typescript'; -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; + // import { identifiers } from '../constants'; import type { ValidatorArgs } from '../shared/types'; diff --git a/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts b/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts index 74707ba1f..d1faa5fac 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/plugin.ts @@ -1,11 +1,12 @@ -import { deduplicateSchema } from '../../../ir/schema'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { refToName } from '../../../utils/ref'; -import type { SchemaWithType } from '../../shared/types/schema'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; -import { toRefs } from '../../shared/utils/refs'; +import { deduplicateSchema } from '~/ir/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; +import { toRefs } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { refToName } from '~/utils/ref'; + import { exportAst } from '../shared/export'; import type { Ast, IrSchemaToAstOptions } from '../shared/types'; import type { ArktypePlugin } from '../types'; diff --git a/packages/openapi-ts/src/plugins/arktype/v2/toAst/index.ts b/packages/openapi-ts/src/plugins/arktype/v2/toAst/index.ts index 9574825f6..7d977d64c 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/toAst/index.ts @@ -1,6 +1,7 @@ import ts from 'typescript'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; + import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { nullToAst } from './null'; import { objectToAst } from './object'; diff --git a/packages/openapi-ts/src/plugins/arktype/v2/toAst/null.ts b/packages/openapi-ts/src/plugins/arktype/v2/toAst/null.ts index ba1ce6731..26c6cdf89 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/toAst/null.ts @@ -1,4 +1,5 @@ -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts b/packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts index b536081df..3e974f785 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/toAst/object.ts @@ -1,9 +1,10 @@ import ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import { numberRegExp } from '../../../../utils/regexp'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { numberRegExp } from '~/utils/regexp'; + // import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/arktype/v2/toAst/string.ts b/packages/openapi-ts/src/plugins/arktype/v2/toAst/string.ts index 9395de267..8c498d0d8 100644 --- a/packages/openapi-ts/src/plugins/arktype/v2/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/arktype/v2/toAst/string.ts @@ -1,4 +1,5 @@ -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/config.ts b/packages/openapi-ts/src/plugins/config.ts index 46002cb6e..e72265ae7 100644 --- a/packages/openapi-ts/src/plugins/config.ts +++ b/packages/openapi-ts/src/plugins/config.ts @@ -1,56 +1,56 @@ -import type { AngularCommonPlugin } from './@angular/common'; -import { defaultConfig as angularCommon } from './@angular/common'; -import type { HeyApiClientAngularPlugin } from './@hey-api/client-angular'; -import { defaultConfig as heyApiClientAngular } from './@hey-api/client-angular'; -import type { HeyApiClientAxiosPlugin } from './@hey-api/client-axios'; -import { defaultConfig as heyApiClientAxios } from './@hey-api/client-axios'; -import type { HeyApiClientFetchPlugin } from './@hey-api/client-fetch'; -import { defaultConfig as heyApiClientFetch } from './@hey-api/client-fetch'; -import type { HeyApiClientNextPlugin } from './@hey-api/client-next'; -import { defaultConfig as heyApiClientNext } from './@hey-api/client-next'; -import type { HeyApiClientNuxtPlugin } from './@hey-api/client-nuxt'; -import { defaultConfig as heyApiClientNuxt } from './@hey-api/client-nuxt'; -import type { HeyApiClientOfetchPlugin } from './@hey-api/client-ofetch'; -import { defaultConfig as heyApiClientOfetch } from './@hey-api/client-ofetch'; -import type { HeyApiClientLegacyAngularPlugin } from './@hey-api/legacy-angular'; -import { defaultConfig as heyApiLegacyAngular } from './@hey-api/legacy-angular'; -import type { HeyApiClientLegacyAxiosPlugin } from './@hey-api/legacy-axios'; -import { defaultConfig as heyApiLegacyAxios } from './@hey-api/legacy-axios'; -import type { HeyApiClientLegacyFetchPlugin } from './@hey-api/legacy-fetch'; -import { defaultConfig as heyApiLegacyFetch } from './@hey-api/legacy-fetch'; -import type { HeyApiClientLegacyNodePlugin } from './@hey-api/legacy-node'; -import { defaultConfig as heyApiLegacyNode } from './@hey-api/legacy-node'; -import type { HeyApiClientLegacyXhrPlugin } from './@hey-api/legacy-xhr'; -import { defaultConfig as heyApiLegacyXhr } from './@hey-api/legacy-xhr'; -import type { HeyApiSchemasPlugin } from './@hey-api/schemas'; -import { defaultConfig as heyApiSchemas } from './@hey-api/schemas'; -import type { HeyApiSdkPlugin } from './@hey-api/sdk'; -import { defaultConfig as heyApiSdk } from './@hey-api/sdk'; -import type { HeyApiTransformersPlugin } from './@hey-api/transformers'; -import { defaultConfig as heyApiTransformers } from './@hey-api/transformers'; -import type { HeyApiTypeScriptPlugin } from './@hey-api/typescript'; -import { defaultConfig as heyApiTypeScript } from './@hey-api/typescript'; -import type { PiniaColadaPlugin } from './@pinia/colada'; -import { defaultConfig as piniaColada } from './@pinia/colada'; -import type { TanStackAngularQueryPlugin } from './@tanstack/angular-query-experimental'; -import { defaultConfig as tanStackAngularQuery } from './@tanstack/angular-query-experimental'; -import type { TanStackReactQueryPlugin } from './@tanstack/react-query'; -import { defaultConfig as tanStackReactQuery } from './@tanstack/react-query'; -import type { TanStackSolidQueryPlugin } from './@tanstack/solid-query'; -import { defaultConfig as tanStackSolidQuery } from './@tanstack/solid-query'; -import type { TanStackSvelteQueryPlugin } from './@tanstack/svelte-query'; -import { defaultConfig as tanStackSvelteQuery } from './@tanstack/svelte-query'; -import type { TanStackVueQueryPlugin } from './@tanstack/vue-query'; -import { defaultConfig as tanStackVueQuery } from './@tanstack/vue-query'; -import type { ArktypePlugin } from './arktype'; -import { defaultConfig as arktype } from './arktype'; -import type { FastifyPlugin } from './fastify'; -import { defaultConfig as fastify } from './fastify'; -import type { Plugin, PluginNames } from './types'; -import type { ValibotPlugin } from './valibot'; -import { defaultConfig as valibot } from './valibot'; -import type { ZodPlugin } from './zod'; -import { defaultConfig as zod } from './zod'; +import type { AngularCommonPlugin } from '~/plugins/@angular/common'; +import { defaultConfig as angularCommon } from '~/plugins/@angular/common'; +import type { HeyApiClientAngularPlugin } from '~/plugins/@hey-api/client-angular'; +import { defaultConfig as heyApiClientAngular } from '~/plugins/@hey-api/client-angular'; +import type { HeyApiClientAxiosPlugin } from '~/plugins/@hey-api/client-axios'; +import { defaultConfig as heyApiClientAxios } from '~/plugins/@hey-api/client-axios'; +import type { HeyApiClientFetchPlugin } from '~/plugins/@hey-api/client-fetch'; +import { defaultConfig as heyApiClientFetch } from '~/plugins/@hey-api/client-fetch'; +import type { HeyApiClientNextPlugin } from '~/plugins/@hey-api/client-next'; +import { defaultConfig as heyApiClientNext } from '~/plugins/@hey-api/client-next'; +import type { HeyApiClientNuxtPlugin } from '~/plugins/@hey-api/client-nuxt'; +import { defaultConfig as heyApiClientNuxt } from '~/plugins/@hey-api/client-nuxt'; +import type { HeyApiClientOfetchPlugin } from '~/plugins/@hey-api/client-ofetch'; +import { defaultConfig as heyApiClientOfetch } from '~/plugins/@hey-api/client-ofetch'; +import type { HeyApiClientLegacyAngularPlugin } from '~/plugins/@hey-api/legacy-angular'; +import { defaultConfig as heyApiLegacyAngular } from '~/plugins/@hey-api/legacy-angular'; +import type { HeyApiClientLegacyAxiosPlugin } from '~/plugins/@hey-api/legacy-axios'; +import { defaultConfig as heyApiLegacyAxios } from '~/plugins/@hey-api/legacy-axios'; +import type { HeyApiClientLegacyFetchPlugin } from '~/plugins/@hey-api/legacy-fetch'; +import { defaultConfig as heyApiLegacyFetch } from '~/plugins/@hey-api/legacy-fetch'; +import type { HeyApiClientLegacyNodePlugin } from '~/plugins/@hey-api/legacy-node'; +import { defaultConfig as heyApiLegacyNode } from '~/plugins/@hey-api/legacy-node'; +import type { HeyApiClientLegacyXhrPlugin } from '~/plugins/@hey-api/legacy-xhr'; +import { defaultConfig as heyApiLegacyXhr } from '~/plugins/@hey-api/legacy-xhr'; +import type { HeyApiSchemasPlugin } from '~/plugins/@hey-api/schemas'; +import { defaultConfig as heyApiSchemas } from '~/plugins/@hey-api/schemas'; +import type { HeyApiSdkPlugin } from '~/plugins/@hey-api/sdk'; +import { defaultConfig as heyApiSdk } from '~/plugins/@hey-api/sdk'; +import type { HeyApiTransformersPlugin } from '~/plugins/@hey-api/transformers'; +import { defaultConfig as heyApiTransformers } from '~/plugins/@hey-api/transformers'; +import type { HeyApiTypeScriptPlugin } from '~/plugins/@hey-api/typescript'; +import { defaultConfig as heyApiTypeScript } from '~/plugins/@hey-api/typescript'; +import type { PiniaColadaPlugin } from '~/plugins/@pinia/colada'; +import { defaultConfig as piniaColada } from '~/plugins/@pinia/colada'; +import type { TanStackAngularQueryPlugin } from '~/plugins/@tanstack/angular-query-experimental'; +import { defaultConfig as tanStackAngularQuery } from '~/plugins/@tanstack/angular-query-experimental'; +import type { TanStackReactQueryPlugin } from '~/plugins/@tanstack/react-query'; +import { defaultConfig as tanStackReactQuery } from '~/plugins/@tanstack/react-query'; +import type { TanStackSolidQueryPlugin } from '~/plugins/@tanstack/solid-query'; +import { defaultConfig as tanStackSolidQuery } from '~/plugins/@tanstack/solid-query'; +import type { TanStackSvelteQueryPlugin } from '~/plugins/@tanstack/svelte-query'; +import { defaultConfig as tanStackSvelteQuery } from '~/plugins/@tanstack/svelte-query'; +import type { TanStackVueQueryPlugin } from '~/plugins/@tanstack/vue-query'; +import { defaultConfig as tanStackVueQuery } from '~/plugins/@tanstack/vue-query'; +import type { ArktypePlugin } from '~/plugins/arktype'; +import { defaultConfig as arktype } from '~/plugins/arktype'; +import type { FastifyPlugin } from '~/plugins/fastify'; +import { defaultConfig as fastify } from '~/plugins/fastify'; +import type { Plugin, PluginNames } from '~/plugins/types'; +import type { ValibotPlugin } from '~/plugins/valibot'; +import { defaultConfig as valibot } from '~/plugins/valibot'; +import type { ZodPlugin } from '~/plugins/zod'; +import { defaultConfig as zod } from '~/plugins/zod'; export interface PluginConfigMap { '@angular/common': AngularCommonPlugin['Types']; diff --git a/packages/openapi-ts/src/plugins/fastify/api.ts b/packages/openapi-ts/src/plugins/fastify/api.ts index eb1e5f9c1..98130c3db 100644 --- a/packages/openapi-ts/src/plugins/fastify/api.ts +++ b/packages/openapi-ts/src/plugins/fastify/api.ts @@ -1,6 +1,6 @@ import type { Selector } from '@hey-api/codegen-core'; -import type { Plugin } from '../types'; +import type { Plugin } from '~/plugins/types'; type SelectorType = 'RouteHandler'; diff --git a/packages/openapi-ts/src/plugins/fastify/config.ts b/packages/openapi-ts/src/plugins/fastify/config.ts index 6db188294..b094d056a 100644 --- a/packages/openapi-ts/src/plugins/fastify/config.ts +++ b/packages/openapi-ts/src/plugins/fastify/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import type { FastifyPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/fastify/plugin.ts b/packages/openapi-ts/src/plugins/fastify/plugin.ts index 617693239..1f1ec72a1 100644 --- a/packages/openapi-ts/src/plugins/fastify/plugin.ts +++ b/packages/openapi-ts/src/plugins/fastify/plugin.ts @@ -1,9 +1,10 @@ import type ts from 'typescript'; -import { operationResponsesMap } from '../../ir/operation'; -import { hasParameterGroupObjectRequired } from '../../ir/parameter'; -import type { IR } from '../../ir/types'; -import { type Property, tsc } from '../../tsc'; +import { operationResponsesMap } from '~/ir/operation'; +import { hasParameterGroupObjectRequired } from '~/ir/parameter'; +import type { IR } from '~/ir/types'; +import { type Property, tsc } from '~/tsc'; + import type { FastifyPlugin } from './types'; const operationToRouteHandler = ({ diff --git a/packages/openapi-ts/src/plugins/fastify/types.d.ts b/packages/openapi-ts/src/plugins/fastify/types.d.ts index 541c5c848..2f409a6ca 100644 --- a/packages/openapi-ts/src/plugins/fastify/types.d.ts +++ b/packages/openapi-ts/src/plugins/fastify/types.d.ts @@ -1,4 +1,5 @@ -import type { DefinePlugin, Plugin } from '../types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'fastify'> & diff --git a/packages/openapi-ts/src/plugins/shared/types/instance.d.ts b/packages/openapi-ts/src/plugins/shared/types/instance.d.ts index c8e770f3f..38047f139 100644 --- a/packages/openapi-ts/src/plugins/shared/types/instance.d.ts +++ b/packages/openapi-ts/src/plugins/shared/types/instance.d.ts @@ -1,5 +1,5 @@ -import type { IrTopLevelKind } from '../../../ir/graph'; -import type { IR } from '../../../ir/types'; +import type { IrTopLevelKind } from '~/ir/graph'; +import type { IR } from '~/ir/types'; type WalkEvents = | { diff --git a/packages/openapi-ts/src/plugins/shared/types/schema.d.ts b/packages/openapi-ts/src/plugins/shared/types/schema.d.ts index 712368428..fcef09883 100644 --- a/packages/openapi-ts/src/plugins/shared/types/schema.d.ts +++ b/packages/openapi-ts/src/plugins/shared/types/schema.d.ts @@ -1,4 +1,4 @@ -import type { IR } from '../../../ir/types'; +import type { IR } from '~/ir/types'; export interface SchemaWithType< T extends diff --git a/packages/openapi-ts/src/plugins/shared/utils/case.ts b/packages/openapi-ts/src/plugins/shared/utils/case.ts index 7bdd24404..d3253d28c 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/case.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/case.ts @@ -1,8 +1,8 @@ import ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { numberRegExp } from '../../../utils/regexp'; -import { stringCase } from '../../../utils/stringCase'; +import type { IR } from '~/ir/types'; +import { numberRegExp } from '~/utils/regexp'; +import { stringCase } from '~/utils/stringCase'; /** * Returns final field name for object properties. This might differ from the diff --git a/packages/openapi-ts/src/plugins/shared/utils/config.ts b/packages/openapi-ts/src/plugins/shared/utils/config.ts index 215095712..44f085eb7 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/config.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/config.ts @@ -1,4 +1,4 @@ -import type { Plugin } from '../../types'; +import type { Plugin } from '~/plugins/types'; export const definePluginConfig = (defaultConfig: Plugin.Config) => diff --git a/packages/openapi-ts/src/plugins/shared/utils/instance.ts b/packages/openapi-ts/src/plugins/shared/utils/instance.ts index 619c76f47..16f25ae63 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/instance.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/instance.ts @@ -7,18 +7,19 @@ import type { SymbolIn, } from '@hey-api/codegen-core'; -import { HeyApiError } from '../../../error'; -import type { IrTopLevelKind } from '../../../ir/graph'; +import { HeyApiError } from '~/error'; +import type { IrTopLevelKind } from '~/ir/graph'; import { irTopLevelKinds, matchIrTopLevelPointer, walkTopological, -} from '../../../ir/graph'; -import type { IR } from '../../../ir/types'; -import type { OpenApi } from '../../../openApi/types'; -import { jsonPointerToPath } from '../../../utils/ref'; -import type { PluginConfigMap } from '../../config'; -import type { Plugin } from '../../types'; +} from '~/ir/graph'; +import type { IR } from '~/ir/types'; +import type { OpenApi } from '~/openApi/types'; +import type { PluginConfigMap } from '~/plugins/config'; +import type { Plugin } from '~/plugins/types'; +import { jsonPointerToPath } from '~/utils/ref'; + import type { WalkEvent, WalkOptions } from '../types/instance'; const defaultGetFilePath = (symbol: Symbol): string | undefined => { diff --git a/packages/openapi-ts/src/plugins/shared/utils/operation.ts b/packages/openapi-ts/src/plugins/shared/utils/operation.ts index ab6e145e5..e5b66b0c1 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/operation.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/operation.ts @@ -1,6 +1,6 @@ -import { hasOperationDataRequired } from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { getClientPlugin } from '../../@hey-api/client-core/utils'; +import { hasOperationDataRequired } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; export const isOperationOptionsRequired = ({ context, diff --git a/packages/openapi-ts/src/plugins/shared/utils/schema.ts b/packages/openapi-ts/src/plugins/shared/utils/schema.ts index 5902fd550..93e814d04 100644 --- a/packages/openapi-ts/src/plugins/shared/utils/schema.ts +++ b/packages/openapi-ts/src/plugins/shared/utils/schema.ts @@ -1,6 +1,6 @@ -import type { IR } from '../../../ir/types'; -import type { Comments } from '../../../tsc'; -import { escapeComment } from '../../../utils/escape'; +import type { IR } from '~/ir/types'; +import type { Comments } from '~/tsc'; +import { escapeComment } from '~/utils/escape'; export const createSchemaComment = ({ schema, diff --git a/packages/openapi-ts/src/plugins/types.d.ts b/packages/openapi-ts/src/plugins/types.d.ts index 5d3172ab5..a0876813b 100644 --- a/packages/openapi-ts/src/plugins/types.d.ts +++ b/packages/openapi-ts/src/plugins/types.d.ts @@ -1,10 +1,10 @@ -import type { ValueToObject } from '../config/utils/config'; -import type { Package } from '../config/utils/package'; -import type { IR } from '../ir/types'; -import type { OpenApi as LegacyOpenApi } from '../openApi'; -import type { Client as LegacyClient } from '../types/client'; -import type { Files } from '../types/utils'; -import type { PluginInstance } from './shared/utils/instance'; +import type { ValueToObject } from '~/config/utils/config'; +import type { Package } from '~/config/utils/package'; +import type { IR } from '~/ir/types'; +import type { OpenApi as LegacyOpenApi } from '~/openApi'; +import type { PluginInstance } from '~/plugins/shared/utils/instance'; +import type { Client as LegacyClient } from '~/types/client'; +import type { Files } from '~/types/utils'; export type PluginClientNames = | '@hey-api/client-angular' diff --git a/packages/openapi-ts/src/plugins/valibot/api.ts b/packages/openapi-ts/src/plugins/valibot/api.ts index f59ae2b24..4eb3bf2ce 100644 --- a/packages/openapi-ts/src/plugins/valibot/api.ts +++ b/packages/openapi-ts/src/plugins/valibot/api.ts @@ -1,7 +1,8 @@ import type { Selector } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { Plugin } from '../types'; +import type { Plugin } from '~/plugins/types'; + import type { ValidatorArgs } from './shared/types'; import { createRequestValidatorV1, createResponseValidatorV1 } from './v1/api'; diff --git a/packages/openapi-ts/src/plugins/valibot/config.ts b/packages/openapi-ts/src/plugins/valibot/config.ts index a6f4d85f6..96af788c3 100644 --- a/packages/openapi-ts/src/plugins/valibot/config.ts +++ b/packages/openapi-ts/src/plugins/valibot/config.ts @@ -1,4 +1,5 @@ -import { definePluginConfig } from '../shared/utils/config'; +import { definePluginConfig } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import type { ValibotPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/valibot/shared/numbers.ts b/packages/openapi-ts/src/plugins/valibot/shared/numbers.ts index 2606f1ada..18105e917 100644 --- a/packages/openapi-ts/src/plugins/valibot/shared/numbers.ts +++ b/packages/openapi-ts/src/plugins/valibot/shared/numbers.ts @@ -1,4 +1,4 @@ -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; export const INTEGER_FORMATS = { int16: { diff --git a/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts b/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts index 0c4bfeb31..bac6dfec1 100644 --- a/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/valibot/shared/types.d.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import type { StringCase, StringName } from '../../../types/case'; -import type { ToRefs } from '../../shared/types/refs'; +import type { IR } from '~/ir/types'; +import type { ToRefs } from '~/plugins/shared/types/refs'; +import type { StringCase, StringName } from '~/types/case'; + import type { ValibotPlugin } from '../types'; export type IrSchemaToAstOptions = { diff --git a/packages/openapi-ts/src/plugins/valibot/types.d.ts b/packages/openapi-ts/src/plugins/valibot/types.d.ts index 2d560d4ea..c6e5a80be 100644 --- a/packages/openapi-ts/src/plugins/valibot/types.d.ts +++ b/packages/openapi-ts/src/plugins/valibot/types.d.ts @@ -1,5 +1,6 @@ -import type { StringCase, StringName } from '../../types/case'; -import type { DefinePlugin, Plugin } from '../types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'valibot'> & diff --git a/packages/openapi-ts/src/plugins/valibot/v1/api.ts b/packages/openapi-ts/src/plugins/valibot/v1/api.ts index 790cfbc0b..f0f40109f 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/api.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/api.ts @@ -1,6 +1,7 @@ import type ts from 'typescript'; -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; + import type { ValidatorArgs } from '../shared/types'; import { identifiers } from './constants'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/constants.ts b/packages/openapi-ts/src/plugins/valibot/v1/constants.ts index b3a085d68..e49e120a4 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/constants.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/constants.ts @@ -1,4 +1,4 @@ -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; export const identifiers = { /** diff --git a/packages/openapi-ts/src/plugins/valibot/v1/operation.ts b/packages/openapi-ts/src/plugins/valibot/v1/operation.ts index 6e2ddea5b..a4c1ce784 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/operation.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/operation.ts @@ -1,8 +1,9 @@ -import { operationResponsesMap } from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; -import { toRef } from '../../shared/utils/refs'; +import { operationResponsesMap } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; +import { toRef } from '~/plugins/shared/utils/refs'; + import type { IrSchemaToAstOptions } from '../shared/types'; import { irSchemaToAst } from './plugin'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/pipesToAst.ts b/packages/openapi-ts/src/plugins/valibot/v1/pipesToAst.ts index 053e8df07..bca4920f7 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/pipesToAst.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/pipesToAst.ts @@ -1,6 +1,7 @@ import type ts from 'typescript'; -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; + import type { ValibotPlugin } from '../types'; import { identifiers } from './constants'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts b/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts index 788af9e91..c3e5ea5ac 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/plugin.ts @@ -1,15 +1,16 @@ import type { Symbol } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import { deduplicateSchema } from '../../../ir/schema'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { refToName } from '../../../utils/ref'; -import type { SchemaWithType } from '../../shared/types/schema'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; -import { toRef, toRefs } from '../../shared/utils/refs'; -import { createSchemaComment } from '../../shared/utils/schema'; +import { deduplicateSchema } from '~/ir/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; +import { toRef, toRefs } from '~/plugins/shared/utils/refs'; +import { createSchemaComment } from '~/plugins/shared/utils/schema'; +import { tsc } from '~/tsc'; +import { refToName } from '~/utils/ref'; + import { numberParameter } from '../shared/numbers'; import type { IrSchemaToAstOptions, PluginState } from '../shared/types'; import type { ValibotPlugin } from '../types'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts index 9bd2fb206..981863a26 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/array.ts @@ -1,9 +1,10 @@ import type ts from 'typescript'; -import { deduplicateSchema } from '../../../../ir/schema'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import { deduplicateSchema } from '~/ir/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; import { pipesToAst } from '../pipesToAst'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts index 149f11be9..d38f3b99e 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/boolean.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts index dd139d990..233a0762e 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/enum.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; import { unknownToAst } from './unknown'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts index 4750ebcc6..c05801d8b 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/index.ts @@ -1,6 +1,7 @@ import type ts from 'typescript'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; import { booleanToAst } from './boolean'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts index 06613a637..a58bafb33 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/never.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts index 281f3e9ae..952f604c5 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/null.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts index e6f0c66e6..c0898efd3 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/number.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { INTEGER_FORMATS, isIntegerFormat, diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts index b85bec76a..423ee7881 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/object.ts @@ -1,9 +1,10 @@ import ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import { numberRegExp } from '../../../../utils/regexp'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { numberRegExp } from '~/utils/regexp'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; import { pipesToAst } from '../pipesToAst'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts index e54c6808c..7a77c9c1b 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/string.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; import { pipesToAst } from '../pipesToAst'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts index 776103b48..d100c5bdc 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/tuple.ts @@ -1,6 +1,7 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; import { pipesToAst } from '../pipesToAst'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts index d4c1167e5..3cc866bf5 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/undefined.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts index 705515414..9df535c73 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/unknown.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts b/packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts index b92cad06a..55c11dbdb 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/toAst/void.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import type { IrSchemaToAstOptions } from '../../shared/types'; import { identifiers } from '../constants'; diff --git a/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts b/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts index e4f4c3042..398398e23 100644 --- a/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts +++ b/packages/openapi-ts/src/plugins/valibot/v1/webhook.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; + import type { IrSchemaToAstOptions } from '../shared/types'; import { irSchemaToAst } from './plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/api.ts b/packages/openapi-ts/src/plugins/zod/api.ts index 1fe8d147e..95b8aa298 100644 --- a/packages/openapi-ts/src/plugins/zod/api.ts +++ b/packages/openapi-ts/src/plugins/zod/api.ts @@ -1,7 +1,8 @@ import type { Selector } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { Plugin } from '../types'; +import type { Plugin } from '~/plugins/types'; + import { createRequestValidatorMini, createResponseValidatorMini, diff --git a/packages/openapi-ts/src/plugins/zod/config.ts b/packages/openapi-ts/src/plugins/zod/config.ts index a025ed339..bf2680141 100644 --- a/packages/openapi-ts/src/plugins/zod/config.ts +++ b/packages/openapi-ts/src/plugins/zod/config.ts @@ -1,6 +1,7 @@ import colors from 'ansi-colors'; -import { definePluginConfig, mappers } from '../shared/utils/config'; +import { definePluginConfig, mappers } from '~/plugins/shared/utils/config'; + import { Api } from './api'; import { handler } from './plugin'; import type { ZodPlugin } from './types'; diff --git a/packages/openapi-ts/src/plugins/zod/constants.ts b/packages/openapi-ts/src/plugins/zod/constants.ts index d0df73c8d..fe79a3555 100644 --- a/packages/openapi-ts/src/plugins/zod/constants.ts +++ b/packages/openapi-ts/src/plugins/zod/constants.ts @@ -1,4 +1,4 @@ -import { tsc } from '../../tsc'; +import { tsc } from '~/tsc'; // TODO: this is inaccurate, it combines identifiers for all supported versions export const identifiers = { diff --git a/packages/openapi-ts/src/plugins/zod/mini/api.ts b/packages/openapi-ts/src/plugins/zod/mini/api.ts index f360d67ed..0b560fbb3 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/api.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/api.ts @@ -1,6 +1,7 @@ import type ts from 'typescript'; -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; + import { identifiers } from '../constants'; import type { ValidatorArgs } from '../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/plugin.ts b/packages/openapi-ts/src/plugins/zod/mini/plugin.ts index ae881579d..6583b6d3c 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/plugin.ts @@ -1,11 +1,12 @@ -import { deduplicateSchema } from '../../../ir/schema'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { refToName } from '../../../utils/ref'; -import type { SchemaWithType } from '../../shared/types/schema'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; -import { toRef, toRefs } from '../../shared/utils/refs'; +import { deduplicateSchema } from '~/ir/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; +import { toRef, toRefs } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { refToName } from '~/utils/ref'; + import { identifiers } from '../constants'; import { exportAst } from '../shared/export'; import { getZodModule } from '../shared/module'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts index 3b77176ce..49374643f 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/array.ts @@ -1,9 +1,10 @@ import type ts from 'typescript'; -import { deduplicateSchema } from '../../../../ir/schema'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import { deduplicateSchema } from '~/ir/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts index 657848a07..f555df28c 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/boolean.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts index 2b43769ba..97baffe9f 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/enum.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { unknownToAst } from './unknown'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts index 62c481bfd..b7400b68a 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/index.ts @@ -1,4 +1,5 @@ -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; + import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; import { booleanToAst } from './boolean'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts index 57e20c23a..a7dcc91f1 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/never.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts index b3ff566dd..082534607 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/null.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts index e04617c61..53919affd 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/number.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import { numberParameter } from '../../shared/numbers'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts index 9d066adb7..46c8a14cd 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/object.ts @@ -1,9 +1,10 @@ import ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import { numberRegExp } from '../../../../utils/regexp'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { numberRegExp } from '~/utils/regexp'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts index 4a4d98ce5..0cad6e696 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/string.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts index 0ea4ac4c8..068597dd3 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/tuple.ts @@ -1,8 +1,9 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts index 13cddcfa1..bf6640610 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/undefined.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts index 2ada823cb..73d1909cd 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/unknown.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts b/packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts index b15a42845..c26bf8c33 100644 --- a/packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts +++ b/packages/openapi-ts/src/plugins/zod/mini/toAst/void.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/shared/export.ts b/packages/openapi-ts/src/plugins/zod/shared/export.ts index 9fa2762eb..f2a5732ef 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/export.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/export.ts @@ -1,9 +1,10 @@ import type { Symbol } from '@hey-api/codegen-core'; import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import { tsc } from '../../../tsc'; -import { createSchemaComment } from '../../shared/utils/schema'; +import type { IR } from '~/ir/types'; +import { createSchemaComment } from '~/plugins/shared/utils/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../constants'; import type { ZodPlugin } from '../types'; import type { Ast } from './types'; diff --git a/packages/openapi-ts/src/plugins/zod/shared/numbers.ts b/packages/openapi-ts/src/plugins/zod/shared/numbers.ts index 63e44916d..2da75b3bc 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/numbers.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/numbers.ts @@ -1,6 +1,6 @@ import type ts from 'typescript'; -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; export const numberParameter = ({ isBigInt, diff --git a/packages/openapi-ts/src/plugins/zod/shared/operation.ts b/packages/openapi-ts/src/plugins/zod/shared/operation.ts index 2d5187f42..04bcfd747 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/operation.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/operation.ts @@ -1,7 +1,8 @@ -import { operationResponsesMap } from '../../../ir/operation'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; +import { operationResponsesMap } from '~/ir/operation'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; + import { exportAst } from './export'; import type { Ast, IrSchemaToAstOptions } from './types'; diff --git a/packages/openapi-ts/src/plugins/zod/shared/types.d.ts b/packages/openapi-ts/src/plugins/zod/shared/types.d.ts index 197cea2d5..90fcf86f1 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/types.d.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/types.d.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import type { IR } from '../../../ir/types'; -import type { ToRefs } from '../../shared/types/refs'; +import type { IR } from '~/ir/types'; +import type { ToRefs } from '~/plugins/shared/types/refs'; + import type { ZodPlugin } from '../types'; export type Ast = { diff --git a/packages/openapi-ts/src/plugins/zod/shared/webhook.ts b/packages/openapi-ts/src/plugins/zod/shared/webhook.ts index 74926f894..62ab05468 100644 --- a/packages/openapi-ts/src/plugins/zod/shared/webhook.ts +++ b/packages/openapi-ts/src/plugins/zod/shared/webhook.ts @@ -1,6 +1,7 @@ -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; + import { exportAst } from './export'; import type { Ast, IrSchemaToAstOptions } from './types'; diff --git a/packages/openapi-ts/src/plugins/zod/types.d.ts b/packages/openapi-ts/src/plugins/zod/types.d.ts index ab95797aa..6d82aff4e 100644 --- a/packages/openapi-ts/src/plugins/zod/types.d.ts +++ b/packages/openapi-ts/src/plugins/zod/types.d.ts @@ -1,5 +1,6 @@ -import type { StringCase, StringName } from '../../types/case'; -import type { DefinePlugin, Plugin } from '../types'; +import type { DefinePlugin, Plugin } from '~/plugins/types'; +import type { StringCase, StringName } from '~/types/case'; + import type { IApi } from './api'; export type UserConfig = Plugin.Name<'zod'> & diff --git a/packages/openapi-ts/src/plugins/zod/v3/api.ts b/packages/openapi-ts/src/plugins/zod/v3/api.ts index 3328950cd..e6b089f93 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/api.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/api.ts @@ -1,6 +1,7 @@ import type ts from 'typescript'; -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; + import { identifiers } from '../constants'; import type { ValidatorArgs } from '../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/plugin.ts b/packages/openapi-ts/src/plugins/zod/v3/plugin.ts index bcdbb22eb..a625aa8ba 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/plugin.ts @@ -1,11 +1,12 @@ -import { deduplicateSchema } from '../../../ir/schema'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { refToName } from '../../../utils/ref'; -import type { SchemaWithType } from '../../shared/types/schema'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; -import { toRef, toRefs } from '../../shared/utils/refs'; +import { deduplicateSchema } from '~/ir/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; +import { toRef, toRefs } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { refToName } from '~/utils/ref'; + import { identifiers } from '../constants'; import { exportAst } from '../shared/export'; import { getZodModule } from '../shared/module'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts index 9f3c1f897..895d83465 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/array.ts @@ -1,9 +1,10 @@ import type ts from 'typescript'; -import { deduplicateSchema } from '../../../../ir/schema'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import { deduplicateSchema } from '~/ir/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts index 7562823d5..b818fcd46 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/boolean.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts index d735f09fb..282274e5c 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/enum.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { IrSchemaToAstOptions } from '../../shared/types'; import { unknownToAst } from './unknown'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts index 50790d8c7..41c535f9f 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/index.ts @@ -1,4 +1,5 @@ -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; + import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; import { booleanToAst } from './boolean'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts index 3dbddf974..6f31ae90d 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/never.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts index fdb2a5875..5247a6663 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/null.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts index 8754becc9..3d39bb940 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/number.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import { numberParameter } from '../../shared/numbers'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts index 748f4c33a..24721e70a 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/object.ts @@ -1,9 +1,10 @@ import ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import { numberRegExp } from '../../../../utils/regexp'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { numberRegExp } from '~/utils/regexp'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts index 1512b1ed2..b45ae09fe 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/string.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts index 1bbcc1b54..ec6e8f0db 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/tuple.ts @@ -1,8 +1,9 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts index f6d75fa79..381cd89c0 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/undefined.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts index 4aa9a4274..5a534a02c 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/unknown.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts b/packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts index fe0cb9e51..28abe5dc1 100644 --- a/packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts +++ b/packages/openapi-ts/src/plugins/zod/v3/toAst/void.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/api.ts b/packages/openapi-ts/src/plugins/zod/v4/api.ts index 9de07623f..01663c8e0 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/api.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/api.ts @@ -1,6 +1,7 @@ import type ts from 'typescript'; -import { tsc } from '../../../tsc'; +import { tsc } from '~/tsc'; + import { identifiers } from '../constants'; import type { ValidatorArgs } from '../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/plugin.ts b/packages/openapi-ts/src/plugins/zod/v4/plugin.ts index ccb222667..fcb072a6a 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/plugin.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/plugin.ts @@ -1,11 +1,12 @@ -import { deduplicateSchema } from '../../../ir/schema'; -import type { IR } from '../../../ir/types'; -import { buildName } from '../../../openApi/shared/utils/name'; -import { tsc } from '../../../tsc'; -import { refToName } from '../../../utils/ref'; -import type { SchemaWithType } from '../../shared/types/schema'; -import { pathToSymbolResourceType } from '../../shared/utils/meta'; -import { toRef, toRefs } from '../../shared/utils/refs'; +import { deduplicateSchema } from '~/ir/schema'; +import type { IR } from '~/ir/types'; +import { buildName } from '~/openApi/shared/utils/name'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { pathToSymbolResourceType } from '~/plugins/shared/utils/meta'; +import { toRef, toRefs } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { refToName } from '~/utils/ref'; + import { identifiers } from '../constants'; import { exportAst } from '../shared/export'; import { getZodModule } from '../shared/module'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts index 0b3848214..0d78f2635 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/array.ts @@ -1,9 +1,10 @@ import type ts from 'typescript'; -import { deduplicateSchema } from '../../../../ir/schema'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import { deduplicateSchema } from '~/ir/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts index ad4b0fbae..c6a23106c 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/boolean.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts index e02d09ea7..6882759a6 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/enum.ts @@ -1,7 +1,8 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { unknownToAst } from './unknown'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts index 62c481bfd..b7400b68a 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/index.ts @@ -1,4 +1,5 @@ -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; + import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { arrayToAst } from './array'; import { booleanToAst } from './boolean'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts index a47363240..9a6239563 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/never.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts index 725bfa73b..ec4ca5e22 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/null.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts index 0a5cc1364..800b55cbd 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/number.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import { numberParameter } from '../../shared/numbers'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts index 021840ea3..607f0ea3e 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/object.ts @@ -1,9 +1,10 @@ import ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import { numberRegExp } from '../../../../utils/regexp'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; +import { numberRegExp } from '~/utils/regexp'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts index e6a2c71ab..559d33354 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/string.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts index f4c35f9a5..f875ed7b9 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/tuple.ts @@ -1,8 +1,9 @@ import type ts from 'typescript'; -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; -import { toRef } from '../../../shared/utils/refs'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { toRef } from '~/plugins/shared/utils/refs'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; import { irSchemaToAst } from '../plugin'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts index 294fba483..ebdf778b5 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/undefined.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts index 7f1163aec..e0f991b92 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/unknown.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts b/packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts index 63324d503..b30aff23a 100644 --- a/packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts +++ b/packages/openapi-ts/src/plugins/zod/v4/toAst/void.ts @@ -1,5 +1,6 @@ -import { tsc } from '../../../../tsc'; -import type { SchemaWithType } from '../../../shared/types/schema'; +import type { SchemaWithType } from '~/plugins/shared/types/schema'; +import { tsc } from '~/tsc'; + import { identifiers } from '../../constants'; import type { Ast, IrSchemaToAstOptions } from '../../shared/types'; diff --git a/packages/openapi-ts/src/processOutput.ts b/packages/openapi-ts/src/processOutput.ts index 7e35f0a9e..f870dbb3e 100644 --- a/packages/openapi-ts/src/processOutput.ts +++ b/packages/openapi-ts/src/processOutput.ts @@ -1,7 +1,7 @@ import { sync } from 'cross-spawn'; -import type { Config } from './types/config'; -import type { Formatters, Linters } from './types/output'; +import type { Config } from '~/types/config'; +import type { Formatters, Linters } from '~/types/output'; type OutputProcessor = { args: (path: string) => ReadonlyArray; diff --git a/packages/openapi-ts/src/tsc/transform.ts b/packages/openapi-ts/src/tsc/transform.ts index f6f3253e8..a73e0523a 100644 --- a/packages/openapi-ts/src/tsc/transform.ts +++ b/packages/openapi-ts/src/tsc/transform.ts @@ -1,6 +1,7 @@ import ts from 'typescript'; -import { validTypescriptIdentifierRegExp } from '../utils/regexp'; +import { validTypescriptIdentifierRegExp } from '~/utils/regexp'; + import { expressionToStatement } from './convert'; import { createCallExpression } from './module'; import { diff --git a/packages/openapi-ts/src/tsc/typedef.ts b/packages/openapi-ts/src/tsc/typedef.ts index 600e1179c..4313ce04e 100644 --- a/packages/openapi-ts/src/tsc/typedef.ts +++ b/packages/openapi-ts/src/tsc/typedef.ts @@ -1,6 +1,7 @@ import ts from 'typescript'; -import { validTypescriptIdentifierRegExp } from '../utils/regexp'; +import { validTypescriptIdentifierRegExp } from '~/utils/regexp'; + import { createKeywordTypeNode, createMappedTypeNode, diff --git a/packages/openapi-ts/src/tsc/types.ts b/packages/openapi-ts/src/tsc/types.ts index af869048b..9a585442b 100644 --- a/packages/openapi-ts/src/tsc/types.ts +++ b/packages/openapi-ts/src/tsc/types.ts @@ -1,7 +1,8 @@ import ts from 'typescript'; -import { escapeName } from '../utils/escape'; -import { validTypescriptIdentifierRegExp } from '../utils/regexp'; +import { escapeName } from '~/utils/escape'; +import { validTypescriptIdentifierRegExp } from '~/utils/regexp'; + import { addLeadingComments, type Comments, diff --git a/packages/openapi-ts/src/tsc/utils.ts b/packages/openapi-ts/src/tsc/utils.ts index 5ed283029..37606547e 100644 --- a/packages/openapi-ts/src/tsc/utils.ts +++ b/packages/openapi-ts/src/tsc/utils.ts @@ -1,7 +1,8 @@ import ts from 'typescript'; -import { getConfig } from '../utils/config'; -import { unescapeName } from '../utils/escape'; +import { getConfig } from '~/utils/config'; +import { unescapeName } from '~/utils/escape'; + import type { AccessLevel } from './types'; import { createStringLiteral, syntaxKindKeyword } from './types'; diff --git a/packages/openapi-ts/src/types/client.d.ts b/packages/openapi-ts/src/types/client.d.ts index 0d64908c7..54b47e7e0 100644 --- a/packages/openapi-ts/src/types/client.d.ts +++ b/packages/openapi-ts/src/types/client.d.ts @@ -6,7 +6,7 @@ import type { Operation as ParserOperation, OperationParameter, OperationResponse, -} from '../openApi'; +} from '~/openApi'; export type { Method, Model, ModelMeta, OperationParameter, OperationResponse }; diff --git a/packages/openapi-ts/src/types/config.d.ts b/packages/openapi-ts/src/types/config.d.ts index 2d585e68d..58198a637 100644 --- a/packages/openapi-ts/src/types/config.d.ts +++ b/packages/openapi-ts/src/types/config.d.ts @@ -1,5 +1,6 @@ -import type { PluginConfigMap } from '../plugins/config'; -import type { Plugin, PluginNames } from '../plugins/types'; +import type { PluginConfigMap } from '~/plugins/config'; +import type { Plugin, PluginNames } from '~/plugins/types'; + import type { Input, UserInput, Watch } from './input'; import type { Logs } from './logs'; import type { Output, UserOutput } from './output'; diff --git a/packages/openapi-ts/src/types/parser.d.ts b/packages/openapi-ts/src/types/parser.d.ts index ad4d2e05f..eff50d325 100644 --- a/packages/openapi-ts/src/types/parser.d.ts +++ b/packages/openapi-ts/src/types/parser.d.ts @@ -1,4 +1,4 @@ -import type { IR } from '../ir/types'; +import type { IR } from '~/ir/types'; import type { OpenApiMetaObject, OpenApiOperationObject, @@ -6,7 +6,8 @@ import type { OpenApiRequestBodyObject, OpenApiResponseObject, OpenApiSchemaObject, -} from '../openApi/types'; +} from '~/openApi/types'; + import type { StringCase, StringName } from './case'; type EnumsMode = 'inline' | 'root'; diff --git a/packages/openapi-ts/src/types/utils.d.ts b/packages/openapi-ts/src/types/utils.d.ts index ef9b7ae81..c73a2f710 100644 --- a/packages/openapi-ts/src/types/utils.d.ts +++ b/packages/openapi-ts/src/types/utils.d.ts @@ -1,4 +1,4 @@ -import type { GeneratedFile } from '../generate/file'; +import type { GeneratedFile } from '~/generate/file'; /** * Converts all top-level ReadonlyArray properties to Array (shallow). diff --git a/packages/openapi-ts/src/utils/__tests__/parse.test.ts b/packages/openapi-ts/src/utils/__tests__/parse.test.ts index 129b476f5..5b28c5897 100644 --- a/packages/openapi-ts/src/utils/__tests__/parse.test.ts +++ b/packages/openapi-ts/src/utils/__tests__/parse.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; -import { operationNameFn } from '../../openApi/common/parser/operation'; +import { operationNameFn } from '~/openApi/common/parser/operation'; + import { setConfig } from '../config'; describe('operationNameFn', () => { diff --git a/packages/openapi-ts/src/utils/__tests__/postprocess.test.ts b/packages/openapi-ts/src/utils/__tests__/postprocess.test.ts index 52a78a988..44faf4cb8 100644 --- a/packages/openapi-ts/src/utils/__tests__/postprocess.test.ts +++ b/packages/openapi-ts/src/utils/__tests__/postprocess.test.ts @@ -1,7 +1,8 @@ import { describe, expect, it, vi } from 'vitest'; -import { parseLegacy } from '../../openApi'; -import type { Config } from '../../types/config'; +import { parseLegacy } from '~/openApi'; +import type { Config } from '~/types/config'; + import { getServiceName, postProcessClient } from '../postprocess'; vi.mock('../config', () => { diff --git a/packages/openapi-ts/src/utils/__tests__/sort.test.ts b/packages/openapi-ts/src/utils/__tests__/sort.test.ts index cca8cb614..04bb1f33d 100644 --- a/packages/openapi-ts/src/utils/__tests__/sort.test.ts +++ b/packages/openapi-ts/src/utils/__tests__/sort.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; -import type { Model, Service } from '../../types/client'; +import type { Model, Service } from '~/types/client'; + import { sort, sortByName } from '../sort'; describe('sort', () => { diff --git a/packages/openapi-ts/src/utils/__tests__/stringCase.test.ts b/packages/openapi-ts/src/utils/__tests__/stringCase.test.ts index c44e24b2d..3e7f3da87 100644 --- a/packages/openapi-ts/src/utils/__tests__/stringCase.test.ts +++ b/packages/openapi-ts/src/utils/__tests__/stringCase.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it } from 'vitest'; -import type { StringCase } from '../../types/case'; +import type { StringCase } from '~/types/case'; + import { stringCase } from '../stringCase'; const cases: ReadonlyArray = [ diff --git a/packages/openapi-ts/src/utils/__tests__/type.test.ts b/packages/openapi-ts/src/utils/__tests__/type.test.ts index 5999ff15e..2474d75fe 100644 --- a/packages/openapi-ts/src/utils/__tests__/type.test.ts +++ b/packages/openapi-ts/src/utils/__tests__/type.test.ts @@ -1,6 +1,7 @@ import { describe, expect, it, type MockedFunction, vi } from 'vitest'; -import type { Config } from '../../types/config'; +import type { Config } from '~/types/config'; + import { isLegacyClient } from '../config'; import { transformTypeKeyName } from '../type'; diff --git a/packages/openapi-ts/src/utils/cli.ts b/packages/openapi-ts/src/utils/cli.ts index af10deda1..d65a5b82d 100644 --- a/packages/openapi-ts/src/utils/cli.ts +++ b/packages/openapi-ts/src/utils/cli.ts @@ -1,6 +1,6 @@ import colors from 'ansi-colors'; -import { loadPackageJson } from '../generate/tsConfig'; +import { loadPackageJson } from '~/generate/tsConfig'; const textAscii = ` 888 | e 888~-_ 888 diff --git a/packages/openapi-ts/src/utils/config.ts b/packages/openapi-ts/src/utils/config.ts index dba4fa5af..304753734 100644 --- a/packages/openapi-ts/src/utils/config.ts +++ b/packages/openapi-ts/src/utils/config.ts @@ -1,5 +1,5 @@ -import { getClientPlugin } from '../plugins/@hey-api/client-core/utils'; -import type { Config } from '../types/config'; +import { getClientPlugin } from '~/plugins/@hey-api/client-core/utils'; +import type { Config } from '~/types/config'; let _config: Config; diff --git a/packages/openapi-ts/src/utils/enum.ts b/packages/openapi-ts/src/utils/enum.ts index 5d863b033..eef7f66df 100644 --- a/packages/openapi-ts/src/utils/enum.ts +++ b/packages/openapi-ts/src/utils/enum.ts @@ -1,5 +1,6 @@ -import type { Enum, Model } from '../openApi'; -import { ensureValidTypeScriptJavaScriptIdentifier } from '../openApi'; +import type { Enum, Model } from '~/openApi'; +import { ensureValidTypeScriptJavaScriptIdentifier } from '~/openApi'; + import { unescapeName } from './escape'; import { sort } from './sort'; import { unique } from './unique'; diff --git a/packages/openapi-ts/src/utils/getHttpRequestName.ts b/packages/openapi-ts/src/utils/getHttpRequestName.ts index c90fb64ce..8b4e74aa5 100644 --- a/packages/openapi-ts/src/utils/getHttpRequestName.ts +++ b/packages/openapi-ts/src/utils/getHttpRequestName.ts @@ -1,4 +1,4 @@ -import type { PluginClientNames } from '../plugins/types'; +import type { PluginClientNames } from '~/plugins/types'; /** * Generate the HttpRequest filename based on the selected client diff --git a/packages/openapi-ts/src/utils/handlebars.ts b/packages/openapi-ts/src/utils/handlebars.ts index c7d37ac24..b8eb52dc3 100644 --- a/packages/openapi-ts/src/utils/handlebars.ts +++ b/packages/openapi-ts/src/utils/handlebars.ts @@ -1,93 +1,94 @@ import Handlebars from 'handlebars'; // @ts-expect-error -import templateClient from '../legacy/handlebars/compiled/client.js'; +import templateClient from '~/legacy/handlebars/compiled/client'; // @ts-expect-error -import angularGetHeaders from '../legacy/handlebars/compiled/core/angular/getHeaders.js'; +import angularGetHeaders from '~/legacy/handlebars/compiled/core/angular/getHeaders'; // @ts-expect-error -import angularGetRequestBody from '../legacy/handlebars/compiled/core/angular/getRequestBody.js'; +import angularGetRequestBody from '~/legacy/handlebars/compiled/core/angular/getRequestBody'; // @ts-expect-error -import angularGetResponseBody from '../legacy/handlebars/compiled/core/angular/getResponseBody.js'; +import angularGetResponseBody from '~/legacy/handlebars/compiled/core/angular/getResponseBody'; // @ts-expect-error -import angularGetResponseHeader from '../legacy/handlebars/compiled/core/angular/getResponseHeader.js'; +import angularGetResponseHeader from '~/legacy/handlebars/compiled/core/angular/getResponseHeader'; // @ts-expect-error -import angularRequest from '../legacy/handlebars/compiled/core/angular/request.js'; +import angularRequest from '~/legacy/handlebars/compiled/core/angular/request'; // @ts-expect-error -import angularSendRequest from '../legacy/handlebars/compiled/core/angular/sendRequest.js'; +import angularSendRequest from '~/legacy/handlebars/compiled/core/angular/sendRequest'; // @ts-expect-error -import templateCoreApiError from '../legacy/handlebars/compiled/core/ApiError.js'; +import templateCoreApiError from '~/legacy/handlebars/compiled/core/ApiError'; // @ts-expect-error -import templateCoreApiRequestOptions from '../legacy/handlebars/compiled/core/ApiRequestOptions.js'; +import templateCoreApiRequestOptions from '~/legacy/handlebars/compiled/core/ApiRequestOptions'; // @ts-expect-error -import templateCoreApiResult from '../legacy/handlebars/compiled/core/ApiResult.js'; +import templateCoreApiResult from '~/legacy/handlebars/compiled/core/ApiResult'; // @ts-expect-error -import axiosGetHeaders from '../legacy/handlebars/compiled/core/axios/getHeaders.js'; +import axiosGetHeaders from '~/legacy/handlebars/compiled/core/axios/getHeaders'; // @ts-expect-error -import axiosGetRequestBody from '../legacy/handlebars/compiled/core/axios/getRequestBody.js'; +import axiosGetRequestBody from '~/legacy/handlebars/compiled/core/axios/getRequestBody'; // @ts-expect-error -import axiosGetResponseBody from '../legacy/handlebars/compiled/core/axios/getResponseBody.js'; +import axiosGetResponseBody from '~/legacy/handlebars/compiled/core/axios/getResponseBody'; // @ts-expect-error -import axiosGetResponseHeader from '../legacy/handlebars/compiled/core/axios/getResponseHeader.js'; +import axiosGetResponseHeader from '~/legacy/handlebars/compiled/core/axios/getResponseHeader'; // @ts-expect-error -import axiosRequest from '../legacy/handlebars/compiled/core/axios/request.js'; +import axiosRequest from '~/legacy/handlebars/compiled/core/axios/request'; // @ts-expect-error -import axiosSendRequest from '../legacy/handlebars/compiled/core/axios/sendRequest.js'; +import axiosSendRequest from '~/legacy/handlebars/compiled/core/axios/sendRequest'; // @ts-expect-error -import templateCoreBaseHttpRequest from '../legacy/handlebars/compiled/core/BaseHttpRequest.js'; +import templateCoreBaseHttpRequest from '~/legacy/handlebars/compiled/core/BaseHttpRequest'; // @ts-expect-error -import templateCancelablePromise from '../legacy/handlebars/compiled/core/CancelablePromise.js'; +import templateCancelablePromise from '~/legacy/handlebars/compiled/core/CancelablePromise'; // @ts-expect-error -import fetchGetHeaders from '../legacy/handlebars/compiled/core/fetch/getHeaders.js'; +import fetchGetHeaders from '~/legacy/handlebars/compiled/core/fetch/getHeaders'; // @ts-expect-error -import fetchGetRequestBody from '../legacy/handlebars/compiled/core/fetch/getRequestBody.js'; +import fetchGetRequestBody from '~/legacy/handlebars/compiled/core/fetch/getRequestBody'; // @ts-expect-error -import fetchGetResponseBody from '../legacy/handlebars/compiled/core/fetch/getResponseBody.js'; +import fetchGetResponseBody from '~/legacy/handlebars/compiled/core/fetch/getResponseBody'; // @ts-expect-error -import fetchGetResponseHeader from '../legacy/handlebars/compiled/core/fetch/getResponseHeader.js'; +import fetchGetResponseHeader from '~/legacy/handlebars/compiled/core/fetch/getResponseHeader'; // @ts-expect-error -import fetchRequest from '../legacy/handlebars/compiled/core/fetch/request.js'; +import fetchRequest from '~/legacy/handlebars/compiled/core/fetch/request'; // @ts-expect-error -import fetchSendRequest from '../legacy/handlebars/compiled/core/fetch/sendRequest.js'; +import fetchSendRequest from '~/legacy/handlebars/compiled/core/fetch/sendRequest'; // @ts-expect-error -import functionBase64 from '../legacy/handlebars/compiled/core/functions/base64.js'; +import functionBase64 from '~/legacy/handlebars/compiled/core/functions/base64'; // @ts-expect-error -import functionCatchErrorCodes from '../legacy/handlebars/compiled/core/functions/catchErrorCodes.js'; +import functionCatchErrorCodes from '~/legacy/handlebars/compiled/core/functions/catchErrorCodes'; // @ts-expect-error -import functionGetFormData from '../legacy/handlebars/compiled/core/functions/getFormData.js'; +import functionGetFormData from '~/legacy/handlebars/compiled/core/functions/getFormData'; // @ts-expect-error -import functionGetQueryString from '../legacy/handlebars/compiled/core/functions/getQueryString.js'; +import functionGetQueryString from '~/legacy/handlebars/compiled/core/functions/getQueryString'; // @ts-expect-error -import functionGetUrl from '../legacy/handlebars/compiled/core/functions/getUrl.js'; +import functionGetUrl from '~/legacy/handlebars/compiled/core/functions/getUrl'; // @ts-expect-error -import functionIsBlob from '../legacy/handlebars/compiled/core/functions/isBlob.js'; +import functionIsBlob from '~/legacy/handlebars/compiled/core/functions/isBlob'; // @ts-expect-error -import functionIsFormData from '../legacy/handlebars/compiled/core/functions/isFormData.js'; +import functionIsFormData from '~/legacy/handlebars/compiled/core/functions/isFormData'; // @ts-expect-error -import functionIsString from '../legacy/handlebars/compiled/core/functions/isString.js'; +import functionIsString from '~/legacy/handlebars/compiled/core/functions/isString'; // @ts-expect-error -import functionIsStringWithValue from '../legacy/handlebars/compiled/core/functions/isStringWithValue.js'; +import functionIsStringWithValue from '~/legacy/handlebars/compiled/core/functions/isStringWithValue'; // @ts-expect-error -import functionIsSuccess from '../legacy/handlebars/compiled/core/functions/isSuccess.js'; +import functionIsSuccess from '~/legacy/handlebars/compiled/core/functions/isSuccess'; // @ts-expect-error -import functionResolve from '../legacy/handlebars/compiled/core/functions/resolve.js'; +import functionResolve from '~/legacy/handlebars/compiled/core/functions/resolve'; // @ts-expect-error -import templateCoreHttpRequest from '../legacy/handlebars/compiled/core/HttpRequest.js'; +import templateCoreHttpRequest from '~/legacy/handlebars/compiled/core/HttpRequest'; // @ts-expect-error -import templateCoreSettings from '../legacy/handlebars/compiled/core/OpenAPI.js'; +import templateCoreSettings from '~/legacy/handlebars/compiled/core/OpenAPI'; // @ts-expect-error -import templateCoreRequest from '../legacy/handlebars/compiled/core/request.js'; +import templateCoreRequest from '~/legacy/handlebars/compiled/core/request'; // @ts-expect-error -import xhrGetHeaders from '../legacy/handlebars/compiled/core/xhr/getHeaders.js'; +import xhrGetHeaders from '~/legacy/handlebars/compiled/core/xhr/getHeaders'; // @ts-expect-error -import xhrGetRequestBody from '../legacy/handlebars/compiled/core/xhr/getRequestBody.js'; +import xhrGetRequestBody from '~/legacy/handlebars/compiled/core/xhr/getRequestBody'; // @ts-expect-error -import xhrGetResponseBody from '../legacy/handlebars/compiled/core/xhr/getResponseBody.js'; +import xhrGetResponseBody from '~/legacy/handlebars/compiled/core/xhr/getResponseBody'; // @ts-expect-error -import xhrGetResponseHeader from '../legacy/handlebars/compiled/core/xhr/getResponseHeader.js'; +import xhrGetResponseHeader from '~/legacy/handlebars/compiled/core/xhr/getResponseHeader'; // @ts-expect-error -import xhrRequest from '../legacy/handlebars/compiled/core/xhr/request.js'; +import xhrRequest from '~/legacy/handlebars/compiled/core/xhr/request'; // @ts-expect-error -import xhrSendRequest from '../legacy/handlebars/compiled/core/xhr/sendRequest.js'; +import xhrSendRequest from '~/legacy/handlebars/compiled/core/xhr/sendRequest'; + import { getConfig } from './config'; import { stringCase } from './stringCase'; import { transformClassName } from './transform'; diff --git a/packages/openapi-ts/src/utils/input/heyApi.ts b/packages/openapi-ts/src/utils/input/heyApi.ts index 08af7efc7..2f5b1ea7f 100644 --- a/packages/openapi-ts/src/utils/input/heyApi.ts +++ b/packages/openapi-ts/src/utils/input/heyApi.ts @@ -1,4 +1,4 @@ -import type { Input } from '../../types/input'; +import type { Input } from '~/types/input'; // Regular expression to match Hey API Registry input formats: // - {organization}/{project}?{queryParams} diff --git a/packages/openapi-ts/src/utils/input/index.ts b/packages/openapi-ts/src/utils/input/index.ts index c0b96b5c1..78bd3ced1 100644 --- a/packages/openapi-ts/src/utils/input/index.ts +++ b/packages/openapi-ts/src/utils/input/index.ts @@ -1,4 +1,5 @@ -import type { Input } from '../../types/input'; +import type { Input } from '~/types/input'; + import { heyApiRegistryBaseUrl, inputToHeyApiPath } from './heyApi'; import { inputToReadmePath } from './readme'; import { inputToScalarPath } from './scalar'; diff --git a/packages/openapi-ts/src/utils/input/readme.ts b/packages/openapi-ts/src/utils/input/readme.ts index 3ed5a5cdf..d5f10bdee 100644 --- a/packages/openapi-ts/src/utils/input/readme.ts +++ b/packages/openapi-ts/src/utils/input/readme.ts @@ -1,4 +1,4 @@ -import type { Input } from '../../types/input'; +import type { Input } from '~/types/input'; // Regular expression to match ReadMe API Registry input formats: // - @{organization}/{project}#{uuid} diff --git a/packages/openapi-ts/src/utils/input/scalar.ts b/packages/openapi-ts/src/utils/input/scalar.ts index 5686ae114..8e00aafb4 100644 --- a/packages/openapi-ts/src/utils/input/scalar.ts +++ b/packages/openapi-ts/src/utils/input/scalar.ts @@ -1,4 +1,4 @@ -import type { Input } from '../../types/input'; +import type { Input } from '~/types/input'; // Regular expression to match Scalar API Registry input formats: // - @{organization}/{project} diff --git a/packages/openapi-ts/src/utils/meta.ts b/packages/openapi-ts/src/utils/meta.ts index 5110278b1..af055a89e 100644 --- a/packages/openapi-ts/src/utils/meta.ts +++ b/packages/openapi-ts/src/utils/meta.ts @@ -1,4 +1,5 @@ -import { getType } from '../openApi'; +import { getType } from '~/openApi'; + import { refParametersPartial, refSchemasPartial } from './const'; import { reservedJavaScriptKeywordsRegExp } from './regexp'; import { cleanAndTransformTypeName } from './transform'; diff --git a/packages/openapi-ts/src/utils/postprocess.ts b/packages/openapi-ts/src/utils/postprocess.ts index c19937a2e..6e6b6b9aa 100644 --- a/packages/openapi-ts/src/utils/postprocess.ts +++ b/packages/openapi-ts/src/utils/postprocess.ts @@ -1,7 +1,8 @@ -import type { Client as ParserClient, Model } from '../openApi'; -import { sanitizeNamespaceIdentifier } from '../openApi'; -import type { Client, Operation, Service } from '../types/client'; -import type { Config } from '../types/config'; +import type { Client as ParserClient, Model } from '~/openApi'; +import { sanitizeNamespaceIdentifier } from '~/openApi'; +import type { Client, Operation, Service } from '~/types/client'; +import type { Config } from '~/types/config'; + import { getConfig, legacyNameFromConfig } from './config'; import { sort } from './sort'; import { stringCase } from './stringCase'; diff --git a/packages/openapi-ts/src/utils/stringCase.ts b/packages/openapi-ts/src/utils/stringCase.ts index 9b279a35a..d5acb3ba1 100644 --- a/packages/openapi-ts/src/utils/stringCase.ts +++ b/packages/openapi-ts/src/utils/stringCase.ts @@ -1,4 +1,4 @@ -import type { StringCase } from '../types/case'; +import type { StringCase } from '~/types/case'; const uppercaseRegExp = /[\p{Lu}]/u; const lowercaseRegExp = /[\p{Ll}]/u; diff --git a/packages/openapi-ts/src/utils/transform.ts b/packages/openapi-ts/src/utils/transform.ts index 8b68a18f1..a766161e6 100644 --- a/packages/openapi-ts/src/utils/transform.ts +++ b/packages/openapi-ts/src/utils/transform.ts @@ -1,5 +1,6 @@ -import { ensureValidTypeScriptJavaScriptIdentifier } from '../openApi'; -import type { Config } from '../types/config'; +import { ensureValidTypeScriptJavaScriptIdentifier } from '~/openApi'; +import type { Config } from '~/types/config'; + import { getConfig } from './config'; import { reservedJavaScriptKeywordsRegExp } from './regexp'; import { stringCase } from './stringCase'; diff --git a/packages/openapi-ts/src/utils/type.ts b/packages/openapi-ts/src/utils/type.ts index 351817a0e..04767ebb8 100644 --- a/packages/openapi-ts/src/utils/type.ts +++ b/packages/openapi-ts/src/utils/type.ts @@ -1,9 +1,10 @@ import type ts from 'typescript'; -import type { Model } from '../openApi'; -import { sanitizeOperationParameterName } from '../openApi'; -import { type Property, tsc } from '../tsc'; -import type { Client } from '../types/client'; +import type { Model } from '~/openApi'; +import { sanitizeOperationParameterName } from '~/openApi'; +import { type Property, tsc } from '~/tsc'; +import type { Client } from '~/types/client'; + import { getConfig, isLegacyClient } from './config'; import { refSchemasPartial } from './const'; import { enumValue } from './enum'; diff --git a/packages/openapi-ts/tsconfig.base.json b/packages/openapi-ts/tsconfig.base.json index 5afc381fb..43a2b88eb 100644 --- a/packages/openapi-ts/tsconfig.base.json +++ b/packages/openapi-ts/tsconfig.base.json @@ -11,6 +11,10 @@ "noUnusedParameters": true, "strict": true, "target": "ES2022", - "useUnknownInCatchVariables": false + "useUnknownInCatchVariables": false, + "baseUrl": "./", + "paths": { + "~/*": ["src/*"] + } } } diff --git a/packages/openapi-ts/vitest.config.ts b/packages/openapi-ts/vitest.config.ts index 1ae312607..21c403f8e 100644 --- a/packages/openapi-ts/vitest.config.ts +++ b/packages/openapi-ts/vitest.config.ts @@ -1,12 +1,19 @@ +import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { createVitestConfig } from '@config/vite-base'; -export default createVitestConfig( - fileURLToPath(new URL('./', import.meta.url)), - { - test: { - setupFiles: './setupTests.ts', - }, +const rootDir = fileURLToPath(new URL('./', import.meta.url)); + +export default createVitestConfig(rootDir, { + resolve: { + alias: [ + // Support imports like `~/foo` and `~` -> maps to /src + { find: /^~\/(.*)/, replacement: path.resolve(rootDir, 'src/$1') }, + { find: '~', replacement: path.resolve(rootDir, 'src') }, + ], + }, + test: { + setupFiles: './setupTests.ts', }, -); +});