@omnia/tooling-vue 8.0.37-vnext → 8.0.38-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.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 +2339 -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 +95 -153
- package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +1 -1
- package/internal-do-not-import-from-here/tasks/bundle.d.ts +2 -3
- package/internal-do-not-import-from-here/tasks/bundle.js +145 -364
- package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
- package/internal-do-not-import-from-here/tasks/doc.js +282 -395
- package/internal-do-not-import-from-here/tasks/vendor.js +5 -3
- 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/hmr/runtime.js +3 -3
- package/internal-do-not-import-from-here/vite/hmr/utils/webpack.js +2 -2
- package/internal-do-not-import-from-here/vite/middlewares/HmrMiddleware.js +2 -2
- package/internal-do-not-import-from-here/vite/middlewares/OmniaMiddleware.js +44 -11
- 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 +6 -5
- package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -477
- 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,232 +257,6 @@ function buildEntries(serve = false) {
|
|
|
257
257
|
}
|
|
258
258
|
});
|
|
259
259
|
}
|
|
260
|
-
async function generateComponentTypingsAndDoc(componentRegistrations) {
|
|
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
|
-
// console.log(
|
|
327
|
-
// ce.typeArguments.params[0],
|
|
328
|
-
// ce.typeArguments.params[0].typeAnnotation?.typeAnnotation,
|
|
329
|
-
// )
|
|
330
|
-
result.type = DefineVueType.Prop;
|
|
331
|
-
result.propertyTypeAsString = getPropertyType(ce.typeArguments.params[0]);
|
|
332
|
-
break;
|
|
333
|
-
case "emit":
|
|
334
|
-
result.type = DefineVueType.Emit;
|
|
335
|
-
result.propertyTypeAsString = getPropertyType(ce.typeArguments.params[0]);
|
|
336
|
-
break;
|
|
337
|
-
default:
|
|
338
|
-
getNameProperty(ce.callee.object, result);
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
}
|
|
342
|
-
async function buildDoc(wc) {
|
|
343
|
-
try {
|
|
344
|
-
const wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
|
|
345
|
-
const wcParseResult = await (0, core_1.parseFile)(wcPath, {
|
|
346
|
-
syntax: 'typescript',
|
|
347
|
-
target: 'es2020',
|
|
348
|
-
tsx: true,
|
|
349
|
-
decorators: true,
|
|
350
|
-
dynamicImport: true
|
|
351
|
-
});
|
|
352
|
-
wcParseResult.body.forEach(b => {
|
|
353
|
-
if (b.type === 'ExportDefaultExpression'
|
|
354
|
-
&& b.expression.callee?.value === "defineVueWebComponent") {
|
|
355
|
-
b.expression.arguments[0].expression
|
|
356
|
-
.properties?.filter(p => p.key.value === "props"
|
|
357
|
-
|| p.key.value === "emits")
|
|
358
|
-
?.forEach(propsIdentifier => {
|
|
359
|
-
if (propsIdentifier) {
|
|
360
|
-
propsIdentifier.value
|
|
361
|
-
.properties?.forEach(p => {
|
|
362
|
-
const em = p.arguments;
|
|
363
|
-
if (em?.callee?.property?.value === "doc$") {
|
|
364
|
-
const PropertyResult = {
|
|
365
|
-
type: null,
|
|
366
|
-
propertyTypeAsString: "",
|
|
367
|
-
name: ""
|
|
368
|
-
};
|
|
369
|
-
getNameProperty(em, PropertyResult);
|
|
370
|
-
if (!docResult[wc.componentOptions.elementName]) {
|
|
371
|
-
docResult[wc.componentOptions.elementName] = {
|
|
372
|
-
emits: {},
|
|
373
|
-
models: {},
|
|
374
|
-
props: {},
|
|
375
|
-
slots: {}
|
|
376
|
-
};
|
|
377
|
-
}
|
|
378
|
-
switch (PropertyResult.type) {
|
|
379
|
-
case DefineVueType.Prop:
|
|
380
|
-
docResult[wc.componentOptions.elementName].props[PropertyResult.name] = {
|
|
381
|
-
type: PropertyResult.propertyTypeAsString,
|
|
382
|
-
description: em.arguments[0].expression.value
|
|
383
|
-
};
|
|
384
|
-
break;
|
|
385
|
-
case DefineVueType.Model:
|
|
386
|
-
docResult[wc.componentOptions.elementName].models[PropertyResult.name] = {
|
|
387
|
-
type: PropertyResult.propertyTypeAsString,
|
|
388
|
-
description: em.arguments[0].expression.value
|
|
389
|
-
};
|
|
390
|
-
break;
|
|
391
|
-
case DefineVueType.Emit:
|
|
392
|
-
docResult[wc.componentOptions.elementName].emits[PropertyResult.name] = {
|
|
393
|
-
type: PropertyResult.propertyTypeAsString,
|
|
394
|
-
description: em.arguments[0].expression.value
|
|
395
|
-
};
|
|
396
|
-
break;
|
|
397
|
-
case DefineVueType.Slot:
|
|
398
|
-
em.arguments[0].expression
|
|
399
|
-
.properties
|
|
400
|
-
.forEach(p => {
|
|
401
|
-
const slotName = p.key.value;
|
|
402
|
-
docResult[wc.componentOptions.elementName].slots[slotName] = {
|
|
403
|
-
type: PropertyResult.propertyTypeAsObject[slotName],
|
|
404
|
-
description: p.value.value
|
|
405
|
-
};
|
|
406
|
-
});
|
|
407
|
-
break;
|
|
408
|
-
default:
|
|
409
|
-
break;
|
|
410
|
-
}
|
|
411
|
-
}
|
|
412
|
-
});
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
});
|
|
417
|
-
}
|
|
418
|
-
catch (ex) {
|
|
419
|
-
tooling_1.utils.log(`Have a exception when extract doc$ for web component manifest -> ${wc.manifestPath}`, tooling_1.utils.LogTypes.Error);
|
|
420
|
-
console.error(ex);
|
|
421
|
-
throw new Error("Exit, have an exception.");
|
|
422
|
-
}
|
|
423
|
-
}
|
|
424
|
-
let wcTypingsPath = "", docPath = $.path.resolve(__dirname, "ComponentDocRegistrations.ts");
|
|
425
|
-
;
|
|
426
|
-
if ($.isExtensionEnv) {
|
|
427
|
-
wcTypingsPath = $.path.resolve(__dirname, "../wctypings.ts");
|
|
428
|
-
}
|
|
429
|
-
else {
|
|
430
|
-
wcTypingsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wctypings.ts`);
|
|
431
|
-
}
|
|
432
|
-
let wcTypings = `
|
|
433
|
-
//{{importWC}}
|
|
434
|
-
declare global {
|
|
435
|
-
namespace JSX {
|
|
436
|
-
interface Element { }
|
|
437
|
-
interface ElementClass { }
|
|
438
|
-
|
|
439
|
-
interface IntrinsicElements {
|
|
440
|
-
//{{elementName}}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
`;
|
|
445
|
-
if ($.isExtensionEnv) {
|
|
446
|
-
wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
|
|
447
|
-
${wcTypings}`;
|
|
448
|
-
}
|
|
449
|
-
else {
|
|
450
|
-
wcTypings = `import { VueComponentBaseProps } from "../../../client/fx/ux/index";
|
|
451
|
-
${wcTypings}`;
|
|
452
|
-
}
|
|
453
|
-
await tooling_1.utils.asyncForEach(componentRegistrations, async (wc) => {
|
|
454
|
-
wcTypings = generateWebComponentTypings(wc, wcTypings);
|
|
455
|
-
await buildDoc(wc);
|
|
456
|
-
});
|
|
457
|
-
if (Object.keys(docResult).length > 0) {
|
|
458
|
-
fsExtra.outputFileSync(docPath, `
|
|
459
|
-
import { extendApi } from "@omnia/fx";
|
|
460
|
-
import { ComponentDoc } from "@omnia/fx-models";
|
|
461
|
-
|
|
462
|
-
extendApi(api => api.fx.docs.registrations, api => {
|
|
463
|
-
|
|
464
|
-
const registrations: { [elementName: string]: ComponentDoc } = ${JSON.stringify(docResult)}
|
|
465
|
-
|
|
466
|
-
Object.keys(registrations).forEach(elementName => {
|
|
467
|
-
api.register(elementName, registrations[elementName]);
|
|
468
|
-
});
|
|
469
|
-
});
|
|
470
|
-
`);
|
|
471
|
-
// create dynamic doc manifest
|
|
472
|
-
$.composers.ManifestRegistry.setCurrentManifestPath(`${path_1.default.relative(tooling_1.utils.root(""), path_1.default.resolve(__dirname))}/`);
|
|
473
|
-
$.composers
|
|
474
|
-
.Composer
|
|
475
|
-
.registerManifest(getBuildOption().dynamicDocManifestId || new fx_models_1.Guid(`${tooling_1.utils.generateGuid()}`), "omnia.fx.docs.components.registraions")
|
|
476
|
-
.registerResources({
|
|
477
|
-
resourcePaths: ["./ComponentDocRegistrations.ts"]
|
|
478
|
-
})
|
|
479
|
-
.withTarget(fx_models_1.ClientManifestTargetTypes.Docs)
|
|
480
|
-
.extendApi(api => api.fx.docs.registrations);
|
|
481
|
-
$.composers.ManifestRegistry.setCurrentManifestPath();
|
|
482
|
-
}
|
|
483
|
-
fsExtra.outputFileSync(wcTypingsPath, wcTypings);
|
|
484
|
-
tooling_1.utils.logTime('Done - Generate components typings and documentation', startTime);
|
|
485
|
-
}
|
|
486
260
|
function buildManifestMetadatas(entries) {
|
|
487
261
|
return new Promise(function (resolve, reject) {
|
|
488
262
|
try {
|
|
@@ -790,7 +564,7 @@ function minifyBundles() {
|
|
|
790
564
|
}
|
|
791
565
|
});
|
|
792
566
|
}
|
|
793
|
-
function createVueWebpackConfig(currentEntry, entries, bundleOutputDir,
|
|
567
|
+
function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrOption) {
|
|
794
568
|
let buildOption = getBuildOption() || {};
|
|
795
569
|
let isBundleCommonChunk = buildOption.bundleOptions && buildOption.bundleOptions.commonsChunk && buildOption.bundleOptions.commonsChunk.name;
|
|
796
570
|
const extractCss = new MiniCssExtractPlugin({
|
|
@@ -895,7 +669,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
895
669
|
mangleExports: false,
|
|
896
670
|
concatenateModules: true,
|
|
897
671
|
//moduleIds: 'natural' as any
|
|
898
|
-
}, isBundleCommonChunk ? buildCommonChunk(entry) : {}),
|
|
672
|
+
}, isBundleCommonChunk && !viteHmrOption ? buildCommonChunk(entry) : {}),
|
|
899
673
|
resolve: {
|
|
900
674
|
modules: $.tooling.core.getWebpackResolveModules(),
|
|
901
675
|
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.html', '.vue', '.less', '.styl'],
|
|
@@ -1057,7 +831,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
|
|
|
1057
831
|
exports.createVueWebpackConfig = createVueWebpackConfig;
|
|
1058
832
|
function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
1059
833
|
var entensionId = getServiceId();
|
|
1060
|
-
return Object.assign({},
|
|
834
|
+
return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
|
|
1061
835
|
plugins: [
|
|
1062
836
|
...buildReferenceManifestFromConfig(),
|
|
1063
837
|
new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
|
|
@@ -1069,6 +843,117 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
|
|
|
1069
843
|
]
|
|
1070
844
|
});
|
|
1071
845
|
}
|
|
846
|
+
function getBaseWebpackConfigForManifestMetadata(entry, bundleOutputDir) {
|
|
847
|
+
return {
|
|
848
|
+
devtool: false,
|
|
849
|
+
mode: 'development',
|
|
850
|
+
context: $.tooling.utils.root(""),
|
|
851
|
+
entry: entry,
|
|
852
|
+
optimization: Object.assign({
|
|
853
|
+
removeAvailableModules: false,
|
|
854
|
+
removeEmptyChunks: false,
|
|
855
|
+
splitChunks: false,
|
|
856
|
+
}),
|
|
857
|
+
resolve: {
|
|
858
|
+
modules: $.tooling.core.getWebpackResolveModules(),
|
|
859
|
+
extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
|
|
860
|
+
//extensions: ['.js', '.jsx', '.ts', '.tsx', '.html', '.vue', '.less', '.styl'],
|
|
861
|
+
symlinks: false,
|
|
862
|
+
cacheWithContext: true,
|
|
863
|
+
descriptionFiles: ['package.json'],
|
|
864
|
+
alias: Object.assign({}, $.tooling.core.getWebpackResolveAlias(), ($.composers.BuildConfigurationRegistry.getBuildOptions()?.moduleOptions?.alias || {}), {
|
|
865
|
+
'axios$': 'axios/dist/axios.js',
|
|
866
|
+
'typestyle$': 'typestyle/lib.es2015/index.js',
|
|
867
|
+
'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
|
|
868
|
+
'@microsoft/signalr': '@microsoft/signalr/dist/webworker/signalr.js',
|
|
869
|
+
}),
|
|
870
|
+
//mainFields: ['main', 'browser', 'module']
|
|
871
|
+
},
|
|
872
|
+
output: {
|
|
873
|
+
pathinfo: false,
|
|
874
|
+
path: $.tooling.utils.root(bundleOutputDir),
|
|
875
|
+
filename: '[name].js'
|
|
876
|
+
},
|
|
877
|
+
externals: [
|
|
878
|
+
function ({ context, request }, callback) {
|
|
879
|
+
if (request.indexOf("node_modules") > -1 || (/\.(sass|scss|styl|less|css)$/i).test(request)) {
|
|
880
|
+
return callback(null, 'commonjs ' + request);
|
|
881
|
+
}
|
|
882
|
+
callback();
|
|
883
|
+
}
|
|
884
|
+
],
|
|
885
|
+
module: {
|
|
886
|
+
noParse: /wwwroot(.*)/,
|
|
887
|
+
rules: [
|
|
888
|
+
{
|
|
889
|
+
test: /\.m?js$/,
|
|
890
|
+
resolve: {
|
|
891
|
+
fullySpecified: false, // disable the behaviour
|
|
892
|
+
},
|
|
893
|
+
},
|
|
894
|
+
...(0, ts_loader_1.default)(),
|
|
895
|
+
...(0, tsx_loader_1.default)(),
|
|
896
|
+
{
|
|
897
|
+
test: /\.styl$/,
|
|
898
|
+
use: [
|
|
899
|
+
//'style-loader',
|
|
900
|
+
//'css-loader',
|
|
901
|
+
'stylus-loader'
|
|
902
|
+
]
|
|
903
|
+
},
|
|
904
|
+
...($.isExtensionEnv ? [] : [{
|
|
905
|
+
test: /\.s(c|a)ss$/,
|
|
906
|
+
use: [
|
|
907
|
+
{
|
|
908
|
+
loader: 'sass-loader',
|
|
909
|
+
options: {
|
|
910
|
+
implementation: require('sass'),
|
|
911
|
+
sassOptions: {
|
|
912
|
+
//fiber: require('fibers'),
|
|
913
|
+
indentedSyntax: true
|
|
914
|
+
}
|
|
915
|
+
//fiber: require('fibers')
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
]
|
|
919
|
+
}]),
|
|
920
|
+
{
|
|
921
|
+
test: /\.less$/,
|
|
922
|
+
use: [
|
|
923
|
+
//'style-loader',
|
|
924
|
+
//'css-loader',
|
|
925
|
+
'less-loader'
|
|
926
|
+
]
|
|
927
|
+
},
|
|
928
|
+
{
|
|
929
|
+
test: /\.css$/,
|
|
930
|
+
use: [
|
|
931
|
+
//'style-loader',
|
|
932
|
+
{
|
|
933
|
+
loader: 'css-loader'
|
|
934
|
+
}
|
|
935
|
+
]
|
|
936
|
+
},
|
|
937
|
+
{
|
|
938
|
+
test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
|
|
939
|
+
loader: 'url-loader'
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
test: /\.(ico|gif|png|jpe?g|svg)$/i,
|
|
943
|
+
use: [{
|
|
944
|
+
loader: 'file-loader',
|
|
945
|
+
options: {
|
|
946
|
+
name: '[name].[ext]',
|
|
947
|
+
outputPath: "../images/",
|
|
948
|
+
publicPath: '/omnia/images/'
|
|
949
|
+
}
|
|
950
|
+
}]
|
|
951
|
+
//loader: 'url-loader'
|
|
952
|
+
}
|
|
953
|
+
]
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
}
|
|
1072
957
|
function buildCommonChunk(entry) {
|
|
1073
958
|
let bundleOptions = getBuildOption().bundleOptions;
|
|
1074
959
|
let minChunk = bundleOptions.commonsChunk.minChunks || 2;
|
|
@@ -1435,89 +1320,18 @@ function getServiceId() {
|
|
|
1435
1320
|
return serviceId;
|
|
1436
1321
|
}
|
|
1437
1322
|
exports.getServiceId = getServiceId;
|
|
1438
|
-
function
|
|
1439
|
-
let foundTypes = {};
|
|
1440
|
-
componentRegistrations.forEach((comp) => {
|
|
1441
|
-
let defPaths = comp.componentOptions.typings;
|
|
1442
|
-
if (defPaths) {
|
|
1443
|
-
let isChildSpec = false;
|
|
1444
|
-
defPaths.forEach((defPath) => {
|
|
1445
|
-
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(comp.manifestPath, [defPath])[0];
|
|
1446
|
-
let contents = $.fs.readFileSync(entryPointPath, 'utf8');
|
|
1447
|
-
let wcEl = getWcElement(contents, isChildSpec);
|
|
1448
|
-
if (wcEl) {
|
|
1449
|
-
//Now lets find the interface mapped to element
|
|
1450
|
-
//example /*@WebComponentInterface("omfx-dialog")*/
|
|
1451
|
-
let interfaceToken = `/*@WebComponentInterface("${wcEl}")*/`;
|
|
1452
|
-
let interfaceIndex = contents.indexOf(interfaceToken);
|
|
1453
|
-
if (interfaceIndex > -1) {
|
|
1454
|
-
let wcProps = [];
|
|
1455
|
-
let intf = contents.substring(interfaceIndex);
|
|
1456
|
-
let nextIsDomProp = false;
|
|
1457
|
-
intf = intf
|
|
1458
|
-
.substring(intf.indexOf("{") + 1, intf.indexOf("}"))
|
|
1459
|
-
.replace(/\?/g, '')
|
|
1460
|
-
.trim()
|
|
1461
|
-
.split(/\r\n|\r|\n/g).forEach((group) => {
|
|
1462
|
-
/*@DomProperty*/
|
|
1463
|
-
let sub = group.trim();
|
|
1464
|
-
if (sub.indexOf("/*@DomProperty*/") > -1) {
|
|
1465
|
-
nextIsDomProp = true;
|
|
1466
|
-
return;
|
|
1467
|
-
}
|
|
1468
|
-
if (nextIsDomProp) {
|
|
1469
|
-
if (sub.indexOf(':')) {
|
|
1470
|
-
sub = sub.split(':')[0];
|
|
1471
|
-
}
|
|
1472
|
-
if (sub) {
|
|
1473
|
-
if (!foundTypes[wcEl]) {
|
|
1474
|
-
foundTypes[wcEl] = [];
|
|
1475
|
-
}
|
|
1476
|
-
foundTypes[wcEl].push(sub);
|
|
1477
|
-
}
|
|
1478
|
-
nextIsDomProp = false;
|
|
1479
|
-
}
|
|
1480
|
-
});
|
|
1481
|
-
}
|
|
1482
|
-
}
|
|
1483
|
-
isChildSpec = true;
|
|
1484
|
-
});
|
|
1485
|
-
}
|
|
1486
|
-
});
|
|
1487
|
-
return foundTypes;
|
|
1488
|
-
}
|
|
1489
|
-
var lastWcElement = "";
|
|
1490
|
-
function getWcElement(contents, isChildSpec) {
|
|
1491
|
-
if (isChildSpec) {
|
|
1492
|
-
if (lastWcElement === "") {
|
|
1493
|
-
new Error("Cant find the /*@DomProperty*/ on the parent interface for the WebComponent definition");
|
|
1494
|
-
}
|
|
1495
|
-
return lastWcElement;
|
|
1496
|
-
}
|
|
1497
|
-
else {
|
|
1498
|
-
lastWcElement = "";
|
|
1499
|
-
}
|
|
1500
|
-
let wcElToken = "/*@WebComponent*/";
|
|
1501
|
-
let wcElIndex = contents.indexOf(wcElToken);
|
|
1502
|
-
let wcEl = "";
|
|
1503
|
-
if (wcElIndex > -1) {
|
|
1504
|
-
wcEl = contents.substring(wcElIndex);
|
|
1505
|
-
wcEl = wcEl.substring(wcEl.indexOf('"') + 1);
|
|
1506
|
-
wcEl = wcEl.substring(0, wcEl.indexOf('"'));
|
|
1507
|
-
lastWcElement = wcEl;
|
|
1508
|
-
}
|
|
1509
|
-
return lastWcElement;
|
|
1510
|
-
}
|
|
1511
|
-
function createVueEntryFormRegistrations(registrations) {
|
|
1323
|
+
function createVueEntryFormComponentRegistrations(registrations) {
|
|
1512
1324
|
let entryPaths = {};
|
|
1513
1325
|
for (let r of registrations) {
|
|
1514
|
-
if (r.componentOptions.entryPoint.endsWith('.
|
|
1326
|
+
if (r.componentOptions.entryPoint.endsWith('.tsx')
|
|
1327
|
+
|| r.componentOptions.entryPoint.endsWith('.vue')) {
|
|
1515
1328
|
let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(r.manifestPath, [r.componentOptions.entryPoint]);
|
|
1516
1329
|
let entryId = r.manifest.resourceId;
|
|
1517
1330
|
if (r.manifest.resourceName) {
|
|
1518
1331
|
entryId = `${r.manifest.resourceName}_${entryId}`;
|
|
1519
1332
|
}
|
|
1520
|
-
|
|
1333
|
+
r.componentOptions.entryPointPath = entryPointPath[0];
|
|
1334
|
+
entryPaths[entryId.toString()] = entryPointPath;
|
|
1521
1335
|
}
|
|
1522
1336
|
else {
|
|
1523
1337
|
$.tooling.log('The OmniaFx build system only supports .jsx, .vue and .tsx based components at the moment ', $.tooling.LogTypes.Error);
|
|
@@ -1831,42 +1645,9 @@ exports.registerManifestsReference = registerManifestsReference;
|
|
|
1831
1645
|
function getRegisteredReferenceManifests() {
|
|
1832
1646
|
return _registeredReferenceManifests;
|
|
1833
1647
|
}
|
|
1834
|
-
function registerWebComponentDefinitions(definitions) {
|
|
1835
|
-
if (definitions) {
|
|
1836
|
-
_wcDefinitions = $.merge(_wcDefinitions, definitions);
|
|
1837
|
-
}
|
|
1838
|
-
}
|
|
1839
|
-
exports.registerWebComponentDefinitions = registerWebComponentDefinitions;
|
|
1840
1648
|
function sortString(a, b) {
|
|
1841
1649
|
if (a >= b) {
|
|
1842
1650
|
return 1;
|
|
1843
1651
|
}
|
|
1844
1652
|
return -1;
|
|
1845
1653
|
}
|
|
1846
|
-
function generateWebComponentTypings(wc, template) {
|
|
1847
|
-
// export default defineVueWebComponent
|
|
1848
|
-
let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
|
|
1849
|
-
let content = fsExtra.readFileSync(wcPath, 'utf8');
|
|
1850
|
-
if (content.indexOf("defineVueWebComponent") > -1) {
|
|
1851
|
-
if (!new RegExp('export\\s+default\\s+').test(content)) {
|
|
1852
|
-
throw new Error(`Missing statement 'export default a vue web component' in ${wcPath}`);
|
|
1853
|
-
}
|
|
1854
|
-
let friendlyManifestId = `wc${wc.manifest.resourceId.toString().replace(/-/g, '').toLowerCase()}`;
|
|
1855
|
-
let importPath = wcPath.substring(0, wcPath.lastIndexOf('.tsx'));
|
|
1856
|
-
if (importPath.indexOf("./") === 0) {
|
|
1857
|
-
importPath = importPath.replace("./", "");
|
|
1858
|
-
}
|
|
1859
|
-
if ($.isExtensionEnv) {
|
|
1860
|
-
importPath = `../../../../${importPath}`;
|
|
1861
|
-
}
|
|
1862
|
-
else {
|
|
1863
|
-
importPath = `../../../${importPath}`;
|
|
1864
|
-
}
|
|
1865
|
-
return template
|
|
1866
|
-
.replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
|
|
1867
|
-
//{{importWC}}`)
|
|
1868
|
-
.replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": typeof ${friendlyManifestId}.propsDefinition & VueComponentBaseProps
|
|
1869
|
-
//{{elementName}}`);
|
|
1870
|
-
}
|
|
1871
|
-
return template;
|
|
1872
|
-
}
|
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { ComponentRegistration } from "@omnia/tooling-composers";
|
|
2
|
+
export declare function generateComponentTypingsAndDoc(componentRegistrations: ComponentRegistration[]): Promise<void>;
|
|
3
|
+
export declare function importSnippetCode(content: string, filePath: string): string;
|