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

feat: update to manifest v3 (Resolves: #32, #33, #29) #40

Merged
merged 18 commits into from
Dec 21, 2022

Conversation

cindyli
Copy link
Member

@cindyli cindyli commented Dec 8, 2022

Resolves: #32
Resolves: #33
Resolves: #29

Migration docs:

package.json Outdated
"clean:build": "rimraf dist",
"clean:test": "rimraf reports coverage",
"build": "run-s -l clean:build build:*",
"build:dist": "cpy . ../dist --cwd=src; cpy . ../../dist/lib/infusion --cwd=node_modules/infusion"
Copy link
Member

Choose a reason for hiding this comment

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

I think the ; operator is non-portable - I get an error running this line on Windows, replacing it with & allows the build to complete


uioPlus.enactor.tableOfContents.injectToCContainer = function (that) {
if (!that.locate("tocContainer").length) {
if (that.content.length === 1) {
Copy link
Member

Choose a reason for hiding this comment

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

A comment explaining why the variant strategy is necessary here would be helpful

Copy link
Member

Choose a reason for hiding this comment

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

I'll try to explain, and hopefully we can come up with a suitable comment.

The ToC component from Infusion relies on the container for the ToC component to be located within the page. However, we cannot rely on the ToC's container being pre-added to the page with UIO+ as it runs on arbitrary sites. uioPlus.enactor.tableOfContents.injectToCContainer will inject the necessary ToC container markup into the pages content, and this container will then be used by the ToC component.

The first if guards against adding the ToC container if one already exists.

The second if/else will either append the ToC container to the content or to the enactor's container if the content isn't found. The content is located by means of uioPlus.contentView defined above. It provides a means for looking for the pages main content area (e.g. <main>, <article> etc.). In some cases, UIO+ is not able to locate the content area. For example a page marked up like <body><div></div><div></div></body>.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've added @jobara's comment into the code.

All code review suggestions so far have been addressed.

"nyc": "15.1.0",
"rimraf": "3.0.2",
"sinon": "13.0.1",
Copy link
Member

Choose a reason for hiding this comment

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

I'm getting an error when trying to run the tests that it can't find sinon.

Copy link
Member Author

Choose a reason for hiding this comment

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

Interesting. sinon-chrome pulls in sinon on my computer. I've added the sinon. Can you try again? Thanks.

@jobara
Copy link
Member

jobara commented Dec 20, 2022

With UIO+ enabled the browser console reports the following error:

{
    "message": "Assertion failure - check console for more details: No container element was found for selector .uioPlus",
    "stack": "Error: Assertion failure - check console for more details: No container element was found for selector .uioPlus\n    at new fluid.FluidError (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:128:2470)\n    at fluid.builtinFail (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:128:3038)\n    at fluid.event.firer.fire (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:128:25883)\n    at fluid.fail (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:128:3289)\n    at fluid.container (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:224673)\n    at fluid.containerForViewComponent (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:228075)\n    at fluid.expander.invokeFunc [as typeFunc] (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:116253)\n    at fluid.expandImmediateImpl (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:113497)\n    at fluid.expandImmediate (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:113252)\n    at fluid.memberFromRecord (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:26907)"
}

@jobara
Copy link
Member

jobara commented Dec 20, 2022

On engadget.com when enabling Text-to-Speech I get the following error.

Error in event handler: Error: Assertion failure - check console for more details: More than one (32) container elements were found for selector article, [role~='article'], .article, #article with selector name article in context null
    at new fluid.FluidError (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:128:2470)
    at fluid.builtinFail (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:128:3038)
    at fluid.event.firer.fire (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:128:25883)
    at fluid.fail (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:128:3289)
    at fluid.container (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:224673)
    at fluid.containerForViewComponent (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:228075)
    at fluid.expander.invokeFunc [as typeFunc] (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:116253)
    at fluid.expandImmediateImpl (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:113497)
    at fluid.expandImmediate (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:113252)
    at fluid.memberFromRecord (chrome-extension://gbenfaceipnpnobakclnelebaeinlelm/lib/infusion/dist/infusion-uio.js:137:26907)

Comment on lines 311 to 312
domReaderContent: ["domReaderContent", "main", "article"],
controllerParentContainer: ["controllerParentContainer", "main", "article"],
Copy link
Member

Choose a reason for hiding this comment

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

I think we still need the "genericContent" option here which is likely defined in a parent grade. It provides more fallbacks to find the page content.

Copy link
Member Author

Choose a reason for hiding this comment

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

You are probably looking at an old version of this file. domReaderContent and controllerParentContainer are used by subcomponents domReader and controller. As these sub-components are now disabled for turning off the page level reading. These lines have been removed in the last commit.

@@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
node-version: [14.x, 16.x]
node-version: [16.x]
Copy link
Member

Choose a reason for hiding this comment

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

Might as well add Node 18 now too.

Suggested change
node-version: [16.x]
node-version: [16.x, 18.x]

README.md Outdated
@@ -110,7 +99,7 @@ _**NOTE:** Published versions can be installed from the [Chrome Web Store](

### BSD 3-Clause

* [Infusion v3.0.0-dev](https://fluidproject.org/infusion.html)
* [Infusion v4.0.0](https://fluidproject.org/infusion.html)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
* [Infusion v4.0.0](https://fluidproject.org/infusion.html)
* [Infusion v4.6.0](https://fluidproject.org/infusion.html)

@jobara jobara self-requested a review December 21, 2022 15:18
@jobara jobara merged commit cad0c64 into fluid-project:main Dec 21, 2022
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.

Update to latest Infusion Update to manifest v3 Migrate build scripts from Grunt to NPM Scripts
3 participants