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

Added support for dynamic imports #42

Merged
merged 1 commit into from
May 15, 2024
Merged

Added support for dynamic imports #42

merged 1 commit into from
May 15, 2024

Conversation

cgalvan
Copy link
Collaborator

@cgalvan cgalvan commented May 14, 2024

Description

Added support for dynamic imports https://developers.google.com/maps/documentation/javascript/load-maps-js-api#dynamic-library-import

This is the recommended workflow for importing the Google API.

  • Updated our adapter to support dynamic imports by providing the importLibrary method that returns a Promise to fulfill the requested library
  • Added support for importing all of our currently supported classes through dynamic import
  • Updated our autoComplete example to show-case the dynamic import workflow
  • Added unit tests to cover all dynamic imports

Testing

Ran unit tests and verified they all pass and that we retain 100% coverage on the index.ts module

------------------|---------|----------|---------|---------|--------------------------
File              | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
------------------|---------|----------|---------|---------|--------------------------
All files         |    84.2 |    86.02 |   82.35 |   84.25 |
 directions.ts    |    9.25 |        0 |       0 |    7.69 | 26-204
 google.maps.d.ts |       0 |        0 |       0 |       0 |
 googleCommon.ts  |     100 |      100 |     100 |     100 |
 index.ts         |     100 |      100 |     100 |     100 |
 infoWindow.ts    |     100 |      100 |     100 |     100 |
 maps.ts          |     100 |    97.26 |     100 |     100 | 105
 markers.ts       |   78.66 |    66.66 |      90 |   78.66 | 63-68,88-115,140,310-334
 places.ts        |   81.19 |       84 |      75 |   81.03 | 230-278
------------------|---------|----------|---------|---------|--------------------------

Test Suites: 6 passed, 6 total
Tests:       113 passed, 113 total

Also built/ran our examples and verified they still work as expected (particularly the autoComplete example, that was changed to use the dynamic imports for both migration and google version).

@cgalvan cgalvan requested a review from a team as a code owner May 14, 2024 20:25
Copy link
Contributor

@jonayuan jonayuan left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@cgalvan cgalvan merged commit 516580b into aws-geospatial:main May 15, 2024
1 check passed
@cgalvan cgalvan deleted the SupportDynamicImports branch May 15, 2024 13:39
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.

2 participants