diff --git a/.vscode/settings.json b/.vscode/settings.json index e2ee50d2d..ba9a42434 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,10 +1,9 @@ - { - "eslint.nodePath": "node_modules", + "eslint.nodePath": ".yarn/sdks", "eslint.runtime": "node", "typescript.format.enable": true, "typescript.validate.enable": true, - "typescript.tsdk": "./node_modules/typescript/lib", + "typescript.tsdk": "./.yarn/sdks/typescript/lib", "editor.defaultFormatter": "esbenp.prettier-vscode", "[javascript]": { "editor.defaultFormatter": "dbaeumer.vscode-eslint" @@ -23,5 +22,10 @@ ], "editor.codeActionsOnSave": { "source.fixAll.eslint": true - } + }, + "search.exclude": { + "**/.yarn": true, + "**/.pnp.*": true + }, + "prettier.prettierPath": ".yarn/sdks/prettier/index.js" } diff --git a/.yarn/sdks/eslint/bin/eslint.js b/.yarn/sdks/eslint/bin/eslint.js new file mode 100644 index 000000000..4d327a49a --- /dev/null +++ b/.yarn/sdks/eslint/bin/eslint.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +const {existsSync} = require(`fs`); +const {createRequire, createRequireFromPath} = require(`module`); +const {resolve} = require(`path`); + +const relPnpApiPath = "../../../../.pnp.cjs"; + +const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require eslint/bin/eslint.js + require(absPnpApiPath).setup(); + } +} + +// Defer to the real eslint/bin/eslint.js your application uses +module.exports = absRequire(`eslint/bin/eslint.js`); diff --git a/.yarn/sdks/eslint/package.json b/.yarn/sdks/eslint/package.json new file mode 100644 index 000000000..190b0383d --- /dev/null +++ b/.yarn/sdks/eslint/package.json @@ -0,0 +1,6 @@ +{ + "name": "eslint", + "version": "8.19.0-sdk", + "main": "./lib/api.js", + "type": "commonjs" +} diff --git a/.yarn/sdks/integrations.yml b/.yarn/sdks/integrations.yml new file mode 100644 index 000000000..aa9d0d0ad --- /dev/null +++ b/.yarn/sdks/integrations.yml @@ -0,0 +1,5 @@ +# This file is automatically generated by @yarnpkg/sdks. +# Manual changes might be lost! + +integrations: + - vscode diff --git a/.yarn/sdks/prettier/index.js b/.yarn/sdks/prettier/index.js new file mode 100644 index 000000000..f6882d809 --- /dev/null +++ b/.yarn/sdks/prettier/index.js @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +const {existsSync} = require(`fs`); +const {createRequire, createRequireFromPath} = require(`module`); +const {resolve} = require(`path`); + +const relPnpApiPath = "../../../.pnp.cjs"; + +const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require prettier/index.js + require(absPnpApiPath).setup(); + } +} + +// Defer to the real prettier/index.js your application uses +module.exports = absRequire(`prettier/index.js`); diff --git a/.yarn/sdks/prettier/package.json b/.yarn/sdks/prettier/package.json new file mode 100644 index 000000000..b61805cee --- /dev/null +++ b/.yarn/sdks/prettier/package.json @@ -0,0 +1,6 @@ +{ + "name": "prettier", + "version": "2.7.1-sdk", + "main": "./index.js", + "type": "commonjs" +} diff --git a/.yarn/sdks/typescript/bin/tsc b/.yarn/sdks/typescript/bin/tsc new file mode 100644 index 000000000..5608e5743 --- /dev/null +++ b/.yarn/sdks/typescript/bin/tsc @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +const {existsSync} = require(`fs`); +const {createRequire, createRequireFromPath} = require(`module`); +const {resolve} = require(`path`); + +const relPnpApiPath = "../../../../.pnp.cjs"; + +const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require typescript/bin/tsc + require(absPnpApiPath).setup(); + } +} + +// Defer to the real typescript/bin/tsc your application uses +module.exports = absRequire(`typescript/bin/tsc`); diff --git a/.yarn/sdks/typescript/bin/tsserver b/.yarn/sdks/typescript/bin/tsserver new file mode 100644 index 000000000..cd7d557d5 --- /dev/null +++ b/.yarn/sdks/typescript/bin/tsserver @@ -0,0 +1,20 @@ +#!/usr/bin/env node + +const {existsSync} = require(`fs`); +const {createRequire, createRequireFromPath} = require(`module`); +const {resolve} = require(`path`); + +const relPnpApiPath = "../../../../.pnp.cjs"; + +const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absRequire = (createRequire || createRequireFromPath)(absPnpApiPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require typescript/bin/tsserver + require(absPnpApiPath).setup(); + } +} + +// Defer to the real typescript/bin/tsserver your application uses +module.exports = absRequire(`typescript/bin/tsserver`); diff --git a/.yarn/sdks/typescript/package.json b/.yarn/sdks/typescript/package.json new file mode 100644 index 000000000..b117d6ab1 --- /dev/null +++ b/.yarn/sdks/typescript/package.json @@ -0,0 +1,6 @@ +{ + "name": "typescript", + "version": "4.7.4-sdk", + "main": "./lib/typescript.js", + "type": "commonjs" +} diff --git a/.yarnrc.yml b/.yarnrc.yml index 887c16b04..395088834 100644 --- a/.yarnrc.yml +++ b/.yarnrc.yml @@ -2,7 +2,8 @@ changesetIgnorePatterns: - "**/__tests__/**" - "**/*.md" -nodeLinker: node-modules +nodeLinker: pnp +pnpEnableEsmLoader: true plugins: - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs diff --git a/examples/typescript/tsconfig.json b/examples/typescript/tsconfig.json index 152af3c59..cf0fa1a36 100644 --- a/examples/typescript/tsconfig.json +++ b/examples/typescript/tsconfig.json @@ -47,16 +47,17 @@ "@standard-endpoint/github/*": ["github/*"] } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */, //"rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ - "typeRoots": [ + /*"typeRoots": [ "node_modules/@types", "../../node_modules/@types", "./src/typings" - ] /* List of folders to include type definitions from. */, + ] List of folders to include type definitions from. ,*/ "types": [ "jest", "@anansi/webpack-config/types", - "node" + "node", + "./src/typings" ] /* Type declaration files to be included in compilation. */, "allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */, "esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */, diff --git a/packages/jest-preset-anansi/src/jest-preset.ts b/packages/jest-preset-anansi/src/jest-preset.ts index 1bd8ab5b3..f3a78a76d 100644 --- a/packages/jest-preset-anansi/src/jest-preset.ts +++ b/packages/jest-preset-anansi/src/jest-preset.ts @@ -53,7 +53,7 @@ module.exports = { '/node_modules/(?!@babel/runtime)', '\\.pnp\\.[^\\/]+$', ], - resolver: require.resolve(`jest-pnp-resolver`), + resolver: require.resolve(`./resolver`), testRegex: '(/__tests__/.*|(\\.|/)(test|spec))\\.(m|c)?(j|t)sx?$', coveragePathIgnorePatterns: ['node_modules'], moduleFileExtensions: [ diff --git a/packages/jest-preset-anansi/src/resolver.ts b/packages/jest-preset-anansi/src/resolver.ts new file mode 100644 index 000000000..4362ce6a8 --- /dev/null +++ b/packages/jest-preset-anansi/src/resolver.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/no-var-requires */ +const pnpResolve = require('jest-pnp-resolver'); +const path = require('path'); + +module.exports = (request: string, options: Record) => { + if ( + options.paths && + Array.isArray(options.paths) && + !['.', '/'].includes(request[0]) + ) { + for (const rootPath of options.paths) { + try { + const p = path.join(rootPath, request); + return require.resolve(p); + // eslint-disable-next-line no-empty + } catch (e) {} + } + } + + return pnpResolve(request, options); +}; diff --git a/yarn.lock b/yarn.lock index 3e42a463d..598a6559a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4948,7 +4948,7 @@ __metadata: languageName: node linkType: hard -"@rest-hooks/redux@npm:6.3.6, @rest-hooks/redux@npm:^6.3.5": +"@rest-hooks/redux@npm:6.3.6": version: 6.3.6 resolution: "@rest-hooks/redux@npm:6.3.6" dependencies: @@ -4966,6 +4966,24 @@ __metadata: languageName: node linkType: hard +"@rest-hooks/redux@npm:^6.3.5": + version: 6.3.5 + resolution: "@rest-hooks/redux@npm:6.3.5" + dependencies: + "@babel/runtime": ^7.17.0 + "@rest-hooks/core": ^4.2.9 + peerDependencies: + "@rest-hooks/react": ^0.1.0 || ^0.2.0 || ^6.0.0 || ^7.0.0 + "@types/react": ^16.8.4 || ^17.0.0 || ^18.0.0 + react: ^16.8.4 || ^17.0.0 || ^18.0.0 + redux: ^4.0.0 + peerDependenciesMeta: + "@types/react": + optional: true + checksum: 83801b853bfaf9f85ac2af6ff912b41f2f1c20ea8599570f39812c6860ab5c70db5964890c1018f95300736ad34679f7b0a8d5e5fa27f866a9048db237cca676 + languageName: node + linkType: hard + "@rest-hooks/rest@npm:6.3.12": version: 6.3.12 resolution: "@rest-hooks/rest@npm:6.3.12" @@ -7228,9 +7246,9 @@ __metadata: linkType: hard "@types/unist@npm:*, @types/unist@npm:^2.0.0": - version: 2.0.6 - resolution: "@types/unist@npm:2.0.6" - checksum: 25cb860ff10dde48b54622d58b23e66214211a61c84c0f15f88d38b61aa1b53d4d46e42b557924a93178c501c166aa37e28d7f6d994aba13d24685326272d5db + version: 2.0.3 + resolution: "@types/unist@npm:2.0.3" + checksum: 4427306b094561da28164e7e5250c4e6b382cb8eac40bf7e6bb0ff1e6e00c13e47aaf32e4a08fc8ba54602d07f79a39fb9ba304cc9dc886b1e3caf824649edbd languageName: node linkType: hard @@ -7388,19 +7406,19 @@ __metadata: version: 5.56.0 resolution: "@typescript-eslint/type-utils@npm:5.56.0" dependencies: - "@typescript-eslint/typescript-estree": 5.56.0 - "@typescript-eslint/utils": 5.56.0 - debug: ^4.3.4 - tsutils: ^3.21.0 - peerDependencies: - eslint: "*" - peerDependenciesMeta: - typescript: - optional: true + "@typescript-eslint/types": 5.23.0 + "@typescript-eslint/visitor-keys": 5.23.0 checksum: 3dd1fcfadad18790b900a3d90f6617904adb6b0e2bd1e1edb6ebf239e1399865ca9098647405385feb4252d8b2b4577883e6fd3ef8d00bdd521d6070972d486b languageName: node linkType: hard +"@typescript-eslint/types@npm:5.23.0": + version: 5.23.0 + resolution: "@typescript-eslint/types@npm:5.23.0" + checksum: 96ae3e80cfae7b34f2846db692c31fb1804bf9651bce1d29f2eb8ae4c763d22f3283adc02dedeebd7cf70e4d8be54ec7f6ca593e03cdca26c791207e7556c2c1 + languageName: node + linkType: hard + "@typescript-eslint/types@npm:5.56.0": version: 5.56.0 resolution: "@typescript-eslint/types@npm:5.56.0" @@ -7444,6 +7462,16 @@ __metadata: languageName: node linkType: hard +"@typescript-eslint/visitor-keys@npm:5.23.0": + version: 5.23.0 + resolution: "@typescript-eslint/visitor-keys@npm:5.23.0" + dependencies: + "@typescript-eslint/types": 5.23.0 + eslint-visitor-keys: ^3.0.0 + checksum: 322e10d52a985e8a90d3612bb9d09a87dc64fc4cb1248484f1a9a7a98f65d3ef65a465ce868773a4939e35fa3b726ad609dac5a168efd7eaca4b06df33e965e3 + languageName: node + linkType: hard + "@typescript-eslint/visitor-keys@npm:5.56.0": version: 5.56.0 resolution: "@typescript-eslint/visitor-keys@npm:5.56.0" @@ -10298,10 +10326,10 @@ __metadata: dependencies: dot-prop: ^5.2.0 graceful-fs: ^4.1.2 - make-dir: ^3.0.0 - unique-string: ^2.0.0 - write-file-atomic: ^3.0.0 - xdg-basedir: ^4.0.0 + make-dir: ^1.0.0 + unique-string: ^1.0.0 + write-file-atomic: ^2.0.0 + xdg-basedir: ^3.0.0 checksum: 60ef65d493b63f96e14b11ba7ec072fdbf3d40110a94fb7199d1c287761bdea5c5244e76b2596325f30c1b652213aa75de96ea20afd4a5f82065e61ea090988e languageName: node linkType: hard @@ -10735,6 +10763,13 @@ __metadata: languageName: node linkType: hard +"crypto-random-string@npm:^1.0.0": + version: 1.0.0 + resolution: "crypto-random-string@npm:1.0.0" + checksum: 6fc61a46c18547b49a93da24f4559c4a1c859f4ee730ecc9533c1ba89fa2a9e9d81f390c2789467afbbd0d1c55a6e96a71e4716b6cd3e77736ed5fced7a2df9a + languageName: node + linkType: hard + "crypto-random-string@npm:^2.0.0": version: 2.0.0 resolution: "crypto-random-string@npm:2.0.0" @@ -11897,7 +11932,17 @@ __metadata: languageName: node linkType: hard -"enhanced-resolve@npm:^5.10.0, enhanced-resolve@npm:^5.12.0, enhanced-resolve@npm:^5.3.1, enhanced-resolve@npm:^5.7.0": +"enhanced-resolve@npm:^5.10.0, enhanced-resolve@npm:^5.3.1, enhanced-resolve@npm:^5.7.0": + version: 5.10.0 + resolution: "enhanced-resolve@npm:5.10.0" + dependencies: + graceful-fs: ^4.2.4 + tapable: ^2.2.0 + checksum: 0bb9830704db271610f900e8d79d70a740ea16f251263362b0c91af545576d09fe50103496606c1300a05e588372d6f9780a9bc2e30ce8ef9b827ec8f44687ff + languageName: node + linkType: hard + +"enhanced-resolve@npm:^5.12.0": version: 5.12.0 resolution: "enhanced-resolve@npm:5.12.0" dependencies: @@ -12450,7 +12495,7 @@ __metadata: languageName: node linkType: hard -"eslint-visitor-keys@npm:^3.1.0, eslint-visitor-keys@npm:^3.3.0": +"eslint-visitor-keys@npm:^3.0.0, eslint-visitor-keys@npm:^3.1.0, eslint-visitor-keys@npm:^3.3.0": version: 3.3.0 resolution: "eslint-visitor-keys@npm:3.3.0" checksum: d59e68a7c5a6d0146526b0eec16ce87fbf97fe46b8281e0d41384224375c4e52f5ffb9e16d48f4ea50785cde93f766b0c898e31ab89978d88b0e1720fbfb7808 @@ -17357,6 +17402,15 @@ __metadata: languageName: node linkType: hard +"make-dir@npm:^1.0.0": + version: 1.3.0 + resolution: "make-dir@npm:1.3.0" + dependencies: + pify: ^3.0.0 + checksum: c564f6e7bb5ace1c02ad56b3a5f5e07d074af0c0b693c55c7b2c2b148882827c8c2afc7b57e43338a9f90c125b58d604e8cf3e6990a48bf949dfea8c79668c0b + languageName: node + linkType: hard + "make-dir@npm:^2.0.0, make-dir@npm:^2.1.0": version: 2.1.0 resolution: "make-dir@npm:2.1.0" @@ -17770,7 +17824,7 @@ __metadata: languageName: node linkType: hard -"memfs@npm:^3.1.2, memfs@npm:^3.4.1, memfs@npm:^3.4.13": +"memfs@npm:^3.1.2, memfs@npm:^3.4.1, memfs@npm:^3.4.13, memfs@npm:^3.4.3": version: 3.4.13 resolution: "memfs@npm:3.4.13" dependencies: @@ -18235,7 +18289,16 @@ __metadata: languageName: node linkType: hard -"mime-types@npm:^2.1.12, mime-types@npm:^2.1.25, mime-types@npm:^2.1.27, mime-types@npm:^2.1.31, mime-types@npm:~2.1.17, mime-types@npm:~2.1.24, mime-types@npm:~2.1.34": +"mime-types@npm:^2.1.12, mime-types@npm:^2.1.27, mime-types@npm:^2.1.31, mime-types@npm:~2.1.17, mime-types@npm:~2.1.24": + version: 2.1.32 + resolution: "mime-types@npm:2.1.32" + dependencies: + mime-db: 1.52.0 + checksum: 4487dfd2f872126d2c219ec731ad47a6169a438d5a4cce6ecef7594ce08eaefaf0d85429485a76ec005f095016c7ec488a24cf8bfcc0ea06de0355e23395746f + languageName: node + linkType: hard + +"mime-types@npm:^2.1.25, mime-types@npm:~2.1.34": version: 2.1.35 resolution: "mime-types@npm:2.1.35" dependencies: @@ -25771,6 +25834,15 @@ __metadata: languageName: node linkType: hard +"unique-string@npm:^1.0.0": + version: 1.0.0 + resolution: "unique-string@npm:1.0.0" + dependencies: + crypto-random-string: ^1.0.0 + checksum: 588f16bd4ec99b5130f237793d1a5694156adde20460366726573238e41e93b739b87987e863792aeb2392b26f8afb292490ace119c82ed12c46816c9c859f5f + languageName: node + linkType: hard + "unique-string@npm:^2.0.0": version: 2.0.0 resolution: "unique-string@npm:2.0.0" @@ -26428,7 +26500,7 @@ __metadata: resolution: "webpack-dev-middleware@npm:5.3.1" dependencies: colorette: ^2.0.10 - memfs: ^3.4.1 + memfs: ^3.4.3 mime-types: ^2.1.31 range-parser: ^1.2.1 schema-utils: ^4.0.0 @@ -26854,7 +26926,7 @@ __metadata: languageName: node linkType: hard -"write-file-atomic@npm:^2.3.0, write-file-atomic@npm:^2.4.2": +"write-file-atomic@npm:^2.0.0, write-file-atomic@npm:^2.3.0, write-file-atomic@npm:^2.4.2": version: 2.4.3 resolution: "write-file-atomic@npm:2.4.3" dependencies: @@ -26975,6 +27047,13 @@ __metadata: languageName: node linkType: hard +"xdg-basedir@npm:^3.0.0": + version: 3.0.0 + resolution: "xdg-basedir@npm:3.0.0" + checksum: 60d613dcb09b1198c70cb442979825531c605ac7861a8a6131304207d2962020dbb23660ac7e1be324fb9e4111a51a6206d875148d3e98df47a7d1869fa1515f + languageName: node + linkType: hard + "xdg-basedir@npm:^4.0.0": version: 4.0.0 resolution: "xdg-basedir@npm:4.0.0"