@omnia/tooling-vue 8.0.79-vnext → 8.0.81-vnext

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 (25) hide show
  1. package/internal-do-not-import-from-here/config/tooling.output.json +1 -0
  2. package/internal-do-not-import-from-here/config/wctypings.d.ts +744 -0
  3. package/internal-do-not-import-from-here/index.d.ts +3 -1
  4. package/internal-do-not-import-from-here/index.js +6 -2
  5. package/internal-do-not-import-from-here/shared.d.ts +26 -118
  6. package/internal-do-not-import-from-here/shared.js +78 -153
  7. package/internal-do-not-import-from-here/tasks/bundle.d.ts +1 -2
  8. package/internal-do-not-import-from-here/tasks/bundle.js +157 -54
  9. package/internal-do-not-import-from-here/variables.d.ts +1 -1
  10. package/internal-do-not-import-from-here/variables.js +2 -2
  11. package/internal-do-not-import-from-here/vite/hmr/graph.js +2 -0
  12. package/internal-do-not-import-from-here/wctypings.ts +0 -0
  13. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +2 -5
  14. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +0 -5
  15. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +3 -0
  16. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +3 -0
  17. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.d.ts +1 -0
  18. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +7 -0
  19. package/package.json +3 -3
  20. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -744
  21. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.d.ts +0 -1
  22. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +0 -13
  23. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.d.ts +0 -1
  24. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.js +0 -10
  25. /package/internal-do-not-import-from-here/{bb000000-0000-bbbb-0000-0000000000bb.wctypings.js → config/wctypings.js} +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"));
@@ -20,7 +20,7 @@ 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
  }
@@ -186,12 +186,7 @@ function clean() {
186
186
  return new Promise(function (resolve, reject) {
187
187
  del_1.default.sync("node_modules/.cache");
188
188
  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
- }
189
+ shared_1.ConfigurationManager.webComponentTypings.delete();
195
190
  resolve();
196
191
  });
197
192
  }
@@ -417,56 +412,55 @@ async function generateComponentTypingsAndDoc(componentRegistrations) {
417
412
  throw new Error("Exit, have an exception.");
418
413
  }
419
414
  }
420
- let wcTypingsPath = "", docPath = $.path.resolve(__dirname, "ComponentDocRegistrations.ts");
415
+ let docPath = $.path.resolve(__dirname, "ComponentDocRegistrations.ts");
421
416
  ;
422
- if ($.isExtensionEnv) {
423
- wcTypingsPath = $.path.resolve(__dirname, "../wctypings.ts");
424
- }
425
- else {
426
- wcTypingsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wctypings.ts`);
427
- }
428
- let wcTypings = $.isExtensionEnv ? `
417
+ const wcNamespace = getBuildOption()?.webComponentNamespace;
418
+ const info = shared_1.ConfigurationManager.outputInfo.get();
419
+ info.wc = {
420
+ namespace: wcNamespace,
421
+ mappings: {}
422
+ };
423
+ let wcTypings = wcNamespace ? `
429
424
  //{{importWC}}
430
425
  declare global {
431
- namespace JSX {
432
- interface Element { }
433
- interface ElementClass { }
426
+ namespace JSX {
427
+ interface Element { }
428
+ interface ElementClass { }
434
429
 
435
- interface IntrinsicElements {
436
- //{{elementName}}
437
- }
430
+ interface IntrinsicElements {
431
+ //{{elementName}}
432
+ }
433
+ }
438
434
  }
435
+
436
+ declare global {
437
+ let ${wcNamespace}: {
438
+ //{{nselementName}}
439
+ };
439
440
  }
440
441
  `
441
442
  : `
442
443
  //{{importWC}}
443
- declare global {
444
- namespace JSX {
445
- interface Element { }
446
- interface ElementClass { }
444
+ declare global {
445
+ namespace JSX {
446
+ interface Element { }
447
+ interface ElementClass { }
447
448
 
448
- interface IntrinsicElements {
449
- //{{elementName}}
450
- }
451
- }
452
- }
453
-
454
- declare global {
455
- let omfx: {
456
- //{{omfxelementName}}
457
- };
458
- }
459
- `;
449
+ interface IntrinsicElements {
450
+ //{{elementName}}
451
+ }
452
+ }
453
+ }`;
460
454
  if ($.isExtensionEnv) {
461
455
  wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
462
456
  ${wcTypings}`;
