minidev 0.0.1
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 +39 -0
- package/assets/builder-debug-utils/CHANGELOG.md +263 -0
- package/assets/builder-debug-utils/README.md +55 -0
- package/assets/builder-debug-utils/dist/index.js +1 -0
- package/assets/builder-debug-utils/lib/compose.d.ts +2 -0
- package/assets/builder-debug-utils/lib/compose.js +81 -0
- package/assets/builder-debug-utils/lib/config.d.ts +3 -0
- package/assets/builder-debug-utils/lib/config.js +18 -0
- package/assets/builder-debug-utils/lib/context.d.ts +14 -0
- package/assets/builder-debug-utils/lib/context.js +31 -0
- package/assets/builder-debug-utils/lib/index.d.ts +3 -0
- package/assets/builder-debug-utils/lib/index.js +17 -0
- package/assets/builder-debug-utils/lib/interface.d.ts +86 -0
- package/assets/builder-debug-utils/lib/interface.js +15 -0
- package/assets/builder-debug-utils/lib/sdk.d.ts +30 -0
- package/assets/builder-debug-utils/lib/sdk.js +148 -0
- package/assets/builder-debug-utils/lib/updater.d.ts +16 -0
- package/assets/builder-debug-utils/lib/updater.js +137 -0
- package/assets/builder-debug-utils/lib/utils.d.ts +13 -0
- package/assets/builder-debug-utils/lib/utils.js +59 -0
- package/assets/builder-debug-utils/offline/assets_map +1 -0
- package/assets/builder-debug-utils/offline/boatman_cube +1 -0
- package/assets/builder-debug-utils/offline/boatman_mini +3 -0
- package/assets/builder-debug-utils/package.json +49 -0
- package/assets/builder-debug-utils/readonly/assets_map +1 -0
- package/assets/builder-debug-utils/readonly/boatman_cube +1 -0
- package/assets/builder-debug-utils/readonly/boatman_mini +3 -0
- package/bin/minidev.js +4 -0
- package/index.d.ts +5500 -0
- package/lib/index.js +2 -0
- package/lib/index.js.LICENSE.txt +36 -0
- package/package.json +36 -0
- package/scripts/post-install.js +6 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IBuilderDebugClient, IBuilderDebugClientOptions, IUpdateAssetsOptions, IGenerateInjectCodeOptions, IGetBoatmanBundleOptions } from './interface';
|
|
2
|
+
import { AssetsUpdater } from './updater';
|
|
3
|
+
import { BuilderDebugContext } from './context';
|
|
4
|
+
export declare class BuilderDebugClient implements IBuilderDebugClient {
|
|
5
|
+
protected assetsUpdater: AssetsUpdater;
|
|
6
|
+
protected context: BuilderDebugContext;
|
|
7
|
+
constructor(options?: IBuilderDebugClientOptions);
|
|
8
|
+
updateOfflineAssets(options: IUpdateAssetsOptions): Promise<void>;
|
|
9
|
+
generateInjectCode(options: IGenerateInjectCodeOptions): Promise<import("./interface").IInjectionPoints>;
|
|
10
|
+
/**
|
|
11
|
+
* generateInjectCode 同步方法
|
|
12
|
+
*/
|
|
13
|
+
generateInjectCodeSync(options: IGenerateInjectCodeOptions): import("./interface").IInjectionPoints;
|
|
14
|
+
/**
|
|
15
|
+
* 生成构建器消费的 InjectCode JSON 文件,并返回路径
|
|
16
|
+
*/
|
|
17
|
+
generateInjectCodePath(options: IGenerateInjectCodeOptions): Promise<string>;
|
|
18
|
+
/**
|
|
19
|
+
* generateInjectCodePath 同步方法
|
|
20
|
+
*/
|
|
21
|
+
generateInjectCodePathSync(options: IGenerateInjectCodeOptions): string;
|
|
22
|
+
/**
|
|
23
|
+
* 获取本地 boatman 文件资源路径
|
|
24
|
+
*/
|
|
25
|
+
getBoatmanBundlePath(options: IGetBoatmanBundleOptions): Promise<string>;
|
|
26
|
+
/**
|
|
27
|
+
* getBoatmanBundlePath 同步方法
|
|
28
|
+
*/
|
|
29
|
+
getBoatmanBundlePathSync(options: IGetBoatmanBundleOptions): string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
16
|
+
const interface_1 = require("./interface");
|
|
17
|
+
const updater_1 = require("./updater");
|
|
18
|
+
const config_1 = require("./config");
|
|
19
|
+
const compose_1 = require("./compose");
|
|
20
|
+
const context_1 = require("./context");
|
|
21
|
+
class BuilderDebugClient {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
this.context = new context_1.BuilderDebugContext(Object.assign(Object.assign({}, config_1.defaultConfig), options));
|
|
24
|
+
}
|
|
25
|
+
updateOfflineAssets(options) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
if (!this.assetsUpdater) {
|
|
28
|
+
this.assetsUpdater = new updater_1.AssetsUpdater(this.context);
|
|
29
|
+
}
|
|
30
|
+
if (options.cacheToday) {
|
|
31
|
+
yield this.assetsUpdater.updateOfflineAssetsToday();
|
|
32
|
+
}
|
|
33
|
+
else {
|
|
34
|
+
yield this.assetsUpdater.updateOfflineAssets();
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
generateInjectCode(options) {
|
|
39
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
options = getInjectCodeOptions(options);
|
|
41
|
+
const assetsMap = yield readAssetsMap(this.context);
|
|
42
|
+
return compose_1.composeAssetsByCompileMode(assetsMap, options);
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* generateInjectCode 同步方法
|
|
47
|
+
*/
|
|
48
|
+
generateInjectCodeSync(options) {
|
|
49
|
+
options = getInjectCodeOptions(options);
|
|
50
|
+
const assetsMap = readAssetsMapSync(this.context);
|
|
51
|
+
return compose_1.composeAssetsByCompileMode(assetsMap, options);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* 生成构建器消费的 InjectCode JSON 文件,并返回路径
|
|
55
|
+
*/
|
|
56
|
+
generateInjectCodePath(options) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const injectCode = yield this.generateInjectCode(options);
|
|
59
|
+
yield fs_extra_1.default.writeJSON(config_1.defaultConfig.injectCodeTempPath, injectCode);
|
|
60
|
+
return config_1.defaultConfig.injectCodeTempPath;
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* generateInjectCodePath 同步方法
|
|
65
|
+
*/
|
|
66
|
+
generateInjectCodePathSync(options) {
|
|
67
|
+
const injectCode = this.generateInjectCodeSync(options);
|
|
68
|
+
fs_extra_1.default.writeJSONSync(config_1.defaultConfig.injectCodeTempPath, injectCode);
|
|
69
|
+
return config_1.defaultConfig.injectCodeTempPath;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* 获取本地 boatman 文件资源路径
|
|
73
|
+
*/
|
|
74
|
+
getBoatmanBundlePath(options) {
|
|
75
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
+
const opt = getGetBoatmanBundleOptions(options);
|
|
77
|
+
// 若文件不存在降级到 readonly 备份
|
|
78
|
+
try {
|
|
79
|
+
const offlineFile = this.context.getBoatmanFilePath(opt.target);
|
|
80
|
+
yield fs_extra_1.default.access(offlineFile, fs_extra_1.default.constants.R_OK);
|
|
81
|
+
return offlineFile;
|
|
82
|
+
}
|
|
83
|
+
catch (error) {
|
|
84
|
+
return this.context.getReadonlyBoatmanFilePath(opt.target);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* getBoatmanBundlePath 同步方法
|
|
90
|
+
*/
|
|
91
|
+
getBoatmanBundlePathSync(options) {
|
|
92
|
+
const opt = getGetBoatmanBundleOptions(options);
|
|
93
|
+
try {
|
|
94
|
+
const offlineFile = this.context.getBoatmanFilePath(opt.target);
|
|
95
|
+
fs_extra_1.default.accessSync(offlineFile, fs_extra_1.default.constants.R_OK);
|
|
96
|
+
return offlineFile;
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return this.context.getReadonlyBoatmanFilePath(opt.target);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.BuilderDebugClient = BuilderDebugClient;
|
|
104
|
+
function getGetBoatmanBundleOptions(options) {
|
|
105
|
+
const result = {
|
|
106
|
+
target: interface_1.ECompileTargetType.Mini,
|
|
107
|
+
};
|
|
108
|
+
if (options.target && Object.keys(interface_1.ECompileTargetType).indexOf(options.target) > -1) {
|
|
109
|
+
result.target = options.target;
|
|
110
|
+
}
|
|
111
|
+
return result;
|
|
112
|
+
}
|
|
113
|
+
function getInjectCodeOptions(options) {
|
|
114
|
+
const opt = Object.assign({}, options);
|
|
115
|
+
if (!opt.mode || Object.keys(interface_1.ECompileModeType).indexOf(opt.mode) === -1) {
|
|
116
|
+
throw new Error(`[${config_1.libName}] invalid 'mode' option: ${opt.mode}`);
|
|
117
|
+
}
|
|
118
|
+
if (!opt.target || Object.keys(interface_1.ECompileTargetType).indexOf(opt.target) === -1) {
|
|
119
|
+
opt.target = interface_1.ECompileTargetType.Mini;
|
|
120
|
+
}
|
|
121
|
+
return options;
|
|
122
|
+
}
|
|
123
|
+
function readAssetsMapSync(context) {
|
|
124
|
+
let localJSON = fs_extra_1.default.readJSONSync(context.getAssetsMapFilePath(), { throws: false });
|
|
125
|
+
if (!localJSON) {
|
|
126
|
+
console.log(`[${config_1.libName}] offline assets_map file was damaged, fallback to readonly file`);
|
|
127
|
+
// 避免文件损坏,readonly/assets_map 做兜底
|
|
128
|
+
localJSON = fs_extra_1.default.readJSONSync(context.getReadonlyAssetsMapFilePath());
|
|
129
|
+
}
|
|
130
|
+
return localJSON;
|
|
131
|
+
}
|
|
132
|
+
function readAssetsMap(context) {
|
|
133
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
+
let localJSON;
|
|
135
|
+
try {
|
|
136
|
+
localJSON = yield fs_extra_1.default.readJSON(context.getAssetsMapFilePath(), { throws: false });
|
|
137
|
+
}
|
|
138
|
+
catch (error) {
|
|
139
|
+
// throws if file is not found
|
|
140
|
+
}
|
|
141
|
+
if (!localJSON) {
|
|
142
|
+
console.log(`[${config_1.libName}] offline assets_map file was damaged, fallback to readonly file`);
|
|
143
|
+
// 避免文件损坏,readonly/assets_map 做兜底
|
|
144
|
+
localJSON = yield fs_extra_1.default.readJSON(context.getReadonlyAssetsMapFilePath());
|
|
145
|
+
}
|
|
146
|
+
return localJSON;
|
|
147
|
+
});
|
|
148
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { BuilderDebugContext } from './context';
|
|
2
|
+
export declare class AssetsUpdater {
|
|
3
|
+
protected context: BuilderDebugContext;
|
|
4
|
+
protected updatingTask: Promise<void> | undefined;
|
|
5
|
+
constructor(context: BuilderDebugContext);
|
|
6
|
+
/**
|
|
7
|
+
* 检查本地资源文件是否过期并进行更新,每日只更新一次
|
|
8
|
+
*/
|
|
9
|
+
updateOfflineAssetsToday(): Promise<void>;
|
|
10
|
+
/**
|
|
11
|
+
* 更新本地资源文件
|
|
12
|
+
*/
|
|
13
|
+
updateOfflineAssets(): Promise<void>;
|
|
14
|
+
protected runUpdateTask(): Promise<void>;
|
|
15
|
+
protected updateLocalFile(filePath: string, url: string | undefined, integrity: string | undefined): Promise<void>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
const bent_1 = __importDefault(require("bent"));
|
|
16
|
+
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
17
|
+
const crypto_1 = __importDefault(require("crypto"));
|
|
18
|
+
const config_1 = require("./config");
|
|
19
|
+
const interface_1 = require("./interface");
|
|
20
|
+
const getJSON = bent_1.default('json');
|
|
21
|
+
const getBuffer = bent_1.default('buffer');
|
|
22
|
+
const LOG_TAG = `[${config_1.libName}]`;
|
|
23
|
+
class AssetsUpdater {
|
|
24
|
+
constructor(context) {
|
|
25
|
+
this.context = context;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 检查本地资源文件是否过期并进行更新,每日只更新一次
|
|
29
|
+
*/
|
|
30
|
+
updateOfflineAssetsToday() {
|
|
31
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
+
if (!isFileModifiedToday(this.context.getAssetsMapFilePath())) {
|
|
33
|
+
console.log(`${LOG_TAG} local assets are outdated, start to download new debug assets`);
|
|
34
|
+
yield this.updateOfflineAssets();
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
console.log(`${LOG_TAG} local assets are in the period of validity`);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* 更新本地资源文件
|
|
43
|
+
*/
|
|
44
|
+
updateOfflineAssets() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
if (this.updatingTask) {
|
|
47
|
+
return this.updatingTask;
|
|
48
|
+
}
|
|
49
|
+
this.updatingTask = this.runUpdateTask();
|
|
50
|
+
try {
|
|
51
|
+
yield this.updatingTask;
|
|
52
|
+
this.updatingTask = undefined;
|
|
53
|
+
}
|
|
54
|
+
catch (error) {
|
|
55
|
+
this.updatingTask = undefined;
|
|
56
|
+
throw error;
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
runUpdateTask() {
|
|
61
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
62
|
+
// 1. 请求在线配置
|
|
63
|
+
let assetsConfig;
|
|
64
|
+
try {
|
|
65
|
+
assetsConfig = (yield getJSON(config_1.defaultConfig.assetsQueryUrl));
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
throw new Error('Failed to request online config');
|
|
69
|
+
}
|
|
70
|
+
yield Promise.all([
|
|
71
|
+
this.updateLocalFile(this.context.getAssetsMapFilePath(), assetsConfig.url_v2, assetsConfig.integrity_v2),
|
|
72
|
+
this.updateLocalFile(this.context.getBoatmanFilePath(interface_1.ECompileTargetType.Mini), assetsConfig.url_boatman_mini, assetsConfig.integrity_boatman_mini),
|
|
73
|
+
this.updateLocalFile(this.context.getBoatmanFilePath(interface_1.ECompileTargetType.Cube), assetsConfig.url_boatman_cube, assetsConfig.integrity_boatman_cube),
|
|
74
|
+
]);
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
updateLocalFile(filePath, url, integrity) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
if (!url || !integrity) {
|
|
80
|
+
// 线上配置有误
|
|
81
|
+
console.error(`${LOG_TAG} Empty key in config`);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
// 2. 校验本地资源是否最新
|
|
85
|
+
try {
|
|
86
|
+
const localAssetsBuffer = yield fs_extra_1.default.readFile(filePath);
|
|
87
|
+
const localAssetsHash = crypto_1.default
|
|
88
|
+
.createHash('sha256')
|
|
89
|
+
.update(localAssetsBuffer)
|
|
90
|
+
.digest('base64');
|
|
91
|
+
if (localAssetsHash === integrity) {
|
|
92
|
+
console.log(`${LOG_TAG} Local is latested`);
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
// 本地资源文件不存在
|
|
98
|
+
}
|
|
99
|
+
console.log(`${LOG_TAG} Start to update local`);
|
|
100
|
+
// 3. 下载新版本资源
|
|
101
|
+
let downloadBuffer;
|
|
102
|
+
try {
|
|
103
|
+
downloadBuffer = (yield getBuffer(url));
|
|
104
|
+
}
|
|
105
|
+
catch (error) {
|
|
106
|
+
console.error(`${LOG_TAG} Download error ${error.message}`);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
// 4. 校验下载资源文件 hash,并写入本地文件
|
|
110
|
+
const downloadHash = crypto_1.default.createHash('sha256').update(downloadBuffer).digest('base64');
|
|
111
|
+
if (downloadHash === integrity) {
|
|
112
|
+
yield fs_extra_1.default.writeFile(filePath, downloadBuffer);
|
|
113
|
+
console.log(`${LOG_TAG} Updated`);
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
throw new Error('Failed to verify');
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.AssetsUpdater = AssetsUpdater;
|
|
122
|
+
/**
|
|
123
|
+
* 检查本地资源文件是否今日更新过
|
|
124
|
+
* @returns {boolean} true-更新过; false-未更新
|
|
125
|
+
*/
|
|
126
|
+
function isFileModifiedToday(filePath) {
|
|
127
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
128
|
+
try {
|
|
129
|
+
const stat = yield fs_extra_1.default.stat(filePath);
|
|
130
|
+
const mtime = new Date(parseInt(`${stat.mtimeMs}`, 10));
|
|
131
|
+
return new Date().toLocaleDateString() === mtime.toLocaleDateString();
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
return false;
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Legacy module API
|
|
3
|
+
* 直接导出函数
|
|
4
|
+
*/
|
|
5
|
+
import { IBuilderDebugClientOptions, IGenerateInjectCodeOptions, IGetBoatmanBundleOptions, IInjectionPoints, IUpdateAssetsOptions } from './interface';
|
|
6
|
+
export declare function updateInjectCodeAssets(options?: IUpdateAssetsOptions): Promise<void>;
|
|
7
|
+
export declare function generateInjectCode(options: IGenerateInjectCodeOptions): Promise<IInjectionPoints>;
|
|
8
|
+
export declare function generateInjectCodeSync(options: IGenerateInjectCodeOptions): IInjectionPoints;
|
|
9
|
+
export declare function generateInjectCodePath(options: IGenerateInjectCodeOptions): Promise<string>;
|
|
10
|
+
export declare function generateInjectCodePathSync(options: IGenerateInjectCodeOptions): string;
|
|
11
|
+
export declare function getBoatmanBundlePath(options?: IGetBoatmanBundleOptions): Promise<string>;
|
|
12
|
+
export declare function getBoatmanBundlePathSync(options?: IGetBoatmanBundleOptions): string;
|
|
13
|
+
export declare function loadConfig(options: IBuilderDebugClientOptions): void;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
const sdk_1 = require("./sdk");
|
|
13
|
+
let sharedBuilderDebugClient;
|
|
14
|
+
function getClient() {
|
|
15
|
+
if (!sharedBuilderDebugClient) {
|
|
16
|
+
sharedBuilderDebugClient = new sdk_1.BuilderDebugClient();
|
|
17
|
+
}
|
|
18
|
+
return sharedBuilderDebugClient;
|
|
19
|
+
}
|
|
20
|
+
function updateInjectCodeAssets(options = {}) {
|
|
21
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
return getClient().updateOfflineAssets(options);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
exports.updateInjectCodeAssets = updateInjectCodeAssets;
|
|
26
|
+
function generateInjectCode(options) {
|
|
27
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
return getClient().generateInjectCode(options);
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
exports.generateInjectCode = generateInjectCode;
|
|
32
|
+
function generateInjectCodeSync(options) {
|
|
33
|
+
return getClient().generateInjectCodeSync(options);
|
|
34
|
+
}
|
|
35
|
+
exports.generateInjectCodeSync = generateInjectCodeSync;
|
|
36
|
+
function generateInjectCodePath(options) {
|
|
37
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
return getClient().generateInjectCodePath(options);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
exports.generateInjectCodePath = generateInjectCodePath;
|
|
42
|
+
function generateInjectCodePathSync(options) {
|
|
43
|
+
return getClient().generateInjectCodePathSync(options);
|
|
44
|
+
}
|
|
45
|
+
exports.generateInjectCodePathSync = generateInjectCodePathSync;
|
|
46
|
+
function getBoatmanBundlePath(options = {}) {
|
|
47
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
return getClient().getBoatmanBundlePath(options);
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
exports.getBoatmanBundlePath = getBoatmanBundlePath;
|
|
52
|
+
function getBoatmanBundlePathSync(options = {}) {
|
|
53
|
+
return getClient().getBoatmanBundlePathSync(options);
|
|
54
|
+
}
|
|
55
|
+
exports.getBoatmanBundlePathSync = getBoatmanBundlePathSync;
|
|
56
|
+
function loadConfig(options) {
|
|
57
|
+
sharedBuilderDebugClient = new sdk_1.BuilderDebugClient(options);
|
|
58
|
+
}
|
|
59
|
+
exports.loadConfig = loadConfig;
|