From fe88c11ebbd7fa1bd701eef7a6f207914b39f13e Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Fri, 16 Aug 2024 21:58:35 +0100
Subject: [PATCH 01/12] Migrate from rollup to rolldown

---
 package.json                           |  6 ++----
 rollup.config.js => rolldown.config.js | 15 +--------------
 src/index.ts                           |  2 +-
 3 files changed, 4 insertions(+), 19 deletions(-)
 rename rollup.config.js => rolldown.config.js (65%)

diff --git a/package.json b/package.json
index 637ed4beef..ac36f7b00c 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
     "start": "vite serve --clearScreen false",
     "preview": "vite preview",
     "build:website": "vite build",
-    "build": "rollup --config --no-stdin",
+    "build": "rolldown --config --no-stdin",
     "build:types": "tsc -p tsconfig.lib.json && api-extractor run --local --verbose",
     "test": "vitest run",
     "test:watch": "vitest watch",
@@ -67,8 +67,6 @@
     "@ianvs/prettier-plugin-sort-imports": "^4.0.2",
     "@linaria/core": "^6.0.0",
     "@microsoft/api-extractor": "^7.23.0",
-    "@rollup/plugin-babel": "^6.0.3",
-    "@rollup/plugin-node-resolve": "^15.1.0",
     "@testing-library/dom": "^10.1.0",
     "@testing-library/react": "^16.0.0",
     "@testing-library/user-event": "^14.5.2",
@@ -100,7 +98,7 @@
     "react-dnd-html5-backend": "^16.0.1",
     "react-dom": "^18.3.1",
     "react-router-dom": "^6.11.1",
-    "rollup": "^4.0.2",
+    "rolldown": "^0.12.2",
     "rollup-plugin-postcss": "^4.0.2",
     "typescript": "~5.5.2",
     "vite": "^5.3.3",
diff --git a/rollup.config.js b/rolldown.config.js
similarity index 65%
rename from rollup.config.js
rename to rolldown.config.js
index 9aac4458c7..7d41950a32 100644
--- a/rollup.config.js
+++ b/rolldown.config.js
@@ -1,12 +1,8 @@
 import { isAbsolute } from 'node:path';
 import wyw from '@wyw-in-js/rollup';
 import postcss from 'rollup-plugin-postcss';
-import { babel } from '@rollup/plugin-babel';
-import nodeResolve from '@rollup/plugin-node-resolve';
 import pkg from './package.json' with { type: 'json' };
 
-const extensions = ['.ts', '.tsx'];
-
 export default {
   input: './src/index.ts',
   output: [
@@ -35,15 +31,6 @@ export default {
     }),
     postcss({
       extract: 'styles.css'
-    }),
-    babel({
-      babelHelpers: 'runtime',
-      extensions,
-      // remove all comments except terser annotations
-      // https://github.com/terser/terser#annotations
-      // https://babeljs.io/docs/en/options#shouldprintcomment
-      shouldPrintComment: (comment) => /^[@#]__.+__$/.test(comment)
-    }),
-    nodeResolve({ extensions })
+    })
   ]
 };
diff --git a/src/index.ts b/src/index.ts
index 270d71def0..d989ae8db1 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,4 +1,4 @@
-import './style/layers.css';
+// import './style/layers.css';
 
 export { default, type DataGridProps, type DataGridHandle } from './DataGrid';
 export { default as TreeDataGrid, type TreeDataGridProps } from './TreeDataGrid';

From 963070abaffbf7e40a867943e9e54a13b6cbaf3a Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Fri, 16 Aug 2024 22:52:23 +0100
Subject: [PATCH 02/12] use defineConfig

---
 rolldown.config.js | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/rolldown.config.js b/rolldown.config.js
index 7d41950a32..a8869c58fe 100644
--- a/rolldown.config.js
+++ b/rolldown.config.js
@@ -1,9 +1,10 @@
 import { isAbsolute } from 'node:path';
