@powerlines/plugin-env 0.15.140 → 0.15.142

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 (209) hide show
  1. package/dist/automd-generator-BNg74tyV.cjs +37 -0
  2. package/dist/automd-generator-DoKLIMuw.mjs +32 -0
  3. package/dist/automd-generator-DoKLIMuw.mjs.map +1 -0
  4. package/dist/babel/index.cjs +5 -2
  5. package/dist/babel/index.d.cts +14 -1
  6. package/dist/babel/index.d.mts +14 -1
  7. package/dist/babel/index.mjs +4 -1
  8. package/dist/babel/plugin.cjs +4 -140
  9. package/dist/babel/plugin.d.cts +14 -7
  10. package/dist/babel/plugin.d.mts +14 -7
  11. package/dist/babel/plugin.mjs +3 -138
  12. package/dist/babel-BZqmdVF4.cjs +0 -0
  13. package/dist/babel-DgietUY3.mjs +1 -0
  14. package/dist/chunk-CNVrAnJR.cjs +48 -0
  15. package/dist/{_virtual/rolldown_runtime.cjs → chunk-CsF2CmBJ.mjs} +6 -2
  16. package/dist/components/docs.cjs +13 -69
  17. package/dist/components/docs.d.cts +1 -21
  18. package/dist/components/docs.d.mts +1 -21
  19. package/dist/components/docs.mjs +12 -67
  20. package/dist/components/env.cjs +13 -588
  21. package/dist/components/env.d.cts +1 -19
  22. package/dist/components/env.d.mts +1 -19
  23. package/dist/components/env.mjs +11 -584
  24. package/dist/components/index.cjs +17 -5
  25. package/dist/components/index.d.cts +3 -2
  26. package/dist/components/index.d.mts +3 -2
  27. package/dist/components/index.mjs +14 -2
  28. package/dist/components-BUo6Koax.cjs +0 -0
  29. package/dist/components-DDFmImcI.mjs +1 -0
  30. package/dist/confbox.DA7CpUDY-DShUZ_rW.mjs +23 -0
  31. package/dist/confbox.DA7CpUDY-DShUZ_rW.mjs.map +1 -0
  32. package/dist/confbox.DA7CpUDY-r6FXRsI6.cjs +28 -0
  33. package/dist/confbox.DnMsyigM-C13n3X-S.cjs +415 -0
  34. package/dist/confbox.DnMsyigM-V6Wj0LPC.mjs +405 -0
  35. package/dist/confbox.DnMsyigM-V6Wj0LPC.mjs.map +1 -0
  36. package/dist/create-reflection-resource-B3friIs9.mjs +98 -0
  37. package/dist/create-reflection-resource-B3friIs9.mjs.map +1 -0
  38. package/dist/create-reflection-resource-BJj83ii4.cjs +103 -0
  39. package/dist/create-reflection-resource-DSLbLsX2.d.cts +16 -0
  40. package/dist/create-reflection-resource-DSLbLsX2.d.cts.map +1 -0
  41. package/dist/create-reflection-resource-DwWJAo-G.d.mts +16 -0
  42. package/dist/create-reflection-resource-DwWJAo-G.d.mts.map +1 -0
  43. package/dist/defu-CrqNIh1A.cjs +227 -0
  44. package/dist/defu-DV5Grr85.mjs +180 -0
  45. package/dist/defu-DV5Grr85.mjs.map +1 -0
  46. package/dist/dist-BQc8ZRwl.cjs +13 -0
  47. package/dist/dist-C_a6goTt.cjs +15282 -0
  48. package/dist/dist-CjWvISyq.mjs +15271 -0
  49. package/dist/dist-CjWvISyq.mjs.map +1 -0
  50. package/dist/dist-mV5Swt78.mjs +13 -0
  51. package/dist/dist-mV5Swt78.mjs.map +1 -0
  52. package/dist/docs-B-SDRHeg.cjs +75 -0
  53. package/dist/docs-B0d8pdIg.d.mts +23 -0
  54. package/dist/docs-B0d8pdIg.d.mts.map +1 -0
  55. package/dist/docs-DMfzQuvP.d.cts +23 -0
  56. package/dist/docs-DMfzQuvP.d.cts.map +1 -0
  57. package/dist/docs-DbRoWmL_.mjs +70 -0
  58. package/dist/docs-DbRoWmL_.mjs.map +1 -0
  59. package/dist/docs-helper-2fe7M3Th.mjs +24 -0
  60. package/dist/docs-helper-2fe7M3Th.mjs.map +1 -0
  61. package/dist/docs-helper-4MoQ5-R3.cjs +28 -0
  62. package/dist/env-BIyd8CTA.d.cts +21 -0
  63. package/dist/env-BIyd8CTA.d.cts.map +1 -0
  64. package/dist/env-BKmI7DyR.d.mts +21 -0
  65. package/dist/env-BKmI7DyR.d.mts.map +1 -0
  66. package/dist/env-D9oCn-AS.mjs +587 -0
  67. package/dist/env-D9oCn-AS.mjs.map +1 -0
  68. package/dist/env-R63eR4RP.cjs +598 -0
  69. package/dist/helpers/automd-generator.cjs +3 -31
  70. package/dist/helpers/automd-generator.d.cts +2 -1
  71. package/dist/helpers/automd-generator.d.cts.map +1 -0
  72. package/dist/helpers/automd-generator.d.mts +2 -1
  73. package/dist/helpers/automd-generator.d.mts.map +1 -0
  74. package/dist/helpers/automd-generator.mjs +2 -29
  75. package/dist/helpers/create-reflection-resource.cjs +11 -97
  76. package/dist/helpers/create-reflection-resource.d.cts +3 -14
  77. package/dist/helpers/create-reflection-resource.d.mts +3 -14
  78. package/dist/helpers/create-reflection-resource.mjs +10 -95
  79. package/dist/helpers/docs-helper.cjs +5 -23
  80. package/dist/helpers/docs-helper.d.cts +4 -2
  81. package/dist/helpers/docs-helper.d.cts.map +1 -0
  82. package/dist/helpers/docs-helper.d.mts +4 -2
  83. package/dist/helpers/docs-helper.d.mts.map +1 -0
  84. package/dist/helpers/docs-helper.mjs +4 -21
  85. package/dist/helpers/index.cjs +38 -32
  86. package/dist/helpers/index.d.cts +9 -6
  87. package/dist/helpers/index.d.mts +9 -6
  88. package/dist/helpers/index.mjs +12 -6
  89. package/dist/helpers/load.cjs +10 -134
  90. package/dist/helpers/load.d.cts +3 -34
  91. package/dist/helpers/load.d.mts +3 -34
  92. package/dist/helpers/load.mjs +8 -130
  93. package/dist/helpers/persistence.cjs +15 -321
  94. package/dist/helpers/persistence.d.cts +3 -83
  95. package/dist/helpers/persistence.d.mts +3 -83
  96. package/dist/helpers/persistence.mjs +4 -308
  97. package/dist/helpers/reflect.cjs +13 -262
  98. package/dist/helpers/reflect.d.cts +3 -45
  99. package/dist/helpers/reflect.d.mts +3 -45
  100. package/dist/helpers/reflect.mjs +4 -252
  101. package/dist/helpers/source-file-env.cjs +3 -57
  102. package/dist/helpers/source-file-env.d.cts +1 -7
  103. package/dist/helpers/source-file-env.d.mts +1 -7
  104. package/dist/helpers/source-file-env.mjs +1 -54
  105. package/dist/helpers/template-helpers.cjs +6 -69
  106. package/dist/helpers/template-helpers.d.cts +3 -14
  107. package/dist/helpers/template-helpers.d.mts +3 -14
  108. package/dist/helpers/template-helpers.mjs +5 -67
  109. package/dist/helpers-45e1bvAO.mjs +1 -0
  110. package/dist/helpers-DgYP3uej.cjs +0 -0
  111. package/dist/index-BNRXMhlr.d.mts +1 -0
  112. package/dist/index-Bdi8CvaN.d.cts +16 -0
  113. package/dist/index-Bdi8CvaN.d.cts.map +1 -0
  114. package/dist/index-CEDY7cmG.d.cts +1 -0
  115. package/dist/index-CREkvfw9.d.mts +1 -0
  116. package/dist/index-DSiHnMH2.d.cts +1 -0
  117. package/dist/index-Drhzdkqe.d.mts +16 -0
  118. package/dist/index-Drhzdkqe.d.mts.map +1 -0
  119. package/dist/index-dhjtMp5F.d.mts +1 -0
  120. package/dist/index-uTS5iDq_.d.cts +1 -0
  121. package/dist/index.cjs +257 -98
  122. package/dist/index.d.cts +14 -23
  123. package/dist/index.d.mts +14 -23
  124. package/dist/index.mjs +184 -23
  125. package/dist/index.mjs.map +1 -0
  126. package/dist/join-paths-BMg51Ddi.mjs +148 -0
  127. package/dist/join-paths-BMg51Ddi.mjs.map +1 -0
  128. package/dist/join-paths-Bc4rM2TX.cjs +159 -0
  129. package/dist/json5-DEV_07Nb.cjs +786 -0
  130. package/dist/json5-jq90mF9X.mjs +787 -0
  131. package/dist/json5-jq90mF9X.mjs.map +1 -0
  132. package/dist/jsonc-CBh70baJ.cjs +4 -0
  133. package/dist/jsonc-CDLU6bgi.mjs +4 -0
  134. package/dist/load-DPB0maqs.cjs +6594 -0
  135. package/dist/load-Dr5ybfL7.mjs +6579 -0
  136. package/dist/load-Dr5ybfL7.mjs.map +1 -0
  137. package/dist/load-GpP6cojj.d.mts +36 -0
  138. package/dist/load-GpP6cojj.d.mts.map +1 -0
  139. package/dist/load-PHGmxX_X.d.cts +36 -0
  140. package/dist/load-PHGmxX_X.d.cts.map +1 -0
  141. package/dist/multipart-parser-D65rtMfY.mjs +176 -0
  142. package/dist/multipart-parser-D65rtMfY.mjs.map +1 -0
  143. package/dist/multipart-parser-aEF5a4Xf.cjs +178 -0
  144. package/dist/node-Co8KdzkZ.cjs +3985 -0
  145. package/dist/node-D9MigVDD.mjs +3975 -0
  146. package/dist/node-D9MigVDD.mjs.map +1 -0
  147. package/dist/persistence-BR4cUaN6.d.cts +85 -0
  148. package/dist/persistence-BR4cUaN6.d.cts.map +1 -0
  149. package/dist/persistence-BsBxs9wt.mjs +586 -0
  150. package/dist/persistence-BsBxs9wt.mjs.map +1 -0
  151. package/dist/persistence-D_clXRxP.cjs +712 -0
  152. package/dist/persistence-DrKQZNCv.d.mts +85 -0
  153. package/dist/persistence-DrKQZNCv.d.mts.map +1 -0
  154. package/dist/plugin-CM1TSv1B.cjs +159 -0
  155. package/dist/plugin-CSVnrdpE.cjs +146 -0
  156. package/dist/plugin-CSe5f2cD.d.cts +155 -0
  157. package/dist/plugin-CSe5f2cD.d.cts.map +1 -0
  158. package/dist/plugin-DMbVjdcQ.d.mts +155 -0
  159. package/dist/plugin-DMbVjdcQ.d.mts.map +1 -0
  160. package/dist/plugin-Vyvy9w9Z.mjs +141 -0
  161. package/dist/plugin-Vyvy9w9Z.mjs.map +1 -0
  162. package/dist/plugin-eBjQJP6x.mjs +130 -0
  163. package/dist/plugin-eBjQJP6x.mjs.map +1 -0
  164. package/dist/reflect-Dm8a3c29.d.cts +47 -0
  165. package/dist/reflect-Dm8a3c29.d.cts.map +1 -0
  166. package/dist/reflect-Dpz8ifa0.d.mts +47 -0
  167. package/dist/reflect-Dpz8ifa0.d.mts.map +1 -0
  168. package/dist/runtime-BDzzR4wH.d.cts +792 -0
  169. package/dist/runtime-BDzzR4wH.d.cts.map +1 -0
  170. package/dist/runtime-C5ukCv3P.mjs +242 -0
  171. package/dist/runtime-C5ukCv3P.mjs.map +1 -0
  172. package/dist/runtime-g0TEIoZK.cjs +253 -0
  173. package/dist/runtime-lYSIZdMn.d.mts +792 -0
  174. package/dist/runtime-lYSIZdMn.d.mts.map +1 -0
  175. package/dist/source-file-env-4Vdtzc5-.cjs +68 -0
  176. package/dist/source-file-env-Brfopjyr.d.cts +9 -0
  177. package/dist/source-file-env-Brfopjyr.d.cts.map +1 -0
  178. package/dist/source-file-env-DWejSP2U.d.mts +9 -0
  179. package/dist/source-file-env-DWejSP2U.d.mts.map +1 -0
  180. package/dist/source-file-env-Tj-6qobx.mjs +57 -0
  181. package/dist/source-file-env-Tj-6qobx.mjs.map +1 -0
  182. package/dist/template-helpers-1SKodHKt.d.mts +16 -0
  183. package/dist/template-helpers-1SKodHKt.d.mts.map +1 -0
  184. package/dist/template-helpers-CCEjhw1B.mjs +70 -0
  185. package/dist/template-helpers-CCEjhw1B.mjs.map +1 -0
  186. package/dist/template-helpers-YVcwxmoF.cjs +75 -0
  187. package/dist/template-helpers-zyitPfMz.d.cts +16 -0
  188. package/dist/template-helpers-zyitPfMz.d.cts.map +1 -0
  189. package/dist/toml-DvrxV201.cjs +657 -0
  190. package/dist/toml-uuOYvEAO.mjs +658 -0
  191. package/dist/toml-uuOYvEAO.mjs.map +1 -0
  192. package/dist/types/index.cjs +10 -9
  193. package/dist/types/index.d.cts +3 -2
  194. package/dist/types/index.d.mts +3 -2
  195. package/dist/types/index.mjs +3 -2
  196. package/dist/types/plugin.cjs +7 -133
  197. package/dist/types/plugin.d.cts +2 -153
  198. package/dist/types/plugin.d.mts +2 -153
  199. package/dist/types/plugin.mjs +2 -127
  200. package/dist/types/runtime.cjs +3 -242
  201. package/dist/types/runtime.d.cts +1 -790
  202. package/dist/types/runtime.d.mts +1 -790
  203. package/dist/types/runtime.mjs +1 -239
  204. package/dist/types-DyPQho_C.mjs +1 -0
  205. package/dist/types-o3zWarRp.cjs +0 -0
  206. package/dist/yaml-CIn2Gddw.mjs +1055 -0
  207. package/dist/yaml-CIn2Gddw.mjs.map +1 -0
  208. package/dist/yaml-CQSFMRMS.cjs +1054 -0
  209. package/package.json +9 -9
