6.1.0 • Published 17 days ago

cosmiconfig-typescript-loader v6.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
17 days ago

cosmiconfig-typescript-loader

⚙️🚀 TypeScript config file support for cosmiconfig

build codecov npm

Usage

Simply add TypeScriptLoader to the list of loaders for the .ts file type, and await loading:

import { cosmiconfig } from "cosmiconfig";
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";

const moduleName = "module";
const explorer = cosmiconfig("test", {
  searchPlaces: [
    "package.json",
    `.${moduleName}rc`,
    `.${moduleName}rc.json`,
    `.${moduleName}rc.yaml`,
    `.${moduleName}rc.yml`,
    `.${moduleName}rc.js`,
    `.${moduleName}rc.ts`,
    `.${moduleName}rc.cjs`,
    `${moduleName}.config.js`,
    `${moduleName}.config.ts`,
    `${moduleName}.config.cjs`,
  ],
  loaders: {
    ".ts": TypeScriptLoader(),
  },
});

const cfg = await explorer.load("./");

Or more simply if you only support loading of a TypeScript based configuration file:

import { cosmiconfig } from "cosmiconfig";
import { TypeScriptLoader } from "cosmiconfig-typescript-loader";

const moduleName = "module";
const explorer = cosmiconfig("test", {
  loaders: {
    ".ts": TypeScriptLoader(),
  },
});

const cfg = await explorer.load("./amazing.config.ts");

Synchronously loading

With the release of Jiti 2, the synchronous loader has now been deprecated. It can still be used by using the TypeScriptLoaderSync export:

import { cosmiconfig } from "cosmiconfig";
import { TypeScriptLoaderSync } from "cosmiconfig-typescript-loader";

const moduleName = "module";
const explorer = cosmiconfig("test", {
  loaders: {
    ".ts": TypeScriptLoaderSync(),
  },
});

const cfg = explorer.load("./amazing.config.ts");

@endemolshinegroup/cosmiconfig-typescript-loader

This package serves as a drop in replacement for @endemolshinegroup/cosmiconfig-typescript-loader. At the time of publishing this, endemolshinegroup is not maintaining the original package. I can only assume this is to do with the fact that Endemol Shine Group was purchased and absorbed by another business. This discontinuation of development efforts towards the original package left any open issues and pull requests unresolved.

This new package resolves the following original issues:

  • #134: "Doesn't work with Cosmiconfig sync API"
  • #147: "doesn't provide typescript, requested by ts-node"
  • #155: "Misleading TypeScriptCompileError when user's tsconfig.json "module" is set to "es2015""
@commitlint/loadreact-native-shekhar-bridge-test@oiti/documentoscopy-react-nativequoc-testinflintdocu-notion-dashwaveluminos-ui-core@everything-registry/sub-chunk-1390jawwy-sdkjawwy_gamification_releasereact-native-sphereuisphereuijawwy_libraryreact-native-credit-card-pkgreact-native-jawwy_samplewifi_configuration_packagern-currency-formatterrn-counter-demosemantic-commit-emoji-configreactnativelysenselink-translate-clireact-native-withframework-checkvantiq-react@justinnio/docu-notion@justinnio/website-docu-notionjawwy_library_newjawy_library_v1gamification-jawwy-libraryframework_test_library_sixdee_new_jawwytest_lib_module_aarquickcapture_react_nativern-agora-ios-mgogencygogency-test-2jesh-calculationjest-openapi-coveragejrennsoh88-react-native-scroll-indicatormdathot-updatergraphql-codegen-cli-nuxtkhaled-salem-custom-componentsjordy-frijters-test-libhong1-utilsmonorepo-coverage-badgesopenapi-ts-requestori-bot-react-nativeproject-wajs-dvnocusaurusmysql-to-zodreact-native-bluetooth-device-detectreact-native-datacapture-corereact-native-dimensions-layoutreact-native-bottom-tab-designsreact-native-components-designreact-native-escapereact-native-custome-component-demoreact-native-dummy-viewreact-native-fedlight-dsmreact-native-bleccs-componentsreact-native-check-componentreact-native-dff-components-demoreact-native-dhp-printerreact-native-custom-poccomponentreact-native-custom-poccomponent-nextreact-native-custom-image-carouselreact-native-volume-phisicalreact-native-xprinter-thermal-blenative-date-picker-modulenotion-downloaderreact-native-lib-test-rn-1react-native-library-testing-422522react-native-radio-bic-group-libreact-native-recent-framework-updatereact-native-reanimated-sortable-listreact-native-s-airlinesreact-native-screen-idle-timerreact-native-rn-appreact-native-rn-icons-libraryreact-native-rn-lib-custom-componentsreact-native-rn-common-components-examplereact-native-rn-tolkaplayerreact-native-rn-tolkaplayer-dharmeshreact-native-shared-gesturereact-native-sharing-intentreact-native-sherpa-onnx-offline-ttsreact-native-rtn-ips-poslin-testreact-native-responsive-helperreact-native-remote-updatereact-native-sandycomponentreact-native-geo-locatorreact-native-input-libraryreact-native-klarify-uireact-native-multi-bluetooth-printerreact-native-moosa-lib-for-testreact-native-paynow-generatorreact-native-nyx-printerreact-native-offline-noticereact-native-otp-custom-libraryreact-native-tilt-blereact-native-test-tooltip
6.1.0

17 days ago

5.1.0

2 months ago

6.0.0

2 months ago

5.0.0

1 year ago

4.4.0

1 year ago

4.3.0

2 years ago

4.2.0

2 years ago

4.1.0

2 years ago

4.1.1

2 years ago

2.0.2

3 years ago

3.1.2

2 years ago

3.1.1

2 years ago

3.1.0

2 years ago

3.0.0

2 years ago

4.0.0

2 years ago

2.0.1

3 years ago

2.0.0

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago