@oclif/plugin-test-esbuild 0.1.6 → 0.2.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.
package/README.md CHANGED
@@ -18,7 +18,7 @@ $ npm install -g @oclif/plugin-test-esbuild
18
18
  $ bundle COMMAND
19
19
  running command...
20
20
  $ bundle (--version)
21
- @oclif/plugin-test-esbuild/0.1.6 linux-x64 node-v20.11.0
21
+ @oclif/plugin-test-esbuild/0.2.0 linux-x64 node-v20.11.0
22
22
  $ bundle --help [COMMAND]
23
23
  USAGE
24
24
  $ bundle COMMAND
@@ -27,6 +27,7 @@ USAGE
27
27
  <!-- usagestop -->
28
28
  # Commands
29
29
  <!-- commands -->
30
+ * [`bundle esbuild [DEFAULTARG] [DEFAULTFNARG] [OPTIONALARG]`](#bundle-esbuild-defaultarg-defaultfnarg-optionalarg)
30
31
  * [`bundle hello PERSON`](#bundle-hello-person)
31
32
  * [`bundle hello alias`](#bundle-hello-alias)
32
33
  * [`bundle hello world`](#bundle-hello-world)
@@ -42,6 +43,22 @@ USAGE
42
43
  * [`bundle plugins:uninstall PLUGIN...`](#bundle-pluginsuninstall-plugin-2)
43
44
  * [`bundle plugins update`](#bundle-plugins-update)
44
45
 
46
+ ## `bundle esbuild [DEFAULTARG] [DEFAULTFNARG] [OPTIONALARG]`
47
+
48
+ ```
49
+ USAGE
50
+ $ bundle esbuild [DEFAULTARG] [DEFAULTFNARG] [OPTIONALARG] [--json] [--defaultFnString <value>]
51
+ [--defaultString <value>] [--optionalString <value>]
52
+
53
+ FLAGS
54
+ --defaultFnString=<value> [default: async fn default]
55
+ --defaultString=<value> [default: simple string default]
56
+ --optionalString=<value>
57
+
58
+ GLOBAL FLAGS
59
+ --json Format output as json.
60
+ ```
61
+
45
62
  ## `bundle hello PERSON`
46
63
 
47
64
  Say hello
package/dist/index.js CHANGED
@@ -2280,7 +2280,7 @@ var require_package = __commonJS({
2280
2280
  module2.exports = {
2281
2281
  name: "@oclif/core",
2282
2282
  description: "base library for oclif CLIs",
2283
- version: "3.19.2-dev.0",
2283
+ version: "3.19.3-dev.0",
2284
2284
  author: "Salesforce",
2285
2285
  bugs: "https://github.com/oclif/core/issues",
2286
2286
  dependencies: {
@@ -2317,7 +2317,7 @@ var require_package = __commonJS({
2317
2317
  "@oclif/plugin-help": "^6",
2318
2318
  "@oclif/plugin-plugins": "^4",
2319
2319
  "@oclif/prettier-config": "^0.2.1",
2320
- "@oclif/test": "^3.1.12",
2320
+ "@oclif/test": "^3.1.14",
2321
2321
  "@types/ansi-styles": "^3.2.1",
2322
2322
  "@types/benchmark": "^2.1.5",
2323
2323
  "@types/chai": "^4.3.11",
@@ -2351,9 +2351,9 @@ var require_package = __commonJS({
2351
2351
  husky: "^8",
2352
2352
  "lint-staged": "^14.0.1",
2353
2353
  madge: "^6.1.0",
2354
- mocha: "^10.2.0",
2354
+ mocha: "^10.3.0",
2355
2355
  nyc: "^15.1.0",
2356
- prettier: "^3.2.4",
2356
+ prettier: "^3.2.5",
2357
2357
  shx: "^0.3.4",
2358
2358
  sinon: "^16.1.3",
2359
2359
  "ts-node": "^10.9.2",
@@ -4528,34 +4528,34 @@ var require_prompt = __commonJS({
4528
4528
  Object.defineProperty(exports2, "__esModule", { value: true });
4529
4529
  exports2.anykey = exports2.confirm = exports2.prompt = void 0;
4530
4530
  var chalk_1 = __importDefault(require_source());
4531
+ var node_readline_1 = __importDefault(require("node:readline"));
4531
4532
  var Errors = __importStar(require_errors());
4532
4533
  var config_1 = require_config2();
4533
4534
  function normal(options, retries = 100) {
4534
4535
  if (retries < 0)
4535
4536
  throw new Error("no input");
4537
+ const ac = new AbortController();
4538
+ const { signal } = ac;
4536
4539
  return new Promise((resolve, reject) => {
4537
- let timer;
4538
- if (options.timeout) {
4539
- timer = setTimeout(() => {
4540
- process.stdin.pause();
4541
- reject(new Error("Prompt timeout"));
4542
- }, options.timeout);
4543
- timer.unref();
4544
- }
4545
- process.stdin.setEncoding("utf8");
4546
- process.stderr.write(options.prompt);
4547
- process.stdin.resume();
4548
- process.stdin.once("data", (b) => {
4549
- if (timer)
4550
- clearTimeout(timer);
4551
- process.stdin.pause();
4552
- const data = (typeof b === "string" ? b : b.toString()).trim();
4540
+ const rl = node_readline_1.default.createInterface({
4541
+ input: process.stdin,
4542
+ output: process.stdout
4543
+ });
4544
+ rl.question(options.prompt, { signal }, (answer) => {
4545
+ rl.close();
4546
+ const data = answer.trim();
4553
4547
  if (!options.default && options.required && data === "") {
4554
4548
  resolve(normal(options, retries - 1));
4555
4549
  } else {
4556
4550
  resolve(data || options.default);
4557
4551
  }
4558
4552
  });
4553
+ if (options.timeout) {
4554
+ signal.addEventListener("abort", () => {
4555
+ reject(new Error("Prompt timeout"));
4556
+ }, { once: true });
4557
+ setTimeout(() => ac.abort(), options.timeout);
4558
+ }
4559
4559
  });
4560
4560
  }
4561
4561
  function getPrompt(name, type, defaultValue) {
@@ -220797,7 +220797,7 @@ var require_cli_ux = __commonJS({
220797
220797
  var wait_1 = __importDefault(require_wait());
220798
220798
  var write_1 = __importDefault(require_write());
220799
220799
  var hyperlinker = require_hyperlinker();
220800
- var ux = class {
220800
+ var ux2 = class {
220801
220801
  static config = config_1.config;
220802
220802
  static get action() {
220803
220803
  return config_1.config.action;
@@ -220884,8 +220884,8 @@ var require_cli_ux = __commonJS({
220884
220884
  return wait_1.default;
220885
220885
  }
220886
220886
  };
220887
- exports2.ux = ux;
220888
- var { action, annotation, anykey, confirm, debug, done, flush, info, log, logToStderr, progress, prompt, styledHeader, styledJSON, styledObject, table, trace, tree, url, wait } = ux;
220887
+ exports2.ux = ux2;
220888
+ var { action, annotation, anykey, confirm, debug, done, flush, info, log, logToStderr, progress, prompt, styledHeader, styledJSON, styledObject, table, trace, tree, url, wait } = ux2;
220889
220889
  exports2.action = action;
220890
220890
  exports2.annotation = annotation;
220891
220891
  exports2.anykey = anykey;
@@ -220912,7 +220912,7 @@ var require_cli_ux = __commonJS({
220912
220912
  exports2.warn = warn;
220913
220913
  var uxProcessExitHandler = async () => {
220914
220914
  try {
220915
- await ux.done();
220915
+ await ux2.done();
220916
220916
  } catch (error2) {
220917
220917
  console.error(error2);
220918
220918
  process.exitCode = 1;
@@ -228813,7 +228813,7 @@ var require_config3 = __commonJS({
228813
228813
  };
228814
228814
  const hooks = p.hooks[event] || [];
228815
228815
  for (const hook2 of hooks) {
228816
- const marker2 = performance_1.Performance.mark(performance_1.OCLIF_MARKER_OWNER, `config.runHook#${p.name}(${hook2})`);
228816
+ const marker2 = performance_1.Performance.mark(performance_1.OCLIF_MARKER_OWNER, `config.runHook#${p.name}(${hook2.target})`);
228817
228817
  try {
228818
228818
  const { filePath, isESM, module: module3 } = await (0, module_loader_1.loadWithData)(p, await (0, ts_node_1.tsPath)(p.root, hook2.target, p));
228819
228819
  debug2("start", isESM ? "(import)" : "(require)", filePath);
@@ -230055,7 +230055,7 @@ var require_command2 = __commonJS({
230055
230055
  return;
230056
230056
  throw err;
230057
230057
  });
230058
- var Command3 = class {
230058
+ var Command4 = class {
230059
230059
  argv;
230060
230060
  config;
230061
230061
  /** An array of aliases for this command. */
@@ -230318,7 +230318,7 @@ var require_command2 = __commonJS({
230318
230318
  keys.map((key) => delete process.env[key]);
230319
230319
  }
230320
230320
  };
230321
- exports2.Command = Command3;
230321
+ exports2.Command = Command4;
230322
230322
  }
230323
230323
  });
230324
230324
 
@@ -230572,11 +230572,40 @@ __export(src_exports, {
230572
230572
  });
230573
230573
  module.exports = __toCommonJS(src_exports);
230574
230574
 
230575
- // src/commands/hello/index.ts
230575
+ // src/commands/esbuild.ts
230576
230576
  var import_core = __toESM(require_lib2());
230577
- var Hello = class _Hello extends import_core.Command {
230577
+ var ESBuild = class _ESBuild extends import_core.Command {
230578
230578
  static args = {
230579
- person: import_core.Args.string({ description: "Person to say hello to", required: true })
230579
+ defaultArg: import_core.Args.string({
230580
+ default: "simple string default"
230581
+ }),
230582
+ defaultFnArg: import_core.Args.string({
230583
+ default: async () => "async fn default"
230584
+ }),
230585
+ optionalArg: import_core.Args.string()
230586
+ };
230587
+ static enableJsonFlag = true;
230588
+ static flags = {
230589
+ defaultFnString: import_core.Flags.string({
230590
+ default: async () => "async fn default"
230591
+ }),
230592
+ defaultString: import_core.Flags.string({
230593
+ default: "simple string default"
230594
+ }),
230595
+ optionalString: import_core.Flags.string()
230596
+ };
230597
+ async run() {
230598
+ const { args, flags } = await this.parse(_ESBuild);
230599
+ this.log(`hello I am a bundled (esbuild) plugin from ${this.config.root}!`);
230600
+ return { args, flags };
230601
+ }
230602
+ };
230603
+
230604
+ // src/commands/hello/index.ts
230605
+ var import_core2 = __toESM(require_lib2());
230606
+ var Hello = class _Hello extends import_core2.Command {
230607
+ static args = {
230608
+ person: import_core2.Args.string({ description: "Person to say hello to", required: true })
230580
230609
  };
230581
230610
  static description = "Say hello";
230582
230611
  static examples = [
@@ -230585,7 +230614,7 @@ hello friend from oclif! (./src/commands/hello/index.ts)
230585
230614
  `
230586
230615
  ];
230587
230616
  static flags = {
230588
- from: import_core.Flags.string({ char: "f", description: "Who is saying hello", required: true })
230617
+ from: import_core2.Flags.string({ char: "f", description: "Who is saying hello", required: true })
230589
230618
  };
230590
230619
  async run() {
230591
230620
  const { args, flags } = await this.parse(_Hello);
@@ -230594,8 +230623,8 @@ hello friend from oclif! (./src/commands/hello/index.ts)
230594
230623
  };
230595
230624
 
230596
230625
  // src/commands/hello/world.ts
230597
- var import_core2 = __toESM(require_lib2());
230598
- var World = class extends import_core2.Command {
230626
+ var import_core3 = __toESM(require_lib2());
230627
+ var World = class extends import_core3.Command {
230599
230628
  static args = {};
230600
230629
  static description = "Say hello world";
230601
230630
  static examples = [
@@ -230610,14 +230639,15 @@ hello world! (./src/commands/hello/world.ts)
230610
230639
  };
230611
230640
 
230612
230641
  // src/hooks/init/init.ts
230613
- var hook = async function(opts) {
230614
- process.stdout.write(`example hook running ${opts.id}
230615
- `);
230642
+ var import_core4 = __toESM(require_lib2());
230643
+ var hook = async function() {
230644
+ import_core4.ux.log("Greetings! from plugin-test-esbuild init hook");
230616
230645
  };
230617
230646
  var init_default = hook;
230618
230647
 
230619
230648
  // src/index.ts
230620
230649
  var COMMANDS = {
230650
+ esbuild: ESBuild,
230621
230651
  hello: Hello,
230622
230652
  "hello:alias": World,
230623
230653
  "hello:world": World
@@ -1,5 +1,58 @@
1
1
  {
2
2
  "commands": {
3
+ "esbuild": {
4
+ "aliases": [],
5
+ "args": {
6
+ "defaultArg": {
7
+ "default": "simple string default",
8
+ "name": "defaultArg"
9
+ },
10
+ "defaultFnArg": {
11
+ "default": "async fn default",
12
+ "name": "defaultFnArg"
13
+ },
14
+ "optionalArg": {
15
+ "name": "optionalArg"
16
+ }
17
+ },
18
+ "flags": {
19
+ "json": {
20
+ "description": "Format output as json.",
21
+ "helpGroup": "GLOBAL",
22
+ "name": "json",
23
+ "allowNo": false,
24
+ "type": "boolean"
25
+ },
26
+ "defaultFnString": {
27
+ "name": "defaultFnString",
28
+ "default": "async fn default",
29
+ "hasDynamicHelp": false,
30
+ "multiple": false,
31
+ "type": "option"
32
+ },
33
+ "defaultString": {
34
+ "name": "defaultString",
35
+ "default": "simple string default",
36
+ "hasDynamicHelp": false,
37
+ "multiple": false,
38
+ "type": "option"
39
+ },
40
+ "optionalString": {
41
+ "name": "optionalString",
42
+ "hasDynamicHelp": false,
43
+ "multiple": false,
44
+ "type": "option"
45
+ }
46
+ },
47
+ "hasDynamicHelp": false,
48
+ "hiddenAliases": [],
49
+ "id": "esbuild",
50
+ "pluginAlias": "@oclif/plugin-test-esbuild",
51
+ "pluginName": "@oclif/plugin-test-esbuild",
52
+ "pluginType": "core",
53
+ "strict": true,
54
+ "enableJsonFlag": true
55
+ },
3
56
  "hello": {
4
57
  "aliases": [],
5
58
  "args": {
@@ -68,5 +121,5 @@
68
121
  "enableJsonFlag": false
69
122
  }
70
123
  },
71
- "version": "0.1.6"
124
+ "version": "0.2.0"
72
125
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oclif/plugin-test-esbuild",
3
- "version": "0.1.6",
3
+ "version": "0.2.0",
4
4
  "description": "Bundled plugin for testing",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/oclif/plugin-test-esbuild/issues",
@@ -11,7 +11,7 @@
11
11
  "bundle": "./bin/run.js"
12
12
  },
13
13
  "dependencies": {
14
- "@oclif/core": "3.19.2-dev.0",
14
+ "@oclif/core": "3.19.3-dev.0",
15
15
  "@oclif/plugin-help": "^6",
16
16
  "@oclif/plugin-plugins": "^4"
17
17
  },
@@ -34,7 +34,7 @@
34
34
  "typescript": "^5"
35
35
  },
36
36
  "resolutions": {
37
- "@oclif/core": "3.19.2-dev.0"
37
+ "@oclif/core": "3.19.3-dev.0"
38
38
  },
39
39
  "engines": {
40
40
  "node": ">=18.0.0"
@@ -74,13 +74,12 @@
74
74
  },
75
75
  "repository": "oclif/plugin-test-esbuild",
76
76
  "scripts": {
77
- "build": "shx rm -rf dist && tsc -b",
78
- "bundle": "shx rm -rf dist && esbuild src/index.ts --bundle --platform=node --outfile=dist/index.js",
77
+ "build": "shx rm -rf dist && esbuild src/index.ts --bundle --platform=node --outfile=dist/index.js",
79
78
  "lint": "eslint . --ext .ts",
80
79
  "postpack": "shx rm -f oclif.manifest.json",
81
80
  "posttest": "yarn lint",
82
- "prepack": "yarn bundle && oclif manifest && oclif readme",
83
- "prepare": "yarn bundle",
81
+ "prepack": "yarn build && oclif manifest && oclif readme",
82
+ "prepare": "yarn build",
84
83
  "test": "mocha --forbid-only \"test/**/*.test.ts\"",
85
84
  "version": "oclif readme && git add README.md"
86
85
  }