@w5s/dev 3.1.4 → 3.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/dist/index.d.ts CHANGED
@@ -1,14 +1,15 @@
1
- import { ESLint } from 'eslint';
1
+ import { ESLint } from "eslint";
2
2
 
3
+ //#region src/directory.d.ts
3
4
  interface DirectoryOptions {
4
- /**
5
- * Directory path
6
- */
7
- readonly path: string;
8
- /**
9
- * Directory target state
10
- */
11
- readonly state: 'present' | 'absent';
5
+ /**
6
+ * Directory path
7
+ */
8
+ readonly path: string;
9
+ /**
10
+ * Directory target state
11
+ */
12
+ readonly state: 'present' | 'absent';
12
13
  }
13
14
  /**
14
15
  * Ensure directory is present/absent
@@ -38,55 +39,57 @@ declare function directory(options: DirectoryOptions): Promise<void>;
38
39
  * @param options
39
40
  */
40
41
  declare function directorySync(options: DirectoryOptions): void;
41
-
42
+ //#endregion
43
+ //#region src/ESLintConfig.d.ts
42
44
  declare namespace ESLintConfig {
43
- /**
44
- *
45
- * @param configs
46
- */
47
- function concat(...configs: ESLint.ConfigData[]): ESLint.ConfigData;
48
- /**
49
- * Always return 'off'. `_status` is the previous rule value.
50
- *
51
- * @param _status
52
- */
53
- function fixme(_status: string | number | [string | number, ...any[]] | undefined): "off";
54
- /**
55
- * Renames rules in the given object according to the given map.
56
- *
57
- * Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
58
- * `{ 'old-prefix/rule-name': 'error' }`, this function will return
59
- * `{ 'new-prefix/rule-name': 'error' }`.
60
- *
61
- * @param rules The object containing the rules to rename.
62
- * @param map The object containing the rename map.
63
- */
64
- function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
45
+ /**
46
+ *
47
+ * @param configs
48
+ */
49
+ function concat(...configs: ESLint.ConfigData[]): ESLint.ConfigData;
50
+ /**
51
+ * Always return 'off'. `_status` is the previous rule value.
52
+ *
53
+ * @param _status
54
+ */
55
+ function fixme(_status: string | number | [string | number, ...any[]] | undefined): "off";
56
+ /**
57
+ * Renames rules in the given object according to the given map.
58
+ *
59
+ * Given a map `{ 'old-prefix': 'new-prefix' }`, and a rule object
60
+ * `{ 'old-prefix/rule-name': 'error' }`, this function will return
61
+ * `{ 'new-prefix/rule-name': 'error' }`.
62
+ *
63
+ * @param rules The object containing the rules to rename.
64
+ * @param map The object containing the rename map.
65
+ */
66
+ function renameRules(rules: Record<string, any>, map: Record<string, string>): Record<string, any>;
65
67
  }
66
-
68
+ //#endregion
69
+ //#region src/block.d.ts
67
70
  interface BlockOptions {
68
- /**
69
- * The marker builder function that will take either `markerBegin` or `markerEnd`
70
- *
71
- * @default '# ${mark} MANAGED BLOCK'
72
- */
73
- marker?: (mark: 'Begin' | 'End') => string;
74
- /**
75
- * File path
76
- */
77
- path: string;
78
- /**
79
- * Block content to insert
80
- */
81
- block: string;
82
- /**
83
- * Insert position
84
- */
85
- insertPosition?: ['before', 'BeginningOfFile' | RegExp] | ['after', 'EndOfFile' | RegExp];
86
- /**
87
- * Block target state
88
- */
89
- state?: 'present' | 'absent';
71
+ /**
72
+ * The marker builder function that will take either `markerBegin` or `markerEnd`
73
+ *
74
+ * @default '# ${mark} MANAGED BLOCK'
75
+ */
76
+ marker?: (mark: 'Begin' | 'End') => string;
77
+ /**
78
+ * File path
79
+ */
80
+ path: string;
81
+ /**
82
+ * Block content to insert
83
+ */
84
+ block: string;
85
+ /**
86
+ * Insert position
87
+ */
88
+ insertPosition?: ['before', 'BeginningOfFile' | RegExp] | ['after', 'EndOfFile' | RegExp];
89
+ /**
90
+ * Block target state
91
+ */
92
+ state?: 'present' | 'absent';
90
93
  }
91
94
  /**
92
95
  * Replace asynchronously a block in file that follows pattern :
@@ -108,25 +111,26 @@ declare function block(options: BlockOptions): Promise<void>;
108
111
  * @param options
109
112
  */
110
113
  declare function blockSync(options: BlockOptions): void;
