@powerlines/plugin-env 0.15.60 → 0.15.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +305 -0
  2. package/dist/babel/plugin.cjs +6 -6
  3. package/dist/babel/plugin.mjs +6 -6
  4. package/dist/components/docs.cjs +4 -4
  5. package/dist/components/docs.mjs +4 -4
  6. package/dist/components/env.cjs +2 -2
  7. package/dist/components/env.mjs +2 -2
  8. package/dist/components/index.cjs +1 -1
  9. package/dist/components/index.mjs +1 -1
  10. package/dist/helpers/automd-generator.cjs +2 -2
  11. package/dist/helpers/automd-generator.mjs +2 -2
  12. package/dist/helpers/index.cjs +1 -1
  13. package/dist/helpers/index.mjs +1 -1
  14. package/dist/helpers/load.cjs +4 -4
  15. package/dist/helpers/load.mjs +4 -4
  16. package/dist/helpers/persistence.cjs +6 -6
  17. package/dist/helpers/persistence.mjs +6 -6
  18. package/dist/helpers/reflect.cjs +4 -4
  19. package/dist/helpers/reflect.mjs +4 -4
  20. package/dist/index.cjs +25 -25
  21. package/dist/index.mjs +25 -25
  22. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/parse-type-definition.cjs +37 -0
  23. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/parse-type-definition.mjs +37 -0
  24. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/to-array.cjs +15 -0
  25. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/to-array.mjs +14 -0
  26. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.cjs +15 -0
  27. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs +14 -0
  28. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.cjs +6 -0
  29. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs +6 -0
  30. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-object.cjs +19 -0
  31. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs +19 -0
  32. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.cjs +63 -0
  33. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs +63 -0
  34. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-string.cjs +12 -0
  35. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs +11 -0
  36. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/type-detect.cjs +15 -0
  37. package/dist/node_modules/.pnpm/@stryke_convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs +16 -0
  38. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.cjs +32 -0
  39. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.mjs +32 -0
  40. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-type.cjs +28 -0
  41. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/is-type.mjs +28 -0
  42. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/join-paths.cjs +106 -0
  43. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/join-paths.mjs +106 -0
  44. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/regex.cjs +12 -0
  45. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/regex.mjs +8 -0
  46. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/slash.cjs +15 -0
  47. package/dist/node_modules/.pnpm/@stryke_path@0.25.3/node_modules/@stryke/path/dist/slash.mjs +14 -0
  48. package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.1/node_modules/c12/dist/index.cjs +1 -1
  49. package/dist/node_modules/.pnpm/c12@3.3.3_magicast@0.5.1/node_modules/c12/dist/index.mjs +1 -1
  50. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.cjs +1 -1
  51. package/dist/node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/shared/giget.OCaTp9b-.mjs +1 -1
  52. package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.cjs +1 -1
  53. package/dist/node_modules/.pnpm/rc9@2.1.2/node_modules/rc9/dist/index.mjs +1 -1
  54. package/dist/packages/powerlines/src/types/config.d.mts +1 -1
  55. package/package.json +16 -16
  56. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/parse-type-definition.cjs +0 -31
  57. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/parse-type-definition.mjs +0 -31
  58. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/to-array.cjs +0 -8
  59. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/to-array.mjs +0 -7
  60. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.cjs +0 -6
  61. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs +0 -5
  62. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.cjs +0 -6
  63. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs +0 -6
  64. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-object.cjs +0 -13
  65. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs +0 -13
  66. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.cjs +0 -13
  67. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs +0 -13
  68. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-string.cjs +0 -12
  69. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs +0 -11
  70. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/type-detect.cjs +0 -11
  71. package/dist/node_modules/.pnpm/@stryke_convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs +0 -12
  72. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-parent-path.cjs +0 -10
  73. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-parent-path.mjs +0 -10
  74. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-type.cjs +0 -13
  75. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/is-type.mjs +0 -13
  76. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/join-paths.cjs +0 -49
  77. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/join-paths.mjs +0 -49
  78. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/regex.cjs +0 -9
  79. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/regex.mjs +0 -5
  80. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/slash.cjs +0 -8
  81. package/dist/node_modules/.pnpm/@stryke_path@0.24.3/node_modules/@stryke/path/dist/slash.mjs +0 -7
  82. /package/dist/node_modules/.pnpm/{@stryke_convert@0.6.32 → @stryke_convert@0.6.34}/node_modules/@stryke/convert/dist/type-checks/src/index.cjs +0 -0
  83. /package/dist/node_modules/.pnpm/{@stryke_convert@0.6.32 → @stryke_convert@0.6.34}/node_modules/@stryke/convert/dist/type-checks/src/index.mjs +0 -0
  84. /package/dist/node_modules/.pnpm/{@stryke_convert@0.6.32 → @stryke_convert@0.6.34}/node_modules/@stryke/convert/dist/type-checks/src/is-collection.cjs +0 -0
  85. /package/dist/node_modules/.pnpm/{@stryke_convert@0.6.32 → @stryke_convert@0.6.34}/node_modules/@stryke/convert/dist/type-checks/src/is-collection.mjs +0 -0
