From cafd920419cb7eae62d77e36c786ac2b0f0cef03 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 19 Dec 2025 14:04:55 -0500 Subject: [PATCH 1/4] Theme: Fix design-tokens.js entrypoint to specify types and CJS variants --- packages/theme/package.json | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/packages/theme/package.json b/packages/theme/package.json index ae8bda23a5503a..c7e46c35ee7ca2 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -39,9 +39,21 @@ "default": "./build/index.cjs" }, "./design-tokens.css": "./src/prebuilt/css/design-tokens.css", - "./design-tokens.js": "./src/prebuilt/js/design-tokens.js", - "./stylelint-plugins/no-unknown-ds-tokens": "./src/stylelint-plugins/no-unknown-ds-tokens.js", - "./stylelint-plugins/no-setting-wpds-custom-properties": "./src/stylelint-plugins/no-setting-wpds-custom-properties.js", + "./design-tokens.js": { + "types": "./build-types/prebuilt/js/design-tokens.d.ts", + "import": "./build-module/prebuilt/js/design-tokens.js", + "default": "./build/prebuilt/js/design-tokens.cjs" + }, + "./stylelint-plugins/no-unknown-ds-tokens": { + "types": "./build-types/stylelint-plugins/no-unknown-ds-tokens.d.ts", + "import": "./build-module/stylelint-plugins/no-unknown-ds-tokens.js", + "default": "./build/stylelint-plugins/no-unknown-ds-tokens.cjs" + }, + "./stylelint-plugins/no-setting-wpds-custom-properties": { + "types": "./build-types/stylelint-plugins/no-setting-wpds-custom-properties.d.ts", + "import": "./build-module/stylelint-plugins/no-setting-wpds-custom-properties.js", + "default": "./build/stylelint-plugins/no-setting-wpds-custom-properties.cjs" + }, "./package.json": "./package.json" }, "react-native": "src/index", From e7d6a961c83c0c886b397a553ba85eae855de809 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 19 Dec 2025 14:07:14 -0500 Subject: [PATCH 2/4] Avoid using DocBlock syntax for prebuilt file headers These will be picked up by TypeScript and used incorrectly to describe the return value of the default export --- packages/theme/bin/terrazzo-plugin-inline-alias-values/index.ts | 2 +- .../theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts | 2 +- packages/theme/bin/terrazzo-plugin-typescript-types/index.ts | 2 +- packages/theme/src/prebuilt/js/design-tokens.js | 2 +- packages/theme/src/prebuilt/ts/color-tokens.ts | 2 +- packages/theme/src/prebuilt/ts/token-types.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/theme/bin/terrazzo-plugin-inline-alias-values/index.ts b/packages/theme/bin/terrazzo-plugin-inline-alias-values/index.ts index 33f4aad331fed2..b07180abf8894a 100644 --- a/packages/theme/bin/terrazzo-plugin-inline-alias-values/index.ts +++ b/packages/theme/bin/terrazzo-plugin-inline-alias-values/index.ts @@ -99,7 +99,7 @@ export default function inlineAliasValues( { outputFile( filename, [ - '/**', + '/*', ' * This file is generated by the @wordpress/terrazzo-plugin-inline-alias-values plugin.', ' * Do not edit this file directly.', ' */', diff --git a/packages/theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts b/packages/theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts index 9db44e95500a34..9c1055a1ca6b8f 100644 --- a/packages/theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +++ b/packages/theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts @@ -34,7 +34,7 @@ export default function pluginKnownWpdsCssVariables( { outputFile( filename, [ - '/**', + '/*', ' * This file is generated by the @terrazzo/plugin-known-wpds-css-variables plugin.', ' * Do not edit this file directly.', ' */', diff --git a/packages/theme/bin/terrazzo-plugin-typescript-types/index.ts b/packages/theme/bin/terrazzo-plugin-typescript-types/index.ts index 3542cc3f075e5c..e8a64b0b88df58 100644 --- a/packages/theme/bin/terrazzo-plugin-typescript-types/index.ts +++ b/packages/theme/bin/terrazzo-plugin-typescript-types/index.ts @@ -102,7 +102,7 @@ export default function typescriptTypes( { }, async build( { outputFile } ) { const outputLines = [ - '/**', + '/*', ' * This file is generated by the @wordpress/terrazzo-plugin-typescript-types plugin.', ' * Do not edit this file directly.', ' */', diff --git a/packages/theme/src/prebuilt/js/design-tokens.js b/packages/theme/src/prebuilt/js/design-tokens.js index 795ded4e17ff58..df4b9a2eeff876 100644 --- a/packages/theme/src/prebuilt/js/design-tokens.js +++ b/packages/theme/src/prebuilt/js/design-tokens.js @@ -1,4 +1,4 @@ -/** +/* * This file is generated by the @terrazzo/plugin-known-wpds-css-variables plugin. * Do not edit this file directly. */ diff --git a/packages/theme/src/prebuilt/ts/color-tokens.ts b/packages/theme/src/prebuilt/ts/color-tokens.ts index 2a2c7a74561c94..1a8bc3e34db0da 100644 --- a/packages/theme/src/prebuilt/ts/color-tokens.ts +++ b/packages/theme/src/prebuilt/ts/color-tokens.ts @@ -1,4 +1,4 @@ -/** +/* * This file is generated by the @wordpress/terrazzo-plugin-inline-alias-values plugin. * Do not edit this file directly. */ diff --git a/packages/theme/src/prebuilt/ts/token-types.ts b/packages/theme/src/prebuilt/ts/token-types.ts index 5e562cede16d75..c7888c44873364 100644 --- a/packages/theme/src/prebuilt/ts/token-types.ts +++ b/packages/theme/src/prebuilt/ts/token-types.ts @@ -1,4 +1,4 @@ -/** +/* * This file is generated by the @wordpress/terrazzo-plugin-typescript-types plugin. * Do not edit this file directly. */ From 0a448198bff57d40264895e2af955645ce782e20 Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Fri, 19 Dec 2025 14:08:25 -0500 Subject: [PATCH 3/4] Scope known WPDS tokens Terrazzo plugin as WordPress 1. Consistency with other plugins 2. It's within the WordPress scope, not Terrazzo These aren't actually published anywhere, but if they were, we'd use the WordPress organization. We're not affiliated with Terrazzo --- .../bin/terrazzo-plugin-known-wpds-css-variables/index.ts | 4 ++-- packages/theme/src/prebuilt/js/design-tokens.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts b/packages/theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts index 9c1055a1ca6b8f..6ca4008426c047 100644 --- a/packages/theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts +++ b/packages/theme/bin/terrazzo-plugin-known-wpds-css-variables/index.ts @@ -8,7 +8,7 @@ export default function pluginKnownWpdsCssVariables( { filename = 'design-tokens.js', } = {} ): Plugin { return { - name: '@terrazzo/plugin-known-wpds-css-variables', + name: '@wordpress/terrazzo-plugin-known-wpds-css-variables', async build( { getTransforms, outputFile } ) { // Either a string (modes=false) or an object (modes=true) const tokensToExport: Record< @@ -35,7 +35,7 @@ export default function pluginKnownWpdsCssVariables( { filename, [ '/*', - ' * This file is generated by the @terrazzo/plugin-known-wpds-css-variables plugin.', + ' * This file is generated by the @wordpress/terrazzo-plugin-known-wpds-css-variables plugin.', ' * Do not edit this file directly.', ' */', '', diff --git a/packages/theme/src/prebuilt/js/design-tokens.js b/packages/theme/src/prebuilt/js/design-tokens.js index df4b9a2eeff876..434a0aaff94a0f 100644 --- a/packages/theme/src/prebuilt/js/design-tokens.js +++ b/packages/theme/src/prebuilt/js/design-tokens.js @@ -1,5 +1,5 @@ /* - * This file is generated by the @terrazzo/plugin-known-wpds-css-variables plugin. + * This file is generated by the @wordpress/terrazzo-plugin-known-wpds-css-variables plugin. * Do not edit this file directly. */ From c99b7cbd5b066d95da3b62d3ce80d04e60af932e Mon Sep 17 00:00:00 2001 From: Andrew Duthie Date: Tue, 30 Dec 2025 09:59:41 -0500 Subject: [PATCH 4/4] Switch import source back to src file --- packages/theme/package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/theme/package.json b/packages/theme/package.json index c7e46c35ee7ca2..c832b7f5887085 100644 --- a/packages/theme/package.json +++ b/packages/theme/package.json @@ -46,12 +46,12 @@ }, "./stylelint-plugins/no-unknown-ds-tokens": { "types": "./build-types/stylelint-plugins/no-unknown-ds-tokens.d.ts", - "import": "./build-module/stylelint-plugins/no-unknown-ds-tokens.js", + "import": "./src/stylelint-plugins/no-unknown-ds-tokens.js", "default": "./build/stylelint-plugins/no-unknown-ds-tokens.cjs" }, "./stylelint-plugins/no-setting-wpds-custom-properties": { "types": "./build-types/stylelint-plugins/no-setting-wpds-custom-properties.d.ts", - "import": "./build-module/stylelint-plugins/no-setting-wpds-custom-properties.js", + "import": "./src/stylelint-plugins/no-setting-wpds-custom-properties.js", "default": "./build/stylelint-plugins/no-setting-wpds-custom-properties.cjs" }, "./package.json": "./package.json"