Commit Graph

98 Commits

Author SHA1 Message Date
Jack Bates
8331ebef64 Defer concurrency control to maxSockets (#460) 2022-07-14 09:50:12 -07:00
Jack Bates
8d064c1bf7 Delete crawl-npm.ts (#491) 2022-07-14 08:48:59 -07:00
Nathan Shively-Sanders
3c92bd1108 Allow .eslintrc.json (#496)
The FS and unused-packages check both need to know about .eslintrc.json

The FS check for `./foo` is too simple, but I expanded the existing
allow-list instead of making the check stricter.
2022-07-05 14:41:11 -07:00
Jack Bates
90eac4dbf8 Use pacote second attempt (#483)
* Use cached npm metadata

* Simply read the npm cache

* Use pacote
2022-06-28 10:51:02 -07:00
Jack Bates
3e6aab8c62 Registry API no longer needs %2f-encoding (#445) 2022-06-22 11:43:32 -07:00
Andrew Branch
cbb1d4d1fa Revert "Use cached npm info (#451)" (#480)
* Revert "Use cached npm info (#451)"

This reverts commit e246b08817.

* Fix package.json version
2022-06-09 13:34:46 -07:00
Jack Bates
e246b08817 Use cached npm info (#451)
* Registry API no longer needs %2f-encoding

* Use cached npm info

* Simply read the npm cache

* Delete create-search-index.ts

* Use pacote
2022-06-09 11:41:21 -07:00
Jack Bates
575fd10bc8 Use valid semvers internally (#436)
* Update test position after upgrading Prettier

* Use valid semvers internally
2022-04-21 14:26:08 -07:00
TypeScript Bot
8665394ff1 Format 2022-04-21 18:44:48 +00:00
Jack Bates
ee38cc9e16 Type-check some version strings (#437) 2022-04-21 09:56:32 -07:00
TypeScript Bot
57f0c23b9d Format 2022-02-03 19:31:38 +00:00
Nathan Shively-Sanders
4d8d66e96f Improve unused path mapping error. (#386)
1. Report all unused path mappings of the first unused-having package.
   Previously it was only the first unused path mapping of the first
   package.

2. Direct the user to check for missing mappings in dependencies in the
   case of path mappings that aren't actually unused.
2022-02-03 11:28:47 -08:00
Nathan Shively-Sanders
8ff6e2a7a0 testDependencies omits entries from 'declare module' (#384)
The list of declared modules includes deep paths, which I think may be
correct for general usage, but not for comparing with the list of
dependencies, which must be package names.

Found by @chriskrycho while trying to update Ember's types.
2022-01-18 16:07:51 -08:00
Nathan Shively-Sanders
ec84740915 Fix dtslint build again (#357)
1. Use Error casts instead of type annotations to any.
2. Somehow stricter settings didn't apply to dtslint before.
3. Use tsc -b . in dtslint and dts-critic's `build` script.
2021-12-01 11:29:21 -08:00
TypeScript Bot
3c7a974a9d Format 2021-12-01 18:38:09 +00:00
Nathan Shively-Sanders
257478f16a Add dtslint and dts-critic to project build (#356)
This updates the build for some other packages to the newest version of
Typescript. I'm not sure why.
2021-12-01 10:35:40 -08:00
Wesley Wigham
5f0bd534e5 Automatically patch a package.json entry onto all object export maps (#352) 2021-11-29 14:14:19 -08:00
TypeScript Bot
900331e70d Format 2021-10-27 20:03:48 +00:00
ZHAO Jinxiang
486c85dd56 Add mts and cts support when we check for .d.ts file (#337)
* Add mts and cts support when we check for .d.ts file

* Update module-info.ts

Remap .d.cts/.d.mts extensions so their module entries don't conflict with a js file with the same basename

* Update module-info.ts

typo

Co-authored-by: Wesley Wigham <wwigham@gmail.com>
2021-10-27 12:59:59 -07:00
TypeScript Bot
58791f51b6 Format 2021-10-13 23:48:20 +00:00
Wesley Wigham
bba41f75df Check for .d.mts and .d.cts files everywhere we check for .d.ts files (#335) 2021-10-13 16:46:01 -07:00
TypeScript Bot
b9ddb4e2e5 Format 2021-10-12 21:48:29 +00:00
Wesley Wigham
c1e59cecf4 Add support for copying package imports/exports/type to resulting package files (#334) 2021-10-12 14:45:57 -07:00
Nathan Shively-Sanders
eed63f27e2 Allow node/buffer path mapping (#270)
* Allow "paths" mapping buffer->node/buffer

Needed because DT infrastructure depends on a real package named
"buffer" which ships its own types, which preempts lookup of the ambient
module "buffer" from node.

I don't think this will be needed for anything except for node and
particularly buffer, so I just added a single exception.

* improve comment

* fix element access lint
2021-05-28 09:05:57 -07:00
TypeScript Bot
a2ec5628f3 Format 2021-05-27 18:28:00 +00:00
Nathan Shively-Sanders
9e4d8b6c17 Require lowercase package names in notNeededPackages.json (#268)
* Require lowercase package names in notNeededPackages.json

This means we can't deprecate packages with uppercase letters, but I
don't think there are many on npm -- possibly none.

* fix mock data: not-needed libraryName for angular
2021-05-27 11:24:31 -07:00
Orta Therox
c3f9145372 If the module is a single dts file, show it in the README (#261)
* If the module is a single dts file, show it in the README

* Fix tests

* Put a size cap on the readme length

* Adds 4 backticks for the codeblock and links to the file
2021-05-20 18:47:07 +01:00
TypeScript Bot
4bdab7de7d Format 2021-05-13 16:31:34 +00:00
Nathan Shively-Sanders
4dcf82b758 Allow deleted files outside notNeededPackages entries (#253)
* Allow deleted files outside notNeededPackages entries

https://github.com/DefinitelyTyped/DefinitelyTyped/pull/52719 needs to
deprecate @types/socket.io@2 and in doing so modify its dependents. One
of its dependents needs to delete a file, but this isn't allowed
currently.

This changes it to be allowed. I'm not sure I've covered all the
interesting cases, so check whether the new code is now too permissive.

* fix whitespace lint
2021-05-13 09:28:51 -07:00
Federico Panico
11947b08c5 definition-parser: Show path of empty dir (#252)
When checkAllUsedRecur fails because of an empty directory, show the
full path to it. Currently "[Object object]" is printed to the terminal.

debugPath does not show path relative to current position, but relative
to root of project.
2021-05-12 10:57:36 -07:00
Andrew Branch
8df8eaee49 Fix unused path mapping detection for scoped packages (#232) 2021-04-08 11:46:05 -07:00
Federico Panico
05b41ea595 Fix: Allow /* in versioned mappings. (#231)
* definition-parser: Use scoped names when testing mappings for relative
imports.
* miscellany/utils: When removing version number, keeps wildcard at the
end of mapping.
* miscellany/utils: When checking the existence of a version number,
catch those packages that include a wildcard path mapping.

Co-authored-by: Federico Panico <federicopanico@gmail.com>
2021-04-08 10:17:38 -07:00
Andrew Branch
cd1f366341 [perf] Store major and minor versions separately, detect whether minor versions matter (#157)
* Store major and minor versions separately

* Update snapshot
2021-03-30 09:02:34 -07:00
Jack Bates
69e3a2b2f4 Move empty OTHER_FILES.txt check from dt-mergebot (#136) 2021-03-30 08:59:23 -07:00
Nathan Shively-Sanders
0c9257237f Allow passthrough anywhere. (#226)
Turns out that passthroughs need to be allowed anywhere.

Since you can only add passthroughs to `./node_modules`, you can only
add passthroughs to things in package.json, which means that that file
remains the security bottleneck.
2021-03-29 10:48:46 -07:00
Nathan Shively-Sanders
8cdbe73054 Allow ./node_modules passthrough in paths (#224)
* Allow ./node_modules passthrough in paths

I introduced a node_modules passthrough in webpack in
DefinitelyTyped/DefinitelyTyped#51712: the entire index.d.ts is

```ts
import webpack = require('./node_modules/webpack')
export = webpack
```

This allows @types/webpack@5 to delegate its entire type definition to
webpack@5, while still allowing @types/webpack@4 to be maintained on
DT.

However, the correct module specifier is actually just 'webpack', since
there's no guarantee of the exact location where webpack will be
installed. This can be made to compile on DT with a path mapping:

```json
"paths": {
    "webpack": [
        "./node_modules/webpack"
    ]
}
```

Previously, path mappings like this were not allowed. This PR allows
them.

* fix === lint
2021-03-29 10:07:29 -07:00
Andrew Branch
29bd7f2f33 Allow STORAGE_DIR environment variable to determine where files are written 2021-03-24 09:03:11 -07:00
Nathan Shively-Sanders
925652e8bf Cleanup NotNeededPackage[Raw] (#220)
* Cleanup NotNeededPackage[Raw]

Better construction interface
Also fix a lot of tests for some reason?

* remove temp notes
2021-03-23 09:46:14 -07:00
Andrew Branch
29ca889c0d Merge pull request #167 from jablko/patch-28
Make notNeededPackages.json an object
2021-03-22 15:13:28 -07:00
Federico
4738bf342f Fix path mapping not created for older scoped packages 2021-03-10 12:39:37 -03:00
Federico Panico
fd4be462c3 fix: parser fails with older scoped packages. (#208)
* fix: parser fails with older scoped packages.

Given a path mapping as

```
"paths": {
	"@ckeditor/ckeditor5-utils": [
		"ckeditor__ckeditor5-utils/v10"
	]
}
```

definitions-parser failed to understand that `/v10` is not part of the
package name, and that the key of the mapping must be a scoped name.

* Resolve PR comments

- add test coverage
- simplify implementation

* Add test in definition-parser

* Use scopedPackageName in Error for missing mapping

Co-authored-by: Piotr Błażejewicz <peterblazejewicz@users.noreply.github.com>
2021-03-05 13:59:19 -05:00
Andrew Branch
d19d55d334 Don’t cache allowedPackageJsonDependencies indefinitely 2021-01-04 10:00:38 -08:00
Jack Bates
d1b49560d6 Make notNeededPackages.json an object 2020-11-16 15:04:28 -07:00
Andrew Branch
6ea64a6333 Merge pull request #142 from jablko/patch-25
Use libraryName homepage for not-needed stub
2020-11-16 11:04:33 -08:00
Andrew Branch
097b0a9521 Merge pull request #148 from microsoft/bug/better-error-message-deleting-old-version
Improve error message when other package has a path mapping to a version you’re deleting
2020-11-02 09:31:05 -08:00
Andrew Branch
0a4c3496c4 Fix versions showing up as "*" all over the place 2020-10-30 15:16:40 -07:00
Andrew Branch
0aa87777b7 Improve error message when other package has a path mapping to a version you’re deleting 2020-10-29 16:12:43 -07:00
Andrew Branch
aec2e2b6ce Fix deleting old versions of packages 2020-10-29 13:21:42 -07:00
Jack Bates
22b761e9a8 Use libraryName homepage for not-needed stub 2020-10-27 12:01:37 -07:00
Nathan Shively-Sanders
0942edcc30 More logging of DT io in publisher (#129) 2020-10-05 09:03:18 -07:00