From 169f8af9b74ebc9f541365f9979ac216f0afdabd Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 7 May 2026 20:54:18 +0200 Subject: [PATCH 1/4] chore: migrate from TS path aliases to workspaces + project references MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Per https://nx.dev/docs/technologies/typescript/guides/switch-to-workspaces-project-references. - tsconfig.base.json: composite, moduleResolution: bundler, customConditions ["@griffel/source"], declarationMap, isolatedModules. Drop paths/baseUrl/rootDir. - Root tsconfig.json with project references to every package. - Per-package tsconfig.lib.json: extends base directly, outDir: ./dist, rootDir: ./src. Cross-package references added via `nx sync`. - Per-package tsconfig.spec.json: extends base, outDir: ./out-tsc/spec, references its tsconfig.lib.json (avoids TS6307). - @nx/js/typescript plugin in nx.json infers type-check target. - Drop explicit type-check targets from project.json files. - Add apps/* to root workspaces. - All package.json: add @griffel/source export condition pointing to source TS; convert internal @griffel/* deps to workspace:*. CJS packages (babel-preset, jest-serializer, postcss-syntax, webpack-loader, webpack-extraction-plugin, style-types) keep CJS output via separate tsconfig.build.json; their tsconfig.lib.json is typecheck-only with emitDeclarationOnly + module: bundler (avoids TS1479 across package boundary). Type-check passes for all 20 projects. Build still fails for the three CJS packages that import @griffel/core (ESM) — needs follow-up: either convert them to ESM, or split exports so the require condition has its own types field pointing to a .d.cts file emitted alongside ./lib/index.cjs. Co-Authored-By: Claude Opus 4.7 (1M context) --- .gitignore | 4 +- apps/website/project.json | 20 +++--- apps/website/tsconfig.json | 12 +++- e2e/eslint/package.json | 7 +- e2e/eslint/project.json | 21 +++--- e2e/eslint/tsconfig.json | 8 --- e2e/eslint/tsconfig.lib.json | 22 ++++-- e2e/rspack/package.json | 8 ++- e2e/rspack/project.json | 21 +++--- e2e/rspack/tsconfig.json | 10 --- e2e/rspack/tsconfig.lib.json | 27 +++++++- e2e/typescript/package.json | 6 +- e2e/typescript/project.json | 21 +++--- e2e/typescript/tsconfig.json | 8 --- e2e/typescript/tsconfig.lib.json | 18 ++++- e2e/utils/package.json | 7 +- e2e/utils/project.json | 11 +-- e2e/utils/tsconfig.json | 8 --- e2e/utils/tsconfig.lib.json | 10 ++- nx.json | 15 ++++- package.json | 1 + packages/babel-preset/package.json | 12 +++- packages/babel-preset/project.json | 14 +--- packages/babel-preset/tsconfig.build.json | 20 ++++++ packages/babel-preset/tsconfig.json | 4 -- packages/babel-preset/tsconfig.lib.json | 20 ++++-- packages/babel-preset/tsconfig.spec.json | 28 ++++---- packages/core/package.json | 11 +-- packages/core/project.json | 12 ---- packages/core/tsconfig.json | 5 -- packages/core/tsconfig.lib.json | 29 +++----- packages/core/tsconfig.spec.json | 19 +++--- packages/devtools/package.json | 2 +- packages/devtools/project.json | 12 ---- packages/devtools/tsconfig.json | 3 - packages/devtools/tsconfig.lib.json | 23 ++++--- packages/devtools/tsconfig.spec.json | 18 ++--- packages/devtools/tsconfig.storybook.json | 3 +- packages/eslint-plugin/package.json | 10 +++ packages/eslint-plugin/project.json | 12 ---- packages/eslint-plugin/tsconfig.json | 5 -- packages/eslint-plugin/tsconfig.lib.json | 10 +-- packages/eslint-plugin/tsconfig.spec.json | 23 ++++--- packages/jest-serializer/package.json | 12 +++- packages/jest-serializer/project.json | 14 +--- packages/jest-serializer/tsconfig.build.json | 20 ++++++ packages/jest-serializer/tsconfig.json | 4 -- packages/jest-serializer/tsconfig.lib.json | 20 ++++-- packages/jest-serializer/tsconfig.spec.json | 26 +++---- packages/postcss-syntax/package.json | 13 +++- packages/postcss-syntax/project.json | 12 ---- packages/postcss-syntax/tsconfig.json | 3 - packages/postcss-syntax/tsconfig.lib.json | 18 +++-- packages/postcss-syntax/tsconfig.spec.json | 22 +++--- packages/react/package.json | 11 +-- packages/react/project.json | 12 ---- packages/react/tsconfig.json | 7 -- packages/react/tsconfig.lib.json | 30 ++++----- packages/react/tsconfig.spec.json | 24 ++++--- packages/react/tsconfig.storybook.json | 3 +- packages/shadow-dom/package.json | 11 +-- packages/shadow-dom/project.json | 12 ---- packages/shadow-dom/tsconfig.json | 8 --- packages/shadow-dom/tsconfig.lib.json | 32 ++++----- packages/shadow-dom/tsconfig.spec.json | 23 ++++--- packages/shadow-dom/tsconfig.storybook.json | 3 +- packages/style-types/package.json | 11 ++- packages/style-types/project.json | 12 ---- packages/style-types/tsconfig.json | 8 +-- packages/style-types/tsconfig.lib.json | 22 ++---- packages/style-types/tsconfig.spec.json | 22 ++++++ packages/transform-shaker/package.json | 5 +- packages/transform-shaker/project.json | 12 ---- packages/transform-shaker/tsconfig.json | 6 -- packages/transform-shaker/tsconfig.lib.json | 31 ++------- packages/transform-shaker/tsconfig.spec.json | 32 +++++---- packages/transform/package.json | 9 +-- packages/transform/project.json | 12 ---- packages/transform/tsconfig.json | 6 -- packages/transform/tsconfig.lib.json | 41 +++++------- packages/transform/tsconfig.spec.json | 30 ++++----- .../webpack-extraction-plugin/package.json | 12 +++- .../webpack-extraction-plugin/project.json | 14 +--- .../tsconfig.build.json | 20 ++++++ .../webpack-extraction-plugin/tsconfig.json | 5 -- .../tsconfig.lib.json | 20 ++++-- .../tsconfig.spec.json | 26 +++---- packages/webpack-loader/package.json | 12 +++- packages/webpack-loader/project.json | 12 ---- packages/webpack-loader/tsconfig.json | 4 -- packages/webpack-loader/tsconfig.lib.json | 21 ++++-- packages/webpack-loader/tsconfig.spec.json | 24 +++---- packages/webpack-plugin/package.json | 12 ++-- packages/webpack-plugin/project.json | 12 ---- packages/webpack-plugin/tsconfig.json | 5 -- packages/webpack-plugin/tsconfig.lib.json | 45 ++++++------- packages/webpack-plugin/tsconfig.spec.json | 36 +++++----- tools/update-shorthands/package.json | 6 +- tools/update-shorthands/project.json | 12 ---- tools/update-shorthands/tsconfig.json | 9 --- tools/update-shorthands/tsconfig.lib.json | 19 ++++-- tools/update-shorthands/tsconfig.spec.json | 29 +++----- tsconfig.base.json | 30 ++------- tsconfig.json | 63 +++++++++++++++++ yarn.lock | 67 ++++++++++++------- 105 files changed, 853 insertions(+), 821 deletions(-) create mode 100644 packages/babel-preset/tsconfig.build.json create mode 100644 packages/jest-serializer/tsconfig.build.json create mode 100644 packages/style-types/tsconfig.spec.json create mode 100644 packages/webpack-extraction-plugin/tsconfig.build.json create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore index 7442e52f9..40ec071f4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,9 @@ # See http://help.github.com/ignore-files/ for more about ignoring files. # compiled output -/dist +dist /tmp -/out-tsc +out-tsc /packages/*/dist/bundle-size # TypeScript build info diff --git a/apps/website/project.json b/apps/website/project.json index 900cb48da..83b1ff447 100644 --- a/apps/website/project.json +++ b/apps/website/project.json @@ -8,7 +8,11 @@ "executor": "nx:run-commands", "options": { "cwd": "apps/website", - "commands": [{ "command": "docusaurus build --out-dir ../../dist/apps/website" }] + "commands": [ + { + "command": "docusaurus build --out-dir ../../dist/apps/website" + } + ] }, "outputs": ["{workspaceRoot}/dist/apps/website"] }, @@ -16,15 +20,11 @@ "executor": "nx:run-commands", "options": { "cwd": "apps/website", - "commands": [{ "command": "docusaurus start" }] - } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "apps/website", - "commands": [{ "command": "tsc -b --pretty" }], - "outputPath": [] + "commands": [ + { + "command": "docusaurus start" + } + ] } } }, diff --git a/apps/website/tsconfig.json b/apps/website/tsconfig.json index 31be612bb..4db04bcb7 100644 --- a/apps/website/tsconfig.json +++ b/apps/website/tsconfig.json @@ -6,14 +6,20 @@ "checkJs": true, "jsx": "react", "noEmit": true, - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc", "types": [ "../../node_modules/@docusaurus/module-type-aliases", "../../node_modules/@docusaurus/theme-classic", "environment", "static-assets", "webpack-env" - ] + ], + "composite": false }, - "include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.js"] + "include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.js"], + "references": [ + { + "path": "../../packages/core" + } + ] } diff --git a/e2e/eslint/package.json b/e2e/eslint/package.json index 4f3194f1e..65c2d105d 100644 --- a/e2e/eslint/package.json +++ b/e2e/eslint/package.json @@ -2,5 +2,10 @@ "name": "@griffel/e2e-eslint", "version": "0.0.0", "private": true, - "type": "module" + "type": "module", + "devDependencies": { + "@griffel/e2e-utils": "workspace:*", + "@griffel/eslint-plugin": "workspace:*", + "@griffel/react": "workspace:*" + } } diff --git a/e2e/eslint/project.json b/e2e/eslint/project.json index f8e12f007..28bc52550 100644 --- a/e2e/eslint/project.json +++ b/e2e/eslint/project.json @@ -7,20 +7,21 @@ "targets": { "test": { "executor": "nx:run-commands", - "dependsOn": [{ "target": "build", "dependencies": true }], + "dependsOn": [ + { + "target": "build", + "dependencies": true + } + ], "options": { "cwd": "e2e/eslint", - "commands": [{ "command": "node src/test.ts" }] + "commands": [ + { + "command": "node src/test.ts" + } + ] }, "outputs": [] - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "e2e/eslint", - "commands": [{ "command": "tsc -b --pretty" }], - "outputPath": [] - } } }, "tags": [] diff --git a/e2e/eslint/tsconfig.json b/e2e/eslint/tsconfig.json index 1f8121e7c..c23e61c80 100644 --- a/e2e/eslint/tsconfig.json +++ b/e2e/eslint/tsconfig.json @@ -1,13 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "module": "nodenext", - "moduleResolution": "nodenext", - "allowImportingTsExtensions": true, - "noEmit": true - }, "files": [], "include": [], "references": [ diff --git a/e2e/eslint/tsconfig.lib.json b/e2e/eslint/tsconfig.lib.json index a1a9a85ca..c00c175e7 100644 --- a/e2e/eslint/tsconfig.lib.json +++ b/e2e/eslint/tsconfig.lib.json @@ -1,9 +1,23 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "module": "nodenext", + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "outDir": "./dist", "types": ["node", "environment"] }, - "include": ["**/*.ts", "**/*.js"], - "exclude": ["src/assets"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "references": [ + { + "path": "../../packages/react/tsconfig.lib.json" + }, + { + "path": "../../packages/eslint-plugin/tsconfig.lib.json" + }, + { + "path": "../utils/tsconfig.lib.json" + } + ] } diff --git a/e2e/rspack/package.json b/e2e/rspack/package.json index f14b21591..7492cb3e1 100644 --- a/e2e/rspack/package.json +++ b/e2e/rspack/package.json @@ -2,5 +2,11 @@ "name": "@griffel/e2e-rspack", "version": "0.0.0", "private": true, - "type": "module" + "type": "module", + "devDependencies": { + "@griffel/e2e-utils": "workspace:*", + "@griffel/react": "workspace:*", + "@griffel/webpack-extraction-plugin": "workspace:*", + "@griffel/webpack-loader": "workspace:*" + } } diff --git a/e2e/rspack/project.json b/e2e/rspack/project.json index d8296cdfa..373e7780c 100644 --- a/e2e/rspack/project.json +++ b/e2e/rspack/project.json @@ -7,20 +7,21 @@ "targets": { "test": { "executor": "nx:run-commands", - "dependsOn": [{ "target": "build", "dependencies": true }], + "dependsOn": [ + { + "target": "build", + "dependencies": true + } + ], "options": { "cwd": "e2e/rspack", - "commands": [{ "command": "node src/test.ts" }] + "commands": [ + { + "command": "node src/test.ts" + } + ] }, "outputs": [] - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "e2e/rspack", - "commands": [{ "command": "tsc -b --pretty" }], - "outputPath": [] - } } }, "tags": [] diff --git a/e2e/rspack/tsconfig.json b/e2e/rspack/tsconfig.json index 9718d1d60..c23e61c80 100644 --- a/e2e/rspack/tsconfig.json +++ b/e2e/rspack/tsconfig.json @@ -1,15 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "target": "es2020", - "module": "nodenext", - "moduleResolution": "nodenext", - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "noEmit": true - }, "files": [], "include": [], "references": [ diff --git a/e2e/rspack/tsconfig.lib.json b/e2e/rspack/tsconfig.lib.json index cadf7b99d..aaf4603aa 100644 --- a/e2e/rspack/tsconfig.lib.json +++ b/e2e/rspack/tsconfig.lib.json @@ -1,8 +1,29 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "module": "nodenext", + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "outDir": "./dist", "types": ["node", "environment"] }, - "include": ["**/*.ts", "**/*.tsx", "**/*.js"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "references": [ + { + "path": "../../packages/webpack-plugin/tsconfig.lib.json" + }, + { + "path": "../../packages/webpack-loader/tsconfig.lib.json" + }, + { + "path": "../../packages/webpack-extraction-plugin/tsconfig.lib.json" + }, + { + "path": "../../packages/react/tsconfig.lib.json" + }, + { + "path": "../utils/tsconfig.lib.json" + } + ] } diff --git a/e2e/typescript/package.json b/e2e/typescript/package.json index 3946842ab..3a4027bd4 100644 --- a/e2e/typescript/package.json +++ b/e2e/typescript/package.json @@ -2,5 +2,9 @@ "name": "@griffel/e2e-typescript", "version": "0.0.0", "private": true, - "type": "module" + "type": "module", + "devDependencies": { + "@griffel/e2e-utils": "workspace:*", + "@griffel/style-types": "workspace:*" + } } diff --git a/e2e/typescript/project.json b/e2e/typescript/project.json index 4bab732f8..a490f6a9a 100644 --- a/e2e/typescript/project.json +++ b/e2e/typescript/project.json @@ -6,20 +6,21 @@ "targets": { "test": { "executor": "nx:run-commands", - "dependsOn": [{ "target": "build", "dependencies": true }], + "dependsOn": [ + { + "target": "build", + "dependencies": true + } + ], "options": { "cwd": "e2e/typescript", - "commands": [{ "command": "node src/test.ts" }] + "commands": [ + { + "command": "node src/test.ts" + } + ] }, "outputs": [] - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "e2e/typescript", - "commands": [{ "command": "tsc -b --pretty" }], - "outputPath": [] - } } }, "tags": [] diff --git a/e2e/typescript/tsconfig.json b/e2e/typescript/tsconfig.json index 1f8121e7c..c23e61c80 100644 --- a/e2e/typescript/tsconfig.json +++ b/e2e/typescript/tsconfig.json @@ -1,13 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "module": "nodenext", - "moduleResolution": "nodenext", - "allowImportingTsExtensions": true, - "noEmit": true - }, "files": [], "include": [], "references": [ diff --git a/e2e/typescript/tsconfig.lib.json b/e2e/typescript/tsconfig.lib.json index 0893e0a68..9bfdd7d09 100644 --- a/e2e/typescript/tsconfig.lib.json +++ b/e2e/typescript/tsconfig.lib.json @@ -1,8 +1,20 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "module": "nodenext", + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "outDir": "./dist", "types": ["node", "environment"] }, - "include": ["**/*.ts", "**/*.js"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "references": [ + { + "path": "../../packages/style-types/tsconfig.lib.json" + }, + { + "path": "../utils/tsconfig.lib.json" + } + ] } diff --git a/e2e/utils/package.json b/e2e/utils/package.json index 38ee26cdf..99b33930f 100644 --- a/e2e/utils/package.json +++ b/e2e/utils/package.json @@ -4,6 +4,11 @@ "private": true, "type": "module", "exports": { - ".": "./src/index.ts" + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./src/index.ts" + }, + "./package.json": "./package.json" } } diff --git a/e2e/utils/project.json b/e2e/utils/project.json index efc02b00a..80cb74844 100644 --- a/e2e/utils/project.json +++ b/e2e/utils/project.json @@ -3,15 +3,6 @@ "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "e2e/utils/src", "projectType": "library", - "targets": { - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "e2e/utils", - "commands": [{ "command": "tsc -b --pretty" }] - }, - "outputs": [] - } - }, + "targets": {}, "tags": [] } diff --git a/e2e/utils/tsconfig.json b/e2e/utils/tsconfig.json index 1f8121e7c..c23e61c80 100644 --- a/e2e/utils/tsconfig.json +++ b/e2e/utils/tsconfig.json @@ -1,13 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "module": "nodenext", - "moduleResolution": "nodenext", - "allowImportingTsExtensions": true, - "noEmit": true - }, "files": [], "include": [], "references": [ diff --git a/e2e/utils/tsconfig.lib.json b/e2e/utils/tsconfig.lib.json index 2954c1047..63bcbcc17 100644 --- a/e2e/utils/tsconfig.lib.json +++ b/e2e/utils/tsconfig.lib.json @@ -1,8 +1,12 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "module": "nodenext", + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "outDir": "./dist", "types": ["node", "environment"] }, - "include": ["**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx"] } diff --git a/nx.json b/nx.json index a31352694..b0c3c2d2f 100644 --- a/nx.json +++ b/nx.json @@ -29,12 +29,25 @@ "inputs": ["default", "^default"] } }, + "plugins": [ + { + "plugin": "@nx/js/typescript", + "options": { + "typecheck": { + "targetName": "type-check" + } + } + } + ], "pluginsConfig": { "@nx/js": { "analyzeSourceFiles": true } }, - "useInferencePlugins": false, + "useInferencePlugins": true, + "sync": { + "applyChanges": true + }, "defaultBase": "main", "tui": { "enabled": false diff --git a/package.json b/package.json index 173e0a958..f7e1be985 100644 --- a/package.json +++ b/package.json @@ -8,6 +8,7 @@ "url": "https://github.com/microsoft/griffel" }, "workspaces": [ + "apps/*", "e2e/*", "packages/*", "tools/*" diff --git a/packages/babel-preset/package.json b/packages/babel-preset/package.json index 61e6aeb98..5c5f3c7d7 100644 --- a/packages/babel-preset/package.json +++ b/packages/babel-preset/package.json @@ -13,11 +13,21 @@ "@babel/helper-plugin-utils": "^7.28.6", "@babel/template": "^7.28.6", "@babel/traverse": "^7.29.0", - "@griffel/core": "^1.21.0", + "@griffel/core": "workspace:*", "@linaria/babel-preset": "^3.0.0-beta.24", "@linaria/shaker": "^3.0.0-beta.22", "ajv": "^8.20.0", "stylis": "^4.4.0", "tslib": "^2.1.0" + }, + "types": "./src/index.ts", + "main": "./dist/index.js", + "exports": { + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" } } diff --git a/packages/babel-preset/project.json b/packages/babel-preset/project.json index dfe0c2966..0e53532c6 100644 --- a/packages/babel-preset/project.json +++ b/packages/babel-preset/project.json @@ -21,7 +21,7 @@ "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/packages/babel-preset", - "tsConfig": "packages/babel-preset/tsconfig.lib.json", + "tsConfig": "packages/babel-preset/tsconfig.build.json", "skipTypeField": true, "packageJson": "packages/babel-preset/package.json", "main": "packages/babel-preset/src/index.ts", @@ -34,18 +34,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/babel-preset", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/babel-preset/tsconfig.build.json b/packages/babel-preset/tsconfig.build.json new file mode 100644 index 000000000..77ee22186 --- /dev/null +++ b/packages/babel-preset/tsconfig.build.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "composite": false, + "module": "node16", + "moduleResolution": "node16", + "customConditions": [], + "emitDeclarationOnly": false, + "declaration": true, + "outDir": "./dist" + }, + "references": [ + { + "path": "../core/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] +} diff --git a/packages/babel-preset/tsconfig.json b/packages/babel-preset/tsconfig.json index 915d41150..62ebbd946 100644 --- a/packages/babel-preset/tsconfig.json +++ b/packages/babel-preset/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "esModuleInterop": true - }, "files": [], "include": [], "references": [ diff --git a/packages/babel-preset/tsconfig.lib.json b/packages/babel-preset/tsconfig.lib.json index 9121cf848..322399716 100644 --- a/packages/babel-preset/tsconfig.lib.json +++ b/packages/babel-preset/tsconfig.lib.json @@ -1,11 +1,19 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./out-tsc/lib", + "rootDir": "./src", + "emitDeclarationOnly": true, "types": ["node", "environment"] }, - "exclude": ["__fixtures__/**/*", "**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"], + "references": [ + { + "path": "../core/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/babel-preset/tsconfig.spec.json b/packages/babel-preset/tsconfig.spec.json index 16b4d408b..103a0cd43 100644 --- a/packages/babel-preset/tsconfig.spec.json +++ b/packages/babel-preset/tsconfig.spec.json @@ -1,23 +1,25 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "jsx": "react-jsx", - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], - "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment", "static-assets"] + "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"], + "jsx": "react-jsx", + "allowJs": true }, "include": [ - "vitest.config.mts", - "__fixtures__/**/code.ts", - "__fixtures__/**/fixture.ts", + "vitest.config.ts", + "src/common/**/*.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "__fixtures__/**/*.js" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/core/package.json b/packages/core/package.json index 431cabec2..5f852f8d3 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -10,19 +10,20 @@ "sideEffects": false, "type": "module", "main": "./lib/index.cjs", - "module": "./src/index.js", - "types": "./src/index.d.ts", + "module": "./dist/index.js", + "types": "./src/index.ts", "exports": { ".": { - "types": "./src/index.d.ts", - "import": "./src/index.js", + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "import": "./dist/index.js", "require": "./lib/index.cjs" }, "./package.json": "./package.json" }, "dependencies": { "@emotion/hash": "^0.9.0", - "@griffel/style-types": "^1.4.0", + "@griffel/style-types": "workspace:*", "csstype": "^3.2.3", "rtl-css-js": "^1.16.1", "stylis": "^4.4.0", diff --git a/packages/core/project.json b/packages/core/project.json index 879f63e06..cf57c52c8 100644 --- a/packages/core/project.json +++ b/packages/core/project.json @@ -54,18 +54,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/core", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index df5d3be6b..62ebbd946 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - }, "files": [], "include": [], "references": [ diff --git a/packages/core/tsconfig.lib.json b/packages/core/tsconfig.lib.json index 95fa77096..f0c017270 100644 --- a/packages/core/tsconfig.lib.json +++ b/packages/core/tsconfig.lib.json @@ -1,24 +1,15 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "NodeNext", - "moduleResolution": "NodeNext", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", - "jest.config.ts", - "vitest.config.ts", - "bundle-size/**" - ], - "include": ["src/**/*.ts", "src/**/*.tsx"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts", "bundle-size/**"], + "references": [ + { + "path": "../style-types/tsconfig.lib.json" + } + ] } diff --git a/packages/core/tsconfig.spec.json b/packages/core/tsconfig.spec.json index f7128fd9d..57c1db01b 100644 --- a/packages/core/tsconfig.spec.json +++ b/packages/core/tsconfig.spec.json @@ -1,7 +1,7 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] }, @@ -11,11 +11,12 @@ "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/devtools/package.json b/packages/devtools/package.json index 9bc0e0961..87264d5b0 100644 --- a/packages/devtools/package.json +++ b/packages/devtools/package.json @@ -8,6 +8,6 @@ "url": "https://github.com/microsoft/griffel" }, "dependencies": { - "@griffel/react": "^1.7.2" + "@griffel/react": "workspace:*" } } diff --git a/packages/devtools/project.json b/packages/devtools/project.json index 1796ff83e..aedac0f8a 100644 --- a/packages/devtools/project.json +++ b/packages/devtools/project.json @@ -40,18 +40,6 @@ "reportsDirectory": "{projectRoot}/../../coverage/packages/devtools" } }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/devtools", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] - }, "watch": { "executor": "nx:run-commands", "options": { diff --git a/packages/devtools/tsconfig.json b/packages/devtools/tsconfig.json index 1fa5f8e7c..37ab84bcd 100644 --- a/packages/devtools/tsconfig.json +++ b/packages/devtools/tsconfig.json @@ -14,9 +14,6 @@ }, { "path": "./tsconfig.spec.json" - }, - { - "path": "./tsconfig.storybook.json" } ] } diff --git a/packages/devtools/tsconfig.lib.json b/packages/devtools/tsconfig.lib.json index ac89bd5f7..e4a82d01e 100644 --- a/packages/devtools/tsconfig.lib.json +++ b/packages/devtools/tsconfig.lib.json @@ -1,24 +1,29 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "jsx": "react-jsx", + "emitDeclarationOnly": true, + "outDir": "./out-tsc/lib", + "rootDir": "./src", "types": ["chrome", "node", "environment"] }, + "include": ["src/**/*.ts", "src/**/*.tsx"], "exclude": [ "**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", "**/*.stories.ts", - "**/*.stories.js", - "**/*.stories.jsx", "**/*.stories.tsx", "vite.config.ts", "vitest.setup.ts" ], - "include": ["**/*.ts", "**/*.tsx"] + "references": [ + { + "path": "../core/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/devtools/tsconfig.spec.json b/packages/devtools/tsconfig.spec.json index 0e6e6d0aa..bb317f1fb 100644 --- a/packages/devtools/tsconfig.spec.json +++ b/packages/devtools/tsconfig.spec.json @@ -1,8 +1,8 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "moduleResolution": "bundler", + "jsx": "react-jsx", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], "types": ["vitest/importMeta", "vite/client", "chrome", "node", "vitest", "environment"] }, @@ -13,10 +13,12 @@ "src/**/*.spec.ts", "src/**/*.test.tsx", "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", "src/**/*.d.ts" - ] + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/devtools/tsconfig.storybook.json b/packages/devtools/tsconfig.storybook.json index 33a39097e..a567768bc 100644 --- a/packages/devtools/tsconfig.storybook.json +++ b/packages/devtools/tsconfig.storybook.json @@ -4,7 +4,8 @@ "emitDecoratorMetadata": true, "moduleResolution": "bundler", "noEmit": true, - "outDir": "" + "outDir": "./out-tsc/storybook", + "composite": false }, "files": [ "../../node_modules/@nx/react/typings/styled-jsx.d.ts", diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index a4279ac6d..1215a8214 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -15,5 +15,15 @@ }, "peerDependencies": { "eslint": "^9.0.0 || ^10.0.0" + }, + "types": "./src/index.ts", + "main": "./dist/index.js", + "exports": { + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" } } diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json index c0c1493ac..92088e1f8 100644 --- a/packages/eslint-plugin/project.json +++ b/packages/eslint-plugin/project.json @@ -31,18 +31,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/babel-preset", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/eslint-plugin/tsconfig.json b/packages/eslint-plugin/tsconfig.json index 7eea1bc24..62ebbd946 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "module": "nodenext", - "moduleResolution": "nodenext" - }, "files": [], "include": [], "references": [ diff --git a/packages/eslint-plugin/tsconfig.lib.json b/packages/eslint-plugin/tsconfig.lib.json index 124ee9eda..afcb2d147 100644 --- a/packages/eslint-plugin/tsconfig.lib.json +++ b/packages/eslint-plugin/tsconfig.lib.json @@ -1,10 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mts"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"] } diff --git a/packages/eslint-plugin/tsconfig.spec.json b/packages/eslint-plugin/tsconfig.spec.json index 34c36bf98..57c1db01b 100644 --- a/packages/eslint-plugin/tsconfig.spec.json +++ b/packages/eslint-plugin/tsconfig.spec.json @@ -1,19 +1,22 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", + "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] }, "include": [ - "vitest.config.mts", + "vitest.config.ts", + "src/common/**/*.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/jest-serializer/package.json b/packages/jest-serializer/package.json index 4826fe1c0..333082675 100644 --- a/packages/jest-serializer/package.json +++ b/packages/jest-serializer/package.json @@ -8,7 +8,17 @@ "url": "https://github.com/microsoft/griffel" }, "dependencies": { - "@griffel/core": "^1.21.0", + "@griffel/core": "workspace:*", "tslib": "^2.1.0" + }, + "types": "./src/index.ts", + "main": "./dist/index.js", + "exports": { + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" } } diff --git a/packages/jest-serializer/project.json b/packages/jest-serializer/project.json index 260c64d3c..98c36e103 100644 --- a/packages/jest-serializer/project.json +++ b/packages/jest-serializer/project.json @@ -21,7 +21,7 @@ "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/packages/jest-serializer", - "tsConfig": "packages/jest-serializer/tsconfig.lib.json", + "tsConfig": "packages/jest-serializer/tsconfig.build.json", "skipTypeField": true, "packageJson": "packages/jest-serializer/package.json", "main": "packages/jest-serializer/src/index.ts", @@ -34,18 +34,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/jest-serializer", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/jest-serializer/tsconfig.build.json b/packages/jest-serializer/tsconfig.build.json new file mode 100644 index 000000000..a8f13e64e --- /dev/null +++ b/packages/jest-serializer/tsconfig.build.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "composite": false, + "module": "node16", + "moduleResolution": "node16", + "customConditions": [], + "emitDeclarationOnly": false, + "declaration": true, + "outDir": "./dist" + }, + "references": [ + { + "path": "../react/tsconfig.lib.json" + }, + { + "path": "../core/tsconfig.lib.json" + } + ] +} diff --git a/packages/jest-serializer/tsconfig.json b/packages/jest-serializer/tsconfig.json index 915d41150..62ebbd946 100644 --- a/packages/jest-serializer/tsconfig.json +++ b/packages/jest-serializer/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "esModuleInterop": true - }, "files": [], "include": [], "references": [ diff --git a/packages/jest-serializer/tsconfig.lib.json b/packages/jest-serializer/tsconfig.lib.json index 0c32ed38a..c48a037ea 100644 --- a/packages/jest-serializer/tsconfig.lib.json +++ b/packages/jest-serializer/tsconfig.lib.json @@ -1,11 +1,19 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./out-tsc/lib", + "rootDir": "./src", + "emitDeclarationOnly": true, "types": ["node", "environment"] }, - "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts", "jest.setup.ts"], - "include": ["**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"], + "references": [ + { + "path": "../react/tsconfig.lib.json" + }, + { + "path": "../core/tsconfig.lib.json" + } + ] } diff --git a/packages/jest-serializer/tsconfig.spec.json b/packages/jest-serializer/tsconfig.spec.json index b44cb9f09..3ce360d52 100644 --- a/packages/jest-serializer/tsconfig.spec.json +++ b/packages/jest-serializer/tsconfig.spec.json @@ -1,22 +1,24 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "jsx": "react-jsx", - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], - "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] + "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"], + "jsx": "react-jsx" }, "include": [ - "vitest.config.mts", "vitest.setup.ts", + "vitest.config.ts", + "src/common/**/*.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/postcss-syntax/package.json b/packages/postcss-syntax/package.json index 694d35fd6..34b708b09 100644 --- a/packages/postcss-syntax/package.json +++ b/packages/postcss-syntax/package.json @@ -10,8 +10,17 @@ "dependencies": { "@babel/core": "^7.29.0", "@babel/helper-plugin-utils": "^7.28.6", - "@griffel/babel-preset": "^1.8.4", + "@griffel/babel-preset": "workspace:*", "postcss": "^8.5.14" }, - "main": "./src/index.js" + "main": "./dist/index.js", + "types": "./src/index.ts", + "exports": { + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + } } diff --git a/packages/postcss-syntax/project.json b/packages/postcss-syntax/project.json index 8e29d2534..e515a1352 100644 --- a/packages/postcss-syntax/project.json +++ b/packages/postcss-syntax/project.json @@ -34,18 +34,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/babel-preset", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/postcss-syntax/tsconfig.json b/packages/postcss-syntax/tsconfig.json index 2bd6d6f0a..62ebbd946 100644 --- a/packages/postcss-syntax/tsconfig.json +++ b/packages/postcss-syntax/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true - }, "files": [], "include": [], "references": [ diff --git a/packages/postcss-syntax/tsconfig.lib.json b/packages/postcss-syntax/tsconfig.lib.json index 0a5aff6ef..4f633a30a 100644 --- a/packages/postcss-syntax/tsconfig.lib.json +++ b/packages/postcss-syntax/tsconfig.lib.json @@ -1,11 +1,17 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "module": "node16", + "moduleResolution": "node16", + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"], + "references": [ + { + "path": "../babel-preset/tsconfig.lib.json" + } + ] } diff --git a/packages/postcss-syntax/tsconfig.spec.json b/packages/postcss-syntax/tsconfig.spec.json index 4784313a6..57c1db01b 100644 --- a/packages/postcss-syntax/tsconfig.spec.json +++ b/packages/postcss-syntax/tsconfig.spec.json @@ -1,20 +1,22 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] }, "include": [ - "vitest.config.mts", + "vitest.config.ts", + "src/common/**/*.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/react/package.json b/packages/react/package.json index 9450aee47..c7c93cd7a 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -10,12 +10,13 @@ "sideEffects": false, "type": "module", "main": "./lib/index.cjs", - "module": "./src/index.js", - "types": "./src/index.d.ts", + "module": "./dist/index.js", + "types": "./src/index.ts", "exports": { ".": { - "types": "./src/index.d.ts", - "import": "./src/index.js", + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "import": "./dist/index.js", "require": "./lib/index.cjs" }, "./package.json": "./package.json" @@ -27,7 +28,7 @@ } }, "dependencies": { - "@griffel/core": "^1.21.0", + "@griffel/core": "workspace:*", "tslib": "^2.1.0" }, "peerDependencies": { diff --git a/packages/react/project.json b/packages/react/project.json index 2d48dbac2..c328235ec 100644 --- a/packages/react/project.json +++ b/packages/react/project.json @@ -79,18 +79,6 @@ "quiet": true } } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/react", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index 71dbfe6cf..62ebbd946 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react-jsx", - "allowJs": true - }, "files": [], "include": [], "references": [ @@ -12,9 +8,6 @@ }, { "path": "./tsconfig.spec.json" - }, - { - "path": "./tsconfig.storybook.json" } ] } diff --git a/packages/react/tsconfig.lib.json b/packages/react/tsconfig.lib.json index 9287e6039..f5292f2cf 100644 --- a/packages/react/tsconfig.lib.json +++ b/packages/react/tsconfig.lib.json @@ -1,28 +1,24 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "NodeNext", - "moduleResolution": "NodeNext", - "outDir": "../../dist/out-tsc", - "declaration": true, - "stripInternal": true, - "types": ["node", "environment"] + "outDir": "./dist", + "rootDir": "./src", + "types": ["node", "environment"], + "jsx": "react-jsx" }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mts"], "exclude": [ "**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", + "vitest.config.ts", "**/*.stories.ts", - "**/*.stories.js", - "**/*.stories.jsx", - "**/*.stories.tsx", - "jest.config.ts", - "vitest.config.ts" + "**/*.stories.tsx" ], - "include": ["src/**/*.ts", "src/**/*.tsx"] + "references": [ + { + "path": "../core/tsconfig.lib.json" + } + ] } diff --git a/packages/react/tsconfig.spec.json b/packages/react/tsconfig.spec.json index 2be2b8559..13bb8116d 100644 --- a/packages/react/tsconfig.spec.json +++ b/packages/react/tsconfig.spec.json @@ -1,21 +1,23 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "allowSyntheticDefaultImports": true, + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], - "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] + "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"], + "jsx": "react-jsx" }, "include": [ "vitest.config.ts", + "src/common/**/*.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/react/tsconfig.storybook.json b/packages/react/tsconfig.storybook.json index c3076d8e3..625584196 100644 --- a/packages/react/tsconfig.storybook.json +++ b/packages/react/tsconfig.storybook.json @@ -5,7 +5,8 @@ "moduleResolution": "bundler", "allowSyntheticDefaultImports": true, "noEmit": true, - "outDir": "" + "outDir": "./out-tsc/storybook", + "composite": false }, "exclude": ["src/**/*.spec.ts", "src/**/*.spec.js", "src/**/*.spec.tsx", "src/**/*.spec.jsx", "jest.config.ts"], "include": ["src/**/*", ".storybook/*.js"] diff --git a/packages/shadow-dom/package.json b/packages/shadow-dom/package.json index af7bde8fd..78bf4c79e 100644 --- a/packages/shadow-dom/package.json +++ b/packages/shadow-dom/package.json @@ -10,18 +10,19 @@ "sideEffects": false, "type": "module", "main": "./lib/index.cjs", - "module": "./src/index.js", - "types": "./src/index.d.ts", + "module": "./dist/index.js", + "types": "./src/index.ts", "exports": { ".": { - "types": "./src/index.d.ts", - "import": "./src/index.js", + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "import": "./dist/index.js", "require": "./lib/index.cjs" }, "./package.json": "./package.json" }, "dependencies": { - "@griffel/core": "^1.21.0", + "@griffel/core": "workspace:*", "tslib": "^2.1.0" } } diff --git a/packages/shadow-dom/project.json b/packages/shadow-dom/project.json index d1aa20a6f..ad59cd815 100644 --- a/packages/shadow-dom/project.json +++ b/packages/shadow-dom/project.json @@ -79,18 +79,6 @@ "quiet": true } } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/shadow-dom", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/shadow-dom/tsconfig.json b/packages/shadow-dom/tsconfig.json index fb0d53b73..62ebbd946 100644 --- a/packages/shadow-dom/tsconfig.json +++ b/packages/shadow-dom/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - }, "files": [], "include": [], "references": [ @@ -13,9 +8,6 @@ }, { "path": "./tsconfig.spec.json" - }, - { - "path": "./tsconfig.storybook.json" } ] } diff --git a/packages/shadow-dom/tsconfig.lib.json b/packages/shadow-dom/tsconfig.lib.json index 4118563c3..93dd77084 100644 --- a/packages/shadow-dom/tsconfig.lib.json +++ b/packages/shadow-dom/tsconfig.lib.json @@ -1,27 +1,27 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "NodeNext", - "moduleResolution": "NodeNext", - "outDir": "../../dist/out-tsc", - "declaration": true, - "types": ["node", "environment"] + "outDir": "./dist", + "rootDir": "./src", + "types": ["node", "environment"], + "jsx": "react-jsx" }, + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mts"], "exclude": [ "**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", + "vitest.config.ts", "**/*.stories.ts", - "**/*.stories.js", - "**/*.stories.jsx", - "**/*.stories.tsx", - "jest.config.ts", - "vitest.config.ts" + "**/*.stories.tsx" ], - "include": ["src/**/*.ts", "src/**/*.tsx"] + "references": [ + { + "path": "../react/tsconfig.lib.json" + }, + { + "path": "../core/tsconfig.lib.json" + } + ] } diff --git a/packages/shadow-dom/tsconfig.spec.json b/packages/shadow-dom/tsconfig.spec.json index 3227aa648..13bb8116d 100644 --- a/packages/shadow-dom/tsconfig.spec.json +++ b/packages/shadow-dom/tsconfig.spec.json @@ -1,20 +1,23 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], - "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] + "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"], + "jsx": "react-jsx" }, "include": [ "vitest.config.ts", + "src/common/**/*.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/shadow-dom/tsconfig.storybook.json b/packages/shadow-dom/tsconfig.storybook.json index da6c6b19f..0c0e62d47 100644 --- a/packages/shadow-dom/tsconfig.storybook.json +++ b/packages/shadow-dom/tsconfig.storybook.json @@ -5,7 +5,8 @@ "emitDecoratorMetadata": true, "noPropertyAccessFromIndexSignature": false, "noEmit": true, - "outDir": "" + "outDir": "./out-tsc/storybook", + "composite": false }, "exclude": ["src/**/*.spec.ts", "src/**/*.spec.js", "src/**/*.spec.tsx", "src/**/*.spec.jsx", "jest.config.ts"], "include": ["src/**/*", ".storybook/*.js"] diff --git a/packages/style-types/package.json b/packages/style-types/package.json index e5d0e74e6..f62737063 100644 --- a/packages/style-types/package.json +++ b/packages/style-types/package.json @@ -11,5 +11,14 @@ "dependencies": { "csstype": "^3.2.3" }, - "types": "src/index.d.ts" + "types": "./src/index.ts", + "main": "./dist/index.js", + "exports": { + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" + } } diff --git a/packages/style-types/project.json b/packages/style-types/project.json index 6b7bb3974..c37a6213e 100644 --- a/packages/style-types/project.json +++ b/packages/style-types/project.json @@ -27,18 +27,6 @@ "lint": { "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/style-types", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/style-types/tsconfig.json b/packages/style-types/tsconfig.json index 15ee67174..62ebbd946 100644 --- a/packages/style-types/tsconfig.json +++ b/packages/style-types/tsconfig.json @@ -1,15 +1,13 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - }, "files": [], "include": [], "references": [ { "path": "./tsconfig.lib.json" + }, + { + "path": "./tsconfig.spec.json" } ] } diff --git a/packages/style-types/tsconfig.lib.json b/packages/style-types/tsconfig.lib.json index fb8516565..4bafdd34e 100644 --- a/packages/style-types/tsconfig.lib.json +++ b/packages/style-types/tsconfig.lib.json @@ -1,20 +1,12 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "declaration": true, + "module": "node16", + "moduleResolution": "node16", + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", - "jest.config.ts" - ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"] } diff --git a/packages/style-types/tsconfig.spec.json b/packages/style-types/tsconfig.spec.json new file mode 100644 index 000000000..57c1db01b --- /dev/null +++ b/packages/style-types/tsconfig.spec.json @@ -0,0 +1,22 @@ +{ + "extends": "../../tsconfig.base.json", + "compilerOptions": { + "outDir": "./out-tsc/spec", + "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], + "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] + }, + "include": [ + "vitest.config.ts", + "src/common/**/*.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] +} diff --git a/packages/transform-shaker/package.json b/packages/transform-shaker/package.json index e87e2846f..bbef017ee 100644 --- a/packages/transform-shaker/package.json +++ b/packages/transform-shaker/package.json @@ -9,10 +9,11 @@ }, "type": "module", "main": "./src/index.js", - "types": "./src/index.d.ts", + "types": "./src/index.ts", "exports": { ".": { - "types": "./src/index.d.ts", + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", "default": "./src/index.js" }, "./package.json": "./package.json" diff --git a/packages/transform-shaker/project.json b/packages/transform-shaker/project.json index 2f68d8b88..19e2f1664 100644 --- a/packages/transform-shaker/project.json +++ b/packages/transform-shaker/project.json @@ -34,18 +34,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/transform-shaker", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/transform-shaker/tsconfig.json b/packages/transform-shaker/tsconfig.json index 00433f885..62ebbd946 100644 --- a/packages/transform-shaker/tsconfig.json +++ b/packages/transform-shaker/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "target": "ES2022" - }, "files": [], "include": [], "references": [ diff --git a/packages/transform-shaker/tsconfig.lib.json b/packages/transform-shaker/tsconfig.lib.json index e52065737..afcb2d147 100644 --- a/packages/transform-shaker/tsconfig.lib.json +++ b/packages/transform-shaker/tsconfig.lib.json @@ -1,29 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "ESNext", - "moduleResolution": "bundler", - "outDir": "../../dist/out-tsc", - "declaration": true, - "types": ["node"] + "outDir": "./dist", + "rootDir": "./src", + "types": ["node", "environment"] }, - "exclude": [ - "**/*.spec.ts", - "**/*.test.ts", - "jest.config.ts", - "vite.config.ts", - "vite.config.mts", - "vitest.config.ts", - "vitest.config.mts", - "src/**/*.test.ts", - "src/**/*.test.mts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx" - ], - "include": ["**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mts"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"] } diff --git a/packages/transform-shaker/tsconfig.spec.json b/packages/transform-shaker/tsconfig.spec.json index a4e266438..57c1db01b 100644 --- a/packages/transform-shaker/tsconfig.spec.json +++ b/packages/transform-shaker/tsconfig.spec.json @@ -1,24 +1,22 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], - "types": ["vitest/importMeta", "vite/client", "node", "vitest"] + "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] }, "include": [ - "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", - "src/**/*.test.ts", - "src/**/*.test.mts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] + "src/common/**/*.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/transform/package.json b/packages/transform/package.json index 1af10a086..0702ace3b 100644 --- a/packages/transform/package.json +++ b/packages/transform/package.json @@ -9,17 +9,18 @@ }, "type": "module", "main": "./src/index.mjs", - "types": "./src/index.d.mts", + "types": "./src/index.mts", "exports": { ".": { - "types": "./src/index.d.mts", + "@griffel/source": "./src/index.mts", + "types": "./src/index.mts", "default": "./src/index.mjs" }, "./package.json": "./package.json" }, "dependencies": { - "@griffel/core": "^1.21.0", - "@griffel/transform-shaker": "^1.0.5", + "@griffel/core": "workspace:*", + "@griffel/transform-shaker": "workspace:*", "debug": "^4.3.0", "magic-string": "^0.30.19", "oxc-parser": "^0.129.0", diff --git a/packages/transform/project.json b/packages/transform/project.json index d983b9e3a..384783bfa 100644 --- a/packages/transform/project.json +++ b/packages/transform/project.json @@ -34,18 +34,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/transform", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/transform/tsconfig.json b/packages/transform/tsconfig.json index 00433f885..62ebbd946 100644 --- a/packages/transform/tsconfig.json +++ b/packages/transform/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "module": "NodeNext", - "moduleResolution": "NodeNext", - "target": "ES2022" - }, "files": [], "include": [], "references": [ diff --git a/packages/transform/tsconfig.lib.json b/packages/transform/tsconfig.lib.json index 6d2b82de4..60d8a91c0 100644 --- a/packages/transform/tsconfig.lib.json +++ b/packages/transform/tsconfig.lib.json @@ -1,30 +1,21 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "ESNext", - "moduleResolution": "bundler", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "exclude": [ - "__fixtures__/**/*", - "**/*.spec.ts", - "**/*.test.ts", - "jest.config.ts", - "vite.config.ts", - "vite.config.mts", - "vitest.config.ts", - "vitest.config.mts", - "src/**/*.test.ts", - "src/**/*.test.mts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx" - ], - "include": ["**/*.mts"] + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mts"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"], + "references": [ + { + "path": "../transform-shaker/tsconfig.lib.json" + }, + { + "path": "../core/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/transform/tsconfig.spec.json b/packages/transform/tsconfig.spec.json index b37a60f5c..57c1db01b 100644 --- a/packages/transform/tsconfig.spec.json +++ b/packages/transform/tsconfig.spec.json @@ -1,24 +1,22 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] }, "include": [ - "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", - "src/**/*.test.ts", - "src/**/*.test.mts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] + "src/common/**/*.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/webpack-extraction-plugin/package.json b/packages/webpack-extraction-plugin/package.json index 673fe17a7..02f8e55db 100644 --- a/packages/webpack-extraction-plugin/package.json +++ b/packages/webpack-extraction-plugin/package.json @@ -11,11 +11,21 @@ "@babel/core": "^7.29.0", "@babel/helper-module-imports": "^7.22.15", "@babel/helper-plugin-utils": "^7.28.6", - "@griffel/core": "^1.21.0", + "@griffel/core": "workspace:*", "stylis": "^4.4.0", "tslib": "^2.1.0" }, "peerDependencies": { "webpack": "^5" + }, + "types": "./src/index.ts", + "main": "./dist/index.js", + "exports": { + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" } } diff --git a/packages/webpack-extraction-plugin/project.json b/packages/webpack-extraction-plugin/project.json index 2395f022f..a15a0286b 100644 --- a/packages/webpack-extraction-plugin/project.json +++ b/packages/webpack-extraction-plugin/project.json @@ -21,7 +21,7 @@ "outputs": ["{options.outputPath}"], "options": { "outputPath": "dist/packages/webpack-extraction-plugin", - "tsConfig": "packages/webpack-extraction-plugin/tsconfig.lib.json", + "tsConfig": "packages/webpack-extraction-plugin/tsconfig.build.json", "skipTypeField": true, "packageJson": "packages/webpack-extraction-plugin/package.json", "main": "packages/webpack-extraction-plugin/src/index.ts", @@ -39,18 +39,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/webpack-extraction-plugin", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/webpack-extraction-plugin/tsconfig.build.json b/packages/webpack-extraction-plugin/tsconfig.build.json new file mode 100644 index 000000000..77ee22186 --- /dev/null +++ b/packages/webpack-extraction-plugin/tsconfig.build.json @@ -0,0 +1,20 @@ +{ + "extends": "./tsconfig.lib.json", + "compilerOptions": { + "composite": false, + "module": "node16", + "moduleResolution": "node16", + "customConditions": [], + "emitDeclarationOnly": false, + "declaration": true, + "outDir": "./dist" + }, + "references": [ + { + "path": "../core/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] +} diff --git a/packages/webpack-extraction-plugin/tsconfig.json b/packages/webpack-extraction-plugin/tsconfig.json index 4393873b8..62ebbd946 100644 --- a/packages/webpack-extraction-plugin/tsconfig.json +++ b/packages/webpack-extraction-plugin/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "esModuleInterop": true, - "checkJs": true - }, "files": [], "include": [], "references": [ diff --git a/packages/webpack-extraction-plugin/tsconfig.lib.json b/packages/webpack-extraction-plugin/tsconfig.lib.json index ed62f0e15..322399716 100644 --- a/packages/webpack-extraction-plugin/tsconfig.lib.json +++ b/packages/webpack-extraction-plugin/tsconfig.lib.json @@ -1,11 +1,19 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./out-tsc/lib", + "rootDir": "./src", + "emitDeclarationOnly": true, "types": ["node", "environment"] }, - "exclude": ["__fixtures__/**/*/*.ts", "**/*.spec.ts", "**/*.test.ts", "src/common/**", "jest.config.ts"], - "include": ["**/*.ts", "virtual-loader/index.js"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"], + "references": [ + { + "path": "../core/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/webpack-extraction-plugin/tsconfig.spec.json b/packages/webpack-extraction-plugin/tsconfig.spec.json index d66c6803c..57c1db01b 100644 --- a/packages/webpack-extraction-plugin/tsconfig.spec.json +++ b/packages/webpack-extraction-plugin/tsconfig.spec.json @@ -1,22 +1,22 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "jsx": "react-jsx", - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], - "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment", "static-assets"] + "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] }, "include": [ - "vitest.config.mts", - "__fixtures__/**/*/code.ts", + "vitest.config.ts", + "src/common/**/*.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/webpack-loader/package.json b/packages/webpack-loader/package.json index e243c48b7..2ff026006 100644 --- a/packages/webpack-loader/package.json +++ b/packages/webpack-loader/package.json @@ -9,11 +9,21 @@ }, "dependencies": { "@babel/core": "^7.29.0", - "@griffel/babel-preset": "^1.8.4", + "@griffel/babel-preset": "workspace:*", "enhanced-resolve": "^5.21.0", "tslib": "^2.1.0" }, "peerDependencies": { "webpack": "^5" + }, + "types": "./src/index.ts", + "main": "./dist/index.js", + "exports": { + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./dist/index.js" + }, + "./package.json": "./package.json" } } diff --git a/packages/webpack-loader/project.json b/packages/webpack-loader/project.json index ac4d21fcd..e85a158e4 100644 --- a/packages/webpack-loader/project.json +++ b/packages/webpack-loader/project.json @@ -34,18 +34,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/webpack-loader", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/webpack-loader/tsconfig.json b/packages/webpack-loader/tsconfig.json index 915d41150..62ebbd946 100644 --- a/packages/webpack-loader/tsconfig.json +++ b/packages/webpack-loader/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "esModuleInterop": true - }, "files": [], "include": [], "references": [ diff --git a/packages/webpack-loader/tsconfig.lib.json b/packages/webpack-loader/tsconfig.lib.json index c5908aa5b..70bf795d0 100644 --- a/packages/webpack-loader/tsconfig.lib.json +++ b/packages/webpack-loader/tsconfig.lib.json @@ -1,11 +1,20 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "module": "node16", + "moduleResolution": "node16", + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "exclude": ["__fixtures__/*/*.ts", "**/*.spec.ts", "**/*.test.ts", "src/common/**", "jest.config.ts"], - "include": ["**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"], + "references": [ + { + "path": "../babel-preset/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/webpack-loader/tsconfig.spec.json b/packages/webpack-loader/tsconfig.spec.json index c75ea2cf1..57c1db01b 100644 --- a/packages/webpack-loader/tsconfig.spec.json +++ b/packages/webpack-loader/tsconfig.spec.json @@ -1,22 +1,22 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "jsx": "react-jsx", - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] }, "include": [ - "vitest.config.mts", - "__fixtures__/*/code.ts", + "vitest.config.ts", + "src/common/**/*.ts", "**/*.test.ts", "**/*.spec.ts", "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/packages/webpack-plugin/package.json b/packages/webpack-plugin/package.json index 793f9f328..04936781a 100644 --- a/packages/webpack-plugin/package.json +++ b/packages/webpack-plugin/package.json @@ -9,21 +9,23 @@ }, "type": "module", "main": "./src/index.mjs", - "types": "./src/index.d.mts", + "types": "./src/index.mts", "exports": { ".": { - "types": "./src/index.d.mts", + "@griffel/source": "./src/index.mts", + "types": "./src/index.mts", "default": "./src/index.mjs" }, "./loader": { - "types": "./src/webpackLoader.d.mts", + "@griffel/source": "./src/webpackLoader.mts", + "types": "./src/webpackLoader.mts", "default": "./src/webpackLoader.mjs" }, "./package.json": "./package.json" }, "dependencies": { - "@griffel/core": "^1.21.0", - "@griffel/transform": "^3.0.4", + "@griffel/core": "workspace:*", + "@griffel/transform": "workspace:*", "oxc-resolver": "^11.19.1", "stylis": "^4.4.0" }, diff --git a/packages/webpack-plugin/project.json b/packages/webpack-plugin/project.json index 596462dea..33f4d5b59 100644 --- a/packages/webpack-plugin/project.json +++ b/packages/webpack-plugin/project.json @@ -33,18 +33,6 @@ ] } }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/webpack-plugin", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] - }, "test": { "executor": "@nx/vitest:test", "outputs": ["{options.reportsDirectory}"], diff --git a/packages/webpack-plugin/tsconfig.json b/packages/webpack-plugin/tsconfig.json index d824d4bb0..62ebbd946 100644 --- a/packages/webpack-plugin/tsconfig.json +++ b/packages/webpack-plugin/tsconfig.json @@ -1,10 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "module": "NodeNext", - "moduleResolution": "NodeNext", - "target": "ES2022" - }, "files": [], "include": [], "references": [ diff --git a/packages/webpack-plugin/tsconfig.lib.json b/packages/webpack-plugin/tsconfig.lib.json index 6d2b82de4..ab08e75c5 100644 --- a/packages/webpack-plugin/tsconfig.lib.json +++ b/packages/webpack-plugin/tsconfig.lib.json @@ -1,30 +1,23 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "ESNext", - "moduleResolution": "bundler", - "outDir": "../../dist/out-tsc", - "declaration": true, - "types": ["node", "environment"] + "outDir": "./dist", + "rootDir": "./src", + "types": ["node", "environment"], + "target": "es2020", + "lib": ["es2020", "dom", "DOM.Iterable"] }, - "exclude": [ - "__fixtures__/**/*", - "**/*.spec.ts", - "**/*.test.ts", - "jest.config.ts", - "vite.config.ts", - "vite.config.mts", - "vitest.config.ts", - "vitest.config.mts", - "src/**/*.test.ts", - "src/**/*.test.mts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx" - ], - "include": ["**/*.mts"] + "include": ["src/**/*.ts", "src/**/*.tsx", "src/**/*.mts"], + "exclude": ["**/*.spec.ts", "**/*.test.ts", "**/*.spec.tsx", "**/*.test.tsx", "vitest.config.ts"], + "references": [ + { + "path": "../transform/tsconfig.lib.json" + }, + { + "path": "../core/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/webpack-plugin/tsconfig.spec.json b/packages/webpack-plugin/tsconfig.spec.json index 499262f90..769a13f50 100644 --- a/packages/webpack-plugin/tsconfig.spec.json +++ b/packages/webpack-plugin/tsconfig.spec.json @@ -1,23 +1,25 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "types": ["node", "environment"] + "outDir": "./out-tsc/spec", + "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], + "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"], + "jsx": "react-jsx", + "target": "es2020", + "lib": ["es2020", "dom", "DOM.Iterable"] }, "include": [ - "vite.config.ts", - "vite.config.mts", "vitest.config.ts", - "vitest.config.mts", - "src/**/*.test.ts", - "src/**/*.test.mts", - "src/**/*.spec.ts", - "src/**/*.test.tsx", - "src/**/*.spec.tsx", - "src/**/*.test.js", - "src/**/*.spec.js", - "src/**/*.test.jsx", - "src/**/*.spec.jsx", - "src/**/*.d.ts" - ] + "src/common/**/*.ts", + "**/*.test.ts", + "**/*.spec.ts", + "**/*.test.tsx", + "**/*.spec.tsx" + ], + "references": [ + { + "path": "./tsconfig.lib.json" + } + ], + "exclude": ["out-tsc/**", "dist/**"] } diff --git a/tools/update-shorthands/package.json b/tools/update-shorthands/package.json index 6c8cf8425..14d2dccbc 100644 --- a/tools/update-shorthands/package.json +++ b/tools/update-shorthands/package.json @@ -2,5 +2,9 @@ "name": "@griffel/update-shorthands", "version": "0.0.0", "private": true, - "type": "module" + "type": "module", + "devDependencies": { + "@griffel/core": "workspace:*", + "@griffel/style-types": "workspace:*" + } } diff --git a/tools/update-shorthands/project.json b/tools/update-shorthands/project.json index c27da15af..2ca7ece33 100644 --- a/tools/update-shorthands/project.json +++ b/tools/update-shorthands/project.json @@ -28,18 +28,6 @@ "options": { "reportsDirectory": "{projectRoot}/../../coverage/tools/update-shorthands" } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "tools/update-shorthands", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/tools/update-shorthands/tsconfig.json b/tools/update-shorthands/tsconfig.json index 2e00bfa0e..c23e61c80 100644 --- a/tools/update-shorthands/tsconfig.json +++ b/tools/update-shorthands/tsconfig.json @@ -1,19 +1,10 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "module": "nodenext", - "moduleResolution": "nodenext", - "allowImportingTsExtensions": true - }, "files": [], "include": [], "references": [ { "path": "./tsconfig.lib.json" - }, - { - "path": "./tsconfig.spec.json" } ] } diff --git a/tools/update-shorthands/tsconfig.lib.json b/tools/update-shorthands/tsconfig.lib.json index 215af9f85..b7c68b095 100644 --- a/tools/update-shorthands/tsconfig.lib.json +++ b/tools/update-shorthands/tsconfig.lib.json @@ -1,9 +1,20 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "noEmit": true, + "module": "nodenext", + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "outDir": "./dist", "types": ["node", "environment"] }, - "exclude": ["__fixtures__/*/*.ts", "**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "include": ["src/**/*.ts", "src/**/*.tsx"], + "references": [ + { + "path": "../../packages/style-types/tsconfig.lib.json" + }, + { + "path": "../../packages/core/tsconfig.lib.json" + } + ] } diff --git a/tools/update-shorthands/tsconfig.spec.json b/tools/update-shorthands/tsconfig.spec.json index 7583c3782..25b22b6a8 100644 --- a/tools/update-shorthands/tsconfig.spec.json +++ b/tools/update-shorthands/tsconfig.spec.json @@ -1,24 +1,17 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "jsx": "react-jsx", - "outDir": "../../dist/out-tsc", - "noEmit": true, "module": "nodenext", - "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], - "types": ["vitest/importMeta", "vite/client", "node", "vitest", "environment"] + "moduleResolution": "nodenext", + "allowImportingTsExtensions": true, + "emitDeclarationOnly": true, + "outDir": "./out-tsc/spec", + "types": ["vitest/importMeta", "node", "vitest", "environment"] }, - "include": [ - "vitest.config.ts", - "__fixtures__/*/code.ts", - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" + "include": ["**/*.test.ts", "**/*.spec.ts"], + "references": [ + { + "path": "./tsconfig.lib.json" + } ] } diff --git a/tsconfig.base.json b/tsconfig.base.json index c9f65a370..3aa843259 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,12 +1,12 @@ { "compileOnSave": false, "compilerOptions": { - "rootDir": ".", + "composite": true, + "declarationMap": true, "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, + "moduleResolution": "bundler", + "customConditions": ["@griffel/source"], + "isolatedModules": true, "importHelpers": true, "target": "es2019", "module": "esnext", @@ -19,25 +19,7 @@ "forceConsistentCasingInFileNames": true, "skipLibCheck": true, "skipDefaultLibCheck": true, - "baseUrl": ".", - "paths": { - "@griffel/babel-preset": ["packages/babel-preset/src/index.ts"], - "@griffel/core": ["packages/core/src/index.ts"], - "@griffel/devtools": ["packages/devtools/src/index.ts"], - "@griffel/e2e-utils": ["e2e/utils/src/index.ts"], - "@griffel/eslint-plugin": ["packages/eslint-plugin/src/index.ts"], - "@griffel/jest-serializer": ["packages/jest-serializer/src/index.ts"], - "@griffel/postcss-syntax": ["packages/postcss-syntax/src/index.ts"], - "@griffel/react": ["packages/react/src/index.ts"], - "@griffel/style-types": ["packages/style-types/src/index.ts"], - "@griffel/transform": ["packages/transform/src/index.mts"], - "@griffel/transform-shaker": ["packages/transform-shaker/src/index.ts"], - "@griffel/update-shorthands": ["tools/update-shorthands/src/index.ts"], - "@griffel/webpack-extraction-plugin": ["packages/webpack-extraction-plugin/src/index.ts"], - "@griffel/webpack-loader": ["packages/webpack-loader/src/index.ts"], - "@griffel/webpack-plugin": ["packages/webpack-plugin/src/index.mts"] - }, - "typeRoots": ["node_modules/@types", "./typings"] + "typeRoots": ["./node_modules/@types", "./typings"] }, "exclude": ["node_modules", "tmp"] } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..180eacece --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,63 @@ +{ + "extends": "./tsconfig.base.json", + "files": [], + "references": [ + { + "path": "./e2e/eslint" + }, + { + "path": "./e2e/rspack" + }, + { + "path": "./e2e/typescript" + }, + { + "path": "./e2e/utils" + }, + { + "path": "./packages/babel-preset" + }, + { + "path": "./packages/core" + }, + { + "path": "./packages/devtools" + }, + { + "path": "./packages/eslint-plugin" + }, + { + "path": "./packages/jest-serializer" + }, + { + "path": "./packages/postcss-syntax" + }, + { + "path": "./packages/react" + }, + { + "path": "./packages/shadow-dom" + }, + { + "path": "./packages/style-types" + }, + { + "path": "./packages/transform" + }, + { + "path": "./packages/transform-shaker" + }, + { + "path": "./packages/webpack-extraction-plugin" + }, + { + "path": "./packages/webpack-loader" + }, + { + "path": "./packages/webpack-plugin" + }, + { + "path": "./tools/update-shorthands" + } + ] +} diff --git a/yarn.lock b/yarn.lock index 8f467ddfa..ba4ddfd72 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3743,7 +3743,7 @@ __metadata: languageName: node linkType: hard -"@griffel/babel-preset@npm:^1.8.4, @griffel/babel-preset@workspace:packages/babel-preset": +"@griffel/babel-preset@workspace:*, @griffel/babel-preset@workspace:packages/babel-preset": version: 0.0.0-use.local resolution: "@griffel/babel-preset@workspace:packages/babel-preset" dependencies: @@ -3752,7 +3752,7 @@ __metadata: "@babel/helper-plugin-utils": "npm:^7.28.6" "@babel/template": "npm:^7.28.6" "@babel/traverse": "npm:^7.29.0" - "@griffel/core": "npm:^1.21.0" + "@griffel/core": "workspace:*" "@linaria/babel-preset": "npm:^3.0.0-beta.24" "@linaria/shaker": "npm:^3.0.0-beta.22" ajv: "npm:^8.20.0" @@ -3761,12 +3761,12 @@ __metadata: languageName: unknown linkType: soft -"@griffel/core@npm:^1.21.0, @griffel/core@workspace:packages/core": +"@griffel/core@workspace:*, @griffel/core@workspace:packages/core": version: 0.0.0-use.local resolution: "@griffel/core@workspace:packages/core" dependencies: "@emotion/hash": "npm:^0.9.0" - "@griffel/style-types": "npm:^1.4.0" + "@griffel/style-types": "workspace:*" csstype: "npm:^3.2.3" rtl-css-js: "npm:^1.16.1" stylis: "npm:^4.4.0" @@ -3778,35 +3778,47 @@ __metadata: version: 0.0.0-use.local resolution: "@griffel/devtools@workspace:packages/devtools" dependencies: - "@griffel/react": "npm:^1.7.2" + "@griffel/react": "workspace:*" languageName: unknown linkType: soft "@griffel/e2e-eslint@workspace:e2e/eslint": version: 0.0.0-use.local resolution: "@griffel/e2e-eslint@workspace:e2e/eslint" + dependencies: + "@griffel/e2e-utils": "workspace:*" + "@griffel/eslint-plugin": "workspace:*" + "@griffel/react": "workspace:*" languageName: unknown linkType: soft "@griffel/e2e-rspack@workspace:e2e/rspack": version: 0.0.0-use.local resolution: "@griffel/e2e-rspack@workspace:e2e/rspack" + dependencies: + "@griffel/e2e-utils": "workspace:*" + "@griffel/react": "workspace:*" + "@griffel/webpack-extraction-plugin": "workspace:*" + "@griffel/webpack-loader": "workspace:*" languageName: unknown linkType: soft "@griffel/e2e-typescript@workspace:e2e/typescript": version: 0.0.0-use.local resolution: "@griffel/e2e-typescript@workspace:e2e/typescript" + dependencies: + "@griffel/e2e-utils": "workspace:*" + "@griffel/style-types": "workspace:*" languageName: unknown linkType: soft -"@griffel/e2e-utils@workspace:e2e/utils": +"@griffel/e2e-utils@workspace:*, @griffel/e2e-utils@workspace:e2e/utils": version: 0.0.0-use.local resolution: "@griffel/e2e-utils@workspace:e2e/utils" languageName: unknown linkType: soft -"@griffel/eslint-plugin@workspace:packages/eslint-plugin": +"@griffel/eslint-plugin@workspace:*, @griffel/eslint-plugin@workspace:packages/eslint-plugin": version: 0.0.0-use.local resolution: "@griffel/eslint-plugin@workspace:packages/eslint-plugin" dependencies: @@ -3822,7 +3834,7 @@ __metadata: version: 0.0.0-use.local resolution: "@griffel/jest-serializer@workspace:packages/jest-serializer" dependencies: - "@griffel/core": "npm:^1.21.0" + "@griffel/core": "workspace:*" tslib: "npm:^2.1.0" languageName: unknown linkType: soft @@ -3833,16 +3845,16 @@ __metadata: dependencies: "@babel/core": "npm:^7.29.0" "@babel/helper-plugin-utils": "npm:^7.28.6" - "@griffel/babel-preset": "npm:^1.8.4" + "@griffel/babel-preset": "workspace:*" postcss: "npm:^8.5.14" languageName: unknown linkType: soft -"@griffel/react@npm:^1.7.2, @griffel/react@workspace:packages/react": +"@griffel/react@workspace:*, @griffel/react@workspace:packages/react": version: 0.0.0-use.local resolution: "@griffel/react@workspace:packages/react" dependencies: - "@griffel/core": "npm:^1.21.0" + "@griffel/core": "workspace:*" tslib: "npm:^2.1.0" peerDependencies: react: ">=16.14.0 <20.0.0" @@ -3853,12 +3865,12 @@ __metadata: version: 0.0.0-use.local resolution: "@griffel/shadow-dom@workspace:packages/shadow-dom" dependencies: - "@griffel/core": "npm:^1.21.0" + "@griffel/core": "workspace:*" tslib: "npm:^2.1.0" languageName: unknown linkType: soft -"@griffel/style-types@npm:^1.4.0, @griffel/style-types@workspace:packages/style-types": +"@griffel/style-types@workspace:*, @griffel/style-types@workspace:packages/style-types": version: 0.0.0-use.local resolution: "@griffel/style-types@workspace:packages/style-types" dependencies: @@ -3866,7 +3878,7 @@ __metadata: languageName: unknown linkType: soft -"@griffel/transform-shaker@npm:^1.0.5, @griffel/transform-shaker@workspace:packages/transform-shaker": +"@griffel/transform-shaker@workspace:*, @griffel/transform-shaker@workspace:packages/transform-shaker": version: 0.0.0-use.local resolution: "@griffel/transform-shaker@workspace:packages/transform-shaker" dependencies: @@ -3877,12 +3889,12 @@ __metadata: languageName: unknown linkType: soft -"@griffel/transform@npm:^3.0.4, @griffel/transform@workspace:packages/transform": +"@griffel/transform@workspace:*, @griffel/transform@workspace:packages/transform": version: 0.0.0-use.local resolution: "@griffel/transform@workspace:packages/transform" dependencies: - "@griffel/core": "npm:^1.21.0" - "@griffel/transform-shaker": "npm:^1.0.5" + "@griffel/core": "workspace:*" + "@griffel/transform-shaker": "workspace:*" debug: "npm:^4.3.0" magic-string: "npm:^0.30.19" oxc-parser: "npm:^0.129.0" @@ -3893,17 +3905,20 @@ __metadata: "@griffel/update-shorthands@workspace:tools/update-shorthands": version: 0.0.0-use.local resolution: "@griffel/update-shorthands@workspace:tools/update-shorthands" + dependencies: + "@griffel/core": "workspace:*" + "@griffel/style-types": "workspace:*" languageName: unknown linkType: soft -"@griffel/webpack-extraction-plugin@workspace:packages/webpack-extraction-plugin": +"@griffel/webpack-extraction-plugin@workspace:*, @griffel/webpack-extraction-plugin@workspace:packages/webpack-extraction-plugin": version: 0.0.0-use.local resolution: "@griffel/webpack-extraction-plugin@workspace:packages/webpack-extraction-plugin" dependencies: "@babel/core": "npm:^7.29.0" "@babel/helper-module-imports": "npm:^7.22.15" "@babel/helper-plugin-utils": "npm:^7.28.6" - "@griffel/core": "npm:^1.21.0" + "@griffel/core": "workspace:*" stylis: "npm:^4.4.0" tslib: "npm:^2.1.0" peerDependencies: @@ -3911,12 +3926,12 @@ __metadata: languageName: unknown linkType: soft -"@griffel/webpack-loader@workspace:packages/webpack-loader": +"@griffel/webpack-loader@workspace:*, @griffel/webpack-loader@workspace:packages/webpack-loader": version: 0.0.0-use.local resolution: "@griffel/webpack-loader@workspace:packages/webpack-loader" dependencies: "@babel/core": "npm:^7.29.0" - "@griffel/babel-preset": "npm:^1.8.4" + "@griffel/babel-preset": "workspace:*" enhanced-resolve: "npm:^5.21.0" tslib: "npm:^2.1.0" peerDependencies: @@ -3928,8 +3943,8 @@ __metadata: version: 0.0.0-use.local resolution: "@griffel/webpack-plugin@workspace:packages/webpack-plugin" dependencies: - "@griffel/core": "npm:^1.21.0" - "@griffel/transform": "npm:^3.0.4" + "@griffel/core": "workspace:*" + "@griffel/transform": "workspace:*" oxc-resolver: "npm:^11.19.1" stylis: "npm:^4.4.0" peerDependencies: @@ -3937,6 +3952,12 @@ __metadata: languageName: unknown linkType: soft +"@griffel/website@workspace:apps/website": + version: 0.0.0-use.local + resolution: "@griffel/website@workspace:apps/website" + languageName: unknown + linkType: soft + "@hapi/hoek@npm:^9.0.0": version: 9.3.0 resolution: "@hapi/hoek@npm:9.3.0" From e5c518bf46c979a64293d853716fe3cffe24c24d Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 7 May 2026 21:07:20 +0200 Subject: [PATCH 2/4] chore: emit per-package dist/, dual-emit ESM+CJS via build-cjs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Build outputs now land at packages/X/dist/ (workspace-relative) instead of dist/packages/X/. This means npm publish from packages/X/ works without the beachball patch — to be removed once verified. - Replace @nx/js:tsc with run-commands invoking tsc + tools/copy-pkg-assets.mjs so tsc's rootDir flattens src/ properly (the executor was preserving src/ in output paths). - Extend tools/build-cjs.mjs to also emit .d.cts alongside .cjs, so CJS consumers under moduleResolution: node16 see CJS-context type declarations via the require export condition. - Dual packages (core/react/shadow-dom): build target chains _build_tsc → build-cjs so consumers' ^build picks up the .cjs output. - exports.require gets per-condition types (./dist/cjs/index.d.cts). - Add files: ["dist/", README, LICENSE] to every published package.json. - Add resolve.conditions: ["@griffel/source"] to every vitest.config so vitest picks up the source-resolution path during tests. Status: - type-check ✅ 20/20 - lint ✅ 15/15 (pre-existing warnings only) - build ✅ 15/15 - test ✅ 15/17, 2 inline-snapshot mismatches in transform/webpack-plugin VM-error-trace tests (formatting diff, just need snapshot update) Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/babel-preset/package.json | 8 +++- packages/babel-preset/project.json | 23 ++++-------- packages/babel-preset/vitest.config.mts | 2 + packages/core/package.json | 15 ++++++-- packages/core/project.json | 34 ++++++----------- packages/core/vitest.config.ts | 2 + packages/eslint-plugin/package.json | 8 +++- packages/eslint-plugin/project.json | 23 ++++-------- packages/eslint-plugin/vitest.config.mts | 2 + packages/jest-serializer/package.json | 8 +++- packages/jest-serializer/project.json | 23 ++++-------- packages/jest-serializer/vitest.config.mts | 2 + packages/postcss-syntax/package.json | 8 +++- packages/postcss-syntax/project.json | 23 ++++-------- packages/postcss-syntax/vitest.config.mts | 2 + packages/react/package.json | 15 ++++++-- packages/react/project.json | 34 ++++++----------- packages/react/vitest.config.ts | 2 + packages/shadow-dom/package.json | 15 ++++++-- packages/shadow-dom/project.json | 37 ++++++++----------- packages/shadow-dom/vitest.config.ts | 2 + packages/style-types/package.json | 8 +++- packages/style-types/project.json | 23 ++++-------- packages/transform-shaker/package.json | 12 ++++-- packages/transform-shaker/project.json | 23 ++++-------- packages/transform-shaker/vitest.config.mts | 2 + packages/transform/package.json | 12 ++++-- packages/transform/project.json | 23 ++++-------- packages/transform/vitest.config.mts | 2 + .../webpack-extraction-plugin/package.json | 8 +++- .../webpack-extraction-plugin/project.json | 28 ++++---------- .../vitest.config.mts | 2 + packages/webpack-loader/package.json | 8 +++- packages/webpack-loader/project.json | 23 ++++-------- packages/webpack-loader/vitest.config.mts | 2 + packages/webpack-plugin/package.json | 14 +++++-- packages/webpack-plugin/project.json | 28 ++++---------- packages/webpack-plugin/vitest.config.mts | 2 + tools/build-cjs.mjs | 30 ++++++++++++--- tools/copy-pkg-assets.mjs | 33 +++++++++++++++++ 40 files changed, 313 insertions(+), 258 deletions(-) create mode 100644 tools/copy-pkg-assets.mjs diff --git a/packages/babel-preset/package.json b/packages/babel-preset/package.json index 5c5f3c7d7..7bf91762f 100644 --- a/packages/babel-preset/package.json +++ b/packages/babel-preset/package.json @@ -29,5 +29,11 @@ "default": "./dist/index.js" }, "./package.json": "./package.json" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/babel-preset/project.json b/packages/babel-preset/project.json index 0e53532c6..e2a39d86f 100644 --- a/packages/babel-preset/project.json +++ b/packages/babel-preset/project.json @@ -17,22 +17,15 @@ } }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/babel-preset/dist"], "options": { - "outputPath": "dist/packages/babel-preset", - "tsConfig": "packages/babel-preset/tsconfig.build.json", - "skipTypeField": true, - "packageJson": "packages/babel-preset/package.json", - "main": "packages/babel-preset/src/index.ts", - "assets": [ - "packages/babel-preset/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] + "cwd": "packages/babel-preset", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/babel-preset" + ], + "parallel": false } } } diff --git a/packages/babel-preset/vitest.config.mts b/packages/babel-preset/vitest.config.mts index 07f6c649b..fc73d2c91 100644 --- a/packages/babel-preset/vitest.config.mts +++ b/packages/babel-preset/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/babel-preset', plugins: [nxViteTsPaths()], diff --git a/packages/core/package.json b/packages/core/package.json index 5f852f8d3..c75ef85a0 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -9,7 +9,7 @@ }, "sideEffects": false, "type": "module", - "main": "./lib/index.cjs", + "main": "./dist/cjs/index.cjs", "module": "./dist/index.js", "types": "./src/index.ts", "exports": { @@ -17,7 +17,10 @@ "@griffel/source": "./src/index.ts", "types": "./src/index.ts", "import": "./dist/index.js", - "require": "./lib/index.cjs" + "require": { + "types": "./dist/cjs/index.d.cts", + "default": "./dist/cjs/index.cjs" + } }, "./package.json": "./package.json" }, @@ -28,5 +31,11 @@ "rtl-css-js": "^1.16.1", "stylis": "^4.4.0", "tslib": "^2.1.0" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/core/project.json b/packages/core/project.json index cf57c52c8..9bfcc0de9 100644 --- a/packages/core/project.json +++ b/packages/core/project.json @@ -6,30 +6,11 @@ "tags": [], "targets": { "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/core", - "tsConfig": "packages/core/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/core/package.json", - "main": "packages/core/src/index.ts", - "assets": [ - "packages/core/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] - } - }, - "build-cjs": { - "dependsOn": ["build"], "executor": "nx:run-commands", - "outputs": ["{workspaceRoot}/dist/packages/core/lib"], + "dependsOn": ["_build_tsc"], + "outputs": ["{workspaceRoot}/packages/core/dist/cjs"], "options": { - "command": "node tools/build-cjs.mjs dist/packages/core/src dist/packages/core/lib" + "command": "node tools/build-cjs.mjs packages/core/dist packages/core/dist/cjs" } }, "lint": { @@ -54,6 +35,15 @@ } ] } + }, + "_build_tsc": { + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/core/dist"], + "options": { + "cwd": "packages/core", + "commands": ["tsc --build tsconfig.lib.json --pretty", "node ../../tools/copy-pkg-assets.mjs packages/core"], + "parallel": false + } } } } diff --git a/packages/core/vitest.config.ts b/packages/core/vitest.config.ts index 0229c87f1..e551c7e6c 100644 --- a/packages/core/vitest.config.ts +++ b/packages/core/vitest.config.ts @@ -4,6 +4,8 @@ import { defineBrowserCommand } from '@vitest/browser-playwright'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/core', plugins: [nxViteTsPaths()], diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 1215a8214..02f324d67 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -25,5 +25,11 @@ "default": "./dist/index.js" }, "./package.json": "./package.json" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json index 92088e1f8..e2bb5f7c6 100644 --- a/packages/eslint-plugin/project.json +++ b/packages/eslint-plugin/project.json @@ -14,22 +14,15 @@ "outputs": ["{workspaceRoot}/coverage/packages/eslint-plugin"] }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/eslint-plugin/dist"], "options": { - "outputPath": "dist/packages/eslint-plugin", - "tsConfig": "packages/eslint-plugin/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/eslint-plugin/package.json", - "main": "packages/eslint-plugin/src/index.ts", - "assets": [ - "packages/eslint-plugin/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] + "cwd": "packages/eslint-plugin", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/eslint-plugin" + ], + "parallel": false } } } diff --git a/packages/eslint-plugin/vitest.config.mts b/packages/eslint-plugin/vitest.config.mts index 62dfe805a..268b91cb5 100644 --- a/packages/eslint-plugin/vitest.config.mts +++ b/packages/eslint-plugin/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/eslint-plugin', plugins: [nxViteTsPaths()], diff --git a/packages/jest-serializer/package.json b/packages/jest-serializer/package.json index 333082675..f92196bb7 100644 --- a/packages/jest-serializer/package.json +++ b/packages/jest-serializer/package.json @@ -20,5 +20,11 @@ "default": "./dist/index.js" }, "./package.json": "./package.json" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/jest-serializer/project.json b/packages/jest-serializer/project.json index 98c36e103..f20a629a2 100644 --- a/packages/jest-serializer/project.json +++ b/packages/jest-serializer/project.json @@ -17,22 +17,15 @@ } }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/jest-serializer/dist"], "options": { - "outputPath": "dist/packages/jest-serializer", - "tsConfig": "packages/jest-serializer/tsconfig.build.json", - "skipTypeField": true, - "packageJson": "packages/jest-serializer/package.json", - "main": "packages/jest-serializer/src/index.ts", - "assets": [ - "packages/jest-serializer/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] + "cwd": "packages/jest-serializer", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/jest-serializer" + ], + "parallel": false } } } diff --git a/packages/jest-serializer/vitest.config.mts b/packages/jest-serializer/vitest.config.mts index fa5a41eef..7fb7276dc 100644 --- a/packages/jest-serializer/vitest.config.mts +++ b/packages/jest-serializer/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/jest-serializer', plugins: [nxViteTsPaths()], diff --git a/packages/postcss-syntax/package.json b/packages/postcss-syntax/package.json index 34b708b09..5f9628a0c 100644 --- a/packages/postcss-syntax/package.json +++ b/packages/postcss-syntax/package.json @@ -22,5 +22,11 @@ "default": "./dist/index.js" }, "./package.json": "./package.json" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/postcss-syntax/project.json b/packages/postcss-syntax/project.json index e515a1352..b5c61cc0d 100644 --- a/packages/postcss-syntax/project.json +++ b/packages/postcss-syntax/project.json @@ -17,22 +17,15 @@ } }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/postcss-syntax/dist"], "options": { - "outputPath": "dist/packages/postcss-syntax", - "tsConfig": "packages/postcss-syntax/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/postcss-syntax/package.json", - "main": "packages/postcss-syntax/src/index.ts", - "assets": [ - "packages/postcss-syntax/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] + "cwd": "packages/postcss-syntax", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/postcss-syntax" + ], + "parallel": false } } } diff --git a/packages/postcss-syntax/vitest.config.mts b/packages/postcss-syntax/vitest.config.mts index 68e5ff484..4417251cf 100644 --- a/packages/postcss-syntax/vitest.config.mts +++ b/packages/postcss-syntax/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/postcss-syntax', plugins: [nxViteTsPaths()], diff --git a/packages/react/package.json b/packages/react/package.json index c7c93cd7a..85e2e5d0d 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -9,7 +9,7 @@ }, "sideEffects": false, "type": "module", - "main": "./lib/index.cjs", + "main": "./dist/cjs/index.cjs", "module": "./dist/index.js", "types": "./src/index.ts", "exports": { @@ -17,7 +17,10 @@ "@griffel/source": "./src/index.ts", "types": "./src/index.ts", "import": "./dist/index.js", - "require": "./lib/index.cjs" + "require": { + "types": "./dist/cjs/index.d.cts", + "default": "./dist/cjs/index.cjs" + } }, "./package.json": "./package.json" }, @@ -33,5 +36,11 @@ }, "peerDependencies": { "react": ">=16.14.0 <20.0.0" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/react/project.json b/packages/react/project.json index c328235ec..354722034 100644 --- a/packages/react/project.json +++ b/packages/react/project.json @@ -6,30 +6,11 @@ "tags": [], "targets": { "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/react", - "tsConfig": "packages/react/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/react/package.json", - "main": "packages/react/src/index.ts", - "assets": [ - "packages/react/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] - } - }, - "build-cjs": { - "dependsOn": ["build"], "executor": "nx:run-commands", - "outputs": ["{workspaceRoot}/dist/packages/react/lib"], + "dependsOn": ["_build_tsc"], + "outputs": ["{workspaceRoot}/packages/react/dist/cjs"], "options": { - "command": "node tools/build-cjs.mjs dist/packages/react/src dist/packages/react/lib" + "command": "node tools/build-cjs.mjs packages/react/dist packages/react/dist/cjs" } }, "lint": { @@ -79,6 +60,15 @@ "quiet": true } } + }, + "_build_tsc": { + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/react/dist"], + "options": { + "cwd": "packages/react", + "commands": ["tsc --build tsconfig.lib.json --pretty", "node ../../tools/copy-pkg-assets.mjs packages/react"], + "parallel": false + } } } } diff --git a/packages/react/vitest.config.ts b/packages/react/vitest.config.ts index 3440e6e04..45cbd276e 100644 --- a/packages/react/vitest.config.ts +++ b/packages/react/vitest.config.ts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/react', plugins: [nxViteTsPaths()], diff --git a/packages/shadow-dom/package.json b/packages/shadow-dom/package.json index 78bf4c79e..ac77f1a4d 100644 --- a/packages/shadow-dom/package.json +++ b/packages/shadow-dom/package.json @@ -9,7 +9,7 @@ }, "sideEffects": false, "type": "module", - "main": "./lib/index.cjs", + "main": "./dist/cjs/index.cjs", "module": "./dist/index.js", "types": "./src/index.ts", "exports": { @@ -17,12 +17,21 @@ "@griffel/source": "./src/index.ts", "types": "./src/index.ts", "import": "./dist/index.js", - "require": "./lib/index.cjs" + "require": { + "types": "./dist/cjs/index.d.cts", + "default": "./dist/cjs/index.cjs" + } }, "./package.json": "./package.json" }, "dependencies": { "@griffel/core": "workspace:*", "tslib": "^2.1.0" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/shadow-dom/project.json b/packages/shadow-dom/project.json index ad59cd815..769691315 100644 --- a/packages/shadow-dom/project.json +++ b/packages/shadow-dom/project.json @@ -6,30 +6,11 @@ "tags": [], "targets": { "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/shadow-dom", - "tsConfig": "packages/shadow-dom/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/shadow-dom/package.json", - "main": "packages/shadow-dom/src/index.ts", - "assets": [ - "packages/shadow-dom/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] - } - }, - "build-cjs": { - "dependsOn": ["build"], "executor": "nx:run-commands", - "outputs": ["{workspaceRoot}/dist/packages/shadow-dom/lib"], + "dependsOn": ["_build_tsc"], + "outputs": ["{workspaceRoot}/packages/shadow-dom/dist/cjs"], "options": { - "command": "node tools/build-cjs.mjs dist/packages/shadow-dom/src dist/packages/shadow-dom/lib" + "command": "node tools/build-cjs.mjs packages/shadow-dom/dist packages/shadow-dom/dist/cjs" } }, "lint": { @@ -79,6 +60,18 @@ "quiet": true } } + }, + "_build_tsc": { + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/shadow-dom/dist"], + "options": { + "cwd": "packages/shadow-dom", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/shadow-dom" + ], + "parallel": false + } } } } diff --git a/packages/shadow-dom/vitest.config.ts b/packages/shadow-dom/vitest.config.ts index ec013ca2a..39769efa0 100644 --- a/packages/shadow-dom/vitest.config.ts +++ b/packages/shadow-dom/vitest.config.ts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/shadow-dom', plugins: [nxViteTsPaths()], diff --git a/packages/style-types/package.json b/packages/style-types/package.json index f62737063..64d82865b 100644 --- a/packages/style-types/package.json +++ b/packages/style-types/package.json @@ -20,5 +20,11 @@ "default": "./dist/index.js" }, "./package.json": "./package.json" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/style-types/project.json b/packages/style-types/project.json index c37a6213e..17c5287b3 100644 --- a/packages/style-types/project.json +++ b/packages/style-types/project.json @@ -6,22 +6,15 @@ "tags": [], "targets": { "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/style-types/dist"], "options": { - "outputPath": "dist/packages/style-types", - "tsConfig": "packages/style-types/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/style-types/package.json", - "main": "packages/style-types/src/index.ts", - "assets": [ - "packages/style-types/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] + "cwd": "packages/style-types", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/style-types" + ], + "parallel": false } }, "lint": { diff --git a/packages/transform-shaker/package.json b/packages/transform-shaker/package.json index bbef017ee..84c01d9ca 100644 --- a/packages/transform-shaker/package.json +++ b/packages/transform-shaker/package.json @@ -8,13 +8,13 @@ "url": "https://github.com/microsoft/griffel" }, "type": "module", - "main": "./src/index.js", + "main": "./dist/index.js", "types": "./src/index.ts", "exports": { ".": { "@griffel/source": "./src/index.ts", "types": "./src/index.ts", - "default": "./src/index.js" + "default": "./dist/index.js" }, "./package.json": "./package.json" }, @@ -23,5 +23,11 @@ "magic-string": "^0.30.19", "oxc-parser": "^0.129.0", "oxc-transform": "^0.129.0" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/transform-shaker/project.json b/packages/transform-shaker/project.json index 19e2f1664..3c8b6159e 100644 --- a/packages/transform-shaker/project.json +++ b/packages/transform-shaker/project.json @@ -17,22 +17,15 @@ } }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/transform-shaker/dist"], "options": { - "outputPath": "dist/packages/transform-shaker", - "tsConfig": "packages/transform-shaker/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/transform-shaker/package.json", - "main": "packages/transform-shaker/src/index.ts", - "assets": [ - "packages/transform-shaker/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] + "cwd": "packages/transform-shaker", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/transform-shaker" + ], + "parallel": false } } } diff --git a/packages/transform-shaker/vitest.config.mts b/packages/transform-shaker/vitest.config.mts index 00c9709f6..52f6c094f 100644 --- a/packages/transform-shaker/vitest.config.mts +++ b/packages/transform-shaker/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/transform-shaker', plugins: [nxViteTsPaths()], diff --git a/packages/transform/package.json b/packages/transform/package.json index 0702ace3b..6557df642 100644 --- a/packages/transform/package.json +++ b/packages/transform/package.json @@ -8,13 +8,13 @@ "url": "https://github.com/microsoft/griffel" }, "type": "module", - "main": "./src/index.mjs", + "main": "./dist/index.mjs", "types": "./src/index.mts", "exports": { ".": { "@griffel/source": "./src/index.mts", "types": "./src/index.mts", - "default": "./src/index.mjs" + "default": "./dist/index.mjs" }, "./package.json": "./package.json" }, @@ -25,5 +25,11 @@ "magic-string": "^0.30.19", "oxc-parser": "^0.129.0", "oxc-walker": "^0.7.0" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/transform/project.json b/packages/transform/project.json index 384783bfa..eb8f9d406 100644 --- a/packages/transform/project.json +++ b/packages/transform/project.json @@ -17,22 +17,15 @@ } }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/transform/dist"], "options": { - "outputPath": "dist/packages/transform", - "tsConfig": "packages/transform/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/transform/package.json", - "main": "packages/transform/src/index.mts", - "assets": [ - "packages/transform/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] + "cwd": "packages/transform", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/transform" + ], + "parallel": false } } } diff --git a/packages/transform/vitest.config.mts b/packages/transform/vitest.config.mts index 89b69bdee..5eaaf9b04 100644 --- a/packages/transform/vitest.config.mts +++ b/packages/transform/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/transform', plugins: [nxViteTsPaths()], diff --git a/packages/webpack-extraction-plugin/package.json b/packages/webpack-extraction-plugin/package.json index 02f8e55db..e1cbef323 100644 --- a/packages/webpack-extraction-plugin/package.json +++ b/packages/webpack-extraction-plugin/package.json @@ -27,5 +27,11 @@ "default": "./dist/index.js" }, "./package.json": "./package.json" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/webpack-extraction-plugin/project.json b/packages/webpack-extraction-plugin/project.json index a15a0286b..f6d63190b 100644 --- a/packages/webpack-extraction-plugin/project.json +++ b/packages/webpack-extraction-plugin/project.json @@ -17,27 +17,15 @@ } }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/webpack-extraction-plugin/dist"], "options": { - "outputPath": "dist/packages/webpack-extraction-plugin", - "tsConfig": "packages/webpack-extraction-plugin/tsconfig.build.json", - "skipTypeField": true, - "packageJson": "packages/webpack-extraction-plugin/package.json", - "main": "packages/webpack-extraction-plugin/src/index.ts", - "assets": [ - "packages/webpack-extraction-plugin/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - }, - { - "glob": "*.(css|js)", - "input": "packages/webpack-extraction-plugin/virtual-loader", - "output": "./virtual-loader" - } - ] + "cwd": "packages/webpack-extraction-plugin", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/webpack-extraction-plugin" + ], + "parallel": false } } } diff --git a/packages/webpack-extraction-plugin/vitest.config.mts b/packages/webpack-extraction-plugin/vitest.config.mts index a8f30bf12..2f0e51d6a 100644 --- a/packages/webpack-extraction-plugin/vitest.config.mts +++ b/packages/webpack-extraction-plugin/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/webpack-extraction-plugin', plugins: [nxViteTsPaths()], diff --git a/packages/webpack-loader/package.json b/packages/webpack-loader/package.json index 2ff026006..db264cc5e 100644 --- a/packages/webpack-loader/package.json +++ b/packages/webpack-loader/package.json @@ -25,5 +25,11 @@ "default": "./dist/index.js" }, "./package.json": "./package.json" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/webpack-loader/project.json b/packages/webpack-loader/project.json index e85a158e4..3b80494ef 100644 --- a/packages/webpack-loader/project.json +++ b/packages/webpack-loader/project.json @@ -17,22 +17,15 @@ } }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/webpack-loader/dist"], "options": { - "outputPath": "dist/packages/webpack-loader", - "tsConfig": "packages/webpack-loader/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/webpack-loader/package.json", - "main": "packages/webpack-loader/src/index.ts", - "assets": [ - "packages/webpack-loader/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] + "cwd": "packages/webpack-loader", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/webpack-loader" + ], + "parallel": false } } } diff --git a/packages/webpack-loader/vitest.config.mts b/packages/webpack-loader/vitest.config.mts index 13d3c63e6..2a7e8c4dd 100644 --- a/packages/webpack-loader/vitest.config.mts +++ b/packages/webpack-loader/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/webpack-loader', plugins: [nxViteTsPaths()], diff --git a/packages/webpack-plugin/package.json b/packages/webpack-plugin/package.json index 04936781a..8dcaf61ac 100644 --- a/packages/webpack-plugin/package.json +++ b/packages/webpack-plugin/package.json @@ -8,18 +8,18 @@ "url": "https://github.com/microsoft/griffel" }, "type": "module", - "main": "./src/index.mjs", + "main": "./dist/index.mjs", "types": "./src/index.mts", "exports": { ".": { "@griffel/source": "./src/index.mts", "types": "./src/index.mts", - "default": "./src/index.mjs" + "default": "./dist/index.mjs" }, "./loader": { "@griffel/source": "./src/webpackLoader.mts", "types": "./src/webpackLoader.mts", - "default": "./src/webpackLoader.mjs" + "default": "./dist/webpackLoader.mjs" }, "./package.json": "./package.json" }, @@ -31,5 +31,11 @@ }, "peerDependencies": { "webpack": "^5" - } + }, + "files": [ + "dist/", + "README.md", + "LICENSE.md", + "CHANGELOG.md" + ] } diff --git a/packages/webpack-plugin/project.json b/packages/webpack-plugin/project.json index 33f4d5b59..c1babf161 100644 --- a/packages/webpack-plugin/project.json +++ b/packages/webpack-plugin/project.json @@ -10,27 +10,15 @@ "outputs": ["{options.outputFile}"] }, "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], + "executor": "nx:run-commands", + "outputs": ["{workspaceRoot}/packages/webpack-plugin/dist"], "options": { - "outputPath": "dist/packages/webpack-plugin", - "tsConfig": "packages/webpack-plugin/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/webpack-plugin/package.json", - "main": "packages/webpack-plugin/src/index.mts", - "assets": [ - "packages/webpack-plugin/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - }, - { - "glob": "*", - "input": "packages/webpack-plugin/src/virtual-loader", - "output": "src/virtual-loader" - } - ] + "cwd": "packages/webpack-plugin", + "commands": [ + "tsc --build tsconfig.lib.json --pretty", + "node ../../tools/copy-pkg-assets.mjs packages/webpack-plugin" + ], + "parallel": false } }, "test": { diff --git a/packages/webpack-plugin/vitest.config.mts b/packages/webpack-plugin/vitest.config.mts index 93f5bea6f..fd385af1a 100644 --- a/packages/webpack-plugin/vitest.config.mts +++ b/packages/webpack-plugin/vitest.config.mts @@ -2,6 +2,8 @@ import { defineConfig } from 'vitest/config'; import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; export default defineConfig({ + resolve: { conditions: ['@griffel/source'] }, + ssr: { resolve: { conditions: ['@griffel/source'] } }, root: __dirname, cacheDir: '../../node_modules/.vite/packages/webpack-plugin', plugins: [nxViteTsPaths()], diff --git a/tools/build-cjs.mjs b/tools/build-cjs.mjs index 355527d0a..ff18813d1 100644 --- a/tools/build-cjs.mjs +++ b/tools/build-cjs.mjs @@ -1,10 +1,13 @@ /** * Converts ESM .js files to CJS .cjs files using SWC. + * Also copies .d.ts files alongside as .d.cts so consumers using the + * `require` exports condition under moduleResolution: node16/nodenext + * see CJS-context type declarations. * * Usage: node tools/build-cjs.mjs */ import { transformFileSync } from '@swc/core'; -import { mkdirSync, readdirSync, writeFileSync } from 'node:fs'; +import { mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; import { dirname, join, resolve, relative } from 'node:path'; const [esmDir, cjsDir] = process.argv.slice(2); @@ -17,20 +20,21 @@ if (!esmDir || !cjsDir) { const absEsmDir = resolve(esmDir); const absCjsDir = resolve(cjsDir); -function collectJsFiles(dir) { +function collectFiles(dir, predicate) { const results = []; for (const entry of readdirSync(dir, { withFileTypes: true })) { + if (entry.name === 'cjs') continue; // skip output sub-directory const fullPath = join(dir, entry.name); if (entry.isDirectory()) { - results.push(...collectJsFiles(fullPath)); - } else if (entry.name.endsWith('.js')) { + results.push(...collectFiles(fullPath, predicate)); + } else if (predicate(entry.name)) { results.push(fullPath); } } return results; } -const jsFiles = collectJsFiles(absEsmDir); +const jsFiles = collectFiles(absEsmDir, name => name.endsWith('.js')); for (const absInput of jsFiles) { const rel = relative(absEsmDir, absInput); @@ -52,4 +56,18 @@ for (const absInput of jsFiles) { writeFileSync(absOutput, cjsCode); } -console.log(`Converted ${jsFiles.length} ESM → CJS files into ${cjsDir}`); +const dtsFiles = collectFiles(absEsmDir, name => name.endsWith('.d.ts') && !name.endsWith('.d.cts')); + +for (const absInput of dtsFiles) { + const rel = relative(absEsmDir, absInput); + const absOutput = join(absCjsDir, rel.replace(/\.d\.ts$/, '.d.cts')); + // Rewrite relative .js extensions in import/export specifiers to .cjs + const dtsCode = readFileSync(absInput, 'utf8').replace( + /(from\s+["']\.\.?\/[^"']+)\.js(["'])/g, + '$1.cjs$2', + ); + mkdirSync(dirname(absOutput), { recursive: true }); + writeFileSync(absOutput, dtsCode); +} + +console.log(`Converted ${jsFiles.length} ESM → CJS files and ${dtsFiles.length} .d.ts → .d.cts into ${cjsDir}`); diff --git a/tools/copy-pkg-assets.mjs b/tools/copy-pkg-assets.mjs new file mode 100644 index 000000000..4f96ac6ca --- /dev/null +++ b/tools/copy-pkg-assets.mjs @@ -0,0 +1,33 @@ +/** + * Copies package.json, README.md, LICENSE.md into the package's dist/. + * + * Usage: node tools/copy-pkg-assets.mjs + * + * Reads /{package.json,README.md} and copies them along with + * the workspace-root LICENSE.md into /dist/. + */ +import { copyFileSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { dirname, join, resolve } from 'node:path'; +import { fileURLToPath } from 'node:url'; + +const [pkgDir] = process.argv.slice(2); +if (!pkgDir) { + console.error('Usage: node tools/copy-pkg-assets.mjs '); + process.exit(1); +} + +const repoRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..'); +const absPkg = resolve(repoRoot, pkgDir); +const distDir = join(absPkg, 'dist'); + +mkdirSync(distDir, { recursive: true }); + +const pkgJson = JSON.parse(readFileSync(join(absPkg, 'package.json'), 'utf8')); +delete pkgJson.scripts; +delete pkgJson.devDependencies; +writeFileSync(join(distDir, 'package.json'), JSON.stringify(pkgJson, null, 2) + '\n'); + +for (const f of ['README.md', 'LICENSE.md']) { + const src = existsSync(join(absPkg, f)) ? join(absPkg, f) : join(repoRoot, f); + if (existsSync(src)) copyFileSync(src, join(distDir, f)); +} From 0492084e601fe11386de82acd3e1cc9b883f2197 Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 7 May 2026 21:08:50 +0200 Subject: [PATCH 3/4] test(transform, webpack-plugin): refresh VM-error-trace snapshots Stack frame format gained "Module." prefix on require.Object.assign.ensure under the new resolution path. Functional behavior unchanged. Co-Authored-By: Claude Opus 4.7 (1M context) --- packages/transform/src/evaluation/module.test.mts | 2 +- packages/webpack-plugin/src/GriffelPlugin.test.mts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/transform/src/evaluation/module.test.mts b/packages/transform/src/evaluation/module.test.mts index 563fec244..8f42edad5 100644 --- a/packages/transform/src/evaluation/module.test.mts +++ b/packages/transform/src/evaluation/module.test.mts @@ -73,7 +73,7 @@ describe('Module', () => { at /child.js: at Script.runInContext (node:vm:) at Module.evaluate (/packages/transform/src/evaluation/module.mts:) - at require.Object.assign.ensure (/packages/transform/src/evaluation/module.mts:) + at Module.require.Object.assign.ensure (/packages/transform/src/evaluation/module.mts:) at /entry.js: at /entry.js: at Script.runInContext (node:vm:) diff --git a/packages/webpack-plugin/src/GriffelPlugin.test.mts b/packages/webpack-plugin/src/GriffelPlugin.test.mts index 1631084ca..09fa53f47 100644 --- a/packages/webpack-plugin/src/GriffelPlugin.test.mts +++ b/packages/webpack-plugin/src/GriffelPlugin.test.mts @@ -473,7 +473,7 @@ describe('GriffelCSSExtractionPlugin', () => { at /packages/webpack-plugin/__fixtures__/vm-error-trace/broken.ts: at Script.runInContext (node:vm:) at Module.evaluate (/packages/transform/src/evaluation/module.mts:) - at require.Object.assign.ensure (/packages/transform/src/evaluation/module.mts:) + at Module.require.Object.assign.ensure (/packages/transform/src/evaluation/module.mts:) at /packages/webpack-plugin/__fixtures__/vm-error-trace/code.ts: at /packages/webpack-plugin/__fixtures__/vm-error-trace/code.ts: at Script.runInContext (node:vm:) From 905f100687ac13647c9b31f476f6aff16f1a45af Mon Sep 17 00:00:00 2001 From: Oleksandr Fediashov Date: Thu, 7 May 2026 21:16:02 +0200 Subject: [PATCH 4/4] chore: switch publishable deps from workspace:* to ^x.y.z, fix e2e packing MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Restore versioned ranges (^X.Y.Z) for internal @griffel/* dependencies in publishable packages. Workspace:* breaks npm pack — yarn rewrites it at publish time but npm pack does not, leaving "workspace:*" literally in the .tgz package.json. Yarn workspaces still resolve ^X.Y.Z to the local package when the version matches, so dev mode is unaffected. - e2e/* and tools/update-shorthands devDependencies stay workspace:* (not published). - Update e2e/utils/src/packLocalPackage.ts to look at packages/X/ as the package root (npm pack from there picks up dist/ via the files field). Old code pointed at dist/packages/X which no longer exists with per-package dist/. - Switch types fields back to ./dist/index.d.ts (and .d.mts where applicable). Per-condition types in exports.require still point at ./dist/cjs/index.d.cts. The @griffel/source condition (TS) and vitest's resolve.conditions still resolve to source TS in dev/test. All targets pass for 19/20 projects (e2e/rspack fails the same way on main — pre-existing, not migration-related). Co-Authored-By: Claude Opus 4.7 (1M context) --- e2e/utils/src/packLocalPackage.ts | 9 +++-- packages/babel-preset/package.json | 6 +-- packages/core/package.json | 6 +-- packages/devtools/package.json | 2 +- packages/eslint-plugin/package.json | 4 +- packages/jest-serializer/package.json | 6 +-- packages/postcss-syntax/package.json | 6 +-- packages/react/package.json | 6 +-- packages/shadow-dom/package.json | 6 +-- packages/style-types/package.json | 4 +- packages/transform-shaker/package.json | 4 +- packages/transform/package.json | 8 ++-- .../webpack-extraction-plugin/package.json | 6 +-- packages/webpack-loader/package.json | 6 +-- packages/webpack-plugin/package.json | 10 ++--- yarn.lock | 38 +++++++++---------- 16 files changed, 64 insertions(+), 63 deletions(-) diff --git a/e2e/utils/src/packLocalPackage.ts b/e2e/utils/src/packLocalPackage.ts index 40d58fa37..474ea605e 100644 --- a/e2e/utils/src/packLocalPackage.ts +++ b/e2e/utils/src/packLocalPackage.ts @@ -4,11 +4,12 @@ import fs from 'fs'; import { sh } from './sh.ts'; export async function packLocalPackage(rootDir: string, tempDir: string, packageName: string) { - const packagePath = path.resolve(rootDir, 'dist', 'packages', packageName.split('/')[1]); - const packagePathExists = !!(await fs.promises.stat(packagePath).catch(() => false)); + const packagePath = path.resolve(rootDir, 'packages', packageName.split('/')[1]); + const distPath = path.resolve(packagePath, 'dist'); + const distExists = !!(await fs.promises.stat(distPath).catch(() => false)); - if (!packagePathExists) { - throw new Error(`A directory with artifacts (${packagePath}) does not exist`); + if (!distExists) { + throw new Error(`Build artifacts not found at "${distPath}" — run "nx run ${packageName}:build" first`); } // Use `npm pack` because `yarn pack` incorrectly calculates the included files when the diff --git a/packages/babel-preset/package.json b/packages/babel-preset/package.json index 7bf91762f..82e373be0 100644 --- a/packages/babel-preset/package.json +++ b/packages/babel-preset/package.json @@ -13,19 +13,19 @@ "@babel/helper-plugin-utils": "^7.28.6", "@babel/template": "^7.28.6", "@babel/traverse": "^7.29.0", - "@griffel/core": "workspace:*", + "@griffel/core": "^1.21.0", "@linaria/babel-preset": "^3.0.0-beta.24", "@linaria/shaker": "^3.0.0-beta.22", "ajv": "^8.20.0", "stylis": "^4.4.0", "tslib": "^2.1.0" }, - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "main": "./dist/index.js", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" diff --git a/packages/core/package.json b/packages/core/package.json index c75ef85a0..deeb0973a 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -11,11 +11,11 @@ "type": "module", "main": "./dist/cjs/index.cjs", "module": "./dist/index.js", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": { "types": "./dist/cjs/index.d.cts", @@ -26,7 +26,7 @@ }, "dependencies": { "@emotion/hash": "^0.9.0", - "@griffel/style-types": "workspace:*", + "@griffel/style-types": "^1.4.0", "csstype": "^3.2.3", "rtl-css-js": "^1.16.1", "stylis": "^4.4.0", diff --git a/packages/devtools/package.json b/packages/devtools/package.json index 87264d5b0..9bc0e0961 100644 --- a/packages/devtools/package.json +++ b/packages/devtools/package.json @@ -8,6 +8,6 @@ "url": "https://github.com/microsoft/griffel" }, "dependencies": { - "@griffel/react": "workspace:*" + "@griffel/react": "^1.7.2" } } diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 02f324d67..5b8334301 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -16,12 +16,12 @@ "peerDependencies": { "eslint": "^9.0.0 || ^10.0.0" }, - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "main": "./dist/index.js", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" diff --git a/packages/jest-serializer/package.json b/packages/jest-serializer/package.json index f92196bb7..0c99859b6 100644 --- a/packages/jest-serializer/package.json +++ b/packages/jest-serializer/package.json @@ -8,15 +8,15 @@ "url": "https://github.com/microsoft/griffel" }, "dependencies": { - "@griffel/core": "workspace:*", + "@griffel/core": "^1.21.0", "tslib": "^2.1.0" }, - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "main": "./dist/index.js", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" diff --git a/packages/postcss-syntax/package.json b/packages/postcss-syntax/package.json index 5f9628a0c..3cf5ef37c 100644 --- a/packages/postcss-syntax/package.json +++ b/packages/postcss-syntax/package.json @@ -10,15 +10,15 @@ "dependencies": { "@babel/core": "^7.29.0", "@babel/helper-plugin-utils": "^7.28.6", - "@griffel/babel-preset": "workspace:*", + "@griffel/babel-preset": "^1.8.4", "postcss": "^8.5.14" }, "main": "./dist/index.js", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" diff --git a/packages/react/package.json b/packages/react/package.json index 85e2e5d0d..7b6c500cb 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -11,11 +11,11 @@ "type": "module", "main": "./dist/cjs/index.cjs", "module": "./dist/index.js", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": { "types": "./dist/cjs/index.d.cts", @@ -31,7 +31,7 @@ } }, "dependencies": { - "@griffel/core": "workspace:*", + "@griffel/core": "^1.21.0", "tslib": "^2.1.0" }, "peerDependencies": { diff --git a/packages/shadow-dom/package.json b/packages/shadow-dom/package.json index ac77f1a4d..5cf7c2ebc 100644 --- a/packages/shadow-dom/package.json +++ b/packages/shadow-dom/package.json @@ -11,11 +11,11 @@ "type": "module", "main": "./dist/cjs/index.cjs", "module": "./dist/index.js", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "import": "./dist/index.js", "require": { "types": "./dist/cjs/index.d.cts", @@ -25,7 +25,7 @@ "./package.json": "./package.json" }, "dependencies": { - "@griffel/core": "workspace:*", + "@griffel/core": "^1.21.0", "tslib": "^2.1.0" }, "files": [ diff --git a/packages/style-types/package.json b/packages/style-types/package.json index 64d82865b..44bf5b3d4 100644 --- a/packages/style-types/package.json +++ b/packages/style-types/package.json @@ -11,12 +11,12 @@ "dependencies": { "csstype": "^3.2.3" }, - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "main": "./dist/index.js", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" diff --git a/packages/transform-shaker/package.json b/packages/transform-shaker/package.json index 84c01d9ca..61b42022f 100644 --- a/packages/transform-shaker/package.json +++ b/packages/transform-shaker/package.json @@ -9,11 +9,11 @@ }, "type": "module", "main": "./dist/index.js", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" diff --git a/packages/transform/package.json b/packages/transform/package.json index 6557df642..d766115f6 100644 --- a/packages/transform/package.json +++ b/packages/transform/package.json @@ -9,18 +9,18 @@ }, "type": "module", "main": "./dist/index.mjs", - "types": "./src/index.mts", + "types": "./dist/index.d.mts", "exports": { ".": { "@griffel/source": "./src/index.mts", - "types": "./src/index.mts", + "types": "./dist/index.d.mts", "default": "./dist/index.mjs" }, "./package.json": "./package.json" }, "dependencies": { - "@griffel/core": "workspace:*", - "@griffel/transform-shaker": "workspace:*", + "@griffel/core": "^1.21.0", + "@griffel/transform-shaker": "^1.0.5", "debug": "^4.3.0", "magic-string": "^0.30.19", "oxc-parser": "^0.129.0", diff --git a/packages/webpack-extraction-plugin/package.json b/packages/webpack-extraction-plugin/package.json index e1cbef323..b2c30699f 100644 --- a/packages/webpack-extraction-plugin/package.json +++ b/packages/webpack-extraction-plugin/package.json @@ -11,19 +11,19 @@ "@babel/core": "^7.29.0", "@babel/helper-module-imports": "^7.22.15", "@babel/helper-plugin-utils": "^7.28.6", - "@griffel/core": "workspace:*", + "@griffel/core": "^1.21.0", "stylis": "^4.4.0", "tslib": "^2.1.0" }, "peerDependencies": { "webpack": "^5" }, - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "main": "./dist/index.js", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" diff --git a/packages/webpack-loader/package.json b/packages/webpack-loader/package.json index db264cc5e..76f2f9916 100644 --- a/packages/webpack-loader/package.json +++ b/packages/webpack-loader/package.json @@ -9,19 +9,19 @@ }, "dependencies": { "@babel/core": "^7.29.0", - "@griffel/babel-preset": "workspace:*", + "@griffel/babel-preset": "^1.8.4", "enhanced-resolve": "^5.21.0", "tslib": "^2.1.0" }, "peerDependencies": { "webpack": "^5" }, - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "main": "./dist/index.js", "exports": { ".": { "@griffel/source": "./src/index.ts", - "types": "./src/index.ts", + "types": "./dist/index.d.ts", "default": "./dist/index.js" }, "./package.json": "./package.json" diff --git a/packages/webpack-plugin/package.json b/packages/webpack-plugin/package.json index 8dcaf61ac..d268a2786 100644 --- a/packages/webpack-plugin/package.json +++ b/packages/webpack-plugin/package.json @@ -9,23 +9,23 @@ }, "type": "module", "main": "./dist/index.mjs", - "types": "./src/index.mts", + "types": "./dist/index.d.mts", "exports": { ".": { "@griffel/source": "./src/index.mts", - "types": "./src/index.mts", + "types": "./dist/index.d.mts", "default": "./dist/index.mjs" }, "./loader": { "@griffel/source": "./src/webpackLoader.mts", - "types": "./src/webpackLoader.mts", + "types": "./dist/webpackLoader.d.mts", "default": "./dist/webpackLoader.mjs" }, "./package.json": "./package.json" }, "dependencies": { - "@griffel/core": "workspace:*", - "@griffel/transform": "workspace:*", + "@griffel/core": "^1.21.0", + "@griffel/transform": "^3.0.4", "oxc-resolver": "^11.19.1", "stylis": "^4.4.0" }, diff --git a/yarn.lock b/yarn.lock index ba4ddfd72..da425d090 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3743,7 +3743,7 @@ __metadata: languageName: node linkType: hard -"@griffel/babel-preset@workspace:*, @griffel/babel-preset@workspace:packages/babel-preset": +"@griffel/babel-preset@npm:^1.8.4, @griffel/babel-preset@workspace:packages/babel-preset": version: 0.0.0-use.local resolution: "@griffel/babel-preset@workspace:packages/babel-preset" dependencies: @@ -3752,7 +3752,7 @@ __metadata: "@babel/helper-plugin-utils": "npm:^7.28.6" "@babel/template": "npm:^7.28.6" "@babel/traverse": "npm:^7.29.0" - "@griffel/core": "workspace:*" + "@griffel/core": "npm:^1.21.0" "@linaria/babel-preset": "npm:^3.0.0-beta.24" "@linaria/shaker": "npm:^3.0.0-beta.22" ajv: "npm:^8.20.0" @@ -3761,12 +3761,12 @@ __metadata: languageName: unknown linkType: soft -"@griffel/core@workspace:*, @griffel/core@workspace:packages/core": +"@griffel/core@npm:^1.21.0, @griffel/core@workspace:*, @griffel/core@workspace:packages/core": version: 0.0.0-use.local resolution: "@griffel/core@workspace:packages/core" dependencies: "@emotion/hash": "npm:^0.9.0" - "@griffel/style-types": "workspace:*" + "@griffel/style-types": "npm:^1.4.0" csstype: "npm:^3.2.3" rtl-css-js: "npm:^1.16.1" stylis: "npm:^4.4.0" @@ -3778,7 +3778,7 @@ __metadata: version: 0.0.0-use.local resolution: "@griffel/devtools@workspace:packages/devtools" dependencies: - "@griffel/react": "workspace:*" + "@griffel/react": "npm:^1.7.2" languageName: unknown linkType: soft @@ -3834,7 +3834,7 @@ __metadata: version: 0.0.0-use.local resolution: "@griffel/jest-serializer@workspace:packages/jest-serializer" dependencies: - "@griffel/core": "workspace:*" + "@griffel/core": "npm:^1.21.0" tslib: "npm:^2.1.0" languageName: unknown linkType: soft @@ -3845,16 +3845,16 @@ __metadata: dependencies: "@babel/core": "npm:^7.29.0" "@babel/helper-plugin-utils": "npm:^7.28.6" - "@griffel/babel-preset": "workspace:*" + "@griffel/babel-preset": "npm:^1.8.4" postcss: "npm:^8.5.14" languageName: unknown linkType: soft -"@griffel/react@workspace:*, @griffel/react@workspace:packages/react": +"@griffel/react@npm:^1.7.2, @griffel/react@workspace:*, @griffel/react@workspace:packages/react": version: 0.0.0-use.local resolution: "@griffel/react@workspace:packages/react" dependencies: - "@griffel/core": "workspace:*" + "@griffel/core": "npm:^1.21.0" tslib: "npm:^2.1.0" peerDependencies: react: ">=16.14.0 <20.0.0" @@ -3865,12 +3865,12 @@ __metadata: version: 0.0.0-use.local resolution: "@griffel/shadow-dom@workspace:packages/shadow-dom" dependencies: - "@griffel/core": "workspace:*" + "@griffel/core": "npm:^1.21.0" tslib: "npm:^2.1.0" languageName: unknown linkType: soft -"@griffel/style-types@workspace:*, @griffel/style-types@workspace:packages/style-types": +"@griffel/style-types@npm:^1.4.0, @griffel/style-types@workspace:*, @griffel/style-types@workspace:packages/style-types": version: 0.0.0-use.local resolution: "@griffel/style-types@workspace:packages/style-types" dependencies: @@ -3878,7 +3878,7 @@ __metadata: languageName: unknown linkType: soft -"@griffel/transform-shaker@workspace:*, @griffel/transform-shaker@workspace:packages/transform-shaker": +"@griffel/transform-shaker@npm:^1.0.5, @griffel/transform-shaker@workspace:packages/transform-shaker": version: 0.0.0-use.local resolution: "@griffel/transform-shaker@workspace:packages/transform-shaker" dependencies: @@ -3889,12 +3889,12 @@ __metadata: languageName: unknown linkType: soft -"@griffel/transform@workspace:*, @griffel/transform@workspace:packages/transform": +"@griffel/transform@npm:^3.0.4, @griffel/transform@workspace:packages/transform": version: 0.0.0-use.local resolution: "@griffel/transform@workspace:packages/transform" dependencies: - "@griffel/core": "workspace:*" - "@griffel/transform-shaker": "workspace:*" + "@griffel/core": "npm:^1.21.0" + "@griffel/transform-shaker": "npm:^1.0.5" debug: "npm:^4.3.0" magic-string: "npm:^0.30.19" oxc-parser: "npm:^0.129.0" @@ -3918,7 +3918,7 @@ __metadata: "@babel/core": "npm:^7.29.0" "@babel/helper-module-imports": "npm:^7.22.15" "@babel/helper-plugin-utils": "npm:^7.28.6" - "@griffel/core": "workspace:*" + "@griffel/core": "npm:^1.21.0" stylis: "npm:^4.4.0" tslib: "npm:^2.1.0" peerDependencies: @@ -3931,7 +3931,7 @@ __metadata: resolution: "@griffel/webpack-loader@workspace:packages/webpack-loader" dependencies: "@babel/core": "npm:^7.29.0" - "@griffel/babel-preset": "workspace:*" + "@griffel/babel-preset": "npm:^1.8.4" enhanced-resolve: "npm:^5.21.0" tslib: "npm:^2.1.0" peerDependencies: @@ -3943,8 +3943,8 @@ __metadata: version: 0.0.0-use.local resolution: "@griffel/webpack-plugin@workspace:packages/webpack-plugin" dependencies: - "@griffel/core": "workspace:*" - "@griffel/transform": "workspace:*" + "@griffel/core": "npm:^1.21.0" + "@griffel/transform": "npm:^3.0.4" oxc-resolver: "npm:^11.19.1" stylis: "npm:^4.4.0" peerDependencies: