@devwizard/vite-plugin-enumify 0.1.3 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +37 -18
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # @devwizard/vite-plugin-enumify
2
2
 
3
- [![NPM](https://img.shields.io/npm/v/@devwizard/vite-plugin-enumify.svg?style=flat-square)](https://www.npmjs.com/package/@devwizard/vite-plugin-enumify)
3
+ [![NPM Version](https://img.shields.io/npm/v/@devwizard/vite-plugin-enumify.svg?style=flat-square)](https://www.npmjs.com/package/@devwizard/vite-plugin-enumify)
4
+ [![NPM Downloads](https://img.shields.io/npm/dt/@devwizard/vite-plugin-enumify.svg?style=flat-square)](https://www.npmjs.com/package/@devwizard/vite-plugin-enumify)
5
+ [![Latest Version on Packagist](https://img.shields.io/packagist/v/devwizardhq/laravel-enumify.svg?style=flat-square)](https://packagist.org/packages/devwizardhq/laravel-enumify)
6
+ [![Packagist Downloads](https://img.shields.io/packagist/dt/devwizardhq/laravel-enumify.svg?style=flat-square)](https://packagist.org/packages/devwizardhq/laravel-enumify)
4
7
  [![GitHub](https://img.shields.io/badge/repo-devwizardhq%2Flaravel--enumify-181717?style=flat-square&logo=github)](https://github.com/devwizardhq/laravel-enumify)
5
8
 
6
9
  Vite plugin for [Laravel Enumify](https://github.com/devwizardhq/laravel-enumify) — automatically sync PHP enums to TypeScript during development and builds.
@@ -121,24 +124,40 @@ The plugin generates:
121
124
 
122
125
  ```ts
123
126
  // resources/js/enums/order-status.ts
124
- export enum OrderStatus {
125
- Pending = "pending",
126
- Processing = "processing",
127
- Shipped = "shipped",
128
- }
129
-
130
- export type OrderStatusValue = `${OrderStatus}`;
131
-
132
- export const OrderStatusLabels: Record<OrderStatus, string> = {
133
- [OrderStatus.Pending]: "Pending",
134
- [OrderStatus.Processing]: "Processing",
135
- [OrderStatus.Shipped]: "Shipped",
136
- };
127
+ export const OrderStatus = {
128
+ PENDING: "pending",
129
+ PROCESSING: "processing",
130
+ SHIPPED: "shipped",
131
+ } as const;
132
+
133
+ export type OrderStatus = (typeof OrderStatus)[keyof typeof OrderStatus];
134
+
135
+ export const OrderStatusUtils = {
136
+ label(status: OrderStatus): string {
137
+ switch (status) {
138
+ case OrderStatus.PENDING:
139
+ return "Pending";
140
+ case OrderStatus.PROCESSING:
141
+ return "Processing";
142
+ case OrderStatus.SHIPPED:
143
+ return "Shipped";
144
+ }
145
+ },
146
+
147
+ color(status: OrderStatus): string {
148
+ switch (status) {
149
+ case OrderStatus.PENDING:
150
+ return "yellow";
151
+ case OrderStatus.PROCESSING:
152
+ return "blue";
153
+ case OrderStatus.SHIPPED:
154
+ return "green";
155
+ }
156
+ },
137
157
 
138
- export const OrderStatusColors: Record<OrderStatus, string> = {
139
- [OrderStatus.Pending]: "yellow",
140
- [OrderStatus.Processing]: "blue",
141
- [OrderStatus.Shipped]: "green",
158
+ options(): OrderStatus[] {
159
+ return Object.values(OrderStatus);
160
+ },
142
161
  };
143
162
  ```
144
163
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devwizard/vite-plugin-enumify",
3
- "version": "0.1.3",
3
+ "version": "1.0.0",
4
4
  "description": "Vite plugin for Laravel Enumify - auto-sync PHP enums to TypeScript",
5
5
  "keywords": [
6
6
  "vite",
@@ -52,15 +52,15 @@
52
52
  "README.md"
53
53
  ],
54
54
  "peerDependencies": {
55
- "vite": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0"
55
+ "vite": "^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "@types/node": "^25.0.8",
59
59
  "prettier": "^3.5.0",
60
60
  "rollup": "^4.40.0",
61
- "typescript": "^5.7.0",
61
+ "typescript": "^6.0.2",
62
62
  "unbuild": "^3.5.0",
63
- "vite": "^7.3.1",
63
+ "vite": "^8.0.8",
64
64
  "vitest": "^4.0.17"
65
65
  },
66
66
  "engines": {