Update checked-in dependencies
This commit is contained in:
parent
11639426e6
commit
9a40cc5274
9 changed files with 95 additions and 75 deletions
20
node_modules/.package-lock.json
generated
vendored
20
node_modules/.package-lock.json
generated
vendored
|
|
@ -88,25 +88,25 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@ava/typescript": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-2.0.0.tgz",
|
||||
"integrity": "sha512-sn+upcMk81AMrlnx/hb/9T7gCGuBfw7hi+p79NPSSQMvY2G64mOB7qRaDExiHiZfZ7FN9j7HwQeFhHZLGD/NWQ==",
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/@ava/typescript/-/typescript-3.0.1.tgz",
|
||||
"integrity": "sha512-/JXIUuKsvkaneaiA9ckk3ksFTqvu0mDNlChASrTe2BnDsvMbhQdPWyqQjJ9WRJWVhhs5TWn1/0Pp1G6Rv8Syrw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"execa": "^5.0.0"
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"execa": "^5.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.22 <13 || >=14.16 <15 || >=15"
|
||||
"node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=17"
|
||||
}
|
||||
},
|
||||
"node_modules/@ava/typescript/node_modules/escape-string-regexp": {
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz",
|
||||
"integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==",
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-5.0.0.tgz",
|
||||
"integrity": "sha512-/veY75JbMK4j1yjvuUxuVsiS/hr/4iHs9FTT6cgTexxdE0Ly/glccBAkloH/DofkjRbZU3bnoj38mOmhkZ0lHw==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/sindresorhus"
|
||||
|
|
|
|||
9
node_modules/@ava/typescript/LICENSE
generated
vendored
Normal file
9
node_modules/@ava/typescript/LICENSE
generated
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Mark Wubben (https://novemberborn.net)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
16
node_modules/@ava/typescript/README.md
generated
vendored
16
node_modules/@ava/typescript/README.md
generated
vendored
|
|
@ -1,11 +1,21 @@
|
|||
# @ava/typescript
|
||||
|
||||
Adds [TypeScript](https://www.typescriptlang.org/) support to [AVA](https://avajs.dev).
|
||||
Adds [TypeScript](https://www.typescriptlang.org/) support to [AVA 4](https://avajs.dev).
|
||||
|
||||
This is designed to work for projects that precompile TypeScript. It allows AVA to load the compiled JavaScript, while configuring AVA to treat the TypeScript files as test files.
|
||||
|
||||
In other words, say you have a test file at `src/test.ts`. You've configured TypeScript to output to `build/`. Using `@ava/typescript` you can run the test using `npx ava src/test.ts`.
|
||||
|
||||
## For AVA 3 users
|
||||
|
||||
Use version 2:
|
||||
|
||||
```console
|
||||
npm install --save-dev @ava/typescript@2
|
||||
```
|
||||
|
||||
Note that v2 does not support ES modules. This requires v3 and AVA 4.
|
||||
|
||||
## Enabling TypeScript support
|
||||
|
||||
Add this package to your project:
|
||||
|
|
@ -39,6 +49,10 @@ Output files are expected to have the `.js` extension.
|
|||
|
||||
AVA searches your entire project for `*.js`, `*.cjs`, `*.mjs` and `*.ts` files (or other extensions you've configured). It will ignore such files found in the `rewritePaths` targets (e.g. `build/`). If you use more specific paths, for instance `build/main/`, you may need to change AVA's `files` configuration to ignore other directories.
|
||||
|
||||
## ES Modules
|
||||
|
||||
If your `package.json` has configured `"type": "module"`, or you've configured AVA to treat the `js` extension as `module`, then `@ava/typescript` will import the output file as an ES module. Note that this is based on the *output file*, not the `ts` extension.
|
||||
|
||||
## Add additional extensions
|
||||
|
||||
You can configure AVA to recognize additional file extensions. To add (partial†) JSX support:
|
||||
|
|
|
|||
66
node_modules/@ava/typescript/index.js
generated
vendored
66
node_modules/@ava/typescript/index.js
generated
vendored
|
|
@ -1,9 +1,10 @@
|
|||
'use strict';
|
||||
const path = require('path');
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
const execa = require('execa');
|
||||
const pkg = require('./package.json');
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import {pathToFileURL} from 'node:url';
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
import execa from 'execa';
|
||||
|
||||
const pkg = JSON.parse(fs.readFileSync(new URL('package.json', import.meta.url)));
|
||||
const help = `See https://github.com/avajs/typescript/blob/v${pkg.version}/README.md`;
|
||||
|
||||
function isPlainObject(x) {
|
||||
|
|
@ -44,7 +45,7 @@ const configProperties = {
|
|||
required: true,
|
||||
isValid(compile) {
|
||||
return compile === false || compile === 'tsc';
|
||||
}
|
||||
},
|
||||
},
|
||||
rewritePaths: {
|
||||
required: true,
|
||||
|
|
@ -53,23 +54,21 @@ const configProperties = {
|
|||
return false;
|
||||
}
|
||||
|
||||
return Object.entries(rewritePaths).every(([from, to]) => {
|
||||
return from.endsWith('/') && typeof to === 'string' && to.endsWith('/');
|
||||
});
|
||||
}
|
||||
return Object.entries(rewritePaths).every(([from, to]) => from.endsWith('/') && typeof to === 'string' && to.endsWith('/'));
|
||||
},
|
||||
},
|
||||
extensions: {
|
||||
required: false,
|
||||
isValid(extensions) {
|
||||
return Array.isArray(extensions) &&
|
||||
extensions.length > 0 &&
|
||||
extensions.every(ext => typeof ext === 'string' && ext !== '') &&
|
||||
new Set(extensions).size === extensions.length;
|
||||
}
|
||||
}
|
||||
return Array.isArray(extensions)
|
||||
&& extensions.length > 0
|
||||
&& extensions.every(ext => typeof ext === 'string' && ext !== '')
|
||||
&& new Set(extensions).size === extensions.length;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
module.exports = ({negotiateProtocol}) => {
|
||||
export default function typescriptProvider({negotiateProtocol}) {
|
||||
const protocol = negotiateProtocol(['ava-3.2'], {version: pkg.version});
|
||||
if (protocol === null) {
|
||||
return;
|
||||
|
|
@ -86,12 +85,12 @@ module.exports = ({negotiateProtocol}) => {
|
|||
const {
|
||||
extensions = ['ts'],
|
||||
rewritePaths: relativeRewritePaths,
|
||||
compile
|
||||
compile,
|
||||
} = config;
|
||||
|
||||
const rewritePaths = Object.entries(relativeRewritePaths).map(([from, to]) => [
|
||||
path.join(protocol.projectDir, from),
|
||||
path.join(protocol.projectDir, to)
|
||||
path.join(protocol.projectDir, to),
|
||||
]);
|
||||
const testFileExtension = new RegExp(`\\.(${extensions.map(ext => escapeStringRegexp(ext)).join('|')})$`);
|
||||
|
||||
|
|
@ -102,13 +101,13 @@ module.exports = ({negotiateProtocol}) => {
|
|||
}
|
||||
|
||||
return {
|
||||
extensions: extensions.slice(),
|
||||
rewritePaths: rewritePaths.slice()
|
||||
extensions: [...extensions],
|
||||
rewritePaths: [...rewritePaths],
|
||||
};
|
||||
},
|
||||
|
||||
get extensions() {
|
||||
return extensions.slice();
|
||||
return [...extensions];
|
||||
},
|
||||
|
||||
ignoreChange(filePath) {
|
||||
|
|
@ -139,18 +138,19 @@ module.exports = ({negotiateProtocol}) => {
|
|||
filePatterns: [
|
||||
...filePatterns,
|
||||
'!**/*.d.ts',
|
||||
...Object.values(relativeRewritePaths).map(to => `!${to}**`)
|
||||
...Object.values(relativeRewritePaths).map(to => `!${to}**`),
|
||||
],
|
||||
ignoredByWatcherPatterns: [
|
||||
...ignoredByWatcherPatterns,
|
||||
...Object.values(relativeRewritePaths).map(to => `${to}**/*.js.map`)
|
||||
]
|
||||
...Object.values(relativeRewritePaths).map(to => `${to}**/*.js.map`),
|
||||
],
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
},
|
||||
|
||||
worker({extensionsToLoadAsModules, state: {extensions, rewritePaths}}) {
|
||||
const useImport = extensionsToLoadAsModules.includes('js');
|
||||
const testFileExtension = new RegExp(`\\.(${extensions.map(ext => escapeStringRegexp(ext)).join('|')})$`);
|
||||
|
||||
return {
|
||||
|
|
@ -159,18 +159,12 @@ module.exports = ({negotiateProtocol}) => {
|
|||
},
|
||||
|
||||
async load(ref, {requireFn}) {
|
||||
for (const extension of extensionsToLoadAsModules) {
|
||||
if (ref.endsWith(`.${extension}`)) {
|
||||
throw new Error('@ava/typescript cannot yet load ESM files');
|
||||
}
|
||||
}
|
||||
|
||||
const [from, to] = rewritePaths.find(([from]) => ref.startsWith(from));
|
||||
// TODO: Support JSX preserve mode — https://www.typescriptlang.org/docs/handbook/jsx.html
|
||||
const rewritten = `${to}${ref.slice(from.length)}`.replace(testFileExtension, '.js');
|
||||
return requireFn(rewritten);
|
||||
}
|
||||
return useImport ? import(pathToFileURL(rewritten)) : requireFn(rewritten); // eslint-disable-line node/no-unsupported-features/es-syntax
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
|||
6
node_modules/@ava/typescript/node_modules/escape-string-regexp/index.d.ts
generated
vendored
6
node_modules/@ava/typescript/node_modules/escape-string-regexp/index.d.ts
generated
vendored
|
|
@ -5,7 +5,7 @@ You can also use this to escape a string that is inserted into the middle of a r
|
|||
|
||||
@example
|
||||
```
|
||||
import escapeStringRegexp = require('escape-string-regexp');
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
|
||||
const escapedString = escapeStringRegexp('How much $ for a 🦄?');
|
||||
//=> 'How much \\$ for a 🦄\\?'
|
||||
|
|
@ -13,6 +13,4 @@ const escapedString = escapeStringRegexp('How much $ for a 🦄?');
|
|||
new RegExp(escapedString);
|
||||
```
|
||||
*/
|
||||
declare const escapeStringRegexp: (string: string) => string;
|
||||
|
||||
export = escapeStringRegexp;
|
||||
export default function escapeStringRegexp(string: string): string;
|
||||
|
|
|
|||
8
node_modules/@ava/typescript/node_modules/escape-string-regexp/index.js
generated
vendored
8
node_modules/@ava/typescript/node_modules/escape-string-regexp/index.js
generated
vendored
|
|
@ -1,13 +1,11 @@
|
|||
'use strict';
|
||||
|
||||
module.exports = string => {
|
||||
export default function escapeStringRegexp(string) {
|
||||
if (typeof string !== 'string') {
|
||||
throw new TypeError('Expected a string');
|
||||
}
|
||||
|
||||
// Escape characters with special meaning either inside or outside character sets.
|
||||
// Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
||||
// Use a simple backslash escape when it’s always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
|
||||
return string
|
||||
.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
|
||||
.replace(/-/g, '\\x2d');
|
||||
};
|
||||
}
|
||||
|
|
|
|||
12
node_modules/@ava/typescript/node_modules/escape-string-regexp/package.json
generated
vendored
12
node_modules/@ava/typescript/node_modules/escape-string-regexp/package.json
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "escape-string-regexp",
|
||||
"version": "4.0.0",
|
||||
"version": "5.0.0",
|
||||
"description": "Escape RegExp special characters",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/escape-string-regexp",
|
||||
|
|
@ -10,8 +10,10 @@
|
|||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"type": "module",
|
||||
"exports": "./index.js",
|
||||
"engines": {
|
||||
"node": ">=10"
|
||||
"node": ">=12"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
|
|
@ -31,8 +33,8 @@
|
|||
"characters"
|
||||
],
|
||||
"devDependencies": {
|
||||
"ava": "^1.4.1",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.28.3"
|
||||
"ava": "^3.15.0",
|
||||
"tsd": "^0.14.0",
|
||||
"xo": "^0.38.2"
|
||||
}
|
||||
}
|
||||
4
node_modules/@ava/typescript/node_modules/escape-string-regexp/readme.md
generated
vendored
4
node_modules/@ava/typescript/node_modules/escape-string-regexp/readme.md
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
# escape-string-regexp [](https://travis-ci.org/sindresorhus/escape-string-regexp)
|
||||
# escape-string-regexp
|
||||
|
||||
> Escape RegExp special characters
|
||||
|
||||
|
|
@ -11,7 +11,7 @@ $ npm install escape-string-regexp
|
|||
## Usage
|
||||
|
||||
```js
|
||||
const escapeStringRegexp = require('escape-string-regexp');
|
||||
import escapeStringRegexp from 'escape-string-regexp';
|
||||
|
||||
const escapedString = escapeStringRegexp('How much $ for a 🦄?');
|
||||
//=> 'How much \\$ for a 🦄\\?'
|
||||
|
|
|
|||
29
node_modules/@ava/typescript/package.json
generated
vendored
29
node_modules/@ava/typescript/package.json
generated
vendored
|
|
@ -1,13 +1,17 @@
|
|||
{
|
||||
"name": "@ava/typescript",
|
||||
"version": "2.0.0",
|
||||
"version": "3.0.1",
|
||||
"description": "TypeScript provider for AVA",
|
||||
"engines": {
|
||||
"node": ">=12.22 <13 || >=14.16 <15 || >=15"
|
||||
"node": ">=12.22 <13 || >=14.17 <15 || >=16.4 <17 || >=17"
|
||||
},
|
||||
"files": [
|
||||
"index.js"
|
||||
],
|
||||
"exports": {
|
||||
".": "./index.js"
|
||||
},
|
||||
"type": "module",
|
||||
"author": "Mark Wubben (https://novemberborn.net)",
|
||||
"repository": "avajs/typescript",
|
||||
"license": "MIT",
|
||||
|
|
@ -19,15 +23,15 @@
|
|||
"test": "xo && c8 ava"
|
||||
},
|
||||
"dependencies": {
|
||||
"escape-string-regexp": "^4.0.0",
|
||||
"execa": "^5.0.0"
|
||||
"escape-string-regexp": "^5.0.0",
|
||||
"execa": "^5.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"ava": "^3.15.0",
|
||||
"c8": "^7.7.1",
|
||||
"ava": "4.0.0-rc.1",
|
||||
"c8": "^7.10.0",
|
||||
"del": "^6.0.0",
|
||||
"typescript": "^4.2.4",
|
||||
"xo": "^0.38.2"
|
||||
"typescript": "^4.4.4",
|
||||
"xo": "^0.46.3"
|
||||
},
|
||||
"c8": {
|
||||
"reporter": [
|
||||
|
|
@ -40,14 +44,15 @@
|
|||
"files": [
|
||||
"!test/broken-fixtures/**"
|
||||
],
|
||||
"ignoredByWatcher": [
|
||||
"test/fixtures/**",
|
||||
"test/broken-fixtures/**"
|
||||
],
|
||||
"timeout": "60s"
|
||||
},
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"test/broken-fixtures"
|
||||
],
|
||||
"rules": {
|
||||
"import/order": "off"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue