unplugin-zed-gpui 0.0.2

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.
Files changed (57) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +155 -0
  3. package/dist/esbuild.cjs +6 -0
  4. package/dist/esbuild.cjs.map +1 -0
  5. package/dist/esbuild.d.cts +6 -0
  6. package/dist/esbuild.d.cts.map +1 -0
  7. package/dist/esbuild.d.mts +7 -0
  8. package/dist/esbuild.d.mts.map +1 -0
  9. package/dist/esbuild.mjs +7 -0
  10. package/dist/esbuild.mjs.map +1 -0
  11. package/dist/index.cjs +7 -0
  12. package/dist/index.d.cts +26 -0
  13. package/dist/index.d.cts.map +1 -0
  14. package/dist/index.d.mts +26 -0
  15. package/dist/index.d.mts.map +1 -0
  16. package/dist/index.mjs +2 -0
  17. package/dist/noble.cjs +7 -0
  18. package/dist/noble.d.cts +2 -0
  19. package/dist/noble.d.mts +2 -0
  20. package/dist/noble.mjs +2 -0
  21. package/dist/rollup.cjs +6 -0
  22. package/dist/rollup.cjs.map +1 -0
  23. package/dist/rollup.d.cts +1350 -0
  24. package/dist/rollup.d.cts.map +1 -0
  25. package/dist/rollup.d.mts +1351 -0
  26. package/dist/rollup.d.mts.map +1 -0
  27. package/dist/rollup.mjs +7 -0
  28. package/dist/rollup.mjs.map +1 -0
  29. package/dist/rspack.cjs +6 -0
  30. package/dist/rspack.cjs.map +1 -0
  31. package/dist/rspack.d.cts +6 -0
  32. package/dist/rspack.d.cts.map +1 -0
  33. package/dist/rspack.d.mts +7 -0
  34. package/dist/rspack.d.mts.map +1 -0
  35. package/dist/rspack.mjs +7 -0
  36. package/dist/rspack.mjs.map +1 -0
  37. package/dist/src-CQKToE8V.cjs +30417 -0
  38. package/dist/src-CQKToE8V.cjs.map +1 -0
  39. package/dist/src-Cdq30MRu.mjs +30412 -0
  40. package/dist/src-Cdq30MRu.mjs.map +1 -0
  41. package/dist/vite.cjs +6 -0
  42. package/dist/vite.cjs.map +1 -0
  43. package/dist/vite.d.cts +6 -0
  44. package/dist/vite.d.cts.map +1 -0
  45. package/dist/vite.d.mts +7 -0
  46. package/dist/vite.d.mts.map +1 -0
  47. package/dist/vite.mjs +7 -0
  48. package/dist/vite.mjs.map +1 -0
  49. package/dist/webpack.cjs +6 -0
  50. package/dist/webpack.cjs.map +1 -0
  51. package/dist/webpack.d.cts +6 -0
  52. package/dist/webpack.d.cts.map +1 -0
  53. package/dist/webpack.d.mts +7 -0
  54. package/dist/webpack.d.mts.map +1 -0
  55. package/dist/webpack.mjs +7 -0
  56. package/dist/webpack.mjs.map +1 -0
  57. package/package.json +92 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 kasukabe tsumugi
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,155 @@
1
+ # unplugin-zed-gpui-treeshake
2
+ # zed-gpui
3
+
4
+ [![npm version](https://img.shields.io/npm/v/unplugin-zed-gpui-treeshake.svg)](https://www.npmjs.org/package/unplugin-zed-gpui-treeshake)
5
+ [![npm downloads](https://img.shields.io/npm/dm/unplugin-zed-gpui-treeshakesvg)](https://www.npmjs.org/package/unplugin-zed-gpui-treeshake)
6
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
7
+
8
+ <p align="center">
9
+ <img src="../../assets/icon.png" width="240px" alt="zed-gpui logo" />
10
+ </p>
11
+
12
+ > 🌳 Tree-shaking optimization plugin for zed-gpui framework
13
+
14
+ ## Framework: [Zed Gpui](https://www.npmjs.com/package/zed-gpui)
15
+
16
+ Remove unused zed-gpui methods from your bundle to reduce bundle size.
17
+
18
+ ## Features
19
+
20
+ - 🚀 **Bundle Size Optimization**: Removes unused zed-gpui methods automatically
21
+ - 🔍 **Usage Analysis**: Analyzes your code to find which zed-gpui methods are actually used
22
+ - 📦 **Unplugin Support**: Works with Vite, Webpack, Rollup, esbuild, and more
23
+ - ⚡ **Zero Config**: Works out of the box with sensible defaults
24
+ - 🛠️ **TypeScript Support**: Full TypeScript support
25
+
26
+ ## Installation
27
+
28
+ ```bash
29
+ npm install unplugin-zed-gpui-treeshake -D
30
+ ```
31
+
32
+ ```bash
33
+ pnpm add unplugin-zed-gpui-treeshake -D
34
+ ```
35
+
36
+ ```bash
37
+ yarn add unplugin-zed-gpui-treeshake -D
38
+ ```
39
+
40
+ ## Usage
41
+
42
+ ### Vite
43
+
44
+ ```typescript
45
+ // vite.config.ts
46
+ import { defineConfig } from 'vite';
47
+ import zedGpuiTreeshake from 'unplugin-zed-gpui-treeshake/vite';
48
+
49
+ export default defineConfig({
50
+ plugins: [
51
+ zedGpuiTreeshake({
52
+ // options (optional)
53
+ debug: false, // Enable debug logging
54
+ }),
55
+ ],
56
+ });
57
+ ```
58
+
59
+ ### Webpack
60
+
61
+ ```javascript
62
+ // webpack.config.js
63
+ const zedGpuiTreeshake = require('unplugin-zed-gpui-treeshake/webpack');
64
+
65
+ module.exports = {
66
+ plugins: [
67
+ zedGpuiTreeshake({
68
+ // options (optional)
69
+ debug: false,
70
+ }),
71
+ ],
72
+ };
73
+ ```
74
+
75
+ ### Rollup
76
+
77
+ ```javascript
78
+ // rollup.config.js
79
+ import zedGpuiTreeshake from 'unplugin-zed-gpui-treeshake/rollup';
80
+
81
+ export default {
82
+ plugins: [
83
+ zedGpuiTreeshake({
84
+ // options (optional)
85
+ debug: false,
86
+ }),
87
+ ],
88
+ };
89
+ ```
90
+
91
+ ### esbuild
92
+
93
+ ```javascript
94
+ // esbuild.config.js
95
+ import { build } from 'esbuild';
96
+ import zedGpuiTreeshake from 'unplugin-zed-gpui-treeshake/esbuild';
97
+
98
+ build({
99
+ plugins: [
100
+ zedGpuiTreeshake({
101
+ // options (optional)
102
+ debug: false,
103
+ }),
104
+ ],
105
+ });
106
+ ```
107
+
108
+ ## Options
109
+
110
+ ### `zedGpuiPackageName`
111
+
112
+ - Type: `string`
113
+ - Default: `'zed-gpui'`
114
+
115
+ The name of the zed-gpui package in your dependencies.
116
+
117
+ ### `elementPath`
118
+
119
+ - Type: `string`
120
+ - Default: `'zed-gpui/element'`
121
+
122
+ Path to the element.ts file in the zed-gpui package.
123
+
124
+ ### `debug`
125
+
126
+ - Type: `boolean`
127
+ - Default: `false`
128
+
129
+ Enable debug logging to see which methods are being removed.
130
+
131
+ ## How it works
132
+
133
+ 1. **Analysis Phase**: The plugin scans all your source files to find which zed-gpui methods are actually being used (like `.flex()`, `.w()`, `.h()`, etc.)
134
+
135
+ 2. **Optimization Phase**: When the bundler processes the zed-gpui `element.ts` file, the plugin removes all unused method definitions from `Object.assign(HTMLElement.prototype, {...})`
136
+
137
+ 3. **Result**: Your final bundle only contains the zed-gpui methods that you actually use
138
+
139
+ ## Example
140
+
141
+ If your code only uses these methods:
142
+
143
+ ```typescript
144
+ div()
145
+ .flex()
146
+ .w('100%')
147
+ .h('100px')
148
+ .onClick(() => console.log('clicked'));
149
+ ```
150
+
151
+ The plugin will only keep `flex`, `w`, `h`, and `onClick` methods in the bundle, removing the other 100+ unused methods.
152
+
153
+ ## License
154
+
155
+ MIT
@@ -0,0 +1,6 @@
1
+ //#region src/esbuild.ts
2
+ var esbuild_default = require("./src-CQKToE8V.cjs").zedGpuiPlugin.esbuild;
3
+ //#endregion
4
+ module.exports = esbuild_default;
5
+
6
+ //# sourceMappingURL=esbuild.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.cjs","names":["zedGpuiPlugin"],"sources":["../src/esbuild.ts"],"sourcesContent":["import { zedGpuiPlugin } from './index.js';\n\nexport default zedGpuiPlugin.esbuild;\n"],"mappings":";AAEA,IAAA,8CAAeA,CAAAA,CAAAA,cAAc"}
@@ -0,0 +1,6 @@
1
+ import { PluginOptions } from "./index.cjs";
2
+
3
+ //#region src/esbuild.d.ts
4
+ declare const _default: (options: PluginOptions) => import("unplugin").EsbuildPlugin;
5
+ export = _default;
6
+ //# sourceMappingURL=esbuild.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.d.cts","names":[],"sources":["../src/esbuild.ts"],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { PluginOptions } from "./index.mjs";
2
+
3
+ //#region src/esbuild.d.ts
4
+ declare const _default: (options: PluginOptions) => import("unplugin").EsbuildPlugin;
5
+ //#endregion
6
+ export { _default as default };
7
+ //# sourceMappingURL=esbuild.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.d.mts","names":[],"sources":["../src/esbuild.ts"],"mappings":""}
@@ -0,0 +1,7 @@
1
+ import { t as zedGpuiPlugin } from "./src-Cdq30MRu.mjs";
2
+ //#region src/esbuild.ts
3
+ var esbuild_default = zedGpuiPlugin.esbuild;
4
+ //#endregion
5
+ export { esbuild_default as default };
6
+
7
+ //# sourceMappingURL=esbuild.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"esbuild.mjs","names":[],"sources":["../src/esbuild.ts"],"sourcesContent":["import { zedGpuiPlugin } from './index.js';\n\nexport default zedGpuiPlugin.esbuild;\n"],"mappings":";;AAEA,IAAA,kBAAe,cAAc"}
package/dist/index.cjs ADDED
@@ -0,0 +1,7 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_src = require("./src-CQKToE8V.cjs");
6
+ exports.default = require_src.zedGpuiPlugin;
7
+ exports.zedGpuiPlugin = require_src.zedGpuiPlugin;
@@ -0,0 +1,26 @@
1
+ //#region src/index.d.ts
2
+ interface PluginOptions {
3
+ /**
4
+ * zed-gpui package name or import path
5
+ * @default 'zed-gpui'
6
+ */
7
+ zedGpuiPackageName?: string;
8
+ /**
9
+ * Path to the element.ts file in zed-gpui package
10
+ * @default 'zed-gpui/element'
11
+ */
12
+ elementPath?: string;
13
+ /**
14
+ * Enable debug logging
15
+ * @default false
16
+ */
17
+ debug?: boolean;
18
+ }
19
+ /**
20
+ * Unplugin for zed-gpui tree-shaking optimization
21
+ * Removes unused zed-gpui methods from the bundle
22
+ */
23
+ declare const zedGpuiPlugin: import("unplugin").UnpluginInstance<PluginOptions, boolean>;
24
+ //#endregion
25
+ export { PluginOptions, zedGpuiPlugin as default, zedGpuiPlugin };
26
+ //# sourceMappingURL=index.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.ts"],"mappings":";UAKiB,aAAA;EAAA;;;;EAKf,kBAAA;EAMA;;;AAMK;EANL,WAAA;EAuFA;;;AAhCwB;EAjDxB,KAAA;AAAA;;;;;cAiDW,aAAA,qBAAa,gBAAA,CAAA,aAAA"}
@@ -0,0 +1,26 @@
1
+ //#region src/index.d.ts
2
+ interface PluginOptions {
3
+ /**
4
+ * zed-gpui package name or import path
5
+ * @default 'zed-gpui'
6
+ */
7
+ zedGpuiPackageName?: string;
8
+ /**
9
+ * Path to the element.ts file in zed-gpui package
10
+ * @default 'zed-gpui/element'
11
+ */
12
+ elementPath?: string;
13
+ /**
14
+ * Enable debug logging
15
+ * @default false
16
+ */
17
+ debug?: boolean;
18
+ }
19
+ /**
20
+ * Unplugin for zed-gpui tree-shaking optimization
21
+ * Removes unused zed-gpui methods from the bundle
22
+ */
23
+ declare const zedGpuiPlugin: import("unplugin").UnpluginInstance<PluginOptions, boolean>;
24
+ //#endregion
25
+ export { PluginOptions, zedGpuiPlugin as default, zedGpuiPlugin };
26
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";UAKiB,aAAA;EAAA;;;;EAKf,kBAAA;EAMA;;;AAMK;EANL,WAAA;EAuFA;;;AAhCwB;EAjDxB,KAAA;AAAA;;;;;cAiDW,aAAA,qBAAa,gBAAA,CAAA,aAAA"}
package/dist/index.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { t as zedGpuiPlugin } from "./src-Cdq30MRu.mjs";
2
+ export { zedGpuiPlugin as default, zedGpuiPlugin };
package/dist/noble.cjs ADDED
@@ -0,0 +1,7 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_src = require("./src-CQKToE8V.cjs");
6
+ exports.default = require_src.zedGpuiPlugin;
7
+ exports.zedGpuiTreeshakePlugin = require_src.zedGpuiPlugin;
@@ -0,0 +1,2 @@
1
+ import zedGpuiPlugin, { PluginOptions } from "./index.cjs";
2
+ export { type PluginOptions, zedGpuiPlugin as default, zedGpuiPlugin as zedGpuiTreeshakePlugin };
@@ -0,0 +1,2 @@
1
+ import zedGpuiPlugin, { PluginOptions } from "./index.mjs";
2
+ export { type PluginOptions, zedGpuiPlugin as default, zedGpuiPlugin as zedGpuiTreeshakePlugin };
package/dist/noble.mjs ADDED
@@ -0,0 +1,2 @@
1
+ import { t as zedGpuiPlugin } from "./src-Cdq30MRu.mjs";
2
+ export { zedGpuiPlugin as default, zedGpuiPlugin as zedGpuiTreeshakePlugin };
@@ -0,0 +1,6 @@
1
+ //#region src/rollup.ts
2
+ var rollup_default = require("./src-CQKToE8V.cjs").zedGpuiPlugin.rollup;
3
+ //#endregion
4
+ module.exports = rollup_default;
5
+
6
+ //# sourceMappingURL=rollup.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rollup.cjs","names":["zedGpuiPlugin"],"sources":["../src/rollup.ts"],"sourcesContent":["import { zedGpuiPlugin } from './index.js';\n\nexport default zedGpuiPlugin.rollup;\n"],"mappings":";AAEA,IAAA,6CAAeA,CAAAA,CAAAA,cAAc"}