@readme/httpsnippet 7.0.1 → 7.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-BCCGHMCJ.mjs +18 -0
- package/dist/chunk-BCCGHMCJ.mjs.map +1 -0
- package/dist/{chunk-XPUGYZ4Y.mjs → chunk-DTZD7L6R.mjs} +3 -62
- package/dist/chunk-DTZD7L6R.mjs.map +1 -0
- package/dist/chunk-UEOS42PC.mjs +63 -0
- package/dist/chunk-UEOS42PC.mjs.map +1 -0
- package/dist/helpers/code-builder.d.mts +51 -0
- package/dist/helpers/code-builder.d.ts +51 -0
- package/dist/helpers/code-builder.js +65 -0
- package/dist/helpers/code-builder.js.map +1 -0
- package/dist/helpers/code-builder.mjs +3 -0
- package/dist/helpers/reducer.d.mts +7 -0
- package/dist/helpers/reducer.d.ts +7 -0
- package/dist/helpers/reducer.js +20 -0
- package/dist/helpers/reducer.js.map +1 -0
- package/dist/helpers/reducer.mjs +3 -0
- package/dist/helpers/reducer.mjs.map +1 -0
- package/dist/{index-acc66e3d.d.ts → index-27be831e.d.ts} +2 -15
- package/dist/index-e612cd58.d.ts +154 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +4 -17
- package/dist/index.mjs.map +1 -1
- package/dist/targets/{targets.d.mts → index.d.mts} +3 -1
- package/dist/targets/{targets.d.ts → index.d.ts} +3 -1
- package/dist/targets/{targets.js → index.js} +2 -2
- package/dist/targets/index.js.map +1 -0
- package/dist/targets/index.mjs +4 -0
- package/dist/targets/index.mjs.map +1 -0
- package/package.json +4 -4
- package/dist/chunk-XPUGYZ4Y.mjs.map +0 -1
- package/dist/targets/targets.js.map +0 -1
- package/dist/targets/targets.mjs +0 -3
- /package/dist/{targets/targets.mjs.map → helpers/code-builder.mjs.map} +0 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/helpers/reducer.ts
|
|
2
|
+
var reducer = (accumulator, pair) => {
|
|
3
|
+
const currentValue = accumulator[pair.name];
|
|
4
|
+
if (currentValue === void 0) {
|
|
5
|
+
accumulator[pair.name] = pair.value;
|
|
6
|
+
return accumulator;
|
|
7
|
+
}
|
|
8
|
+
if (Array.isArray(currentValue)) {
|
|
9
|
+
currentValue.push(pair.value);
|
|
10
|
+
return accumulator;
|
|
11
|
+
}
|
|
12
|
+
accumulator[pair.name] = [currentValue, pair.value];
|
|
13
|
+
return accumulator;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export { reducer };
|
|
17
|
+
//# sourceMappingURL=out.js.map
|
|
18
|
+
//# sourceMappingURL=chunk-BCCGHMCJ.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/helpers/reducer.ts"],"names":[],"mappings":";AAEO,IAAM,UAAU,CAA4C,aAAkC,SAAY;AAC/G,QAAM,eAAe,YAAY,KAAK,IAAI;AAC1C,MAAI,iBAAiB,QAAW;AAC9B,gBAAY,KAAK,IAAI,IAAI,KAAK;AAC9B,WAAO;AAAA,EACT;AAGA,MAAI,MAAM,QAAQ,YAAY,GAAG;AAC/B,iBAAa,KAAK,KAAK,KAAK;AAC5B,WAAO;AAAA,EACT;AAGA,cAAY,KAAK,IAAI,IAAI,CAAC,cAAc,KAAK,KAAK;AAClD,SAAO;AACT","sourcesContent":["export type ReducedHelperObject = Record<string, string[] | string>;\n\nexport const reducer = <T extends { name: string; value: string }>(accumulator: ReducedHelperObject, pair: T) => {\n const currentValue = accumulator[pair.name];\n if (currentValue === undefined) {\n accumulator[pair.name] = pair.value;\n return accumulator;\n }\n\n // If we already have it as array just push the value\n if (Array.isArray(currentValue)) {\n currentValue.push(pair.value);\n return accumulator;\n }\n\n // convert to array since now we have more than one value for this key\n accumulator[pair.name] = [currentValue, pair.value];\n return accumulator;\n};\n"]}
|
|
@@ -1,65 +1,6 @@
|
|
|
1
|
+
import { CodeBuilder } from './chunk-UEOS42PC.mjs';
|
|
1
2
|
import stringifyObject9 from 'stringify-object';
|
|
2
3
|
|
|
3
|
-
// src/helpers/code-builder.ts
|
|
4
|
-
var DEFAULT_INDENTATION_CHARACTER = "";
|
|
5
|
-
var DEFAULT_LINE_JOIN = "\n";
|
|
6
|
-
var CodeBuilder = class {
|
|
7
|
-
/**
|
|
8
|
-
* Helper object to format and aggragate lines of code.
|
|
9
|
-
* Lines are aggregated in a `code` array, and need to be joined to obtain a proper code snippet.
|
|
10
|
-
*/
|
|
11
|
-
constructor({ indent, join } = {}) {
|
|
12
|
-
this.postProcessors = [];
|
|
13
|
-
this.code = [];
|
|
14
|
-
this.indentationCharacter = DEFAULT_INDENTATION_CHARACTER;
|
|
15
|
-
this.lineJoin = DEFAULT_LINE_JOIN;
|
|
16
|
-
/**
|
|
17
|
-
* Add given indentation level to given line of code
|
|
18
|
-
*/
|
|
19
|
-
this.indentLine = (line, indentationLevel = 0) => {
|
|
20
|
-
const indent = this.indentationCharacter.repeat(indentationLevel);
|
|
21
|
-
return `${indent}${line}`;
|
|
22
|
-
};
|
|
23
|
-
/**
|
|
24
|
-
* Add the line at the beginning of the current lines
|
|
25
|
-
*/
|
|
26
|
-
this.unshift = (line, indentationLevel) => {
|
|
27
|
-
const newLine = this.indentLine(line, indentationLevel);
|
|
28
|
-
this.code.unshift(newLine);
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* Add the line at the end of the current lines
|
|
32
|
-
*/
|
|
33
|
-
this.push = (line, indentationLevel) => {
|
|
34
|
-
const newLine = this.indentLine(line, indentationLevel);
|
|
35
|
-
this.code.push(newLine);
|
|
36
|
-
};
|
|
37
|
-
/**
|
|
38
|
-
* Add an empty line at the end of current lines
|
|
39
|
-
*/
|
|
40
|
-
this.blank = () => {
|
|
41
|
-
this.code.push("");
|
|
42
|
-
};
|
|
43
|
-
/**
|
|
44
|
-
* Concatenate all current lines using the given lineJoin, then apply any replacers that may have been added
|
|
45
|
-
*/
|
|
46
|
-
this.join = () => {
|
|
47
|
-
const unreplacedCode = this.code.join(this.lineJoin);
|
|
48
|
-
const replacedOutput = this.postProcessors.reduce((accumulator, replacer) => replacer(accumulator), unreplacedCode);
|
|
49
|
-
return replacedOutput;
|
|
50
|
-
};
|
|
51
|
-
/**
|
|
52
|
-
* Often when writing modules you may wish to add a literal tag or bit of metadata that you wish to transform after other processing as a final step.
|
|
53
|
-
* To do so, you can provide a PostProcessor function and it will be run automatically for you when you call `join()` later on.
|
|
54
|
-
*/
|
|
55
|
-
this.addPostProcessor = (postProcessor) => {
|
|
56
|
-
this.postProcessors = [...this.postProcessors, postProcessor];
|
|
57
|
-
};
|
|
58
|
-
this.indentationCharacter = indent || DEFAULT_INDENTATION_CHARACTER;
|
|
59
|
-
this.lineJoin = join ?? DEFAULT_LINE_JOIN;
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
|
|
63
4
|
// src/helpers/escape.ts
|
|
64
5
|
function escapeString(rawValue, options = {}) {
|
|
65
6
|
const { delimiter = '"', escapeChar = "\\", escapeNewlines = true } = options;
|
|
@@ -3370,7 +3311,7 @@ var swift = {
|
|
|
3370
3311
|
}
|
|
3371
3312
|
};
|
|
3372
3313
|
|
|
3373
|
-
// src/targets/
|
|
3314
|
+
// src/targets/index.ts
|
|
3374
3315
|
var targets = {
|
|
3375
3316
|
c,
|
|
3376
3317
|
clojure,
|
|
@@ -3482,4 +3423,4 @@ var addTargetClient = (targetId, client) => {
|
|
|
3482
3423
|
|
|
3483
3424
|
export { addTarget, addTargetClient, getHeaderName, isClient, isTarget, targets };
|
|
3484
3425
|
//# sourceMappingURL=out.js.map
|
|
3485
|
-
//# sourceMappingURL=chunk-
|
|
3426
|
+
//# sourceMappingURL=chunk-DTZD7L6R.mjs.map
|