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

fix(terser-webpack-plugin): target webpack@5 #49314

Merged

Conversation

buschtoens
Copy link
Contributor

Fixes #48806

Please fill in this template.

  • Use a meaningful title for the pull request. Include the name of the package modified.

  • Test the change in your own code. (Compile and run.)

  • Add or edit tests to reflect the change. (Run with npm test YOUR_PACKAGE_NAME.)
    Not applicable. Tests already exist.

  • Follow the advice from the readme.

  • Avoid common mistakes.

  • Run npm run lint package-name (or tsc if no tslint.json is present).
    TS 4.1 is failing, because it looks up source-map in the repo root and not in the package-local node_modules directory.

    Error Log
    Installing to /Users/jan/.dts/typescript-installs/4.0...
    Installed!
    
    Installing to /Users/jan/.dts/typescript-installs/4.1...
    Installed!
    
    Error: Errors in typescript@4.1 for external dependencies:
    ../uglify-js/index.d.ts(9,30): error TS7016: Could not find a declaration file for module 'source-map'. '/Users/jan/open-source/DefinitelyTyped/node_modules/source-map/source-map.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/source-map` if it exists or add a new declaration (.d.ts) file containing `declare module 'source-map';`
    ../webpack-sources/lib/CachedSource.d.ts(1,30): error TS7016: Could not find a declaration file for module 'source-map'. '/Users/jan/open-source/DefinitelyTyped/node_modules/source-map/source-map.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/source-map` if it exists or add a new declaration (.d.ts) file containing `declare module 'source-map';`
    ../webpack-sources/lib/ConcatSource.d.ts(2,28): error TS7016: Could not find a declaration file for module 'source-map'. '/Users/jan/open-source/DefinitelyTyped/node_modules/source-map/source-map.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/source-map` if it exists or add a new declaration (.d.ts) file containing `declare module 'source-map';`
    ../webpack-sources/lib/index.d.ts(1,30): error TS7016: Could not find a declaration file for module 'source-map'. '/Users/jan/open-source/DefinitelyTyped/node_modules/source-map/source-map.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/source-map` if it exists or add a new declaration (.d.ts) file containing `declare module 'source-map';`
    ../webpack-sources/lib/OriginalSource.d.ts(2,28): error TS7016: Could not find a declaration file for module 'source-map'. '/Users/jan/open-source/DefinitelyTyped/node_modules/source-map/source-map.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/source-map` if it exists or add a new declaration (.d.ts) file containing `declare module 'source-map';`
    ../webpack-sources/lib/Source.d.ts(2,30): error TS7016: Could not find a declaration file for module 'source-map'. '/Users/jan/open-source/DefinitelyTyped/node_modules/source-map/source-map.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/source-map` if it exists or add a new declaration (.d.ts) file containing `declare module 'source-map';`
    ../webpack-sources/lib/SourceMapSource.d.ts(1,50): error TS7016: Could not find a declaration file for module 'source-map'. '/Users/jan/open-source/DefinitelyTyped/node_modules/source-map/source-map.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/source-map` if it exists or add a new declaration (.d.ts) file containing `declare module 'source-map';`
    ../webpack/index.d.ts(46,30): error TS7016: Could not find a declaration file for module 'source-map'. '/Users/jan/open-source/DefinitelyTyped/node_modules/source-map/source-map.js' implicitly has an 'any' type.
      Try `npm i --save-dev @types/source-map` if it exists or add a new declaration (.d.ts) file containing `declare module 'source-map';`
    

Select one of these and delete the others:

If changing an existing definition:

@buschtoens
Copy link
Contributor Author

CI is failing, because webpack is not in the list of allowed dependencies yet: microsoft/DefinitelyTyped-tools#152

@typescript-bot typescript-bot added The CI failed When GH Actions fails Popular package This PR affects a popular package (as counted by NPM download counts). Untested Change This PR does not touch tests labels Nov 3, 2020
@typescript-bot typescript-bot added this to Needs Author Action in New Pull Request Status Board Nov 3, 2020
@typescript-bot
Copy link
Contributor

typescript-bot commented Nov 3, 2020

@buschtoens Thank you for submitting this PR! I see this is your first time submitting to DefinitelyTyped 👋 — I'm the local bot who will help you through the process of getting things through.

This is a live comment which I will keep updated.

This PR doesn't modify any tests, so it's hard to know what's being fixed, and your changes might regress in the future. Have you considered adding tests to cover the change you're making? Including tests allows this PR to be merged by yourself and the owners of this module. This can potentially save days of time for you.

1 package in this PR

Code Reviews

This PR can be merged once it's reviewed by a DT maintainer.

Status

  • ✅ No merge conflicts
  • ✅ Continuous integration tests have passed
  • ✅ Only a DT maintainer can approve changes without tests

All of the items on the list are green. To merge, you need to post a comment including the string "Ready to merge" to bring in your changes.


