@ogygia/devtools 0.11.1 → 0.12.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 +1 -1
- package/dist/profiler/index.d.ts +1 -1
- package/dist/profiler/standalone.js +12 -4
- package/dist/server.js +7 -0
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -23,4 +23,4 @@ export default defineConfig(({ mode }) => ({
|
|
|
23
23
|
|
|
24
24
|
Code for the profiler: `@ogygia/devtools/profiler` (`span`, `instrument`), `@ogygia/devtools/profiler/client` (`mark`), and stores at `@ogygia/devtools/profiler/storage/sqlite`, `/redis`, `/postgres`.
|
|
25
25
|
|
|
26
|
-
Docs: [
|
|
26
|
+
Docs: [@ogygia/devtools](https://ogygiajs.dev/docs/devtools/overview), with [the dock](https://ogygiajs.dev/docs/devtools/dock) and [the profiler](https://ogygiajs.dev/docs/devtools/profiler/overview).
|
package/dist/profiler/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ import { Forecast } from "./forecast.js";
|
|
|
18
18
|
import { HeapGrowth, Pattern } from "./patterns.js";
|
|
19
19
|
import { SpanRecord } from "./span.js";
|
|
20
20
|
import { PageAssets } from "@ogygia/core/insights";
|
|
21
|
-
import { Handle } from "@
|
|
21
|
+
import { Handle } from "@ogygia/core/plugin";
|
|
22
22
|
export interface ProfilerOptions {
|
|
23
23
|
/**
|
|
24
24
|
* Auth secret. Defaults to the OGYGIA_PROFILER_SECRET env var. Required outside
|
|
@@ -3,7 +3,9 @@ const STYLESHEET_RE = /<link\b[^>]*\brel=["']stylesheet["'][^>]*>/gi;
|
|
|
3
3
|
const MODULEPRELOAD_RE = /<link\b[^>]*\brel=["']modulepreload["'][^>]*>/gi;
|
|
4
4
|
const HREF_RE = /\bhref=["']([^"']+)["']/i;
|
|
5
5
|
const MODULE_SCRIPT_RE = /<script\b([^>]*\btype=["']module["'][^>]*)\bsrc=["']([^"']+)["']([^>]*)><\/script>/gi;
|
|
6
|
-
const
|
|
6
|
+
const REGION_TAG_RE = /<ogygia-region\b[^>]*>/gi;
|
|
7
|
+
const REGION_ENTRY_RE = /((?<![\w-])entry=["'])([^"']+)(["'])/i;
|
|
8
|
+
const REGION_SRC_RE = /((?<![\w-])src=["'])([^"']+)(["'])/i;
|
|
7
9
|
/** a static or dynamic import of a RELATIVE specifier inside a built chunk — quoted, or a
|
|
8
10
|
* template literal with no interpolation (Vite emits `import(\`./chunks/x.js\`)`) */
|
|
9
11
|
const IMPORT_RE = /((?:\bfrom|\bimport)\s*\(?\s*)(["'`])(\.{1,2}\/[^"'`$]+)\2/g;
|
|
@@ -78,10 +80,16 @@ async function build_standalone(html, opts) {
|
|
|
78
80
|
chunks.delete(key);
|
|
79
81
|
}
|
|
80
82
|
const entries = [];
|
|
81
|
-
html = html.replace(
|
|
82
|
-
const
|
|
83
|
+
html = html.replace(REGION_TAG_RE, (tag) => {
|
|
84
|
+
const src = REGION_SRC_RE.exec(tag)?.[2];
|
|
85
|
+
const file = src ?? REGION_ENTRY_RE.exec(tag)?.[2];
|
|
86
|
+
if (!file) return tag;
|
|
87
|
+
const u = new URL(file, base);
|
|
83
88
|
entries.push(u);
|
|
84
|
-
|
|
89
|
+
const key = key_of(u);
|
|
90
|
+
let out = tag.replace(REGION_ENTRY_RE, (_m, open, _v, close) => open + key + close);
|
|
91
|
+
if (src) out = out.replace(REGION_SRC_RE, (_m, open, _v, close) => open + key + close);
|
|
92
|
+
return out;
|
|
85
93
|
});
|
|
86
94
|
for (const u of entries) await add_chunk(u);
|
|
87
95
|
const imports = {};
|
package/dist/server.js
CHANGED
|
@@ -2,6 +2,13 @@ import { profiler_demand_skip } from "./profiler/on-demand.js";
|
|
|
2
2
|
import { defineServer } from "@ogygia/core/plugin";
|
|
3
3
|
import { want_request_stats } from "@ogygia/core/internal/server";
|
|
4
4
|
// src/server.ts
|
|
5
|
+
/**
|
|
6
|
+
* The SERVER half of `devtools()` (its `server`). With the profiler on it
|
|
7
|
+
* wraps every request (`handle`): it times the render and serves its UI at `/__profiler`, and turns
|
|
8
|
+
* on core's request stats, its data. The profiler itself — node:inspector, crypto, the UI's render
|
|
9
|
+
* path — loads on the first request through a dynamic import, so an app pays for it only when it is
|
|
10
|
+
* on; with `onDemand`, only once someone opens the profiler.
|
|
11
|
+
*/
|
|
5
12
|
/** the mounted profiler; `undefined` until the first request resolves it, `null` when unavailable */
|
|
6
13
|
let mounted;
|
|
7
14
|
async function mount(options) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ogygia/devtools",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Devtools for ogygia: the in-page dock, and the SSR profiler with its report, client marks and storage adapters",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"devtools",
|
|
@@ -66,10 +66,13 @@
|
|
|
66
66
|
},
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"@neodrag/svelte": "3.0.0-next.12",
|
|
69
|
-
"
|
|
70
|
-
"
|
|
69
|
+
"@ogygia/router": "^0.12.0",
|
|
70
|
+
"devalue": "^5.9.3"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
|
+
"@ogygia/core": "0.12.0",
|
|
74
|
+
"@ogygia/tooling": "0.0.0",
|
|
75
|
+
"@ogygia/tsdown-plugin-svelte": "1.1.1",
|
|
73
76
|
"@playwright/test": "1.62.1",
|
|
74
77
|
"@sveltejs/kit": "^2.70.2",
|
|
75
78
|
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
|
@@ -80,16 +83,13 @@
|
|
|
80
83
|
"tsdown": "^0.23.4",
|
|
81
84
|
"typescript": "^6.0.3",
|
|
82
85
|
"vite": "^8.3.5",
|
|
83
|
-
"vitest": "^4.1.12"
|
|
84
|
-
"@ogygia/core": "0.11.1",
|
|
85
|
-
"@ogygia/tooling": "0.0.0",
|
|
86
|
-
"@ogygia/tsdown-plugin-svelte": "1.1.0"
|
|
86
|
+
"vitest": "^4.1.12"
|
|
87
87
|
},
|
|
88
88
|
"peerDependencies": {
|
|
89
|
+
"@ogygia/core": "^0.12.0",
|
|
89
90
|
"@sveltejs/kit": ">=2.70.2 <4",
|
|
90
91
|
"svelte": "^5.56.8",
|
|
91
|
-
"vite": "^8.2.4"
|
|
92
|
-
"@ogygia/core": "^0.11.1"
|
|
92
|
+
"vite": "^8.2.4"
|
|
93
93
|
},
|
|
94
94
|
"scripts": {
|
|
95
95
|
"build": "tsdown",
|