@omnia/tooling-vue 8.0.335-dev → 8.0.337-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.
@@ -334,6 +334,7 @@ function buildManifestMetadata(entries) {
334
334
  }
335
335
  $.tooling.logTime('Build manifests metadata done', startTime);
336
336
  compiler.close((err, result) => { });
337
+ compiler = null;
337
338
  resolve(entries);
338
339
  });
339
340
  }
@@ -463,103 +464,114 @@ function bundleManifest(entries) {
463
464
  webpackConfigs.push(vueWebpackConfig);
464
465
  });
465
466
  // run on each batch 500 manifets to prevent memory leak and perf
466
- // let start = 0
467
- // let end = webpackConfigs.length > 500 ? 500 : webpackConfigs.length
468
- // function recursiveCompile() {
469
- // let compiler = $.webpack(webpackConfigs.slice(start, end))
470
- // compiler.run((err, stats) => {
471
- // if (err) {
472
- // $.tooling.log('Bundle manifest error : \r\n', $.tooling.LogTypes.Error);
473
- // $.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
474
- // reject();
475
- // //compiler.close((err, result) => { })
476
- // return;
477
- // }
478
- // if (stats.hasErrors()) {
479
- // $.tooling.log('Bundle manifest have error : \r\n', $.tooling.LogTypes.Error);
480
- // let errors = stats.toJson().errors;
481
- // errors.forEach((err: any) => {
482
- // $.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
483
- // })
484
- // reject();
485
- // //compiler.close((err, result) => { })
486
- // return;
487
- // }
488
- // compiler.close((err, result) => { });
489
- // compiler = null;
490
- // if (end === webpackConfigs.length) {
491
- // if (checkDuplicateBundle()) { // detect duplicated bundle
492
- // $.tooling.log('Bundle manifest have error that found duplicated bundles', $.tooling.LogTypes.Error);
493
- // reject();
494
- // //compiler.close((err, result) => { })
495
- // return;
496
- // }
497
- // // merge stylex.css
498
- // const stylexFiles: string[] = globbySync([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath).replace(/\\/g, "/")}/*.stylex.css`]);
499
- // stylexFiles?.forEach(stylexFilePath => {
500
- // const manifestCssFilePath = stylexFilePath.replace(".stylex.css", ".css");
501
- // const styelxCss = fsExtra.readFileSync(stylexFilePath, 'utf8');
502
- // if (!fsExtra.existsSync(manifestCssFilePath)) {
503
- // fsExtra.outputFileSync(manifestCssFilePath, styelxCss);
504
- // } else {
505
- // const css = fsExtra.readFileSync(manifestCssFilePath, 'utf8');
506
- // fsExtra.outputFileSync(manifestCssFilePath, `${styelxCss}
507
- // ${css}`);
508
- // }
509
- // fsExtra.removeSync(stylexFilePath);
510
- // });
511
- // resolve(entries)
512
- // } else {
513
- // start = start + 500;
514
- // end = (end + 500) > webpackConfigs.length ? webpackConfigs.length : end + 500
515
- // recursiveCompile();
516
- // }
517
- // });
518
- // }
519
- // recursiveCompile();
520
- let compiler = $.webpack(webpackConfigs);
521
- compiler.run((err, stats) => {
522
- if (checkDuplicateBundle()) { // detect duplicated bundle
523
- $.tooling.log('Bundle manifest have error that found duplicated bundles', $.tooling.LogTypes.Error);
524
- reject();
525
- //compiler.close((err, result) => { })
526
- return;
527
- }
528
- if (err) {
529
- $.tooling.log('Bundle manifest error : \r\n', $.tooling.LogTypes.Error);
530
- $.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
531
- reject();
532
- //compiler.close((err, result) => { })
533
- return;
467
+ let start = 0;
468
+ let end = webpackConfigs.length > 500 ? 500 : webpackConfigs.length;
469
+ function recursiveCompile() {
470
+ let compiler = $.webpack(webpackConfigs.slice(start, end));
471
+ let startTime = new Date().getTime();
472
+ if (end >= 500) {
473
+ tooling_1.utils.logTime(`Bundle a batch manifests from ${start} to ${end} running...`, startTime);
534
474
  }
535
- if (stats.hasErrors()) {
536
- $.tooling.log('Bundle manifest have error : \r\n', $.tooling.LogTypes.Error);
537
- let errors = stats.toJson().errors;
538
- errors.forEach((err) => {
475
+ compiler.run((err, stats) => {
476
+ if (err) {
477
+ $.tooling.log('Bundle manifest error : \r\n', $.tooling.LogTypes.Error);
539
478
  $.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
540
- });
541
- reject();
542
- //compiler.close((err, result) => { })
543
- return;
544
- }
545
- compiler.close((err, result) => { });
546
- // merge stylex.css
547
- const stylexFiles = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath).replace(/\\/g, "/")}/*.stylex.css`]);
548
- stylexFiles?.forEach(stylexFilePath => {
549
- const manifestCssFilePath = stylexFilePath.replace(".stylex.css", ".css");
550
- const styelxCss = fsExtra.readFileSync(stylexFilePath, 'utf8');
551
- if (!fsExtra.existsSync(manifestCssFilePath)) {
552
- fsExtra.outputFileSync(manifestCssFilePath, styelxCss);
479
+ reject();
480
+ //compiler.close((err, result) => { })
481
+ return;
482
+ }
483
+ if (stats.hasErrors()) {
484
+ $.tooling.log('Bundle manifest have error : \r\n', $.tooling.LogTypes.Error);
485
+ let errors = stats.toJson().errors;
486
+ errors.forEach((err) => {
487
+ $.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
488
+ });
489
+ reject();
490
+ //compiler.close((err, result) => { })
491
+ return;
492
+ }
493
+ compiler.close((err, result) => { });
494
+ compiler = null;
495
+ if (end === webpackConfigs.length) {
496
+ if (checkDuplicateBundle()) { // detect duplicated bundle
497
+ $.tooling.log('Bundle manifest have error that found duplicated bundles', $.tooling.LogTypes.Error);
498
+ reject();
499
+ //compiler.close((err, result) => { })
500
+ return;
501
+ }
502
+ // merge stylex.css
503
+ const stylexFiles = (0, globby_1.globbySync)([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath).replace(/\\/g, "/")}/*.stylex.css`]);
504
+ stylexFiles?.forEach(stylexFilePath => {
505
+ const manifestCssFilePath = stylexFilePath.replace(".stylex.css", ".css");
506
+ const styelxCss = fsExtra.readFileSync(stylexFilePath, 'utf8');
507
+ if (!fsExtra.existsSync(manifestCssFilePath)) {
508
+ fsExtra.outputFileSync(manifestCssFilePath, styelxCss);
509
+ }
510
+ else {
511
+ const css = fsExtra.readFileSync(manifestCssFilePath, 'utf8');
512
+ fsExtra.outputFileSync(manifestCssFilePath, `${styelxCss}
513
+ ${css}`);
514
+ }
515
+ fsExtra.removeSync(stylexFilePath);
516
+ });
517
+ if (end >= 500) {
518
+ tooling_1.utils.logTime(`Bundle a batch manifests from ${start} to ${end} done`, startTime);
519
+ }
520
+ resolve(entries);
553
521
  }
554
522
  else {
555
- const css = fsExtra.readFileSync(manifestCssFilePath, 'utf8');
556
- fsExtra.outputFileSync(manifestCssFilePath, `${styelxCss}
557
- ${css}`);
523
+ if (end >= 500) {
524
+ tooling_1.utils.logTime(`Bundle a batch manifests from ${start} to ${end} done`, startTime);
525
+ }
526
+ start = start + 500;
527
+ end = (end + 500) > webpackConfigs.length ? webpackConfigs.length : end + 500;
528
+ recursiveCompile();
558
529
  }
559
- fsExtra.removeSync(stylexFilePath);
560
530
  });
561
- resolve(entries);
562
- });
531
+ }
532
+ recursiveCompile();
533
+ // let compiler = $.webpack(webpackConfigs)
534
+ // compiler.run((err, stats) => {
535
+ // if (checkDuplicateBundle()) { // detect duplicated bundle
536
+ // $.tooling.log('Bundle manifest have error that found duplicated bundles', $.tooling.LogTypes.Error);
537
+ // reject();
538
+ // //compiler.close((err, result) => { })
539
+ // return;
540
+ // }
541
+ // if (err) {
542
+ // $.tooling.log('Bundle manifest error : \r\n', $.tooling.LogTypes.Error);
543
+ // $.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
544
+ // reject();
545
+ // //compiler.close((err, result) => { })
546
+ // return;
547
+ // }
548
+ // if (stats.hasErrors()) {
549
+ // $.tooling.log('Bundle manifest have error : \r\n', $.tooling.LogTypes.Error);
550
+ // let errors = stats.toJson().errors;
551
+ // errors.forEach((err: any) => {
552
+ // $.tooling.log(err.stack || err, $.tooling.LogTypes.Error);
553
+ // })
554
+ // reject();
555
+ // //compiler.close((err, result) => { })
556
+ // return;
557
+ // }
558
+ // compiler.close((err, result) => { });
559
+ // // merge stylex.css
560
+ // const stylexFiles: string[] = globbySync([`${$.tooling.utils.root($.tooling.composer.OmniaOutput.OutputBundlePath).replace(/\\/g, "/")}/*.stylex.css`]);
561
+ // stylexFiles?.forEach(stylexFilePath => {
562
+ // const manifestCssFilePath = stylexFilePath.replace(".stylex.css", ".css");
563
+ // const styelxCss = fsExtra.readFileSync(stylexFilePath, 'utf8');
564
+ // if (!fsExtra.existsSync(manifestCssFilePath)) {
565
+ // fsExtra.outputFileSync(manifestCssFilePath, styelxCss);
566
+ // } else {
567
+ // const css = fsExtra.readFileSync(manifestCssFilePath, 'utf8');
568
+ // fsExtra.outputFileSync(manifestCssFilePath, `${styelxCss}
569
+ // ${css}`);
570
+ // }
571
+ // fsExtra.removeSync(stylexFilePath);
572
+ // });
573
+ // resolve(entries)
574
+ // });
563
575
  }
564
576
  }
565
577
  catch (e) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@omnia/tooling-vue",
3
3
  "license": "MIT",
4
- "version": "8.0.335-dev",
4
+ "version": "8.0.337-dev",
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.335-dev",
23
- "@omnia/tooling-composers": "8.0.335-dev",
22
+ "@omnia/fx-models": "8.0.337-dev",
23
+ "@omnia/tooling-composers": "8.0.337-dev",
24
24
  "@types/mousetrap": "1.5.34",
25
25
  "@types/quill": "1.3.6",
26
26
  "@types/zepto": "1.0.29",