@omnia/tooling-vue 8.0.102-vnext → 8.0.103-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 (33) 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.libs_0fe5c5f2-8d89-485b-afd4-36fe3ff5943a.manifest.json +1 -0
  3. package/internal-do-not-import-from-here/config/omnia.fx.ux_dee030cc-4ab3-4158-bb06-8049f5c67542.manifest.json +1 -0
  4. package/internal-do-not-import-from-here/config/omnia.fx_a5a89056-b5f5-475d-8518-a1f55090379d.manifest.json +1 -0
  5. package/internal-do-not-import-from-here/config/omnia.vendor.manifest.json +1 -1
  6. package/internal-do-not-import-from-here/config/tooling.output.json +1 -1
  7. package/internal-do-not-import-from-here/config/wctypings.d.ts +4467 -1535
  8. package/internal-do-not-import-from-here/shared.d.ts +11 -6
  9. package/internal-do-not-import-from-here/shared.js +32 -12
  10. package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +1 -1
  11. package/internal-do-not-import-from-here/tasks/bundle.js +102 -386
  12. package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
  13. package/internal-do-not-import-from-here/tasks/doc.js +407 -391
  14. package/internal-do-not-import-from-here/tasks/vendor.js +22 -16
  15. package/internal-do-not-import-from-here/vite/hmr/graph.js +3 -1
  16. package/internal-do-not-import-from-here/vite/hmr/vueJsx.js +3 -2
  17. package/internal-do-not-import-from-here/vite/index.js +1 -1
  18. package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +1 -1
  19. package/internal-do-not-import-from-here/webpack-loaders/doc-loader.d.ts +1 -0
  20. package/internal-do-not-import-from-here/webpack-loaders/doc-loader.js +11 -0
  21. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.d.ts +1 -0
  22. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +10 -0
  23. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +5 -2
  24. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +8 -0
  25. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +3 -3
  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 -1
  28. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +5 -1
  29. package/internal-do-not-import-from-here/webpack-plugins/stylexjs/index.d.ts +53 -0
  30. package/internal-do-not-import-from-here/webpack-plugins/stylexjs/index.js +194 -0
  31. package/internal-do-not-import-from-here/webpack-plugins/stylexjs/loader.d.ts +9 -0
  32. package/internal-do-not-import-from-here/webpack-plugins/stylexjs/loader.js +23 -0
  33. package/package.json +10 -10
@@ -14,7 +14,8 @@ const fx_models_1 = require("@omnia/fx-models");
14
14
  const $ = tslib_1.__importStar(require("../variables"));
15
15
  const shared_1 = require("../shared");
16
16
  const tooling_1 = require("@omnia/tooling");
17
- const core_1 = require("@swc/core");
17
+ const doc_1 = require("./doc");
18
+ const stylexjs_1 = require("../webpack-plugins/stylexjs");
18
19
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
19
20
  const ConcatSource = require('webpack-core/lib/ConcatSource');
20
21
  const CircularDependencyPlugin = require('circular-dependency-plugin');
@@ -202,11 +203,12 @@ function buildEntries(serve = false) {
202
203
  var componentRegistry = $.composers.ComponentRegistry;
203
204
  let componentRegistrations = componentRegistry.getRegistrations();
204
205
  const serviceInfo = $.composers.ServiceManifestRegistry.getServiceInfo();
205
- if (serviceInfo.serviceType === tooling_composers_1.ServiceTypes.WebApp) {
206
- await generateComponentTypingsAndDoc(componentRegistrations);
207
- }
208
206
  startTime = new Date().getTime();
209
207
  $.tooling.logTime("Found [" + componentRegistrations.length + "] component registrations", startTime);
208
+ let componentEntries = createVueEntryFormComponentRegistrations(componentRegistrations);
209
+ if (serviceInfo.serviceType === tooling_composers_1.ServiceTypes.WebApp) {
210
+ await (0, doc_1.generateComponentTypingsAndDoc)(componentRegistrations);
211
+ }
210
212
  var resourceRegistry = $.composers.ResourceRegistry;
211
213
  let resourceBundlesWithBuildOptions = resourceRegistry.getRegisteredResourceBundles(shared_1.convertManifestPathToEntryPath);
212
214
  $.tooling.logTime("Found [" + resourceBundlesWithBuildOptions?.size + "] resource bundles", startTime);
@@ -222,7 +224,6 @@ function buildEntries(serve = false) {
222
224
  console.log("debug " + res[0] + " has build options for paths " + resource.paths + " buildoptions: " + JSON.stringify(resource.buildOptions));
223
225
  }
224
226
  }
