@tolki/enum 0.0.5 → 0.0.6
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 +3 -3
- package/dist/vite-plugin.d.ts +1 -1
- package/dist/vite-plugin.js +12 -12
- package/package.json +17 -3
package/README.md
CHANGED
|
@@ -143,7 +143,7 @@ Using just `sail artisan ts:publish` often fails because `sail` is commonly defi
|
|
|
143
143
|
By default, the plugin will work in the following way:
|
|
144
144
|
|
|
145
145
|
1. It will call `php artisan ts:publish` as the republish command when a file changes.
|
|
146
|
-
2. It will look for the list of transformed PHP files here: `resources/js/types/laravel-ts-collected-files.json`.
|
|
146
|
+
2. It will look for the list of transformed PHP files here: `resources/js/types/data/laravel-ts-collected-files.json`.
|
|
147
147
|
3. If that manifest file changes, it will reload the watched file list without calling the publish command again.
|
|
148
148
|
4. It will reload the page after a successful publish triggered by a watched PHP file change.
|
|
149
149
|
5. It will call the publish command on `vite build` before bundling, with `--only-enums` appended by default (since model interfaces are type-only and erased at compile time).
|
|
@@ -173,7 +173,7 @@ Full startup commands (`runOnDevStart`, `runOnBuildStart`) always use the full `
|
|
|
173
173
|
|
|
174
174
|
The collected-files manifest is treated as configuration input for the watcher, not as a publish trigger.
|
|
175
175
|
|
|
176
|
-
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.
|
|
176
|
+
That means when `ts:publish` updates `resources/js/types/data/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.
|
|
177
177
|
|
|
178
178
|
### Plugin Options
|
|
179
179
|
|
|
@@ -208,7 +208,7 @@ export default defineConfig({
|
|
|
208
208
|
/**
|
|
209
209
|
* The directory where the JSON manifest file exists, relative to the Vite root.
|
|
210
210
|
*/
|
|
211
|
-
directory: "resources/js/types/",
|
|
211
|
+
directory: "resources/js/types/data/",
|
|
212
212
|
/**
|
|
213
213
|
* Whether to run the publish command once when `vite dev` starts.
|
|
214
214
|
*
|
package/dist/vite-plugin.d.ts
CHANGED
package/dist/vite-plugin.js
CHANGED
|
@@ -8,7 +8,7 @@ function H(E = {}) {
|
|
|
8
8
|
const {
|
|
9
9
|
command: s = "php artisan ts:publish",
|
|
10
10
|
filename: O = "laravel-ts-collected-files.json",
|
|
11
|
-
directory: S = "resources/js/types/",
|
|
11
|
+
directory: S = "resources/js/types/data/",
|
|
12
12
|
runOnDevStart: q = !1,
|
|
13
13
|
runOnBuildStart: z = !0,
|
|
14
14
|
reload: P = !0,
|
|
@@ -25,8 +25,8 @@ function H(E = {}) {
|
|
|
25
25
|
try {
|
|
26
26
|
const e = await M(u, "utf-8"), o = JSON.parse(e);
|
|
27
27
|
for (const c of o) {
|
|
28
|
-
const
|
|
29
|
-
t.set(
|
|
28
|
+
const a = g(C.resolve(r.root, c));
|
|
29
|
+
t.set(a, c);
|
|
30
30
|
}
|
|
31
31
|
} catch (e) {
|
|
32
32
|
if (e instanceof Error && e.code === "ENOENT") {
|
|
@@ -49,23 +49,23 @@ function H(E = {}) {
|
|
|
49
49
|
return;
|
|
50
50
|
}
|
|
51
51
|
m = !0;
|
|
52
|
-
let
|
|
53
|
-
w && !
|
|
52
|
+
let a = e && y ? y.replaceAll("{file}", e) : o ?? s;
|
|
53
|
+
w && !a.includes("--quiet") && (a += " --quiet");
|
|
54
54
|
try {
|
|
55
|
-
r.logger.info(`${n} Running: ${
|
|
55
|
+
r.logger.info(`${n} Running: ${a}`, {
|
|
56
56
|
timestamp: !0
|
|
57
|
-
}), await R(
|
|
57
|
+
}), await R(a, { cwd: r.root }), r.logger.info(`${n} Types published successfully`, {
|
|
58
58
|
timestamp: !0
|
|
59
59
|
}), P && l && l.ws.send({ type: "full-reload" });
|
|
60
|
-
} catch (
|
|
61
|
-
const b = `${n} Command failed: ${
|
|
60
|
+
} catch (i) {
|
|
61
|
+
const b = `${n} Command failed: ${i instanceof Error ? i.message : String(i)}`;
|
|
62
62
|
if (x())
|
|
63
|
-
throw new Error(b, { cause:
|
|
63
|
+
throw new Error(b, { cause: i });
|
|
64
64
|
r.logger.error(b);
|
|
65
65
|
} finally {
|
|
66
66
|
if (m = !1, f.length > 0) {
|
|
67
|
-
const
|
|
68
|
-
await d(
|
|
67
|
+
const i = f.shift();
|
|
68
|
+
await d(i);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tolki/enum",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
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",
|
|
@@ -13,17 +13,31 @@
|
|
|
13
13
|
"bugs": {
|
|
14
14
|
"url": "https://github.com/abetwothree/tolki/issues"
|
|
15
15
|
},
|
|
16
|
+
"$schema": "https://raw.githubusercontent.com/vitejs/vite-plugin-registry/refs/heads/main/data/schema/extended-package-json.schema.json",
|
|
17
|
+
"compatiblePackages": {
|
|
18
|
+
"schemaVersion": 1,
|
|
19
|
+
"vite": {
|
|
20
|
+
"type": "compatible",
|
|
21
|
+
"versions": "^7.0.0"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
16
24
|
"main": "dist/index.js",
|
|
17
25
|
"type": "module",
|
|
18
26
|
"keywords": [
|
|
19
27
|
"enum",
|
|
20
28
|
"enums",
|
|
29
|
+
"model",
|
|
30
|
+
"models",
|
|
21
31
|
"laravel",
|
|
22
32
|
"utils",
|
|
23
|
-
"utilities"
|
|
33
|
+
"utilities",
|
|
34
|
+
"typescript",
|
|
35
|
+
"vite",
|
|
36
|
+
"tolki",
|
|
37
|
+
"vite-plugin"
|
|
24
38
|
],
|
|
25
39
|
"dependencies": {
|
|
26
|
-
"@tolki/types": "^1.1.
|
|
40
|
+
"@tolki/types": "^1.1.4"
|
|
27
41
|
},
|
|
28
42
|
"peerDependencies": {
|
|
29
43
|
"vite": "^7.0.0"
|