diff --git a/package.json b/package.json index 2a245da..3827575 100644 --- a/package.json +++ b/package.json @@ -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", @@ -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", @@ -116,7 +117,7 @@ "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", @@ -124,26 +125,25 @@ "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" @@ -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" } } } diff --git a/playground/package.json b/playground/package.json index 71c6571..a849ea3 100644 --- a/playground/package.json +++ b/playground/package.json @@ -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" } diff --git a/playground/vite.config.ts b/playground/vite.config.ts index dd42a59..63b7953 100644 --- a/playground/vite.config.ts +++ b/playground/vite.config.ts @@ -20,10 +20,12 @@ export default defineConfig({ sourcemap: true, }, plugins: [ + // @ts-ignore Vue({ // reactivityTransform: true, }), + // @ts-ignore vueJsx(), // https://github.com/hannoeru/vite-plugin-pages @@ -31,9 +33,11 @@ export default defineConfig({ importMode: 'sync', }), + // @ts-ignore WindiCSS(), // https://github.com/antfu/unocss + // @ts-ignore Unocss({ configFile: path.resolve(__dirname, 'uno.config.ts'), }), diff --git a/src/contexts/sandpackContext.tsx b/src/contexts/sandpackContext.tsx index 1beba61..dbfb6ea 100644 --- a/src/contexts/sandpackContext.tsx +++ b/src/contexts/sandpackContext.tsx @@ -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) }); } diff --git a/vite.config.ts b/vite.config.ts index ea76d68..08c8bc3 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,5 +1,4 @@ /// -/// import dts from 'vite-plugin-dts'; import path from 'path';