463
457
  }
464
458
  else {
465
- wcTypings = `import { VueComponentBaseProps } from "../../../client/fx/ux/index";
459
+ wcTypings = `import { VueComponentBaseProps } from "../../../../client/fx/ux/index";
466
460
  ${wcTypings}`;
467
461
  }
468
462
  await tooling_1.utils.asyncForEach(componentRegistrations, async (wc) => {
469
- wcTypings = generateWebComponentTypings(wc, wcTypings);
463
+ wcTypings = generateWebComponentTypings(wc, wcTypings, info);
470
464
  await buildDoc(wc);
471
465
  });
472
466
  if (Object.keys(docResult).length > 0) {
@@ -487,7 +481,7 @@ extendApi(api => api.fx.docs.registrations, api => {
487
481
  $.composers.ManifestRegistry.setCurrentManifestPath(`${path_1.default.relative(tooling_1.utils.root(""), path_1.default.resolve(__dirname))}/`);
488
482
  $.composers
489
483
  .Composer
490
- .registerManifest(getBuildOption().dynamicDocManifestId || new fx_models_1.Guid(`${tooling_1.utils.generateGuid()}`), "omnia.fx.docs.components.registraions")
484
+ .registerManifest(getBuildOption().docResourceManifestId || new fx_models_1.Guid(`${tooling_1.utils.generateGuid()}`), "omnia.fx.docs.components.registraions")
491
485
  .registerResources({
492
486
  resourcePaths: ["./ComponentDocRegistrations.ts"]
493
487
  })
@@ -495,7 +489,8 @@ extendApi(api => api.fx.docs.registrations, api => {
495
489
  .extendApi(api => api.fx.docs.registrations);
496
490
  $.composers.ManifestRegistry.setCurrentManifestPath();
497
491
  }
498
- fsExtra.outputFileSync(wcTypingsPath, wcTypings);
492
+ shared_1.ConfigurationManager.webComponentTypings.update(wcTypings);
493
+ shared_1.ConfigurationManager.outputInfo.update(info);
499
494
  tooling_1.utils.logTime('Done - Generate components typings and documentation', startTime);
500
495
  }
501
496
  function buildManifestMetadatas(entries) {
@@ -1072,7 +1067,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrO
1072
1067
  exports.createVueWebpackConfig = createVueWebpackConfig;
1073
1068
  function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
1074
1069
  var entensionId = getServiceId();
1075
- return Object.assign({}, (0, shared_1.getBaseWebpackConfigForManifestMetadata)(entry, metadataOutputDir), {
1070
+ return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
1076
1071
  plugins: [
1077
1072
  ...buildReferenceManifestFromConfig(),
1078
1073
  new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
@@ -1084,6 +1079,117 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
1084
1079
  ]
1085
1080
  });
1086
1081
  }
1082
+ function getBaseWebpackConfigForManifestMetadata(entry, bundleOutputDir) {
1083
+ return {
1084
+ devtool: false,
1085
+ mode: 'development',
1086
+ context: $.tooling.utils.root(""),
1087
+ entry: entry,
1088
+ optimization: Object.assign({
1089
+ removeAvailableModules: false,
1090
+ removeEmptyChunks: false,
1091
+ splitChunks: false,
1092
+ }),
1093
+ resolve: {
1094
+ modules: $.tooling.core.getWebpackResolveModules(),
1095
+ extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx'],
1096
+ //extensions: ['.js', '.jsx', '.ts', '.tsx', '.html', '.vue', '.less', '.styl'],
1097
+ symlinks: false,
1098
+ cacheWithContext: true,
1099
+ descriptionFiles: ['package.json'],
1100
+ alias: Object.assign({}, $.tooling.core.getWebpackResolveAlias(), ($.composers.BuildConfigurationRegistry.getBuildOptions()?.moduleOptions?.alias || {}), {
1101
+ 'axios$': 'axios/dist/axios.js',
1102
+ 'typestyle$': 'typestyle/lib.es2015/index.js',
1103
+ 'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
1104
+ '@microsoft/signalr': '@microsoft/signalr/dist/webworker/signalr.js',
1105
+ }),
1106
+ //mainFields: ['main', 'browser', 'module']
1107
+ },
1108
+ output: {
1109
+ pathinfo: false,
1110
+ path: $.tooling.utils.root(bundleOutputDir),
1111
+ filename: '[name].js'
1112
+ },
1113
+ externals: [
1114
+ function ({ context, request }, callback) {
1115
+ if (request.indexOf("node_modules") > -1 || (/\.(sass|scss|styl|less|css)$/i).test(request)) {
1116
+ return callback(null, 'commonjs ' + request);
1117
+ }
1118
+ callback();
1119
+ }
1120
+ ],
1121
+ module: {
1122
+ noParse: /wwwroot(.*)/,
1123
+ rules: [
1124
+ {
1125
+ test: /\.m?js$/,
1126
+ resolve: {
1127
+ fullySpecified: false, // disable the behaviour
1128
+ },
1129
+ },
1130
+ ...(0, ts_loader_1.default)(),
1131
+ ...(0, tsx_loader_1.default)(),
1132
+ {
1133
+ test: /\.styl$/,
1134
+ use: [
1135
+ //'style-loader',
1136
+ //'css-loader',
1137
+ 'stylus-loader'
1138
+ ]
1139
+ },
1140
+ ...($.isExtensionEnv ? [] : [{
1141
+ test: /\.s(c|a)ss$/,
1142
+ use: [
1143
+ {
1144
+ loader: 'sass-loader',
1145
+ options: {
1146
+ implementation: require('sass'),
1147
+ sassOptions: {
1148
+ //fiber: require('fibers'),
1149
+ indentedSyntax: true
1150
+ }
1151
+ //fiber: require('fibers')
1152
+ }
1153
+ }
1154
+ ]
1155
+ }]),
1156
+ {
1157
+ test: /\.less$/,
1158
+ use: [
1159
+ //'style-loader',
1160
+ //'css-loader',
1161
+ 'less-loader'
1162
+ ]
1163
+ },
1164
+ {
1165
+ test: /\.css$/,
1166
+ use: [
1167
+ //'style-loader',
1168
+ {
1169
+ loader: 'css-loader'
1170
+ }
1171
+ ]
1172
+ },
1173
+ {
1174
+ test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/,
1175
+ loader: 'url-loader'
1176
+ },
1177
+ {
1178
+ test: /\.(ico|gif|png|jpe?g|svg)$/i,
1179
+ use: [{
1180
+ loader: 'file-loader',
1181
+ options: {
1182
+ name: '[name].[ext]',
1183
+ outputPath: "../images/",
1184
+ publicPath: '/omnia/images/'
1185
+ }
1186
+ }]
1187
+ //loader: 'url-loader'
1188
+ }
1189
+ ]
1190
+ }
1191
+ };
1192
+ }
1087
1193
  function buildCommonChunk(entry) {
1088
1194
  let bundleOptions = getBuildOption().bundleOptions;
1089
1195
  let minChunk = bundleOptions.commonsChunk.minChunks || 2;
@@ -1846,19 +1952,13 @@ exports.registerManifestsReference = registerManifestsReference;
1846
1952
  function getRegisteredReferenceManifests() {
1847
1953
  return _registeredReferenceManifests;
1848
1954
  }
1849
- function registerWebComponentDefinitions(definitions) {
1850
- if (definitions) {
1851
- _wcDefinitions = $.merge(_wcDefinitions, definitions);
1852
- }
1853
- }
1854
- exports.registerWebComponentDefinitions = registerWebComponentDefinitions;
1855
1955
  function sortString(a, b) {
1856
1956
  if (a >= b) {
1857
1957
  return 1;
1858
1958
  }
1859
1959
  return -1;
1860
1960
  }
1861
- function generateWebComponentTypings(wc, template) {
1961
+ function generateWebComponentTypings(wc, template, info) {
1862
1962
  // export default defineVueWebComponent
1863
1963
  let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
1864
1964
  let content = fsExtra.readFileSync(wcPath, 'utf8');
@@ -1872,18 +1972,21 @@ function generateWebComponentTypings(wc, template) {
1872
1972
  importPath = importPath.replace("./", "");
1873
1973
  }
1874
1974
  if ($.isExtensionEnv) {
1875
- importPath = `../../../../${importPath}`;
1975
+ importPath = `../../../../../${importPath}`;
1876
1976
  }
1877
1977
  else {
1878
- importPath = `../../../${importPath}`;
1978
+ importPath = `../../../../${importPath}`;
1879
1979
  }
1980
+ let elementNamePascalCase = wc.componentOptions.elementName.replace("omfx-", "").replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); });
1981
+ elementNamePascalCase = elementNamePascalCase[0].toUpperCase() + elementNamePascalCase.substring(1, elementNamePascalCase.length);
1982
+ info.wc.mappings[elementNamePascalCase] = wc.componentOptions.elementName;
1880
1983
  return template
1881
1984
  .replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
1882
1985
  //{{importWC}}`)
