@jsenv/core 30.0.4 → 30.0.6

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/main.js CHANGED
@@ -2264,16 +2264,16 @@ const writeFileSync = (destination, content = "") => {
2264
2264
  }
2265
2265
  };
2266
2266
 
2267
- const LOG_LEVEL_OFF = "off";
2268
- const LOG_LEVEL_DEBUG = "debug";
2269
- const LOG_LEVEL_INFO = "info";
2270
- const LOG_LEVEL_WARN = "warn";
2271
- const LOG_LEVEL_ERROR = "error";
2272
-
2273
- const createLogger = ({
2274
- logLevel = LOG_LEVEL_INFO
2267
+ const LOG_LEVEL_OFF$1 = "off";
2268
+ const LOG_LEVEL_DEBUG$1 = "debug";
2269
+ const LOG_LEVEL_INFO$1 = "info";
2270
+ const LOG_LEVEL_WARN$1 = "warn";
2271
+ const LOG_LEVEL_ERROR$1 = "error";
2272
+
2273
+ const createLogger$1 = ({
2274
+ logLevel = LOG_LEVEL_INFO$1
2275
2275
  } = {}) => {
2276
- if (logLevel === LOG_LEVEL_DEBUG) {
2276
+ if (logLevel === LOG_LEVEL_DEBUG$1) {
2277
2277
  return {
2278
2278
  level: "debug",
2279
2279
  levels: {
@@ -2282,13 +2282,13 @@ const createLogger = ({
2282
2282
  warn: true,
2283
2283
  error: true
2284
2284
  },
2285
- debug,
2286
- info,
2287
- warn,
2288
- error
2285
+ debug: debug$1,
2286
+ info: info$1,
2287
+ warn: warn$1,
2288
+ error: error$1
2289
2289
  };
2290
2290
  }
2291
- if (logLevel === LOG_LEVEL_INFO) {
2291
+ if (logLevel === LOG_LEVEL_INFO$1) {
2292
2292
  return {
2293
2293
  level: "info",
2294
2294
  levels: {
@@ -2297,13 +2297,13 @@ const createLogger = ({
2297
2297
  warn: true,
2298
2298
  error: true
2299
2299
  },
2300
- debug: debugDisabled,
2301
- info,
2302
- warn,
2303
- error
2300
+ debug: debugDisabled$1,
2301
+ info: info$1,
2302
+ warn: warn$1,
2303
+ error: error$1
2304
2304
  };
2305
2305
  }
2306
- if (logLevel === LOG_LEVEL_WARN) {
2306
+ if (logLevel === LOG_LEVEL_WARN$1) {
2307
2307
  return {
2308
2308
  level: "warn",
2309
2309
  levels: {
@@ -2312,13 +2312,13 @@ const createLogger = ({
2312
2312
  warn: true,
2313
2313
  error: true
2314
2314
  },
2315
- debug: debugDisabled,
2316
- info: infoDisabled,
2317
- warn,
2318
- error
2315
+ debug: debugDisabled$1,
2316
+ info: infoDisabled$1,
2317
+ warn: warn$1,
2318
+ error: error$1
2319
2319
  };
2320
2320
  }
2321
- if (logLevel === LOG_LEVEL_ERROR) {
2321
+ if (logLevel === LOG_LEVEL_ERROR$1) {
2322
2322
  return {
2323
2323
  level: "error",
2324
2324
  levels: {
@@ -2327,13 +2327,13 @@ const createLogger = ({
2327
2327
  warn: false,
2328
2328
  error: true
2329
2329
  },
2330
- debug: debugDisabled,
2331
- info: infoDisabled,
2332
- warn: warnDisabled,
2333
- error
2330
+ debug: debugDisabled$1,
2331
+ info: infoDisabled$1,
2332
+ warn: warnDisabled$1,
2333
+ error: error$1
2334
2334
  };
2335
2335
  }
2336
- if (logLevel === LOG_LEVEL_OFF) {
2336
+ if (logLevel === LOG_LEVEL_OFF$1) {
2337
2337
  return {
2338
2338
  level: "off",
2339
2339
  levels: {
@@ -2342,59 +2342,60 @@ const createLogger = ({
2342
2342
  warn: false,
2343
2343
  error: false
2344
2344
  },
2345
- debug: debugDisabled,
2346
- info: infoDisabled,
2347
- warn: warnDisabled,
2348
- error: errorDisabled
2345
+ debug: debugDisabled$1,
2346
+ info: infoDisabled$1,
2347
+ warn: warnDisabled$1,
2348
+ error: errorDisabled$1
2349
2349
  };
2350
2350
  }
2351
2351
  throw new Error(`unexpected logLevel.
2352
2352
  --- logLevel ---
2353
2353
  ${logLevel}
2354
2354
  --- allowed log levels ---
2355
- ${LOG_LEVEL_OFF}
2356
- ${LOG_LEVEL_ERROR}
2357
- ${LOG_LEVEL_WARN}
2358
- ${LOG_LEVEL_INFO}
2359
- ${LOG_LEVEL_DEBUG}`);
2360
- };
2361
- const debug = (...args) => console.debug(...args);
2362
- const debugDisabled = () => {};
2363
- const info = (...args) => console.info(...args);
2364
- const infoDisabled = () => {};
2365
- const warn = (...args) => console.warn(...args);
2366
- const warnDisabled = () => {};
2367
- const error = (...args) => console.error(...args);
2368
- const errorDisabled = () => {};
2355
+ ${LOG_LEVEL_OFF$1}
2356
+ ${LOG_LEVEL_ERROR$1}
2357
+ ${LOG_LEVEL_WARN$1}
2358
+ ${LOG_LEVEL_INFO$1}
2359
+ ${LOG_LEVEL_DEBUG$1}`);
2360
+ };
2361
+ const debug$1 = (...args) => console.debug(...args);
2362
+ const debugDisabled$1 = () => {};
2363
+ const info$1 = (...args) => console.info(...args);
2364
+ const infoDisabled$1 = () => {};
2365
+ const warn$1 = (...args) => console.warn(...args);
2366
+ const warnDisabled$1 = () => {};
2367
+ const error$1 = (...args) => console.error(...args);
2368
+ const errorDisabled$1 = () => {};
2369
2369
 
2370
2370
  // From: https://github.com/sindresorhus/has-flag/blob/main/index.js
2371
- function hasFlag(flag, argv = globalThis.Deno?.args ?? process$1.argv) {
2371
+ /// function hasFlag(flag, argv = globalThis.Deno?.args ?? process.argv) {
2372
+ function hasFlag$1(flag, argv = globalThis.Deno ? globalThis.Deno.args : process$1.argv) {
2372
2373
  const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
2373
2374
  const position = argv.indexOf(prefix + flag);
2374
2375
  const terminatorPosition = argv.indexOf('--');
2375
2376
  return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
2376
2377
  }
2377
2378
  const {
2378
- env
2379
+ env: env$1
2379
2380
  } = process$1;
2380
- let flagForceColor;
2381
- if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
2382
- flagForceColor = 0;
2383
- } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
2384
- flagForceColor = 1;
2381
+ let flagForceColor$1;
2382
+ if (hasFlag$1('no-color') || hasFlag$1('no-colors') || hasFlag$1('color=false') || hasFlag$1('color=never')) {
2383
+ flagForceColor$1 = 0;
2384
+ } else if (hasFlag$1('color') || hasFlag$1('colors') || hasFlag$1('color=true') || hasFlag$1('color=always')) {
2385
+ flagForceColor$1 = 1;
2385
2386
  }
2386
- function envForceColor() {
2387
- if ('FORCE_COLOR' in env) {
2388
- if (env.FORCE_COLOR === 'true') {
2387
+ function envForceColor$1() {
2388
+ if ('FORCE_COLOR' in env$1) {
2389
+ if (env$1.FORCE_COLOR === 'true') {
2389
2390
  return 1;
2390
2391
  }
2391
- if (env.FORCE_COLOR === 'false') {
2392
+ if (env$1.FORCE_COLOR === 'false') {
2392
2393
  return 0;
2393
2394
  }
2394
- return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
2395
+ return env$1.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env$1.FORCE_COLOR, 10), 3);
2395
2396
  }
2396
2397
  }
2397
- function translateLevel(level) {
2398
+ function translateLevel$1(level) {
2398
2399
  if (level === 0) {
2399
2400
  return false;
2400
2401
  }
@@ -2405,37 +2406,37 @@ function translateLevel(level) {
2405
2406
  has16m: level >= 3
2406
2407
  };
2407
2408
  }
2408
- function _supportsColor(haveStream, {
2409
+ function _supportsColor$1(haveStream, {
2409
2410
  streamIsTTY,
2410
2411
  sniffFlags = true
2411
2412
  } = {}) {
2412
- const noFlagForceColor = envForceColor();
2413
+ const noFlagForceColor = envForceColor$1();
2413
2414
  if (noFlagForceColor !== undefined) {
2414
- flagForceColor = noFlagForceColor;
2415
+ flagForceColor$1 = noFlagForceColor;
2415
2416
  }
2416
- const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
2417
+ const forceColor = sniffFlags ? flagForceColor$1 : noFlagForceColor;
2417
2418
  if (forceColor === 0) {
2418
2419
  return 0;
2419
2420
  }
2420
2421
  if (sniffFlags) {
2421
- if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
2422
+ if (hasFlag$1('color=16m') || hasFlag$1('color=full') || hasFlag$1('color=truecolor')) {
2422
2423
  return 3;
2423
2424
  }
2424
- if (hasFlag('color=256')) {
2425
+ if (hasFlag$1('color=256')) {
2425
2426
  return 2;
2426
2427
  }
2427
2428
  }
2428
2429
 
2429
2430
  // Check for Azure DevOps pipelines.
2430
2431
  // Has to be above the `!streamIsTTY` check.
2431
- if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
2432
+ if ('TF_BUILD' in env$1 && 'AGENT_NAME' in env$1) {
2432
2433
  return 1;
2433
2434
  }
2434
2435
  if (haveStream && !streamIsTTY && forceColor === undefined) {
2435
2436
  return 0;
2436
2437
  }
2437
2438
  const min = forceColor || 0;
2438
- if (env.TERM === 'dumb') {
2439
+ if (env$1.TERM === 'dumb') {
2439
2440
  return min;
2440
2441
  }
2441
2442
  if (process$1.platform === 'win32') {
@@ -2447,63 +2448,67 @@ function _supportsColor(haveStream, {
2447
2448
  }
2448
2449
  return 1;
2449
2450
  }
2450
- if ('CI' in env) {
2451
- if ('GITHUB_ACTIONS' in env) {
2451
+ if ('CI' in env$1) {
2452
+ if ('GITHUB_ACTIONS' in env$1) {
2452
2453
  return 3;
2453
2454
  }
2454
- if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
2455
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env$1) || env$1.CI_NAME === 'codeship') {
2455
2456
  return 1;
2456
2457
  }
2457
2458
  return min;
2458
2459
  }
2459
- if ('TEAMCITY_VERSION' in env) {
2460
- return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
2460
+ if ('TEAMCITY_VERSION' in env$1) {
2461
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env$1.TEAMCITY_VERSION) ? 1 : 0;
2461
2462
  }
2462
- if (env.COLORTERM === 'truecolor') {
2463
+ if (env$1.COLORTERM === 'truecolor') {
2463
2464
  return 3;
2464
2465
  }
2465
- if (env.TERM === 'xterm-kitty') {
2466
+ if (env$1.TERM === 'xterm-kitty') {
2466
2467
  return 3;
2467
2468
  }
2468
- if ('TERM_PROGRAM' in env) {
2469
- const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2470
- switch (env.TERM_PROGRAM) {
2469
+ if ('TERM_PROGRAM' in env$1) {
2470
+ const version = Number.parseInt((env$1.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
2471
+ switch (env$1.TERM_PROGRAM) {
2471
2472
  case 'iTerm.app':
2472
- return version >= 3 ? 3 : 2;
2473
+ {
2474
+ return version >= 3 ? 3 : 2;
2475
+ }
2473
2476
  case 'Apple_Terminal':
2474
- return 2;
2477
+ {
2478
+ return 2;
2479
+ }
2475
2480
  // No default
2476
2481
  }
2477
2482
  }
2478
2483
 
2479
- if (/-256(color)?$/i.test(env.TERM)) {
2484
+ if (/-256(color)?$/i.test(env$1.TERM)) {
2480
2485
  return 2;
2481
2486
  }
2482
- if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
2487
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env$1.TERM)) {
2483
2488
  return 1;
2484
2489
  }
2485
- if ('COLORTERM' in env) {
2490
+ if ('COLORTERM' in env$1) {
2486
2491
  return 1;
2487
2492
  }
2488
2493
  return min;
2489
2494
  }
2490
- function createSupportsColor(stream, options = {}) {
2491
- const level = _supportsColor(stream, {
2495
+ function createSupportsColor$1(stream, options = {}) {
2496
+ const level = _supportsColor$1(stream, {
2492
2497
  streamIsTTY: stream && stream.isTTY,
2493
2498
  ...options
2494
2499
  });
2495
- return translateLevel(level);
2500
+ return translateLevel$1(level);
2496
2501
  }
2497
2502
  ({
2498
- stdout: createSupportsColor({
2503
+ stdout: createSupportsColor$1({
2499
2504
  isTTY: tty.isatty(1)
2500
2505
  }),
2501
- stderr: createSupportsColor({
2506
+ stderr: createSupportsColor$1({
2502
2507
  isTTY: tty.isatty(2)
2503
2508
  })
2504
2509
  });
2505
2510
 
2506
- const processSupportsBasicColor = createSupportsColor(process.stdout).hasBasic;
2511
+ const processSupportsBasicColor = createSupportsColor$1(process.stdout).hasBasic;
2507
2512
  let canUseColors = processSupportsBasicColor;
2508
2513
 
2509
2514
  // GitHub workflow does support ANSI but "supports-color" returns false
@@ -2583,7 +2588,7 @@ const UNICODE = {
2583
2588
  supported: canUseUnicode
2584
2589
  };
2585
2590
 
2586
- const createDetailedMessage$1 = (message, details = {}) => {
2591
+ const createDetailedMessage$2 = (message, details = {}) => {
2587
2592
  let string = `${message}`;
2588
2593
  Object.keys(details).forEach(key => {
2589
2594
  const value = details[key];
@@ -3205,6 +3210,269 @@ const createTaskLog = (label, {
3205
3210
  };
3206
3211
  };
3207
3212
 
3213
+ const LOG_LEVEL_OFF = "off";
3214
+ const LOG_LEVEL_DEBUG = "debug";
3215
+ const LOG_LEVEL_INFO = "info";
3216
+ const LOG_LEVEL_WARN = "warn";
3217
+ const LOG_LEVEL_ERROR = "error";
3218
+
3219
+ const createLogger = ({
3220
+ logLevel = LOG_LEVEL_INFO
3221
+ } = {}) => {
3222
+ if (logLevel === LOG_LEVEL_DEBUG) {
3223
+ return {
3224
+ level: "debug",
3225
+ levels: {
3226
+ debug: true,
3227
+ info: true,
3228
+ warn: true,
3229
+ error: true
3230
+ },
3231
+ debug,
3232
+ info,
3233
+ warn,
3234
+ error
3235
+ };
3236
+ }
3237
+ if (logLevel === LOG_LEVEL_INFO) {
3238
+ return {
3239
+ level: "info",
3240
+ levels: {
3241
+ debug: false,
3242
+ info: true,
3243
+ warn: true,
3244
+ error: true
3245
+ },
3246
+ debug: debugDisabled,
3247
+ info,
3248
+ warn,
3249
+ error
3250
+ };
3251
+ }
3252
+ if (logLevel === LOG_LEVEL_WARN) {
3253
+ return {
3254
+ level: "warn",
3255
+ levels: {
3256
+ debug: false,
3257
+ info: false,
3258
+ warn: true,
3259
+ error: true
3260
+ },
3261
+ debug: debugDisabled,
3262
+ info: infoDisabled,
3263
+ warn,
3264
+ error
3265
+ };
3266
+ }
3267
+ if (logLevel === LOG_LEVEL_ERROR) {
3268
+ return {
3269
+ level: "error",
3270
+ levels: {
3271
+ debug: false,
3272
+ info: false,
3273
+ warn: false,
3274
+ error: true
3275
+ },
3276
+ debug: debugDisabled,
3277
+ info: infoDisabled,
3278
+ warn: warnDisabled,
3279
+ error
3280
+ };
3281
+ }
3282
+ if (logLevel === LOG_LEVEL_OFF) {
3283
+ return {
3284
+ level: "off",
3285
+ levels: {
3286
+ debug: false,
3287
+ info: false,
3288
+ warn: false,
3289
+ error: false
3290
+ },
3291
+ debug: debugDisabled,
3292
+ info: infoDisabled,
3293
+ warn: warnDisabled,
3294
+ error: errorDisabled
3295
+ };
3296
+ }
3297
+ throw new Error(`unexpected logLevel.
3298
+ --- logLevel ---
3299
+ ${logLevel}
3300
+ --- allowed log levels ---
3301
+ ${LOG_LEVEL_OFF}
3302
+ ${LOG_LEVEL_ERROR}
3303
+ ${LOG_LEVEL_WARN}
3304
+ ${LOG_LEVEL_INFO}
3305
+ ${LOG_LEVEL_DEBUG}`);
3306
+ };
3307
+ const debug = (...args) => console.debug(...args);
3308
+ const debugDisabled = () => {};
3309
+ const info = (...args) => console.info(...args);
3310
+ const infoDisabled = () => {};
3311
+ const warn = (...args) => console.warn(...args);
3312
+ const warnDisabled = () => {};
3313
+ const error = (...args) => console.error(...args);
3314
+ const errorDisabled = () => {};
3315
+
3316
+ // From: https://github.com/sindresorhus/has-flag/blob/main/index.js
3317
+ function hasFlag(flag, argv = globalThis.Deno?.args ?? process$1.argv) {
3318
+ const prefix = flag.startsWith('-') ? '' : flag.length === 1 ? '-' : '--';
3319
+ const position = argv.indexOf(prefix + flag);
3320
+ const terminatorPosition = argv.indexOf('--');
3321
+ return position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);
3322
+ }
3323
+ const {
3324
+ env
3325
+ } = process$1;
3326
+ let flagForceColor;
3327
+ if (hasFlag('no-color') || hasFlag('no-colors') || hasFlag('color=false') || hasFlag('color=never')) {
3328
+ flagForceColor = 0;
3329
+ } else if (hasFlag('color') || hasFlag('colors') || hasFlag('color=true') || hasFlag('color=always')) {
3330
+ flagForceColor = 1;
3331
+ }
3332
+ function envForceColor() {
3333
+ if ('FORCE_COLOR' in env) {
3334
+ if (env.FORCE_COLOR === 'true') {
3335
+ return 1;
3336
+ }
3337
+ if (env.FORCE_COLOR === 'false') {
3338
+ return 0;
3339
+ }
3340
+ return env.FORCE_COLOR.length === 0 ? 1 : Math.min(Number.parseInt(env.FORCE_COLOR, 10), 3);
3341
+ }
3342
+ }
3343
+ function translateLevel(level) {
3344
+ if (level === 0) {
3345
+ return false;
3346
+ }
3347
+ return {
3348
+ level,
3349
+ hasBasic: true,
3350
+ has256: level >= 2,
3351
+ has16m: level >= 3
3352
+ };
3353
+ }
3354
+ function _supportsColor(haveStream, {
3355
+ streamIsTTY,
3356
+ sniffFlags = true
3357
+ } = {}) {
3358
+ const noFlagForceColor = envForceColor();
3359
+ if (noFlagForceColor !== undefined) {
3360
+ flagForceColor = noFlagForceColor;
3361
+ }
3362
+ const forceColor = sniffFlags ? flagForceColor : noFlagForceColor;
3363
+ if (forceColor === 0) {
3364
+ return 0;
3365
+ }
3366
+ if (sniffFlags) {
3367
+ if (hasFlag('color=16m') || hasFlag('color=full') || hasFlag('color=truecolor')) {
3368
+ return 3;
3369
+ }
3370
+ if (hasFlag('color=256')) {
3371
+ return 2;
3372
+ }
3373
+ }
3374
+
3375
+ // Check for Azure DevOps pipelines.
3376
+ // Has to be above the `!streamIsTTY` check.
3377
+ if ('TF_BUILD' in env && 'AGENT_NAME' in env) {
3378
+ return 1;
3379
+ }
3380
+ if (haveStream && !streamIsTTY && forceColor === undefined) {
3381
+ return 0;
3382
+ }
3383
+ const min = forceColor || 0;
3384
+ if (env.TERM === 'dumb') {
3385
+ return min;
3386
+ }
3387
+ if (process$1.platform === 'win32') {
3388
+ // Windows 10 build 10586 is the first Windows release that supports 256 colors.
3389
+ // Windows 10 build 14931 is the first release that supports 16m/TrueColor.
3390
+ const osRelease = os.release().split('.');
3391
+ if (Number(osRelease[0]) >= 10 && Number(osRelease[2]) >= 10_586) {
3392
+ return Number(osRelease[2]) >= 14_931 ? 3 : 2;
3393
+ }
3394
+ return 1;
3395
+ }
3396
+ if ('CI' in env) {
3397
+ if ('GITHUB_ACTIONS' in env) {
3398
+ return 3;
3399
+ }
3400
+ if (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'BUILDKITE', 'DRONE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {
3401
+ return 1;
3402
+ }
3403
+ return min;
3404
+ }
3405
+ if ('TEAMCITY_VERSION' in env) {
3406
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;
3407
+ }
3408
+ if (env.COLORTERM === 'truecolor') {
3409
+ return 3;
3410
+ }
3411
+ if (env.TERM === 'xterm-kitty') {
3412
+ return 3;
3413
+ }
3414
+ if ('TERM_PROGRAM' in env) {
3415
+ const version = Number.parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);
3416
+ switch (env.TERM_PROGRAM) {
3417
+ case 'iTerm.app':
3418
+ return version >= 3 ? 3 : 2;
3419
+ case 'Apple_Terminal':
3420
+ return 2;
3421
+ // No default
3422
+ }
3423
+ }
3424
+
3425
+ if (/-256(color)?$/i.test(env.TERM)) {
3426
+ return 2;
3427
+ }
3428
+ if (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {
3429
+ return 1;
3430
+ }
3431
+ if ('COLORTERM' in env) {
3432
+ return 1;
3433
+ }
3434
+ return min;
3435
+ }
3436
+ function createSupportsColor(stream, options = {}) {
3437
+ const level = _supportsColor(stream, {
3438
+ streamIsTTY: stream && stream.isTTY,
3439
+ ...options
3440
+ });
3441
+ return translateLevel(level);
3442
+ }
3443
+ ({
3444
+ stdout: createSupportsColor({
3445
+ isTTY: tty.isatty(1)
3446
+ }),
3447
+ stderr: createSupportsColor({
3448
+ isTTY: tty.isatty(2)
3449
+ })
3450
+ });
3451
+
3452
+ createSupportsColor(process.stdout).hasBasic;
3453
+
3454
+ // GitHub workflow does support ANSI but "supports-color" returns false
3455
+ // because stream.isTTY returns false, see https://github.com/actions/runner/issues/241
3456
+ if (process.env.GITHUB_WORKFLOW) {
3457
+ // Check on FORCE_COLOR is to ensure it is prio over GitHub workflow check
3458
+ if (process.env.FORCE_COLOR !== "false") ;
3459
+ }
3460
+
3461
+ // see also https://github.com/sindresorhus/figures
3462
+ isUnicodeSupported();
3463
+
3464
+ const createDetailedMessage$1 = (message, details = {}) => {
3465
+ let string = `${message}`;
3466
+ Object.keys(details).forEach(key => {
3467
+ const value = details[key];
3468
+ string += `
3469
+ --- ${key} ---
3470
+ ${Array.isArray(value) ? value.join(`
3471
+ `) : value}`;
3472
+ });
3473
+ return string;
3474
+ };
3475
+
3208
3476
  const memoize = compute => {
3209
3477
  let memoized = false;
3210
3478
  let memoizedValue;
@@ -8106,7 +8374,7 @@ const createResolveUrlError = ({
8106
8374
  reason,
8107
8375
  ...details
8108
8376
  }) => {
8109
- const resolveError = new Error(createDetailedMessage$1(`Failed to resolve url reference`, {
8377
+ const resolveError = new Error(createDetailedMessage$2(`Failed to resolve url reference`, {
8110
8378
  reason,
8111
8379
  ...details,
8112
8380
  "specifier": `"${reference.specifier}"`,
@@ -8140,7 +8408,7 @@ const createFetchUrlContentError = ({
8140
8408
  reason,
8141
8409
  ...details
8142
8410
  }) => {
8143
- const fetchError = new Error(createDetailedMessage$1(`Failed to fetch url content`, {
8411
+ const fetchError = new Error(createDetailedMessage$2(`Failed to fetch url content`, {
8144
8412
  reason,
8145
8413
  ...details,
8146
8414
  "url": urlInfo.url,
@@ -8207,7 +8475,7 @@ const createTransformUrlContentError = ({
8207
8475
  reason,
8208
8476
  ...details
8209
8477
  }) => {
8210
- const transformError = new Error(createDetailedMessage$1(`"transformUrlContent" error on "${urlInfo.type}"`, {
8478
+ const transformError = new Error(createDetailedMessage$2(`"transformUrlContent" error on "${urlInfo.type}"`, {
8211
8479
  reason,
8212
8480
  ...details,
8213
8481
  "url": urlInfo.url,
@@ -8260,7 +8528,7 @@ const createFinalizeUrlContentError = ({
8260
8528
  urlInfo,
8261
8529
  error
8262
8530
  }) => {
8263
- const finalizeError = new Error(createDetailedMessage$1(`"finalizeUrlContent" error on "${urlInfo.type}"`, {
8531
+ const finalizeError = new Error(createDetailedMessage$2(`"finalizeUrlContent" error on "${urlInfo.type}"`, {
8264
8532
  ...detailsFromValueThrown(error),
8265
8533
  "url": urlInfo.url,
8266
8534
  "url reference trace": reference.trace.message,
@@ -8502,7 +8770,7 @@ const createKitchen = ({
8502
8770
  writeGeneratedFiles,
8503
8771
  outDirectoryUrl
8504
8772
  }) => {
8505
- const logger = createLogger({
8773
+ const logger = createLogger$1({
8506
8774
  logLevel
8507
8775
  });
8508
8776
  const kitchenContext = {
@@ -8762,7 +9030,7 @@ ${ANSI.color(normalizedReturnValue, ANSI.YELLOW)}
8762
9030
  try {
8763
9031
  const fetchUrlContentReturnValue = await pluginController.callAsyncHooksUntil("fetchUrlContent", urlInfo, contextDuringFetch);
8764
9032
  if (!fetchUrlContentReturnValue) {
8765
- logger.warn(createDetailedMessage$1(`no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`, {
9033
+ logger.warn(createDetailedMessage$2(`no plugin has handled url during "fetchUrlContent" hook -> url will be ignored`, {
8766
9034
  "url": urlInfo.url,
8767
9035
  "url reference trace": reference.trace.message
8768
9036
  }));
@@ -20501,7 +20769,7 @@ const build = async ({
20501
20769
  signal,
20502
20770
  logLevel
20503
20771
  }) => {
20504
- const logger = createLogger({
20772
+ const logger = createLogger$1({
20505
20773
  logLevel
20506
20774
  });
20507
20775
  const buildOperation = Abort.startOperation();
@@ -20772,7 +21040,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
20772
21040
  const rawUrl = buildDirectoryRedirections.get(url) || url;
20773
21041
  const rawUrlInfo = rawGraph.getUrlInfo(rawUrl);
20774
21042
  if (!rawUrlInfo) {
20775
- throw new Error(createDetailedMessage$1(`Cannot find url`, {
21043
+ throw new Error(createDetailedMessage$2(`Cannot find url`, {
20776
21044
  url,
20777
21045
  "raw urls": Array.from(buildDirectoryRedirections.values()),
20778
21046
  "build urls": Array.from(buildDirectoryRedirections.keys())
@@ -20836,7 +21104,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
20836
21104
  });
20837
21105
  const finalEntryUrls = [];
20838
21106
  {
20839
- const loadTask = createTaskLog("load", {
21107
+ const generateSourceGraph = createTaskLog("generate source graph", {
20840
21108
  disabled: logger.levels.debug || !logger.levels.info
20841
21109
  });
20842
21110
  try {
@@ -20862,10 +21130,10 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
20862
21130
  });
20863
21131
  await rawUrlGraphLoader.getAllLoadDonePromise(buildOperation);
20864
21132
  } catch (e) {
20865
- loadTask.fail();
21133
+ generateSourceGraph.fail();
20866
21134
  throw e;
20867
21135
  }
20868
- loadTask.done();
21136
+ generateSourceGraph.done();
20869
21137
  }
20870
21138
  {
20871
21139
  {
@@ -21050,7 +21318,7 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
21050
21318
  }, Promise.resolve());
21051
21319
  }
21052
21320
  {
21053
- const buildTask = createTaskLog("build", {
21321
+ const generateBuildGraph = createTaskLog("generate build graph", {
21054
21322
  disabled: logger.levels.debug || !logger.levels.info
21055
21323
  });
21056
21324
  try {
@@ -21074,10 +21342,10 @@ ${ANSI.color(buildUrl, ANSI.MAGENTA)}
21074
21342
  });
21075
21343
  await finalUrlGraphLoader.getAllLoadDonePromise(buildOperation);
21076
21344
  } catch (e) {
21077
- buildTask.fail();
21345
+ generateBuildGraph.fail();
21078
21346
  throw e;
21079
21347
  }
21080
- buildTask.done();
21348
+ generateBuildGraph.done();
21081
21349
  }
21082
21350
  }
21083
21351
  const versionMap = new Map();
@@ -22359,7 +22627,7 @@ const startDevServer = async ({
22359
22627
  // and mitigates https://github.com/actions/runner-images/issues/3885
22360
22628
  writeGeneratedFiles = !process.env.CI
22361
22629
  }) => {
22362
- const logger = createLogger({
22630
+ const logger = createLogger$1({
22363
22631
  logLevel
22364
22632
  });
22365
22633
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
@@ -22681,7 +22949,7 @@ const readNodeV8CoverageDirectory = async ({
22681
22949
  timeSpentTrying += 200;
22682
22950
  return tryReadJsonFile();
22683
22951
  }
22684
- console.warn(createDetailedMessage$1(`Error while reading coverage file`, {
22952
+ console.warn(createDetailedMessage$2(`Error while reading coverage file`, {
22685
22953
  "error stack": e.stack,
22686
22954
  "file": dirEntryUrl
22687
22955
  }));
@@ -22842,7 +23110,7 @@ const composeV8AndIstanbul = (v8FileByFileCoverage, istanbulFileByFileCoverage,
22842
23110
  const v8Coverage = v8FileByFileCoverage[key];
22843
23111
  if (v8Coverage) {
22844
23112
  if (coverageV8ConflictWarning) {
22845
- console.warn(createDetailedMessage$1(`Coverage conflict on "${key}", found two coverage that cannot be merged together: v8 and istanbul. The istanbul coverage will be ignored.`, {
23113
+ console.warn(createDetailedMessage$2(`Coverage conflict on "${key}", found two coverage that cannot be merged together: v8 and istanbul. The istanbul coverage will be ignored.`, {
22846
23114
  details: `This happens when a file is executed on a runtime using v8 coverage (node or chromium) and on runtime using istanbul coverage (firefox or webkit)`,
22847
23115
  suggestion: "You can disable this warning with coverageV8ConflictWarning: false"
22848
23116
  }));
@@ -23344,7 +23612,7 @@ const generateFileExecutionSteps = ({
23344
23612
  return;
23345
23613
  }
23346
23614
  if (typeof stepConfig !== "object") {
23347
- throw new TypeError(createDetailedMessage$1(`found unexpected value in plan, they must be object`, {
23615
+ throw new TypeError(createDetailedMessage$2(`found unexpected value in plan, they must be object`, {
23348
23616
  ["file relative path"]: fileRelativeUrl,
23349
23617
  ["execution name"]: executionName,
23350
23618
  ["value"]: stepConfig
@@ -23757,7 +24025,7 @@ const executePlan = async (plan, {
23757
24025
  }
23758
24026
  });
23759
24027
  });
23760
- logger.debug(createDetailedMessage$1(`Prepare executing plan`, {
24028
+ logger.debug(createDetailedMessage$2(`Prepare executing plan`, {
23761
24029
  runtimes: JSON.stringify(runtimes, null, " ")
23762
24030
  }));
23763
24031
  const multipleExecutionsOperation = Abort.startOperation();
@@ -23784,7 +24052,7 @@ const executePlan = async (plan, {
23784
24052
  await ensureEmptyDirectory(process.env.NODE_V8_COVERAGE);
23785
24053
  } else {
23786
24054
  coverageMethodForNodeJs = "Profiler";
23787
- logger.warn(createDetailedMessage$1(`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`, {
24055
+ logger.warn(createDetailedMessage$2(`process.env.NODE_V8_COVERAGE is required to generate coverage for Node.js subprocesses`, {
23788
24056
  "suggestion": `set process.env.NODE_V8_COVERAGE`,
23789
24057
  "suggestion 2": `use coverageMethodForNodeJs: "Profiler". But it means coverage for child_process and worker_thread cannot be collected`
23790
24058
  }));
@@ -24217,7 +24485,7 @@ const executeTestPlan = async ({
24217
24485
  coverageReportJsonFile = process.env.CI ? null : "./.coverage/coverage.json",
24218
24486
  coverageReportHtmlDirectory = process.env.CI ? "./.coverage/" : null
24219
24487
  }) => {
24220
- const logger = createLogger({
24488
+ const logger = createLogger$1({
24221
24489
  logLevel
24222
24490
  });
24223
24491
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
@@ -24249,7 +24517,7 @@ const executeTestPlan = async ({
24249
24517
  });
24250
24518
  if (patternsMatchingCoverAndExecute.length) {
24251
24519
  // It would be strange, for a given file to be both covered and executed
24252
- throw new Error(createDetailedMessage$1(`some file will be both covered and executed`, {
24520
+ throw new Error(createDetailedMessage$2(`some file will be both covered and executed`, {
24253
24521
  patterns: patternsMatchingCoverAndExecute
24254
24522
  }));
24255
24523
  }
@@ -24749,7 +25017,7 @@ const importPlaywright = async ({
24749
25017
  return namespace;
24750
25018
  } catch (e) {
24751
25019
  if (e.code === "ERR_MODULE_NOT_FOUND") {
24752
- throw new Error(createDetailedMessage$1(`"playwright" not found. You need playwright in your dependencies to use "${browserName}"`, {
25020
+ throw new Error(createDetailedMessage$2(`"playwright" not found. You need playwright in your dependencies to use "${browserName}"`, {
24753
25021
  suggestion: `npm install --save-dev playwright`
24754
25022
  }), {
24755
25023
  cause: e
@@ -24904,7 +25172,7 @@ const createChildExecOptions = async ({
24904
25172
  debugModeInheritBreak = true
24905
25173
  } = {}) => {
24906
25174
  if (typeof debugMode === "string" && AVAILABLE_DEBUG_MODE.indexOf(debugMode) === -1) {
24907
- throw new TypeError(createDetailedMessage$1(`unexpected debug mode.`, {
25175
+ throw new TypeError(createDetailedMessage$2(`unexpected debug mode.`, {
24908
25176
  ["debug mode"]: debugMode,
24909
25177
  ["allowed debug mode"]: AVAILABLE_DEBUG_MODE
24910
25178
  }));
@@ -25170,7 +25438,7 @@ nodeChildProcess.run = async ({
25170
25438
  stdio: ["pipe", "pipe", "pipe", "ipc"],
25171
25439
  env: envForChildProcess
25172
25440
  });
25173
- logger.debug(createDetailedMessage$1(`child process forked (pid ${childProcess.pid})`, {
25441
+ logger.debug(createDetailedMessage$2(`child process forked (pid ${childProcess.pid})`, {
25174
25442
  "execArgv": execArgv.join(`\n`),
25175
25443
  "custom env": JSON.stringify(env, null, " ")
25176
25444
  }));
@@ -25723,7 +25991,7 @@ const startBuildServer = async ({
25723
25991
  buildServerMainFile = getCallerPosition().url,
25724
25992
  cooldownBetweenFileEvents
25725
25993
  }) => {
25726
- const logger = createLogger({
25994
+ const logger = createLogger$1({
25727
25995
  logLevel
25728
25996
  });
25729
25997
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);
@@ -25921,7 +26189,7 @@ const execute = async ({
25921
26189
  runtimeParams,
25922
26190
  ignoreError = false
25923
26191
  }) => {
25924
- const logger = createLogger({
26192
+ const logger = createLogger$1({
25925
26193
  logLevel
25926
26194
  });
25927
26195
  rootDirectoryUrl = assertAndNormalizeDirectoryUrl(rootDirectoryUrl);