@omnia/tooling-vue 8.0.15-vnext → 8.0.17-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 (56) hide show
  1. package/internal-do-not-import-from-here/config/omnia.vendor.manifest.json +1 -1
  2. package/internal-do-not-import-from-here/config/tooling.output.json +1 -0
  3. package/internal-do-not-import-from-here/config/wctypings.d.ts +2122 -0
  4. package/internal-do-not-import-from-here/index.d.ts +3 -1
  5. package/internal-do-not-import-from-here/index.js +6 -2
  6. package/internal-do-not-import-from-here/shared.d.ts +32 -122
  7. package/internal-do-not-import-from-here/shared.js +97 -192
  8. package/internal-do-not-import-from-here/swc/extract-doc-plugin/package.json +14 -0
  9. package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.d.ts +1 -0
  10. package/internal-do-not-import-from-here/tasks/ComponentDocRegistrations.js +9 -0
  11. package/internal-do-not-import-from-here/tasks/bundle.d.ts +3 -4
  12. package/internal-do-not-import-from-here/tasks/bundle.js +266 -252
  13. package/internal-do-not-import-from-here/tasks/doc.d.ts +3 -1
  14. package/internal-do-not-import-from-here/tasks/doc.js +282 -395
  15. package/internal-do-not-import-from-here/tasks/tsc.js +1 -0
  16. package/internal-do-not-import-from-here/tasks/vendor.js +166 -19
  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 +5 -1
  20. package/internal-do-not-import-from-here/vite/hmr/manifest.js +5 -5
  21. package/internal-do-not-import-from-here/vite/hmr/runtime.js +5 -5
  22. package/internal-do-not-import-from-here/vite/hmr/transformers/internal/dynamicBundle.js +7 -1
  23. package/internal-do-not-import-from-here/vite/hmr/utils/manifest.js +3 -3
  24. package/internal-do-not-import-from-here/vite/hmr/utils/path.js +7 -6
  25. package/internal-do-not-import-from-here/vite/hmr/utils/webpack.js +2 -2
  26. package/internal-do-not-import-from-here/vite/index.js +4 -0
  27. package/internal-do-not-import-from-here/vite/middlewares/HmrMiddleware.js +8 -13
  28. package/internal-do-not-import-from-here/vite/middlewares/OmniaMiddleware.js +55 -17
  29. package/internal-do-not-import-from-here/vite/middlewares/StaticFileMiddleware.js +31 -10
  30. package/internal-do-not-import-from-here/vite/middlewares/WebpackMiddleware.js +1 -1
  31. package/internal-do-not-import-from-here/vite/plugins/OmniaPlugin.js +10 -2
  32. package/internal-do-not-import-from-here/wctypings.ts +0 -0
  33. package/internal-do-not-import-from-here/webpack-loaders/doc-loader.js +11 -0
  34. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.d.ts +11 -4
  35. package/internal-do-not-import-from-here/webpack-loaders/ts-loader.js +12 -12
  36. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.d.ts +11 -1
  37. package/internal-do-not-import-from-here/webpack-loaders/tsx-loader.js +34 -29
  38. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.d.ts +1 -0
  39. package/internal-do-not-import-from-here/webpack-loaders/wc-loader.js +11 -0
  40. package/package.json +13 -9
  41. package/internal-do-not-import-from-here/1cacb55c-202b-4cd7-819d-11bad92fa9cb.wcdefinitions.json +0 -1
  42. package/internal-do-not-import-from-here/1cacb55c-202b-4cd7-819d-11bad92fa9cb.wctypings.d.ts +0 -11
  43. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wcdefinitions.json +0 -1
  44. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.d.ts +0 -343
  45. package/internal-do-not-import-from-here/bb000000-0000-bbbb-0000-0000000000bb.wctypings.js +0 -2
  46. package/internal-do-not-import-from-here/cc000000-0000-cccc-0000-0000000000cc.wcdefinitions.json +0 -1
  47. package/internal-do-not-import-from-here/config/tsconfig.es2015.json +0 -21
  48. package/internal-do-not-import-from-here/webpack-loaders/esbuild-custom-loader.js +0 -13
  49. package/internal-do-not-import-from-here/webpack-loaders/jsx-loader.d.ts +0 -8
  50. package/internal-do-not-import-from-here/webpack-loaders/jsx-loader.js +0 -61
  51. package/internal-do-not-import-from-here/webpack-loaders/vue-tsx-hot-loader.d.ts +0 -1
  52. package/internal-do-not-import-from-here/webpack-loaders/vue-tsx-hot-loader.js +0 -44
  53. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.d.ts +0 -1
  54. package/internal-do-not-import-from-here/webpack-loaders/wcmanifest-loader.js +0 -10
  55. /package/internal-do-not-import-from-here/{1cacb55c-202b-4cd7-819d-11bad92fa9cb.wctypings.js → config/wctypings.js} +0 -0
  56. /package/internal-do-not-import-from-here/webpack-loaders/{esbuild-custom-loader.d.ts → doc-loader.d.ts} +0 -0
@@ -1,23 +1,26 @@
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"));
7
7
  const fsExtra = tslib_1.__importStar(require("fs-extra"));
8
- const globby = tslib_1.__importStar(require("globby"));
8
+ const globby_1 = require("globby");
9
9
  const terser_1 = require("terser");
10
10
  const ts_loader_1 = tslib_1.__importDefault(require("../webpack-loaders/ts-loader"));
