diff --git a/.eslintignore b/.eslintignore index cb70be51c..5579a11ce 100644 --- a/.eslintignore +++ b/.eslintignore @@ -1,2 +1,3 @@ node_modules /packages/*/dist +out-tsc diff --git a/.eslintrc.json b/.eslintrc.json index fee435407..685a9b58b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -70,6 +70,7 @@ { "files": [ "**/__fixtures__/**/*", + "**/bundle-size/**", "**/*.stories.ts", "**/*.stories.tsx", "**/*.test.ts", diff --git a/.gitignore b/.gitignore index c90767db9..53d053f52 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 @@ -53,4 +53,4 @@ Thumbs.db .github/instructions/nx.instructions.md vite.config.*.timestamp* -vitest.config.*.timestamp* \ No newline at end of file +vitest.config.*.timestamp* diff --git a/.yarn/patches/beachball-npm-2.31.5-0e84ec4233.patch b/.yarn/patches/beachball-npm-2.31.5-0e84ec4233.patch deleted file mode 100644 index 63a3a2f0b..000000000 --- a/.yarn/patches/beachball-npm-2.31.5-0e84ec4233.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/lib/packageManager/packagePublish.js b/lib/packageManager/packagePublish.js -index 6a211b2b472c8d16f776f79a89d5914cabd390b7..f0006dd42e1f8aae581e61c6c5b6dfe495500ed1 100644 ---- a/lib/packageManager/packagePublish.js -+++ b/lib/packageManager/packagePublish.js -@@ -9,6 +9,10 @@ const npm_1 = require("./npm"); - function packagePublish(packageInfo, registry, token, access, authType, timeout) { - const packageOptions = packageInfo.combinedOptions; - const packagePath = path_1.default.dirname(packageInfo.packageJsonPath); -+ -+ const packageDir = require('path').relative(packageInfo.combinedOptions.path, packagePath); -+ const artifactsPath = require('path').resolve(packageInfo.combinedOptions.path, 'dist', packageDir); -+ - const args = [ - 'publish', - '--registry', -@@ -23,8 +27,9 @@ function packagePublish(packageInfo, registry, token, access, authType, timeout) - args.push('--access'); - args.push(access); - } -+ console.log(`publish cwd: ${artifactsPath}`); - console.log(`publish command: ${args.join(' ')}`); -- return npm_1.npmAsync(args, { cwd: packagePath, timeout, all: true }); -+ return npm_1.npmAsync(args, { cwd: artifactsPath, timeout, all: true }); - } - exports.packagePublish = packagePublish; - //# sourceMappingURL=packagePublish.js.map diff --git a/apps/website/project.json b/apps/website/project.json index 900cb48da..bb08d0dcc 100644 --- a/apps/website/project.json +++ b/apps/website/project.json @@ -8,9 +8,9 @@ "executor": "nx:run-commands", "options": { "cwd": "apps/website", - "commands": [{ "command": "docusaurus build --out-dir ../../dist/apps/website" }] + "commands": [{ "command": "docusaurus build --out-dir ./dist" }] }, - "outputs": ["{workspaceRoot}/dist/apps/website"] + "outputs": ["{workspaceRoot}/apps/website/dist"] }, "serve": { "executor": "nx:run-commands", @@ -18,14 +18,6 @@ "cwd": "apps/website", "commands": [{ "command": "docusaurus start" }] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "apps/website", - "commands": [{ "command": "tsc -b --pretty" }], - "outputPath": [] - } } }, "tags": [] diff --git a/apps/website/tsconfig.json b/apps/website/tsconfig.json index 31be612bb..7a88f44fa 100644 --- a/apps/website/tsconfig.json +++ b/apps/website/tsconfig.json @@ -1,9 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "allowJs": true, "allowSyntheticDefaultImports": true, - "checkJs": true, "jsx": "react", "noEmit": true, "outDir": "../../dist/out-tsc", @@ -15,5 +13,10 @@ "webpack-env" ] }, - "include": ["./src/**/*.ts", "./src/**/*.tsx", "./src/**/*.js"] + "include": ["./src/**/*.ts", "./src/**/*.tsx"], + "references": [ + { + "path": "../../packages/core" + } + ] } diff --git a/change/@griffel-babel-preset-24c2dc69-ffd0-4d8a-b053-bf55a4027d43.json b/change/@griffel-babel-preset-24c2dc69-ffd0-4d8a-b053-bf55a4027d43.json new file mode 100644 index 000000000..901307c1c --- /dev/null +++ b/change/@griffel-babel-preset-24c2dc69-ffd0-4d8a-b053-bf55a4027d43.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/babel-preset", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-core-a5957bda-ea00-4364-b7be-fa9d9b2a6daa.json b/change/@griffel-core-a5957bda-ea00-4364-b7be-fa9d9b2a6daa.json new file mode 100644 index 000000000..a48ce846f --- /dev/null +++ b/change/@griffel-core-a5957bda-ea00-4364-b7be-fa9d9b2a6daa.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/core", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-devtools-3abc336c-b3fd-455c-8da6-34bf28c5abe6.json b/change/@griffel-devtools-3abc336c-b3fd-455c-8da6-34bf28c5abe6.json new file mode 100644 index 000000000..59da0ea7a --- /dev/null +++ b/change/@griffel-devtools-3abc336c-b3fd-455c-8da6-34bf28c5abe6.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/devtools", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-eslint-plugin-454db01d-6427-4196-b46d-585a84cb4f13.json b/change/@griffel-eslint-plugin-454db01d-6427-4196-b46d-585a84cb4f13.json new file mode 100644 index 000000000..bd1d3f549 --- /dev/null +++ b/change/@griffel-eslint-plugin-454db01d-6427-4196-b46d-585a84cb4f13.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/eslint-plugin", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-jest-serializer-a71b0f0d-9429-4482-bdaa-83506dd7bc0b.json b/change/@griffel-jest-serializer-a71b0f0d-9429-4482-bdaa-83506dd7bc0b.json new file mode 100644 index 000000000..4e7c03d3b --- /dev/null +++ b/change/@griffel-jest-serializer-a71b0f0d-9429-4482-bdaa-83506dd7bc0b.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/jest-serializer", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-next-extraction-plugin-a3cfb937-d268-4077-be23-6c4936c5d610.json b/change/@griffel-next-extraction-plugin-a3cfb937-d268-4077-be23-6c4936c5d610.json new file mode 100644 index 000000000..8d72449c1 --- /dev/null +++ b/change/@griffel-next-extraction-plugin-a3cfb937-d268-4077-be23-6c4936c5d610.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/next-extraction-plugin", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-postcss-syntax-dbb05ada-100a-4c47-adf1-9b68602e21c1.json b/change/@griffel-postcss-syntax-dbb05ada-100a-4c47-adf1-9b68602e21c1.json new file mode 100644 index 000000000..065518d69 --- /dev/null +++ b/change/@griffel-postcss-syntax-dbb05ada-100a-4c47-adf1-9b68602e21c1.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/postcss-syntax", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-react-c8774aa3-bb26-4f59-83c1-fcc567ba8d81.json b/change/@griffel-react-c8774aa3-bb26-4f59-83c1-fcc567ba8d81.json new file mode 100644 index 000000000..d00960cc1 --- /dev/null +++ b/change/@griffel-react-c8774aa3-bb26-4f59-83c1-fcc567ba8d81.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/react", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-shadow-dom-2865224c-dc90-4f52-8656-24cae3736a96.json b/change/@griffel-shadow-dom-2865224c-dc90-4f52-8656-24cae3736a96.json new file mode 100644 index 000000000..2a65a38b2 --- /dev/null +++ b/change/@griffel-shadow-dom-2865224c-dc90-4f52-8656-24cae3736a96.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/shadow-dom", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-style-types-781bbea4-3958-4cd8-beed-1b574c20cd54.json b/change/@griffel-style-types-781bbea4-3958-4cd8-beed-1b574c20cd54.json new file mode 100644 index 000000000..964f91938 --- /dev/null +++ b/change/@griffel-style-types-781bbea4-3958-4cd8-beed-1b574c20cd54.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/style-types", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-tag-processor-224568a5-7dc8-495d-b484-ef139b2ec76a.json b/change/@griffel-tag-processor-224568a5-7dc8-495d-b484-ef139b2ec76a.json new file mode 100644 index 000000000..5ca4faeb6 --- /dev/null +++ b/change/@griffel-tag-processor-224568a5-7dc8-495d-b484-ef139b2ec76a.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/tag-processor", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-transform-4b1bc89a-4029-4d61-bd2f-ada2ca8c7e1f.json b/change/@griffel-transform-4b1bc89a-4029-4d61-bd2f-ada2ca8c7e1f.json new file mode 100644 index 000000000..e74b63d07 --- /dev/null +++ b/change/@griffel-transform-4b1bc89a-4029-4d61-bd2f-ada2ca8c7e1f.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/transform", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-vite-plugin-d8c06477-2fcf-4d41-bc02-f699ad7bfb10.json b/change/@griffel-vite-plugin-d8c06477-2fcf-4d41-bc02-f699ad7bfb10.json new file mode 100644 index 000000000..737a7b0f3 --- /dev/null +++ b/change/@griffel-vite-plugin-d8c06477-2fcf-4d41-bc02-f699ad7bfb10.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/vite-plugin", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-webpack-extraction-plugin-4427d7f4-cae2-4945-a7e4-a17b14c23aa0.json b/change/@griffel-webpack-extraction-plugin-4427d7f4-cae2-4945-a7e4-a17b14c23aa0.json new file mode 100644 index 000000000..c89ab9d1a --- /dev/null +++ b/change/@griffel-webpack-extraction-plugin-4427d7f4-cae2-4945-a7e4-a17b14c23aa0.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/webpack-extraction-plugin", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-webpack-loader-d12758ef-2b97-4b3c-a414-0cce46ca1ed4.json b/change/@griffel-webpack-loader-d12758ef-2b97-4b3c-a414-0cce46ca1ed4.json new file mode 100644 index 000000000..335c48eb6 --- /dev/null +++ b/change/@griffel-webpack-loader-d12758ef-2b97-4b3c-a414-0cce46ca1ed4.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/webpack-loader", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/change/@griffel-webpack-plugin-57ffbb25-6211-4e1f-97a6-9577b99f66cd.json b/change/@griffel-webpack-plugin-57ffbb25-6211-4e1f-97a6-9577b99f66cd.json new file mode 100644 index 000000000..fffd14968 --- /dev/null +++ b/change/@griffel-webpack-plugin-57ffbb25-6211-4e1f-97a6-9577b99f66cd.json @@ -0,0 +1,7 @@ +{ + "type": "none", + "comment": "chore: migrate from TS path aliases to workspaces + project references", + "packageName": "@griffel/webpack-plugin", + "email": "olfedias@microsoft.com", + "dependentChangeType": "none" +} diff --git a/e2e/nextjs/package.json b/e2e/nextjs/package.json new file mode 100644 index 000000000..20da1b451 --- /dev/null +++ b/e2e/nextjs/package.json @@ -0,0 +1,10 @@ +{ + "name": "@griffel/e2e-nextjs", + "private": true, + "devDependencies": { + "@griffel/e2e-utils": "workspace:*", + "@griffel/next-extraction-plugin": "^0.1.14", + "@griffel/react": "^1.6.0", + "@griffel/webpack-loader": "^2.2.22" + } +} diff --git a/e2e/nextjs/project.json b/e2e/nextjs/project.json index 55a9bbba8..cf441ed40 100644 --- a/e2e/nextjs/project.json +++ b/e2e/nextjs/project.json @@ -13,14 +13,6 @@ "commands": [{ "command": "ts-node src/test.ts" }] }, "outputs": [] - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "e2e/nextjs", - "commands": [{ "command": "tsc -b --pretty" }], - "outputPath": [] - } } }, "tags": [] diff --git a/e2e/nextjs/tsconfig.json b/e2e/nextjs/tsconfig.json index e3a26387b..040a5f553 100644 --- a/e2e/nextjs/tsconfig.json +++ b/e2e/nextjs/tsconfig.json @@ -1,12 +1,8 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "allowJs": true, "allowSyntheticDefaultImports": true, - "checkJs": true, - "module": "CommonJS", - "jsx": "react", - "noEmit": true + "jsx": "react" }, "files": [], "include": [], @@ -16,7 +12,10 @@ } ], "ts-node": { - "require": ["tsconfig-paths/register"], - "swc": true + "swc": true, + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node" + } } } diff --git a/e2e/nextjs/tsconfig.lib.json b/e2e/nextjs/tsconfig.lib.json index cadf7b99d..d54f436a9 100644 --- a/e2e/nextjs/tsconfig.lib.json +++ b/e2e/nextjs/tsconfig.lib.json @@ -1,8 +1,24 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "include": ["**/*.ts", "**/*.tsx", "**/*.js"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"], + "references": [ + { + "path": "../../packages/webpack-loader/tsconfig.lib.json" + }, + { + "path": "../../packages/react/tsconfig.lib.json" + }, + { + "path": "../../packages/next-extraction-plugin/tsconfig.lib.json" + }, + { + "path": "../utils/tsconfig.lib.json" + } + ] } diff --git a/e2e/rspack/package.json b/e2e/rspack/package.json new file mode 100644 index 000000000..2bf35be44 --- /dev/null +++ b/e2e/rspack/package.json @@ -0,0 +1,10 @@ +{ + "name": "@griffel/e2e-rspack", + "private": true, + "devDependencies": { + "@griffel/e2e-utils": "workspace:*", + "@griffel/react": "^1.6.0", + "@griffel/webpack-extraction-plugin": "^0.5.13", + "@griffel/webpack-loader": "^2.2.22" + } +} diff --git a/e2e/rspack/project.json b/e2e/rspack/project.json index cfba5f534..0bb85ec66 100644 --- a/e2e/rspack/project.json +++ b/e2e/rspack/project.json @@ -13,14 +13,6 @@ "commands": [{ "command": "ts-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 df0f6e586..2d173e7f0 100644 --- a/e2e/rspack/tsconfig.json +++ b/e2e/rspack/tsconfig.json @@ -1,11 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "allowJs": true, - "checkJs": true, - "module": "CommonJS", - "jsx": "react", - "noEmit": true + "jsx": "react" }, "files": [], "include": [], @@ -15,7 +11,10 @@ } ], "ts-node": { - "require": ["tsconfig-paths/register"], - "swc": true + "swc": true, + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node" + } } } diff --git a/e2e/rspack/tsconfig.lib.json b/e2e/rspack/tsconfig.lib.json index cadf7b99d..0dcec8763 100644 --- a/e2e/rspack/tsconfig.lib.json +++ b/e2e/rspack/tsconfig.lib.json @@ -1,8 +1,24 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "include": ["**/*.ts", "**/*.tsx", "**/*.js"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"], + "references": [ + { + "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 new file mode 100644 index 000000000..b2b90b851 --- /dev/null +++ b/e2e/typescript/package.json @@ -0,0 +1,8 @@ +{ + "name": "@griffel/e2e-typescript", + "private": true, + "devDependencies": { + "@griffel/e2e-utils": "workspace:*", + "@griffel/style-types": "^1.3.0" + } +} diff --git a/e2e/typescript/project.json b/e2e/typescript/project.json index 7fcdc8f69..71cf64651 100644 --- a/e2e/typescript/project.json +++ b/e2e/typescript/project.json @@ -12,14 +12,6 @@ "commands": [{ "command": "ts-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 9302d2d7c..9656eb406 100644 --- a/e2e/typescript/tsconfig.json +++ b/e2e/typescript/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "module": "CommonJS", - "noEmit": true - }, "files": [], "include": [], "references": [ @@ -14,7 +8,10 @@ } ], "ts-node": { - "require": ["tsconfig-paths/register"], - "swc": true + "swc": true, + "compilerOptions": { + "module": "commonjs", + "moduleResolution": "node" + } } } diff --git a/e2e/typescript/tsconfig.lib.json b/e2e/typescript/tsconfig.lib.json index 0893e0a68..3193c6a31 100644 --- a/e2e/typescript/tsconfig.lib.json +++ b/e2e/typescript/tsconfig.lib.json @@ -1,8 +1,18 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "include": ["**/*.ts", "**/*.js"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/", "src/assets/legacy/*"], + "include": ["src/**/*.ts"], + "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 new file mode 100644 index 000000000..2520a9b35 --- /dev/null +++ b/e2e/utils/package.json @@ -0,0 +1,13 @@ +{ + "name": "@griffel/e2e-utils", + "types": "./src/index.ts", + "private": true, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./src/index.ts", + "default": "./src/index.ts" + } + } +} 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/src/packLocalPackage.ts b/e2e/utils/src/packLocalPackage.ts index f57fcea44..eb8f92775 100644 --- a/e2e/utils/src/packLocalPackage.ts +++ b/e2e/utils/src/packLocalPackage.ts @@ -1,15 +1,13 @@ import * as path from 'path'; -import * as fs from 'fs'; import * as logSymbols from 'log-symbols'; import { sh } from './sh'; 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]); - if (!packagePathExists) { - throw new Error(`A directory with artifacts (${packagePath}) does not exist`); + if (!packagePath) { + throw new Error(`A package directory (${packageName}) does not exist`); } // Use `npm pack` because `yarn pack` incorrectly calculates the included files when the diff --git a/e2e/utils/tsconfig.json b/e2e/utils/tsconfig.json index 7e5c7fe4b..c23e61c80 100644 --- a/e2e/utils/tsconfig.json +++ b/e2e/utils/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true, - "module": "CommonJS", - "noEmit": true - }, "files": [], "include": [], "references": [ diff --git a/e2e/utils/tsconfig.lib.json b/e2e/utils/tsconfig.lib.json index 2954c1047..efd17e538 100644 --- a/e2e/utils/tsconfig.lib.json +++ b/e2e/utils/tsconfig.lib.json @@ -1,8 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"] } diff --git a/monosize.config.mjs b/monosize.config.mjs index a1e0b98aa..6c247de36 100644 --- a/monosize.config.mjs +++ b/monosize.config.mjs @@ -1,22 +1,9 @@ -import path from 'node:path'; import upstashStorage from 'monosize-storage-upstash'; import webpackBundler from 'monosize-bundler-webpack'; -const dirname = new URL('.', import.meta.url).pathname; - export default { repository: 'https://github.com/microsoft/griffel', - bundler: webpackBundler(config => ({ - ...config, - resolve: { - ...config.resolve, - alias: { - '@griffel/core': path.resolve(dirname, './dist/packages/core/index.esm.js'), - '@griffel/shadow-dom': path.resolve(dirname, './dist/packages/shadow-dom/index.esm.js'), - '@griffel/react': path.resolve(dirname, './dist/packages/react/index.esm.js'), - }, - }, - })), + bundler: webpackBundler(), storage: upstashStorage({ url: 'https://welcome-giraffe-61766.upstash.io', readonlyToken: diff --git a/nx.json b/nx.json index 9493bf5ab..e0b35096a 100644 --- a/nx.json +++ b/nx.json @@ -1,6 +1,6 @@ { "$schema": "./node_modules/nx/schemas/nx-schema.json", - "extends": "nx/presets/core.json", + "extends": "@nx/workspace/presets/core.json", "targetDefaults": { "build": { "dependsOn": ["^build"], @@ -42,12 +42,32 @@ "inputs": ["default", "^default"] } }, + "plugins": [ + { + "plugin": "@nx/js/typescript", + "options": { + "typecheck": { + "targetName": "type-check" + }, + "build": { + "targetName": "build", + "configName": "tsconfig.lib.json" + } + } + }, + { + "plugin": "@nx/rollup/plugin", + "options": { + "buildTargetName": "build" + } + } + ], "pluginsConfig": { "@nx/js": { "analyzeSourceFiles": true } }, - "useInferencePlugins": false, + "useInferencePlugins": true, "defaultBase": "main", "tui": { "enabled": false diff --git a/package.json b/package.json index e751bb0ba..3d43fd0d0 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,12 @@ "engines": { "node": ">=20" }, + "workspaces": [ + "packages/*", + "apps/*", + "e2e/*", + "tools/*" + ], "nano-staged": { "**/*.{js,json,ts,tsx}": "prettier --write", "**/*.{md}": "doctoc -u" @@ -125,6 +131,7 @@ "react-dom": "18.3.1", "react-refresh": "^0.10.0", "react-shadow": "^20.2.0", + "rollup": "^4.14.0", "rollup-plugin-preserve-directives": "^0.4.0", "simple-git-hooks": "2.7.0", "snapshot-diff": "0.10.0", @@ -171,7 +178,6 @@ "tslib": "^2.1.0" }, "resolutions": { - "beachball@2.31.5": "patch:beachball@npm:2.31.5#.yarn/patches/beachball-npm-2.31.5-0e84ec4233.patch", "source-map-js@1.0.2": "patch:source-map-js@npm:1.0.2#.yarn/patches/source-map-js-npm-1.0.2-ee4f9f9b30.patch" } } diff --git a/packages/babel-preset/package.json b/packages/babel-preset/package.json index 687a71553..d6ac5a5de 100644 --- a/packages/babel-preset/package.json +++ b/packages/babel-preset/package.json @@ -1,12 +1,27 @@ { "name": "@griffel/babel-preset", "version": "1.8.1", + "types": "./dist/index.d.ts", "description": "Babel preset with build time transforms for Griffel", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "devDependencies": { + "@griffel/react": "^1.6.0" + }, "dependencies": { "@babel/core": "^7.23.2", "@babel/generator": "^7.23.0", diff --git a/packages/babel-preset/project.json b/packages/babel-preset/project.json index b2fe8430c..cd33da700 100644 --- a/packages/babel-preset/project.json +++ b/packages/babel-preset/project.json @@ -15,37 +15,6 @@ "options": { "jestConfig": "packages/babel-preset/jest.config.ts" } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/babel-preset", - "tsConfig": "packages/babel-preset/tsconfig.lib.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": "." - } - ] - } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/babel-preset", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/babel-preset/tsconfig.json b/packages/babel-preset/tsconfig.json index 2bd6d6f0a..62ebbd946 100644 --- a/packages/babel-preset/tsconfig.json +++ b/packages/babel-preset/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true - }, "files": [], "include": [], "references": [ diff --git a/packages/babel-preset/tsconfig.lib.json b/packages/babel-preset/tsconfig.lib.json index 9121cf848..6b6fee454 100644 --- a/packages/babel-preset/tsconfig.lib.json +++ b/packages/babel-preset/tsconfig.lib.json @@ -1,11 +1,13 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "node16", + "moduleResolution": "node16", "types": ["node", "environment"] }, - "exclude": ["__fixtures__/**/*", "**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.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 0321a8aa6..41f194b14 100644 --- a/packages/babel-preset/tsconfig.spec.json +++ b/packages/babel-preset/tsconfig.spec.json @@ -1,23 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "jsx": "react", - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment", "static-assets"] }, - "include": [ - "__fixtures__/**/code.ts", - "__fixtures__/**/fixture.ts", - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/core/package.json b/packages/core/package.json index beb2e3fb8..5962d6241 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -1,13 +1,27 @@ { "name": "@griffel/core", "version": "1.20.1", + "types": "./dist/index.d.ts", "description": "DOM implementation of Atomic CSS-in-JS", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, "sideEffects": false, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "import": "./dist/index.esm.js", + "require": "./dist/index.cjs.js", + "default": "./dist/index.esm.js" + } + }, "dependencies": { "@emotion/hash": "^0.9.0", "@griffel/style-types": "^1.4.0", diff --git a/packages/core/project.json b/packages/core/project.json index 7a4c0cdb7..39064a0c2 100644 --- a/packages/core/project.json +++ b/packages/core/project.json @@ -5,36 +5,6 @@ "projectType": "library", "tags": [], "targets": { - "build": { - "executor": "@nx/rollup:rollup", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/core", - "tsConfig": "packages/core/tsconfig.lib.json", - "skipTypeField": true, - "skipTypeCheck": true, - "project": "packages/core/package.json", - "entryFile": "packages/core/src/index.ts", - "useLegacyTypescriptPlugin": true, - "rollupConfig": "tools/getRollupOptions.js", - "compiler": "babel", - "sourceMap": true, - "external": ["tslib"], - "format": ["esm", "cjs"], - "assets": [ - { - "glob": "packages/core/README.md", - "input": ".", - "output": "." - }, - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] - } - }, "lint": { "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] @@ -61,18 +31,6 @@ } ] } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/core", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/core/rollup.config.cjs b/packages/core/rollup.config.cjs new file mode 100644 index 000000000..f1a37302f --- /dev/null +++ b/packages/core/rollup.config.cjs @@ -0,0 +1,14 @@ +const { withNx } = require('@nx/rollup/with-nx'); +const getRollupOptions = require('../../tools/getRollupOptions'); + +module.exports = getRollupOptions( + withNx({ + main: './src/index.ts', + outputPath: './dist', + tsConfig: './tsconfig.lib.json', + compiler: 'babel', + format: ['esm', 'cjs'], + external: ['tslib'], + sourceMap: true, + }), +); 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 d22b5ad70..b8564218b 100644 --- a/packages/core/tsconfig.lib.json +++ b/packages/core/tsconfig.lib.json @@ -1,19 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "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"] + "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts", "src/**/*.tsx"], + "references": [{ "path": "../style-types/tsconfig.lib.json" }] } diff --git a/packages/core/tsconfig.spec.json b/packages/core/tsconfig.spec.json index bc9c667a0..9ee963363 100644 --- a/packages/core/tsconfig.spec.json +++ b/packages/core/tsconfig.spec.json @@ -1,20 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.spec.tsx", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/devtools/package.json b/packages/devtools/package.json index 22368b81e..1b198a859 100644 --- a/packages/devtools/package.json +++ b/packages/devtools/package.json @@ -8,6 +8,7 @@ "url": "https://github.com/microsoft/griffel" }, "devDependencies": { - "@griffel/react": "^1.6.1" + "@griffel/core": "^1.20.0", + "@griffel/react": "^1.6.0" } } diff --git a/packages/devtools/project.json b/packages/devtools/project.json index 8bcec6838..28e88b661 100644 --- a/packages/devtools/project.json +++ b/packages/devtools/project.json @@ -11,29 +11,13 @@ "defaultConfiguration": "production", "options": { "compiler": "babel", - "outputPath": "dist/packages/devtools", + "outputPath": "packages/devtools/dist", "index": "packages/devtools/src/index.html", "main": "packages/devtools/src/index.tsx", "tsConfig": "packages/devtools/tsconfig.lib.json", + "typeCheckOptions": false, "skipTypeField": true, "packageJson": "packages/devtools/package.json", - "assets": [ - { - "glob": "packages/devtools/public", - "input": ".", - "output": "." - }, - { - "glob": "packages/devtools/package.json", - "input": ".", - "output": "." - }, - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ], "webpackConfig": "packages/devtools/webpack.config.js" }, "configurations": { @@ -77,18 +61,6 @@ "jestConfig": "packages/devtools/jest.config.ts" } }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/devtools", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] - }, "watch": { "executor": "nx:run-commands", "options": { @@ -112,19 +84,6 @@ "quiet": true } } - }, - "build-storybook": { - "executor": "@nx/storybook:build", - "outputs": ["{options.outputDir}"], - "options": { - "configDir": "packages/devtools/.storybook", - "outputDir": "dist/storybook/@griffel/devtools" - }, - "configurations": { - "ci": { - "quiet": true - } - } } } } diff --git a/packages/devtools/src/utils.ts b/packages/devtools/src/utils.ts index 3fd1c98c5..896a2b1e2 100644 --- a/packages/devtools/src/utils.ts +++ b/packages/devtools/src/utils.ts @@ -10,7 +10,7 @@ export function getRulesBySlots(node: DebugResult, result: SlotInfo[] = []): Slo { slot, sourceURL, - rules: debugClassNames.reduce((acc, { className, overriddenBy }) => { + rules: debugClassNames.reduce((acc, { className, overriddenBy }) => { if (className) { acc.push({ cssRule: rules![className], @@ -19,12 +19,12 @@ export function getRulesBySlots(node: DebugResult, result: SlotInfo[] = []): Slo } return acc; - }, [] as AtomicRules[]), + }, []), }, ]; } - return node.children.reduce((acc, child) => { + return node.children.reduce((acc, child) => { return [...acc, ...getRulesBySlots(child)]; }, result); } diff --git a/packages/devtools/tsconfig.json b/packages/devtools/tsconfig.json index a51cd328c..ed3e4588d 100644 --- a/packages/devtools/tsconfig.json +++ b/packages/devtools/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - }, "files": [], "include": [], "references": [ diff --git a/packages/devtools/tsconfig.lib.json b/packages/devtools/tsconfig.lib.json index 7953499a7..e78d3ebf6 100644 --- a/packages/devtools/tsconfig.lib.json +++ b/packages/devtools/tsconfig.lib.json @@ -1,23 +1,19 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./dist", + "rootDir": "./src", + "jsx": "react", "types": ["chrome", "node", "environment"] }, - "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", - "jest.config.ts" - ], - "include": ["**/*.ts", "**/*.tsx"] + "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts", "src/**/*.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 705860176..f035827cf 100644 --- a/packages/devtools/tsconfig.spec.json +++ b/packages/devtools/tsconfig.spec.json @@ -1,20 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["chrome", "jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.spec.tsx", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/devtools/tsconfig.storybook.json b/packages/devtools/tsconfig.storybook.json index 8b4e6ede2..fc96f59c8 100644 --- a/packages/devtools/tsconfig.storybook.json +++ b/packages/devtools/tsconfig.storybook.json @@ -1,10 +1,9 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "emitDecoratorMetadata": true, + "outDir": "./out-tsc/storybook", "moduleResolution": "bundler", - "noEmit": true, - "outDir": "" + "jsx": "react" }, "files": [ "../../node_modules/@nx/react/typings/styled-jsx.d.ts", diff --git a/packages/devtools/webpack.config.js b/packages/devtools/webpack.config.js index 502b2bbbf..71f9fb728 100644 --- a/packages/devtools/webpack.config.js +++ b/packages/devtools/webpack.config.js @@ -4,5 +4,8 @@ const { composePlugins, withNx, withWeb } = require('@nx/webpack'); module.exports = composePlugins(withNx(), withWeb(), config => { // Note: This was added by an Nx migration. Webpack builds are required to have a corresponding Webpack config file. // See: https://nx.dev/recipes/webpack/webpack-config-setup + + config.resolve.conditionNames = ['@griffel/source', '...']; + return config; }); diff --git a/packages/eslint-plugin/package.json b/packages/eslint-plugin/package.json index 89f7006b1..642901ba5 100644 --- a/packages/eslint-plugin/package.json +++ b/packages/eslint-plugin/package.json @@ -1,12 +1,27 @@ { "name": "@griffel/eslint-plugin", "version": "2.0.2", + "types": "./dist/index.d.ts", "description": "ESLint plugin with lint rules for Griffel", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "devDependencies": { + "@griffel/react": "^1.6.0" + }, "dependencies": { "@typescript-eslint/utils": "^7.18.0", "csstype": "^3.1.3", diff --git a/packages/eslint-plugin/project.json b/packages/eslint-plugin/project.json index 9749ea0b0..2a07660d2 100644 --- a/packages/eslint-plugin/project.json +++ b/packages/eslint-plugin/project.json @@ -15,37 +15,6 @@ "options": { "jestConfig": "packages/eslint-plugin/jest.config.ts" } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "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": "." - } - ] - } - }, - "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 2a77e803f..62ebbd946 100644 --- a/packages/eslint-plugin/tsconfig.json +++ b/packages/eslint-plugin/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "moduleResolution": "node16" - }, "files": [], "include": [], "references": [ diff --git a/packages/eslint-plugin/tsconfig.lib.json b/packages/eslint-plugin/tsconfig.lib.json index fb9bbcee7..5df444fb6 100644 --- a/packages/eslint-plugin/tsconfig.lib.json +++ b/packages/eslint-plugin/tsconfig.lib.json @@ -1,11 +1,17 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", "module": "node16", + "moduleResolution": "node16", "types": ["node", "environment"] }, - "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"], + "references": [ + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/eslint-plugin/tsconfig.spec.json b/packages/eslint-plugin/tsconfig.spec.json index bc9c667a0..685cd7a2c 100644 --- a/packages/eslint-plugin/tsconfig.spec.json +++ b/packages/eslint-plugin/tsconfig.spec.json @@ -1,20 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/jest-serializer/package.json b/packages/jest-serializer/package.json index eb7edb6f6..991e5a842 100644 --- a/packages/jest-serializer/package.json +++ b/packages/jest-serializer/package.json @@ -1,12 +1,27 @@ { "name": "@griffel/jest-serializer", "version": "1.1.36", + "types": "./dist/index.d.ts", "description": "Jest serializer for Griffel", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "devDependencies": { + "@griffel/react": "^1.6.0" + }, "dependencies": { "@griffel/core": "^1.20.1", "tslib": "^2.1.0" diff --git a/packages/jest-serializer/project.json b/packages/jest-serializer/project.json index 702a20123..7a1b0974f 100644 --- a/packages/jest-serializer/project.json +++ b/packages/jest-serializer/project.json @@ -15,37 +15,6 @@ "options": { "jestConfig": "packages/jest-serializer/jest.config.ts" } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/jest-serializer", - "tsConfig": "packages/jest-serializer/tsconfig.lib.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": "." - } - ] - } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/jest-serializer", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/jest-serializer/tsconfig.json b/packages/jest-serializer/tsconfig.json index 2bd6d6f0a..62ebbd946 100644 --- a/packages/jest-serializer/tsconfig.json +++ b/packages/jest-serializer/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true - }, "files": [], "include": [], "references": [ diff --git a/packages/jest-serializer/tsconfig.lib.json b/packages/jest-serializer/tsconfig.lib.json index 0c32ed38a..c097e5779 100644 --- a/packages/jest-serializer/tsconfig.lib.json +++ b/packages/jest-serializer/tsconfig.lib.json @@ -1,11 +1,20 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "node16", + "moduleResolution": "node16", "types": ["node", "environment"] }, - "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts", "jest.setup.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.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 3077bef75..c6af75ac9 100644 --- a/packages/jest-serializer/tsconfig.spec.json +++ b/packages/jest-serializer/tsconfig.spec.json @@ -1,22 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "jsx": "react", - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts", - "jest.setup.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/next-extraction-plugin/package.json b/packages/next-extraction-plugin/package.json index 1f4bdac03..a9bdec818 100644 --- a/packages/next-extraction-plugin/package.json +++ b/packages/next-extraction-plugin/package.json @@ -1,12 +1,24 @@ { "name": "@griffel/next-extraction-plugin", "version": "0.1.15", + "types": "./dist/index.d.ts", "description": "NextJS plugin that add Griffel's CSS extraction to webpack loaders pipeline", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, "dependencies": { "@griffel/webpack-extraction-plugin": "^0.5.14", "browserslist": "^4.19.1", diff --git a/packages/next-extraction-plugin/project.json b/packages/next-extraction-plugin/project.json index 5daf93f80..27f142421 100644 --- a/packages/next-extraction-plugin/project.json +++ b/packages/next-extraction-plugin/project.json @@ -15,30 +15,6 @@ "options": { "jestConfig": "packages/next-extraction-plugin/jest.config.ts" } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/next-extraction-plugin", - "tsConfig": "packages/next-extraction-plugin/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/next-extraction-plugin/package.json", - "main": "packages/next-extraction-plugin/src/index.ts", - "assets": ["packages/next-extraction-plugin/*.md"] - } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/next-extraction-plugin", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/next-extraction-plugin/tsconfig.json b/packages/next-extraction-plugin/tsconfig.json index b5371dfd3..62ebbd946 100644 --- a/packages/next-extraction-plugin/tsconfig.json +++ b/packages/next-extraction-plugin/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true, - "checkJs": true - }, "files": [], "include": [], "references": [ diff --git a/packages/next-extraction-plugin/tsconfig.lib.json b/packages/next-extraction-plugin/tsconfig.lib.json index 0a5aff6ef..2baaf3881 100644 --- a/packages/next-extraction-plugin/tsconfig.lib.json +++ b/packages/next-extraction-plugin/tsconfig.lib.json @@ -1,11 +1,13 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "node16", + "moduleResolution": "node16", "types": ["node", "environment"] }, - "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.spec.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"], + "references": [{ "path": "../webpack-extraction-plugin/tsconfig.lib.json" }] } diff --git a/packages/next-extraction-plugin/tsconfig.spec.json b/packages/next-extraction-plugin/tsconfig.spec.json index 1470336f4..41f194b14 100644 --- a/packages/next-extraction-plugin/tsconfig.spec.json +++ b/packages/next-extraction-plugin/tsconfig.spec.json @@ -1,22 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "jsx": "react", - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment", "static-assets"] }, - "include": [ - "__fixtures__/**/*/code.ts", - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/postcss-syntax/package.json b/packages/postcss-syntax/package.json index 28f5bcd66..a529bd9e4 100644 --- a/packages/postcss-syntax/package.json +++ b/packages/postcss-syntax/package.json @@ -1,17 +1,32 @@ { "name": "@griffel/postcss-syntax", "version": "1.3.6", + "types": "./dist/index.d.ts", "description": "postcss syntax for Griffel", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, + "devDependencies": { + "@griffel/react": "^1.6.0" + }, "dependencies": { "@babel/core": "^7.23.2", - "@griffel/babel-preset": "^1.8.1", "@babel/helper-plugin-utils": "^7.22.5", + "@griffel/babel-preset": "^1.8.1", "postcss": "^8.4.29" }, - "main": "./src/index.js" + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "main": "./dist/index.js" } diff --git a/packages/postcss-syntax/project.json b/packages/postcss-syntax/project.json index 5d9e39520..22f95eb99 100644 --- a/packages/postcss-syntax/project.json +++ b/packages/postcss-syntax/project.json @@ -15,37 +15,6 @@ "options": { "jestConfig": "packages/postcss-syntax/jest.config.ts" } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "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": "." - } - ] - } - }, - "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..bcd32469c 100644 --- a/packages/postcss-syntax/tsconfig.lib.json +++ b/packages/postcss-syntax/tsconfig.lib.json @@ -1,11 +1,20 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "node16", + "moduleResolution": "node16", "types": ["node", "environment"] }, - "exclude": ["**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"], + "references": [ + { + "path": "../babel-preset/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/postcss-syntax/tsconfig.spec.json b/packages/postcss-syntax/tsconfig.spec.json index bc9c667a0..685cd7a2c 100644 --- a/packages/postcss-syntax/tsconfig.spec.json +++ b/packages/postcss-syntax/tsconfig.spec.json @@ -1,20 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/react/package.json b/packages/react/package.json index f9de1ae3e..85aa766ad 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -1,13 +1,27 @@ { "name": "@griffel/react", "version": "1.6.1", + "types": "./dist/index.d.ts", "description": "React implementation of Atomic CSS-in-JS", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, "sideEffects": false, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "import": "./dist/index.esm.js", + "require": "./dist/index.cjs.js", + "default": "./dist/index.esm.js" + } + }, "wyw-in-js": { "tags": { "makeStyles": "@griffel/tag-processor/make-styles", diff --git a/packages/react/project.json b/packages/react/project.json index eb3267aaf..0251f2eb3 100644 --- a/packages/react/project.json +++ b/packages/react/project.json @@ -5,36 +5,6 @@ "projectType": "library", "tags": [], "targets": { - "build": { - "executor": "@nx/rollup:rollup", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/react", - "tsConfig": "packages/react/tsconfig.lib.json", - "skipTypeField": true, - "skipTypeCheck": true, - "project": "packages/react/package.json", - "entryFile": "packages/react/src/index.ts", - "compiler": "babel", - "sourceMap": true, - "useLegacyTypescriptPlugin": true, - "rollupConfig": ["@nx/react/plugins/bundle-rollup", "tools/getRollupOptions.js"], - "external": ["tslib"], - "format": ["esm", "cjs"], - "assets": [ - { - "glob": "packages/react/README.md", - "input": ".", - "output": "." - }, - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] - } - }, "lint": { "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] @@ -73,31 +43,6 @@ "quiet": true } } - }, - "build-storybook": { - "executor": "@nx/storybook:build", - "outputs": ["{options.outputDir}"], - "options": { - "configDir": "packages/react/.storybook", - "outputDir": "dist/storybook/@griffel/react" - }, - "configurations": { - "ci": { - "quiet": true - } - } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/react", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/react/rollup.config.cjs b/packages/react/rollup.config.cjs new file mode 100644 index 000000000..f1a37302f --- /dev/null +++ b/packages/react/rollup.config.cjs @@ -0,0 +1,14 @@ +const { withNx } = require('@nx/rollup/with-nx'); +const getRollupOptions = require('../../tools/getRollupOptions'); + +module.exports = getRollupOptions( + withNx({ + main: './src/index.ts', + outputPath: './dist', + tsConfig: './tsconfig.lib.json', + compiler: 'babel', + format: ['esm', 'cjs'], + external: ['tslib'], + sourceMap: true, + }), +); diff --git a/packages/react/tsconfig.json b/packages/react/tsconfig.json index a51cd328c..ed3e4588d 100644 --- a/packages/react/tsconfig.json +++ b/packages/react/tsconfig.json @@ -1,11 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "jsx": "react", - "allowJs": true, - "esModuleInterop": true, - "allowSyntheticDefaultImports": true - }, "files": [], "include": [], "references": [ diff --git a/packages/react/tsconfig.lib.json b/packages/react/tsconfig.lib.json index acec26066..185aef441 100644 --- a/packages/react/tsconfig.lib.json +++ b/packages/react/tsconfig.lib.json @@ -1,23 +1,18 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./dist", + "rootDir": "./src", + "jsx": "react", "types": ["node", "environment"] }, "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", - "jest.config.ts" + "src/**/*.test.ts", + "src/**/*.test.tsx", + "src/**/*.stories.tsx", + "src/**/__fixture__/", + "src/**/__mocks__/" ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.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 bc9c667a0..bd9768e5f 100644 --- a/packages/react/tsconfig.spec.json +++ b/packages/react/tsconfig.spec.json @@ -1,20 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", + "jsx": "react", "types": ["jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.spec.tsx", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/react/tsconfig.storybook.json b/packages/react/tsconfig.storybook.json index f5d4c0b70..edcba2b51 100644 --- a/packages/react/tsconfig.storybook.json +++ b/packages/react/tsconfig.storybook.json @@ -1,10 +1,9 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "emitDecoratorMetadata": true, - "moduleResolution": "bundler", - "noEmit": true, - "outDir": "" + "outDir": "./out-tsc/storybook", + "jsx": "react", + "moduleResolution": "bundler" }, "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 890b1bfa6..2cb42dd38 100644 --- a/packages/shadow-dom/package.json +++ b/packages/shadow-dom/package.json @@ -1,13 +1,30 @@ { "name": "@griffel/shadow-dom", "version": "0.2.12", + "types": "./dist/index.d.ts", "description": "Shadow DOM implementation of Griffel Atomic CSS-in-JS", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, "sideEffects": false, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "import": "./dist/index.esm.js", + "require": "./dist/index.cjs.js", + "default": "./dist/index.esm.js" + } + }, + "devDependencies": { + "@griffel/react": "^1.6.0" + }, "dependencies": { "@griffel/core": "^1.20.1", "tslib": "^2.1.0" diff --git a/packages/shadow-dom/project.json b/packages/shadow-dom/project.json index 6795854a8..d1c1edaae 100644 --- a/packages/shadow-dom/project.json +++ b/packages/shadow-dom/project.json @@ -5,36 +5,6 @@ "projectType": "library", "tags": [], "targets": { - "build": { - "executor": "@nx/rollup:rollup", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/shadow-dom", - "tsConfig": "packages/shadow-dom/tsconfig.lib.json", - "skipTypeField": true, - "skipTypeCheck": true, - "project": "packages/shadow-dom/package.json", - "entryFile": "packages/shadow-dom/src/index.ts", - "compiler": "babel", - "sourceMap": true, - "useLegacyTypescriptPlugin": true, - "rollupConfig": ["@nx/react/plugins/bundle-rollup", "tools/getRollupOptions.js"], - "external": ["tslib"], - "format": ["esm", "cjs"], - "assets": [ - { - "glob": "packages/shadow-dom/README.md", - "input": ".", - "output": "." - }, - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] - } - }, "lint": { "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] @@ -73,31 +43,6 @@ "quiet": true } } - }, - "build-storybook": { - "executor": "@nx/storybook:build", - "outputs": ["{options.outputDir}"], - "options": { - "configDir": "packages/shadow-dom/.storybook", - "outputDir": "dist/storybook/@griffel/shadow-dom" - }, - "configurations": { - "ci": { - "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/rollup.config.cjs b/packages/shadow-dom/rollup.config.cjs new file mode 100644 index 000000000..f1a37302f --- /dev/null +++ b/packages/shadow-dom/rollup.config.cjs @@ -0,0 +1,14 @@ +const { withNx } = require('@nx/rollup/with-nx'); +const getRollupOptions = require('../../tools/getRollupOptions'); + +module.exports = getRollupOptions( + withNx({ + main: './src/index.ts', + outputPath: './dist', + tsConfig: './tsconfig.lib.json', + compiler: 'babel', + format: ['esm', 'cjs'], + external: ['tslib'], + sourceMap: true, + }), +); diff --git a/packages/shadow-dom/src/stories/createShadowDOMRenderer.stories.tsx b/packages/shadow-dom/src/stories/createShadowDOMRenderer.stories.tsx index f76afb9f2..11dab21c2 100644 --- a/packages/shadow-dom/src/stories/createShadowDOMRenderer.stories.tsx +++ b/packages/shadow-dom/src/stories/createShadowDOMRenderer.stories.tsx @@ -34,7 +34,7 @@ const ReactComponentsWrapper: React.FC<{ const root = createProxy({}, '@griffel/shadow-dom', ({ children, root }) => ( {children} -)); +)) as unknown as { div: React.FC<{ children: React.ReactNode }> }; const useStyles = makeStyles({ root: { diff --git a/packages/shadow-dom/tsconfig.json b/packages/shadow-dom/tsconfig.json index fb0d53b73..ed3e4588d 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": [ diff --git a/packages/shadow-dom/tsconfig.lib.json b/packages/shadow-dom/tsconfig.lib.json index acec26066..b94bf27dd 100644 --- a/packages/shadow-dom/tsconfig.lib.json +++ b/packages/shadow-dom/tsconfig.lib.json @@ -1,23 +1,24 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, "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", - "jest.config.ts" + "src/**/*.test.ts", + "src/**/*.test.tsx", + "src/**/*.stories.tsx", + "src/**/__fixture__/", + "src/**/__mocks__/" ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.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 bc9c667a0..9ee963363 100644 --- a/packages/shadow-dom/tsconfig.spec.json +++ b/packages/shadow-dom/tsconfig.spec.json @@ -1,20 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.spec.tsx", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/shadow-dom/tsconfig.storybook.json b/packages/shadow-dom/tsconfig.storybook.json index e97278b05..1aa3110fa 100644 --- a/packages/shadow-dom/tsconfig.storybook.json +++ b/packages/shadow-dom/tsconfig.storybook.json @@ -1,11 +1,9 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "jsx": "react", - "emitDecoratorMetadata": true, - "noPropertyAccessFromIndexSignature": false, - "noEmit": true, - "outDir": "" + "outDir": "./out-tsc/storybook", + "moduleResolution": "bundler", + "jsx": "react" }, "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 d3794a42b..f462bb629 100644 --- a/packages/style-types/package.json +++ b/packages/style-types/package.json @@ -2,6 +2,9 @@ "name": "@griffel/style-types", "version": "1.4.0", "description": "Provides types for Griffel style objects", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", @@ -11,5 +14,22 @@ "dependencies": { "csstype": "^3.1.3" }, - "types": "src/index.d.ts" + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "import": "./dist/index.esm.js", + "require": "./dist/index.cjs.js", + "default": "./dist/index.esm.js" + } + }, + "types": "./dist/index.d.ts", + "typesVersions": { + "<4.4": { + "dist/index.d.ts": [ + "dist/legacy/index.d.ts" + ] + } + } } diff --git a/packages/style-types/project.json b/packages/style-types/project.json index 1c576b6a1..afd059e9f 100644 --- a/packages/style-types/project.json +++ b/packages/style-types/project.json @@ -2,28 +2,8 @@ "name": "@griffel/style-types", "$schema": "../../node_modules/nx/schemas/project-schema.json", "sourceRoot": "packages/style-types/src", - "projectType": "library", "tags": [], "targets": { - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "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": "." - } - ] - } - }, "lint": { "executor": "@nx/eslint:lint", "outputs": ["{options.outputFile}"] @@ -34,18 +14,6 @@ "options": { "jestConfig": "packages/style-types/jest.config.ts" } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/style-types", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] } } } diff --git a/packages/style-types/rollup.config.cjs b/packages/style-types/rollup.config.cjs new file mode 100644 index 000000000..f1a37302f --- /dev/null +++ b/packages/style-types/rollup.config.cjs @@ -0,0 +1,14 @@ +const { withNx } = require('@nx/rollup/with-nx'); +const getRollupOptions = require('../../tools/getRollupOptions'); + +module.exports = getRollupOptions( + withNx({ + main: './src/index.ts', + outputPath: './dist', + tsConfig: './tsconfig.lib.json', + compiler: 'babel', + format: ['esm', 'cjs'], + external: ['tslib'], + sourceMap: true, + }), +); diff --git a/packages/style-types/tsconfig.lib.json b/packages/style-types/tsconfig.lib.json index fb8516565..afb5758f3 100644 --- a/packages/style-types/tsconfig.lib.json +++ b/packages/style-types/tsconfig.lib.json @@ -1,20 +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", - "**/*.spec.tsx", - "**/*.test.tsx", - "**/*.spec.js", - "**/*.test.js", - "**/*.spec.jsx", - "**/*.test.jsx", - "jest.config.ts" - ], - "include": ["**/*.js", "**/*.jsx", "**/*.ts", "**/*.tsx"] + "exclude": ["src/**/*.test.ts", "src/**/*.test.tsx", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts", "src/**/*.tsx"] } diff --git a/packages/style-types/tsconfig.spec.json b/packages/style-types/tsconfig.spec.json index bc9c667a0..9ee963363 100644 --- a/packages/style-types/tsconfig.spec.json +++ b/packages/style-types/tsconfig.spec.json @@ -1,20 +1,10 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.spec.tsx", "src/**/*.test.ts", "src/**/*.test.tsx", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/tag-processor/package.json b/packages/tag-processor/package.json index e054b41e1..25536b657 100644 --- a/packages/tag-processor/package.json +++ b/packages/tag-processor/package.json @@ -1,7 +1,11 @@ { "name": "@griffel/tag-processor", "version": "1.0.16", + "types": "./dist/index.d.ts", "description": "wyw-in-js processor for Griffel", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", @@ -15,16 +19,19 @@ }, "exports": { ".": { - "types": "./src/index.d.ts", - "default": "./src/index.js" + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" }, "./make-styles": { - "types": "./src/MakeStylesProcessor.d.ts", - "default": "./src/MakeStylesProcessor.js" + "@griffel/source": "./src/MakeStylesProcessor.ts", + "types": "./dist/MakeStylesProcessor.d.ts", + "default": "./dist/MakeStylesProcessor.js" }, "./make-reset-styles": { - "types": "./src/MakeResetStylesProcessor.d.ts", - "default": "./src/MakeResetStylesProcessor.js" + "@griffel/source": "./src/MakeResetStylesProcessor.ts", + "types": "./dist/MakeResetStylesProcessor.d.ts", + "default": "./dist/MakeResetStylesProcessor.js" } } } diff --git a/packages/tag-processor/project.json b/packages/tag-processor/project.json index 7785d617d..13dae656c 100644 --- a/packages/tag-processor/project.json +++ b/packages/tag-processor/project.json @@ -15,37 +15,6 @@ "options": { "jestConfig": "packages/tag-processor/jest.config.js" } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/tag-processor", - "tsConfig": "packages/tag-processor/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/tag-processor/package.json", - "main": "packages/tag-processor/src/index.ts", - "assets": [ - "packages/tag-processor/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] - } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/tag-processor", - "commands": [ - { - "command": "tsc -b --pretty" - } - ], - "outputPath": [] - } } } } diff --git a/packages/tag-processor/tsconfig.json b/packages/tag-processor/tsconfig.json index 2bd6d6f0a..62ebbd946 100644 --- a/packages/tag-processor/tsconfig.json +++ b/packages/tag-processor/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true - }, "files": [], "include": [], "references": [ diff --git a/packages/tag-processor/tsconfig.lib.json b/packages/tag-processor/tsconfig.lib.json index 8d27d94f9..b51109b41 100644 --- a/packages/tag-processor/tsconfig.lib.json +++ b/packages/tag-processor/tsconfig.lib.json @@ -1,11 +1,13 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "node16", + "moduleResolution": "node16", "types": ["node", "environment"] }, - "exclude": ["**/*.spec.ts", "**/*.test.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"], + "references": [{ "path": "../core/tsconfig.lib.json" }] } diff --git a/packages/tag-processor/tsconfig.spec.json b/packages/tag-processor/tsconfig.spec.json index 167fe948f..ae0acc6a1 100644 --- a/packages/tag-processor/tsconfig.spec.json +++ b/packages/tag-processor/tsconfig.spec.json @@ -1,20 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { + "outDir": "./out-tsc/spec", + "rootDir": ".", "jsx": "react", - "outDir": "../../dist/out-tsc", - "module": "commonjs", "types": ["jest", "node", "environment"] }, - "include": [ - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/transform/package.json b/packages/transform/package.json index 053ec245b..44f996feb 100644 --- a/packages/transform/package.json +++ b/packages/transform/package.json @@ -1,7 +1,14 @@ { "name": "@griffel/transform", "version": "1.2.1", + "types": "./index.d.mts", "description": "A package that performs build time transforms for Griffel", + "files": [ + "*.js", + "*.d.mts", + "*.d.ts", + "dist/" + ], "license": "MIT", "repository": { "type": "git", @@ -10,11 +17,15 @@ "type": "module", "exports": { ".": { + "@griffel/source": "./src/index.mts", "node": "./transform.js", "types": "./index.d.mts" }, "./package.json": "./package.json" }, + "devDependencies": { + "@griffel/react": "^1.6.0" + }, "dependencies": { "@griffel/core": "^1.20.1", "@linaria/shaker": "^3.0.0-beta.22", diff --git a/packages/transform/project.json b/packages/transform/project.json index b945f9777..2b0cca081 100644 --- a/packages/transform/project.json +++ b/packages/transform/project.json @@ -20,22 +20,10 @@ "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/packages/transform", + "outputPath": "packages/transform/dist", "compiler": "swc", "format": ["esm"] } - }, - "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..d824d4bb0 100644 --- a/packages/transform/tsconfig.json +++ b/packages/transform/tsconfig.json @@ -1,7 +1,6 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "allowJs": true, "module": "NodeNext", "moduleResolution": "NodeNext", "target": "ES2022" diff --git a/packages/transform/tsconfig.lib.json b/packages/transform/tsconfig.lib.json index a99a4ea5c..ab8811366 100644 --- a/packages/transform/tsconfig.lib.json +++ b/packages/transform/tsconfig.lib.json @@ -1,28 +1,21 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "target": "ES2022", "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"] + "exclude": ["src/**/*.test.mts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.mts"], + "references": [ + { + "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 203183b7f..253de3041 100644 --- a/packages/transform/tsconfig.spec.json +++ b/packages/transform/tsconfig.spec.json @@ -1,24 +1,14 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", + "rootDir": ".", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "target": "ES2022", "typeRoots": ["../../node_modules", "../../node_modules/@types", "../../typings"], "types": ["vitest/globals", "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" - ] + "include": ["src/**/*.spec.mts", "src/**/*.test.mts", "src/**/*.d.mts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/transform/vite.config.ts b/packages/transform/vite.config.ts index b965b0f6c..7e70492a8 100644 --- a/packages/transform/vite.config.ts +++ b/packages/transform/vite.config.ts @@ -1,5 +1,4 @@ /// -import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; import { defineConfig } from 'vite'; import dts from 'vite-plugin-dts'; @@ -15,14 +14,19 @@ export default defineConfig(() => ({ root: __dirname, cacheDir: '../../node_modules/.vite/packages/transform', plugins: [ - nxViteTsPaths(), nxCopyAssetsPlugin(['*.md']), dts({ entryRoot: 'src', tsconfigPath: join(__dirname, 'tsconfig.lib.json'), pathsToAliases: false }), ], - // Uncomment this if you are using workers. - // worker: { - // plugins: [ nxViteTsPaths() ], - // }, + resolve: { + conditions: ['@griffel/source'], + }, + environments: { + ssr: { + resolve: { + conditions: ['@griffel/source'], + }, + }, + }, build: { emptyOutDir: true, lib: { diff --git a/packages/vite-plugin/package.json b/packages/vite-plugin/package.json index 69aea2605..915ed6cbd 100644 --- a/packages/vite-plugin/package.json +++ b/packages/vite-plugin/package.json @@ -1,13 +1,25 @@ { "name": "@griffel/vite-plugin", "version": "0.1.16", + "types": "./dist/index.d.ts", "description": "Vite plugin for Griffel", + "files": [ + "dist/" + ], "license": "MIT", "type": "module", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, "dependencies": { "@wyw-in-js/vite": "^0.8.0" }, diff --git a/packages/vite-plugin/project.json b/packages/vite-plugin/project.json index f955b01a5..c6c6caedc 100644 --- a/packages/vite-plugin/project.json +++ b/packages/vite-plugin/project.json @@ -16,33 +16,6 @@ "commands": [{ "command": "node --test **/*.test.mjs" }], "outputPath": [] } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/vite-plugin", - "tsConfig": "packages/vite-plugin/tsconfig.lib.json", - "skipTypeField": true, - "packageJson": "packages/vite-plugin/package.json", - "main": "packages/vite-plugin/src/index.ts", - "assets": [ - "packages/vite-plugin/README.md", - { - "glob": "LICENSE.md", - "input": ".", - "output": "." - } - ] - } - }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/vite-plugin", - "commands": [{ "command": "tsc -b --pretty" }], - "outputPath": [] - } } }, "tags": [] diff --git a/packages/vite-plugin/src/index.test.mjs b/packages/vite-plugin/src/index.test.mjs index ece886c6b..79262391d 100644 --- a/packages/vite-plugin/src/index.test.mjs +++ b/packages/vite-plugin/src/index.test.mjs @@ -1,4 +1,3 @@ -import moduleAlias from 'module-alias'; import assert from 'node:assert'; import fs from 'node:fs/promises'; import test from 'node:test'; @@ -15,18 +14,6 @@ const fixturesDir = path.resolve(currentDir, '..', '__fixtures__'); const prettierConfig = JSON.parse(await fs.readFile(path.resolve(rootDir, '.prettierrc'), { encoding: 'utf-8' })); -// TODO: Remove this once we have a better way to resolve aliases in ESM -moduleAlias.addAlias('@griffel/core', path.resolve(rootDir, 'dist', 'packages', 'core')); -moduleAlias.addAlias('@griffel/react', path.resolve(rootDir, 'dist', 'packages', 'react')); -moduleAlias.addAlias( - '@griffel/tag-processor/make-styles', - path.resolve(rootDir, 'dist', 'packages', 'tag-processor', 'src', 'MakeStylesProcessor.js'), -); -moduleAlias.addAlias( - '@griffel/tag-processor/make-reset-styles', - path.resolve(rootDir, 'dist', 'packages', 'tag-processor', 'src', 'MakeResetStylesProcessor.js'), -); - /** * @param {string} fixtureName * @param {object} [options] @@ -41,9 +28,6 @@ async function buildFixture(fixtureName, options = {}) { const result = await build({ resolve: { alias: { - '@griffel/core': path.resolve(rootDir, 'dist', 'packages', 'core'), - '@griffel/react': path.resolve(rootDir, 'dist', 'packages', 'react'), - ...options.aliases, }, }, diff --git a/packages/vite-plugin/tsconfig.json b/packages/vite-plugin/tsconfig.json index 2bd6d6f0a..62ebbd946 100644 --- a/packages/vite-plugin/tsconfig.json +++ b/packages/vite-plugin/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true - }, "files": [], "include": [], "references": [ diff --git a/packages/vite-plugin/tsconfig.lib.json b/packages/vite-plugin/tsconfig.lib.json index 249743072..1cb64f98b 100644 --- a/packages/vite-plugin/tsconfig.lib.json +++ b/packages/vite-plugin/tsconfig.lib.json @@ -1,11 +1,18 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "ES2022", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "exclude": ["__fixtures__/*/*.ts", "**/*.spec.ts", "**/*.test.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"], + "references": [ + { + "path": "../tag-processor/tsconfig.lib.json" + }, + { + "path": "../react/tsconfig.lib.json" + } + ] } diff --git a/packages/vite-plugin/tsconfig.spec.json b/packages/vite-plugin/tsconfig.spec.json index b751e080a..6176f302f 100644 --- a/packages/vite-plugin/tsconfig.spec.json +++ b/packages/vite-plugin/tsconfig.spec.json @@ -1,21 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "jsx": "react", - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["node", "environment"] }, - "include": [ - "__fixtures__/*/code.ts", - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/webpack-extraction-plugin/package.json b/packages/webpack-extraction-plugin/package.json index 41f4069a0..205ebb726 100644 --- a/packages/webpack-extraction-plugin/package.json +++ b/packages/webpack-extraction-plugin/package.json @@ -1,12 +1,28 @@ { "name": "@griffel/webpack-extraction-plugin", "version": "0.5.14", + "types": "./dist/index.d.ts", "description": "Webpack plugin that performs CSS extraction for Griffel", + "files": [ + "dist/", + "virtual-loader/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "devDependencies": { + "@griffel/react": "^1.6.0" + }, "dependencies": { "@babel/core": "^7.23.2", "@babel/helper-module-imports": "^7.22.15", diff --git a/packages/webpack-extraction-plugin/project.json b/packages/webpack-extraction-plugin/project.json index a2de6bf23..354932a28 100644 --- a/packages/webpack-extraction-plugin/project.json +++ b/packages/webpack-extraction-plugin/project.json @@ -15,42 +15,6 @@ "options": { "jestConfig": "packages/webpack-extraction-plugin/jest.config.ts" } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "options": { - "outputPath": "dist/packages/webpack-extraction-plugin", - "tsConfig": "packages/webpack-extraction-plugin/tsconfig.lib.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" - } - ] - } - }, - "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.json b/packages/webpack-extraction-plugin/tsconfig.json index b5371dfd3..62ebbd946 100644 --- a/packages/webpack-extraction-plugin/tsconfig.json +++ b/packages/webpack-extraction-plugin/tsconfig.json @@ -1,9 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": 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 6181fe223..59566b8de 100644 --- a/packages/webpack-extraction-plugin/tsconfig.lib.json +++ b/packages/webpack-extraction-plugin/tsconfig.lib.json @@ -1,11 +1,20 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "node16", + "moduleResolution": "node16", "types": ["node", "environment"] }, - "exclude": ["__fixtures__/**/*/*.ts", "**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts", "virtual-loader/index.js"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.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 1470336f4..c00b55a04 100644 --- a/packages/webpack-extraction-plugin/tsconfig.spec.json +++ b/packages/webpack-extraction-plugin/tsconfig.spec.json @@ -1,22 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { + "outDir": "./out-tsc/spec", + "rootDir": ".", "jsx": "react", - "outDir": "../../dist/out-tsc", - "module": "commonjs", "types": ["jest", "node", "environment", "static-assets"] }, - "include": [ - "__fixtures__/**/*/code.ts", - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/webpack-extraction-plugin/virtual-loader/index.js b/packages/webpack-extraction-plugin/virtual-loader/index.js index 3c0290a58..f2e6fa711 100644 --- a/packages/webpack-extraction-plugin/virtual-loader/index.js +++ b/packages/webpack-extraction-plugin/virtual-loader/index.js @@ -1,5 +1,5 @@ const { URLSearchParams } = require('url'); -const { GriffelCssLoaderContextKey } = require('../src/constants'); +const { GriffelCssLoaderContextKey } = require('../dist/constants'); /** * @this {import("../src/constants").SupplementedLoaderContext} diff --git a/packages/webpack-loader/package.json b/packages/webpack-loader/package.json index 5f00ceebb..e0ceefbdf 100644 --- a/packages/webpack-loader/package.json +++ b/packages/webpack-loader/package.json @@ -1,12 +1,27 @@ { "name": "@griffel/webpack-loader", "version": "2.2.23", + "types": "./dist/index.d.ts", "description": "Webpack loader that performs build time transforms for Griffel", + "files": [ + "dist/" + ], "license": "MIT", "repository": { "type": "git", "url": "https://github.com/microsoft/griffel" }, + "exports": { + "./package.json": "./package.json", + ".": { + "@griffel/source": "./src/index.ts", + "types": "./dist/index.d.ts", + "default": "./dist/index.js" + } + }, + "devDependencies": { + "@griffel/react": "^1.6.0" + }, "dependencies": { "@babel/core": "^7.23.2", "@griffel/babel-preset": "^1.8.1", diff --git a/packages/webpack-loader/project.json b/packages/webpack-loader/project.json index 975ee5aab..0c09b7fc0 100644 --- a/packages/webpack-loader/project.json +++ b/packages/webpack-loader/project.json @@ -15,37 +15,6 @@ "options": { "jestConfig": "packages/webpack-loader/jest.config.ts" } - }, - "build": { - "executor": "@nx/js:tsc", - "outputs": ["{options.outputPath}"], - "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": "." - } - ] - } - }, - "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 2bd6d6f0a..62ebbd946 100644 --- a/packages/webpack-loader/tsconfig.json +++ b/packages/webpack-loader/tsconfig.json @@ -1,8 +1,5 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { - "allowJs": true - }, "files": [], "include": [], "references": [ diff --git a/packages/webpack-loader/tsconfig.lib.json b/packages/webpack-loader/tsconfig.lib.json index 14ef888bf..9ed388647 100644 --- a/packages/webpack-loader/tsconfig.lib.json +++ b/packages/webpack-loader/tsconfig.lib.json @@ -1,11 +1,20 @@ { "extends": "./tsconfig.json", "compilerOptions": { - "module": "commonjs", - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "node16", + "moduleResolution": "node16", "types": ["node", "environment"] }, - "exclude": ["__fixtures__/*/*.ts", "**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.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 06948acab..c6af75ac9 100644 --- a/packages/webpack-loader/tsconfig.spec.json +++ b/packages/webpack-loader/tsconfig.spec.json @@ -1,22 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "jsx": "react", - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment"] }, - "include": [ - "__fixtures__/*/code.ts", - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/webpack-plugin/package.json b/packages/webpack-plugin/package.json index 4c04569f2..09dc9fbc9 100644 --- a/packages/webpack-plugin/package.json +++ b/packages/webpack-plugin/package.json @@ -1,7 +1,14 @@ { "name": "@griffel/webpack-plugin", "version": "2.0.0", + "types": "./index.d.mts", "description": "Webpack plugin that performs CSS extraction for Griffel", + "files": [ + "*.js", + "*.d.mts", + "*.d.ts", + "dist/" + ], "license": "MIT", "repository": { "type": "git", @@ -10,18 +17,20 @@ "type": "module", "exports": { ".": { + "@griffel/source": "./src/index.mts", "node": "./webpack-plugin.js", "types": "./index.d.mts" }, "./loader": { + "@griffel/source": "./src/webpackLoader.mts", "node": "./webpack-loader.js", "types": "./webpackLoader.d.mts" }, "./package.json": "./package.json" }, "dependencies": { - "@griffel/transform": "^1.2.1", "@griffel/core": "^1.20.1", + "@griffel/transform": "^1.2.1", "oxc-resolver": "^11.19.1", "stylis": "^4.2.0" }, diff --git a/packages/webpack-plugin/project.json b/packages/webpack-plugin/project.json index 21166c0fa..1e9bfa3f6 100644 --- a/packages/webpack-plugin/project.json +++ b/packages/webpack-plugin/project.json @@ -13,23 +13,11 @@ "executor": "@nx/vite:build", "outputs": ["{options.outputPath}"], "options": { - "outputPath": "dist/packages/webpack-plugin", + "outputPath": "packages/webpack-plugin/dist", "compiler": "swc", "format": ["esm"] } }, - "type-check": { - "executor": "nx:run-commands", - "options": { - "cwd": "packages/webpack-plugin", - "commands": [ - { - "command": "tsc -b --pretty" - } - ] - }, - "outputs": [] - }, "test": { "executor": "@nx/vite:test", "outputs": ["{options.reportsDirectory}"], diff --git a/packages/webpack-plugin/tsconfig.lib.json b/packages/webpack-plugin/tsconfig.lib.json index a99a4ea5c..365f4d3ee 100644 --- a/packages/webpack-plugin/tsconfig.lib.json +++ b/packages/webpack-plugin/tsconfig.lib.json @@ -1,28 +1,24 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "declaration": true, + "outDir": "./dist", + "rootDir": "./src", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "target": "ES2022", "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"] + "exclude": ["src/**/*.test.mts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.mts"], + "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..dfad535ba 100644 --- a/packages/webpack-plugin/tsconfig.spec.json +++ b/packages/webpack-plugin/tsconfig.spec.json @@ -1,23 +1,13 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", + "outDir": "./out-tsc/spec", + "rootDir": ".", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "target": "ES2022", "types": ["node", "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" - ] + "include": ["src/**/*.spec.mts", "src/**/*.test.mts", "src/**/*.d.mts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/packages/webpack-plugin/vite.config.ts b/packages/webpack-plugin/vite.config.ts index b13732a7b..0fd933e66 100644 --- a/packages/webpack-plugin/vite.config.ts +++ b/packages/webpack-plugin/vite.config.ts @@ -1,5 +1,4 @@ /// -import { nxViteTsPaths } from '@nx/vite/plugins/nx-tsconfig-paths.plugin'; import { nxCopyAssetsPlugin } from '@nx/vite/plugins/nx-copy-assets.plugin'; import { defineConfig } from 'vite'; import dts from 'vite-plugin-dts'; @@ -18,7 +17,6 @@ export default defineConfig(() => ({ root: __dirname, cacheDir: '../../node_modules/.vite/packages/webpack-plugin', plugins: [ - nxViteTsPaths(), nxCopyAssetsPlugin([ '*.md', { @@ -29,12 +27,16 @@ export default defineConfig(() => ({ ]), dts({ entryRoot: 'src', tsconfigPath: join(__dirname, 'tsconfig.lib.json'), pathsToAliases: false }), ], - - // Uncomment this if you are using workers. - // worker: { - // plugins: [ nxViteTsPaths() ], - // }, - + resolve: { + conditions: ['@griffel/source'], + }, + environments: { + ssr: { + resolve: { + conditions: ['@griffel/source'], + }, + }, + }, build: { emptyOutDir: true, lib: { diff --git a/tools/getRollupOptions.js b/tools/getRollupOptions.js index cee465ffb..6269c9c38 100644 --- a/tools/getRollupOptions.js +++ b/tools/getRollupOptions.js @@ -1,4 +1,41 @@ const { preserveDirectives } = require('rollup-plugin-preserve-directives'); +const fs = require('fs'); +const path = require('path'); + +/** + * Rollup plugin that removes declaration files (.d.ts, .d.ts.map) generated by + * @rollup/plugin-typescript. These are incompatible with tsc --build project references + * (different directory layout), so tsc handles declarations via the type-check target instead. + */ +function cleanDeclarations() { + return { + name: 'clean-declarations', + async writeBundle(outputOptions) { + const dir = outputOptions.dir; + if (!dir) return; + + const srcDir = path.join(dir, 'src'); + if (fs.existsSync(srcDir)) { + fs.rmSync(srcDir, { recursive: true }); + } + + // Remove the barrel index.d.ts and stale .tsbuildinfo generated by rollup + for (const file of fs.readdirSync(dir)) { + if (file.endsWith('.d.ts') || file.endsWith('.d.ts.map')) { + fs.unlinkSync(path.join(dir, file)); + } + } + + // Remove stale .tsbuildinfo from the package root (rollup's tsc pass creates it) + const pkgRoot = path.dirname(dir); + for (const file of fs.readdirSync(pkgRoot)) { + if (file.endsWith('.tsbuildinfo')) { + fs.unlinkSync(path.join(pkgRoot, file)); + } + } + }, + }; +} function getRollupOptions(/** @type {import('rollup').RollupOptions} */ options) { if (Array.isArray(options.output)) { @@ -14,6 +51,7 @@ function getRollupOptions(/** @type {import('rollup').RollupOptions} */ options) // Add plugin to preserve 'use client' directives in the output files options.plugins = options.plugins || []; options.plugins.push(preserveDirectives()); + options.plugins.push(cleanDeclarations()); return options; } diff --git a/tools/update-shorthands/package.json b/tools/update-shorthands/package.json new file mode 100644 index 000000000..2016faba7 --- /dev/null +++ b/tools/update-shorthands/package.json @@ -0,0 +1,8 @@ +{ + "name": "@griffel/update-shorthands", + "private": true, + "devDependencies": { + "@griffel/core": "^1.20.0", + "@griffel/style-types": "^1.3.0" + } +} diff --git a/tools/update-shorthands/project.json b/tools/update-shorthands/project.json index f05cf75b0..55d2b2bbf 100644 --- a/tools/update-shorthands/project.json +++ b/tools/update-shorthands/project.json @@ -27,18 +27,6 @@ "options": { "jestConfig": "tools/update-shorthands/jest.config.ts" } - }, - "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 3acbab264..f17cf21a5 100644 --- a/tools/update-shorthands/tsconfig.json +++ b/tools/update-shorthands/tsconfig.json @@ -1,8 +1,7 @@ { "extends": "../../tsconfig.base.json", "compilerOptions": { - "allowJs": true, - "module": "commonjs" + "allowJs": true }, "files": [], "include": [], diff --git a/tools/update-shorthands/tsconfig.lib.json b/tools/update-shorthands/tsconfig.lib.json index 5237aa9a9..1b019f55d 100644 --- a/tools/update-shorthands/tsconfig.lib.json +++ b/tools/update-shorthands/tsconfig.lib.json @@ -1,10 +1,18 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { - "outDir": "../../dist/out-tsc", - "declaration": false, + "outDir": "./dist", + "rootDir": "./src", "types": ["node", "environment"] }, - "exclude": ["__fixtures__/*/*.ts", "**/*.spec.ts", "**/*.test.ts", "jest.config.ts"], - "include": ["**/*.ts"] + "exclude": ["src/**/*.test.ts", "src/**/__fixture__/", "src/**/__mocks__/"], + "include": ["src/**/*.ts"], + "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 06948acab..c6af75ac9 100644 --- a/tools/update-shorthands/tsconfig.spec.json +++ b/tools/update-shorthands/tsconfig.spec.json @@ -1,22 +1,11 @@ { - "extends": "./tsconfig.json", + "extends": "../../tsconfig.base.json", "compilerOptions": { "jsx": "react", - "outDir": "../../dist/out-tsc", - "module": "commonjs", + "outDir": "./out-tsc/spec", + "rootDir": ".", "types": ["jest", "node", "environment"] }, - "include": [ - "__fixtures__/*/code.ts", - "**/*.test.ts", - "**/*.spec.ts", - "**/*.test.tsx", - "**/*.spec.tsx", - "**/*.test.js", - "**/*.spec.js", - "**/*.test.jsx", - "**/*.spec.jsx", - "**/*.d.ts", - "jest.config.ts" - ] + "include": ["src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.d.ts"], + "references": [{ "path": "./tsconfig.lib.json" }] } diff --git a/tsconfig.base.json b/tsconfig.base.json index 2b75c7ef2..2b454c0fe 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -1,12 +1,11 @@ { "compileOnSave": false, "compilerOptions": { - "rootDir": ".", + "composite": true, "sourceMap": true, - "declaration": false, - "moduleResolution": "node", - "emitDecoratorMetadata": true, - "experimentalDecorators": true, + "declarationMap": true, + "moduleResolution": "bundler", + "customConditions": ["@griffel/source"], "importHelpers": true, "target": "es2019", "module": "esnext", @@ -19,29 +18,8 @@ "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/next-extraction-plugin": ["packages/next-extraction-plugin/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/tag-processor": ["packages/tag-processor/src/index.ts"], - "@griffel/tag-processor/make-reset-styles": ["packages/tag-processor/src/MakeResetStylesProcessor.ts"], - "@griffel/tag-processor/make-styles": ["packages/tag-processor/src/MakeStylesProcessor.ts"], - "@griffel/transform": ["packages/transform/src/index.mts"], - "@griffel/update-shorthands": ["tools/update-shorthands/src/index.ts"], - "@griffel/vite-plugin": ["packages/vite-plugin/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"] + "isolatedModules": true, + "typeRoots": ["./node_modules/@types", "./typings"] }, "exclude": ["node_modules", "tmp"] } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 000000000..e52eb4f95 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,28 @@ +{ + "extends": "./tsconfig.base.json", + "files": [], + "references": [ + { "path": "./packages/style-types" }, + { "path": "./packages/core" }, + { "path": "./packages/react" }, + { "path": "./packages/transform" }, + { "path": "./packages/webpack-plugin" }, + { "path": "./packages/babel-preset" }, + { "path": "./packages/tag-processor" }, + { "path": "./packages/webpack-loader" }, + { "path": "./packages/webpack-extraction-plugin" }, + { "path": "./packages/next-extraction-plugin" }, + { "path": "./packages/jest-serializer" }, + { "path": "./packages/postcss-syntax" }, + { "path": "./packages/vite-plugin" }, + { "path": "./packages/shadow-dom" }, + { "path": "./packages/devtools" }, + { "path": "./packages/eslint-plugin" }, + { "path": "./apps/website" }, + { "path": "./e2e/nextjs" }, + { "path": "./e2e/rspack" }, + { "path": "./e2e/typescript" }, + { "path": "./e2e/utils" }, + { "path": "./tools/update-shorthands" } + ] +} diff --git a/yarn.lock b/yarn.lock index e9bed68e1..122380035 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3519,6 +3519,255 @@ __metadata: languageName: node linkType: hard +"@griffel/babel-preset@npm:^1.8.0, @griffel/babel-preset@workspace:packages/babel-preset": + version: 0.0.0-use.local + resolution: "@griffel/babel-preset@workspace:packages/babel-preset" + dependencies: + "@babel/core": "npm:^7.23.2" + "@babel/generator": "npm:^7.23.0" + "@babel/helper-plugin-utils": "npm:^7.22.5" + "@babel/template": "npm:^7.22.15" + "@babel/traverse": "npm:^7.23.2" + "@griffel/core": "npm:^1.20.0" + "@griffel/react": "npm:^1.6.0" + "@linaria/babel-preset": "npm:^3.0.0-beta.24" + "@linaria/shaker": "npm:^3.0.0-beta.22" + ajv: "npm:^8.18.0" + stylis: "npm:^4.2.0" + tslib: "npm:^2.1.0" + languageName: unknown + linkType: soft + +"@griffel/core@npm:^1.20.0, @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.3.0" + csstype: "npm:^3.1.3" + rtl-css-js: "npm:^1.16.1" + stylis: "npm:^4.2.0" + tslib: "npm:^2.1.0" + languageName: unknown + linkType: soft + +"@griffel/devtools@workspace:packages/devtools": + version: 0.0.0-use.local + resolution: "@griffel/devtools@workspace:packages/devtools" + dependencies: + "@griffel/core": "npm:^1.20.0" + "@griffel/react": "npm:^1.6.0" + languageName: unknown + linkType: soft + +"@griffel/e2e-nextjs@workspace:e2e/nextjs": + version: 0.0.0-use.local + resolution: "@griffel/e2e-nextjs@workspace:e2e/nextjs" + dependencies: + "@griffel/e2e-utils": "workspace:*" + "@griffel/next-extraction-plugin": "npm:^0.1.14" + "@griffel/react": "npm:^1.6.0" + "@griffel/webpack-loader": "npm:^2.2.22" + 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": "npm:^1.6.0" + "@griffel/webpack-extraction-plugin": "npm:^0.5.13" + "@griffel/webpack-loader": "npm:^2.2.22" + 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": "npm:^1.3.0" + languageName: unknown + linkType: soft + +"@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": + version: 0.0.0-use.local + resolution: "@griffel/eslint-plugin@workspace:packages/eslint-plugin" + dependencies: + "@griffel/react": "npm:^1.6.0" + "@typescript-eslint/utils": "npm:^7.18.0" + csstype: "npm:^3.1.3" + tslib: "npm:^2.1.0" + peerDependencies: + eslint: ^7.5.0 || ^8.0.0 + languageName: unknown + linkType: soft + +"@griffel/jest-serializer@workspace:packages/jest-serializer": + version: 0.0.0-use.local + resolution: "@griffel/jest-serializer@workspace:packages/jest-serializer" + dependencies: + "@griffel/core": "npm:^1.20.0" + "@griffel/react": "npm:^1.6.0" + tslib: "npm:^2.1.0" + languageName: unknown + linkType: soft + +"@griffel/next-extraction-plugin@npm:^0.1.14, @griffel/next-extraction-plugin@workspace:packages/next-extraction-plugin": + version: 0.0.0-use.local + resolution: "@griffel/next-extraction-plugin@workspace:packages/next-extraction-plugin" + dependencies: + "@griffel/webpack-extraction-plugin": "npm:^0.5.13" + browserslist: "npm:^4.19.1" + tslib: "npm:^2.1.0" + peerDependencies: + next: ">=13" + languageName: unknown + linkType: soft + +"@griffel/postcss-syntax@workspace:packages/postcss-syntax": + version: 0.0.0-use.local + resolution: "@griffel/postcss-syntax@workspace:packages/postcss-syntax" + dependencies: + "@babel/core": "npm:^7.23.2" + "@babel/helper-plugin-utils": "npm:^7.22.5" + "@griffel/babel-preset": "npm:^1.8.0" + "@griffel/react": "npm:^1.6.0" + postcss: "npm:^8.4.29" + languageName: unknown + linkType: soft + +"@griffel/react@npm:^1.6.0, @griffel/react@workspace:packages/react": + version: 0.0.0-use.local + resolution: "@griffel/react@workspace:packages/react" + dependencies: + "@griffel/core": "npm:^1.20.0" + tslib: "npm:^2.1.0" + peerDependencies: + react: ">=16.8.0 <20.0.0" + languageName: unknown + linkType: soft + +"@griffel/shadow-dom@workspace:packages/shadow-dom": + version: 0.0.0-use.local + resolution: "@griffel/shadow-dom@workspace:packages/shadow-dom" + dependencies: + "@griffel/core": "npm:^1.20.0" + "@griffel/react": "npm:^1.6.0" + tslib: "npm:^2.1.0" + languageName: unknown + linkType: soft + +"@griffel/style-types@npm:^1.3.0, @griffel/style-types@workspace:packages/style-types": + version: 0.0.0-use.local + resolution: "@griffel/style-types@workspace:packages/style-types" + dependencies: + csstype: "npm:^3.1.3" + languageName: unknown + linkType: soft + +"@griffel/tag-processor@workspace:packages/tag-processor": + version: 0.0.0-use.local + resolution: "@griffel/tag-processor@workspace:packages/tag-processor" + dependencies: + "@griffel/core": "npm:^1.20.0" + "@wyw-in-js/processor-utils": "npm:^0.8.0" + stylis: "npm:^4.2.0" + tslib: "npm:^2.1.0" + languageName: unknown + linkType: soft + +"@griffel/transform@npm:^1.2.0, @griffel/transform@workspace:packages/transform": + version: 0.0.0-use.local + resolution: "@griffel/transform@workspace:packages/transform" + dependencies: + "@griffel/core": "npm:^1.20.0" + "@griffel/react": "npm:^1.6.0" + "@linaria/shaker": "npm:^3.0.0-beta.22" + debug: "npm:^4.3.0" + magic-string: "npm:^0.30.19" + oxc-parser: "npm:^0.116.0" + oxc-walker: "npm:^0.7.0" + languageName: unknown + linkType: soft + +"@griffel/update-shorthands@workspace:tools/update-shorthands": + version: 0.0.0-use.local + resolution: "@griffel/update-shorthands@workspace:tools/update-shorthands" + dependencies: + "@griffel/core": "npm:^1.20.0" + "@griffel/style-types": "npm:^1.3.0" + languageName: unknown + linkType: soft + +"@griffel/vite-plugin@workspace:packages/vite-plugin": + version: 0.0.0-use.local + resolution: "@griffel/vite-plugin@workspace:packages/vite-plugin" + dependencies: + "@wyw-in-js/vite": "npm:^0.8.0" + peerDependencies: + "@griffel/tag-processor": ">=1.0.15 <2.0.0" + vite: ">=4" + languageName: unknown + linkType: soft + +"@griffel/webpack-extraction-plugin@npm:^0.5.13, @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.23.2" + "@babel/helper-module-imports": "npm:^7.22.15" + "@babel/helper-plugin-utils": "npm:^7.22.5" + "@griffel/core": "npm:^1.20.0" + "@griffel/react": "npm:^1.6.0" + stylis: "npm:^4.2.0" + tslib: "npm:^2.1.0" + peerDependencies: + webpack: ^5 + languageName: unknown + linkType: soft + +"@griffel/webpack-loader@npm:^2.2.22, @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.23.2" + "@griffel/babel-preset": "npm:^1.8.0" + "@griffel/react": "npm:^1.6.0" + enhanced-resolve: "npm:^5.15.0" + tslib: "npm:^2.1.0" + peerDependencies: + webpack: ^5 + languageName: unknown + linkType: soft + +"@griffel/webpack-plugin@workspace:packages/webpack-plugin": + version: 0.0.0-use.local + resolution: "@griffel/webpack-plugin@workspace:packages/webpack-plugin" + dependencies: + "@griffel/core": "npm:^1.20.0" + "@griffel/transform": "npm:^1.2.0" + enhanced-resolve: "npm:^5.15.0" + oxc-resolver: "npm:^11.19.1" + stylis: "npm:^4.2.0" + peerDependencies: + webpack: ^5 + 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" @@ -10251,28 +10500,6 @@ __metadata: languageName: node linkType: hard -"beachball@patch:beachball@npm:2.31.5#.yarn/patches/beachball-npm-2.31.5-0e84ec4233.patch::locator=griffel-repository%40workspace%3A.": - version: 2.31.5 - resolution: "beachball@patch:beachball@npm%3A2.31.5#.yarn/patches/beachball-npm-2.31.5-0e84ec4233.patch::version=2.31.5&hash=21277d&locator=griffel-repository%40workspace%3A." - dependencies: - cosmiconfig: "npm:^7.0.0" - execa: "npm:^5.0.0" - fs-extra: "npm:^10.0.0" - lodash: "npm:^4.17.15" - minimatch: "npm:^3.0.4" - p-limit: "npm:^3.0.2" - prompts: "npm:^2.4.2" - semver: "npm:^7.0.0" - toposort: "npm:^2.0.2" - uuid: "npm:^9.0.0" - workspace-tools: "npm:^0.29.0" - yargs-parser: "npm:^21.0.0" - bin: - beachball: bin/beachball.js - checksum: 10/01fdff91134d30225df12ecea3c73cdd0498d7d281c83f94acf7dacebd872d0d993f38efe4fca26a3a8f88dbf9843c8afe2c73e92f02c38840d798875b261ac1 - languageName: node - linkType: hard - "bestzip@npm:2.2.0": version: 2.2.0 resolution: "bestzip@npm:2.2.0" @@ -15176,6 +15403,7 @@ __metadata: react-dom: "npm:18.3.1" react-refresh: "npm:^0.10.0" react-shadow: "npm:^20.2.0" + rollup: "npm:^4.14.0" rollup-plugin-preserve-directives: "npm:^0.4.0" rtl-css-js: "npm:^1.16.1" simple-git-hooks: "npm:2.7.0" @@ -22315,14 +22543,14 @@ __metadata: languageName: node linkType: hard -"postcss@npm:^8.4.21, postcss@npm:^8.4.24, postcss@npm:^8.4.27, postcss@npm:^8.4.33, postcss@npm:^8.4.38, postcss@npm:^8.5.4, postcss@npm:^8.5.6": - version: 8.5.6 - resolution: "postcss@npm:8.5.6" +"postcss@npm:^8.4.21, postcss@npm:^8.4.24, postcss@npm:^8.4.27, postcss@npm:^8.4.29, postcss@npm:^8.4.33, postcss@npm:^8.4.38, postcss@npm:^8.5.4, postcss@npm:^8.5.6": + version: 8.5.8 + resolution: "postcss@npm:8.5.8" dependencies: nanoid: "npm:^3.3.11" picocolors: "npm:^1.1.1" source-map-js: "npm:^1.2.1" - checksum: 10/9e4fbe97574091e9736d0e82a591e29aa100a0bf60276a926308f8c57249698935f35c5d2f4e80de778d0cbb8dcffab4f383d85fd50c5649aca421c3df729b86 + checksum: 10/cbacbfd7f767e2c820d4bf09a3a744834dd7d14f69ff08d1f57b1a7defce9ae5efcf31981890d9697a972a64e9965de677932ef28e4c8ba23a87aad45b82c459 languageName: node linkType: hard