@celljs/serve-static 4.6.1 → 4.8.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/README.zh-cn.md +13 -0
- package/package.json +4 -4
package/README.zh-cn.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Cell - 静态文件服务组件
|
|
2
|
+
|
|
3
|
+
从后端提供前端构建。`fullstack` 模板依赖它;没有前端的项目不需要它。
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @celljs/serve-static
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
它提供 `serveStatic.root`(默认 `${paths.public}`,构建输出的 `public/` 目录),使用 Cell 自己的文件发送程序:Content-Type、弱 ETag、Last-Modified、Cache-Control、对新鲜请求的 `304`、对失败的 `If-Match` / `If-Unmodified-Since` 的 `412`、单字节范围(`206` / `416`)、忽略 dotfiles,拒绝离开 root 的路径。使用 `spa: true`(默认)时未知路径获得 `/index.html`,所以客户端路由在重新加载时工作。没有前端目录时,请求通过。
|
|
10
|
+
|
|
11
|
+
`serveStatic.options`:`maxAge`(毫秒,默认一年)、`immutable`(默认 `true`)、`htmlMaxAge`(HTML 文件和 Web 应用清单的 Cache-Control,`.webmanifest`,默认 0)、`headers`(添加到每个文件)、`index`(默认 `index.html`,`false` 表示无)、`extensions`(路径无后缀时尝试)、`dotfiles`(`ignore` 默认、`allow`、`deny`)、`redirect`(从目录重定向到其带 `/` 的路径,`301`)、`acceptRanges`、`cacheControl`、`etag`、`lastModified`(默认 `true`)、`fallthrough`(默认 `true`)。
|
|
12
|
+
|
|
13
|
+
使用 `cell build --single`,文件被嵌入到服务端包中,从内存中以相同的 header 提供。
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@celljs/serve-static",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.8.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cell-component"
|
|
@@ -33,9 +33,9 @@
|
|
|
33
33
|
"watch": "tsc -b -w --preserveWatchOutput"
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@celljs/core": "4.
|
|
37
|
-
"@celljs/http": "4.
|
|
38
|
-
"@celljs/web": "4.
|
|
36
|
+
"@celljs/core": "4.8.0",
|
|
37
|
+
"@celljs/http": "4.8.0",
|
|
38
|
+
"@celljs/web": "4.8.0"
|
|
39
39
|
},
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|