@oclif/core 3.0.0-beta.21 → 3.0.0-beta.22

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.
@@ -15,7 +15,7 @@ export declare class ux {
15
15
  static get action(): ActionBase;
16
16
  static styledObject(obj: any, keys?: string[]): void;
17
17
  static styledHeader(header: string): void;
18
- static get styledJSON(): typeof styled.styledJSON;
18
+ static styledJSON(obj: unknown): void;
19
19
  static get table(): typeof styled.Table.table;
20
20
  static get tree(): typeof styled.tree;
21
21
  static get wait(): typeof uxWait;
@@ -29,7 +29,7 @@ export declare class ux {
29
29
  static annotation(text: string, annotation: string): void;
30
30
  static flush(ms?: number): Promise<void>;
31
31
  }
32
- declare const action: ActionBase, annotation: typeof ux.annotation, anykey: typeof uxPrompt.anykey, confirm: typeof uxPrompt.confirm, debug: typeof ux.debug, done: typeof ux.done, flush: typeof ux.flush, info: typeof ux.info, log: typeof ux.log, progress: typeof styled.progress, prompt: typeof uxPrompt.prompt, styledHeader: typeof ux.styledHeader, styledJSON: typeof styled.styledJSON, styledObject: typeof ux.styledObject, table: typeof styled.Table.table, trace: typeof ux.trace, tree: typeof styled.tree, url: typeof ux.url, wait: (ms?: number) => Promise<void>;
32
+ declare const action: ActionBase, annotation: typeof ux.annotation, anykey: typeof uxPrompt.anykey, confirm: typeof uxPrompt.confirm, debug: typeof ux.debug, done: typeof ux.done, flush: typeof ux.flush, info: typeof ux.info, log: typeof ux.log, progress: typeof styled.progress, prompt: typeof uxPrompt.prompt, styledHeader: typeof ux.styledHeader, styledJSON: typeof ux.styledJSON, styledObject: typeof ux.styledObject, table: typeof styled.Table.table, trace: typeof ux.trace, tree: typeof styled.tree, url: typeof ux.url, wait: (ms?: number) => Promise<void>;
33
33
  declare const error: typeof Errors.error, exit: typeof Errors.exit, warn: typeof Errors.warn;
34
34
  export { action, annotation, anykey, confirm, debug, done, error, exit, flush, info, log, progress, prompt, styledHeader, styledJSON, styledObject, table, trace, tree, url, wait, warn, };
35
35
  export { ExitError } from './exit';
@@ -35,8 +35,15 @@ class ux {
35
35
  static styledHeader(header) {
36
36
  this.info(chalk_1.default.dim('=== ') + chalk_1.default.bold(header) + '\n');
37
37
  }
38
- static get styledJSON() {
39
- return styled.styledJSON;
38
+ static styledJSON(obj) {
39
+ const json = JSON.stringify(obj, null, 2);
40
+ if (!chalk_1.default.level) {
41
+ info(json);
42
+ return;
43
+ }
44
+ const cardinal = require('cardinal');
45
+ const theme = require('cardinal/themes/jq');
46
+ this.info(cardinal.highlight(json, { json: true, theme }));
40
47
  }
41
48
  static get table() {
42
49
  return styled.Table.table;
@@ -1,5 +1,4 @@
1
1
  export * as Table from './table';
2
2
  export { default as progress } from './progress';
3
- export { default as styledJSON } from './json';
4
3
  export { default as styledObject } from './object';
5
4
  export { default as tree } from './tree';
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.tree = exports.styledObject = exports.styledJSON = exports.progress = exports.Table = void 0;
3
+ exports.tree = exports.styledObject = exports.progress = exports.Table = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  exports.Table = tslib_1.__importStar(require("./table"));
6
6
  var progress_1 = require("./progress");
7
7
  Object.defineProperty(exports, "progress", { enumerable: true, get: function () { return tslib_1.__importDefault(progress_1).default; } });
8
- var json_1 = require("./json");
9
- Object.defineProperty(exports, "styledJSON", { enumerable: true, get: function () { return tslib_1.__importDefault(json_1).default; } });
10
8
  var object_1 = require("./object");
11
9
  Object.defineProperty(exports, "styledObject", { enumerable: true, get: function () { return tslib_1.__importDefault(object_1).default; } });
12
10
  var tree_1 = require("./tree");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@oclif/core",
3
3
  "description": "base library for oclif CLIs",
4
- "version": "3.0.0-beta.21",
4
+ "version": "3.0.0-beta.22",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/core/issues",
7
7
  "dependencies": {
@@ -1 +0,0 @@
1
- export default function styledJSON(obj: unknown): void;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const tslib_1 = require("tslib");
4
- const chalk_1 = tslib_1.__importDefault(require("chalk"));
5
- const node_util_1 = require("node:util");
6
- const stream_1 = require("../stream");
7
- const info = (output) => stream_1.stdout.write((0, node_util_1.format)(output) + '\n');
8
- function styledJSON(obj) {
9
- const json = JSON.stringify(obj, null, 2);
10
- if (!chalk_1.default.level) {
11
- info(json);
12
- return;
13
- }
14
- const cardinal = require('cardinal');
15
- const theme = require('cardinal/themes/jq');
16
- info(cardinal.highlight(json, { json: true, theme }));
17
- }
18
- exports.default = styledJSON;