Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
3f3fac7
Split babel transformers into separate transform-js and transform-jsx…
k0d13 Apr 17, 2026
4ea25fc
Remove unused dependencies: typescript-transform-paths and vite-tscon…
k0d13 Apr 17, 2026
812a4d3
Bump dependencies and code cleanup
k0d13 Apr 17, 2026
99d510a
Re-order tanstack start example plugin list
k0d13 Apr 17, 2026
39a388d
Fix identifier assignment in ChoiceMessage branches to ensure proper …
k0d13 Apr 17, 2026
01e1363
Fix transformer function to use previous value in reduce for content …
k0d13 Apr 17, 2026
9a320d7
Remove unused play.ts example file from plugin-babel
k0d13 Apr 17, 2026
9a7c99f
Refactor transformation logic in plugin-babel and plugin-unplugin to …
k0d13 Apr 17, 2026
06feab7
Set translation to undefined in message extraction for JS and JSX tra…
k0d13 Apr 17, 2026
d738e44
Add null check for initialiser in parseJSXOpeningElement to prevent e…
k0d13 Apr 17, 2026
7522cc6
Add removal of stale entries in indexPath method
k0d13 Apr 17, 2026
0d061ab
Remove debugging code
k0d13 Apr 17, 2026
4a0a8ed
Restore typescript as peer dependency of config
k0d13 Apr 17, 2026
c60d589
Refactor hydrateTranslations to use bucket parameter and improve fall…
k0d13 Apr 17, 2026
adea30a
Update Formatter to use templateLiteral for extension property
k0d13 Apr 17, 2026
b6a9d0d
Refactor Bucket definition to simplify intersection and improve reada…
k0d13 Apr 17, 2026
9a8cf71
Remove unreachable handling of literal values in parseJSXOpeningEleme…
k0d13 Apr 17, 2026
10c0656
Use Promise.allSettled to ensure all bucket workers complete before e…
k0d13 Apr 17, 2026
9a3a4bd
Fix null assertion on cooked for tagged templates with invalid escape…
k0d13 Apr 17, 2026
fa78ad7
Rename @saykit/babel-plugin to babel-plugin-saykit
k0d13 Apr 18, 2026
d14a495
Normalise single transformers to arrays to avoid match bypass
k0d13 Apr 18, 2026
0572d81
Drop `as string`
k0d13 Apr 18, 2026
a979684
Chores
k0d13 Apr 18, 2026
4c56139
Refactor transformer function signatures to use 'code' as the first p…
k0d13 Apr 18, 2026
d227ae2
Fix argument order in transformer extraction to use content first
k0d13 Apr 18, 2026
25f86fd
Fix argument order in transform function within Bucket
k0d13 Apr 18, 2026
9825155
Add labels for transform-js and transform-jsx packages
k0d13 Apr 18, 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
12 changes: 7 additions & 5 deletions .changeset/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
"commit": false,
"fixed": [
[
"saykit",
"@saykit/react",
"@saykit/carbon",
"@saykit/config",
"@saykit/format-po",
"@saykit/babel-plugin",
"unplugin-saykit"
"saykit",
"@saykit/carbon",
"@saykit/react",
"babel-plugin-saykit",
"unplugin-saykit",
"@saykit/transform-js",
"@saykit/transform-jsx"
]
],
"linked": [],
Expand Down
2 changes: 1 addition & 1 deletion .changeset/nine-zebras-greet.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"saykit": patch
"@saykit/carbon": patch
"@saykit/react": patch
"@saykit/babel-plugin": patch
"babel-plugin-saykit": patch
"unplugin-saykit": patch
---

Expand Down
11 changes: 11 additions & 0 deletions .changeset/silent-moose-wish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
"@saykit/react": patch
"unplugin-saykit": patch
"@saykit/transform-jsx": patch
"babel-plugin-saykit": patch
"@saykit/transform-js": patch
"@saykit/format-po": patch
"@saykit/config": patch
---

Split babel transformers into separate transform-js and transform-jsx packages
8 changes: 8 additions & 0 deletions .github/labeller.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@
'package: unplugin':
- changed-files:
- any-glob-to-any-file: ['packages/unplugin/**']

'package: transform-js':
- changed-files:
- any-glob-to-any-file: ['packages/transform-js/**']

'package: transform-jsx':
- changed-files:
- any-glob-to-any-file: ['packages/transform-jsx/**']
10 changes: 9 additions & 1 deletion .github/labels.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,21 @@
color: 84cc16

