@easytwin/devkit 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -5
- package/dist/bin.js +1308 -208
- package/dist/index.d.ts +175 -78
- package/dist/index.js +1510 -648
- package/dist/runtime/twin-app-host.js +265 -0
- package/dist/runtime/twin-apps.js +48 -0
- package/dist/runtime/twin-runtime.js +128301 -0
- package/package.json +5 -3
- package/skills/easytwin-bootstrap/SKILL.md +1 -4
- package/skills/easytwin-develop/SKILL.md +6 -4
- package/skills/easytwin-render/SKILL.md +3 -3
- package/skills/easytwin-scene/SKILL.md +57 -54
- package/skills/easytwin-test/SKILL.md +47 -0
- package/skills/easytwin-upload/SKILL.md +39 -38
- package/dist/bin.js.map +0 -1
- package/dist/index.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,13 +6,6 @@ declare const CONFIG_FILE_NAME = "easytwin.config.json";
|
|
|
6
6
|
declare const DEFAULT_BASE_URL = "http://saas-twin.k8s.dtstack.cn/";
|
|
7
7
|
/** 官方测试环境域名。 */
|
|
8
8
|
declare const TEST_BASE_URL = "http://172.16.125.3:10100/";
|
|
9
|
-
/**
|
|
10
|
-
* 当前测试 OP 网关缺省头(与编辑器 curl 一致)。配置/环境变量可覆盖。
|
|
11
|
-
* 免网关接口到位后删除(D13)。
|
|
12
|
-
*/
|
|
13
|
-
declare const TEST_OP_ACCOUNT_ID = "25";
|
|
14
|
-
declare const TEST_OP_USER_ID = "25";
|
|
15
|
-
declare const TEST_SPACE_ID = "54";
|
|
16
9
|
/**
|
|
17
10
|
* 官方 OSS(twin runtime baseOSSUrl)。系统资产由此拼出:
|
|
18
11
|
* `{ossUrl}/easytwin/system/libs/webp-wasm.wasm`、
|
|
@@ -37,10 +30,6 @@ interface EasyTwinConfig {
|
|
|
37
30
|
baseUrl?: string;
|
|
38
31
|
/** twin runtime 资产根(baseOSSUrl);缺省官方 OSS,可覆盖为 CDN/自建存储。 */
|
|
39
32
|
ossUrl?: string;
|
|
40
|
-
/** 过渡期 OP 网关头;免网关接口到位后删除(D13)。 */
|
|
41
|
-
opAccountId?: string;
|
|
42
|
-
opUserId?: string;
|
|
43
|
-
spaceId?: string;
|
|
44
33
|
/**
|
|
45
34
|
* 关联场景摘要,由 scene list / 场景树刷新写入(D17)。
|
|
46
35
|
* 不含场景 JSON 本体;下次 list 全量覆盖。
|
|
@@ -66,10 +55,6 @@ interface ResolvedConfig {
|
|
|
66
55
|
/** 本地测试模式:appId/appSecret 均为 "test" 时启用,scene/upload/pull 走本地 mock 不发请求。 */
|
|
67
56
|
mock: boolean;
|
|
68
57
|
source: "file" | "env";
|
|
69
|
-
/** 过渡期 OP 网关头;env=test 时缺省 25/25/54。免网关接口到位后删除(D13)。 */
|
|
70
|
-
opAccountId?: string;
|
|
71
|
-
opUserId?: string;
|
|
72
|
-
spaceId?: string;
|
|
73
58
|
}
|
|
74
59
|
declare class ConfigError extends Error {
|
|
75
60
|
constructor(message: string);
|
|
@@ -100,25 +85,21 @@ declare function initConfig(input: EasyTwinConfig, cwd: string): Promise<InitRes
|
|
|
100
85
|
declare function writeConfigScenes(cwd: string, scenes: ConfigScene[]): Promise<void>;
|
|
101
86
|
|
|
102
87
|
/**
|
|
103
|
-
* 认证与路径以内部 swagger 为准(标签:SDK 应用场景 /
|
|
104
|
-
* 全仓唯一认证头注入点:`x-app-secret` = App Secret。
|
|
105
|
-
*
|
|
106
|
-
* 场景/代码路径参数名为 applicationId;DevKit 传入配置里的 App ID。
|
|
88
|
+
* 认证与路径以内部 swagger 为准(标签:SDK 应用场景 / 分享相关 / SDK 应用代码)。
|
|
89
|
+
* 全仓唯一认证头注入点:`x-app-id` = App ID,`x-app-secret` = App Secret(D20)。
|
|
90
|
+
* share 代码与场景列表接口无路径参数(D21 / D22);上传不请求仍走 OP 网关的 workspace-config(D24)。
|
|
107
91
|
*/
|
|
92
|
+
declare const APP_ID_HEADER = "x-app-id";
|
|
108
93
|
declare const AUTH_HEADER = "x-app-secret";
|
|
109
|
-
/** 过渡期 OP 网关头;免网关接口到位后删除(D13)。 */
|
|
110
|
-
declare const OP_ACCOUNT_ID_HEADER = "op-account-id";
|
|
111
|
-
declare const OP_USER_ID_HEADER = "op-user-id";
|
|
112
|
-
declare const SPACE_ID_HEADER = "space-id";
|
|
113
94
|
declare const ENDPOINTS: {
|
|
114
|
-
/**
|
|
115
|
-
readonly linkedScenes: (
|
|
116
|
-
/**
|
|
117
|
-
readonly
|
|
118
|
-
/**
|
|
95
|
+
/** POST 已关联场景列表(分享路径,空 body)。 */
|
|
96
|
+
readonly linkedScenes: () => string;
|
|
97
|
+
/** POST 拉取工作区全部代码文件(分享路径,空 body)。 */
|
|
98
|
+
readonly workspaceCodePull: () => string;
|
|
99
|
+
/** POST 一次推送 create/update/delete(分享路径)。 */
|
|
100
|
+
readonly workspaceCodePush: () => string;
|
|
101
|
+
/** GET 工作区文件约束(仍带 applicationId,走 OP 网关;上传不调用,拉取失败则降级)。 */
|
|
119
102
|
readonly workspaceConfig: (applicationId: string) => string;
|
|
120
|
-
/** POST 新建 / PATCH 批量更新 / DELETE 批量删除。 */
|
|
121
|
-
readonly workspaceCodeFiles: (applicationId: string) => string;
|
|
122
103
|
};
|
|
123
104
|
declare class EasyTwinApiError extends Error {
|
|
124
105
|
readonly status: number;
|
|
@@ -135,14 +116,11 @@ declare class EasyTwinClient {
|
|
|
135
116
|
readonly baseUrl: string;
|
|
136
117
|
/** twin runtime / 场景快照资产根(baseOSSUrl)。 */
|
|
137
118
|
readonly ossUrl: string;
|
|
138
|
-
/** 接入凭证 App ID
|
|
119
|
+
/** 接入凭证 App ID;写入 `x-app-id`,workspace-config 路径仍可用。 */
|
|
139
120
|
readonly appId: string;
|
|
140
121
|
/** 本地测试模式:true 时 scene/upload/pull 走本地 mock,不发网络请求(见 config.ts)。 */
|
|
141
122
|
readonly mock: boolean;
|
|
142
123
|
private readonly appSecret;
|
|
143
|
-
private readonly opAccountId?;
|
|
144
|
-
private readonly opUserId?;
|
|
145
|
-
private readonly spaceId?;
|
|
146
124
|
constructor(config: ResolvedConfig);
|
|
147
125
|
/** 全仓唯一认证头注入点。 */
|
|
148
126
|
private authHeaders;
|
|
@@ -251,20 +229,58 @@ interface UploadProgress {
|
|
|
251
229
|
}
|
|
252
230
|
interface UploadOptions {
|
|
253
231
|
onProgress?: (progress: UploadProgress) => void;
|
|
254
|
-
/**
|
|
232
|
+
/** 额外忽略规则;默认已跳过插件产物与相关文件(D23)。 */
|
|
255
233
|
ignore?: (relPath: string) => boolean;
|
|
256
234
|
}
|
|
235
|
+
interface CollectedFile {
|
|
236
|
+
relPath: string;
|
|
237
|
+
absPath: string;
|
|
238
|
+
size: number;
|
|
239
|
+
}
|
|
257
240
|
interface UploadResult {
|
|
258
241
|
fileCount: number;
|
|
259
242
|
byteCount: number;
|
|
243
|
+
created: number;
|
|
244
|
+
updated: number;
|
|
245
|
+
deleted: number;
|
|
246
|
+
unchanged: number;
|
|
260
247
|
/** 本地测试模式(dry-run)时置 true:未真正上传。 */
|
|
261
248
|
mock?: boolean;
|
|
262
249
|
}
|
|
263
|
-
interface
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
250
|
+
interface UploadCreate {
|
|
251
|
+
file: CollectedFile;
|
|
252
|
+
content: string;
|
|
253
|
+
}
|
|
254
|
+
interface UploadUpdate {
|
|
255
|
+
file: CollectedFile;
|
|
256
|
+
id: string;
|
|
257
|
+
content: string;
|
|
267
258
|
}
|
|
259
|
+
interface UploadDelete {
|
|
260
|
+
id: string;
|
|
261
|
+
filePath: string;
|
|
262
|
+
}
|
|
263
|
+
/** 对照远端文件,本地区分新增 / 更新 / 删除(D21,一次 push)。 */
|
|
264
|
+
interface WorkspaceUploadPlan {
|
|
265
|
+
creates: UploadCreate[];
|
|
266
|
+
updates: UploadUpdate[];
|
|
267
|
+
deletes: UploadDelete[];
|
|
268
|
+
unchanged: CollectedFile[];
|
|
269
|
+
}
|
|
270
|
+
/** 上传/拉取共同跳过:插件产物、agent 目录、构建产物与凭据。 */
|
|
271
|
+
declare const WORKSPACE_IGNORED_DIRS: Set<string>;
|
|
272
|
+
declare const WORKSPACE_IGNORED_FILES: Set<string>;
|
|
273
|
+
/** 与 push 服务端一致的工作区代码扩展名(D25)。 */
|
|
274
|
+
declare const WORKSPACE_CODE_EXTENSIONS: readonly [".ts", ".tsx", ".js", ".json"];
|
|
275
|
+
/** 工作区本地预览测试文件:不参与 pull/upload(D27)。 */
|
|
276
|
+
declare function isWorkspaceSpecFile(relPath: string): boolean;
|
|
277
|
+
/**
|
|
278
|
+
* 插件产物、凭据、构建目录与场景快照。
|
|
279
|
+
* 不含 `*.spec.ts`(预览测试扫描需要读这些文件)。
|
|
280
|
+
*/
|
|
281
|
+
declare function isIgnoredWorkspacePath(relPath: string): boolean;
|
|
282
|
+
/** 跳过插件产物/凭据/场景快照,以及本地预览测试文件 `*.spec.ts`(D23 / D26 / D27)。 */
|
|
283
|
+
declare function defaultWorkspaceIgnore(relPath: string): boolean;
|
|
268
284
|
/** swagger `SdkApplicationWorkspaceCodeConfigVo`。 */
|
|
269
285
|
interface WorkspaceCodeConfig {
|
|
270
286
|
allowedFileExtensions: string[];
|
|
@@ -286,12 +302,25 @@ declare function buildMultipartBody(boundary: string, fields: Record<string, str
|
|
|
286
302
|
declare function normalizePath(relPath: string): string;
|
|
287
303
|
declare function normalizeWorkspaceConfig(data: unknown): WorkspaceCodeConfig;
|
|
288
304
|
declare function normalizeWorkspaceFiles(data: unknown): WorkspaceCodeFile[];
|
|
305
|
+
/** 是否为可同步的工作区代码文件(`.ts` / `.tsx` / `.js` / `.json`)。 */
|
|
306
|
+
declare function isWorkspaceCodeFile(relPath: string): boolean;
|
|
289
307
|
/** 目录深度:根文件为 0,`src/a.ts` 为 1,`src/utils/a.ts` 为 2。 */
|
|
290
308
|
declare function directoryDepth(relPath: string): number;
|
|
291
309
|
declare function assertUploadable(files: CollectedFile[], config: WorkspaceCodeConfig): void;
|
|
292
310
|
/**
|
|
293
|
-
*
|
|
294
|
-
*
|
|
311
|
+
* 对照远端工作区文件,把本地文件分成新增 / 更新 / 删除 / 未变。
|
|
312
|
+
* 不做本地清单:每次上传以本次 GET 的远端列表为准。
|
|
313
|
+
*/
|
|
314
|
+
declare function planWorkspaceUpload(local: {
|
|
315
|
+
file: CollectedFile;
|
|
316
|
+
content: string;
|
|
317
|
+
}[], remote: WorkspaceCodeFile[]): WorkspaceUploadPlan;
|
|
318
|
+
declare function formatUploadResult(result: UploadResult): string;
|
|
319
|
+
/** swagger `PushSdkApplicationWorkspaceCodeDto`:字段均可选,有变更才带上。 */
|
|
320
|
+
declare function buildWorkspacePushBody(plan: WorkspaceUploadPlan): Record<string, unknown> | null;
|
|
321
|
+
/**
|
|
322
|
+
* 全量对齐上传目录:对照远端工作区,本地 diff 后一次 push(create/update/delete)。
|
|
323
|
+
* 不请求仍走 OP 网关的 workspace-config(D24);只收集 `.ts`/`.tsx`/`.js`/`.json`(D25)。本地测试模式(mock)时退化为 dry-run。
|
|
295
324
|
*/
|
|
296
325
|
declare function uploadDirectory(client: EasyTwinClient, dir: string, options?: UploadOptions): Promise<UploadResult>;
|
|
297
326
|
|
|
@@ -348,10 +377,73 @@ declare function formatWorkspacePullResult(result: WorkspacePullResult): string;
|
|
|
348
377
|
declare function workspacePullHasConflicts(plan: WorkspacePullPlan): boolean;
|
|
349
378
|
declare function workspacePullPendingWrites(plan: WorkspacePullPlan, force?: boolean): string[];
|
|
350
379
|
|
|
380
|
+
/** 用户代码固定入口(相对工作区根)。 */
|
|
381
|
+
declare const USER_ENTRY = "src/main.ts";
|
|
382
|
+
/** CLI 缺省输出路径(相对工作区根)。 */
|
|
383
|
+
declare const DEFAULT_BUNDLE_OUT = "dist/main.js";
|
|
384
|
+
/** 白名单允许的裸模块。 */
|
|
385
|
+
declare const RUNTIME_MODULE = "@easytwin/runtime";
|
|
386
|
+
declare const APPS_MODULE = "@easytwin/apps";
|
|
387
|
+
declare class BundleError extends Error {
|
|
388
|
+
constructor(message: string);
|
|
389
|
+
}
|
|
390
|
+
interface BundleUserCodeOptions {
|
|
391
|
+
cwd: string;
|
|
392
|
+
/** 缺省不落盘,只返回产物字符串(插件内存编译);CLI 传入绝对/相对路径。 */
|
|
393
|
+
outFile?: string;
|
|
394
|
+
}
|
|
395
|
+
interface BundleWorkspaceModuleOptions extends BundleUserCodeOptions {
|
|
396
|
+
/** 相对 cwd 的入口文件(posix 或当前平台分隔符均可)。 */
|
|
397
|
+
entry: string;
|
|
398
|
+
/** 入口缺失时的报错文案;缺省按路径拼一条。 */
|
|
399
|
+
missingEntryMessage?: string;
|
|
400
|
+
}
|
|
401
|
+
interface BundleResult {
|
|
402
|
+
code: string;
|
|
403
|
+
warnings: string[];
|
|
404
|
+
}
|
|
405
|
+
/** 打包工作区任意入口。产物标准 ESM + inline sourcemap;仅允许 @easytwin/runtime 与 @easytwin/apps。 */
|
|
406
|
+
declare function bundleWorkspaceModule(options: BundleWorkspaceModuleOptions): Promise<BundleResult>;
|
|
407
|
+
/** 打包工作区 src/main.ts。产物标准 ESM + inline sourcemap;仅允许 @easytwin/runtime 与 @easytwin/apps。 */
|
|
408
|
+
declare function bundleUserCode(options: BundleUserCodeOptions): Promise<BundleResult>;
|
|
409
|
+
/** 若工作区尚未同步 runtime 类型,返回提示文案;已同步则返回 undefined。 */
|
|
410
|
+
declare function typesMissingHint(cwd: string): Promise<string | undefined>;
|
|
411
|
+
interface SourceMapJson {
|
|
412
|
+
sources?: string[];
|
|
413
|
+
mappings?: string;
|
|
414
|
+
}
|
|
415
|
+
declare function extractInlineSourceMap(code: string): SourceMapJson | undefined;
|
|
416
|
+
/**
|
|
417
|
+
* 把 bundled JS 的 stack(blob: 行号)映射回 TS 源码行号。
|
|
418
|
+
* 映射失败时原样返回。
|
|
419
|
+
*/
|
|
420
|
+
declare function remapErrorStack(stack: string, bundledCode: string): string;
|
|
421
|
+
|
|
422
|
+
interface WorkspaceTestCase {
|
|
423
|
+
/** `${file}:${name}`,文件内唯一。 */
|
|
424
|
+
id: string;
|
|
425
|
+
/** 相对工作区根的 posix 路径。 */
|
|
426
|
+
file: string;
|
|
427
|
+
name: string;
|
|
428
|
+
/** 除 ctx 外还有参数时,预览显示输入框。 */
|
|
429
|
+
hasInput: boolean;
|
|
430
|
+
/** 第二个参数名,作输入框占位。 */
|
|
431
|
+
inputName?: string;
|
|
432
|
+
}
|
|
433
|
+
/** 从 spec 源码解析命名导出的函数(跳过 default / type / class / 再导出)。 */
|
|
434
|
+
declare function parseExportedTestFunctions(source: string): Omit<WorkspaceTestCase, "id" | "file">[];
|
|
435
|
+
declare function workspaceTestId(file: string, name: string): string;
|
|
436
|
+
/** 扫描工作区 `*.spec.ts` 的命名导出函数。跳过插件产物目录,不跳过 spec 本身。 */
|
|
437
|
+
declare function listWorkspaceTests(cwd: string): Promise<WorkspaceTestCase[]>;
|
|
438
|
+
declare function bundleWorkspaceTestFile(options: {
|
|
439
|
+
cwd: string;
|
|
440
|
+
file: string;
|
|
441
|
+
}): Promise<BundleResult>;
|
|
442
|
+
|
|
351
443
|
type SyncTarget = "cursor" | "claude" | "codex" | "qoder";
|
|
352
444
|
type SyncTargetArg = SyncTarget | "all";
|
|
353
|
-
/**
|
|
354
|
-
declare const SKILL_NAMES: readonly ["easytwin-render", "easytwin-core", "easytwin-develop", "easytwin-bootstrap", "easytwin-scene", "easytwin-upload"];
|
|
445
|
+
/** 七件套清单(5.1),顺序即输出顺序。 */
|
|
446
|
+
declare const SKILL_NAMES: readonly ["easytwin-render", "easytwin-core", "easytwin-develop", "easytwin-bootstrap", "easytwin-scene", "easytwin-upload", "easytwin-test"];
|
|
355
447
|
type SyncAction = "created" | "updated" | "unchanged";
|
|
356
448
|
interface SyncEntrySummary {
|
|
357
449
|
name: string;
|
|
@@ -411,40 +503,6 @@ interface SkillsStatus {
|
|
|
411
503
|
/** 供插件"缺失/过期时提示一次"使用:检测各目标当前同步状态。 */
|
|
412
504
|
declare function detectSkillsStatus(cwd: string, sourceDir?: string): Promise<SkillsStatus>;
|
|
413
505
|
|
|
414
|
-
/** 用户代码固定入口(相对工作区根)。 */
|
|
415
|
-
declare const USER_ENTRY = "src/main.ts";
|
|
416
|
-
/** CLI 缺省输出路径(相对工作区根)。 */
|
|
417
|
-
declare const DEFAULT_BUNDLE_OUT = "dist/main.js";
|
|
418
|
-
/** 白名单允许的裸模块。 */
|
|
419
|
-
declare const RUNTIME_MODULE = "@easytwin/runtime";
|
|
420
|
-
declare const APPS_MODULE = "@easytwin/apps";
|
|
421
|
-
declare class BundleError extends Error {
|
|
422
|
-
constructor(message: string);
|
|
423
|
-
}
|
|
424
|
-
interface BundleUserCodeOptions {
|
|
425
|
-
cwd: string;
|
|
426
|
-
/** 缺省不落盘,只返回产物字符串(插件内存编译);CLI 传入绝对/相对路径。 */
|
|
427
|
-
outFile?: string;
|
|
428
|
-
}
|
|
429
|
-
interface BundleResult {
|
|
430
|
-
code: string;
|
|
431
|
-
warnings: string[];
|
|
432
|
-
}
|
|
433
|
-
/** 打包工作区 src/main.ts。产物标准 ESM + inline sourcemap;仅允许 @easytwin/runtime 与 @easytwin/apps。 */
|
|
434
|
-
declare function bundleUserCode(options: BundleUserCodeOptions): Promise<BundleResult>;
|
|
435
|
-
/** 若工作区尚未同步 runtime 类型,返回提示文案;已同步则返回 undefined。 */
|
|
436
|
-
declare function typesMissingHint(cwd: string): Promise<string | undefined>;
|
|
437
|
-
interface SourceMapJson {
|
|
438
|
-
sources?: string[];
|
|
439
|
-
mappings?: string;
|
|
440
|
-
}
|
|
441
|
-
declare function extractInlineSourceMap(code: string): SourceMapJson | undefined;
|
|
442
|
-
/**
|
|
443
|
-
* 把 bundled JS 的 stack(blob: 行号)映射回 TS 源码行号。
|
|
444
|
-
* 映射失败时原样返回。
|
|
445
|
-
*/
|
|
446
|
-
declare function remapErrorStack(stack: string, bundledCode: string): string;
|
|
447
|
-
|
|
448
506
|
/** 在线 TwinApp 编译 stub 露出的 `@easytwin/runtime` 导出名。本地整包 external,超出此集合只 warning。 */
|
|
449
507
|
declare const PORTABLE_RUNTIME_EXPORTS: readonly ["THREE", "RuntimeEngine", "SceneManager", "LoadSceneMode", "convertObjToComponentJson"];
|
|
450
508
|
type PortableRuntimeExport = (typeof PORTABLE_RUNTIME_EXPORTS)[number];
|
|
@@ -566,6 +624,9 @@ declare class TwinAppPreviewHost {
|
|
|
566
624
|
private readonly onEngineTick;
|
|
567
625
|
constructor(options: TwinAppPreviewHostOptions);
|
|
568
626
|
getEngine(): TwinAppEngine | null;
|
|
627
|
+
/** 给 spec 调用:场景字段取当前引擎主场景(不要求已 Run TwinApp)。 */
|
|
628
|
+
getTestContext(): TwinAppContext;
|
|
629
|
+
invokeTest(fn: (ctx: TwinAppContext, input?: string) => unknown, input?: string): Promise<unknown>;
|
|
569
630
|
boot(): Promise<void>;
|
|
570
631
|
run(code: string): Promise<void>;
|
|
571
632
|
dispose(): Promise<void>;
|
|
@@ -583,4 +644,40 @@ declare class TwinAppPreviewHost {
|
|
|
583
644
|
private getContext;
|
|
584
645
|
}
|
|
585
646
|
|
|
586
|
-
|
|
647
|
+
type PreviewHostKind = "vscode" | "http";
|
|
648
|
+
/**
|
|
649
|
+
* 纯函数:构造场景预览页 HTML(插件 webview 与 CLI localhost HTTP 共用,D28)。
|
|
650
|
+
* 单栏三维场景页:module script 动态 import twin runtime,
|
|
651
|
+
* 用场景数据经 convertObjToComponentJson + RuntimeEngine.create + loadScene 真实渲染。
|
|
652
|
+
* baseOSSUrl 必须是 ossUrl(缺省官方 OSS),不是 API baseUrl。
|
|
653
|
+
* host=vscode 且页面为 HTTPS 时,HTTP 资源经扩展宿主代理,规避 mixed content。
|
|
654
|
+
* host=http(CLI preview)时直连 API 与 OSS,走同源 `/api/*` 做 bundle/tests/assets。
|
|
655
|
+
* 底部 Run 走 TwinAppPreviewHost(D14):import map 注入 @easytwin/runtime 与 @easytwin/apps。
|
|
656
|
+
* 工作区 *.spec.ts 命名导出在 Run 栏上方列出(D27)。
|
|
657
|
+
*/
|
|
658
|
+
declare function escapeHtml(text: string): string;
|
|
659
|
+
/**
|
|
660
|
+
* 把 JSON 文本安全嵌入 `<script type="application/json">`。
|
|
661
|
+
* script 元素的内容是 raw text,HTML 实体不会解码,因此不能使用 escapeHtml;
|
|
662
|
+
* 只需把 `<`/`>` 与 U+2028/U+2029 转成 JSON 字面转义。
|
|
663
|
+
*/
|
|
664
|
+
declare function escapeJsonForScript(json: string): string;
|
|
665
|
+
/** 纯状态页:预览加载中 / 加载失败时的兜底内容,避免空白 webview。 */
|
|
666
|
+
declare function buildStatusHtml(message: string): string;
|
|
667
|
+
declare function buildPreviewHtml(options: {
|
|
668
|
+
baseUrl: string;
|
|
669
|
+
ossUrl: string;
|
|
670
|
+
sceneJson: string;
|
|
671
|
+
mock?: boolean;
|
|
672
|
+
runtimeUri: string;
|
|
673
|
+
appsUri?: string;
|
|
674
|
+
hostUri?: string;
|
|
675
|
+
appId?: string;
|
|
676
|
+
/** vscode=webview postMessage+混合内容代理;http=CLI 同源 /api/*。缺省 vscode。 */
|
|
677
|
+
host?: PreviewHostKind;
|
|
678
|
+
/** VSCode webview.cspSource;缺省回退 runtimeUri 的 origin(单测用)。 */
|
|
679
|
+
cspSource?: string;
|
|
680
|
+
tests?: WorkspaceTestCase[];
|
|
681
|
+
}): string;
|
|
682
|
+
|
|
683
|
+
export { APPS_DTS, APPS_MODULE, APPS_TYPES_FILE, APP_ID_HEADER, AUTH_HEADER, BundleError, type BundleResult, type BundleUserCodeOptions, type BundleWorkspaceModuleOptions, CODEX_MARKER_BEGIN, CODEX_MARKER_END, CONFIG_FILE_NAME, type CollectedFile, ConfigError, type ConfigScene, DEFAULT_BASE_URL, DEFAULT_BUNDLE_OUT, DEFAULT_ENTRY_PATH, DEFAULT_MAIN_TS, DEFAULT_OSS_URL, EASYTWIN_TYPES_DIR, ENDPOINTS, EXAMPLE_SCENE_FILE, EasyTwinApiError, EasyTwinClient, type EasyTwinConfig, type EasyTwinEnv, GITIGNORE_ENTRY, GITIGNORE_FILE_NAME, type GitignoreResult, type InitResult, LOCAL_LOAD_SCENE_ERROR, type LinkedScene, META_FILE_NAME, MINIMAL_TSCONFIG, MISSING_TICK_ERROR, MOCK_APP_ID, MOCK_APP_SECRET, MOCK_SCENE_NAME, PORTABLE_RUNTIME_EXPORTS, type PortableRuntimeExport, type PreviewHostKind, RUNTIME_MODULE, type RequestOptions, type ResolvedConfig, SKILL_NAMES, type SceneDetail, type SceneSummary, type SceneTreeNode, type SkillsStatus, type SkillsTargetStatus, type SyncAction, type SyncEntrySummary, type SyncOptions, type SyncSkillsResult, type SyncSummary, type SyncTarget, type SyncTargetArg, TEST_BASE_URL, TSCONFIG_PATHS_HINT, TwinApp, type TwinAppContext, type TwinAppEngine, TwinAppPreviewHost, type TwinAppPreviewHostOptions, type TwinAppRuntimeModule, type TwinAppRuntimeScene, type TwinAppSceneManager, type TwinAppTickListener, type TypesSyncSummary, USER_ENTRY, type UploadCreate, type UploadDelete, type UploadOptions, type UploadProgress, type UploadResult, type UploadUpdate, WORKSPACE_CODE_EXTENSIONS, WORKSPACE_IGNORED_DIRS, WORKSPACE_IGNORED_FILES, type WorkspaceChangeKind, type WorkspaceCodeConfig, type WorkspaceCodeFile, type WorkspaceFileChange, type WorkspacePullApplyResult, type WorkspacePullOptions, type WorkspacePullPlan, type WorkspacePullResult, type WorkspaceTestCase, type WorkspaceUploadPlan, appendGitignore, applyWorkspacePull, assertUploadable, buildMultipartBody, buildPreviewHtml, buildRuntimeTypesContent, buildStatusHtml, buildWorkspacePushBody, bundleUserCode, bundleWorkspaceModule, bundleWorkspaceTestFile, collectFiles, configFilePath, createAppInstance, defaultPullIgnore, defaultWorkspaceIgnore, defineApp, deriveExampleSceneId, detectSkillsStatus, directoryDepth, escapeHtml, escapeJsonForScript, exampleSceneSummary, extractInlineSourceMap, extractSceneArray, formatUploadResult, formatWorkspacePullPlan, formatWorkspacePullResult, initConfig, isIgnoredWorkspacePath, isMockCredentials, isSafeRelPath, isWorkspaceCodeFile, isWorkspaceSpecFile, listScenes, listWorkspaceTests, loadConfig, loadExampleScene, normalizeLinkedScenes, normalizePath, normalizeSceneList, normalizeTargets, normalizeWorkspaceConfig, normalizeWorkspaceFiles, parseConfig, parseExportedTestFunctions, parseSceneStructure, planWorkspacePull, planWorkspaceUpload, portableRuntimeWarning, pullScene, pullWorkspace, readConfigFile, readDevkitVersion, remapErrorStack, resolveConfig, resolveExampleScenePath, resolveRuntimeTypesSourceFile, resolveSkillsSourceDir, resolveSnapshotUrl, resolveWorkspaceAssetPath, saveSceneJson, syncSkills, toConfigScenes, typesMissingHint, uploadDirectory, validateConfigShape, workspacePullHasConflicts, workspacePullPendingWrites, workspaceTestId, writeConfigFile, writeConfigScenes };
|