@omnia/tooling-vue 8.0.95-vnext → 8.0.96-dev
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/internal-do-not-import-from-here/config/omnia.fx.core_a2892051-fd9f-4056-ae8d-30d16d48417d.manifest.json +1 -0
- package/internal-do-not-import-from-here/config/omnia.fx.ux_dee030cc-4ab3-4158-bb06-8049f5c67542.manifest.json +1 -0
- package/internal-do-not-import-from-here/config/omnia.fx_a5a89056-b5f5-475d-8518-a1f55090379d.manifest.json +1 -0
- package/internal-do-not-import-from-here/config/omnia.vendor.manifest.json +1 -1
- package/internal-do-not-import-from-here/config/tooling.output.json +1 -1
- package/internal-do-not-import-from-here/config/wctypings.d.ts +4429 -1518
- package/internal-do-not-import-from-here/shared.d.ts +11 -6
- package/internal-do-not-import-from-here/shared.js +32 -12
- package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +1 -1
- package/internal-do-not-import-from-here/tasks/bundle.js +119 -399
- package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
- package/internal-do-not-import-from-here/tasks/doc.js +393 -392
- package/internal-do-not-import-from-here/tasks/vendor.js +18 -12
- package/internal-do-not-import-from-here/vite/hmr/graph.js +3 -1
- package/internal-do-not-import-from-here/vite/hmr/vueJsx.js +21 -1
- package/internal-do-not-import-from-here/vite/index.js +1 -1
- package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +1 -1
- package/internal-do-not-import-from-here/webpack-loaders/doc-loader.d.ts +1 -0
- package/internal-do-not-import-from-here/webpack-loaders/doc-loader.js +11 -0
- package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.d.ts +1 -0
- package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +10 -0
- package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +5 -2
- package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +8 -0
- package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +3 -3
- package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +3 -0
- package/internal-do-not-import-from-here/webpack-loaders/wc-loader.d.ts +1 -1
- package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +5 -1
- package/package.json +10 -9
|
@@ -14,7 +14,8 @@ const fx_models_1 = require("@omnia/fx-models");
|
|
|
14
14
|
const $ = tslib_1.__importStar(require("../variables"));
|
|
15
15
|
const shared_1 = require("../shared");
|
|
16
16
|
const tooling_1 = require("@omnia/tooling");
|
|
17
|
-
const
|
|
17
|
+
const doc_1 = require("./doc");
|
|
18
|
+
const webpack_plugin_1 = tslib_1.__importDefault(require("@stylexjs/webpack-plugin"));
|
|
18
19
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
19
20
|
const ConcatSource = require('webpack-core/lib/ConcatSource');
|
|
20
21
|
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
@@ -40,19 +41,24 @@ $.tooling.core.registerBuildTask({
|
|
|
40
41
|
return new Promise(function (resolve, reject) {
|
|
41
42
|
buildEntries()
|
|
42
43
|
.then((result) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
44
|
+
if (process.argv.length > 0 && process.argv.find(argv => argv === "--package") !== undefined) {
|
|
45
|
+
resolve(result);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
let startTime = new Date().getTime();
|
|
49
|
+
tooling_1.utils.log("Typescript checking...");
|
|
50
|
+
const spawn = require("child_process").spawn;
|
|
51
|
+
spawn("node", [path_1.default.resolve(__dirname, "./tsc.js")], { stdio: "inherit", })
|
|
52
|
+
.on('exit', (code) => {
|
|
53
|
+
if (code == 0) {
|
|
54
|
+
tooling_1.utils.logTime('Done - Typescript', startTime);
|
|
55
|
+
resolve(result);
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
process.exit(code);
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
56
62
|
}, reject);
|
|
57
63
|
});
|
|
58
64
|
}
|
|
@@ -197,11 +203,12 @@ function buildEntries(serve = false) {
|
|
|
197
203
|
var componentRegistry = $.composers.ComponentRegistry;
|
|
198
204
|
let componentRegistrations = componentRegistry.getRegistrations();
|
|
199
205
|
const serviceInfo = $.composers.ServiceManifestRegistry.getServiceInfo();
|
|
200
|
-
if (serviceInfo.serviceType === tooling_composers_1.ServiceTypes.WebApp) {
|
|
201
|
-
await generateComponentTypingsAndDoc(componentRegistrations);
|
|
202
|
-
}
|
|
203
206
|
startTime = new Date().getTime();
|
|
204
207
|
$.tooling.logTime("Found [" + componentRegistrations.length + "] component registrations", startTime);
|
|
208
|
+
let componentEntries = createVueEntryFormComponentRegistrations(componentRegistrations);
|
|
209
|
+
if (serviceInfo.serviceType === tooling_composers_1.ServiceTypes.WebApp) {
|
|
210
|
+
await (0, doc_1.generateComponentTypingsAndDoc)(componentRegistrations);
|
|
211
|
+
}
|
|
205
212
|
var resourceRegistry = $.composers.ResourceRegistry;
|
|
206
213
|
let resourceBundlesWithBuildOptions = resourceRegistry.getRegisteredResourceBundles(shared_1.convertManifestPathToEntryPath);
|
|
207
214
|
$.tooling.logTime("Found [" + resourceBundlesWithBuildOptions?.size + "] resource bundles", startTime);
|
|
@@ -217,7 +224,6 @@ function buildEntries(serve = false) {
|
|
|
217
224
|
console.log("debug " + res[0] + " has build options for paths " + resource.paths + " buildoptions: " + JSON.stringify(resource.buildOptions));
|
|
218
225
|
}
|
|
219
226
|
}
|
|
220
|
-
let componentEntries = createVueEntryFormRegistrations(componentRegistrations);
|
|
221
227
|
var entries = $.merge(componentEntries, resourceEntries);
|
|
222
228
|
if (checkDuplicateWebpackEntryPoints(entries)) {
|
|
223
229
|
$.tooling.log('Build manifests metadata have error that found duplicated resource path', $.tooling.LogTypes.Error);
|
|
@@ -252,248 +258,7 @@ function buildEntries(serve = false) {
|
|
|
252
258
|
}
|
|
253
259
|
});
|
|
254
260
|
}
|
|
255
|
-
|
|
256
|
-
tooling_1.utils.log("Generate components typings and documentation running...");
|
|
257
|
-
var startTime = new Date().getTime();
|
|
258
|
-
let DefineVueType;
|
|
259
|
-
(function (DefineVueType) {
|
|
260
|
-
DefineVueType[DefineVueType["Prop"] = 0] = "Prop";
|
|
261
|
-
DefineVueType[DefineVueType["Model"] = 1] = "Model";
|
|
262
|
-
DefineVueType[DefineVueType["Slot"] = 2] = "Slot";
|
|
263
|
-
DefineVueType[DefineVueType["Emit"] = 4] = "Emit";
|
|
264
|
-
})(DefineVueType || (DefineVueType = {}));
|
|
265
|
-
const docResult = {};
|
|
266
|
-
function getPropertyFunctionTypeAsString(type) {
|
|
267
|
-
let params = "";
|
|
268
|
-
if (type.params?.length > 0) {
|
|
269
|
-
type.params.forEach(p => {
|
|
270
|
-
params += `${p.value}:${getPropertyType(p.typeAnnotation)}, `;
|
|
271
|
-
});
|
|
272
|
-
params = params.replace(/,\s*$/, "");
|
|
273
|
-
}
|
|
274
|
-
return `(${params}) => ${getPropertyType(type.typeAnnotation)}`;
|
|
275
|
-
}
|
|
276
|
-
function getPropertyType(tsType) {
|
|
277
|
-
let result = "";
|
|
278
|
-
if (tsType.type === "TsTypeAnnotation") {
|
|
279
|
-
return getPropertyType(tsType.typeAnnotation);
|
|
280
|
-
}
|
|
281
|
-
switch (tsType.type) {
|
|
282
|
-
case "TsLiteralType":
|
|
283
|
-
result = tsType.literal.value;
|
|
284
|
-
break;
|
|
285
|
-
case "TsKeywordType":
|
|
286
|
-
result = tsType.kind;
|
|
287
|
-
break;
|
|
288
|
-
case "TsTypeReference":
|
|
289
|
-
result = tsType.typeName.value;
|
|
290
|
-
break;
|
|
291
|
-
case "TsFunctionType":
|
|
292
|
-
result = getPropertyFunctionTypeAsString(tsType);
|
|
293
|
-
break;
|
|
294
|
-
default:
|
|
295
|
-
break;
|
|
296
|
-
}
|
|
297
|
-
return result;
|
|
298
|
-
}
|
|
299
|
-
function getNameProperty(ce, result) {
|
|
300
|
-
const identifier = ce.callee?.property?.value;
|
|
301
|
-
if (identifier) {
|
|
302
|
-
switch (identifier) {
|
|
303
|
-
case "name":
|
|
304
|
-
result.name = ce.arguments[0].expression.value;
|
|
305
|
-
getNameProperty(ce.callee.object, result);
|
|
306
|
-
break;
|
|
307
|
-
case "vModel":
|
|
308
|
-
result.type = DefineVueType.Model;
|
|
309
|
-
result.propertyTypeAsString = getPropertyType(ce.typeArguments.params[0]);
|
|
310
|
-
result.name = result.name ? `v-model:${result.name}` : result.name;
|
|
311
|
-
break;
|
|
312
|
-
case "slots":
|
|
313
|
-
result.type = DefineVueType.Slot;
|
|
314
|
-
result.propertyTypeAsObject = {};
|
|
315
|
-
ce.typeArguments.params[0].members
|
|
316
|
-
.forEach(m => {
|
|
317
|
-
result.propertyTypeAsObject[m.key.value] = getPropertyType(m.typeAnnotation);
|
|
318
|
-
});
|
|
319
|
-
break;
|
|
320
|
-
case "prop":
|
|
321
|
-
result.type = DefineVueType.Prop;
|
|
322
|
-
result.propertyTypeAsString = getPropertyType(ce.typeArguments.params[0]);
|
|
323
|
-
break;
|
|
324
|
-
case "emit":
|
|
325
|
-
result.type = DefineVueType.Emit;
|
|
326
|
-
result.propertyTypeAsString = getPropertyType(ce.typeArguments.params[0]);
|
|
327
|
-
break;
|
|
328
|
-
default:
|
|
329
|
-
getNameProperty(ce.callee.object, result);
|
|
330
|
-
}
|
|
331
|
-
}
|
|
332
|
-
}
|
|
333
|
-
async function buildDoc(wc) {
|
|
334
|
-
try {
|
|
335
|
-
const wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
|
|
336
|
-
const wcParseResult = await (0, core_1.parseFile)(wcPath, {
|
|
337
|
-
syntax: 'typescript',
|
|
338
|
-
target: 'es2020',
|
|
339
|
-
tsx: true,
|
|
340
|
-
decorators: true,
|
|
341
|
-
dynamicImport: true
|
|
342
|
-
});
|
|
343
|
-
wcParseResult.body.forEach(b => {
|
|
344
|
-
if (b.type === 'ExportDefaultExpression'
|
|
345
|
-
&& b.expression.callee?.value === "defineVueWebComponent") {
|
|
346
|
-
b.expression.arguments[0].expression
|
|
347
|
-
.properties?.filter(p => p.key.value === "props"
|
|
348
|
-
|| p.key.value === "emits")
|
|
349
|
-
?.forEach(propsIdentifier => {
|
|
350
|
-
if (propsIdentifier) {
|
|
351
|
-
propsIdentifier.value
|
|
352
|
-
.properties?.forEach(p => {
|
|
353
|
-
const em = p.arguments;
|
|
354
|
-
if (em?.callee?.property?.value === "doc$") {
|
|
355
|
-
const PropertyResult = {
|
|
356
|
-
type: null,
|
|
357
|
-
propertyTypeAsString: "",
|
|
358
|
-
name: ""
|
|
359
|
-
};
|
|
360
|
-
getNameProperty(em, PropertyResult);
|
|
361
|
-
if (!docResult[wc.componentOptions.elementName]) {
|
|
362
|
-
docResult[wc.componentOptions.elementName] = {
|
|
363
|
-
emits: {},
|
|
364
|
-
models: {},
|
|
365
|
-
props: {},
|
|
366
|
-
slots: {}
|
|
367
|
-
};
|
|
368
|
-
}
|
|
369
|
-
switch (PropertyResult.type) {
|
|
370
|
-
case DefineVueType.Prop:
|
|
371
|
-
docResult[wc.componentOptions.elementName].props[PropertyResult.name] = {
|
|
372
|
-
type: PropertyResult.propertyTypeAsString,
|
|
373
|
-
description: em.arguments[0].expression.value
|
|
374
|
-
};
|
|
375
|
-
break;
|
|
376
|
-
case DefineVueType.Model:
|
|
377
|
-
docResult[wc.componentOptions.elementName].models[PropertyResult.name] = {
|
|
378
|
-
type: PropertyResult.propertyTypeAsString,
|
|
379
|
-
description: em.arguments[0].expression.value
|
|
380
|
-
};
|
|
381
|
-
break;
|
|
382
|
-
case DefineVueType.Emit:
|
|
383
|
-
docResult[wc.componentOptions.elementName].emits[PropertyResult.name] = {
|
|
384
|
-
type: PropertyResult.propertyTypeAsString,
|
|
385
|
-
description: em.arguments[0].expression.value
|
|
386
|
-
};
|
|
387
|
-
break;
|
|
388
|
-
case DefineVueType.Slot:
|
|
389
|
-
em.arguments[0].expression
|
|
390
|
-
.properties
|
|
391
|
-
.forEach(p => {
|
|
392
|
-
const slotName = p.key.value;
|
|
393
|
-
docResult[wc.componentOptions.elementName].slots[slotName] = {
|
|
394
|
-
type: PropertyResult.propertyTypeAsObject[slotName],
|
|
395
|
-
description: p.value.value
|
|
396
|
-
};
|
|
397
|
-
});
|
|
398
|
-
break;
|
|
399
|
-
default:
|
|
400
|
-
break;
|
|
401
|
-
}
|
|
402
|
-
}
|
|
403
|
-
});
|
|
404
|
-
}
|
|
405
|
-
});
|
|
406
|
-
}
|
|
407
|
-
});
|
|
408
|
-
}
|
|
409
|
-
catch (ex) {
|
|
410
|
-
tooling_1.utils.log(`Have a exception when extract doc$ for web component manifest -> ${wc.manifestPath}`, tooling_1.utils.LogTypes.Error);
|
|
411
|
-
console.error(ex);
|
|
412
|
-
throw new Error("Exit, have an exception.");
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
let docPath = $.path.resolve(__dirname, "ComponentDocRegistrations.ts");
|
|
416
|
-
;
|
|
417
|
-
const wcNamespace = getBuildOption()?.webComponentNamespace;
|
|
418
|
-
const info = shared_1.ConfigurationManager.outputInfo.get();
|
|
419
|
-
info.wc = {
|
|
420
|
-
namespace: wcNamespace,
|
|
421
|
-
mappings: {}
|
|
422
|
-
};
|
|
423
|
-
let wcTypings = wcNamespace ? `
|
|
424
|
-
//{{importWC}}
|
|
425
|
-
declare global {
|
|
426
|
-
namespace JSX {
|
|
427
|
-
interface Element { }
|
|
428
|
-
interface ElementClass { }
|
|
429
|
-
|
|
430
|
-
interface IntrinsicElements {
|
|
431
|
-
//{{elementName}}
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
declare global {
|
|
437
|
-
let ${wcNamespace}: {
|
|
438
|
-
//{{nselementName}}
|
|
439
|
-
};
|
|
440
|
-
}
|
|
441
|
-
`
|
|
442
|
-
: `
|
|
443
|
-
//{{importWC}}
|
|
444
|
-
declare global {
|
|
445
|
-
namespace JSX {
|
|
446
|
-
interface Element { }
|
|
447
|
-
interface ElementClass { }
|
|
448
|
-
|
|
449
|
-
interface IntrinsicElements {
|
|
450
|
-
//{{elementName}}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
}`;
|
|
454
|
-
if ($.isExtensionEnv) {
|
|
455
|
-
wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
|
|
456
|
-
${wcTypings}`;
|
|
457
|
-
}
|
|
458
|
-
else {
|
|
459
|
-
wcTypings = `import { VueComponentBaseProps } from "../../../../client/fx/ux/index";
|
|
460
|
-
${wcTypings}`;
|
|
461
|
-
}
|
|
462
|
-
await tooling_1.utils.asyncForEach(componentRegistrations, async (wc) => {
|
|
463
|
-
wcTypings = generateWebComponentTypings(wc, wcTypings, info);
|
|
464
|
-
await buildDoc(wc);
|
|
465
|
-
});
|
|
466
|
-
if (Object.keys(docResult).length > 0) {
|
|
467
|
-
fsExtra.outputFileSync(docPath, `
|
|
468
|
-
import { extendApi } from "@omnia/fx";
|
|
469
|
-
import { ComponentDoc } from "@omnia/fx-models";
|
|
470
|
-
|
|
471
|
-
extendApi(api => api.fx.docs.registrations, api => {
|
|
472
|
-
|
|
473
|
-
const registrations: { [elementName: string]: ComponentDoc } = ${JSON.stringify(docResult)}
|
|
474
|
-
|
|
475
|
-
Object.keys(registrations).forEach(elementName => {
|
|
476
|
-
api.register(elementName, registrations[elementName]);
|
|
477
|
-
});
|
|
478
|
-
});
|
|
479
|
-
`);
|
|
480
|
-
// create dynamic doc manifest
|
|
481
|
-
$.composers.ManifestRegistry.setCurrentManifestPath(`${path_1.default.relative(tooling_1.utils.root(""), path_1.default.resolve(__dirname))}/`);
|
|
482
|
-
$.composers
|
|
483
|
-
.Composer
|
|
484
|
-
.registerManifest(getBuildOption().docResourceManifestId || new fx_models_1.Guid(`${tooling_1.utils.generateGuid()}`), "omnia.fx.docs.components.registraions")
|
|
485
|
-
.registerResources({
|
|
486
|
-
resourcePaths: ["./ComponentDocRegistrations.ts"]
|
|
487
|
-
})
|
|
488
|
-
.withTarget(fx_models_1.ClientManifestTargetTypes.Docs)
|
|
489
|
-
.extendApi(api => api.fx.docs.registrations);
|
|
490
|
-
$.composers.ManifestRegistry.setCurrentManifestPath();
|
|
491
|
-
}
|
|
492
|
-
shared_1.ConfigurationManager.webComponentTypings.update(wcTypings);
|
|
493
|
-
shared_1.ConfigurationManager.outputInfo.update(info);
|
|
494
|
-
tooling_1.utils.logTime('Done - Generate components typings and documentation', startTime);
|
|
495
|
-
}
|
|
496
|
-
function buildManifestMetadatas(entries) {
|
|
261
|
+
function buildManifestMetadata(entries) {
|
|
497
262
|
return new Promise(function (resolve, reject) {
|
|
498
263
|
try {
|
|
499
264
|
var startTime = new Date().getTime();
|
|
@@ -580,7 +345,7 @@ function beforeBundleManifest(entries) {
|
|
|
580
345
|
// isRunBuildMetadata = !isEqual(entries, cachedEntries);
|
|
581
346
|
// }
|
|
582
347
|
// }
|
|
583
|
-
if ($.fs.existsSync(cachedEntriesPath)) {
|
|
348
|
+
if (!isBuildWebpackManifestOnly() && $.fs.existsSync(cachedEntriesPath)) {
|
|
584
349
|
let cachedEntries = require(cachedEntriesPath);
|
|
585
350
|
isRunBuildMetadata = !isEqual(entries, cachedEntries);
|
|
586
351
|
}
|
|
@@ -612,9 +377,14 @@ function beforeBundleManifest(entries) {
|
|
|
612
377
|
fsExtra.writeJsonSync(manifestPath, content);
|
|
613
378
|
}
|
|
614
379
|
});
|
|
615
|
-
|
|
380
|
+
buildManifestMetadata(entriesToBuild).then(() => {
|
|
616
381
|
fsExtra.ensureFileSync(cachedEntriesPath);
|
|
617
382
|
fsExtra.writeJsonSync(cachedEntriesPath, entries);
|
|
383
|
+
if (isBuildWebpackManifestOnly()) {
|
|
384
|
+
fsExtra.copyFileSync(`${outDirManifestMetadata}/omnia.fx.core_a2892051-fd9f-4056-ae8d-30d16d48417d.manifest.json`, "client/tooling/vue/config/omnia.fx.core_a2892051-fd9f-4056-ae8d-30d16d48417d.manifest.json");
|
|
385
|
+
fsExtra.copyFileSync(`${outDirManifestMetadata}/omnia.fx_a5a89056-b5f5-475d-8518-a1f55090379d.manifest.json`, "client/tooling/vue/config/omnia.fx_a5a89056-b5f5-475d-8518-a1f55090379d.manifest.json");
|
|
386
|
+
fsExtra.copyFileSync(`${outDirManifestMetadata}/omnia.fx.ux_dee030cc-4ab3-4158-bb06-8049f5c67542.manifest.json`, "client/tooling/vue/config/omnia.fx.ux_dee030cc-4ab3-4158-bb06-8049f5c67542.manifest.json");
|
|
387
|
+
}
|
|
618
388
|
resolve(entries);
|
|
619
389
|
});
|
|
620
390
|
}
|
|
@@ -754,12 +524,15 @@ function afterGenerateManifestsMetadata() {
|
|
|
754
524
|
.then(resolve, reject);
|
|
755
525
|
});
|
|
756
526
|
}
|
|
527
|
+
function isBuildWebpackManifestOnly() {
|
|
528
|
+
return process.argv?.find(argv => argv === "--webpackManifest") !== undefined;
|
|
529
|
+
}
|
|
757
530
|
function minifyBundles() {
|
|
758
531
|
return new Promise(function (resolve, reject) {
|
|
759
532
|
if (process.argv.length > 0 && process.argv.find(argv => argv === "--minify") !== undefined) {
|
|
760
533
|
let startTime = new Date().getTime();
|
|
761
534
|
$.tooling.log('Minify bundles running...');
|
|
762
|
-
const jsPaths = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/*.js`]);
|
|
535
|
+
const jsPaths = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath).replace(/\\/g, "/")}/*.js`]);
|
|
763
536
|
let promises = [];
|
|
764
537
|
jsPaths.forEach(filePath => {
|
|
765
538
|
promises.push(new Promise(async (resolve, reject) => {
|
|
@@ -816,6 +589,25 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
|
|
|
816
589
|
...referenceManifests,
|
|
817
590
|
extractCss,
|
|
818
591
|
new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
|
|
592
|
+
new webpack_plugin_1.default({
|
|
593
|
+
// filename: 'styles.[contenthash].css',
|
|
594
|
+
filename: `${Object.keys(entry)[0]}.css`,
|
|
595
|
+
// get webpack mode and set value for dev
|
|
596
|
+
dev: false,
|
|
597
|
+
// Use statically generated CSS files and not runtime injected CSS.
|
|
598
|
+
// Even in development.
|
|
599
|
+
runtimeInjection: false,
|
|
600
|
+
// optional. default: 'x'
|
|
601
|
+
classNamePrefix: 'o',
|
|
602
|
+
// Required for CSS variable support
|
|
603
|
+
unstable_moduleResolution: {
|
|
604
|
+
// type: 'commonJS' | 'haste'
|
|
605
|
+
// default: 'commonJS'
|
|
606
|
+
type: 'commonJS',
|
|
607
|
+
// The absolute path to the root directory of your project
|
|
608
|
+
rootDir: __dirname,
|
|
609
|
+
},
|
|
610
|
+
}),
|
|
819
611
|
];
|
|
820
612
|
if (!buildOption.detectCircularDependencyOptions || buildOption.detectCircularDependencyOptions.disable !== true) {
|
|
821
613
|
plugins.unshift(new CircularDependencyPlugin({
|
|
@@ -888,10 +680,10 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
|
|
|
888
680
|
plugins.push(new $.omniaWebpackPlugins.ChunkAssets(function (compilation, fileName) {
|
|
889
681
|
chunkAsset(entries, compilation, fileName, viteHmrOption);
|
|
890
682
|
}));
|
|
891
|
-
let webpackEntries = {};
|
|
892
|
-
Object.keys(entry).forEach(name => {
|
|
893
|
-
|
|
894
|
-
})
|
|
683
|
+
// let webpackEntries = {};
|
|
684
|
+
// Object.keys(entry).forEach(name => {
|
|
685
|
+
// webpackEntries[name] = { import: entry[name] }
|
|
686
|
+
// })
|
|
895
687
|
return {
|
|
896
688
|
mode: 'production',
|
|
897
689
|
devtool: false,
|
|
@@ -919,7 +711,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
|
|
|
919
711
|
'@microsoft/signalr$': '@microsoft/signalr/dist/webworker/signalr.js',
|
|
920
712
|
}),
|
|
921
713
|
},
|
|
922
|
-
target: ['web', 'es2022'],
|
|
714
|
+
target: ['web', 'es2022'], // Will change ES6 when stop support IE11
|
|
923
715
|
output: {
|
|
924
716
|
//library: {
|
|
925
717
|
// type: "umd"
|
|
@@ -954,8 +746,8 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
|
|
|
954
746
|
}
|
|
955
747
|
return false;
|
|
956
748
|
},
|
|
957
|
-
// use: 'null-loader',
|
|
958
749
|
use: [
|
|
750
|
+
// 'null-loader',
|
|
959
751
|
{
|
|
960
752
|
loader: path_1.default.resolve(__dirname, $.isExtensionEnv ? '../webpack-loaders/ingore-vuetify-locale.js' : '../webpack-loaders/ingore-vuetify-locale.ts'),
|
|
961
753
|
}
|
|
@@ -1069,7 +861,7 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
|
1069
861
|
var entensionId = getServiceId();
|
|
1070
862
|
return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
|
|
1071
863
|
plugins: [
|
|
1072
|
-
...buildReferenceManifestFromConfig(),
|
|
864
|
+
...buildReferenceManifestFromConfig(Object.keys(entry)[0]),
|
|
1073
865
|
new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
|
|
1074
866
|
new $.webpack.DllPlugin({
|
|
1075
867
|
entryOnly: false,
|
|
@@ -1297,9 +1089,10 @@ function createCombinedManfest(omniaServiceId, manifestIds, targetManifestId, ta
|
|
|
1297
1089
|
if (manifestIds &&
|
|
1298
1090
|
targetManifestId &&
|
|
1299
1091
|
manifestIds.length > 0) {
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1092
|
+
const manifestIdToFileNameMap = {};
|
|
1093
|
+
const targetJsFileName = `${targetManifestName ? targetManifestName + "_" : ""}${targetManifestId}.js`;
|
|
1094
|
+
const targetCssFileName = `${targetManifestName ? targetManifestName + "_" : ""}${targetManifestId}.css`;
|
|
1095
|
+
manifestIdToFileNameMap[targetManifestId] = targetJsFileName;
|
|
1303
1096
|
$.tooling.log("Creating manifest group bundle [" + targetManifestId + "]", $.tooling.LogTypes.HeadLine);
|
|
1304
1097
|
let omniaServiceId = getServiceId();
|
|
1305
1098
|
manifestIds.sort((manifestId1, manifestId2) => {
|
|
@@ -1316,18 +1109,32 @@ function createCombinedManfest(omniaServiceId, manifestIds, targetManifestId, ta
|
|
|
1316
1109
|
}
|
|
1317
1110
|
return result;
|
|
1318
1111
|
});
|
|
1319
|
-
|
|
1112
|
+
const jsBundleNames = [];
|
|
1113
|
+
const cssBundleNames = [];
|
|
1320
1114
|
for (let i = 0; i < manifestIds.length; i++) {
|
|
1321
1115
|
let manifest = $.composers.LoadableManifestRegistry.getRegisteredManifest(manifestIds[i]);
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1116
|
+
jsBundleNames[i] = outputDir + `/${manifest.resourceName ? manifest.resourceName + "_" : ""}${manifest.resourceId}.js`;
|
|
1117
|
+
const cssFilePath = outputDir + `/${manifest.resourceName ? manifest.resourceName + "_" : ""}${manifest.resourceId}.css`;
|
|
1118
|
+
if (!fsExtra.existsSync(jsBundleNames[i])) {
|
|
1119
|
+
throw new Error("Error, can't create combined bundle: " + targetJsFileName + " can't find bundle to include: " + jsBundleNames[i]);
|
|
1120
|
+
}
|
|
1121
|
+
if (fsExtra.existsSync(cssFilePath)) {
|
|
1122
|
+
cssBundleNames.push(cssFilePath);
|
|
1325
1123
|
}
|
|
1326
|
-
manifestIdToFileNameMap[manifestIds[i]] =
|
|
1124
|
+
manifestIdToFileNameMap[manifestIds[i]] = jsBundleNames[i];
|
|
1327
1125
|
$.tooling.log("Adding manifest bundle [" + manifestIds[i] + "] to group", $.tooling.LogTypes.Info);
|
|
1328
1126
|
}
|
|
1329
|
-
let
|
|
1330
|
-
|
|
1127
|
+
let mergedCssContent = "";
|
|
1128
|
+
cssBundleNames.forEach(filePath => {
|
|
1129
|
+
mergedCssContent = `${mergedCssContent}
|
|
1130
|
+
${fsExtra.readFileSync(filePath, 'utf8')}
|
|
1131
|
+
`;
|
|
1132
|
+
});
|
|
1133
|
+
if (mergedCssContent) {
|
|
1134
|
+
fsExtra.writeFileSync(`${outputDir}/${targetCssFileName}`, mergedCssContent);
|
|
1135
|
+
}
|
|
1136
|
+
let mergedJsContent = "";
|
|
1137
|
+
jsBundleNames.forEach(filePath => {
|
|
1331
1138
|
let manifestId = "";
|
|
1332
1139
|
let currentFilename = $.path.basename(filePath);
|
|
1333
1140
|
for (let id in manifestIdToFileNameMap) {
|
|
@@ -1340,13 +1147,13 @@ function createCombinedManfest(omniaServiceId, manifestIds, targetManifestId, ta
|
|
|
1340
1147
|
throw Error("Couldn't extract manifest id from filename: " + currentFilename);
|
|
1341
1148
|
}
|
|
1342
1149
|
let content = fsExtra.readFileSync(filePath, 'utf8');
|
|
1343
|
-
|
|
1344
|
-
${
|
|
1150
|
+
mergedJsContent = `
|
|
1151
|
+
${mergedJsContent}
|
|
1345
1152
|
/* Start of resource:${manifestId} */omniaWebpackJsonp["bb000000-0000-bbbb-0000-0000000000bb"]["${fx_models_1.OmniaResourceManifests.FxCore.toString()}"]("06e712d2-9897-4891-9353-148547efe61c").ManifestResourceLoader.registerWebComponentFromGroupBundle("${omniaServiceId}", "${manifestId}", "${targetManifestId}", function(){
|
|
1346
1153
|
${content}
|
|
1347
1154
|
})//End of resource:${manifestId} `;
|
|
1348
1155
|
});
|
|
1349
|
-
fsExtra.writeFileSync(`${outputDir}/${
|
|
1156
|
+
fsExtra.writeFileSync(`${outputDir}/${targetJsFileName}`, `/******/ if (typeof omniaLoader === 'undefined') {
|
|
1350
1157
|
/******/ globalThis['omniaLoader'] = {};
|
|
1351
1158
|
/******/ }
|
|
1352
1159
|
/******/ omniaLoader['${omniaServiceId}'] = omniaLoader['${omniaServiceId}'] || {};
|
|
@@ -1355,7 +1162,7 @@ ${content}
|
|
|
1355
1162
|
/******/
|
|
1356
1163
|
}
|
|
1357
1164
|
/******/ omniaLoader['${omniaServiceId}']['${targetManifestId}'] = function () {
|
|
1358
|
-
${
|
|
1165
|
+
${mergedJsContent}
|
|
1359
1166
|
}
|
|
1360
1167
|
${$.composers.LoadableManifestRegistry.isDefineWithNoDependency(targetManifestId) ? `omniaLoader['${omniaServiceId}']['${targetManifestId}']()` : ''}`, 'utf8');
|
|
1361
1168
|
$.tooling.log("Done - Creating manifest group bundle for manifest id: " + targetManifestId, $.tooling.LogTypes.HeadLine);
|
|
@@ -1439,12 +1246,17 @@ function buildReferenceManifest(currentEntry, entries) {
|
|
|
1439
1246
|
var manifests = [];
|
|
1440
1247
|
var dynamicReferenceManifests = [];
|
|
1441
1248
|
let buildOptions = getBuildOption();
|
|
1442
|
-
if (buildOptions && buildOptions.bundleOptions && buildOptions.bundleOptions.commonsChunk)
|
|
1443
|
-
return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig());
|
|
1444
1249
|
var currentEntryName = Object.keys(currentEntry)[0];
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1250
|
+
if (buildOptions && buildOptions.bundleOptions && buildOptions.bundleOptions.commonsChunk)
|
|
1251
|
+
return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig(currentEntryName));
|
|
1252
|
+
// exclude pre-built webpack manifest
|
|
1253
|
+
if ($.isExtensionEnv
|
|
1254
|
+
|| (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
|
|
1255
|
+
&& currentEntryName.indexOf(vendorProdId) === -1
|
|
1256
|
+
// && currentEntryName.indexOf(OmniaResourceManifests.FxCore.toString()) === -1
|
|
1257
|
+
// && currentEntryName.indexOf(OmniaResourceManifests.Fx.toString()) === -1
|
|
1258
|
+
// && currentEntryName.indexOf(OmniaResourceManifests.FxUx.toString()) === -1
|
|
1259
|
+
)) {
|
|
1448
1260
|
Object.keys(entries).forEach((entryName) => {
|
|
1449
1261
|
if (entryName !== currentEntryName) {
|
|
1450
1262
|
if ($.fs.existsSync($.tooling.utils.root(outDirManifestMetadata + "/" + entryName + ".manifest.json"))) {
|
|
@@ -1458,14 +1270,14 @@ function buildReferenceManifest(currentEntry, entries) {
|
|
|
1458
1270
|
}
|
|
1459
1271
|
});
|
|
1460
1272
|
}
|
|
1461
|
-
manifests = buildReferenceManifestFromConfig().concat(dynamicReferenceManifests).concat(manifests);
|
|
1273
|
+
manifests = buildReferenceManifestFromConfig(currentEntryName).concat(dynamicReferenceManifests).concat(manifests);
|
|
1462
1274
|
return manifests;
|
|
1463
1275
|
}
|
|
1464
1276
|
function cleanUpComposer() {
|
|
1465
1277
|
$.composers.ManifestRegistry.clearState();
|
|
1466
1278
|
}
|
|
1467
1279
|
exports.cleanUpComposer = cleanUpComposer;
|
|
1468
|
-
function buildReferenceManifestFromConfig() {
|
|
1280
|
+
function buildReferenceManifestFromConfig(entryName) {
|
|
1469
1281
|
var manifests = [];
|
|
1470
1282
|
let buildOptions = getBuildOption();
|
|
1471
1283
|
if (buildOptions.reference) {
|
|
@@ -1477,6 +1289,17 @@ function buildReferenceManifestFromConfig() {
|
|
|
1477
1289
|
}));
|
|
1478
1290
|
}
|
|
1479
1291
|
}
|
|
1292
|
+
if (!isBuildWebpackManifestOnly() && buildOptions.webpackManifests) {
|
|
1293
|
+
for (let manifestPath of buildOptions.webpackManifests) {
|
|
1294
|
+
if (manifestPath.indexOf(entryName) === -1) {
|
|
1295
|
+
manifests.push(new $.omniaWebpackPlugins.DllReferencePlugin({
|
|
1296
|
+
context: $.tooling.utils.root(""),
|
|
1297
|
+
manifest: $.tooling.utils.root(manifestPath),
|
|
1298
|
+
// name: `md${++trackingModuleRefId}` //require('md5')(manifestPath)
|
|
1299
|
+
}));
|
|
1300
|
+
}
|
|
1301
|
+
}
|
|
1302
|
+
}
|
|
1480
1303
|
if ($.isExtensionEnv) {
|
|
1481
1304
|
_registeredReferenceManifests.forEach(manifest => {
|
|
1482
1305
|
manifests.push(new $.omniaWebpackPlugins.DllReferencePlugin({
|
|
@@ -1556,89 +1379,18 @@ function getServiceId() {
|
|
|
1556
1379
|
return serviceId;
|
|
1557
1380
|
}
|
|
1558
1381
|
exports.getServiceId = getServiceId;
|
|
1559
|
-
function
|
|
1560
|
-
let foundTypes = {};
|
|
1561
|
-
componentRegistrations.forEach((comp) => {
|
|
1562
|
-
let defPaths = comp.componentOptions.typings;
|
|
1563
|
-
if (defPaths) {
|
|
1564
|
-
let isChildSpec = false;
|
|
1565
|
-
defPaths.forEach((defPath) => {
|
|
1566
|
-
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(comp.manifestPath, [defPath])[0];
|
|
1567
|
-
let contents = $.fs.readFileSync(entryPointPath, 'utf8');
|
|
1568
|
-
let wcEl = getWcElement(contents, isChildSpec);
|
|
1569
|
-
if (wcEl) {
|
|
1570
|
-
//Now lets find the interface mapped to element
|
|
1571
|
-
//example /*@WebComponentInterface("omfx-dialog")*/
|
|
1572
|
-
let interfaceToken = `/*@WebComponentInterface("${wcEl}")*/`;
|
|
1573
|
-
let interfaceIndex = contents.indexOf(interfaceToken);
|
|
1574
|
-
if (interfaceIndex > -1) {
|
|
1575
|
-
let wcProps = [];
|
|
1576
|
-
let intf = contents.substring(interfaceIndex);
|
|
1577
|
-
let nextIsDomProp = false;
|
|
1578
|
-
intf = intf
|
|
1579
|
-
.substring(intf.indexOf("{") + 1, intf.indexOf("}"))
|
|
1580
|
-
.replace(/\?/g, '')
|
|
1581
|
-
.trim()
|
|
1582
|
-
.split(/\r\n|\r|\n/g).forEach((group) => {
|
|
1583
|
-
/*@DomProperty*/
|
|
1584
|
-
let sub = group.trim();
|
|
1585
|
-
if (sub.indexOf("/*@DomProperty*/") > -1) {
|
|
1586
|
-
nextIsDomProp = true;
|
|
1587
|
-
return;
|
|
1588
|
-
}
|
|
1589
|
-
if (nextIsDomProp) {
|
|
1590
|
-
if (sub.indexOf(':')) {
|
|
1591
|
-
sub = sub.split(':')[0];
|
|
1592
|
-
}
|
|
1593
|
-
if (sub) {
|
|
1594
|
-
if (!foundTypes[wcEl]) {
|
|
1595
|
-
foundTypes[wcEl] = [];
|
|
1596
|
-
}
|
|
1597
|
-
foundTypes[wcEl].push(sub);
|
|
1598
|
-
}
|
|
1599
|
-
nextIsDomProp = false;
|
|
1600
|
-
}
|
|
1601
|
-
});
|
|
1602
|
-
}
|
|
1603
|
-
}
|
|
1604
|
-
isChildSpec = true;
|
|
1605
|
-
});
|
|
1606
|
-
}
|
|
1607
|
-
});
|
|
1608
|
-
return foundTypes;
|
|
1609
|
-
}
|
|
1610
|
-
var lastWcElement = "";
|
|
1611
|
-
function getWcElement(contents, isChildSpec) {
|
|
1612
|
-
if (isChildSpec) {
|
|
1613
|
-
if (lastWcElement === "") {
|
|
1614
|
-
new Error("Cant find the /*@DomProperty*/ on the parent interface for the WebComponent definition");
|
|
1615
|
-
}
|
|
1616
|
-
return lastWcElement;
|
|
1617
|
-
}
|
|
1618
|
-
else {
|
|
1619
|
-
lastWcElement = "";
|
|
1620
|
-
}
|
|
1621
|
-
let wcElToken = "/*@WebComponent*/";
|
|
1622
|
-
let wcElIndex = contents.indexOf(wcElToken);
|
|
1623
|
-
let wcEl = "";
|
|
1624
|
-
if (wcElIndex > -1) {
|
|
1625
|
-
wcEl = contents.substring(wcElIndex);
|
|
1626
|
-
wcEl = wcEl.substring(wcEl.indexOf('"') + 1);
|
|
1627
|
-
wcEl = wcEl.substring(0, wcEl.indexOf('"'));
|
|
1628
|
-
lastWcElement = wcEl;
|
|
1629
|
-
}
|
|
1630
|
-
return lastWcElement;
|
|
1631
|
-
}
|
|
1632
|
-
function createVueEntryFormRegistrations(registrations) {
|
|
1382
|
+
function createVueEntryFormComponentRegistrations(registrations) {
|
|
1633
1383
|
let entryPaths = {};
|
|
1634
1384
|
for (let r of registrations) {
|
|
1635
|
-
if (r.componentOptions.entryPoint.endsWith('.
|
|
1385
|
+
if (r.componentOptions.entryPoint.endsWith('.tsx')
|
|
1386
|
+
|| r.componentOptions.entryPoint.endsWith('.vue')) {
|
|
1636
1387
|
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(r.manifestPath, [r.componentOptions.entryPoint]);
|
|
1637
1388
|
let entryId = r.manifest.resourceId;
|
|
1638
1389
|
if (r.manifest.resourceName) {
|
|
1639
1390
|
entryId = `${r.manifest.resourceName}_${entryId}`;
|
|
1640
1391
|
}
|
|
1641
|
-
|
|
1392
|
+
r.componentOptions.entryPointPath = entryPointPath[0];
|
|
1393
|
+
entryPaths[entryId.toString()] = entryPointPath;
|
|
1642
1394
|
}
|
|
1643
1395
|
else {
|
|
1644
1396
|
$.tooling.log('The OmniaFx build system only supports .jsx, .vue and .tsx based components at the moment ', $.tooling.LogTypes.Error);
|
|
@@ -1958,35 +1710,3 @@ function sortString(a, b) {
|
|
|
1958
1710
|
}
|
|
1959
1711
|
return -1;
|
|
1960
1712
|
}
|
|
1961
|
-
function generateWebComponentTypings(wc, template, info) {
|
|
1962
|
-
// export default defineVueWebComponent
|
|
1963
|
-
let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
|
|
1964
|
-
let content = fsExtra.readFileSync(wcPath, 'utf8');
|
|
1965
|
-
if (content.indexOf("defineVueWebComponent") > -1) {
|
|
1966
|
-
if (!new RegExp('export\\s+default\\s+').test(content)) {
|
|
1967
|
-
throw new Error(`Missing statement 'export default a vue web component' in ${wcPath}`);
|
|
1968
|
-
}
|
|
1969
|
-
let friendlyManifestId = `wc${wc.manifest.resourceId.toString().replace(/-/g, '').toLowerCase()}`;
|
|
1970
|
-
let importPath = wcPath.substring(0, wcPath.lastIndexOf('.tsx'));
|
|
1971
|
-
if (importPath.indexOf("./") === 0) {
|
|
1972
|
-
importPath = importPath.replace("./", "");
|
|
1973
|
-
}
|
|
1974
|
-
if ($.isExtensionEnv) {
|
|
1975
|
-
importPath = `../../../../${importPath}`;
|
|
1976
|
-
}
|
|
1977
|
-
else {
|
|
1978
|
-
importPath = `../../../../${importPath}`;
|
|
1979
|
-
}
|
|
1980
|
-
let elementNamePascalCase = wc.componentOptions.elementName.replace("omfx-", "").replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
|
|
1981
|
-
elementNamePascalCase = elementNamePascalCase[0].toUpperCase() + elementNamePascalCase.substring(1, elementNamePascalCase.length);
|
|
1982
|
-
info.wc.mappings[elementNamePascalCase] = wc.componentOptions.elementName;
|
|
1983
|
-
return template
|
|
1984
|
-
.replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
|
|
1985
|
-
//{{importWC}}`)
|
|
1986
|
-
.replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": typeof ${friendlyManifestId}.propsDefinition & VueComponentBaseProps
|
|
1987
|
-
//{{elementName}}`)
|
|
1988
|
-
.replace(/\/\/{{nselementName}}/, `"${elementNamePascalCase}": { new(...args: any[]): { $props: typeof ${friendlyManifestId}.propsDefinition & VueComponentBaseProps } }
|
|
1989
|
-
//{{nselementName}}`);
|
|
1990
|
-
}
|
|
1991
|
-
return template;
|
|
1992
|
-
}
|