@unpackjs/core 1.7.3 → 1.7.5

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.
Files changed (50) hide show
  1. package/compiled/commander/index.d.ts +88 -12
  2. package/compiled/commander/index.js +367 -129
  3. package/compiled/commander/package.json +1 -1
  4. package/compiled/css-loader/index.js +22 -24
  5. package/compiled/less-loader/index.js +8 -8
  6. package/compiled/postcss-loader/index.js +10 -10
  7. package/compiled/sass-loader/index.js +9 -8
  8. package/compiled/sass-loader/package.json +1 -1
  9. package/compiled/style-loader/index.js +10 -10
  10. package/dist/bundler-config/chunkSplit.cjs +0 -4
  11. package/dist/bundler-config/chunkSplit.d.ts.map +1 -1
  12. package/dist/bundler-config/chunkSplit.js +0 -4
  13. package/dist/bundler-config/css.cjs +1 -2
  14. package/dist/bundler-config/css.d.ts.map +1 -1
  15. package/dist/bundler-config/css.js +1 -2
  16. package/dist/bundler-config/experimentCss.cjs +4 -1
  17. package/dist/bundler-config/experimentCss.d.ts.map +1 -1
  18. package/dist/bundler-config/experimentCss.js +4 -1
  19. package/dist/bundler-config/index.cjs +2 -1
  20. package/dist/bundler-config/index.d.ts.map +1 -1
  21. package/dist/bundler-config/index.js +2 -1
  22. package/dist/bundler-config/jsMinify.cjs +1 -1
  23. package/dist/bundler-config/jsMinify.js +1 -1
  24. package/dist/createUnpack.cjs +2 -2
  25. package/dist/createUnpack.js +2 -2
  26. package/dist/plugin-progress/webpack.d.ts.map +1 -1
  27. package/dist/prebundleDeps.cjs +2 -1
  28. package/dist/prebundleDeps.d.ts.map +1 -1
  29. package/dist/prebundleDeps.js +2 -1
  30. package/dist/run/dev.cjs +1 -1
  31. package/dist/run/dev.js +1 -1
  32. package/dist/types/config.d.ts +1 -6
  33. package/dist/types/config.d.ts.map +1 -1
  34. package/package.json +10 -11
  35. package/dist/thread-loader/WorkerError.cjs +0 -41
  36. package/dist/thread-loader/WorkerError.js +0 -31
  37. package/dist/thread-loader/WorkerPool.cjs +0 -407
  38. package/dist/thread-loader/WorkerPool.js +0 -387
  39. package/dist/thread-loader/index.cjs +0 -100
  40. package/dist/thread-loader/index.js +0 -85
  41. package/dist/thread-loader/readBuffer.cjs +0 -55
  42. package/dist/thread-loader/readBuffer.js +0 -45
  43. package/dist/thread-loader/serializer.cjs +0 -46
  44. package/dist/thread-loader/serializer.js +0 -31
  45. package/dist/thread-loader/utils.cjs +0 -84
  46. package/dist/thread-loader/utils.js +0 -60
  47. package/dist/thread-loader/worker.cjs +0 -377
  48. package/dist/thread-loader/worker.js +0 -382
  49. package/dist/thread-loader/workerPools.cjs +0 -57
  50. package/dist/thread-loader/workerPools.js +0 -33
@@ -1,8 +1,6 @@
1
1
  // Type definitions for commander
2
2
  // Original definitions by: Alan Agius <https://github.com/alan-agius4>, Marcelo Dezem <https://github.com/mdezem>, vvakame <https://github.com/vvakame>, Jules Randolph <https://github.com/sveinburne>
3
3
 
4
- // Using method rather than property for method-signature-style, to document method overloads separately. Allow either.
5
- /* eslint-disable @typescript-eslint/method-signature-style */
6
4
  /* eslint-disable @typescript-eslint/no-explicit-any */
7
5
 
8
6
  // This is a trick to encourage editor to suggest the known literals while still
