Skip to content

Commit

Permalink
feat(engine): remove global dom shim workaround
Browse files Browse the repository at this point in the history
  • Loading branch information
daKmoR committed Aug 13, 2022
1 parent 50bb68a commit 379f08f
Show file tree
Hide file tree
Showing 19 changed files with 41 additions and 52 deletions.
6 changes: 6 additions & 0 deletions .changeset/funny-seals-run.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@rocket/engine': patch
---

Remove the lit workaround to globally load the `global-dom-shim` in the "main thread".
Which means only the worker that does the actual SSR rendering will load it.
2 changes: 1 addition & 1 deletion examples/01-hydration-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"@rocket/cli": "^0.20.0",
"@rocket/engine": "^0.2.0",
"@webcomponents/template-shadowroot": "^0.1.0",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"@rocket/template-name": "Hydration Starter",
"imports": {
Expand Down
2 changes: 1 addition & 1 deletion examples/02-blog-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"devDependencies": {
"@rocket/cli": "^0.20.0",
"@rocket/engine": "^0.2.0",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"@rocket/template-name": "Blog Starter"
}
2 changes: 1 addition & 1 deletion examples/03-minimal-starter/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"devDependencies": {
"@rocket/cli": "^0.20.0",
"@rocket/engine": "^0.2.0",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"@rocket/template-name": "Minimal Starter"
}
2 changes: 1 addition & 1 deletion examples/04-sanity-minimal-starter/frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"@sanity/client": "^3.1.0",
"@sanity/image-url": "^1.0.1",
"dotenv": "^16.0.0",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"@rocket/template-name": "Sanity Minimal Starter"
}
2 changes: 1 addition & 1 deletion examples/50-landing-theme-spark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.0",
"@rocket/spark": "^0.2.0",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"@rocket/template-name": "Landing Page (@rocket/spark Theme)",
"imports": {
Expand Down
2 changes: 1 addition & 1 deletion examples/51-docs-theme-launch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"@rocket/engine": "^0.2.0",
"@rocket/launch": "^0.21.0",
"@rocket/search": "^0.7.0",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"@rocket/template-name": "Documentation Website (@rocket/launch Theme)",
"imports": {
Expand Down
2 changes: 1 addition & 1 deletion packages/components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"dependencies": {
"@webcomponents/template-shadowroot": "^0.1.0",
"fontawesome-free": "^1.0.4",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"devDependencies": {},
"types": "./dist-types/exports/index.d.ts",
Expand Down
6 changes: 3 additions & 3 deletions packages/engine/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"scripts": {
"debug": "DEBUG=engine:rendering yarn test",
"debug:integration": "PWDEBUG=1 yarn test:integration",
"test": "mocha --require ../../scripts/testMochaGlobalHooks.js --timeout 5000 test-node/**/*.test.js test-node/*.test.js",
"test": "mocha --require ../../scripts/testMochaGlobalHooks.js --timeout 8000 test-node/**/*.test.js test-node/*.test.js",
"test:integration": "playwright test test-node/*.spec.js",
"test:watch": "onchange 'src/**/*.js' 'test-node/**/*.js' -- npm test",
"types:copy": "copyfiles \"./types/**/*.d.ts\" dist-types/"
Expand All @@ -47,12 +47,12 @@
],
"dependencies": {
"@d4kmor/tree-model": "^0.1.3",
"@lit-labs/ssr": "^2.0.4",
"@lit-labs/ssr": "^2.2.3",
"@mdjs/core": "^0.20.0",
"@parcel/watcher": "^2.0.5",
"@web/dev-server": "^0.1.4",
"es-module-lexer": "^0.10.5",
"lit": "^2.2.5",
"lit": "^2.3.0",
"plugins-manager": "^0.3.0",
"sax-wasm": "^2.1.3",
"unist-util-visit": "^4.1.0"
Expand Down
4 changes: 0 additions & 4 deletions packages/engine/src/formats/markdown.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// we need to load the global-dom-shim as otherwise import { html } from 'lit'; breaks
// https://github.com/lit/lit/issues/2524
import '@lit-labs/ssr/lib/install-global-dom-shim.js';

/* eslint-disable @typescript-eslint/ban-ts-comment */
// @ts-ignore
import { mdjsProcess } from '@mdjs/core';
Expand Down
4 changes: 0 additions & 4 deletions packages/engine/src/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// we need to load the global-dom-shim as otherwise import { html } from 'lit'; breaks
// https://github.com/lit/lit/issues/2524
import '@lit-labs/ssr/lib/install-global-dom-shim.js';

export { renderJoiningGroup } from './helpers/renderJoiningGroup.js';
export { inlineFile } from './helpers/inlineFile.js';

Expand Down
4 changes: 0 additions & 4 deletions packages/engine/src/worker/importWorker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// we need to load the global-dom-shim as otherwise import { html } from 'lit'; breaks
// https://github.com/lit/lit/issues/2524
import '@lit-labs/ssr/lib/install-global-dom-shim.js';

import { parentPort } from 'worker_threads';
// import { convertMdFile, convertHtmlFile } from '../converts.js';

Expand Down
4 changes: 0 additions & 4 deletions packages/engine/src/worker/renderWorker.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
// we need to load the global-dom-shim as otherwise import { html } from 'lit'; breaks
// https://github.com/lit/lit/issues/2524
import '@lit-labs/ssr/lib/install-global-dom-shim.js';

import path from 'path';
import { parentPort } from 'worker_threads';
import { mkdir, writeFile } from 'fs/promises';
Expand Down
1 change: 0 additions & 1 deletion packages/engine/test-node/04a-renderJoiningGroup.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import chai from 'chai';
// import '@lit-labs/ssr/lib/install-global-dom-shim.js';
import { html } from 'lit';
import { renderJoiningGroup } from '../src/helpers/renderJoiningGroup.js';
import { testLitServerRender } from './test-helpers.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/launch/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.0",
"@webcomponents/template-shadowroot": "^0.1.0",
"lit": "^2.2.5",
"lit": "^2.3.0",
"workbox-window": "^6.1.5"
},
"types": "./dist-types/src/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/mdjs-preview/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"dependencies": {
"@lion/accordion": "^0.9.0",
"@open-wc/scoped-elements": "^2.0.0",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"types": "dist-types/index.d.ts"
}
2 changes: 1 addition & 1 deletion packages/mdjs-story/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"src"
],
"dependencies": {
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"types": "dist-types/index.d.ts"
}
2 changes: 1 addition & 1 deletion presets/spark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
"dependencies": {
"@rocket/components": "^0.2.0",
"@rocket/engine": "^0.2.0",
"lit": "^2.2.5"
"lit": "^2.3.0"
},
"devDependencies": {},
"types": "./dist-types/src/index.d.ts",
Expand Down
42 changes: 21 additions & 21 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1266,25 +1266,25 @@
lit "^2.0.0"
lit-html "^2.0.0"

"@lit-labs/ssr@^2.0.4":
version "2.2.2"
resolved "https://registry.yarnpkg.com/@lit-labs/ssr/-/ssr-2.2.2.tgz#545ce760d4f3d50459221f56e516ad1c0bf5d1cd"
integrity sha512-pWyZurpOeOxueS5EXdWkZTM9fBEHfR70WJ3dAn4oE4iWRLpt6mwx9GvUWQF0oKHqi0tQP/WjfTRf+nafWWSTfw==
"@lit-labs/ssr@^2.2.3":
version "2.2.3"
resolved "https://registry.yarnpkg.com/@lit-labs/ssr/-/ssr-2.2.3.tgz#8f9cc343ebf531dd670136d342562bee33ce9be0"
integrity sha512-QOHZGR5a6znwqa8wM5hpMdlfO/fXUh0LYV39b16TEGtnszhGlKECx4+w9RiBuwOj/Qb5/SHGKpr81APRevWGeg==
dependencies:
"@lit-labs/ssr-client" "^1.0.0"
"@lit/reactive-element" "^1.1.0"
"@lit/reactive-element" "^1.4.0"
"@types/node" "^16.0.0"
lit "^2.1.0"
lit "^2.3.0"
lit-element "^3.1.0"
lit-html "^2.1.0"
lit-html "^2.3.0"
node-fetch "^3.2.8"
parse5 "^6.0.1"
resolve "^1.10.1"

"@lit/reactive-element@^1.0.0", "@lit/reactive-element@^1.1.0", "@lit/reactive-element@^1.3.0":
version "1.3.4"
resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.3.4.tgz#c4492a54387f7b1020d498a348403229583d1c06"
integrity sha512-I1wz4uxOA52zSBhKmv4KQWLJpCyvfpnDg+eQR6mjpRgV+Ldi14HLPpSUpJklZRldz0fFmGCC/kVmuc/3cPFqCg==
"@lit/reactive-element@^1.0.0", "@lit/reactive-element@^1.3.0", "@lit/reactive-element@^1.4.0":
version "1.4.0"
resolved "https://registry.yarnpkg.com/@lit/reactive-element/-/reactive-element-1.4.0.tgz#78ed05eb9b750e8e3671a61a30c19198e4038f80"
integrity sha512-blrtlLKvtVyjTJ3gUHWNSHOU6tD8be9mRafqtnO7GVMcB+5z4RjNcO0DpMGmccK6N8yur1vVVYnS0gPdQ/WgEQ==

"@manypkg/find-root@^1.1.0":
version "1.1.0"
Expand Down Expand Up @@ -5148,21 +5148,21 @@ lit-html@^1.1.1:
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-1.4.1.tgz#0c6f3ee4ad4eb610a49831787f0478ad8e9ae5e0"
integrity sha512-B9btcSgPYb1q4oSOb/PrOT6Z/H+r6xuNzfH4lFli/AWhYwdtrgQkQWBbIc6mdnf6E2IL3gDXdkkqNktpU0OZQA==

lit-html@^2.0.0, lit-html@^2.1.0, lit-html@^2.2.0:
version "2.2.7"
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.2.7.tgz#390a45589f55b95106da1f860b6aa2894ab34373"
integrity sha512-JhqiAwO1l03kRe68uBZ0i2x4ef2S5szY9vvP411nlrFZIpKK4/hwnhA/15bqbvxe1lV3ipBdhaOzHmyOk7QIRg==
lit-html@^2.0.0, lit-html@^2.2.0, lit-html@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/lit-html/-/lit-html-2.3.0.tgz#6896685744f0b1ddef0d39aa2092fcd06dfd169d"
integrity sha512-bnJneRqizoeSTxUeyDJLBDr+DI+7bn6P3WWqsj/4AwPWJjYgjSO5W64BVl1CrEo/8DtgU6DAYADX6yeI5/eDsg==
dependencies:
"@types/trusted-types" "^2.0.2"

lit@^2.0.0, lit@^2.0.2, lit@^2.1.0, lit@^2.2.5:
version "2.2.8"
resolved "https://registry.yarnpkg.com/lit/-/lit-2.2.8.tgz#26bdf560042aa3ec9b788f5d48119f7138b2dcc1"
integrity sha512-QjeNbi/H9LVIHR+u0OqsL+hs62a16m02JlJHYN48HcBuXyiPYR8JvzsTp5dYYS81l+b9Emp3UaGo82EheV0pog==
lit@^2.0.0, lit@^2.0.2, lit@^2.3.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/lit/-/lit-2.3.0.tgz#611e122cbf9f34f1af0c1f3f791f886453bdcbde"
integrity sha512-ynSGsUYKSGN2weFQ1F3SZq0Ihlj+vr/3KAET//Yf8Tz86L7lZizlw9Px+ab5iN8Si4RkVoLqd9YtKQmjdyKHNg==
dependencies:
"@lit/reactive-element" "^1.3.0"
"@lit/reactive-element" "^1.4.0"
lit-element "^3.2.0"
lit-html "^2.2.0"
lit-html "^2.3.0"

load-json-file@^4.0.0:
version "4.0.0"
Expand Down

0 comments on commit 379f08f

Please sign in to comment.