mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
fix types
This commit is contained in:
7 files changed
+11
-18
No files matched your search
@@ -8,8 +8,6 @@ if (process.env.npm_execpath?.includes('yarn')) {
|
||||
}
|
||||
}
|
||||
|
||||
const dir = path.dirname(path.dirname(require.resolve('@types/node/package.json')));
|
||||
const types = fs.readdirSync(dir).filter((i) => !['sharedworker', 'serviceworker'].includes(i));
|
||||
const withoutTypes = (data) => ({
|
||||
...data,
|
||||
compilerOptions: Object.fromEntries(Object.entries(data.compilerOptions).filter(([k]) => k !== 'types')),
|
||||
@@ -29,7 +27,6 @@ const compilerOptionsBase = {
|
||||
experimentalDecorators: true,
|
||||
// emitDecoratorMetadata: true,
|
||||
incremental: true,
|
||||
types,
|
||||
};
|
||||
const baseOutDir = path.resolve(__dirname, '../.cache/ts-out');
|
||||
const config = {
|
||||
@@ -95,7 +92,6 @@ const UIConfig = {
|
||||
baseUrl: '.',
|
||||
outDir: path.join(baseOutDir, 'ui'),
|
||||
moduleResolution: 'node',
|
||||
types,
|
||||
paths: {
|
||||
'vj/*': [
|
||||
'./packages/ui-default/*',
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
"@types/cross-spawn": "^6.0.6",
|
||||
"@types/node": "^20.10.6",
|
||||
"@types/semver": "^7.5.6",
|
||||
"@types/supertest": "^6.0.2",
|
||||
"autocannon": "^7.14.0",
|
||||
"cac": "^6.7.14",
|
||||
"chai": "^4.3.10",
|
||||
|
||||
@@ -243,7 +243,6 @@ async function handle(ctx: KoaContext, HandlerClass, checker) {
|
||||
args, request, response, user, domain, UiContext,
|
||||
} = ctx.HydroContext;
|
||||
Object.assign(args, ctx.params);
|
||||
console.log(ctx.HydroContext);
|
||||
const h = new HandlerClass(ctx, args, request, response, user, domain, UiContext);
|
||||
ctx.handler = h;
|
||||
try {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
/* eslint-disable no-restricted-globals */
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="ES2015" />
|
||||
/// <reference types="@types/sharedworker" />
|
||||
/// <reference lib="webworker" />
|
||||
import ReconnectingWebsocket from 'reconnecting-websocket';
|
||||
import { FLAG_INFO } from 'vj/constant/message';
|
||||
declare const self: SharedWorkerGlobalScope;
|
||||
|
||||
console.log('SharedWorker init');
|
||||
|
||||
@@ -75,7 +75,7 @@ function initConn(path: string, port: MessagePort, cookie: any) {
|
||||
};
|
||||
}
|
||||
|
||||
onconnect = function (e) { // eslint-disable-line no-undef
|
||||
self.onconnect = function (e) { // eslint-disable-line no-undef
|
||||
const port = e.ports[0];
|
||||
|
||||
port.addEventListener('message', (msg: { data: RequestPayload }) => {
|
||||
|
||||
@@ -37,8 +37,6 @@
|
||||
"@types/react": "^18.2.46",
|
||||
"@types/react-dom": "^18.2.18",
|
||||
"@types/redux-logger": "^3.0.12",
|
||||
"@types/serviceworker": "^0.0.82",
|
||||
"@types/sharedworker": "^0.0.111",
|
||||
"@types/webpack-env": "^1.18.4",
|
||||
"@vscode/codicons": "^0.0.35",
|
||||
"ajv": "^8.12.0",
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
/// <reference no-default-lib="true"/>
|
||||
/// <reference lib="ES2015" />
|
||||
/// <reference types="@types/serviceworker" />
|
||||
/* global clients */
|
||||
/* eslint-disable no-restricted-globals */
|
||||
/// <reference no-default-lib="true" />
|
||||
/// <reference lib="webworker" />
|
||||
export { }; // make it a module so that declare self works
|
||||
declare const self: ServiceWorkerGlobalScope;
|
||||
|
||||
const map = new Map();
|
||||
|
||||
function createStream(port) {
|
||||
@@ -78,11 +79,11 @@ self.addEventListener('notificationclick', (event) => {
|
||||
console.log('On notification click: ', event.notification.tag);
|
||||
event.notification.close();
|
||||
if (!event.notification.tag.startsWith('message-')) return;
|
||||
event.waitUntil(clients.matchAll({ type: 'window' }).then((clientList) => {
|
||||
event.waitUntil(self.clients.matchAll({ type: 'window' }).then((clientList) => {
|
||||
for (const client of clientList) {
|
||||
if (client.url === '/home/messages' && 'focus' in client) return client.focus();
|
||||
}
|
||||
if (clients.openWindow) clients.openWindow('/home/messages');
|
||||
if (self.clients.openWindow) self.clients.openWindow('/home/messages');
|
||||
return null;
|
||||
}));
|
||||
});
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ const Root = {
|
||||
};
|
||||
|
||||
describe('App', () => {
|
||||
let agent: supertest.SuperAgentTest;
|
||||
let agent;
|
||||
before(async () => {
|
||||
const init = Date.now();
|
||||
await new Promise((resolve) => {
|
||||
|
||||
Reference in new issue
Block a user