Gathering detailed insights and metrics for ts-pnp
Gathering detailed insights and metrics for ts-pnp
Gathering detailed insights and metrics for ts-pnp
Gathering detailed insights and metrics for ts-pnp
npm install ts-pnp
Module System
Unable to determine the module system for this package.
Min. Node Version
Typescript Support
Node Version
NPM Version
67 Stars
20 Commits
9 Forks
5 Watching
1 Branches
2 Contributors
Updated on 19 Jul 2024
JavaScript (98.75%)
TypeScript (1.25%)
Cumulative downloads
Total Downloads
Last day
-6.4%
735,518
Compared to previous day
Last week
2.1%
4,155,071
Compared to previous week
Last month
3.7%
17,733,955
Compared to previous month
Last year
-30.4%
224,826,085
Compared to previous year
1
This plugin is also available for Webpack (pnp-webpack-plugin), Jest (jest-pnp-resolver), and Rollup (rollup-plugin-pnp-resolve)
yarn add -D ts-pnp
Note that ts-pnp
is a low-level package - you shouldn't have to use it unless you're writing a TS compiler host. If you just want to write TypeScript and have it Just Work™, take a look at pnp-webpack-plugin
instead.
This package exports a function that can be used to implement the resolveModuleName
hook from CompilerHost
. It mimics the interface from the one you'd typically use and, as all other PnP plugins, works just fine whether your application is actually running under PnP or not.
1import {resolveModuleName} from 'ts-pnp';
2import * as ts from 'typescript';
3
4function createCompilerHost(
5 compilerOptions: ts.CompilerOptions,
6): ts.CompilerHost {
7 const compilerHost = {
8 resolveModuleNames,
9 resolveTypeReferenceDirectives,
10 };
11
12 return compilerHost;
13
14 function resolveModuleNames(moduleNames: string[], containingFile: string) {
15 return moduleNames.map(moduleName => {
16 return resolveModuleName(moduleName, containingFile, compilerOptions, compilerHost, ts.resolveModuleName).resolvedModule;
17 });
18 }
19
20 function resolveTypeReferenceDirectives(typeDirectiveNames: string[], containingFile: string) {
21 return typeDirectiveNames.map(typeDirectiveName => {
22 return resolveModuleName(typeDirectiveName, containingFile, compilerOptions, compilerHost, ts.resolveTypeReferenceDirective).resolvedTypeReferenceDirective;
23 });
24 }
25}
Copyright © 2016 Maël Nison
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 1/19 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More