diff --git a/CHANGELOG.md b/CHANGELOG.md index 0a4a057..03cef87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +## 0.6.1 + +Use exports map + ## 0.6.0 Publish as ESM diff --git a/README.md b/README.md index 7a913a9..9c2eba5 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Add `import "virtual:@downwind/base.css";` and `import "virtual:@downwind/utils. To use nesting, install [postcss-nested](https://github.com/postcss/postcss-nested) and add it to the postcss config: ```js -// postcss.config.js +// postcss.config.cjs module.exports = { plugins: { "postcss-nested": {}, diff --git a/bun.lockb b/bun.lockb index d7f4e2f..211bf73 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index 084880f..a4d0ac1 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,9 @@ { "name": "@arnaud-barre/downwind", "description": "A PostCSS-less implementation of Tailwind based on Lightning CSS", + "private": true, "type": "module", - "version": "0.6.0", + "version": "0.6.1", "author": "Arnaud Barré (https://github.com/ArnaudBarre)", "license": "MIT", "scripts": { @@ -21,7 +22,7 @@ "quoteProps": "consistent" }, "dependencies": { - "@arnaud-barre/config-loader": "^0.6.1", + "@arnaud-barre/config-loader": "^0.6.2", "lightningcss": "^1.20.0" }, "devDependencies": { diff --git a/playground/vite/package.json b/playground/vite/package.json index 6885521..66da791 100644 --- a/playground/vite/package.json +++ b/playground/vite/package.json @@ -1,6 +1,7 @@ { "name": "vite-playground", "private": true, + "type": "module", "scripts": { "dev": "vite", "tsc": "tsc", diff --git a/playground/vite/vite.config.ts b/playground/vite/vite.config.ts index 6922ed8..473f887 100644 --- a/playground/vite/vite.config.ts +++ b/playground/vite/vite.config.ts @@ -1,6 +1,6 @@ import react from "@vitejs/plugin-react-swc"; import { defineConfig } from "vite"; -import { downwind } from "../../dist/vite.js"; +import { downwind } from "../../dist/vitePlugin.js"; // eslint-disable-next-line import/no-default-export export default defineConfig({ plugins: [react(), downwind()] }); diff --git a/scripts/bundle.ts b/scripts/bundle.ts index 938ba8c..006572c 100755 --- a/scripts/bundle.ts +++ b/scripts/bundle.ts @@ -39,13 +39,11 @@ await buildOrWatch({ supported: { "object-rest-spread": false }, }); -execSync("cp -r LICENSE README.md dist/"); +execSync( + "cp -r LICENSE README.md src/esbuildPlugin.d.ts src/vitePlugin.d.ts dist/", +); copyFileSync("src/base/base.css", "dist/base.css"); copyFileSync("src/types.d.ts", "dist/index.d.ts"); -for (const tool of ["esbuild", "vite"]) { - copyFileSync(`src/${tool}Plugin.d.ts`, `dist/${tool}.d.ts`); - execSync(`mv dist/${tool}Plugin.js dist/${tool}.js`); -} if ( !dev && @@ -70,7 +68,11 @@ writeFileSync( license: packageJSON.license, repository: "ArnaudBarre/downwind", keywords: ["tailwind", "lightningcss"], - main: "index.js", + exports: { + ".": "./index.js", + "./esbuild": "./esbuildPlugin.js", + "./vite": "./vitePlugin.js", + }, bin: { downwind: "cli.js" }, dependencies: packageJSON.dependencies, }, diff --git a/src/cli.ts b/src/cli.ts index 2e46602..bfe58c7 100644 --- a/src/cli.ts +++ b/src/cli.ts @@ -1,7 +1,6 @@ #!/usr/bin/env node import { existsSync, mkdirSync, writeFileSync } from "node:fs"; import { dirname } from "node:path"; -import type { Downwind } from "./types"; const firstArg = process.argv[2] as string | undefined; @@ -35,7 +34,7 @@ if (!output) { } const module = await import("./index.ts"); -const downwind: Downwind = await module.initDownwind(); +const downwind = await module.initDownwind(); const dir = dirname(output); if (!existsSync(dir)) mkdirSync(dir, { recursive: true }); writeFileSync(output, downwind.codegen({ mode })); diff --git a/yarn.lock b/yarn.lock index 8d64025..4f4694c 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1,12 +1,12 @@ # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. # yarn lockfile v1 -# bun ./bun.lockb --hash: C97A53C32FBF0D0E-61aef6eaec7a0a57-2E4C0597A1030AC1-a794a4a9657b095e +# bun ./bun.lockb --hash: 3A30617A91567C88-ac0f42393f38566c-3D4190F2E8F16EC3-1830e3dcd3a65965 -"@arnaud-barre/config-loader@^0.6.1": - version "0.6.1" - resolved "https://registry.npmjs.org/@arnaud-barre/config-loader/-/config-loader-0.6.1.tgz" - integrity sha512-61Y2+ePCILBmJPFL6m9oIk+Dt/aW5GEH9zq4yyN9YwAZ/1jyo9W5aixDtPupVXmxSRCdliLs4rKzeJ42Qovj/Q== +"@arnaud-barre/config-loader@^0.6.2": + version "0.6.2" + resolved "https://registry.npmjs.org/@arnaud-barre/config-loader/-/config-loader-0.6.2.tgz" + integrity sha512-nVpWengzVguxul4sU4kDmVT/d7dvPJLBjKx3z7c55RXpi01U/R553DVFJRmBFC4J4CMeL78rfpwdRx9QcBAa1g== dependencies: esbuild "^0.17"