@flowview/runtime 0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Andersseen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,14 @@
1
+ declare function escapeHtml(value: unknown): string;
2
+
3
+ declare function renderValue(value: unknown): string;
4
+
5
+ /**
6
+ * Generic shape of the context object passed to a generated render function.
7
+ */
8
+ type RenderContext = Record<string, unknown>;
9
+ /**
10
+ * Type of a generated Flowmark render function.
11
+ */
12
+ type RenderFunction<C extends RenderContext = RenderContext> = (context: C) => string;
13
+
14
+ export { type RenderContext, type RenderFunction, escapeHtml, renderValue };
package/dist/index.js ADDED
@@ -0,0 +1,28 @@
1
+ // src/escape-html.ts
2
+ var HTML_ESCAPE_REPLACEMENTS = {
3
+ "&": "&amp;",
4
+ "<": "&lt;",
5
+ ">": "&gt;",
6
+ '"': "&quot;",
7
+ "'": "&#39;"
8
+ };
9
+ var HTML_ESCAPE_PATTERN = /[&<>"']/g;
10
+ function escapeHtml(value) {
11
+ if (value === null || value === void 0 || value === false) {
12
+ return "";
13
+ }
14
+ return String(value).replace(
15
+ HTML_ESCAPE_PATTERN,
16
+ (character) => HTML_ESCAPE_REPLACEMENTS[character]
17
+ );
18
+ }
19
+
20
+ // src/render-value.ts
21
+ function renderValue(value) {
22
+ return escapeHtml(value);
23
+ }
24
+ export {
25
+ escapeHtml,
26
+ renderValue
27
+ };
28
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/escape-html.ts","../src/render-value.ts"],"sourcesContent":["const HTML_ESCAPE_REPLACEMENTS: Record<string, string> = {\n \"&\": \"&amp;\",\n \"<\": \"&lt;\",\n \">\": \"&gt;\",\n '\"': \"&quot;\",\n \"'\": \"&#39;\",\n};\n\nconst HTML_ESCAPE_PATTERN = /[&<>\"']/g;\n\nexport function escapeHtml(value: unknown): string {\n if (value === null || value === undefined || value === false) {\n return \"\";\n }\n\n return String(value).replace(\n HTML_ESCAPE_PATTERN,\n (character) => HTML_ESCAPE_REPLACEMENTS[character],\n );\n}\n","import { escapeHtml } from \"./escape-html\";\n\nexport function renderValue(value: unknown): string {\n return escapeHtml(value);\n}\n"],"mappings":";AAAA,IAAM,2BAAmD;AAAA,EACvD,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAEA,IAAM,sBAAsB;AAErB,SAAS,WAAW,OAAwB;AACjD,MAAI,UAAU,QAAQ,UAAU,UAAa,UAAU,OAAO;AAC5D,WAAO;AAAA,EACT;AAEA,SAAO,OAAO,KAAK,EAAE;AAAA,IACnB;AAAA,IACA,CAAC,cAAc,yBAAyB,SAAS;AAAA,EACnD;AACF;;;ACjBO,SAAS,YAAY,OAAwB;AAClD,SAAO,WAAW,KAAK;AACzB;","names":[]}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@flowview/runtime",
3
+ "version": "0.1.0",
4
+ "description": "Tiny runtime for Flowmark-generated render functions.",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "sideEffects": false,
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "https://github.com/andersseen/flowmark.git",
11
+ "directory": "packages/runtime"
12
+ },
13
+ "bugs": {
14
+ "url": "https://github.com/andersseen/flowmark/issues"
15
+ },
16
+ "homepage": "https://github.com/andersseen/flowmark/tree/main/packages/runtime#readme",
17
+ "keywords": [
18
+ "flowmark",
19
+ "template",
20
+ "compiler",
21
+ "runtime",
22
+ "html",
23
+ "ssr"
24
+ ],
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ }
30
+ },
31
+ "files": [
32
+ "dist"
33
+ ],
34
+ "publishConfig": {
35
+ "access": "public"
36
+ },
37
+ "devDependencies": {
38
+ "tsup": "^8.5.0",
39
+ "typescript": "^5.9.0",
40
+ "vitest": "^3.0.0"
41
+ },
42
+ "scripts": {
43
+ "build": "tsup",
44
+ "test": "vitest run",
45
+ "typecheck": "tsc --noEmit"
46
+ }
47
+ }