@celox-sim/vite-plugin 0.4.3 → 0.4.4-nightly.stable.20260830182418.g953728ecc565
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/dist/cache.d.ts +5 -4
- package/dist/cache.d.ts.map +1 -1
- package/dist/cache.js +17 -17
- package/dist/cache.js.map +1 -1
- package/package.json +2 -2
- package/src/cache.ts +21 -17
package/dist/cache.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export declare class GenTsCache {
|
|
|
3
3
|
private readonly _projectRoot;
|
|
4
4
|
private _testbenchComponents?;
|
|
5
5
|
private _data;
|
|
6
|
-
private
|
|
6
|
+
private _sourceKey;
|
|
7
7
|
constructor(_projectRoot: string, _testbenchComponents?: TestbenchComponentManifests | undefined);
|
|
8
8
|
setTestbenchComponents(components: TestbenchComponentManifests): void;
|
|
9
9
|
/** Get cached data, refreshing if any .veryl file has changed. */
|
|
@@ -11,10 +11,11 @@ export declare class GenTsCache {
|
|
|
11
11
|
/** Force invalidation — next `get()` will re-run the generator. */
|
|
12
12
|
invalidate(): void;
|
|
13
13
|
/**
|
|
14
|
-
* Build a key from
|
|
15
|
-
* This
|
|
14
|
+
* Build a key from every .veryl file's path, mtime, and size.
|
|
15
|
+
* This stays cheap — only stats, no file reads — while detecting changes to
|
|
16
|
+
* older files whose mtime does not exceed the newest file in the project.
|
|
16
17
|
*/
|
|
17
|
-
private
|
|
18
|
+
private computeSourceKey;
|
|
18
19
|
private walkVerylFiles;
|
|
19
20
|
}
|
|
20
21
|
//# sourceMappingURL=cache.d.ts.map
|
package/dist/cache.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE/E,qBAAa,UAAU;IAKrB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,oBAAoB,CAAC;IAL9B,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,2BAA2B,EAAE,MAAM,YAAY,CAAC;AAE/E,qBAAa,UAAU;IAKrB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,oBAAoB,CAAC;IAL9B,OAAO,CAAC,KAAK,CAA8B;IAC3C,OAAO,CAAC,UAAU,CAAM;IAExB,YACkB,YAAY,EAAE,MAAM,EAC7B,oBAAoB,CAAC,EAAE,2BAA2B,YAAA,EACvD;IAEJ,sBAAsB,CAAC,UAAU,EAAE,2BAA2B,GAAG,IAAI,CAGpE;IAED,kEAAkE;IAClE,GAAG,IAAI,eAAe,CAQrB;IAED,mEAAmE;IACnE,UAAU,IAAI,IAAI,CAGjB;IAED;;;;OAIG;IACH,OAAO,CAAC,gBAAgB;IASxB,OAAO,CAAC,cAAc;CAiCtB"}
|
package/dist/cache.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { readdirSync, statSync } from "node:fs";
|
|
2
|
-
import { extname, join } from "node:path";
|
|
2
|
+
import { extname, join, relative } from "node:path";
|
|
3
3
|
import { runGenTs } from "./generator.js";
|
|
4
4
|
export class GenTsCache {
|
|
5
5
|
_projectRoot;
|
|
6
6
|
_testbenchComponents;
|
|
7
7
|
_data;
|
|
8
|
-
|
|
8
|
+
_sourceKey = "";
|
|
9
9
|
constructor(_projectRoot, _testbenchComponents) {
|
|
10
10
|
this._projectRoot = _projectRoot;
|
|
11
11
|
this._testbenchComponents = _testbenchComponents;
|
|
@@ -16,32 +16,31 @@ export class GenTsCache {
|
|
|
16
16
|
}
|
|
17
17
|
/** Get cached data, refreshing if any .veryl file has changed. */
|
|
18
18
|
get() {
|
|
19
|
-
const key = this.
|
|
20
|
-
if (this._data && this.
|
|
19
|
+
const key = this.computeSourceKey();
|
|
20
|
+
if (this._data && this._sourceKey === key) {
|
|
21
21
|
return this._data;
|
|
22
22
|
}
|
|
23
23
|
this._data = runGenTs(this._projectRoot, this._testbenchComponents);
|
|
24
|
-
this.
|
|
24
|
+
this._sourceKey = key;
|
|
25
25
|
return this._data;
|
|
26
26
|
}
|
|
27
27
|
/** Force invalidation — next `get()` will re-run the generator. */
|
|
28
28
|
invalidate() {
|
|
29
|
-
this.
|
|
29
|
+
this._sourceKey = "";
|
|
30
30
|
this._data = undefined;
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
|
-
* Build a key from
|
|
34
|
-
* This
|
|
33
|
+
* Build a key from every .veryl file's path, mtime, and size.
|
|
34
|
+
* This stays cheap — only stats, no file reads — while detecting changes to
|
|
35
|
+
* older files whose mtime does not exceed the newest file in the project.
|
|
35
36
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
if (mtimeMs > maxMtime)
|
|
41
|
-
maxMtime = mtimeMs;
|
|
42
|
-
count++;
|
|
37
|
+
computeSourceKey() {
|
|
38
|
+
const files = [];
|
|
39
|
+
this.walkVerylFiles(this._projectRoot, (path, mtimeMs, size) => {
|
|
40
|
+
files.push([relative(this._projectRoot, path), mtimeMs, size]);
|
|
43
41
|
});
|
|
44
|
-
|
|
42
|
+
files.sort(([a], [b]) => a.localeCompare(b));
|
|
43
|
+
return JSON.stringify(files);
|
|
45
44
|
}
|
|
46
45
|
walkVerylFiles(dir, cb) {
|
|
47
46
|
let entries;
|
|
@@ -65,7 +64,8 @@ export class GenTsCache {
|
|
|
65
64
|
}
|
|
66
65
|
else if (extname(entry.name) === ".veryl") {
|
|
67
66
|
try {
|
|
68
|
-
|
|
67
|
+
const stat = statSync(full);
|
|
68
|
+
cb(full, stat.mtimeMs, stat.size);
|
|
69
69
|
}
|
|
70
70
|
catch {
|
|
71
71
|
// file may have been deleted
|
package/dist/cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"cache.js","sourceRoot":"","sources":["../src/cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,WAAW,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAG1C,MAAM,OAAO,UAAU;IAKJ,YAAY;IACrB,oBAAoB;IALrB,KAAK,CAA8B;IACnC,UAAU,GAAG,EAAE,CAAC;IAExB,YACkB,YAAoB,EAC7B,oBAAkD;4BADzC,YAAY;oCACrB,oBAAoB;IAC1B,CAAC;IAEJ,sBAAsB,CAAC,UAAuC;QAC7D,IAAI,CAAC,oBAAoB,GAAG,UAAU,CAAC;QACvC,IAAI,CAAC,UAAU,EAAE,CAAC;IACnB,CAAC;IAED,kEAAkE;IAClE,GAAG;QACF,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpC,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;YAC3C,OAAO,IAAI,CAAC,KAAK,CAAC;QACnB,CAAC;QACD,IAAI,CAAC,KAAK,GAAG,QAAQ,CAAC,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,oBAAoB,CAAC,CAAC;QACpE,IAAI,CAAC,UAAU,GAAG,GAAG,CAAC;QACtB,OAAO,IAAI,CAAC,KAAK,CAAC;IACnB,CAAC;IAED,mEAAmE;IACnE,UAAU;QACT,IAAI,CAAC,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c,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC/B,CAAC;iBAAM,IAAI,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,QAAQ,EAAE,CAAC;gBAC7C,IAAI,CAAC;oBACJ,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC;oBAC5B,EAAE,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC;gBACnC,CAAC;gBAAC,MAAM,CAAC;oBACR,6BAA6B;gBAC9B,CAAC;YACF,CAAC;QACF,CAAC;IACF,CAAC;CACD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celox-sim/vite-plugin",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4-nightly.stable.20260830182418.g953728ecc565",
|
|
4
4
|
"description": "Vite plugin for importing .veryl files as typed ModuleDefinition objects",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"vite": ">=5.0.0"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@celox-sim/celox": "0.4.
|
|
36
|
+
"@celox-sim/celox": "0.4.4-nightly.stable.20260830182418.g953728ecc565"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^25.3.2",
|
package/src/cache.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { type Dirent, readdirSync, statSync } from "node:fs";
|
|
2
|
-
import { extname, join } from "node:path";
|
|
2
|
+
import { extname, join, relative } from "node:path";
|
|
3
3
|
import { runGenTs } from "./generator.js";
|
|
4
4
|
import type { GenTsJsonOutput, TestbenchComponentManifests } from "./types.js";
|
|
5
5
|
|
|
6
6
|
export class GenTsCache {
|
|
7
7
|
private _data: GenTsJsonOutput | undefined;
|
|
8
|
-
private
|
|
8
|
+
private _sourceKey = "";
|
|
9
9
|
|
|
10
10
|
constructor(
|
|
11
11
|
private readonly _projectRoot: string,
|
|
@@ -19,36 +19,39 @@ export class GenTsCache {
|
|
|
19
19
|
|
|
20
20
|
/** Get cached data, refreshing if any .veryl file has changed. */
|
|
21
21
|
get(): GenTsJsonOutput {
|
|
22
|
-
const key = this.
|
|
23
|
-
if (this._data && this.
|
|
22
|
+
const key = this.computeSourceKey();
|
|
23
|
+
if (this._data && this._sourceKey === key) {
|
|
24
24
|
return this._data;
|
|
25
25
|
}
|
|
26
26
|
this._data = runGenTs(this._projectRoot, this._testbenchComponents);
|
|
27
|
-
this.
|
|
27
|
+
this._sourceKey = key;
|
|
28
28
|
return this._data;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/** Force invalidation — next `get()` will re-run the generator. */
|
|
32
32
|
invalidate(): void {
|
|
33
|
-
this.
|
|
33
|
+
this._sourceKey = "";
|
|
34
34
|
this._data = undefined;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
|
-
* Build a key from
|
|
39
|
-
* This
|
|
38
|
+
* Build a key from every .veryl file's path, mtime, and size.
|
|
39
|
+
* This stays cheap — only stats, no file reads — while detecting changes to
|
|
40
|
+
* older files whose mtime does not exceed the newest file in the project.
|
|
40
41
|
*/
|
|
41
|
-
private
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (mtimeMs > maxMtime) maxMtime = mtimeMs;
|
|
46
|
-
count++;
|
|
42
|
+
private computeSourceKey(): string {
|
|
43
|
+
const files: Array<[path: string, mtimeMs: number, size: number]> = [];
|
|
44
|
+
this.walkVerylFiles(this._projectRoot, (path, mtimeMs, size) => {
|
|
45
|
+
files.push([relative(this._projectRoot, path), mtimeMs, size]);
|
|
47
46
|
});
|
|
48
|
-
|
|
47
|
+
files.sort(([a], [b]) => a.localeCompare(b));
|
|
48
|
+
return JSON.stringify(files);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
private walkVerylFiles(
|
|
51
|
+
private walkVerylFiles(
|
|
52
|
+
dir: string,
|
|
53
|
+
cb: (path: string, mtimeMs: number, size: number) => void,
|
|
54
|
+
): void {
|
|
52
55
|
let entries: Dirent<string>[] | undefined;
|
|
53
56
|
try {
|
|
54
57
|
entries = readdirSync(dir, { withFileTypes: true });
|
|
@@ -70,7 +73,8 @@ export class GenTsCache {
|
|
|
70
73
|
this.walkVerylFiles(full, cb);
|
|
71
74
|
} else if (extname(entry.name) === ".veryl") {
|
|
72
75
|
try {
|
|
73
|
-
|
|
76
|
+
const stat = statSync(full);
|
|
77
|
+
cb(full, stat.mtimeMs, stat.size);
|
|
74
78
|
} catch {
|
|
75
79
|
// file may have been deleted
|
|
76
80
|
}
|