Commit 2d52f0b
committed
Puppeteer/Playwright: collapse browser_cache_dir → single writable cache_dir
Per maintainer feedback (#33): providers should expose only
``install_root``, ``cache_dir``, and ``bin_dir`` — no duplicate
``browser_cache_dir`` field.
Refactor to match:
- Drop the separate ``browser_cache_dir`` field on both providers.
- Promote ``cache_dir`` from a computed property to a writable field
with a ``default_factory`` that hydrates from
``PUPPETEER_CACHE_DIR`` / ``PLAYWRIGHT_BROWSERS_PATH``.
- A ``@model_validator(mode="after")`` on each provider fills
``cache_dir = install_root/cache`` when ``cache_dir`` is still ``None``
but an ``install_root`` is pinned (preserving the previous default).
- Precedence at validate time:
1. explicit ``cache_dir`` kwarg wins
2. else env var (PUPPETEER_CACHE_DIR / PLAYWRIGHT_BROWSERS_PATH)
3. else ``<install_root>/cache`` when an install root is pinned
4. else ``None`` (global / OS default)
Uninstall + abspath checks:
- ``PlaywrightProvider.default_uninstall_handler`` now iterates the
resolved ``cache_dir`` (= ``PLAYWRIGHT_BROWSERS_PATH`` tree) instead
of ``install_root`` when cleaning ``<browser>-*/`` dirs.
- ``PlaywrightProvider.default_abspath_handler`` now scopes
``executablePath()`` hits to ``cache_dir.resolve()`` ancestry
instead of ``install_root`` ancestry, so an explicit
``PLAYWRIGHT_BROWSERS_PATH`` outside ``install_root`` still
satisfies ``load()``.
- ``PuppeteerProvider`` already routed all cache ops through
``self.cache_dir`` — no behaviour change there, just field cleanup.
README updated to reflect the collapsed API surface for both providers.1 parent 08ab1ae commit 2d52f0b
3 files changed
Lines changed: 48 additions & 66 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1074 | 1074 | | |
1075 | 1075 | | |
1076 | 1076 | | |
1077 | | - | |
| 1077 | + | |
1078 | 1078 | | |
1079 | 1079 | | |
1080 | 1080 | | |
1081 | | - | |
| 1081 | + | |
1082 | 1082 | | |
1083 | 1083 | | |
1084 | 1084 | | |
| |||
1097 | 1097 | | |
1098 | 1098 | | |
1099 | 1099 | | |
1100 | | - | |
| 1100 | + | |
1101 | 1101 | | |
1102 | 1102 | | |
1103 | 1103 | | |
1104 | 1104 | | |
1105 | | - | |
| 1105 | + | |
1106 | 1106 | | |
1107 | 1107 | | |
1108 | 1108 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
13 | 14 | | |
14 | 15 | | |
15 | 16 | | |
| |||
72 | 73 | | |
73 | 74 | | |
74 | 75 | | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
95 | 102 | | |
96 | 103 | | |
97 | 104 | | |
98 | | - | |
99 | | - | |
| 105 | + | |
100 | 106 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
| 107 | + | |
121 | 108 | | |
122 | 109 | | |
123 | 110 | | |
| |||
605 | 592 | | |
606 | 593 | | |
607 | 594 | | |
608 | | - | |
609 | | - | |
610 | | - | |
611 | | - | |
612 | | - | |
613 | | - | |
614 | | - | |
615 | | - | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
616 | 604 | | |
617 | 605 | | |
618 | 606 | | |
| |||
763 | 751 | | |
764 | 752 | | |
765 | 753 | | |
766 | | - | |
767 | | - | |
768 | | - | |
769 | | - | |
770 | | - | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
771 | 761 | | |
772 | 762 | | |
773 | 763 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
75 | 77 | | |
76 | 78 | | |
77 | 79 | | |
| |||
89 | 91 | | |
90 | 92 | | |
91 | 93 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | 94 | | |
105 | 95 | | |
106 | 96 | | |
107 | 97 | | |
| 98 | + | |
| 99 | + | |
108 | 100 | | |
109 | 101 | | |
110 | 102 | | |
| |||
0 commit comments