Skip to content

[ContentFeature] de-decouple build specific code from content-features #1545

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

Merged
merged 15 commits into from
Mar 13, 2025

Conversation

dbajpeyi
Copy link
Contributor

@dbajpeyi dbajpeyi commented Mar 5, 2025

Asana Task/Github Issue: https://app.asana.com/0/72649045549333/1209507178584805

Description

  1. Move out feature setting parsing logic to a ConfigFeature class, which allows outside packages to re-use functionality like getFeatureSetting, without having to implement the whole ContentFeature
  2. Move out all import.meta code from the core code, and pass it as importConfig in the content-scope-features.js class

Testing Steps

Checklist

Please tick all that apply:

  • I have tested this change locally
  • I have tested this change locally in all supported browsers
  • This change will be visible to users
  • I have added automated tests that cover this change
  • I have ensured the change is gated by config
  • This change was covered by a ship review
  • This change was covered by a tech design
  • Any dependent config has been merged

Copy link

netlify bot commented Mar 5, 2025

Deploy Preview for content-scope-scripts ready!

Name Link
🔨 Latest commit c3d8d69
🔍 Latest deploy log https://app.netlify.com/sites/content-scope-scripts/deploys/67d297051b095e00085434d8
😎 Deploy Preview https://deploy-preview-1545--content-scope-scripts.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

github-actions bot commented Mar 5, 2025

Temporary Branch Update

The temporary branch has been updated with the latest changes. Below are the details:

Please use the above install command to update to the latest version.

Copy link

github-actions bot commented Mar 5, 2025

[Beta] Generated file diff

Time updated: Thu, 13 Mar 2025 08:28:45 GMT

Android
    - android/autofillPasswordImport.js
  • android/brokerProtection.js
  • android/contentScope.js

File has changed

Chrome
    - chrome/inject.js

File has changed

Chrome-mv3
    - chrome-mv3/inject.js

File has changed

Firefox
    - firefox/inject.js

File has changed

Integration
    - integration/contentScope.js

File has changed

Windows
    - windows/contentScope.js

File has changed

Apple
    - dist/contentScope.js
  • dist/contentScopeIsolated.js

File has changed

@dbajpeyi dbajpeyi force-pushed the dbajpeyi/refactor/decouple-import-meta branch from f87255a to c5e86a4 Compare March 5, 2025 15:28
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/refactor/decouple-import-meta branch 4 times, most recently from 894cce5 to 512b303 Compare March 5, 2025 16:32
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/refactor/decouple-import-meta branch from 512b303 to e7e6721 Compare March 5, 2025 17:26
@dbajpeyi dbajpeyi changed the title (wip) refactor: move utility function to a separate class (wip) refactor: move utility function to a config class Mar 5, 2025
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/refactor/decouple-import-meta branch from 917f4f8 to db3cdf8 Compare March 6, 2025 14:04
@dbajpeyi dbajpeyi changed the title (wip) refactor: move utility function to a config class [ContentFeature] de-decouple build specific code from logic Mar 6, 2025
this.#args = null;
constructor(featureName, importConfig) {
super(featureName);
this.args = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
this.args = null;
this.#args = null;

@dbajpeyi dbajpeyi force-pushed the dbajpeyi/refactor/decouple-import-meta branch 2 times, most recently from d309b19 to 85dfc98 Compare March 6, 2025 14:41
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/refactor/decouple-import-meta branch from 85dfc98 to 363da49 Compare March 6, 2025 15:03
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/refactor/decouple-import-meta branch 4 times, most recently from 83024d3 to 2562c00 Compare March 7, 2025 10:44
@dbajpeyi dbajpeyi changed the title [ContentFeature] de-decouple build specific code from logic [ContentFeature] de-decouple build specific code from content-features Mar 7, 2025
@dbajpeyi dbajpeyi marked this pull request as ready for review March 10, 2025 12:03
@dbajpeyi dbajpeyi requested review from a team, kzar and sammacbeth as code owners March 10, 2025 12:03
@dbajpeyi dbajpeyi force-pushed the dbajpeyi/refactor/decouple-import-meta branch from 6c388ce to 0a3d39b Compare March 10, 2025 12:52
@dbajpeyi
Copy link
Contributor Author

@jonathanKingston I've addressed the comments. Note that the references are this.args are unique now, because the base class has a setter. Please let me know if it makes sense.

PS: Integration test seems to be broken, but not sure why. I am investigating.

@jonathanKingston
Copy link
Contributor

@shakyShane this reshuffle starts simplifying some of the application structure. It breaks content-feature into two classes, one which autofill can then depend on or use in isolation.

I suggest when Deep gets back we add more testing on this interface so we can add it as a testable interface rather than just letting this barrier to autofill to rot.

This largely is a transitional step, I don't think we want to reside with args wiring still being so complex (i'd like to break the dependency of features heavily relying on them and instead use methods to access that data).

This also simplifies the load and init arguments mostly as a requirement to remove the use of import.meta which I think we agree now was a bit of a mistake. We just then use it at the periphery and don't require autofill to need custom transpiling. importConfig is the transport object for anything that's import.meta related through into the features.

I've reviewed most of this, I'd appreciate a quick look over in case I missed anything. The 4 additional small tiny commits I made just got the integration tests working from a missed setting of args in a method.

@shakyShane
Copy link
Contributor

@jonathanKingston I pushed a commit to fix a type, as mentioned in asana I tested this with complex integrations like duck.ai etc.

@shakyShane
Copy link
Contributor

shakyShane commented Mar 13, 2025

@jonathanKingston jonathanKingston merged commit 02a9553 into main Mar 13, 2025
13 checks passed
@jonathanKingston jonathanKingston deleted the dbajpeyi/refactor/decouple-import-meta branch March 13, 2025 09:44
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