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

Merge pull request #1934 from seriouslag/feat/add-shared-exports

feat(openapi-ts): export additional functions from openapi-ts

authored by

Lubos 🍈 and committed by
GitHub
cd5d6530 729488e9

+55 -2
+5
.changeset/three-rats-count.md
··· 1 + --- 2 + "@hey-api/openapi-ts": patch 3 + --- 4 + 5 + fix: export some internal functions
+11 -1
packages/openapi-ts/package.json
··· 52 52 "default": "./dist/index.cjs" 53 53 } 54 54 }, 55 + "./internal": { 56 + "import": { 57 + "types": "./dist/internal.d.ts", 58 + "default": "./dist/internal.js" 59 + }, 60 + "require": { 61 + "types": "./dist/internal.d.cts", 62 + "default": "./dist/internal.cjs" 63 + } 64 + }, 55 65 "./package.json": "./package.json" 56 66 }, 57 67 "bin": { ··· 64 74 ], 65 75 "scripts": { 66 76 "build": "tsup && pnpm check-exports", 67 - "check-exports": "attw --pack .", 77 + "check-exports": "attw --pack . --profile node16", 68 78 "dev": "tsup --watch", 69 79 "handlebars": "node src/legacy/handlebars/handlebars.cjs", 70 80 "prepublishOnly": "pnpm build",
+10
packages/openapi-ts/src/__tests__/index.test.ts
··· 1 + import { describe, expect, it } from 'vitest'; 2 + 3 + describe('main entry index', () => { 4 + describe('createClient', () => { 5 + it('should be exported', async () => { 6 + const { createClient } = await import('../index'); 7 + expect(createClient).toBeDefined(); 8 + }); 9 + }); 10 + });
+18
packages/openapi-ts/src/__tests__/internal.test.ts
··· 1 + import { describe, expect, it } from 'vitest'; 2 + 3 + describe('internal entry index', () => { 4 + it('getSpec should be exported', async () => { 5 + const { getSpec } = await import('../internal'); 6 + expect(getSpec).toBeDefined(); 7 + }); 8 + 9 + it('initConfigs should be exported', async () => { 10 + const { initConfigs } = await import('../internal'); 11 + expect(initConfigs).toBeDefined(); 12 + }); 13 + 14 + it('parseOpenApiSpec should be exported', async () => { 15 + const { parseOpenApiSpec } = await import('../internal'); 16 + expect(parseOpenApiSpec).toBeDefined(); 17 + }); 18 + });
+3
packages/openapi-ts/src/getSpec.ts
··· 21 21 response: Response; 22 22 } 23 23 24 + /** 25 + * @internal 26 + */ 24 27 export const getSpec = async ({ 25 28 fetchOptions, 26 29 inputPath,
+3
packages/openapi-ts/src/initConfigs.ts
··· 253 253 return watch; 254 254 }; 255 255 256 + /** 257 + * @internal 258 + */ 256 259 export const initConfigs = async ( 257 260 userConfig: UserConfig | undefined, 258 261 ): Promise<Config[]> => {
+3
packages/openapi-ts/src/internal.ts
··· 1 + export { getSpec } from './getSpec'; 2 + export { initConfigs } from './initConfigs'; 3 + export { parseOpenApiSpec } from './openApi';
+1
packages/openapi-ts/src/openApi/index.ts
··· 57 57 } 58 58 59 59 /** 60 + * @internal 60 61 * Parse the resolved OpenAPI specification. This will populate and return 61 62 * `context` with intermediate representation obtained from the parsed spec. 62 63 */
+1 -1
packages/openapi-ts/tsup.config.ts
··· 14 14 }, 15 15 clean: true, 16 16 dts: true, 17 - entry: ['src/index.ts'], 17 + entry: ['src/index.ts', 'src/internal.ts'], 18 18 format: ['cjs', 'esm'], 19 19 minify: !options.watch, 20 20 shims: false,