Skip to content
This repository has been archived by the owner on May 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #50 from parttio/bugfix/24.3.3
Browse files Browse the repository at this point in the history
Update Vaadin version to 24.3.x
  • Loading branch information
jcgueriaud1 authored Jan 26, 2024
2 parents 8d44fbb + dc6116d commit 2572072
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 14 deletions.
4 changes: 2 additions & 2 deletions accessibility-checker-for-vaadin-demo/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</organization>

<properties>
<vaadin.version>24.2.5</vaadin.version>
<vaadin.version>24.3.3</vaadin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand All @@ -31,7 +31,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.1.5</version>
<version>3.2.2</version>
<relativePath/>
</parent>

Expand Down
42 changes: 34 additions & 8 deletions accessibility-checker-for-vaadin-demo/vite.generated.ts
Original file line number Diff line number Diff line change
Expand Up @@ -300,13 +300,23 @@ function statsExtracterPlugin(): PluginOption {
id.startsWith(themeOptions.frontendGeneratedFolder.replace(/\\/g, '/'))
&& id.match(/.*\/jar-resources\/themes\/[^\/]+\/components\//);

const isGeneratedWebComponentResource = (id: string) =>
id.startsWith(themeOptions.frontendGeneratedFolder.replace(/\\/g, '/'))
&& id.match(/.*\/flow\/web-components\//);

const isFrontendResourceCollected = (id: string) =>
!id.startsWith(themeOptions.frontendGeneratedFolder.replace(/\\/g, '/'))
|| isThemeComponentsResource(id)
|| isGeneratedWebComponentResource(id);

// collects project's frontend resources in frontend folder, excluding
// 'generated' sub-folder, except for legacy shadow DOM stylesheets
// packaged in `theme/components/` folder.
// packaged in `theme/components/` folder
// and generated web component resources in `flow/web-components` folder.
modules
.map((id) => id.replace(/\\/g, '/'))
.filter((id) => id.startsWith(frontendFolder.replace(/\\/g, '/')))
.filter((id) => !id.startsWith(themeOptions.frontendGeneratedFolder.replace(/\\/g, '/')) || isThemeComponentsResource(id))
.filter(isFrontendResourceCollected)
.map((id) => id.substring(frontendFolder.length + 1))
.map((line: string) => (line.includes('?') ? line.substring(0, line.lastIndexOf('?')) : line))
.forEach((line: string) => {
Expand All @@ -333,6 +343,22 @@ function statsExtracterPlugin(): PluginOption {
const fileKey = line.substring(line.indexOf('jar-resources/') + 14);
frontendFiles[fileKey] = hash;
});
// collects and hash rest of the Frontend resources excluding files in /generated/ and /themes/
// and files already in frontendFiles.
let frontendFolderAlias = "Frontend";
generatedImports
.filter((line: string) => line.startsWith(frontendFolderAlias + '/'))
.filter((line: string) => !line.startsWith(frontendFolderAlias + '/generated/'))
.filter((line: string) => !line.startsWith(frontendFolderAlias + '/themes/'))
.map((line) => line.substring(frontendFolderAlias.length + 1))
.filter((line: string) => !frontendFiles[line])
.forEach((line: string) => {
const filePath = path.resolve(frontendFolder, line);
if (projectFileExtensions.includes(path.extname(filePath)) && existsSync(filePath)) {
const fileBuffer = readFileSync(filePath, { encoding: 'utf-8' }).replace(/\r\n/g, '\n');
frontendFiles[line] = createHash('sha256').update(fileBuffer, 'utf8').digest('hex');
}
});
// If a index.ts exists hash it to be able to see if it changes.
if (existsSync(path.resolve(frontendFolder, 'index.ts'))) {
const fileBuffer = readFileSync(path.resolve(frontendFolder, 'index.ts'), { encoding: 'utf-8' }).replace(
Expand Down Expand Up @@ -748,8 +774,8 @@ export const vaadinConfig: UserConfigFn = (env) => {
{
name: 'vaadin:force-remove-html-middleware',
transformIndexHtml: {
enforce: 'pre',
transform(_html, { server }) {
order: 'pre',
handler(_html, { server }) {
if (server && !spaMiddlewareForceRemoved) {
server.middlewares.stack = server.middlewares.stack.filter((mw) => {
const handleName = '' + mw.handle;
Expand All @@ -763,8 +789,8 @@ export const vaadinConfig: UserConfigFn = (env) => {
hasExportedWebComponents && {
name: 'vaadin:inject-entrypoints-to-web-component-html',
transformIndexHtml: {
enforce: 'pre',
transform(_html, { path, server }) {
order: 'pre',
handler(_html, { path, server }) {
if (path !== '/web-component.html') {
return;
}
Expand All @@ -782,8 +808,8 @@ export const vaadinConfig: UserConfigFn = (env) => {
{
name: 'vaadin:inject-entrypoints-to-index-html',
transformIndexHtml: {
enforce: 'pre',
transform(_html, { path, server }) {
order: 'pre',
handler(_html, { path, server }) {
if (path !== '/index.html') {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion accessibility-checker-for-vaadin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<url>https://github.com/parttio/accessibility-checker-for-vaadin</url>

<properties>
<vaadin.version>24.2.5</vaadin.version>
<vaadin.version>24.3.3</vaadin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ export class AccessibilityChecker extends LitElement implements MessageHandler {
highlight(this.detail.node);
}
const vaadinDevTool = (document.getElementsByTagName('vaadin-dev-tools')[0] as VaadinDevTools);
vaadinDevTool.disableJavaLiveReload();
vaadinDevTool.setJavaLiveReloadActive(false);
}

deactivate() {
if (this.detail) {
resetHighlight(this.detail.node);
}
const vaadinDevTool = (document.getElementsByTagName('vaadin-dev-tools')[0] as VaadinDevTools);
vaadinDevTool.enableJavaLiveReload();
vaadinDevTool.setJavaLiveReloadActive(true);
}
willUpdate(changedProperties: PropertyValues<this>) {
if (changedProperties.has('filterTagName') ||changedProperties.has('filterRuleCategory') || changedProperties.has('report')) {
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<description>accessibility-checker-for-vaadin</description>

<properties>
<vaadin.version>24.2.5</vaadin.version>
<vaadin.version>24.3.3</vaadin.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
Expand Down

0 comments on commit 2572072

Please sign in to comment.