Skip to content

Commit

Permalink
perf: dependeny js api constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
SyMind committed Dec 23, 2024
1 parent 8fda3ba commit 29181a5
Showing 1 changed file with 24 additions and 26 deletions.
50 changes: 24 additions & 26 deletions packages/rspack/src/Dependency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,33 +19,31 @@ export class Dependency {
private constructor(binding: JsDependency) {
this.#inner = binding;

Object.defineProperties(this, {
type: {
enumerable: true,
get(): string {
return binding.type;
}
},
category: {
enumerable: true,
get(): string {
return binding.category;
}
},
request: {
enumerable: true,
get(): string | undefined {
return binding.request;
}
Object.defineProperty(this, "type", {
enumerable: true,
get(): string {
return binding.type;
}
});
Object.defineProperty(this, "category", {
enumerable: true,
get(): string {
return binding.category;
}
});
Object.defineProperty(this, "request", {
enumerable: true,
get(): string | undefined {
return binding.request;
}
});
Object.defineProperty(this, "critical", {
enumerable: true,
get(): boolean {
return binding.critical;
},
critical: {
enumerable: true,
get(): boolean {
return binding.critical;
},
set(val: boolean) {
binding.critical = val;
}
set(val: boolean) {
binding.critical = val;
}
});
}
Expand Down

0 comments on commit 29181a5

Please sign in to comment.