@shijiu/jsview 2.1.363-test.0 → 2.1.365-test.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/package.json
CHANGED
|
@@ -110,14 +110,16 @@ function getHostConfig()
|
|
|
110
110
|
}
|
|
111
111
|
|
|
112
112
|
content += `
|
|
113
|
-
shared:
|
|
114
|
-
if(options.jsviewMode == '
|
|
113
|
+
shared: {`;
|
|
114
|
+
if(options.jsviewMode == 'shared') {
|
|
115
115
|
content += `
|
|
116
|
-
'jsview'
|
|
116
|
+
'@shijiu/jsview-vue': {},
|
|
117
|
+
jsview: { packagePath: '@shijiu/jsview-vue' },`;
|
|
117
118
|
}
|
|
118
119
|
content += `
|
|
119
|
-
|
|
120
|
-
|
|
120
|
+
vue: {},
|
|
121
|
+
'vue-router': {},
|
|
122
|
+
},
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
return config
|
|
@@ -150,22 +152,23 @@ function genFederationConfigFunction(options)
|
|
|
150
152
|
var content = '';
|
|
151
153
|
if(options.mode == 'remote') {
|
|
152
154
|
content += `
|
|
153
|
-
function setFederationRemoteConfig(config) {`;
|
|
155
|
+
function setFederationRemoteConfig(config, federation) {`;
|
|
154
156
|
} else if(options.mode == 'host') {
|
|
155
157
|
content += `
|
|
156
|
-
function setFederationHostConfig(config) {`;
|
|
158
|
+
function setFederationHostConfig(config, federation) {`;
|
|
157
159
|
}
|
|
158
160
|
|
|
159
|
-
|
|
160
|
-
if(options.jsviewMode == 'expose') {
|
|
161
|
-
content += `
|
|
161
|
+
content += `
|
|
162
162
|
config.build = (config.build || {})
|
|
163
163
|
config.build.rollupOptions = (config.build.rollupOptions || {})
|
|
164
164
|
config.build.rollupOptions.output = (config.build.rollupOptions.output || {})
|
|
165
165
|
config.build.rollupOptions.output.manualChunks = (config.build.rollupOptions.output.manualChunks || {})
|
|
166
|
-
|
|
167
|
-
config.build.rollupOptions.output.chunkFileNames = getChunkFileName
|
|
168
166
|
config.build.rollupOptions.output.manualChunks["__federation_fn_import"] = ["__federation_fn_import"]`;
|
|
167
|
+
|
|
168
|
+
if(options.mode == 'remote') {
|
|
169
|
+
if(options.jsviewMode == 'expose') {
|
|
170
|
+
content += `
|
|
171
|
+
config.build.rollupOptions.output.chunkFileNames = getChunkFileName`;
|
|
169
172
|
}
|
|
170
173
|
}
|
|
171
174
|
|
|
@@ -217,8 +220,7 @@ function createFederationHostConfigFile(options)
|
|
|
217
220
|
const federationConfigName = 'federation.host.config.ts';
|
|
218
221
|
Logger.Info('Creating ' + federationConfigName + ' ...');
|
|
219
222
|
|
|
220
|
-
var federationConfigContent =
|
|
221
|
-
import federation from '@originjs/vite-plugin-federation'`;
|
|
223
|
+
var federationConfigContent = '';
|
|
222
224
|
|
|
223
225
|
federationConfigContent += '\n';
|
|
224
226
|
federationConfigContent += genFederationUrl(options);
|
|
@@ -309,7 +311,7 @@ function updateTsConfigFile(options)
|
|
|
309
311
|
if(regex.test(tsConfigContent) == false) {
|
|
310
312
|
tsConfigContent = tsConfigContent.replace(/"jsview"/, '"RemoteEntry/JsViewVue": [ "./node_modules/@shijiu/jsview-vue" ],\n $&');
|
|
311
313
|
}
|
|
312
|
-
fs.writeFileSync(
|
|
314
|
+
fs.writeFileSync(tsConfigPath, tsConfigContent, 'utf-8');
|
|
313
315
|
}
|
|
314
316
|
}
|
|
315
317
|
}
|
|
@@ -345,8 +347,8 @@ async function main(argv)
|
|
|
345
347
|
}
|
|
346
348
|
options.mode = argv.mode;
|
|
347
349
|
|
|
348
|
-
if(argv.jsview != '
|
|
349
|
-
Logger.ErrorAndExit('Invalid --jsview, its value can only be "
|
|
350
|
+
if(argv.jsview != 'shared' && argv.jsview != 'expose') {
|
|
351
|
+
Logger.ErrorAndExit('Invalid --jsview, its value can only be "shared" or "expose".');
|
|
350
352
|
}
|
|
351
353
|
options.jsviewMode = argv.jsview;
|
|
352
354
|
|
|
@@ -377,7 +379,7 @@ async function main(argv)
|
|
|
377
379
|
|
|
378
380
|
const requiredUsages = {
|
|
379
381
|
'--mode': 'Project mode. the value is "remote" or "host"',
|
|
380
|
-
'--jsview': 'jsview mode. the value is "
|
|
382
|
+
'--jsview': 'jsview mode. the value is "shared" or "expose"',
|
|
381
383
|
};
|
|
382
384
|
const optionalUsages = {
|
|
383
385
|
'--remote-domain': 'remote domain. Host use this domain to access remote module.',
|