@onebun/core 0.2.4 → 0.2.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.
package/package.json
CHANGED
|
@@ -886,8 +886,10 @@ export function getSseMetadata(
|
|
|
886
886
|
|
|
887
887
|
/**
|
|
888
888
|
* Module decorator metadata
|
|
889
|
+
* Stored on globalThis via Symbol.for() to survive package duplication in node_modules.
|
|
890
|
+
* When multiple copies of @onebun/core exist, they share the same metadata storage.
|
|
889
891
|
*/
|
|
890
|
-
const META_MODULES
|
|
892
|
+
const META_MODULES: Map<
|
|
891
893
|
Function,
|
|
892
894
|
{
|
|
893
895
|
imports?: Function[];
|
|
@@ -895,7 +897,8 @@ const META_MODULES = new Map<
|
|
|
895
897
|
providers?: unknown[];
|
|
896
898
|
exports?: unknown[];
|
|
897
899
|
}
|
|
898
|
-
|
|
900
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
901
|
+
> = ((globalThis as any)[Symbol.for('onebun:meta_modules')] ??= new Map());
|
|
899
902
|
|
|
900
903
|
/**
|
|
901
904
|
* Module decorator
|
|
@@ -932,9 +935,11 @@ export function getModuleMetadata(target: Function):
|
|
|
932
935
|
|
|
933
936
|
/**
|
|
934
937
|
* Storage for global modules
|
|
935
|
-
* Global modules export their providers to all modules automatically
|
|
938
|
+
* Global modules export their providers to all modules automatically.
|
|
939
|
+
* Stored on globalThis via Symbol.for() to survive package duplication in node_modules.
|
|
936
940
|
*/
|
|
937
|
-
|
|
941
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
942
|
+
const globalModules: Set<Function> = ((globalThis as any)[Symbol.for('onebun:global_modules')] ??= new Set());
|
|
938
943
|
|
|
939
944
|
/**
|
|
940
945
|
* @Global() decorator - marks module as global
|
package/src/module/module.ts
CHANGED
|
@@ -49,14 +49,18 @@ import {
|
|
|
49
49
|
/**
|
|
50
50
|
* Global services registry
|
|
51
51
|
* Stores services from modules marked with @Global() decorator
|
|
52
|
-
* These services are automatically available in all modules without explicit import
|
|
52
|
+
* These services are automatically available in all modules without explicit import.
|
|
53
|
+
* Stored on globalThis via Symbol.for() to survive package duplication in node_modules.
|
|
53
54
|
*/
|
|
54
|
-
|
|
55
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
56
|
+
const globalServicesRegistry: Map<Context.Tag<unknown, unknown>, unknown> = ((globalThis as any)[Symbol.for('onebun:global_services_registry')] ??= new Map());
|
|
55
57
|
|
|
56
58
|
/**
|
|
57
|
-
* Registry of processed global modules to avoid duplicate initialization
|
|
59
|
+
* Registry of processed global modules to avoid duplicate initialization.
|
|
60
|
+
* Stored on globalThis via Symbol.for() to survive package duplication in node_modules.
|
|
58
61
|
*/
|
|
59
|
-
|
|
62
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
63
|
+
const processedGlobalModules: Set<Function> = ((globalThis as any)[Symbol.for('onebun:processed_global_modules')] ??= new Set());
|
|
60
64
|
|
|
61
65
|
/**
|
|
62
66
|
* Clear global services registry (useful for testing)
|