- name: 'package: babel-plugin'
description: Related to @saykit/babel-plugin
description: Related to babel-plugin-saykit
color: f59e0b

- name: 'package: unplugin'
description: Related to unplugin-saykit
color: 06b6d4

- name: 'package: transform-js'
description: Related to @saykit/transform-js
color: 8b5cf6

- name: 'package: transform-jsx'
description: Related to @saykit/transform-jsx
color: ec4899

# Labels primarily for both issues and pull requests

- name: blocked
Expand Down
2 changes: 1 addition & 1 deletion .oxfmtrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"ignorePatterns": [".changeset/*.md"],
"ignorePatterns": [".changeset/*.md", "*.gen.ts"],
"singleQuote": true,
"experimentalSortImports": {
"groups": ["builtin", "external", "internal", "parent", "sibling", "index", "unknown"],
Expand Down
14 changes: 0 additions & 14 deletions examples/carbon-tsdown/saykit.config.ts

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "carbon-tsdown-example",
"name": "carbon-example",
"private": true,
"type": "module",
"scripts": {
Expand All @@ -10,17 +10,18 @@
"dev": "wrangler dev"
},
"dependencies": {
"@buape/carbon": "0.14.0",
"@buape/carbon": "0.16.0",
"@sapphire/snowflake": "^3.5.5",
"@saykit/carbon": "workspace:^",
"saykit": "workspace:^"
},
"devDependencies": {
"@cloudflare/workers-types": "^4.20260210.0",
"@cloudflare/workers-types": "^4.20260417.1",
"@saykit/config": "workspace:^",
"@saykit/format-po": "workspace:^",
"typescript": "^5.9.3",
"@saykit/transform-js": "workspace:^",
"typescript": "^6.0.3",
"unplugin-saykit": "workspace:^",
"wrangler": "^4.64.0"
"wrangler": "^4.83.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { defineConfig } from '@saykit/config';
import createFormatter from '@saykit/format-po';
import createPoFormatter from '@saykit/format-po';
import createJsTransformer from '@saykit/transform-js';

export default defineConfig({
sourceLocale: 'en',
locales: ['en', 'fr'],
buckets: [
{
include: ['src/**/*.{ts,tsx}'],
include: ['src/**/*.ts'],
output: 'src/locales/{locale}/messages.{extension}',
formatter: createFormatter(),
formatter: createPoFormatter(),
transformer: createJsTransformer(),
},
],
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 0 additions & 4 deletions examples/nextjs-babel/.babelrc

This file was deleted.

4 changes: 4 additions & 0 deletions examples/nextjs/.babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"presets": ["next/babel"],
"plugins": ["saykit"]
}
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import './.next/dev/types/routes.d.ts';
import './.next/types/routes.d.ts';

// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "nextjs-babel-example",
"name": "nextjs-example",
"private": true,
"type": "module",
"scripts": {
Expand All @@ -12,15 +12,20 @@
},
"dependencies": {
"@saykit/react": "workspace:^",
"next": "^16.1.6",
"react": "^19.2.4",
"react-dom": "^19.2.4",
"saykit": "workspace:^"
"next": "16.2.4",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"saykit": "workspace:^",
"server-only": "^0.0.1"
Comment thread
k0d13 marked this conversation as resolved.
},
"devDependencies": {
"@saykit/babel-plugin": "workspace:^",
"@saykit/config": "workspace:^",
"@saykit/format-po": "workspace:^",
"@types/react": "^19.2.13"
"@saykit/transform-js": "workspace:^",
"@saykit/transform-jsx": "workspace:^",
"@types/node": "^25.6.0",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"babel-plugin-saykit": "workspace:^"
}
}
17 changes: 17 additions & 0 deletions examples/nextjs/saykit.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from '@saykit/config';
import createPoFormatter from '@saykit/format-po';
import createJsTransformer from '@saykit/transform-js';
import createJsxTransformer from '@saykit/transform-jsx';

export default defineConfig({
sourceLocale: 'en',
locales: ['en', 'fr'],
buckets: [
{
include: ['src/**/*.{ts,tsx}'],
output: 'src/locales/{locale}/messages.{extension}',
formatter: createPoFormatter(),
transformer: [createJsTransformer(), createJsxTransformer()],
},
],
});
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
// TODO: abstract this away into @saykit/react/server, @saykit/next or something

import { type NextRequest, NextResponse } from 'next/server';
import saykitConfig from '../saykit.config';

const SOURCE_LOCALE = 'en';
const LOCALES = ['en', 'fr'];

export default function proxy(request: NextRequest) {
let respondWith = NextResponse.next();

const defaultLocale = saykitConfig.sourceLocale;
const defaultLocale = SOURCE_LOCALE;
let pathLocale = fromUrlPathname(request.nextUrl.pathname);
if (pathLocale && !saykitConfig.locales.includes(pathLocale)) pathLocale = undefined;
if (pathLocale && !LOCALES.includes(pathLocale)) pathLocale = undefined;

if (pathLocale === defaultLocale) {
// Redirect /{defaultLocale} to /
Expand All @@ -19,7 +21,7 @@ export default function proxy(request: NextRequest) {
//
else if (!pathLocale) {
let cookieLocale = fromRequestCookies(request.cookies) ?? defaultLocale;
if (!saykitConfig.locales.includes(cookieLocale)) cookieLocale = defaultLocale;
if (!LOCALES.includes(cookieLocale)) cookieLocale = defaultLocale;

request.nextUrl.pathname = `/${cookieLocale}${request.nextUrl.pathname}`;
if (cookieLocale === defaultLocale) {
Expand Down
5 changes: 5 additions & 0 deletions examples/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"extends": "../../tsconfig.base.json",
"include": ["src/**/*", ".next/dev/types/**/*.ts", "next-env.d.ts"],
"compilerOptions": { "paths": { "~/*": ["./src/*"] } }
}
3 changes: 3 additions & 0 deletions examples/tanstack-start/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.tanstack/
node_modules/
src/locales/*/*.json
34 changes: 34 additions & 0 deletions examples/tanstack-start/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "tanstack-start-example",
"private": true,
"type": "module",
"sideEffects": false,
"scripts": {
"check": "tsc --noEmit",
"extract": "saykit extract",
"compile": "saykit compile",
"build": "vite build && tsc --noEmit",
"dev": "vite dev"
},
"dependencies": {
"@saykit/react": "workspace:^",
"@tanstack/react-router": "^1.168.22",
"@tanstack/react-router-devtools": "^1.166.13",
"@tanstack/react-start": "^1.167.41",
"react": "^19.2.5",
"react-dom": "^19.2.5",
"saykit": "workspace:^"
},
"devDependencies": {
"@saykit/config": "workspace:^",
"@saykit/format-po": "workspace:^",
"@saykit/transform-js": "workspace:^",
"@saykit/transform-jsx": "workspace:^",
"@types/node": "^25.6.0",
"@types/react": "^19.2.14",
"@types/react-dom": "^19.2.3",
"@vitejs/plugin-react": "^6.0.1",
"unplugin-saykit": "workspace:^",
"vite": "^8.0.8"
}
}
17 changes: 17 additions & 0 deletions examples/tanstack-start/saykit.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { defineConfig } from '@saykit/config';
import createPoFormatter from '@saykit/format-po';
import createJsTransformer from '@saykit/transform-js';
import createJsxTransformer from '@saykit/transform-jsx';

export default defineConfig({
sourceLocale: 'en',
locales: ['en', 'fr'],
buckets: [
{
include: ['src/**/*.{ts,tsx}'],
output: 'src/locales/{locale}/messages.{extension}',
formatter: createPoFormatter(),
transformer: [createJsTransformer(), createJsxTransformer()],
},
],
});
11 changes: 11 additions & 0 deletions examples/tanstack-start/src/i18n.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Say } from 'saykit';

const say = new Say({
locales: ['en', 'fr'],
messages: {
en: await import('./locales/en/messages.json').then((m) => m.default),
fr: await import('./locales/fr/messages.json').then((m) => m.default),
},
});

export default say;
15 changes: 15 additions & 0 deletions examples/tanstack-start/src/locales/en/messages.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: en\n"
"X-Generator: saykit\n"

msgid "Count: {count}"
msgstr "Count: {count}"

msgid "Increment"
msgstr "Increment"

msgid "Reset"
msgstr "Reset"
15 changes: 15 additions & 0 deletions examples/tanstack-start/src/locales/fr/messages.po
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
msgid ""
msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Language: fr\n"
"X-Generator: saykit\n"

msgid "Count: {count}"
msgstr "Compteur : {count}"

msgid "Increment"
msgstr "Incrémenter"

msgid "Reset"
msgstr "Réinitialiser"
Loading
Loading