Skip to content

Commit

Permalink
fix: the targets export
Browse files Browse the repository at this point in the history
  • Loading branch information
erunion committed Sep 8, 2023
1 parent aa9304f commit 60c8960
Show file tree
Hide file tree
Showing 65 changed files with 70 additions and 70 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
"import": "./dist/helpers/reducer.mjs"
},
"./targets": {
"types": "./dist/targets.d.ts",
"require": "./dist/targets.js",
"import": "./dist/targets.mjs"
"types": "./dist/targets/index.d.ts",
"require": "./dist/targets/index.js",
"import": "./dist/targets/index.mjs"
},
"./package.json": "./package.json"
},
Expand Down
2 changes: 1 addition & 1 deletion src/fixtures/customTarget.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets/targets';
import type { Target } from '../targets';

import { request } from '../targets/node/request/client';

Expand Down
2 changes: 1 addition & 1 deletion src/fixtures/runCustomFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable jest/valid-title */
/* eslint-disable jest/no-export */
import type { HTTPSnippetOptions, Request } from '..';
import type { ClientId, TargetId } from '../targets/targets';
import type { ClientId, TargetId } from '../targets';

import { writeFileSync } from 'node:fs';
import { readFile } from 'node:fs/promises';
Expand Down
4 changes: 2 additions & 2 deletions src/helpers/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ClientInfo, TargetId, TargetInfo } from '../targets/targets';
import type { ClientInfo, TargetId, TargetInfo } from '../targets';

import { targets } from '../targets/targets';
import { targets } from '../targets';

export interface AvailableTarget extends TargetInfo {
clients: ClientInfo[];
Expand Down
6 changes: 3 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { ReducedHelperObject } from './helpers/reducer';
import type { ClientId, TargetId } from './targets/targets';
import type { ClientId, TargetId } from './targets';
import type { Param, PostDataCommon, Request as NpmHarRequest } from 'har-format';
import type { UrlWithParsedQuery } from 'node:url';

Expand All @@ -12,10 +12,10 @@ import { stringify as queryStringify } from 'qs';
import { formDataIterator, isBlob } from './helpers/form-data';
import { getHeaderName } from './helpers/headers';
import { reducer } from './helpers/reducer';
import { targets } from './targets/targets';
import { targets } from './targets';

export { availableTargets, extname } from './helpers/utils';
export { addTarget, addTargetClient } from './targets/targets';
export { addTarget, addTargetClient } from './targets';

/** is this wrong? yes. according to the spec (http://www.softwareishard.com/blog/har-12-spec/#postData) it's technically wrong since `params` and `text` are (by the spec) mutually exclusive. However, in practice, this is not what is often the case.
*
Expand Down
2 changes: 1 addition & 1 deletion src/integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable jest/no-conditional-expect */
import type { Request } from '.';
import type { AvailableTarget } from './helpers/utils';
import type { TargetId } from './targets/targets';
import type { TargetId } from './targets';
import type { Response } from 'har-format';

import shell from 'node:child_process';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/c/libcurl/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/c/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { libcurl } from './libcurl/client';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/clojure/clj_http/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { getHeader, getHeaderName } from '../../../helpers/headers';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/clojure/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { clj_http } from './clj_http/client';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/csharp/httpclient/client.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Client } from '../..';
import type { Request } from '../../..';
import type { Client } from '../../targets';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/csharp/restsharp/client.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/csharp/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { httpclient } from './httpclient/client';
import { restsharp } from './restsharp/client';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/go/native/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/go/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { native } from './native/client';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/http/http1.1/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
*
* For any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/http/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { http11 } from './http1.1/client';

Expand Down
4 changes: 2 additions & 2 deletions src/targets/targets.test.ts → src/targets/index.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Client, ClientId, Target, TargetId } from './targets';
import type { Client, ClientId, Target, TargetId } from '.';
import type { HTTPSnippetOptions, Request } from '..';

import { readdirSync, readFileSync, writeFileSync } from 'node:fs';
Expand All @@ -8,7 +8,7 @@ import { HTTPSnippet } from '..';
import short from '../fixtures/requests/short';
import { availableTargets, extname } from '../helpers/utils';

import { isClient, isTarget, addTarget, addTargetClient, targets } from './targets';
import { isClient, isTarget, addTarget, addTargetClient, targets } from '.';

const expectedBasePath = ['src', 'fixtures', 'requests'];

Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/targets/java/asynchttp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/java/nethttp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/java/okhttp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/java/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { asynchttp } from './asynchttp/client';
import { nethttp } from './nethttp/client';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/java/unirest/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/javascript/axios/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/javascript/fetch/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/javascript/jquery/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/javascript/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { axios } from './axios/client';
import { fetch } from './fetch/client';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/javascript/xhr/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/json/native/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
*
* For any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../..';
import type { ReducedHelperObject } from '../../../helpers/reducer';
import type { Client } from '../../targets';

export const native: Client = {
info: {
Expand Down
2 changes: 1 addition & 1 deletion src/targets/json/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { native } from './native/client';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/kotlin/okhttp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/kotlin/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { okhttp } from './okhttp/client';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/node/axios/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/node/fetch/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/node/native/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/node/request/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/node/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { axios } from './axios/client';
import { fetch } from './fetch/client';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/node/unirest/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import stringifyObject from 'stringify-object';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/objc/nsurlsession/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { nsDeclaration } from '../helpers';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/objc/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { nsurlsession } from './nsurlsession/client';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/ocaml/cohttp/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/ocaml/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { cohttp } from './cohttp/client';

Expand Down
2 changes: 1 addition & 1 deletion src/targets/php/curl/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForDoubleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/php/guzzle/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { escapeForSingleQuotes } from '../../../helpers/escape';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/php/http1/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { convertType, supportedMethods } from '../helpers';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/php/http2/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
*
* for any questions or issues regarding the generated code snippet, please open an issue mentioning the author.
*/
import type { Client } from '../../targets';
import type { Client } from '../..';

import { CodeBuilder } from '../../../helpers/code-builder';
import { getHeader, getHeaderName, hasHeader } from '../../../helpers/headers';
Expand Down
2 changes: 1 addition & 1 deletion src/targets/php/target.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Target } from '../targets';
import type { Target } from '..';

import { curl } from './curl/client';
import { guzzle } from './guzzle/client';
Expand Down
Loading

0 comments on commit 60c8960

Please sign in to comment.