@tolki/enum 1.1.4 → 1.2.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/README.md +1 -1
- package/dist/enums.d.ts +28 -6
- package/dist/enums.d.ts.map +1 -1
- package/dist/enums.js +42 -56
- package/dist/index.js +3 -9
- package/dist/php-enums.d.ts +1 -1
- package/dist/php-enums.js +7 -8
- package/dist/vite-plugin.js +73 -115
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This package provides enum utility functions similar to a PHP enum class.
|
|
|
6
6
|
|
|
7
7
|
## Documentation
|
|
8
8
|
|
|
9
|
-
The full documentation for the enum utilities can be found at [https://tolki.abe.dev](https://tolki.abe.dev/enums
|
|
9
|
+
The full documentation for the enum utilities can be found at [https://tolki.abe.dev/ts/enums.html](https://tolki.abe.dev/ts/enums.html).
|
|
10
10
|
|
|
11
11
|
<!-- AUTO-GENERATED-DOCS:START -->
|
|
12
12
|
|
package/dist/enums.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AsEnum, CaseValue, DefineEnumResult, EnumConst, FromResult } from '@tolki/types';
|
|
1
|
+
import { AsEnum, CaseKeys, CaseValue, DefineEnumResult, EnumConst, FromResult } from '@tolki/types';
|
|
2
2
|
export type { AsEnum, CaseValue, DefineEnumResult, EnumConst, FromResult };
|
|
3
3
|
/**
|
|
4
4
|
* Creates an enum instance from a case value similar to PHP's `BackedEnum::from()`
|
|
@@ -9,8 +9,8 @@ export type { AsEnum, CaseValue, DefineEnumResult, EnumConst, FromResult };
|
|
|
9
9
|
*
|
|
10
10
|
* The enumObj is the published enum from the Laravel TypeScript Publish package.
|
|
11
11
|
*
|
|
12
|
-
* @see https://
|
|
13
|
-
* @see https://tolki.abe.dev/enums
|
|
12
|
+
* @see https://tolki.abe.dev/ts/enums.html#metadata-the-defineenum-wrapper
|
|
13
|
+
* @see https://tolki.abe.dev/ts/enums.html#from
|
|
14
14
|
*
|
|
15
15
|
* @param enumObj - The enum const object to resolve from.
|
|
16
16
|
* @param value - The case value to resolve. Must be one of the values defined in the enum const's cases.
|
|
@@ -23,7 +23,7 @@ export declare function from<TEnum extends EnumConst, const TValue extends CaseV
|
|
|
23
23
|
*
|
|
24
24
|
* Mirrors PHP's `BackedEnum::tryFrom()`.
|
|
25
25
|
*
|
|
26
|
-
* @see https://tolki.abe.dev/enums
|
|
26
|
+
* @see https://tolki.abe.dev/ts/enums.html#tryfrom
|
|
27
27
|
*
|
|
28
28
|
* @param enumObj - The enum const object to resolve from.
|
|
29
29
|
* @param value - The case value to resolve.
|
|
@@ -35,12 +35,34 @@ export declare function tryFrom<TEnum extends EnumConst, const TValue extends Ca
|
|
|
35
35
|
*
|
|
36
36
|
* Mirrors PHP's `BackedEnum::cases()`, returning one resolved instance per case defined in the enum const.
|
|
37
37
|
*
|
|
38
|
-
* @see https://tolki.abe.dev/enums
|
|
38
|
+
* @see https://tolki.abe.dev/ts/enums.html#cases
|
|
39
39
|
*
|
|
40
40
|
* @param enumObj - The enum const object to resolve all cases from.
|
|
41
41
|
* @returns An array of resolved enum instances, one for each case.
|
|
42
42
|
*/
|
|
43
43
|
export declare function cases<TEnum extends EnumConst>(enumObj: TEnum): Array<FromResult<TEnum, CaseValue<TEnum>>>;
|
|
44
|
+
/**
|
|
45
|
+
* Returns the backing values of all enum cases, in case order.
|
|
46
|
+
*
|
|
47
|
+
* Mirrors PHP's `array_column(Enum::cases(), 'value')`. A unit enum's values are its case names.
|
|
48
|
+
*
|
|
49
|
+
* @see https://tolki.abe.dev/ts/enums.html#values
|
|
50
|
+
*
|
|
51
|
+
* @param enumObj - The enum const object to read the case values from.
|
|
52
|
+
* @returns A new array with one value per case, or an empty array when the enum has no `_cases`.
|
|
53
|
+
*/
|
|
54
|
+
export declare function values<TEnum extends EnumConst>(enumObj: TEnum): ReadonlyArray<CaseValue<TEnum>>;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the names of all enum cases, in case order.
|
|
57
|
+
*
|
|
58
|
+
* Mirrors PHP's `array_column(Enum::cases(), 'name')`.
|
|
59
|
+
*
|
|
60
|
+
* @see https://tolki.abe.dev/ts/enums.html#keys
|
|
61
|
+
*
|
|
62
|
+
* @param enumObj - The enum const object to read the case names from.
|
|
63
|
+
* @returns A new array with one name per case, or an empty array when the enum has no `_cases`.
|
|
64
|
+
*/
|
|
65
|
+
export declare function keys<TEnum extends EnumConst>(enumObj: TEnum): ReadonlyArray<CaseKeys<TEnum>>;
|
|
44
66
|
/**
|
|
45
67
|
* Factory function that creates an enriched enum object
|
|
46
68
|
*
|
|
@@ -50,7 +72,7 @@ export declare function cases<TEnum extends EnumConst>(enumObj: TEnum): Array<Fr
|
|
|
50
72
|
*
|
|
51
73
|
* The original enum data is preserved and the PHP like enum methods are attached directly to the returned object.
|
|
52
74
|
*
|
|
53
|
-
* @see https://tolki.abe.dev/enums
|
|
75
|
+
* @see https://tolki.abe.dev/ts/enums.html#defineenum
|
|
54
76
|
*
|
|
55
77
|
* @param enumObj - The raw enum const object to enrich.
|
|
56
78
|
* @returns The enum object with `from`, `tryFrom`, and `cases` methods bound to it.
|
package/dist/enums.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"enums.d.ts","sourceRoot":"","sources":["../src/enums.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,MAAM,EACN,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,UAAU,EACb,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAE3E;;;;;;;;;;;;;;;;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,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CA8C1D;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,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAMjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,KAAK,SAAS,SAAS,EACzC,OAAO,EAAE,KAAK,GACf,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAI5C;AAED;;;;;;;;;;;;;GAaG;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,MAAM,EACN,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,UAAU,EACb,MAAM,cAAc,CAAC;AAGtB,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,gBAAgB,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;AAE3E;;;;;;;;;;;;;;;;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,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CA8C1D;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,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,GAAG,IAAI,CAMjE;AAED;;;;;;;;;GASG;AACH,wBAAgB,KAAK,CAAC,KAAK,SAAS,SAAS,EACzC,OAAO,EAAE,KAAK,GACf,KAAK,CAAC,UAAU,CAAC,KAAK,EAAE,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,CAI5C;AAED;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,KAAK,SAAS,SAAS,EAC1C,OAAO,EAAE,KAAK,GACf,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,CAIjC;AAED;;;;;;;;;GASG;AACH,wBAAgB,IAAI,CAAC,KAAK,SAAS,SAAS,EACxC,OAAO,EAAE,KAAK,GACf,aAAa,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAEhC;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,60 +1,46 @@
|
|
|
1
|
-
import { isArray as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
"_helpers",
|
|
22
|
-
"_static"
|
|
23
|
-
]);
|
|
24
|
-
for (const [t, c] of Object.entries(e))
|
|
25
|
-
l.has(t) || n.has(t) || h.has(t) || (f.has(t) ? o[t] = c[r] : o[t] = c);
|
|
26
|
-
return o.name = r, o;
|
|
1
|
+
import { isArray as e } from "@tolki/utils";
|
|
2
|
+
// src/enums.ts
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
let r = new Set(t._cases ?? []), i;
|
|
5
|
+
for (let e of r) if (t[e] === n) {
|
|
6
|
+
i = e;
|
|
7
|
+
break;
|
|
8
|
+
}
|
|
9
|
+
if (!i) {
|
|
10
|
+
let e = Array.from(r).map((e) => t[e]);
|
|
11
|
+
throw Error(`Value "${String(n)}" does not match any case in the enum. Values: ${e.join(", ")}, Cases: ${[...r].join(", ")}`);
|
|
12
|
+
}
|
|
13
|
+
let a = { value: n }, o = new Set(t._methods ?? []), s = t._helpers, c = new Set(e(s) ? s : []), l = /* @__PURE__ */ new Set([
|
|
14
|
+
"_cases",
|
|
15
|
+
"_methods",
|
|
16
|
+
"_helpers",
|
|
17
|
+
"_static"
|
|
18
|
+
]);
|
|
19
|
+
for (let [e, n] of Object.entries(t)) l.has(e) || r.has(e) || c.has(e) || (a[e] = o.has(e) ? n[i] : n);
|
|
20
|
+
return a.name = i, a;
|
|
27
21
|
}
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
function n(e, n) {
|
|
23
|
+
try {
|
|
24
|
+
return t(e, n);
|
|
25
|
+
} catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
34
28
|
}
|
|
35
|
-
function
|
|
36
|
-
|
|
37
|
-
(s) => a(e, e[s])
|
|
38
|
-
);
|
|
29
|
+
function r(e) {
|
|
30
|
+
return (e._cases ?? []).map((n) => t(e, e[n]));
|
|
39
31
|
}
|
|
40
|
-
function
|
|
41
|
-
|
|
42
|
-
from: (r) => a(e, r),
|
|
43
|
-
tryFrom: (r) => p(e, r),
|
|
44
|
-
cases: () => u(e)
|
|
45
|
-
}, n = Object.keys(s);
|
|
46
|
-
return Object.assign(
|
|
47
|
-
/* @__PURE__ */ Object.create(null),
|
|
48
|
-
e,
|
|
49
|
-
s,
|
|
50
|
-
{
|
|
51
|
-
_helpers: n
|
|
52
|
-
}
|
|
53
|
-
);
|
|
32
|
+
function i(e) {
|
|
33
|
+
return (e._cases ?? []).map((t) => e[t]);
|
|
54
34
|
}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
35
|
+
function a(e) {
|
|
36
|
+
return [...e._cases ?? []];
|
|
37
|
+
}
|
|
38
|
+
function o(e) {
|
|
39
|
+
let i = {
|
|
40
|
+
from: (n) => t(e, n),
|
|
41
|
+
tryFrom: (t) => n(e, t),
|
|
42
|
+
cases: () => r(e)
|
|
43
|
+
}, a = Object.keys(i);
|
|
44
|
+
return Object.assign(Object.create(null), e, i, { _helpers: a });
|
|
45
|
+
}
|
|
46
|
+
export { r as cases, o as defineEnum, t as from, a as keys, n as tryFrom, i as values };
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import { cases as e, defineEnum as
|
|
2
|
-
import { SortDirection as
|
|
3
|
-
export {
|
|
4
|
-
n as SortDirection,
|
|
5
|
-
e as cases,
|
|
6
|
-
m as defineEnum,
|
|
7
|
-
t as from,
|
|
8
|
-
f as tryFrom
|
|
9
|
-
};
|
|
1
|
+
import { cases as e, defineEnum as t, from as n, keys as r, tryFrom as i, values as a } from "./enums.js";
|
|
2
|
+
import { SortDirection as o } from "./php-enums.js";
|
|
3
|
+
export { o as SortDirection, e as cases, t as defineEnum, n as from, r as keys, i as tryFrom, a as values };
|
package/dist/php-enums.d.ts
CHANGED
package/dist/php-enums.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { defineEnum as e } from "./enums.js";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
2
|
+
// src/php-enums.ts
|
|
3
|
+
var t = e({
|
|
4
|
+
Ascending: "Ascending",
|
|
5
|
+
Descending: "Descending",
|
|
6
|
+
backed: !1,
|
|
7
|
+
_cases: ["Ascending", "Descending"]
|
|
7
8
|
});
|
|
8
|
-
export {
|
|
9
|
-
c as SortDirection
|
|
10
|
-
};
|
|
9
|
+
export { t as SortDirection };
|
package/dist/vite-plugin.js
CHANGED
|
@@ -1,116 +1,74 @@
|
|
|
1
|
-
import { exec as
|
|
2
|
-
import { readFile as
|
|
3
|
-
import
|
|
4
|
-
import { promisify as
|
|
5
|
-
import { normalizePath as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
return {
|
|
77
|
-
name: "@tolki/vite-plugin-laravel-ts-publish",
|
|
78
|
-
enforce: "pre",
|
|
79
|
-
configResolved(e) {
|
|
80
|
-
t = e, u = g(
|
|
81
|
-
S.resolve(t.root, P, z)
|
|
82
|
-
);
|
|
83
|
-
},
|
|
84
|
-
configureServer(e) {
|
|
85
|
-
l = e;
|
|
86
|
-
},
|
|
87
|
-
async buildStart() {
|
|
88
|
-
if (t.command === "build") {
|
|
89
|
-
if (x) {
|
|
90
|
-
let e = M && !a.includes("--only-enums") ? `${a} --only-enums` : a;
|
|
91
|
-
w && !e.includes("--quiet") && (e += " --quiet"), await d(null, e);
|
|
92
|
-
}
|
|
93
|
-
return;
|
|
94
|
-
}
|
|
95
|
-
await $(), v(), r.size > 0 && t.logger.info(
|
|
96
|
-
`${n} Watching ${r.size} PHP file${r.size === 1 ? "" : "s"} for changes`,
|
|
97
|
-
{ timestamp: !0 }
|
|
98
|
-
), T && await d();
|
|
99
|
-
},
|
|
100
|
-
async handleHotUpdate({ file: e }) {
|
|
101
|
-
const o = g(e);
|
|
102
|
-
if (o === u)
|
|
103
|
-
return t.logger.info(
|
|
104
|
-
`${n} Manifest changed, reloading watched files`,
|
|
105
|
-
{ timestamp: !0 }
|
|
106
|
-
), await $(), v(), [];
|
|
107
|
-
if (r.has(o)) {
|
|
108
|
-
const c = r.get(o) ?? null;
|
|
109
|
-
return await d(c), [];
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
};
|
|
1
|
+
import { exec as e } from "node:child_process";
|
|
2
|
+
import { readFile as t } from "node:fs/promises";
|
|
3
|
+
import n from "node:path";
|
|
4
|
+
import { promisify as r } from "node:util";
|
|
5
|
+
import { normalizePath as i } from "vite";
|
|
6
|
+
// src/vite-plugin.ts
|
|
7
|
+
var a = r(e);
|
|
8
|
+
function o(e = {}) {
|
|
9
|
+
let { command: r = "php artisan ts:publish", filename: o = "laravel-ts-collected-files.json", directory: s = "resources/js/types/data/", runOnDevStart: c = !1, runOnBuildStart: l = !0, reload: u = !0, failOnError: d, sourceCommand: f, onBuildOnlyEnums: p = !0, quiet: m = !0 } = e, h = f === !1 ? !1 : f ?? `${r} --source="{file}"`, g, _, v = /* @__PURE__ */ new Map(), y = "", b = !1, x = [], S = "[laravel-ts-publish]", C = async () => {
|
|
10
|
+
v.clear();
|
|
11
|
+
try {
|
|
12
|
+
let e = await t(y, "utf-8"), r = JSON.parse(e);
|
|
13
|
+
for (let e of r) {
|
|
14
|
+
let t = i(n.resolve(g.root, e));
|
|
15
|
+
v.set(t, e);
|
|
16
|
+
}
|
|
17
|
+
} catch (e) {
|
|
18
|
+
if (e instanceof Error && e.code === "ENOENT") {
|
|
19
|
+
g.logger.warn(`${S} Manifest not found: ${y}`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
g.logger.error(`${S} Failed to read manifest: ${e instanceof Error ? e.message : String(e)}`);
|
|
23
|
+
}
|
|
24
|
+
}, w = () => {
|
|
25
|
+
if (_) for (let e of v.keys()) _.watcher.add(e);
|
|
26
|
+
}, T = () => d === void 0 ? g.command === "build" : d, E = async (e = null, t) => {
|
|
27
|
+
if (b) {
|
|
28
|
+
x.includes(e) || x.push(e);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
b = !0;
|
|
32
|
+
let n = e && h ? h.replaceAll("{file}", e) : t ?? r;
|
|
33
|
+
m && !n.includes("--quiet") && (n += " --quiet");
|
|
34
|
+
try {
|
|
35
|
+
g.logger.info(`${S} Running: ${n}`, { timestamp: !0 }), await a(n, { cwd: g.root }), g.logger.info(`${S} Types published successfully`, { timestamp: !0 }), u && _ && _.ws.send({ type: "full-reload" });
|
|
36
|
+
} catch (e) {
|
|
37
|
+
let t = e instanceof Error ? e.message : String(e), { stdout: n, stderr: r } = e, i = [r?.trim(), n?.trim()].filter((e) => !!e && !t.includes(e)).join("\n"), a = `${S} Command failed: ${t}${i ? `\n${i}` : ""}`;
|
|
38
|
+
if (T()) throw Error(a, { cause: e });
|
|
39
|
+
g.logger.error(a);
|
|
40
|
+
} finally {
|
|
41
|
+
if (b = !1, x.length > 0) {
|
|
42
|
+
let e = x.shift();
|
|
43
|
+
await E(e);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
return {
|
|
48
|
+
name: "@tolki/vite-plugin-laravel-ts-publish",
|
|
49
|
+
enforce: "pre",
|
|
50
|
+
configResolved(e) {
|
|
51
|
+
g = e, y = i(n.resolve(g.root, s, o));
|
|
52
|
+
},
|
|
53
|
+
configureServer(e) {
|
|
54
|
+
_ = e;
|
|
55
|
+
},
|
|
56
|
+
async buildStart() {
|
|
57
|
+
if (g.command === "build") {
|
|
58
|
+
if (l) {
|
|
59
|
+
let e = p && !r.includes("--only-enums") ? `${r} --only-enums` : r;
|
|
60
|
+
m && !e.includes("--quiet") && (e += " --quiet"), await E(null, e);
|
|
61
|
+
}
|
|
62
|
+
} else await C(), w(), v.size > 0 && g.logger.info(`${S} Watching ${v.size} PHP file${v.size === 1 ? "" : "s"} for changes`, { timestamp: !0 }), c && await E();
|
|
63
|
+
},
|
|
64
|
+
async handleHotUpdate({ file: e }) {
|
|
65
|
+
let t = i(e);
|
|
66
|
+
if (t === y) return g.logger.info(`${S} Manifest changed, reloading watched files`, { timestamp: !0 }), await C(), w(), [];
|
|
67
|
+
if (v.has(t)) {
|
|
68
|
+
let e = v.get(t) ?? null;
|
|
69
|
+
return await E(e), [];
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
};
|
|
113
73
|
}
|
|
114
|
-
export {
|
|
115
|
-
U as laravelTsPublish
|
|
116
|
-
};
|
|
74
|
+
export { o as laravelTsPublish };
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolki/enum",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.2.0",
|
|
4
4
|
"description": "A set of enum utilities for the Laravel TypeScript Publish PHP package.",
|
|
5
5
|
"author": "Abraham Arango <https://github.com/abetwothree>",
|
|
6
6
|
"license": "MIT",
|
|
7
|
-
"homepage": "https://tolki.abe.dev/enums
|
|
7
|
+
"homepage": "https://tolki.abe.dev/ts/enums.html",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/abetwothree/tolki.git",
|
|
@@ -37,8 +37,11 @@
|
|
|
37
37
|
"tolki"
|
|
38
38
|
],
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@tolki/types": "^1.
|
|
41
|
-
"@tolki/utils": "^1.6.
|
|
40
|
+
"@tolki/types": "^1.12.0",
|
|
41
|
+
"@tolki/utils": "^1.6.3"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"vite": "^8.3.5"
|
|
42
45
|
},
|
|
43
46
|
"peerDependencies": {
|
|
44
47
|
"vite": "^8.0.0||^7.0.0"
|