mirror of
https://github.com/n8n-io/n8n.git
synced 2026-05-27 06:45:26 +02:00
refactor(editor): Reorganize shims-*.d.ts files (no-changelog) (#21533)
This commit is contained in:
parent
af7417b88e
commit
d3455f1508
|
|
@ -2,7 +2,7 @@ import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|||
import { useDebugInfo } from './useDebugInfo';
|
||||
import type { RootStoreState } from '@n8n/stores/useRootStore';
|
||||
import type { useSettingsStore as useSettingsStoreType } from '@/app/stores/settings.store';
|
||||
import type { RecursivePartial } from '@/type-utils';
|
||||
import type { RecursivePartial } from '@/app/types/utils';
|
||||
|
||||
vi.mock('@n8n/stores/useRootStore', () => ({
|
||||
useRootStore: (): Partial<RootStoreState> => ({
|
||||
|
|
|
|||
|
|
@ -1,4 +1,12 @@
|
|||
/// <reference types="vite/client" />
|
||||
/// <reference types="vite-plugin-comlink/client" />
|
||||
|
||||
import 'vue-router';
|
||||
import type { VNode, ComponentPublicInstance } from 'vue';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type { ExternalHooks } from '@/app/types/externalHooks';
|
||||
import type { FrontendSettings } from '@n8n/api-types';
|
||||
import type { Plugin as PrettierPlugin } from 'prettier';
|
||||
import type { I18nClass } from '@n8n/i18n';
|
||||
import type { Route, Router, RouteLocation } from 'vue-router';
|
||||
import type { Telemetry } from '@/app/plugins/telemetry';
|
||||
|
|
@ -6,9 +14,63 @@ import type { VIEWS } from '@/app/constants';
|
|||
import type { IPermissions } from '@/Interface';
|
||||
import type { MiddlewareOptions, RouterMiddlewareType } from '@/app/types/router';
|
||||
|
||||
/**
|
||||
* File types
|
||||
*/
|
||||
|
||||
declare module '*.json';
|
||||
declare module '*.svg';
|
||||
declare module '*.png';
|
||||
declare module '*.jpg';
|
||||
declare module '*.jpeg';
|
||||
declare module '*.gif';
|
||||
declare module '*.webp';
|
||||
|
||||
declare module '*?raw' {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Global
|
||||
*/
|
||||
|
||||
declare global {
|
||||
interface ImportMeta {
|
||||
env: {
|
||||
DEV: boolean;
|
||||
PROD: boolean;
|
||||
NODE_ENV: 'development' | 'production';
|
||||
VUE_APP_URL_BASE_API: string;
|
||||
VUE_SCAN: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface Window {
|
||||
BASE_PATH: string;
|
||||
REST_ENDPOINT: string;
|
||||
n8nExternalHooks?: PartialDeep<ExternalHooks>;
|
||||
preventNodeViewBeforeUnload?: boolean;
|
||||
maxPinnedDataSize?: number;
|
||||
}
|
||||
|
||||
namespace JSX {
|
||||
interface Element extends VNode {}
|
||||
interface ElementClass extends ComponentPublicInstance {}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
findLast(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T;
|
||||
}
|
||||
}
|
||||
|
||||
export {};
|
||||
|
||||
/**
|
||||
* Vue Runtime
|
||||
* @docs https://vuejs.org/guide/typescript/options-api.html#augmenting-global-properties
|
||||
*/
|
||||
|
||||
|
|
@ -28,6 +90,7 @@ declare module '@vue/runtime-core' {
|
|||
}
|
||||
|
||||
/**
|
||||
* Vue Router
|
||||
* @docs https://router.vuejs.org/guide/advanced/meta
|
||||
*/
|
||||
|
||||
144
packages/frontend/editor-ui/src/shims-modules.d.ts
vendored
144
packages/frontend/editor-ui/src/shims-modules.d.ts
vendored
|
|
@ -4,23 +4,6 @@
|
|||
|
||||
declare module 'vue-agile';
|
||||
|
||||
/**
|
||||
* File types
|
||||
*/
|
||||
|
||||
declare module '*.json';
|
||||
declare module '*.svg';
|
||||
declare module '*.png';
|
||||
declare module '*.jpg';
|
||||
declare module '*.jpeg';
|
||||
declare module '*.gif';
|
||||
declare module '*.webp';
|
||||
|
||||
declare module '*?raw' {
|
||||
const content: string;
|
||||
export default content;
|
||||
}
|
||||
|
||||
declare module 'v3-infinite-loading' {
|
||||
import { Plugin, DefineComponent } from 'vue';
|
||||
|
||||
|
|
@ -37,3 +20,130 @@ declare module 'v3-infinite-loading' {
|
|||
|
||||
export default InfiniteLoading;
|
||||
}
|
||||
|
||||
declare module 'vue-virtual-scroller' {
|
||||
import {
|
||||
type ObjectEmitsOptions,
|
||||
type PublicProps,
|
||||
type SetupContext,
|
||||
type SlotsType,
|
||||
type VNode,
|
||||
} from 'vue';
|
||||
|
||||
interface RecycleScrollerProps<T> {
|
||||
items: readonly T[];
|
||||
direction?: 'vertical' | 'horizontal';
|
||||
itemSize?: number | null;
|
||||
gridItems?: number;
|
||||
itemSecondarySize?: number;
|
||||
minItemSize?: number;
|
||||
sizeField?: string;
|
||||
typeField?: string;
|
||||
keyField?: keyof T;
|
||||
pageMode?: boolean;
|
||||
prerender?: number;
|
||||
buffer?: number;
|
||||
emitUpdate?: boolean;
|
||||
updateInterval?: number;
|
||||
listClass?: string;
|
||||
itemClass?: string;
|
||||
listTag?: string;
|
||||
itemTag?: string;
|
||||
}
|
||||
|
||||
interface DynamicScrollerProps<T> extends RecycleScrollerProps<T> {
|
||||
minItemSize: number;
|
||||
}
|
||||
|
||||
interface RecycleScrollerEmitOptions extends ObjectEmitsOptions {
|
||||
resize: () => void;
|
||||
visible: () => void;
|
||||
hidden: () => void;
|
||||
update: (
|
||||
startIndex: number,
|
||||
endIndex: number,
|
||||
visibleStartIndex: number,
|
||||
visibleEndIndex: number,
|
||||
) => void;
|
||||
'scroll-start': () => void;
|
||||
'scroll-end': () => void;
|
||||
}
|
||||
|
||||
interface RecycleScrollerSlotProps<T> {
|
||||
item: T;
|
||||
index: number;
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
interface RecycleScrollerSlots<T> {
|
||||
default(slotProps: RecycleScrollerSlotProps<T>): unknown;
|
||||
before(): unknown;
|
||||
empty(): unknown;
|
||||
after(): unknown;
|
||||
}
|
||||
|
||||
export interface RecycleScrollerInstance {
|
||||
getScroll(): { start: number; end: number };
|
||||
scrollToItem(index: number): void;
|
||||
scrollToPosition(position: number): void;
|
||||
}
|
||||
|
||||
export const RecycleScroller: <T>(
|
||||
props: RecycleScrollerProps<T> & PublicProps,
|
||||
ctx?: SetupContext<RecycleScrollerEmitOptions, SlotsType<RecycleScrollerSlots<T>>>,
|
||||
expose?: (exposed: RecycleScrollerInstance) => void,
|
||||
) => VNode & {
|
||||
__ctx?: {
|
||||
props: RecycleScrollerProps<T> & PublicProps;
|
||||
expose(exposed: RecycleScrollerInstance): void;
|
||||
slots: RecycleScrollerSlots<T>;
|
||||
};
|
||||
};
|
||||
|
||||
export const DynamicScroller: <T>(
|
||||
props: DynamicScrollerProps<T> & PublicProps,
|
||||
ctx?: SetupContext<RecycleScrollerEmitOptions, SlotsType<RecycleScrollerSlots<T>>>,
|
||||
expose?: (exposed: RecycleScrollerInstance) => void,
|
||||
) => VNode & {
|
||||
__ctx?: {
|
||||
props: DynamicScrollerProps<T> & PublicProps;
|
||||
expose(exposed: RecycleScrollerInstance): void;
|
||||
slots: RecycleScrollerSlots<T>;
|
||||
};
|
||||
};
|
||||
|
||||
interface DynamicScrollerItemProps<T> {
|
||||
item: T;
|
||||
active: boolean;
|
||||
sizeDependencies?: unknown[];
|
||||
watchData?: boolean;
|
||||
tag?: string;
|
||||
emitResize?: boolean;
|
||||
onResize?: () => void;
|
||||
}
|
||||
|
||||
interface DynamicScrollerItemEmitOptions extends ObjectEmitsOptions {
|
||||
resize: () => void;
|
||||
}
|
||||
|
||||
export const DynamicScrollerItem: <T>(
|
||||
props: DynamicScrollerItemProps<T> & PublicProps,
|
||||
ctx?: SetupContext<DynamicScrollerItemEmitOptions>,
|
||||
) => VNode;
|
||||
|
||||
export function IdState(options?: { idProp?: (value: any) => unknown }): unknown;
|
||||
}
|
||||
|
||||
declare module 'prettier/plugins/estree' {
|
||||
const plugin: PrettierPlugin;
|
||||
export = plugin;
|
||||
export default plugin;
|
||||
}
|
||||
|
||||
declare module 'virtual:node-popularity-data' {
|
||||
const data: Array<{
|
||||
id: string;
|
||||
popularity: number;
|
||||
}>;
|
||||
export default data;
|
||||
}
|
||||
|
|
|
|||
48
packages/frontend/editor-ui/src/shims.d.ts
vendored
48
packages/frontend/editor-ui/src/shims.d.ts
vendored
|
|
@ -1,48 +0,0 @@
|
|||
/// <reference types="vite/client" />
|
||||
/// <reference types="vite-plugin-comlink/client" />
|
||||
|
||||
import type { VNode, ComponentPublicInstance } from 'vue';
|
||||
import type { PartialDeep } from 'type-fest';
|
||||
import type { ExternalHooks } from '@/app/types/externalHooks';
|
||||
import type { FrontendSettings } from '@n8n/api-types';
|
||||
import type { Plugin as PrettierPlugin } from 'prettier';
|
||||
|
||||
export {};
|
||||
|
||||
declare global {
|
||||
interface ImportMeta {
|
||||
env: {
|
||||
DEV: boolean;
|
||||
PROD: boolean;
|
||||
NODE_ENV: 'development' | 'production';
|
||||
VUE_APP_URL_BASE_API: string;
|
||||
VUE_SCAN: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface Window {
|
||||
BASE_PATH: string;
|
||||
REST_ENDPOINT: string;
|
||||
n8nExternalHooks?: PartialDeep<ExternalHooks>;
|
||||
preventNodeViewBeforeUnload?: boolean;
|
||||
maxPinnedDataSize?: number;
|
||||
}
|
||||
|
||||
namespace JSX {
|
||||
interface Element extends VNode {}
|
||||
interface ElementClass extends ComponentPublicInstance {}
|
||||
interface IntrinsicElements {
|
||||
[elem: string]: any;
|
||||
}
|
||||
}
|
||||
|
||||
interface Array<T> {
|
||||
findLast(predicate: (value: T, index: number, obj: T[]) => unknown, thisArg?: any): T;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'prettier/plugins/estree' {
|
||||
const plugin: PrettierPlugin;
|
||||
export = plugin;
|
||||
export default plugin;
|
||||
}
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
/// <reference types="vite/client" />
|
||||
|
||||
declare module 'virtual:node-popularity-data' {
|
||||
const data: Array<{
|
||||
id: string;
|
||||
popularity: number;
|
||||
}>;
|
||||
export default data;
|
||||
}
|
||||
|
|
@ -1,112 +0,0 @@
|
|||
declare module 'vue-virtual-scroller' {
|
||||
import {
|
||||
type ObjectEmitsOptions,
|
||||
type PublicProps,
|
||||
type SetupContext,
|
||||
type SlotsType,
|
||||
type VNode,
|
||||
} from 'vue';
|
||||
|
||||
interface RecycleScrollerProps<T> {
|
||||
items: readonly T[];
|
||||
direction?: 'vertical' | 'horizontal';
|
||||
itemSize?: number | null;
|
||||
gridItems?: number;
|
||||
itemSecondarySize?: number;
|
||||
minItemSize?: number;
|
||||
sizeField?: string;
|
||||
typeField?: string;
|
||||
keyField?: keyof T;
|
||||
pageMode?: boolean;
|
||||
prerender?: number;
|
||||
buffer?: number;
|
||||
emitUpdate?: boolean;
|
||||
updateInterval?: number;
|
||||
listClass?: string;
|
||||
itemClass?: string;
|
||||
listTag?: string;
|
||||
itemTag?: string;
|
||||
}
|
||||
|
||||
interface DynamicScrollerProps<T> extends RecycleScrollerProps<T> {
|
||||
minItemSize: number;
|
||||
}
|
||||
|
||||
interface RecycleScrollerEmitOptions extends ObjectEmitsOptions {
|
||||
resize: () => void;
|
||||
visible: () => void;
|
||||
hidden: () => void;
|
||||
update: (
|
||||
startIndex: number,
|
||||
endIndex: number,
|
||||
visibleStartIndex: number,
|
||||
visibleEndIndex: number,
|
||||
) => void;
|
||||
'scroll-start': () => void;
|
||||
'scroll-end': () => void;
|
||||
}
|
||||
|
||||
interface RecycleScrollerSlotProps<T> {
|
||||
item: T;
|
||||
index: number;
|
||||
active: boolean;
|
||||
}
|
||||
|
||||
interface RecycleScrollerSlots<T> {
|
||||
default(slotProps: RecycleScrollerSlotProps<T>): unknown;
|
||||
before(): unknown;
|
||||
empty(): unknown;
|
||||
after(): unknown;
|
||||
}
|
||||
|
||||
export interface RecycleScrollerInstance {
|
||||
getScroll(): { start: number; end: number };
|
||||
scrollToItem(index: number): void;
|
||||
scrollToPosition(position: number): void;
|
||||
}
|
||||
|
||||
export const RecycleScroller: <T>(
|
||||
props: RecycleScrollerProps<T> & PublicProps,
|
||||
ctx?: SetupContext<RecycleScrollerEmitOptions, SlotsType<RecycleScrollerSlots<T>>>,
|
||||
expose?: (exposed: RecycleScrollerInstance) => void,
|
||||
) => VNode & {
|
||||
__ctx?: {
|
||||
props: RecycleScrollerProps<T> & PublicProps;
|
||||
expose(exposed: RecycleScrollerInstance): void;
|
||||
slots: RecycleScrollerSlots<T>;
|
||||
};
|
||||
};
|
||||
|
||||
export const DynamicScroller: <T>(
|
||||
props: DynamicScrollerProps<T> & PublicProps,
|
||||
ctx?: SetupContext<RecycleScrollerEmitOptions, SlotsType<RecycleScrollerSlots<T>>>,
|
||||
expose?: (exposed: RecycleScrollerInstance) => void,
|
||||
) => VNode & {
|
||||
__ctx?: {
|
||||
props: DynamicScrollerProps<T> & PublicProps;
|
||||
expose(exposed: RecycleScrollerInstance): void;
|
||||
slots: RecycleScrollerSlots<T>;
|
||||
};
|
||||
};
|
||||
|
||||
interface DynamicScrollerItemProps<T> {
|
||||
item: T;
|
||||
active: boolean;
|
||||
sizeDependencies?: unknown[];
|
||||
watchData?: boolean;
|
||||
tag?: string;
|
||||
emitResize?: boolean;
|
||||
onResize?: () => void;
|
||||
}
|
||||
|
||||
interface DynamicScrollerItemEmitOptions extends ObjectEmitsOptions {
|
||||
resize: () => void;
|
||||
}
|
||||
|
||||
export const DynamicScrollerItem: <T>(
|
||||
props: DynamicScrollerItemProps<T> & PublicProps,
|
||||
ctx?: SetupContext<DynamicScrollerItemEmitOptions>,
|
||||
) => VNode;
|
||||
|
||||
export function IdState(options?: { idProp?: (value: any) => unknown }): unknown;
|
||||
}
|
||||
|
|
@ -71,7 +71,7 @@ const alias = [
|
|||
{
|
||||
// For sanitize-html
|
||||
find: 'source-map-js',
|
||||
replacement: resolve(__dirname, 'src/source-map-js-shim'),
|
||||
replacement: resolve(__dirname, 'vite/source-map-js-shim'),
|
||||
},
|
||||
];
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user