+import { defineConfig } from 'rolldown';
 import wyw from '@wyw-in-js/rollup';
 import postcss from 'rollup-plugin-postcss';
 import pkg from './package.json' with { type: 'json' };
 
-export default {
+export default defineConfig({
   input: './src/index.ts',
   output: [
     {
@@ -33,4 +34,4 @@ export default {
       extract: 'styles.css'
     })
   ]
-};
+});

From 73b54cce0190910fde63112f454bd46d8c5c1409 Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Fri, 16 Aug 2024 22:54:00 +0100
Subject: [PATCH 03/12] tweak command

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index ac36f7b00c..e5a0721cb2 100644
--- a/package.json
+++ b/package.json
@@ -36,7 +36,7 @@
     "start": "vite serve --clearScreen false",
     "preview": "vite preview",
     "build:website": "vite build",
-    "build": "rolldown --config --no-stdin",
+    "build": "rolldown --config",
     "build:types": "tsc -p tsconfig.lib.json && api-extractor run --local --verbose",
     "test": "vitest run",
     "test:watch": "vitest watch",

From 75da3bc8c9912c5a1edee373f2214746248c626d Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Wed, 11 Sep 2024 14:28:26 +0100
Subject: [PATCH 04/12] update rolldown

---
 package.json | 2 +-
 src/index.ts | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/package.json b/package.json
index 1d11f9d734..6d2be429ab 100644
--- a/package.json
+++ b/package.json
@@ -98,7 +98,7 @@
     "react-dnd-html5-backend": "^16.0.1",
     "react-dom": "^18.3.1",
     "react-router-dom": "^6.11.1",
-    "rolldown": "^0.12.2",
+    "rolldown": "^0.13.2",
     "rollup-plugin-postcss": "^4.0.2",
     "typescript": "~5.6.2",
     "vite": "^5.3.3",
diff --git a/src/index.ts b/src/index.ts
index 1aa1bf944a..49a6bc9511 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -1,4 +1,4 @@
-// import './style/layers.css';
+import './style/layers.css';
 
 export { default, type DataGridProps, type DataGridHandle } from './DataGrid';
 export { default as TreeDataGrid, type TreeDataGridProps } from './TreeDataGrid';

From 9b4fe3a1e996c25594800ed941d564b03bee5877 Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Sun, 22 Dec 2024 17:00:01 +0000
Subject: [PATCH 05/12] update rolldown

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 643f65f09f..cbb497d769 100644
--- a/package.json
+++ b/package.json
@@ -103,7 +103,7 @@
     "react-dnd": "^16.0.1",
     "react-dnd-html5-backend": "^16.0.1",
     "react-dom": "^18.3.1",
-    "rolldown": "^0.13.2",
+    "rolldown": "^0.15.1",
     "rollup-plugin-postcss": "^4.0.2",
     "typescript": "~5.7.2",
     "vite": "^6.0.3",

From d03f789d30353cf2a6113e2ea723deeb5623d4a5 Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Sun, 22 Dec 2024 17:39:46 +0000
Subject: [PATCH 06/12] update rolldown config

---
 package.json       |  1 -
 rolldown.config.js | 79 +++++++++++++++++++++++++++-------------------
 tsconfig.js.json   |  3 +-
 3 files changed, 48 insertions(+), 35 deletions(-)

diff --git a/package.json b/package.json
index cbb497d769..0163a1b716 100644
--- a/package.json
+++ b/package.json
@@ -104,7 +104,6 @@
     "react-dnd-html5-backend": "^16.0.1",
     "react-dom": "^18.3.1",
     "rolldown": "^0.15.1",
-    "rollup-plugin-postcss": "^4.0.2",
     "typescript": "~5.7.2",
     "vite": "^6.0.3",
     "vitest": "^2.1.8",
