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.
- package/LICENSE +21 -0
- package/README.md +155 -0
- package/dist/esbuild.cjs +6 -0
- package/dist/esbuild.cjs.map +1 -0
- package/dist/esbuild.d.cts +6 -0
- package/dist/esbuild.d.cts.map +1 -0
- package/dist/esbuild.d.mts +7 -0
- package/dist/esbuild.d.mts.map +1 -0
- package/dist/esbuild.mjs +7 -0
- package/dist/esbuild.mjs.map +1 -0
- package/dist/index.cjs +7 -0
- package/dist/index.d.cts +26 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +26 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -0
- package/dist/noble.cjs +7 -0
- package/dist/noble.d.cts +2 -0
- package/dist/noble.d.mts +2 -0
- package/dist/noble.mjs +2 -0
- package/dist/rollup.cjs +6 -0
- package/dist/rollup.cjs.map +1 -0
- package/dist/rollup.d.cts +1350 -0
- package/dist/rollup.d.cts.map +1 -0
- package/dist/rollup.d.mts +1351 -0
- package/dist/rollup.d.mts.map +1 -0
- package/dist/rollup.mjs +7 -0
- package/dist/rollup.mjs.map +1 -0
- package/dist/rspack.cjs +6 -0
- package/dist/rspack.cjs.map +1 -0
- package/dist/rspack.d.cts +6 -0
- package/dist/rspack.d.cts.map +1 -0
- package/dist/rspack.d.mts +7 -0
- package/dist/rspack.d.mts.map +1 -0
- package/dist/rspack.mjs +7 -0
- package/dist/rspack.mjs.map +1 -0
- package/dist/src-CQKToE8V.cjs +30417 -0
- package/dist/src-CQKToE8V.cjs.map +1 -0
- package/dist/src-Cdq30MRu.mjs +30412 -0
- package/dist/src-Cdq30MRu.mjs.map +1 -0
- package/dist/vite.cjs +6 -0
- package/dist/vite.cjs.map +1 -0
- package/dist/vite.d.cts +6 -0
- package/dist/vite.d.cts.map +1 -0
- package/dist/vite.d.mts +7 -0
- package/dist/vite.d.mts.map +1 -0
- package/dist/vite.mjs +7 -0
- package/dist/vite.mjs.map +1 -0
- package/dist/webpack.cjs +6 -0
- package/dist/webpack.cjs.map +1 -0
- package/dist/webpack.d.cts +6 -0
- package/dist/webpack.d.cts.map +1 -0
- package/dist/webpack.d.mts +7 -0
- package/dist/webpack.d.mts.map +1 -0
- package/dist/webpack.mjs +7 -0
- package/dist/webpack.mjs.map +1 -0
- 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
|
+
[](https://www.npmjs.org/package/unplugin-zed-gpui-treeshake)
|
|
5
|
+
[](https://www.npmjs.org/package/unplugin-zed-gpui-treeshake)
|
|
6
|
+
[](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
|
package/dist/esbuild.cjs
ADDED
|
@@ -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 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.d.cts","names":[],"sources":["../src/esbuild.ts"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"esbuild.d.mts","names":[],"sources":["../src/esbuild.ts"],"mappings":""}
|
package/dist/esbuild.mjs
ADDED
|
@@ -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;
|
package/dist/index.d.cts
ADDED
|
@@ -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"}
|
package/dist/index.d.mts
ADDED
|
@@ -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
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;
|
package/dist/noble.d.cts
ADDED
package/dist/noble.d.mts
ADDED
package/dist/noble.mjs
ADDED
package/dist/rollup.cjs
ADDED
|
@@ -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"}
|