@cjser/iterm2-version__v5_0_0 5.0.0-cjser.2

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.
@@ -0,0 +1,53 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // packages/@cjser/iterm2-version__v5_0_0.tmp-26-1778155893122/index.js
30
+ var index_exports = {};
31
+ __export(index_exports, {
32
+ default: () => iterm2Version
33
+ });
34
+ module.exports = __toCommonJS(index_exports);
35
+ var import_node_path = __toESM(require("node:path"), 1);
36
+ var import_node_fs = __toESM(require("node:fs"), 1);
37
+ var import_app_path = __toESM(require("@cjser/app-path"), 1);
38
+ var import_plist = __toESM(require("plist"), 1);
39
+ var version;
40
+ function iterm2Version() {
41
+ if (process.platform !== "darwin") {
42
+ return;
43
+ }
44
+ if (!version) {
45
+ if (process.env.TERM_PROGRAM === "iTerm.app" && process.env.TERM_PROGRAM_VERSION) {
46
+ version = process.env.TERM_PROGRAM_VERSION;
47
+ } else {
48
+ const filePath = import_node_path.default.join(import_app_path.default.sync("iTerm"), "Contents/Info.plist");
49
+ version = import_plist.default.parse(import_node_fs.default.readFileSync(filePath, "utf8")).CFBundleVersion;
50
+ }
51
+ }
52
+ return version;
53
+ }
package/index.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ /**
2
+ Get the [iTerm2](https://www.iterm2.com) version.
3
+
4
+ @returns The iTerm2 version. If you're running this on a different terminal or operating system, it will return `undefined`.
5
+
6
+ @example
7
+ ```
8
+ import iterm2Version from '@cjser/iterm2-version__v5_0_0';
9
+
10
+ iterm2Version();
11
+ //=> '3.0.15'
12
+ ```
13
+ */
14
+ export default function iterm2Version(): string | undefined;
package/index.js ADDED
@@ -0,0 +1,23 @@
1
+ import path from 'node:path';
2
+ import fs from 'node:fs';
3
+ import appPath from '@cjser/app-path';
4
+ import plist from 'plist';
5
+
6
+ let version;
7
+
8
+ export default function iterm2Version() {
9
+ if (process.platform !== 'darwin') {
10
+ return;
11
+ }
12
+
13
+ if (!version) {
14
+ if (process.env.TERM_PROGRAM === 'iTerm.app' && process.env.TERM_PROGRAM_VERSION) {
15
+ version = process.env.TERM_PROGRAM_VERSION;
16
+ } else {
17
+ const filePath = path.join(appPath.sync('iTerm'), 'Contents/Info.plist');
18
+ version = plist.parse(fs.readFileSync(filePath, 'utf8')).CFBundleVersion;
19
+ }
20
+ }
21
+
22
+ return version;
23
+ }
package/license ADDED
@@ -0,0 +1,9 @@
1
+ MIT License
2
+
3
+ Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6
+
7
+ The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8
+
9
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "@cjser/iterm2-version__v5_0_0",
3
+ "version": "5.0.0-cjser.2",
4
+ "description": "Get the iTerm2 version",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://code.moenext.com/3rdeye/cjser.git"
9
+ },
10
+ "funding": "https://github.com/sponsors/sindresorhus",
11
+ "author": {
12
+ "name": "Sindre Sorhus",
13
+ "email": "sindresorhus@gmail.com",
14
+ "url": "https://sindresorhus.com"
15
+ },
16
+ "type": "module",
17
+ "exports": {
18
+ "require": "./dist-cjser/index.cjs",
19
+ "default": "./index.js"
20
+ },
21
+ "engines": {
22
+ "node": ">=12"
23
+ },
24
+ "scripts": {
25
+ "test": "xo && ava && tsd"
26
+ },
27
+ "files": [
28
+ "index.js",
29
+ "index.d.ts",
30
+ "dist-cjser"
31
+ ],
32
+ "keywords": [
33
+ "iterm2",
34
+ "iterm",
35
+ "terminal",
36
+ "app",
37
+ "version"
38
+ ],
39
+ "dependencies": {
40
+ "plist": "^3.0.2",
41
+ "@cjser/app-path": "4.0.0-cjser.2"
42
+ },
43
+ "devDependencies": {
44
+ "ava": "^3.15.0",
45
+ "tsd": "^0.14.0",
46
+ "xo": "^0.39.1"
47
+ },
48
+ "main": "./dist-cjser/index.cjs",
49
+ "cjser": {
50
+ "sourceVersion": "5.0.0",
51
+ "cjserVersion": 2,
52
+ "original": {
53
+ "name": "iterm2-version",
54
+ "version": "5.0.0",
55
+ "exports": "./index.js",
56
+ "repository": "sindresorhus/iterm2-version",
57
+ "dependencies": {
58
+ "app-path": "^4.0.0",
59
+ "plist": "^3.0.2"
60
+ },
61
+ "files": [
62
+ "index.js",
63
+ "index.d.ts"
64
+ ],
65
+ "scripts": {
66
+ "test": "xo && ava && tsd"
67
+ }
68
+ }
69
+ }
70
+ }
package/readme.md ADDED
@@ -0,0 +1,27 @@
1
+ # iterm2-version
2
+
3
+ > Get the [iTerm2](https://www.iterm2.com) version
4
+
5
+ Note: The `2` in iTerm2 is [part of the name](https://en.wikipedia.org/wiki/ITerm2) and does not indicate the version.
6
+
7
+ ## Install
8
+
9
+ ```
10
+ $ npm install iterm2-version
11
+ ```
12
+
13
+ ## Usage
14
+
15
+ ```js
16
+ import iterm2Version from 'iterm2-version';
17
+
18
+ iterm2Version();
19
+ //=> '3.0.15'
20
+ ```
21
+
22
+ If you're running this on a different terminal or operating system, it will return `undefined`.
23
+
24
+ ## cjser
25
+
26
+ This package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.
27
+ Original repository: https://github.com/sindresorhus/iterm2-version