diff --git a/rolldown.config.js b/rolldown.config.js
index c42f4dba15..7e5e040cd0 100644
--- a/rolldown.config.js
+++ b/rolldown.config.js
@@ -1,39 +1,52 @@
+// @ts-check
 import { isAbsolute } from 'node:path';
 import wyw from '@wyw-in-js/rollup';
-import postcss from 'rollup-plugin-postcss';
 import pkg from './package.json' with { type: 'json' };
 import { defineConfig } from 'rolldown';
 
-const annotationRegexp = /^[@#]__.+__$/;
+// TODO: can't preserve minifier annotations, open issue
+// const annotationRegexp = /^[@#]__.+__$/;
 
-export default defineConfig({
-  input: './src/index.ts',
-  output: [
-    {
-      file: './lib/bundle.js',
-      format: 'es',
-      generatedCode: 'es2015',
-      sourcemap: true
-    },
-    {
-      file: './lib/bundle.cjs',
-      format: 'cjs',
-      generatedCode: 'es2015',
-      sourcemap: true
-    }
-  ],
-  external: (id) => !id.startsWith('.') && !id.startsWith('@linaria:') && !isAbsolute(id),
-  plugins: [
-    wyw({
-      preprocessor: 'none',
-      classNameSlug(hash) {
-        // We add the package version as suffix to avoid style conflicts
-        // between multiple versions of RDG on the same page.
-        return `${hash}${pkg.version.replaceAll('.', '-')}`;
-      }
-    }),
-    postcss({
-      extract: 'styles.css'
-    })
-  ]
-});
+/**
+ * @type {readonly import('rolldown').OutputOptions[]}
+ */
+const outputs = [
+  {
+    dir: 'lib',
+    entryFileNames: 'bundle.js',
+    cssEntryFileNames: 'styles.css',
+    format: 'es',
+    sourcemap: true,
+    comments: 'preserve-legal'
+  },
+  {
+    dir: 'lib',
+    entryFileNames: 'bundle.cjs',
+    cssEntryFileNames: 'styles.css',
+    format: 'cjs',
+    sourcemap: true
+  }
+];
+
+export default outputs.map((output) =>
+  defineConfig({
+    input: './src/index.ts',
+    output,
+    platform: 'browser',
+    external: (id) => !id.startsWith('.') && !isAbsolute(id),
+    plugins: [
+      // @ts-expect-error
+      wyw({
+        preprocessor: 'none',
+        /**
+         * @param {string} hash
+         */
+        classNameSlug(hash) {
+          // We add the package version as suffix to avoid style conflicts
+          // between multiple versions of RDG on the same page.
+          return `${hash}${pkg.version.replaceAll('.', '-')}`;
+        }
+      })
+    ]
+  })
+);
diff --git a/tsconfig.js.json b/tsconfig.js.json
index ee8264bb3c..f015060dcd 100644
--- a/tsconfig.js.json
+++ b/tsconfig.js.json
@@ -4,8 +4,9 @@
     "allowJs": true,
     "module": "NodeNext",
     "moduleResolution": "NodeNext",
+    "resolveJsonModule": true,
     "skipLibCheck": true
   },
-  "include": ["**/*.js", ".github/**/*.js"],
+  "include": ["**/*.js", ".github/**/*.js", "package.json"],
   "exclude": ["./coverage/**/*", "./dist/**/*", "./lib/**/*"]
 }

From 670ba11cfc2faedf274e3aa21f2f8c818e7bdd0a Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Sun, 22 Dec 2024 17:48:41 +0000
Subject: [PATCH 07/12] don't need this

---
 rolldown.config.js | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/rolldown.config.js b/rolldown.config.js
