Skip to content

Commit

Permalink
fix: addFile with no code argument & rimraf issue
Browse files Browse the repository at this point in the history
  • Loading branch information
jerrywu committed Dec 12, 2022
1 parent 575c3e2 commit b55a281
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 24 deletions.
42 changes: 24 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@
"clean-set": "^1.1.2",
"code-hike-classer-vue3": "^0.1.6",
"lodash.isequal": "^4.5.0",
"lz-string": "^1.4.4"
"lz-string": "^1.4.4",
"rimraf": "^3.0.2"
},
"devDependencies": {
"@babel/core": "^7.20.5",
Expand All @@ -94,18 +95,18 @@
"@storybook/addon-links": "~6.4.22",
"@storybook/builder-vite": "0.1.37",
"@storybook/vue3": "~6.4.22",
"@swc/core": "^1.3.21",
"@swc/core": "^1.3.22",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/user-event": "^14.4.3",
"@testing-library/vue": "^6.6.1",
"@types/lodash.isequal": "^4.5.6",
"@types/lz-string": "^1.3.34",
"@types/node": "^18.11.10",
"@typescript-eslint/eslint-plugin": "^5.45.0",
"@typescript-eslint/parser": "^5.45.0",
"@vitejs/plugin-vue": "^3.2.0",
"@vitejs/plugin-vue-jsx": "^2.1.1",
"@vitest/ui": "^0.25.3",
"@types/node": "^18.11.13",
"@typescript-eslint/eslint-plugin": "^5.46.0",
"@typescript-eslint/parser": "^5.46.0",
"@vitejs/plugin-vue": "^4.0.0",
"@vitejs/plugin-vue-jsx": "^3.0.0",
"@vitest/ui": "^0.25.7",
"@vue/babel-plugin-jsx": "^1.1.1",
"@vue/eslint-config-typescript": "^11.0.2",
"autoprefixer": "^10.4.13",
Expand All @@ -116,34 +117,33 @@
"core-js": "^3.26.1",
"cssnano": "^5.1.14",
"esbuild-plugin-babel": "^0.2.3",
"eslint": "^8.28.0",
"eslint": "^8.29.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-airbnb-typescript": "^17.0.0",
"eslint-plugin-import": "^2.26.0",
"eslint-plugin-jsx-a11y": "^6.6.1",
"eslint-plugin-vue": "^9.8.0",
"husky": "^8.0.2",
"jsdom": "^20.0.3",
"lint-staged": "^13.0.4",
"npm": "^9.1.3",
"postcss": "^8.4.19",
"lint-staged": "^13.1.0",
"npm": "^9.2.0",
"postcss": "^8.4.20",
"postcss-cli": "^10.1.0",
"postcss-loader": "^7.0.2",
"postcss-nested": "^6.0.0",
"rimraf": "^3.0.2",
"shelljs": "^0.8.5",
"stylelint": "^14.15.0",
"stylelint": "^14.16.0",
"stylelint-config-prettier": "^9.0.4",
"stylelint-config-recommended-vue": "^1.4.0",
"stylelint-config-standard": "^29.0.0",
"stylelint-prettier": "^2.0.0",
"tsup": "^6.5.0",
"typescript": "~4.8.4",
"vite": "^3.2.4",
"typescript": "^4.9.4",
"vite": "^4.0.0",
"vite-plugin-dts": "^1.7.1",
"vite-plugin-windicss": "^1.8.8",
"vitest": "^0.25.3",
"vue-tsc": "^1.0.10"
"vitest": "^0.25.7",
"vue-tsc": "^1.0.13"
},
"peerDependencies": {
"vue": "^3.2.0"
Expand All @@ -163,6 +163,12 @@
},
"@storybook/vue3": {
"babel-loader": "^9.1.0"
},
"@storybook/builder-vite": {
"@vitejs/plugin-vue": "^4.0.0"
},
"vite-plugin-windicss": {
"vite": "^4.0.0"
}
}
}
4 changes: 2 additions & 2 deletions playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
},
"devDependencies": {
"@iconify-json/carbon": "^1.1.11",
"@unocss/reset": "^0.47.4",
"@unocss/reset": "^0.47.6",
"cross-env": "^7.0.3",
"unocss": "^0.47.4",
"unocss": "^0.47.6",
"vite-plugin-pages": "^0.27.1",
"vue-loader": "^17.0.1"
}
Expand Down
4 changes: 4 additions & 0 deletions playground/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,24 @@ export default defineConfig({
sourcemap: true,
},
plugins: [
// @ts-ignore
Vue({
// reactivityTransform: true,
}),

// @ts-ignore
vueJsx(),

// https://github.com/hannoeru/vite-plugin-pages
Pages({
importMode: 'sync',
}),

// @ts-ignore
WindiCSS(),

// https://github.com/antfu/unocss
// @ts-ignore
Unocss({
configFile: path.resolve(__dirname, 'uno.config.ts'),
}),
Expand Down
6 changes: 3 additions & 3 deletions src/contexts/sandpackContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,12 +177,12 @@ const SandpackProvider = defineComponent({
}

function updateFile(pathOrFiles: string | SandpackFiles, code?: string) {
if (typeof pathOrFiles === 'string' && code) {
if (code === state.files[pathOrFiles]?.code) {
if (typeof pathOrFiles === 'string') {
if (state.files[pathOrFiles]?.code && code === state.files[pathOrFiles].code) {
return;
}

state.files = { ...state.files, [pathOrFiles]: { code } };
state.files = { ...state.files, [pathOrFiles]: { code: code ?? '' } };
} else if (typeof pathOrFiles === 'object') {
state.files = normalizePath({ ...state.files, ...convertedFilesToBundlerFiles(pathOrFiles) });
}
Expand Down
1 change: 0 additions & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/// <reference types="vitest" />
/// <reference types="vite/client" />

import dts from 'vite-plugin-dts';
import path from 'path';
Expand Down

0 comments on commit b55a281

Please sign in to comment.