package/dist/index.mjs CHANGED
@@ -1,34 +1,194 @@
1
- import { __ΩEnvInterface, __ΩSecretsInterface } from "./types/runtime.mjs";
2
- import { __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType } from "./types/plugin.mjs";
3
- import "./types/index.mjs";
4
- import { BaseEnv, BaseSecrets, __ΩCreateEnvReflectionOptions, createEnvReflection, createSecretsReflection, mergeEnvReflections, mergeSecretsReflections, reflectEnv, reflectSecrets } from "./helpers/reflect.mjs";
5
- import { getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, readEnvReflection, readEnvTypeReflection, readSecretsReflection, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection } from "./helpers/persistence.mjs";
6
- import { createTemplateReflection } from "./helpers/template-helpers.mjs";
7
- import { formatEnvField, removeEnvPrefix } from "./helpers/source-file-env.mjs";
8
- import { loadEnv, loadEnvFromContext } from "./helpers/load.mjs";
9
- import { createReflectionResource } from "./helpers/create-reflection-resource.mjs";
10
- import "./helpers/index.mjs";
11
- import { getDocsOutputPath } from "./helpers/docs-helper.mjs";
12
- import { env } from "./helpers/automd-generator.mjs";
13
- import { EnvDocsFile } from "./components/docs.mjs";
14
- import { EnvBuiltin, EnvTypeDefinition } from "./components/env.mjs";
15
- import "./components/index.mjs";
16
- import { envBabelPlugin } from "./babel/plugin.mjs";
17
- import "./babel/index.mjs";
1
+ import { n as __ΩSecretsInterface, t as __ΩEnvInterface } from "./runtime-C5ukCv3P.mjs";
2
+ import { a as __ΩEnvType, i as __ΩEnvPluginUserConfig, n as __ΩEnvPluginOptions, r as __ΩEnvPluginResolvedConfig, t as __ΩEnvPluginContext } from "./plugin-eBjQJP6x.mjs";
3
+ import "./types-DyPQho_C.mjs";
4
+ import { t as joinPaths } from "./join-paths-BMg51Ddi.mjs";
5
+ import { _ as mergeEnvReflections, a as readEnvReflection, b as reflectSecrets, c as resolveRuntimeTypeFile, d as writeEnvTypeReflection, f as BaseEnv, g as createSecretsReflection, h as createEnvReflection, i as getSecretsDefaultTypeDefinition, l as writeEnvReflection, m as __ΩCreateEnvReflectionOptions, n as getEnvReflectionsPath, o as readEnvTypeReflection, p as BaseSecrets, r as getEnvTypeReflectionsPath, s as readSecretsReflection, t as getEnvDefaultTypeDefinition, u as writeEnvReflectionSync, v as mergeSecretsReflections, x as isParentPath, y as reflectEnv } from "./persistence-BsBxs9wt.mjs";
6
+ import { t as createTemplateReflection } from "./template-helpers-CCEjhw1B.mjs";
7
+ import { n as removeEnvPrefix, t as formatEnvField } from "./source-file-env-Tj-6qobx.mjs";
8
+ import { t as defu } from "./defu-DV5Grr85.mjs";
9
+ import { n as loadEnvFromContext, t as loadEnv } from "./load-Dr5ybfL7.mjs";
10
+ import "./confbox.DA7CpUDY-DShUZ_rW.mjs";
11
+ import "./confbox.DnMsyigM-V6Wj0LPC.mjs";
12
+ import { t as createReflectionResource } from "./create-reflection-resource-B3friIs9.mjs";
13
+ import "./helpers-45e1bvAO.mjs";
14
+ import { t as getDocsOutputPath } from "./docs-helper-2fe7M3Th.mjs";
15
+ import { t as env } from "./automd-generator-DoKLIMuw.mjs";
16
+ import { t as EnvDocsFile } from "./docs-DbRoWmL_.mjs";
17
+ import { n as EnvTypeDefinition, t as EnvBuiltin } from "./env-D9oCn-AS.mjs";
18
+ import "./components-DDFmImcI.mjs";
19
+ import { t as envBabelPlugin } from "./plugin-Vyvy9w9Z.mjs";
20
+ import "./babel-DgietUY3.mjs";
18
21
  import { ReflectionClass, ReflectionKind } from "@powerlines/deepkit/vendor/type";
19
- import { isParentPath } from "@stryke/path/is-parent-path";
20
22
  import { ENV_PREFIXES } from "@stryke/env/types";
21
- import defu from "defu";
22
- import { joinPaths } from "@stryke/path/join";
23
23
  import { createComponent } from "@alloy-js/core/jsx-runtime";
24
24
  import alloy from "@powerlines/plugin-alloy";
25
25
  import automd from "@powerlines/plugin-automd";
26
26
  import babel from "@powerlines/plugin-babel";
27
- import { parseTypeDefinition } from "@stryke/convert/parse-type-definition";
28
- import { toArray } from "@stryke/convert/to-array";
29
27
  import { existsSync } from "@stryke/fs/exists";
30
28
  import { constantCase } from "@stryke/string-format/constant-case";
31
29
 
30
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs
31
+ /**
32
+ * Gets the `toStringTag` of `obj`.
33
+ *
34
+ * @param value - The obj to query.
35
+ * @returns Returns the `toStringTag`.
36
+ */
37
+ const getObjectTag = (value) => {
38
+ if (value == null) return value === void 0 ? "[object Undefined]" : "[object Null]";
39
+ return Object.prototype.toString.call(value);
40
+ };
41
+
42
+ //#endregion
43
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs
44
+ /**
45
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
46
+ * and has a `typeof` result of "object".
47
+ *
48
+ * @example
49
+ * ```typescript
50
+ * isObjectLike({})
51
+ * // => true
52
+ *
53
+ * isObjectLike([1, 2, 3])
54
+ * // => true
55
+ *
56
+ * isObjectLike(Function)
57
+ * // => false
58
+ *
59
+ * isObjectLike(null)
60
+ * // => false
61
+ * ```
62
+ *
63
+ * @param value - The value to check.
64
+ * @returns Returns `true` if `value` is object-like, else `false`.
65
+ */
66
+ const isObjectLike = (obj) => {
67
+ return typeof obj === "object" && obj !== null;
68
+ };
69
+ /**
70
+ * Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.
71
+ *
72
+ * @example
73
+ * ```typescript
74
+ * function Foo() {
75
+ * this.a = 1
76
+ * }
77
+ *
78
+ * isPlainObject(new Foo)
79
+ * // => false
80
+ *
81
+ * isPlainObject([1, 2, 3])
82
+ * // => false
83
+ *
84
+ * isPlainObject({ 'x': 0, 'y': 0 })
85
+ * // => true
86
+ *
87
+ * isPlainObject(Object.create(null))
88
+ * // => true
89
+ * ```
90
+ *
91
+ * @param obj - The value to check.
92
+ * @returns Returns `true` if `obj` is a plain object, else `false`.
93
+ */
94
+ const isPlainObject = (obj) => {
95
+ if (!isObjectLike(obj) || getObjectTag(obj) !== "[object Object]") return false;
96
+ if (Object.getPrototypeOf(obj) === null) return true;
97
+ let proto = obj;
98
+ while (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);
99
+ return Object.getPrototypeOf(obj) === proto;
100
+ };
101
+
102
+ //#endregion
103
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs
104
+ /**
105
+ * Check if the provided value's type is `Object`
106
+ *
107
+ * @param value - The value to type check
108
+ * @returns An indicator specifying if the value provided is of type `Object`
109
+ */
110
+ const isObject = (value) => {
111
+ try {
112
+ return typeof value === "object" || Boolean(value) && value?.constructor === Object || isPlainObject(value);
113
+ } catch {
114
+ return false;
115
+ }
116
+ };
117
+
118
+ //#endregion
119
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs
120
+ const isString = (value) => {
121
+ try {
122
+ return typeof value === "string";
123
+ } catch {
124
+ return false;
125
+ }
126
+ };
127
+
128
+ //#endregion
129
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs
130
+ const isBufferExists = typeof Buffer !== "undefined";
131
+ isBufferExists && Buffer.isBuffer.bind(Buffer);
132
+
133
+ //#endregion
134
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs
135
+ ((Obj) => {
136
+ if (typeof globalThis === "object") return globalThis;
137
+ Object.defineProperty(Obj, "typeDetectGlobalObject", {
138
+ get() {
139
+ return this;
140
+ },
141
+ configurable: true
142
+ });
143
+ return globalThis;
144
+ })(Object.prototype);
145
+
146
+ //#endregion
147
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/parse-type-definition.mjs
148
+ /**
149
+ * Parse a type definition parameter into a {@link TypeDefinition} object
150
+ *
151
+ * @param param - The parameter to parse
152
+ * @returns The parsed type definition
153
+ */
154
+ const parseTypeDefinition = (param) => {
155
+ if (isString(param)) {
156
+ if (param.includes(":")) {
157
+ const params = param.split(":");
158
+ if (params.length > 1 && params[0]) return {
159
+ file: params[0],
160
+ name: params[1]
161
+ };
162
+ }
163
+ if (param.includes("#")) {
164
+ const params = param.split("#");
165
+ if (params.length > 1 && params[0]) return {
166
+ file: params[0],
167
+ name: params[1]
168
+ };
169
+ }
170
+ return { file: param };
171
+ }
172
+ if (isObject(param)) return {
173
+ file: param.file,
174
+ name: param.name
175
+ };
176
+ };
177
+
178
+ //#endregion
179
+ //#region ../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/to-array.mjs
180
+ /**
181
+ * Convert `Arrayable<T>` to `Array<T>`
182
+ *
183
+ * @param array - The `Arrayable<T>` to convert
184
+ * @returns An `Array<T>` containing the elements of the input
185
+ */
186
+ function toArray(array) {
187
+ array = array ?? [];
188
+ return Array.isArray(array) ? array : [array];
189
+ }
190
+
191
+ //#endregion
32
192
  //#region src/index.tsx
