@the-w1zard/the-registry 1.0.6 → 1.0.7

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,246 @@
1
+ declare const EventEmitter: any;
2
+ type FlushCallback = () => V;
3
+ export declare const rv: <T>(v: UF<T>) => T;
4
+ export declare const sameValue: (a: A, b: A) => B;
5
+ export declare class Registry extends EventEmitter {
6
+ #private;
7
+ _byteid(): string;
8
+ _sid(): string;
9
+ b(): string;
10
+ r: string;
11
+ m: string;
12
+ s: string;
13
+ DEVTOOLS_ACTIVE: boolean;
14
+ constructor();
15
+ _globalNotifyCache: WeakMap<any, Map<any, () => void>>;
16
+ _notifyCache: WeakMap<Map<any, Set<(value: A) => void>>, Map<any, () => void>>;
17
+ scheduleGlobalNotify(key: string | symbol, meta: A, opts: ScopeOptions): void;
18
+ scheduleNotify(key: A, _listeners: M2<A, Set<(value: A) => void>>, _state: Map<A, A>): void;
19
+ getMap<K, V>(slave?: A, master?: A, rk?: A): M2<K, V>;
20
+ getMetadata(s?: string, m?: string, r?: string): any;
21
+ store: {
22
+ get: <T = A>(key: A, opts?: ScopeOptions) => T | undefined;
23
+ set: <T = A>(key: A, value: T | ((prev: T | undefined) => T), opts?: {
24
+ triggerRender?: boolean;
25
+ cap?: number;
26
+ } & ScopeOptions) => any;
27
+ subscribe: <T = A>(key: A, listener: (value: T) => void, opts?: ScopeOptions) => (() => void);
28
+ delete: (key: A, opts?: ScopeOptions) => boolean;
29
+ entries: <T = A>(opts?: ScopeOptions) => [A, T][];
30
+ persist: (key: A, opts?: ScopeOptions) => void;
31
+ unpersist: (key: A, opts?: ScopeOptions) => void;
32
+ has: (key: A, opts?: ScopeOptions) => boolean;
33
+ clear: (opts?: ScopeOptions) => void;
34
+ clearPersistent: (opts?: ScopeOptions) => void;
35
+ _emit: (key: string | symbol, sl_reg?: string, ms_reg?: string, globalKey?: string) => void;
36
+ };
37
+ state: {
38
+ get: <T = A>(key: string | symbol, opts?: ScopeOptions) => T | undefined;
39
+ set: <T = A>(key: string | symbol, value: T | ((prev: T | undefined) => T), opts?: {
40
+ triggerRender?: boolean;
41
+ } & ScopeOptions) => void;
42
+ delete: (key: string | symbol, opts?: ScopeOptions) => boolean;
43
+ getByPrefix: <T = A>(prefix: string, opts?: ScopeOptions) => {
44
+ key: string;
45
+ value: T;
46
+ }[];
47
+ getAll: <T = A>(opts?: ScopeOptions) => Record<string | symbol, T>;
48
+ subscribe: <T = A>(key: string | symbol, listener: (value: T) => void, opts?: ScopeOptions) => (() => void);
49
+ subscribeAll: (listener: (key: string | symbol, value: A) => void, opts?: ScopeOptions) => (() => void);
50
+ clear: (opts?: ScopeOptions) => void;
51
+ waitFor: <T = A>(key: string | symbol, opts?: ScopeOptions) => Promise<T>;
52
+ };
53
+ onFlush(cb: FlushCallback): void;
54
+ scheduleDrain(): void;
55
+ drain(): void;
56
+ set(key: A, value: A): this;
57
+ setLazy(key: A, make: () => A): this;
58
+ delete(key: A): boolean;
59
+ clear(): void;
60
+ subscribe(fn: (value: A, prev: A, key: S) => V): () => V;
61
+ subscribe(key: S, fn: (value: A, prev: A, key: S) => V, opts?: {
62
+ immediate?: B;
63
+ }): () => V;
64
+ subscribe(key: S, opts?: {
65
+ immediate?: B;
66
+ }): AsyncGenerator<A, V, U>;
67
+ unsubscribeAll(fns: Iterable<FN>): void;
68
+ subscribersOf(keys: S[]): A;
69
+ get<T = A>(key: S): T | UD;
70
+ get<T = A>(key: S, fallback: T): T;
71
+ getAll(): A;
72
+ has(key: A): any;
73
+ freeze(): void;
74
+ wait(key: A, { predicate, timeout, immediate, signal }?: A): Promise<any>;
75
+ waitChange(key: A, opts?: {}): Promise<any>;
76
+ waitFor(key: A, predicate: A, opts?: {}): Promise<any>;
77
+ setIfAbsent(key: A, value: U): boolean;
78
+ setIfPresent(key: A, value: U): boolean;
79
+ replace(key: A, value: U): boolean;
80
+ update(key: A, fn: (old: A, has: B) => A, initial: U): any;
81
+ inc(key: A, by?: number): any;
82
+ touch(key: A): boolean;
83
+ toJSON(): any;
84
+ entries(): any;
85
+ keys(): any;
86
+ values(): any;
87
+ find(pred: A): any;
88
+ findKey(pred: A): any;
89
+ group(fn: A): any;
90
+ pick(keys: A): any;
91
+ omit(keys: A): any;
92
+ snapshot(): A;
93
+ equals(other: A): any;
94
+ snapshotSubs(): any;
95
+ nextWaiterId: number;
96
+ private nextDeferId;
97
+ private draining;
98
+ private drainAgain;
99
+ private deferStats;
100
+ private autoCloud;
101
+ private warnedUseBeforeReady;
102
+ private ENV_STATE;
103
+ private shout;
104
+ /** the results view — computed from the ONE registry, stored nowhere */
105
+ get results(): RO<Array<ResultRecord>>;
106
+ get size(): N;
107
+ static readonly MODULE_LEVEL_CANDIDATES: readonly ["typescript", "rollup", "vite", "eslint", "babel", "postcss", "tailwindcss", "@babel/core", "prettier", "stylelint", "sass", "less", "jest", "vitest", "playwright", "@types/vscode"];
108
+ static readonly PLATFORM_CANDIDATES: readonly ["PROJECT_PLATFORM_KILLER", "react", "preact", "@remix-run/react", "@react-router/react", "next", "nuxt", "svelte", "solid", "vite", "arfa", "vue", "angular", "astro", "gatsby", "dojo", "inferno", "lupine", "ember-source", "backbone", "alpinejs", "lit", "marko", "@builder.io/qwik", "solid-start", "@sveltejs/kit", "meteor", "stencil", "aurelia", "nodiff", "qwik", "velo-type", "webpack"];
109
+ static readonly COMPILER_CANDIDATES: readonly ["rspack", "webpack", "vite", "rollup", "esbuild", "swc-loader", "babel", "next", "nuxt", "@remix-run/react", "@react-router/react", "svelte", "solid", "vue", "@swc/core", "turbopack", "parcel", "tsup", "unbuild", "esbuild-loader", "@babel/core", "terser", "@angular/core", "@angular/compile"];
110
+ static readonly BUNDLER_CANDIDATES: readonly ["bun", "pnpm", "yarn", "npm"];
111
+ static readonly ADAPTER_CANDIDATES: readonly ["websocket_dev_server", "cross_app_ws_server", "terminal_ngin_proxy_register", "terminal_ngin_proxy", "workspace_hub_server", "workspace_hub_client", "cross_app_ws_client", "cse_cross_app_server", "cse_cross_app_client", "shared_worker", "service_worker", "unix_worker", "broadcastr_channel", "websocket", "websocket_server", "websocket_client", "webrtc", "webrtc_server", "webrtc_client", "electron_server", "electron_client", "mqtt", "sse", "named_pipe", "worker_thread", "native_msg_host", "native_msg_client"];
112
+ static readonly CAPABILITY_CANDIDATES: readonly ["shared_worker", "service_worker", "unix_worker", "broadcastr_channel", "electron_server", "electron_client", "named_pipe", "native_msg_host", "native_msg_client"];
113
+ maelstrom: {
114
+ (): void;
115
+ log: (where: S, detail?: R, type?: "info" | "success" | "warn" | "error") => void; /** resolve a specifier relative to THIS file, always. Absolute out. */
116
+ key_for: (specifier: S) => S;
117
+ normalizeFallback: <F>(fallback: F | (() => F) | undefined, fallbackDefault: () => F) => () => F; /** the safe proxy — missing module access is suppressed, never crashed */
118
+ createSafeProxy: () => A;
119
+ toNamespace: (m: A) => A;
120
+ blind: {
121
+ (): void;
122
+ /** dynamic import with no static dependency — works in every module system */
123
+ import: (s: string) => Promise<any>;
124
+ /** require with no static dependency — null where require does not exist (browser/ESM) */
125
+ require: (s: string) => A;
126
+ };
127
+ has: {
128
+ (): void;
129
+ bun: boolean;
130
+ node: boolean;
131
+ /** does a local file exist, resolved from cwd — the has_local probe */
132
+ local: (filePath: S | undefined, module?: S) => B;
133
+ require: boolean;
134
+ };
135
+ is: {
136
+ (): void;
137
+ require_available: () => B;
138
+ browser: boolean;
139
+ VSCode: string;
140
+ electron: boolean;
141
+ unix: boolean;
142
+ windows: boolean;
143
+ };
144
+ /**
145
+ * Record an outcome. This is the single funnel: it tags the registry entry, notifies the
146
+ * entry's subscribers, advances every waiter on the label, and releases deferred tasks.
147
+ * It writes to the ONE registry — it creates no maps.
148
+ */
149
+ record: <T>(label: S, solver: Solver, value: T | undefined, store?: StoreKind) => void;
150
+ rift: {
151
+ <T = any>(name: S): RiftLike<T>;
152
+ clear: (() => V) | (() => V);
153
+ inspect: () => R;
154
+ /** guard — wait for a rift, then run a fn on its unlock value */
155
+ guard: <T, R>(name: string, fn: (unlockValue: T) => R | Promise<R>, timeoutMs?: number) => void;
156
+ /** async load with inflight dedupe — same key always resolves to the same promise */
157
+ load: <T = any>(specifier: S) => Promise<T>;
158
+ result: <T = any>(label: S) => ResultRecord<T> | undefined;
159
+ resultsFrom: (solver: Solver) => ResultRecord[];
160
+ onResult: (listener: (r: ResultRecord) => V) => (() => V);
161
+ place: <T = any>(label: S, value: T, store?: StoreKind) => V;
162
+ get_value: <T = any>(label: S) => T | undefined;
163
+ read: <T = any>(label: S, store?: StoreKind) => T | undefined;
164
+ reset: (name: S) => V;
165
+ delete: (name: S) => B;
166
+ bandit: <T = any>(label: S, module?: A, wait?: N, store?: StoreKind) => A;
167
+ create: <T = any>(label: S, module: T, store?: StoreKind) => A;
168
+ use: <T = any>(label: S, wait?: N, apparation?: T, store?: StoreKind) => A;
169
+ resolve: {
170
+ <T = any>(name: S, v: T): A;
171
+ global: <T = any>(name: S, wait?: N, fallback?: T) => A;
172
+ };
173
+ has: (module: S) => B;
174
+ make: <T = any>() => RiftLike<T>;
175
+ conjure: {
176
+ <T = any, F = any>(options: OPTIONAL_IMPORT_OPTIONS<T, F>): A;
177
+ get: <T = any>(label: S, cache?: B, module?: B) => A;
178
+ uncached: <T = any, F = any>(options: OPTIONAL_IMPORT_OPTIONS<T, F>) => A;
179
+ };
180
+ use_if_available: <T = any>(label: S, filePath: S, comp_name: S, fallback: T, opts?: {
181
+ store?: StoreKind;
182
+ }) => T;
183
+ probe: <T = any>(label: S, filePath: S, comp_name: S, fallback: T) => T;
184
+ guard_promise_gate: (get: A, name: string, fn: A, timeoutMs?: number) => () => Promise<R>;
185
+ };
186
+ module: {
187
+ <T = any>(module: S, filePath?: S): T | Promise<T>;
188
+ extract_named: (ns: A, comp_name: S) => A;
189
+ init: {
190
+ (label: S, module?: B): A;
191
+ named_export: (label: S, comp_name: S, cache?: B, module?: B) => A;
192
+ };
193
+ named_export: <T = any>(label: S, comp_name: S, module?: B) => A;
194
+ check: (moduleName: S) => Promise<B>;
195
+ isLoaded: (specifier: S) => B;
196
+ getLoaded: <T = any>(specifier: S) => OPT<T>;
197
+ /**
198
+ * Find a named export across every loaded module.
199
+ * Ambiguous finds throw — the index never silently guesses.
200
+ */
201
+ export_of: <T = any>(name: S, specifier?: S) => OPT<T>;
202
+ indexExports: (rift: A, key: S, mod: A) => void;
203
+ require: <T = any>(specifier: S) => T;
204
+ };
205
+ waiter: {
206
+ (deps: S | S[], fn: (v?: A) => V): N;
207
+ /** advance every multi-label waiter on this label */
208
+ releaseMulti: (k: S, v: A) => void;
209
+ cancel: (id: N) => B;
210
+ wait_and_promise: <T = any>(timeoutMs: N, key: S, isOpen: B, current: A) => Promise<T>;
211
+ };
212
+ defer: {
213
+ (deps: S | S[], fn: (...v: A[]) => A): N;
214
+ provide: (k: S | Record<S, A>, v?: A) => void;
215
+ resolve: (k: S) => void;
216
+ invalidate: (k: S) => B;
217
+ has: (k: S) => B;
218
+ get: <T = any>(k: S) => OPT<T>;
219
+ cancel: (id: N) => B;
220
+ ready: (task: DeferredTask) => B;
221
+ drain: () => V;
222
+ reportError: (task: DeferredTask, e: A) => void;
223
+ inspect: () => R;
224
+ clear: () => void;
225
+ onError: (e: A, id: N, deps: S[]) => void;
226
+ onSuccess: (id: N, deps: S[]) => void;
227
+ };
228
+ detect: {
229
+ (): void;
230
+ capability: (name: S) => B;
231
+ bundler: () => S | null;
232
+ firstMatch: (candidates: readonly S[]) => Promise<S | null>;
233
+ all: (candidates: readonly S[]) => Promise<S[]>;
234
+ environment: (env_lib?: S) => void;
235
+ type: (v: unknown) => "Array" | "ArrayBuffer" | "Buffer" | "Promise" | "URL" | "URLSearchParams" | "WeakMap" | "WeakSet" | "array" | "async-iterable" | "bigint" | "boolean" | "date" | "error" | "function" | "iterable" | "iterator" | "map" | "null" | "number" | "object" | "plainObject" | "regexp" | "set" | "string" | "symbol" | "thenable" | "undefined";
236
+ cloudSupport: () => B;
237
+ };
238
+ useEnvState: () => EnvDetectionState & {
239
+ rt: S;
240
+ subChannel: S;
241
+ };
242
+ apparation: any;
243
+ reset: () => void;
244
+ };
245
+ }
246
+ export {};
package/dist/index.js CHANGED
@@ -3691,12 +3691,11 @@ var src_Registry = /*#__PURE__*/ function(EventEmitter) {
3691
3691
  };
