@tonyclaw/llm-inspector 1.6.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/.output/nitro.json +17 -0
- package/.output/public/assets/alibaba-TTwafVwX.svg +1 -0
- package/.output/public/assets/index-B3RwBPLW.css +1 -0
- package/.output/public/assets/index-s4lwsWvq.js +97 -0
- package/.output/public/assets/main-Cp8AM0Pa.js +17 -0
- package/.output/public/assets/minimax-BPMzvuL-.jpeg +0 -0
- package/.output/public/assets/qwen-CONDcHqt.png +0 -0
- package/.output/public/assets/zhipuai-BPNAnxo-.svg +219 -0
- package/.output/server/_chunks/ssr-renderer.mjs +17 -0
- package/.output/server/_libs/@radix-ui/react-accessible-icon+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-dismissable-layer+[...].mjs +210 -0
- package/.output/server/_libs/@radix-ui/react-navigation-menu+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-one-time-password-field+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-password-toggle-field+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-callback-ref+[...].mjs +11 -0
- package/.output/server/_libs/@radix-ui/react-use-controllable-state+[...].mjs +69 -0
- package/.output/server/_libs/@radix-ui/react-use-effect-event+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-escape-keydown+[...].mjs +17 -0
- package/.output/server/_libs/@radix-ui/react-use-is-hydrated+[...].mjs +1 -0
- package/.output/server/_libs/@radix-ui/react-use-layout-effect+[...].mjs +6 -0
- package/.output/server/_libs/@radix-ui/react-visually-hidden+[...].mjs +34 -0
- package/.output/server/_libs/ajv-formats.mjs +330 -0
- package/.output/server/_libs/ajv.mjs +11444 -0
- package/.output/server/_libs/aria-hidden.mjs +122 -0
- package/.output/server/_libs/atomically.mjs +152 -0
- package/.output/server/_libs/bail.mjs +8 -0
- package/.output/server/_libs/character-entities.mjs +2130 -0
- package/.output/server/_libs/class-variance-authority.mjs +44 -0
- package/.output/server/_libs/clsx.mjs +16 -0
- package/.output/server/_libs/comma-separated-tokens.mjs +10 -0
- package/.output/server/_libs/conf.mjs +635 -0
- package/.output/server/_libs/cookie-es.mjs +58 -0
- package/.output/server/_libs/core-util-is.mjs +75 -0
- package/.output/server/_libs/croner.mjs +1 -0
- package/.output/server/_libs/crossws.mjs +1 -0
- package/.output/server/_libs/debounce-fn.mjs +69 -0
- package/.output/server/_libs/decode-named-character-reference+[...].mjs +8 -0
- package/.output/server/_libs/detect-node-es.mjs +1 -0
- package/.output/server/_libs/devlop.mjs +8 -0
- package/.output/server/_libs/dot-prop.mjs +265 -0
- package/.output/server/_libs/env-paths.mjs +57 -0
- package/.output/server/_libs/estree-util-is-identifier-name.mjs +11 -0
- package/.output/server/_libs/extend.mjs +97 -0
- package/.output/server/_libs/fast-deep-equal.mjs +38 -0
- package/.output/server/_libs/fast-uri.mjs +812 -0
- package/.output/server/_libs/floating-ui__core.mjs +725 -0
- package/.output/server/_libs/floating-ui__dom.mjs +622 -0
- package/.output/server/_libs/floating-ui__react-dom.mjs +292 -0
- package/.output/server/_libs/floating-ui__utils.mjs +320 -0
- package/.output/server/_libs/get-nonce.mjs +9 -0
- package/.output/server/_libs/h3-v2.mjs +276 -0
- package/.output/server/_libs/h3.mjs +400 -0
- package/.output/server/_libs/hast-util-to-jsx-runtime.mjs +388 -0
- package/.output/server/_libs/hast-util-whitespace.mjs +10 -0
- package/.output/server/_libs/hookable.mjs +1 -0
- package/.output/server/_libs/html-url-attributes.mjs +26 -0
- package/.output/server/_libs/immediate.mjs +74 -0
- package/.output/server/_libs/inherits.mjs +50 -0
- package/.output/server/_libs/inline-style-parser.mjs +142 -0
- package/.output/server/_libs/is-plain-obj.mjs +10 -0
- package/.output/server/_libs/isarray.mjs +14 -0
- package/.output/server/_libs/isbot.mjs +20 -0
- package/.output/server/_libs/json-schema-traverse.mjs +180 -0
- package/.output/server/_libs/jszip.mjs +3049 -0
- package/.output/server/_libs/lie.mjs +273 -0
- package/.output/server/_libs/lucide-react.mjs +368 -0
- package/.output/server/_libs/mdast-util-from-markdown.mjs +717 -0
- package/.output/server/_libs/mdast-util-to-hast.mjs +710 -0
- package/.output/server/_libs/mdast-util-to-string.mjs +38 -0
- package/.output/server/_libs/micromark-core-commonmark.mjs +2259 -0
- package/.output/server/_libs/micromark-factory-destination.mjs +94 -0
- package/.output/server/_libs/micromark-factory-label.mjs +63 -0
- package/.output/server/_libs/micromark-factory-space.mjs +24 -0
- package/.output/server/_libs/micromark-factory-title.mjs +65 -0
- package/.output/server/_libs/micromark-factory-whitespace.mjs +22 -0
- package/.output/server/_libs/micromark-util-character.mjs +44 -0
- package/.output/server/_libs/micromark-util-chunked.mjs +36 -0
- package/.output/server/_libs/micromark-util-classify-character+[...].mjs +12 -0
- package/.output/server/_libs/micromark-util-combine-extensions+[...].mjs +41 -0
- package/.output/server/_libs/micromark-util-decode-numeric-character-reference+[...].mjs +19 -0
- package/.output/server/_libs/micromark-util-decode-string.mjs +21 -0
- package/.output/server/_libs/micromark-util-encode.mjs +1 -0
- package/.output/server/_libs/micromark-util-html-tag-name.mjs +69 -0
- package/.output/server/_libs/micromark-util-normalize-identifier+[...].mjs +6 -0
- package/.output/server/_libs/micromark-util-resolve-all.mjs +15 -0
- package/.output/server/_libs/micromark-util-sanitize-uri.mjs +41 -0
- package/.output/server/_libs/micromark-util-subtokenize.mjs +346 -0
- package/.output/server/_libs/micromark.mjs +906 -0
- package/.output/server/_libs/mimic-function.mjs +47 -0
- package/.output/server/_libs/ohash.mjs +1 -0
- package/.output/server/_libs/pako.mjs +4223 -0
- package/.output/server/_libs/process-nextick-args.mjs +48 -0
- package/.output/server/_libs/property-information.mjs +1209 -0
- package/.output/server/_libs/radix-ui.mjs +1 -0
- package/.output/server/_libs/radix-ui__number.mjs +6 -0
- package/.output/server/_libs/radix-ui__primitive.mjs +11 -0
- package/.output/server/_libs/radix-ui__react-accordion.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-alert-dialog.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-arrow.mjs +23 -0
- package/.output/server/_libs/radix-ui__react-aspect-ratio.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-avatar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-checkbox.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-collapsible.mjs +144 -0
- package/.output/server/_libs/radix-ui__react-collection.mjs +69 -0
- package/.output/server/_libs/radix-ui__react-compose-refs.mjs +39 -0
- package/.output/server/_libs/radix-ui__react-context-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-context.mjs +78 -0
- package/.output/server/_libs/radix-ui__react-dialog.mjs +325 -0
- package/.output/server/_libs/radix-ui__react-direction.mjs +9 -0
- package/.output/server/_libs/radix-ui__react-dropdown-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-focus-guards.mjs +29 -0
- package/.output/server/_libs/radix-ui__react-focus-scope.mjs +206 -0
- package/.output/server/_libs/radix-ui__react-form.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-hover-card.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-id.mjs +14 -0
- package/.output/server/_libs/radix-ui__react-label.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-menu.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-menubar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-popover.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-popper.mjs +286 -0
- package/.output/server/_libs/radix-ui__react-portal.mjs +16 -0
- package/.output/server/_libs/radix-ui__react-presence.mjs +128 -0
- package/.output/server/_libs/radix-ui__react-primitive.mjs +42 -0
- package/.output/server/_libs/radix-ui__react-progress.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-radio-group.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-roving-focus.mjs +224 -0
- package/.output/server/_libs/radix-ui__react-scroll-area.mjs +721 -0
- package/.output/server/_libs/radix-ui__react-select.mjs +1163 -0
- package/.output/server/_libs/radix-ui__react-separator.mjs +28 -0
- package/.output/server/_libs/radix-ui__react-slider.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-slot.mjs +99 -0
- package/.output/server/_libs/radix-ui__react-switch.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-tabs.mjs +189 -0
- package/.output/server/_libs/radix-ui__react-toast.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-toggle-group.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-toggle.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-toolbar.mjs +1 -0
- package/.output/server/_libs/radix-ui__react-tooltip.mjs +495 -0
- package/.output/server/_libs/radix-ui__react-use-previous.mjs +14 -0
- package/.output/server/_libs/radix-ui__react-use-size.mjs +39 -0
- package/.output/server/_libs/react-dom.mjs +9935 -0
- package/.output/server/_libs/react-markdown.mjs +147 -0
- package/.output/server/_libs/react-remove-scroll-bar.mjs +82 -0
- package/.output/server/_libs/react-remove-scroll.mjs +328 -0
- package/.output/server/_libs/react-style-singleton.mjs +69 -0
- package/.output/server/_libs/react.mjs +515 -0
- package/.output/server/_libs/readable-stream.mjs +1518 -0
- package/.output/server/_libs/remark-parse.mjs +19 -0
- package/.output/server/_libs/remark-rehype.mjs +21 -0
- package/.output/server/_libs/rou3.mjs +8 -0
- package/.output/server/_libs/safe-buffer.mjs +64 -0
- package/.output/server/_libs/semver.mjs +1984 -0
- package/.output/server/_libs/seroval-plugins.mjs +58 -0
- package/.output/server/_libs/seroval.mjs +1765 -0
- package/.output/server/_libs/setimmediate.mjs +1 -0
- package/.output/server/_libs/space-separated-tokens.mjs +6 -0
- package/.output/server/_libs/srvx.mjs +334 -0
- package/.output/server/_libs/stubborn-fs.mjs +91 -0
- package/.output/server/_libs/stubborn-utils.mjs +66 -0
- package/.output/server/_libs/style-to-js.mjs +72 -0
- package/.output/server/_libs/style-to-object.mjs +38 -0
- package/.output/server/_libs/tailwind-merge.mjs +3010 -0
- package/.output/server/_libs/tanstack__history.mjs +217 -0
- package/.output/server/_libs/tanstack__react-router.mjs +1480 -0
- package/.output/server/_libs/tanstack__react-store.mjs +1 -0
- package/.output/server/_libs/tanstack__react-virtual.mjs +44 -0
- package/.output/server/_libs/tanstack__router-core.mjs +4827 -0
- package/.output/server/_libs/tanstack__store.mjs +1 -0
- package/.output/server/_libs/tanstack__virtual-core.mjs +1225 -0
- package/.output/server/_libs/tiny-invariant.mjs +12 -0
- package/.output/server/_libs/tiny-warning.mjs +5 -0
- package/.output/server/_libs/trim-lines.mjs +41 -0
- package/.output/server/_libs/trough.mjs +85 -0
- package/.output/server/_libs/tslib.mjs +576 -0
- package/.output/server/_libs/ufo.mjs +54 -0
- package/.output/server/_libs/uint8array-extras.mjs +69 -0
- package/.output/server/_libs/unctx.mjs +1 -0
- package/.output/server/_libs/ungap__structured-clone.mjs +212 -0
- package/.output/server/_libs/unified.mjs +661 -0
- package/.output/server/_libs/unist-util-is.mjs +100 -0
- package/.output/server/_libs/unist-util-position.mjs +27 -0
- package/.output/server/_libs/unist-util-stringify-position.mjs +27 -0
- package/.output/server/_libs/unist-util-visit-parents.mjs +82 -0
- package/.output/server/_libs/unist-util-visit.mjs +24 -0
- package/.output/server/_libs/unstorage.mjs +1 -0
- package/.output/server/_libs/use-callback-ref.mjs +66 -0
- package/.output/server/_libs/use-sidecar.mjs +106 -0
- package/.output/server/_libs/use-sync-external-store.mjs +1 -0
- package/.output/server/_libs/util-deprecate.mjs +12 -0
- package/.output/server/_libs/vfile-message.mjs +138 -0
- package/.output/server/_libs/vfile.mjs +467 -0
- package/.output/server/_libs/when-exit.mjs +53 -0
- package/.output/server/_libs/zod.mjs +4460 -0
- package/.output/server/_ssr/index-ByCLZu7J.mjs +3061 -0
- package/.output/server/_ssr/index.mjs +1176 -0
- package/.output/server/_ssr/router-Bq_mxeNz.mjs +2872 -0
- package/.output/server/_ssr/start-HYkvq4Ni.mjs +4 -0
- package/.output/server/_tanstack-start-manifest_v-C4E0e9my.mjs +4 -0
- package/.output/server/index.mjs +393 -0
- package/README.md +196 -0
- package/package.json +91 -0
- package/src/assets/logos/alibaba.svg +1 -0
- package/src/assets/logos/anthropic.svg +1 -0
- package/src/assets/logos/deepseek.svg +1 -0
- package/src/assets/logos/minimax.jpeg +0 -0
- package/src/assets/logos/openai.svg +1 -0
- package/src/assets/logos/qwen.png +0 -0
- package/src/assets/logos/zhipuai.svg +219 -0
- package/src/cli.ts +68 -0
- package/src/components/ProxyViewer.tsx +325 -0
- package/src/components/ProxyViewerContainer.tsx +211 -0
- package/src/components/providers/ProviderCard.tsx +186 -0
- package/src/components/providers/ProviderForm.tsx +259 -0
- package/src/components/providers/ProviderLogo.tsx +111 -0
- package/src/components/providers/ProvidersPanel.tsx +259 -0
- package/src/components/providers/SettingsDialog.tsx +39 -0
- package/src/components/proxy-viewer/ConversationGroup.tsx +68 -0
- package/src/components/proxy-viewer/ConversationHeader.tsx +141 -0
- package/src/components/proxy-viewer/LogEntry.tsx +225 -0
- package/src/components/proxy-viewer/LogEntryHeader.tsx +250 -0
- package/src/components/proxy-viewer/ReplayDialog.tsx +208 -0
- package/src/components/proxy-viewer/ResponseView.tsx +161 -0
- package/src/components/proxy-viewer/StreamingChunkSequence.tsx +171 -0
- package/src/components/proxy-viewer/formats/anthropic/ContentBlocks.tsx +139 -0
- package/src/components/proxy-viewer/formats/anthropic/ResponseView.tsx +64 -0
- package/src/components/proxy-viewer/formats/index.tsx +24 -0
- package/src/components/proxy-viewer/formats/openai/ResponseView.tsx +80 -0
- package/src/components/proxy-viewer/index.ts +8 -0
- package/src/components/ui/badge.tsx +47 -0
- package/src/components/ui/button.tsx +47 -0
- package/src/components/ui/collapsible.tsx +21 -0
- package/src/components/ui/dialog.tsx +129 -0
- package/src/components/ui/json-viewer.tsx +464 -0
- package/src/components/ui/scroll-area.tsx +54 -0
- package/src/components/ui/select.tsx +178 -0
- package/src/components/ui/separator.tsx +28 -0
- package/src/components/ui/tabs.tsx +88 -0
- package/src/components/ui/tooltip.tsx +51 -0
- package/src/index.css +11 -0
- package/src/lib/export-logs.ts +51 -0
- package/src/lib/utils.ts +22 -0
- package/src/proxy/chunkStorage.ts +118 -0
- package/src/proxy/constants.ts +36 -0
- package/src/proxy/formats/anthropic/anthropicProvider.ts +75 -0
- package/src/proxy/formats/anthropic/handler.ts +74 -0
- package/src/proxy/formats/anthropic/index.ts +14 -0
- package/src/proxy/formats/anthropic/register.ts +4 -0
- package/src/proxy/formats/anthropic/schemas.ts +217 -0
- package/src/proxy/formats/anthropic/stream.ts +167 -0
- package/src/proxy/formats/handler.ts +46 -0
- package/src/proxy/formats/index.ts +12 -0
- package/src/proxy/formats/jsonSchema.ts +24 -0
- package/src/proxy/formats/openai/alibabaProvider.ts +38 -0
- package/src/proxy/formats/openai/handler.ts +70 -0
- package/src/proxy/formats/openai/index.ts +25 -0
- package/src/proxy/formats/openai/provider.ts +50 -0
- package/src/proxy/formats/openai/register.ts +4 -0
- package/src/proxy/formats/openai/schemas.ts +150 -0
- package/src/proxy/formats/openai/stream.ts +153 -0
- package/src/proxy/formats/protocol.ts +50 -0
- package/src/proxy/formats/providerRegistry.ts +51 -0
- package/src/proxy/formats/providers/index.ts +3 -0
- package/src/proxy/formats/registry.ts +61 -0
- package/src/proxy/handler.ts +389 -0
- package/src/proxy/logIndex.ts +187 -0
- package/src/proxy/logger.ts +99 -0
- package/src/proxy/providers.ts +234 -0
- package/src/proxy/schemas.ts +160 -0
- package/src/proxy/socketTracker.ts +158 -0
- package/src/proxy/store.ts +386 -0
- package/src/router.tsx +16 -0
- package/src/routes/__root.tsx +38 -0
- package/src/routes/api/config.paths.ts +14 -0
- package/src/routes/api/health.ts +11 -0
- package/src/routes/api/logs.$id.chunks.ts +36 -0
- package/src/routes/api/logs.$id.replay.ts +262 -0
- package/src/routes/api/logs.$id.ts +22 -0
- package/src/routes/api/logs.stream.ts +64 -0
- package/src/routes/api/logs.ts +30 -0
- package/src/routes/api/models.ts +10 -0
- package/src/routes/api/providers.$providerId.ts +45 -0
- package/src/routes/api/providers.ts +37 -0
- package/src/routes/api/sessions.ts +10 -0
- package/src/routes/index.tsx +6 -0
- package/src/routes/proxy/$.ts +15 -0
- package/styles/globals.css +121 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
var getDefaultParent = function(originalTarget) {
|
|
2
|
+
if (typeof document === "undefined") {
|
|
3
|
+
return null;
|
|
4
|
+
}
|
|
5
|
+
var sampleTarget = Array.isArray(originalTarget) ? originalTarget[0] : originalTarget;
|
|
6
|
+
return sampleTarget.ownerDocument.body;
|
|
7
|
+
};
|
|
8
|
+
var counterMap = /* @__PURE__ */ new WeakMap();
|
|
9
|
+
var uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
10
|
+
var markerMap = {};
|
|
11
|
+
var lockCount = 0;
|
|
12
|
+
var unwrapHost = function(node) {
|
|
13
|
+
return node && (node.host || unwrapHost(node.parentNode));
|
|
14
|
+
};
|
|
15
|
+
var correctTargets = function(parent, targets) {
|
|
16
|
+
return targets.map(function(target) {
|
|
17
|
+
if (parent.contains(target)) {
|
|
18
|
+
return target;
|
|
19
|
+
}
|
|
20
|
+
var correctedTarget = unwrapHost(target);
|
|
21
|
+
if (correctedTarget && parent.contains(correctedTarget)) {
|
|
22
|
+
return correctedTarget;
|
|
23
|
+
}
|
|
24
|
+
console.error("aria-hidden", target, "in not contained inside", parent, ". Doing nothing");
|
|
25
|
+
return null;
|
|
26
|
+
}).filter(function(x) {
|
|
27
|
+
return Boolean(x);
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
var applyAttributeToOthers = function(originalTarget, parentNode, markerName, controlAttribute) {
|
|
31
|
+
var targets = correctTargets(parentNode, Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
32
|
+
if (!markerMap[markerName]) {
|
|
33
|
+
markerMap[markerName] = /* @__PURE__ */ new WeakMap();
|
|
34
|
+
}
|
|
35
|
+
var markerCounter = markerMap[markerName];
|
|
36
|
+
var hiddenNodes = [];
|
|
37
|
+
var elementsToKeep = /* @__PURE__ */ new Set();
|
|
38
|
+
var elementsToStop = new Set(targets);
|
|
39
|
+
var keep = function(el) {
|
|
40
|
+
if (!el || elementsToKeep.has(el)) {
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
elementsToKeep.add(el);
|
|
44
|
+
keep(el.parentNode);
|
|
45
|
+
};
|
|
46
|
+
targets.forEach(keep);
|
|
47
|
+
var deep = function(parent) {
|
|
48
|
+
if (!parent || elementsToStop.has(parent)) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
Array.prototype.forEach.call(parent.children, function(node) {
|
|
52
|
+
if (elementsToKeep.has(node)) {
|
|
53
|
+
deep(node);
|
|
54
|
+
} else {
|
|
55
|
+
try {
|
|
56
|
+
var attr = node.getAttribute(controlAttribute);
|
|
57
|
+
var alreadyHidden = attr !== null && attr !== "false";
|
|
58
|
+
var counterValue = (counterMap.get(node) || 0) + 1;
|
|
59
|
+
var markerValue = (markerCounter.get(node) || 0) + 1;
|
|
60
|
+
counterMap.set(node, counterValue);
|
|
61
|
+
markerCounter.set(node, markerValue);
|
|
62
|
+
hiddenNodes.push(node);
|
|
63
|
+
if (counterValue === 1 && alreadyHidden) {
|
|
64
|
+
uncontrolledNodes.set(node, true);
|
|
65
|
+
}
|
|
66
|
+
if (markerValue === 1) {
|
|
67
|
+
node.setAttribute(markerName, "true");
|
|
68
|
+
}
|
|
69
|
+
if (!alreadyHidden) {
|
|
70
|
+
node.setAttribute(controlAttribute, "true");
|
|
71
|
+
}
|
|
72
|
+
} catch (e) {
|
|
73
|
+
console.error("aria-hidden: cannot operate on ", node, e);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
};
|
|
78
|
+
deep(parentNode);
|
|
79
|
+
elementsToKeep.clear();
|
|
80
|
+
lockCount++;
|
|
81
|
+
return function() {
|
|
82
|
+
hiddenNodes.forEach(function(node) {
|
|
83
|
+
var counterValue = counterMap.get(node) - 1;
|
|
84
|
+
var markerValue = markerCounter.get(node) - 1;
|
|
85
|
+
counterMap.set(node, counterValue);
|
|
86
|
+
markerCounter.set(node, markerValue);
|
|
87
|
+
if (!counterValue) {
|
|
88
|
+
if (!uncontrolledNodes.has(node)) {
|
|
89
|
+
node.removeAttribute(controlAttribute);
|
|
90
|
+
}
|
|
91
|
+
uncontrolledNodes.delete(node);
|
|
92
|
+
}
|
|
93
|
+
if (!markerValue) {
|
|
94
|
+
node.removeAttribute(markerName);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
lockCount--;
|
|
98
|
+
if (!lockCount) {
|
|
99
|
+
counterMap = /* @__PURE__ */ new WeakMap();
|
|
100
|
+
counterMap = /* @__PURE__ */ new WeakMap();
|
|
101
|
+
uncontrolledNodes = /* @__PURE__ */ new WeakMap();
|
|
102
|
+
markerMap = {};
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
};
|
|
106
|
+
var hideOthers = function(originalTarget, parentNode, markerName) {
|
|
107
|
+
if (markerName === void 0) {
|
|
108
|
+
markerName = "data-aria-hidden";
|
|
109
|
+
}
|
|
110
|
+
var targets = Array.from(Array.isArray(originalTarget) ? originalTarget : [originalTarget]);
|
|
111
|
+
var activeParentNode = getDefaultParent(originalTarget);
|
|
112
|
+
if (!activeParentNode) {
|
|
113
|
+
return function() {
|
|
114
|
+
return null;
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
targets.push.apply(targets, Array.from(activeParentNode.querySelectorAll("[aria-live], script")));
|
|
118
|
+
return applyAttributeToOthers(targets, activeParentNode, markerName, "aria-hidden");
|
|
119
|
+
};
|
|
120
|
+
export {
|
|
121
|
+
hideOthers as h
|
|
122
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import path from "node:path";
|
|
2
|
+
import { F as FS } from "./stubborn-fs.mjs";
|
|
3
|
+
import process from "node:process";
|
|
4
|
+
import { w as whenExit } from "./when-exit.mjs";
|
|
5
|
+
const DEFAULT_ENCODING = "utf8";
|
|
6
|
+
const DEFAULT_FILE_MODE = 438;
|
|
7
|
+
const DEFAULT_FOLDER_MODE = 511;
|
|
8
|
+
const DEFAULT_WRITE_OPTIONS = {};
|
|
9
|
+
const DEFAULT_USER_UID = process.geteuid ? process.geteuid() : -1;
|
|
10
|
+
const DEFAULT_USER_GID = process.getegid ? process.getegid() : -1;
|
|
11
|
+
const DEFAULT_TIMEOUT_SYNC = 1e3;
|
|
12
|
+
const IS_POSIX = !!process.getuid;
|
|
13
|
+
process.getuid ? !process.getuid() : false;
|
|
14
|
+
const LIMIT_BASENAME_LENGTH = 128;
|
|
15
|
+
const isException = (value) => {
|
|
16
|
+
return value instanceof Error && "code" in value;
|
|
17
|
+
};
|
|
18
|
+
const isString = (value) => {
|
|
19
|
+
return typeof value === "string";
|
|
20
|
+
};
|
|
21
|
+
const isUndefined = (value) => {
|
|
22
|
+
return value === void 0;
|
|
23
|
+
};
|
|
24
|
+
const Temp = {
|
|
25
|
+
/* VARIABLES */
|
|
26
|
+
store: {},
|
|
27
|
+
// filePath => purge
|
|
28
|
+
/* API */
|
|
29
|
+
create: (filePath) => {
|
|
30
|
+
const randomness = `000000${Math.floor(Math.random() * 16777215).toString(16)}`.slice(-6);
|
|
31
|
+
const timestamp = Date.now().toString().slice(-10);
|
|
32
|
+
const prefix = "tmp-";
|
|
33
|
+
const suffix = `.${prefix}${timestamp}${randomness}`;
|
|
34
|
+
const tempPath = `${filePath}${suffix}`;
|
|
35
|
+
return tempPath;
|
|
36
|
+
},
|
|
37
|
+
get: (filePath, creator, purge = true) => {
|
|
38
|
+
const tempPath = Temp.truncate(creator(filePath));
|
|
39
|
+
if (tempPath in Temp.store)
|
|
40
|
+
return Temp.get(filePath, creator, purge);
|
|
41
|
+
Temp.store[tempPath] = purge;
|
|
42
|
+
const disposer = () => delete Temp.store[tempPath];
|
|
43
|
+
return [tempPath, disposer];
|
|
44
|
+
},
|
|
45
|
+
purge: (filePath) => {
|
|
46
|
+
if (!Temp.store[filePath])
|
|
47
|
+
return;
|
|
48
|
+
delete Temp.store[filePath];
|
|
49
|
+
FS.attempt.unlink(filePath);
|
|
50
|
+
},
|
|
51
|
+
purgeSync: (filePath) => {
|
|
52
|
+
if (!Temp.store[filePath])
|
|
53
|
+
return;
|
|
54
|
+
delete Temp.store[filePath];
|
|
55
|
+
FS.attempt.unlinkSync(filePath);
|
|
56
|
+
},
|
|
57
|
+
purgeSyncAll: () => {
|
|
58
|
+
for (const filePath in Temp.store) {
|
|
59
|
+
Temp.purgeSync(filePath);
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
truncate: (filePath) => {
|
|
63
|
+
const basename = path.basename(filePath);
|
|
64
|
+
if (basename.length <= LIMIT_BASENAME_LENGTH)
|
|
65
|
+
return filePath;
|
|
66
|
+
const truncable = /^(\.?)(.*?)((?:\.[^.]+)?(?:\.tmp-\d{10}[a-f0-9]{6})?)$/.exec(basename);
|
|
67
|
+
if (!truncable)
|
|
68
|
+
return filePath;
|
|
69
|
+
const truncationLength = basename.length - LIMIT_BASENAME_LENGTH;
|
|
70
|
+
return `${filePath.slice(0, -basename.length)}${truncable[1]}${truncable[2].slice(0, -truncationLength)}${truncable[3]}`;
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
whenExit(Temp.purgeSyncAll);
|
|
74
|
+
function writeFileSync(filePath, data, options = DEFAULT_WRITE_OPTIONS) {
|
|
75
|
+
if (isString(options))
|
|
76
|
+
return writeFileSync(filePath, data, { encoding: options });
|
|
77
|
+
const timeout = options.timeout ?? DEFAULT_TIMEOUT_SYNC;
|
|
78
|
+
const retryOptions = { timeout };
|
|
79
|
+
let tempDisposer = null;
|
|
80
|
+
let tempPath = null;
|
|
81
|
+
let fd = null;
|
|
82
|
+
try {
|
|
83
|
+
const filePathReal = FS.attempt.realpathSync(filePath);
|
|
84
|
+
const filePathExists = !!filePathReal;
|
|
85
|
+
filePath = filePathReal || filePath;
|
|
86
|
+
[tempPath, tempDisposer] = Temp.get(filePath, options.tmpCreate || Temp.create, !(options.tmpPurge === false));
|
|
87
|
+
const useStatChown = IS_POSIX && isUndefined(options.chown);
|
|
88
|
+
const useStatMode = isUndefined(options.mode);
|
|
89
|
+
if (filePathExists && (useStatChown || useStatMode)) {
|
|
90
|
+
const stats = FS.attempt.statSync(filePath);
|
|
91
|
+
if (stats) {
|
|
92
|
+
options = { ...options };
|
|
93
|
+
if (useStatChown) {
|
|
94
|
+
options.chown = { uid: stats.uid, gid: stats.gid };
|
|
95
|
+
}
|
|
96
|
+
if (useStatMode) {
|
|
97
|
+
options.mode = stats.mode;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
if (!filePathExists) {
|
|
102
|
+
const parentPath = path.dirname(filePath);
|
|
103
|
+
FS.attempt.mkdirSync(parentPath, {
|
|
104
|
+
mode: DEFAULT_FOLDER_MODE,
|
|
105
|
+
recursive: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
fd = FS.retry.openSync(retryOptions)(tempPath, "w", options.mode || DEFAULT_FILE_MODE);
|
|
109
|
+
if (options.tmpCreated) {
|
|
110
|
+
options.tmpCreated(tempPath);
|
|
111
|
+
}
|
|
112
|
+
if (isString(data)) {
|
|
113
|
+
FS.retry.writeSync(retryOptions)(fd, data, 0, options.encoding || DEFAULT_ENCODING);
|
|
114
|
+
} else if (!isUndefined(data)) {
|
|
115
|
+
FS.retry.writeSync(retryOptions)(fd, data, 0, data.length, 0);
|
|
116
|
+
}
|
|
117
|
+
if (options.fsync !== false) {
|
|
118
|
+
if (options.fsyncWait !== false) {
|
|
119
|
+
FS.retry.fsyncSync(retryOptions)(fd);
|
|
120
|
+
} else {
|
|
121
|
+
FS.attempt.fsync(fd);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
FS.retry.closeSync(retryOptions)(fd);
|
|
125
|
+
fd = null;
|
|
126
|
+
if (options.chown && (options.chown.uid !== DEFAULT_USER_UID || options.chown.gid !== DEFAULT_USER_GID)) {
|
|
127
|
+
FS.attempt.chownSync(tempPath, options.chown.uid, options.chown.gid);
|
|
128
|
+
}
|
|
129
|
+
if (options.mode && options.mode !== DEFAULT_FILE_MODE) {
|
|
130
|
+
FS.attempt.chmodSync(tempPath, options.mode);
|
|
131
|
+
}
|
|
132
|
+
try {
|
|
133
|
+
FS.retry.renameSync(retryOptions)(tempPath, filePath);
|
|
134
|
+
} catch (error) {
|
|
135
|
+
if (!isException(error))
|
|
136
|
+
throw error;
|
|
137
|
+
if (error.code !== "ENAMETOOLONG")
|
|
138
|
+
throw error;
|
|
139
|
+
FS.retry.renameSync(retryOptions)(tempPath, Temp.truncate(filePath));
|
|
140
|
+
}
|
|
141
|
+
tempDisposer();
|
|
142
|
+
tempPath = null;
|
|
143
|
+
} finally {
|
|
144
|
+
if (fd)
|
|
145
|
+
FS.attempt.closeSync(fd);
|
|
146
|
+
if (tempPath)
|
|
147
|
+
Temp.purge(tempPath);
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
export {
|
|
151
|
+
writeFileSync as w
|
|
152
|
+
};
|