@storybook/instrumenter 6.4.0-alpha.35

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.
@@ -0,0 +1,53 @@
1
+ import { Channel } from '@storybook/addons';
2
+ import { Call, CallRef, LogItem } from './types';
3
+ export declare const EVENTS: {
4
+ CALL: string;
5
+ SYNC: string;
6
+ START: string;
7
+ BACK: string;
8
+ GOTO: string;
9
+ NEXT: string;
10
+ END: string;
11
+ };
12
+ export interface Options {
13
+ intercept?: boolean | ((method: string, path: Array<string | CallRef>) => boolean);
14
+ retain?: boolean;
15
+ mutate?: boolean;
16
+ path?: Array<string | CallRef>;
17
+ }
18
+ export interface State {
19
+ isDebugging: boolean;
20
+ cursor: number;
21
+ calls: Call[];
22
+ shadowCalls: Call[];
23
+ callRefsByResult: Map<any, CallRef & {
24
+ retain: boolean;
25
+ }>;
26
+ chainedCallIds: Set<Call['id']>;
27
+ parentCallId?: Call['id'];
28
+ playUntil?: Call['id'];
29
+ resolvers: Record<Call['id'], Function>;
30
+ syncTimeout: ReturnType<typeof setTimeout>;
31
+ forwardedException?: Error;
32
+ }
33
+ export declare type PatchedObj<TObj> = {
34
+ [Property in keyof TObj]: TObj[Property] & {
35
+ _original: PatchedObj<TObj>;
36
+ };
37
+ };
38
+ export declare class Instrumenter {
39
+ channel: Channel;
40
+ state: State;
41
+ constructor();
42
+ setState(update: Partial<State> | ((state: State) => Partial<State>)): void;
43
+ getLog(): LogItem[];
44
+ instrument<TObj extends {
45
+ [x: string]: any;
46
+ }>(obj: TObj, options?: Options): PatchedObj<TObj>;
47
+ patch(method: string, fn: Function, options: Options): (...args: any[]) => PatchedObj<any>;
48
+ track(method: string, fn: Function, args: any[], { path, ...options }: Options): PatchedObj<any>;
49
+ intercept(fn: Function, call: Call): any;
50
+ invoke(fn: Function, call: Call): any;
51
+ sync(call: Call): void;
52
+ }
53
+ export declare const instrument: ((obj: any) => any) | (<TObj extends Record<string, any>>(obj: TObj, options?: Options) => PatchedObj<TObj>);
@@ -0,0 +1,37 @@
1
+ export interface Call {
2
+ id: string;
3
+ path: Array<string | CallRef>;
4
+ method: string;
5
+ args: any[];
6
+ interceptable: boolean;
7
+ retain: boolean;
8
+ state?: CallStates.DONE | CallStates.ERROR | CallStates.ACTIVE | CallStates.WAITING;
9
+ exception?: {
10
+ callId: Call['id'];
11
+ message: Error['message'];
12
+ stack: Error['stack'];
13
+ };
14
+ parentId?: Call['id'];
15
+ }
16
+ export declare enum CallStates {
17
+ DONE = "done",
18
+ ERROR = "error",
19
+ ACTIVE = "active",
20
+ WAITING = "waiting"
21
+ }
22
+ export interface CallRef {
23
+ __callId__: Call['id'];
24
+ }
25
+ export interface ElementRef {
26
+ __element__: {
27
+ prefix?: string;
28
+ localName: string;
29
+ id?: string;
30
+ classNames?: string[];
31
+ innerText?: string;
32
+ };
33
+ }
34
+ export interface LogItem {
35
+ callId: Call['id'];
36
+ state: Call['state'];
37
+ }
package/package.json ADDED
@@ -0,0 +1,52 @@
1
+ {
2
+ "name": "@storybook/instrumenter",
3
+ "version": "6.4.0-alpha.35",
4
+ "description": "",
5
+ "keywords": [
6
+ "storybook"
7
+ ],
8
+ "homepage": "https://github.com/storybookjs/storybook/tree/main/lib/instrumenter",
9
+ "bugs": {
10
+ "url": "https://github.com/storybookjs/storybook/issues"
11
+ },
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/storybookjs/storybook.git",
15
+ "directory": "lib/instrumenter"
16
+ },
17
+ "funding": {
18
+ "type": "opencollective",
19
+ "url": "https://opencollective.com/storybook"
20
+ },
21
+ "license": "MIT",
22
+ "sideEffects": false,
23
+ "main": "dist/cjs/index.js",
24
+ "module": "dist/esm/index.js",
25
+ "types": "dist/ts3.9/index.d.ts",
26
+ "typesVersions": {
27
+ "<3.8": {
28
+ "*": [
29
+ "dist/ts3.4/*"
30
+ ]
31
+ }
32
+ },
33
+ "files": [
34
+ "dist/**/*",
35
+ "README.md",
36
+ "*.js",
37
+ "*.d.ts"
38
+ ],
39
+ "scripts": {
40
+ "prepare": "node ../../scripts/prepare.js"
41
+ },
42
+ "dependencies": {
43
+ "@storybook/addons": "6.4.0-alpha.35",
44
+ "@storybook/core-events": "6.4.0-alpha.35",
45
+ "global": "^4.4.0"
46
+ },
47
+ "publishConfig": {
48
+ "access": "public"
49
+ },
50
+ "gitHead": "8f65635eb105c8ef3e6ffea3c9cf6668ad34705e",
51
+ "sbmodern": "dist/modern/index.js"
52
+ }