This commit is contained in:
Pavel Feldman 2022-08-08 08:54:56 -07:00 коммит произвёл GitHub
Родитель d21f06d650
Коммит a2e05bb419
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
6 изменённых файлов: 90 добавлений и 14 удалений

Просмотреть файл

@ -137,6 +137,7 @@ This project incorporates components from the projects listed below. The origina
- source-map-support@0.5.21 (https://github.com/evanw/node-source-map-support)
- source-map@0.6.1 (https://github.com/mozilla/source-map)
- stack-utils@2.0.5 (https://github.com/tapjs/stack-utils)
- stoppable@1.1.0 (https://github.com/hunterloftis/stoppable)
- supports-color@5.5.0 (https://github.com/chalk/supports-color)
- supports-color@7.2.0 (https://github.com/chalk/supports-color)
- to-fast-properties@2.0.0 (https://github.com/sindresorhus/to-fast-properties)
@ -3931,6 +3932,32 @@ THE SOFTWARE.
=========================================
END OF stack-utils@2.0.5 AND INFORMATION
%% stoppable@1.1.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
The MIT License (MIT)
Copyright (c) 2017 Hunter Loftis <hunter@hunterloftis.com>
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.
=========================================
END OF stoppable@1.1.0 AND INFORMATION
%% supports-color@5.5.0 NOTICES AND INFORMATION BEGIN HERE
=========================================
MIT License
@ -4002,6 +4029,6 @@ END OF to-regex-range@5.0.1 AND INFORMATION
SUMMARY BEGIN HERE
=========================================
Total Packages: 137
Total Packages: 138
=========================================
END OF SUMMARY

Просмотреть файл

@ -11,12 +11,20 @@
"json5": "2.2.1",
"open": "8.4.0",
"pirates": "4.0.4",
"source-map-support": "0.5.21"
"source-map-support": "0.5.21",
"stoppable": "^1.1.0"
},
"devDependencies": {
"@types/source-map-support": "^0.5.4"
"@types/source-map-support": "^0.5.4",
"@types/stoppable": "^1.1.1"
}
},
"node_modules/@types/node": {
"version": "18.6.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.4.tgz",
"integrity": "sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg==",
"dev": true
},
"node_modules/@types/source-map-support": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.5.4.tgz",
@ -26,6 +34,15 @@
"source-map": "^0.6.0"
}
},
"node_modules/@types/stoppable": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/stoppable/-/stoppable-1.1.1.tgz",
"integrity": "sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@ -115,9 +132,24 @@
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"node_modules/stoppable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
"integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw==",
"engines": {
"node": ">=4",
"npm": ">=6"
}
}
},
"dependencies": {
"@types/node": {
"version": "18.6.4",
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.6.4.tgz",
"integrity": "sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg==",
"dev": true
},
"@types/source-map-support": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/@types/source-map-support/-/source-map-support-0.5.4.tgz",
@ -127,6 +159,15 @@
"source-map": "^0.6.0"
}
},
"@types/stoppable": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/stoppable/-/stoppable-1.1.1.tgz",
"integrity": "sha512-b8N+fCADRIYYrGZOcmOR8ZNBOqhktWTB/bMUl5LvGtT201QKJZOOH5UsFyI3qtteM6ZAJbJqZoBcLqqxKIwjhw==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"buffer-from": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
@ -183,6 +224,11 @@
"buffer-from": "^1.0.0",
"source-map": "^0.6.0"
}
},
"stoppable": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/stoppable/-/stoppable-1.1.0.tgz",
"integrity": "sha512-KXDYZ9dszj6bzvnEMRYvxgeTHU74QBFL54XKtP3nyMuJ81CFYtABZ3bAzL2EdFUaEwJOBOgENyFj3R7oTzDyyw=="
}
}
}

Просмотреть файл

@ -12,9 +12,11 @@
"json5": "2.2.1",
"open": "8.4.0",
"pirates": "4.0.4",
"source-map-support": "0.5.21"
"source-map-support": "0.5.21",
"stoppable": "^1.1.0"
},
"devDependencies": {
"@types/source-map-support": "^0.5.4"
"@types/source-map-support": "^0.5.4",
"@types/stoppable": "^1.1.1"
}
}

Просмотреть файл

@ -25,3 +25,6 @@ export const pirates = piratesLibrary;
import sourceMapSupportLibrary from 'source-map-support';
export const sourceMapSupport = sourceMapSupportLibrary;
import stoppableLibrary from 'stoppable';
export const stoppable = stoppableLibrary;

Просмотреть файл

@ -17,16 +17,17 @@
import fs from 'fs';
import type { Suite } from '../../types/testReporter';
import path from 'path';
import type { InlineConfig, Plugin, PreviewServer } from 'vite';
import type { InlineConfig, Plugin } from 'vite';
import type { TestRunnerPlugin } from '.';
import { parse, traverse, types as t } from '../babelBundle';
import { stoppable } from '../utilsBundle';
import type { ComponentInfo } from '../tsxTransform';
import { collectComponentUsages, componentInfo } from '../tsxTransform';
import type { FullConfig } from '../types';
import { assert, calculateSha1 } from 'playwright-core/lib/utils';
import type { AddressInfo } from 'net';
let previewServer: PreviewServer;
let stoppableServer: any;
const VERSION = 6;
type CtConfig = {
@ -135,7 +136,8 @@ export function createPlugin(
}
if (hasNewTests || hasNewComponents || sourcesDirty)
await fs.promises.writeFile(buildInfoFile, JSON.stringify(buildInfo, undefined, 2));
previewServer = await preview(viteConfig);
const previewServer = await preview(viteConfig);
stoppableServer = stoppable(previewServer.httpServer, 0);
const isAddressInfo = (x: any): x is AddressInfo => x?.address;
const address = previewServer.httpServer.address();
if (isAddressInfo(address))
@ -143,12 +145,7 @@ export function createPlugin(
},
teardown: async () => {
await new Promise<void>((f, r) => previewServer.httpServer.close(err => {
if (err)
r(err);
else
f();
}));
await new Promise(f => stoppableServer.stop(f));
},
};
}

Просмотреть файл

@ -18,3 +18,4 @@ export const json5: typeof import('../bundles/utils/node_modules/json5') = requi
export const open: typeof import('../bundles/utils/node_modules/open') = require('./utilsBundleImpl').open;
export const pirates: typeof import('../bundles/utils/node_modules/pirates') = require('./utilsBundleImpl').pirates;
export const sourceMapSupport: typeof import('../bundles/utils/node_modules/@types/source-map-support') = require('./utilsBundleImpl').sourceMapSupport;
export const stoppable: typeof import('../bundles/utils/node_modules/@types/stoppable') = require('./utilsBundleImpl').stoppable;