Skip to content

Commit

Permalink
Merge branch 'v2-dev' into fix/2024-12-10_bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ErKeLost authored Dec 11, 2024
2 parents 0f67043 + eeeb886 commit c36506a
Show file tree
Hide file tree
Showing 260 changed files with 2,273 additions and 895 deletions.
5 changes: 0 additions & 5 deletions .changeset/hungry-bikes-guess.md

This file was deleted.

2 changes: 0 additions & 2 deletions .changeset/sweet-ears-agree.md

This file was deleted.

7 changes: 7 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ jobs:
run: npm install -g [email protected] && pnpm i --frozen-lockfile
- name: Build CLI and Core
run: pnpm --filter @farmfe/cli run build
- name: Build Runtime
run: pnpm --filter @farmfe/runtime run build
- name: Type Check With Tsc
run: pnpm run --filter "@farmfe/*" type-check
- name: Changesets Check
Expand Down Expand Up @@ -145,6 +147,11 @@ jobs:
with:
name: ${{ github.sha }}-${{ matrix.settings.abi }}
path: ./packages/core/binding
- name: Build Runtime
run: |
pnpm --filter "@farmfe/runtime" build
pnpm --filter "@farmfe/runtime-plugin-hmr" build
pnpm --filter "@farmfe/runtime-plugin-import-meta" build
- name: Build Core CJS
run: cd packages/core && pnpm run build:cjs
- name: Test - ${{ matrix.settings.abi }}
Expand Down
243 changes: 243 additions & 0 deletions bench/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,243 @@
# bench

## 1.0.32

### Patch Changes

- Updated dependencies [e63b163a]
- Updated dependencies [e63b163a]
- Updated dependencies [e63b163a]
- Updated dependencies [e63b163a]
- @farmfe/core@1.5.0

## 1.0.31

### Patch Changes

- Updated dependencies [c6df3d2b]
- @farmfe/core@1.4.7

## 1.0.30

### Patch Changes

- @farmfe/core@1.4.6

## 1.0.29

### Patch Changes

- Updated dependencies [376fd9d4]
- @farmfe/core@1.4.5

## 1.0.28

### Patch Changes

- Updated dependencies [94451ae6]
- Updated dependencies [b05a2c84]
- @farmfe/core@1.4.4

## 1.0.27

### Patch Changes

- Updated dependencies [c4ff67a2]
- Updated dependencies [c4ff67a2]
- @farmfe/core@1.4.3

## 1.0.26

### Patch Changes

- Updated dependencies [3085d644]
- @farmfe/core@1.4.2

## 1.0.25

### Patch Changes

- @farmfe/core@1.4.1

## 1.0.24

### Patch Changes

- Updated dependencies [7d86847c]
- @farmfe/core@1.4.0

## 1.0.23

### Patch Changes

- Updated dependencies [8853c4aa]
- @farmfe/core@1.3.34

## 1.0.22

### Patch Changes

- Updated dependencies [3b95eef4]
- @farmfe/core@1.3.33

## 1.0.21

### Patch Changes

- Updated dependencies [3ae860bd]
- @farmfe/core@1.3.32

## 1.0.20

### Patch Changes

- Updated dependencies [c078cd35]
- Updated dependencies [c078cd35]
- @farmfe/core@1.3.31

## 1.0.19

### Patch Changes

- Updated dependencies [36512446]
- Updated dependencies [2b9b2e3f]
- Updated dependencies [b3a7caf2]
- @farmfe/core@1.3.30

## 1.0.18

### Patch Changes

- Updated dependencies [663dfeed]
- @farmfe/core@1.3.29

## 1.0.17

### Patch Changes

- Updated dependencies [e1f5c696]
- Updated dependencies [a2a32f51]
- Updated dependencies [04a124fe]
- Updated dependencies [7d84234e]
- @farmfe/core@1.3.28

## 1.0.16

### Patch Changes

- Updated dependencies
- @farmfe/core@1.3.27

## 1.0.15

### Patch Changes

- Updated dependencies [3b6eb912]
- Updated dependencies [ed676f02]
- @farmfe/core@1.3.26

## 1.0.14

### Patch Changes

- Updated dependencies [97408595]
- @farmfe/core@1.3.25

## 1.0.13

### Patch Changes

- Updated dependencies [772381b0]
- Updated dependencies [732c046d]
- @farmfe/core@1.3.24

## 1.0.12

### Patch Changes

- Updated dependencies [e17551ad]
- Updated dependencies [4542c3d8]
- @farmfe/core@1.3.23

## 1.0.11

### Patch Changes

- Updated dependencies [5f0c02d2]
- @farmfe/core@1.3.22

## 1.0.10

### Patch Changes

- Updated dependencies [1b1a7c17]
- @farmfe/core@1.3.21

## 1.0.9

