• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2025 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16namespace interop {
17    export type NativePointer = number;
18
19    export interface PluginContext {
20        setArkTSAst(ast: Node): void;
21        getArkTSAst(): Node | undefined;
22        setArkTSProgram(program: Node): void;
23        getArkTSProgram(): Node | undefined;
24        setProjectConfig(projectConfig: Node): void;
25        getProjectConfig(): Node | undefined;
26    }
27
28    export interface ArktsObject {
29        readonly peer: NativePointer;
30    }
31
32    export interface Node extends ArktsObject {
33        get originalPeer(): NativePointer;
34        set originalPeer(peer: NativePointer);
35        dumpJson(): string;
36        dumpSrc(): string;
37    }
38
39    export interface EtsScript extends Node {}
40
41    export interface Plugin {
42        name: string;
43        parsed?(context: PluginContext): EtsScript | undefined;
44        checked?(context: PluginContext): EtsScript | undefined;
45    }
46
47    export type TransfromerName = string & { __TransfromerNameBrand: any };
48
49    export interface EmitTransformerOptions {
50        arkui: TransfromerName;
51    }
52
53    export interface DeclTransformerOptions {
54        arkui: TransfromerName;
55    }
56}
57