11
11
  const tsx_loader_1 = tslib_1.__importDefault(require("../webpack-loaders/tsx-loader"));
12
+ const tooling_composers_1 = require("@omnia/tooling-composers");
12
13
  const fx_models_1 = require("@omnia/fx-models");
13
14
  const $ = tslib_1.__importStar(require("../variables"));
14
15
  const shared_1 = require("../shared");
15
16
  const tooling_1 = require("@omnia/tooling");
17
+ const doc_1 = require("./doc");
16
18
  const MiniCssExtractPlugin = require('mini-css-extract-plugin');
17
19
  const ConcatSource = require('webpack-core/lib/ConcatSource');
18
20
  const CircularDependencyPlugin = require('circular-dependency-plugin');
19
21
  const isEqual = require('lodash/isEqual');
20
- let outDirManifestMetadata = "client/tooling/vue/output_manifests", _manifestsEntry = {}, _registeredReferenceManifests = [], serviceId = null, _modulesStats = {}, _manifestsStats = {}, keepTrackbuildOptions = {}, _transformResourcepaths = [], wcDomProps, _wcDefinitions = {};
22
+ const vendorProdId = "aaf89b2d-5ea8-4b79-946a-8c1e89f713a3";
23
+ let outDirManifestMetadata = "client/tooling/vue/output_manifests", _manifestsEntry = {}, _registeredReferenceManifests = [], serviceId = null, _modulesStats = {}, _manifestsStats = {}, keepTrackbuildOptions = {}, _transformResourcepaths = [];
21
24
  if ($.isExtensionEnv) {
22
25
  outDirManifestMetadata = "node_modules/@omnia/tooling-vue/internal-do-not-import-from-here/output_manifests";
23
26
  }
@@ -35,8 +38,27 @@ $.tooling.core.registerBuildTask({
35
38
  order: 2,
36
39
  task: function () {
37
40
  return new Promise(function (resolve, reject) {
38
- buildWebpackEntries()
39
- .then(resolve, reject);
41
+ buildEntries()
42
+ .then((result) => {
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
+ }
61
+ }, reject);
40
62
  });
41
63
  }
42
64
  });
@@ -50,7 +72,7 @@ $.tooling.core.registerServeTask({
50
72
  fsExtra.removeSync("node_modules/tiptap-commands/node_modules");
51
73
  fsExtra.removeSync("node_modules/tiptap-utils/node_modules");
52
74
  }
53
- buildWebpackEntries(true)
75
+ buildEntries(true)
54
76
  .then(resolve, reject);
55
77
  });
56
78
  }
@@ -169,80 +191,38 @@ function clean() {
169
191
  return new Promise(function (resolve, reject) {
170
192
  del_1.default.sync("node_modules/.cache");
171
193
  del_1.default.sync($.tooling.utils.root(outDirManifestMetadata + "/manifest.entries.cached.json"));
172
- if ($.isExtensionEnv) {
173
- del_1.default.sync($.path.resolve(__dirname, "../wctypings.ts"));
174
- }
175
- else {
176
- del_1.default.sync($.path.resolve(__dirname, `../bb000000-0000-bbbb-0000-0000000000bb.wctypings.ts`));
177
- }
194
+ shared_1.ConfigurationManager.webComponentTypings.delete();
178
195
  resolve();
179
196
  });
180
197
  }