111
-
114
+ //#endregion
115
+ //#region src/file.d.ts
112
116
  interface FileOptions {
113
- /**
114
- * File path
115
- */
116
- readonly path: string;
117
- /**
118
- * File target state
119
- */
120
- readonly state: 'present' | 'absent';
121
- /**
122
- * File content mapping function
123
- *
124
- */
125
- readonly update?: ((content: string) => string | undefined) | undefined;
126
- /**
127
- * File encoding
128
- */
129
- readonly encoding?: BufferEncoding;
117
+ /**
118
+ * File path
119
+ */
120
+ readonly path: string;
121
+ /**
122
+ * File target state
123
+ */
124
+ readonly state: 'present' | 'absent';
125
+ /**
126
+ * File content mapping function
127
+ *
128
+ */
129
+ readonly update?: ((content: string) => string | undefined) | undefined;
130
+ /**
131
+ * File encoding
132
+ */
133
+ readonly encoding?: BufferEncoding;
130
134
  }
131
135
  /**
132
136
  * Ensure file is present/absent with content initialized or modified with `update
@@ -158,7 +162,8 @@ declare function file(options: FileOptions): Promise<void>;
158
162
  * @param options
159
163
  */
160
164
  declare function fileSync(options: FileOptions): void;
161
-
165
+ //#endregion
166
+ //#region src/interopDefault.d.ts
162
167
  /**
163
168
  * Resolves a module or promise-like object, returning the default export if available.
164
169
  *
@@ -180,54 +185,56 @@ declare function fileSync(options: FileOptions): void;
180
185
  * @param m The module or promise-like object to resolve.
181
186
  */
182
187
  declare function interopDefault<T>(m: PromiseLike<T>): Promise<T extends {
183
- default: infer U;
188
+ default: infer U;
184
189
  } ? U : T>;
185
190
  declare function interopDefault<T>(m: T): T extends {
186
- default: infer U;
191
+ default: infer U;
187
192
  } ? U : T;
188
-
193
+ //#endregion
194
+ //#region src/LanguageId.d.ts
189
195
  interface LanguageIdMap {
190
- css: true;
191
- graphql: true;
192
- javascript: true;
193
- javascriptreact: true;
194
- jpeg: true;
195
- json: true;
196
- jsonc: true;
197
- less: true;
198
- markdown: true;
199
- sass: true;
200
- scss: true;
201
- typescript: true;
202
- typescriptreact: true;
203
- vue: true;
204
- yaml: true;
196
+ css: true;
197
+ graphql: true;
198
+ javascript: true;
199
+ javascriptreact: true;
200
+ jpeg: true;
201
+ json: true;
202
+ jsonc: true;
203
+ less: true;
204
+ markdown: true;
205
+ sass: true;
206
+ scss: true;
207
+ typescript: true;
208
+ typescriptreact: true;
209
+ vue: true;
210
+ yaml: true;
205
211
  }
206
212
  /**
207
213
  * A list of "vscode-like" language identifiers (i.e. "javascript", "javascriptreact")
208
214
  */
209
215
  type LanguageId = keyof LanguageIdMap;
210
-
216
+ //#endregion
217
+ //#region src/json.d.ts
211
218
  type JSONValue = null | number | string | boolean | JSONValue[] | {
212
- [key: string]: JSONValue;
219
+ [key: string]: JSONValue;
213
220
  };
214
221
  interface JSONOption<V = JSONValue> {
215
- /**
216
- * File path
217
- */
218
- readonly path: string;
219
- /**
220
- * File target state
221
- */
222
- readonly state: 'present' | 'absent';
223
- /**
224
- * File content mapping function
225
- */
226
- readonly update?: ((content: V | undefined) => V | undefined) | undefined;
227
- /**
228
- * File encoding
229
- */
230
- readonly encoding?: BufferEncoding;
222
+ /**
223
+ * File path
224
+ */
225
+ readonly path: string;
226
+ /**
227
+ * File target state
228
+ */
229
+ readonly state: 'present' | 'absent';
230
+ /**
231
+ * File content mapping function
232
+ */
233
+ readonly update?: ((content: V | undefined) => V | undefined) | undefined;
234
+ /**
235
+ * File encoding
236
+ */
237
+ readonly encoding?: BufferEncoding;
231
238
  }
232
239
  /**
233
240
  * Ensure file is present/absent asynchronously with content value initialized or modified with `update`
@@ -241,124 +248,132 @@ declare function json<Value>(options: JSONOption<Value>): Promise<void>;
241
248
  * @param options
242
249
  */
243
250
  declare function jsonSync<Value>(options: JSONOption<Value>): void;
