@visulima/packem-rollup 1.0.0-alpha.19 → 1.0.0-alpha.20

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/CHANGELOG.md CHANGED
@@ -1,3 +1,22 @@
1
+ ## @visulima/packem-rollup [1.0.0-alpha.20](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.19...@visulima/packem-rollup@1.0.0-alpha.20) (2025-10-08)
2
+
3
+ ### Bug Fixes
4
+
5
+ * enhance package-json-exports and preserve-directives tests ([c3b58f2](https://github.com/visulima/packem/commit/c3b58f251ea9ed3d8747a967b6f53fd4c1773509))
6
+
7
+ ### Documentation
8
+
9
+ * clarify minification requirement for minify-html-literals plugin ([287b231](https://github.com/visulima/packem/commit/287b231d04ea8268470a07eadb32350c986d2892))
10
+
11
+ ### Miscellaneous Chores
12
+
13
+ * update dependencies and add minify-html-literals plugin ([e20007d](https://github.com/visulima/packem/commit/e20007ddf3cbb80c34c323ed37164baaf6f9a649))
14
+
15
+
16
+ ### Dependencies
17
+
18
+ * **@visulima/packem-share:** upgraded to 1.0.0-alpha.13
19
+
1
20
  ## @visulima/packem-rollup [1.0.0-alpha.19](https://github.com/visulima/packem/compare/@visulima/packem-rollup@1.0.0-alpha.18...@visulima/packem-rollup@1.0.0-alpha.19) (2025-10-07)
2
21
 
3
22
  ### Bug Fixes
package/dist/index.d.mts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Plugin, RenderedChunk, GetManualChunk, CustomPluginOptions } from 'rollup';
2
- import { P as PailServerType } from './packem_shared/types-h27kdghe.mjs';
3
- export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, e as DebarrelPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, t as IsolatedDeclarationsResult, v as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, N as NativeModulesOptions, w as PackemRollupOptions, R as RawLoaderOptions, O as RequireCJSPluginOptions, T as RequireCJSPluginTransformFunction, x as RollupPlugins, S as ShebangOptions, p as SourcemapsPluginOptions, y as TransformerFn, z as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, d as dataUriPlugin, f as debarrelPlugin, g as esmShimCjsSyntaxPlugin, k as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, n as nativeModulesPlugin, r as rawPlugin, o as removeShebangPlugin, h as requireCJSTransformerPlugin, s as shebangPlugin, q as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-h27kdghe.mjs';
2
+ export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, e as DebarrelPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, t as IsolatedDeclarationsResult, v as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, N as NativeModulesOptions, P as PackemRollupOptions, R as RawLoaderOptions, O as RequireCJSPluginOptions, T as RequireCJSPluginTransformFunction, w as RollupPlugins, S as ShebangOptions, p as SourcemapsPluginOptions, x as TransformerFn, y as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, d as dataUriPlugin, f as debarrelPlugin, g as esmShimCjsSyntaxPlugin, k as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, n as nativeModulesPlugin, r as rawPlugin, o as removeShebangPlugin, h as requireCJSTransformerPlugin, s as shebangPlugin, q as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-BK7k04DQ.mjs';
4
3
  export { b as browserslistToEsbuild } from './packem_shared/browserslist-to-esbuild-DY9HwYtp.mjs';
5
4
  import { RollupJsonOptions } from '@rollup/plugin-json';
5
+ export { MinifyHTMLLiteralsOptions, default as minifyHTMLLiteralsPlugin } from './plugins/minify-html-literals/index.mjs';
6
6
  import { FileCache } from '@visulima/packem-share/utils';
7
7
  import { FilterPattern } from '@rollup/pluginutils';
8
+ import { P as PailServerType } from './packem_shared/index.server.d-DhMawQMd.mjs';
8
9
  import { BuildContextBuildAssetAndChunk, BuildContextBuildEntry } from '@visulima/packem-share/types';
9
10
  export { Alias, ResolverObject as AliasResolverObject, ResolvedAlias, RollupAliasOptions, default as alias } from '@rollup/plugin-alias';
10
11
  export { RollupCommonJSOptions, default as commonjs } from '@rollup/plugin-commonjs';
@@ -14,7 +15,7 @@ export { RollupNodeResolveOptions, default as nodeResolve } from '@rollup/plugin
14
15
  export { RollupReplaceOptions, default as replace } from '@rollup/plugin-replace';
15
16
  export { RollupWasmOptions, default as wasm } from '@rollup/plugin-wasm';
16
17
  export { NodePolyfillsOptions as RollupNodePolyfillsOptions, default as polyfillNode } from 'rollup-plugin-polyfill-node';
17
- export { PureAnnotationsOptions as RollupPureAnnotationsOptions, PluginPure as pure } from 'rollup-plugin-pure';
18
+ export { PluginPure, PureAnnotationsOptions as RollupPureAnnotationsOptions } from 'rollup-plugin-pure';
18
19
  export { PluginVisualizerOptions as RollupPluginVisualizerOptions, default as visualizer } from 'rollup-plugin-visualizer';
19
20
  import 'rollup-plugin-dts';
20
21
  import 'esbuild';
@@ -22,6 +23,8 @@ import '@visulima/package';
22
23
  import 'oxc-resolver';
23
24
  import 'oxc-transform';
24
25
  import 'sucrase';
26
+ import 'magic-string';
27
+ import 'html-minifier-next';
25
28
 
26
29
  declare const chunkSplitter: () => Plugin;
27
30
 
package/dist/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import { Plugin, RenderedChunk, GetManualChunk, CustomPluginOptions } from 'rollup';
2
- import { P as PailServerType } from './packem_shared/types-h27kdghe.js';
3
- export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, e as DebarrelPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, t as IsolatedDeclarationsResult, v as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, N as NativeModulesOptions, w as PackemRollupOptions, R as RawLoaderOptions, O as RequireCJSPluginOptions, T as RequireCJSPluginTransformFunction, x as RollupPlugins, S as ShebangOptions, p as SourcemapsPluginOptions, y as TransformerFn, z as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, d as dataUriPlugin, f as debarrelPlugin, g as esmShimCjsSyntaxPlugin, k as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, n as nativeModulesPlugin, r as rawPlugin, o as removeShebangPlugin, h as requireCJSTransformerPlugin, s as shebangPlugin, q as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-h27kdghe.js';
2
+ export { C as CJSInteropOptions, a as CopyPluginOptions, D as DataUriPluginOptions, e as DebarrelPluginOptions, E as EsmShimCjsSyntaxOptions, I as IsolatedDeclarationsOptions, t as IsolatedDeclarationsResult, v as IsolatedDeclarationsTransformer, J as JSXRemoveAttributesPlugin, L as LicenseOptions, N as NativeModulesOptions, P as PackemRollupOptions, R as RawLoaderOptions, O as RequireCJSPluginOptions, T as RequireCJSPluginTransformFunction, w as RollupPlugins, S as ShebangOptions, p as SourcemapsPluginOptions, x as TransformerFn, y as TransformerName, U as UrlOptions, c as cjsInteropPlugin, b as copyPlugin, d as dataUriPlugin, f as debarrelPlugin, g as esmShimCjsSyntaxPlugin, k as getShebang, i as isolatedDeclarationsPlugin, j as jsxRemoveAttributes, l as licensePlugin, m as makeExecutable, n as nativeModulesPlugin, r as rawPlugin, o as removeShebangPlugin, h as requireCJSTransformerPlugin, s as shebangPlugin, q as sourcemapsPlugin, u as urlPlugin } from './packem_shared/types-DvaEike_.js';
4
3
  export { b as browserslistToEsbuild } from './packem_shared/browserslist-to-esbuild-DY9HwYtp.js';
5
4
  import { RollupJsonOptions } from '@rollup/plugin-json';
5
+ export { MinifyHTMLLiteralsOptions, default as minifyHTMLLiteralsPlugin } from './plugins/minify-html-literals/index.js';
6
6
  import { FileCache } from '@visulima/packem-share/utils';
7
7
  import { FilterPattern } from '@rollup/pluginutils';
8
+ import { P as PailServerType } from './packem_shared/index.server.d-DhMawQMd.js';
8
9
  import { BuildContextBuildAssetAndChunk, BuildContextBuildEntry } from '@visulima/packem-share/types';
9
10
  export { Alias, ResolverObject as AliasResolverObject, ResolvedAlias, RollupAliasOptions, default as alias } from '@rollup/plugin-alias';
10
11
  export { RollupCommonJSOptions, default as commonjs } from '@rollup/plugin-commonjs';
@@ -14,7 +15,7 @@ export { RollupNodeResolveOptions, default as nodeResolve } from '@rollup/plugin
14
15
  export { RollupReplaceOptions, default as replace } from '@rollup/plugin-replace';
15
16
  export { RollupWasmOptions, default as wasm } from '@rollup/plugin-wasm';
16
17
  export { NodePolyfillsOptions as RollupNodePolyfillsOptions, default as polyfillNode } from 'rollup-plugin-polyfill-node';
17
- export { PureAnnotationsOptions as RollupPureAnnotationsOptions, PluginPure as pure } from 'rollup-plugin-pure';
18
+ export { PluginPure, PureAnnotationsOptions as RollupPureAnnotationsOptions } from 'rollup-plugin-pure';
18
19
  export { PluginVisualizerOptions as RollupPluginVisualizerOptions, default as visualizer } from 'rollup-plugin-visualizer';
19
20
  import 'rollup-plugin-dts';
20
21
  import 'esbuild';
@@ -22,6 +23,8 @@ import '@visulima/package';
22
23
  import 'oxc-resolver';
23
24
  import 'oxc-transform';
24
25
  import 'sucrase';
26
+ import 'magic-string';
27
+ import 'html-minifier-next';
25
28
 
26
29
  declare const chunkSplitter: () => Plugin;
27
30
 
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{default as o}from"./packem_shared/chunkSplitter-DWAy1JkE.mjs";import{cjsInteropPlugin as a}from"./packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs";import{copyPlugin as f}from"./packem_shared/copyPlugin--6RITp1-.mjs";import{dataUriPlugin as s}from"./packem_shared/dataUriPlugin-BFb7bZZs.mjs";import{debarrelPlugin as i}from"./packem_shared/debarrelPlugin-BTYc859G.mjs";import{default as x}from"./packem_shared/browserslistToEsbuild-C0IWmbNe.mjs";import{esmShimCjsSyntaxPlugin as d}from"./packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs";import{fixDtsDefaultCjsExportsPlugin as P}from"./packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs";import{default as b}from"./packem_shared/fixDynamicImportExtension-BBGNRniz.mjs";import{isolatedDeclarationsPlugin as h}from"./packem_shared/isolatedDeclarationsPlugin-B34s_qkE.mjs";import{default as y}from"./packem_shared/jsonPlugin-BAi3Da-h.mjs";import{jsxRemoveAttributes as C}from"./packem_shared/jsxRemoveAttributes-B1PLPffj.mjs";import{license as E}from"./packem_shared/licensePlugin-C5yzUqe-.mjs";import{default as w}from"./packem_shared/metafilePlugin-CVcqFpPJ.mjs";import{nativeModulesPlugin as M}from"./packem_shared/nativeModulesPlugin-D6lO-8g6.mjs";import{default as R}from"./packem_shared/cachingPlugin-TWoY5ZxV.mjs";import{default as U}from"./packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs";import{rawPlugin as z}from"./packem_shared/rawPlugin-DgRj14Xy.mjs";import{requireCJSTransformerPlugin as F}from"./packem_shared/requireCJSTransformerPlugin-BZ49I4kw.mjs";import{default as N}from"./packem_shared/resolveFileUrlPlugin-BkpjVHeK.mjs";import{getShebang as B,makeExecutable as G,removeShebangPlugin as H,shebangPlugin as K}from"./packem_shared/makeExecutable-6aOVHoJR.mjs";import{sourcemapsPlugin as Q}from"./packem_shared/sourcemapsPlugin-B4W3J79w.mjs";import{urlPlugin as X}from"./packem_shared/urlPlugin-DJJrDWjj.mjs";import{default as Z}from"./packem_shared/createSplitChunks-CGDk55G3.mjs";import{default as $}from"./packem_shared/getCustomModuleLayer-d8i66lfh.mjs";import{default as re}from"./packem_shared/getModuleLayer-rF9RxnJ5.mjs";import{default as te}from"@rollup/plugin-alias";import{default as le}from"@rollup/plugin-commonjs";import{default as ue}from"@rollup/plugin-dynamic-import-vars";import{default as me}from"@rollup/plugin-inject";import{default as pe}from"@rollup/plugin-node-resolve";import{default as ne}from"@rollup/plugin-replace";import{default as ge}from"@rollup/plugin-wasm";import{default as ce}from"rollup-plugin-polyfill-node";import{PluginPure as ve}from"rollup-plugin-pure";import{default as je}from"rollup-plugin-visualizer";export{te as alias,x as browserslistToEsbuild,R as cachingPlugin,o as chunkSplitter,a as cjsInteropPlugin,le as commonjs,f as copyPlugin,Z as createSplitChunks,s as dataUriPlugin,i as debarrelPlugin,ue as dynamicImportVars,d as esmShimCjsSyntaxPlugin,P as fixDtsDefaultCjsExportsPlugin,b as fixDynamicImportExtension,$ as getCustomModuleLayer,re as getModuleLayer,B as getShebang,me as inject,h as isolatedDeclarationsPlugin,y as jsonPlugin,C as jsxRemoveAttributes,E as licensePlugin,G as makeExecutable,w as metafilePlugin,M as nativeModulesPlugin,pe as nodeResolve,ce as polyfillNode,U as preserveDirectivesPlugin,ve as pure,z as rawPlugin,H as removeShebangPlugin,ne as replace,F as requireCJSTransformerPlugin,N as resolveFileUrlPlugin,K as shebangPlugin,Q as sourcemapsPlugin,X as urlPlugin,je as visualizer,ge as wasm};
1
+ import{default as o}from"./packem_shared/chunkSplitter-DWAy1JkE.mjs";import{cjsInteropPlugin as a}from"./packem_shared/cjsInteropPlugin-D5wyoQ_B.mjs";import{copyPlugin as f}from"./packem_shared/copyPlugin--6RITp1-.mjs";import{dataUriPlugin as s}from"./packem_shared/dataUriPlugin-BFb7bZZs.mjs";import{debarrelPlugin as i}from"./packem_shared/debarrelPlugin-BTYc859G.mjs";import{default as n}from"./packem_shared/browserslistToEsbuild-C0IWmbNe.mjs";import{esmShimCjsSyntaxPlugin as d}from"./packem_shared/esmShimCjsSyntaxPlugin-DjKqX4DE.mjs";import{fixDtsDefaultCjsExportsPlugin as P}from"./packem_shared/fixDtsDefaultCjsExportsPlugin-Dp1UcHVR.mjs";import{default as b}from"./packem_shared/fixDynamicImportExtension-BBGNRniz.mjs";import{isolatedDeclarationsPlugin as y}from"./packem_shared/isolatedDeclarationsPlugin-B34s_qkE.mjs";import{default as j}from"./packem_shared/jsonPlugin-BAi3Da-h.mjs";import{jsxRemoveAttributes as C}from"./packem_shared/jsxRemoveAttributes-B1PLPffj.mjs";import{license as E}from"./packem_shared/licensePlugin-C5yzUqe-.mjs";import{default as M}from"./packem_shared/metafilePlugin-CVcqFpPJ.mjs";import{minifyHTMLLiteralsPlugin as w}from"./plugins/minify-html-literals/index.mjs";import{nativeModulesPlugin as T}from"./packem_shared/nativeModulesPlugin-D6lO-8g6.mjs";import{default as U}from"./packem_shared/cachingPlugin-TWoY5ZxV.mjs";import{default as z}from"./packem_shared/preserveDirectivesPlugin-B49Cbykd.mjs";import{rawPlugin as F}from"./packem_shared/rawPlugin-DgRj14Xy.mjs";import{requireCJSTransformerPlugin as J}from"./packem_shared/requireCJSTransformerPlugin-BZ49I4kw.mjs";import{default as V}from"./packem_shared/resolveFileUrlPlugin-BkpjVHeK.mjs";import{getShebang as G,makeExecutable as K,removeShebangPlugin as O,shebangPlugin as Q}from"./packem_shared/makeExecutable-6aOVHoJR.mjs";import{sourcemapsPlugin as X}from"./packem_shared/sourcemapsPlugin-B4W3J79w.mjs";import{urlPlugin as Z}from"./packem_shared/urlPlugin-DJJrDWjj.mjs";import{default as $}from"./packem_shared/createSplitChunks-CGDk55G3.mjs";import{default as re}from"./packem_shared/getCustomModuleLayer-d8i66lfh.mjs";import{default as te}from"./packem_shared/getModuleLayer-rF9RxnJ5.mjs";import{default as le}from"@rollup/plugin-alias";import{default as ue}from"@rollup/plugin-commonjs";import{default as me}from"@rollup/plugin-dynamic-import-vars";import{default as pe}from"@rollup/plugin-inject";import{default as xe}from"@rollup/plugin-node-resolve";import{default as ge}from"@rollup/plugin-replace";import{default as ce}from"@rollup/plugin-wasm";import{default as ve}from"rollup-plugin-polyfill-node";import{PluginPure as he}from"rollup-plugin-pure";import{default as Se}from"rollup-plugin-visualizer";export{he as PluginPure,le as alias,n as browserslistToEsbuild,U as cachingPlugin,o as chunkSplitter,a as cjsInteropPlugin,ue as commonjs,f as copyPlugin,$ as createSplitChunks,s as dataUriPlugin,i as debarrelPlugin,me as dynamicImportVars,d as esmShimCjsSyntaxPlugin,P as fixDtsDefaultCjsExportsPlugin,b as fixDynamicImportExtension,re as getCustomModuleLayer,te as getModuleLayer,G as getShebang,pe as inject,y as isolatedDeclarationsPlugin,j as jsonPlugin,C as jsxRemoveAttributes,E as licensePlugin,K as makeExecutable,M as metafilePlugin,w as minifyHTMLLiteralsPlugin,T as nativeModulesPlugin,xe as nodeResolve,ve as polyfillNode,z as preserveDirectivesPlugin,F as rawPlugin,O as removeShebangPlugin,ge as replace,J as requireCJSTransformerPlugin,V as resolveFileUrlPlugin,Q as shebangPlugin,X as sourcemapsPlugin,Z as urlPlugin,Se as visualizer,ce as wasm};
@@ -0,0 +1,251 @@
1
+ type AnsiColors = "bgBlack" | "bgBlackBright" | "bgBlue" | "bgBlueBright" | "bgCyan" | "bgCyanBright" | "bgGray" | "bgGreen" | "bgGreenBright" | "bgGrey" | "bgMagenta" | "bgMagentaBright" | "bgRed" | "bgRedBright" | "bgWhite" | "bgWhiteBright" | "bgYellow" | "bgYellowBright" | "black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright";
2
+
3
+ /**
4
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
5
+
6
+ @category Type
7
+ */
8
+ type Primitive =
9
+ | null
10
+ | undefined
11
+ | string
12
+ | number
13
+ | boolean
14
+ | symbol
15
+ | bigint;
16
+
17
+ declare global {
18
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
19
+ interface SymbolConstructor {
20
+ readonly observable: symbol;
21
+ }
22
+ }
23
+
24
+ /**
25
+ Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
26
+
27
+ Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
28
+
29
+ This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
30
+
31
+ @example
32
+ ```
33
+ import type {LiteralUnion} from 'type-fest';
34
+
35
+ // Before
36
+
37
+ type Pet = 'dog' | 'cat' | string;
38
+
39
+ const pet: Pet = '';
40
+ // Start typing in your TypeScript-enabled IDE.
41
+ // You **will not** get auto-completion for `dog` and `cat` literals.
42
+
43
+ // After
44
+
45
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
46
+
47
+ const pet: Pet2 = '';
48
+ // You **will** get auto-completion for `dog` and `cat` literals.
49
+ ```
50
+
51
+ @category Type
52
+ */
53
+ type LiteralUnion<
54
+ LiteralType,
55
+ BaseType extends Primitive,
56
+ > = LiteralType | (BaseType & Record<never, never>);
57
+
58
+ declare class InteractiveStreamHook {
59
+ #private;
60
+ static readonly DRAIN = true;
61
+ constructor(stream: NodeJS.WriteStream);
62
+ active(): void;
63
+ erase(count: number): void;
64
+ inactive(separateHistory?: boolean): void;
65
+ renew(): void;
66
+ write(message: string): void;
67
+ }
68
+
69
+ type StreamType = "stderr" | "stdout";
70
+ declare class InteractiveManager {
71
+ #private;
72
+ constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
73
+ get lastLength(): number;
74
+ get outside(): number;
75
+ get isHooked(): boolean;
76
+ get isSuspended(): boolean;
77
+ erase(stream: StreamType, count?: number): void;
78
+ hook(): boolean;
79
+ resume(stream: StreamType, eraseRowCount?: number): void;
80
+ suspend(stream: StreamType, erase?: boolean): void;
81
+ unhook(separateHistory?: boolean): boolean;
82
+ update(stream: StreamType, rows: string[], from?: number): void;
83
+ private _clear;
84
+ }
85
+
86
+ declare global {
87
+ namespace VisulimaPail {
88
+ interface CustomMeta<L> {
89
+ }
90
+ }
91
+ }
92
+ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
93
+ badge: string | undefined;
94
+ context: any[] | undefined;
95
+ date: Date | string;
96
+ error: Error | undefined;
97
+ groups: string[];
98
+ label: string | undefined;
99
+ message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
100
+ prefix: string | undefined;
101
+ repeated?: number | undefined;
102
+ scope: string[] | undefined;
103
+ suffix: string | undefined;
104
+ traceError: Error | undefined;
105
+ type: {
106
+ level: ExtendedRfc5424LogLevels | L;
107
+ name: string;
108
+ };
109
+ }
110
+ type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
111
+ type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
112
+ interface LoggerFunction {
113
+ (message: Message): void;
114
+ (...message: any[]): void;
115
+ }
116
+ interface LoggerConfiguration<L extends string> {
117
+ badge?: string;
118
+ color?: AnsiColors | undefined;
119
+ label: string;
120
+ logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
121
+ }
122
+ type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
123
+ type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
124
+ interface Reporter<L extends string> {
125
+ log: (meta: ReadonlyMeta<L>) => void;
126
+ }
127
+ interface Processor<L extends string> {
128
+ process: (meta: Meta<L>) => Meta<L>;
129
+ }
130
+ interface ConstructorOptions<T extends string, L extends string> {
131
+ disabled?: boolean;
132
+ logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
133
+ logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
134
+ messages?: {
135
+ timerEnd?: string;
136
+ timerStart?: string;
137
+ };
138
+ processors?: Processor<L>[];
139
+ rawReporter?: Reporter<L>;
140
+ reporters?: Reporter<L>[];
141
+ scope?: string[] | string;
142
+ throttle?: number;
143
+ throttleMin?: number;
144
+ types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
145
+ }
146
+ interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
147
+ interactive?: boolean;
148
+ stderr: NodeJS.WriteStream;
149
+ stdout: NodeJS.WriteStream;
150
+ }
151
+ type Message = {
152
+ context?: any[] | undefined;
153
+ message: any;
154
+ prefix?: string;
155
+ suffix?: string;
156
+ };
157
+
158
+ type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
159
+
160
+ interface StringifyOptions {
161
+ bigint?: boolean,
162
+ circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
163
+ deterministic?: boolean | ((a: string, b: string) => number),
164
+ maximumBreadth?: number,
165
+ maximumDepth?: number,
166
+ strict?: boolean,
167
+ }
168
+
169
+ declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
170
+ declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
171
+ declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
172
+
173
+ declare namespace stringify {
174
+ export function configure(options: StringifyOptions): typeof stringify
175
+ }
176
+
177
+ declare class PailBrowserImpl<T extends string = string, L extends string = string> {
178
+ protected timersMap: Map<string, number>;
179
+ protected countMap: Map<string, number>;
180
+ protected seqTimers: Set<string>;
181
+ protected readonly lastLog: {
182
+ count?: number;
183
+ object?: Meta<L>;
184
+ serialized?: string;
185
+ time?: Date;
186
+ timeout?: ReturnType<typeof setTimeout>;
187
+ };
188
+ protected readonly logLevels: Record<string, number>;
189
+ protected disabled: boolean;
190
+ protected scopeName: string[];
191
+ protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
192
+ protected readonly longestLabel: string;
193
+ protected readonly processors: Set<Processor<L>>;
194
+ protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
195
+ protected reporters: Set<Reporter<L>>;
196
+ protected readonly throttle: number;
197
+ protected readonly throttleMin: number;
198
+ protected readonly stringify: typeof stringify;
199
+ protected groups: string[];
200
+ protected readonly startTimerMessage: string;
201
+ protected readonly endTimerMessage: string;
202
+ protected rawReporter: Reporter<L>;
203
+ constructor(options: ConstructorOptions<T, L>);
204
+ wrapConsole(): void;
205
+ restoreConsole(): void;
206
+ wrapException(): void;
207
+ disable(): void;
208
+ enable(): void;
209
+ isEnabled(): boolean;
210
+ scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
211
+ unscope(): void;
212
+ time(label?: string): void;
213
+ timeLog(label?: string, ...data: unknown[]): void;
214
+ timeEnd(label?: string): void;
215
+ group(label?: string): void;
216
+ groupEnd(): void;
217
+ count(label?: string): void;
218
+ countReset(label?: string): void;
219
+ clear(): void;
220
+ raw(message: string, ...arguments_: unknown[]): void;
221
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
222
+ protected registerReporters(reporters: Reporter<L>[]): void;
223
+ private _report;
224
+ private registerProcessors;
225
+ private _normalizeLogLevel;
226
+ private _buildMeta;
227
+ private _logger;
228
+ }
229
+ type PailBrowserType<T extends string = string, L extends string = string> = PailBrowserImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ConstructorOptions<TC, LC>) => PailBrowserType<TC, LC>);
230
+
231
+ declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
232
+ readonly options: ServerConstructorOptions<T, L>;
233
+ protected readonly stdout: NodeJS.WriteStream;
234
+ protected readonly stderr: NodeJS.WriteStream;
235
+ protected interactiveManager: InteractiveManager | undefined;
236
+ protected readonly interactive: boolean;
237
+ constructor(options: ServerConstructorOptions<T, L>);
238
+ scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
239
+ getInteractiveManager(): InteractiveManager | undefined;
240
+ wrapStd(): void;
241
+ restoreStd(): void;
242
+ wrapAll(): void;
243
+ restoreAll(): void;
244
+ clear(): void;
245
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
246
+ private _wrapStream;
247
+ private _restoreStream;
248
+ }
249
+ type PailServerType<T extends string = string, L extends string = string> = PailServerImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ServerConstructorOptions<TC, LC>) => PailServerType<TC, LC>);
250
+
251
+ export type { PailServerType as P };
@@ -0,0 +1,251 @@
1
+ type AnsiColors = "bgBlack" | "bgBlackBright" | "bgBlue" | "bgBlueBright" | "bgCyan" | "bgCyanBright" | "bgGray" | "bgGreen" | "bgGreenBright" | "bgGrey" | "bgMagenta" | "bgMagentaBright" | "bgRed" | "bgRedBright" | "bgWhite" | "bgWhiteBright" | "bgYellow" | "bgYellowBright" | "black" | "blackBright" | "blue" | "blueBright" | "cyan" | "cyanBright" | "gray" | "green" | "greenBright" | "grey" | "magenta" | "magentaBright" | "red" | "redBright" | "white" | "whiteBright" | "yellow" | "yellowBright";
2
+
3
+ /**
4
+ Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
5
+
6
+ @category Type
7
+ */
8
+ type Primitive =
9
+ | null
10
+ | undefined
11
+ | string
12
+ | number
13
+ | boolean
14
+ | symbol
15
+ | bigint;
16
+
17
+ declare global {
18
+ // eslint-disable-next-line @typescript-eslint/consistent-type-definitions -- It has to be an `interface` so that it can be merged.
19
+ interface SymbolConstructor {
20
+ readonly observable: symbol;
21
+ }
22
+ }
23
+
24
+ /**
25
+ Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
26
+
27
+ Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
28
+
29
+ This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
30
+
31
+ @example
32
+ ```
33
+ import type {LiteralUnion} from 'type-fest';
34
+
35
+ // Before
36
+
37
+ type Pet = 'dog' | 'cat' | string;
38
+
39
+ const pet: Pet = '';
40
+ // Start typing in your TypeScript-enabled IDE.
41
+ // You **will not** get auto-completion for `dog` and `cat` literals.
42
+
43
+ // After
44
+
45
+ type Pet2 = LiteralUnion<'dog' | 'cat', string>;
46
+
47
+ const pet: Pet2 = '';
48
+ // You **will** get auto-completion for `dog` and `cat` literals.
49
+ ```
50
+
51
+ @category Type
52
+ */
53
+ type LiteralUnion<
54
+ LiteralType,
55
+ BaseType extends Primitive,
56
+ > = LiteralType | (BaseType & Record<never, never>);
57
+
58
+ declare class InteractiveStreamHook {
59
+ #private;
60
+ static readonly DRAIN = true;
61
+ constructor(stream: NodeJS.WriteStream);
62
+ active(): void;
63
+ erase(count: number): void;
64
+ inactive(separateHistory?: boolean): void;
65
+ renew(): void;
66
+ write(message: string): void;
67
+ }
68
+
69
+ type StreamType = "stderr" | "stdout";
70
+ declare class InteractiveManager {
71
+ #private;
72
+ constructor(stdout: InteractiveStreamHook, stderr: InteractiveStreamHook);
73
+ get lastLength(): number;
74
+ get outside(): number;
75
+ get isHooked(): boolean;
76
+ get isSuspended(): boolean;
77
+ erase(stream: StreamType, count?: number): void;
78
+ hook(): boolean;
79
+ resume(stream: StreamType, eraseRowCount?: number): void;
80
+ suspend(stream: StreamType, erase?: boolean): void;
81
+ unhook(separateHistory?: boolean): boolean;
82
+ update(stream: StreamType, rows: string[], from?: number): void;
83
+ private _clear;
84
+ }
85
+
86
+ declare global {
87
+ namespace VisulimaPail {
88
+ interface CustomMeta<L> {
89
+ }
90
+ }
91
+ }
92
+ interface Meta<L> extends VisulimaPail.CustomMeta<L> {
93
+ badge: string | undefined;
94
+ context: any[] | undefined;
95
+ date: Date | string;
96
+ error: Error | undefined;
97
+ groups: string[];
98
+ label: string | undefined;
99
+ message: Primitive | ReadonlyArray<unknown> | Record<PropertyKey, unknown>;
100
+ prefix: string | undefined;
101
+ repeated?: number | undefined;
102
+ scope: string[] | undefined;
103
+ suffix: string | undefined;
104
+ traceError: Error | undefined;
105
+ type: {
106
+ level: ExtendedRfc5424LogLevels | L;
107
+ name: string;
108
+ };
109
+ }
110
+ type ExtendedRfc5424LogLevels = "alert" | "critical" | "debug" | "emergency" | "error" | "informational" | "notice" | "trace" | "warning";
111
+ type DefaultLogTypes = "alert" | "await" | "complete" | "critical" | "debug" | "emergency" | "error" | "info" | "log" | "notice" | "pending" | "start" | "stop" | "success" | "trace" | "wait" | "warn" | "watch";
112
+ interface LoggerFunction {
113
+ (message: Message): void;
114
+ (...message: any[]): void;
115
+ }
116
+ interface LoggerConfiguration<L extends string> {
117
+ badge?: string;
118
+ color?: AnsiColors | undefined;
119
+ label: string;
120
+ logLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
121
+ }
122
+ type LoggerTypesConfig<T extends string, L extends string> = Record<T, Partial<LoggerConfiguration<L>>>;
123
+ type ReadonlyMeta<L extends string> = Readonly<Meta<L>>;
124
+ interface Reporter<L extends string> {
125
+ log: (meta: ReadonlyMeta<L>) => void;
126
+ }
127
+ interface Processor<L extends string> {
128
+ process: (meta: Meta<L>) => Meta<L>;
129
+ }
130
+ interface ConstructorOptions<T extends string, L extends string> {
131
+ disabled?: boolean;
132
+ logLevel?: LiteralUnion<ExtendedRfc5424LogLevels, L>;
133
+ logLevels?: Partial<Record<ExtendedRfc5424LogLevels, number>> & Record<L, number>;
134
+ messages?: {
135
+ timerEnd?: string;
136
+ timerStart?: string;
137
+ };
138
+ processors?: Processor<L>[];
139
+ rawReporter?: Reporter<L>;
140
+ reporters?: Reporter<L>[];
141
+ scope?: string[] | string;
142
+ throttle?: number;
143
+ throttleMin?: number;
144
+ types?: LoggerTypesConfig<T, L> & Partial<LoggerTypesConfig<DefaultLogTypes, L>>;
145
+ }
146
+ interface ServerConstructorOptions<T extends string, L extends string> extends ConstructorOptions<T, L> {
147
+ interactive?: boolean;
148
+ stderr: NodeJS.WriteStream;
149
+ stdout: NodeJS.WriteStream;
150
+ }
151
+ type Message = {
152
+ context?: any[] | undefined;
153
+ message: any;
154
+ prefix?: string;
155
+ suffix?: string;
156
+ };
157
+
158
+ type Replacer = (number | string)[] | null | undefined | ((key: string, value: unknown) => string | number | boolean | null | object)
159
+
160
+ interface StringifyOptions {
161
+ bigint?: boolean,
162
+ circularValue?: string | null | TypeErrorConstructor | ErrorConstructor,
163
+ deterministic?: boolean | ((a: string, b: string) => number),
164
+ maximumBreadth?: number,
165
+ maximumDepth?: number,
166
+ strict?: boolean,
167
+ }
168
+
169
+ declare function stringify(value: undefined | symbol | ((...args: unknown[]) => unknown), replacer?: Replacer, space?: string | number): undefined
170
+ declare function stringify(value: string | number | unknown[] | null | boolean | object, replacer?: Replacer, space?: string | number): string
171
+ declare function stringify(value: unknown, replacer?: ((key: string, value: unknown) => unknown) | (number | string)[] | null | undefined, space?: string | number): string | undefined
172
+
173
+ declare namespace stringify {
174
+ export function configure(options: StringifyOptions): typeof stringify
175
+ }
176
+
177
+ declare class PailBrowserImpl<T extends string = string, L extends string = string> {
178
+ protected timersMap: Map<string, number>;
179
+ protected countMap: Map<string, number>;
180
+ protected seqTimers: Set<string>;
181
+ protected readonly lastLog: {
182
+ count?: number;
183
+ object?: Meta<L>;
184
+ serialized?: string;
185
+ time?: Date;
186
+ timeout?: ReturnType<typeof setTimeout>;
187
+ };
188
+ protected readonly logLevels: Record<string, number>;
189
+ protected disabled: boolean;
190
+ protected scopeName: string[];
191
+ protected readonly types: LoggerTypesConfig<LiteralUnion<DefaultLogTypes, T>, L>;
192
+ protected readonly longestLabel: string;
193
+ protected readonly processors: Set<Processor<L>>;
194
+ protected readonly generalLogLevel: LiteralUnion<ExtendedRfc5424LogLevels, L>;
195
+ protected reporters: Set<Reporter<L>>;
196
+ protected readonly throttle: number;
197
+ protected readonly throttleMin: number;
198
+ protected readonly stringify: typeof stringify;
199
+ protected groups: string[];
200
+ protected readonly startTimerMessage: string;
201
+ protected readonly endTimerMessage: string;
202
+ protected rawReporter: Reporter<L>;
203
+ constructor(options: ConstructorOptions<T, L>);
204
+ wrapConsole(): void;
205
+ restoreConsole(): void;
206
+ wrapException(): void;
207
+ disable(): void;
208
+ enable(): void;
209
+ isEnabled(): boolean;
210
+ scope<N extends string = T>(...name: string[]): PailBrowserType<N, L>;
211
+ unscope(): void;
212
+ time(label?: string): void;
213
+ timeLog(label?: string, ...data: unknown[]): void;
214
+ timeEnd(label?: string): void;
215
+ group(label?: string): void;
216
+ groupEnd(): void;
217
+ count(label?: string): void;
218
+ countReset(label?: string): void;
219
+ clear(): void;
220
+ raw(message: string, ...arguments_: unknown[]): void;
221
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
222
+ protected registerReporters(reporters: Reporter<L>[]): void;
223
+ private _report;
224
+ private registerProcessors;
225
+ private _normalizeLogLevel;
226
+ private _buildMeta;
227
+ private _logger;
228
+ }
229
+ type PailBrowserType<T extends string = string, L extends string = string> = PailBrowserImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ConstructorOptions<TC, LC>) => PailBrowserType<TC, LC>);
230
+
231
+ declare class PailServerImpl<T extends string = string, L extends string = string> extends PailBrowserImpl<T, L> {
232
+ readonly options: ServerConstructorOptions<T, L>;
233
+ protected readonly stdout: NodeJS.WriteStream;
234
+ protected readonly stderr: NodeJS.WriteStream;
235
+ protected interactiveManager: InteractiveManager | undefined;
236
+ protected readonly interactive: boolean;
237
+ constructor(options: ServerConstructorOptions<T, L>);
238
+ scope<N extends string = T>(...name: string[]): PailServerType<N, L>;
239
+ getInteractiveManager(): InteractiveManager | undefined;
240
+ wrapStd(): void;
241
+ restoreStd(): void;
242
+ wrapAll(): void;
243
+ restoreAll(): void;
244
+ clear(): void;
245
+ protected extendReporter(reporter: Reporter<L>): Reporter<L>;
246
+ private _wrapStream;
247
+ private _restoreStream;
248
+ }
249
+ type PailServerType<T extends string = string, L extends string = string> = PailServerImpl<T, L> & Record<DefaultLogTypes, LoggerFunction> & Record<T, LoggerFunction> & (new <TC extends string = string, LC extends string = string>(options?: ServerConstructorOptions<TC, LC>) => PailServerType<TC, LC>);
250
+
251
+ export type { PailServerType as P };