Skip to content

Commit 01357ab

Browse files
committed
docs: update setting
1 parent 2e831b3 commit 01357ab

8 files changed

+58
-25
lines changed

docs/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"docs:serve": "vitepress serve docs"
99
},
1010
"devDependencies": {
11-
"vitepress": "1.0.0-alpha.65",
11+
"vitepress": "1.0.0-alpha.72",
1212
"vitepress-plugin-sandpack": "latest"
1313
}
1414
}

package.json

+34-14
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,33 @@
1616
"license": "MIT",
1717
"author": "jerrywu001 <57242263@163.com>",
1818
"main": "./dist/index.js",
19-
"module": "./dist/esm/index.js",
19+
"module": "./dist/index.mjs",
2020
"types": "./dist/index.d.ts",
21-
"typings": "./dist/index.d.ts",
21+
"exports": {
22+
".": {
23+
"types": "./dist/index.d.ts",
24+
"import": "./dist/index.mjs",
25+
"require": "./dist/index.js"
26+
},
27+
"./*": [
28+
"./*",
29+
"./*.d.ts"
30+
]
31+
},
32+
"typesVersions": {
33+
"*": {
34+
"*": [
35+
"./dist/*",
36+
"./*"
37+
]
38+
}
39+
},
2240
"files": [
2341
"dist",
2442
"package.json",
2543
"README.md",
26-
"global.d.ts"
44+
"global.d.ts",
45+
"*.d.ts"
2746
],
2847
"workspaces": [
2948
"docs",
@@ -59,40 +78,41 @@
5978
"@babel/plugin-transform-typescript": "^7.21.3",
6079
"@babel/preset-env": "^7.21.4",
6180
"@babel/preset-typescript": "^7.21.4",
62-
"@commitlint/cli": "^17.5.1",
63-
"@commitlint/config-conventional": "^17.4.4",
64-
"@swc/core": "^1.3.49",
81+
"@commitlint/cli": "^17.6.1",
82+
"@commitlint/config-conventional": "^17.6.1",
83+
"@swc/core": "^1.3.51",
6584
"@testing-library/jest-dom": "^5.16.5",
6685
"@testing-library/user-event": "^14.4.3",
6786
"@testing-library/vue": "^7.0.0",
6887
"@types/lodash.isequal": "^4.5.6",
6988
"@types/lz-string": "^1.3.34",
7089
"@types/node": "^18.15.11",
71-
"@typescript-eslint/eslint-plugin": "^5.58.0",
72-
"@typescript-eslint/parser": "^5.58.0",
90+
"@typescript-eslint/eslint-plugin": "^5.59.0",
91+
"@typescript-eslint/parser": "^5.59.0",
7392
"@vitejs/plugin-vue": "^4.1.0",
7493
"@vitejs/plugin-vue-jsx": "^3.0.1",
7594
"@vitest/ui": "^0.30.1",
7695
"@vue/babel-plugin-jsx": "^1.1.1",
7796
"@vue/eslint-config-typescript": "^11.0.2",
7897
"autoprefixer": "^10.4.14",
7998
"babel-loader": "^9.1.2",
99+
"browserslist-to-esbuild": "^1.2.0",
80100
"bumpp": "^9.1.0",
81-
"core-js": "^3.30.0",
101+
"core-js": "^3.30.1",
82102
"cssnano": "^6.0.0",
83103
"esbuild-plugin-babel": "^0.2.3",
84104
"eslint": "^8.38.0",
85105
"eslint-config-airbnb-base": "^15.0.0",
86106
"eslint-config-airbnb-typescript": "^17.0.0",
87107
"eslint-plugin-import": "^2.27.5",
88108
"eslint-plugin-jsx-a11y": "^6.7.1",
89-
"eslint-plugin-vue": "^9.10.0",
109+
"eslint-plugin-vue": "^9.11.0",
90110
"husky": "^8.0.3",
91111
"jsdom": "^21.1.1",
92112
"lint-staged": "^13.2.1",
93113
"npm": "^9.6.4",
94114
"npm-run-all": "^4.1.5",
95-
"postcss": "^8.4.21",
115+
"postcss": "^8.4.22",
96116
"postcss-cli": "^10.1.0",
97117
"postcss-loader": "^7.2.4",
98118
"postcss-nested": "^6.0.1",
@@ -104,9 +124,9 @@
104124
"stylelint-config-recommended-vue": "^1.4.0",
105125
"stylelint-config-standard": "^29.0.0",
106126
"tsup": "^6.7.0",
107-
"typescript": "^5.0.4",
108-
"vite": "^4.2.1",
109-
"vite-plugin-dts": "^2.2.0",
127+
"typescript": "^4.9.4",
128+
"vite": "^4.2.2",
129+
"vite-plugin-dts": "^2.3.0",
110130
"vitest": "^0.30.1",
111131
"vue-tsc": "^1.2.0"
112132
},

