@module-federation/sdk 0.0.0-next-20231220075820 → 0.0.0-next-20231220085130
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/LICENSE +21 -0
- package/dist/index.cjs.d.ts +1 -0
- package/dist/index.cjs.js +793 -0
- package/dist/index.esm.js +761 -0
- package/dist/normalize-webpack-path.cjs.d.ts +1 -0
- package/dist/normalize-webpack-path.cjs.js +42 -0
- package/dist/normalize-webpack-path.esm.js +33 -0
- package/dist/package.json +44 -0
- package/dist/src/constant.d.ts +16 -0
- package/dist/src/dom.d.ts +10 -0
- package/dist/src/env.d.ts +7 -0
- package/dist/src/generateSnapshotFromManifest.d.ts +10 -0
- package/{src/index.ts → dist/src/index.d.ts} +1 -4
- package/dist/src/logger.d.ts +8 -0
- package/dist/src/normalize-webpack-path.d.ts +3 -0
- package/{src/types/common.ts → dist/src/types/common.d.ts} +4 -12
- package/dist/src/types/manifest.d.ts +26 -0
- package/dist/src/types/snapshot.d.ts +62 -0
- package/dist/src/types/stats.d.ts +79 -0
- package/dist/src/utils.d.ts +17 -0
- package/package.json +5 -1
- package/CHANGELOG.md +0 -2190
- package/__tests__/decodeName.spec.ts +0 -11
- package/__tests__/encodeName.spec.ts +0 -10
- package/__tests__/generateSnapshotFromManifest.spec.ts +0 -147
- package/__tests__/parseEntry.spec.ts +0 -36
- package/__tests__/resources/constant.ts +0 -6
- package/__tests__/resources/getId.ts +0 -5
- package/__tests__/resources/manifestSnapshotMap.ts +0 -1541
- package/__tests__/simpleJoinRemoteEntry.spec.ts +0 -53
- package/jest.config.js +0 -27
- package/project.json +0 -65
- package/rollup.config.js +0 -11
- package/src/constant.ts +0 -24
- package/src/dom.ts +0 -115
- package/src/env.ts +0 -25
- package/src/generateSnapshotFromManifest.ts +0 -176
- package/src/logger.ts +0 -59
- package/src/normalize-webpack-path.ts +0 -33
- package/src/types/manifest.ts +0 -44
- package/src/types/snapshot.ts +0 -87
- package/src/types/stats.ts +0 -101
- package/src/utils.ts +0 -213
- package/tsconfig.json +0 -29
- package/tsconfig.lib.json +0 -10
- package/tsconfig.spec.json +0 -14
- /package/{src/types/index.ts → dist/src/types/index.d.ts} +0 -0
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { nameMap } from './resources/constant';
|
|
2
|
-
import { decodeName } from '../src';
|
|
3
|
-
|
|
4
|
-
describe('decodeName', () => {
|
|
5
|
-
it('should correct decode transformed name', () => {
|
|
6
|
-
Object.keys(nameMap).forEach((name) => {
|
|
7
|
-
const transformedName = nameMap[name];
|
|
8
|
-
expect(decodeName(transformedName)).toBe(name);
|
|
9
|
-
});
|
|
10
|
-
});
|
|
11
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { nameMap } from './resources/constant';
|
|
2
|
-
import { encodeName } from '../src';
|
|
3
|
-
|
|
4
|
-
describe('encodeName', () => {
|
|
5
|
-
it('should correct transform name', () => {
|
|
6
|
-
Object.keys(nameMap).forEach((name) => {
|
|
7
|
-
expect(encodeName(name)).toBe(nameMap[name]);
|
|
8
|
-
});
|
|
9
|
-
});
|
|
10
|
-
});
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
import { manifest, snapshot } from './resources/manifestSnapshotMap';
|
|
2
|
-
import { generateSnapshotFromManifest } from '../src/generateSnapshotFromManifest';
|
|
3
|
-
|
|
4
|
-
describe('generateSnapshotFromManifest', () => {
|
|
5
|
-
it('return basic app snapshot with only manifest params in dev', () => {
|
|
6
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
7
|
-
manifest.devAppManifest,
|
|
8
|
-
);
|
|
9
|
-
expect(remoteSnapshot).toEqual(snapshot.devAppSnapshot);
|
|
10
|
-
});
|
|
11
|
-
|
|
12
|
-
it('return modulePath while expose.path existed', () => {
|
|
13
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
14
|
-
manifest.devAppManifest,
|
|
15
|
-
);
|
|
16
|
-
expect(remoteSnapshot).toEqual(snapshot.devAppSnapshot);
|
|
17
|
-
manifest.devAppManifest.exposes.forEach((expose) => {
|
|
18
|
-
if (expose.path) {
|
|
19
|
-
expect(
|
|
20
|
-
Boolean(
|
|
21
|
-
remoteSnapshot.modules.find((m) => m.modulePath === expose.path),
|
|
22
|
-
),
|
|
23
|
-
).toEqual(true);
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('return basic app snapshot with manifest params and version in dev', () => {
|
|
29
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
30
|
-
manifest.devAppManifest,
|
|
31
|
-
{ version: 'http://localhost:2006/vmok-manifest.json' },
|
|
32
|
-
);
|
|
33
|
-
expect(remoteSnapshot).toEqual(snapshot.devAppSnapshotWithVersion);
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
it('return basic app snapshot with only manifest params in dev with getPublicPath', () => {
|
|
37
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
38
|
-
manifest.devAppManifestWithGetPublicPath,
|
|
39
|
-
);
|
|
40
|
-
expect(remoteSnapshot).toEqual(snapshot.devAppSnapshotWithGetPublicPath);
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
it('return app snapshot with manifest params in dev with overrides', () => {
|
|
44
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
45
|
-
manifest.devAppManifest,
|
|
46
|
-
{
|
|
47
|
-
overrides: {
|
|
48
|
-
'@garfish/micro-app-sub4': 'http://localhost:8080/vmok-manifest.json',
|
|
49
|
-
'@garfish/micro-app-sub3': '1.0.3',
|
|
50
|
-
},
|
|
51
|
-
},
|
|
52
|
-
);
|
|
53
|
-
expect(remoteSnapshot).toEqual(snapshot.devAppSnapshotWithOverrides);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
it('return app snapshot with manifest params in dev with part remotes', () => {
|
|
57
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
58
|
-
manifest.devAppManifest,
|
|
59
|
-
{
|
|
60
|
-
remotes: {
|
|
61
|
-
'@garfish/micro-app-sub3': '1.0.3',
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
);
|
|
65
|
-
expect(remoteSnapshot).toEqual(snapshot.devAppSnapshotWithPartRemotes);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('return app snapshot with manifest params in dev with remotes', () => {
|
|
69
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
70
|
-
manifest.devAppManifest,
|
|
71
|
-
{
|
|
72
|
-
remotes: {
|
|
73
|
-
'@garfish/micro-app-sub4': '1.2.3',
|
|
74
|
-
'@garfish/micro-app-sub3': '1.0.3',
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
);
|
|
78
|
-
expect(remoteSnapshot).toEqual(snapshot.devAppSnapshotWithRemotes);
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
it('return app snapshot with manifest params in dev with remotes and overrides', () => {
|
|
82
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
83
|
-
manifest.devAppManifest,
|
|
84
|
-
{
|
|
85
|
-
remotes: {
|
|
86
|
-
'@garfish/micro-app-sub4': '1.2.3',
|
|
87
|
-
'@garfish/micro-app-sub3': '1.0.3',
|
|
88
|
-
},
|
|
89
|
-
overrides: {
|
|
90
|
-
'@garfish/micro-app-sub4': 'http://localhost:8080/vmok-manifest.json',
|
|
91
|
-
'@garfish/micro-app-sub3': '1.0.4',
|
|
92
|
-
},
|
|
93
|
-
},
|
|
94
|
-
);
|
|
95
|
-
expect(remoteSnapshot).toEqual(
|
|
96
|
-
snapshot.devAppSnapshotWithRemotesAndOverrides,
|
|
97
|
-
);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('return app snapshot with manifest params in dev with all params', () => {
|
|
101
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
102
|
-
manifest.devAppManifest,
|
|
103
|
-
{
|
|
104
|
-
remotes: {
|
|
105
|
-
'@garfish/micro-app-sub4': '1.2.3',
|
|
106
|
-
'@garfish/micro-app-sub3': '1.0.3',
|
|
107
|
-
},
|
|
108
|
-
overrides: {
|
|
109
|
-
'@garfish/micro-app-sub4': 'http://localhost:8080/vmok-manifest.json',
|
|
110
|
-
'@garfish/micro-app-sub3': '1.0.4',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
);
|
|
114
|
-
expect(remoteSnapshot).toEqual(snapshot.devAppSnapshotWithAllParams);
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
it('return basic app snapshot with only manifest params in prod', () => {
|
|
118
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
119
|
-
manifest.prodAppManifest,
|
|
120
|
-
);
|
|
121
|
-
expect(remoteSnapshot).toEqual(snapshot.prodAppSnapshot);
|
|
122
|
-
});
|
|
123
|
-
|
|
124
|
-
it('return basic app snapshot with only manifest params in prod with getPublicPath', () => {
|
|
125
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
126
|
-
manifest.prodAppManifestWithGetPublicPath,
|
|
127
|
-
);
|
|
128
|
-
expect(remoteSnapshot).toEqual(snapshot.prodAppSnapshotWithGetPublicPath);
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
it('return app snapshot with manifest params in prod with all params', () => {
|
|
132
|
-
const remoteSnapshot = generateSnapshotFromManifest(
|
|
133
|
-
manifest.prodAppManifest,
|
|
134
|
-
{
|
|
135
|
-
remotes: {
|
|
136
|
-
'@garfish/micro-app-sub4': '1.2.3',
|
|
137
|
-
'@garfish/micro-app-sub3': '1.0.3',
|
|
138
|
-
},
|
|
139
|
-
overrides: {
|
|
140
|
-
'@garfish/micro-app-sub4': 'http://localhost:8080/vmok-manifest.json',
|
|
141
|
-
'@garfish/micro-app-sub3': '1.0.4',
|
|
142
|
-
},
|
|
143
|
-
},
|
|
144
|
-
);
|
|
145
|
-
expect(remoteSnapshot).toEqual(snapshot.prodAppSnapshotWithAllParams);
|
|
146
|
-
});
|
|
147
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { parseEntry } from '../src';
|
|
2
|
-
|
|
3
|
-
describe('parseEntry', () => {
|
|
4
|
-
it('get correct entryInfo by parsing normal entry', () => {
|
|
5
|
-
const entry = '@byted/app1:1.2.0';
|
|
6
|
-
|
|
7
|
-
const entryInfo = parseEntry(entry);
|
|
8
|
-
|
|
9
|
-
expect(entryInfo).toMatchObject({
|
|
10
|
-
version: '1.2.0',
|
|
11
|
-
name: '@byted/app1',
|
|
12
|
-
});
|
|
13
|
-
});
|
|
14
|
-
|
|
15
|
-
it('get correct entryInfo by parsing none version entry', () => {
|
|
16
|
-
const entry = '@byted/app1';
|
|
17
|
-
|
|
18
|
-
const entryInfo = parseEntry(entry);
|
|
19
|
-
|
|
20
|
-
expect(entryInfo).toMatchObject({
|
|
21
|
-
version: '*',
|
|
22
|
-
name: '@byted/app1',
|
|
23
|
-
});
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
it('get correct entryInfo by parsing local version entry', () => {
|
|
27
|
-
const entry = '@byted/app1:http://localhost:8080/vmok-manifest.json';
|
|
28
|
-
|
|
29
|
-
const entryInfo = parseEntry(entry);
|
|
30
|
-
|
|
31
|
-
expect(entryInfo).toMatchObject({
|
|
32
|
-
name: '@byted/app1',
|
|
33
|
-
entry: 'http://localhost:8080/vmok-manifest.json',
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
});
|