Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into hydration-warn
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanlawson committed Nov 13, 2024
2 parents 8610e5c + bfc799b commit f73dd7b
Show file tree
Hide file tree
Showing 16 changed files with 34 additions and 23 deletions.
1 change: 0 additions & 1 deletion packages/@lwc/babel-plugin-component/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ const AMBIGUOUS_PROP_SET = new Map([
['bgcolor', 'bgColor'],
['accesskey', 'accessKey'],
['contenteditable', 'contentEditable'],
['contextmenu', 'contextMenu'],
['tabindex', 'tabIndex'],
['maxlength', 'maxLength'],
['maxvalue', 'maxValue'],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<x-component>
<template shadowrootmode="open">
<x-child accesskey="foo" aria-activedescendant="foo" aria-atomic="foo" aria-autocomplete="foo" aria-busy="foo" aria-checked="foo" aria-colcount="foo" aria-colindex="foo" aria-colspan="foo" aria-controls="foo" aria-current="foo" aria-describedby="foo" aria-details="foo" aria-disabled="foo" aria-errormessage="foo" aria-expanded="foo" aria-flowto="foo" aria-haspopup="foo" aria-hidden="foo" aria-invalid="foo" aria-keyshortcuts="foo" aria-label="foo" aria-labelledby="foo" aria-level="foo" aria-live="foo" aria-modal="foo" aria-multiline="foo" aria-multiselectable="foo" aria-orientation="foo" aria-owns="foo" aria-placeholder="foo" aria-posinset="foo" aria-pressed="foo" aria-readonly="foo" aria-relevant="foo" aria-required="foo" aria-roledescription="foo" aria-rowcount="foo" aria-rowindex="foo" aria-rowspan="foo" aria-selected="foo" aria-setsize="foo" aria-sort="foo" aria-valuemax="foo" aria-valuemin="foo" aria-valuenow="foo" aria-valuetext="foo" autocapitalize="foo" autofocus="foo" contenteditable="foo" contextmenu="foo" dir="foo" draggable="foo" enterkeyhint="foo" exportparts="foo" id="foo" inputmode="foo" itemid="foo" itemprop="foo" itemref="foo" itemscope="foo" itemtype="foo" lang="foo" nonce="foo" role="foo" spellcheck="foo" tabindex="foo" title="foo" translate="foo">
<x-child accesskey="foo" aria-activedescendant="foo" aria-atomic="foo" aria-autocomplete="foo" aria-busy="foo" aria-checked="foo" aria-colcount="foo" aria-colindex="foo" aria-colspan="foo" aria-controls="foo" aria-current="foo" aria-describedby="foo" aria-details="foo" aria-disabled="foo" aria-errormessage="foo" aria-expanded="foo" aria-flowto="foo" aria-haspopup="foo" aria-hidden="foo" aria-invalid="foo" aria-keyshortcuts="foo" aria-label="foo" aria-labelledby="foo" aria-level="foo" aria-live="foo" aria-modal="foo" aria-multiline="foo" aria-multiselectable="foo" aria-orientation="foo" aria-owns="foo" aria-placeholder="foo" aria-posinset="foo" aria-pressed="foo" aria-readonly="foo" aria-relevant="foo" aria-required="foo" aria-roledescription="foo" aria-rowcount="foo" aria-rowindex="foo" aria-rowspan="foo" aria-selected="foo" aria-setsize="foo" aria-sort="foo" aria-valuemax="foo" aria-valuemin="foo" aria-valuenow="foo" aria-valuetext="foo" autocapitalize="foo" autofocus="foo" contenteditable="foo" dir="foo" draggable="foo" enterkeyhint="foo" exportparts="foo" id="foo" inputmode="foo" itemid="foo" itemprop="foo" itemref="foo" itemscope="foo" itemtype="foo" lang="foo" nonce="foo" role="foo" spellcheck="foo" tabindex="foo" title="foo" translate="foo">
<template shadowrootmode="open">
<span>
accessKey:
Expand Down Expand Up @@ -176,9 +176,6 @@
<span>
contentEditable:
</span>
<span>
contextMenu:
</span>
<span>
crossorigin:
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
<span>colSpan: {colSpan}</span>
<span>command: {command}</span>
<span>contentEditable: {contentEditable}</span>
<span>contextMenu: {contextMenu}</span>
<span>crossorigin: {crossorigin}</span>
<span>datetime: {datetime}</span>
<span>details: {details}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
colspan={dynamic}
command={dynamic}
contenteditable={dynamic}
contextmenu={dynamic}
crossorigin={dynamic}
datetime={dynamic}
details={dynamic}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<x-component>
<template shadowrootmode="open">
<x-child contextmenu="foo" exportparts="foo">
<x-child exportparts="foo">
<template shadowrootmode="open">
<span>
accessKey: foo
Expand Down Expand Up @@ -176,9 +176,6 @@
<span>
contentEditable: foo
</span>
<span>
contextMenu:
</span>
<span>
crossorigin:
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
<span>colSpan: {colSpan}</span>
<span>command: {command}</span>
<span>contentEditable: {contentEditable}</span>
<span>contextMenu: {contextMenu}</span>
<span>crossorigin: {crossorigin}</span>
<span>datetime: {datetime}</span>
<span>details: {details}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export default class extends LightningElement {
@api colSpan
@api command
@api contentEditable
@api contextMenu
@api crossorigin
@api datetime
@api details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
colspan={dynamic}
command={dynamic}
contenteditable={dynamic}
contextmenu={dynamic}
crossorigin={dynamic}
datetime={dynamic}
details={dynamic}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<x-component>
<template shadowrootmode="open">
<x-child aria-activedescendant="foo" aria-atomic="foo" aria-autocomplete="foo" aria-busy="foo" aria-checked="foo" aria-colcount="foo" aria-colindex="foo" aria-colspan="foo" aria-controls="foo" aria-current="foo" aria-describedby="foo" aria-details="foo" aria-disabled="foo" aria-errormessage="foo" aria-expanded="foo" aria-flowto="foo" aria-haspopup="foo" aria-hidden="foo" aria-invalid="foo" aria-keyshortcuts="foo" aria-label="foo" aria-labelledby="foo" aria-level="foo" aria-live="foo" aria-modal="foo" aria-multiline="foo" aria-multiselectable="foo" aria-orientation="foo" aria-owns="foo" aria-placeholder="foo" aria-posinset="foo" aria-pressed="foo" aria-readonly="foo" aria-relevant="foo" aria-required="foo" aria-roledescription="foo" aria-rowcount="foo" aria-rowindex="foo" aria-rowspan="foo" aria-selected="foo" aria-setsize="foo" aria-sort="foo" aria-valuemax="foo" aria-valuemin="foo" aria-valuenow="foo" aria-valuetext="foo" contextmenu="foo" exportparts="foo" role="foo">
<x-child aria-activedescendant="foo" aria-atomic="foo" aria-autocomplete="foo" aria-busy="foo" aria-checked="foo" aria-colcount="foo" aria-colindex="foo" aria-colspan="foo" aria-controls="foo" aria-current="foo" aria-describedby="foo" aria-details="foo" aria-disabled="foo" aria-errormessage="foo" aria-expanded="foo" aria-flowto="foo" aria-haspopup="foo" aria-hidden="foo" aria-invalid="foo" aria-keyshortcuts="foo" aria-label="foo" aria-labelledby="foo" aria-level="foo" aria-live="foo" aria-modal="foo" aria-multiline="foo" aria-multiselectable="foo" aria-orientation="foo" aria-owns="foo" aria-placeholder="foo" aria-posinset="foo" aria-pressed="foo" aria-readonly="foo" aria-relevant="foo" aria-required="foo" aria-roledescription="foo" aria-rowcount="foo" aria-rowindex="foo" aria-rowspan="foo" aria-selected="foo" aria-setsize="foo" aria-sort="foo" aria-valuemax="foo" aria-valuemin="foo" aria-valuenow="foo" aria-valuetext="foo" exportparts="foo" role="foo">
<template shadowrootmode="open">
<span>
accessKey:
Expand Down Expand Up @@ -176,9 +176,6 @@
<span>
contentEditable:
</span>
<span>
contextMenu:
</span>
<span>
crossorigin:
</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
<span>colSpan: {colSpan}</span>
<span>command: {command}</span>
<span>contentEditable: {contentEditable}</span>
<span>contextMenu: {contextMenu}</span>
<span>crossorigin: {crossorigin}</span>
<span>datetime: {datetime}</span>
<span>details: {details}</span>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export default class extends LightningElement {
colSpan
command
contentEditable
contextMenu
crossorigin
datetime
details
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@
colspan={dynamic}
command={dynamic}
contenteditable={dynamic}
contextmenu={dynamic}
crossorigin={dynamic}
datetime={dynamic}
details={dynamic}
Expand Down
1 change: 0 additions & 1 deletion packages/@lwc/shared/src/html-attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ const GLOBAL_ATTRIBUTE = /*@__PURE__*/ new Set([
'autofocus',
'class',
'contenteditable',
'contextmenu',
'dir',
'draggable',
'enterkeyhint',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export const expectedFailures = new Set([
'attribute-class/with-scoped-styles/dynamic/index.js',
'attribute-component-global-html/index.js',
'attribute-global-html/as-component-prop/undeclared/index.js',
'attribute-global-html/as-component-prop/with-@api/index.js',
'attribute-global-html/as-component-prop/without-@api/index.js',
'attribute-namespace/index.js',
'attribute-style/basic/index.js',
Expand Down
2 changes: 2 additions & 0 deletions packages/@lwc/ssr-compiler/src/compile-js/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { catalogStaticStylesheets, catalogAndReplaceStyleImports } from './style
import { addGenerateMarkupExport, assignGenerateMarkupToComponent } from './generate-markup';
import { catalogWireAdapters } from './wire';

import { removeDecoratorImport } from './remove-decorator-import';
import type { Identifier as EsIdentifier, Program as EsProgram, Expression } from 'estree';
import type { Visitors, ComponentMetaState } from './types';
import type { CompilationMode } from '../shared';
Expand All @@ -34,6 +35,7 @@ const visitors: Visitors = {
replaceLwcImport(path, state);
catalogTmplImport(path, state);
catalogAndReplaceStyleImports(path, state);
removeDecoratorImport(path);
},
ClassDeclaration(path, state) {
if (!path.node?.superClass) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2024, salesforce.com, 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 { ImportDeclaration } from 'estree';
import { NodePath, builders as b } from 'estree-toolkit';

export function removeDecoratorImport(path: NodePath<ImportDeclaration>) {
if (!path.node || path.node.source.value !== '@lwc/ssr-runtime') {
return;
}

const filteredSpecifiers = path.node.specifiers.filter(
(specifier) =>
!(
specifier.type === 'ImportSpecifier' &&
specifier.imported.type === 'Identifier' &&
// Excluding track because it also has a non-decorator signature that might be used
(specifier.imported.name === 'api' || specifier.imported.name === 'wire')
)
);

if (filteredSpecifiers.length !== path.node.specifiers.length) {
path.replaceWith(b.importDeclaration(filteredSpecifiers, b.literal('@lwc/ssr-runtime')));
}
}

0 comments on commit f73dd7b

Please sign in to comment.