mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(syntax): use FxHashMap for ModuleRecord::request_modules (#3124)
closes #3121 The ordering is not important here.
This commit is contained in:
parent
14e4c58540
commit
ae6561308c
5 changed files with 13 additions and 16 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
|
@ -1621,7 +1621,6 @@ version = "0.12.5"
|
|||
dependencies = [
|
||||
"bitflags 2.5.0",
|
||||
"dashmap",
|
||||
"indexmap",
|
||||
"oxc_index",
|
||||
"oxc_span",
|
||||
"phf",
|
||||
|
|
|
|||
|
|
@ -141,7 +141,7 @@ impl Rule for NoCycle {
|
|||
});
|
||||
|
||||
if visitor_result.result {
|
||||
let span = module_record.requested_modules.get(&stack[0].0).unwrap()[0].span();
|
||||
let span = module_record.requested_modules[&stack[0].0][0].span();
|
||||
let help = stack
|
||||
.iter()
|
||||
.map(|(specifier, path)| {
|
||||
|
|
|
|||
|
|
@ -369,17 +369,6 @@ expression: no_duplicates
|
|||
13 │ }
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-import(no-duplicates): Forbid repeated import of the same module in multiple places
|
||||
╭─[index.ts:1:19]
|
||||
1 │ import {A1,} from 'foo';
|
||||
· ─────
|
||||
2 │ import {B1,} from 'foo';
|
||||
· ─────
|
||||
3 │ import {C1,} from 'foo';
|
||||
· ─────
|
||||
4 │
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-import(no-duplicates): Forbid repeated import of the same module in multiple places
|
||||
╭─[index.ts:7:20]
|
||||
6 │ A2,
|
||||
|
|
@ -395,6 +384,17 @@ expression: no_duplicates
|
|||
· ─────
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-import(no-duplicates): Forbid repeated import of the same module in multiple places
|
||||
╭─[index.ts:1:19]
|
||||
1 │ import {A1,} from 'foo';
|
||||
· ─────
|
||||
2 │ import {B1,} from 'foo';
|
||||
· ─────
|
||||
3 │ import {C1,} from 'foo';
|
||||
· ─────
|
||||
4 │
|
||||
╰────
|
||||
|
||||
⚠ eslint-plugin-import(no-duplicates): Forbid repeated import of the same module in multiple places
|
||||
╭─[index.ts:1:20]
|
||||
1 │ import type x from './foo'; import type y from './foo'
|
||||
|
|
|
|||
|
|
@ -25,7 +25,6 @@ oxc_span = { workspace = true }
|
|||
unicode-id-start = { workspace = true }
|
||||
bitflags = { workspace = true }
|
||||
rustc-hash = { workspace = true }
|
||||
indexmap = { workspace = true }
|
||||
dashmap = { workspace = true }
|
||||
phf = { workspace = true, features = ["macros"] }
|
||||
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@
|
|||
use std::{fmt, hash::BuildHasherDefault, path::PathBuf, sync::Arc};
|
||||
|
||||
use dashmap::DashMap;
|
||||
use indexmap::IndexMap;
|
||||
use rustc_hash::{FxHashMap, FxHasher};
|
||||
|
||||
use oxc_span::{CompactStr, Span};
|
||||
|
|
@ -32,7 +31,7 @@ pub struct ModuleRecord {
|
|||
/// import ModuleSpecifier
|
||||
/// export ExportFromClause FromClause
|
||||
/// Keyed by ModuleSpecifier, valued by all node occurrences
|
||||
pub requested_modules: IndexMap<CompactStr, Vec<RequestedModule>, BuildHasherDefault<FxHasher>>,
|
||||
pub requested_modules: FxHashMap<CompactStr, Vec<RequestedModule>>,
|
||||
|
||||
/// `[[LoadedModules]]`
|
||||
///
|
||||
|
|
|
|||
Loading…
Reference in a new issue