@modern-js/types 2.43.0 → 2.45.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/common/babel.d.ts CHANGED
@@ -1,3 +1,8 @@
1
+ import type {
2
+ TransformOptions as BabelTransformOptions,
3
+ PluginItem as BabelPlugin,
4
+ } from '@babel/core';
5
+
1
6
  export type {
2
7
  TransformOptions as BabelTransformOptions,
3
8
  PluginItem as BabelPlugin,
package/package.json CHANGED
@@ -15,7 +15,7 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.43.0",
18
+ "version": "2.45.0",
19
19
  "types": "./index.d.ts",
20
20
  "exports": {
21
21
  ".": {
@@ -45,8 +45,8 @@
45
45
  "http-proxy-middleware": "^2.0.4",
46
46
  "jest": "^29",
47
47
  "type-fest": "2.15.0",
48
- "@scripts/build": "2.43.0",
49
- "@scripts/jest-config": "2.43.0"
48
+ "@scripts/build": "2.45.0",
49
+ "@scripts/jest-config": "2.45.0"
50
50
  },
51
51
  "sideEffects": false,
52
52
  "publishConfig": {
package/server/hook.d.ts CHANGED
@@ -68,6 +68,16 @@ export type AfterRenderContext = HookContext & {
68
68
  };
69
69
  };
70
70
 
71
+ export type AfterStreamingRenderContext = HookContext & {
72
+ route?: Partial<
73
+ Pick<
74
+ ServerRoute,
75
+ 'entryName' | 'bundle' | 'isSPA' | 'isSSR' | 'urlPath' | 'entryPath'
76
+ >
77
+ >;
78
+ chunk: string;
79
+ };
80
+
71
81
  export type MiddlewareContext<T extends 'worker' | 'node' = 'node'> =
72
82
  HookContext & {
73
83
  reporter?: Reporter;
package/server/utils.d.ts CHANGED
@@ -4,23 +4,28 @@ import type {
4
4
  Filter as ProxyFilter,
5
5
  } from 'http-proxy-middleware';
6
6
 
7
- export type Metrics = {
8
- emitCounter: (name: string, value: number, tags: Record<string, any>) => void;
9
- emitTimer: (name: string, value: number, tags: Record<string, any>) => void;
10
- gauges: () => void;
11
- };
7
+ export interface Metrics {
8
+ emitCounter: (
9
+ name: string,
10
+ value: number,
11
+ prefix?: string,
12
+ tags?: Record<string, any>,
13
+ ) => void;
14
+ emitTimer: (
15
+ name: string,
16
+ value: number,
17
+ prefix?: string,
18
+ tags?: Record<string, any>,
19
+ ) => void;
20
+ }
12
21
 
13
- type LoggerFunction = (
14
- message?: number | string | Error,
15
- ...args: any[]
16
- ) => void;
17
- export type Logger = {
22
+ type LoggerFunction = (message: string, ...args: any[]) => void;
23
+ export interface Logger {
18
24
  error: LoggerFunction;
19
25
  info: LoggerFunction;
20
26
  warn: LoggerFunction;
21
27
  debug: LoggerFunction;
22
- log: LoggerFunction;
23
- };
28
+ }
24
29
 
25
30
  export interface ServerTiming {
26
31
  addServeTiming: (name: string, dur: number, decs?: string) => this;
@@ -108,13 +113,13 @@ export type CacheOption =
108
113
 
109
114
  export interface Container<K = string, V = string> {
110
115
  /**
111
- * Returns a specified element from the containter. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Containter.
116
+ * Returns a specified element from the container. If the value that is associated to the provided key is an object, then you will get a reference to that object and any change made to that object will effectively modify it inside the Container.
112
117
  * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
113
118
  */
114
119
  get: (key: K) => Promise<V | undefined>;
115
120
 
116
121
  /**
117
- * Adds a new element with a specified key and value to the containter. If an element with the same key already exists, the element will be updated.
122
+ * Adds a new element with a specified key and value to the container. If an element with the same key already exists, the element will be updated.
118
123
  */
119
124
  set: (key: K, value: V, options?: { ttl?: number }) => Promise<this>;
120
125
 
@@ -124,9 +129,9 @@ export interface Container<K = string, V = string> {
124
129
  has: (key: K) => Promise<boolean>;
125
130
 
126
131
  /**
127
- * @returns true if an element in the containter existed and has been removed, or false if the element does not exist.
132
+ * @returns true if an element in the container existed and has been removed, or false if the element does not exist.
128
133
  */
129
134
  delete: (key: K) => Promise<boolean>;
130
135
 
131
- forEach?: (callbackFn: (v: V, k: K, containter: this) => void) => void;
136
+ forEach?: (callbackFn: (v: V, k: K, container: this) => void) => void;
132
137
  }