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: v0.5.12
Choose a base ref
...
head repository: unjs/mlly
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.5.13
Choose a head ref
  • 3 commits
  • 4 files changed
  • 3 contributors

Commits on Aug 18, 2022

  1. Copy the full SHA
    ac7c37c View commit details
  2. chore(deps): update pnpm to v7.9.3 (#66)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Aug 18, 2022
    Copy the full SHA
    83e8df9 View commit details
  3. chore(release): 0.5.13

    pi0 committed Aug 18, 2022
    Copy the full SHA
    bb0d4a6 View commit details
Showing with 13 additions and 4 deletions.
  1. +7 −0 CHANGELOG.md
  2. +2 −2 package.json
  3. +1 −1 src/analyze.ts
  4. +3 −1 test/exports.test.ts
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,6 +2,13 @@

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.

### [0.5.13](https://github.com/unjs/mlly/compare/v0.5.12...v0.5.13) (2022-08-18)


### Features

* **findExports:** support typescript enum exports ([#69](https://github.com/unjs/mlly/issues/69)) ([ac7c37c](https://github.com/unjs/mlly/commit/ac7c37c079cdfa602d9e0d908292f51cd0472406))

### [0.5.12](https://github.com/unjs/mlly/compare/v0.5.11...v0.5.12) (2022-08-12)


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": "0.5.12",
"version": "0.5.13",
"description": "Missing ECMAScript module utils for Node.js",
"repository": "unjs/mlly",
"license": "MIT",
@@ -40,5 +40,5 @@
"unbuild": "latest",
"vitest": "latest"
},
"packageManager": "pnpm@7.9.0"
"packageManager": "pnpm@7.9.3"
}
2 changes: 1 addition & 1 deletion src/analyze.ts
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@ export interface DefaultExport extends ESMExport {
export const ESM_STATIC_IMPORT_RE = /(?<=\s|^|;)import\s*(["'\s]*(?<imports>[\w*${}\n\r\t, /]+)from\s*)?["']\s*(?<specifier>(?<="\s*)[^"]*[^"\s](?=\s*")|(?<='\s*)[^']*[^'\s](?=\s*'))\s*["'][\s;]*/gm
export const DYNAMIC_IMPORT_RE = /import\s*\((?<expression>(?:[^)(]+|\((?:[^)(]+|\([^)(]*\))*\))*)\)/gm

export const EXPORT_DECAL_RE = /\bexport\s+(?<declaration>(async function|function|let|const|var|class))\s+(?<name>[\w$_]+)/g
export const EXPORT_DECAL_RE = /\bexport\s+(?<declaration>(async function|function|let|const enum|const|enum|var|class))\s+(?<name>[\w$_]+)/g
const EXPORT_NAMED_RE = /\bexport\s+{(?<exports>[^}]+?)(?:[,\s]*)}(\s*from\s*["']\s*(?<specifier>(?<="\s*)[^"]*[^"\s](?=\s*")|(?<='\s*)[^']*[^'\s](?=\s*'))\s*["'][^\n]*)?/g
const EXPORT_STAR_RE = /\bexport\s*(\*)(\s*as\s+(?<name>[\w$_]+)\s+)?\s*(\s*from\s*["']\s*(?<specifier>(?<="\s*)[^"]*[^"\s](?=\s*")|(?<='\s*)[^']*[^'\s](?=\s*'))\s*["'][^\n]*)?/g
const EXPORT_DEFAULT_RE = /\bexport\s+default\s+/g
4 changes: 3 additions & 1 deletion test/exports.test.ts
Original file line number Diff line number Diff line change
@@ -18,7 +18,9 @@ describe('findExports', () => {
'export * from "./other"': { type: 'star', specifier: './other' },
'export * as foo from "./other"': { type: 'star', specifier: './other', name: 'foo' },
// eslint-disable-next-line no-template-curly-in-string
'const a = `<div${JSON.stringify({ class: 42 })}>`;\nexport default true;': { type: 'default', name: 'default', names: ['default'] }
'const a = `<div${JSON.stringify({ class: 42 })}>`;\nexport default true;': { type: 'default', name: 'default', names: ['default'] },
'export const enum foo { a = \'xx\' }': { type: 'declaration', names: ['foo'] },
'export enum bar { a = \'xx\' }': { type: 'declaration', names: ['bar'] }
}

for (const [input, test] of Object.entries(tests)) {