From db9edf68c1e88cf2ce0cdf11e401695635cf3c15 Mon Sep 17 00:00:00 2001 From: Tomer Aberbach Date: Sat, 30 Nov 2024 15:44:12 -0500 Subject: [PATCH] feat(website): swap to `node-inspect-extracted` (#55) --- pnpm-lock.yaml | 12 +++++++++--- website/docs/concepts/concurrent-iterable.mdx | 2 +- website/docs/recipes.mdx | 7 ++++++- website/package.json | 2 +- website/src/pages/playground/_helpers/console.tsx | 8 ++++++-- 5 files changed, 23 insertions(+), 8 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 643869f..53fea2c 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -89,9 +89,9 @@ importers: monaco-editor: specifier: ^0.52.0 version: 0.52.0 - object-inspect: - specifier: ^1.13.3 - version: 1.13.3 + node-inspect-extracted: + specifier: ^3.0.2 + version: 3.0.2 p-filter: specifier: ^4.1.0 version: 4.1.0 @@ -5061,6 +5061,10 @@ packages: resolution: {integrity: sha512-dPEtOeMvF9VMcYV/1Wb8CPoVAXtp6MKMlcbAt4ddqmGqUJ6fQZFXkNZNkNlfevtNkGtaSoXf/vNNNSvgrdXwtA==} engines: {node: '>= 6.13.0'} + node-inspect-extracted@3.0.2: + resolution: {integrity: sha512-lOBe4RMfICoYRKZaCXLVoBt6t8wM93QLEIp2WuvPJ5yDTEzrp+LhquGp4RV283Vd5RJ+vUvBmRrGtRu2HCgWHw==} + engines: {node: '>=18'} + node-releases@2.0.18: resolution: {integrity: sha512-d9VeXT4SJ7ZeOqGX6R5EM022wpL+eWPooLI+5UpWn2jCT1aosUQEhQP214x33Wkwx3JQMvIm+tIoVOdodFS40g==} @@ -13842,6 +13846,8 @@ snapshots: node-forge@1.3.1: {} + node-inspect-extracted@3.0.2: {} + node-releases@2.0.18: {} normalize-package-data@2.5.0: diff --git a/website/docs/concepts/concurrent-iterable.mdx b/website/docs/concepts/concurrent-iterable.mdx index ab1a331..482a3a4 100644 --- a/website/docs/concepts/concurrent-iterable.mdx +++ b/website/docs/concepts/concurrent-iterable.mdx @@ -169,7 +169,7 @@ const withLfi = await pipe( ) console.timeEnd(`with lfi`) // NOTE: This duration may vary slightly between runs -//=> with lfi: 6011 ms +//=> with lfi: 6000 ms // Takes 10 seconds! The first item is a bottleneck because `p-map` waits for all callbacks console.time(`without lfi`) diff --git a/website/docs/recipes.mdx b/website/docs/recipes.mdx index 5bdbaeb..6a2c7fb 100644 --- a/website/docs/recipes.mdx +++ b/website/docs/recipes.mdx @@ -247,7 +247,12 @@ console.log( //=> 1 //=> 0 // NOTE: This order may change between runs -//=> [ 'kind strawberry', 'humble max', 'great bitsy', 'beautiful tommy' ] +//=> [ +//=> 'kind strawberry', +//=> 'humble max', +//=> 'great bitsy', +//=> 'beautiful tommy' +//=> ] ``` ## How do I reduce an iterable to more than one result in one pass? diff --git a/website/package.json b/website/package.json index 26ea38a..b17041d 100644 --- a/website/package.json +++ b/website/package.json @@ -47,7 +47,7 @@ "lfi": "link:..", "limit-concur": "^3.0.0", "monaco-editor": "^0.52.0", - "object-inspect": "^1.13.3", + "node-inspect-extracted": "^3.0.2", "p-filter": "^4.1.0", "p-map": "^7.0.2", "prettier": "^3.4.1", diff --git a/website/src/pages/playground/_helpers/console.tsx b/website/src/pages/playground/_helpers/console.tsx index 42463da..651ec14 100644 --- a/website/src/pages/playground/_helpers/console.tsx +++ b/website/src/pages/playground/_helpers/console.tsx @@ -1,6 +1,6 @@ import { join, map, pipe } from 'lfi' import type { ReactElement } from 'react' -import inspect from 'object-inspect' +import { inspect } from 'node-inspect-extracted' import type { Log } from './use-sandbox.ts' const Console = ({ logs }: { logs: Log[] }) => { @@ -144,7 +144,11 @@ const extractLabel = (args: unknown[]): string => { const formatArgs = (args: unknown[]): string => pipe( args, - map(arg => (typeof arg === `string` ? arg : inspect(arg, { indent: 2 }))), + map(arg => + typeof arg === `string` + ? arg + : inspect(arg, { breakLength: 50, depth: 5 }), + ), join(` `), )