pushwork 2.0.0-a.sub.1 → 2.0.0-preview
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/branches.d.ts +19 -0
- package/dist/branches.d.ts.map +1 -0
- package/dist/branches.js +111 -0
- package/dist/branches.js.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +238 -272
- package/dist/cli.js.map +1 -1
- package/dist/config.d.ts +17 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +84 -0
- package/dist/config.js.map +1 -0
- package/dist/fs-tree.d.ts +6 -0
- package/dist/fs-tree.d.ts.map +1 -0
- package/dist/fs-tree.js +99 -0
- package/dist/fs-tree.js.map +1 -0
- package/dist/ignore.d.ts +6 -0
- package/dist/ignore.d.ts.map +1 -0
- package/dist/ignore.js +74 -0
- package/dist/ignore.js.map +1 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +34 -4
- package/dist/index.js.map +1 -1
- package/dist/log.d.ts +3 -0
- package/dist/log.d.ts.map +1 -0
- package/dist/log.js +14 -0
- package/dist/log.js.map +1 -0
- package/dist/pushwork.d.ts +115 -0
- package/dist/pushwork.d.ts.map +1 -0
- package/dist/pushwork.js +918 -0
- package/dist/pushwork.js.map +1 -0
- package/dist/repo.d.ts +14 -0
- package/dist/repo.d.ts.map +1 -0
- package/dist/repo.js +60 -0
- package/dist/repo.js.map +1 -0
- package/dist/shapes/custom.d.ts +3 -0
- package/dist/shapes/custom.d.ts.map +1 -0
- package/dist/shapes/custom.js +57 -0
- package/dist/shapes/custom.js.map +1 -0
- package/dist/shapes/file.d.ts +20 -0
- package/dist/shapes/file.d.ts.map +1 -0
- package/dist/shapes/file.js +140 -0
- package/dist/shapes/file.js.map +1 -0
- package/dist/shapes/index.d.ts +10 -0
- package/dist/shapes/index.d.ts.map +1 -0
- package/dist/shapes/index.js +35 -0
- package/dist/shapes/index.js.map +1 -0
- package/dist/shapes/patchwork-folder.d.ts +3 -0
- package/dist/shapes/patchwork-folder.d.ts.map +1 -0
- package/dist/shapes/patchwork-folder.js +160 -0
- package/dist/shapes/patchwork-folder.js.map +1 -0
- package/dist/shapes/types.d.ts +37 -0
- package/dist/shapes/types.d.ts.map +1 -0
- package/dist/shapes/types.js +52 -0
- package/dist/shapes/types.js.map +1 -0
- package/dist/shapes/vfs.d.ts +3 -0
- package/dist/shapes/vfs.d.ts.map +1 -0
- package/dist/shapes/vfs.js +88 -0
- package/dist/shapes/vfs.js.map +1 -0
- package/dist/stash.d.ts +23 -0
- package/dist/stash.d.ts.map +1 -0
- package/dist/stash.js +118 -0
- package/dist/stash.js.map +1 -0
- package/flake.lock +128 -0
- package/flake.nix +66 -0
- package/package.json +15 -48
- package/patches/@automerge__automerge-repo@2.6.0-subduction.15.patch +26 -0
- package/pnpm-workspace.yaml +5 -0
- package/src/branches.ts +93 -0
- package/src/cli.ts +258 -408
- package/src/config.ts +64 -0
- package/src/fs-tree.ts +70 -0
- package/src/ignore.ts +33 -0
- package/src/index.ts +38 -4
- package/src/log.ts +8 -0
- package/src/pushwork.ts +1055 -0
- package/src/repo.ts +76 -0
- package/src/shapes/custom.ts +29 -0
- package/src/shapes/file.ts +115 -0
- package/src/shapes/index.ts +19 -0
- package/src/shapes/patchwork-folder.ts +156 -0
- package/src/shapes/types.ts +79 -0
- package/src/shapes/vfs.ts +93 -0
- package/src/stash.ts +106 -0
- package/test/integration/branches.test.ts +389 -0
- package/test/integration/pushwork.test.ts +547 -0
- package/test/setup.ts +29 -0
- package/test/unit/doc-shape.test.ts +612 -0
- package/tsconfig.json +2 -3
- package/vitest.config.ts +14 -0
- package/ARCHITECTURE-ACCORDING-TO-CLAUDE.md +0 -248
- package/CLAUDE.md +0 -141
- package/README.md +0 -221
- package/babel.config.js +0 -5
- package/dist/cli/commands.d.ts +0 -71
- package/dist/cli/commands.d.ts.map +0 -1
- package/dist/cli/commands.js +0 -794
- package/dist/cli/commands.js.map +0 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -19
- package/dist/cli/index.js.map +0 -1
- package/dist/commands.d.ts +0 -61
- package/dist/commands.d.ts.map +0 -1
- package/dist/commands.js +0 -861
- package/dist/commands.js.map +0 -1
- package/dist/config/index.d.ts +0 -71
- package/dist/config/index.d.ts.map +0 -1
- package/dist/config/index.js +0 -314
- package/dist/config/index.js.map +0 -1
- package/dist/core/change-detection.d.ts +0 -80
- package/dist/core/change-detection.d.ts.map +0 -1
- package/dist/core/change-detection.js +0 -523
- package/dist/core/change-detection.js.map +0 -1
- package/dist/core/config.d.ts +0 -81
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js +0 -258
- package/dist/core/config.js.map +0 -1
- package/dist/core/index.d.ts +0 -6
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -6
- package/dist/core/index.js.map +0 -1
- package/dist/core/move-detection.d.ts +0 -34
- package/dist/core/move-detection.d.ts.map +0 -1
- package/dist/core/move-detection.js +0 -121
- package/dist/core/move-detection.js.map +0 -1
- package/dist/core/snapshot.d.ts +0 -105
- package/dist/core/snapshot.d.ts.map +0 -1
- package/dist/core/snapshot.js +0 -217
- package/dist/core/snapshot.js.map +0 -1
- package/dist/core/sync-engine.d.ts +0 -157
- package/dist/core/sync-engine.d.ts.map +0 -1
- package/dist/core/sync-engine.js +0 -1379
- package/dist/core/sync-engine.js.map +0 -1
- package/dist/types/config.d.ts +0 -99
- package/dist/types/config.d.ts.map +0 -1
- package/dist/types/config.js +0 -5
- package/dist/types/config.js.map +0 -1
- package/dist/types/documents.d.ts +0 -88
- package/dist/types/documents.d.ts.map +0 -1
- package/dist/types/documents.js +0 -20
- package/dist/types/documents.js.map +0 -1
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -4
- package/dist/types/index.js.map +0 -1
- package/dist/types/snapshot.d.ts +0 -64
- package/dist/types/snapshot.d.ts.map +0 -1
- package/dist/types/snapshot.js +0 -2
- package/dist/types/snapshot.js.map +0 -1
- package/dist/utils/content-similarity.d.ts +0 -53
- package/dist/utils/content-similarity.d.ts.map +0 -1
- package/dist/utils/content-similarity.js +0 -155
- package/dist/utils/content-similarity.js.map +0 -1
- package/dist/utils/content.d.ts +0 -10
- package/dist/utils/content.d.ts.map +0 -1
- package/dist/utils/content.js +0 -31
- package/dist/utils/content.js.map +0 -1
- package/dist/utils/directory.d.ts +0 -24
- package/dist/utils/directory.d.ts.map +0 -1
- package/dist/utils/directory.js +0 -52
- package/dist/utils/directory.js.map +0 -1
- package/dist/utils/fs.d.ts +0 -74
- package/dist/utils/fs.d.ts.map +0 -1
- package/dist/utils/fs.js +0 -248
- package/dist/utils/fs.js.map +0 -1
- package/dist/utils/index.d.ts +0 -5
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/index.js +0 -5
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/mime-types.d.ts +0 -13
- package/dist/utils/mime-types.d.ts.map +0 -1
- package/dist/utils/mime-types.js +0 -209
- package/dist/utils/mime-types.js.map +0 -1
- package/dist/utils/network-sync.d.ts +0 -36
- package/dist/utils/network-sync.d.ts.map +0 -1
- package/dist/utils/network-sync.js +0 -250
- package/dist/utils/network-sync.js.map +0 -1
- package/dist/utils/node-polyfills.d.ts +0 -9
- package/dist/utils/node-polyfills.d.ts.map +0 -1
- package/dist/utils/node-polyfills.js +0 -9
- package/dist/utils/node-polyfills.js.map +0 -1
- package/dist/utils/output.d.ts +0 -129
- package/dist/utils/output.d.ts.map +0 -1
- package/dist/utils/output.js +0 -368
- package/dist/utils/output.js.map +0 -1
- package/dist/utils/repo-factory.d.ts +0 -13
- package/dist/utils/repo-factory.d.ts.map +0 -1
- package/dist/utils/repo-factory.js +0 -46
- package/dist/utils/repo-factory.js.map +0 -1
- package/dist/utils/string-similarity.d.ts +0 -14
- package/dist/utils/string-similarity.d.ts.map +0 -1
- package/dist/utils/string-similarity.js +0 -39
- package/dist/utils/string-similarity.js.map +0 -1
- package/dist/utils/text-diff.d.ts +0 -37
- package/dist/utils/text-diff.d.ts.map +0 -1
- package/dist/utils/text-diff.js +0 -93
- package/dist/utils/text-diff.js.map +0 -1
- package/dist/utils/trace.d.ts +0 -19
- package/dist/utils/trace.d.ts.map +0 -1
- package/dist/utils/trace.js +0 -63
- package/dist/utils/trace.js.map +0 -1
- package/src/commands.ts +0 -1134
- package/src/core/change-detection.ts +0 -712
- package/src/core/config.ts +0 -313
- package/src/core/index.ts +0 -5
- package/src/core/move-detection.ts +0 -169
- package/src/core/snapshot.ts +0 -275
- package/src/core/sync-engine.ts +0 -1795
- package/src/types/config.ts +0 -111
- package/src/types/documents.ts +0 -91
- package/src/types/index.ts +0 -3
- package/src/types/snapshot.ts +0 -67
- package/src/utils/content.ts +0 -34
- package/src/utils/directory.ts +0 -73
- package/src/utils/fs.ts +0 -297
- package/src/utils/index.ts +0 -4
- package/src/utils/mime-types.ts +0 -244
- package/src/utils/network-sync.ts +0 -319
- package/src/utils/node-polyfills.ts +0 -8
- package/src/utils/output.ts +0 -450
- package/src/utils/repo-factory.ts +0 -73
- package/src/utils/string-similarity.ts +0 -54
- package/src/utils/text-diff.ts +0 -101
- package/src/utils/trace.ts +0 -70
- package/test/integration/README.md +0 -328
- package/test/integration/clone-test.sh +0 -310
- package/test/integration/conflict-resolution-test.sh +0 -309
- package/test/integration/debug-both-nested.sh +0 -74
- package/test/integration/debug-concurrent-nested.sh +0 -87
- package/test/integration/debug-nested.sh +0 -73
- package/test/integration/deletion-behavior-test.sh +0 -487
- package/test/integration/deletion-sync-test-simple.sh +0 -193
- package/test/integration/deletion-sync-test.sh +0 -297
- package/test/integration/exclude-patterns.test.ts +0 -144
- package/test/integration/full-integration-test.sh +0 -363
- package/test/integration/fuzzer.test.ts +0 -818
- package/test/integration/in-memory-sync.test.ts +0 -830
- package/test/integration/init-sync.test.ts +0 -89
- package/test/integration/manual-sync-test.sh +0 -84
- package/test/integration/sync-deletion.test.ts +0 -280
- package/test/integration/sync-flow.test.ts +0 -291
- package/test/jest.setup.ts +0 -34
- package/test/run-tests.sh +0 -225
- package/test/unit/deletion-behavior.test.ts +0 -249
- package/test/unit/enhanced-mime-detection.test.ts +0 -244
- package/test/unit/snapshot.test.ts +0 -404
- package/test/unit/sync-convergence.test.ts +0 -298
- package/test/unit/sync-timing.test.ts +0 -134
- package/test/unit/utils.test.ts +0 -366
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import * as A from "@automerge/automerge";
|
|
2
|
-
/**
|
|
3
|
-
* Read content from an Automerge document, normalizing legacy ImmutableString
|
|
4
|
-
* values to plain strings for backwards compatibility.
|
|
5
|
-
*
|
|
6
|
-
* Old documents may store text as ImmutableString. This helper ensures callers
|
|
7
|
-
* always get back `string | Uint8Array | null`.
|
|
8
|
-
*/
|
|
9
|
-
export declare function readDocContent(content: unknown): string | Uint8Array | null;
|
|
10
|
-
/**
|
|
11
|
-
* Update text content on an Automerge document property inside a change
|
|
12
|
-
* callback.
|
|
13
|
-
*
|
|
14
|
-
* If the existing value is already a collaborative text string, we diff and
|
|
15
|
-
* splice for minimal CRDT operations. If the existing value is a legacy
|
|
16
|
-
* ImmutableString we can't splice into it, so we assign the whole string
|
|
17
|
-
* which converts the field to a collaborative text CRDT going forward.
|
|
18
|
-
*
|
|
19
|
-
* @param doc - The mutable Automerge document (inside a change callback)
|
|
20
|
-
* @param path - Property path to the text field, e.g. ["content"]
|
|
21
|
-
* @param newContent - The desired new text value
|
|
22
|
-
*/
|
|
23
|
-
export declare function updateTextContent(doc: any, path: A.Prop[], newContent: string): void;
|
|
24
|
-
/**
|
|
25
|
-
* Apply a text diff between oldContent and newContent as Automerge splice
|
|
26
|
-
* operations on the given document property path.
|
|
27
|
-
*
|
|
28
|
-
* This preserves the collaborative text CRDT structure by making minimal
|
|
29
|
-
* character-level edits rather than replacing the entire string.
|
|
30
|
-
*
|
|
31
|
-
* @param doc - The Automerge document (inside a change callback)
|
|
32
|
-
* @param path - The property path to the text field, e.g. ["content"]
|
|
33
|
-
* @param oldContent - The previous text content
|
|
34
|
-
* @param newContent - The desired new text content
|
|
35
|
-
*/
|
|
36
|
-
export declare function spliceText(doc: any, path: A.Prop[], oldContent: string, newContent: string): void;
|
|
37
|
-
//# sourceMappingURL=text-diff.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-diff.d.ts","sourceRoot":"","sources":["../../src/utils/text-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,sBAAsB,CAAA;AAGzC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,GAAG,IAAI,CAO3E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,iBAAiB,CAChC,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EACd,UAAU,EAAE,MAAM,GAChB,IAAI,CAeN;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CACzB,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,EACd,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,MAAM,GAChB,IAAI,CA8BN"}
|
package/dist/utils/text-diff.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import * as A from "@automerge/automerge";
|
|
2
|
-
import * as diffLib from "diff";
|
|
3
|
-
/**
|
|
4
|
-
* Read content from an Automerge document, normalizing legacy ImmutableString
|
|
5
|
-
* values to plain strings for backwards compatibility.
|
|
6
|
-
*
|
|
7
|
-
* Old documents may store text as ImmutableString. This helper ensures callers
|
|
8
|
-
* always get back `string | Uint8Array | null`.
|
|
9
|
-
*/
|
|
10
|
-
export function readDocContent(content) {
|
|
11
|
-
if (content == null)
|
|
12
|
-
return null;
|
|
13
|
-
if (typeof content === "string")
|
|
14
|
-
return content;
|
|
15
|
-
if (content instanceof Uint8Array)
|
|
16
|
-
return content;
|
|
17
|
-
// Legacy ImmutableString — convert to plain string
|
|
18
|
-
if (A.isImmutableString(content))
|
|
19
|
-
return content.toString();
|
|
20
|
-
return null;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Update text content on an Automerge document property inside a change
|
|
24
|
-
* callback.
|
|
25
|
-
*
|
|
26
|
-
* If the existing value is already a collaborative text string, we diff and
|
|
27
|
-
* splice for minimal CRDT operations. If the existing value is a legacy
|
|
28
|
-
* ImmutableString we can't splice into it, so we assign the whole string
|
|
29
|
-
* which converts the field to a collaborative text CRDT going forward.
|
|
30
|
-
*
|
|
31
|
-
* @param doc - The mutable Automerge document (inside a change callback)
|
|
32
|
-
* @param path - Property path to the text field, e.g. ["content"]
|
|
33
|
-
* @param newContent - The desired new text value
|
|
34
|
-
*/
|
|
35
|
-
export function updateTextContent(doc, path, newContent) {
|
|
36
|
-
const target = path.reduce((obj, key) => obj?.[key], doc);
|
|
37
|
-
if (typeof target === "string") {
|
|
38
|
-
// Already a collaborative text string — diff and splice
|
|
39
|
-
spliceText(doc, path, target, newContent);
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
// Legacy ImmutableString, undefined, or other — assign directly.
|
|
43
|
-
// This converts the field to a collaborative text CRDT.
|
|
44
|
-
let obj = doc;
|
|
45
|
-
for (let i = 0; i < path.length - 1; i++) {
|
|
46
|
-
obj = obj[path[i]];
|
|
47
|
-
}
|
|
48
|
-
obj[path[path.length - 1]] = newContent;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Apply a text diff between oldContent and newContent as Automerge splice
|
|
53
|
-
* operations on the given document property path.
|
|
54
|
-
*
|
|
55
|
-
* This preserves the collaborative text CRDT structure by making minimal
|
|
56
|
-
* character-level edits rather than replacing the entire string.
|
|
57
|
-
*
|
|
58
|
-
* @param doc - The Automerge document (inside a change callback)
|
|
59
|
-
* @param path - The property path to the text field, e.g. ["content"]
|
|
60
|
-
* @param oldContent - The previous text content
|
|
61
|
-
* @param newContent - The desired new text content
|
|
62
|
-
*/
|
|
63
|
-
export function spliceText(doc, path, oldContent, newContent) {
|
|
64
|
-
if (oldContent === newContent)
|
|
65
|
-
return;
|
|
66
|
-
// Fast path: if old is empty, just insert everything
|
|
67
|
-
if (oldContent === "") {
|
|
68
|
-
A.splice(doc, path, 0, 0, newContent);
|
|
69
|
-
return;
|
|
70
|
-
}
|
|
71
|
-
// Fast path: if new is empty, just delete everything
|
|
72
|
-
if (newContent === "") {
|
|
73
|
-
A.splice(doc, path, 0, oldContent.length);
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const changes = diffLib.diffChars(oldContent, newContent);
|
|
77
|
-
let pos = 0;
|
|
78
|
-
for (const part of changes) {
|
|
79
|
-
if (part.removed) {
|
|
80
|
-
A.splice(doc, path, pos, part.value.length);
|
|
81
|
-
// Don't advance pos — text shifted left after deletion
|
|
82
|
-
}
|
|
83
|
-
else if (part.added) {
|
|
84
|
-
A.splice(doc, path, pos, 0, part.value);
|
|
85
|
-
pos += part.value.length;
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
// Unchanged text — just advance the cursor
|
|
89
|
-
pos += part.value.length;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
//# sourceMappingURL=text-diff.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"text-diff.js","sourceRoot":"","sources":["../../src/utils/text-diff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,CAAC,MAAM,sBAAsB,CAAA;AACzC,OAAO,KAAK,OAAO,MAAM,MAAM,CAAA;AAE/B;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,OAAgB;IAC9C,IAAI,OAAO,IAAI,IAAI;QAAE,OAAO,IAAI,CAAA;IAChC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,OA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E,CAAC,EAAE,UAAU,CAAC,CAAA;QACrC,OAAM;IACP,CAAC;IAED,qDAAqD;IACrD,IAAI,UAAU,KAAK,EAAE,EAAE,CAAC;QACvB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,CAAC,MAAM,CAAC,CAAA;QACzC,OAAM;IACP,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,UAAU,EAAE,UAAU,CAAC,CAAA;IAEzD,IAAI,GAAG,GAAG,CAAC,CAAA;IACX,KAAK,MAAM,IAAI,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YAClB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,CAAA;YAC3C,uDAAuD;QACxD,CAAC;aAAM,IAAI,IAAI,CAAC,KAAK,EAAE,CAAC;YACvB,CAAC,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;YACvC,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA;QACzB,CAAC;aAAM,CAAC;YACP,2CAA2C;YAC3C,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,MAAM,CAAA;QACzB,CAAC;IACF,CAAC;AACF,CAAC"}
|
package/dist/utils/trace.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Enable or disable tracing
|
|
3
|
-
*/
|
|
4
|
-
export declare function setTracingEnabled(enabled: boolean): void;
|
|
5
|
-
/**
|
|
6
|
-
* Check if tracing is enabled
|
|
7
|
-
*/
|
|
8
|
-
export declare function isTracingEnabled(): boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Trace a span of work by outputting to console
|
|
11
|
-
* Works for both sync and async functions
|
|
12
|
-
* Only outputs if tracing is enabled
|
|
13
|
-
*
|
|
14
|
-
* Usage:
|
|
15
|
-
* await span("operation", async () => { ... })
|
|
16
|
-
* span("operation", () => { ... })
|
|
17
|
-
*/
|
|
18
|
-
export declare function span<T>(name: string, fn: () => T | Promise<T>): T | Promise<T>;
|
|
19
|
-
//# sourceMappingURL=trace.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trace.d.ts","sourceRoot":"","sources":["../../src/utils/trace.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAExD;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,OAAO,CAE1C;AAED;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,CAAC,EACpB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,GACvB,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAqBhB"}
|
package/dist/utils/trace.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { out } from "./output.js";
|
|
2
|
-
/**
|
|
3
|
-
* Global tracing state
|
|
4
|
-
*/
|
|
5
|
-
let tracingEnabled = false;
|
|
6
|
-
/**
|
|
7
|
-
* Enable or disable tracing
|
|
8
|
-
*/
|
|
9
|
-
export function setTracingEnabled(enabled) {
|
|
10
|
-
tracingEnabled = enabled;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Check if tracing is enabled
|
|
14
|
-
*/
|
|
15
|
-
export function isTracingEnabled() {
|
|
16
|
-
return tracingEnabled;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Trace a span of work by outputting to console
|
|
20
|
-
* Works for both sync and async functions
|
|
21
|
-
* Only outputs if tracing is enabled
|
|
22
|
-
*
|
|
23
|
-
* Usage:
|
|
24
|
-
* await span("operation", async () => { ... })
|
|
25
|
-
* span("operation", () => { ... })
|
|
26
|
-
*/
|
|
27
|
-
export function span(name, fn) {
|
|
28
|
-
if (!tracingEnabled) {
|
|
29
|
-
return fn();
|
|
30
|
-
}
|
|
31
|
-
const start = performance.now();
|
|
32
|
-
const result = fn();
|
|
33
|
-
// Check if it's a promise (async)
|
|
34
|
-
if (result instanceof Promise) {
|
|
35
|
-
return result.then((value) => {
|
|
36
|
-
const duration = performance.now() - start;
|
|
37
|
-
out.taskLine(`${name} (${formatDuration(duration)})`, true);
|
|
38
|
-
return value;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
// Sync case
|
|
42
|
-
const duration = performance.now() - start;
|
|
43
|
-
out.taskLine(`${name} (${formatDuration(duration)})`, true);
|
|
44
|
-
return result;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Format duration for display
|
|
48
|
-
*/
|
|
49
|
-
function formatDuration(ms) {
|
|
50
|
-
if (ms < 1) {
|
|
51
|
-
return `${ms.toFixed(2)}ms`;
|
|
52
|
-
}
|
|
53
|
-
else if (ms < 1000) {
|
|
54
|
-
return `${Math.round(ms)}ms`;
|
|
55
|
-
}
|
|
56
|
-
else if (ms < 2000) {
|
|
57
|
-
return `${(ms / 1000).toFixed(2)}s`;
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
return `${(ms / 1000).toFixed(1)}s`;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=trace.js.map
|
package/dist/utils/trace.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trace.js","sourceRoot":"","sources":["../../src/utils/trace.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAElC;;GAEG;AACH,IAAI,cAAc,GAAG,KAAK,CAAC;AAE3B;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAgB;IAChD,cAAc,GAAG,OAAO,CAAC;AAC3B,CAAC;AAED;;GAEG;AACH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