Gathering detailed insights and metrics for cosmiconfig-typescript-loader
Gathering detailed insights and metrics for cosmiconfig-typescript-loader
Gathering detailed insights and metrics for cosmiconfig-typescript-loader
Gathering detailed insights and metrics for cosmiconfig-typescript-loader
TypeScript config file handler for cosmiconfig
npm install cosmiconfig-typescript-loader
87.9
Supply Chain
93.4
Quality
81.4
Maintenance
100
Vulnerability
99.3
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
30 Stars
328 Commits
7 Forks
2 Watching
3 Branches
3 Contributors
Updated on 16 Nov 2024
JavaScript (50.44%)
TypeScript (49.56%)
Cumulative downloads
Total Downloads
Last day
-4.6%
803,592
Compared to previous day
Last week
1.6%
4,552,173
Compared to previous week
Last month
8.2%
19,028,620
Compared to previous month
Last year
3.7%
192,493,808
Compared to previous year
1
3
⚙️🚀 TypeScript config file support for cosmiconfig
Simply add TypeScriptLoader
to the list of loaders for the .ts
file type, and await
loading:
1import { cosmiconfig } from "cosmiconfig"; 2import { TypeScriptLoader } from "cosmiconfig-typescript-loader"; 3 4const moduleName = "module"; 5const explorer = cosmiconfig("test", { 6 searchPlaces: [ 7 "package.json", 8 `.${moduleName}rc`, 9 `.${moduleName}rc.json`, 10 `.${moduleName}rc.yaml`, 11 `.${moduleName}rc.yml`, 12 `.${moduleName}rc.js`, 13 `.${moduleName}rc.ts`, 14 `.${moduleName}rc.cjs`, 15 `${moduleName}.config.js`, 16 `${moduleName}.config.ts`, 17 `${moduleName}.config.cjs`, 18 ], 19 loaders: { 20 ".ts": TypeScriptLoader(), 21 }, 22}); 23 24const cfg = await explorer.load("./");
Or more simply if you only support loading of a TypeScript based configuration file:
1import { cosmiconfig } from "cosmiconfig"; 2import { TypeScriptLoader } from "cosmiconfig-typescript-loader"; 3 4const moduleName = "module"; 5const explorer = cosmiconfig("test", { 6 loaders: { 7 ".ts": TypeScriptLoader(), 8 }, 9}); 10 11const cfg = await explorer.load("./amazing.config.ts");
With the release of Jiti 2, the synchronous loader has now been deprecated. It can still be used by using the TypeScriptLoaderSync
export:
1import { cosmiconfig } from "cosmiconfig"; 2import { TypeScriptLoaderSync } from "cosmiconfig-typescript-loader"; 3 4const moduleName = "module"; 5const explorer = cosmiconfig("test", { 6 loaders: { 7 ".ts": TypeScriptLoaderSync(), 8 }, 9}); 10 11const 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:
No vulnerabilities found.
No security vulnerabilities found.