@monowind/vite 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Benoît Rouleau
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @monowind/vite
2
+
3
+ Zero-config Vite plugin for [monowind](https://www.npmjs.com/package/monowind)
4
+ — Tailwind included, no Tailwind setup required. Add the plugin, write HTML.
5
+
6
+ ```sh
7
+ npm install -D @monowind/vite
8
+ ```
9
+
10
+ ```ts
11
+ // vite.config.ts
12
+ import monowind from "@monowind/vite";
13
+ import { defineConfig } from "vite";
14
+
15
+ export default defineConfig({
16
+ plugins: [monowind()],
17
+ });
18
+ ```
19
+
20
+ ```html
21
+ <!-- index.html — no stylesheet, no script: the plugin injects both. -->
22
+ <mono-wind>
23
+ <div class="flex min-h-5 items-center justify-between border px-1">
24
+ <div>left</div>
25
+ <button>right</button>
26
+ </div>
27
+ </mono-wind>
28
+ ```
29
+
30
+ ## Customizing Tailwind
31
+
32
+ Pass a CSS entry to add `@theme` tokens, custom utilities, or any other
33
+ Tailwind CSS features:
34
+
35
+ ```ts
36
+ monowind({ css: "./src/theme.css" });
37
+ ```
38
+
39
+ ```css
40
+ /* src/theme.css */
41
+ @theme {
42
+ --color-phosphor: #00ff88;
43
+ }
44
+ ```
45
+
46
+ Setups without an `index.html` can load everything manually with
47
+ `import "virtual:monowind"`.
48
+
49
+ ## Docs
50
+
51
+ See the [monowind repository](https://github.com/benface/monowind) for
52
+ documentation and examples.
@@ -0,0 +1,25 @@
1
+ import type { PluginOption } from "vite";
2
+ export interface MonowindOptions {
3
+ /**
4
+ * Optional CSS entry (path relative to the Vite root) pulled into the
5
+ * Tailwind compilation, so `@theme` customization, custom utilities, and
6
+ * any other Tailwind CSS features work exactly as in a hand-rolled setup.
7
+ */
8
+ css?: string;
9
+ }
10
+ /**
11
+ * Standalone monowind: add this plugin and write HTML — Tailwind v4 and the
12
+ * monowind engine are wired up automatically (no Tailwind install, no CSS
13
+ * entry, no JS entry required).
14
+ *
15
+ * How: the plugin embeds `@tailwindcss/vite`, generates a CSS entry that
16
+ * imports Tailwind + the monowind companion stylesheet (+ the user's `css`
17
+ * file, if any) via absolute paths — so resolution works even though the
18
+ * user's project doesn't depend on Tailwind — and injects a virtual module
19
+ * into index.html that loads that CSS and registers <mono-wind>.
20
+ *
21
+ * Setups without an index.html (SSR, some frameworks) can import the same
22
+ * virtual module manually instead: `import "virtual:monowind"`.
23
+ */
24
+ export default function monowind(options?: MonowindOptions): PluginOption[];
25
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAU,YAAY,EAAE,MAAM,MAAM,CAAC;AAEjD,MAAM,WAAW,eAAe;IAC9B;;;;OAIG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAID;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,OAAO,UAAU,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,YAAY,EAAE,CAmE9E"}
package/dist/index.js ADDED
@@ -0,0 +1,85 @@
1
+ import { mkdirSync, writeFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import path from "node:path";
4
+ import tailwindcss from "@tailwindcss/vite";
5
+ const VIRTUAL_ID = "virtual:monowind";
6
+ /**
7
+ * Standalone monowind: add this plugin and write HTML — Tailwind v4 and the
8
+ * monowind engine are wired up automatically (no Tailwind install, no CSS
9
+ * entry, no JS entry required).
10
+ *
11
+ * How: the plugin embeds `@tailwindcss/vite`, generates a CSS entry that
12
+ * imports Tailwind + the monowind companion stylesheet (+ the user's `css`
13
+ * file, if any) via absolute paths — so resolution works even though the
14
+ * user's project doesn't depend on Tailwind — and injects a virtual module
15
+ * into index.html that loads that CSS and registers <mono-wind>.
16
+ *
17
+ * Setups without an index.html (SSR, some frameworks) can import the same
18
+ * virtual module manually instead: `import "virtual:monowind"`.
19
+ */
20
+ export default function monowind(options = {}) {
21
+ // Resolve from THIS package's context: the user's project depends only on
22
+ // @monowind/vite; tailwindcss and monowind are our dependencies.
23
+ const require = createRequire(import.meta.url);
24
+ const tailwindEntry = path.join(path.dirname(require.resolve("tailwindcss/package.json")), "index.css");
25
+ const companionEntry = require.resolve("monowind/styles.css");
26
+ const engineEntry = require.resolve("monowind");
27
+ let cssEntryPath = "";
28
+ let command = "serve";
29
+ const setup = {
30
+ name: "monowind",
31
+ configResolved(config) {
32
+ command = config.command;
33
+ const imports = [tailwindEntry, companionEntry];
34
+ if (options.css)
35
+ imports.push(path.resolve(config.root, options.css));
36
+ // A real file on disk (not a virtual module) so Tailwind's plugin and
37
+ // Vite's CSS pipeline treat it like any authored entry. Lives NEXT TO
38
+ // Vite's cacheDir (usually node_modules/.monowind): that location is
39
+ // writable and gitignored wherever `root` points, but deliberately NOT
40
+ // inside cacheDir itself — Vite treats URLs under cacheDir as
41
+ // dep-optimizer artifacts and won't serve arbitrary files from there.
42
+ const cacheDir = path.join(path.dirname(config.cacheDir), ".monowind");
43
+ mkdirSync(cacheDir, { recursive: true });
44
+ cssEntryPath = path.join(cacheDir, "entry.css");
45
+ const content = imports.map((file) => `@import ${JSON.stringify(file)};`).join("\n");
46
+ writeFileSync(cssEntryPath, `${content}\n`);
47
+ },
48
+ resolveId(id) {
49
+ if (id === VIRTUAL_ID)
50
+ return VIRTUAL_ID;
51
+ return undefined;
52
+ },
53
+ load(id) {
54
+ if (id !== VIRTUAL_ID)
55
+ return undefined;
56
+ return [
57
+ `import ${JSON.stringify(cssEntryPath)};`,
58
+ `import { defineMonoWind } from ${JSON.stringify(engineEntry)};`,
59
+ `defineMonoWind();`,
60
+ ].join("\n");
61
+ },
62
+ transformIndexHtml: {
63
+ // `pre`, so the injected script is present when Vite's build scans the
64
+ // HTML for module entries (post-order injection ships the raw
65
+ // `/@id/...` URL to production, unresolved).
66
+ order: "pre",
67
+ handler() {
68
+ return [
69
+ {
70
+ tag: "script",
71
+ attrs: {
72
+ type: "module",
73
+ // Dev middleware needs the /@id/ prefix; the build resolves
74
+ // the bare virtual id through resolveId.
75
+ src: command === "serve" ? `/@id/${VIRTUAL_ID}` : VIRTUAL_ID,
76
+ },
77
+ injectTo: "head",
78
+ },
79
+ ];
80
+ },
81
+ },
82
+ };
83
+ return [tailwindcss(), setup];
84
+ }
85
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,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description": "Zero-config Vite plugin for monowind — Tailwind included, no Tailwind setup required",
5
+ "keywords": [
6
+ "monowind",
7
+ "tailwind",
8
+ "tui",
9
+ "vite-plugin"
10
+ ],
11
+ "license": "MIT",
12
+ "author": "Benoît Rouleau",
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/benface/monowind.git",
16
+ "directory": "packages/vite"
17
+ },
18
+ "files": [
19
+ "dist"
20
+ ],
21
+ "type": "module",
22
+ "sideEffects": false,
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "default": "./dist/index.js"
27
+ }
28
+ },
29
+ "dependencies": {
30
+ "@tailwindcss/vite": "^4.3.3",
31
+ "monowind": "^0.1.0",
32
+ "tailwindcss": "^4.3.3"
33
+ },
34
+ "devDependencies": {
35
+ "typescript": "^7.0.2",
36
+ "vite": "^8.2.2"
37
+ },
38
+ "peerDependencies": {
39
+ "vite": "^7.0.0 || ^8.0.0"
40
+ },
41
+ "scripts": {
42
+ "build": "tsc -p tsconfig.build.json",
43
+ "typecheck": "tsc --noEmit"
44
+ }
45
+ }