### Patch Changes

- Updated dependencies [ca00a930]
- @farmfe/core@1.3.20

## 1.0.8

### Patch Changes

- Updated dependencies [2095f173]
- @farmfe/core@1.3.19

## 1.0.7

### Patch Changes

- Updated dependencies [e4e8b92b]
- @farmfe/core@1.3.18

## 1.0.6

### Patch Changes

- Updated dependencies [83b89e72]
- @farmfe/core@1.3.17

## 1.0.5

### Patch Changes

- Updated dependencies [b5d2a4c3]
- Updated dependencies [2e7f4f90]
- Updated dependencies [b7fb695a]
- @farmfe/core@1.3.16

## 1.0.4

### Patch Changes

- @farmfe/core@1.3.15

## 1.0.3

### Patch Changes

- Updated dependencies [535d0b2c]
- Updated dependencies [8e67cdab]
- Updated dependencies [73cfd570]
- @farmfe/core@1.3.14

## 1.0.2

### Patch Changes

- Updated dependencies [ed5c5278]
- Updated dependencies [ef19162f]
- @farmfe/core@1.3.13

## 1.0.1

### Patch Changes

- Updated dependencies [7417d0f3]
- Updated dependencies [49448561]
- Updated dependencies [eff069c4]
- @farmfe/core@1.3.12
13 changes: 13 additions & 0 deletions bench/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "bench",
"version": "1.0.32",
"private": true,
"description": "",
"scripts": {},
"dependencies": {
"@farmfe/core": "workspace:*"
},
"keywords": [],
"author": "",
"license": "ISC"
}
3 changes: 3 additions & 0 deletions crates/compiler/src/build/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,10 @@ impl Compiler {
if let Some(cached_module) =
try_get_module_cache_by_hash(&module.id, &module.content_hash, context)?
{
// should not overwrite the timestamp of current resolved module
let last_update_timestamp = module.last_update_timestamp;
*module = cached_module.module;
module.last_update_timestamp = last_update_timestamp;
return Ok(CachedModule::dep_sources(cached_module.dependencies));
}

Expand Down
19 changes: 17 additions & 2 deletions crates/compiler/src/build/module_cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,16 @@ pub fn set_module_graph_cache(module_ids: Vec<ModuleId>, context: &Arc<Compilati
.collect::<Vec<_>>();

for module in &modules {
// if the module has already in the cache and not changed, skip it.
if !context.cache_manager.module_cache.is_cache_changed(module) {
// skip cache unchanged modules if following conditions are met:
// 1. There is no query string in the module id when timestamp enabled
// 2. if the module has already in the cache and the cache hash not changed
// Note: For condition 1, here is the case: `index.vue` imports virtual modules like `index.vue?vue&setup&lang.tsx`,
// when content of `index.vue` is changed, the content hash of `index.vue?vue&setup&lang.tsx` may not be changed,
// but the cached timestamp of `index.vue?vue&setup&lang.tsx` should be updated to make sure the cache is always up-to-date.
// otherwise, cache of `index.vue` is used but cache of `index.vue?vue&setup&lang.tsx` is not used, which would cause a bug like transform error.
if (!context.config.persistent_cache.timestamp_enabled() || module.id.query_string().is_empty())
&& !context.cache_manager.module_cache.is_cache_changed(module)
{
continue;
}

Expand Down Expand Up @@ -255,9 +263,16 @@ pub fn handle_cached_modules(
context,
)?;

// clear module groups and resource pot as it will be re-resolved later
cached_module.module.module_groups.clear();
cached_module.module.resource_pot = None;
cached_module.module.used_exports.clear();

// TODO: return of resolve hook should be treated as part of the cache key
Ok(())
}

/// recreate the watch graph for the cached module
fn handle_relation_roots(
cached_module_id: &ModuleId,
watch_dependencies: &Vec<CachedWatchDependency>,
Expand Down
4 changes: 3 additions & 1 deletion crates/compiler/src/update/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ impl Compiler {
self.set_module_group_graph_stats();

// update cache
set_updated_modules_cache(&updated_module_ids, &diff_result, &self.context);
if self.context.config.persistent_cache.enabled() {
set_updated_modules_cache(&updated_module_ids, &diff_result, &self.context);
}

// call module graph updated hook
self.context.plugin_driver.module_graph_updated(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub fn generate_and_diff_resource_pots(
let mut new_resource_pot_ids =
diff_and_patch_resource_pot_map(resources_pots, &enforce_resource_pot_ids, context);

// alway render affected resource pots resource pots
// alway render affected resource pots
enforce_resource_pot_ids.into_iter().for_each(|id| {
if !new_resource_pot_ids.contains(&id) {
new_resource_pot_ids.insert(id);
Expand Down
Loading

0 comments on commit c36506a

Please sign in to comment.