octane 0.2.10 → 0.2.11

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,115 @@
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 __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var hook_slot_cache_exports = {};
20
+ __export(hook_slot_cache_exports, {
21
+ resolveHookPath: () => resolveHookPath
22
+ });
23
+ module.exports = __toCommonJS(hook_slot_cache_exports);
24
+ const MAX_PATH_DEPTH = 16;
25
+ const MAX_BASE_SLOTS = 32;
26
+ const NATIVE_APPLY = Reflect.apply;
27
+ const INITIAL_SYMBOL_FOR = Symbol.for;
28
+ let NATIVE_SYMBOL_FOR = null;
29
+ try {
30
+ const text = NATIVE_APPLY(Function.prototype.toString, INITIAL_SYMBOL_FOR, []);
31
+ if (typeof INITIAL_SYMBOL_FOR === "function" && typeof text === "string" && /^function for\(\)\s*\{\s*\[native code\]\s*\}$/.test(text))
32
+ NATIVE_SYMBOL_FOR = INITIAL_SYMBOL_FOR;
33
+ } catch {
34
+ }
35
+ const frames = [];
36
+ function pathFrame(depth) {
37
+ return frames[depth] ??= { prefix: "", tag: "", size: 0, value: "", path: "", slots: null };
38
+ }
39
+ function resolveHookPath(stack, own, universal, server = false) {
40
+ const depth = stack.length;
41
+ let prefix = universal ? "@octane:universal-hook:" : "@octane:hook:";
42
+ let cacheable = depth < MAX_PATH_DEPTH;
43
+ for (let index = 0; index <= depth; index++) {
44
+ const last = index === depth;
45
+ const part = last ? own : stack[index];
46
+ cacheable &&= part === null || typeof part !== "object" && typeof part !== "function";
47
+ let tag;
48
+ let size;
49
+ let value;
50
+ let encoded;
51
+ if (!universal && last && own === void 0) {
52
+ tag = "";
53
+ size = 0;
54
+ value = "";
55
+ } else if (!universal) {
56
+ tag = typeof part === "number" ? "n" : server && typeof part === "string" ? "t" : "s";
57
+ value = typeof part === "number" ? String(part) : server && typeof part === "string" ? part : part.description ?? "";
58
+ size = value.length;
59
+ if (typeof value !== "string" || typeof size !== "number") {
60
+ encoded = tag + size + ":" + value;
61
+ cacheable = false;
62
+ }
63
+ } else {
64
+ tag = typeof part === "symbol" ? "s" : "v";
65
+ size = typeof part === "symbol" ? part.description?.length ?? 0 : String(part).length;
66
+ const head = typeof size === "number" ? void 0 : `${tag}${size}:`;
67
+ value = typeof part === "symbol" ? part.description ?? "" : String(part);
68
+ if (head !== void 0 || typeof value !== "string") {
69
+ encoded = `${head ?? `${tag}${size}:`}${value}`;
70
+ cacheable = false;
71
+ }
72
+ }
73
+ if (last) {
74
+ const registry = Symbol;
75
+ const intern = registry.for;
76
+ if (!cacheable || intern !== NATIVE_SYMBOL_FOR) {
77
+ const key = prefix + (encoded ?? (tag === "" ? "" : tag + size + ":" + value));
78
+ return intern === NATIVE_SYMBOL_FOR ? intern(key) : NATIVE_APPLY(intern, registry, [key]);
79
+ }
80
+ const frame2 = pathFrame(depth);
81
+ const slots = frame2.slots ??= /* @__PURE__ */ new Map();
82
+ const cached = slots.get(own);
83
+ if (cached !== void 0 && cached.prefix === prefix && cached.tag === tag && cached.size === size && cached.value === value)
84
+ return cached.resolved;
85
+ const resolved = intern(prefix + (tag === "" ? "" : tag + size + ":" + value));
86
+ if (cached !== void 0) {
87
+ cached.prefix = prefix;
88
+ cached.tag = tag;
89
+ cached.size = size;
90
+ cached.value = value;
91
+ cached.resolved = resolved;
92
+ } else if (slots.size < MAX_BASE_SLOTS)
93
+ slots.set(own, { prefix, tag, size, value, resolved });
94
+ return resolved;
95
+ }
96
+ if (!cacheable) {
97
+ prefix += encoded ?? tag + size + ":" + value;
98
+ continue;
99
+ }
100
+ const frame = pathFrame(index);
101
+ if (frame.prefix !== prefix || frame.tag !== tag || frame.size !== size || frame.value !== value) {
102
+ frame.prefix = prefix;
103
+ frame.tag = tag;
104
+ frame.size = size;
105
+ frame.value = value;
106
+ frame.path = prefix + tag + size + ":" + value;
107
+ }
108
+ prefix = frame.path;
109
+ }
110
+ throw new Error("Unreachable hook path");
111
+ }
112
+ // Annotate the CommonJS export names for ESM import in node:
113
+ 0 && (module.exports = {
114
+ resolveHookPath
115
+ });
@@ -96,8 +96,10 @@ __export(index_exports, {
96
96
  evt0: () => import_runtime.evt0,
97
97
  evt0u: () => import_runtime.evt0u,
98
98
  evt1: () => import_runtime.evt1,
99
+ evt1e: () => import_runtime.evt1e,
99
100
  evt1u: () => import_runtime.evt1u,
100
101
  evt2: () => import_runtime.evt2,
102
+ evt2e: () => import_runtime.evt2e,
101
103
  evt2u: () => import_runtime.evt2u,
102
104
  evtN: () => import_runtime.evtN,
103
105
  evtNu: () => import_runtime.evtNu,
@@ -326,8 +328,10 @@ var import_method_dep = require("./method-dep.cjs");
326
328
  evt0,
327
329
  evt0u,
328
330
  evt1,
331
+ evt1e,
329
332
  evt1u,
330
333
  evt2,
334
+ evt2e,
331
335
  evt2u,
332
336
  evtN,
333
337
  evtNu,