@stryke/fs 0.33.78 → 0.33.80
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 +24 -0
- package/dist/_virtual/_rolldown/runtime.cjs +14 -0
- package/dist/_virtual/_rolldown/runtime.mjs +18 -0
- package/dist/buffer.cjs +12 -0
- package/dist/buffer.mjs +8 -1
- package/dist/buffer.mjs.map +1 -1
- package/dist/buffer.test.cjs +13 -0
- package/dist/buffer.test.d.cts +1 -0
- package/dist/buffer.test.d.mts +1 -0
- package/dist/buffer.test.mjs +14 -0
- package/dist/buffer.test.mjs.map +1 -0
- package/dist/chmod-x.cjs +14 -0
- package/dist/chmod-x.mjs +10 -1
- package/dist/chmod-x.mjs.map +1 -1
- package/dist/chmod-x.test.cjs +13 -0
- package/dist/chmod-x.test.d.cts +1 -0
- package/dist/chmod-x.test.d.mts +1 -0
- package/dist/chmod-x.test.mjs +14 -0
- package/dist/chmod-x.test.mjs.map +1 -0
- package/dist/command-exists.cjs +11 -1
- package/dist/command-exists.mjs +6 -1
- package/dist/command-exists.mjs.map +1 -1
- package/dist/command-exists.test.cjs +13 -0
- package/dist/command-exists.test.d.cts +1 -0
- package/dist/command-exists.test.d.mts +1 -0
- package/dist/command-exists.test.mjs +14 -0
- package/dist/command-exists.test.mjs.map +1 -0
- package/dist/compress.cjs +8 -1
- package/dist/compress.mjs +3 -1
- package/dist/compress.mjs.map +1 -1
- package/dist/compress.test.cjs +13 -0
- package/dist/compress.test.d.cts +1 -0
- package/dist/compress.test.d.mts +1 -0
- package/dist/compress.test.mjs +14 -0
- package/dist/compress.test.mjs.map +1 -0
- package/dist/constants.cjs +13 -0
- package/dist/constants.mjs +8 -1
- package/dist/constants.mjs.map +1 -0
- package/dist/constants.test.cjs +13 -0
- package/dist/constants.test.d.cts +1 -0
- package/dist/constants.test.d.mts +1 -0
- package/dist/constants.test.mjs +14 -0
- package/dist/constants.test.mjs.map +1 -0
- package/dist/copy-file.cjs +13 -1
- package/dist/copy-file.mjs +8 -1
- package/dist/copy-file.mjs.map +1 -1
- package/dist/copy-file.test.cjs +13 -0
- package/dist/copy-file.test.d.cts +1 -0
- package/dist/copy-file.test.d.mts +1 -0
- package/dist/copy-file.test.mjs +14 -0
- package/dist/copy-file.test.mjs.map +1 -0
- package/dist/exists.cjs +11 -1
- package/dist/exists.mjs +6 -1
- package/dist/exists.mjs.map +1 -1
- package/dist/exists.test.cjs +13 -0
- package/dist/exists.test.d.cts +1 -0
- package/dist/exists.test.d.mts +1 -0
- package/dist/exists.test.mjs +14 -0
- package/dist/exists.test.mjs.map +1 -0
- package/dist/get-parent-path.cjs +8 -1
- package/dist/get-parent-path.mjs +3 -1
- package/dist/get-parent-path.mjs.map +1 -1
- package/dist/get-parent-path.test.cjs +13 -0
- package/dist/get-parent-path.test.d.cts +1 -0
- package/dist/get-parent-path.test.d.mts +1 -0
- package/dist/get-parent-path.test.mjs +14 -0
- package/dist/get-parent-path.test.mjs.map +1 -0
- package/dist/get-workspace-root.cjs +16 -0
- package/dist/get-workspace-root.mjs +12 -1
- package/dist/get-workspace-root.mjs.map +1 -1
- package/dist/get-workspace-root.test.cjs +13 -0
- package/dist/get-workspace-root.test.d.cts +1 -0
- package/dist/get-workspace-root.test.d.mts +1 -0
- package/dist/get-workspace-root.test.mjs +14 -0
- package/dist/get-workspace-root.test.mjs.map +1 -0
- package/dist/helpers.cjs +14 -0
- package/dist/helpers.mjs +10 -1
- package/dist/helpers.mjs.map +1 -1
- package/dist/helpers.test.cjs +13 -0
- package/dist/helpers.test.d.cts +1 -0
- package/dist/helpers.test.d.mts +1 -0
- package/dist/helpers.test.mjs +14 -0
- package/dist/helpers.test.mjs.map +1 -0
- package/dist/index.cjs +111 -0
- package/dist/index.mjs +107 -1
- package/dist/index.mjs.map +1 -0
- package/dist/index.test.cjs +13 -0
- package/dist/index.test.d.cts +1 -0
- package/dist/index.test.d.mts +1 -0
- package/dist/index.test.mjs +14 -0
- package/dist/index.test.mjs.map +1 -0
- package/dist/install.cjs +10 -0
- package/dist/install.mjs +6 -1
- package/dist/install.mjs.map +1 -1
- package/dist/install.test.cjs +13 -0
- package/dist/install.test.d.cts +1 -0
- package/dist/install.test.d.mts +1 -0
- package/dist/install.test.mjs +14 -0
- package/dist/install.test.mjs.map +1 -0
- package/dist/is-file.cjs +13 -1
- package/dist/is-file.mjs +8 -1
- package/dist/is-file.mjs.map +1 -1
- package/dist/is-file.test.cjs +13 -0
- package/dist/is-file.test.d.cts +1 -0
- package/dist/is-file.test.d.mts +1 -0
- package/dist/is-file.test.mjs +14 -0
- package/dist/is-file.test.mjs.map +1 -0
- package/dist/json.cjs +12 -0
- package/dist/json.mjs +8 -1
- package/dist/json.mjs.map +1 -1
- package/dist/json.test.cjs +13 -0
- package/dist/json.test.d.cts +1 -0
- package/dist/json.test.d.mts +1 -0
- package/dist/json.test.mjs +14 -0
- package/dist/json.test.mjs.map +1 -0
- package/dist/list-files.cjs +15 -1
- package/dist/list-files.mjs +10 -1
- package/dist/list-files.mjs.map +1 -1
- package/dist/list-files.test.cjs +13 -0
- package/dist/list-files.test.d.cts +1 -0
- package/dist/list-files.test.d.mts +1 -0
- package/dist/list-files.test.mjs +14 -0
- package/dist/list-files.test.mjs.map +1 -0
- package/dist/package-fns.cjs +16 -1
- package/dist/package-fns.mjs +11 -1
- package/dist/package-fns.mjs.map +1 -1
- package/dist/package-fns.test.cjs +13 -0
- package/dist/package-fns.test.d.cts +1 -0
- package/dist/package-fns.test.d.mts +1 -0
- package/dist/package-fns.test.mjs +14 -0
- package/dist/package-fns.test.mjs.map +1 -0
- package/dist/read-file.cjs +13 -1
- package/dist/read-file.mjs +8 -1
- package/dist/read-file.mjs.map +1 -1
- package/dist/read-file.test.cjs +13 -0
- package/dist/read-file.test.d.cts +1 -0
- package/dist/read-file.test.d.mts +1 -0
- package/dist/read-file.test.mjs +14 -0
- package/dist/read-file.test.mjs.map +1 -0
- package/dist/registry.cjs +13 -0
- package/dist/registry.mjs +9 -1
- package/dist/registry.mjs.map +1 -1
- package/dist/registry.test.cjs +13 -0
- package/dist/registry.test.d.cts +1 -0
- package/dist/registry.test.d.mts +1 -0
- package/dist/registry.test.mjs +14 -0
- package/dist/registry.test.mjs.map +1 -0
- package/dist/remove-file.cjs +11 -1
- package/dist/remove-file.mjs +6 -1
- package/dist/remove-file.mjs.map +1 -1
- package/dist/remove-file.test.cjs +13 -0
- package/dist/remove-file.test.d.cts +1 -0
- package/dist/remove-file.test.d.mts +1 -0
- package/dist/remove-file.test.mjs +14 -0
- package/dist/remove-file.test.mjs.map +1 -0
- package/dist/resolve.cjs +20 -1
- package/dist/resolve.mjs +15 -1
- package/dist/resolve.mjs.map +1 -1
- package/dist/resolve.test.cjs +13 -0
- package/dist/resolve.test.d.cts +1 -0
- package/dist/resolve.test.d.mts +1 -0
- package/dist/resolve.test.mjs +14 -0
- package/dist/resolve.test.mjs.map +1 -0
- package/dist/semver-fns.cjs +20 -1
- package/dist/semver-fns.mjs +15 -1
- package/dist/semver-fns.mjs.map +1 -1
- package/dist/semver-fns.test.cjs +13 -0
- package/dist/semver-fns.test.d.cts +1 -0
- package/dist/semver-fns.test.d.mts +1 -0
- package/dist/semver-fns.test.mjs +14 -0
- package/dist/semver-fns.test.mjs.map +1 -0
- package/dist/toml.cjs +12 -0
- package/dist/toml.mjs +8 -1
- package/dist/toml.mjs.map +1 -1
- package/dist/toml.test.cjs +13 -0
- package/dist/toml.test.d.cts +1 -0
- package/dist/toml.test.d.mts +1 -0
- package/dist/toml.test.mjs +14 -0
- package/dist/toml.test.mjs.map +1 -0
- package/dist/tsconfig.cjs +8 -1
- package/dist/tsconfig.mjs +3 -1
- package/dist/tsconfig.mjs.map +1 -1
- package/dist/tsconfig.test.cjs +13 -0
- package/dist/tsconfig.test.d.cts +1 -0
- package/dist/tsconfig.test.d.mts +1 -0
- package/dist/tsconfig.test.mjs +14 -0
- package/dist/tsconfig.test.mjs.map +1 -0
- package/dist/write-file.cjs +11 -1
- package/dist/write-file.mjs +6 -1
- package/dist/write-file.mjs.map +1 -1
- package/dist/write-file.test.cjs +13 -0
- package/dist/write-file.test.d.cts +1 -0
- package/dist/write-file.test.d.mts +1 -0
- package/dist/write-file.test.mjs +14 -0
- package/dist/write-file.test.mjs.map +1 -0
- package/dist/yaml.cjs +11 -1
- package/dist/yaml.mjs +6 -1
- package/dist/yaml.mjs.map +1 -1
- package/dist/yaml.test.cjs +13 -0
- package/dist/yaml.test.d.cts +1 -0
- package/dist/yaml.test.d.mts +1 -0
- package/dist/yaml.test.mjs +14 -0
- package/dist/yaml.test.mjs.map +1 -0
- package/package.json +110 -10
package/dist/copy-file.cjs
CHANGED
|
@@ -15,6 +15,12 @@ let _stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path
|
|
|
15
15
|
let mlly = require("mlly");
|
|
16
16
|
|
|
17
17
|
//#region src/copy-file.ts
|
|
18
|
+
var copy_file_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
19
|
+
copyFile: () => copyFile,
|
|
20
|
+
copyFileSync: () => copyFileSync,
|
|
21
|
+
copyFiles: () => copyFiles,
|
|
22
|
+
copyFilesSync: () => copyFilesSync
|
|
23
|
+
});
|
|
18
24
|
/**
|
|
19
25
|
* Copy a file from one location to another
|
|
20
26
|
*
|
|
@@ -84,4 +90,10 @@ function copyFilesSync(source, destination) {
|
|
|
84
90
|
exports.copyFile = copyFile;
|
|
85
91
|
exports.copyFileSync = copyFileSync;
|
|
86
92
|
exports.copyFiles = copyFiles;
|
|
87
|
-
exports.copyFilesSync = copyFilesSync;
|
|
93
|
+
exports.copyFilesSync = copyFilesSync;
|
|
94
|
+
Object.defineProperty(exports, 'copy_file_exports', {
|
|
95
|
+
enumerable: true,
|
|
96
|
+
get: function () {
|
|
97
|
+
return copy_file_exports;
|
|
98
|
+
}
|
|
99
|
+
});
|
package/dist/copy-file.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
1
2
|
import { existsSync as existsSync$1 } from "./exists.mjs";
|
|
2
3
|
import { createDirectory, createDirectorySync } from "./helpers.mjs";
|
|
3
4
|
import { isDirectory, isFile } from "./is-file.mjs";
|
|
@@ -13,6 +14,12 @@ import { resolveParentPath } from "@stryke/path/resolve-parent-path";
|
|
|
13
14
|
import { fileURLToPath } from "mlly";
|
|
14
15
|
|
|
15
16
|
//#region src/copy-file.ts
|
|
17
|
+
var copy_file_exports = /* @__PURE__ */ __exportAll({
|
|
18
|
+
copyFile: () => copyFile,
|
|
19
|
+
copyFileSync: () => copyFileSync,
|
|
20
|
+
copyFiles: () => copyFiles,
|
|
21
|
+
copyFilesSync: () => copyFilesSync
|
|
22
|
+
});
|
|
16
23
|
/**
|
|
17
24
|
* Copy a file from one location to another
|
|
18
25
|
*
|
|
@@ -79,5 +86,5 @@ function copyFilesSync(source, destination) {
|
|
|
79
86
|
}
|
|
80
87
|
|
|
81
88
|
//#endregion
|
|
82
|
-
export { copyFile, copyFileSync, copyFiles, copyFilesSync };
|
|
89
|
+
export { copyFile, copyFileSync, copyFiles, copyFilesSync, copy_file_exports };
|
|
83
90
|
//# sourceMappingURL=copy-file.mjs.map
|
package/dist/copy-file.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copy-file.mjs","names":["existsSync","cpf","cpfSync"],"sources":["../src/copy-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 { stripStars } from \"@stryke/path/correct-path\";\nimport { findFilePath, hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isString } from \"@stryke/type-checks\";\nimport type { AssetGlob } from \"@stryke/types/file\";\nimport { fileURLToPath } from \"mlly\";\nimport { copyFileSync as cpfSync } from \"node:fs\";\nimport { copyFile as cpf } from \"node:fs/promises\";\nimport { existsSync } from \"./exists\";\nimport { createDirectory, createDirectorySync } from \"./helpers\";\nimport { isDirectory, isFile } from \"./is-file\";\nimport { listFiles, listFilesSync } from \"./list-files\";\n\n/**\n * Copy a file from one location to another\n *\n * @param source - The file to copy, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport async function copyFile(\n source: string | URL,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (!hasFileExtension(dest)) {\n if (!existsSync(resolveParentPath(dest))) {\n await createDirectory(resolveParentPath(dest));\n }\n } else if (!existsSync(findFilePath(dest))) {\n await createDirectory(findFilePath(dest));\n }\n\n if (isString(src) && existsSync(src)) {\n return cpf(src, dest);\n }\n}\n\n/**\n * Synchronously copy a file from one location to another\n *\n * @param source - The file to copy, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport function copyFileSync(source: string | URL, destination: string | URL) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (!hasFileExtension(dest)) {\n if (!existsSync(resolveParentPath(dest))) {\n createDirectorySync(resolveParentPath(dest));\n }\n } else if (!existsSync(findFilePath(dest))) {\n createDirectorySync(findFilePath(dest));\n }\n\n if (isString(src) && existsSync(src)) {\n return cpfSync(src, dest);\n }\n}\n\n/**\n * Copy files from one location to another\n *\n * @param source - The source location, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport async function copyFiles(\n source: string | URL | Omit<AssetGlob, \"output\">,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (isString(src) && isFile(src)) {\n return copyFile(src, dest);\n }\n\n return Promise.all(\n (await listFiles(src)).map(async entryPath => {\n const destFile = joinPaths(\n dest,\n replacePath(entryPath, isString(src) ? stripStars(src) : src.input)\n );\n\n if (isDirectory(entryPath)) {\n await copyFiles(entryPath, destFile);\n } else {\n await copyFile(entryPath, destFile);\n }\n })\n );\n}\n\n/**\n * Synchronously copy files from one location to another\n *\n * @param source - The source location, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport function copyFilesSync(\n source: string | URL | Omit<AssetGlob, \"output\">,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (isString(src) && isFile(src)) {\n return copyFileSync(src, dest);\n }\n\n return listFilesSync(src).map(entryPath => {\n const destFile = joinPaths(\n dest,\n replacePath(entryPath, isString(src) ? stripStars(src) : src.input)\n );\n\n if (isDirectory(entryPath)) {\n copyFilesSync(entryPath, destFile);\n } else {\n copyFileSync(entryPath, destFile);\n }\n });\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"copy-file.mjs","names":["existsSync","cpf","cpfSync"],"sources":["../src/copy-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 { stripStars } from \"@stryke/path/correct-path\";\nimport { findFilePath, hasFileExtension } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isString } from \"@stryke/type-checks\";\nimport type { AssetGlob } from \"@stryke/types/file\";\nimport { fileURLToPath } from \"mlly\";\nimport { copyFileSync as cpfSync } from \"node:fs\";\nimport { copyFile as cpf } from \"node:fs/promises\";\nimport { existsSync } from \"./exists\";\nimport { createDirectory, createDirectorySync } from \"./helpers\";\nimport { isDirectory, isFile } from \"./is-file\";\nimport { listFiles, listFilesSync } from \"./list-files\";\n\n/**\n * Copy a file from one location to another\n *\n * @param source - The file to copy, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport async function copyFile(\n source: string | URL,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (!hasFileExtension(dest)) {\n if (!existsSync(resolveParentPath(dest))) {\n await createDirectory(resolveParentPath(dest));\n }\n } else if (!existsSync(findFilePath(dest))) {\n await createDirectory(findFilePath(dest));\n }\n\n if (isString(src) && existsSync(src)) {\n return cpf(src, dest);\n }\n}\n\n/**\n * Synchronously copy a file from one location to another\n *\n * @param source - The file to copy, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport function copyFileSync(source: string | URL, destination: string | URL) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (!hasFileExtension(dest)) {\n if (!existsSync(resolveParentPath(dest))) {\n createDirectorySync(resolveParentPath(dest));\n }\n } else if (!existsSync(findFilePath(dest))) {\n createDirectorySync(findFilePath(dest));\n }\n\n if (isString(src) && existsSync(src)) {\n return cpfSync(src, dest);\n }\n}\n\n/**\n * Copy files from one location to another\n *\n * @param source - The source location, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport async function copyFiles(\n source: string | URL | Omit<AssetGlob, \"output\">,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (isString(src) && isFile(src)) {\n return copyFile(src, dest);\n }\n\n return Promise.all(\n (await listFiles(src)).map(async entryPath => {\n const destFile = joinPaths(\n dest,\n replacePath(entryPath, isString(src) ? stripStars(src) : src.input)\n );\n\n if (isDirectory(entryPath)) {\n await copyFiles(entryPath, destFile);\n } else {\n await copyFile(entryPath, destFile);\n }\n })\n );\n}\n\n/**\n * Synchronously copy files from one location to another\n *\n * @param source - The source location, this can be a file, directory, URL, or glob pattern\n * @param destination - The destination location\n * @returns An indicator specifying if the copy was successful\n */\nexport function copyFilesSync(\n source: string | URL | Omit<AssetGlob, \"output\">,\n destination: string | URL\n) {\n const src = source instanceof URL ? fileURLToPath(source) : source;\n const dest =\n destination instanceof URL ? fileURLToPath(destination) : destination;\n\n if (isString(src) && isFile(src)) {\n return copyFileSync(src, dest);\n }\n\n return listFilesSync(src).map(entryPath => {\n const destFile = joinPaths(\n dest,\n replacePath(entryPath, isString(src) ? stripStars(src) : src.input)\n );\n\n if (isDirectory(entryPath)) {\n copyFilesSync(entryPath, destFile);\n } else {\n copyFileSync(entryPath, destFile);\n }\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,eAAsB,SACpB,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,CAAC,iBAAiB,KAAK,EACzB;MAAI,CAACA,aAAW,kBAAkB,KAAK,CAAC,CACtC,OAAM,gBAAgB,kBAAkB,KAAK,CAAC;YAEvC,CAACA,aAAW,aAAa,KAAK,CAAC,CACxC,OAAM,gBAAgB,aAAa,KAAK,CAAC;AAG3C,KAAI,SAAS,IAAI,IAAIA,aAAW,IAAI,CAClC,QAAOC,WAAI,KAAK,KAAK;;;;;;;;;AAWzB,SAAgB,aAAa,QAAsB,aAA2B;CAC5E,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,CAAC,iBAAiB,KAAK,EACzB;MAAI,CAACD,aAAW,kBAAkB,KAAK,CAAC,CACtC,qBAAoB,kBAAkB,KAAK,CAAC;YAErC,CAACA,aAAW,aAAa,KAAK,CAAC,CACxC,qBAAoB,aAAa,KAAK,CAAC;AAGzC,KAAI,SAAS,IAAI,IAAIA,aAAW,IAAI,CAClC,QAAOE,eAAQ,KAAK,KAAK;;;;;;;;;AAW7B,eAAsB,UACpB,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,SAAS,IAAI,IAAI,OAAO,IAAI,CAC9B,QAAO,SAAS,KAAK,KAAK;AAG5B,QAAO,QAAQ,KACZ,MAAM,UAAU,IAAI,EAAE,IAAI,OAAM,cAAa;EAC5C,MAAM,WAAW,UACf,MACA,YAAY,WAAW,SAAS,IAAI,GAAG,WAAW,IAAI,GAAG,IAAI,MAAM,CACpE;AAED,MAAI,YAAY,UAAU,CACxB,OAAM,UAAU,WAAW,SAAS;MAEpC,OAAM,SAAS,WAAW,SAAS;GAErC,CACH;;;;;;;;;AAUH,SAAgB,cACd,QACA,aACA;CACA,MAAM,MAAM,kBAAkB,MAAM,cAAc,OAAO,GAAG;CAC5D,MAAM,OACJ,uBAAuB,MAAM,cAAc,YAAY,GAAG;AAE5D,KAAI,SAAS,IAAI,IAAI,OAAO,IAAI,CAC9B,QAAO,aAAa,KAAK,KAAK;AAGhC,QAAO,cAAc,IAAI,CAAC,KAAI,cAAa;EACzC,MAAM,WAAW,UACf,MACA,YAAY,WAAW,SAAS,IAAI,GAAG,WAAW,IAAI,GAAG,IAAI,MAAM,CACpE;AAED,MAAI,YAAY,UAAU,CACxB,eAAc,WAAW,SAAS;MAElC,cAAa,WAAW,SAAS;GAEnC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_copy_file = require('./copy-file.cjs');
|
|
3
|
+
let vitest = require("vitest");
|
|
4
|
+
|
|
5
|
+
//#region src/copy-file.test.ts
|
|
6
|
+
(0, vitest.describe)("copy-file.ts exports", () => {
|
|
7
|
+
(0, vitest.it)("loads module exports", () => {
|
|
8
|
+
(0, vitest.expect)(require_copy_file.copy_file_exports).toBeDefined();
|
|
9
|
+
(0, vitest.expect)(typeof require_copy_file.copy_file_exports).toBe("object");
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { copy_file_exports } from "./copy-file.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/copy-file.test.ts
|
|
5
|
+
describe("copy-file.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(copy_file_exports).toBeDefined();
|
|
8
|
+
expect(typeof copy_file_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=copy-file.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"copy-file.test.mjs","names":["moduleExports"],"sources":["../src/copy-file.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./copy-file.ts\";\n\ndescribe(\"copy-file.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,8BAA8B;AACrC,IAAG,8BAA8B;AAC/B,SAAOA,kBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,kBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
package/dist/exists.cjs
CHANGED
|
@@ -4,6 +4,10 @@ let node_fs = require("node:fs");
|
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
5
5
|
|
|
6
6
|
//#region src/exists.ts
|
|
7
|
+
var exists_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
8
|
+
exists: () => exists,
|
|
9
|
+
existsSync: () => existsSync
|
|
10
|
+
});
|
|
7
11
|
/**
|
|
8
12
|
* Check if a file exists
|
|
9
13
|
*
|
|
@@ -25,4 +29,10 @@ async function exists(filePath) {
|
|
|
25
29
|
|
|
26
30
|
//#endregion
|
|
27
31
|
exports.exists = exists;
|
|
28
|
-
exports.existsSync = existsSync;
|
|
32
|
+
exports.existsSync = existsSync;
|
|
33
|
+
Object.defineProperty(exports, 'exists_exports', {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return exists_exports;
|
|
37
|
+
}
|
|
38
|
+
});
|
package/dist/exists.mjs
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
1
2
|
import { existsSync as existsSync$1 } from "node:fs";
|
|
2
3
|
import { access, constants as constants$1 } from "node:fs/promises";
|
|
3
4
|
|
|
4
5
|
//#region src/exists.ts
|
|
6
|
+
var exists_exports = /* @__PURE__ */ __exportAll({
|
|
7
|
+
exists: () => exists,
|
|
8
|
+
existsSync: () => existsSync
|
|
9
|
+
});
|
|
5
10
|
/**
|
|
6
11
|
* Check if a file exists
|
|
7
12
|
*
|
|
@@ -22,5 +27,5 @@ async function exists(filePath) {
|
|
|
22
27
|
}
|
|
23
28
|
|
|
24
29
|
//#endregion
|
|
25
|
-
export { exists, existsSync };
|
|
30
|
+
export { exists, existsSync, exists_exports };
|
|
26
31
|
//# sourceMappingURL=exists.mjs.map
|
package/dist/exists.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exists.mjs","names":["existsSyncFs","constants"],"sources":["../src/exists.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 { existsSync as existsSyncFs } from \"node:fs\";\nimport { access, constants } from \"node:fs/promises\";\n\n/**\n * Check if a file exists\n *\n * @param filePath - The file path to check\n * @returns An indicator specifying if the file exists\n */\nexport function existsSync(filePath: string): boolean {\n return existsSyncFs(filePath);\n}\n\n/**\n * Check if a file exists\n *\n * @param filePath - The file path to check\n * @returns An indicator specifying if the file exists\n */\nexport async function exists(filePath: string): Promise<boolean> {\n return access(filePath, constants.F_OK)\n .then(() => true)\n .catch(() => false);\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"exists.mjs","names":["existsSyncFs","constants"],"sources":["../src/exists.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 { existsSync as existsSyncFs } from \"node:fs\";\nimport { access, constants } from \"node:fs/promises\";\n\n/**\n * Check if a file exists\n *\n * @param filePath - The file path to check\n * @returns An indicator specifying if the file exists\n */\nexport function existsSync(filePath: string): boolean {\n return existsSyncFs(filePath);\n}\n\n/**\n * Check if a file exists\n *\n * @param filePath - The file path to check\n * @returns An indicator specifying if the file exists\n */\nexport async function exists(filePath: string): Promise<boolean> {\n return access(filePath, constants.F_OK)\n .then(() => true)\n .catch(() => false);\n}\n"],"mappings":";;;;;;;;;;;;;;;AA2BA,SAAgB,WAAW,UAA2B;AACpD,QAAOA,aAAa,SAAS;;;;;;;;AAS/B,eAAsB,OAAO,UAAoC;AAC/D,QAAO,OAAO,UAAUC,YAAU,KAAK,CACpC,WAAW,KAAK,CAChB,YAAY,MAAM"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_exists = require('./exists.cjs');
|
|
3
|
+
let vitest = require("vitest");
|
|
4
|
+
|
|
5
|
+
//#region src/exists.test.ts
|
|
6
|
+
(0, vitest.describe)("exists.ts exports", () => {
|
|
7
|
+
(0, vitest.it)("loads module exports", () => {
|
|
8
|
+
(0, vitest.expect)(require_exists.exists_exports).toBeDefined();
|
|
9
|
+
(0, vitest.expect)(typeof require_exists.exists_exports).toBe("object");
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { exists_exports } from "./exists.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/exists.test.ts
|
|
5
|
+
describe("exists.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(exists_exports).toBeDefined();
|
|
8
|
+
expect(typeof exists_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=exists.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exists.test.mjs","names":["moduleExports"],"sources":["../src/exists.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./exists.ts\";\n\ndescribe(\"exists.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,2BAA2B;AAClC,IAAG,8BAA8B;AAC/B,SAAOA,eAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,eAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
package/dist/get-parent-path.cjs
CHANGED
|
@@ -8,6 +8,7 @@ let _stryke_convert_to_array = require("@stryke/convert/to-array");
|
|
|
8
8
|
let _stryke_path_cwd = require("@stryke/path/cwd");
|
|
9
9
|
|
|
10
10
|
//#region src/get-parent-path.ts
|
|
11
|
+
var get_parent_path_exports = /* @__PURE__ */ require_runtime.__exportAll({ getParentPath: () => getParentPath });
|
|
11
12
|
/**
|
|
12
13
|
* Get the first parent path that has a file or directory with the provided name.
|
|
13
14
|
*
|
|
@@ -33,4 +34,10 @@ const getParentPath = (name, cwd = (0, _stryke_path_cwd.cwd)(), options = {}) =>
|
|
|
33
34
|
};
|
|
34
35
|
|
|
35
36
|
//#endregion
|
|
36
|
-
exports.getParentPath = getParentPath;
|
|
37
|
+
exports.getParentPath = getParentPath;
|
|
38
|
+
Object.defineProperty(exports, 'get_parent_path_exports', {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () {
|
|
41
|
+
return get_parent_path_exports;
|
|
42
|
+
}
|
|
43
|
+
});
|
package/dist/get-parent-path.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
1
2
|
import { isDirectory } from "./is-file.mjs";
|
|
2
3
|
import { existsSync } from "node:fs";
|
|
3
4
|
import { joinPaths } from "@stryke/path/join-paths";
|
|
@@ -6,6 +7,7 @@ import { toArray } from "@stryke/convert/to-array";
|
|
|
6
7
|
import { cwd } from "@stryke/path/cwd";
|
|
7
8
|
|
|
8
9
|
//#region src/get-parent-path.ts
|
|
10
|
+
var get_parent_path_exports = /* @__PURE__ */ __exportAll({ getParentPath: () => getParentPath });
|
|
9
11
|
/**
|
|
10
12
|
* Get the first parent path that has a file or directory with the provided name.
|
|
11
13
|
*
|
|
@@ -31,5 +33,5 @@ const getParentPath = (name, cwd$1 = cwd(), options = {}) => {
|
|
|
31
33
|
};
|
|
32
34
|
|
|
33
35
|
//#endregion
|
|
34
|
-
export { getParentPath };
|
|
36
|
+
export { getParentPath, get_parent_path_exports };
|
|
35
37
|
//# sourceMappingURL=get-parent-path.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-parent-path.mjs","names":["currentDir","cwd"],"sources":["../src/get-parent-path.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 { toArray } from \"@stryke/convert/to-array\";\nimport { cwd as currentDir } from \"@stryke/path/cwd\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { existsSync } from \"node:fs\";\nimport { isDirectory } from \"./is-file\";\n\nexport interface GetParentPathOptions {\n /**\n * Whether to ignore the case of the file names when checking for existence.\n *\n * @defaultValue true\n */\n ignoreCase: boolean;\n\n /**\n * Whether to skip the current working directory when checking for the file.\n *\n * @defaultValue false\n */\n skipCwd: boolean;\n\n /**\n * Should we include the found file/directory name in the results.\n *\n * @defaultValue false\n */\n includeNameInResults?: boolean;\n}\n\n/**\n * Get the first parent path that has a file or directory with the provided name.\n *\n * @param name - The name (or names) of the file to look for in the parent paths.\n * @param cwd - The current working directory.\n * @returns The first parent path that exists.\n */\nexport const getParentPath = (\n name: string | string[],\n cwd = currentDir(),\n options: Partial<GetParentPathOptions> = {}\n): string | undefined => {\n const ignoreCase = options?.ignoreCase ?? true;\n const skipCwd = options?.skipCwd ?? false;\n const includeNameInResults = options?.includeNameInResults ?? false;\n\n let dir = cwd;\n if (skipCwd) {\n dir = resolveParentPath(cwd);\n }\n\n let names = toArray(name);\n if (ignoreCase) {\n names = names.map(name => name.toLowerCase());\n }\n\n while (true) {\n const target = names.find(name => existsSync(joinPaths(dir, name)));\n if (target) {\n return includeNameInResults || isDirectory(joinPaths(dir, target))\n ? joinPaths(dir, target)\n : dir;\n }\n\n const parentDir = resolveParentPath(dir);\n if (parentDir === dir) {\n // It'll fail anyway\n return undefined;\n }\n\n dir = parentDir;\n }\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-parent-path.mjs","names":["currentDir","cwd"],"sources":["../src/get-parent-path.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 { toArray } from \"@stryke/convert/to-array\";\nimport { cwd as currentDir } from \"@stryke/path/cwd\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { existsSync } from \"node:fs\";\nimport { isDirectory } from \"./is-file\";\n\nexport interface GetParentPathOptions {\n /**\n * Whether to ignore the case of the file names when checking for existence.\n *\n * @defaultValue true\n */\n ignoreCase: boolean;\n\n /**\n * Whether to skip the current working directory when checking for the file.\n *\n * @defaultValue false\n */\n skipCwd: boolean;\n\n /**\n * Should we include the found file/directory name in the results.\n *\n * @defaultValue false\n */\n includeNameInResults?: boolean;\n}\n\n/**\n * Get the first parent path that has a file or directory with the provided name.\n *\n * @param name - The name (or names) of the file to look for in the parent paths.\n * @param cwd - The current working directory.\n * @returns The first parent path that exists.\n */\nexport const getParentPath = (\n name: string | string[],\n cwd = currentDir(),\n options: Partial<GetParentPathOptions> = {}\n): string | undefined => {\n const ignoreCase = options?.ignoreCase ?? true;\n const skipCwd = options?.skipCwd ?? false;\n const includeNameInResults = options?.includeNameInResults ?? false;\n\n let dir = cwd;\n if (skipCwd) {\n dir = resolveParentPath(cwd);\n }\n\n let names = toArray(name);\n if (ignoreCase) {\n names = names.map(name => name.toLowerCase());\n }\n\n while (true) {\n const target = names.find(name => existsSync(joinPaths(dir, name)));\n if (target) {\n return includeNameInResults || isDirectory(joinPaths(dir, target))\n ? joinPaths(dir, target)\n : dir;\n }\n\n const parentDir = resolveParentPath(dir);\n if (parentDir === dir) {\n // It'll fail anyway\n return undefined;\n }\n\n dir = parentDir;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAuDA,MAAa,iBACX,MACA,QAAMA,KAAY,EAClB,UAAyC,EAAE,KACpB;CACvB,MAAM,aAAa,SAAS,cAAc;CAC1C,MAAM,UAAU,SAAS,WAAW;CACpC,MAAM,uBAAuB,SAAS,wBAAwB;CAE9D,IAAI,MAAMC;AACV,KAAI,QACF,OAAM,kBAAkBA,MAAI;CAG9B,IAAI,QAAQ,QAAQ,KAAK;AACzB,KAAI,WACF,SAAQ,MAAM,KAAI,SAAQ,KAAK,aAAa,CAAC;AAG/C,QAAO,MAAM;EACX,MAAM,SAAS,MAAM,MAAK,SAAQ,WAAW,UAAU,KAAK,KAAK,CAAC,CAAC;AACnE,MAAI,OACF,QAAO,wBAAwB,YAAY,UAAU,KAAK,OAAO,CAAC,GAC9D,UAAU,KAAK,OAAO,GACtB;EAGN,MAAM,YAAY,kBAAkB,IAAI;AACxC,MAAI,cAAc,IAEhB;AAGF,QAAM"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_get_parent_path = require('./get-parent-path.cjs');
|
|
3
|
+
let vitest = require("vitest");
|
|
4
|
+
|
|
5
|
+
//#region src/get-parent-path.test.ts
|
|
6
|
+
(0, vitest.describe)("get-parent-path.ts exports", () => {
|
|
7
|
+
(0, vitest.it)("loads module exports", () => {
|
|
8
|
+
(0, vitest.expect)(require_get_parent_path.get_parent_path_exports).toBeDefined();
|
|
9
|
+
(0, vitest.expect)(typeof require_get_parent_path.get_parent_path_exports).toBe("object");
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { get_parent_path_exports } from "./get-parent-path.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/get-parent-path.test.ts
|
|
5
|
+
describe("get-parent-path.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(get_parent_path_exports).toBeDefined();
|
|
8
|
+
expect(typeof get_parent_path_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=get-parent-path.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-parent-path.test.mjs","names":["moduleExports"],"sources":["../src/get-parent-path.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./get-parent-path.ts\";\n\ndescribe(\"get-parent-path.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,oCAAoC;AAC3C,IAAG,8BAA8B;AAC/B,SAAOA,wBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,wBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
|
@@ -7,6 +7,16 @@ let _storm_software_config_tools = require("@storm-software/config-tools");
|
|
|
7
7
|
let _stryke_path_is_root_dir = require("@stryke/path/is-root-dir");
|
|
8
8
|
|
|
9
9
|
//#region src/get-workspace-root.ts
|
|
10
|
+
var get_workspace_root_exports = /* @__PURE__ */ require_runtime.__exportAll({
|
|
11
|
+
PROJECT_ROOT_CONTENT: () => PROJECT_ROOT_CONTENT,
|
|
12
|
+
WORKSPACE_ROOT_CONTENT: () => WORKSPACE_ROOT_CONTENT,
|
|
13
|
+
getProjectRoot: () => getProjectRoot,
|
|
14
|
+
getWorkspaceRoot: () => getWorkspaceRoot,
|
|
15
|
+
isProjectRoot: () => isProjectRoot,
|
|
16
|
+
isWorkspaceRoot: () => isWorkspaceRoot,
|
|
17
|
+
relativeToProjectRoot: () => relativeToProjectRoot,
|
|
18
|
+
relativeToWorkspaceRoot: () => relativeToWorkspaceRoot
|
|
19
|
+
});
|
|
10
20
|
const WORKSPACE_ROOT_CONTENT = [
|
|
11
21
|
".all-contributorsrc",
|
|
12
22
|
".commitlintrc",
|
|
@@ -153,6 +163,12 @@ exports.PROJECT_ROOT_CONTENT = PROJECT_ROOT_CONTENT;
|
|
|
153
163
|
exports.WORKSPACE_ROOT_CONTENT = WORKSPACE_ROOT_CONTENT;
|
|
154
164
|
exports.getProjectRoot = getProjectRoot;
|
|
155
165
|
exports.getWorkspaceRoot = getWorkspaceRoot;
|
|
166
|
+
Object.defineProperty(exports, 'get_workspace_root_exports', {
|
|
167
|
+
enumerable: true,
|
|
168
|
+
get: function () {
|
|
169
|
+
return get_workspace_root_exports;
|
|
170
|
+
}
|
|
171
|
+
});
|
|
156
172
|
exports.isProjectRoot = isProjectRoot;
|
|
157
173
|
exports.isWorkspaceRoot = isWorkspaceRoot;
|
|
158
174
|
exports.relativeToProjectRoot = relativeToProjectRoot;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
1
2
|
import { getParentPath } from "./get-parent-path.mjs";
|
|
2
3
|
import { relativePath } from "@stryke/path/file-path-fns";
|
|
3
4
|
import { cwd } from "@stryke/path/cwd";
|
|
@@ -5,6 +6,16 @@ import { findWorkspaceRootSafe } from "@storm-software/config-tools";
|
|
|
5
6
|
import { isSystemRoot } from "@stryke/path/is-root-dir";
|
|
6
7
|
|
|
7
8
|
//#region src/get-workspace-root.ts
|
|
9
|
+
var get_workspace_root_exports = /* @__PURE__ */ __exportAll({
|
|
10
|
+
PROJECT_ROOT_CONTENT: () => PROJECT_ROOT_CONTENT,
|
|
11
|
+
WORKSPACE_ROOT_CONTENT: () => WORKSPACE_ROOT_CONTENT,
|
|
12
|
+
getProjectRoot: () => getProjectRoot,
|
|
13
|
+
getWorkspaceRoot: () => getWorkspaceRoot,
|
|
14
|
+
isProjectRoot: () => isProjectRoot,
|
|
15
|
+
isWorkspaceRoot: () => isWorkspaceRoot,
|
|
16
|
+
relativeToProjectRoot: () => relativeToProjectRoot,
|
|
17
|
+
relativeToWorkspaceRoot: () => relativeToWorkspaceRoot
|
|
18
|
+
});
|
|
8
19
|
const WORKSPACE_ROOT_CONTENT = [
|
|
9
20
|
".all-contributorsrc",
|
|
10
21
|
".commitlintrc",
|
|
@@ -147,5 +158,5 @@ function relativeToProjectRoot(filePath) {
|
|
|
147
158
|
}
|
|
148
159
|
|
|
149
160
|
//#endregion
|
|
150
|
-
export { PROJECT_ROOT_CONTENT, WORKSPACE_ROOT_CONTENT, getProjectRoot, getWorkspaceRoot, isProjectRoot, isWorkspaceRoot, relativeToProjectRoot, relativeToWorkspaceRoot };
|
|
161
|
+
export { PROJECT_ROOT_CONTENT, WORKSPACE_ROOT_CONTENT, getProjectRoot, getWorkspaceRoot, get_workspace_root_exports, isProjectRoot, isWorkspaceRoot, relativeToProjectRoot, relativeToWorkspaceRoot };
|
|
151
162
|
//# sourceMappingURL=get-workspace-root.mjs.map
|
|
@@ -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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_get_workspace_root = require('./get-workspace-root.cjs');
|
|
3
|
+
let vitest = require("vitest");
|
|
4
|
+
|
|
5
|
+
//#region src/get-workspace-root.test.ts
|
|
6
|
+
(0, vitest.describe)("get-workspace-root.ts exports", () => {
|
|
7
|
+
(0, vitest.it)("loads module exports", () => {
|
|
8
|
+
(0, vitest.expect)(require_get_workspace_root.get_workspace_root_exports).toBeDefined();
|
|
9
|
+
(0, vitest.expect)(typeof require_get_workspace_root.get_workspace_root_exports).toBe("object");
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { get_workspace_root_exports } from "./get-workspace-root.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/get-workspace-root.test.ts
|
|
5
|
+
describe("get-workspace-root.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(get_workspace_root_exports).toBeDefined();
|
|
8
|
+
expect(typeof get_workspace_root_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=get-workspace-root.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-workspace-root.test.mjs","names":["moduleExports"],"sources":["../src/get-workspace-root.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./get-workspace-root.ts\";\n\ndescribe(\"get-workspace-root.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,uCAAuC;AAC9C,IAAG,8BAA8B;AAC/B,SAAOA,2BAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,2BAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|
package/dist/helpers.cjs
CHANGED
|
@@ -6,6 +6,14 @@ 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
|
+
});
|
|
9
17
|
/**
|
|
10
18
|
* Create a directory if it does not exist.
|
|
11
19
|
*
|
|
@@ -80,5 +88,11 @@ exports.createDirectory = createDirectory;
|
|
|
80
88
|
exports.createDirectorySync = createDirectorySync;
|
|
81
89
|
exports.extractFileFromTar = extractFileFromTar;
|
|
82
90
|
exports.extractFileFromTarGzip = extractFileFromTarGzip;
|
|
91
|
+
Object.defineProperty(exports, 'helpers_exports', {
|
|
92
|
+
enumerable: true,
|
|
93
|
+
get: function () {
|
|
94
|
+
return helpers_exports;
|
|
95
|
+
}
|
|
96
|
+
});
|
|
83
97
|
exports.removeDirectory = removeDirectory;
|
|
84
98
|
exports.removeDirectorySync = removeDirectorySync;
|
package/dist/helpers.mjs
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
import { __exportAll } from "./_virtual/_rolldown/runtime.mjs";
|
|
1
2
|
import { exists, existsSync as existsSync$1 } from "./exists.mjs";
|
|
2
3
|
import { createWriteStream, mkdirSync, rmSync } from "node:fs";
|
|
3
4
|
import { mkdir, readFile, rm } from "node:fs/promises";
|
|
4
5
|
import { parseTar, parseTarGzip } from "nanotar";
|
|
5
6
|
|
|
6
7
|
//#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
|
+
});
|
|
7
16
|
/**
|
|
8
17
|
* Create a directory if it does not exist.
|
|
9
18
|
*
|
|
@@ -74,5 +83,5 @@ async function extractFileFromTarGzip(tarballPath, file, destinationFilePath) {
|
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
//#endregion
|
|
77
|
-
export { createDirectory, createDirectorySync, extractFileFromTar, extractFileFromTarGzip, removeDirectory, removeDirectorySync };
|
|
86
|
+
export { createDirectory, createDirectorySync, extractFileFromTar, extractFileFromTarGzip, helpers_exports, removeDirectory, removeDirectorySync };
|
|
78
87
|
//# 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"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
const require_helpers = require('./helpers.cjs');
|
|
3
|
+
let vitest = require("vitest");
|
|
4
|
+
|
|
5
|
+
//#region src/helpers.test.ts
|
|
6
|
+
(0, vitest.describe)("helpers.ts exports", () => {
|
|
7
|
+
(0, vitest.it)("loads module exports", () => {
|
|
8
|
+
(0, vitest.expect)(require_helpers.helpers_exports).toBeDefined();
|
|
9
|
+
(0, vitest.expect)(typeof require_helpers.helpers_exports).toBe("object");
|
|
10
|
+
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { helpers_exports } from "./helpers.mjs";
|
|
2
|
+
import { describe, expect, it } from "vitest";
|
|
3
|
+
|
|
4
|
+
//#region src/helpers.test.ts
|
|
5
|
+
describe("helpers.ts exports", () => {
|
|
6
|
+
it("loads module exports", () => {
|
|
7
|
+
expect(helpers_exports).toBeDefined();
|
|
8
|
+
expect(typeof helpers_exports).toBe("object");
|
|
9
|
+
});
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
//#endregion
|
|
13
|
+
export { };
|
|
14
|
+
//# sourceMappingURL=helpers.test.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"helpers.test.mjs","names":["moduleExports"],"sources":["../src/helpers.test.ts"],"sourcesContent":["import { describe, expect, it } from \"vitest\";\nimport * as moduleExports from \"./helpers.ts\";\n\ndescribe(\"helpers.ts exports\", () => {\n it(\"loads module exports\", () => {\n expect(moduleExports).toBeDefined();\n expect(typeof moduleExports).toBe(\"object\");\n });\n});\n"],"mappings":";;;;AAGA,SAAS,4BAA4B;AACnC,IAAG,8BAA8B;AAC/B,SAAOA,gBAAc,CAAC,aAAa;AACnC,SAAO,OAAOA,gBAAc,CAAC,KAAK,SAAS;GAC3C;EACF"}
|