225
- let componentEntries = createVueEntryFormRegistrations(componentRegistrations);
226
227
  var entries = $.merge(componentEntries, resourceEntries);
227
228
  if (checkDuplicateWebpackEntryPoints(entries)) {
228
229
  $.tooling.log('Build manifests metadata have error that found duplicated resource path', $.tooling.LogTypes.Error);
@@ -257,248 +258,7 @@ function buildEntries(serve = false) {
257
258
  }
258
259
  });
259
260
  }
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 docPath = $.path.resolve(__dirname, "ComponentDocRegistrations.ts");
421
- ;
422
- const wcNamespace = getBuildOption()?.webComponentNamespace;
423
- const info = shared_1.ConfigurationManager.outputInfo.get();
424
- info.wc = {
425
- namespace: wcNamespace,
426
- mappings: {}
427
- };
428
- let wcTypings = wcNamespace ? `
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
- declare global {
442
- let ${wcNamespace}: {
443
- //{{nselementName}}
444
- };
445
- }
446
- `
447
- : `
448
- //{{importWC}}
449
- declare global {
450
- namespace JSX {
451
- interface Element { }
452
- interface ElementClass { }
453
-
454
- interface IntrinsicElements {
455
- //{{elementName}}
456
- }
457
- }
458
- }`;
459
- if ($.isExtensionEnv) {
460
- wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
461
- ${wcTypings}`;
462
- }
463
- else {
464
- wcTypings = `import { VueComponentBaseProps } from "../../../../client/fx/ux/index";
465
- ${wcTypings}`;
466
- }
467
- await tooling_1.utils.asyncForEach(componentRegistrations, async (wc) => {
468
- wcTypings = generateWebComponentTypings(wc, wcTypings, info);
469
- await buildDoc(wc);
470
- });
471
- if (Object.keys(docResult).length > 0) {
472
- fsExtra.outputFileSync(docPath, `
473
- import { extendApi } from "@omnia/fx";
474
- import { ComponentDoc } from "@omnia/fx-models";
475
-
476
- extendApi(api => api.fx.docs.registrations, api => {
477
-
478
- const registrations: { [elementName: string]: ComponentDoc } = ${JSON.stringify(docResult)}
479
-
480
- Object.keys(registrations).forEach(elementName => {
481
- api.register(elementName, registrations[elementName]);
482
- });
483
- });
484
- `);
485
- // create dynamic doc manifest
486
- $.composers.ManifestRegistry.setCurrentManifestPath(`${path_1.default.relative(tooling_1.utils.root(""), path_1.default.resolve(__dirname))}/`);
487
- $.composers
488
- .Composer
489
- .registerManifest(getBuildOption().docResourceManifestId || new fx_models_1.Guid(`${tooling_1.utils.generateGuid()}`), "omnia.fx.docs.components.registraions")
490
- .registerResources({
491
- resourcePaths: ["./ComponentDocRegistrations.ts"]
492
- })
493
- .withTarget(fx_models_1.ClientManifestTargetTypes.Docs)
494
- .extendApi(api => api.fx.docs.registrations);
495
- $.composers.ManifestRegistry.setCurrentManifestPath();
496
- }
497
- shared_1.ConfigurationManager.webComponentTypings.update(wcTypings);
498
- shared_1.ConfigurationManager.outputInfo.update(info);
499
- tooling_1.utils.logTime('Done - Generate components typings and documentation', startTime);
500
- }
501
- function buildManifestMetadatas(entries) {
261
+ function buildManifestMetadata(entries) {
502
262
  return new Promise(function (resolve, reject) {
503
263
  try {
504
264
  var startTime = new Date().getTime();
@@ -585,7 +345,7 @@ function beforeBundleManifest(entries) {
585
345
  // isRunBuildMetadata = !isEqual(entries, cachedEntries);
586
346
  // }
587
347
  // }
588
- if ($.fs.existsSync(cachedEntriesPath)) {
348
+ if (!isBuildWebpackManifestOnly() && $.fs.existsSync(cachedEntriesPath)) {
589
349
  let cachedEntries = require(cachedEntriesPath);
590
350
  isRunBuildMetadata = !isEqual(entries, cachedEntries);
591
351
  }
@@ -617,9 +377,15 @@ function beforeBundleManifest(entries) {
617
377
  fsExtra.writeJsonSync(manifestPath, content);
618
378
  }
619
379
  });
620
- buildManifestMetadatas(entriesToBuild).then(() => {
380
+ buildManifestMetadata(entriesToBuild).then(() => {
621
381
  fsExtra.ensureFileSync(cachedEntriesPath);
622
382
  fsExtra.writeJsonSync(cachedEntriesPath, entries);
383
+ if (isBuildWebpackManifestOnly()) {
384
+ fsExtra.copyFileSync(`${outDirManifestMetadata}/omnia.fx.core_a2892051-fd9f-4056-ae8d-30d16d48417d.manifest.json`, "client/tooling/vue/config/omnia.fx.core_a2892051-fd9f-4056-ae8d-30d16d48417d.manifest.json");
385
+ fsExtra.copyFileSync(`${outDirManifestMetadata}/omnia.fx_a5a89056-b5f5-475d-8518-a1f55090379d.manifest.json`, "client/tooling/vue/config/omnia.fx_a5a89056-b5f5-475d-8518-a1f55090379d.manifest.json");
386
+ fsExtra.copyFileSync(`${outDirManifestMetadata}/omnia.fx.ux_dee030cc-4ab3-4158-bb06-8049f5c67542.manifest.json`, "client/tooling/vue/config/omnia.fx.ux_dee030cc-4ab3-4158-bb06-8049f5c67542.manifest.json");
387
+ fsExtra.copyFileSync(`${outDirManifestMetadata}/omnia.fx.ux.libs_0fe5c5f2-8d89-485b-afd4-36fe3ff5943a.manifest.json`, "client/tooling/vue/config/omnia.fx.ux.libs_0fe5c5f2-8d89-485b-afd4-36fe3ff5943a.manifest.json");
388
+ }
623
389
  resolve(entries);
624
390
  });
625
391
  }
@@ -759,12 +525,15 @@ function afterGenerateManifestsMetadata() {
759
525
  .then(resolve, reject);
760
526
  });
761
527
  }
528
+ function isBuildWebpackManifestOnly() {
529
+ return process.argv?.find(argv => argv === "--webpackManifest") !== undefined;
530
+ }
762
531
  function minifyBundles() {
763
532
  return new Promise(function (resolve, reject) {
764
533
  if (process.argv.length > 0 && process.argv.find(argv => argv === "--minify") !== undefined) {
765
534
  let startTime = new Date().getTime();
766
535
  $.tooling.log('Minify bundles running...');
767
- const jsPaths = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/*.js`]);
536
+ const jsPaths = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath).replace(/\\/g, "/")}/*.js`]);
768
537
  let promises = [];
769
538
  jsPaths.forEach(filePath => {
770
539
  promises.push(new Promise(async (resolve, reject) => {
@@ -821,6 +590,25 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
821
590
  ...referenceManifests,
822
591
  extractCss,
823
592
  new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
593
+ new stylexjs_1.StylexPlugin({
594
+ // filename: 'styles.[contenthash].css',
595
+ filename: `${Object.keys(entry)[0]}.css`,
596
+ // get webpack mode and set value for dev
597
+ dev: false,
598
+ // Use statically generated CSS files and not runtime injected CSS.
599
+ // Even in development.
600
+ runtimeInjection: false,
601
+ // optional. default: 'x'
602
+ classNamePrefix: 'o',
603
+ // Required for CSS variable support
604
+ unstable_moduleResolution: {
605
+ // type: 'commonJS' | 'haste'
606
+ // default: 'commonJS'
607
+ type: 'commonJS',
608
+ // The absolute path to the root directory of your project
609
+ rootDir: __dirname,
610
+ },
611
+ }),
824
612
  ];
825
613
  if (!buildOption.detectCircularDependencyOptions || buildOption.detectCircularDependencyOptions.disable !== true) {
826
614
  plugins.unshift(new CircularDependencyPlugin({
@@ -893,10 +681,10 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
893
681
  plugins.push(new $.omniaWebpackPlugins.ChunkAssets(function (compilation, fileName) {
894
682
  chunkAsset(entries, compilation, fileName, viteHmrOption);
895
683
  }));
896
- let webpackEntries = {};
897
- Object.keys(entry).forEach(name => {
898
- webpackEntries[name] = { import: entry[name] };
899
- });
684
+ // let webpackEntries = {};
685
+ // Object.keys(entry).forEach(name => {
686
+ // webpackEntries[name] = { import: entry[name] }
687
+ // })
900
688
  return {
901
689
  mode: 'production',
902
690
  devtool: false,
@@ -924,7 +712,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
924
712
  '@microsoft/signalr$': '@microsoft/signalr/dist/webworker/signalr.js',
925
713
  }),
926
714
  },
927
- target: ['web', 'es2022'],
715
+ target: ['web', 'es2022'], // Will change ES6 when stop support IE11
928
716
  output: {
929
717
  //library: {
930
718
  // type: "umd"
@@ -959,8 +747,8 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
959
747
  }
960
748
  return false;
961
749
  },
962
- // use: 'null-loader',
963
750
  use: [
751
+ // 'null-loader',
964
752
  {
965
753
  loader: path_1.default.resolve(__dirname, $.isExtensionEnv ? '../webpack-loaders/ingore-vuetify-locale.js' : '../webpack-loaders/ingore-vuetify-locale.ts'),
966
754
  }
@@ -1074,7 +862,7 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
1074
862
  var entensionId = getServiceId();
1075
863
  return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
1076
864
  plugins: [
1077
- ...buildReferenceManifestFromConfig(),
865
+ ...buildReferenceManifestFromConfig(Object.keys(entry)[0]),
1078
866
  new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
1079
867
  new $.webpack.DllPlugin({
1080
868
  entryOnly: false,
@@ -1302,9 +1090,10 @@ function createCombinedManfest(omniaServiceId, manifestIds, targetManifestId, ta
1302
1090
  if (manifestIds &&
1303
1091
  targetManifestId &&
1304
1092
  manifestIds.length > 0) {
1305
- let manifestIdToFileNameMap = {};
1306
- let targetFileName = `${targetManifestName ? targetManifestName + "_" : ""}${targetManifestId}.js`;
1307
- manifestIdToFileNameMap[targetManifestId] = targetFileName;
1093
+ const manifestIdToFileNameMap = {};
1094
+ const targetJsFileName = `${targetManifestName ? targetManifestName + "_" : ""}${targetManifestId}.js`;
1095
+ const targetCssFileName = `${targetManifestName ? targetManifestName + "_" : ""}${targetManifestId}.css`;
1096
+ manifestIdToFileNameMap[targetManifestId] = targetJsFileName;
1308
1097
  $.tooling.log("Creating manifest group bundle [" + targetManifestId + "]", $.tooling.LogTypes.HeadLine);
1309
1098
  let omniaServiceId = getServiceId();
1310
1099
  manifestIds.sort((manifestId1, manifestId2) => {
@@ -1321,18 +1110,32 @@ function createCombinedManfest(omniaServiceId, manifestIds, targetManifestId, ta
1321
1110
  }
1322
1111
  return result;
1323
1112
  });
1324
- let bundleNames = [];
1113
+ const jsBundleNames = [];
1114
+ const cssBundleNames = [];
1325
1115
  for (let i = 0; i < manifestIds.length; i++) {
1326
1116
  let manifest = $.composers.LoadableManifestRegistry.getRegisteredManifest(manifestIds[i]);
1327
- bundleNames[i] = outputDir + `/${manifest.resourceName ? manifest.resourceName + "_" : ""}${manifest.resourceId}.js`;
1328
- if (!$.fs.existsSync(bundleNames[i])) {
1329
- throw new Error("Error, can't create combined bundle: " + targetFileName + " can't find bundle to include: " + bundleNames[i]);
1117
+ jsBundleNames[i] = outputDir + `/${manifest.resourceName ? manifest.resourceName + "_" : ""}${manifest.resourceId}.js`;
1118
+ const cssFilePath = outputDir + `/${manifest.resourceName ? manifest.resourceName + "_" : ""}${manifest.resourceId}.css`;
1119
+ if (!fsExtra.existsSync(jsBundleNames[i])) {
1120
+ throw new Error("Error, can't create combined bundle: " + targetJsFileName + " can't find bundle to include: " + jsBundleNames[i]);
1121
+ }
1122
+ if (fsExtra.existsSync(cssFilePath)) {
1123
+ cssBundleNames.push(cssFilePath);
1330
1124
  }
1331
- manifestIdToFileNameMap[manifestIds[i]] = bundleNames[i];
1125
+ manifestIdToFileNameMap[manifestIds[i]] = jsBundleNames[i];
1332
1126
  $.tooling.log("Adding manifest bundle [" + manifestIds[i] + "] to group", $.tooling.LogTypes.Info);
1333
1127
  }
1334
- let mergedContent = "";
1335
- bundleNames.forEach(filePath => {
1128
+ let mergedCssContent = "";
1129
+ cssBundleNames.forEach(filePath => {
1130
+ mergedCssContent = `${mergedCssContent}
1131
+ ${fsExtra.readFileSync(filePath, 'utf8')}
1132
+ `;
1133
+ });
1134
+ if (mergedCssContent) {
1135
+ fsExtra.writeFileSync(`${outputDir}/${targetCssFileName}`, mergedCssContent);
1136
+ }
1137
+ let mergedJsContent = "";
1138
+ jsBundleNames.forEach(filePath => {
1336
1139
  let manifestId = "";
1337
1140
  let currentFilename = $.path.basename(filePath);
1338
1141
  for (let id in manifestIdToFileNameMap) {
@@ -1345,13 +1148,13 @@ function createCombinedManfest(omniaServiceId, manifestIds, targetManifestId, ta
1345
1148
  throw Error("Couldn't extract manifest id from filename: " + currentFilename);
1346
1149
  }
1347
1150
  let content = fsExtra.readFileSync(filePath, 'utf8');
1348
- mergedContent = `
1349
- ${mergedContent}
1151
+ mergedJsContent = `
1152
+ ${mergedJsContent}
1350
1153
  /* Start of resource:${manifestId} */omniaWebpackJsonp["bb000000-0000-bbbb-0000-0000000000bb"]["${fx_models_1.OmniaResourceManifests.FxCore.toString()}"]("06e712d2-9897-4891-9353-148547efe61c").ManifestResourceLoader.registerWebComponentFromGroupBundle("${omniaServiceId}", "${manifestId}", "${targetManifestId}", function(){
1351
1154
  ${content}
1352
1155
  })//End of resource:${manifestId} `;
