@modern-js/main-doc 2.43.0 → 2.44.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.
@@ -120,18 +120,18 @@ Simultaneously, you can also include regular expression syntax in it, such as `/
120
120
 
121
121
  By default, Server will use memory for caching. But typically, services will be deployed on serverless. Each service access may be a new process, so caching cannot be applied every time.
122
122
 
123
- Therefore, developers can also customise the cache container, which needs to implement the `Containter` interface.
123
+ Therefore, developers can also customise the cache container, which needs to implement the `Container` interface.
124
124
 
125
125
  ```ts
126
- export interface Containter<K = string, V = string> {
126
+ export interface Container<K = string, V = string> {
127
127
  /**
128
- * 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.
128
+ * 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.
129
129
  * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
130
130
  */
131
131
  get: (key: K) => Promise<V | undefined>;
132
132
 
133
133
  /**
134
- * 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.
134
+ * 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.
135
135
  *
136
136
  * The ttl indicates cache expiration time.
137
137
  */
@@ -143,7 +143,7 @@ export interface Containter<K = string, V = string> {
143
143
  has: (key: K) => Promise<boolean>;
144
144
 
145
145
  /**
146
- * @returns true if an element in the containter existed and has been removed, or false if the element does not exist.
146
+ * @returns true if an element in the container existed and has been removed, or false if the element does not exist.
147
147
  */
148
148
  delete: (key: K) => Promise<boolean>;
149
149
  }
@@ -152,9 +152,9 @@ export interface Containter<K = string, V = string> {
152
152
  As an example in the following code, a developer can implement a Redis container.
153
153
 
154
154
  ```ts
155
- import type { Containter, CacheOption } from '@modern-js/runtime/server';
155
+ import type { Container, CacheOption } from '@modern-js/runtime/server';
156
156
 
157
- class RedisContainter implements Containter {
157
+ class RedisContainer implements Container {
158
158
  redis = new Redis();
159
159
 
160
160
  async get(key: string) {
@@ -175,9 +175,9 @@ class RedisContainter implements Containter {
175
175
  }
176
176
  }
177
177
 
178
- const containter = new RedisContainter();
178
+ const container = new RedisContainer();
179
179
 
180
- export const customContainer: Containter = containter;
180
+ export const customContainer: Container = container;
181
181
 
182
182
  export const cacheOption: CacheOption = {
183
183
  maxAge: 500, // ms
@@ -123,18 +123,18 @@ export const cacheOption: CacheOption = {
123
123
 
124
124
  默认情况下,Server 将会使用内存进行缓存。但通常情况下服务将会部署在 serverless 上。每一次的服务访问可能都是一个新的进程,这样每次访问都不能应用缓存
125
125
 
126
- 故开发者也可以自定义缓存容器,容器需实现接口 `Containter`
126
+ 故开发者也可以自定义缓存容器,容器需实现接口 `Container`
127
127
 
128
128
  ```ts
129
- export interface Containter<K = string, V = string> {
129
+ export interface Container<K = string, V = string> {
130
130
  /**
131
- * 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.
131
+ * 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.
132
132
  * @returns Returns the element associated with the specified key. If no element is associated with the specified key, undefined is returned.
133
133
  */
134
134
  get: (key: K) => Promise<V | undefined>;
135
135
 
136
136
  /**
137
- * 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.
137
+ * 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.
138
138
  *
139
139
  * The ttl indicates cache expiration time.
140
140
  */
@@ -146,7 +146,7 @@ export interface Containter<K = string, V = string> {
146
146
  has: (key: K) => Promise<boolean>;
147
147
 
148
148
  /**
149
- * @returns true if an element in the containter existed and has been removed, or false if the element does not exist.
149
+ * @returns true if an element in the container existed and has been removed, or false if the element does not exist.
150
150
  */
151
151
  delete: (key: K) => Promise<boolean>;
152
152
  }
@@ -155,9 +155,9 @@ export interface Containter<K = string, V = string> {
155
155
  以下面代码为例,开发者可实现一个 redis 容器。
156
156
 
157
157
  ```ts
158
- import type { Containter, CacheOption } from '@modern-js/runtime/server';
158
+ import type { Container, CacheOption } from '@modern-js/runtime/server';
159
159
 
160
- class RedisContainter implements Containter {
160
+ class RedisContainer implements Container {
161
161
  redis = new Redis();
162
162
 
163
163
  async get(key: string) {
@@ -178,9 +178,9 @@ class RedisContainter implements Containter {
178
178
  }
179
179
  }
180
180
 
181
- const containter = new RedisContainter();
181
+ const container = new RedisContainer();
182
182
 
183
- export const customContainer: Containter = containter;
183
+ export const customContainer: Container = container;
184
184
 
185
185
  export const cacheOption: CacheOption = {
186
186
  maxAge: 500, // ms
package/package.json CHANGED
@@ -15,17 +15,17 @@
15
15
  "modern",
16
16
  "modern.js"
17
17
  ],
18
- "version": "2.43.0",
18
+ "version": "2.44.0",
19
19
  "publishConfig": {
20
20
  "registry": "https://registry.npmjs.org/",
21
21
  "access": "public",
22
22
  "provenance": true
23
23
  },
24
24
  "dependencies": {
25
- "@modern-js/sandpack-react": "2.43.0"
25
+ "@modern-js/sandpack-react": "2.44.0"
26
26
  },
27
27
  "peerDependencies": {
28
- "@modern-js/builder-doc": "^2.43.0"
28
+ "@modern-js/builder-doc": "^2.44.0"
29
29
  },
30
30
  "devDependencies": {
31
31
  "classnames": "^2",
@@ -35,12 +35,12 @@
35
35
  "ts-node": "^10.9.1",
36
36
  "typescript": "^5",
37
37
  "fs-extra": "^10",
38
- "rspress": "1.8.3",
39
- "@rspress/shared": "1.8.3",
38
+ "rspress": "1.8.4",
39
+ "@rspress/shared": "1.8.4",
40
40
  "@types/node": "^16",
41
41
  "@types/fs-extra": "9.0.13",
42
- "@modern-js/builder-doc": "2.43.0",
43
- "@modern-js/doc-plugin-auto-sidebar": "2.43.0"
42
+ "@modern-js/doc-plugin-auto-sidebar": "2.44.0",
43
+ "@modern-js/builder-doc": "2.44.0"
44
44
  },
45
45
  "scripts": {
46
46
  "dev": "rspress dev",