@@ -0,0 +1,15 @@
1
+ require('./is-buffer.cjs');
2
+
3
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs
4
+ ((Obj) => {
5
+ if (typeof globalThis === "object") return globalThis;
6
+ Object.defineProperty(Obj, "typeDetectGlobalObject", {
7
+ get() {
8
+ return this;
9
+ },
10
+ configurable: true
11
+ });
12
+ return globalThis;
13
+ })(Object.prototype);
14
+
15
+ //#endregion
@@ -0,0 +1,16 @@
1
+ import "./is-buffer.mjs";
2
+
3
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.34/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs
4
+ ((Obj) => {
5
+ if (typeof globalThis === "object") return globalThis;
6
+ Object.defineProperty(Obj, "typeDetectGlobalObject", {
7
+ get() {
8
+ return this;
9
+ },
10
+ configurable: true
11
+ });
12
+ return globalThis;
13
+ })(Object.prototype);
14
+
15
+ //#endregion
16
+ export { };
@@ -0,0 +1,32 @@
1
+ const require_slash = require('./slash.cjs');
2
+
3
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.mjs
4
+ /**
5
+ * Check if a given path is a parent of another path.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
10
+ * // returns true
11
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project");
12
+ * // returns true
13
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
14
+ * // returns false
15
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/other");
16
+ * // returns false
17
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
18
+ * // returns false
19
+ * ```
20
+ *
21
+ * @param childPath - The path to check if it is a child of the parent path.
22
+ * @param parentPath - The path to check if it is a parent of the child path.
23
+ * @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
24
+ */
25
+ function isParentPath(childPath, parentPath) {
26
+ const normalizedChild = require_slash.slash(childPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
27
+ const normalizedParent = require_slash.slash(parentPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
28
+ return childPath !== parentPath && normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
29
+ }
30
+
31
+ //#endregion
32
+ exports.isParentPath = isParentPath;
@@ -0,0 +1,32 @@
1
+ import { slash } from "./slash.mjs";
2
+
3
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/is-parent-path.mjs
4
+ /**
5
+ * Check if a given path is a parent of another path.
6
+ *
7
+ * @example
8
+ * ```ts
9
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src");
10
+ * // returns true
11
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project");
12
+ * // returns true
13
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/other");
14
+ * // returns false
15
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/other");
16
+ * // returns false
17
+ * isParentPath("/home/user/project/src/index.ts", "/home/user/project/src/index.ts");
18
+ * // returns false
19
+ * ```
20
+ *
21
+ * @param childPath - The path to check if it is a child of the parent path.
22
+ * @param parentPath - The path to check if it is a parent of the child path.
23
+ * @returns `true` if `childPath` is a child of `parentPath`, otherwise `false`.
24
+ */
25
+ function isParentPath(childPath, parentPath) {
26
+ const normalizedChild = slash(childPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
27
+ const normalizedParent = slash(parentPath.replaceAll(/\\/g, "/").replace(/\/*$/, ""))?.toLowerCase();
28
+ return childPath !== parentPath && normalizedChild !== normalizedParent && normalizedChild.startsWith(`${normalizedParent}/`);
29
+ }
30
+
31
+ //#endregion
32
+ export { isParentPath };
@@ -0,0 +1,28 @@
1
+ const require_regex = require('./regex.cjs');
2
+ const require_slash = require('./slash.cjs');
3
+
4
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/is-type.mjs
5
+ /**
6
+ * Check if the path is an absolute path.
7
+ *
8
+ * @param path - The path to check
9
+ * @returns An indicator specifying if the path is an absolute path
10
+ */
11
+ function isAbsolutePath(path) {
12
+ return require_regex.ABSOLUTE_PATH_REGEX.test(require_slash.slash(path));
13
+ }
14
+ /**
15
+ * Check if the path is an absolute path.
16
+ *
17
+ * @remarks
18
+ * This is an alias for {@link isAbsolutePath}.
19
+ *
20
+ * @param path - The path to check
21
+ * @returns An indicator specifying if the path is an absolute path
22
+ */
23
+ function isAbsolute(path) {
24
+ return isAbsolutePath(path);
25
+ }
26
+
27
+ //#endregion
28
+ exports.isAbsolute = isAbsolute;
@@ -0,0 +1,28 @@
1
+ import { ABSOLUTE_PATH_REGEX } from "./regex.mjs";
2
+ import { slash } from "./slash.mjs";
3
+
4
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/is-type.mjs
5
+ /**
6
+ * Check if the path is an absolute path.
7
+ *
8
+ * @param path - The path to check
9
+ * @returns An indicator specifying if the path is an absolute path
10
+ */
11
+ function isAbsolutePath(path) {
12
+ return ABSOLUTE_PATH_REGEX.test(slash(path));
13
+ }
14
+ /**
15
+ * Check if the path is an absolute path.
16
+ *
17
+ * @remarks
18
+ * This is an alias for {@link isAbsolutePath}.
19
+ *
20
+ * @param path - The path to check
21
+ * @returns An indicator specifying if the path is an absolute path
22
+ */
23
+ function isAbsolute(path) {
24
+ return isAbsolutePath(path);
25
+ }
26
+
27
+ //#endregion
28
+ export { isAbsolute };
@@ -0,0 +1,106 @@
1
+ const require_regex = require('./regex.cjs');
2
+ const require_is_type = require('./is-type.cjs');
3
+
4
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/join-paths.mjs
5
+ function normalizeWindowsPath(input = "") {
6
+ if (!input) return input;
7
+ return input.replace(/\\/g, "/").replace(require_regex.DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
8
+ }
9
+ function correctPaths(path) {
10
+ if (!path || path.length === 0) return ".";
11
+ path = normalizeWindowsPath(path);
12
+ const isUNCPath = path.match(require_regex.UNC_REGEX);
13
+ const isPathAbsolute = require_is_type.isAbsolute(path);
14
+ const trailingSeparator = path[path.length - 1] === "/";
15
+ path = normalizeString(path, !isPathAbsolute);
16
+ if (path.length === 0) {
17
+ if (isPathAbsolute) return "/";
18
+ return trailingSeparator ? "./" : ".";
19
+ }
20
+ if (trailingSeparator) path += "/";
21
+ if (require_regex.DRIVE_LETTER_REGEX.test(path)) path += "/";
22
+ if (isUNCPath) {
23
+ if (!isPathAbsolute) return `//./${path}`;
24
+ return `//${path}`;
25
+ }
26
+ return isPathAbsolute && !require_is_type.isAbsolute(path) ? `/${path}` : path;
27
+ }
28
+ /**
29
+ * Joins all given path segments together using the platform-specific separator as a delimiter.
30
+ * The resulting path is normalized to remove any redundant or unnecessary segments.
31
+ *
32
+ * @param segments - The path segments to join.
33
+ * @returns The joined and normalized path string.
34
+ */
35
+ function joinPaths(...segments) {
36
+ let path = "";
37
+ for (const seg of segments) {
38
+ if (!seg) continue;
39
+ if (path.length > 0) {
40
+ const pathTrailing = path[path.length - 1] === "/";
41
+ const segLeading = seg[0] === "/";
42
+ if (pathTrailing && segLeading) path += seg.slice(1);
43
+ else path += pathTrailing || segLeading ? seg : `/${seg}`;
44
+ } else path += seg;
45
+ }
46
+ return correctPaths(path);
47
+ }
48
+ /**
49
+ * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
50
+ *
51
+ * @param path - The path to normalize.
52
+ * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
53
+ * @returns the normalized path string.
54
+ */
55
+ function normalizeString(path, allowAboveRoot) {
56
+ let res = "";
57
+ let lastSegmentLength = 0;
58
+ let lastSlash = -1;
59
+ let dots = 0;
60
+ let char = null;
61
+ for (let index = 0; index <= path.length; ++index) {
62
+ if (index < path.length) char = path[index];
63
+ else if (char === "/") break;
64
+ else char = "/";
65
+ if (char === "/") {
66
+ if (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {
67
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
68
+ if (res.length > 2) {
69
+ const lastSlashIndex = res.lastIndexOf("/");
70
+ if (lastSlashIndex === -1) {
71
+ res = "";
72
+ lastSegmentLength = 0;
73
+ } else {
74
+ res = res.slice(0, lastSlashIndex);
75
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
76
+ }
77
+ lastSlash = index;
78
+ dots = 0;
79
+ continue;
80
+ } else if (res.length > 0) {
81
+ res = "";
82
+ lastSegmentLength = 0;
83
+ lastSlash = index;
84
+ dots = 0;
85
+ continue;
86
+ }
87
+ }
88
+ if (allowAboveRoot) {
89
+ res += res.length > 0 ? "/.." : "..";
90
+ lastSegmentLength = 2;
91
+ }
92
+ } else {
93
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
94
+ else res = path.slice(lastSlash + 1, index);
95
+ lastSegmentLength = index - lastSlash - 1;
96
+ }
97
+ lastSlash = index;
98
+ dots = 0;
99
+ } else if (char === "." && dots !== -1) ++dots;
100
+ else dots = -1;
101
+ }
102
+ return res;
103
+ }
104
+
105
+ //#endregion
106
+ exports.joinPaths = joinPaths;
@@ -0,0 +1,106 @@
1
+ import { DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, UNC_REGEX } from "./regex.mjs";
2
+ import { isAbsolute } from "./is-type.mjs";
3
+
4
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/join-paths.mjs
5
+ function normalizeWindowsPath(input = "") {
6
+ if (!input) return input;
7
+ return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
8
+ }
9
+ function correctPaths(path) {
10
+ if (!path || path.length === 0) return ".";
11
+ path = normalizeWindowsPath(path);
12
+ const isUNCPath = path.match(UNC_REGEX);
13
+ const isPathAbsolute = isAbsolute(path);
14
+ const trailingSeparator = path[path.length - 1] === "/";
15
+ path = normalizeString(path, !isPathAbsolute);
16
+ if (path.length === 0) {
17
+ if (isPathAbsolute) return "/";
18
+ return trailingSeparator ? "./" : ".";
19
+ }
20
+ if (trailingSeparator) path += "/";
21
+ if (DRIVE_LETTER_REGEX.test(path)) path += "/";
22
+ if (isUNCPath) {
23
+ if (!isPathAbsolute) return `//./${path}`;
24
+ return `//${path}`;
25
+ }
26
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
27
+ }
28
+ /**
29
+ * Joins all given path segments together using the platform-specific separator as a delimiter.
30
+ * The resulting path is normalized to remove any redundant or unnecessary segments.
31
+ *
32
+ * @param segments - The path segments to join.
33
+ * @returns The joined and normalized path string.
34
+ */
35
+ function joinPaths(...segments) {
36
+ let path = "";
37
+ for (const seg of segments) {
38
+ if (!seg) continue;
39
+ if (path.length > 0) {
40
+ const pathTrailing = path[path.length - 1] === "/";
41
+ const segLeading = seg[0] === "/";
42
+ if (pathTrailing && segLeading) path += seg.slice(1);
43
+ else path += pathTrailing || segLeading ? seg : `/${seg}`;
44
+ } else path += seg;
45
+ }
46
+ return correctPaths(path);
47
+ }
48
+ /**
49
+ * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
50
+ *
51
+ * @param path - The path to normalize.
52
+ * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
53
+ * @returns the normalized path string.
54
+ */
55
+ function normalizeString(path, allowAboveRoot) {
56
+ let res = "";
57
+ let lastSegmentLength = 0;
58
+ let lastSlash = -1;
59
+ let dots = 0;
60
+ let char = null;
61
+ for (let index = 0; index <= path.length; ++index) {
62
+ if (index < path.length) char = path[index];
63
+ else if (char === "/") break;
64
+ else char = "/";
65
+ if (char === "/") {
66
+ if (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {
67
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
68
+ if (res.length > 2) {
69
+ const lastSlashIndex = res.lastIndexOf("/");
70
+ if (lastSlashIndex === -1) {
71
+ res = "";
72
+ lastSegmentLength = 0;
73
+ } else {
74
+ res = res.slice(0, lastSlashIndex);
75
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
76
+ }
77
+ lastSlash = index;
78
+ dots = 0;
79
+ continue;
80
+ } else if (res.length > 0) {
81
+ res = "";
82
+ lastSegmentLength = 0;
83
+ lastSlash = index;
84
+ dots = 0;
85
+ continue;
86
+ }
87
+ }
88
+ if (allowAboveRoot) {
89
+ res += res.length > 0 ? "/.." : "..";
90
+ lastSegmentLength = 2;
91
+ }
92
+ } else {
93
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
94
+ else res = path.slice(lastSlash + 1, index);
95
+ lastSegmentLength = index - lastSlash - 1;
96
+ }
97
+ lastSlash = index;
98
+ dots = 0;
99
+ } else if (char === "." && dots !== -1) ++dots;
100
+ else dots = -1;
101
+ }
102
+ return res;
103
+ }
104
+
105
+ //#endregion
106
+ export { joinPaths };
@@ -0,0 +1,12 @@
1
+
2
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/regex.mjs
3
+ const DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
4
+ const DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
5
+ const UNC_REGEX = /^[/\\]{2}/;
6
+ const ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
7
+
8
+ //#endregion
9
+ exports.ABSOLUTE_PATH_REGEX = ABSOLUTE_PATH_REGEX;
10
+ exports.DRIVE_LETTER_REGEX = DRIVE_LETTER_REGEX;
11
+ exports.DRIVE_LETTER_START_REGEX = DRIVE_LETTER_START_REGEX;
12
+ exports.UNC_REGEX = UNC_REGEX;
@@ -0,0 +1,8 @@
1
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/regex.mjs
2
+ const DRIVE_LETTER_START_REGEX = /^[A-Z]:\//i;
3
+ const DRIVE_LETTER_REGEX = /^[A-Z]:$/i;
4
+ const UNC_REGEX = /^[/\\]{2}/;
5
+ const ABSOLUTE_PATH_REGEX = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^~[/\\]|^[A-Z]:[/\\]/i;
6
+
7
+ //#endregion
8
+ export { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, UNC_REGEX };
@@ -0,0 +1,15 @@
1
+
2
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/slash.mjs
3
+ /**
4
+ * Replace backslash to slash
5
+ *
6
+ * @param path - The string to replace
7
+ * @returns The string with replaced backslashes
8
+ */
9
+ function slash(path) {
10
+ if (path.startsWith("\\\\?\\")) return path;
11
+ return path.replace(/\\/g, "/");
12
+ }
13
+
14
+ //#endregion
15
+ exports.slash = slash;
@@ -0,0 +1,14 @@
1
+ //#region ../../node_modules/.pnpm/@stryke+path@0.25.3/node_modules/@stryke/path/dist/slash.mjs
2
+ /**
3
+ * Replace backslash to slash
4
+ *
5
+ * @param path - The string to replace
6
+ * @returns The string with replaced backslashes
7
+ */
8
+ function slash(path) {
9
+ if (path.startsWith("\\\\?\\")) return path;
10
+ return path.replace(/\\/g, "/");
11
+ }
12
+
13
+ //#endregion
14
+ export { slash };
@@ -1,9 +1,9 @@
1
1
  const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
2
- const require_defu = require('../../../../defu@6.1.4/node_modules/defu/dist/defu.cjs');
3
2
  const require_pathe_M_eThtNZ = require('../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs');
4
3
  const require_main$1 = require('../../../../dotenv@17.2.3/node_modules/dotenv/lib/main.cjs');
5
4
  const require_index = require('../../../../exsolve@1.0.8/node_modules/exsolve/dist/index.cjs');
6
5
  const require_jiti = require('../../../../jiti@2.6.1/node_modules/jiti/lib/jiti.cjs');
6
+ const require_defu = require('../../../../defu@6.1.4/node_modules/defu/dist/defu.cjs');
7
7
  const require_index$1 = require('../../../../rc9@2.1.2/node_modules/rc9/dist/index.cjs');
8
8
  const require_index$2 = require('../../../../pkg-types@2.3.0/node_modules/pkg-types/dist/index.cjs');
9
9
  let node_fs = require("node:fs");
@@ -1,9 +1,9 @@
1
1
  import { __toESM } from "../../../../../../_virtual/rolldown_runtime.mjs";
2
- import { defu } from "../../../../defu@6.1.4/node_modules/defu/dist/defu.mjs";
3
2
  import { basename, dirname, extname, join, normalize, resolve } from "../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs";
4
3
  import { require_main } from "../../../../dotenv@17.2.3/node_modules/dotenv/lib/main.mjs";
5
4
  import { resolveModulePath } from "../../../../exsolve@1.0.8/node_modules/exsolve/dist/index.mjs";
6
5
  import { createJiti } from "../../../../jiti@2.6.1/node_modules/jiti/lib/jiti.mjs";
6
+ import { defu } from "../../../../defu@6.1.4/node_modules/defu/dist/defu.mjs";
7
7
  import { read, readUser } from "../../../../rc9@2.1.2/node_modules/rc9/dist/index.mjs";
8
8
  import { findWorkspaceDir, readPackageJSON } from "../../../../pkg-types@2.3.0/node_modules/pkg-types/dist/index.mjs";
9
9
  import { existsSync, promises, statSync } from "node:fs";
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../../../../../_virtual/rolldown_runtime.cjs');
2
- const require_defu = require('../../../../../defu@6.1.4/node_modules/defu/dist/defu.cjs');
3
2
  const require_pathe_M_eThtNZ = require('../../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.cjs');
3
+ const require_defu = require('../../../../../defu@6.1.4/node_modules/defu/dist/defu.cjs');
4
4
  const require_nypm_CLjaS_sz = require('../../../../../nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.cjs');
5
5
  const require_proxy$1 = require('../../../../../node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.cjs');
6
6
  let node_fs = require("node:fs");
@@ -1,5 +1,5 @@
1
- import { defu } from "../../../../../defu@6.1.4/node_modules/defu/dist/defu.mjs";
2
1
  import { basename, dirname as dirname$1, resolve as resolve$1 } from "../../../../../pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs";
2
+ import { defu } from "../../../../../defu@6.1.4/node_modules/defu/dist/defu.mjs";
3
3
  import { installDependencies } from "../../../../../nypm@0.6.2/node_modules/nypm/dist/shared/nypm.CLjaS_sz.mjs";
4
4
  import { require_proxy } from "../../../../../node-fetch-native@1.6.7/node_modules/node-fetch-native/dist/proxy.mjs";
5
5
  import fs, { createWriteStream, existsSync, readdirSync, renameSync } from "node:fs";
@@ -1,6 +1,6 @@
1
1
  const require_rolldown_runtime = require('../../../../../../_virtual/rolldown_runtime.cjs');
2
- require('../../../../defu@6.1.4/node_modules/defu/dist/defu.cjs');
3
2
  const require_index = require('../../../../destr@2.0.5/node_modules/destr/dist/index.cjs');
3
+ require('../../../../defu@6.1.4/node_modules/defu/dist/defu.cjs');
4
4
  let node_fs = require("node:fs");
5
5
  let node_path = require("node:path");
6
6
  let node_os = require("node:os");
@@ -1,5 +1,5 @@
1
- import "../../../../defu@6.1.4/node_modules/defu/dist/defu.mjs";
2
1
  import { destr } from "../../../../destr@2.0.5/node_modules/destr/dist/index.mjs";
2
+ import "../../../../defu@6.1.4/node_modules/defu/dist/defu.mjs";
3
3
  import { existsSync, readFileSync } from "node:fs";
4
4
  import { resolve } from "node:path";
5
5
  import { homedir } from "node:os";
@@ -4,8 +4,8 @@ import { StoragePort, StoragePreset } from "./fs.mjs";
4
4
  import { TSConfig } from "./tsconfig.mjs";
5
5
  import { PluginContext } from "./context.mjs";
6
6
  import { Plugin } from "./plugin.mjs";
7
- import { LogLevelLabel } from "@storm-software/config-tools/types";
8
7
  import { transformAsync } from "@babel/core";
8
+ import { LogLevelLabel } from "@storm-software/config-tools/types";
9
9
  import { MaybePromise } from "@stryke/types/base";
10
10
  import { PreviewOptions } from "vite";
11
11
  import { Format } from "@storm-software/build-tools/types";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@powerlines/plugin-env",
3
- "version": "0.15.60",
3
+ "version": "0.15.62",
4
4
  "type": "module",
5
5
  "description": "A package containing a Powerlines plugin for injecting static .env configuration values to the code so that they're accessible at runtime.",
6
6
  "repository": {
@@ -193,27 +193,27 @@
193
193
  "@alloy-js/typescript": "^0.22.0",
194
194
  "@babel/core": "^7.28.6",
195
195
  "@babel/types": "^7.28.6",
196
- "@powerlines/plugin-alloy": "^0.18.57",
197
- "@powerlines/plugin-automd": "^0.1.171",
198
- "@powerlines/plugin-babel": "^0.12.180",
199
- "@powerlines/plugin-plugin": "^0.12.123",
196
+ "@powerlines/plugin-alloy": "^0.18.59",
197
+ "@powerlines/plugin-automd": "^0.1.173",
198
+ "@powerlines/plugin-babel": "^0.12.182",
199
+ "@powerlines/plugin-plugin": "^0.12.125",
200
200
  "@storm-software/config-tools": "^1.188.80",
201
- "@stryke/capnp": "^0.12.55",
202
- "@stryke/env": "^0.20.47",
203
- "@stryke/fs": "^0.33.30",
204
- "@stryke/json": "^0.9.35",
205
- "@stryke/string-format": "^0.13.1",
206
- "@stryke/type-checks": "^0.5.17",
207
- "@stryke/types": "^0.10.31",
201
+ "@stryke/capnp": "^0.12.60",
202
+ "@stryke/env": "^0.20.52",
203
+ "@stryke/fs": "^0.33.35",
204
+ "@stryke/json": "^0.9.37",
205
+ "@stryke/string-format": "^0.13.3",
206
+ "@stryke/type-checks": "^0.5.19",
207
+ "@stryke/types": "^0.10.33",
208
208
  "automd": "^0.4.2",
209
- "powerlines": "^0.37.45"
209
+ "powerlines": "^0.37.47"
210
210
  },
211
211
  "devDependencies": {
212
- "@powerlines/deepkit": "^0.5.88",
213
- "@powerlines/plugin-deepkit": "^0.11.49",
212
+ "@powerlines/deepkit": "^0.5.90",
213
+ "@powerlines/plugin-deepkit": "^0.11.51",
214
214
  "@types/node": "^24.10.9",
215
215
  "vite": "8.0.0-beta.2"
216
216
  },
217
217
  "publishConfig": { "access": "public" },
218
- "gitHead": "98320250bde7e4d99e3bfbb71b01b64392686868"
218
+ "gitHead": "f1392e3dedb999a5b1b981beab54365e614bfb4e"
219
219
  }
@@ -1,31 +0,0 @@
1
- const require_is_object = require('./type-checks/src/is-object.cjs');
2
- const require_is_string = require('./type-checks/src/is-string.cjs');
3
- require('./type-checks/src/index.cjs');
4
-
5
- //#region ../../node_modules/.pnpm/@stryke+convert@0.6.32/node_modules/@stryke/convert/dist/parse-type-definition.mjs
6
- const n = (n$1) => {
7
- if (require_is_string.e(n$1)) {
8
- if (n$1.includes(`:`)) {
9
- let e$1 = n$1.split(`:`);
10
- if (e$1.length > 1 && e$1[0]) return {
11
- file: e$1[0],
12
- name: e$1[1]
13
- };
14
- }
15
- if (n$1.includes(`#`)) {
16
- let e$1 = n$1.split(`#`);
17
- if (e$1.length > 1 && e$1[0]) return {
18
- file: e$1[0],
19
- name: e$1[1]
20
- };
21
- }
22
- return { file: n$1 };
23
- }
24
- if (require_is_object.t(n$1)) return {
25
- file: n$1.file,
26
- name: n$1.name
27
- };
28
- };
29
-
30
- //#endregion
31
- exports.n = n;
@@ -1,31 +0,0 @@
1
- import { t } from "./type-checks/src/is-object.mjs";
2
- import { e } from "./type-checks/src/is-string.mjs";
3
- import "./type-checks/src/index.mjs";
4
-
5
- //#region ../../node_modules/.pnpm/@stryke+convert@0.6.32/node_modules/@stryke/convert/dist/parse-type-definition.mjs
6
- const n = (n$1) => {
7
- if (e(n$1)) {
8
- if (n$1.includes(`:`)) {
9
- let e$1 = n$1.split(`:`);
10
- if (e$1.length > 1 && e$1[0]) return {
11
- file: e$1[0],
12
- name: e$1[1]
13
- };
14
- }
15
- if (n$1.includes(`#`)) {
16
- let e$1 = n$1.split(`#`);
17
- if (e$1.length > 1 && e$1[0]) return {
18
- file: e$1[0],
19
- name: e$1[1]
20
- };
21
- }
22
- return { file: n$1 };
23
- }
24
- if (t(n$1)) return {
25
- file: n$1.file,
26
- name: n$1.name
27
- };
28
- };
29
-
30
- //#endregion
31
- export { n };
@@ -1,8 +0,0 @@
1
-
2
- //#region ../../node_modules/.pnpm/@stryke+convert@0.6.32/node_modules/@stryke/convert/dist/to-array.mjs
3
- function e(e$1) {
4
- return e$1 ??= [], Array.isArray(e$1) ? e$1 : [e$1];
5
- }
6
-
7
- //#endregion
8
- exports.e = e;
@@ -1,7 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@stryke+convert@0.6.32/node_modules/@stryke/convert/dist/to-array.mjs
2
- function e(e$1) {
3
- return e$1 ??= [], Array.isArray(e$1) ? e$1 : [e$1];
4
- }
5
-
6
- //#endregion
7
- export { e };
@@ -1,6 +0,0 @@
1
-
2
- //#region ../../node_modules/.pnpm/@stryke+convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs
3
- const e = (e$1) => e$1 == null ? e$1 === void 0 ? `[object Undefined]` : `[object Null]` : Object.prototype.toString.call(e$1);
4
-
5
- //#endregion
6
- exports.e = e;
@@ -1,5 +0,0 @@
1
- //#region ../../node_modules/.pnpm/@stryke+convert@0.6.32/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs
2
- const e = (e$1) => e$1 == null ? e$1 === void 0 ? `[object Undefined]` : `[object Null]` : Object.prototype.toString.call(e$1);
3
-
4
- //#endregion
5
- export { e };