1353
1156
  });
1354
- fsExtra.writeFileSync(`${outputDir}/${targetFileName}`, `/******/ if (typeof omniaLoader === 'undefined') {
1157
+ fsExtra.writeFileSync(`${outputDir}/${targetJsFileName}`, `/******/ if (typeof omniaLoader === 'undefined') {
1355
1158
  /******/ globalThis['omniaLoader'] = {};
1356
1159
  /******/ }
1357
1160
  /******/ omniaLoader['${omniaServiceId}'] = omniaLoader['${omniaServiceId}'] || {};
@@ -1360,7 +1163,7 @@ ${content}
1360
1163
  /******/
1361
1164
  }
1362
1165
  /******/ omniaLoader['${omniaServiceId}']['${targetManifestId}'] = function () {
1363
- ${mergedContent}
1166
+ ${mergedJsContent}
1364
1167
  }
1365
1168
  ${$.composers.LoadableManifestRegistry.isDefineWithNoDependency(targetManifestId) ? `omniaLoader['${omniaServiceId}']['${targetManifestId}']()` : ''}`, 'utf8');
1366
1169
  $.tooling.log("Done - Creating manifest group bundle for manifest id: " + targetManifestId, $.tooling.LogTypes.HeadLine);
@@ -1444,12 +1247,17 @@ function buildReferenceManifest(currentEntry, entries) {
1444
1247
  var manifests = [];
1445
1248
  var dynamicReferenceManifests = [];
1446
1249
  let buildOptions = getBuildOption();
1447
- if (buildOptions && buildOptions.bundleOptions && buildOptions.bundleOptions.commonsChunk)
1448
- return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig());
1449
1250
  var currentEntryName = Object.keys(currentEntry)[0];
1450
- // exclude omnia vendor
1451
- if (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
1452
- && currentEntryName.indexOf(vendorProdId) === -1) {
1251
+ if (buildOptions && buildOptions.bundleOptions && buildOptions.bundleOptions.commonsChunk)
1252
+ return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig(currentEntryName));
1253
+ // exclude pre-built webpack manifest
1254
+ if ($.isExtensionEnv
1255
+ || (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
1256
+ && currentEntryName.indexOf(vendorProdId) === -1
1257
+ // && currentEntryName.indexOf(OmniaResourceManifests.FxCore.toString()) === -1
1258
+ // && currentEntryName.indexOf(OmniaResourceManifests.Fx.toString()) === -1
1259
+ // && currentEntryName.indexOf(OmniaResourceManifests.FxUx.toString()) === -1
1260
+ )) {
1453
1261
  Object.keys(entries).forEach((entryName) => {
1454
1262
  if (entryName !== currentEntryName) {
1455
1263
  if ($.fs.existsSync($.tooling.utils.root(outDirManifestMetadata + "/" + entryName + ".manifest.json"))) {
@@ -1463,14 +1271,14 @@ function buildReferenceManifest(currentEntry, entries) {
1463
1271
  }
1464
1272
  });
1465
1273
  }
1466
- manifests = buildReferenceManifestFromConfig().concat(dynamicReferenceManifests).concat(manifests);
1274
+ manifests = buildReferenceManifestFromConfig(currentEntryName).concat(dynamicReferenceManifests).concat(manifests);
1467
1275
  return manifests;
1468
1276
  }
1469
1277
  function cleanUpComposer() {
1470
1278
  $.composers.ManifestRegistry.clearState();
1471
1279
  }
1472
1280
  exports.cleanUpComposer = cleanUpComposer;
1473
- function buildReferenceManifestFromConfig() {
1281
+ function buildReferenceManifestFromConfig(entryName) {
1474
1282
  var manifests = [];
1475
1283
  let buildOptions = getBuildOption();
1476
1284
  if (buildOptions.reference) {
@@ -1482,6 +1290,17 @@ function buildReferenceManifestFromConfig() {
1482
1290
  }));
1483
1291
  }
1484
1292
  }
1293
+ if (!isBuildWebpackManifestOnly() && buildOptions.webpackManifests) {
1294
+ for (let manifestPath of buildOptions.webpackManifests) {
1295
+ if (manifestPath.indexOf(entryName) === -1) {
1296
+ manifests.push(new $.omniaWebpackPlugins.DllReferencePlugin({
1297
+ context: $.tooling.utils.root(""),
1298
+ manifest: $.tooling.utils.root(manifestPath),
1299
+ // name: `md${++trackingModuleRefId}` //require('md5')(manifestPath)
1300
+ }));
1301
+ }
1302
+ }
1303
+ }
1485
1304
  if ($.isExtensionEnv) {
1486
1305
  _registeredReferenceManifests.forEach(manifest => {
1487
1306
  manifests.push(new $.omniaWebpackPlugins.DllReferencePlugin({
@@ -1561,89 +1380,18 @@ function getServiceId() {
1561
1380
  return serviceId;
1562
1381
  }
1563
1382
  exports.getServiceId = getServiceId;
1564
- function extractTypingsForComponents(componentRegistrations) {
1565
- let foundTypes = {};
1566
- componentRegistrations.forEach((comp) => {
1567
- let defPaths = comp.componentOptions.typings;
1568
- if (defPaths) {
1569
- let isChildSpec = false;
1570
- defPaths.forEach((defPath) => {
1571
- let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(comp.manifestPath, [defPath])[0];
1572
- let contents = $.fs.readFileSync(entryPointPath, 'utf8');
1573
- let wcEl = getWcElement(contents, isChildSpec);
1574
- if (wcEl) {
1575
- //Now lets find the interface mapped to element
1576
- //example /*@WebComponentInterface("omfx-dialog")*/
1577
- let interfaceToken = `/*@WebComponentInterface("${wcEl}")*/`;
1578
- let interfaceIndex = contents.indexOf(interfaceToken);
1579
- if (interfaceIndex > -1) {
1580
- let wcProps = [];
1581
- let intf = contents.substring(interfaceIndex);
1582
- let nextIsDomProp = false;
1583
- intf = intf
1584
- .substring(intf.indexOf("{") + 1, intf.indexOf("}"))
1585
- .replace(/\?/g, '')
1586
- .trim()
1587
- .split(/\r\n|\r|\n/g).forEach((group) => {
1588
- /*@DomProperty*/
1589
- let sub = group.trim();
1590
- if (sub.indexOf("/*@DomProperty*/") > -1) {
1591
- nextIsDomProp = true;
1592
- return;
1593
- }
1594
- if (nextIsDomProp) {
1595
- if (sub.indexOf(':')) {
1596
- sub = sub.split(':')[0];
1597
- }
1598
- if (sub) {
1599
- if (!foundTypes[wcEl]) {
1600
- foundTypes[wcEl] = [];
1601
- }
1602
- foundTypes[wcEl].push(sub);
1603
- }
1604
- nextIsDomProp = false;
1605
- }
1606
- });
1607
- }
1608
- }
1609
- isChildSpec = true;
1610
- });
1611
- }
1612
- });
1613
- return foundTypes;
1614
- }
1615
- var lastWcElement = "";
1616
- function getWcElement(contents, isChildSpec) {
1617
- if (isChildSpec) {
1618
- if (lastWcElement === "") {
1619
- new Error("Cant find the /*@DomProperty*/ on the parent interface for the WebComponent definition");
1620
- }
1621
- return lastWcElement;
1622
- }
1623
- else {
1624
- lastWcElement = "";
1625
- }
1626
- let wcElToken = "/*@WebComponent*/";
1627
- let wcElIndex = contents.indexOf(wcElToken);
1628
- let wcEl = "";
1629
- if (wcElIndex > -1) {
1630
- wcEl = contents.substring(wcElIndex);
1631
- wcEl = wcEl.substring(wcEl.indexOf('"') + 1);
1632
- wcEl = wcEl.substring(0, wcEl.indexOf('"'));
1633
- lastWcElement = wcEl;
1634
- }
1635
- return lastWcElement;
1636
- }
1637
- function createVueEntryFormRegistrations(registrations) {
1383
+ function createVueEntryFormComponentRegistrations(registrations) {
1638
1384
  let entryPaths = {};
1639
1385
  for (let r of registrations) {
1640
- if (r.componentOptions.entryPoint.endsWith('.jsx') || r.componentOptions.entryPoint.endsWith('.vue') || r.componentOptions.entryPoint.endsWith('.tsx') || r.componentOptions.entryPoint.endsWith('.ts')) {
1386
+ if (r.componentOptions.entryPoint.endsWith('.tsx')
1387
+ || r.componentOptions.entryPoint.endsWith('.vue')) {
1641
1388
  let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(r.manifestPath, [r.componentOptions.entryPoint]);
1642
1389
  let entryId = r.manifest.resourceId;
1643
1390
  if (r.manifest.resourceName) {
1644
1391
  entryId = `${r.manifest.resourceName}_${entryId}`;
1645
1392
  }
1646
- entryPaths[entryId] = entryPointPath;
1393
+ r.componentOptions.entryPointPath = entryPointPath[0];
1394
+ entryPaths[entryId.toString()] = entryPointPath;
1647
1395
  }
1648
1396
  else {
1649
1397
  $.tooling.log('The OmniaFx build system only supports .jsx, .vue and .tsx based components at the moment ', $.tooling.LogTypes.Error);
@@ -1963,35 +1711,3 @@ function sortString(a, b) {
1963
1711
  }
1964
1712
  return -1;
1965
1713
  }
1966
- function generateWebComponentTypings(wc, template, info) {
1967
- // export default defineVueWebComponent
1968
- let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
1969
- let content = fsExtra.readFileSync(wcPath, 'utf8');
1970
- if (content.indexOf("defineVueWebComponent") > -1) {
1971
- if (!new RegExp('export\\s+default\\s+').test(content)) {
1972
- throw new Error(`Missing statement 'export default a vue web component' in ${wcPath}`);
1973
- }
1974
- let friendlyManifestId = `wc${wc.manifest.resourceId.toString().replace(/-/g, '').toLowerCase()}`;
1975
- let importPath = wcPath.substring(0, wcPath.lastIndexOf('.tsx'));
1976
- if (importPath.indexOf("./") === 0) {
1977
- importPath = importPath.replace("./", "");
1978
- }
1979
- if ($.isExtensionEnv) {
1980
- importPath = `../../../../${importPath}`;
1981
- }
1982
- else {
1983
- importPath = `../../../../${importPath}`;
1984
- }
1985
- let elementNamePascalCase = wc.componentOptions.elementName.replace("omfx-", "").replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
1986
- elementNamePascalCase = elementNamePascalCase[0].toUpperCase() + elementNamePascalCase.substring(1, elementNamePascalCase.length);
1987
- info.wc.mappings[elementNamePascalCase] = wc.componentOptions.elementName;
1988
- return template
1989
- .replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
1990
- //{{importWC}}`)
1991
- .replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": typeof ${friendlyManifestId}.propsDefinition & Omit<VueComponentBaseProps, keyof typeof ${friendlyManifestId}.propsDefinition>
1992
- //{{elementName}}`)
1993
- .replace(/\/\/{{nselementName}}/, `"${elementNamePascalCase}": { new(...args: any[]): { $props: typeof ${friendlyManifestId}.propsDefinition & Omit<VueComponentBaseProps, keyof typeof ${friendlyManifestId}.propsDefinition> } }
1994
- //{{nselementName}}`);
1995
- }
1996
- return template;
1997
- }
@@ -1 +1,3 @@
1
- export {};
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;