@@ -190,7 +188,7 @@ declare class Option {
190
188
 
191
189
  /**
192
190
  * Return option name, in a camelcase format that can be used
193
- * as a object attribute key.
191
+ * as an object attribute key.
194
192
  */
195
193
  attributeName(): string;
196
194
 
@@ -205,12 +203,25 @@ declare class Option {
205
203
  declare class Help {
206
204
  /** output helpWidth, long lines are wrapped to fit */
207
205
  helpWidth?: number;
206
+ minWidthToWrap: number;
208
207
  sortSubcommands: boolean;
209
208
  sortOptions: boolean;
210
209
  showGlobalOptions: boolean;
211
210
 
212
211
  constructor();
213
212
 
213
+ /*
214
+ * prepareContext is called by Commander after applying overrides from `Command.configureHelp()`
215
+ * and just before calling `formatHelp()`.
216
+ *
217
+ * Commander just uses the helpWidth and the others are provided for subclasses.
218
+ */
219
+ prepareContext(contextOptions: {
220
+ error?: boolean;
221
+ helpWidth?: number;
222
+ outputHasColors?: boolean;
223
+ }): void;
224
+
214
225
  /** Get the command term to show in the list of subcommands. */
215
226
  subcommandTerm(cmd: Command): string;
216
227
  /** Get the command summary to show in the list of subcommands. */
@@ -246,18 +257,60 @@ declare class Help {
246
257
  longestGlobalOptionTermLength(cmd: Command, helper: Help): number;
247
258
  /** Get the longest argument term length. */
248
259
  longestArgumentTermLength(cmd: Command, helper: Help): number;
260
+
261
+ /** Return display width of string, ignoring ANSI escape sequences. Used in padding and wrapping calculations. */
262
+ displayWidth(str: string): number;
263
+
264
+ /** Style the titles. Called with 'Usage:', 'Options:', etc. */
265
+ styleTitle(title: string): string;
266
+
267
+ /** Usage: <str> */
268
+ styleUsage(str: string): string;
269
+ /** Style for command name in usage string. */
270
+ styleCommandText(str: string): string;
271
+
272
+ styleCommandDescription(str: string): string;
273
+ styleOptionDescription(str: string): string;
274
+ styleSubcommandDescription(str: string): string;
275
+ styleArgumentDescription(str: string): string;
276
+ /** Base style used by descriptions. */
277
+ styleDescriptionText(str: string): string;
278
+
279
+ styleOptionTerm(str: string): string;
280
+ styleSubcommandTerm(str: string): string;
281
+ styleArgumentTerm(str: string): string;
282
+
283
+ /** Base style used in terms and usage for options. */
284
+ styleOptionText(str: string): string;
285
+ /** Base style used in terms and usage for subcommands. */
286
+ styleSubcommandText(str: string): string;
287
+ /** Base style used in terms and usage for arguments. */
288
+ styleArgumentText(str: string): string;
289
+
249
290
  /** Calculate the pad width from the maximum term length. */
250
291
  padWidth(cmd: Command, helper: Help): number;
251
292
 
252
293
  /**
253
- * Wrap the given string to width characters per line, with lines after the first indented.
254
- * Do not wrap if insufficient room for wrapping (minColumnWidth), or string is manually formatted.
294
+ * Wrap a string at whitespace, preserving existing line breaks.
295
+ * Wrapping is skipped if the width is less than `minWidthToWrap`.
296
+ */
297
+ boxWrap(str: string, width: number): string;
298
+
299
+ /** Detect manually wrapped and indented strings by checking for line break followed by whitespace. */
300
+ preformatted(str: string): boolean;
301
+
302
+ /**
303
+ * Format the "item", which consists of a term and description. Pad the term and wrap the description, indenting the following lines.
304
+ *
305
+ * So "TTT", 5, "DDD DDDD DD DDD" might be formatted for this.helpWidth=17 like so:
306
+ * TTT DDD DDDD
307
+ * DD DDD
255
308
  */
256
- wrap(
257
- str: string,
258
- width: number,
259
- indent: number,
260
- minColumnWidth?: number,
309
+ formatItem(
310
+ term: string,
311
+ termWidth: number,
312
+ description: string,
313
+ helper: Help,
261
314
  ): string;
262
315
 
263
316
  /** Generate the built-in help text. */
@@ -280,9 +333,14 @@ interface AddHelpTextContext {
280
333
  interface OutputConfiguration {
281
334
  writeOut?(str: string): void;
282
335
  writeErr?(str: string): void;
336
+ outputError?(str: string, write: (str: string) => void): void;
337
+
283
338
  getOutHelpWidth?(): number;
284
339
  getErrHelpWidth?(): number;
285
- outputError?(str: string, write: (str: string) => void): void;
340
+
341
+ getOutHasColors?(): boolean;
342
+ getErrHasColors?(): boolean;
343
+ stripColor?(str: string): string;
286
344
  }
287
345
 
288
346
  type AddHelpTextPosition = 'beforeAll' | 'before' | 'after' | 'afterAll';
@@ -544,7 +602,7 @@ declare class Command {
544
602
  *
545
603
  * @returns `this` command for chaining
546
604
  */
547
- action(fn: (...args: any[]) => void | Promise<void>): this;
605
+ action(fn: (this: this, ...args: any[]) => void | Promise<void>): this;
548
606
 
549
607
  /**
550
608
  * Define option with `flags`, `description`, and optional argument parsing function or `defaultValue` or both.
@@ -763,10 +821,28 @@ declare class Command {
763
821
  parseOptions?: ParseOptions,
764
822
  ): Promise<this>;
765
823
 
824
+ /**
825
+ * Called the first time parse is called to save state and allow a restore before subsequent calls to parse.
826
+ * Not usually called directly, but available for subclasses to save their custom state.
827
+ *
828
+ * This is called in a lazy way. Only commands used in parsing chain will have state saved.
829
+ */
830
+ saveStateBeforeParse(): void;
831
+
832
+ /**
833
+ * Restore state before parse for calls after the first.
834
+ * Not usually called directly, but available for subclasses to save their custom state.
835
+ *
836
+ * This is called in a lazy way. Only commands used in parsing chain will have state restored.
837
+ */
838
+ restoreStateBeforeParse(): void;
839
+
766
840
  /**
767
841
  * Parse options from `argv` removing known options,
768
842
  * and return argv split into operands and unknown arguments.
769
843
  *
844
+ * Side effects: modifies command by storing options. Does not reset state if called again.
845
+ *
770
846
  * argv => operands, unknown
771
847
  * --known kkk op => [op], []
772
848
  * op --known kkk => [op], []