@plugjs/plug 0.0.2 → 0.0.3

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 (87) hide show
  1. package/dist/async.cjs +4 -2
  2. package/dist/async.cjs.map +1 -1
  3. package/dist/async.mjs +4 -2
  4. package/dist/async.mjs.map +1 -1
  5. package/dist/files.cjs +16 -2
  6. package/dist/files.cjs.map +1 -1
  7. package/dist/files.mjs +17 -3
  8. package/dist/files.mjs.map +1 -1
  9. package/dist/fork.cjs +2 -2
  10. package/dist/fork.cjs.map +1 -1
  11. package/dist/fork.mjs +2 -2
  12. package/dist/fork.mjs.map +1 -1
  13. package/dist/helpers.cjs +1 -1
  14. package/dist/helpers.cjs.map +1 -1
  15. package/dist/helpers.mjs +1 -1
  16. package/dist/helpers.mjs.map +1 -1
  17. package/dist/log/report.cjs +2 -1
  18. package/dist/log/report.cjs.map +1 -1
  19. package/dist/log/report.mjs +2 -1
  20. package/dist/log/report.mjs.map +1 -1
  21. package/dist/log.cjs +4 -1
  22. package/dist/log.cjs.map +1 -1
  23. package/dist/log.mjs +4 -1
  24. package/dist/log.mjs.map +1 -1
  25. package/dist/paths.cjs.map +1 -1
  26. package/dist/paths.mjs.map +1 -1
  27. package/dist/plugs/copy.cjs +1 -1
  28. package/dist/plugs/copy.cjs.map +1 -1
  29. package/dist/plugs/copy.mjs +1 -1
  30. package/dist/plugs/copy.mjs.map +1 -1
  31. package/dist/plugs/coverage/analysis.cjs +8 -3
  32. package/dist/plugs/coverage/analysis.cjs.map +2 -2
  33. package/dist/plugs/coverage/analysis.mjs +8 -3
  34. package/dist/plugs/coverage/analysis.mjs.map +2 -2
  35. package/dist/plugs/coverage/report.cjs +2 -1
  36. package/dist/plugs/coverage/report.cjs.map +1 -1
  37. package/dist/plugs/coverage/report.mjs +2 -1
  38. package/dist/plugs/coverage/report.mjs.map +1 -1
  39. package/dist/plugs/debug.cjs +6 -6
  40. package/dist/plugs/debug.cjs.map +1 -1
  41. package/dist/plugs/debug.mjs +7 -7
  42. package/dist/plugs/debug.mjs.map +1 -1
  43. package/dist/plugs/esbuild/fix-extensions.cjs +4 -3
  44. package/dist/plugs/esbuild/fix-extensions.cjs.map +1 -1
  45. package/dist/plugs/esbuild/fix-extensions.mjs +4 -3
  46. package/dist/plugs/esbuild/fix-extensions.mjs.map +1 -1
  47. package/dist/plugs/esbuild.cjs +34 -4
  48. package/dist/plugs/esbuild.cjs.map +2 -2
  49. package/dist/plugs/esbuild.mjs +35 -5
  50. package/dist/plugs/esbuild.mjs.map +2 -2
  51. package/dist/plugs/filter.cjs +2 -3
  52. package/dist/plugs/filter.cjs.map +1 -1
  53. package/dist/plugs/filter.mjs +2 -3
  54. package/dist/plugs/filter.mjs.map +1 -1
  55. package/dist/plugs/mocha/reporter.cjs +1 -1
  56. package/dist/plugs/mocha/reporter.cjs.map +1 -1
  57. package/dist/plugs/mocha/reporter.mjs +1 -1
  58. package/dist/plugs/mocha/reporter.mjs.map +1 -1
  59. package/dist/plugs/rmf.cjs +53 -0
  60. package/dist/plugs/rmf.cjs.map +6 -0
  61. package/dist/plugs/rmf.mjs +28 -0
  62. package/dist/plugs/rmf.mjs.map +6 -0
  63. package/dist/plugs.cjs +1 -0
  64. package/dist/plugs.cjs.map +1 -1
  65. package/dist/plugs.mjs +1 -0
  66. package/dist/plugs.mjs.map +1 -1
  67. package/dist/run.cjs +3 -3
  68. package/dist/run.cjs.map +1 -1
  69. package/dist/run.mjs +3 -3
  70. package/dist/run.mjs.map +1 -1
  71. package/package.json +2 -2
  72. package/src/files.ts +36 -4
  73. package/src/fork.ts +2 -2
  74. package/src/helpers.ts +4 -4
  75. package/src/paths.ts +1 -0
  76. package/src/plugs/copy.ts +1 -1
  77. package/src/plugs/debug.ts +7 -7
  78. package/src/plugs/esbuild.ts +69 -10
  79. package/src/plugs/filter.ts +2 -3
  80. package/src/plugs/rmf.ts +42 -0
  81. package/src/plugs.ts +1 -0
  82. package/src/run.ts +5 -5
  83. package/types/files.d.ts +12 -1
  84. package/types/helpers.d.ts +3 -3
  85. package/types/plugs/rmf.d.ts +15 -0
  86. package/types/plugs.d.ts +1 -0
  87. package/types/run.d.ts +2 -2
