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

Release TypeScript source code and source map for all packages #1019

Closed
AllanZhengYP opened this issue Mar 19, 2020 · 3 comments
Closed

Release TypeScript source code and source map for all packages #1019

AllanZhengYP opened this issue Mar 19, 2020 · 3 comments
Assignees
Labels
feature-request New feature or enhancement. May require GitHub community feedback.

Comments

@AllanZhengYP
Copy link
Contributor

Is your feature request related to a problem? Please describe.
Currently all service clients release with the TS source code, but none of the dependency package releases .ts files. When debugging the bundled front-end code, users can set the break point in .ts source, but only reaches the service client code. If we release all the dependency packages with .ts sources, users can debug the TS code.
Currently, debugging the ES5 frontend JS code is not easy

@AllanZhengYP AllanZhengYP added the feature-request New feature or enhancement. May require GitHub community feedback. label Mar 19, 2020
@JReinhold
Copy link

I have a similar issue, in that source maps are actually distributed with references to non-distributed TypeScript. I decided to post it here as a comment instead of a new issue because they are so related, but let me know if you want another issue instead.

Describe the bug

Some (or maybe all) of the published AWS npm packages includes source maps in their distribution. However, they all reference the TypeScript source code, which is NOT published.
In the best case, useless source maps are increasing the package size for no reason - they map from a distribution bundle to a source that doesn't exist.
In the worst case, bundlers like Parcel will warn on missing sources every time our applications are bundled, which are quite annoying warnings to see.
The warnings from Parcel in my application looks as follows:

⚠️  Could not load source file "../../src/index.ts" in source map of "../node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/index.js".
⚠️  Could not load source file "../../src/fromCognitoIdentity.ts" in source map of "../node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/fromCognitoIdentity.js".
⚠️  Could not load source file "../../src/fromCognitoIdentityPool.ts" in source map of "../node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/fromCognitoIdentityPool.js".
⚠️  Could not load source file "../../src/resolveLogins.ts" in source map of "../node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/resolveLogins.js".
⚠️  Could not load source file "../../src/localStorage.ts" in source map of "../node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/localStorage.js".
⚠️  Could not load source file "../src/index.ts" in source map of "../node_modules/@aws-sdk/stream-collector-browser/build/index.js".
⚠️  Could not load source file "../../src/IndexedDbStorage.ts" in source map of "../node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/IndexedDbStorage.js".
⚠️  Could not load source file "../../src/InMemoryStorage.ts" in source map of "../node_modules/@aws-sdk/credential-provider-cognito-identity/dist/es/InMemoryStorage.js".
⚠️  Could not load source file "../../src/index.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/index.js".
⚠️  Could not load source file "../../src/credentialDerivation.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/credentialDerivation.js".
⚠️  Could not load source file "../../src/SignatureV4.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/SignatureV4.js".
⚠️  Could not load source file "index.ts" in source map of "../node_modules/@aws-crypto/ie11-detection/build/index.js".
⚠️  Could not load source file "../../src/constants.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/constants.js".
⚠️  Could not load source file "../../src/getCanonicalHeaders.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/getCanonicalHeaders.js".
⚠️  Could not load source file "../../src/prepareRequest.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/prepareRequest.js".
⚠️  Could not load source file "../../src/getCanonicalQuery.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/getCanonicalQuery.js".
⚠️  Could not load source file "../../src/getPayloadHash.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/getPayloadHash.js".
⚠️  Could not load source file "../../src/moveHeadersToQuery.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/moveHeadersToQuery.js".
⚠️  Could not load source file "../../src/hasHeader.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/hasHeader.js".
⚠️  Could not load source file "../../src/utilDate.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/utilDate.js".
⚠️  Could not load source file "MsWindow.ts" in source map of "../node_modules/@aws-crypto/ie11-detection/build/MsWindow.js".
⚠️  Could not load source file "../../src/cloneRequest.ts" in source map of "../node_modules/@aws-sdk/signature-v4/dist/es/cloneRequest.js".

my application directly depends on the following AWS packages:

"@aws-amplify/auth": "^3.2.4",
"@aws-amplify/core": "^3.2.4",
"aws-appsync-auth-link": "^2.0.1",
"aws-appsync-subscription-link": "^2.0.1",

Is the issue in the browser/Node.js?

Node.js

If on Node.js, are you running this on AWS Lambda?

Not relevant.

Details of the browser/Node.js version

node -v: v13.12.0

SDK version number

  • aws-sdk: v2.656.0
  • @aws-amplify/core: v3.2.4
  • @aws-amplify/auth: v3.2.4

To Reproduce (observed behavior)
Steps to reproduce the behavior (please share code or minimal repo)

  1. npm install @aws-amplify/core
  2. Visit ./node_modules/@aws-sdk/client-cognito-identity/dist/es/CognitoIdentity.js.map
  3. See that it includes a reference to "../../CognitoIdentity.ts", which doesn't exist in the folder

Expected behavior

  • No distributed source maps should reference non-existent source.
  • Either source maps should not be included in the published package, or their TypeScript sources should be included in the distribution

Screenshots

Screenshot of Parcel warnings

Additional context

For more context on the Parcel error, see parcel-bundler/parcel#2185

While @AllanFly120 asks that sources are included in the distributed packages, I don't care if they are, or if the source maps are removed instead. As long as they match (source maps with sources, or no source maps and no sources).

@AllanZhengYP AllanZhengYP self-assigned this Oct 8, 2020
@AllanZhengYP
Copy link
Contributor Author

This issue should be addressed by #1462 In the latest gamma clients.
@JReinhold Can you try if you have the same issue with the latest clients? If so please open a new issue.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request New feature or enhancement. May require GitHub community feedback.
Projects
None yet
Development

No branches or pull requests

2 participants