@fluixi/devtools 0.2.0-alpha.2 → 0.2.0-alpha.4
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 +80 -2
- package/dist/callsite.cjs +72 -0
- package/dist/callsite.d.ts +22 -0
- package/dist/callsite.d.ts.map +1 -0
- package/dist/callsite.js +82 -0
- package/dist/callsite.mjs +51 -0
- package/dist/change-view.cjs +134 -0
- package/dist/change-view.d.ts +10 -0
- package/dist/change-view.d.ts.map +1 -0
- package/dist/change-view.js +102 -0
- package/dist/change-view.mjs +111 -0
- package/dist/copy.cjs +63 -0
- package/dist/copy.d.ts +9 -0
- package/dist/copy.d.ts.map +1 -0
- package/dist/copy.js +52 -0
- package/dist/copy.mjs +42 -0
- package/dist/describe.cjs +55 -0
- package/dist/describe.d.ts +3 -0
- package/dist/describe.d.ts.map +1 -0
- package/dist/describe.js +47 -0
- package/dist/describe.mjs +34 -0
- package/dist/detail-panel.cjs +307 -0
- package/dist/detail-panel.d.ts +17 -0
- package/dist/detail-panel.d.ts.map +1 -0
- package/dist/detail-panel.js +217 -0
- package/dist/detail-panel.mjs +284 -0
- package/dist/diff.cjs +225 -0
- package/dist/diff.d.ts +31 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +132 -0
- package/dist/diff.mjs +202 -0
- package/dist/dom.cjs +204 -0
- package/dist/dom.d.ts +81 -0
- package/dist/dom.d.ts.map +1 -0
- package/dist/dom.js +269 -0
- package/dist/dom.mjs +183 -0
- package/dist/export.cjs +221 -0
- package/dist/export.d.ts +55 -0
- package/dist/export.d.ts.map +1 -0
- package/dist/export.js +90 -0
- package/dist/export.mjs +209 -0
- package/dist/float.cjs +232 -0
- package/dist/float.d.ts +54 -0
- package/dist/float.d.ts.map +1 -0
- package/dist/float.js +256 -0
- package/dist/float.mjs +211 -0
- package/dist/format.cjs +175 -0
- package/dist/format.d.ts +16 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +188 -0
- package/dist/format.mjs +154 -0
- package/dist/graph-view.cjs +893 -0
- package/dist/graph-view.d.ts +79 -2
- package/dist/graph-view.d.ts.map +1 -1
- package/dist/graph-view.js +866 -50
- package/dist/graph-view.mjs +870 -0
- package/dist/highlight.cjs +140 -0
- package/dist/highlight.d.ts +56 -0
- package/dist/highlight.d.ts.map +1 -0
- package/dist/highlight.js +154 -0
- package/dist/highlight.mjs +119 -0
- package/dist/history.cjs +95 -0
- package/dist/history.d.ts +59 -0
- package/dist/history.d.ts.map +1 -0
- package/dist/history.js +85 -0
- package/dist/history.mjs +74 -0
- package/dist/hook.cjs +1562 -0
- package/dist/hook.d.ts +60 -0
- package/dist/hook.d.ts.map +1 -0
- package/dist/hook.js +142 -0
- package/dist/hook.mjs +1553 -0
- package/dist/index.cjs +4552 -0
- package/dist/index.d.ts +44 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +25 -1
- package/dist/index.mjs +4544 -0
- package/dist/inspector.cjs +688 -0
- package/dist/inspector.d.ts +60 -0
- package/dist/inspector.d.ts.map +1 -0
- package/dist/inspector.js +415 -0
- package/dist/inspector.mjs +676 -0
- package/dist/instrument.cjs +497 -0
- package/dist/instrument.d.ts +147 -5
- package/dist/instrument.d.ts.map +1 -1
- package/dist/instrument.js +164 -44
- package/dist/instrument.mjs +487 -0
- package/dist/kind-filter.cjs +172 -0
- package/dist/kind-filter.d.ts +39 -0
- package/dist/kind-filter.d.ts.map +1 -0
- package/dist/kind-filter.js +151 -0
- package/dist/kind-filter.mjs +151 -0
- package/dist/menu.cjs +141 -0
- package/dist/menu.d.ts +37 -0
- package/dist/menu.d.ts.map +1 -0
- package/dist/menu.js +125 -0
- package/dist/menu.mjs +120 -0
- package/dist/observe.cjs +1352 -0
- package/dist/observe.d.ts +80 -0
- package/dist/observe.d.ts.map +1 -0
- package/dist/observe.js +893 -0
- package/dist/observe.mjs +1345 -0
- package/dist/palette.cjs +52 -0
- package/dist/palette.d.ts +11 -0
- package/dist/palette.d.ts.map +1 -0
- package/dist/palette.js +27 -0
- package/dist/palette.mjs +31 -0
- package/dist/path.cjs +45 -0
- package/dist/path.d.ts +19 -0
- package/dist/path.d.ts.map +1 -0
- package/dist/path.js +49 -0
- package/dist/path.mjs +24 -0
- package/dist/plugin.cjs +87 -0
- package/dist/plugin.d.ts +121 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/plugin.js +74 -0
- package/dist/plugin.mjs +66 -0
- package/dist/plugins/context.cjs +98 -0
- package/dist/plugins/context.d.ts +10 -0
- package/dist/plugins/context.d.ts.map +1 -0
- package/dist/plugins/context.js +80 -0
- package/dist/plugins/context.mjs +75 -0
- package/dist/plugins/directives.cjs +98 -0
- package/dist/plugins/directives.d.ts +25 -0
- package/dist/plugins/directives.d.ts.map +1 -0
- package/dist/plugins/directives.js +78 -0
- package/dist/plugins/directives.mjs +75 -0
- package/dist/plugins/index.cjs +162 -0
- package/dist/plugins/index.d.ts +7 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +9 -0
- package/dist/plugins/index.mjs +140 -0
- package/dist/source.cjs +111 -0
- package/dist/source.d.ts +72 -0
- package/dist/source.d.ts.map +1 -0
- package/dist/source.js +153 -0
- package/dist/source.mjs +90 -0
- package/dist/timeline.cjs +350 -0
- package/dist/timeline.d.ts +30 -0
- package/dist/timeline.d.ts.map +1 -0
- package/dist/timeline.js +271 -0
- package/dist/timeline.mjs +327 -0
- package/dist/tree.cjs +574 -0
- package/dist/tree.d.ts +128 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/tree.js +645 -0
- package/dist/tree.mjs +551 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/value-pane.cjs +223 -0
- package/dist/value-pane.d.ts +10 -0
- package/dist/value-pane.d.ts.map +1 -0
- package/dist/value-pane.js +61 -0
- package/dist/value-pane.mjs +200 -0
- package/dist/wire.cjs +109 -0
- package/dist/wire.d.ts +100 -0
- package/dist/wire.d.ts.map +1 -0
- package/dist/wire.js +93 -0
- package/dist/wire.mjs +89 -0
- package/package.json +17 -5
package/dist/palette.cjs
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/palette.ts
|
|
21
|
+
var palette_exports = {};
|
|
22
|
+
__export(palette_exports, {
|
|
23
|
+
KIND_COLOR: () => KIND_COLOR,
|
|
24
|
+
kindColor: () => kindColor,
|
|
25
|
+
kindRules: () => kindRules,
|
|
26
|
+
kindVar: () => kindVar
|
|
27
|
+
});
|
|
28
|
+
module.exports = __toCommonJS(palette_exports);
|
|
29
|
+
var KIND_COLOR = {
|
|
30
|
+
state: "#34d399",
|
|
31
|
+
memo: "#a78bfa",
|
|
32
|
+
effect: "#fbbf24",
|
|
33
|
+
store: "#38bdf8",
|
|
34
|
+
resource: "#fb7185",
|
|
35
|
+
component: "#f0abfc",
|
|
36
|
+
provider: "#fb923c",
|
|
37
|
+
control: "#22d3ee",
|
|
38
|
+
router: "#818cf8",
|
|
39
|
+
handler: "#f472b6",
|
|
40
|
+
context: "#a3e635",
|
|
41
|
+
directive: "#5eead4",
|
|
42
|
+
binding: "#5eead4",
|
|
43
|
+
setter: "#fb7185",
|
|
44
|
+
group: "#8a90a2",
|
|
45
|
+
element: "#8a90a2"
|
|
46
|
+
};
|
|
47
|
+
var kindVar = (kind) => `--fx-kind-${kind}`;
|
|
48
|
+
var kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
|
|
49
|
+
var KINDS = Object.keys(KIND_COLOR);
|
|
50
|
+
function kindRules(selector, property) {
|
|
51
|
+
return KINDS.map((kind) => `${selector(kind)} { ${property}: ${kindColor(kind)}; }`).join("\n");
|
|
52
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { NodeKind } from './instrument.js';
|
|
2
|
+
/** Element rows exist only in the tree, which is why this is wider than NodeKind. */
|
|
3
|
+
export type ColouredKind = NodeKind | 'element';
|
|
4
|
+
export declare const KIND_COLOR: Record<ColouredKind, string>;
|
|
5
|
+
/** The variable a host can set to override one, per kind. */
|
|
6
|
+
export declare const kindVar: (kind: ColouredKind) => string;
|
|
7
|
+
/** `var(--fx-kind-memo, #a78bfa)`, so a host may theme it and nothing breaks if it does not. */
|
|
8
|
+
export declare const kindColor: (kind: ColouredKind) => string;
|
|
9
|
+
/** One rule per kind, built from the table so a new kind cannot be missed in one host. */
|
|
10
|
+
export declare function kindRules(selector: (kind: ColouredKind) => string, property: string): string;
|
|
11
|
+
//# sourceMappingURL=palette.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"palette.d.ts","sourceRoot":"","sources":["../src/palette.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAEhD,qFAAqF;AACrF,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEhD,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAiBnD,CAAC;AAEF,6DAA6D;AAC7D,eAAO,MAAM,OAAO,GAAI,MAAM,YAAY,KAAG,MAA6B,CAAC;AAE3E,gGAAgG;AAChG,eAAO,MAAM,SAAS,GAAI,MAAM,YAAY,KAAG,MACD,CAAC;AAI/C,0FAA0F;AAC1F,wBAAgB,SAAS,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAE5F"}
|
package/dist/palette.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export const KIND_COLOR = {
|
|
2
|
+
state: '#34d399',
|
|
3
|
+
memo: '#a78bfa',
|
|
4
|
+
effect: '#fbbf24',
|
|
5
|
+
store: '#38bdf8',
|
|
6
|
+
resource: '#fb7185',
|
|
7
|
+
component: '#f0abfc',
|
|
8
|
+
provider: '#fb923c',
|
|
9
|
+
control: '#22d3ee',
|
|
10
|
+
router: '#818cf8',
|
|
11
|
+
handler: '#f472b6',
|
|
12
|
+
context: '#a3e635',
|
|
13
|
+
directive: '#5eead4',
|
|
14
|
+
binding: '#5eead4',
|
|
15
|
+
setter: '#fb7185',
|
|
16
|
+
group: '#8a90a2',
|
|
17
|
+
element: '#8a90a2',
|
|
18
|
+
};
|
|
19
|
+
/** The variable a host can set to override one, per kind. */
|
|
20
|
+
export const kindVar = (kind) => `--fx-kind-${kind}`;
|
|
21
|
+
/** `var(--fx-kind-memo, #a78bfa)`, so a host may theme it and nothing breaks if it does not. */
|
|
22
|
+
export const kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
|
|
23
|
+
const KINDS = Object.keys(KIND_COLOR);
|
|
24
|
+
/** One rule per kind, built from the table so a new kind cannot be missed in one host. */
|
|
25
|
+
export function kindRules(selector, property) {
|
|
26
|
+
return KINDS.map((kind) => `${selector(kind)} { ${property}: ${kindColor(kind)}; }`).join('\n');
|
|
27
|
+
}
|
package/dist/palette.mjs
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// src/palette.ts
|
|
2
|
+
var KIND_COLOR = {
|
|
3
|
+
state: "#34d399",
|
|
4
|
+
memo: "#a78bfa",
|
|
5
|
+
effect: "#fbbf24",
|
|
6
|
+
store: "#38bdf8",
|
|
7
|
+
resource: "#fb7185",
|
|
8
|
+
component: "#f0abfc",
|
|
9
|
+
provider: "#fb923c",
|
|
10
|
+
control: "#22d3ee",
|
|
11
|
+
router: "#818cf8",
|
|
12
|
+
handler: "#f472b6",
|
|
13
|
+
context: "#a3e635",
|
|
14
|
+
directive: "#5eead4",
|
|
15
|
+
binding: "#5eead4",
|
|
16
|
+
setter: "#fb7185",
|
|
17
|
+
group: "#8a90a2",
|
|
18
|
+
element: "#8a90a2"
|
|
19
|
+
};
|
|
20
|
+
var kindVar = (kind) => `--fx-kind-${kind}`;
|
|
21
|
+
var kindColor = (kind) => `var(${kindVar(kind)}, ${KIND_COLOR[kind]})`;
|
|
22
|
+
var KINDS = Object.keys(KIND_COLOR);
|
|
23
|
+
function kindRules(selector, property) {
|
|
24
|
+
return KINDS.map((kind) => `${selector(kind)} { ${property}: ${kindColor(kind)}; }`).join("\n");
|
|
25
|
+
}
|
|
26
|
+
export {
|
|
27
|
+
KIND_COLOR,
|
|
28
|
+
kindColor,
|
|
29
|
+
kindRules,
|
|
30
|
+
kindVar
|
|
31
|
+
};
|
package/dist/path.cjs
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/path.ts
|
|
21
|
+
var path_exports = {};
|
|
22
|
+
__export(path_exports, {
|
|
23
|
+
shortenPath: () => shortenPath
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(path_exports);
|
|
26
|
+
var normalize = (file) => file.replace(/\\/g, "/");
|
|
27
|
+
var ROOTED = /^\/|^(Users|home|var|opt|private|tmp|mnt|srv)\//;
|
|
28
|
+
var WORKSPACE_DIRS = /* @__PURE__ */ new Set(["packages", "apps", "libs", "examples"]);
|
|
29
|
+
function shortenPath(file, root) {
|
|
30
|
+
const path = normalize(file);
|
|
31
|
+
if (root) {
|
|
32
|
+
const base = normalize(root).replace(/\/+$/, "");
|
|
33
|
+
if (base && path.startsWith(`${base}/`)) return path.slice(base.length + 1);
|
|
34
|
+
if (base.startsWith("/") && path.startsWith(`${base.slice(1)}/`)) return path.slice(base.length);
|
|
35
|
+
}
|
|
36
|
+
const installed = path.lastIndexOf("node_modules/");
|
|
37
|
+
if (installed >= 0) return path.slice(installed + "node_modules/".length);
|
|
38
|
+
if (ROOTED.test(path)) {
|
|
39
|
+
const segments = path.split("/");
|
|
40
|
+
for (let i = segments.length - 2; i > 0; i--) {
|
|
41
|
+
if (WORKSPACE_DIRS.has(segments[i])) return segments.slice(i).join("/");
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return path;
|
|
45
|
+
}
|
package/dist/path.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Showing a file path at the length a reader wants.
|
|
3
|
+
*
|
|
4
|
+
* A node the framework made carries the path of the file that made it, on the machine that
|
|
5
|
+
* ran it: `/Users/someone/work/app/packages/dom/src/lib/dom/runtime.ts`. All of it before
|
|
6
|
+
* the package name says nothing about the project, and it is most of the line.
|
|
7
|
+
*
|
|
8
|
+
* The full path is kept for opening the file — only what is displayed is shortened.
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* The part of `file` worth showing.
|
|
12
|
+
*
|
|
13
|
+
* Tried in order: below the project root when the host knows it, then the package a
|
|
14
|
+
* node_modules path names, then the workspace package a monorepo path names. A path that
|
|
15
|
+
* matches none of those is left as it is — guessing at a shorter form would hide which file
|
|
16
|
+
* it is, and the point of the line is to say that.
|
|
17
|
+
*/
|
|
18
|
+
export declare function shortenPath(file: string, root?: string): string;
|
|
19
|
+
//# sourceMappingURL=path.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"path.d.ts","sourceRoot":"","sources":["../src/path.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAWH;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAyB/D"}
|
package/dist/path.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Showing a file path at the length a reader wants.
|
|
3
|
+
*
|
|
4
|
+
* A node the framework made carries the path of the file that made it, on the machine that
|
|
5
|
+
* ran it: `/Users/someone/work/app/packages/dom/src/lib/dom/runtime.ts`. All of it before
|
|
6
|
+
* the package name says nothing about the project, and it is most of the line.
|
|
7
|
+
*
|
|
8
|
+
* The full path is kept for opening the file — only what is displayed is shortened.
|
|
9
|
+
*/
|
|
10
|
+
/** Windows separators, and the leading slash an origin-stripped path can lose. */
|
|
11
|
+
const normalize = (file) => file.replace(/\\/g, '/');
|
|
12
|
+
/** `Users/…`, `home/…`: an absolute path whose leading slash was trimmed off. */
|
|
13
|
+
const ROOTED = /^\/|^(Users|home|var|opt|private|tmp|mnt|srv)\//;
|
|
14
|
+
/** Where a monorepo keeps the things it builds. */
|
|
15
|
+
const WORKSPACE_DIRS = new Set(['packages', 'apps', 'libs', 'examples']);
|
|
16
|
+
/**
|
|
17
|
+
* The part of `file` worth showing.
|
|
18
|
+
*
|
|
19
|
+
* Tried in order: below the project root when the host knows it, then the package a
|
|
20
|
+
* node_modules path names, then the workspace package a monorepo path names. A path that
|
|
21
|
+
* matches none of those is left as it is — guessing at a shorter form would hide which file
|
|
22
|
+
* it is, and the point of the line is to say that.
|
|
23
|
+
*/
|
|
24
|
+
export function shortenPath(file, root) {
|
|
25
|
+
const path = normalize(file);
|
|
26
|
+
if (root) {
|
|
27
|
+
const base = normalize(root).replace(/\/+$/, '');
|
|
28
|
+
if (base && path.startsWith(`${base}/`))
|
|
29
|
+
return path.slice(base.length + 1);
|
|
30
|
+
// The path lost its leading slash on the way here; the root still has one.
|
|
31
|
+
if (base.startsWith('/') && path.startsWith(`${base.slice(1)}/`))
|
|
32
|
+
return path.slice(base.length);
|
|
33
|
+
}
|
|
34
|
+
// Everything up to the last node_modules is the machine's, not the project's.
|
|
35
|
+
const installed = path.lastIndexOf('node_modules/');
|
|
36
|
+
if (installed >= 0)
|
|
37
|
+
return path.slice(installed + 'node_modules/'.length);
|
|
38
|
+
// A monorepo package, which is where a framework's own files sit while it is worked on.
|
|
39
|
+
// The last of these wins: a checkout under `~/Developer/libs` has one in the machine's
|
|
40
|
+
// part of the path as well as the project's, and the project's is the one meant.
|
|
41
|
+
if (ROOTED.test(path)) {
|
|
42
|
+
const segments = path.split('/');
|
|
43
|
+
for (let i = segments.length - 2; i > 0; i--) {
|
|
44
|
+
if (WORKSPACE_DIRS.has(segments[i]))
|
|
45
|
+
return segments.slice(i).join('/');
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return path;
|
|
49
|
+
}
|
package/dist/path.mjs
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/path.ts
|
|
2
|
+
var normalize = (file) => file.replace(/\\/g, "/");
|
|
3
|
+
var ROOTED = /^\/|^(Users|home|var|opt|private|tmp|mnt|srv)\//;
|
|
4
|
+
var WORKSPACE_DIRS = /* @__PURE__ */ new Set(["packages", "apps", "libs", "examples"]);
|
|
5
|
+
function shortenPath(file, root) {
|
|
6
|
+
const path = normalize(file);
|
|
7
|
+
if (root) {
|
|
8
|
+
const base = normalize(root).replace(/\/+$/, "");
|
|
9
|
+
if (base && path.startsWith(`${base}/`)) return path.slice(base.length + 1);
|
|
10
|
+
if (base.startsWith("/") && path.startsWith(`${base.slice(1)}/`)) return path.slice(base.length);
|
|
11
|
+
}
|
|
12
|
+
const installed = path.lastIndexOf("node_modules/");
|
|
13
|
+
if (installed >= 0) return path.slice(installed + "node_modules/".length);
|
|
14
|
+
if (ROOTED.test(path)) {
|
|
15
|
+
const segments = path.split("/");
|
|
16
|
+
for (let i = segments.length - 2; i > 0; i--) {
|
|
17
|
+
if (WORKSPACE_DIRS.has(segments[i])) return segments.slice(i).join("/");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return path;
|
|
21
|
+
}
|
|
22
|
+
export {
|
|
23
|
+
shortenPath
|
|
24
|
+
};
|
package/dist/plugin.cjs
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/plugin.ts
|
|
21
|
+
var plugin_exports = {};
|
|
22
|
+
__export(plugin_exports, {
|
|
23
|
+
annotationOf: () => annotationOf,
|
|
24
|
+
devtoolsPlugins: () => devtoolsPlugins,
|
|
25
|
+
pluginBadge: () => pluginBadge,
|
|
26
|
+
pluginElementBadge: () => pluginElementBadge,
|
|
27
|
+
pluginElementRows: () => pluginElementRows,
|
|
28
|
+
pluginRows: () => pluginRows,
|
|
29
|
+
registerDevtoolsPlugin: () => registerDevtoolsPlugin
|
|
30
|
+
});
|
|
31
|
+
module.exports = __toCommonJS(plugin_exports);
|
|
32
|
+
var plugins = [];
|
|
33
|
+
function registerDevtoolsPlugin(plugin) {
|
|
34
|
+
const at = plugins.findIndex((p) => p.name === plugin.name);
|
|
35
|
+
if (at === -1) plugins.push(plugin);
|
|
36
|
+
else plugins[at] = plugin;
|
|
37
|
+
}
|
|
38
|
+
function devtoolsPlugins() {
|
|
39
|
+
return plugins;
|
|
40
|
+
}
|
|
41
|
+
function annotationOf(node, name) {
|
|
42
|
+
return node.extra?.[name];
|
|
43
|
+
}
|
|
44
|
+
function pluginRows(node, graph) {
|
|
45
|
+
const out = [];
|
|
46
|
+
for (const plugin of plugins) {
|
|
47
|
+
if (!plugin.rows) continue;
|
|
48
|
+
try {
|
|
49
|
+
out.push(...plugin.rows(node, graph));
|
|
50
|
+
} catch {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
function pluginElementRows(extra) {
|
|
56
|
+
if (!extra) return [];
|
|
57
|
+
const out = [];
|
|
58
|
+
for (const plugin of plugins) {
|
|
59
|
+
if (!plugin.elementRows) continue;
|
|
60
|
+
try {
|
|
61
|
+
out.push(...plugin.elementRows(extra));
|
|
62
|
+
} catch {
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
function pluginElementBadge(extra) {
|
|
68
|
+
if (!extra) return void 0;
|
|
69
|
+
for (const plugin of plugins) {
|
|
70
|
+
try {
|
|
71
|
+
const badge = plugin.elementBadge?.(extra);
|
|
72
|
+
if (badge) return badge;
|
|
73
|
+
} catch {
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return void 0;
|
|
77
|
+
}
|
|
78
|
+
function pluginBadge(node) {
|
|
79
|
+
for (const plugin of plugins) {
|
|
80
|
+
try {
|
|
81
|
+
const badge = plugin.badge?.(node);
|
|
82
|
+
if (badge) return badge;
|
|
83
|
+
} catch {
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return void 0;
|
|
87
|
+
}
|
package/dist/plugin.d.ts
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import type { NodeKind, RNode } from './instrument.js';
|
|
2
|
+
/** A directive the runtime applied to an element. */
|
|
3
|
+
export interface DirectiveReport {
|
|
4
|
+
/** The node it was applied inside, usually a component. */
|
|
5
|
+
owner: number | undefined;
|
|
6
|
+
/** `use`, `class`, `style`, `bind`. */
|
|
7
|
+
kind: string;
|
|
8
|
+
/** The key after the colon, or the function name for `use:`. */
|
|
9
|
+
name: string;
|
|
10
|
+
/** The element as a selector. */
|
|
11
|
+
element: string;
|
|
12
|
+
/** The element itself. Only in the page, and the key to annotate it by. */
|
|
13
|
+
target?: unknown;
|
|
14
|
+
at?: {
|
|
15
|
+
file?: string;
|
|
16
|
+
line?: number;
|
|
17
|
+
column?: number;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** A node a plugin contributes. Ids come from the graph so they cannot collide. */
|
|
21
|
+
export interface PluginNode {
|
|
22
|
+
label: string;
|
|
23
|
+
kind: NodeKind;
|
|
24
|
+
createdIn?: number;
|
|
25
|
+
deps?: number[];
|
|
26
|
+
/** Short enough for a card. */
|
|
27
|
+
value?: string;
|
|
28
|
+
/** The whole of it, for the inspector. */
|
|
29
|
+
detail?: string;
|
|
30
|
+
/**
|
|
31
|
+
* Whether the application wrote this or the framework did. False folds it into the
|
|
32
|
+
* machinery card, the way an unnamed memo is folded.
|
|
33
|
+
*/
|
|
34
|
+
authored?: boolean;
|
|
35
|
+
source?: {
|
|
36
|
+
file?: string;
|
|
37
|
+
line?: number;
|
|
38
|
+
column?: number;
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/** A context provided or read. */
|
|
42
|
+
export interface ContextReport {
|
|
43
|
+
/** The node it happened in. */
|
|
44
|
+
owner: number | undefined;
|
|
45
|
+
/** Identity of the context, stable for its lifetime. */
|
|
46
|
+
id: symbol;
|
|
47
|
+
/** What the symbol was created with, when it says anything. */
|
|
48
|
+
name: string;
|
|
49
|
+
/** Label of the node it happened in, for naming a context nobody named. */
|
|
50
|
+
ownerLabel?: string;
|
|
51
|
+
/** Where the context was written, and whether that was inside a package. */
|
|
52
|
+
at?: {
|
|
53
|
+
file?: string;
|
|
54
|
+
line?: number;
|
|
55
|
+
column?: number;
|
|
56
|
+
external?: boolean;
|
|
57
|
+
};
|
|
58
|
+
kind: 'provide' | 'read';
|
|
59
|
+
/** Formatted, since a panel elsewhere cannot hold the value itself. Not yet clipped. */
|
|
60
|
+
value?: string;
|
|
61
|
+
}
|
|
62
|
+
/** What a plugin gets in the page. */
|
|
63
|
+
export interface CollectContext {
|
|
64
|
+
onDirective(fn: (report: DirectiveReport) => void): void;
|
|
65
|
+
onContext(fn: (report: ContextReport) => void): void;
|
|
66
|
+
/** Attach data under this plugin's name. Must survive JSON.stringify. */
|
|
67
|
+
annotate(id: number, data: unknown): void;
|
|
68
|
+
/**
|
|
69
|
+
* The same, for an element rather than a node. A directive belongs to the element it was
|
|
70
|
+
* applied to, and an element is not a node, so it is keyed by the element itself and
|
|
71
|
+
* lands on the description a panel draws.
|
|
72
|
+
*/
|
|
73
|
+
annotateElement(target: unknown, data: unknown): void;
|
|
74
|
+
/** What this plugin already attached to an element. */
|
|
75
|
+
elementAnnotation(target: unknown): unknown;
|
|
76
|
+
add(node: PluginNode): number;
|
|
77
|
+
/**
|
|
78
|
+
* Say what a plain component really is. A component that exists to provide a context is a
|
|
79
|
+
* provider, and nothing but the plugin watching the context can know that.
|
|
80
|
+
*
|
|
81
|
+
* Ignored for a node the framework already named, and ignored for any kind that is not
|
|
82
|
+
* itself a tag: a Router that provides a context is still a Router, and a component
|
|
83
|
+
* relabelled a signal would leave the tree along with everything it rendered.
|
|
84
|
+
*/
|
|
85
|
+
retype(id: number, kind: NodeKind): void;
|
|
86
|
+
/** What this plugin already attached, for adding to it rather than replacing it. */
|
|
87
|
+
annotation(id: number): unknown;
|
|
88
|
+
}
|
|
89
|
+
/** A line a plugin adds to the inspector. `at` makes it a link the host can open. */
|
|
90
|
+
export interface PluginRow {
|
|
91
|
+
label: string;
|
|
92
|
+
value?: string;
|
|
93
|
+
at?: {
|
|
94
|
+
file?: string;
|
|
95
|
+
line?: number;
|
|
96
|
+
column?: number;
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface DevtoolsPlugin {
|
|
100
|
+
/** Namespaces everything it writes. */
|
|
101
|
+
name: string;
|
|
102
|
+
/** In the page. */
|
|
103
|
+
collect?(ctx: CollectContext): void;
|
|
104
|
+
/** In a panel, for the selected node. Sees only what crossed the wire. */
|
|
105
|
+
rows?(node: RNode, graph: Map<number, RNode>): PluginRow[];
|
|
106
|
+
/** A short word next to the label, in the tree and on the card. */
|
|
107
|
+
badge?(node: RNode): string | undefined;
|
|
108
|
+
/** The same, for an element row. Given what plugins attached to that element. */
|
|
109
|
+
elementBadge?(extra: Record<string, unknown>): string | undefined;
|
|
110
|
+
/** Rows for a selected element row. */
|
|
111
|
+
elementRows?(extra: Record<string, unknown>): PluginRow[];
|
|
112
|
+
}
|
|
113
|
+
/** Replaced rather than added twice, so a module evaluated in two bundles does not double. */
|
|
114
|
+
export declare function registerDevtoolsPlugin(plugin: DevtoolsPlugin): void;
|
|
115
|
+
export declare function devtoolsPlugins(): readonly DevtoolsPlugin[];
|
|
116
|
+
export declare function annotationOf(node: RNode, name: string): unknown;
|
|
117
|
+
export declare function pluginRows(node: RNode, graph: Map<number, RNode>): PluginRow[];
|
|
118
|
+
export declare function pluginElementRows(extra?: Record<string, unknown>): PluginRow[];
|
|
119
|
+
export declare function pluginElementBadge(extra?: Record<string, unknown>): string | undefined;
|
|
120
|
+
export declare function pluginBadge(node: RNode): string | undefined;
|
|
121
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../src/plugin.ts"],"names":[],"mappings":"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"}
|
package/dist/plugin.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const plugins = [];
|
|
2
|
+
/** Replaced rather than added twice, so a module evaluated in two bundles does not double. */
|
|
3
|
+
export function registerDevtoolsPlugin(plugin) {
|
|
4
|
+
const at = plugins.findIndex((p) => p.name === plugin.name);
|
|
5
|
+
if (at === -1)
|
|
6
|
+
plugins.push(plugin);
|
|
7
|
+
else
|
|
8
|
+
plugins[at] = plugin;
|
|
9
|
+
}
|
|
10
|
+
export function devtoolsPlugins() {
|
|
11
|
+
return plugins;
|
|
12
|
+
}
|
|
13
|
+
export function annotationOf(node, name) {
|
|
14
|
+
return node.extra?.[name];
|
|
15
|
+
}
|
|
16
|
+
export function pluginRows(node, graph) {
|
|
17
|
+
const out = [];
|
|
18
|
+
for (const plugin of plugins) {
|
|
19
|
+
if (!plugin.rows)
|
|
20
|
+
continue;
|
|
21
|
+
// A plugin with a bug is not a reason for the panel to stop.
|
|
22
|
+
try {
|
|
23
|
+
out.push(...plugin.rows(node, graph));
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
/* ignored */
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return out;
|
|
30
|
+
}
|
|
31
|
+
export function pluginElementRows(extra) {
|
|
32
|
+
if (!extra)
|
|
33
|
+
return [];
|
|
34
|
+
const out = [];
|
|
35
|
+
for (const plugin of plugins) {
|
|
36
|
+
if (!plugin.elementRows)
|
|
37
|
+
continue;
|
|
38
|
+
try {
|
|
39
|
+
out.push(...plugin.elementRows(extra));
|
|
40
|
+
}
|
|
41
|
+
catch {
|
|
42
|
+
/* ignored */
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return out;
|
|
46
|
+
}
|
|
47
|
+
export function pluginElementBadge(extra) {
|
|
48
|
+
if (!extra)
|
|
49
|
+
return undefined;
|
|
50
|
+
for (const plugin of plugins) {
|
|
51
|
+
try {
|
|
52
|
+
const badge = plugin.elementBadge?.(extra);
|
|
53
|
+
if (badge)
|
|
54
|
+
return badge;
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
/* ignored */
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
export function pluginBadge(node) {
|
|
63
|
+
for (const plugin of plugins) {
|
|
64
|
+
try {
|
|
65
|
+
const badge = plugin.badge?.(node);
|
|
66
|
+
if (badge)
|
|
67
|
+
return badge;
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
/* ignored */
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
}
|
package/dist/plugin.mjs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
// src/plugin.ts
|
|
2
|
+
var plugins = [];
|
|
3
|
+
function registerDevtoolsPlugin(plugin) {
|
|
4
|
+
const at = plugins.findIndex((p) => p.name === plugin.name);
|
|
5
|
+
if (at === -1) plugins.push(plugin);
|
|
6
|
+
else plugins[at] = plugin;
|
|
7
|
+
}
|
|
8
|
+
function devtoolsPlugins() {
|
|
9
|
+
return plugins;
|
|
10
|
+
}
|
|
11
|
+
function annotationOf(node, name) {
|
|
12
|
+
return node.extra?.[name];
|
|
13
|
+
}
|
|
14
|
+
function pluginRows(node, graph) {
|
|
15
|
+
const out = [];
|
|
16
|
+
for (const plugin of plugins) {
|
|
17
|
+
if (!plugin.rows) continue;
|
|
18
|
+
try {
|
|
19
|
+
out.push(...plugin.rows(node, graph));
|
|
20
|
+
} catch {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return out;
|
|
24
|
+
}
|
|
25
|
+
function pluginElementRows(extra) {
|
|
26
|
+
if (!extra) return [];
|
|
27
|
+
const out = [];
|
|
28
|
+
for (const plugin of plugins) {
|
|
29
|
+
if (!plugin.elementRows) continue;
|
|
30
|
+
try {
|
|
31
|
+
out.push(...plugin.elementRows(extra));
|
|
32
|
+
} catch {
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return out;
|
|
36
|
+
}
|
|
37
|
+
function pluginElementBadge(extra) {
|
|
38
|
+
if (!extra) return void 0;
|
|
39
|
+
for (const plugin of plugins) {
|
|
40
|
+
try {
|
|
41
|
+
const badge = plugin.elementBadge?.(extra);
|
|
42
|
+
if (badge) return badge;
|
|
43
|
+
} catch {
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return void 0;
|
|
47
|
+
}
|
|
48
|
+
function pluginBadge(node) {
|
|
49
|
+
for (const plugin of plugins) {
|
|
50
|
+
try {
|
|
51
|
+
const badge = plugin.badge?.(node);
|
|
52
|
+
if (badge) return badge;
|
|
53
|
+
} catch {
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return void 0;
|
|
57
|
+
}
|
|
58
|
+
export {
|
|
59
|
+
annotationOf,
|
|
60
|
+
devtoolsPlugins,
|
|
61
|
+
pluginBadge,
|
|
62
|
+
pluginElementBadge,
|
|
63
|
+
pluginElementRows,
|
|
64
|
+
pluginRows,
|
|
65
|
+
registerDevtoolsPlugin
|
|
66
|
+
};
|