@lvce-editor/extension-host-worker 1.3.0 → 1.4.0
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/dist/extensionHostWorkerMain.js +23 -15
- package/package.json +1 -1
|
@@ -1843,7 +1843,7 @@ const createRpcWithId = ({
|
|
|
1843
1843
|
const lazyRpc = {
|
|
1844
1844
|
async invoke(method, ...params) {
|
|
1845
1845
|
const rpc = await getOrCreateRpc(id);
|
|
1846
|
-
|
|
1846
|
+
return rpc.invoke(method, ...params);
|
|
1847
1847
|
}
|
|
1848
1848
|
};
|
|
1849
1849
|
return lazyRpc;
|
|
@@ -2187,6 +2187,7 @@ const getRemoteUrlForWebView = async (uri, options = {}) => {
|
|
|
2187
2187
|
|
|
2188
2188
|
const Electron = 'electron';
|
|
2189
2189
|
const Remote = 'remote';
|
|
2190
|
+
const Web = 'web';
|
|
2190
2191
|
const Test = 'test';
|
|
2191
2192
|
|
|
2192
2193
|
const getPlatform = () => {
|
|
@@ -2202,6 +2203,9 @@ const getPlatform = () => {
|
|
|
2202
2203
|
if (typeof name !== 'undefined' && name.endsWith('(Electron)')) {
|
|
2203
2204
|
return Electron;
|
|
2204
2205
|
}
|
|
2206
|
+
if (typeof name !== 'undefined' && name.endsWith('(Web)')) {
|
|
2207
|
+
return Web;
|
|
2208
|
+
}
|
|
2205
2209
|
return Remote;
|
|
2206
2210
|
};
|
|
2207
2211
|
const platform = getPlatform(); // TODO tree-shake this out in production
|
|
@@ -2401,12 +2405,29 @@ const getExtensionId = extension => {
|
|
|
2401
2405
|
return '<unknown>';
|
|
2402
2406
|
};
|
|
2403
2407
|
|
|
2408
|
+
const getAssetDir = () => {
|
|
2409
|
+
// @ts-ignore
|
|
2410
|
+
if (typeof ASSET_DIR !== 'undefined') {
|
|
2411
|
+
// @ts-ignore
|
|
2412
|
+
return ASSET_DIR;
|
|
2413
|
+
}
|
|
2414
|
+
if (platform === Electron) {
|
|
2415
|
+
return '../../../../..';
|
|
2416
|
+
}
|
|
2417
|
+
return '';
|
|
2418
|
+
};
|
|
2419
|
+
const assetDir = getAssetDir();
|
|
2420
|
+
|
|
2404
2421
|
const getUrlPrefix = extensionPath => {
|
|
2405
2422
|
if (extensionPath.startsWith('http://') || extensionPath.startsWith('https://')) {
|
|
2406
2423
|
return extensionPath;
|
|
2407
2424
|
}
|
|
2408
|
-
|
|
2425
|
+
if (platform === Web) {
|
|
2426
|
+
return `${assetDir}${extensionPath}`;
|
|
2427
|
+
}
|
|
2428
|
+
return `/remote${extensionPath}`;
|
|
2409
2429
|
};
|
|
2430
|
+
|
|
2410
2431
|
const handleRpcInfos = extension => {
|
|
2411
2432
|
try {
|
|
2412
2433
|
if (!extension) {
|
|
@@ -2507,19 +2528,6 @@ class BabelParseError extends SyntaxError {
|
|
|
2507
2528
|
}
|
|
2508
2529
|
}
|
|
2509
2530
|
|
|
2510
|
-
const getAssetDir = () => {
|
|
2511
|
-
// @ts-ignore
|
|
2512
|
-
if (typeof ASSET_DIR !== 'undefined') {
|
|
2513
|
-
// @ts-ignore
|
|
2514
|
-
return ASSET_DIR;
|
|
2515
|
-
}
|
|
2516
|
-
if (platform === Electron) {
|
|
2517
|
-
return '../../../../..';
|
|
2518
|
-
}
|
|
2519
|
-
return '';
|
|
2520
|
-
};
|
|
2521
|
-
const assetDir = getAssetDir();
|
|
2522
|
-
|
|
2523
2531
|
const loadBabelParser = () => {
|
|
2524
2532
|
const url = `${assetDir}/js/babel-parser.js`;
|
|
2525
2533
|
return import(url);
|
package/package.json
CHANGED