Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
7ad9d37
chore: [build] build the library with vite 8 and typescript 7
rohanchkrabrty Nov 25, 2026
c94e6ac
chore: [ci] check types and package exports in ci
rohanchkrabrty Nov 25, 2026
4062fa1
fix: [docs] render the props table on the server
rohanchkrabrty Nov 25, 2026
0fe5168
chore: [build] match the lockfile to the vite range
rohanchkrabrty Nov 25, 2026
3f0791f
chore: [docs] use typescript 7 in the docs site
rohanchkrabrty Nov 25, 2026
23c0b99
chore: [build] keep colors as written in the stylesheet
rohanchkrabrty Nov 26, 2026
2dd54be
chore: [build] use vite 8.4 beta for rolldown 1.3
rohanchkrabrty Nov 26, 2026
616c5f7
Merge remote-tracking branch 'origin/main' into chore/vite-build
rohanchkrabrty Nov 26, 2026
0e06ace
chore: [build] use stable vite 8.3.8 with rolldown 1.3
rohanchkrabrty Nov 26, 2026
c9052ee
Merge remote-tracking branch 'origin/main' into chore/vite-build
rohanchkrabrty Nov 26, 2026
afc741a
chore: [build] keep the rollup css module class names
rohanchkrabrty Nov 26, 2026
9dd33d0
chore: [build] run tsc once per watch rebuild
rohanchkrabrty Nov 26, 2026
d03cd4e
fix: [data-view] write the scroll edge animation as longhands
rohanchkrabrty Nov 26, 2026
da2292a
chore: [build] keep declarations current in watch mode
rohanchkrabrty Nov 26, 2026
c3eb669
chore: [docs] note the data-view longhands in the changelog
rohanchkrabrty Nov 26, 2026
a598beb
chore: [build] minify the stylesheets with cssnano 7
rohanchkrabrty Nov 26, 2026
bc7abd6
test: run the suite in vm threads
rohanchkrabrty Nov 27, 2026
77ebdd8
test: [build] run every time zone test in a child process
rohanchkrabrty Nov 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/release-rc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
Expand All @@ -35,12 +35,12 @@ jobs:
version: 9.3.0

- name: Setup Node.js 22.x
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 22.x

- name: Install Dependencies 🔧
run: pnpm install
run: pnpm install --frozen-lockfile

- name: Build Step 🔧
env:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout 🛎️
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.ref }}
Expand All @@ -35,12 +35,12 @@ jobs:
version: 9.3.0

- name: Setup Node.js 22.x
uses: actions/setup-node@v2
uses: actions/setup-node@v4
with:
node-version: 22.x

- name: Install Dependencies 🔧
run: pnpm install
run: pnpm install --frozen-lockfile

- name: Build Step 🔧
env:
Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,17 @@ jobs:
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Lint
run: pnpm lint

- name: Type check
run: pnpm --filter=@raystack/apsara typecheck

- name: Run tests
run: pnpm --filter=@raystack/apsara test

- name: Check build
run: pnpm build:apsara

- name: Check package exports and types
run: pnpm --filter=@raystack/apsara check:package
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,8 @@ Apsara is a public repo. Anyone can read PR titles, descriptions, branch names,
### Before you open it

- Tests pass: `pnpm test:apsara`.
- Lint passes: `pnpm lint`. CI does not run lint, so check it locally.
- The change adds no type errors: `pnpm exec tsc --noEmit` in `packages/react`. CI does not run this either.
- Lint passes: `pnpm lint`.
- The change adds no type errors: `pnpm typecheck` in `packages/react`.
- The library builds: `pnpm build:apsara`.
- New or changed behavior has tests.
- The docs page is up to date: `index.mdx` and `demo.ts` in `apps/www/src/content/docs/components/<name>/`, and the JSDoc of each prop, which the props tables show.
Expand All @@ -108,7 +108,7 @@ Do not worry if you miss a step. CI and the maintainers will help.
### CI checks