244
-
251
+ //#endregion
252
+ //#region src/meta.d.ts
253
+ declare const meta: Readonly<{
254
+ name: string;
255
+ version: string;
256
+ buildNumber: number;
257
+ }>;
258
+ //#endregion
259
+ //#region src/Project.d.ts
245
260
  declare namespace Project {
246
- /**
247
- * A type of a file extension
248
- */
249
- type Extension = `.${string}`;
250
- /**
251
- * Object hash of all well-known file extension category to file extensions mapping
252
- */
253
- type ExtensionRegistry = {
254
- [K in LanguageId]: readonly Extension[];
255
- };
256
- /**
257
- * Supported ECMA version
258
- *
259
- * @example
260
- * ```ts
261
- * Project.ecmaVersion() // 2022
262
- * ```
263
- */
264
- function ecmaVersion(): 2022;
265
- /**
266
- * Return a list of extensions
267
- *
268
- * @example
269
- * ```ts
270
- * Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]
271
- * Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']
272
- * ```
273
- *
274
- * @param languages
275
- */
276
- function queryExtensions(languages: LanguageId[]): readonly Extension[];
277
- /**
278
- * Supported file extensions
279
- *
280
- * @example
281
- * ```ts
282
- * Project.sourceExtensions() // ['.ts', '.js', ...]
283
- * ```
284
- */
285
- function sourceExtensions(): readonly `.${string}`[];
286
- /**
287
- * Resource file extensions
288
- *
289
- * @example
290
- * ```ts
291
- * Project.resourceExtensions() // ['.css', '.sass', ...]
292
- * ```
293
- */
294
- function resourceExtensions(): readonly `.${string}`[];
295
- /**
296
- * Files and folders to always ignore
297
- *
298
- * @example
299
- * ```ts
300
- * IGNORED // ['node_modules/', 'build/', ...]
301
- * ```
302
- */
303
- function ignored(): readonly string[];
304
- /**
305
- * Return a RegExp that will match any list of extensions
306
- *
307
- * @param extensions
308
- * @example
309
- * ```ts
310
- * Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\.js|\.ts)$/
311
- * ```
312
- */
313
- function extensionsToMatcher(extensions: readonly Extension[]): RegExp;
314
- /**
315
- * Return a glob matcher that will match any list of extensions
316
- *
317
- * @param extensions
318
- * @example
319
- * ```ts
320
- * Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'
321
- * ```
322
- */
323
- function extensionsToGlob(extensions: readonly Extension[]): string;
261
+ /**
262
+ * A type of a file extension
263
+ */
264
+ type Extension = `.${string}`;
265
+ /**
266
+ * Object hash of all well-known file extension category to file extensions mapping
267
+ */
268
+ type ExtensionRegistry = { [K in LanguageId]: readonly Extension[] };
269
+ /**
270
+ * Supported ECMA version
271
+ *
272
+ * @example
273
+ * ```ts
274
+ * Project.ecmaVersion() // 2022
275
+ * ```
276
+ */
277
+ function ecmaVersion(): 2022;
278
+ /**
279
+ * Return a list of extensions
280
+ *
281
+ * @example
282
+ * ```ts
283
+ * Project.queryExtensions(['javascript']); // ['.js', '.cjs', ...]
284
+ * Project.queryExtensions(['typescript', 'typescriptreact']); // ['.ts', '.mts', ..., '.tsx']
285
+ * ```
286
+ *
287
+ * @param languages
288
+ */
289
+ function queryExtensions(languages: LanguageId[]): readonly Extension[];
290
+ /**
291
+ * Supported file extensions
292
+ *
293
+ * @example
294
+ * ```ts
295
+ * Project.sourceExtensions() // ['.ts', '.js', ...]
296
+ * ```
297
+ */
298
+ function sourceExtensions(): readonly `.${string}`[];
299
+ /**
300
+ * Resource file extensions
301
+ *
302
+ * @example
303
+ * ```ts
304
+ * Project.resourceExtensions() // ['.css', '.sass', ...]
305
+ * ```
306
+ */
307
+ function resourceExtensions(): readonly `.${string}`[];
308
+ /**
309
+ * Files and folders to always ignore
310
+ *
311
+ * @example
312
+ * ```ts
313
+ * IGNORED // ['node_modules/', 'build/', ...]
314
+ * ```
315
+ */
316
+ function ignored(): readonly string[];
317
+ /**
318
+ * Return a RegExp that will match any list of extensions
319
+ *
320
+ * @param extensions
321
+ * @example
322
+ * ```ts
323
+ * Project.extensionsToMatcher(['.js', '.ts']) // RegExp = /(\.js|\.ts)$/
324
+ * ```
325
+ */
326
+ function extensionsToMatcher(extensions: readonly Extension[]): RegExp;
327
+ /**
328
+ * Return a glob matcher that will match any list of extensions
329
+ *
330
+ * @param extensions
331
+ * @example
332
+ * ```ts
333
+ * Project.extensionsToGlob(['.js', '.ts']) // '*.+(js|ts)'
334
+ * ```
335
+ */
336
+ function extensionsToGlob(extensions: readonly Extension[]): string;
324
337
  }
