Skip to content

Commit

Permalink
Use exports map [publish]
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre committed May 14, 2023
1 parent 3bfc201 commit 151aab8
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 17 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 0.6.1

Use exports map

## 0.6.0

Publish as ESM
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -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": {},
Expand Down
Binary file modified bun.lockb
Binary file not shown.
5 changes: 3 additions & 2 deletions 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": {
Expand All @@ -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": {
Expand Down
1 change: 1 addition & 0 deletions playground/vite/package.json
@@ -1,6 +1,7 @@
{
"name": "vite-playground",
"private": true,
"type": "module",
"scripts": {
"dev": "vite",
"tsc": "tsc",
Expand Down
2 changes: 1 addition & 1 deletion 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()] });
14 changes: 8 additions & 6 deletions scripts/bundle.ts
Expand Up @@ -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 &&
Expand All @@ -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,
},
Expand Down
3 changes: 1 addition & 2 deletions 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;

Expand Down Expand Up @@ -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 }));
10 changes: 5 additions & 5 deletions 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"

Expand Down

0 comments on commit 151aab8

Please sign in to comment.