[typescript] Make module usable with esbuild (#11298)

* Use default import from url-parse

* Update samples

* Fix typo in readme
This commit is contained in:
Bodo Graumann 2022-01-13 17:06:04 +01:00 committed by GitHub
parent dff3944d19
commit 7129cdebc5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 37 additions and 25 deletions

View File

@ -3,7 +3,7 @@
<div align="center"> <div align="center">
[![Stable releaases in Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22) [![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-orange)](./LICENSE) [![Open Collective backers](https://img.shields.io/opencollective/backers/openapi_generator?color=orange&label=OpenCollective%20Backers)](https://opencollective.com/openapi_generator) [![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM) [![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator) [![Stable releases in Maven Central](https://img.shields.io/maven-metadata/v/https/repo1.maven.org/maven2/org/openapitools/openapi-generator/maven-metadata.xml.svg)](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.openapitools%22%20AND%20a%3A%22openapi-generator%22) [![Apache 2.0 License](https://img.shields.io/badge/License-Apache%202.0-orange)](./LICENSE) [![Open Collective backers](https://img.shields.io/opencollective/backers/openapi_generator?color=orange&label=OpenCollective%20Backers)](https://opencollective.com/openapi_generator) [![Join the Slack chat room](https://img.shields.io/badge/Slack-Join%20the%20chat%20room-orange)](https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM) [![Follow OpenAPI Generator Twitter account to get the latest update](https://img.shields.io/twitter/follow/oas_generator.svg?style=social&label=Follow)](https://twitter.com/oas_generator)
</div> </div>

View File

@ -7,9 +7,7 @@ import { URLSearchParams } from 'url';
{{/platforms}} {{/platforms}}
{{#platforms}} {{#platforms}}
{{^deno}} {{^deno}}
// typings of url-parse are incorrect... import URLParse from "url-parse";
// @ts-ignore
import * as URLParse from "url-parse";
{{/deno}} {{/deno}}
{{/platforms}} {{/platforms}}
import { Observable, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{extensionForDeno}}'{{/useRxJS}}; import { Observable, from } from {{#useRxJS}}'rxjs'{{/useRxJS}}{{^useRxJS}}'../rxjsStub{{extensionForDeno}}'{{/useRxJS}};

View File

@ -51,7 +51,8 @@
"url-parse": "^1.4.3" "url-parse": "^1.4.3"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^3.9.3" "typescript": "^3.9.3",
"@types/url-parse": "1.4.4"
}{{#npmRepository}},{{/npmRepository}} }{{#npmRepository}},{{/npmRepository}}
{{#npmRepository}} {{#npmRepository}}
"publishConfig":{ "publishConfig":{

View File

@ -13,6 +13,9 @@
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* To import url-parse */
"allowSyntheticDefaultImports": true,
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",

View File

@ -1,6 +1,4 @@
// typings of url-parse are incorrect... import URLParse from "url-parse";
// @ts-ignore
import * as URLParse from "url-parse";
import { Observable, from } from '../rxjsStub'; import { Observable, from } from '../rxjsStub';
export * from './isomorphic-fetch'; export * from './isomorphic-fetch';

View File

@ -22,6 +22,7 @@
"url-parse": "^1.4.3" "url-parse": "^1.4.3"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^3.9.3" "typescript": "^3.9.3",
"@types/url-parse": "1.4.4"
} }
} }

View File

@ -13,6 +13,9 @@
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* To import url-parse */
"allowSyntheticDefaultImports": true,
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",

View File

@ -1,9 +1,7 @@
// TODO: evaluate if we can easily get rid of this library // TODO: evaluate if we can easily get rid of this library
import * as FormData from "form-data"; import * as FormData from "form-data";
import { URLSearchParams } from 'url'; import { URLSearchParams } from 'url';
// typings of url-parse are incorrect... import URLParse from "url-parse";
// @ts-ignore
import * as URLParse from "url-parse";
import { Observable, from } from '../rxjsStub'; import { Observable, from } from '../rxjsStub';
export * from './isomorphic-fetch'; export * from './isomorphic-fetch';

View File

@ -26,6 +26,7 @@
"url-parse": "^1.4.3" "url-parse": "^1.4.3"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^3.9.3" "typescript": "^3.9.3",
"@types/url-parse": "1.4.4"
} }
} }

View File

@ -13,6 +13,9 @@
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* To import url-parse */
"allowSyntheticDefaultImports": true,
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",

View File

@ -1,9 +1,7 @@
// TODO: evaluate if we can easily get rid of this library // TODO: evaluate if we can easily get rid of this library
import * as FormData from "form-data"; import * as FormData from "form-data";
import { URLSearchParams } from 'url'; import { URLSearchParams } from 'url';
// typings of url-parse are incorrect... import URLParse from "url-parse";
// @ts-ignore
import * as URLParse from "url-parse";
import { Observable, from } from '../rxjsStub'; import { Observable, from } from '../rxjsStub';
export * from './isomorphic-fetch'; export * from './isomorphic-fetch';

View File

@ -27,6 +27,7 @@
"url-parse": "^1.4.3" "url-parse": "^1.4.3"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^3.9.3" "typescript": "^3.9.3",
"@types/url-parse": "1.4.4"
} }
} }

View File

@ -13,6 +13,9 @@
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* To import url-parse */
"allowSyntheticDefaultImports": true,
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",

View File

@ -1,6 +1,4 @@
// typings of url-parse are incorrect... import URLParse from "url-parse";
// @ts-ignore
import * as URLParse from "url-parse";
import { Observable, from } from '../rxjsStub'; import { Observable, from } from '../rxjsStub';
export * from './jquery'; export * from './jquery';

View File

@ -23,6 +23,7 @@
"url-parse": "^1.4.3" "url-parse": "^1.4.3"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^3.9.3" "typescript": "^3.9.3",
"@types/url-parse": "1.4.4"
} }
} }

View File

@ -13,6 +13,9 @@
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* To import url-parse */
"allowSyntheticDefaultImports": true,
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",

View File

@ -1,9 +1,7 @@
// TODO: evaluate if we can easily get rid of this library // TODO: evaluate if we can easily get rid of this library
import * as FormData from "form-data"; import * as FormData from "form-data";
import { URLSearchParams } from 'url'; import { URLSearchParams } from 'url';
// typings of url-parse are incorrect... import URLParse from "url-parse";
// @ts-ignore
import * as URLParse from "url-parse";
import { Observable, from } from '../rxjsStub'; import { Observable, from } from '../rxjsStub';
export * from './isomorphic-fetch'; export * from './isomorphic-fetch';

View File

@ -26,6 +26,7 @@
"url-parse": "^1.4.3" "url-parse": "^1.4.3"
}, },
"devDependencies": { "devDependencies": {
"typescript": "^3.9.3" "typescript": "^3.9.3",
"@types/url-parse": "1.4.4"
} }
} }

View File

@ -13,6 +13,9 @@
"noImplicitReturns": true, /* Report error when not all code paths in function return a value. */ "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
"noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */ "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
/* To import url-parse */
"allowSyntheticDefaultImports": true,
"removeComments": true, "removeComments": true,
"sourceMap": true, "sourceMap": true,
"outDir": "./dist", "outDir": "./dist",