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

chore(core): bump to ts 5.0 #11077

Merged
merged 7 commits into from
Mar 22, 2023

Conversation

AllanZhengYP
Copy link
Member

@AllanZhengYP AllanZhengYP commented Mar 10, 2023

Description of changes

This is the first commit to lay the ground for the custom clients work. Bump the core to ts 5.0 so we can utilize the better type resolution compared to ts3.8. It is not a breaking change because we are not exporting any ts interfaces differently than main branch.

The bundle size increased because the ts config importHelpers is turned off. Otherwise the build error is show:

error TS2343: This syntax requires an imported helper named '__spreadArray' which does not exist in 'tslib'. Consider upgrading your version of 'tslib'.

This is because ts3.x generates spread helper function __spread. The helper function was deprecated in ts4.x and new helper function __spreadArray from tslib 2.x is favored. We cannot bump tslib version yet because the tslib version misalignment with dependency package will cause mutliple copies of the tslib in users node_modules, hence bigger bundle size.

The bundle size increase of the core package as temporary as custom clients will bring greater reduction of bundle size.

Description of how you validated changes

Verified with build & ts-coverage & watch mode

Checklist

  • PR description included
  • yarn test passes
  • Tests are changed or added
  • Relevant documentation is changed or added (and PR referenced)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

upgrade is required to workaround build error:
src/Logger/ConsoleLogger.ts(134,28): error TS2343: This syntax
requires an imported helper named '__spreadArray' which does not
exist in 'tslib'. Consider upgrading your version of 'tslib'.
@AllanZhengYP AllanZhengYP requested review from a team as code owners March 10, 2023 23:46
@AllanZhengYP AllanZhengYP requested a review from stocaaro March 10, 2023 23:46
@AllanZhengYP AllanZhengYP changed the base branch from feat/custom-clients to v5/custom-clients March 22, 2023 01:03
@AllanZhengYP AllanZhengYP requested review from israx and jimblanc March 22, 2023 01:26
Comment on lines +21 to +24
"build:cjs": "rimraf lib && tsc -m commonjs --outDir lib && webpack && webpack --config ./webpack.config.dev.js",
"build:esm": "rimraf lib-esm && tsc -m esnext --outDir lib-esm",
"build:cjs:watch": "rimraf lib && tsc -m commonjs --outDir lib --watch",
"build:esm:watch": "rimraf lib-esm && tsc -m esnext --outDir lib-esm --watch",
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice, good bye custom build script 👋

Copy link
Contributor

@jimblanc jimblanc Mar 22, 2023

Choose a reason for hiding this comment

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

It might be a good idea to diff the UMD artifacts after this change just to see if there was an impact there. I'm also wondering if we could do away with the webpack entirely as well and just have tsc build our UMD artifacts (don't need to do it now, just food for thought)?

@@ -51,7 +51,8 @@
"find": "^0.2.7",
"genversion": "^2.2.0",
"prepend-file": "^1.3.1",
"react-native": "^0.64.1"
"react-native": "^0.64.1",
"typescript": "4.9.5"
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm wondering if we should try for TS 5.0, just dropped a few days ago (out of RC)

Copy link
Contributor

Choose a reason for hiding this comment

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

Although downlevel doesn't support 5.0 yet, so maybe that would be jumping the gun at this point.

@AllanZhengYP AllanZhengYP changed the title chore(core): bump to ts4.9.5 chore(core): bump to ts 5.0 Mar 22, 2023
@@ -51,7 +51,8 @@
"find": "^0.2.7",
"genversion": "^2.2.0",
"prepend-file": "^1.3.1",
"react-native": "^0.64.1"
"react-native": "^0.64.1",
"typescript": "5.0.2"
Copy link
Member

Choose a reason for hiding this comment

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

I really like this.

