@omnia/tooling-vue 8.0.78-vnext → 8.0.79-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 -0
- package/internal-do-not-import-from-here/config/wctypings.d.ts +4431 -0
- package/internal-do-not-import-from-here/index.d.ts +3 -1
- package/internal-do-not-import-from-here/index.js +6 -2
- package/internal-do-not-import-from-here/shared.d.ts +31 -118
- package/internal-do-not-import-from-here/shared.js +98 -153
- package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +1 -1
- package/internal-do-not-import-from-here/tasks/bundle.d.ts +1 -2
- package/internal-do-not-import-from-here/tasks/bundle.js +179 -391
- package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
- package/internal-do-not-import-from-here/tasks/doc.js +330 -393
- package/internal-do-not-import-from-here/tasks/vendor.js +16 -12
- package/internal-do-not-import-from-here/variables.d.ts +1 -1
- package/internal-do-not-import-from-here/variables.js +2 -2
- package/internal-do-not-import-from-here/vite/hmr/graph.js +4 -0
- package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +1 -1
- package/internal-do-not-import-from-here/wctypings.ts +0 -0
- package/internal-do-not-import-from-here/webpack-loaders/doc-loader.js +11 -0
- package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +3 -3
- package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +3 -3
- package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +3 -0
- 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 -0
- package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +11 -0
- package/package.json +5 -4
- package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -741
- package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +0 -13
- package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.d.ts +0 -1
- package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.js +0 -10
- /package/internal-do-not-import-from-here/{bb000000-0000-bbbb-0000-0000000000bb.wctypings.js → config/wctypings.js} +0 -0
- /package/internal-do-not-import-from-here/webpack-loaders/{esbuild-custom-loader.d.ts → doc-loader.d.ts} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addDependency = exports.processManifestGenerated = exports.checkDuplicateBundle = exports.
|
|
3
|
+
exports.addDependency = exports.processManifestGenerated = exports.checkDuplicateBundle = exports.registerManifestsReference = exports.createCombinedManfest = exports.createVueWebpackConfig = exports.cleanUpComposer = exports.getBuildOption = exports.getServiceId = exports.bundleManifest = exports.ensureManifestDependencyInRuntime = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const path_1 = tslib_1.__importDefault(require("path"));
|
|
6
6
|
const del_1 = tslib_1.__importDefault(require("del"));
|
|
@@ -14,13 +14,13 @@ 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
18
|
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
|
|
19
19
|
const ConcatSource = require('webpack-core/lib/ConcatSource');
|
|
20
20
|
const CircularDependencyPlugin = require('circular-dependency-plugin');
|
|
21
21
|
const isEqual = require('lodash/isEqual');
|
|
22
22
|
const vendorProdId = "aaf89b2d-5ea8-4b79-946a-8c1e89f713a3";
|
|
23
|
-
let outDirManifestMetadata = "client/tooling/vue/output_manifests", _manifestsEntry = {}, _registeredReferenceManifests = [], serviceId = null, _modulesStats = {}, _manifestsStats = {}, keepTrackbuildOptions = {}, _transformResourcepaths = []
|
|
23
|
+
let outDirManifestMetadata = "client/tooling/vue/output_manifests", _manifestsEntry = {}, _registeredReferenceManifests = [], serviceId = null, _modulesStats = {}, _manifestsStats = {}, keepTrackbuildOptions = {}, _transformResourcepaths = [];
|
|
24
24
|
if ($.isExtensionEnv) {
|
|
25
25
|
outDirManifestMetadata = "node_modules/@omnia/tooling-vue/internal-do-not-import-from-here/output_manifests";
|
|
26
26
|
}
|
|
@@ -40,19 +40,24 @@ $.tooling.core.registerBuildTask({
|
|
|
40
40
|
return new Promise(function (resolve, reject) {
|
|
41
41
|
buildEntries()
|
|
42
42
|
.then((result) => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
43
|
+
if (process.argv.length > 0 && process.argv.find(argv => argv === "--package") !== undefined) {
|
|
44
|
+
resolve(result);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
let startTime = new Date().getTime();
|
|
48
|
+
tooling_1.utils.log("Typescript checking...");
|
|
49
|
+
const spawn = require("child_process").spawn;
|
|
50
|
+
spawn("node", [path_1.default.resolve(__dirname, "./tsc.js")], { stdio: "inherit", })
|
|
51
|
+
.on('exit', (code) => {
|
|
52
|
+
if (code == 0) {
|
|
53
|
+
tooling_1.utils.logTime('Done - Typescript', startTime);
|
|
54
|
+
resolve(result);
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
process.exit(code);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
56
61
|
}, reject);
|
|
57
62
|
});
|
|
58
63
|
}
|
|
@@ -186,12 +191,7 @@ function clean() {
|
|
|
186
191
|
return new Promise(function (resolve, reject) {
|
|
187
192
|
del_1.default.sync("node_modules/.cache");
|
|
188
193
|
del_1.default.sync($.tooling.utils.root(outDirManifestMetadata + "/manifest.entries.cached.json"));
|
|
189
|
-
|
|
190
|
-
del_1.default.sync($.path.resolve(__dirname, "../wctypings.ts"));
|
|
191
|
-
}
|
|
192
|
-
else {
|
|
193
|
-
del_1.default.sync($.path.resolve(__dirname, `../bb000000-0000-bbbb-0000-0000000000bb.wctypings.ts`));
|
|
194
|
-
}
|
|
194
|
+
shared_1.ConfigurationManager.webComponentTypings.delete();
|
|
195
195
|
resolve();
|
|
196
196
|
});
|
|
197
197
|
}
|
|
@@ -202,11 +202,12 @@ function buildEntries(serve = false) {
|
|
|
202
202
|
var componentRegistry = $.composers.ComponentRegistry;
|
|
203
203
|
let componentRegistrations = componentRegistry.getRegistrations();
|
|
204
204
|
const serviceInfo = $.composers.ServiceManifestRegistry.getServiceInfo();
|
|
205
|
-
if (serviceInfo.serviceType === tooling_composers_1.ServiceTypes.WebApp) {
|
|
206
|
-
await generateComponentTypingsAndDoc(componentRegistrations);
|
|
207
|
-
}
|
|
208
205
|
startTime = new Date().getTime();
|
|
209
206
|
$.tooling.logTime("Found [" + componentRegistrations.length + "] component registrations", startTime);
|
|
207
|
+
let componentEntries = createVueEntryFormComponentRegistrations(componentRegistrations);
|
|
208
|
+
if (serviceInfo.serviceType === tooling_composers_1.ServiceTypes.WebApp) {
|
|
209
|
+
await (0, doc_1.generateComponentTypingsAndDoc)(componentRegistrations);
|
|
210
|
+
}
|
|
210
211
|
var resourceRegistry = $.composers.ResourceRegistry;
|
|
211
212
|
let resourceBundlesWithBuildOptions = resourceRegistry.getRegisteredResourceBundles(shared_1.convertManifestPathToEntryPath);
|
|
212
213
|
$.tooling.logTime("Found [" + resourceBundlesWithBuildOptions?.size + "] resource bundles", startTime);
|
|
@@ -222,7 +223,6 @@ function buildEntries(serve = false) {
|
|
|
222
223
|
console.log("debug " + res[0] + " has build options for paths " + resource.paths + " buildoptions: " + JSON.stringify(resource.buildOptions));
|
|
223
224
|
}
|
|
224
225
|
}
|
|
225
|
-
let componentEntries = createVueEntryFormRegistrations(componentRegistrations);
|
|
226
226
|
var entries = $.merge(componentEntries, resourceEntries);
|
|
227
227
|
if (checkDuplicateWebpackEntryPoints(entries)) {
|
|
228
228
|
$.tooling.log('Build manifests metadata have error that found duplicated resource path', $.tooling.LogTypes.Error);
|
|
@@ -257,248 +257,7 @@ function buildEntries(serve = false) {
|
|
|
257
257
|
}
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
-
|
|
261
|
-
tooling_1.utils.log("Generate components typings and documentation running...");
|
|
262
|
-
var startTime = new Date().getTime();
|
|
263
|
-
let DefineVueType;
|
|
264
|
-
(function (DefineVueType) {
|
|
265
|
-
DefineVueType[DefineVueType["Prop"] = 0] = "Prop";
|
|
266
|
-
DefineVueType[DefineVueType["Model"] = 1] = "Model";
|
|
267
|
-
DefineVueType[DefineVueType["Slot"] = 2] = "Slot";
|
|
268
|
-
DefineVueType[DefineVueType["Emit"] = 4] = "Emit";
|
|
269
|
-
})(DefineVueType || (DefineVueType = {}));
|
|
270
|
-
const docResult = {};
|
|
271
|
-
function getPropertyFunctionTypeAsString(type) {
|
|
272
|
-
let params = "";
|
|
273
|
-
if (type.params?.length > 0) {
|
|
274
|
-
type.params.forEach(p => {
|
|
275
|
-
params += `${p.value}:${getPropertyType(p.typeAnnotation)}, `;
|
|
276
|
-
});
|
|
277
|
-
params = params.replace(/,\s*$/, "");
|
|
278
|
-
}
|
|
279
|
-
return `(${params}) => ${getPropertyType(type.typeAnnotation)}`;
|
|
280
|
-
}
|
|
281
|
-
function getPropertyType(tsType) {
|
|
282
|
-
let result = "";
|
|
283
|
-
if (tsType.type === "TsTypeAnnotation") {
|
|
284
|
-
return getPropertyType(tsType.typeAnnotation);
|
|
285
|
-
}
|
|
286
|
-
switch (tsType.type) {
|
|
287
|
-
case "TsLiteralType":
|
|
288
|
-
result = tsType.literal.value;
|
|
289
|
-
break;
|
|
290
|
-
case "TsKeywordType":
|
|
291
|
-
result = tsType.kind;
|
|
292
|
-
break;
|
|
293
|
-
case "TsTypeReference":
|
|
294
|
-
result = tsType.typeName.value;
|
|
295
|
-
break;
|
|
296
|
-
case "TsFunctionType":
|
|
297
|
-
result = getPropertyFunctionTypeAsString(tsType);
|
|
298
|
-
break;
|
|
299
|
-
default:
|
|
300
|
-
break;
|
|
301
|
-
}
|
|
302
|
-
return result;
|
|
303
|
-
}
|
|
304
|
-
function getNameProperty(ce, result) {
|
|
305
|
-
const identifier = ce.callee?.property?.value;
|
|
306
|
-
if (identifier) {
|
|
307
|
-
switch (identifier) {
|
|
308
|
-
case "name":
|
|
309
|
-
result.name = ce.arguments[0].expression.value;
|
|
310
|
-
getNameProperty(ce.callee.object, result);
|
|
311
|
-
break;
|
|
312
|
-
case "vModel":
|
|
313
|
-
result.type = DefineVueType.Model;
|
|
314
|
-
result.propertyTypeAsString = getPropertyType(ce.typeArguments.params[0]);
|
|
315
|
-
result.name = result.name ? `v-model:${result.name}` : result.name;
|
|
316
|
-
break;
|
|
317
|
-
case "slots":
|
|
318
|
-
result.type = DefineVueType.Slot;
|
|
319
|
-
result.propertyTypeAsObject = {};
|
|
320
|
-
ce.typeArguments.params[0].members
|
|
321
|
-
.forEach(m => {
|
|
322
|
-
result.propertyTypeAsObject[m.key.value] = getPropertyType(m.typeAnnotation);
|
|
323
|
-
});
|
|
324
|
-
break;
|
|
325
|
-
case "prop":
|
|
326
|
-
result.type = DefineVueType.Prop;
|
|
327
|
-
result.propertyTypeAsString = getPropertyType(ce.typeArguments.params[0]);
|
|
328
|
-
break;
|
|
329
|
-
case "emit":
|
|
330
|
-
result.type = DefineVueType.Emit;
|
|
331
|
-
result.propertyTypeAsString = getPropertyType(ce.typeArguments.params[0]);
|
|
332
|
-
break;
|
|
333
|
-
default:
|
|
334
|
-
getNameProperty(ce.callee.object, result);
|
|
335
|
-
}
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
async function buildDoc(wc) {
|
|
339
|
-
try {
|
|
340
|
-
const wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
|
|
341
|
-
const wcParseResult = await (0, core_1.parseFile)(wcPath, {
|
|
342
|
-
syntax: 'typescript',
|
|
343
|
-
target: 'es2020',
|
|
344
|
-
tsx: true,
|
|
345
|
-
decorators: true,
|
|
346
|
-
dynamicImport: true
|
|
347
|
-
});
|
|
348
|
-
wcParseResult.body.forEach(b => {
|
|
349
|
-
if (b.type === 'ExportDefaultExpression'
|
|
350
|
-
&& b.expression.callee?.value === "defineVueWebComponent") {
|
|
351
|
-
b.expression.arguments[0].expression
|
|
352
|
-
.properties?.filter(p => p.key.value === "props"
|
|
353
|
-
|| p.key.value === "emits")
|
|
354
|
-
?.forEach(propsIdentifier => {
|
|
355
|
-
if (propsIdentifier) {
|
|
356
|
-
propsIdentifier.value
|
|
357
|
-
.properties?.forEach(p => {
|
|
358
|
-
const em = p.arguments;
|
|
359
|
-
if (em?.callee?.property?.value === "doc$") {
|
|
360
|
-
const PropertyResult = {
|
|
361
|
-
type: null,
|
|
362
|
-
propertyTypeAsString: "",
|
|
363
|
-
name: ""
|
|
364
|
-
};
|
|
365
|
-
getNameProperty(em, PropertyResult);
|
|
366
|
-
if (!docResult[wc.componentOptions.elementName]) {
|
|
367
|
-
docResult[wc.componentOptions.elementName] = {
|
|
368
|
-
emits: {},
|
|
369
|
-
models: {},
|
|
370
|
-
props: {},
|
|
371
|
-
slots: {}
|
|
372
|
-
};
|
|
373
|
-
}
|
|
374
|
-
switch (PropertyResult.type) {
|
|
375
|
-
case DefineVueType.Prop:
|
|
376
|
-
docResult[wc.componentOptions.elementName].props[PropertyResult.name] = {
|
|
377
|
-
type: PropertyResult.propertyTypeAsString,
|
|
378
|
-
description: em.arguments[0].expression.value
|
|
379
|
-
};
|
|
380
|
-
break;
|
|
381
|
-
case DefineVueType.Model:
|
|
382
|
-
docResult[wc.componentOptions.elementName].models[PropertyResult.name] = {
|
|
383
|
-
type: PropertyResult.propertyTypeAsString,
|
|
384
|
-
description: em.arguments[0].expression.value
|
|
385
|
-
};
|
|
386
|
-
break;
|
|
387
|
-
case DefineVueType.Emit:
|
|
388
|
-
docResult[wc.componentOptions.elementName].emits[PropertyResult.name] = {
|
|
389
|
-
type: PropertyResult.propertyTypeAsString,
|
|
390
|
-
description: em.arguments[0].expression.value
|
|
391
|
-
};
|
|
392
|
-
break;
|
|
393
|
-
case DefineVueType.Slot:
|
|
394
|
-
em.arguments[0].expression
|
|
395
|
-
.properties
|
|
396
|
-
.forEach(p => {
|
|
397
|
-
const slotName = p.key.value;
|
|
398
|
-
docResult[wc.componentOptions.elementName].slots[slotName] = {
|
|
399
|
-
type: PropertyResult.propertyTypeAsObject[slotName],
|
|
400
|
-
description: p.value.value
|
|
401
|
-
};
|
|
402
|
-
});
|
|
403
|
-
break;
|
|
404
|
-
default:
|
|
405
|
-
break;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
}
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
catch (ex) {
|
|
415
|
-
tooling_1.utils.log(`Have a exception when extract doc$ for web component manifest -> ${wc.manifestPath}`, tooling_1.utils.LogTypes.Error);
|
|
416
|
-
console.error(ex);
|
|
417
|
-
throw new Error("Exit, have an exception.");
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
let wcTypingsPath = "", docPath = $.path.resolve(__dirname, "ComponentDocRegistrations.ts");
|
|
421
|
-
;
|
|
422
|
-
if ($.isExtensionEnv) {
|
|
423
|
-
wcTypingsPath = $.path.resolve(__dirname, "../wctypings.ts");
|
|
424
|
-
}
|
|
425
|
-
else {
|
|
426
|
-
wcTypingsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wctypings.ts`);
|
|
427
|
-
}
|
|
428
|
-
let wcTypings = $.isExtensionEnv ? `
|
|
429
|
-
//{{importWC}}
|
|
430
|
-
declare global {
|
|
431
|
-
namespace JSX {
|
|
432
|
-
interface Element { }
|
|
433
|
-
interface ElementClass { }
|
|
434
|
-
|
|
435
|
-
interface IntrinsicElements {
|
|
436
|
-
//{{elementName}}
|
|
437
|
-
}
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
|
-
`
|
|
441
|
-
: `
|
|
442
|
-
//{{importWC}}
|
|
443
|
-
declare global {
|
|
444
|
-
namespace JSX {
|
|
445
|
-
interface Element { }
|
|
446
|
-
interface ElementClass { }
|
|
447
|
-
|
|
448
|
-
interface IntrinsicElements {
|
|
449
|
-
//{{elementName}}
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
declare global {
|
|
455
|
-
let omfx: {
|
|
456
|
-
//{{omfxelementName}}
|
|
457
|
-
};
|
|
458
|
-
}
|
|
459
|
-
`;
|
|
460
|
-
if ($.isExtensionEnv) {
|
|
461
|
-
wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
|
|
462
|
-
${wcTypings}`;
|
|
463
|
-
}
|
|
464
|
-
else {
|
|
465
|
-
wcTypings = `import { VueComponentBaseProps } from "../../../client/fx/ux/index";
|
|
466
|
-
${wcTypings}`;
|
|
467
|
-
}
|
|
468
|
-
await tooling_1.utils.asyncForEach(componentRegistrations, async (wc) => {
|
|
469
|
-
wcTypings = generateWebComponentTypings(wc, wcTypings);
|
|
470
|
-
await buildDoc(wc);
|
|
471
|
-
});
|
|
472
|
-
if (Object.keys(docResult).length > 0) {
|
|
473
|
-
fsExtra.outputFileSync(docPath, `
|
|
474
|
-
import { extendApi } from "@omnia/fx";
|
|
475
|
-
import { ComponentDoc } from "@omnia/fx-models";
|
|
476
|
-
|
|
477
|
-
extendApi(api => api.fx.docs.registrations, api => {
|
|
478
|
-
|
|
479
|
-
const registrations: { [elementName: string]: ComponentDoc } = ${JSON.stringify(docResult)}
|
|
480
|
-
|
|
481
|
-
Object.keys(registrations).forEach(elementName => {
|
|
482
|
-
api.register(elementName, registrations[elementName]);
|
|
483
|
-
});
|
|
484
|
-
});
|
|
485
|
-
`);
|
|
486
|
-
// create dynamic doc manifest
|
|
487
|
-
$.composers.ManifestRegistry.setCurrentManifestPath(`${path_1.default.relative(tooling_1.utils.root(""), path_1.default.resolve(__dirname))}/`);
|
|
488
|
-
$.composers
|
|
489
|
-
.Composer
|
|
490
|
-
.registerManifest(getBuildOption().dynamicDocManifestId || new fx_models_1.Guid(`${tooling_1.utils.generateGuid()}`), "omnia.fx.docs.components.registraions")
|
|
491
|
-
.registerResources({
|
|
492
|
-
resourcePaths: ["./ComponentDocRegistrations.ts"]
|
|
493
|
-
})
|
|
494
|
-
.withTarget(fx_models_1.ClientManifestTargetTypes.Docs)
|
|
495
|
-
.extendApi(api => api.fx.docs.registrations);
|
|
496
|
-
$.composers.ManifestRegistry.setCurrentManifestPath();
|
|
497
|
-
}
|
|
498
|
-
fsExtra.outputFileSync(wcTypingsPath, wcTypings);
|
|
499
|
-
tooling_1.utils.logTime('Done - Generate components typings and documentation', startTime);
|
|
500
|
-
}
|
|
501
|
-
function buildManifestMetadatas(entries) {
|
|
260
|
+
function buildManifestMetadata(entries) {
|
|
502
261
|
return new Promise(function (resolve, reject) {
|
|
503
262
|
try {
|
|
504
263
|
var startTime = new Date().getTime();
|
|
@@ -585,7 +344,7 @@ function beforeBundleManifest(entries) {
|
|
|
585
344
|
// isRunBuildMetadata = !isEqual(entries, cachedEntries);
|
|
586
345
|
// }
|
|
587
346
|
// }
|
|
588
|
-
if ($.fs.existsSync(cachedEntriesPath)) {
|
|
347
|
+
if (!isBuildWebpackManifestOnly() && $.fs.existsSync(cachedEntriesPath)) {
|
|
589
348
|
let cachedEntries = require(cachedEntriesPath);
|
|
590
349
|
isRunBuildMetadata = !isEqual(entries, cachedEntries);
|
|
591
350
|
}
|
|
@@ -617,9 +376,14 @@ function beforeBundleManifest(entries) {
|
|
|
617
376
|
fsExtra.writeJsonSync(manifestPath, content);
|
|
618
377
|
}
|
|
619
378
|
});
|
|
620
|
-
|
|
379
|
+
buildManifestMetadata(entriesToBuild).then(() => {
|
|
621
380
|
fsExtra.ensureFileSync(cachedEntriesPath);
|
|
622
381
|
fsExtra.writeJsonSync(cachedEntriesPath, entries);
|
|
382
|
+
if (isBuildWebpackManifestOnly()) {
|
|
383
|
+
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");
|
|
384
|
+
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");
|
|
385
|
+
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");
|
|
386
|
+
}
|
|
623
387
|
resolve(entries);
|
|
624
388
|
});
|
|
625
389
|
}
|
|
@@ -759,6 +523,9 @@ function afterGenerateManifestsMetadata() {
|
|
|
759
523
|
.then(resolve, reject);
|
|
760
524
|
});
|
|
761
525
|
}
|
|
526
|
+
function isBuildWebpackManifestOnly() {
|
|
527
|
+
return process.argv?.find(argv => argv === "--webpackManifest") !== undefined;
|
|
528
|
+
}
|
|
762
529
|
function minifyBundles() {
|
|
763
530
|
return new Promise(function (resolve, reject) {
|
|
764
531
|
if (process.argv.length > 0 && process.argv.find(argv => argv === "--minify") !== undefined) {
|
|
@@ -924,7 +691,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
|
|
|
924
691
|
'@microsoft/signalr$': '@microsoft/signalr/dist/webworker/signalr.js',
|
|
925
692
|
}),
|
|
926
693
|
},
|
|
927
|
-
target: ['web', 'es2022'],
|
|
694
|
+
target: ['web', 'es2022'], // Will change ES6 when stop support IE11
|
|
928
695
|
output: {
|
|
929
696
|
//library: {
|
|
930
697
|
// type: "umd"
|
|
@@ -1072,9 +839,9 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
|
|
|
1072
839
|
exports.createVueWebpackConfig = createVueWebpackConfig;
|
|
1073
840
|
function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
1074
841
|
var entensionId = getServiceId();
|
|
1075
|
-
return Object.assign({},
|
|
842
|
+
return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
|
|
1076
843
|
plugins: [
|
|
1077
|
-
...buildReferenceManifestFromConfig(),
|
|
844
|
+
...buildReferenceManifestFromConfig(Object.keys(entry)[0]),
|
|
1078
845
|
new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
|
|
1079
846
|
new $.webpack.DllPlugin({
|
|
1080
847
|
entryOnly: false,
|
|
@@ -1084,6 +851,117 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
|
1084
851
|
]
|
|
1085
852
|
});
|
|
1086
853
|
}
|
|
854
|
+
function getBaseWebpackConfigForManifestMetadata(entry, bundleOutputDir) {
|
|
855
|
+
return {
|
|
856
|
+
devtool: false,
|
|
857
|
+
mode: 'development',
|
|
858
|
+
context: $.tooling.utils.root(""),
|
|
859
|
+
entry: entry,
|
|
860
|
+
optimization: Object.assign({
|
|
861
|
+
removeAvailableModules: false,
|
|
862
|
+
removeEmptyChunks: false,
|
|
863
|
+
splitChunks: false,
|
|
864
|
+
}),
|
|
865
|
+
resolve: {
|
|
866
|
+
modules: $.tooling.core.getWebpackResolveModules(),
|
|
867
|
+
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
|
|
868
|
+
//extensions: ['.js', '.jsx', '.ts', '.tsx', '.html', '.vue', '.less', '.styl'],
|
|
869
|
+
symlinks: false,
|
|
870
|
+
cacheWithContext: true,
|
|
871
|
+
descriptionFiles: ['package.json'],
|
|
872
|
+
alias: Object.assign({}, $.tooling.core.getWebpackResolveAlias(), ($.composers.BuildConfigurationRegistry.getBuildOptions()?.moduleOptions?.alias || {}), {
|
|
873
|
+
'axios$': 'axios/dist/axios.js',
|
|
874
|
+
'typestyle$': 'typestyle/lib.es2015/index.js',
|
|
875
|
+
'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
|
|
876
|
+
'@microsoft/signalr': '@microsoft/signalr/dist/webworker/signalr.js',
|
|
877
|
+
}),
|
|
878
|
+
//mainFields: ['main', 'browser', 'module']
|
|
879
|
+
},
|
|
880
|
+
output: {
|
|
881
|
+
pathinfo: false,
|
|
882
|
+
path: $.tooling.utils.root(bundleOutputDir),
|
|
883
|
+
filename: '[name].js'
|
|
884
|
+
},
|
|
885
|
+
externals: [
|
|
886
|
+
function ({ context, request }, callback) {
|
|
887
|
+
if (request.indexOf("node_modules") > -1 || (/\.(sass|scss|styl|less|css)$/i).test(request)) {
|
|
888
|
+
return callback(null, 'commonjs ' + request);
|
|
889
|
+
}
|
|
890
|
+
callback();
|
|
891
|
+
}
|
|
892
|
+
],
|
|
893
|
+
module: {
|
|
894
|
+
noParse: /wwwroot(.*)/,
|
|
895
|
+
rules: [
|
|
896
|
+
{
|
|
897
|
+
test: /\.m?js$/,
|
|
898
|
+
resolve: {
|
|
899
|
+
fullySpecified: false, // disable the behaviour
|
|
900
|
+
},
|
|
901
|
+
},
|
|
902
|
+
...(0, ts_loader_1.default)(),
|
|
903
|
+
...(0, tsx_loader_1.default)(),
|
|
904
|
+
{
|
|
905
|
+
test: /\.styl$/,
|
|
906
|
+
use: [
|
|
907
|
+
//'style-loader',
|
|
908
|
+
//'css-loader',
|
|
909
|
+
'stylus-loader'
|
|
910
|
+
]
|
|
911
|
+
},
|
|
912
|
+
...($.isExtensionEnv ? [] : [{
|
|
913
|
+
test: /\.s(c|a)ss$/,
|
|
914
|
+
use: [
|
|
915
|
+
{
|
|
916
|
+
loader: 'sass-loader',
|
|
917
|
+
options: {
|
|
918
|
+
implementation: require('sass'),
|
|
919
|
+
sassOptions: {
|
|
920
|
+
//fiber: require('fibers'),
|
|
921
|
+
indentedSyntax: true
|
|
922
|
+
}
|
|
923
|
+
//fiber: require('fibers')
|
|
924
|
+
}
|
|
925
|
+
}
|
|
926
|
+
]
|
|
927
|
+
}]),
|
|
928
|
+
{
|
|
929
|
+
test: /\.less$/,
|
|
930
|
+
use: [
|
|
931
|
+
//'style-loader',
|
|
932
|
+
//'css-loader',
|
|
933
|
+
'less-loader'
|
|
934
|
+
]
|
|
935
|
+
},
|
|
936
|
+
{
|
|
937
|
+
test: /\.css$/,
|
|
938
|
+
use: [
|
|
939
|
+
//'style-loader',
|
|
940
|
+
{
|
|
941
|
+
loader: 'css-loader'
|
|
942
|
+
}
|
|
943
|
+
]
|
|
944
|
+
},
|
|
945
|
+
{
|
|
946
|
+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
947
|
+
loader: 'url-loader'
|
|
948
|
+
},
|
|
949
|
+
{
|
|
950
|
+
test: /\.(ico|gif|png|jpe?g|svg)$/i,
|
|
951
|
+
use: [{
|
|
952
|
+
loader: 'file-loader',
|
|
953
|
+
options: {
|
|
954
|
+
name: '[name].[ext]',
|
|
955
|
+
outputPath: "../images/",
|
|
956
|
+
publicPath: '/omnia/images/'
|
|
957
|
+
}
|
|
958
|
+
}]
|
|
959
|
+
//loader: 'url-loader'
|
|
960
|
+
}
|
|
961
|
+
]
|
|
962
|
+
}
|
|
963
|
+
};
|
|
964
|
+
}
|
|
1087
965
|
function buildCommonChunk(entry) {
|
|
1088
966
|
let bundleOptions = getBuildOption().bundleOptions;
|
|
1089
967
|
let minChunk = bundleOptions.commonsChunk.minChunks || 2;
|
|
@@ -1333,12 +1211,17 @@ function buildReferenceManifest(currentEntry, entries) {
|
|
|
1333
1211
|
var manifests = [];
|
|
1334
1212
|
var dynamicReferenceManifests = [];
|
|
1335
1213
|
let buildOptions = getBuildOption();
|
|
1336
|
-
if (buildOptions && buildOptions.bundleOptions && buildOptions.bundleOptions.commonsChunk)
|
|
1337
|
-
return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig());
|
|
1338
1214
|
var currentEntryName = Object.keys(currentEntry)[0];
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1215
|
+
if (buildOptions && buildOptions.bundleOptions && buildOptions.bundleOptions.commonsChunk)
|
|
1216
|
+
return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig(currentEntryName));
|
|
1217
|
+
// exclude pre-built webpack manifest
|
|
1218
|
+
if ($.isExtensionEnv
|
|
1219
|
+
|| (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
|
|
1220
|
+
&& currentEntryName.indexOf(vendorProdId) === -1
|
|
1221
|
+
// && currentEntryName.indexOf(OmniaResourceManifests.FxCore.toString()) === -1
|
|
1222
|
+
// && currentEntryName.indexOf(OmniaResourceManifests.Fx.toString()) === -1
|
|
1223
|
+
// && currentEntryName.indexOf(OmniaResourceManifests.FxUx.toString()) === -1
|
|
1224
|
+
)) {
|
|
1342
1225
|
Object.keys(entries).forEach((entryName) => {
|
|
1343
1226
|
if (entryName !== currentEntryName) {
|
|
1344
1227
|
if ($.fs.existsSync($.tooling.utils.root(outDirManifestMetadata + "/" + entryName + ".manifest.json"))) {
|
|
@@ -1352,14 +1235,14 @@ function buildReferenceManifest(currentEntry, entries) {
|
|
|
1352
1235
|
}
|
|
1353
1236
|
});
|
|
1354
1237
|
}
|
|
1355
|
-
manifests = buildReferenceManifestFromConfig().concat(dynamicReferenceManifests).concat(manifests);
|
|
1238
|
+
manifests = buildReferenceManifestFromConfig(currentEntryName).concat(dynamicReferenceManifests).concat(manifests);
|
|
1356
1239
|
return manifests;
|
|
1357
1240
|
}
|
|
1358
1241
|
function cleanUpComposer() {
|
|
1359
1242
|
$.composers.ManifestRegistry.clearState();
|
|
1360
1243
|
}
|
|
1361
1244
|
exports.cleanUpComposer = cleanUpComposer;
|
|
1362
|
-
function buildReferenceManifestFromConfig() {
|
|
1245
|
+
function buildReferenceManifestFromConfig(entryName) {
|
|
1363
1246
|
var manifests = [];
|
|
1364
1247
|
let buildOptions = getBuildOption();
|
|
1365
1248
|
if (buildOptions.reference) {
|
|
@@ -1371,6 +1254,17 @@ function buildReferenceManifestFromConfig() {
|
|
|
1371
1254
|
}));
|
|
1372
1255
|
}
|
|
1373
1256
|
}
|
|
1257
|
+
if (!isBuildWebpackManifestOnly() && buildOptions.webpackManifests) {
|
|
1258
|
+
for (let manifestPath of buildOptions.webpackManifests) {
|
|
1259
|
+
if (manifestPath.indexOf(entryName) === -1) {
|
|
1260
|
+
manifests.push(new $.omniaWebpackPlugins.DllReferencePlugin({
|
|
1261
|
+
context: $.tooling.utils.root(""),
|
|
1262
|
+
manifest: $.tooling.utils.root(manifestPath),
|
|
1263
|
+
// name: `md${++trackingModuleRefId}` //require('md5')(manifestPath)
|
|
1264
|
+
}));
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
}
|
|
1374
1268
|
if ($.isExtensionEnv) {
|
|
1375
1269
|
_registeredReferenceManifests.forEach(manifest => {
|
|
1376
1270
|
manifests.push(new $.omniaWebpackPlugins.DllReferencePlugin({
|
|
@@ -1450,89 +1344,18 @@ function getServiceId() {
|
|
|
1450
1344
|
return serviceId;
|
|
1451
1345
|
}
|
|
1452
1346
|
exports.getServiceId = getServiceId;
|
|
1453
|
-
function
|
|
1454
|
-
let foundTypes = {};
|
|
1455
|
-
componentRegistrations.forEach((comp) => {
|
|
1456
|
-
let defPaths = comp.componentOptions.typings;
|
|
1457
|
-
if (defPaths) {
|
|
1458
|
-
let isChildSpec = false;
|
|
1459
|
-
defPaths.forEach((defPath) => {
|
|
1460
|
-
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(comp.manifestPath, [defPath])[0];
|
|
1461
|
-
let contents = $.fs.readFileSync(entryPointPath, 'utf8');
|
|
1462
|
-
let wcEl = getWcElement(contents, isChildSpec);
|
|
1463
|
-
if (wcEl) {
|
|
1464
|
-
//Now lets find the interface mapped to element
|
|
1465
|
-
//example /*@WebComponentInterface("omfx-dialog")*/
|
|
1466
|
-
let interfaceToken = `/*@WebComponentInterface("${wcEl}")*/`;
|
|
1467
|
-
let interfaceIndex = contents.indexOf(interfaceToken);
|
|
1468
|
-
if (interfaceIndex > -1) {
|
|
1469
|
-
let wcProps = [];
|
|
1470
|
-
let intf = contents.substring(interfaceIndex);
|
|
1471
|
-
let nextIsDomProp = false;
|
|
1472
|
-
intf = intf
|
|
1473
|
-
.substring(intf.indexOf("{") + 1, intf.indexOf("}"))
|
|
1474
|
-
.replace(/\?/g, '')
|
|
1475
|
-
.trim()
|
|
1476
|
-
.split(/\r\n|\r|\n/g).forEach((group) => {
|
|
1477
|
-
/*@DomProperty*/
|
|
1478
|
-
let sub = group.trim();
|
|
1479
|
-
if (sub.indexOf("/*@DomProperty*/") > -1) {
|
|
1480
|
-
nextIsDomProp = true;
|
|
1481
|
-
return;
|
|
1482
|
-
}
|
|
1483
|
-
if (nextIsDomProp) {
|
|
1484
|
-
if (sub.indexOf(':')) {
|
|
1485
|
-
sub = sub.split(':')[0];
|
|
1486
|
-
}
|
|
1487
|
-
if (sub) {
|
|
1488
|
-
if (!foundTypes[wcEl]) {
|
|
1489
|
-
foundTypes[wcEl] = [];
|
|
1490
|
-
}
|
|
1491
|
-
foundTypes[wcEl].push(sub);
|
|
1492
|
-
}
|
|
1493
|
-
nextIsDomProp = false;
|
|
1494
|
-
}
|
|
1495
|
-
});
|
|
1496
|
-
}
|
|
1497
|
-
}
|
|
1498
|
-
isChildSpec = true;
|
|
1499
|
-
});
|
|
1500
|
-
}
|
|
1501
|
-
});
|
|
1502
|
-
return foundTypes;
|
|
1503
|
-
}
|
|
1504
|
-
var lastWcElement = "";
|
|
1505
|
-
function getWcElement(contents, isChildSpec) {
|
|
1506
|
-
if (isChildSpec) {
|
|
1507
|
-
if (lastWcElement === "") {
|
|
1508
|
-
new Error("Cant find the /*@DomProperty*/ on the parent interface for the WebComponent definition");
|
|
1509
|
-
}
|
|
1510
|
-
return lastWcElement;
|
|
1511
|
-
}
|
|
1512
|
-
else {
|
|
1513
|
-
lastWcElement = "";
|
|
1514
|
-
}
|
|
1515
|
-
let wcElToken = "/*@WebComponent*/";
|
|
1516
|
-
let wcElIndex = contents.indexOf(wcElToken);
|
|
1517
|
-
let wcEl = "";
|
|
1518
|
-
if (wcElIndex > -1) {
|
|
1519
|
-
wcEl = contents.substring(wcElIndex);
|
|
1520
|
-
wcEl = wcEl.substring(wcEl.indexOf('"') + 1);
|
|
1521
|
-
wcEl = wcEl.substring(0, wcEl.indexOf('"'));
|
|
1522
|
-
lastWcElement = wcEl;
|
|
1523
|
-
}
|
|
1524
|
-
return lastWcElement;
|
|
1525
|
-
}
|
|
1526
|
-
function createVueEntryFormRegistrations(registrations) {
|
|
1347
|
+
function createVueEntryFormComponentRegistrations(registrations) {
|
|
1527
1348
|
let entryPaths = {};
|
|
1528
1349
|
for (let r of registrations) {
|
|
1529
|
-
if (r.componentOptions.entryPoint.endsWith('.
|
|
1350
|
+
if (r.componentOptions.entryPoint.endsWith('.tsx')
|
|
1351
|
+
|| r.componentOptions.entryPoint.endsWith('.vue')) {
|
|
1530
1352
|
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(r.manifestPath, [r.componentOptions.entryPoint]);
|
|
1531
1353
|
let entryId = r.manifest.resourceId;
|
|
1532
1354
|
if (r.manifest.resourceName) {
|
|
1533
1355
|
entryId = `${r.manifest.resourceName}_${entryId}`;
|
|
1534
1356
|
}
|
|
1535
|
-
|
|
1357
|
+
r.componentOptions.entryPointPath = entryPointPath[0];
|
|
1358
|
+
entryPaths[entryId.toString()] = entryPointPath;
|
|
1536
1359
|
}
|
|
1537
1360
|
else {
|
|
1538
1361
|
$.tooling.log('The OmniaFx build system only supports .jsx, .vue and .tsx based components at the moment ', $.tooling.LogTypes.Error);
|
|
@@ -1846,44 +1669,9 @@ exports.registerManifestsReference = registerManifestsReference;
|
|
|
1846
1669
|
function getRegisteredReferenceManifests() {
|
|
1847
1670
|
return _registeredReferenceManifests;
|
|
1848
1671
|
}
|
|
1849
|
-
function registerWebComponentDefinitions(definitions) {
|
|
1850
|
-
if (definitions) {
|
|
1851
|
-
_wcDefinitions = $.merge(_wcDefinitions, definitions);
|
|
1852
|
-
}
|
|
1853
|
-
}
|
|
1854
|
-
exports.registerWebComponentDefinitions = registerWebComponentDefinitions;
|
|
1855
1672
|
function sortString(a, b) {
|
|
1856
1673
|
if (a >= b) {
|
|
1857
1674
|
return 1;
|
|
1858
1675
|
}
|
|
1859
1676
|
return -1;
|
|
1860
1677
|
}
|
|
1861
|
-
function generateWebComponentTypings(wc, template) {
|
|
1862
|
-
// export default defineVueWebComponent
|
|
1863
|
-
let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
|
|
1864
|
-
let content = fsExtra.readFileSync(wcPath, 'utf8');
|
|
1865
|
-
if (content.indexOf("defineVueWebComponent") > -1) {
|
|
1866
|
-
if (!new RegExp('export\\s+default\\s+').test(content)) {
|
|
1867
|
-
throw new Error(`Missing statement 'export default a vue web component' in ${wcPath}`);
|
|
1868
|
-
}
|
|
1869
|
-
let friendlyManifestId = `wc${wc.manifest.resourceId.toString().replace(/-/g, '').toLowerCase()}`;
|
|
1870
|
-
let importPath = wcPath.substring(0, wcPath.lastIndexOf('.tsx'));
|
|
1871
|
-
if (importPath.indexOf("./") === 0) {
|
|
1872
|
-
importPath = importPath.replace("./", "");
|
|
1873
|
-
}
|
|
1874
|
-
if ($.isExtensionEnv) {
|
|
1875
|
-
importPath = `../../../../${importPath}`;
|
|
1876
|
-
}
|
|
1877
|
-
else {
|
|
1878
|
-
importPath = `../../../${importPath}`;
|
|
1879
|
-
}
|
|
1880
|
-
return template
|
|
1881
|
-
.replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
|
|
1882
|
-
//{{importWC}}`)
|
|
1883
|
-
.replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": typeof ${friendlyManifestId}.propsDefinition & VueComponentBaseProps
|
|
1884
|
-
//{{elementName}}`)
|
|
1885
|
-
.replace(/\/\/{{omfxelementName}}/, `"${wc.componentOptions.elementName.replace("omfx-", "").replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); })}": typeof ${friendlyManifestId} & VueComponentBaseProps
|
|
1886
|
-
//{{omfxelementName}}`);
|
|
1887
|
-
}
|
|
1888
|
-
return template;
|
|
1889
|
-
}
|