diff --git a/.changeset/famous-pens-cheer.md b/.changeset/famous-pens-cheer.md new file mode 100644 index 000000000000..39468c01e265 --- /dev/null +++ b/.changeset/famous-pens-cheer.md @@ -0,0 +1,5 @@ +--- +'@astrojs/lit': patch +--- + +Patch Lit's server shim to allow for `sass` compatability diff --git a/packages/integrations/lit/package.json b/packages/integrations/lit/package.json index 6f6bbdb70474..730a1bd41759 100644 --- a/packages/integrations/lit/package.json +++ b/packages/integrations/lit/package.json @@ -37,7 +37,8 @@ "devDependencies": { "astro": "workspace:*", "astro-scripts": "workspace:*", - "cheerio": "^1.0.0-rc.11" + "cheerio": "^1.0.0-rc.11", + "sass": "^1.52.1" }, "peerDependencies": { "@webcomponents/template-shadowroot": "^0.1.0", diff --git a/packages/integrations/lit/server-shim.js b/packages/integrations/lit/server-shim.js index 0546795920bc..0c1fde3837b8 100644 --- a/packages/integrations/lit/server-shim.js +++ b/packages/integrations/lit/server-shim.js @@ -3,3 +3,5 @@ installWindowOnGlobal(); window.global = window; document.getElementsByTagName = () => []; +// See https://github.com/lit/lit/issues/2393 +document.currentScript = null; diff --git a/packages/integrations/lit/test/sass.test.js b/packages/integrations/lit/test/sass.test.js new file mode 100644 index 000000000000..9bc039db6c5b --- /dev/null +++ b/packages/integrations/lit/test/sass.test.js @@ -0,0 +1,14 @@ +import { expect } from 'chai'; + +describe('check', () => { + it('should be able to load sass', async () => { + let error = null; + try { + await import(new URL('../server-shim.js', import.meta.url)); + await import('sass'); + } catch (e) { + error = e; + } + expect(error).to.be.null; + }); +}); diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0bc8e4ca6edf..6a0d18c6c085 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1665,12 +1665,14 @@ importers: astro: workspace:* astro-scripts: workspace:* cheerio: ^1.0.0-rc.11 + sass: ^1.52.1 dependencies: '@lit-labs/ssr': 2.2.0 devDependencies: astro: link:../../astro astro-scripts: link:../../../scripts cheerio: 1.0.0-rc.11 + sass: 1.52.1 packages/integrations/netlify: specifiers: @@ -8059,6 +8061,11 @@ packages: /debug/3.2.7: resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true dependencies: ms: 2.1.3 dev: false @@ -10990,6 +10997,8 @@ packages: debug: 3.2.7 iconv-lite: 0.4.24 sax: 1.2.4 + transitivePeerDependencies: + - supports-color dev: false /netmask/2.0.2: @@ -11073,6 +11082,8 @@ packages: rimraf: 2.7.1 semver: 5.7.1 tar: 4.4.19 + transitivePeerDependencies: + - supports-color dev: false /node-releases/2.0.5: