{"name":"@yarn-tool/fnm-detect","version":"1.0.9","keywords":["yarn-tool","fnm","fnm-detect","fast-node-manager","node-version-manager","environment-detection","multishell","node","nodejs","version-manager","yarn","npm","workspaces","monorepo"],"author":"","license":"ISC","_id":"@yarn-tool/fnm-detect@1.0.9","maintainers":[{"name":"bluelovers","email":"codelovers@users.sourceforge.net"}],"homepage":"https://github.com/bluelovers/ws-yarn-workspaces/tree/master/packages/@yarn-tool/fnm-detect#readme","bugs":{"url":"https://github.com/bluelovers/ws-yarn-workspaces/issues"},"dist":{"shasum":"8f7eefc072ad46a6c780582dd82db6d17fac336e","tarball":"http://registry-npm.ywwl.com/@yarn-tool/fnm-detect/download/@yarn-tool/fnm-detect-1.0.9.tgz","fileCount":6,"integrity":"sha512-9NNEFYot2HaBC5fq5IHEPrYfeEny3EB8k3Nu4W9pmZrgjsAtx6LPOLjWnV7p6Jy4ZHHHJpQlGDVm7LLpW6IkyQ==","signatures":[{"sig":"MEUCIQCVOGu4MKSZZA7xAbrSmS6SozufQMpeZfYk5Dpg+5c7agIgPP893bHgZTeH7dbv7IIr3/5Qu7MX3+1IUV6KuEpdG8g=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCOXpY5INoHe9Y5NSPfOqpWxtTdvhxxfFaq9YaE6MZRMgIhANCNYm0y7tv26885iAOdBE/7ebURtG34kXHKD9iaD8Aj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":115167,"size":32181,"noattachment":false,"key":"/@yarn-tool/fnm-detect/-/@yarn-tool/fnm-detect-1.0.9.tgz"},"main":"index.js","type":"commonjs","types":"./index.d.ts","gitHead":"471c63ee11851f0ac3487f23d1c472936f99b460","scripts":{"lint":"pnpm run lint:eslint","pack":"echo pack","test":"node --run test:node","review":"pnpm run review:coverage","prepack":"echo prepack","pretest":"echo pretest","publish":"echo publish","tsc:esm":"tsc -p tsconfig.esm.json","version":"echo version","ci:build":"echo ci:build","coverage":"pnpm run test -- --coverage","postpack":"echo postpack","test:tsc":"tsc --noEmit & echo typescript check done","test:tsd":"ynpx tsd","test:jest":"jest --passWithNoTests","test:node":"tsx --test --test-update-snapshots **/*.node-spec.ts **/*.node-test.ts **/*.spec.ts **/*.test.ts","test:tsdx":"ynpx @bluelovers/tsdx test --passWithNoTests","build:tsdx":"ynpx @bluelovers/tsdx build --target node --name index","ci:install":"echo ci:install","prepublish":"echo prepublish","preversion":"echo preversion && pnpm run test","test:mocha":"ynpx --quiet -p ts-node -p mocha mocha -- --require ts-node/register \"!(node_modules)/**/*.{test,spec}.{ts,tsx}\"","lint:eslint":"ynpx eslint --ext .ts,.tsx,.mts,.cts ./","postpublish":"echo postpublish","postversion":"echo postversion","review:test":"pnpm run lint && pnpm run test","tsc:default":"tsc -p tsconfig.json","build:dts:tsc":"pnpm run build:dts:tsc:emit && pnpm run build:dts:copy","test:snapshot":"pnpm run test -u","build:dts:copy":"copy .\\src\\index.d.ts .\\dist\\index.d.ts & echo build:dts","prepublishOnly":"echo prepublishOnly","tsc:showConfig":"ynpx get-current-tsconfig -p","postpublishOnly":"echo postpublishOnly","review:coverage":"pnpm run lint && pnpm run coverage","build:dts:bundle":"ynpx @bluelovers/dts-bundle-generator -o ./dist/index.d.ts ./src/index.ts --no-banner --inline-declare-global & echo build:dts:bundle","build:microbundle":"ynpx microbundle --target node","sort-package-json":"yarn-tool sort","build:dts:tsc:emit":"tsc --emitDeclarationOnly --declaration --noEmit false","test:jest:coverage":"pnpm run test:jest -- --coverage","test:jest:snapshot":"pnpm run test:jest -- -u"},"_npmUser":{"name":"bluelovers","email":"codelovers@users.sourceforge.net"},"repository":{"url":"git+https://github.com/bluelovers/ws-yarn-workspaces.git","type":"git","directory":"packages/@yarn-tool/fnm-detect"},"_npmVersion":"lerna/7.4.2/node@v26.7.0+x64 (win32)","description":"fnm (Fast Node Manager) 環境偵測模組 / A module for detecting whether the current Node.js process is running within an fnm-managed environment","directories":{},"sideEffects":false,"_nodeVersion":"26.7.0","dependencies":{"tslib":">=2.8.1","upath2":"^3.1.25","ts-type":"^3.0.18","fs-extra":"^11.4.1","sort-object-keys2":"^3.0.10"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/fnm-detect_1.0.9_1791819135267_0.7132711121073663","host":"s3://npm-registry-packages-npm-production"},"readme":"# @yarn-tool/fnm-detect\n\nfnm (Fast Node Manager) 環境偵測模組，用於偵測當前 Node.js 程序是否在 fnm 管理的環境中執行。\nA module for detecting whether the current Node.js process is running within an fnm-managed environment.\n\n## 功能 (Features)\n\n- 透過 Node.js 執行檔路徑 (execPath) 偵測 fnm 環境 / Detect fnm environment via Node.js execPath\n- 透過環境變數 (Environment variables) `FNM_DIR`、`FNM_MULTISHELL_PATH` 偵測 fnm 環境\n- 結合兩種偵測方式並回傳偵測來源 (Detection source) / Combine both methods and report where detection came from\n- 解析 fnm 路徑類型 (Path type)：`fnm_multishells`、`aliases`、`node-versions`\n- 提供便利函式 (Convenience function) `isFNM()` 快速取得布林值結果\n\n## 安裝 (Installation)\n\n```bash\n# 使用 yarn / Using yarn\nyarn add @yarn-tool/fnm-detect\n\n# 使用 yarn-tool / Using yarn-tool\nyarn-tool add @yarn-tool/fnm-detect\n# yt 是 yarn-tool 的別名 / yt is an alias for yarn-tool\nyt add @yarn-tool/fnm-detect\n\n# 使用 pnpm / Using pnpm\npnpm add @yarn-tool/fnm-detect\n\n# 使用 npm / Using npm\nnpm install @yarn-tool/fnm-detect\n```\n\n## 用法 (Usage)\n\n```typescript\nimport {\n  detectFnmByExecPath,\n  detectFnmByEnv,\n  detectFnmByAll,\n  isFNM\n} from '@yarn-tool/fnm-detect';\n\n// 簡單檢查是否在 fnm 環境中 / Simple check for fnm environment\nif (isFNM()) {\n  console.log('Running under fnm');\n}\n\n// 透過 execPath 偵測 / Detect via execPath\nconst result = detectFnmByExecPath();\nconsole.log(result);\n// {\n//   isFnm: true,\n//   detectedBy: 'execpath',\n//   fnmPathType: 'fnm_multishells',\n//   fnmPath: 'C:/Users/User/AppData/Local/fnm_multishells/20128_1771488837711',\n//   fnmPathReal: 'C:/Users/User/AppData/Roaming/fnm/node-versions/v24.13.1/installation',\n//   fnmDir: 'C:/Users/User/AppData/Roaming/fnm',\n//   multishellKey: '20128_1771488837711',\n//   version: 'v24.13.1',\n//   ...\n// }\n\n// 透過環境變數偵測 / Detect via environment variables\nconst envResult = detectFnmByEnv(process.env);\n\n// 結合兩種偵測方式 / Combine both detection methods\nconst allResult = detectFnmByAll();\nconsole.log(allResult.detectedBy); // ['execpath', 'env'] 或 ['execpath'] 或 ['env'] 或 []\n```\n\n## API 文件 (API Documentation)\n\n### `detectFnmByExecPath(execPath?, nodeVersion?)`\n\n透過 Node.js 執行檔路徑偵測 fnm 環境。\n\n### `detectFnmByEnv(env?, nodeVersion?)`\n\n透過環境變數 (FNM_DIR, FNM_MULTISHELL_PATH) 偵測 fnm 環境。\n\n### `detectFnmByAll(pc?)`\n\n同時使用 execPath 與環境變數兩種方式偵測。\n\n### `isFNM()`\n\n簡單檢查當前程序是否在 fnm 下執行，返回布林值。\n\n### `detectFnmPathType(fnmPath, inDeep?)`\n\n分析 fnm 路徑類型 (fnm_multishells, aliases, node-versions)。\n\n## 回傳結果類型 (Result Types)\n\n### IDetectFnmByResult\n\n| 屬性 | 說明 / Description |\n|------|-------------------|\n| `isFnm` | 是否偵測到 fnm 環境 / Whether fnm is detected |\n| `detectedBy` | 偵測來源 (execpath/env) / Detection source |\n| `fnmPathType` | 路徑類型 / Path type |\n| `fnmPath` | fnm 路徑 / fnm path |\n| `fnmPathReal` | 真實路徑（解析符號連結後）/ Real path after resolving symlinks |\n| `fnmDir` | fnm 主目錄 / fnm main directory |\n| `multishellPath` | Multishell 路徑 / Multishell path |\n| `multishellKey` | Multishell 鍵值 / Multishell key |\n| `version` | Node.js 版本 / Node.js version |\n| `installationPath` | 安裝路徑 / Installation path |\n| `aliasesDefaultPath` | 預設別名路徑 / Default alias path |\n\n## 組態設定 (Configuration)\n\n本套件不需額外設定檔，偵測行為由傳入參數與 fnm 所設定的環境變數 (Environment variables) 決定：\n\n| 設定來源 (Source) | 預設值 (Default) | 說明 (Description) |\n| --- | --- | --- |\n| `execPath` | `process.execPath` | 用於 execPath 偵測的 Node.js 執行檔路徑 / Node.js executable path used by execPath detection |\n| `env` | `process.env` | 環境變數來源，需可讀取 `FNM_DIR` 與 `FNM_MULTISHELL_PATH` / Environment variable source; must expose `FNM_DIR` and `FNM_MULTISHELL_PATH` |\n| `nodeVersion` / `version` | `process.version` | 用於推算 `node-versions/{version}/installation` 安裝路徑的 Node.js 版本 / Node.js version used to derive the `node-versions/{version}/installation` path |\n\nfnm 本身設定的環境變數 (Environment variables set by fnm)：\n\n- `FNM_DIR`：fnm 主目錄 (Main fnm directory)，存放 node 版本與別名 / stores node versions and aliases\n- `FNM_MULTISHELL_PATH`：當前 shell 工作階段的 multishell 臨時符號連結目錄 (Temporary symlink directory of the current shell session)\n\n## License\n\nISC","publish_time":1791819135353,"_cnpm_publish_time":1791819135353,"dist-tags":{"latest":"1.0.15"}}