@zerolith/devtools 0.1.0-alpha.7 → 0.1.0-alpha.8
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 +4 -4
- package/dist/production/index.js +67 -0
- package/dist/production/index.js.map +1 -0
- package/dist/production/noop.js +2 -0
- package/dist/production/noop.js.map +1 -0
- package/dist/production/version.js +2 -0
- package/dist/production/version.js.map +1 -0
- package/dist/version.js +1 -1
- package/package.json +6 -6
- package/src/version.ts +1 -1
package/README.md
CHANGED
|
@@ -12,15 +12,15 @@ The dock shows the live reactive graph (every signal, computed value, and effect
|
|
|
12
12
|
|
|
13
13
|
The package reads the hook the core publishes in development builds as `globalThis.__ZEROLITH_DEVTOOLS__`. Under the `development` export condition it is the inspector; otherwise it is a no-op, so the call can stay in application code.
|
|
14
14
|
|
|
15
|
-
The guide is on the [docs site](https://
|
|
15
|
+
The guide is on the [docs site](https://zerolith.dev/guide/dev-tools/).
|
|
16
16
|
|
|
17
17
|
Status: alpha. Install with `npm install @zerolith/devtools@alpha`, at the version of `zerolith` the project uses: the two share the `zerolith/internal` entry, and `mountDevtools` stops with `package_version_mismatch` on any other version. The API may change before 1.0.
|
|
18
18
|
|
|
19
19
|
## Documentation
|
|
20
20
|
|
|
21
|
-
- The [dev tools guide](https://
|
|
22
|
-
- The [reference](https://
|
|
23
|
-
- New to zerolith? The [tutorial](https://
|
|
21
|
+
- The [dev tools guide](https://zerolith.dev/guide/dev-tools/) explains it with examples that run as tests.
|
|
22
|
+
- The [reference](https://zerolith.dev/reference/zerolith-devtools/) lists every export, generated from the source.
|
|
23
|
+
- New to zerolith? The [tutorial](https://zerolith.dev/learn/) builds an app step by step, and the [playground](https://zerolith.dev/playground/) runs code in the browser.
|
|
24
24
|
|
|
25
25
|
## License
|
|
26
26
|
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import{computed as e,css as t,each as n,html as r,render as i,signal as a,when as o}from"zerolith";import{devtoolsInternal as s}from"zerolith/internal";import{checkCoreVersion as c}from"./version.js";const l=t`
|
|
2
|
+
:scope { position: fixed; inset: auto 0 0 0; z-index: 2147483000; max-height: 45vh; display: grid; grid-template-rows: auto 1fr; background: #14171a; color: #e6e8eb; border-top: 1px solid #2a2f36; font: 12px/1.45 ui-monospace, monospace; }
|
|
3
|
+
header { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid #2a2f36; }
|
|
4
|
+
header strong { margin-right: 8px; color: #7cc4ff; }
|
|
5
|
+
header button { background: none; border: 1px solid transparent; color: inherit; padding: 2px 8px; border-radius: 4px; cursor: pointer; font: inherit; }
|
|
6
|
+
header button[aria-selected="true"] { border-color: #2a2f36; background: #1d2126; }
|
|
7
|
+
header .spacer { flex: 1; }
|
|
8
|
+
.panel { overflow: auto; padding: 4px 8px 8px; }
|
|
9
|
+
table { width: 100%; border-collapse: collapse; }
|
|
10
|
+
th, td { text-align: left; padding: 2px 6px; border-bottom: 1px solid #1d2126; vertical-align: top; white-space: nowrap; }
|
|
11
|
+
td.value { white-space: pre-wrap; max-width: 40vw; overflow-wrap: anywhere; color: #c6e2b5; }
|
|
12
|
+
tr[data-kind="effect"] td.value { color: #9aa3ad; }
|
|
13
|
+
.code { color: #ff8a80; }
|
|
14
|
+
a { color: #7cc4ff; }
|
|
15
|
+
.empty { color: #9aa3ad; padding: 12px 0; }
|
|
16
|
+
`,u=t`
|
|
17
|
+
:scope { position: fixed; right: 12px; bottom: 12px; z-index: 2147483000; background: #14171a; color: #7cc4ff; border: 1px solid #2a2f36; border-radius: 999px; padding: 6px 12px; font: 12px/1 ui-monospace, monospace; cursor: pointer; }
|
|
18
|
+
`;function d(){return globalThis.__ZEROLITH_DEVTOOLS__}export function describeValue(e){if(typeof e==`string`)return JSON.stringify(e.length>120?e.slice(0,117)+`...`:e);if(typeof e==`function`)return`function ${e.name}`;if(typeof e!=`object`||!e)return String(e);if(typeof Node<`u`&&e instanceof Node)return`<${e.nodeName.toLowerCase()}>`;try{let t=JSON.stringify(e);return t===void 0?String(e):t.length>120?t.slice(0,117)+`...`:t}catch{return Object.prototype.toString.call(e)}}function f(e){if(e.nodeType!==1)return e.nodeName.toLowerCase();let t=e,n=t.id===``?``:`#${t.id}`,r=t.classList.length===0?``:`.`+Array.from(t.classList).join(`.`);return t.localName+n+r}function p(t){let i=e(()=>t().filter(e=>!e.internal));return o(e(()=>i.get().length>0),()=>r`
|
|
19
|
+
<table>
|
|
20
|
+
<thead><tr><th>id</th><th>kind</th><th>name</th><th>observers</th><th>value</th></tr></thead>
|
|
21
|
+
<tbody>${n(i,e=>e.id,t=>r`
|
|
22
|
+
<tr data-kind=${e(()=>t.get().kind)}>
|
|
23
|
+
<td>${e(()=>t.get().id)}</td>
|
|
24
|
+
<td>${e(()=>t.get().kind)}</td>
|
|
25
|
+
<td>${e(()=>t.get().name??``)}</td>
|
|
26
|
+
<td>${e(()=>t.get().observers)}</td>
|
|
27
|
+
<td class="value">${e(()=>`value`in t.get()?describeValue(t.get().value):``)}</td>
|
|
28
|
+
</tr>`)}</tbody>
|
|
29
|
+
</table>`,()=>r`<p class="empty">No signals yet.</p>`)}function m(t){let i=e(()=>t().filter(e=>!e.internal));return o(e(()=>i.get().length>0),()=>r`
|
|
30
|
+
<table>
|
|
31
|
+
<thead><tr><th>id</th><th>kind</th><th>container</th></tr></thead>
|
|
32
|
+
<tbody>${n(i,e=>e.id,t=>r`
|
|
33
|
+
<tr>
|
|
34
|
+
<td>${e(()=>t.get().id)}</td>
|
|
35
|
+
<td>${e(()=>t.get().kind)}</td>
|
|
36
|
+
<td>${e(()=>f(t.get().container))}</td>
|
|
37
|
+
</tr>`)}</tbody>
|
|
38
|
+
</table>`,()=>r`<p class="empty">No roots mounted.</p>`)}function h(t){let i=e(()=>t().map((e,t)=>({index:t,record:e})));return o(e(()=>i.get().length>0),()=>r`
|
|
39
|
+
<table>
|
|
40
|
+
<thead><tr><th>severity</th><th>code</th><th>cause</th><th>arguments</th></tr></thead>
|
|
41
|
+
<tbody>${n(i,e=>e.index,t=>r`
|
|
42
|
+
<tr>
|
|
43
|
+
<td>${e(()=>t.get().record.severity)}</td>
|
|
44
|
+
<td class="code"><a href=${e(()=>t.get().record.url)} target="_blank" rel="noopener">${e(()=>t.get().record.code)}</a></td>
|
|
45
|
+
<td class="value">${e(()=>t.get().record.cause)}</td>
|
|
46
|
+
<td class="value">${e(()=>describeValue(t.get().record.args??{}))}</td>
|
|
47
|
+
</tr>`)}</tbody>
|
|
48
|
+
</table>`,()=>r`<p class="empty">No diagnostics reported.</p>`)}export function mountDevtools(t={}){c();let n=d(),{open:f,tab:g,version:_}=s(()=>({open:a(t.open===!0),tab:a(`signals`),version:a(0)})),v=()=>(_.get(),n?.nodes()??[]),y=()=>(_.get(),n?.roots()??[]),b=()=>(_.get(),n?.diagnostics()??[]),x=!1,S=()=>{x||(x=!0,requestAnimationFrame(()=>{x=!1,_.set(_.get()+1)}))},C=n?.subscribe(S),w=e=>{e.altKey&&e.shiftKey&&e.code===`KeyZ`&&(e.preventDefault(),f.set(!f.get()))};document.addEventListener(`keydown`,w);let T=document.createElement(`div`);T.dataset.zerolithDevtools=``,document.body.append(T);let E=(t,n)=>r`<button type="button" role="tab" aria-selected=${e(()=>String(g.get()===t))} @click=${()=>g.set(t)}>${n}</button>`,D=s(()=>i(r`
|
|
49
|
+
${o(f,()=>r`
|
|
50
|
+
<aside class=${l} aria-label="zerolith dev tools">
|
|
51
|
+
<header role="tablist">
|
|
52
|
+
<strong>zerolith</strong>
|
|
53
|
+
${E(`signals`,`Signals`)}
|
|
54
|
+
${E(`roots`,`Roots`)}
|
|
55
|
+
${E(`diagnostics`,`Diagnostics`)}
|
|
56
|
+
<span class="spacer"></span>
|
|
57
|
+
<button type="button" @click=${()=>S()}>Refresh</button>
|
|
58
|
+
<button type="button" aria-label="Close dev tools" @click=${()=>f.set(!1)}>Close</button>
|
|
59
|
+
</header>
|
|
60
|
+
<div class="panel">
|
|
61
|
+
${o(e(()=>n===void 0),()=>r`<p class="empty">No zerolith development build is running on this page.</p>`,()=>r`
|
|
62
|
+
${o(e(()=>g.get()===`signals`),()=>p(v))}
|
|
63
|
+
${o(e(()=>g.get()===`roots`),()=>m(y))}
|
|
64
|
+
${o(e(()=>g.get()===`diagnostics`),()=>h(b))}`)}
|
|
65
|
+
</div>
|
|
66
|
+
</aside>`,()=>r`<button type="button" class=${u} aria-label="Open zerolith dev tools" @click=${()=>f.set(!0)}>zerolith</button>`)}`,T));return{toggle(e){f.set(e??!f.get())},dispose(){C?.(),document.removeEventListener(`keydown`,w),D.dispose(),T.remove()}}}
|
|
67
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/index.ts"],"sourcesContent":["/**\n * @zerolith/devtools: an in-page inspector built with zerolith itself. It\n * reads the hook the core publishes in development and renders a dock\n * with the reactive graph, the mounted roots, and the diagnostics feed.\n */\nimport { type Diagnostic, computed, css, each, html, render, signal, when } from \"zerolith\";\nimport { type DevtoolsHook, type NodeSnapshot, type RootSnapshot, devtoolsInternal } from \"zerolith/internal\";\nimport { checkCoreVersion } from \"./version.js\";\n\nexport type { DevtoolsHandle, DevtoolsOptions } from \"./noop.js\";\nimport type { DevtoolsHandle, DevtoolsOptions } from \"./noop.js\";\n\ntype Tab = \"signals\" | \"roots\" | \"diagnostics\";\n\nconst dock = css`\n :scope { position: fixed; inset: auto 0 0 0; z-index: 2147483000; max-height: 45vh; display: grid; grid-template-rows: auto 1fr; background: #14171a; color: #e6e8eb; border-top: 1px solid #2a2f36; font: 12px/1.45 ui-monospace, monospace; }\n header { display: flex; align-items: center; gap: 4px; padding: 4px 8px; border-bottom: 1px solid #2a2f36; }\n header strong { margin-right: 8px; color: #7cc4ff; }\n header button { background: none; border: 1px solid transparent; color: inherit; padding: 2px 8px; border-radius: 4px; cursor: pointer; font: inherit; }\n header button[aria-selected=\"true\"] { border-color: #2a2f36; background: #1d2126; }\n header .spacer { flex: 1; }\n .panel { overflow: auto; padding: 4px 8px 8px; }\n table { width: 100%; border-collapse: collapse; }\n th, td { text-align: left; padding: 2px 6px; border-bottom: 1px solid #1d2126; vertical-align: top; white-space: nowrap; }\n td.value { white-space: pre-wrap; max-width: 40vw; overflow-wrap: anywhere; color: #c6e2b5; }\n tr[data-kind=\"effect\"] td.value { color: #9aa3ad; }\n .code { color: #ff8a80; }\n a { color: #7cc4ff; }\n .empty { color: #9aa3ad; padding: 12px 0; }\n`;\n\nconst launcher = css`\n :scope { position: fixed; right: 12px; bottom: 12px; z-index: 2147483000; background: #14171a; color: #7cc4ff; border: 1px solid #2a2f36; border-radius: 999px; padding: 6px 12px; font: 12px/1 ui-monospace, monospace; cursor: pointer; }\n`;\n\nfunction hook(): DevtoolsHook | undefined\n{\n return (globalThis as { __ZEROLITH_DEVTOOLS__?: DevtoolsHook }).__ZEROLITH_DEVTOOLS__;\n}\n\n/** A short, safe textual form of a value for the table. */\nexport function describeValue(value: unknown): string\n{\n if (typeof value === \"string\")\n {\n return JSON.stringify(value.length > 120 ? value.slice(0, 117) + \"...\" : value);\n }\n if (typeof value === \"function\")\n {\n return `function ${value.name}`;\n }\n if (value === null || typeof value !== \"object\")\n {\n return String(value);\n }\n if (typeof Node !== \"undefined\" && value instanceof Node)\n {\n return `<${value.nodeName.toLowerCase()}>`;\n }\n try\n {\n const text = JSON.stringify(value);\n return text === undefined ? String(value) : text.length > 120 ? text.slice(0, 117) + \"...\" : text;\n }\n catch\n {\n return Object.prototype.toString.call(value);\n }\n}\n\nfunction describeContainer(node: Node): string\n{\n if (node.nodeType !== 1)\n {\n return node.nodeName.toLowerCase();\n }\n const element = node as Element;\n const id = element.id === \"\" ? \"\" : `#${element.id}`;\n const classes = element.classList.length === 0 ? \"\" : \".\" + Array.from(element.classList).join(\".\");\n return element.localName + id + classes;\n}\n\nfunction Signals(nodes: () => NodeSnapshot[])\n{\n const rows = computed(() => nodes().filter((node) => !node.internal));\n return when(computed(() => rows.get().length > 0), () => html`\n <table>\n <thead><tr><th>id</th><th>kind</th><th>name</th><th>observers</th><th>value</th></tr></thead>\n <tbody>${each(rows, (node) => node.id, (node) => html`\n <tr data-kind=${computed(() => node.get().kind)}>\n <td>${computed(() => node.get().id)}</td>\n <td>${computed(() => node.get().kind)}</td>\n <td>${computed(() => node.get().name ?? \"\")}</td>\n <td>${computed(() => node.get().observers)}</td>\n <td class=\"value\">${computed(() => (\"value\" in node.get() ? describeValue(node.get().value) : \"\"))}</td>\n </tr>`)}</tbody>\n </table>`, () => html`<p class=\"empty\">No signals yet.</p>`);\n}\n\nfunction Roots(roots: () => RootSnapshot[])\n{\n const rows = computed(() => roots().filter((root) => !root.internal));\n return when(computed(() => rows.get().length > 0), () => html`\n <table>\n <thead><tr><th>id</th><th>kind</th><th>container</th></tr></thead>\n <tbody>${each(rows, (root) => root.id, (root) => html`\n <tr>\n <td>${computed(() => root.get().id)}</td>\n <td>${computed(() => root.get().kind)}</td>\n <td>${computed(() => describeContainer(root.get().container))}</td>\n </tr>`)}</tbody>\n </table>`, () => html`<p class=\"empty\">No roots mounted.</p>`);\n}\n\nfunction Diagnostics(list: () => Diagnostic[])\n{\n const rows = computed(() => list().map((record, index) => ({ index, record })));\n return when(computed(() => rows.get().length > 0), () => html`\n <table>\n <thead><tr><th>severity</th><th>code</th><th>cause</th><th>arguments</th></tr></thead>\n <tbody>${each(rows, (row) => row.index, (row) => html`\n <tr>\n <td>${computed(() => row.get().record.severity)}</td>\n <td class=\"code\"><a href=${computed(() => row.get().record.url)} target=\"_blank\" rel=\"noopener\">${computed(() => row.get().record.code)}</a></td>\n <td class=\"value\">${computed(() => row.get().record.cause)}</td>\n <td class=\"value\">${computed(() => describeValue(row.get().record.args ?? {}))}</td>\n </tr>`)}</tbody>\n </table>`, () => html`<p class=\"empty\">No diagnostics reported.</p>`);\n}\n\n/**\n * Mounts the inspector dock at the bottom of the page. Returns a handle to\n * toggle or remove it. Everything the inspector creates is marked internal\n * so it does not appear in its own tables. Mounting fails with\n * `package_version_mismatch` when the installed zerolith is not the version\n * the inspector was released with.\n */\nexport function mountDevtools(options: DevtoolsOptions = {}): DevtoolsHandle\n{\n checkCoreVersion();\n const source = hook();\n const { open, tab, version } = devtoolsInternal(() => ({ open: signal(options.open === true), tab: signal<Tab>(\"signals\"), version: signal(0) }));\n const nodes = (): NodeSnapshot[] => (version.get(), source?.nodes() ?? []);\n const roots = (): RootSnapshot[] => (version.get(), source?.roots() ?? []);\n const list = (): Diagnostic[] => (version.get(), source?.diagnostics() ?? []);\n\n let scheduled = false;\n const refresh = (): void =>\n {\n if (scheduled)\n {\n return;\n }\n scheduled = true;\n requestAnimationFrame(() =>\n {\n scheduled = false;\n version.set(version.get() + 1);\n });\n };\n const unsubscribe = source?.subscribe(refresh);\n\n const onKey = (event: KeyboardEvent): void =>\n {\n if (event.altKey && event.shiftKey && event.code === \"KeyZ\")\n {\n event.preventDefault();\n open.set(!open.get());\n }\n };\n document.addEventListener(\"keydown\", onKey);\n\n const host = document.createElement(\"div\");\n host.dataset[\"zerolithDevtools\"] = \"\";\n document.body.append(host);\n\n const tabButton = (name: Tab, label: string) => html`<button type=\"button\" role=\"tab\" aria-selected=${computed(() => String(tab.get() === name))} @click=${() => tab.set(name)}>${label}</button>`;\n\n const root = devtoolsInternal(() => render(html`\n ${when(open, () => html`\n <aside class=${dock} aria-label=\"zerolith dev tools\">\n <header role=\"tablist\">\n <strong>zerolith</strong>\n ${tabButton(\"signals\", \"Signals\")}\n ${tabButton(\"roots\", \"Roots\")}\n ${tabButton(\"diagnostics\", \"Diagnostics\")}\n <span class=\"spacer\"></span>\n <button type=\"button\" @click=${() => refresh()}>Refresh</button>\n <button type=\"button\" aria-label=\"Close dev tools\" @click=${() => open.set(false)}>Close</button>\n </header>\n <div class=\"panel\">\n ${when(computed(() => source === undefined), () => html`<p class=\"empty\">No zerolith development build is running on this page.</p>`, () => html`\n ${when(computed(() => tab.get() === \"signals\"), () => Signals(nodes))}\n ${when(computed(() => tab.get() === \"roots\"), () => Roots(roots))}\n ${when(computed(() => tab.get() === \"diagnostics\"), () => Diagnostics(list))}`)}\n </div>\n </aside>`, () => html`<button type=\"button\" class=${launcher} aria-label=\"Open zerolith dev tools\" @click=${() => open.set(true)}>zerolith</button>`)}`, host));\n\n return {\n toggle(state?: boolean): void\n {\n open.set(state ?? !open.get());\n },\n dispose(): void\n {\n unsubscribe?.();\n document.removeEventListener(\"keydown\", onKey);\n root.dispose();\n host.remove();\n }\n };\n}\n"],"names":["dock","launcher","hook","value","text","describeContainer","node","element","id","classes","Signals","rows","computed","nodes","when","each","Roots","roots","root","Diagnostics","list","row","checkCoreVersion","source","devtoolsInternal","signal","options","version","scheduled","refresh","unsubscribe","onKey","event","open","host","\"zerolithDevtools\"","tabButton","tab","name","label","render","state"],"mappings":"AAKA,OAA0B,cAAU,SAAK,UAAM,UAAM,YAAQ,YAAQ,cAAY,WACjF,OAAkE,0BAAwB,oBAC1F,OAAS,0BAAwB,eAOjC,MAAMA,EAAO,CAAG;;;;;;;;;;;;;;;EAiBVC,EAAW,CAAG;;EAIpB,SAASC,GAAI,CAET,OAAQ,WAAwD,qBACpE,CAGA,OAAM,SAAU,cAAc,EAAc,CAExC,GAAI,OAAOC,GAAU,SAEjB,OAAO,KAAK,UAAUA,EAAM,OAAS,IAAMA,EAAM,MAAM,EAAG,GAAG,EAAI,MAAQA,CAAK,EAElF,GAAI,OAAOA,GAAU,WAEjB,MAAO,YAAYA,EAAM,OAE7B,GAAsB,OAAOA,GAAU,WAAnCA,EAEA,OAAO,OAAOA,CAAK,EAEvB,GAAI,OAAO,KAAS,KAAeA,aAAiB,KAEhD,MAAO,IAAIA,EAAM,SAAS,YAAW,EAAE,GAE3C,GACA,CACI,IAAMC,EAAO,KAAK,UAAUD,CAAK,EACjC,OAAOC,IAAS,OAAY,OAAOD,CAAK,EAAIC,EAAK,OAAS,IAAMA,EAAK,MAAM,EAAG,GAAG,EAAI,MAAQA,CACjG,MAEA,CACI,OAAO,OAAO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,mBAAoB,IAAKC,CAAI,CAAC,EAEtK,MAAO,CACH,OAAO,EAAe,CAElBD,EAAK,IAAIQ,GAAS,CAACR,EAAK,IAAG,CAAE,CACjC,EACA,SAAO,CAEHH,IAAa,EACb,SAAS,oBAAoB,UAAWC,CAAK,EAC7Cb,EAAK,QAAO,EACZgB,EAAK,OAAM,CACf,CACH,CACL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noop.js","sources":["../../src/noop.ts"],"sourcesContent":["/**\n * The production entry of @zerolith/devtools: the same surface as the\n * inspector, doing nothing.\n */\n\n/** Options for `mountDevtools`. */\nexport interface DevtoolsOptions\n{\n /** Start with the dock open. Defaults to false. */\n open?: boolean;\n}\n\n/** The handle returned by `mountDevtools`. */\nexport interface DevtoolsHandle\n{\n /** Shows or hides the dock. */\n toggle(open?: boolean): void;\n /** Removes the dock. */\n dispose(): void;\n}\n\n/** Does nothing in production builds. */\nexport function mountDevtools(_options?: DevtoolsOptions): DevtoolsHandle\n{\n return {\n toggle(): void\n {\n },\n dispose(): void\n {\n }\n };\n}\n"],"names":[],"mappings":"AAsBA,OAAM,SAAU,cAAc,EAA0B,CAEpD,MAAO,CACH,QAAM,CAEN,EACA,SAAO,CAEP,CACH,CACL"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{DIAGNOSTIC_URL as e}from"zerolith";import{version as t}from"zerolith/internal";export const version=`0.1.0-alpha.8`;export function checkCoreVersion(n=`0.1.0-alpha.8`,r=t){if(r!==n)throw Error(`zerolith: package_version_mismatch: @zerolith/devtools ${n} requires zerolith ${n}, and zerolith ${r} is installed. Install one version of both, with npm install @zerolith/devtools@${r} or npm install zerolith@${n}. ${e}package_version_mismatch`)}
|
|
2
|
+
//# sourceMappingURL=version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.js","sources":["../../src/version.ts"],"sourcesContent":["/**\n * The inspector and the core share `zerolith/internal`, which can change\n * with every version, so the inspector requires the zerolith it was\n * released with.\n */\nimport { DIAGNOSTIC_URL } from \"zerolith\";\nimport { version as installed } from \"zerolith/internal\";\n\n/** The version of this package, which the version script keeps equal to its manifest's. */\nexport const version: string = \"0.1.0-alpha.8\";\n\n/** Throws `package_version_mismatch` when the installed zerolith is not the inspector's own version. */\nexport function checkCoreVersion(own: string = version, core: string = installed): void\n{\n if (core !== own)\n {\n throw new Error(`zerolith: package_version_mismatch: @zerolith/devtools ${own} requires zerolith ${own}, and zerolith ${core} is installed. Install one version of both, with npm install @zerolith/devtools@${core} or npm install zerolith@${own}. ${DIAGNOSTIC_URL}package_version_mismatch`);\n }\n}\n"],"names":["installed","core","own","DIAGNOSTIC_URL"],"mappings":"AAKA,OAAS,wBAAsB,WAC/B,OAAS,WAAWA,MAAiB,oBAGrC,OAAO,MAAM,QAAkB,gBAG/B,OAAM,SAAU,iBAAiB,EAAc,gBAAS,EAAeA,EAAS,CAE5E,GAAIC,IAASC,EAET,MAAU,MAAM,0DAA0DA,EAAG,qBAAsBA,EAAG,iBAAkBD,EAAI,kFAAmFA,EAAI,2BAA4BC,EAAG,IAAKC,EAAc,yBAA0B,CAEvS"}
|
package/dist/version.js
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import { DIAGNOSTIC_URL } from "zerolith";
|
|
7
7
|
import { version as installed } from "zerolith/internal";
|
|
8
8
|
/** The version of this package, which the version script keeps equal to its manifest's. */
|
|
9
|
-
export const version = "0.1.0-alpha.
|
|
9
|
+
export const version = "0.1.0-alpha.8";
|
|
10
10
|
/** Throws `package_version_mismatch` when the installed zerolith is not the inspector's own version. */
|
|
11
11
|
export function checkCoreVersion(own = version, core = installed) {
|
|
12
12
|
if (core !== own) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zerolith/devtools",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
3
|
+
"version": "0.1.0-alpha.8",
|
|
4
4
|
"description": "An in-page inspector for zerolith applications: signals, roots, and diagnostics, working wherever the app is served",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "molexxxx",
|
|
7
|
-
"homepage": "https://
|
|
7
|
+
"homepage": "https://zerolith.dev/",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/molexxxx/zerolith.git",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
".": {
|
|
28
28
|
"types": "./dist/index.d.ts",
|
|
29
29
|
"development": "./dist/index.js",
|
|
30
|
-
"default": "./dist/noop.js"
|
|
30
|
+
"default": "./dist/production/noop.js"
|
|
31
31
|
},
|
|
32
32
|
"./package.json": "./package.json"
|
|
33
33
|
},
|
|
@@ -38,12 +38,12 @@
|
|
|
38
38
|
"README.md"
|
|
39
39
|
],
|
|
40
40
|
"scripts": {
|
|
41
|
-
"build": "tsc -p tsconfig.build.json"
|
|
41
|
+
"build": "tsc -p tsconfig.build.json && node ../../scripts/production.ts"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
|
-
"zerolith": "0.1.0-alpha.
|
|
44
|
+
"zerolith": "0.1.0-alpha.8"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"zerolith": "0.1.0-alpha.
|
|
47
|
+
"zerolith": "0.1.0-alpha.8"
|
|
48
48
|
}
|
|
49
49
|
}
|
package/src/version.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { DIAGNOSTIC_URL } from "zerolith";
|
|
|
7
7
|
import { version as installed } from "zerolith/internal";
|
|
8
8
|
|
|
9
9
|
/** The version of this package, which the version script keeps equal to its manifest's. */
|
|
10
|
-
export const version: string = "0.1.0-alpha.
|
|
10
|
+
export const version: string = "0.1.0-alpha.8";
|
|
11
11
|
|
|
12
12
|
/** Throws `package_version_mismatch` when the installed zerolith is not the inspector's own version. */
|
|
13
13
|
export function checkCoreVersion(own: string = version, core: string = installed): void
|