3692
3692
  }
3693
3693
  var key = keyOrFn;
3694
- // iterator form: no maybeFn, or second arg is an options object
3695
- if (maybeFn === undefined || (typeof maybeFn === "undefined" ? "undefined" : _type_of(maybeFn)) === "object" && maybeFn !== null) {
3696
- var iteratorOpts = (typeof maybeFn === "undefined" ? "undefined" : _type_of(maybeFn)) === "object" && maybeFn || opts;
3694
+ var maybeFnIsObject = maybeFn !== undefined && (typeof maybeFn === "undefined" ? "undefined" : _type_of(maybeFn)) === "object" && maybeFn !== null;
3695
+ if (maybeFn === undefined || maybeFnIsObject) {
3696
+ var iteratorOpts = maybeFnIsObject ? maybeFn : opts;
3697
3697
  return _class_private_method_get(this, _asIterator, asIterator).call(this, key, iteratorOpts);
3698
3698
  }
3699
- // callback form
3700
3699
  var fn1 = maybeFn;
3701
3700
  var set = _class_private_field_get(this, _subs).getOrM(function() {
3702
3701
  return new SET2();
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@the-w1zard/the-registry",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "sideEffects": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "exports": {
8
8
  ".": {
9
- "types": "./src/index.d.ts",
9
+ "types": "./dist/index.d.ts",
10
10
  "default": "./dist/index.js"
11
11
  }
12
12
  },
@@ -15,7 +15,7 @@
15
15
  "./src/index.d.ts"
16
16
  ],
17
17
  "scripts": {
18
- "build": "rspack build",
18
+ "build": "tsc --emitDeclarationOnly && rspack build",
19
19
  "build1": "rspack build",
20
20
  "dev": "rspack serve",
21
21
  "check": "tsc --noEmit"