Skip to content

Commit 96e4cbb

Browse files
committed
fix(data-uri): prepare for Rollup 3
BREAKING CHANGES: Requires Node 14
1 parent 32aa6d2 commit 96e4cbb

File tree

8 files changed

+77
-34
lines changed

8 files changed

+77
-34
lines changed

packages/data-uri/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
## Requirements
1515

16-
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v8.0.0+) and Rollup v1.20.0+.
16+
This plugin requires an [LTS](https://github.com/nodejs/Release) Node version (v14.0.0+) and Rollup v1.20.0+.
1717

1818
## Install
1919

packages/data-uri/package.json

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,14 @@
1313
"author": "shellscape",
1414
"homepage": "https://github.com/rollup/plugins/tree/master/packages/data-uri",
1515
"bugs": "https://github.com/rollup/plugins/issues",
16-
"main": "dist/index.js",
17-
"module": "dist/index.es.js",
16+
"main": "./dist/cjs/index.js",
17+
"module": "./dist/es/index.js",
18+
"exports": {
19+
"require": "./dist/cjs/index.js",
20+
"import": "./dist/es/index.js"
21+
},
1822
"engines": {
19-
"node": ">= 8.0.0"
23+
"node": ">=14.0.0"
2024
},
2125
"scripts": {
2226
"build": "rollup -c",
@@ -32,7 +36,7 @@
3236
"test:ts": "tsc --noEmit"
3337
},
3438
"files": [
35-
"dist",
39+
"dist/**/*.{js,json}",
3640
"types",
3741
"README.md",
3842
"LICENSE"
@@ -47,13 +51,20 @@
4751
"url"
4852
],
4953
"peerDependencies": {
50-
"rollup": "^1.20.0||^2.0.0"
54+
"rollup": "^1.20.0||^2.0.0||^3.0.0"
55+
},
56+
"peerDependenciesMeta": {
57+
"rollup": {
58+
"optional": true
59+
}
60+
},
61+
"dependencies": {
62+
"@rollup/pluginutils": "^4.2.1"
5163
},
5264
"devDependencies": {
53-
"@rollup/plugin-typescript": "^5.0.2",
54-
"@rollup/pluginutils": "^3.0.1",
55-
"rollup": "^2.67.3",
56-
"typescript": "^4.1.2"
65+
"@rollup/plugin-typescript": "^8.5.0",
66+
"rollup": "^3.0.0-7",
67+
"typescript": "^4.8.3"
5768
},
5869
"types": "types/index.d.ts",
5970
"ava": {

packages/data-uri/rollup.config.js

Lines changed: 0 additions & 13 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { readFileSync } from 'fs';
2+
3+
import { createConfig } from '../../shared/rollup.config.mjs';
4+
5+
export default createConfig({
6+
pkg: JSON.parse(readFileSync(new URL('./package.json', import.meta.url), 'utf8'))
7+
});

packages/data-uri/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ export default function dataUri(): Plugin {
6666
} catch (e: any) {
6767
const error: RollupError = {
6868
message: e.toString(),
69-
parserError: e,
69+
cause: e,
7070
plugin: '@rollup/plugin-data-uri',
7171
pluginCode: 'DU$JSON'
7272
};

pnpm-lock.yaml

Lines changed: 45 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

shared/rollup.config.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,14 @@ export function createConfig({ pkg, external = [] }) {
2323
output: [
2424
{
2525
format: 'cjs',
26-
file: pkg.main,
26+
file: pkg.exports.require,
2727
exports: 'named',
2828
footer: 'module.exports = Object.assign(exports.default, exports);',
2929
sourcemap: true
3030
},
3131
{
3232
format: 'es',
33-
file: pkg.module,
33+
file: pkg.exports.import,
3434
plugins: [emitModulePackageFile()],
3535
sourcemap: true
3636
}

tsconfig.base.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"pretty": true,
1313
"sourceMap": true,
1414
"strict": true,
15-
"target": "es2017"
15+
"target": "es2019"
1616
},
1717
"exclude": ["dist", "node_modules", "test/types"]
1818
}

0 commit comments

Comments
 (0)