181
- function buildWebpackEntries(serve = false) {
182
- return new Promise(function (resolve, reject) {
198
+ function buildEntries(serve = false) {
199
+ return new Promise(async function (resolve, reject) {
183
200
  try {
184
- var startTime = new Date().getTime();
201
+ let startTime = new Date().getTime();
185
202
  var componentRegistry = $.composers.ComponentRegistry;
186
203
  let componentRegistrations = componentRegistry.getRegistrations();
204
+ const serviceInfo = $.composers.ServiceManifestRegistry.getServiceInfo();
205
+ startTime = new Date().getTime();
187
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
+ }
188
211
  var resourceRegistry = $.composers.ResourceRegistry;
189
212
  let resourceBundlesWithBuildOptions = resourceRegistry.getRegisteredResourceBundles(shared_1.convertManifestPathToEntryPath);
190
- $.tooling.logTime("Found [" + (resourceBundlesWithBuildOptions ? Object.keys(resourceBundlesWithBuildOptions).length : 0) + "] resource bundles", startTime);
213
+ $.tooling.logTime("Found [" + resourceBundlesWithBuildOptions?.size + "] resource bundles", startTime);
191
214
  let resourceEntries = {};
192
- let wcDefinitionsPath, wcTypingsPath;
193
- for (let key in resourceBundlesWithBuildOptions) {
194
- let resource = resourceBundlesWithBuildOptions[key];
195
- let manifest = $.composers.LoadableManifestRegistry.getRegisteredManifest(key);
215
+ for (const res of resourceBundlesWithBuildOptions) {
216
+ let resource = res[1];
217
+ let manifest = $.composers.LoadableManifestRegistry.getRegisteredManifest(res[0]);
196
218
  if (!resource.buildOptions) {
197
- resourceEntries[`${manifest.resourceName ? manifest.resourceName + "_" : ""}${key}`] = resource.paths;
219
+ resourceEntries[`${manifest.resourceName ? manifest.resourceName + "_" : ""}${res[0]}`] = resource.paths;
198
220
  }
199
221
  else {
200
222
  //Some special handling of buildoptions
201
- console.log("debug " + key + " has build options for paths " + resource.paths + " buildoptions: " + JSON.stringify(resource.buildOptions));
223
+ console.log("debug " + res[0] + " has build options for paths " + resource.paths + " buildoptions: " + JSON.stringify(resource.buildOptions));
202
224
  }
203
225
  }
204
- //We only support typings for registered web components
205
- wcDomProps = extractTypingsForComponents(componentRegistrations);
206
- if (Object.keys(wcDomProps).length > 0) {
207
- let wcDomPropsDesc = `Extracted web component typings for ${Object.keys(wcDomProps).length} component(s)`;
208
- $.tooling.logTime(wcDomPropsDesc, startTime);
209
- }
210
- if ($.isExtensionEnv) {
211
- wcDefinitionsPath = $.path.resolve(__dirname, "../wcdefinitions.json");
212
- wcTypingsPath = $.path.resolve(__dirname, "../wctypings.ts");
213
- }
214
- else {
215
- wcDefinitionsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wcdefinitions.json`);
216
- wcTypingsPath = $.path.resolve(__dirname, `../${getServiceId().toLowerCase()}.wctypings.ts`);
217
- }
218
- fsExtra.writeJsonSync(wcDefinitionsPath, wcDomProps);
219
- let wcTypings = `
220
- //{{importWC}}
221
- declare global {
222
- namespace JSX {
223
- interface Element { }
224
- interface ElementClass { }
225
-
226
- interface IntrinsicElements {
227
- //{{elementName}}
228
- }
229
- }
230
- }
231
- `;
232
- if ($.isExtensionEnv) {
233
- wcTypings = `import { VueComponentBaseProps } from "@omnia/fx/ux";
234
- ${wcTypings}`;
235
- }
236
- else {
237
- wcTypings = `import { VueComponentBaseProps } from "../../../client/fx/ux/index";
238
- ${wcTypings}`;
239
- }
240
- componentRegistrations.forEach(wc => {
241
- wcTypings = generateWebComponentTypings(wc, wcTypings);
242
- });
243
- fsExtra.outputFileSync(wcTypingsPath, wcTypings);
244
- wcDomProps = $.merge(wcDomProps, getRegisteredWebComponentDefinitions());
245
- let componentEntries = createVueEntryFormRegistrations(componentRegistrations);
246
226
  var entries = $.merge(componentEntries, resourceEntries);
247
227
  if (checkDuplicateWebpackEntryPoints(entries)) {
248
228
  $.tooling.log('Build manifests metadata have error that found duplicated resource path', $.tooling.LogTypes.Error);
@@ -293,7 +273,15 @@ function buildManifestMetadatas(entries) {
293
273
  return;
294
274
  }
295
275
  $.tooling.log('Build manifests metadata running...', $.tooling.LogTypes.HeadLine);
296
- let updateMetadataFiles = () => {
276
+ let webpackConfigs = [];
277
+ Object.keys(entries).forEach((id) => {
278
+ var entry = {};
279
+ entry[id] = entries[id];
280
+ var vueWebpackConfig = createWebpackConfigForManifestMetadata(entry, outputDir);
281
+ webpackConfigs.push(vueWebpackConfig);
282
+ });
283
+ let compiler = $.webpack(webpackConfigs);
284
+ compiler.run((err, stats) => {
297
285
  Object.keys(entries).forEach((entry) => {
298
286
  let manifestPath = outputDir + "/" + entry + '.manifest.json';
299
287
  if ($.fs.existsSync($.tooling.utils.root(manifestPath))) {
@@ -307,17 +295,6 @@ function buildManifestMetadatas(entries) {
307
295
  $.fs.writeFileSync(manifestPath, JSON.stringify(manifestJson));
308
296
  }
309
297
  });
310
- };
311
- let webpackConfigs = [];
312
- Object.keys(entries).forEach((id) => {
313
- var entry = {};
314
- entry[id] = entries[id];
315
- var vueWebpackConfig = createWebpackConfigForManifestMetadata(entry, outputDir);
316
- webpackConfigs.push(vueWebpackConfig);
317
- });
318
- let compiler = $.webpack(webpackConfigs);
319
- compiler.run((err, stats) => {
320
- updateMetadataFiles();
321
298
  $.del.sync([outputDir + '/*.js']);
322
299
  if (err) {
323
300
  $.tooling.logTime(`Build manifests metadata have an exception`, startTime);
@@ -372,16 +349,33 @@ function beforeBundleManifest(entries) {
372
349
  isRunBuildMetadata = !isEqual(entries, cachedEntries);
373
350
  }
374
351
  if (isRunBuildMetadata) {
375
- let entriesToBuild = entries;
376
- if (!getBuildOption().allowShareWCManifestBundle) {
377
- let reourceRegistrationsKeys = Object.keys($.composers.ResourceRegistry.getResourceRegistrations());
378
- entriesToBuild = {};
379
- Object.keys(entries).forEach(entry => {
380
- if (reourceRegistrationsKeys.find(rk => entry.indexOf(rk) > -1)) {
381
- entriesToBuild[entry] = entries[entry];
382
- }
383
- });
384
- }
352
+ // cleanup before generate
353
+ del_1.default.sync(outDirManifestMetadata);
354
+ const entriesToBuild = {};
355
+ const resourceRegistrations = Array.from($.composers.ResourceRegistry.getResourceRegistrations().keys());
356
+ const wcRegistrations = $.composers.ComponentRegistry.getComponentRegistrations();
357
+ Object.keys(entries).forEach(name => {
358
+ if (resourceRegistrations.find(rk => name.indexOf(rk.toString()) > -1)) {
359
+ entriesToBuild[name] = entries[name];
360
+ }
361
+ // generate manifest metadata for wc
362
+ else if (wcRegistrations.find(rk => name.indexOf(rk.manifest.resourceId.toString()) > -1)) {
363
+ const manifestPath = $.tooling.utils.root(outDirManifestMetadata + "/" + name + '.manifest.json');
364
+ const content = {
365
+ name: `omniaWebpackJsonp['${getServiceId()}']['${$.tooling.utils.getGuidValue(name)}']`,
366
+ content: {
367
+ [entries[name][0]]: {
368
+ id: entries[name][0].toLowerCase(),
369
+ buildMeta: {
370
+ exportsType: "namespace"
371
+ }
372
+ }
373
+ }
374
+ };
375
+ fsExtra.ensureFileSync(manifestPath);
376
+ fsExtra.writeJsonSync(manifestPath, content);
377
+ }
378
+ });
385
379
  buildManifestMetadatas(entriesToBuild).then(() => {
386
380
  fsExtra.ensureFileSync(cachedEntriesPath);
387
381
  fsExtra.writeJsonSync(cachedEntriesPath, entries);
@@ -395,7 +389,6 @@ function beforeBundleManifest(entries) {
395
389
  });
396
390
  }
397
391
  function bundleManifest(entries) {
398
- var startTime = new Date().getTime();
399
392
  return new Promise(function (resolve, reject) {
400
393
  try {
401
394
  // Hacky solution to delete node_modules inside tiptap regarding miss match version prosemirror
@@ -437,14 +430,18 @@ function bundleManifest(entries) {
437
430
  }
438
431
  else {
439
432
  let webpackConfigs = [];
433
+ var startTime = new Date().getTime();
434
+ // $.tooling.logTime('Build Webpack Config running', startTime);
440
435
  Object.keys(entries).forEach((id) => {
441
436
  var entry = {};
442
437
  entry[id] = entries[id];
443
438
  var vueWebpackConfig = createVueWebpackConfig(entry, entries, $.tooling.composer.OmniaOutput.OutputBundlePath);
444
439
  webpackConfigs.push(vueWebpackConfig);
445
440
  });
441
+ // $.tooling.logTime('Build Webpack Config - done', startTime);
446
442
  let compiler = $.webpack(webpackConfigs);
447
443
  compiler.run((err, stats) => {
444
+ //console.log("webpack run -done")
448
445
  if (checkDuplicateBundle()) { // detect duplicated bundle
449
446
  $.tooling.log('Bundle manifest have error that found duplicated bundles', $.tooling.LogTypes.Error);
450
447
  reject();
@@ -526,19 +523,35 @@ function minifyBundles() {
526
523
  if (process.argv.length > 0 && process.argv.find(argv => argv === "--minify") !== undefined) {
527
524
  let startTime = new Date().getTime();
528
525
  $.tooling.log('Minify bundles running...');
529
- const jsPaths = globby.sync([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/*.js`]);
526
+ const jsPaths = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/*.js`]);
530
527
  let promises = [];
531
528
  jsPaths.forEach(filePath => {
532
529
  promises.push(new Promise(async (resolve, reject) => {
533
- $.tooling.log(`Minify Js -> ${filePath}`);
534
- let content = await fsExtra.readFile(filePath, 'utf8');
535
- let minified = await (0, terser_1.minify)(content, {
536
- sourceMap: false,
537
- ecma: 5 // will remove es5 when not support IE 11
538
- });
539
- await fsExtra.writeFile(`${filePath.substring(0, filePath.length - 3)}.min.js`, minified.code, 'utf8');
540
- $.tooling.log(`Minify Js Done -> ${filePath}`);
541
- resolve();
530
+ try {
531
+ $.tooling.log(`Minify Js -> ${filePath}`);
532
+ // only minify for omnia.vendor.prod
533
+ if (filePath.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1) {
534
+ let content = await fsExtra.readFile(filePath, 'utf8');
535
+ let outFileName = `${filePath.substring(0, filePath.length - 3)}.min.js`;
536
+ if (filePath.indexOf(vendorProdId) > -1) {
537
+ content = content.replace(new RegExp(vendorProdId, "g"), fx_models_1.OmniaResourceManifests.Vendor.toString());
538
+ outFileName = `${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath)}/omnia.vendor_6270b632-1f44-4146-bace-137131c0471b.min.js`;
539
+ }
540
+ let minified = await (0, terser_1.minify)(content, {
541
+ sourceMap: false,
542
+ ecma: 2020 // will remove es5 when not support IE 11
543
+ });
544
+ await fsExtra.writeFile(outFileName, minified.code, 'utf8');
545
+ $.tooling.log(`Minify Js Done -> ${filePath}`);
546
+ }
547
+ resolve();
548
+ }
549
+ catch (ex) {
550
+ tooling_1.utils.log(`Have a exception when minify the file -> ${filePath}`, tooling_1.utils.LogTypes.Error);
551
+ console.error(ex);
552
+ resolve();
553
+ throw new Error("Exit, have an exception.");
554
+ }
542
555
  }));
543
556
  });
544
557
  Promise.all(promises).then(() => {
@@ -551,7 +564,7 @@ function minifyBundles() {
551
564
  }
552
565
  });
553
566
  }
554
- function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModuleReload, viteHmrOption) {
567
+ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, viteHmrOption) {
555
568
  let buildOption = getBuildOption() || {};
556
569
  let isBundleCommonChunk = buildOption.bundleOptions && buildOption.bundleOptions.commonsChunk && buildOption.bundleOptions.commonsChunk.name;
557
570
  const extractCss = new MiniCssExtractPlugin({
@@ -592,7 +605,12 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
592
605
  }
593
606
  }));
594
607
  }
595
- let modifyContent = [];
608
+ let modifyContent = [
609
+ {
610
+ pattern: /\.doc\$(.*\))/g,
611
+ replacement: ''
612
+ }
613
+ ];
596
614
  if (buildOption.bundleOptions && buildOption.bundleOptions.removeSourceMap) {
597
615
  modifyContent.push({
598
616
  pattern: /# sourceMappingURL=(.*\.map)/g,
@@ -614,15 +632,18 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
614
632
  transform(data, opts) {
615
633
  // build manifets stats to detect duplicate bundle
616
634
  let entryName = Object.keys(data.assetsByChunkName)[0];
617
- _manifestsStats[entryName] = [];
618
- data.modules.filter(m => typeof m.id === 'string'
619
- && m.id.trim().length > 0
620
- && m.id.indexOf('dll-reference') === -1
621
- && m.identifier.indexOf('from dll-reference') === -1).forEach(module => {
622
- _manifestsStats[entryName].push(module.id);
623
- _modulesStats[module.id] = _modulesStats[module.id] || new Set();
624
- _modulesStats[module.id].add(entryName);
625
- });
635
+ // ignore omnia.vendor.prod
636
+ if (entryName.indexOf(vendorProdId) === -1) {
637
+ _manifestsStats[entryName] = [];
638
+ data.modules.filter(m => typeof m.id === 'string'
639
+ && m.id.trim().length > 0
640
+ && m.id.indexOf('dll-reference') === -1
641
+ && m.identifier.indexOf('from dll-reference') === -1).forEach(module => {
642
+ _manifestsStats[entryName].push(module.id);
643
+ _modulesStats[module.id] = _modulesStats[module.id] || new Set();
644
+ _modulesStats[module.id].add(entryName);
645
+ });
646
+ }
626
647
  }
627
648
  }));
628
649
  }
@@ -648,7 +669,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
648
669
  mangleExports: false,
649
670
  concatenateModules: true,
650
671
  //moduleIds: 'natural' as any
651
- }, isBundleCommonChunk ? buildCommonChunk(entry) : {}),
672
+ }, isBundleCommonChunk && !viteHmrOption ? buildCommonChunk(entry) : {}),
652
673
  resolve: {
653
674
  modules: $.tooling.core.getWebpackResolveModules(),
654
675
  extensions: ['.ts', '.tsx', '.mjs', '.js', '.jsx', '.html', '.vue', '.less', '.styl'],
@@ -658,7 +679,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
658
679
  alias: Object.assign({}, $.tooling.core.getWebpackResolveAlias(), (getBuildOption()?.moduleOptions?.alias || {}), {
659
680
  'axios$': 'axios/dist/axios.js',
660
681
  'typestyle$': 'typestyle/lib.es2015/index.js',
661
- 'vue$': 'vue/dist/vue.esm-bundler.js',
682
+ 'vue$': 'vue/dist/vue.runtime.esm-bundler.js',
662
683
  '@microsoft/signalr$': '@microsoft/signalr/dist/webworker/signalr.js',
663
684
  }),
664
685
  },
@@ -682,9 +703,8 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
682
703
  fullySpecified: false, // disable the behaviour
683
704
  },
684
705
  },
685
- ...(0, ts_loader_1.default)(getBuildOption().enableTreeShaking),
686
- ...(0, tsx_loader_1.default)(getBuildOption().enableTreeShaking, wcDomProps, hotModuleReload),
687
- // ...jsxLoader(getBuildOption().enableTreeShaking, wcDomProps, hotModuleReload),
706
+ ...(0, ts_loader_1.default)(),
707
+ ...(0, tsx_loader_1.default)(),
688
708
  {
689
709
  // remove vuetify locale
690
710
  test: (path) => {
@@ -811,7 +831,7 @@ function createVueWebpackConfig(currentEntry, entries, bundleOutputDir, hotModul
811
831
  exports.createVueWebpackConfig = createVueWebpackConfig;
812
832
  function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
813
833
  var entensionId = getServiceId();
814
- return Object.assign({}, (0, shared_1.getBaseWebpackConfigForManifestMetadata)(entry, metadataOutputDir, wcDomProps, getBuildOption().enableTreeShaking), {
834
+ return Object.assign({}, getBaseWebpackConfigForManifestMetadata(entry, metadataOutputDir), {
815
835
  plugins: [
816
836
  ...buildReferenceManifestFromConfig(),
817
837
  new $.omniaWebpackPlugins.NamedModulesPlugin(buildModuleName()),
@@ -823,6 +843,117 @@ function createWebpackConfigForManifestMetadata(entry, metadataOutputDir) {
823
843
  ]
824
844
  });
825
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
+ }
826
957
  function buildCommonChunk(entry) {
827
958
  let bundleOptions = getBuildOption().bundleOptions;
828
959
  let minChunk = bundleOptions.commonsChunk.minChunks || 2;
@@ -858,7 +989,7 @@ function buildCommonChunk(entry) {
858
989
  function processManifestGenerated(entries, outDir) {
859
990
  var allowJsOutputExtensions = [".js", ".ts", ".tsx", ".jsx", ".vue"];
860
991
  if (entries) {
861
- var manifestsPaths = globby.sync(outDir.replace(/\/$/, '') + '/*.*', {});
992
+ var manifestsPaths = (0, globby_1.globbySync)(outDir.replace(/\/$/, '') + '/*.*', {});
862
993
  if (manifestsPaths) {
863
994
  for (let p of manifestsPaths) {
864
995
  var manifestId = $.tooling.utils.getGuidValue($.tooling.utils.getFileName(p));
@@ -1076,7 +1207,8 @@ function buildReferenceManifest(currentEntry, entries) {
1076
1207
  return dynamicReferenceManifests.concat(buildReferenceManifestFromConfig());
1077
1208
  var currentEntryName = Object.keys(currentEntry)[0];
1078
1209
  // exclude omnia vendor
1079
- if (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1) {
1210
+ if (currentEntryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
1211
+ && currentEntryName.indexOf(vendorProdId) === -1) {
1080
1212
  Object.keys(entries).forEach((entryName) => {
1081
1213
  if (entryName !== currentEntryName) {
1082
1214
  if ($.fs.existsSync($.tooling.utils.root(outDirManifestMetadata + "/" + entryName + ".manifest.json"))) {
@@ -1128,7 +1260,8 @@ function buildModuleName() {
1128
1260
  replace: function (modulePath) {
1129
1261
  var buildOptions = getBuildOption();
1130
1262
  if (buildOptions && buildOptions.moduleOptions && buildOptions.moduleOptions.enableTransformResourcePath) {
1131
- if (modulePath.indexOf('./node_modules/') === -1 // ignore from npm package
1263
+ if (modulePath.indexOf('./node_modules/') === -1 // ignore from npm package and in wwwwroot .js file
1264
+ && (modulePath.indexOf('./wwwroot/') === -1 || path_1.default.extname(modulePath) === ".js")
1132
1265
  && modulePath.indexOf('./omnia/fx/models/ConfigurationComposers') === -1 // ignore comment interface for special case here
1133
1266
  && $.fs.existsSync(modulePath)) {
1134
1267
  let stream = $.fs.readFileSync(modulePath, 'utf8');
@@ -1187,89 +1320,18 @@ function getServiceId() {
1187
1320
  return serviceId;
1188
1321
  }
1189
1322
  exports.getServiceId = getServiceId;
1190
- function extractTypingsForComponents(componentRegistrations) {
1191
- let foundTypes = {};
1192
- componentRegistrations.forEach((comp) => {
1193
- let defPaths = comp.componentOptions.typings;
1194
- if (defPaths) {
1195
- let isChildSpec = false;
1196
- defPaths.forEach((defPath) => {
1197
- let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(comp.manifestPath, [defPath])[0];
1198
- let contents = $.fs.readFileSync(entryPointPath, 'utf8');
1199
- let wcEl = getWcElement(contents, isChildSpec);
1200
- if (wcEl) {
1201
- //Now lets find the interface mapped to element
1202
- //example /*@WebComponentInterface("omfx-dialog")*/
1203
- let interfaceToken = `/*@WebComponentInterface("${wcEl}")*/`;
1204
- let interfaceIndex = contents.indexOf(interfaceToken);
1205
- if (interfaceIndex > -1) {
1206
- let wcProps = [];
1207
- let intf = contents.substring(interfaceIndex);
1208
- let nextIsDomProp = false;
1209
- intf = intf
1210
- .substring(intf.indexOf("{") + 1, intf.indexOf("}"))
1211
- .replace(/\?/g, '')
1212
- .trim()
1213
- .split(/\r\n|\r|\n/g).forEach((group) => {
1214
- /*@DomProperty*/
1215
- let sub = group.trim();
1216
- if (sub.indexOf("/*@DomProperty*/") > -1) {
1217
- nextIsDomProp = true;
1218
- return;
1219
- }
1220
- if (nextIsDomProp) {
1221
- if (sub.indexOf(':')) {
1222
- sub = sub.split(':')[0];
1223
- }
1224
- if (sub) {
1225
- if (!foundTypes[wcEl]) {
1226
- foundTypes[wcEl] = [];
1227
- }
1228
- foundTypes[wcEl].push(sub);
1229
- }
1230
- nextIsDomProp = false;
1231
- }
1232
- });
1233
- }
1234
- }
1235
- isChildSpec = true;
1236
- });
1237
- }
1238
- });
1239
- return foundTypes;
1240
- }
1241
- var lastWcElement = "";
1242
- function getWcElement(contents, isChildSpec) {
1243
- if (isChildSpec) {
1244
- if (lastWcElement === "") {
1245
- new Error("Cant find the /*@DomProperty*/ on the parent interface for the WebComponent definition");
1246
- }
1247
- return lastWcElement;
1248
- }
1249
- else {
1250
- lastWcElement = "";
1251
- }
1252
- let wcElToken = "/*@WebComponent*/";
1253
- let wcElIndex = contents.indexOf(wcElToken);
1254
- let wcEl = "";
1255
- if (wcElIndex > -1) {
1256
- wcEl = contents.substring(wcElIndex);
1257
- wcEl = wcEl.substring(wcEl.indexOf('"') + 1);
1258
- wcEl = wcEl.substring(0, wcEl.indexOf('"'));
1259
- lastWcElement = wcEl;
1260
- }
1261
- return lastWcElement;
1262
- }
1263
- function createVueEntryFormRegistrations(registrations) {
1323
+ function createVueEntryFormComponentRegistrations(registrations) {
1264
1324
  let entryPaths = {};
1265
1325
  for (let r of registrations) {
1266
- if (r.componentOptions.entryPoint.endsWith('.jsx') || r.componentOptions.entryPoint.endsWith('.vue') || r.componentOptions.entryPoint.endsWith('.tsx') || r.componentOptions.entryPoint.endsWith('.ts')) {
1326
+ if (r.componentOptions.entryPoint.endsWith('.tsx')
1327
+ || r.componentOptions.entryPoint.endsWith('.vue')) {
1267
1328
  let entryPointPath = (0, shared_1.convertManifestPathToEntryPath)(r.manifestPath, [r.componentOptions.entryPoint]);
1268
1329
  let entryId = r.manifest.resourceId;
1269
1330
  if (r.manifest.resourceName) {
1270
1331
  entryId = `${r.manifest.resourceName}_${entryId}`;
1271
1332
  }
1272
- entryPaths[entryId] = entryPointPath;
1333
+ r.componentOptions.entryPointPath = entryPointPath[0];
1334
+ entryPaths[entryId.toString()] = entryPointPath;
1273
1335
  }
1274
1336
  else {
1275
1337
  $.tooling.log('The OmniaFx build system only supports .jsx, .vue and .tsx based components at the moment ', $.tooling.LogTypes.Error);
@@ -1280,7 +1342,6 @@ function createVueEntryFormRegistrations(registrations) {
1280
1342
  }
1281
1343
  function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFilePath) {
1282
1344
  let manifest = $.tooling.composer.getManifestById(currentManifestId);
1283
- let hasChanged = false;
1284
1345
  const content = fsExtra.readFileSync(manifestBundleFilePath, 'utf8');
1285
1346
  const addDependency = (dependOnmanifestId, dependOnServiceId) => {
1286
1347
  let hasNewDependency = false;
@@ -1304,7 +1365,7 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
1304
1365
  if (manifestObject && manifestObject.content) {
1305
1366
  Object.keys(manifestObject.content).forEach((modulePath) => {
1306
1367
  if (content.indexOf(modulePath) > -1) {
1307
- hasChanged = addDependency(manifest.resourceId, manifest.serviceId);
1368
+ addDependency(manifest.resourceId, manifest.serviceId);
1308
1369
  return;
1309
1370
  }
1310
1371
  });
@@ -1324,7 +1385,8 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
1324
1385
  if (entryName.toLowerCase() !== currentManifestId.toString().toLowerCase()
1325
1386
  && entryName.indexOf(fx_models_1.OmniaResourceManifests.FxWorkers.toString()) === -1
1326
1387
  && entryName.indexOf(fx_models_1.OmniaResourceManifests.FxCore.toString()) === -1 /* ignore omnia.fx.core, omnia.fx.workers and vendor manifest because ith not loaded by our resource loader */
1327
- && entryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1) {
1388
+ && entryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
1389
+ && entryName.indexOf(vendorProdId) === -1) {
1328
1390
  for (let entryPointPath of _manifestsEntry[entryName]) {
1329
1391
  if (!hasDependency) {
1330
1392
  var transformresourcePath = _transformResourcepaths.find(resource => resource.original === entryPointPath);
@@ -1336,7 +1398,7 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
1336
1398
  hasDependency = true;
1337
1399
  }
1338
1400
  if (hasDependency) {
1339
- hasChanged = addDependency($.tooling.utils.getGuidValue(entryName));
1401
+ addDependency($.tooling.utils.getGuidValue(entryName));
1340
1402
  break;
1341
1403
  }
1342
1404
  }
@@ -1344,10 +1406,6 @@ function ensureManifestDependencyInRuntime(currentManifestId, manifestBundleFile
1344
1406
  }
1345
1407
  });
1346
1408
  }
1347
- if (hasChanged) {
1348
- let manifestsData = $.tooling.composer.getManifestData();
1349
- $.tooling.composer.updateManifestData(manifestsData);
1350
- }
1351
1409
  }
1352
1410
  exports.ensureManifestDependencyInRuntime = ensureManifestDependencyInRuntime;
1353
1411
  function buildManifestsDependency(entries, manifestId, manifestBundleContent) {
@@ -1378,7 +1436,8 @@ function buildManifestsDependency(entries, manifestId, manifestBundleContent) {
1378
1436
  if (entryName.toLowerCase() !== manifestId.toLowerCase()
1379
1437
  && entryName.indexOf(fx_models_1.OmniaResourceManifests.FxWorkers.toString()) === -1
1380
1438
  && entryName.indexOf(fx_models_1.OmniaResourceManifests.FxCore.toString()) === -1 /* ignore omnia.fx.core, omnia.fx.workers and vendor manifest because ith not loaded by our resource loader */
1381
- && entryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1) {
1439
+ && entryName.indexOf(fx_models_1.OmniaResourceManifests.Vendor.toString()) === -1
1440
+ && entryName.indexOf(vendorProdId) === -1) {
1382
1441
  for (let entryPointPath of entries[entryName]) {
1383
1442
  if (!hasDependency) {
1384
1443
  var transformresourcePath = _transformResourcepaths.find(resource => resource.original === entryPointPath);
@@ -1437,15 +1496,12 @@ function chunkAsset(entries, compilation, fileName, viteHmrOption) {
1437
1496
  /******/ }
1438
1497
  /******/ omniaLoader['${omniaServiceId}'] = omniaLoader['${omniaServiceId}'] || {};
1439
1498
  /******/
1440
- /******/ function preBundle() {
1499
+ /******/ function hmrPreBundle() {
1441
1500
  ${content}
1442
1501
  /******/ }
1443
1502
 
1444
- if (omniaLoader['${omniaServiceId}']['${manifestId}']){
1445
- omniaLoader['${omniaServiceId}']['${manifestId}'](preBundle);
1446
- }
1447
- else {
1448
- omniaLoader['${omniaServiceId}']['${manifestId}'] = preBundle;
1503
+ if (!omniaLoader['${omniaServiceId}']['${manifestId}']){
1504
+ omniaLoader['${omniaServiceId}']['${manifestId}'] = hmrPreBundle;
1449
1505
  }`;
1450
1506
  }
1451
1507
  else if (viteHmrOption == 'dynamic') {
@@ -1517,7 +1573,8 @@ function checkDuplicateWebpackEntryPoints(entries) {
1517
1573
  let foundDuplicated = false;
1518
1574
  let entryPathInfos = {};
1519
1575
  Object.keys(entries).forEach(key => {
1520
- if (entries[key]) {
1576
+ // skip omnia.vendor.prod
1577
+ if (entries[key] && key.indexOf(vendorProdId) === -1) {
1521
1578
  entries[key].forEach(path => {
1522
1579
  entryPathInfos[path] = entryPathInfos[path] || [];
1523
1580
  entryPathInfos[path].push(key);
@@ -1532,13 +1589,6 @@ function checkDuplicateWebpackEntryPoints(entries) {
1532
1589
  });
1533
1590
  return foundDuplicated;
1534
1591
  }
1535
- function isEnableMeasureBuild() {
1536
- let enableMeasure = $.composers.DevelopmentBuildConfiguration.isEnableMeasureBuild;
1537
- if (enableMeasure !== true && process.argv.length > 0) {
1538
- enableMeasure = process.argv.find(argv => argv === "--measure") !== undefined;
1539
- }
1540
- return enableMeasure;
1541
- }
1542
1592
  function prefixCssSelector() {
1543
1593
  //var applyToSelectors = ['input', '::before', '::after'];
1544
1594
  //var applyToSelectors = ['select', 'textarea', 'button', 'input', '.btn', '.content', '.input-group', '.title', '.icon', '*'];
@@ -1595,45 +1645,9 @@ exports.registerManifestsReference = registerManifestsReference;
1595
1645
  function getRegisteredReferenceManifests() {
1596
1646
  return _registeredReferenceManifests;
1597
1647
  }
1598
- function registerWebComponentDefinitions(definitions) {
1599
- if (definitions) {
1600
- _wcDefinitions = $.merge(_wcDefinitions, definitions);
1601
- }
1602
- }
1603
- exports.registerWebComponentDefinitions = registerWebComponentDefinitions;
1604
- function getRegisteredWebComponentDefinitions() {
1605
- return _wcDefinitions;
1606
- }
1607
1648
  function sortString(a, b) {
1608
1649
  if (a >= b) {
1609
1650
  return 1;
1610
1651
  }
1611
1652
  return -1;
1612
1653
  }
1613
- function generateWebComponentTypings(wc, template) {
1614
- // export default defineVueWebComponent
1615
- let wcPath = (0, shared_1.convertManifestPathToEntryPath)(wc.manifestPath, [wc.componentOptions.entryPoint])[0];
1616
- let content = fsExtra.readFileSync(wcPath, 'utf8');
1617
- if (content.indexOf("defineVueWebComponent") > -1) {
1618
- if (!new RegExp('export\\s+default\\s+').test(content)) {
1619
- throw new Error(`Missing statement 'export default a vue web component' in ${wcPath}`);
1620
- }
1621
- let friendlyManifestId = `wc${wc.manifest.resourceId.replace(/-/g, '').toLowerCase()}`;
1622
- let importPath = wcPath.substring(0, wcPath.lastIndexOf('.tsx'));
1623
- if (importPath.indexOf("./") === 0) {
1624
- importPath = importPath.replace("./", "");
1625
- }
1626
- if ($.isExtensionEnv) {
1627
- importPath = `../../../../${importPath}`;
1628
- }
1629
- else {
1630
- importPath = `../../../${importPath}`;
1631
- }
1632
- return template
1633
- .replace(/\/\/{{importWC}}/, `import ${friendlyManifestId} from '${importPath}';
1634
- //{{importWC}}`)
1635
- .replace(/\/\/{{elementName}}/, `"${wc.componentOptions.elementName}": typeof ${friendlyManifestId}.propsDefinition & VueComponentBaseProps
1636
- //{{elementName}}`);
1637
- }
1638
- return template;
1639
- }