325
-
338
+ //#endregion
339
+ //#region src/ProjectScript.d.ts
326
340
  /**
327
341
  * Project common scripts
328
342
  */
329
343
  declare const ProjectScript: {
330
- readonly Build: "build";
331
- readonly Clean: "clean";
332
- readonly CodeAnalysis: "code-analysis";
333
- readonly Coverage: "coverage";
334
- readonly Develop: "develop";
335
- readonly Docs: "docs";
336
- readonly Format: "format";
337
- readonly Install: "install";
338
- readonly Lint: "lint";
339
- readonly Prepare: "prepare";
340
- readonly Release: "release";
341
- readonly Rescue: "rescue";
342
- readonly Spellcheck: "spellcheck";
343
- readonly Test: "test";
344
- readonly Validate: "validate";
344
+ readonly Build: "build";
345
+ readonly Clean: "clean";
346
+ readonly CodeAnalysis: "code-analysis";
347
+ readonly Coverage: "coverage";
348
+ readonly Develop: "develop";
349
+ readonly Docs: "docs";
350
+ readonly Format: "format";
351
+ readonly Install: "install";
352
+ readonly Lint: "lint";
353
+ readonly Prepare: "prepare";
354
+ readonly Release: "release";
355
+ readonly Rescue: "rescue";
356
+ readonly Spellcheck: "spellcheck";
357
+ readonly Test: "test";
358
+ readonly Validate: "validate";
345
359
  };
346
360
  type ProjectScript = (typeof ProjectScript)[keyof typeof ProjectScript];
347
-
361
+ //#endregion
362
+ //#region src/yarnConfig.d.ts
348
363
  interface YarnConfigOptions {
349
- /**
350
- * Configuration key
351
- */
352
- readonly key: string;
353
- /**
354
- * Option target state
355
- */
356
- readonly state: 'present' | 'absent';
357
- /**
358
- * File content mapping function
359
- *
360
- */
361
- readonly update?: ((content: string) => string | undefined) | undefined;
364
+ /**
365
+ * Configuration key
366
+ */
367
+ readonly key: string;
368
+ /**
369
+ * Option target state
370
+ */
371
+ readonly state: 'present' | 'absent';
372
+ /**
373
+ * File content mapping function
374
+ *
375
+ */
376
+ readonly update?: ((content: string) => string | undefined) | undefined;
362
377
  }
363
378
  /**
364
379
  * Synchronous version of {@link yarnConfig}
@@ -384,18 +399,19 @@ declare function yarnConfigSync(options: YarnConfigOptions): void;
384
399
  * })
385
400
  */
386
401
  declare function yarnConfig(options: YarnConfigOptions): Promise<void>;
387
-
402
+ //#endregion
403
+ //#region src/yarnVersion.d.ts
388
404
  type YarnVersionKind = 'berry' | 'classic';
389
405
  interface YarnVersionOptions {
390
- /**
391
- * Option target state
392
- */
393
- readonly state: 'present' | 'absent';
394
- /**
395
- * Version mapping function
396
- *
397
- */
398
- readonly update?: (() => YarnVersionKind | undefined) | undefined;
406
+ /**
407
+ * Option target state
408
+ */
409
+ readonly state: 'present' | 'absent';
410
+ /**
411
+ * Version mapping function
412
+ *
413
+ */
414
+ readonly update?: (() => YarnVersionKind | undefined) | undefined;
399
415
  }
400
416
  /**
401
417
  * Synchronous version of {@link yarnVersion}
@@ -419,5 +435,6 @@ declare function yarnVersionSync(options: YarnVersionOptions): void;
419
435
  * })
420
436
  */
421
437
  declare function yarnVersion(options: YarnVersionOptions): Promise<void>;
422
-
423
- export { type BlockOptions, type DirectoryOptions, ESLintConfig, type FileOptions, type JSONOption, type JSONValue, type LanguageId, type LanguageIdMap, Project, ProjectScript, type YarnConfigOptions, type YarnVersionKind, type YarnVersionOptions, block, blockSync, directory, directorySync, file, fileSync, interopDefault, json, jsonSync, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
438
+ //#endregion
439
+ export { BlockOptions, DirectoryOptions, ESLintConfig, FileOptions, JSONOption, JSONValue, LanguageId, LanguageIdMap, Project, ProjectScript, YarnConfigOptions, YarnVersionKind, YarnVersionOptions, block, blockSync, directory, directorySync, file, fileSync, interopDefault, json, jsonSync, meta, yarnConfig, yarnConfigSync, yarnVersion, yarnVersionSync };
440
+ //# sourceMappingURL=index.d.ts.map