feat: add builder configuration file
feat: add cocos-service configuration file feat: add device configuration file feat: add engine configuration file feat: add information configuration file feat: add program configuration file feat: add project configuration file feat: add TypeScript configuration file
This commit is contained in:
1191
extensions/we_sane/@types/editor.d.ts
vendored
Normal file
1191
extensions/we_sane/@types/editor.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
16092
extensions/we_sane/@types/electron.d.ts
vendored
Normal file
16092
extensions/we_sane/@types/electron.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
57
extensions/we_sane/@types/extension.d.ts
vendored
Normal file
57
extensions/we_sane/@types/extension.d.ts
vendored
Normal file
@@ -0,0 +1,57 @@
|
||||
declare namespace Editor {
|
||||
|
||||
namespace Interface {
|
||||
// ---- Package ---- start
|
||||
interface PackageInfo {
|
||||
debug: boolean;
|
||||
enable: boolean;
|
||||
info: PackageJson;
|
||||
invalid: boolean;
|
||||
name: string;
|
||||
path: string;
|
||||
version: string;
|
||||
}
|
||||
|
||||
interface PackageJson {
|
||||
name: string;
|
||||
version: string;
|
||||
|
||||
title?: string;
|
||||
author?: string;
|
||||
debug?: boolean;
|
||||
description?: string;
|
||||
main?: string;
|
||||
editor?: string;
|
||||
panel?: any;
|
||||
contributions?: { [key: string]: any };
|
||||
}
|
||||
// ---- Package ---- end
|
||||
|
||||
// ---- UI ---- start
|
||||
interface PanelInfo {
|
||||
template?: string;
|
||||
style?: string;
|
||||
listeners?: { [key: string]: () => {} };
|
||||
methods?: { [key: string]: Function };
|
||||
$?: { [key: string]: string };
|
||||
ready?(): void;
|
||||
update?(...args: any[]): void;
|
||||
beforeClose?(): void;
|
||||
close?(): void;
|
||||
}
|
||||
|
||||
namespace UIKit {
|
||||
interface UIPanelInfo extends PanelInfo {
|
||||
// 向上触发事件
|
||||
dispath(eventName: string, ...arg: any): void;
|
||||
}
|
||||
|
||||
interface EditorElementBase extends HTMLElement {
|
||||
value: any;
|
||||
dispath: (name: string, event: any) => void;
|
||||
}
|
||||
|
||||
}
|
||||
// ---- UI ---- end
|
||||
}
|
||||
}
|
||||
2
extensions/we_sane/@types/index.d.ts
vendored
Normal file
2
extensions/we_sane/@types/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/// <reference path="./editor.d.ts"/>
|
||||
/// <reference path="./message.d.ts"/>
|
||||
27
extensions/we_sane/@types/message.d.ts
vendored
Normal file
27
extensions/we_sane/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
import * as AssetDB from './packages/asset-db/@types/message';
|
||||
import * as Scene from './packages/scene/@types/message';
|
||||
import * as Engine from './packages/engine/@types/message';
|
||||
import * as Builder from './packages/builder/@types/public/message';
|
||||
import * as Programming from './packages/programming/@types/message';
|
||||
// import * as Extension from './packages/extension/@types/message';
|
||||
|
||||
declare global {
|
||||
interface EditorMessageContent {
|
||||
params: any[],
|
||||
result: any;
|
||||
}
|
||||
|
||||
interface EditorMessageMap {
|
||||
[x: string]: EditorMessageContent;
|
||||
}
|
||||
|
||||
interface EditorMessageMaps {
|
||||
[x: string]: EditorMessageMap;
|
||||
'asset-db': AssetDB.message;
|
||||
'scene': Scene.message;
|
||||
'engine': Engine.message;
|
||||
'builder': Builder.message;
|
||||
'programming': Programming.message,
|
||||
// 'extension': Extension.message;
|
||||
}
|
||||
}
|
||||
179
extensions/we_sane/@types/packages/asset-db/@types/message.d.ts
vendored
Normal file
179
extensions/we_sane/@types/packages/asset-db/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,179 @@
|
||||
import { AssetInfo, QueryAssetsOption, AssetOperationOption, AssetDBOptions, IAssetMeta } from './public';
|
||||
|
||||
export interface message extends EditorMessageMap {
|
||||
'query-ready': {
|
||||
params: [],
|
||||
result: boolean,
|
||||
},
|
||||
'create-asset': {
|
||||
params: [
|
||||
string,
|
||||
string | Buffer | null,
|
||||
] | [
|
||||
string,
|
||||
string | Buffer | null,
|
||||
AssetOperationOption,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'import-asset': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
] | [
|
||||
string,
|
||||
string,
|
||||
AssetOperationOption,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'copy-asset': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
] | [
|
||||
string,
|
||||
string,
|
||||
AssetOperationOption,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'move-asset': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
] | [
|
||||
string,
|
||||
string,
|
||||
AssetOperationOption,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'delete-asset': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'open-asset': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: void,
|
||||
},
|
||||
'save-asset': {
|
||||
params: [
|
||||
string,
|
||||
string | Buffer,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'save-asset-meta': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'reimport-asset': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'refresh-asset': {
|
||||
params: [
|
||||
string
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'query-asset-info': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'query-asset-meta': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: IAssetMeta | null,
|
||||
},
|
||||
'query-path': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'query-url': {
|
||||
params: [
|
||||
string
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'query-uuid': {
|
||||
params: [
|
||||
string
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'query-assets': {
|
||||
params: [] | [
|
||||
QueryAssetsOption,
|
||||
],
|
||||
result: AssetInfo[],
|
||||
},
|
||||
'generate-available-url': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: string,
|
||||
},
|
||||
|
||||
// private
|
||||
|
||||
'query-asset-mtime': {
|
||||
params: [
|
||||
string
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'refresh': {
|
||||
params: [],
|
||||
result: void,
|
||||
},
|
||||
'open-devtools': {
|
||||
params: [],
|
||||
result: void,
|
||||
},
|
||||
'query-db-info': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: AssetDBOptions,
|
||||
},
|
||||
'create-asset-dialog': {
|
||||
params: [
|
||||
string,
|
||||
] | [
|
||||
string,
|
||||
string,
|
||||
],
|
||||
result: string | null,
|
||||
},
|
||||
'init-asset': {
|
||||
params: [
|
||||
string,
|
||||
string,
|
||||
],
|
||||
result: AssetInfo | null,
|
||||
},
|
||||
'query-all-importer': {
|
||||
params: [],
|
||||
result: string[],
|
||||
},
|
||||
'query-all-asset-types': {
|
||||
params: [],
|
||||
result: string[],
|
||||
},
|
||||
}
|
||||
115
extensions/we_sane/@types/packages/asset-db/@types/public.d.ts
vendored
Normal file
115
extensions/we_sane/@types/packages/asset-db/@types/public.d.ts
vendored
Normal file
@@ -0,0 +1,115 @@
|
||||
// Basic information about the resource
|
||||
// 资源的基础信息
|
||||
export interface AssetInfo {
|
||||
// Asset name
|
||||
// 资源名字
|
||||
name: string;
|
||||
// Asset display name
|
||||
// 资源用于显示的名字
|
||||
displayName: string;
|
||||
// URL
|
||||
source: string;
|
||||
// loader 加载的层级地址
|
||||
path: string;
|
||||
// loader 加载地址会去掉扩展名,这个参数不去掉
|
||||
url: string;
|
||||
// 绝对路径
|
||||
file: string;
|
||||
// 资源的唯一 ID
|
||||
uuid: string;
|
||||
// 使用的导入器名字
|
||||
importer: string;
|
||||
// 类型
|
||||
type: string;
|
||||
// 是否是文件夹
|
||||
isDirectory: boolean;
|
||||
// 导入资源的 map
|
||||
library: { [key: string]: string };
|
||||
// 子资源 map
|
||||
subAssets: { [key: string]: AssetInfo };
|
||||
// 是否显示
|
||||
visible: boolean;
|
||||
// 是否只读
|
||||
readonly: boolean;
|
||||
|
||||
// 虚拟资源可以实例化成实体的话,会带上这个扩展名
|
||||
instantiation?: string;
|
||||
// 跳转指向资源
|
||||
redirect?: IRedirectInfo;
|
||||
// 继承类型
|
||||
extends?: string[];
|
||||
// 是否导入完成
|
||||
imported: boolean;
|
||||
// 是否导入失败
|
||||
invalid: boolean;
|
||||
}
|
||||
|
||||
export interface IRedirectInfo {
|
||||
// 跳转资源的类型
|
||||
type: string;
|
||||
// 跳转资源的 uuid
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export interface QueryAssetsOption {
|
||||
type?: string;
|
||||
pattern?: string;
|
||||
ccType?: string;
|
||||
extname?: string;
|
||||
importer?: string;
|
||||
isBundle?: boolean;
|
||||
}
|
||||
|
||||
export interface AssetOperationOption {
|
||||
// 是否强制覆盖已经存在的文件,默认 false
|
||||
overwrite?: boolean;
|
||||
// 是否自动重命名冲突文件,默认 false
|
||||
rename?: boolean;
|
||||
}
|
||||
|
||||
export interface AssetDBOptions {
|
||||
name: string;
|
||||
target: string;
|
||||
library: string;
|
||||
temp: string;
|
||||
/**
|
||||
* 0: 忽略错误
|
||||
* 1: 仅仅打印错误
|
||||
* 2: 打印错误、警告
|
||||
* 3: 打印错误、警告、日志
|
||||
* 4: 打印错误、警告、日志、调试信息
|
||||
*/
|
||||
level: number;
|
||||
ignoreFiles: string[];
|
||||
readonly: boolean;
|
||||
}
|
||||
|
||||
export interface ContributionInfo {
|
||||
mount?: {
|
||||
path: string;
|
||||
readonly?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
export interface ExecuteAssetDBScriptMethodOptions {
|
||||
name: string;
|
||||
method: string;
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export interface IAssetMeta {
|
||||
ver: string;
|
||||
importer: string;
|
||||
imported: boolean;
|
||||
uuid: string;
|
||||
files: string[];
|
||||
subMetas: {
|
||||
[index: string]: IAssetMeta;
|
||||
};
|
||||
userData: {
|
||||
[index: string]: any;
|
||||
};
|
||||
displayName: string;
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
2
extensions/we_sane/@types/packages/builder/@types/index.d.ts
vendored
Normal file
2
extensions/we_sane/@types/packages/builder/@types/index.d.ts
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
|
||||
export * from './public';
|
||||
117
extensions/we_sane/@types/packages/builder/@types/protect/asset-manager.d.ts
vendored
Normal file
117
extensions/we_sane/@types/packages/builder/@types/protect/asset-manager.d.ts
vendored
Normal file
@@ -0,0 +1,117 @@
|
||||
import { AssetInfo } from "../../../asset-db/@types/public";
|
||||
import { UUID } from "../public";
|
||||
import { IInternalBuildOptions } from "./options";
|
||||
export interface IBuildStatiscInfo {
|
||||
packageName: string;
|
||||
gameName: string;
|
||||
platform: string;
|
||||
scenesNum: number;
|
||||
assetsNum: number;
|
||||
scriptNum: number;
|
||||
|
||||
includeModules: string[];
|
||||
orientation: string;
|
||||
remoteServerAddress: string;
|
||||
appid: string;
|
||||
|
||||
size: number;
|
||||
time: number;
|
||||
err: string;
|
||||
}
|
||||
|
||||
// ********************************* asset-manager *********************************
|
||||
|
||||
export class BuilderAssetCache {
|
||||
// 场景资源的 assets 信息缓存
|
||||
public readonly sceneUuids: Array<string>;
|
||||
|
||||
// 脚本资源的 assets 信息缓存
|
||||
public readonly scriptUuids: Array<string>;
|
||||
|
||||
// 除场景、脚本资源外的资源 assets uuid 缓存
|
||||
public readonly assetUuids: Array<string>;
|
||||
|
||||
init: () => Promise<void>;
|
||||
addAsset: (asset: IAssetInfo) => void;
|
||||
addInstance: (instance: any) => void;
|
||||
clearAsset: (uuid: string) => void;
|
||||
getMeta: (uuid: string) => Promise<any>;
|
||||
getAssetInfo: (uuid: string) => IAssetInfo;
|
||||
getDependUuids: (uuid: string) => Promise<readonly string[]>;
|
||||
getDependUuidsDeep: (uuid: string) => Promise<readonly string[]>;
|
||||
/**
|
||||
* 获取序列化文件
|
||||
*/
|
||||
getLibraryJSON: (uuid: string) => Promise<any>;
|
||||
getSerializedJSON: (uuid: string, options: IInternalBuildOptions) => Promise<any>;
|
||||
forEach: (type: string, handle: Function) => Promise<void>;
|
||||
getInstance: (uuid: string) => Promise<any>;
|
||||
__addStaticsInfo: (info: any) => void;
|
||||
}
|
||||
|
||||
export interface IAssetInfo extends AssetInfo {
|
||||
meta?: any;
|
||||
temp?: string; // 资源的构建缓存目录
|
||||
fatherInfo?: any;
|
||||
// fatherUuid?: string | undefined;
|
||||
userData?: any;
|
||||
subAssets: Record<string, IAssetInfo>;
|
||||
dirty?: boolean;
|
||||
// 内置资源没有 mtime
|
||||
mtime?: number;
|
||||
}
|
||||
export type IUrl = string; // 需要的是符合 url 标准的字符串,例如 asset/script/text.ts
|
||||
export type IAssetInfoMap = Record<UUID, IAssetInfo>;
|
||||
export type IUuidDependMap = Record<UUID, UUID[]>;
|
||||
export type IJsonGroupMap = Record<UUID, IJSONGroupItem>;
|
||||
export type IAssetGroupMap = Record<UUID, IAssetGroupItem>;
|
||||
|
||||
// TODO meta 的类型定义
|
||||
export type IMetaMap = Record<UUID, any>;
|
||||
export type IJsonMap = Record<UUID, any>;
|
||||
export type IInstanceMap = Record<UUID, any>;
|
||||
|
||||
export type ICompressOptions = Record<string, number>;
|
||||
export interface IAssetGroupItem {
|
||||
// 分组名字
|
||||
// name: string;
|
||||
// 分组的根 url
|
||||
baseUrls: string[];
|
||||
// 脚本编译后的实际地址
|
||||
scriptDest: string;
|
||||
// 脚本 uuid 列表
|
||||
scriptUuids: UUID[];
|
||||
// raw 资源 uuid 列表
|
||||
assetUuids: UUID[];
|
||||
}
|
||||
|
||||
export interface IJSONGroupItem {
|
||||
// 分组名字
|
||||
name?: string;
|
||||
// 分组名字
|
||||
type: string;
|
||||
// json 资源 uuid 列表
|
||||
uuids: UUID[];
|
||||
}
|
||||
|
||||
export interface IAssetGroupOptions {
|
||||
// 脚本打包后的输出路径
|
||||
scriptUrl: string;
|
||||
baseUrl: string;
|
||||
}
|
||||
|
||||
export type IGroupType = 'json' | 'script' | 'asset';
|
||||
export interface PacInfo {
|
||||
meta: any;
|
||||
asset: IAssetInfo;
|
||||
spriteFrames: any[];
|
||||
relativePath: string;
|
||||
relativeDir: string;
|
||||
}
|
||||
|
||||
export type IUpdateType = 'asset-change' | 'asset-add' | 'asset-delete';
|
||||
export interface IUpdateInfo {
|
||||
type: IUpdateType;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
152
extensions/we_sane/@types/packages/builder/@types/protect/build-plugin.d.ts
vendored
Normal file
152
extensions/we_sane/@types/packages/builder/@types/protect/build-plugin.d.ts
vendored
Normal file
@@ -0,0 +1,152 @@
|
||||
// ********************************* plugin ****************************************
|
||||
|
||||
import { BundleCompressionType, IBuildPluginConfig, IBuildTaskOption, IDisplayOptions, ISettings, IVerificationRuleMap } from '../public';
|
||||
import { BuilderAssetCache } from './asset-manager';
|
||||
import { InternalBuildResult } from './build-result';
|
||||
import { IInternalBuildOptions } from './options';
|
||||
import { ITextureCompressPlatform, ITextureCompressType } from '../public/texture-compress';
|
||||
|
||||
export interface IBuildWorkerPluginInfo {
|
||||
assetHandlers?: string;
|
||||
// 注册到各个平台的钩子函数
|
||||
hooks?: Record<string, string>;
|
||||
pkgName: string;
|
||||
internal: boolean; // 是否为内置插件
|
||||
priority: number; // 优先级
|
||||
}
|
||||
|
||||
export type IPluginHookName =
|
||||
| 'onBeforeBuild'
|
||||
| 'onAfterInit'
|
||||
| 'onBeforeInit'
|
||||
| 'onAfterInit'
|
||||
| 'onBeforeBuildAssets'
|
||||
| 'onAfterBuildAssets'
|
||||
| 'onBeforeCompressSettings'
|
||||
| 'onAfterCompressSettings'
|
||||
| 'onAfterBuild';
|
||||
// | 'onBeforeCompile'
|
||||
// | 'compile'
|
||||
// | 'onAfterCompile'
|
||||
// | 'run';
|
||||
|
||||
export type IPluginHook = Record<IPluginHookName, IInternalBaseHooks>;
|
||||
export interface IInternalHook {
|
||||
throwError?: boolean; // 插件注入的钩子函数,在执行失败时是否直接退出构建流程
|
||||
title?: string; // 插件任务整体 title,支持 i18n 写法
|
||||
// ------------------ 钩子函数 --------------------------
|
||||
onBeforeBuild?: IInternalBaseHooks;
|
||||
onBeforeInit?: IInternalBaseHooks;
|
||||
onAfterInit?: IInternalBaseHooks;
|
||||
onBeforeBuildAssets?: IInternalBaseHooks;
|
||||
onAfterBuildAssets?: IInternalBaseHooks;
|
||||
onBeforeCompressSettings?: IInternalBaseHooks;
|
||||
onAfterCompressSettings?: IInternalBaseHooks;
|
||||
onAfterBuild?: IInternalBaseHooks;
|
||||
// ------------------ 其他操作函数 ---------------------
|
||||
// 内置插件才有可能触发这个函数
|
||||
run?: (dest: string, options: IBuildTaskOption) => Promise<boolean>;
|
||||
// 内置插件才有可能触发这个函数
|
||||
compile?: (dest: string, options: IBuildTaskOption) => boolean;
|
||||
}
|
||||
|
||||
export type IInternalBaseHooks = (options: IInternalBuildOptions, result: InternalBuildResult, cache: BuilderAssetCache, ...args: any[]) => void;
|
||||
export interface IBuildTask {
|
||||
handle: (options: IInternalBuildOptions, result: InternalBuildResult, cache: BuilderAssetCache, settings?: ISettings) => {};
|
||||
title: string;
|
||||
name: string;
|
||||
}
|
||||
|
||||
export interface IBuildHooksInfo {
|
||||
pkgNameOrder: string[];
|
||||
infos: Record<string, { path: string; internal: boolean }>;
|
||||
}
|
||||
export interface IBuildAssetHandlerInfo {
|
||||
pkgNameOrder: string[];
|
||||
handles: {[pkgName: string]: Function};
|
||||
}
|
||||
export interface IInternalBuildPluginConfig extends IBuildPluginConfig {
|
||||
platformName?: string; // 平台名,可以指定为 i18n 写法, 只有官方构建插件的该字段有效
|
||||
hooks?: string; // 钩子函数的存储路径
|
||||
panel?: string; // 存储导出 vue 组件、button 配置的脚本路径
|
||||
textureCompressConfig?: {
|
||||
// 仅对内部插件开放
|
||||
platformType: ITextureCompressPlatform; // 注册的纹理压缩平台类型
|
||||
support: {
|
||||
rgba: ITextureCompressType[];
|
||||
rgb: ITextureCompressType[];
|
||||
}; // 该平台支持的纹理压缩格式,按照推荐优先级排列
|
||||
};
|
||||
assetBundleConfig?: {
|
||||
// asset bundle 的配置
|
||||
supportedCompressionTypes: BundleCompressionType[];
|
||||
};
|
||||
priority?: number;
|
||||
wrapWithFold?: boolean; // 是否将选项显示在折叠框内(默认 true )
|
||||
options?: IDisplayOptions; // 需要注入的平台参数配置
|
||||
verifyRuleMap?: IVerificationRuleMap; // 注入的需要更改原有参数校验规则的函数
|
||||
commonOptions?: Record<string, boolean>;
|
||||
// TODO 之前为 ios-app-clip HACK 出来的接口,之后需要重新设计
|
||||
realInFileExplorer?: (options: IInternalBuildOptions | any) => void; // 根据构建配置计算输出地址(界面中的在文件夹中显示)
|
||||
debugConfig?: IDebugConfig;
|
||||
internal?: boolean;
|
||||
}
|
||||
|
||||
export interface BuildCheckResult {
|
||||
error: string;
|
||||
newValue: any;
|
||||
}
|
||||
|
||||
export type IBuildVerificationFunc = (value: any, options: IBuildTaskOption) => boolean | Promise<boolean>;
|
||||
|
||||
export interface IButtonConfigItem {
|
||||
label: string; // 按钮名称
|
||||
click?: (event: Event, options: IBuildTaskOption) => void; // 点击事件响应函数
|
||||
hookHandle?: string; // 点击后执行的方法,与 click 二选一
|
||||
tooltip?: string; // 鼠标上移到按钮上的文本提示
|
||||
// 只有指定 hookHandle 配置的按钮,才可以影响进度条,构建将会自动为每个按钮创建一个构建内置任务,并提供对应的进度 log 更新等等。
|
||||
// attributes?: any; // 想要添加在按钮上的一些属性值(class, style, title)
|
||||
}
|
||||
|
||||
export interface IDebugConfig {
|
||||
options?: IDisplayOptions; // 显示在构建平台编译运行调试工具上的配置选项
|
||||
custom?: string; // 显示在构建平台编译运行调试工具上的配置 vue 组件
|
||||
}
|
||||
|
||||
// ui-panel 注册数据
|
||||
export interface PanelInfo {
|
||||
$?: { [name: string]: string | HTMLElement | null };
|
||||
template?: string; // TODO 暂时设置为可选
|
||||
style?: string;
|
||||
methods?: { [name: string]: Function };
|
||||
ready?: Function;
|
||||
close?: Function;
|
||||
update?: (options: IBuildTaskOption, path: string, value: any) => void | Promise<void>;
|
||||
}
|
||||
|
||||
export interface IPanelThis {
|
||||
$: Record<string, HTMLElement>;
|
||||
dispatch: (name: string, ...args: any[]) => void;
|
||||
}
|
||||
|
||||
export interface IPanelInfo extends PanelInfo {
|
||||
component?: any; // 注入面板的 vue 组件,可与与 options 共存,options 会优先显示
|
||||
buttonConfig?: IButtonConfig; // 要注入的构建选项脚本
|
||||
}
|
||||
|
||||
export interface IButtonConfig {
|
||||
configs?: Record<string, IButtonConfigItem>;
|
||||
custom?: any;
|
||||
}
|
||||
|
||||
export interface ICompInfo {
|
||||
custom?: any;
|
||||
options?: IDisplayOptions;
|
||||
panelInfo?: PanelInfo;
|
||||
displayName?: string;
|
||||
wrapWithFold: boolean;
|
||||
|
||||
// ..... 初始化时未存在的字段 .....
|
||||
panel?: any; // 实例化后的 panel 对象
|
||||
pkgName?: string; // 插件名称
|
||||
}
|
||||
141
extensions/we_sane/@types/packages/builder/@types/protect/build-result.d.ts
vendored
Normal file
141
extensions/we_sane/@types/packages/builder/@types/protect/build-result.d.ts
vendored
Normal file
@@ -0,0 +1,141 @@
|
||||
import { BundleCompressionType, IAssetPathInfo, IBuildPaths, IBuildTaskOption, IBundleConfig, IJsonPathInfo, ISettings, UUID } from "../public";
|
||||
import { IAssetInfo } from "./asset-manager";
|
||||
import { ImportMapWithImports } from "./import-map";
|
||||
|
||||
export class InternalBuildResult {
|
||||
settings: ISettings;
|
||||
readonly bundles: IBundle[];
|
||||
readonly bundleMap: Record<string, IBundle>;
|
||||
// 构建实际使用到的插件脚本 uuid 列表
|
||||
plugins: UUID[];
|
||||
// 脚本资源包分组(子包/分包)
|
||||
scriptPackages: string[];
|
||||
// MD5 后缀 map
|
||||
pluginVers: Record<UUID, string>;
|
||||
// 纹理压缩任务
|
||||
imageTaskMap: Record<UUID, IImageTask>;
|
||||
compressImageResult: ICompressImageResult;
|
||||
importMap: ImportMapWithImports;
|
||||
// 传入构建的 options
|
||||
rawOptions: IBuildTaskOption;
|
||||
// 输出路径集合
|
||||
paths: IBuildPaths;
|
||||
// 允许自定义编译选项
|
||||
compileOptions?: any;
|
||||
addBundle: (bundle: IBundle) => void;
|
||||
addPlugin: (plugin: IAssetInfo) => void;
|
||||
}
|
||||
|
||||
export interface IImageTask {
|
||||
src: string;
|
||||
// TODO 这个名称已和意义有冲突需要整理调整
|
||||
dest: string[];
|
||||
presetId: string;
|
||||
hasAlpha: boolean;
|
||||
mtime?: any;
|
||||
// 生成阶段将会重新获取 bundle 的输出地址
|
||||
bundleNames: string[];
|
||||
}
|
||||
|
||||
export interface IVersionMap {
|
||||
import: Record<UUID, string>;
|
||||
native: Record<UUID, string>;
|
||||
}
|
||||
|
||||
export interface IMD5Map {
|
||||
'raw-assets': Record<UUID, string>;
|
||||
import: Record<UUID, string>;
|
||||
plugin?: Record<UUID, string>;
|
||||
}
|
||||
export interface IAtlasResult {
|
||||
assetsToImage: Record<string, string>;
|
||||
imageToAtlas: Record<string, string>;
|
||||
atlasToImages: Record<string, string[]>;
|
||||
}
|
||||
|
||||
export class IBundle {
|
||||
readonly scenes: UUID[]; // 该 bundle 中的所有场景,包含重定向的
|
||||
readonly assets: UUID[]; // 该 bundle 中的所有资源,包含重定向的
|
||||
readonly assetsWithoutRedirect: UUID[]; // 该 bundle 中的未重定向的资源
|
||||
readonly scripts: UUID[]; // 该 bundle 中的所有脚本
|
||||
readonly rootAssets: UUID[]; // 该 bundle 中的根资源,即直接放在 bundle 目录下的资源,包含重定向的资源
|
||||
readonly isSubpackage: boolean; // 该 bundle 是否是子包
|
||||
root: string; // bundle 的根目录, 开发者勾选的目录,如果是 main 包,这个字段为 ''
|
||||
dest: string; // bundle 的输出目录
|
||||
importBase: string;
|
||||
nativeBase: string;
|
||||
scriptDest: string; // 脚本的输出目录
|
||||
name: string; // bundle 的名称
|
||||
priority: number; // bundle 的优先级
|
||||
compressionType: BundleCompressionType; // bundle 的压缩类型
|
||||
assetVer: IVersionMap; // bundle 内的资源版本
|
||||
version: string; // bundle 本身的版本信息
|
||||
readonly isRemote: boolean; // bundle 是否是远程包
|
||||
redirect: Record<UUID, string>; // bundle 中的重定向资源
|
||||
deps: Set<string>; // bundle 的依赖 bundle
|
||||
groups: IGroup[]; // 该 bundle 中的资源分组
|
||||
cache: any;
|
||||
configOutPutName: string;
|
||||
config: IBundleConfig; // 该 bundle 的资源清单
|
||||
readonly isZip: boolean; // 该 bundle 是否是 zip 模式
|
||||
zipVer: string; // Zip 压缩模式,压缩包的版本
|
||||
atlasRes: IAtlasResult;
|
||||
_rootAssets: Set<UUID>; // 该 bundle 直接包含的资源
|
||||
_scenes: Set<UUID>;
|
||||
_scripts: Set<UUID>;
|
||||
_assets: Set<UUID>;
|
||||
|
||||
addScene(scene: IAssetInfo): void;
|
||||
addScript(script: IAssetInfo): void;
|
||||
addRootAsset(asset: IAssetInfo): void;
|
||||
addAsset(asset: IAssetInfo): void;
|
||||
removeAsset(asset: UUID): void;
|
||||
addRedirectWithUuid(asset: UUID, redirect: string): void;
|
||||
addRedirect(asset: IAssetInfo, redirect: string): void;
|
||||
addAssetWithUuid(asset: UUID): void;
|
||||
getRedirect(uuid: UUID): string | undefined;
|
||||
addGroup(type: IJSONGroupType, uuids: UUID[]): void;
|
||||
addToGroup(type: IJSONGroupType, uuid: UUID): void;
|
||||
removeFromGroups(uuid: UUID): void;
|
||||
getJsonPath(uuid: string): string;
|
||||
getAssetPathInfo(uuid: string): IAssetPathInfo | null;
|
||||
containsAsset(uuid: string): boolean;
|
||||
getRawAssetPaths(uuid: string): string[];
|
||||
getJsonPathInfo(uuid: string): IJsonPathInfo | null;
|
||||
|
||||
_resolveImportPath: (name: string) => string;
|
||||
_resolveNativePath: (libraryPath: string, extName: string) => string;
|
||||
}
|
||||
|
||||
export type ICompressImageResult = Record<UUID, {
|
||||
formats: string[],
|
||||
files: string[],
|
||||
}>;
|
||||
|
||||
export interface IGroup {
|
||||
// 分组名字
|
||||
name?: string;
|
||||
// 分组类型
|
||||
type: IJSONGroupType;
|
||||
// 该组中的资源 uuid 列表
|
||||
uuids: UUID[];
|
||||
}
|
||||
|
||||
export type IJSONGroupType = 'NORMAL' | 'TEXTURE' | 'IMAGE';
|
||||
|
||||
export interface IDefaultGroup {
|
||||
assetUuids: UUID[];
|
||||
scriptUuids: UUID[];
|
||||
jsonUuids: UUID[];
|
||||
}
|
||||
|
||||
export interface IBundleOptions {
|
||||
root: string, // bundle 的根目录, 开发者勾选的目录,如果是 main 包,这个字段为''
|
||||
dest: string, // bundle 的输出目录
|
||||
scriptDest: string, // 脚本的输出目录
|
||||
name: string, // bundle 的名称
|
||||
priority: number, // bundle 的优先级
|
||||
compressionType: BundleCompressionType, // bundle 的压缩类型
|
||||
isRemote: boolean // bundle 是否是远程包
|
||||
// isEncrypted: boolean // bundle 中的代码是否加密,原生平台使用
|
||||
}
|
||||
18
extensions/we_sane/@types/packages/builder/@types/protect/global.d.ts
vendored
Normal file
18
extensions/we_sane/@types/packages/builder/@types/protect/global.d.ts
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
import { IBuildPanel, IInternalBuild } from ".";
|
||||
|
||||
// 定义 builder 进程内的全局变量
|
||||
declare global {
|
||||
// 构建进程可用
|
||||
// @ts-ignore
|
||||
const Build: IInternalBuild;
|
||||
|
||||
const __manager: {
|
||||
taskManager: any;
|
||||
currentCompileTask: any;
|
||||
currentBuildTask: any;
|
||||
__taskId: string;
|
||||
};
|
||||
|
||||
// 渲染进程可用
|
||||
const BuildPanel: IBuildPanel;
|
||||
}
|
||||
7
extensions/we_sane/@types/packages/builder/@types/protect/import-map.d.ts
vendored
Normal file
7
extensions/we_sane/@types/packages/builder/@types/protect/import-map.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
|
||||
export interface ImportMap {
|
||||
imports?: Record<string, string>;
|
||||
scopes?: Record<string, Record<string, string>>;
|
||||
}
|
||||
|
||||
export type ImportMapWithImports = ImportMap & { imports: NonNullable<ImportMap['imports']> };
|
||||
89
extensions/we_sane/@types/packages/builder/@types/protect/index.d.ts
vendored
Normal file
89
extensions/we_sane/@types/packages/builder/@types/protect/index.d.ts
vendored
Normal file
@@ -0,0 +1,89 @@
|
||||
import { IBuild, IBuildUtils, ITaskState } from '../public';
|
||||
import { InternalBuildResult } from './build-result';
|
||||
|
||||
export * from './asset-manager';
|
||||
export * from './import-map';
|
||||
export * from './options';
|
||||
export * from './build-result';
|
||||
export * from './build-plugin';
|
||||
export * from '../public';
|
||||
|
||||
export type Physics = 'cannon' | 'ammo' | 'builtin';
|
||||
export type Url = string; // 需要的是符合 url 标准的字符串
|
||||
export type AssetInfoArr = Array<string | number>; // 固定两位或三位数组 [url,ccType,isSubAsset]
|
||||
export type IProcessingFunc = (process: number, message: string, state?: ITaskState) => void;
|
||||
export interface IBuildManager {
|
||||
taskManager: any;
|
||||
currentCompileTask: any;
|
||||
currentBuildTask: any;
|
||||
__taskId: string;
|
||||
}
|
||||
|
||||
export interface IQuickSpawnOption {
|
||||
cwd?: string;
|
||||
env?: any;
|
||||
downGradeWaring?: boolean; // 将会转为 log 打印,默认为 false
|
||||
downGradeLog?: boolean; // 将会转为 debug 打印,默认为 true
|
||||
downGradeError?: boolean; // 将会转为警告,默认为 false
|
||||
ignoreLog?: boolean; // 忽略 log 信息
|
||||
}
|
||||
export interface IInternalBuildUtils extends IBuildUtils {
|
||||
/**
|
||||
* 获取构建出的所有模块或者模块包文件。
|
||||
*/
|
||||
getModuleFiles(result: InternalBuildResult): Promise<string[]>;
|
||||
|
||||
/**
|
||||
* 快速开启子进程
|
||||
* @param command
|
||||
* @param cmdParams
|
||||
* @param options
|
||||
*/
|
||||
quickSpawn(command: string, cmdParams: string[], options?: IQuickSpawnOption): Promise<number | boolean>;
|
||||
|
||||
/**
|
||||
* 将某个 hash 值添加到某个路径上
|
||||
* @param targetPath
|
||||
* @param hash
|
||||
* @returns
|
||||
*/
|
||||
patchMd5ToPath(targetPath: string, hash: string): string;
|
||||
}
|
||||
|
||||
export interface IInternalBuild extends IBuild {
|
||||
Utils: IInternalBuildUtils;
|
||||
}
|
||||
|
||||
export interface IBuildProcessInfo {
|
||||
state: ITaskState; // 任务状态
|
||||
progress: number; // 任务进度
|
||||
message: string; // 最后一次更新的进度消息
|
||||
id: string; // 任务唯一标识符
|
||||
options: any; // 构建参数
|
||||
}
|
||||
|
||||
export interface fileMap {
|
||||
src: string;
|
||||
dest: string;
|
||||
}
|
||||
|
||||
export interface IScriptInfo {
|
||||
file: string;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
type ICheckRule = 'pathExist' | 'valid' | 'required' | 'normalName' | 'noChinese' | 'array' | 'string' | 'number' | 'http';
|
||||
|
||||
export interface IBuildPanel {
|
||||
// 内部使用的 Vue
|
||||
Vue: any;
|
||||
// 内置 vue 组件
|
||||
vueComps: {
|
||||
buildProp: any;
|
||||
templateComp: any;
|
||||
},
|
||||
validator: {
|
||||
has: (ruleName: string) => boolean;
|
||||
check: (ruleName: ICheckRule, val: any) => boolean;
|
||||
},
|
||||
}
|
||||
145
extensions/we_sane/@types/packages/builder/@types/protect/options.d.ts
vendored
Normal file
145
extensions/we_sane/@types/packages/builder/@types/protect/options.d.ts
vendored
Normal file
@@ -0,0 +1,145 @@
|
||||
import { IBuildTimeConstantValue } from "@cocos/build-engine/dist/build-time-constants";
|
||||
import { IBuildDesignResolution, IBuildTaskOption } from "../public";
|
||||
|
||||
export interface ScriptAssetuserData {
|
||||
isPlugin?: boolean;
|
||||
isNative?: boolean;
|
||||
loadPluginInNative?: boolean;
|
||||
loadPluginInWeb?: boolean;
|
||||
}
|
||||
|
||||
export interface IBuildScriptParam {
|
||||
/**
|
||||
* 若存在,表示将 import map 转换为指定的模块格式。
|
||||
*/
|
||||
importMapFormat?: 'commonjs' | 'esm';
|
||||
|
||||
polyfills?: IPolyFills;
|
||||
|
||||
/**
|
||||
* 擦除模块结构。当选择后会获得更快的脚本导入速度,但无法再使用模块特性,如 `import.meta`、`import()` 等。
|
||||
* @experimental
|
||||
*/
|
||||
experimentalEraseModules?: boolean;
|
||||
outputName: string; // 输出文件夹名称(带后缀)
|
||||
targets?: ITransformTarget;
|
||||
|
||||
system?: {
|
||||
preset?: 'web' | 'commonjs-like',
|
||||
},
|
||||
|
||||
flags: Record<string, IBuildTimeConstantValue>,
|
||||
}
|
||||
|
||||
export interface IPolyFills {
|
||||
/**
|
||||
* True if async functions polyfills(i.e. regeneratorRuntime) needs to be included.
|
||||
* You need to turn on this field if you want to use async functions in language.
|
||||
*/
|
||||
asyncFunctions?: boolean;
|
||||
|
||||
/**
|
||||
* If true, [core-js](https://github.com/zloirock/core-js) polyfills are included.
|
||||
* The default options of [core-js-builder](https://github.com/zloirock/core-js/tree/master/packages/core-js-builder)
|
||||
* will be used to build the core-js.
|
||||
*/
|
||||
coreJs?: boolean;
|
||||
|
||||
targets?: string;
|
||||
}
|
||||
/**
|
||||
* 模块保留选项。
|
||||
* - 'erase' 擦除模块信息。生成的代码中将不会保留模块信息。
|
||||
* - 'preserve' 保留原始模块信息。生成的文件将和原始模块文件结构一致。
|
||||
* - 'facade' 保留原始模块信息,将所有模块转化为一个 SystemJS 模块,但这些模块都打包在一个单独的 IIFE bundle 模块中。
|
||||
* 当这个 bundle 模块执行时,所有模块都会被注册。
|
||||
* 当你希望代码中仍旧使用模块化的特性(如动态导入、import.meta.url),但又不希望模块零散在多个文件时可以使用这个选项。
|
||||
*/
|
||||
export type ModulePreservation = 'erase' | 'preserve' | 'facade';
|
||||
|
||||
export type INewConsoleType = 'log' | 'warn' | 'error' | 'debug';
|
||||
|
||||
export interface IInternalBuildOptions extends IBuildTaskOption {
|
||||
dest: string;
|
||||
// 编译 application.js 参数配置
|
||||
appTemplateData: appTemplateData;
|
||||
// 编译引擎参数配置
|
||||
buildEngineParam: IBuildEngineParam;
|
||||
// 编译脚本配置选项
|
||||
buildScriptParam: IBuildScriptParam;
|
||||
// 序列化打包资源时的特殊处理
|
||||
assetSerializeOptions: {
|
||||
'cc.EffectAsset': {
|
||||
glsl1: boolean;
|
||||
glsl3: boolean;
|
||||
glsl4: boolean;
|
||||
};
|
||||
// 是否输出 ccon 格式
|
||||
exportCCON?: boolean;
|
||||
|
||||
allowCCONExtension?: boolean;
|
||||
};
|
||||
updateOnly: boolean;
|
||||
nextTasks?: string[];
|
||||
generateCompileConfig?: boolean;
|
||||
recompileConfig?: IRecompileConfig;
|
||||
logDest?: string; // log 输出地址
|
||||
|
||||
// 项目设置,重复定义为必选参数
|
||||
includeModules: string[];
|
||||
renderPipeline: string;
|
||||
designResolution: IBuildDesignResolution;
|
||||
physicsConfig: any;
|
||||
flags: Record<string, boolean>;
|
||||
}
|
||||
|
||||
|
||||
export interface appTemplateData {
|
||||
debugMode: boolean;
|
||||
renderMode: boolean; // !!options.renderMode,
|
||||
// ImportMapSupported: boolean;
|
||||
// NonconformingCommonJs: boolean;
|
||||
showFPS: boolean;
|
||||
importMapFile?: string;
|
||||
resolution: {
|
||||
policy: number;
|
||||
width: number;
|
||||
height: number;
|
||||
};
|
||||
// hasPhysicsAmmo: boolean;
|
||||
md5Cache: boolean;
|
||||
server: string; // 服务器地址
|
||||
|
||||
cocosTemplate?: string; // 注入的子模板路径
|
||||
}
|
||||
|
||||
export interface IBuildEngineParam {
|
||||
entry?: string; // 引擎入口文件
|
||||
debug: boolean;
|
||||
sourceMaps: boolean;
|
||||
platform: string;
|
||||
includeModules: string[];
|
||||
engineVersion: string;
|
||||
md5Map: string[];
|
||||
engineName: string;
|
||||
useCache: boolean;
|
||||
split?: boolean;
|
||||
targets?: ITransformTarget;
|
||||
skip?: boolean;
|
||||
ammoJsWasm?: boolean | 'fallback';
|
||||
assetURLFormat?:
|
||||
| 'relative-from-out'
|
||||
| 'relative-from-chunk'
|
||||
| 'runtime-resolved';
|
||||
baseUrl?: string;
|
||||
}
|
||||
|
||||
export type ITransformTarget = string | string[] | Record<string, string>;
|
||||
|
||||
export interface IRecompileConfig {
|
||||
enable: boolean;
|
||||
generateAssets: boolean;
|
||||
generateScripts: boolean;
|
||||
generateEngine: boolean; // 是否生成引擎
|
||||
generateEngineByCache: boolean; // 是否使用缓存引擎
|
||||
}
|
||||
76
extensions/we_sane/@types/packages/builder/@types/public/build-plugin.d.ts
vendored
Normal file
76
extensions/we_sane/@types/packages/builder/@types/public/build-plugin.d.ts
vendored
Normal file
@@ -0,0 +1,76 @@
|
||||
import { ITextureCompressType, IPVRQuality, IASTCQuality, IETCQuality } from './texture-compress';
|
||||
import { IBuildTaskOption } from './options';
|
||||
import { IBuildResult } from './build-result';
|
||||
|
||||
export interface IBuildPluginConfig {
|
||||
hooks?: string; // relate url about IHook
|
||||
options?: IDisplayOptions; // config of options
|
||||
verifyRuleMap?: IVerificationRuleMap;
|
||||
}
|
||||
|
||||
export type IVerificationFunc = (val: any, ...arg: any[]) => boolean | Promise<boolean>;
|
||||
|
||||
export type IVerificationRuleMap = Record<
|
||||
string,
|
||||
{
|
||||
func?: IVerificationFunc;
|
||||
message?: string;
|
||||
}
|
||||
>;
|
||||
|
||||
export type IDisplayOptions = Record<string, IConfigItem>;
|
||||
|
||||
export type ArrayItem = {
|
||||
label: string;
|
||||
value: string;
|
||||
};
|
||||
export interface IConfigItem {
|
||||
// 配置显示的名字,如果需要翻译,则传入 i18n:${key}
|
||||
label?: string;
|
||||
// 设置的简单说明
|
||||
description?: string;
|
||||
// 默认值
|
||||
default?: any;
|
||||
// 配置的类型
|
||||
type?: 'array' | 'object';
|
||||
itemConfigs?: IConfigItem[] | Record<string, IConfigItem>;
|
||||
verifyRules?: string[];
|
||||
attributes?: any;
|
||||
render?: {
|
||||
ui: string;
|
||||
attributes?: any;
|
||||
items?: ArrayItem[];
|
||||
};
|
||||
}
|
||||
|
||||
export interface IBuildPlugin {
|
||||
configs?: BuildPlugin.Configs;
|
||||
assetHandlers?: BuildPlugin.AssetHandlers;
|
||||
load?: BuildPlugin.load;
|
||||
unload?: BuildPlugin.Unload;
|
||||
}
|
||||
export type IBaseHooks = (options: IBuildTaskOption, result: IBuildResult) => Promise<void> | void;
|
||||
|
||||
export namespace BuildPlugin {
|
||||
export type Configs = Record<string, IBuildPluginConfig>;
|
||||
export type AssetHandlers = string;
|
||||
export type load = () => Promise<void> | void;
|
||||
export type Unload = () => Promise<void> | void;
|
||||
}
|
||||
|
||||
export namespace BuildHook {
|
||||
export type throwError = boolean; // 插件注入的钩子函数,在执行失败时是否直接退出构建流程
|
||||
export type title = string; // 插件任务整体 title,支持 i18n 写法
|
||||
export type onBeforeBuild = IBaseHooks;
|
||||
export type onBeforeCompressSettings = IBaseHooks;
|
||||
export type onAfterCompressSettings = IBaseHooks;
|
||||
export type onAfterBuild = IBaseHooks;
|
||||
export type load = () => Promise<void> | void;
|
||||
export type unload = () => Promise<void> | void;
|
||||
}
|
||||
|
||||
export namespace AssetHandlers {
|
||||
export type compressTextures = (
|
||||
tasks: { src: string; dest: string; quality: number | IPVRQuality | IASTCQuality | IETCQuality; format: ITextureCompressType }[],
|
||||
) => Promise<void>;
|
||||
}
|
||||
189
extensions/we_sane/@types/packages/builder/@types/public/build-result.d.ts
vendored
Normal file
189
extensions/we_sane/@types/packages/builder/@types/public/build-result.d.ts
vendored
Normal file
@@ -0,0 +1,189 @@
|
||||
/**
|
||||
* settings.js 里定义的数据
|
||||
*/
|
||||
|
||||
import { ISplashSetting, ICustomJointTextureLayout, UUID } from "./options";
|
||||
|
||||
// ****************************** settings ************************************************
|
||||
|
||||
// debug: true
|
||||
// designResolution: {width: "960", height: "640", policy: 4}
|
||||
// jsList: ["assets/resources/b.js", "assets/resources/a.js"]
|
||||
// launchScene: "db://assets/New Scene-001.scene"
|
||||
// platform: "web-desktop"
|
||||
// rawAssets: {
|
||||
// assets: {
|
||||
// "0e95a9f8-d4e7-4849-875a-7a11dd692b34": ["mesh/env/gltf/textures/birch_yellow_mat_baseColor.png", "cc.ImageAsset"]
|
||||
// }
|
||||
// internal: {
|
||||
// "1baf0fc9-befa-459c-8bdd-af1a450a0319": ["effects/builtin-standard.effect", "cc.EffectAsset"]
|
||||
// }
|
||||
// }
|
||||
// scenes: [{url: "db://assets/New Scene-001.scene", uuid: "69dc4a42-cc6c-49fb-9a57-7de0c212f83d"},…]
|
||||
// startScene: "current_scene"
|
||||
export interface ISettings {
|
||||
CocosEngine: string;
|
||||
debug: boolean;
|
||||
designResolution: ISettingsDesignResolution;
|
||||
jsList: string[];
|
||||
launchScene: string;
|
||||
moduleIds: string[];
|
||||
platform: string;
|
||||
renderPipeline: string;
|
||||
physics?: IPhysicsConfig;
|
||||
exactFitScreen: boolean;
|
||||
|
||||
bundleVers: Record<string, string>;
|
||||
subpackages: string[];
|
||||
remoteBundles: string[];
|
||||
server: string;
|
||||
hasResourcesBundle: boolean;
|
||||
hasStartSceneBundle: boolean;
|
||||
|
||||
scriptPackages?: string[];
|
||||
splashScreen?: ISplashSetting;
|
||||
|
||||
customJointTextureLayouts?: ICustomJointTextureLayout[];
|
||||
|
||||
importMaps?: Array<{
|
||||
url: string;
|
||||
map: any;
|
||||
}>;
|
||||
|
||||
macros?: Record<string, any>;
|
||||
collisionMatrix?: any;
|
||||
groupList?: any;
|
||||
// preview
|
||||
engineModules: string[];
|
||||
customLayers: {name: string, bit: number}[];
|
||||
}
|
||||
|
||||
// 物理配置
|
||||
export interface IVec3Like {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
export interface ICollisionMatrix {
|
||||
[x: string]: number;
|
||||
}
|
||||
|
||||
export interface IPhysicsMaterial {
|
||||
friction: number; // 0.5
|
||||
rollingFriction: number; // 0.1
|
||||
spinningFriction: number; // 0.1
|
||||
restitution: number; // 0.1
|
||||
}
|
||||
|
||||
export interface IPhysicsConfig {
|
||||
gravity: IVec3Like; // (0,-10, 0)
|
||||
allowSleep: boolean; // true
|
||||
sleepThreshold: number; // 0.1,最小 0
|
||||
autoSimulation: boolean; // true
|
||||
fixedTimeStep: number; // 1 / 60 ,最小 0
|
||||
maxSubSteps: number; // 1,最小 0
|
||||
defaultMaterial: IPhysicsMaterial;
|
||||
useNodeChains: boolean; // true
|
||||
collisionMatrix: ICollisionMatrix;
|
||||
physicsEngine: string;
|
||||
}
|
||||
|
||||
export interface IPackageInfo {
|
||||
name: string;
|
||||
path: string;
|
||||
uuids: UUID[];
|
||||
}
|
||||
|
||||
export interface ISettingsDesignResolution {
|
||||
width: number;
|
||||
height: number;
|
||||
policy: number;
|
||||
}
|
||||
|
||||
interface IAssetPathBase {
|
||||
bundleName?: string;
|
||||
redirect?: string; // 重定向的 bundle 包名
|
||||
}
|
||||
|
||||
export interface IRawAssetPathInfo extends IAssetPathBase {
|
||||
raw: string[];
|
||||
}
|
||||
export declare interface IAssetPathInfo extends IAssetPathBase {
|
||||
raw?: string[];
|
||||
json?: string;
|
||||
groupIndex?: number;
|
||||
}
|
||||
|
||||
export interface IJsonPathInfo extends IAssetPathBase {
|
||||
json?: string;
|
||||
groupIndex?: number;
|
||||
}
|
||||
|
||||
export interface IBuildPaths {
|
||||
dir: string; // 构建资源输出地址( assets 所在的目录,并不一定与构建目录对应)
|
||||
settings: string; // settings.json 输出地址
|
||||
systemJs?: string; // system.js 生成地址
|
||||
engineDir?: string; // 引擎生成地址
|
||||
polyfillsJs?: string; // polyfill.js 生成地址
|
||||
assets: string; // assets 目录
|
||||
subpackages: string; // subpackages 目录
|
||||
remote: string; // remote 目录
|
||||
bundleScripts: string // bundle 的脚本,某些平台无法下载脚本,则将远程包中的脚本移到本地
|
||||
applicationJS: string; // application.js 的生成地址
|
||||
compileConfig?: string; // cocos.compile.config.json
|
||||
importMap: string; // import-map 文件地址
|
||||
}
|
||||
|
||||
export declare class IBuildResult {
|
||||
dest: string; // options 指定的构建目录
|
||||
|
||||
paths: IBuildPaths; // 构建后资源相关地址集合
|
||||
|
||||
settings?: ISettings;
|
||||
|
||||
/**
|
||||
* 指定的 uuid 资源是否包含在构建资源中
|
||||
*/
|
||||
containsAsset: (uuid: string) => boolean;
|
||||
|
||||
/**
|
||||
* 获取指定 uuid 原始资源的存放路径(不包括序列化 json)
|
||||
* 自动图集的小图 uuid 和自动图集的 uuid 都将会查询到合图大图的生成路径
|
||||
* 实际返回多个路径的情况:查询 uuid 为自动图集资源,且对应图集生成多张大图,纹理压缩会有多个图片格式路径
|
||||
*/
|
||||
getRawAssetPaths: (uuid: string) => IRawAssetPathInfo[];
|
||||
|
||||
/**
|
||||
* 获取指定 uuid 资源的序列化 json 路径
|
||||
*/
|
||||
getJsonPathInfo: (uuid: string) => IJsonPathInfo[];
|
||||
|
||||
/**
|
||||
* 获取指定 uuid 资源的路径相关信息
|
||||
* @return {raw?: string[]; json?: string; groupIndex?: number;}
|
||||
* @return.raw: 该资源源文件的实际存储位置
|
||||
* @return.json: 该资源序列化 json 的实际存储位置,不存在为空
|
||||
* @return.groupIndex: 若该资源的序列化 json 在某个 json 分组内,这里标识在分组内的 index,不存在为空
|
||||
*/
|
||||
getAssetPathInfo: (uuid: string) => IAssetPathInfo[];
|
||||
}
|
||||
|
||||
export interface IBundleConfig {
|
||||
importBase: string; // bundle 中 import 目录的名称,通常是 'import'
|
||||
nativeBase: string; // native 中 native 目录的名称,通常是 'native'
|
||||
name: string; // bundle 的名称,可以通过 bundle 名称加载 bundle
|
||||
deps: string[]; // 该 bundle 依赖的其他 bundle 名称
|
||||
uuids: UUID[]; // 该 bundle 中的所有资源的 uuid
|
||||
paths: Record<string, any[]>; // 该 bundle 中可以通过路径加载的资源,参考以前 settings 中 rawAssets 的定义
|
||||
scenes: Record<string, UUID|number>; // 该 bundle 中所有场景,场景名为 key, uuid 为 value
|
||||
packs: Record<UUID, UUID[]>; // 该 bundle 中所有合并的 json, 参考以前 settings 中 packedAssets 的定义
|
||||
versions: { import: Array<string|number>, native: Array<string|number> }; // 该 bundle 中所有资源的版本号,参考以前 settings 中 md5AssetsMap 的定义
|
||||
redirect: Array<string|number>; // 该 bundle 中重定向到其他 bundle 的资源
|
||||
debug: boolean; // 是否是 debug 模式,debug 模式会对 config.json 的数据进行压缩,所以运行时得解压
|
||||
types?: string[]; // paths 中的类型数组,参考以前 settings 中 assetTypes 的定义
|
||||
encrypted?: boolean; // 原生上使用,标记该 bundle 中的脚本是否加密
|
||||
isZip?: boolean; // 是否是 zip 模式
|
||||
zipVersion?: string;
|
||||
extensionMap: Record<string, UUID[]>
|
||||
}
|
||||
7
extensions/we_sane/@types/packages/builder/@types/public/global.d.ts
vendored
Normal file
7
extensions/we_sane/@types/packages/builder/@types/public/global.d.ts
vendored
Normal file
@@ -0,0 +1,7 @@
|
||||
import { IBuild } from ".";
|
||||
|
||||
// 定义 builder 进程内的全局变量
|
||||
declare global {
|
||||
// @ts-ignore
|
||||
const Build: IBuild;
|
||||
}
|
||||
100
extensions/we_sane/@types/packages/builder/@types/public/index.d.ts
vendored
Normal file
100
extensions/we_sane/@types/packages/builder/@types/public/index.d.ts
vendored
Normal file
@@ -0,0 +1,100 @@
|
||||
import { ITransformOptions } from './options';
|
||||
|
||||
export * from './build-result';
|
||||
export * from './build-plugin';
|
||||
export * from './texture-compress';
|
||||
export * from './options';
|
||||
|
||||
interface IAppendRes {
|
||||
hash: string;
|
||||
paths: string[];
|
||||
}
|
||||
|
||||
interface ICreateBundleOptions {
|
||||
excludes?: string[];
|
||||
debug?: boolean;
|
||||
sourceMap?: boolean;
|
||||
}
|
||||
export interface IBuildUtils {
|
||||
/**
|
||||
* 压缩 uuid
|
||||
* 'fc991dd7-0033-4b80-9d41-c8a86a702e59' -> 'fc9913XADNLgJ1ByKhqcC5Z'
|
||||
*/
|
||||
compressUuid: (uuid: string, min: boolean) => string;
|
||||
|
||||
/**
|
||||
* 解压缩 uuid
|
||||
* 'fc9913XADNLgJ1ByKhqcC5Z' -> 'fc991dd7-0033-4b80-9d41-c8a86a702e59'
|
||||
*/
|
||||
decompressUuid: (uuid: string) => string;
|
||||
|
||||
/**
|
||||
* 翻译带有 i18n 开头的名称(i18n:test)(待定)
|
||||
* 'i18n:test' -> '测试'
|
||||
*/
|
||||
transI18nName: (name: string) => string;
|
||||
|
||||
/**
|
||||
* 移除 db 前缀
|
||||
* 'db://assets/test.jpg' -> 'assets/test.jpg'
|
||||
*/
|
||||
removeDbHeader: (url: string) => string;
|
||||
|
||||
/**
|
||||
* 将 db 开头的 url 转为项目里的实际 url
|
||||
* 'db://assets/test.jpg' -> 'c:/project/assets/test.jpg'
|
||||
*/
|
||||
dbUrlToRawPath: (url: string) => string;
|
||||
|
||||
/**
|
||||
* 从路径里获取存在的 uuid
|
||||
* 'E:\test3d\library\oc\0c0c1f5742-89b0-4a1e-b5eb-914d84f48c1c.json' -> '0c0c1f5742-89b0-4a1e-b5eb-914d84f48c1c'
|
||||
*/
|
||||
getUuidFromPath: (path: string) => string;
|
||||
|
||||
/**
|
||||
* 检查是否全局安装了 nodejs
|
||||
*/
|
||||
isInstallNodeJs: () => Promise<boolean>;
|
||||
|
||||
/**
|
||||
* 逐文件拷贝
|
||||
*/
|
||||
copyDirSync: (src: string, dest: string) => void;
|
||||
|
||||
/**
|
||||
* 获取相对路径接口
|
||||
* 返回 / 拼接的相对路径
|
||||
*/
|
||||
relativeUrl: (from: string, to: string) => string;
|
||||
|
||||
transformCode: (code: string, options: ITransformOptions) => Promise<string>;
|
||||
|
||||
/**
|
||||
* 给指定路径添加 md5
|
||||
*/
|
||||
appendMd5ToPaths: (paths: string[]) => Promise<IAppendRes | null>;
|
||||
|
||||
calcMd5: (data: Buffer | string) => string;
|
||||
|
||||
copyPaths: (paths: { src: string; dest: string }[]) => Promise<void[]>;
|
||||
|
||||
createBundle: (src: string, dest: string, options?: ICreateBundleOptions) => Promise<unknown>;
|
||||
}
|
||||
export interface IBuild {
|
||||
Utils: IBuildUtils;
|
||||
|
||||
LIBRARY_NAME: string;
|
||||
IMPORT_HEADER: string;
|
||||
NATIVE_HEADER: string;
|
||||
ASSETS_HEADER: string;
|
||||
SUBPACKAGES_HEADER: string;
|
||||
REMOTE_HEADER: string;
|
||||
BUNDLE_SCRIPTS_HEADER: string;
|
||||
SCRIPT_NAME: string;
|
||||
CONFIG_NAME: string;
|
||||
BUNDLE_ZIP_NAME: string;
|
||||
projectTempDir: string;
|
||||
globalTempDir: string;
|
||||
buildTemplateDir: string; // 构建模板地址 build-templates
|
||||
}
|
||||
40
extensions/we_sane/@types/packages/builder/@types/public/message.d.ts
vendored
Normal file
40
extensions/we_sane/@types/packages/builder/@types/public/message.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
import { IBundleConfig, ISettings } from "./build-result";
|
||||
import { ITaskItemJSON } from "./options";
|
||||
export interface message extends EditorMessageMap {
|
||||
'open-devtools': {
|
||||
params: [],
|
||||
result: void,
|
||||
},
|
||||
open: {
|
||||
params: [],
|
||||
result: void,
|
||||
},
|
||||
'generate-preview-setting': {
|
||||
params: any[],
|
||||
result: Promise<{
|
||||
settings: ISettings;
|
||||
script2library: Record<string, string>;
|
||||
bundleConfigs: IBundleConfig[];
|
||||
}>,
|
||||
},
|
||||
'query-tasks-info': {
|
||||
params: [],
|
||||
result: {
|
||||
queue: Record<string, ITaskItemJSON>,
|
||||
free: Promise<boolean>,
|
||||
},
|
||||
},
|
||||
'query-task': {
|
||||
params: string[],
|
||||
result: Promise<ITaskItemJSON>,
|
||||
},
|
||||
/**
|
||||
* 预览合图
|
||||
* @param {object} pacUuid
|
||||
*/
|
||||
'preview-pac': {
|
||||
params: string[],
|
||||
result: Promise<ITaskItemJSON>,
|
||||
},
|
||||
|
||||
}
|
||||
132
extensions/we_sane/@types/packages/builder/@types/public/options.d.ts
vendored
Normal file
132
extensions/we_sane/@types/packages/builder/@types/public/options.d.ts
vendored
Normal file
@@ -0,0 +1,132 @@
|
||||
/**
|
||||
* 构建所需的完整参数
|
||||
*/
|
||||
export interface IBuildTaskOption {
|
||||
// 构建后的游戏文件夹生成的路径
|
||||
buildPath: string;
|
||||
debug: boolean;
|
||||
inlineSpriteFrames: boolean;
|
||||
md5Cache: boolean;
|
||||
// bundle 设置
|
||||
mainBundleCompressionType: BundleCompressionType;
|
||||
mainBundleIsRemote: boolean;
|
||||
moveRemoteBundleScript: boolean;
|
||||
mergeJson: boolean;
|
||||
name: string;
|
||||
packAutoAtlas: boolean;
|
||||
platform: Platform;
|
||||
scenes: IBuildSceneItem[];
|
||||
compressTexture: boolean;
|
||||
sourceMaps: boolean;
|
||||
startScene: string;
|
||||
outputName: string;
|
||||
experimentalEraseModules: boolean;
|
||||
|
||||
/**
|
||||
* 是否是预览进程发送的构建请求。
|
||||
* @default false
|
||||
*/
|
||||
preview?: boolean;
|
||||
|
||||
// 项目设置
|
||||
includeModules?: string[];
|
||||
renderPipeline?: string;
|
||||
designResolution?: IBuildDesignResolution;
|
||||
physicsConfig?: any;
|
||||
flags?: Record<string, boolean>;
|
||||
|
||||
|
||||
// 是否使用自定义插屏选项
|
||||
replaceSplashScreen?: boolean;
|
||||
splashScreen: ISplashSetting;
|
||||
|
||||
packages?: Record<string, any>;
|
||||
id?: string; // 手动配置构建任务 id
|
||||
// recompileConfig?: IRecompileConfig;
|
||||
|
||||
customLayers: {name: string, value: number}[];
|
||||
}
|
||||
|
||||
export type UUID = string;
|
||||
|
||||
export interface ISplashSetting {
|
||||
base64src: string;
|
||||
displayRatio: number;
|
||||
totalTime: number;
|
||||
effect: string;
|
||||
clearColor: { x: number; y: number; z: number; w: number };
|
||||
displayWatermark: boolean;
|
||||
}
|
||||
|
||||
export interface ICustomJointTextureLayout {
|
||||
textureLength: number;
|
||||
contents: IChunkContent[];
|
||||
}
|
||||
|
||||
export interface IChunkContent {
|
||||
skeleton: null | string;
|
||||
clips: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建使用的设计分辨率数据
|
||||
*/
|
||||
export interface IBuildDesignResolution {
|
||||
height: number;
|
||||
width: number;
|
||||
fitWidth?: boolean;
|
||||
fitHeight?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建使用的场景的数据
|
||||
*/
|
||||
export interface IBuildSceneItem {
|
||||
url: string;
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
// **************************** options *******************************************
|
||||
export type Platform =
|
||||
| 'web-desktop'
|
||||
| 'web-mobile'
|
||||
| 'wechatgame'
|
||||
| 'oppo-mini-game'
|
||||
| 'vivo-mini-game'
|
||||
| 'huawei-quick-game'
|
||||
| 'alipay-mini-game'
|
||||
| 'mac'
|
||||
| 'ios'
|
||||
// | 'ios-app-clip'
|
||||
| 'android'
|
||||
| 'ohos'
|
||||
| 'windows'
|
||||
| 'xiaomi-quick-game'
|
||||
| 'baidu-mini-game'
|
||||
| 'bytedance-mini-game'
|
||||
| 'cocos-play'
|
||||
| 'huawei-agc'
|
||||
| 'link-sure'
|
||||
| 'qtt'
|
||||
| 'cocos-runtime'
|
||||
;
|
||||
|
||||
export type BundleCompressionType = 'none' | 'merge_dep' | 'merge_all_json' | 'subpackage' | 'zip';
|
||||
export type IModules = 'esm' | 'commonjs' | 'systemjs';
|
||||
|
||||
export interface ITransformOptions {
|
||||
importMapFormat: IModules;
|
||||
}
|
||||
|
||||
export type ITaskState = 'waiting' | 'success' | 'failure' | 'cancel' | 'processing';
|
||||
|
||||
export interface ITaskItemJSON {
|
||||
id: string;
|
||||
progress: number;
|
||||
state: ITaskState;
|
||||
message: string;
|
||||
options: IBuildTaskOption;
|
||||
time: string;
|
||||
dirty: boolean;
|
||||
rawOptions: IBuildTaskOption;
|
||||
}
|
||||
43
extensions/we_sane/@types/packages/builder/@types/public/texture-compress.d.ts
vendored
Normal file
43
extensions/we_sane/@types/packages/builder/@types/public/texture-compress.d.ts
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
export type ITextureCompressType =
|
||||
| 'jpg'
|
||||
| 'png'
|
||||
| 'webp'
|
||||
| 'pvrtc_4bits_rgb'
|
||||
| 'pvrtc_4bits_rgba'
|
||||
| 'pvrtc_4bits_rgb_a'
|
||||
| 'pvrtc_2bits_rgb'
|
||||
| 'pvrtc_2bits_rgba'
|
||||
| 'pvrtc_2bits_rgb_a'
|
||||
| 'etc1_rgb'
|
||||
| 'etc1_rgb_a'
|
||||
| 'etc2_rgb'
|
||||
| 'etc2_rgba'
|
||||
| 'astc_4x4'
|
||||
| 'astc_5x5'
|
||||
| 'astc_6x6'
|
||||
| 'astc_8x8'
|
||||
| 'astc_10x5'
|
||||
| 'astc_10x10'
|
||||
| 'astc_12x12';
|
||||
export type ITextureCompressPlatform = 'miniGame' | 'web' | 'ios' | 'android';
|
||||
export type IQualityType = 'etc' | 'pvr' | 'number' | 'astc';
|
||||
export interface ITextureFormatInfo {
|
||||
displayName: string;
|
||||
qualityType: IQualityType;
|
||||
alpha?: boolean;
|
||||
}
|
||||
export interface ISupportFormat {
|
||||
rgb: ITextureCompressType[];
|
||||
rgba: ITextureCompressType[];
|
||||
}
|
||||
export interface IConfigGroupsInfo {
|
||||
defaultSupport?: ISupportFormat,
|
||||
support: ISupportFormat,
|
||||
displayName: string;
|
||||
icon: string;
|
||||
}
|
||||
export type IConfigGroups = Record<ITextureCompressPlatform, IConfigGroupsInfo>;
|
||||
|
||||
export type IPVRQuality = 'fastest' | 'fast' | 'normal' | 'high' | 'best';
|
||||
export type IETCQuality = 'slow' | 'fast';
|
||||
export type IASTCQuality = 'veryfast' | 'fast' | 'medium' | 'thorough' | 'exhaustive';
|
||||
16
extensions/we_sane/@types/packages/console/@types/pritate.d.ts
vendored
Normal file
16
extensions/we_sane/@types/packages/console/@types/pritate.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface IMessageItem {
|
||||
rows: number;
|
||||
translateY: number;
|
||||
show: boolean;
|
||||
title: string;
|
||||
content: string[];
|
||||
count: number;
|
||||
fold: boolean;
|
||||
type: string;
|
||||
message: any;
|
||||
texture: string;
|
||||
date?: number;
|
||||
time?: number;
|
||||
process?: string;
|
||||
stack: string[];
|
||||
}
|
||||
16
extensions/we_sane/@types/packages/engine/@types/message.d.ts
vendored
Normal file
16
extensions/we_sane/@types/packages/engine/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
export interface message extends EditorMessageMap {
|
||||
'query-info': {
|
||||
params: [] | [
|
||||
string,
|
||||
],
|
||||
result: {
|
||||
type: string;
|
||||
version: string;
|
||||
path: string;
|
||||
nativeVersion: string; // 原生引擎类型 'custom' 'builtin'
|
||||
nativePath: string;
|
||||
editor: string;
|
||||
renderPipeline: string;
|
||||
},
|
||||
},
|
||||
}
|
||||
1
extensions/we_sane/@types/packages/preview/@types/index.d.ts
vendored
Normal file
1
extensions/we_sane/@types/packages/preview/@types/index.d.ts
vendored
Normal file
@@ -0,0 +1 @@
|
||||
export * from './protect/';
|
||||
33
extensions/we_sane/@types/packages/preview/@types/protect/index.d.ts
vendored
Normal file
33
extensions/we_sane/@types/packages/preview/@types/protect/index.d.ts
vendored
Normal file
@@ -0,0 +1,33 @@
|
||||
import { Platform } from "../../../builder/@types/public";
|
||||
|
||||
export type IPreviewType = 'game-view' | 'simulator' | 'browser';
|
||||
|
||||
export type ISupportDataType = 'settings' | 'renderData';
|
||||
|
||||
export interface IHookConfig {
|
||||
methods: string;
|
||||
hook: string;
|
||||
}
|
||||
export interface IGenerateSettingsOptions {
|
||||
type: IPreviewType;
|
||||
startScene?: string;
|
||||
platform?: Platform;
|
||||
}
|
||||
|
||||
export interface IPreviewPluginConfig {
|
||||
methods?: string;
|
||||
hooks?: Record<string, string>;
|
||||
}
|
||||
|
||||
// 界面渲染配置
|
||||
export interface IRenderData {
|
||||
title: string; // 预览页面 title
|
||||
enableDebugger: boolean; // 是否开启 vConsole
|
||||
config: { // 预览页面菜单栏配置
|
||||
device: string; // 设备名称
|
||||
// https://github.com/cocos-creator/engine/blob/3d/cocos/core/platform/debug.ts
|
||||
debugMode: string; // cc.DebugMode 枚举名称
|
||||
showFps: boolean;
|
||||
fps: number;
|
||||
}
|
||||
}
|
||||
19
extensions/we_sane/@types/packages/programming/@types/message.d.ts
vendored
Normal file
19
extensions/we_sane/@types/packages/programming/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export interface message extends EditorMessageMap {
|
||||
'query-shared-settings': {
|
||||
params: [],
|
||||
result: {
|
||||
useDefineForClassFields: boolean;
|
||||
allowDeclareFields: boolean;
|
||||
loose: boolean;
|
||||
guessCommonJsExports: boolean;
|
||||
exportsConditions: string[];
|
||||
importMap?: {
|
||||
json: {
|
||||
imports?: Record<string, string>;
|
||||
scopes?: Record<string, Record<string, string>>;
|
||||
};
|
||||
url: string;
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
68
extensions/we_sane/@types/packages/scene/@types/message.d.ts
vendored
Normal file
68
extensions/we_sane/@types/packages/scene/@types/message.d.ts
vendored
Normal file
@@ -0,0 +1,68 @@
|
||||
import {
|
||||
SetPropertyOptions,
|
||||
} from './public';
|
||||
|
||||
export interface message extends EditorMessageMap {
|
||||
'update-create-node-template': {
|
||||
params: [],
|
||||
result: any,
|
||||
},
|
||||
'open': {
|
||||
params: [],
|
||||
result: any,
|
||||
},
|
||||
'open-devtools': {
|
||||
params: [],
|
||||
result: any,
|
||||
},
|
||||
'graphical-tools': {
|
||||
params: [
|
||||
boolean,
|
||||
],
|
||||
result: void,
|
||||
},
|
||||
'open-scene': {
|
||||
params: [
|
||||
string,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'save-scene': {
|
||||
params: [] | [
|
||||
boolean,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'save-as-scene': {
|
||||
params: [
|
||||
boolean,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'close-scene': {
|
||||
params: [],
|
||||
result: boolean,
|
||||
},
|
||||
'set-property': {
|
||||
params: [
|
||||
SetPropertyOptions,
|
||||
],
|
||||
result: boolean,
|
||||
},
|
||||
'query-node-tree': {
|
||||
params: [] | [
|
||||
string,
|
||||
],
|
||||
result: any,
|
||||
},
|
||||
'execute-scene-script': {
|
||||
params: [] | [
|
||||
{
|
||||
name: string;
|
||||
method: string;
|
||||
args: any[];
|
||||
}
|
||||
],
|
||||
result: any,
|
||||
},
|
||||
}
|
||||
407
extensions/we_sane/@types/packages/scene/@types/public.d.ts
vendored
Normal file
407
extensions/we_sane/@types/packages/scene/@types/public.d.ts
vendored
Normal file
@@ -0,0 +1,407 @@
|
||||
// ---- 一些 engine 基础数据 ---- start
|
||||
interface Vec2 {
|
||||
x: number;
|
||||
y: number;
|
||||
}
|
||||
|
||||
export interface Vec3 {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
}
|
||||
|
||||
interface Vec4 {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
w: number;
|
||||
}
|
||||
|
||||
interface Quat {
|
||||
x: number;
|
||||
y: number;
|
||||
z: number;
|
||||
w: number;
|
||||
}
|
||||
|
||||
interface Color3 {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
}
|
||||
|
||||
interface Color4 {
|
||||
r: number;
|
||||
g: number;
|
||||
b: number;
|
||||
a: number;
|
||||
}
|
||||
|
||||
interface Mat3 {
|
||||
m00: number;
|
||||
m01: number;
|
||||
m02: number;
|
||||
|
||||
m03: number;
|
||||
m04: number;
|
||||
m05: number;
|
||||
|
||||
m06: number;
|
||||
m07: number;
|
||||
m08: number;
|
||||
}
|
||||
|
||||
interface Mat4 {
|
||||
m00: number;
|
||||
m01: number;
|
||||
m02: number;
|
||||
m03: number;
|
||||
|
||||
m04: number;
|
||||
m05: number;
|
||||
m06: number;
|
||||
m07: number;
|
||||
|
||||
m08: number;
|
||||
m09: number;
|
||||
m10: number;
|
||||
m11: number;
|
||||
|
||||
m12: number;
|
||||
m13: number;
|
||||
m14: number;
|
||||
m15: number;
|
||||
}
|
||||
// ---- 一些 engine 基础数据 ---- end
|
||||
|
||||
// ---- 操作消息的参数定义 --- strart
|
||||
|
||||
// set-property 消息的 options 定义
|
||||
export interface SetPropertyOptions {
|
||||
uuid: string; // 修改属性的对象的 uuid
|
||||
path: string; // 属性挂载对象的搜索路径
|
||||
// key: string; // 属性的 key
|
||||
dump: IProperty; // 属性 dump 出来的数据
|
||||
}
|
||||
|
||||
// move-array-element 消息的 options 定义
|
||||
export interface MoveArrayOptions {
|
||||
uuid: string;
|
||||
path: string;
|
||||
target: number;
|
||||
offset: number;
|
||||
}
|
||||
|
||||
// remove-array-element 消息的 options 定义
|
||||
export interface RemoveArrayOptions {
|
||||
uuid: string;
|
||||
path: string;
|
||||
index: number;
|
||||
}
|
||||
|
||||
export interface PasteNodeOptions {
|
||||
target: string; // 目标节点
|
||||
uuids: string | string[]; // 被复制的节点 uuids
|
||||
keepWorldTransform?: boolean; // 是否保持新节点的世界坐标不变
|
||||
}
|
||||
|
||||
export interface CutNodeOptions {
|
||||
parent: string; // 父节点
|
||||
uuids: string | string[]; // 被移入的节点 uuids
|
||||
keepWorldTransform?: boolean; // 是否保持新节点的世界坐标不变
|
||||
}
|
||||
|
||||
// create-node 消息的 options 定义
|
||||
export interface CreateNodeOptions {
|
||||
parent?: string;
|
||||
components?: string[];
|
||||
|
||||
name?: string;
|
||||
dump?: INode | IScene; // node 初始化应用的数据
|
||||
keepWorldTransform?: boolean; // 是否保持新节点的世界坐标不变
|
||||
type?: string; // 资源类型
|
||||
assetUuid?: string; // asset uuid , type value 格式保持兼容拖动的数据格式,有资源 id,则从资源内创建对应的节点
|
||||
canvasRequired?: boolean; // 是否需要有 Canvas
|
||||
unlinkPrefab?: boolean; // 创建后取消 prefab 状态
|
||||
position?: Vec3; // 指定生成的位置
|
||||
}
|
||||
|
||||
export interface ResetNodeOptions {
|
||||
uuid: string | string[];
|
||||
}
|
||||
|
||||
export interface RemoveNodeOptions {
|
||||
uuid: string | string[];
|
||||
keepWorldTransform?: boolean;
|
||||
}
|
||||
|
||||
export interface CreateComponentOptions {
|
||||
uuid: string;
|
||||
component: string;
|
||||
}
|
||||
|
||||
export interface ResetComponentOptions {
|
||||
uuid: string;
|
||||
}
|
||||
|
||||
export interface RemoveComponentOptions {
|
||||
uuid: string;
|
||||
component: string;
|
||||
}
|
||||
|
||||
export interface ExecuteComponentMethodOptions {
|
||||
uuid: string;
|
||||
name: string;
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export interface IAnimOperation {
|
||||
funcName: string;
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export interface ExecuteSceneScriptMethodOptions {
|
||||
name: string;
|
||||
method: string;
|
||||
args: any[];
|
||||
}
|
||||
|
||||
export type IPropertyValueType = IProperty | IProperty[] | null | undefined | number | boolean | string | Vec3 | Vec2;
|
||||
|
||||
export interface IPropertyGroupOptions {
|
||||
id: string // 默认 'default'
|
||||
name: string,
|
||||
displayOrder: number, // 默认 Infinity, 排在最后面
|
||||
style: string // 默认为 'tab'
|
||||
}
|
||||
|
||||
export interface IProperty {
|
||||
value: { [key: string]: IPropertyValueType } | IPropertyValueType;
|
||||
default?: any; // 默认值
|
||||
|
||||
// 多选节点之后,这里存储多个数据,用于自行判断多选后的显示效果,无需更新该数据
|
||||
values?: ({ [key: string]: IPropertyValueType } | IPropertyValueType)[];
|
||||
|
||||
cid?: string;
|
||||
type?: string;
|
||||
readonly?: boolean;
|
||||
visible?: boolean;
|
||||
name?: string;
|
||||
|
||||
elementTypeData?: IProperty; // 数组里的数据的默认值 dump
|
||||
|
||||
path?: string; // 数据的搜索路径,这个是由使用方填充的
|
||||
|
||||
isArray?: boolean;
|
||||
invalid?: boolean;
|
||||
extends?: string[]; // 继承链
|
||||
displayName?: string; // 显示到界面上的名字
|
||||
displayOrder?: number; // 显示排序
|
||||
group?: IPropertyGroupOptions; // tab
|
||||
tooltip?: string; // 提示文本
|
||||
editor?: any; // 组件上定义的编辑器数据
|
||||
animatable?: boolean; // 是否可以在动画中编辑
|
||||
|
||||
// Enum
|
||||
enumList?: any[]; // enum 类型的 list 选项数组
|
||||
|
||||
bitmaskList?: any[];
|
||||
|
||||
// Number
|
||||
min?: number; // 数值类型的最小值
|
||||
max?: number; // 数值类型的最大值
|
||||
step?: number; // 数值类型的步进值
|
||||
slide?: boolean; // 数组是否显示为滑块
|
||||
unit?: string; // 显示的单位
|
||||
radian?: boolean; // 标识是否为角度
|
||||
|
||||
// Label
|
||||
multiline?: boolean; // 字符串是否允许换行
|
||||
// nullable?: boolean; 属性是否允许为空
|
||||
}
|
||||
|
||||
export interface IRemovedComponentInfo {
|
||||
name: string;
|
||||
fileID: string;
|
||||
}
|
||||
|
||||
export interface INode {
|
||||
active: IProperty;
|
||||
locked: IProperty;
|
||||
name: IProperty;
|
||||
position: IProperty;
|
||||
|
||||
/**
|
||||
* 此为 dump 数据,非 node.rotation
|
||||
* 实际指向 node.eulerAngles
|
||||
* rotation 为了给用户更友好的文案
|
||||
*/
|
||||
rotation: IProperty;
|
||||
|
||||
scale: IProperty;
|
||||
layer: IProperty;
|
||||
uuid: IProperty;
|
||||
|
||||
children: any[];
|
||||
parent: any;
|
||||
|
||||
__comps__: IProperty[];
|
||||
__type__: string;
|
||||
__prefab__?: any;
|
||||
_prefabInstance?: any;
|
||||
removedComponents?: IRemovedComponentInfo[];
|
||||
mountedRoot?: string;
|
||||
}
|
||||
|
||||
export interface IComponent extends IProperty {
|
||||
value: {
|
||||
enabled: IPropertyValueType;
|
||||
uuid: IPropertyValueType;
|
||||
name: IPropertyValueType;
|
||||
} & Record<string, IPropertyValueType>;
|
||||
mountedRoot?: string;
|
||||
}
|
||||
|
||||
export interface IScene {
|
||||
name: IProperty;
|
||||
active: IProperty;
|
||||
locked: IProperty;
|
||||
_globals: any;
|
||||
isScene: boolean;
|
||||
autoReleaseAssets: IProperty;
|
||||
|
||||
uuid: IProperty;
|
||||
children: any[];
|
||||
parent: any;
|
||||
__type__: string;
|
||||
targetOverrides?: any;
|
||||
}
|
||||
|
||||
export interface ITargetOverrideInfo {
|
||||
source: string;
|
||||
sourceInfo?: string[];
|
||||
propertyPath: string[];
|
||||
target: string;
|
||||
targetInfo?: string[];
|
||||
}
|
||||
// ---- 操作消息的参数定义 --- end
|
||||
|
||||
// ---- 场景插件返回的 info 信息 ---- start
|
||||
interface ScenePluginNodeInfo {
|
||||
uuid: string;
|
||||
components: ScenePluginComponentInfo[];
|
||||
}
|
||||
|
||||
// 场景插件传回的场景信息
|
||||
export interface ScenePluginInfo {
|
||||
// 选中节点列表
|
||||
nodes: ScenePluginNodeInfo[];
|
||||
|
||||
// gizmo 的一些信息
|
||||
gizmo: {
|
||||
is2D: boolean;
|
||||
};
|
||||
// 当前编辑模式数组
|
||||
modes: string[];
|
||||
}
|
||||
|
||||
// 场景插件传回的组件信息
|
||||
export interface ScenePluginComponentInfo {
|
||||
uuid: string;
|
||||
enabled: boolean;
|
||||
type: string;
|
||||
}
|
||||
|
||||
export interface QueryClassesOptions {
|
||||
extends?: string | string[];
|
||||
excludeSelf?: boolean;
|
||||
}
|
||||
|
||||
// ---- 场景插件返回的 info 信息 ---- end
|
||||
|
||||
// ---- 动画数据 ---- start
|
||||
|
||||
export interface IKeyDumpData {
|
||||
frame: number;
|
||||
dump: any; // value的dump数据
|
||||
inTangent?: number;
|
||||
inTangentWeight?: number;
|
||||
outTangent?: number;
|
||||
outTangentWeight?: number;
|
||||
interpMode?: number;
|
||||
broken?: boolean;
|
||||
tangentWeightMode?: number;
|
||||
imgUrl?: string;
|
||||
easingMethod?: number;
|
||||
}
|
||||
|
||||
export interface IDumpType {
|
||||
value: string;
|
||||
extends?: string[];
|
||||
}
|
||||
|
||||
export interface IPropCurveDumpData {
|
||||
nodePath: string;
|
||||
keyframes: IKeyDumpData[];
|
||||
displayName: string;
|
||||
key: string;
|
||||
type?: IDumpType;
|
||||
preExtrap: number;
|
||||
postExtrap: number;
|
||||
isCurveSupport: boolean; // 是否支持贝塞尔曲线编辑
|
||||
}
|
||||
|
||||
export interface IAnimCopyKeySrcInfo {
|
||||
curvesDump: IPropCurveDumpData[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyNodeSrcInfo {
|
||||
curvesDump: IPropCurveDumpData[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyNodeDstInfo {
|
||||
nodePath: string;
|
||||
}
|
||||
|
||||
interface IEventDump {
|
||||
frame: number;
|
||||
func: string;
|
||||
params: string[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyEventSrcInfo {
|
||||
eventsDump: IEventDump[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyPropSrcInfo {
|
||||
curvesDump: IPropCurveDumpData[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyPropDstInfo {
|
||||
nodePath: string;
|
||||
propKeys?: string[];
|
||||
}
|
||||
|
||||
export interface IAnimCopyKeyDstInfo {
|
||||
nodePath: string;
|
||||
propKeys?: string[];
|
||||
startFrame: number;
|
||||
}
|
||||
|
||||
export interface IAnimCopyEventDstInfo {
|
||||
startFrame: number;
|
||||
}
|
||||
// ---- 动画数据 ---- end
|
||||
|
||||
// ---- Contributions ---- start
|
||||
|
||||
export interface ContributionDropItem {
|
||||
type: string;
|
||||
message: string;
|
||||
}
|
||||
|
||||
// ---- Contributions ---- end
|
||||
|
||||
export interface UnitTestInfo {
|
||||
name: string;
|
||||
}
|
||||
27
extensions/we_sane/@types/packages/server/@types/package.d.ts
vendored
Normal file
27
extensions/we_sane/@types/packages/server/@types/package.d.ts
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
// 消息定义
|
||||
interface MessageInterface {
|
||||
params: any[],
|
||||
result: any;
|
||||
}
|
||||
|
||||
// host
|
||||
export interface HostInfo {
|
||||
host: string;
|
||||
ip: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
// 消息定义
|
||||
export interface main {
|
||||
scene: {
|
||||
[x: string]: MessageInterface;
|
||||
'query-port': {
|
||||
params: [],
|
||||
result: number,
|
||||
};
|
||||
'scan-lan': {
|
||||
params: [],
|
||||
result: HostInfo[],
|
||||
};
|
||||
}
|
||||
}
|
||||
19
extensions/we_sane/@types/packages/shortcuts/@types/shortcut.d.ts
vendored
Normal file
19
extensions/we_sane/@types/packages/shortcuts/@types/shortcut.d.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
export interface ShortcutItem {
|
||||
when: string;
|
||||
message: string;
|
||||
shortcut: string;
|
||||
pkgName: string;
|
||||
rawShortcut?: string;
|
||||
key: string;
|
||||
missing?: boolean;
|
||||
}
|
||||
|
||||
export type IShortcutItemMap = Record<string, ShortcutItem>;
|
||||
|
||||
export interface IShortcutEditInfo {
|
||||
key: string;
|
||||
shortcut: string;
|
||||
searches: ShortcutItem[];
|
||||
conflict: boolean;
|
||||
when: string;
|
||||
}
|
||||
16
extensions/we_sane/README-CN.md
Normal file
16
extensions/we_sane/README-CN.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# 项目简介
|
||||
|
||||
一份空白的扩展。
|
||||
|
||||
## 开发环境
|
||||
|
||||
Node.js
|
||||
|
||||
## 安装
|
||||
|
||||
```bash
|
||||
# 安装依赖模块
|
||||
npm install
|
||||
# 构建
|
||||
npm run build
|
||||
```
|
||||
16
extensions/we_sane/README-EN.md
Normal file
16
extensions/we_sane/README-EN.md
Normal file
@@ -0,0 +1,16 @@
|
||||
# Project Title
|
||||
|
||||
An blank extension.
|
||||
|
||||
## Development Environment
|
||||
|
||||
Node.js
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
# Install dependent modules
|
||||
npm install
|
||||
# build
|
||||
npm run build
|
||||
```
|
||||
105
extensions/we_sane/dist/buildH5.js
vendored
Normal file
105
extensions/we_sane/dist/buildH5.js
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
var Fs = require("fs");
|
||||
var fsextra = require("fs-extra");
|
||||
var zlib = require('zlib');
|
||||
var archiver = require('archiver');
|
||||
const path = require('path');
|
||||
|
||||
module.exports = {
|
||||
load() {
|
||||
this.webUrl = Editor.Project.path + "/build/web-mobile"; //打h5包的路径
|
||||
this.replaceUrl = Editor.Project.path + "/build/replace_H5"; //替换文件路径
|
||||
this.indexUrl = this.webUrl + "/index.html"; //index 位置
|
||||
|
||||
//需要 复制 的文件
|
||||
this.replaceUrls = [
|
||||
"/weSane.js",
|
||||
"/res",
|
||||
]
|
||||
/** index 需要写入的 数据 row行数 */
|
||||
this.writeIndexData = [
|
||||
{ rowNum: 35, writeType: 'ADD', str: ' <meta data-react-helmet="true" property="og:title" content="Game Name"> ' },
|
||||
{ rowNum: 36, writeType: 'ADD', str: ' <meta data-react-helmet="true" property="og:description" content="Game Description">' },
|
||||
{ rowNum: 37, writeType: 'ADD', str: ' <meta data-react-helmet="true" property="og:image" content="res/share.jpg"> ' },
|
||||
{ rowNum: 38, writeType: 'ADD', str: ' <meta http-equiv="cache-control" content="no-cache,no-store,must-revalidate" /> ' },
|
||||
{ rowNum: 39, writeType: 'ADD', str: ' <meta http-equiv="Pragma" content="no-cache" /> ' },
|
||||
{ rowNum: 40, writeType: 'ADD', str: ' <meta http-equiv="expires" content="-1" /> ' },
|
||||
|
||||
{ rowNum: 49, writeType: 'ADD', str: '<div id="splash"><div class="progress-bar stripes"><span style="width: 0%"></span></div></div>' },
|
||||
{ rowNum: 51, writeType: 'ADD', str: '<div id="loadingImg" style="top:24%;align:center;width:100%;position:absolute;z-index:10;"> <img style="border-radius: 15px;" src="res/logo.png" width="90" height="90" /> </div>' },
|
||||
{ rowNum: 52, writeType: 'ADD', str: '<div id="webText" type="text" style="width:100%;text-align:center;position:absolute;top:38%;z-index:99;font-size:16px;color:#1e2222" > </div> ' },
|
||||
{ rowNum: 53, writeType: 'ADD', str: '<div id="loadingText" type="text" style="width:100%;text-align:center;position:absolute;top:56%;z-index:99;font-size:17px;color:#e86c00" > </div> ' },
|
||||
{ rowNum: 54, writeType: 'ADD', str: '<div style="align:center;display: none"><img src="res/share.jpg" width="10%" /></div> ' },
|
||||
|
||||
{ rowNum: 55, writeType: 'ADD', str: ' <script src="weSane.js" charset="utf-8"> </script> ' },
|
||||
|
||||
// { rowNum: 56, writeType: 'ADD', str: ' <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> ' },
|
||||
// { rowNum: 57, writeType: 'ADD', str: ' <script src="https://www.wesane.com/Public/js/Anti-addiction.js"></script> ' },
|
||||
]
|
||||
},
|
||||
|
||||
/** 写入 index 文件 */
|
||||
writeIndex() {
|
||||
let indexStr = Fs.readFileSync(this.indexUrl, 'utf8');//读取文件
|
||||
let strArr = indexStr.split("\n"); //按回车分割成数组
|
||||
this.addStrArrData(this.writeIndexData, strArr);
|
||||
|
||||
let weSaneJs = Fs.readFileSync(this.replaceUrl + "/weSane.js", 'utf8').split("\n");
|
||||
strArr[5] = " <title>" + weSaneJs[4].split('"')[1] + '</title>'; //修改标题
|
||||
|
||||
let writeStr = ""; //写入inex的字符串
|
||||
for (let i = 0; i < strArr.length; i++) {
|
||||
if (i < strArr.length - 1) {
|
||||
writeStr += (strArr[i] + "\n");
|
||||
}
|
||||
}
|
||||
Fs.writeFileSync(this.indexUrl, writeStr, 'utf8');
|
||||
console.log("index 写入成功");
|
||||
},
|
||||
/** 复制文件 打包zip 的名字 */
|
||||
copyFloder(zipName) {
|
||||
for (let i = 0; i < this.replaceUrls.length; i++) {
|
||||
fsextra.copySync(this.replaceUrl + this.replaceUrls[i], this.webUrl + this.replaceUrls[i], 0);
|
||||
}
|
||||
console.log("复制文件完成");
|
||||
// this.gzip(Editor.Project.path + "/build/web-mobile/weSane.js" );
|
||||
let outurl = Editor.Project.path + '/build/' + zipName + '.zip'; //zip 输出目录
|
||||
this.deleteFile(outurl);
|
||||
|
||||
this.zipFolder(this.webUrl, outurl, function (err, msg) {
|
||||
console.log(err, msg);
|
||||
});
|
||||
},
|
||||
/** 删除文件 */
|
||||
deleteFile(url) {
|
||||
if (Fs.existsSync(url)) {
|
||||
Fs.unlinkSync(url);
|
||||
}
|
||||
},
|
||||
/** 打包Zip */
|
||||
zipFolder(sourceFolder, destZip, cb, subdir) {
|
||||
var output = Fs.createWriteStream(destZip);
|
||||
var archive = archiver('zip', {
|
||||
zlib: { level: 9 }
|
||||
});
|
||||
archive.pipe(output);
|
||||
archive.directory(sourceFolder, subdir ? sourceFolder.substr(path.dirname(sourceFolder).length + 1) : false);
|
||||
archive.finalize();
|
||||
console.log("打包zip 完成");
|
||||
},
|
||||
|
||||
/** 添加 需要写入的配置里面的字符串 */
|
||||
addStrArrData(dataArr, strArr) {
|
||||
|
||||
for (let i = 0; i < dataArr.length; i++) {
|
||||
if (dataArr[i].writeType == 'ADD') {
|
||||
if (strArr[dataArr[i].rowNum - 1] == dataArr[i].str) { continue; }
|
||||
strArr.splice(dataArr[i].rowNum - 1, 0, dataArr[i].str);
|
||||
} else if (dataArr[i].writeType == 'REVISE') {
|
||||
strArr[dataArr[i].rowNum - 1] = dataArr[i].str;
|
||||
} else if (dataArr[i].writeType == 'DELETE') {
|
||||
strArr[dataArr[i].rowNum - 1] = '';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
};
|
||||
44
extensions/we_sane/dist/main.js
vendored
Normal file
44
extensions/we_sane/dist/main.js
vendored
Normal file
@@ -0,0 +1,44 @@
|
||||
|
||||
var Fs = require("fs");
|
||||
const buildH5 = require("./buildH5");
|
||||
|
||||
exports.methods = {
|
||||
/** 打微伞包 */
|
||||
weSaneZip(){
|
||||
buildH5.writeIndex(); //写入Index
|
||||
buildH5.copyFloder("web-mobile_WeSane"); //复制替换文件 并打包zip
|
||||
},
|
||||
/** 打通用包 */
|
||||
commonH5Zip(){
|
||||
buildH5.writeIndex(); //写入Index
|
||||
buildH5.copyFloder("web-mobile_Other"); //复制替换文件 并打包zip
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 启动的时候执行的初始化方法
|
||||
*/
|
||||
exports.load = function() {
|
||||
buildH5.load(); //初始化 打包H5
|
||||
console.warn("we_sane is not compiled yet.");
|
||||
};
|
||||
/**
|
||||
* 插件被关闭的时候执行的卸载方法
|
||||
*/
|
||||
exports.unload = function() {};
|
||||
|
||||
|
||||
/** buildH5Json 配置信息
|
||||
* indexUrl index.html 的工程路径
|
||||
* replaceUrls 替换文件的 配置路径
|
||||
* webUrls 对应替换文件 需要copy 到 web里面的路径
|
||||
* writeIndexData 写入index.html 文件的配置 rowNum:行数 str:需要添加的代码
|
||||
*/
|
||||
1
extensions/we_sane/i18n/en.js
Normal file
1
extensions/we_sane/i18n/en.js
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";module.exports={description:"A blank extension"};
|
||||
1
extensions/we_sane/i18n/zh.js
Normal file
1
extensions/we_sane/i18n/zh.js
Normal file
@@ -0,0 +1 @@
|
||||
"use strict";module.exports={description:"一份空白的扩展"};
|
||||
39
extensions/we_sane/package.json
Normal file
39
extensions/we_sane/package.json
Normal file
@@ -0,0 +1,39 @@
|
||||
{
|
||||
"package_version": 2,
|
||||
"version": "1.0.0",
|
||||
"name": "we_sane",
|
||||
"description": "i18n:we_sane.description",
|
||||
"main": "./dist/main.js",
|
||||
"devDependencies": {
|
||||
"@types/node": "^16.0.1",
|
||||
"typescript": "^4.3.4"
|
||||
},
|
||||
"author": "Chao",
|
||||
"editor": ">=3.4.0",
|
||||
"scripts": {
|
||||
"build": "tsc -b",
|
||||
"watch": "tsc -w"
|
||||
},
|
||||
"contributions": {
|
||||
"menu": [
|
||||
{
|
||||
"path": "weSane/上线H5",
|
||||
"label": "打包-微伞zip",
|
||||
"message": "build-wesane"
|
||||
},
|
||||
{
|
||||
"path": "weSane/上线H5",
|
||||
"label": "打包-通用zip",
|
||||
"message": "build-h5"
|
||||
}
|
||||
],
|
||||
"messages": {
|
||||
"build-wesane": {
|
||||
"methods": ["weSaneZip"]
|
||||
},
|
||||
"build-h5": {
|
||||
"methods": ["commonH5Zip"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
18
extensions/we_sane/src/main.ts
Normal file
18
extensions/we_sane/src/main.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
/**
|
||||
* @en Registration method for the main process of Extension
|
||||
* @zh 为扩展的主进程的注册方法
|
||||
*/
|
||||
export const methods: { [key: string]: (...any: any) => any } = { };
|
||||
|
||||
/**
|
||||
* @en Hooks triggered after extension loading is complete
|
||||
* @zh 扩展加载完成后触发的钩子
|
||||
*/
|
||||
export const load = function() { };
|
||||
|
||||
/**
|
||||
* @en Hooks triggered after extension uninstallation is complete
|
||||
* @zh 扩展卸载完成后触发的钩子
|
||||
*/
|
||||
export const unload = function() { };
|
||||
14
extensions/we_sane/tsconfig.json
Normal file
14
extensions/we_sane/tsconfig.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "ES2017",
|
||||
"module": "CommonJS",
|
||||
"outDir": "./dist",
|
||||
"rootDir": "./src",
|
||||
"strict": true,
|
||||
"moduleResolution": "node",
|
||||
"esModuleInterop": true,
|
||||
"skipLibCheck": true,
|
||||
"forceConsistentCasingInFileNames": true,
|
||||
"resolveJsonModule": true,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user