Skip to content

Commit

Permalink
fix(template-compiler): fix static part comments and release 5.0.6 (#…
Browse files Browse the repository at this point in the history
…3936)

Co-authored-by: James Tu <jmsjtu@gmail.com>
Co-authored-by: Eugene Kashida <ekashida@gmail.com>
Co-authored-by: Ravi Jayaramappa <ravi.jayaramappa@salesforce.com>
  • Loading branch information
4 people committed Jan 10, 2024
1 parent a7e0b54 commit ab701e5
Show file tree
Hide file tree
Showing 36 changed files with 917 additions and 78 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lwc-monorepo",
"version": "5.0.5",
"version": "5.0.6",
"private": true,
"description": "Lightning Web Components",
"repository": {
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/aria-reflection/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/aria-reflection",
"version": "5.0.5",
"version": "5.0.6",
"description": "ARIA element reflection polyfill for strings",
"keywords": [
"aom",
Expand Down
6 changes: 3 additions & 3 deletions packages/@lwc/babel-plugin-component/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/babel-plugin-component",
"version": "5.0.5",
"version": "5.0.6",
"description": "Babel plugin to transform a LWC module",
"keywords": [
"lwc"
Expand Down Expand Up @@ -43,8 +43,8 @@
},
"dependencies": {
"@babel/helper-module-imports": "7.22.15",
"@lwc/errors": "5.0.5",
"@lwc/shared": "5.0.5",
"@lwc/errors": "5.0.6",
"@lwc/shared": "5.0.6",
"line-column": "~1.0.2"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions packages/@lwc/compiler/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/compiler",
"version": "5.0.5",
"version": "5.0.6",
"description": "LWC compiler",
"keywords": [
"lwc"
Expand Down Expand Up @@ -48,10 +48,10 @@
"@babel/plugin-proposal-object-rest-spread": "7.20.7",
"@babel/plugin-transform-async-to-generator": "7.23.3",
"@locker/babel-plugin-transform-unforgeables": "0.20.0",
"@lwc/babel-plugin-component": "5.0.5",
"@lwc/errors": "5.0.5",
"@lwc/shared": "5.0.5",
"@lwc/style-compiler": "5.0.5",
"@lwc/template-compiler": "5.0.5"
"@lwc/babel-plugin-component": "5.0.6",
"@lwc/errors": "5.0.6",
"@lwc/shared": "5.0.6",
"@lwc/style-compiler": "5.0.6",
"@lwc/template-compiler": "5.0.6"
}
}
6 changes: 3 additions & 3 deletions packages/@lwc/engine-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/engine-core",
"version": "5.0.5",
"version": "5.0.6",
"description": "Core LWC engine APIs.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -42,8 +42,8 @@
}
},
"dependencies": {
"@lwc/features": "5.0.5",
"@lwc/shared": "5.0.5"
"@lwc/features": "5.0.6",
"@lwc/shared": "5.0.6"
},
"devDependencies": {
"observable-membrane": "2.0.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/@lwc/engine-dom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/engine-dom",
"version": "5.0.5",
"version": "5.0.6",
"description": "Renders LWC components in a DOM environment.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -42,8 +42,8 @@
}
},
"devDependencies": {
"@lwc/engine-core": "5.0.5",
"@lwc/shared": "5.0.5"
"@lwc/engine-core": "5.0.6",
"@lwc/shared": "5.0.6"
},
"lwc": {
"modules": [
Expand Down
8 changes: 4 additions & 4 deletions packages/@lwc/engine-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/engine-server",
"version": "5.0.5",
"version": "5.0.6",
"description": "Renders LWC components in a server environment.",
"keywords": [
"lwc"
Expand Down Expand Up @@ -42,9 +42,9 @@
}
},
"devDependencies": {
"@lwc/engine-core": "5.0.5",
"@lwc/rollup-plugin": "5.0.5",
"@lwc/shared": "5.0.5",
"@lwc/engine-core": "5.0.6",
"@lwc/rollup-plugin": "5.0.6",
"@lwc/shared": "5.0.6",
"@rollup/plugin-virtual": "^3.0.1",
"parse5": "^7.1.2",
"@parse5/tools": "^0.3.0"
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/errors/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/errors",
"version": "5.0.5",
"version": "5.0.6",
"description": "LWC Error Utilities",
"keywords": [
"lwc"
Expand Down
4 changes: 2 additions & 2 deletions packages/@lwc/features/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/features",
"version": "5.0.5",
"version": "5.0.6",
"description": "LWC Features Flags",
"keywords": [
"lwc"
Expand Down Expand Up @@ -42,6 +42,6 @@
}
},
"dependencies": {
"@lwc/shared": "5.0.5"
"@lwc/shared": "5.0.6"
}
}
12 changes: 6 additions & 6 deletions packages/@lwc/integration-karma/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lwc/integration-karma",
"private": true,
"version": "5.0.5",
"version": "5.0.6",
"scripts": {
"start": "KARMA_MODE=watch karma start ./scripts/karma-configs/test/local.js",
"test": "karma start ./scripts/karma-configs/test/local.js --single-run --browsers ChromeHeadless",
Expand All @@ -18,11 +18,11 @@
"karma-sauce-launcher-fix-firefox": "using a fork to work around https://github.com/karma-runner/karma-sauce-launcher/issues/275"
},
"devDependencies": {
"@lwc/compiler": "5.0.5",
"@lwc/engine-dom": "5.0.5",
"@lwc/engine-server": "5.0.5",
"@lwc/rollup-plugin": "5.0.5",
"@lwc/synthetic-shadow": "5.0.5",
"@lwc/compiler": "5.0.6",
"@lwc/engine-dom": "5.0.6",
"@lwc/engine-server": "5.0.6",
"@lwc/rollup-plugin": "5.0.6",
"@lwc/synthetic-shadow": "5.0.6",
"chokidar": "^3.5.3",
"istanbul-lib-coverage": "^3.2.2",
"istanbul-lib-report": "^3.0.1",
Expand Down
44 changes: 44 additions & 0 deletions packages/@lwc/integration-karma/test/static-content/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import OnlyEventListenerChild from 'x/onlyEventListenerChild';
import OnlyEventListenerGrandchild from 'x/onlyEventListenerGrandchild';
import ListenerStaticWithUpdates from 'x/listenerStaticWithUpdates';
import DeepListener from 'x/deepListener';
import Comments from 'x/comments';
import PreserveComments from 'x/preserveComments';

if (!process.env.NATIVE_SHADOW) {
describe('Mixed mode for static content', () => {
Expand Down Expand Up @@ -396,3 +398,45 @@ describe('event listeners on deep paths', () => {
}
});
});

describe('static parts applies to comments correctly', () => {
it('has correct static parts when lwc:preserve-comments is off', async () => {
const elm = createElement('x-comments', {
is: Comments,
});
document.body.appendChild(elm);

await Promise.resolve();

const { foo, bar } = extractDataIds(elm);
const refs = elm.getRefs();

foo.click();
expect(elm.fooWasClicked).toBe(true);
expect(refs.foo).toBe(foo);

bar.click();
expect(elm.barWasClicked).toBe(true);
expect(refs.bar).toBe(bar);
});

it('has correct static parts when lwc:preserve-comments is on', async () => {
const elm = createElement('x-preserve-comments', {
is: PreserveComments,
});
document.body.appendChild(elm);

await Promise.resolve();

const { foo, bar } = extractDataIds(elm);
const refs = elm.getRefs();

foo.click();
expect(elm.fooWasClicked).toBe(true);
expect(refs.foo).toBe(foo);

bar.click();
expect(elm.barWasClicked).toBe(true);
expect(refs.bar).toBe(bar);
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template>
<div>
<!-- comment -->
<button data-id="foo" onclick={onClickFoo} lwc:ref="foo">foo</button>
<!-- comment -->
<button data-id="bar" onclick={onClickBar} lwc:ref="bar">bar</button>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { LightningElement, api } from 'lwc';

export default class extends LightningElement {
@api
fooWasClicked;

@api
barWasClicked;

onClickFoo() {
this.fooWasClicked = true;
}

onClickBar() {
this.barWasClicked = true;
}

@api
getRefs() {
return this.refs;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<template lwc:preserve-comments>
<div>
<!-- comment -->
<button data-id="foo" onclick={onClickFoo} lwc:ref="foo">foo</button>
<!-- comment -->
<button data-id="bar" onclick={onClickBar} lwc:ref="bar">bar</button>
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { LightningElement, api } from 'lwc';

export default class extends LightningElement {
@api
fooWasClicked;

@api
barWasClicked;

onClickFoo() {
this.fooWasClicked = true;
}

onClickBar() {
this.barWasClicked = true;
}

@api
getRefs() {
return this.refs;
}
}
6 changes: 3 additions & 3 deletions packages/@lwc/integration-tests/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@lwc/integration-tests",
"private": true,
"version": "5.0.5",
"version": "5.0.6",
"scripts": {
"build": "node scripts/build.js",
"build:dev": "MODE=dev yarn build",
Expand All @@ -16,7 +16,7 @@
"sauce:prod:ci": "MODE=prod yarn build:prod && MODE=prod ../../../scripts/ci/retry.sh wdio ./scripts/wdio.sauce.conf.js"
},
"devDependencies": {
"@lwc/rollup-plugin": "5.0.5",
"@lwc/rollup-plugin": "5.0.6",
"@wdio/cli": "^8.22.1",
"@wdio/local-runner": "^8.22.1",
"@wdio/mocha-framework": "^8.22.0",
Expand All @@ -25,7 +25,7 @@
"@wdio/static-server-service": "^8.21.0",
"deepmerge": "^4.3.0",
"dotenv": "^16.3.1",
"lwc": "5.0.5",
"lwc": "5.0.6",
"minimist": "^1.2.8",
"webdriverio": "^8.22.1"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@lwc/module-resolver/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/module-resolver",
"version": "5.0.5",
"version": "5.0.6",
"description": "Resolves paths for LWC components",
"keywords": [
"lwc"
Expand Down
4 changes: 2 additions & 2 deletions packages/@lwc/perf-benchmarks-components/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@lwc/perf-benchmarks-components",
"version": "5.0.5",
"version": "5.0.6",
"private": true,
"scripts": {
"build": "rm -fr dist && rollup -c ./rollup.config.mjs"
},
"devDependencies": {
"@lwc/rollup-plugin": "5.0.5"
"@lwc/rollup-plugin": "5.0.6"
},
"nx": {
"targets": {
Expand Down
10 changes: 5 additions & 5 deletions packages/@lwc/perf-benchmarks/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lwc/perf-benchmarks",
"version": "5.0.5",
"version": "5.0.6",
"private": true,
"scripts": {
"build": "rm -fr dist && rollup -c ./rollup.config.mjs && node scripts/build.js && ./scripts/fix-deps.sh",
Expand All @@ -17,10 +17,10 @@
"Also note that we use legacy versions of rollup-plugin-node-resolve and rollup-plugin-commonjs because Best uses an old version of Rollup."
],
"dependencies": {
"@lwc/engine-dom": "5.0.5",
"@lwc/engine-server": "5.0.5",
"@lwc/perf-benchmarks-components": "5.0.5",
"@lwc/synthetic-shadow": "5.0.5"
"@lwc/engine-dom": "5.0.6",
"@lwc/engine-server": "5.0.6",
"@lwc/perf-benchmarks-components": "5.0.6",
"@lwc/synthetic-shadow": "5.0.6"
},
"devDependencies": {
"@best/cli": "^10.0.0",
Expand Down
8 changes: 4 additions & 4 deletions packages/@lwc/rollup-plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"You can safely modify dependencies, devDependencies, keywords, etc., but other props will be overwritten."
],
"name": "@lwc/rollup-plugin",
"version": "5.0.5",
"version": "5.0.6",
"description": "Rollup plugin to compile LWC",
"keywords": [
"lwc"
Expand Down Expand Up @@ -42,12 +42,12 @@
}
},
"dependencies": {
"@lwc/compiler": "5.0.5",
"@lwc/module-resolver": "5.0.5",
"@lwc/compiler": "5.0.6",
"@lwc/module-resolver": "5.0.6",
"@rollup/pluginutils": "~5.0.4"
},
"devDependencies": {
"@lwc/errors": "5.0.5"
"@lwc/errors": "5.0.6"
},
"peerDependencies": {
"rollup": "^1.2.0||^2.0.0||^3.0.0||^4.0.0"
Expand Down
Loading

0 comments on commit ab701e5

Please sign in to comment.