@intlayer/engine 9.1.2 → 9.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/dist/assets/initConfig/templates/cjs.txt +4 -1
- package/dist/assets/initConfig/templates/json.txt +4 -1
- package/dist/assets/initConfig/templates/mjs.txt +4 -1
- package/dist/assets/initConfig/templates/ts.txt +4 -1
- package/dist/cjs/docReview/alignBlocks.cjs +57 -8
- package/dist/cjs/docReview/alignBlocks.cjs.map +1 -1
- package/dist/cjs/docReview/rebuildDocument.cjs +37 -9
- package/dist/cjs/docReview/rebuildDocument.cjs.map +1 -1
- package/dist/cjs/docReview/segmentDocument.cjs +19 -2
- package/dist/cjs/docReview/segmentDocument.cjs.map +1 -1
- package/dist/cjs/prepareIntlayer.cjs +7 -3
- package/dist/cjs/prepareIntlayer.cjs.map +1 -1
- package/dist/cjs/utils/runOnce.cjs +129 -50
- package/dist/cjs/utils/runOnce.cjs.map +1 -1
- package/dist/cjs/writeFileIfChanged.cjs +14 -7
- package/dist/cjs/writeFileIfChanged.cjs.map +1 -1
- package/dist/esm/docReview/alignBlocks.mjs +57 -8
- package/dist/esm/docReview/alignBlocks.mjs.map +1 -1
- package/dist/esm/docReview/rebuildDocument.mjs +37 -9
- package/dist/esm/docReview/rebuildDocument.mjs.map +1 -1
- package/dist/esm/docReview/segmentDocument.mjs +19 -2
- package/dist/esm/docReview/segmentDocument.mjs.map +1 -1
- package/dist/esm/prepareIntlayer.mjs +7 -3
- package/dist/esm/prepareIntlayer.mjs.map +1 -1
- package/dist/esm/utils/runOnce.mjs +129 -50
- package/dist/esm/utils/runOnce.mjs.map +1 -1
- package/dist/esm/writeFileIfChanged.mjs +15 -8
- package/dist/esm/writeFileIfChanged.mjs.map +1 -1
- package/dist/types/docReview/alignBlocks.d.ts +4 -2
- package/dist/types/docReview/alignBlocks.d.ts.map +1 -1
- package/dist/types/docReview/rebuildDocument.d.ts.map +1 -1
- package/dist/types/docReview/segmentDocument.d.ts.map +1 -1
- package/dist/types/docReview/types.d.ts +9 -0
- package/dist/types/docReview/types.d.ts.map +1 -1
- package/dist/types/utils/index.d.ts +2 -2
- package/dist/types/utils/runOnce.d.ts +30 -6
- package/dist/types/utils/runOnce.d.ts.map +1 -1
- package/package.json +10 -10
|
@@ -1,4 +1,16 @@
|
|
|
1
1
|
//#region src/utils/runOnce.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Context handed to the callback so it can interact with the lock it runs under.
|
|
4
|
+
*/
|
|
5
|
+
type RunOnceContext = {
|
|
6
|
+
/**
|
|
7
|
+
* Re-create the sentinel file after an operation that may have deleted it —
|
|
8
|
+
* typically cleaning the output directory, which wipes the cache directory the
|
|
9
|
+
* sentinel lives in. Without this, concurrent processes would see no lock and
|
|
10
|
+
* start a competing run while this one is still writing.
|
|
11
|
+
*/
|
|
12
|
+
renewLock: () => Promise<void>;
|
|
13
|
+
};
|
|
2
14
|
type RunOnceOptions = {
|
|
3
15
|
/**
|
|
4
16
|
* The function to execute when the sentinel is not found or is older than the cache timeout.
|
|
@@ -16,30 +28,42 @@ type RunOnceOptions = {
|
|
|
16
28
|
* @default false
|
|
17
29
|
*/
|
|
18
30
|
forceRun?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* How long to wait for another process to release the sentinel before
|
|
33
|
+
* considering its run abandoned and taking the lock over.
|
|
34
|
+
*
|
|
35
|
+
* @default 300000 = 5 minutes
|
|
36
|
+
*/
|
|
37
|
+
lockWaitTimeoutMs?: number;
|
|
19
38
|
};
|
|
20
39
|
/**
|
|
21
40
|
* Ensures a callback function runs only once within a specified time window across multiple processes.
|
|
22
41
|
* Uses a sentinel file to coordinate execution and prevent duplicate work.
|
|
23
42
|
*
|
|
43
|
+
* Processes that lose the race for the sentinel wait for the owner to finish
|
|
44
|
+
* rather than running a competing copy of the callback — concurrent runs would
|
|
45
|
+
* otherwise write to (and clean) the same output directory at the same time.
|
|
46
|
+
*
|
|
24
47
|
* @param sentinelFilePath - Path to the sentinel file used for coordination
|
|
25
48
|
* @param callback - The function to execute (should be async)
|
|
26
49
|
* @param options - The options for the runOnce function
|
|
27
50
|
*
|
|
28
51
|
* @example
|
|
29
52
|
* ```typescript
|
|
30
|
-
* await
|
|
53
|
+
* await runOnce(
|
|
31
54
|
* '/tmp/intlayer-sentinel',
|
|
32
|
-
* async () => {
|
|
33
|
-
* //
|
|
55
|
+
* async ({ renewLock }) => {
|
|
56
|
+
* await cleanOutputDir(configuration); // may delete the sentinel
|
|
57
|
+
* await renewLock();
|
|
34
58
|
* await prepareIntlayer();
|
|
35
59
|
* },
|
|
36
|
-
* 30 * 1000 // 30 seconds cache
|
|
60
|
+
* { cacheTimeoutMs: 30 * 1000 } // 30 seconds cache
|
|
37
61
|
* );
|
|
38
62
|
* ```
|
|
39
63
|
*
|
|
40
64
|
* @throws {Error} When there are unexpected filesystem errors
|
|
41
65
|
*/
|
|
42
|
-
declare const runOnce: (sentinelFilePath: string, callback: () => void | Promise<void>, options?: RunOnceOptions) => Promise<void>;
|
|
66
|
+
declare const runOnce: (sentinelFilePath: string, callback: (context: RunOnceContext) => void | Promise<void>, options?: RunOnceOptions) => Promise<void>;
|
|
43
67
|
//#endregion
|
|
44
|
-
export { runOnce };
|
|
68
|
+
export { RunOnceContext, runOnce };
|
|
45
69
|
//# sourceMappingURL=runOnce.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runOnce.d.ts","names":[],"sources":["../../../src/utils/runOnce.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"runOnce.d.ts","names":[],"sources":["../../../src/utils/runOnce.ts"],"mappings":";;;;KA4BY;;;;;;;EAOV,iBAAiB;;KAGd;;;;EAIH,0BAA0B;;;;;;EAM1B;;;;;;EAMA;;;;;;;EAOA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAwKW,UAAO,0BACM,WACb,SAAS,0BAA0B,eAAa,UACjD,mBAAc"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intlayer/engine",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Scans and builds Intlayer declaration files into dictionaries based on Intlayer configuration.",
|
|
6
6
|
"keywords": [
|
|
@@ -141,17 +141,17 @@
|
|
|
141
141
|
"typecheck": "tsc --noEmit --project tsconfig.types.json"
|
|
142
142
|
},
|
|
143
143
|
"dependencies": {
|
|
144
|
-
"@intlayer/api": "9.
|
|
145
|
-
"@intlayer/config": "9.
|
|
146
|
-
"@intlayer/core": "9.
|
|
147
|
-
"@intlayer/dictionaries-entry": "9.
|
|
148
|
-
"@intlayer/remote-dictionaries-entry": "9.
|
|
149
|
-
"@intlayer/types": "9.
|
|
150
|
-
"@intlayer/unmerged-dictionaries-entry": "9.
|
|
144
|
+
"@intlayer/api": "9.2.0",
|
|
145
|
+
"@intlayer/config": "9.2.0",
|
|
146
|
+
"@intlayer/core": "9.2.0",
|
|
147
|
+
"@intlayer/dictionaries-entry": "9.2.0",
|
|
148
|
+
"@intlayer/remote-dictionaries-entry": "9.2.0",
|
|
149
|
+
"@intlayer/types": "9.2.0",
|
|
150
|
+
"@intlayer/unmerged-dictionaries-entry": "9.2.0",
|
|
151
151
|
"@parcel/watcher": "2.6.0",
|
|
152
152
|
"defu": "6.1.7",
|
|
153
153
|
"fast-glob": "3.3.3",
|
|
154
|
-
"recast": "0.23.
|
|
154
|
+
"recast": "0.23.14",
|
|
155
155
|
"simple-git": "3.36.0",
|
|
156
156
|
"zod-to-ts": "2.1.0"
|
|
157
157
|
},
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
"zod": "4.4.3"
|
|
168
168
|
},
|
|
169
169
|
"peerDependencies": {
|
|
170
|
-
"@intlayer/babel": "9.
|
|
170
|
+
"@intlayer/babel": "9.2.0"
|
|
171
171
|
},
|
|
172
172
|
"peerDependenciesMeta": {
|
|
173
173
|
"@intlayer/babel": {
|