fork of hey-api/openapi-ts because I need some additional things

chore: normalize external path

Lubos 8e44ea8f 052341eb

+14 -9
+4 -3
dev/openapi-ts.config.ts
··· 35 35 // }, 36 36 path: path.resolve( 37 37 getSpecsPath(), 38 - // '3.0.x', 39 - '3.1.x', 38 + '3.0.x', 39 + // '3.1.x', 40 40 // 'circular.yaml', 41 41 // 'dutchie.json', 42 42 // 'enum-names-values.yaml', 43 43 // 'invalid', 44 44 // 'full.yaml', 45 + 'sdk-method-class-conflict.yaml', 45 46 // 'object-property-names.yaml', 46 47 // 'openai.yaml', 47 48 // 'opencode.yaml', 48 49 // 'pagination-ref.yaml', 49 50 // 'sdk-instance.yaml', 50 - 'sdk-nested-classes.yaml', 51 + // 'sdk-nested-classes.yaml', 51 52 // 'string-with-format.yaml', 52 53 // 'transformers.json', 53 54 // 'transformers-recursive.json',
+3 -1
packages/codegen-core/src/files/file.ts
··· 1 + import path from 'node:path'; 2 + 1 3 import type { ExportModule, ImportModule } from '../bindings'; 2 4 import { fileBrand } from '../brands'; 3 5 import { debug } from '../debug'; ··· 63 65 this.external = input.external ?? false; 64 66 this.id = id; 65 67 if (input.language !== undefined) this._language = input.language; 66 - this._logicalFilePath = input.logicalFilePath; 68 + this._logicalFilePath = input.logicalFilePath.split(path.sep).join('/'); 67 69 if (input.name !== undefined) this._name = input.name; 68 70 this.project = project; 69 71 }
+4 -1
packages/codegen-core/src/files/registry.ts
··· 1 + import path from 'node:path'; 2 + 1 3 import type { IProject } from '../project/types'; 2 4 import { File } from './file'; 3 5 import type { FileKeyArgs, IFileIn, IFileRegistry } from './types'; ··· 50 52 } 51 53 52 54 private createFileKey(args: FileKeyArgs): string { 53 - return `${args.external ? 'ext:' : ''}${args.logicalFilePath}${args.language ? `:${args.language}` : ''}`; 55 + const logicalPath = args.logicalFilePath.split(path.sep).join('/'); 56 + return `${args.external ? 'ext:' : ''}${logicalPath}${args.language ? `:${args.language}` : ''}`; 54 57 } 55 58 }
+3 -4
packages/openapi-ts/src/ts-dsl/render/utils.ts
··· 97 97 preferFileExtension: string; 98 98 root: string; 99 99 }): SortKey => { 100 - const fromPath = fromFile.finalPath!; 101 - const filePath = file.finalPath!; 102 - let modulePath = fromPath; 100 + const filePath = file.finalPath!.split(path.sep).join('/'); 101 + let modulePath = fromFile.finalPath!.split(path.sep).join('/'); 103 102 104 103 // built-ins 105 104 // TODO: based on nodeBuiltins set ··· 110 109 } 111 110 112 111 // outside project root 113 - if (!modulePath.startsWith(root)) { 112 + if (!modulePath.startsWith(root.split(path.sep).join('/'))) { 114 113 return [1, 0, modulePath]; 115 114 } 116 115