Comparing version 0.1.7 to 0.2.0
@@ -5,2 +5,16 @@ # Changelog | ||
## [0.2.0](https://github.com/unjs/mlly/compare/v0.1.7...v0.2.0) (2021-07-23) | ||
### ⚠ BREAKING CHANGES | ||
* directly use a url to create cjs context | ||
### Features | ||
* rewrite error stack for inline scripts ([7357aeb](https://github.com/unjs/mlly/commit/7357aeb4b7b6eca234f8622fd8d2d833c1129518)) | ||
* directly use a url to create cjs context ([e7012fb](https://github.com/unjs/mlly/commit/e7012fb38015fd3a0d38f40829b3e8042c8e7f1f)) | ||
### [0.1.7](https://github.com/unjs/mlly/compare/v0.1.6...v0.1.7) (2021-07-23) | ||
@@ -7,0 +21,0 @@ |
@@ -8,3 +8,3 @@ // CommonJS | ||
export function createCommonJS (importMeta: ImportMeta) : CommonjsContext | ||
export function createCommonJS (url: string) : CommonjsContext | ||
@@ -11,0 +11,0 @@ // Resolve |
{ | ||
"name": "mlly", | ||
"version": "0.1.7", | ||
"version": "0.2.0", | ||
"description": "Missing ECMAScript module utils for Node.js", | ||
@@ -5,0 +5,0 @@ "repository": "unjs/mlly", |
@@ -6,3 +6,3 @@ # 🤝 mlly | ||
## Install | ||
## Usage | ||
@@ -24,5 +24,23 @@ > This package is ESM only. Node.js 12+ is needed to use it and it must be imported instead of required. | ||
```js | ||
import {} from 'mlly' | ||
import { } from 'mlly' | ||
``` | ||
## At a glance | ||
While ESM Modules are evolving in Node.js ecosystem, there are still many required features that are still experimental or missing. This package tries to fill in the gap for them. | ||
- Utils to create compatible CommonJS context | ||
- Resolve Utils | ||
- Exposed from native Node.js implementation | ||
- Windows paths normalized | ||
- Supporting custom `extensions` and `/index` resolution | ||
- Supporting custom `conditions` | ||
- Module Evaluation | ||
- Allow evaluating modules using `data:` imports | ||
- Automatic import rewrite to resolved path using static analyzes | ||
- Allow bypass ESM Cache | ||
- Stack-trace support | ||
- `.json` loader | ||
- Multiple composable module utils exposed | ||
## CommonJS Context | ||
@@ -37,5 +55,7 @@ | ||
const { __dirname, __filename, require } = createCommonJS(import.meta) | ||
const { __dirname, __filename, require } = createCommonJS(import.meta.url) | ||
``` | ||
Note: `require` and `require.resolve` implementation are lazy functions. [`createRequire`](https://nodejs.org/api/module.html#module_module_createrequire_filename) will be called on first usage. | ||
## Resolving Modules | ||
@@ -42,0 +62,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16501
206
224