Skip to content

Commit

Permalink
[pigment] Patch WyW's WeakRef usage (#41909)
Browse files Browse the repository at this point in the history
  • Loading branch information
DiegoAndai authored Apr 15, 2024
1 parent 3152481 commit 357c50e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 6 deletions.
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,9 @@
"@mui/joy": "workspace:*",
"@mui/material": "workspace:^",
"@mui/utils": "workspace:^",
"@pigment-css/react": "workspace:^",
"@next/eslint-plugin-next": "^14.2.1",
"@octokit/rest": "^20.1.0",
"@pigment-css/react": "workspace:^",
"@playwright/test": "1.43.1",
"@types/enzyme": "^3.10.18",
"@types/fs-extra": "^11.0.4",
Expand Down Expand Up @@ -227,5 +227,10 @@
],
"sourceMap": false,
"instrument": false
},
"pnpm": {
"patchedDependencies": {
"@wyw-in-js/[email protected]": "patches/@[email protected]"
}
}
}
44 changes: 44 additions & 0 deletions patches/@[email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/esm/module.js b/esm/module.js
index 527070166142e7fda5ed14e1f3465052c82f2a2b..122061e0d481066a2b5fd0c7ab2a8b1d523b1ef1 100644
--- a/esm/module.js
+++ b/esm/module.js
@@ -119,7 +119,7 @@ export class Module {
this.services = services;
this.moduleImpl = moduleImpl;
this.cache = services.cache;
- this.#entrypointRef = new WeakRef(entrypoint);
+ this.#entrypointRef = entrypoint;
this.idx = entrypoint.idx;
this.id = entrypoint.name;
this.filename = entrypoint.name;
@@ -143,7 +143,7 @@ export class Module {
this.debug('the whole exports was overridden with %O', value);
}
get entrypoint() {
- const entrypoint = this.#entrypointRef.deref();
+ const entrypoint = this.#entrypointRef;
invariant(entrypoint, `Module ${this.idx} is disposed`);
return entrypoint;
}
diff --git a/lib/module.js b/lib/module.js
index d2f2644c2469ac7ad0dbd1b9f58099eda4084b80..b8bad9c43c35bef14c3f6a277f8c9974607b2a00 100644
--- a/lib/module.js
+++ b/lib/module.js
@@ -127,7 +127,7 @@ class Module {
this.services = services;
this.moduleImpl = moduleImpl;
this.cache = services.cache;
- this.#entrypointRef = new WeakRef(entrypoint);
+ this.#entrypointRef = entrypoint;
this.idx = entrypoint.idx;
this.id = entrypoint.name;
this.filename = entrypoint.name;
@@ -151,7 +151,7 @@ class Module {
this.debug('the whole exports was overridden with %O', value);
}
get entrypoint() {
- const entrypoint = this.#entrypointRef.deref();
+ const entrypoint = this.#entrypointRef;
(0, _tsInvariant.invariant)(entrypoint, `Module ${this.idx} is disposed`);
return entrypoint;
}
16 changes: 11 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 357c50e

Please sign in to comment.