From b96dd4db0d0e925abaddf7c8b3b3b9d57ed32b6f Mon Sep 17 00:00:00 2001 From: Amin Yahyaabadi Date: Sat, 4 May 2024 23:10:21 -0700 Subject: [PATCH] fix: include the source in the packages This has several benefits: - Allows directly importing the source files, that could resolve the issues with server-side rendering with various build systems - Can result in more optimized code as the source file is directly built by the build tool (better tree shaking or more modern syntax) - Compatibility with new package registries such as JSR that prefer TypeScript over JavaScript - In security conscious environments, the source files can be checked against GitHub and then used directly. --- packages/core/package.json | 5 ++++- packages/tailwindcss/package.json | 7 +++++-- packages/tests/package.json | 4 +++- packages/utils/package.json | 7 +++++-- packages/vanilla-extract/package.json | 7 +++++-- 5 files changed, 22 insertions(+), 8 deletions(-) diff --git a/packages/core/package.json b/packages/core/package.json index 2dcf5609..3d8bfb59 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -39,7 +39,8 @@ "types": "./dist/*/index.d.ts", "solid": "./dist/*/index.jsx", "default": "./dist/*/index.js" - } + }, + "./src/*": "./src/*" }, "main": "dist/index.js", "module": "dist/index.js", @@ -52,8 +53,10 @@ ] } }, + "source": "src/index.tsx", "files": [ "dist", + "src", "NOTICE.txt" ], "scripts": { diff --git a/packages/tailwindcss/package.json b/packages/tailwindcss/package.json index dd5bb46a..590e0280 100644 --- a/packages/tailwindcss/package.json +++ b/packages/tailwindcss/package.json @@ -31,13 +31,16 @@ "default": "./dist/index.js" }, "require": "./dist/index.cjs" - } + }, + "./src/*": "./src/*" }, "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", + "source": "src/index.ts", "files": [ - "dist" + "dist", + "src" ], "scripts": { "build": "tsup", diff --git a/packages/tests/package.json b/packages/tests/package.json index ef8bd6f0..92c7b7b9 100644 --- a/packages/tests/package.json +++ b/packages/tests/package.json @@ -40,8 +40,10 @@ "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", + "source": "src/index.ts", "files": [ - "dist" + "dist", + "src" ], "scripts": { "build": "tsup", diff --git a/packages/utils/package.json b/packages/utils/package.json index 06ddd8e1..63563cf1 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -35,13 +35,16 @@ "default": "./dist/index.js" }, "require": "./dist/index.cjs" - } + }, + "./src/*": "./src/*" }, "main": "./dist/index.cjs", "module": "./dist/index.js", "types": "./dist/index.d.ts", + "source": "src/index.ts", "files": [ - "dist" + "dist", + "src" ], "scripts": { "build": "tsup", diff --git a/packages/vanilla-extract/package.json b/packages/vanilla-extract/package.json index ec81dd41..1cd66465 100644 --- a/packages/vanilla-extract/package.json +++ b/packages/vanilla-extract/package.json @@ -30,13 +30,16 @@ "default": "./dist/index.mjs", "require": "./dist/index.js", "node": "./dist/index.js" - } + }, + "./src/*": "./src/*" }, "main": "dist/index.js", "module": "dist/index.mjs", "types": "dist/index.d.ts", + "source": "src/index.ts", "files": [ - "dist" + "dist", + "src" ], "scripts": { "build": "tsup",