package/types/files.d.ts CHANGED
@@ -6,8 +6,19 @@ import { AbsolutePath } from './paths.js';
6
6
  export interface FilesBuilder {
7
7
  /** The (resolved) directory the {@link Files} will be associated with */
8
8
  readonly directory: AbsolutePath;
9
- /** Push files into the {@link Files} instance being built */
9
+ /**
10
+ * Push files into the {@link Files} instance being built **checking for
11
+ * their existance on disk**.
12
+ *
13
+ * This _will_ be slow, use {@link FilesBuilder.unchecked} when absolutely
14
+ * sure the file already exist.
15
+ */
10
16
  add(...files: string[]): this;
17
+ /**
18
+ * Push files into the {@link Files} instance being built without checking
19
+ * they exist on disk _(use with care!)_.
20
+ */
21
+ unchecked(...files: string[]): this;
11
22
  /** Merge orther {@link Files} instance to the {@link Files} being built */
12
23
  merge(...files: Files[]): this;
13
24
  /** Write a file and add it to the {@link Files} instance being built */
@@ -18,15 +18,15 @@ export declare function setLogLevel(level: LogLevelString): void;
18
18
  * Resolve a path into an {@link AbsolutePath}.
19
19
  *
20
20
  * If the path starts with `@...` it is considered to be relative to the
21
- * {@link process.cwd | current working directory}, otherwise it will be
22
- * resolved against the build file where the task was originally defined in.
21
+ * _directory containing the build file where the task was defined_, otherwise
22
+ * it will be relative to the {@link process.cwd | current working directory}.
23
23
  */
24
24
  export declare function resolve(...paths: string[]): AbsolutePath;
25
25
  /**
26
26
  * Create a new {@link Files} instance.
27
27
  */
28
28
  export declare function files(files: Files): FilesBuilder;
29
- export declare function files(...paths: string[]): FilesBuilder;
29
+ export declare function files(directory: string, ...paths: string[]): FilesBuilder;
30
30
  /**
31
31
  * Merge multiple {@link Files} instance.
32
32
  */
@@ -0,0 +1,15 @@
1
+ import { Files } from '../files.js';
2
+ import { Plug } from '../pipe.js';
3
+ import { Run } from '../run.js';
4
+ /** Remove some files using globs. */
5
+ export declare class Rmf implements Plug<undefined> {
6
+ private readonly _dryRun;
7
+ constructor(dryRun?: boolean);
8
+ pipe(files: Files, run: Run): Promise<undefined>;
9
+ }
10
+ declare module '../pipe.js' {
11
+ interface Pipe {
12
+ /** Remove all {@link Files} piped in. */
13
+ rmf: PipeExtension<typeof Rmf>;
14
+ }
15
+ }
package/types/plugs.d.ts CHANGED
@@ -14,3 +14,4 @@ export * from './plugs/debug.js';
14
14
  export * from './plugs/esbuild.js';
15
15
  export * from './plugs/exec.js';
16
16
  export * from './plugs/filter.js';
17
+ export * from './plugs/rmf.js';
package/types/run.d.ts CHANGED
@@ -43,8 +43,8 @@ export interface Run {
43
43
  * Resolve a path in the context of this {@link Run}.
44
44
  *
45
45
  * If the path starts with `@...` it is considered to be relative to the
46
- * {@link process.cwd | current working directory}, otherwise it will be
47
- * resolved against the build file where the task was originally defined in.
46
+ * _directory containing the build file where the task was defined_, otherwise
47
+ * it will be relative to the {@link process.cwd | current working directory}.
48
48
  */
49
49
  resolve(...paths: string[]): AbsolutePath;
50
50
  /** Create a {@link FilesBuilder} cloning an existing {@link Files}. */