@omnia/tooling-vue 8.0.72-vnext → 8.0.73-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.
Files changed (35) hide show
  1. package/internal-do-not-import-from-here/config/omnia.fx.core_a2892051-fd9f-4056-ae8d-30d16d48417d.manifest.json +1 -0
  2. package/internal-do-not-import-from-here/config/omnia.fx.ux_dee030cc-4ab3-4158-bb06-8049f5c67542.manifest.json +1 -0
  3. package/internal-do-not-import-from-here/config/omnia.fx_a5a89056-b5f5-475d-8518-a1f55090379d.manifest.json +1 -0
  4. package/internal-do-not-import-from-here/config/omnia.vendor.manifest.json +1 -1
  5. package/internal-do-not-import-from-here/config/tooling.output.json +1 -0
  6. package/internal-do-not-import-from-here/config/wctypings.d.ts +2598 -0
  7. package/internal-do-not-import-from-here/index.d.ts +3 -1
  8. package/internal-do-not-import-from-here/index.js +6 -2
  9. package/internal-do-not-import-from-here/shared.d.ts +31 -118
  10. package/internal-do-not-import-from-here/shared.js +95 -153
  11. package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +1 -1
  12. package/internal-do-not-import-from-here/tasks/bundle.d.ts +1 -2
  13. package/internal-do-not-import-from-here/tasks/bundle.js +179 -370
  14. package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
  15. package/internal-do-not-import-from-here/tasks/doc.js +282 -395
  16. package/internal-do-not-import-from-here/tasks/vendor.js +16 -12
  17. package/internal-do-not-import-from-here/variables.d.ts +1 -1
  18. package/internal-do-not-import-from-here/variables.js +2 -2
  19. package/internal-do-not-import-from-here/vite/hmr/graph.js +4 -0
  20. package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +1 -1
  21. package/internal-do-not-import-from-here/wctypings.ts +0 -0
  22. package/internal-do-not-import-from-here/webpack-loaders/doc-loader.js +11 -0
  23. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +3 -3
  24. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +3 -3
  25. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +3 -0
  26. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +3 -0
  27. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.d.ts +1 -0
  28. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +11 -0
  29. package/package.json +5 -4
  30. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -493
  31. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +0 -13
  32. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.d.ts +0 -1
  33. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.js +0 -10
  34. /package/internal-do-not-import-from-here/{bb000000-0000-bbbb-0000-0000000000bb.wctypings.js → config/wctypings.js} +0 -0
  35. /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.registerWebComponentDefinitions = exports.registerManifestsReference = exports.createCombinedManfest = exports.createVueWebpackConfig = exports.cleanUpComposer = exports.getBuildOption = exports.getServiceId = exports.bundleManifest = exports.ensureManifestDependencyInRuntime = void 0;
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 core_1 = require("@swc/core");
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 = [], _wcDefinitions = {};
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
- let startTime = new Date().getTime();
44
- tooling_1.utils.log("Typescript checking...");
45
- const spawn = require("child_process").spawn;
46
- spawn("node", [path_1.default.resolve(__dirname, "./tsc.js")], { stdio: "inherit", })
47
- .on('exit', (code) => {
48
- if (code == 0) {
49
- tooling_1.utils.logTime('Done - Typescript', startTime);
50
- resolve(result);
51
- }
52
- else {
53
- process.exit(code);
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
- if ($.isExtensionEnv) {
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,229 +257,7 @@ 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
- 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 = `
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
- if ($.isExtensionEnv) {
442
- wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
443
- ${wcTypings}`;
444
- }
445
- else {
446
- wcTypings = `import { VueComponentBaseProps } from "../../../client/fx/ux/index";
447
- ${wcTypings}`;
448
- }
449
- await tooling_1.utils.asyncForEach(componentRegistrations, async (wc) => {
450
- wcTypings = generateWebComponentTypings(wc, wcTypings);
451
- await buildDoc(wc);
452
- });
453
- if (Object.keys(docResult).length > 0) {
454
- fsExtra.outputFileSync(docPath, `
455
- import { extendApi } from "@omnia/fx";
456
- import { ComponentDoc } from "@omnia/fx-models";
457
-
458
- extendApi(api => api.fx.docs.registrations, api => {
459
-
460
- const registrations: { [elementName: string]: ComponentDoc } = ${JSON.stringify(docResult)}
461
-
462
- Object.keys(registrations).forEach(elementName => {
463
- api.register(elementName, registrations[elementName]);
464
- });
465
- });
466
- `);
467
- // create dynamic doc manifest
468
- $.composers.ManifestRegistry.setCurrentManifestPath(`${path_1.default.relative(tooling_1.utils.root(""), path_1.default.resolve(__dirname))}/`);
469
- $.composers
470
- .Composer
471
- .registerManifest(getBuildOption().dynamicDocManifestId || new fx_models_1.Guid(`${tooling_1.utils.generateGuid()}`), "omnia.fx.docs.components.registraions")
472
- .registerResources({
473
- resourcePaths: ["./ComponentDocRegistrations.ts"]
474
- })
475
- .withTarget(fx_models_1.ClientManifestTargetTypes.Docs)
476
- .extendApi(api => api.fx.docs.registrations);
477
- $.composers.ManifestRegistry.setCurrentManifestPath();
478
- }
479
- fsExtra.outputFileSync(wcTypingsPath, wcTypings);
480
- tooling_1.utils.logTime('Done - Generate components typings and documentation', startTime);
481
- }
482
- function buildManifestMetadatas(entries) {
260
+ function buildManifestMetadata(entries) {
483
261
  return new Promise(function (resolve, reject) {
484
262
  try {
485
263
  var startTime = new Date().getTime();
@@ -566,7 +344,7 @@ function beforeBundleManifest(entries) {
566
344
  // isRunBuildMetadata = !isEqual(entries, cachedEntries);
567
345
  // }
568
346
  // }
569
- if ($.fs.existsSync(cachedEntriesPath)) {
347
+ if (!isBuildWebpackManifestOnly() && $.fs.existsSync(cachedEntriesPath)) {
570
348
  let cachedEntries = require(cachedEntriesPath);
571
349
  isRunBuildMetadata = !isEqual(entries, cachedEntries);
572
350
  }
@@ -598,9 +376,14 @@ function beforeBundleManifest(entries) {
598
376
  fsExtra.writeJsonSync(manifestPath, content);
599
377
  }
600
378
  });
601
- buildManifestMetadatas(entriesToBuild).then(() => {
379
+ buildManifestMetadata(entriesToBuild).then(() => {
602
380
  fsExtra.ensureFileSync(cachedEntriesPath);
603
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
+ }
604
387
  resolve(entries);
605
388
  });
606
389
  }
@@ -740,6 +523,9 @@ function afterGenerateManifestsMetadata() {
740
523
  .then(resolve, reject);
741
524
  });
742
525
  }
526
+ function isBuildWebpackManifestOnly() {
527
+ return process.argv?.find(argv => argv === "--webpackManifest") !== undefined;
528
+ }
743
529
  function minifyBundles() {
744
530
  return new Promise(function (resolve, reject) {
745
531
  if (process.argv.length > 0 && process.argv.find(argv => argv === "--minify") !== undefined) {
@@ -905,7 +691,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
905
691
  '@microsoft/signalr$': '@microsoft/signalr/dist/webworker/signalr.js',
906
692
  }),
907
693
  },
908
- target: ['web', 'es2022'],
694
+ target: ['web', 'es2022'], // Will change ES6 when stop support IE11
909
695
  output: {
910
696
  //library: {
911
697
  // type: "umd"
@@ -1053,9 +839,9 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
1053
839
  exports.createVueWebpackConfig = createVueWebpackConfig;
1054
840
  function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
1055
841
  var entensionId = getServiceId();
1056
- return Object.assign({}, (0, shared_1.getBaseWebpackConfigForManifestMetadata)(entry, metadataOutputDir), {
842
+ return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
1057
843
  plugins: [
1058
- ...buildReferenceManifestFromConfig(),
844
+ ...buildReferenceManifestFromConfig(Object.keys(entry)[0]),
1059
845
  new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
1060
846
  new $.webpack.DllPlugin({
1061
847
  entryOnly: false,
@@ -1065,6 +851,117 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
1065
851
  ]
1066
852
  });
1067
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
+ }
1068
965
  function buildCommonChunk(entry) {
1069
966
  let bundleOptions = getBuildOption().bundleOptions;
1070
967
  let minChunk = bundleOptions.commonsChunk.minChunks || 2;
@@ -1314,12 +1211,17 @@ function buildReferenceManifest(currentEntry, entries) {
1314
1211
  var manifests = [];
1315
1212
  var dynamicReferenceManifests = [];
1316
1213
  let buildOptions = getBuildOption();
1317
- if (buildOptions && buildOptions.bundleOptions && buildOptions.bundleOptions.commonsChunk)
1318
- return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig());
1319
1214
  var currentEntryName = Object.keys(currentEntry)[0];
1320
- // exclude omnia vendor
1321
- if (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
1322
- && currentEntryName.indexOf(vendorProdId) === -1) {
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
+ )) {
1323
1225
  Object.keys(entries).forEach((entryName) => {
1324
1226
  if (entryName !== currentEntryName) {
1325
1227
  if ($.fs.existsSync($.tooling.utils.root(outDirManifestMetadata + "/" + entryName + ".manifest.json"))) {
@@ -1333,14 +1235,14 @@ function buildReferenceManifest(currentEntry, entries) {
1333
1235
  }
1334
1236
  });
1335
1237
  }
1336
- manifests = buildReferenceManifestFromConfig().concat(dynamicReferenceManifests).concat(manifests);
1238
+ manifests = buildReferenceManifestFromConfig(currentEntryName).concat(dynamicReferenceManifests).concat(manifests);
1337
1239
  return manifests;
1338
1240
  }
1339
1241
  function cleanUpComposer() {
1340
1242
  $.composers.ManifestRegistry.clearState();
1341
1243
  }
1342
1244
  exports.cleanUpComposer = cleanUpComposer;
1343
- function buildReferenceManifestFromConfig() {
1245
+ function buildReferenceManifestFromConfig(entryName) {
1344
1246
  var manifests = [];
1345
1247
  let buildOptions = getBuildOption();
1346
1248
  if (buildOptions.reference) {
@@ -1352,6 +1254,17 @@ function buildReferenceManifestFromConfig() {
1352
1254
  }));
1353
1255
  }
1354
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
+ }
1355
1268
  if ($.isExtensionEnv) {
1356
1269
  _registeredReferenceManifests.forEach(manifest => {
1357
1270
  manifests.push(new $.omniaWebpackPlugins.DllReferencePlugin({
@@ -1431,89 +1344,18 @@ function getServiceId() {
1431
1344
  return serviceId;
1432
1345
  }
1433
1346
  exports.getServiceId = getServiceId;
1434
- function extractTypingsForComponents(componentRegistrations) {
1435
- let foundTypes = {};
1436
- componentRegistrations.forEach((comp) => {
1437
- let defPaths = comp.componentOptions.typings;
1438
- if (defPaths) {
1439
- let isChildSpec = false;
1440
- defPaths.forEach((defPath) => {
1441
- let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(comp.manifestPath, [defPath])[0];
1442
- let contents = $.fs.readFileSync(entryPointPath, 'utf8');
1443
- let wcEl = getWcElement(contents, isChildSpec);
1444
- if (wcEl) {
1445
- //Now lets find the interface mapped to element
1446
- //example /*@WebComponentInterface("omfx-dialog")*/
1447
- let interfaceToken = `/*@WebComponentInterface("${wcEl}")*/`;
1448
- let interfaceIndex = contents.indexOf(interfaceToken);
1449
- if (interfaceIndex > -1) {
1450
- let wcProps = [];
1451
- let intf = contents.substring(interfaceIndex);
1452
- let nextIsDomProp = false;
1453
- intf = intf
1454
- .substring(intf.indexOf("{") + 1, intf.indexOf("}"))
1455
- .replace(/\?/g, '')
1456
- .trim()
1457
- .split(/\r\n|\r|\n/g).forEach((group) => {
1458
- /*@DomProperty*/
1459
- let sub = group.trim();
1460
- if (sub.indexOf("/*@DomProperty*/") > -1) {
1461
- nextIsDomProp = true;
1462
- return;
1463
- }
1464
- if (nextIsDomProp) {
1465
- if (sub.indexOf(':')) {
1466
- sub = sub.split(':')[0];
1467
- }
1468
- if (sub) {
1469
- if (!foundTypes[wcEl]) {
1470
- foundTypes[wcEl] = [];
1471
- }
1472
- foundTypes[wcEl].push(sub);
1473
- }
1474
- nextIsDomProp = false;
1475
- }
1476
- });
1477
- }
1478
- }
1479
- isChildSpec = true;
1480
- });
1481
- }
1482
- });
1483
- return foundTypes;
1484
- }
1485
- var lastWcElement = "";
1486
- function getWcElement(contents, isChildSpec) {
1487
- if (isChildSpec) {
1488
- if (lastWcElement === "") {
1489
- new Error("Cant find the /*@DomProperty*/ on the parent interface for the WebComponent definition");
1490
- }
1491
- return lastWcElement;
1492
- }
1493
- else {
1494
- lastWcElement = "";
1495
- }
1496
- let wcElToken = "/*@WebComponent*/";
1497
- let wcElIndex = contents.indexOf(wcElToken);
1498
- let wcEl = "";
1499
- if (wcElIndex > -1) {
1500
- wcEl = contents.substring(wcElIndex);
1501
- wcEl = wcEl.substring(wcEl.indexOf('"') + 1);
1502
- wcEl = wcEl.substring(0, wcEl.indexOf('"'));
1503
- lastWcElement = wcEl;
1504
- }
1505
- return lastWcElement;
1506
- }
1507
- function createVueEntryFormRegistrations(registrations) {
1347
+ function createVueEntryFormComponentRegistrations(registrations) {
1508
1348
  let entryPaths = {};
1509
1349
  for (let r of registrations) {
1510
- if (r.componentOptions.entryPoint.endsWith('.jsx') || r.componentOptions.entryPoint.endsWith('.vue') || r.componentOptions.entryPoint.endsWith('.tsx') || r.componentOptions.entryPoint.endsWith('.ts')) {
1350
+ if (r.componentOptions.entryPoint.endsWith('.tsx')
1351
+ || r.componentOptions.entryPoint.endsWith('.vue')) {
1511
1352
  let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(r.manifestPath, [r.componentOptions.entryPoint]);
1512
1353
  let entryId = r.manifest.resourceId;
1513
1354
  if (r.manifest.resourceName) {
1514
1355
  entryId = `${r.manifest.resourceName}_${entryId}`;
1515
1356
  }
1516
- entryPaths[entryId] = entryPointPath;
1357
+ r.componentOptions.entryPointPath = entryPointPath[0];
1358
+ entryPaths[entryId.toString()] = entryPointPath;
1517
1359
  }
1518
1360
  else {
1519
1361
  $.tooling.log('The OmniaFx build system only supports .jsx, .vue and .tsx based components at the moment ', $.tooling.LogTypes.Error);
@@ -1827,42 +1669,9 @@ exports.registerManifestsReference = registerManifestsReference;
1827
1669
  function getRegisteredReferenceManifests() {
1828
1670
  return _registeredReferenceManifests;
1829
1671
  }
1830
- function registerWebComponentDefinitions(definitions) {
1831
- if (definitions) {
1832
- _wcDefinitions = $.merge(_wcDefinitions, definitions);
1833
- }
1834
- }
1835
- exports.registerWebComponentDefinitions = registerWebComponentDefinitions;
1836
1672
  function sortString(a, b) {
1837
1673
  if (a >= b) {
1838
1674
  return 1;
1839
1675
  }
1840
1676
  return -1;
1841
1677
  }
1842
- function generateWebComponentTypings(wc, template) {
1843
- // export default defineVueWebComponent
1844
- let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
1845
- let content = fsExtra.readFileSync(wcPath, 'utf8');
1846
- if (content.indexOf("defineVueWebComponent") > -1) {
1847
- if (!new RegExp('export\\s+default\\s+').test(content)) {
1848
- throw new Error(`Missing statement 'export default a vue web component' in ${wcPath}`);
1849
- }
1850
- let friendlyManifestId = `wc${wc.manifest.resourceId.toString().replace(/-/g, '').toLowerCase()}`;
1851
- let importPath = wcPath.substring(0, wcPath.lastIndexOf('.tsx'));
1852
- if (importPath.indexOf("./") === 0) {
1853
- importPath = importPath.replace("./", "");
1854
- }
1855
- if ($.isExtensionEnv) {
1856
- importPath = `../../../../${importPath}`;
1857
- }
1858
- else {
1859
- importPath = `../../../${importPath}`;
1860
- }
1861
- return template
1862
- .replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
1863
- //{{importWC}}`)
1864
- .replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": typeof ${friendlyManifestId}.propsDefinition & VueComponentBaseProps
1865
- //{{elementName}}`);
1866
- }
1867
- return template;
1868
- }