From 5b2269f24b152cc805d8fb84c7e969f185817cf5 Mon Sep 17 00:00:00 2001 From: Denys Dovhan Date: Sun, 16 Jun 2024 22:18:19 +0300 Subject: [PATCH] fix: migrate rollup to esm modules --- package-lock.json | 25 +++++++++++++++++++++---- package.json | 1 + rollup.config.js => rollup.config.mjs | 8 +++++--- 3 files changed, 27 insertions(+), 7 deletions(-) rename rollup.config.js => rollup.config.mjs (89%) diff --git a/package-lock.json b/package-lock.json index 6e139f1..2e2a4ef 100644 --- a/package-lock.json +++ b/package-lock.json @@ -37,6 +37,7 @@ "postcss-preset-env": "^9.1.2", "prettier": "^2.0.5", "rollup": "^2.7.6", + "rollup-plugin-html-literals": "^1.1.8", "rollup-plugin-minify-html-literals": "^1.2.6", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-postcss-lit": "^2.0.0", @@ -3169,9 +3170,9 @@ } }, "node_modules/@rollup/pluginutils": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.0.2.tgz", - "integrity": "sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==", + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-5.1.0.tgz", + "integrity": "sha512-XTIWOPPcpvyKI6L1NHo0lFlCyznUEyPmPY1mc3KpPVDYulHSTvyeLNVW00QTLIAFNhR3kYnJTQHeGqU4M3n09g==", "dev": true, "dependencies": { "@types/estree": "^1.0.0", @@ -3182,7 +3183,7 @@ "node": ">=14.0.0" }, "peerDependencies": { - "rollup": "^1.20.0||^2.0.0||^3.0.0" + "rollup": "^1.20.0||^2.0.0||^3.0.0||^4.0.0" }, "peerDependenciesMeta": { "rollup": { @@ -14884,6 +14885,22 @@ "fsevents": "~2.3.2" } }, + "node_modules/rollup-plugin-html-literals": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/rollup-plugin-html-literals/-/rollup-plugin-html-literals-1.1.8.tgz", + "integrity": "sha512-M9KmEalEVWJ6Rk55hwmAmTdKibdvrY7LbmGLiJg+hLPUS2W1xEKgTrkucyvOov+SgE7SM37qEd4Uc5sjs3nWuQ==", + "dev": true, + "dependencies": { + "@rollup/pluginutils": "^5.0.4", + "minify-html-literals": "^1.3.5" + }, + "engines": { + "node": ">=16" + }, + "peerDependencies": { + "rollup": "^1.x.x||^2.x.x||^3.x.x||^4.x.x" + } + }, "node_modules/rollup-plugin-minify-html-literals": { "version": "1.2.6", "resolved": "https://registry.npmjs.org/rollup-plugin-minify-html-literals/-/rollup-plugin-minify-html-literals-1.2.6.tgz", diff --git a/package.json b/package.json index 486bd8e..ff10335 100644 --- a/package.json +++ b/package.json @@ -52,6 +52,7 @@ "postcss-preset-env": "^9.1.2", "prettier": "^2.0.5", "rollup": "^2.7.6", + "rollup-plugin-html-literals": "^1.1.8", "rollup-plugin-minify-html-literals": "^1.2.6", "rollup-plugin-postcss": "^4.0.2", "rollup-plugin-postcss-lit": "^2.0.0", diff --git a/rollup.config.js b/rollup.config.mjs similarity index 89% rename from rollup.config.js rename to rollup.config.mjs index 3514ab3..8e05076 100644 --- a/rollup.config.js +++ b/rollup.config.mjs @@ -1,5 +1,5 @@ /* eslint-env node */ -import pkg from './package.json'; +import { createRequire } from 'node:module'; import commonjs from '@rollup/plugin-commonjs'; import nodeResolve from '@rollup/plugin-node-resolve'; import json from '@rollup/plugin-json'; @@ -10,10 +10,13 @@ import postcss from 'rollup-plugin-postcss'; import postcssPresetEnv from 'postcss-preset-env'; import postcssLit from 'rollup-plugin-postcss-lit'; import { terser } from 'rollup-plugin-terser'; -import minifyLiterals from 'rollup-plugin-minify-html-literals'; +import minifyLiterals from 'rollup-plugin-html-literals'; import replace from '@rollup/plugin-replace'; import serve from 'rollup-plugin-serve'; +const require = createRequire(import.meta.url); +const pkg = require('./package.json'); + const IS_DEV = process.env.ROLLUP_WATCH; const serverOptions = { @@ -36,7 +39,6 @@ const plugins = [ }, preventAssignment: true, }), - postcss({ plugins: [ postcssPresetEnv({