diff options
author | 2024-08-19 08:12:33 -0400 | |
---|---|---|
committer | 2024-08-19 08:12:33 -0400 | |
commit | 3822e574aa1d779020983a2d9815b3974a9d911a (patch) | |
tree | e73bc12683498256f3a27c3d57033427f0eff71a /packages/integrations/lit/server-shim.js | |
parent | 7ffcae19064a8c912a7d5e8c943952923d20edc5 (diff) | |
download | astro-3822e574aa1d779020983a2d9815b3974a9d911a.tar.gz astro-3822e574aa1d779020983a2d9815b3974a9d911a.tar.zst astro-3822e574aa1d779020983a2d9815b3974a9d911a.zip |
Remove @astrojs/lit (#11680)
* Remove @astrojs/lit
This removes the Lit integration as an official integration. The reasons
for doing so in 5.0:
- Only 1% of Astro users use this integration.
- SSR support in Lit is at a lower-level of support due to be a Labs
project: https://lit.dev/docs/libraries/labs/, and has been in this
state since we added support a couple of years ago.
- The maintenance cost of fixing bugs in this integration is too high
given the low usage. Some PRs for upgrading Lit versions have taken
quite a long time. We can't justify the core team being responsible for
this going forward.
- There used to be community contributions to fix bugs but this has
fallen off for various reasons.
Given that, this PR removes the integration as one that is officially
supported by the Astro core team. Interested community members are
encouraged to fork the integration and continue the development in
another repository.
* Remove e2e tests and examples
* Update lockfile
* Remove ssr-lit.test.js
* Remove error for no client entrypoint
* Remove auto selection of the Lit renderer
* Remove lit package.json
* Remove lit fixture
Diffstat (limited to 'packages/integrations/lit/server-shim.js')
-rw-r--r-- | packages/integrations/lit/server-shim.js | 35 |
1 files changed, 0 insertions, 35 deletions
diff --git a/packages/integrations/lit/server-shim.js b/packages/integrations/lit/server-shim.js deleted file mode 100644 index d777382f2..000000000 --- a/packages/integrations/lit/server-shim.js +++ /dev/null @@ -1,35 +0,0 @@ -import { customElements as litCE, HTMLElement as litShimHTMLElement } from '@lit-labs/ssr-dom-shim'; - -// Something at build time injects document.currentScript = undefined instead of -// document.currentScript = null. This causes Sass build to fail because it -// seems to be expecting `=== null`. This set to `undefined` doesn't seem to be -// caused by Lit and only happens at build / test time, but not in dev or -// preview time. -if (globalThis.document) { - document.currentScript = null; -} - -if (globalThis.HTMLElement) { - // Seems Astro's Element shim does nothing when `.setAttribute` is called - // and subsequently `.getAttribute` is called. Causes Lit to not SSR attrs - globalThis.HTMLElement = litShimHTMLElement; -} - -// Astro seems to have a DOM shim and the only real difference that we need out -// of the Lit DOM shim is that the Lit DOM shim reads -// `HTMLElement.observedAttributes` which is meant to trigger -// `ReactiveElement.finalize()`. So this is the only thing we will re-shim since -// Lit will try to respect other global DOM shims. -globalThis.customElements = litCE; - -const litCeDefine = customElements.define; - -// We need to patch customElements.define to keep track of the tagName on the -// class itself so that we can transform JSX custom element class definition to -// a DSD string on the server, because there is no way to get the tagName from a -// CE class otherwise. Not an issue on client:only because the browser supports -// appending a class instance directly to the DOM. -customElements.define = function (tagName, Ctr) { - Ctr[Symbol.for('tagName')] = tagName; - return litCeDefine.call(this, tagName, Ctr); -}; |