@rzl-zone/build-tools 0.0.10 → 0.0.12-beta.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/.references/index.d.cts +1 -1
- package/dist/.references/index.d.ts +1 -1
- package/dist/bundler/rolldown.cjs +4 -4
- package/dist/bundler/rolldown.cjs.map +1 -1
- package/dist/bundler/rolldown.d.cts +2 -2
- package/dist/bundler/rolldown.d.ts +2 -2
- package/dist/bundler/rolldown.js +1 -1
- package/dist/bundler/rolldown.js.map +1 -1
- package/dist/bundler/tsdown.cjs +9 -9
- package/dist/bundler/tsdown.cjs.map +1 -1
- package/dist/bundler/tsdown.d.cts +2 -2
- package/dist/bundler/tsdown.d.ts +2 -2
- package/dist/bundler/tsdown.js +3 -3
- package/dist/bundler/tsdown.js.map +1 -1
- package/dist/bundler/utils.cjs +2 -2
- package/dist/bundler/utils.cjs.map +1 -1
- package/dist/bundler/utils.d.cts +2 -2
- package/dist/bundler/utils.d.ts +2 -2
- package/dist/bundler/utils.js +2 -2
- package/dist/bundler/utils.js.map +1 -1
- package/dist/client-E8kISMNO.cjs +81 -0
- package/dist/client-E8kISMNO.cjs.map +1 -0
- package/dist/client-MFOxk6MV.js +75 -0
- package/dist/client-MFOxk6MV.js.map +1 -0
- package/dist/commander-kit/index.cjs +84 -65
- package/dist/commander-kit/index.cjs.map +1 -1
- package/dist/commander-kit/index.d.cts +3 -3
- package/dist/commander-kit/index.d.ts +3 -3
- package/dist/commander-kit/index.js +24 -5
- package/dist/commander-kit/index.js.map +1 -1
- package/dist/{extra-CYpD3D9p.d.ts → extra-B1CzOGop.d.ts} +2 -2
- package/dist/{extra-Dc_eIyiW.d.cts → extra-DJwL1pB2.d.cts} +2 -2
- package/dist/{fast-globe-options-CZ-9wIKV.d.ts → fast-globe-options-DDloBj5e.d.ts} +3 -3
- package/dist/{fast-globe-options-BtIrCNb6.d.cts → fast-globe-options-Rz3TI5hc.d.cts} +3 -3
- package/dist/{helper-CWU8QYq3.js → formatter-BS3omf7k.js} +88 -3
- package/dist/formatter-BS3omf7k.js.map +1 -0
- package/dist/{helper-DvCvgDxy.cjs → formatter-Cbz6g0Mi.cjs} +142 -14
- package/dist/formatter-Cbz6g0Mi.cjs.map +1 -0
- package/dist/{identity-xuDCNgfm.js → identity-Cznri5bj.js} +5 -6
- package/dist/{identity-xuDCNgfm.js.map → identity-Cznri5bj.js.map} +1 -1
- package/dist/{identity-D192lL-_.cjs → identity-D2BhaOq4.cjs} +14 -15
- package/dist/{identity-D192lL-_.cjs.map → identity-D2BhaOq4.cjs.map} +1 -1
- package/dist/{index-1FKLQ7ah.d.cts → index-BW05_5Zw.d.ts} +2 -2
- package/dist/{index-qft-a5kh.d.ts → index-C5uH9Zib.d.cts} +2 -2
- package/dist/{index-CEsO_rxz.d.ts → index-D5tuL_Tf.d.cts} +2 -2
- package/dist/{index-DW1JFluR.d.cts → index-DMYmm0in.d.ts} +2 -2
- package/dist/index.cjs +378 -359
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +81 -48
- package/dist/index.d.ts +81 -48
- package/dist/index.js +175 -156
- package/dist/index.js.map +1 -1
- package/dist/package-banner-Com8U-Xm.cjs +59 -0
- package/dist/{package-banner-BHyF8RdG.cjs.map → package-banner-Com8U-Xm.cjs.map} +1 -1
- package/dist/{package-banner-BmLNyezO.js → package-banner-Jw1DuF8v.js} +4 -5
- package/dist/{package-banner-BmLNyezO.js.map → package-banner-Jw1DuF8v.js.map} +1 -1
- package/dist/server-Bewzn3sy.cjs +255 -0
- package/dist/server-Bewzn3sy.cjs.map +1 -0
- package/dist/server-Owi9-DW1.js +198 -0
- package/dist/server-Owi9-DW1.js.map +1 -0
- package/dist/utils/client.cjs +12 -11
- package/dist/utils/client.d.cts +1 -1
- package/dist/utils/client.d.ts +1 -1
- package/dist/utils/client.js +3 -2
- package/dist/utils/server.cjs +5 -2
- package/dist/utils/server.d.cts +433 -3
- package/dist/utils/server.d.ts +433 -3
- package/dist/utils/server.js +3 -3
- package/package.json +10 -6
- package/dist/client-BmfdVI22.js +0 -160
- package/dist/client-BmfdVI22.js.map +0 -1
- package/dist/client-DnTjQyyo.cjs +0 -221
- package/dist/client-DnTjQyyo.cjs.map +0 -1
- package/dist/helper-CWU8QYq3.js.map +0 -1
- package/dist/helper-DvCvgDxy.cjs.map +0 -1
- package/dist/package-banner-BHyF8RdG.cjs +0 -60
- package/dist/server-BA7ruG1h.js +0 -142
- package/dist/server-BA7ruG1h.js.map +0 -1
- package/dist/server-DZvrqlyy.cjs +0 -181
- package/dist/server-DZvrqlyy.cjs.map +0 -1
package/dist/utils/server.d.ts
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.12-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import { t as AnyString } from "../extra-B1CzOGop.js";
|
|
12
|
+
import { n as PatternOptions, r as defaultPatternOptions, t as PatternConfig } from "../fast-globe-options-DDloBj5e.js";
|
|
12
13
|
import _fastGlob from "fast-glob";
|
|
13
14
|
import _fsExtra from "fs-extra";
|
|
14
15
|
type Icons = { readonly [K in keyof typeof emojiIcons]: string };
|
|
@@ -81,6 +82,435 @@ declare const emojiIcons: {
|
|
|
81
82
|
*
|
|
82
83
|
*/
|
|
83
84
|
declare const ICONS: Readonly<Icons>;
|
|
85
|
+
/** -------------------------------------------------------------------
|
|
86
|
+
* * ***Determines whether an option value comes from the default configuration
|
|
87
|
+
* or has been explicitly overridden by the user.***
|
|
88
|
+
* -------------------------------------------------------------------
|
|
89
|
+
*
|
|
90
|
+
* This utility is primarily intended for logging and debugging purposes,
|
|
91
|
+
* especially in CLI tools or build pipelines where distinguishing between
|
|
92
|
+
* default and user-provided values is important.
|
|
93
|
+
*
|
|
94
|
+
* The comparison is performed using `Object.is` to ensure accurate detection,
|
|
95
|
+
* including edge cases such as:
|
|
96
|
+
* - `NaN` vs `NaN`.
|
|
97
|
+
* - `-0` vs `+0`.
|
|
98
|
+
*
|
|
99
|
+
* @template T - The type of the option value being compared.
|
|
100
|
+
*
|
|
101
|
+
* @param {unknown} value - The actual value used at runtime.
|
|
102
|
+
* @param {unknown} defaultValue - The default value defined by the tool.
|
|
103
|
+
*
|
|
104
|
+
* @returns
|
|
105
|
+
* A string indicating the source of the value:
|
|
106
|
+
*
|
|
107
|
+
* - `"default"` when `value` is strictly equal to `defaultValue`.
|
|
108
|
+
* - `"overridden"` when the value differs from the default.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* sourceOf("dist", "dist"); // ➔ "default"
|
|
113
|
+
* sourceOf("dist/types", "dist"); // ➔ "overridden"
|
|
114
|
+
* ```
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* ***CLI-style option logging:***
|
|
118
|
+
* ```ts
|
|
119
|
+
* BUILD_LOGGER.OPTIONS(
|
|
120
|
+
* "outDir",
|
|
121
|
+
* outDir,
|
|
122
|
+
* sourceOf(outDir, DEFAULTS.outDir)
|
|
123
|
+
* );
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
declare const sourceOf: <T>(value: T, defaultValue: T) => "default" | "overridden";
|
|
127
|
+
/** ----------------------------------------------------------------
|
|
128
|
+
* * ***Deep default source detector.***
|
|
129
|
+
* ----------------------------------------------------------------
|
|
130
|
+
*
|
|
131
|
+
* Determines whether a given value is structurally identical
|
|
132
|
+
* to its default value using deep comparison.
|
|
133
|
+
*
|
|
134
|
+
* Unlike `Object.is`, this utility compares object contents
|
|
135
|
+
* recursively rather than checking reference identity.
|
|
136
|
+
*
|
|
137
|
+
* Intended for configuration systems where option objects
|
|
138
|
+
* may be cloned or reconstructed but still represent the
|
|
139
|
+
* default state.
|
|
140
|
+
*
|
|
141
|
+
* @template T - Value type being compared.
|
|
142
|
+
*
|
|
143
|
+
* @param value - Current runtime value.
|
|
144
|
+
* @param defaultValue - Default reference value.
|
|
145
|
+
*
|
|
146
|
+
* @returns
|
|
147
|
+
* - `"default"` ➔ If values are deeply equal.
|
|
148
|
+
* - `"overridden"` ➔ If values differ.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```ts
|
|
152
|
+
* sourceOfIsDeepStrictEqual(
|
|
153
|
+
* { onlyFiles: true },
|
|
154
|
+
* { onlyFiles: true }
|
|
155
|
+
* );
|
|
156
|
+
* // "default"
|
|
157
|
+
* ```
|
|
158
|
+
*/
|
|
159
|
+
declare const sourceOfIsDeepStrictEqual: <T>(value: T, defaultValue: T) => "default" | "overridden";
|
|
160
|
+
/** -------------------------------------------------------------------
|
|
161
|
+
* * ***Structured build-time console logger with consistent formatting,
|
|
162
|
+
* icons, and colorized output.***
|
|
163
|
+
* --------------------------------------------------------------------
|
|
164
|
+
*
|
|
165
|
+
* `BUILD_LOGGER` provides a collection of standardized logging helpers
|
|
166
|
+
* intended for **CLI tools, build scripts, and Node.js-based workflows**.
|
|
167
|
+
*
|
|
168
|
+
* - **It ensures:**
|
|
169
|
+
* - Consistent log structure across different build phases.
|
|
170
|
+
* - Clear visual distinction between states (start, success, skip, error).
|
|
171
|
+
* - Emoji or ASCII icon support depending on environment configuration.
|
|
172
|
+
* - Readable, colorized output via `picocolors`.
|
|
173
|
+
*
|
|
174
|
+
* Emoji usage is controlled via the environment variable:
|
|
175
|
+
*
|
|
176
|
+
* ```
|
|
177
|
+
* FORCE_EMOJI=1
|
|
178
|
+
* ```
|
|
179
|
+
*
|
|
180
|
+
* When disabled, all icons gracefully fall back to ASCII-safe symbols.
|
|
181
|
+
*
|
|
182
|
+
* ---
|
|
183
|
+
*
|
|
184
|
+
* - **Behavior:**
|
|
185
|
+
* - Uses emoji icons when `FORCE_EMOJI === "1"`.
|
|
186
|
+
* - Falls back to ASCII symbols otherwise.
|
|
187
|
+
* - Applies consistent spacing, bulleting, and indentation.
|
|
188
|
+
* - Formats messages using `picocolors` for visibility.
|
|
189
|
+
* - Safely extracts error messages from unknown error values.
|
|
190
|
+
*
|
|
191
|
+
* ---
|
|
192
|
+
*
|
|
193
|
+
* - **Available log actions:**
|
|
194
|
+
* - `SOURCE_OF`:
|
|
195
|
+
* - See {@link sourceOf | **`sourceOf`**} helpers.
|
|
196
|
+
*
|
|
197
|
+
* - `OPTIONS({ label, value, source, isRequired })`:
|
|
198
|
+
* - Logs the options argument function using
|
|
199
|
+
* {@link sourceOf | **`sourceOf`**} helper.
|
|
200
|
+
*
|
|
201
|
+
* - `NEW_LINE()`:
|
|
202
|
+
* - *Inserts an empty line in the console output.*
|
|
203
|
+
*
|
|
204
|
+
* - `ON_STARTING({ actionName })`:
|
|
205
|
+
* - *Logs the start of a build or processing action.*
|
|
206
|
+
*
|
|
207
|
+
* - `ON_FINISH({ actionName, count })`:
|
|
208
|
+
* - *Logs successful completion with item count.*
|
|
209
|
+
*
|
|
210
|
+
* - `ON_SKIPPING({ actionName, reasonEndText })`:
|
|
211
|
+
* - *Logs skipped actions with human-readable reasons.*
|
|
212
|
+
*
|
|
213
|
+
* - `ON_ERROR({ actionName, error })`:
|
|
214
|
+
* - *Logs formatted error output with extracted message.*
|
|
215
|
+
*
|
|
216
|
+
* - `ON_PROCESS_COPY({ actionName, copyFrom, copyTo })`:
|
|
217
|
+
* - *Logs file copy operations.*
|
|
218
|
+
*
|
|
219
|
+
* - `ON_PROCESS({ actionName, nameDirect })`:
|
|
220
|
+
* - *Logs generic processing steps.*
|
|
221
|
+
*
|
|
222
|
+
* - `ON_PROCESS_REFERENCING({ actionName, referenceFrom, referenceTo })`:
|
|
223
|
+
* - *Logs reference or linking operations.*
|
|
224
|
+
*
|
|
225
|
+
* ---
|
|
226
|
+
*
|
|
227
|
+
* This logger is intentionally **side-effectful** and writes directly
|
|
228
|
+
* to `console.log` / `console.error`.
|
|
229
|
+
*
|
|
230
|
+
* It is designed for **human-readable output**, not structured logging
|
|
231
|
+
* or machine parsing.
|
|
232
|
+
*/
|
|
233
|
+
declare const BUILD_LOGGER: LoggerBuilder;
|
|
234
|
+
type LoggerBuilder = {
|
|
235
|
+
SOURCE_OF: typeof sourceOf;
|
|
236
|
+
OPTIONS(label: string, value: unknown, source: ReturnType<typeof sourceOf> | AnyString, isRequired?: boolean): void;
|
|
237
|
+
SECTION(title: string, options?: LoggerBuilderSection): void;
|
|
238
|
+
NEW_LINE(value?: string): void;
|
|
239
|
+
ON_STARTING: (options: LoggerBuilderOnStarting) => void;
|
|
240
|
+
ON_FINISH: (options: LoggerBuilderOnFinish) => void;
|
|
241
|
+
ON_SKIPPING: (options: LoggerBuilderOnSkipping) => void;
|
|
242
|
+
ON_ERROR: (options: LoggerBuilderOnError) => void;
|
|
243
|
+
ON_PROCESS: (options: LoggerBuilderOnProcess) => void;
|
|
244
|
+
ON_PROCESS_COPY: (options: LoggerBuilderOnProcessCopy) => void;
|
|
245
|
+
ON_PROCESS_COPY_ERROR: (options: LoggerBuilderOnProcessCopyError) => void;
|
|
246
|
+
ON_PROCESS_REFERENCING: (options: LoggerBuilderOnProcessReferencing) => void;
|
|
247
|
+
};
|
|
248
|
+
type LoggerBuilderSection = {
|
|
249
|
+
/**
|
|
250
|
+
* @default ICON.config
|
|
251
|
+
*/
|
|
252
|
+
icon?: string;
|
|
253
|
+
/**
|
|
254
|
+
* @default ""
|
|
255
|
+
*/
|
|
256
|
+
indent?: string;
|
|
257
|
+
};
|
|
258
|
+
type LoggerBuilderOnStarting = {
|
|
259
|
+
/** The name of the action being started.
|
|
260
|
+
*
|
|
261
|
+
* @default
|
|
262
|
+
* undefined
|
|
263
|
+
*/
|
|
264
|
+
actionName: string;
|
|
265
|
+
/** Connector word used before the action name.
|
|
266
|
+
*
|
|
267
|
+
* @default
|
|
268
|
+
* "to"
|
|
269
|
+
*/
|
|
270
|
+
textDirectAction?: string;
|
|
271
|
+
};
|
|
272
|
+
type LoggerBuilderOnFinish = {
|
|
273
|
+
/** The name of the completed action.
|
|
274
|
+
*
|
|
275
|
+
* @default
|
|
276
|
+
* undefined
|
|
277
|
+
*/
|
|
278
|
+
actionName: string;
|
|
279
|
+
/** The success text.
|
|
280
|
+
*
|
|
281
|
+
* @default
|
|
282
|
+
* @default "Success"
|
|
283
|
+
*/
|
|
284
|
+
textSuccess?: string;
|
|
285
|
+
/** Label for the count unit.
|
|
286
|
+
*
|
|
287
|
+
* @default
|
|
288
|
+
* "file"
|
|
289
|
+
*/
|
|
290
|
+
typeCount?: string;
|
|
291
|
+
/** Number of processed items.
|
|
292
|
+
*
|
|
293
|
+
* @default
|
|
294
|
+
* undefined
|
|
295
|
+
*/
|
|
296
|
+
count: number;
|
|
297
|
+
/** Progress of processed items (e.g. `2/7`).
|
|
298
|
+
*
|
|
299
|
+
* Represents how many items have been processed relative to the total.
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* "2/7"
|
|
303
|
+
*/
|
|
304
|
+
progress?: string;
|
|
305
|
+
};
|
|
306
|
+
type LoggerBuilderOnSkipping = {
|
|
307
|
+
/** The name of the skipped action.
|
|
308
|
+
*
|
|
309
|
+
* @default
|
|
310
|
+
* undefined
|
|
311
|
+
*/
|
|
312
|
+
actionName: string;
|
|
313
|
+
/** Connector word explaining the reason.
|
|
314
|
+
*
|
|
315
|
+
* @default
|
|
316
|
+
* "because"
|
|
317
|
+
*/
|
|
318
|
+
reasonTitle?: string;
|
|
319
|
+
/** Short reason phrase.
|
|
320
|
+
*
|
|
321
|
+
* @default
|
|
322
|
+
* "nothing left"
|
|
323
|
+
*/
|
|
324
|
+
reasonSkipAction?: string;
|
|
325
|
+
/** Contextual explanation for the skip.
|
|
326
|
+
*
|
|
327
|
+
* @default
|
|
328
|
+
* undefined
|
|
329
|
+
*/
|
|
330
|
+
reasonEndText: string;
|
|
331
|
+
/** Type of resource involved.
|
|
332
|
+
*
|
|
333
|
+
* @default
|
|
334
|
+
* "files"
|
|
335
|
+
*/
|
|
336
|
+
reasonType?: string;
|
|
337
|
+
/** Connector word before the target.
|
|
338
|
+
*
|
|
339
|
+
* @default
|
|
340
|
+
* "to"
|
|
341
|
+
*/
|
|
342
|
+
textDirectAction?: string;
|
|
343
|
+
};
|
|
344
|
+
type LoggerBuilderOnError = {
|
|
345
|
+
/** The name of the action that failed.
|
|
346
|
+
*
|
|
347
|
+
* @default
|
|
348
|
+
* undefined
|
|
349
|
+
*/
|
|
350
|
+
actionName: string;
|
|
351
|
+
/** Connector word before the action name.
|
|
352
|
+
*
|
|
353
|
+
* @default
|
|
354
|
+
* "to"
|
|
355
|
+
*/
|
|
356
|
+
textDirectAction?: string;
|
|
357
|
+
/** Unknown error object or `Error` instance.
|
|
358
|
+
*
|
|
359
|
+
*/
|
|
360
|
+
error: unknown;
|
|
361
|
+
};
|
|
362
|
+
type LoggerBuilderOnProcess = {
|
|
363
|
+
/** Description of the process.
|
|
364
|
+
*
|
|
365
|
+
* @default
|
|
366
|
+
* undefined
|
|
367
|
+
*/
|
|
368
|
+
actionName: string;
|
|
369
|
+
/** Sequence number.
|
|
370
|
+
*
|
|
371
|
+
* @default
|
|
372
|
+
* undefined
|
|
373
|
+
*/
|
|
374
|
+
count: number;
|
|
375
|
+
/** Connector word before the target.
|
|
376
|
+
*
|
|
377
|
+
* @default
|
|
378
|
+
* "in"
|
|
379
|
+
*/
|
|
380
|
+
textDirectFolder?: string;
|
|
381
|
+
/** Target name or location.
|
|
382
|
+
*
|
|
383
|
+
* @default
|
|
384
|
+
* undefined
|
|
385
|
+
*/
|
|
386
|
+
nameDirect: string;
|
|
387
|
+
};
|
|
388
|
+
type LoggerBuilderOnProcessCopy = {
|
|
389
|
+
/** The name of the action being the copy action.
|
|
390
|
+
*
|
|
391
|
+
* @default
|
|
392
|
+
* undefined
|
|
393
|
+
*/
|
|
394
|
+
actionName: string;
|
|
395
|
+
/** Sequence number of the process.
|
|
396
|
+
*
|
|
397
|
+
* @default
|
|
398
|
+
* undefined
|
|
399
|
+
*/
|
|
400
|
+
count: number;
|
|
401
|
+
/** Connector text before source path.
|
|
402
|
+
*
|
|
403
|
+
* @default
|
|
404
|
+
* "from"
|
|
405
|
+
*/
|
|
406
|
+
textFrom?: string;
|
|
407
|
+
/** Source path.
|
|
408
|
+
*
|
|
409
|
+
* @default
|
|
410
|
+
* undefined
|
|
411
|
+
*/
|
|
412
|
+
copyFrom: string;
|
|
413
|
+
/** Destination path.
|
|
414
|
+
*
|
|
415
|
+
* @default
|
|
416
|
+
* undefined
|
|
417
|
+
*/
|
|
418
|
+
copyTo: string;
|
|
419
|
+
/** Arrow symbol between paths.
|
|
420
|
+
*
|
|
421
|
+
* @default
|
|
422
|
+
* "➔"
|
|
423
|
+
*/
|
|
424
|
+
textArrow?: string;
|
|
425
|
+
};
|
|
426
|
+
type LoggerBuilderOnProcessCopyError = {
|
|
427
|
+
/** The name of the action being the error copy action.
|
|
428
|
+
*
|
|
429
|
+
* @default
|
|
430
|
+
* undefined
|
|
431
|
+
*/
|
|
432
|
+
actionName: string;
|
|
433
|
+
/** Sequence number of the process.
|
|
434
|
+
*
|
|
435
|
+
* @default
|
|
436
|
+
* undefined
|
|
437
|
+
*/
|
|
438
|
+
count: number;
|
|
439
|
+
/** Index number parameter.
|
|
440
|
+
*
|
|
441
|
+
* @default
|
|
442
|
+
* undefined
|
|
443
|
+
*/
|
|
444
|
+
index?: number;
|
|
445
|
+
/** Index key name for parameter.
|
|
446
|
+
*
|
|
447
|
+
* @default
|
|
448
|
+
* undefined
|
|
449
|
+
*/
|
|
450
|
+
indexKey?: string;
|
|
451
|
+
/** Connector text before source path.
|
|
452
|
+
*
|
|
453
|
+
* @default
|
|
454
|
+
* "from"
|
|
455
|
+
*/
|
|
456
|
+
textFrom?: string;
|
|
457
|
+
/** Source path.
|
|
458
|
+
*
|
|
459
|
+
* @default
|
|
460
|
+
* undefined
|
|
461
|
+
*/
|
|
462
|
+
copyFrom: string;
|
|
463
|
+
/** The reason error on copying.
|
|
464
|
+
*
|
|
465
|
+
* @default
|
|
466
|
+
* undefined
|
|
467
|
+
*/
|
|
468
|
+
errorReason: string | Error;
|
|
469
|
+
/** Connector word explaining the reason.
|
|
470
|
+
*
|
|
471
|
+
* @default
|
|
472
|
+
* "because"
|
|
473
|
+
*/
|
|
474
|
+
textReason?: string;
|
|
475
|
+
};
|
|
476
|
+
type LoggerBuilderOnProcessReferencing = {
|
|
477
|
+
/** The name of the action being the referencing action.
|
|
478
|
+
*
|
|
479
|
+
* @default
|
|
480
|
+
* undefined
|
|
481
|
+
*/
|
|
482
|
+
actionName: string;
|
|
483
|
+
/** Sequence number.
|
|
484
|
+
*
|
|
485
|
+
* @default
|
|
486
|
+
* undefined
|
|
487
|
+
*/
|
|
488
|
+
count: number;
|
|
489
|
+
/** Connector text before source.
|
|
490
|
+
*
|
|
491
|
+
* @default
|
|
492
|
+
* "from"
|
|
493
|
+
*/
|
|
494
|
+
textFrom?: string;
|
|
495
|
+
/** Source reference path.
|
|
496
|
+
*
|
|
497
|
+
* @default
|
|
498
|
+
* undefined
|
|
499
|
+
*/
|
|
500
|
+
referenceFrom: string;
|
|
501
|
+
/** Target reference path.
|
|
502
|
+
*
|
|
503
|
+
* @default
|
|
504
|
+
* undefined
|
|
505
|
+
*/
|
|
506
|
+
referenceTo: string;
|
|
507
|
+
/** Arrow symbol between references.
|
|
508
|
+
*
|
|
509
|
+
* @default
|
|
510
|
+
* "➔"
|
|
511
|
+
*/
|
|
512
|
+
textArrow?: string;
|
|
513
|
+
};
|
|
84
514
|
/** ----------------------------------------------------------------
|
|
85
515
|
* * ***Node.js–only filesystem utilities (fs-extra).***
|
|
86
516
|
* ----------------------------------------------------------------
|
|
@@ -120,5 +550,5 @@ declare const fsExtra: typeof _fsExtra;
|
|
|
120
550
|
* @environment node
|
|
121
551
|
*/
|
|
122
552
|
declare const fastGlob: typeof _fastGlob;
|
|
123
|
-
export { ICONS, type PatternConfig, type PatternOptions, defaultPatternOptions, fastGlob, fsExtra };
|
|
553
|
+
export { BUILD_LOGGER, ICONS, type PatternConfig, type PatternOptions, defaultPatternOptions, fastGlob, fsExtra, sourceOf, sourceOfIsDeepStrictEqual };
|
|
124
554
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/utils/server.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
* ========================================================================
|
|
3
3
|
* @rzl-zone/build-tools
|
|
4
4
|
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.
|
|
5
|
+
* Version: `0.0.12-beta.0`
|
|
6
6
|
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
7
|
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
8
|
* ========================================================================
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import { i as
|
|
12
|
-
export { ICONS, defaultPatternOptions, fastGlob, fsExtra };
|
|
11
|
+
import { a as sourceOfIsDeepStrictEqual, i as sourceOf, n as fsExtra, o as ICONS, r as BUILD_LOGGER, s as defaultPatternOptions, t as fastGlob } from "../server-Owi9-DW1.js";
|
|
12
|
+
export { BUILD_LOGGER, ICONS, defaultPatternOptions, fastGlob, fsExtra, sourceOf, sourceOfIsDeepStrictEqual };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rzl-zone/build-tools",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.12-beta.0",
|
|
4
4
|
"description": "Toolkit to standardize and improve TypeScript and JavaScript build outputs.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Rizalvin Dwiky <rizalvindwiky1998@gmail.com>",
|
|
@@ -44,6 +44,7 @@
|
|
|
44
44
|
"dist",
|
|
45
45
|
"README.md",
|
|
46
46
|
"LICENSE.md",
|
|
47
|
+
"LICENSE",
|
|
47
48
|
"!**/*.test.*"
|
|
48
49
|
],
|
|
49
50
|
"exports": {
|
|
@@ -117,19 +118,22 @@
|
|
|
117
118
|
"fs-extra": "^11.3.4",
|
|
118
119
|
"picocolors": "^1.1.1",
|
|
119
120
|
"semver": "^7.7.4",
|
|
120
|
-
"
|
|
121
|
+
"shell-quote": "^1.8.3",
|
|
122
|
+
"@rzl-zone/node-only": "0.0.10-beta.0"
|
|
121
123
|
},
|
|
122
124
|
"devDependencies": {
|
|
123
125
|
"@types/babel__traverse": "^7.28.0",
|
|
124
126
|
"@types/fs-extra": "^11.0.4",
|
|
127
|
+
"@types/shell-quote": "^1.7.5",
|
|
125
128
|
"eslint": "^9.39.2",
|
|
126
129
|
"rolldown": "^1.0.0-rc.15",
|
|
127
130
|
"terser": "^5.46.1",
|
|
128
|
-
"tsdown": "0.
|
|
131
|
+
"tsdown": "0.22.0",
|
|
129
132
|
"type-fest": "5.5.0",
|
|
130
|
-
"typescript": "
|
|
131
|
-
"
|
|
132
|
-
"@workspace/typescript-config": "0.0.0"
|
|
133
|
+
"typescript": "6.0.3",
|
|
134
|
+
"unrun": "^0.3.0",
|
|
135
|
+
"@workspace/typescript-config": "0.0.0",
|
|
136
|
+
"@workspace/eslint-config": "0.0.0"
|
|
133
137
|
},
|
|
134
138
|
"peerDependencies": {
|
|
135
139
|
"rolldown": ">=1",
|
package/dist/client-BmfdVI22.js
DELETED
|
@@ -1,160 +0,0 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* ========================================================================
|
|
3
|
-
* @rzl-zone/build-tools
|
|
4
|
-
* ------------------------------------------------------------------------
|
|
5
|
-
* Version: `0.0.10`
|
|
6
|
-
* Author: `Rizalvin Dwiky <rizalvindwiky1998@gmail.com>`
|
|
7
|
-
* Repository: `https://github.com/rzl-zone/rzl-zone/tree/main/packages/build-tools`
|
|
8
|
-
* ========================================================================
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { c as isNil, d as isNumber, f as isObject, g as isString, h as isSet, i as isBoolean, l as isNonEmptyString, m as isRegExp, o as isFunction, p as isPlainObject, r as isArray, s as isMap, t as deepFreeze } from "./helper-CWU8QYq3.js";
|
|
12
|
-
import pcr from "picocolors";
|
|
13
|
-
const hasGlobalRequire = (value) => isObject(value) && isFunction(value.require);
|
|
14
|
-
const getRuntimeRequire = () => {
|
|
15
|
-
if (!hasGlobalRequire(globalThis)) return void 0;
|
|
16
|
-
return globalThis.require;
|
|
17
|
-
};
|
|
18
|
-
const __runtimeRequire = ((x) => {
|
|
19
|
-
const r = getRuntimeRequire();
|
|
20
|
-
if (r) return r;
|
|
21
|
-
if (typeof Proxy !== "undefined") return new Proxy(x, { get(target, prop) {
|
|
22
|
-
const r2 = getRuntimeRequire();
|
|
23
|
-
return r2 ? r2[prop] : target[prop];
|
|
24
|
-
} });
|
|
25
|
-
return x;
|
|
26
|
-
})(function(id) {
|
|
27
|
-
const r = getRuntimeRequire();
|
|
28
|
-
if (r) return r.call(this, id);
|
|
29
|
-
throw new Error(`Calling \`require\` for "${id}" in an environment that doesn't expose the \`require\` function.`);
|
|
30
|
-
});
|
|
31
|
-
const picocolors = pcr;
|
|
32
|
-
const NEWLINE = atob("Cg==");
|
|
33
|
-
const EOL = hasGlobalRequire(globalThis) ? __runtimeRequire("node:os").EOL : NEWLINE;
|
|
34
|
-
function plural(count, word, pluralWord) {
|
|
35
|
-
if (count === 1) return word;
|
|
36
|
-
return pluralWord ?? `${word}s`;
|
|
37
|
-
}
|
|
38
|
-
function padText(value, options = {}) {
|
|
39
|
-
const { start = true, end = true, padOnInvalid = true } = options;
|
|
40
|
-
if (!isNonEmptyString(value)) return padOnInvalid ? " " : "";
|
|
41
|
-
return `${start ? " " : ""}${value}${end ? " " : ""}`;
|
|
42
|
-
}
|
|
43
|
-
function joinInline(...text) {
|
|
44
|
-
return text.filter(Boolean).join(" ");
|
|
45
|
-
}
|
|
46
|
-
function joinLines(...text) {
|
|
47
|
-
return text.filter(Boolean).join(EOL);
|
|
48
|
-
}
|
|
49
|
-
function joinLinesLoose(...text) {
|
|
50
|
-
return text.filter((v) => v !== false && v !== null && v !== void 0).join(EOL);
|
|
51
|
-
}
|
|
52
|
-
function formatOptionValue(value, options) {
|
|
53
|
-
const { pretty = false, indent = 2, sortKeys = false, sortArray = false } = options ?? {};
|
|
54
|
-
const indentUnit = " ".repeat(indent);
|
|
55
|
-
function formatRecursive(input, depth = 0) {
|
|
56
|
-
const currentIndent = indentUnit.repeat(depth);
|
|
57
|
-
const nextIndent = indentUnit.repeat(depth + 1);
|
|
58
|
-
const joinInline = picocolors.dim(", ");
|
|
59
|
-
const joinPretty = `,${EOL}`;
|
|
60
|
-
if (isSet(input)) return formatRecursive([...input], depth);
|
|
61
|
-
if (isMap(input)) return formatRecursive(Object.fromEntries(input), depth);
|
|
62
|
-
if (isArray(input)) {
|
|
63
|
-
const arr = sortArray ? [...input].sort() : input;
|
|
64
|
-
if (arr.length === 0) return picocolors.gray("[]");
|
|
65
|
-
if (!pretty) {
|
|
66
|
-
const items = arr.map((v) => formatRecursive(v, depth)).join(joinInline);
|
|
67
|
-
return picocolors.gray("[") + items + picocolors.gray("]");
|
|
68
|
-
}
|
|
69
|
-
const items = arr.map((v) => nextIndent + formatRecursive(v, depth + 1)).join(joinPretty);
|
|
70
|
-
return picocolors.gray(`[${EOL}`) + items + EOL + currentIndent + picocolors.gray("]");
|
|
71
|
-
}
|
|
72
|
-
if (isPlainObject(input)) {
|
|
73
|
-
let entries = Object.entries(input);
|
|
74
|
-
if (sortKeys) entries = entries.sort(([a], [b]) => a.localeCompare(b));
|
|
75
|
-
if (entries.length === 0) return picocolors.gray("{}");
|
|
76
|
-
if (!pretty) {
|
|
77
|
-
const props = entries.map(([key, val]) => {
|
|
78
|
-
return picocolors.dim(key) + picocolors.gray(": ") + formatRecursive(val, depth);
|
|
79
|
-
}).join(joinInline);
|
|
80
|
-
return picocolors.gray("{ ") + props + picocolors.gray(" }");
|
|
81
|
-
}
|
|
82
|
-
const props = entries.map(([key, val]) => {
|
|
83
|
-
return nextIndent + picocolors.dim(key) + picocolors.gray(": ") + formatRecursive(val, depth + 1);
|
|
84
|
-
}).join(joinPretty);
|
|
85
|
-
return picocolors.gray(`{${EOL}`) + props + EOL + currentIndent + picocolors.gray("}");
|
|
86
|
-
}
|
|
87
|
-
if (isRegExp(input)) return picocolors.greenBright("/") + picocolors.redBright(input.source) + picocolors.greenBright("/") + picocolors.magentaBright(input.flags);
|
|
88
|
-
if (isString(input)) return picocolors.gray(`"${input}"`);
|
|
89
|
-
if (isNumber(input, { includeNaN: true })) return picocolors.redBright(String(input));
|
|
90
|
-
if (isBoolean(input)) return picocolors.redBright(String(input));
|
|
91
|
-
if (isNil(input)) return picocolors.redBright(String(input));
|
|
92
|
-
if (isObject(input)) return picocolors.cyanBright(Object.prototype.toString.call(input));
|
|
93
|
-
return picocolors.cyanBright(String(input));
|
|
94
|
-
}
|
|
95
|
-
return formatRecursive(value);
|
|
96
|
-
}
|
|
97
|
-
var ConfigurationError = class ConfigurationError extends Error {
|
|
98
|
-
static _LABEL = "Invalid configuration";
|
|
99
|
-
static _normalizeReason(reason) {
|
|
100
|
-
const trimmed = reason.trim().replace(/\.*$/, "");
|
|
101
|
-
if (trimmed.length === 0) return trimmed;
|
|
102
|
-
return trimmed.charAt(0).toLowerCase() + trimmed.slice(1);
|
|
103
|
-
}
|
|
104
|
-
static _compose(field, body, context) {
|
|
105
|
-
const prefix = context ? `${ConfigurationError._LABEL} in ${ConfigurationError.wrapCode(context)}:` : `${ConfigurationError._LABEL}:`;
|
|
106
|
-
return ConfigurationError.format(`${prefix} ${ConfigurationError.wrapCode(field)} ${body}`);
|
|
107
|
-
}
|
|
108
|
-
constructor(message, details) {
|
|
109
|
-
super(message);
|
|
110
|
-
this.name = ConfigurationError.NAME;
|
|
111
|
-
this.code = ConfigurationError.CODE;
|
|
112
|
-
this.details = details ? deepFreeze({ ...details }) : void 0;
|
|
113
|
-
Object.setPrototypeOf(this, new.target.prototype);
|
|
114
|
-
if (Error.captureStackTrace) Error.captureStackTrace(this, ConfigurationError);
|
|
115
|
-
if (Object.getPrototypeOf(this) === ConfigurationError.prototype) Object.freeze(this);
|
|
116
|
-
}
|
|
117
|
-
static NAME = "ConfigurationError";
|
|
118
|
-
static CODE = "CONFIGURATION_ERROR";
|
|
119
|
-
code = ConfigurationError.CODE;
|
|
120
|
-
details;
|
|
121
|
-
static format(message) {
|
|
122
|
-
if (typeof message !== "string" || message.trim().length === 0) throw new TypeError(`${this._LABEL}: ${ConfigurationError.NAME}.format(message) expects a non-empty string.`);
|
|
123
|
-
return message.trim().replace(/\.*$/, "") + ".";
|
|
124
|
-
}
|
|
125
|
-
static wrapCode(value) {
|
|
126
|
-
if (!isNonEmptyString(value)) throw new TypeError(`${this._LABEL}: ${ConfigurationError.NAME}.wrapCode(value) expects a non-empty string.`);
|
|
127
|
-
return `\`${value.replace(/`+/g, "").trim()}\``;
|
|
128
|
-
}
|
|
129
|
-
static is(value) {
|
|
130
|
-
if (typeof value !== "object" || value === null) return false;
|
|
131
|
-
if (!("code" in value) || !("name" in value)) return false;
|
|
132
|
-
const { code, name } = value;
|
|
133
|
-
return code === ConfigurationError.CODE && name === ConfigurationError.NAME;
|
|
134
|
-
}
|
|
135
|
-
toJSON() {
|
|
136
|
-
return {
|
|
137
|
-
name: this.name,
|
|
138
|
-
message: this.message,
|
|
139
|
-
code: this.code,
|
|
140
|
-
details: this.details,
|
|
141
|
-
stack: this.stack
|
|
142
|
-
};
|
|
143
|
-
}
|
|
144
|
-
static invalid(field, reason, details, context) {
|
|
145
|
-
const body = ConfigurationError._normalizeReason(reason);
|
|
146
|
-
return new ConfigurationError(ConfigurationError._compose(field, body, context), {
|
|
147
|
-
...details,
|
|
148
|
-
...context ? { context } : {}
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
static type(field, expected, received, context) {
|
|
152
|
-
const body = `must be ${expected}`;
|
|
153
|
-
return new ConfigurationError(ConfigurationError._compose(field, body, context), {
|
|
154
|
-
received,
|
|
155
|
-
...context ? { context } : {}
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
export { joinInline as a, padText as c, formatOptionValue as i, picocolors as l, EOL as n, joinLines as o, NEWLINE as r, joinLinesLoose as s, ConfigurationError as t, plural as u };
|
|
160
|
-
//# sourceMappingURL=client-BmfdVI22.js.map
|