@komaci/cli 242.3.1 → 244.1.0

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.
@@ -47,6 +47,12 @@ export default {
47
47
  type: Boolean,
48
48
  defaultValue: false,
49
49
  },
50
+ {
51
+ name: 'luvioMetadata',
52
+ alias: 'l',
53
+ type: Boolean,
54
+ defaultValue: false,
55
+ },
50
56
  ],
51
57
  run,
52
58
  };
@@ -1,4 +1,4 @@
1
- import { BundleConfig } from '@lwc-platform/lwc-metadata-next';
1
+ import { BundleConfig } from '@lwc/metadata';
2
2
  import { ParsedBundle } from '../types';
3
3
  /**
4
4
  * typeof BundleConfig.file
@@ -1,6 +1,6 @@
1
1
  import { readdirSync, existsSync, readFileSync } from 'fs';
2
2
  import { basename, dirname, extname, resolve } from 'path';
3
- import { collectBundleMetadata } from '@lwc-platform/lwc-metadata-next';
3
+ import { collectBundleMetadata } from '@lwc/metadata';
4
4
  import { generateKomaciModule, processGeneratorInputAndState } from '@komaci/esm-generator';
5
5
  /**
6
6
  * Finds all .js, .mjs, .css, and .html files within the given directory, reads their contents, and combines them into a bundle,
@@ -68,6 +68,9 @@ export function readAndParseBundle(path, configOverrides) {
68
68
  const inputFiles = Object.fromEntries(metadata.files
69
69
  .map(({ fileName, komaciDoc }) => [fileName, komaciDoc])
70
70
  .filter(([, komaciDoc]) => !!komaciDoc));
71
+ const luvioMetadataFileMap = new Map(metadata.files.filter((file) => file.fileType == 'js' &&
72
+ file.luvioMetadata != undefined &&
73
+ file.luvioMetadata.gqlTag.length > 0).map((file) => [file.fileName, file.luvioMetadata]));
71
74
  const generatorInput = {
72
75
  moduleInfo: {
73
76
  name,
@@ -76,6 +79,7 @@ export function readAndParseBundle(path, configOverrides) {
76
79
  files: inputFiles,
77
80
  },
78
81
  srcFileMap,
82
+ luvioMetadata: luvioMetadataFileMap.size >= 1 ? luvioMetadataFileMap : undefined,
79
83
  };
80
84
  const modGenOutput = generateKomaciModule(generatorInput);
81
85
  return {
@@ -6,7 +6,7 @@ const { log, warn } = logger;
6
6
  * @param cmdOptions
7
7
  */
8
8
  export function run(cmdOptions) {
9
- const { paths = [], disableKomaci = false, bundleType: type } = cmdOptions;
9
+ const { paths = [], disableKomaci = false, bundleType: type, luvioMetadata } = cmdOptions;
10
10
  if (paths.length) {
11
11
  if (cmdOptions.withExceptions) {
12
12
  const errors = [];
@@ -24,7 +24,7 @@ export function run(cmdOptions) {
24
24
  });
25
25
  }
26
26
  else {
27
- const parsedBundles = paths.map((path) => readAndParseBundle(path, { enableKomaci: !disableKomaci, type }));
27
+ const parsedBundles = paths.map((path) => readAndParseBundle(path, { enableKomaci: !disableKomaci, type, enableLuvio: luvioMetadata }));
28
28
  for (const parsedBundle of parsedBundles) {
29
29
  const { input: { bundleConfig = null } = {}, output } = parsedBundle || {};
30
30
  const { type, namespace, name, namespaceMapping = {}, enableKomaci = false, files = [], } = bundleConfig || {};
@@ -19,5 +19,6 @@ export interface ModGenOptions extends CommandLineOptions {
19
19
  bundleType: BundleType;
20
20
  json: boolean;
21
21
  withExceptions: boolean;
22
+ luvioMetadata: boolean;
22
23
  }
23
24
  //# sourceMappingURL=types.d.ts.map
package/build/lib/log.js CHANGED
@@ -8,8 +8,11 @@ const { red, yellow, blue } = chalk;
8
8
  * @returns Seralized version of the object,
9
9
  */
10
10
  export function serialize(obj, pretty = true) {
11
- const options = pretty ? { depth: 5, colors: true } : { depth: Infinity };
12
- return inspect(obj, options);
11
+ if (pretty) {
12
+ const options = { depth: 5, colors: true };
13
+ return inspect(obj, options);
14
+ }
15
+ return JSON.stringify(obj, null, 2);
13
16
  }
14
17
  export default {
15
18
  log,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@komaci/cli",
3
- "version": "242.3.1",
3
+ "version": "244.1.0",
4
4
  "description": "CLI utility that enables developers to use komaci from the command line.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -24,8 +24,8 @@
24
24
  "url": "https://github.com/AndrewHuffman/komaci/issues"
25
25
  },
26
26
  "dependencies": {
27
- "@komaci/esm-generator": "242.3.1",
28
- "@lwc/metadata": "2.22.0-0",
27
+ "@komaci/esm-generator": "244.1.0",
28
+ "@lwc/metadata": "2.32.0-0",
29
29
  "@lwc/sfdc-compiler-utils": "2.22.0-0",
30
30
  "chalk": "^5.0.1",
31
31
  "command-line-args": "^5.2.1"