@rzl-zone/build-tools 0.0.7 → 0.0.9

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 (63) hide show
  1. package/dist/.references/index.d.cts +1 -1
  2. package/dist/.references/index.d.ts +1 -1
  3. package/dist/bundler/rolldown.cjs +2 -2
  4. package/dist/bundler/rolldown.d.cts +2 -2
  5. package/dist/bundler/rolldown.d.ts +2 -2
  6. package/dist/bundler/rolldown.js +1 -1
  7. package/dist/bundler/tsdown.cjs +3 -3
  8. package/dist/bundler/tsdown.d.cts +2 -2
  9. package/dist/bundler/tsdown.d.ts +2 -2
  10. package/dist/bundler/tsdown.js +3 -3
  11. package/dist/bundler/utils.cjs +2 -2
  12. package/dist/bundler/utils.d.cts +2 -2
  13. package/dist/bundler/utils.d.ts +2 -2
  14. package/dist/bundler/utils.js +2 -2
  15. package/dist/{client-VbpeaXsy.cjs → client-C3jHSAqV.cjs} +3 -3
  16. package/dist/{client-VbpeaXsy.cjs.map → client-C3jHSAqV.cjs.map} +1 -1
  17. package/dist/{client-CuldIPPY.js → client-DUlrjus0.js} +3 -3
  18. package/dist/{client-CuldIPPY.js.map → client-DUlrjus0.js.map} +1 -1
  19. package/dist/commander-kit/index.cjs +5 -5
  20. package/dist/commander-kit/index.d.cts +3 -3
  21. package/dist/commander-kit/index.d.ts +3 -3
  22. package/dist/commander-kit/index.js +5 -5
  23. package/dist/{extra-2iX9E4Hj.d.cts → extra-CsRmdXC4.d.cts} +2 -2
  24. package/dist/{extra-DY59MRMZ.d.ts → extra-DxvrBev9.d.ts} +2 -2
  25. package/dist/{fast-globe-options-ClsKhWod.d.ts → fast-globe-options-Cz8KJqKc.d.ts} +3 -3
  26. package/dist/{fast-globe-options-BLHLcUA_.d.cts → fast-globe-options-PH-bHWVK.d.cts} +3 -3
  27. package/dist/{helper-BlSd9P9f.js → helper-D11A-ZKL.js} +2 -2
  28. package/dist/{helper-BlSd9P9f.js.map → helper-D11A-ZKL.js.map} +1 -1
  29. package/dist/{helper-PkWCboHw.cjs → helper-DpeqwciR.cjs} +2 -2
  30. package/dist/{helper-PkWCboHw.cjs.map → helper-DpeqwciR.cjs.map} +1 -1
  31. package/dist/{identity-NSVVUm0l.cjs → identity-ByjqnR8L.cjs} +6 -6
  32. package/dist/{identity-NSVVUm0l.cjs.map → identity-ByjqnR8L.cjs.map} +1 -1
  33. package/dist/{identity-BFjidy_R.js → identity-C5MeSAA7.js} +6 -6
  34. package/dist/{identity-BFjidy_R.js.map → identity-C5MeSAA7.js.map} +1 -1
  35. package/dist/{index-CQatHoCR.d.ts → index-B1t7Xs3T.d.ts} +2 -2
  36. package/dist/{index-CNjsgh1e.d.ts → index-Dvmmz0f_.d.ts} +15 -3
  37. package/dist/{index-B3VpO-fM.d.cts → index-TgjbNRWB.d.cts} +15 -3
  38. package/dist/{index-BNJNsFwK.d.cts → index-xAz8brx-.d.cts} +2 -2
  39. package/dist/index.cjs +196 -196
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +157 -157
  42. package/dist/index.d.ts +157 -157
  43. package/dist/index.js +196 -196
  44. package/dist/index.js.map +1 -1
  45. package/dist/{package-banner-yTTlKTH6.cjs → package-banner-ByfR7yCv.cjs} +17 -11
  46. package/dist/package-banner-ByfR7yCv.cjs.map +1 -0
  47. package/dist/{package-banner-Cgukf7xE.js → package-banner-vwqcAX8E.js} +17 -11
  48. package/dist/package-banner-vwqcAX8E.js.map +1 -0
  49. package/dist/{server-niOC1_n4.js → server-1H2HFAbi.js} +3 -3
  50. package/dist/{server-niOC1_n4.js.map → server-1H2HFAbi.js.map} +1 -1
  51. package/dist/{server-Ct02ysTN.cjs → server-BK6eykjo.cjs} +3 -3
  52. package/dist/{server-Ct02ysTN.cjs.map → server-BK6eykjo.cjs.map} +1 -1
  53. package/dist/utils/client.cjs +2 -2
  54. package/dist/utils/client.d.cts +1 -1
  55. package/dist/utils/client.d.ts +1 -1
  56. package/dist/utils/client.js +2 -2
  57. package/dist/utils/server.cjs +2 -2
  58. package/dist/utils/server.d.cts +2 -2
  59. package/dist/utils/server.d.ts +2 -2
  60. package/dist/utils/server.js +2 -2
  61. package/package.json +3 -3
  62. package/dist/package-banner-Cgukf7xE.js.map +0 -1
  63. package/dist/package-banner-yTTlKTH6.cjs.map +0 -1
package/dist/index.js CHANGED
@@ -2,24 +2,24 @@
2
2
  * ========================================================================
3
3
  * @rzl-zone/build-tools
4
4
  * ------------------------------------------------------------------------
5
- * Version: `0.0.7`
5
+ * Version: `0.0.9`
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 { S as toStringSet, _ as isUndefined, a as isError, d as isNumber, g as isString, h as isSet, i as isBoolean, l as isNonEmptyString, m as isRegExp, n as flattenStrings, p as isPlainObject, r as isArray, v as normalizeSpaces, x as toObjectSet, y as safeStableStringify } from "./helper-BlSd9P9f.js";
12
- import { a as resolvePatternOptions, i as defaultPatternOptions, n as fsExtra, o as sourceOfPatternOptions, r as ICONS, t as fastGlob } from "./server-niOC1_n4.js";
13
- import { t as CommandIdentity } from "./identity-BFjidy_R.js";
14
- import { a as joinInline, i as formatOptionValue, l as picocolors, n as EOL, o as joinLines, s as joinLinesLoose, u as plural } from "./client-CuldIPPY.js";
15
- import { n as getPackageJson, t as generatePackageBanner } from "./package-banner-Cgukf7xE.js";
11
+ import { S as toStringSet, _ as isUndefined, a as isError, d as isNumber, g as isString, h as isSet, i as isBoolean, l as isNonEmptyString, m as isRegExp, n as flattenStrings, p as isPlainObject, r as isArray, v as normalizeSpaces, x as toObjectSet, y as safeStableStringify } from "./helper-D11A-ZKL.js";
12
+ import { a as resolvePatternOptions, i as defaultPatternOptions, n as fsExtra, o as sourceOfPatternOptions, r as ICONS, t as fastGlob } from "./server-1H2HFAbi.js";
13
+ import { t as CommandIdentity } from "./identity-C5MeSAA7.js";
14
+ import { a as joinInline, i as formatOptionValue, l as picocolors, n as EOL, o as joinLines, s as joinLinesLoose, u as plural } from "./client-DUlrjus0.js";
15
+ import { n as getPackageJson, t as generatePackageBanner } from "./package-banner-vwqcAX8E.js";
16
16
  import "@rzl-zone/node-only";
17
17
  import * as t from "@babel/types";
18
18
  import { parse } from "@babel/parser";
19
19
  import traverseImport from "@babel/traverse";
20
20
  import path from "node:path";
21
- import * as acorn from "acorn";
22
21
  import { ChildProcess, spawn } from "node:child_process";
22
+ import * as acorn from "acorn";
23
23
  function isLogLevel(value) {
24
24
  return typeof value === "string" && value in LOG_LEVEL_PRIORITY;
25
25
  }
@@ -1154,195 +1154,6 @@ const normalizeJsBuildNewlines = async (pattern, options = {}) => {
1154
1154
  });
1155
1155
  }
1156
1156
  };