index 7e5e040cd0..7527e2f0f4 100644
--- a/rolldown.config.js
+++ b/rolldown.config.js
@@ -16,8 +16,7 @@ const outputs = [
     entryFileNames: 'bundle.js',
     cssEntryFileNames: 'styles.css',
     format: 'es',
-    sourcemap: true,
-    comments: 'preserve-legal'
+    sourcemap: true
   },
   {
     dir: 'lib',

From 2a4c80ddd25ba420157a463a030c37242e631ae8 Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Mon, 23 Dec 2024 17:20:43 +0000
Subject: [PATCH 08/12] add todo, remove other comment

---
 rolldown.config.js | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/rolldown.config.js b/rolldown.config.js
index 7527e2f0f4..b8714024a9 100644
--- a/rolldown.config.js
+++ b/rolldown.config.js
@@ -4,10 +4,8 @@ import wyw from '@wyw-in-js/rollup';
 import pkg from './package.json' with { type: 'json' };
 import { defineConfig } from 'rolldown';
 
-// TODO: can't preserve minifier annotations, open issue
-// const annotationRegexp = /^[@#]__.+__$/;
-
 /**
+ * TODO: https://github.com/rolldown/rolldown/issues/3200
  * @type {readonly import('rolldown').OutputOptions[]}
  */
 const outputs = [

From 96ec3fc4ccd2e90e1f74b5b84bb00627046e2008 Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Mon, 23 Dec 2024 17:28:25 +0000
Subject: [PATCH 09/12] remove most babel deps

---
 babel.config.json | 17 +----------------
 package.json      |  6 ------
 2 files changed, 1 insertion(+), 22 deletions(-)

diff --git a/babel.config.json b/babel.config.json
index 249dc5cef4..f878e8f9f9 100644
--- a/babel.config.json
+++ b/babel.config.json
@@ -1,18 +1,3 @@
 {
-  "presets": [
-    [
-      "@babel/env",
-      {
-        "loose": true,
-        "bugfixes": true,
-        "shippedProposals": true
-      }
-    ],
-    ["@babel/react", { "runtime": "automatic" }],
-    "@babel/typescript"
-  ],
-  "plugins": [
-    "@babel/transform-runtime",
-    ["optimize-clsx", { "functionNames": ["getCellClassname"] }]
-  ]
+  "presets": ["@babel/typescript"]
 }
diff --git a/package.json b/package.json
index 0163a1b716..b6f7b5a81e 100644
--- a/package.json
+++ b/package.json
@@ -55,12 +55,7 @@
     "clsx": "^2.0.0"
   },
   "devDependencies": {
-    "@babel/core": "^7.26.0",
-    "@babel/plugin-transform-runtime": "^7.25.9",
-    "@babel/preset-env": "^7.26.0",
-    "@babel/preset-react": "^7.26.3",
     "@babel/preset-typescript": "^7.26.0",
-    "@babel/runtime": "^7.26.0",
     "@biomejs/biome": "1.9.4",
     "@eslint/compat": "^1.2.4",
     "@eslint/markdown": "^6.2.1",
@@ -84,7 +79,6 @@
     "@vitest/eslint-plugin": "^1.1.17",
     "@wyw-in-js/rollup": "^0.5.0",
     "@wyw-in-js/vite": "^0.5.0",
-    "babel-plugin-optimize-clsx": "^2.6.2",
     "browserslist": "^4.24.3",
     "eslint": "^9.17.0",
     "eslint-plugin-jest-dom": "^5.5.0",

From 8f7d26253de6a75704734abb1bbff11c25eaefe3 Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Sat, 28 Dec 2024 02:09:10 +0000
Subject: [PATCH 10/12] update rolldown

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index b6f7b5a81e..84aa7aa9fc 100644
--- a/package.json
+++ b/package.json
@@ -97,7 +97,7 @@
     "react-dnd": "^16.0.1",
     "react-dnd-html5-backend": "^16.0.1",
     "react-dom": "^18.3.1",
-    "rolldown": "^0.15.1",
+    "rolldown": "^1.0.0-beta.1",
     "typescript": "~5.7.2",
     "vite": "^6.0.3",
     "vitest": "^2.1.8",

From cc33d160e6ba681f0219d70dc78c26e03adfb365 Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Sat, 28 Dec 2024 02:10:51 +0000
Subject: [PATCH 11/12] use output array

---
 rolldown.config.js | 78 +++++++++++++++++++++-------------------------
 1 file changed, 35 insertions(+), 43 deletions(-)

diff --git a/rolldown.config.js b/rolldown.config.js
index b8714024a9..161d7b664f 100644
--- a/rolldown.config.js
+++ b/rolldown.config.js
@@ -4,46 +4,38 @@ import wyw from '@wyw-in-js/rollup';
 import pkg from './package.json' with { type: 'json' };
 import { defineConfig } from 'rolldown';
 
-/**
- * TODO: https://github.com/rolldown/rolldown/issues/3200
- * @type {readonly import('rolldown').OutputOptions[]}
- */
-const outputs = [
-  {
-    dir: 'lib',
-    entryFileNames: 'bundle.js',
-    cssEntryFileNames: 'styles.css',
-    format: 'es',
-    sourcemap: true
-  },
-  {
-    dir: 'lib',
-    entryFileNames: 'bundle.cjs',
-    cssEntryFileNames: 'styles.css',
-    format: 'cjs',
-    sourcemap: true
-  }
-];
-
-export default outputs.map((output) =>
-  defineConfig({
-    input: './src/index.ts',
-    output,
-    platform: 'browser',
-    external: (id) => !id.startsWith('.') && !isAbsolute(id),
-    plugins: [
-      // @ts-expect-error
-      wyw({
-        preprocessor: 'none',
-        /**
-         * @param {string} hash
-         */
-        classNameSlug(hash) {
-          // We add the package version as suffix to avoid style conflicts
-          // between multiple versions of RDG on the same page.
-          return `${hash}${pkg.version.replaceAll('.', '-')}`;
-        }
-      })
-    ]
-  })
-);
+export default defineConfig({
+  input: './src/index.ts',
+  output: [
+    {
+      dir: 'lib',
+      entryFileNames: 'bundle.js',
+      cssEntryFileNames: 'styles.css',
+      format: 'es',
+      sourcemap: true
+    },
+    {
+      dir: 'lib',
+      entryFileNames: 'bundle.cjs',
+      cssEntryFileNames: 'styles.css',
+      format: 'cjs',
+      sourcemap: true
+    }
+  ],
+  platform: 'browser',
+  external: (id) => !id.startsWith('.') && !isAbsolute(id),
+  plugins: [
+    // @ts-expect-error
+    wyw({
+      preprocessor: 'none',
+      /**
+       * @param {string} hash
+       */
+      classNameSlug(hash) {
+        // We add the package version as suffix to avoid style conflicts
+        // between multiple versions of RDG on the same page.
+        return `${hash}${pkg.version.replaceAll('.', '-')}`;
+      }
+    })
+  ]
+});

From 55e33d68b580ac909ca6fe2055e82399676945be Mon Sep 17 00:00:00 2001
From: Nicolas Stepien <stepien.nicolas@gmail.com>
Date: Sat, 28 Dec 2024 02:36:58 +0000
Subject: [PATCH 12/12] pin @vitest/eslint-plugin

---
 package.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/package.json b/package.json
index 84aa7aa9fc..048a739033 100644
--- a/package.json
+++ b/package.json
@@ -76,7 +76,7 @@
     "@vitejs/plugin-react": "^4.3.4",
     "@vitest/browser": "^2.1.8",
     "@vitest/coverage-v8": "^2.1.8",
-    "@vitest/eslint-plugin": "^1.1.17",
+    "@vitest/eslint-plugin": "1.1.20",
     "@wyw-in-js/rollup": "^0.5.0",
     "@wyw-in-js/vite": "^0.5.0",
     "browserslist": "^4.24.3",