diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..e86e2d4fca
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}{bar}{baz}{foo}{bar}{baz}{foo}{bar}{baz}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-at-end/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/expected.html
new file mode 100644
index 0000000000..f821309f78
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/expected.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..798c29b64d
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}{bar}{baz}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/comments-then-element/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/expected.html
new file mode 100644
index 0000000000..dcc1ec185d
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/expected.html
@@ -0,0 +1,7 @@
+
+
+
+ abc
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..a6fdb72f8b
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/modules/x/comments-text/comments-text.html
@@ -0,0 +1,9 @@
+
+
+ a
+
+ b
+
+ c
+
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..1973a6ccec
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep/modules/x/comments-text/comments-text.js
@@ -0,0 +1,5 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ isTrue = true;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/expected.html
new file mode 100644
index 0000000000..841e1096c3
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/expected.html
@@ -0,0 +1,9 @@
+
+
+ ab
+
+ c
+
+ de
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..aded417865
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/modules/x/comments-text/comments-text.html
@@ -0,0 +1,9 @@
+
+ a
+
+ b
+ c
+ d
+
+ e
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..1973a6ccec
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/deep2/modules/x/comments-text/comments-text.js
@@ -0,0 +1,5 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ isTrue = true;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..023262ffb3
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}{bar}{baz}{foo}{bar}{baz}{foo}{bar}{baz}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..44bf0aff54
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/emptier/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '';
+ bar = undefined;
+ baz = null;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/empty/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..44bf0aff54
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '';
+ bar = undefined;
+ baz = null;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty1/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty1/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/expected.html
new file mode 100644
index 0000000000..0e6e634163
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/expected.html
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty2/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty2/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/expected.html
new file mode 100644
index 0000000000..0e6e634163
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/expected.html
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/empty3/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/empty3/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/expected.html
new file mode 100644
index 0000000000..84f3b7dd97
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/expected.html
@@ -0,0 +1,7 @@
+
+
+
+ −
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..189c0ff634
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..7094659b1c
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping-single/modules/x/comments-text/comments-text.js
@@ -0,0 +1,5 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '−';
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/expected.html
new file mode 100644
index 0000000000..84f3b7dd97
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/expected.html
@@ -0,0 +1,7 @@
+
+
+
+ −
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..a6255ede18
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/html-escaping/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '&';
+ bar = 'minus';
+ baz = ';';
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/error.txt
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/error.txt
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/error.txt
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/expected.html
new file mode 100644
index 0000000000..9b9b476fdb
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/expected.html
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/index.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/index.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/index.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..e96d3f1bf9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..ca8dce94e0
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/just-comments/modules/x/comments-text/comments-text.js
@@ -0,0 +1,3 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..5a0774ecfd
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}{bar}{baz}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty-dynamic/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-dynamic/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/expected.html
new file mode 100644
index 0000000000..2996fd08ab
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/expected.html
@@ -0,0 +1,7 @@
+
+
+
+ totoyolototoyolo
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..812db11ed2
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ toto{foo}yolo{bar}toto{baz}yolo
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..44bf0aff54
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty-literals-outside/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '';
+ bar = undefined;
+ baz = null;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/nonempty/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..44bf0aff54
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '';
+ bar = undefined;
+ baz = null;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty1/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty1/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty2/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty2/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/nonempty3/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/nonempty3/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/expected.html
new file mode 100644
index 0000000000..0e6e634163
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/expected.html
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..da33aa2cbf
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}{bar}{baz}{foo}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..44bf0aff54
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-off/text-comment-text-comment/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '';
+ bar = undefined;
+ baz = null;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/expected.html
new file mode 100644
index 0000000000..f3d70401af
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/expected.html
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..72c2e48281
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}{bar}{baz}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..44bf0aff54
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/comments-then-element/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '';
+ bar = undefined;
+ baz = null;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/expected.html
new file mode 100644
index 0000000000..0b67b66ca9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/expected.html
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..98cd0cde7b
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}{bar}{baz}{foo}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..44bf0aff54
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier-with-text-comment-text/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '';
+ bar = undefined;
+ baz = null;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/expected.html
new file mode 100644
index 0000000000..b4d5bbd885
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/expected.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..6faada2d46
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+ {foo}{bar}{baz}{foo}{bar}{baz}{foo}{bar}{baz}
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..44bf0aff54
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/emptier/modules/x/comments-text/comments-text.js
@@ -0,0 +1,7 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {
+ foo = '';
+ bar = undefined;
+ baz = null;
+}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/expected.html
new file mode 100644
index 0000000000..8958106119
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/expected.html
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/modules/x/comments-text/comments-text.html
new file mode 100644
index 0000000000..285aa302d5
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/modules/x/comments-text/comments-text.html
@@ -0,0 +1,3 @@
+
+
+
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/modules/x/comments-text/comments-text.js
new file mode 100644
index 0000000000..ca8dce94e0
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/just-comments/modules/x/comments-text/comments-text.js
@@ -0,0 +1,3 @@
+import { LightningElement } from 'lwc';
+
+export default class extends LightningElement {}
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments2/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments2/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/error.txt b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/error.txt
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/expected.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/expected.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/expected.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/expected.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/index.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/index.js
new file mode 100644
index 0000000000..4bd94488e9
--- /dev/null
+++ b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/index.js
@@ -0,0 +1,3 @@
+export const tagName = 'x-comments-text';
+export { default } from 'x/comments-text';
+export * from 'x/comments-text';
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/modules/x/comments-text/comments-text.html b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/modules/x/comments-text/comments-text.html
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/modules/x/comments-text/comments-text.html
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/modules/x/comments-text/comments-text.html
diff --git a/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/modules/x/comments-text/comments-text.js b/packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/modules/x/comments-text/comments-text.js
similarity index 100%
rename from packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/with-comments/preserve-comments3/modules/x/comments-text/comments-text.js
rename to packages/@lwc/engine-server/src/__tests__/fixtures/adjacent-text-nodes/preserve-comments-on/preserve-comments3/modules/x/comments-text/comments-text.js
diff --git a/packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts b/packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts
index d847cc1f21..97b5f1d186 100644
--- a/packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts
+++ b/packages/@lwc/ssr-compiler/src/__tests__/utils/expected-failures.ts
@@ -8,11 +8,7 @@
// We should slowly drive down these test failures or at least document where we expect the failures
// TODO [#4815]: enable all SSR v2 tests
export const expectedFailures = new Set([
- 'adjacent-text-nodes/empty/index.js',
- 'adjacent-text-nodes/with-comments/empty1/index.js',
- 'adjacent-text-nodes/with-comments/empty2/index.js',
- 'adjacent-text-nodes/with-comments/empty3/index.js',
- 'adjacent-text-nodes/with-comments/preserve-comments2/index.js',
+ 'adjacent-text-nodes/preserve-comments-off/deep2/index.js',
'attribute-aria/dynamic/index.js',
'attribute-class/with-scoped-styles-only-in-child/dynamic/index.js',
'attribute-class/with-scoped-styles/dynamic/index.js',
@@ -34,6 +30,7 @@ export const expectedFailures = new Set([
'scoped-slots/mixed-with-light-dom-slots-inside/index.js',
'scoped-slots/mixed-with-light-dom-slots-outside/index.js',
'slot-forwarding/scoped-slots/index.js',
+ 'slot-not-at-top-level/advanced/ifTrue/light/index.js',
'slot-not-at-top-level/advanced/ifTrue/shadow/index.js',
'slot-not-at-top-level/advanced/lwcIf/light/index.js',
'slot-not-at-top-level/advanced/lwcIf/shadow/index.js',
diff --git a/packages/@lwc/ssr-compiler/src/compile-template/adjacent-text-nodes.ts b/packages/@lwc/ssr-compiler/src/compile-template/adjacent-text-nodes.ts
new file mode 100644
index 0000000000..50132c8974
--- /dev/null
+++ b/packages/@lwc/ssr-compiler/src/compile-template/adjacent-text-nodes.ts
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2024, Salesforce, Inc.
+ * All rights reserved.
+ * SPDX-License-Identifier: MIT
+ * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT
+ */
+import { esTemplateWithYield } from '../estemplate';
+import type { IfStatement as EsIfStatement } from 'estree';
+import type { TransformerContext } from './types';
+import type { Node as IrNode } from '@lwc/template-compiler';
+
+/**
+ * True if this is one of a series of text content nodes and/or comment node that are adjacent to one another as
+ * siblings. (Comment nodes are ignored when preserve-comments is turned off.) This allows for adjacent text
+ * node concatenation.
+ */
+const isConcatenatedNode = (node: IrNode, cxt: TransformerContext) => {
+ switch (node.type) {
+ case 'Text':
+ return true;
+ case 'Comment':
+ return !cxt.templateOptions.preserveComments;
+ default:
+ return false;
+ }
+};
+
+export const isLastConcatenatedNode = (cxt: TransformerContext) => {
+ const { nextSibling } = cxt;
+ if (!nextSibling) {
+ // we are the last sibling
+ return true;
+ }
+ return !isConcatenatedNode(nextSibling, cxt);
+};
+
+export const bYieldTextContent = esTemplateWithYield`
+ if (didBufferTextContent) {
+ // We are at the end of a series of text nodes - flush to a concatenated string
+ // We only render the ZWJ if there were actually any dynamic text nodes rendered
+ // The ZWJ is just so hydration can compare the SSR'd dynamic text content against
+ // the CSR'd text content.
+ yield textContentBuffer === '' ? '\u200D' : htmlEscape(textContentBuffer);
+ // Reset
+ textContentBuffer = '';
+ didBufferTextContent = false;
+ }
+`;
diff --git a/packages/@lwc/ssr-compiler/src/compile-template/index.ts b/packages/@lwc/ssr-compiler/src/compile-template/index.ts
index 5a1448be35..2af47535ac 100644
--- a/packages/@lwc/ssr-compiler/src/compile-template/index.ts
+++ b/packages/@lwc/ssr-compiler/src/compile-template/index.ts
@@ -28,6 +28,11 @@ const bExportTemplate = esTemplate`
Cmp,
instance
) {
+ // Deliberately using let so we can mutate as many times as we want in the same scope.
+ // These should be scoped to the "tmpl" function however, to avoid conflicts with other templates.
+ let textContentBuffer = '';
+ let didBufferTextContent = false;
+
const isLightDom = Cmp.renderMode === 'light';
if (!isLightDom) {
yield \`\`
diff --git a/packages/@lwc/ssr-compiler/src/compile-template/shared.ts b/packages/@lwc/ssr-compiler/src/compile-template/shared.ts
index 32d36e0a3e..ed21898c47 100644
--- a/packages/@lwc/ssr-compiler/src/compile-template/shared.ts
+++ b/packages/@lwc/ssr-compiler/src/compile-template/shared.ts
@@ -12,17 +12,17 @@ import { isValidES3Identifier } from '@babel/types';
import { expressionIrToEs } from './expression';
import type { TransformerContext } from './types';
import type {
- Node as IrNode,
Attribute as IrAttribute,
+ Node as IrNode,
Property as IrProperty,
} from '@lwc/template-compiler';
import type {
- Statement as EsStatement,
Expression as EsExpression,
- MemberExpression as EsMemberExpression,
Identifier as EsIdentifier,
+ MemberExpression as EsMemberExpression,
ObjectExpression as EsObjectExpression,
Property as EsProperty,
+ Statement as EsStatement,
} from 'estree';
export function optimizeAdjacentYieldStmts(statements: EsStatement[]): EsStatement[] {
diff --git a/packages/@lwc/ssr-compiler/src/compile-template/transformers/comment.ts b/packages/@lwc/ssr-compiler/src/compile-template/transformers/comment.ts
index 1e85d4fd43..702aacd07c 100644
--- a/packages/@lwc/ssr-compiler/src/compile-template/transformers/comment.ts
+++ b/packages/@lwc/ssr-compiler/src/compile-template/transformers/comment.ts
@@ -7,6 +7,7 @@
import { builders as b } from 'estree-toolkit';
+import { bYieldTextContent, isLastConcatenatedNode } from '../adjacent-text-nodes';
import type { Comment as IrComment } from '@lwc/template-compiler';
import type { Transformer } from '../types';
@@ -14,6 +15,13 @@ export const Comment: Transformer = function Comment(node, cxt) {
if (cxt.templateOptions.preserveComments) {
return [b.expressionStatement(b.yieldExpression(b.literal(``)))];
} else {
- return [];
+ cxt.import('htmlEscape');
+
+ const isLastInSeries = isLastConcatenatedNode(cxt);
+
+ // If preserve comments is off, we check if we should flush text content
+ // for adjacent text nodes. (If preserve comments is on, then the previous
+ // text node already flushed.)
+ return [...(isLastInSeries ? [bYieldTextContent()] : [])];
}
};
diff --git a/packages/@lwc/ssr-compiler/src/compile-template/transformers/text.ts b/packages/@lwc/ssr-compiler/src/compile-template/transformers/text.ts
index a1782e584f..baa7a01afc 100644
--- a/packages/@lwc/ssr-compiler/src/compile-template/transformers/text.ts
+++ b/packages/@lwc/ssr-compiler/src/compile-template/transformers/text.ts
@@ -9,58 +9,38 @@ import { builders as b, is } from 'estree-toolkit';
import { esTemplateWithYield } from '../../estemplate';
import { expressionIrToEs } from '../expression';
-import type {
- Expression as EsExpression,
- Statement as EsStatement,
- BlockStatement as EsBlockStatement,
-} from 'estree';
+import { bYieldTextContent, isLastConcatenatedNode } from '../adjacent-text-nodes';
+import type { Statement as EsStatement } from 'estree';
import type {
ComplexExpression as IrComplexExpression,
Expression as IrExpression,
Literal as IrLiteral,
Text as IrText,
- Node as IrNode,
} from '@lwc/template-compiler';
import type { Transformer } from '../types';
-const bYield = (expr: EsExpression) => b.expressionStatement(b.yieldExpression(expr));
-
-const bYieldEscapedString = esTemplateWithYield`
- {
+const bBufferTextContent = esTemplateWithYield`
+ didBufferTextContent = true;
+ {
const value = ${/* string value */ is.expression};
// Using non strict equality to align with original implementation (ex. undefined == null)
// See: https://github.com/salesforce/lwc/blob/348130f/packages/%40lwc/engine-core/src/framework/api.ts#L548
- const massagedValue = value == null ? '' : String(value);
- yield ${/* is isolated text node? */ is.literal} && massagedValue === '' ? '\\u200D' : htmlEscape(massagedValue);
+ textContentBuffer += value == null ? '' : String(value);
}
-`;
+`;
function isLiteral(node: IrLiteral | IrExpression | IrComplexExpression): node is IrLiteral {
return node.type === 'Literal';
}
export const Text: Transformer = function Text(node, cxt): EsStatement[] {
- if (isLiteral(node.value)) {
- return [bYield(b.literal(node.value.value))];
- }
-
- const shouldIsolate = (node?: IrNode) => {
- switch (node?.type) {
- case 'Text':
- return false;
- case 'Comment':
- return cxt.templateOptions.preserveComments;
- default:
- return true;
- }
- };
+ cxt.import('htmlEscape');
- const isIsolatedTextNode = b.literal(
- shouldIsolate(cxt.prevSibling) && shouldIsolate(cxt.nextSibling)
- );
+ const isLastInSeries = isLastConcatenatedNode(cxt);
- const valueToYield = expressionIrToEs(node.value, cxt);
+ const valueToYield = isLiteral(node.value)
+ ? b.literal(node.value.value)
+ : expressionIrToEs(node.value, cxt);
- cxt.import('htmlEscape');
- return [bYieldEscapedString(valueToYield, isIsolatedTextNode)];
+ return [...bBufferTextContent(valueToYield), ...(isLastInSeries ? [bYieldTextContent()] : [])];
};
diff --git a/packages/@lwc/ssr-runtime/src/index.ts b/packages/@lwc/ssr-runtime/src/index.ts
index bec88d354e..ef329a2097 100644
--- a/packages/@lwc/ssr-runtime/src/index.ts
+++ b/packages/@lwc/ssr-runtime/src/index.ts
@@ -11,6 +11,7 @@ export * from './stubs';
export { htmlEscape, setHooks, sanitizeHtmlContent, normalizeClass } from '@lwc/shared';
export { ClassList } from './class-list';
+export { getReadOnlyProxy } from './get-read-only-proxy';
export {
LightningElement,
LightningElementConstructor,
@@ -33,5 +34,4 @@ export {
export { hasScopedStaticStylesheets, renderStylesheets } from './styles';
export { toIteratorDirective } from './to-iterator-directive';
export { validateStyleTextContents } from './validate-style-text-contents';
-export { getReadOnlyProxy } from './get-read-only-proxy';
export { createContextProvider, establishContextfulRelationship, connectContext } from './wire';