Socket
Socket
Sign inDemoInstall

esm-resolve

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esm-resolve - npm Package Compare versions

Comparing version 1.0.8 to 1.0.9

.prettierrc.json

17

index.d.ts

@@ -19,7 +19,20 @@ /*

import {ResolverOptions} from './types/index.js';
import { ResolverOptions } from './types/index.js';
// nb. default exports are hard; this exports as both `default` and `buildResolver`
/**
* Builds an import resolver for the given importer file.
*/
export default function buildResolver(importer: string, options?: Partial<ResolverOptions>): (importer: string) => string|undefined;
export default function buildResolver(
importer: string,
options?: Partial<ResolverOptions>,
): (importer: string) => string | undefined;
/**
* Builds an import resolver for the given importer file.
*/
export function buildResolver(
importer: string,
options?: Partial<ResolverOptions>,
): (importer: string) => string | undefined;

27

package.json
{
"name": "esm-resolve",
"version": "1.0.8",
"description": "Resolves ESM imports in JS",
"main": "index.js",
"version": "1.0.9",
"description": "Resolves ESM imports in Node",
"main": "bundle.js",
"exports": {
".": {
"node": {
"import": "./index.js",
"import": "./bundle.js",
"require": "./bundle.cjs"

@@ -15,15 +15,14 @@ }

"type": "module",
"scripts": {
"test": "ava",
"prepublishOnly": "esbuild index.js --bundle --platform=node --target=node12 --outfile=bundle.cjs"
},
"author": "Sam Thorogood <sam.thorogood@gmail.com>",
"repository": "git@github.com:samthor/esm-resolve.git",
"license": "Apache-2",
"license": "Apache-2.0",
"devDependencies": {
"@types/node": "^14.14.25",
"ava": "^3.15.0",
"esbuild": "^0.14.1"
"@types/node": "^20.11.28",
"esbuild": "^0.14.1",
"tsx": "^4.7.1"
},
"types": "index.d.ts"
}
"types": "index.d.ts",
"scripts": {
"test": "npx tsx test/resolve.ts"
}
}

@@ -9,3 +9,3 @@ [![Tests](https://github.com/samthor/esm-resolve/workflows/Tests/badge.svg)](https://github.com/samthor/esm-resolve/actions)

Install and import "esm-resolve" via your favourite package manager.
Install and import "esm-resolve" via your favorite package manager.
Create a resolver based on the importing file.

@@ -15,7 +15,8 @@

import buildResolver from 'esm-resolve';
import { buildResolver } from 'esm-resolve'; // also works
const r = buildResolver('./path/to/js/file.js');
r('./relative'); // './relative.js'
r('foo-test-package-name'); // './node_modules/foo-test-package-name/index.js'
r('./relative'); // './relative.js'
r('foo-test-package-name'); // './node_modules/foo-test-package-name/index.js'
```

@@ -43,6 +44,6 @@

// If there's a file "foo.mjs", this will now work:
r('./foo'); // './foo.mjs'
r('./foo'); // './foo.mjs'
// Or if we're importing package with a node constraint:
r('node-only'); // './node-modules/node-only/build-for-node.js'
```
r('node-only'); // './node-modules/node-only/build-for-node.js'
```

@@ -17,5 +17,3 @@ /*

export interface ResolverOptions {
/**

@@ -28,3 +26,3 @@ * The list of constraints to search for inside a package's exports/imports fields. If

*/
constraints: string[] | string,
constraints: string[] | string;

@@ -37,3 +35,3 @@ /**

*/
allowMissing: boolean,
allowMissing: boolean;

@@ -55,3 +53,3 @@ /**

*/
rewritePeerTypes: boolean,
rewritePeerTypes: boolean;

@@ -64,3 +62,3 @@ /**

*/
allowExportFallback: boolean,
allowExportFallback: boolean;

@@ -73,3 +71,3 @@ /**

*/
includeMainFallback: boolean,
includeMainFallback: boolean;

@@ -82,3 +80,3 @@ /**

*/
matchNakedMjs: boolean,
matchNakedMjs: boolean;

@@ -92,4 +90,3 @@ /**

*/
checkNestedPackages: boolean,
checkNestedPackages: boolean;
}

@@ -22,3 +22,3 @@ /*

*/
export type InternalPackageModuleNode = {[name: string]: InternalPackageModuleNode} | string;
export type InternalPackageModuleNode = { [name: string]: InternalPackageModuleNode } | string;

@@ -29,6 +29,6 @@ /**

export type InternalPackageJson = {
[name: string]: number | string | InternalPackageJson,
exports?: InternalPackageModuleNode,
imports?: InternalPackageModuleNode,
name?: string,
[name: string]: number | string | InternalPackageJson;
exports?: InternalPackageModuleNode;
imports?: InternalPackageModuleNode;
name?: string;
};

@@ -40,3 +40,3 @@

export type InternalPackageJsonNode = {
[name: string]: number | string | InternalPackageJsonNode,
[name: string]: number | string | InternalPackageJsonNode;
};

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc