@yarnpkg/plugin-essentials 4.0.2 → 4.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.
@@ -8,7 +8,6 @@ const core_2 = require("@yarnpkg/core");
8
8
  const fslib_1 = require("@yarnpkg/fslib");
9
9
  const clipanion_1 = require("clipanion");
10
10
  const semver_1 = tslib_1.__importDefault(require("semver"));
11
- const url_1 = require("url");
12
11
  const vm_1 = require("vm");
13
12
  const list_1 = require("./list");
14
13
  // eslint-disable-next-line arca/no-default-export
@@ -39,7 +38,7 @@ class PluginImportCommand extends cli_1.BaseCommand {
39
38
  let pluginUrl;
40
39
  if (this.name.match(/^https?:/)) {
41
40
  try {
42
- new url_1.URL(this.name);
41
+ new URL(this.name);
43
42
  }
44
43
  catch {
45
44
  throw new core_1.ReportError(core_1.MessageName.INVALID_PLUGIN_REFERENCE, `Plugin specifier "${this.name}" is neither a plugin name nor a valid url`);
@@ -1,5 +1,6 @@
1
1
  import { BaseCommand } from '@yarnpkg/cli';
2
2
  export default class RunIndexCommand extends BaseCommand {
3
3
  static paths: string[][];
4
+ json: boolean;
4
5
  execute(): Promise<0 | 1>;
5
6
  }
@@ -3,9 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const cli_1 = require("@yarnpkg/cli");
4
4
  const core_1 = require("@yarnpkg/core");
5
5
  const core_2 = require("@yarnpkg/core");
6
+ const clipanion_1 = require("clipanion");
6
7
  const util_1 = require("util");
7
8
  // eslint-disable-next-line arca/no-default-export
8
9
  class RunIndexCommand extends cli_1.BaseCommand {
10
+ constructor() {
11
+ super(...arguments);
12
+ this.json = clipanion_1.Option.Boolean(`--json`, false, {
13
+ description: `Format the output as an NDJSON stream`,
14
+ });
15
+ }
9
16
  async execute() {
10
17
  const configuration = await core_1.Configuration.find(this.context.cwd, this.context.plugins);
11
18
  const { project, workspace } = await core_1.Project.find(configuration, this.context.cwd);
@@ -14,6 +21,7 @@ class RunIndexCommand extends cli_1.BaseCommand {
14
21
  const report = await core_1.StreamReport.start({
15
22
  configuration,
16
23
  stdout: this.context.stdout,
24
+ json: this.json,
17
25
  }, async (report) => {
18
26
  const scripts = workspace.manifest.scripts;
19
27
  const keys = core_2.miscUtils.sortMap(scripts.keys(), key => key);
@@ -25,8 +33,9 @@ class RunIndexCommand extends cli_1.BaseCommand {
25
33
  const maxKeyLength = keys.reduce((max, key) => {
26
34
  return Math.max(max, key.length);
27
35
  }, 0);
28
- for (const [key, value] of scripts.entries()) {
29
- report.reportInfo(null, `${key.padEnd(maxKeyLength, ` `)} ${(0, util_1.inspect)(value, inspectConfig)}`);
36
+ for (const [key, script] of scripts.entries()) {
37
+ report.reportInfo(null, `${key.padEnd(maxKeyLength, ` `)} ${(0, util_1.inspect)(script, inspectConfig)}`);
38
+ report.reportJson({ name: key, script });
30
39
  }
31
40
  });
32
41
  return report.exitCode();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yarnpkg/plugin-essentials",
3
- "version": "4.0.2",
3
+ "version": "4.1.0",
4
4
  "license": "BSD-2-Clause",
5
5
  "main": "./lib/index.js",
6
6
  "exports": {
@@ -8,7 +8,7 @@
8
8
  "./package.json": "./package.json"
9
9
  },
10
10
  "dependencies": {
11
- "@yarnpkg/fslib": "^3.0.1",
11
+ "@yarnpkg/fslib": "^3.0.2",
12
12
  "@yarnpkg/parsers": "^3.0.0",
13
13
  "ci-info": "^3.2.0",
14
14
  "clipanion": "^4.0.0-rc.2",
@@ -20,16 +20,16 @@
20
20
  "typanion": "^3.14.0"
21
21
  },
22
22
  "peerDependencies": {
23
- "@yarnpkg/cli": "^4.0.2",
24
- "@yarnpkg/core": "^4.0.2",
23
+ "@yarnpkg/cli": "^4.1.0",
24
+ "@yarnpkg/core": "^4.0.3",
25
25
  "@yarnpkg/plugin-git": "^3.0.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@types/lodash": "^4.14.136",
29
29
  "@types/micromatch": "^4.0.1",
30
30
  "@types/semver": "^7.1.0",
31
- "@yarnpkg/cli": "^4.0.2",
32
- "@yarnpkg/core": "^4.0.2",
31
+ "@yarnpkg/cli": "^4.1.0",
32
+ "@yarnpkg/core": "^4.0.3",
33
33
  "@yarnpkg/plugin-git": "^3.0.0"
34
34
  },
35
35
  "repository": {