@tolki/enum 0.0.1 → 0.0.3

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/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Tolki JS Enum Package
2
2
 
3
- This package provides enum utility functions similar to Laravel's Enum class facade.
3
+ This package provides enum utility functions similar to a PHP enum class.
4
4
 
5
5
  ## Documentation
6
6
 
@@ -8,7 +8,7 @@ The full documentation for the enum utilities can be found at [https://tolki.abe
8
8
 
9
9
  <!-- AUTO-GENERATED-DOCS:START -->
10
10
 
11
- # Enum Utilities Installation
11
+ ## Enum Utilities Installation
12
12
 
13
13
  The [`@tolki/enum`](https://www.npmjs.com/package/@tolki/enum) package provides a variety of enum manipulation utilities inspired by PHP's enum utilities like [from](https://www.php.net/manual/en/backedenum.from.php), [tryFrom](https://www.php.net/manual/en/backedenum.tryfrom.php), and [cases](https://www.php.net/manual/en/unitenum.cases.php).
14
14
 
@@ -28,17 +28,17 @@ yarn add @tolki/enum
28
28
  pnpm add @tolki/enum
29
29
  ```
30
30
 
31
- # Tolki Enum Utilities List
31
+ ## Tolki Enum Utilities List
32
32
 
33
- ## Enum Utilities List
33
+ ### Enum Utilities List
34
34
 
35
35
  As mentioned in the [Enum Utilities Installation](./index.md) page, the `@tolki/enum` package is not meant to be used as standalone package as it works with the [Laravel TypeScript Publisher](https://github.com/abetwothree/laravel-ts-publish) package to transform PHP enums into TypeScript enums. The functions below are being listed out for reference, not necessarily for direct use.
36
36
 
37
37
  [cases](#cases) [defineEnum](#defineenum) [from](#from) [tryFrom](#tryfrom)
38
38
 
39
- ## Enum Utilities Details
39
+ ### Enum Utilities Details
40
40
 
41
- ### cases
41
+ #### cases
42
42
 
43
43
  Similar to the PHP [cases](https://www.php.net/manual/en/unitenum.cases.php) method, this function returns an array of all the cases of the given enum.
44
44
 
@@ -49,7 +49,7 @@ import { Status } from "@js/types/enums";
49
49
  const result = cases(Status); // result is an array with an enum instance for each case in the Status enum
50
50
  ```
51
51
 
52
- ### defineEnum
52
+ #### defineEnum
53
53
 
54
54
  This is a factory function that is automatically applied by the Laravel TypeScript Publisher package when it transforms PHP enums into TypeScript enums. It automatically adds the `cases`, `from`, and `tryFrom` methods to the transformed TypeScript enums.
55
55
 
@@ -71,7 +71,7 @@ Status.from("active"); // result is the enum instance for the ACTIVE case
71
71
  Status.tryFrom("non-valid-key"); // result null
72
72
  ```
73
73
 
74
- ### from
74
+ #### from
75
75
 
76
76
  Similar to the PHP [from](https://www.php.net/manual/en/backedenum.from.php) method, this function returns the enum instance for the given value. If the value does not exist in the enum, it throws an error.
77
77
 
@@ -83,7 +83,7 @@ const result = from(Status, "active"); // result is the enum instance for the AC
83
83
  const result2 = from(Status, "non-valid-key"); // throws an error because "non-valid-key" is not a valid value
84
84
  ```
85
85
 
86
- ### tryFrom
86
+ #### tryFrom
87
87
 
88
88
  Similar to the PHP [tryFrom](https://www.php.net/manual/en/backedenum.tryfrom.php) method, this function returns the enum instance for the given value. If the value does not exist in the enum, it returns null instead of throwing an error.
89
89
 
@@ -95,13 +95,28 @@ const result = tryFrom(Status, "active"); // result is the enum instance for the
95
95
  const result2 = tryFrom(Status, "non-valid-key"); // result is null because "non-valid-key" is not a valid value
96
96
  ```
97
97
 
98
- # Tolki Enum Laravel TypeScript Publisher Vite Plugin
98
+ ## Tolki Enum Laravel TypeScript Publisher Vite Plugin
99
99
 
100
100
  The `@tolki/enum` package provides a Vite plugin to automatically watch for changes of the transformed PHP files by the [Laravel TypeScript Publisher](https://github.com/abetwothree/laravel-ts-publish) package.
101
101
 
102
102
  The Laravel TypeScript Publisher package can publish a JSON file list of transformed PHP files. This Vite plugin uses that JSON file list to watch for changes in those PHP files and automatically call the `php artisan ts:publish` command to transform the changed PHP files into TypeScript files.
103
103
 
104
- ## Usage
104
+ ### Command Execution Notes
105
+
106
+ The plugin runs the configured `command` with Node's `child_process.exec()` from the Vite project root.
107
+
108
+ This has two important consequences:
109
+
110
+ 1. The command runs in a non-interactive shell.
111
+ 2. Shell aliases such as `sail` are usually not available.
112
+
113
+ If you are using Laravel Sail and Vite is running on your host machine, prefer `./vendor/bin/sail artisan ts:publish` instead of `sail artisan ts:publish`.
114
+
115
+ If Vite is already running inside the PHP container, use `php artisan ts:publish`.
116
+
117
+ When the publish command rewrites the collected-files manifest, the plugin only reloads the watched file list. It does not run the publish command again for that manifest update, which prevents command loops.
118
+
119
+ ### Usage
105
120
 
106
121
  To use the Vite plugin, you need to add it to your Vite configuration file. Below is an example of how to add the plugin to your Vite configuration file:
107
122
 
@@ -114,17 +129,33 @@ export default defineConfig({
114
129
  });
115
130
  ```
116
131
 
117
- ## Default Functionality
132
+ #### Laravel Sail
133
+
134
+ Choose the command based on where `vite dev` is running:
135
+
136
+ - Vite running on the host machine: `./vendor/bin/sail artisan ts:publish`
137
+ - Vite running inside the container: `php artisan ts:publish`
138
+
139
+ Using just `sail artisan ts:publish` often fails because `sail` is commonly defined as a shell alias and aliases are not resolved by `exec()`.
140
+
141
+ ### Default Functionality
118
142
 
119
143
  By default, the plugin will work in the following way:
120
144
 
121
145
  1. It will call `php artisan ts:publish` as the republish command when a file changes.
122
146
  2. It will look for the list of transformed PHP files here: `resources/js/types/laravel-ts-collected-files.json`.
123
- 3. It will reload the page after you make any update to any of the transformed PHP files.
124
- 4. It will call the publish command on `vite build` before bundling.
125
- 5. It will throw an error if the publish command fails on `vite build`.
147
+ 3. If that manifest file changes, it will reload the watched file list without calling the publish command again.
148
+ 4. It will reload the page after a successful publish triggered by a watched PHP file change.
149
+ 5. It will call the publish command on `vite build` before bundling.
150
+ 6. It will throw an error if the publish command fails on `vite build`.
126
151
 
127
- ## Plugin Options
152
+ #### Manifest Updates
153
+
154
+ The collected-files manifest is treated as configuration input for the watcher, not as a publish trigger.
155
+
156
+ That means when `ts:publish` updates `resources/js/types/laravel-ts-collected-files.json`, the plugin will refresh its internal watched-file list and continue. It will not immediately run `ts:publish` again from that manifest write.
157
+
158
+ ### Plugin Options
128
159
 
129
160
  The plugin accepts an options object to customize its behavior. It is recommended to use `.env` config settings to sync settings between the PHP side and the Vite plugin for the `filename` and `directory` options.
130
161
 
@@ -140,9 +171,14 @@ export default defineConfig({
140
171
  /**
141
172
  * The publish command to run when a watched PHP file changes.
142
173
  *
143
- * If you use Sail and run your Vite dev server inside the Sail container,
144
- * you may need to change this command to `sail php artisan ts:publish`
145
- * or `./vendor/bin/sail php artisan ts:publish` depending on your setup.
174
+ * This command runs through Node's `exec()` from the Vite project root.
175
+ * Shell aliases like `sail` are usually not available here.
176
+ *
177
+ * If Vite runs on the host machine and your app uses Sail, prefer
178
+ * `./vendor/bin/sail artisan ts:publish`.
179
+ *
180
+ * If Vite already runs inside the PHP container, use
181
+ * `php artisan ts:publish`.
146
182
  */
147
183
  command: "php artisan ts:publish",
148
184
  /**
@@ -186,4 +222,34 @@ export default defineConfig({
186
222
  });
187
223
  ```
188
224
 
225
+ #### Example for a Host-Machine Vite Dev Server with Sail
226
+
227
+ ```javascript
228
+ import { defineConfig } from "vite";
229
+ import { laravelTsPublish } from "@tolki/enum/vite";
230
+
231
+ export default defineConfig({
232
+ plugins: [
233
+ laravelTsPublish({
234
+ command: "./vendor/bin/sail artisan ts:publish",
235
+ }),
236
+ ],
237
+ });
238
+ ```
239
+
240
+ #### Example for Vite Running Inside the Container
241
+
242
+ ```javascript
243
+ import { defineConfig } from "vite";
244
+ import { laravelTsPublish } from "@tolki/enum/vite";
245
+
246
+ export default defineConfig({
247
+ plugins: [
248
+ laravelTsPublish({
249
+ command: "php artisan ts:publish",
250
+ }),
251
+ ],
252
+ });
253
+ ```
254
+
189
255
  <!-- AUTO-GENERATED-DOCS:END -->
package/dist/enums.d.ts CHANGED
@@ -9,6 +9,7 @@ import { CaseValue, DefineEnumResult, EnumConst, ToEnumResult } from '../../type
9
9
  * The enumObj is the published enum from the Laravel TypeScript Publish package.
10
10
  *
11
11
  * @see https://github.com/abetwothree/laravel-ts-publish#enum-metadata--tolki-enum-package
12
+ * @see https://tolki.abe.dev/enums/enum-utilities-list.html#from
12
13
  *
13
14
  * @param enumObj - The enum const object to resolve from.
14
15
  * @param value - The case value to resolve. Must be one of the values defined in the enum const's cases.
@@ -21,6 +22,8 @@ export declare function from<TEnum extends EnumConst, const TValue extends CaseV
21
22
  *
22
23
  * Mirrors PHP's `BackedEnum::tryFrom()`.
23
24
  *
25
+ * @see https://tolki.abe.dev/enums/enum-utilities-list.html#tryfrom
26
+ *
24
27
  * @param enumObj - The enum const object to resolve from.
25
28
  * @param value - The case value to resolve.
26
29
  * @returns The resolved enum case, or null if the value does not match any case.
@@ -31,6 +34,8 @@ export declare function tryFrom<TEnum extends EnumConst, const TValue extends Ca
31
34
  *
32
35
  * Mirrors PHP's `BackedEnum::cases()`, returning one resolved instance per case defined in the enum const.
33
36
  *
37
+ * @see https://tolki.abe.dev/enums/enum-utilities-list.html#cases
38
+ *
34
39
  * @param enumObj - The enum const object to resolve all cases from.
35
40
  * @returns An array of resolved enum instances, one for each case.
36
41
  */
@@ -44,6 +49,8 @@ export declare function cases<TEnum extends EnumConst>(enumObj: TEnum): Array<To
44
49
  *
45
50
  * The original enum data is preserved and the PHP like enum methods are attached directly to the returned object.
46
51
  *
52
+ * @see https://tolki.abe.dev/enums/enum-utilities-list.html#defineenum
53
+ *
47
54
  * @param enumObj - The raw enum const object to enrich.
48
55
  * @returns The enum object with `from`, `tryFrom`, and `cases` methods bound to it.
49
56
  */
@@ -1 +1 @@
1
- {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,YAAY,EACf,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAChB,KAAK,SAAS,SAAS,EACvB,KAAK,CAAC,MAAM,SAAS,SAAS,CAAC,KAAK,CAAC,EACvC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CA2C5D;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CACnB,KAAK,SAAS,SAAS,EACvB,KAAK,CAAC,MAAM,SAAS,SAAS,CAAC,KAAK,CAAC,EACvC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAMnE;AAED;;;;;;;GAOG;AACH,wBAAgB,KAAK,CAAC,KAAK,SAAS,SAAS,EACzC,OAAO,EAAE,KAAK,GACf,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAI9C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,KAAK,SAAS,SAAS,EACpD,OAAO,EAAE,KAAK,GACf,gBAAgB,CAAC,KAAK,CAAC,CA2BzB"}
1
+ {"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,YAAY,EACf,MAAM,cAAc,CAAC;AAEtB;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,IAAI,CAChB,KAAK,SAAS,SAAS,EACvB,KAAK,CAAC,MAAM,SAAS,SAAS,CAAC,KAAK,CAAC,EACvC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,CA4C5D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,OAAO,CACnB,KAAK,SAAS,SAAS,EACvB,KAAK,CAAC,MAAM,SAAS,SAAS,CAAC,KAAK,CAAC,EACvC,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAMnE;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,KAAK,SAAS,SAAS,EACzC,OAAO,EAAE,KAAK,GACf,KAAK,CAAC,YAAY,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAI9C;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,UAAU,CAAC,KAAK,CAAC,KAAK,SAAS,SAAS,EACpD,OAAO,EAAE,KAAK,GACf,gBAAgB,CAAC,KAAK,CAAC,CA2BzB"}
package/dist/enums.js CHANGED
@@ -1,4 +1,4 @@
1
- function c(e, t) {
1
+ function a(e, t) {
2
2
  const n = new Set(e._cases);
3
3
  let r;
4
4
  for (const s of n)
@@ -6,39 +6,41 @@ function c(e, t) {
6
6
  r = s;
7
7
  break;
8
8
  }
9
- if (!r)
9
+ if (!r) {
10
+ const s = Array.from(n).map((o) => e[o]);
10
11
  throw new Error(
11
- `Value "${String(t)}" does not match any case in the enum. Cases: ${[...n].join(", ")}`
12
+ `Value "${String(t)}" does not match any case in the enum. Values: ${s.join(", ")}, Cases: ${[...n].join(", ")}`
12
13
  );
13
- const o = { value: t }, h = new Set(e._methods), a = e._helpers, f = new Set(
14
- Array.isArray(a) ? a : []
14
+ }
15
+ const c = { value: t }, h = new Set(e._methods), i = e._helpers, f = new Set(
16
+ Array.isArray(i) ? i : []
15
17
  ), l = /* @__PURE__ */ new Set([
16
18
  "_cases",
17
19
  "_methods",
18
20
  "_helpers",
19
21
  "_static"
20
22
  ]);
21
- for (const [s, i] of Object.entries(e))
22
- l.has(s) || n.has(s) || f.has(s) || (h.has(s) ? o[s] = i[r] : o[s] = i);
23
- return o;
23
+ for (const [s, o] of Object.entries(e))
24
+ l.has(s) || n.has(s) || f.has(s) || (h.has(s) ? c[s] = o[r] : c[s] = o);
25
+ return c;
24
26
  }
25
27
  function y(e, t) {
26
28
  try {
27
- return c(e, t);
29
+ return a(e, t);
28
30
  } catch {
29
31
  return null;
30
32
  }
31
33
  }
32
- function _(e) {
34
+ function p(e) {
33
35
  return e._cases.map(
34
- (t) => c(e, e[t])
36
+ (t) => a(e, e[t])
35
37
  );
36
38
  }
37
- function p(e) {
39
+ function u(e) {
38
40
  const t = {
39
- from: (r) => c(e, r),
41
+ from: (r) => a(e, r),
40
42
  tryFrom: (r) => y(e, r),
41
- cases: () => _(e)
43
+ cases: () => p(e)
42
44
  }, n = Object.keys(t);
43
45
  return Object.assign(
44
46
  /* @__PURE__ */ Object.create(null),
@@ -50,8 +52,8 @@ function p(e) {
50
52
  );
51
53
  }
52
54
  export {
53
- _ as cases,
54
- p as defineEnum,
55
- c as from,
55
+ p as cases,
56
+ u as defineEnum,
57
+ a as from,
56
58
  y as tryFrom
57
59
  };
@@ -3,6 +3,14 @@ export interface LaravelTsPublishOptions {
3
3
  /**
4
4
  * The command to run when a watched PHP file changes.
5
5
  *
6
+ * The command is executed with Node's `exec()` using the Vite project root
7
+ * as the current working directory. Because it runs in a non-interactive
8
+ * shell, shell aliases such as `sail` are usually not available.
9
+ *
10
+ * Common setups:
11
+ * - Run Vite on the host machine with Laravel Sail: `./vendor/bin/sail artisan ts:publish`
12
+ * - Run Vite inside the container: `php artisan ts:publish`
13
+ *
6
14
  * @default "php artisan ts:publish"
7
15
  */
8
16
  command?: string;
@@ -63,7 +71,12 @@ export interface LaravelTsPublishOptions {
63
71
  * PHP files to the dev-server file watcher, and re-runs the command when any
64
72
  * of them change via HMR. Optionally runs the command once at startup when
65
73
  * `runOnDevStart` is `true`. Sends a full browser reload after every
66
- * successful run (disable with `reload: false`).
74
+ * successful run (disable with `reload: false`). Manifest updates only
75
+ * refresh the watched-file list and do not trigger the command again.
76
+ * - **Command execution**: the configured command runs through Node's
77
+ * `child_process.exec()` from the Vite project root. Shell aliases are not
78
+ * resolved, so use a real executable path such as `./vendor/bin/sail` when
79
+ * running Vite on the host with Laravel Sail.
67
80
  *
68
81
  * @param options - Configuration options for the plugin.
69
82
  * @returns A Vite plugin object.
@@ -85,7 +98,14 @@ export interface LaravelTsPublishOptions {
85
98
  * ```ts
86
99
  * // With Laravel Sail
87
100
  * laravelTsPublish({
88
- * command: "sail artisan ts:publish",
101
+ * command: "./vendor/bin/sail artisan ts:publish",
102
+ * });
103
+ * ```
104
+ * @example
105
+ * ```ts
106
+ * // When Vite is already running inside the PHP container
107
+ * laravelTsPublish({
108
+ * command: "php artisan ts:publish",
89
109
  * });
90
110
  * ```
91
111
  *
@@ -1 +1 @@
1
- {"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,KAAK,MAAM,EAGd,MAAM,MAAM,CAAC;AAId,MAAM,WAAW,uBAAuB;IACpC;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,GAAE,uBAA4B,GACtC,MAAM,CA8LR"}
1
+ {"version":3,"file":"vite-plugin.d.ts","sourceRoot":"","sources":["../src/vite-plugin.ts"],"names":[],"mappings":"AAKA,OAAO,EAEH,KAAK,MAAM,EAGd,MAAM,MAAM,CAAC;AAId,MAAM,WAAW,uBAAuB;IACpC;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;OAMG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,gBAAgB,CAC5B,OAAO,GAAE,uBAA4B,GACtC,MAAM,CA6LR"}
@@ -16,56 +16,56 @@ function C(h = {}) {
16
16
  } = h;
17
17
  let r, i;
18
18
  const t = /* @__PURE__ */ new Set();
19
- let s = "", l = !1, f = !1;
20
- const a = "[laravel-ts-publish]", m = async () => {
19
+ let n = "", l = !1, f = !1;
20
+ const o = "[laravel-ts-publish]", m = async () => {
21
21
  t.clear();
22
22
  try {
23
- const e = await z(s, "utf-8"), o = JSON.parse(e);
24
- for (const S of o) {
23
+ const e = await z(n, "utf-8"), a = JSON.parse(e);
24
+ for (const S of a) {
25
25
  const F = c(p.resolve(r.root, S));
26
26
  t.add(F);
27
27
  }
28
28
  } catch (e) {
29
29
  if (e instanceof Error && e.code === "ENOENT") {
30
30
  r.logger.warn(
31
- `${a} Manifest not found: ${s}`
31
+ `${o} Manifest not found: ${n}`
32
32
  );
33
33
  return;
34
34
  }
35
35
  r.logger.error(
36
- `${a} Failed to read manifest: ${e instanceof Error ? e.message : String(e)}`
36
+ `${o} Failed to read manifest: ${e instanceof Error ? e.message : String(e)}`
37
37
  );
38
38
  }
39
39
  }, g = () => {
40
40
  if (i)
41
41
  for (const e of t)
42
42
  i.watcher.add(e);
43
- }, E = () => d !== void 0 ? d : r.command === "build", n = async () => {
43
+ }, E = () => d !== void 0 ? d : r.command === "build", s = async () => {
44
44
  if (l) {
45
45
  f = !0;
46
46
  return;
47
47
  }
48
48
  l = !0;
49
49
  try {
50
- r.logger.info(`${a} Running: ${u}`, {
50
+ r.logger.info(`${o} Running: ${u}`, {
51
51
  timestamp: !0
52
- }), await T(u, { cwd: r.root }), r.logger.info(`${a} Types published successfully`, {
52
+ }), await T(u, { cwd: r.root }), r.logger.info(`${o} Types published successfully`, {
53
53
  timestamp: !0
54
54
  }), b && i && i.ws.send({ type: "full-reload" });
55
55
  } catch (e) {
56
- const o = `${a} Command failed: ${e instanceof Error ? e.message : String(e)}`;
56
+ const a = `${o} Command failed: ${e instanceof Error ? e.message : String(e)}`;
57
57
  if (E())
58
- throw new Error(o, { cause: e });
59
- r.logger.error(o);
58
+ throw new Error(a, { cause: e });
59
+ r.logger.error(a);
60
60
  } finally {
61
- l = !1, f && (f = !1, await n());
61
+ l = !1, f && (f = !1, await s());
62
62
  }
63
63
  };
64
64
  return {
65
65
  name: "@tolki/vite-plugin-laravel-ts-publish",
66
66
  enforce: "pre",
67
67
  configResolved(e) {
68
- r = e, s = c(
68
+ r = e, n = c(
69
69
  p.resolve(r.root, y, w)
70
70
  );
71
71
  },
@@ -74,23 +74,23 @@ function C(h = {}) {
74
74
  },
75
75
  async buildStart() {
76
76
  if (r.command === "build") {
77
- $ && await n();
77
+ $ && await s();
78
78
  return;
79
79
  }
80
80
  await m(), g(), t.size > 0 && r.logger.info(
81
- `${a} Watching ${t.size} PHP file${t.size === 1 ? "" : "s"} for changes`,
81
+ `${o} Watching ${t.size} PHP file${t.size === 1 ? "" : "s"} for changes`,
82
82
  { timestamp: !0 }
83
- ), v && await n();
83
+ ), v && await s();
84
84
  },
85
85
  async handleHotUpdate({ file: e }) {
86
- const o = c(e);
87
- if (o === s)
86
+ const a = c(e);
87
+ if (a === n)
88
88
  return r.logger.info(
89
- `${a} Manifest changed, reloading watched files`,
89
+ `${o} Manifest changed, reloading watched files`,
90
90
  { timestamp: !0 }
91
- ), await m(), g(), await n(), [];
92
- if (t.has(o))
93
- return await n(), [];
91
+ ), await m(), g(), [];
92
+ if (t.has(a))
93
+ return await s(), [];
94
94
  }
95
95
  };
96
96
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolki/enum",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "A set of enum utilities for the @tolki packages.",
5
5
  "author": "Abraham Arango <https://github.com/abetwothree>",
6
6
  "license": "MIT",
@@ -23,7 +23,7 @@
23
23
  "utilities"
24
24
  ],
25
25
  "dependencies": {
26
- "@tolki/types": "^1.1.0"
26
+ "@tolki/types": "^1.1.1"
27
27
  },
28
28
  "peerDependencies": {
29
29
  "vite": "^7.0.0"
@@ -39,12 +39,14 @@
39
39
  "require": "./dist/index.js"
40
40
  },
41
41
  "./enums": {
42
- "types": "./dist/enums/index.d.ts",
43
- "import": "./dist/enums/index.js"
42
+ "types": "./dist/enums.d.ts",
43
+ "import": "./dist/enums.js",
44
+ "default": "./dist/enums.js"
44
45
  },
45
46
  "./vite": {
46
- "types": "./dist/vite-plugin/index.d.ts",
47
- "import": "./dist/vite-plugin/index.js"
47
+ "types": "./dist/vite-plugin.d.ts",
48
+ "import": "./dist/vite-plugin.js",
49
+ "default": "./dist/vite-plugin.js"
48
50
  }
49
51
  },
50
52
  "tolki": {