@AllanZhengYP AllanZhengYP merged commit 75e80e3 into aws-amplify:v5/custom-clients Mar 22, 2023
AllanZhengYP added a commit to AllanZhengYP/amplify-js that referenced this pull request May 30, 2023
similar to aws-amplify#11077; This change adds 5.8kB to bundle size limit
because it disables importHelpers to keep tslib version aligned.
We may need to revisit whether to bump tslib to 2.x
AllanZhengYP added a commit to AllanZhengYP/amplify-js that referenced this pull request May 30, 2023
similar to aws-amplify#11077; This change adds 5.8kB to bundle size limit
because it disables importHelpers to keep tslib version aligned.
We may need to revisit whether to bump tslib to 2.x
AllanZhengYP added a commit to AllanZhengYP/amplify-js that referenced this pull request May 30, 2023
similar to aws-amplify#11077; This change adds 5.8kB to bundle size limit
because it disables importHelpers to keep tslib version aligned.
We may need to revisit whether to bump tslib to 2.x
erinleigh90 pushed a commit that referenced this pull request Jun 6, 2023
* chore(core): bump to ts 5.0 (#11077)

* feat(clients): basic types and fetch handler (#11120)

* feat(clients): compose transfer handler with middleware & retry middleware (#11188)

* feat(clients): middleware interface and retry middleware

* test(clients): retry middleare unit test

* fix(clients): middleware type to include options

* feat(clients): add retry middleware unit test and update interface

* chore(clients): update bundle size limit for fetch and retry

* chore(clients): add retry docs; fix format

* fix(clients): address feedbacks

* fix(retry): add metadata to returns from retry middldeware (#11212)

* fix(retry): add metadata to returns from retry middldeware; fix minor bugs

* feat(clients): address retry middleware feedbacks

Co-authored-by: Chris F <5827964+cshfang@users.noreply.github.com>

* chore(core): update size limit

* feat(clients): cognito identity client (#11213)

* feat(clients): implement service API composer

* chore(clients): rename middleware interface

* feat(clients): middleware handler interface can be non request/response interface

* chore(clients): move fetch handler to handlers folder

* feat(clients): implement user agent middleware

* feat(clients): implement unauth aws transfer handler

* feat(clients): implement api handler composer

* feat(clients): implement cognito-identity client

* chore(clients): update bundle size limit

* feat(clients): add serde utils; remove retry in api handler composer

* feat(clients): integrate cognito-identity client to Credentials class

* fix(clients): make retryDecider interface async

* chore: move cognito client to dev dep

* chore(clients): use Pascale path name

* fix(clients): handle fetch response.body undefined in RN

* chore: publish under v5-custom-clients dist-tag

* fix(clients): read body once for errors

* chore(clients): enable tagged release of custom clients (#11267)

* test(clients): add functional test to cognito identity client (#11266)

* test(clients): add cognito-identity functional test

* chore(clients): prefer destructuring parameters at top

* feat(clients): add useragent to cognito identity (#11269)

* chore(clients): add license header to files (#11292)

* feat(clients): Add custom signature v4 signer (#11273)

* feat(clients): Add custom signature v4 signer

* Updated docstrings

* Extracted common code

* Use == null instead of isNil

* Add unit tests

* Add missing licensing headers

* Use test case options in presign tests

* Fixed comment

* Add test for data hashing with SourceData keys

* Remove buffer dependency

* Remove internal sdk dependency

* chore(clients): Make signing functions synchronous (#11307)

* chore(clients): Replace existing Signer implementation (#11310)

* chore(clients): Add @internal annotation (#11320)

* feat(clients): Add signing middleware (#11323)

* feat(clients): Add signing middleware

* Use closure for clock offset

* Add bundle size test entry

* Address comments

* feat(clients): support CN partition by adding DNS suffix resolver (#11311)

* feat(clients): support CN partition by adding DNS suffix resolver

* chore(clients): update bundle size test limit

* fix(clients): address feedbacks

* chore: update bundle size limit

* chore(clients): Add context to some regex (#11334)

* feat(clients) Add updateEndpoint API (#11330)

* feat(clients) Add updateEndpoint API

* Rename handler

* chore(clients): Use DNS suffix util in Pinpoint client (#11340)

* chore(clients): Annotate custom client APIs with @internal (#11347)

* feat(clients) Add putEvents API (#11342)

* feat(clients) Add putEvents API

* Add additional verification for expected date format

* Mark API as internal

* feat(clients) Add getInAppMessages API (#11348)

* feat(clients) Add getInAppMessages API

* Update unit test

* chore(clients): Replace SDK Pinpoint Client (#11359)

Co-authored-by: Allan Zheng <zheallan@amazon.com>

* chore: update size limit

* chore(clients): export pinpoint client from internal subpath (#11369)

* feat(clients): allow fetch handler to read body multiple times

* chore: update size limit

* fix(clients): add react-native entrypoint for internal modules

* chore: address feedbacks

* feat(clients): vendor TS types from pinpoint and cognito-identity clients (#11393)

* chore: dts bundler script for AWS SDK types

* feat(clients): vendor AWS SDK client types

* chore: workaround the tslint errors for generated rollup types

* docs: add readme to build clients script

* feat: update SDK types

* chore(storage): update size limit (#11406)

* fix(clients): middleware chain revert after every invocation (#11432)

* chore: prepare for release; split out data packages diffs

* fix: address feedbacks

* fix(analytics): apply useragent enhancement to pinpoint client

* chore: update size limit

* fix: Auth bundle size test

* fix: Update bundle size for pubsub

* fix: api-graphql bundle size update

* fix: Update api bundle sizes

* fix: DataStore bundle size test

---------

Co-authored-by: Chris F <5827964+cshfang@users.noreply.github.com>
Co-authored-by: Aaron S <94858815+stocaaro@users.noreply.github.com>
AllanZhengYP added a commit to AllanZhengYP/amplify-js that referenced this pull request Jun 6, 2023
similar to aws-amplify#11077; This change adds 5.8kB to bundle size limit
because it disables importHelpers to keep tslib version aligned.
We may need to revisit whether to bump tslib to 2.x
AllanZhengYP added a commit to AllanZhengYP/amplify-js that referenced this pull request Jun 8, 2023
similar to aws-amplify#11077; This change adds 5.8kB to bundle size limit
because it disables importHelpers to keep tslib version aligned.
We may need to revisit whether to bump tslib to 2.x
AllanZhengYP added a commit to AllanZhengYP/amplify-js that referenced this pull request Jun 8, 2023
similar to aws-amplify#11077; This change adds 5.8kB to bundle size limit
because it disables importHelpers to keep tslib version aligned.
We may need to revisit whether to bump tslib to 2.x
AllanZhengYP added a commit that referenced this pull request Jun 8, 2023
similar to #11077; This change adds 5.8kB to bundle size limit
because it disables importHelpers to keep tslib version aligned.
We may need to revisit whether to bump tslib to 2.x
kvramyasri7 pushed a commit to kvramyasri7/amplify-js that referenced this pull request Jul 7, 2023
similar to aws-amplify#11077; This change adds 5.8kB to bundle size limit
because it disables importHelpers to keep tslib version aligned.
We may need to revisit whether to bump tslib to 2.x
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