@catladder/cli 0.0.0-next-7c1dcdcf → 0.0.0-next-837b10de

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.
@@ -867,17 +867,19 @@ const escapeSingleQuotes = (value) => value === null || value === void 0 ? void
867
867
  exports.escapeSingleQuotes = escapeSingleQuotes;
868
868
  /**
869
869
  *
870
- * what an absolute nightmare.
871
- * unfortunatly, dotenv has many limitations. You can't escape quotes properly.
872
- *
873
- * In order to be very forgiving, we need to do some magic here:
870
+ * escape env vars for .env files.
871
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
874
872
  *
875
873
  * - when the value contains no newlines, we are fine
876
874
  * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
877
- * - you can't escape quotes. this is a shitty limitation of dotenv and node
875
+ * - you can't escape quotes. this is a limitation of dotenv and node
878
876
  * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
879
877
  * - so we need to quote cleverly
880
878
  * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
879
+ *
880
+ * what an absolute nightmare.
881
+ *
882
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
881
883
  */
882
884
  const escapeForDotEnv = (value) => {
883
885
  if (value === undefined || value === null) {
@@ -892,8 +894,8 @@ const escapeForDotEnv = (value) => {
892
894
  const quote = value.includes(`"`)
893
895
  ? value.includes(`'`)
894
896
  ? value.includes("`")
895
- ? // If all quote types are present, default to no
896
- ""
897
+ ? // If all quote types are present, default to double quotes. This works in dotenv, but not in node.js because of the bug mentioned abouve
898
+ '"'
897
899
  : "`"
898
900
  : "'"
899
901
  : '"';
@@ -935,7 +937,7 @@ const escapeForDotEnvScript = (0, globalScriptFunctions_1.registerGlobalScriptFu
935
937
  input="\${input//$'\\n'/\\\\n}"
936
938
  if [[ "$input" == *\\\\n* ]]; then
937
939
  if [[ "$input" == *\\"* && "$input" == *\\'* && "$input" == *\\\`* ]]; then
938
- printf "%s\\n" "$input"
940
+ printf "\\"%s\\"\\n" "$input" ${ /* fallback to double quotes */""}
939
941
  elif [[ "$input" == *\\"* && "$input" == *\\'* ]]; then
940
942
  printf "\`%s\`\\n" "$input"
941
943
  elif [[ "$input" == *\\"* ]]; then
@@ -3911,17 +3911,19 @@ const escapeSingleQuotes = (value) => value === null || value === void 0 ? void
3911
3911
  exports.escapeSingleQuotes = escapeSingleQuotes;
3912
3912
  /**
3913
3913
  *
3914
- * what an absolute nightmare.
3915
- * unfortunatly, dotenv has many limitations. You can't escape quotes properly.
3916
- *
3917
- * In order to be very forgiving, we need to do some magic here:
3914
+ * escape env vars for .env files.
3915
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
3918
3916
  *
3919
3917
  * - when the value contains no newlines, we are fine
3920
3918
  * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
3921
- * - you can't escape quotes. this is a shitty limitation of dotenv and node
3919
+ * - you can't escape quotes. this is a limitation of dotenv and node
3922
3920
  * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
3923
3921
  * - so we need to quote cleverly
3924
3922
  * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
3923
+ *
3924
+ * what an absolute nightmare.
3925
+ *
3926
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
3925
3927
  */
3926
3928
  const escapeForDotEnv = (value) => {
3927
3929
  if (value === undefined || value === null) {
@@ -3936,8 +3938,8 @@ const escapeForDotEnv = (value) => {
3936
3938
  const quote = value.includes(`"`)
3937
3939
  ? value.includes(`'`)
3938
3940
  ? value.includes("`")
3939
- ? // If all quote types are present, default to no
3940
- ""
3941
+ ? // If all quote types are present, default to double quotes. This works in dotenv, but not in node.js because of the bug mentioned abouve
3942
+ '"'
3941
3943
  : "`"
3942
3944
  : "'"
3943
3945
  : '"';
@@ -3979,7 +3981,7 @@ const escapeForDotEnvScript = (0, globalScriptFunctions_1.registerGlobalScriptFu
3979
3981
  input="\${input//$'\\n'/\\\\n}"
3980
3982
  if [[ "$input" == *\\\\n* ]]; then
3981
3983
  if [[ "$input" == *\\"* && "$input" == *\\'* && "$input" == *\\\`* ]]; then
3982
- printf "%s\\n" "$input"
3984
+ printf "\\"%s\\"\\n" "$input" ${ /* fallback to double quotes */""}
3983
3985
  elif [[ "$input" == *\\"* && "$input" == *\\'* ]]; then
3984
3986
  printf "\`%s\`\\n" "$input"
3985
3987
  elif [[ "$input" == *\\"* ]]; then
@@ -15,16 +15,18 @@ export declare const escapeDoubleQuotes: (value: string | null | undefined) => s
15
15
  export declare const escapeSingleQuotes: (value: string | null | undefined) => string;
16
16
  /**
17
17
  *
18
- * what an absolute nightmare.
19
- * unfortunatly, dotenv has many limitations. You can't escape quotes properly.
20
- *
21
- * In order to be very forgiving, we need to do some magic here:
18
+ * escape env vars for .env files.
19
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
22
20
  *
23
21
  * - when the value contains no newlines, we are fine
24
22
  * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
25
- * - you can't escape quotes. this is a shitty limitation of dotenv and node
23
+ * - you can't escape quotes. this is a limitation of dotenv and node
26
24
  * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
27
25
  * - so we need to quote cleverly
28
26
  * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
27
+ *
28
+ * what an absolute nightmare.
29
+ *
30
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
29
31
  */
30
32
  export declare const escapeForDotEnv: (value: VariableValue | undefined | null) => string;
@@ -43,17 +43,19 @@ const escapeSingleQuotes = (value) => value === null || value === void 0 ? void
43
43
  exports.escapeSingleQuotes = escapeSingleQuotes;
44
44
  /**
45
45
  *
46
- * what an absolute nightmare.
47
- * unfortunatly, dotenv has many limitations. You can't escape quotes properly.
48
- *
49
- * In order to be very forgiving, we need to do some magic here:
46
+ * escape env vars for .env files.
47
+ * unfortunatly, the format has many limitations. In order to be very forgiving, we need to do some magic here:
50
48
  *
51
49
  * - when the value contains no newlines, we are fine
52
50
  * - if the value contains newlines, we need to wrap it in quotes. And thats where the problem begins:
53
- * - you can't escape quotes. this is a shitty limitation of dotenv and node
51
+ * - you can't escape quotes. this is a limitation of dotenv and node
54
52
  * - you can have inner quotes, but they break in node.js (not in dotenv though), see https://github.com/nodejs/node/issues/54134
55
53
  * - so we need to quote cleverly
56
54
  * - to make things worse, we need to check whether we have a simple stirng or a bash expression, that needs to be evalulated first...
55
+ *
56
+ * what an absolute nightmare.
57
+ *
58
+ * - other languages are currently only partially supported, since most .env implementations are slightly different
57
59
  */
58
60
  const escapeForDotEnv = (value) => {
59
61
  if (value === undefined || value === null) {
@@ -68,8 +70,8 @@ const escapeForDotEnv = (value) => {
68
70
  const quote = value.includes(`"`)
69
71
  ? value.includes(`'`)
70
72
  ? value.includes("`")
71
- ? // If all quote types are present, default to no
72
- ""
73
+ ? // If all quote types are present, default to double quotes. This works in dotenv, but not in node.js because of the bug mentioned abouve
74
+ '"'
73
75
  : "`"
74
76
  : "'"
75
77
  : '"';
@@ -111,7 +113,7 @@ const escapeForDotEnvScript = (0, globalScriptFunctions_1.registerGlobalScriptFu
111
113
  input="\${input//$'\\n'/\\\\n}"
112
114
  if [[ "$input" == *\\\\n* ]]; then
113
115
  if [[ "$input" == *\\"* && "$input" == *\\'* && "$input" == *\\\`* ]]; then
114
- printf "%s\\n" "$input"
116
+ printf "\\"%s\\"\\n" "$input" ${ /* fallback to double quotes */""}
115
117
  elif [[ "$input" == *\\"* && "$input" == *\\'* ]]; then
116
118
  printf "\`%s\`\\n" "$input"
117
119
  elif [[ "$input" == *\\"* ]]; then
@@ -1 +1 @@
1
- {"version":3,"file":"bashEscape.js","sourceRoot":"","sources":["../../../../../pipeline/src/bash/bashEscape.ts"],"names":[],"mappings":";;;AAAA,oEAAwE;AAExE,sGAAmG;AACnG,qDAAkD;AAOlD;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