Skip to content

Commit b54c58d

Browse files
Merge branch 'master' into jhefferman/cte-html-compliance
2 parents ab7b49a + 5ecf556 commit b54c58d

File tree

13 files changed

+334
-444
lines changed

13 files changed

+334
-444
lines changed

package.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
},
3939
"devDependencies": {
4040
"@commitlint/cli": "^19.8.1",
41-
"@eslint/js": "9.34.0",
41+
"@eslint/js": "9.35.0",
4242
"@lwc/eslint-plugin-lwc-internal": "link:./scripts/eslint-plugin",
4343
"@lwc/test-utils-lwc-internals": "link:./scripts/test-utils",
4444
"@nx/js": "21.4.1",
@@ -51,13 +51,13 @@
5151
"@swc/core": "~1.13.5",
5252
"@swc/helpers": "~0.5.17",
5353
"@types/babel__core": "^7.20.5",
54-
"@types/node": "^22.18.0",
54+
"@types/node": "^22.18.1",
5555
"@vitest/coverage-v8": "^3.2.4",
56-
"@vitest/eslint-plugin": "^1.3.6",
56+
"@vitest/eslint-plugin": "^1.3.9",
5757
"@vitest/ui": "^3.2.4",
5858
"bytes": "^3.1.2",
5959
"es-module-lexer": "^1.7.0",
60-
"eslint": "9.34.0",
60+
"eslint": "9.35.0",
6161
"eslint-config-flat-gitignore": "^2.1.0",
6262
"eslint-plugin-header": "^3.1.1",
6363
"eslint-plugin-import": "^2.32.0",
@@ -67,14 +67,14 @@
6767
"isbinaryfile": "^5.0.6",
6868
"jsdom": "^26.1.0",
6969
"lint-staged": "^16.1.6",
70-
"magic-string": "^0.30.18",
70+
"magic-string": "^0.30.19",
7171
"nx": "21.4.1",
7272
"prettier": "^3.6.2",
73-
"rollup": "^4.50.0",
74-
"terser": "^5.43.1",
73+
"rollup": "^4.50.1",
74+
"terser": "^5.44.0",
7575
"tslib": "^2.8.1",
7676
"typescript": "5.8.2",
77-
"typescript-eslint": "8.41.0",
77+
"typescript-eslint": "8.42.0",
7878
"vitest": "^3.2.4"
7979
},
8080
"lint-staged": {

packages/@lwc/compiler/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,11 @@
4646
}
4747
},
4848
"dependencies": {
49-
"@babel/core": "7.28.3",
49+
"@babel/core": "7.28.4",
5050
"@babel/plugin-transform-async-generator-functions": "7.28.0",
5151
"@babel/plugin-transform-async-to-generator": "7.27.1",
5252
"@babel/plugin-transform-class-properties": "7.27.1",
53-
"@babel/plugin-transform-object-rest-spread": "7.28.0",
53+
"@babel/plugin-transform-object-rest-spread": "7.28.4",
5454
"@locker/babel-plugin-transform-unforgeables": "0.22.0",
5555
"@lwc/babel-plugin-component": "8.21.6",
5656
"@lwc/errors": "8.21.6",

packages/@lwc/integration-not-karma/configs/base.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ const env = {
1414
'DISABLE_STATIC_CONTENT_OPTIMIZATION',
1515
'DISABLE_SYNTHETIC',
1616
'ENABLE_ARIA_REFLECTION_GLOBAL_POLYFILL',
17-
'ENABLE_SYNTHETIC_SHADOW_IN_HYDRATION',
1817
'ENGINE_SERVER',
1918
'FORCE_NATIVE_SHADOW_MODE_FOR_TEST',
2019
'NATIVE_SHADOW',

packages/@lwc/integration-not-karma/configs/hydration.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@ import hydrationTestPlugin from './plugins/serve-hydration.js';
66
/** @type {import("@web/test-runner").TestRunnerConfig} */
77
export default {
88
...baseConfig,
9-
files: [
10-
// FIXME: These tests are just symlinks to integration-karma for now so the git diff smaller
11-
'test-hydration/**/*.spec.js',
12-
// FIXME: hits timeout?
13-
'!test-hydration/light-dom/scoped-styles/replace-scoped-styles-with-dynamic-templates/index.spec.js',
14-
// FIXME: This uses ENABLE_SYNTHETIC_SHADOW_IN_MIGRATION to detect status,
15-
// we should just use DISABLE_SYNTHETIC instead
16-
'!test-hydration/synthetic-shadow/index.spec.js',
17-
],
9+
files: ['test-hydration/**/*.spec.js'],
1810
plugins: [...baseConfig.plugins, hydrationTestPlugin],
1911
};

packages/@lwc/integration-not-karma/configs/plugins/serve-hydration.js

Lines changed: 36 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,20 @@ import fs from 'node:fs/promises';
44
import { rollup } from 'rollup';
55
import lwcRollupPlugin from '@lwc/rollup-plugin';
66
import { DISABLE_STATIC_CONTENT_OPTIMIZATION, ENGINE_SERVER } from '../../helpers/options.js';
7-
const lwcSsr = await (ENGINE_SERVER ? import('@lwc/engine-server') : import('@lwc/ssr-runtime'));
8-
9-
const ROOT_DIR = path.join(import.meta.dirname, '../..');
10-
11-
const context = {
12-
LWC: lwcSsr,
13-
moduleOutput: null,
14-
};
7+
/** LWC SSR module to use when server-side rendering components. */
8+
const lwcSsr = await (ENGINE_SERVER
9+
? // Using import('literal') rather than import(variable) so static analysis tools work
10+
import('@lwc/engine-server')
11+
: import('@lwc/ssr-runtime'));
1512

1613
lwcSsr.setHooks({
1714
sanitizeHtmlContent(content) {
1815
return content;
1916
},
2017
});
2118

19+
const ROOT_DIR = path.join(import.meta.dirname, '../..');
20+
2221
let guid = 0;
2322
const COMPONENT_UNDER_TEST = 'main';
2423

@@ -100,7 +99,7 @@ function throwOnUnexpectedConsoleCalls(runnable, expectedConsoleCalls = {}) {
10099
};
101100
}
102101
try {
103-
runnable();
102+
return runnable();
104103
} finally {
105104
Object.assign(console, originals);
106105
}
@@ -117,31 +116,26 @@ function throwOnUnexpectedConsoleCalls(runnable, expectedConsoleCalls = {}) {
117116
* So, script runs, generates markup, & we get that markup out and return it for use
118117
* in client-side tests.
119118
*/
120-
async function getSsrCode(moduleCode, testConfig, filename, expectedSSRConsoleCalls) {
119+
async function getSsrCode(moduleCode, testConfig, filePath, expectedSSRConsoleCalls) {
121120
const script = new vm.Script(
122-
// FIXME: Can these IIFEs be converted to ESM imports?
123-
// No, vm.Script doesn't support that. But might be doable with experimental vm.Module
124-
`
125-
${testConfig};
126-
config = config || {};
127-
${moduleCode};
128-
moduleOutput = LWC.renderComponent(
121+
`(() => {
122+
${testConfig}
123+
${moduleCode}
124+
return LWC.renderComponent(
129125
'x-${COMPONENT_UNDER_TEST}-${guid++}',
130126
Main,
131127
config.props || {},
132128
false,
133129
'sync'
134130
);
135-
`,
136-
{ filename }
131+
})()`,
132+
{ filename: `[SSR] ${filePath}` }
137133
);
138134

139-
throwOnUnexpectedConsoleCalls(() => {
140-
vm.createContext(context);
141-
script.runInContext(context);
142-
}, expectedSSRConsoleCalls);
143-
144-
return await context.moduleOutput;
135+
return throwOnUnexpectedConsoleCalls(
136+
() => script.runInContext(vm.createContext({ LWC: lwcSsr })),
137+
expectedSSRConsoleCalls
138+
);
145139
}
146140

147141
async function getTestConfig(input) {
@@ -178,52 +172,41 @@ async function existsUp(dir, file) {
178172
* This function wraps those configs in the test code to be executed.
179173
*/
180174
async function wrapHydrationTest(filePath) {
181-
const suiteDir = path.dirname(filePath);
182-
183-
// Wrap all the tests into a describe block with the file stricture name
184-
const describeTitle = path.relative(ROOT_DIR, suiteDir).split(path.sep).join(' ');
185-
186-
const testCode = await getTestConfig(filePath);
187-
188-
// Create a temporary module to evaluate the bundled code and extract config properties for test configuration
189-
const configModule = new vm.Script(testCode);
190-
const configContext = { config: {} };
191-
vm.createContext(configContext);
192-
configModule.runInContext(configContext);
193-
const { expectedSSRConsoleCalls, requiredFeatureFlags } = configContext.config;
194-
195-
requiredFeatureFlags?.forEach((featureFlag) => {
196-
lwcSsr.setFeatureFlagForTest(featureFlag, true);
197-
});
175+
const {
176+
default: { expectedSSRConsoleCalls, requiredFeatureFlags },
177+
} = await import(path.join(ROOT_DIR, filePath));
198178

199179
try {
180+
requiredFeatureFlags?.forEach((featureFlag) => {
181+
lwcSsr.setFeatureFlagForTest(featureFlag, true);
182+
});
183+
184+
const suiteDir = path.dirname(filePath);
200185
// You can add an `.only` file alongside an `index.spec.js` file to make it `fdescribe()`
201186
const onlyFileExists = await existsUp(suiteDir, '.only');
202187

203-
const describeFn = onlyFileExists ? 'describe.only' : 'describe';
204188
const componentDefCSR = await getCompiledModule(suiteDir, false);
205189
const componentDefSSR = ENGINE_SERVER
206190
? componentDefCSR
207191
: await getCompiledModule(suiteDir, true);
208192
const ssrOutput = await getSsrCode(
209193
componentDefSSR,
210-
testCode,
211-
path.join(suiteDir, 'ssr.js'),
194+
await getTestConfig(filePath),
195+
filePath,
212196
expectedSSRConsoleCalls
213197
);
214198

215199
// FIXME: can we turn these IIFEs into ESM imports?
216200
return `
217201
import { runTest } from '/helpers/test-hydrate.js';
218202
import config from '/${filePath}?original=1';
219-
${describeFn}("${describeTitle}", () => {
220-
it('test', async () => {
221-
const ssrRendered = ${JSON.stringify(ssrOutput) /* escape quotes */};
222-
// Component code, IIFE set as Main
223-
${componentDefCSR};
224-
return await runTest(ssrRendered, Main, config);
225-
})
226-
});`;
203+
${onlyFileExists ? 'it.only' : 'it'}('${filePath}', async () => {
204+
const ssrRendered = ${JSON.stringify(ssrOutput) /* escape quotes */};
205+
// Component code, IIFE set as Main
206+
${componentDefCSR};
207+
return await runTest(ssrRendered, Main, config);
208+
});
209+
`;
227210
} finally {
228211
requiredFeatureFlags?.forEach((featureFlag) => {
229212
lwcSsr.setFeatureFlagForTest(featureFlag, false);

packages/@lwc/integration-not-karma/helpers/options.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@ export const DISABLE_STATIC_CONTENT_OPTIMIZATION = Boolean(
2626
process.env.DISABLE_STATIC_CONTENT_OPTIMIZATION
2727
);
2828

29-
export const ENABLE_SYNTHETIC_SHADOW_IN_HYDRATION = Boolean(
30-
process.env.ENABLE_SYNTHETIC_SHADOW_IN_HYDRATION
31-
);
32-
3329
export const DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE = Boolean(
3430
process.env.DISABLE_NATIVE_CUSTOM_ELEMENT_LIFECYCLE
3531
);
@@ -56,7 +52,6 @@ export const COVERAGE_DIR_FOR_OPTIONS =
5652
DISABLE_SYNTHETIC,
5753
DISABLE_SYNTHETIC_SHADOW_SUPPORT_IN_COMPILER,
5854
ENABLE_ARIA_REFLECTION_GLOBAL_POLYFILL,
59-
ENABLE_SYNTHETIC_SHADOW_IN_HYDRATION,
6055
FORCE_NATIVE_SHADOW_MODE_FOR_TEST,
6156
LEGACY_BROWSERS,
6257
NODE_ENV_FOR_TEST,

packages/@lwc/integration-not-karma/test-hydration/synthetic-shadow/index.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ export default {
2222
expect(child.shadowRoot.synthetic).toBeUndefined();
2323

2424
// sanity check that the env var is working
25-
if (process.env.ENABLE_SYNTHETIC_SHADOW_IN_HYDRATION) {
26-
expect(document.body.attachShadow.toString()).not.toContain('[native code');
27-
} else {
25+
if (process.env.DISABLE_SYNTHETIC) {
2826
expect(document.body.attachShadow.toString()).toContain('[native code');
27+
} else {
28+
expect(document.body.attachShadow.toString()).not.toContain('[native code');
2929
}
3030

3131
expect(consoleCalls.warn).toHaveSize(0);

packages/@lwc/integration-tests/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"@wdio/spec-reporter": "^9.17.0",
2727
"@wdio/static-server-service": "^9.16.2",
2828
"deepmerge": "^4.3.1",
29-
"dotenv": "^17.2.1",
29+
"dotenv": "^17.2.2",
3030
"lwc": "8.21.6",
3131
"minimist": "^1.2.8",
3232
"webdriverio": "^9.0.7"

packages/@lwc/integration-types/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"devDependencies": {
1616
"@rollup/plugin-replace": "^6.0.2",
1717
"@rollup/plugin-typescript": "^12.1.4",
18-
"rollup": "^4.50.0",
18+
"rollup": "^4.50.1",
1919
"rollup-plugin-livereload": "^2.0.5",
2020
"rollup-plugin-serve": "^3.0.0"
2121
}

packages/@lwc/rollup-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
"@lwc/compiler": "8.21.6",
5050
"@lwc/module-resolver": "8.21.6",
5151
"@lwc/shared": "8.21.6",
52-
"@rollup/pluginutils": "~5.2.0"
52+
"@rollup/pluginutils": "~5.3.0"
5353
},
5454
"devDependencies": {
5555
"@lwc/errors": "8.21.6"

0 commit comments

Comments
 (0)