@bedelightful/es6-template-strings 0.0.5
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/LICENSE +8 -0
- package/README.md +60 -0
- package/dist/es/compile.js +105 -0
- package/dist/es/compile.js.map +1 -0
- package/dist/es/index.d.ts +22 -0
- package/dist/es/index.js +9 -0
- package/dist/es/index.js.map +1 -0
- package/dist/es/passthru-array.js +18 -0
- package/dist/es/passthru-array.js.map +1 -0
- package/dist/es/passthru.js +13 -0
- package/dist/es/passthru.js.map +1 -0
- package/dist/es/resolve-to-array.js +12 -0
- package/dist/es/resolve-to-array.js.map +1 -0
- package/dist/es/resolve-to-string.js +12 -0
- package/dist/es/resolve-to-string.js.map +1 -0
- package/dist/es/resolve.js +62 -0
- package/dist/es/resolve.js.map +1 -0
- package/dist/es/to-array.js +16 -0
- package/dist/es/to-array.js.map +1 -0
- package/dist/es/to-string.js +16 -0
- package/dist/es/to-string.js.map +1 -0
- package/dist/es/types.js +1 -0
- package/dist/es/types.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +3123 -0
- package/dist/index.js.map +1 -0
- package/dist/index.min.js +20 -0
- package/dist/index.min.js.map +1 -0
- package/dist/lib/compile.js +134 -0
- package/dist/lib/compile.js.map +1 -0
- package/dist/lib/index.d.cts +22 -0
- package/dist/lib/index.js +44 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/passthru-array.js +37 -0
- package/dist/lib/passthru-array.js.map +1 -0
- package/dist/lib/passthru.js +32 -0
- package/dist/lib/passthru.js.map +1 -0
- package/dist/lib/resolve-to-array.js +41 -0
- package/dist/lib/resolve-to-array.js.map +1 -0
- package/dist/lib/resolve-to-string.js +41 -0
- package/dist/lib/resolve-to-string.js.map +1 -0
- package/dist/lib/resolve.js +91 -0
- package/dist/lib/resolve.js.map +1 -0
- package/dist/lib/to-array.js +45 -0
- package/dist/lib/to-array.js.map +1 -0
- package/dist/lib/to-string.js +45 -0
- package/dist/lib/to-string.js.map +1 -0
- package/dist/lib/types.js +17 -0
- package/dist/lib/types.js.map +1 -0
- package/package.json +66 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
9
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
10
|
+
var __export = (target, all) => {
|
|
11
|
+
for (var name in all)
|
|
12
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
13
|
+
};
|
|
14
|
+
var __copyProps = (to, from, except, desc) => {
|
|
15
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
16
|
+
for (let key of __getOwnPropNames(from))
|
|
17
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
18
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
23
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
24
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
25
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
26
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
27
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
28
|
+
mod
|
|
29
|
+
));
|
|
30
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
31
|
+
var __publicField = (obj, key, value) => {
|
|
32
|
+
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
33
|
+
return value;
|
|
34
|
+
};
|
|
35
|
+
var compile_exports = {};
|
|
36
|
+
__export(compile_exports, {
|
|
37
|
+
default: () => compile
|
|
38
|
+
});
|
|
39
|
+
module.exports = __toCommonJS(compile_exports);
|
|
40
|
+
var import_esniff = __toESM(require("esniff"), 1);
|
|
41
|
+
var _a;
|
|
42
|
+
let i;
|
|
43
|
+
let current;
|
|
44
|
+
let literals;
|
|
45
|
+
let substitutions;
|
|
46
|
+
let template;
|
|
47
|
+
let Notation = "$";
|
|
48
|
+
let NotationStart = "{";
|
|
49
|
+
let NotationEnd = "}";
|
|
50
|
+
let Compile = (_a = class {
|
|
51
|
+
}, __name(_a, "Compile"), __publicField(_a, "sOut", /* @__PURE__ */ __name((char) => {
|
|
52
|
+
if (char === "\\")
|
|
53
|
+
return _a.sEscape;
|
|
54
|
+
if (char === Notation)
|
|
55
|
+
return _a.sAhead;
|
|
56
|
+
current += char;
|
|
57
|
+
return _a.sOut;
|
|
58
|
+
}, "sOut")), __publicField(_a, "sEscape", /* @__PURE__ */ __name((char) => {
|
|
59
|
+
if (char !== "\\" && char !== Notation) {
|
|
60
|
+
current += "\\";
|
|
61
|
+
}
|
|
62
|
+
current += char;
|
|
63
|
+
return _a.sOut;
|
|
64
|
+
}, "sEscape")), __publicField(_a, "sAhead", /* @__PURE__ */ __name((char) => {
|
|
65
|
+
if (char === NotationStart) {
|
|
66
|
+
literals == null ? void 0 : literals.push(current);
|
|
67
|
+
current = "";
|
|
68
|
+
return _a.sIn;
|
|
69
|
+
}
|
|
70
|
+
if (char === Notation) {
|
|
71
|
+
current += Notation;
|
|
72
|
+
return _a.sAhead;
|
|
73
|
+
}
|
|
74
|
+
current += Notation + char;
|
|
75
|
+
return _a.sOut;
|
|
76
|
+
}, "sAhead")), __publicField(_a, "sIn", /* @__PURE__ */ __name(() => {
|
|
77
|
+
const code = template.slice(i);
|
|
78
|
+
let end;
|
|
79
|
+
(0, import_esniff.default)(code, NotationEnd, (j) => {
|
|
80
|
+
if (import_esniff.default.nest >= 0)
|
|
81
|
+
return import_esniff.default.next();
|
|
82
|
+
end = j;
|
|
83
|
+
});
|
|
84
|
+
if (end != null) {
|
|
85
|
+
substitutions == null ? void 0 : substitutions.push(template.slice(i, i + end));
|
|
86
|
+
i += end;
|
|
87
|
+
current = "";
|
|
88
|
+
return _a.sOut;
|
|
89
|
+
}
|
|
90
|
+
end = code.length;
|
|
91
|
+
i += end;
|
|
92
|
+
current += code;
|
|
93
|
+
return _a.sIn;
|
|
94
|
+
}, "sIn")), __publicField(_a, "sInEscape", /* @__PURE__ */ __name(function(char) {
|
|
95
|
+
if (char !== "\\" && char !== NotationEnd) {
|
|
96
|
+
current += "\\";
|
|
97
|
+
}
|
|
98
|
+
current += char;
|
|
99
|
+
return _a.sIn;
|
|
100
|
+
}, "sInEscape")), _a);
|
|
101
|
+
function compile(str, options) {
|
|
102
|
+
current = "";
|
|
103
|
+
literals = [];
|
|
104
|
+
substitutions = [];
|
|
105
|
+
Notation = (options == null ? void 0 : options.notation) || "$";
|
|
106
|
+
NotationStart = (options == null ? void 0 : options.notationStart) || "{";
|
|
107
|
+
NotationEnd = (options == null ? void 0 : options.notationEnd) || "}";
|
|
108
|
+
template = String(str);
|
|
109
|
+
const { length } = template;
|
|
110
|
+
let state = Compile.sOut;
|
|
111
|
+
for (i = 0; i < length; i += 1) {
|
|
112
|
+
state = state(template[i]);
|
|
113
|
+
}
|
|
114
|
+
if (state === Compile.sOut) {
|
|
115
|
+
literals.push(current);
|
|
116
|
+
} else if (state === Compile.sEscape) {
|
|
117
|
+
literals.push(`${current}\\`);
|
|
118
|
+
} else if (state === Compile.sAhead) {
|
|
119
|
+
literals.push(current + Notation);
|
|
120
|
+
} else if (state === Compile.sIn) {
|
|
121
|
+
literals[literals.length - 1] += `${Notation}${NotationStart}${current}`;
|
|
122
|
+
} else if (state === Compile.sInEscape) {
|
|
123
|
+
literals[literals.length - 1] += `${Notation}${NotationStart}${current}\\`;
|
|
124
|
+
}
|
|
125
|
+
const result = {
|
|
126
|
+
literals,
|
|
127
|
+
substitutions
|
|
128
|
+
};
|
|
129
|
+
literals = null;
|
|
130
|
+
substitutions = null;
|
|
131
|
+
return result;
|
|
132
|
+
}
|
|
133
|
+
__name(compile, "compile");
|
|
134
|
+
//# sourceMappingURL=compile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/compile.ts"],"sourcesContent":["import esniff from \"esniff\"\nimport type { CompileOptions } from \"./types\"\n\nlet i: number\nlet current: string\nlet literals: null | Array<string>\nlet substitutions: null | Array<string>\nlet template: string\n\n/** Prefix for template syntax */\nlet Notation: string = \"$\"\n/** Opening delimiter for template syntax */\nlet NotationStart: string = \"{\"\n/** Closing delimiter for template syntax */\nlet NotationEnd: string = \"}\"\n\nexport interface Result {\n\tliterals: string[]\n\tsubstitutions: string[]\n}\n\ntype State = (char: string) => State\n\nclass Compile {\n\tstatic sOut: State = (char) => {\n\t\tif (char === \"\\\\\") return Compile.sEscape\n\t\tif (char === Notation) return Compile.sAhead\n\t\tcurrent += char\n\t\treturn Compile.sOut\n\t}\n\n\tstatic sEscape: State = (char) => {\n\t\tif (char !== \"\\\\\" && char !== Notation) {\n\t\t\tcurrent += \"\\\\\"\n\t\t}\n\t\tcurrent += char\n\t\treturn Compile.sOut\n\t}\n\n\tstatic sAhead: State = (char) => {\n\t\tif (char === NotationStart) {\n\t\t\tliterals?.push(current)\n\t\t\tcurrent = \"\"\n\t\t\treturn Compile.sIn\n\t\t}\n\t\tif (char === Notation) {\n\t\t\tcurrent += Notation\n\t\t\treturn Compile.sAhead\n\t\t}\n\t\tcurrent += Notation + char\n\t\treturn Compile.sOut\n\t}\n\n\tstatic sIn: State = () => {\n\t\tconst code = template.slice(i)\n\t\tlet end\n\n\t\t// eslint-disable-next-line consistent-return\n\t\tesniff(code, NotationEnd, (j: number) => {\n\t\t\tif (esniff.nest >= 0) return esniff.next()\n\t\t\tend = j\n\t\t})\n\t\tif (end != null) {\n\t\t\tsubstitutions?.push(template.slice(i, i + end))\n\t\t\ti += end\n\t\t\tcurrent = \"\"\n\t\t\treturn Compile.sOut\n\t\t}\n\t\tend = code.length\n\t\ti += end\n\t\tcurrent += code\n\t\treturn Compile.sIn\n\t}\n\n\tstatic sInEscape: State = function (char) {\n\t\tif (char !== \"\\\\\" && char !== NotationEnd) {\n\t\t\tcurrent += \"\\\\\"\n\t\t}\n\t\tcurrent += char\n\t\treturn Compile.sIn\n\t}\n}\n\nexport default function compile(str: string, options?: CompileOptions): Result {\n\tcurrent = \"\"\n\tliterals = []\n\tsubstitutions = []\n\n\tNotation = options?.notation || \"$\"\n\tNotationStart = options?.notationStart || \"{\"\n\tNotationEnd = options?.notationEnd || \"}\"\n\n\ttemplate = String(str)\n\tconst { length } = template\n\n\tlet state: State = Compile.sOut\n\tfor (i = 0; i < length; i += 1) {\n\t\tstate = state(template[i])\n\t}\n\tif (state === Compile.sOut) {\n\t\tliterals.push(current)\n\t} else if (state === Compile.sEscape) {\n\t\tliterals.push(`${current}\\\\`)\n\t} else if (state === Compile.sAhead) {\n\t\tliterals.push(current + Notation)\n\t} else if (state === Compile.sIn) {\n\t\tliterals[literals.length - 1] += `${Notation}${NotationStart}${current}`\n\t} else if (state === Compile.sInEscape) {\n\t\tliterals[literals.length - 1] += `${Notation}${NotationStart}${current}\\\\`\n\t}\n\n\tconst result: Result = { literals, substitutions }\n\tliterals = null\n\tsubstitutions = null\n\treturn result\n}\n"],"mappings":"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","names":["i","current","literals","substitutions","template","Notation","NotationStart","NotationEnd","Compile","sOut","char","sEscape","sAhead","push","sIn","code","slice","end","esniff","j","nest","next","length","sInEscape","str","options","notation","notationStart","notationEnd","String","state","result","compile"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Parser options */
|
|
2
|
+
interface CompileOptions {
|
|
3
|
+
/** Prefix for template syntax */
|
|
4
|
+
notation?: string;
|
|
5
|
+
/** Opening delimiter for template syntax */
|
|
6
|
+
notationStart?: string;
|
|
7
|
+
/** Closing delimiter for template syntax */
|
|
8
|
+
notationEnd?: string;
|
|
9
|
+
}
|
|
10
|
+
interface ResolveOptions {
|
|
11
|
+
/** Skip failed expressions; otherwise return undefined for failures */
|
|
12
|
+
partial?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/** Template parsing options */
|
|
15
|
+
interface TemplateOptions extends CompileOptions, ResolveOptions {
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
declare function toArray(template: string, context: Record<string, any>, options?: TemplateOptions): string[];
|
|
19
|
+
|
|
20
|
+
declare function export_default(template: string, context: Record<string, any>, options?: TemplateOptions): string;
|
|
21
|
+
|
|
22
|
+
export { export_default as default, toArray as resolveToArray, export_default as resolveToString };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var src_exports = {};
|
|
30
|
+
__export(src_exports, {
|
|
31
|
+
default: () => src_default,
|
|
32
|
+
resolveToArray: () => import_to_array.default,
|
|
33
|
+
resolveToString: () => import_to_string.default
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
var import_to_array = __toESM(require("./to-array"), 1);
|
|
37
|
+
var import_to_string = __toESM(require("./to-string"), 1);
|
|
38
|
+
var src_default = import_to_string.default;
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
resolveToArray,
|
|
42
|
+
resolveToString
|
|
43
|
+
});
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/index.ts"],"sourcesContent":["import resolveToArray from \"./to-array\"\nimport resolveToString from \"./to-string\"\n\nexport { resolveToString, resolveToArray }\nexport default resolveToString\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;wCAAAA;EAAA,wCAAAC;;AAAA;sBAA2B;AAC3B,uBAA4B;AAG5B,IAAA,cAAeA,iBAAAA;","names":["resolveToArray","resolveToString"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var passthru_array_exports = {};
|
|
21
|
+
__export(passthru_array_exports, {
|
|
22
|
+
default: () => passthru_array_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(passthru_array_exports);
|
|
25
|
+
var passthru_array_default = /* @__PURE__ */ __name((literals, ...substitutions) => {
|
|
26
|
+
const result = [];
|
|
27
|
+
const l = literals.length;
|
|
28
|
+
if (!l) {
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
result.push(literals[0]);
|
|
32
|
+
for (let i = 1; i < l; i += 1) {
|
|
33
|
+
result.push(arguments[i], literals[i]);
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}, "default");
|
|
37
|
+
//# sourceMappingURL=passthru-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/passthru-array.ts"],"sourcesContent":["// @ts-ignore\nexport default (literals: Array<string>, ...substitutions: Array<string>): Array<string> => {\n\tconst result: Array<string> = []\n\tconst l = literals.length\n\tif (!l) {\n\t\treturn result\n\t}\n\tresult.push(literals[0])\n\tfor (let i = 1; i < l; i += 1) {\n\t\t// @ts-ignore\n\t\tresult.push(arguments[i], literals[i])\n\t}\n\treturn result\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;AACA,IAAA,yBAAe,wBAACA,aAA4BC,kBAAAA;AAC3C,QAAMC,SAAwB,CAAA;AAC9B,QAAMC,IAAIH,SAASI;AACnB,MAAI,CAACD,GAAG;AACP,WAAOD;EACR;AACAA,SAAOG,KAAKL,SAAS,CAAA,CAAE;AACvB,WAASM,IAAI,GAAGA,IAAIH,GAAGG,KAAK,GAAG;AAE9BJ,WAAOG,KAAKE,UAAUD,CAAAA,GAAIN,SAASM,CAAAA,CAAE;EACtC;AACA,SAAOJ;AACR,GAZe;","names":["literals","substitutions","result","l","length","push","i","arguments"]}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var passthru_exports = {};
|
|
21
|
+
__export(passthru_exports, {
|
|
22
|
+
default: () => passthru_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(passthru_exports);
|
|
25
|
+
function passthru_default(literals, ..._substitutions) {
|
|
26
|
+
const args = arguments;
|
|
27
|
+
return literals.reduce((a, b, i) => {
|
|
28
|
+
return a + (args[i] === void 0 ? "" : String(args[i])) + b;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
__name(passthru_default, "default");
|
|
32
|
+
//# sourceMappingURL=passthru.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/passthru.ts"],"sourcesContent":["export default function (literals: Array<string>, ..._substitutions: Array<string>) {\n\t// eslint-disable-next-line prefer-rest-params\n\tconst args = arguments\n\treturn literals.reduce((a: string, b: string, i: number): string => {\n\t\treturn a + (args[i] === undefined ? \"\" : String(args[i])) + b\n\t})\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAe,SAAf,iBAAyBA,aAA4BC,gBAA6B;AAEjF,QAAMC,OAAOC;AACb,SAAOH,SAASI,OAAO,CAACC,GAAWC,GAAWC,MAAAA;AAC7C,WAAOF,KAAKH,KAAKK,CAAAA,MAAOC,SAAY,KAAKC,OAAOP,KAAKK,CAAAA,CAAE,KAAKD;EAC7D,CAAA;AACD;AANA;","names":["literals","_substitutions","args","arguments","reduce","a","b","i","undefined","String"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var resolve_to_array_exports = {};
|
|
31
|
+
__export(resolve_to_array_exports, {
|
|
32
|
+
default: () => resolve_to_array_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(resolve_to_array_exports);
|
|
35
|
+
var import_resolve = __toESM(require("./resolve"), 1);
|
|
36
|
+
var import_passthru_array = __toESM(require("./passthru-array"), 1);
|
|
37
|
+
var resolve_to_array_default = /* @__PURE__ */ __name((data, context, options) => {
|
|
38
|
+
const [literals, ...result] = (0, import_resolve.default)(data, context, options);
|
|
39
|
+
return import_passthru_array.default.call(null, literals, ...result);
|
|
40
|
+
}, "default");
|
|
41
|
+
//# sourceMappingURL=resolve-to-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/resolve-to-array.ts"],"sourcesContent":["import resolve from \"./resolve\"\nimport passthru from \"./passthru-array\"\nimport type { Result } from \"./compile\"\nimport type { ResolveOptions } from \"./types\"\n\nexport default (data: Result, context: Record<string, any>, options?: ResolveOptions) => {\n\tconst [literals, ...result] = resolve(data, context, options)\n\treturn passthru.call(null, literals as Array<string>, ...(result as Array<string>))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,qBAAoB;AACpB,4BAAqB;AAIrB,IAAA,2BAAe,wBAACA,MAAcC,SAA8BC,YAAAA;AAC3D,QAAM,CAACC,UAAU,GAAGC,MAAAA,QAAUC,eAAAA,SAAQL,MAAMC,SAASC,OAAAA;AACrD,SAAOI,sBAAAA,QAASC,KAAK,MAAMJ,UAAAA,GAA+BC,MAAAA;AAC3D,GAHe;","names":["data","context","options","literals","result","resolve","passthru","call"]}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var resolve_to_string_exports = {};
|
|
31
|
+
__export(resolve_to_string_exports, {
|
|
32
|
+
default: () => resolve_to_string_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(resolve_to_string_exports);
|
|
35
|
+
var import_resolve = __toESM(require("./resolve"), 1);
|
|
36
|
+
var import_passthru = __toESM(require("./passthru"), 1);
|
|
37
|
+
var resolve_to_string_default = /* @__PURE__ */ __name((data, context, options) => {
|
|
38
|
+
const [literals, ...result] = (0, import_resolve.default)(data, context, options);
|
|
39
|
+
return import_passthru.default.call(null, literals, ...result);
|
|
40
|
+
}, "default");
|
|
41
|
+
//# sourceMappingURL=resolve-to-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/resolve-to-string.ts"],"sourcesContent":["import resolve from \"./resolve\"\nimport passthru from \"./passthru\"\nimport type { Result } from \"./compile\"\nimport type { ResolveOptions } from \"./types\"\n\nexport default (data: Result, context: Record<string, any>, options?: ResolveOptions) => {\n\tconst [literals, ...result] = resolve(data, context, options)\n\treturn passthru.call(null, literals as Array<string>, ...(result as Array<string>))\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,qBAAoB;AACpB,sBAAqB;AAIrB,IAAA,4BAAe,wBAACA,MAAcC,SAA8BC,YAAAA;AAC3D,QAAM,CAACC,UAAU,GAAGC,MAAAA,QAAUC,eAAAA,SAAQL,MAAMC,SAASC,OAAAA;AACrD,SAAOI,gBAAAA,QAASC,KAAK,MAAMJ,UAAAA,GAA+BC,MAAAA;AAC3D,GAHe;","names":["data","context","options","literals","result","resolve","passthru","call"]}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var resolve_exports = {};
|
|
31
|
+
__export(resolve_exports, {
|
|
32
|
+
default: () => processData
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(resolve_exports);
|
|
35
|
+
var import_is_var_name_valid = __toESM(require("esniff/is-var-name-valid"), 1);
|
|
36
|
+
const { stringify } = JSON;
|
|
37
|
+
function isValue(value) {
|
|
38
|
+
if (value === null || value === void 0)
|
|
39
|
+
throw new TypeError("Cannot use null or undefined");
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
__name(isValue, "isValue");
|
|
43
|
+
function process(src, obj) {
|
|
44
|
+
for (const key in src) {
|
|
45
|
+
obj[key] = src[key];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
__name(process, "process");
|
|
49
|
+
function normalize(...args) {
|
|
50
|
+
const result = /* @__PURE__ */ Object.create(null);
|
|
51
|
+
args.forEach(function(options) {
|
|
52
|
+
if (!isValue(options))
|
|
53
|
+
return;
|
|
54
|
+
process(Object(options), result);
|
|
55
|
+
});
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
__name(normalize, "normalize");
|
|
59
|
+
function processData(data, context, options = {}) {
|
|
60
|
+
isValue(data) && isValue(data == null ? void 0 : data.literals) && isValue(data == null ? void 0 : data.substitutions);
|
|
61
|
+
context = normalize(context);
|
|
62
|
+
const names = Object.keys(context).filter(import_is_var_name_valid.default);
|
|
63
|
+
const argNames = names.join(", ");
|
|
64
|
+
const argValues = names.map((name) => context[name]);
|
|
65
|
+
const { substitutions = [], literals = [] } = data;
|
|
66
|
+
return [
|
|
67
|
+
literals
|
|
68
|
+
].concat(substitutions.map((expr) => {
|
|
69
|
+
let resolver;
|
|
70
|
+
if (!expr)
|
|
71
|
+
return void 0;
|
|
72
|
+
try {
|
|
73
|
+
resolver = new Function(argNames, `return (${expr})`);
|
|
74
|
+
} catch (error) {
|
|
75
|
+
throw new TypeError(`Unable to compile expression:
|
|
76
|
+
args: ${stringify(argNames)}
|
|
77
|
+
body: ${stringify(expr)}
|
|
78
|
+
error: ${error.stack}`);
|
|
79
|
+
}
|
|
80
|
+
try {
|
|
81
|
+
return resolver.apply(null, argValues);
|
|
82
|
+
} catch (e) {
|
|
83
|
+
if (options.partial) {
|
|
84
|
+
return `\${${expr}}`;
|
|
85
|
+
}
|
|
86
|
+
return "undefined";
|
|
87
|
+
}
|
|
88
|
+
}));
|
|
89
|
+
}
|
|
90
|
+
__name(processData, "processData");
|
|
91
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/resolve.ts"],"sourcesContent":["import isVarNameValid from \"esniff/is-var-name-valid\"\nimport type { Result } from \"./compile\"\nimport type { ResolveOptions } from \"./types\"\n\nconst { stringify } = JSON\n\nfunction isValue(value: any): any | never {\n\tif (value === null || value === undefined) throw new TypeError(\"Cannot use null or undefined\")\n\treturn value\n}\n\nfunction process(src: Record<string, any>, obj: Record<string, any>) {\n\t// eslint-disable-next-line guard-for-in,no-restricted-syntax\n\tfor (const key in src) {\n\t\tobj[key] = src[key]\n\t}\n}\n\nfunction normalize(...args: Array<any>) {\n\tconst result: Record<string, any> = Object.create(null)\n\targs.forEach(function (options) {\n\t\tif (!isValue(options)) return\n\t\tprocess(Object(options), result)\n\t})\n\treturn result\n}\n\nexport default function processData(\n\tdata: Result,\n\tcontext: Record<string, any>,\n\toptions: ResolveOptions = {},\n): Array<Array<string> | string> {\n\tisValue(data) && isValue(data?.literals) && isValue(data?.substitutions)\n\tcontext = normalize(context)\n\tconst names = Object.keys(context).filter(isVarNameValid)\n\tconst argNames = names.join(\", \")\n\tconst argValues = names.map((name: string) => context[name])\n\tconst { substitutions = [], literals = [] } = data\n\n\t// For failed expressions, return ${} only when options.partial is true; otherwise return undefined\n\treturn [literals].concat(\n\t\tsubstitutions.map((expr: string) => {\n\t\t\tlet resolver: Function\n\t\t\tif (!expr) return undefined\n\t\t\ttry {\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-implied-eval\n\t\t\t\tresolver = new Function(argNames, `return (${expr})`)\n\t\t\t} catch (error: any) {\n\t\t\t\tthrow new TypeError(\n\t\t\t\t\t`Unable to compile expression:\\n\\targs: ${stringify(argNames)}\\n\\tbody: ${stringify(\n\t\t\t\t\t\texpr,\n\t\t\t\t\t)}\\n\\terror: ${error.stack}`,\n\t\t\t\t)\n\t\t\t}\n\t\t\ttry {\n\t\t\t\t// eslint-disable-next-line prefer-spread\n\t\t\t\treturn resolver.apply(null, argValues)\n\t\t\t} catch (e) {\n\t\t\t\tif (options.partial) {\n\t\t\t\t\treturn `\\${${expr}}`\n\t\t\t\t}\n\t\t\t\treturn \"undefined\"\n\n\t\t\t\t// Error handling intentionally suppressed for now; returns undefined instead\n\t\t\t\t// throw new TypeError(\n\t\t\t\t// \t`Unable to resolve expression:\\n\\targs: ${ stringify(argNames) }\\n\\tbody: ${ stringify(\n\t\t\t\t// \t\texpr\n\t\t\t\t// \t) }\\n\\terror: ${ e.stack }`\n\t\t\t\t// )\n\t\t\t}\n\t\t}),\n\t)\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,+BAA2B;AAI3B,MAAM,EAAEA,UAAS,IAAKC;AAEtB,SAASC,QAAQC,OAAU;AAC1B,MAAIA,UAAU,QAAQA,UAAUC;AAAW,UAAM,IAAIC,UAAU,8BAAA;AAC/D,SAAOF;AACR;AAHSD;AAKT,SAASI,QAAQC,KAA0BC,KAAwB;AAElE,aAAWC,OAAOF,KAAK;AACtBC,QAAIC,GAAAA,IAAOF,IAAIE,GAAAA;EAChB;AACD;AALSH;AAOT,SAASI,aAAaC,MAAgB;AACrC,QAAMC,SAA8BC,uBAAOC,OAAO,IAAA;AAClDH,OAAKI,QAAQ,SAAUC,SAAO;AAC7B,QAAI,CAACd,QAAQc,OAAAA;AAAU;AACvBV,YAAQO,OAAOG,OAAAA,GAAUJ,MAAAA;EAC1B,CAAA;AACA,SAAOA;AACR;AAPSF;AASM,SAAf,YACCO,MACAC,SACAF,UAA0B,CAAC,GAAC;AAE5Bd,UAAQe,IAAAA,KAASf,QAAQe,6BAAME,QAAAA,KAAajB,QAAQe,6BAAMG,aAAAA;AAC1DF,YAAUR,UAAUQ,OAAAA;AACpB,QAAMG,QAAQR,OAAOS,KAAKJ,OAAAA,EAASK,OAAOC,yBAAAA,OAAAA;AAC1C,QAAMC,WAAWJ,MAAMK,KAAK,IAAA;AAC5B,QAAMC,YAAYN,MAAMO,IAAI,CAACC,SAAiBX,QAAQW,IAAAA,CAAK;AAC3D,QAAM,EAAET,gBAAgB,CAAA,GAAID,WAAW,CAAA,EAAE,IAAKF;AAG9C,SAAO;IAACE;IAAUW,OACjBV,cAAcQ,IAAI,CAACG,SAAAA;AAClB,QAAIC;AACJ,QAAI,CAACD;AAAM,aAAO3B;AAClB,QAAI;AAEH4B,iBAAW,IAAIC,SAASR,UAAU,WAAWM,IAAAA,GAAO;IACrD,SAASG,OAAY;AACpB,YAAM,IAAI7B,UACT;SAA0CL,UAAUyB,QAAAA,CAAAA;SAAsBzB,UACzE+B,IAAAA,CAAAA;UACcG,MAAMC,KAAK,EAAE;IAE9B;AACA,QAAI;AAEH,aAAOH,SAASI,MAAM,MAAMT,SAAAA;IAC7B,SAASU,GAAG;AACX,UAAIrB,QAAQsB,SAAS;AACpB,eAAO,MAAMP,IAAAA;MACd;AACA,aAAO;IAQR;EACD,CAAA,CAAA;AAEF;AA7CwBQ;","names":["stringify","JSON","isValue","value","undefined","TypeError","process","src","obj","key","normalize","args","result","Object","create","forEach","options","data","context","literals","substitutions","names","keys","filter","isVarNameValid","argNames","join","argValues","map","name","concat","expr","resolver","Function","error","stack","apply","e","partial","processData"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var to_array_exports = {};
|
|
31
|
+
__export(to_array_exports, {
|
|
32
|
+
default: () => toArray
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(to_array_exports);
|
|
35
|
+
var import_lodash_es = require("lodash-es");
|
|
36
|
+
var import_compile = __toESM(require("./compile"), 1);
|
|
37
|
+
var import_resolve_to_array = __toESM(require("./resolve-to-array"), 1);
|
|
38
|
+
function toArray(template, context, options) {
|
|
39
|
+
const compileOptions = (0, import_lodash_es.omit)(options, "partial");
|
|
40
|
+
return (0, import_resolve_to_array.default)((0, import_compile.default)(template, compileOptions), context, {
|
|
41
|
+
partial: options == null ? void 0 : options.partial
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
__name(toArray, "toArray");
|
|
45
|
+
//# sourceMappingURL=to-array.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/to-array.ts"],"sourcesContent":["import { omit } from \"lodash-es\"\nimport compile from \"./compile\"\nimport resolve from \"./resolve-to-array\"\nimport type { CompileOptions, TemplateOptions } from \"./types\"\n\nexport default function toArray(\n\ttemplate: string,\n\tcontext: Record<string, any>,\n\toptions?: TemplateOptions,\n) {\n\tconst compileOptions: CompileOptions = omit(options, \"partial\")\n\treturn resolve(compile(template, compileOptions), context, { partial: options?.partial })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,uBAAqB;AACrB,qBAAoB;AACpB,8BAAoB;AAGL,SAAf,QACCA,UACAC,SACAC,SAAyB;AAEzB,QAAMC,qBAAiCC,uBAAKF,SAAS,SAAA;AACrD,aAAOG,wBAAAA,aAAQC,eAAAA,SAAQN,UAAUG,cAAAA,GAAiBF,SAAS;IAAEM,SAASL,mCAASK;EAAQ,CAAA;AACxF;AAPwBC;","names":["template","context","options","compileOptions","omit","resolve","compile","partial","toArray"]}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var to_string_exports = {};
|
|
31
|
+
__export(to_string_exports, {
|
|
32
|
+
default: () => to_string_default
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(to_string_exports);
|
|
35
|
+
var import_lodash_es = require("lodash-es");
|
|
36
|
+
var import_compile = __toESM(require("./compile"), 1);
|
|
37
|
+
var import_resolve_to_string = __toESM(require("./resolve-to-string"), 1);
|
|
38
|
+
function to_string_default(template, context, options) {
|
|
39
|
+
const compileOptions = (0, import_lodash_es.omit)(options, "partial");
|
|
40
|
+
return (0, import_resolve_to_string.default)((0, import_compile.default)(template, compileOptions), context, {
|
|
41
|
+
partial: options == null ? void 0 : options.partial
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
__name(to_string_default, "default");
|
|
45
|
+
//# sourceMappingURL=to-string.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/to-string.ts"],"sourcesContent":["import { omit } from \"lodash-es\"\nimport compile from \"./compile\"\nimport resolve from \"./resolve-to-string\"\nimport type { CompileOptions, TemplateOptions } from \"./types\"\n\nexport default function (\n\ttemplate: string,\n\tcontext: Record<string, any>,\n\toptions?: TemplateOptions,\n) {\n\tconst compileOptions: CompileOptions = omit(options, \"partial\")\n\treturn resolve(compile(template, compileOptions), context, { partial: options?.partial })\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAAA,uBAAqB;AACrB,qBAAoB;AACpB,+BAAoB;AAGL,SAAf,kBACCA,UACAC,SACAC,SAAyB;AAEzB,QAAMC,qBAAiCC,uBAAKF,SAAS,SAAA;AACrD,aAAOG,yBAAAA,aAAQC,eAAAA,SAAQN,UAAUG,cAAAA,GAAiBF,SAAS;IAAEM,SAASL,mCAASK;EAAQ,CAAA;AACxF;AAPA;","names":["template","context","options","compileOptions","omit","resolve","compile","partial"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/types.ts"],"sourcesContent":["/** Parser options */\nexport interface CompileOptions {\n\t/** Prefix for template syntax */\n\tnotation?: string\n\t/** Opening delimiter for template syntax */\n\tnotationStart?: string\n\t/** Closing delimiter for template syntax */\n\tnotationEnd?: string\n}\n\nexport interface ResolveOptions {\n\t/** Skip failed expressions; otherwise return undefined for failures */\n\tpartial?: boolean\n}\n\n/** Template parsing options */\nexport interface TemplateOptions extends CompileOptions, ResolveOptions {}\n"],"mappings":";;;;;;;;;;;;;;AAAA;;","names":[]}
|