@jsenv/core 38.4.9 → 38.4.10

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 (2) hide show
  1. package/dist/jsenv_core.js +44 -1
  2. package/package.json +1 -1
@@ -1,7 +1,6 @@
1
1
  import { readdir, chmod, stat, lstat, promises, writeFileSync as writeFileSync$1, mkdirSync, unlink, openSync, closeSync, rmdir, watch, readdirSync, statSync, createReadStream, readFile, existsSync, readFileSync, realpathSync } from "node:fs";
2
2
  import stringWidth from "string-width";
3
3
  import process$1 from "node:process";
4
- import { isBrowser } from "environment";
5
4
  import os, { networkInterfaces } from "node:os";
6
5
  import tty from "node:tty";
7
6
  import { pathToFileURL, fileURLToPath } from "node:url";
@@ -677,6 +676,50 @@ const error = (...args) => console.error(...args);
677
676
 
678
677
  const errorDisabled = () => {};
679
678
 
679
+ /* globals WorkerGlobalScope, DedicatedWorkerGlobalScope, SharedWorkerGlobalScope, ServiceWorkerGlobalScope */
680
+
681
+ const isBrowser = globalThis.window?.document !== undefined;
682
+
683
+ globalThis.process?.versions?.node !== undefined;
684
+
685
+ globalThis.process?.versions?.bun !== undefined;
686
+
687
+ globalThis.Deno?.version?.deno !== undefined;
688
+
689
+ globalThis.process?.versions?.electron !== undefined;
690
+
691
+ globalThis.navigator?.userAgent?.includes('jsdom') === true;
692
+
693
+ typeof WorkerGlobalScope !== 'undefined' && globalThis instanceof WorkerGlobalScope;
694
+
695
+ typeof DedicatedWorkerGlobalScope !== 'undefined' && globalThis instanceof DedicatedWorkerGlobalScope;
696
+
697
+ typeof SharedWorkerGlobalScope !== 'undefined' && globalThis instanceof SharedWorkerGlobalScope;
698
+
699
+ typeof ServiceWorkerGlobalScope !== 'undefined' && globalThis instanceof ServiceWorkerGlobalScope;
700
+
701
+ // Note: I'm intentionally not DRYing up the other variables to keep them "lazy".
702
+ const platform = globalThis.navigator?.userAgentData?.platform;
703
+
704
+ platform === 'macOS'
705
+ || globalThis.navigator?.platform === 'MacIntel' // Even on Apple silicon Macs.
706
+ || globalThis.navigator?.userAgent?.includes(' Mac ') === true
707
+ || globalThis.process?.platform === 'darwin';
708
+
709
+ platform === 'Windows'
710
+ || globalThis.navigator?.platform === 'Win32'
711
+ || globalThis.process?.platform === 'win32';
712
+
713
+ platform === 'Linux'
714
+ || globalThis.navigator?.platform?.startsWith('Linux') === true
715
+ || globalThis.navigator?.userAgent?.includes(' Linux ') === true
716
+ || globalThis.process?.platform === 'linux';
717
+
718
+ platform === 'Android'
719
+ || globalThis.navigator?.platform === 'Android'
720
+ || globalThis.navigator?.userAgent?.includes(' Android ') === true
721
+ || globalThis.process?.platform === 'android';
722
+
680
723
  const ESC = '\u001B[';
681
724
 
682
725
  !isBrowser && process$1.env.TERM_PROGRAM === 'Apple_Terminal';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jsenv/core",
3
- "version": "38.4.9",
3
+ "version": "38.4.10",
4
4
  "description": "Tool to develop, test and build js projects",
5
5
  "license": "MIT",
6
6
  "author": {