Skip to content

Commit

Permalink
fix(client): fix output files
Browse files Browse the repository at this point in the history
  • Loading branch information
Mister-Hope committed Dec 19, 2023
1 parent 08b831f commit 04917d1
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 40 deletions.
18 changes: 10 additions & 8 deletions docs/src/en/reference/client/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ icon: file

## CDN File List

- `dist/waline.umd.js`: full version, UMD format
- `dist/waline.js`: full version, ESM format

This file is the recommend version to import `@waline/client`, 53 KB Gzip size

This file is the default file for CDN import `@waline/client`, 53 KB Gzip size
- `dist/waline.umd.js`: full version, UMD format

- `dist/shim.js`: full version without dependency bundles, ES Module format
- `dist/slim.js`: full version without dependency bundles, ES Module format

This file is the default file for `import` to import `@waline/client`, 19.39 KB Gzip size
This file is the default file to import `@waline/client` with Node.js, 19.39 KB Gzip size

- `dist/waline.css`: Waline CSS styles

Expand All @@ -25,13 +27,13 @@ icon: file

This file is for using Waline comments in component mode in a Vue project, 18.28 KB Gzip size

- `dist/comment.umd.js`: Waline's comment count module, UMD format, < 1KB Gzip size
- `dist/comment.js`: Waline's comment count module, ESM format, < 1KB Gzip size

This file is used for CDN ingestion, when only the number of page comments is required
This file is used for CDN import, when only the number of page comments is required

- `dist/pageview.umd.js`: Waline's pageview module, UMD format, < 1KB Gzip size
- `dist/pageview.js`: Waline's pageview module, ESM format, < 1KB Gzip size

This file is used for CDN ingestion, when only page views are required
This file is used for CDN import, when only page views are required

## Module exports

Expand Down
12 changes: 7 additions & 5 deletions docs/src/reference/client/file.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ icon: file

## CDN 文件列表

- `dist/waline.umd.js`: 完整版本,UMD 格式
- `dist/waline.js`: 完整版本, ESM 格式

此文件为 CDN 引入 `@waline/client` 的默认文件,53 KB Gzip 大小

- `dist/shim.js`: 不含依赖捆绑的完整版本, ES Module 格式
- `dist/waline.umd.js`: 完整版本,UMD 格式

- `dist/slim.js`: 不含依赖捆绑的完整版本, ES Module 格式

此文件为 `import` 引入 `@waline/client` 的默认文件, 19.39 KB Gzip 大小
此文件为 Node.js 导入 `@waline/client` 的默认文件, 19.39 KB Gzip 大小

- `dist/waline.css`: Waline CSS 样式

Expand All @@ -25,11 +27,11 @@ icon: file

此文件用于在 Vue 项目中以组件模式使用 Waline 评论, 18.28 KB Gzip 大小

- `dist/comment.umd.js`: Waline 的评论数模块,UMD 格式, < 1KB Gzip 大小
- `dist/comment.js`: Waline 的评论数模块,ESM 格式, < 1KB Gzip 大小

此文件用于 CDN 引入,用于仅需页面评论数的情况

- `dist/pageview.umd.js`: Waline 的浏览量模块,UMD 格式, < 1KB Gzip 大小
- `dist/pageview.js`: Waline 的浏览量模块,ESM 格式, < 1KB Gzip 大小

此文件用于 CDN 引入,用于仅需页面浏览量的情况

Expand Down
10 changes: 5 additions & 5 deletions packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
},
"exports": {
".": {
"types": "./dist/shim.d.ts",
"default": "./dist/shim.js"
"types": "./dist/slim.d.ts",
"default": "./dist/slim.js"
},
"./component": {
"types": "./dist/component.d.ts",
Expand All @@ -47,10 +47,10 @@
"./waline-meta.css": "./dist/waline-meta.css",
"./package.json": "./package.json"
},
"main": "./dist/shim.js",
"module": "./dist/shim.js",
"main": "./dist/slim.js",
"module": "./dist/slim.js",
"browser": "./dist/waline.umd.js",
"types": "./dist/shim.d.ts",
"types": "./dist/slim.d.ts",
"files": [
"dist"
],
Expand Down
36 changes: 14 additions & 22 deletions packages/client/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ export default [
format: 'esm',
sourcemap: true,
},
{
file: './dist/waline.umd.js',
format: 'umd',
name: 'Waline',
sourcemap: true,
},
],
plugins: [
vue({
Expand Down Expand Up @@ -52,19 +58,22 @@ export default [
treeshake: 'smallest',
},

// full declaration files
// full and slim declaration files
{
input: './src/entries/full.ts',
output: [{ file: './dist/waline.d.ts', format: 'esm' }],
output: [
{ file: './dist/waline.d.ts', format: 'esm' },
{ file: './dist/slim.d.ts', format: 'esm' },
],
plugins: [dts({ compilerOptions: { preserveSymlinks: false } })],
},

// shim package
// slim package
{
input: './src/entries/full.ts',
output: [
{
file: './dist/shim.js',
file: './dist/slim.js',
format: 'esm',
sourcemap: true,
},
Expand Down Expand Up @@ -105,12 +114,7 @@ export default [
'vue',
],
},
// shim declaration files
{
input: './src/entries/full.ts',
output: [{ file: './dist/shim.d.ts', format: 'esm' }],
plugins: [dts({ compilerOptions: { preserveSymlinks: false } })],
},

// components
{
input: './src/entries/components.ts',
Expand Down Expand Up @@ -167,12 +171,6 @@ export default [
{
input: './src/entries/comment.ts',
output: [
{
file: './dist/comment.umd.js',
format: 'umd',
name: 'Waline',
sourcemap: true,
},
{
file: './dist/comment.mjs',
format: 'esm',
Expand Down Expand Up @@ -220,12 +218,6 @@ export default [
{
input: './src/entries/pageview.ts',
output: [
{
file: './dist/pageview.umd.js',
format: 'umd',
name: 'Waline',
sourcemap: true,
},
{
file: './dist/pageview.js',
format: 'esm',
Expand Down

0 comments on commit 04917d1

Please sign in to comment.