https://github.com/flex-development/mlly
ECMAScript module utilities
https://github.com/flex-development/mlly
ecmascript esm esmodules module typescript
Last synced: 2 months ago
JSON representation
ECMAScript module utilities
- Host: GitHub
- URL: https://github.com/flex-development/mlly
- Owner: flex-development
- License: bsd-3-clause
- Created: 2022-10-03T04:28:47.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-05-27T22:42:46.000Z (about 1 year ago)
- Last Synced: 2024-05-28T08:15:50.860Z (about 1 year ago)
- Topics: ecmascript, esm, esmodules, module, typescript
- Language: TypeScript
- Homepage: https://github.com/flex-development/mlly
- Size: 6.51 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 12
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Funding: .github/funding.yml
- License: LICENSE.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# \:gear: mlly
[](https://github.com/flex-development/mlly/releases/latest)
[](https://npmjs.com/package/@flex-development/mlly)
[](https://codecov.io/gh/flex-development/mlly)
[](https://github.com/voxpelli/badges-cjs-esm)
[](LICENSE.md)
[](https://conventionalcommits.org)
[](https://typescriptlang.org)
[](https://vitest.dev)
[](https://yarnpkg.com)[ECMAScript module][node-esm] utilities.
## Contents
- [What is this?](#what-is-this)
- [Install](#install)
- [Use](#use)
- [API](#api)
- [Types](#types)
- [Contribute](#contribute)## What is this?
`mlly` is a set of [ECMAScript module][node-esm] (ESM) utilities. It exposes several tools to bridge the gap between
developer experience and the current state of ECMAScript modules.## Install
This package is [ESM only][esm].
In Node.js (version 18+) with [yarn][]:
```sh
yarn add @flex-development/mlly
```
See Git - Protocols | Yarn
for details regarding installing from Git.
In Deno with [`esm.sh`][esmsh]:
```ts
import { resolveModule } from 'https://esm.sh/@flex-development/mlly'
```In browsers with [`esm.sh`][esmsh]:
```html
import { resolveModule } from 'https://esm.sh/@flex-development/mlly'
```
## Use
```js
import {
canParseUrl,
cwd,
defaultConditions,
defaultExtensions,
defaultMainFields,
extensionFormatMap,
formats,
getSource,
isAbsoluteSpecifier,
isArrayIndex,
isBareSpecifier,
isDirectory,
isFile,
isImportsSubpath,
isRelativeSpecifier,
legacyMainResolve,
legacyMainResolveSync,
lookupPackageScope,
moduleResolve,
moduleResolveSync,
packageExportsResolve,
packageExportsResolveSync,
packageImportsExportsResolve,
packageImportsExportsResolveSync,
packageImportsResolve,
packageImportsResolveSync,
packageResolve,
packageResolveSync,
packageSelfResolve,
packageSelfResolveSync,
packageTargetResolve,
packageTargetResolveSync,
patternKeyCompare,
patternMatch,
readPackageJson,
resolveAlias,
resolveModule,
resolver,
root,
toRelativeSpecifier,
toUrl
} from '@flex-development/mlly'
```## API
This package exports the following identifiers:
- [`canParseUrl`](./src/lib/can-parse-url.mts)
- [`cwd`](./src/lib/cwd.mts)
- [`defaultConditions`](./src/lib/default-conditions.mts)
- [`defaultExtensions`](./src/lib/default-extensions.mts)
- [`defaultMainFields`](./src/lib/default-main-fields.mts)
- [`extensionFormatMap`](./src/lib/extension-format-map.mts)
- [`formats`](./src/lib/formats.mts)
- [`getSource`](./src/lib/get-source.mts)
- [`isAbsoluteSpecifier`](./src/lib/is-absolute-specifier.mts)
- [`isArrayIndex`](./src/lib/is-array-index.mts)
- [`isBareSpecifier`](./src/lib/is-bare-specifier.mts)
- [`isDirectory`](./src/lib/is-directory.mts)
- [`isFile`](./src/lib/is-file.mts)
- [`isImportsSubpath`](./src/lib/is-imports-subpath.mts)
- [`isRelativeSpecifier`](./src/lib/is-relative-specifier.mts)
- [`lookupPackageScope`](./src/lib/lookup-package-scope.mts)
- [`patternKeyCompare`](./src/lib/pattern-key-compare.mts)
- [`patternMatch`](./src/lib/pattern-match.mts)
- [`readPackageJson`](./src/lib/read-package-json.mts)
- [`resolveAlias`](./src/lib/resolve-alias.mts)
- [`resolveModule`](./src/lib/resolve-module.mts)
- [`resolver`](./src/lib/resolver.mts)
- `legacyMainResolve`
- `legacyMainResolveSync`
- `moduleResolve`
- `moduleResolveSync`
- `packageExportsResolve`
- `packageExportsResolveSync`
- `packageImportsExportsResolve`
- `packageImportsExportsResolveSync`
- `packageImportsResolve`
- `packageImportsResolveSync`
- `packageResolve`
- `packageResolveSync`
- `packageSelfResolve`
- `packageSelfResolveSync`
- `packageTargetResolve`
- `packageTargetResolveSync`
- [`root`](./src/lib/root.mts)
- [`toRelativeSpecifier`](./src/lib/to-relative-specifier.mts)
- [`toUrl`](./src/lib/to-url.mts)There is no default export.
## Types
This package is fully typed with [TypeScript][].
### Interfaces
- [`Aliases`](src/interfaces/aliases.mts)
- [`FileSystem`](src/interfaces/file-system.mts)
- [`MainFieldMap`](src/interfaces/main-field-map.mts)
- [`ModuleFormatMap`](src/interfaces/module-format-map.mts)
- [`ResolveAliasOptions`](src/interfaces/options-resolve-alias.mts)
- [`ResolveModuleOptions`](src/interfaces/options-resolve-module.mts)
- [`ProtocolMap`](src/interfaces/protocol-map.mts)
- [`Stats`](src/interfaces/stats.mts)### Type Aliases
- [`ChangeExtFn`](src/types/change-ext-fn.mts)
- [`MainField`](src/types/main-field.mts)
- [`ModuleFormat`](src/types/module-format.mts)
- [`ModuleId`](src/types/module-id.mts)
- [`Numeric`](src/types/numeric.mts)
- [`PatternKeyCompareResult`](src/types/pattern-key-compare-result.mts)
- [`PatternMatch`](src/types/pattern-match.mts)
- [`Protocol`](src/types/protocol.mts)## Contribute
See [`CONTRIBUTING.md`](CONTRIBUTING.md).
This project has a [code of conduct](./CODE_OF_CONDUCT.md). By interacting with this repository, organization, or
community you agree to abide by its terms.[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
[esmsh]: https://esm.sh
[node-esm]: https://nodejs.org/api/esm.html
[typescript]: https://www.typescriptlang.org
[yarn]: https://yarnpkg.com