@alwaysmeticulous/backend-recorder-workerd 2.327.0 → 2.330.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 +36 -0
- package/dist/context.js +2 -2
- package/dist/context.js.map +1 -1
- package/dist/coverage/coverage.types.d.ts +32 -0
- package/dist/coverage/replay-coverage.js +84 -0
- package/dist/coverage/replay-coverage.js.map +1 -0
- package/dist/coverage/runtime.d.ts +70 -0
- package/dist/coverage/runtime.js +138 -0
- package/dist/coverage/runtime.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/protocol.d.ts +36 -1
- package/dist/protocol.js +19 -3
- package/dist/protocol.js.map +1 -1
- package/dist/publish-shim-version.js +37 -0
- package/dist/publish-shim-version.js.map +1 -0
- package/dist/replay-log-tagging.js +57 -0
- package/dist/replay-log-tagging.js.map +1 -0
- package/dist/sidecar-client.js +45 -4
- package/dist/sidecar-client.js.map +1 -1
- package/dist/version.d.ts +14 -0
- package/dist/version.js +18 -0
- package/dist/version.js.map +1 -0
- package/dist/virtual-random.js +17 -25
- package/dist/virtual-random.js.map +1 -1
- package/dist/vite/index.d.ts +62 -0
- package/dist/vite/index.js +6764 -0
- package/dist/vite/index.js.map +1 -0
- package/dist/with-meticulous.js +0 -0
- package/dist/with-meticulous.js.map +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
//#region src/vite/index.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Vite plugin that instruments a Worker's server modules for Meticulous line
|
|
4
|
+
* coverage.
|
|
5
|
+
*
|
|
6
|
+
* Add it to the build you upload for testing — not the one you ship:
|
|
7
|
+
*
|
|
8
|
+
* import { meticulousCoverage } from "@alwaysmeticulous/backend-recorder-workerd/vite";
|
|
9
|
+
* export default defineConfig({ plugins: [meticulousCoverage()] });
|
|
10
|
+
*
|
|
11
|
+
* `enforce: "post"` is deliberate: by then Vite's esbuild pass has already
|
|
12
|
+
* stripped TypeScript and JSX, so the instrumenter only ever sees plain JS and
|
|
13
|
+
* needs no TS-aware parser. Anything it still cannot parse is passed through
|
|
14
|
+
* untouched — coverage is never worth failing a customer's build for.
|
|
15
|
+
*
|
|
16
|
+
* The cost of running last is that AST line numbers are lines in the re-printed
|
|
17
|
+
* module, not in the file the customer wrote — that pass drops comments and
|
|
18
|
+
* blank lines, which on a commented codebase shifts nearly every statement. So
|
|
19
|
+
* each marker's line is resolved back through `getCombinedSourcemap()`, the
|
|
20
|
+
* transform chain's accumulated map, which is only available here in the
|
|
21
|
+
* transform hook.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The slice of Vite's transform-hook context this uses. Optional because the
|
|
25
|
+
* plugin must still work when called without one — a bare `plugin.transform(...)`
|
|
26
|
+
* in a test, or a host that does not provide the hook.
|
|
27
|
+
*/
|
|
28
|
+
interface TransformContextLike {
|
|
29
|
+
getCombinedSourcemap?: () => unknown;
|
|
30
|
+
}
|
|
31
|
+
/** Structural subset of a Vite plugin — avoids depending on vite's types. */
|
|
32
|
+
interface VitePluginLike {
|
|
33
|
+
name: string;
|
|
34
|
+
enforce?: "pre" | "post";
|
|
35
|
+
configResolved?: (config: {
|
|
36
|
+
root?: string;
|
|
37
|
+
}) => void;
|
|
38
|
+
transform?: (this: TransformContextLike | undefined, code: string, id: string, options?: {
|
|
39
|
+
ssr?: boolean;
|
|
40
|
+
}) => {
|
|
41
|
+
code: string;
|
|
42
|
+
map: string;
|
|
43
|
+
} | null;
|
|
44
|
+
buildEnd?: () => void;
|
|
45
|
+
}
|
|
46
|
+
interface MeticulousCoverageOptions {
|
|
47
|
+
/**
|
|
48
|
+
* Instrument client modules too. Off by default: only the server build runs
|
|
49
|
+
* inside workerd, and it is the only side Meticulous replays.
|
|
50
|
+
*/
|
|
51
|
+
includeClient?: boolean;
|
|
52
|
+
/** Extra paths to leave uninstrumented, on top of node_modules and virtual modules. */
|
|
53
|
+
exclude?: RegExp[];
|
|
54
|
+
/** Overrides where the injected runtime import points (tests use this). */
|
|
55
|
+
runtimeModuleId?: string;
|
|
56
|
+
/** Receives a warning when the build produced no instrumentation at all. */
|
|
57
|
+
onWarning?: (message: string) => void;
|
|
58
|
+
}
|
|
59
|
+
declare const meticulousCoverage: (options?: MeticulousCoverageOptions) => VitePluginLike;
|
|
60
|
+
//#endregion
|
|
61
|
+
export { MeticulousCoverageOptions, TransformContextLike, VitePluginLike, meticulousCoverage };
|
|
62
|
+
//# sourceMappingURL=index.d.ts.map
|