@elliemae/encw-heap-doctor 26.2.3 → 26.2.5
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/cjs/errors/index.js +1 -3
- package/dist/cjs/heapDoctor.js +0 -80
- package/dist/cjs/index.js +0 -2
- package/dist/esm/errors/index.js +1 -3
- package/dist/esm/heapDoctor.js +0 -70
- package/dist/esm/index.js +0 -2
- package/dist/types/lib/errors/index.d.ts +0 -1
- package/dist/types/lib/heapDoctor.d.ts +3 -17
- package/dist/types/lib/index.d.ts +1 -3
- package/dist/types/lib/types/index.d.ts +1 -2
- package/dist/types/lib/types/report.d.ts +0 -6
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -10
- package/dist/cjs/errors/scenarioError.js +0 -27
- package/dist/cjs/scenario/playwrightScenarioRunner.js +0 -118
- package/dist/cjs/types/scenario.js +0 -16
- package/dist/esm/errors/scenarioError.js +0 -7
- package/dist/esm/scenario/playwrightScenarioRunner.js +0 -88
- package/dist/esm/types/scenario.js +0 -0
- package/dist/types/lib/errors/scenarioError.d.ts +0 -5
- package/dist/types/lib/scenario/playwrightScenarioRunner.d.ts +0 -29
- package/dist/types/lib/types/scenario.d.ts +0 -28
package/dist/cjs/errors/index.js
CHANGED
|
@@ -19,10 +19,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var errors_exports = {};
|
|
20
20
|
__export(errors_exports, {
|
|
21
21
|
DomainError: () => import_domainError.DomainError,
|
|
22
|
-
ParseError: () => import_parseError.ParseError
|
|
23
|
-
ScenarioError: () => import_scenarioError.ScenarioError
|
|
22
|
+
ParseError: () => import_parseError.ParseError
|
|
24
23
|
});
|
|
25
24
|
module.exports = __toCommonJS(errors_exports);
|
|
26
25
|
var import_domainError = require("./domainError.js");
|
|
27
26
|
var import_parseError = require("./parseError.js");
|
|
28
|
-
var import_scenarioError = require("./scenarioError.js");
|
package/dist/cjs/heapDoctor.js
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
3
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
4
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
5
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
6
|
var __export = (target, all) => {
|
|
9
7
|
for (var name in all)
|
|
@@ -17,14 +15,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
15
|
}
|
|
18
16
|
return to;
|
|
19
17
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
19
|
var heapDoctor_exports = {};
|
|
30
20
|
__export(heapDoctor_exports, {
|
|
@@ -33,7 +23,6 @@ __export(heapDoctor_exports, {
|
|
|
33
23
|
module.exports = __toCommonJS(heapDoctor_exports);
|
|
34
24
|
var import_types = require("./types/index.js");
|
|
35
25
|
var import_domainError = require("./errors/domainError.js");
|
|
36
|
-
var import_scenarioError = require("./errors/scenarioError.js");
|
|
37
26
|
var import_snapshotParser = require("./core/snapshotParser.js");
|
|
38
27
|
var import_leakDetector = require("./analysis/leakDetector.js");
|
|
39
28
|
var import_retainerTracer = require("./analysis/retainerTracer.js");
|
|
@@ -137,76 +126,7 @@ class HeapDoctor {
|
|
|
137
126
|
throw error;
|
|
138
127
|
}
|
|
139
128
|
}
|
|
140
|
-
/**
|
|
141
|
-
* Run a browser scenario to capture snapshots, then compare them.
|
|
142
|
-
* @param {HeapDoctorScenario} scenario - The navigation scenario describing the user flow.
|
|
143
|
-
* @returns {Promise<Result<ScenarioReport>>} A Result containing the scenario report or a DomainError.
|
|
144
|
-
*/
|
|
145
|
-
async runScenario(scenario) {
|
|
146
|
-
try {
|
|
147
|
-
const { snapshotPaths } = await this.captureSnapshots(scenario);
|
|
148
|
-
const firstPath = snapshotPaths[0];
|
|
149
|
-
if (snapshotPaths.length < 2) {
|
|
150
|
-
if (!firstPath) {
|
|
151
|
-
return (0, import_types.err)(
|
|
152
|
-
new import_scenarioError.ScenarioError(
|
|
153
|
-
"No snapshots were captured by the scenario runner"
|
|
154
|
-
)
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
const singleResult = await this.analyse(firstPath);
|
|
158
|
-
if (!singleResult.ok) return singleResult;
|
|
159
|
-
return (0, import_types.ok)({
|
|
160
|
-
snapshotPaths,
|
|
161
|
-
comparison: {
|
|
162
|
-
beforePath: firstPath,
|
|
163
|
-
afterPath: firstPath,
|
|
164
|
-
beforeNodeCount: singleResult.value.nodeCount,
|
|
165
|
-
afterNodeCount: singleResult.value.nodeCount,
|
|
166
|
-
delta: {
|
|
167
|
-
newNodeCount: 0,
|
|
168
|
-
removedNodeCount: 0,
|
|
169
|
-
retainedSizeDelta: 0,
|
|
170
|
-
newLeakGroups: [],
|
|
171
|
-
detachedDomDelta: /* @__PURE__ */ new Map()
|
|
172
|
-
},
|
|
173
|
-
afterAnalysis: singleResult.value,
|
|
174
|
-
markdown: singleResult.value.markdown
|
|
175
|
-
},
|
|
176
|
-
markdown: singleResult.value.markdown
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
const beforePath = firstPath;
|
|
180
|
-
const afterPath = snapshotPaths.at(-1);
|
|
181
|
-
if (!beforePath || !afterPath) {
|
|
182
|
-
throw new import_scenarioError.ScenarioError(
|
|
183
|
-
"Unexpected: snapshotPaths is empty after length check"
|
|
184
|
-
);
|
|
185
|
-
}
|
|
186
|
-
const compResult = await this.compare(beforePath, afterPath);
|
|
187
|
-
if (!compResult.ok) return compResult;
|
|
188
|
-
return (0, import_types.ok)({
|
|
189
|
-
snapshotPaths,
|
|
190
|
-
comparison: compResult.value,
|
|
191
|
-
markdown: compResult.value.markdown
|
|
192
|
-
});
|
|
193
|
-
} catch (error) {
|
|
194
|
-
if (error instanceof import_domainError.DomainError) return (0, import_types.err)(error);
|
|
195
|
-
throw error;
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
129
|
// ── Internal helpers ──
|
|
199
|
-
/**
|
|
200
|
-
* Create the appropriate scenario runner based on the configured browser
|
|
201
|
-
* and execute the scenario.
|
|
202
|
-
* @param {HeapDoctorScenario} scenario - The navigation scenario to execute.
|
|
203
|
-
* @returns {Promise<CapturedSnapshots>} The captured snapshot file paths.
|
|
204
|
-
*/
|
|
205
|
-
async captureSnapshots(scenario) {
|
|
206
|
-
const { PlaywrightScenarioRunner } = await import("./scenario/playwrightScenarioRunner.js");
|
|
207
|
-
const runner = new PlaywrightScenarioRunner();
|
|
208
|
-
return runner.run(scenario);
|
|
209
|
-
}
|
|
210
130
|
buildLeakResults(leaks, snapshot) {
|
|
211
131
|
const results = [];
|
|
212
132
|
for (const leak of leaks) {
|
package/dist/cjs/index.js
CHANGED
|
@@ -21,7 +21,6 @@ __export(lib_exports, {
|
|
|
21
21
|
DomainError: () => import_domainError.DomainError,
|
|
22
22
|
HeapDoctor: () => import_heapDoctor.HeapDoctor,
|
|
23
23
|
ParseError: () => import_parseError.ParseError,
|
|
24
|
-
ScenarioError: () => import_scenarioError.ScenarioError,
|
|
25
24
|
generateAiPrompt: () => import_promptGenerator.generateAiPrompt
|
|
26
25
|
});
|
|
27
26
|
module.exports = __toCommonJS(lib_exports);
|
|
@@ -29,4 +28,3 @@ var import_heapDoctor = require("./heapDoctor.js");
|
|
|
29
28
|
var import_promptGenerator = require("./prompts/promptGenerator.js");
|
|
30
29
|
var import_domainError = require("./errors/domainError.js");
|
|
31
30
|
var import_parseError = require("./errors/parseError.js");
|
|
32
|
-
var import_scenarioError = require("./errors/scenarioError.js");
|
package/dist/esm/errors/index.js
CHANGED
package/dist/esm/heapDoctor.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ok, err } from "./types/index.js";
|
|
2
2
|
import { DomainError } from "./errors/domainError.js";
|
|
3
|
-
import { ScenarioError } from "./errors/scenarioError.js";
|
|
4
3
|
import { SnapshotParser } from "./core/snapshotParser.js";
|
|
5
4
|
import { LeakDetector } from "./analysis/leakDetector.js";
|
|
6
5
|
import { RetainerTracer } from "./analysis/retainerTracer.js";
|
|
@@ -104,76 +103,7 @@ class HeapDoctor {
|
|
|
104
103
|
throw error;
|
|
105
104
|
}
|
|
106
105
|
}
|
|
107
|
-
/**
|
|
108
|
-
* Run a browser scenario to capture snapshots, then compare them.
|
|
109
|
-
* @param {HeapDoctorScenario} scenario - The navigation scenario describing the user flow.
|
|
110
|
-
* @returns {Promise<Result<ScenarioReport>>} A Result containing the scenario report or a DomainError.
|
|
111
|
-
*/
|
|
112
|
-
async runScenario(scenario) {
|
|
113
|
-
try {
|
|
114
|
-
const { snapshotPaths } = await this.captureSnapshots(scenario);
|
|
115
|
-
const firstPath = snapshotPaths[0];
|
|
116
|
-
if (snapshotPaths.length < 2) {
|
|
117
|
-
if (!firstPath) {
|
|
118
|
-
return err(
|
|
119
|
-
new ScenarioError(
|
|
120
|
-
"No snapshots were captured by the scenario runner"
|
|
121
|
-
)
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
const singleResult = await this.analyse(firstPath);
|
|
125
|
-
if (!singleResult.ok) return singleResult;
|
|
126
|
-
return ok({
|
|
127
|
-
snapshotPaths,
|
|
128
|
-
comparison: {
|
|
129
|
-
beforePath: firstPath,
|
|
130
|
-
afterPath: firstPath,
|
|
131
|
-
beforeNodeCount: singleResult.value.nodeCount,
|
|
132
|
-
afterNodeCount: singleResult.value.nodeCount,
|
|
133
|
-
delta: {
|
|
134
|
-
newNodeCount: 0,
|
|
135
|
-
removedNodeCount: 0,
|
|
136
|
-
retainedSizeDelta: 0,
|
|
137
|
-
newLeakGroups: [],
|
|
138
|
-
detachedDomDelta: /* @__PURE__ */ new Map()
|
|
139
|
-
},
|
|
140
|
-
afterAnalysis: singleResult.value,
|
|
141
|
-
markdown: singleResult.value.markdown
|
|
142
|
-
},
|
|
143
|
-
markdown: singleResult.value.markdown
|
|
144
|
-
});
|
|
145
|
-
}
|
|
146
|
-
const beforePath = firstPath;
|
|
147
|
-
const afterPath = snapshotPaths.at(-1);
|
|
148
|
-
if (!beforePath || !afterPath) {
|
|
149
|
-
throw new ScenarioError(
|
|
150
|
-
"Unexpected: snapshotPaths is empty after length check"
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
const compResult = await this.compare(beforePath, afterPath);
|
|
154
|
-
if (!compResult.ok) return compResult;
|
|
155
|
-
return ok({
|
|
156
|
-
snapshotPaths,
|
|
157
|
-
comparison: compResult.value,
|
|
158
|
-
markdown: compResult.value.markdown
|
|
159
|
-
});
|
|
160
|
-
} catch (error) {
|
|
161
|
-
if (error instanceof DomainError) return err(error);
|
|
162
|
-
throw error;
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
106
|
// ── Internal helpers ──
|
|
166
|
-
/**
|
|
167
|
-
* Create the appropriate scenario runner based on the configured browser
|
|
168
|
-
* and execute the scenario.
|
|
169
|
-
* @param {HeapDoctorScenario} scenario - The navigation scenario to execute.
|
|
170
|
-
* @returns {Promise<CapturedSnapshots>} The captured snapshot file paths.
|
|
171
|
-
*/
|
|
172
|
-
async captureSnapshots(scenario) {
|
|
173
|
-
const { PlaywrightScenarioRunner } = await import("./scenario/playwrightScenarioRunner.js");
|
|
174
|
-
const runner = new PlaywrightScenarioRunner();
|
|
175
|
-
return runner.run(scenario);
|
|
176
|
-
}
|
|
177
107
|
buildLeakResults(leaks, snapshot) {
|
|
178
108
|
const results = [];
|
|
179
109
|
for (const leak of leaks) {
|
package/dist/esm/index.js
CHANGED
|
@@ -2,11 +2,9 @@ import { HeapDoctor } from "./heapDoctor.js";
|
|
|
2
2
|
import { generateAiPrompt } from "./prompts/promptGenerator.js";
|
|
3
3
|
import { DomainError } from "./errors/domainError.js";
|
|
4
4
|
import { ParseError } from "./errors/parseError.js";
|
|
5
|
-
import { ScenarioError } from "./errors/scenarioError.js";
|
|
6
5
|
export {
|
|
7
6
|
DomainError,
|
|
8
7
|
HeapDoctor,
|
|
9
8
|
ParseError,
|
|
10
|
-
ScenarioError,
|
|
11
9
|
generateAiPrompt
|
|
12
10
|
};
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Result } from './types/index.js';
|
|
2
|
-
import type { AnalysisReport, ComparisonReport
|
|
3
|
-
import type { HeapDoctorScenario } from './types/scenario.js';
|
|
2
|
+
import type { AnalysisReport, ComparisonReport } from './types/report.js';
|
|
4
3
|
/** Configuration for HeapDoctor construction. */
|
|
5
4
|
export interface HeapDoctorConfig {
|
|
6
5
|
/** Default number of top leak groups to report. */
|
|
@@ -9,8 +8,8 @@ export interface HeapDoctorConfig {
|
|
|
9
8
|
/**
|
|
10
9
|
* Public facade for heap snapshot analysis.
|
|
11
10
|
*
|
|
12
|
-
* Composes all internal service classes and exposes
|
|
13
|
-
* `analyse()
|
|
11
|
+
* Composes all internal service classes and exposes two high-level methods:
|
|
12
|
+
* `analyse()` and `compare()`. Both return `Result<T>` for
|
|
14
13
|
* recoverable error handling.
|
|
15
14
|
* @example
|
|
16
15
|
* ```ts
|
|
@@ -42,19 +41,6 @@ export declare class HeapDoctor {
|
|
|
42
41
|
* @returns {Promise<Result<ComparisonReport>>} A Result containing the comparison report or a DomainError.
|
|
43
42
|
*/
|
|
44
43
|
compare(beforePath: string, afterPath: string): Promise<Result<ComparisonReport>>;
|
|
45
|
-
/**
|
|
46
|
-
* Run a browser scenario to capture snapshots, then compare them.
|
|
47
|
-
* @param {HeapDoctorScenario} scenario - The navigation scenario describing the user flow.
|
|
48
|
-
* @returns {Promise<Result<ScenarioReport>>} A Result containing the scenario report or a DomainError.
|
|
49
|
-
*/
|
|
50
|
-
runScenario(scenario: HeapDoctorScenario): Promise<Result<ScenarioReport>>;
|
|
51
|
-
/**
|
|
52
|
-
* Create the appropriate scenario runner based on the configured browser
|
|
53
|
-
* and execute the scenario.
|
|
54
|
-
* @param {HeapDoctorScenario} scenario - The navigation scenario to execute.
|
|
55
|
-
* @returns {Promise<CapturedSnapshots>} The captured snapshot file paths.
|
|
56
|
-
*/
|
|
57
|
-
private captureSnapshots;
|
|
58
44
|
private buildLeakResults;
|
|
59
45
|
private static computeFixPriority;
|
|
60
46
|
}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export { HeapDoctor } from './heapDoctor.js';
|
|
2
2
|
export type { HeapDoctorConfig } from './heapDoctor.js';
|
|
3
3
|
export type { Result, NodeIndex, EdgeIndex, NodeId, Severity, StepType, LeakReason, } from './types/index.js';
|
|
4
|
-
export type { AnalysisReport, ComparisonReport
|
|
4
|
+
export type { AnalysisReport, ComparisonReport } from './types/report.js';
|
|
5
5
|
export type { LeakGroup, LeakElement, RetainerChain, RetainerStep, LeakPatterns, MatchedPattern, Suggestion, } from './types/leak.js';
|
|
6
|
-
export type { HeapDoctorScenario } from './types/scenario.js';
|
|
7
6
|
export { generateAiPrompt } from './prompts/promptGenerator.js';
|
|
8
7
|
export { DomainError } from './errors/domainError.js';
|
|
9
8
|
export { ParseError } from './errors/parseError.js';
|
|
10
|
-
export { ScenarioError } from './errors/scenarioError.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { DomainError } from '../errors/domainError.js';
|
|
2
|
-
export type { AnalysisReport, ComparisonReport
|
|
2
|
+
export type { AnalysisReport, ComparisonReport } from './report.js';
|
|
3
3
|
export type { LeakGroup, LeakElement, RetainerChain, RetainerStep, LeakPatterns, MatchedPattern, Suggestion, ChainContext, } from './leak.js';
|
|
4
|
-
export type { HeapDoctorScenario } from './scenario.js';
|
|
5
4
|
/**
|
|
6
5
|
* Discriminated union for recoverable operation results.
|
|
7
6
|
* Prefer returning Result<T> over throwing for expected failure modes.
|
|
@@ -47,9 +47,3 @@ export interface ComparisonReport {
|
|
|
47
47
|
readonly afterAnalysis: AnalysisReport;
|
|
48
48
|
readonly markdown: string;
|
|
49
49
|
}
|
|
50
|
-
/** Report returned by HeapDoctor.runScenario(). */
|
|
51
|
-
export interface ScenarioReport {
|
|
52
|
-
readonly snapshotPaths: readonly string[];
|
|
53
|
-
readonly comparison: ComparisonReport;
|
|
54
|
-
readonly markdown: string;
|
|
55
|
-
}
|