diff --git a/.changeset/eight-mice-march.md b/.changeset/eight-mice-march.md new file mode 100644 index 000000000..045b8da9a --- /dev/null +++ b/.changeset/eight-mice-march.md @@ -0,0 +1,8 @@ +--- +"@farmfe/js-plugin-postcss": patch +"@farmfe/js-plugin-less": patch +"@farmfe/js-plugin-sass": patch +"@farmfe/core": patch +--- + +Fix persistent cache panic when using addFileWatchFile with query #2067 diff --git a/crates/compiler/src/build/module_cache.rs b/crates/compiler/src/build/module_cache.rs index 205097bae..baf558b74 100644 --- a/crates/compiler/src/build/module_cache.rs +++ b/crates/compiler/src/build/module_cache.rs @@ -305,9 +305,8 @@ fn is_watch_dependencies_timestamp_changed( "is_watch_dependencies_timestamp_changed: {:?}", cached_module.module.id )); - let module_id = cached_module.module.id.clean_id(); let watch_graph = context.watch_graph.read(); - let relation_dependencies = watch_graph.relation_dependencies(&module_id); + let relation_dependencies = watch_graph.relation_dependencies(&cached_module.module.id); if relation_dependencies.is_empty() { return false; @@ -342,9 +341,8 @@ fn is_watch_dependencies_content_hash_changed( "is_watch_dependencies_content_hash_changed: {:?}", cached_module.module.id )); - let module_id = cached_module.module.id.clean_id(); let watch_graph = context.watch_graph.read(); - let relation_dependencies = watch_graph.relation_dependencies(&module_id); + let relation_dependencies = watch_graph.relation_dependencies(&cached_module.module.id); if relation_dependencies.is_empty() { return false; diff --git a/crates/core/src/module/mod.rs b/crates/core/src/module/mod.rs index c16abac18..0f8272514 100644 --- a/crates/core/src/module/mod.rs +++ b/crates/core/src/module/mod.rs @@ -712,14 +712,6 @@ impl ModuleId { (p.to_string(), query.to_string()) } - - // path without query - pub fn clean_id(&self) -> ModuleId { - Self { - relative_path: self.relative_path.clone(), - query_string: "".to_string(), - } - } } impl From<&str> for ModuleId { diff --git a/examples/react/src/index.module.scss b/examples/react/src/index.module.scss new file mode 100644 index 000000000..8cfca002f --- /dev/null +++ b/examples/react/src/index.module.scss @@ -0,0 +1,11 @@ +@import './variables.scss'; + +:global { + body { + background-color: $primaryColor; + } +} + +.main { + display: block; +} \ No newline at end of file diff --git a/examples/react/src/index.scss b/examples/react/src/index.scss deleted file mode 100644 index 47179691a..000000000 --- a/examples/react/src/index.scss +++ /dev/null @@ -1,5 +0,0 @@ -@import './variables.scss'; - -body { - background-color: $primaryColor; -} diff --git a/examples/react/src/index.tsx b/examples/react/src/index.tsx index fe84e5270..4ef1fe7ed 100644 --- a/examples/react/src/index.tsx +++ b/examples/react/src/index.tsx @@ -1,16 +1,14 @@ -import { Provider } from 'react-redux'; -import React from 'react'; -import { createRoot } from 'react-dom/client'; -import { Main } from './main'; -import { store } from './store'; +import { Provider } from "react-redux"; +import React from "react"; +import { createRoot } from "react-dom/client"; +import { Main } from "./main"; +import { store } from "./store"; -import './index.scss'; - -const container = document.querySelector('#root'); +const container = document.querySelector("#root"); const root = createRoot(container); root.render(
- + , ); diff --git a/examples/react/src/main.tsx b/examples/react/src/main.tsx index ef90f4c6a..c64f210b2 100644 --- a/examples/react/src/main.tsx +++ b/examples/react/src/main.tsx @@ -1,13 +1,15 @@ -import React from 'react'; -import { useStore } from 'react-redux'; +import React from "react"; +import { useStore } from "react-redux"; -import { Welcome } from './components/index'; -import './main.css'; +import { Welcome } from "./components/index"; +import "./main.css"; -import { BizType } from './enums'; +import { BizType } from "./enums"; -import * as Sentry from '@sentry/react'; -import { Effect } from 'effect'; +import * as Sentry from "@sentry/react"; +import { Effect } from "effect"; + +import styles from "./index.module.scss"; Sentry.init({}); @@ -18,9 +20,9 @@ export function Main() { console.log(import.meta.env); return ( <> -
+
effect: {result}
-
+
store.api.config.online: {JSON.stringify(store.getState().api.config.online)} BizType: {BizType.First} {BizType.Second} diff --git a/examples/vite-adapter-vue/package.json b/examples/vite-adapter-vue/package.json index 0e8290637..f5906800b 100644 --- a/examples/vite-adapter-vue/package.json +++ b/examples/vite-adapter-vue/package.json @@ -3,14 +3,16 @@ "version": "0.0.1", "private": true, "dependencies": { - "@sinclair/typebox": "^0.32.33", "@opentiny/vue": "^3.18.0", + "@sinclair/typebox": "^0.32.33", "ant-design-vue": "3", + "argon2-browser": "^1.18.0", "axios": "^1.4.0", "bcryptjs": "^2.4.3", "bootstrap": "^5.3.3", "core-js": "^3.30.1", "element-plus": "^2.4.1", + "lodash-es": "^4.17.21", "prettier": "^3.3.2", "vue": "^3.2.45", "vue-router": "^4.2.1" @@ -25,6 +27,7 @@ "@farmfe/js-plugin-vue": "workspace:*", "@farmfe/plugin-sass": "workspace:^", "@types/bcryptjs": "^2.4.5", + "@types/lodash-es": "^4.17.12", "@unocss/postcss": "^0.62.2", "@vitejs/plugin-vue": "5.1.4", "@vitejs/plugin-vue-jsx": "^3.1.0", diff --git a/examples/vite-adapter-vue/src/App.vue b/examples/vite-adapter-vue/src/App.vue index efff15391..90056bb16 100644 --- a/examples/vite-adapter-vue/src/App.vue +++ b/examples/vite-adapter-vue/src/App.vue @@ -2,6 +2,13 @@ + Map is weakMap: {{mapIsWeakMap}}; + WeakMap is weakMap: {{weakMapIsWeakMap}}; + + + Argon2 hash + + Hash Bytes: {{hashBytes}} @@ -26,7 +33,7 @@