Diagnostic Information: What the bot saw about this PR
{
  "type": "info",
  "now": "-",
  "pr_number": 49314,
  "author": "buschtoens",
  "dangerLevel": "ScopedAndUntested",
  "headCommitAbbrOid": "18fc2af",
  "headCommitOid": "18fc2af119e413e81992d6d477afda03c0510e7a",
  "mergeIsRequested": true,
  "stalenessInDays": 0,
  "lastPushDate": "2020-11-03T07:45:15.000Z",
  "lastCommentDate": "2020-11-04T00:47:46.000Z",
  "maintainerBlessed": false,
  "reviewLink": "https://github.com/DefinitelyTyped/DefinitelyTyped/pull/49314/files",
  "hasMergeConflict": false,
  "authorIsOwner": false,
  "isFirstContribution": true,
  "popularityLevel": "Popular",
  "pkgInfo": [
    {
      "name": "terser-webpack-plugin",
      "files": [
        {
          "path": "types/terser-webpack-plugin/index.d.ts",
          "kind": "definition"
        },
        {
          "path": "types/terser-webpack-plugin/package.json",
          "kind": "package-meta-ok"
        }
      ],
      "owners": [
        "Danscho",
        "peterblazejewicz"
      ],
      "addedOwners": [],
      "deletedOwners": [],
      "popularityLevel": "Popular"
    }
  ],
  "hasDismissedReview": false,
  "ciResult": "pass",
  "lastReviewDate": "2020-11-04T00:41:10.000Z",
  "firstApprovalDate": "2020-11-03T07:52:49.000Z",
  "reviewersWithStaleReviews": [],
  "approvalFlags": 6,
  "isChangesRequested": false
}

@typescript-bot
Copy link
Contributor

🔔 @Danscho @peterblazejewicz — please review this PR in the next few days. Be sure to explicitly select Approve or Request Changes in the GitHub UI so I know what's going on.

@typescript-bot
Copy link
Contributor

@buschtoens The CI build failed! Please review the logs for more information.

Once you've pushed the fixes, the build will automatically re-run. Thanks!

@danger-public
Copy link

Inspecting the JavaScript source for this package found some properties that are not in the .d.ts files.
The check for missing properties isn't always right, so take this list as advice, not a requirement.

terser-webpack-plugin (unpkg)

was missing the following properties:

  1. isSourceMap
  2. buildError
  3. getAvailableNumberOfCores
  4. getEcmaVersion

Generated by 🚫 dangerJS against 18fc2af

@typescript-bot typescript-bot removed the The CI failed When GH Actions fails label Nov 3, 2020
@typescript-bot typescript-bot moved this from Needs Author Action to Needs Maintainer Review in New Pull Request Status Board Nov 3, 2020
@typescript-bot
Copy link
Contributor

@Danscho Thank you for reviewing this PR! The author has pushed new commits since your last review. Could you take another look and submit a fresh review?

@typescript-bot typescript-bot added the Owner Approved A listed owner of this package signed off on the pull request. label Nov 3, 2020
@typescript-bot
Copy link
Contributor

👋 Hi there! I’ve run some quick measurements against master and your PR. These metrics should help the humans reviewing this PR gauge whether it might negatively affect compile times or editor responsiveness for users who install these typings.

Let’s review the numbers, shall we?

Comparison details 📊
master #49314 diff
Batch compilation
Memory usage (MiB) 79.6 80.6 +1.2%
Type count 11136 11137 0%
Assignability cache size 1970 1970 0%
Language service
Samples taken 107 107 0%
Identifiers in tests 107 107 0%
getCompletionsAtPosition
    Mean duration (ms) 433.1 436.8 +0.9%
    Mean CV 9.9% 9.7%
    Worst duration (ms) 529.8 533.2 +0.6%
    Worst identifier test value
getQuickInfoAtPosition
    Mean duration (ms) 426.9 434.1 +1.7%
    Mean CV 9.4% 9.3% -1.1%
    Worst duration (ms) 514.4 537.0 +4.4%
    Worst identifier comment ie8

It looks like nothing changed too much. I won’t post performance data again unless it gets worse.

@typescript-bot typescript-bot added the Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. label Nov 3, 2020
@typescript-bot typescript-bot added Maintainer Approved Self Merge This PR can now be self-merged by the PR author or an owner labels Nov 4, 2020
@typescript-bot typescript-bot moved this from Needs Maintainer Review to Waiting for Author to Merge in New Pull Request Status Board Nov 4, 2020
@typescript-bot
Copy link
Contributor

@buschtoens Everything looks good here. Great job! I am ready to merge this PR on your behalf.

If you'd like that to happen, please post a comment saying:

Ready to merge

and I'll merge this PR almost instantly. Thanks for helping out! ❤️

(@Danscho, @peterblazejewicz: you can do this too.)

@buschtoens
Copy link
Contributor Author

Ready to merge.

Thanks everybody! 🥰

@typescript-bot typescript-bot moved this from Waiting for Author to Merge to Recently Merged in New Pull Request Status Board Nov 4, 2020
@typescript-bot typescript-bot merged commit 9be913a into DefinitelyTyped:master Nov 4, 2020
@typescript-bot
Copy link
Contributor

I just published @types/terser-webpack-plugin@5.0.2 to npm.

@typescript-bot typescript-bot removed this from Recently Merged in New Pull Request Status Board Nov 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Maintainer Approved Owner Approved A listed owner of this package signed off on the pull request. Perf: Same typescript-bot determined that this PR will not significantly impact compilation performance. Popular package This PR affects a popular package (as counted by NPM download counts). Self Merge This PR can now be self-merged by the PR author or an owner Untested Change This PR does not touch tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[@types/terser-webpack-plugin] Support for webpack 5
6 participants