- PR Title: checks that the title follows the [commit convention](#commit-convention). It runs again when you edit the title.
- Tests: runs the Vitest suite and builds the library on Node 22 and 24. To reproduce it, run `pnpm test:apsara` and `pnpm build:apsara`.
- Tests: on Node 22 and 24, runs lint, the type check, and the Vitest suite, builds the library, and checks the package exports and types with publint and arethetypeswrong. To reproduce it, run `pnpm lint`, `pnpm test:apsara`, and `pnpm build:apsara`, then `pnpm typecheck` and `pnpm check:package` in `packages/react`.
- Canary Release: publishes a preview build to [pkg.pr.new](https://pkg.pr.new) and comments the install command on the PR. See [Canary releases](#canary-releases).
- Vercel: deploys a preview of the docs site with your changes.

Expand Down
11 changes: 9 additions & 2 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,8 @@ Run these from `packages/react/`:
| `pnpm test:watch` | Run tests in watch mode |
| `pnpm test:coverage` | Run tests with a coverage report |
| `pnpm lint:fix` | Fix lint issues |
| `pnpm exec tsc --noEmit` | Check types |
| `pnpm typecheck` | Check types |
| `pnpm check:package` | Check the built package's exports and types with publint and arethetypeswrong |

Run `pnpm dev` in `apps/www/` to start only the docs site.

Expand All @@ -118,7 +119,13 @@ describe('Flex', () => {

## Build

`pnpm build:apsara` runs Rollup (`packages/react/rollup.config.mjs`) and writes ESM and CommonJS builds, type declarations, and CSS to `packages/react/dist/`. `pnpm dev` runs the same build in watch mode.
`pnpm build:apsara` runs Vite in library mode (`packages/react/vite.config.ts`) and writes the build to `packages/react/dist/`:

- ESM (`.js`) and CommonJS (`.cjs`), one file per source module, so `'use client'` stays on each file.
- `style.css`, `style-no-fonts.css`, and `normalize.css`. CSS Module class names use the `[name]_[local]__[hash:base64:5]` pattern. Do not change it: an app that loads two Apsara versions applies both sheets to a shared class name. Lightning CSS adds the vendor prefixes that the `browserslist` in `package.json` needs, and cssnano 7 minifies the sheets. cssnano 7 writes rules in the same form as the 1.x builds, so an app that loads both drops the duplicate 1.x rules. Colors stay as written.
- Type declarations (`.d.ts` and `.d.cts`). `tsc -p tsconfig.build.json` runs alongside the bundle, so a type error fails the build.

`pnpm dev` runs the same build in watch mode. Turbo caches `pnpm build:apsara`, so a build with no changes restores `dist/` from the cache.

## Icons

Expand Down
4 changes: 2 additions & 2 deletions apps/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"prebuild": "cd ../.. && (git rev-parse -q --verify refs/tags/v1.0.0 >/dev/null || git fetch -q --tags $(test \"$(git rev-parse --is-shallow-repository)\" = true && echo --unshallow) https://github.com/raystack/apsara.git || true) && npm run build:apsara",
"prebuild": "cd ../.. && (git rev-parse -q --verify refs/tags/v1.0.0 >/dev/null || git fetch -q --tags $(test \"$(git rev-parse --is-shallow-repository)\" = true && echo --unshallow) https://github.com/raystack/apsara.git || true) && pnpm build:apsara",
"dev": "next dev",
"build": "next build",
"start": "next start",
Expand Down Expand Up @@ -41,7 +41,7 @@
"@types/prettier": "^2",
"@types/react": "^19.2.2",
"@types/react-dom": "^19.2.2",
"typescript": "^5.9.3"
"typescript": "~7.0.2"
},
"engines": {
"node": ">=22"
Expand Down
3 changes: 1 addition & 2 deletions apps/www/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"extends": "@raystack/tools-config/tsconfig/react",
"compilerOptions": {
"baseUrl": ".",
"target": "ESNext",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
Expand All @@ -10,7 +9,7 @@
"resolveJsonModule": true,
"incremental": true,
"paths": {
"react": ["node_modules/@types/react"],
"react": ["./node_modules/@types/react"],
"@/.source": ["./.source/server.ts"],
"@/*": ["./src/*"]
},
Expand Down
10 changes: 7 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,21 @@
},
"devDependencies": {
"@biomejs/biome": "2.3.8",
"semver": "^7.6.0",
"@raystack/tools-config": "workspace:*",
"@turbo/gen": "^1.9.7",
"concurrently": "^9.1.2",
"lefthook": "^1.11.12",
"pkg-pr-new": "^0.0.86",
"process": "^0.11.10",
"semver": "^7.6.0",
"turbo": "2.3.1",
"typescript": "4.7"
"typescript": "~7.0.2"
},
"packageManager": "pnpm@9.3.0",
"pnpm": {
"overrides": {
"vite>rolldown": "~1.3.3"
}
},
"name": "apsara",
"engines": {
"node": ">=22"
Expand Down
25 changes: 25 additions & 0 deletions packages/react/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,31 @@ Apsara uses `@base-ui/react` 1.9.0 and `@base-ui/utils` 0.5.0.
- A `Dialog`, `AlertDialog` or `Drawer` opened from code through a
handle is not linked to a trigger that did not open it.

### Build

Vite 8 and TypeScript 7 build the package. The exports and the CSS rules
are the same. An app that uses a bundler needs no change.

#### Changes

- `package.json` sets `"type": "module"`. The `import` condition resolves
to the `.js` ES modules and `.d.ts` types, and `require` resolves to the
`.cjs` modules and `.d.cts` types.
- With `moduleResolution: node`, `@raystack/apsara/icons` and
`@raystack/apsara/hooks` resolve to their own types, not to the root
types.
- `sideEffects` lists `*.css`, so a bundler keeps
`import '@raystack/apsara/style.css'`.
- The package no longer ships declarations for tests and Figma files, or
declaration maps.
- `style.css` leaves out the `-moz-` and `-o-` prefixes that no supported
browser needs. The CSS Module class names are the same.
- The `DataView` list header and group anchor show their edge when
content scrolls under them. The minifier
used to move `animation-timeline` before the `animation` shorthand,
which reset it. The animation now uses longhands, so a minifier in an
app's build cannot reorder it either.

### Icons — lucide replaces @radix-ui/react-icons (BREAKING)

Apsara names every icon with a stable key that does not name a library —
Expand Down
12 changes: 9 additions & 3 deletions packages/react/components/data-view/data-view.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -613,18 +613,24 @@
}

/* Scrolled-under edges: header hairline and group-anchor hairline appear only
once content scrolls beneath them. See table.module.css for rationale. */
once content scrolls beneath them. Longhands only: a minifier that sorts
declarations, such as cssnano, can move an `animation` shorthand after
`animation-timeline`, which resets it. */
@supports (animation-timeline: scroll()) {
.listHeader {
border-bottom-color: transparent;
animation: list-header-edge linear both;
animation-name: list-header-edge;
animation-timing-function: linear;
animation-fill-mode: both;
animation-timeline: scroll(nearest block);
animation-range: 0px 24px;
}

.listGroupAnchor {
box-shadow: 0 0.5px 0 0 transparent;
animation: list-anchor-edge linear both;
animation-name: list-anchor-edge;
animation-timing-function: linear;
animation-fill-mode: both;
animation-timeline: scroll(nearest block);
animation-range: 0px 24px;
}
Expand Down
48 changes: 24 additions & 24 deletions packages/react/components/editor/__tests__/bundle.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// @vitest-environment node
import { mkdtempSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import type { Plugin } from 'rollup';
import { basename, join, resolve } from 'node:path';
import type { Plugin } from 'rolldown';
import { describe, expect, it } from 'vitest';

/* An app that never imports MarkdownAdapter must not ship marked. */
Expand All @@ -11,7 +11,17 @@ const PACKAGE_ROOT = resolve(__dirname, '../../..');
const PACKAGE_INDEX = join(PACKAGE_ROOT, 'index.tsx');
const { sideEffects } = JSON.parse(
readFileSync(join(PACKAGE_ROOT, 'package.json'), 'utf8')
) as { sideEffects?: unknown };
) as { sideEffects?: boolean | string[] };

/** Reads `sideEffects` the way an app's bundler does: `*.css` globs match file names. */
const hasSideEffects = (id: string) =>
Array.isArray(sideEffects)
? sideEffects.some(glob =>
new RegExp(
`^${glob.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '[^/]*')}$`
).test(basename(id))
)
: sideEffects !== false;

/** Resolves `~/` and stubs CSS modules, so the graph is the JavaScript only. */
const sourcePlugin: Plugin = {
Expand All @@ -26,7 +36,9 @@ const sourcePlugin: Plugin = {
return null;
},
load(id) {
return id.startsWith('\0css:') ? 'export default {};' : null;
return id.startsWith('\0css:')
? { code: 'export default {};', moduleType: 'js' }
: null;
}
};

Expand All @@ -36,11 +48,9 @@ async function bundle(source: string): Promise<string> {
const entry = join(dir, 'fixture.ts');
writeFileSync(entry, source);

const { rollup } = await import('rollup');
const { nodeResolve } = await import('@rollup/plugin-node-resolve');
const typescript = (await import('@rollup/plugin-typescript')).default;
const { rolldown } = await import('rolldown');

const build = await rollup({
const build = await rolldown({
input: entry,
// Libraries stay external, so a kept `marked` shows as an import.
external: id =>
Expand All @@ -50,23 +60,13 @@ async function bundle(source: string): Promise<string> {
!id.startsWith('\0'),
// The package's own `sideEffects` setting, as an app's bundler reads it.
treeshake: {
moduleSideEffects: (_id, external) => external || sideEffects !== false
moduleSideEffects: (id, external) => external || hasSideEffects(id)
},
plugins: [
sourcePlugin,
nodeResolve({ extensions: ['.ts', '.tsx', '.js'] }),
typescript({
tsconfig: false,
jsx: 'react-jsx',
target: 'esnext',
module: 'esnext',
moduleResolution: 'bundler',
declaration: false,
skipLibCheck: true,
noEmitOnError: false
})
],
onwarn: () => undefined
tsconfig: false,
transform: { jsx: 'react-jsx' },
resolve: { extensions: ['.ts', '.tsx', '.js'] },
plugins: [sourcePlugin],
logLevel: 'silent'
});
const { output } = await build.generate({ format: 'es' });
await build.close();
Expand Down
2 changes: 2 additions & 0 deletions packages/react/global.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ declare module '*.module.css' {
const classes: { [key: string]: string };
export default classes;
}

declare module '*.css';
32 changes: 8 additions & 24 deletions packages/react/icons/__tests__/bundle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,41 +31,25 @@ async function bundleFixture() {
)};\n` + `export const icons = [${IMPORTED.join(', ')}];\n`
);

// Use rollup, the bundler that actually builds this package.
const { rollup } = await import('rollup');
const { nodeResolve } = await import('@rollup/plugin-node-resolve');
const typescript = (await import('@rollup/plugin-typescript')).default;
// Use rolldown, the bundler that builds this package.
const { rolldown } = await import('rolldown');

const bundle = await rollup({
const bundle = await rolldown({
input: entry,
// Keep the libraries out so the assertions read the icon graph only.
external: [/^react($|\/)/, 'lucide-react'],
plugins: [
nodeResolve({ extensions: ['.ts', '.tsx', '.js'] }),
typescript({
tsconfig: false,
jsx: 'react-jsx',
target: 'esnext',
module: 'esnext',
moduleResolution: 'bundler',
declaration: false,
skipLibCheck: true,
noEmitOnError: false
})
],
tsconfig: false,
transform: { jsx: 'react-jsx' },
resolve: { extensions: ['.ts', '.tsx', '.js'] },
// A directive is not a side effect, and the warning is noise here.
onwarn: warning => {
if (warning.code === 'MODULE_LEVEL_DIRECTIVE') return;
if (warning.code === 'PLUGIN_WARNING') return;
}
logLevel: 'silent'
});

const { output } = await bundle.generate({ format: 'es' });
await bundle.close();

return output
.filter(chunk => chunk.type === 'chunk')
.map(chunk => ('code' in chunk ? chunk.code : ''))
.map(chunk => (chunk.type === 'chunk' ? chunk.code : ''))
.join('\n');
}

Expand Down
4 changes: 0 additions & 4 deletions packages/react/icons/__tests__/create-icon.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import {
// ship and have it behave like one that Apsara does. This file is the only
// cover that contract has: `icons/icons.tsx` only ever passes keys inside the
// set, so nothing else here calls the factory the way a consumer does.
//
// It imports nothing outside `icons/`: the `./icons` rollup build sets `rootDir`
// to this directory, and an import of a component would make the TypeScript
// program warn (TS6059).

/** A drawing, standing in for whatever library the consumer pulls from. */
const Rocket = (props: IconProps) => (
Expand Down
6 changes: 2 additions & 4 deletions packages/react/icons/__tests__/registry.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,8 @@ import {
XIcon
} from '../icons';

// This file imports nothing outside `icons/`. The `./icons` rollup build sets
// `rootDir` to this directory, so an import of a component would make the
// TypeScript program warn (TS6059). The `<Theme icons=…>` integration is tested
// in `components/theme/__tests__/theme.test.tsx` instead.
// The `<Theme icons=…>` integration is tested in
// `components/theme/__tests__/theme.test.tsx`.

/** A stand-in for a consumer's own icon component. */
const StubIcon = (props: IconProps) => (
Expand Down
Loading
Loading