Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions playwright/diagnostics.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,35 @@ test('sass compiler warnings surface in styles diagnostics', async ({ page }) =>
)
})

test('css modules nesting compiles without lightning wasm compatibility errors', async ({
page,
}) => {
await waitForInitialRender(page)

await ensurePanelToolsVisible(page, 'styles')
await page.getByRole('combobox', { name: 'Style mode' }).selectOption('module')
await setStylesEditorSource(
page,
['.btn {', ' &:hover {', ' color: red;', ' }', '}'].join('\n'),
)

await expect
.poll(async () => {
return (
await page.getByRole('status', { name: 'App status' }).textContent()
)?.trim()
})
.toBe('Rendered')

await ensureDiagnosticsDrawerOpen(page)
await expect(page.locator('#diagnostics-styles')).not.toContainText(
'Style compilation failed.',
)
await expect(page.locator('#diagnostics-styles')).not.toContainText(
'invalid type: unit value, expected a boolean',
)
})

test('clear component diagnostics resets rendered lint-issue status pill', async ({
page,
}) => {
Expand Down
35 changes: 20 additions & 15 deletions src/modules/cdn.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,24 +45,25 @@ const fallbackCdnProviders = fallbackCdnProvidersByPrimary[primaryCdnProvider] ?

export const cdnImportSpecs = {
cssBrowser: {
importMap: '@knighted/css/browser',
esm: '@knighted/css/browser',
jspmGa: 'npm:@knighted/css/browser',
importMap: '@knighted/css@1.2.1/browser',
esm: '@knighted/css@1.2.1/browser',
unpkg: '@knighted/css@1.2.1/dist/browser.js?module',
jspmGa: 'npm:@knighted/css@1.2.1/browser',
},
jsxDom: {
importMap: '@knighted/jsx',
esm: '@knighted/jsx',
jspmGa: 'npm:@knighted/jsx',
importMap: '@knighted/jsx@1.14.0',
esm: '@knighted/jsx@1.14.0',
jspmGa: 'npm:@knighted/jsx@1.14.0',
},
jsxTransform: {
importMap: '@knighted/jsx/transform',
esm: '@knighted/jsx/transform',
jspmGa: 'npm:@knighted/jsx/transform',
importMap: '@knighted/jsx@1.14.0/transform',
esm: '@knighted/jsx@1.14.0/transform',
jspmGa: 'npm:@knighted/jsx@1.14.0/transform',
},
jsxReact: {
importMap: '@knighted/jsx/react',
esm: '@knighted/jsx/react',
jspmGa: 'npm:@knighted/jsx/react',
importMap: '@knighted/jsx@1.14.0/react',
esm: '@knighted/jsx@1.14.0/react',
jspmGa: 'npm:@knighted/jsx@1.14.0/react',
},
react: {
importMap: 'react',
Expand Down Expand Up @@ -100,9 +101,13 @@ export const cdnImportSpecs = {
jspmGa: 'npm:less',
},
lightningCssWasm: {
importMap: '@parcel/css-wasm',
esm: '@parcel/css-wasm',
jspmGa: 'npm:@parcel/css-wasm',
/**
* Keep this pinned to a runtime version verified with @knighted/css browser.
* Drift here can break cssFromSource module transforms (e.g. drafts.nesting).
*/
importMap: 'lightningcss-wasm@1.30.1',
esm: 'lightningcss-wasm@1.30.1',
jspmGa: 'npm:lightningcss-wasm@1.30.1',
},
typescript: {
importMap: 'typescript',
Expand Down
2 changes: 1 addition & 1 deletion src/modules/preview/render-runtime.js
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ export const createRenderRuntimeController = ({
if (hasNamedInit) {
await module.init()
} else if (hasNamedTransform && typeof module.default === 'function') {
// @parcel/css-wasm exports default init + named transform.
// Common WASM ESM shape: default init + named transform.
await module.default()
}

Expand Down
Loading