Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add v8 coverage & upgrade to Vite 5 #300

Merged
merged 2 commits into from
Jun 26, 2024

Conversation

M4tiz
Copy link
Contributor

@M4tiz M4tiz commented Jun 17, 2024

No description provided.

Copy link
Contributor

@wouterlucas wouterlucas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@M4tiz
Copy link
Contributor Author

M4tiz commented Jun 18, 2024

@wouterlucas any ideas why the test pipeline fails? It doesn't look like my PR influences it.
https://github.com/lightning-js/renderer/actions/runs/9545663743/job/26329904984?pr=300

@frank-weindel
Copy link
Collaborator

frank-weindel commented Jun 18, 2024

Investigating this. This change is somehow producing errors during the TypeScript build of the renderer when built within the VRT runner --ci container:

> @lightningjs/[email protected] build /work
> tsc --build

node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/index.d.ts:843:22 - error TS2420: Class 'import("/work/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/index").FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
  Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref

843 export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
                         ~~~~~~~~~

src/core/text-rendering/font-face-types/TrFontFace.ts:185:7 - error TS2353: Object literal may only specify known properties, and 'variant' does not exist in type 'FontFaceDescriptors'.

185       variant: descriptors.variant,
          ~~~~~~~

src/core/text-rendering/font-face-types/WebTrFontFace.ts:60:7 - error TS2353: Object literal may only specify known properties, and 'variant' does not exist in type 'FontFaceDescriptors'.

60       variant: determinedDescriptors.variant,
         ~~~~~~~

node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/index.d.ts:843:22 - error TS2420: Class 'import("/work/node_modules/.pnpm/[email protected]_@[email protected]/node_modules/vite/dist/node/index").FSWatcher' incorrectly implements interface 'import("fs").FSWatcher'.
  Type 'FSWatcher' is missing the following properties from type 'FSWatcher': ref, unref

843 export declare class FSWatcher extends EventEmitter implements fs.FSWatcher {
                         ~~~~~~~~~

src/core/text-rendering/font-face-types/TrFontFace.ts:185:7 - error TS2353: Object literal may only specify known properties, and 'variant' does not exist in type 'FontFaceDescriptors'.

185       variant: descriptors.variant,
          ~~~~~~~

src/core/text-rendering/font-face-types/WebTrFontFace.ts:60:7 - error TS2353: Object literal may only specify known properties, and 'variant' does not exist in type 'FontFaceDescriptors'.

60       variant: determinedDescriptors.variant,
         ~~~~~~~


Found 6 errors.

@frank-weindel
Copy link
Collaborator

frank-weindel commented Jun 18, 2024

Okay. This issue is reproducible locally if you delete all the node_modules folders and run pnpm install from the repo root.

What seems to be happening is that the new dependency is pulling in [email protected] (likely somehow via peerDependency), whereas prior to this change [email protected] would get installed.

Vite 4.5.2 seemed to have introduced this bug which seems to be fixed in Vite 5, but never backported to Vite 4:

Upgrading to Vite 5 may solve this issue. If you could help try that, that would be greatly appreciated and we could get this PR merged sooner. Thanks 🙏

@frank-weindel
Copy link
Collaborator

Actually not sure if that will solve the variant issue. I don't have time to look at this further atm.

@M4tiz M4tiz changed the title Add v8 coverage Add v8 coverage & upgrade to Vite 5 Jun 21, 2024
@wouterlucas
Copy link
Contributor

wouterlucas commented Jun 21, 2024

Nice! I'd rebase this against dev - thats the working branch we're on and will be part of the next big "release".

That way we don't even have to bother with stuff like:

[dev] 3:06:17 PM [vite] warning:
[dev] ./workspace/renderer/dist/src/render-drivers/utils.js
[dev] 13 |      try {
[dev] 14 |          console.log('Loading core extension', coreExtensionModule);
[dev] 15 |          module = (await import(coreExtensionModule /* @vite-ignore */));
[dev]    |                                 ^^^^^^^^^^^^^^^^^^^
[dev] 16 |      }
[dev] 17 |      catch (e) {
[dev] The above dynamic import cannot be analyzed by Vite.
[dev] See https://github.com/rollup/plugins/tree/master/packages/dynamic-import-vars#limitations for supported dynamic import formats. If this is intended to be left as-is, you can use the /* @vite-ignore */ comment inside the import() call to suppress this warning.

😄

@M4tiz M4tiz changed the base branch from main to dev June 21, 2024 13:14
@M4tiz M4tiz changed the base branch from dev to main June 21, 2024 13:14
@M4tiz M4tiz changed the base branch from main to dev June 21, 2024 13:21
@M4tiz
Copy link
Contributor Author

M4tiz commented Jun 21, 2024

@frank-weindel @wouterlucas
I decided to try to update to Vite 5.x I hope that's alright :)

Crucial changes:

Let me know any of these require some additional checks to look for regression.

@@ -204,9 +204,9 @@ export const getTimingFunction = (
}

if (timingLookup[str] !== undefined) {
const [a, b, c, d] = timingLookup[str];
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the @ts-ignore for this no longer needed? If so can you delete the comments related to it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is still needed but for the line 211:
const timing = getTimingBezier(a, b, c, d);
Screenshot from 2024-06-21 16-19-07

@frank-weindel
Copy link
Collaborator

@frank-weindel @wouterlucas I decided to try to update to Vite 5.x I hope that's alright :)

Crucial changes:

Let me know any of these require some additional checks to look for regression.

@M4tiz Excellent. Thanks! That's much appreciated.

Looks like there's an error in CI with this change related to the examples pnpm lock file:

Scope: all 3 workspace projects
 ERR_PNPM_OUTDATED_LOCKFILE  Cannot install with "frozen-lockfile" because pnpm-lock.yaml is not up to date with examples/package.json

Note that in CI environments this setting is true by default. If you still need to run install in such cases, use "pnpm install --no-frozen-lockfile"

    Failure reason:
    specifiers in the lockfile ({"@lightningjs/renderer":"link:..","@stdlib/random-base-mt1[9](https://github.com/lightning-js/renderer/actions/runs/9614491706/job/26521477915?pr=300#step:7:10)937":"^0.2.1","@lightningjs/vite-plugin-import-chunk-url":"^0.3.0","vite":"^5.0.0"}) don't match specs in package.json ({"vite":"^5.0.0","@lightningjs/renderer":"link:.."})

pnpm-lock.yaml Outdated
playwright:
specifier: ^1.39.0
version: 1.39.0
version: 1.44.1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something seems a bit off about how you're pnpm installing/upgrading the dependencies needed for this PR. I just did it myself on a test branch and I'm not seeing any version changes to any unrelated packages like this one in the pnpm-lock.yaml file. Are you using a mix of npm/pnpm by accident by any chance? The package-lock.json file should not be being updated.

It seems like the reason you're getting the visual regression failures is that your changes are updating playwright to this newer version which seems to change how things are rendering. I'd advise that you start the new dependency installation from scratch and avoid the unnecessary changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. It must've entered this state while I was tinkering with the dependencies. It's fixed now :)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Looks good!

@frank-weindel frank-weindel merged commit a26008d into lightning-js:dev Jun 26, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants