@kaleabdenbel/llmweb 1.0.4 → 1.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.
@@ -0,0 +1,233 @@
1
+ // src/adapters/react.tsx
2
+ import React from "react";
3
+
4
+ // src/core/resolver.ts
5
+ async function resolveAll(dynamicSources, options = {}) {
6
+ const keys = Object.keys(dynamicSources);
7
+ const results = await Promise.allSettled(
8
+ keys.map((key) => resolveSource(dynamicSources[key], options.timeout))
9
+ );
10
+ const data = {};
11
+ results.forEach((result, index) => {
12
+ const key = keys[index];
13
+ if (result.status === "fulfilled") {
14
+ data[key] = result.value;
15
+ } else {
16
+ console.error(`[llmweb] Failed to resolve source "${key}":`, result.reason);
17
+ data[key] = null;
18
+ }
19
+ });
20
+ return data;
21
+ }
22
+ async function resolveSource(source, timeoutMs) {
23
+ const { from } = source;
24
+ const controller = timeoutMs ? new AbortController() : null;
25
+ const signal = controller?.signal;
26
+ const timeoutPromise = timeoutMs ? new Promise(
27
+ (_, reject) => setTimeout(() => {
28
+ controller?.abort();
29
+ reject(new Error(`Timeout of ${timeoutMs}ms exceeded`));
30
+ }, timeoutMs)
31
+ ) : null;
32
+ const resolvePromise = (async () => {
33
+ if (from.type === "fetch") {
34
+ if (!from.url) throw new Error("Fetch source requires a URL");
35
+ const response = await fetch(from.url, { signal });
36
+ if (!response.ok) throw new Error(`HTTP error ${response.status} for ${from.url}`);
37
+ return response.json();
38
+ }
39
+ if (from.type === "fn") {
40
+ if (!from.call) throw new Error('Function source requires a "call" property');
41
+ return from.call();
42
+ }
43
+ throw new Error(`Unsupported source type: ${from.type}`);
44
+ })();
45
+ if (timeoutPromise) {
46
+ return Promise.race([resolvePromise, timeoutPromise]);
47
+ }
48
+ return resolvePromise;
49
+ }
50
+
51
+ // src/core/transformer.ts
52
+ function transform(sourceData, schema) {
53
+ if (!sourceData) return sourceData;
54
+ if (Array.isArray(sourceData)) {
55
+ return sourceData.map((item) => transform(item, schema));
56
+ }
57
+ if (typeof sourceData !== "object") return sourceData;
58
+ const result = {};
59
+ for (const [targetKey, mapping] of Object.entries(schema)) {
60
+ if (typeof mapping === "string") {
61
+ result[targetKey] = getValueByPath(sourceData, mapping);
62
+ } else if (typeof mapping === "function") {
63
+ result[targetKey] = mapping(sourceData);
64
+ } else if (typeof mapping === "object" && mapping !== null) {
65
+ result[targetKey] = transform(sourceData, mapping);
66
+ }
67
+ }
68
+ return result;
69
+ }
70
+ function getValueByPath(obj, path) {
71
+ return path.split(".").reduce((acc, part) => acc && acc[part], obj);
72
+ }
73
+
74
+ // src/core/merger.ts
75
+ function merge(staticData, dynamicResults) {
76
+ if (!staticData) return dynamicResults;
77
+ return {
78
+ ...staticData,
79
+ ...dynamicResults
80
+ };
81
+ }
82
+
83
+ // src/core/compiler.ts
84
+ async function compileLLM(config, loader, options = {}) {
85
+ const { static: staticRef, dynamic, ...topLevelMetadata } = config;
86
+ let staticTruth = { ...topLevelMetadata };
87
+ if (staticRef) {
88
+ try {
89
+ if (typeof staticRef === "object") {
90
+ staticTruth = { ...staticTruth, ...staticRef };
91
+ } else {
92
+ const content = await loader(staticRef);
93
+ if (content) {
94
+ staticTruth = { ...staticTruth, ...JSON.parse(content) };
95
+ }
96
+ }
97
+ } catch (error) {
98
+ if (options.failLoudly) {
99
+ throw new Error(`[llmweb] Static Truth Error: Failed to load/parse JSON at ${staticRef}. ${error}`);
100
+ }
101
+ console.warn(`[llmweb] Warning: Could not load static JSON at ${staticRef}. Proceeding with dynamic data only.`);
102
+ }
103
+ }
104
+ const dynamicTruth = {};
105
+ if (config.dynamic) {
106
+ const rawResults = await resolveAll(config.dynamic, { timeout: options.timeout });
107
+ for (const [key, source] of Object.entries(config.dynamic)) {
108
+ const rawData = rawResults[key];
109
+ if (rawData === null && options.failLoudly) {
110
+ throw new Error(`[llmweb] Dynamic Truth Error: Source "${key}" failed to resolve.`);
111
+ }
112
+ if (rawData && source.map) {
113
+ try {
114
+ dynamicTruth[key] = transform(rawData, source.map);
115
+ } catch (error) {
116
+ if (options.failLoudly) {
117
+ throw new Error(`[llmweb] Transformation Error: Failed to map source "${key}". ${error}`);
118
+ }
119
+ console.error(`[llmweb] Warning: Mapping failed for "${key}". Using raw data.`);
120
+ dynamicTruth[key] = rawData;
121
+ }
122
+ } else {
123
+ dynamicTruth[key] = rawData;
124
+ }
125
+ }
126
+ }
127
+ return merge(staticTruth, dynamicTruth);
128
+ }
129
+
130
+ // src/core/injector.ts
131
+ function toWindowString(data, key = "__LLM__") {
132
+ const json = JSON.stringify(data);
133
+ return `window.${key} = ${json};`;
134
+ }
135
+
136
+ // src/index.ts
137
+ async function createLLMSource(config, options = {}) {
138
+ const nodeLoader = async (path) => {
139
+ try {
140
+ const fs = await import(
141
+ /* webpackIgnore: true */
142
+ "fs"
143
+ );
144
+ const nodePath = await import(
145
+ /* webpackIgnore: true */
146
+ "path"
147
+ );
148
+ const fullPath = path.startsWith("/") ? path : nodePath.join(process.cwd(), path);
149
+ return fs.readFileSync(fullPath, "utf-8");
150
+ } catch (error) {
151
+ console.warn(`[llmweb] Warning: 'node:fs' not available. Skipping static file load: ${path}`);
152
+ return null;
153
+ }
154
+ };
155
+ return compileLLM(config, nodeLoader, options);
156
+ }
157
+
158
+ // src/adapters/react.tsx
159
+ import { jsx } from "react/jsx-runtime";
160
+ async function LLMJson({
161
+ config,
162
+ mode = "script",
163
+ targetKey = "__LLM__",
164
+ className
165
+ }) {
166
+ const truth = await createLLMSource(config);
167
+ if (mode === "window") {
168
+ const scriptBody = toWindowString(truth, targetKey);
169
+ return /* @__PURE__ */ jsx(
170
+ "script",
171
+ {
172
+ id: `llm-window-${targetKey}`,
173
+ dangerouslySetInnerHTML: { __html: scriptBody }
174
+ }
175
+ );
176
+ }
177
+ if (mode === "pre") {
178
+ return /* @__PURE__ */ jsx("pre", { id: "llm-truth-pre", className, children: JSON.stringify(truth, null, 2) });
179
+ }
180
+ return /* @__PURE__ */ jsx(
181
+ "script",
182
+ {
183
+ id: "llm-truth-script",
184
+ type: "application/llm+json",
185
+ dangerouslySetInnerHTML: { __html: JSON.stringify(truth) }
186
+ }
187
+ );
188
+ }
189
+ function LLMInjector({
190
+ config,
191
+ mode = "script",
192
+ targetKey = "__LLM__",
193
+ className
194
+ }) {
195
+ const [truth, setTruth] = React.useState(
196
+ typeof config.static === "object" ? config.static : null
197
+ );
198
+ React.useEffect(() => {
199
+ let mounted = true;
200
+ createLLMSource(config).then((data) => {
201
+ if (mounted) setTruth(data);
202
+ });
203
+ return () => {
204
+ mounted = false;
205
+ };
206
+ }, [config]);
207
+ if (!truth) return null;
208
+ if (mode === "window") {
209
+ const scriptBody = toWindowString(truth, targetKey);
210
+ return /* @__PURE__ */ jsx(
211
+ "script",
212
+ {
213
+ id: `llm-window-${targetKey}`,
214
+ dangerouslySetInnerHTML: { __html: scriptBody }
215
+ }
216
+ );
217
+ }
218
+ if (mode === "pre") {
219
+ return /* @__PURE__ */ jsx("pre", { id: "llm-truth-pre", className, children: JSON.stringify(truth, null, 2) });
220
+ }
221
+ return /* @__PURE__ */ jsx(
222
+ "script",
223
+ {
224
+ id: "llm-truth-script",
225
+ type: "application/llm+json",
226
+ dangerouslySetInnerHTML: { __html: JSON.stringify(truth) }
227
+ }
228
+ );
229
+ }
230
+ export {
231
+ LLMInjector,
232
+ LLMJson
233
+ };
@@ -0,0 +1,8 @@
1
+ import { L as LLMConfig } from '../index-B8G8cw7b.mjs';
2
+
3
+ /**
4
+ * Vanilla JS helper to inject LLM truth into the DOM.
5
+ */
6
+ declare function inject(config: LLMConfig, mode?: 'script' | 'window', targetKey?: string): Promise<void>;
7
+
8
+ export { inject };
@@ -0,0 +1,8 @@
1
+ import { L as LLMConfig } from '../index-B8G8cw7b.js';
2
+
3
+ /**
4
+ * Vanilla JS helper to inject LLM truth into the DOM.
5
+ */
6
+ declare function inject(config: LLMConfig, mode?: 'script' | 'window', targetKey?: string): Promise<void>;
7
+
8
+ export { inject };
@@ -0,0 +1,201 @@
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
+
30
+ // src/adapters/vanilla.ts
31
+ var vanilla_exports = {};
32
+ __export(vanilla_exports, {
33
+ inject: () => inject
34
+ });
35
+ module.exports = __toCommonJS(vanilla_exports);
36
+
37
+ // src/core/resolver.ts
38
+ async function resolveAll(dynamicSources, options = {}) {
39
+ const keys = Object.keys(dynamicSources);
40
+ const results = await Promise.allSettled(
41
+ keys.map((key) => resolveSource(dynamicSources[key], options.timeout))
42
+ );
43
+ const data = {};
44
+ results.forEach((result, index) => {
45
+ const key = keys[index];
46
+ if (result.status === "fulfilled") {
47
+ data[key] = result.value;
48
+ } else {
49
+ console.error(`[llmweb] Failed to resolve source "${key}":`, result.reason);
50
+ data[key] = null;
51
+ }
52
+ });
53
+ return data;
54
+ }
55
+ async function resolveSource(source, timeoutMs) {
56
+ const { from } = source;
57
+ const controller = timeoutMs ? new AbortController() : null;
58
+ const signal = controller?.signal;
59
+ const timeoutPromise = timeoutMs ? new Promise(
60
+ (_, reject) => setTimeout(() => {
61
+ controller?.abort();
62
+ reject(new Error(`Timeout of ${timeoutMs}ms exceeded`));
63
+ }, timeoutMs)
64
+ ) : null;
65
+ const resolvePromise = (async () => {
66
+ if (from.type === "fetch") {
67
+ if (!from.url) throw new Error("Fetch source requires a URL");
68
+ const response = await fetch(from.url, { signal });
69
+ if (!response.ok) throw new Error(`HTTP error ${response.status} for ${from.url}`);
70
+ return response.json();
71
+ }
72
+ if (from.type === "fn") {
73
+ if (!from.call) throw new Error('Function source requires a "call" property');
74
+ return from.call();
75
+ }
76
+ throw new Error(`Unsupported source type: ${from.type}`);
77
+ })();
78
+ if (timeoutPromise) {
79
+ return Promise.race([resolvePromise, timeoutPromise]);
80
+ }
81
+ return resolvePromise;
82
+ }
83
+
84
+ // src/core/transformer.ts
85
+ function transform(sourceData, schema) {
86
+ if (!sourceData) return sourceData;
87
+ if (Array.isArray(sourceData)) {
88
+ return sourceData.map((item) => transform(item, schema));
89
+ }
90
+ if (typeof sourceData !== "object") return sourceData;
91
+ const result = {};
92
+ for (const [targetKey, mapping] of Object.entries(schema)) {
93
+ if (typeof mapping === "string") {
94
+ result[targetKey] = getValueByPath(sourceData, mapping);
95
+ } else if (typeof mapping === "function") {
96
+ result[targetKey] = mapping(sourceData);
97
+ } else if (typeof mapping === "object" && mapping !== null) {
98
+ result[targetKey] = transform(sourceData, mapping);
99
+ }
100
+ }
101
+ return result;
102
+ }
103
+ function getValueByPath(obj, path) {
104
+ return path.split(".").reduce((acc, part) => acc && acc[part], obj);
105
+ }
106
+
107
+ // src/core/merger.ts
108
+ function merge(staticData, dynamicResults) {
109
+ if (!staticData) return dynamicResults;
110
+ return {
111
+ ...staticData,
112
+ ...dynamicResults
113
+ };
114
+ }
115
+
116
+ // src/core/compiler.ts
117
+ async function compileLLM(config, loader, options = {}) {
118
+ const { static: staticRef, dynamic, ...topLevelMetadata } = config;
119
+ let staticTruth = { ...topLevelMetadata };
120
+ if (staticRef) {
121
+ try {
122
+ if (typeof staticRef === "object") {
123
+ staticTruth = { ...staticTruth, ...staticRef };
124
+ } else {
125
+ const content = await loader(staticRef);
126
+ if (content) {
127
+ staticTruth = { ...staticTruth, ...JSON.parse(content) };
128
+ }
129
+ }
130
+ } catch (error) {
131
+ if (options.failLoudly) {
132
+ throw new Error(`[llmweb] Static Truth Error: Failed to load/parse JSON at ${staticRef}. ${error}`);
133
+ }
134
+ console.warn(`[llmweb] Warning: Could not load static JSON at ${staticRef}. Proceeding with dynamic data only.`);
135
+ }
136
+ }
137
+ const dynamicTruth = {};
138
+ if (config.dynamic) {
139
+ const rawResults = await resolveAll(config.dynamic, { timeout: options.timeout });
140
+ for (const [key, source] of Object.entries(config.dynamic)) {
141
+ const rawData = rawResults[key];
142
+ if (rawData === null && options.failLoudly) {
143
+ throw new Error(`[llmweb] Dynamic Truth Error: Source "${key}" failed to resolve.`);
144
+ }
145
+ if (rawData && source.map) {
146
+ try {
147
+ dynamicTruth[key] = transform(rawData, source.map);
148
+ } catch (error) {
149
+ if (options.failLoudly) {
150
+ throw new Error(`[llmweb] Transformation Error: Failed to map source "${key}". ${error}`);
151
+ }
152
+ console.error(`[llmweb] Warning: Mapping failed for "${key}". Using raw data.`);
153
+ dynamicTruth[key] = rawData;
154
+ }
155
+ } else {
156
+ dynamicTruth[key] = rawData;
157
+ }
158
+ }
159
+ }
160
+ return merge(staticTruth, dynamicTruth);
161
+ }
162
+
163
+ // src/index.ts
164
+ async function createLLMSource(config, options = {}) {
165
+ const nodeLoader = async (path) => {
166
+ try {
167
+ const fs = await import(
168
+ /* webpackIgnore: true */
169
+ "fs"
170
+ );
171
+ const nodePath = await import(
172
+ /* webpackIgnore: true */
173
+ "path"
174
+ );
175
+ const fullPath = path.startsWith("/") ? path : nodePath.join(process.cwd(), path);
176
+ return fs.readFileSync(fullPath, "utf-8");
177
+ } catch (error) {
178
+ console.warn(`[llmweb] Warning: 'node:fs' not available. Skipping static file load: ${path}`);
179
+ return null;
180
+ }
181
+ };
182
+ return compileLLM(config, nodeLoader, options);
183
+ }
184
+
185
+ // src/adapters/vanilla.ts
186
+ async function inject(config, mode = "script", targetKey = "__LLM__") {
187
+ const truth = await createLLMSource(config);
188
+ if (mode === "window") {
189
+ window[targetKey] = truth;
190
+ return;
191
+ }
192
+ const script = document.createElement("script");
193
+ script.type = "application/llm+json";
194
+ script.id = "llm-truth-script";
195
+ script.text = JSON.stringify(truth);
196
+ document.head.appendChild(script);
197
+ }
198
+ // Annotate the CommonJS export names for ESM import in node:
199
+ 0 && (module.exports = {
200
+ inject
201
+ });
@@ -0,0 +1,164 @@
1
+ // src/core/resolver.ts
2
+ async function resolveAll(dynamicSources, options = {}) {
3
+ const keys = Object.keys(dynamicSources);
4
+ const results = await Promise.allSettled(
5
+ keys.map((key) => resolveSource(dynamicSources[key], options.timeout))
6
+ );
7
+ const data = {};
8
+ results.forEach((result, index) => {
9
+ const key = keys[index];
10
+ if (result.status === "fulfilled") {
11
+ data[key] = result.value;
12
+ } else {
13
+ console.error(`[llmweb] Failed to resolve source "${key}":`, result.reason);
14
+ data[key] = null;
15
+ }
16
+ });
17
+ return data;
18
+ }
19
+ async function resolveSource(source, timeoutMs) {
20
+ const { from } = source;
21
+ const controller = timeoutMs ? new AbortController() : null;
22
+ const signal = controller?.signal;
23
+ const timeoutPromise = timeoutMs ? new Promise(
24
+ (_, reject) => setTimeout(() => {
25
+ controller?.abort();
26
+ reject(new Error(`Timeout of ${timeoutMs}ms exceeded`));
27
+ }, timeoutMs)
28
+ ) : null;
29
+ const resolvePromise = (async () => {
30
+ if (from.type === "fetch") {
31
+ if (!from.url) throw new Error("Fetch source requires a URL");
32
+ const response = await fetch(from.url, { signal });
33
+ if (!response.ok) throw new Error(`HTTP error ${response.status} for ${from.url}`);
34
+ return response.json();
35
+ }
36
+ if (from.type === "fn") {
37
+ if (!from.call) throw new Error('Function source requires a "call" property');
38
+ return from.call();
39
+ }
40
+ throw new Error(`Unsupported source type: ${from.type}`);
41
+ })();
42
+ if (timeoutPromise) {
43
+ return Promise.race([resolvePromise, timeoutPromise]);
44
+ }
45
+ return resolvePromise;
46
+ }
47
+
48
+ // src/core/transformer.ts
49
+ function transform(sourceData, schema) {
50
+ if (!sourceData) return sourceData;
51
+ if (Array.isArray(sourceData)) {
52
+ return sourceData.map((item) => transform(item, schema));
53
+ }
54
+ if (typeof sourceData !== "object") return sourceData;
55
+ const result = {};
56
+ for (const [targetKey, mapping] of Object.entries(schema)) {
57
+ if (typeof mapping === "string") {
58
+ result[targetKey] = getValueByPath(sourceData, mapping);
59
+ } else if (typeof mapping === "function") {
60
+ result[targetKey] = mapping(sourceData);
61
+ } else if (typeof mapping === "object" && mapping !== null) {
62
+ result[targetKey] = transform(sourceData, mapping);
63
+ }
64
+ }
65
+ return result;
66
+ }
67
+ function getValueByPath(obj, path) {
68
+ return path.split(".").reduce((acc, part) => acc && acc[part], obj);
69
+ }
70
+
71
+ // src/core/merger.ts
72
+ function merge(staticData, dynamicResults) {
73
+ if (!staticData) return dynamicResults;
74
+ return {
75
+ ...staticData,
76
+ ...dynamicResults
77
+ };
78
+ }
79
+
80
+ // src/core/compiler.ts
81
+ async function compileLLM(config, loader, options = {}) {
82
+ const { static: staticRef, dynamic, ...topLevelMetadata } = config;
83
+ let staticTruth = { ...topLevelMetadata };
84
+ if (staticRef) {
85
+ try {
86
+ if (typeof staticRef === "object") {
87
+ staticTruth = { ...staticTruth, ...staticRef };
88
+ } else {
89
+ const content = await loader(staticRef);
90
+ if (content) {
91
+ staticTruth = { ...staticTruth, ...JSON.parse(content) };
92
+ }
93
+ }
94
+ } catch (error) {
95
+ if (options.failLoudly) {
96
+ throw new Error(`[llmweb] Static Truth Error: Failed to load/parse JSON at ${staticRef}. ${error}`);
97
+ }
98
+ console.warn(`[llmweb] Warning: Could not load static JSON at ${staticRef}. Proceeding with dynamic data only.`);
99
+ }
100
+ }
101
+ const dynamicTruth = {};
102
+ if (config.dynamic) {
103
+ const rawResults = await resolveAll(config.dynamic, { timeout: options.timeout });
104
+ for (const [key, source] of Object.entries(config.dynamic)) {
105
+ const rawData = rawResults[key];
106
+ if (rawData === null && options.failLoudly) {
107
+ throw new Error(`[llmweb] Dynamic Truth Error: Source "${key}" failed to resolve.`);
108
+ }
109
+ if (rawData && source.map) {
110
+ try {
111
+ dynamicTruth[key] = transform(rawData, source.map);
112
+ } catch (error) {
113
+ if (options.failLoudly) {
114
+ throw new Error(`[llmweb] Transformation Error: Failed to map source "${key}". ${error}`);
115
+ }
116
+ console.error(`[llmweb] Warning: Mapping failed for "${key}". Using raw data.`);
117
+ dynamicTruth[key] = rawData;
118
+ }
119
+ } else {
120
+ dynamicTruth[key] = rawData;
121
+ }
122
+ }
123
+ }
124
+ return merge(staticTruth, dynamicTruth);
125
+ }
126
+
127
+ // src/index.ts
128
+ async function createLLMSource(config, options = {}) {
129
+ const nodeLoader = async (path) => {
130
+ try {
131
+ const fs = await import(
132
+ /* webpackIgnore: true */
133
+ "fs"
134
+ );
135
+ const nodePath = await import(
136
+ /* webpackIgnore: true */
137
+ "path"
138
+ );
139
+ const fullPath = path.startsWith("/") ? path : nodePath.join(process.cwd(), path);
140
+ return fs.readFileSync(fullPath, "utf-8");
141
+ } catch (error) {
142
+ console.warn(`[llmweb] Warning: 'node:fs' not available. Skipping static file load: ${path}`);
143
+ return null;
144
+ }
145
+ };
146
+ return compileLLM(config, nodeLoader, options);
147
+ }
148
+
149
+ // src/adapters/vanilla.ts
150
+ async function inject(config, mode = "script", targetKey = "__LLM__") {
151
+ const truth = await createLLMSource(config);
152
+ if (mode === "window") {
153
+ window[targetKey] = truth;
154
+ return;
155
+ }
156
+ const script = document.createElement("script");
157
+ script.type = "application/llm+json";
158
+ script.id = "llm-truth-script";
159
+ script.text = JSON.stringify(truth);
160
+ document.head.appendChild(script);
161
+ }
162
+ export {
163
+ inject
164
+ };