@wbce/projen-d9 0.0.28 → 0.1.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/.jsii +184 -45
- package/API.md +153 -37
- package/CHANGELOG.md +13 -0
- package/README.md +10 -3
- package/docs/D9-plumbing.md +189 -0
- package/lib/cli/atlas.d.ts +10 -0
- package/lib/cli/atlas.js +65 -0
- package/lib/cli/commands/cedar/cedar-format.d.ts +7 -0
- package/lib/cli/commands/cedar/cedar-format.js +75 -0
- package/lib/cli/commands/cedar/cedar-to-d9-translations.d.ts +12 -0
- package/lib/cli/commands/cedar/cedar-to-d9-translations.js +130 -0
- package/lib/cli/commands/cedar/cedar-to-d9.d.ts +57 -0
- package/lib/cli/commands/cedar/cedar-to-d9.js +221 -0
- package/lib/cli/commands/cedar/cedar-translations.d.ts +9 -0
- package/lib/cli/commands/cedar/cedar-translations.js +213 -0
- package/lib/cli/commands/cedar/d9-permission.d.ts +27 -0
- package/lib/cli/commands/cedar/d9-permission.js +45 -0
- package/lib/cli/commands/cedar/d9-to-cedar.d.ts +33 -0
- package/lib/cli/commands/cedar/d9-to-cedar.js +157 -0
- package/lib/cli/commands/cedar/roles-table.d.ts +14 -0
- package/lib/cli/commands/cedar/roles-table.js +29 -0
- package/lib/cli/commands/save/apply-snapshot.js +39 -30
- package/lib/cli/commands/save/check-unsaved.d.ts +9 -0
- package/lib/cli/commands/save/check-unsaved.js +81 -0
- package/lib/cli/commands/save/env.d.ts +33 -0
- package/lib/cli/commands/save/env.js +109 -0
- package/lib/cli/commands/save/save-snapshot.d.ts +9 -0
- package/lib/cli/commands/save/save-snapshot.js +232 -0
- package/lib/cli/commands/save/sync-files.d.ts +5 -0
- package/lib/cli/commands/save/sync-files.js +46 -0
- package/lib/cli/commands/save/transfer.d.ts +18 -0
- package/lib/cli/commands/save/transfer.js +96 -0
- package/lib/cli/commands/save/utils.d.ts +5 -0
- package/lib/cli/commands/save/utils.js +33 -3
- package/lib/cli/commands/sync.js +4 -3
- package/lib/cli/index.js +65 -25
- package/lib/cli/logger.d.ts +2 -0
- package/lib/cli/logger.js +10 -0
- package/lib/cli/plumbing-config.d.ts +11 -0
- package/lib/cli/plumbing-config.js +13 -0
- package/lib/index.d.ts +44 -5
- package/lib/index.js +54 -41
- package/node_modules/@cedar-policy/cedar-wasm/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm.d.ts +427 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm.js +9 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.js +434 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/esm/package.json +23 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm.d.ts +427 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm.js +463 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/nodejs/package.json +18 -0
- package/node_modules/@cedar-policy/cedar-wasm/package.json +53 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/README.md +181 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm.d.ts +486 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm.js +534 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm_bg.wasm +0 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/cedar_wasm_bg.wasm.d.ts +34 -0
- package/node_modules/@cedar-policy/cedar-wasm/web/package.json +21 -0
- package/node_modules/@types/node/README.md +5 -6
- package/node_modules/@types/node/assert/strict.d.ts +111 -0
- package/node_modules/@types/node/assert.d.ts +1040 -79
- package/node_modules/@types/node/async_hooks.d.ts +476 -119
- package/node_modules/@types/node/buffer.buffer.d.ts +472 -0
- package/node_modules/@types/node/buffer.d.ts +1925 -13
- package/node_modules/@types/node/child_process.d.ts +1204 -235
- package/node_modules/@types/node/cluster.d.ts +455 -137
- package/node_modules/@types/node/compatibility/disposable.d.ts +14 -0
- package/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/node_modules/@types/node/compatibility/iterators.d.ts +20 -0
- package/node_modules/@types/node/console.d.ts +450 -1
- package/node_modules/@types/node/constants.d.ts +20 -447
- package/node_modules/@types/node/crypto.d.ts +3962 -600
- package/node_modules/@types/node/dgram.d.ts +515 -33
- package/node_modules/@types/node/diagnostics_channel.d.ts +578 -0
- package/node_modules/@types/node/dns/promises.d.ts +503 -0
- package/node_modules/@types/node/dns.d.ts +798 -247
- package/node_modules/@types/node/domain.d.ts +164 -10
- package/node_modules/@types/node/events.d.ts +954 -25
- package/node_modules/@types/node/fs/promises.d.ts +1295 -0
- package/node_modules/@types/node/fs.d.ts +3463 -1569
- package/node_modules/@types/node/globals.d.ts +98 -1277
- package/node_modules/@types/node/globals.typedarray.d.ts +38 -0
- package/node_modules/@types/node/http.d.ts +1933 -300
- package/node_modules/@types/node/http2.d.ts +1946 -254
- package/node_modules/@types/node/https.d.ts +557 -134
- package/node_modules/@types/node/index.d.ts +54 -48
- package/node_modules/@types/node/inspector.d.ts +227 -3014
- package/node_modules/@types/node/inspector.generated.d.ts +4052 -0
- package/node_modules/@types/node/module.d.ts +890 -2
- package/node_modules/@types/node/net.d.ts +872 -105
- package/node_modules/@types/node/os.d.ts +452 -209
- package/node_modules/@types/node/package.json +78 -128
- package/node_modules/@types/node/path.d.ts +196 -155
- package/node_modules/@types/node/perf_hooks.d.ts +829 -120
- package/node_modules/@types/node/process.d.ts +2072 -3
- package/node_modules/@types/node/punycode.d.ts +69 -27
- package/node_modules/@types/node/querystring.d.ts +132 -9
- package/node_modules/@types/node/readline/promises.d.ts +161 -0
- package/node_modules/@types/node/readline.d.ts +485 -49
- package/node_modules/@types/node/repl.d.ts +121 -83
- package/node_modules/@types/node/sea.d.ts +153 -0
- package/node_modules/@types/node/sqlite.d.ts +721 -0
- package/node_modules/@types/node/stream/consumers.d.ts +38 -0
- package/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/node_modules/@types/node/stream/web.d.ts +622 -0
- package/node_modules/@types/node/stream.d.ts +1470 -140
- package/node_modules/@types/node/string_decoder.d.ts +64 -4
- package/node_modules/@types/node/test.d.ts +2163 -0
- package/node_modules/@types/node/timers/promises.d.ts +108 -0
- package/node_modules/@types/node/timers.d.ts +284 -13
- package/node_modules/@types/node/tls.d.ts +850 -244
- package/node_modules/@types/node/trace_events.d.ts +147 -11
- package/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +468 -0
- package/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +34 -0
- package/node_modules/@types/node/ts5.6/index.d.ts +97 -0
- package/node_modules/@types/node/tty.d.ts +160 -18
- package/node_modules/@types/node/url.d.ts +890 -53
- package/node_modules/@types/node/util.d.ts +2566 -160
- package/node_modules/@types/node/v8.d.ts +806 -83
- package/node_modules/@types/node/vm.d.ts +932 -44
- package/node_modules/@types/node/wasi.d.ts +148 -22
- package/node_modules/@types/node/web-globals/abortcontroller.d.ts +34 -0
- package/node_modules/@types/node/web-globals/domexception.d.ts +68 -0
- package/node_modules/@types/node/web-globals/events.d.ts +97 -0
- package/node_modules/@types/node/web-globals/fetch.d.ts +55 -0
- package/node_modules/@types/node/web-globals/navigator.d.ts +22 -0
- package/node_modules/@types/node/web-globals/storage.d.ts +24 -0
- package/node_modules/@types/node/worker_threads.d.ts +657 -80
- package/node_modules/@types/node/zlib.d.ts +510 -119
- package/node_modules/pino/.nojekyll +0 -0
- package/node_modules/pino/.prettierignore +1 -0
- package/node_modules/pino/CNAME +1 -0
- package/node_modules/pino/CONTRIBUTING.md +34 -0
- package/node_modules/pino/LICENSE +21 -0
- package/node_modules/pino/README.md +177 -0
- package/node_modules/pino/SECURITY.md +103 -0
- package/node_modules/pino/benchmarks/basic.bench.js +95 -0
- package/node_modules/pino/benchmarks/child-child.bench.js +52 -0
- package/node_modules/pino/benchmarks/child-creation.bench.js +73 -0
- package/node_modules/pino/benchmarks/child.bench.js +62 -0
- package/node_modules/pino/benchmarks/deep-object.bench.js +88 -0
- package/node_modules/pino/benchmarks/formatters.bench.js +50 -0
- package/node_modules/pino/benchmarks/internal/custom-levels.js +67 -0
- package/node_modules/pino/benchmarks/internal/just-pino-heavy.bench.js +76 -0
- package/node_modules/pino/benchmarks/internal/just-pino.bench.js +182 -0
- package/node_modules/pino/benchmarks/internal/parent-vs-child.bench.js +75 -0
- package/node_modules/pino/benchmarks/internal/redact.bench.js +86 -0
- package/node_modules/pino/benchmarks/long-string.bench.js +81 -0
- package/node_modules/pino/benchmarks/multi-arg.bench.js +193 -0
- package/node_modules/pino/benchmarks/multistream.js +98 -0
- package/node_modules/pino/benchmarks/object.bench.js +82 -0
- package/node_modules/pino/benchmarks/utils/generate-benchmark-doc.js +36 -0
- package/node_modules/pino/benchmarks/utils/runbench.js +138 -0
- package/node_modules/pino/benchmarks/utils/wrap-log-level.js +55 -0
- package/node_modules/pino/bin.js +6 -0
- package/node_modules/pino/browser.js +607 -0
- package/node_modules/pino/build/sync-version.js +25 -0
- package/node_modules/pino/docs/api.md +1664 -0
- package/node_modules/pino/docs/asynchronous.md +55 -0
- package/node_modules/pino/docs/benchmarks.md +55 -0
- package/node_modules/pino/docs/browser.md +341 -0
- package/node_modules/pino/docs/bundling.md +40 -0
- package/node_modules/pino/docs/child-loggers.md +116 -0
- package/node_modules/pino/docs/diagnostics.md +16 -0
- package/node_modules/pino/docs/ecosystem.md +87 -0
- package/node_modules/pino/docs/help.md +353 -0
- package/node_modules/pino/docs/lts.md +93 -0
- package/node_modules/pino/docs/pretty.md +38 -0
- package/node_modules/pino/docs/redaction.md +130 -0
- package/node_modules/pino/docs/transports.md +1447 -0
- package/node_modules/pino/docs/web.md +306 -0
- package/node_modules/pino/eslint.config.js +36 -0
- package/node_modules/pino/examples/basic.js +43 -0
- package/node_modules/pino/examples/transport.js +68 -0
- package/node_modules/pino/favicon.ico +0 -0
- package/node_modules/pino/file.js +12 -0
- package/node_modules/pino/inc-version.sh +42 -0
- package/node_modules/pino/index.html +55 -0
- package/node_modules/pino/lib/caller.js +40 -0
- package/node_modules/pino/lib/constants.js +28 -0
- package/node_modules/pino/lib/deprecations.js +8 -0
- package/node_modules/pino/lib/levels.js +241 -0
- package/node_modules/pino/lib/meta.js +3 -0
- package/node_modules/pino/lib/multistream.js +211 -0
- package/node_modules/pino/lib/proto.js +256 -0
- package/node_modules/pino/lib/redaction.js +119 -0
- package/node_modules/pino/lib/symbols.js +76 -0
- package/node_modules/pino/lib/time.js +39 -0
- package/node_modules/pino/lib/tools.js +427 -0
- package/node_modules/pino/lib/transport-stream.js +56 -0
- package/node_modules/pino/lib/transport.js +302 -0
- package/node_modules/pino/lib/worker.js +197 -0
- package/node_modules/pino/package.json +112 -0
- package/node_modules/pino/pino.d.ts +881 -0
- package/node_modules/pino/pino.js +259 -0
- package/node_modules/pino/test/basic.test.js +952 -0
- package/node_modules/pino/test/broken-pipe.test.js +59 -0
- package/node_modules/pino/test/browser-bindings.test.js +114 -0
- package/node_modules/pino/test/browser-child.test.js +132 -0
- package/node_modules/pino/test/browser-disabled.test.js +87 -0
- package/node_modules/pino/test/browser-early-console-freeze.test.js +12 -0
- package/node_modules/pino/test/browser-is-level-enabled.test.js +101 -0
- package/node_modules/pino/test/browser-levels.test.js +241 -0
- package/node_modules/pino/test/browser-redaction.test.js +264 -0
- package/node_modules/pino/test/browser-serializers.test.js +352 -0
- package/node_modules/pino/test/browser-set-bindings.test.js +99 -0
- package/node_modules/pino/test/browser-timestamp.test.js +88 -0
- package/node_modules/pino/test/browser-transmit.test.js +417 -0
- package/node_modules/pino/test/browser.test.js +698 -0
- package/node_modules/pino/test/caller.test.js +20 -0
- package/node_modules/pino/test/complex-objects.test.js +36 -0
- package/node_modules/pino/test/crlf.test.js +34 -0
- package/node_modules/pino/test/custom-levels.test.js +267 -0
- package/node_modules/pino/test/diagnostics.test.js +107 -0
- package/node_modules/pino/test/error-key.test.js +37 -0
- package/node_modules/pino/test/error.test.js +403 -0
- package/node_modules/pino/test/escaping.test.js +110 -0
- package/node_modules/pino/test/esm/esm.mjs +14 -0
- package/node_modules/pino/test/esm/index.test.js +21 -0
- package/node_modules/pino/test/esm/named-exports.mjs +29 -0
- package/node_modules/pino/test/exit.test.js +79 -0
- package/node_modules/pino/test/fixtures/broken-pipe/basic.js +9 -0
- package/node_modules/pino/test/fixtures/broken-pipe/destination.js +10 -0
- package/node_modules/pino/test/fixtures/broken-pipe/syncfalse.js +12 -0
- package/node_modules/pino/test/fixtures/caller-loop.js +6 -0
- package/node_modules/pino/test/fixtures/console-transport.js +13 -0
- package/node_modules/pino/test/fixtures/crashing-transport.js +13 -0
- package/node_modules/pino/test/fixtures/default-exit.js +8 -0
- package/node_modules/pino/test/fixtures/destination-exit.js +8 -0
- package/node_modules/pino/test/fixtures/eval/index.js +13 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/14-files.js +3 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/2-files.js +3 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file1.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file10.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file11.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file12.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file13.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file14.js +11 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file2.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file3.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file4.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file5.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file6.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file7.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file8.js +5 -0
- package/node_modules/pino/test/fixtures/eval/node_modules/file9.js +5 -0
- package/node_modules/pino/test/fixtures/noop-transport.js +10 -0
- package/node_modules/pino/test/fixtures/pretty/null-prototype.js +8 -0
- package/node_modules/pino/test/fixtures/stdout-hack-protection.js +11 -0
- package/node_modules/pino/test/fixtures/syncfalse-child.js +6 -0
- package/node_modules/pino/test/fixtures/syncfalse-exit.js +9 -0
- package/node_modules/pino/test/fixtures/syncfalse-flush-exit.js +10 -0
- package/node_modules/pino/test/fixtures/syncfalse.js +6 -0
- package/node_modules/pino/test/fixtures/syntax-error-esm.mjs +2 -0
- package/node_modules/pino/test/fixtures/to-file-transport-with-transform.js +20 -0
- package/node_modules/pino/test/fixtures/to-file-transport.js +13 -0
- package/node_modules/pino/test/fixtures/to-file-transport.mjs +8 -0
- package/node_modules/pino/test/fixtures/transport/index.js +12 -0
- package/node_modules/pino/test/fixtures/transport/package.json +5 -0
- package/node_modules/pino/test/fixtures/transport-exit-immediately-with-async-dest.js +16 -0
- package/node_modules/pino/test/fixtures/transport-exit-immediately.js +11 -0
- package/node_modules/pino/test/fixtures/transport-exit-on-ready.js +12 -0
- package/node_modules/pino/test/fixtures/transport-invalid-node-options.js +26 -0
- package/node_modules/pino/test/fixtures/transport-main.js +9 -0
- package/node_modules/pino/test/fixtures/transport-many-lines.js +29 -0
- package/node_modules/pino/test/fixtures/transport-preload-main.mjs +13 -0
- package/node_modules/pino/test/fixtures/transport-preload.mjs +13 -0
- package/node_modules/pino/test/fixtures/transport-string-stdout.js +9 -0
- package/node_modules/pino/test/fixtures/transport-transform.js +21 -0
- package/node_modules/pino/test/fixtures/transport-uses-pino-config.js +33 -0
- package/node_modules/pino/test/fixtures/transport-with-on-exit.js +12 -0
- package/node_modules/pino/test/fixtures/transport-worker-data.js +19 -0
- package/node_modules/pino/test/fixtures/transport-worker-name.js +24 -0
- package/node_modules/pino/test/fixtures/transport-worker.js +15 -0
- package/node_modules/pino/test/fixtures/transport-wrong-export-type.js +3 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport-native.mts +15 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport-with-transform.ts +18 -0
- package/node_modules/pino/test/fixtures/ts/to-file-transport.ts +11 -0
- package/node_modules/pino/test/fixtures/ts/transpile.cjs +36 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-immediately-with-async-dest.ts +15 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-immediately.ts +10 -0
- package/node_modules/pino/test/fixtures/ts/transport-exit-on-ready.ts +11 -0
- package/node_modules/pino/test/fixtures/ts/transport-main.ts +8 -0
- package/node_modules/pino/test/fixtures/ts/transport-string-stdout.ts +8 -0
- package/node_modules/pino/test/fixtures/ts/transport-worker.ts +14 -0
- package/node_modules/pino/test/formatters.test.js +364 -0
- package/node_modules/pino/test/helper.d.ts +4 -0
- package/node_modules/pino/test/helper.js +159 -0
- package/node_modules/pino/test/hooks.test.js +114 -0
- package/node_modules/pino/test/http.test.js +214 -0
- package/node_modules/pino/test/internals/version.test.js +17 -0
- package/node_modules/pino/test/is-level-enabled.test.js +179 -0
- package/node_modules/pino/test/jest/basic.spec.js +10 -0
- package/node_modules/pino/test/levels.test.js +810 -0
- package/node_modules/pino/test/metadata.test.js +120 -0
- package/node_modules/pino/test/mixin-merge-strategy.test.js +57 -0
- package/node_modules/pino/test/mixin.test.js +241 -0
- package/node_modules/pino/test/multistream.test.js +793 -0
- package/node_modules/pino/test/redact.test.js +923 -0
- package/node_modules/pino/test/serializers.test.js +257 -0
- package/node_modules/pino/test/smoke.js +59 -0
- package/node_modules/pino/test/stdout-protection.test.js +41 -0
- package/node_modules/pino/test/syncfalse.test.js +186 -0
- package/node_modules/pino/test/timestamp-nano.test.js +37 -0
- package/node_modules/pino/test/timestamp.test.js +124 -0
- package/node_modules/pino/test/transport/big.test.js +42 -0
- package/node_modules/pino/test/transport/bundlers-support.test.js +99 -0
- package/node_modules/pino/test/transport/caller.test.js +24 -0
- package/node_modules/pino/test/transport/core.test.js +818 -0
- package/node_modules/pino/test/transport/core.transpiled.test.ts +114 -0
- package/node_modules/pino/test/transport/crash.test.js +36 -0
- package/node_modules/pino/test/transport/module-link.test.js +241 -0
- package/node_modules/pino/test/transport/native-type-stripping.test.mjs +151 -0
- package/node_modules/pino/test/transport/node-options.test.js +116 -0
- package/node_modules/pino/test/transport/pipeline.test.js +137 -0
- package/node_modules/pino/test/transport/preload.test.js +54 -0
- package/node_modules/pino/test/transport/repl.test.js +15 -0
- package/node_modules/pino/test/transport/sync-false.test.js +79 -0
- package/node_modules/pino/test/transport/sync-true.test.js +57 -0
- package/node_modules/pino/test/transport/targets.test.js +48 -0
- package/node_modules/pino/test/transport/uses-pino-config.test.js +166 -0
- package/node_modules/pino/test/transport-stream.test.js +40 -0
- package/node_modules/pino/test/types/pino-import.tst.cts +30 -0
- package/node_modules/pino/test/types/pino-import.tst.js +73 -0
- package/node_modules/pino/test/types/pino-multistream.tst.ts +49 -0
- package/node_modules/pino/test/types/pino-top-export.tst.ts +32 -0
- package/node_modules/pino/test/types/pino-transport.tst.ts +171 -0
- package/node_modules/pino/test/types/pino-type-only.tst.ts +77 -0
- package/node_modules/pino/test/types/pino.ts +98 -0
- package/node_modules/pino/test/types/pino.tst.ts +681 -0
- package/node_modules/pino/test/types/tsconfig.json +10 -0
- package/node_modules/pino/tsconfig.json +14 -0
- package/node_modules/pino-pretty/.borp.yaml +6 -0
- package/node_modules/pino-pretty/.editorconfig +13 -0
- package/node_modules/pino-pretty/.github/dependabot.yml +13 -0
- package/node_modules/pino-pretty/.github/workflows/ci.yml +83 -0
- package/node_modules/pino-pretty/LICENSE +21 -0
- package/node_modules/pino-pretty/Readme.md +425 -0
- package/node_modules/pino-pretty/SECURITY.md +146 -0
- package/node_modules/pino-pretty/benchmark.js +105 -0
- package/node_modules/pino-pretty/bin.js +113 -0
- package/node_modules/pino-pretty/demo.png +0 -0
- package/node_modules/pino-pretty/docs/help.md +24 -0
- package/node_modules/pino-pretty/eslint.config.js +5 -0
- package/node_modules/pino-pretty/help/help.txt +68 -0
- package/node_modules/pino-pretty/index.d.ts +227 -0
- package/node_modules/pino-pretty/index.js +234 -0
- package/node_modules/pino-pretty/lib/colors.js +134 -0
- package/node_modules/pino-pretty/lib/colors.test.js +132 -0
- package/node_modules/pino-pretty/lib/constants.js +55 -0
- package/node_modules/pino-pretty/lib/pretty.js +171 -0
- package/node_modules/pino-pretty/lib/utils/build-safe-sonic-boom.js +69 -0
- package/node_modules/pino-pretty/lib/utils/build-safe-sonic-boom.test.js +84 -0
- package/node_modules/pino-pretty/lib/utils/create-date.js +26 -0
- package/node_modules/pino-pretty/lib/utils/create-date.test.js +20 -0
- package/node_modules/pino-pretty/lib/utils/delete-log-property.js +28 -0
- package/node_modules/pino-pretty/lib/utils/delete-log-property.test.js +31 -0
- package/node_modules/pino-pretty/lib/utils/filter-log.js +99 -0
- package/node_modules/pino-pretty/lib/utils/filter-log.test.js +265 -0
- package/node_modules/pino-pretty/lib/utils/format-time.js +66 -0
- package/node_modules/pino-pretty/lib/utils/format-time.test.js +71 -0
- package/node_modules/pino-pretty/lib/utils/get-level-label-data.js +29 -0
- package/node_modules/pino-pretty/lib/utils/get-property-value.js +30 -0
- package/node_modules/pino-pretty/lib/utils/get-property-value.test.js +31 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-names-opts.js +38 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-names-opts.test.js +45 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-opts.js +39 -0
- package/node_modules/pino-pretty/lib/utils/handle-custom-levels-opts.test.js +47 -0
- package/node_modules/pino-pretty/lib/utils/index.js +108 -0
- package/node_modules/pino-pretty/lib/utils/index.test.js +37 -0
- package/node_modules/pino-pretty/lib/utils/interpret-conditionals.js +41 -0
- package/node_modules/pino-pretty/lib/utils/interpret-conditionals.test.js +84 -0
- package/node_modules/pino-pretty/lib/utils/is-object.js +7 -0
- package/node_modules/pino-pretty/lib/utils/is-object.test.js +10 -0
- package/node_modules/pino-pretty/lib/utils/is-valid-date.js +14 -0
- package/node_modules/pino-pretty/lib/utils/is-valid-date.test.js +16 -0
- package/node_modules/pino-pretty/lib/utils/join-lines-with-indentation.js +29 -0
- package/node_modules/pino-pretty/lib/utils/join-lines-with-indentation.test.js +16 -0
- package/node_modules/pino-pretty/lib/utils/noop.js +3 -0
- package/node_modules/pino-pretty/lib/utils/noop.test.js +12 -0
- package/node_modules/pino-pretty/lib/utils/parse-factory-options.js +171 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error-log.js +76 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error-log.test.js +143 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error.js +54 -0
- package/node_modules/pino-pretty/lib/utils/prettify-error.test.js +25 -0
- package/node_modules/pino-pretty/lib/utils/prettify-level.js +41 -0
- package/node_modules/pino-pretty/lib/utils/prettify-level.test.js +70 -0
- package/node_modules/pino-pretty/lib/utils/prettify-message.js +65 -0
- package/node_modules/pino-pretty/lib/utils/prettify-message.test.js +287 -0
- package/node_modules/pino-pretty/lib/utils/prettify-metadata.js +75 -0
- package/node_modules/pino-pretty/lib/utils/prettify-metadata.test.js +170 -0
- package/node_modules/pino-pretty/lib/utils/prettify-object.js +115 -0
- package/node_modules/pino-pretty/lib/utils/prettify-object.test.js +217 -0
- package/node_modules/pino-pretty/lib/utils/prettify-time.js +43 -0
- package/node_modules/pino-pretty/lib/utils/prettify-time.test.js +264 -0
- package/node_modules/pino-pretty/lib/utils/split-property-key.js +49 -0
- package/node_modules/pino-pretty/lib/utils/split-property-key.test.js +29 -0
- package/node_modules/pino-pretty/lib/utils/strip-unsafe-control-chars.js +18 -0
- package/node_modules/pino-pretty/lib/utils/strip-unsafe-control-chars.test.js +9 -0
- package/node_modules/pino-pretty/package.json +64 -0
- package/node_modules/pino-pretty/test/basic.test.js +1305 -0
- package/node_modules/pino-pretty/test/boolean-options.test.js +228 -0
- package/node_modules/pino-pretty/test/cli-rc.test.js +275 -0
- package/node_modules/pino-pretty/test/cli.test.js +360 -0
- package/node_modules/pino-pretty/test/crlf.test.js +33 -0
- package/node_modules/pino-pretty/test/error-objects.test.js +494 -0
- package/node_modules/pino-pretty/test/example/example.js +33 -0
- package/node_modules/pino-pretty/test/helper.js +19 -0
- package/node_modules/pino-pretty/test/types/exports.tst.ts +15 -0
- package/node_modules/pino-pretty/test/types/pino-pretty.tst.ts +140 -0
- package/node_modules/pino-pretty/test/types/tsconfig.json +9 -0
- package/package.json +12 -5
- package/lib/cli/commands/init.d.ts +0 -1
- package/lib/cli/commands/init.js +0 -8
- package/node_modules/@types/node/globals.global.d.ts +0 -1
|
@@ -1,102 +1,332 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/**
|
|
2
|
+
* This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for
|
|
3
|
+
* Node.js-specific performance measurements.
|
|
4
|
+
*
|
|
5
|
+
* Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/):
|
|
6
|
+
*
|
|
7
|
+
* * [High Resolution Time](https://www.w3.org/TR/hr-time-2)
|
|
8
|
+
* * [Performance Timeline](https://w3c.github.io/performance-timeline/)
|
|
9
|
+
* * [User Timing](https://www.w3.org/TR/user-timing/)
|
|
10
|
+
* * [Resource Timing](https://www.w3.org/TR/resource-timing-2/)
|
|
11
|
+
*
|
|
12
|
+
* ```js
|
|
13
|
+
* import { PerformanceObserver, performance } from 'node:perf_hooks';
|
|
14
|
+
*
|
|
15
|
+
* const obs = new PerformanceObserver((items) => {
|
|
16
|
+
* console.log(items.getEntries()[0].duration);
|
|
17
|
+
* performance.clearMarks();
|
|
18
|
+
* });
|
|
19
|
+
* obs.observe({ type: 'measure' });
|
|
20
|
+
* performance.measure('Start to Now');
|
|
21
|
+
*
|
|
22
|
+
* performance.mark('A');
|
|
23
|
+
* doSomeLongRunningProcess(() => {
|
|
24
|
+
* performance.measure('A to Now', 'A');
|
|
25
|
+
*
|
|
26
|
+
* performance.mark('B');
|
|
27
|
+
* performance.measure('A to B', 'A', 'B');
|
|
28
|
+
* });
|
|
29
|
+
* ```
|
|
30
|
+
* @see [source](https://github.com/nodejs/node/blob/v22.x/lib/perf_hooks.js)
|
|
31
|
+
*/
|
|
32
|
+
declare module "perf_hooks" {
|
|
33
|
+
import { AsyncResource } from "node:async_hooks";
|
|
34
|
+
type EntryType =
|
|
35
|
+
| "dns" // Node.js only
|
|
36
|
+
| "function" // Node.js only
|
|
37
|
+
| "gc" // Node.js only
|
|
38
|
+
| "http2" // Node.js only
|
|
39
|
+
| "http" // Node.js only
|
|
40
|
+
| "mark" // available on the Web
|
|
41
|
+
| "measure" // available on the Web
|
|
42
|
+
| "net" // Node.js only
|
|
43
|
+
| "node" // Node.js only
|
|
44
|
+
| "resource"; // available on the Web
|
|
45
|
+
interface NodeGCPerformanceDetail {
|
|
46
|
+
/**
|
|
47
|
+
* When `performanceEntry.entryType` is equal to 'gc', the `performance.kind` property identifies
|
|
48
|
+
* the type of garbage collection operation that occurred.
|
|
49
|
+
* See perf_hooks.constants for valid values.
|
|
50
|
+
*/
|
|
51
|
+
readonly kind: number;
|
|
52
|
+
/**
|
|
53
|
+
* When `performanceEntry.entryType` is equal to 'gc', the `performance.flags`
|
|
54
|
+
* property contains additional information about garbage collection operation.
|
|
55
|
+
* See perf_hooks.constants for valid values.
|
|
56
|
+
*/
|
|
57
|
+
readonly flags: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The constructor of this class is not exposed to users directly.
|
|
61
|
+
* @since v8.5.0
|
|
62
|
+
*/
|
|
63
|
+
class PerformanceEntry {
|
|
64
|
+
protected constructor();
|
|
5
65
|
/**
|
|
6
|
-
* The total number of milliseconds elapsed for this entry.
|
|
7
|
-
*
|
|
66
|
+
* The total number of milliseconds elapsed for this entry. This value will not
|
|
67
|
+
* be meaningful for all Performance Entry types.
|
|
68
|
+
* @since v8.5.0
|
|
8
69
|
*/
|
|
9
70
|
readonly duration: number;
|
|
10
|
-
|
|
11
71
|
/**
|
|
12
72
|
* The name of the performance entry.
|
|
73
|
+
* @since v8.5.0
|
|
13
74
|
*/
|
|
14
75
|
readonly name: string;
|
|
15
|
-
|
|
16
76
|
/**
|
|
17
|
-
* The high resolution millisecond timestamp marking the starting time of the
|
|
77
|
+
* The high resolution millisecond timestamp marking the starting time of the
|
|
78
|
+
* Performance Entry.
|
|
79
|
+
* @since v8.5.0
|
|
18
80
|
*/
|
|
19
81
|
readonly startTime: number;
|
|
20
|
-
|
|
21
82
|
/**
|
|
22
|
-
* The type of the performance entry.
|
|
23
|
-
*
|
|
83
|
+
* The type of the performance entry. It may be one of:
|
|
84
|
+
*
|
|
85
|
+
* * `'node'` (Node.js only)
|
|
86
|
+
* * `'mark'` (available on the Web)
|
|
87
|
+
* * `'measure'` (available on the Web)
|
|
88
|
+
* * `'gc'` (Node.js only)
|
|
89
|
+
* * `'function'` (Node.js only)
|
|
90
|
+
* * `'http2'` (Node.js only)
|
|
91
|
+
* * `'http'` (Node.js only)
|
|
92
|
+
* @since v8.5.0
|
|
93
|
+
*/
|
|
94
|
+
readonly entryType: EntryType;
|
|
95
|
+
toJSON(): any;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Exposes marks created via the `Performance.mark()` method.
|
|
99
|
+
* @since v18.2.0, v16.17.0
|
|
100
|
+
*/
|
|
101
|
+
class PerformanceMark extends PerformanceEntry {
|
|
102
|
+
readonly detail: any;
|
|
103
|
+
readonly duration: 0;
|
|
104
|
+
readonly entryType: "mark";
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Exposes measures created via the `Performance.measure()` method.
|
|
108
|
+
*
|
|
109
|
+
* The constructor of this class is not exposed to users directly.
|
|
110
|
+
* @since v18.2.0, v16.17.0
|
|
111
|
+
*/
|
|
112
|
+
class PerformanceMeasure extends PerformanceEntry {
|
|
113
|
+
readonly detail: any;
|
|
114
|
+
readonly entryType: "measure";
|
|
115
|
+
}
|
|
116
|
+
interface UVMetrics {
|
|
117
|
+
/**
|
|
118
|
+
* Number of event loop iterations.
|
|
24
119
|
*/
|
|
25
|
-
readonly
|
|
26
|
-
|
|
120
|
+
readonly loopCount: number;
|
|
27
121
|
/**
|
|
28
|
-
*
|
|
29
|
-
* the type of garbage collection operation that occurred.
|
|
30
|
-
* The value may be one of perf_hooks.constants.
|
|
122
|
+
* Number of events that have been processed by the event handler.
|
|
31
123
|
*/
|
|
32
|
-
readonly
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
interface PerformanceNodeTiming extends PerformanceEntry {
|
|
124
|
+
readonly events: number;
|
|
36
125
|
/**
|
|
37
|
-
*
|
|
38
|
-
|
|
126
|
+
* Number of events that were waiting to be processed when the event provider was called.
|
|
127
|
+
*/
|
|
128
|
+
readonly eventsWaiting: number;
|
|
129
|
+
}
|
|
130
|
+
// TODO: PerformanceNodeEntry is missing
|
|
131
|
+
/**
|
|
132
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
133
|
+
*
|
|
134
|
+
* Provides timing details for Node.js itself. The constructor of this class
|
|
135
|
+
* is not exposed to users.
|
|
136
|
+
* @since v8.5.0
|
|
137
|
+
*/
|
|
138
|
+
class PerformanceNodeTiming extends PerformanceEntry {
|
|
139
|
+
readonly entryType: "node";
|
|
140
|
+
/**
|
|
141
|
+
* The high resolution millisecond timestamp at which the Node.js process
|
|
142
|
+
* completed bootstrapping. If bootstrapping has not yet finished, the property
|
|
143
|
+
* has the value of -1.
|
|
144
|
+
* @since v8.5.0
|
|
39
145
|
*/
|
|
40
146
|
readonly bootstrapComplete: number;
|
|
41
|
-
|
|
42
147
|
/**
|
|
43
|
-
* The high resolution millisecond timestamp at which the Node.js
|
|
44
|
-
*
|
|
148
|
+
* The high resolution millisecond timestamp at which the Node.js environment was
|
|
149
|
+
* initialized.
|
|
150
|
+
* @since v8.5.0
|
|
45
151
|
*/
|
|
46
152
|
readonly environment: number;
|
|
47
|
-
|
|
48
153
|
/**
|
|
49
|
-
* The high resolution millisecond timestamp
|
|
154
|
+
* The high resolution millisecond timestamp of the amount of time the event loop
|
|
155
|
+
* has been idle within the event loop's event provider (e.g. `epoll_wait`). This
|
|
156
|
+
* does not take CPU usage into consideration. If the event loop has not yet
|
|
157
|
+
* started (e.g., in the first tick of the main script), the property has the
|
|
158
|
+
* value of 0.
|
|
159
|
+
* @since v14.10.0, v12.19.0
|
|
50
160
|
*/
|
|
51
161
|
readonly idleTime: number;
|
|
52
|
-
|
|
53
162
|
/**
|
|
54
|
-
* The high resolution millisecond timestamp at which the Node.js event loop
|
|
55
|
-
* If the event loop has not yet exited, the property has the value of -1
|
|
56
|
-
* It can only have a value of not -1 in a handler of the 'exit' event.
|
|
163
|
+
* The high resolution millisecond timestamp at which the Node.js event loop
|
|
164
|
+
* exited. If the event loop has not yet exited, the property has the value of -1\.
|
|
165
|
+
* It can only have a value of not -1 in a handler of the `'exit'` event.
|
|
166
|
+
* @since v8.5.0
|
|
57
167
|
*/
|
|
58
168
|
readonly loopExit: number;
|
|
59
|
-
|
|
60
169
|
/**
|
|
61
|
-
* The high resolution millisecond timestamp at which the Node.js event loop
|
|
62
|
-
* If the event loop has not yet started (e.g., in the first tick of the
|
|
170
|
+
* The high resolution millisecond timestamp at which the Node.js event loop
|
|
171
|
+
* started. If the event loop has not yet started (e.g., in the first tick of the
|
|
172
|
+
* main script), the property has the value of -1.
|
|
173
|
+
* @since v8.5.0
|
|
63
174
|
*/
|
|
64
175
|
readonly loopStart: number;
|
|
65
|
-
|
|
66
176
|
/**
|
|
67
177
|
* The high resolution millisecond timestamp at which the Node.js process was initialized.
|
|
178
|
+
* @since v8.5.0
|
|
68
179
|
*/
|
|
69
180
|
readonly nodeStart: number;
|
|
70
|
-
|
|
71
181
|
/**
|
|
72
|
-
*
|
|
182
|
+
* This is a wrapper to the `uv_metrics_info` function.
|
|
183
|
+
* It returns the current set of event loop metrics.
|
|
184
|
+
*
|
|
185
|
+
* It is recommended to use this property inside a function whose execution was
|
|
186
|
+
* scheduled using `setImmediate` to avoid collecting metrics before finishing all
|
|
187
|
+
* operations scheduled during the current loop iteration.
|
|
188
|
+
* @since v22.8.0, v20.18.0
|
|
189
|
+
*/
|
|
190
|
+
readonly uvMetricsInfo: UVMetrics;
|
|
191
|
+
/**
|
|
192
|
+
* The high resolution millisecond timestamp at which the V8 platform was
|
|
193
|
+
* initialized.
|
|
194
|
+
* @since v8.5.0
|
|
73
195
|
*/
|
|
74
196
|
readonly v8Start: number;
|
|
75
197
|
}
|
|
76
|
-
|
|
77
198
|
interface EventLoopUtilization {
|
|
78
199
|
idle: number;
|
|
79
200
|
active: number;
|
|
80
201
|
utilization: number;
|
|
81
202
|
}
|
|
82
|
-
|
|
203
|
+
/**
|
|
204
|
+
* @param utilization1 The result of a previous call to `eventLoopUtilization()`.
|
|
205
|
+
* @param utilization2 The result of a previous call to `eventLoopUtilization()` prior to `utilization1`.
|
|
206
|
+
*/
|
|
207
|
+
type EventLoopUtilityFunction = (
|
|
208
|
+
utilization1?: EventLoopUtilization,
|
|
209
|
+
utilization2?: EventLoopUtilization,
|
|
210
|
+
) => EventLoopUtilization;
|
|
211
|
+
interface MarkOptions {
|
|
212
|
+
/**
|
|
213
|
+
* Additional optional detail to include with the mark.
|
|
214
|
+
*/
|
|
215
|
+
detail?: unknown | undefined;
|
|
216
|
+
/**
|
|
217
|
+
* An optional timestamp to be used as the mark time.
|
|
218
|
+
* @default `performance.now()`
|
|
219
|
+
*/
|
|
220
|
+
startTime?: number | undefined;
|
|
221
|
+
}
|
|
222
|
+
interface MeasureOptions {
|
|
223
|
+
/**
|
|
224
|
+
* Additional optional detail to include with the mark.
|
|
225
|
+
*/
|
|
226
|
+
detail?: unknown;
|
|
227
|
+
/**
|
|
228
|
+
* Duration between start and end times.
|
|
229
|
+
*/
|
|
230
|
+
duration?: number | undefined;
|
|
231
|
+
/**
|
|
232
|
+
* Timestamp to be used as the end time, or a string identifying a previously recorded mark.
|
|
233
|
+
*/
|
|
234
|
+
end?: number | string | undefined;
|
|
235
|
+
/**
|
|
236
|
+
* Timestamp to be used as the start time, or a string identifying a previously recorded mark.
|
|
237
|
+
*/
|
|
238
|
+
start?: number | string | undefined;
|
|
239
|
+
}
|
|
240
|
+
interface TimerifyOptions {
|
|
241
|
+
/**
|
|
242
|
+
* A histogram object created using `perf_hooks.createHistogram()` that will record runtime
|
|
243
|
+
* durations in nanoseconds.
|
|
244
|
+
*/
|
|
245
|
+
histogram?: RecordableHistogram | undefined;
|
|
246
|
+
}
|
|
83
247
|
interface Performance {
|
|
84
248
|
/**
|
|
85
|
-
* If name is not provided, removes all PerformanceMark objects from the Performance Timeline.
|
|
86
|
-
* If name is provided, removes only the named mark.
|
|
87
|
-
* @
|
|
249
|
+
* If `name` is not provided, removes all `PerformanceMark` objects from the Performance Timeline.
|
|
250
|
+
* If `name` is provided, removes only the named mark.
|
|
251
|
+
* @since v8.5.0
|
|
88
252
|
*/
|
|
89
253
|
clearMarks(name?: string): void;
|
|
90
|
-
|
|
91
254
|
/**
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
255
|
+
* If `name` is not provided, removes all `PerformanceMeasure` objects from the Performance Timeline.
|
|
256
|
+
* If `name` is provided, removes only the named measure.
|
|
257
|
+
* @since v16.7.0
|
|
258
|
+
*/
|
|
259
|
+
clearMeasures(name?: string): void;
|
|
260
|
+
/**
|
|
261
|
+
* If `name` is not provided, removes all `PerformanceResourceTiming` objects from the Resource Timeline.
|
|
262
|
+
* If `name` is provided, removes only the named resource.
|
|
263
|
+
* @since v18.2.0, v16.17.0
|
|
264
|
+
*/
|
|
265
|
+
clearResourceTimings(name?: string): void;
|
|
266
|
+
/**
|
|
267
|
+
* eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time.
|
|
268
|
+
* It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait).
|
|
269
|
+
* No other CPU idle time is taken into consideration.
|
|
270
|
+
*/
|
|
271
|
+
eventLoopUtilization: EventLoopUtilityFunction;
|
|
272
|
+
/**
|
|
273
|
+
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`.
|
|
274
|
+
* If you are only interested in performance entries of certain types or that have certain names, see
|
|
275
|
+
* `performance.getEntriesByType()` and `performance.getEntriesByName()`.
|
|
276
|
+
* @since v16.7.0
|
|
277
|
+
*/
|
|
278
|
+
getEntries(): PerformanceEntry[];
|
|
279
|
+
/**
|
|
280
|
+
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
|
|
281
|
+
* whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`.
|
|
282
|
+
* @param name
|
|
283
|
+
* @param type
|
|
284
|
+
* @since v16.7.0
|
|
285
|
+
*/
|
|
286
|
+
getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
|
|
287
|
+
/**
|
|
288
|
+
* Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`
|
|
289
|
+
* whose `performanceEntry.entryType` is equal to `type`.
|
|
290
|
+
* @param type
|
|
291
|
+
* @since v16.7.0
|
|
292
|
+
*/
|
|
293
|
+
getEntriesByType(type: EntryType): PerformanceEntry[];
|
|
294
|
+
/**
|
|
295
|
+
* Creates a new `PerformanceMark` entry in the Performance Timeline.
|
|
296
|
+
* A `PerformanceMark` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'mark'`,
|
|
297
|
+
* and whose `performanceEntry.duration` is always `0`.
|
|
95
298
|
* Performance marks are used to mark specific significant moments in the Performance Timeline.
|
|
299
|
+
*
|
|
300
|
+
* The created `PerformanceMark` entry is put in the global Performance Timeline and can be queried with
|
|
301
|
+
* `performance.getEntries`, `performance.getEntriesByName`, and `performance.getEntriesByType`. When the observation is
|
|
302
|
+
* performed, the entries should be cleared from the global Performance Timeline manually with `performance.clearMarks`.
|
|
96
303
|
* @param name
|
|
97
304
|
*/
|
|
98
|
-
mark(name?:
|
|
99
|
-
|
|
305
|
+
mark(name: string, options?: MarkOptions): PerformanceMark;
|
|
306
|
+
/**
|
|
307
|
+
* Creates a new `PerformanceResourceTiming` entry in the Resource Timeline.
|
|
308
|
+
* A `PerformanceResourceTiming` is a subclass of `PerformanceEntry` whose `performanceEntry.entryType` is always `'resource'`.
|
|
309
|
+
* Performance resources are used to mark moments in the Resource Timeline.
|
|
310
|
+
* @param timingInfo [Fetch Timing Info](https://fetch.spec.whatwg.org/#fetch-timing-info)
|
|
311
|
+
* @param requestedUrl The resource url
|
|
312
|
+
* @param initiatorType The initiator name, e.g: 'fetch'
|
|
313
|
+
* @param global
|
|
314
|
+
* @param cacheMode The cache mode must be an empty string ('') or 'local'
|
|
315
|
+
* @param bodyInfo [Fetch Response Body Info](https://fetch.spec.whatwg.org/#response-body-info)
|
|
316
|
+
* @param responseStatus The response's status code
|
|
317
|
+
* @param deliveryType The delivery type. Default: ''.
|
|
318
|
+
* @since v18.2.0, v16.17.0
|
|
319
|
+
*/
|
|
320
|
+
markResourceTiming(
|
|
321
|
+
timingInfo: object,
|
|
322
|
+
requestedUrl: string,
|
|
323
|
+
initiatorType: string,
|
|
324
|
+
global: object,
|
|
325
|
+
cacheMode: "" | "local",
|
|
326
|
+
bodyInfo: object,
|
|
327
|
+
responseStatus: number,
|
|
328
|
+
deliveryType?: string,
|
|
329
|
+
): PerformanceResourceTiming;
|
|
100
330
|
/**
|
|
101
331
|
* Creates a new PerformanceMeasure entry in the Performance Timeline.
|
|
102
332
|
* A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure',
|
|
@@ -111,89 +341,375 @@ declare module 'perf_hooks' {
|
|
|
111
341
|
* @param name
|
|
112
342
|
* @param startMark
|
|
113
343
|
* @param endMark
|
|
344
|
+
* @return The PerformanceMeasure entry that was created
|
|
114
345
|
*/
|
|
115
|
-
measure(name: string, startMark?: string, endMark?: string):
|
|
116
|
-
|
|
346
|
+
measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure;
|
|
347
|
+
measure(name: string, options: MeasureOptions): PerformanceMeasure;
|
|
117
348
|
/**
|
|
118
|
-
*
|
|
349
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
350
|
+
*
|
|
351
|
+
* An instance of the `PerformanceNodeTiming` class that provides performance metrics for specific Node.js operational milestones.
|
|
352
|
+
* @since v8.5.0
|
|
119
353
|
*/
|
|
120
354
|
readonly nodeTiming: PerformanceNodeTiming;
|
|
121
|
-
|
|
122
355
|
/**
|
|
123
|
-
*
|
|
356
|
+
* Returns the current high resolution millisecond timestamp, where 0 represents the start of the current `node` process.
|
|
357
|
+
* @since v8.5.0
|
|
124
358
|
*/
|
|
125
359
|
now(): number;
|
|
126
|
-
|
|
127
360
|
/**
|
|
128
|
-
*
|
|
361
|
+
* Sets the global performance resource timing buffer size to the specified number of "resource" type performance entry objects.
|
|
362
|
+
*
|
|
363
|
+
* By default the max buffer size is set to 250.
|
|
364
|
+
* @since v18.8.0
|
|
365
|
+
*/
|
|
366
|
+
setResourceTimingBufferSize(maxSize: number): void;
|
|
367
|
+
/**
|
|
368
|
+
* The [`timeOrigin`](https://w3c.github.io/hr-time/#dom-performance-timeorigin) specifies the high resolution millisecond timestamp
|
|
369
|
+
* at which the current `node` process began, measured in Unix time.
|
|
370
|
+
* @since v8.5.0
|
|
129
371
|
*/
|
|
130
372
|
readonly timeOrigin: number;
|
|
131
|
-
|
|
132
373
|
/**
|
|
374
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
375
|
+
*
|
|
133
376
|
* Wraps a function within a new function that measures the running time of the wrapped function.
|
|
134
|
-
* A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed.
|
|
377
|
+
* A `PerformanceObserver` must be subscribed to the `'function'` event type in order for the timing details to be accessed.
|
|
378
|
+
*
|
|
379
|
+
* ```js
|
|
380
|
+
* import {
|
|
381
|
+
* performance,
|
|
382
|
+
* PerformanceObserver,
|
|
383
|
+
* } from 'node:perf_hooks';
|
|
384
|
+
*
|
|
385
|
+
* function someFunction() {
|
|
386
|
+
* console.log('hello world');
|
|
387
|
+
* }
|
|
388
|
+
*
|
|
389
|
+
* const wrapped = performance.timerify(someFunction);
|
|
390
|
+
*
|
|
391
|
+
* const obs = new PerformanceObserver((list) => {
|
|
392
|
+
* console.log(list.getEntries()[0].duration);
|
|
393
|
+
*
|
|
394
|
+
* performance.clearMarks();
|
|
395
|
+
* performance.clearMeasures();
|
|
396
|
+
* obs.disconnect();
|
|
397
|
+
* });
|
|
398
|
+
* obs.observe({ entryTypes: ['function'] });
|
|
399
|
+
*
|
|
400
|
+
* // A performance timeline entry will be created
|
|
401
|
+
* wrapped();
|
|
402
|
+
* ```
|
|
403
|
+
*
|
|
404
|
+
* If the wrapped function returns a promise, a finally handler will be attached to the promise and the duration will be reported
|
|
405
|
+
* once the finally handler is invoked.
|
|
135
406
|
* @param fn
|
|
136
407
|
*/
|
|
137
|
-
timerify<T extends (...
|
|
138
|
-
|
|
408
|
+
timerify<T extends (...params: any[]) => any>(fn: T, options?: TimerifyOptions): T;
|
|
139
409
|
/**
|
|
140
|
-
*
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
* @param util1 The result of a previous call to eventLoopUtilization()
|
|
145
|
-
* @param util2 The result of a previous call to eventLoopUtilization() prior to util1
|
|
410
|
+
* An object which is JSON representation of the performance object. It is similar to
|
|
411
|
+
* [`window.performance.toJSON`](https://developer.mozilla.org/en-US/docs/Web/API/Performance/toJSON) in browsers.
|
|
412
|
+
* @since v16.1.0
|
|
146
413
|
*/
|
|
147
|
-
|
|
414
|
+
toJSON(): any;
|
|
148
415
|
}
|
|
149
|
-
|
|
150
|
-
interface PerformanceObserverEntryList {
|
|
416
|
+
class PerformanceObserverEntryList {
|
|
151
417
|
/**
|
|
152
|
-
*
|
|
418
|
+
* Returns a list of `PerformanceEntry` objects in chronological order
|
|
419
|
+
* with respect to `performanceEntry.startTime`.
|
|
420
|
+
*
|
|
421
|
+
* ```js
|
|
422
|
+
* import {
|
|
423
|
+
* performance,
|
|
424
|
+
* PerformanceObserver,
|
|
425
|
+
* } from 'node:perf_hooks';
|
|
426
|
+
*
|
|
427
|
+
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
428
|
+
* console.log(perfObserverList.getEntries());
|
|
429
|
+
*
|
|
430
|
+
* * [
|
|
431
|
+
* * PerformanceEntry {
|
|
432
|
+
* * name: 'test',
|
|
433
|
+
* * entryType: 'mark',
|
|
434
|
+
* * startTime: 81.465639,
|
|
435
|
+
* * duration: 0,
|
|
436
|
+
* * detail: null
|
|
437
|
+
* * },
|
|
438
|
+
* * PerformanceEntry {
|
|
439
|
+
* * name: 'meow',
|
|
440
|
+
* * entryType: 'mark',
|
|
441
|
+
* * startTime: 81.860064,
|
|
442
|
+
* * duration: 0,
|
|
443
|
+
* * detail: null
|
|
444
|
+
* * }
|
|
445
|
+
* * ]
|
|
446
|
+
*
|
|
447
|
+
* performance.clearMarks();
|
|
448
|
+
* performance.clearMeasures();
|
|
449
|
+
* observer.disconnect();
|
|
450
|
+
* });
|
|
451
|
+
* obs.observe({ type: 'mark' });
|
|
452
|
+
*
|
|
453
|
+
* performance.mark('test');
|
|
454
|
+
* performance.mark('meow');
|
|
455
|
+
* ```
|
|
456
|
+
* @since v8.5.0
|
|
153
457
|
*/
|
|
154
458
|
getEntries(): PerformanceEntry[];
|
|
155
|
-
|
|
156
459
|
/**
|
|
157
|
-
*
|
|
158
|
-
*
|
|
460
|
+
* Returns a list of `PerformanceEntry` objects in chronological order
|
|
461
|
+
* with respect to `performanceEntry.startTime` whose `performanceEntry.name` is
|
|
462
|
+
* equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`.
|
|
463
|
+
*
|
|
464
|
+
* ```js
|
|
465
|
+
* import {
|
|
466
|
+
* performance,
|
|
467
|
+
* PerformanceObserver,
|
|
468
|
+
* } from 'node:perf_hooks';
|
|
469
|
+
*
|
|
470
|
+
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
471
|
+
* console.log(perfObserverList.getEntriesByName('meow'));
|
|
472
|
+
*
|
|
473
|
+
* * [
|
|
474
|
+
* * PerformanceEntry {
|
|
475
|
+
* * name: 'meow',
|
|
476
|
+
* * entryType: 'mark',
|
|
477
|
+
* * startTime: 98.545991,
|
|
478
|
+
* * duration: 0,
|
|
479
|
+
* * detail: null
|
|
480
|
+
* * }
|
|
481
|
+
* * ]
|
|
482
|
+
*
|
|
483
|
+
* console.log(perfObserverList.getEntriesByName('nope')); // []
|
|
484
|
+
*
|
|
485
|
+
* console.log(perfObserverList.getEntriesByName('test', 'mark'));
|
|
486
|
+
*
|
|
487
|
+
* * [
|
|
488
|
+
* * PerformanceEntry {
|
|
489
|
+
* * name: 'test',
|
|
490
|
+
* * entryType: 'mark',
|
|
491
|
+
* * startTime: 63.518931,
|
|
492
|
+
* * duration: 0,
|
|
493
|
+
* * detail: null
|
|
494
|
+
* * }
|
|
495
|
+
* * ]
|
|
496
|
+
*
|
|
497
|
+
* console.log(perfObserverList.getEntriesByName('test', 'measure')); // []
|
|
498
|
+
*
|
|
499
|
+
* performance.clearMarks();
|
|
500
|
+
* performance.clearMeasures();
|
|
501
|
+
* observer.disconnect();
|
|
502
|
+
* });
|
|
503
|
+
* obs.observe({ entryTypes: ['mark', 'measure'] });
|
|
504
|
+
*
|
|
505
|
+
* performance.mark('test');
|
|
506
|
+
* performance.mark('meow');
|
|
507
|
+
* ```
|
|
508
|
+
* @since v8.5.0
|
|
159
509
|
*/
|
|
160
|
-
getEntriesByName(name: string, type?:
|
|
161
|
-
|
|
510
|
+
getEntriesByName(name: string, type?: EntryType): PerformanceEntry[];
|
|
162
511
|
/**
|
|
163
|
-
*
|
|
164
|
-
* whose performanceEntry.entryType is equal to type
|
|
512
|
+
* Returns a list of `PerformanceEntry` objects in chronological order
|
|
513
|
+
* with respect to `performanceEntry.startTime` whose `performanceEntry.entryType` is equal to `type`.
|
|
514
|
+
*
|
|
515
|
+
* ```js
|
|
516
|
+
* import {
|
|
517
|
+
* performance,
|
|
518
|
+
* PerformanceObserver,
|
|
519
|
+
* } from 'node:perf_hooks';
|
|
520
|
+
*
|
|
521
|
+
* const obs = new PerformanceObserver((perfObserverList, observer) => {
|
|
522
|
+
* console.log(perfObserverList.getEntriesByType('mark'));
|
|
523
|
+
*
|
|
524
|
+
* * [
|
|
525
|
+
* * PerformanceEntry {
|
|
526
|
+
* * name: 'test',
|
|
527
|
+
* * entryType: 'mark',
|
|
528
|
+
* * startTime: 55.897834,
|
|
529
|
+
* * duration: 0,
|
|
530
|
+
* * detail: null
|
|
531
|
+
* * },
|
|
532
|
+
* * PerformanceEntry {
|
|
533
|
+
* * name: 'meow',
|
|
534
|
+
* * entryType: 'mark',
|
|
535
|
+
* * startTime: 56.350146,
|
|
536
|
+
* * duration: 0,
|
|
537
|
+
* * detail: null
|
|
538
|
+
* * }
|
|
539
|
+
* * ]
|
|
540
|
+
*
|
|
541
|
+
* performance.clearMarks();
|
|
542
|
+
* performance.clearMeasures();
|
|
543
|
+
* observer.disconnect();
|
|
544
|
+
* });
|
|
545
|
+
* obs.observe({ type: 'mark' });
|
|
546
|
+
*
|
|
547
|
+
* performance.mark('test');
|
|
548
|
+
* performance.mark('meow');
|
|
549
|
+
* ```
|
|
550
|
+
* @since v8.5.0
|
|
165
551
|
*/
|
|
166
|
-
getEntriesByType(type:
|
|
552
|
+
getEntriesByType(type: EntryType): PerformanceEntry[];
|
|
167
553
|
}
|
|
168
|
-
|
|
169
554
|
type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void;
|
|
170
|
-
|
|
555
|
+
/**
|
|
556
|
+
* @since v8.5.0
|
|
557
|
+
*/
|
|
171
558
|
class PerformanceObserver extends AsyncResource {
|
|
172
559
|
constructor(callback: PerformanceObserverCallback);
|
|
173
|
-
|
|
174
560
|
/**
|
|
175
|
-
* Disconnects the PerformanceObserver instance from all notifications.
|
|
561
|
+
* Disconnects the `PerformanceObserver` instance from all notifications.
|
|
562
|
+
* @since v8.5.0
|
|
176
563
|
*/
|
|
177
564
|
disconnect(): void;
|
|
178
|
-
|
|
179
565
|
/**
|
|
180
|
-
* Subscribes the PerformanceObserver instance to notifications of new PerformanceEntry instances identified by options.entryTypes.
|
|
181
|
-
*
|
|
182
|
-
*
|
|
183
|
-
*
|
|
566
|
+
* Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes` or `options.type`:
|
|
567
|
+
*
|
|
568
|
+
* ```js
|
|
569
|
+
* import {
|
|
570
|
+
* performance,
|
|
571
|
+
* PerformanceObserver,
|
|
572
|
+
* } from 'node:perf_hooks';
|
|
573
|
+
*
|
|
574
|
+
* const obs = new PerformanceObserver((list, observer) => {
|
|
575
|
+
* // Called once asynchronously. `list` contains three items.
|
|
576
|
+
* });
|
|
577
|
+
* obs.observe({ type: 'mark' });
|
|
578
|
+
*
|
|
579
|
+
* for (let n = 0; n < 3; n++)
|
|
580
|
+
* performance.mark(`test${n}`);
|
|
581
|
+
* ```
|
|
582
|
+
* @since v8.5.0
|
|
583
|
+
*/
|
|
584
|
+
observe(
|
|
585
|
+
options:
|
|
586
|
+
| {
|
|
587
|
+
entryTypes: readonly EntryType[];
|
|
588
|
+
buffered?: boolean | undefined;
|
|
589
|
+
}
|
|
590
|
+
| {
|
|
591
|
+
type: EntryType;
|
|
592
|
+
buffered?: boolean | undefined;
|
|
593
|
+
},
|
|
594
|
+
): void;
|
|
595
|
+
/**
|
|
596
|
+
* @since v16.0.0
|
|
597
|
+
* @returns Current list of entries stored in the performance observer, emptying it out.
|
|
598
|
+
*/
|
|
599
|
+
takeRecords(): PerformanceEntry[];
|
|
600
|
+
}
|
|
601
|
+
/**
|
|
602
|
+
* Provides detailed network timing data regarding the loading of an application's resources.
|
|
603
|
+
*
|
|
604
|
+
* The constructor of this class is not exposed to users directly.
|
|
605
|
+
* @since v18.2.0, v16.17.0
|
|
606
|
+
*/
|
|
607
|
+
class PerformanceResourceTiming extends PerformanceEntry {
|
|
608
|
+
readonly entryType: "resource";
|
|
609
|
+
protected constructor();
|
|
610
|
+
/**
|
|
611
|
+
* The high resolution millisecond timestamp at immediately before dispatching the `fetch`
|
|
612
|
+
* request. If the resource is not intercepted by a worker the property will always return 0.
|
|
613
|
+
* @since v18.2.0, v16.17.0
|
|
614
|
+
*/
|
|
615
|
+
readonly workerStart: number;
|
|
616
|
+
/**
|
|
617
|
+
* The high resolution millisecond timestamp that represents the start time of the fetch which
|
|
618
|
+
* initiates the redirect.
|
|
619
|
+
* @since v18.2.0, v16.17.0
|
|
620
|
+
*/
|
|
621
|
+
readonly redirectStart: number;
|
|
622
|
+
/**
|
|
623
|
+
* The high resolution millisecond timestamp that will be created immediately after receiving
|
|
624
|
+
* the last byte of the response of the last redirect.
|
|
625
|
+
* @since v18.2.0, v16.17.0
|
|
626
|
+
*/
|
|
627
|
+
readonly redirectEnd: number;
|
|
628
|
+
/**
|
|
629
|
+
* The high resolution millisecond timestamp immediately before the Node.js starts to fetch the resource.
|
|
630
|
+
* @since v18.2.0, v16.17.0
|
|
631
|
+
*/
|
|
632
|
+
readonly fetchStart: number;
|
|
633
|
+
/**
|
|
634
|
+
* The high resolution millisecond timestamp immediately before the Node.js starts the domain name lookup
|
|
635
|
+
* for the resource.
|
|
636
|
+
* @since v18.2.0, v16.17.0
|
|
637
|
+
*/
|
|
638
|
+
readonly domainLookupStart: number;
|
|
639
|
+
/**
|
|
640
|
+
* The high resolution millisecond timestamp representing the time immediately after the Node.js finished
|
|
641
|
+
* the domain name lookup for the resource.
|
|
642
|
+
* @since v18.2.0, v16.17.0
|
|
643
|
+
*/
|
|
644
|
+
readonly domainLookupEnd: number;
|
|
645
|
+
/**
|
|
646
|
+
* The high resolution millisecond timestamp representing the time immediately before Node.js starts to
|
|
647
|
+
* establish the connection to the server to retrieve the resource.
|
|
648
|
+
* @since v18.2.0, v16.17.0
|
|
649
|
+
*/
|
|
650
|
+
readonly connectStart: number;
|
|
651
|
+
/**
|
|
652
|
+
* The high resolution millisecond timestamp representing the time immediately after Node.js finishes
|
|
653
|
+
* establishing the connection to the server to retrieve the resource.
|
|
654
|
+
* @since v18.2.0, v16.17.0
|
|
655
|
+
*/
|
|
656
|
+
readonly connectEnd: number;
|
|
657
|
+
/**
|
|
658
|
+
* The high resolution millisecond timestamp representing the time immediately before Node.js starts the
|
|
659
|
+
* handshake process to secure the current connection.
|
|
660
|
+
* @since v18.2.0, v16.17.0
|
|
184
661
|
*/
|
|
185
|
-
|
|
662
|
+
readonly secureConnectionStart: number;
|
|
663
|
+
/**
|
|
664
|
+
* The high resolution millisecond timestamp representing the time immediately before Node.js receives the
|
|
665
|
+
* first byte of the response from the server.
|
|
666
|
+
* @since v18.2.0, v16.17.0
|
|
667
|
+
*/
|
|
668
|
+
readonly requestStart: number;
|
|
669
|
+
/**
|
|
670
|
+
* The high resolution millisecond timestamp representing the time immediately after Node.js receives the
|
|
671
|
+
* last byte of the resource or immediately before the transport connection is closed, whichever comes first.
|
|
672
|
+
* @since v18.2.0, v16.17.0
|
|
673
|
+
*/
|
|
674
|
+
readonly responseEnd: number;
|
|
675
|
+
/**
|
|
676
|
+
* A number representing the size (in octets) of the fetched resource. The size includes the response header
|
|
677
|
+
* fields plus the response payload body.
|
|
678
|
+
* @since v18.2.0, v16.17.0
|
|
679
|
+
*/
|
|
680
|
+
readonly transferSize: number;
|
|
681
|
+
/**
|
|
682
|
+
* A number representing the size (in octets) received from the fetch (HTTP or cache), of the payload body, before
|
|
683
|
+
* removing any applied content-codings.
|
|
684
|
+
* @since v18.2.0, v16.17.0
|
|
685
|
+
*/
|
|
686
|
+
readonly encodedBodySize: number;
|
|
687
|
+
/**
|
|
688
|
+
* A number representing the size (in octets) received from the fetch (HTTP or cache), of the message body, after
|
|
689
|
+
* removing any applied content-codings.
|
|
690
|
+
* @since v18.2.0, v16.17.0
|
|
691
|
+
*/
|
|
692
|
+
readonly decodedBodySize: number;
|
|
693
|
+
/**
|
|
694
|
+
* Returns a `object` that is the JSON representation of the `PerformanceResourceTiming` object
|
|
695
|
+
* @since v18.2.0, v16.17.0
|
|
696
|
+
*/
|
|
697
|
+
toJSON(): any;
|
|
186
698
|
}
|
|
187
|
-
|
|
188
699
|
namespace constants {
|
|
189
700
|
const NODE_PERFORMANCE_GC_MAJOR: number;
|
|
190
701
|
const NODE_PERFORMANCE_GC_MINOR: number;
|
|
191
702
|
const NODE_PERFORMANCE_GC_INCREMENTAL: number;
|
|
192
703
|
const NODE_PERFORMANCE_GC_WEAKCB: number;
|
|
704
|
+
const NODE_PERFORMANCE_GC_FLAGS_NO: number;
|
|
705
|
+
const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number;
|
|
706
|
+
const NODE_PERFORMANCE_GC_FLAGS_FORCED: number;
|
|
707
|
+
const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number;
|
|
708
|
+
const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number;
|
|
709
|
+
const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number;
|
|
710
|
+
const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number;
|
|
193
711
|
}
|
|
194
|
-
|
|
195
712
|
const performance: Performance;
|
|
196
|
-
|
|
197
713
|
interface EventLoopMonitorOptions {
|
|
198
714
|
/**
|
|
199
715
|
* The sampling rate in milliseconds.
|
|
@@ -202,58 +718,251 @@ declare module 'perf_hooks' {
|
|
|
202
718
|
*/
|
|
203
719
|
resolution?: number | undefined;
|
|
204
720
|
}
|
|
205
|
-
|
|
206
|
-
interface EventLoopDelayMonitor {
|
|
721
|
+
interface Histogram {
|
|
207
722
|
/**
|
|
208
|
-
*
|
|
723
|
+
* The number of samples recorded by the histogram.
|
|
724
|
+
* @since v17.4.0, v16.14.0
|
|
209
725
|
*/
|
|
210
|
-
|
|
726
|
+
readonly count: number;
|
|
211
727
|
/**
|
|
212
|
-
*
|
|
728
|
+
* The number of samples recorded by the histogram.
|
|
729
|
+
* v17.4.0, v16.14.0
|
|
213
730
|
*/
|
|
214
|
-
|
|
215
|
-
|
|
731
|
+
readonly countBigInt: bigint;
|
|
216
732
|
/**
|
|
217
|
-
*
|
|
733
|
+
* The number of times the event loop delay exceeded the maximum 1 hour event
|
|
734
|
+
* loop delay threshold.
|
|
735
|
+
* @since v11.10.0
|
|
218
736
|
*/
|
|
219
|
-
|
|
220
|
-
|
|
737
|
+
readonly exceeds: number;
|
|
221
738
|
/**
|
|
222
|
-
*
|
|
223
|
-
* @
|
|
739
|
+
* The number of times the event loop delay exceeded the maximum 1 hour event loop delay threshold.
|
|
740
|
+
* @since v17.4.0, v16.14.0
|
|
224
741
|
*/
|
|
225
|
-
|
|
226
|
-
|
|
742
|
+
readonly exceedsBigInt: bigint;
|
|
227
743
|
/**
|
|
228
|
-
*
|
|
744
|
+
* The maximum recorded event loop delay.
|
|
745
|
+
* @since v11.10.0
|
|
229
746
|
*/
|
|
230
|
-
readonly
|
|
231
|
-
|
|
747
|
+
readonly max: number;
|
|
232
748
|
/**
|
|
233
|
-
* The
|
|
749
|
+
* The maximum recorded event loop delay.
|
|
750
|
+
* v17.4.0, v16.14.0
|
|
234
751
|
*/
|
|
235
|
-
readonly
|
|
236
|
-
|
|
752
|
+
readonly maxBigInt: number;
|
|
753
|
+
/**
|
|
754
|
+
* The mean of the recorded event loop delays.
|
|
755
|
+
* @since v11.10.0
|
|
756
|
+
*/
|
|
757
|
+
readonly mean: number;
|
|
237
758
|
/**
|
|
238
759
|
* The minimum recorded event loop delay.
|
|
760
|
+
* @since v11.10.0
|
|
239
761
|
*/
|
|
240
762
|
readonly min: number;
|
|
241
|
-
|
|
242
763
|
/**
|
|
243
|
-
* The
|
|
764
|
+
* The minimum recorded event loop delay.
|
|
765
|
+
* v17.4.0, v16.14.0
|
|
244
766
|
*/
|
|
245
|
-
readonly
|
|
246
|
-
|
|
767
|
+
readonly minBigInt: bigint;
|
|
247
768
|
/**
|
|
248
|
-
*
|
|
769
|
+
* Returns the value at the given percentile.
|
|
770
|
+
* @since v11.10.0
|
|
771
|
+
* @param percentile A percentile value in the range (0, 100].
|
|
249
772
|
*/
|
|
250
|
-
|
|
251
|
-
|
|
773
|
+
percentile(percentile: number): number;
|
|
774
|
+
/**
|
|
775
|
+
* Returns the value at the given percentile.
|
|
776
|
+
* @since v17.4.0, v16.14.0
|
|
777
|
+
* @param percentile A percentile value in the range (0, 100].
|
|
778
|
+
*/
|
|
779
|
+
percentileBigInt(percentile: number): bigint;
|
|
780
|
+
/**
|
|
781
|
+
* Returns a `Map` object detailing the accumulated percentile distribution.
|
|
782
|
+
* @since v11.10.0
|
|
783
|
+
*/
|
|
784
|
+
readonly percentiles: Map<number, number>;
|
|
785
|
+
/**
|
|
786
|
+
* Returns a `Map` object detailing the accumulated percentile distribution.
|
|
787
|
+
* @since v17.4.0, v16.14.0
|
|
788
|
+
*/
|
|
789
|
+
readonly percentilesBigInt: Map<bigint, bigint>;
|
|
790
|
+
/**
|
|
791
|
+
* Resets the collected histogram data.
|
|
792
|
+
* @since v11.10.0
|
|
793
|
+
*/
|
|
794
|
+
reset(): void;
|
|
252
795
|
/**
|
|
253
796
|
* The standard deviation of the recorded event loop delays.
|
|
797
|
+
* @since v11.10.0
|
|
254
798
|
*/
|
|
255
799
|
readonly stddev: number;
|
|
256
800
|
}
|
|
257
|
-
|
|
258
|
-
|
|
801
|
+
interface IntervalHistogram extends Histogram {
|
|
802
|
+
/**
|
|
803
|
+
* Enables the update interval timer. Returns `true` if the timer was
|
|
804
|
+
* started, `false` if it was already started.
|
|
805
|
+
* @since v11.10.0
|
|
806
|
+
*/
|
|
807
|
+
enable(): boolean;
|
|
808
|
+
/**
|
|
809
|
+
* Disables the update interval timer. Returns `true` if the timer was
|
|
810
|
+
* stopped, `false` if it was already stopped.
|
|
811
|
+
* @since v11.10.0
|
|
812
|
+
*/
|
|
813
|
+
disable(): boolean;
|
|
814
|
+
}
|
|
815
|
+
interface RecordableHistogram extends Histogram {
|
|
816
|
+
/**
|
|
817
|
+
* @since v15.9.0, v14.18.0
|
|
818
|
+
* @param val The amount to record in the histogram.
|
|
819
|
+
*/
|
|
820
|
+
record(val: number | bigint): void;
|
|
821
|
+
/**
|
|
822
|
+
* Calculates the amount of time (in nanoseconds) that has passed since the
|
|
823
|
+
* previous call to `recordDelta()` and records that amount in the histogram.
|
|
824
|
+
* @since v15.9.0, v14.18.0
|
|
825
|
+
*/
|
|
826
|
+
recordDelta(): void;
|
|
827
|
+
/**
|
|
828
|
+
* Adds the values from `other` to this histogram.
|
|
829
|
+
* @since v17.4.0, v16.14.0
|
|
830
|
+
*/
|
|
831
|
+
add(other: RecordableHistogram): void;
|
|
832
|
+
}
|
|
833
|
+
/**
|
|
834
|
+
* _This property is an extension by Node.js. It is not available in Web browsers._
|
|
835
|
+
*
|
|
836
|
+
* Creates an `IntervalHistogram` object that samples and reports the event loop
|
|
837
|
+
* delay over time. The delays will be reported in nanoseconds.
|
|
838
|
+
*
|
|
839
|
+
* Using a timer to detect approximate event loop delay works because the
|
|
840
|
+
* execution of timers is tied specifically to the lifecycle of the libuv
|
|
841
|
+
* event loop. That is, a delay in the loop will cause a delay in the execution
|
|
842
|
+
* of the timer, and those delays are specifically what this API is intended to
|
|
843
|
+
* detect.
|
|
844
|
+
*
|
|
845
|
+
* ```js
|
|
846
|
+
* import { monitorEventLoopDelay } from 'node:perf_hooks';
|
|
847
|
+
* const h = monitorEventLoopDelay({ resolution: 20 });
|
|
848
|
+
* h.enable();
|
|
849
|
+
* // Do something.
|
|
850
|
+
* h.disable();
|
|
851
|
+
* console.log(h.min);
|
|
852
|
+
* console.log(h.max);
|
|
853
|
+
* console.log(h.mean);
|
|
854
|
+
* console.log(h.stddev);
|
|
855
|
+
* console.log(h.percentiles);
|
|
856
|
+
* console.log(h.percentile(50));
|
|
857
|
+
* console.log(h.percentile(99));
|
|
858
|
+
* ```
|
|
859
|
+
* @since v11.10.0
|
|
860
|
+
*/
|
|
861
|
+
function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram;
|
|
862
|
+
interface CreateHistogramOptions {
|
|
863
|
+
/**
|
|
864
|
+
* The minimum recordable value. Must be an integer value greater than 0.
|
|
865
|
+
* @default 1
|
|
866
|
+
*/
|
|
867
|
+
lowest?: number | bigint | undefined;
|
|
868
|
+
/**
|
|
869
|
+
* The maximum recordable value. Must be an integer value greater than min.
|
|
870
|
+
* @default Number.MAX_SAFE_INTEGER
|
|
871
|
+
*/
|
|
872
|
+
highest?: number | bigint | undefined;
|
|
873
|
+
/**
|
|
874
|
+
* The number of accuracy digits. Must be a number between 1 and 5.
|
|
875
|
+
* @default 3
|
|
876
|
+
*/
|
|
877
|
+
figures?: number | undefined;
|
|
878
|
+
}
|
|
879
|
+
/**
|
|
880
|
+
* Returns a `RecordableHistogram`.
|
|
881
|
+
* @since v15.9.0, v14.18.0
|
|
882
|
+
*/
|
|
883
|
+
function createHistogram(options?: CreateHistogramOptions): RecordableHistogram;
|
|
884
|
+
import {
|
|
885
|
+
performance as _performance,
|
|
886
|
+
PerformanceEntry as _PerformanceEntry,
|
|
887
|
+
PerformanceMark as _PerformanceMark,
|
|
888
|
+
PerformanceMeasure as _PerformanceMeasure,
|
|
889
|
+
PerformanceObserver as _PerformanceObserver,
|
|
890
|
+
PerformanceObserverEntryList as _PerformanceObserverEntryList,
|
|
891
|
+
PerformanceResourceTiming as _PerformanceResourceTiming,
|
|
892
|
+
} from "perf_hooks";
|
|
893
|
+
global {
|
|
894
|
+
/**
|
|
895
|
+
* `PerformanceEntry` is a global reference for `import { PerformanceEntry } from 'node:perf_hooks'`
|
|
896
|
+
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceentry
|
|
897
|
+
* @since v19.0.0
|
|
898
|
+
*/
|
|
899
|
+
var PerformanceEntry: typeof globalThis extends {
|
|
900
|
+
onmessage: any;
|
|
901
|
+
PerformanceEntry: infer T;
|
|
902
|
+
} ? T
|
|
903
|
+
: typeof _PerformanceEntry;
|
|
904
|
+
/**
|
|
905
|
+
* `PerformanceMark` is a global reference for `import { PerformanceMark } from 'node:perf_hooks'`
|
|
906
|
+
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemark
|
|
907
|
+
* @since v19.0.0
|
|
908
|
+
*/
|
|
909
|
+
var PerformanceMark: typeof globalThis extends {
|
|
910
|
+
onmessage: any;
|
|
911
|
+
PerformanceMark: infer T;
|
|
912
|
+
} ? T
|
|
913
|
+
: typeof _PerformanceMark;
|
|
914
|
+
/**
|
|
915
|
+
* `PerformanceMeasure` is a global reference for `import { PerformanceMeasure } from 'node:perf_hooks'`
|
|
916
|
+
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performancemeasure
|
|
917
|
+
* @since v19.0.0
|
|
918
|
+
*/
|
|
919
|
+
var PerformanceMeasure: typeof globalThis extends {
|
|
920
|
+
onmessage: any;
|
|
921
|
+
PerformanceMeasure: infer T;
|
|
922
|
+
} ? T
|
|
923
|
+
: typeof _PerformanceMeasure;
|
|
924
|
+
/**
|
|
925
|
+
* `PerformanceObserver` is a global reference for `import { PerformanceObserver } from 'node:perf_hooks'`
|
|
926
|
+
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserver
|
|
927
|
+
* @since v19.0.0
|
|
928
|
+
*/
|
|
929
|
+
var PerformanceObserver: typeof globalThis extends {
|
|
930
|
+
onmessage: any;
|
|
931
|
+
PerformanceObserver: infer T;
|
|
932
|
+
} ? T
|
|
933
|
+
: typeof _PerformanceObserver;
|
|
934
|
+
/**
|
|
935
|
+
* `PerformanceObserverEntryList` is a global reference for `import { PerformanceObserverEntryList } from 'node:perf_hooks'`
|
|
936
|
+
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceobserverentrylist
|
|
937
|
+
* @since v19.0.0
|
|
938
|
+
*/
|
|
939
|
+
var PerformanceObserverEntryList: typeof globalThis extends {
|
|
940
|
+
onmessage: any;
|
|
941
|
+
PerformanceObserverEntryList: infer T;
|
|
942
|
+
} ? T
|
|
943
|
+
: typeof _PerformanceObserverEntryList;
|
|
944
|
+
/**
|
|
945
|
+
* `PerformanceResourceTiming` is a global reference for `import { PerformanceResourceTiming } from 'node:perf_hooks'`
|
|
946
|
+
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performanceresourcetiming
|
|
947
|
+
* @since v19.0.0
|
|
948
|
+
*/
|
|
949
|
+
var PerformanceResourceTiming: typeof globalThis extends {
|
|
950
|
+
onmessage: any;
|
|
951
|
+
PerformanceResourceTiming: infer T;
|
|
952
|
+
} ? T
|
|
953
|
+
: typeof _PerformanceResourceTiming;
|
|
954
|
+
/**
|
|
955
|
+
* `performance` is a global reference for `import { performance } from 'node:perf_hooks'`
|
|
956
|
+
* @see https://nodejs.org/docs/latest-v22.x/api/globals.html#performance
|
|
957
|
+
* @since v16.0.0
|
|
958
|
+
*/
|
|
959
|
+
var performance: typeof globalThis extends {
|
|
960
|
+
onmessage: any;
|
|
961
|
+
performance: infer T;
|
|
962
|
+
} ? T
|
|
963
|
+
: typeof _performance;
|
|
964
|
+
}
|
|
965
|
+
}
|
|
966
|
+
declare module "node:perf_hooks" {
|
|
967
|
+
export * from "perf_hooks";
|
|
259
968
|
}
|