@stryke/fs 0.33.83 → 0.33.84
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/CHANGELOG.md +6 -0
- package/dist/_virtual/_rolldown/runtime.cjs +0 -14
- package/dist/buffer.cjs +0 -12
- package/dist/buffer.mjs +1 -8
- package/dist/buffer.mjs.map +1 -1
- package/dist/chmod-x.cjs +0 -14
- package/dist/chmod-x.mjs +1 -10
- package/dist/chmod-x.mjs.map +1 -1
- package/dist/command-exists.cjs +1 -11
- package/dist/command-exists.mjs +1 -6
- package/dist/command-exists.mjs.map +1 -1
- package/dist/compress.cjs +1 -8
- package/dist/compress.mjs +1 -3
- package/dist/compress.mjs.map +1 -1
- package/dist/constants.cjs +0 -13
- package/dist/constants.mjs +1 -8
- package/dist/copy-file.cjs +1 -13
- package/dist/copy-file.mjs +1 -8
- package/dist/copy-file.mjs.map +1 -1
- package/dist/exists.cjs +1 -11
- package/dist/exists.mjs +1 -6
- package/dist/exists.mjs.map +1 -1
- package/dist/get-parent-path.cjs +1 -8
- package/dist/get-parent-path.mjs +1 -3
- package/dist/get-parent-path.mjs.map +1 -1
- package/dist/get-workspace-root.cjs +0 -16
- package/dist/get-workspace-root.mjs +1 -12
- package/dist/get-workspace-root.mjs.map +1 -1
- package/dist/helpers.cjs +0 -14
- package/dist/helpers.mjs +1 -10
- package/dist/helpers.mjs.map +1 -1
- package/dist/index.cjs +0 -111
- package/dist/index.mjs +1 -107
- package/dist/install.cjs +0 -10
- package/dist/install.mjs +1 -6
- package/dist/install.mjs.map +1 -1
- package/dist/is-file.cjs +1 -13
- package/dist/is-file.mjs +1 -8
- package/dist/is-file.mjs.map +1 -1
- package/dist/json.cjs +0 -12
- package/dist/json.mjs +1 -8
- package/dist/json.mjs.map +1 -1
- package/dist/list-files.cjs +1 -15
- package/dist/list-files.mjs +1 -10
- package/dist/list-files.mjs.map +1 -1
- package/dist/package-fns.cjs +1 -16
- package/dist/package-fns.mjs +1 -11
- package/dist/package-fns.mjs.map +1 -1
- package/dist/read-file.cjs +1 -13
- package/dist/read-file.mjs +1 -8
- package/dist/read-file.mjs.map +1 -1
- package/dist/registry.cjs +0 -13
- package/dist/registry.mjs +1 -9
- package/dist/registry.mjs.map +1 -1
- package/dist/remove-file.cjs +1 -11
- package/dist/remove-file.mjs +1 -6
- package/dist/remove-file.mjs.map +1 -1
- package/dist/resolve.cjs +1 -20
- package/dist/resolve.mjs +1 -15
- package/dist/resolve.mjs.map +1 -1
- package/dist/semver-fns.cjs +1 -20
- package/dist/semver-fns.mjs +1 -15
- package/dist/semver-fns.mjs.map +1 -1
- package/dist/toml.cjs +0 -12
- package/dist/toml.mjs +1 -8
- package/dist/toml.mjs.map +1 -1
- package/dist/tsconfig.cjs +1 -8
- package/dist/tsconfig.mjs +1 -3
- package/dist/tsconfig.mjs.map +1 -1
- package/dist/write-file.cjs +1 -11
- package/dist/write-file.mjs +1 -6
- package/dist/write-file.mjs.map +1 -1
- package/dist/yaml.cjs +1 -11
- package/dist/yaml.mjs +1 -6
- package/dist/yaml.mjs.map +1 -1
- package/package.json +9 -109
- package/dist/_virtual/_rolldown/runtime.mjs +0 -18
- package/dist/buffer.test.cjs +0 -13
- package/dist/buffer.test.d.cts +0 -1
- package/dist/buffer.test.d.mts +0 -1
- package/dist/buffer.test.mjs +0 -14
- package/dist/buffer.test.mjs.map +0 -1
- package/dist/chmod-x.test.cjs +0 -13
- package/dist/chmod-x.test.d.cts +0 -1
- package/dist/chmod-x.test.d.mts +0 -1
- package/dist/chmod-x.test.mjs +0 -14
- package/dist/chmod-x.test.mjs.map +0 -1
- package/dist/command-exists.test.cjs +0 -13
- package/dist/command-exists.test.d.cts +0 -1
- package/dist/command-exists.test.d.mts +0 -1
- package/dist/command-exists.test.mjs +0 -14
- package/dist/command-exists.test.mjs.map +0 -1
- package/dist/compress.test.cjs +0 -13
- package/dist/compress.test.d.cts +0 -1
- package/dist/compress.test.d.mts +0 -1
- package/dist/compress.test.mjs +0 -14
- package/dist/compress.test.mjs.map +0 -1
- package/dist/constants.mjs.map +0 -1
- package/dist/constants.test.cjs +0 -13
- package/dist/constants.test.d.cts +0 -1
- package/dist/constants.test.d.mts +0 -1
- package/dist/constants.test.mjs +0 -14
- package/dist/constants.test.mjs.map +0 -1
- package/dist/copy-file.test.cjs +0 -13
- package/dist/copy-file.test.d.cts +0 -1
- package/dist/copy-file.test.d.mts +0 -1
- package/dist/copy-file.test.mjs +0 -14
- package/dist/copy-file.test.mjs.map +0 -1
- package/dist/exists.test.cjs +0 -13
- package/dist/exists.test.d.cts +0 -1
- package/dist/exists.test.d.mts +0 -1
- package/dist/exists.test.mjs +0 -14
- package/dist/exists.test.mjs.map +0 -1
- package/dist/get-parent-path.test.cjs +0 -13
- package/dist/get-parent-path.test.d.cts +0 -1
- package/dist/get-parent-path.test.d.mts +0 -1
- package/dist/get-parent-path.test.mjs +0 -14
- package/dist/get-parent-path.test.mjs.map +0 -1
- package/dist/get-workspace-root.test.cjs +0 -13
- package/dist/get-workspace-root.test.d.cts +0 -1
- package/dist/get-workspace-root.test.d.mts +0 -1
- package/dist/get-workspace-root.test.mjs +0 -14
- package/dist/get-workspace-root.test.mjs.map +0 -1
- package/dist/helpers.test.cjs +0 -13
- package/dist/helpers.test.d.cts +0 -1
- package/dist/helpers.test.d.mts +0 -1
- package/dist/helpers.test.mjs +0 -14
- package/dist/helpers.test.mjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/index.test.cjs +0 -13
- package/dist/index.test.d.cts +0 -1
- package/dist/index.test.d.mts +0 -1
- package/dist/index.test.mjs +0 -14
- package/dist/index.test.mjs.map +0 -1
- package/dist/install.test.cjs +0 -13
- package/dist/install.test.d.cts +0 -1
- package/dist/install.test.d.mts +0 -1
- package/dist/install.test.mjs +0 -14
- package/dist/install.test.mjs.map +0 -1
- package/dist/is-file.test.cjs +0 -13
- package/dist/is-file.test.d.cts +0 -1
- package/dist/is-file.test.d.mts +0 -1
- package/dist/is-file.test.mjs +0 -14
- package/dist/is-file.test.mjs.map +0 -1
- package/dist/json.test.cjs +0 -13
- package/dist/json.test.d.cts +0 -1
- package/dist/json.test.d.mts +0 -1
- package/dist/json.test.mjs +0 -14
- package/dist/json.test.mjs.map +0 -1
- package/dist/list-files.test.cjs +0 -13
- package/dist/list-files.test.d.cts +0 -1
- package/dist/list-files.test.d.mts +0 -1
- package/dist/list-files.test.mjs +0 -14
- package/dist/list-files.test.mjs.map +0 -1
- package/dist/package-fns.test.cjs +0 -13
- package/dist/package-fns.test.d.cts +0 -1
- package/dist/package-fns.test.d.mts +0 -1
- package/dist/package-fns.test.mjs +0 -14
- package/dist/package-fns.test.mjs.map +0 -1
- package/dist/read-file.test.cjs +0 -13
- package/dist/read-file.test.d.cts +0 -1
- package/dist/read-file.test.d.mts +0 -1
- package/dist/read-file.test.mjs +0 -14
- package/dist/read-file.test.mjs.map +0 -1
- package/dist/registry.test.cjs +0 -13
- package/dist/registry.test.d.cts +0 -1
- package/dist/registry.test.d.mts +0 -1
- package/dist/registry.test.mjs +0 -14
- package/dist/registry.test.mjs.map +0 -1
- package/dist/remove-file.test.cjs +0 -13
- package/dist/remove-file.test.d.cts +0 -1
- package/dist/remove-file.test.d.mts +0 -1
- package/dist/remove-file.test.mjs +0 -14
- package/dist/remove-file.test.mjs.map +0 -1
- package/dist/resolve.test.cjs +0 -13
- package/dist/resolve.test.d.cts +0 -1
- package/dist/resolve.test.d.mts +0 -1
- package/dist/resolve.test.mjs +0 -14
- package/dist/resolve.test.mjs.map +0 -1
- package/dist/semver-fns.test.cjs +0 -13
- package/dist/semver-fns.test.d.cts +0 -1
- package/dist/semver-fns.test.d.mts +0 -1
- package/dist/semver-fns.test.mjs +0 -14
- package/dist/semver-fns.test.mjs.map +0 -1
- package/dist/toml.test.cjs +0 -13
- package/dist/toml.test.d.cts +0 -1
- package/dist/toml.test.d.mts +0 -1
- package/dist/toml.test.mjs +0 -14
- package/dist/toml.test.mjs.map +0 -1
- package/dist/tsconfig.test.cjs +0 -13
- package/dist/tsconfig.test.d.cts +0 -1
- package/dist/tsconfig.test.d.mts +0 -1
- package/dist/tsconfig.test.mjs +0 -14
- package/dist/tsconfig.test.mjs.map +0 -1
- package/dist/write-file.test.cjs +0 -13
- package/dist/write-file.test.d.cts +0 -1
- package/dist/write-file.test.d.mts +0 -1
- package/dist/write-file.test.mjs +0 -14
- package/dist/write-file.test.mjs.map +0 -1
- package/dist/yaml.test.cjs +0 -13
- package/dist/yaml.test.d.cts +0 -1
- package/dist/yaml.test.d.mts +0 -1
- package/dist/yaml.test.mjs +0 -14
- package/dist/yaml.test.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-workspace-root.mjs","names":[],"sources":["../src/get-workspace-root.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { findWorkspaceRootSafe } from \"@storm-software/config-tools\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { isSystemRoot } from \"@stryke/path/is-root-dir\";\nimport { getParentPath } from \"./get-parent-path\";\n\nexport const WORKSPACE_ROOT_CONTENT: string[] = [\n \".all-contributorsrc\",\n \".commitlintrc\",\n \".github\",\n \".git\",\n \".husky\",\n \".huskyrc\",\n \".lintstagedrc\",\n \".log4brains.yml\",\n \".npmrc\",\n \".nx\",\n \".storm-workspace.js\",\n \".storm-workspace.json\",\n \".storm-workspace.ts\",\n \".storm-workspace.yaml\",\n \".storm-workspace.yml\",\n \".vscode\",\n \".whitesource\",\n \"bun.lock\",\n \"bun.lockb\",\n \"lefthook.yaml\",\n \"lefthook.yml\",\n \"lerna.json\",\n \"npm-lock.json\",\n \"npm-lock.yaml\",\n \"npm-lock.yml\",\n \"npm-workspace.json\",\n \"npm-workspace.yaml\",\n \"npm-workspace.yml\",\n \"nx.json\",\n \"package-lock.json\",\n \"patches\",\n \"pnpm-lock.json\",\n \"pnpm-lock.yaml\",\n \"pnpm-lock.yml\",\n \"pnpm-workspace.json\",\n \"pnpm-workspace.yaml\",\n \"pnpm-workspace.yml\",\n \"socket.yaml\",\n \"storm-workspace.js\",\n \"storm-workspace.json\",\n \"storm-workspace.ts\",\n \"storm-workspace.yaml\",\n \"storm-workspace.yml\",\n \"syncpack.config.js\",\n \"syncpack.json\",\n \"turbo.json\",\n \"yarn-lock.json\",\n \"yarn-lock.yaml\",\n \"yarn-lock.yml\",\n \"yarn-workspace.json\",\n \"yarn-workspace.yaml\",\n \"yarn-workspace.yml\",\n \"yarn.lock\"\n] as const;\n\nexport const PROJECT_ROOT_CONTENT: string[] = [\n \".powerlines\",\n \".storm\",\n \"package.json\",\n \"powerlines.json\",\n \"powerlines.yaml\",\n \"powerlines.yml\",\n \"powerlines.toml\",\n \"powerlines.config.js\",\n \"powerlines.config.ts\",\n \"project.json\"\n] as const;\n\n/**\n * Get the workspace root path\n *\n * @param dir - A directory to start the search from\n * @returns The workspace root path\n */\nexport function getWorkspaceRoot(dir = cwd()) {\n if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {\n return (process.env.STORM_WORKSPACE_ROOT ||\n process.env.NX_WORKSPACE_ROOT_PATH)!;\n }\n\n const root = findWorkspaceRootSafe(dir);\n if (root) {\n return root;\n }\n\n let result = getParentPath(WORKSPACE_ROOT_CONTENT, dir);\n if (result) {\n return result;\n }\n\n result = dir;\n while (result && !isSystemRoot(result)) {\n result = getParentPath(\"storm-workspace.json\", result, {\n skipCwd: true,\n includeNameInResults: false\n });\n if (result) {\n return result;\n }\n }\n\n return dir;\n}\n\n/**\n * Check if the given directory is the workspace root\n *\n * @param dir - A directory to check\n * @returns True if the directory is the workspace root, false otherwise\n */\nexport function isWorkspaceRoot(dir = cwd()): boolean {\n const workspaceRoot = getWorkspaceRoot(dir);\n if (workspaceRoot) {\n return workspaceRoot === dir;\n }\n\n return false;\n}\n\n/**\n * Get the project root path\n *\n * @param dir - A directory to start the search from\n * @returns The project root path\n */\nexport function getProjectRoot(dir = cwd()) {\n const result = getParentPath(PROJECT_ROOT_CONTENT, dir);\n\n if (result) {\n return result;\n }\n\n return dir;\n}\n\n/**\n * Check if the given directory is the project root\n *\n * @param dir - A directory to check\n * @returns True if the directory is the project root, false otherwise\n */\nexport function isProjectRoot(dir = cwd()): boolean {\n const projectRoot = getProjectRoot(dir);\n if (projectRoot) {\n return projectRoot === dir;\n }\n\n return false;\n}\n\n/**\n * Find the file path relative to the workspace root path.\n *\n * @param filePath - The file path to process\n * @returns The file path relative to the workspace root\n */\nexport function relativeToWorkspaceRoot(filePath: string) {\n return relativePath(filePath, getWorkspaceRoot());\n}\n\n/**\n * Find the file path relative to the project root path.\n *\n * @param filePath - The file path to process\n * @returns The file path relative to the project root\n */\nexport function relativeToProjectRoot(filePath: string) {\n return relativePath(filePath, getProjectRoot());\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-workspace-root.mjs","names":[],"sources":["../src/get-workspace-root.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { findWorkspaceRootSafe } from \"@storm-software/config-tools\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport { relativePath } from \"@stryke/path/file-path-fns\";\nimport { isSystemRoot } from \"@stryke/path/is-root-dir\";\nimport { getParentPath } from \"./get-parent-path\";\n\nexport const WORKSPACE_ROOT_CONTENT: string[] = [\n \".all-contributorsrc\",\n \".commitlintrc\",\n \".github\",\n \".git\",\n \".husky\",\n \".huskyrc\",\n \".lintstagedrc\",\n \".log4brains.yml\",\n \".npmrc\",\n \".nx\",\n \".storm-workspace.js\",\n \".storm-workspace.json\",\n \".storm-workspace.ts\",\n \".storm-workspace.yaml\",\n \".storm-workspace.yml\",\n \".vscode\",\n \".whitesource\",\n \"bun.lock\",\n \"bun.lockb\",\n \"lefthook.yaml\",\n \"lefthook.yml\",\n \"lerna.json\",\n \"npm-lock.json\",\n \"npm-lock.yaml\",\n \"npm-lock.yml\",\n \"npm-workspace.json\",\n \"npm-workspace.yaml\",\n \"npm-workspace.yml\",\n \"nx.json\",\n \"package-lock.json\",\n \"patches\",\n \"pnpm-lock.json\",\n \"pnpm-lock.yaml\",\n \"pnpm-lock.yml\",\n \"pnpm-workspace.json\",\n \"pnpm-workspace.yaml\",\n \"pnpm-workspace.yml\",\n \"socket.yaml\",\n \"storm-workspace.js\",\n \"storm-workspace.json\",\n \"storm-workspace.ts\",\n \"storm-workspace.yaml\",\n \"storm-workspace.yml\",\n \"syncpack.config.js\",\n \"syncpack.json\",\n \"turbo.json\",\n \"yarn-lock.json\",\n \"yarn-lock.yaml\",\n \"yarn-lock.yml\",\n \"yarn-workspace.json\",\n \"yarn-workspace.yaml\",\n \"yarn-workspace.yml\",\n \"yarn.lock\"\n] as const;\n\nexport const PROJECT_ROOT_CONTENT: string[] = [\n \".powerlines\",\n \".storm\",\n \"package.json\",\n \"powerlines.json\",\n \"powerlines.yaml\",\n \"powerlines.yml\",\n \"powerlines.toml\",\n \"powerlines.config.js\",\n \"powerlines.config.ts\",\n \"project.json\"\n] as const;\n\n/**\n * Get the workspace root path\n *\n * @param dir - A directory to start the search from\n * @returns The workspace root path\n */\nexport function getWorkspaceRoot(dir = cwd()) {\n if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {\n return (process.env.STORM_WORKSPACE_ROOT ||\n process.env.NX_WORKSPACE_ROOT_PATH)!;\n }\n\n const root = findWorkspaceRootSafe(dir);\n if (root) {\n return root;\n }\n\n let result = getParentPath(WORKSPACE_ROOT_CONTENT, dir);\n if (result) {\n return result;\n }\n\n result = dir;\n while (result && !isSystemRoot(result)) {\n result = getParentPath(\"storm-workspace.json\", result, {\n skipCwd: true,\n includeNameInResults: false\n });\n if (result) {\n return result;\n }\n }\n\n return dir;\n}\n\n/**\n * Check if the given directory is the workspace root\n *\n * @param dir - A directory to check\n * @returns True if the directory is the workspace root, false otherwise\n */\nexport function isWorkspaceRoot(dir = cwd()): boolean {\n const workspaceRoot = getWorkspaceRoot(dir);\n if (workspaceRoot) {\n return workspaceRoot === dir;\n }\n\n return false;\n}\n\n/**\n * Get the project root path\n *\n * @param dir - A directory to start the search from\n * @returns The project root path\n */\nexport function getProjectRoot(dir = cwd()) {\n const result = getParentPath(PROJECT_ROOT_CONTENT, dir);\n\n if (result) {\n return result;\n }\n\n return dir;\n}\n\n/**\n * Check if the given directory is the project root\n *\n * @param dir - A directory to check\n * @returns True if the directory is the project root, false otherwise\n */\nexport function isProjectRoot(dir = cwd()): boolean {\n const projectRoot = getProjectRoot(dir);\n if (projectRoot) {\n return projectRoot === dir;\n }\n\n return false;\n}\n\n/**\n * Find the file path relative to the workspace root path.\n *\n * @param filePath - The file path to process\n * @returns The file path relative to the workspace root\n */\nexport function relativeToWorkspaceRoot(filePath: string) {\n return relativePath(filePath, getWorkspaceRoot());\n}\n\n/**\n * Find the file path relative to the project root path.\n *\n * @param filePath - The file path to process\n * @returns The file path relative to the project root\n */\nexport function relativeToProjectRoot(filePath: string) {\n return relativePath(filePath, getProjectRoot());\n}\n"],"mappings":";;;;;;;AAwBA,MAAa,yBAAmC;CAC9C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;AAED,MAAa,uBAAiC;CAC5C;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;;;;AAQD,SAAgB,iBAAiB,MAAM,KAAK,EAAE;AAC5C,KAAI,QAAQ,IAAI,wBAAwB,QAAQ,IAAI,uBAClD,QAAQ,QAAQ,IAAI,wBAClB,QAAQ,IAAI;CAGhB,MAAM,OAAO,sBAAsB,IAAI;AACvC,KAAI,KACF,QAAO;CAGT,IAAI,SAAS,cAAc,wBAAwB,IAAI;AACvD,KAAI,OACF,QAAO;AAGT,UAAS;AACT,QAAO,UAAU,CAAC,aAAa,OAAO,EAAE;AACtC,WAAS,cAAc,wBAAwB,QAAQ;GACrD,SAAS;GACT,sBAAsB;GACvB,CAAC;AACF,MAAI,OACF,QAAO;;AAIX,QAAO;;;;;;;;AAST,SAAgB,gBAAgB,MAAM,KAAK,EAAW;CACpD,MAAM,gBAAgB,iBAAiB,IAAI;AAC3C,KAAI,cACF,QAAO,kBAAkB;AAG3B,QAAO;;;;;;;;AAST,SAAgB,eAAe,MAAM,KAAK,EAAE;CAC1C,MAAM,SAAS,cAAc,sBAAsB,IAAI;AAEvD,KAAI,OACF,QAAO;AAGT,QAAO;;;;;;;;AAST,SAAgB,cAAc,MAAM,KAAK,EAAW;CAClD,MAAM,cAAc,eAAe,IAAI;AACvC,KAAI,YACF,QAAO,gBAAgB;AAGzB,QAAO;;;;;;;;AAST,SAAgB,wBAAwB,UAAkB;AACxD,QAAO,aAAa,UAAU,kBAAkB,CAAC;;;;;;;;AASnD,SAAgB,sBAAsB,UAAkB;AACtD,QAAO,aAAa,UAAU,gBAAgB,CAAC"}
|
package/dist/helpers.cjs
CHANGED
|
@@ -6,14 +6,6 @@ let node_fs_promises = require("node:fs/promises");
|
|
|
6
6
|
let nanotar = require("nanotar");
|
|
7
7
|
|
|
8
8
|
//#region src/helpers.ts
|
|
9
|
-
var helpers_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
10
|
-
createDirectory: () => createDirectory,
|
|
11
|
-
createDirectorySync: () => createDirectorySync,
|
|
12
|
-
extractFileFromTar: () => extractFileFromTar,
|
|
13
|
-
extractFileFromTarGzip: () => extractFileFromTarGzip,
|
|
14
|
-
removeDirectory: () => removeDirectory,
|
|
15
|
-
removeDirectorySync: () => removeDirectorySync
|
|
16
|
-
});
|
|
17
9
|
/**
|
|
18
10
|
* Create a directory if it does not exist.
|
|
19
11
|
*
|
|
@@ -88,11 +80,5 @@ exports.createDirectory = createDirectory;
|
|
|
88
80
|
exports.createDirectorySync = createDirectorySync;
|
|
89
81
|
exports.extractFileFromTar = extractFileFromTar;
|
|
90
82
|
exports.extractFileFromTarGzip = extractFileFromTarGzip;
|
|
91
|
-
Object.defineProperty(exports, 'helpers_exports', {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function () {
|
|
94
|
-
return helpers_exports;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
83
|
exports.removeDirectory = removeDirectory;
|
|
98
84
|
exports.removeDirectorySync = removeDirectorySync;
|
package/dist/helpers.mjs
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { exists, existsSync as existsSync$1 } from "./exists.mjs";
|
|
3
2
|
import { createWriteStream, mkdirSync, rmSync } from "node:fs";
|
|
4
3
|
import { mkdir, readFile, rm } from "node:fs/promises";
|
|
5
4
|
import { parseTar, parseTarGzip } from "nanotar";
|
|
6
5
|
|
|
7
6
|
//#region src/helpers.ts
|
|
8
|
-
var helpers_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
-
createDirectory: () => createDirectory,
|
|
10
|
-
createDirectorySync: () => createDirectorySync,
|
|
11
|
-
extractFileFromTar: () => extractFileFromTar,
|
|
12
|
-
extractFileFromTarGzip: () => extractFileFromTarGzip,
|
|
13
|
-
removeDirectory: () => removeDirectory,
|
|
14
|
-
removeDirectorySync: () => removeDirectorySync
|
|
15
|
-
});
|
|
16
7
|
/**
|
|
17
8
|
* Create a directory if it does not exist.
|
|
18
9
|
*
|
|
@@ -83,5 +74,5 @@ async function extractFileFromTarGzip(tarballPath, file, destinationFilePath) {
|
|
|
83
74
|
}
|
|
84
75
|
|
|
85
76
|
//#endregion
|
|
86
|
-
export { createDirectory, createDirectorySync, extractFileFromTar, extractFileFromTarGzip,
|
|
77
|
+
export { createDirectory, createDirectorySync, extractFileFromTar, extractFileFromTarGzip, removeDirectory, removeDirectorySync };
|
|
87
78
|
//# sourceMappingURL=helpers.mjs.map
|
package/dist/helpers.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.mjs","names":["existsSync"],"sources":["../src/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parseTar, parseTarGzip } from \"nanotar\";\nimport { createWriteStream, mkdirSync, rmSync } from \"node:fs\";\nimport { mkdir, readFile, rm } from \"node:fs/promises\";\nimport { exists, existsSync } from \"./exists\";\n\n/**\n * Create a directory if it does not exist.\n *\n * @param path - The directory path to check\n * @returns An indicator specifying if the directory exists\n */\nexport function createDirectorySync(path: string) {\n if (existsSync(path)) {\n return;\n }\n\n return mkdirSync(path, { recursive: true });\n}\n\n/**\n * Create a directory if it does not exist.\n *\n * @param path - The directory path to check\n * @returns An indicator specifying if the directory exists\n */\nexport async function createDirectory(path: string) {\n if (await exists(path)) {\n return;\n }\n\n return mkdir(path, { recursive: true });\n}\n\n/**\n * Remove a directory if it exists.\n *\n * @param path - The directory path to check\n * @returns An indicator specifying if the directory exists\n */\nexport function removeDirectorySync(path: string) {\n if (!existsSync(path)) {\n return;\n }\n\n return rmSync(path, { recursive: true });\n}\n\n/**\n * Remove a directory if it exists.\n *\n * @param path - The directory path to check\n * @returns An indicator specifying if the directory exists\n */\nexport async function removeDirectory(path: string) {\n if (!existsSync(path)) {\n return;\n }\n\n return rm(path, { recursive: true });\n}\n\n/**\n * Extracts a file from a given tarball to the specified destination.\n *\n * @param tarballPath - The path to the tarball from where the file should be extracted.\n * @param file - The path to the file inside the tarball.\n * @param destinationFilePath - The destination file path.\n * @returns True if the file was extracted successfully, false otherwise.\n */\nexport async function extractFileFromTar(\n tarballPath: string,\n file: string,\n destinationFilePath: string\n) {\n const result = parseTar(await readFile(tarballPath));\n\n const entry = result.find(e => e.name === file);\n if (!entry?.data) {\n return;\n }\n\n if (!(await exists(destinationFilePath))) {\n await mkdir(destinationFilePath, { recursive: true });\n }\n\n const stream = createWriteStream(destinationFilePath);\n stream.write(entry.data);\n}\n\n/**\n * Extracts a file from a given TarGzip to the specified destination.\n *\n * @param tarballPath - The path to the tarball from where the file should be extracted.\n * @param file - The path to the file inside the tarball.\n * @param destinationFilePath - The destination file path.\n * @returns True if the file was extracted successfully, false otherwise.\n */\nexport async function extractFileFromTarGzip(\n tarballPath: string,\n file: string,\n destinationFilePath: string\n) {\n const result = await parseTarGzip(await readFile(tarballPath));\n\n const entry = result.find(e => e.name === file);\n if (!entry?.data) {\n return;\n }\n\n if (!(await exists(destinationFilePath))) {\n await mkdir(destinationFilePath, { recursive: true });\n }\n\n const stream = createWriteStream(destinationFilePath);\n stream.write(entry.data);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"helpers.mjs","names":["existsSync"],"sources":["../src/helpers.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { parseTar, parseTarGzip } from \"nanotar\";\nimport { createWriteStream, mkdirSync, rmSync } from \"node:fs\";\nimport { mkdir, readFile, rm } from \"node:fs/promises\";\nimport { exists, existsSync } from \"./exists\";\n\n/**\n * Create a directory if it does not exist.\n *\n * @param path - The directory path to check\n * @returns An indicator specifying if the directory exists\n */\nexport function createDirectorySync(path: string) {\n if (existsSync(path)) {\n return;\n }\n\n return mkdirSync(path, { recursive: true });\n}\n\n/**\n * Create a directory if it does not exist.\n *\n * @param path - The directory path to check\n * @returns An indicator specifying if the directory exists\n */\nexport async function createDirectory(path: string) {\n if (await exists(path)) {\n return;\n }\n\n return mkdir(path, { recursive: true });\n}\n\n/**\n * Remove a directory if it exists.\n *\n * @param path - The directory path to check\n * @returns An indicator specifying if the directory exists\n */\nexport function removeDirectorySync(path: string) {\n if (!existsSync(path)) {\n return;\n }\n\n return rmSync(path, { recursive: true });\n}\n\n/**\n * Remove a directory if it exists.\n *\n * @param path - The directory path to check\n * @returns An indicator specifying if the directory exists\n */\nexport async function removeDirectory(path: string) {\n if (!existsSync(path)) {\n return;\n }\n\n return rm(path, { recursive: true });\n}\n\n/**\n * Extracts a file from a given tarball to the specified destination.\n *\n * @param tarballPath - The path to the tarball from where the file should be extracted.\n * @param file - The path to the file inside the tarball.\n * @param destinationFilePath - The destination file path.\n * @returns True if the file was extracted successfully, false otherwise.\n */\nexport async function extractFileFromTar(\n tarballPath: string,\n file: string,\n destinationFilePath: string\n) {\n const result = parseTar(await readFile(tarballPath));\n\n const entry = result.find(e => e.name === file);\n if (!entry?.data) {\n return;\n }\n\n if (!(await exists(destinationFilePath))) {\n await mkdir(destinationFilePath, { recursive: true });\n }\n\n const stream = createWriteStream(destinationFilePath);\n stream.write(entry.data);\n}\n\n/**\n * Extracts a file from a given TarGzip to the specified destination.\n *\n * @param tarballPath - The path to the tarball from where the file should be extracted.\n * @param file - The path to the file inside the tarball.\n * @param destinationFilePath - The destination file path.\n * @returns True if the file was extracted successfully, false otherwise.\n */\nexport async function extractFileFromTarGzip(\n tarballPath: string,\n file: string,\n destinationFilePath: string\n) {\n const result = await parseTarGzip(await readFile(tarballPath));\n\n const entry = result.find(e => e.name === file);\n if (!entry?.data) {\n return;\n }\n\n if (!(await exists(destinationFilePath))) {\n await mkdir(destinationFilePath, { recursive: true });\n }\n\n const stream = createWriteStream(destinationFilePath);\n stream.write(entry.data);\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAgB,oBAAoB,MAAc;AAChD,KAAIA,aAAW,KAAK,CAClB;AAGF,QAAO,UAAU,MAAM,EAAE,WAAW,MAAM,CAAC;;;;;;;;AAS7C,eAAsB,gBAAgB,MAAc;AAClD,KAAI,MAAM,OAAO,KAAK,CACpB;AAGF,QAAO,MAAM,MAAM,EAAE,WAAW,MAAM,CAAC;;;;;;;;AASzC,SAAgB,oBAAoB,MAAc;AAChD,KAAI,CAACA,aAAW,KAAK,CACnB;AAGF,QAAO,OAAO,MAAM,EAAE,WAAW,MAAM,CAAC;;;;;;;;AAS1C,eAAsB,gBAAgB,MAAc;AAClD,KAAI,CAACA,aAAW,KAAK,CACnB;AAGF,QAAO,GAAG,MAAM,EAAE,WAAW,MAAM,CAAC;;;;;;;;;;AAWtC,eAAsB,mBACpB,aACA,MACA,qBACA;CAGA,MAAM,QAFS,SAAS,MAAM,SAAS,YAAY,CAE/B,CAAC,MAAK,MAAK,EAAE,SAAS,KAAK;AAC/C,KAAI,CAAC,OAAO,KACV;AAGF,KAAI,CAAE,MAAM,OAAO,oBAAoB,CACrC,OAAM,MAAM,qBAAqB,EAAE,WAAW,MAAM,CAAC;AAIvD,CADe,kBAAkB,oBAC3B,CAAC,MAAM,MAAM,KAAK;;;;;;;;;;AAW1B,eAAsB,uBACpB,aACA,MACA,qBACA;CAGA,MAAM,SAAQ,MAFO,aAAa,MAAM,SAAS,YAAY,CAAC,EAEzC,MAAK,MAAK,EAAE,SAAS,KAAK;AAC/C,KAAI,CAAC,OAAO,KACV;AAGF,KAAI,CAAE,MAAM,OAAO,oBAAoB,CACrC,OAAM,MAAM,qBAAqB,EAAE,WAAW,MAAM,CAAC;AAIvD,CADe,kBAAkB,oBAC3B,CAAC,MAAM,MAAM,KAAK"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_exists = require('./exists.cjs');
|
|
4
3
|
const require_helpers = require('./helpers.cjs');
|
|
5
4
|
const require_buffer = require('./buffer.cjs');
|
|
@@ -24,110 +23,6 @@ const require_toml = require('./toml.cjs');
|
|
|
24
23
|
const require_tsconfig = require('./tsconfig.cjs');
|
|
25
24
|
const require_yaml = require('./yaml.cjs');
|
|
26
25
|
|
|
27
|
-
//#region src/index.ts
|
|
28
|
-
var src_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
29
|
-
DEFAULT_EXTENSIONS: () => require_resolve.DEFAULT_EXTENSIONS,
|
|
30
|
-
PROJECT_ROOT_CONTENT: () => require_get_workspace_root.PROJECT_ROOT_CONTENT,
|
|
31
|
-
RELEASE_TYPES: () => require_semver_fns.RELEASE_TYPES,
|
|
32
|
-
WORKSPACE_ROOT_CONTENT: () => require_get_workspace_root.WORKSPACE_ROOT_CONTENT,
|
|
33
|
-
chmodX: () => require_chmod_x.chmodX,
|
|
34
|
-
chmodXSync: () => require_chmod_x.chmodXSync,
|
|
35
|
-
coerceVersion: () => require_semver_fns.coerceVersion,
|
|
36
|
-
commandExists: () => require_command_exists.commandExists,
|
|
37
|
-
commandExistsSync: () => require_command_exists.commandExistsSync,
|
|
38
|
-
compressDirectory: () => require_compress.compressDirectory,
|
|
39
|
-
copyFile: () => require_copy_file.copyFile,
|
|
40
|
-
copyFileSync: () => require_copy_file.copyFileSync,
|
|
41
|
-
copyFiles: () => require_copy_file.copyFiles,
|
|
42
|
-
copyFilesSync: () => require_copy_file.copyFilesSync,
|
|
43
|
-
createDirectory: () => require_helpers.createDirectory,
|
|
44
|
-
createDirectorySync: () => require_helpers.createDirectorySync,
|
|
45
|
-
deriveNewSemverVersion: () => require_semver_fns.deriveNewSemverVersion,
|
|
46
|
-
doesPackageMatch: () => require_package_fns.doesPackageMatch,
|
|
47
|
-
exists: () => require_exists.exists,
|
|
48
|
-
existsSync: () => require_exists.existsSync,
|
|
49
|
-
extractFileFromTar: () => require_helpers.extractFileFromTar,
|
|
50
|
-
extractFileFromTarGzip: () => require_helpers.extractFileFromTarGzip,
|
|
51
|
-
formatNodeOptions: () => require_registry.formatNodeOptions,
|
|
52
|
-
getFormattedNodeOptionsWithoutInspect: () => require_registry.getFormattedNodeOptionsWithoutInspect,
|
|
53
|
-
getNodeModulesPaths: () => require_resolve.getNodeModulesPaths,
|
|
54
|
-
getPackageInfo: () => require_package_fns.getPackageInfo,
|
|
55
|
-
getPackageListing: () => require_package_fns.getPackageListing,
|
|
56
|
-
getPackageManager: () => require_package_fns.getPackageManager,
|
|
57
|
-
getParentPath: () => require_get_parent_path.getParentPath,
|
|
58
|
-
getParsedNodeOptionsWithoutInspect: () => require_registry.getParsedNodeOptionsWithoutInspect,
|
|
59
|
-
getProjectRoot: () => require_get_workspace_root.getProjectRoot,
|
|
60
|
-
getRegistry: () => require_registry.getRegistry,
|
|
61
|
-
getResolutionCombinations: () => require_resolve.getResolutionCombinations,
|
|
62
|
-
getResolutionPaths: () => require_resolve.getResolutionPaths,
|
|
63
|
-
getWorkspaceRoot: () => require_get_workspace_root.getWorkspaceRoot,
|
|
64
|
-
importModule: () => require_resolve.importModule,
|
|
65
|
-
install: () => require_install.install,
|
|
66
|
-
isDirectory: () => require_is_file.isDirectory,
|
|
67
|
-
isDirectorySymlink: () => require_is_file.isDirectorySymlink,
|
|
68
|
-
isExecutable: () => require_chmod_x.isExecutable,
|
|
69
|
-
isExecutableSync: () => require_chmod_x.isExecutableSync,
|
|
70
|
-
isFile: () => require_is_file.isFile,
|
|
71
|
-
isFileSymlink: () => require_is_file.isFileSymlink,
|
|
72
|
-
isPackageExists: () => require_package_fns.isPackageExists,
|
|
73
|
-
isPackageListed: () => require_package_fns.isPackageListed,
|
|
74
|
-
isProjectRoot: () => require_get_workspace_root.isProjectRoot,
|
|
75
|
-
isRange: () => require_semver_fns.isRange,
|
|
76
|
-
isRelativeVersionKeyword: () => require_semver_fns.isRelativeVersionKeyword,
|
|
77
|
-
isSemver: () => require_semver_fns.isSemver,
|
|
78
|
-
isValidRange: () => require_semver_fns.isValidRange,
|
|
79
|
-
isValidSemver: () => require_semver_fns.isValidSemver,
|
|
80
|
-
isValidVersion: () => require_semver_fns.isValidVersion,
|
|
81
|
-
isWorkspaceRoot: () => require_get_workspace_root.isWorkspaceRoot,
|
|
82
|
-
isWritable: () => require_chmod_x.isWritable,
|
|
83
|
-
isWritableSync: () => require_chmod_x.isWritableSync,
|
|
84
|
-
list: () => require_list_files.list,
|
|
85
|
-
listDirectories: () => require_list_files.listDirectories,
|
|
86
|
-
listDirectoriesSync: () => require_list_files.listDirectoriesSync,
|
|
87
|
-
listFiles: () => require_list_files.listFiles,
|
|
88
|
-
listFilesSync: () => require_list_files.listFilesSync,
|
|
89
|
-
listSync: () => require_list_files.listSync,
|
|
90
|
-
loadPackageJson: () => require_package_fns.loadPackageJson,
|
|
91
|
-
loadTsConfig: () => require_tsconfig.loadTsConfig,
|
|
92
|
-
packageExists: () => require_install.packageExists,
|
|
93
|
-
parseVersion: () => require_semver_fns.parseVersion,
|
|
94
|
-
readFile: () => require_read_file.readFile,
|
|
95
|
-
readFileBuffer: () => require_buffer.readFileBuffer,
|
|
96
|
-
readFileBufferSync: () => require_buffer.readFileBufferSync,
|
|
97
|
-
readFileIfExisting: () => require_read_file.readFileIfExisting,
|
|
98
|
-
readFileIfExistingSync: () => require_read_file.readFileIfExistingSync,
|
|
99
|
-
readFileSync: () => require_read_file.readFileSync,
|
|
100
|
-
readJsonFile: () => require_json.readJsonFile,
|
|
101
|
-
readJsonFileSync: () => require_json.readJsonFileSync,
|
|
102
|
-
readTomlFile: () => require_toml.readTomlFile,
|
|
103
|
-
readTomlFileSync: () => require_toml.readTomlFileSync,
|
|
104
|
-
readYamlFile: () => require_yaml.readYamlFile,
|
|
105
|
-
readYamlFileSync: () => require_yaml.readYamlFileSync,
|
|
106
|
-
relativeToProjectRoot: () => require_get_workspace_root.relativeToProjectRoot,
|
|
107
|
-
relativeToWorkspaceRoot: () => require_get_workspace_root.relativeToWorkspaceRoot,
|
|
108
|
-
removeDirectory: () => require_helpers.removeDirectory,
|
|
109
|
-
removeDirectorySync: () => require_helpers.removeDirectorySync,
|
|
110
|
-
removeFile: () => require_remove_file.removeFile,
|
|
111
|
-
removeFileSync: () => require_remove_file.removeFileSync,
|
|
112
|
-
resolve: () => require_resolve.resolve,
|
|
113
|
-
resolvePackage: () => require_resolve.resolvePackage,
|
|
114
|
-
resolvePackageSync: () => require_resolve.resolvePackageSync,
|
|
115
|
-
resolveSafe: () => require_resolve.resolveSafe,
|
|
116
|
-
resolveSafeSync: () => require_resolve.resolveSafeSync,
|
|
117
|
-
resolveSync: () => require_resolve.resolveSync,
|
|
118
|
-
satisfiesVersion: () => require_semver_fns.satisfiesVersion,
|
|
119
|
-
tokenizeArgs: () => require_registry.tokenizeArgs,
|
|
120
|
-
writeFile: () => require_write_file.writeFile,
|
|
121
|
-
writeFileBuffer: () => require_buffer.writeFileBuffer,
|
|
122
|
-
writeFileBufferSync: () => require_buffer.writeFileBufferSync,
|
|
123
|
-
writeFileSync: () => require_write_file.writeFileSync,
|
|
124
|
-
writeJsonFile: () => require_json.writeJsonFile,
|
|
125
|
-
writeJsonFileSync: () => require_json.writeJsonFileSync,
|
|
126
|
-
writeTomlFile: () => require_toml.writeTomlFile,
|
|
127
|
-
writeTomlFileSync: () => require_toml.writeTomlFileSync
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
//#endregion
|
|
131
26
|
exports.DEFAULT_EXTENSIONS = require_resolve.DEFAULT_EXTENSIONS;
|
|
132
27
|
exports.PROJECT_ROOT_CONTENT = require_get_workspace_root.PROJECT_ROOT_CONTENT;
|
|
133
28
|
exports.RELEASE_TYPES = require_semver_fns.RELEASE_TYPES;
|
|
@@ -218,12 +113,6 @@ exports.resolveSafe = require_resolve.resolveSafe;
|
|
|
218
113
|
exports.resolveSafeSync = require_resolve.resolveSafeSync;
|
|
219
114
|
exports.resolveSync = require_resolve.resolveSync;
|
|
220
115
|
exports.satisfiesVersion = require_semver_fns.satisfiesVersion;
|
|
221
|
-
Object.defineProperty(exports, 'src_exports', {
|
|
222
|
-
enumerable: true,
|
|
223
|
-
get: function () {
|
|
224
|
-
return src_exports;
|
|
225
|
-
}
|
|
226
|
-
});
|
|
227
116
|
exports.tokenizeArgs = require_registry.tokenizeArgs;
|
|
228
117
|
exports.writeFile = require_write_file.writeFile;
|
|
229
118
|
exports.writeFileBuffer = require_buffer.writeFileBuffer;
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { exists, existsSync } from "./exists.mjs";
|
|
3
2
|
import { createDirectory, createDirectorySync, extractFileFromTar, extractFileFromTarGzip, removeDirectory, removeDirectorySync } from "./helpers.mjs";
|
|
4
3
|
import { readFileBuffer, readFileBufferSync, writeFileBuffer, writeFileBufferSync } from "./buffer.mjs";
|
|
@@ -23,109 +22,4 @@ import { readTomlFile, readTomlFileSync, writeTomlFile, writeTomlFileSync } from
|
|
|
23
22
|
import { loadTsConfig } from "./tsconfig.mjs";
|
|
24
23
|
import { readYamlFile, readYamlFileSync } from "./yaml.mjs";
|
|
25
24
|
|
|
26
|
-
|
|
27
|
-
var src_exports = /* @__PURE__ */ __exportAll({
|
|
28
|
-
DEFAULT_EXTENSIONS: () => DEFAULT_EXTENSIONS,
|
|
29
|
-
PROJECT_ROOT_CONTENT: () => PROJECT_ROOT_CONTENT,
|
|
30
|
-
RELEASE_TYPES: () => RELEASE_TYPES,
|
|
31
|
-
WORKSPACE_ROOT_CONTENT: () => WORKSPACE_ROOT_CONTENT,
|
|
32
|
-
chmodX: () => chmodX,
|
|
33
|
-
chmodXSync: () => chmodXSync,
|
|
34
|
-
coerceVersion: () => coerceVersion,
|
|
35
|
-
commandExists: () => commandExists,
|
|
36
|
-
commandExistsSync: () => commandExistsSync,
|
|
37
|
-
compressDirectory: () => compressDirectory,
|
|
38
|
-
copyFile: () => copyFile,
|
|
39
|
-
copyFileSync: () => copyFileSync,
|
|
40
|
-
copyFiles: () => copyFiles,
|
|
41
|
-
copyFilesSync: () => copyFilesSync,
|
|
42
|
-
createDirectory: () => createDirectory,
|
|
43
|
-
createDirectorySync: () => createDirectorySync,
|
|
44
|
-
deriveNewSemverVersion: () => deriveNewSemverVersion,
|
|
45
|
-
doesPackageMatch: () => doesPackageMatch,
|
|
46
|
-
exists: () => exists,
|
|
47
|
-
existsSync: () => existsSync,
|
|
48
|
-
extractFileFromTar: () => extractFileFromTar,
|
|
49
|
-
extractFileFromTarGzip: () => extractFileFromTarGzip,
|
|
50
|
-
formatNodeOptions: () => formatNodeOptions,
|
|
51
|
-
getFormattedNodeOptionsWithoutInspect: () => getFormattedNodeOptionsWithoutInspect,
|
|
52
|
-
getNodeModulesPaths: () => getNodeModulesPaths,
|
|
53
|
-
getPackageInfo: () => getPackageInfo,
|
|
54
|
-
getPackageListing: () => getPackageListing,
|
|
55
|
-
getPackageManager: () => getPackageManager,
|
|
56
|
-
getParentPath: () => getParentPath,
|
|
57
|
-
getParsedNodeOptionsWithoutInspect: () => getParsedNodeOptionsWithoutInspect,
|
|
58
|
-
getProjectRoot: () => getProjectRoot,
|
|
59
|
-
getRegistry: () => getRegistry,
|
|
60
|
-
getResolutionCombinations: () => getResolutionCombinations,
|
|
61
|
-
getResolutionPaths: () => getResolutionPaths,
|
|
62
|
-
getWorkspaceRoot: () => getWorkspaceRoot,
|
|
63
|
-
importModule: () => importModule,
|
|
64
|
-
install: () => install,
|
|
65
|
-
isDirectory: () => isDirectory,
|
|
66
|
-
isDirectorySymlink: () => isDirectorySymlink,
|
|
67
|
-
isExecutable: () => isExecutable,
|
|
68
|
-
isExecutableSync: () => isExecutableSync,
|
|
69
|
-
isFile: () => isFile,
|
|
70
|
-
isFileSymlink: () => isFileSymlink,
|
|
71
|
-
isPackageExists: () => isPackageExists,
|
|
72
|
-
isPackageListed: () => isPackageListed,
|
|
73
|
-
isProjectRoot: () => isProjectRoot,
|
|
74
|
-
isRange: () => isRange,
|
|
75
|
-
isRelativeVersionKeyword: () => isRelativeVersionKeyword,
|
|
76
|
-
isSemver: () => isSemver,
|
|
77
|
-
isValidRange: () => isValidRange,
|
|
78
|
-
isValidSemver: () => isValidSemver,
|
|
79
|
-
isValidVersion: () => isValidVersion,
|
|
80
|
-
isWorkspaceRoot: () => isWorkspaceRoot,
|
|
81
|
-
isWritable: () => isWritable,
|
|
82
|
-
isWritableSync: () => isWritableSync,
|
|
83
|
-
list: () => list,
|
|
84
|
-
listDirectories: () => listDirectories,
|
|
85
|
-
listDirectoriesSync: () => listDirectoriesSync,
|
|
86
|
-
listFiles: () => listFiles,
|
|
87
|
-
listFilesSync: () => listFilesSync,
|
|
88
|
-
listSync: () => listSync,
|
|
89
|
-
loadPackageJson: () => loadPackageJson,
|
|
90
|
-
loadTsConfig: () => loadTsConfig,
|
|
91
|
-
packageExists: () => packageExists,
|
|
92
|
-
parseVersion: () => parseVersion,
|
|
93
|
-
readFile: () => readFile,
|
|
94
|
-
readFileBuffer: () => readFileBuffer,
|
|
95
|
-
readFileBufferSync: () => readFileBufferSync,
|
|
96
|
-
readFileIfExisting: () => readFileIfExisting,
|
|
97
|
-
readFileIfExistingSync: () => readFileIfExistingSync,
|
|
98
|
-
readFileSync: () => readFileSync,
|
|
99
|
-
readJsonFile: () => readJsonFile,
|
|
100
|
-
readJsonFileSync: () => readJsonFileSync,
|
|
101
|
-
readTomlFile: () => readTomlFile,
|
|
102
|
-
readTomlFileSync: () => readTomlFileSync,
|
|
103
|
-
readYamlFile: () => readYamlFile,
|
|
104
|
-
readYamlFileSync: () => readYamlFileSync,
|
|
105
|
-
relativeToProjectRoot: () => relativeToProjectRoot,
|
|
106
|
-
relativeToWorkspaceRoot: () => relativeToWorkspaceRoot,
|
|
107
|
-
removeDirectory: () => removeDirectory,
|
|
108
|
-
removeDirectorySync: () => removeDirectorySync,
|
|
109
|
-
removeFile: () => removeFile,
|
|
110
|
-
removeFileSync: () => removeFileSync,
|
|
111
|
-
resolve: () => resolve,
|
|
112
|
-
resolvePackage: () => resolvePackage,
|
|
113
|
-
resolvePackageSync: () => resolvePackageSync,
|
|
114
|
-
resolveSafe: () => resolveSafe,
|
|
115
|
-
resolveSafeSync: () => resolveSafeSync,
|
|
116
|
-
resolveSync: () => resolveSync,
|
|
117
|
-
satisfiesVersion: () => satisfiesVersion,
|
|
118
|
-
tokenizeArgs: () => tokenizeArgs,
|
|
119
|
-
writeFile: () => writeFile,
|
|
120
|
-
writeFileBuffer: () => writeFileBuffer,
|
|
121
|
-
writeFileBufferSync: () => writeFileBufferSync,
|
|
122
|
-
writeFileSync: () => writeFileSync,
|
|
123
|
-
writeJsonFile: () => writeJsonFile,
|
|
124
|
-
writeJsonFileSync: () => writeJsonFileSync,
|
|
125
|
-
writeTomlFile: () => writeTomlFile,
|
|
126
|
-
writeTomlFileSync: () => writeTomlFileSync
|
|
127
|
-
});
|
|
128
|
-
|
|
129
|
-
//#endregion
|
|
130
|
-
export { DEFAULT_EXTENSIONS, PROJECT_ROOT_CONTENT, RELEASE_TYPES, WORKSPACE_ROOT_CONTENT, chmodX, chmodXSync, coerceVersion, commandExists, commandExistsSync, compressDirectory, copyFile, copyFileSync, copyFiles, copyFilesSync, createDirectory, createDirectorySync, deriveNewSemverVersion, doesPackageMatch, exists, existsSync, extractFileFromTar, extractFileFromTarGzip, formatNodeOptions, getFormattedNodeOptionsWithoutInspect, getNodeModulesPaths, getPackageInfo, getPackageListing, getPackageManager, getParentPath, getParsedNodeOptionsWithoutInspect, getProjectRoot, getRegistry, getResolutionCombinations, getResolutionPaths, getWorkspaceRoot, importModule, install, isDirectory, isDirectorySymlink, isExecutable, isExecutableSync, isFile, isFileSymlink, isPackageExists, isPackageListed, isProjectRoot, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, isWorkspaceRoot, isWritable, isWritableSync, list, listDirectories, listDirectoriesSync, listFiles, listFilesSync, listSync, loadPackageJson, loadTsConfig, packageExists, parseVersion, readFile, readFileBuffer, readFileBufferSync, readFileIfExisting, readFileIfExistingSync, readFileSync, readJsonFile, readJsonFileSync, readTomlFile, readTomlFileSync, readYamlFile, readYamlFileSync, relativeToProjectRoot, relativeToWorkspaceRoot, removeDirectory, removeDirectorySync, removeFile, removeFileSync, resolve, resolvePackage, resolvePackageSync, resolveSafe, resolveSafeSync, resolveSync, satisfiesVersion, src_exports, tokenizeArgs, writeFile, writeFileBuffer, writeFileBufferSync, writeFileSync, writeJsonFile, writeJsonFileSync, writeTomlFile, writeTomlFileSync };
|
|
131
|
-
//# sourceMappingURL=index.mjs.map
|
|
25
|
+
export { DEFAULT_EXTENSIONS, PROJECT_ROOT_CONTENT, RELEASE_TYPES, WORKSPACE_ROOT_CONTENT, chmodX, chmodXSync, coerceVersion, commandExists, commandExistsSync, compressDirectory, copyFile, copyFileSync, copyFiles, copyFilesSync, createDirectory, createDirectorySync, deriveNewSemverVersion, doesPackageMatch, exists, existsSync, extractFileFromTar, extractFileFromTarGzip, formatNodeOptions, getFormattedNodeOptionsWithoutInspect, getNodeModulesPaths, getPackageInfo, getPackageListing, getPackageManager, getParentPath, getParsedNodeOptionsWithoutInspect, getProjectRoot, getRegistry, getResolutionCombinations, getResolutionPaths, getWorkspaceRoot, importModule, install, isDirectory, isDirectorySymlink, isExecutable, isExecutableSync, isFile, isFileSymlink, isPackageExists, isPackageListed, isProjectRoot, isRange, isRelativeVersionKeyword, isSemver, isValidRange, isValidSemver, isValidVersion, isWorkspaceRoot, isWritable, isWritableSync, list, listDirectories, listDirectoriesSync, listFiles, listFilesSync, listSync, loadPackageJson, loadTsConfig, packageExists, parseVersion, readFile, readFileBuffer, readFileBufferSync, readFileIfExisting, readFileIfExistingSync, readFileSync, readJsonFile, readJsonFileSync, readTomlFile, readTomlFileSync, readYamlFile, readYamlFileSync, relativeToProjectRoot, relativeToWorkspaceRoot, removeDirectory, removeDirectorySync, removeFile, removeFileSync, resolve, resolvePackage, resolvePackageSync, resolveSafe, resolveSafeSync, resolveSync, satisfiesVersion, tokenizeArgs, writeFile, writeFileBuffer, writeFileBufferSync, writeFileSync, writeJsonFile, writeJsonFileSync, writeTomlFile, writeTomlFileSync };
|
package/dist/install.cjs
CHANGED
|
@@ -6,10 +6,6 @@ let _antfu_install_pkg = require("@antfu/install-pkg");
|
|
|
6
6
|
require("tinyexec");
|
|
7
7
|
|
|
8
8
|
//#region src/install.ts
|
|
9
|
-
var install_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
10
|
-
install: () => install,
|
|
11
|
-
packageExists: () => packageExists
|
|
12
|
-
});
|
|
13
9
|
/**
|
|
14
10
|
* Install a specific or list of packages
|
|
15
11
|
*
|
|
@@ -37,10 +33,4 @@ const packageExists = async (name, options) => {
|
|
|
37
33
|
|
|
38
34
|
//#endregion
|
|
39
35
|
exports.install = install;
|
|
40
|
-
Object.defineProperty(exports, 'install_exports', {
|
|
41
|
-
enumerable: true,
|
|
42
|
-
get: function () {
|
|
43
|
-
return install_exports;
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
36
|
exports.packageExists = packageExists;
|
package/dist/install.mjs
CHANGED
|
@@ -1,14 +1,9 @@
|
|
|
1
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { resolve } from "./resolve.mjs";
|
|
3
2
|
import { cwd } from "@stryke/path/cwd";
|
|
4
3
|
import { installPackage } from "@antfu/install-pkg";
|
|
5
4
|
import "tinyexec";
|
|
6
5
|
|
|
7
6
|
//#region src/install.ts
|
|
8
|
-
var install_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
-
install: () => install,
|
|
10
|
-
packageExists: () => packageExists
|
|
11
|
-
});
|
|
12
7
|
/**
|
|
13
8
|
* Install a specific or list of packages
|
|
14
9
|
*
|
|
@@ -35,5 +30,5 @@ const packageExists = async (name, options) => {
|
|
|
35
30
|
};
|
|
36
31
|
|
|
37
32
|
//#endregion
|
|
38
|
-
export { install,
|
|
33
|
+
export { install, packageExists };
|
|
39
34
|
//# sourceMappingURL=install.mjs.map
|
package/dist/install.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.mjs","names":[],"sources":["../src/install.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { InstallPackageOptions } from \"@antfu/install-pkg\";\nimport { installPackage } from \"@antfu/install-pkg\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport \"tinyexec\";\nimport { resolve } from \"./resolve\";\n\n/**\n * Install a specific package\n *\n * @param name - The name of the package to install\n * @param options - The options to use when installing the package\n */\nexport async function install(\n name: string,\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>>;\n\n/**\n * Install a list of packages\n *\n * @param names - The list of package names to install\n * @param options - The options to use when installing the package\n */\nexport async function install(\n names: string[],\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>>;\n\n/**\n * Install a specific or list of packages\n *\n * @param nameOrNames - The name or names of packages to install\n * @param options - The options to use when installing the package\n * @returns The result of the command or an exception\n */\nexport async function install(\n nameOrNames: string | string[],\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>> {\n return installPackage(nameOrNames, options);\n}\n\n/**\n * Check if a package exists and install it if it does not\n *\n * @param name - The name of the package to check\n * @param options - The options to use when installing the package\n */\nexport const packageExists = async (\n name: string,\n options?: InstallPackageOptions\n) => {\n const resolvePath = await resolve(options?.cwd || cwd());\n try {\n await resolve(name, { paths: [resolvePath] });\n } catch {\n await install(name, options);\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"install.mjs","names":[],"sources":["../src/install.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { InstallPackageOptions } from \"@antfu/install-pkg\";\nimport { installPackage } from \"@antfu/install-pkg\";\nimport { cwd } from \"@stryke/path/cwd\";\nimport \"tinyexec\";\nimport { resolve } from \"./resolve\";\n\n/**\n * Install a specific package\n *\n * @param name - The name of the package to install\n * @param options - The options to use when installing the package\n */\nexport async function install(\n name: string,\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>>;\n\n/**\n * Install a list of packages\n *\n * @param names - The list of package names to install\n * @param options - The options to use when installing the package\n */\nexport async function install(\n names: string[],\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>>;\n\n/**\n * Install a specific or list of packages\n *\n * @param nameOrNames - The name or names of packages to install\n * @param options - The options to use when installing the package\n * @returns The result of the command or an exception\n */\nexport async function install(\n nameOrNames: string | string[],\n options?: InstallPackageOptions\n): Promise<ReturnType<typeof installPackage>> {\n return installPackage(nameOrNames, options);\n}\n\n/**\n * Check if a package exists and install it if it does not\n *\n * @param name - The name of the package to check\n * @param options - The options to use when installing the package\n */\nexport const packageExists = async (\n name: string,\n options?: InstallPackageOptions\n) => {\n const resolvePath = await resolve(options?.cwd || cwd());\n try {\n await resolve(name, { paths: [resolvePath] });\n } catch {\n await install(name, options);\n }\n};\n"],"mappings":";;;;;;;;;;;;;AAqDA,eAAsB,QACpB,aACA,SAC4C;AAC5C,QAAO,eAAe,aAAa,QAAQ;;;;;;;;AAS7C,MAAa,gBAAgB,OAC3B,MACA,YACG;CACH,MAAM,cAAc,MAAM,QAAQ,SAAS,OAAO,KAAK,CAAC;AACxD,KAAI;AACF,QAAM,QAAQ,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,CAAC;SACvC;AACN,QAAM,QAAQ,MAAM,QAAQ"}
|
package/dist/is-file.cjs
CHANGED
|
@@ -4,12 +4,6 @@ let node_fs = require("node:fs");
|
|
|
4
4
|
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
5
5
|
|
|
6
6
|
//#region src/is-file.ts
|
|
7
|
-
var is_file_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
8
|
-
isDirectory: () => isDirectory,
|
|
9
|
-
isDirectorySymlink: () => isDirectorySymlink,
|
|
10
|
-
isFile: () => isFile,
|
|
11
|
-
isFileSymlink: () => isFileSymlink
|
|
12
|
-
});
|
|
13
7
|
/**
|
|
14
8
|
* Check if the given path is a file.
|
|
15
9
|
*
|
|
@@ -55,10 +49,4 @@ const isDirectorySymlink = (path, additionalPath) => {
|
|
|
55
49
|
exports.isDirectory = isDirectory;
|
|
56
50
|
exports.isDirectorySymlink = isDirectorySymlink;
|
|
57
51
|
exports.isFile = isFile;
|
|
58
|
-
exports.isFileSymlink = isFileSymlink;
|
|
59
|
-
Object.defineProperty(exports, 'is_file_exports', {
|
|
60
|
-
enumerable: true,
|
|
61
|
-
get: function () {
|
|
62
|
-
return is_file_exports;
|
|
63
|
-
}
|
|
64
|
-
});
|
|
52
|
+
exports.isFileSymlink = isFileSymlink;
|
package/dist/is-file.mjs
CHANGED
|
@@ -1,14 +1,7 @@
|
|
|
1
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { lstatSync, statSync } from "node:fs";
|
|
3
2
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
4
3
|
|
|
5
4
|
//#region src/is-file.ts
|
|
6
|
-
var is_file_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
-
isDirectory: () => isDirectory,
|
|
8
|
-
isDirectorySymlink: () => isDirectorySymlink,
|
|
9
|
-
isFile: () => isFile,
|
|
10
|
-
isFileSymlink: () => isFileSymlink
|
|
11
|
-
});
|
|
12
5
|
/**
|
|
13
6
|
* Check if the given path is a file.
|
|
14
7
|
*
|
|
@@ -51,5 +44,5 @@ const isDirectorySymlink = (path, additionalPath) => {
|
|
|
51
44
|
};
|
|
52
45
|
|
|
53
46
|
//#endregion
|
|
54
|
-
export { isDirectory, isDirectorySymlink, isFile, isFileSymlink
|
|
47
|
+
export { isDirectory, isDirectorySymlink, isFile, isFileSymlink };
|
|
55
48
|
//# sourceMappingURL=is-file.mjs.map
|
package/dist/is-file.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-file.mjs","names":[],"sources":["../src/is-file.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { lstatSync, statSync } from \"node:fs\";\n\n/**\n * Check if the given path is a file.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a file\n */\nexport function isFile(path: string, additionalPath?: string): boolean {\n return Boolean(\n statSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isFile()\n );\n}\n\n/**\n * Check if the given path is a directory.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a directory\n */\nexport function isDirectory(path: string, additionalPath?: string): boolean {\n return Boolean(\n statSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isDirectory()\n );\n}\n\n/**\n * Check if the given path is a file . Does not dereference symbolic links.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a file\n */\nexport const isFileSymlink = (\n path: string,\n additionalPath?: string\n): boolean => {\n return Boolean(\n lstatSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isFile()\n );\n};\n\n/**\n * Check if the given path is a directory. Does not dereference symbolic links.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a directory\n */\nexport const isDirectorySymlink = (\n path: string,\n additionalPath?: string\n): boolean => {\n return Boolean(\n lstatSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isDirectory()\n );\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-file.mjs","names":[],"sources":["../src/is-file.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { lstatSync, statSync } from \"node:fs\";\n\n/**\n * Check if the given path is a file.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a file\n */\nexport function isFile(path: string, additionalPath?: string): boolean {\n return Boolean(\n statSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isFile()\n );\n}\n\n/**\n * Check if the given path is a directory.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a directory\n */\nexport function isDirectory(path: string, additionalPath?: string): boolean {\n return Boolean(\n statSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isDirectory()\n );\n}\n\n/**\n * Check if the given path is a file . Does not dereference symbolic links.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a file\n */\nexport const isFileSymlink = (\n path: string,\n additionalPath?: string\n): boolean => {\n return Boolean(\n lstatSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isFile()\n );\n};\n\n/**\n * Check if the given path is a directory. Does not dereference symbolic links.\n *\n * @param path - The location to check\n * @param additionalPath - An optional additional path to add to the start of the path\n * @returns An indicator specifying if the path is a directory\n */\nexport const isDirectorySymlink = (\n path: string,\n additionalPath?: string\n): boolean => {\n return Boolean(\n lstatSync(additionalPath ? joinPaths(additionalPath, path) : path, {\n throwIfNoEntry: false\n })?.isDirectory()\n );\n};\n"],"mappings":";;;;;;;;;;;AA4BA,SAAgB,OAAO,MAAc,gBAAkC;AACrE,QAAO,QACL,SAAS,iBAAiB,UAAU,gBAAgB,KAAK,GAAG,MAAM,EAChE,gBAAgB,OACjB,CAAC,EAAE,QAAQ,CACb;;;;;;;;;AAUH,SAAgB,YAAY,MAAc,gBAAkC;AAC1E,QAAO,QACL,SAAS,iBAAiB,UAAU,gBAAgB,KAAK,GAAG,MAAM,EAChE,gBAAgB,OACjB,CAAC,EAAE,aAAa,CAClB;;;;;;;;;AAUH,MAAa,iBACX,MACA,mBACY;AACZ,QAAO,QACL,UAAU,iBAAiB,UAAU,gBAAgB,KAAK,GAAG,MAAM,EACjE,gBAAgB,OACjB,CAAC,EAAE,QAAQ,CACb;;;;;;;;;AAUH,MAAa,sBACX,MACA,mBACY;AACZ,QAAO,QACL,UAAU,iBAAiB,UAAU,gBAAgB,KAAK,GAAG,MAAM,EACjE,gBAAgB,OACjB,CAAC,EAAE,aAAa,CAClB"}
|
package/dist/json.cjs
CHANGED
|
@@ -8,12 +8,6 @@ let _stryke_json_storm_json = require("@stryke/json/storm-json");
|
|
|
8
8
|
let _stryke_type_checks_is_error = require("@stryke/type-checks/is-error");
|
|
9
9
|
|
|
10
10
|
//#region src/json.ts
|
|
11
|
-
var json_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
12
|
-
readJsonFile: () => readJsonFile,
|
|
13
|
-
readJsonFileSync: () => readJsonFileSync,
|
|
14
|
-
writeJsonFile: () => writeJsonFile,
|
|
15
|
-
writeJsonFileSync: () => writeJsonFileSync
|
|
16
|
-
});
|
|
17
11
|
/**
|
|
18
12
|
* Reads a JSON file and returns the object the JSON content represents.
|
|
19
13
|
*
|
|
@@ -88,12 +82,6 @@ async function writeJsonFile(path, data, options = {}) {
|
|
|
88
82
|
}
|
|
89
83
|
|
|
90
84
|
//#endregion
|
|
91
|
-
Object.defineProperty(exports, 'json_exports', {
|
|
92
|
-
enumerable: true,
|
|
93
|
-
get: function () {
|
|
94
|
-
return json_exports;
|
|
95
|
-
}
|
|
96
|
-
});
|
|
97
85
|
exports.readJsonFile = readJsonFile;
|
|
98
86
|
exports.readJsonFileSync = readJsonFileSync;
|
|
99
87
|
exports.writeJsonFile = writeJsonFile;
|
package/dist/json.mjs
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { readFile, readFileSync } from "./read-file.mjs";
|
|
3
2
|
import { writeFile, writeFileSync } from "./write-file.mjs";
|
|
4
3
|
import { findFileExtension } from "@stryke/path";
|
|
@@ -7,12 +6,6 @@ import { StormJSON } from "@stryke/json/storm-json";
|
|
|
7
6
|
import { isError } from "@stryke/type-checks/is-error";
|
|
8
7
|
|
|
9
8
|
//#region src/json.ts
|
|
10
|
-
var json_exports = /* @__PURE__ */ __exportAll({
|
|
11
|
-
readJsonFile: () => readJsonFile,
|
|
12
|
-
readJsonFileSync: () => readJsonFileSync,
|
|
13
|
-
writeJsonFile: () => writeJsonFile,
|
|
14
|
-
writeJsonFileSync: () => writeJsonFileSync
|
|
15
|
-
});
|
|
16
9
|
/**
|
|
17
10
|
* Reads a JSON file and returns the object the JSON content represents.
|
|
18
11
|
*
|
|
@@ -87,5 +80,5 @@ async function writeJsonFile(path, data, options = {}) {
|
|
|
87
80
|
}
|
|
88
81
|
|
|
89
82
|
//#endregion
|
|
90
|
-
export {
|
|
83
|
+
export { readJsonFile, readJsonFileSync, writeJsonFile, writeJsonFileSync };
|
|
91
84
|
//# sourceMappingURL=json.mjs.map
|
package/dist/json.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.mjs","names":[],"sources":["../src/json.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport type {\n JsonParseOptions,\n JsonSerializeOptions\n} from \"@stryke/json/types\";\nimport { findFileExtension } from \"@stryke/path\";\nimport { isSetString } from \"@stryke/type-checks\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { readFile, readFileSync } from \"./read-file\";\nimport { writeFile, writeFileSync } from \"./write-file\";\n\n/**\n * Reads a JSON file and returns the object the JSON content represents.\n *\n * @param path - A path to a file.\n * @param options - JSON parse options\n * @returns Object the JSON content of the file represents\n */\nexport function readJsonFileSync<T extends object = any>(\n path: string,\n options?: JsonParseOptions\n): T {\n const content = readFileSync(path);\n\n try {\n return StormJSON.parse<T>(isSetString(content) ? content.trim() : \"{}\", {\n expectComments: findFileExtension(path) === \"jsonc\",\n ...options\n });\n } catch (error) {\n if (isError(error)) {\n error.message = error.message.replace(\"JSON\", path);\n throw error;\n }\n\n throw new Error(`Failed to parse JSON: ${path}`);\n }\n}\n\n/**\n * Reads a JSON file and returns the object the JSON content represents.\n *\n * @param path - A path to a file.\n * @param options - JSON parse options\n * @returns Object the JSON content of the file represents\n */\nexport async function readJsonFile<T extends object = any>(\n path: string,\n options: JsonParseOptions = {}\n): Promise<T> {\n const content = await readFile(path);\n\n try {\n return StormJSON.parse<T>(isSetString(content) ? content.trim() : \"{}\", {\n expectComments: findFileExtension(path) === \"jsonc\",\n ...options\n });\n } catch (error) {\n if (isError(error)) {\n error.message = error.message.replace(\"JSON\", path);\n throw error;\n }\n\n throw new Error(`Failed to parse JSON: ${path}`);\n }\n}\n\nexport interface JsonWriteOptions extends JsonSerializeOptions {\n /**\n * whether to append new line at the end of JSON file\n *\n * @defaultValue false\n */\n appendNewLine?: boolean;\n}\n\n/**\n * Serializes the given data to JSON and writes it to a file.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized to JSON and written to the file\n * @param options - JSON serialize options\n */\nexport function writeJsonFileSync<T extends object = object>(\n path: string,\n data: T,\n options: JsonWriteOptions = {}\n): void {\n const serializedJson = StormJSON.stringify(data, { spaces: 2, ...options });\n\n return writeFileSync(\n path,\n options?.appendNewLine ? `${serializedJson}\\n` : serializedJson\n );\n}\n\n/**\n * Serializes the given data to JSON and writes it to a file asynchronously.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized to JSON and written to the file\n * @param options - JSON serialize options\n */\nexport async function writeJsonFile<T extends object = object>(\n path: string,\n data: T,\n options: JsonWriteOptions = {}\n): Promise<void> {\n const serializedJson = StormJSON.stringify(data, { spaces: 2, ...options });\n\n return writeFile(\n path,\n options?.appendNewLine ? `${serializedJson}\\n` : serializedJson\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"json.mjs","names":[],"sources":["../src/json.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/stryke\n Documentation: https://docs.stormsoftware.com/projects/stryke\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { StormJSON } from \"@stryke/json/storm-json\";\nimport type {\n JsonParseOptions,\n JsonSerializeOptions\n} from \"@stryke/json/types\";\nimport { findFileExtension } from \"@stryke/path\";\nimport { isSetString } from \"@stryke/type-checks\";\nimport { isError } from \"@stryke/type-checks/is-error\";\nimport { readFile, readFileSync } from \"./read-file\";\nimport { writeFile, writeFileSync } from \"./write-file\";\n\n/**\n * Reads a JSON file and returns the object the JSON content represents.\n *\n * @param path - A path to a file.\n * @param options - JSON parse options\n * @returns Object the JSON content of the file represents\n */\nexport function readJsonFileSync<T extends object = any>(\n path: string,\n options?: JsonParseOptions\n): T {\n const content = readFileSync(path);\n\n try {\n return StormJSON.parse<T>(isSetString(content) ? content.trim() : \"{}\", {\n expectComments: findFileExtension(path) === \"jsonc\",\n ...options\n });\n } catch (error) {\n if (isError(error)) {\n error.message = error.message.replace(\"JSON\", path);\n throw error;\n }\n\n throw new Error(`Failed to parse JSON: ${path}`);\n }\n}\n\n/**\n * Reads a JSON file and returns the object the JSON content represents.\n *\n * @param path - A path to a file.\n * @param options - JSON parse options\n * @returns Object the JSON content of the file represents\n */\nexport async function readJsonFile<T extends object = any>(\n path: string,\n options: JsonParseOptions = {}\n): Promise<T> {\n const content = await readFile(path);\n\n try {\n return StormJSON.parse<T>(isSetString(content) ? content.trim() : \"{}\", {\n expectComments: findFileExtension(path) === \"jsonc\",\n ...options\n });\n } catch (error) {\n if (isError(error)) {\n error.message = error.message.replace(\"JSON\", path);\n throw error;\n }\n\n throw new Error(`Failed to parse JSON: ${path}`);\n }\n}\n\nexport interface JsonWriteOptions extends JsonSerializeOptions {\n /**\n * whether to append new line at the end of JSON file\n *\n * @defaultValue false\n */\n appendNewLine?: boolean;\n}\n\n/**\n * Serializes the given data to JSON and writes it to a file.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized to JSON and written to the file\n * @param options - JSON serialize options\n */\nexport function writeJsonFileSync<T extends object = object>(\n path: string,\n data: T,\n options: JsonWriteOptions = {}\n): void {\n const serializedJson = StormJSON.stringify(data, { spaces: 2, ...options });\n\n return writeFileSync(\n path,\n options?.appendNewLine ? `${serializedJson}\\n` : serializedJson\n );\n}\n\n/**\n * Serializes the given data to JSON and writes it to a file asynchronously.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized to JSON and written to the file\n * @param options - JSON serialize options\n */\nexport async function writeJsonFile<T extends object = object>(\n path: string,\n data: T,\n options: JsonWriteOptions = {}\n): Promise<void> {\n const serializedJson = StormJSON.stringify(data, { spaces: 2, ...options });\n\n return writeFile(\n path,\n options?.appendNewLine ? `${serializedJson}\\n` : serializedJson\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAoCA,SAAgB,iBACd,MACA,SACG;CACH,MAAM,UAAU,aAAa,KAAK;AAElC,KAAI;AACF,SAAO,UAAU,MAAS,YAAY,QAAQ,GAAG,QAAQ,MAAM,GAAG,MAAM;GACtE,gBAAgB,kBAAkB,KAAK,KAAK;GAC5C,GAAG;GACJ,CAAC;UACK,OAAO;AACd,MAAI,QAAQ,MAAM,EAAE;AAClB,SAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,KAAK;AACnD,SAAM;;AAGR,QAAM,IAAI,MAAM,yBAAyB,OAAO;;;;;;;;;;AAWpD,eAAsB,aACpB,MACA,UAA4B,EAAE,EAClB;CACZ,MAAM,UAAU,MAAM,SAAS,KAAK;AAEpC,KAAI;AACF,SAAO,UAAU,MAAS,YAAY,QAAQ,GAAG,QAAQ,MAAM,GAAG,MAAM;GACtE,gBAAgB,kBAAkB,KAAK,KAAK;GAC5C,GAAG;GACJ,CAAC;UACK,OAAO;AACd,MAAI,QAAQ,MAAM,EAAE;AAClB,SAAM,UAAU,MAAM,QAAQ,QAAQ,QAAQ,KAAK;AACnD,SAAM;;AAGR,QAAM,IAAI,MAAM,yBAAyB,OAAO;;;;;;;;;;AAoBpD,SAAgB,kBACd,MACA,MACA,UAA4B,EAAE,EACxB;CACN,MAAM,iBAAiB,UAAU,UAAU,MAAM;EAAE,QAAQ;EAAG,GAAG;EAAS,CAAC;AAE3E,QAAO,cACL,MACA,SAAS,gBAAgB,GAAG,eAAe,MAAM,eAClD;;;;;;;;;AAUH,eAAsB,cACpB,MACA,MACA,UAA4B,EAAE,EACf;CACf,MAAM,iBAAiB,UAAU,UAAU,MAAM;EAAE,QAAQ;EAAG,GAAG;EAAS,CAAC;AAE3E,QAAO,UACL,MACA,SAAS,gBAAgB,GAAG,eAAe,MAAM,eAClD"}
|
package/dist/list-files.cjs
CHANGED
|
@@ -7,14 +7,6 @@ defu = require_runtime.__toESM(defu, 1);
|
|
|
7
7
|
let glob = require("glob");
|
|
8
8
|
|
|
9
9
|
//#region src/list-files.ts
|
|
10
|
-
var list_files_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
11
|
-
list: () => list,
|
|
12
|
-
listDirectories: () => listDirectories,
|
|
13
|
-
listDirectoriesSync: () => listDirectoriesSync,
|
|
14
|
-
listFiles: () => listFiles,
|
|
15
|
-
listFilesSync: () => listFilesSync,
|
|
16
|
-
listSync: () => listSync
|
|
17
|
-
});
|
|
18
10
|
const DEFAULT_OPTIONS = { dot: true };
|
|
19
11
|
/**
|
|
20
12
|
* Determines whether a string contains glob "magic" characters.
|
|
@@ -106,10 +98,4 @@ exports.listDirectories = listDirectories;
|
|
|
106
98
|
exports.listDirectoriesSync = listDirectoriesSync;
|
|
107
99
|
exports.listFiles = listFiles;
|
|
108
100
|
exports.listFilesSync = listFilesSync;
|
|
109
|
-
exports.listSync = listSync;
|
|
110
|
-
Object.defineProperty(exports, 'list_files_exports', {
|
|
111
|
-
enumerable: true,
|
|
112
|
-
get: function () {
|
|
113
|
-
return list_files_exports;
|
|
114
|
-
}
|
|
115
|
-
});
|
|
101
|
+
exports.listSync = listSync;
|
package/dist/list-files.mjs
CHANGED
|
@@ -1,18 +1,9 @@
|
|
|
1
|
-
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
2
1
|
import { hasFileExtension, joinPaths } from "@stryke/path";
|
|
3
2
|
import { isString } from "@stryke/type-checks";
|
|
4
3
|
import defu from "defu";
|
|
5
4
|
import { glob } from "glob";
|
|
6
5
|
|
|
7
6
|
//#region src/list-files.ts
|
|
8
|
-
var list_files_exports = /* @__PURE__ */ __exportAll({
|
|
9
|
-
list: () => list,
|
|
10
|
-
listDirectories: () => listDirectories,
|
|
11
|
-
listDirectoriesSync: () => listDirectoriesSync,
|
|
12
|
-
listFiles: () => listFiles,
|
|
13
|
-
listFilesSync: () => listFilesSync,
|
|
14
|
-
listSync: () => listSync
|
|
15
|
-
});
|
|
16
7
|
const DEFAULT_OPTIONS = { dot: true };
|
|
17
8
|
/**
|
|
18
9
|
* Determines whether a string contains glob "magic" characters.
|
|
@@ -99,5 +90,5 @@ function listDirectoriesSync(filesGlob, options) {
|
|
|
99
90
|
}
|
|
100
91
|
|
|
101
92
|
//#endregion
|
|
102
|
-
export { list, listDirectories, listDirectoriesSync, listFiles, listFilesSync, listSync
|
|
93
|
+
export { list, listDirectories, listDirectoriesSync, listFiles, listFilesSync, listSync };
|
|
103
94
|
//# sourceMappingURL=list-files.mjs.map
|