playground/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"build": "tsc && vue-tsc && vite build",
66
"build:storybook": "build-storybook",
77
"dev": "vite --host --open",
8-
"dev:usepack": "cross-env USEPACK=true vite --port 5000 --open",
8+
"dev:usepack": "cross-env USEPACK=true vite --host --port 5000 --open",
99
"preview": "vite preview",
1010
"storybook": "start-storybook -p 6006",
1111
"typecheck": "tsc && vue-tsc"

playground/tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"skipLibCheck": true,
1212
"strictNullChecks": true,
1313
"esModuleInterop": true,
14-
"ignoreDeprecations": "5.0",
1514
"allowSyntheticDefaultImports": true,
1615
"noEmit": true,
1716
"strict": true,

playground/vite.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default defineConfig({
99
resolve: {
1010
alias: {
1111
'@/': `${path.resolve(__dirname, 'src')}/`,
12-
'my-custom-vue3-package': path.resolve(__dirname, process.env.USEPACK === 'true' ? '../dist/esm' : '../src'),
12+
'my-custom-vue3-package': path.resolve(__dirname, process.env.USEPACK === 'true' ? '../dist' : '../src'),
1313
},
1414
},
1515
build: {

tsconfig.json

-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"skipLibCheck": true,
1212
"strictNullChecks": true,
1313
"esModuleInterop": true,
14-
"ignoreDeprecations": "5.0",
1514
"allowSyntheticDefaultImports": true,
1615
"strict": true,
1716
"noEmit": true,

tsup.config.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ export default defineConfig({
99
entry: [
1010
'./src/index.ts',
1111
],
12+
outExtension({ format }) {
13+
const extension = format === 'esm' ? '.mjs' : '.js';
14+
return {
15+
js: extension,
16+
};
17+
},
1218
target: 'es6',
1319
format: [
1420
'cjs',
@@ -18,7 +24,6 @@ export default defineConfig({
1824
clean: true,
1925
dts: './src/index.ts',
2026
// sourcemap: true,
21-
legacyOutput: true,
2227
splitting: false,
2328
minify: true,
2429
esbuildPlugins: [

vite.config.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,38 @@ import path from 'path';
66
import Vue from '@vitejs/plugin-vue';
77
import vueJsx from '@vitejs/plugin-vue-jsx';
88
import { defineConfig } from 'vite';
9+
import browserslistToEsbuild from 'browserslist-to-esbuild';
10+
import pkg from './package.json';
11+
12+
const resolvePath = (pathName: string) => path.resolve(__dirname, pathName);
913

1014
export default defineConfig({
1115
resolve: {
1216
alias: {
13-
'my-custom-vue3-package': path.resolve(__dirname, './src/index.ts'),
17+
'my-custom-vue3-package': resolvePath('./src/index.ts'),
1418
},
1519
},
1620
build: {
1721
minify: true,
1822
lib: {
1923
fileName: (type) => {
20-
if (type === 'es') return 'esm/index.js';
24+
if (type === 'es') return 'index.mjs';
2125
if (type === 'cjs') return 'index.js';
2226
return 'index.js';
2327
},
24-
entry: path.resolve(__dirname, 'src/index.ts'),
28+
entry: resolvePath('src/index.ts'),
2529
formats: ['es', 'cjs'],
2630
},
27-
// sourcemap: true,
31+
target: browserslistToEsbuild(),
32+
sourcemap: false,
2833
rollupOptions: {
34+
output: {
35+
exports: 'named',
36+
},
2937
external: [
30-
'vue',
38+
// ...Object.keys(pkg.dependencies), // if exist
39+
...Object.keys(pkg.devDependencies),
40+
...Object.keys(pkg.peerDependencies),
3141
],
3242
},
3343
},

0 commit comments

Comments
 (0)