chayns-api 3.7.0-beta.0 → 3.7.0-beta.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.
|
@@ -17,35 +17,40 @@ const isManifestUrl = url => {
|
|
|
17
17
|
return url.endsWith(MANIFEST_SUFFIX);
|
|
18
18
|
}
|
|
19
19
|
};
|
|
20
|
-
const ManifestShareScopePlugin = () =>
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const ManifestShareScopePlugin = () => {
|
|
21
|
+
const legacyRemotes = new WeakSet();
|
|
22
|
+
return {
|
|
23
|
+
name: 'manifest-share-scope',
|
|
24
|
+
beforeRegisterRemote(args) {
|
|
25
|
+
if (args.remote.shareScope) {
|
|
26
|
+
legacyRemotes.add(args.remote);
|
|
27
|
+
} else if ('entry' in args.remote && args.remote.entry.endsWith('v2.remoteEntry.js')) {
|
|
28
|
+
Object.assign(args.remote, {
|
|
29
|
+
shareScope: LEGACY_SHARE_SCOPE
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
return args;
|
|
33
|
+
},
|
|
34
|
+
async beforeRequest(args) {
|
|
35
|
+
var _manifest$metaData, _manifest$shared$find;
|
|
36
|
+
const remote = args.options.remotes.find(candidate => {
|
|
37
|
+
const name = candidate.name;
|
|
38
|
+
const alias = candidate.alias;
|
|
39
|
+
return args.id === name || args.id.startsWith(`${name}/`) || alias && (args.id === alias || args.id.startsWith(`${alias}/`));
|
|
26
40
|
});
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
if (!remote || legacyRemotes.has(remote) || !('entry' in remote) || !isManifestUrl(remote.entry)) {
|
|
42
|
+
return args;
|
|
43
|
+
}
|
|
44
|
+
await args.origin.snapshotHandler.loadRemoteSnapshotInfo({
|
|
45
|
+
moduleInfo: remote,
|
|
46
|
+
id: args.id
|
|
47
|
+
});
|
|
48
|
+
const manifest = args.origin.snapshotHandler.manifestCache.get(remote.entry);
|
|
49
|
+
const remoteShareScope = manifest === null || manifest === void 0 || (_manifest$metaData = manifest.metaData) === null || _manifest$metaData === void 0 ? void 0 : _manifest$metaData.reactShareScope;
|
|
50
|
+
const reactRequiredVersion = manifest === null || manifest === void 0 || (_manifest$shared$find = manifest.shared.find(shared => shared.name === 'react')) === null || _manifest$shared$find === void 0 ? void 0 : _manifest$shared$find.requiredVersion;
|
|
51
|
+
remote.shareScope = !remoteShareScope ? LEGACY_SHARE_SCOPE : reactRequiredVersion && (0, _runtimeCore.satisfy)(_react.default.version, reactRequiredVersion) ? `${HOST_REACT_SHARE_SCOPE}-${_react.default.version}` : remoteShareScope;
|
|
38
52
|
return args;
|
|
39
53
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
id: args.id
|
|
43
|
-
});
|
|
44
|
-
const manifest = args.origin.snapshotHandler.manifestCache.get(remote.entry);
|
|
45
|
-
const remoteShareScope = manifest === null || manifest === void 0 || (_manifest$metaData = manifest.metaData) === null || _manifest$metaData === void 0 ? void 0 : _manifest$metaData.reactShareScope;
|
|
46
|
-
const reactRequiredVersion = manifest === null || manifest === void 0 || (_manifest$shared$find = manifest.shared.find(shared => shared.name === 'react')) === null || _manifest$shared$find === void 0 ? void 0 : _manifest$shared$find.requiredVersion;
|
|
47
|
-
remote.shareScope = !remoteShareScope ? LEGACY_SHARE_SCOPE : reactRequiredVersion && (0, _runtimeCore.satisfy)(_react.default.version, reactRequiredVersion) ? `${HOST_REACT_SHARE_SCOPE}-${_react.default.version}` : remoteShareScope;
|
|
48
|
-
return args;
|
|
49
|
-
}
|
|
50
|
-
});
|
|
54
|
+
};
|
|
55
|
+
};
|
|
51
56
|
exports.ManifestShareScopePlugin = ManifestShareScopePlugin;
|
|
@@ -10,34 +10,39 @@ const isManifestUrl = url => {
|
|
|
10
10
|
return url.endsWith(MANIFEST_SUFFIX);
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
export const ManifestShareScopePlugin = () =>
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
export const ManifestShareScopePlugin = () => {
|
|
14
|
+
const legacyRemotes = new WeakSet();
|
|
15
|
+
return {
|
|
16
|
+
name: 'manifest-share-scope',
|
|
17
|
+
beforeRegisterRemote(args) {
|
|
18
|
+
if (args.remote.shareScope) {
|
|
19
|
+
legacyRemotes.add(args.remote);
|
|
20
|
+
} else if ('entry' in args.remote && args.remote.entry.endsWith('v2.remoteEntry.js')) {
|
|
21
|
+
Object.assign(args.remote, {
|
|
22
|
+
shareScope: LEGACY_SHARE_SCOPE
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
return args;
|
|
26
|
+
},
|
|
27
|
+
async beforeRequest(args) {
|
|
28
|
+
var _manifest$metaData, _manifest$shared$find;
|
|
29
|
+
const remote = args.options.remotes.find(candidate => {
|
|
30
|
+
const name = candidate.name;
|
|
31
|
+
const alias = candidate.alias;
|
|
32
|
+
return args.id === name || args.id.startsWith(`${name}/`) || alias && (args.id === alias || args.id.startsWith(`${alias}/`));
|
|
19
33
|
});
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
34
|
+
if (!remote || legacyRemotes.has(remote) || !('entry' in remote) || !isManifestUrl(remote.entry)) {
|
|
35
|
+
return args;
|
|
36
|
+
}
|
|
37
|
+
await args.origin.snapshotHandler.loadRemoteSnapshotInfo({
|
|
38
|
+
moduleInfo: remote,
|
|
39
|
+
id: args.id
|
|
40
|
+
});
|
|
41
|
+
const manifest = args.origin.snapshotHandler.manifestCache.get(remote.entry);
|
|
42
|
+
const remoteShareScope = manifest === null || manifest === void 0 || (_manifest$metaData = manifest.metaData) === null || _manifest$metaData === void 0 ? void 0 : _manifest$metaData.reactShareScope;
|
|
43
|
+
const reactRequiredVersion = manifest === null || manifest === void 0 || (_manifest$shared$find = manifest.shared.find(shared => shared.name === 'react')) === null || _manifest$shared$find === void 0 ? void 0 : _manifest$shared$find.requiredVersion;
|
|
44
|
+
remote.shareScope = !remoteShareScope ? LEGACY_SHARE_SCOPE : reactRequiredVersion && satisfy(React.version, reactRequiredVersion) ? `${HOST_REACT_SHARE_SCOPE}-${React.version}` : remoteShareScope;
|
|
31
45
|
return args;
|
|
32
46
|
}
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
id: args.id
|
|
36
|
-
});
|
|
37
|
-
const manifest = args.origin.snapshotHandler.manifestCache.get(remote.entry);
|
|
38
|
-
const remoteShareScope = manifest === null || manifest === void 0 || (_manifest$metaData = manifest.metaData) === null || _manifest$metaData === void 0 ? void 0 : _manifest$metaData.reactShareScope;
|
|
39
|
-
const reactRequiredVersion = manifest === null || manifest === void 0 || (_manifest$shared$find = manifest.shared.find(shared => shared.name === 'react')) === null || _manifest$shared$find === void 0 ? void 0 : _manifest$shared$find.requiredVersion;
|
|
40
|
-
remote.shareScope = !remoteShareScope ? LEGACY_SHARE_SCOPE : reactRequiredVersion && satisfy(React.version, reactRequiredVersion) ? `${HOST_REACT_SHARE_SCOPE}-${React.version}` : remoteShareScope;
|
|
41
|
-
return args;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
47
|
+
};
|
|
48
|
+
};
|