1157
- const DEFAULT_SJC_PATTERN_POLICY = {
1158
- filesOnly: true,
1159
- forceUnique: true
1160
- };
1161
- const resolvedSjcPatternOption = resolvePatternOptions(defaultPatternOptions, DEFAULT_SJC_PATTERN_POLICY);
1162
- const DEFAULT_SJC_OPTIONS = {
1163
- removeSourceMap: false,
1164
- sourceType: "module",
1165
- removeRegion: true,
1166
- ecmaVersion: "latest",
1167
- patternOptions: resolvedSjcPatternOption,
1168
- logLevel: DEFAULT_LOG_LEVEL
1169
- };
1170
- const VALID_SOURCE_TYPE = new Set([
1171
- "module",
1172
- "script",
1173
- "commonjs"
1174
- ]);
1175
- const VALID_ECMA_VERSION = new Set([
1176
- "latest",
1177
- 3,
1178
- 5,
1179
- 6,
1180
- 7,
1181
- 8,
1182
- 9,
1183
- 10,
1184
- 11,
1185
- 12,
1186
- 13,
1187
- 14,
1188
- 15,
1189
- 16,
1190
- 17,
1191
- 2015,
1192
- 2016,
1193
- 2017,
1194
- 2018,
1195
- 2019,
1196
- 2020,
1197
- 2021,
1198
- 2022,
1199
- 2023,
1200
- 2024,
1201
- 2025,
1202
- 2026
1203
- ]);
1204
- const REGION_COMMENT_RE = /^#(?:end)?region\b/i;
1205
- const SOURCE_MAP_COMMENT_RE = /^[#@]\s*sourceMappingURL=/;
1206
- function normalizeNewlines(code) {
1207
- return code.replace(/[ \t]+\n/g, EOL).replace(/\n\s*\n+/g, EOL);
1208
- }
1209
- function stripComments(code, { removeRegion, removeSourceMap, sourceType, ecmaVersion }) {
1210
- const comments = [];
1211
- if (sourceType == null || !VALID_SOURCE_TYPE.has(sourceType)) sourceType = DEFAULT_SJC_OPTIONS.sourceType;
1212
- if (ecmaVersion == null || !VALID_ECMA_VERSION.has(ecmaVersion)) ecmaVersion = DEFAULT_SJC_OPTIONS.ecmaVersion;
1213
- try {
1214
- acorn.parse(code, {
1215
- sourceType,
1216
- ecmaVersion,
1217
- allowHashBang: true,
1218
- onComment(block, text, start, end) {
1219
- if (!block) {
1220
- const value = text.trim();
1221
- if (!REGION_COMMENT_RE.test(value) && !SOURCE_MAP_COMMENT_RE.test(value)) return;
1222
- }
1223
- const value = text.trim();
1224
- const forceRemove = shouldRemoveDocRuntime(value);
1225
- if (forceRemove === true) {
1226
- comments.push([start, end]);
1227
- return;
1228
- }
1229
- if (forceRemove === false) return;
1230
- if (IMPORTANT_COMMENT.test(value)) return;
1231
- if (SOURCE_MAP_COMMENT_RE.test(value)) {
1232
- if (removeSourceMap) comments.push([start, end]);
1233
- return;
1234
- }
1235
- if (REGION_COMMENT_RE.test(value)) {
1236
- if (removeRegion) comments.push([start, end]);
1237
- return;
1238
- }
1239
- if (block) comments.push([start, end]);
1240
- }
1241
- });
1242
- } catch {
1243
- return code;
1244
- }
1245
- if (!comments.length) return code;
1246
- const parts = [];
1247
- let last = 0;
1248
- for (const [start, end] of comments) {
1249
- parts.push(code.slice(last, start));
1250
- last = end;
1251
- }
1252
- parts.push(code.slice(last));
1253
- const lines = parts.join("").split(/\r?\n/);
1254
- const seenSourceMap = /* @__PURE__ */ new Set();
1255
- return lines.filter((line) => {
1256
- if (SOURCE_MAP_RE.test(line)) {
1257
- const key = line.trim();
1258
- if (seenSourceMap.has(key)) return false;
1259
- seenSourceMap.add(key);
1260
- if (removeSourceMap) return false;
1261
- return true;
1262
- }
1263
- if (removeRegion && REGION_RE.test(line)) return false;
1264
- if (isTargetComment(line, {
1265
- removeSourceMap,
1266
- removeRegion
1267
- })) return false;
1268
- return true;
1269
- }).map((line) => {
1270
- let out = line.replace(/^[ \t]*\/\/\s*(?:\.\.\/|\.\/)*[^ \n]*?(?:src|node_modules)\/[^\n]*\n?/gm, "").replace(/\/\/\s*eslint[^\n]*/g, "");
1271
- out = out.replace(/(\/\/[#@]\s*sourceMappingURL=[^\r\n]*)(?:\r?\n\1)+/g, "$1");
1272
- return out;
1273
- }).join(EOL);
1274
- }
1275
- const commandSjcIdentity = new CommandIdentity({ defaultCommandName: "strip-js-comments" });
1276
- const stripJsComments = async (pattern, options = {}) => {
1277
- const loggerLevel = resolveLogVerbosity(options, DEFAULT_SJC_OPTIONS.logLevel);
1278
- try {
1279
- const { patternOptions = DEFAULT_SJC_OPTIONS.patternOptions, removeSourceMap = DEFAULT_SJC_OPTIONS.removeSourceMap, removeRegion = DEFAULT_SJC_OPTIONS.removeRegion, sourceType = DEFAULT_SJC_OPTIONS.sourceType, ecmaVersion = DEFAULT_SJC_OPTIONS.ecmaVersion, __commandTitle } = options;
1280
- if (canLog(loggerLevel, VERBOSE_LOG)) console.log(joinLinesLoose(isNonEmptyString(__commandTitle) ? __commandTitle : commandSjcIdentity.utility(), ""));
1281
- const patterns = [...toStringSet(pattern)];
1282
- const cleanPatternOptions = resolvePatternOptions(patternOptions, DEFAULT_SJC_PATTERN_POLICY);
1283
- if (canLog(loggerLevel, VERBOSE_LOG)) {
1284
- BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
1285
- BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
1286
- BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, sourceOfPatternOptions(cleanPatternOptions, DEFAULT_SJC_OPTIONS.patternOptions));
1287
- BUILD_LOGGER.OPTIONS("options.removeSourceMap", removeSourceMap, BUILD_LOGGER.SOURCE_OF(removeSourceMap, DEFAULT_SJC_OPTIONS.removeSourceMap));
1288
- BUILD_LOGGER.OPTIONS("options.removeRegion", removeRegion, BUILD_LOGGER.SOURCE_OF(removeRegion, DEFAULT_SJC_OPTIONS.removeRegion));
1289
- BUILD_LOGGER.OPTIONS("options.sourceType", sourceType, BUILD_LOGGER.SOURCE_OF(sourceType, DEFAULT_SJC_OPTIONS.sourceType));
1290
- BUILD_LOGGER.OPTIONS("options.ecmaVersion", ecmaVersion, BUILD_LOGGER.SOURCE_OF(ecmaVersion, DEFAULT_SJC_OPTIONS.ecmaVersion));
1291
- BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_SJC_OPTIONS.logLevel));
1292
- BUILD_LOGGER.NEW_LINE();
1293
- BUILD_LOGGER.ON_STARTING({ actionName: "Stripping JS Comments" });
1294
- }
1295
- const files = (await fastGlob(patterns, cleanPatternOptions)).sort();
1296
- let count = 0;
1297
- for (const filePath of files) {
1298
- if (!JS_OUTPUT_FILE_RE.test(filePath)) continue;
1299
- let content;
1300
- try {
1301
- content = await fsExtra.promises.readFile(filePath, "utf8");
1302
- } catch (err) {
1303
- if (err.code === "ENOENT") continue;
1304
- throw err;
1305
- }
1306
- let output = content;
1307
- if (!/\/[/*]/.test(content)) continue;
1308
- output = stripComments(content, {
1309
- removeRegion,
1310
- removeSourceMap,
1311
- sourceType,
1312
- ecmaVersion
1313
- });
1314
- output = normalizeNewlines(output).trim() + EOL;
1315
- if (output !== content) {
1316
- try {
1317
- await fsExtra.promises.writeFile(filePath, output, "utf8");
1318
- } catch (err) {
1319
- if (err.code === "ENOENT") continue;
1320
- throw err;
1321
- }
1322
- count++;
1323
- if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
1324
- actionName: "JS Comment Stripping",
1325
- count,
1326
- nameDirect: filePath
1327
- });
1328
- }
1329
- }
1330
- if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) BUILD_LOGGER.ON_FINISH({
1331
- actionName: "Stripping JS Comments",
1332
- count
1333
- });
1334
- else BUILD_LOGGER.ON_SKIPPING({
1335
- actionName: "Stripping JS Comments",
1336
- reasonType: "file",
1337
- reasonEndText: "processing"
1338
- });
1339
- } catch (error) {
1340
- if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
1341
- actionName: "Stripping JS Comments",
1342
- error
1343
- });
1344
- }
1345
- };
1346
1157
  function runCommand(command, argsOrOptions = [], maybeOptions = {}) {
1347
1158
  assertValidCommand(command);
1348
1159
  let args;
@@ -1637,5 +1448,194 @@ function spawnWithLifecycle(command, args, options, config) {
1637
1448
  }
1638
1449
  };
1639
1450
  }
1451
+ const DEFAULT_SJC_PATTERN_POLICY = {
1452
+ filesOnly: true,
1453
+ forceUnique: true
1454
+ };
1455
+ const resolvedSjcPatternOption = resolvePatternOptions(defaultPatternOptions, DEFAULT_SJC_PATTERN_POLICY);
1456
+ const DEFAULT_SJC_OPTIONS = {
1457
+ removeSourceMap: false,
1458
+ sourceType: "module",
1459
+ removeRegion: true,
1460
+ ecmaVersion: "latest",
1461
+ patternOptions: resolvedSjcPatternOption,
1462
+ logLevel: DEFAULT_LOG_LEVEL
1463
+ };
1464
+ const VALID_SOURCE_TYPE = new Set([
1465
+ "module",
1466
+ "script",
1467
+ "commonjs"
1468
+ ]);
1469
+ const VALID_ECMA_VERSION = new Set([
1470
+ "latest",
1471
+ 3,
1472
+ 5,
1473
+ 6,
1474
+ 7,
1475
+ 8,
1476
+ 9,
1477
+ 10,
1478
+ 11,
1479
+ 12,
1480
+ 13,
1481
+ 14,
1482
+ 15,
1483
+ 16,
1484
+ 17,
1485
+ 2015,
1486
+ 2016,
1487
+ 2017,
1488
+ 2018,
1489
+ 2019,
1490
+ 2020,
1491
+ 2021,
1492
+ 2022,
1493
+ 2023,
1494
+ 2024,
1495
+ 2025,
1496
+ 2026
1497
+ ]);
1498
+ const REGION_COMMENT_RE = /^#(?:end)?region\b/i;
1499
+ const SOURCE_MAP_COMMENT_RE = /^[#@]\s*sourceMappingURL=/;
1500
+ function normalizeNewlines(code) {
1501
+ return code.replace(/[ \t]+\n/g, EOL).replace(/\n\s*\n+/g, EOL);
1502
+ }
1503
+ function stripComments(code, { removeRegion, removeSourceMap, sourceType, ecmaVersion }) {
1504
+ const comments = [];
1505
+ if (sourceType == null || !VALID_SOURCE_TYPE.has(sourceType)) sourceType = DEFAULT_SJC_OPTIONS.sourceType;
1506
+ if (ecmaVersion == null || !VALID_ECMA_VERSION.has(ecmaVersion)) ecmaVersion = DEFAULT_SJC_OPTIONS.ecmaVersion;
1507
+ try {
1508
+ acorn.parse(code, {
1509
+ sourceType,
1510
+ ecmaVersion,
1511
+ allowHashBang: true,
1512
+ onComment(block, text, start, end) {
1513
+ if (!block) {
1514
+ const value = text.trim();
1515
+ if (!REGION_COMMENT_RE.test(value) && !SOURCE_MAP_COMMENT_RE.test(value)) return;
1516
+ }
1517
+ const value = text.trim();
1518
+ const forceRemove = shouldRemoveDocRuntime(value);
1519
+ if (forceRemove === true) {
1520
+ comments.push([start, end]);
1521
+ return;
1522
+ }
1523
+ if (forceRemove === false) return;
1524
+ if (IMPORTANT_COMMENT.test(value)) return;
1525
+ if (SOURCE_MAP_COMMENT_RE.test(value)) {
1526
+ if (removeSourceMap) comments.push([start, end]);
1527
+ return;
1528
+ }
1529
+ if (REGION_COMMENT_RE.test(value)) {
1530
+ if (removeRegion) comments.push([start, end]);
1531
+ return;
1532
+ }
1533
+ if (block) comments.push([start, end]);
1534
+ }
1535
+ });
1536
+ } catch {
1537
+ return code;
1538
+ }
1539
+ if (!comments.length) return code;
1540
+ const parts = [];
1541
+ let last = 0;
1542
+ for (const [start, end] of comments) {
1543
+ parts.push(code.slice(last, start));
1544
+ last = end;
1545
+ }
1546
+ parts.push(code.slice(last));
1547
+ const lines = parts.join("").split(/\r?\n/);
1548
+ const seenSourceMap = /* @__PURE__ */ new Set();
1549
+ return lines.filter((line) => {
1550
+ if (SOURCE_MAP_RE.test(line)) {
1551
+ const key = line.trim();
1552
+ if (seenSourceMap.has(key)) return false;
1553
+ seenSourceMap.add(key);
1554
+ if (removeSourceMap) return false;
1555
+ return true;
1556
+ }
1557
+ if (removeRegion && REGION_RE.test(line)) return false;
1558
+ if (isTargetComment(line, {
1559
+ removeSourceMap,
1560
+ removeRegion
1561
+ })) return false;
1562
+ return true;
1563
+ }).map((line) => {
1564
+ let out = line.replace(/^[ \t]*\/\/\s*(?:\.\.\/|\.\/)*[^ \n]*?(?:src|node_modules)\/[^\n]*\n?/gm, "").replace(/\/\/\s*eslint[^\n]*/g, "");
1565
+ out = out.replace(/(\/\/[#@]\s*sourceMappingURL=[^\r\n]*)(?:\r?\n\1)+/g, "$1");
1566
+ return out;
1567
+ }).join(EOL);
1568
+ }
1569
+ const commandSjcIdentity = new CommandIdentity({ defaultCommandName: "strip-js-comments" });
1570
+ const stripJsComments = async (pattern, options = {}) => {
1571
+ const loggerLevel = resolveLogVerbosity(options, DEFAULT_SJC_OPTIONS.logLevel);
1572
+ try {
1573
+ const { patternOptions = DEFAULT_SJC_OPTIONS.patternOptions, removeSourceMap = DEFAULT_SJC_OPTIONS.removeSourceMap, removeRegion = DEFAULT_SJC_OPTIONS.removeRegion, sourceType = DEFAULT_SJC_OPTIONS.sourceType, ecmaVersion = DEFAULT_SJC_OPTIONS.ecmaVersion, __commandTitle } = options;
1574
+ if (canLog(loggerLevel, VERBOSE_LOG)) console.log(joinLinesLoose(isNonEmptyString(__commandTitle) ? __commandTitle : commandSjcIdentity.utility(), ""));
1575
+ const patterns = [...toStringSet(pattern)];
1576
+ const cleanPatternOptions = resolvePatternOptions(patternOptions, DEFAULT_SJC_PATTERN_POLICY);
1577
+ if (canLog(loggerLevel, VERBOSE_LOG)) {
1578
+ BUILD_LOGGER.SECTION("Options", { icon: "⚙️ " });
1579
+ BUILD_LOGGER.OPTIONS("pattern", patterns, BUILD_LOGGER.SOURCE_OF(patterns, void 0), true);
1580
+ BUILD_LOGGER.OPTIONS("options.patternOptions", cleanPatternOptions, sourceOfPatternOptions(cleanPatternOptions, DEFAULT_SJC_OPTIONS.patternOptions));
1581
+ BUILD_LOGGER.OPTIONS("options.removeSourceMap", removeSourceMap, BUILD_LOGGER.SOURCE_OF(removeSourceMap, DEFAULT_SJC_OPTIONS.removeSourceMap));
1582
+ BUILD_LOGGER.OPTIONS("options.removeRegion", removeRegion, BUILD_LOGGER.SOURCE_OF(removeRegion, DEFAULT_SJC_OPTIONS.removeRegion));
1583
+ BUILD_LOGGER.OPTIONS("options.sourceType", sourceType, BUILD_LOGGER.SOURCE_OF(sourceType, DEFAULT_SJC_OPTIONS.sourceType));
1584
+ BUILD_LOGGER.OPTIONS("options.ecmaVersion", ecmaVersion, BUILD_LOGGER.SOURCE_OF(ecmaVersion, DEFAULT_SJC_OPTIONS.ecmaVersion));
1585
+ BUILD_LOGGER.OPTIONS("options.logLevel", loggerLevel, BUILD_LOGGER.SOURCE_OF(loggerLevel, DEFAULT_SJC_OPTIONS.logLevel));
1586
+ BUILD_LOGGER.NEW_LINE();
1587
+ BUILD_LOGGER.ON_STARTING({ actionName: "Stripping JS Comments" });
1588
+ }
1589
+ const files = (await fastGlob(patterns, cleanPatternOptions)).sort();
1590
+ let count = 0;
1591
+ for (const filePath of files) {
1592
+ if (!JS_OUTPUT_FILE_RE.test(filePath)) continue;
1593
+ let content;
1594
+ try {
1595
+ content = await fsExtra.promises.readFile(filePath, "utf8");
1596
+ } catch (err) {
1597
+ if (err.code === "ENOENT") continue;
1598
+ throw err;
1599
+ }
1600
+ let output = content;
1601
+ if (!/\/[/*]/.test(content)) continue;
1602
+ output = stripComments(content, {
1603
+ removeRegion,
1604
+ removeSourceMap,
1605
+ sourceType,
1606
+ ecmaVersion
1607
+ });
1608
+ output = normalizeNewlines(output).trim() + EOL;
1609
+ if (output !== content) {
1610
+ try {
1611
+ await fsExtra.promises.writeFile(filePath, output, "utf8");
1612
+ } catch (err) {
1613
+ if (err.code === "ENOENT") continue;
1614
+ throw err;
1615
+ }
1616
+ count++;
1617
+ if (canLog(loggerLevel, VERBOSE_LOG)) BUILD_LOGGER.ON_PROCESS({
1618
+ actionName: "JS Comment Stripping",
1619
+ count,
1620
+ nameDirect: filePath
1621
+ });
1622
+ }
1623
+ }
1624
+ if (canLog(loggerLevel, VERBOSE_LOG)) if (count > 0) BUILD_LOGGER.ON_FINISH({
1625
+ actionName: "Stripping JS Comments",
1626
+ count
1627
+ });
1628
+ else BUILD_LOGGER.ON_SKIPPING({
1629
+ actionName: "Stripping JS Comments",
1630
+ reasonType: "file",
1631
+ reasonEndText: "processing"
1632
+ });
1633
+ } catch (error) {
1634
+ if (loggerLevel !== "silent") BUILD_LOGGER.ON_ERROR({
1635
+ actionName: "Stripping JS Comments",
1636
+ error
1637
+ });
1638
+ }
1639
+ };
1640
1640
  export { CommandProcessError, DEFAULT_CLEAN_PATTERN_POLICY, DEFAULT_ECI_PATTERN_POLICY, DEFAULT_EFN_PATTERN_POLICY, DEFAULT_GRI_PATTERN_POLICY, DEFAULT_IB_PATTERN_POLICY, DEFAULT_ID_PATTERN_POLICY, DEFAULT_NJBN_PATTERN_POLICY, DEFAULT_SJC_PATTERN_POLICY, cleanJsBuildArtifacts, cleanTypesBuildArtifacts, commandCftdIdentity, commandCjbaIdentity, commandCtbaIdentity, commandEciIdentity, commandEfnIdentity, commandGriIdentity, commandIbIdentity, commandIdIdentity, commandNjbnIdentity, commandSjcIdentity, copyFileToDest, createCopyFileToDestParameterSet, ensureCssImport, ensureFinalNewline, generatePackageBanner, generateReferenceIndex, getPackageJson, injectBanner, injectDirective, isCommandProcessError, normalizeJsBuildNewlines, resolvedCleanPatternOption, resolvedEciPatternOption, resolvedEfnPatternOption, resolvedGriPatternOption, resolvedIbPatternOption, resolvedIdPatternOption, resolvedNjbnPatternOption, resolvedSjcPatternOption, runCommand, runCommandCapture, stripJsComments };
1641
1641
  //# sourceMappingURL=index.js.map