web-extend-plugin-vue2 0.3.4 → 0.3.5
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 +40 -1
- package/dist/index.cjs +78 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +78 -21
- package/dist/index.mjs.map +1 -1
- package/index.d.ts +11 -0
- package/package.json +13 -9
package/dist/index.mjs
CHANGED
|
@@ -75,7 +75,7 @@ function getEnvObject() {
|
|
|
75
75
|
return raw.__WEP_ENV__;
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
catch {
|
|
78
|
+
catch (_a) {
|
|
79
79
|
/* ignore */
|
|
80
80
|
}
|
|
81
81
|
return null;
|
|
@@ -111,7 +111,7 @@ function readProcessEnv(key) {
|
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
}
|
|
114
|
-
catch {
|
|
114
|
+
catch (_a) {
|
|
115
115
|
/* ignore */
|
|
116
116
|
}
|
|
117
117
|
return undefined;
|
|
@@ -137,7 +137,7 @@ function resolveBundledIsDev() {
|
|
|
137
137
|
return true;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
|
-
catch {
|
|
140
|
+
catch (_a) {
|
|
141
141
|
/* ignore */
|
|
142
142
|
}
|
|
143
143
|
try {
|
|
@@ -145,7 +145,7 @@ function resolveBundledIsDev() {
|
|
|
145
145
|
return true;
|
|
146
146
|
}
|
|
147
147
|
}
|
|
148
|
-
catch {
|
|
148
|
+
catch (_b) {
|
|
149
149
|
/* ignore */
|
|
150
150
|
}
|
|
151
151
|
return false;
|
|
@@ -220,7 +220,7 @@ function isScriptHostAllowed(url, hostSet) {
|
|
|
220
220
|
const h = normalizeHost(u.hostname);
|
|
221
221
|
return hostSet.has(h);
|
|
222
222
|
}
|
|
223
|
-
catch {
|
|
223
|
+
catch (_a) {
|
|
224
224
|
return false;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
@@ -3432,7 +3432,7 @@ function parseWebPluginDevMapExplicit(opts) {
|
|
|
3432
3432
|
const map = JSON.parse(String(raw));
|
|
3433
3433
|
return map && typeof map === 'object' ? map : null;
|
|
3434
3434
|
}
|
|
3435
|
-
catch {
|
|
3435
|
+
catch (_a) {
|
|
3436
3436
|
console.warn('[wep] invalid webPluginDevMapJson / VITE_WEB_PLUGIN_DEV_MAP');
|
|
3437
3437
|
return null;
|
|
3438
3438
|
}
|
|
@@ -3484,7 +3484,7 @@ async function buildImplicitWebPluginDevMap(opts, hostSet) {
|
|
|
3484
3484
|
return {};
|
|
3485
3485
|
}
|
|
3486
3486
|
}
|
|
3487
|
-
catch {
|
|
3487
|
+
catch (_a) {
|
|
3488
3488
|
return {};
|
|
3489
3489
|
}
|
|
3490
3490
|
const pathPart = opts.webPluginDevEntryPath;
|
|
@@ -3508,7 +3508,7 @@ function closeAllPluginDevEventSources() {
|
|
|
3508
3508
|
try {
|
|
3509
3509
|
es.close();
|
|
3510
3510
|
}
|
|
3511
|
-
catch {
|
|
3511
|
+
catch (_a) {
|
|
3512
3512
|
/* ignore */
|
|
3513
3513
|
}
|
|
3514
3514
|
}
|
|
@@ -3526,7 +3526,7 @@ function isDevOriginAllowedForSse(origin, hostSet) {
|
|
|
3526
3526
|
const u = new URL(origin);
|
|
3527
3527
|
return hostSet.has(normalizeHost(u.hostname));
|
|
3528
3528
|
}
|
|
3529
|
-
catch {
|
|
3529
|
+
catch (_a) {
|
|
3530
3530
|
return false;
|
|
3531
3531
|
}
|
|
3532
3532
|
}
|
|
@@ -3570,7 +3570,7 @@ function startPluginDevSseForMap(devMap, isDev, hostSet, ssePath) {
|
|
|
3570
3570
|
try {
|
|
3571
3571
|
origins.add(new URL(t, window.location.href).origin);
|
|
3572
3572
|
}
|
|
3573
|
-
catch {
|
|
3573
|
+
catch (_a) {
|
|
3574
3574
|
/* skip */
|
|
3575
3575
|
}
|
|
3576
3576
|
}
|
|
@@ -3765,6 +3765,25 @@ function cloneMetaMap(registry) {
|
|
|
3765
3765
|
}
|
|
3766
3766
|
return out;
|
|
3767
3767
|
}
|
|
3768
|
+
function resolveVueGlobalComponentSource(VueRuntime) {
|
|
3769
|
+
if (!VueRuntime || typeof VueRuntime !== 'object' || Array.isArray(VueRuntime)) {
|
|
3770
|
+
return undefined;
|
|
3771
|
+
}
|
|
3772
|
+
const maybeOptions = VueRuntime.options;
|
|
3773
|
+
if (!maybeOptions || typeof maybeOptions !== 'object' || Array.isArray(maybeOptions)) {
|
|
3774
|
+
return undefined;
|
|
3775
|
+
}
|
|
3776
|
+
const maybeComponents = maybeOptions.components;
|
|
3777
|
+
return maybeComponents && typeof maybeComponents === 'object' && !Array.isArray(maybeComponents)
|
|
3778
|
+
? maybeComponents
|
|
3779
|
+
: undefined;
|
|
3780
|
+
}
|
|
3781
|
+
function resolveHostComponentMeta(metaInput, name, component) {
|
|
3782
|
+
const raw = typeof metaInput === 'function' ? metaInput(name, component) : metaInput;
|
|
3783
|
+
return raw && typeof raw === 'object' && !Array.isArray(raw)
|
|
3784
|
+
? normalizeExposeMeta(raw)
|
|
3785
|
+
: {};
|
|
3786
|
+
}
|
|
3768
3787
|
function registerHostComponents(input) {
|
|
3769
3788
|
const entries = normalizeNamedEntries(input, normalizeHostComponentEntry);
|
|
3770
3789
|
for (const { name, entry } of entries) {
|
|
@@ -3785,22 +3804,60 @@ function registerHostModules(input) {
|
|
|
3785
3804
|
}
|
|
3786
3805
|
return getAllHostModuleMeta();
|
|
3787
3806
|
}
|
|
3807
|
+
function registerVueGlobalComponents(VueRuntime, options = {}) {
|
|
3808
|
+
const source = options.source && typeof options.source === 'object' && !Array.isArray(options.source)
|
|
3809
|
+
? options.source
|
|
3810
|
+
: resolveVueGlobalComponentSource(VueRuntime);
|
|
3811
|
+
if (!source) {
|
|
3812
|
+
return getAllHostComponentMeta();
|
|
3813
|
+
}
|
|
3814
|
+
const registry = {};
|
|
3815
|
+
for (const [rawName, component] of Object.entries(source)) {
|
|
3816
|
+
const sourceName = String(rawName).trim();
|
|
3817
|
+
if (!sourceName || component == null) {
|
|
3818
|
+
continue;
|
|
3819
|
+
}
|
|
3820
|
+
if (typeof options.include === 'function' && !options.include(sourceName, component)) {
|
|
3821
|
+
continue;
|
|
3822
|
+
}
|
|
3823
|
+
const mappedName = typeof options.mapName === 'function' ? options.mapName(sourceName, component) : sourceName;
|
|
3824
|
+
const exposeName = typeof mappedName === 'string' ? mappedName.trim() : '';
|
|
3825
|
+
if (!exposeName) {
|
|
3826
|
+
continue;
|
|
3827
|
+
}
|
|
3828
|
+
registry[exposeName] = {
|
|
3829
|
+
component,
|
|
3830
|
+
...resolveHostComponentMeta(options.meta, sourceName, component)
|
|
3831
|
+
};
|
|
3832
|
+
}
|
|
3833
|
+
return registerHostComponents(registry);
|
|
3834
|
+
}
|
|
3788
3835
|
function getHostComponent(name) {
|
|
3789
3836
|
const key = typeof name === 'string' ? name.trim() : '';
|
|
3790
|
-
|
|
3837
|
+
if (!key) {
|
|
3838
|
+
return undefined;
|
|
3839
|
+
}
|
|
3840
|
+
const record = hostComponentsRegistry[key];
|
|
3841
|
+
return record ? record.value : undefined;
|
|
3791
3842
|
}
|
|
3792
3843
|
function getHostModule(name) {
|
|
3793
3844
|
const key = typeof name === 'string' ? name.trim() : '';
|
|
3794
|
-
|
|
3845
|
+
if (!key) {
|
|
3846
|
+
return undefined;
|
|
3847
|
+
}
|
|
3848
|
+
const record = hostModulesRegistry[key];
|
|
3849
|
+
return record ? record.value : undefined;
|
|
3795
3850
|
}
|
|
3796
3851
|
function getHostComponentMeta(name) {
|
|
3797
3852
|
const key = typeof name === 'string' ? name.trim() : '';
|
|
3798
|
-
const
|
|
3853
|
+
const record = key ? hostComponentsRegistry[key] : undefined;
|
|
3854
|
+
const meta = record ? record.meta : undefined;
|
|
3799
3855
|
return meta ? { ...meta } : undefined;
|
|
3800
3856
|
}
|
|
3801
3857
|
function getHostModuleMeta(name) {
|
|
3802
3858
|
const key = typeof name === 'string' ? name.trim() : '';
|
|
3803
|
-
const
|
|
3859
|
+
const record = key ? hostModulesRegistry[key] : undefined;
|
|
3860
|
+
const meta = record ? record.meta : undefined;
|
|
3804
3861
|
return meta ? { ...meta } : undefined;
|
|
3805
3862
|
}
|
|
3806
3863
|
function getAllHostComponentMeta() {
|
|
@@ -3904,7 +3961,7 @@ function resolveStaticManifestUrlForFetch(url, origin) {
|
|
|
3904
3961
|
const pathPart = u.startsWith('/') ? u : `/${u}`;
|
|
3905
3962
|
return new URL(pathPart, o).href;
|
|
3906
3963
|
}
|
|
3907
|
-
catch {
|
|
3964
|
+
catch (_a) {
|
|
3908
3965
|
return u;
|
|
3909
3966
|
}
|
|
3910
3967
|
}
|
|
@@ -4290,13 +4347,13 @@ function manifestFetchCacheMiddleware$1(options = {}) {
|
|
|
4290
4347
|
return structuredClone(r);
|
|
4291
4348
|
}
|
|
4292
4349
|
}
|
|
4293
|
-
catch {
|
|
4350
|
+
catch (_a) {
|
|
4294
4351
|
/* ignore */
|
|
4295
4352
|
}
|
|
4296
4353
|
try {
|
|
4297
4354
|
return JSON.parse(JSON.stringify(r));
|
|
4298
4355
|
}
|
|
4299
|
-
catch {
|
|
4356
|
+
catch (_b) {
|
|
4300
4357
|
return { ...r, data: r.data };
|
|
4301
4358
|
}
|
|
4302
4359
|
}
|
|
@@ -4334,7 +4391,7 @@ function manifestFetchCacheMiddleware$1(options = {}) {
|
|
|
4334
4391
|
}
|
|
4335
4392
|
return res;
|
|
4336
4393
|
}
|
|
4337
|
-
catch {
|
|
4394
|
+
catch (_a) {
|
|
4338
4395
|
return null;
|
|
4339
4396
|
}
|
|
4340
4397
|
}
|
|
@@ -4342,7 +4399,7 @@ function manifestFetchCacheMiddleware$1(options = {}) {
|
|
|
4342
4399
|
try {
|
|
4343
4400
|
store.setItem(key, JSON.stringify({ expiresAt, result }));
|
|
4344
4401
|
}
|
|
4345
|
-
catch {
|
|
4402
|
+
catch (_a) {
|
|
4346
4403
|
/* Quota / 不可序列化 */
|
|
4347
4404
|
}
|
|
4348
4405
|
}
|
|
@@ -4435,7 +4492,7 @@ function normalizeBridgePath(input) {
|
|
|
4435
4492
|
try {
|
|
4436
4493
|
return decodeURIComponent(normalized);
|
|
4437
4494
|
}
|
|
4438
|
-
catch {
|
|
4495
|
+
catch (_a) {
|
|
4439
4496
|
return normalized;
|
|
4440
4497
|
}
|
|
4441
4498
|
})();
|
|
@@ -4921,5 +4978,5 @@ function createVueCliAxiosInstallOptions(deps, extra = {}) {
|
|
|
4921
4978
|
const { bootstrapPlugins, defaultFetchWebPluginManifest, resolveRuntimeOptions, ensurePluginHostRoute, getActivatedPluginIds } = pluginRuntime;
|
|
4922
4979
|
const { composeManifestFetch, manifestFetchCacheMiddleware, wrapManifestFetchWithCache } = manifestComposer;
|
|
4923
4980
|
|
|
4924
|
-
export { ExtensionPoint, HOST_PLUGIN_API_VERSION, RUNTIME_CONSOLE_LABEL, bootstrapPlugins, composeManifestFetch, createHostApi, createRequestBridge, createVueCliAxiosInstallOptions, defaultFetchWebPluginManifest, defaultManifestFetchCache, defaultManifestMode, defaultWebExtendPluginRuntime, disposeWebPlugin, ensurePluginHostRoute, getActivatedPluginIds, getAllHostComponentMeta, getAllHostModuleMeta, getContributedRoutesForPlugin, getHostComponent, getHostComponentMeta, getHostModule, getHostModuleMeta, getRegisteredTopRouteNamesForPlugin, installWebExtendPluginVue2, manifestFetchCacheMiddleware, peerMinimumVersions, registerHostComponents, registerHostModules, registries, resolveRuntimeOptions, routeSynthNamePrefix, setWebExtendPluginEnv, webExtendPluginEnvKeys, wrapManifestFetchWithCache };
|
|
4981
|
+
export { ExtensionPoint, HOST_PLUGIN_API_VERSION, RUNTIME_CONSOLE_LABEL, bootstrapPlugins, composeManifestFetch, createHostApi, createRequestBridge, createVueCliAxiosInstallOptions, defaultFetchWebPluginManifest, defaultManifestFetchCache, defaultManifestMode, defaultWebExtendPluginRuntime, disposeWebPlugin, ensurePluginHostRoute, getActivatedPluginIds, getAllHostComponentMeta, getAllHostModuleMeta, getContributedRoutesForPlugin, getHostComponent, getHostComponentMeta, getHostModule, getHostModuleMeta, getRegisteredTopRouteNamesForPlugin, installWebExtendPluginVue2, manifestFetchCacheMiddleware, peerMinimumVersions, registerHostComponents, registerHostModules, registerVueGlobalComponents, registries, resolveRuntimeOptions, routeSynthNamePrefix, setWebExtendPluginEnv, webExtendPluginEnvKeys, wrapManifestFetchWithCache };
|
|
4925
4982
|
//# sourceMappingURL=index.mjs.map
|