Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: unjs/mlly
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v1.6.0
Choose a base ref
...
head repository: unjs/mlly
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v1.6.1
Choose a head ref
  • 2 commits
  • 4 files changed
  • 2 contributors

Commits on Feb 21, 2024

  1. chore(release): v1.6.0

    pi0 committed Feb 21, 2024
    Copy the full SHA
    5d5ce86 View commit details

Commits on Feb 23, 2024

  1. fix(parseStaticImport): omit empty import names (#232)

    patzick authored Feb 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    83699b6 View commit details
Showing with 53 additions and 3 deletions.
  1. +44 −0 CHANGELOG.md
  2. +2 −2 package.json
  3. +1 −1 src/analyze.ts
  4. +6 −0 test/imports.test.ts
44 changes: 44 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,50 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

## v1.6.0

[compare changes](https://github.com/unjs/mlly/compare/v1.5.0...v1.6.0)

### 🚀 Enhancements

- Add declaration type in ESMExport ([#227](https://github.com/unjs/mlly/pull/227))
- **utils:** Add `pathToFileURL` ([cdcbcb7](https://github.com/unjs/mlly/commit/cdcbcb7))

### 🔥 Performance

- **resolver:** Stat absolute paths once in fast path ([#229](https://github.com/unjs/mlly/pull/229))
- **resolver:** Remove intermediate `pcall` util ([#230](https://github.com/unjs/mlly/pull/230))
- **resolve:** Enable fast path for file urls ([#231](https://github.com/unjs/mlly/pull/231))

### 🩹 Fixes

- **resolver:** Strictly check input ([778bd73](https://github.com/unjs/mlly/commit/778bd73))

### 💅 Refactors

- **resolver:** Use pathToFileURL from mlly ([982a7a9](https://github.com/unjs/mlly/commit/982a7a9))
- Strict type checks ([77ebe50](https://github.com/unjs/mlly/commit/77ebe50))

### 🏡 Chore

- Lint ([3a932b8](https://github.com/unjs/mlly/commit/3a932b8))
- Update ci script ([08f02d7](https://github.com/unjs/mlly/commit/08f02d7))

### ✅ Tests

- **resolver:** Add test for node bultins ([58407dd](https://github.com/unjs/mlly/commit/58407dd))
- **fileURLToPath, pathToFileURL:** Add windows specific tests ([bfa2bbe](https://github.com/unjs/mlly/commit/bfa2bbe))

### 🤖 CI

- Update scripts ([48acc8d](https://github.com/unjs/mlly/commit/48acc8d))

### ❤️ Contributors

- Pooya Parsa ([@pi0](http://github.com/pi0))
- Pooya ([@pi0](http://github.com/pi0))
- Tamago

## v1.5.0

[compare changes](https://github.com/unjs/mlly/compare/v1.4.2...v1.5.0)
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mlly",
"version": "1.5.0",
"version": "1.6.0",
"description": "Missing ECMAScript module utils for Node.js",
"repository": "unjs/mlly",
"license": "MIT",
@@ -47,4 +47,4 @@
"vitest": "^1.2.2"
},
"packageManager": "pnpm@8.15.1"
}
}
2 changes: 1 addition & 1 deletion src/analyze.ts
Original file line number Diff line number Diff line change
@@ -128,7 +128,7 @@ export function parseStaticImport(
const _match = namedImport.match(/^\s*(\S*) as (\S*)\s*$/);
const source = _match?.[1] || namedImport.trim();
const importName = _match?.[2] || source;
if (!TYPE_RE.test(source)) {
if (source && !TYPE_RE.test(source)) {
namedImports[source] = importName;
}
}
6 changes: 6 additions & 0 deletions test/imports.test.ts
Original file line number Diff line number Diff line change
@@ -49,6 +49,12 @@ const staticTests: Record<
member3: "alias3",
},
},
'import { memberFormattedWithPrettier, } from "module-name";': {
specifier: "module-name",
namedImports: {
memberFormattedWithPrettier: "memberFormattedWithPrettier",
},
},
'import { member1, /* member0point5, */ member2 as alias2, member3 as alias3 } from "module-name";':
{
specifier: "module-name",