1883
1986
  .replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": typeof ${friendlyManifestId}.propsDefinition & VueComponentBaseProps
1884
1987
  //{{elementName}}`)
1885
- .replace(/\/\/{{omfxelementName}}/, `"${wc.componentOptions.elementName.replace("omfx-", "").replace(/-([a-z])/g, function (g) { return g[1].toUpperCase(); })}": typeof ${friendlyManifestId} & VueComponentBaseProps
1886
- //{{omfxelementName}}`);
1988
+ .replace(/\/\/{{nselementName}}/, `"${elementNamePascalCase}": typeof ${friendlyManifestId} & VueComponentBaseProps
1989
+ //{{nselementName}}`);
1887
1990
  }
1888
1991
  return template;
1889
1992
  }
@@ -5,6 +5,7 @@ import * as composers from "@omnia/tooling-composers";
5
5
  import * as enums from "../composers/models/Enums";
6
6
  import * as composer from '../composers/task';
7
7
  import { core, utils } from '@omnia/tooling';
8
+ import { isExtensionEnv } from "./shared";
8
9
  import merge from 'webpack-merge';
9
10
  import webpack from 'webpack';
10
11
  declare var tooling: {
@@ -16,5 +17,4 @@ declare var tooling: {
16
17
  LogTypes: typeof utils.LogTypes;
17
18
  };
18
19
  declare var basePathProcess: string;
19
- declare var isExtensionEnv: boolean;
20
20
  export { omniaWebpackPlugins, basePathProcess, isExtensionEnv, tooling, webpack, chalk, timestamp, path, fs, extend, merge, del, md5File, composers, enums };
@@ -28,6 +28,8 @@ const enums = tslib_1.__importStar(require("@omnia/tooling-composers/internal-do
28
28
  exports.enums = enums;
29
29
  const composer = tslib_1.__importStar(require("@omnia/tooling-composers/internal-do-not-import-from-here/task"));
30
30
  const tooling_1 = require("@omnia/tooling");
31
+ const shared_1 = require("./shared");
32
+ Object.defineProperty(exports, "isExtensionEnv", { enumerable: true, get: function () { return shared_1.isExtensionEnv; } });
31
33
  const webpack_merge_1 = tslib_1.__importDefault(require("webpack-merge"));
32
34
  exports.merge = webpack_merge_1.default;
33
35
  const webpack_1 = tslib_1.__importDefault(require("webpack"));
@@ -36,5 +38,3 @@ var tooling = { composer, core: tooling_1.core, utils: tooling_1.utils, log: too
36
38
  exports.tooling = tooling;
37
39
  var basePathProcess = process.cwd();
38
40
  exports.basePathProcess = basePathProcess;
39
- var isExtensionEnv = fs.existsSync(basePathProcess + "/node_modules/@omnia/tooling-vue/package.json");
40
- exports.isExtensionEnv = isExtensionEnv;
@@ -10,6 +10,7 @@ const utils_1 = require("./utils");
10
10
  const manifest_1 = require("./manifest");
11
11
  const vueJsx_1 = require("./vueJsx");
12
12
  const $ = tslib_1.__importStar(require("../../variables"));
13
+ const shared_1 = require("../../shared");
13
14
  let fileGraphs = {};
14
15
  let manifests = {};
15
16
  const initialManifests = [
@@ -151,6 +152,7 @@ async function buildFileGraph(unknownId, code) {
151
152
  return { fileGraph, code };
152
153
  }
153
154
  fileGraph.js.scanned = true;
155
+ code = (0, shared_1.replaceWebComponentNamespaceMapping)(code);
154
156
  const esbuildTransformResult = await (0, vite_1.transformWithEsbuild)(code, id, esbuildTransformOptions);
155
157
  code = esbuildTransformResult.code;
156
158
  // d.ts or interface only
File without changes
@@ -1,9 +1,6 @@
1
1
  export default function (): {
2
2
  test: RegExp;
3
- use: ({
4
- loader: any;
5
- options?: undefined;
6
- } | {
3
+ use: {
7
4
  loader: string;
8
5
  options: {
9
6
  loader: string;
@@ -16,5 +13,5 @@ export default function (): {
16
13
  };
17
14
  };
18
15
  };
19
- })[];
16
+ }[];
20
17
  }[];
@@ -1,15 +1,10 @@
1
1
  'use strict';
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const $ = tslib_1.__importStar(require("../variables"));
5
3
  var path = require('path');
6
4
  function default_1() {
7
5
  return [{
8
6
  test: /\.ts$/,
9
7
  use: [
10
- {
11
- loader: path.resolve(__dirname, $.isExtensionEnv ? './esbuild-custom-loader.js' : './esbuild-custom-loader.ts'),
12
- },
13
8
  {
14
9
  loader: 'esbuild-loader',
15
10
  options: {
@@ -22,5 +22,8 @@ export default function (): {
22
22
  };
23
23
  };
24
24
  };
25
+ } | {
26
+ loader: any;
27
+ options?: undefined;
25
28
  })[];
26
29
  }[];
@@ -61,6 +61,9 @@ function default_1() {
61
61
  }
62
62
  }
63
63
  },
64
+ },
65
+ {
66
+ loader: path.resolve(__dirname, $.isExtensionEnv ? './wc-loader.js' : './wc-loader.ts'),
64
67
  }
65
68
  ];
66
69
  return [
@@ -0,0 +1 @@
1
+ export default function (content: any, context: any): string;
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const shared_1 = require("../shared");
4
+ function default_1(content, context) {
5
+ return (0, shared_1.replaceWebComponentNamespaceMapping)(content);
6
+ }
7
+ exports.default = default_1;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/tooling-vue",
3
3
  "license": "MIT",
4
- "version": "8.0.79-vnext",
4
+ "version": "8.0.81-vnext",
5
5
  "description": "Used to bundle and serve manifests web component that build on Vue framework.",
6
6
  "scripts": {
7
7
  "test": "echo \"Error: no test specified\" && exit 1"
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "author": "Precio Fishbone",
21
21
  "dependencies": {
22
- "@omnia/fx-models": "8.0.79-vnext",
23
- "@omnia/tooling-composers": "8.0.79-vnext",
22
+ "@omnia/fx-models": "8.0.81-vnext",
23
+ "@omnia/tooling-composers": "8.0.81-vnext",
24
24
  "@types/mousetrap": "1.5.34",
25
25
  "@types/quill": "1.3.6",
26
26
  "@types/zepto": "1.0.29",