From 8d24e3c52493e503cb9cfc23da27564074fe31bf Mon Sep 17 00:00:00 2001 From: Dylan Staley <88163+dstaley@users.noreply.github.com> Date: Wed, 13 Mar 2024 15:07:56 -0700 Subject: [PATCH 1/4] feat: remove rollup --- package-lock.json | 313 +------------------------- package.json | 19 +- rollup.config.js | 92 -------- src/index.tsx | 2 +- src/jsx-runtime.cjs.d.ts | 8 - src/plugins/remove-imports-exports.ts | 2 +- src/rsc.tsx | 4 +- src/serialize.ts | 6 +- tsconfig.json | 8 +- 9 files changed, 18 insertions(+), 436 deletions(-) delete mode 100644 rollup.config.js delete mode 100644 src/jsx-runtime.cjs.d.ts diff --git a/package-lock.json b/package-lock.json index c994a65..57116f8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,14 +15,10 @@ "vfile-matter": "^5.0.0" }, "devDependencies": { - "@babel/code-frame": "^7.16.0", + "@babel/code-frame": "^7.23.5", "@changesets/changelog-github": "^0.5.0", "@changesets/cli": "^2.27.1", "@hashicorp/remark-plugins": "^3.2.1", - "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.0.6", - "@rollup/plugin-typescript": "^8.3.0", "@types/babel__code-frame": "^7.0.3", "@types/cross-spawn": "^6.0.2", "@types/jest": "^29.5.12", @@ -45,10 +41,8 @@ "react-dom": "^18.2.0", "release": "^6.3.0", "rmfr": "^2.0.0", - "rollup": "^2.59.0", "serve-handler": "^6.1.3", "tree-kill": "^1.2.2", - "tslib": "^2.3.1", "typescript": "^5.4.2", "unist-util-remove": "^3.1.0" }, @@ -3192,100 +3186,6 @@ "node": ">= 4.5.0" } }, - "node_modules/@rollup/plugin-commonjs": { - "version": "21.0.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-21.0.1.tgz", - "integrity": "sha512-EA+g22lbNJ8p5kuZJUYyhhDK7WgJckW5g4pNN7n4mAFUM96VuwUnNT3xr2Db2iCZPI1pJPbGyfT5mS9T1dHfMg==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^3.1.0", - "commondir": "^1.0.1", - "estree-walker": "^2.0.1", - "glob": "^7.1.6", - "is-reference": "^1.2.1", - "magic-string": "^0.25.7", - "resolve": "^1.17.0" - }, - "engines": { - "node": ">= 8.0.0" - }, - "peerDependencies": { - "rollup": "^2.38.3" - } - }, - "node_modules/@rollup/plugin-commonjs/node_modules/estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true - }, - "node_modules/@rollup/plugin-json": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", - "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^3.0.8" - }, - "peerDependencies": { - "rollup": "^1.20.0 || ^2.0.0" - } - }, - "node_modules/@rollup/plugin-node-resolve": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.0.6.tgz", - "integrity": "sha512-sFsPDMPd4gMqnh2gS0uIxELnoRUp5kBl5knxD2EO0778G1oOJv4G1vyT2cpWz75OU2jDVcXhjVUuTAczGyFNKA==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^3.1.0", - "@types/resolve": "1.17.1", - "builtin-modules": "^3.1.0", - "deepmerge": "^4.2.2", - "is-module": "^1.0.0", - "resolve": "^1.19.0" - }, - "engines": { - "node": ">= 10.0.0" - }, - "peerDependencies": { - "rollup": "^2.42.0" - } - }, - "node_modules/@rollup/plugin-typescript": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.3.0.tgz", - "integrity": "sha512-I5FpSvLbtAdwJ+naznv+B4sjXZUcIvLLceYpITAn7wAP8W0wqc5noLdGIp9HGVntNhRWXctwPYrSSFQxtl0FPA==", - "dev": true, - "dependencies": { - "@rollup/pluginutils": "^3.1.0", - "resolve": "^1.17.0" - }, - "engines": { - "node": ">=8.0.0" - }, - "peerDependencies": { - "rollup": "^2.14.0", - "tslib": "*", - "typescript": ">=3.7.0" - } - }, - "node_modules/@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", - "dev": true, - "dependencies": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" - }, - "engines": { - "node": ">= 8.0.0" - }, - "peerDependencies": { - "rollup": "^1.20.0||^2.0.0" - } - }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -3547,15 +3447,6 @@ "@types/react": "*" } }, - "node_modules/@types/resolve": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", - "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", - "dev": true, - "dependencies": { - "@types/node": "*" - } - }, "node_modules/@types/rimraf": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.0.tgz", @@ -4375,18 +4266,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "node_modules/builtin-modules": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", - "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", - "dev": true, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -4905,12 +4784,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, "node_modules/compare-versions": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", @@ -6242,12 +6115,6 @@ "resolved": "https://registry.npmjs.org/@types/unist/-/unist-3.0.2.tgz", "integrity": "sha512-dqId9J8K/vGi5Zr7oo212BGii5m3q5Hxlkwy3WpYuKPklmBEvsbMYYyLxAQpSffdLl/gdW0XUpKWFvYmyoWCoQ==" }, - "node_modules/estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, "node_modules/exec-sh": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.6.tgz", @@ -8361,12 +8228,6 @@ "url": "https://github.com/sponsors/wooorm" } }, - "node_modules/is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", - "dev": true - }, "node_modules/is-negative-zero": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", @@ -8439,15 +8300,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-reference": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", - "dev": true, - "dependencies": { - "@types/estree": "*" - } - }, "node_modules/is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -11179,15 +11031,6 @@ "node": ">=10" } }, - "node_modules/magic-string": { - "version": "0.25.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", - "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", - "dev": true, - "dependencies": { - "sourcemap-codec": "^1.4.4" - } - }, "node_modules/make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -14674,21 +14517,6 @@ "rimraf": "bin.js" } }, - "node_modules/rollup": { - "version": "2.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.59.0.tgz", - "integrity": "sha512-l7s90JQhCQ6JyZjKgo7Lq1dKh2RxatOM+Jr6a9F7WbS9WgKbocyUSeLmZl8evAse7y96Ae98L2k1cBOwWD8nHw==", - "dev": true, - "bin": { - "rollup": "dist/bin/rollup" - }, - "engines": { - "node": ">=10.0.0" - }, - "optionalDependencies": { - "fsevents": "~2.3.2" - } - }, "node_modules/rsvp": { "version": "4.8.5", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", @@ -15711,12 +15539,6 @@ "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", "dev": true }, - "node_modules/sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "dev": true - }, "node_modules/space-separated-tokens": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", @@ -20060,73 +19882,6 @@ } } }, - "@rollup/plugin-commonjs": { - "version": "21.0.1", - "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-21.0.1.tgz", - "integrity": "sha512-EA+g22lbNJ8p5kuZJUYyhhDK7WgJckW5g4pNN7n4mAFUM96VuwUnNT3xr2Db2iCZPI1pJPbGyfT5mS9T1dHfMg==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.1.0", - "commondir": "^1.0.1", - "estree-walker": "^2.0.1", - "glob": "^7.1.6", - "is-reference": "^1.2.1", - "magic-string": "^0.25.7", - "resolve": "^1.17.0" - }, - "dependencies": { - "estree-walker": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-2.0.2.tgz", - "integrity": "sha512-Rfkk/Mp/DL7JVje3u18FxFujQlTNR2q6QfMSMB7AvCBx91NGj/ba3kCfza0f6dVDbw7YlRf/nDrn7pQrCCyQ/w==", - "dev": true - } - } - }, - "@rollup/plugin-json": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-json/-/plugin-json-4.1.0.tgz", - "integrity": "sha512-yfLbTdNS6amI/2OpmbiBoW12vngr5NW2jCJVZSBEz+H5KfUJZ2M7sDjk0U6GOOdCWFVScShte29o9NezJ53TPw==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.0.8" - } - }, - "@rollup/plugin-node-resolve": { - "version": "13.0.6", - "resolved": "https://registry.npmjs.org/@rollup/plugin-node-resolve/-/plugin-node-resolve-13.0.6.tgz", - "integrity": "sha512-sFsPDMPd4gMqnh2gS0uIxELnoRUp5kBl5knxD2EO0778G1oOJv4G1vyT2cpWz75OU2jDVcXhjVUuTAczGyFNKA==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.1.0", - "@types/resolve": "1.17.1", - "builtin-modules": "^3.1.0", - "deepmerge": "^4.2.2", - "is-module": "^1.0.0", - "resolve": "^1.19.0" - } - }, - "@rollup/plugin-typescript": { - "version": "8.3.0", - "resolved": "https://registry.npmjs.org/@rollup/plugin-typescript/-/plugin-typescript-8.3.0.tgz", - "integrity": "sha512-I5FpSvLbtAdwJ+naznv+B4sjXZUcIvLLceYpITAn7wAP8W0wqc5noLdGIp9HGVntNhRWXctwPYrSSFQxtl0FPA==", - "dev": true, - "requires": { - "@rollup/pluginutils": "^3.1.0", - "resolve": "^1.17.0" - } - }, - "@rollup/pluginutils": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/@rollup/pluginutils/-/pluginutils-3.1.0.tgz", - "integrity": "sha512-GksZ6pr6TpIjHm8h9lSQ8pi8BE9VeubNT0OMJ3B5uZJ8pz73NPiqOtCog/x2/QzM1ENChPKxMDhiQuRHsqc+lg==", - "dev": true, - "requires": { - "@types/estree": "0.0.39", - "estree-walker": "^1.0.1", - "picomatch": "^2.2.2" - } - }, "@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -20388,15 +20143,6 @@ "@types/react": "*" } }, - "@types/resolve": { - "version": "1.17.1", - "resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-1.17.1.tgz", - "integrity": "sha512-yy7HuzQhj0dhGpD8RLXSZWEkLsV9ibvxvi6EiJ3bkqLAO1RGo0WbkWQiwpRlSFymTJRz0d3k5LM3kkx8ArDbLw==", - "dev": true, - "requires": { - "@types/node": "*" - } - }, "@types/rimraf": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/rimraf/-/rimraf-3.0.0.tgz", @@ -21036,12 +20782,6 @@ "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ==", "dev": true }, - "builtin-modules": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-3.2.0.tgz", - "integrity": "sha512-lGzLKcioL90C7wMczpkY0n/oART3MbBa8R9OFGE1rJxoVI86u4WAGfEk8Wjv10eKSyTHVGkSo3bvBylCEtk7LA==", - "dev": true - }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -21441,12 +21181,6 @@ "resolved": "https://registry.npmjs.org/comma-separated-tokens/-/comma-separated-tokens-2.0.3.tgz", "integrity": "sha512-Fu4hJdvzeylCfQPp9SGWidpzrMs7tTrlu6Vb8XGaRGck8QSNZJJp538Wrb60Lax4fPwR64ViY468OIUTbRlGZg==" }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, "compare-versions": { "version": "3.6.0", "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", @@ -22454,12 +22188,6 @@ } } }, - "estree-walker": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-1.0.1.tgz", - "integrity": "sha512-1fMXF3YP4pZZVozF8j/ZLfvnR8NSIljt56UhbZ5PeeDmmGHpgpdwQt7ITlGvYaQukCvuBRMLEiKiYC+oeIg4cg==", - "dev": true - }, "exec-sh": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/exec-sh/-/exec-sh-0.3.6.tgz", @@ -24094,12 +23822,6 @@ "integrity": "sha512-gyPJuv83bHMpocVYoqof5VDiZveEoGoFL8m3BXNb2VW8Xs+rz9kqO8LOQ5DH6EsuvilT1ApazU0pyl+ytbPtlw==", "dev": true }, - "is-module": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", - "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", - "dev": true - }, "is-negative-zero": { "version": "2.0.3", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.3.tgz", @@ -24148,15 +23870,6 @@ "isobject": "^3.0.1" } }, - "is-reference": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/is-reference/-/is-reference-1.2.1.tgz", - "integrity": "sha512-U82MsXXiFIrjCK4otLT+o2NA2Cd2g5MLoOVXUZjIOhLurrRxpEXzI8O0KZHr3IjLvlAH1kTPYSuqer5T9ZVBKQ==", - "dev": true, - "requires": { - "@types/estree": "*" - } - }, "is-regex": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.1.4.tgz", @@ -26204,15 +25917,6 @@ "yallist": "^4.0.0" } }, - "magic-string": { - "version": "0.25.7", - "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.7.tgz", - "integrity": "sha512-4CrMT5DOHTDk4HYDlzmwu4FVCcIYI8gauveasrdCu2IKIFOJ3f0v/8MDGJCDL9oD2ppz/Av1b0Nj345H9M+XIA==", - "dev": true, - "requires": { - "sourcemap-codec": "^1.4.4" - } - }, "make-dir": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-4.0.0.tgz", @@ -28744,15 +28448,6 @@ } } }, - "rollup": { - "version": "2.59.0", - "resolved": "https://registry.npmjs.org/rollup/-/rollup-2.59.0.tgz", - "integrity": "sha512-l7s90JQhCQ6JyZjKgo7Lq1dKh2RxatOM+Jr6a9F7WbS9WgKbocyUSeLmZl8evAse7y96Ae98L2k1cBOwWD8nHw==", - "dev": true, - "requires": { - "fsevents": "~2.3.2" - } - }, "rsvp": { "version": "4.8.5", "resolved": "https://registry.npmjs.org/rsvp/-/rsvp-4.8.5.tgz", @@ -29578,12 +29273,6 @@ "integrity": "sha512-cPiFOTLUKvJFIg4SKVScy4ilPPW6rFgMgfuZJPNoDuMs3nC1HbMUycBoJw77xFIp6z1UJQJOfx6C9GMH80DiTw==", "dev": true }, - "sourcemap-codec": { - "version": "1.4.8", - "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.8.tgz", - "integrity": "sha512-9NykojV5Uih4lgo5So5dtw+f0JgJX30KCNI8gwhz2J9A15wD0Ml6tjHKwf6fTSa6fAdVBdZeNOs9eJ71qCk8vA==", - "dev": true - }, "space-separated-tokens": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/space-separated-tokens/-/space-separated-tokens-2.0.2.tgz", diff --git a/package.json b/package.json index 3628f5f..354859b 100644 --- a/package.json +++ b/package.json @@ -17,15 +17,15 @@ "vfile": "^6.0.1", "vfile-matter": "^5.0.0" }, + "peerDependencies": { + "react": ">=16.x <=18.x", + "react-dom": ">=16.x <=18.x" + }, "devDependencies": { - "@babel/code-frame": "^7.16.0", + "@babel/code-frame": "^7.23.5", "@changesets/changelog-github": "^0.5.0", "@changesets/cli": "^2.27.1", "@hashicorp/remark-plugins": "^3.2.1", - "@rollup/plugin-commonjs": "^21.0.1", - "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-node-resolve": "^13.0.6", - "@rollup/plugin-typescript": "^8.3.0", "@types/babel__code-frame": "^7.0.3", "@types/cross-spawn": "^6.0.2", "@types/jest": "^29.5.12", @@ -48,10 +48,8 @@ "react-dom": "^18.2.0", "release": "^6.3.0", "rmfr": "^2.0.0", - "rollup": "^2.59.0", "serve-handler": "^6.1.3", "tree-kill": "^1.2.2", - "tslib": "^2.3.1", "typescript": "^5.4.2", "unist-util-remove": "^3.1.0" }, @@ -68,10 +66,6 @@ "next.js" ], "license": "MPL-2.0", - "peerDependencies": { - "react": ">=16.x <=18.x", - "react-dom": ">=16.x <=18.x" - }, "engines": { "node": ">=14", "npm": ">=7" @@ -81,8 +75,7 @@ "url": "git+https://github.com/hashicorp/next-mdx-remote.git" }, "scripts": { - "build": "rm -rf ./dist && rollup -c rollup.config.js", - "postbuild": "cp ./src/jsx-runtime.cjs dist", + "build": "rm -rf ./dist && tsc -p .", "lint": "prettier --write \"./**/*.{js,jsx,json}\"", "release:major": "release major && npm publish", "release:minor": "release minor && npm publish", diff --git a/rollup.config.js b/rollup.config.js deleted file mode 100644 index 6448d06..0000000 --- a/rollup.config.js +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -import resolve from '@rollup/plugin-node-resolve' -import cjs from '@rollup/plugin-commonjs' -import json from '@rollup/plugin-json' -import ts from '@rollup/plugin-typescript' - -const extensions = ['.js', '.jsx', '.ts', '.tsx'] - -export default [ - { - input: './src/index.tsx', - output: { - dir: './dist', - format: 'es', - }, - external: [ - 'react', - '@mdx-js/react', - 'react/jsx-runtime', - './jsx-runtime.cjs', - ], - plugins: [ - ts({ - tsconfig: './tsconfig.json', - declaration: true, - declarationDir: './dist', - exclude: ['./__tests__/**/*'], - }), - resolve(), - { - // ensure that the requestIdleCallback polyfill file is marked as having - // side-effects so that it gets bundled - name: 'ensure-idle-callback-polyfill', - transform(code, id) { - if (id.includes('idle-callback-polyfill.js')) { - return { code, moduleSideEffects: true } - } - }, - }, - ], - }, - { - input: './src/rsc.tsx', - output: { - dir: './dist', - format: 'es', - }, - external: [ - 'react', - '@mdx-js/react', - 'react/jsx-runtime', - './jsx-runtime.cjs', - '@mdx-js/mdx', - 'vfile', - 'vfile-matter', - ], - plugins: [ - ts({ - tsconfig: './tsconfig.json', - declaration: true, - declarationDir: './dist', - exclude: ['./__tests__/**/*'], - }), - json(), - resolve(), - cjs(), - ], - }, - { - input: './src/serialize.ts', - output: { - dir: './dist', - format: 'es', - }, - external: ['@mdx-js/mdx', 'vfile', 'vfile-matter'], - plugins: [ - ts({ - tsconfig: './tsconfig.json', - declaration: true, - declarationDir: './dist', - exclude: ['./__tests__/**/*'], - }), - json(), - resolve(), - cjs(), - ], - }, -] diff --git a/src/index.tsx b/src/index.tsx index a4bae5e..644cf3c 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -7,7 +7,7 @@ import './idle-callback-polyfill' import React, { useEffect, useState, useMemo } from 'react' import { jsxRuntime } from './jsx-runtime.cjs' import * as mdx from '@mdx-js/react' -import type { MDXRemoteSerializeResult } from './types' +import type { MDXRemoteSerializeResult } from './types.js' // requestIdleCallback types found here: https://github.com/microsoft/TypeScript/issues/21309 type RequestIdleCallbackHandle = number diff --git a/src/jsx-runtime.cjs.d.ts b/src/jsx-runtime.cjs.d.ts deleted file mode 100644 index 8f95ff6..0000000 --- a/src/jsx-runtime.cjs.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** - * Copyright (c) HashiCorp, Inc. - * SPDX-License-Identifier: MPL-2.0 - */ - -import * as jsxRuntime from 'react/jsx-runtime' - -export { jsxRuntime } diff --git a/src/plugins/remove-imports-exports.ts b/src/plugins/remove-imports-exports.ts index 5b5484e..84c5fa0 100644 --- a/src/plugins/remove-imports-exports.ts +++ b/src/plugins/remove-imports-exports.ts @@ -4,7 +4,7 @@ */ import { remove } from 'unist-util-remove' -import { Plugin } from 'unified' +import type { Plugin } from 'unified' /** * remark plugin which removes all import and export statements diff --git a/src/rsc.tsx b/src/rsc.tsx index d5f0407..8d5eecc 100644 --- a/src/rsc.tsx +++ b/src/rsc.tsx @@ -5,10 +5,10 @@ import React from 'react' import { jsxRuntime } from './jsx-runtime.cjs' -import type { MDXRemoteSerializeResult, SerializeOptions } from './types' +import type { MDXRemoteSerializeResult, SerializeOptions } from './types.js' import { VFileCompatible } from 'vfile' import { MDXProvider } from '@mdx-js/react' -import { serialize } from './serialize' +import { serialize } from './serialize.js' export type MDXRemoteProps = { source: VFileCompatible diff --git a/src/serialize.ts b/src/serialize.ts index 1240f4d..b535c1a 100644 --- a/src/serialize.ts +++ b/src/serialize.ts @@ -7,11 +7,11 @@ import { compile, CompileOptions } from '@mdx-js/mdx' import { VFile, VFileCompatible } from 'vfile' import { matter } from 'vfile-matter' -import { createFormattedMDXError } from './format-mdx-error' -import { removeImportsExportsPlugin } from './plugins/remove-imports-exports' +import { createFormattedMDXError } from './format-mdx-error.js' +import { removeImportsExportsPlugin } from './plugins/remove-imports-exports.js' // types -import type { MDXRemoteSerializeResult, SerializeOptions } from './types' +import type { MDXRemoteSerializeResult, SerializeOptions } from './types.js' function getCompileOptions( mdxOptions: SerializeOptions['mdxOptions'] = {}, diff --git a/tsconfig.json b/tsconfig.json index 5a93fb4..9e2887e 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,18 +1,18 @@ { "compilerOptions": { "target": "ESNext", - "module": "esnext", + "module": "NodeNext", "lib": ["es6", "dom"], "allowJs": true, "skipLibCheck": true, "strict": true, "forceConsistentCasingInFileNames": true, - "moduleResolution": "node", "esModuleInterop": true, "jsx": "react", "declaration": true, "declarationDir": "./dist", - "outDir": "./dist" + "outDir": "./dist", + "rootDir": "./src" }, - "include": ["./src", "types.d.ts", "__tests__", "global.d.ts"] + "include": ["./src"] } From 8da946480ba1b9334edc9ec4f101a1861ae6f8d7 Mon Sep 17 00:00:00 2001 From: Dylan Staley <88163+dstaley@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:57:55 -0700 Subject: [PATCH 2/4] fix: move @babel/code-frame to deps --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index a414f32..4c2b5a0 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "./rsc": "./rsc.js" }, "dependencies": { + "@babel/code-frame": "^7.23.5", "@mdx-js/mdx": "^3.0.1", "@mdx-js/react": "^3.0.1", "unist-util-remove": "^3.1.0", @@ -23,7 +24,6 @@ "react-dom": ">=16.x <=18.x" }, "devDependencies": { - "@babel/code-frame": "^7.23.5", "@changesets/changelog-github": "^0.5.0", "@changesets/cli": "^2.27.1", "@hashicorp/remark-plugins": "^3.2.1", From dc26490ea1833cce144fbc784a2293e42358936f Mon Sep 17 00:00:00 2001 From: Dylan Staley <88163+dstaley@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:58:09 -0700 Subject: [PATCH 3/4] fix: add extension to polyfill import --- src/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/index.tsx b/src/index.tsx index 644cf3c..ceff332 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,7 @@ * SPDX-License-Identifier: MPL-2.0 */ -import './idle-callback-polyfill' +import './idle-callback-polyfill.js' import React, { useEffect, useState, useMemo } from 'react' import { jsxRuntime } from './jsx-runtime.cjs' import * as mdx from '@mdx-js/react' From 359cad9cc4888d2711b0cf5e92e6ac73774917e0 Mon Sep 17 00:00:00 2001 From: Dylan Staley <88163+dstaley@users.noreply.github.com> Date: Wed, 13 Mar 2024 17:56:50 -0700 Subject: [PATCH 4/4] fix: add extension to type imports --- index.d.ts | 2 +- rsc.d.ts | 2 +- serialize.d.ts | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/index.d.ts b/index.d.ts index e6e6a23..1fa59b0 100644 --- a/index.d.ts +++ b/index.d.ts @@ -3,4 +3,4 @@ * SPDX-License-Identifier: MPL-2.0 */ -export * from './dist/index' +export * from './dist/index.js' diff --git a/rsc.d.ts b/rsc.d.ts index c7b1a8f..3dcb9ec 100644 --- a/rsc.d.ts +++ b/rsc.d.ts @@ -3,4 +3,4 @@ * SPDX-License-Identifier: MPL-2.0 */ -export * from './dist/rsc' +export * from './dist/rsc.js' diff --git a/serialize.d.ts b/serialize.d.ts index 338372f..5d35832 100644 --- a/serialize.d.ts +++ b/serialize.d.ts @@ -3,4 +3,4 @@ * SPDX-License-Identifier: MPL-2.0 */ -export * from './dist/serialize' +export * from './dist/serialize.js'