33
193
  /**
34
194
  * A Powerlines plugin to inject environment variables into the source code.
@@ -176,4 +336,5 @@ const plugin = (options = {}) => {
176
336
  var src_default = plugin;
177
337
 
178
338
  //#endregion
179
- export { BaseEnv, BaseSecrets, EnvBuiltin, EnvDocsFile, EnvTypeDefinition, __ΩCreateEnvReflectionOptions, __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface, createEnvReflection, createReflectionResource, createSecretsReflection, createTemplateReflection, src_default as default, envBabelPlugin, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, plugin, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
339
+ export { BaseEnv, BaseSecrets, EnvBuiltin, EnvDocsFile, EnvTypeDefinition, __ΩCreateEnvReflectionOptions, __ΩEnvInterface, __ΩEnvPluginContext, __ΩEnvPluginOptions, __ΩEnvPluginResolvedConfig, __ΩEnvPluginUserConfig, __ΩEnvType, __ΩSecretsInterface, createEnvReflection, createReflectionResource, createSecretsReflection, createTemplateReflection, src_default as default, envBabelPlugin, formatEnvField, getEnvDefaultTypeDefinition, getEnvReflectionsPath, getEnvTypeReflectionsPath, getSecretsDefaultTypeDefinition, loadEnv, loadEnvFromContext, mergeEnvReflections, mergeSecretsReflections, plugin, readEnvReflection, readEnvTypeReflection, readSecretsReflection, reflectEnv, reflectSecrets, removeEnvPrefix, resolveRuntimeTypeFile, writeEnvReflection, writeEnvReflectionSync, writeEnvTypeReflection };
340
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","names":["ReflectionClass","ReflectionKind","alloy","automd","babel","parseTypeDefinition","toArray","ENV_PREFIXES","existsSync","isParentPath","joinPaths","constantCase","defu","envBabelPlugin","EnvDocsFile","EnvBuiltin","env","getDocsOutputPath","loadEnv","getEnvDefaultTypeDefinition","getEnvReflectionsPath","getEnvTypeReflectionsPath","getSecretsDefaultTypeDefinition","readEnvReflection","readEnvTypeReflection","readSecretsReflection","writeEnvReflection","writeEnvTypeReflection","reflectEnv","reflectSecrets","plugin","options","name","config","debug","types","prefix","transform","plugins","warn","envDefaultTypeDefinition","file","secrets","secretsDefaultTypeDefinition","reduce","ret","formattedPrefix","includes","push","framework","filter","Boolean","replace","configResolved","parsed","used","injected","command","skipCache","persistedMeta","checksum","meta","workspaceConfig","workspaceRoot","projectRoot","undefined","Error","getProperties","length","envWithAlias","prop","getAlias","Object","entries","forEach","key","value","unprefixedKey","startsWith","slice","aliasKey","find","reverse","hasProperty","getProperty","setDefaultValue","kind","objectLiteral","typeName","description","prepare","_self$","render","_$createComponent","defaultConfig","order","handler","trace","docs","levelOffset","buildEnd","reflectionPath","generators","vite","envPrefix"],"sources":["../../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/get-object-tag.mjs","../../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/is-plain-object.mjs","../../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/is-object.mjs","../../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/is-string.mjs","../../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/is-buffer.mjs","../../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/type-checks/src/type-detect.mjs","../../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/parse-type-definition.mjs","../../../node_modules/.pnpm/@stryke+convert@0.6.37/node_modules/@stryke/convert/dist/to-array.mjs","../src/index.tsx"],"sourcesContent":["//#region ../type-checks/src/get-object-tag.ts\n/**\n* Gets the `toStringTag` of `obj`.\n*\n* @param value - The obj to query.\n* @returns Returns the `toStringTag`.\n*/\nconst getObjectTag = (value) => {\n\tif (value == null) return value === void 0 ? \"[object Undefined]\" : \"[object Null]\";\n\treturn Object.prototype.toString.call(value);\n};\n\n//#endregion\nexport { getObjectTag };\n//# sourceMappingURL=get-object-tag.mjs.map","import { getObjectTag } from \"./get-object-tag.mjs\";\n\n//#region ../type-checks/src/is-plain-object.ts\n/**\n* Checks if `value` is object-like. A value is object-like if it's not `null`\n* and has a `typeof` result of \"object\".\n*\n* @example\n* ```typescript\n* isObjectLike({})\n* // => true\n*\n* isObjectLike([1, 2, 3])\n* // => true\n*\n* isObjectLike(Function)\n* // => false\n*\n* isObjectLike(null)\n* // => false\n* ```\n*\n* @param value - The value to check.\n* @returns Returns `true` if `value` is object-like, else `false`.\n*/\nconst isObjectLike = (obj) => {\n\treturn typeof obj === \"object\" && obj !== null;\n};\n/**\n* Checks if `obj` is a plain object, that is, an object created by the `Object` constructor or one with a `[[Prototype]]` of `null`.\n*\n* @example\n* ```typescript\n* function Foo() {\n* this.a = 1\n* }\n*\n* isPlainObject(new Foo)\n* // => false\n*\n* isPlainObject([1, 2, 3])\n* // => false\n*\n* isPlainObject({ 'x': 0, 'y': 0 })\n* // => true\n*\n* isPlainObject(Object.create(null))\n* // => true\n* ```\n*\n* @param obj - The value to check.\n* @returns Returns `true` if `obj` is a plain object, else `false`.\n*/\nconst isPlainObject = (obj) => {\n\tif (!isObjectLike(obj) || getObjectTag(obj) !== \"[object Object]\") return false;\n\tif (Object.getPrototypeOf(obj) === null) return true;\n\tlet proto = obj;\n\twhile (Object.getPrototypeOf(proto) !== null) proto = Object.getPrototypeOf(proto);\n\treturn Object.getPrototypeOf(obj) === proto;\n};\n\n//#endregion\nexport { isObjectLike, isPlainObject };\n//# sourceMappingURL=is-plain-object.mjs.map","import { isPlainObject } from \"./is-plain-object.mjs\";\n\n//#region ../type-checks/src/is-object.ts\n/**\n* Check if the provided value's type is `Object`\n*\n* @param value - The value to type check\n* @returns An indicator specifying if the value provided is of type `Object`\n*/\nconst isObject = (value) => {\n\ttry {\n\t\treturn typeof value === \"object\" || Boolean(value) && value?.constructor === Object || isPlainObject(value);\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isObject };\n//# sourceMappingURL=is-object.mjs.map","//#region ../type-checks/src/is-string.ts\nconst isString = (value) => {\n\ttry {\n\t\treturn typeof value === \"string\";\n\t} catch {\n\t\treturn false;\n\t}\n};\n\n//#endregion\nexport { isString };\n//# sourceMappingURL=is-string.mjs.map","//#region ../type-checks/src/is-buffer.ts\nconst isBufferExists = typeof Buffer !== \"undefined\";\n/**\n* Check if the provided value's type is `Buffer`\n*/\nconst isBuffer = isBufferExists ? Buffer.isBuffer.bind(Buffer) : function isBuffer$1(value) {\n\treturn false;\n};\n\n//#endregion\nexport { isBufferExists };\n//# sourceMappingURL=is-buffer.mjs.map","import \"./is-buffer.mjs\";\n\n//#region ../type-checks/src/type-detect.ts\nconst globalObject = ((Obj) => {\n\tif (typeof globalThis === \"object\") return globalThis;\n\tObject.defineProperty(Obj, \"typeDetectGlobalObject\", {\n\t\tget() {\n\t\t\treturn this;\n\t\t},\n\t\tconfigurable: true\n\t});\n\treturn globalThis;\n})(Object.prototype);\n\n//#endregion\nexport { };\n//# sourceMappingURL=type-detect.mjs.map","import { isObject } from \"./type-checks/src/is-object.mjs\";\nimport { isString } from \"./type-checks/src/is-string.mjs\";\nimport \"./type-checks/src/index.mjs\";\n\n//#region src/parse-type-definition.ts\n/**\n* Parse a type definition parameter into a {@link TypeDefinition} object\n*\n* @param param - The parameter to parse\n* @returns The parsed type definition\n*/\nconst parseTypeDefinition = (param) => {\n\tif (isString(param)) {\n\t\tif (param.includes(\":\")) {\n\t\t\tconst params = param.split(\":\");\n\t\t\tif (params.length > 1 && params[0]) return {\n\t\t\t\tfile: params[0],\n\t\t\t\tname: params[1]\n\t\t\t};\n\t\t}\n\t\tif (param.includes(\"#\")) {\n\t\t\tconst params = param.split(\"#\");\n\t\t\tif (params.length > 1 && params[0]) return {\n\t\t\t\tfile: params[0],\n\t\t\t\tname: params[1]\n\t\t\t};\n\t\t}\n\t\treturn { file: param };\n\t}\n\tif (isObject(param)) return {\n\t\tfile: param.file,\n\t\tname: param.name\n\t};\n};\n\n//#endregion\nexport { parseTypeDefinition };\n//# sourceMappingURL=parse-type-definition.mjs.map","//#region src/to-array.ts\n/**\n* Convert `Arrayable<T>` to `Array<T>`\n*\n* @param array - The `Arrayable<T>` to convert\n* @returns An `Array<T>` containing the elements of the input\n*/\nfunction toArray(array) {\n\tarray = array ?? [];\n\treturn Array.isArray(array) ? array : [array];\n}\n\n//#endregion\nexport { toArray };\n//# sourceMappingURL=to-array.mjs.map","/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Powerlines\n\n This code was released as part of the Powerlines project. Powerlines\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/powerlines.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/powerlines\n Documentation: https://docs.stormsoftware.com/projects/powerlines\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport {\n ReflectionClass,\n ReflectionKind\n} from \"@powerlines/deepkit/vendor/type\";\nimport alloy from \"@powerlines/plugin-alloy\";\nimport automd from \"@powerlines/plugin-automd\";\nimport babel from \"@powerlines/plugin-babel\";\nimport { parseTypeDefinition } from \"@stryke/convert/parse-type-definition\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { ENV_PREFIXES } from \"@stryke/env/types\";\nimport { existsSync } from \"@stryke/fs/exists\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport {\n TypeDefinition,\n TypeDefinitionParameter\n} from \"@stryke/types/configuration\";\nimport defu from \"defu\";\nimport { Plugin } from \"powerlines/types/plugin\";\nimport type { UserConfig as ViteUserConfig } from \"vite\";\nimport { envBabelPlugin } from \"./babel/plugin\";\nimport { EnvDocsFile } from \"./components/docs\";\nimport { EnvBuiltin } from \"./components/env\";\nimport { env } from \"./helpers/automd-generator\";\nimport { getDocsOutputPath } from \"./helpers/docs-helper\";\nimport { loadEnv } from \"./helpers/load\";\nimport {\n getEnvDefaultTypeDefinition,\n getEnvReflectionsPath,\n getEnvTypeReflectionsPath,\n getSecretsDefaultTypeDefinition,\n readEnvReflection,\n readEnvTypeReflection,\n readSecretsReflection,\n writeEnvReflection,\n writeEnvTypeReflection\n} from \"./helpers/persistence\";\nimport { reflectEnv, reflectSecrets } from \"./helpers/reflect\";\nimport { EnvPluginContext, EnvPluginOptions } from \"./types/plugin\";\n\nexport * from \"./babel\";\nexport * from \"./components\";\nexport * from \"./helpers\";\nexport * from \"./types\";\n\n/**\n * A Powerlines plugin to inject environment variables into the source code.\n */\nexport const plugin = <TContext extends EnvPluginContext = EnvPluginContext>(\n options: EnvPluginOptions = {}\n) => {\n return [\n alloy(options.alloy),\n babel(options.babel),\n {\n name: \"env\",\n async config() {\n this.debug(\n \"Providing default configuration for the Powerlines `env` build plugin.\"\n );\n\n const config = {\n env: defu(options, {\n types: {} as TypeDefinitionParameter,\n prefix: []\n }),\n transform: {\n babel: {\n plugins: [envBabelPlugin]\n }\n }\n };\n\n if (config.env.types) {\n config.env.types = parseTypeDefinition(\n config.env.types\n ) as TypeDefinition;\n } else {\n this.warn(\n \"The `env.types` configuration parameter was not provided. Please ensure this is expected.\"\n );\n\n const envDefaultTypeDefinition =\n await getEnvDefaultTypeDefinition(this);\n config.env.types = parseTypeDefinition(\n `${envDefaultTypeDefinition.file}#${envDefaultTypeDefinition.name}`\n ) as TypeDefinition;\n }\n\n if (config.env.secrets) {\n config.env.secrets = parseTypeDefinition(\n config.env.secrets\n ) as TypeDefinition;\n } else {\n const secretsDefaultTypeDefinition =\n await getSecretsDefaultTypeDefinition(this);\n config.env.secrets = parseTypeDefinition(\n `${secretsDefaultTypeDefinition.file}#${\n secretsDefaultTypeDefinition.name\n }`\n ) as TypeDefinition;\n }\n\n config.env.prefix = toArray(\n (config.env.prefix ?? []) as string[]\n ).reduce(\n (ret: string[], prefix: string) => {\n const formattedPrefix = constantCase(prefix);\n if (!ret.includes(formattedPrefix)) {\n ret.push(formattedPrefix);\n }\n\n return ret;\n },\n [\n ...ENV_PREFIXES,\n \"POWERLINES_\",\n this.config.framework &&\n this.config.framework !== \"powerlines\" &&\n `${constantCase(this.config.framework)}_`\n ].filter(Boolean) as string[]\n );\n\n config.env.prefix = toArray(config.env.prefix).reduce((ret, prefix) => {\n if (!ret.includes(prefix.replace(/_$/g, \"\"))) {\n ret.push(prefix.replace(/_$/g, \"\"));\n }\n return ret;\n }, [] as string[]);\n\n return config;\n },\n async configResolved() {\n this.debug(\n `Environment plugin configuration has been resolved for the Powerlines project.`\n );\n\n this.env = defu(\n {\n parsed: await loadEnv(this, this.config.env)\n },\n this.env ?? {},\n {\n types: {\n env: {}\n },\n used: {\n env: {},\n secrets: {}\n },\n parsed: {},\n injected: {}\n }\n ) as EnvPluginContext[\"env\"];\n\n if (\n this.config.command !== \"prepare\" &&\n !this.config.skipCache &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n existsSync(getEnvTypeReflectionsPath(this, \"env\"))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n this.env.types.env = await readEnvTypeReflection(this, \"env\");\n\n if (existsSync(getEnvReflectionsPath(this, \"env\"))) {\n this.env.used.env = await readEnvReflection(this);\n }\n\n if (existsSync(getEnvTypeReflectionsPath(this, \"secrets\"))) {\n this.env.types.secrets = await readEnvTypeReflection(\n this,\n \"secrets\"\n );\n }\n\n if (existsSync(getEnvReflectionsPath(this, \"secrets\"))) {\n this.env.used.secrets = await readSecretsReflection(this);\n }\n } else {\n this.debug(\n `Starting environment configuration reflection initialization.`\n );\n\n this.env.types.env = await reflectEnv(\n this,\n this.config.env.types?.file\n ? isParentPath(\n this.config.env.types?.file,\n this.workspaceConfig.workspaceRoot\n )\n ? this.config.env.types?.file\n : joinPaths(\n this.config.projectRoot,\n this.config.env.types?.file\n )\n : undefined,\n this.config.env.types?.name\n );\n if (!this.env.types.env) {\n throw new Error(\n \"Failed to find the environment configuration type reflection in the context.\"\n );\n }\n\n await writeEnvTypeReflection(this, this.env.types.env, \"env\");\n\n this.env.types.secrets = await reflectSecrets(\n this,\n this.config.env.secrets?.file\n ? isParentPath(\n this.config.env.secrets?.file,\n this.workspaceConfig.workspaceRoot\n )\n ? this.config.env.secrets?.file\n : joinPaths(\n this.config.projectRoot,\n this.config.env.secrets?.file\n )\n : undefined,\n this.config.env.secrets?.name\n );\n if (!this.env.types.secrets) {\n throw new Error(\n \"Failed to find the secrets configuration type reflection in the context.\"\n );\n }\n\n await writeEnvTypeReflection(this, this.env.types.secrets, \"secrets\");\n\n this.debug(\n `Resolved ${\n this.env.types.env.getProperties().length ?? 0\n } environment configuration parameters and ${\n this.env.types.secrets?.getProperties().length ?? 0\n } secret configuration parameters`\n );\n\n const envWithAlias = this.env.types.env\n .getProperties()\n .filter(prop => prop.getAlias().length > 0);\n\n Object.entries(await loadEnv(this, this.config.env)).forEach(\n ([key, value]) => {\n const unprefixedKey = this.config.env.prefix.reduce(\n (ret, prefix) => {\n if (key.replace(/_$/g, \"\").startsWith(prefix)) {\n return key.replace(/_$/g, \"\").slice(prefix.length);\n }\n return ret;\n },\n key\n );\n\n const aliasKey = envWithAlias.find(prop =>\n prop?.getAlias().reverse().includes(unprefixedKey)\n );\n if (this.env.types.env?.hasProperty(unprefixedKey) || aliasKey) {\n this.env.types.env\n .getProperty(unprefixedKey)\n .setDefaultValue(value);\n }\n }\n );\n\n this.env.used.env = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Env\",\n description: `An object containing the environment configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.env\n );\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n\n if (this.env.types.secrets) {\n await writeEnvTypeReflection(\n this,\n this.env.types.secrets,\n \"secrets\"\n );\n\n this.env.used.secrets = new ReflectionClass(\n {\n kind: ReflectionKind.objectLiteral,\n typeName: \"Secrets\",\n description: `An object containing the secret configuration parameters used by the ${\n this.config.name\n ? `${this.config.name} application`\n : \"application\"\n }.`,\n types: []\n },\n this.env.types.secrets\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async prepare() {\n this.debug(\n `Preparing the Environment runtime artifacts for the Powerlines project.`\n );\n\n return this.render(\n <EnvBuiltin defaultConfig={this.config.env.defaultConfig} />\n );\n },\n transform: {\n order: \"post\",\n async handler() {\n if (this.env.used.env.getProperties().length > 0) {\n this.trace(\n `Persisting used environment configuration reflections to ${getEnvReflectionsPath(\n this,\n \"env\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n\n if (this.env.used.secrets.getProperties().length > 0) {\n this.trace(\n `Persisting used secret configuration reflections to ${getEnvReflectionsPath(\n this,\n \"secrets\"\n )}.`\n );\n await writeEnvReflection(this, this.env.used.secrets, \"secrets\");\n }\n }\n },\n async docs() {\n this.debug(\n `Documenting environment variables configuration values in \"${joinPaths(\n getDocsOutputPath(this),\n \"env.md\"\n )}\"`\n );\n\n return this.render(<EnvDocsFile levelOffset={0} />);\n },\n async buildEnd() {\n const reflectionPath = getEnvReflectionsPath(this, \"env\");\n\n this.debug(`Writing env reflection types to ${reflectionPath}.`);\n\n await writeEnvReflection(this, this.env.used.env, \"env\");\n }\n },\n {\n name: \"env:automd-generator\",\n config() {\n return {\n automd: defu(options.automd ?? {}, {\n generators: {\n \"env\": env(this)\n }\n })\n };\n }\n },\n {\n name: \"env:vite\",\n vite: {\n configResolved(this: TContext) {\n return {\n envPrefix: this.config?.env?.prefix\n } as ViteUserConfig;\n }\n }\n },\n automd(options.automd)\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"x_google_ignoreList":[0,1,2,3,4,5,6,7],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,MAAM,gBAAgB,UAAU;AAC/B,KAAI,SAAS,KAAM,QAAO,UAAU,KAAK,IAAI,uBAAuB;AACpE,QAAO,OAAO,UAAU,SAAS,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;ACgB7C,MAAM,gBAAgB,QAAQ;AAC7B,QAAO,OAAO,QAAQ,YAAY,QAAQ;;;;;;;;;;;;;;;;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mD,WAAW,KAAKvE,QAAQjB,KAAKoB,QAC9B;MAEL;GACD;EACDjC,OAAO4B,QAAQ5B,OAAO;EACvB;;AAGH,kBAAe2B"}
@@ -0,0 +1,148 @@
1
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.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
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/slash.mjs
9
+ /**
10
+ * Replace backslash to slash
11
+ *
12
+ * @param path - The string to replace
13
+ * @returns The string with replaced backslashes
14
+ */
15
+ function slash(path) {
16
+ if (path.startsWith("\\\\?\\")) return path;
17
+ return path.replace(/\\/g, "/");
18
+ }
19
+
20
+ //#endregion
21
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/is-type.mjs
22
+ /**
23
+ * Check if the path is an absolute path.
24
+ *
25
+ * @param path - The path to check
26
+ * @returns An indicator specifying if the path is an absolute path
27
+ */
28
+ function isAbsolutePath(path) {
29
+ return ABSOLUTE_PATH_REGEX.test(slash(path));
30
+ }
31
+ /**
32
+ * Check if the path is an absolute path.
33
+ *
34
+ * @remarks
35
+ * This is an alias for {@link isAbsolutePath}.
36
+ *
37
+ * @param path - The path to check
38
+ * @returns An indicator specifying if the path is an absolute path
39
+ */
40
+ function isAbsolute(path) {
41
+ return isAbsolutePath(path);
42
+ }
43
+
44
+ //#endregion
45
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/join-paths.mjs
46
+ function normalizeWindowsPath(input = "") {
47
+ if (!input) return input;
48
+ return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
49
+ }
50
+ function correctPaths(path) {
51
+ if (!path || path.length === 0) return ".";
52
+ path = normalizeWindowsPath(path);
53
+ const isUNCPath = path.match(UNC_REGEX);
54
+ const isPathAbsolute = isAbsolute(path);
55
+ const trailingSeparator = path[path.length - 1] === "/";
56
+ path = normalizeString(path, !isPathAbsolute);
57
+ if (path.length === 0) {
58
+ if (isPathAbsolute) return "/";
59
+ return trailingSeparator ? "./" : ".";
60
+ }
61
+ if (trailingSeparator) path += "/";
62
+ if (DRIVE_LETTER_REGEX.test(path)) path += "/";
63
+ if (isUNCPath) {
64
+ if (!isPathAbsolute) return `//./${path}`;
65
+ return `//${path}`;
66
+ }
67
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
68
+ }
69
+ /**
70
+ * Joins all given path segments together using the platform-specific separator as a delimiter.
71
+ * The resulting path is normalized to remove any redundant or unnecessary segments.
72
+ *
73
+ * @param segments - The path segments to join.
74
+ * @returns The joined and normalized path string.
75
+ */
76
+ function joinPaths(...segments) {
77
+ let path = "";
78
+ for (const seg of segments) {
79
+ if (!seg) continue;
80
+ if (path.length > 0) {
81
+ const pathTrailing = path[path.length - 1] === "/";
82
+ const segLeading = seg[0] === "/";
83
+ if (pathTrailing && segLeading) path += seg.slice(1);
84
+ else path += pathTrailing || segLeading ? seg : `/${seg}`;
85
+ } else path += seg;
86
+ }
87
+ return correctPaths(path);
88
+ }
89
+ /**
90
+ * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
91
+ *
92
+ * @param path - The path to normalize.
93
+ * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
94
+ * @returns the normalized path string.
95
+ */
96
+ function normalizeString(path, allowAboveRoot) {
97
+ let res = "";
98
+ let lastSegmentLength = 0;
99
+ let lastSlash = -1;
100
+ let dots = 0;
101
+ let char = null;
102
+ for (let index = 0; index <= path.length; ++index) {
103
+ if (index < path.length) char = path[index];
104
+ else if (char === "/") break;
105
+ else char = "/";
106
+ if (char === "/") {
107
+ if (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {
108
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
109
+ if (res.length > 2) {
110
+ const lastSlashIndex = res.lastIndexOf("/");
111
+ if (lastSlashIndex === -1) {
112
+ res = "";
113
+ lastSegmentLength = 0;
114
+ } else {
115
+ res = res.slice(0, lastSlashIndex);
116
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
117
+ }
118
+ lastSlash = index;
119
+ dots = 0;
120
+ continue;
121
+ } else if (res.length > 0) {
122
+ res = "";
123
+ lastSegmentLength = 0;
124
+ lastSlash = index;
125
+ dots = 0;
126
+ continue;
127
+ }
128
+ }
129
+ if (allowAboveRoot) {
130
+ res += res.length > 0 ? "/.." : "..";
131
+ lastSegmentLength = 2;
132
+ }
133
+ } else {
134
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
135
+ else res = path.slice(lastSlash + 1, index);
136
+ lastSegmentLength = index - lastSlash - 1;
137
+ }
138
+ lastSlash = index;
139
+ dots = 0;
140
+ } else if (char === "." && dots !== -1) ++dots;
141
+ else dots = -1;
142
+ }
143
+ return res;
144
+ }
145
+
146
+ //#endregion
147
+ export { slash as n, joinPaths as t };
148
+ //# sourceMappingURL=join-paths-BMg51Ddi.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"join-paths-BMg51Ddi.mjs","names":[],"sources":["../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/regex.mjs","../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/slash.mjs","../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/is-type.mjs","../../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/join-paths.mjs"],"sourcesContent":["//#region src/regex.ts\nconst DRIVE_LETTER_START_REGEX = /^[A-Z]:\\//i;\nconst DRIVE_LETTER_REGEX = /^[A-Z]:$/i;\nconst UNC_REGEX = /^[/\\\\]{2}/;\nconst ABSOLUTE_PATH_REGEX = /^[/\\\\](?![/\\\\])|^[/\\\\]{2}(?!\\.)|^~[/\\\\]|^[A-Z]:[/\\\\]/i;\nconst ROOT_FOLDER_REGEX = /^\\/([A-Z]:)?$/i;\nconst FILE_EXTENSION_REGEX = /\\.[0-9a-z]+$/i;\nconst FULL_FILE_EXTENSION_REGEX = /(\\.d)?\\.[0-9a-z]+(\\.map)?$/i;\nconst PACKAGE_PATH_REGEX = /^@\\w+\\/.*$/;\nconst NPM_SCOPED_PACKAGE_REGEX = /^(?:@[\\w-]+\\/)?[\\w-]+$/;\n\n//#endregion\nexport { ABSOLUTE_PATH_REGEX, DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, FILE_EXTENSION_REGEX, FULL_FILE_EXTENSION_REGEX, NPM_SCOPED_PACKAGE_REGEX, PACKAGE_PATH_REGEX, ROOT_FOLDER_REGEX, UNC_REGEX };\n//# sourceMappingURL=regex.mjs.map","import { isAbsolutePath } from \"./is-type.mjs\";\n\n//#region src/slash.ts\n/**\n* Replace backslash to slash\n*\n* @param path - The string to replace\n* @returns The string with replaced backslashes\n*/\nfunction slash(path) {\n\tif (path.startsWith(\"\\\\\\\\?\\\\\")) return path;\n\treturn path.replace(/\\\\/g, \"/\");\n}\n/**\n* Replace backslash to slash and remove unneeded leading and trailing slashes\n*\n* @param path - The string to replace\n* @returns The string with replaced backslashes\n*/\nfunction formatSlash(path) {\n\tconst formatted = slash(path);\n\treturn isAbsolutePath(formatted) ? formatted.replace(/\\/+$/g, \"\") : formatted.replace(/^\\.\\//g, \"\").replace(/\\/+$/g, \"\");\n}\n\n//#endregion\nexport { formatSlash, slash };\n//# sourceMappingURL=slash.mjs.map","import { ABSOLUTE_PATH_REGEX, NPM_SCOPED_PACKAGE_REGEX } from \"./regex.mjs\";\nimport { slash } from \"./slash.mjs\";\n\n//#region src/is-type.ts\n/**\n* Check if the path is an absolute path.\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is an absolute path\n*/\nfunction isAbsolutePath(path) {\n\treturn ABSOLUTE_PATH_REGEX.test(slash(path));\n}\n/**\n* Check if the path is an absolute path.\n*\n* @remarks\n* This is an alias for {@link isAbsolutePath}.\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is an absolute path\n*/\nfunction isAbsolute(path) {\n\treturn isAbsolutePath(path);\n}\n/**\n* Check if the path is a relative path.\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is a relative path\n*/\nfunction isRelativePath(path) {\n\treturn !isAbsolutePath(path);\n}\n/**\n* Check if the path is a relative path.\n*\n* @remarks\n* This is an alias for {@link isRelativePath}.\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is a relative path\n*/\nfunction isRelative(path) {\n\treturn isRelativePath(path);\n}\n/**\n* Check if the path is a npm package path.\n*\n* @remarks\n* This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackage}.\n*\n* @example\n* ```ts\n* isNpmScopedPackage(\"@stryke/path\"); // returns true\n* isNpmScopedPackage(\"lodash\"); // returns false\n* isNpmNamespacePackage(\"./src/index.ts\"); // returns false\n* ```\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is a npm package path\n*/\nfunction isNpmScopedPackagePath(path) {\n\treturn NPM_SCOPED_PACKAGE_REGEX.test(slash(path));\n}\n/**\n* Check if the path is a npm package path.\n*\n* @remarks\n* This only checks if the path matches the npm namespace scoped package naming convention such as `@scope/package-name`. This is an alias for {@link isNpmScopedPackagePath}.\n*\n* @example\n* ```ts\n* isNpmScopedPackagePath(\"@stryke/path\"); // returns true\n* isNpmScopedPackagePath(\"lodash\"); // returns false\n* isNpmScopedPackagePath(\"./src/index.ts\"); // returns false\n* ```\n*\n* @param path - The path to check\n* @returns An indicator specifying if the path is a npm package path\n*/\nfunction isNpmScopedPackage(path) {\n\treturn isNpmScopedPackagePath(path);\n}\n\n//#endregion\nexport { isAbsolute, isAbsolutePath, isNpmScopedPackage, isNpmScopedPackagePath, isRelative, isRelativePath };\n//# sourceMappingURL=is-type.mjs.map","import { DRIVE_LETTER_REGEX, DRIVE_LETTER_START_REGEX, UNC_REGEX } from \"./regex.mjs\";\nimport { isAbsolute } from \"./is-type.mjs\";\n\n//#region src/join-paths.ts\nfunction normalizeWindowsPath(input = \"\") {\n\tif (!input) return input;\n\treturn input.replace(/\\\\/g, \"/\").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());\n}\nfunction correctPaths(path) {\n\tif (!path || path.length === 0) return \".\";\n\tpath = normalizeWindowsPath(path);\n\tconst isUNCPath = path.match(UNC_REGEX);\n\tconst isPathAbsolute = isAbsolute(path);\n\tconst trailingSeparator = path[path.length - 1] === \"/\";\n\tpath = normalizeString(path, !isPathAbsolute);\n\tif (path.length === 0) {\n\t\tif (isPathAbsolute) return \"/\";\n\t\treturn trailingSeparator ? \"./\" : \".\";\n\t}\n\tif (trailingSeparator) path += \"/\";\n\tif (DRIVE_LETTER_REGEX.test(path)) path += \"/\";\n\tif (isUNCPath) {\n\t\tif (!isPathAbsolute) return `//./${path}`;\n\t\treturn `//${path}`;\n\t}\n\treturn isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;\n}\n/**\n* Joins all given path segments together using the platform-specific separator as a delimiter.\n* The resulting path is normalized to remove any redundant or unnecessary segments.\n*\n* @param segments - The path segments to join.\n* @returns The joined and normalized path string.\n*/\nfunction joinPaths(...segments) {\n\tlet path = \"\";\n\tfor (const seg of segments) {\n\t\tif (!seg) continue;\n\t\tif (path.length > 0) {\n\t\t\tconst pathTrailing = path[path.length - 1] === \"/\";\n\t\t\tconst segLeading = seg[0] === \"/\";\n\t\t\tif (pathTrailing && segLeading) path += seg.slice(1);\n\t\t\telse path += pathTrailing || segLeading ? seg : `/${seg}`;\n\t\t} else path += seg;\n\t}\n\treturn correctPaths(path);\n}\nconst join = joinPaths;\n/**\n* Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.\n*\n* @param path - The path to normalize.\n* @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.\n* @returns the normalized path string.\n*/\nfunction normalizeString(path, allowAboveRoot) {\n\tlet res = \"\";\n\tlet lastSegmentLength = 0;\n\tlet lastSlash = -1;\n\tlet dots = 0;\n\tlet char = null;\n\tfor (let index = 0; index <= path.length; ++index) {\n\t\tif (index < path.length) char = path[index];\n\t\telse if (char === \"/\") break;\n\t\telse char = \"/\";\n\t\tif (char === \"/\") {\n\t\t\tif (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {\n\t\t\t\tif (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== \".\" || res[res.length - 2] !== \".\") {\n\t\t\t\t\tif (res.length > 2) {\n\t\t\t\t\t\tconst lastSlashIndex = res.lastIndexOf(\"/\");\n\t\t\t\t\t\tif (lastSlashIndex === -1) {\n\t\t\t\t\t\t\tres = \"\";\n\t\t\t\t\t\t\tlastSegmentLength = 0;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tres = res.slice(0, lastSlashIndex);\n\t\t\t\t\t\t\tlastSegmentLength = res.length - 1 - res.lastIndexOf(\"/\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\tlastSlash = index;\n\t\t\t\t\t\tdots = 0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t} else if (res.length > 0) {\n\t\t\t\t\t\tres = \"\";\n\t\t\t\t\t\tlastSegmentLength = 0;\n\t\t\t\t\t\tlastSlash = index;\n\t\t\t\t\t\tdots = 0;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif (allowAboveRoot) {\n\t\t\t\t\tres += res.length > 0 ? \"/..\" : \"..\";\n\t\t\t\t\tlastSegmentLength = 2;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;\n\t\t\t\telse res = path.slice(lastSlash + 1, index);\n\t\t\t\tlastSegmentLength = index - lastSlash - 1;\n\t\t\t}\n\t\t\tlastSlash = index;\n\t\t\tdots = 0;\n\t\t} else if (char === \".\" && dots !== -1) ++dots;\n\t\telse dots = -1;\n\t}\n\treturn res;\n}\n\n//#endregion\nexport { join, joinPaths };\n//# sourceMappingURL=join-paths.mjs.map"],"x_google_ignoreList":[0,1,2,3],"mappings":";AACA,MAAM,2BAA2B;AACjC,MAAM,qBAAqB;AAC3B,MAAM,YAAY;AAClB,MAAM,sBAAsB;;;;;;;;;;ACK5B,SAAS,MAAM,MAAM;AACpB,KAAI,KAAK,WAAW,UAAU,CAAE,QAAO;AACvC,QAAO,KAAK,QAAQ,OAAO,IAAI;;;;;;;;;;;ACDhC,SAAS,eAAe,MAAM;AAC7B,QAAO,oBAAoB,KAAK,MAAM,KAAK,CAAC;;;;;;;;;;;AAW7C,SAAS,WAAW,MAAM;AACzB,QAAO,eAAe,KAAK;;;;;ACnB5B,SAAS,qBAAqB,QAAQ,IAAI;AACzC,KAAI,CAAC,MAAO,QAAO;AACnB,QAAO,MAAM,QAAQ,OAAO,IAAI,CAAC,QAAQ,2BAA2B,MAAM,EAAE,aAAa,CAAC;;AAE3F,SAAS,aAAa,MAAM;AAC3B,KAAI,CAAC,QAAQ,KAAK,WAAW,EAAG,QAAO;AACvC,QAAO,qBAAqB,KAAK;CACjC,MAAM,YAAY,KAAK,MAAM,UAAU;CACvC,MAAM,iBAAiB,WAAW,KAAK;CACvC,MAAM,oBAAoB,KAAK,KAAK,SAAS,OAAO;AACpD,QAAO,gBAAgB,MAAM,CAAC,eAAe;AAC7C,KAAI,KAAK,WAAW,GAAG;AACtB,MAAI,eAAgB,QAAO;AAC3B,SAAO,oBAAoB,OAAO;;AAEnC,KAAI,kBAAmB,SAAQ;AAC/B,KAAI,mBAAmB,KAAK,KAAK,CAAE,SAAQ;AAC3C,KAAI,WAAW;AACd,MAAI,CAAC,eAAgB,QAAO,OAAO;AACnC,SAAO,KAAK;;AAE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AS,IAAI,QAAQ;AAChC,yBAAoB;;UAEf;AACN,QAAI,IAAI,SAAS,EAAG,QAAO,IAAI,KAAK,MAAM,YAAY,GAAG,MAAM;QAC1D,OAAM,KAAK,MAAM,YAAY,GAAG,MAAM;AAC3C,wBAAoB,QAAQ,YAAY;;AAEzC,eAAY;AACZ,UAAO;aACG,SAAS,OAAO,SAAS,GAAI,GAAE;MACrC,QAAO;;AAEb,QAAO"}
@@ -0,0 +1,159 @@
1
+
2
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.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
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/slash.mjs
10
+ /**
11
+ * Replace backslash to slash
12
+ *
13
+ * @param path - The string to replace
14
+ * @returns The string with replaced backslashes
15
+ */
16
+ function slash(path) {
17
+ if (path.startsWith("\\\\?\\")) return path;
18
+ return path.replace(/\\/g, "/");
19
+ }
20
+
21
+ //#endregion
22
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/is-type.mjs
23
+ /**
24
+ * Check if the path is an absolute path.
25
+ *
26
+ * @param path - The path to check
27
+ * @returns An indicator specifying if the path is an absolute path
28
+ */
29
+ function isAbsolutePath(path) {
30
+ return ABSOLUTE_PATH_REGEX.test(slash(path));
31
+ }
32
+ /**
33
+ * Check if the path is an absolute path.
34
+ *
35
+ * @remarks
36
+ * This is an alias for {@link isAbsolutePath}.
37
+ *
38
+ * @param path - The path to check
39
+ * @returns An indicator specifying if the path is an absolute path
40
+ */
41
+ function isAbsolute(path) {
42
+ return isAbsolutePath(path);
43
+ }
44
+
45
+ //#endregion
46
+ //#region ../../node_modules/.pnpm/@stryke+path@0.26.3/node_modules/@stryke/path/dist/join-paths.mjs
47
+ function normalizeWindowsPath(input = "") {
48
+ if (!input) return input;
49
+ return input.replace(/\\/g, "/").replace(DRIVE_LETTER_START_REGEX, (r) => r.toUpperCase());
50
+ }
51
+ function correctPaths(path) {
52
+ if (!path || path.length === 0) return ".";
53
+ path = normalizeWindowsPath(path);
54
+ const isUNCPath = path.match(UNC_REGEX);
55
+ const isPathAbsolute = isAbsolute(path);
56
+ const trailingSeparator = path[path.length - 1] === "/";
57
+ path = normalizeString(path, !isPathAbsolute);
58
+ if (path.length === 0) {
59
+ if (isPathAbsolute) return "/";
60
+ return trailingSeparator ? "./" : ".";
61
+ }
62
+ if (trailingSeparator) path += "/";
63
+ if (DRIVE_LETTER_REGEX.test(path)) path += "/";
64
+ if (isUNCPath) {
65
+ if (!isPathAbsolute) return `//./${path}`;
66
+ return `//${path}`;
67
+ }
68
+ return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
69
+ }
70
+ /**
71
+ * Joins all given path segments together using the platform-specific separator as a delimiter.
72
+ * The resulting path is normalized to remove any redundant or unnecessary segments.
73
+ *
74
+ * @param segments - The path segments to join.
75
+ * @returns The joined and normalized path string.
76
+ */
77
+ function joinPaths(...segments) {
78
+ let path = "";
79
+ for (const seg of segments) {
80
+ if (!seg) continue;
81
+ if (path.length > 0) {
82
+ const pathTrailing = path[path.length - 1] === "/";
83
+ const segLeading = seg[0] === "/";
84
+ if (pathTrailing && segLeading) path += seg.slice(1);
85
+ else path += pathTrailing || segLeading ? seg : `/${seg}`;
86
+ } else path += seg;
87
+ }
88
+ return correctPaths(path);
89
+ }
90
+ /**
91
+ * Resolves a string path, resolving '.' and '.' segments and allowing paths above the root.
92
+ *
93
+ * @param path - The path to normalize.
94
+ * @param allowAboveRoot - Whether to allow the resulting path to be above the root directory.
95
+ * @returns the normalized path string.
96
+ */
97
+ function normalizeString(path, allowAboveRoot) {
98
+ let res = "";
99
+ let lastSegmentLength = 0;
100
+ let lastSlash = -1;
101
+ let dots = 0;
102
+ let char = null;
103
+ for (let index = 0; index <= path.length; ++index) {
104
+ if (index < path.length) char = path[index];
105
+ else if (char === "/") break;
106
+ else char = "/";
107
+ if (char === "/") {
108
+ if (lastSlash === index - 1 || dots === 1) {} else if (dots === 2) {
109
+ if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
110
+ if (res.length > 2) {
111
+ const lastSlashIndex = res.lastIndexOf("/");
112
+ if (lastSlashIndex === -1) {
113
+ res = "";
114
+ lastSegmentLength = 0;
115
+ } else {
116
+ res = res.slice(0, lastSlashIndex);
117
+ lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
118
+ }
119
+ lastSlash = index;
120
+ dots = 0;
121
+ continue;
122
+ } else if (res.length > 0) {
123
+ res = "";
124
+ lastSegmentLength = 0;
125
+ lastSlash = index;
126
+ dots = 0;
127
+ continue;
128
+ }
129
+ }
130
+ if (allowAboveRoot) {
131
+ res += res.length > 0 ? "/.." : "..";
132
+ lastSegmentLength = 2;
133
+ }
134
+ } else {
135
+ if (res.length > 0) res += `/${path.slice(lastSlash + 1, index)}`;
136
+ else res = path.slice(lastSlash + 1, index);
137
+ lastSegmentLength = index - lastSlash - 1;
138
+ }
139
+ lastSlash = index;
140
+ dots = 0;
141
+ } else if (char === "." && dots !== -1) ++dots;
142
+ else dots = -1;
143
+ }
144
+ return res;
145
+ }
146
+
147
+ //#endregion
148
+ Object.defineProperty(exports, 'joinPaths', {
149
+ enumerable: true,
150
+ get: function () {
151
+ return joinPaths;
152
+ }
153
+ });
154
+ Object.defineProperty(exports, 'slash', {
155
+ enumerable: true,
156
+ get: function () {
157
+ return slash;
158
+ }
159
+ });