diff options
Diffstat (limited to 'cli/tests/testdata/npm/registry')
14 files changed, 133 insertions, 2 deletions
diff --git a/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/index.d.ts b/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/index.d.ts new file mode 100644 index 000000000..673c0035e --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/index.d.ts @@ -0,0 +1,6 @@ +// intentional type checking errors +export class Class1 extends Class2 { +} + +export class Class2 extends Class1 { +} diff --git a/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/index.js b/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/index.js new file mode 100644 index 000000000..7eb6b784d --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/index.js @@ -0,0 +1,6 @@ +module.exports = { + Class1: class { + }, + Class2: class { + }, +}; diff --git a/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/package.json new file mode 100644 index 000000000..295920a8f --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/check-error/1.0.0/package.json @@ -0,0 +1,5 @@ +{ + "name": "@denotest/check-error", + "version": "1.0.0", + "types": "./index.d.ts" +} diff --git a/cli/tests/testdata/npm/registry/@denotest/cjs-default-export/1.0.0/index.d.ts b/cli/tests/testdata/npm/registry/@denotest/cjs-default-export/1.0.0/index.d.ts new file mode 100644 index 000000000..90fdfe5f6 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/cjs-default-export/1.0.0/index.d.ts @@ -0,0 +1,6 @@ +export default function (): number; +export declare function named(): number; +declare class MyClass { + static someStaticMethod(): string; +} +export { MyClass }; diff --git a/cli/tests/testdata/npm/registry/@denotest/cjs-default-export/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/cjs-default-export/1.0.0/package.json index 4765d25d2..8da28b919 100644 --- a/cli/tests/testdata/npm/registry/@denotest/cjs-default-export/1.0.0/package.json +++ b/cli/tests/testdata/npm/registry/@denotest/cjs-default-export/1.0.0/package.json @@ -1,4 +1,5 @@ { "name": "@denotest/cjs-default-export", - "version": "1.0.0" + "version": "1.0.0", + "types": "./index.d.ts" } diff --git a/cli/tests/testdata/npm/registry/@denotest/esm-import-cjs-default/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/esm-import-cjs-default/1.0.0/package.json index 184076799..f757a08fb 100644 --- a/cli/tests/testdata/npm/registry/@denotest/esm-import-cjs-default/1.0.0/package.json +++ b/cli/tests/testdata/npm/registry/@denotest/esm-import-cjs-default/1.0.0/package.json @@ -1,6 +1,7 @@ { "name": "@denotest/esm-import-cjs-default", "version": "1.0.0", + "main": "index.mjs", "dependencies": { "@denotest/cjs-default-export": "^1.0.0" } diff --git a/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.d.ts b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.d.ts new file mode 100644 index 000000000..ee03712dd --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.d.ts @@ -0,0 +1,13 @@ +declare const tempGlobalThis: typeof globalThis; +declare const tempGlobal: typeof global; +declare const tempProcess: typeof process; +export { + tempGlobalThis as globalThis, + tempGlobal as global, + tempProcess as process, +}; + +type AssertTrue<T extends true> = never; +type _TestHasProcessGlobal = AssertTrue< + typeof globalThis extends { process: any } ? true : false +>; diff --git a/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js index be5e6e5ac..50d2d3d2a 100644 --- a/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js +++ b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/index.js @@ -1,2 +1,3 @@ exports.globalThis = globalThis; exports.global = global; +exports.process = process; diff --git a/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/package.json index cba0742c1..1ce42ded4 100644 --- a/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/package.json +++ b/cli/tests/testdata/npm/registry/@denotest/globals/1.0.0/package.json @@ -1,4 +1,5 @@ { "name": "@denotest/globals", - "version": "1.0.0" + "version": "1.0.0", + "types": "index.d.ts" } diff --git a/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/index.d.ts b/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/index.d.ts new file mode 100644 index 000000000..fc2199884 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/index.d.ts @@ -0,0 +1,10 @@ +// Some packages do this. It's really not ideal because instead of allowing +// the package to be resolved at any specifier, it instead expects the package +// to be resolved via a "@denotest/types-ambient" specifier. To make this work, +// we've currently modified the typescript compiler to check for any "<package-name>" +// ambient modules when resolving an npm specifier at "npm:<package-name>" +declare module "@denotest/types-ambient" { + class Test { + prop: number; + } +} diff --git a/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/index.js b/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/index.js new file mode 100644 index 000000000..47ff7adb2 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/index.js @@ -0,0 +1,3 @@ +export class Test { + prop = 5; +} diff --git a/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/package.json b/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/package.json new file mode 100644 index 000000000..ef927cbe3 --- /dev/null +++ b/cli/tests/testdata/npm/registry/@denotest/types-ambient/1.0.0/package.json @@ -0,0 +1,5 @@ +{ + "name": "@denotest/types-ambient", + "version": "1.0.0", + "types": "./index.d.ts" +} diff --git a/cli/tests/testdata/npm/registry/@types/node/node-18.8.2.tgz b/cli/tests/testdata/npm/registry/@types/node/node-18.8.2.tgz Binary files differnew file mode 100644 index 000000000..8afc9d21d --- /dev/null +++ b/cli/tests/testdata/npm/registry/@types/node/node-18.8.2.tgz diff --git a/cli/tests/testdata/npm/registry/@types/node/registry.json b/cli/tests/testdata/npm/registry/@types/node/registry.json new file mode 100644 index 000000000..3fff1578e --- /dev/null +++ b/cli/tests/testdata/npm/registry/@types/node/registry.json @@ -0,0 +1,73 @@ +{ + "_id": "@types/node", + "_rev": "8944-025a921c7561ec7339c70b87995cb358", + "name": "@types/node", + "description": "TypeScript definitions for Node.js", + "dist-tags": { + "latest": "18.8.2" + }, + "versions": { + "18.8.2": { + "name": "@types/node", + "version": "18.8.2", + "description": "TypeScript definitions for Node.js", + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", + "license": "MIT", + "contributors": [ + ], + "main": "", + "types": "index.d.ts", + "typesVersions": { "<4.9.0-0": { "*": ["ts4.8/*"] } }, + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/node" + }, + "scripts": {}, + "dependencies": {}, + "typesPublisherContentHash": "034172ea945b66afc6502e6be34d6fb957c596091e39cf43672e8aca563a8c66", + "typeScriptVersion": "4.1", + "_id": "@types/node@18.8.2", + "dist": { + "integrity": "sha512-cRMwIgdDN43GO4xMWAfJAecYn8wV4JbsOGHNfNUIDiuYkUYAR5ec4Rj7IO2SAhFPEfpPtLtUTbbny/TCT7aDwA==", + "shasum": "17d42c6322d917764dd3d2d3a10d7884925de067", + "tarball": "http://localhost:4545/npm/registry/@types/node/node-18.8.2.tgz", + "fileCount": 124, + "unpackedSize": 3524549, + "signatures": [ + { + "keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA", + "sig": "MEYCIQCAqI3XibndhBD647C/13AFb58Fhmg4WmfCoGrIYrgtzwIhAIB0b0D58Tigwb3qKaOVsKnuYOOr0strAmprZSCi/+oq" + } + ], + "npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjPFItACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmrKAg/+IwaUWPgePlO4IxW7CVhFEEFiyhjEH3FHe0ogC3YmreoBFv/A\r\nPwQrwObdskbGWrBzsAOVFvhzYktzP3kc857HtU2ia9FXeaEYvsSQBqh6jZfA\r\njR1+h+jn+W5JnmbnwRGfNn2riCo/un4tYoZ4o/bKiMdNd9WrdIs0Oii1Dd4N\r\nnsBXPb05UPPP4Uu8cz68u1bj+QQ6aslr6keGNyNeILf8bJsEfcfVkEO3l4cu\r\njyTIrxiD+tM8jrUE9CDeodF8CZNuvLh3hqdMPJeH3U47qkDtPDKEOvZTbyYm\r\ngodto6mcnuBr8F9vmikAQfGiXV0U2cg2XRjWc1lI8HT4X0kESTIo+nzNuliD\r\niTpfjyZHdKBGGIuHP1Ou9dVvx4t5XZ1JsK9EK5WTilvAlu/qZrynxXxAV3Rc\r\nvL9UhIacISprMWB3Sohl9ZtfcmGnV/KMRpM+yPZOWp39gQQCKaKF/j2f/mir\r\n8YFbFUnySZkXKzxgsgjrSsh9QiK2dYAzcqHlazITeFN9jOYRzYUjAFj3qOFm\r\n7o1eJpW0qM5vgR+fPq30WxcdcQ4PaWgHSlb/ll8hiwQG1ZUihO/1RU7FtDoc\r\n1KwcfrGOAJPL6vBSLPReUkhDIUTSBwfmvfMxzqD1aDp6YV5WX7h03B0dWbPJ\r\nmPJmJZjjZje4Trk9jBJ5/ZLpB8/zkrDKvhE=\r\n=LPWa\r\n-----END PGP SIGNATURE-----\r\n" + }, + "_npmUser": { "name": "types", "email": "ts-npm-types@microsoft.com" }, + "directories": {}, + "maintainers": [ + { "name": "types", "email": "ts-npm-types@microsoft.com" } + ], + "_npmOperationalInternal": { + "host": "s3://npm-registry-packages", + "tmp": "tmp/node_18.8.2_1664897581729_0.9746861340465625" + }, + "_hasShrinkwrap": false + } + }, + "readme": "[object Object]", + "maintainers": [{ "name": "types", "email": "ts-npm-types@microsoft.com" }], + "time": { + "18.8.2": "2022-10-04T15:33:01.913Z" + }, + "license": "MIT", + "readmeFilename": "", + "repository": { + "type": "git", + "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", + "directory": "types/node" + }, + "users": { + }, + "contributors": [], + "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node" +} |