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

extract import map generation logic into utility #668

Merged

Conversation

thescientist13
Copy link
Member

@thescientist13 thescientist13 commented Jul 15, 2021

Related Issue

resolves #537 (as a result of looking into #557 (comment))

Summary of Changes

  1. Extract logic from plugin-node-modules into its own utility
  2. Also resolved refactor duplicate hardcoded dependencies list in plugin-graphql to a single shared data structure #538

TODOs

  1. extend to graphql plugin
  2. extend to babel plugin - remove need for supplemental babel packages for plugin-babel  #906
    • Is going to require more work including installing dependencies and updating specs (there were none for this case!). Should make a new issue for the 1.0 backlog tracker to account for installing those deps to the package, copying into the tests folder, stubbing out package.json. Wonder if I could use walker package ranger to target against specific deps and build up the import map to shim that way??? 🧐

Discussion

  1. make a package?
    • pass a path or an object? object assumes process.cwd()?
    • what kind of API?
1. Should be merged _after_ #557 , to account for hardcoded usages of _node_modules_? ```js // use .mjs version if it exists, for packages like redux if (!Array.isArray(entry) && fs.existsSync(`${process.cwd()}/node_modules/${packageJson.name}/${entry.replace('.js', '.mjs')}`)) { entry = entry.replace('.js', '.mjs'); } ```

@thescientist13 thescientist13 added question Further information is requested chore unit testing, maintenance, etc CLI labels Jul 15, 2021
@thescientist13 thescientist13 self-assigned this Jul 15, 2021
@thescientist13
Copy link
Member Author

Some refactoring ideas coming out of #832

  • just pass initial path to walkModule and let it do the fs.readFile?
  • can't updateImportMap append /node_modules/ hint string?

@thescientist13 thescientist13 force-pushed the chore/issue-537-refactor-import-map-generation branch from 1b6bca9 to 9464c0b Compare December 25, 2021 01:06
@thescientist13 thescientist13 force-pushed the chore/issue-537-refactor-import-map-generation branch from 2c91d5b to 9e4927b Compare February 27, 2022 00:06
@thescientist13 thescientist13 removed the question Further information is requested label Feb 27, 2022
@thescientist13 thescientist13 marked this pull request as ready for review February 27, 2022 00:38
@thescientist13 thescientist13 added the Plugins Greenwood Plugins label Feb 27, 2022
@thescientist13 thescientist13 removed their assignment Mar 3, 2022
@thescientist13 thescientist13 added enhancement Improve something existing (e.g. no docs, new APIs, etc) and removed chore unit testing, maintenance, etc labels Mar 5, 2022
@thescientist13 thescientist13 force-pushed the chore/issue-537-refactor-import-map-generation branch from 9e4927b to f4b01cb Compare March 12, 2022 18:36
@thescientist13 thescientist13 changed the base branch from master to release/0.25.0 March 13, 2022 01:06
@thescientist13 thescientist13 merged commit cd0712f into release/0.25.0 Mar 13, 2022
@thescientist13 thescientist13 deleted the chore/issue-537-refactor-import-map-generation branch March 13, 2022 01:07
thescientist13 added a commit that referenced this pull request Mar 18, 2022
* extract package walk logic into utility

* lower thresholds

* remove removed config

* create import map merging function and apply to graphql plugin

* 538 refactor rollup and resource to use shared data structure

* post rebase fixes
thescientist13 added a commit that referenced this pull request Apr 7, 2022
* extract package walk logic into utility

* lower thresholds

* remove removed config

* create import map merging function and apply to graphql plugin

* 538 refactor rollup and resource to use shared data structure

* post rebase fixes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLI enhancement Improve something existing (e.g. no docs, new APIs, etc) Plugins Greenwood Plugins
Projects
None yet
1 participant