-
-
Notifications
You must be signed in to change notification settings - Fork 594
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(node-resolve): prepare for Rollup 3 (#1288)
BREAKING CHANGES: Requires Node 14
- Loading branch information
1 parent
cafc32b
commit ec4d28e
Showing
25 changed files
with
143 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { readFileSync } from 'fs'; | ||
|
||
import json from '@rollup/plugin-json'; | ||
|
||
import { createConfig } from '../../shared/rollup.config.mjs'; | ||
|
||
export default { | ||
...createConfig({ | ||
pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8')) | ||
}), | ||
input: 'src/index.js', | ||
plugins: [json()] | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
const versionRegexp = /\^(\d+\.\d+\.\d+)/g; | ||
|
||
export default function validateVersion(actualVersion, peerDependencyVersion) { | ||
let minMajor = Infinity; | ||
let minMinor = Infinity; | ||
let minPatch = Infinity; | ||
let foundVersion; | ||
// eslint-disable-next-line no-cond-assign | ||
while ((foundVersion = versionRegexp.exec(peerDependencyVersion))) { | ||
const [foundMajor, foundMinor, foundPatch] = foundVersion[1].split('.').map(Number); | ||
if (foundMajor < minMajor) { | ||
minMajor = foundMajor; | ||
minMinor = foundMinor; | ||
minPatch = foundPatch; | ||
} | ||
} | ||
if (!actualVersion) { | ||
throw new Error( | ||
`Insufficient Rollup version: "@rollup/plugin-node-resolve" requires at least rollup@${minMajor}.${minMinor}.${minPatch}.` | ||
); | ||
} | ||
const [major, minor, patch] = actualVersion.split('.').map(Number); | ||
if ( | ||
major < minMajor || | ||
(major === minMajor && (minor < minMinor || (minor === minMinor && patch < minPatch))) | ||
) { | ||
throw new Error( | ||
`Insufficient rollup version: "@rollup/plugin-node-resolve" requires at least rollup@${minMajor}.${minMinor}.${minPatch} but found rollup@${actualVersion}.` | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
10 changes: 6 additions & 4 deletions
10
packages/node-resolve/test/side-effects.js β packages/node-resolve/test/side-effects.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+61 Bytes
(140%)
packages/node-resolve/test/snapshots/dedupe-custom.js.snap
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+80 Bytes
(130%)
packages/node-resolve/test/snapshots/prefer-builtins.js.snap
Binary file not shown.
Binary file not shown.
Binary file not shown.
4 changes: 2 additions & 2 deletions
4
...resolve/test/snapshots/side-effects.js.md β ...esolve/test/snapshots/side-effects.mjs.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Oops, something went wrong.