Skip to content

Commit

Permalink
fix: can't update in real time, fix #40
Browse files Browse the repository at this point in the history
  • Loading branch information
vben-admin committed Aug 1, 2021
1 parent f91dea1 commit f25c6ac
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 46 deletions.
2 changes: 1 addition & 1 deletion examples/ts-example/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { viteMockServe } from '../../src';
import { viteMockServe } from '../../dist/index';

import { UserConfigExport, ConfigEnv } from 'vite';
import vue from '@vitejs/plugin-vue';
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@
"pretty-quick": "^3.1.1",
"rimraf": "^3.0.2",
"ts-jest": "^27.0.3",
"tsup": "^4.12.5",
"typescript": "^4.3.5",
"vite": "^2.4.2"
"tsup": "4.8.21",
"typescript": "^4.3.2",
"vite": "2.1.5"
}
}
2 changes: 1 addition & 1 deletion src/createMockServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function createWatch(opt: ViteMockOptions) {

// clear cache
function cleanRequireCache(opt: ViteMockOptions) {
if (!require || !require.cache) {
if (!require.cache) {
return;
}
const { absConfigPath, absMockPath } = getPath(opt);
Expand Down
93 changes: 52 additions & 41 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2487,10 +2487,15 @@ [email protected]:
resolved "https://registry.yarnpkg.com/esbuild/-/esbuild-0.11.3.tgz#b57165b907be4ffba651f6450538ce8d8c1d5eb0"
integrity sha512-BzVRHcCtFepjS9WcqRjqoIxLqgpK21a8J4Zi4msSGxDxiXVO1IbcqT1KjhdDDnJxKfe7bvzZrvMEX+bVO0Elcw==

esbuild@^0.12.8, esbuild@^0.12.9:
version "0.12.14"
resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.12.14.tgz#43157dbd0b36d939247d4eb4909a4886ac40f82e"
integrity sha512-z8p+6FGiplR7a3pPonXREbm+8IeXjBGvDpVidZmGB/AJMsJSfGCU+n7KOMCazA9AwvagadRWBhiKorC0w9WJvw==
esbuild@^0.10.2:
version "0.10.2"
resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.10.2.tgz#caa65a8f3096d547d89159918039df6c5c6c90be"
integrity sha512-/5vsZD7wTJJHC3yNXLUjXNvUDwqwNoIMvFvLd9tcDQ9el5l13pspYm3yufavjIeYvNtAbo+6N/6uoWx9dGA6ug==

esbuild@^0.9.3:
version "0.9.7"
resolved "https://registry.npmjs.org/esbuild/-/esbuild-0.9.7.tgz#ea0d639cbe4b88ec25fbed4d6ff00c8d788ef70b"
integrity sha512-VtUf6aQ89VTmMLKrWHYG50uByMF4JQlVysb8dmg6cOgW8JnFCipmz7p+HNBl+RR3LLCuBxFGVauAe2wfnF9bLg==

escalade@^3.1.1:
version "3.1.1"
Expand Down Expand Up @@ -3206,6 +3211,18 @@ globby@^11.0.1:
merge2 "^1.3.0"
slash "^3.0.0"

globby@^11.0.2:
version "11.0.4"
resolved "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz#2cbaff77c2f2a62e71e9b2813a67b97a3a3001a5"
integrity sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==
dependencies:
array-union "^2.1.0"
dir-glob "^3.0.1"
fast-glob "^3.1.1"
ignore "^5.1.4"
merge2 "^1.3.0"
slash "^3.0.0"

globby@^11.0.3:
version "11.0.3"
resolved "https://registry.npmjs.org/globby/-/globby-11.0.3.tgz#9b1f0cb523e171dd1ad8c7b2a9fb4b644b9593cb"
Expand Down Expand Up @@ -4163,7 +4180,7 @@ jest@^27.0.6:
import-local "^3.0.2"
jest-cli "^27.0.6"

joycon@^3.0.1:
joycon@^3.0.0:
version "3.0.1"
resolved "https://registry.npmjs.org/joycon/-/joycon-3.0.1.tgz#9074c9b08ccf37a6726ff74a18485f85efcaddaf"
integrity sha512-SJcJNBg32dGgxhPtM0wQqxqV0ax9k/9TaUskGDSJkSFSQOEWWvQ3zzWdGQRIUry2j1zA5+ReH13t0Mf3StuVZA==
Expand Down Expand Up @@ -5155,10 +5172,10 @@ postcss-load-config@^3.0.1:
cosmiconfig "^7.0.0"
import-cwd "^3.0.0"

postcss@^8.3.5:
version "8.3.5"
resolved "https://registry.npmjs.org/postcss/-/postcss-8.3.5.tgz#982216b113412bc20a86289e91eb994952a5b709"
integrity sha512-NxTuJocUhYGsMiMFHDUkmjSKT3EdH4/WbGF6GCi1NDGk+vbcUTun4fpbOqaPtD8IIsztA2ilZm2DhYCuyN58gA==
postcss@^8.2.1:
version "8.3.6"
resolved "https://registry.npmjs.org/postcss/-/postcss-8.3.6.tgz#2730dd76a97969f37f53b9a6096197be311cc4ea"
integrity sha512-wG1cc/JhRgdqB6WHEuyLTedf3KIRuD0hG6ldkFEZNCjRxiC+3i6kkWUUbiJQayP28iwG35cEmAbe98585BYV0A==
dependencies:
colorette "^1.2.2"
nanoid "^3.1.23"
Expand Down Expand Up @@ -5507,10 +5524,10 @@ rollup@^2.38.5:
optionalDependencies:
fsevents "~2.3.1"

rollup@^2.45.2:
version "2.52.7"
resolved "https://registry.npmjs.org/rollup/-/rollup-2.52.7.tgz#e15a8bf734f6e4c204b7cdf33521151310250cb2"
integrity sha512-55cSH4CCU6MaPr9TAOyrIC+7qFCHscL7tkNsm1MBfIJRRqRbCEY0mmeFn4Wg8FKsHtEH8r389Fz38r/o+kgXLg==
rollup@^2.41.2:
version "2.55.1"
resolved "https://registry.npmjs.org/rollup/-/rollup-2.55.1.tgz#66a444648e2fb603d8e329e77a61c608a6510fda"
integrity sha512-1P9w5fpb6b4qroePh8vHKGIvPNxwoCQhjJpIqfZGHLKpZ0xcU2/XBmFxFbc9697/6bmHpmFTLk5R1dAQhFSo0g==
optionalDependencies:
fsevents "~2.3.2"

Expand Down Expand Up @@ -5933,10 +5950,10 @@ strip-json-comments@^3.1.0, strip-json-comments@^3.1.1:
resolved "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz#31f1281b3832630434831c310c01cccda8cbe006"
integrity sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==

sucrase@^3.18.1:
version "3.19.0"
resolved "https://registry.npmjs.org/sucrase/-/sucrase-3.19.0.tgz#cc9a60f731e7497766a7b710d3362260a8f9ced5"
integrity sha512-FeMelydANPRMiOo/lxbf7NxN8bQmMVBQmKOa69BifwVhteMJzRoJNHaVBoCYmE/kpnx6VPg9ckaLumwtuAzmEA==
sucrase@^3.17.1:
version "3.20.0"
resolved "https://registry.npmjs.org/sucrase/-/sucrase-3.20.0.tgz#a80e865830e27d66a912c938491d474164b06205"
integrity sha512-Rsp+BX7DRuCleJvBAHN7gQ3ddk7U0rJev19XlIBF6dAq9vX4Tr5mHk4E7+ig/I7BM3DLYotCmm20lfBElT2XtQ==
dependencies:
commander "^4.0.0"
glob "7.1.6"
Expand Down Expand Up @@ -6142,11 +6159,6 @@ tr46@^2.1.0:
dependencies:
punycode "^2.1.1"

tree-kill@^1.2.2:
version "1.2.2"
resolved "https://registry.npmjs.org/tree-kill/-/tree-kill-1.2.2.tgz#4ca09a9092c88b73a7cdc5e8a01b507b0790a0cc"
integrity sha512-L0Orpi8qGpRG//Nd+H90vFB+3iHnue1zSSGmNOOCh1GLJ7rUKVwV2HvijphGQS2UmhUZewS9VgvxYIdgr+fG1A==

trim-newlines@^1.0.0:
version "1.0.0"
resolved "https://registry.npmjs.org/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
Expand Down Expand Up @@ -6188,24 +6200,23 @@ tslib@^1.8.1, tslib@^1.9.0:
resolved "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00"
integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==

tsup@^4.12.5:
version "4.12.5"
resolved "https://registry.yarnpkg.com/tsup/-/tsup-4.12.5.tgz#fefbee2b32b244dd3f6c01986f8ab68e7ab83fc3"
integrity sha512-3f0StcX+trOZvgaY/iU11U8HvvQ4v/LLgoP9OmxtOQVXP8e/Q8FSk69d0bXFb2pHB77CmVxvqiWdwybELQfx1A==
tsup@4.8.21:
version "4.8.21"
resolved "https://registry.npmjs.org/tsup/-/tsup-4.8.21.tgz#15c3fc9552b3612f5ac29bc5c875d59e4cc300d8"
integrity sha512-8paK4Q0jvsbZE7v9ptsL1JxUSs83etaml2IrNBOsnTdgrHD/gq9dvxEcWU7rNdyCCh4UhUZ8RlEjRI3etZyfsw==
dependencies:
cac "^6.7.2"
chalk "^4.1.0"
chokidar "^3.5.1"
debug "^4.3.1"
esbuild "^0.12.9"
esbuild "^0.10.2"
execa "^5.0.0"
globby "^11.0.3"
joycon "^3.0.1"
globby "^11.0.2"
joycon "^3.0.0"
postcss-load-config "^3.0.1"
resolve-from "^5.0.0"
rollup "^2.45.2"
sucrase "^3.18.1"
tree-kill "^1.2.2"
rollup "^2.41.2"
sucrase "^3.17.1"

tsutils@^3.17.1, tsutils@^3.21.0:
version "3.21.0"
Expand Down Expand Up @@ -6265,7 +6276,7 @@ typedarray-to-buffer@^3.1.5:
dependencies:
is-typedarray "^1.0.0"

typescript@^4.3.5:
typescript@^4.3.2:
version "4.3.5"
resolved "https://registry.npmjs.org/typescript/-/typescript-4.3.5.tgz#4d1c37cc16e893973c45a06886b7113234f119f4"
integrity sha512-DqQgihaQ9cUrskJo9kIyW/+g0Vxsk8cDtZ52a3NGh0YNTfpUSArXSohyUGnvbPazEPLu398C0UxmKSOrPumUzA==
Expand Down Expand Up @@ -6362,17 +6373,17 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"

vite@^2.4.2:
version "2.4.2"
resolved "https://registry.yarnpkg.com/vite/-/vite-2.4.2.tgz#07d00615775c808530bc9f65641062b349b67929"
integrity sha512-2MifxD2I9fjyDmmEzbULOo3kOUoqX90A58cT6mECxoVQlMYFuijZsPQBuA14mqSwvV3ydUsqnq+BRWXyO9Qa+w==
vite@2.1.5:
version "2.1.5"
resolved "https://registry.npmjs.org/vite/-/vite-2.1.5.tgz#4857da441c62f7982c83cbd5f42a00330f20c9c1"
integrity sha512-tYU5iaYeUgQYvK/CNNz3tiJ8vYqPWfCE9IQ7K0iuzYovWw7lzty7KRYGWwV3CQPh0NKxWjOczAqiJsCL0Xb+Og==
dependencies:
esbuild "^0.12.8"
postcss "^8.3.5"
resolve "^1.20.0"
esbuild "^0.9.3"
postcss "^8.2.1"
resolve "^1.19.0"
rollup "^2.38.5"
optionalDependencies:
fsevents "~2.3.2"
fsevents "~2.3.1"

w3c-hr-time@^1.0.2:
version "1.0.2"
Expand Down

0 comments on commit f25c6ac

Please sign in to comment.